diff --git a/src/session-fast-mode.ts b/src/session-fast-mode.ts index 36ab0c55..b91d0035 100644 --- a/src/session-fast-mode.ts +++ b/src/session-fast-mode.ts @@ -74,9 +74,15 @@ export function normalizeFastModeDisabledReason( /** Build the Fast mode config option. When the Client supports boolean config * options we expose a native `type: "boolean"` toggle; otherwise we degrade to - * a two-value `select` ("on"/"off") so older Clients still get a usable + * a two-value `select` ("off"/"on") so older Clients still get a usable * control. * + * Its category is `speed`, the unstable ACP category of an option that + * changes how fast the model responds, in v1 and v2. A category needs no + * capability: a Client that does not know `speed` handles it as any unknown + * category. ACP asks for a `speed` select's values from slowest to fastest, + * so the fallback lists off before on. + * * `disabledReason` (the SDK's `fast_mode_disabled_reason`) is folded into the * description while the toggle reads off, so a user whose account or provider * can't serve Fast mode sees why instead of a switch that silently refuses to @@ -92,7 +98,7 @@ export function createFastModeConfigOption( id: FAST_MODE_CONFIG_ID, name: "Fast mode", description: explanation ? `${FAST_MODE_DESCRIPTION} — ${explanation}` : FAST_MODE_DESCRIPTION, - category: "model_config", + category: "speed", } as const; if (useBooleanOption) { @@ -104,8 +110,8 @@ export function createFastModeConfigOption( type: "select", currentValue: enabled ? FAST_MODE_ON : FAST_MODE_OFF, options: [ - { value: FAST_MODE_ON, name: "On" }, { value: FAST_MODE_OFF, name: "Off" }, + { value: FAST_MODE_ON, name: "On" }, ], }; } diff --git a/src/tests/v1/fast-mode-config.test.ts b/src/tests/v1/fast-mode-config.test.ts index 34bcb479..14c099e8 100644 --- a/src/tests/v1/fast-mode-config.test.ts +++ b/src/tests/v1/fast-mode-config.test.ts @@ -54,7 +54,7 @@ describe("createFastModeConfigOption", () => { id: FAST_MODE_CONFIG_ID, name: "Fast mode", description: expect.any(String), - category: "model_config", + category: "speed", type: "boolean", currentValue: true, }); @@ -102,16 +102,17 @@ describe("createFastModeConfigOption", () => { ); }); - it("falls back to an on/off select when the client did not opt in", () => { + it("falls back to a select that lists off before on when the client did not opt in", () => { const option = createFastModeConfigOption(false, false); expect(option).toMatchObject({ id: FAST_MODE_CONFIG_ID, type: "select", - category: "model_config", + category: "speed", currentValue: FAST_MODE_OFF, + // ACP: the values of a `speed` select go from slowest to fastest. options: [ - { value: FAST_MODE_ON, name: "On" }, { value: FAST_MODE_OFF, name: "Off" }, + { value: FAST_MODE_ON, name: "On" }, ], }); expect(option).not.toHaveProperty("currentValue", true); diff --git a/src/tests/v2/acp-v2.test.ts b/src/tests/v2/acp-v2.test.ts index 90ada7ee..b7187e14 100644 --- a/src/tests/v2/acp-v2.test.ts +++ b/src/tests/v2/acp-v2.test.ts @@ -1575,6 +1575,7 @@ describe("ACP v2 sessions", () => { ]); const [update] = client.updates("config_option_update"); expect(update.configOptions.find((option) => option.configId === "fast")).toMatchObject({ + category: "speed", currentValue: false, description: "Faster responses on supported models — requires extra usage to be enabled for this account",