sandboxrunner

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTemplateRequired = errors.New("template_id is required")
	ErrTemplateNotFound = errors.New("template not found")
	ErrTemplateNotReady = errors.New("template is not ready")
	ErrSandboxNotFound  = errors.New("sandbox not found")
	ErrRunnerNotFound   = errors.New("runner process not found")
)

Functions

This section is empty.

Types

type Catalog

type Catalog interface {
	ListTemplates(ctx context.Context) ([]CatalogTemplate, error)
	ListRunnerSandboxes(ctx context.Context) ([]CatalogSandbox, error)
}

type CatalogSandbox

type CatalogSandbox struct {
	SandboxID  string    `json:"sandbox_id"`
	TemplateID string    `json:"template_id"`
	Alias      string    `json:"alias,omitempty"`
	State      string    `json:"state"`
	CPUCount   int32     `json:"cpu_count"`
	MemoryMB   int32     `json:"memory_mb"`
	DiskSizeMB int32     `json:"disk_size_mb"`
	StartedAt  time.Time `json:"started_at"`
	ExpiresAt  time.Time `json:"expires_at"`
}

type CatalogTemplate

type CatalogTemplate struct {
	TemplateID  string    `json:"template_id"`
	Aliases     []string  `json:"aliases"`
	Names       []string  `json:"names"`
	BuildStatus string    `json:"build_status"`
	CPUCount    int32     `json:"cpu_count"`
	MemoryMB    int32     `json:"memory_mb"`
	DiskSizeMB  int32     `json:"disk_size_mb"`
	Public      bool      `json:"public"`
	SpawnCount  int64     `json:"spawn_count"`
	UpdatedAt   time.Time `json:"updated_at"`
}

type DefaultTemplateCatalog added in v0.2.7

type DefaultTemplateCatalog interface {
	ListDefaultTemplates(ctx context.Context) ([]CatalogTemplate, error)
}

DefaultTemplateCatalog lists public templates available on the scoped Sandbox endpoint.

type E2BService

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

func NewE2BService

func NewE2BService(apiKey, endpoint string, httpClient *http.Client) (*E2BService, error)

func (*E2BService) ListDefaultTemplates added in v0.2.7

func (s *E2BService) ListDefaultTemplates(ctx context.Context) ([]CatalogTemplate, error)

ListDefaultTemplates lists the public template catalog from the scoped Sandbox endpoint.

func (*E2BService) ListRunnerSandboxes

func (s *E2BService) ListRunnerSandboxes(ctx context.Context) ([]CatalogSandbox, error)

func (*E2BService) ListTemplates

func (s *E2BService) ListTemplates(ctx context.Context) ([]CatalogTemplate, error)

func (*E2BService) RecoverRunner added in v0.2.6

func (s *E2BService) RecoverRunner(ctx context.Context, input RecoverInput) (StartResult, error)

func (*E2BService) StartRunner

func (s *E2BService) StartRunner(ctx context.Context, input StartInput) (StartResult, error)

func (*E2BService) StartTerminal

func (s *E2BService) StartTerminal(ctx context.Context, sandboxID string, size PtySize, onData func([]byte)) (TerminalSession, error)

func (*E2BService) StopRunner

func (s *E2BService) StopRunner(ctx context.Context, sandboxID string, pid uint32) error

func (*E2BService) ValidateTemplate

func (s *E2BService) ValidateTemplate(ctx context.Context, templateID string) error

type ExitResult

type ExitResult struct {
	ExitCode int
	Stdout   string
	Stderr   string
	Error    string
}

type PtySize

type PtySize struct {
	Cols uint32
	Rows uint32
}

type RecoverInput added in v0.2.6

type RecoverInput struct {
	RequestID      string
	SandboxID      string
	PID            uint32
	Timeout        time.Duration
	CommandContext context.Context
	OnExit         func(ExitResult, error)
}

type Service

type Service interface {
	ValidateTemplate(ctx context.Context, templateID string) error
	StartRunner(ctx context.Context, input StartInput) (StartResult, error)
	RecoverRunner(ctx context.Context, input RecoverInput) (StartResult, error)
	StopRunner(ctx context.Context, sandboxID string, pid uint32) error
	StartTerminal(ctx context.Context, sandboxID string, size PtySize, onData func([]byte)) (TerminalSession, error)
}

type StartInput

type StartInput struct {
	RequestID         string
	RunnerName        string
	RepositoryURL     string
	RegistrationToken string
	Labels            []string
	RunnerGroup       string
	TemplateID        string
	RequireDocker     bool
	Timeout           time.Duration
	CommandContext    context.Context
	OnStdout          func([]byte)
	OnStderr          func([]byte)
	OnExit            func(ExitResult, error)
}

type StartResult

type StartResult struct {
	SandboxID string
	PID       uint32
}

type TerminalSession

type TerminalSession interface {
	PID() uint32
	SendInput(ctx context.Context, data []byte) error
	Resize(ctx context.Context, size PtySize) error
	Close(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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