sandboxrunner

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: Apache-2.0 Imports: 9 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")
)

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"`
	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 E2BService

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

func NewE2BService

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

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) 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 Service

type Service interface {
	ValidateTemplate(ctx context.Context, templateID string) error
	StartRunner(ctx context.Context, input StartInput) (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
	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