sandbox

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 37 Imported by: 0

Documentation

Overview

internal/cmd/sandbox/command.go

internal/cmd/sandbox/configflags.go

Index

Constants

This section is empty.

Variables

View Source
var ErrAborted = errors.New("session aborted by user")

ErrAborted is returned by SessionBootstrap.Run when the user chooses Exit from the failure menu. The caller must close the session lane without starting a PTY.

Functions

func NewCommand

func NewCommand(gf *flags.Global) *cobra.Command

NewCommand returns the top-level "sandbox" cobra command.

Types

type DataLane added in v0.16.0

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

DataLane manages the persistent reverse WebSocket to sandbox-proxy. It dispatches control messages to a SessionManager.

func (*DataLane) Run added in v0.16.0

func (dl *DataLane) Run(ctx context.Context)

Run connects to the data lane and dispatches messages until ctx is cancelled or a delete_sandbox message is received. Reconnects with exponential backoff.

func (*DataLane) Send added in v0.16.0

func (dl *DataLane) Send(msg dataLaneMsg)

Send queues a message to be written to the active data lane connection. Drops silently if the buffer is full or no connection is active.

type SessionBootstrap added in v0.16.0

type SessionBootstrap struct {
	SessionID    string
	SessionName  string
	SandboxID    string
	SandboxName  string
	WorkspaceID  string
	Config       *sandboxv1.Sandbox_Config
	SystemPrompt string
	SeedPrompt   string
	JWT          string
	Endpoint     string
	BaseDir      string // directory where `retask sandbox connect` was invoked
	Log          *slog.Logger
}

SessionBootstrap performs per-session setup for a Private VM sandbox: creates the session folder, writes agent configs, clones git repos, and builds the process environment.

func (*SessionBootstrap) Run added in v0.16.0

func (b *SessionBootstrap) Run(ctx context.Context, conn *websocket.Conn) (sessionDir string, env []string, err error)

Run performs all bootstrap steps before the PTY starts. It streams progress to conn as terminal output frames.

Returns (sessionDir, envSlice, nil) on success. Returns ("", nil, ErrAborted) if the user chooses Exit from the failure menu. Returns ("", nil, err) on non-recoverable error.

type SessionManager added in v0.16.0

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

SessionManager creates and tracks one agentfleet Runner per active sandbox session.

func (*SessionManager) Remove added in v0.16.0

func (sm *SessionManager) Remove(sessionID string)

Remove stops the session's PTY and removes it from the fleet so it disappears from the TUI immediately. Used for delete_session messages.

func (*SessionManager) Start added in v0.16.0

func (sm *SessionManager) Start(ctx context.Context, sessionID, token, name string, configJSON json.RawMessage, systemPrompt, seedPrompt string)

Start handles a new_session event: connects the session lane, runs bootstrap, then launches the PTY and bridges it to the session lane.

func (*SessionManager) Stop added in v0.16.0

func (sm *SessionManager) Stop(sessionID string)

Stop sends SIGTERM to the session's PTY process.

func (*SessionManager) StopAll added in v0.16.0

func (sm *SessionManager) StopAll()

StopAll stops every active session.

Jump to

Keyboard shortcuts

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