Module Proto.Control

Control protocol wire format for SDK communication.

This module defines the wire format for the SDK control protocol used for bidirectional communication between the SDK and the Claude CLI. It handles JSON serialization and deserialization of control messages.

The control protocol enables:

Request Types

module Request : sig ... end

SDK control request types.

Response Types

module Response : sig ... end

SDK control response types.

Control Envelopes

type request_envelope = {
  1. request_id : string;
  2. request : Request.t;
  3. unknown : Unknown.t;
}

Control request envelope. Wire format has "type": "control_request".

type response_envelope = {
  1. response : Response.t;
  2. unknown : Unknown.t;
}

Control response envelope. Wire format has "type": "control_response".

val request_envelope_jsont : request_envelope Jsont.t

request_envelope_jsont is the Jsont codec for request envelopes.

val response_envelope_jsont : response_envelope Jsont.t

response_envelope_jsont is the Jsont codec for response envelopes.

val create_request : request_id:string -> request:Request.t -> unit -> request_envelope

create_request ~request_id ~request () creates a control request envelope.

val create_response : response:Response.t -> unit -> response_envelope

create_response ~response () creates a control response envelope.

Server Information

module Server_info : sig ... end

Server information and capabilities.