@devries-cameron20 / t3code-1 / commits / d3ef7e8e52
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(cursor): send the catalog's default model parameters on every Cursor run (#28722)

Julius Marminge committed Nov 13, 2026 at 08:51 UTC d3ef7e8e527ce2076ee858fc4c5360955da54b8a
6 files changed +106 -8
packages/provider-cursor/src/server/adapter.ts
+7 -2
@@ -307,6 +307,7 @@ const CURSOR_AGENT_SETTING_SOURCES = [
307 export function makeCursorAgentOptions(input: {
308 readonly apiKey?: string;
309 readonly modelSelection: ModelSelection;
310 + readonly models?: ReadonlyArray<ServerProviderModel>;
311 readonly runtimePolicy: ProviderAdapter.ProviderAdapterV2RuntimePolicy;
312 readonly threadId: ThreadId;
313 readonly mcpSession: McpProviderSession.McpProviderSessionConfig | undefined;
@@ -315,7 +316,7 @@ export function makeCursorAgentOptions(input: {
316 const policy = cursorRuntimeAgentPolicy(input.runtimePolicy, input.platform);
317 const mcpServers = cursorMcpServers(input.mcpSession);
318 return {
318 - model: cursorSdkModelSelection(input.modelSelection),
319 + model: cursorSdkModelSelection(input.modelSelection, input.models),
320 name: `T3 Code ${input.threadId}`,
321 mode: input.runtimePolicy.interactionMode === "plan" ? "plan" : "agent",
322 ...(input.apiKey === undefined ? {} : { apiKey: input.apiKey }),
@@ -2296,6 +2297,7 @@ export const makeCursorAdapterV2 = Effect.fn("makeCursorAdapterV2")(function* (
2297 const options = makeCursorAgentOptions({
2298 ...(apiKey === undefined ? {} : { apiKey }),
2299 modelSelection: openInput.modelSelection,
2300 + models: adapterOptions.getModels?.() ?? [],
2301 runtimePolicy: openInput.runtimePolicy,
2302 platform,
2303 threadId: openInput.threadId,
@@ -2486,7 +2488,10 @@ export const makeCursorAdapterV2 = Effect.fn("makeCursorAdapterV2")(function* (
2488 message,
2489 summarize: compacted,
2490 options: {
2489 - model: cursorSdkModelSelection(turnInput.modelSelection),
2491 + model: cursorSdkModelSelection(
2492 + turnInput.modelSelection,
2493 + adapterOptions.getModels?.() ?? [],
2494 + ),
2495 mode: turnInput.runtimePolicy.interactionMode === "plan" ? "plan" : "agent",
2496 ...(Object.keys(turnMcpServers).length === 0
2497 ? {}
packages/provider-cursor/src/server/driver.test.ts
+1 -1
@@ -389,7 +389,7 @@ it.layer(layerTest)("CursorDriver", (it) => {
389 allowance: DEFAULT_HANDOFF_TOKEN_CAP,
390 },
391 catalogDefault: {
392 - model: { id: "claude-opus-5-5" },
392 + model: { id: "claude-opus-5-5", params: [{ id: "context", value: "1m" }] },
393 window: 1_000_000,
394 allowance: DEFAULT_HANDOFF_TOKEN_CAP,
395 },
packages/provider-cursor/src/server/driver.ts
+1
@@ -208,6 +208,7 @@ export const CursorDriver: ProviderDriver<
208 processEnv,
209 auth.requireApiKey,
210 auth.withAccess,
211 + () => catalogModels,
212 );
213
214 const checkProvider = auth.readApiKey.pipe(
packages/provider-cursor/src/server/sdkModel.test.ts new
+73
@@ -0,0 +1,73 @@
1 +import { ProviderInstanceId } from "@t3tools/contracts";
2 +import { describe, expect, it } from "vite-plus/test";
3 +
4 +import { cursorSdkModelSelection } from "./sdkModel.ts";
5 +import { buildCursorDiscoveredModelsFromSdk } from "./status.ts";
6 +
7 +const instanceId = ProviderInstanceId.make("cursor");
8 +const models = buildCursorDiscoveredModelsFromSdk([
9 + {
10 + id: "grok-4.5",
11 + displayName: "Grok 4.5",
12 + parameters: [
13 + {
14 + id: "effort",
15 + displayName: "Effort",
16 + values: [{ value: "low" }, { value: "medium" }, { value: "high" }],
17 + },
18 + { id: "fast", displayName: "Fast", values: [{ value: "false" }, { value: "true" }] },
19 + ],
20 + variants: [
21 + {
22 + displayName: "Grok 4.5 High Fast",
23 + isDefault: true,
24 + params: [
25 + { id: "effort", value: "high" },
26 + { id: "fast", value: "true" },
27 + ],
28 + },
29 + ],
30 + },
31 +]);
32 +
33 +describe("cursorSdkModelSelection", () => {
34 + it.each([
35 + {
36 + name: "fills unset catalog parameters and keeps Fast off",
37 + options: undefined,
38 + params: [
39 + { id: "effort", value: "high" },
40 + { id: "fast", value: "false" },
41 + ],
42 + },
43 + {
44 + name: "keeps explicit options",
45 + options: [
46 + { id: "effort", value: "low" },
47 + { id: "fastMode", value: true },
48 + ],
49 + params: [
50 + { id: "effort", value: "low" },
51 + { id: "fast", value: "true" },
52 + ],
53 + },
54 + ])("$name", ({ options, params }) => {
55 + const selection = cursorSdkModelSelection(
56 + { instanceId, model: "grok-4.5", ...(options === undefined ? {} : { options }) },
57 + models,
58 + );
59 + expect({
60 + ...selection,
61 + params: selection.params?.toSorted((a, b) => a.id.localeCompare(b.id)),
62 + }).toEqual({
63 + id: "grok-4.5",
64 + params,
65 + });
66 + });
67 +
68 + it("sends no parameters for a model missing from the catalog", () => {
69 + expect(cursorSdkModelSelection({ instanceId, model: "auto" }, models)).toEqual({
70 + id: "default",
71 + });
72 + });
73 +});
packages/provider-cursor/src/server/sdkModel.ts
+17 -3
@@ -55,13 +55,27 @@ export function cursorContextWindowTokens(
55 return Number.isSafeInteger(tokens) && tokens > 0 ? tokens : undefined;
56 }
57
58 -export function cursorSdkModelSelection(modelSelection: ModelSelection): CursorSdkModelSelection {
58 +export function cursorSdkModelSelection(
59 + modelSelection: ModelSelection,
60 + models: ReadonlyArray<ServerProviderModel> = [],
61 +): CursorSdkModelSelection {
62 + const explicit = modelSelection.options ?? [];
63 + const descriptors =
64 + models.find((model) => model.slug === modelSelection.model)?.capabilities?.optionDescriptors ??
65 + [];
66 + // Some Cursor plans reject runs that leave a catalog parameter unset; T3 keeps Fast off until picked.
67 + const defaults = descriptors.flatMap((descriptor) => {
68 + if (explicit.some((option) => option.id === descriptor.id)) return [];
69 + const value = descriptor.id === "fastMode" ? false : getProviderOptionCurrentValue(descriptor);
70 + return value === undefined ? [] : [{ id: descriptor.id, value }];
71 + });
72 + const options = [...explicit, ...defaults];
73 return {
74 id: modelSelection.model === "auto" ? "default" : modelSelection.model,
61 - ...(modelSelection.options === undefined || modelSelection.options.length === 0
75 + ...(options.length === 0
76 ? {}
77 : {
64 - params: modelSelection.options.map((option): ModelParameterValue => ({
78 + params: options.map((option): ModelParameterValue => ({
79 id: cursorSdkParameterId(option.id),
80 value: String(option.value),
81 })),
packages/provider-cursor/src/server/textGeneration.ts
+7 -2
@@ -5,7 +5,11 @@ import * as Effect from "effect/Effect";
5 import * as Option from "effect/Option";
6 import * as Schema from "effect/Schema";
7
8 -import { type ProviderSetupError, TextGenerationError } from "@t3tools/contracts";
8 +import {
9 + type ProviderSetupError,
10 + type ServerProviderModel,
11 + TextGenerationError,
12 +} from "@t3tools/contracts";
13 import type { CursorSettings } from "../settings.ts";
14
15 import * as TextGenerationOperations from "@t3tools/provider-core/server/textGenerationOperations";
@@ -51,6 +55,7 @@ export const makeCursorTextGeneration = Effect.fn("makeCursorTextGeneration")(fu
55 environment?: NodeJS.ProcessEnv,
56 resolveApiKey?: Effect.Effect<string, ProviderSetupError>,
57 withAccess?: CursorAuth["withAccess"],
58 + getModels?: () => ReadonlyArray<ServerProviderModel>,
59 ) {
60 const fs = yield* FileSystem.FileSystem;
61 const sdk = yield* CursorSdk.CursorSdk;
@@ -117,7 +122,7 @@ export const makeCursorTextGeneration = Effect.fn("makeCursorTextGeneration")(fu
122 const agentOptions = {
123 apiKey,
124 mode: "plan",
120 - model: cursorSdkModelSelection(modelSelection),
125 + model: cursorSdkModelSelection(modelSelection, getModels?.() ?? []),
126 local: {
127 cwd,
128 store,