Skip to content

feat(slim-bindings): hierarchical config loading and stable identity - #1867

Open
Tehsmash wants to merge 4 commits into
mainfrom
feat/hierarchical-slim-config-loading
Open

feat(slim-bindings): hierarchical config loading and stable identity#1867
Tehsmash wants to merge 4 commits into
mainfrom
feat/hierarchical-slim-config-loading

Conversation

@Tehsmash

@Tehsmash Tehsmash commented Jul 16, 2026

Copy link
Copy Markdown
Member

Description

This PR ports the hierarchical SLIM configuration loading feature from the slim-bindings PR #21 into the SLIM monorepo, and then lifts the core logic into agntcy-slim-service so any Rust consumer can use it without the UniFFI layer.

Commit 1 — feat(slim-bindings): hierarchical config loading and stable identity

Adds crates/slim-bindings/src/slim_node_config.rs and extends crates/slim-bindings/src/service.rs with:

  • SlimConfig / SlimAppConfig UniFFI record types
  • load_slim_config() — git-style slim.yaml discovery + env-var overrides
  • Service::create_app_from_slim_config — one-call API: load config → init identity → connect → subscribe → return SlimAppHandle
  • Signature key caching in .slim-cache/ for stable agent identity across restarts

Commit 2 — feat(service): add slim-config feature with hierarchical config loading

Moves the config-loading logic into agntcy-slim-service behind a new slim-config Cargo feature, so downstream consumers using core crates directly can benefit:

  • New crates/service/src/node_config.rs module using core types (slim_config::client::ClientConfig, slim_config::auth::identity::*)
  • Service::create_app_from_slim_config(&self, config: SlimNodeConfig) -> Result<AppHandle, ServiceError> (gated on slim-config + session)
  • AppHandle struct bundling app, notification receiver, name, and conn_id
  • #[serde(default)] added to IdentityProviderConfig::SharedSecret::id so the field is optional in YAML
  • slim-bindings refactored to delegate to the service crate — load_slim_config and create_app_from_slim_config are now thin FFI adapters

Type of Change

  • New Feature
  • Refactor

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

@Tehsmash
Tehsmash requested a review from a team as a code owner July 16, 2026 13:52
@Tehsmash
Tehsmash force-pushed the feat/hierarchical-slim-config-loading branch from b37ad00 to 97908db Compare July 17, 2026 15:15
@micpapal

Copy link
Copy Markdown
Member

once #1820 is merged I think we can remove the slim-cache file as the keys are already store in the DB. We can add a new filed in slim.yaml that should look like

node:
  endpoint: "http://localhost:46357"

app:
  name: "agntcy/default/receiver"
  identity:
    type: shared_secret
    data: "slim-dev-shared-secret-change-in-production"
  identity_verifier:
    type: shared_secret
    data: "slim-dev-shared-secret-change-in-production"

persistence:
  path: "~/.slim/state"        # where the SQLite DB lives
  # passphrase: "..."          # optional, for real at-rest encryption

using create_app_with_direction_and_persistence we should be able to recreate the app and all the related session.

@Tehsmash
Tehsmash force-pushed the feat/hierarchical-slim-config-loading branch 2 times, most recently from 4013f36 to e01d2f8 Compare July 24, 2026 15:49
Tehsmash added 4 commits July 28, 2026 18:04
Implements #1802 — hierarchical slim.yaml config discovery
with env var overrides and persistent identity (signature key) caching.

- Walks up from CWD for slim.yaml; falls back to ~/.slim/config.yaml
- Env var overrides: SLIM_NODE_ADDRESS, SLIM_APP_NAME, SLIM_IDENTITY_*
- Caches instance UUID and Ed25519 keys in .slim-cache/ next to config
- Service.create_app_from_slim_config: one-call API → ready App
- Serde added to all public config types (no more Raw* intermediaries)
- Name::new_with_id returns Result<Self, SlimError> instead of panicking

Ported from agntcy/slim-bindings#21.

Signed-off-by: Sam Betts <1769706+Tehsmash@users.noreply.github.com>
Signed-off-by: Sam Betts <1769706+Tehsmash@users.noreply.github.com>
…fline notification

Signed-off-by: Sam Betts <1769706+Tehsmash@users.noreply.github.com>
Remove double-conversion round-trips in slim_node_config.rs
(ffi_app_to_core/core_app_to_ffi used an intermediate FFI→FFI step
before the FFI→Core From impl, which is a no-op). Also remove
stray double blank line in service.rs and trailing blank line in
the node_config test module.

Signed-off-by: Sam Betts <1769706+Tehsmash@users.noreply.github.com>
@Tehsmash
Tehsmash force-pushed the feat/hierarchical-slim-config-loading branch from e01d2f8 to c1b3cee Compare July 28, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants