Documentation
¶
Index ¶
- Constants
- Variables
- type AgentEventEnvelope
- type AgentEventReceiver
- type AgentEventSender
- type AgentEventService
- type Capabilities
- type ContentBlock
- type CreateSessionRequest
- type CreateSessionResponse
- type CreateSnapshotRequest
- type CreateSnapshotResponse
- type DestroySessionRequest
- type DestroySessionResponse
- type ExecuteToolRequest
- type ExecuteToolResponse
- type ExecuteToolStreamMessage
- type ExecuteToolStreamReceiver
- func NewExecuteToolStream(messages ...*ExecuteToolStreamMessage) ExecuteToolStreamReceiver
- func NewExecuteToolStreamChannel(ch <-chan *ExecuteToolStreamMessage, closeFn func() error) ExecuteToolStreamReceiver
- func NewExecuteToolStreamChannelWithErr(ch <-chan *ExecuteToolStreamMessage, errCh <-chan error, closeFn func() error) ExecuteToolStreamReceiver
- type GetProcessStatusRequest
- type GetProcessStatusResponse
- type GetSessionRequest
- type GetSessionResponse
- type HealthCheckRequest
- type HealthCheckResponse
- type KillProcessRequest
- type KillProcessResponse
- type LaunchProcessRequest
- type LaunchProcessResponse
- type ListSnapshotsRequest
- type ListSnapshotsResponse
- type PauseSessionRequest
- type PauseSessionResponse
- type ProcessStatus
- type ResourceSpec
- type ResumeSessionRequest
- type ResumeSessionResponse
- type RollbackSessionRequest
- type RollbackSessionResponse
- type SandboxService
- type Session
- type Snapshot
- type StreamAgentEventsRequest
- type StreamTerminalRequest
- type TerminalAttached
- type TerminalClientMessage
- type TerminalDetached
- type TerminalInput
- type TerminalOutput
- type TerminalResize
- type TerminalServerMessage
- type TerminalService
- type TerminalStreamHandle
- type ToolProgress
- type TurnCompleteRequest
- type TurnCompleteResponse
Constants ¶
const MaxTerminalChunkSize = 64 * 1024
MaxTerminalChunkSize is the maximum size of a single TerminalOutput message. Larger PTY reads are split into multiple messages.
Variables ¶
var ErrStreamClosed = errors.New("rpc stream closed")
Functions ¶
This section is empty.
Types ¶
type AgentEventEnvelope ¶
type AgentEventEnvelope struct {
SessionID string
Event agent.AgentEvent
}
type AgentEventReceiver ¶
type AgentEventReceiver interface {
Recv() (*AgentEventEnvelope, error)
Close() error
}
func NewAgentEventReceiver ¶
func NewAgentEventReceiver(ch <-chan *AgentEventEnvelope, closeFn func() error) AgentEventReceiver
type AgentEventSender ¶
type AgentEventSender interface {
Send(*AgentEventEnvelope) error
Close() error
}
type AgentEventService ¶
type AgentEventService interface {
StreamAgentEvents(ctx context.Context, req *StreamAgentEventsRequest) (AgentEventReceiver, error)
}
type Capabilities ¶
type ContentBlock ¶
type CreateSessionRequest ¶
type CreateSessionResponse ¶
type CreateSessionResponse struct {
Session *Session
ServerCapabilities Capabilities
}
type CreateSnapshotRequest ¶
type CreateSnapshotResponse ¶
type DestroySessionRequest ¶
type DestroySessionRequest struct {
SessionID string
}
type DestroySessionResponse ¶
type DestroySessionResponse struct{}
type ExecuteToolRequest ¶
type ExecuteToolResponse ¶
type ExecuteToolStreamMessage ¶
type ExecuteToolStreamMessage struct {
Progress *ToolProgress
Response *ExecuteToolResponse
}
type ExecuteToolStreamReceiver ¶
type ExecuteToolStreamReceiver interface {
Recv() (*ExecuteToolStreamMessage, error)
Close() error
}
func NewExecuteToolStream ¶
func NewExecuteToolStream(messages ...*ExecuteToolStreamMessage) ExecuteToolStreamReceiver
func NewExecuteToolStreamChannel ¶
func NewExecuteToolStreamChannel(ch <-chan *ExecuteToolStreamMessage, closeFn func() error) ExecuteToolStreamReceiver
func NewExecuteToolStreamChannelWithErr ¶
func NewExecuteToolStreamChannelWithErr(ch <-chan *ExecuteToolStreamMessage, errCh <-chan error, closeFn func() error) ExecuteToolStreamReceiver
type GetProcessStatusRequest ¶
type GetProcessStatusResponse ¶
type GetProcessStatusResponse struct {
Status ProcessStatus
ExitCode *int
}
type GetSessionRequest ¶
type GetSessionRequest struct {
SessionID string
}
type GetSessionResponse ¶
type GetSessionResponse struct {
Session *Session
}
type HealthCheckRequest ¶
type HealthCheckRequest struct{}
type HealthCheckResponse ¶
type KillProcessRequest ¶
type KillProcessResponse ¶
type KillProcessResponse struct{}
type LaunchProcessRequest ¶
type LaunchProcessResponse ¶
type LaunchProcessResponse struct {
ProcessID string
Address string
Status ProcessStatus
}
type ListSnapshotsRequest ¶
type ListSnapshotsRequest struct {
SessionID string
}
type ListSnapshotsResponse ¶
type ListSnapshotsResponse struct {
Snapshots []Snapshot
}
type PauseSessionRequest ¶
type PauseSessionRequest struct {
SessionID string
}
type PauseSessionResponse ¶
type PauseSessionResponse struct{}
type ProcessStatus ¶
type ProcessStatus string
const ( ProcessStatusStarting ProcessStatus = "starting" ProcessStatusRunning ProcessStatus = "running" ProcessStatusExited ProcessStatus = "exited" )
type ResourceSpec ¶
type ResumeSessionRequest ¶
type ResumeSessionRequest struct {
SessionID string
}
type ResumeSessionResponse ¶
type ResumeSessionResponse struct{}
type RollbackSessionRequest ¶
type RollbackSessionResponse ¶
type RollbackSessionResponse struct{}
type SandboxService ¶
type SandboxService interface {
CreateSession(ctx context.Context, req *CreateSessionRequest) (*CreateSessionResponse, error)
GetSession(ctx context.Context, req *GetSessionRequest) (*GetSessionResponse, error)
PauseSession(ctx context.Context, req *PauseSessionRequest) (*PauseSessionResponse, error)
ResumeSession(ctx context.Context, req *ResumeSessionRequest) (*ResumeSessionResponse, error)
DestroySession(ctx context.Context, req *DestroySessionRequest) (*DestroySessionResponse, error)
LaunchProcess(ctx context.Context, req *LaunchProcessRequest) (*LaunchProcessResponse, error)
KillProcess(ctx context.Context, req *KillProcessRequest) (*KillProcessResponse, error)
GetProcessStatus(ctx context.Context, req *GetProcessStatusRequest) (*GetProcessStatusResponse, error)
ExecuteTool(ctx context.Context, req *ExecuteToolRequest) (*ExecuteToolResponse, error)
ExecuteToolStream(ctx context.Context, req *ExecuteToolRequest) (ExecuteToolStreamReceiver, error)
TurnComplete(ctx context.Context, req *TurnCompleteRequest) (*TurnCompleteResponse, error)
CreateSnapshot(ctx context.Context, req *CreateSnapshotRequest) (*CreateSnapshotResponse, error)
RollbackSession(ctx context.Context, req *RollbackSessionRequest) (*RollbackSessionResponse, error)
ListSnapshots(ctx context.Context, req *ListSnapshotsRequest) (*ListSnapshotsResponse, error)
HealthCheck(ctx context.Context, req *HealthCheckRequest) (*HealthCheckResponse, error)
}
Service interfaces used by client/server adapters.
type StreamAgentEventsRequest ¶
type StreamAgentEventsRequest struct {
SessionID string
}
Event streaming contracts.
type StreamTerminalRequest ¶
type StreamTerminalRequest struct {
SessionID string
}
StreamTerminalRequest is the initial attach request from a client.
type TerminalAttached ¶
type TerminalAttached struct {
Rows int `json:"rows"`
Cols int `json:"cols"`
Scrollback []byte `json:"scrollback,omitempty"`
}
TerminalAttached is sent after successful subscription, including current dimensions and scrollback history for replay.
type TerminalClientMessage ¶
type TerminalClientMessage struct {
Input *TerminalInput `json:"input,omitempty"`
Resize *TerminalResize `json:"resize,omitempty"`
}
TerminalClientMessage is a message from the client to the terminal server.
type TerminalDetached ¶
type TerminalDetached struct {
Reason string `json:"reason"` // "session_ended", "kicked", "error"
}
TerminalDetached is sent when the session ends or the client is kicked.
type TerminalInput ¶
type TerminalInput struct {
Data []byte `json:"data"`
}
TerminalInput carries raw keystrokes from the client to the PTY.
type TerminalOutput ¶
type TerminalOutput struct {
Data []byte `json:"data"`
}
TerminalOutput carries raw PTY output (including ANSI sequences) to the client.
type TerminalResize ¶
TerminalResize carries terminal dimension changes from the client.
type TerminalServerMessage ¶
type TerminalServerMessage struct {
Attached *TerminalAttached `json:"attached,omitempty"`
Output *TerminalOutput `json:"output,omitempty"`
Detached *TerminalDetached `json:"detached,omitempty"`
}
TerminalServerMessage is a message from the terminal server to the client.
type TerminalService ¶
type TerminalService interface {
StreamTerminal(ctx context.Context, req *StreamTerminalRequest) (TerminalStreamHandle, error)
}
TerminalService handles bidirectional terminal streaming. It is a separate service from SandboxService — terminal streaming targets browser debug UIs, while SandboxService targets the agent loop.
type TerminalStreamHandle ¶
type TerminalStreamHandle interface {
Send(*TerminalClientMessage) error
Recv() (*TerminalServerMessage, error)
Close() error
}
TerminalStreamHandle is the client-facing handle for a terminal stream. Callers use Send for input/resize and Recv for output/attached/detached.
func NewTerminalStreamHandle ¶
func NewTerminalStreamHandle( toClient <-chan *TerminalServerMessage, fromClient chan<- *TerminalClientMessage, ctx context.Context, cancel context.CancelFunc, ) TerminalStreamHandle
NewTerminalStreamHandle creates a TerminalStreamHandle from channels. The ctx/cancel control the stream lifecycle: cancelling ctx causes the backing goroutines to exit, which closes toClient (triggering EOF on Recv).
type ToolProgress ¶
type TurnCompleteRequest ¶
type TurnCompleteRequest struct {
SessionID string
}