Expand description
Sandbox policy: “Allow / Deny / Ask user” decision for tool calls.
§Interface with the main loop
SandboxPolicy::classify is a pure decision; it returns a PolicyDecision:
Allow/Deny: the main loop branches directly.Ask(Ask): the main loop packsAsk::optionsinto an ACPRequestPermissionRequestand waits for the user’s response. When the response arrives, it callsSandboxPolicy::recordso the policy can update its internal “already authorized” table.
§Boundary with the OS-level sandbox
This module only makes decisions — OS-level isolation (landlock / seatbelt / child
process
permission dropping) is a separate trait (a future ToolSandbox). This module’s
output is
“whether to execute”, orthogonal to “how much permission to grant at execution time”.
Structs§
- Ask
- Payload for populating
Askoptions. - AskOption
- A permission option presented to the user.
- AskWrites
Policy - Default policy:
ReadOnlyis directlyAllow;Mutating,Destructive, andNetworkgo throughAsk.AllowAlwaysmaintains an internal whitelist of tool names; a match results in an immediateAllow. - Deny
AllPolicy - Deny everything. Used for smoke testing.
- Mode
Catalog - A set of mutually exclusive permission modes plus the currently selected one. Maps to
ACP’s
SessionModeState. - NonInteractive
Policy - Adapts any inner policy to a non-interactive semantics: when the inner policy returns
PolicyDecision::Ask, it is downgraded toPolicyDecision::Deny;Allow/Denyare passed through unchanged. - Open
Policy - Allows everything. Intended for testing / dev mode.
- Policy
Ctx - Context shared by
classifyandrecord. - Policy
Mode - A permission mode entry that can be selected by an ACP client.
- Read
Only Policy - Only allows
ReadOnly; everything else is denied.
Enums§
- Policy
Decision - The decision result.
- Recorded
Outcome - The “user response” that the main loop writes back to the policy.
Traits§
- Sandbox
Policy - A decision-maker for tool invocations.