Documentation
¶
Overview ¶
Package policy decides whether an agent may run an action without asking the user. It is the only place that maps an action's risk and the run's access level to allow, ask or deny; tools ask it instead of comparing levels themselves. What the agent can reach at all (registered tools, workspace roles, writable knowledge bases) is decided elsewhere and is not widened by anything here.
See docs/design/agent-permission-model.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Covers ¶
Covers reports whether a grant approved for risk granted applies to a call of risk r: a grant never covers a riskier call than it was approved for.
func Grantable ¶
Grantable reports whether approving a during a run may be remembered for later calls of the same kind: only recoverable changes the workspace does not require approving every time.
func Offered ¶
func Offered(level types.AssistantAccessLevel, risk Risk) bool
Offered reports whether an action of risk should be offered to the model at all under level. A read-only run is not shown changes it cannot make, nor anything whose risk is unknown.
func Pregrantable ¶
Pregrantable reports whether a standing grant, approved ahead of time for a specific resource, may cover a. Unlike Grantable this includes destructive actions, which only an automation's settings may pre-approve; Always still asks every time.
Types ¶
type Action ¶
type Action struct {
Risk Risk
// Always asks every time, whatever the level: a skill installation, or an
// MCP tool the workspace marked as requiring approval.
Always bool
}
Action is one call the agent wants to make.
type Risk ¶
type Risk string
Risk classifies an action by its effect on user data.
const ( // RiskRead has no side effects. RiskRead Risk = "read" // RiskProbe changes no data but does real work to answer: it connects to // an external service or runs a retrieval. RiskProbe Risk = "probe" // RiskWrite changes state in a recoverable way (reparse, status change). RiskWrite Risk = "write" // RiskDestructive removes data or cannot be undone. RiskDestructive Risk = "destructive" )
type Rules ¶
type Rules struct {
// Level is the run's effective access level.
Level types.AssistantAccessLevel
}
Rules are what the run allows.