Repository navigation
feat(palette): choose the agent when starting a session from Cmd+K - #685
Conversation
The palette's "New session" row now shows the agent it will start and lets Left/Right (or the row's arrows) switch it. The agents come from the injected CLI catalog, filtered to enabled and installed entries, so no CLI id list lives in the palette. The pick is a one-shot launch through run() with a temporary _runMode swap: the Run button's mode is left unchanged.
|
Thanks @aakhter, this is a nice addition: the Cmd+K New session row now shows which agent it will start, Left/Right or the arrows switch it, and Enter launches it once through I ran it in Chromium against a dev server. Left/Right cycle and wrap, the caret is respected mid-query, clicking an arrow keeps focus in the search box and does not launch, Enter posts the picked mode, and the Run button and the saved I will apply these small things at merge time (tell me if you would rather push them yourself):
One thing for a follow-up, not this PR: I will merge it with the three fixes above on top. Thanks again! |
palette agent switch: aria-hidden on .command-palette-agent, arrows lose role="button" and aria-label (no nested buttons in the row) i18n: zh-CN entry for the "Agent for the new session (Left/Right to change)" tooltip docs: Keyboard-Shortcuts Ctrl+K row says Left/Right change the agent on the New session row test: pin the aria-hidden switch and the zh-CN tooltip entry in command-palette-ui.test.ts Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Keep the Run button's mode when fewer than two agents are offered (_commandPaletteAgent), so a Docker case whose host offers only Shell still starts the container agent the Run button shows; pinned by a new palette test. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Merged, thank you! This ships in 1.45.0. Testing the merged branch turned up one regression: the palette gated agents on what the host has installed, so a Docker case couldn't start a CLI that only its container has. Cmd+K now uses the same per-case rule as the Run menu ( |
Problem
The Cmd+K palette's "New session" row always starts whatever the Run button is set to. Starting a session with a different agent means leaving the palette, opening the Run menu, changing the Run button's mode, and then running, which also leaves the Run button changed for every later launch.
Approach
The "New session" row now shows the agent it will start, with arrows on either side of the agent's logo and name.
window.__codemanCliCatalog), filtered to enabled entries that are installed here (isCliAvailable()), in catalog order. That is the same list the welcome screen's Run buttons offer. No CLI id list lives in the palette code, and a CLI added throughclis.jsonshows up with no frontend change.run(), with the same temporary_runModeswap the custom-model entries and worktree launches use. The Run button's mode and the savedrunModesetting are not changed, and the swap is undone even if the launch throws.No new setting. Which agents appear is already controlled by the CLI registry's own enable toggles, and a second palette-only list would be another place to curate the same thing.
panels-ui.jsis added to the filestest/frontend-cli-no-id-branching.test.tsscans. It has no CLI id branches today, so this costs nothing and keeps the palette from growing one.Tests
test/command-palette-ui.test.ts: 10 new cases covering the catalog-derived list (disabled and uninstalled CLIs left out), the starting agent and its fallback, Left/Right cycling with wrap-around, Left/Right left to the caret mid-query, no cycling on a session row, arrow clicks that cycle without launching, the one-shot launch that leaves the Run button mode alone (also whenrun()throws), and no picker with a single agent. The existing palette tests pass unchanged.test/frontend-cli-no-id-branching.test.tsnow also scanspanels-ui.js.npm run typecheck,npm run lint,npm run format:check,npm run check:frontend-syntax,npm run check:public-assets,npm run test:ci.mode: "shell"while the Run button stayed on Claude Code.