sandbox

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Providers = registry.New[SandboxProvider]("sandbox")

Providers is the global registry of available SandboxProvider implementations.

Functions

This section is empty.

Types

type AttachOptions

type AttachOptions struct {
	Stdin      io.Reader
	Stdout     io.Writer
	Stderr     io.Writer
	TTY        bool
	ResizeChan <-chan TerminalSize
}

AttachOptions specifies parameters for an interactive terminal attachment.

type Capability

type Capability string

Capability represents optional features supported by a SandboxProvider.

const (
	CapExec         Capability = "exec"
	CapAttach       Capability = "attach"
	CapPortForward  Capability = "port-forward"
	CapFileTransfer Capability = "file-transfer"
	CapPools        Capability = "pools"
	CapMetrics      Capability = "metrics"
	CapSnapshot     Capability = "snapshot"
	CapSuspend      Capability = "suspend"
)

type CapabilityDetector

type CapabilityDetector interface {
	Supports(cap Capability) bool
}

CapabilityDetector allows callers to discover supported features on a provider.

type ExecOptions

type ExecOptions struct {
	Command []string
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer
}

ExecOptions specifies execution parameters inside an active sandbox container.

type LogOptions

type LogOptions struct {
	Follow     bool
	TailLines  *int64
	Timestamps bool
}

LogOptions specifies parameters for log streaming from the sandbox pod.

type PoolInfo

type PoolInfo struct {
	Name       string
	Ready      int32
	Allocated  int32
	TargetSize int32
	Image      string
}

PoolInfo reports the state of a pre-warmed sandbox pool.

type PortForwardOptions

type PortForwardOptions struct {
	Ports     []string // e.g. ["8080:8080"]
	StopChan  <-chan struct{}
	ReadyChan chan struct{}
	Out       io.Writer
	ErrOut    io.Writer
}

PortForwardOptions specifies parameters for forwarding ports into the sandbox pod.

type SandboxAttacher

type SandboxAttacher interface {
	Attach(ctx context.Context, task *v1alpha1.AgentTask, opts AttachOptions) error
}

SandboxAttacher is an optional interface for providers supporting interactive terminal attachments.

type SandboxExecutor

type SandboxExecutor interface {
	Exec(ctx context.Context, task *v1alpha1.AgentTask, opts ExecOptions) (exitCode int, err error)
}

SandboxExecutor is an optional interface implemented by providers that support running commands or diagnostic probes directly inside an active sandbox.

type SandboxFileTransfer

type SandboxFileTransfer interface {
	CopyTo(ctx context.Context, task *v1alpha1.AgentTask, src io.Reader, dstPath string) error
	CopyFrom(ctx context.Context, task *v1alpha1.AgentTask, srcPath string) (io.ReadCloser, error)
}

SandboxFileTransfer is an optional interface for streaming files into or out of the sandbox workspace.

type SandboxMetrics

type SandboxMetrics struct {
	CPUUsageMillicores int64
	MemoryUsageBytes   int64
	StorageUsageBytes  int64
	NetworkRxBytes     int64
	NetworkTxBytes     int64
}

SandboxMetrics encapsulates runtime resource utilization for finops and observability.

type SandboxMetricsCollector

type SandboxMetricsCollector interface {
	GetMetrics(ctx context.Context, task *v1alpha1.AgentTask) (*SandboxMetrics, error)
}

SandboxMetricsCollector is an optional interface for retrieving real-time resource utilization.

type SandboxPoolManager

type SandboxPoolManager interface {
	ListPools(ctx context.Context, namespace string) ([]PoolInfo, error)
	GetPool(ctx context.Context, namespace, name string) (*PoolInfo, error)
	ScalePool(ctx context.Context, namespace, name string, targetSize int32) error
}

SandboxPoolManager is an optional interface for managing pre-warmed sandbox worker pools.

type SandboxPortForwarder

type SandboxPortForwarder interface {
	PortForward(ctx context.Context, task *v1alpha1.AgentTask, opts PortForwardOptions) error
}

SandboxPortForwarder is an optional interface for forwarding network ports into an active sandbox.

type SandboxProvider

type SandboxProvider interface {
	// Provision creates or claims an isolated sandbox workspace for the AgentTask.
	Provision(ctx context.Context, task *v1alpha1.AgentTask) (*SandboxResult, error)

	// Teardown cleanly releases the sandbox workspace and deletes associated resources.
	// Must be idempotent.
	Teardown(ctx context.Context, task *v1alpha1.AgentTask) error

	// Status returns the live runtime state of the sandbox.
	Status(ctx context.Context, task *v1alpha1.AgentTask) (*SandboxStatus, error)

	// StreamLogs opens a stream to the sandbox container logs.
	StreamLogs(ctx context.Context, task *v1alpha1.AgentTask, opts LogOptions) (io.ReadCloser, error)
}

SandboxProvider defines the contract for provisioning, observing, and tearing down isolated agent workspaces (e.g. K8s Agent Sandbox, gVisor pods).

type SandboxResult

type SandboxResult struct {
	ClaimName      string
	PodName        string
	PodIP          string
	TokenMountPath string
	Ready          bool
	Message        string
}

SandboxResult holds the immediate result of a Provision operation.

type SandboxSnapshotter

type SandboxSnapshotter interface {
	Snapshot(ctx context.Context, task *v1alpha1.AgentTask, opts SnapshotOptions) (string, error)
	Restore(ctx context.Context, task *v1alpha1.AgentTask, snapshotID string) error
}

SandboxSnapshotter is an optional interface for capturing and restoring sandbox states.

type SandboxStatus

type SandboxStatus struct {
	ClaimName string
	PodName   string
	PodIP     string
	Phase     string
	Ready     bool
	Message   string
}

SandboxStatus holds the live observed status of an AgentTask's sandbox.

type SandboxSuspender added in v0.19.0

type SandboxSuspender interface {
	Suspend(ctx context.Context, task *v1alpha1.AgentTask) error
	Resume(ctx context.Context, task *v1alpha1.AgentTask) error
}

SandboxSuspender is an optional interface implemented by providers that can suspend and resume sandbox compute in-place without destroying workspace state.

type SnapshotOptions

type SnapshotOptions struct {
	Name        string
	Description string
}

SnapshotOptions defines parameters for capturing a sandbox filesystem state.

type TerminalSize

type TerminalSize struct {
	Width  uint16
	Height uint16
}

TerminalSize specifies terminal width and height for interactive sessions.

Jump to

Keyboard shortcuts

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