sandbox

package
v0.0.0-...-50f9a76 Latest Latest
Warning

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

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

Documentation

Overview

Package sandbox defines the isolated tool-execution abstraction used by the agent and verifier. Docker-backed execution is implemented in this package.

Index

Constants

View Source
const (
	DefaultImage    = "alpine/git:2.47.2"
	DefaultWorkdir  = "/workspace"
	DefaultRepoDir  = "repo"
	DefaultGitUser  = "wright"
	DefaultGitEmail = "wright@local"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Docker

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

Docker orchestrates task containers through the Docker Engine API.

func NewDocker

func NewDocker(retryCfg retry.Config) (*Docker, error)

NewDocker creates a Docker orchestrator using the local Docker environment. retryCfg controls retries around image pulls, the orchestrator's one genuine network connection attempt.

func NewDockerWithClient

func NewDockerWithClient(cli *client.Client, retryCfg retry.Config) *Docker

NewDockerWithClient creates a Docker orchestrator from a caller-provided client (used mainly by tests).

func (*Docker) Start

func (d *Docker) Start(ctx context.Context, spec TaskSpec) (Task, error)

Start creates, starts, and prepares a task container. If CloneURL is set, the repository is cloned into RepoDir (or DefaultRepoDir when omitted).

type FakeExec

type FakeExec struct {
	Files  map[string]string
	BashFn func(command string) (string, error)
	// contains filtered or unexported fields
}

FakeExec is an in-memory ToolExec for tests.

func (*FakeExec) Bash

func (f *FakeExec) Bash(_ context.Context, command string) (string, error)

func (*FakeExec) Exists

func (f *FakeExec) Exists(_ context.Context, path string) (bool, error)

func (*FakeExec) ReadFile

func (f *FakeExec) ReadFile(_ context.Context, path string) (string, error)

func (*FakeExec) ReplaceText

func (f *FakeExec) ReplaceText(_ context.Context, path, oldText, newText string) error

func (*FakeExec) WriteFile

func (f *FakeExec) WriteFile(_ context.Context, path, content string) error

type Orchestrator

type Orchestrator interface {
	Start(ctx context.Context, spec TaskSpec) (Task, error)
}

Orchestrator provisions per-issue isolated tasks.

type Task

type Task interface {
	ToolExec
	RepoDir() string
	Close(ctx context.Context) error
}

Task is a running sandbox task.

type TaskSpec

type TaskSpec struct {
	Image      string
	Workdir    string
	RepoDir    string
	CloneURL   string
	BaseBranch string

	GitUserName  string
	GitUserEmail string
}

TaskSpec configures one sandbox task.

type ToolExec

type ToolExec interface {
	Bash(ctx context.Context, command string) (string, error)
	ReadFile(ctx context.Context, path string) (string, error)
	WriteFile(ctx context.Context, path, content string) error
	ReplaceText(ctx context.Context, path, oldText, newText string) error
	Exists(ctx context.Context, path string) (bool, error)
}

ToolExec executes Claude tool calls inside an isolated repo workspace.

Jump to

Keyboard shortcuts

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