Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/agents/plan-mode.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ Availability:

## UI Features

The right sidebar's **Plan** tab shows the plan file next to the chat. It reads the file again
when a turn ends and when the window regains focus, so a plan the agent is writing, or one you
edited in an external editor, stays current. Open it from a New tab in the sidebar, with
`/plan open`, with `Ctrl+Alt+Shift+L` (`Cmd+Option+Shift+L` on Mac), or from the **Plan file** row in the
Stats tab's post-compaction context. The tab has the plan card's main actions: **Implement**,
**Edit** (opens the file in your external editor) and **Copy**. `/plan` shows the plan in the
chat instead.

The `propose_plan` tool call in chat includes:

- **Rendered Markdown**: View the plan with proper formatting.
Expand Down
12 changes: 11 additions & 1 deletion docs/config/keybinds.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ While a workspace's actions menu (`⋮` in the sidebar row, `…` in the header)
| New right sidebar tab (lists the tools) | `Ctrl+Alt+N` |
| Close the right sidebar's active tab | `Ctrl+W` |

The right sidebar shows only the tabs you open. A new tab lists the tools it can show (Stats, Review, Instructions, Goal, Terminal, and more); pick one to open it in that tab's place. The **+** button after the last tab opens a new tab. Closing the last tab closes the sidebar. The chevron at the right end of the tab strip lists your open tabs.
The right sidebar shows only the tabs you open. A new tab lists the tools it can show (Stats, Review, Instructions, Plan, Goal, Terminal, and more); pick one to open it in that tab's place. The **+** button after the last tab opens a new tab. Closing the last tab closes the sidebar. The chevron at the right end of the tab strip lists your open tabs.

### Command Palette

Expand All @@ -97,6 +97,16 @@ The command palette (`Ctrl+Shift+P`) has two modes:

This separation keeps the switcher clean and fast while making all other commands easily accessible via `>`.

### Plan tab

The shortcuts other than opening the tab apply while focus is inside the Plan tab.

| Action | Shortcut |
| --------------------------------- | ------------------ |
| Open the Plan tab | `Ctrl+Alt+Shift+L` |
| Open the plan file in your editor | `E` |
| Copy the plan | `Y` |

### Artifacts tab (experimental)

These work when the **Artifacts** experiment is on. Shortcuts other than opening the tab only apply while focus is inside the Artifacts tab (inside an HTML or SVG preview, `Shift+F` and `Esc` only exit fullscreen). On narrow windows, where the right sidebar is hidden, `Ctrl+Shift+K` shows the sidebar full-screen on the Artifacts tab. The image zoom shortcuts apply while focus is on the image or its zoom controls.
Expand Down
38 changes: 38 additions & 0 deletions src/browser/components/WorkspaceMenuBar/WorkspaceMenuBar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,44 @@ describe("WorkspaceMenuBar archive confirmations", () => {
expect(shown).toEqual(["artifacts"]);
});

it("the Plan shortcut shows the Plan tab and asks its panel for focus, but not from the palette", () => {
narrow();
const requests: unknown[] = [];
const record = (event: Event) => requests.push((event as CustomEvent<unknown>).detail);
window.addEventListener(CUSTOM_EVENTS.OPEN_PLAN_TAB, record);
const palette = document.createElement("div");
palette.setAttribute("cmdk-root", "");
const paletteInput = document.createElement("input");
palette.append(paletteInput);
document.body.append(palette);
const { shown } = renderRecording();
// Happy DOM reports AltGraph whenever Alt is down, which the shortcut ignores as AltGr text.
const press = (target: Element | Window) => {
const event = new window.KeyboardEvent("keydown", {
key: "L",
code: "KeyL",
ctrlKey: true,
altKey: true,
shiftKey: true,
bubbles: true,
cancelable: true,
});
Object.defineProperty(event, "getModifierState", { value: () => false });
act(() => {
fireEvent(target, event);
});
};

press(paletteInput);
press(window);
window.removeEventListener(CUSTOM_EVENTS.OPEN_PLAN_TAB, record);
palette.remove();

expect(shown).toEqual(["plan"]);
// RightSidebar focuses the panel on this request, as after the wide-layout shortcut.
expect(requests).toEqual([{ workspaceId, focus: true }]);
});

it("leave keys alone while the sidebar is visible or a modal is open", () => {
stubMatchMedia(() => false);
const { shown, view } = renderRecording();
Expand Down
38 changes: 38 additions & 0 deletions src/browser/components/WorkspaceMenuBar/WorkspaceMenuBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ import { Checkbox } from "../Checkbox/Checkbox";
import {
formatKeybind,
isBrowserViewportFocused,
isCommandPaletteTarget,
isDesktopViewportFocused,
isDialogOpen,
isEditableElement,
isTerminalFocused,
KEYBINDS,
matchesKeybind,
matchesOpenPlanTabKeybind,
} from "@/browser/utils/ui/keybinds";
import { openPlanTab } from "@/browser/utils/openPlanTab";
import { useRuntimeStatus, useRuntimeStatusStoreRaw } from "@/browser/stores/RuntimeStatusStore";
import { useWorkspaceSidebarState } from "@/browser/stores/WorkspaceStore";
import { hasWorkspaceRepository } from "@/browser/utils/workspaceCapabilities";
Expand Down Expand Up @@ -444,6 +447,41 @@ export const WorkspaceMenuBar: React.FC<WorkspaceMenuBarProps> = ({
return () => window.removeEventListener("keydown", handler);
}, [artifactsExperimentEnabled, isTimelineSidebarHidden, openSidebarTab]);

// The Plan tab while the sidebar is hidden: its shortcut (RightSidebar owns the wide-layout
// handler) and "/plan open" (OPEN_PLAN_TAB; RightSidebar already selected the tab, so only a
// hidden sidebar needs showing).
useEffect(() => {
const open = () => openSidebarTab("plan", activeElement());
const onKeyDown = (e: KeyboardEvent) => {
if (
!matchesOpenPlanTabKeybind(e) ||
isDialogOpen() ||
!isTimelineSidebarHidden() ||
// The command palette renders no modal dialog but keeps its keystrokes.
isCommandPaletteTarget(e.target) ||
isTerminalFocused(e.target) ||
isDesktopViewportFocused(e.target)
) {
return;
}
e.preventDefault();
// Through the event, so RightSidebar asks the panel for focus as after the wide-layout
// shortcut: the full-screen view alone would focus the tab label, outside the panel's
// single-key shortcuts. The listener below shows the view.
openPlanTab(workspaceId, { focus: true });
};
const onOpenPlanTab = (event: Event) => {
const detail = (event as CustomEvent<{ workspaceId: string }>).detail;
if (detail?.workspaceId === workspaceId && isTimelineSidebarHidden()) open();
};
window.addEventListener("keydown", onKeyDown);
window.addEventListener(CUSTOM_EVENTS.OPEN_PLAN_TAB, onOpenPlanTab);
return () => {
window.removeEventListener("keydown", onKeyDown);
window.removeEventListener(CUSTOM_EVENTS.OPEN_PLAN_TAB, onOpenPlanTab);
};
}, [isTimelineSidebarHidden, openSidebarTab, workspaceId]);

// openArtifact() (chat cards, file cards, Review, palette) and "Open in tab" on an MCP Apps
// tool card: while the sidebar is hidden, they show their tab full-screen (RightSidebar
// handles the same events on wider layouts).
Expand Down
16 changes: 11 additions & 5 deletions src/browser/components/WorkspaceShell/deferredSidebarInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
KEYBINDS,
matchesKeybind,
matchesNewSidebarTabKeybind,
matchesOpenPlanTabKeybind,
} from "@/browser/utils/ui/keybinds";
import { isWorkspaceRightSidebarHidden } from "@/browser/features/RightSidebar/rightSidebarVisibility";

Expand All @@ -16,6 +17,7 @@ export type HeldSidebarInput = () => void;
// at once and opens the side chat full-screen when no sidebar claims it, as on a narrow layout.
const SIDEBAR_EVENTS = [
CUSTOM_EVENTS.OPEN_GOAL_TAB,
CUSTOM_EVENTS.OPEN_PLAN_TAB,
Comment thread
asm marked this conversation as resolved.
Resolved
CUSTOM_EVENTS.OPEN_NEW_SIDEBAR_TAB,
CUSTOM_EVENTS.FOCUS_SIDEBAR_TAB,
CUSTOM_EVENTS.OPEN_MCP_APP_VIEW,
Expand All @@ -40,6 +42,7 @@ export function holdSidebarInput(held: HeldSidebarInput[]): () => void {
const sidebarKey =
SIDEBAR_KEYBINDS.some((keybind) => matchesKeybind(e, keybind)) ||
matchesNewSidebarTabKeybind(e) || // its own matcher: AltGr does not count
matchesOpenPlanTabKeybind(e) || // likewise
// Shift+I types a letter in a text field, where the sidebar ignores it.
(matchesKeybind(e, KEYBINDS.TOGGLE_REVIEW_IMMERSIVE) && !isEditableElement(e.target));
if (!sidebarKey) return;
Expand Down Expand Up @@ -78,11 +81,13 @@ export function holdSidebarInput(held: HeldSidebarInput[]): () => void {

function holdEventInto(held: HeldSidebarInput[]): (e: Event) => void {
return (e) => {
// While the layout hides the sidebar, RightSidebar ignores these two and WorkspaceMenuBar acts
// on them. Chromium may already have run the menu bar's listener (window listeners run in
// registration order at the window target), so a replay would act twice (#6208).
// While the layout hides the sidebar, WorkspaceMenuBar acts on these events (it shows the
// tab full-screen). Chromium may already have run the menu bar's listener (window listeners
// run in registration order at the window target), so a replay would act twice (#6208).
const menuBarEvent =
e.type === CUSTOM_EVENTS.OPEN_ARTIFACT || e.type === CUSTOM_EVENTS.OPEN_MCP_APP_VIEW;
e.type === CUSTOM_EVENTS.OPEN_ARTIFACT ||
e.type === CUSTOM_EVENTS.OPEN_MCP_APP_VIEW ||
e.type === CUSTOM_EVENTS.OPEN_PLAN_TAB;
if (
menuBarEvent &&
isWorkspaceRightSidebarHidden(document.querySelector("[data-workspace-shell]"))
Expand All @@ -103,7 +108,8 @@ export function guardSidebarKeys(): () => void {
const guard = (e: KeyboardEvent) => {
const sidebarKey =
SIDEBAR_KEYBINDS.some((keybind) => matchesKeybind(e, keybind)) ||
matchesNewSidebarTabKeybind(e);
matchesNewSidebarTabKeybind(e) ||
matchesOpenPlanTabKeybind(e);
if (sidebarKey) e.preventDefault();
};
window.addEventListener("keydown", guard);
Expand Down
1 change: 1 addition & 0 deletions src/browser/features/RightSidebar/NewTabLauncher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { mcpAppEntrypointDescription } from "./AppViewTab/mcpAppEntrypoints";
/** Tools with a global shortcut of their own; the launcher shows it as a hint. */
const TOOL_KEYBINDS: Partial<Record<BaseTabType, Keybind>> = {
artifacts: KEYBINDS.OPEN_ARTIFACTS_TAB,
plan: KEYBINDS.OPEN_PLAN_TAB,
};

interface NewTabLauncherProps {
Expand Down
100 changes: 0 additions & 100 deletions src/browser/features/RightSidebar/PlanFileDialog.stories.tsx

This file was deleted.

Loading