feat(hooks): map notification, permissionDenied and beforeSubmitPrompt for OpenCode and Kilo - #2617
Merged
Merged
Conversation
…t for OpenCode and Kilo OpenCode's plugin event surface documents tui.toast.show and permission.replied as subscribable events, and chat.message as a named (input, output) hook. Map the canonical notification, permissionDenied and beforeSubmitPrompt events onto them so they are no longer dropped for OpenCode and Kilo. permission.replied fires for every reply, so the generated handler is gated on a rejecting reply via a new declarative gate table for generic event dispatches.
…dler Kilo's plugin docs enumerate the same events as OpenCode's except for the TUI section, which they omit entirely, so tui.toast.show is dropped from Kilo's surface rather than emitted into a plugin where it may never fire. The permission.replied gate now hangs off the canonical event, like SHELL_EVENT_TOOL_GATES, and is emitted per handler, so a future canonical event mapped onto the same dispatch cannot inherit its sibling's gate. Also record the toast channel's breadth in the docs prose, cover the matcher drop on the new generic events, and syntax-check the generated plugin now that a condition is composed into the emitted if.
This was referenced Aug 7, 2026
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenCode (verified against anomalyco/opencode v1.18.14) exposes three plugin surfaces rulesync was not mapping, so hooks authored on
notification,permissionDeniedandbeforeSubmitPromptwere silently dropped for OpenCode and Kilo.Changes
notification->tui.toast.show(a genericevent.typedispatch; defined inpackages/schema/src/tui-event.tsand listed under TUI Events in the plugins docs).permissionDenied->permission.replied(packages/schema/src/v1/permission.ts,replyis one ofonce/always/reject). The event fires for every reply, so the generated handler is gated onevent.properties.reply === "reject"through a newGENERIC_EVENT_PROPERTY_GATEStable - the generic-dispatch counterpart of the existingSHELL_EVENT_TOOL_GATES.beforeSubmitPrompt->chat.message, registered as a named(input, output)hook with anullmatcher subject, the same wayexperimental.session.compactingalready is. Amatcheron it is dropped, since the prompt text lives inoutput.partsrather than a single matchable field.Kilo follows automatically because
KILO_HOOK_EVENTSaliasesOPENCODE_HOOK_EVENTS; its tests are updated alongside OpenCode's. Docs prose, the generated hook event x tool matrix, anddocs-contentare regenerated. Verified locally with the hooks e2e spec.Note on the payload field: the v1 SDK
s generatedEventtyping still describespermission.repliedas{ permissionID, response }, but the schema source, the v2 typings, and the TUI's live consumer all agree on{ requestID, reply }`, so the stale codegen is not followed. This is recorded in a comment next to the gate.Part of #2592
Part of #2499
Remaining, deliberately not in this PR: #2592 gap 3 (references authoring) is a discretionary design item, and gap 4 (the V2 GA gate) has not fired - the latest release is still 1.18.14. #2499's mode-directories item remains design-gated.
🤖 Generated with Claude Code