Skip to main content

Module permissions

Module permissions 

Source
Expand description

Permission normalization and relay for the uniform per-command approval (“ask”) mode.

Each backend CLI that supports interactive, per-command approval exposes the approval handshake over a different JSON wire format. This module translates those native frames into a single normalized permission_request event and translates a normalized decision (once | always | reject) back into the native response frame that the CLI expects on its stdin.

Only tools with a drivable JSON request/response permission protocol can be relayed (see ASK_SUPPORTED_TOOLS). Tools whose only native approval mechanism is a static policy (opencode), a sandbox coupling (codex), or a non-streaming approval flag (qwen, gemini) are documented in the parity table but fail clearly when ask mode is requested — mirroring the --read-only unsupported-tool pattern.

This is the Rust mirror of js/src/permissions/.

Structs§

NormalizedPermissionRequest
A normalized permission request, uniform across every relayable backend.
PermissionParityRow
A single row of the per-command approval parity table.
PermissionRelay
Relay native permission requests to a consumer and forward decisions back.

Constants§

ASK_DECISIONS
Normalized decisions a consumer may return for a permission request.
ASK_SUPPORTED_TOOLS
Tools that expose a relayable per-command approval protocol over JSON.

Functions§

ask_scope
Scope of an always decision for each backend. The reviewer (m13v) flagged that “always” does not mean the same thing across CLIs, so the normalized event and the parity table both carry this scope.
ask_unsupported_error
Build the standard error for tools without a relayable per-command approval mechanism (ask mode). Mirrors crate::command_builder::read_only_unsupported_error.
build_permission_response
Build the native response frame for a normalized decision.
normalize_permission_request
Normalize a native permission request frame into a uniform event.
permission_parity
Parity description for each tool’s native per-command approval mechanism.
supports_ask
Whether agent-commander can relay per-command approvals for the given tool.