Expand description
RPC mode for headless operation
Implements a JSONL-over-stdio protocol for embedding oxicode in other applications. Commands are received as JSON lines on stdin, responses and events are emitted as JSON lines on stdout.
§Protocol
- Commands: JSON objects with a
typefield and optionalidfor correlation - Responses: JSON objects with
type: "response",command,success, and optionaldata/error - Events:
AgentEventobjects streamed as they occur - Extension UI: Extension UI requests emitted to client; client responds with
extension_ui_response - JSON-RPC 2.0: Alternatively supports JSON-RPC 2.0 framing (detected by
jsonrpcfield)
§Framing
Strict JSONL (JSON Lines): each record is a single JSON object terminated by \n (LF).
Carriage returns inside payloads are preserved; records are split on \n only.
Re-exports§
pub use handlers::run_rpc_mode;pub use protocol::CommandInfo;pub use protocol::CompactionResult;pub use protocol::ImageData;pub use protocol::JSONRPC_INTERNAL_ERROR;pub use protocol::JSONRPC_INVALID_PARAMS;pub use protocol::JSONRPC_INVALID_REQUEST;pub use protocol::JSONRPC_METHOD_NOT_FOUND;pub use protocol::JSONRPC_PARSE_ERROR;pub use protocol::JsonRpcError;pub use protocol::JsonRpcErrorResponse;pub use protocol::JsonRpcRequest;pub use protocol::JsonRpcSuccessResponse;pub use protocol::JsonlLineReader;pub use protocol::ModelInfo;pub use protocol::PendingExtensionRequest;pub use protocol::RpcCommand;pub use protocol::RpcEvent;pub use protocol::RpcExtensionUiRequest;pub use protocol::RpcExtensionUiResponse;pub use protocol::RpcImageSource;pub use protocol::RpcOutput;pub use protocol::RpcResponse;pub use protocol::SessionHandoff;pub use protocol::SessionState;pub use protocol::SessionStats;pub use protocol::SourceInfo;pub use protocol::jsonrpc_to_command;pub use protocol::parse_json_line;pub use protocol::rpc_response_to_jsonrpc;pub use protocol::serialize_json_line;pub use protocol::serialize_json_line_obj;pub use utils::BoxedEventListener;pub use utils::PasteHandler;pub use utils::PasteState;pub use utils::RpcClient;pub use utils::RpcClientConfig;