Repository navigation
refactor(ai): decide freeform formats in the AI package from the model's capabilities - #65898
Merged
Merged
Conversation
rekram1-node
force-pushed
the
freeform-capability
branch
from
November 24, 2026 00:11
43ec798 to
dc6faf0
Compare
rekram1-node
enabled auto-merge (squash)
November 24, 2026 00:12
beyondChang
pushed a commit
to beyondChang/opencode
that referenced
this pull request
Nov 24, 2026
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 #65849 (merged).
Whether a tool goes out as raw text, and with which grammar, was decided in two places: core dropped
freeformwhen the model's catalog didn't list the tool's format (session/model-request.ts), thenpackages/aichecked forlarkto decide whether the options line gets a grammar. Nowpackages/aimakes both calls from the model's freeform formats, and core only passes those formats through.[](catalog lists none)larklark@opencode/aicallers that don't say)Trade-offs
model.requestplugin hooks now see a tool's declaredfreeformeven when the model can't take it, instead ofundefined. The AI package still sends that tool as JSON.ModelResolver's catalog path; models built through the AI SDK path don't use OpenAI custom tools, so nothing changes for them.Checks
packages/ai: fullbun test(2304 pass), new case forresolvematching formats;bun typecheck.packages/core:model-resolver(new case: catalog formats,[]by default),session-model-request-hooks(formats pass through),tool-execute,session-runner;bun typecheckandtypecheck:tsc.bun run checkat the root.OPENCODE_FLAGS=full_codemodeonopenai/gpt-6.2-sol:executestill went out as a custom tool with the grammar; GPT wrote// @options: {"background": true}and the call ran in the background.