Documentation
¶
Overview ¶
Package permission is the agent's safety boundary. It models tool-call decisions (allow / deny / ask), six permission modes, allow/deny rule lists with deny-priority, and a host-provided interactive callback. The four-stage pipeline in Evaluate combines a tool's own CheckPermissions verdict with policy and mode to produce a final decision.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CanUseTool ¶
type CanUseTool func(ctx context.Context, toolName string, input json.RawMessage, pc Context) Decision
CanUseTool is the host's interactive approval callback (CLI prompt, GUI, or automated policy). It is consulted only when the pipeline reaches the "ask" stage (FR-05.1, C-02).
type Decision ¶
type Decision struct {
Behavior Behavior
UpdatedInput json.RawMessage // optional rewritten input (e.g. stripped flag)
Message string // reason, shown to model on deny / to user on ask
Suggestions []Update // optional "always allow" suggestions
}
Decision is the outcome of a permission check.
type Mode ¶
type Mode string
Mode is a permission mode (FR-05.4).
const ( ModeDefault Mode = "default" // ask for non-read-only unless a rule allows ModeAcceptEdits Mode = "acceptEdits" // auto-allow file edits/writes ModeBypass Mode = "bypassPermissions" // allow everything (except deny rules) ModePlan Mode = "plan" // read-only only ModeDontAsk Mode = "dontAsk" // never prompt; rules + read-only only ModeAuto Mode = "auto" // like dontAsk but allows tool's own allow verdict )
type Request ¶
type Request struct {
ToolName string
Input json.RawMessage
IsReadOnly bool
ToolDecision Decision // verdict from the tool's own CheckPermissions
Ctx Context
Ask CanUseTool
}
Request bundles everything Evaluate needs without importing the tool package.