feat: add persisted manual pi backend mode controls

This commit is contained in:
William Valentin
2026-02-23 23:06:40 -08:00
parent 3e5e82c76e
commit 4188c68130
14 changed files with 360 additions and 10 deletions
@@ -11,6 +11,7 @@ If you only want the protocol surface, see `docs/api/PROTOCOL.md`.
- Agent work is queued per `sessionId` (FIFO), not per connection.
- Sessions persist in SQLite via `SessionManager` even if clients disconnect.
- Once dequeued, message routing may execute the native orchestrator path or an optional external backend path (`claude_code`, `opencode`, `codex`, `gemini`, `pi_embedded`) depending on agent/backend config.
- Runtime backend mode can be overridden manually via `/backend` command fast-path (`status`, `activate pi`, `deactivate pi`, `use config`) and is persisted in preferences.
- Backend routing outcomes are auditable via `backend.route` / `backend.success` / `backend.fallback`, which enables offline canary evaluation without changing gateway protocol methods.
## Component Map
@@ -19,6 +20,7 @@ If you only want the protocol surface, see `docs/api/PROTOCOL.md`.
flowchart LR
subgraph CFG[Config + Runtime Policy]
QP[server.queue policy\nmode/cap/overflow/overrides]
BM[backend runtime mode\nconfig_default|force_native|force_pi_embedded]
end
subgraph GW[Gateway Process]
@@ -37,6 +39,7 @@ flowchart LR
WS --> GS
QP --> GS
BM --> GS
GS --> LQ
GS --> SB
LQ --> AQ