feat(opencode): pass sessionID, model, and agent to tool.definition hook#17955
Open
ualtinok wants to merge 1 commit intoanomalyco:devfrom
Open
feat(opencode): pass sessionID, model, and agent to tool.definition hook#17955ualtinok wants to merge 1 commit intoanomalyco:devfrom
ualtinok wants to merge 1 commit intoanomalyco:devfrom
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found a related PR: Related PR Found:
Why it's related: This PR is explicitly mentioned in the current PR's description as being superseded by PR #17955. PR #17331 appears to address a similar concern about requiring session IDs for tool definitions, which is part of the broader refactoring in the current PR. The current PR (#17955) is the newer implementation that builds upon and supersedes the earlier work in #17331 (and also #17334 as mentioned in the description). |
2b43967 to
ad05dce
Compare
e6a43d5 to
b890fc5
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.
Issue for this PR
Closes #17954
Supersedes #17334 / #17331
Type of change
What does this PR do?
Passes
sessionIDthrough the tool registry sotool.definitionplugin hooks can adapt tool descriptions based on session context.Changes:
packages/opencode/src/tool/registry.ts— RefactoredToolRegistry.tools()from positional args(model, agent?)to a single input object{ model, sessionID, agent? }. AddedSessionIDtype import.All call sites updated:
session/prompt.ts— threadssession.idthroughtool/batch.ts— threadsctx.sessionIDthroughcli/cmd/debug/agent.ts— creates session before fetching tools, passes session ID to bothgetAvailableToolsandcreateToolContextserver/routes/experimental.ts— requiressessionIDquery param, validates session exists (404 if missing), addedSessionID,NotFoundError,HTTPExceptionimportsHow did you verify your code works?
Screenshots / recordings
Not a UI change.
Checklist