Skip to content

feat(opencode): V2 permission.requested alongside V1 publish - #78

Merged
filipeforattini merged 1 commit into
mainfrom
feat/permission-request-shim
Aug 21, 2026
Merged

feat(opencode): V2 permission.requested alongside V1 publish#78
filipeforattini merged 1 commit into
mainfrom
feat/permission-request-shim

Conversation

@filipeforattini

@filipeforattini filipeforattini commented Aug 21, 2026

Copy link
Copy Markdown

Fifth V1→V2 shim in the series (#70 #72 #75 #76 #77). Adds SessionEvent.Permission.Requested (live event, type session.next.permission.requested) carrying the full PermissionV1.Request payload and fires it alongside the existing V1 events.publish(Event.Asked, info) in the permission service.

What this PR does

  • Adds Permission.Requested carrying the full request shape (id, sessionID, permission, patterns, metadata, always, tool).
  • The permission service now publishes both V1 (permission.asked) and V2 (session.next.permission.requested) on each ask, so V2 plugins can subscribe without registering a V1 plugin.
  • The V1 permission.ask hook continues to fire (via HookV2 watching the V1 event) so existing plugins keep working.

Pattern

Same as the rest: V2 events alongside V1 hooks, plugins pick whichever surface fits them. For permission.requested the dispatch is emit (parallel) — no veto because the ask already happened, observation only.

Out of scope

  • experimental.session.compacting / experimental.compaction.autocontinue / experimental.text.complete (all emit)
  • Agent loop decomposition (turn flow as events)
  • Profiles + bundles

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Adds `SessionEvent.Permission.Requested` (live event, type `session.next.permission.requested`) carrying the full `PermissionV1.Request` payload and fires it alongside the existing V1 `events.publish(Event.Asked, info)` in the permission service.

This is the V2 surface for the legacy V1 `permission.ask` hook (which fires via `HookV2` watching `permission.asked`). Plugins subscribe via `events.subscribe`/`events.subscribeAll` to attach audit/telemetry without registering a V1 plugin. The V1 hook continues to fire so existing plugins keep working.
@filipeforattini
filipeforattini merged commit f3eb659 into main Aug 21, 2026
5 of 7 checks passed
@filipeforattini
filipeforattini deleted the feat/permission-request-shim branch August 21, 2026 12:19
filipeforattini added a commit that referenced this pull request Aug 21, 2026
Adds `SessionEvent.Text.Complete` (live waterfall event, type `session.next.text.complete`) carrying `{ sessionID, messageID, partID, text }` and wires `EventV2Bridge.waterfall` into the text-complete dispatch next to the existing V1 `plugin.trigger('experimental.text.complete', ...)`.

The waterfall currently has a single listener that delegates to the V1 trigger so existing plugins keep working. Listeners return `{ text }` to transform the final text; throwing short-circuits the text part. Same shim pattern as #70 #72 #75 #76 #77 #78 #79.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant