A local-first multi-agent app development platform, built on PenguinHarness
feat(web,ui): 停靠面可以拉到最大,每个停靠面板都是一条注册表定义(上游 #961 移植)
lmlihenge7a0a5a70721
diff --git a/changelog/unreleased/2026-10-09-dock-fullscreen.md b/changelog/unreleased/2026-10-09-dock-fullscreen.mdnew file mode 100644index 00000000..deaeaab9--- /dev/null+++ b/changelog/unreleased/2026-10-09-dock-fullscreen.md@@ -0,0 +1,47 @@+# A dock can grow to its largest size, and every dock panel is a registry definition++- **Date:** 2026-10-09+- **Type:** feature+- **Scope:** `web`, `ui`++[中文版](2026-10-09-dock-fullscreen.zh.md)++A dock surface with tabs can now grow to its largest size — from a header button or by dragging its edge past the maximum — with an animated transition.+The panels behind the docks became definitions in one registry, which every list of panels reads,+as the seam for panels that plugins will provide.+This is ported from upstream PenguinHarness (#961, commit `1eb13325`).++## Details++- **Full screen** is the dock at its largest, below the chat toolbar, which keeps the title and+ statistics: the right dock covers its row (the conversation column), with an open bottom dock still+ showing below it; the bottom dock (or the merged sheet on a narrow window) grows up to the toolbar.+ The navigation column stays. Enter it with the **Full screen** header button, or by dragging the+ dock's edge a little past its maximum width (height for the bottom dock); the drag snaps into full+ screen and ends there. While full, the resize handle sits on the surface's leading edge: dragging it+ back snaps out to the stored size, and so does a double-click. The header button, now **Exit full+ screen**, leaves in place. Esc does not leave: the terminal, the editor and web pages use it. The+ tab strip, **Add panel**, a terminal's **Detach** and the dock's × keep working; moving the dock or+ a tab to the other edge is put away.+- Entering and leaving animate with the theme's layout motion — the surface grows from where it+ docks and shrinks back — and are instant under reduced motion. The panel lays out at its final+ size from the first frame, so a terminal does not refit on every step. The theme's layout motion+ now also covers `top` and `left`.+- Full screen is not remembered. It ends when the conversation changes, when the window crosses the+ narrow breakpoint, when the dock is hidden or its last tab closes, and when a dock it covers has to+ show something (the right dock opening under a full-screen bottom dock), so that content never+ opens under the cover. A full-screen right dock covers no other dock, so the bottom dock opening+ or showing a terminal leaves it as it is.+- The page under the cover does not reflow, and the panels do not remount: scroll positions, a+ file preview, an editor draft and a terminal's screen are as they were on the way back. Dialogs,+ menus, tooltips and toasts still show above a full-screen dock, and the built-in browser's page+ follows it.+- The touch-only **Fill the screen** button of the bottom dock is gone; full screen replaces it on+ every pointer.+- **Panel registry.** Each panel kind (agents, Files, Memory, Trajectories, Remote control,+ Scheduled tasks, Browser) is a definition — id, name, icon, order, whether it is offered here,+ and its body component. The tab strip, **Add panel**, the empty dock's picker and the Shortcuts+ launcher list and name panels from it. A body reaches what its dock gives it through one hook,+ `useDockPanel()`: its dock, whether it is the shown tab, full screen on and off, and closing its+ tab through the close guards. A stored tab whose panel is not registered (a plugin not loaded+ yet) stays in the layout and shows a placeholder until it is, closable by its ×.diff --git a/changelog/unreleased/2026-10-09-dock-fullscreen.zh.md b/changelog/unreleased/2026-10-09-dock-fullscreen.zh.mdnew file mode 100644index 00000000..a870835e--- /dev/null+++ b/changelog/unreleased/2026-10-09-dock-fullscreen.zh.md@@ -0,0 +1,18 @@+# 停靠面可以拉到最大,每个停靠面板都是注册表里的一条定义++- **Date:** 2026-10-09+- **Type:** feature+- **Scope:** `web`, `ui`++[English](2026-10-09-dock-fullscreen.md)++有标签的停靠面现在可以拉到最大尺寸——经头部按钮,或把边界拖过最大值——进出都有过渡动画。停靠栏里的面板改为同一个注册表中的定义,所有列出面板的地方都读它,为日后插件提供面板留出接缝。本次从上游 PenguinHarness 移植(#961,提交 `1eb13325`)。++## 细节++- **全屏**就是把停靠面拉到它在对话工具行之下能达到的最大尺寸,工具行连同标题与统计信息保留:右侧停靠栏铺满所在的一行、盖住对话列,开着的底部停靠栏照常显示在它下方;底部停靠栏(或窄屏下合并成的底部面)一直长到工具行之下。导航栏保留。进入有两种方式:头部的**全屏**按钮,或把停靠面的边界拖过最大宽度(底部为最大高度)再多一小段——拖动随即跳变为全屏并就此结束。全屏时调整手柄位于全屏面的前缘,向回拖即跳回记住的尺寸,双击亦然;头部那枚按钮原位变为**退出全屏**。Esc 不退出:终端、编辑器与网页都要用它。标签条、**添加面板**、终端的**分离**与停靠栏的 × 照常可用;把停靠栏或标签移到另一侧,全屏时不提供。+- 进出全屏随主题的布局动效过渡:停靠面从原位展开,退出时收回原位;减弱动效时即时切换。面板从第一帧起就按终点尺寸排版,终端不会每一帧都重新排布。主题的布局动效因此也涵盖 `top` 与 `left`。+- 全屏不会被记住。切换对话、窗口跨过窄屏断点、停靠栏被隐藏或最后一个标签关闭,以及被它盖住的停靠栏要显示内容时(例如底部全屏时打开右侧停靠栏),全屏都会结束,内容因此不会打开在全屏面之下。右侧全屏不盖住底部停靠栏,底部停靠栏的开合或在其中显示终端都不影响它。+- 全屏面之下的页面不重新排版,面板也不重新挂载:退出后滚动位置、文件预览、编辑器草稿与终端画面都原样还在。弹窗、菜单、悬停提示与 toast 仍显示在全屏面之上,内置浏览器的页面随之移动。+- 底部停靠栏原先仅触屏可用的**放大到整屏**按钮已移除,由各种指针都可用的全屏取代。+- **面板注册表。** 每种面板(智能体、文件浏览、记忆、轨迹观测、远程控制、定时任务、浏览器)都是一条定义:id、名称、图标、排序、当前环境是否提供,以及面板主体组件。标签条、**添加面板**、空停靠栏的选单与快捷方式悬浮球都按它列出、命名面板。面板主体经同一个 hook `useDockPanel()` 取得停靠栏给它的能力:所在停靠栏、是否为当前显示的标签、进出全屏、经关闭守卫关闭本标签。布局里存着、但其面板尚未注册的标签(如插件尚未加载)会留在布局中,在注册之前显示占位内容,可用 × 关闭。diff --git a/packages/docs/content/chat.en.md b/packages/docs/content/chat.en.mdindex 18bde9d8..001cdfbe 100644--- a/packages/docs/content/chat.en.md+++ b/packages/docs/content/chat.en.md@@ -240,6 +240,8 @@ The chat page has two docks for panels: the right sidebar and the bottom panel.Each conversation remembers its own panel layout in this browser, and switching conversations restores it. Hiding a dock keeps its panels as they were, including unsaved edits. While a subagent waits for approval, an amber dot marks the button of the dock that holds the Agents panel, or the **Right sidebar** button when the panel is closed.+To make a dock as large as it goes, select **Full screen** in its header, or drag its edge past the widest (for the bottom panel, tallest) it can be. The right sidebar then covers the conversation and the bottom panel grows up to the toolbar; the toolbar with the title and statistics, and the sidebar on the left, stay where they are. Its tabs and **Add panel** keep working. To come back, select **Exit full screen** in the same place, or drag the edge back. Full screen also ends when you switch conversations, hide the dock or close its last tab, or when a panel opens in a dock it covers.+### Open panels with the shortcuts launcherWhen the right sidebar is closed on a desktop-width window, or no panel is open on a narrow one, a round **Shortcuts** button floats 32px inside the right edge of the conversation. It is not shown on the draft page or while the conversation's history is loading or failed to load.diff --git a/packages/docs/content/chat.zh.md b/packages/docs/content/chat.zh.mdindex 122e9587..4b4f87a6 100644--- a/packages/docs/content/chat.zh.md+++ b/packages/docs/content/chat.zh.md@@ -240,6 +240,8 @@ Task 运行时输入了内容,发送按钮的行为取决于 + 菜单底部的每段对话会在当前浏览器里记住自己的面板布局,切换对话时恢复。隐藏侧栏不会改变其中的面板,未保存的编辑也会保留。子 Agent 等待审批时,放着智能体面板的那个侧栏按钮上会出现琥珀色圆点;智能体面板没有打开时,圆点在**右侧栏**按钮上。+想把侧栏拉到最大,点侧栏头部的**全屏**,或者把它的边界拖过最大宽度(下侧栏为最大高度)。右侧栏随即盖住对话,下侧栏则一直长到工具栏下方;带标题和统计信息的工具栏、左边的侧边栏都保持不动,标签和**添加面板**照常可用。点同一位置的**退出全屏**,或把边界拖回来,即可恢复。切换对话、隐藏侧栏、关闭最后一个标签,或者有面板在被它盖住的侧栏里打开时,全屏也会自动结束。+### 用快捷方式悬浮球打开面板桌面宽度下右侧栏关闭时,或窄屏下没有打开任何面板时,对话区右缘内侧 32px 处会浮着一个圆形的**快捷方式**按钮。草稿页不显示它;对话历史正在加载或加载失败时也不显示。diff --git a/packages/ui/src/components/shell/dock-frame/dock-frame.tsx b/packages/ui/src/components/shell/dock-frame/dock-frame.tsxindex e6941b41..5a8a4c11 100644--- a/packages/ui/src/components/shell/dock-frame/dock-frame.tsx+++ b/packages/ui/src/components/shell/dock-frame/dock-frame.tsx@@ -13,15 +13,62 @@** The border belongs to the open state only: with border-box sizing a collapsed dock would still* paint its 1px, leaving a hairline where nothing is. The resize handle is the caller's too, shown- * only while open: an overlay straddling the bottom dock's top edge (it costs no height), and a- * layout sibling before the right dock (it must cost real width, so the conversation measures- * the same under every surface).+ * only while open and seated by the frame: an overlay straddling the bottom dock's top edge (it+ * costs no height), and the one item of a spacer before the right dock (it must cost real width,+ * so the conversation measures the same under every surface).+ *+ * A surface can go FULLSCREEN — grown as far as its own edge goes, which is the element the+ * caller names: the right dock's row (the conversation beside it; the toolbar above and the+ * bottom dock below stay in view), the bottom dock's area up to the toolbar (the row and itself,+ * over the right dock). The box in the flow keeps its size as a placeholder — the conversation+ * beside or above it does not reflow, so nothing under the cover scrolls or refits — and only the+ * content box inside it lifts off (`fixed`, at `DOCK_FULLSCREEN_Z`); the bodies are the same+ * elements, so a terminal, a file preview or an editor draft carries over untouched. The resize+ * handle moves to the lifted box's LEADING edge (the right dock's left, the bottom dock's top),+ * where a pull back inward is the way out by drag, while the placeholder keeps the handle's+ * footprint without a second bar; the header's own toggle is the other way back.+ *+ * The flip is the theme's layout motion, in three phases the root announces as+ * `data-fullscreen` (absent in the flow): ENTERING lifts the box at its docked rect and sends it+ * to the cover's on the next frame, so the transition has two values to run between; FULL follows+ * the cover live — the navigation column folds, the window resizes, the bottom dock opens or+ * resizes under a fullscreen right dock and its row changes height — with no transition; EXITING+ * sends it back to the docked rect, which the root still holds, and the box rejoins the flow when+ * the transition ends. The inside never reflows on the way: a wrapper lays the header and body out+ * at the size the box is heading to, anchored to the box's top and to the edge both rects share+ * (the right dock's right, the bottom dock's left), so the header rides the box's top edge while+ * the box's `overflow: hidden` uncovers or covers the rest. A theme with no motion (or reduced+ * motion) fires no `transitionend`; a timer from the computed duration settles the phase instead.+ * Layers that lay content over the dock by coordinates follow the phases, not the caller's flag,+ * through `onFullscreenPhase`: the box is still lifted while it exits.*/-import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode, Ref } from "react";+import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";+import type {+ ButtonHTMLAttributes,+ CSSProperties,+ HTMLAttributes,+ ReactNode,+ Ref,+ RefObject,+} from "react";+import { RESIZE_HANDLE_PX } from "../../layout/resize-handle/resize-handle";export type DockEdge = "right" | "bottom";-/** A small square header button: the dock's add, detach, move and hide controls. */+/**+ * The layer a fullscreen dock surface paints at: level with the in-flow menus (z-40, where the+ * dock wins by document order — it comes after the toolbar and the navigation column in the+ * tree), under the dialogs and drawers (z-50), the portaled menus and tooltips (z-[60]) and the+ * toasts (z-[100]), so the dock's own confirmations, its "+" menu and its tooltips still paint+ * over it. Content laid over the surface by coordinates (the built-in browser's page) takes the+ * step above (+1), and so does the resize handle seated on the surface's leading edge.+ */+export const DOCK_FULLSCREEN_Z = 40;++/** Where a lifted surface is on its way; the root carries it as `data-fullscreen`. */+export type DockFullscreenPhase = "entering" | "full" | "exiting";++/** A small square header button: the dock's add, detach, move, fullscreen and hide controls. */export function DockHeaderButton({label,coarse = false,@@ -51,6 +98,268 @@ export function DockHeaderButton({);}+// ------------------------------------------------------------------------------ fullscreen++interface Rect {+ top: number;+ left: number;+ width: number;+ height: number;+}++interface Size {+ width: number;+ height: number;+}++interface FullscreenState {+ phase: "docked" | DockFullscreenPhase;+ /** The lifted box's rect — its inline style; null while it sits in the flow. */+ box: Rect | null;+ /** The size the inside lays out at while lifted: the size the box is heading to. */+ inner: Size | null;+ /**+ * Entering, before launch: the box is lifted at its docked rect, waiting for the frame that+ * sends it to the host's. A box that mounts lifted at its target has no transition to run.+ */+ launch: boolean;+}++const DOCKED: FullscreenState = { phase: "docked", box: null, inner: null, launch: false };++/**+ * What the lifted box transitions; a `transitionend` for anything else (a child's colour) is not+ * the box arriving.+ */+const MOVED = new Set(["top", "left", "width", "height"]);++/** Grace past the theme's duration before the fallback settles a phase whose end never fired. */+const SETTLE_SLACK_MS = 100;++function sameRect(a: Rect | null, b: Rect): boolean {+ if (a === null) return false;+ return a.top === b.top && a.left === b.left && a.width === b.width && a.height === b.height;+}++function sizeOf(rect: Rect): Size {+ return { width: rect.width, height: rect.height };+}++/**+ * The rect a lifted surface covers: the element the caller names (the right dock's row, the+ * bottom dock's area), or the viewport without one.+ */+function hostRect(host: HTMLElement | null): Rect {+ if (host === null)+ return { top: 0, left: 0, width: window.innerWidth, height: window.innerHeight };+ const box = host.getBoundingClientRect();+ return { top: box.top, left: box.left, width: box.width, height: box.height };+}++/**+ * The content box's docked rect, read off the root rather than off the box: the root keeps its+ * place and its size through every phase (it is the placeholder once the box lifts), so the+ * reading is right both before the box leaves and while it is on its way back. The client box+ * leaves out the open state's border, which the content sits inside of.+ */+function dockedRect(root: HTMLElement): Rect {+ const box = root.getBoundingClientRect();+ return {+ top: box.top + root.clientTop,+ left: box.left + root.clientLeft,+ width: root.clientWidth,+ height: root.clientHeight,+ };+}++/**+ * The longest transition the box's computed style declares, in ms — 0 when the theme or reduced+ * motion turned it off (`transition: none` computes to a zero duration), in which case no+ * `transitionend` will ever come.+ */+function transitionMs(style: CSSStyleDeclaration): number {+ const longest = (list: string): number => {+ const values = list.split(",").map((part) => {+ const value = part.trim();+ const number = parseFloat(value);+ if (!Number.isFinite(number)) return 0;+ return value.endsWith("ms") ? number : number * 1000;+ });+ return Math.max(0, ...values);+ };+ return longest(style.transitionDuration) + longest(style.transitionDelay);+}++/**+ * The phase machine behind `fullscreen`: `want` is where the caller wants the surface, `jump`+ * whether a change lands at once (the layout motion is off, or the dock is closing — the × hid a+ * fullscreen dock, which also ended its fullscreen, and the collapse is the one animation to+ * play). The box's root is its parent, read at the moments that need it.+ */+function useFullscreenPhase(+ want: boolean,+ jump: boolean,+ boxRef: RefObject<HTMLDivElement | null>,+ fullscreenHost: (() => HTMLElement | null) | undefined,+ onFullscreenPhase: ((phase: DockFullscreenPhase | null) => void) | undefined,+): FullscreenState {+ const [state, setState] = useState<FullscreenState>(DOCKED);+ const { phase, launch } = state;++ // The callbacks as the latest render gave them, so the effects below key on the phase alone+ // (the caller may hand in a fresh arrow every render). Assigned first, before any effect reads.+ const hostRef = useRef(fullscreenHost);+ const reportRef = useRef(onFullscreenPhase);+ useLayoutEffect(() => {+ hostRef.current = fullscreenHost;+ reportRef.current = onFullscreenPhase;+ });+ const host = useCallback((): Rect => hostRect(hostRef.current?.() ?? null), []);++ // Drive: every change of what is wanted, and every settled step, decides the next state. A+ // layout effect, so a lift measures the box's docked rect while the box still sits in the flow+ // and the lifted first paint lands at that same rect — identical to the eye.+ useLayoutEffect(() => {+ const root = boxRef.current?.parentElement ?? null;+ if (root === null) return;+ if (want) {+ if (phase === "full") return;+ const target = host();+ if (jump) {+ setState({ phase: "full", box: target, inner: sizeOf(target), launch: false });+ return;+ }+ if (phase === "entering") return;+ if (phase === "docked") {+ setState({+ phase: "entering",+ box: dockedRect(root),+ inner: sizeOf(target),+ launch: true,+ });+ return;+ }+ // Exiting: the box is on its way back — turn it round from wherever it is.+ setState({ phase: "entering", box: target, inner: sizeOf(target), launch: false });+ return;+ }+ if (phase === "docked") return;+ // Before launch the box never left its docked rect: there is nothing to animate back.+ if (jump || launch) {+ setState(DOCKED);+ return;+ }+ if (phase === "exiting") return;+ const target = dockedRect(root);+ if (sameRect(state.box, target)) {+ setState(DOCKED);+ return;+ }+ setState({ phase: "exiting", box: target, inner: sizeOf(target), launch: false });+ }, [want, jump, state, phase, launch, boxRef, host]);++ // Launch: a frame after the lifted box painted at its docked rect, send it to the host's.+ // Double rAF: the first can land in the same frame as that paint, and a change within one+ // frame is not a transition. A host no bigger than the dock leaves nothing to move.+ useEffect(() => {+ if (phase !== "entering" || !launch) return;+ let inner = 0;+ const outer = requestAnimationFrame(() => {+ inner = requestAnimationFrame(() => {+ const target = host();+ setState((s) =>+ s.phase !== "entering" || !s.launch+ ? s+ : {+ phase: sameRect(s.box, target) ? "full" : "entering",+ box: target,+ inner: sizeOf(target),+ launch: false,+ },+ );+ });+ });+ return () => {+ cancelAnimationFrame(outer);+ cancelAnimationFrame(inner);+ };+ }, [phase, launch, host]);++ // Settle: the box arrives when its own transition ends — or, with a theme that moves nothing,+ // at once; and a timer past the computed duration catches an end that never fires (a frame+ // dropped past the event, a transition the browser cancelled). A phase that changed meanwhile+ // (the toggle pressed again mid-flight) re-arms for its new destination.+ useLayoutEffect(() => {+ if ((phase !== "entering" && phase !== "exiting") || launch) return;+ const box = boxRef.current;+ if (box === null) return;+ const settle = () =>+ setState((s) => {+ if (s.phase !== phase) return s;+ return phase === "entering" ? { ...s, phase: "full" } : DOCKED;+ });+ const ms = transitionMs(getComputedStyle(box));+ if (ms === 0) {+ settle();+ return;+ }+ const ended = (event: TransitionEvent) => {+ if (event.target === box && MOVED.has(event.propertyName)) settle();+ };+ box.addEventListener("transitionend", ended);+ // The timer can beat a transition that is still running (a background tab throttles both+ // frames and events): the box is finished where it was going before the phase says it is+ // there, or the next phase would start from wherever the motion had got to.+ const timer = window.setTimeout(() => {+ for (const animation of box.getAnimations()) animation.finish();+ settle();+ }, ms + SETTLE_SLACK_MS);+ return () => {+ box.removeEventListener("transitionend", ended);+ window.clearTimeout(timer);+ };+ }, [phase, launch, boxRef]);++ // Full: follow the covered element's rect as it changes — its size through a ResizeObserver+ // (the navigation column folding animates its width; the bottom dock opening, closing or+ // resizing under a fullscreen right dock changes the row's height), its place through the+ // window — with no transition, so the cover sticks to the element rather than trailing it.+ useEffect(() => {+ if (phase !== "full") return;+ const follow = () => {+ const target = host();+ setState((s) =>+ s.phase === "full" && !sameRect(s.box, target)+ ? { ...s, box: target, inner: sizeOf(target) }+ : s,+ );+ };+ const element = hostRef.current?.() ?? null;+ const observer = element === null ? null : new ResizeObserver(follow);+ if (element !== null) observer?.observe(element);+ window.addEventListener("resize", follow);+ follow();+ return () => {+ observer?.disconnect();+ window.removeEventListener("resize", follow);+ };+ }, [phase, host]);++ // Report each phase once it is in the DOM (the attribute and the lifted box exist from this+ // commit on), never the initial docked state.+ const reported = useRef<DockFullscreenPhase | null>(null);+ useLayoutEffect(() => {+ const current = phase === "docked" ? null : phase;+ if (current === reported.current) return;+ reported.current = current;+ reportRef.current?.(current);+ }, [phase]);++ return state;+}++// ----------------------------------------------------------------------------------- frame+export interface DockFrameProps {position: DockEdge;/** False while the dock collapses on its way out: it stays mounted at size 0, inert. */@@ -59,7 +368,7 @@ export interface DockFrameProps {size: number;/** The settled size the content lays out at (px), whatever the box is passing through. */contentSize: number;- /** Whether a change of `size` animates. */+ /** Whether a change of `size` — and a fullscreen flip — animates. */animate: boolean;/** The tab strip (`DockTabs`). */tabs: ReactNode;@@ -73,12 +382,35 @@ export interface DockFrameProps {movable?: boolean;/** The shown tab's body, or the picker while the dock has no tabs. */children: ReactNode;- /** The resize handle, rendered only while open. */+ /**+ * The resize handle (a `ResizeHandle`), rendered only while open. The frame seats it: the right+ * dock's, given without `edge`, fills the 6px spacer before the box; the bottom dock's, given+ * with `edge: "start"`, straddles the box's top edge. While the surface is lifted the same+ * element sits on the lifted box's leading edge instead, and the spacer keeps its footprint.+ */handle?: ReactNode;/** Layers that belong to the dock but float over the page (a drag overlay, a confirmation). */overlays?: ReactNode;/** The box's node: the resize handle measures it, and a drop preview finds it. */rootRef?: Ref<HTMLDivElement>;+ /**+ * The surface covers its host instead of sitting in the flow (its in-flow box keeps its size+ * underneath). The flip animates with the theme's layout motion unless `animate` is off or the+ * dock is closing, when it lands at once.+ */+ fullscreen?: boolean;+ /**+ * The element a fullscreen surface covers — the dock grown as far as its own edge goes: the+ * right dock's row, the bottom dock's area — read when the surface lifts and followed while it+ * is full; the viewport when absent or null.+ */+ fullscreenHost?: () => HTMLElement | null;+ /**+ * Each change of the fullscreen phase, once it is in the DOM — `entering`, `full`, `exiting`,+ * and null when the box is back in the flow — for the layers that lay content over the dock by+ * coordinates: the box is still lifted, and still clips, while it exits.+ */+ onFullscreenPhase?: (phase: DockFullscreenPhase | null) => void;}export function DockFrame({@@ -95,6 +427,9 @@ export function DockFrame({handle,overlays,rootRef,+ fullscreen = false,+ fullscreenHost,+ onFullscreenPhase,}: DockFrameProps) {const header = (<header@@ -110,6 +445,107 @@ export function DockFrame({</header>);+ // The content box's node: the phase machine measures it, listens for its transition's end and+ // reads its root (the parent) for the docked rect.+ const boxRef = useRef<HTMLDivElement | null>(null);+ const { phase, box, inner } = useFullscreenPhase(+ fullscreen && open,+ // Off while a drag resizes or a flip must land at once, and while the dock closes: the ×+ // hiding a fullscreen dock ends its fullscreen too, and the collapse is the one animation+ // then — the cover simply goes.+ !animate || !open,+ boxRef,+ fullscreenHost,+ onFullscreenPhase,+ );+ const lifted = phase !== "docked";+ const moving = animate && (phase === "entering" || phase === "exiting");++ // The handle's seat. In the flow the seat is `display: contents`, so the handle lays itself out+ // as the caller placed it: the right dock's as the one item of the spacer before the root — the+ // spacer, not the handle, is what costs the row its `RESIZE_HANDLE_PX`, so the footprint stays+ // while the handle is away — and the bottom dock's as the overlay straddling the root's top+ // edge. Lifted, the seat is a fixed box on the lifted surface's LEADING edge, where a pull back+ // inward is the way out: a band straddling the right dock's left edge for the handle to fill, a+ // zero-height line along the bottom dock's top edge for the overlay handle to straddle as it+ // straddles the root's. It takes the step above the surface (the box comes later in the tree,+ // so an equal index would paint it over the handle) and follows the box's rect, with the box's+ // layout motion while it moves. The SEAT changes, never the handle: one element through every+ // phase, so a drag that began on it in the flow goes on when the snap lifts the surface+ // mid-gesture — a remounted handle would keep the pointer's capture and never report the+ // release that ends the drag. There is one handle at a time.+ const seatStyle: CSSProperties | undefined =+ lifted && box !== null+ ? position === "right"+ ? {+ top: box.top,+ left: box.left - RESIZE_HANDLE_PX / 2,+ width: RESIZE_HANDLE_PX,+ height: box.height,+ zIndex: DOCK_FULLSCREEN_Z + 1,+ }+ : {+ top: box.top,+ left: box.left,+ width: box.width,+ height: 0,+ zIndex: DOCK_FULLSCREEN_Z + 1,+ }+ : undefined;+ const seatClass =+ seatStyle === undefined ? "contents" : position === "right" ? "fixed flex" : "fixed";+ const seat = open ? (+ <div data-layout-motion={moving ? "" : undefined} style={seatStyle} className={seatClass}>+ {handle}+ </div>+ ) : null;++ // Lifted: a fixed box at the rect the phase machine gives it, transitioning its place and size+ // through the theme's layout motion while it enters or exits, clipping what the inside lays out+ // past it. In the flow: the settled box the header and body lay out in, whatever size the+ // outer box is passing through.+ const boxStyle: CSSProperties =+ lifted && box !== null+ ? {+ top: box.top,+ left: box.left,+ width: box.width,+ height: box.height,+ zIndex: DOCK_FULLSCREEN_Z,+ }+ : position === "bottom"+ ? { height: contentSize }+ : { width: contentSize };+ const boxClass = lifted+ ? "fixed overflow-hidden bg-canvas"+ : position === "bottom"+ ? "flex min-h-0 shrink-0 flex-col"+ : "flex min-h-0 flex-1 flex-col";++ // The inside: lifted, laid out once at the size the box is heading to and anchored to the+ // box's top and to the edge the docked and the host rect share — the right dock's right, the+ // bottom dock's left — so the header rides the top edge and nothing reflows while the box+ // moves. In the flow, it fills the content box.+ const insideStyle: CSSProperties | undefined =+ lifted && inner !== null ? { width: inner.width, height: inner.height } : undefined;+ const insideClass = lifted+ ? `absolute top-0 ${position === "right" ? "right-0" : "left-0"} flex flex-col`+ : "flex min-h-0 flex-1 flex-col";++ const content = (+ <div+ ref={boxRef}+ data-layout-motion={moving ? "" : undefined}+ style={boxStyle}+ className={boxClass}+ >+ <div style={insideStyle} className={insideClass}>+ {header}+ {children}+ </div>+ </div>+ );+if (position === "bottom") {return (<div@@ -118,17 +554,15 @@ export function DockFrame({data-position="bottom"data-open={open}data-layout-motion={animate ? "" : undefined}+ data-fullscreen={lifted ? phase : undefined}style={{ height: size }}inert={!open}className={`relative flex w-full shrink-0 flex-col overflow-hidden bg-canvas ${open ? "border-t border-line" : ""}`}>- {open && handle}- <div style={{ height: contentSize }} className="flex min-h-0 shrink-0 flex-col">- {header}- {children}- </div>+ {seat}+ {content}{overlays}</div>);@@ -136,23 +570,22 @@ export function DockFrame({return (<>- {open && handle}+ {/* The spacer: `w-1.5` is RESIZE_HANDLE_PX, the width the handle costs the row. */}+ {seat !== null && <div className="flex w-1.5 shrink-0">{seat}</div>}<divref={rootRef}data-testid="dock"data-position="right"data-open={open}data-layout-motion={animate ? "" : undefined}+ data-fullscreen={lifted ? phase : undefined}style={{ width: size }}inert={!open}className={`relative flex min-h-0 shrink-0 flex-col overflow-hidden bg-canvas ${open ? "border-l border-line" : ""}`}>- <div style={{ width: contentSize }} className="flex min-h-0 flex-1 flex-col">- {header}- {children}- </div>+ {content}{overlays}</div></>diff --git a/packages/ui/src/testing/deslop.ts b/packages/ui/src/testing/deslop.tsindex 66627582..fcd1d49d 100644--- a/packages/ui/src/testing/deslop.ts+++ b/packages/ui/src/testing/deslop.ts@@ -82,9 +82,10 @@ export interface DeslopPolicy {/** Rule 1: files that may transition a transform — the chevron, the sheet, launcher and drawer motion. */readonly transformMotion: readonly string[];/**- * Rule 1: files that may transition a size — the one `data-layout-motion` rule in the theme- * foundation, which moves a sidebar's width or a disclosure's grid rows on the theme's layout- * tokens. A component never transitions geometry itself; it sets the attribute.+ * Rule 1: files that may transition a size or a place — the one `data-layout-motion` rule in+ * the theme foundation, which moves a sidebar's width, a disclosure's grid rows or a lifted dock+ * surface's insets on the theme's layout tokens. A component never transitions geometry itself;+ * it sets the attribute.*/readonly layoutMotion?: readonly string[];/** Rule 3: keyframe-driven entrances that may run 300 ms or longer. */@@ -585,9 +586,14 @@ const TRANSITION_PROPERTIES = new Set(),);const TRANSFORM_PROPERTIES = new Set(["transform", "translate", "scale", "rotate"]);-/** Rule 1: the sizes the layout-motion rule may transition, and nothing else may. */+/**+ * Rule 1: the geometry the layout-motion rule may transition, and nothing else may — the sizes,+ * and the two insets a fixed box moves through when a dock surface lifts off the page column.+ */const LAYOUT_PROPERTIES = new Set(- "width height min-width max-width flex-basis grid-template-rows grid-template-columns".split(" "),+ "width height min-width max-width flex-basis grid-template-rows grid-template-columns top left".split(+ " ",+ ),);/** Rule 12: the steps a gap, a stack or an all-sides padding may take. */diff --git a/packages/ui/src/theme.css b/packages/ui/src/theme.cssindex f26d7178..08bf93c2 100644--- a/packages/ui/src/theme.css+++ b/packages/ui/src/theme.css@@ -256,7 +256,8 @@* - `data-reveal`: content that just appeared inside a settled surface — a streamed chunk of* text, a new tool row — fades (and de-blurs) in once; put it on the appended element only.* - `data-layout-motion`: an element whose size changes between states, the sidebar's width or a- * disclosure's `grid-template-rows: 0fr ↔ 1fr`; the theme sets the duration and the curve.+ * disclosure's `grid-template-rows: 0fr ↔ 1fr` — or whose place does, a dock surface lifting+ * off the page column to cover it (`top`, `left`); the theme sets the duration and the curve.** The presence keyframes move the element through the individual `translate` and `scale`* properties, never `transform`, so a layer that positions itself with a `transform` keeps it@@ -343,7 +344,8 @@[data-layout-motion] {transition-property:- width, height, min-width, max-width, flex-basis, grid-template-rows, grid-template-columns;+ width, height, min-width, max-width, flex-basis, grid-template-rows, grid-template-columns,+ top, left;transition-duration: var(--ui-dur-layout);transition-timing-function: var(--ui-ease-layout);}diff --git a/packages/ui/test/dock-frame.test.ts b/packages/ui/test/dock-frame.test.tsindex edbc6b57..9e988ef1 100644--- a/packages/ui/test/dock-frame.test.ts+++ b/packages/ui/test/dock-frame.test.ts@@ -49,10 +49,12 @@ describe("DockFrame", () => {expect(html).toContain("BODY");});- it("puts the right dock's handle before the dock, where it costs real width", () => {+ it("puts the right dock's handle before the dock, in a spacer that costs real width", () => {const html = render({ position: "right", size: 360, contentSize: 360 });+ // The spacer holds the row's width for the handle; the seat between them is+ // `display: contents` in the flow, so the handle lays out in the spacer as before.expect(html).toMatch(- /^<div data-testid="handle"><\/div><div data-testid="dock" data-position="right"/,+ /^<div class="flex w-1\.5 shrink-0"><div class="contents"><div data-testid="handle"><\/div><\/div><\/div><div data-testid="dock" data-position="right"/,);expect(html).toContain('style="width:360px"');expect(classTokens(html)).toEqual(diff --git a/packages/web/e2e/dock.spec.mjs b/packages/web/e2e/dock.spec.mjsindex 7fd69920..a7f045d9 100644--- a/packages/web/e2e/dock.spec.mjs+++ b/packages/web/e2e/dock.spec.mjs@@ -11,6 +11,9 @@* puts the dock away;* - a whole dock moves to the other edge via its header button, a single tab via drag* onto the drop targets;+ * - full screen is a dock at its largest below the toolbar (the right dock over its row, the+ * bottom dock up to the toolbar; its box stays in the flow), entered by its header toggle or a+ * drag past the max and left the same ways; a dock it covers coming on stage ends it;* - the arrangement is PER CONVERSATION (each one manages its own tabs, browser-window* style) and survives a reload; the bottom dock's height ratio is a global preference;* - a new shell starts in the conversation's Workspace, not the home directory;@@ -216,6 +219,91 @@ test("two toolbar toggles: an opened empty dock shows the picker; hiding keeps tawait expect(page.getByTestId("dock-toggle-right")).toHaveAttribute("aria-expanded", "false");});+test("full screen is a dock at its largest below the toolbar — by its button or a drag past the max", async ({+ page,+}) => {+ await provisionAndLogin(page.request, U, P);+ const projectId = await configureProjectModel(page.request);+ await killAllTerminals(page.request);+ const sessionId = await createSession(page.request, projectId);+ await page.goto(`${BASE}/chat/${sessionId}`);+ await page.getByPlaceholder(/输入消息/).waitFor();++ await openViaPicker(page, "right", "trace");+ const right = dockAt(page, "right");+ await expect(right.locator('[data-tab-id="trace"][data-active="true"]')).toBeVisible();+ // The composer measures the conversation column; wait out the dock's expand transition.+ const composer = page.getByPlaceholder(/输入消息/);+ let settled = null;+ await expect+ .poll(async () => {+ const box = await composer.boundingBox();+ const same = settled !== null && box !== null && box.width === settled.width;+ settled = box;+ return same;+ })+ .toBe(true);+ const rowBox = () => page.locator("[data-dock-row]").boundingBox();+ const headerBox = (dock) => dock.getByTestId("dock-header").boundingBox();++ // The header button: the right dock covers its own row — the conversation column — while the+ // toolbar with the title and the statistics stays, and nothing under the cover reflowed.+ await right.getByTestId("dock-fullscreen").click();+ await expect(right).toHaveAttribute("data-fullscreen", "full");+ let row = await rowBox();+ let header = await headerBox(right);+ expect(Math.round(header.x)).toBe(Math.round(row.x));+ expect(Math.round(header.y)).toBe(Math.round(row.y));+ expect(Math.round(header.width)).toBe(Math.round(row.width));+ await expect(page.getByRole("heading", { level: 1 })).toBeVisible();+ await expect(page.getByTestId("dock-toggle-right")).toBeVisible();+ await expect(page.getByTestId("dock-fullscreen-exit")).toHaveCount(0);+ expect((await composer.boundingBox()).width).toBe(settled.width);++ // The bottom dock is not under the cover, so bringing it forward leaves the right one full.+ await page.keyboard.press("Control+Alt+3");+ const bottom = dockAt(page, "bottom");+ await expect(bottom).toBeVisible();+ await bottom.getByTestId("dock-pick-memory").click();+ await expect(bottom.locator('[data-tab-id="memory"][data-active="true"]')).toBeVisible();+ await expect(right).toHaveAttribute("data-fullscreen", "full");++ // The header button leaves in place.+ await right.getByTestId("dock-fullscreen").click();+ await expect(right).not.toHaveAttribute("data-fullscreen");++ // Dragging the right boundary well past the widest it may be snaps into full screen ...+ const handle = page.locator('[data-testid="dock-resizer"][aria-orientation="vertical"]:visible');+ let hb = await handle.boundingBox();+ row = await rowBox();+ await page.mouse.move(hb.x + hb.width / 2, hb.y + hb.height / 2);+ await page.mouse.down();+ await page.mouse.move(row.x + 40, hb.y + hb.height / 2, { steps: 12 });+ await page.mouse.up();+ await expect(right).toHaveAttribute("data-fullscreen", "full");+ // ... and dragging the surface's leading edge back snaps out.+ hb = await handle.boundingBox();+ await page.mouse.move(hb.x + hb.width / 2, hb.y + hb.height / 2);+ await page.mouse.down();+ await page.mouse.move(hb.x + 300, hb.y + hb.height / 2, { steps: 12 });+ await page.mouse.up();+ await expect(right).not.toHaveAttribute("data-fullscreen");++ // A full-screen bottom dock grows up to the toolbar, over the row and the right dock with it;+ // the right dock coming back on stage, from under the cover, ends it.+ await bottom.getByTestId("dock-fullscreen").click();+ await expect(bottom).toHaveAttribute("data-fullscreen", "full");+ row = await rowBox();+ header = await headerBox(bottom);+ expect(Math.round(header.y)).toBe(Math.round(row.y));+ expect(Math.round(header.x)).toBe(Math.round(row.x));+ await page.getByTestId("dock-toggle-right").click(); // hides the covered right dock: still full+ await expect(bottom).toHaveAttribute("data-fullscreen", "full");+ await page.getByTestId("dock-toggle-right").click(); // brings it back on stage: full ends+ await expect(dockAt(page, "right")).toBeVisible();+ await expect(bottom).not.toHaveAttribute("data-fullscreen");+});+test("tabs of every kind share a dock: switch, close a panel tab, terminals numbered", async ({page,}) => {diff --git a/packages/web/src/features/builtin-browser/browser-layer.tsx b/packages/web/src/features/builtin-browser/browser-layer.tsxindex 65937ff4..80c53f39 100644--- a/packages/web/src/features/builtin-browser/browser-layer.tsx+++ b/packages/web/src/features/builtin-browser/browser-layer.tsx@@ -11,7 +11,10 @@* page parks off-screen at a real size, so a page an agent works in while the dock is closed* keeps a desktop layout. While a browser panel is on screen a frame loop follows its slot,* because the dock resizes, slides and moves with the layout around it and nothing announces- * all of those.+ * all of those. The pages have no stacking order of their own, except while the slot sits in a+ * dock surface gone fullscreen: that surface paints on a layer above the page, so the page on+ * screen (and the agent ring over it) steps up one layer with it — for as long as the surface is+ * lifted, its enter and exit animations included — and back down once it is back in the flow.** It also runs the lifecycle the server asks for over the user channel: `builtin_browser_open`* creates a page; as soon as the page's element knows its webContents id, the id claims the@@ -38,7 +41,7 @@ import {} from "react";import type { CSSProperties } from "react";import type { BuiltinBrowserLoadWarning } from "@lmliheng/penguin-server/api";-import { toastAttention } from "@lmliheng/penguin-ui";+import { DOCK_FULLSCREEN_Z, toastAttention } from "@lmliheng/penguin-ui";import { toneInk } from "../../lib/tone";import { currentDockScope, isTabShown, openPanel } from "../dock/dock-state";import { isBlankUrl } from "./address";@@ -113,6 +116,8 @@ interface PageHost {view: WebviewElement | null;/** What was last written to the two boxes; a frame that computes the same writes nothing. */applied: Placement | undefined;+ /** Whether the frame was last written onto the layer above a fullscreen dock surface. */+ lifted: boolean;/** The size it parks at: the size it was last shown at, or the default. */parkSize: Size;}@@ -123,12 +128,23 @@ const hosts = new Map<string, PageHost>();function hostFor(key: string): PageHost {let host = hosts.get(key);if (host === undefined) {- host = { frame: null, view: null, applied: undefined, parkSize: DEFAULT_PARK_SIZE };+ host = {+ frame: null,+ view: null,+ applied: undefined,+ lifted: false,+ parkSize: DEFAULT_PARK_SIZE,+ };hosts.set(key, host);}return host;}+/** The layer a page or the ring paints on: the step above a fullscreen dock surface, or none. */+function layerFor(lifted: boolean): string {+ return lifted ? String(DOCK_FULLSCREEN_Z + 1) : "";+}+function toRect(box: DOMRect): Rect {return { left: box.left, top: box.top, width: box.width, height: box.height };}@@ -144,8 +160,11 @@ function writeRect(style: CSSStyleDeclaration, rect: Rect): void {* Lays every hosted page out for this frame: the active tab over the visible slot, unless its* page is blank or crashed (the panel's own surface shows then: the blank state, or the crash* with its Reload), and everything else parked. The ring, when mounted, frames the visible slot.- * The server hears which tab is on screen, none while the window is hidden: that tab runs at full- * speed, and the parked ones may be throttled.+ * A page shown over a slot inside a fullscreen dock surface steps up to the layer above that+ * surface, and so does the ring; a parked page, or one over an ordinary slot, has no layer of its+ * own (a fullscreen surface covering the OTHER dock then covers it, as it should). The server+ * hears which tab is on screen, none while the window is hidden: that tab runs at full speed, and+ * the parked ones may be throttled.*/function placePages(ring: HTMLDivElement | null): void {const state = browserState();@@ -165,16 +184,20 @@ function placePages(ring: HTMLDivElement | null): void {tab !== null &&tab.crashed === undefined &&!(isBlankUrl(tab.url) && !tab.loading);+ const lifted = showPage && slot !== null && slot.lifted;reportOnScreenTab(showPage && tab !== null && document.visibilityState !== "hidden" ? tab.id : null,);for (const guest of state.guests) {const host = hosts.get(guest.key);if (host === undefined || host.frame === null || host.view === null) continue;- const placement =- showPage && onScreen !== null && guest.tabId !== null && guest.tabId === state.activeTabId- ? onScreen- : parkedPlacement(host.parkSize);+ const shown =+ showPage && onScreen !== null && guest.tabId !== null && guest.tabId === state.activeTabId;+ const placement = shown ? onScreen : parkedPlacement(host.parkSize);+ if ((shown && lifted) !== host.lifted) {+ host.lifted = shown && lifted;+ host.frame.style.zIndex = layerFor(host.lifted);+ }host.parkSize = shownSize(placement) ?? host.parkSize;if (samePlacement(host.applied, placement)) continue;writeRect(host.frame.style, placement.frame);@@ -184,6 +207,7 @@ function placePages(ring: HTMLDivElement | null): void {if (ring !== null) {if (onScreen !== null && onScreen.shown) {ring.style.display = "";+ ring.style.zIndex = layerFor(lifted);writeRect(ring.style, onScreen.frame);} else {ring.style.display = "none";@@ -318,6 +342,13 @@ function LayerHost() {};}, [available]);+ // A dock surface lifting off to cover the page, or returning, is the one change to the boxes+ // around a slot while it stays mounted: the dock's content box becomes fixed (its placeholder+ // stops clipping it) and the page must step above the surface's layer. Both are cached per slot+ // (slot-registry.ts), and the dock drops the caches itself at each step of its fullscreen phase,+ // once the step is in the DOM — not the store's flag, which flips before the exit animation has+ // run and says nothing when it ends; the frame loop below reads them afresh on its next tick.+// After every render: a new page gets its boxes, and a switched tab moves at once.useLayoutEffect(() => placePages(ringRef.current));diff --git a/packages/web/src/features/builtin-browser/slot-registry.ts b/packages/web/src/features/builtin-browser/slot-registry.tsindex 2f4b29b6..5cf7f30d 100644--- a/packages/web/src/features/builtin-browser/slot-registry.ts+++ b/packages/web/src/features/builtin-browser/slot-registry.ts@@ -4,15 +4,29 @@* Every mounted browser panel registers its slot element; the one on screen says so. More* than one can be mounted at a time — a tab moving between docks keeps the old dock's copy* mounted through its collapse — so the most recently shown slot wins.+ *+ * With the slot comes what the layer needs to place a page over it: the ancestors that clip it,+ * and whether it sits inside a fullscreen dock surface, in which case the page must float above+ * the surface's layer rather than under it. Both are read from the DOM once per slot and cached;+ * the one thing that changes them while a slot stays mounted is the surface lifting off to cover+ * the page or returning (the dock's content box becomes `fixed` and its placeholder stops+ * clipping it), and the dock drops the caches at each step of that flip (`invalidateSlotClips`).*/+interface SlotGeometry {+ /** Ancestors that clip the slot, innermost first. */+ clips: HTMLElement[];+ /** The slot is inside a fullscreen dock surface: its page paints above the surface's layer. */+ lifted: boolean;+}+interface SlotEntry {element: HTMLElement;visible: boolean;/** When it last became visible: the tiebreak between two visible slots. */shownAt: number;- /** Ancestors that clip it, found on first use (the chain does not change while mounted). */- clips: HTMLElement[] | null;+ /** Read from the DOM on first use; dropped when the fullscreen state flips. */+ geometry: SlotGeometry | null;}const slots = new Map<symbol, SlotEntry>();@@ -39,7 +53,7 @@ export function slotsVersion(): number {/** Registers a slot; the returned function withdraws it. */export function registerSlot(id: symbol, element: HTMLElement): () => void {- slots.set(id, { element, visible: false, shownAt: 0, clips: null });+ slots.set(id, { element, visible: false, shownAt: 0, geometry: null });notify();return () => {slots.delete(id);@@ -64,23 +78,57 @@ export function hasVisibleSlot(): boolean {return false;}-/** Every ancestor whose overflow clips its content — what can hide part of a slot from view. */+/**+ * Drops every slot's cached clip chain and lift flag, to be re-read from the DOM on next use.+ * Called by the dock surface after the DOM has changed around the slots — at each step of its+ * fullscreen phase (lifting, full, returning, back in the flow), once that step has been+ * committed: the attribute and the fixed box exist only from the commit on, and the box stays+ * lifted, and clipping, through the whole exit animation — a read at the store's flip, or one+ * cached from before it, would place the page against the wrong boxes.+ */+export function invalidateSlotClips(): void {+ for (const entry of slots.values()) entry.geometry = null;+}++/**+ * Every ancestor whose overflow clips its content — what can hide part of a slot from view. The+ * walk stops at the nearest `fixed` ancestor (after checking it): a fixed box is laid out against+ * the window, and the boxes above it clip nothing of it — the app shell has no transforms or+ * filters, which would make one of them its containing block instead. That is what lets a+ * fullscreen dock's page escape the dock's placeholder, which clips at the old panel size.+ */function clippingAncestors(element: HTMLElement): HTMLElement[] {const found: HTMLElement[] = [];for (let node = element.parentElement; node !== null; node = node.parentElement) {const style = getComputedStyle(node);if (style.overflowX !== "visible" || style.overflowY !== "visible") found.push(node);+ if (style.position === "fixed") break;}return found;}-/** The slot on screen, with the ancestors that clip it; null when no browser panel is showing. */-export function visibleSlot(): { element: HTMLElement; clips: HTMLElement[] } | null {+function readGeometry(element: HTMLElement): SlotGeometry {+ return {+ clips: clippingAncestors(element),+ lifted: element.closest("[data-fullscreen]") !== null,+ };+}++/** The slot on screen, with what the layer needs to place a page over it. */+export interface VisibleSlot extends SlotGeometry {+ element: HTMLElement;+}++/**+ * The slot on screen, with the ancestors that clip it and whether its page must float above the+ * fullscreen layer; null when no browser panel is showing.+ */+export function visibleSlot(): VisibleSlot | null {let best: SlotEntry | null = null;for (const entry of slots.values()) {if (entry.visible && (best === null || entry.shownAt > best.shownAt)) best = entry;}if (best === null) return null;- best.clips ??= clippingAncestors(best.element);- return { element: best.element, clips: best.clips };+ best.geometry ??= readGeometry(best.element);+ return { element: best.element, clips: best.geometry.clips, lifted: best.geometry.lifted };}diff --git a/packages/web/src/features/chat/builtin-dock-panels.tsx b/packages/web/src/features/chat/builtin-dock-panels.tsxnew file mode 100644index 00000000..ea482da0--- /dev/null+++ b/packages/web/src/features/chat/builtin-dock-panels.tsx@@ -0,0 +1,244 @@+/**+ * The built-in dock panels as registry definitions: the conversation's views (subagents,+ * Files, Memory, Trace, messaging, schedules) and the built-in browser. A definition names its+ * panel once — the label and glyph every surface that lists panels reads — and carries the+ * tab's body. The conversation's bodies read the chat page's state through useChatDock (the+ * page provides it around both docks); the browser needs none of it.+ *+ * Importing the module registers the seven — chat-page.tsx does, so they are in the registry+ * before any dock renders.+ */+import { EmptyState, ICONS } from "@lmliheng/penguin-ui";+import { S } from "../../lib/strings";+import { NAV_ICONS } from "../../lib/nav-icons";+import { dockPanelDefinition, panelLabel, registerDockPanel } from "../dock/panel-registry";+import type { DockPanelBodyProps, DockPanelDefinition, PanelId } from "../dock/panel-registry";+import { isBrowserOffered, subscribeBrowser } from "../builtin-browser/browser-store";+import { BuiltinBrowserPanel } from "../builtin-browser/browser-panel";+import { TracePanel } from "../traces/trace-panel";+import { MessagingPanel } from "../messaging/messaging-panel";+import { SchedulePanel } from "../schedules/schedule-panel";+import { approvalModeChoices } from "./approval-mode";+import { useChatDock } from "./chat-dock-context";+import { ChatMemoryView } from "./memory-view";+import { SubagentsView } from "./subagents-view";+import { WorkspaceBrowser } from "./workspace-browser";++/**+ * What a conversation's tab shows on the draft page, before the first send creates the+ * Session it would show.+ */+function draftPlaceholder(id: PanelId) {+ return (+ <EmptyState+ title={panelLabel(id)}+ // The schedules tab says what the first message unlocks; the other tabs share one line.+ description={id === "schedules" ? S.schedule.panelDraftEmpty : S.dock.draftEmpty}+ />+ );+}++// The conversation's bodies. Keyed by Session where the view starts over per conversation+// (agents / memory / trace / messaging / schedules); the Workspace browser instead re-binds+// through its props — its own handled-once request guard is what the conversation-switch e2e+// covers.++function AgentsPanelBody() {+ const {+ selected,+ panelModel,+ stream,+ ctx,+ subagentFocus,+ subagentTaskScope,+ models,+ onChangeApprovalMode,+ onChangeSandbox,+ modeSaving,+ parentThinkingLevel,+ } = useChatDock();+ if (!selected) return draftPlaceholder("agents");+ return (+ <SubagentsView+ key={selected.sessionId}+ session={selected}+ // The merged view (backfilled windows included): a chip on an older turn keeps+ // its historical graph and child conversation reachable after pagination.+ model={panelModel}+ version={stream.version}+ taskRunning={stream.taskState !== "idle"}+ ctx={ctx}+ focusRequest={subagentFocus}+ taskScope={subagentTaskScope}+ subagents={stream.subagents}+ models={models?.models ?? []}+ approvalMode={selected.approvalMode}+ approvalModes={approvalModeChoices(selected.client, selected.approvalMode)}+ onChangeApprovalMode={onChangeApprovalMode}+ onChangeSandbox={onChangeSandbox}+ modeSaving={modeSaving}+ parentThinkingLevel={parentThinkingLevel}+ />+ );+}++function WorkspacePanelBody({ active }: DockPanelBodyProps) {+ const {+ selected,+ draft,+ draftWorkspace,+ projectId,+ fileOpenRequest,+ settledTurnSignal,+ addComposerReference,+ } = useChatDock();+ // The draft's Files panel browses the folder picked in the composer, addressed by the+ // directory itself; a temporary Workspace has none yet.+ if (!selected && draft && projectId) {+ return draftWorkspace !== null ? (+ <WorkspaceBrowser+ scope={{+ kind: "workspace",+ projectId,+ workspace: draftWorkspace.path,+ machineId: draftWorkspace.machineId,+ }}+ active={active}+ onAddReference={addComposerReference}+ />+ ) : (+ <EmptyState title={panelLabel("workspace")} description={S.files.draftTemporary} />+ );+ }+ if (!selected) return draftPlaceholder("workspace");+ return (+ <WorkspaceBrowser+ scope={{ kind: "session", sessionId: selected.sessionId }}+ openRequest={fileOpenRequest}+ active={active}+ reloadSignal={settledTurnSignal}+ onAddReference={addComposerReference}+ />+ );+}++function MemoryPanelBody({ active }: DockPanelBodyProps) {+ const { selected, sessionMemoryChanges, memoryListing, memoryRequest, openMemorySettings } =+ useChatDock();+ if (!selected) return draftPlaceholder("memory");+ return (+ <ChatMemoryView+ key={selected.sessionId}+ session={selected}+ changes={sessionMemoryChanges}+ scopes={memoryListing.scopes}+ listingError={memoryListing.error}+ request={memoryRequest}+ active={active}+ // Management (add / edit / delete) lives on the agent-settings memory tab.+ onOpenSettings={() => openMemorySettings(selected.agentId)}+ />+ );+}++function TracePanelBody({ active }: DockPanelBodyProps) {+ const { selected, settledTurnSignal } = useChatDock();+ if (!selected) return draftPlaceholder("trace");+ return (+ <TracePanel+ key={selected.sessionId}+ session={selected}+ active={active}+ reloadSignal={settledTurnSignal}+ />+ );+}++function MessagingPanelBody({ active }: DockPanelBodyProps) {+ const { selected } = useChatDock();+ if (!selected) return draftPlaceholder("messaging");+ return <MessagingPanel key={selected.sessionId} sessionId={selected.sessionId} active={active} />;+}++function SchedulesPanelBody({ active }: DockPanelBodyProps) {+ const { selected, prefillComposer } = useChatDock();+ if (!selected) return draftPlaceholder("schedules");+ return (+ <SchedulePanel+ key={selected.sessionId}+ session={selected}+ active={active}+ onPrefillComposer={prefillComposer}+ />+ );+}++const BUILTIN_DOCK_PANELS: readonly DockPanelDefinition[] = [+ {+ id: "agents",+ label: () => S.chat.openAgents,+ glyph: ICONS.robotPair,+ order: 10,+ Body: AgentsPanelBody,+ },+ {+ id: "workspace",+ label: () => S.chat.workspacePanel,+ glyph: ICONS.folder,+ order: 20,+ Body: WorkspacePanelBody,+ },+ {+ id: "memory",+ label: () => S.chat.memoryViewTitle,+ glyph: ICONS.brain,+ order: 30,+ Body: MemoryPanelBody,+ },+ {+ id: "trace",+ label: () => S.nav.traces,+ glyph: NAV_ICONS.traces,+ order: 40,+ Body: TracePanelBody,+ },+ {+ id: "messaging",+ label: () => S.messaging.panelTitle,+ glyph: ICONS.paperPlane,+ order: 50,+ Body: MessagingPanelBody,+ },+ {+ id: "schedules",+ label: () => S.schedule.panelTitle,+ glyph: ICONS.alarmClock,+ order: 60,+ Body: SchedulesPanelBody,+ },+ // The browser is one set of pages shared by every conversation, not a Session's view, so it+ // needs no Session and works on the draft page too. It exists only where this window can+ // host it and the server can drive it (the desktop app).+ {+ id: "builtin-browser",+ label: () => S.builtinBrowser.panelTitle,+ glyph: ICONS.globe,+ order: 70,+ offered: isBrowserOffered,+ subscribeOffered: subscribeBrowser,+ Body: BuiltinBrowserPanel,+ },+];++/**+ * Registers the built-in panels. Idempotent: a kind already registered with its very+ * definition is left alone, so a repeated call changes nothing and wakes no listener, while a+ * kind missing from the registry comes back.+ */+export function registerBuiltinDockPanels(): void {+ for (const definition of BUILTIN_DOCK_PANELS) {+ if (dockPanelDefinition(definition.id) !== definition) registerDockPanel(definition);+ }+}++registerBuiltinDockPanels();diff --git a/packages/web/src/features/chat/chat-dock-context.tsx b/packages/web/src/features/chat/chat-dock-context.tsxnew file mode 100644index 00000000..94677d2a--- /dev/null+++ b/packages/web/src/features/chat/chat-dock-context.tsx@@ -0,0 +1,91 @@+/**+ * What the chat page hands its dock panels. A dock renders every panel the same way — the+ * registered Body with its `active` flag and nothing else — but the built-in bodies+ * (builtin-dock-panels.tsx) show the conversation on screen, and that state is the page's:+ * the selected Session, the stream, the jump commands the transcript issues, and the+ * composer's entry points. The page provides it once around both docks; a body reads it with+ * useChatDock.+ */+import { createContext, useContext } from "react";+import type { ReactNode } from "react";+import type {+ ApprovalMode,+ ModelsResponse,+ SessionInfo,+ SessionSandbox,+} from "@lmliheng/penguin-server/api";+import type { StreamModel } from "../../lib/omni/stream-model";+import type { MemoryChangeRow, MemoryLocateTarget } from "../../lib/omni/memory-changes";+import type { ComposerReference } from "../../lib/workspace-tree";+import type { StreamRenderContext } from "./message-stream";+import type { SessionStreamState } from "./use-session-stream";+import type { useMemoryListing } from "./use-memory-listing";++export interface ChatDockState {+ /** The conversation on screen; null on the draft page and while none is selected (yet). */+ selected: SessionInfo | null;+ /** The new-chat draft (`/chat/new`) or a parked draft is on screen. */+ draft: boolean;+ /**+ * The folder the draft has picked, and its machine — what the Files panel browses while+ * there is no Session to address it by. Null for a temporary Workspace.+ */+ draftWorkspace: { path: string; machineId: string | null } | null;+ projectId: string | null;+ /** The subagents panel's model view: the live model with the backfilled windows merged in. */+ panelModel: StreamModel;+ /** The stream's repaint signal, its run state and the runtime's live subagent children. */+ stream: Pick<SessionStreamState, "version" | "taskState" | "subagents">;+ /** The main conversation's render context (origin []); a child conversation derives its own. */+ ctx: StreamRenderContext;+ /** Jump command: select this child conversation in the agents tab. */+ subagentFocus: { sessionId: string; origin: string[] } | null;+ /** The Task the agents tab shows: null = the latest; an anchor pins the one with that child. */+ subagentTaskScope: { anchorSessionId: string } | null;+ models: ModelsResponse | null;+ onChangeApprovalMode: (mode: ApprovalMode) => void;+ onChangeSandbox: (pick: Partial<SessionSandbox>) => void;+ /** An approval-mode or sandbox save is in flight. */+ modeSaving: boolean;+ /** The Session's effective thinking level ("" = unknown): a child composer's display fallback. */+ parentThinkingLevel: string;+ /** Jump command: locate this Workspace file in the Files tab. */+ fileOpenRequest: { path: string } | null;+ /** Bumped every time a Task settles on this Session: "re-read" for the Files and Trace tabs. */+ settledTurnSignal: number;+ /** Stages a file, a directory or a quoted range in this conversation's composer as a chip. */+ addComposerReference: (reference: ComposerReference) => void;+ /** This conversation's memory changes, the same array while their content is unchanged. */+ sessionMemoryChanges: MemoryChangeRow[];+ /** The Agent's memory listing, shared with the memory-changes card's deleted-row marking. */+ memoryListing: ReturnType<typeof useMemoryListing>;+ /** Jump command: land the Memory tab on this memory's detail, or on the list (null target). */+ memoryRequest: { target: MemoryLocateTarget | null } | null;+ /** Opens this Agent's settings on the memory tab, where add / edit / delete live. */+ openMemorySettings: (agentId: string) => void;+ /** Writes a prompt into this conversation's composer and stops there: nothing is sent. */+ prefillComposer: (text: string) => void;+}++const ChatDockContext = createContext<ChatDockState | null>(null);++/**+ * Provides the chat page's dock state to the panel bodies below it. A context provider adds+ * no element, so it can span the chat row and the bottom dock after it without touching the+ * layout.+ */+export function ChatDockProvider({+ value,+ children,+}: {+ value: ChatDockState;+ children: ReactNode;+}) {+ return <ChatDockContext.Provider value={value}>{children}</ChatDockContext.Provider>;+}++export function useChatDock(): ChatDockState {+ const ctx = useContext(ChatDockContext);+ if (!ctx) throw new Error("useChatDock must be used within a ChatDockProvider");+ return ctx;+}diff --git a/packages/web/src/features/chat/chat-page.tsx b/packages/web/src/features/chat/chat-page.tsxindex d20a45a7..30c915cd 100644--- a/packages/web/src/features/chat/chat-page.tsx+++ b/packages/web/src/features/chat/chat-page.tsx@@ -4,12 +4,12 @@* popup) + the message stream and input area (input box vertically centered when there* are no messages), with the dock surfaces beside and below (features/dock): every side* element — subagents, Workspace files, Memory, Trace, terminals — is a tab in the right- * or bottom dock, arranged by the user and persisted globally. This page contributes the- * panel BODIES (they need its session/stream state) through DockPanel's renderPanel, and- * the stream's jump commands: a message file card, or a reply's link to a Workspace file,- * opens the Workspace tab on that file (onOpenFile), a subagent chip opens the agents tab- * focused (onOpenSubagent), a memory-change row opens the Memory tab located- * (onLocateMemoryChange).+ * or bottom dock, arranged by the user and persisted globally. The panel BODIES are registry+ * definitions (builtin-dock-panels.tsx); this page provides the session/stream state they read+ * around both docks (chat-dock-context.tsx), and the stream's jump commands: a message file+ * card, or a reply's link to a Workspace file, opens the Workspace tab on that file+ * (onOpenFile), a subagent chip opens the agents tab focused (onOpenSubagent), a memory-change+ * row opens the Memory tab located (onLocateMemoryChange).* Approval mode and Model/context usage live in the input area's toolbar; context is compacted* via the /compact slash command.* Draft state (/chat/new) is carried by DraftView: Agent / Workspace / approval mode / Model are@@ -134,20 +134,16 @@ import { sessionModelPickerDisabled, sessionRowStale, switchContextShape } fromimport type { SwitchContextShape } from "./model-switch";import { hasConfiguredKey, promotedPricing, sameModelRef } from "../models/model-grouping";import { providerInfo } from "@lmliheng/penguin-core/model-catalog";-import { WorkspaceBrowser } from "./workspace-browser";-import { ChatMemoryView } from "./memory-view";import { useMemoryListing } from "./use-memory-listing";import { deletedChangeKeys } from "./memory-nav";-import { SubagentsView } from "./subagents-view";-import { TracePanel } from "../traces/trace-panel";-import { MessagingPanel } from "../messaging/messaging-panel";-import { SchedulePanel } from "../schedules/schedule-panel";import { noteScheduleEvent } from "../schedules/schedule-store";import { DockPanel } from "../dock/dock-panel";import { DockLauncher } from "../dock/dock-launcher";-import { BuiltinBrowserPanel } from "../builtin-browser/browser-panel";import { useDockMount } from "../dock/use-dock-mount";-import { panelLabel } from "../dock/panel-meta";+// importing it registers the built-in panels (their definitions and bodies) with the dock+import "./builtin-dock-panels";+import { ChatDockProvider } from "./chat-dock-context";+import type { ChatDockState } from "./chat-dock-context";// importing it also registers the global Ctrl+` hotkey with the app bundleimport { setDockCwd } from "../dock/dock-terminal";import {@@ -159,7 +155,6 @@ import {openPanel,panelDock,subscribeDock,- type PanelKind,} from "../dock/dock-state";import { terminalApiSupported, subscribeTerminals } from "../terminal/terminal-list";import { advancePanelTaskScope, createPanelTaskScope } from "./panel-task-scope";@@ -1961,112 +1956,42 @@ export function ChatPage() {);const terminalSupported = terminalApiSupported();+ // The Memory panel's way to its management: add / edit / delete live on the Agent's+ // settings page, on the memory tab.+ const openMemorySettings = useCallback(+ (memoryAgentId: string) => navigate(`/agents/${memoryAgentId}?tab=memory`),+ [navigate],+ );/**- * The panel tabs' bodies. Keyed by Session where the view starts over per conversation- * (agents / memory / trace); the Workspace browser instead re-binds through its props —- * its own handled-once request guard is what the conversation-switch e2e covers.+ * What the dock panel bodies read off this page (builtin-dock-panels.tsx), provided around+ * both docks below. Not memoised: `ctx` is rebuilt on every render and the stream fields+ * move with every version, so a memo would miss every time; the bodies re-render with the+ * page, exactly as they did when the page built them inline. The callbacks in it are the+ * page's own memoised ones, passed as they are, never wrapped afresh.*/- const renderPanel = (kind: PanelKind, active: boolean): ReactNode => {- // The browser is one set of pages shared by every conversation, not a Session's view,- // so it needs no Session and works on the draft page too.- if (kind === "builtin-browser") return <BuiltinBrowserPanel active={active} />;- // The draft's Files panel browses the folder picked in the composer, addressed by the- // directory itself; a temporary Workspace has none yet.- if (!selected && draft && kind === "workspace" && projectId) {- return draftWorkspace !== null ? (- <WorkspaceBrowser- scope={{- kind: "workspace",- projectId,- workspace: draftWorkspace.path,- machineId: draftWorkspace.machineId,- }}- active={active}- onAddReference={addComposerReference}- />- ) : (- <EmptyState title={panelLabel(kind)} description={S.files.draftTemporary} />- );- }- if (!selected)- return (- <EmptyState- title={panelLabel(kind)}- // The schedules tab says what the first message unlocks; the other tabs share one line.- description={kind === "schedules" ? S.schedule.panelDraftEmpty : S.dock.draftEmpty}- />- );- switch (kind) {- case "agents":- return (- <SubagentsView- key={selected.sessionId}- session={selected}- // The merged view (backfilled windows included): a chip on an older turn keeps- // its historical graph and child conversation reachable after pagination.- model={panelModel}- version={stream.version}- taskRunning={stream.taskState !== "idle"}- ctx={ctx}- focusRequest={subagentFocus}- taskScope={subagentTaskScope}- subagents={stream.subagents}- models={models?.models ?? []}- approvalMode={selected.approvalMode}- approvalModes={approvalModeChoices(selected.client, selected.approvalMode)}- onChangeApprovalMode={onChangeApprovalMode}- onChangeSandbox={onChangeSandbox}- modeSaving={modeSaving}- parentThinkingLevel={sessionThinkingLevel(turnThinkingLevel, agentThinkingLevel)}- />- );- case "workspace":- return (- <WorkspaceBrowser- scope={{ kind: "session", sessionId: selected.sessionId }}- openRequest={fileOpenRequest}- active={active}- reloadSignal={settledTurnSignal}- onAddReference={addComposerReference}- />- );- case "memory":- return (- <ChatMemoryView- key={selected.sessionId}- session={selected}- changes={sessionMemoryChanges}- scopes={memoryListing.scopes}- listingError={memoryListing.error}- request={memoryRequest}- active={active}- // Management (add / edit / delete) lives on the agent-settings memory tab.- onOpenSettings={() => navigate(`/agents/${selected.agentId}?tab=memory`)}- />- );- case "trace":- return (- <TracePanel- key={selected.sessionId}- session={selected}- active={active}- reloadSignal={settledTurnSignal}- />- );- case "messaging":- return (- <MessagingPanel key={selected.sessionId} sessionId={selected.sessionId} active={active} />- );- case "schedules":- return (- <SchedulePanel- key={selected.sessionId}- session={selected}- active={active}- onPrefillComposer={prefillComposer}- />- );- }+ const chatDock: ChatDockState = {+ selected,+ draft,+ draftWorkspace,+ projectId,+ panelModel,+ stream,+ ctx,+ subagentFocus,+ subagentTaskScope,+ models,+ onChangeApprovalMode,+ onChangeSandbox,+ modeSaving,+ parentThinkingLevel: sessionThinkingLevel(turnThinkingLevel, agentThinkingLevel),+ fileOpenRequest,+ settledTurnSignal,+ addComposerReference,+ sessionMemoryChanges,+ memoryListing,+ memoryRequest,+ openMemorySettings,+ prefillComposer,};if (!projectId || !agentId) {@@ -2542,168 +2467,176 @@ export function ChatPage() {</div>)}- {/* Body: chat column + the right dock on this row (below the toolbar — a dock- beside the whole page would squeeze the header), with the bottom dock after the- row spanning the full page width. data-dock-row is what the drag preview- measures for a right landing. */}- <div data-dock-row className="flex min-h-0 flex-1">- {/* The chat area, and the only region a dragged file may be dropped on (#311): it- covers the conversation and the composer in both branches below, and nothing else- — the sidebar, the mobile top bar, the toolbar above and the docked panels beside- it (terminal panes included) are all outside, where a file drop is inert (see- drop-zone.tsx). `relative` bounds the drop overlay to this column. */}- <ChatDropRegion className="relative flex min-h-0 min-w-0 flex-1 flex-col">- {draft ? (- // Draft state: DraftView's vertically centered input card + Agent / Workspace- // selection panel; the Session is only created once the first message is sent. Keyed- // by Project (switching Project remounts onto that Project's draft cache) and by the- // parked-draft id — falling back to location.key for `/chat/new`, so clicking "New- // chat" while already on the draft page (which just parked the typed text) remounts- // onto the freshly cleared cache. (Agent selection happens inside the draft itself,- // so it's not part of the key.)- <DraftView- key={`draft:${projectId}:${parkedDraftId ?? location.key}`}- projectId={projectId}- models={models}- {...(parkedDraftId !== null ? { draftId: parkedDraftId } : {})}- composerRef={composerRef}- onWorkspaceChange={onDraftWorkspace}- />- ) : (- // Keyed by Session: the whole block does a light fade-in when switching sessions.- <div- key={selected?.sessionId ?? "empty"}- className="anim-fade flex min-h-0 flex-1 flex-col"- >- {selected ? (- stream.error ? (- // History failed to load: show a clear error and a retry entry point, instead of staying on a misleading empty state.- <div className="flex h-full flex-col items-center justify-center gap-3 p-6">- <p className="text-sm text-red-600 dark:text-red-400">- {S.chat.historyLoadFailed}:{stream.error}- </p>- <Button onClick={stream.retry}>{S.common.retry}</Button>- </div>- ) : stream.loading ? (- <div className="space-y-3 p-6">- <Skeleton className="h-5 w-1/3" />- <Skeleton className="h-5 w-2/3" />- <Skeleton className="h-5 w-1/2" />- </div>- ) : (- // The empty state shares the same structure as the message stream (message- // area + bottom input area): only the message area's content differs, and- // ChatInput always mounts in the same JSX slot, so it isn't unmounted and- // recreated when the first message arrives (preserving draft/focus).- <>- {/* `relative`: the floating dock launcher below anchors to this body —- the region between the toolbar and the composer — so clamping to- it keeps the launcher off both. */}- <div className="relative min-h-0 flex-1">- {emptyChat ? (- <div className="flex h-full items-center justify-center px-4">- <p className="text-lg font-medium text-gray-400 dark:text-gray-500">- {S.chat.emptyGreeting}- </p>- </div>- ) : (- <MessageStream- items={allItems}- version={stream.version}- ctx={ctx}- scrollElRef={streamScrollRef}- // The selection menu's "Add to conversation": the excerpt is staged- // in this composer as a chip, the same way the Files panel stages a- // quoted range.- onAddExcerpt={addComposerReference}- // Scroll-up backfill of older history windows (tail-first- // loading): near-top scrolling prepends the previous window,- // scroll position anchored (see MessageStream).- older={{- hasMore: stream.older.hasMore,- loading: stream.older.loading,- error: stream.older.error,- prependedCount: stream.prefixItems.length,- onLoad: stream.loadOlder,- }}- // Tick-rail minimap over the stream's left gutter (zero layout- // width; hides itself when the gutter is too narrow or the- // pointer can't hover).- outline={- <ConversationOutline- entries={outline}- turnOffset={stream.outlineOffset}+ {/* The state the dock panels' bodies read (chat-dock-context.tsx): one provider over+ the row's right dock and the bottom dock after it — a provider adds no element. */}+ <ChatDockProvider value={chatDock}>+ {/* data-dock-area: the row and the bottom dock together — what a fullscreen bottom dock+ (or the narrow merged view) grows to cover, up to the toolbar; a fullscreen right+ dock covers the row alone. Layout-neutral: it takes the column's remaining height+ exactly as the row and the dock did when they sat in the column themselves. */}+ <div data-dock-area className="flex min-h-0 flex-1 flex-col">+ {/* Body: chat column + the right dock on this row (below the toolbar — a dock+ beside the whole page would squeeze the header), with the bottom dock after the+ row spanning the full page width. data-dock-row is what the drag preview+ measures for a right landing. */}+ <div data-dock-row className="flex min-h-0 flex-1">+ {/* The chat area, and the only region a dragged file may be dropped on (#311): it+ covers the conversation and the composer in both branches below, and nothing else+ — the sidebar, the mobile top bar, the toolbar above and the docked panels beside+ it (terminal panes included) are all outside, where a file drop is inert (see+ drop-zone.tsx). `relative` bounds the drop overlay to this column. */}+ <ChatDropRegion className="relative flex min-h-0 min-w-0 flex-1 flex-col">+ {draft ? (+ // Draft state: DraftView's vertically centered input card + Agent / Workspace+ // selection panel; the Session is only created once the first message is sent. Keyed+ // by Project (switching Project remounts onto that Project's draft cache) and by the+ // parked-draft id — falling back to location.key for `/chat/new`, so clicking "New+ // chat" while already on the draft page (which just parked the typed text) remounts+ // onto the freshly cleared cache. (Agent selection happens inside the draft itself,+ // so it's not part of the key.)+ <DraftView+ key={`draft:${projectId}:${parkedDraftId ?? location.key}`}+ projectId={projectId}+ models={models}+ {...(parkedDraftId !== null ? { draftId: parkedDraftId } : {})}+ composerRef={composerRef}+ onWorkspaceChange={onDraftWorkspace}+ />+ ) : (+ // Keyed by Session: the whole block does a light fade-in when switching sessions.+ <div+ key={selected?.sessionId ?? "empty"}+ className="anim-fade flex min-h-0 flex-1 flex-col"+ >+ {selected ? (+ stream.error ? (+ // History failed to load: show a clear error and a retry entry point, instead of staying on a misleading empty state.+ <div className="flex h-full flex-col items-center justify-center gap-3 p-6">+ <p className="text-sm text-red-600 dark:text-red-400">+ {S.chat.historyLoadFailed}:{stream.error}+ </p>+ <Button onClick={stream.retry}>{S.common.retry}</Button>+ </div>+ ) : stream.loading ? (+ <div className="space-y-3 p-6">+ <Skeleton className="h-5 w-1/3" />+ <Skeleton className="h-5 w-2/3" />+ <Skeleton className="h-5 w-1/2" />+ </div>+ ) : (+ // The empty state shares the same structure as the message stream (message+ // area + bottom input area): only the message area's content differs, and+ // ChatInput always mounts in the same JSX slot, so it isn't unmounted and+ // recreated when the first message arrives (preserving draft/focus).+ <>+ {/* `relative`: the floating dock launcher below anchors to this body —+ the region between the toolbar and the composer — so clamping to+ it keeps the launcher off both. */}+ <div className="relative min-h-0 flex-1">+ {emptyChat ? (+ <div className="flex h-full items-center justify-center px-4">+ <p className="text-lg font-medium text-gray-400 dark:text-gray-500">+ {S.chat.emptyGreeting}+ </p>+ </div>+ ) : (+ <MessageStream+ items={allItems}version={stream.version}- scrollRef={streamScrollRef}- running={stream.taskState !== "idle"}- fit={railFit}+ ctx={ctx}+ scrollElRef={streamScrollRef}+ // The selection menu's "Add to conversation": the excerpt is staged+ // in this composer as a chip, the same way the Files panel stages a+ // quoted range.+ onAddExcerpt={addComposerReference}+ // Scroll-up backfill of older history windows (tail-first+ // loading): near-top scrolling prepends the previous window,+ // scroll position anchored (see MessageStream).+ older={{+ hasMore: stream.older.hasMore,+ loading: stream.older.loading,+ error: stream.older.error,+ prependedCount: stream.prefixItems.length,+ onLoad: stream.loadOlder,+ }}+ // Tick-rail minimap over the stream's left gutter (zero layout+ // width; hides itself when the gutter is too narrow or the+ // pointer can't hover).+ outline={+ <ConversationOutline+ entries={outline}+ turnOffset={stream.outlineOffset}+ version={stream.version}+ scrollRef={streamScrollRef}+ running={stream.taskState !== "idle"}+ fit={railFit}+ />+ }/>- }- />- )}- {/* The right dock's floating launcher: rides this body's right edge- while that dock is hidden, and opens its panels in one click. */}- <DockLauncher agentsPending={anySubagentPending} />- </div>- <div className="shrink-0 border-t border-gray-200 bg-canvas px-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] pt-3 md:pb-3 dark:border-gray-800">- <div className="mx-auto max-w-3xl">- {/* Goal banner docked above the composer: an in-flight goal's progress- (restored on load while still active), or the terminal state reached- during this page's lifetime. The stop button is the composer's- regular stop (one abort ends the whole goal loop). */}- {stream.goal && <GoalStatusBanner goal={stream.goal} />}- {input}- </div>+ )}+ {/* The right dock's floating launcher: rides this body's right edge+ while that dock is hidden, and opens its panels in one click. */}+ <DockLauncher agentsPending={anySubagentPending} />+ </div>+ <div className="shrink-0 border-t border-gray-200 bg-canvas px-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] pt-3 md:pb-3 dark:border-gray-800">+ <div className="mx-auto max-w-3xl">+ {/* Goal banner docked above the composer: an in-flight goal's progress+ (restored on load while still active), or the terminal state reached+ during this page's lifetime. The stop button is the composer's+ regular stop (one abort ends the whole goal loop). */}+ {stream.goal && <GoalStatusBanner goal={stream.goal} />}+ {input}+ </div>+ </div>+ </>+ )+ ) : routeSessionOffline ? (+ <EmptyState+ title={+ routeSessionOwner === null+ ? S.chat.sessionOnOfflineMachineUnknown+ : S.chat.sessionOnOfflineMachine(+ machineLabels.get(routeSessionOwner) ?? routeSessionOwner,+ )+ }+ description={S.chat.sessionOfflineHint}+ />+ ) : sessionsLoading || routeSessionPending ? (+ <div className="space-y-3 p-6">+ <Skeleton className="h-5 w-1/2" /></div>- </>- )- ) : routeSessionOffline ? (- <EmptyState- title={- routeSessionOwner === null- ? S.chat.sessionOnOfflineMachineUnknown- : S.chat.sessionOnOfflineMachine(- machineLabels.get(routeSessionOwner) ?? routeSessionOwner,- )- }- description={S.chat.sessionOfflineHint}- />- ) : sessionsLoading || routeSessionPending ? (- <div className="space-y-3 p-6">- <Skeleton className="h-5 w-1/2" />+ ) : (+ <EmptyState+ title={S.chat.noSessions}+ action={<Button onClick={newChat}>{S.nav.newChat}</Button>}+ />+ )}</div>- ) : (- <EmptyState- title={S.chat.noSessions}- action={<Button onClick={newChat}>{S.nav.newChat}</Button>}- />)}- </div>- )}- </ChatDropRegion>-- {rightMount.view && (- <DockPanel- view={rightMount.view}- open={rightMount.open}- animateEntrance={rightMount.animateEntrance}- renderPanel={renderPanel}- panelBadges={{ agents: anySubagentPending }}- terminalSupported={terminalSupported}- />- )}- </div>+ </ChatDropRegion>++ {rightMount.view && (+ <DockPanel+ view={rightMount.view}+ open={rightMount.open}+ animateEntrance={rightMount.animateEntrance}+ panelBadges={{ agents: anySubagentPending }}+ terminalSupported={terminalSupported}+ />+ )}+ </div>- {bottomMount.view && (- <DockPanel- view={bottomMount.view}- open={bottomMount.open}- animateEntrance={bottomMount.animateEntrance}- renderPanel={renderPanel}- panelBadges={{ agents: anySubagentPending }}- terminalSupported={terminalSupported}- />- )}+ {bottomMount.view && (+ <DockPanel+ view={bottomMount.view}+ open={bottomMount.open}+ animateEntrance={bottomMount.animateEntrance}+ panelBadges={{ agents: anySubagentPending }}+ terminalSupported={terminalSupported}+ />+ )}+ </div>+ </ChatDockProvider><Modalopen={credentialGuide}diff --git a/packages/web/src/features/dock/dock-launcher.tsx b/packages/web/src/features/dock/dock-launcher.tsxindex 271158c7..34fca2a7 100644--- a/packages/web/src/features/dock/dock-launcher.tsx+++ b/packages/web/src/features/dock/dock-launcher.tsx@@ -2,8 +2,8 @@* The floating launcher for the workbench — an AssistiveTouch-style ball floating clear of* the chat body's right edge while no dock surface is up, so the dock's panels stay* discoverable for a user who never notices the toolbar's toggle. The ball carries a short- * caption, and a click fans out one round button per panel kind (plus the terminal) onto a- * tight ring centred on it and opening leftward. The entries are glyphs alone; the caption+ * caption, and a click fans out one round button per panel the registry offers here (plus the+ * terminal) onto a tight ring centred on it and opening leftward. The entries are glyphs alone; the caption* under the ball is where their names are read — it shows the hovered or focused entry's* name — because seven name pills floating around the ball is what pushed the ring far* enough out to stop reading as one object. The ball is that readout's other half: it draws@@ -56,17 +56,9 @@ import { S } from "../../lib/strings";import { NAV_ICONS } from "../../lib/nav-icons";import { toneInk } from "../../lib/tone";import { subscribeTerminals, terminalApiSupported } from "../terminal/terminal-list";-import { isBrowserOffered, subscribeBrowser } from "../builtin-browser/browser-store";import { openTerminalInDock } from "./dock-terminal";-import { panelGlyph, panelLabel } from "./panel-meta";-import {- PANEL_KINDS,- dockVersion,- isDockVisible,- isNarrow,- openPanel,- subscribeDock,-} from "./dock-state";+import { useDockPanels } from "./panel-registry";+import { dockVersion, isDockVisible, isNarrow, openPanel, subscribeDock } from "./dock-state";import {FAN_ENTRY_SIZE,LAUNCHER_CAPTION_HEIGHT,@@ -108,7 +100,6 @@ export function DockLauncher({ agentsPending }: DockLauncherProps) {useSyncExternalStore(subscribeDock, dockVersion);useSyncExternalStore(subscribeLauncherHidden, launcherHiddenVersion);const terminalSupported = useSyncExternalStore(subscribeTerminals, terminalApiSupported);- const browserOffered = useSyncExternalStore(subscribeBrowser, isBrowserOffered);const narrow = isNarrow();const visible = shouldShowLauncher({rightDockVisible: isDockVisible("right"),@@ -121,7 +112,6 @@ export function DockLauncher({ agentsPending }: DockLauncherProps) {<FloatingLauncheragentsPending={agentsPending}terminalSupported={terminalSupported}- browserOffered={browserOffered}narrow={narrow}/>);@@ -148,16 +138,16 @@ interface FanEntry {function FloatingLauncher({agentsPending,terminalSupported,- browserOffered,narrow,}: {agentsPending: boolean;terminalSupported: boolean;- /** The built-in browser can be shown (the desktop app's own window, with a shell that hosts it). */- browserOffered: boolean;/** Below the breakpoint the docks merge, so an entry names no dock and lets the store pick. */narrow: boolean;}) {+ // The panels offered here, in registry order (the built-in browser only in the desktop app's+ // own window): one fan entry each.+ const panels = useDockPanels();const reducedMotion = usePrefersReducedMotion();const reducedMotionRef = useRef(reducedMotion);reducedMotionRef.current = reducedMotion;@@ -414,15 +404,14 @@ function FloatingLauncher({// render as one merged surface, so it names none and the store lands the tab where the// toolbar's own panel buttons land it.const target = narrow ? undefined : "right";- const kinds = PANEL_KINDS.filter((kind) => kind !== "builtin-browser" || browserOffered);- const entries: FanEntry[] = kinds.map((kind) => ({- key: kind,- label: panelLabel(kind),- glyphAt: (size) => panelGlyph(kind, size),- badge: kind === "agents" && agentsPending,- testId: `dock-launcher-open-${kind}`,+ const entries: FanEntry[] = panels.map((definition) => ({+ key: definition.id,+ label: definition.label(),+ glyphAt: (size) => <GlyphIcon d={definition.glyph} size={size} />,+ badge: definition.id === "agents" && agentsPending,+ testId: `dock-launcher-open-${definition.id}`,// The dock becomes visible with the tab, and the launcher unmounts with it.- choose: () => openPanel(kind, target),+ choose: () => openPanel(definition.id, target),}));if (terminalSupported) {entries.push({diff --git a/packages/web/src/features/dock/dock-panel.tsx b/packages/web/src/features/dock/dock-panel.tsxindex 3635aec5..252b1cf7 100644--- a/packages/web/src/features/dock/dock-panel.tsx+++ b/packages/web/src/features/dock/dock-panel.tsx@@ -5,10 +5,13 @@* bottom — or a single merged bottom surface below the desktop breakpoint.** The drawing is the UI package's (`DockFrame`, `DockTabs`, `DockPicker`); this container- * binds it to the dock store, the terminal list and the page's panel bodies.+ * binds it to the dock store, the terminal list and the panel registry.*- * Panel tabs' bodies come from the page through `renderPanel` (they need the page's- * session/stream state); terminal tabs' bodies are the pooled xterm views+ * Panel tabs' bodies are the registry's (panel-registry.ts: the page registers one definition+ * per panel, body included, and this surface never names a panel itself), each wrapped in the+ * provider that tells it about its own tab (panel-context.tsx). A tab whose id has no definition+ * registered — a plugin's panel before the plugin loads — shows a placeholder saying so and keeps+ * its × until the definition arrives. Terminal tabs' bodies are the pooled xterm views* (terminal-view-pool.tsx), adopted by DOM handoff so tab churn never reconnects a shell.* Every tab's body stays mounted while its tab is in the strip — switching tabs hides and* shows, and so does hiding the whole dock (which renders at zero size rather than@@ -18,23 +21,38 @@** The header carries the strip, a "+" menu (panels, a fresh shell, and any live shell no* conversation holds), a detach button while a terminal is shown, a move-to-other-edge- * button, and the dock's × (hide — tabs and everything their bodies hold stay; each tab's- * own always-visible × is what removes). Tabs drag sideways to reorder; dragging a tab out- * of the strip brings up the edge overlay (dock-drag.tsx) and dropping on the other edge- * moves that tab there.- * Dragging the header itself moves the whole dock the same way. The boundary with the- * chat content resizes the dock — the right dock through the shared side-panel width,- * the bottom dock through its height ratio.+ * button, a fullscreen toggle, and the dock's × (hide — tabs and everything their bodies hold+ * stay; each tab's own always-visible × is what removes). Tabs drag sideways to reorder;+ * dragging a tab out of the strip brings up the edge overlay (dock-drag.tsx) and dropping on+ * the other edge moves that tab there. Dragging the header itself moves the whole dock the same+ * way. The boundary with the chat content resizes the dock — the right dock through the shared+ * side-panel width, the bottom dock through its height ratio.+ *+ * FULLSCREEN is the surface grown as far as its own edge goes, the toolbar above it staying in+ * view: the right dock covers its row — the conversation beside it, with the bottom dock still+ * showing below — and the bottom dock (or the narrow merged view) climbs to the toolbar, over the+ * row and the right dock in it (the store says which surface, if any; the frame draws it, keeping+ * the dock's own box in the flow so nothing underneath reflows, and animates the flip with the+ * theme's layout motion). The strip, the "+" menu and the detach button keep working; what has no+ * meaning for a surface grown past its edge is put away — the move button, the header drag,+ * dragging a tab out to the other edge. The boundary drag is how the flip happens by gesture:+ * pulled past the dock's maximum size by a small slack, the dock snaps to fullscreen and the drag+ * is over; while fullscreen the handle sits on the cover's leading edge, and a pull back inward+ * past the slack (or a double click) snaps it back to its stored size. The header's toggle (now+ * corners in) is the other way back, and the store drops fullscreen by itself when the surface+ * stops qualifying (hidden, emptied, or a dock it covers brought forward). Esc is left alone: the+ * terminal, the editor and web pages each own it.*/import {useCallback,useEffect,useLayoutEffect,+ useMemo,useRef,useState,useSyncExternalStore,} from "react";-import type { ReactNode } from "react";+import { flushSync } from "react-dom";import {CloseIcon,ConfirmModal,@@ -43,6 +61,7 @@ import {DockPicker,DockTabs,Dropdown,+ EmptyState,GlyphIcon,ICONS,ICON_SIZE,@@ -72,19 +91,23 @@ import {subscribeTerminalCloseRequests,} from "../terminal/terminal-view-pool";import type { TerminalInfo } from "../terminal/terminal-view";-import { isBrowserOffered, subscribeBrowser } from "../builtin-browser/browser-store";+import { invalidateSlotClips } from "../builtin-browser/slot-registry";import { confirmClose } from "./close-guard";import { createShellInDock, detachTerminal, openTerminalInDock } from "./dock-terminal";import { DockDragOverlay, dockDropCandidate } from "./dock-drag";-import { panelGlyph, panelGlyphPath, panelLabel } from "./panel-meta";+import { DockPanelProvider } from "./panel-context";+import type { DockPanelHandle } from "./panel-context";+import { panelGlyph, panelLabel } from "./panel-meta";+import { dockPanelDefinition, useDockPanels } from "./panel-registry";+import type { DockPanelDefinition, PanelId } from "./panel-registry";import {DOCK_MIN_HEIGHT_PX,DOCK_RATIO_MAX,- PANEL_KINDS,activateTab,addTerminalTab,bottomRatio,dockVersion,+ fullscreenDock,hideView,moveDock,moveTab,@@ -93,6 +116,7 @@ import {reorderDock,resetBottomRatio,setBottomRatio,+ setDockFullscreen,subscribeDock,tabHome,tabKey,@@ -100,9 +124,9 @@ import {type DockPosition,type DockTab,type DockView,- type PanelKind,} from "./dock-state";import {+ maxWidthFor,persistPanelWidth,resetPanelWidth,setPanelWidth,@@ -110,16 +134,20 @@ import {} from "../chat/use-panel-width";/**- * The picker's order after the agents, the terminal and the built-in browser (each shown only- * where it can run): the rest of the panels.+ * The picker's leading rows, each shown only where the registry offers it: the agents, then the+ * terminal between them, then the built-in browser — what a conversation most often opens. Every+ * other offered panel follows in registry order, which is where a plugin's panel lands.*/-const PICKER_PANELS: readonly PanelKind[] = [- "workspace",- "memory",- "trace",- "messaging",- "schedules",-];+const PICKER_LEAD: readonly PanelId[] = ["agents", "builtin-browser"];++/**+ * How far past the dock's maximum size a boundary drag pulls before the dock snaps to fullscreen,+ * and how far back inward from the cover's leading edge a drag pulls before it snaps out, in px.+ * Enough that a drag meant to stop at the maximum never tips over (the size clamps there and the+ * pointer habitually overshoots by a little), small enough that the snap feels like the next+ * notch rather than a separate journey.+ */+const FULLSCREEN_SNAP_PX = 40;/*** A terminal tab's body: adopts the shown terminal's pooled container. Only while shown —@@ -156,6 +184,62 @@ function TerminalBody({ id, active }: { id: string; active: boolean }) {);}+/**+ * A panel tab's body: the registry's component for its id, inside the provider that tells the+ * body about its own tab. An id with no definition registered (a plugin's tab stored before the+ * plugin loads, or after it was removed) shows a placeholder that says so and keeps the tab+ * closable from the strip; the body appears the moment the definition is registered, since the+ * dock re-renders on registration.+ */+function PanelBody({+ id,+ position,+ merged,+ active,+ fullscreen,+}: {+ id: PanelId;+ position: DockPosition;+ merged: boolean;+ active: boolean;+ fullscreen: boolean;+}) {+ const handle = useMemo<DockPanelHandle>(+ () => ({+ id,+ position,+ merged,+ active,+ fullscreen,+ // Only this surface's own fullscreen is this body's to end: a body in the other dock+ // asking for "off" must not cancel a fullscreen it is no part of.+ setFullscreen: (on) => {+ if (on) setDockFullscreen(position);+ else if (fullscreenDock() === position) setDockFullscreen(null);+ },+ // The tab's × path: a close guard the body registered (unsaved text) asks first.+ close: () => {+ void confirmClose([id]).then((ok) => {+ if (ok) removeTab(id);+ });+ },+ }),+ [id, position, merged, active, fullscreen],+ );+ const Body = dockPanelDefinition(id)?.Body;+ return (+ <DockPanelProvider handle={handle}>+ {Body !== undefined ? (+ <Body active={active} />+ ) : (+ <div className="flex h-full min-h-0 items-center justify-center overflow-y-auto p-4">+ <EmptyState title={S.dock.panelUnavailable} />+ </div>+ )}+ </DockPanelProvider>+ );+}+/** The strip label of a terminal tab: stable seq + live title, like a tmux status line. */function terminalLabel(info: TerminalInfo | undefined, id: string, ordinal: number): string {if (!info) return `${ordinal}: ${id.slice(0, 6)}`;@@ -164,10 +248,8 @@ function terminalLabel(info: TerminalInfo | undefined, id: string, ordinal: numbexport interface DockPanelProps {view: DockView;- /** The page's panel bodies (they need its session/stream state); null hides that kind from the add menu too. */- renderPanel: (kind: PanelKind, active: boolean) => ReactNode;- /** Attention dots per panel kind (the agents tab's pending-approval amber dot). */- panelBadges?: Partial<Record<PanelKind, boolean>>;+ /** Attention dots per panel id (the agents tab's pending-approval amber dot). */+ panelBadges?: Partial<Record<PanelId, boolean>>;/** Whether the server serves the terminal API at all (an older runtime does not). */terminalSupported: boolean;/** False only while the dock collapses on its way out (use-dock-mount keeps it mounted). */@@ -178,7 +260,6 @@ export interface DockPanelProps {export function DockPanel({view,- renderPanel,panelBadges,terminalSupported,open = true,@@ -188,7 +269,9 @@ export function DockPanel({const terminals = useSyncExternalStore(subscribeTerminals, liveTerminals);const closeShortcut = useShortcutLabel("terminal.close");const toggleChord = useDisplayedBinding("terminal.toggle");- const browserOffered = useSyncExternalStore(subscribeBrowser, isBrowserOffered);+ // The panels offered here, in registry order: what the "+" menu and the picker list, and+ // what re-renders the strip when a definition arrives for a tab it already shows.+ const offered = useDockPanels();const terminalById = new Map(terminals.map((t) => [t.id, t]));const { position, merged, tabs, activeKey } = view;const horizontal = position === "bottom";@@ -197,6 +280,10 @@ export function DockPanel({const activeTab = tabs.find((tab) => tabKey(tab) === activeKey) ?? null;+ // The store decides which surface (if any) is fullscreen; this one is it while it is open and+ // the store names its position (the merged view's is "bottom", like the bottom dock's).+ const fullscreen = open && fullscreenDock() === position;+// ---------------------------------------------------------------------------- selection// A terminal tab's × ends the shell itself (server-side) — an easy mis-click next to@@ -248,8 +335,12 @@ export function DockPanel({const headerDragProps = usePointerDrag<object>({begin: (event) =>- // The merged view spans both docks, so "move the dock" has no target of its own.- merged || (event.target as HTMLElement).closest("button, [data-testid='dock-tab']")+ // The merged view spans both docks, so "move the dock" has no target of its own; a+ // fullscreen surface is not moved either — it has grown past its edge, and the move+ // controls are put away with it.+ merged ||+ fullscreen ||+ (event.target as HTMLElement).closest("button, [data-testid='dock-tab']")? null: {},onMove: (event) =>@@ -287,8 +378,9 @@ export function DockPanel({if (!stripEl) return;// Out of the strip (with a little slack): the gesture becomes "move to the other// edge" — the same overlay as moving a dock, with the preview showing the landing.+ // Not while fullscreen, where the move controls are put away: the drag stays a reorder.const strip = stripEl.getBoundingClientRect();- if (event.clientY < strip.top - 20 || event.clientY > strip.bottom + 20) {+ if (!fullscreen && (event.clientY < strip.top - 20 || event.clientY > strip.bottom + 20)) {setTabDrag({ active: true, candidate: dockDropCandidate(event.clientX, event.clientY) });return;}@@ -333,25 +425,83 @@ export function DockPanel({// (it must cost real width), so the handle's events cannot `closest()` their way to the// dock — the ref is how both handles reach the box they resize.const rootRef = useRef<HTMLDivElement | null>(null);+ // Set by a snap into or out of fullscreen mid-drag: the rest of that gesture's moves change+ // nothing, and its release persists nothing — the snap already did what the drag was for.+ const snapped = useRef(false);- /** One move of a boundary drag: the pointer's position, as the dock's new size. */+ /**+ * The element a fullscreen surface covers — the dock grown as far as its own edge goes. The+ * right dock's is its row ([data-dock-row]: the conversation beside it, the toolbar above+ * untouched, the bottom dock still in view below). The bottom dock's, and the narrow merged+ * view's, is the area from the row's top to the page column's bottom ([data-dock-area]: the row+ * and itself, over the right dock). Read when the surface lifts and followed while it is full,+ * so the frame need not know the page; the snap below measures it too.+ */+ const coveredElement = () =>+ document.querySelector<HTMLElement>(horizontal ? "[data-dock-area]" : "[data-dock-row]");++ /**+ * A snap into or out of fullscreen ends the gesture: the drag's hold on the layout motion lifts+ * first, so the flip animates, and the pointer's remaining moves until its release change+ * nothing. One synchronous flush for both changes, because on their own they would reach the+ * screen in two renders in the wrong order — the store's change re-renders in React's sync lane+ * while a state set from a window listener waits for the continuous one — and the first of them+ * would paint the flip with the drag still counted as running, landing it without its motion.+ */+ const snapTo = (target: DockPosition | null): void => {+ snapped.current = true;+ flushSync(() => {+ setResizing(false);+ setDockFullscreen(target);+ });+ };++ /**+ * One move of a boundary drag: the pointer's position, as the dock's new size — and, past the+ * dock's maximum by the slack, the snap to fullscreen (the stored size stays at the maximum).+ * While fullscreen the handle sits on the cover's leading edge, and only a pull back inward past+ * the slack means anything: the snap out, to the stored size.+ */const resizeTo = (event: PointerEvent): void => {+ if (snapped.current) return;+ if (fullscreen) {+ const covered = coveredElement()?.getBoundingClientRect();+ if (!covered) return;+ const inward = horizontal ? event.clientY - covered.top : event.clientX - covered.left;+ if (inward > FULLSCREEN_SNAP_PX) snapTo(null);+ return;+ }const pane = rootRef.current?.getBoundingClientRect();if (!pane) return;+ // The picker (no tabs) never goes fullscreen — the store refuses it and the header offers no+ // button — so its drag simply stops at the maximum.+ const canSnap = tabs.length > 0;if (horizontal) {// The ratio's basis is the chat page column ([data-dock-host]), the same box the- // rendered height is computed from below.+ // rendered height is computed from below; the ratio clamps at its ceiling, which is the+ // maximum the snap measures against.const host = document.querySelector("[data-dock-host]")?.getBoundingClientRect();if (!host || host.height === 0) return;- setBottomRatio((pane.bottom - event.clientY) / host.height);+ const asked = pane.bottom - event.clientY;+ setBottomRatio(asked / host.height);+ if (canSnap && asked > DOCK_RATIO_MAX * host.height + FULLSCREEN_SNAP_PX) snapTo(position);} else {- setPanelWidth(pane.right - event.clientX);+ const asked = pane.right - event.clientX;+ setPanelWidth(asked); // clamps at the maximum+ if (canSnap && asked > maxWidthFor(window.innerWidth) + FULLSCREEN_SNAP_PX) {+ // The width is stored here, once, in place of the release that would have stored it.+ persistPanelWidth();+ snapTo(position);+ }}};const resizeEnd = (committed: boolean): void => {setResizing(false);- // Once per drag, not per frame; an abandoned drag stores nothing.- if (committed && !horizontal) persistPanelWidth();+ const snappedHere = snapped.current;+ snapped.current = false;+ // Once per drag, not per frame; an abandoned drag stores nothing, and a drag that snapped+ // stored its width at the snap.+ if (committed && !horizontal && !snappedHere) persistPanelWidth();};// The bottom dock's height in PIXELS: ratio × the measured chat column, with the same@@ -383,40 +533,40 @@ export function DockPanel({Math.min(DOCK_RATIO_MAX * hostHeight, Math.max(DOCK_MIN_HEIGHT_PX, bottomRatio() * hostHeight)),);- const onResizerDoubleClick = useCallback(- () => (horizontal ? resetBottomRatio() : resetPanelWidth()),- [horizontal],- );+ // A double click on the handle: back to the default size — or, on the cover's leading edge,+ // back out of fullscreen, which is what "back" means for a surface grown past every size.+ const onResizerDoubleClick = useCallback(() => {+ if (fullscreen) {+ setDockFullscreen(null);+ return;+ }+ if (horizontal) resetBottomRatio();+ else resetPanelWidth();+ }, [horizontal, fullscreen]);- // ------------------------------------------------------------------- touch height toggle+ // ------------------------------------------------------------------------------ fullscreen- // The bottom dock's height is set by dragging its top boundary — a 4px line, which is a- // mouse target and not a finger one. On touch the same two heights a user actually wants- // (as much as the dock can take, and back to where it was) get a button. The remembered- // height is per mount on purpose: the ratio itself is persisted, so a dock left maximised- // restores to the shared default rather than to a height from another session.+ // The header's button toggles in place (corners out ↔ corners in): a flip made there keeps the+ // focus where it is, and a quick second click lands on the same button rather than on whatever+ // slid into its slot. It is the explicit control; the boundary drag's snap (above) is the other,+ // and nothing floats over the surface as a way out. What the surface covers is coveredElement's.const coarsePointer = useCoarsePointer();- const restoreRatio = useRef<number | null>(null);- const maximized = bottomRatio() >= DOCK_RATIO_MAX;- const toggleMaximized = useCallback(() => {- if (bottomRatio() >= DOCK_RATIO_MAX) {- const previous = restoreRatio.current;- if (previous === null) resetBottomRatio();- else setBottomRatio(previous);- return;- }- restoreRatio.current = bottomRatio();- setBottomRatio(DOCK_RATIO_MAX);- }, []);+ const toggleFullscreen = () => setDockFullscreen(fullscreen ? null : position);+ // The built-in browser lays its page over the panel's slot by coordinates and caches, per slot,+ // which ancestors clip it and whether it sits in a lifted surface. The frame's phase — not the+ // store's flag — is what changes both: the box is lifted, and clipping, through its enter and+ // exit animations, and back in the flow only once the exit has ended. Each step drops the+ // caches once it is in the DOM; the layer's frame loop re-reads them on its next tick.+ const onFullscreenPhase = () => invalidateSlotClips();// ------------------------------------------------------------------------------ add menu- const openPanelHere = (kind: PanelKind): void => {+ const openPanelHere = (id: PanelId): void => {setAddOpen(false);// The merged view has no edge of its own to insist on — the panel's existing tab (or// the right-dock default) decides, which is also where it lands when the window// widens back out.- openPanel(kind, merged ? undefined : position);+ openPanel(id, merged ? undefined : position);};/** Live shells no conversation holds: offer to pull them into this dock. */@@ -441,13 +591,13 @@ export function DockPanel({}><Menu>- {PANEL_KINDS.filter((kind) => kind !== "builtin-browser" || browserOffered).map((kind) => (+ {offered.map((definition) => (<MenuItem- key={kind}- data-testid={`dock-add-${kind}`}- glyph={panelGlyphPath(kind)}- label={panelLabel(kind)}- onSelect={() => openPanelHere(kind)}+ key={definition.id}+ data-testid={`dock-add-${definition.id}`}+ glyph={definition.glyph}+ label={definition.label()}+ onSelect={() => openPanelHere(definition.id)}/>))}{terminalSupported && (@@ -548,8 +698,9 @@ export function DockPanel({};useEffect(() => subscribeTerminalCloseRequests((id) => closeRequest.current(id)), []);- // The strip's items: panel tabs by their panel's name and mark, terminal tabs by their- // shell's seq and title, closed by killing the shell.+ // The strip's items: panel tabs by their panel's name and mark (the registry's, or the id and+ // the puzzle piece while no definition is registered), terminal tabs by their shell's seq and+ // title, closed by killing the shell.const stripTabs: DockTabItem[] = tabs.map((tab) => {const key = tabKey(tab);if (tab.kind === "panel") {@@ -581,16 +732,19 @@ export function DockPanel({// An open dock with nothing in it yet: the picker chooses what this dock opens. The// terminal row adopts the newest shell no conversation holds, or starts a fresh one, and- // names its hotkey while one is bound; the built-in browser is offered only where it can- // be shown (the desktop app's own window, with a shell that hosts it).- const pickPanel = (kind: PanelKind): DockPickerChoice => ({- key: kind,- label: panelLabel(kind),- glyph: panelGlyph(kind),- onChoose: () => openPanel(kind, merged ? undefined : position),+ // names its hotkey while one is bound; every panel row is one the registry offers here (the+ // built-in browser only where it can be shown: the desktop app's own window).+ const pickPanel = (definition: DockPanelDefinition): DockPickerChoice => ({+ key: definition.id,+ label: definition.label(),+ glyph: <GlyphIcon d={definition.glyph} size={ICON_SIZE.iconButton} />,+ onChoose: () => openPanel(definition.id, merged ? undefined : position),});+ const leading = (id: PanelId) => offered.find((definition) => definition.id === id);+ const agents = leading("agents");+ const browser = leading("builtin-browser");const pickerChoices: DockPickerChoice[] = [- pickPanel("agents"),+ ...(agents !== undefined ? [pickPanel(agents)] : []),...(terminalSupported? [{@@ -602,8 +756,8 @@ export function DockPanel({},]: []),- ...(browserOffered ? [pickPanel("builtin-browser")] : []),- ...PICKER_PANELS.map(pickPanel),+ ...(browser !== undefined ? [pickPanel(browser)] : []),+ ...offered.filter((definition) => !PICKER_LEAD.includes(definition.id)).map(pickPanel),];const bodies =@@ -620,7 +774,13 @@ export function DockPanel({bodies gate their polling and their reload-on-return on this, and acollapsed dock should cost nothing while it is away. */}{tab.kind === "panel" ? (- renderPanel(tab.panel, active && open)+ <PanelBody+ id={tab.panel}+ position={position}+ merged={merged}+ active={active && open}+ fullscreen={fullscreen}+ />) : (<TerminalBody id={tab.terminalId} active={active && open} />)}@@ -648,8 +808,10 @@ export function DockPanel({);// The boundary handle: on the bottom dock an overlay straddling the top edge (it costs no- // height), on the right dock a layout sibling (it must cost real width). The store clamps- // the size a drag asks for.+ // height), on the right dock a layout sibling (it must cost real width); the frame seats it,+ // and moves the same element onto the cover's leading edge while the surface is fullscreen, so+ // a drag that snaps the surface in or out keeps its pointer and ends on the release as usual.+ // The store clamps the size a drag asks for.const handle = (<ResizeHandledata-testid="dock-resizer"@@ -675,7 +837,10 @@ export function DockPanel({animate={!resizing && !snap}rootRef={rootRef}headerProps={headerDragProps}- movable={!merged}+ movable={!merged && !fullscreen}+ fullscreen={fullscreen}+ fullscreenHost={coveredElement}+ onFullscreenPhase={onFullscreenPhase}tabs={// Drag sideways to reorder, drag out to move onto the other edge.<DockTabs@@ -701,7 +866,7 @@ export function DockPanel({</DockHeaderButton>)}{addMenu}- {!merged && tabs.length > 0 && (+ {!merged && !fullscreen && tabs.length > 0 && (<DockHeaderButtonlabel={position === "right" ? S.dock.moveToBottom : S.dock.moveToRight}coarse={coarsePointer}@@ -714,15 +879,17 @@ export function DockPanel({/></DockHeaderButton>)}- {horizontal && coarsePointer && tabs.length > 0 && (+ {/* Not in the picker state: with no tab there is nothing to show full screen. While+ fullscreen it stays where it was, as the one way back. */}+ {tabs.length > 0 && (<DockHeaderButton- label={maximized ? S.dock.restore : S.dock.maximize}- coarse- data-testid="dock-maximize"- onClick={toggleMaximized}+ label={fullscreen ? S.dock.exitFullscreen : S.dock.fullscreen}+ coarse={coarsePointer}+ data-testid="dock-fullscreen"+ onClick={toggleFullscreen}><GlyphIcon- d={maximized ? ICONS.cornersIn : ICONS.cornersOut}+ d={fullscreen ? ICONS.cornersIn : ICONS.cornersOut}size={ICON_SIZE.rowLead}/></DockHeaderButton>diff --git a/packages/web/src/features/dock/dock-state.ts b/packages/web/src/features/dock/dock-state.tsindex eb2b1dfc..af6c982d 100644--- a/packages/web/src/features/dock/dock-state.ts+++ b/packages/web/src/features/dock/dock-state.ts@@ -27,11 +27,26 @@* merged bottom surface (a 320px-minimum right panel does not fit a phone); the stored* arrangement splits back apart when the window widens.*+ * The store knows panels by id alone. What an id names — its label, its mark, its body — is+ * the panel registry's (panel-registry.ts), so a tab whose panel this build has never heard of+ * (a plugin's, stored before the plugin loads) is kept as it is and rendered as a placeholder+ * until its definition arrives; only a key that cannot be a panel id at all is dropped.+ *+ * One surface at a time can be FULLSCREEN — the dock grown as far as its own edge goes: the right+ * dock over its row (the conversation beside it, with the toolbar above and the bottom dock below+ * still in view), the bottom dock or the narrow merged view up to the toolbar (over the row, and+ * the right dock in it). That is the one piece of state here that is transient — in memory, never+ * stored, cleared by a scope switch and by the breakpoint flipping — and it holds only while its+ * surface is on screen with tabs and no dock it COVERS is brought forward (checked after every+ * mutation, in commit()): the right dock taking the stage under a fullscreen bottom dock drops+ * it, so what was asked for is seen rather than opening under the cover.+ ** A store (rather than component state) because the consumers live far apart: the chat* toolbar toggles the docks, the global hotkey flips the terminal, AppLayout points the* scope at the route's conversation, the chat page renders the docks, and the terminal* list prunes dead shells' tabs on refresh.*/+import type { PanelId } from "./panel-registry";const LAYOUT_KEY = "penguin.dock.layout";/** Scopes kept in storage; past that, the least recently touched conversations age out. */@@ -40,37 +55,37 @@ const MAX_SCOPES = 40;export type DockPosition = "right" | "bottom";/**- * The singleton panel kinds. Terminals are the one multi-instance tab kind. The built-in- * browser is one set of pages shared by every conversation, so each conversation's tab shows- * the same browser; it exists only in the desktop app, and the menus that offer panels ask- * features/builtin-browser whether to list it.+ * Panels are singletons — one tab per id within a conversation — and terminals are the one+ * multi-instance tab kind. Which panels exist, and whether one is offered here (the built-in+ * browser exists only in the desktop app), is the registry's business; the store only carries+ * their ids.*/-export type PanelKind =- "agents" | "workspace" | "memory" | "trace" | "messaging" | "schedules" | "builtin-browser";--export const PANEL_KINDS: readonly PanelKind[] = [- "agents",- "workspace",- "memory",- "trace",- "messaging",- "schedules",- "builtin-browser",-];--export type DockTab =- { kind: "panel"; panel: PanelKind } | { kind: "terminal"; terminalId: string };+export type { PanelId };++export type DockTab = { kind: "panel"; panel: PanelId } | { kind: "terminal"; terminalId: string };/** Stable identity of a tab ("agents", …, "terminal:<id>") — the stored form. */export function tabKey(tab: DockTab): string {return tab.kind === "panel" ? tab.panel : `terminal:${tab.terminalId}`;}+/**+ * The shape of a panel id: lowercase words joined by hyphens, with dots or slashes between+ * segments for a namespaced plugin panel ("acme.kanban", "acme/board"); the built-in ids all fit.+ * The store accepts any key of this shape without asking the registry, so a stored tab survives+ * its panel being unknown for a while.+ */+const PANEL_ID_PATTERN = /^[a-z][a-z0-9-]*(?:[./][a-z0-9-]+)*$/;+const PANEL_ID_MAX_LENGTH = 100;++export function isPanelId(key: string): boolean {+ return key.length <= PANEL_ID_MAX_LENGTH && PANEL_ID_PATTERN.test(key);+}+function parseTabKey(key: string): DockTab | null {- if ((PANEL_KINDS as readonly string[]).includes(key))- return { kind: "panel", panel: key as PanelKind };if (key.startsWith("terminal:") && key.length > "terminal:".length)return { kind: "terminal", terminalId: key.slice("terminal:".length) };+ if (isPanelId(key)) return { kind: "panel", panel: key };return null;}@@ -202,6 +217,12 @@ let scope = NO_SCOPE;// Unpacked into a local rather than read through `scopes[scope]` everywhere: the reads// are on every render path, and one live object per scope keeps switching cheap.let layout: ScopeLayout = scopes[scope] ?? emptyScope();+/**+ * The surface grown to its fullscreen cover, by the position it renders at ("bottom" for the+ * narrow merged view), or null. In memory only: a reload, a scope switch and the breakpoint+ * flipping all start in the normal layout. The rules live in the fullscreen section below.+ */+let fullscreen: DockPosition | null = null;/** Whether a scope's arrangement is worth a storage entry at all. */function scopeIsEmpty(s: ScopeLayout): boolean {@@ -249,6 +270,17 @@ function notify(): void {for (const listener of [...listeners]) listener();}+/**+ * The tail of every mutation: the layout reaches storage, the fullscreen state is checked+ * against what the mutation left on screen, and the listeners hear about it. One place, so no+ * action has to remember the check — a new action that ends in commit() is covered.+ */+function commit(): void {+ persist();+ reconcileFullscreen();+ notify();+}+/** Monotonic change counter — subscribe with this snapshot to re-render on ANY change. */export function dockVersion(): number {return version;@@ -321,6 +353,9 @@ function switchScope(target: string, mayHandOver: boolean): void {}scope = target;layout = scopes[scope] ?? emptyScope();+ // Fullscreen belongs to the moment, not to the conversation: a new scope starts in the+ // normal layout even when its own dock would have qualified, and coming back never restores it.+ fullscreen = null;notify();}@@ -351,6 +386,9 @@ if (typeof window !== "undefined" && typeof window.matchMedia === "function") {narrow = query.matches;query.addEventListener("change", (event) => {narrow = event.matches;+ // The surfaces are re-cut at the breakpoint (two docks ↔ one merged view), so the surface+ // that was fullscreen no longer exists as such; the user re-enters on the new one if wanted.+ fullscreen = null;notify();});}@@ -486,8 +524,7 @@ export function activateTab(key: string): void {const found = findTab(key);if (!found) return;activate(found.position, key);- persist();- notify();+ commit();}function insertTab(tab: DockTab, position: DockPosition): void {@@ -521,8 +558,7 @@ export function removeTab(key: string): void {if (state.active === key)state.active = state.tabs.length > 0 ? tabKey(state.tabs[state.tabs.length - 1]!) : null;if (state.tabs.length === 0) state.open = false;- persist();- notify();+ commit();}/** Moves one tab to the other dock (drag / the dock pickers), activating it there. */@@ -533,8 +569,7 @@ export function moveTab(key: string, to: DockPosition): void {const tab = layout[found.position].tabs[found.index]!;insertTab(tab, to);if (layout[found.position].tabs.length === 0) layout[found.position].open = false;- persist();- notify();+ commit();}/** Moves a whole dock's tabs onto the other edge, after any tabs already there. */@@ -552,8 +587,7 @@ export function moveDock(from: DockPosition, to: DockPosition): void {if (shown !== null) activate(to, shown);else layout.focus = to;target.open = true;- persist();- notify();+ commit();}/** Reorders one dock's strip; `keys` is the full new order of that dock's tabs. */@@ -564,8 +598,7 @@ export function reorderDock(position: DockPosition, keys: readonly string[]): voif (next.length !== state.tabs.length) return; // a stale drag; keep the strip consistentif (next.every((tab, index) => tab === state.tabs[index])) return;state.tabs = next;- persist();- notify();+ commit();}/**@@ -576,8 +609,7 @@ export function toggleDock(position: DockPosition): void {const state = area(position);state.open = !state.open;if (state.open) layout.focus = position;- persist();- notify();+ commit();}/** The merged view's ×: both docks away (wide views pass their own position instead). */@@ -588,15 +620,69 @@ export function hideView(view: DockView): void {} else {area(view.position).open = false;}- persist();+ commit();+}++// --------------------------------------------------------------------------- fullscreen++/** The surface grown to its fullscreen cover ("bottom" for the narrow merged view), or null. */+export function fullscreenDock(): DockPosition | null {+ return fullscreen;+}++/** Whether the merged view is on screen with something in its strip (rather than its picker). */+function mergedViewHasTabs(): boolean {+ return (+ (isDockVisible("bottom") && hasTabs("bottom")) || (isDockVisible("right") && hasTabs("right"))+ );+}++/**+ * Whether a surface can be fullscreen as the layout stands: on screen with tabs (the picker is+ * never fullscreen). Wide, the surface is one dock; narrow, it is the merged view, which only+ * exists at the bottom.+ */+function fullscreenEligible(position: DockPosition): boolean {+ if (narrow) return position === "bottom" && mergedViewHasTabs();+ return isDockVisible(position) && hasTabs(position);+}++/**+ * Drops fullscreen when its surface stopped qualifying — hidden, or its last tab gone — and when a+ * dock it COVERS takes the stage, which would otherwise happen invisibly under the cover. Only the+ * bottom dock's cover reaches another dock: it climbs to the toolbar, over the right dock, so the+ * right dock being touched — activated, opened, or had something moved into it — ends it. The+ * right dock's cover is its own row, with the bottom dock still in view below it, so the bottom+ * dock opening, being touched or receiving a tab leaves it alone; so does anything within the+ * merged view, which is every dock there is. Runs in commit(), after every mutation.+ */+function reconcileFullscreen(): void {+ if (fullscreen === null) return;+ const coveredTakesStage = !narrow && fullscreen === "bottom" && layout.focus === "right";+ if (!fullscreenEligible(fullscreen) || coveredTakesStage) fullscreen = null;+}++/**+ * Enters (a position) or leaves (null). Entering counts as touching that dock — it becomes the+ * focused one, so the header button works on a dock that was not touched last — and is a no-op+ * for a surface that is not on screen with tabs.+ */+export function setDockFullscreen(position: DockPosition | null): void {+ if (position !== null && !fullscreenEligible(position)) return;+ if (position !== null && !narrow && layout.focus !== position) {+ layout.focus = position;+ persist();+ }+ if (position === fullscreen) return;+ fullscreen = position;notify();}// ------------------------------------------------------------------------------- panels/** The dock a panel's tab lives in (open or not), or null when the panel is closed. */-export function panelDock(kind: PanelKind): DockPosition | null {- return tabHome(kind);+export function panelDock(id: PanelId): DockPosition | null {+ return tabHome(id);}/**@@ -604,15 +690,14 @@ export function panelDock(kind: PanelKind): DockPosition | null {* right dock — the default edge for panels opened from the conversation) and activates* it. Idempotent when already shown.*/-export function openPanel(kind: PanelKind, position?: DockPosition): void {- const target = position ?? panelDock(kind) ?? "right";- insertTab({ kind: "panel", panel: kind }, target);- persist();- notify();+export function openPanel(id: PanelId, position?: DockPosition): void {+ const target = position ?? panelDock(id) ?? "right";+ insertTab({ kind: "panel", panel: id }, target);+ commit();}-export function closePanel(kind: PanelKind): void {- removeTab(kind);+export function closePanel(id: PanelId): void {+ removeTab(id);}// ---------------------------------------------------------------------------- terminals@@ -651,8 +736,7 @@ export function unownedTerminals(ids: readonly string[]): string[] {/** New terminals land at the bottom dock unless a dock asked for them explicitly. */export function addTerminalTab(id: string, position?: DockPosition): void {insertTab({ kind: "terminal", terminalId: id }, position ?? terminalTabDock(id) ?? "bottom");- persist();- notify();+ commit();}/**@@ -682,8 +766,7 @@ export function restoreTerminalTab(scopeId: string, id: string, position: DockPostate.open = true;const { [scopeId]: _previous, ...rest } = scopes;scopes = { ...rest, [scopeId]: target };- persist();- notify();+ commit();}/**@@ -710,8 +793,7 @@ export function pruneTerminalTabs(liveIds: ReadonlySet<string>): void {if (pruneArea(layout.right)) changed = true;if (pruneArea(layout.bottom)) changed = true;if (!changed) return;- persist();- notify();+ commit();}/**@@ -736,8 +818,7 @@ export function toggleTerminalDocks(): boolean {);if (anyShown) {for (const position of holders) area(position).open = false;- persist();- notify();+ commit();return true;}showTerminal(ids[ids.length - 1]!);@@ -755,12 +836,10 @@ export function setBottomRatio(next: number): void {const clamped = clampRatio(next);if (clamped === ratio) return;ratio = clamped;- persist();- notify();+ commit();}export function resetBottomRatio(): void {ratio = DEFAULT_DOCK_HEIGHT_RATIO;- persist();- notify();+ commit();}diff --git a/packages/web/src/features/dock/panel-context.tsx b/packages/web/src/features/dock/panel-context.tsxnew file mode 100644index 00000000..f9079d49--- /dev/null+++ b/packages/web/src/features/dock/panel-context.tsx@@ -0,0 +1,51 @@+/**+ * What the dock tells a panel body about its own tab — where it lives, whether it is the shown+ * tab, whether its surface is fullscreen — and the two things a body may ask for: fullscreen on+ * or off, and its own tab closed. One hook, the same for a built-in body and for the plugin+ * panels to come, so a body never reaches into the dock store for its own circumstances: the+ * store speaks in tab keys and positions, which a body knows nothing about unless told.+ *+ * The provider is the dock's (dock-panel.tsx wraps every panel body in it); a body reads the+ * handle with `useDockPanel()`, which throws outside a dock — a panel component rendered+ * anywhere else has no tab to describe, and a silent default would hide that mistake.+ */+import { createContext, useContext } from "react";+import type { ReactNode } from "react";+import type { DockPosition } from "./dock-state";+import type { PanelId } from "./panel-registry";++export interface DockPanelHandle {+ id: PanelId;+ /** Where its tab lives ("bottom" for the narrow merged view's own position). */+ position: DockPosition;+ merged: boolean;+ /** Same as the body's `active` prop. */+ active: boolean;+ /** Whether the surface holding it is fullscreen. */+ fullscreen: boolean;+ setFullscreen: (on: boolean) => void;+ /** Removes the tab (honours close guards, like the tab's ×). */+ close: () => void;+}++const DockPanelContext = createContext<DockPanelHandle | null>(null);++/** Wraps one panel body; the dock renders it around every panel tab's body. */+export function DockPanelProvider({+ handle,+ children,+}: {+ handle: DockPanelHandle;+ children: ReactNode;+}) {+ return <DockPanelContext.Provider value={handle}>{children}</DockPanelContext.Provider>;+}++/** The handle of the panel body this is called from; throws outside a dock body. */+export function useDockPanel(): DockPanelHandle {+ const handle = useContext(DockPanelContext);+ if (handle === null) {+ throw new Error("useDockPanel() is only available inside a dock panel body");+ }+ return handle;+}diff --git a/packages/web/src/features/dock/panel-meta.tsx b/packages/web/src/features/dock/panel-meta.tsxindex 0e18100b..2c7c0a68 100644--- a/packages/web/src/features/dock/panel-meta.tsx+++ b/packages/web/src/features/dock/panel-meta.tsx@@ -1,54 +1,18 @@/**- * The panel kinds' display identity — label and glyph — shared by every surface that names- * them: the toolbar's triggers and menu rows, the docks' tab strips, and the docks' add- * menus. One table, so a panel never has two names or two marks.+ * The panels' display identity — label and glyph — for every surface that names them: the+ * toolbar's triggers and menu rows, the docks' tab strips, and the docks' add menus. The table+ * itself is the panel registry's (panel-registry.ts: one definition per panel, so a panel never+ * has two names or two marks); these are its readers, kept here so the surfaces that need only a+ * name or a mark keep their import, with the drawn form of the glyph beside them.*/import type { ReactNode } from "react";-import { GlyphIcon, ICONS, ICON_SIZE } from "@lmliheng/penguin-ui";-import { S } from "../../lib/strings";-import { NAV_ICONS } from "../../lib/nav-icons";-import type { PanelKind } from "./dock-state";+import { GlyphIcon, ICON_SIZE } from "@lmliheng/penguin-ui";+import { panelGlyphPath, panelLabel } from "./panel-registry";+import type { PanelId } from "./panel-registry";-/** The panel's short display name (read at call time — `S` is a live locale binding). */-export function panelLabel(kind: PanelKind): string {- switch (kind) {- case "agents":- return S.chat.openAgents;- case "workspace":- return S.chat.workspacePanel;- case "memory":- return S.chat.memoryViewTitle;- case "trace":- return S.nav.traces;- case "messaging":- return S.messaging.panelTitle;- case "schedules":- return S.schedule.panelTitle;- case "builtin-browser":- return S.builtinBrowser.panelTitle;- }-}--/** The panel's mark, as the registry path a Menu row draws on its own. */-export function panelGlyphPath(kind: PanelKind): string {- switch (kind) {- case "agents":- return ICONS.robotPair;- case "workspace":- return ICONS.folder;- case "memory":- return ICONS.brain;- case "trace":- return NAV_ICONS.traces;- case "messaging":- return ICONS.paperPlane;- case "schedules":- return ICONS.alarmClock;- case "builtin-browser":- return ICONS.globe;- }-}+export { panelGlyphPath, panelLabel };-export function panelGlyph(kind: PanelKind, size: number = ICON_SIZE.iconButton): ReactNode {- return <GlyphIcon d={panelGlyphPath(kind)} size={size} />;+/** The panel's mark, drawn at `size` (an id with no definition yet draws the puzzle piece). */+export function panelGlyph(id: PanelId, size: number = ICON_SIZE.iconButton): ReactNode {+ return <GlyphIcon d={panelGlyphPath(id)} size={size} />;}diff --git a/packages/web/src/features/dock/panel-registry.ts b/packages/web/src/features/dock/panel-registry.tsnew file mode 100644index 00000000..698f49a7--- /dev/null+++ b/packages/web/src/features/dock/panel-registry.ts@@ -0,0 +1,135 @@+/**+ * The registry of dock panel kinds: one self-describing definition per kind — its id, how it is+ * named and drawn, where it sorts, whether it is offered here, and the component that renders its+ * tab's body — read by every surface that lists, names or renders panels: the dock's tab strip,+ * its "+" menu and its picker, the floating launcher's fan, and the toolbar's panel buttons.+ *+ * Why a registry rather than a list of kinds: the dock is meant to take panels from plugins, and+ * a plugin's panel must be able to arrive without the dock knowing it by name. Everything the+ * dock used to do per kind through switches — a label here, a glyph there, a body in the chat+ * page — is a field of the definition now, and the built-ins register through the same door the+ * plugins will use (features/chat/builtin-dock-panels.tsx). Loading plugins is not here; this is+ * the seam they will plug into.+ *+ * An id doubles as the tab's stored key, so a stored tab whose definition is not registered (a+ * plugin's panel before the plugin loads, or after it was removed) still has a name and a mark+ * through `panelLabel` / `panelGlyphPath` — the id itself and the puzzle piece. The dock keeps+ * such a tab and shows a placeholder body until the definition arrives.+ *+ * `offered` is a live question — the built-in browser is offered only in the desktop app's own+ * window, which the shell answers a moment after startup — so a definition brings its own change+ * feed and the registry folds every feed into the one subscription. A feed is followed from the+ * moment of registration, not from the first subscriber: the built-ins register at module load,+ * before any component is mounted to listen, and their later `offered` flips must still reach it.+ */+import { useMemo, useSyncExternalStore } from "react";+import type { ComponentType } from "react";+import { ICONS } from "@lmliheng/penguin-ui";++/** A panel kind's id, also its tab's stored key. Built-ins keep their existing ids. */+export type PanelId = string;++export interface DockPanelBodyProps {+ /** The tab is the shown one AND its dock is open (bodies gate polling / reloads on it). */+ active: boolean;+}++export interface DockPanelDefinition {+ id: PanelId;+ /** Display name, read at call time (the locale binding `S` is live). */+ label: () => string;+ /** Icon path (ICONS / NAV_ICONS) — drawn with GlyphIcon by every surface. */+ glyph: string;+ /** Sort key for the add menu, the picker's tail and the launcher fan. Built-ins: 10, 20, … */+ order: number;+ /** Whether surfaces offer it here (the built-in browser: desktop shell only). Default: always. */+ offered?: () => boolean;+ /** Change feed for `offered`. */+ subscribeOffered?: (listener: () => void) => () => void;+ /** The tab's body. */+ Body: ComponentType<DockPanelBodyProps>;+}++interface Entry {+ definition: DockPanelDefinition;+ /** Stops following the definition's `offered` feed; null when it has none. */+ stopOffered: (() => void) | null;+}++const entries = new Map<PanelId, Entry>();+const listeners = new Set<() => void>();+let version = 0;++function notify(): void {+ version += 1;+ for (const listener of [...listeners]) listener();+}++/**+ * Registers (or replaces, same id) a panel kind; returns the unregister function. Replacing a+ * definition swaps the `Body` component under any open tab of that id, which remounts that body+ * (React sees a new component type) — a plugin reloading its panel starts it afresh.+ */+export function registerDockPanel(definition: DockPanelDefinition): () => void {+ entries.get(definition.id)?.stopOffered?.();+ const entry: Entry = {+ definition,+ stopOffered: definition.subscribeOffered?.(notify) ?? null,+ };+ entries.set(definition.id, entry);+ notify();+ return () => {+ // The id may have been registered again meanwhile; a stale unregister must not take the+ // newer definition down with it.+ if (entries.get(definition.id) !== entry) return;+ entry.stopOffered?.();+ entries.delete(definition.id);+ notify();+ };+}++export function dockPanelDefinition(id: PanelId): DockPanelDefinition | undefined {+ return entries.get(id)?.definition;+}++/** Registered and offered panels, by `order` then id. */+export function dockPanels(): DockPanelDefinition[] {+ return [...entries.values()]+ .map((entry) => entry.definition)+ .filter((definition) => definition.offered?.() ?? true)+ .sort((a, b) => a.order - b.order || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));+}++/** Fires on registration changes AND on any definition's `offered` change. */+export function subscribeDockPanels(listener: () => void): () => void {+ listeners.add(listener);+ return () => {+ listeners.delete(listener);+ };+}++/** Monotonic change counter — the useSyncExternalStore snapshot. */+export function dockPanelsVersion(): number {+ return version;+}++/** Hook form: re-renders on registration and on `offered` changes. */+export function useDockPanels(): DockPanelDefinition[] {+ const current = useSyncExternalStore(subscribeDockPanels, dockPanelsVersion);+ // Rebuilt only when the registry changed: the list is read on every render of every dock+ // surface, and a fresh array each time would defeat the memoised props downstream.+ return useMemo(() => dockPanels(), [current]);+}++/**+ * A tab label for an id that may not be registered (yet): the definition's name, or the id+ * itself — a plugin's tab stored before the plugin loads still needs a strip label.+ */+export function panelLabel(id: PanelId): string {+ return entries.get(id)?.definition.label() ?? id;+}++/** The mark for an id that may not be registered (yet): its glyph, or the puzzle piece. */+export function panelGlyphPath(id: PanelId): string {+ return entries.get(id)?.definition.glyph ?? ICONS.puzzle;+}diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.tsindex bcb116e2..f5bbc4c2 100644--- a/packages/web/src/lib/strings-en.ts+++ b/packages/web/src/lib/strings-en.ts@@ -253,8 +253,9 @@ export const en: Strings = {launcherPanels: "Shortcuts",launcherHide: "Hide launcher",launcherHiddenToast: "Launcher hidden — turn it back on in Settings › Appearance",- maximize: "Fill the screen",- restore: "Restore the height",+ fullscreen: "Full screen",+ exitFullscreen: "Exit full screen",+ panelUnavailable: "This panel isn't available",},builtinBrowser: {diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.tsindex 32aed0f4..9e660e06 100644--- a/packages/web/src/lib/strings.ts+++ b/packages/web/src/lib/strings.ts@@ -294,9 +294,12 @@ export const zh = {/** The fan's last entry: puts the launcher away until Appearance settings bring it back. */launcherHide: "隐藏悬浮球",launcherHiddenToast: "悬浮球已隐藏,可在 设置 › 外观 中重新开启",- /** Touch-only: the bottom dock's height toggle, standing in for a boundary drag. */- maximize: "放大到整屏",- restore: "还原高度",+ /** The dock header's fullscreen toggle while the dock is at its usual size. */+ fullscreen: "全屏",+ /** The same toggle while the dock is fullscreen: it leaves in place. */+ exitFullscreen: "退出全屏",+ /** A tab whose panel has no definition registered (a plugin's panel before it loads). */+ panelUnavailable: "此面板暂不可用",},/** The built-in browser (desktop app only): its dock panel, toolbar and dialogs. */diff --git a/packages/web/test/dock-state.test.ts b/packages/web/test/dock-state.test.tsindex b285cdf7..a9d650c2 100644--- a/packages/web/test/dock-state.test.ts+++ b/packages/web/test/dock-state.test.ts@@ -21,13 +21,20 @@* - The terminal toggle reports no tab so the caller adopts or creates one, hides and restores,* and brings the terminal to the front when a panel covers it.* - Each scope's arrangement round-trips across a reload (sizes are one preference); a stored- * tab this build does not know is dropped, not the dock, and a malformed entry reads as empty+ * tab key that is no well-formed id is dropped, not the dock, while a well-formed id nothing+ * has registered (a plugin's panel not loaded yet) is kept; a malformed entry reads as empty* docks.* - Scope switches and moves are instant (no animation); toggles animate.* - A detached terminal tab returns to the scope it left, unless a conversation already holds* the shell again.* - There is one view per open dock; a hidden dock keeps its view to stay mounted on, an empty* one has none.+ * - At most one surface is fullscreen, and only an open dock with tabs enters it. It lasts while+ * that dock is open with tabs and no dock it covers comes forward: the right dock's cover is its+ * own row, so the bottom dock opening or activating leaves it, while the bottom dock's cover+ * reaches the right dock, so the right dock opening or activating ends it. Hiding the surface or+ * closing its last tab ends either; switching tabs within it does not. A scope switch ends it+ * too, and it is never stored.*/import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";import { memoryStorage } from "./helpers/storage";@@ -76,15 +83,13 @@ describe("panel tabs", () => {expect(dock.dockActiveKey("bottom")).toBe("agents");});- it("lists the scheduled-tasks panel as a kind and opens it like any other", () => {- expect(dock.PANEL_KINDS).toContain("schedules");+ it("opens the scheduled-tasks panel like any other", () => {dock.openPanel("schedules", "right");expect(dock.panelDock("schedules")).toBe("right");expect(dock.dockActiveKey("right")).toBe("schedules");});- it("lists the built-in browser as a kind and opens it like any other", () => {- expect(dock.PANEL_KINDS).toContain("builtin-browser");+ it("opens the built-in browser like any other", () => {dock.openPanel("builtin-browser");expect(dock.panelDock("builtin-browser")).toBe("right");expect(dock.isTabShown("builtin-browser")).toBe(true);@@ -314,18 +319,23 @@ describe("persistence", () => {expect(reloaded.dockActiveKey("bottom")).toBe("memory");});- it("reads a stored schedules tab back and drops a tab key it does not know", async () => {- // A layout written by a newer build may name a kind this build lacks; the known tab- // survives and the stranger is dropped, never the whole dock.+ it("keeps a well-formed stored tab id, a plugin's namespaced one too, and drops the rest", async () => {+ // A stored id nothing has registered (a plugin's panel not loaded yet) stays, to render a+ // placeholder; a key that is no id at all is dropped, never the whole dock.+ const tabs = ["schedules", "acme.kanban", "Bad Key!", "terminal:", "terminal:t1"];localStorage.setItem("penguin.dock.layout",- '{"scopes": {"s": {"right": {"tabs": ["schedules", "someday"], "active": "schedules", "open": true}}}}',+ JSON.stringify({ scopes: { s: { right: { tabs, active: "acme.kanban", open: true } } } }),);vi.resetModules();const reloaded = await import("../src/features/dock/dock-state");reloaded.setDockScope("s");- expect(reloaded.dockTabs("right").map(reloaded.tabKey)).toEqual(["schedules"]);- expect(reloaded.dockActiveKey("right")).toBe("schedules");+ expect(reloaded.dockTabs("right").map(reloaded.tabKey)).toEqual([+ "schedules",+ "acme.kanban",+ "terminal:t1",+ ]);+ expect(reloaded.dockActiveKey("right")).toBe("acme.kanban");expect(reloaded.isDockVisible("right")).toBe(true);});@@ -429,3 +439,114 @@ describe("view models", () => {expect(dock.closedDockView("right")).toBeNull();});});++describe("fullscreen", () => {+ it("enters only on an open dock with tabs: closed, hidden or the picker is a no-op", () => {+ dock.setDockFullscreen("right"); // nothing open+ expect(dock.fullscreenDock()).toBeNull();+ dock.toggleDock("right"); // the picker: open, no tabs+ dock.setDockFullscreen("right");+ expect(dock.fullscreenDock()).toBeNull();+ dock.openPanel("workspace", "right");+ dock.toggleDock("right"); // hidden, its tab kept+ dock.setDockFullscreen("right");+ expect(dock.fullscreenDock()).toBeNull();++ dock.toggleDock("right");+ const before = dock.dockVersion();+ dock.setDockFullscreen("right");+ expect(dock.fullscreenDock()).toBe("right");+ expect(dock.dockVersion()).toBeGreaterThan(before); // subscribers re-render+ dock.setDockFullscreen(null);+ expect(dock.fullscreenDock()).toBeNull();+ });++ it("exits when its dock hides, and does not come back when the dock reopens", () => {+ dock.openPanel("workspace", "right");+ dock.setDockFullscreen("right");+ dock.toggleDock("right");+ expect(dock.fullscreenDock()).toBeNull();+ dock.toggleDock("right");+ expect(dock.fullscreenDock()).toBeNull();+ });++ it("outlives closing one of its tabs and exits with the last", () => {+ dock.openPanel("workspace", "bottom");+ dock.openPanel("memory", "bottom");+ dock.setDockFullscreen("bottom");+ dock.closePanel("memory");+ expect(dock.fullscreenDock()).toBe("bottom");+ dock.closePanel("workspace");+ expect(dock.fullscreenDock()).toBeNull();+ });++ it("keeps covering while another tab of the same dock activates or opens there", () => {+ dock.openPanel("workspace", "right");+ dock.openPanel("memory", "right");+ dock.setDockFullscreen("right");+ dock.activateTab("workspace");+ dock.openPanel("trace"); // a new panel lands in the right dock by default+ expect(dock.fullscreenDock()).toBe("right");+ });++ it("right: survives the bottom dock opening, activating and receiving a panel", () => {+ dock.openPanel("memory", "bottom");+ dock.openPanel("builtin-browser", "bottom");+ dock.openPanel("workspace", "right");+ dock.setDockFullscreen("right");+ dock.toggleDock("bottom"); // hidden+ dock.toggleDock("bottom"); // open again, focused — it shows below the covered row+ dock.activateTab("memory");+ // The agent opens the browser, whose tab lives at the bottom: shown there, under nothing.+ dock.openPanel("builtin-browser");+ expect(dock.fullscreenDock()).toBe("right");+ });++ it("bottom: ends when the right dock is toggled open", () => {+ dock.openPanel("workspace", "bottom");+ dock.setDockFullscreen("bottom");+ dock.toggleDock("right");+ expect(dock.fullscreenDock()).toBeNull();+ });++ it("bottom: ends when a tab of the right dock activates or a panel lands there", () => {+ dock.openPanel("memory", "right");+ dock.openPanel("workspace", "bottom");+ dock.setDockFullscreen("bottom");+ dock.activateTab("memory"); // the covered dock takes the stage+ expect(dock.fullscreenDock()).toBeNull();++ dock.setDockFullscreen("bottom");+ dock.openPanel("trace"); // a new panel lands in the right dock by default+ expect(dock.fullscreenDock()).toBeNull();+ });++ it("is cleared by a scope switch and not restored on return", () => {+ const a = `scope-fullscreen-a-${scopeSeq}`;+ const b = `scope-fullscreen-b-${scopeSeq}`;+ dock.setDockScope(b);+ dock.openPanel("workspace", "right");+ dock.setDockScope(a);+ dock.openPanel("workspace", "right");+ dock.setDockFullscreen("right");+ dock.setDockScope(b); // the same dock is open and touched last here too+ expect(dock.fullscreenDock()).toBeNull();+ dock.setDockScope(a);+ expect(dock.fullscreenDock()).toBeNull();+ });++ it("is never written to storage", () => {+ dock.openPanel("workspace", "right");+ dock.setDockFullscreen("right");+ dock.openPanel("memory", "right"); // a persisted change made while it still covers+ expect(dock.fullscreenDock()).toBe("right");+ const stored = JSON.parse(localStorage.getItem("penguin.dock.layout")!) as {+ scopes: Record<string, { right: object; bottom: object }>;+ };+ const entry = stored.scopes[dock.currentDockScope()]!;+ expect(Object.keys(stored).sort()).toEqual(["bottomRatio", "scopes"]);+ expect(Object.keys(entry).sort()).toEqual(["bottom", "focus", "right"]);+ for (const area of [entry.right, entry.bottom])+ expect(Object.keys(area).sort()).toEqual(["active", "open", "tabs"]);+ });+});diff --git a/packages/web/test/panel-registry.test.ts b/packages/web/test/panel-registry.test.tsnew file mode 100644index 00000000..2d107620--- /dev/null+++ b/packages/web/test/panel-registry.test.ts@@ -0,0 +1,113 @@+/**+ * The dock's panel registry (features/dock/panel-registry.ts): every panel kind is a+ * definition registered under its id, and every surface that lists, names or renders panels+ * reads it — the seam a plugin's panel will plug into.+ *+ * - A definition registers under its id, a second one with the same id replaces it, and the+ * returned function takes it back out.+ * - The list holds the offered definitions only, by `order` and then id.+ * - Subscribers hear about registrations and about a definition's `offered` changing.+ * - A tab whose id nothing has registered still gets a name and a mark: the id itself and the+ * puzzle glyph.+ */+import { afterEach, describe, expect, it, vi } from "vitest";+import { ICONS } from "@lmliheng/penguin-ui";+import {+ dockPanelDefinition,+ dockPanels,+ dockPanelsVersion,+ panelGlyphPath,+ panelLabel,+ registerDockPanel,+ subscribeDockPanels,+} from "../src/features/dock/panel-registry";+import type { DockPanelDefinition } from "../src/features/dock/panel-registry";++/** The registry is module-level: each test takes back everything it registered. */+const cleanups: (() => void)[] = [];+afterEach(() => {+ for (const cleanup of cleanups.splice(0).reverse()) cleanup();+});++function register(definition: DockPanelDefinition): () => void {+ const unregister = registerDockPanel(definition);+ cleanups.push(unregister);+ return unregister;+}++function panel(+ id: string,+ order: number,+ extra: Partial<DockPanelDefinition> = {},+): DockPanelDefinition {+ return {+ id,+ label: () => `Label of ${id}`,+ glyph: ICONS.folder,+ order,+ Body: () => null,+ ...extra,+ };+}++const listedIds = (): string[] => dockPanels().map((definition) => definition.id);++describe("the panel registry", () => {+ it("registers a panel, replaces it by id, and unregisters it", () => {+ const first = panel("acme.kanban", 10);+ register(first);+ expect(dockPanelDefinition("acme.kanban")).toBe(first);++ const second = panel("acme.kanban", 10, { label: () => "Board" });+ const unregister = register(second);+ expect(dockPanelDefinition("acme.kanban")).toBe(second);+ expect(listedIds()).toEqual(["acme.kanban"]);++ unregister();+ expect(dockPanelDefinition("acme.kanban")).toBeUndefined();+ expect(listedIds()).toEqual([]);+ });++ it("lists the offered panels by order, then id", () => {+ register(panel("test.gamma", 20));+ register(panel("test.beta", 10));+ register(panel("test.alpha", 20));+ register(panel("test.hidden", 5, { offered: () => false }));+ expect(listedIds()).toEqual(["test.beta", "test.alpha", "test.gamma"]);+ });++ it("notifies subscribers on a registration and on an offered change", () => {+ const offeredListeners = new Set<() => void>();+ let offered = true;+ register(+ panel("test.web", 10, {+ offered: () => offered,+ subscribeOffered: (listener) => {+ offeredListeners.add(listener);+ return () => offeredListeners.delete(listener);+ },+ }),+ );+ const listener = vi.fn();+ cleanups.push(subscribeDockPanels(listener));++ register(panel("test.other", 20));+ expect(listener).toHaveBeenCalled();++ listener.mockClear();+ const before = dockPanelsVersion();+ offered = false;+ for (const notifyOffered of [...offeredListeners]) notifyOffered();+ expect(listener).toHaveBeenCalled();+ expect(dockPanelsVersion()).not.toBe(before);+ expect(listedIds()).toEqual(["test.other"]);+ });++ it("names an unregistered id by the id itself and marks it with the puzzle glyph", () => {+ register(panel("test.known", 10, { label: () => "Known", glyph: ICONS.globe }));+ expect(panelLabel("test.known")).toBe("Known");+ expect(panelGlyphPath("test.known")).toBe(ICONS.globe);+ expect(panelLabel("acme.kanban")).toBe("acme.kanban");+ expect(panelGlyphPath("acme.kanban")).toBe(ICONS.puzzle);+ });+});