Skip to content

Commit ef4ecbb

Browse files
committed
fix(client): keep Cursor thinking selections visible
1 parent 7095610 commit ef4ecbb

2 files changed

Lines changed: 35 additions & 3 deletions

File tree

‎packages/client-runtime/src/modelTraits.test.ts‎

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ import { ProviderDriverKind, type ProviderOptionDescriptor } from "@t3tools/cont
33
import { buildTraitsTriggerDisplay } from "./modelTraits.ts";
44

55
describe("thinking trait label", () => {
6-
const display = (descriptors: ProviderOptionDescriptor[]) =>
6+
const display = (
7+
descriptors: ProviderOptionDescriptor[],
8+
provider = ProviderDriverKind.make("claudeAgent"),
9+
) =>
710
buildTraitsTriggerDisplay({
8-
provider: ProviderDriverKind.make("claudeAgent"),
11+
provider,
912
descriptors,
1013
primarySelectDescriptorId: "effort",
1114
ultrathinkPromptControlled: false,
@@ -42,4 +45,29 @@ describe("thinking trait label", () => {
4245
display([{ id: "thinking", label: "Thinking", type: "boolean", currentValue: false }]),
4346
).toBe("Thinking Off");
4447
});
48+
49+
it.each([true, false])("shows Cursor's thinking selection when it is %s", (thinking) => {
50+
const descriptor: ProviderOptionDescriptor = {
51+
id: "thinking",
52+
label: "Thinking",
53+
type: "boolean",
54+
currentValue: thinking,
55+
};
56+
const label = thinking ? "Thinking On" : "Thinking Off";
57+
expect(display([descriptor], ProviderDriverKind.make("cursor"))).toBe(label);
58+
expect(
59+
display(
60+
[
61+
{
62+
id: "effort",
63+
label: "Reasoning",
64+
type: "select",
65+
options: [{ id: "high", label: "High", isDefault: true }],
66+
},
67+
descriptor,
68+
],
69+
ProviderDriverKind.make("cursor"),
70+
),
71+
).toBe(`High · ${label}`);
72+
});
4573
});

‎packages/client-runtime/src/modelTraits.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ export function buildTraitsTriggerDisplay(input: {
122122
fastModeFallbackLabel = speedLabel ?? "Normal";
123123
continue;
124124
}
125-
if (descriptor.id === "thinking" && descriptor.type === "boolean") {
125+
if (
126+
input.provider === "claudeAgent" &&
127+
descriptor.id === "thinking" &&
128+
descriptor.type === "boolean"
129+
) {
126130
if (descriptor.currentValue === false) {
127131
labels.push("Thinking Off");
128132
} else {

0 commit comments

Comments
 (0)