Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

feat(composer): open the mode menu instead of cycling the chip

vastsa90951c165ab4
diff --git a/apps/desktop/src/components/Composer.tsx b/apps/desktop/src/components/Composer.tsx
index bebc1d609..c9baf395d 100644
--- a/apps/desktop/src/components/Composer.tsx
+++ b/apps/desktop/src/components/Composer.tsx
@@ -151,6 +151,7 @@ export function Composer({
: EMPTY_QUEUED_PROMPTS,
);
+ const [modeOpen, setModeOpen] = useState(false);
const [permissionOpen, setPermissionOpen] = useState(false);
const composerTransformInvalidateRef = useRef<() => void>(() => {});
const composerShellRef = useRef<HTMLDivElement>(null);
@@ -415,6 +416,7 @@ export function Composer({
useEffect(() => {
if (!controlsBlocked) return;
+ setModeOpen(false);
setPermissionOpen(false);
}, [controlsBlocked]);
@@ -609,6 +611,8 @@ export function Composer({
modelId={modelId}
thinkingLevel={thinkingLevel}
composerPermissionMode={composerPermissionMode}
+ modeOpen={modeOpen}
+ setModeOpen={setModeOpen}
permissionOpen={permissionOpen}
setPermissionOpen={setPermissionOpen}
controlsBlocked={controlsBlocked}
diff --git a/apps/desktop/src/features/chat/composer/ComposerModePicker.tsx b/apps/desktop/src/features/chat/composer/ComposerModePicker.tsx
new file mode 100644
index 000000000..55da2662a
--- /dev/null
+++ b/apps/desktop/src/features/chat/composer/ComposerModePicker.tsx
@@ -0,0 +1,99 @@
+import type { Dispatch, SetStateAction } from "react";
+import type { TFunction } from "i18next";
+import type { Mode } from "@pi-desktop/shared";
+import { AnchoredMenu } from "../../../components/settings/AnchoredMenu";
+import { TooltipButton } from "../../../components/ui";
+import { IconCheck, IconChevronDown } from "../../../components/icons";
+import { ModeIcon } from "./ComposerModeIcon";
+import { MODE_CYCLE, MODE_LABEL_KEYS } from "./model";
+
+/**
+ * Operating mode as a compact chip that opens one menu.
+ *
+ * The chip only ever names the committed mode, so the toolbar keeps the width
+ * of a single label; the other two modes are one menu away instead of one
+ * cycle-click away.
+ */
+export function ComposerModePicker({
+ t,
+ mode,
+ planningLive,
+ open,
+ setOpen,
+ controlsBlocked,
+ onCloseOtherMenus,
+ onSelect,
+}: {
+ t: TFunction;
+ mode: Mode;
+ planningLive: boolean;
+ open: boolean;
+ setOpen: Dispatch<SetStateAction<boolean>>;
+ controlsBlocked: boolean;
+ onCloseOtherMenus: () => void;
+ onSelect: (mode: Mode) => void | Promise<void>;
+}) {
+ const label = t(MODE_LABEL_KEYS[mode]);
+ return (
+ <AnchoredMenu
+ className="composer-mode"
+ open={open}
+ onClose={() => setOpen(false)}
+ menuClassName="composer-mode-menu"
+ label={t("settings.mode")}
+ role="menu"
+ align="start"
+ side="top"
+ trigger={(ref) => (
+ <TooltipButton
+ ref={ref}
+ type="button"
+ className={`icon-btn mode-chip composer-mode-chip ${open ? "active" : ""}`}
+ data-mode={mode}
+ data-planning={planningLive ? "true" : undefined}
+ tooltip={planningLive ? t(`${mode}.planning`) : t("settings.mode")}
+ ariaLabel={
+ planningLive
+ ? `${t("settings.mode")}: ${label}. ${t(`${mode}.planning`)}`
+ : `${t("settings.mode")}: ${label}`
+ }
+ aria-haspopup="menu"
+ aria-expanded={open}
+ disabled={controlsBlocked}
+ onClick={() => {
+ onCloseOtherMenus();
+ setOpen((current) => !current);
+ }}
+ >
+ <span className="composer-mode-chip-face" key={mode}>
+ <ModeIcon mode={mode} />
+ <span className="composer-mode-chip-label text-sm">{label}</span>
+ </span>
+ <IconChevronDown
+ size={12}
+ aria-hidden="true"
+ className="composer-mode-chip-caret"
+ />
+ </TooltipButton>
+ )}
+ >
+ {MODE_CYCLE.map((candidate) => (
+ <button
+ key={candidate}
+ type="button"
+ role="menuitemradio"
+ aria-checked={mode === candidate}
+ disabled={controlsBlocked}
+ className={`composer-plus-item ${mode === candidate ? "active" : ""}`}
+ onClick={async () => {
+ setOpen(false);
+ await onSelect(candidate);
+ }}
+ >
+ <span className="flex-1 text-left">{t(MODE_LABEL_KEYS[candidate])}</span>
+ {mode === candidate ? <IconCheck size={13} /> : null}
+ </button>
+ ))}
+ </AnchoredMenu>
+ );
+}
diff --git a/apps/desktop/src/features/chat/composer/ComposerToolbar.tsx b/apps/desktop/src/features/chat/composer/ComposerToolbar.tsx
index dea7eee18..2b04f19f8 100644
--- a/apps/desktop/src/features/chat/composer/ComposerToolbar.tsx
+++ b/apps/desktop/src/features/chat/composer/ComposerToolbar.tsx
@@ -9,6 +9,7 @@ import {
type PluginComposerTransformMeta,
} from "@pi-desktop/shared";
import type { AppState } from "../../../stores/app-store";
+import { ComposerModePicker } from "./ComposerModePicker";
import { ComposerPermissionPicker } from "./ComposerPermissionPicker";
import { ContextUsageInspector } from "../../../components/ContextUsageInspector";
import { ComposerControlSlots } from "./ComposerControlSlots";
@@ -20,13 +21,8 @@ import {
IconStop,
IconUndo2,
} from "../../../components/icons";
-import { ModeIcon } from "./ComposerModeIcon";
import { LiveVoiceControls } from "../../voice/live/LiveVoiceControls";
import { ComposerModelPicker } from "./ComposerModelPicker";
-import {
- MODE_LABEL_KEYS,
- nextMode,
-} from "./model";
import type { useComposerModelMenu } from "./hooks/useComposerModelMenu";
type ModelMenuController = ReturnType<typeof useComposerModelMenu>;
@@ -40,6 +36,8 @@ export type ComposerToolbarProps = {
modelId?: string;
thinkingLevel: SessionThinkingLevel;
composerPermissionMode: Exclude<PermissionMode, "inherit">;
+ modeOpen: boolean;
+ setModeOpen: Dispatch<SetStateAction<boolean>>;
permissionOpen: boolean;
setPermissionOpen: Dispatch<SetStateAction<boolean>>;
controlsBlocked: boolean;
@@ -79,6 +77,8 @@ export function ComposerToolbar({
modelId,
thinkingLevel,
composerPermissionMode,
+ modeOpen,
+ setModeOpen,
permissionOpen,
setPermissionOpen,
controlsBlocked,
@@ -129,18 +129,18 @@ export function ComposerToolbar({
</TooltipButton>
</div>
{localToolsAllowed ? <LiveVoiceControls t={t} workSessionId={workSessionId} /> : null}
- <TooltipButton
- type="button"
- className="icon-btn mode-chip composer-mode-chip"
- data-mode={mode}
- data-planning={planningLive ? "true" : undefined}
- tooltip={planningLive ? t(`${mode}.planning`) : t("settings.mode")}
- ariaLabel={planningLive ? t(`${mode}.planning`) : t("settings.mode")}
- disabled={controlsBlocked}
- onClick={async () => {
+ <ComposerModePicker
+ t={t}
+ mode={mode}
+ planningLive={planningLive}
+ open={modeOpen}
+ setOpen={setModeOpen}
+ controlsBlocked={controlsBlocked}
+ onCloseOtherMenus={() => {
modelMenu.setOpen(false);
setPermissionOpen(false);
- const next: Mode = nextMode(mode);
+ }}
+ onSelect={async (next) => {
try {
await configureActiveSession({
mode: next,
@@ -154,18 +154,15 @@ export function ComposerToolbar({
});
}
}}
- >
- <span className="composer-mode-chip-face" key={mode}>
- <ModeIcon mode={mode} />
- <span className="composer-mode-chip-label text-sm">
- {t(MODE_LABEL_KEYS[mode])}
- </span>
- </span>
- </TooltipButton>
+ />
<ComposerPermissionPicker t={t} mode={mode}
composerPermissionMode={composerPermissionMode}
permissionOpen={permissionOpen} setPermissionOpen={setPermissionOpen}
- controlsBlocked={controlsBlocked} onCloseOtherMenus={() => modelMenu.setOpen(false)}
+ controlsBlocked={controlsBlocked}
+ onCloseOtherMenus={() => {
+ modelMenu.setOpen(false);
+ setModeOpen(false);
+ }}
onSelect={async (candidate) => {
try {
await configureActiveSession({
diff --git a/apps/desktop/src/features/chat/composer/model.ts b/apps/desktop/src/features/chat/composer/model.ts
index cd6c1e63b..787283b91 100644
--- a/apps/desktop/src/features/chat/composer/model.ts
+++ b/apps/desktop/src/features/chat/composer/model.ts
@@ -68,11 +68,6 @@ export type ComposerFileReference = {
};
-export function nextMode(mode: Mode): Mode {
- const index = MODE_CYCLE.indexOf(mode);
- return MODE_CYCLE[(index + 1) % MODE_CYCLE.length] ?? "agent";
-}
-
export function isThinkingLevel(value: unknown): value is SessionThinkingLevel {
return isSessionThinkingLevel(value);
}
diff --git a/apps/desktop/src/styles/composer-menus.css b/apps/desktop/src/styles/composer-menus.css
index 150670417..5fdfe01df 100644
--- a/apps/desktop/src/styles/composer-menus.css
+++ b/apps/desktop/src/styles/composer-menus.css
@@ -48,7 +48,8 @@
position: relative;
}
-.composer-permission-menu {
+.composer-permission-menu,
+.composer-mode-menu {
position: fixed;
top: 0;
left: 0;
@@ -95,6 +96,7 @@
}
.composer-permission-menu.is-open,
+.composer-mode-menu.is-open,
.composer-model-menu.is-open {
opacity: 1;
pointer-events: auto;
diff --git a/apps/desktop/src/styles/theme-overrides.css b/apps/desktop/src/styles/theme-overrides.css
index 8ef838815..a7b2ac964 100644
--- a/apps/desktop/src/styles/theme-overrides.css
+++ b/apps/desktop/src/styles/theme-overrides.css
@@ -215,13 +215,19 @@
white-space: nowrap;
}
-/* Keep the Agent/Plan/Goal control stable while its localized label changes. */
+/* Keep the Agent/Plan/Goal trigger stable while its localized label changes.
+ The width covers the longest built-in label plus the menu caret. */
.composer-mode-chip {
- width: 88px;
- min-width: 88px;
- max-width: 88px;
- flex: 0 0 88px;
- justify-content: flex-start;
+ width: 96px;
+ min-width: 96px;
+ max-width: 96px;
+ flex: 0 0 96px;
+ justify-content: space-between;
+}
+
+.composer-mode-chip-caret {
+ flex: 0 0 auto;
+ color: var(--ds-text-muted);
}
.composer-mode-chip-label {
diff --git a/apps/desktop/test/composer-chip-descenders.test.mjs b/apps/desktop/test/composer-chip-descenders.test.mjs
index d8ae43646..4e5ed84da 100644
--- a/apps/desktop/test/composer-chip-descenders.test.mjs
+++ b/apps/desktop/test/composer-chip-descenders.test.mjs
@@ -61,14 +61,14 @@ test("composer runtime chips keep compact line-height for descenders", () => {
test("mode selector reserves the longest localized label width", () => {
assert.match(
composerSource,
- /className="icon-btn mode-chip composer-mode-chip"/,
+ /className={`icon-btn mode-chip composer-mode-chip/
);
const block = styles.match(/\.composer-mode-chip\s*\{[^}]+\}/)?.[0] ?? "";
- assert.match(block, /width:\s*88px;/);
- assert.match(block, /min-width:\s*88px;/);
- assert.match(block, /max-width:\s*88px;/);
- assert.match(block, /flex:\s*0 0 88px;/);
+ assert.match(block, /width:\s*96px;/);
+ assert.match(block, /min-width:\s*96px;/);
+ assert.match(block, /max-width:\s*96px;/);
+ assert.match(block, /flex:\s*0 0 96px;/);
assert.match(styles, /\.composer-mode-chip-label\s*\{[\s\S]*?text-overflow:\s*ellipsis;/);
});
diff --git a/apps/desktop/test/composer-mode-menu.test.mjs b/apps/desktop/test/composer-mode-menu.test.mjs
new file mode 100644
index 000000000..f7657ccb0
--- /dev/null
+++ b/apps/desktop/test/composer-mode-menu.test.mjs
@@ -0,0 +1,70 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+import { composerToolbar } from "./helpers/composer-toolbar.mjs";
+import { readComposerModule, readComposerSource } from "./helpers/source-contracts.mjs";
+import { slotSsr } from "./helpers/slot-ssr.mjs";
+
+/*
+ * The operating mode is a compact chip that opens one menu. It used to advance
+ * one state per click, so reaching Goal from Agent took two clicks and the two
+ * other modes were never on screen; a row of three always-visible options fixed
+ * the clicks but cost the toolbar a wide cluster. The chip names the committed
+ * mode only, and the menu lists the three modes with their check marks.
+ */
+
+const modePicker = await readComposerModule("ComposerModePicker.tsx");
+const composerSource = await readComposerSource();
+
+async function toolbar(t, overrides = {}) {
+ const ssr = await slotSsr(t);
+ return (await composerToolbar(t, ssr, overrides))();
+}
+
+test("the chip opens a labelled menu instead of cycling", async (t) => {
+ const html = await toolbar(t, { mode: "plan" });
+ assert.match(html, /aria-haspopup="menu"/);
+ assert.match(html, /aria-expanded="false"/);
+ // The trigger names the committed mode only: no other mode label in the chip.
+ assert.match(html, /class="composer-mode-chip-label text-sm">settings\.modePlan</);
+ // No state-advancing helper survives: the chip only opens the menu.
+ assert.doesNotMatch(composerSource, /\bnextMode\b/);
+ assert.match(modePicker, /menuClassName="composer-mode-menu"/);
+ assert.match(modePicker, /role="menu"/);
+});
+
+test("the menu lists every mode with the committed one checked", () => {
+ assert.match(modePicker, /\{MODE_CYCLE\.map\(\(candidate\) => \(/);
+ assert.match(modePicker, /role="menuitemradio"/);
+ assert.match(modePicker, /aria-checked=\{mode === candidate\}/);
+ assert.match(modePicker, /composer-mode-menu/);
+});
+
+test("choosing a mode closes the menu and configures the active session once", () => {
+ assert.match(
+ modePicker,
+ /onClick=\{async \(\) => \{\s*\n\s*setOpen\(false\);\s*\n\s*await onSelect\(candidate\);/,
+ );
+ const toolbarSource = composerSource.slice(
+ composerSource.indexOf("<ComposerModePicker"),
+ composerSource.indexOf("<ComposerPermissionPicker"),
+ );
+ assert.match(toolbarSource, /onSelect=\{async \(next\) => \{/);
+ assert.match(toolbarSource, /mode: next,/);
+});
+
+test("opening one menu closes the other", () => {
+ const toolbarSource = composerSource.slice(
+ composerSource.indexOf("<ComposerModePicker"),
+ composerSource.indexOf('<div className="composer-right">'),
+ );
+ assert.match(
+ toolbarSource,
+ /onCloseOtherMenus=\{\(\) => \{\s*\n\s*modelMenu\.setOpen\(false\);\s*\n\s*setPermissionOpen\(false\);/,
+ );
+ assert.match(
+ toolbarSource,
+ /onCloseOtherMenus=\{\(\) => \{\s*\n\s*modelMenu\.setOpen\(false\);\s*\n\s*setModeOpen\(false\);/,
+ );
+ // A blocked composer closes both menus, not just the approval one.
+ assert.match(composerSource, /setModeOpen\(false\);\s*\n\s*setPermissionOpen\(false\);/);
+});
diff --git a/apps/desktop/test/composer-paste-files.test.mjs b/apps/desktop/test/composer-paste-files.test.mjs
index c3ecf5e4a..e27e6ab92 100644
--- a/apps/desktop/test/composer-paste-files.test.mjs
+++ b/apps/desktop/test/composer-paste-files.test.mjs
@@ -139,7 +139,7 @@ test("picker attachments materialize a session before importing paths", () => {
test("composer opens one unified file picker directly from the plus button", () => {
const leftStart = composer.indexOf('<div className="composer-left">');
const plusIndex = composer.indexOf('tooltip={t("chat.addFiles")}', leftStart);
- const modeIndex = composer.indexOf("composer-mode-chip", leftStart);
+ const modeIndex = composer.indexOf("<ComposerModePicker", leftStart);
assert.ok(leftStart >= 0 && plusIndex > leftStart && modeIndex > leftStart);
assert.ok(plusIndex < modeIndex, "upload must precede the agent mode chip");
assert.match(composer, /void pickAndAttach\(\);/);
diff --git a/apps/desktop/test/fixed-dropdown-surfaces.test.mjs b/apps/desktop/test/fixed-dropdown-surfaces.test.mjs
index 21f019ea3..7f2e8cdc7 100644
--- a/apps/desktop/test/fixed-dropdown-surfaces.test.mjs
+++ b/apps/desktop/test/fixed-dropdown-surfaces.test.mjs
@@ -42,6 +42,7 @@ const dropdownSurfaces = [
"agent-capability-menu",
"scope-compact-menu",
"scope-popover",
+ "composer-mode-menu",
"composer-permission-menu",
"composer-model-menu",
"plan-approval-menu",
diff --git a/apps/desktop/test/plugin-composer-slots.test.mjs b/apps/desktop/test/plugin-composer-slots.test.mjs
index bfa72803f..0fb0315d1 100644
--- a/apps/desktop/test/plugin-composer-slots.test.mjs
+++ b/apps/desktop/test/plugin-composer-slots.test.mjs
@@ -16,7 +16,12 @@ import { parseProbe, probed, propsProbe, slotMounts, slotSsr } from "./helpers/s
/** The toolbar's own controls below, by label. */
// Live Voice's idle entry is conditional on the feature setting and therefore
// is not a permanent host slot in this disabled-by-default fixture.
-const HOST_LEFT = ["chat.addFiles", "settings.mode", "chat.permissionMode"];
+// Every label-driven trigger states its control and its current value.
+const HOST_LEFT = [
+ "chat.addFiles",
+ "settings.mode: settings.modeAgent",
+ "chat.permissionMode",
+];
const HOST_RIGHT = ["context", "chat.model: Model. chat.reasoningLevel: Off", "chat.send"];
async function composer(t, toolbarProps = {}) {
diff --git a/apps/desktop/test/thinking-ui.test.mjs b/apps/desktop/test/thinking-ui.test.mjs
index eed489502..824438583 100644
--- a/apps/desktop/test/thinking-ui.test.mjs
+++ b/apps/desktop/test/thinking-ui.test.mjs
@@ -102,16 +102,14 @@ test("Composer owns the mode and model controls", () => {
composerToolbarSource.indexOf('<div className="composer-left">'),
composerToolbarSource.indexOf('<div className="composer-right">'),
);
- const modeControl = leftToolbar.indexOf(
- 'className="icon-btn mode-chip composer-mode-chip"',
- );
+ const modeControl = leftToolbar.indexOf("<ComposerModePicker");
const permissionControl = leftToolbar.indexOf("<ComposerPermissionPicker");
const rightToolbar = composerToolbarSource.slice(
composerToolbarSource.indexOf('<div className="composer-right">'),
);
- assert.ok(modeControl >= 0);
- assert.ok(permissionControl > modeControl);
+ assert.ok(modeControl >= 0, "the left toolbar owns the mode trigger");
+ assert.ok(permissionControl > modeControl, "approval follows the mode trigger");
// The task draft has no session, so its picker must not claim one: with
// `activeSessionId` unset the menu resolves the selected model's binding
// default thinking level instead of pinning the draft to its current value.
diff --git a/docs/spec/04-ux/07-ui-design-system.md b/docs/spec/04-ux/07-ui-design-system.md
index b372f3379..3ee249432 100644
--- a/docs/spec/04-ux/07-ui-design-system.md
+++ b/docs/spec/04-ux/07-ui-design-system.md
@@ -969,7 +969,7 @@ The composer renders only controls connected to the active pi session:
Unknown models do not gain reasoning automatically. Changing provider clamps
or resets the durable session value before the next turn.
- The left-of-input Composer Agent/Plan/Goal chip is the sole active-session mode
- control and cycles Agent → Plan → Goal → Agent. The Composer-right combined
+ control and opens a menu listing Agent, Plan, and Goal. The Composer-right combined
chip owns model and reasoning changes; the top bar has no duplicate mode or
model control. The combined Composer picker closes and is disabled while an active
`pending` Plan or Goal approval exists;
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index 0f770f5a6..82b7fba02 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -2862,11 +2862,13 @@ reasoning-level control.
- Padding: px-4 py-3 inner textarea
- Font: text-sm for Agent, Plan, and Goal; mode changes semantics and tool
controls, not the typography
-- The Agent/Plan/Goal mode chip reserves one fixed 88px width, sized from the
- longest built-in label in English and zh-CN ("Agent" / "智能体"). Its label
- stays single-line and ellipsizes if a future locale exceeds that budget, so
- switching modes never reflows the adjacent Composer controls. Cycling the
- chip cross-fades the icon and label in place. While the live turn is
+- The Agent/Plan/Goal mode chip reserves one fixed 96px width, sized from the
+ longest built-in label in English and zh-CN ("Agent" / "智能体") plus its
+ menu caret. Its label stays single-line and ellipsizes if a future locale
+ exceeds that budget, so switching modes never reflows the adjacent Composer
+ controls. The chip names the committed mode and opens one menu listing the
+ three modes, each a checked menu item; choosing one closes the menu and
+ configures the active session. While the live turn is
`planning`, the chip pulses on its icon (purple) instead of leaving a
second status row parked above the composer; a staged mode choice still
updates the chip immediately and does not start that pulse until the
@@ -3135,7 +3137,7 @@ reasoning-level control.
to Off-only. An active pending Plan or Goal approval still disables these
controls. Approval actions are the exception while awaiting approval. The
Composer-left Agent/Plan/Goal chip is the sole mode
- control and cycles Agent → Plan → Goal → Agent on click. The Composer-right
+ control and opens the mode menu on click. The Composer-right
model × reasoning chip owns both selections. Palette and Composer slash mode commands use the
same active-session configuration path; after host confirmation resolves an
approval, the approval surface is removed rather than remaining as a terminal
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 41b076c6d..782a1ee51 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -11151,10 +11151,12 @@ This test plan spec is accepted when:
### US-UI-73 Composer mode selector has stable width
- Open the empty home and a docked thread in both English and zh-CN.
-- Switch the Composer mode chip through Agent/Plan/Goal several times.
-- Expect the mode chip to keep one fixed width sized for the longest built-in
- label (English "Agent" / zh-CN "智能体"); the adjacent Thinking and
- permission controls, send button, and composer shell do not move or resize.
+- Open the Composer mode chip and switch between Agent/Plan/Goal several times.
+- Expect the chip to list the three modes as checked menu items, to name only
+ the committed mode, and to keep one fixed width sized for the longest built-in
+ label (English "Agent" / zh-CN "智能体") plus its caret; the adjacent Thinking
+ and permission controls, send button, and composer shell do not move or
+ resize.
- In Goal, expect the permission chip to remain visible with the same geometry,
show Full auto / 全自动, and stay disabled without opening a permission menu.
The Plan/Goal approval card remains the separate execution-policy control.
diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.md
index 0b8bfed5c..541acec87 100644
--- a/docs/spec/08-meta/decisions-log.md
+++ b/docs/spec/08-meta/decisions-log.md
@@ -7749,3 +7749,20 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.
`apps/desktop/test/browser-preview-tool.test.mjs`. The packaged File Manager
scenario in E2E-153 covers the complete user path. See ADR 0330 and the
plugin API, permission, security, and component specs.
+
+## 2026-10-17 — Composer mode control opens a menu instead of cycling (D663)
+
+- The Composer-left Agent/Plan/Goal trigger keeps naming only the committed
+ mode, at a fixed 96px that now includes its caret; clicking it opens one menu
+ whose three rows are radio menu items with the committed mode checked.
+ Choosing a row closes the menu and configures the active session.
+- Cycling was replaced because reaching a specific mode took repeated clicks
+ and never showed the alternatives. A row of three always-visible segmented
+ options was implemented and dropped: it needed roughly 70px more toolbar
+ width per extra state and crowded the approval control beside it.
+- The approval chip keeps its existing fixed-width menu, and opening either
+ menu closes the other. `nextMode` is removed. Covered by
+ `apps/desktop/test/composer-mode-menu.test.mjs`,
+ `apps/desktop/test/composer-chip-descenders.test.mjs`, and the composer
+ slots and thinking contracts. See `04-ux/08-component-spec.md` §11 and
+ US-UI-73.
diff --git a/docs/zh-CN/spec/04-ux/07-ui-design-system.md b/docs/zh-CN/spec/04-ux/07-ui-design-system.md
index f50b378d4..4042aad20 100644
--- a/docs/zh-CN/spec/04-ux/07-ui-design-system.md
+++ b/docs/zh-CN/spec/04-ux/07-ui-design-system.md
@@ -849,7 +849,7 @@ UTF-8 写入活动会话的临时 `pasted/` 目录,并在粘贴位置显示一
行动或分级阶梯。更换供应商钳位或重置耐用性
下一轮之前的会话值。
- 左侧输入 Composer Agent/Plan/Goal 芯片是唯一的活动会话模式
- 控制和循环 Agent → Plan → Goal → Agent。顶部栏没有重复的模式或模型控件。
+ 控制,点击打开列出 Agent、Plan、Goal 的菜单。顶部栏没有重复的模式或模型控件。
Composer 组合选择器当存在有效的 `pending` Plan 或 Goal 批准时将关闭并被禁用;
终端提案快照不会禁用它。批准选择器记住
该设备上最后选择的模式并将其用于下一个待处理的提案。
diff --git a/docs/zh-CN/spec/04-ux/08-component-spec.md b/docs/zh-CN/spec/04-ux/08-component-spec.md
index 01c073eee..07d75aa4e 100644
--- a/docs/zh-CN/spec/04-ux/08-component-spec.md
+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md
@@ -2000,10 +2000,10 @@ MainChat 底部的输入区域,用于撰写和发送提示。支持多行输
- 填充:px-4 py-3 内部文本区域
- 字体:Agent、Plan 和 Goal 的 text-sm;模式改变语义和工具
控件,而不是排版
-- Agent/Plan/Goal 模式芯片保留一个固定的 88px 宽度,尺寸从
- 最长的英文和中中文内置标签(“Agent”/“智能体”)。它的标签
- 如果未来的语言环境超出预算,则保持单行并省略,因此
- 切换模式永远不会回流相邻的 Composer 控件。循环切换时图标和标签就地交叉淡入。
+- Agent/Plan/Goal 模式芯片保留一个固定的 96px 宽度,按英文与中文最长内置标签
+ (“Agent”/“智能体”)加上菜单指示箭头计算。标签保持单行,未来语言超出预算时
+ 省略,因此切换模式永远不会回流相邻的 Composer 控件。芯片只显示当前模式,
+ 点击打开列出三个模式的菜单,每项带选中标记;选择后菜单关闭并配置当前会话。
当前回合处于实时 `planning` 时,芯片图标以紫色脉冲,而不是在输入框上方再停一行状态;
回合中暂存的模式选择仍会立刻改芯片,但要等进行中的回合真正投影 `planning` 才开始脉冲。
- 右侧工具栏在有用量时于模型 × 推理芯片左侧放置剩余容量检查器(D347);触发器只显示圆环和百分比。模型 × 推理芯片直接显示规范思考等级值,不进行本地化;`off` 时省略等级文本。
@@ -2122,8 +2122,8 @@ MainChat 底部的输入区域,用于撰写和发送提示。支持多行输
(`supportsReasoning: false`、缺省或空的等级列表),Composer 就回落到
所选模型的目录/绑定等级,因此回合中改档不会把子菜单塌缩成只剩关闭思考。有效的待处理 Plan 或 Goal 批准仍会禁用这些功能
控制。等待批准期间的批准操作是例外情况。的
- Composer-左Agent/Plan/Goal芯片是唯一模式
- 单击时控制并循环 Agent → Plan → Goal → Agent;Composer 右侧的
+ Composer 左侧的 Agent/Plan/Goal 芯片是唯一模式控制,
+ 点击打开模式菜单;Composer 右侧的
模型 × 推理芯片拥有这两项选择。Palette 和 Composer 斜线模式命令使用
相同的活动会话配置路径;主机确认解决后
审批,审批面被移除而不是保留为终端
diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 9bead491a..313ccd8d6 100644
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@ -6626,9 +6626,9 @@ eleven-tool-round desktop paths are verified by
### US-UI-73 Composer 模式选择器具有稳定的宽度
- 以英语和中文打开空的主页和停靠的线程。
-- 通过Agent/Plan/Goal多次切换Composer模式芯片。
-- 期望模式芯片为最长的内置保持一个固定的宽度尺寸
- 标签(英文“Agent”/zh-CN“智能体”);相邻的思维和
+- 打开 Composer 模式芯片,在 Agent/Plan/Goal 之间多次切换。
+- 期望芯片以带选中标记的菜单项列出三个模式、只显示当前模式,并为最长内置标签
+ (英文“Agent”/zh-CN“智能体”)加上箭头保留一个固定宽度;相邻的思考与
权限控件、发送按钮和 Composer shell 不会移动或调整大小。
- **链接规格**:`04-ux/08-component-spec.md` §11.3
- **里程碑**:M5
diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.md
index 40476b06c..8077aca65 100644
--- a/docs/zh-CN/spec/08-meta/decisions-log.md
+++ b/docs/zh-CN/spec/08-meta/decisions-log.md
@@ -5467,3 +5467,15 @@ Markdown 源码,不是 `text/html` 负载;对禁用行内 HTML 的外部编
- 由 `apps/desktop/test/plugin-fs-scope.test.mjs` 与
`apps/desktop/test/browser-preview-tool.test.mjs` 覆盖。E2E-153 的已打包文件管理器
场景覆盖完整用户流程。见 ADR 0330 以及插件 API、权限、安全与组件规格。
+
+## 2026-10-17 —— Composer 模式控件改为打开菜单而非循环切换(D663)
+
+- Composer 左侧的 Agent/Plan/Goal 触发器仍只显示当前模式,固定宽度 96px
+ (已包含菜单箭头);点击打开一个菜单,三行都是带选中标记的 radio 菜单项,
+ 选中后关闭菜单并配置当前会话。
+- 放弃循环切换:到达目标模式需要多次点击,且始终看不到其他选项。曾实现“三个
+ 常驻分段选项”,但每个状态约多占 70px 工具栏宽度,挤压相邻的权限控件。
+- 权限芯片保留原有的固定宽度菜单;打开任一菜单会关闭另一个。`nextMode` 已删除。
+ 由 `apps/desktop/test/composer-mode-menu.test.mjs`、
+ `apps/desktop/test/composer-chip-descenders.test.mjs` 以及 composer 插槽与
+ 思考等级契约覆盖。见 `04-ux/08-component-spec.md` §11 与 US-UI-73。