Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrCapabilityNotSupported = errors.New("capability not supported by environment") ErrSessionNotFound = errors.New("environment: session not found") ErrNotActive = errors.New("environment not in active state") ErrSessionLimitReached = errors.New("session limit reached") )
var DaytonaCapabilities = Capabilities{ Snapshots: false, Rollback: false, Pause: false, TierRouting: false, StreamingProgress: true, }
var E2BCapabilities = Capabilities{ Snapshots: false, Rollback: false, Pause: true, TierRouting: false, StreamingProgress: true, MaxSessionDuration: 24 * time.Hour, }
var FlyCapabilities = Capabilities{ Snapshots: false, Rollback: false, Pause: true, TierRouting: false, StreamingProgress: false, }
var LocalCapabilities = Capabilities{ Snapshots: false, Rollback: false, Pause: true, TierRouting: false, StreamingProgress: true, }
Functions ¶
func IsFileOp ¶
IsFileOp returns true for tool names that operate on the filesystem (read, write, edit, grep, glob) and should be dispatched via the environment's filesystem API. All other tools are treated as process operations and dispatched via the command execution API. This is independent of the Tier 1/2 classifier in internal/tools, which is a NativeSandbox-specific concept.
Types ¶
type Capabilities ¶
type Capabilities struct {
Snapshots bool
Rollback bool
Pause bool
StreamingProgress bool
TierRouting bool
MaxSessionDuration time.Duration
ConcurrentSessions int
}
Capabilities describes what an ExecutionEnvironment supports.
type ExecutionEnvironment ¶
type ExecutionEnvironment interface {
Create(ctx context.Context, config SessionConfig) error
Pause(ctx context.Context) error
Resume(ctx context.Context) error
Destroy(ctx context.Context) error
ExecuteTool(ctx context.Context, req ToolRequest, onProgress func(ToolProgress)) (*ToolResponse, error)
State() SessionState
Capabilities() Capabilities
CreateSnapshot(ctx context.Context, name string) (*SnapshotInfo, error)
Rollback(ctx context.Context, snapshotID string) error
}
ExecutionEnvironment is the unified interface for tool execution environments. It covers lifecycle management, tool execution, environment state, and optional capabilities like snapshots and rollback.
type SessionConfig ¶
type SessionConfig struct {
BaseImage string
SessionID string
Labels map[string]string
Options any
}
SessionConfig carries parameters for environment creation.
type SessionState ¶
type SessionState string
SessionState represents lifecycle state for an execution environment.
const ( StateCreating SessionState = "creating" StateActive SessionState = "active" StatePaused SessionState = "paused" StateDestroying SessionState = "destroying" StateDestroyed SessionState = "destroyed" StateFailed SessionState = "failed" )
type SnapshotInfo ¶
type SnapshotInfo struct {
ID string
Name string
CreatedAt time.Time
SpaceUsed int64 // bytes; 0 if environment does not track this
}
SnapshotInfo describes a snapshot of the environment state.
type ToolProgress ¶
type ToolProgress = tools.ToolProgress
type ToolRequest ¶
type ToolRequest = tools.ToolRequest
type ToolResponse ¶
type ToolResponse = tools.ToolResponse