Documentation
¶
Overview ¶
Package axernsdk provides the Go client surface for Axern programmable sandboxes.
The package owns the SDK-side lifecycle for service-backed sandboxes, attached processes, platform file APIs, archive directory transfer, and tunnel sessions. Runtime behavior is delegated to Axern control, node, and tunnel APIs; the SDK does not implement shell fallbacks for sandbox files or process control.
Index ¶
- Constants
- Variables
- func ErrorRetryable(err error) bool
- func IsAlreadyExists(err error) bool
- func IsCancelled(err error) bool
- func IsNotFound(err error) bool
- func IsPermissionDenied(err error) bool
- func IsTimeout(err error) bool
- func IsUnavailable(err error) bool
- func IsValidation(err error) bool
- func PlatformName() string
- func Version() string
- type CapabilityDependencyStatus
- type CapabilityProviderStatus
- type CapabilityProviderSummary
- type CapabilityStatus
- type ChmodOptions
- type Client
- func (c *Client) AgentProfileControl() agentprofilev1.AgentProfileControlClient
- func (c *Client) ArtifactData() artifactv1.ArtifactDataClient
- func (c *Client) CancelRollout(ctx context.Context, id string, options ...grpc.CallOption) (*rolloutv1.Rollout, error)
- func (c *Client) Close() error
- func (c *Client) CreateEnvironment(ctx context.Context, options CreateEnvironmentOptions) (*environmentv1.Environment, error)
- func (c *Client) CreateRollout(ctx context.Context, request *rolloutv1.CreateRolloutRequest, ...) (*rolloutv1.Rollout, error)
- func (c *Client) CreateService(ctx context.Context, options CreateServiceOptions) (*servicev1.Service, error)
- func (c *Client) CreateTunnelSession(ctx context.Context, options CreateTunnelSessionOptions) (CreateTunnelSessionResult, error)
- func (c *Client) DeleteEnvironment(ctx context.Context, environmentID string) error
- func (c *Client) DeleteService(ctx context.Context, serviceID string) error
- func (c *Client) GetRollout(ctx context.Context, id string, options ...grpc.CallOption) (*rolloutv1.GetRolloutResponse, error)
- func (c *Client) GetTunnelSession(ctx context.Context, sessionID string) (*tunnelcontrolv1.TunnelSession, error)
- func (c *Client) ListServiceReplicas(ctx context.Context, serviceID string) ([]*servicev1.ServiceReplica, error)
- func (c *Client) ListTunnelSessionEvents(ctx context.Context, sessionID string, limit int32) ([]*tunnelcontrolv1.TunnelSessionEvent, error)
- func (c *Client) NodeSandbox(allocationID string) (*NodeSandboxClient, error)
- func (c *Client) ReadRunOutput(ctx context.Context, runID string, options RunOutputOptions) (*RunOutput, error)
- func (c *Client) RenewTunnelSession(ctx context.Context, sessionID, clientToken string, ttl time.Duration) (*tunnelcontrolv1.TunnelSession, error)
- func (c *Client) RetryRollout(ctx context.Context, id string, options ...grpc.CallOption) (*rolloutv1.Rollout, error)
- func (c *Client) RevokeTunnelSession(ctx context.Context, sessionID, reason string) (*tunnelcontrolv1.TunnelSession, error)
- func (c *Client) RolloutControl() rolloutv1.RolloutControlClient
- func (c *Client) WatchRun(ctx context.Context, runID string, afterVersion int64) (*RunWatch, error)
- func (c *Client) WatchService(ctx context.Context, serviceID string, afterVersion int64) (ServiceWatch, error)
- type ClientOption
- type Command
- type ComputerUseDependencyStatus
- type ComputerUseDisplay
- type ComputerUseKeyboardOptions
- type ComputerUseMouseOptions
- type ComputerUseRegion
- type ComputerUseScreenshot
- type ComputerUseScreenshotOptions
- type ComputerUseStatus
- type CopyOptions
- type CreateEnvironmentOptions
- type CreateServiceOptions
- type CreateTunnelSessionOptions
- type CreateTunnelSessionResult
- type DownloadDirOptions
- type ExecError
- type ExecOptions
- type ExecResult
- type ExtensionCapability
- type ImageExecOptions
- type ImageMount
- type ImageProcessMount
- type ImageProcessOptions
- type ManagedProxyOptions
- type ManagedProxyReport
- type MkdirOptions
- type MoveOptions
- type NodeSandboxClient
- func (n *NodeSandboxClient) CapabilityStatus(ctx context.Context) (CapabilityStatus, error)
- func (n *NodeSandboxClient) Chmod(ctx context.Context, path string, mode uint32, options ChmodOptions) error
- func (n *NodeSandboxClient) ComputerUseDisplay(ctx context.Context) (ComputerUseDisplay, error)
- func (n *NodeSandboxClient) ComputerUseKeyboard(ctx context.Context, options ComputerUseKeyboardOptions) error
- func (n *NodeSandboxClient) ComputerUseMouse(ctx context.Context, options ComputerUseMouseOptions) error
- func (n *NodeSandboxClient) ComputerUseScreenshot(ctx context.Context, options ...ComputerUseScreenshotOptions) (ComputerUseScreenshot, error)
- func (n *NodeSandboxClient) ComputerUseStatus(ctx context.Context) (ComputerUseStatus, error)
- func (n *NodeSandboxClient) Copy(ctx context.Context, srcPath, dstPath string, options CopyOptions) error
- func (n *NodeSandboxClient) DownloadDir(ctx context.Context, remotePath, localPath string, options DownloadDirOptions) error
- func (n *NodeSandboxClient) Exec(ctx context.Context, command any, options ExecOptions) (ExecResult, error)
- func (n *NodeSandboxClient) ExecImage(ctx context.Context, image string, command any, options ImageExecOptions) (ExecResult, error)
- func (n *NodeSandboxClient) Exists(ctx context.Context, path string) (bool, error)
- func (n *NodeSandboxClient) ListDir(ctx context.Context, path string) ([]SandboxFileInfo, error)
- func (n *NodeSandboxClient) MaterializeTaskAssets(ctx context.Context, sourcePath, target string, kind TaskAssetKind) (int64, error)
- func (n *NodeSandboxClient) Mkdir(ctx context.Context, path string, options MkdirOptions) error
- func (n *NodeSandboxClient) Move(ctx context.Context, srcPath, dstPath string, options MoveOptions) error
- func (n *NodeSandboxClient) Process(ctx context.Context, command any, options ProcessOptions) (*SandboxProcess, error)
- func (n *NodeSandboxClient) ProcessImage(ctx context.Context, image string, command any, options ImageProcessOptions) (*SandboxProcess, error)
- func (n *NodeSandboxClient) ReadFile(ctx context.Context, path string) ([]byte, error)
- func (n *NodeSandboxClient) Remove(ctx context.Context, path string, options RemoveOptions) error
- func (n *NodeSandboxClient) Stat(ctx context.Context, path string) (SandboxFileInfo, error)
- func (n *NodeSandboxClient) Touch(ctx context.Context, path string, options TouchOptions) error
- func (n *NodeSandboxClient) UploadDir(ctx context.Context, localPath, remotePath string, options UploadDirOptions) error
- func (n *NodeSandboxClient) WriteFile(ctx context.Context, path string, data []byte, options WriteFileOptions) error
- type PathError
- type ProcessEvent
- type ProcessEventKind
- type ProcessOptions
- type ProcessOutput
- type ProcessResult
- type RPCError
- type RemoveOptions
- type ResourceQuantity
- type RunOutput
- type RunOutputEvent
- type RunOutputOptions
- type RunWatch
- type Sandbox
- func (s *Sandbox) CapabilityStatus(ctx context.Context) (CapabilityStatus, error)
- func (s *Sandbox) Chmod(ctx context.Context, path string, mode uint32, options ChmodOptions) error
- func (s *Sandbox) Close(ctx context.Context) error
- func (s *Sandbox) ComputerUseDisplay(ctx context.Context) (ComputerUseDisplay, error)
- func (s *Sandbox) ComputerUseKeyboard(ctx context.Context, options ComputerUseKeyboardOptions) error
- func (s *Sandbox) ComputerUseMouse(ctx context.Context, options ComputerUseMouseOptions) error
- func (s *Sandbox) ComputerUseScreenshot(ctx context.Context, options ...ComputerUseScreenshotOptions) (ComputerUseScreenshot, error)
- func (s *Sandbox) ComputerUseStatus(ctx context.Context) (ComputerUseStatus, error)
- func (s *Sandbox) Copy(ctx context.Context, srcPath, dstPath string, options CopyOptions) error
- func (s *Sandbox) DownloadDir(ctx context.Context, remotePath, localPath string, options DownloadDirOptions) error
- func (s *Sandbox) Exec(ctx context.Context, command any, options ExecOptions) (ExecResult, error)
- func (s *Sandbox) ExecImage(ctx context.Context, image string, command any, options ImageExecOptions) (ExecResult, error)
- func (s *Sandbox) Exists(ctx context.Context, path string) (bool, error)
- func (s *Sandbox) ListDir(ctx context.Context, path string) ([]SandboxFileInfo, error)
- func (s *Sandbox) MaterializeTaskAssets(ctx context.Context, sourcePath, target string, kind TaskAssetKind) error
- func (s *Sandbox) Metadata() (SandboxMetadata, error)
- func (s *Sandbox) Mkdir(ctx context.Context, path string, options MkdirOptions) error
- func (s *Sandbox) Move(ctx context.Context, srcPath, dstPath string, options MoveOptions) error
- func (s *Sandbox) OpenTunnel(ctx context.Context, options TunnelOptions) (*SandboxTunnel, error)
- func (s *Sandbox) Process(ctx context.Context, command any, options ProcessOptions) (*SandboxProcess, error)
- func (s *Sandbox) ProcessImage(ctx context.Context, image string, command any, options ImageProcessOptions) (*SandboxProcess, error)
- func (s *Sandbox) ReadFile(ctx context.Context, path string) ([]byte, error)
- func (s *Sandbox) Remove(ctx context.Context, path string, options RemoveOptions) error
- func (s *Sandbox) Start(ctx context.Context) error
- func (s *Sandbox) Stat(ctx context.Context, path string) (SandboxFileInfo, error)
- func (s *Sandbox) State() (SandboxState, error)
- func (s *Sandbox) Touch(ctx context.Context, path string, options TouchOptions) error
- func (s *Sandbox) UploadDir(ctx context.Context, localPath, remotePath string, options UploadDirOptions) error
- func (s *Sandbox) WriteFile(ctx context.Context, path string, data []byte, options WriteFileOptions) error
- type SandboxCapabilityErrorInfo
- type SandboxFileInfo
- type SandboxFileKind
- type SandboxMetadata
- type SandboxOptions
- type SandboxProcess
- func (p *SandboxProcess) Close() error
- func (p *SandboxProcess) CloseStdin() error
- func (p *SandboxProcess) Events() iter.Seq2[ProcessEvent, error]
- func (p *SandboxProcess) Kill() error
- func (p *SandboxProcess) Output() (ProcessOutput, error)
- func (p *SandboxProcess) Recv() (ProcessEvent, error)
- func (p *SandboxProcess) Resize(cols, rows uint32) error
- func (p *SandboxProcess) Signal(signal string) error
- func (p *SandboxProcess) Terminate() error
- func (p *SandboxProcess) Wait() (ProcessResult, error)
- func (p *SandboxProcess) Write(data []byte) error
- func (p *SandboxProcess) WriteString(data string) error
- type SandboxState
- type SandboxTunnel
- type ServiceWatch
- type TaskAssetKind
- type TouchOptions
- type TunnelConnectorOptions
- type TunnelOptions
- type UploadDirOptions
- type ValidationError
- type VolumeMount
- type WorkspaceImageSource
- type WorkspaceImageVariant
- type WriteFileOptions
Constants ¶
const ( // ProxyModeEnv uses gRPC's environment proxy configuration. ProxyModeEnv = "env" // ProxyModeDirect bypasses environment proxies for all SDK connections. ProxyModeDirect = "direct" )
Variables ¶
var ( // ErrSandboxNotStarted indicates a sandbox runtime API was called before Start. ErrSandboxNotStarted = errors.New("sandbox is not active") // ErrInvalidSource indicates SandboxOptions did not specify exactly one source. ErrInvalidSource = errors.New("provide exactly one sandbox source") // ErrProcessClosed indicates an attached process stream is already closed. ErrProcessClosed = errors.New("sandbox process is closed") // ErrProcessExitMissing indicates the process stream ended without exit status. ErrProcessExitMissing = errors.New("sandbox process stream ended without exit status") )
Functions ¶
func ErrorRetryable ¶
ErrorRetryable reports whether an SDK error represents a transient operation that may be retried within the caller's original deadline.
func IsAlreadyExists ¶
IsAlreadyExists reports whether err maps to gRPC AlreadyExists.
func IsCancelled ¶
IsCancelled reports whether err was cancelled by the caller or transport.
func IsNotFound ¶
IsNotFound reports whether err maps to gRPC NotFound.
func IsPermissionDenied ¶
IsPermissionDenied reports whether err maps to permission or auth failure.
func IsUnavailable ¶
IsUnavailable reports whether err maps to gRPC Unavailable.
func IsValidation ¶
IsValidation reports whether err was caused by invalid SDK input.
Types ¶
type CapabilityStatus ¶
type CapabilityStatus struct {
Ready bool
Capabilities []string
Providers []CapabilityProviderStatus
ProviderSummary CapabilityProviderSummary
}
type ChmodOptions ¶
type ChmodOptions struct {
Recursive bool
}
ChmodOptions configures sandbox-side chmod operations.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the root Axern Go SDK client.
func (*Client) AgentProfileControl ¶
func (c *Client) AgentProfileControl() agentprofilev1.AgentProfileControlClient
func (*Client) ArtifactData ¶
func (c *Client) ArtifactData() artifactv1.ArtifactDataClient
func (*Client) CancelRollout ¶
func (*Client) CreateEnvironment ¶
func (c *Client) CreateEnvironment(ctx context.Context, options CreateEnvironmentOptions) (*environmentv1.Environment, error)
CreateEnvironment creates an Axern environment from a template or image.
func (*Client) CreateRollout ¶
func (c *Client) CreateRollout(ctx context.Context, request *rolloutv1.CreateRolloutRequest, options ...grpc.CallOption) (*rolloutv1.Rollout, error)
func (*Client) CreateService ¶
func (c *Client) CreateService(ctx context.Context, options CreateServiceOptions) (*servicev1.Service, error)
CreateService creates an Axern service.
func (*Client) CreateTunnelSession ¶
func (c *Client) CreateTunnelSession(ctx context.Context, options CreateTunnelSessionOptions) (CreateTunnelSessionResult, error)
CreateTunnelSession creates a tunnel session through the control plane.
func (*Client) DeleteEnvironment ¶
DeleteEnvironment deletes an environment by id.
func (*Client) DeleteService ¶
DeleteService deletes a service by id.
func (*Client) GetRollout ¶
func (c *Client) GetRollout(ctx context.Context, id string, options ...grpc.CallOption) (*rolloutv1.GetRolloutResponse, error)
func (*Client) GetTunnelSession ¶
func (c *Client) GetTunnelSession(ctx context.Context, sessionID string) (*tunnelcontrolv1.TunnelSession, error)
GetTunnelSession fetches a tunnel session by id.
func (*Client) ListServiceReplicas ¶
func (c *Client) ListServiceReplicas(ctx context.Context, serviceID string) ([]*servicev1.ServiceReplica, error)
ListServiceReplicas returns the current replicas for a service.
func (*Client) ListTunnelSessionEvents ¶
func (c *Client) ListTunnelSessionEvents(ctx context.Context, sessionID string, limit int32) ([]*tunnelcontrolv1.TunnelSessionEvent, error)
ListTunnelSessionEvents returns recent tunnel session events.
func (*Client) NodeSandbox ¶
func (c *Client) NodeSandbox(allocationID string) (*NodeSandboxClient, error)
NodeSandbox returns a low-level sandbox client for allocationID.
func (*Client) ReadRunOutput ¶ added in v0.4.0
func (*Client) RenewTunnelSession ¶
func (c *Client) RenewTunnelSession(ctx context.Context, sessionID, clientToken string, ttl time.Duration) (*tunnelcontrolv1.TunnelSession, error)
RenewTunnelSession renews a tunnel session lease.
func (*Client) RetryRollout ¶
func (*Client) RevokeTunnelSession ¶
func (c *Client) RevokeTunnelSession(ctx context.Context, sessionID, reason string) (*tunnelcontrolv1.TunnelSession, error)
RevokeTunnelSession revokes a tunnel session.
func (*Client) RolloutControl ¶
func (c *Client) RolloutControl() rolloutv1.RolloutControlClient
func (*Client) WatchService ¶
func (c *Client) WatchService(ctx context.Context, serviceID string, afterVersion int64) (ServiceWatch, error)
WatchService watches service snapshots newer than afterVersion.
type ClientOption ¶
type ClientOption func(*clientConfig) error
ClientOption configures a Client.
func WithControlConn ¶
func WithControlConn(conn *grpc.ClientConn) ClientOption
WithControlConn uses an existing control-plane gRPC connection.
func WithDialOptions ¶
func WithDialOptions(options ...grpc.DialOption) ClientOption
WithDialOptions appends gRPC dial options for the control-plane connection.
func WithProxyMode ¶
func WithProxyMode(mode string) ClientOption
WithProxyMode configures proxy handling for both control-plane and tunnel relay connections.
func WithTLS ¶
func WithTLS(caCertPath, certPath, keyPath, serverName string) ClientOption
WithTLS configures mutual TLS for the control-plane connection.
type ComputerUseDisplay ¶
type ComputerUseMouseOptions ¶
type ComputerUseScreenshot ¶
type ComputerUseScreenshotOptions ¶
type ComputerUseScreenshotOptions struct {
ShowCursor bool
Region *ComputerUseRegion
Format string
Quality int32
Scale float64
}
type ComputerUseStatus ¶
type ComputerUseStatus struct {
Available bool
Display string
Backend string
Reason string
Dependencies []ComputerUseDependencyStatus
}
type CopyOptions ¶
CopyOptions configures sandbox-side copy operations.
type CreateEnvironmentOptions ¶
type CreateEnvironmentOptions struct {
Namespace string
TemplateID string
Image string
RegistryCredentialID string
RootFSReadonly bool
Labels map[string]string
}
CreateEnvironmentOptions configures a control-plane environment.
type CreateServiceOptions ¶
type CreateServiceOptions struct {
Namespace string
EnvironmentID string
Argv []string
Env map[string]string
Cwd string
RuntimeClass string
ExtensionCapabilities []ExtensionCapability
Volumes []VolumeMount
ImageMounts []ImageMount
WorkspaceImage *WorkspaceImageSource
RequestCPU ResourceQuantity
RequestMemory ResourceQuantity
RequestEphemeralStorage ResourceQuantity
LimitCPU ResourceQuantity
LimitMemory ResourceQuantity
LimitEphemeralStorage ResourceQuantity
Labels map[string]string
}
CreateServiceOptions configures a single-replica service for sandbox use.
type CreateTunnelSessionOptions ¶
type CreateTunnelSessionOptions struct {
AllocationID string
LocalTarget string
RemotePort int32
TTL time.Duration
WaitReady bool
ReadyTimeout time.Duration
}
CreateTunnelSessionOptions configures a control-plane tunnel session.
type CreateTunnelSessionResult ¶
type CreateTunnelSessionResult struct {
Session *tunnelcontrolv1.TunnelSession
ClientToken string
}
CreateTunnelSessionResult contains the created tunnel session and client token.
type DownloadDirOptions ¶
type DownloadDirOptions struct {
NoOverwrite bool
}
DownloadDirOptions configures directory downloads from a sandbox.
type ExecError ¶
type ExecError struct {
Argv []string
Result ExecResult
}
ExecError is returned when ExecOptions.Check is true and a command exits nonzero.
func (*ExecError) StderrString ¶
func (*ExecError) StdoutString ¶
type ExecOptions ¶
type ExecOptions struct {
Env map[string]string
Cwd string
Timeout time.Duration
User string
TTY bool
Check bool
ManagedProxy *ManagedProxyOptions
}
ExecOptions configures a collected sandbox command execution.
type ExecResult ¶
type ExecResult struct {
ExitCode int32
Stdout []byte
Stderr []byte
StdoutTruncated bool
StderrTruncated bool
ManagedProxyReport *ManagedProxyReport
}
ExecResult contains collected command output and exit status.
func (ExecResult) StderrString ¶
func (r ExecResult) StderrString() string
StderrString returns stderr decoded as a Go string.
func (ExecResult) StdoutString ¶
func (r ExecResult) StdoutString() string
StdoutString returns stdout decoded as a Go string.
type ExtensionCapability ¶ added in v0.5.0
ExtensionCapability is an exact-match, DNS-qualified node extension fact. Platform capabilities are inferred by Axern and cannot be requested here.
type ImageExecOptions ¶
type ImageExecOptions struct {
Env map[string]string
Cwd string
Timeout time.Duration
User string
TTY bool
Check bool
Mounts []ImageProcessMount
ManagedProxy *ManagedProxyOptions
}
ImageExecOptions configures a collected command from a separate image.
type ImageMount ¶
ImageMount describes a read-only OCI image mounted into the workload rootfs.
type ImageProcessMount ¶
type ImageProcessMount struct {
SandboxPath string
TargetPath string
Readonly bool
Options []string
}
ImageProcessMount shares a host-backed path from the target sandbox into an image-backed process.
func WorkspaceMount ¶
func WorkspaceMount(path string) ImageProcessMount
WorkspaceMount shares path from the target sandbox at the same path inside the image-backed process.
type ImageProcessOptions ¶
type ImageProcessOptions struct {
Env map[string]string
Cwd string
Timeout time.Duration
User string
TTY bool
Mounts []ImageProcessMount
ManagedProxy *ManagedProxyOptions
}
ImageProcessOptions configures a streaming process from a separate image.
type ManagedProxyOptions ¶
type ManagedProxyReport ¶
type MkdirOptions ¶
type MkdirOptions struct {
Parents bool
}
MkdirOptions configures sandbox directory creation.
type MoveOptions ¶
type MoveOptions struct {
Overwrite bool
}
MoveOptions configures sandbox-side move operations.
type NodeSandboxClient ¶
type NodeSandboxClient struct {
// contains filtered or unexported fields
}
NodeSandboxClient provides lower-level operations for an existing allocation.
func (*NodeSandboxClient) CapabilityStatus ¶
func (n *NodeSandboxClient) CapabilityStatus(ctx context.Context) (CapabilityStatus, error)
func (*NodeSandboxClient) Chmod ¶
func (n *NodeSandboxClient) Chmod(ctx context.Context, path string, mode uint32, options ChmodOptions) error
func (*NodeSandboxClient) ComputerUseDisplay ¶
func (n *NodeSandboxClient) ComputerUseDisplay(ctx context.Context) (ComputerUseDisplay, error)
func (*NodeSandboxClient) ComputerUseKeyboard ¶
func (n *NodeSandboxClient) ComputerUseKeyboard(ctx context.Context, options ComputerUseKeyboardOptions) error
func (*NodeSandboxClient) ComputerUseMouse ¶
func (n *NodeSandboxClient) ComputerUseMouse(ctx context.Context, options ComputerUseMouseOptions) error
func (*NodeSandboxClient) ComputerUseScreenshot ¶
func (n *NodeSandboxClient) ComputerUseScreenshot(ctx context.Context, options ...ComputerUseScreenshotOptions) (ComputerUseScreenshot, error)
func (*NodeSandboxClient) ComputerUseStatus ¶
func (n *NodeSandboxClient) ComputerUseStatus(ctx context.Context) (ComputerUseStatus, error)
func (*NodeSandboxClient) Copy ¶
func (n *NodeSandboxClient) Copy(ctx context.Context, srcPath, dstPath string, options CopyOptions) error
func (*NodeSandboxClient) DownloadDir ¶
func (n *NodeSandboxClient) DownloadDir(ctx context.Context, remotePath, localPath string, options DownloadDirOptions) error
func (*NodeSandboxClient) Exec ¶
func (n *NodeSandboxClient) Exec(ctx context.Context, command any, options ExecOptions) (ExecResult, error)
Exec runs a command in the allocation and collects stdout/stderr.
func (*NodeSandboxClient) ExecImage ¶
func (n *NodeSandboxClient) ExecImage(ctx context.Context, image string, command any, options ImageExecOptions) (ExecResult, error)
ExecImage runs a command from image against explicit host-backed paths from the allocation and collects stdout/stderr.
func (*NodeSandboxClient) ListDir ¶
func (n *NodeSandboxClient) ListDir(ctx context.Context, path string) ([]SandboxFileInfo, error)
func (*NodeSandboxClient) MaterializeTaskAssets ¶
func (n *NodeSandboxClient) MaterializeTaskAssets(ctx context.Context, sourcePath, target string, kind TaskAssetKind) (int64, error)
func (*NodeSandboxClient) Mkdir ¶
func (n *NodeSandboxClient) Mkdir(ctx context.Context, path string, options MkdirOptions) error
func (*NodeSandboxClient) Move ¶
func (n *NodeSandboxClient) Move(ctx context.Context, srcPath, dstPath string, options MoveOptions) error
func (*NodeSandboxClient) Process ¶
func (n *NodeSandboxClient) Process(ctx context.Context, command any, options ProcessOptions) (*SandboxProcess, error)
Process starts an attached process in the allocation.
func (*NodeSandboxClient) ProcessImage ¶
func (n *NodeSandboxClient) ProcessImage(ctx context.Context, image string, command any, options ImageProcessOptions) (*SandboxProcess, error)
ProcessImage starts a streaming process from image against explicit host-backed paths from the allocation.
func (*NodeSandboxClient) Remove ¶
func (n *NodeSandboxClient) Remove(ctx context.Context, path string, options RemoveOptions) error
func (*NodeSandboxClient) Stat ¶
func (n *NodeSandboxClient) Stat(ctx context.Context, path string) (SandboxFileInfo, error)
func (*NodeSandboxClient) Touch ¶
func (n *NodeSandboxClient) Touch(ctx context.Context, path string, options TouchOptions) error
func (*NodeSandboxClient) UploadDir ¶
func (n *NodeSandboxClient) UploadDir(ctx context.Context, localPath, remotePath string, options UploadDirOptions) error
func (*NodeSandboxClient) WriteFile ¶
func (n *NodeSandboxClient) WriteFile(ctx context.Context, path string, data []byte, options WriteFileOptions) error
type PathError ¶
type PathError struct {
Message string
}
PathError describes invalid sandbox path input.
type ProcessEvent ¶
type ProcessEvent struct {
Kind ProcessEventKind
Data []byte
ExitCode int32
Message string
ManagedProxyReport *ManagedProxyReport
}
ProcessEvent is a stdout, stderr, or exit event from an attached process.
type ProcessEventKind ¶
type ProcessEventKind string
ProcessEventKind identifies a process stream event.
const ( ProcessEventStdout ProcessEventKind = "stdout" ProcessEventStderr ProcessEventKind = "stderr" ProcessEventExit ProcessEventKind = "exit" )
type ProcessOptions ¶
type ProcessOptions struct {
Env map[string]string
Cwd string
Timeout time.Duration
User string
TTY bool
ManagedProxy *ManagedProxyOptions
}
ProcessOptions configures an attached sandbox process.
type ProcessOutput ¶
type ProcessOutput struct {
ProcessResult
Stdout []byte
Stderr []byte
}
ProcessOutput contains collected stdout, stderr, and exit status.
type ProcessResult ¶
type ProcessResult struct {
ExitCode int32
Message string
ManagedProxyReport *ManagedProxyReport
}
ProcessResult is the exit status for a sandbox process.
type RPCError ¶
type RPCError struct {
Operation string
AllocationID string
Code codes.Code
Details string
Retryable bool
Capability *SandboxCapabilityErrorInfo
Err error
}
RPCError wraps a gRPC status with SDK operation context.
type RemoveOptions ¶
RemoveOptions configures sandbox file or directory removal.
type ResourceQuantity ¶
type ResourceQuantity string
ResourceQuantity is a user-facing resource quantity. String literals such as "500m", "512Mi", and "512MiB" can be assigned directly; constructors below make numeric quantities explicit without weakening the public API to any.
func CPUCores ¶
func CPUCores(cores int64) ResourceQuantity
CPUCores formats CPU cores as a resource quantity.
func CPUMilli ¶
func CPUMilli(milli int64) ResourceQuantity
CPUMilli formats milli CPU as a resource quantity.
func EphemeralStorageBytes ¶ added in v0.5.0
func EphemeralStorageBytes(bytes int64) ResourceQuantity
EphemeralStorageBytes formats node-local ephemeral storage bytes as a resource quantity.
func MemoryBytes ¶
func MemoryBytes(bytes int64) ResourceQuantity
MemoryBytes formats memory bytes as a resource quantity.
type RunOutput ¶ added in v0.4.0
type RunOutput struct {
// contains filtered or unexported fields
}
func (*RunOutput) Recv ¶ added in v0.4.0
func (s *RunOutput) Recv() (RunOutputEvent, error)
type RunOutputEvent ¶ added in v0.4.0
type RunOutputOptions ¶ added in v0.4.0
type Sandbox ¶
type Sandbox struct {
// contains filtered or unexported fields
}
Sandbox is an SDK-owned programmable sandbox backed by an Axern service allocation.
func NewSandbox ¶
func NewSandbox(options SandboxOptions) (*Sandbox, error)
NewSandbox constructs a sandbox handle. Call Start before using runtime APIs.
func (*Sandbox) CapabilityStatus ¶
func (s *Sandbox) CapabilityStatus(ctx context.Context) (CapabilityStatus, error)
func (*Sandbox) Close ¶
Close closes SDK-owned processes and tunnels, then deletes SDK-owned service/environment resources.
func (*Sandbox) ComputerUseDisplay ¶
func (s *Sandbox) ComputerUseDisplay(ctx context.Context) (ComputerUseDisplay, error)
func (*Sandbox) ComputerUseKeyboard ¶
func (s *Sandbox) ComputerUseKeyboard(ctx context.Context, options ComputerUseKeyboardOptions) error
func (*Sandbox) ComputerUseMouse ¶
func (s *Sandbox) ComputerUseMouse(ctx context.Context, options ComputerUseMouseOptions) error
func (*Sandbox) ComputerUseScreenshot ¶
func (s *Sandbox) ComputerUseScreenshot(ctx context.Context, options ...ComputerUseScreenshotOptions) (ComputerUseScreenshot, error)
func (*Sandbox) ComputerUseStatus ¶
func (s *Sandbox) ComputerUseStatus(ctx context.Context) (ComputerUseStatus, error)
func (*Sandbox) DownloadDir ¶
func (s *Sandbox) DownloadDir(ctx context.Context, remotePath, localPath string, options DownloadDirOptions) error
DownloadDir downloads the contents of remotePath into localPath.
func (*Sandbox) Exec ¶
func (s *Sandbox) Exec(ctx context.Context, command any, options ExecOptions) (ExecResult, error)
Exec runs a command in the sandbox and collects stdout/stderr.
func (*Sandbox) ExecImage ¶
func (s *Sandbox) ExecImage(ctx context.Context, image string, command any, options ImageExecOptions) (ExecResult, error)
ExecImage runs a command from image against explicit host-backed paths from the sandbox and collects stdout/stderr.
func (*Sandbox) MaterializeTaskAssets ¶
func (s *Sandbox) MaterializeTaskAssets(ctx context.Context, sourcePath, target string, kind TaskAssetKind) error
MaterializeTaskAssets makes protected assets from the allocation's resolved TaskSet payload visible inside its copy-on-write workspace.
func (*Sandbox) Metadata ¶
func (s *Sandbox) Metadata() (SandboxMetadata, error)
Metadata returns diagnostic metadata for a started sandbox.
func (*Sandbox) OpenTunnel ¶
func (s *Sandbox) OpenTunnel(ctx context.Context, options TunnelOptions) (*SandboxTunnel, error)
OpenTunnel exposes a local upstream to the sandbox.
func (*Sandbox) Process ¶
func (s *Sandbox) Process(ctx context.Context, command any, options ProcessOptions) (*SandboxProcess, error)
Process starts an attached process in the sandbox.
func (*Sandbox) ProcessImage ¶
func (s *Sandbox) ProcessImage(ctx context.Context, image string, command any, options ImageProcessOptions) (*SandboxProcess, error)
ProcessImage starts a streaming process from image against explicit host-backed paths from the sandbox.
func (*Sandbox) Start ¶
Start creates the backing environment/service when needed and waits for a ready allocation.
func (*Sandbox) State ¶
func (s *Sandbox) State() (SandboxState, error)
State returns the current lightweight state for a started sandbox.
type SandboxCapabilityErrorInfo ¶
type SandboxCapabilityErrorInfo struct {
Capability string
Provider string
ProviderState string
Reason string
MissingDependencies []string
}
SandboxCapabilityErrorInfo is structured sandbox capability/provider detail parsed from an RPC error.
func SandboxCapabilityInfo ¶
func SandboxCapabilityInfo(details string) *SandboxCapabilityErrorInfo
SandboxCapabilityInfo returns sandbox capability/provider information from an Axern RPC detail string.
type SandboxFileInfo ¶
type SandboxFileInfo struct {
Path string
Kind SandboxFileKind
Size int64
Mode uint32
MtimeNS int64
}
SandboxFileInfo contains sandbox filesystem metadata.
type SandboxFileKind ¶
type SandboxFileKind string
SandboxFileKind describes the kind of a sandbox filesystem entry.
const ( SandboxFileKindFile SandboxFileKind = "file" SandboxFileKindDirectory SandboxFileKind = "directory" SandboxFileKindSymlink SandboxFileKind = "symlink" SandboxFileKindOther SandboxFileKind = "other" SandboxFileKindUnspecified SandboxFileKind = "unspecified" )
type SandboxMetadata ¶
type SandboxMetadata struct {
EnvironmentID string
ServiceID string
AllocationID string
Attempt int64
NodeID string
RuntimeClass string
StartedAt time.Time
TunnelSessionID string
BoundAddr string
Labels map[string]string
}
SandboxMetadata is a stable diagnostic view of a started sandbox.
type SandboxOptions ¶
type SandboxOptions struct {
Client *Client
TemplateID string
Image string
EnvironmentID string
Namespace string
Argv []string
Env map[string]string
Cwd string
RuntimeClass string
ExtensionCapabilities []ExtensionCapability
Volumes []VolumeMount
ImageMounts []ImageMount
WorkspaceImage *WorkspaceImageSource
RequestCPU ResourceQuantity
RequestMemory ResourceQuantity
RequestEphemeralStorage ResourceQuantity
LimitCPU ResourceQuantity
LimitMemory ResourceQuantity
LimitEphemeralStorage ResourceQuantity
ReadyTimeout time.Duration
Labels map[string]string
RegistryCredentialID string
RootFSReadonly bool
}
SandboxOptions describes the service-backed sandbox to create or attach to.
type SandboxProcess ¶
type SandboxProcess struct {
// contains filtered or unexported fields
}
SandboxProcess is an attached sandbox process with stream controls.
func (*SandboxProcess) Close ¶
func (p *SandboxProcess) Close() error
Close closes the attached process stream.
func (*SandboxProcess) CloseStdin ¶
func (p *SandboxProcess) CloseStdin() error
CloseStdin closes the process stdin stream.
func (*SandboxProcess) Events ¶
func (p *SandboxProcess) Events() iter.Seq2[ProcessEvent, error]
Events returns an iterator over process events until exit or error.
func (*SandboxProcess) Kill ¶
func (p *SandboxProcess) Kill() error
Kill sends SIGKILL to the process.
func (*SandboxProcess) Output ¶
func (p *SandboxProcess) Output() (ProcessOutput, error)
Output collects stdout, stderr, and exit status.
func (*SandboxProcess) Recv ¶
func (p *SandboxProcess) Recv() (ProcessEvent, error)
Recv receives the next process event.
func (*SandboxProcess) Resize ¶
func (p *SandboxProcess) Resize(cols, rows uint32) error
Resize sends a terminal resize event for TTY processes.
func (*SandboxProcess) Signal ¶
func (p *SandboxProcess) Signal(signal string) error
Signal sends a named signal to the process.
func (*SandboxProcess) Terminate ¶
func (p *SandboxProcess) Terminate() error
Terminate sends SIGTERM to the process.
func (*SandboxProcess) Wait ¶
func (p *SandboxProcess) Wait() (ProcessResult, error)
Wait drains events until the process exit status is observed.
func (*SandboxProcess) Write ¶
func (p *SandboxProcess) Write(data []byte) error
Write sends bytes to the process stdin stream.
func (*SandboxProcess) WriteString ¶
func (p *SandboxProcess) WriteString(data string) error
WriteString sends a string to the process stdin stream.
type SandboxState ¶
type SandboxState struct {
EnvironmentID string
ServiceID string
AllocationID string
NodeID string
Attempt int64
StartedAt time.Time
TunnelSessionID string
BoundAddr string
WorkspacePreparation *commonv1.WorkspacePreparationFacts
VerifierMaterializeMs int64
}
SandboxState is the lightweight runtime identity for a started sandbox.
type SandboxTunnel ¶
type SandboxTunnel struct {
// contains filtered or unexported fields
}
SandboxTunnel is an SDK-owned tunnel session with renewal and cleanup.
func (*SandboxTunnel) BoundAddr ¶
func (t *SandboxTunnel) BoundAddr() string
BoundAddr returns the sandbox-local address bound by the tunnel.
func (*SandboxTunnel) Close ¶
func (t *SandboxTunnel) Close(ctx context.Context) error
Close revokes the tunnel session and stops SDK-owned renewal/relay work.
func (*SandboxTunnel) Session ¶
func (t *SandboxTunnel) Session() *tunnelcontrolv1.TunnelSession
Session returns the latest control-plane tunnel session payload.
func (*SandboxTunnel) SessionID ¶
func (t *SandboxTunnel) SessionID() string
SessionID returns the control-plane tunnel session id.
type ServiceWatch ¶
ServiceWatch is a resumable stream of monotonically newer service snapshots.
type TaskAssetKind ¶
type TaskAssetKind string
const ( TaskAssetKindVerifier TaskAssetKind = "verifier" TaskAssetKindOracle TaskAssetKind = "oracle" )
type TouchOptions ¶
TouchOptions configures sandbox-side touch operations.
type TunnelConnectorOptions ¶
type TunnelConnectorOptions struct {
PingInterval time.Duration
DialTimeout time.Duration
MaxStreams int
}
TunnelConnectorOptions configures SDK-owned relay connector behavior.
type TunnelOptions ¶
type TunnelOptions struct {
Upstream string
ProxyPort int32
TTL time.Duration
ReadyTimeout time.Duration
Connector TunnelConnectorOptions
}
TunnelOptions configures a sandbox tunnel to a local upstream.
type UploadDirOptions ¶
UploadDirOptions configures directory uploads into a sandbox.
type ValidationError ¶
ValidationError describes invalid SDK input.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type VolumeMount ¶
VolumeMount describes a service volume claim mounted into a sandbox.
type WorkspaceImageSource ¶
type WorkspaceImageSource struct {
Variants []WorkspaceImageVariant
SourcePath string
Target string
}
WorkspaceImageSource describes an immutable TaskSet payload mounted through an allocation-local copy-on-write view. Variants are ordered by preference.
type WorkspaceImageVariant ¶
type WorkspaceImageVariant struct{ Format, Image string }
type WriteFileOptions ¶
type WriteFileOptions struct {
CreateParents bool
}
WriteFileOptions configures sandbox file writes.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package clientconfig loads the explicit context file shared by the Axern CLI and SDKs.
|
Package clientconfig loads the explicit context file shared by the Axern CLI and SDKs. |
|
examples
|
|
|
basic
command
|
|
|
computer-use
command
|
|
|
files
command
|
|
|
process
command
|
|
|
programmable
command
|
|
|
tunnel
command
|
|
|
gen
|
|
|
internal
|
|
|
tests
|
|
|
e2e
command
|