config

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAllowEnvNonoVar = errors.New(`allow_env must not contain NONO_* variables: they reconfigure the shell sandbox itself`)
View Source
var ErrDeprecatedNetworkKeys = errors.New("sandbox.network.allow_cidrs / allow_hosts are no longer supported; use allow_domains in [sandbox.shell]")
View Source
var ErrDropRuleMissingPattern = errors.New(`each sandbox.agent.drop_commands entry requires a non-empty "pattern"`)
View Source
var ErrInvalidToolMode = errors.New(`invalid tool_mode (must be "mcp" or "hook")`)
View Source
var ErrMissingMCPCommandOutputDir = errors.New("missing required field: mcp.command_output_dir")
View Source
var ErrMovedAgentHost = errors.New("sandbox.agent.host has moved: write its keys directly under [sandbox.agent]")
View Source
var ErrMovedCommandHost = errors.New("sandbox.command.host has moved: the shell sandbox's host access is now [sandbox.shell]")
View Source
var ErrMovedCommandNetwork = errors.New("sandbox.command.network has moved: use allow_domains in [sandbox.shell]")
View Source
var ErrMovedCommandRouting = errors.New("sandbox.command has moved: command routing is now allow_commands / drop_commands in [sandbox.agent]")
View Source
var ErrMovedEnvPassthrough = errors.New("sandbox.command.env_passthrough has moved: use allow_env in [sandbox.shell]")
View Source
var ErrMovedNetworkSection = errors.New("sandbox.network has moved: it only ever configured brokered commands, so use allow_domains in [sandbox.shell]")
View Source
var ErrMovedSharedSection = errors.New("sandbox.host has moved: the base shared by both sandboxes is now [sandbox.shared]")
View Source
var ErrRemovedAllowExternal = errors.New("sandbox.network.allow_external is no longer supported: use allow_domains in [sandbox.shell]")
View Source
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

func Load(path string) (*Config, error)

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

type DropRule struct {
	Pattern string `toml:"pattern"`
	Message string `toml:"message"`
}

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 {
	Shared HostConfig  `toml:"shared"`
	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.

Jump to

Keyboard shortcuts

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