Documentation
¶
Overview ¶
Package sandbox provides an OS-level virtualized execution environment with strict confinement across three foundational capabilities: Filesystem (FS), Process execution (Proc), and Network access (Net).
Pure Virtualized OS Layer ¶
The sandbox package is a pure operating-system virtualization boundary. It has zero awareness of AI models, Loom, agents, tools, or Git worktrees, and does not provide context-value injection helpers. Higher-level subsystems (such as workspace managers or tool executors) consume a Sandbox explicitly via its capability interfaces. Host-to-sandbox file transfers (Sandbox.Upload and Sandbox.Download) live exclusively on the top-level Sandbox controller and are intentionally omitted from FS so untrusted callers holding only FS cannot reference host paths.
Execution Modes ¶
A Sandbox operates in one of two modes configured via Mode:
ModeLocal: Confines filesystem operations to the sandbox working directory using Go's kernel-backed os.Root capability handle, manages child processes via isolated Unix process groups, and enforces network policies in-process through a policy-enforcing dialer (Net).
ModeNative: Layers OS-native kernel sandboxing over ModeLocal for spawned processes. On macOS (darwin), child processes are wrapped with Seatbelt (/usr/bin/sandbox-exec) using dynamically generated mandatory access control profiles. On Linux, child processes are isolated inside unprivileged namespaces via Bubblewrap (bwrap) with read-only root bind mounts, isolated PID namespaces, and optional network namespace unsharing.
Strict Environment & Security Invariants ¶
- Zero Implicit Environment Leakage: The sandbox never reads os.Environ or os.Getenv when constructing child process environments. Child processes receive strictly the variables declared in Config.Env merged with per-command overrides in Command.Env (plus a minimal safe PATH default if none is provided).
- Traversal-Safe Filesystem: All filesystem operations are rooted in Config.WorkDir via os.Root, preventing symlink escapes and "../" path traversal attacks with ErrPathEscape.
- Read-Only Enforcement: When Config.ReadOnly is enabled, mutating filesystem calls return ErrReadOnly immediately, and native OS profiles disallow writes to the working directory.
- Protected Write Paths: Callers may supply a FilesystemPolicy whose DeniedWritePaths stay read-only at the kernel level even inside the writable Config.WorkDir or FilesystemPolicy.ExtraWritePaths; Sandbox.SetFilesystemPolicy swaps the policy live so subsequent child processes observe updated rules without recreating the sandbox.
- Process Group Lifecycle: Every spawned process runs in its own process group. Killing a process or closing the sandbox terminates the entire process tree, preventing orphan background processes.
Index ¶
- Constants
- Variables
- func Availability() api.SandboxAvailability
- func NativeAvailable() error
- func RelayServe(ctx context.Context, unixSocket string, port int) error
- func RunSandboxRelay(unixSocket string, port int, target string, args []string) error
- type Command
- type Config
- type ExecResult
- type FS
- type File
- type FilesystemPolicy
- type HostApprovalFunc
- type HostApprover
- type LookupIP
- type Mode
- type Net
- type NetworkPolicy
- type Platform
- type Proc
- type Process
- type Proxy
- func (p *Proxy) Addr() string
- func (p *Proxy) Close() error
- func (p *Proxy) DialContext(ctx context.Context, network, addr string) (net.Conn, error)
- func (p *Proxy) Policy() ProxyPolicy
- func (p *Proxy) Port() int
- func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (p *Proxy) SetApprover(a HostApprover)
- func (p *Proxy) SetPolicy(policy ProxyPolicy)
- func (p *Proxy) UnixSocket() string
- type ProxyConfig
- type ProxyPolicy
- type Sandbox
- type WatchEvent
- type WatchOp
- type WatchOptions
- type Watcher
Constants ¶
const SandboxRelayArg = "sandbox-relay"
SandboxRelayArg is the hidden TaskSmith subcommand children run inside a sandboxed Linux network namespace to bridge loopback traffic to the daemon-side allowlist proxy.
Variables ¶
var ( ErrSandboxClosed = errors.New("sandbox: sandbox is closed") ErrInvalidConfig = errors.New("sandbox: invalid configuration") ErrReadOnly = errors.New("sandbox: filesystem is read-only") ErrPathEscape = errors.New("sandbox: path escapes sandbox root") ErrNetworkDisabled = errors.New("sandbox: network access is disabled") ErrHostBlocked = errors.New("sandbox: target host is blocked by policy") ErrLoopbackBlocked = errors.New("sandbox: loopback address access is blocked by policy") ErrInvalidURL = errors.New("sandbox: invalid http/https url") ErrWatchUnsupported = errors.New("sandbox: watching filesystem is unsupported") )
Sentinel errors returned by the sandbox package.
var ErrProxyClosed = errors.New("sandbox: network proxy is closed")
ErrProxyClosed is returned when the proxy is asked to serve after Close.
Functions ¶
func Availability ¶
func Availability() api.SandboxAvailability
Availability reports the health of this host's OS-native kernel sandbox backend: the backend name ("seatbelt" on macOS, "bubblewrap" on Linux, "" on unsupported platforms), whether the cached probe succeeded, the probe error detail, and actionable remediation guidance when the backend is unavailable (e.g. installing bubblewrap or lifting Ubuntu's AppArmor unprivileged-userns restriction).
func NativeAvailable ¶
func NativeAvailable() error
NativeAvailable reports whether the OS-native kernel sandbox backend (Seatbelt on macOS, Bubblewrap on Linux) is usable on this host. The check actually probes sandbox creation (cached), not just binary presence, so restricted containers and nested-sandbox hosts degrade to local isolation.
func RelayServe ¶
RelayServe bridges TCP connections on 127.0.0.1:port to the allowlist proxy's Unix socket at unixSocket. It runs inside the child's closed network namespace on Linux, where the only path to the daemon-side proxy is the Unix socket bind-mounted inside the sandbox temp dir: children keep talking to the same http://127.0.0.1:<port> proxy URL the sandbox injects, and the relay forwards every byte to the real proxy over the socket.
The listener is bound before RelayServe returns so a supervising process can exec its target the moment the port answers. It blocks until ctx is canceled and closes the listener and the socket file before returning.
func RunSandboxRelay ¶
RunSandboxRelay supervises one sandboxed command inside the closed network namespace: it raises the loopback interface, starts a relay server for the proxy socket as a background process, waits until the loopback proxy port answers, then execs the real target in place. When the target exits the process group is killed, which tears the relay server down with it.
Types ¶
type Command ¶
type Command struct {
// Name is the executable name or path to invoke.
Name string
// Args holds command-line arguments passed to the executable (excluding argv[0]).
Args []string
// Dir specifies the working directory relative to the sandbox root (or an
// absolute path within the sandbox root). If empty, defaults to WorkDir.
Dir string
// Env contains per-command environment variables merged on top of the
// sandbox's base Config.Env.
Env map[string]string
// Stdin supplies standard input when calling Proc.Exec.
Stdin io.Reader
// Stdout optionally receives standard output when calling Proc.Exec.
// If nil, output is captured in ExecResult.Stdout.
Stdout io.Writer
// Stderr optionally receives standard error when calling Proc.Exec.
// If nil, output is captured in ExecResult.Stderr.
Stderr io.Writer
// Timeout overrides the sandbox's DefaultTimeout for Proc.Exec.
Timeout time.Duration
// ReadOnly requests a read-only kernel profile for this individual
// command even when the sandbox itself is writable. In ModeNative the
// generated Seatbelt/Bubblewrap profile denies all file writes outside the
// dedicated temp directory for this process only. It has no effect in
// ModeLocal, which has no kernel enforcement.
ReadOnly bool
// Unsandboxed runs this single command directly on the host, skipping the
// kernel wrapper in ModeNative while keeping process-group tracking, the
// session environment scrubbing, and lifecycle teardown. The command
// inherits the host temp/cache directories instead of the sandbox temp
// dir. Combining Unsandboxed with a read-only session or ReadOnly command
// is rejected with ErrReadOnly. It has no effect in ModeLocal, which
// already runs processes without a kernel wrapper.
Unsandboxed bool
}
Command specifies the parameters for executing a child process inside the sandbox.
type Config ¶
type Config struct {
// ID is an optional identifier for the sandbox. If empty, a deterministic
// prefix of the configuration fingerprint is used.
ID string `json:"id,omitempty"`
// Mode selects the isolation backend. Defaults to ModeLocal if empty.
Mode Mode `json:"mode,omitempty"`
// WorkDir is the required existing absolute directory on the host that serves
// as the root of the sandbox filesystem and default process working directory.
WorkDir string `json:"work_dir"`
// ReadOnly blocks all mutating filesystem operations and configures native
// OS sandboxes to disallow file writes inside WorkDir.
ReadOnly bool `json:"read_only,omitempty"`
// Env specifies the explicit base environment variables exposed to child
// processes. The host daemon's os.Environ() is never inherited.
Env map[string]string `json:"env,omitempty"`
// Network configures outbound network restrictions.
Network NetworkPolicy `json:"network,omitzero"`
// OnUnlistedHost is consulted by the allowlist proxy when child traffic
// targets a host matching neither the allowed nor denied domain patterns.
// A nil approver refuses unlisted hosts. It is only consulted while the
// Network.Allowlist posture is active.
OnUnlistedHost HostApprovalFunc `json:"-"`
// Filesystem carries the structured read/write path lists native OS
// sandbox profiles enforce in addition to the WorkDir confinement. It has
// no effect in ModeLocal, where reads and writes are already confined to
// WorkDir by the os.Root handle.
Filesystem FilesystemPolicy `json:"filesystem,omitzero"`
// SessionWriteDirs lists session-private directories outside WorkDir (such
// as <session-dir>/plans/) that remain writable through the in-process FS
// capability even when ReadOnly is true. Child processes never inherit these
// paths when ReadOnly is active.
SessionWriteDirs []string `json:"-"`
// DefaultTimeout sets the fallback execution timeout for Proc.Exec when
// Command.Timeout is zero.
DefaultTimeout time.Duration `json:"default_timeout,omitempty"`
}
Config defines the configuration for instantiating a Sandbox.
func (*Config) Fingerprint ¶
Fingerprint computes a canonical SHA-256 hex digest of the effective sandbox configuration, normalizing slices and maps for deterministic comparison.
type ExecResult ¶
type ExecResult struct {
Stdout []byte `json:"stdout,omitempty"`
Stderr []byte `json:"stderr,omitempty"`
ExitCode int `json:"exit_code"`
Duration time.Duration `json:"duration"`
}
ExecResult contains the captured output and exit metadata of a completed process.
type FS ¶
type FS interface {
fs.FS // Open(name string) (fs.File, error)
ReadFile(ctx context.Context, path string) ([]byte, error)
WriteFile(ctx context.Context, path string, data []byte, perm fs.FileMode) error
OpenFile(ctx context.Context, path string, flag int, perm fs.FileMode) (File, error)
Stat(ctx context.Context, path string) (fs.FileInfo, error)
Lstat(ctx context.Context, path string) (fs.FileInfo, error)
ReadDir(ctx context.Context, path string) ([]fs.DirEntry, error)
MkdirAll(ctx context.Context, path string, perm fs.FileMode) error
Remove(ctx context.Context, path string) error
RemoveAll(ctx context.Context, path string) error
Rename(ctx context.Context, oldpath, newpath string) error
Chmod(ctx context.Context, path string, perm fs.FileMode) error
// ResolvePath validates path and returns a clean, slash-separated path
// relative to the sandbox root, or ErrPathEscape if path escapes WorkDir.
ResolvePath(path string) (string, error)
// Watch monitors the directory at path (relative to WorkDir) for filesystem changes.
Watch(ctx context.Context, path string, opts WatchOptions) (Watcher, error)
}
FS provides traversal-safe filesystem operations confined to the sandbox's working directory. It implements io/fs.FS for read-only standard library compatibility alongside context-aware read and write operations.
type FilesystemPolicy ¶
type FilesystemPolicy struct {
// DeniedReadPaths lists host paths (typically credential directories)
// that child processes must not read even though the profile allows
// broad file reads.
DeniedReadPaths []string `json:"denied_read_paths,omitempty"`
// AllowReadPaths lists subpaths inside a DeniedReadPaths entry that
// should remain readable. A narrower AllowReadPaths entry re-opens a
// subtree masked by a broader DeniedReadPaths entry.
AllowReadPaths []string `json:"allow_read_paths,omitempty"`
// ExtraWritePaths lists additional writable directories outside WorkDir
// (such as a linked git worktree's shared .git directory) that child
// processes may write to.
ExtraWritePaths []string `json:"extra_write_paths,omitempty"`
// DeniedWritePaths lists paths inside WorkDir or ExtraWritePaths that
// must stay read-only at the kernel level (such as .agents,
// WORKSPACE.md, and .git/hooks), overriding the broad write allow.
DeniedWritePaths []string `json:"denied_write_paths,omitempty"`
}
FilesystemPolicy describes the canonical path lists a native OS sandbox profile enforces beyond the sandbox work directory itself. All entries must be absolute host paths; relative or blank entries are dropped during normalization.
func (FilesystemPolicy) Clone ¶
func (p FilesystemPolicy) Clone() FilesystemPolicy
Clone returns a deep copy of the policy so callers can extend a shared baseline (e.g. layering user sandbox.json overrides onto the built-in floor) without mutating the original lists.
func (*FilesystemPolicy) IsZero ¶
func (p *FilesystemPolicy) IsZero() bool
IsZero reports whether the policy carries no path restrictions.
type HostApprovalFunc ¶
HostApprovalFunc adapts a plain function to HostApprover.
func (HostApprovalFunc) ApproveHost ¶
ApproveHost implements HostApprover.
type HostApprover ¶
type HostApprover interface {
ApproveHost(ctx context.Context, host string, port int) (bool, error)
}
HostApprover is consulted when child traffic targets a host that matches no policy pattern. Returning true admits the connection for this request only; persistent grants live in the caller's permission rules. A non-nil error is surfaced to the client alongside the refusal. The session package supplies an implementation wired to the permission engine (HostApprovalFunc adapts a plain function).
type LookupIP ¶
LookupIP resolves a hostname; tests inject deterministic tables to exercise the DNS-rebinding guard without live DNS.
type Mode ¶
type Mode = api.SandboxMode
Mode defines the isolation backend used by a Sandbox.
const ( // ModeLocal confines operations to the host working directory using os.Root, // process group lifecycle management, and in-process network policy dialers. ModeLocal Mode = api.SandboxLocal // ModeNative wraps child process execution in OS-level kernel sandboxes // (macOS Seatbelt sandbox-exec or Linux Bubblewrap bwrap) in addition to // ModeLocal's os.Root and Net enforcement. ModeNative Mode = api.SandboxNative )
func DefaultMode ¶
func DefaultMode() Mode
DefaultMode returns ModeNative when the OS kernel sandbox backend is usable on this host, falling back to ModeLocal otherwise.
func ResolveMode ¶
ResolveMode maps a requested sandbox backend onto the mode this host can enforce: explicit ModeLocal selects ModeLocal, while empty or ModeNative prefers ModeNative and degrades to ModeLocal when the kernel backend is unavailable.
type Net ¶
type Net interface {
// DialContext connects to the address on the named network while enforcing
// the sandbox's NetworkPolicy (disabled check, host allow/block lists, and
// loopback IP prevention).
DialContext(ctx context.Context, network, addr string) (net.Conn, error)
// HTTPClient returns a new *http.Client whose transport is wired to use
// the sandbox's policy-enforced DialContext.
HTTPClient() *http.Client
// ValidateURL parses and validates an outbound HTTP or HTTPS URL and
// checks its hostname against the sandbox's NetworkPolicy (Disabled,
// BlockedHosts, AllowedHosts, and literal/localhost loopback rules).
ValidateURL(rawURL string) (*url.URL, error)
}
Net provides network dialing and HTTP client generation subject to the sandbox's NetworkPolicy.
type NetworkPolicy ¶
type NetworkPolicy struct {
// Disabled completely blocks all outbound network connections when true.
Disabled bool `json:"disabled,omitempty"`
// Allowlist routes child process traffic through the daemon-side domain
// proxy instead of granting direct network access. It only takes effect
// in ModeNative, where the kernel profile can physically force the
// routing; in ModeLocal the in-process Net capability still enforces
// AllowedHosts/BlockedHosts, but child processes cannot be confined.
Allowlist bool `json:"allowlist,omitempty"`
// AllowedHosts restricts outbound connections to matching hostnames or
// wildcard domain patterns (e.g., "api.example.com", "*.example.com").
// When empty, all non-blocked hosts are permitted.
AllowedHosts []string `json:"allowed_hosts,omitempty"`
// BlockedHosts denies outbound connections to matching hostnames or
// wildcard domain patterns. BlockedHosts takes precedence over AllowedHosts.
BlockedHosts []string `json:"blocked_hosts,omitempty"`
// AllowLoopback permits connections to loopback IP addresses (127.0.0.0/8, ::1).
// When false (the default), dialing any host that resolves to or specifies a
// loopback address is rejected with ErrLoopbackBlocked.
AllowLoopback bool `json:"allow_loopback,omitempty"`
}
NetworkPolicy defines outbound network access controls for the sandbox.
func (*NetworkPolicy) IsZero ¶
func (p *NetworkPolicy) IsZero() bool
func (*NetworkPolicy) ProxyPolicy ¶
func (p *NetworkPolicy) ProxyPolicy() ProxyPolicy
ProxyPolicy derives the domain policy the network proxy enforces from the sandbox network posture.
type Platform ¶
type Platform struct {
OS string `json:"os"`
Arch string `json:"arch"`
WorkDir string `json:"work_dir"`
}
Platform describes the target operating system, architecture, and root path of a sandbox instance.
type Proc ¶
type Proc interface {
// Exec runs a command to completion, capturing its stdout, stderr, exit code,
// and execution duration. Non-zero exit codes are returned in ExecResult.ExitCode
// without returning a Go error unless the context expires or startup fails.
Exec(ctx context.Context, cmd Command) (*ExecResult, error)
// Start launches a command asynchronously with streaming stdio pipes.
Start(ctx context.Context, cmd Command) (Process, error)
}
Proc provides process execution confined to the sandbox.
type Process ¶
type Process interface {
// PID returns the operating system process ID.
PID() int
// Stdin returns the write-closer pipe connected to the process's standard input.
Stdin() io.WriteCloser
// Stdout returns the read-closer pipe connected to the process's standard output.
Stdout() io.ReadCloser
// Stderr returns the read-closer pipe connected to the process's standard error.
Stderr() io.ReadCloser
// Wait waits for the process to exit and returns its execution result.
// When pipes are consumed directly via Stdout()/Stderr(), ExecResult contains
// any remaining unread bytes alongside the exit code and duration.
Wait() (*ExecResult, error)
// Signal sends an OS signal to the process group.
Signal(sig os.Signal) error
// Kill forcefully terminates the entire process group with SIGKILL.
Kill() error
}
Process represents a running child process started via Proc.Start.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy is a daemon-side HTTP and CONNECT proxy enforcing the sandbox.json network allowlist for sandboxed child processes. Child processes reach it through the proxy environment variables injected into their environment; the kernel profile denies them every other outbound path.
func NewProxy ¶
func NewProxy(cfg ProxyConfig) (*Proxy, error)
NewProxy binds the proxy to an ephemeral loopback TCP port and starts serving.
func (*Proxy) DialContext ¶
DialContext exposes the policy-checked dialer for in-process consumers.
func (*Proxy) Policy ¶
func (p *Proxy) Policy() ProxyPolicy
Policy returns a deep copy of the current policy.
func (*Proxy) ServeHTTP ¶
func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements both plain HTTP forwarding and CONNECT tunneling.
func (*Proxy) SetApprover ¶
func (p *Proxy) SetApprover(a HostApprover)
SetApprover swaps the unlisted-host approver; nil refuses unlisted hosts.
func (*Proxy) SetPolicy ¶
func (p *Proxy) SetPolicy(policy ProxyPolicy)
SetPolicy atomically swaps the domain policy for subsequent connections.
func (*Proxy) UnixSocket ¶
UnixSocket returns the optional unix socket path the proxy also serves.
type ProxyConfig ¶
type ProxyConfig struct {
// Policy is the initial domain policy; it can be swapped at runtime via
// [Proxy.SetPolicy].
Policy ProxyPolicy
// Approver is consulted for hosts matching no policy pattern. It may be
// replaced later via [Proxy.SetApprover].
Approver HostApprover
// Resolve optionally overrides DNS resolution (tests).
Resolve LookupIP
// UnixSocket optionally binds an additional listener at the given path so
// network-namespaced sandboxes can reach the proxy over a filesystem
// socket. A bind failure is returned to the caller.
UnixSocket string
}
ProxyConfig configures a Proxy.
type ProxyPolicy ¶
type ProxyPolicy struct {
// AllowedDomains lists exact hostnames and "*.domain" wildcard patterns
// routed without prompting. A literal-IP pattern (e.g. "127.0.0.1") also
// waives the reserved-IP guard for that address.
AllowedDomains []string
// DeniedDomains lists patterns that are always refused, taking precedence
// over AllowedDomains and any host approval.
DeniedDomains []string
}
ProxyPolicy carries the domain rules the network proxy enforces on child process traffic. It mirrors the merged sandbox.json network posture.
func (ProxyPolicy) Clone ¶
func (p ProxyPolicy) Clone() ProxyPolicy
Clone returns a deep copy so stored policies cannot be mutated in place.
type Sandbox ¶
type Sandbox interface {
// ID returns the unique identifier of the sandbox instance.
ID() string
// Mode returns the active isolation mode (ModeLocal or ModeNative).
Mode() Mode
// ReadOnly reports whether the sandbox currently enforces read-only
// filesystem semantics.
ReadOnly() bool
// SetReadOnly toggles read-only enforcement for future filesystem
// operations and native OS sandbox profiles. Toggling to true does not
// terminate already-running child processes; it affects subsequent
// executions and confined FS operations.
SetReadOnly(readOnly bool)
// Platform returns the OS, architecture, and canonical root directory.
Platform() Platform
// Env returns a defensive copy of the sandbox's base environment variables.
Env() map[string]string
// SetEnv replaces the sandbox's base environment variables for future child
// processes, defensively cloning env so external mutations cannot affect the
// sandbox.
SetEnv(env map[string]string)
// Filesystem returns a defensive copy of the sandbox's current native
// filesystem path policy.
Filesystem() FilesystemPolicy
// SetFilesystemPolicy atomically replaces the native filesystem path
// policy for future child processes, defensively cloning policy so
// external mutations cannot affect the sandbox. Already-running child
// processes keep the kernel profile they started with. It has no effect
// in ModeLocal.
SetFilesystemPolicy(policy FilesystemPolicy)
// SetNetworkPolicy atomically replaces the live outbound network posture
// for future child processes and in-process dials. When the Allowlist
// flag turns on in ModeNative the sandbox starts its domain proxy; when
// it turns off the proxy stops. Already-running child processes keep the
// profile and environment they started with. If the proxy cannot start,
// the allowlist posture is kept (fail-closed: confined children get no
// network) and the error is reported.
SetNetworkPolicy(policy NetworkPolicy) error
// FS returns the confined filesystem capability rooted at WorkDir.
FS() FS
// Proc returns the confined process execution capability.
Proc() Proc
// Net returns the policy-enforced network capability.
Net() Net
// Upload copies a file or directory tree from hostSrc on the host filesystem
// into sandboxDst within the sandbox. Returns ErrReadOnly if the sandbox is
// configured as read-only, or ErrPathEscape if sandboxDst escapes WorkDir.
Upload(ctx context.Context, hostSrc, sandboxDst string) error
// Download copies a file or directory tree from sandboxSrc within the sandbox
// to hostDst on the host filesystem. Returns ErrPathEscape if sandboxSrc
// escapes WorkDir.
Download(ctx context.Context, sandboxSrc, hostDst string) error
// Close terminates all active processes spawned inside the sandbox and
// releases underlying OS resources (such as the os.Root handle).
Close() error
}
Sandbox represents an isolated OS execution environment exposing confined filesystem, process, and network capabilities.
type WatchEvent ¶
type WatchEvent struct {
Path string // Clean, slash-separated sandbox-relative path
Op WatchOp // Bitmask of operations
}
WatchEvent describes a filesystem mutation event within the sandbox.
type WatchOptions ¶
type WatchOptions struct {
Recursive bool // Watch directory and all subdirectories recursively
Ignore []string // Additional directory names or patterns to ignore (always includes .git, .bare)
MaxDirs int // Maximum directories to watch (defaults to 1024 when <= 0)
}
WatchOptions configures filesystem watching.
type Watcher ¶
type Watcher interface {
Events() <-chan WatchEvent
Errors() <-chan error
Close() error
}
Watcher provides streaming notifications of filesystem events within the sandbox.