summaryrefslogtreecommitdiff
path: root/internal/sandbox/sandbox.go
blob: 42754757cea23f0d24f733ecf3d4a7d6b1c71592 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Package sandbox defines the filesystem/shell/git surface an agent loop
// executes tool calls against. Sandbox is intentionally narrow — just the
// operations internal/agentloop's read_file/write_file/run_bash/glob tools
// and its git clone/push/cleanup lifecycle need.
//
// Phase 1 ships exactly one implementation, HostSandbox, which lifts the
// LocalRunner's existing behavior (host git clone into a temp dir, plain
// os.Exec-backed file/bash tools) verbatim. A DockerSandbox (isolation
// improvements, new safety checks) is explicitly out of scope for this phase.
package sandbox

import "context"

// Sandbox is the environment a single task execution runs its tool calls
// against.
type Sandbox interface {
	ReadFile(ctx context.Context, path string) (string, error)
	WriteFile(ctx context.Context, path, content string) error
	RunBash(ctx context.Context, command string) (stdout, stderr string, exitCode int, err error)
	Glob(ctx context.Context, pattern string) ([]string, error)
	GitClone(ctx context.Context, remote, branch string) error
	GitPush(ctx context.Context, branch string) error
	WorkDir() string
	Cleanup(ctx context.Context) error
}