Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAllowEnvNonoVar = errors.New(`allow_env must not contain NONO_* variables: they reconfigure the shell sandbox itself`)
var ErrDeprecatedNetworkKeys = errors.New("sandbox.network.allow_cidrs / allow_hosts are no longer supported; use allow_domains in [sandbox.shell]")
var ErrDropRuleMissingPattern = errors.New(`each sandbox.agent.drop_commands entry requires a non-empty "pattern"`)
var ErrInvalidToolMode = errors.New(`invalid tool_mode (must be "mcp" or "hook")`)
var ErrMissingMCPCommandOutputDir = errors.New("missing required field: mcp.command_output_dir")
var ErrMovedAgentHost = errors.New("sandbox.agent.host has moved: write its keys directly under [sandbox.agent]")
var ErrMovedCommandHost = errors.New("sandbox.command.host has moved: the shell sandbox's host access is now [sandbox.shell]")
var ErrMovedCommandNetwork = errors.New("sandbox.command.network has moved: use allow_domains in [sandbox.shell]")
var ErrMovedCommandRouting = errors.New("sandbox.command has moved: command routing is now allow_commands / drop_commands in [sandbox.agent]")
var ErrMovedEnvPassthrough = errors.New("sandbox.command.env_passthrough has moved: use allow_env in [sandbox.shell]")
var ErrMovedNetworkSection = errors.New("sandbox.network has moved: it only ever configured brokered commands, so use allow_domains in [sandbox.shell]")
var ErrRemovedAllowExternal = errors.New("sandbox.network.allow_external is no longer supported: use allow_domains in [sandbox.shell]")
var ErrRemovedContainerSection = errors.New("sandbox.container is no longer supported: commands now run under nono, not Docker; remove the section")
Functions ¶
This section is empty.
Types ¶
type AgentConfig ¶ added in v0.16.0
type AgentConfig struct {
HostConfig
AllowCommands []string `toml:"allow_commands"`
DropCommands []DropRule `toml:"drop_commands"`
}
AgentConfig is the launched agent's own host access plus the routing policy for the commands it runs. Routing lives here because it describes what the agent may do — run a command on the host, or not at all — rather than what the shell sandbox may touch. The keys are allow_commands / drop_commands so they cannot be confused with the embedded HostConfig's allow, which grants a host directory.
type Config ¶
type Config struct {
ToolMode string `toml:"tool_mode"`
MCP MCPConfig `toml:"mcp"`
Sandbox SandboxConfig `toml:"sandbox"`
}
func Load ¶
Load composes the optional user-scope config (~/.config/agent-sandbox/config.toml) with the project-scope config at path, then validates the merged result. Scalars: project overrides user. Lists (agent.allow_commands, agent.drop_commands, shell.allow_domains, and every list in the three host sections): de-duplicated union.
type DropRule ¶ added in v0.14.3
DropRule is one drop pattern with an optional custom refusal message. Every drop_commands entry is written as a table so the shape is the same with or without a message:
drop_commands = [
{ pattern = "git *" },
{ pattern = "gh *", message = "gh is disabled" },
]
An omitted message leaves Message empty, and the router falls back to the default `dropped: command matches drop pattern "<pattern>"` line.
type HostConfig ¶ added in v0.13.0
type HostConfig struct {
Capabilities []string `toml:"capabilities"`
Allow []string `toml:"allow"`
Read []string `toml:"read"`
AllowFile []string `toml:"allow_file"`
ReadFile []string `toml:"read_file"`
AllowEnv []string `toml:"allow_env"`
}
HostConfig declares, in nono-agnostic terms, host-side access for one sandbox. Capabilities are named bundles expanded by internal/sandboxhost; the remaining lists are raw grants. It is embedded in AgentConfig and ShellConfig, so these keys are written directly under [sandbox.agent] / [sandbox.shell] with no intervening table.
type MCPConfig ¶ added in v0.8.0
type MCPConfig struct {
CommandOutputDir string `toml:"command_output_dir"`
}
type SandboxConfig ¶
type SandboxConfig struct {
Agent AgentConfig `toml:"agent"`
Shell ShellConfig `toml:"shell"`
}
SandboxConfig spans the two sandboxes agent-sandbox generates a profile for: the launched agent and the shell sandbox each brokered command runs in. Shared is expanded into both; Agent and Shell add grants to exactly one of them.
Nothing is inherited between the two sides. A grant reaches a profile only if it is written in that side's section or in the shared base, which is why there is no subtraction axis: anything you do not want in a profile is simply not written where that profile can see it.
type ShellConfig ¶ added in v0.16.0
type ShellConfig struct {
HostConfig
AllowDomains []string `toml:"allow_domains"`
}
ShellConfig is the host access and network reach of the sandbox a brokered command runs in.