The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: exercise native Stop through the Python Ink launcher
Tekniumc75e0cdd76a1
diff --git a/ui-tui/CANONICAL_GATEWAY.md b/ui-tui/CANONICAL_GATEWAY.mdindex 66c11d696b3..4779b3421cf 100644--- a/ui-tui/CANONICAL_GATEWAY.md+++ b/ui-tui/CANONICAL_GATEWAY.md@@ -65,8 +65,10 @@ Optional mode argument after the receipt directory:- `startup`: absent owner → native Ink ensure → one fresh TUI-policy session and reply.- `launcher`: the same fresh path through `python -m hermes_cli.main --tui chat -q ...`,using the supported prebuilt `HERMES_TUI_DIR` path (no dependency install).-- `stop` / `stop-control`: hold the loopback inference stream before a harmless- fixture-owned tool effect. Native Ctrl+C must receive the real generation-bearing+- `stop` / `stop-control` / `stop-launcher`: hold the loopback inference stream before a harmless+ fixture-owned tool effect. `stop-launcher` starts the viewer through the Python+ launcher and discovers its one fresh TUI-policy session, without seeding one.+ Native Ctrl+C must receive the real generation-bearingacknowledgement and suppress that effect; the no-Stop control must execute it.Both then type a fresh prompt and require rendered and persisted completion.These modes run the ordinary daemon entry via `native_stop_probe.py`, whosediff --git a/ui-tui/scripts/native_canonical_probe.py b/ui-tui/scripts/native_canonical_probe.pyindex 3bbe97b0cb6..cf619c98124 100644--- a/ui-tui/scripts/native_canonical_probe.py+++ b/ui-tui/scripts/native_canonical_probe.py@@ -37,7 +37,7 @@ def run():user = base / 'user'user.mkdir()peer_class = ModelPeer- stopping = kind in ('stop', 'stop-control')+ stopping = kind in ('stop', 'stop-control', 'stop-launcher')if stopping:from native_stop_probe import StopPeerpeer_class = StopPeer@@ -109,7 +109,7 @@ def run():if query:launch_env['HERMES_TUI_QUERY'] = queryargv = ['node', str(ROOT / 'ui-tui/dist/entry.js')]- if kind == 'launcher':+ if kind in ('launcher', 'stop-launcher'):# Exercise the actual parser and Python launcher, using the# supported prebuilt path so shared dependencies stay read-only.launch_env.update(HERMES_TUI_DIR=str(ROOT / 'ui-tui'), TMPDIR=str(base))@@ -178,8 +178,12 @@ def run():else:raise AssertionError('daemon bootstrap readiness timeout')receipts['instance_id'] = g['instance_id']- sid = asyncio.run(seed())+ sid = None if kind == 'stop-launcher' else asyncio.run(seed())first = launch('first', sid, 'WS_SHARED')+ if kind == 'stop-launcher':+ from native_stop_probe import created_session_id+ sid = asyncio.run(created_session_id(grant, rpc, connect))+ receipts.update(session_id=sid, python_launcher=True)if stopping:from native_stop_probe import exerciseexercise(kind, model, first, sid, grant, rpc, connect, home, receipts, Path(sys.argv[1]))diff --git a/ui-tui/scripts/native_stop_probe.py b/ui-tui/scripts/native_stop_probe.pyindex c1542780b93..5268b1ca6d0 100644--- a/ui-tui/scripts/native_stop_probe.py+++ b/ui-tui/scripts/native_stop_probe.py@@ -59,6 +59,21 @@ class StopPeer(BaseHTTPRequestHandler):self.wfile.flush()+async def created_session_id(grant, rpc, connect):+ g = grant()+ async with connect(g['url'], subprotocols=g['protocols']) as ws:+ async with asyncio.timeout(15):+ while True:+ inventory = await rpc(ws, 'session.list')+ if inventory['sessions']:+ assert len(inventory['sessions']) == 1, inventory+ sid = inventory['sessions'][0]['session_id']+ info = await rpc(ws, 'session.info', session_id=sid)+ assert info['source'] == 'tui', info+ return sid+ await asyncio.sleep(.05)++def exercise(kind, model, first, sid, grant, rpc, connect, home, receipts, destination):def wait(predicate, seconds=15):deadline = time.monotonic() + seconds@@ -71,7 +86,7 @@ def exercise(kind, model, first, sid, grant, rpc, connect, home, receipts, destiwait(lambda: model.blocked.is_set() and b'STOP_RUNNING' in first[2])control = home / 'native-control-receipts.jsonl'- if kind == 'stop':+ if kind in ('stop', 'stop-launcher'):os.write(first[1], b'\x03')wait(lambda: control.exists())wire = [json.loads(line) for line in control.read_text().splitlines()]