Skip to main content

Module rpc

Module rpc 

Source
Expand description

RPC mode: commands read from stdin and the responses written to stdout, as in modes/rpc/rpc-types.ts of pi v1.0.0. Events use the JSON mode shapes in crate::event.

Structs§

BashResult
What a user ! command produced: the bash response data.
ContextUsage
How full the context window is; tokens and percent are null while unknown.
ExtensionUiResponse
An extension_ui_response line on stdin.
ForkMessage
A fork point in get_fork_messages data.
SessionState
get_state data.
SessionStats
get_session_stats data.
SlashCommand
A command a prompt can invoke, in get_commands data.
SourceInfo
Where a resource was found, as pi’s SourceInfo: source is auto for discovered files, cli for command-line paths and the package for package resources; scope is user, project or temporary.
TokenTotals
Token totals in SessionStats.
TreeNode
One node of get_tree data, as pi’s SessionTreeNode.

Enums§

CommandSource
Where a SlashCommand comes from.
PromptDisposition
What became of a prompt once it passed preflight.
RpcCommand
A command line on stdin, without its id.
StreamingBehavior
How a prompt sent while the agent runs is queued.

Functions§

response_line
A response line: data is serialized JSON, or absent. A line without a type gets a response without command, as JSON.stringify drops pi’s undefined.
tree_json
Serializes the trees under roots without recursion, so a long linear session cannot exhaust the stack.