Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
Render the plan surface in the inline right panel (#3118)
Julius Marminge3a5ec9464b4b
diff --git a/apps/web/src/components/ChatView.browser.tsx b/apps/web/src/components/ChatView.browser.tsxindex 6f620d9a0..90790a01b 100644--- a/apps/web/src/components/ChatView.browser.tsx+++ b/apps/web/src/components/ChatView.browser.tsx@@ -2110,6 +2110,48 @@ describe("ChatView timeline estimator parity (full app)", () => {}});+ it("keeps the compact chat header on one row", async () => {+ const mounted = await mountChatView({+ viewport: COMPACT_FOOTER_VIEWPORT,+ snapshot: createSnapshotForTargetUser({+ targetMessageId: "msg-user-compact-header" as MessageId,+ targetText: "keep the compact header aligned",+ }),+ });++ try {+ const chatHeader = await waitForElement(+ () => document.querySelector<HTMLElement>("[data-chat-header]"),+ "Unable to find chat header.",+ );+ const threadTitle = await waitForElement(+ () => chatHeader.querySelector<HTMLElement>("h2"),+ "Unable to find thread title.",+ );+ const headerActions = await waitForElement(+ () => document.querySelector<HTMLElement>("[data-chat-header-actions]"),+ "Unable to find chat header actions.",+ );++ const headerRect = chatHeader.getBoundingClientRect();+ const titleRect = threadTitle.getBoundingClientRect();+ const actionsRect = headerActions.getBoundingClientRect();+ const headerCenter = headerRect.top + headerRect.height / 2;++ expect(headerRect.height).toBe(52);+ expect(titleRect.top).toBeGreaterThanOrEqual(headerRect.top);+ expect(titleRect.bottom).toBeLessThanOrEqual(headerRect.bottom);+ expect(actionsRect.top).toBeGreaterThanOrEqual(headerRect.top);+ expect(actionsRect.bottom).toBeLessThanOrEqual(headerRect.bottom);+ expect(Math.abs(titleRect.top + titleRect.height / 2 - headerCenter)).toBeLessThanOrEqual(1);+ expect(Math.abs(actionsRect.top + actionsRect.height / 2 - headerCenter)).toBeLessThanOrEqual(+ 1,+ );+ } finally {+ await mounted.cleanup();+ }+ });+it("keeps panel toggles fixed and can maximize the right panel", async () => {const mounted = await mountChatView({viewport: WIDE_FOOTER_VIEWPORT,@@ -2276,6 +2318,151 @@ describe("ChatView timeline estimator parity (full app)", () => {}});+ it("renders the plan surface in the inline right panel", async () => {+ useRightPanelStore.getState().open(THREAD_REF, "plan");++ const mounted = await mountChatView({+ viewport: WIDE_FOOTER_VIEWPORT,+ snapshot: createSnapshotForTargetUser({+ targetMessageId: "msg-user-inline-plan-panel" as MessageId,+ targetText: "show the inline plan panel",+ }),+ });++ try {+ await waitForElement(+ () =>+ Array.from(document.querySelectorAll<HTMLElement>("p")).find(+ (element) => element.textContent?.trim() === "No active plan yet.",+ ) ?? null,+ "Unable to find inline plan panel content.",+ );++ expect(+ document.querySelector<HTMLElement>("[data-right-panel-tabbar]")?.textContent,+ ).toContain("Plan");+ expect(document.body.textContent).toContain("Plans will appear here when generated.");+ } finally {+ await mounted.cleanup();+ }+ });++ it("renders the shared panel toggles in the responsive right-panel sheet", async () => {+ useRightPanelStore.getState().open(THREAD_REF, "plan");+ useRightPanelStore.getState().openTerminal(THREAD_REF, DEFAULT_TERMINAL_ID);+ useRightPanelStore.getState().activateSurface(THREAD_REF, "plan");+ const baseSnapshot = createSnapshotForTargetUser({+ targetMessageId: "msg-user-responsive-plan-panel-controls" as MessageId,+ targetText: "show responsive plan panel controls",+ });+ const snapshot: OrchestrationReadModel = {+ ...baseSnapshot,+ threads: baseSnapshot.threads.map((thread) =>+ thread.id === THREAD_ID+ ? {+ ...thread,+ activities: [+ {+ id: EventId.make("activity-responsive-panel-plan"),+ tone: "info",+ kind: "turn.plan.updated",+ summary: "Plan updated",+ payload: {+ explanation: "Claude Tasks",+ plan: [{ step: "Keep terminal navigation available", status: "inProgress" }],+ },+ turnId: null,+ sequence: 1,+ createdAt: isoAt(1_000),+ },+ ],+ }+ : thread,+ ),+ };++ const mounted = await mountChatView({+ viewport: COMPACT_FOOTER_VIEWPORT,+ snapshot,+ });++ try {+ const sheet = await waitForElement(+ () => document.querySelector<HTMLElement>('[data-slot="sheet-popup"]'),+ "Unable to find responsive right-panel sheet.",+ );+ const controls = await waitForElement(+ () => sheet.querySelector<HTMLElement>("[data-panel-layout-controls]"),+ "Unable to find shared controls in the responsive right-panel sheet.",+ );+ const tabbar = await waitForElement(+ () => sheet.querySelector<HTMLElement>("[data-right-panel-tabbar]"),+ "Unable to find responsive right-panel tabbar.",+ );+ const controlButtons = Array.from(controls.querySelectorAll<HTMLButtonElement>("button"));+ const tabbarRect = tabbar.getBoundingClientRect();+ const controlsRect = controls.getBoundingClientRect();++ expect(controlButtons.map((button) => button.getAttribute("aria-label"))).toEqual([+ "Toggle terminal drawer",+ "Toggle right panel",+ ]);+ expect(tabbarRect.height).toBe(52);+ expect(controlsRect.height).toBe(52);+ expect(controlsRect.top).toBe(tabbarRect.top);+ expect(window.innerWidth - controlsRect.right).toBe(12);+ for (const button of controlButtons) {+ const rect = button.getBoundingClientRect();+ const buttonCenter = rect.top + rect.height / 2;+ const tabbarCenter = tabbarRect.top + tabbarRect.height / 2;+ expect(rect.width).toBe(32);+ expect(rect.height).toBe(32);+ expect(Math.abs(buttonCenter - tabbarCenter)).toBeLessThanOrEqual(1);+ }+ expect(+ controlButtons[1]!.getBoundingClientRect().left -+ controlButtons[0]!.getBoundingClientRect().right,+ ).toBe(4);+ expect(sheet.querySelector('button[aria-label="Maximize panel"]')).toBeNull();+ expect(sheet.querySelector('button[aria-label="Close tasks sidebar"]')).toBeNull();++ const terminalTab = Array.from(+ sheet.querySelectorAll<HTMLButtonElement>("[data-right-panel-tab-list] button"),+ ).find((button) => button.textContent?.includes("Terminal"));+ terminalTab?.click();++ await vi.waitFor(() => {+ expect(+ selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, THREAD_REF)+ .activeSurfaceId,+ ).toBe(`terminal:${DEFAULT_TERMINAL_ID}`);+ expect(sheet.querySelector('[data-terminal-owner="right-panel"]')).not.toBeNull();+ expect(sheet.textContent).not.toContain("Claude Tasks");+ });++ sheet.querySelector<HTMLButtonElement>('button[aria-label="Close Plan"]')?.click();++ await vi.waitFor(() => {+ const panelState = selectThreadRightPanelState(+ useRightPanelStore.getState().byThreadKey,+ THREAD_REF,+ );+ expect(panelState.surfaces.some((surface) => surface.kind === "plan")).toBe(false);+ expect(panelState.activeSurfaceId).toBe(`terminal:${DEFAULT_TERMINAL_ID}`);+ });++ controls.querySelector<HTMLButtonElement>('button[aria-label="Toggle right panel"]')?.click();++ await vi.waitFor(() => {+ expect(+ selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, THREAD_REF).isOpen,+ ).toBe(false);+ });+ } finally {+ await mounted.cleanup();+ }+ });+it("loads file previews from the active thread worktree", async () => {const worktreePath = "/repo/worktrees/file-preview-thread";const snapshot = createSnapshotForTargetUser({diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsxindex 88186123d..5cd0583e7 100644--- a/apps/web/src/components/ChatView.tsx+++ b/apps/web/src/components/ChatView.tsx@@ -170,7 +170,7 @@ import { ExpandedImageDialog } from "./chat/ExpandedImageDialog";import { PullRequestThreadDialog } from "./PullRequestThreadDialog";import { MessagesTimeline } from "./chat/MessagesTimeline";import { ChatHeader } from "./chat/ChatHeader";-import { PanelLayoutControls } from "./chat/PanelLayoutControls";+import { PanelLayoutControls, RightPanelMaximizeControl } from "./chat/PanelLayoutControls";import { type ExpandedImagePreview } from "./chat/ExpandedImagePreview";import { NoActiveThreadState } from "./NoActiveThreadState";import { resolveEffectiveEnvMode, resolveEnvironmentOptionLabel } from "./BranchToolbar.logic";@@ -1333,9 +1333,8 @@ function ChatViewContent(props: ChatViewProps) {const planSidebarOpen = activeRightPanelKind === "plan";const previewPanelOpen = activeRightPanelKind === "preview" && isPreviewSupportedInRuntime();const rightPanelOpen = rightPanelState.isOpen;- const canMaximizeRightPanel = rightPanelOpen && !shouldUsePlanSidebarSheet;const rightPanelMaximized =- canMaximizeRightPanel && maximizedRightPanelThreadKey === routeThreadKey;+ rightPanelOpen && !shouldUsePlanSidebarSheet && maximizedRightPanelThreadKey === routeThreadKey;const inlineRightPanelOwnsTitleBar = rightPanelOpen && !shouldUsePlanSidebarSheet;useEffect(() => {@@ -3036,23 +3035,25 @@ function ChatViewContent(props: ChatViewProps) {const toggleInteractionMode = useCallback(() => {handleInteractionModeChange(interactionMode === "plan" ? "default" : "plan");}, [handleInteractionModeChange, interactionMode]);+ const dismissPlanSidebarForCurrentTurn = useCallback(() => {+ planSidebarDismissedForTurnRef.current =+ activePlan?.turnId ?? sidebarProposedPlan?.turnId ?? "__dismissed__";+ }, [activePlan?.turnId, sidebarProposedPlan?.turnId]);const togglePlanSidebar = useCallback(() => {if (!activeThreadRef) return;if (planSidebarOpen) {- planSidebarDismissedForTurnRef.current =- activePlan?.turnId ?? sidebarProposedPlan?.turnId ?? "__dismissed__";+ dismissPlanSidebarForCurrentTurn();} else {planSidebarDismissedForTurnRef.current = null;}useRightPanelStore.getState().toggle(activeThreadRef, "plan");- }, [activePlan?.turnId, activeThreadRef, planSidebarOpen, sidebarProposedPlan?.turnId]);+ }, [activeThreadRef, dismissPlanSidebarForCurrentTurn, planSidebarOpen]);const closePlanSidebar = useCallback(() => {if (!activeThreadRef) return;setMaximizedRightPanelThreadKey(null);useRightPanelStore.getState().close(activeThreadRef);- planSidebarDismissedForTurnRef.current =- activePlan?.turnId ?? sidebarProposedPlan?.turnId ?? "__dismissed__";- }, [activePlan?.turnId, activeThreadRef, sidebarProposedPlan?.turnId]);+ dismissPlanSidebarForCurrentTurn();+ }, [activeThreadRef, dismissPlanSidebarForCurrentTurn]);const closePreviewPanel = useCallback(() => {if (!activeThreadRef) return;setMaximizedRightPanelThreadKey(null);@@ -3061,6 +3062,11 @@ function ChatViewContent(props: ChatViewProps) {const activateRightPanelSurface = useCallback((surface: RightPanelSurface) => {if (!activeThreadRef) return;+ if (surface.kind === "plan") {+ planSidebarDismissedForTurnRef.current = null;+ } else if (planSidebarOpen) {+ dismissPlanSidebarForCurrentTurn();+ }useRightPanelStore.getState().activateSurface(activeThreadRef, surface.id);if (surface.kind === "preview" && surface.resourceId) {usePreviewStateStore.getState().setActiveTab(activeThreadRef, surface.resourceId);@@ -3085,17 +3091,31 @@ function ChatViewContent(props: ChatViewProps) {});}},- [activeThreadRef, diffOpen, environmentId, navigate, onDiffPanelOpen, threadId],+ [+ activeThreadRef,+ diffOpen,+ dismissPlanSidebarForCurrentTurn,+ environmentId,+ navigate,+ onDiffPanelOpen,+ planSidebarOpen,+ threadId,+ ],);const toggleRightPanel = useCallback(() => {if (!activeThreadRef) return;if (rightPanelOpen) {- setMaximizedRightPanelThreadKey(null);+ if (planSidebarOpen) {+ closePlanSidebar();+ } else {+ closePreviewPanel();+ }+ return;}useRightPanelStore.getState().toggleVisibility(activeThreadRef);- }, [activeThreadRef, rightPanelOpen]);+ }, [activeThreadRef, closePlanSidebar, closePreviewPanel, planSidebarOpen, rightPanelOpen]);const toggleRightPanelMaximized = () => {- if (!canMaximizeRightPanel) return;+ if (!rightPanelOpen || shouldUsePlanSidebarSheet) return;setMaximizedRightPanelThreadKey((threadKey) =>threadKey === routeThreadKey ? null : routeThreadKey,);@@ -3103,6 +3123,9 @@ function ChatViewContent(props: ChatViewProps) {const cleanupRightPanelSurfaces = useCallback((surfaces: readonly RightPanelSurface[]) => {if (!activeThreadRef) return;+ if (surfaces.some((surface) => surface.kind === "plan")) {+ dismissPlanSidebarForCurrentTurn();+ }const api = readEnvironmentApi(activeThreadRef.environmentId);for (const surface of surfaces) {@@ -3133,7 +3156,14 @@ function ChatViewContent(props: ChatViewProps) {});}},- [activeThreadRef, diffOpen, environmentId, navigate, threadId],+ [+ activeThreadRef,+ diffOpen,+ dismissPlanSidebarForCurrentTurn,+ environmentId,+ navigate,+ threadId,+ ],);const syncActivePreviewSurface = useCallback(() => {if (!activeThreadRef) return;@@ -4654,7 +4684,7 @@ function ChatViewContent(props: ChatViewProps) {return <NoActiveThreadState />;}- const panelLayoutControls = (+ const panelToggleControls = (<PanelLayoutControlsterminalAvailable={Boolean(activeProject)}terminalOpen={Boolean(terminalUiState.terminalOpen)}@@ -4662,20 +4692,95 @@ function ChatViewContent(props: ChatViewProps) {rightPanelAvailable={Boolean(activeProject)}rightPanelOpen={rightPanelOpen}rightPanelShortcutLabel={rightPanelToggleShortcutLabel}- rightPanelMaximized={rightPanelMaximized}- canMaximizeRightPanel={canMaximizeRightPanel}onToggleTerminal={toggleTerminalVisibility}onToggleRightPanel={toggleRightPanel}- onToggleRightPanelMaximized={toggleRightPanelMaximized}/>);+ const panelLayoutControls = (+ <div className="workspace-titlebar-controls z-50 gap-1 [-webkit-app-region:no-drag]">+ {rightPanelOpen && !shouldUsePlanSidebarSheet ? (+ <RightPanelMaximizeControl+ maximized={rightPanelMaximized}+ onToggle={toggleRightPanelMaximized}+ />+ ) : null}+ {panelToggleControls}+ </div>+ );+ const rightPanelContent = activeThreadRef ? (+ activeRightPanelSurface?.kind === "preview" ? (+ <Suspense fallback={null}>+ <PreviewPanel+ mode="embedded"+ threadRef={activeThreadRef}+ tabId={activeRightPanelSurface.resourceId}+ configuredUrls={configuredPreviewUrls}+ visible+ />+ </Suspense>+ ) : activeRightPanelSurface?.kind === "terminal" ? (+ <PersistentThreadTerminalPanel+ threadRef={activeThreadRef}+ surface={activeRightPanelSurface}+ launchContext={activeTerminalLaunchContext ?? null}+ focusRequestId={terminalFocusRequestId}+ keybindings={keybindings}+ onAddTerminalContext={addTerminalContextToDraft}+ onSplitTerminal={splitPanelTerminal}+ onSplitTerminalVertical={splitPanelTerminalVertical}+ onNewTerminal={addTerminalSurface}+ onActiveTerminalChange={activatePanelTerminal}+ onCloseTerminal={closePanelTerminal}+ splitShortcutLabel={splitTerminalShortcutLabel ?? undefined}+ splitVerticalShortcutLabel={splitTerminalVerticalShortcutLabel ?? undefined}+ newShortcutLabel={newTerminalShortcutLabel ?? undefined}+ closeShortcutLabel={closeTerminalShortcutLabel ?? undefined}+ />+ ) : activeRightPanelSurface?.kind === "diff" ? (+ <Suspense fallback={null}>+ <DiffPanel mode="embedded" composerDraftTarget={composerDraftTarget} />+ </Suspense>+ ) : activeRightPanelSurface?.kind === "plan" ? (+ <PlanSidebar+ activePlan={activePlan}+ activeProposedPlan={sidebarProposedPlan}+ label={planSidebarLabel}+ environmentId={environmentId}+ threadRef={activeThreadRef}+ markdownCwd={gitCwd ?? undefined}+ workspaceRoot={activeWorkspaceRoot}+ timestampFormat={timestampFormat}+ mode="embedded"+ />+ ) : (activeRightPanelSurface?.kind === "files" || activeRightPanelSurface?.kind === "file") &&+ activeProject &&+ activeWorkspaceRoot ? (+ <Suspense fallback={null}>+ <FilePreviewPanel+ key={`${activeProject.environmentId}:${activeWorkspaceRoot}`}+ environmentId={activeProject.environmentId}+ cwd={activeWorkspaceRoot}+ projectName={activeProject.name}+ threadRef={activeThreadRef}+ composerDraftTarget={composerDraftTarget}+ keybindings={keybindings}+ availableEditors={availableEditors}+ relativePath={+ activeRightPanelSurface.kind === "file" ? activeRightPanelSurface.relativePath : null+ }+ onOpenFile={openFileSurface}+ onPendingChange={handleFilePendingChange}+ />+ </Suspense>+ ) : null+ ) : null;return (<div className="relative flex min-h-0 min-w-0 flex-1 overflow-hidden bg-background">{isElectron && activeThreadRef ? (<PreviewAutomationOwner threadRef={activeThreadRef} visible={previewPanelOpen} />) : null}- {rightPanelOpen ? panelLayoutControls : null}+ {rightPanelOpen && !shouldUsePlanSidebarSheet ? panelLayoutControls : null}<divclassName={cn("flex min-h-0 min-w-0 flex-col overflow-hidden",@@ -4944,69 +5049,15 @@ function ChatViewContent(props: ChatViewProps) {diffAvailable={isServerThread && isGitRepo}filesAvailable={Boolean(activeProject)}>- {activeRightPanelSurface?.kind === "preview" ? (- <Suspense fallback={null}>- <PreviewPanel- mode="embedded"- threadRef={activeThreadRef}- tabId={activeRightPanelSurface.resourceId}- configuredUrls={configuredPreviewUrls}- visible- />- </Suspense>- ) : activeRightPanelSurface?.kind === "terminal" ? (- <PersistentThreadTerminalPanel- threadRef={activeThreadRef}- surface={activeRightPanelSurface}- launchContext={activeTerminalLaunchContext ?? null}- focusRequestId={terminalFocusRequestId}- keybindings={keybindings}- onAddTerminalContext={addTerminalContextToDraft}- onSplitTerminal={splitPanelTerminal}- onSplitTerminalVertical={splitPanelTerminalVertical}- onNewTerminal={addTerminalSurface}- onActiveTerminalChange={activatePanelTerminal}- onCloseTerminal={closePanelTerminal}- splitShortcutLabel={splitTerminalShortcutLabel ?? undefined}- splitVerticalShortcutLabel={splitTerminalVerticalShortcutLabel ?? undefined}- newShortcutLabel={newTerminalShortcutLabel ?? undefined}- closeShortcutLabel={closeTerminalShortcutLabel ?? undefined}- />- ) : activeRightPanelSurface?.kind === "diff" ? (- <Suspense fallback={null}>- <DiffPanel mode="embedded" composerDraftTarget={composerDraftTarget} />- </Suspense>- ) : (activeRightPanelSurface?.kind === "files" ||- activeRightPanelSurface?.kind === "file") &&- activeProject &&- activeWorkspaceRoot ? (- <Suspense fallback={null}>- <FilePreviewPanel- key={`${activeProject.environmentId}:${activeWorkspaceRoot}`}- environmentId={activeProject.environmentId}- cwd={activeWorkspaceRoot}- projectName={activeProject.name}- threadRef={activeThreadRef}- composerDraftTarget={composerDraftTarget}- keybindings={keybindings}- availableEditors={availableEditors}- relativePath={- activeRightPanelSurface.kind === "file"- ? activeRightPanelSurface.relativePath- : null- }- onOpenFile={openFileSurface}- onPendingChange={handleFilePendingChange}- />- </Suspense>- ) : null}+ {rightPanelContent}</RightPanelTabs>) : null}{shouldUsePlanSidebarSheet && rightPanelOpen && activeThreadRef ? (- <RightPanelSheet open onClose={closePreviewPanel}>+ <RightPanelSheet open onClose={planSidebarOpen ? closePlanSidebar : closePreviewPanel}><RightPanelTabsmode="sheet"+ layoutControls={panelToggleControls}surfaces={rightPanelState.surfaces}activeSurfaceId={activeRightPanelSurface?.id ?? null}pendingSurfaceIds={pendingFileSurfaceIds}@@ -5026,75 +5077,7 @@ function ChatViewContent(props: ChatViewProps) {diffAvailable={isServerThread && isGitRepo}filesAvailable={Boolean(activeProject)}>- {activeRightPanelSurface?.kind === "preview" ? (- <Suspense fallback={null}>- <PreviewPanel- mode="embedded"- threadRef={activeThreadRef}- tabId={activeRightPanelSurface.resourceId}- configuredUrls={configuredPreviewUrls}- visible- />- </Suspense>- ) : activeRightPanelSurface?.kind === "terminal" ? (- <PersistentThreadTerminalPanel- threadRef={activeThreadRef}- surface={activeRightPanelSurface}- launchContext={activeTerminalLaunchContext ?? null}- focusRequestId={terminalFocusRequestId}- keybindings={keybindings}- onAddTerminalContext={addTerminalContextToDraft}- onSplitTerminal={splitPanelTerminal}- onSplitTerminalVertical={splitPanelTerminalVertical}- onNewTerminal={addTerminalSurface}- onActiveTerminalChange={activatePanelTerminal}- onCloseTerminal={closePanelTerminal}- splitShortcutLabel={splitTerminalShortcutLabel ?? undefined}- splitVerticalShortcutLabel={splitTerminalVerticalShortcutLabel ?? undefined}- newShortcutLabel={newTerminalShortcutLabel ?? undefined}- closeShortcutLabel={closeTerminalShortcutLabel ?? undefined}- />- ) : activeRightPanelSurface?.kind === "diff" ? (- <Suspense fallback={null}>- <DiffPanel mode="embedded" composerDraftTarget={composerDraftTarget} />- </Suspense>- ) : activeRightPanelSurface?.kind === "plan" ? (- <PlanSidebar- activePlan={activePlan}- activeProposedPlan={sidebarProposedPlan}- label={planSidebarLabel}- environmentId={environmentId}- threadRef={activeThreadRef}- markdownCwd={gitCwd ?? undefined}- workspaceRoot={activeWorkspaceRoot}- timestampFormat={timestampFormat}- mode="embedded"- onClose={closePlanSidebar}- />- ) : (activeRightPanelSurface?.kind === "files" ||- activeRightPanelSurface?.kind === "file") &&- activeProject &&- activeWorkspaceRoot ? (- <Suspense fallback={null}>- <FilePreviewPanel- key={`${activeProject.environmentId}:${activeWorkspaceRoot}`}- environmentId={activeProject.environmentId}- cwd={activeWorkspaceRoot}- projectName={activeProject.name}- threadRef={activeThreadRef}- composerDraftTarget={composerDraftTarget}- keybindings={keybindings}- availableEditors={availableEditors}- relativePath={- activeRightPanelSurface.kind === "file"- ? activeRightPanelSurface.relativePath- : null- }- onOpenFile={openFileSurface}- onPendingChange={handleFilePendingChange}- />- </Suspense>- ) : null}+ {rightPanelContent}</RightPanelTabs></RightPanelSheet>) : null}diff --git a/apps/web/src/components/PlanSidebar.tsx b/apps/web/src/components/PlanSidebar.tsxindex 498f1912c..f7aada1df 100644--- a/apps/web/src/components/PlanSidebar.tsx+++ b/apps/web/src/components/PlanSidebar.tsx@@ -11,7 +11,6 @@ import {ChevronRightIcon,EllipsisIcon,LoaderIcon,- PanelRightCloseIcon,} from "lucide-react";import { cn } from "~/lib/utils";import type { ActivePlanState } from "../session-logic";@@ -61,7 +60,6 @@ interface PlanSidebarProps {workspaceRoot: string | undefined;timestampFormat: TimestampFormat;mode?: "sheet" | "sidebar" | "embedded";- onClose: () => void;}const PlanSidebar = memo(function PlanSidebar({@@ -74,7 +72,6 @@ const PlanSidebar = memo(function PlanSidebar({workspaceRoot,timestampFormat,mode = "sidebar",- onClose,}: PlanSidebarProps) {const [proposedPlanExpanded, setProposedPlanExpanded] = useState(false);const [isSavingToWorkspace, setIsSavingToWorkspace] = useState(false);@@ -182,15 +179,6 @@ const PlanSidebar = memo(function PlanSidebar({</MenuPopup></Menu>) : null}- <Button- size="icon-xs"- variant="ghost"- onClick={onClose}- aria-label={`Close ${label.toLowerCase()} sidebar`}- className="text-muted-foreground/50 hover:text-foreground/70"- >- <PanelRightCloseIcon className="size-3.5" />- </Button></div></div>diff --git a/apps/web/src/components/RightPanelTabs.tsx b/apps/web/src/components/RightPanelTabs.tsxindex b5c419a08..ead306f7c 100644--- a/apps/web/src/components/RightPanelTabs.tsx+++ b/apps/web/src/components/RightPanelTabs.tsx@@ -27,6 +27,7 @@ import { PierreEntryIcon } from "./chat/PierreEntryIcon";interface RightPanelTabsProps {mode: PreviewPanelMode;maximized?: boolean;+ layoutControls?: ReactNode;surfaces: readonly RightPanelSurface[];activeSurfaceId: string | null;pendingSurfaceIds: ReadonlySet<string>;@@ -342,8 +343,8 @@ export function RightPanelTabs(props: RightPanelTabsProps) {><divclassName={cn(- "px-2 pr-28",- props.mode === "inline" ? "workspace-topbar" : "flex h-10 shrink-0 items-center",+ "workspace-topbar gap-1 pl-2",+ props.mode === "inline" ? "pr-28" : "pr-3",ownsDesktopTitleBar && "wco:pr-[calc(var(--workspace-native-controls-inset)+6rem)]",)}data-right-panel-tabbar@@ -457,6 +458,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) {) : null}</div></ScrollArea>+ {props.layoutControls}</div><div className="flex min-h-0 flex-1 flex-col">{props.activeSurfaceId === null ? (diff --git a/apps/web/src/components/chat/ChatHeader.tsx b/apps/web/src/components/chat/ChatHeader.tsxindex db694644a..2bfc204ce 100644--- a/apps/web/src/components/chat/ChatHeader.tsx+++ b/apps/web/src/components/chat/ChatHeader.tsx@@ -72,15 +72,15 @@ export const ChatHeader = memo(function ChatHeader({primaryEnvironmentId,});return (- <div className="@container/header-actions flex min-w-0 flex-1 flex-col gap-2 sm:flex-row sm:items-center sm:justify-between">- <div className="flex min-w-0 flex-wrap items-center gap-2 overflow-hidden sm:flex-1 sm:flex-nowrap sm:gap-3">+ <div className="@container/header-actions flex min-w-0 flex-1 items-center gap-2 sm:gap-3">+ <div className="flex min-w-0 flex-1 items-center gap-2 overflow-hidden sm:gap-3"><SidebarTrigger className="size-7 shrink-0 md:hidden" /><Tooltip><TooltipTriggerrender={<h2aria-label={activeThreadTitle}- className="min-w-0 flex-1 basis-40 truncate text-sm font-medium text-foreground"+ className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">{activeThreadTitle}</h2>@@ -92,7 +92,7 @@ export const ChatHeader = memo(function ChatHeader({<divdata-chat-header-actionsclassName={cn(- "flex min-w-0 flex-wrap items-center justify-start gap-2 sm:shrink-0 sm:justify-end @3xl/header-actions:gap-3",+ "flex shrink-0 items-center justify-end gap-2 @3xl/header-actions:gap-3",rightPanelOpen ? "pr-0" : "pr-16",)}>diff --git a/apps/web/src/components/chat/PanelLayoutControls.tsx b/apps/web/src/components/chat/PanelLayoutControls.tsxindex 3b7fbf4ad..deb7b3ee9 100644--- a/apps/web/src/components/chat/PanelLayoutControls.tsx+++ b/apps/web/src/components/chat/PanelLayoutControls.tsx@@ -1,8 +1,6 @@import { Maximize2Icon, Minimize2Icon, PanelBottomIcon, PanelRightIcon } from "lucide-react";import { memo } from "react";-import { cn } from "~/lib/utils";-import { Toggle } from "../ui/toggle";import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";@@ -13,11 +11,8 @@ interface PanelLayoutControlsProps {rightPanelAvailable: boolean;rightPanelOpen: boolean;rightPanelShortcutLabel: string | null;- rightPanelMaximized: boolean;- canMaximizeRightPanel: boolean;onToggleTerminal: () => void;onToggleRightPanel: () => void;- onToggleRightPanelMaximized: () => void;}export const PanelLayoutControls = memo(function PanelLayoutControls({@@ -27,47 +22,14 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({rightPanelAvailable,rightPanelOpen,rightPanelShortcutLabel,- rightPanelMaximized,- canMaximizeRightPanel,onToggleTerminal,onToggleRightPanel,- onToggleRightPanelMaximized,}: PanelLayoutControlsProps) {return (<div- className={cn("workspace-titlebar-controls z-50 gap-1 [-webkit-app-region:no-drag]")}+ className="flex h-full shrink-0 items-center gap-1 [-webkit-app-region:no-drag]"data-panel-layout-controls>- {rightPanelOpen ? (- <Tooltip>- <TooltipTrigger- render={- <Toggle- className="shrink-0 [-webkit-app-region:no-drag]"- pressed={rightPanelMaximized}- onPressedChange={onToggleRightPanelMaximized}- aria-label={rightPanelMaximized ? "Restore panel size" : "Maximize panel"}- variant="ghost"- size="sm"- disabled={!canMaximizeRightPanel}- >- {rightPanelMaximized ? (- <Minimize2Icon className="size-3.5" />- ) : (- <Maximize2Icon className="size-3.5" />- )}- </Toggle>- }- />- <TooltipPopup side="bottom">- {canMaximizeRightPanel- ? rightPanelMaximized- ? "Restore panel size"- : "Maximize panel"- : "Panel maximization is unavailable at this width"}- </TooltipPopup>- </Tooltip>- ) : null}<Tooltip><TooltipTriggerrender={@@ -115,3 +77,36 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({</div>);});++export const RightPanelMaximizeControl = memo(function RightPanelMaximizeControl({+ maximized,+ onToggle,+}: {+ maximized: boolean;+ onToggle: () => void;+}) {+ const label = maximized ? "Restore panel size" : "Maximize panel";+ return (+ <Tooltip>+ <TooltipTrigger+ render={+ <Toggle+ className="shrink-0 [-webkit-app-region:no-drag]"+ pressed={maximized}+ onPressedChange={onToggle}+ aria-label={label}+ variant="ghost"+ size="sm"+ >+ {maximized ? (+ <Minimize2Icon className="size-3.5" />+ ) : (+ <Maximize2Icon className="size-3.5" />+ )}+ </Toggle>+ }+ />+ <TooltipPopup side="bottom">{label}</TooltipPopup>+ </Tooltip>+ );+});