controlsocket

package module
v0.0.0-...-7fc3621 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelControl = "control"

	TypeChange           = "change"
	TypeError            = "error"
	TypeStreamOpen       = "stream.open"
	TypeStreamData       = "stream.data"
	TypeStreamCloseWrite = "stream.close_write"
	TypeStreamClose      = "stream.close"
)

Variables

This section is empty.

Functions

func Payload

func Payload(v any) json.RawMessage

Types

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn serializes websocket writes and exposes a small frame API for the sandbox agent control socket.

func NewConn

func NewConn(ws *websocket.Conn) *Conn

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) CloseOnDone

func (c *Conn) CloseOnDone(ctx context.Context)

func (*Conn) ReadFrame

func (c *Conn) ReadFrame(ctx context.Context) (Frame, error)

func (*Conn) WriteFrame

func (c *Conn) WriteFrame(ctx context.Context, frame Frame) error

type Frame

type Frame struct {
	Version int             `json:"version"`
	ID      string          `json:"id,omitempty"`
	Channel string          `json:"channel"`
	Type    string          `json:"type"`
	Name    string          `json:"name,omitempty"`
	Payload json.RawMessage `json:"payload,omitempty"`
	Data    []byte          `json:"data,omitempty"`
}

Frame is the shared sandbox agent control socket envelope. Control changes carry JSON in Payload. Stream frames use Channel as the stream name and carry optional JSON metadata in Payload plus raw bytes in Data.

Jump to

Keyboard shortcuts

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