Skip to main content

Module config

Module config 

Source
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.
CompiledGlob
One compiled glob plus the bookkeeping the precedence rule needs.
PermissionMap
An agent’s compiled permission map.
ToolRule
One <tool-glob>: <body> entry.

Enums§

PermissionConfigError
Every way a permissions: block is rejected (#7948 fail-closed contract).
RuleBody
What a tool-glob key maps to.
RuleDecision
The three decisions a permission rule can carry.

Functions§

parse_permissions
Parse the permissions: block out of one agent document, if it has one.