Documentation
¶
Overview ¶
Package control implements the stream-json control channel: the request/response frames that ride the same stdio pipes as events. It is a pure state machine over a write function — no process, no session knowledge — so its behaviour is fully testable without a child. Frame shapes are pinned in contracts/control-channel.md, characterized from the 2.1.226 captures and the SDK 0.3.226 oracle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = errors.New("control: connection closed")
ErrClosed reports a request made on (or failed by) a closed Conn.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is one control-channel multiplexer.
func NewConn ¶
NewConn returns a mux that emits frames through write. write must be safe for concurrent use (handlers respond from their own goroutines).
func (*Conn) Close ¶
Close fails all pending requests with err (ErrClosed when nil), cancels in-flight incoming handlers, and refuses further requests. Idempotent.
func (*Conn) HandleFrame ¶
HandleFrame routes one stdout line. It reports false for non-control frames so the session pump passes them on to event decoding.
func (*Conn) Request ¶
Request sends one control request and waits for its response. params must marshal to a JSON object (or be nil); subtype is set on it.
func (*Conn) SetHandler ¶
SetHandler registers the responder for an incoming subtype. An unregistered subtype gets an error control_response naming it (the oracle's behaviour). Not safe to call after frames start flowing.