The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): bind the session's workspace for local slash discovery and skill dispatch
yoniebans9de32e7be98e
diff --git a/gateway/session_commands.py b/gateway/session_commands.pyindex 164ebaa7a8f..e5e24a02d90 100644--- a/gateway/session_commands.py+++ b/gateway/session_commands.py@@ -255,7 +255,7 @@ async def execute_command(connection, ref, params, *, dispatch=False):return {'type': 'exec', 'output': _text(output)}if definition is None:def build():- with _profile_runtime_scope(home):+ with _profile_runtime_scope(home), _session_workspace(authority.runner, live.source):return _skill_directive(name, arg, live.route)return await asyncio.to_thread(build)diff --git a/gateway/session_discovery.py b/gateway/session_discovery.pyindex fd0074bf1e3..2c514b35d97 100644--- a/gateway/session_discovery.py+++ b/gateway/session_discovery.py@@ -8,10 +8,18 @@ from hermes_state_runtime import RuntimeStoreErrorasync def discover_commands(authority, actor, params, *, completion=False):if 'session:read' not in actor.capabilities or actor.profile_id != authority.profile_id:raise RuntimeStoreError('permission_denied')- allowed = {'profile', 'text', 'session_id'} if completion else {'profile'}+ allowed = {'profile', 'text', 'session_id'} if completion else {'profile', 'session_id'}if (not isinstance(params, dict) or set(params) - allowedor any(not isinstance(value, str) for value in params.values())):raise RuntimeStoreError('invalid_params')+ scope = None+ if params.get('session_id'):+ # Project skills resolve from the session's workspace, not the gateway process cwd.+ from gateway.session_commands import _session_workspace+ from gateway.session_contract import SessionRef+ ref = SessionRef(authority.profile_id, params['session_id'])+ authority.authorize(actor, ref, 'session:read')+ scope = _session_workspace(authority.runner, authority.sessions[ref.session_id].source)def discover():from hermes_cli.profiles import profile_matches_home@@ -21,6 +29,7 @@ async def discover_commands(authority, actor, params, *, completion=False):from gateway.run import _profile_runtime_scopefrom tui_gateway.command_discovery import command_catalog, slash_completionswith _profile_runtime_scope(home):- return slash_completions(params.get('text', '')) if completion else command_catalog()+ return (slash_completions(params.get('text', ''), scope=scope) if completion+ else command_catalog(scope=scope))return await asyncio.to_thread(discover)