Fork of backnotprop/plannotator with reduced surface area

feat(ai): Pi provider via RPC subprocess (#377)

* refactor(ai): extract BaseSession and buildEffectivePrompt Pull shared session lifecycle (~80 lines duplicated across Claude and Codex providers) into BaseSession: query guard, abort, ID resolution, generation counter. Extract first-query prompt prepending into buildEffectivePrompt() in context.ts. Both providers now extend BaseSession. Behavior-preserving — all 54 existing tests pass unchanged. For provenance purposes, this commit was AI assisted. * feat(ai): add Pi provider via RPC subprocess Spawns `pi --mode rpc` and communicates via JSONL over stdio. No Pi SDK bundled — user must have the pi CLI installed. Provider auto-discovers available models at startup via get_available_models. Includes: PiProcess (JSONL client), PiSDKProvider, PiSDKSession extending BaseSession, mapPiEvent for streaming, Pi icon in provider UI, and 12 new tests (9 event mapping + 3 buildEffectivePrompt). For provenance purposes, this commit was AI assisted. * fix(ai): harden Pi provider error paths - Surface startup errors when Pi process dies (bad config, missing API keys) instead of hanging the chat indefinitely - Map tool-call errors as non-terminal tool_result instead of AIErrorMessage, so Pi can continue reasoning after a failed tool call - Fix subprocess leak in fetchModels() by moving proc.kill() to finally block For provenance purposes, this commit was AI assisted. * fix(ai): detect Pi prompt rejections and process crashes - Use sendAndWait for prompt command so RPC-level rejections (expired credentials, invalid session) surface as errors instead of hanging - Emit process_exited instead of synthetic agent_end when Pi subprocess dies, so crashes show as errors instead of silent empty successes For provenance purposes, this commit was AI assisted. * docs(ai): add Pi to AI features guide, code review docs, and installation For provenance purposes, this commit was AI assisted. * style(ai): apply biome formatting to new files For provenance purposes, this commit was AI assisted.


Author Michael Ramos Committer GitHub Date Commit Parent b675e867
+918 -135
15 changed files
+918 -135
15 changed files