Expand description
Schema, parser, and validation for an agent’s permissions: frontmatter
block (#7948).
Why: the TUI permission prompt (#3422) needs a declarative rule set to
prompt from, and opencode’s permission config (see the harness
compatibility study) is the reference shape: tool globs mapped to
allow/ask/deny, optionally discriminated by an argument glob. This
module owns what an operator may write and what is rejected outright.
What: RuleDecision, PermissionMap (compiled tool-glob rules, each a
single decision or a table of argument globs), PermissionConfigError,
and parse_permissions — the one entry point, which lifts the
permissions: block out of an agent document’s frontmatter and compiles it.
FAIL-CLOSED: a malformed block is an error that fails the agent load. It is
never degraded to “no permissions”, because an empty map allows every tool.
Test: permissions::tests::config_tests — the whole module.
Structs§
- ArgRule
- One argument-glob rule inside a tool’s table.
- Compiled
Glob - One compiled glob plus the bookkeeping the precedence rule needs.
- Permission
Map - An agent’s compiled permission map.
- Tool
Rule - One
<tool-glob>: <body>entry.
Enums§
- Permission
Config Error - Every way a
permissions:block is rejected (#7948 fail-closed contract). - Rule
Body - What a tool-glob key maps to.
- Rule
Decision - The three decisions a permission rule can carry.
Functions§
- parse_
permissions - Parse the
permissions:block out of one agent document, if it has one.