protocol

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrProtocolStdoutContamination = "E_PROTOCOL_STDOUT_CONTAMINATION"
	ErrProtocolInvalidJSON         = "E_PROTOCOL_INVALID_JSON"
	ErrProtocolUnexpectedFrame     = "E_PROTOCOL_UNEXPECTED_FRAME"
	ErrProtocolInvalidHandshake    = "E_PROTOCOL_INVALID_HANDSHAKE"
	ErrUnsupported                 = "E_UNSUPPORTED"
	ErrTimeout                     = "E_TIMEOUT"
	ErrCanceled                    = "E_CANCELED"
	ErrRuntime                     = "E_RUNTIME"
)

Variables

This section is empty.

Functions

func ValidateHandshake

func ValidateHandshake(h Handshake) error

Types

type Capabilities

type Capabilities struct {
	Ops      []string      `json:"ops,omitempty"`
	Streams  []string      `json:"streams,omitempty"`
	Commands []CommandSpec `json:"commands,omitempty"`
}

type CommandArg

type CommandArg struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type CommandSpec

type CommandSpec struct {
	Name     string       `json:"name"`
	Help     string       `json:"help,omitempty"`
	ArgsSpec []CommandArg `json:"args_spec,omitempty"`
}

type Error

type Error struct {
	Code    string         `json:"code"`
	Message string         `json:"message"`
	Details map[string]any `json:"details,omitempty"`
}

type Event

type Event struct {
	Type     FrameType      `json:"type"`
	StreamID string         `json:"stream_id"`
	Event    string         `json:"event"`
	Level    string         `json:"level,omitempty"`
	Message  string         `json:"message,omitempty"`
	Fields   map[string]any `json:"fields,omitempty"`
	Ok       *bool          `json:"ok,omitempty"`
}

type FrameType

type FrameType string
const (
	FrameHandshake FrameType = "handshake"
	FrameRequest   FrameType = "request"
	FrameResponse  FrameType = "response"
	FrameEvent     FrameType = "event"
)

type Handshake

type Handshake struct {
	Type            FrameType       `json:"type"`
	ProtocolVersion ProtocolVersion `json:"protocol_version"`
	PluginName      string          `json:"plugin_name"`
	Capabilities    Capabilities    `json:"capabilities"`
	Declares        map[string]any  `json:"declares,omitempty"`
}

type Note

type Note struct {
	Level   string `json:"level"`
	Message string `json:"message"`
}

type ProtocolVersion

type ProtocolVersion string
const ProtocolV1 ProtocolVersion = "v1"
const ProtocolV2 ProtocolVersion = "v2"

type Request

type Request struct {
	Type      FrameType       `json:"type"`
	RequestID string          `json:"request_id"`
	Op        string          `json:"op"`
	Ctx       RequestContext  `json:"ctx"`
	Input     json.RawMessage `json:"input,omitempty"`
}

type RequestContext

type RequestContext struct {
	RepoRoot   string `json:"repo_root,omitempty"`
	Cwd        string `json:"cwd,omitempty"`
	DeadlineMs int64  `json:"deadline_ms,omitempty"`
	DryRun     bool   `json:"dry_run,omitempty"`
}

type Response

type Response struct {
	Type      FrameType       `json:"type"`
	RequestID string          `json:"request_id"`
	Ok        bool            `json:"ok"`
	Output    json.RawMessage `json:"output,omitempty"`
	Warnings  []Note          `json:"warnings,omitempty"`
	Notes     []Note          `json:"notes,omitempty"`
	Error     *Error          `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL