Native pi spawning in Daemon.hs (remove pi_rpc.py)

t-539.2·WorkTask·
·
·
Parent:t-539·Created2 weeks ago·Updated2 weeks ago

Description

Edit

Remove pi_rpc.py and implement native pi spawning in Haskell.

Current state:

  • Daemon.hs calls python pi_rpc.py daemon --socket ... --webhook ...
  • pi_rpc.py spawns pi --mode rpc and manages Unix socket

Target state:

  • Daemon.hs spawns pi --mode rpc directly
  • Daemon.hs handles Unix socket JSON-RPC communication natively
  • Delete tools/pi_rpc.py

Implementation: 1. Update spawnPiAgent in Daemon.hs to spawn pi --mode rpc directly 2. Pi's --mode rpc reads JSON from stdin, writes to stdout (newline-delimited) 3. Use Haskell async to manage the process and pipe communication 4. Reuse existing sendJsonRpc for socket communication (already in Daemon.hs) 5. Webhook notifications can be HTTP POSTs from Haskell (already have HTTP deps)

The JSON-RPC helpers in Daemon.hs and Pi.hs already exist - just need to wire them to spawn pi directly instead of through the Python wrapper.

Timeline (6)

🔄[human]Open → InProgress2 weeks ago
💬[human]2 weeks ago

Updated Omni/Agentd/Daemon.hs to spawn pi --mode rpc directly with native stdin/stdout handling, live status tracking, cost/summary extraction, webhooks, and DB schema updates. typecheck.sh passes. tools/pi_rpc.py still exists for legacy Ava Web pi endpoints; can remove once we migrate or deprecate those endpoints.

🔄[human]InProgress → Done2 weeks ago
💬[human]2 weeks ago

Removed tools/pi_rpc.py and Omni/Ava/Agent/Pi.hs; Omni/Agentd/Daemon.hs now spawns pi directly. Migrated Omni/Ava/Web.hs agent control plane endpoints to call agentd HTTP API (spawn/send/stop) and updated webhook handling to accept agentd payloads.