From 8990c2441d3d45cb4781cd81316b3ffbafee85ee Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Thu, 19 Nov 2026 09:34:30 +0100 Subject: [PATCH] feat: report Fast mode in the speed config option category (#1659) The Fast mode config option now has the `speed` category, on v1 and v2. It was `model_config`. ## Why ACP has an unstable `speed` category for "an option that changes how fast the model responds, such as a fast mode toggle" (the [speed config category RFD](https://github.com/agentclientprotocol/agent-client-protocol/blob/main/docs/rfds/speed-config-category.mdx), and the draft session config options pages of both versions). `model_config` tells a client where to put an option, not what it does. With `speed`, a client can treat this option like any other agent's fast mode toggle. A category needs no capability. A client that does not know `speed` handles it as an unknown category. ## Changes - `createFastModeConfigOption` in `src/session-fast-mode.ts` builds the option for both versions, so one change covers both: `category: "speed"`. - The two-value select that a v1 client without boolean options gets now lists Off before On. ACP asks for the values of a `speed` select from slowest to fastest. ## For the reviewer - A client that shows `model_config` options next to the model selector and does not know `speed` will place Fast mode with its other options. - A client that picks the select's value by position now gets Off first. - Nothing in the adapter or in `docs/air-extensions.md` reads the option's category. I did not check how AIR, Zed or Delta place it. ## Tests - `fast-mode-config.test.ts` (v1): the category, and the order of the select's values. - `acp-v2.test.ts`: the category on v2. `npm run build`, `npm run check` and `npm run test:run` pass (4338 tests). --- src/session-fast-mode.ts | 12 +++++++++--- src/tests/v1/fast-mode-config.test.ts | 9 +++++---- src/tests/v2/acp-v2.test.ts | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) 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",