feat(plugin): add messageID to tool.execute.before/after hooks#15831
Open
chaomao wants to merge 3 commits intoanomalyco:devfrom
Open
feat(plugin): add messageID to tool.execute.before/after hooks#15831chaomao wants to merge 3 commits intoanomalyco:devfrom
chaomao wants to merge 3 commits intoanomalyco:devfrom
Conversation
Tool execution hooks now include the messageID so plugin authors can correlate tool calls back to the assistant message that triggered them. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
|
@adamdotdevin please review |
6 tasks
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.
Tool execution hooks now include the messageID so plugin authors can correlate tool calls back to the assistant message that triggered them.
Issue for this PR
Close #15933
Type of change
What does this PR do?
tool.execute.beforeandtool.execute.afterhook payloads were missingmessageID, making it impossible for plugin authors to correlate a tool call back to the assistant message that triggered itmessageID: stringto the input of both hooks inpackages/plugin/src/index.tspackages/opencode/src/session/prompt.ts: built-in tools, MCP tools, and the task toolHow did you verify your code works?
bun run --cwd packages/opencode typecheckpasses with no errorsmessageIDis already present in the localTool.Contextat every trigger site (input.processor.message.idfor built-in/MCP tools,assistantMessage.idfor the task tool) — this just threads it through to the plugin payloadScreenshots / recordings
below is the screenshot of tool.execute.before hooks show logs.

Checklist
If you do not follow this template your PR will be automatically rejected.