feat(opencode): V2 commands.pre-execute alongside V1 trigger - #76
Merged
Conversation
filipeforattini
added a commit
that referenced
this pull request
Aug 21, 2026
…77) Adds `SessionEvent.Agent.PreSystem` (live waterfall event, type `session.next.agent.pre_system`) carrying `{ agent, sessionID, messageID, system }` and wires `EventV2Bridge.waterfall` into the agent generate dispatch next to the existing V1 `plugin.trigger('experimental.chat.system.transform', ...)`. The waterfall currently has a single listener that delegates to the V1 trigger so existing plugins keep working. Listeners return `{ system }` to rewrite the system prompt; throwing short-circuits the generate. Same shim pattern as #70 #72 #75 #76. `EventV2Bridge` joins the Agent layer's deps so the generate function's new service requirement propagates cleanly; `cli/cmd/agent.ts` provisions the service when running the generate effect locally.
This was referenced Aug 21, 2026
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.
Adds `SessionEvent.Command.PreExecute` (live waterfall event, type `session.next.command.pre_execute`) carrying `{ command, sessionID, arguments, parts }` and wires `EventV2Bridge.waterfall` into the command dispatch next to the existing V1 `plugin.trigger('command.execute.before', ...)`.
The waterfall currently has a single listener that delegates to the V1 trigger so existing plugins keep working. Listeners return `{ parts }` to rewrite the prompt payload; throwing short-circuits the command. Same shim pattern as #70 #72.
filipeforattini
force-pushed
the
feat/commands-pre-execute-shim
branch
from
August 21, 2026 15:12
c76d09f to
7831f17
Compare
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.
Third V1→V2 shim in the series (#70 #72 #75). Adds
SessionEvent.Command.PreExecute(live waterfall event, typesession.next.command.pre_execute) carrying{ command, sessionID, arguments, parts }and wiresEventV2Bridge.waterfallinto the command dispatch next to the existing V1plugin.trigger('command.execute.before', ...).What this PR does
Command.PreExecuteas a sibling namespace toTool, carrying command/arguments/parts.waterfallwith a single listener that delegates to the V1 trigger so existing plugins keep working unchanged.{ parts }to rewrite the prompt payload; throwing short-circuits the command.Pattern
Same shape as #70 / #72: waterfall returns the (possibly transformed) result, V1 listener falls back to the mutated shared value when no V2 plugin exists, and V2 plugins get right of last say when they do.
Out of scope
agent.pre-systemforexperimental.chat.system.transformpermission.requestforpermission.askexperimental.session.compacting/experimental.compaction.autocontinue/experimental.text.complete(all emit)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.