mirror of
https://github.com/agentclientprotocol/claude-agent-acp.git
synced 2026-11-18 23:32:13 +00:00
Compare commits
1 Commits
main
...
speed-conf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebe1ebc07f |
@@ -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" },
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user