Expand description
Typed models of pi’s wire vocabulary: the messages and events shared
by --mode json (one-shot JSONL event stream) and --mode rpc
(command protocol; see crate::rpc).
Shapes mirror the documented TypeScript types
(packages/ai/src/types.ts, packages/agent/src/types.ts, and
packages/coding-agent/docs/{json,rpc}.md in earendil-works/pi).
Unknown event types are preserved verbatim in PiEvent::Unknown
rather than erroring, so a newer CLI degrades soft.
Structs§
- Model
- A model catalog entry (
get_state/set_model/get_available_models). With no provider configured,get_statereturns a placeholder withid: "unknown"and zeroed limits — treatcontextWindow == 0as “no real model resolved”. - Usage
- Per-request/response token accounting on assistant and tool messages.
- Usage
Cost - Dollar cost breakdown inside
Usage.
Enums§
- Content
Block - One block of assistant content: text, thinking, or a tool call.
- PiEvent
- One event from the
--mode json/--mode rpcstdout stream, discriminated ontype. Known lifecycle events are typed with their primary fields lifted; every variant keeps its full payload reachable (unmodeled fields land inextra), and unknowntypes fall back toPiEvent::Unknowninstead of erroring. - PiMessage
- A conversation message, discriminated on
role. This is pi’sAgentMessageunion plus the RPC-onlybashExecutionrole.