feat(core): let subagents pick a model and expose models tool - #49194
Open
rekram1-node wants to merge 6 commits into
Open
rekram1-node wants to merge 6 commits into
rekram1-node wants to merge 6 commits into
Conversation
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.
Follow-up to #49129. Two additions so an agent can reason about and choose models.
tools.opencode.models({ provider?, limit?, offset? })in the codemode namespace. Returns enabled models newest-first with an agent-facing shape —{ id: "provider/model", name, released, variants: string[], cost, status }— plustotalandnextfor paging (default 20, max 100). Codemode-only, like the otheropencodetools.modelon the subagent tool — optional"provider/model"or"provider/model#variant". Prompted to be used only when the user explicitly asks for a model, preferring the caller's own provider and the latest version when the request is ambiguous. Precedence is explicit model > agent's configured model > parent session's model. Validated againstModel.available()(ref and variant) with actionableToolFailuremessages. Passingmodelwhile continuing an existing child switches that child's model, mirroring the existing agent-switch behavior.Tests:
tool-opencode.test.ts(shape, ordering, paging, provider filter, disabled exclusion) and a subagent case covering override-on-create, switch-on-continue, and the three validation failures.