diff --git a/packages/coding-agent/src/slash-commands/builtin-registry.ts b/packages/coding-agent/src/slash-commands/builtin-registry.ts index 5a783618a..992c84789 100644 --- a/packages/coding-agent/src/slash-commands/builtin-registry.ts +++ b/packages/coding-agent/src/slash-commands/builtin-registry.ts @@ -62,6 +62,19 @@ function refreshStatusLine(ctx: InteractiveModeContext): void { ctx.ui.requestRender(); } +/** `/fast status` label: "off", "on", or scope-qualified "on (… only)". */ +function formatFastModeStatus(session: AgentSession): string { + if (!session.isFastModeEnabled()) return "off"; + switch (session.serviceTier) { + case "openai-only": + return "on (OpenAI only)"; + case "claude-only": + return "on (Claude only)"; + default: + return "on"; + } +} + /** Scheme-less display form of a browser deep link: accent + underline, OSC-8 linked to the full URL. */ function collabWebLinkClickable(webLink: string): string { const display = theme.fg("accent", `\x1b[4m${webLink.replace(/^https?:\/\//, "")}\x1b[24m`); @@ -359,15 +372,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray = [ return commandConsumed(); } if (arg === "status") { - const tier = runtime.session.serviceTier; - const label = !runtime.session.isFastModeEnabled() - ? "off" - : tier === "openai-only" - ? "on (OpenAI only)" - : tier === "claude-only" - ? "on (Claude only)" - : "on"; - await runtime.output(`Fast mode is ${label}.`); + await runtime.output(`Fast mode is ${formatFastModeStatus(runtime.session)}.`); return commandConsumed(); } return usage("Usage: /fast [on|off|status]", runtime); @@ -396,15 +401,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray = [ return; } if (arg === "status") { - const tier = runtime.ctx.session.serviceTier; - const label = !runtime.ctx.session.isFastModeEnabled() - ? "off" - : tier === "openai-only" - ? "on (OpenAI only)" - : tier === "claude-only" - ? "on (Claude only)" - : "on"; - runtime.ctx.showStatus(`Fast mode is ${label}.`); + runtime.ctx.showStatus(`Fast mode is ${formatFastModeStatus(runtime.ctx.session)}.`); runtime.ctx.editor.setText(""); return; }