Skip to main content

Module protocol

Module protocol 

Source
Expand description

JSONL framing, JSON-RPC 2.0 types, RPC command/response/event types, and serialization helpers.

Structs§

CommandInfo
Command info for get_commands response
CompactionResult
Result of compaction
ImageData
Image data for RPC commands
JsonRpcError
JSON-RPC 2.0 error object
JsonRpcErrorResponse
JSON-RPC 2.0 error response
JsonRpcRequest
JSON-RPC 2.0 request
JsonRpcSuccessResponse
JSON-RPC 2.0 success response
JsonlLineReader
A strict JSONL line reader that splits on LF only (not CR or other separators). This is important because JSON strings may contain U+2028/U+2029 which Node.js readline would incorrectly split on.
ModelInfo
Model information for session state
PendingExtensionRequest
Tracks pending extension UI requests awaiting client responses.
RpcImageSource
Base64-encoded image data
RpcOutput
Thread-safe output writer that ensures atomic JSONL writes.
SessionHandoff
Information about a session for handoff between processes.
SessionState
Session state for get_state response
SessionStats
Result of a session stat query
SourceInfo
Source info for command provenance

Enums§

RpcCommand
RPC command from client
RpcEvent
Events emitted by the RPC server to the client during streaming.
RpcExtensionUiRequest
Extension UI request
RpcExtensionUiResponse
Extension UI response from client
RpcResponse
RPC response to client

Constants§

JSONRPC_INTERNAL_ERROR
JSON-RPC internal error code.
JSONRPC_INVALID_PARAMS
JSON-RPC invalid params error code.
JSONRPC_INVALID_REQUEST
JSON-RPC invalid request error code.
JSONRPC_METHOD_NOT_FOUND
JSON-RPC method-not-found error code.
JSONRPC_PARSE_ERROR
JSON-RPC parse error code.

Functions§

jsonrpc_to_command
Map a JSON-RPC 2.0 method + params to an internal RPC command value.
parse_json_line
Parse a JSONL line, trimming any trailing CR.
rpc_response_to_jsonrpc
Convert an internal RpcResponse to a JSON-RPC 2.0 response.
serialize_json_line
Serialize a value as a strict JSONL record (JSON + LF).
serialize_json_line_obj
Serialize a serializable value as a JSONL record.