mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-21 07:55:08 +00:00
feat(desktop): schema-driven memory-provider config surface
Make the desktop memory settings dynamic instead of hardcoded per
provider. The dropdown is now populated from discover_memory_providers()
(bundled + user-installed + pip) rather than a static enum, and each
provider's config panel is derived from its own get_config_schema() —
the same declaration `hermes memory setup` uses — so adding or porting a
provider is pure declaration with no bespoke UI, conditional, or
endpoint.
- memory_providers.py: reworked from a hand-written Hindsight registry
into a pure adapter (describe_provider + coerce_value) that normalizes
a provider's raw schema into typed fields — secret(+env), select,
boolean, typed text — carrying `when` conditionals, url, and required.
- MemoryProvider ABC: add optional read_current_config() (default {}),
the read-back mirror of save_config(). Ported mem0, hindsight, honcho,
holographic; the rest fall back to schema defaults safely.
- web_server GET/PUT /api/memory/providers/{name}/config now load the
live provider, derive its schema, write non-secrets via the provider's
own save_config() (each keeps its native storage), persist secrets to
the env store, and `when`-gate validation so hidden fields aren't
required or written. Secrets stay write-only (is_set only).
- ProviderConfigPanel: `when`-conditional visibility (handles Hindsight's
mode-gated duplicate keys), boolean toggle, and credential url links.
Dropdown driven by getMemoryStatus(); hardcoded enum removed.
Tests assert the mapping contract and endpoint behavior (schema
derivation, save-via-save_config, secret-never-returned, when-gating,
select rejection) against real bundled providers rather than a snapshot
of a hardcoded list.
This commit is contained in:
parent
03d9a95a74
commit
e48d18c8e2
16 changed files with 770 additions and 291 deletions
|
|
@ -276,6 +276,27 @@ class MemoryProvider(ABC):
|
|||
should all have ``env_var`` set and this method stays no-op).
|
||||
"""
|
||||
|
||||
def read_current_config(self) -> Dict[str, Any]:
|
||||
"""Return persisted config values for schema-driven setup UIs.
|
||||
|
||||
Powers the desktop memory-provider config panel (and any other
|
||||
editor built off ``get_config_schema()``): on open, declared fields
|
||||
are pre-filled with the values the provider previously saved via
|
||||
``save_config()``. The mirror image of ``save_config()`` — it reads
|
||||
back what that wrote.
|
||||
|
||||
Return the provider's stored config as a flat dict keyed by the same
|
||||
``key`` names used in ``get_config_schema()``. Secret values may be
|
||||
included or omitted; callers MUST treat fields marked ``secret`` as
|
||||
write-only and never echo them back regardless. Default returns
|
||||
``{}`` (the UI falls back to schema defaults). Providers that persist
|
||||
non-secret config should override this — usually a one-liner
|
||||
delegating to the same loader ``initialize()`` uses.
|
||||
|
||||
Must not raise — return ``{}`` on any error.
|
||||
"""
|
||||
return {}
|
||||
|
||||
def on_memory_write(
|
||||
self,
|
||||
action: str,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue