Context
Building a Tauri/React GUI (codegraff-zig/gui) on top of a persistent graff --json session per conversation. Streaming (text/tool_call/tool_result/turn/error) works well.
Problem
The --json stdio protocol currently accepts only three request types — user, set_system_prompt, score (per --schema → protocol). Several GUI controls map to graff REPL commands that act on the live session and have no protocol equivalent, so a persistent --json session can't drive them:
- Model switch (
/model): the GUI can only set the model at spawn (--model). Switching mid-conversation requires killing + respawning the child, which loses context.
- Compaction (
/compact): the GUI can't compact the live session's context (today it shows only a cosmetic marker).
- Plan mode toggle (
/plan): read-only mode can't be entered/exited per turn.
- Agent switch (
/agents).
Proposal
Add request types to the stdio protocol (and mirror over serve), each acked with an event — same pattern as set_system_prompt:
Same KV-cache caveat as set_system_prompt applies (mutations at turn boundaries). Happy to implement once the shape is agreed.
Context
Building a Tauri/React GUI (
codegraff-zig/gui) on top of a persistentgraff --jsonsession per conversation. Streaming (text/tool_call/tool_result/turn/error) works well.Problem
The
--jsonstdio protocol currently accepts only three request types —user,set_system_prompt,score(per--schema→protocol). Several GUI controls map tograffREPL commands that act on the live session and have no protocol equivalent, so a persistent--jsonsession can't drive them:/model): the GUI can only set the model at spawn (--model). Switching mid-conversation requires killing + respawning the child, which loses context./compact): the GUI can't compact the live session's context (today it shows only a cosmetic marker)./plan): read-only mode can't be entered/exited per turn./agents).Proposal
Add request types to the stdio protocol (and mirror over
serve), each acked with an event — same pattern asset_system_prompt:{"type":"set_model","name":"deepseek-v4-pro"} // -> {"type":"model","ok":true,"name":"..."} {"type":"compact"} // -> compaction ack / turn {"type":"set_mode","mode":"plan"|"normal"} // -> {"type":"mode","ok":true,"mode":"..."} {"type":"set_agent","id":"..."} // -> {"type":"agent","ok":true,"id":"..."}Same KV-cache caveat as
set_system_promptapplies (mutations at turn boundaries). Happy to implement once the shape is agreed.