Documentation
¶
Overview ¶
Package jsonrpc is JSON-RPC 2.0 over newline-delimited JSON: ACP's stdio transport (ADR 0002), for KairoCode as an ACP agent and as an ACP client of other agents (ADR 0014).
Index ¶
Constants ¶
const ( CodeParse = -32700 CodeInvalidRequest = -32600 CodeMethodNotFound = -32601 CodeInvalidParams = -32602 CodeInternal = -32603 // CodeCancelled answers a request cancelled with $/cancel_request. CodeCancelled = -32800 )
JSON-RPC error codes.
Variables ¶
var ErrClosed = errors.New("jsonrpc: the connection is closed")
ErrClosed: the connection ended before the response came.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a JSON-RPC connection over newline-delimited JSON (ACP's stdio transport). Requests from the other side are handled each in its own goroutine; ours wait for their responses.
func (*Conn) Call ¶
Call sends a request and waits for its response into out. When ctx ends first, the request is cancelled ($/cancel_request) and ctx's error returned.
type Handler ¶
Handler answers a request (its result, or an error) or takes a notification (the result is dropped).
type Message ¶
type Message struct {
JSONRPC string `json:"jsonrpc"`
ID json.RawMessage `json:"id,omitempty"`
Method string `json:"method,omitempty"`
Params json.RawMessage `json:"params,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
Error *Error `json:"error,omitempty"`
}
Message is a JSON-RPC 2.0 message: a request (ID and Method), a notification (Method only) or a response (ID, and Result or Error).