diff --git a/plugins/memory/honcho/config_schema.py b/plugins/memory/honcho/config_schema.py index 827732898c..fdd778d68f 100644 --- a/plugins/memory/honcho/config_schema.py +++ b/plugins/memory/honcho/config_schema.py @@ -105,6 +105,11 @@ CONFIG_SCHEMA = ProviderConfigSchema( default="false", group="Recall"), _field("contextTokens", "Context token cap", KIND_NUMBER, "Cap on auto-injected context tokens. Blank leaves it uncapped.", placeholder="(uncapped)", group="Recall"), + # The plugin reads `injection` as one object, so the panel edits the whole block rather than a nested key. + _field("injection", "Session-start injection", KIND_JSON, + "Pin which base-context sections the first turn injects: summary, peerRepresentation, peerCard, " + "aiRepresentation, aiCard. Blank injects all of them; an empty list injects nothing.", + placeholder='{"sessionStart": ["summary", "peerCard"]}', group="Recall"), _field("initOnSessionStart", "Eager init", KIND_BOOL, "Initialize the session eagerly in tools mode instead of on first tool call.", default="false", group="Recall"), # — Limits — diff --git a/tests/honcho_plugin/test_session.py b/tests/honcho_plugin/test_session.py index 9e11593907..5534e24d02 100644 --- a/tests/honcho_plugin/test_session.py +++ b/tests/honcho_plugin/test_session.py @@ -1317,6 +1317,22 @@ class TestSessionStartInjection: formatted = _provider_with_raw(raw)._format_first_turn_context(_FULL_CTX) assert [line for line in formatted.splitlines() if line.startswith("## ")] == headings + @pytest.mark.parametrize("submitted, headings", [ + ('{"sessionStart": ["peerCard"]}', ["## User Peer Card"]), + ('{"sessionStart": []}', []), + ("", ["## Session Summary", "## User Representation", "## User Peer Card", + "## AI Self-Representation", "## AI Identity Card"]), + ], ids=["pin", "empty-list", "blank-clears-the-pin"]) + def test_desktop_panel_writes_the_pin_the_provider_reads(self, submitted, headings): + from hermes_cli.web_routers.memory_providers import _apply_field_values + from plugins.memory.honcho.config_schema import CONFIG_SCHEMA + + host_block = {"injection": {"sessionStart": ["summary"]}} + _apply_field_values(CONFIG_SCHEMA, {"injection": submitted}, lambda field: host_block) + raw = {"hosts": {"hermes": host_block}} + formatted = _provider_with_raw(raw)._format_first_turn_context(_FULL_CTX) + assert [line for line in formatted.splitlines() if line.startswith("## ")] == headings + def test_non_list_value_is_treated_as_unset(self): raw = {"injection": {"sessionStart": "summary"}} assert _provider_with_raw(raw)._session_start_components is None