diff --git a/apps/server/src/provider/AcpRegistryProbe.test.ts b/apps/server/src/provider/AcpRegistryProbe.test.ts index 30915b31d474f..54c08554fab70 100644 --- a/apps/server/src/provider/AcpRegistryProbe.test.ts +++ b/apps/server/src/provider/AcpRegistryProbe.test.ts @@ -107,7 +107,7 @@ describe("ACP Registry probe", () => { configOptions: [ { id: "effort", - label: "Effort", + label: "Reasoning", type: "select", options: [{ id: "high", label: "High" }], currentValue: "high", diff --git a/packages/provider-acp-registry/src/server/driver.test.ts b/packages/provider-acp-registry/src/server/driver.test.ts index 684eb21d7456b..7bc0eba29b501 100644 --- a/packages/provider-acp-registry/src/server/driver.test.ts +++ b/packages/provider-acp-registry/src/server/driver.test.ts @@ -403,10 +403,11 @@ describe("acpRegistrySnapshotReadiness", () => { [], ).models.map((model) => model.capabilities?.optionDescriptors ?? []); expect(advertised).toEqual([ - [{ ...liveOptions[0]!, role: "reasoning" }], + [{ ...liveOptions[0]!, label: "Reasoning", role: "reasoning" }], [ { ...liveOptions[0]!, + label: "Reasoning", role: "reasoning", options: [{ id: "low", label: "Low" }], currentValue: "low", @@ -467,9 +468,9 @@ describe("acpRegistrySnapshotReadiness", () => { ]); const thinking = (levels: ReadonlyArray) => ({ id: "thinking", - label: "Thinking", + label: "Reasoning", type: "select", - options: levels.map((id) => ({ id, label: id })), + options: levels.map((id) => ({ id, label: id[0]!.toUpperCase() + id.slice(1) })), currentValue: "high", role: "reasoning", }); @@ -492,7 +493,7 @@ describe("acpRegistrySnapshotReadiness", () => { ); expect(descriptors(onMedium)).toEqual([ ["mistral-large-4-0-3", [thinking(["low", "medium", "high"])]], - ["mistral-medium-3.5", [thinking(["off", "high"])]], + ["mistral-medium-3.5", [thinking(["high", "off"])]], ]); }); diff --git a/packages/provider-acp/src/server/sessionConfig.test.ts b/packages/provider-acp/src/server/sessionConfig.test.ts index ceb6ceb92783a..98d0ec4571332 100644 --- a/packages/provider-acp/src/server/sessionConfig.test.ts +++ b/packages/provider-acp/src/server/sessionConfig.test.ts @@ -43,7 +43,7 @@ describe("acpProviderOptionDescriptors", () => { expect(descriptors).toEqual([ { id: "reasoning_effort", - label: "Reasoning effort", + label: "Reasoning", type: "select", options: [ { id: "low", label: "Low" }, @@ -183,6 +183,104 @@ describe("acpProviderOptionDescriptors", () => { ]); }); + it("orders Qoder reasoning levels and badges High as the default", () => { + const descriptors = acpProviderOptionDescriptors({ + configOptions: [ + { + id: "reasoning_effort", + name: "Reasoning Effort", + category: "thought_level", + type: "select", + currentValue: "max", + options: [ + { value: "high", name: "High" }, + { value: "none", name: "None" }, + { value: "max", name: "Max" }, + { value: "low", name: "Low" }, + ], + }, + ], + modeState: undefined, + }); + + expect(descriptors).toEqual([ + { + id: "reasoning_effort", + label: "Reasoning", + type: "select", + role: "reasoning", + currentValue: "max", + options: [ + { id: "low", label: "Low" }, + { id: "high", label: "High", isDefault: true }, + { id: "max", label: "Extra High" }, + { id: "none", label: "None" }, + ], + }, + ]); + }); + + it("keeps Max distinct when the model also offers Extra High", () => { + const descriptors = acpProviderOptionDescriptors({ + configOptions: [ + { + id: "reasoning_effort", + name: "Reasoning Effort", + category: "thought_level", + type: "select", + currentValue: "max", + options: [ + { value: "max", name: "Max" }, + { value: "xhigh", name: "Xhigh" }, + { value: "low", name: "Low" }, + ], + }, + ], + modeState: undefined, + }); + + expect(descriptors[0]).toMatchObject({ + options: [ + { id: "low", label: "Low" }, + { id: "xhigh", label: "Extra High" }, + { id: "max", label: "Max" }, + ], + }); + }); + + it("does not badge High as the default for other thought levels", () => { + const descriptors = acpProviderOptionDescriptors({ + configOptions: [ + { + id: "thinking_level", + name: "Thinking Level", + category: "thought_level", + type: "select", + currentValue: "low", + options: [ + { value: "high", name: "High" }, + { value: "low", name: "Low" }, + ], + }, + ], + modeState: undefined, + }); + + expect(descriptors).toEqual([ + { + id: "thinking_level", + label: "Reasoning", + type: "select", + options: [ + { id: "low", label: "Low" }, + { id: "high", label: "High" }, + ], + currentValue: "low", + role: "reasoning", + }, + ]); + }); + it("preserves canonical opaque option values and omits values the wire would mutate", () => { const exactValue = "value:with:opaque-markers"; const descriptors = acpProviderOptionDescriptors({ diff --git a/packages/provider-acp/src/server/sessionConfig.ts b/packages/provider-acp/src/server/sessionConfig.ts index af8ee0eec0f33..b093f6177544e 100644 --- a/packages/provider-acp/src/server/sessionConfig.ts +++ b/packages/provider-acp/src/server/sessionConfig.ts @@ -33,6 +33,73 @@ export function flattenSelectChoices( return options.flatMap((candidate) => ("value" in candidate ? [candidate] : candidate.options)); } +const THOUGHT_LEVEL_ORDER = [ + "minimal", + "low", + "medium", + "high", + "xhigh", + "extra-high", + "extra_high", + "max", + "none", + "off", +] as const; + +const THOUGHT_LEVEL_RANK = new Map( + THOUGHT_LEVEL_ORDER.map((id, index) => [id, index]), +); + +function thoughtLevelLabel(id: string, fallback: string, separateMax: boolean): string { + switch (id) { + case "minimal": + return "Minimal"; + case "low": + return "Low"; + case "medium": + return "Medium"; + case "high": + return "High"; + case "xhigh": + case "extra-high": + case "extra_high": + return "Extra High"; + case "max": + // One top bucket is Extra High. Max stays Max only when Extra High is also offered. + return separateMax ? "Max" : "Extra High"; + case "none": + return "None"; + case "off": + return "Off"; + default: + return fallback; + } +} + +/** + * Agents omit a default flag. Qoder's `reasoning_effort` column badges High as Default + * while the check mark stays on `currentValue`. Other thought levels must not get that + * flag: `isDefault` is also the value used when `currentValue` is absent. + */ +function presentThoughtLevelChoices( + choices: ReadonlyArray, + badgeHighAsDefault: boolean, +): ReadonlyArray { + const ids = new Set(choices.map((choice) => choice.id)); + const separateMax = ids.has("xhigh") || ids.has("extra-high") || ids.has("extra_high"); + return [...choices] + .sort( + (left, right) => + (THOUGHT_LEVEL_RANK.get(left.id) ?? THOUGHT_LEVEL_RANK.size) - + (THOUGHT_LEVEL_RANK.get(right.id) ?? THOUGHT_LEVEL_RANK.size), + ) + .map((choice) => ({ + ...choice, + label: thoughtLevelLabel(choice.id, choice.label, separateMax), + ...(badgeHighAsDefault && choice.id === "high" ? { isDefault: true } : {}), + })); +} + function selectChoices( candidates: ReadonlyArray<{ readonly value: string; @@ -100,12 +167,16 @@ export function acpProviderOptionDescriptors(input: { if (isThoughtLevel) { mirroredModeChoiceSets.push(new Set(choices.map((choice) => choice.id))); } + const presentedChoices = isThoughtLevel + ? presentThoughtLevelChoices(choices, id === "reasoning_effort") + : choices; const currentValue = choiceId(option.currentValue); descriptors.push({ ...base, + ...(isThoughtLevel ? { label: "Reasoning" } : {}), type: "select", - options: choices, - ...(currentValue && choices.some((choice) => choice.id === currentValue) + options: presentedChoices, + ...(currentValue && presentedChoices.some((choice) => choice.id === currentValue) ? { currentValue } : {}), ...(isThoughtLevel ? { role: "reasoning" as const } : {}),