Open History to see the last commit
1import * as NodeOS from "node:os";
2
3import * as NodeServices from "@effect/platform-node/NodeServices";
4import { Effect, FileSystem, Path } from "effect";
5import { describe, expect, it } from "vitest";
6import type * as EffectAcpSchema from "effect-acp/schema";
7import type { CursorSettings, ServerProviderModel } from "@t3tools/contracts";
8import { createModelCapabilities } from "@t3tools/shared/model";
9
10import {
11 buildCursorProviderSnapshot,
12 buildCursorCapabilitiesFromConfigOptions,
13 buildCursorDiscoveredModelsFromConfigOptions,
14 checkCursorProviderStatus,
15 discoverCursorModelCapabilitiesViaAcp,
16 discoverCursorModelsViaAcp,
17 getCursorFallbackModels,
18 getCursorParameterizedModelPickerUnsupportedMessage,
19 parseCursorAboutOutput,
20 parseCursorCliConfigChannel,
21 parseCursorVersionDate,
22 resolveCursorAcpBaseModelId,
23 resolveCursorAcpConfigUpdates,
24} from "./CursorProvider.ts";
25
26const runNode = <A, E>(
27 effect: Effect.Effect<A, E, FileSystem.FileSystem | Path.Path>,
28): Promise<A> => Effect.runPromise(effect.pipe(Effect.provide(NodeServices.layer)));
29
30const resolveMockAgentPath = Effect.fn("resolveMockAgentPath")(function* () {
31 const path = yield* Path.Path;
32 return yield* path.fromFileUrl(new URL("../../../scripts/acp-mock-agent.ts", import.meta.url));
33});
34
35function selectDescriptor(
36 id: string,
37 label: string,
38 options: ReadonlyArray<{ id: string; label: string; isDefault?: boolean }>,
39) {
40 return {
41 id,
42 label,
43 type: "select" as const,
44 options: [...options],
45 ...(options.find((option) => option.isDefault)?.id
46 ? { currentValue: options.find((option) => option.isDefault)?.id }
47 : {}),
48 };
49}
50
51function booleanDescriptor(id: string, label: string, currentValue?: boolean) {
52 return {
53 id,
54 label,
55 type: "boolean" as const,
56 ...(typeof currentValue === "boolean" ? { currentValue } : {}),
57 };
58}
59
60const makeMockAgentWrapper = Effect.fn("makeMockAgentWrapper")(function* (
61 extraEnv?: Record<string, string>,
62) {
63 const fileSystem = yield* FileSystem.FileSystem;
64 const path = yield* Path.Path;
65 const mockAgentPath = yield* resolveMockAgentPath();
66 const dir = yield* fileSystem.makeTempDirectory({
67 directory: NodeOS.tmpdir(),
68 prefix: "cursor-provider-mock-",
69 });
70 const wrapperPath = path.join(dir, "fake-agent.sh");
71 const envExports = Object.entries(extraEnv ?? {})
72 .map(([key, value]) => `export ${key}=${JSON.stringify(value)}`)
73 .join("\n");
74 const script = `#!/bin/sh
75${envExports}
76exec ${JSON.stringify("bun")} ${JSON.stringify(mockAgentPath)} "$@"
77`;
78 yield* fileSystem.writeFileString(wrapperPath, script);
79 yield* fileSystem.chmod(wrapperPath, 0o755);
80 return wrapperPath;
81});
82
83const makeMockAgentWithAboutWrapper = Effect.fn("makeMockAgentWithAboutWrapper")(function* () {
84 const fileSystem = yield* FileSystem.FileSystem;
85 const path = yield* Path.Path;
86 const mockAgentPath = yield* resolveMockAgentPath();
87 const dir = yield* fileSystem.makeTempDirectory({
88 directory: NodeOS.tmpdir(),
89 prefix: "cursor-provider-about-mock-",
90 });
91 const wrapperPath = path.join(dir, "fake-agent.sh");
92 const script = `#!/bin/sh
93if [ "$1" = "about" ]; then
94 printf 'CLI Version 2026.04.09-f2b0fcd\\n'
95 printf 'User Email cursor@example.com\\n'
96 exit 0
97fi
98exec ${JSON.stringify("bun")} ${JSON.stringify(mockAgentPath)} "$@"
99`;
100 yield* fileSystem.writeFileString(wrapperPath, script);
101 yield* fileSystem.chmod(wrapperPath, 0o755);
102 return wrapperPath;
103});
104
105const waitForFileContent = Effect.fn("waitForFileContent")(function* (
106 filePath: string,
107 attempts = 40,
108) {
109 const fileSystem = yield* FileSystem.FileSystem;
110 for (let attempt = 0; attempt < attempts; attempt += 1) {
111 const content = yield* fileSystem
112 .readFileString(filePath)
113 .pipe(Effect.catch(() => Effect.void));
114 if (content !== undefined) {
115 if (content.trim().length > 0) {
116 return content;
117 }
118 }
119 yield* Effect.sleep("50 millis");
120 }
121 return yield* Effect.fail(new Error(`Timed out waiting for file content at ${filePath}`));
122});
123
124const makeProviderStatusEnvFixture = Effect.fn("makeProviderStatusEnvFixture")(function* () {
125 const fileSystem = yield* FileSystem.FileSystem;
126 const path = yield* Path.Path;
127 const tempDir = yield* fileSystem.makeTempDirectory({
128 directory: NodeOS.tmpdir(),
129 prefix: "cursor-provider-status-env-",
130 });
131 return {
132 requestLogPath: path.join(tempDir, "requests.ndjson"),
133 wrapperPath: yield* makeMockAgentWithAboutWrapper(),
134 };
135});
136
137const makeExitLogFixture = Effect.fn("makeExitLogFixture")(function* (prefix: string) {
138 const fileSystem = yield* FileSystem.FileSystem;
139 const path = yield* Path.Path;
140 const tempDir = yield* fileSystem.makeTempDirectory({
141 directory: NodeOS.tmpdir(),
142 prefix,
143 });
144 const exitLogPath = path.join(tempDir, "exit.log");
145 return {
146 exitLogPath,
147 wrapperPath: yield* makeMockAgentWrapper({
148 T3_ACP_EXIT_LOG_PATH: exitLogPath,
149 }),
150 };
151});
152
153const parameterizedGpt54ConfigOptions = [
154 {
155 type: "select",
156 currentValue: "gpt-5.4-medium-fast",
157 options: [{ name: "GPT-5.4", value: "gpt-5.4-medium-fast" }],
158 category: "model",
159 id: "model",
160 name: "Model",
161 },
162 {
163 type: "select",
164 currentValue: "medium",
165 options: [
166 { name: "None", value: "none" },
167 { name: "Low", value: "low" },
168 { name: "Medium", value: "medium" },
169 { name: "High", value: "high" },
170 { name: "Extra High", value: "extra-high" },
171 ],
172 category: "thought_level",
173 id: "reasoning",
174 name: "Reasoning",
175 },
176 {
177 type: "select",
178 currentValue: "272k",
179 options: [
180 { name: "272K", value: "272k" },
181 { name: "1M", value: "1m" },
182 ],
183 category: "model_config",
184 id: "context",
185 name: "Context",
186 },
187 {
188 type: "select",
189 currentValue: "false",
190 options: [
191 { name: "Off", value: "false" },
192 { name: "Fast", value: "true" },
193 ],
194 category: "model_config",
195 id: "fast",
196 name: "Fast",
197 },
198] satisfies ReadonlyArray<EffectAcpSchema.SessionConfigOption>;
199
200const parameterizedClaudeConfigOptions = [
201 {
202 type: "select",
203 currentValue: "claude-4.6-opus-high-thinking",
204 options: [{ name: "Opus 4.6", value: "claude-4.6-opus-high-thinking" }],
205 category: "model",
206 id: "model",
207 name: "Model",
208 },
209 {
210 type: "select",
211 currentValue: "high",
212 options: [
213 { name: "Low", value: "low" },
214 { name: "Medium", value: "medium" },
215 { name: "High", value: "high" },
216 ],
217 category: "thought_level",
218 id: "reasoning",
219 name: "Reasoning",
220 },
221 {
222 type: "boolean",
223 currentValue: true,
224 category: "model_config",
225 id: "thinking",
226 name: "Thinking",
227 },
228] satisfies ReadonlyArray<EffectAcpSchema.SessionConfigOption>;
229
230const parameterizedClaudeModelOptionConfigOptions = [
231 {
232 type: "select",
233 currentValue: "claude-opus-4-6",
234 options: [{ name: "Opus 4.6", value: "claude-opus-4-6" }],
235 category: "model",
236 id: "model",
237 name: "Model",
238 },
239 {
240 type: "select",
241 currentValue: "high",
242 options: [
243 { name: "Low", value: "low" },
244 { name: "Medium", value: "medium" },
245 { name: "High", value: "high" },
246 ],
247 category: "thought_level",
248 id: "reasoning",
249 name: "Reasoning",
250 },
251 {
252 type: "select",
253 currentValue: "max",
254 options: [
255 { name: "Low", value: "low" },
256 { name: "Medium", value: "medium" },
257 { name: "High", value: "high" },
258 { name: "Max", value: "max" },
259 ],
260 category: "model_option",
261 id: "effort",
262 name: "Effort",
263 },
264 {
265 type: "select",
266 currentValue: "true",
267 options: [
268 { name: "Off", value: "false" },
269 { name: "Fast", value: "true" },
270 ],
271 category: "model_config",
272 id: "fast",
273 name: "Fast",
274 },
275 {
276 type: "select",
277 currentValue: "true",
278 options: [
279 { name: "Off", value: "false" },
280 { name: ":icon-brain:", value: "true" },
281 ],
282 category: "model_config",
283 id: "thinking",
284 name: "Thinking",
285 },
286] satisfies ReadonlyArray<EffectAcpSchema.SessionConfigOption>;
287
288const sessionNewCursorConfigOptions = [
289 {
290 type: "select",
291 currentValue: "agent",
292 options: [
293 { name: "Agent", value: "agent", description: "Full agent capabilities with tool access" },
294 ],
295 category: "mode",
296 id: "mode",
297 name: "Mode",
298 description: "Controls how the agent executes tasks",
299 },
300 {
301 type: "select",
302 currentValue: "composer-2",
303 options: [
304 { name: "Auto", value: "default" },
305 { name: "Composer 2", value: "composer-2" },
306 { name: "GPT-5.4", value: "gpt-5.4" },
307 { name: "Sonnet 4.6", value: "claude-sonnet-4-6" },
308 { name: "Opus 4.6", value: "claude-opus-4-6" },
309 { name: "Codex 5.3 Spark", value: "gpt-5.3-codex-spark" },
310 ],
311 category: "model",
312 id: "model",
313 name: "Model",
314 description: "Controls which model is used for responses",
315 },
316 {
317 type: "select",
318 currentValue: "true",
319 options: [
320 { name: "Off", value: "false" },
321 { name: "Fast", value: "true" },
322 ],
323 category: "model_config",
324 id: "fast",
325 name: "Fast",
326 description: "Faster speeds.",
327 },
328] satisfies ReadonlyArray<EffectAcpSchema.SessionConfigOption>;
329
330const baseCursorSettings: CursorSettings = {
331 enabled: true,
332 binaryPath: "agent",
333 apiEndpoint: "",
334 customModels: [],
335};
336
337const emptyCapabilities = createModelCapabilities({ optionDescriptors: [] });
338
339describe("getCursorFallbackModels", () => {
340 it("does not publish any built-in cursor models before ACP discovery", () => {
341 expect(
342 getCursorFallbackModels({
343 customModels: ["internal/cursor-model"],
344 }).map((model) => model.slug),
345 ).toEqual(["internal/cursor-model"]);
346 });
347});
348
349describe("buildCursorProviderSnapshot", () => {
350 it("downgrades ready status to warning when ACP model discovery times out", () => {
351 expect(
352 buildCursorProviderSnapshot({
353 checkedAt: "2026-01-01T00:00:00.000Z",
354 cursorSettings: baseCursorSettings,
355 parsed: {
356 version: "2026.04.09-f2b0fcd",
357 status: "ready",
358 auth: { status: "authenticated", type: "Team", label: "Cursor Team Subscription" },
359 },
360 discoveryWarning: "Cursor ACP model discovery timed out after 15000ms.",
361 }),
362 ).toMatchObject({
363 status: "warning",
364 message: "Cursor ACP model discovery timed out after 15000ms.",
365 models: [],
366 });
367 });
368
369 it("preserves provider error state while appending discovery warnings", () => {
370 expect(
371 buildCursorProviderSnapshot({
372 checkedAt: "2026-01-01T00:00:00.000Z",
373 cursorSettings: {
374 ...baseCursorSettings,
375 customModels: ["claude-sonnet-4-6"],
376 },
377 parsed: {
378 version: "2026.04.09-f2b0fcd",
379 status: "error",
380 auth: { status: "unauthenticated" },
381 message: "Cursor Agent is not authenticated. Run `agent login` and try again.",
382 },
383 discoveryWarning: "Cursor ACP model discovery failed. Check server logs for details.",
384 }),
385 ).toMatchObject({
386 status: "error",
387 message:
388 "Cursor Agent is not authenticated. Run `agent login` and try again. Cursor ACP model discovery failed. Check server logs for details.",
389 models: [
390 {
391 slug: "claude-sonnet-4-6",
392 isCustom: true,
393 },
394 ],
395 });
396 });
397});
398
399describe("buildCursorCapabilitiesFromConfigOptions", () => {
400 it("derives model capabilities from parameterized Cursor ACP config options", () => {
401 expect(buildCursorCapabilitiesFromConfigOptions(parameterizedGpt54ConfigOptions)).toEqual(
402 createModelCapabilities({
403 optionDescriptors: [
404 selectDescriptor("reasoning", "Reasoning", [
405 { id: "low", label: "Low" },
406 { id: "medium", label: "Medium", isDefault: true },
407 { id: "high", label: "High" },
408 { id: "xhigh", label: "Extra High" },
409 ]),
410 selectDescriptor("contextWindow", "Context", [
411 { id: "272k", label: "272K", isDefault: true },
412 { id: "1m", label: "1M" },
413 ]),
414 booleanDescriptor("fastMode", "Fast", false),
415 ],
416 }),
417 );
418 });
419
420 it("detects boolean thinking toggles from model_config options", () => {
421 expect(buildCursorCapabilitiesFromConfigOptions(parameterizedClaudeConfigOptions)).toEqual(
422 createModelCapabilities({
423 optionDescriptors: [
424 selectDescriptor("reasoning", "Reasoning", [
425 { id: "low", label: "Low" },
426 { id: "medium", label: "Medium" },
427 { id: "high", label: "High", isDefault: true },
428 ]),
429 booleanDescriptor("thinking", "Thinking", true),
430 ],
431 }),
432 );
433 });
434
435 it("prefers the newer model_option effort control over legacy thought_level", () => {
436 expect(
437 buildCursorCapabilitiesFromConfigOptions(parameterizedClaudeModelOptionConfigOptions),
438 ).toEqual(
439 createModelCapabilities({
440 optionDescriptors: [
441 selectDescriptor("reasoning", "Effort", [
442 { id: "low", label: "Low" },
443 { id: "medium", label: "Medium" },
444 { id: "high", label: "High" },
445 { id: "max", label: "Max", isDefault: true },
446 ]),
447 booleanDescriptor("fastMode", "Fast", true),
448 booleanDescriptor("thinking", "Thinking", true),
449 ],
450 }),
451 );
452 });
453});
454
455describe("buildCursorDiscoveredModelsFromConfigOptions", () => {
456 it("publishes ACP model choices immediately from session/new config options", () => {
457 expect(buildCursorDiscoveredModelsFromConfigOptions(sessionNewCursorConfigOptions)).toEqual([
458 {
459 slug: "default",
460 name: "Auto",
461 isCustom: false,
462 capabilities: emptyCapabilities,
463 },
464 {
465 slug: "composer-2",
466 name: "Composer 2",
467 isCustom: false,
468 capabilities: createModelCapabilities({
469 optionDescriptors: [booleanDescriptor("fastMode", "Fast", true)],
470 }),
471 },
472 {
473 slug: "gpt-5.4",
474 name: "GPT-5.4",
475 isCustom: false,
476 capabilities: emptyCapabilities,
477 },
478 {
479 slug: "claude-sonnet-4-6",
480 name: "Sonnet 4.6",
481 isCustom: false,
482 capabilities: emptyCapabilities,
483 },
484 {
485 slug: "claude-opus-4-6",
486 name: "Opus 4.6",
487 isCustom: false,
488 capabilities: emptyCapabilities,
489 },
490 {
491 slug: "gpt-5.3-codex-spark",
492 name: "Codex 5.3 Spark",
493 isCustom: false,
494 capabilities: emptyCapabilities,
495 },
496 ]);
497 });
498});
499
500describe("checkCursorProviderStatus", () => {
501 it("passes the injected environment to ACP model discovery", async () => {
502 const { requestLogPath, wrapperPath } = await runNode(makeProviderStatusEnvFixture());
503
504 const provider = await Effect.runPromise(
505 checkCursorProviderStatus(
506 {
507 enabled: true,
508 binaryPath: wrapperPath,
509 apiEndpoint: "",
510 customModels: [],
511 },
512 {
513 ...process.env,
514 T3_ACP_REQUEST_LOG_PATH: requestLogPath,
515 },
516 ).pipe(Effect.provide(NodeServices.layer)),
517 );
518
519 expect(provider.models.map((model) => model.slug)).toEqual([
520 "default",
521 "composer-2",
522 "gpt-5.4",
523 "claude-opus-4-6",
524 ]);
525 await expect(runNode(waitForFileContent(requestLogPath))).resolves.toContain("initialize");
526 });
527});
528
529describe("discoverCursorModelsViaAcp", () => {
530 it("keeps the ACP probe runtime alive long enough to discover models", async () => {
531 const wrapperPath = await runNode(makeMockAgentWrapper());
532
533 const models = await Effect.runPromise(
534 discoverCursorModelsViaAcp({
535 enabled: true,
536 binaryPath: wrapperPath,
537 apiEndpoint: "",
538 customModels: [],
539 }).pipe(Effect.provide(NodeServices.layer), Effect.scoped),
540 );
541
542 expect(models.map((model) => model.slug)).toEqual([
543 "default",
544 "composer-2",
545 "gpt-5.4",
546 "claude-opus-4-6",
547 ]);
548 });
549
550 it("closes the ACP probe runtime after discovery completes", async () => {
551 const { exitLogPath, wrapperPath } = await runNode(
552 makeExitLogFixture("cursor-provider-exit-log-"),
553 );
554
555 await Effect.runPromise(
556 discoverCursorModelsViaAcp({
557 enabled: true,
558 binaryPath: wrapperPath,
559 apiEndpoint: "",
560 customModels: [],
561 }).pipe(Effect.provide(NodeServices.layer)),
562 );
563
564 const exitLog = await runNode(waitForFileContent(exitLogPath));
565 expect(exitLog).toContain("SIGTERM");
566 });
567});
568
569describe("discoverCursorModelCapabilitiesViaAcp", () => {
570 it("closes all ACP probe runtimes after capability enrichment completes", async () => {
571 const { exitLogPath, wrapperPath } = await runNode(
572 makeExitLogFixture("cursor-capabilities-exit-log-"),
573 );
574 const existingModels: ReadonlyArray<ServerProviderModel> = [
575 { slug: "default", name: "Auto", isCustom: false, capabilities: emptyCapabilities },
576 { slug: "composer-2", name: "Composer 2", isCustom: false, capabilities: emptyCapabilities },
577 { slug: "gpt-5.4", name: "GPT-5.4", isCustom: false, capabilities: emptyCapabilities },
578 {
579 slug: "claude-opus-4-6",
580 name: "Opus 4.6",
581 isCustom: false,
582 capabilities: emptyCapabilities,
583 },
584 ];
585
586 const models = await Effect.runPromise(
587 discoverCursorModelCapabilitiesViaAcp(
588 {
589 enabled: true,
590 binaryPath: wrapperPath,
591 apiEndpoint: "",
592 customModels: [],
593 },
594 existingModels,
595 ).pipe(Effect.provide(NodeServices.layer)),
596 );
597
598 expect(models.map((model) => model.slug)).toEqual([
599 "default",
600 "composer-2",
601 "gpt-5.4",
602 "claude-opus-4-6",
603 ]);
604
605 const exitLog = await runNode(waitForFileContent(exitLogPath));
606 expect(exitLog.match(/SIGTERM/g)?.length ?? 0).toBe(4);
607 });
608});
609
610describe("parseCursorAboutOutput", () => {
611 it("parses json about output and forwards subscription metadata", () => {
612 expect(
613 parseCursorAboutOutput({
614 code: 0,
615 stdout: JSON.stringify({
616 cliVersion: "2026.04.09-f2b0fcd",
617 subscriptionTier: "Team",
618 userEmail: "jmarminge@gmail.com",
619 }),
620 stderr: "",
621 }),
622 ).toEqual({
623 version: "2026.04.09-f2b0fcd",
624 status: "ready",
625 auth: {
626 status: "authenticated",
627 email: "jmarminge@gmail.com",
628 type: "Team",
629 label: "Cursor Team Subscription",
630 },
631 });
632 });
633
634 it("treats json about output with a logged-out email as unauthenticated", () => {
635 expect(
636 parseCursorAboutOutput({
637 code: 0,
638 stdout: JSON.stringify({
639 cliVersion: "2026.04.09-f2b0fcd",
640 subscriptionTier: "Team",
641 userEmail: "Not logged in",
642 }),
643 stderr: "",
644 }),
645 ).toEqual({
646 version: "2026.04.09-f2b0fcd",
647 status: "error",
648 auth: {
649 status: "unauthenticated",
650 },
651 message: "Cursor Agent is not authenticated. Run `agent login` and try again.",
652 });
653 });
654
655 it("treats json about output with a null email as unauthenticated", () => {
656 expect(
657 parseCursorAboutOutput({
658 code: 0,
659 stdout: JSON.stringify({
660 cliVersion: "2026.04.09-f2b0fcd",
661 subscriptionTier: null,
662 userEmail: null,
663 }),
664 stderr: "",
665 }),
666 ).toEqual({
667 version: "2026.04.09-f2b0fcd",
668 status: "error",
669 auth: {
670 status: "unauthenticated",
671 },
672 message: "Cursor Agent is not authenticated. Run `agent login` and try again.",
673 });
674 });
675});
676
677describe("Cursor parameterized model picker preview gating", () => {
678 it("parses Cursor CLI version dates from build versions", () => {
679 expect(parseCursorVersionDate("2026.04.08-c4e73a3")).toBe(20260408);
680 expect(parseCursorVersionDate("2026.04.09")).toBe(20260409);
681 expect(parseCursorVersionDate("not-a-version")).toBeUndefined();
682 });
683
684 it("parses the Cursor CLI channel from cli-config.json", () => {
685 expect(parseCursorCliConfigChannel('{ "channel": "lab" }')).toBe("lab");
686 expect(parseCursorCliConfigChannel('{ "channel": "stable" }')).toBe("stable");
687 expect(parseCursorCliConfigChannel('{ "version": 1 }')).toBeUndefined();
688 expect(parseCursorCliConfigChannel("not-json")).toBeUndefined();
689 });
690
691 it("returns no warning when the preview requirements are met", () => {
692 expect(
693 getCursorParameterizedModelPickerUnsupportedMessage({
694 version: "2026.04.08-c4e73a3",
695 channel: "lab",
696 }),
697 ).toBeUndefined();
698 });
699
700 it("explains when the Cursor Agent version is too old", () => {
701 expect(
702 getCursorParameterizedModelPickerUnsupportedMessage({
703 version: "2026.04.07-c4e73a3",
704 channel: "lab",
705 }),
706 ).toContain("too old");
707 });
708
709 it("explains when the Cursor Agent channel is not lab", () => {
710 expect(
711 getCursorParameterizedModelPickerUnsupportedMessage({
712 version: "2026.04.08-c4e73a3",
713 channel: "stable",
714 }),
715 ).toContain("lab channel");
716 });
717});
718
719describe("resolveCursorAcpBaseModelId", () => {
720 it("drops bracket traits without rewriting raw ACP model ids", () => {
721 expect(resolveCursorAcpBaseModelId("gpt-5.4[reasoning=medium,context=272k]")).toBe("gpt-5.4");
722 expect(resolveCursorAcpBaseModelId("gpt-5.4-medium-fast")).toBe("gpt-5.4-medium-fast");
723 expect(resolveCursorAcpBaseModelId("claude-4.6-opus-high-thinking")).toBe(
724 "claude-4.6-opus-high-thinking",
725 );
726 expect(resolveCursorAcpBaseModelId("composer-2")).toBe("composer-2");
727 expect(resolveCursorAcpBaseModelId("auto")).toBe("auto");
728 });
729});
730
731describe("resolveCursorAcpConfigUpdates", () => {
732 it("maps Cursor model options onto separate ACP config option updates", () => {
733 expect(
734 resolveCursorAcpConfigUpdates(parameterizedGpt54ConfigOptions, [
735 { id: "reasoning", value: "xhigh" },
736 { id: "fastMode", value: true },
737 { id: "contextWindow", value: "1m" },
738 ]),
739 ).toEqual([
740 { configId: "reasoning", value: "extra-high" },
741 { configId: "context", value: "1m" },
742 { configId: "fast", value: "true" },
743 ]);
744 });
745
746 it("maps boolean thinking toggles when the model exposes them separately", () => {
747 expect(
748 resolveCursorAcpConfigUpdates(parameterizedClaudeConfigOptions, [
749 { id: "thinking", value: false },
750 ]),
751 ).toEqual([{ configId: "thinking", value: false }]);
752 });
753
754 it("maps explicit fastMode: false so the adapter can clear a prior fast selection", () => {
755 expect(
756 resolveCursorAcpConfigUpdates(parameterizedGpt54ConfigOptions, [
757 { id: "fastMode", value: false },
758 ]),
759 ).toEqual([{ configId: "fast", value: "false" }]);
760 });
761
762 it("writes Cursor effort changes through the newer model_option config when available", () => {
763 expect(
764 resolveCursorAcpConfigUpdates(parameterizedClaudeModelOptionConfigOptions, [
765 { id: "reasoning", value: "max" },
766 { id: "thinking", value: false },
767 ]),
768 ).toEqual([
769 { configId: "effort", value: "max" },
770 { configId: "thinking", value: "false" },
771 ]);
772 });
773});