From ce88676d898d68c9370246f3b52d443736d82974 Mon Sep 17 00:00:00 2001 From: Luke Parke <5702154+LukasParke@users.noreply.github.com> Date: Wed, 21 Oct 2026 18:01:28 +0000 Subject: [PATCH] fix(agent): derive NextTurnParamsContext.models from the SDK request type Port of OpenRouterTeam/typescript-sdk#821. Replace the hand-written string[] with NonNullable 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) --- .changeset/next-turn-models-type.md | 5 +++++ packages/agent/src/lib/tool-types.ts | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .changeset/next-turn-models-type.md diff --git a/.changeset/next-turn-models-type.md b/.changeset/next-turn-models-type.md new file mode 100644 index 0000000..987b83d --- /dev/null +++ b/.changeset/next-turn-models-type.md @@ -0,0 +1,5 @@ +--- +'@openrouter/agent': patch +--- + +Type `NextTurnParamsContext.models` as `NonNullable` instead of a hand-written `string[]`. It now follows the SDK's generated request type: `string[]` today, and reason-gated fallback entries once the SDK spec regenerates. With the current SDK there is no type change. diff --git a/packages/agent/src/lib/tool-types.ts b/packages/agent/src/lib/tool-types.ts index 90ce667..8c10a87 100644 --- a/packages/agent/src/lib/tool-types.ts +++ b/packages/agent/src/lib/tool-types.ts @@ -300,8 +300,12 @@ export type NextTurnParamsContext = { toolChoice: models.ResponsesRequest['toolChoice']; /** Current model selection */ model: string; - /** Current models array */ - models: string[]; + /** + * Current models array (fallback model IDs, or reason-gated fallback + * entries once the SDK spec includes them). Derived from the SDK request + * type so it tracks the generated shape. + */ + models: NonNullable; /** Current temperature */ temperature: number | null; /** Current maxOutputTokens */