Expand description
The runtime permission gate: evaluate, ask, await, time out (#7948).
Why: config says what an operator wrote and matcher says which rule
applies; this module turns a tool call into “dispatch it” or “refuse it”,
including the suspend-and-await path an ask rule needs, behind one call
at the agent loop’s dispatch site.
What: PermissionMode (the headless escape hatch), Decision (the pure
evaluation), Outcome/DenySource (the final answer), PermissionEvents
(the emit seam SessionRegistry implements), PermissionContext (the
session-scoped half), and PermissionGate (one agent’s gate).
An agent with no permissions: block short-circuits to Allow after the
legacy allowlist check, and HARNESS_REGISTERED_TOOLS skips that check
entirely, so stock bundled agents are unaffected.
Test: permissions::tests::gate_tests — the whole module.
Structs§
- Permission
Context - The session-scoped, agent-independent half of a gate’s configuration.
- Permission
Gate - One agent’s permission gate — the object the agent loop holds.
Enums§
- Decision
- The pure evaluation of a tool call against an agent’s configuration.
- Deny
Source - Why a call was refused, and what
Event::PermissionResolved.sourcesays. Test:headless_ask_is_denied,timed_out_ask_is_denied,client_deny_is_denied. - Outcome
- The gate’s final answer for one tool call.
Test:
deny_message_names_the_rule. - Permission
Mode - What a run does with an
askit cannot put to a client.
Constants§
- ALLOW_
ASKS_ SOURCE Event::PermissionResolved.sourcefor anaskthatPermissionMode::AllowAsksapproved without a client (#7948).- DEFAULT_
ASK_ TIMEOUT_ SECS - How long an unanswered
askwaits before resolving to deny. - HARNESS_
REGISTERED_ TOOLS - The tools the HARNESS registers on an agent’s behalf, exempt from the legacy
tcode_toolsallowlist (#7948). - PERMISSION_
MODE_ ENV - Environment fallback for
PermissionModewhen no CLI flag is given. - REMEMBERED_
SOURCE Event::PermissionResolved.sourcefor anaska grant this session already remembers satisfied, with no client round trip (#7948).
Traits§
- Permission
Events - The emit seam for the two permission events.