Multiplayer agent harness for work.
Compact multiview pane header: session actions on the active tab, legible narrow panes (#1550)
Joshua France95adea5957aa
diff --git a/plugins/web-ui/src/chat.ts b/plugins/web-ui/src/chat.tsindex 9d3e5079c..f2c50925c 100644--- a/plugins/web-ui/src/chat.ts+++ b/plugins/web-ui/src/chat.ts@@ -2877,6 +2877,49 @@ export function createChatSurface(}}+ let attachmentPeek: HTMLElement | null = null;++ function unpeekAttachment(): void {+ attachmentPeek?.remove();+ attachmentPeek = null;+ document.removeEventListener("scroll", unpeekAttachment, true);+ }++ function peekAttachment(e: Event): void {+ const link = e.currentTarget as HTMLElement | null;+ const img = link?.querySelector("img");+ if (!link || !img || getComputedStyle(link).getPropertyValue("--attachment-compact").trim() !== "1") return;+ unpeekAttachment();+ const bounds = (link.closest(".split-pane-content") ?? document.documentElement).getBoundingClientRect();+ const anchor = link.getBoundingClientRect();+ const pad = 12;+ const chrome = 12;+ const maxW = Math.max(80, Math.min(360, bounds.width - pad * 2 - chrome));+ const maxH = Math.max(60, Math.min(320, bounds.height - anchor.height - pad * 3 - chrome));+ const natural = { w: img.naturalWidth || maxW, h: img.naturalHeight || maxH };+ const scale = Math.min(maxW / natural.w, maxH / natural.h, 1);+ const w = Math.round(natural.w * scale);+ const h = Math.round(natural.h * scale);+ const peek = document.createElement("div");+ peek.className = "attachment-peek";+ peek.setAttribute("aria-hidden", "true");+ const copy = document.createElement("img");+ copy.src = img.currentSrc || img.src;+ copy.alt = "";+ copy.style.width = `${w}px`;+ copy.style.height = `${h}px`;+ peek.append(copy);+ const below = anchor.bottom + 8;+ const top =+ below + h + chrome <= bounds.bottom - pad ? below : Math.max(bounds.top + pad, anchor.top - 8 - h - chrome);+ const left = Math.max(bounds.left + pad, Math.min(anchor.right - w - chrome, bounds.right - pad - w - chrome));+ peek.style.top = `${top}px`;+ peek.style.left = `${left}px`;+ document.body.append(peek);+ attachmentPeek = peek;+ document.addEventListener("scroll", unpeekAttachment, true);+ }+function userAttachmentBadge(a: UserAttachmentView): TemplateResult {const artifactHref = a.artifactId ? fileContentUrl(a.artifactId, a.fileName) : undefined;if (a.mimeType?.startsWith("image/")) {@@ -2884,9 +2927,20 @@ export function createChatSurface(a.content && (a.content.startsWith("data:") ? a.content : `data:${a.mimeType};base64,${a.content}`);const href = artifactHref ?? localContentUrl(a) ?? dataUrl;if (href && browserRenderableImage(a.mimeType)) {- return html`<a class="file-image" href=${href} target="_blank" rel="noreferrer" ${tip(a.fileName)}- ><img src=${href} alt=${a.fileName} loading="lazy"- /></a>`;+ return html`<a+ class="file-image"+ href=${href}+ target="_blank"+ rel="noreferrer"+ ${tip(a.fileName)}+ @mouseenter=${peekAttachment}+ @mouseleave=${unpeekAttachment}+ @focus=${peekAttachment}+ @blur=${unpeekAttachment}+ ><img src=${href} alt=${a.fileName} loading="lazy" /><span class="file-image-name" dir="auto"+ >${a.fileName}</span+ >${typeof a.size === "number" ? html`<small class="file-image-size">${formatBytes(a.size)}</small>` : nothing}</a+ >`;}return chipBadge(FileImage, a.fileName, a.size, href || undefined, true);}diff --git a/plugins/web-ui/src/shell.css b/plugins/web-ui/src/shell.cssindex b7cb2405c..c2735e007 100644--- a/plugins/web-ui/src/shell.css+++ b/plugins/web-ui/src/shell.css@@ -627,10 +627,6 @@ a.chat-row-open {.split-pane-title > .session-status {margin-inline-start: auto;}-.split-pane-title:has(> .session-status) .split-tab-actions {- right: 22px;-}-.working-mark {display: inline-flex;align-items: center;@@ -2357,6 +2353,95 @@ qm-markdown .tok-in {height: 80px;object-fit: cover;}+.file-image .file-image-name,+.file-image .file-image-size {+ display: none;+}+/* In a short pane, or while the message is the pinned prompt riding over the answer, an+ image folds from the 80px thumbnail to a one-line chip: a 22px thumbnail, the name and+ the size, the same footprint as a document chip. Hover or focus peeks at the picture. */+@container split-pane (max-height: 480px) {+ .user-row > .message-files .file-image {+ --attachment-compact: 1;+ display: inline-flex;+ align-items: center;+ gap: 6px;+ width: auto;+ max-width: 100%;+ min-height: 28px;+ padding: 3px 8px 3px 3px;+ border: 1px solid var(--border);+ border-radius: 8px;+ background: var(--background);+ color: var(--muted-foreground);+ font-size: 12px;+ line-height: 1.2;+ }+ .user-row > .message-files .file-image img {+ width: 22px;+ height: 22px;+ border-radius: 5px;+ object-fit: cover;+ }+ .user-row > .message-files .file-image .file-image-name,+ .user-row > .message-files .file-image .file-image-size {+ display: inline;+ }+}+.message-stack .user-row.stuck > .message-files .file-image {+ --attachment-compact: 1;+ display: inline-flex;+ align-items: center;+ gap: 6px;+ width: auto;+ max-width: 100%;+ min-height: 28px;+ padding: 3px 8px 3px 3px;+ border: 1px solid var(--border);+ border-radius: 8px;+ background: var(--background);+ color: var(--muted-foreground);+ font-size: 12px;+ line-height: 1.2;+}+.message-stack .user-row.stuck > .message-files .file-image img {+ width: 22px;+ height: 22px;+ border-radius: 5px;+ object-fit: cover;+}+.message-stack .user-row.stuck > .message-files .file-image .file-image-name,+.message-stack .user-row.stuck > .message-files .file-image .file-image-size {+ display: inline;+}+.file-image .file-image-name {+ min-width: 0;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ color: var(--foreground);+}+.file-image .file-image-size {+ flex: none;+ color: var(--muted-foreground);+}+.attachment-peek {+ position: fixed;+ z-index: 1200;+ padding: 6px;+ border: 1px solid var(--border);+ border-radius: 12px;+ background: var(--background);+ box-shadow: var(--chat-surface-shadow);+ pointer-events: none;+}+.attachment-peek img {+ display: block;+ max-width: 100%;+ max-height: 100%;+ border-radius: 8px;+ object-fit: contain;+}.file-html-unfurl {display: flex;flex-direction: column;@@ -8156,9 +8241,14 @@ h3.ambient-field-label {}.split-canvas.single-pane .dockview-theme-qm .dv-groupview .dv-tabs-and-actions-container {+ --split-strip-line: color-mix(in srgb, var(--border) 68%, transparent);+ --split-strip-bg: color-mix(in srgb, var(--background) 94%, var(--secondary));padding: 0 16px;- border-bottom-color: color-mix(in srgb, var(--border) 68%, transparent);- background: color-mix(in srgb, var(--background) 94%, var(--secondary));+}++.split-canvas.single-pane .dockview-theme-qm .dv-groupview .dv-tabs-and-actions-container:not(.dv-single-tab) {+ --split-strip-pad: 11px;+ padding-top: var(--split-strip-pad);}.split-canvas.single-pane .dv-render-overlay {@@ -8215,21 +8305,25 @@ h3.ambient-field-label {border-radius: 0;background: var(--background);overflow: hidden;+ container: pane-group / inline-size;}.dockview-theme-qm .dv-tabs-and-actions-container {+ --split-strip-line: var(--border);+ --split-strip-bg: var(--secondary);+ --split-strip-pad: 4px;position: relative;box-sizing: border-box;- padding: 4px 6px 4px 10px;+ padding: var(--split-strip-pad) 6px var(--split-strip-pad) 10px;gap: 8px;- border-bottom: 1px solid var(--border);- background: var(--secondary);+ border-bottom: 1px solid var(--split-strip-line);+ background: var(--split-strip-bg);user-select: none;font-family: var(--app-font);}.dockview-theme-qm .dv-groupview.dv-active-group .dv-tabs-and-actions-container {- border-bottom-color: color-mix(in srgb, var(--brand-accent) 20%, var(--border));+ --split-strip-line: color-mix(in srgb, var(--brand-accent) 20%, var(--border));}/* Empty auxiliary action containers must not occupy a flex-gap slot. */@@ -8257,6 +8351,19 @@ h3.ambient-field-label {.dockview-theme-qm .dv-tabs-and-actions-container:not(.dv-single-tab) {--dv-activegroup-visiblepanel-tab-background-color: var(--background);--dv-inactivegroup-visiblepanel-tab-background-color: var(--background);+ padding-bottom: 0;+ border-bottom: 0;+ background: linear-gradient(var(--split-strip-line), var(--split-strip-line)) bottom / 100% 1px no-repeat+ var(--split-strip-bg);+}++.dockview-theme-qm .dv-tabs-and-actions-container:not(.dv-single-tab) .dv-tabs-container,+.dockview-theme-qm .dv-tabs-and-actions-container:not(.dv-single-tab) .dv-right-actions-container {+ align-items: flex-start;+}++.dockview-theme-qm .dv-tabs-and-actions-container:not(.dv-single-tab) .split-group-session-action {+ display: none;}/* A lone tab is today's header: title 10px from the strip edge, no chip chrome, and the@@ -8278,25 +8385,17 @@ h3.ambient-field-label {}.split-group-session-action {- display: none;-}--.dockview-theme-qm .dv-single-tab .split-group-session-action {display: inline-flex;}-/* Multi-tab groups (tabbing is new capability the old canvas lacked): segmented chips in- the app's own control idiom — the active tab is the standard raised card (page bg, 1px- border, tiny shadow, 34px like .icon-btn), inactive tabs are muted text with the shared- 7% hover wash. The group-level close hides; every session closes from its own tab. */+/* Multi-tab groups: inactive tabs are muted labels on the strip; the active tab shares the+ body's surface and runs down onto it, carrying its own session actions. Tabs shrink to a+ floor and then move into the strip's overflow menu; the active one keeps a higher floor. */.dockview-theme-qm .dv-tabs-and-actions-container:not(.dv-single-tab) .dv-tab {- height: 34px;- /* Every tab takes the same share of the strip and shrinks with it, down to a floor that- still reads as a label; past that they stop shrinking and the ones that no longer fit- move into the strip's overflow menu. Sizing off a fixed basis rather than the title- keeps the rhythm even and stops a title change from resizing its neighbours. */- flex: 0 1 220px;- min-width: 100px;+ --split-tab-h: 34px;+ height: var(--split-tab-h);+ flex: 0 1 160px;+ min-width: 72px;max-width: 220px;padding: 0 8px 0 10px;display: flex;@@ -8306,7 +8405,15 @@ h3.ambient-field-label {}.dockview-theme-qm .dv-tabs-and-actions-container:not(.dv-single-tab) .dv-tab.dv-active-tab {+ flex: 0 1 260px;+ min-width: 150px;+ max-width: 320px;+ align-self: stretch;+ height: auto;+ padding-bottom: var(--split-strip-pad);border-color: var(--border);+ border-bottom-color: transparent;+ border-radius: var(--radius-sm) var(--radius-sm) 0 0;}.dockview-theme-qm@@ -8376,16 +8483,15 @@ h3.ambient-field-label {background: var(--secondary);}+/* The close control sits in the tab's flow after the title, so the title truncates+ around it instead of being painted over; every tab reserves the slot and only the+ opacity moves, so hovering never shifts a title. */.split-tab-actions {- position: absolute;- right: 0;- top: 50%;- transform: translateY(-50%);display: flex;align-items: center;gap: 2px;- border-radius: 5px;- background: color-mix(in srgb, var(--background) 96%, transparent);+ flex: 0 0 auto;+ margin-left: 2px;opacity: 0;pointer-events: none;transition: opacity 0.12s ease;@@ -8398,7 +8504,7 @@ h3.ambient-field-label {pointer-events: auto;}-.split-tab-close {+.split-tab-actions .icon-btn {width: 18px;height: 18px;min-width: 18px;@@ -8406,11 +8512,32 @@ h3.ambient-field-label {opacity: 0.55;}-.dv-tab:hover .split-tab-close,-.dv-tab:focus-within .split-tab-close {+.dv-tab:hover .split-tab-actions .icon-btn,+.dv-tab:focus-within .split-tab-actions .icon-btn {opacity: 0.8;}+.split-tab-session {+ display: inline-flex;+ align-items: center;+ gap: 2px;+}++.split-tab-more,+.dv-tab:not(.dv-active-tab) .split-tab-session {+ display: none;+}++@container pane-group (max-width: 400px) {+ .dv-tab .split-tab-session {+ display: none;+ }++ .dv-tab.dv-active-tab .split-tab-more {+ display: inline-flex;+ }+}+.split-pane-title {display: flex;align-items: center;@@ -8439,6 +8566,18 @@ h3.ambient-field-label {flex: 0 0 auto;}+.split-pane-actions-wide {+ display: contents;+}++/* A narrow pane keeps the tools menu, share, archive and the group close in its header;+ split and focus fold into the menu. */+@container pane-group (max-width: 560px) {+ .split-pane-actions-wide {+ display: none;+ }+}+/* Single-header multiview: the pane title is a scope / title breadcrumb, and thechat's project tools live behind the header's own overflow menu. */.split-pane-crumb {@@ -8513,7 +8652,7 @@ h3.ambient-field-label {font-size: 21px;}-.split-canvas:not(.single-pane) .dockview-theme-qm .dv-tabs-and-actions-container .icon-btn {+.split-canvas:not(.single-pane) .dockview-theme-qm .dv-tabs-and-actions-container .split-pane-actions .icon-btn {width: 27px;height: 27px;min-width: 27px;@@ -8521,7 +8660,7 @@ h3.ambient-field-label {}.split-canvas:not(.single-pane) .dockview-theme-qm .dv-tabs-and-actions-container:not(.dv-single-tab) .dv-tab {- height: 27px;+ --split-tab-h: 27px;border-radius: 0;}diff --git a/plugins/web-ui/src/split.ts b/plugins/web-ui/src/split.tsindex 985915891..3a9fd5b88 100644--- a/plugins/web-ui/src/split.ts+++ b/plugins/web-ui/src/split.ts@@ -10,6 +10,7 @@ import {Box,Brain,Clock3,+ ChevronDown,Cog,Expand,Files,@@ -21,6 +22,7 @@ import {Rocket,Shrink,X,+ type IconNode,} from "lucide";import {createDockview,@@ -872,7 +874,7 @@ function paneCrumb(panel: IDockviewPanel): string | null {return scopeTitle(scope, context?.name ?? null);}-const PANE_TOOLS: { tool: SessionTool; glyph: Parameters<typeof icon>[0]; label: string }[] = [+const PANE_TOOLS: { tool: SessionTool; glyph: IconNode; label: string }[] = [{ tool: "crons", glyph: Clock3, label: "Crons" },{ tool: "apps", glyph: Rocket, label: "Apps" },{ tool: "files", glyph: Files, label: "Files" },@@ -1075,61 +1077,81 @@ class PaneContent implements IContentRenderer {}}-function sessionActions(sessionId: string, inTab: boolean, panelId: string): TemplateResult {- const cls = inTab ? "split-tab-close" : "split-group-session-action";+function sessionParent(sessionId: string): CoreSession | undefined {const parentId = sessionsState.list.find((row) => row.id === sessionId)?.parentSessionId;- const parent = parentId ? sessionsState.list.find((row) => row.id === parentId) : undefined;- return html`${- parent- ? html`<button- type="button"- class="icon-btn subtle ${cls}"- aria-label=${`Back to parent: ${sessionTitle(parent)}`}- ${tip(`Back to ${sessionTitle(parent)}`)}- @pointerdown=${(e: Event) => {- if (inTab) e.stopPropagation();- }}- @click=${(e: Event) => {- if (inTab) e.stopPropagation();- focusPane(panelId);- void openSession(parent);- }}- >- ${icon(ArrowUpLeft, 13)}- </button>`- : nothing- }<button- type="button"- class="icon-btn subtle ${cls} split-tab-share"- ${tip("Share conversation")}- aria-label="Share conversation"- @pointerdown=${(e: Event) => {- if (inTab) e.stopPropagation();- }}- @click=${(e: Event) => {- if (inTab) e.stopPropagation();+ return parentId ? sessionsState.list.find((row) => row.id === parentId) : undefined;+}++type SessionAction = { label: string; aria?: string; glyph: Parameters<typeof icon>[0]; cls?: string; run: () => void };++function sessionActionItems(sessionId: string, panelId: string): SessionAction[] {+ const parent = sessionParent(sessionId);+ const items: SessionAction[] = [];+ if (parent) {+ items.push({+ label: `Back to ${sessionTitle(parent)}`,+ aria: `Back to parent: ${sessionTitle(parent)}`,+ glyph: ArrowUpLeft,+ run: () => {+ focusPane(panelId);+ void openSession(parent);+ },+ });+ }+ items.push(+ {+ label: "Share conversation",+ glyph: Link,+ cls: "split-tab-share",+ run: () => {void openSessionShare(sessionId);- }}- >- ${icon(Link, 13)}- </button>- <button- class="icon-btn subtle ${cls} split-tab-archive"- type="button"- title="Archive session"- aria-label="Archive session"- @pointerdown=${(e: Event) => {- if (inTab) e.stopPropagation();- }}- @click=${(e: Event) => {- if (inTab) e.stopPropagation();+ },+ },+ {+ label: "Archive session",+ glyph: Archive,+ cls: "split-tab-archive",+ run: () => {archiveSessionById(sessionId);- }}- >- ${icon(Archive, 13)}- </button>`;+ },+ },+ );+ return items;}+function sessionActions(sessionId: string, panelId: string, cls: string): TemplateResult {+ return html`${sessionActionItems(sessionId, panelId).map(+ (a) =>+ html`<button+ type="button"+ class=${["icon-btn", "subtle", cls, a.cls].filter(Boolean).join(" ")}+ ${tip(a.label)}+ aria-label=${a.aria ?? a.label}+ @click=${a.run}+ >+ ${icon(a.glyph, 13)}+ </button>`,+ )}`;+}++let tabMenu: { panelId: string; anchor: HTMLElement } | null = null;++function toggleTabMenu(panelId: string, anchor: HTMLElement): void {+ tabMenu = tabMenu?.panelId === panelId ? null : { panelId, anchor };+ for (const a of groupActions) a.draw();+}++const placeBelow =+ (anchor: HTMLElement) =>+ (el?: Element): void => {+ if (!(el instanceof HTMLElement)) return;+ const rect = anchor.getBoundingClientRect();+ el.style.position = "fixed";+ el.style.top = `${rect.bottom + 6}px`;+ el.style.left = `${Math.max(8, Math.min(rect.left, window.innerWidth - el.offsetWidth - 8))}px`;+ el.style.right = "auto";+ };+class PaneTab implements ITabRenderer {readonly element: HTMLElement;private panelId = "";@@ -1219,7 +1241,25 @@ class PaneTab implements ITabRenderer {${this.inStrip? html`<span class="split-tab-actions">- ${sessionId ? sessionActions(sessionId, true, panel.id) : nothing}+ ${+ sessionId+ ? html`<span class="split-tab-session" @click=${(e: Event) => e.stopPropagation()}+ >${sessionActions(sessionId, panel.id, "")}</span+ ><button+ class="icon-btn subtle split-tab-more"+ type="button"+ ${tip("Session actions")}+ aria-label="Session actions"+ aria-haspopup="menu"+ @click=${(e: Event) => {+ e.stopPropagation();+ toggleTabMenu(panel.id, e.currentTarget as HTMLElement);+ }}+ >+ ${icon(ChevronDown, 13)}+ </button>`+ : nothing+ }<buttonclass="icon-btn subtle split-tab-close"type="button"@@ -1305,10 +1345,11 @@ class GroupActions implements IHeaderActionsRenderer {}private readonly onDocClick = (e: Event): void => {- if (!this.menuOpen) return;+ if (!this.menuOpen && !tabMenu) return;const tools = this.element.querySelector(".split-tools");if (tools && e.composedPath().includes(tools)) return;this.menuOpen = false;+ tabMenu = null;this.draw();};@@ -1342,6 +1383,14 @@ class GroupActions implements IHeaderActionsRenderer {if (p) openPaneTool(p, tool);};if (single) this.menuOpen = false;+ const closeMenu = (): void => {+ this.menuOpen = false;+ this.draw();+ };+ const splitPane = (): void => {+ const p = activePanel();+ if (p) paneSplitWithBlank(p);+ };const menu = this.menuOpen? html`<div@@ -1363,8 +1412,18 @@ class GroupActions implements IHeaderActionsRenderer {type="button"role="menuitem"@click=${() => {- this.menuOpen = false;- this.draw();+ closeMenu();+ splitPane();+ }}+ >+ ${icon(Plus, 15)}<span>Split with a new session</span>+ </button>+ <button+ class="session-menu-option"+ type="button"+ role="menuitem"+ @click=${() => {+ closeMenu();if (maximized) props.api.exitMaximized();else props.api.maximize();}}@@ -1380,10 +1439,7 @@ class GroupActions implements IHeaderActionsRenderer {{label: "Split this pane with a new session",glyph: icon(Plus, 15),- run: () => {- const p = activePanel();- if (p) paneSplitWithBlank(p);- },+ run: splitPane,},{label: "Open full screen",@@ -1405,58 +1461,85 @@ class GroupActions implements IHeaderActionsRenderer {},},];- render(- html`${- single- ? html`<span class="split-single-tools">- ${PANE_TOOLS.map((t) => {- const count = scope ? scopeToolCount(t.tool, scope, () => this.draw()) : null;- return html`<button- class="session-tool"+ const headerButton = (b: (typeof buttons)[number]): TemplateResult =>+ html`<button+ class="icon-btn subtle${b.cls ?? ""}"+ type="button"+ ${tip(b.label)}+ aria-label=${b.label}+ @click=${b.run}+ >+ ${b.glyph}+ </button>`;+ const menuPanel = tabMenu ? props.group.panels.find((p) => p.id === tabMenu?.panelId) : undefined;+ const menuSession = menuPanel ? (panelParams(menuPanel).sessionId ?? paneSession(menuPanel)?.id) : undefined;+ const tabMenuTpl =+ tabMenu && menuPanel && menuSession+ ? html`<div+ class="session-menu-popover split-tools-menu split-tab-menu"+ role="menu"+ ${ref(placeBelow(tabMenu.anchor))}+ @click=${(e: Event) => e.stopPropagation()}+ >+ ${sessionActionItems(menuSession, menuPanel.id).map(+ (a) => html`+ <button+ class="session-menu-option"type="button"- aria-label=${t.label}- ${tip(t.label)}- @click=${() => runTool(t.tool)}+ role="menuitem"+ @click=${() => {+ tabMenu = null;+ this.draw();+ a.run();+ }}>- ${icon(t.glyph, 15)}${count ? html`<span class="session-tool-count">${count}</span>` : nothing}- </button>`;- })}- </span>`- : html`<span class="split-tools">- <button- class="icon-btn subtle split-tools-btn ${this.menuOpen ? "active" : ""}"- type="button"- ${tip("Tools")}- aria-label="Tools"- aria-haspopup="menu"- aria-expanded=${this.menuOpen ? "true" : "false"}- @click=${() => {- this.menuOpen = !this.menuOpen;- this.draw();- }}- >- ${icon(MoreHorizontal, 15)}- </button>- ${menu}- </span>`- }- ${sessionId ? sessionActions(sessionId, false, panel!.id) : nothing}- ${- single- ? nothing- : buttons.map(- (b) =>- html`<button- class="icon-btn subtle${b.cls ?? ""}"+ ${icon(a.glyph, 15)}<span>${a.label}</span>+ </button>+ `,+ )}+ </div>`+ : nothing;+ render(+ html`${+ single+ ? html`<span class="split-single-tools">+ ${PANE_TOOLS.map((t) => {+ const count = scope ? scopeToolCount(t.tool, scope, () => this.draw()) : null;+ return html`<button+ class="session-tool"+ type="button"+ aria-label=${t.label}+ ${tip(t.label)}+ @click=${() => runTool(t.tool)}+ >+ ${icon(t.glyph, 15)}${count ? html`<span class="session-tool-count">${count}</span>` : nothing}+ </button>`;+ })}+ </span>`+ : html`<span class="split-tools">+ <button+ class="icon-btn subtle split-tools-btn ${this.menuOpen ? "active" : ""}"type="button"- ${tip(b.label)}- aria-label=${b.label}- @click=${b.run}+ ${tip("Tools")}+ aria-label="Tools"+ aria-haspopup="menu"+ aria-expanded=${this.menuOpen ? "true" : "false"}+ @click=${() => {+ tabMenu = null;+ this.menuOpen = !this.menuOpen;+ this.draw();+ }}>- ${b.glyph}- </button>`,- )- }`,+ ${icon(MoreHorizontal, 15)}+ </button>+ ${menu}+ </span>`+ }+ ${sessionId ? sessionActions(sessionId, panel!.id, "split-group-session-action") : nothing}+ <span class="split-pane-actions-wide"+ >${single ? nothing : buttons.filter((b) => !b.cls).map(headerButton)}</span+ >+ ${single ? nothing : buttons.filter((b) => b.cls).map(headerButton)}${tabMenuTpl}`,this.element,);}diff --git a/plugins/web-ui/test/attachment-compact.test.ts b/plugins/web-ui/test/attachment-compact.test.tsnew file mode 100644index 000000000..3bd8e90d9--- /dev/null+++ b/plugins/web-ui/test/attachment-compact.test.ts@@ -0,0 +1,64 @@+import assert from "node:assert/strict";+import { readFileSync } from "node:fs";+import test from "node:test";++const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");+const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");++const block = (selector: RegExp): string => css.match(new RegExp(`${selector.source}\\s*\\{([^}]*)\\}`))?.[1] ?? "";++test("a user image carries its name and size inside the same element as the thumbnail", () => {+ const fn = chat.match(/function userAttachmentBadge\([\s\S]*?\n {2}\}/)?.[0] ?? "";+ assert.match(+ fn,+ /class="file-image"[\s\S]*?<img src=\$\{href\}[\s\S]*?class="file-image-name"[\s\S]*?class="file-image-size"/,+ );+ assert.match(css, /\.file-image \.file-image-name,\s*\.file-image \.file-image-size \{\s*display: none;/);+});++test("the thumbnail folds to a chip in a short pane and while the prompt is pinned", () => {+ const short =+ css.match(+ /@container split-pane \(max-height: 480px\) \{\s*\.user-row > \.message-files \.file-image \{([^}]*)\}/,+ )?.[1] ?? "";+ const stuck = block(/\.message-stack \.user-row\.stuck > \.message-files \.file-image/);+ for (const [name, rule] of [+ ["short pane", short],+ ["pinned prompt", stuck],+ ] as const) {+ assert.match(rule, /--attachment-compact: 1;/, name);+ assert.match(rule, /display: inline-flex;/, name);+ assert.match(rule, /min-height: 28px;/, name);+ assert.match(rule, /border: 1px solid var\(--border\);/, name);+ }+ assert.match(+ css,+ /\.message-stack \.user-row\.stuck > \.message-files \.file-image img \{[^}]*width: 22px;[^}]*height: 22px;/,+ );+ assert.match(+ css,+ /\.message-stack \.user-row\.stuck > \.message-files \.file-image \.file-image-name,\s*\.message-stack \.user-row\.stuck > \.message-files \.file-image \.file-image-size \{\s*display: inline;/,+ );+ const rest = block(/\n\.user-row > \.message-files \.file-image/);+ assert.match(rest, /width: 80px;/, "the resting thumbnail is unchanged");+});++test("the peek only opens for the chip form, floats above everything and leaves on scroll", () => {+ const peek = chat.match(/function peekAttachment\([\s\S]*?\n {2}\}/)?.[0] ?? "";+ assert.match(peek, /getPropertyValue\("--attachment-compact"\)\.trim\(\) !== "1"\) return;/);+ assert.match(+ peek,+ /closest\("\.split-pane-content"\) \?\? document\.documentElement/,+ "clamps to the pane, not the window",+ );+ assert.match(peek, /document\.addEventListener\("scroll", unpeekAttachment, true\);/);+ assert.match(peek, /peek\.className = "attachment-peek";/);+ const fn = chat.match(/function userAttachmentBadge\([\s\S]*?\n {2}\}/)?.[0] ?? "";+ assert.match(+ fn,+ /@mouseenter=\$\{peekAttachment\}[\s\S]*?@mouseleave=\$\{unpeekAttachment\}[\s\S]*?@focus=\$\{peekAttachment\}[\s\S]*?@blur=\$\{unpeekAttachment\}/,+ );+ const style = block(/\n\.attachment-peek/);+ assert.match(style, /position: fixed;/);+ assert.match(style, /pointer-events: none;/);+});diff --git a/plugins/web-ui/test/css-vars.test.ts b/plugins/web-ui/test/css-vars.test.tsindex 86ee2ba24..ff93b2685 100644--- a/plugins/web-ui/test/css-vars.test.ts+++ b/plugins/web-ui/test/css-vars.test.ts@@ -119,7 +119,7 @@ test("expanded pins wrap their full text instead of truncating to one line", ()});test("chat shadows stay limited to elevated surfaces and subtle activity hover glow", () => {- const elevated = [".pinned-strip", ".message-stack .user-row.stuck > .user-bubble"];+ const elevated = [".pinned-strip", ".message-stack .user-row.stuck > .user-bubble", ".attachment-peek"];const rules = shellCss.replace(/\/\*[\s\S]*?\*\//g, "");const painted = [...rules.matchAll(/([^{}]+)\{([^{}]*)\}/g)].flatMap((rule) =>[...rule[2].matchAll(/(box|text)-shadow\s*:\s*([^;}]+)/g)]diff --git a/plugins/web-ui/test/session-share-actions.test.ts b/plugins/web-ui/test/session-share-actions.test.tsindex 879d963c6..2824a836e 100644--- a/plugins/web-ui/test/session-share-actions.test.ts+++ b/plugins/web-ui/test/session-share-actions.test.ts@@ -7,24 +7,44 @@ const split = read("split.ts");const sessions = read("sessions.ts");const css = read("shell.css");-test("tab and header sharing use the same session actions", () => {+test("a strip tab carries its own session's share and archive, drawn from one action list", () => {+ const tab = split.slice(split.indexOf("class PaneTab"), split.indexOf("class StripDrop"));+ assert.match(tab, /split-tab-session[\s\S]*?sessionActions\(sessionId, panel\.id, ""\)/);+ assert.match(tab, /split-tab-more[\s\S]*?toggleTabMenu\(panel\.id, e\.currentTarget as HTMLElement\)/);+ const items = split.slice(split.indexOf("function sessionActionItems"), split.indexOf("function sessionActions"));+ assert.match(items, /split-tab-share[\s\S]*?openSessionShare\(sessionId\)/);+ assert.match(items, /glyph: Link/);+ assert.match(items, /split-tab-archive[\s\S]*?archiveSessionById\(sessionId\)/);+ assert.match(split, /icon\(a\.glyph, 13\)/);+ assert.doesNotMatch(split, /session-share-button|sessionMenuItems/);+ assert.match(css, /\.dv-tab:not\(\.dv-active-tab\) \.split-tab-session \{\s*display: none;/);+});++test("under 400px the active tab folds share and archive into one caret menu the header draws", () => {assert.match(- split,- /this\.inStrip[\s\S]*?split-tab-actions[\s\S]*?sessionId \? sessionActions\(sessionId, true, panel\.id\) : nothing/,+ css,+ /@container pane-group \(max-width: 400px\) \{\s*\.dv-tab \.split-tab-session \{\s*display: none;\s*\}\s*\.dv-tab\.dv-active-tab \.split-tab-more \{\s*display: inline-flex;/,);- const actions = split.slice(split.indexOf("function sessionActions"), split.indexOf("class PaneTab"));- assert.match(actions, /split-tab-share[\s\S]*?openSessionShare\(sessionId\)[\s\S]*?icon\(Link, 13\)/);- assert.match(actions, /split-tab-archive[\s\S]*?archiveSessionById\(sessionId\)/);- assert.doesNotMatch(split, /session-share-button/);+ const group = split.slice(split.indexOf("class GroupActions"), split.indexOf("function notePaneSession"));+ assert.match(+ group,+ /split-tab-menu[\s\S]*?placeBelow\(tabMenu\.anchor\)[\s\S]*?sessionActionItems\(menuSession, menuPanel\.id\)/,+ );+ assert.match(group, /if \(!this\.menuOpen && !tabMenu\) return;[\s\S]*?tabMenu = null;/);});-test("a lone header orders tools before sharing and archive", () => {+test("a lone tab's header orders tools, sharing and archive before the pane controls, which fold when narrow", () => {const group = split.slice(split.indexOf("class GroupActions"), split.indexOf("function notePaneSession"));const render = group.slice(group.indexOf(" render("));- assert.match(render, /split-tools[\s\S]*?sessionActions\(sessionId, false, panel!\.id\)[\s\S]*?buttons\.map/);+ assert.match(+ render,+ /split-tools[\s\S]*?sessionActions\(sessionId, panel!\.id, "split-group-session-action"\)[\s\S]*?split-pane-actions-wide[\s\S]*?buttons\.filter\(\(b\) => !b\.cls\)/,+ );assert.match(css, /\.dv-single-tab \.split-tab-actions\s*\{\s*display: none/);- assert.match(css, /\.split-group-session-action\s*\{\s*display: none/);- assert.match(css, /\.dv-single-tab \.split-group-session-action\s*\{\s*display: inline-flex/);+ assert.match(css, /\.split-group-session-action\s*\{\s*display: inline-flex/);+ assert.match(css, /:not\(\.dv-single-tab\) \.split-group-session-action \{\s*display: none;/);+ assert.match(css, /@container pane-group \(max-width: 560px\) \{\s*\.split-pane-actions-wide \{\s*display: none;/);+ assert.match(css, /\.dockview-theme-qm \.dv-groupview \{[^}]*container: pane-group \/ inline-size;/);});test("session lists open sharing inline beside archive", () => {diff --git a/plugins/web-ui/test/single-view-navigation.test.ts b/plugins/web-ui/test/single-view-navigation.test.tsindex 5cca93780..b4002e280 100644--- a/plugins/web-ui/test/single-view-navigation.test.ts+++ b/plugins/web-ui/test/single-view-navigation.test.ts@@ -135,6 +135,7 @@ test("single and multiview headers render mutually exclusive tools and pane contconst actions = runInNewContext(compile(`${source}\nnew GroupActions();`), {document: { createElement: () => ({}), addEventListener: () => {} },groupActions: new Set(),+ tabMenu: null,dockApi,html,nothing: "",diff --git a/plugins/web-ui/test/split-tiles-and-titles.test.ts b/plugins/web-ui/test/split-tiles-and-titles.test.tsindex 20820cdf0..08761362e 100644--- a/plugins/web-ui/test/split-tiles-and-titles.test.ts+++ b/plugins/web-ui/test/split-tiles-and-titles.test.ts@@ -81,24 +81,37 @@ test("a pane title ellipsizes rather than being clipped or wrapped", () => {assert.match(css, /\.split-pane-title \{[^}]*min-width: 0;/);});-test("tabs share the strip evenly down to a legible floor", () => {+test("the active tab keeps a higher floor than its neighbours and runs down onto the body", () => {const multi = css.match(/:not\(\.dv-single-tab\) \.dv-tab \{[^}]*\}/)?.[0] ?? "";- assert.match(multi, /flex: 0 1 220px;/);- assert.match(multi, /min-width: 100px;/);+ assert.match(multi, /flex: 0 1 160px;/);+ assert.match(multi, /min-width: 72px;/);assert.match(multi, /max-width: 220px;/);+ const active = css.match(/:not\(\.dv-single-tab\) \.dv-tab\.dv-active-tab \{[^}]*\}/)?.[0] ?? "";+ assert.match(active, /flex: 0 1 260px;/);+ assert.match(active, /min-width: 150px;/);+ assert.match(active, /align-self: stretch;/);+ assert.match(active, /padding-bottom: var\(--split-strip-pad\);/);+ assert.match(active, /border-bottom-color: transparent;/);+ const strip =+ css.match(/^\.dockview-theme-qm \.dv-tabs-and-actions-container:not\(\.dv-single-tab\) \{[^}]*\}/m)?.[0] ?? "";+ assert.match(strip, /padding-bottom: 0;/);+ assert.match(strip, /border-bottom: 0;/);+ assert.match(+ strip,+ /linear-gradient\(var\(--split-strip-line\), var\(--split-strip-line\)\) bottom \/ 100% 1px no-repeat/,+ );});-test("tab actions overlay the title instead of reserving title space", () => {+test("tab actions sit in the title's flow so the title truncates around them", () => {const actions = css.match(/^\.split-tab-actions \{[^}]*\}/m)?.[0] ?? "";- assert.match(actions, /position: absolute;/);- assert.match(actions, /right: 0;/);- assert.match(actions, /background: color-mix\(in srgb, var\(--background\) 96%, transparent\);/);- assert.doesNotMatch(actions, /gradient|blur/);- assert.doesNotMatch(actions, /padding(?:-[\w-]+)?\s*:/, "the overlay must hug its action buttons");- assert.match(css, /\.dv-tab \.split-pane-title \{[^}]*position: relative;/);+ assert.doesNotMatch(actions, /position: absolute;|right: 0;|transform:/, "nothing may paint over the title");+ assert.match(actions, /flex: 0 0 auto;/);+ assert.doesNotMatch(css, /\.split-pane-title:has\(> \.session-status\) \.split-tab-actions/);+ assert.match(css, /\.split-pane-title-text \{[^}]*overflow: hidden;/);assert.match(css, /\.dv-tab \.split-pane-title \{[^}]*flex: 1 1 auto;/);const draw = split.slice(split.indexOf("class PaneTab"), split.indexOf("class StripDrop"));assert.equal((draw.match(/class="split-tab-actions"/g) ?? []).length, 2);+ assert.equal((draw.match(/split-tab-close/g) ?? []).length, 2, "each tab form carries exactly one close control");});test("the tab overflow menu is lifted above the panes and styled", () => {@@ -125,7 +138,7 @@ test("a pane tab carries the conversation's background chip, from the sidebar'sassert.match(css, /\.bg-chip\[role="button"\] \{[^}]*cursor: pointer;/);});-test("tab action overlays only fade on hover or keyboard focus", () => {+test("tab actions only fade on hover or keyboard focus, never shifting the title", () => {const actions = css.match(/^\.split-tab-actions \{[^}]*\}/m)?.[0] ?? "";assert.match(actions, /transition: opacity 0\.12s ease;/);assert.match(actions, /opacity: 0;/);diff --git a/plugins/web-ui/test/tab-archive-button.test.ts b/plugins/web-ui/test/tab-archive-button.test.tsindex b14a8f7fa..2df174bf4 100644--- a/plugins/web-ui/test/tab-archive-button.test.ts+++ b/plugins/web-ui/test/tab-archive-button.test.ts@@ -12,20 +12,13 @@ const fn = (src: string, name: string): string => {return body;};-test("a tab offers an archive button beside close, for real sessions only", () => {- assert.match(- split,- /this\.inStrip[\s\S]*?split-tab-actions[\s\S]*?sessionId \? sessionActions\(sessionId, true, panel\.id\)/,- );- const btn = fn(split, "sessionActions");- assert.match(btn, /archiveSessionById\(sessionId\)/);- assert.match(btn, /@pointerdown=[\s\S]*?if \(inTab\) e\.stopPropagation\(\)/);- assert.match(btn, /@click=[\s\S]*?if \(inTab\) e\.stopPropagation\(\)/);- const archiveAt = split.indexOf("split-tab-archive");- assert.ok(- archiveAt !== -1 && split.indexOf('tip("Close pane")', archiveAt) !== -1,- "archive sits before (next to) the close button",- );+test("a tab archives its own session through the shared action list", () => {+ const tab = split.slice(split.indexOf("class PaneTab"), split.indexOf("class StripDrop"));+ assert.match(tab, /split-tab-actions[\s\S]*?tip\("Close pane"\)/);+ assert.match(tab, /split-tab-session/);+ assert.doesNotMatch(tab, /archiveSessionById/);+ const items = fn(split, "sessionActionItems");+ assert.match(items, /split-tab-archive[\s\S]*?archiveSessionById\(sessionId\)/);});test("archiveSessionById routes through setArchived so surfaces close and Recents updates at once", () => {@@ -41,9 +34,10 @@ test("archiveSessionById routes through setArchived so surfaces close and Recent);});-test("a lone session keeps archive in the group header instead of the tab", () => {+test("archive lives in the header only while the tab is alone; tabs take it over", () => {const css = read("shell.css");assert.match(css, /\.dv-single-tab \.split-tab-actions\s*\{\s*display: none/);- assert.match(css, /\.dv-single-tab \.split-group-session-action\s*\{\s*display: inline-flex/);- assert.match(split, /sessionId \? sessionActions\(sessionId, false, panel!\.id\) : nothing/);+ assert.match(css, /\.split-group-session-action\s*\{\s*display: inline-flex/);+ assert.match(css, /:not\(\.dv-single-tab\) \.split-group-session-action \{\s*display: none;/);+ assert.match(split, /sessionId \? sessionActions\(sessionId, panel!\.id, "split-group-session-action"\) : nothing/);});