Expand description
Shared wire protocol for rpi’s headless RPC mode (--mode rpc, the server)
and the remote client (--connect).
Single source of truth: the server serializes these types and the client deserializes them, so the contract cannot drift between the two ends.
Wire shape (one JSON object per line):
- the server opens with
{"type":"ready"}, then - streams
RemoteEvents ({"type":"agent_start"},{"type":"message_update",…}, …), and - answers each
RemoteCommandwith aRemoteResponse({"type":"response",…}).
These are intentionally not the core pi-agent/pi-ai types: AgentEvent
is documented as process-local (see pi-agent/src/events.rs) and deliberately
has no serde impl. This module projects the process-local events into a
stable, wire-safe shape, and translates back only the subset the client needs.
That keeps the core crates untouched and the client free of local resources.
Structs§
- Prompt
Outcome - The
promptresult payload ({outcome, finalText}). - Remote
Response - The server’s answer to a single
RemoteCommand. - Session
State - The
get_stateresult payload, as a typed view over the response.
Enums§
- Remote
Command - A command sent from the client to the server (
{"id":…,"type":…,…}). - Remote
Event - A fine-grained lifecycle event streamed from the server to the client.
- Response
Status - Response status for a
RemoteResponse.
Functions§
- tool_
result_ json - Serialize a tool result into the stable wire shape (content blocks, details, usage, and the batch hints).