The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: verify ordinary daemon slash actor isolation and handler scope
Teknium3cdf25cb2ff5
diff --git a/tests/gateway/test_session_commands.py b/tests/gateway/test_session_commands.pyindex f6f434b4f91..257a00dc74e 100644--- a/tests/gateway/test_session_commands.py+++ b/tests/gateway/test_session_commands.py@@ -42,7 +42,8 @@ def test_ordinary_daemon_slash_skill_uses_durable_fifo(tmp_path):env = {k: os.environ[k] for k in ('PATH', 'LANG', 'TZ') if k in os.environ}env.update(HOME=str(user), USERPROFILE=str(user), HERMES_HOME=str(home),PYTHONPATH=str(root), PYTHONUNBUFFERED='1',- OPENAI_API_KEY='loopback-only', OPENAI_BASE_URL=url)+ OPENAI_API_KEY='loopback-only', OPENAI_BASE_URL=url,+ HERMES_DASHBOARD_SESSION_TOKEN='owned-slash-negative')receipts = []def rows():@@ -64,6 +65,9 @@ def test_ordinary_daemon_slash_skill_uses_durable_fifo(tmp_path):help_reply = await command(command='help')assert help_reply.get('result', {}).get('output'), help_reply+ for read_command in ('commands', 'context', 'version', 'whoami'):+ read_reply = await command(command=read_command)+ assert read_reply.get('result', {}).get('output'), read_replystatus = await command(command='status')assert sid in status['result']['output'], statusfor method, params in [('slash.exec', {'command': 'probe-quick TASK_ONE'}),@@ -98,6 +102,14 @@ def test_ordinary_daemon_slash_skill_uses_durable_fifo(tmp_path):({'command': 'approve'}, 'unsupported_command')]:denied = await command(**params)assert denied['error']['message'] == reason, denied+ # A second valid credential is a different actor, not session ownership.+ other_url = desc['api_origin'].replace('http:', 'ws:') + '/api/ws?token=owned-slash-negative'+ async with connect(other_url) as other:+ for method, payload in [('slash.exec', {'command': 'title stolen'}),+ ('command.dispatch', {'name': 'title', 'arg': 'stolen'})]:+ denied = await rpc(other, method, session_id=sid, **payload)+ receipts.append(denied)+ assert denied.get('error', {}).get('message') == 'permission_denied', deniedpeer.release.set()async with asyncio.timeout(45):while any(row[1] != 'terminal' for row in rows()):diff --git a/website/docs/developer-guide/gateway-internals.md b/website/docs/developer-guide/gateway-internals.mdindex 6a124c46215..62d79f8eb58 100644--- a/website/docs/developer-guide/gateway-internals.md+++ b/website/docs/developer-guide/gateway-internals.md@@ -22,6 +22,32 @@ publishes this state before `message.complete`, retaining the terminal event aslast event of that turn. Desktop translates both paths into its existing`pending_submissions` queue store.+## Shared authority local slash commands++Authenticated local sessions accept `slash.exec({session_id, command})` and+`command.dispatch({session_id, name, arg})`. Both use the existing command registry+and gateway handlers, without a legacy slash worker or second execution runtime.+An optional `profile` selector must match the owning daemon's profile. Caller source+and routing overrides are rejected; another authenticated actor cannot operate the+session.++Supported read commands are `/help`, `/commands`, `/status`, `/context`, `/version`,+and `/whoami` (`session:read`). `/title` requires `session:control`, even for a query,+and retains the existing busy rejection. Registry aliases work. Handler results use+`{type: "exec", output}`.++Skill names and configured quick-command aliases to supported commands or skills+are resolved in the owner's profile. Skill resolution requires `session:submit` and+returns `{type: "skill", name, message, display}`. Desktop/Ink send the expanded+message through their normal identified `prompt.submit`; resolution is not an+admission ACK. The authority's durable FIFO owns retries and execution, and skill+content remains a user message without changing the cached system prefix.++Other commands return `unsupported_command`: shell quick commands, plugin execution,+bundles, configuration/runtime changes, lifecycle commands, and approval/secret+slash shortcuts are not exposed. Existing generation-bound approval and interrupt+RPCs remain separate. Catalog discovery is broader than this reviewed execution set.+## Shared authority setup readinessAuthenticated local clients can call `setup.status` and `setup.runtime_check` before