Module rpc

Module rpc 

Source
Expand description

JSON RPC IPC server for subagent communication.

Provides a JSON RPC 2.0 protocol for inter-process communication between SCUD and external orchestrators. The server reads requests from stdin and emits events/responses to stdout.

§Protocol

Requests (stdin):

{"jsonrpc": "2.0", "method": "spawn", "params": {"task_id": "1", "prompt": "..."}, "id": 1}
{"jsonrpc": "2.0", "method": "ping", "id": 2}
{"jsonrpc": "2.0", "method": "shutdown", "id": 3}

Responses/Events (stdout):

{"jsonrpc": "2.0", "result": {"status": "ok"}, "id": 1}
{"jsonrpc": "2.0", "method": "agent.started", "params": {"task_id": "1"}}
{"jsonrpc": "2.0", "method": "agent.completed", "params": {"task_id": "1", "success": true}}

§Usage

use scud::rpc::{RpcServer, RpcServerConfig};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let config = RpcServerConfig::default();
    let mut server = RpcServer::new(config);
    server.run().await
}

JSON RPC IPC module for subagent communication

Provides a JSON RPC 2.0 protocol for inter-process communication between SCUD and external orchestrators. The server reads requests from stdin and emits events/responses to stdout.

§Protocol

Requests (stdin):

{"jsonrpc": "2.0", "method": "spawn", "params": {"task_id": "1", "prompt": "..."}, "id": 1}
{"jsonrpc": "2.0", "method": "ping", "id": 2}
{"jsonrpc": "2.0", "method": "shutdown", "id": 3}

Responses/Events (stdout):

{"jsonrpc": "2.0", "result": {"status": "ok"}, "id": 1}
{"jsonrpc": "2.0", "method": "agent.started", "params": {"task_id": "1"}}
{"jsonrpc": "2.0", "method": "agent.output", "params": {"task_id": "1", "line": "..."}}
{"jsonrpc": "2.0", "method": "agent.completed", "params": {"task_id": "1", "success": true}}

Structs§

GetTaskParams
Parameters for the “get_task” method
ListTasksParams
Parameters for the “list_tasks” method
NextTaskParams
Parameters for the “next_task” method
RpcError
JSON RPC Error object
RpcNotification
JSON RPC Notification (outgoing event, no id expected)
RpcRequest
JSON RPC Request (incoming from stdin)
RpcResponse
JSON RPC Response (outgoing to stdout)
RpcServer
JSON RPC Server for subagent communication
RpcServerConfig
RPC Server configuration
SetStatusParams
Parameters for the “set_status” method
SpawnParams
Parameters for the “spawn” method
SpawnTaskParams
Parameters for the “spawn_task” method (spawns from task graph)

Enums§

RpcId
JSON RPC ID can be string, number, or null

Constants§

JSONRPC_VERSION
JSON RPC version constant