Multiplayer agent harness for work.
web-ui: a UI pass over the chat, inbox, settings, and sidebar surfaces (#976)
Eve Bouffardadf81a4ce21a
diff --git a/plugins/web-ui/package-lock.json b/plugins/web-ui/package-lock.jsonindex 5bd6f43ed..49d6b5535 100644--- a/plugins/web-ui/package-lock.json+++ b/plugins/web-ui/package-lock.json@@ -664,6 +664,7 @@}],"license": "MIT",+ "peer": true,"engines": {"node": ">=20.19.0"},@@ -712,6 +713,7 @@}],"license": "MIT",+ "peer": true,"engines": {"node": ">=20.19.0"}@@ -1333,6 +1335,7 @@"version": "0.2.1","resolved": "https://registry.npmjs.org/@mariozechner/mini-lit/-/mini-lit-0.2.1.tgz","integrity": "sha512-u300euLgCsDDlb8o2Wbz+55eSJga5X2vB58s9XBuFIr2Bi3iI+GMR7t/NYo/O6Vr6obXShXgYjR3SRUJVgo+kQ==",+ "peer": true,"dependencies": {"@preact/signals-core": "^1.12.1","class-variance-authority": "^0.7.1",@@ -2952,6 +2955,7 @@"resolved": "https://registry.npmjs.org/lit/-/lit-3.3.3.tgz","integrity": "sha512-fycuvZg/hkpozL00lm1pEJH5nN/lr9ZXd6mJI2HSN4+Bzc+LDNdEApJ6HFbPkdFNHLvOplIIuJvxkS4XUxqirw==","license": "BSD-3-Clause",+ "peer": true,"dependencies": {"@lit/reactive-element": "^2.1.0","lit-element": "^4.2.0",@@ -3189,6 +3193,7 @@"integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==","dev": true,"license": "MIT",+ "peer": true,"engines": {"node": ">=12"},@@ -3449,6 +3454,7 @@"resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.6.0.tgz","integrity": "sha512-uxL7qAVQriqRQPAyK3pj66VqskWqoZ37PW94jwOTwNfq/z9oyu1V+eqrZqtR2+fCiXdYOZe/Modt8GtvqNzu+w==","license": "MIT",+ "peer": true,"funding": {"type": "github","url": "https://github.com/sponsors/dcastil"@@ -3829,6 +3835,7 @@"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz","integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==","license": "MIT",+ "peer": true,"funding": {"url": "https://github.com/sponsors/colinhacks"}diff --git a/plugins/web-ui/src/chat.ts b/plugins/web-ui/src/chat.tsindex c21e6a185..c57445d6c 100644--- a/plugins/web-ui/src/chat.ts+++ b/plugins/web-ui/src/chat.ts@@ -128,6 +128,7 @@ import { createForkOriginController, forkOriginView } from "./fork-origin";import { base64ToBytes } from "./paste-text";import { tip } from "./tooltip";import { workSeconds, workedLabel } from "./work-duration";+import { markClampedPrompts } from "./prompt-clamp";import { decorateTextCodeBlocks, normalizePlainTextFences } from "./text-code";import { createTranscriptViewport } from "./transcript-viewport";@@ -150,6 +151,7 @@ interface SettledRowKey {speakerLabel: string | undefined;edited: boolean;deleted: boolean;+ expanded: boolean;tpl: TemplateResult | typeof nothing;}const settledRowCache = new WeakMap<object, SettledRowKey>();@@ -219,6 +221,7 @@ export function createChatSurface(inheritedLoaded: false,pins: [] as SessionPin[],pinsExpanded: false,+ expandedPrompt: null as number | null,labelSpeakers: false,};@@ -398,6 +401,7 @@ export function createChatSurface(chatState.earlierCount = 0;chatState.loadingEarlier = false;chatState.pins = [];+ chatState.expandedPrompt = null;chatState.host = document.createElement("div");chatState.host.className = "custom-chat";@@ -929,6 +933,7 @@ export function createChatSurface(if (!sameSession) {chatState.inheritedExpanded = false;chatState.pins = [];+ chatState.expandedPrompt = null;}syncLocation();@@ -1029,6 +1034,7 @@ export function createChatSurface();requestAnimationFrame(() => {decorateTextCodeBlocks(host);+ markClampedPrompts(host);if (host.isConnected) transcriptViewport.sync(host.querySelector<HTMLElement>(".chat-scroll"));});};@@ -1069,6 +1075,12 @@ export function createChatSurface(else readonlyRedraw?.();}+ function togglePromptExpanded(index: number): void {+ chatState.expandedPrompt = chatState.expandedPrompt === index ? null : index;+ if (chatState.agent) drawActiveChat(chatState.agent);+ else readonlyRedraw?.();+ }+function linkifiedText(text: string): TemplateResult {return html`${splitLinks(text).map((seg) =>seg.kind === "link"@@ -1286,7 +1298,10 @@ export function createChatSurface(chatState.host,);decorateStreamingTail();- requestAnimationFrame(() => decorateTextCodeBlocks(chatState.host));+ requestAnimationFrame(() => {+ decorateTextCodeBlocks(chatState.host);+ markClampedPrompts(chatState.host);+ });ctx.composer.resizeComposer();scrollTranscript(opts.forceScroll);postCurrentPaneState();@@ -1422,6 +1437,7 @@ export function createChatSurface(const speakerLabel = speakerLabelFor(message);const edited = Boolean((message as { edited?: boolean }).edited);const deleted = Boolean((message as { deleted?: boolean }).deleted);+ const expanded = chatState.expandedPrompt === index;const hit = settledRowCache.get(message as object);if (hit &&@@ -1437,7 +1453,8 @@ export function createChatSurface(hit.forkable === forkable &&hit.speakerLabel === speakerLabel &&hit.edited === edited &&- hit.deleted === deleted+ hit.deleted === deleted &&+ hit.expanded === expanded) {return hit.tpl;}@@ -1456,6 +1473,7 @@ export function createChatSurface(speakerLabel,edited,deleted,+ expanded,tpl,});return tpl;@@ -1476,10 +1494,21 @@ export function createChatSurface(<article class="message-row user-row ${steered ? "steered-row" : ""}" data-index=${index}>${steered ? html`<div class="steer-label">↪ steered the running task</div>` : nothing}${speaker ? html`<div class="speaker-label">${speaker}</div>` : nothing}- <div class="message-bubble user-bubble ${deleted ? "deleted-bubble" : ""}">+ <div+ class="message-bubble user-bubble ${deleted ? "deleted-bubble" : ""}"+ data-expanded=${chatState.expandedPrompt === index ? "true" : "false"}+ >${isReadOnlySlackView() ? slackWireBubble(messageText(message)) : markdown(messageText(message))}${attachments.length ? html`<div class="message-files">${attachments.map(userAttachmentBadge)}</div>` : nothing}${edited || deleted ? html`<span class="revision-badge">(${deleted ? "deleted" : "edited"})</span>` : nothing}+ <button+ class="prompt-toggle"+ type="button"+ aria-expanded=${chatState.expandedPrompt === index ? "true" : "false"}+ @click=${() => togglePromptExpanded(index)}+ >+ ${chatState.expandedPrompt === index ? "Show less" : "Show more"}+ </button></div>${sendFailurediff --git a/plugins/web-ui/src/contexts.ts b/plugins/web-ui/src/contexts.tsindex 06455c4bf..88ce60c53 100644--- a/plugins/web-ui/src/contexts.ts+++ b/plugins/web-ui/src/contexts.ts@@ -2,8 +2,6 @@ import { html, nothing, render, type TemplateResult } from "lit";import {ArrowLeft,Boxes,- Check,- ChevronDown,Folder,FolderPlus,Hash,@@ -27,7 +25,7 @@ import {} from "./core-bridge";import { UI_BASE } from "./deep-link";import { errMessage } from "../../chassis/src/errors";-import { actionSnippet, closeFormMenus, fieldSelect, formatBytes, icon, initials, relTime, toggleFormMenu } from "./ui";+import { actionSnippet, fieldSelect, formatBytes, icon, initials, menuSelect, relTime } from "./ui";import { appState, replacePanePreservingFocus, switchView, syncUrlFromState } from "./shell";import { startNewChat } from "./sessions";import { groupDmTitle, openSession, refreshSessions, sessionsState, slackLogo, surfaceOf } from "./sessions";@@ -274,38 +272,21 @@ export function scopeChip(scopeId: string | null, fallbackName?: string | null):}export function scopeFilterControl(current: string | null, onSelect: (scopeId: string | null) => void): TemplateResult {- const label = current ? metaForScope(current).title : "All contexts";- const option = (scopeId: string | null, text: string, glyph: IconNode) => {- const active = (current ?? null) === scopeId;- return html`- <button- class="menu-option ${active ? "active" : ""}"- type="button"- role="menuitemradio"- aria-checked=${active ? "true" : "false"}- @click=${(e: Event) => {- e.stopPropagation();- closeFormMenus();- onSelect(scopeId);- }}- >- <span class="menu-option-label scope-option-label">${icon(glyph, 14)}<span>${text}</span></span>- ${active ? icon(Check, 15) : nothing}- </button>- `;- };- return html`- <div class="menu-control form-menu-control scope-filter">- <button class="menu-button" type="button" aria-haspopup="menu" aria-expanded="false" @click=${toggleFormMenu}>- <span class="menu-label">Filter by: ${label}</span>${icon(ChevronDown, 14)}- </button>- <div class="menu-popover" role="menu" hidden>- <div class="menu-title">Filter by context</div>- ${option(null, "All contexts", Boxes)}- ${contextsState.list.map((c) => option(c.scopeId, contextMeta(c).title, contextMeta(c).glyph))}- </div>- </div>- `;+ return menuSelect({+ value: current,+ prefix: "Filter by: ",+ ariaLabel: "Filter by context",+ className: "scope-filter",+ onSelect,+ options: [+ { value: null, label: "All contexts", glyph: Boxes },+ ...contextsState.list.map((c) => ({+ value: c.scopeId,+ label: contextMeta(c).title,+ glyph: contextMeta(c).glyph,+ })),+ ],+ });}function sessionsIn(scopeId: string): CoreSession[] {diff --git a/plugins/web-ui/src/crons.ts b/plugins/web-ui/src/crons.tsindex 1061ae5ee..32ee7c42b 100644--- a/plugins/web-ui/src/crons.ts+++ b/plugins/web-ui/src/crons.ts@@ -362,7 +362,7 @@ function cronPageRow(c: CronView, mine: boolean): TemplateResult {function cronRowActions(c: CronView): TemplateResult {let stateAction = html`<button- class="icon-btn subtle cron-action-btn"+ class="icon-btn subtle compact"type="button"${tip("Enable")}aria-label="Enable cron"@@ -374,7 +374,7 @@ function cronRowActions(c: CronView): TemplateResult {if (c.archived) {stateAction = html`<button- class="icon-btn subtle cron-action-btn"+ class="icon-btn subtle compact"type="button"${tip("Unarchive")}aria-label="Unarchive cron"@@ -386,7 +386,7 @@ function cronRowActions(c: CronView): TemplateResult {} else if (c.enabled) {stateAction = html`<button- class="icon-btn subtle cron-action-btn"+ class="icon-btn subtle compact"type="button"${tip("Disable")}aria-label="Disable cron"@@ -399,7 +399,7 @@ function cronRowActions(c: CronView): TemplateResult {return html`<div class="cron-row-actions" aria-label="Cron actions"><button- class="icon-btn subtle cron-action-btn"+ class="icon-btn subtle compact"type="button"${tip("Edit")}aria-label="Edit cron"@@ -416,7 +416,7 @@ function cronRowActions(c: CronView): TemplateResult {? nothing: html`<button- class="icon-btn subtle cron-action-btn"+ class="icon-btn subtle compact"type="button"${tip("Archive")}aria-label="Archive cron"diff --git a/plugins/web-ui/src/inbox.ts b/plugins/web-ui/src/inbox.tsindex 22e7db0fb..2b9b25328 100644--- a/plugins/web-ui/src/inbox.ts+++ b/plugins/web-ui/src/inbox.ts@@ -27,7 +27,7 @@ import { listBackLink } from "./list-page";import { registerPaneKind } from "./pane-kinds";import { beginPaneKindDrag, endPaneDrag, exitSplitIfActive, notifyPanesChanged } from "./split";import { tip } from "./tooltip";-import { brandName, icon, initials, relTime, slackMark } from "./ui";+import { brandName, icon, initials, relTime, slackMark, workingWave } from "./ui";export type InboxSource = "gmail" | "slack";@@ -130,6 +130,10 @@ export const inboxState = {syncBusy: false,};+const DRAFT_SUGGESTIONS = ["Make it shorter", "Make it more friendly", "Remove the salutations"];+const ASIDE_MIN_HEIGHT = 320;+const ASIDE_MAX_HEIGHT = 1100;+const CHAT_INPUT_MAX_HEIGHT = 200;const draftEdits = new Map<string, InboxDraft & { basedOnAt?: number }>();const sending = new Set<string>();const acting = new Set<string>();@@ -387,6 +391,17 @@ function notify(msg: string | null): void {}}+function draftSubject(item: InboxItem, draft: InboxDraft): string {+ if (draft.subject !== undefined) return draft.subject;+ return item.gmail?.subject ? `Re: ${item.gmail.subject.replace(/^re:\s*/i, "")}` : "";+}++function headerPeek(item: InboxItem, draft: InboxDraft): string {+ const to = (draft.to ?? []).join(", ");+ const subject = draftSubject(item, draft);+ return [to, subject].filter(Boolean).join(" · ") || "Recipients and subject";+}+function effectiveDraft(item: InboxItem): InboxDraft {const edited = draftEdits.get(item.id);if (edited) {@@ -705,7 +720,7 @@ export function slackTextTpl(item: InboxItem, text: string, opts: { links?: boolreturn html`${splitSlackWire(text).map((seg) => {if (seg.kind === "mention") return mentionChip(seg.handle);if (seg.kind === "link") {- if (opts.links === false) return html`<span title=${seg.href}>${withMentions(seg.label)}</span>`;+ if (opts.links === false) return html`<span ${tip(seg.href)}>${withMentions(seg.label)}</span>`;return html`<a class="inbox-text-link" href=${seg.href} target="_blank" rel="noreferrer noopener">${withMentions(seg.label)}</a>`;@@ -754,19 +769,14 @@ export function contextTpl(item: InboxItem): TemplateResult | typeof nothing {</div>`;}-function syncAskEnabled(box: HTMLTextAreaElement): void {- const composer = box.closest(".inbox-chat-composer");- const send = composer?.querySelector<HTMLButtonElement>(".inbox-chat-send");- if (send) send.disabled = !box.value.trim();- composer?.classList.toggle("has-text", !!box.value.trim());-}-export function chatTpl(item: InboxItem): TemplateResult {const busy = chatting.has(item.id);const pending = chatDrafts.get(item.id) ?? "";const submit = (el: HTMLTextAreaElement): void => {+ if (busy) return;const text = el.value;el.value = "";+ autosizeChatInput(el);void askAgent(item, text);};const empty = item.thread.length === 0;@@ -774,7 +784,22 @@ export function chatTpl(item: InboxItem): TemplateResult {<div class="inbox-chat">${empty- ? html`<h2 class="inbox-chat-cta">What should I change?</h2>`+ ? html`<div class="inbox-chat-empty">+ <h2 class="inbox-chat-cta">What should I change?</h2>+ <div class="inbox-chat-suggestions">+ ${DRAFT_SUGGESTIONS.map(+ (prompt) =>+ html`<button+ class="inbox-chat-suggestion"+ type="button"+ ?disabled=${busy}+ @click=${() => void askAgent(item, prompt)}+ >+ ${prompt}+ </button>`,+ )}+ </div>+ </div>`: html`<div class="inbox-chat-log">${item.thread.map((m) =>@@ -784,18 +809,19 @@ export function chatTpl(item: InboxItem): TemplateResult {)}</div>`}- ${busy ? html`<div class="inbox-chat-working">Thinking…</div>` : nothing}+ ${busy ? html`<div class="inbox-chat-working">${workingWave()}<span>Thinking…</span></div>` : nothing}<div class="inbox-chat-composer ${pending.trim() ? "has-text" : ""}"><textareaclass="inbox-chat-input"rows="1"placeholder=${`Ask ${brandName()} for something`}.value=${pending}- ?disabled=${busy}@input=${(e: Event) => {const box = e.currentTarget as HTMLTextAreaElement;+ const had = Boolean((chatDrafts.get(item.id) ?? "").trim());chatDrafts.set(item.id, box.value);- syncAskEnabled(box);+ autosizeChatInput(box);+ if (had !== Boolean(box.value.trim())) drawAll();}}@keydown=${(e: KeyboardEvent) => {if (e.key === "Enter" && !e.shiftKey) {@@ -881,38 +907,43 @@ export function draftEditorTpl(item: InboxItem, opts: { chat?: boolean } = {}):${gmail? html`- <label class="inbox-field">- <span>To</span>- <input- type="text"- .value=${(draft.to ?? []).join(", ")}- placeholder="[email protected]"- @input=${(e: Event) => editDraft(item, { to: splitAddresses((e.currentTarget as HTMLInputElement).value) })}- @blur=${() => void persistDraft(item)}- />- </label>- ${- showCc- ? html`<label class="inbox-field">- <span>Cc</span>- <input- type="text"- .value=${(draft.cc ?? []).join(", ")}- @input=${(e: Event) => editDraft(item, { cc: splitAddresses((e.currentTarget as HTMLInputElement).value) })}- @blur=${() => void persistDraft(item)}- />- </label>`- : nothing- }- <label class="inbox-field">- <span>Subject</span>- <input- type="text"- .value=${draft.subject ?? (item.gmail?.subject ? `Re: ${item.gmail.subject.replace(/^re:\s*/i, "")}` : "")}- @input=${(e: Event) => editDraft(item, { subject: (e.currentTarget as HTMLInputElement).value })}- @blur=${() => void persistDraft(item)}- />- </label>+ <details class="inbox-draft-headers">+ <summary><span class="inbox-draft-headers-peek">${headerPeek(item, draft)}</span></summary>+ <div class="inbox-draft-headers-fields">+ <label class="inbox-field">+ <span>To</span>+ <input+ type="text"+ .value=${(draft.to ?? []).join(", ")}+ placeholder="[email protected]"+ @input=${(e: Event) => editDraft(item, { to: splitAddresses((e.currentTarget as HTMLInputElement).value) })}+ @blur=${() => void persistDraft(item)}+ />+ </label>+ ${+ showCc+ ? html`<label class="inbox-field">+ <span>Cc</span>+ <input+ type="text"+ .value=${(draft.cc ?? []).join(", ")}+ @input=${(e: Event) => editDraft(item, { cc: splitAddresses((e.currentTarget as HTMLInputElement).value) })}+ @blur=${() => void persistDraft(item)}+ />+ </label>`+ : nothing+ }+ <label class="inbox-field">+ <span>Subject</span>+ <input+ type="text"+ .value=${draftSubject(item, draft)}+ @input=${(e: Event) => editDraft(item, { subject: (e.currentTarget as HTMLInputElement).value })}+ @blur=${() => void persistDraft(item)}+ />+ </label>+ </div>+ </details>`: nothing}@@ -1045,25 +1076,25 @@ function syncLineTpl(): TemplateResult {return html`<buttonclass="btn inbox-sync-setup"type="button"+ ${tip("Create the inbox loop and the personal cron that scans your connected apps and drafts replies")}?disabled=${inboxState.syncBusy}@click=${() => void setUpSync()}- title="Create the inbox loop and the personal cron that scans your connected apps and drafts replies">${icon(RefreshCw, 13)}<span>${inboxState.syncBusy ? "Setting up…" : "Set up sync"}</span></button>`;}return html`<span class="inbox-sync-line"><button- class="icon-btn subtle"+ class="icon-btn subtle compact"type="button"- title="Sync now"+ ${tip("Sync now")}aria-label="Sync now"?disabled=${inboxState.syncBusy}@click=${() => void syncNow()}>- ${icon(RefreshCw, 13)}+ ${icon(RefreshCw, 14)}</button>- <span title=${cron.enabled ? "The sync cron is on" : "The sync cron is paused. Manage it under Crons"}>+ <span ${tip(cron.enabled ? "The sync cron is on" : "The sync cron is paused. Manage it under Crons")}>${syncStatusLabel(cron)}</span></span>`;@@ -1209,9 +1240,11 @@ function keepingChatLogsPinned(host: HTMLElement, draw: () => void): void {function drawSurface(surface: InboxSurface): void {if (!surface.host.isConnected && surface.pane) return;keepingChatLogsPinned(surface.host, () => render(surfaceTpl(surface), surface.host));+ sizeChatInputs(surface.host);}let fullSurface: InboxSurface | null = null;+let asideObserver: ResizeObserver | null = null;let fullViewId = "all";let pendingItemId: string | null = null;@@ -1229,6 +1262,7 @@ function drawFull(): void {showHandled: fullSurface?.showHandled ?? false,};appState.mainEl.replaceChildren(host);+ observeAsideSize(host);}fullSurface.viewId = fullViewId;if (pendingItemId) {@@ -1246,10 +1280,7 @@ function drawFull(): void {? itemPageTpl(openItem): html`<div class="pane-head">- <div>- <h1 class="pane-title">Inbox</h1>- <div class="pane-subtitle">Everything waiting on a reply from you, drafted and ready to send.</div>- </div>+ <h1 class="pane-title">Inbox</h1><div class="pane-head-actions">${syncLineTpl()}</div></div>${surfaceTpl(surface)}@@ -1257,6 +1288,46 @@ function drawFull(): void {host,),);+ sizeAside(host);+ sizeChatInputs(host);+}++/**+ * The assistant sticks to the top of a page that now scrolls, so its height is+ * the viewport below wherever it starts rather than a share of a fixed frame.+ */+function sizeAside(host: HTMLElement): void {+ if (!host.querySelector(".inbox-item-aside")) return;+ const pad = getComputedStyle(host);+ const padTop = Number.parseFloat(pad.paddingTop) || 0;+ const padBottom = Number.parseFloat(pad.paddingBottom) || 0;+ const available = host.clientHeight - padTop - padBottom;+ const height = Math.min(ASIDE_MAX_HEIGHT, Math.max(ASIDE_MIN_HEIGHT, available));+ const next = `${height}px`;+ if (host.style.getPropertyValue("--inbox-aside-height") === next) return;+ host.style.setProperty("--inbox-aside-height", next);+}++function observeAsideSize(host: HTMLElement): void {+ if (typeof ResizeObserver === "undefined") return;+ asideObserver?.disconnect();+ asideObserver = new ResizeObserver(() => {+ sizeAside(host);+ sizeChatInputs(host);+ });+ asideObserver.observe(host);+}++function autosizeChatInput(box: HTMLTextAreaElement): void {+ box.style.height = "auto";+ const cap = Number.parseFloat(getComputedStyle(box).maxHeight) || CHAT_INPUT_MAX_HEIGHT;+ const content = box.scrollHeight;+ box.style.height = `${Math.min(cap, content)}px`;+ box.style.overflowY = content > cap ? "auto" : "hidden";+}++function sizeChatInputs(host: HTMLElement): void {+ for (const box of host.querySelectorAll<HTMLTextAreaElement>(".inbox-chat-input")) autosizeChatInput(box);}function syncItemUrl(itemId: string | null, push = false): void {@@ -1267,13 +1338,16 @@ function syncItemUrl(itemId: string | null, push = false): void {else history.replaceState(null, "", next);}-function closeInboxItem(): void {+export function resetActiveInboxItem(): void {const open = fullSurface?.selectedId;- if (open) {- const item = inboxState.items.find((i) => i.id === open);- if (item) void persistDraft(item);- }- if (fullSurface) fullSurface.selectedId = null;+ if (!open || !fullSurface) return;+ const item = inboxState.items.find((i) => i.id === open);+ if (item) void persistDraft(item);+ fullSurface.selectedId = null;+}++function closeInboxItem(): void {+ resetActiveInboxItem();syncItemUrl(null);drawAll();}diff --git a/plugins/web-ui/src/prompt-clamp.ts b/plugins/web-ui/src/prompt-clamp.tsnew file mode 100644index 000000000..4458bc8b9--- /dev/null+++ b/plugins/web-ui/src/prompt-clamp.ts@@ -0,0 +1,11 @@+const PINNED_BUBBLE = ".message-stack .user-row:not(:has(~ .user-row)) .user-bubble";++export function markClampedPrompts(root: ParentNode | null): void {+ if (!root) return;+ for (const bubble of root.querySelectorAll<HTMLElement>(PINNED_BUBBLE)) {+ if (bubble.dataset.expanded === "true") continue;+ const body = bubble.querySelector<HTMLElement>(":scope > markdown-block, :scope > .slack-wire-text");+ if (!body) continue;+ bubble.dataset.clamped = String(body.scrollHeight - body.clientHeight > 1);+ }+}diff --git a/plugins/web-ui/src/sessions.ts b/plugins/web-ui/src/sessions.tsindex 4c5e2cae7..db1d3fcb5 100644--- a/plugins/web-ui/src/sessions.ts+++ b/plugins/web-ui/src/sessions.ts@@ -65,7 +65,7 @@ import {} from "./session-list";import { tip } from "./tooltip";import { errMessage } from "../../chassis/src/errors";-import { copyText, fieldSelect, icon, relTime, workingWave } from "./ui";+import { copyText, icon, menuSelect, relTime, workingWave } from "./ui";import { listPageTpl } from "./list-page";import {contextsState,@@ -372,6 +372,7 @@ export function renderList(): void {const NEW_CHAT_TOOLTIP = "Start a new chat";const PROJECT_OPTIONS_TOOLTIP = "Project options";+const CHAT_OPTIONS_TOOLTIP = "Chat options";function newChatHint(name: string): string {return `Start a new chat in ${name}`;@@ -608,18 +609,17 @@ export function drawChatsPage(): void {)}</div><div class="list-select">- ${fieldSelect({- compact: true,- ariaLabel: "Filter by surface",+ ${menuSelect({value: chatsPageSurface,- onChange: (value) => {- chatsPageSurface = value as typeof chatsPageSurface;+ ariaLabel: "Filter by surface",+ onSelect: (value) => {+ chatsPageSurface = (value ?? "all") as typeof chatsPageSurface;drawChatsPage();},options: [- html`<option value="all">All surfaces</option>`,- html`<option value="web">Web</option>`,- html`<option value="slack">Slack</option>`,+ { value: "all", label: "All surfaces" },+ { value: "web", label: "Web" },+ { value: "slack", label: "Slack" },],})}</div>@@ -953,6 +953,7 @@ function sessionRow(s: CoreSession, projectChild = false): TemplateResult {<buttonclass="session-menu-btn session-archive-btn"type="button"+ ${tip(s.archived ? "Unarchive" : "Archive")}aria-label=${`${s.archived ? "Unarchive" : "Archive"} ${sessionTitle(s)}`}@click=${(e: Event) => {e.stopPropagation();@@ -965,6 +966,7 @@ function sessionRow(s: CoreSession, projectChild = false): TemplateResult {class="session-menu-btn"data-menu-id=${s.id}type="button"+ ${tip(CHAT_OPTIONS_TOOLTIP)}aria-label=${`Options for ${sessionTitle(s)}`}aria-haspopup="menu"aria-expanded=${menuOpen ? "true" : "false"}@@ -1225,7 +1227,7 @@ export function sessionSelectionBar(): TemplateResult | null {<buttonclass="icon-btn"type="button"- title="Clear selection (Esc)"+ ${tip("Clear selection (Esc)")}aria-label="Clear selection"@click=${() => clearSessionSelection()}>@@ -1237,7 +1239,7 @@ export function sessionSelectionBar(): TemplateResult | null {<buttonclass="icon-btn"type="button"- title=${allPinned ? "Unpin selected" : "Pin selected"}+ ${tip(allPinned ? "Unpin selected" : "Pin selected")}aria-label=${allPinned ? "Unpin selected conversations" : "Pin selected conversations"}@click=${() => void bulkPatch({ pinned: !allPinned })}>@@ -1247,7 +1249,7 @@ export function sessionSelectionBar(): TemplateResult | null {<buttonclass="icon-btn"type="button"- title="Color selected"+ ${tip("Color selected")}aria-label="Color selected conversations"aria-haspopup="true"aria-expanded=${selectColorOpen ? "true" : "false"}@@ -1263,7 +1265,7 @@ export function sessionSelectionBar(): TemplateResult | null {<buttonclass="icon-btn"type="button"- title=${allArchived ? "Unarchive selected" : "Archive selected"}+ ${tip(allArchived ? "Unarchive selected" : "Archive selected")}aria-label=${allArchived ? "Unarchive selected conversations" : "Archive selected conversations"}@click=${() => void bulkPatch({ archived: !allArchived })}>@@ -1296,7 +1298,7 @@ function colorPopover(): TemplateResult {class="color-swatch"type="button"style=${`--swatch:${c}`}- title=${`Color selected ${c}`}+ ${tip(`Color selected ${c}`)}aria-label=${`Color selected conversations ${c}`}@click=${() => void bulkPatch({ color: c })}></button>@@ -1305,7 +1307,7 @@ function colorPopover(): TemplateResult {<buttonclass="color-swatch clear"type="button"- title="Clear color"+ ${tip("Clear color")}aria-label="Clear color on selected conversations"@click=${() => void bulkPatch({ color: null })}>diff --git a/plugins/web-ui/src/settings.ts b/plugins/web-ui/src/settings.tsindex 8da128889..5ea9e37d3 100644--- a/plugins/web-ui/src/settings.ts+++ b/plugins/web-ui/src/settings.ts@@ -1,5 +1,5 @@import { html, nothing, render, type TemplateResult } from "lit";-import { BookOpen, ExternalLink, LogOut, Monitor, Moon, ShieldUser, Sun, Trash2, Upload, type IconNode } from "lucide";+import { BookOpen, ExternalLink, LogOut, Monitor, Moon, ShieldUser, Sun, type IconNode } from "lucide";import { icon } from "./ui";import { ADMIN_HOME_URL, appState, can, signOut } from "./shell";import { sessionsState, setWebOnly } from "./sessions";@@ -171,25 +171,25 @@ function themeRow(): TemplateResult {@change=${(e: Event) => void onThemeFileChosen(e)}/><button- class="btn settings-row-action"+ class="settings-theme-link"type="button"@click=${(e: Event) =>(e.currentTarget as HTMLElement).parentElement?.querySelector<HTMLInputElement>(".theme-file-input")?.click()}>- ${icon(Upload, 15)}<span>${custom ? "Replace theme file…" : "Import theme file…"}</span>+ ${custom ? "Replace theme file" : "Import theme file"}</button>${custom? html`<button- class="btn settings-row-action"+ class="settings-theme-link"type="button"aria-label="Remove imported theme"@click=${() => removeCustomTheme()}>- ${icon(Trash2, 15)}<span>Remove</span>+ Remove</button>`: nothingdiff --git a/plugins/web-ui/src/shell.css b/plugins/web-ui/src/shell.cssindex ceabc2641..fa4bc4acd 100644--- a/plugins/web-ui/src/shell.css+++ b/plugins/web-ui/src/shell.css@@ -14,7 +14,7 @@--chat-surface-shadow: 0 2px 5px rgb(0 0 0 / 0.08), 0 8px 24px rgb(0 0 0 / 0.1);/* Height reserved at the bottom of every chat message for its own hover footer; it doublesas the rhythm between message blocks. */- --meta-lane: 18px;+ --meta-lane: 24px;--brand-accent: #4f46e5;--dev-accent: #8a5a00;--brand-mark: none;@@ -23,6 +23,7 @@--cta-foreground: oklch(0.99 0 0);--success: #1a7f37;--warning: #a66700;+ --scrim: oklch(0.145 0 0);}.dark {@@ -31,6 +32,7 @@--cta-foreground: oklch(0.99 0 0);--success: #3fb950;--warning: #d29922;+ --scrim: oklch(0.11 0.03 250);--background: oklch(0.165 0.022 250);--foreground: oklch(0.975 0.005 250);@@ -40,6 +42,7 @@--muted: oklch(0.245 0.024 250);--muted-foreground: oklch(0.72 0.021 250);--accent: oklch(0.36 0.03 250);+ --accent-foreground: oklch(0.8 0.07 250);--border: oklch(0.275 0.024 250);--input: oklch(0.325 0.026 250);--sidebar: oklch(0.205 0.024 250);@@ -969,6 +972,10 @@ a.chat-row-open {.settings-row:last-child {border-bottom: 0;}+.settings-row-copy {+ flex: 1 1 260px;+ min-width: 0;+}.settings-row-title {font-size: 14px;}@@ -1016,14 +1023,28 @@ a.chat-row-open {}.settings-theme-controls {display: flex;- align-items: center;- justify-content: flex-end;- flex-wrap: wrap;- gap: 8px;+ flex-direction: column;+ align-items: flex-end;+ margin-left: auto;+ gap: 7px;}.settings-theme-import {display: inline-flex;- gap: 6px;+ gap: 12px;+}+.settings-theme-link {+ padding: 0;+ border: 0;+ background: none;+ color: var(--muted-foreground);+ cursor: pointer;+ font: inherit;+ font-size: 12.5px;+ text-decoration: underline;+ text-underline-offset: 2px;+}+.settings-theme-link:hover {+ color: var(--foreground);}.settings-row-error {color: var(--destructive, #c0392b);@@ -1309,6 +1330,11 @@ a.chat-row-open {.icon-btn.subtle {color: var(--muted-foreground);}+.icon-btn.compact {+ width: 28px;+ height: 28px;+ min-width: 28px;+}.chat-scroll {isolation: isolate;--chat-scroll-pad-top: 8px;@@ -1621,7 +1647,7 @@ a.chat-row-open {z-index: 4;display: flex;align-items: center;- gap: 6px;+ gap: 8px;height: var(--meta-lane);padding: 0 2px;border-radius: 6px;@@ -1751,17 +1777,46 @@ a.chat-row-open {flex-direction: column;max-height: 40cqh;}+.message-stack .user-row:not(:has(~ .user-row)) .user-bubble[data-expanded="true"] {+ max-height: none;+}.message-stack .user-row:not(:has(~ .user-row)) .user-bubble > markdown-block,.message-stack .user-row:not(:has(~ .user-row)) .user-bubble > .slack-wire-text {flex-shrink: 1000;min-height: 0;- overflow-y: auto;+ overflow: hidden;+}+.message-stack .user-row:not(:has(~ .user-row)) .user-bubble[data-expanded="true"] > markdown-block,+.message-stack .user-row:not(:has(~ .user-row)) .user-bubble[data-expanded="true"] > .slack-wire-text {+ overflow: visible;}.message-stack .user-row:not(:has(~ .user-row)) .user-bubble > .message-files {min-height: 0;max-height: 20cqh;overflow-y: auto;}+.prompt-toggle {+ display: none;+ align-self: flex-start;+ flex-shrink: 0;+ margin-top: 6px;+ padding: 0;+ border: 0;+ background: transparent;+ color: var(--muted-foreground);+ font: inherit;+ font-size: 12px;+ cursor: pointer;+}+.prompt-toggle:hover {+ color: var(--foreground);+ text-decoration: underline;+}+.message-stack .user-row:not(:has(~ .user-row)) .user-bubble[data-clamped="true"] > .prompt-toggle,+.message-stack .user-row:not(:has(~ .user-row)) .user-bubble[data-expanded="true"] > .prompt-toggle {+ display: block;+}+.message-files,.attachment-strip {display: flex;@@ -2779,8 +2834,6 @@ a.chat-row-open {.user-bubble code-block.text-code-collapsible[data-expanded="false"] .text-code-body {max-height: 76px;overflow: hidden;- mask-image: linear-gradient(to bottom, #000, rgb(0 0 0 / 0.74) 38%, rgb(0 0 0 / 0.32) 68%, transparent);- -webkit-mask-image: linear-gradient(to bottom, #000, rgb(0 0 0 / 0.74) 38%, rgb(0 0 0 / 0.32) 68%, transparent);}.text-code-toggle {margin-left: auto;@@ -4133,7 +4186,7 @@ a.chat-row-open {justify-content: center;width: auto;padding: 24px;- background: color-mix(in srgb, #000 42%, transparent);+ background: color-mix(in srgb, var(--scrim) 42%, transparent);}.kc-confirm {width: min(430px, 100%);@@ -4535,7 +4588,7 @@ a.chat-row-open {padding: 0;border: 0;border-radius: 0;- background: color-mix(in srgb, var(--foreground) 24%, transparent);+ background: color-mix(in srgb, var(--scrim) 24%, transparent);}.layout.sidebar-closed .sidebar-scrim {display: none;@@ -4890,12 +4943,17 @@ a.chat-row-open {flex-direction: column;gap: 4px;color: var(--muted-foreground);+}+.list-select > span:not(.field-select) {font-size: 11px;font-weight: 600;}.list-select .field-select {min-width: 124px;}+.list-select .field-menu .menu-button {+ min-width: 124px;+}.resource-tabs {width: min(960px, 100%);margin: 16px auto 0;@@ -5505,10 +5563,10 @@ a.chat-row-open {justify-content: center;padding: var(--dialog-pad-top) var(--dialog-pad-right) var(--dialog-pad-bottom) var(--dialog-pad-left);box-sizing: border-box;- background: color-mix(in srgb, var(--foreground) 28%, transparent);+ background: color-mix(in srgb, var(--scrim) 28%, transparent);}.project-dialog::backdrop {- background: color-mix(in srgb, var(--foreground) 28%, transparent);+ background: color-mix(in srgb, var(--scrim) 28%, transparent);}.project-dialog {/* Tailwind's preflight zeroes every margin, which strips the UA centering from@@ -6352,11 +6410,6 @@ a.chat-row-open {pointer-events: auto;}}-.cron-action-btn {- width: 28px;- height: 28px;- min-width: 28px;-}.cron-disabled-toggle {margin-top: 6px;}@@ -6407,26 +6460,41 @@ a.chat-row-open {white-space: nowrap;}-.scope-filter .menu-button {+.field-menu .menu-button {height: 34px;+ max-width: min(260px, 50vw);+ padding: 0 10px;border: 1px solid var(--border);border-radius: var(--radius-sm);- padding: 0 12px;- max-width: min(260px, 50vw);+ background: var(--background);+ color: var(--foreground);+}+.field-menu .menu-button > svg {+ flex-shrink: 0;+ opacity: 0.55;+}+.field-menu .menu-button:hover:not(:disabled),+.field-menu .menu-button[aria-expanded="true"] {+ background: var(--background);+ border-color: color-mix(in srgb, var(--foreground) 30%, var(--border));+ color: var(--foreground);+}+.field-menu .menu-button:focus-visible {+ border-color: var(--foreground);+ outline: 2px solid color-mix(in srgb, var(--foreground) 65%, transparent);+ outline-offset: 2px;}.scope-filter .menu-popover {- top: calc(100% + 6px);- bottom: auto;left: auto;right: 0;width: 248px;}-.scope-option-label {+.menu-select-option {display: inline-flex;align-items: center;gap: 8px;}-.scope-option-label svg {+.menu-select-option svg {flex-shrink: 0;opacity: 0.85;}@@ -7228,7 +7296,7 @@ h3.ambient-field-label {padding: var(--chat-scroll-pad-top) var(--chat-pad) var(--chat-scroll-pad-bottom);}[data-density="compact"] .message-row {- --meta-lane: 16px;+ --meta-lane: 20px;}[data-density="compact"] .message-stack {gap: 0;@@ -7494,7 +7562,7 @@ h3.ambient-field-label {justify-content: center;align-items: flex-start;padding-top: clamp(48px, 12vh, 120px);- background: color-mix(in srgb, var(--foreground) 32%, transparent);+ background: color-mix(in srgb, var(--scrim) 32%, transparent);}.chat-search-palette {display: flex;@@ -7731,13 +7799,14 @@ h3.ambient-field-label {.nav-badge {margin-left: auto;min-width: 18px;- padding: 1px 5px;+ padding: 1px 5px 2px;border-radius: 9px;background: var(--accent);color: var(--accent-foreground, #fff);font-size: 11px;font-weight: 600;- line-height: 15px;+ letter-spacing: -0.035em;+ line-height: 14px;text-align: center;}.layout.sidebar-closed #sidebar-top .navrow .nav-badge {@@ -7802,15 +7871,19 @@ h3.ambient-field-label {background: color-mix(in srgb, var(--foreground) 12%, transparent);border-color: transparent;}+.inbox-chip:has(.inbox-chip-count) {+ padding-right: 7px;+}.inbox-chip-count {min-width: 16px;- padding: 0 4px;+ padding: 0 4px 1px;border-radius: 8px;background: color-mix(in srgb, var(--accent) 85%, var(--foreground) 0%);color: var(--accent-foreground, #fff);font-size: 11px;font-weight: 600;- line-height: 15px;+ letter-spacing: -0.035em;+ line-height: 14px;text-align: center;}.inbox-sync-line {@@ -8044,10 +8117,9 @@ h3.ambient-field-label {display: grid;grid-template-columns: minmax(0, 960px) minmax(0, 330px);- grid-template-rows: auto minmax(0, 1fr);+ grid-template-rows: auto 1fr;column-gap: 18px;justify-content: center;- overflow: hidden;}.inbox-page:has(.inbox-item-aside) .pane-head,.inbox-page:has(.inbox-item-aside) .inbox-item-surface {@@ -8058,19 +8130,22 @@ h3.ambient-field-label {}.inbox-page:has(.inbox-item-aside) .pane-head {grid-area: 1 / 1;+ align-self: start;}.inbox-page:has(.inbox-item-aside) .inbox-item-surface {grid-area: 2 / 1;- min-height: 0;+ height: auto;}.inbox-item-thread {- min-height: 0;- overflow-y: auto;- padding-right: 4px;+ flex: none;+ overflow: visible;}.inbox-item-aside {grid-area: 1 / 2 / span 2;- min-height: 0;+ position: sticky;+ top: 0;+ align-self: start;+ height: var(--inbox-aside-height, clamp(320px, 70vh, 1100px));}.inbox-item-aside .inbox-chat {flex: 1;@@ -8081,12 +8156,9 @@ h3.ambient-field-label {min-height: 0;max-height: none;}- .inbox-item-aside .inbox-chat-cta {+ .inbox-item-aside .inbox-chat-empty {flex: 1;min-height: 0;- display: flex;- align-items: center;- justify-content: center;}.inbox-item-aside .inbox-chat-composer {flex: none;@@ -8170,6 +8242,49 @@ h3.ambient-field-label {.inbox-session-link {font-size: 11px;}+.inbox-draft-headers-fields {+ display: flex;+ flex-direction: column;+ gap: 8px;+ padding-top: 8px;+}+.inbox-draft-headers > summary {+ display: flex;+ align-items: center;+ gap: 6px;+ width: fit-content;+ max-width: 100%;+ padding: 2px 0;+ color: var(--muted-foreground);+ font-size: 12px;+ cursor: pointer;+ list-style: none;+}+.inbox-draft-headers > summary::-webkit-details-marker {+ display: none;+}+.inbox-draft-headers > summary::before {+ content: "";+ flex: none;+ width: 5px;+ height: 5px;+ border-right: 1.5px solid currentColor;+ border-bottom: 1.5px solid currentColor;+ transform: rotate(-45deg);+ transition: transform 0.12s ease;+}+.inbox-draft-headers[open] > summary::before {+ transform: rotate(45deg);+}+.inbox-draft-headers > summary:hover {+ color: var(--foreground);+}+.inbox-draft-headers-peek {+ min-width: 0;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}.inbox-field {display: flex;align-items: center;@@ -8219,6 +8334,37 @@ h3.ambient-field-label {border-radius: var(--radius-sm);padding: 14px;}+.inbox-chat-empty {+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: 14px;+}+.inbox-chat-suggestions {+ display: flex;+ flex-wrap: wrap;+ gap: 6px;+ justify-content: center;+}+.inbox-chat-suggestion {+ padding: 4px 10px;+ border: 1px solid var(--border);+ border-radius: 999px;+ background: transparent;+ color: var(--muted-foreground);+ font: inherit;+ font-size: 12.5px;+ cursor: pointer;+}+.inbox-chat-suggestion:hover:not(:disabled) {+ border-color: color-mix(in srgb, var(--foreground) 30%, transparent);+ color: var(--foreground);+}+.inbox-chat-suggestion:disabled {+ opacity: 0.5;+ cursor: not-allowed;+}.inbox-chat-cta {margin: 0;font-size: 19px;@@ -8292,9 +8438,16 @@ h3.ambient-field-label {font-style: italic;}.inbox-chat-working {+ display: flex;+ align-items: center;+ gap: 6px;color: var(--muted-foreground);font-size: 12px;}+.inbox-chat-working .working-wave {+ flex: 0 0 auto;+ color: var(--working-dot, #2f81f7);+}.inbox-chat-composer {display: flex;@@ -8314,7 +8467,7 @@ h3.ambient-field-label {resize: none;overflow-x: hidden;min-height: 44px;- max-height: 160px;+ max-height: min(200px, calc(var(--inbox-aside-height, 400px) * 0.45));border: 0;background: transparent;color: inherit;@@ -8539,13 +8692,14 @@ h3.ambient-field-label {}.pane-kind-count {min-width: 16px;- padding: 0 4px;+ padding: 0 4px 1px;border-radius: 8px;background: var(--accent);color: var(--accent-foreground, #fff);font-size: 11px;font-weight: 600;- line-height: 15px;+ letter-spacing: -0.035em;+ line-height: 14px;text-align: center;margin-left: 5px;}@@ -8567,6 +8721,9 @@ h3.ambient-field-label {.inbox-surface[data-density="min"] .inbox-chip-count {display: none;}+.inbox-surface[data-density="min"] .inbox-chip:has(.inbox-chip-count) {+ padding-right: 14px;+}.draft-review-pane-host {overflow: hidden;}@@ -10020,7 +10177,7 @@ h3.ambient-field-label {.mc-overlay {position: fixed;inset: 0;- background: color-mix(in srgb, var(--foreground) 24%, transparent);+ background: color-mix(in srgb, var(--scrim) 24%, transparent);z-index: 1000;display: flex;align-items: center;diff --git a/plugins/web-ui/src/shell.ts b/plugins/web-ui/src/shell.tsindex 38c705c89..f1afa6fdd 100644--- a/plugins/web-ui/src/shell.ts+++ b/plugins/web-ui/src/shell.ts@@ -89,6 +89,7 @@ import {openInboxItemById,refreshInbox,renderInbox,+ resetActiveInboxItem,resetInboxState,routeInboxHistory,} from "./inbox";@@ -681,6 +682,7 @@ export function switchView(v: View): void {}renderSidebarTop();syncUrlFromState();+ resetActiveDetail(v);switch (v) {case "chats":if (splitState.active) drawCanvas();@@ -691,15 +693,12 @@ export function switchView(v: View): void {void renderInbox();break;case "webhooks":- resetActiveWebhook();void renderWebhooksPage();break;case "crons":- resetActiveCron();void renderCronsPage();break;case "loops":- resetActiveLoop();void renderLoopsPage();break;case "contexts":@@ -718,7 +717,6 @@ export function switchView(v: View): void {void renderMemory();break;case "skills":- resetActiveSkill();void renderSkills();break;case "settings":@@ -727,7 +725,29 @@ export function switchView(v: View): void {}}+function resetActiveDetail(v: View): void {+ switch (v) {+ case "inbox":+ resetActiveInboxItem();+ break;+ case "webhooks":+ resetActiveWebhook();+ break;+ case "crons":+ resetActiveCron();+ break;+ case "loops":+ resetActiveLoop();+ break;+ case "skills":+ resetActiveSkill();+ break;+ }+}+function refreshActiveView(v: View): void {+ resetActiveDetail(v);+ syncUrlFromState();switch (v) {case "chats":if (splitState.active) void refreshSessions({ silent: true, refreshContexts: true });diff --git a/plugins/web-ui/src/theme-import.ts b/plugins/web-ui/src/theme-import.tsindex 1851c0c23..d2f5a07a1 100644--- a/plugins/web-ui/src/theme-import.ts+++ b/plugins/web-ui/src/theme-import.ts@@ -365,6 +365,7 @@ export function themeTokens(palette: Palette): ThemeTokens {"--success": readable(green ?? action),"--warning": readable(ansiOrBright(ANSI.yellow) ?? action),"--selection": palette.selection ?? mix(bg, action, 0.35),+ "--scrim": mix(bg, BLACK, 0.82),"--working-dot": readable(ansiOrBright(ANSI.blue) ?? action),"--awaiting-dot": readable(ansiOrBright(ANSI.yellow) ?? action),"--syntax-keyword": syntax("keyword", ansiOrBright(ANSI.magenta), fg),diff --git a/plugins/web-ui/src/ui.ts b/plugins/web-ui/src/ui.tsindex 8d7459d01..218378ff5 100644--- a/plugins/web-ui/src/ui.ts+++ b/plugins/web-ui/src/ui.ts@@ -117,6 +117,63 @@ export function fieldSelect(props: {</span>`;}+export interface MenuSelectOption {+ value: string | null;+ label: string;+ glyph?: IconNode;+}++export function menuSelect(props: {+ value: string | null;+ options: MenuSelectOption[];+ onSelect: (value: string | null) => void;+ ariaLabel: string;+ prefix?: string;+ className?: string;+}): TemplateResult {+ const current = props.value ?? null;+ const selected = props.options.find((o) => (o.value ?? null) === current) ?? props.options[0];+ const option = (o: MenuSelectOption): TemplateResult => {+ const active = (o.value ?? null) === current;+ return html`+ <button+ class="menu-option ${active ? "active" : ""}"+ type="button"+ role="menuitemradio"+ aria-checked=${active ? "true" : "false"}+ @click=${(e: Event) => {+ e.stopPropagation();+ closeFormMenus();+ props.onSelect(o.value ?? null);+ }}+ >+ <span class="menu-option-label menu-select-option"+ >${o.glyph ? icon(o.glyph, 14) : nothing}<span>${o.label}</span></span+ >+ ${active ? icon(Check, 15) : nothing}+ </button>+ `;+ };+ return html`+ <div+ class=${`menu-control form-menu-control field-menu${props.className ? ` ${props.className}` : ""}`}+ data-drop="down"+ >+ <button+ class="menu-button"+ type="button"+ aria-haspopup="menu"+ aria-expanded="false"+ aria-label=${props.ariaLabel}+ @click=${toggleFormMenu}+ >+ <span class="menu-label">${props.prefix ?? ""}${selected?.label ?? ""}</span>${icon(ChevronDown, 14)}+ </button>+ <div class="menu-popover" role="menu" hidden>${props.options.map(option)}</div>+ </div>+ `;+}+export function initials(s: string): string {const base = (s.split("@")[0] || s).trim();const parts = base.split(/[.\-_ ]+/).filter(Boolean);diff --git a/plugins/web-ui/test/chat-settled-row-cache.test.ts b/plugins/web-ui/test/chat-settled-row-cache.test.tsindex cc7b1d467..9e3fce457 100644--- a/plugins/web-ui/test/chat-settled-row-cache.test.ts+++ b/plugins/web-ui/test/chat-settled-row-cache.test.ts@@ -26,7 +26,12 @@ test("the cache key covers every mutable render input of a settled row", () => {"hit.stopReason === msg.stopReason","hit.errorMessage === msg.errorMessage","hit.approvalDecision === msg.approvalDecision",+ "hit.sendFailure === msg.sendFailure","hit.forkable === forkable",+ "hit.speakerLabel === speakerLabel",+ "hit.edited === edited",+ "hit.deleted === deleted",+ "hit.expanded === expanded",]) {assert.ok(chat.includes(field), `cache key must compare: ${field}`);}diff --git a/plugins/web-ui/test/css-vars.test.ts b/plugins/web-ui/test/css-vars.test.tsindex 72e47b6ce..c1774d1ce 100644--- a/plugins/web-ui/test/css-vars.test.ts+++ b/plugins/web-ui/test/css-vars.test.ts@@ -51,3 +51,30 @@ test("only the elevated chat surfaces paint a shadow", () => {assert.deepEqual(inlineShadows, [], "inline styles must not introduce additional shadows");assert.doesNotMatch(shellCss + tsSource, /drop-shadow\(/);});++test("every modal scrim dims through --scrim, which each theme points away from its own text", () => {+ const scrims = [...shellCss.matchAll(/\n\s*\.[^{]*(?:scrim|overlay|backdrop)[^{]*\{[^}]*\}/g)].map((m) => m[0]);+ assert.ok(scrims.length >= 5, "the scrim rules should still be findable by name");+ for (const rule of scrims) {+ const background = rule.match(/\n\s*background:\s*([^;]+);/)?.[1] ?? "";+ if (!background.includes("transparent")) continue;+ const name = rule.split("{")[0].trim();+ assert.doesNotMatch(+ background,+ /var\(--foreground\)/,+ `a scrim mixed from --foreground inverts in dark mode, painting white over the page: ${name}`,+ );+ if (background.includes("var(--background)")) continue;+ assert.match(background, /var\(--scrim\)/, `scrim should dim through --scrim: ${name}`);+ }+ const light = shellCss.match(/:root \{[\s\S]*?\n\}/)?.[0] ?? "";+ const dark = shellCss.match(/\n\.dark \{[\s\S]*?\n\}/)?.[0] ?? "";+ for (const [name, block] of [+ ["light", light],+ ["dark", dark],+ ] as const) {+ const value = block.match(/--scrim:\s*oklch\(([\d.]+)/)?.[1];+ assert.ok(value, `${name} must define --scrim`);+ assert.ok(Number(value) < 0.2, `${name} --scrim must be dark enough to dim, got L=${value}`);+ }+});diff --git a/plugins/web-ui/test/field-select-source.test.ts b/plugins/web-ui/test/field-select-source.test.tsindex a508b7464..30fc0d418 100644--- a/plugins/web-ui/test/field-select-source.test.ts+++ b/plugins/web-ui/test/field-select-source.test.ts@@ -48,6 +48,13 @@ test("list dropdowns share enough width to show their selected value", () => {assert.match(css, /\.list-select \.field-select \{\s*min-width: 124px;/);});+test("the list caption's weight stays on the caption and off the control it labels", () => {+ const start = css.indexOf(".list-select {");+ const block = css.slice(start, css.indexOf("}", start));+ assert.doesNotMatch(block, /font-weight/, "a weight on .list-select reaches the select through font: inherit");+ assert.match(css, /\.list-select > span:not\(\.field-select\) \{\s*font-size: 11px;\s*font-weight: 600;/);+});+test("the dropdown holds the caller's value against re-renders (live) and stale DOM state", () => {// .value on a <select> commits before its <option> children exist on first render,// and lit's default dirty-check skips re-asserting it when the DOM has drifted —@@ -55,3 +62,71 @@ test("the dropdown holds the caller's value against re-renders (live) and staleassert.match(ui, /import \{ live \} from "lit\/directives\/live\.js"/);assert.match(ui, /\.value=\$\{props\.value === undefined \? nothing : live\(props\.value\)\}/);});++const sessions = readFileSync(new URL("sessions.ts", srcDir), "utf8");+const contexts = readFileSync(new URL("contexts.ts", srcDir), "utf8");++test("the context and surface filters are the same control, built once", () => {+ assert.match(ui, /export function menuSelect\(props: \{/);+ for (const [name, source] of [+ ["the context filter", contexts],+ ["the surface filter", sessions],+ ] as const) {+ assert.match(source, /menuSelect\(\{/, `${name} should render through menuSelect`);+ assert.doesNotMatch(+ source.slice(source.indexOf("menuSelect({")),+ /^\s*<div class="menu-control/m,+ `${name} should not hand-roll the menu markup`,+ );+ }+ assert.doesNotMatch(sessions, /fieldSelect/, "the surface filter no longer uses the native select");+});++test("a filter menu opens straight onto its options, with no header restating the button", () => {+ const menu = ui.match(/export function menuSelect\(props: \{[\s\S]*?\n\}/)?.[0] ?? "";+ assert.doesNotMatch(menu, /menu-title/, "the header only ever repeated the label already on the button");+ assert.doesNotMatch(menu, /title\?: string;/);+ for (const [name, source] of [+ ["the context filter", contexts],+ ["the surface filter", sessions],+ ] as const) {+ const call = source.slice(source.indexOf("menuSelect({"));+ assert.doesNotMatch(call.slice(0, call.indexOf("})")), /title:/, `${name} still passes a menu header`);+ assert.match(+ call.slice(0, call.indexOf("})")),+ /ariaLabel:/,+ `${name} must keep naming itself for a screen reader`,+ );+ }+});++test("the menu-backed filter wears the same box as the native select's resting state", () => {+ const box = (rule: string): Record<string, string> => {+ const start = css.indexOf(rule);+ assert.ok(start >= 0, `${rule} should exist`);+ const block = css.slice(start, css.indexOf("}", start));+ return Object.fromEntries([...block.matchAll(/\n\s*([a-z-]+):\s*([^;]+);/g)].map((m) => [m[1]!, m[2]!.trim()]));+ };+ const select = box("\n.field-select > select {");+ const menu = box("\n.field-menu .menu-button {");+ for (const prop of ["border", "border-radius"]) {+ assert.equal(menu[prop], select[prop], `${prop} must match the native select`);+ }+ assert.equal(menu["background"], "var(--background)");+ assert.equal(menu["color"], "var(--foreground)");+ assert.equal(menu["height"], "34px");+ assert.equal(select["min-height"], "34px");+});++test("a filter menu opens downward, since the shared popover defaults to opening up for the composer", () => {+ const control = ui.match(/<div\s+class=\$\{`menu-control form-menu-control field-menu[\s\S]*?>/)?.[0] ?? "";+ assert.match(control, /data-drop="down"/, "without this the filter opens over the header above it");+ assert.match(css, /\.menu-control\[data-drop="down"\] \.menu-popover \{\s*top: calc\(100% \+ 6px\);\s*bottom: auto;/);+ assert.match(+ css,+ /\.menu-control\[data-drop="down"\] \.menu-popover\.drop-up \{/,+ "the flip-up fallback must survive so a filter near the bottom edge still fits",+ );+ const scope = css.match(/\n\.scope-filter \.menu-popover \{[^}]*\}/)?.[0] ?? "";+ assert.doesNotMatch(scope, /top:|bottom:/, "drop direction belongs to the shared control, not one caller");+});diff --git a/plugins/web-ui/test/inbox-aside-height.test.ts b/plugins/web-ui/test/inbox-aside-height.test.tsnew file mode 100644index 000000000..367018424--- /dev/null+++ b/plugins/web-ui/test/inbox-aside-height.test.ts@@ -0,0 +1,66 @@+import assert from "node:assert/strict";+import { readFileSync } from "node:fs";+import test from "node:test";++const inbox = readFileSync(new URL("../src/inbox.ts", import.meta.url), "utf8");+const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");++const sizeAside = inbox.match(/function sizeAside\(host: HTMLElement\): void \{[\s\S]*?\n\}/)?.[0] ?? "";++const MIN = 320;+const MAX = 1100;+const PAD_TOP = 28;+const PAD_BOTTOM = 40;++function heightFor(viewport: number): number {+ return Math.min(MAX, Math.max(MIN, viewport - PAD_TOP - PAD_BOTTOM));+}++test("the assistant ends at the pane's content box, so its own height cannot scroll the page", () => {+ assert.equal(heightFor(900), 832);+ assert.equal(heightFor(700), 632);+ assert.equal(heightFor(500), 432);+});++test("a very tall window stops growing the assistant at its ceiling", () => {+ assert.equal(heightFor(1300), MAX);+ assert.equal(heightFor(4000), MAX);+});++test("a very short window overrides the fit: the assistant keeps its floor and overflows into page scroll", () => {+ assert.equal(heightFor(340), MIN);+ assert.equal(heightFor(300), MIN);+ assert.ok(+ MIN > 300 - PAD_TOP - PAD_BOTTOM,+ "the floor must exceed what a short viewport offers, or nothing overflows",+ );+});++test("sizeAside clamps on both ends rather than only flooring", () => {+ assert.match(sizeAside, /Math\.min\(ASIDE_MAX_HEIGHT, Math\.max\(ASIDE_MIN_HEIGHT, available\)\)/);+ assert.match(sizeAside, /host\.clientHeight - padTop - padBottom/);+ assert.match(inbox, new RegExp(`const ASIDE_MIN_HEIGHT = ${MIN};`));+ assert.match(inbox, new RegExp(`const ASIDE_MAX_HEIGHT = ${MAX};`));+});++test("the height is recomputed when the pane resizes, not only when it renders", () => {+ const observer = inbox.match(/function observeAsideSize\(host: HTMLElement\): void \{[\s\S]*?\n\}/)?.[0] ?? "";+ assert.match(observer, /new ResizeObserver\(/);+ assert.match(observer, /sizeAside\(host\)/);+ assert.match(observer, /\.observe\(host\)/);+ assert.match(inbox, /appState\.mainEl\.replaceChildren\(host\);\s*observeAsideSize\(host\);/);+});++test("recreating the page host replaces its observer instead of stacking another one", () => {+ const observer = inbox.match(/function observeAsideSize\(host: HTMLElement\): void \{[\s\S]*?\n\}/)?.[0] ?? "";+ assert.match(observer, /asideObserver\?\.disconnect\(\);/);+ assert.match(inbox, /let asideObserver: ResizeObserver \| null = null;/);+});++test("writing the same height twice is skipped, so the observer cannot feed itself", () => {+ assert.match(sizeAside, /if \(host\.style\.getPropertyValue\("--inbox-aside-height"\) === next\) return;/);+});++test("the pre-JS fallback carries the same bounds as the measured height", () => {+ assert.match(css, /height: var\(--inbox-aside-height, clamp\(320px, 70vh, 1100px\)\);/);+});diff --git a/plugins/web-ui/test/inbox-source.test.ts b/plugins/web-ui/test/inbox-source.test.tsindex 7bd4d3c23..659974e12 100644--- a/plugins/web-ui/test/inbox-source.test.ts+++ b/plugins/web-ui/test/inbox-source.test.ts@@ -208,8 +208,8 @@ test("draft header links stay together after the label", () => {});test("suggested draft actions yield to typed instructions without reflow", () => {- assert.match(inbox, /composer\?\.classList\.toggle\("has-text", !!box\.value\.trim\(\)\)/);assert.match(inbox, /inbox-chat-composer \$\{pending\.trim\(\) \? "has-text" : ""\}/);+ assert.match(inbox, /if \(had !== Boolean\(box\.value\.trim\(\)\)\) drawAll\(\);/);assert.match(css, /\.inbox-chat-composer\.has-text \.inbox-chat-suggest \{\s*visibility: hidden;/);assert.doesNotMatch(inbox, /inbox-draft-actions|function sendLabel/);});diff --git a/plugins/web-ui/test/message-meta-lane.test.ts b/plugins/web-ui/test/message-meta-lane.test.tsindex 2dddea2ca..50f74195c 100644--- a/plugins/web-ui/test/message-meta-lane.test.ts+++ b/plugins/web-ui/test/message-meta-lane.test.ts@@ -8,3 +8,10 @@ test("message actions fit their lane and stack above sticky rows", () => {assert.match(css, /\.message-meta\s*{[^}]*z-index: 4;[^}]*height: var\(--meta-lane\);/s);assert.match(css, /\.msg-copy\s*{[^}]*width: var\(--meta-lane\);[^}]*height: var\(--meta-lane\);/s);});++test("the action buttons clear the 24px minimum target, and the lane they reserve grows with them", () => {+ assert.match(css, /\n:root \{[^}]*--meta-lane: 24px;/s);+ assert.match(css, /\[data-density="compact"\][^{]*\{[^}]*--meta-lane: 20px;/s);+ assert.match(css, /\.message-meta\s*\{[^}]*gap: 8px;/s);+ assert.doesNotMatch(css, /\.msg-copy::after/);+});diff --git a/plugins/web-ui/test/nav-returns-to-index.test.ts b/plugins/web-ui/test/nav-returns-to-index.test.tsnew file mode 100644index 000000000..25bd295f1--- /dev/null+++ b/plugins/web-ui/test/nav-returns-to-index.test.ts@@ -0,0 +1,57 @@+import assert from "node:assert/strict";+import { readFileSync } from "node:fs";+import test from "node:test";++const shell = readFileSync(new URL("../src/shell.ts", import.meta.url), "utf8");+const inbox = readFileSync(new URL("../src/inbox.ts", import.meta.url), "utf8");++const resetDetail = shell.match(/function resetActiveDetail\(v: View\): void \{[\s\S]*?\n\}/)?.[0] ?? "";+const refresh = shell.match(/function refreshActiveView\(v: View\): void \{[\s\S]*?\n\}/)?.[0] ?? "";++test("pressing the nav entry for the view you are already on drops back to its index", () => {+ assert.match(refresh, /^\s*resetActiveDetail\(v\);/m);+ assert.match(refresh, /syncUrlFromState\(\);/);+});++test("every view with a detail page clears it, so no nav entry is a no-op", () => {+ for (const [view, reset] of [+ ["inbox", "resetActiveInboxItem"],+ ["webhooks", "resetActiveWebhook"],+ ["crons", "resetActiveCron"],+ ["loops", "resetActiveLoop"],+ ["skills", "resetActiveSkill"],+ ]) {+ assert.match(resetDetail, new RegExp(String.raw`case "${view}":\s*${reset}\(\);`), `${view} keeps its detail open`);+ }+});++test("arriving from another view and re-pressing the nav entry share one reset", () => {+ assert.equal(shell.match(/resetActiveDetail\(v\);/g)?.length, 2);+ const switcher = shell.match(/export function switchView\(v: View\): void \{[\s\S]*?\n\}/)?.[0] ?? "";+ assert.match(switcher, /resetActiveDetail\(v\);/);+ for (const reset of ["resetActiveWebhook", "resetActiveCron", "resetActiveLoop", "resetActiveSkill"]) {+ assert.doesNotMatch(+ switcher,+ new RegExp(String.raw`${reset}\(\);`),+ `${reset} should only run via resetActiveDetail`,+ );+ }+});++test("a deep link still wins: the reset clears the selection but never the pending item", () => {+ const reset = inbox.match(/export function resetActiveInboxItem\(\): void \{[\s\S]*?\n\}/)?.[0] ?? "";+ assert.match(reset, /fullSurface\.selectedId = null;/);+ assert.doesNotMatch(reset, /pendingItemId/);+ assert.match(+ shell,+ /if \(wanted === "inbox" && wantedItem\) openInboxItemById\(wantedItem\);\s*\n\s*.*\n?\s*switchView\(wanted as View\);/,+ );+});++test("closing an item from the page and from the nav both persist the draft first", () => {+ const reset = inbox.match(/export function resetActiveInboxItem\(\): void \{[\s\S]*?\n\}/)?.[0] ?? "";+ assert.match(reset, /void persistDraft\(item\);/);+ const close = inbox.match(/function closeInboxItem\(\): void \{[\s\S]*?\n\}/)?.[0] ?? "";+ assert.match(close, /resetActiveInboxItem\(\);/);+ assert.doesNotMatch(close, /persistDraft/);+});diff --git a/plugins/web-ui/test/plain-text-code-wrap.test.ts b/plugins/web-ui/test/plain-text-code-wrap.test.tsindex b87f51771..613fff817 100644--- a/plugins/web-ui/test/plain-text-code-wrap.test.ts+++ b/plugins/web-ui/test/plain-text-code-wrap.test.ts@@ -37,10 +37,11 @@ test("plain-text code fences stay compact without changing source-code fences",});test("long plain-text fences collapse by default and remain expandable", () => {- assert.match(chat, /requestAnimationFrame\(\(\) => decorateTextCodeBlocks\(/);+ assert.match(chat, /requestAnimationFrame\(\(\) => \{\s*decorateTextCodeBlocks\(/);assert.match(chat, /normalizePlainTextFences/);assert.match(css,- /code-block\.text-code-collapsible\[data-expanded="false"\] \.text-code-body[^}]*max-height: 76px;[^}]*overflow: hidden;[^}]*mask-image: linear-gradient\(to bottom, #000, rgb\(0 0 0 \/ 0\.74\) 38%, rgb\(0 0 0 \/ 0\.32\) 68%, transparent\);/s,+ /code-block\.text-code-collapsible\[data-expanded="false"\] \.text-code-body[^}]*max-height: 76px;[^}]*overflow: hidden;/s,);+ assert.doesNotMatch(css, /code-block\.text-code-collapsible[^}]*mask-image:/s);});diff --git a/plugins/web-ui/test/prompt-clamp.test.ts b/plugins/web-ui/test/prompt-clamp.test.tsnew file mode 100644index 000000000..987346f2c--- /dev/null+++ b/plugins/web-ui/test/prompt-clamp.test.ts@@ -0,0 +1,101 @@+import assert from "node:assert/strict";+import { readFileSync } from "node:fs";+import test from "node:test";+import { JSDOM } from "jsdom";++import { markClampedPrompts } from "../src/prompt-clamp.ts";++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 pinned = String.raw`\.message-stack \.user-row:not\(:has\(~ \.user-row\)\) \.user-bubble`;++function bubbleDom(scrollHeight: number, clientHeight: number, expanded = "false"): HTMLElement {+ const dom = new JSDOM(`<div class="message-stack">+ <article class="message-row user-row">+ <div class="message-bubble user-bubble" data-expanded="${expanded}">+ <markdown-block></markdown-block>+ </div>+ </article>+ </div>`);+ const body = dom.window.document.querySelector("markdown-block")!;+ Object.defineProperty(body, "scrollHeight", { value: scrollHeight });+ Object.defineProperty(body, "clientHeight", { value: clientHeight });+ markClampedPrompts(dom.window.document);+ return dom.window.document.querySelector<HTMLElement>(".user-bubble")!;+}++test("a prompt taller than its cap is marked clamped; one that fits is not", () => {+ assert.equal(bubbleDom(800, 240).dataset.clamped, "true");+ assert.equal(bubbleDom(240, 240).dataset.clamped, "false");+});++test("an expanded prompt keeps its clamped mark so Show less stays reachable", () => {+ const dom = new JSDOM(`<div class="message-stack">+ <article class="message-row user-row">+ <div class="message-bubble user-bubble" data-clamped="true" data-expanded="true">+ <markdown-block></markdown-block>+ </div>+ </article>+ </div>`);+ const body = dom.window.document.querySelector("markdown-block")!;+ Object.defineProperty(body, "scrollHeight", { value: 800 });+ Object.defineProperty(body, "clientHeight", { value: 800 });+ markClampedPrompts(dom.window.document);+ assert.equal(dom.window.document.querySelector<HTMLElement>(".user-bubble")!.dataset.clamped, "true");+});++test("only the last user row is measured — earlier prompts are never clamped", () => {+ const dom = new JSDOM(`<div class="message-stack">+ <article class="message-row user-row"><div class="user-bubble"><markdown-block></markdown-block></div></article>+ <article class="message-row user-row"><div class="user-bubble"><markdown-block></markdown-block></div></article>+ </div>`);+ for (const body of dom.window.document.querySelectorAll("markdown-block")) {+ Object.defineProperty(body, "scrollHeight", { value: 800 });+ Object.defineProperty(body, "clientHeight", { value: 240 });+ }+ markClampedPrompts(dom.window.document);+ const bubbles = dom.window.document.querySelectorAll<HTMLElement>(".user-bubble");+ assert.equal(bubbles[0].dataset.clamped, undefined);+ assert.equal(bubbles[1].dataset.clamped, "true");+});++test("the clamped prompt clips instead of scrolling, and expanding lifts the cap", () => {+ const text =+ css.match(new RegExp(String.raw`\n${pinned} > markdown-block,\n${pinned} > \.slack-wire-text \{[^}]*\}`))?.[0] ??+ "";+ assert.match(text, /overflow: hidden;/);+ assert.doesNotMatch(text, /overflow-y: auto;/);+ assert.match(css, new RegExp(String.raw`\n${pinned}\[data-expanded="true"\] \{[^}]*max-height: none;`));+});++test("the toggle is hidden until the prompt actually overflows", () => {+ const base = css.match(/\n\.prompt-toggle \{[^}]*\}/)?.[0] ?? "";+ assert.match(base, /display: none;/);+ assert.match(+ css,+ new RegExp(+ String.raw`${pinned}\[data-clamped="true"\] > \.prompt-toggle,\n${pinned}\[data-expanded="true"\] > \.prompt-toggle \{\s*display: block;`,+ ),+ );+});++test("the toggle names its own next action and reports state to assistive tech", () => {+ assert.match(chat, /chatState\.expandedPrompt === index \? "Show less" : "Show more"/);+ assert.match(chat, /aria-expanded=\$\{chatState\.expandedPrompt === index \? "true" : "false"\}/);+ assert.match(chat, /@click=\$\{\(\) => togglePromptExpanded\(index\)\}/);+});++test("toggling a prompt redraws through whichever surface is mounted", () => {+ const fn = chat.match(/function togglePromptExpanded\(index: number\): void \{[\s\S]*?\n {2}\}/)?.[0] ?? "";+ assert.match(fn, /chatState\.expandedPrompt = chatState\.expandedPrompt === index \? null : index;/);+ assert.match(fn, /if \(chatState\.agent\) drawActiveChat\(chatState\.agent\);\s*else readonlyRedraw\?\.\(\);/);+});++test("both transcript surfaces re-measure after every render", () => {+ assert.equal(chat.match(/markClampedPrompts\((host|chatState\.host)\)/g)?.length, 2);+});++test("switching sessions collapses the prompt again — the index never carries over", () => {+ assert.equal(chat.match(/chatState\.expandedPrompt = null;/g)?.length, 2);+});diff --git a/plugins/web-ui/test/sidebar-row-tooltips.test.ts b/plugins/web-ui/test/sidebar-row-tooltips.test.tsnew file mode 100644index 000000000..c2df0187e--- /dev/null+++ b/plugins/web-ui/test/sidebar-row-tooltips.test.ts@@ -0,0 +1,35 @@+import assert from "node:assert/strict";+import { readFileSync } from "node:fs";+import test from "node:test";++const sessions = readFileSync(new URL("../src/sessions.ts", import.meta.url), "utf8");++function block(marker: string): string {+ const at = sessions.indexOf(marker);+ assert.ok(at >= 0, `missing marker: ${marker}`);+ return sessions.slice(at, sessions.indexOf("</button>", at));+}++test("the sidebar row's archive button names itself on hover", () => {+ const archive = block('class="session-menu-btn session-archive-btn"');+ assert.match(archive, /\$\{tip\(s\.archived \? "Unarchive" : "Archive"\)\}/);+ assert.match(archive, /aria-label=/);+});++test("the sidebar row's options button names itself on hover", () => {+ const options = block("data-menu-id=${s.id}");+ assert.match(options, /\$\{tip\(CHAT_OPTIONS_TOOLTIP\)\}/);+ assert.match(options, /aria-label=/);+});++test("row tooltips reuse the wording the chats page already uses for the same actions", () => {+ const chatsPage = block('${tip(s.archived ? "Unarchive" : "Archive")}');+ assert.ok(chatsPage.length > 0);+ assert.equal(sessions.match(/\$\{tip\(s\.archived \? "Unarchive" : "Archive"\)\}/g)?.length, 2);+ assert.match(sessions, /const CHAT_OPTIONS_TOOLTIP = "Chat options";/);+});++test("every sidebar control uses the app tooltip, never the native title attribute", () => {+ assert.doesNotMatch(sessions, /\n\s*title="/);+ assert.doesNotMatch(sessions, /\n\s*title=\$\{/);+});diff --git a/plugins/web-ui/test/sticky-prompt-occlusion.test.ts b/plugins/web-ui/test/sticky-prompt-occlusion.test.tsnew file mode 100644index 000000000..011e705bb--- /dev/null+++ b/plugins/web-ui/test/sticky-prompt-occlusion.test.ts@@ -0,0 +1,13 @@+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");+test("the transcript clips at its own edges — no fade at the topbar or the composer", () => {+ assert.doesNotMatch(css, /\.chat-scroll::(before|after)/);+});++test("no transcript surface dissolves content into the background", () => {+ assert.doesNotMatch(css, /linear-gradient\(\s*to (top|bottom),\s*var\(--background\)/s);+ assert.doesNotMatch(css, /mask-image:/);+});diff --git a/plugins/web-ui/test/user-message-cap.test.ts b/plugins/web-ui/test/user-message-cap.test.tsindex b5ccdcedc..48719bdd0 100644--- a/plugins/web-ui/test/user-message-cap.test.ts+++ b/plugins/web-ui/test/user-message-cap.test.ts@@ -16,7 +16,7 @@ test("only the pinned prompt is capped, at 40% of its own scroller, and its textcss.match(new RegExp(String.raw`\n${pinned} > markdown-block,\n${pinned} > \.slack-wire-text \{[^}]*\}`))?.[0] ??"";assert.match(text, /flex-shrink: 1000;/);- assert.match(text, /overflow-y: auto;/);+ assert.match(text, /overflow: hidden;/);const files = css.match(new RegExp(String.raw`\n${pinned} > \.message-files \{[^}]*\}`))?.[0] ?? "";assert.match(files, /min-height: 0;/);assert.match(files, /max-height: 20cqh;/);