Skip to content

[FEATURE]: Wire the permission.ask plugin hook #19469

@jacobprall

Description

@jacobprall

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

The permission.ask hook is declared in the Hooks interface (@opencode-ai/plugin) but never triggered from the permission engine. Plugins that implement permission.ask are silently ignored.

Wiring it would let plugins auto-allow or auto-deny permission requests before prompting the user — useful for governance sidecars, policy engines, and MCP integrations that manage permissions externally.

Proposed behavior:

  • Built-in ruleset evaluation stays unchanged (deny short-circuits, allow passes).
  • When rules evaluate to "ask", fire Plugin.trigger("permission.ask", ...) after the request enters the pending queue.
  • If the plugin sets status:"allow" → resolve immediately, no prompt.
  • If the plugin sets status:"deny" → throw DeniedError, no prompt.
  • If the plugin leaves status:"ask" or throws → normal prompt flow.

Small change (~40 lines in permission/index.ts), zero regressions on existing tests.

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions