colibri/scripts/fake-pi-agent.py
Sam & Hermes 3c10fc098e test: add Pi spawn path proof integration test
Validates: Colibri spawns agent process (fake-pi-agent.py) → reads
JSONL stdout → glasspane ingests → snapshot shows Done state with
correct session ID.

Uses scripts/fake-pi-agent.py which emits the colibri-pi-events
JSONL taxonomy (session, agent_start, turn_start, turn_end,
agent_end). Proves the spawn→ingest→glasspane pipeline without
requiring the real pi binary.

The real Pi binary path (when installed) follows the same pattern:
pi --mode json is spawned with identical spawner code.

Build: pass | Tests: 1/1 green | Workspace: all green
2026-05-31 16:23:11 +02:00

25 lines
684 B
Python
Executable file

#!/usr/bin/env python3
"""Fake Pi agent — emits JSONL in the colibri-pi-events format.
Used by Colibri integration tests to validate the spawn → JSONL → glasspane path.
"""
import sys
import json
import time
messages = [
{"type": "session", "id": f"pi-test-{int(time.time())}", "cwd": "/tmp"},
{"type": "agent_start"},
{"type": "turn_start"},
{"type": "message_start"},
{"type": "message_update", "delta": "Processing task..."},
{"type": "message_end"},
{"type": "turn_end", "stop": "end_turn"},
{"type": "agent_end"},
]
for msg in messages:
sys.stdout.write(json.dumps(msg) + "\n")
sys.stdout.flush()
time.sleep(0.01)
sys.exit(0)