Compare commits

...

1 Commits

Author SHA1 Message Date
Ben Brandt
ebe1ebc07f feat: report Fast mode in the speed config option category
ACP has an unstable `speed` category for an option that changes how fast
the model responds, in v1 and v2 (the speed config option category RFD).
The Fast mode option was `model_config`, which tells a client where to put
an option and not what it does. It is `speed` now, on both versions, so a
client can treat it as it treats another agent's fast mode toggle.

A category needs no capability. A client that does not know `speed`
handles it as any unknown category.

ACP asks for the values of a `speed` select from slowest to fastest. The
select that a v1 client without boolean options gets listed on before off.
It lists off before on now.
2026-11-18 16:59:17 +01:00
3 changed files with 15 additions and 7 deletions

View File

@@ -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" },
],
};
}

View File

@@ -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);

View File

@@ -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",