Repository navigation
fix(agent): derive NextTurnParamsContext.models from the SDK request type - #134
Draft
LukasParke wants to merge 1 commit into
Draft
LukasParke wants to merge 1 commit into
LukasParke wants to merge 1 commit into
Conversation
…type Port of OpenRouterTeam/typescript-sdk#821. Replace the hand-written string[] with NonNullable<models.ResponsesRequest['models']> so the field accepts reason-gated fallback entries once the spec regenerates (openrouter-web#34136). With @openrouter/sdk 0.13.7 the type is still string[], so this is a no-op today. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
What
Port of OpenRouterTeam/typescript-sdk#821.
NextTurnParamsContext.modelsis now typed asNonNullable<models.ResponsesRequest['models']>instead of the hand-writtenstring[](packages/agent/src/lib/tool-types.ts).Why
openrouter-web#34136 adds reason-gated fallback entries, which turns
modelsinto(string | ReasonGatedFallbackModel)[]. A hand-writtenstring[]would then stop type-checking against the generated request type. Deriving the type from the request keeps the two in sync.Compatibility
@openrouter/sdk@0.13.7still typesResponsesRequest.modelsasArray<string>, so today the type staysstring[]and nothing changes. The latest published SDK (1.4.25) is also stillArray<string>.main,buildNextTurnParamsContext, assignsrequest.models ?? [], which already has this type.context.models[i]as astringwill need to narrow it. Nothing onmaindoes that today. Open PR fix(agent): populate primary model from models fallback array (#121) #124 readsmodels[0]from the request, not from this context, and already guards it with atypeofstring check.Testing
pnpm typecheck,pnpm lintand the unit tests pass. Added a patch changeset.🤖 Generated with Claude Code