Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Delete web-ui tests that only read source text (#2242)

Regan Bellc7985e5f9f8a
diff --git a/knip.json b/knip.json
index 8354cbd9f..3ab45211d 100644
--- a/knip.json
+++ b/knip.json
@@ -51,7 +51,10 @@
"src/lazy-hljs.ts",
"src/hljs-lang-stub.ts",
"test/**/*.test.ts",
- "src/app-devbar.ts"
+ "src/app-devbar.ts",
+ "src/inbox.ts",
+ "src/context-model.ts",
+ "src/assistant-sidebar.ts"
],
"ignoreDependencies": [
"katex-real",
diff --git a/plugins/web-ui/src/ambient-policy.ts b/plugins/web-ui/src/ambient-policy.ts
index 0ccaf4303..b0655cd91 100644
--- a/plugins/web-ui/src/ambient-policy.ts
+++ b/plugins/web-ui/src/ambient-policy.ts
@@ -4,9 +4,9 @@ import { errMessage } from "../../chassis/src/errors";
import { fieldSelect } from "./ui";
import { tip } from "./tooltip";
-export const BOT_MODES = ["ignore", "rollup", "action", "user"] as const;
-export type BotMode = (typeof BOT_MODES)[number];
-export interface BotPolicyView {
+const BOT_MODES = ["ignore", "rollup", "action", "user"] as const;
+type BotMode = (typeof BOT_MODES)[number];
+interface BotPolicyView {
name: string;
mode: BotMode;
rollupHours?: number;
@@ -20,7 +20,7 @@ interface PolicyWire {
};
}
-export const ambientPolicyState = {
+const ambientPolicyState = {
scope: null as string | null,
loading: false,
orders: "",
@@ -37,7 +37,7 @@ export const ambientPolicyState = {
let loadSeq = 0;
let redraw: () => void = () => {};
-export function ambientPolicyApplies(scopeId: string): boolean {
+function ambientPolicyApplies(scopeId: string): boolean {
return scopeId.startsWith("channel:") || scopeId.startsWith("group:");
}
diff --git a/plugins/web-ui/src/channel-header.ts b/plugins/web-ui/src/channel-header.ts
index ef09e51c2..cc19d5eab 100644
--- a/plugins/web-ui/src/channel-header.ts
+++ b/plugins/web-ui/src/channel-header.ts
@@ -10,7 +10,7 @@ interface HeaderPinWire {
default?: boolean;
}
-export const channelHeaderState = {
+const channelHeaderState = {
scope: null as string | null,
loading: false,
saving: false,
@@ -25,7 +25,7 @@ export const channelHeaderState = {
let loadSeq = 0;
let redraw: () => void = () => {};
-export function channelHeaderApplies(scopeId: string): boolean {
+function channelHeaderApplies(scopeId: string): boolean {
return scopeId.startsWith("channel:");
}
diff --git a/plugins/web-ui/test/admin-navigation-source.test.ts b/plugins/web-ui/test/admin-navigation-source.test.ts
deleted file mode 100644
index 92ea1ceb7..000000000
--- a/plugins/web-ui/test/admin-navigation-source.test.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-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");
-
-test("admin navigation uses an admin-specific icon", () => {
- const adminLink = shell.match(/<a class="icon-btn subtle" href=\$\{ADMIN_HOME_URL\}[\s\S]*?<\/a>/);
- assert.ok(adminLink, "admin navigation link exists");
- assert.match(adminLink[0], /icon\(ShieldUser, 17\)/);
- assert.doesNotMatch(adminLink[0], /icon\(ArrowLeft, 17\)/);
-});
-
-test("the sidebar has exactly one admin shortcut", () => {
- assert.equal([...shell.matchAll(/href=\$\{ADMIN_HOME_URL\}/g)].length, 1);
-});
diff --git a/plugins/web-ui/test/ambient-policy-source.test.ts b/plugins/web-ui/test/ambient-policy-source.test.ts
deleted file mode 100644
index f7aef34b4..000000000
--- a/plugins/web-ui/test/ambient-policy-source.test.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const policy = readFileSync(new URL("../src/ambient-policy.ts", import.meta.url), "utf8");
-const contexts = readFileSync(new URL("../src/contexts.ts", import.meta.url), "utf8");
-const shell = readFileSync(new URL("../src/shell.ts", import.meta.url), "utf8");
-const sessions = readFileSync(new URL("../src/sessions.ts", import.meta.url), "utf8");
-const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
-
-test("policy edits redraw immediately and preserve focused text controls", () => {
- const markDirty = policy.match(/function markDirty\(\)[^]*?\n\}/)?.[0] ?? "";
- assert.match(markDirty, /redraw\(\)/);
- assert.match(policy, /data-focus-key="ambient-orders"/);
- assert.match(policy, /data-focus-key="ambient-bot-name"/);
- assert.match(policy, /data-focus-key=\$\{`ambient-hours-\$\{i\}`\}/);
-});
-
-test("policy controls use product language and persistent accessible labels", () => {
- for (const label of ["Ignore", "Batch updates", "Act immediately", "Treat like a person"])
- assert.match(policy, new RegExp(label));
- assert.match(policy, /<label class="ambient-field-label" for="ambient-orders">/);
- assert.match(policy, /aria-describedby="ambient-orders-hint"/);
- assert.match(policy, /describedBy: "ambient-enabled-hint"/);
- assert.match(policy, /aria-label="Bot name"/);
- assert.match(policy, /required/);
-});
-
-test("a field reads label, then control, then the prose explaining it", () => {
- for (const [id, control] of [
- ["ambient-enabled", "fieldSelect({"],
- ["ambient-orders", "<textarea"],
- ]) {
- const group = policy.match(new RegExp(`<label class="ambient-field-label" for="${id}">[^]*?</div>`))?.[0] ?? "";
- assert.ok(group, `${id} sits in its own group`);
- const controlIndex = group.indexOf(control!);
- assert.ok(controlIndex >= 0, `${id}'s control is present in its group`);
- assert.ok(controlIndex < group.indexOf(`id="${id}-hint"`), `${id}'s control comes before its hint`);
- }
-});
-
-test("both policy dropdowns come from the shared one, not hand-rolled markup", () => {
- assert.equal((policy.match(/fieldSelect\(\{/g) ?? []).length, 2);
- assert.doesNotMatch(policy, /<select/);
-});
-
-test("policy styles use the shell theme contract", () => {
- const start = css.indexOf(".ambient-policy {");
- const end = css.indexOf("\n.main {", start);
- assert.notEqual(start, -1);
- assert.notEqual(end, -1);
- const block = css.slice(start, end);
- assert.match(block, /color: var\(--muted-foreground\)/);
- assert.match(block, /background: var\(--background\)/);
- assert.match(block, /color: var\(--foreground\)/);
- assert.doesNotMatch(block, /var\(--muted,/);
- assert.doesNotMatch(block, /var\(--panel,/);
- assert.match(block, /:focus-visible/);
- assert.match(block, /outline: 2px solid/);
-});
-
-test("the scope homepage puts work before settings and consolidates the empty project", () => {
- assert.match(contexts, /context-workspace-main[^]*?<aside class="context-settings"/);
- assert.match(contexts, /This project is ready for work/);
- assert.match(contexts, /if\s*\(\s*r\.files\.length === 0[^]*?return nothing;/);
-});
-
-test("narrow navigation overlays content and closes when its breakpoint is crossed", () => {
- assert.doesNotMatch(css, /layout:not\(\.sidebar-closed\) \.pane/);
- assert.match(shell, /narrowViewport\.addEventListener\("change"/);
- assert.match(shell, /closeSidebarOnNarrowView\(\)/);
- assert.match(css, /@container \(max-width: 760px\)[^]*?context-workspace\.has-settings/);
-});
-
-test("every sidebar destination dismisses the narrow overlay", () => {
- const openSession = sessions.match(/export async function openSession[^]*?\n\}/)?.[0] ?? "";
- const startNewChat = sessions.match(/export function startNewChat\([^]*?\n\}/)?.[0] ?? "";
- assert.match(openSession, /closeSidebarOnNarrowView\(\)/);
- assert.match(startNewChat, /closeSidebarOnNarrowView\(\)/);
- assert.match(shell, /export function switchView[^]*?closeSidebarOnNarrowView\(\)/);
-});
diff --git a/plugins/web-ui/test/approval-continuation-source.test.ts b/plugins/web-ui/test/approval-continuation-source.test.ts
deleted file mode 100644
index 01efc4e22..000000000
--- a/plugins/web-ui/test/approval-continuation-source.test.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-const composer = readFileSync(new URL("../src/composer.ts", import.meta.url), "utf8");
-
-test("approval continuations attach their exact run while sibling cards stay independent", () => {
- assert.match(chat, /const runId = await resolveApproval[\s\S]{0,300}await resumeRun/);
- assert.match(chat, /makeRunResumeStreamFn\(runId, initialRun/);
- assert.match(chat, /!chatState\.resolvingApprovals\.has\(approval\.requestId\)/);
- assert.match(chat, /await active\.waitForIdle\(\);[\s\S]{0,100}await syncPendingApprovals\(active\)/);
- assert.match(chat, /delete .*pendingApprovals;[\s\S]{0,100}attachPendingApprovals/);
- assert.match(composer, /resolvingApprovals\.has\(a\.requestId\)/);
- assert.doesNotMatch(composer, /const busy = ctx\.chat\.state\.resolvingApprovals\.size > 0/);
-});
diff --git a/plugins/web-ui/test/archive-closes-pane.test.ts b/plugins/web-ui/test/archive-closes-pane.test.ts
deleted file mode 100644
index 0d30f8478..000000000
--- a/plugins/web-ui/test/archive-closes-pane.test.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const read = (f: string): string => readFileSync(new URL(`../src/${f}`, import.meta.url), "utf8");
-const split = read("split.ts");
-const sessions = read("sessions.ts");
-
-const fn = (src: string, name: string): string => {
- const body = src.match(new RegExp(`^(?:export )?(?:async )?function ${name}\\([\\s\\S]*?\\n\\}`, "m"))?.[0] ?? "";
- assert.ok(body, `${name} not found`);
- return body;
-};
-
-test("archiving a session closes any surface still showing it", () => {
- const close = fn(split, "closeSessionSurfaces");
- assert.match(close, /dockApi\.panels\.filter\(\(p\) => panelParams\(p\)\.sessionId === sessionId\)/);
- assert.match(close, /closePanels\(showing\)/, "open panes must be removed, and reconciled by closePanels");
- assert.match(close, /conv\.state\.sessionId !== sessionId\) return false;/, "leave other conversations alone");
- assert.match(close, /conv\.newChat\(\);/, "outside the canvas the main view drops the archived session");
-
- const archived = fn(sessions, "setArchived");
- assert.match(archived, /if \(archived && s\.id\) closeSessionSurfaces\(s\.id\);/);
- assert.ok(
- archived.indexOf("closeSessionSurfaces") < archived.indexOf("persistSessionPatch"),
- "close the surface before the patch round-trip so the UI reacts immediately",
- );
- assert.doesNotMatch(archived, /!archived.*closeSessionSurfaces/s, "unarchiving must not close anything");
-});
diff --git a/plugins/web-ui/test/attachment-compact.test.ts b/plugins/web-ui/test/attachment-compact.test.ts
deleted file mode 100644
index 3bd8e90d9..000000000
--- a/plugins/web-ui/test/attachment-compact.test.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-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/channel-header-source.test.ts b/plugins/web-ui/test/channel-header-source.test.ts
deleted file mode 100644
index 9ce92a48a..000000000
--- a/plugins/web-ui/test/channel-header-source.test.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const panel = readFileSync(new URL("../src/channel-header.ts", import.meta.url), "utf8");
-const contexts = readFileSync(new URL("../src/contexts.ts", import.meta.url), "utf8");
-const server = readFileSync(new URL("../server/index.ts", import.meta.url), "utf8");
-const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
-
-test("the pinned-header panel exists only for channel scopes and follows the org default", () => {
- assert.match(panel, /scopeId\.startsWith\("channel:"\)/);
- assert.match(panel, /\?selected=\$\{channelHeaderState\.configured === null\}/);
- assert.match(panel, /Default \(\$\{channelHeaderState\.orgDefault \? "on" : "off"\}\)/);
- assert.match(panel, /save\(scopeId, v === "default" \? null : v === "on"\)/);
-});
-
-test("the panel writes through the channel-header-pin endpoint and reports both directions", () => {
- assert.match(panel, /api<HeaderPinWire>\("\/api\/channel-header-pin", \{\s*method: "PUT"/);
- assert.match(panel, /Header pinned in the channel\./);
- assert.match(panel, /Pinned header removed\./);
-});
-
-test("the server proxies the toggle with the signed-in user as principal", () => {
- assert.match(server, /path: "\/api\/channel-header-pin"/);
- assert.match(server, /\/v1\/channel-header-pin\?\$\{qs\.toString\(\)\}/);
-});
-
-test("every context loads and resets the pinned-header setting with the page", () => {
- assert.match(contexts, /loadChannelHeader\(contextsState\.selected, drawContexts\)/);
- assert.match(contexts, /resetChannelHeader\(\)/);
- assert.match(contexts, /channelHeaderSection\(c\.scopeId\)/);
-});
-
-test("pinned-header panel styles use the shell theme contract", () => {
- const block = css.slice(css.indexOf(".channel-header {"), css.indexOf("\n.ambient-policy {"));
- assert.match(block, /color: var\(--muted-foreground\)/);
-});
diff --git a/plugins/web-ui/test/chat-elevation.test.ts b/plugins/web-ui/test/chat-elevation.test.ts
deleted file mode 100644
index 7f4626acd..000000000
--- a/plugins/web-ui/test/chat-elevation.test.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-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("transcript edges do not blur or mask the response", () => {
- assert.doesNotMatch(css, /\.chat-scroll::(?:before|after)/);
- assert.doesNotMatch(css, /\.message-stack \.user-row[^{}]* > \.user-bubble::(?:before|after)/);
- assert.doesNotMatch(css, /--chat-edge-fade/);
-});
-
-test("the pinned prompt and composer have elevated solid surfaces", () => {
- const pinned = css.match(/\.message-stack \.user-row\.stuck > \.user-bubble \{[^}]*\}/)?.[0] ?? "";
- const composer = css.match(/^\.composer-wrap \{[^}]*\}/m)?.[0] ?? "";
- assert.match(pinned, /box-shadow: var\(--chat-surface-shadow\);/);
- assert.match(composer, /background: var\(--background\);/);
- assert.match(composer, /box-shadow:\s*0 2px 5px rgb\(0 0 0 \/ 0\.05\),\s*0 8px 24px rgb\(0 0 0 \/ 0\.06\);/);
-});
-
-test("prompt elevation uses the shared surface shadow only while stuck", () => {
- const root = css.match(/:root \{[^}]*\}/)?.[0] ?? "";
- const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
- assert.match(root, /--chat-surface-shadow:/);
- assert.match(css, /\.user-row\.stuck/);
- assert.doesNotMatch(chat, /markStuckUserRow/);
-});
diff --git a/plugins/web-ui/test/chat-settled-row-cache.test.ts b/plugins/web-ui/test/chat-settled-row-cache.test.ts
deleted file mode 100644
index 4940eb8e7..000000000
--- a/plugins/web-ui/test/chat-settled-row-cache.test.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-
-test("the transcript renders rows through the settled-row cache", () => {
- assert.match(chat, /messages\.map\(\(m, i\) =>\s*settledChatMessage\(m, i - inheritedOffset,/);
-});
-
-test("live, approval-paused, subagent, and steered work rows bypass the cache (their render reads mutable state)", () => {
- assert.match(
- chat,
- /const cacheable =\s*!isStreaming &&\s*!\(message as \{ subagentMail\?: SubagentMailRef \}\)\.subagentMail &&\s*!work\?\.activity\.some\(\s*\(activity\) =>\s*activity.type === "user" \|\|\s*\["session", "sessions", "subagents"\]\.includes\(\(activity\.payload as ToolPayload \| null\)\?\.tool \?\? ""\),?\s*\) &&\s*\(!work \|\| \(\(work\.status === "complete" \|\| work\.status === "failed"\) && !work\.pendingApprovals\?\.length\)\)/,
- );
- assert.match(chat, /if \(!cacheable\) return chatMessage\(message, index, isStreaming\);/);
-});
-
-test("the cache key covers every mutable render input of a settled row", () => {
- for (const field of [
- "hit.day === day",
- "hit.index === index",
- "hit.activity === work?.activity",
- "hit.status === work?.status",
- "hit.stale === work?.stale",
- "hit.deliveredFiles === msg.deliveredFiles",
- "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",
- ]) {
- assert.ok(chat.includes(field), `cache key must compare: ${field}`);
- }
-});
-
-test("prompt expansion is managed by the viewport without invalidating cached templates", () => {
- assert.doesNotMatch(chat, /expandedPrompt|togglePromptExpanded/);
-});
-
-test("canonical steering rows never enter the standalone cache during resume startup", () => {
- const settled = chat.slice(chat.indexOf("function settledChatMessage"), chat.indexOf("function chatMessage"));
- const suppression = settled.indexOf("if ((message as { steered?: boolean }).steered) return nothing;");
- assert.ok(suppression >= 0);
- assert.ok(suppression < settled.indexOf("settledRowCache.get"));
-});
-
-test("inline steering shows the user message without redundant steering chrome", () => {
- assert.match(chat, /class="inline-steer"/);
- assert.doesNotMatch(chat, /steer-label|steered the running task/);
-});
diff --git a/plugins/web-ui/test/composer-fast-mode.test.ts b/plugins/web-ui/test/composer-fast-mode.test.ts
deleted file mode 100644
index b7a2c66a1..000000000
--- a/plugins/web-ui/test/composer-fast-mode.test.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const composer = readFileSync(new URL("../src/model-picker.ts", import.meta.url), "utf8");
-const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
-const fast = composer.slice(
- composer.indexOf('class="loadout-setting"'),
- composer.indexOf('<div class="loadout-foot">'),
-);
-
-test("Fast is a stateful toggle row without a trailing checkmark", () => {
- assert.match(fast, /class="loadout-setting"/);
- assert.match(fast, /role="menuitemcheckbox"/);
- assert.match(fast, /aria-checked=\$\{fastOn \? "true" : "false"\}/);
- assert.match(fast, /@click=\$\{\(\) => toggleFastMode\(agent\)\}/);
- assert.match(fast, /class="loadout-toggle \$\{fastOn \? "on" : ""\}"/);
- assert.doesNotMatch(fast.slice(0, fast.indexOf("</button>")), /icon\(Check/);
-});
-
-test("the Fast toggle names itself and hides its decorative track", () => {
- assert.match(fast, /aria-label="Fast"/);
- assert.match(fast, /aria-hidden="true"/);
- assert.match(fast, /fastAvailable \? "⌘⇧E" : fastUnsupportedReason/);
-});
-
-test("the toggle track and knob carry their own state styling", () => {
- assert.match(css, /\.loadout-toggle \{[^}]*\}/);
- assert.match(css, /\.loadout-toggle\.on \{[^}]*\}/);
- assert.match(css, /\.loadout-knob \{[^}]*\}/);
-});
diff --git a/plugins/web-ui/test/composer-no-scrollbar.test.ts b/plugins/web-ui/test/composer-no-scrollbar.test.ts
deleted file mode 100644
index b3f3dbc8c..000000000
--- a/plugins/web-ui/test/composer-no-scrollbar.test.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-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 composer = readFileSync(new URL("../src/composer.ts", import.meta.url), "utf8");
-
-test("composer input rests overflow-hidden below the height cap", () => {
- const block = css.match(/\.composer-input \{[^}]*\}/)?.[0] ?? "";
- assert.match(block, /overflow-y: hidden;/, "base CSS must suppress the scrollbar below the cap");
-});
-
-test("no chat composer leaves the horizontal axis on the textarea UA default of auto", () => {
- for (const selector of [".composer-input"]) {
- const block = css.match(new RegExp(`\\${selector} \\{[^}]*\\}`))?.[0] ?? "";
- assert.notEqual(block, "", `${selector} is styled`);
- assert.match(
- block,
- /overflow-x: hidden;/,
- `${selector} soft-wraps, so an auto x-axis only ever paints a phantom bar`,
- );
- }
-});
-
-test("resizeComposer opens scrolling only past the cap and pins scrollTop under it", () => {
- const fn = composer.match(/function resizeComposer\(\): void \{[\s\S]*?\n {2}\}/)?.[0] ?? "";
- assert.match(
- fn,
- /const cap = parseFloat\(getComputedStyle\(ta\)\.maxHeight\) \|\| 180;/,
- "the cap follows the computed max-height (120 pane / 180 main)",
- );
- assert.match(fn, /content > cap/, "overflow flips on content beyond the cap only");
- assert.match(fn, /overflowY = "auto"/);
- assert.match(fn, /overflowY = "hidden"/);
- assert.match(fn, /ta\.scrollTop = 0/, "under the cap any residual scroll offset is cleared");
-});
-
-test("the send-clear path resets overflow and scroll before the input is seen empty", () => {
- const fn = composer.match(/function clearComposerDom\(agent: Agent\): void \{[\s\S]*?\n {2}\}/)?.[0] ?? "";
- assert.match(fn, /overflowY = "hidden"/, "clearing must close the scroller synchronously");
- assert.match(fn, /scrollTop = 0/, "clearing must drop the clamped scroll offset");
-});
diff --git a/plugins/web-ui/test/composer-source.test.ts b/plugins/web-ui/test/composer-source.test.ts
deleted file mode 100644
index 7dd45f4c0..000000000
--- a/plugins/web-ui/test/composer-source.test.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const picker = readFileSync(new URL("../src/model-picker.ts", import.meta.url), "utf8");
-
-const composer = readFileSync(new URL("../src/composer.ts", import.meta.url), "utf8");
-
-test("preset default actions live on the row while inheritance remains in the footer", () => {
- const row = picker.slice(picker.indexOf("function loadoutRow"), picker.indexOf("function cancelLoadoutClose"));
- const loadout = picker.slice(picker.indexOf("function render"), picker.indexOf("function menuArrowKeys"));
- assert.ok(row.includes('class="loadout-make-default"'));
- assert.ok(row.includes("effortLevel: settings.effort"));
- assert.ok(row.includes("fastMode: settings.fast"));
- assert.ok(!loadout.includes("Make default"));
- assert.ok(loadout.includes("changeScopeRuntime({ inherit: true }, agent)"));
-});
-
-test("compact and full composers share one left-side picker with Fast inside its menu", () => {
- assert.ok(
- /const runtimeControls = modelPicker.render\(agent, selectedModel, inputBlocked\)/.test(composer),
- "compact surfaces must retain the full model and effort picker",
- );
- const leftStart = composer.indexOf('class="composer-left"');
- const rightStart = composer.indexOf('class="composer-right"');
- assert.ok(leftStart >= 0 && rightStart > leftStart);
- assert.ok(composer.slice(leftStart, rightStart).includes("${runtimeControls}"));
- assert.ok(/class="composer-right">\$\{sendControls\(agent\)\}<\/div>/.test(composer));
- const loadout = picker.slice(picker.indexOf("function render"), picker.indexOf("function menuArrowKeys"));
- assert.ok(/role="menuitemcheckbox"\s+aria-label="Fast"/.test(loadout));
- assert.equal((picker.match(/@click=\$\{\(\) => toggleFastMode\(agent\)\}/g) ?? []).length, 1);
-});
-
-test("switching setups preserves prior tweaks and validates effort and Fast for the selected model", () => {
- const apply = composer.slice(
- composer.indexOf("function applyLoadout"),
- composer.indexOf("function composerShortcut"),
- );
- const remember = apply.indexOf("rememberActiveTweaks(previous)");
- const select = apply.indexOf("selectModel(entry.value, agent)");
- assert.ok(remember >= 0 && select > remember, "save the prior model's tweaks before switching");
- const normalize = composer.slice(
- composer.indexOf("function normalizeLoadoutEntry"),
- composer.indexOf("function seededLoadout"),
- );
- assert.ok(normalize.includes("effortLevelsForHarness(option.harnessId, option.model)"));
- assert.ok(/levels.some\([\s\S]*?\? entry.effort/.test(normalize));
- assert.ok(apply.includes("normalizeLoadoutEntry(entry, option)"));
- assert.ok(
- /entry.fast && harnessSupportsFastMode\(option.harnessId\) && modelSupportsFastMode\(scopeKey\(\), option.model.id\)/.test(
- normalize,
- ),
- "a stored Fast preference cannot enable an unsupported model",
- );
- assert.ok(apply.includes("saveLoadout(loadout, loadoutKey)"));
-});
-
-test("attaching files is allowed while a turn is streaming", () => {
- assert.match(composer, /const attachingDisabled = inputBlocked;/);
- assert.doesNotMatch(composer, /attachingDisabled = inputBlocked \|\| agent\.state\.isStreaming/);
- const guards = composer.match(/isStreaming/g) ?? [];
- const pickFiles = composer.slice(
- composer.indexOf("function pickFiles"),
- composer.indexOf("function removeAttachment"),
- );
- assert.doesNotMatch(pickFiles, /isStreaming/);
- const addFiles = composer.slice(
- composer.indexOf("async function addFiles"),
- composer.indexOf("function dragHasFiles"),
- );
- assert.doesNotMatch(addFiles, /isStreaming/);
- assert.ok(guards.length > 0, "streaming still gates steer/send routing");
-});
-
-test("a mid-turn submit queues — attachments cannot ride a queued message and stay for the next", () => {
- assert.match(composer, /\$\{tip\("Queue for after this turn"\)\}/);
- assert.doesNotMatch(composer, /attachments stay for your next message/);
-});
-
-test("scope runtime defaults include effort and fast mode", () => {
- assert.match(picker, /effortLevel: settings\.effort/);
- assert.match(picker, /fastMode: settings\.fast/);
- assert.match(composer, /getRuntimeConfig\(scopeKey\(\)\)\?\.effective\.effortLevel/);
- assert.match(composer, /getRuntimeConfig\(scopeKey\(\)\)\?\.effective\.fastMode === true/);
-});
diff --git a/plugins/web-ui/test/context-model-source.test.ts b/plugins/web-ui/test/context-model-source.test.ts
deleted file mode 100644
index a2f7410b5..000000000
--- a/plugins/web-ui/test/context-model-source.test.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const panel = readFileSync(new URL("../src/context-model.ts", import.meta.url), "utf8");
-const contexts = readFileSync(new URL("../src/contexts.ts", import.meta.url), "utf8");
-const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
-
-test("the scope's model panel writes through the same endpoint the composer's default does", () => {
- assert.match(panel, /saveRuntimeConfig\(\s*scope,/);
- assert.match(panel, /\{ inherit: true \}/);
- assert.match(panel, /harnessId,\n\s+modelId: value\.slice\(sep \+ 1\)/);
- assert.doesNotMatch(panel, /applyRuntimeOptions/);
-});
-
-test("the panel offers inheriting the org default and names what is serving now", () => {
- assert.match(panel, /changeDefault: \(\) => choose\(scopeId, INHERIT\)/);
- assert.match(panel, /no longer offered/);
-});
-
-test("context settings reuse the composer picker and disable it while saving", () => {
- assert.match(panel, /createModelPicker<void>/);
- assert.match(panel, /picker.render\(undefined, option, contextModelState.saving\)/);
- assert.doesNotMatch(panel, /fieldSelect/);
- assert.match(panel, /aria-live="polite"/);
-});
-
-test("every context loads and resets its model setting with the page", () => {
- assert.match(contexts, /loadContextModel\(contextsState\.selected, drawContexts\)/);
- assert.match(contexts, /resetContextModel\(\)/);
- assert.match(contexts, /<aside class="context-settings"[^]*?contextModelSection\(c\.scopeId\)/);
-});
-
-test("model panel styles use the shell theme contract", () => {
- const block = css.slice(css.indexOf(".context-model {"), css.indexOf("\n.ambient-policy {"));
- assert.match(block, /color: var\(--muted-foreground\)/);
- assert.match(block, /color: var\(--destructive/);
- assert.doesNotMatch(block, /#[0-9a-f]{6}(?![^)]*\))/i);
-});
-
-test("an in-flight pick wins the saving re-render — no snap-back while the save runs", () => {
- assert.match(panel, /pending: null as string \| null/);
- assert.match(panel, /contextModelState\.pending = value/);
- assert.match(panel, /contextModelState\.saving = false;\n\s+contextModelState\.pending = null;/);
-});
-
-test("context effort and Fast use the shared harness and model capabilities", () => {
- assert.match(panel, /return effortLevelsForHarness\(harnessId, model\)/);
- assert.match(panel, /harnessSupportsFastMode\(harnessId\)/);
- assert.match(panel, /modelSupportsFastMode\(scope, value.slice\(sep \+ 1\)\)/);
-});
-
-test("no effort is ever sent for a harness that doesn't support it", () => {
- assert.match(panel, /if \(!harnessSupportsEffort\(harnessId\)\) return \[\];/);
-});
-
-test("the model card omits explanatory and success prose", () => {
- assert.doesNotMatch(
- panel,
- /The model every conversation|Following the org default|Pinned for this project|Saved\. New conversations/,
- );
-});
diff --git a/plugins/web-ui/test/contexts-source.test.ts b/plugins/web-ui/test/contexts-source.test.ts
deleted file mode 100644
index e00094cad..000000000
--- a/plugins/web-ui/test/contexts-source.test.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const source = readFileSync(new URL("../src/contexts.ts", import.meta.url), "utf8");
-
-test("contexts pane redraws preserve focus instead of raw-replacing the DOM", () => {
- assert.match(
- source,
- /render\(selected \? detailTpl\(selected\) : gridTpl\(\), host\);\s+replacePanePreservingFocus\(host\);/,
- );
- assert.doesNotMatch(source, /appState\.mainEl\.replaceChildren/);
-});
-
-test("contexts pane text inputs carry focus keys", () => {
- assert.match(source, /data-focus-key="project-member-search"/);
- assert.match(source, /data-focus-key="contexts-search"/);
- assert.match(source, /data-focus-key="project-name"/);
- assert.match(
- readFileSync(new URL("../src/ambient-policy.ts", import.meta.url), "utf8"),
- /data-focus-key="ambient-orders"/,
- );
-});
-
-test("member search commits the typed query to state on input", () => {
- const input = source.match(/<input\s+id="project-member-search"[^]*?\/>/)?.[0] ?? "";
- assert.match(
- input,
- /@input=\$\{[^]*?contextsState\.memberQuery = \(event\.currentTarget as HTMLInputElement\)\.value/,
- );
- assert.match(input, /\.value=\$\{contextsState\.memberQuery\}/);
-});
-
-test("member search runs debounced as you type", () => {
- const input = source.match(/<input\s+id="project-member-search"[^]*?\/>/)?.[0] ?? "";
- assert.match(input, /@input=\$\{[^]*?scheduleMemberSearch\(/);
- assert.match(source, /function scheduleMemberSearch\(/);
- assert.match(source, /clearTimeout\(memberSearchTimer\)/);
- assert.match(source, /memberSearchTimer = (?:window\.)?setTimeout\([^]*?MEMBER_SEARCH_DEBOUNCE_MS/);
-});
-
-test("submit and debounce share runMemberSearch", () => {
- assert.match(source, /async function runMemberSearch\(/);
- const submit = source.match(/async function searchProjectMembers\([^]*?\n\}/)?.[0] ?? "";
- assert.match(submit, /runMemberSearch\(/);
-});
-
-test("no-match searches render visible feedback", () => {
- assert.match(source, /memberSearchedQuery/);
- assert.match(source, /No matches for/);
- assert.match(source, /already in this project/);
-});
-
-test("dismissing the picker cancels a pending debounced search", () => {
- for (const fn of ["closeMemberPicker", "toggleMemberPicker", "selectContext", "addProjectMember"]) {
- const body = source.match(new RegExp(`function ${fn}\\([^]*?\\n\\}`))?.[0] ?? "";
- assert.match(body, /cancelMemberSearchTimer\(\)/, `${fn} must cancel the debounce timer`);
- }
-});
-
-test("typing supersedes an in-flight search", () => {
- const sched = source.match(/function scheduleMemberSearch\([^]*?\n\}/)?.[0] ?? "";
- assert.match(sched, /memberSearchSeq\+\+/);
- assert.match(sched, /memberSearching = false/);
-});
-
-test("result cap applies after the member filter", () => {
- assert.match(source, /\.filter\(\(match\) => !members\.has\(match\.principalId\)\)\.slice\(0, 8\)/);
-});
-
-test("every project member can invite while only the owner can remove people", () => {
- const detail = source.match(/function detailTpl\([^]*?\n\}/)?.[0] ?? "";
- const members = source.match(/function projectMembersSection\([^]*?\n\}/)?.[0] ?? "";
- assert.match(detail, /\$\{\s*c\.project\s*\? html`<button class="btn context-add-member"/);
- assert.doesNotMatch(detail, /c\.project && isProjectOwner\(c\)/);
- assert.match(members, /isProjectOwner\(context\) && principalId !== project\.ownerId/);
-});
diff --git a/plugins/web-ui/test/crons-deep-link.test.ts b/plugins/web-ui/test/crons-deep-link.test.ts
deleted file mode 100644
index efbfe06d6..000000000
--- a/plugins/web-ui/test/crons-deep-link.test.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const source = readFileSync(new URL("../src/crons.ts", import.meta.url), "utf8");
-const shell = readFileSync(new URL("../src/shell.ts", import.meta.url), "utf8");
-
-test("a run's worklog link addresses the chats view, not the page it was rendered on", () => {
- assert.match(source, /class="cron-run-link" href=\$\{deepLinkPath\(UI_BASE, "chats", run\.sessionId\)\}/);
- assert.doesNotMatch(source, /location\.pathname\}\?session=/);
-});
-
-test("a cron row is a real link to its own path", () => {
- assert.match(source, /<a\s+class="cron-row-main"\s+href=\$\{deepLinkPath\(UI_BASE, "crons", null, null, c\.id\)\}/);
-});
-
-test("cron index rows keep details and raw schedules out of the summary", () => {
- const row = source.slice(source.indexOf("function cronPageRow"), source.indexOf("function cronRowActions"));
- assert.doesNotMatch(row, /cronPreview|cronScheduleSummary/);
- assert.match(row, /cronRunSummary\(c\)/);
-});
-
-test("cron index keeps only search in its header controls", () => {
- const page = source.slice(source.indexOf("function drawCronsPage"), source.indexOf("function setCronTab"));
- assert.doesNotMatch(page, /onScope|onRefresh|label: "New cron"/);
- assert.match(page, /placeholder: "Search crons"/);
-});
-
-test("reopening a cron refreshes recent runs without a manual refresh control", () => {
- assert.match(source, /const shouldRefreshRuns = opts\.refreshRuns \|\| activeCronId !== c\.id;/);
- assert.match(source, /openCron\(c, \{ refreshRuns: true \}\)/);
-});
-
-test("modified clicks fall through to the browser so open-in-tab and save-link still work", () => {
- const deepLink = readFileSync(new URL("../src/deep-link.ts", import.meta.url), "utf8");
- assert.match(deepLink, /e\.metaKey \|\| e\.ctrlKey \|\| e\.shiftKey \|\| e\.altKey \|\| e\.button !== 0/);
- assert.match(source, /if \(!isPlainLeftClick\(event\)\) return;/);
-});
-
-test("opening a cron from the list pushes history, so Back returns to the list", () => {
- assert.match(source, /openCron\(c, \{ push: true \}\)/);
- assert.match(source, /if \(push\) history\.pushState\(null, "", next\);\s+else history\.replaceState/);
- assert.match(shell, /addEventListener\("popstate"[\s\S]*?routeCronsHistory\(item\)/);
-});
-
-test("a failed load is never reported as a missing cron", () => {
- assert.match(source, /const loaded = await refreshCrons/);
- assert.match(source, /if \(!loaded\) return drawCronsPage\(\);/);
- const body = source.slice(source.indexOf("export async function renderCronsPage"));
- assert.ok(body.indexOf("if (!loaded)") < body.indexOf("wasn't found"));
-});
-
-test("a pending deep-linked cron is consumed even when the view changed mid-load", () => {
- const body = source.slice(source.indexOf("export async function renderCronsPage"));
- const consume = body.indexOf("pendingCronId = null");
- const guard = body.indexOf('appState.currentView !== "crons") return', body.indexOf("await refreshCrons"));
- assert.ok(consume !== -1 && guard !== -1 && consume < guard);
-});
diff --git a/plugins/web-ui/test/css-vars.test.ts b/plugins/web-ui/test/css-vars.test.ts
deleted file mode 100644
index 0087fe3ba..000000000
--- a/plugins/web-ui/test/css-vars.test.ts
+++ /dev/null
@@ -1,210 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync, readdirSync } from "node:fs";
-import test from "node:test";
-
-const shellCss = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
-const themeCss = readFileSync(
- new URL("../node_modules/@earendil-works/pi-web-ui/dist/app.css", import.meta.url),
- "utf8",
-);
-const srcDir = new URL("../src/", import.meta.url);
-const tsSource = readdirSync(srcDir)
- .filter((f) => f.endsWith(".ts"))
- .map((f) => readFileSync(new URL(f, srcDir), "utf8"))
- .join("\n");
-
-test("every no-fallback var() in shell.css names a property something defines", () => {
- const defined = new Set<string>();
- for (const m of (shellCss + themeCss).matchAll(/(?:^|[\s;{(])(--[A-Za-z0-9-]+)\s*:/g)) defined.add(m[1]);
- for (const m of tsSource.matchAll(/(--[A-Za-z0-9-]+)/g)) defined.add(m[1]);
- const dead = new Set<string>();
- for (const m of shellCss.matchAll(/var\(\s*(--[A-Za-z0-9-]+)\s*\)/g)) {
- if (!defined.has(m[1])) dead.add(m[1]);
- }
- assert.deepEqual([...dead], [], "var() references that nothing defines (add the property or a fallback)");
-});
-
-test("colored session actions keep their row hue at rest and on hover", () => {
- const variables = shellCss.match(/\.session-row\.colored \{[^}]+\}/)?.[0] ?? "";
- assert.match(variables, /--session-action-hover:\s*color-mix\([^;]+var\(--session-color\)/);
- assert.match(variables, /--session-action-foreground:\s*color-mix\([^;]+var\(--session-color\)/);
- assert.match(shellCss, /\.session-row\.colored \.session-menu-btn \{\s*color: var\(--session-action-foreground\);/);
- assert.match(
- shellCss,
- /\.session-row\.colored \.session-menu-btn:hover,[\s\S]*?\.session-row\.colored\.menu-open \.session-menu-btn \{\s*background: var\(--session-action-hover\);\s*color: var\(--session-action-foreground\);/,
- );
-});
-
-test("conversation colors use solid fills from the refined spectrum palette on every list surface", () => {
- assert.match(tsSource, /const SESSION_COLORS = \["#f43f5e", "#f59e0b", "#10b981", "#3b82f6", "#8b5cf6", "#ec4899"\]/);
- assert.equal(tsSource.match(/const color = displaySessionColor\(s\.color\);/g)?.length, 2);
- assert.match(tsSource, /const current = displaySessionColor\(s\.color\);/);
- assert.doesNotMatch(tsSource, /#d2664d|#b98a52|#7d884f|#5f8b83|#527d99|#8b5d52/);
- assert.match(shellCss, /conic-gradient\(#f43f5e, #f59e0b, #10b981, #3b82f6, #8b5cf6, #ec4899, #f43f5e\)/);
- for (const rule of [
- shellCss.match(/\.session-row\.colored \.session \{[^}]+\}/)?.[0] ?? "",
- shellCss.match(
- /\.session-row\.colored \.session:hover,\s*\.session-row\.colored\.menu-open \.session \{[^}]+\}/,
- )?.[0] ?? "",
- shellCss.match(/\.session-row\.colored\.active \.session \{[^}]+\}/)?.[0] ?? "",
- shellCss.match(/\.list-row\.chat-row\.colored \{[^}]+\}/)?.[0] ?? "",
- shellCss.match(/\.list-row\.chat-row\.colored:hover \{[^}]+\}/)?.[0] ?? "",
- ]) {
- assert.match(rule, /background:\s*color-mix\(/);
- assert.doesNotMatch(rule, /gradient\(/);
- }
- assert.doesNotMatch(shellCss, /\.session-row\.colored \.session::before/);
-});
-
-test("painted sidebar backgrounds align without moving conversation text", () => {
- const extended =
- shellCss.match(
- /\.session-row:is\(\.colored, \.active, \.menu-open, \.selected, \.read-only, :hover\) \.session \{[^}]+\}/,
- )?.[0] ?? "";
- assert.match(extended, /width:\s*calc\(100% \+ 4px\);/);
- assert.match(extended, /margin-left:\s*-4px;/);
- assert.match(extended, /padding-left:\s*15px;/);
- const nested =
- shellCss.match(
- /\.recent-project-children \.session-row:is\(\.colored, \.active, \.menu-open, \.selected, \.read-only, :hover\) \.session,[\s\S]*?\{[^}]+\}/,
- )?.[0] ?? "";
- assert.match(
- nested,
- /\.archived-children \.session-row:is\(\.colored, \.active, \.menu-open, \.selected, \.read-only, :hover\) \.session,/,
- );
- assert.match(
- nested,
- /\.pinned-children \.session-row:is\(\.colored, \.active, \.menu-open, \.selected, \.read-only, :hover\) \.session \{/,
- );
- assert.match(nested, /padding-left:\s*10px;/);
-});
-
-test("pinned conversations align with project conversations without a header-to-child gap", () => {
- assert.match(tsSource, /class="pinned-head-glyph"/);
- assert.match(tsSource, /class="pinned-children"/);
- assert.match(shellCss, /\.recent-project \{[\s\S]*?margin:\s*3px 0 5px 4px;/);
- const header = shellCss.match(/\.recents-group\.pinned-head \{[^}]+\}/)?.[0] ?? "";
- assert.match(header, /min-height:\s*30px;/);
- assert.match(header, /margin:\s*3px 0 0 4px;/);
- assert.match(header, /padding:\s*4px 3px 4px 2px;/);
- assert.match(header, /font-size:\s*var\(--font-12-5\);/);
- assert.match(shellCss, /\.pinned-head-glyph \{[\s\S]*?flex: 0 0 14px;/);
- assert.match(shellCss, /\.pinned-children \{[\s\S]*?margin-left: 13px;/);
- assert.match(shellCss, /\.pinned-children \.session \{\s*padding-left: 6px;/);
-});
-
-test("sidebar conversations keep space between their backgrounds and the scrollbar", () => {
- const list = shellCss.match(/\.sidebar \.list \{[^}]+\}/)?.[0] ?? "";
- assert.match(list, /box-sizing:\s*border-box;/);
- assert.match(list, /padding-right:\s*8px;/);
- assert.match(list, /scrollbar-gutter:\s*stable;/);
-});
-
-test("every drop zone the canvas renders has a positioning rule in shell.css", () => {
- const splitTs = readFileSync(new URL("../src/split.ts", import.meta.url), "utf8");
- const edges = [...splitTs.matchAll(/zoneTpl\("([a-z]+)"/g)].map((m) => m[1]);
- assert.ok(edges.length >= 5, `expected the canvas drop zones, found ${edges.length}`);
- const missing = edges.filter((e) => !new RegExp(`\\.zone-${e}\\s*\\{`).test(shellCss));
- assert.deepEqual(missing, [], "drop zones rendered with no .zone-<edge> rule (they collapse to 0×0)");
-});
-
-test("expanded pins wrap their full text instead of truncating to one line", () => {
- const item = shellCss.match(/\.pinned-item \{[^}]+\}/)?.[0] ?? "";
- assert.match(item, /flex-direction:\s*column;/);
- const text = shellCss.match(/\.pinned-item-text \{[^}]+\}/)?.[0] ?? "";
- assert.match(text, /white-space:\s*pre-wrap;/);
- assert.match(text, /overflow-wrap:\s*anywhere;/);
- assert.doesNotMatch(text, /text-overflow|nowrap/);
- assert.doesNotMatch(tsSource, /class="pinned-item" title=/);
-});
-
-test("chat shadows stay limited to elevated surfaces and subtle activity hover glow", () => {
- 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)]
- .filter((shadow) => shadow[2].trim() !== "none")
- .map((shadow) => [rule[1].trim(), shadow[1], shadow[2].trim().replace(/\s+/g, " ")]),
- );
- assert.deepEqual(
- painted,
- [
- ...elevated.map((selector) => [selector, "box", "var(--chat-surface-shadow)"]),
- [
- ".work-head:hover,\n.tool-row .tool-summary:hover,\n.thinking-summary:hover",
- "text",
- "0 0 12px color-mix(in srgb, var(--foreground) 12%, transparent)",
- ],
- [".composer-wrap", "box", "0 2px 5px rgb(0 0 0 / 0.05), 0 8px 24px rgb(0 0 0 / 0.06)"],
- [".qm-tooltip", "box", "var(--chat-surface-shadow)"],
- ],
- "pinned surfaces, the composer, and tooltips retain their shadows; activity glow appears only on hover",
- );
- const inlineShadows = [...tsSource.matchAll(/(?:box|text)-shadow\s*:\s*([^;}]+)/g)]
- .map((m) => m[1].trim())
- .filter((v) => v !== "none");
- 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") || background === "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}`);
- }
-});
-
-test("desktop density tokens keep original touch sizes and a 12px floor", () => {
- const root = shellCss.match(/:root \{([^}]+)\}/)?.[1] ?? "";
- const desktop = shellCss.match(/@media \(min-width: 861px\) and \(hover: hover\) \{\s*:root \{([^}]+)\}/)?.[1] ?? "";
- const tokens = (block: string) => new Map([...block.matchAll(/(--[\w-]+):\s*([^;]+);/g)].map((m) => [m[1], m[2]]));
- const before = tokens(root);
- const after = tokens(desktop);
- assert.equal(before.get("--text-scale"), "1");
- assert.equal(after.get("--text-scale"), "0.9");
- for (const [name, value] of before) {
- if (!name.startsWith("--font-")) continue;
- const original = Number.parseFloat(value);
- assert.equal(after.get(name), `${Math.max(12, Math.round(original * 90) / 100)}px`, name);
- }
- for (const [name, original, compact] of [
- ["--content-w", "820px", "740px"],
- ["--chat-pad", "16px", "14.4px"],
- ["--meta-lane", "24px", "21.6px"],
- ["--session-title-size", "13.5px", "12.5px"],
- ]) {
- assert.equal(before.get(name), original);
- assert.equal(after.get(name), compact);
- }
- const scaled = (offset: string) =>
- `font-size: max(min(12px, calc(var(--chat-font-size) - ${offset})), calc((var(--chat-font-size) - ${offset}) * var(--text-scale)));`;
- for (const [selector, offset] of [
- [".thinking", "2px"],
- [".thinking-summary", "1px"],
- [".thinking-body", "1px"],
- [".work-message", "1px"],
- ]) {
- const block = shellCss.match(new RegExp(`\\n${selector.replace(".", "\\.")} \\{([^}]*)\\}`))?.[1] ?? "";
- assert.ok(block.includes(scaled(offset)), selector);
- }
-});
diff --git a/plugins/web-ui/test/deploy-permissions-source.test.ts b/plugins/web-ui/test/deploy-permissions-source.test.ts
deleted file mode 100644
index b972d6329..000000000
--- a/plugins/web-ui/test/deploy-permissions-source.test.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const source = readFileSync(new URL("../src/deploy-permissions.ts", import.meta.url), "utf8");
-
-test("app permissions expose explicit private and public general-access states", () => {
- assert.match(source, /General access/);
- assert.match(source, /Restricted/);
- assert.match(source, /Anyone with the link/);
- assert.match(source, /No sign-in required/);
- assert.match(source, /post\(\{ public: true \}\)/);
- assert.match(source, /post\(\{ public: false \}\)/);
- assert.match(source, /Public\. Anyone can open this app\./);
-});
-
-test("app permissions offer explicit view-only email grants outside the directory", () => {
- assert.match(source, /Add people by name or email/);
- assert.match(source, /emailCandidate/);
- assert.match(source, /Add \$\{emailCandidate\(\)\} with view access/);
- assert.match(source, /selected\.email \? "view" : access/);
- assert.match(source, /email \? \{ email \} : \{ scope \}/);
- assert.match(source.replace(/\s+/g, " "), /This does not add them to your organization/);
- assert.match(source, /Access granted, but no invitation email was sent/);
-});
-
-test("general access is one menu: restricted, the org, or (admin permitting) anyone with the link", () => {
- assert.match(source, /externalSharing = response\.externalSharing !== false/);
- assert.match(source, /disabledHint: "An org admin must turn on external app sharing first\."/);
- assert.match(source, /post\(\{ scope: "org", access: "view" \}\)/);
-});
diff --git a/plugins/web-ui/test/effort-peak-contrast.test.ts b/plugins/web-ui/test/effort-peak-contrast.test.ts
deleted file mode 100644
index bebc10494..000000000
--- a/plugins/web-ui/test/effort-peak-contrast.test.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-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 LIGHT_SURFACES = ["#ffffff", "#f5f5f5"];
-const DARK_SURFACES = ["#070f18", "#18212c"];
-const AA_NORMAL_TEXT = 4.5;
-
-function channel(value: number): number {
- const c = value / 255;
- return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
-}
-
-function luminance(hex: string): number {
- const [r, g, b] = [1, 3, 5].map((i) => channel(Number.parseInt(hex.slice(i, i + 2), 16)));
- return 0.2126 * r! + 0.7152 * g! + 0.0722 * b!;
-}
-
-function contrast(a: string, b: string): number {
- const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);
- return (hi! + 0.05) / (lo! + 0.05);
-}
-
-function rampAfter(marker: string): string[] {
- const rule = css.slice(css.indexOf(marker));
- const spectrum = /linear-gradient\(\s*90deg,([^)]*)\)/.exec(rule);
- assert.ok(spectrum, `no spectrum gradient found after ${marker}`);
- return [...spectrum![1]!.matchAll(/#[0-9a-f]{6}/g)].map((m) => m[0]);
-}
-
-test("the Extra high spectrum clears AA on the surfaces it is painted on", () => {
- const light = rampAfter(".effort-peak {");
- const dark = rampAfter(":root.dark .effort-peak,");
- assert.equal(light.length, 9);
- assert.equal(dark.length, 9);
- for (const [ramp, surfaces] of [
- [light, LIGHT_SURFACES],
- [dark, DARK_SURFACES],
- ] as const) {
- for (const stop of ramp) {
- for (const surface of surfaces) {
- assert.ok(
- contrast(stop, surface) >= AA_NORMAL_TEXT,
- `${stop} on ${surface} is ${contrast(stop, surface).toFixed(2)}:1, below ${AA_NORMAL_TEXT}:1`,
- );
- }
- }
- }
-});
-
-test("the hover glint darkens light surfaces and lightens dark ones", () => {
- const light = css.slice(css.indexOf(".effort-peak {"), css.indexOf(":root.dark .effort-peak,"));
- const dark = css.slice(css.indexOf(":root.dark .effort-peak,"));
- assert.match(light, /linear-gradient\(105deg,[^)]*rgb\(0 0 0 \/ 0?\.\d+\)/);
- assert.match(dark, /linear-gradient\(105deg,[^)]*rgb\(255 255 255 \/ 0?\.\d+\)/);
-});
-
-test("the spectrum never leaves the label invisible when the paint is dropped", () => {
- for (const guard of ["@supports not ((background-clip: text) or (-webkit-background-clip: text))", "@media print"]) {
- const block = css.slice(css.indexOf(guard), css.indexOf("}", css.indexOf("color: inherit;", css.indexOf(guard))));
- assert.match(block, /background-image: none;/, `${guard} must drop the gradient, not just restore the colour`);
- assert.match(block, /color: inherit;/, `${guard} must restore a visible colour`);
- }
- assert.match(css, /\.effort-peak::selection \{\s*color: var\(--foreground\);/);
-});
diff --git a/plugins/web-ui/test/field-select-source.test.ts b/plugins/web-ui/test/field-select-source.test.ts
deleted file mode 100644
index 6e50f52ad..000000000
--- a/plugins/web-ui/test/field-select-source.test.ts
+++ /dev/null
@@ -1,133 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import { readdirSync } from "node:fs";
-import test from "node:test";
-
-const srcDir = new URL("../src/", import.meta.url);
-const ui = readFileSync(new URL("ui.ts", srcDir), "utf8");
-const css = readFileSync(new URL("shell.css", srcDir), "utf8");
-
-test("the shell has exactly one dropdown, and it is a real select", () => {
- const offenders = readdirSync(srcDir)
- .filter((f) => f.endsWith(".ts"))
- .filter((f) => readFileSync(new URL(f, srcDir), "utf8").includes("<select"));
- assert.deepEqual(offenders, ["ui.ts"], "every dropdown goes through fieldSelect()");
- assert.match(ui, /<select/);
- assert.match(ui, /icon\(ChevronDown, 16\)/);
- assert.doesNotMatch(ui, /function selectMenu/);
- assert.doesNotMatch(readFileSync(new URL("sessions.ts", srcDir), "utf8"), /selectMenu/);
-});
-
-test("the dropdown keeps the accessible name, focus key and disabled state its callers pass", () => {
- for (const attr of [
- /id=\$\{props\.id \?\? nothing\}/,
- /aria-label=\$\{props\.ariaLabel \?\? nothing\}/,
- /aria-description=\$\{props\.ariaDescription \?\? nothing\}/,
- /aria-describedby=\$\{props\.describedBy \?\? nothing\}/,
- /data-focus-key=\$\{props\.focusKey \?\? nothing\}/,
- /\?disabled=\$\{props\.disabled \?\? false\}/,
- ])
- assert.match(ui, attr);
-});
-
-test("the chevron is inset from the edge, not pinned to it", () => {
- const block = css.slice(css.indexOf(".field-select {"), css.indexOf(".field-select.compact > select"));
- assert.match(block, /appearance: none/);
- assert.match(block, /padding: 0 36px 0 10px/);
- assert.match(block, /right: 12px/);
- assert.match(block, /pointer-events: none/);
-});
-
-test("no page keeps its own select chrome now that one rule owns it", () => {
- for (const dead of [".list-select select {", ".deploy-sort select {", ".ambient-enabled-select {\n align-self"])
- assert.ok(!css.includes(dead) || dead.includes("align-self"), `${dead} should be gone`);
- assert.doesNotMatch(css, /\.list-select select \{/);
- assert.doesNotMatch(css, /\.deploy-sort select \{/);
-});
-
-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 —
- // so the caller's value must go through live(), and options mark their own selected.
- assert.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/files-source.test.ts b/plugins/web-ui/test/files-source.test.ts
deleted file mode 100644
index cd80560f9..000000000
--- a/plugins/web-ui/test/files-source.test.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const source = readFileSync(new URL("../src/files.ts", import.meta.url), "utf8");
-const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
-
-test("Files keeps the clickable drop target without a separate upload button", () => {
- assert.doesNotMatch(source, /Files created, uploaded, or shared with you|scopeFilterControl/);
- assert.equal(source.match(/@click=\$\{pickFiles\}/g)?.length, 1);
- assert.match(source, /class="file-drop/);
- assert.match(source, /Drop files here or choose files/);
- assert.doesNotMatch(source, /class="btn primary"[\s\S]{0,200}@click=\$\{pickFiles\}/);
- assert.match(source, /"Ownership"/);
- assert.match(source, /"Type"/);
- assert.doesNotMatch(source, /"Sort",\s*filesSort/);
-});
-
-test("Files uses compact rows that open directly", () => {
- const start = source.indexOf("function fileRow(");
- const end = source.indexOf("\nfunction rowsFromPage", start);
- const row = source.slice(start, end);
- assert.match(row, /<a\s+class="list-row file-row"\s+href=\$\{contentUrl\}\s+target="_blank"/);
- assert.doesNotMatch(row, /file-row-type|\$\{f\.mimetype\}|class="badge"|\$\{f\.kind\}|>Open</);
- assert.doesNotMatch(row, /scopeChip|fileScope\(f\)/);
- assert.match(row, /formatBytes\(f\.sizeBytes\)/);
- assert.match(row, /relTime\(f\.createdAt\)/);
- assert.match(css, /\.file-row \{\s*color: inherit;\s*text-decoration: none;/);
- assert.match(
- css,
- /\.file-row \{\s*display: grid;\s*grid-template-columns: 22px minmax\(0, 1fr\) auto;\s*justify-content: initial;/,
- );
- assert.match(css, /\.file-row \.list-row-title \{\s*justify-self: stretch;\s*text-align: left;/);
- assert.match(css, /\.file-row \.list-row-meta \{\s*gap: 14px;/);
- assert.match(
- css,
- /\.file-list,\s*\.file-groups,\s*\.deploy-list,\s*\.files-page \.file-drop \{\s*width: min\(960px, 100%\);\s*margin-inline: auto;/,
- );
- assert.doesNotMatch(
- css,
- /\.files-page \.list-page-head,\s*\.files-page \.file-drop,\s*\.files-page \.list-toolbar,\s*\.files-page \.file-groups,\s*\.files-page \.file-list \{\s*margin-right: 0;\s*margin-left: 0;/,
- );
-});
-
-test("Files groups rows by scope instead of repeating scope badges", () => {
- assert.match(source, /function groupFilesByScope\(files: FileRow\[\]\)/);
- assert.match(source, /groups\.map\(/);
- assert.match(source, /<h2>\$\{scopeTitle\(group\.scope\)\}<\/h2>/);
- assert.doesNotMatch(source, /scopeChip/);
- assert.match(css, /\.file-scope-group h2 \{/);
- assert.match(source, /else if \(filesScope\) \{\s*filesScope = null;/);
-});
-
-test("Files uses distinct Finder-inspired glyphs and type colors", () => {
- for (const glyph of [
- "FileImage",
- "FileText",
- "FileSpreadsheet",
- "Presentation",
- "FileJson",
- "FileArchive",
- "FileAudio",
- "FileVideo",
- "FileCode",
- ]) {
- assert.match(source, new RegExp(`\\b${glyph}\\b`));
- }
- for (const kind of ["image", "pdf", "spreadsheet", "presentation", "archive", "code", "audio", "video", "document"]) {
- assert.match(css, new RegExp(`\\.file-row-icon\\.${kind}`));
- }
-});
diff --git a/plugins/web-ui/test/fork-remount-preserves-show.test.ts b/plugins/web-ui/test/fork-remount-preserves-show.test.ts
deleted file mode 100644
index 99d070fc6..000000000
--- a/plugins/web-ui/test/fork-remount-preserves-show.test.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-
-// A same-session readonly remount (delivery refresh, earlier pages) must not
-// reset the fork-origin controller: reset bumps the toggle generation and
-// discards an in-flight multi-page "show" load with no error.
-test("readonly remount resets the fork-origin controller only when the session changes", () => {
- assert.match(
- chat,
- /const sameSession = chatState\.sessionId === s\.id && chatState\.threadRef === null;\s*if \(!sameSession\) forkOriginController\.reset\(\);/,
- );
-});
diff --git a/plugins/web-ui/test/fork-transcript-anchor.test.ts b/plugins/web-ui/test/fork-transcript-anchor.test.ts
deleted file mode 100644
index 39cf19fe4..000000000
--- a/plugins/web-ui/test/fork-transcript-anchor.test.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-const sessions = readFileSync(new URL("../src/sessions.ts", import.meta.url), "utf8");
-
-// A fork whose only unloaded prefix is collapsed pre-fork history shows no
-// "earlier" button (adjusted count 0) but MUST keep its refresh anchor —
-// otherwise every settled turn refetches the transcript unbounded.
-test("the refresh anchor derives from raw earlier entries, not the fork-adjusted count", () => {
- assert.match(chat, /const rawEarlier = page\.earlierEntries \?\? 0;/);
- assert.match(
- chat,
- /chatState\.transcriptAnchorSeq = rawEarlier > 0 \? \(page\.entries\?\.\[0\]\?\.seq \?\? null\) : null;/,
- );
- assert.match(chat, /const rawRemaining = page\.earlierEntries \?\? 0;/);
- assert.match(
- chat,
- /chatState\.transcriptAnchorSeq = rawRemaining > 0 \? \(page\.entries\?\.\[0\]\?\.seq \?\? null\) : null;/,
- );
- assert.match(
- chat,
- /setTranscriptWindow\(anchorSeq: number \| null, earlierCount: number, hasEarlier = earlierCount > 0\)/,
- );
- assert.match(sessions, /conv\.setTranscriptWindow\(anchorSeq, earlier, \(entriesRes\.earlierEntries \?\? 0\) > 0\);/);
-});
-
-// Badge navigation must probe access itself: a listed-but-unreadable origin
-// otherwise slips past the controller's error path into a torn-down view.
-test("origin navigation fetches the source transcript before opening it", () => {
- assert.match(chat, /const page = await transcriptFetcher\(sourceId, \{ tailTurns: TAIL_TURNS \}\);/);
- assert.match(chat, /await sessionOpener\(source, Promise\.resolve\(page\)\);/);
-});
diff --git a/plugins/web-ui/test/inbox-feed-resync.test.ts b/plugins/web-ui/test/inbox-feed-resync.test.ts
deleted file mode 100644
index 4925f2a1c..000000000
--- a/plugins/web-ui/test/inbox-feed-resync.test.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const server = readFileSync(new URL("../server/index.ts", import.meta.url), "utf8");
-const coreBridge = readFileSync(new URL("../src/core-bridge.ts", import.meta.url), "utf8");
-const conversations = readFileSync(new URL("../src/conversations.ts", import.meta.url), "utf8");
-const inbox = readFileSync(new URL("../src/inbox.ts", import.meta.url), "utf8");
-
-test("the BFF sends each loop-item change only to its viewers and resyncs everyone only on reconnect", () => {
- const feed = server.match(/function runInboxFeed\(\): Promise<void> \{[\s\S]*?\n\}/)?.[0] ?? "";
- assert.match(feed, /consumeCoreFeed\(\s*"\/v1\/loop-items\/events",\s*"loop_item",/);
- assert.match(feed, /forwardInboxItem\([\s\S]*?\),\s*resyncInbox,/);
- const forward = server.match(/async function forwardInboxItem\([\s\S]*?\n\}/)?.[0] ?? "";
- assert.match(
- forward,
- /"\/v1\/inbox\/viewers",\s*JSON\.stringify\(\{ loopId: ev\.loopId, candidates: \[\.\.\.deliveryClients\.keys\(\)\] \}\)/,
- );
- assert.match(
- forward,
- /for \(const user of viewers\) for \(const res of deliveryClients\.get\(user\) \?\? \[\]\) sseEvent\(res, "inbox_item", frame\);/,
- );
- assert.match(
- forward,
- /if \(!viewers\) return resyncInbox\(\);/,
- "an unanswerable viewer lookup falls back to a resync, so nobody misses a change",
- );
- assert.doesNotMatch(forward, /inbox_resync/);
-});
-
-test("the BFF treats a core-side resync frame like a dropped feed", () => {
- const consume = server.match(/async function consumeCoreFeed\([\s\S]*?\n\}/)?.[0] ?? "";
- assert.match(consume, /event: \$\{eventName\}_resync`\)\) \{\s*onReconnect\?\.\(\);\s*continue;/);
-});
-
-test("a resync or item event while the inbox is hidden marks it stale, and the next staleness-gated refresh consumes the mark", () => {
- const gate = inbox.match(/async function refreshWhenVisible[\s\S]*?\n\}/)?.[0] ?? "";
- assert.match(gate, /resyncMissedWhileHidden = true;\s*return;\s*\}\s*await refreshInbox\(\{ silent: true \}\);/);
- const refresh = inbox.match(/export async function refreshInbox[\s\S]*?\n\}/)?.[0] ?? "";
- assert.match(
- refresh,
- /if \(opts\.ifStaleMs !== undefined && !resyncMissedWhileHidden && Date\.now\(\) - inboxState\.fetchedAt < opts\.ifStaleMs\)\s*return;\s*resyncMissedWhileHidden = false;/,
- "every ifStaleMs caller honors the mark, and it clears only when a fetch actually starts",
- );
- const realtime = inbox.match(/function ensureRealtime\(\): void \{[\s\S]*?\n\}/)?.[0] ?? "";
- assert.match(
- realtime,
- /addEventListener\("visibilitychange"[\s\S]*?refreshInbox\(\{ ifStaleMs: 30_000, silent: true \}\)/,
- );
-});
-
-test("the browser handles inbox_resync frames and treats its own reconnect the same way", () => {
- assert.match(coreBridge, /es\.addEventListener\("inbox_resync", \(\) => onInboxResync\?\.\(\)\);/);
- const onopen = coreBridge.match(/es\.onopen = [\s\S]*?everOpened = true;/)?.[0] ?? "";
- assert.match(onopen, /onResync\?\.\(\);/);
- assert.match(onopen, /onInboxResync\?\.\(\);/, "an EventSource reopen resyncs the inbox, not just the session list");
-});
-
-test("a resync lands as a silent inbox refresh", () => {
- assert.match(conversations, /\(\) => inboxResyncHandler\?\.\(\)/);
- const wired = inbox.match(/onInboxResync\(\(\) => \{[\s\S]*?\}\);/)?.[0] ?? "";
- assert.match(wired, /void refreshWhenVisible\(\);/);
-});
-
-test("realtime inbox events flow through the coalescer, so a burst refetches every touched item", () => {
- assert.match(inbox, /enqueueRealtimeEvent\(\{ loopId: event\.loopId, itemId: event\.itemId \}\);/);
- assert.match(
- inbox,
- /if \(inboxState\.loaded && !inboxState\.selected\.some\(\(loop\) => loop\.id === event\.loopId\)\) return;/,
- "an event that lands before the first load finishes still queues a follow-up refresh",
- );
- assert.match(inbox, /createInboxEventCoalescer\(\s*250,\s*\(\) => void refreshWhenVisible\(\),/);
-});
-
-test("a refresh requested while one is in flight re-runs instead of being dropped", () => {
- const refresh = inbox.match(/export async function refreshInbox[\s\S]*?\n\}/)?.[0] ?? "";
- assert.match(
- refresh,
- /if \(inboxState\.loading\) \{\s*if \(opts\.ifStaleMs === undefined \|\| resyncMissedWhileHidden\) refreshFollowUp = true;/,
- );
- assert.match(
- refresh,
- /if \(refreshFollowUp\) \{\s*refreshFollowUp = false;\s*void refreshInbox\(\{ silent: true \}\);/,
- );
-});
diff --git a/plugins/web-ui/test/inbox-reply-layout.test.ts b/plugins/web-ui/test/inbox-reply-layout.test.ts
deleted file mode 100644
index 16326cec6..000000000
--- a/plugins/web-ui/test/inbox-reply-layout.test.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-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");
-
-test("the loaded conversation renders one assistant beside the source thread", () => {
- const page = inbox.match(/function itemPageTpl[\s\S]*?function keepingChatLogsPinned/)?.[0] ?? "";
- assert.match(
- page,
- /\$\{contextTpl\(item\)\}\s*\$\{draftMessageTpl\(item\)\}[\s\S]*?inbox-item-thread[\s\S]*?\$\{detail\}[\s\S]*?item.detailLoaded \? html`[\s\S]*?<aside class="inbox-item-aside" aria-label="Conversation assistant">\$\{chatTpl\(item\)\}<\/aside>/,
- );
- assert.equal(page.match(/chatTpl\(item\)/g)?.length, 1);
-});
-
-test("desktop threads use a CSS-sized sticky assistant in the second column", () => {
- assert.doesNotMatch(inbox, /sizeAside|ASIDE_MIN_HEIGHT|ASIDE_MAX_HEIGHT/);
- assert.match(css, /@media \(min-width: 1100px\) \{\s*\.inbox-thread-page/);
- assert.match(css, /grid-template-columns: minmax\(0, 1fr\) var\(--content-aside-width\);/);
- assert.match(css, /\.inbox-item-aside \{[^}]*grid-area: 1 \/ 2 \/ span 2;[^}]*position: sticky;/);
- assert.match(css, /\.inbox-item-aside \.inbox-chat-log \{[^}]*flex: 1;[^}]*min-height: 0;[^}]*overflow-y: auto;/);
-});
-
-test("narrow layouts keep the assistant below the source with page scrolling", () => {
- const stacked = css.slice(0, css.indexOf("@media (min-width: 1100px) {\n .inbox-thread-page"));
- assert.match(stacked, /\.inbox-item-aside \{[^}]*width: min\(var\(--content-wide-width\), 100%\);/);
- assert.match(stacked, /\.inbox-item-aside \.inbox-chat-log \{[^}]*max-height: none;[^}]*overflow: visible;/);
-});
-
-test("inbox reuses the shared composer's autosizing", () => {
- const embedded = readFileSync(new URL("../src/embedded-composer.ts", import.meta.url), "utf8");
- assert.match(inbox, /embeddedComposer\(/);
- assert.match(embedded, /ctx.composer.resizeComposer\(\)/);
- assert.doesNotMatch(inbox, /autosizeChatInput/);
-});
diff --git a/plugins/web-ui/test/inbox-source.test.ts b/plugins/web-ui/test/inbox-source.test.ts
deleted file mode 100644
index 2854c8ed0..000000000
--- a/plugins/web-ui/test/inbox-source.test.ts
+++ /dev/null
@@ -1,306 +0,0 @@
-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 split = readFileSync(new URL("../src/split.ts", import.meta.url), "utf8");
-const shell = readFileSync(new URL("../src/shell.ts", import.meta.url), "utf8");
-const shellState = readFileSync(new URL("../src/shell-state.ts", import.meta.url), "utf8");
-const server = readFileSync(new URL("../server/index.ts", import.meta.url), "utf8");
-const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
-
-test("inbox is a first-class view with a draggable sidebar entry", () => {
- assert.match(shellState, /"chats",\s*"inbox",\s*"calendar",\s*"contexts"/);
- assert.match(shell, /case "inbox":\s*void renderInbox\(\);/);
- assert.match(shell, /data-view="inbox"/);
- assert.match(shell, /application\/x-webui-inbox/);
- assert.match(shell, /nav-badge/);
-});
-
-test("inbox access rides the existing permissions plumbing", () => {
- assert.match(shell, /can\("inbox"\) \? html`\$\{inboxNavRow\(\)\}/);
- assert.match(shellState, /if \(view === "inbox" \|\| view === "calendar"\) return can\("inbox"\);/);
- assert.match(server, /process\.env\.INBOX_USERS/);
- assert.match(server, /principalInAllowlist\(principalId, configuredUsers\)/);
- assert.match(server, /if \(isInboxUser\(user\)\) permissions\.push\("inbox"\);/);
- assert.match(inbox, /if \(!can\("inbox"\)\) return;/);
-});
-
-test("the split canvas accepts inbox views as panes alongside sessions", () => {
- assert.match(inbox, /registerPaneKind\(\{/, "the inbox registers itself as a pane kind");
- assert.match(inbox, /paramsKey: "inboxView"/, "saved layouts keep loading under the inboxView key");
- assert.match(inbox, /mountInboxPane\(\{ host, viewId: id/, "pane content mounts the inbox surface");
- assert.match(
- inbox,
- /badge: \(id\) => \(can\("inbox"\) \? inboxOpenCount\(id\) : 0\)/,
- "the gated tab strip shows the open count",
- );
- assert.match(split, /paneKindEntry\(this\.params\)/, "pane content resolves its kind through the registry");
- assert.match(split, /conversation: Conversation \| null = null/);
- assert.match(split, /private ensureConversation\(\): Conversation/);
-});
-
-test("an inbox drag paints drop zones on every existing pane", () => {
- assert.match(
- split,
- /render\(paneDrag \? paneZonesTpl\(this\.panelId\) : nothing/,
- "zones render for any pane drag, inbox included",
- );
- assert.match(shell, /beginPaneKindDrag\("inboxView", "all"\)/, "the sidebar row drags the whole inbox");
- assert.doesNotMatch(inbox, /beginPaneKindDrag\("inboxView"/, "view chips are plain tabs, not drag handles");
-});
-
-test("email items edit like an email; slack items like slack", () => {
- assert.match(inbox, /<span>To<\/span>/);
- assert.match(inbox, /<span>Subject<\/span>/);
- assert.match(inbox, /Send it/, "send is a suggested action");
- assert.match(
- readFileSync(new URL("../src/assistant-sidebar.ts", import.meta.url), "utf8"),
- /inbox-chat-suggest/,
- "suggested actions render beside edit prompts",
- );
- assert.match(inbox, /submit\(event, "Send it"\)/);
- assert.match(inbox, /rows=\$\{gmail \? 7 : 3\}/, "email drafts get a taller editor than slack replies");
-});
-
-test("the address keeps naming the open item, even after switchView writes the bare view path", () => {
- assert.match(
- inbox,
- /syncInboxUrl\(openSentEmail\?\.id \?\? fullSurface\.selectedId\);/,
- "every draw re-states the URL from the selection it just rendered",
- );
- assert.match(inbox, /await openSentEmailById\(id, drawAll\);/, "unknown inbox ids resolve through sent mail");
- assert.match(
- shell,
- /(?:const|let) next = deepLinkPath\(UI_BASE, appState\.currentView, sessionId, contextsState\.selected\);/,
- "syncUrlFromState carries no item id, which is what the inbox has to heal after",
- );
- const draw = inbox.match(/function drawFull\(\): void \{[\s\S]*?\n\}/)?.[0] ?? "";
- assert.match(draw, /pendingItemId/, "a deep link reaches the draw as pendingItemId");
- assert.match(inbox, /function syncInboxUrl\(itemId: string \| null, push = false\)/);
- assert.match(inbox, /if \(appState\.currentView !== "inbox"\) return;/, "and never writes from another view");
-});
-
-test("inbox tabs own stable routes that survive refresh and history navigation", () => {
- assert.match(inbox, /itemId \?\? inboxViewSegment\(fullViewId\)/);
- assert.match(inbox, /if \(segment === "email"\) return "gmail"/);
- assert.match(inbox, /if \(surface === fullSurface\) selectInboxView\(v\.id, true\)/);
- assert.match(inbox, /export function routeInboxHistory\(segment: string \| null\)/);
- assert.match(shell, /if \(wanted === "inbox"\) routeInboxHistory\(wantedItem\)/);
- assert.match(shell, /else routeInboxHistory\(item\)/);
-});
-
-test("initial inbox selection is restored after the shell resets the active view", () => {
- assert.match(shell, /switchView\(wanted as View\);\s*if \(wanted === "inbox"\) routeInboxHistory\(wantedItem\);/);
-});
-
-test("every draft links back to the session that produced it", () => {
- assert.match(inbox, /draftSessionId/);
- assert.match(inbox, /deepLinkPath\(UI_BASE, "chats", item.draftSessionId\)/);
- assert.match(inbox, /Open agent session/);
-});
-
-test("drafts persist on blur and send uses the current edit", () => {
- assert.match(inbox, /@blur=\$\{\(\) => void persistDraft\(item\)\}/);
- assert.match(inbox, /const draft = effectiveDraft\(item\);/);
- assert.match(
- inbox,
- /`\/api\/loops\/\$\{encodeURIComponent\(item\.loopId\)\}\/items\/\$\{encodeURIComponent\(item\.id\)\}\/\$\{leaf\}`/,
- "every item mutation addresses the ledger item under its own loop",
- );
- assert.match(inbox, /postAction\(item, "edit", \{\s*proposal,/, "a blurred edit revises the proposal");
- assert.doesNotMatch(inbox, /postAction\(item, "send"/);
- assert.match(inbox, /await persistDraftNow\(item.id\);/);
- assert.match(inbox, /postAction\(item, status === "dismissed" \? "dismiss" : "reopen"\)/);
-});
-
-test("the inbox reads a paginated combined feed and retains original item references", () => {
- assert.match(inbox, /api<Feed>\(`\/api\/inbox\?\$\{qs\}`\)/);
- assert.match(inbox, /feedWindows/);
- assert.match(inbox, /loopId: entry\.loopId/);
- assert.match(inbox, /loadDeepLink/);
-});
-
-test("load more is a text button at the end of the filter row, not a full-width bar above the list", () => {
- assert.match(inbox, /const hasMore = !!feedWindows\.get\(surface\.viewId\)\?\.nextCursor;/);
- assert.match(inbox, /showEmailFilter \|\| hasMore\s*\? html`\s*<div class="inbox-filter-bar">/);
- assert.match(
- inbox,
- /class="inbox-load-more"[\s\S]*?refreshInbox\(\{ more: true, viewId: surface\.viewId \}\)[\s\S]*?Load more/,
- );
- assert.doesNotMatch(inbox, /<button class="btn"[^\n]*>Load more/);
- assert.match(inbox, /<button class="inbox-load-more" type="button"[^\n]*handled:[^\n]*>Load more handled<\/button>/);
- assert.match(css, /\.inbox-filter-bar \{\s*display: flex;/);
- assert.match(css, /\.inbox-load-more \{\s*margin-left: auto;/);
- assert.match(css, /\.inbox-filter-bar:not\(:has\(\.inbox-filter\)\) \{\s*padding-bottom: 0;/);
-});
-
-test("localhost can overlay private inbox seed data without checking it into source", () => {
- assert.match(inbox, /fetch\("\/inbox-seed\.local\.json", \{ cache: "no-store" \}\)/);
- assert.match(
- inbox,
- /if \(!\["localhost", "127\.0\.0\.1", "\[::1\]"\]\.includes\(location\.hostname\)\) return \[\];/,
- );
- assert.match(inbox, /const localItems = await fetchLocalInboxItems\(\);/);
- assert.match(inbox, /if \(localItems\.length\) inboxState\.items = localItems/);
- assert.match(inbox, /api<Feed>\(`\/api\/inbox\?\$\{qs\}`\)/);
-});
-
-test("each item carries a follow-up chat with the agent", () => {
- assert.match(inbox, /export function chatTpl\(item: InboxItem, compact = false\): TemplateResult/);
- assert.match(inbox, /actionPath\(item, "followup"\)/);
- assert.match(inbox, /message: text,/);
- assert.match(inbox, /\$\{draftMessageTpl\(item\)\}/, "the draft is a message in the conversation");
- assert.match(inbox, /item\.thread\.map\(/, "the thread transcript renders");
- assert.match(inbox, /draftEdits\.delete\(item\.id\);/, "a revised proposal supersedes the local edit");
- assert.match(css, /\.inbox-chat-log \{/);
- assert.match(css, /\.inbox-chat-msg\.human \{/);
- assert.match(css, /\.inbox-chat-composer \{/);
-});
-
-test("handled items keep their history but stay out of the way", () => {
- assert.match(inbox, /Handled \(/);
- assert.match(inbox, /if \(item\.status === "sent"\) return "Sent";/);
- assert.match(inbox, /if \(item\.status === "replied"\) return "Replied";/);
- assert.match(inbox, /return "Dismissed";/);
- assert.match(inbox, /Reopen/);
-});
-
-test("an external reply in Slack or Gmail closes the loop in the UI", () => {
- assert.match(
- inbox,
- /status: "open" \| "sent" \| "dismissed" \| "replied"/,
- "the item type learns the replied status",
- );
- assert.match(inbox, /externalReplyText\?: string;/);
- assert.match(inbox, /You replied in \$\{where\}/);
- assert.match(inbox, /item\.source === "slack" \? "Slack" : "Gmail"/);
- assert.match(inbox, /item\.externalReplyText \? html`<div class="inbox-replied-text">/);
- assert.match(
- inbox,
- /resolved === "replied" && entry\.actionResult \? \{ externalReplyText: entry\.actionResult \}/,
- "the reply text rides the ledger action result, not a bespoke field",
- );
-});
-
-test("the inbox reads reactions but no longer writes them — no react or emoji-insert affordance", () => {
- assert.doesNotMatch(inbox, /reactToItem/, "reacting from the inbox is gone with its button");
- assert.doesNotMatch(inbox, /insertIntoDraftBody/, "so is inserting an emoji into a draft");
- assert.doesNotMatch(inbox, /openEmojiPicker/, "and nothing opens the picker anymore");
- assert.match(inbox, /item\.reactions\?\.length/, "reactions added elsewhere still render as chips");
- assert.match(inbox, /charForName\(name\)/);
- assert.match(inbox, /Array\.isArray\(payload\.reactions\)/, "the chips read the opaque source payload");
- assert.doesNotMatch(inbox, /\/api\/inbox\/items/, "ledger actions ride the generic loop item routes");
- assert.match(
- server,
- /\/v1\/loops\/\$\{encodeURIComponent\(params\.id!\)\}\/items\/\$\{encodeURIComponent\(params\.itemId!\)\}\/\$\{leaf\}/,
- "one relay still carries every ledger item intent",
- );
-});
-
-test("the reaction chip and replied-text styles ship with the stylesheet", () => {
- assert.doesNotMatch(css, /\.emoji-picker/, "the picker went with the affordance that opened it");
- assert.match(css, /\.inbox-reaction-chip \{/);
- assert.match(css, /\.inbox-replied-text \{/);
-});
-
-test("the inbox stylesheet exists and scopes to inbox- classes", () => {
- assert.match(css, /\.inbox-surface \{/);
- assert.match(css, /\.inbox-chip\.active \{/);
- assert.match(css, /\.pane-kind-count \{/);
- assert.match(css, /\.nav-badge \{/);
-});
-
-test("the inbox list spans the same desktop content width as the item detail", () => {
- assert.match(
- css,
- /\.content-wide-page \{[\s\S]*--content-wide-width: calc\(var\(--content-primary-width\) \+ var\(--content-gap\) \+ var\(--content-aside-width\)\);/,
- );
- assert.match(css, /\.inbox-page \.inbox-surface \{\s*width: min\(var\(--content-wide-width\), 100%\);/);
- assert.match(
- css,
- /\.content-wide-page > \.pane-head \{\s*width: min\(var\(--content-wide-width\), 100%\);\s*max-width: none;/,
- );
- assert.match(css, /\.inbox-thread-page > \.inbox-item-surface/);
-});
-
-test("inbox item hover behaves like a sidebar conversation hover", () => {
- assert.match(css, /\.session:hover \{\s*background: var\(--conversation-hover\);/);
- assert.match(css, /--inbox-row-hover: color-mix\(in srgb, var\(--foreground\) 4%, var\(--background\)\);/);
- assert.match(css, /\.inbox-item-summary:hover,[\s\S]*?background: var\(--inbox-row-hover\);/);
- const reveal = css.match(/\.inbox-item-summary:hover \.inbox-item-dismiss,[\s\S]*?\n\}/)?.[0] ?? "";
- assert.match(reveal, /opacity: 1;/);
- assert.doesNotMatch(reveal, /background:|color:|pointer-events:/);
- assert.match(css, /\.inbox-item-summary:has\(\.inbox-item-dismiss:hover\) \{\s*background: none;/);
-});
-
-test("inbox dividers do not collide with rounded hovered rows", () => {
- assert.match(css, /\.inbox-item:not\(:last-child\)::after \{[\s\S]*?margin: 0 12px;/);
- assert.match(
- css,
- /\.inbox-item:hover::after,\s*\.inbox-item:has\(\+ \.inbox-item:hover\)::after \{\s*background: transparent;/,
- );
- assert.doesNotMatch(css, /\.inbox-item \{\s*border-bottom:/);
-});
-
-test("clipped email snippets do not trigger a native hover tooltip", () => {
- assert.match(css, /\.src-gmail \.inbox-item-snippet \{\s*pointer-events: none;/);
-});
-
-test("a send refused because the agent redrafted keeps the person's edit and shows the new draft", () => {
- assert.match(inbox, /status === 409 && \/draft changed\/i\.test\(e\.message\)/);
- assert.match(inbox, /await refetchItem\(item\);/);
- assert.match(
- inbox,
- /redrafted this reply while you were editing\. Your text is kept in the box\. New draft: "\$\{preview\}"/,
- );
-});
-
-test("an edit remembers the draft version it started from, and both edit and send carry it", () => {
- assert.match(inbox, /const basedOnAt = draftEdits\.get\(item\.id\)\?\.basedOnAt \?\? item\.draftAt;/);
- assert.match(
- inbox,
- /postAction\(item, "edit", \{\s*proposal,\s*\.\.\.\(basedOnAt !== undefined \? \{ expectedProposalAt: basedOnAt \} : \{\}\),/,
- );
- assert.match(inbox, /expectedProposalAt: current.draftAt/);
- assert.match(inbox, /if \(isDraftConflict\(e\)\) return explainDraftConflict\(item, true\);/);
-});
-
-test("draft header links stay together after the label", () => {
- assert.match(css, /\.inbox-draft-label \{[^}]*margin-right: auto;/);
- assert.doesNotMatch(css, /\.inbox-session-link \{[^}]*margin-left: auto;/);
- assert.doesNotMatch(css, /\.inbox-draft-head \.inbox-external-link \{[^}]*margin-left: auto;/);
-});
-
-test("draft header links share one text size", () => {
- assert.match(css, /\.inbox-session-link,\s*\.inbox-external-link \{[^}]*font-size: 11px;/);
- assert.doesNotMatch(css, /\.inbox-session-link \{[^}]*font-size:/);
-});
-
-test("send stays available alongside typed instructions", () => {
- assert.match(inbox, /embeddedComposer\(/);
- assert.doesNotMatch(css, /\.inbox-chat-composer\.has-text \.inbox-chat-suggest/);
- assert.match(inbox, /new CustomEvent\("composer-submit", \{ detail: instruction \}\)/);
-});
-
-test("conversation messages use the containing view's scroll instead of clipping the latest message", () => {
- const context = css.match(/\.inbox-context \{[^}]*\}/)?.[0] ?? "";
- assert.match(context, /flex: none;/);
- assert.doesNotMatch(context, /max-height:|overflow-y:/);
-});
-
-test("single email pages keep bottom breathing room", () => {
- const surface = css.match(/\.inbox-item-surface \.inbox-scroll \{[^}]*\}/)?.[0] ?? "";
- assert.match(surface, /padding-bottom: calc\(64px \+ env\(safe-area-inset-bottom\)\);/);
-});
-
-test("phone inbox composer gives instructions a full row without shrinking touch controls", () => {
- const start = css.indexOf(" .inbox-chat-composer .composer-wrap .composer-input,");
- assert.ok(start >= 0);
- const phone = css.slice(css.lastIndexOf("@media", start), start + 180);
- assert.match(phone, /^@media \(max-width: 860px\)/);
- assert.match(
- phone,
- /\.inbox-chat-composer \.composer-wrap \.composer-input,\s*\.inbox-chat-composer \.composer-wrap \.composer-toolbar\s*\{\s*grid-column: 1 \/ -1;/,
- );
-});
diff --git a/plugins/web-ui/test/inbox-sync-actions.test.ts b/plugins/web-ui/test/inbox-sync-actions.test.ts
deleted file mode 100644
index 497556f5e..000000000
--- a/plugins/web-ui/test/inbox-sync-actions.test.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const source = readFileSync(new URL("../src/inbox.ts", import.meta.url), "utf8");
-const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
-
-test("inbox sync states use the same labeled action button", () => {
- assert.match(source, /function syncActionTpl/);
- assert.match(source, /class="btn inbox-sync-action"/);
- assert.match(source, /label: "Refresh"/);
- assert.match(source, /label: "Sync"/);
- assert.match(source, /class="inbox-setup-action"/);
- assert.match(source, /busyLabel: "Refreshing…"/);
- assert.match(source, /busyLabel: "Syncing…"/);
- assert.match(source, /"Setting up…" : "Set up"/);
-});
-
-test("a pending inbox migration lives in the sync line instead of a banner", () => {
- assert.doesNotMatch(source, /Moving your existing Inbox/);
- assert.doesNotMatch(source, /migrationPending \? html`<div class="inbox-notice"/);
- assert.match(
- source,
- /const moving = inboxState\.migrationPending;\s*if \(!crons\.length && !moving\) return nothing;/,
- );
- assert.match(source, /disabled: moving,/);
- assert.match(source, /tooltip: moving \? MIGRATION_HINT : "Sync now"/);
- assert.match(
- source,
- /<span class="inbox-sync-status" role=\$\{moving \? "status" : nothing\}>\$\{moving \? MIGRATION_STATUS : status\}<\/span>/,
- );
- assert.match(source, /inboxState\.migrationPending \? MIGRATION_STATUS : "Sync not set up"/);
- assert.match(source, /\$\{inboxState\.migrationPending \? tip\(MIGRATION_HINT\) : nothing\}/);
- assert.match(source, /\?disabled=\$\{inboxState\.syncBusy \|\| inboxState\.migrationPending\}/);
- assert.match(
- css,
- /\.inbox-surface\.compact \.inbox-sync-line > \.inbox-sync-status:not\(\[role="status"\]\) \{\s*display: none;/,
- );
-});
diff --git a/plugins/web-ui/test/layout-thrash.test.ts b/plugins/web-ui/test/layout-thrash.test.ts
deleted file mode 100644
index 77f0bed79..000000000
--- a/plugins/web-ui/test/layout-thrash.test.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const composer = readFileSync(new URL("../src/composer.ts", import.meta.url), "utf8");
-const viewport = readFileSync(new URL("../src/transcript-viewport.ts", import.meta.url), "utf8");
-const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-
-test("resizeComposer skips the forced-reflow measure pass when the draft value is unchanged", () => {
- const fn = composer.match(/function resizeComposer\(\): void \{[\s\S]*?\n {2}\}/)?.[0] ?? "";
- const skip = fn.indexOf("if (ta.value === autosizedValue) return;");
- const measure = fn.indexOf('ta.style.height = "auto"');
- assert.ok(skip >= 0, "the value memo must gate the measure pass");
- assert.ok(measure >= 0, "the measure pass must still exist");
- assert.ok(skip < measure, "the skip must come BEFORE the height:auto write that dirties layout");
-});
-
-test("a box-size change re-arms the composer measure via ResizeObserver (fires after layout, no thrash)", () => {
- assert.match(composer, /new ResizeObserver\(\(\) => \{\s*autosizedValue = null;[\s\S]{0,80}?resizeComposer\(\);/);
- assert.match(composer, /autosizeObserver\.observe\(ta\)/);
- assert.match(composer, /autosizeObserver\.unobserve\(autosizedTa\)/, "the replaced input must be unobserved");
-});
-
-test("bottom-follow's skip path performs zero layout reads", () => {
- const fn = viewport.slice(viewport.indexOf(" function follow("));
- const skip = fn.indexOf("if (!scroller || !following || contentUpdates.size > 0 || frame !== null) return;");
- const firstRead = fn.indexOf("const priorTop = element.scrollTop;");
- assert.ok(skip >= 0 && skip < firstRead);
- assert.match(viewport, /if \(changed\) syncSticky\(\);/);
-});
-
-test("bottom-follow belongs to each scroller, and fresh mounts start pinned", () => {
- assert.match(viewport, /addEventListener\("scroll", onScroll/);
- assert.match(viewport, /const atBottom = scroller.scrollHeight - scroller.clientHeight - scroller.scrollTop <= 1;/);
- assert.match(viewport, /if \(force\) \{\s*setFollowing\(true\);/);
-});
-
-test("revealing a transcript re-arms follow; read-only mounts start at the end except pagination", () => {
- assert.match(chat, /function scrollToBottom\(\): void \{\s*scrollTranscript\(true\);/);
- assert.match(chat, /if \(!sameSession\) scrollToBottom\(\);/);
- assert.match(chat, /transcriptViewport.follow\(force\);/);
-});
-
-test("composer measurement holds its outer height instead of temporarily resizing the transcript", () => {
- const fn = composer.slice(composer.indexOf(" function resizeComposer("));
- const lock = fn.indexOf("wrap.style.height = `${wrap.getBoundingClientRect().height}px`");
- const measure = fn.indexOf('ta.style.height = "auto"');
- const release = fn.indexOf("wrap.style.height = wrapHeight");
- assert.ok(lock >= 0 && lock < measure && release > measure);
-});
-
-test("both pagination paths adjust their anchor without smooth scrolling", () => {
- const anchors = chat.match(
- /const prev = scrollerNow\.style\.scrollBehavior;\s*scrollerNow\.style\.scrollBehavior = "auto";\s*scrollerNow\.scrollTop = priorTop \+ \(scrollerNow\.scrollHeight - priorHeight\);\s*scrollerNow\.style\.scrollBehavior = prev;/g,
- );
- assert.equal(anchors?.length, 2);
-});
-
-test("chat layout waits for markdown custom elements before measuring the transcript", () => {
- const fn = chat.match(/function drawActiveChat\([\s\S]*?\n {2}\}/)?.[0] ?? "";
- const deferred = fn.match(/requestAnimationFrame\(\(\) => \{[\s\S]*?\n {4}\}\);/)?.[0] ?? "";
- assert.match(deferred, /decorateTextCodeBlocks\(host\)/);
- assert.match(deferred, /ctx\.composer\.resizeComposer\(\)/);
- assert.match(deferred, /scrollTranscript\(opts\.forceScroll\)/);
- assert.doesNotMatch(fn.replace(deferred, ""), /resizeComposer\(|scrollTranscript\(/);
-});
-
-test("deferred chat layout cannot scroll a replacement or detached session", () => {
- const fn = chat.match(/function drawActiveChat\([\s\S]*?\n {2}\}/)?.[0] ?? "";
- const guard = fn.indexOf("if (chatState.host !== host || chatState.agent !== agent || !host.isConnected) return;");
- const measure = fn.indexOf("ctx.composer.resizeComposer()");
- assert.ok(guard >= 0 && guard < measure);
-});
diff --git a/plugins/web-ui/test/list-page.test.ts b/plugins/web-ui/test/list-page.test.ts
deleted file mode 100644
index ed7ef69bb..000000000
--- a/plugins/web-ui/test/list-page.test.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-test("list search uses its purpose as an accessible name", () => {
- const source = readFileSync(new URL("../src/list-page.ts", import.meta.url), "utf8");
- assert.equal(source.includes("aria-label=${o.search.placeholder"), true);
-});
diff --git a/plugins/web-ui/test/loading-pane-centered.test.ts b/plugins/web-ui/test/loading-pane-centered.test.ts
deleted file mode 100644
index 5949af8e3..000000000
--- a/plugins/web-ui/test/loading-pane-centered.test.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-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 sessions = readFileSync(new URL("../src/sessions.ts", import.meta.url), "utf8");
-
-test("the loading pane renders chat-loading as the shell's only child", () => {
- const fn = chat.match(/function mountLoadingPane\(\): \(\) => boolean \{[\s\S]*?\n {2}\}/)?.[0] ?? "";
- assert.match(fn, /custom-chat-shell/);
- assert.match(fn, /chat-loading/);
-});
-
-test("chat-loading spans every shell grid row so the spinner centers vertically", () => {
- const shell = css.match(/\.custom-chat-shell \{[^}]*\}/)?.[0] ?? "";
- assert.match(shell, /display: grid;/, "the shell is a grid, so a lone child needs an explicit row span");
- const block = css.match(/\.chat-loading \{[^}]*\}/)?.[0] ?? "";
- assert.match(block, /grid-row: 1 \/ -1;/, "without spanning all rows the spinner hugs the top auto row");
- assert.match(block, /align-items: center;/);
- assert.match(block, /justify-content: center;/);
-});
-
-test("opening a conversation replaces the previous pane before waiting for its transcript", () => {
- const start = sessions.indexOf("export async function openSessionInto");
- const body = sessions.slice(start, sessions.indexOf("\nexport ", start + 1));
- const loading = body.indexOf("conv.mountLoadingPane()");
- const waiting = body.indexOf("await Promise.all");
- assert.ok(loading >= 0, "the target conversation must claim the pane with its loading state");
- assert.ok(loading < waiting, "the previous conversation must disappear before transcript loading can yield");
- assert.doesNotMatch(body, /setTimeout/, "a delay exposes the previous or new-conversation UI between clicks");
-});
diff --git a/plugins/web-ui/test/loops-source.test.ts b/plugins/web-ui/test/loops-source.test.ts
deleted file mode 100644
index efc9f6d11..000000000
--- a/plugins/web-ui/test/loops-source.test.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const source = readFileSync(new URL("../src/loops.ts", import.meta.url), "utf8");
-const shell = readFileSync(new URL("../src/shell.ts", import.meta.url), "utf8");
-const browse = readFileSync(new URL("../src/browse.ts", import.meta.url), "utf8");
-
-test("unconfirmed loop outputs have confirmation and return controls", () => {
- assert.match(source, /const unconfirmed = outputs\.filter\(\(o\) => o\.state === "unconfirmed"\)/);
- assert.match(source, /Needs confirmation/);
- assert.match(source, /reviewRow\(loop, o, "Confirm shipped"\)/);
- assert.match(source, /decide\(loop, output, "return"\)/);
-});
-
-test("loops navigation, routing, and fetching require permission", () => {
- assert.match(browse, /can\("loops"\) \? navRow\("loops"|can\("loops"\)\) list\.push\(to\("loops"/);
- assert.match(shell, /if \(!canView\(v\)\) v = "chats"/);
- assert.match(shell, /isView\(wanted\) && canView\(wanted\)/);
- assert.match(source, /renderLoopsPage[^]*if \(!can\("loops"\)\) return/);
-});
-
-test("loop detail derives and renders the autopilot toggle", () => {
- assert.match(source, /shipActions\.length > 0 && loop\.shipActions\.every\(\(policy\) => policy\.gate === "auto"\)/);
- assert.match(source, />Autopilot</);
- assert.match(source, /Ships outputs without review/);
- assert.match(source, /Shipping without review/);
- assert.match(source, /setAutopilot\(loop, !autopilot\)/);
- assert.match(source, /\?disabled=\$\{loopBusy\}/);
- assert.match(source, /loop\.shipActions\.length[^]*class="loop-autopilot/);
-});
diff --git a/plugins/web-ui/test/message-meta-lane.test.ts b/plugins/web-ui/test/message-meta-lane.test.ts
deleted file mode 100644
index 50f74195c..000000000
--- a/plugins/web-ui/test/message-meta-lane.test.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-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("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.ts
deleted file mode 100644
index e39417edd..000000000
--- a/plugins/web-ui/test/nav-returns-to-index.test.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-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 after the view switch resets its selection", () => {
- 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, /switchView\(wanted as View\);\s*if \(wanted === "inbox"\) routeInboxHistory\(wantedItem\);/);
-});
-
-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/open-session-view-switch.test.ts b/plugins/web-ui/test/open-session-view-switch.test.ts
deleted file mode 100644
index f60270689..000000000
--- a/plugins/web-ui/test/open-session-view-switch.test.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-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");
-const contexts = readFileSync(new URL("../src/contexts.ts", import.meta.url), "utf8");
-
-const openSessionBody = sessions.match(/export async function openSession\([^]*?\n\}/)?.[0] ?? "";
-
-test("openSession returns to the chats view before mounting (sidebar sessions are visible on every view)", () => {
- const guard = openSessionBody.match(/if \(appState\.currentView !== "chats"\) \{[^]*?\n {2}\}/)?.[0] ?? "";
- assert.ok(guard, "openSession must switch back to the chats view when invoked from another view");
- assert.match(guard, /appState\.currentView = "chats"/);
- assert.match(guard, /appState\.viewRenderSeq\+\+/, "must invalidate pending renders of the previous view");
- assert.match(guard, /renderSidebarTop\(\)/);
- assert.match(guard, /if \(splitState\.active\) drawCanvas\(\)/, "split canvas must be redrawn on return to chats");
- assert.match(
- guard,
- /syncUrlFromState\(s\.id \|\| null\)/,
- "URL must leave the old view — with the target session, not a stale remembered one — even when the split intercept returns early",
- );
- assert.ok(
- openSessionBody.indexOf(guard) < openSessionBody.indexOf("splitInterceptsOpen"),
- "view switch must happen before the split intercept so canvas opens intercept correctly",
- );
-});
-
-test("openFromContext delegates the view switch to openSession", () => {
- const body = contexts.match(/async function openFromContext\([^]*?\n\}/)?.[0] ?? "";
- assert.ok(body, "openFromContext exists");
- assert.match(body, /await openSession\(s\)/);
- assert.doesNotMatch(body, /appState\.currentView = "chats"/);
-});
diff --git a/plugins/web-ui/test/page-refresh-controls.test.ts b/plugins/web-ui/test/page-refresh-controls.test.ts
deleted file mode 100644
index c27ad3b94..000000000
--- a/plugins/web-ui/test/page-refresh-controls.test.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import assert from "node:assert/strict";
-import { readdirSync, readFileSync } from "node:fs";
-import { extname } from "node:path";
-import test from "node:test";
-
-const sourceDir = new URL("../src/", import.meta.url);
-
-function sourceFiles(dir: URL): URL[] {
- return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
- const child = new URL(entry.name, dir);
- if (entry.isDirectory()) return sourceFiles(new URL(`${entry.name}/`, dir));
- return extname(entry.name) === ".ts" || extname(entry.name) === ".css" ? [child] : [];
- });
-}
-
-test("page headers do not expose manual refresh controls", () => {
- const source = sourceFiles(sourceDir)
- .map((file) => readFileSync(file, "utf8"))
- .join("\n");
- assert.doesNotMatch(
- source,
- /pane-refresh|\bonRefresh\b|Refresh projects|Refresh memory|Refresh conversations|>Refresh<\/button>/,
- );
-});
diff --git a/plugins/web-ui/test/pane-approval-overflow.test.ts b/plugins/web-ui/test/pane-approval-overflow.test.ts
deleted file mode 100644
index 993e45279..000000000
--- a/plugins/web-ui/test/pane-approval-overflow.test.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-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");
-
-test("approval details use the full row above their actions", () => {
- const approval = css.match(/\.composer-approval \{[^}]*\}/)?.[0] ?? "";
- const copy = css.match(/\.composer-approval-copy \{[^}]*\}/)?.[0] ?? "";
- const actions = css.match(/\.composer-approval \.approval-actions \{[^}]*\}/)?.[0] ?? "";
-
- assert.match(approval, /display: flex;/);
- assert.match(approval, /flex-direction: column;/, "actions belong below the approval details at every width");
- assert.match(copy, /width: 100%;/, "approval details should use the full available row");
- assert.match(actions, /width: 100%;/, "the action row should not compete with the details for width");
-});
-
-test("phone approval actions use full-width touch targets", () => {
- const phone = css.match(/@media \(max-width: 560px\) \{[\s\S]*?\n\}/)?.[0] ?? "";
- const button = phone.match(/\.composer-approval \.approval-btn \{[^}]*\}/)?.[0] ?? "";
-
- assert.match(button, /width: 100%;/);
- assert.match(button, /min-height: 44px;/);
-});
-
-test("approval panel caps to the pane viewport and scrolls instead of clipping", () => {
- const panel = css.match(/\.composer-approval-panel \{[^}]*\}/)?.[0] ?? "";
- assert.match(panel, /max-height: min\(calc\(100dvh - 130px\), calc\(100cqh - 130px\)\);/);
- const pane = css.match(/\.split-pane-content \{[^}]*\}/)?.[0] ?? "";
- assert.match(pane, /container: split-pane \/ size;/, "approval height must follow the pane, not the whole window");
- assert.match(panel, /overflow-y: auto;/, "panel must scroll once the cap binds");
-});
-
-test("pane glance renders no placeholder text for an empty chat", () => {
- assert.ok(!chat.includes("No messages yet"), "the No-messages-yet placeholder is gone");
- const glance = chat.slice(chat.indexOf("function paneGlance"), chat.indexOf("function paneNowLine"));
- assert.match(glance, /\$\{now \?\? snippet\}/, "strip falls back to the snippet alone");
- assert.match(
- glance,
- /\$\{snippet \? html`<div class="pane-card-last" dir="auto">\$\{snippet\}<\/div>` : nothing\}/,
- "card omits the last-reply row when empty",
- );
-});
-
-test("approval grid tracks cannot grow wider than their container", () => {
- for (const selector of [".composer-approval-panel", ".composer-approval-copy"]) {
- const rule = css.slice(css.indexOf(`${selector} {`)).split("}")[0];
- assert.match(rule, /grid-template-columns: minmax\(0, 1fr\);/, selector);
- }
-});
-
-test("long approval text wraps in both the composer and transcript", () => {
- for (const selector of [".composer-approval-copy", ".approval-text"]) {
- const rule = css.slice(css.indexOf(`${selector} {`)).split("}")[0];
- assert.match(rule, /overflow-wrap: anywhere;/, selector);
- }
-});
diff --git a/plugins/web-ui/test/pinned-composer-polish.test.ts b/plugins/web-ui/test/pinned-composer-polish.test.ts
deleted file mode 100644
index 9044b7378..000000000
--- a/plugins/web-ui/test/pinned-composer-polish.test.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-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");
-
-test("transcript top spacing and prompt gap stay compact at every density", () => {
- const values = [...css.matchAll(/--chat-scroll-pad-top: (\d+)px/g)].map((m) => Number(m[1]));
- assert.ok(values.length >= 3 && values.every((v) => v === 8));
- const prompt = css.match(/\.message-stack \.user-row\.latest-prompt \{[^}]*\}/)?.[0] ?? "";
- assert.match(prompt, /padding-top: 8px;/);
- assert.match(prompt, /margin-top: -8px;/);
- assert.match(prompt, /margin-bottom: 12px;/);
-});
-
-test("background activity shares the queued inset above the composer", () => {
- assert.match(
- chat,
- /ctx\.composer\.queuedStrip\(agent\)\} \$\{subagentStrip\(\)\}\s*\$\{swarmUi\.strip\(chatState\.sessionId\)\} \$\{backgroundActivityStrip\(\)\}\s*\$\{ctx\.composer\.composerForm\(agent\)\}/,
- );
- assert.match(css, /\.queued-strip,\s*\.chat-bottom-dock > \.bg-activity \{/);
- assert.doesNotMatch(css, /\.composer-wrap > \.bg-activity/);
-});
-
-test("the composer input follows the composer size variable while background activity stays compact", () => {
- assert.match(css, /\.chat-bottom-dock > \.bg-activity > \.bg-activity-strip \{[^}]*font-size: 12px;/);
- const sizes = [...css.matchAll(/([^{}]+)\{([^{}]*)\}/g)].flatMap((rule) =>
- [...rule[2].matchAll(/--composer-font-size: ([^;]+);/g)].map((match) => [rule[1].trim(), match[1]]),
- );
- assert.deepEqual(sizes, [
- [".composer-wrap", "var(--font-15)"],
- [".split-canvas:not(.single-pane) .split-pane-chat .custom-chat-shell .composer-wrap", "12px"],
- [".composer-wrap", "16px"],
- ["body.app-edit-embed .composer-wrap", "var(--font-13)"],
- ]);
- const blocks = css.matchAll(/\.composer-input \{([^}]+)\}/g);
- const declarations = [...blocks].flatMap((match) => [...match[1].matchAll(/font-size: ([^;]+);/g)]);
- assert.ok(declarations.length > 0);
- for (const declaration of declarations) {
- assert.match(declaration[1], /^(?:max\(16px, )?var\(--composer-font-size[,)]/);
- }
- assert.match(
- css,
- /@media \(max-width: 860px\), \(hover: none\) and \(pointer: coarse\) \{[^@]*\.composer-input,\s*\.live-work-line \{\s*font-size: max\(16px, var\(--composer-font-size, 16px\)\);/,
- );
-});
-
-test("queued cards tuck beneath the next card just as the queue tucks beneath the composer", () => {
- const strip = css.match(/\.queued-strip,\s*\.chat-bottom-dock > \.bg-activity \{([^}]+)\}/)?.[1] ?? "";
- const stacked = css.match(/\.queued-chip \+ \.queued-chip \{([^}]+)\}/)?.[1] ?? "";
- assert.doesNotMatch(strip, /gap:/);
- assert.match(strip, /margin: 0 auto -10px;/);
- assert.match(stacked, /margin-top: -10px;/);
-});
-
-test("collapsed prompt content uses a readable six-line cutoff", () => {
- const selector = ".message-stack .user-row.latest-prompt:not(.pin-expanded) .user-bubble > .pin-content";
- const rule = css.slice(css.indexOf(`${selector} {`)).split("}")[0] ?? "";
- assert.match(rule, /display: -webkit-box;/);
- assert.match(rule, /-webkit-box-orient: vertical;/);
- assert.match(rule, /-webkit-line-clamp: 6;/);
- assert.doesNotMatch(rule, /max-height:/);
- assert.match(rule, /overflow: hidden;/);
- assert.doesNotMatch(rule, /mask-image|blur/);
- assert.equal(css.includes(`${selector}::after`), false);
-});
-
-test("collapsed rich prompts retain a height bound across nested formatting contexts", () => {
- assert.match(
- css,
- /> \.pin-content:has\(code-block, pre, table, img, svg, math, .katex-display, video, iframe\) \{\s*max-height: 6lh;/,
- );
-});
diff --git a/plugins/web-ui/test/plain-text-code-wrap.test.ts b/plugins/web-ui/test/plain-text-code-wrap.test.ts
deleted file mode 100644
index 848ad2869..000000000
--- a/plugins/web-ui/test/plain-text-code-wrap.test.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-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");
-
-test("plain-text code fences stay compact without changing source-code fences", () => {
- assert.match(
- css,
- /code-block\[language="text"\] pre[^}]*margin: 0;[^}]*padding: 4px 8px 8px;[^}]*white-space: pre-wrap;[^}]*overflow-wrap: anywhere;[^}]*font-size: 10px;[^}]*line-height: 1\.4;/s,
- );
- assert.match(css, /code-block\[language="text"\] pre code[^}]*font-size: 10px;[^}]*line-height: 1\.4;/s);
- assert.match(css, /code-block\[language="text"\] > div[^}]*display: flex;[^}]*flex-direction: column;/s);
- assert.match(
- css,
- /code-block\[language="text"\] \.text-code-footer[^}]*order: 2;[^}]*height: var\(--meta-lane\);[^}]*justify-content: flex-end;[^}]*padding: 0 2px;[^}]*font-size: 10px;[^}]*opacity: 0;[^}]*pointer-events: none;[^}]*transition: opacity 0\.12s ease;/s,
- );
- assert.match(
- css,
- /code-block\[language="text"\]:hover \.text-code-footer[^}]*opacity: 1;[^}]*pointer-events: auto;/s,
- );
- assert.match(
- css,
- /code-block\[language="text"\] \.text-code-footer:focus-within[^}]*opacity: 1;[^}]*pointer-events: auto;/s,
- );
- assert.match(
- css,
- /@media \(hover: none\)[\s\S]*code-block\[language="text"\] \.text-code-footer[^}]*opacity: 1;[^}]*pointer-events: auto;/s,
- );
- assert.match(
- css,
- /code-block\[language="text"\] copy-button button[^}]*width: var\(--meta-lane\);[^}]*height: var\(--meta-lane\);[^}]*padding: 0;/s,
- );
- assert.doesNotMatch(css, /code-block\[language="text"\] \.text-code-footer[^}]*position: absolute;/s);
- assert.doesNotMatch(css, /markdown-block pre code\s*{[^}]*white-space: pre-wrap;/s);
-});
-
-test("long plain-text fences collapse by default and remain expandable", () => {
- assert.match(chat, /requestAnimationFrame\(\(\) => \{\s*decorateTextCodeBlocks\(/);
- assert.match(
- readFileSync(new URL("../src/message-markdown.ts", import.meta.url), "utf8"),
- /normalizePlainTextFences/,
- );
- assert.match(
- css,
- /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/project-slack-channel-source.test.ts b/plugins/web-ui/test/project-slack-channel-source.test.ts
deleted file mode 100644
index c10bb1251..000000000
--- a/plugins/web-ui/test/project-slack-channel-source.test.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const source = readFileSync(new URL("../src/contexts.ts", import.meta.url), "utf8");
-const server = readFileSync(new URL("../server/index.ts", import.meta.url), "utf8");
-const bridge = readFileSync(new URL("../src/core-bridge.ts", import.meta.url), "utf8");
-
-test("project detail offers a Slack home-channel section", () => {
- assert.match(source, /function projectSlackSection\(/);
- assert.match(source, /c\.project \? projectSlackSection\(c\) : nothing/);
- assert.match(source, /Link a channel/);
-});
-
-test("the slack-channel input keeps focus across redraws and commits to state", () => {
- const input = source.match(/<input\s+type="text"\s+data-focus-key="project-slack-channel"[^]*?\/>/)?.[0] ?? "";
- assert.match(input, /\.value=\$\{contextsState\.slackValue\}/);
- assert.match(input, /contextsState\.slackValue = \(e\.target as HTMLInputElement\)\.value/);
-});
-
-test("link and unlink go through the project slack-channel API and refresh the project view", () => {
- assert.match(source, /\/slack-channel`, \{\s*method: "PUT"/);
- assert.match(source, /\/slack-channel`, \{\s*method: "DELETE"/);
- const link = source.match(/async function linkProjectSlackChannel[^]*?\n\}/)?.[0] ?? "";
- const unlink = source.match(/async function unlinkProjectSlackChannel[^]*?\n\}/)?.[0] ?? "";
- for (const fn of [link, unlink]) {
- assert.match(fn, /projectFromResponse\(/);
- assert.match(fn, /upsertProject\(/);
- }
- assert.match(unlink, /window\.confirm/);
-});
-
-test("the web-ui server proxies slack-channel link routes to core with the signed-in principal", () => {
- const routes = [
- ...server.matchAll(/method: "(PUT|DELETE)",\s+path: "\/api\/projects\/:id\/slack-channel"[^]*?\n {2}\},/g),
- ];
- assert.equal(routes.length, 2, "one PUT and one DELETE slack-channel route");
- const put = routes.find((m) => m[1] === "PUT")?.[0] ?? "";
- const del = routes.find((m) => m[1] === "DELETE")?.[0] ?? "";
- assert.match(put, /"PUT",\s*`\/v1\/projects\/\$\{encodeURIComponent\(id\)\}\/slack-channel`/);
- assert.match(del, /"DELETE",\s*`\/v1\/projects\/\$\{encodeURIComponent\(id\)\}\/slack-channel`/);
- assert.match(put, /JSON\.stringify\(\{ principalId: user, channel \}\)/);
-});
-
-test("CoreProject carries the linked slack channel", () => {
- assert.match(
- bridge,
- /slackChannel\?: \{ channelId: string; channelName: string; linkedBy\?: string; linkedAt\?: number \}/,
- );
-});
-
-test("channel-derived members are badged and not removable", () => {
- assert.match(source, /viaChannel = Boolean\(/);
- assert.match(source, /principalId !== project\.ownerId && !viaChannel/);
- assert.match(source, /Joined via the linked Slack channel/);
-});
-
-test("hint copy says the agent posts there and membership follows the channel", () => {
- assert.match(source, /everyone in the channel joins\s+the project/);
- assert.match(source, /everyone in the channel is in the project/);
-});
diff --git a/plugins/web-ui/test/renderable-image-source.test.ts b/plugins/web-ui/test/renderable-image-source.test.ts
deleted file mode 100644
index 2ba8f494d..000000000
--- a/plugins/web-ui/test/renderable-image-source.test.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { readFileSync } from "node:fs";
-import { test } from "node:test";
-import assert from "node:assert/strict";
-
-const ui = readFileSync(new URL("../src/ui.ts", import.meta.url), "utf8");
-const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-
-test("SVG attachments fall back to a visible download chip", () => {
- const renderableTypes = ui.match(/const RENDERABLE_IMAGE_TYPES = new Set\(\[([\s\S]*?)\]\);/)?.[1] ?? "";
- assert.doesNotMatch(renderableTypes, /image\/svg\+xml/);
- assert.match(chat, /if \(!browserRenderableImage\(file\.mimetype\)\) return imageChip/);
-});
diff --git a/plugins/web-ui/test/responsive-source.test.ts b/plugins/web-ui/test/responsive-source.test.ts
deleted file mode 100644
index a63a88f4b..000000000
--- a/plugins/web-ui/test/responsive-source.test.ts
+++ /dev/null
@@ -1,144 +0,0 @@
-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 compactCss = css.replace(/\s+/g, " ");
-const shell = readFileSync(new URL("../src/shell.ts", import.meta.url), "utf8");
-const sessions = readFileSync(new URL("../src/sessions.ts", import.meta.url), "utf8");
-const contexts = readFileSync(new URL("../src/contexts.ts", import.meta.url), "utf8");
-const page = readFileSync(new URL("../index.html", import.meta.url), "utf8");
-
-test("mobile shell follows the visual viewport and device safe areas", () => {
- assert.match(page, /viewport-fit=cover/);
- assert.match(compactCss, /height: 100dvh/);
- for (const inset of ["top", "right", "bottom", "left"]) {
- assert.match(compactCss, new RegExp(`safe-area-inset-${inset}`));
- }
-});
-
-test("mobile sidebar is modal, dismissible, and sized for touch", () => {
- assert.match(shell, /actionRow\(ICON\.newChat[\s\S]{0,200}startNewChatInLastScope\(\);/);
- assert.match(sessions, /export function startNewChat\([^)]*\)[^{]*\{\s*closeSidebarOnNarrowView\(\);/);
- assert.match(shell, /class="sidebar-scrim"[^>]+aria-label="Close sidebar"[^>]+@click=\$\{toggleSidebar\}/);
- assert.match(shell, /main\.inert = modal/);
- assert.match(
- css,
- /\.layout\.sidebar-closed \.sidebar > :not\(\.brand\):not\(#sidebar-top\):not\(#sidebar-footer\),\s*\.layout\.sidebar-closed \.brand-lockup \{[^}]*opacity: 0;\s*visibility: hidden;/,
- );
- assert.match(shell, /sidebar\.setAttribute\("role", modal \? "dialog" : "navigation"\)/);
- assert.match(
- shell,
- /if \(modal\) sidebar\.setAttribute\("aria-modal", "true"\);\s*else sidebar\.removeAttribute\("aria-modal"\)/,
- );
- assert.match(shell, /event\.key === "Escape" && event\.defaultPrevented/);
- assert.match(shell, /event\.key === "Escape" && closeOpenSessionMenu\(\)/);
- assert.match(sessions, /data-menu-id=\$\{menuKey\}/);
- assert.match(sessions, /data-menu-id=\$\{s\.id\}/);
- assert.match(sessions, /focusSessionMenuButton\(menuKey\)/);
- assert.match(shell, /trapDialogFocus\(event, \(\) => setSidebarOpen\(false\)\)/);
- assert.match(css, /\.layout\.sidebar-closed \.sidebar \{\s*position: static;/);
- assert.match(
- shell,
- /setSidebarOpen\(false, false\);\s*requestAnimationFrame\(\(\) => appState\.mainEl\?\.focus\(\{ preventScroll: true \}\)\)/,
- );
- assert.match(shell, /class="main" id="main" tabindex="-1"/);
- assert.match(compactCss, /\.layout\.sidebar-closed \.sidebar-scrim \{\s*display: none;/);
- assert.match(
- compactCss,
- /\.navrow,[\s\S]*\.browse-tile,[\s\S]*\.settings-choice-option,[\s\S]*\.session-menu-option,[\s\S]*\.archived-toggle \{\s*min-height: 44px;/,
- );
- assert.match(compactCss, /\.session-menu-btn,[\s\S]*\.recent-project-new-chat \{\s*width: 44px;\s*height: 44px;/);
- assert.match(compactCss, /\.session-menu\s*\{\s*right:\s*0;\s*margin-top:\s*-22px;\s*\}/);
- assert.match(
- compactCss,
- /@media \(max-width: 860px\) and \(hover: none\)[\s\S]*\.sidebar \.session-menu-btn\s*\{\s*opacity:\s*1;\s*\}/,
- );
- assert.match(compactCss, /\.recent-project-head \.recent-project-count \{ opacity: 0; \}/);
-});
-
-test("the sidebar's quick actions share the navrow treatment", () => {
- assert.match(shell, /const actionRow = \([\s\S]{0,160}class="navrow"\s+type="button"/);
- assert.doesNotMatch(shell, /class="new-chat"/);
- assert.doesNotMatch(shell, /split-new-session/);
- assert.doesNotMatch(css, /(^|\n)\.new-chat[ ,:{]/);
- assert.doesNotMatch(css, /split-new-session/);
-});
-
-test("the sidebar resize handle stays accessible without a hover tooltip", () => {
- assert.match(
- shell,
- /class="sidebar-resize-handle"[\s\S]{0,200}aria-label="Resize sidebar"[\s\S]{0,200}@pointerdown=\$\{startSidebarResize\}[\s\S]{0,100}@dblclick=\$\{resetSidebarWidth\}/,
- );
- assert.doesNotMatch(shell, /Drag to resize/);
-});
-
-test("the quick nav is home, search, browse; create sits under the divider", () => {
- assert.match(
- shell,
- /<nav class="nav quick-nav"[\s\S]*?navRow\("chats", ICON\.home, "Home"\)[\s\S]*?actionRow\(Search, "Search"[\s\S]*?actionRow\(ICON\.browse, "Browse"[\s\S]*?<\/nav>/,
- );
- assert.doesNotMatch(
- shell,
- /<nav class="nav quick-nav"[\s\S]*?actionRow\(ICON\.newChat[\s\S]*?<\/nav>/,
- "create belongs below the quick-nav divider, not inside it",
- );
- assert.match(shell, /<div class="nav new-chat-nav">[\s\S]*?actionRow\(ICON\.newChat[\s\S]*?<\/div>/);
- assert.doesNotMatch(shell, /<span>Sessions<\/span>/);
- assert.doesNotMatch(shell, /navRow\("chats", ICON\.chats/);
- assert.doesNotMatch(shell, /nav-section-toggle|nav-group|navWorkspaceOpen/);
- assert.doesNotMatch(css, /\.nav-section-toggle|\.nav-group/);
-});
-
-test("impersonation mode keeps its critical exit control below the top safe area", () => {
- assert.match(compactCss, /height: calc\(38px \+ env\(safe-area-inset-top\)\)/);
- assert.match(compactCss, /padding: env\(safe-area-inset-top\)/);
- assert.match(compactCss, /margin-top: calc\(38px \+ env\(safe-area-inset-top\)\)/);
- assert.match(compactCss, /\.layout\.impersonating \{\s*--surface-safe-top: 0px;/);
- assert.match(compactCss, /padding-top: calc\(10px \+ var\(--surface-safe-top\)\)/);
-});
-
-test("shared dialogs keep their scrollable edge inside device safe areas", () => {
- assert.match(
- compactCss,
- /\.project-dialog-backdrop,\s*\.project-dialog \{[\s\S]*--dialog-pad-bottom: max\(20px, env\(safe-area-inset-bottom\)\)/,
- );
- assert.match(
- compactCss,
- /padding: var\(--dialog-pad-top\) var\(--dialog-pad-right\) var\(--dialog-pad-bottom\) var\(--dialog-pad-left\)/,
- );
- assert.match(compactCss, /max-height: calc\(100dvh - var\(--dialog-pad-top\) - var\(--dialog-pad-bottom\)\)/);
-});
-
-test("touch layouts expose row actions and preserve readable composer choices", () => {
- assert.match(compactCss, /@media \(hover: none\)\s*\{\s*\.chat-row-actions\s*\{\s*opacity:\s*1;\s*\}/);
- assert.match(compactCss, /@media \(max-width: 360px\)[\s\S]*content: attr\(data-mobile-label\)/);
- assert.match(
- compactCss,
- /\.composer-toolbar \.runtime-default-btn,[\s\S]*\.composer-toolbar \.send-btn \{\s*min-height: 44px;/,
- );
- assert.match(compactCss, /\.composer-right \.model-control \{\s*flex: 1 1 96px;/);
- assert.match(compactCss, /\.project-create-button \{\s*width: 44px;\s*height: 44px;/);
- assert.match(contexts, /project-create-button"\s+type="button"\s+aria-label="New project"/);
- assert.match(
- compactCss,
- /\.chat-scroll \{\s*padding-right: max\(var\(--chat-pad\), env\(safe-area-inset-right\)\);\s*padding-left: max\(var\(--chat-pad\), env\(safe-area-inset-left\)\)/,
- );
- assert.match(
- compactCss,
- /\.pane \{\s*padding: calc\(28px \+ var\(--surface-safe-top\)\) max\(28px, env\(safe-area-inset-right\)\) calc\(40px \+ env\(safe-area-inset-bottom\)\) max\(28px, env\(safe-area-inset-left\)\)/,
- );
- assert.match(
- compactCss,
- /padding: calc\(20px \+ var\(--surface-safe-top\)\) max\(14px, env\(safe-area-inset-right\)\) calc\(32px \+ env\(safe-area-inset-bottom\)\) max\(14px, env\(safe-area-inset-left\)\)/,
- );
- assert.match(compactCss, /margin: 0 auto max\(18px, calc\(10px \+ env\(safe-area-inset-bottom\)\)\)/);
- assert.match(
- compactCss,
- /\.composer-wrap \{\s*width: auto;\s*margin-right: max\(16px, calc\(10px \+ env\(safe-area-inset-right\)\)\);\s*margin-left: max\(16px, calc\(10px \+ env\(safe-area-inset-left\)\)\)/,
- );
- assert.match(
- compactCss,
- /\.composer-wrap \{\s*margin-right: calc\(10px \+ env\(safe-area-inset-right\)\);\s*margin-bottom: calc\(10px \+ env\(safe-area-inset-bottom\)\);\s*margin-left: calc\(10px \+ env\(safe-area-inset-left\)\)/,
- );
-});
diff --git a/plugins/web-ui/test/runtime-config-handoff.test.ts b/plugins/web-ui/test/runtime-config-handoff.test.ts
deleted file mode 100644
index 5d535698f..000000000
--- a/plugins/web-ui/test/runtime-config-handoff.test.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const composer = readFileSync(new URL("../src/composer.ts", import.meta.url), "utf8");
-const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
-const shell = readFileSync(new URL("../src/shell.ts", import.meta.url), "utf8");
-
-test("boot hands its runtime config to the composer instead of dropping it", () => {
- assert.match(shell, /const personalScope = `personal:\$\{appState\.me\.user\}`;/);
- assert.match(shell, /seedRuntimeConfig\(personalScope, runtimeConfig\);/);
- const fetchAt = shell.indexOf("await fetchRuntimeConfig(personalScope)");
- const seedAt = shell.indexOf("seedRuntimeConfig(personalScope, runtimeConfig)");
- assert.ok(fetchAt > 0 && seedAt > fetchAt, "boot must seed the config it just fetched");
-});
-
-test("composers read the shared boot snapshot without consuming or copying it", () => {
- assert.match(composer, /const activeRuntimeConfig = getRuntimeConfig\(scopeKey\(\)\);/);
- assert.match(composer, /await loadRuntimeConfig\(actualScope, refresh, options.runtimeAccount\)/);
- assert.doesNotMatch(composer, /seededRuntime|applyRuntimeOptions|let activeRuntimeConfig/);
-});
-
-test("a still-loading composer is not painted as a failure", () => {
- const branch = composer.slice(
- composer.indexOf("} else if (!approvalPauses.length && runtimePending) {"),
- composer.indexOf("} else if (composerState.error) {"),
- );
- assert.ok(branch, "the runtime-pending branch not found");
- assert.match(branch, /composerState\.error\s*\?/, "the branch must split on a real error");
- assert.match(branch, /class="composer-note">Loading runtime settings…/, "loading is a note");
- const loadingAt = branch.indexOf("Loading runtime settings…");
- const errorClassAt = branch.indexOf('class="composer-error"');
- assert.ok(errorClassAt >= 0 && errorClassAt < loadingAt, "only the real error keeps the error class");
- assert.ok(
- !/class="composer-error">[\s\S]{0,80}Loading runtime settings…/.test(branch),
- "the loading placeholder must not render inside .composer-error",
- );
- const retryAt = branch.indexOf("Retry");
- assert.ok(retryAt >= 0 && retryAt < loadingAt, "Retry stays on the error side");
-});
-
-test(".composer-error is the destructive colour — which is why loading must not use it", () => {
- assert.match(css, /^\.composer-error \{\n {2}color: var\(--destructive/m);
-});
-
-test("a personal mount passing null still matches the seeded personal scope", () => {
- const resolver = composer.slice(
- composer.indexOf("function runtimeScopeKey"),
- composer.indexOf("function modelOptionFor"),
- );
- assert.ok(resolver, "runtimeScopeKey not found");
- assert.match(resolver, /if \(scopeId\) return scopeId;/, "a named scope is used as-is");
- assert.match(resolver, /return user \? `personal:\$\{user\}` : null;/, "null resolves to the personal scope");
-});
diff --git a/plugins/web-ui/test/runtime-picker-follow.test.ts b/plugins/web-ui/test/runtime-picker-follow.test.ts
deleted file mode 100644
index 8cea38b7a..000000000
--- a/plugins/web-ui/test/runtime-picker-follow.test.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import { test } from "node:test";
-
-const composer = readFileSync(new URL("../src/composer.ts", import.meta.url), "utf8");
-const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-
-test("a thread pick that only mirrored the old default follows a new default", () => {
- assert.match(composer, /followDefault\(defaults\);\n\s+\}\n\s+defaults = next;/);
- assert.match(composer, /picked\.model\.id !== previous\.modelId\) return;\n\s+forgetThreadPick\(threadRef\);/);
-});
-
-test("runtime settings revalidate after each turn and when the tab regains focus", () => {
- assert.match(
- chat,
- /refreshTranscriptFromEntries\(agent\);\n\s+void ctx\.composer\.refreshRuntimeSelection\(scopeId, agent, true\);/,
- );
- assert.match(composer, /addEventListener\("visibilitychange", revalidateRuntime\)/);
- assert.match(composer, /removeEventListener\("visibilitychange", revalidateRuntime\)/);
-});
diff --git a/plugins/web-ui/test/send-retry-source.test.ts b/plugins/web-ui/test/send-retry-source.test.ts
deleted file mode 100644
index 8ae69c2f1..000000000
--- a/plugins/web-ui/test/send-retry-source.test.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { test } from "node:test";
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-
-const source = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-
-test("failed sends render Retry on the optimistic user message", () => {
- const userBranch = source.slice(source.indexOf('if (role === "user"'), source.indexOf('if (role === "assistant"'));
- assert.match(userBranch, /sendFailure/);
- assert.match(userBranch, /retryFailedSend\(message, index\)/);
- assert.match(userBranch, /Retry\s*<\/button>/);
-});
-
-test("the synthetic retryable assistant error stays out of the transcript", () => {
- const assistantBranch = source.slice(
- source.indexOf('if (role === "assistant"'),
- source.indexOf("function messageMeta"),
- );
- assert.match(assistantBranch, /if \(\(msg as AssistantWork\)\.retryableSend\) return nothing/);
- assert.doesNotMatch(assistantBranch, /retryFailedSend/);
-});
-
-test("retry clears the user failure and removes only its synthetic assistant error", () => {
- const retry = source.slice(
- source.indexOf("async function retryFailedSend"),
- source.indexOf("function visibleMessages"),
- );
- assert.match(retry, /delete .*sendFailure/);
- assert.match(retry, /current !== index \+ 1/);
- assert.match(retry, /await agent\.continue\(\)/);
- assert.doesNotMatch(retry, /agent\.prompt/);
-});
diff --git a/plugins/web-ui/test/session-header-stacking.test.ts b/plugins/web-ui/test/session-header-stacking.test.ts
deleted file mode 100644
index 1ff1e3000..000000000
--- a/plugins/web-ui/test/session-header-stacking.test.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-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 main session header paints above its composited transcript scroller", () => {
- const block = css.match(/\.chat-topbar \{[^}]*\}/)?.[0] ?? "";
- assert.match(block, /position: relative;/, "the header must establish a positioned stacking layer");
- assert.match(block, /z-index: 1;/, "the header must paint above the transcript scroller");
-});
diff --git a/plugins/web-ui/test/session-share-actions.test.ts b/plugins/web-ui/test/session-share-actions.test.ts
deleted file mode 100644
index 2824a836e..000000000
--- a/plugins/web-ui/test/session-share-actions.test.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const read = (name: string) => readFileSync(new URL(`../src/${name}`, import.meta.url), "utf8");
-const split = read("split.ts");
-const sessions = read("sessions.ts");
-const css = read("shell.css");
-
-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(
- 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 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 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, 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: 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", () => {
- assert.match(
- sessions,
- /class="session-menu-btn session-share-btn"[\s\S]*?openSessionShare\(s.id\)[\s\S]*?session-archive-btn/,
- );
- const row = sessions.slice(
- sessions.indexOf("function chatPageRow"),
- sessions.indexOf("export function addPendingSession"),
- );
- assert.match(row, /openSessionShare\(s.id\)[\s\S]*?tip\(s.archived/);
- assert.doesNotMatch(row, /Copy link/);
- assert.match(css, /\.sidebar \.session-share-btn,\s*\.sidebar \.session-archive-btn\s*\{\s*display: none/);
-});
-
-test("a topbar without archive does not offer a separate share button", () => {
- assert.doesNotMatch(read("session-scope.ts"), /session-share-button|openSessionShare/);
- assert.doesNotMatch(css, /\.session-share-button\s*\{/);
-});
diff --git a/plugins/web-ui/test/settings-page.test.ts b/plugins/web-ui/test/settings-page.test.ts
deleted file mode 100644
index 2a8c68622..000000000
--- a/plugins/web-ui/test/settings-page.test.ts
+++ /dev/null
@@ -1,105 +0,0 @@
-import { test } from "node:test";
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-
-const settings = readFileSync(new URL("../src/settings.ts", import.meta.url), "utf8");
-const shell = readFileSync(new URL("../src/shell.ts", import.meta.url), "utf8");
-const shellState = readFileSync(new URL("../src/shell-state.ts", import.meta.url), "utf8");
-const main = readFileSync(new URL("../src/main.ts", import.meta.url), "utf8");
-const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
-
-test("settings is a routable view, so /settings survives a reload and a shared link", () => {
- assert.match(shellState, /"settings",?\s*\] as const/);
- assert.match(shell, /case "settings":\s*renderSettings\(\);/);
- const switchBody = shell.slice(
- shell.indexOf("export function switchView"),
- shell.indexOf("function refreshActiveView"),
- );
- assert.match(switchBody, /case "settings":/, "switchView must route the settings view");
-});
-
-test("the sidebar footer keeps the identity pill, an admin shortcut, and the settings button", () => {
- const footer = shell.slice(
- shell.indexOf("export function renderSidebarFooter"),
- shell.indexOf("export function renderSidebarTop"),
- );
- assert.match(footer, /class="user-pill"/);
- assert.match(footer, /aria-label="Settings"/);
- assert.doesNotMatch(footer, /theme-toggle/, "the theme toggle became the settings button");
- assert.match(
- footer,
- /can\("admin"\)[\s\S]{0,120}href=\$\{ADMIN_HOME_URL\}/,
- "admins get a one-click way into the admin portal, and only admins",
- );
- assert.doesNotMatch(footer, /aria-label="Sign out"/, "sign out moved behind the identity pill");
- assert.match(footer, /Sign out/, "sign out still exists — inside the pill's menu");
- assert.doesNotMatch(shell, /mini-lit\/dist\/ThemeToggle/, "the theme web component is no longer imported");
-});
-
-test("the identity menu closes on an outside click and on Escape", () => {
- assert.match(main, /if \(!target\?\.closest\("\.user-menu"\)\) closeUserMenu\(\);/);
- const escapeHandler = main.slice(main.indexOf('if (e.key !== "Escape") return;'));
- assert.match(escapeHandler, /closeUserMenu\(\);/);
-});
-
-test("theme choice persists under the key the boot path reads, and system tracks the OS", () => {
- assert.match(settings, /const THEME_KEY = "theme";/);
- assert.match(settings, /localStorage\.removeItem\(THEME_KEY\)/, "system is stored as the absence of a choice");
- assert.match(settings, /matchMedia\("\(prefers-color-scheme: dark\)"\)/);
- assert.match(settings, /classList\.toggle\("dark", dark\)/);
- assert.match(
- shell,
- /applyTheme\(\);\nwatchSystemTheme\(\);/,
- "boot must apply the saved theme without the old component",
- );
-});
-
-test("the settings page offers the theme picker and a way into admin", () => {
- assert.match(settings, /value: "light"/);
- assert.match(settings, /value: "dark"/);
- assert.match(settings, /value: "system"/);
- assert.match(settings, /href=\$\{ADMIN_HOME_URL\}/);
- assert.match(settings, /role="radiogroup"/);
- assert.match(css, /\.settings-choice-option\.selected \{/);
-});
-
-test("an imported palette is a fourth theme choice that only exists while a palette is stored", () => {
- assert.match(settings, /const CUSTOM_THEME_KEY = "theme:custom";/);
- assert.match(
- settings,
- /if \(stored === "custom" && storedCustomTheme\(\)\) return stored;/,
- "a dangling custom choice with no palette must fall back to system",
- );
- assert.match(settings, /custom \? themeOption\("custom"/);
- assert.match(settings, /class="theme-file-input"\s+type="file"\s+hidden\s+accept=\$\{THEME_FILE_ACCEPT\}/);
- assert.match(
- settings,
- /querySelector<HTMLInputElement>\("\.theme-file-input"\)\s*\?\.click\(\)/,
- "a real button opens the picker so the keyboard can reach it",
- );
- assert.match(settings, /\.itermcolors/);
- assert.match(settings, /aria-label="Remove imported theme"/);
-});
-
-test("the imported palette is painted as one style element that applyTheme owns end to end", () => {
- const apply = settings.slice(
- settings.indexOf("export function applyTheme"),
- settings.indexOf("export function setTheme"),
- );
- assert.match(apply, /getElementById\(CUSTOM_THEME_STYLE_ID\)/);
- assert.match(apply, /styleEl\.textContent = themeCss\(tokens\);/);
- assert.match(apply, /classList\.toggle\("dark", tokens\.dark\)/, "the palette decides dark mode, not the OS");
- assert.match(apply, /styleEl\?\.remove\(\);/, "leaving custom must strip the injected palette");
- assert.match(css, /\.theme-swatch \{/);
-});
-
-const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-
-test("the chat greeting rotates across reloads, not just within one page session", () => {
- assert.match(chat, /const CTA_INDEX_KEY = "web-ui:chat-cta";/);
- const next = chat.slice(chat.indexOf("function nextChatCta"), chat.indexOf("const connectedConnectors"));
- assert.match(next, /localStorage\.getItem\(CTA_INDEX_KEY\)/, "the seed must survive a page load");
- assert.match(next, /localStorage\.setItem\(CTA_INDEX_KEY/);
- assert.match(next, /% CHAT_CTAS\.length/);
- assert.doesNotMatch(chat, /let ctaIndex = -1;/, "the per-surface counter always restarted at the first line");
-});
diff --git a/plugins/web-ui/test/sidebar-rail-source.test.ts b/plugins/web-ui/test/sidebar-rail-source.test.ts
deleted file mode 100644
index 59f32a1f8..000000000
--- a/plugins/web-ui/test/sidebar-rail-source.test.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-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 shell = readFileSync(new URL("../src/shell.ts", import.meta.url), "utf8");
-const mobileButton = css.indexOf("\n.mobile-menu-btn {");
-assert.ok(mobileButton >= 0, "the mobile menu button has a desktop visibility rule");
-const mobileShell = css.indexOf("@media (max-width: 860px) {", mobileButton);
-assert.ok(mobileShell > mobileButton, "the phone shell media query follows the mobile menu button rule");
-
-test("collapsed sidebar is an in-flow rail, not a floating button", () => {
- assert.doesNotMatch(shell, /sidebar-peek-toggle/);
- assert.doesNotMatch(css, /sidebar-peek-toggle/);
- assert.match(css, /--rail-w: 50px/);
- assert.match(css, /\.layout\.sidebar-closed \.sidebar \{\s*width: var\(--rail-w\);\s*padding-right: 8px;\s*\}/);
- assert.match(css, /\.sidebar \{[^}]*transition: width 0\.18s ease;/);
- assert.match(css, /body\.resizing-sidebar \.sidebar \{\s*transition: none;/);
- assert.match(css, /@media \(prefers-reduced-motion: reduce\) \{\s*\.sidebar \{\s*transition: none;/);
-});
-
-test("hidden sidebar innards are out of the focus order and keep their layout while clipped", () => {
- assert.match(css, /\.sidebar > :not\(\.brand\) \{\s*min-width: calc\(var\(--sidebar-w\) - 16px\);/);
- assert.match(
- css,
- /\.layout\.sidebar-closed \.sidebar > :not\(\.brand\):not\(#sidebar-top\):not\(#sidebar-footer\),\s*\.layout\.sidebar-closed \.brand-lockup \{[^}]*opacity: 0;\s*visibility: hidden;\s*\}/,
- );
-
- const sidebarRules = [...css.slice(0, mobileShell).matchAll(/([^{}]+)\{([^{}]*)\}/g)]
- .filter(([, selector]) => /(?:\.sidebar\b|#sidebar-|\.brand(?:-lockup)?\b)/.test(selector!))
- .map(([, , declarations]) => declarations)
- .join("\n");
- assert.doesNotMatch(sidebarRules, /transition:[^;}]*visibility/);
- assert.doesNotMatch(shell, /sidebar\.inert/);
-});
-
-test("the collapsed rail keeps icon-only navigation instead of going empty", () => {
- assert.match(
- css,
- /\.layout\.sidebar-closed #sidebar-top \{\s*min-width: 0;[^}]*min-height: 0;\s*overflow-y: auto;\s*\}/,
- );
- assert.match(
- css,
- /\.layout\.sidebar-closed #sidebar-top \.navrow span,\s*\.layout\.sidebar-closed #sidebar-top \.section-label \{\s*display: none;/,
- );
- assert.match(css, /\.layout\.sidebar-closed #sidebar-top \.navrow \{\s*justify-content: center;/);
-
- assert.match(css, /\.layout\.sidebar-closed #sidebar-footer \{\s*min-width: 0;\s*justify-content: center;\s*\}/);
- assert.match(css, /\.layout\.sidebar-closed #sidebar-footer \.user-menu \{\s*display: none;\s*\}/);
- // Icon-only rows need tooltips to carry their labels.
- assert.match(shell, /class="navrow[^`]*\$\{tip\(sidebarOpen \? "" : label\)\}/);
-});
-
-test("rail tooltips open beside the icons on first paint and on every toggle", () => {
- assert.match(shell, /data-tip-placement=\$\{sidebarOpen \? "top" : "right"\}/);
- assert.match(shell, /setAttribute\("data-tip-placement", open \? "top" : "right"\)/);
-});
-
-test("the collapse toggle's tooltip is pushed in step with the aria-label it mirrors", () => {
- assert.match(shell, /btn\.setAttribute\("aria-label", collapseLabel\);\s*attachTooltip\(btn, collapseLabel\);/);
-});
-
-test("phone viewports swap the rail for a slide-over drawer with one floating menu button", () => {
- const mobile = css.slice(mobileShell);
-
- assert.match(mobile, /\.layout\.sidebar-closed \.sidebar \{\s*transform: translateX\(-106%\);\s*visibility: hidden;/);
- assert.match(mobile, /\.mobile-menu-btn \{\s*display: inline-flex;\s*position: absolute;/);
-
- assert.match(mobile, /\.chat-topbar \{[^}]*padding-left: calc\(max\(4px, env\(safe-area-inset-left\)\) \+ 48px\);/);
-
- assert.match(shell, /class="icon-btn sidebar-toggle mobile-menu-btn"[^`]*@click=\$\{toggleSidebar\}/);
-
- assert.match(css, /\.mobile-menu-btn \{\s*display: none;\s*\}/);
-});
-
-test("per-view clearance hacks for the old floating button are gone", () => {
- assert.doesNotMatch(css, /sidebar-closed \.kc-hero-copy/);
- assert.doesNotMatch(css, /peek-clearance/);
-});
diff --git a/plugins/web-ui/test/sidebar-row-tooltips.test.ts b/plugins/web-ui/test/sidebar-row-tooltips.test.ts
deleted file mode 100644
index c2df0187e..000000000
--- a/plugins/web-ui/test/sidebar-row-tooltips.test.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-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/skills-deep-link.test.ts b/plugins/web-ui/test/skills-deep-link.test.ts
deleted file mode 100644
index 641c45592..000000000
--- a/plugins/web-ui/test/skills-deep-link.test.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const source = readFileSync(new URL("../src/skills.ts", import.meta.url), "utf8");
-const shell = readFileSync(new URL("../src/shell.ts", import.meta.url), "utf8");
-const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
-
-function bodyOf(name: string): string {
- const start = source.indexOf(`function ${name}(`);
- assert.notEqual(start, -1, `${name} exists`);
- const next = source.indexOf("\nfunction ", start + 1);
- return source.slice(start, next < 0 ? source.length : next);
-}
-
-test("skill rows link to dedicated detail routes instead of expanding inline", () => {
- const row = bodyOf("skillVariant");
- assert.match(row, /class="skill-variant-main"/);
- assert.match(row, /deepLinkPath\(UI_BASE, "skills", null, null, s\.id \?\? null\)/);
- assert.match(row, /openSkill\(s, \{ push: true \}\)/);
- assert.doesNotMatch(row, /<details|<summary|skillMeta|skill-variant-meta/);
- assert.match(row, /<code class="skill-variant-name" dir="auto">\/\$\{s\.name\}<\/code>/);
- assert.match(row, /<span class="skill-variant-description"/);
- assert.match(css, /\.skill-variant-main::after \{\s*position: absolute;\s*inset: 0;/);
- assert.match(css, /\.skill-variant-state \{\s*position: relative;\s*z-index: 1;/);
- assert.match(css, /\.skill-variant-main \{[\s\S]*grid-template-columns: minmax\(110px, 0\.34fr\) minmax\(0, 1fr\)/);
- assert.doesNotMatch(bodyOf("skillGroup"), /skill-group-head|skill-group-name|skill-precedence/);
-});
-
-test("skill details have a back link and resource fields", () => {
- const detail = bodyOf("openSkill");
- assert.match(detail, /listBackLink\("Skills", \(\) => drawSkills\(\)\)/);
- for (const label of ["Description", "Scope", "Version", "Source", "Capabilities", "Assets"]) {
- assert.match(detail, new RegExp(`<label>${label}</label>`));
- }
- assert.match(
- bodyOf("skillScopeTitle"),
- /s\.scope === "personal" \|\| s\.scope === "channel" \|\| s\.scope === "group"/,
- );
-});
-
-test("skill detail routes survive reload and browser history", () => {
- assert.match(shell, /if \(wanted === "skills" && wantedItem\) openSkillById\(wantedItem\)/);
- assert.match(shell, /else if \(view === "skills"\) routeSkillsHistory\(item\)/);
-});
diff --git a/plugins/web-ui/test/slack-render-source.test.ts b/plugins/web-ui/test/slack-render-source.test.ts
deleted file mode 100644
index 2aa9bb8a9..000000000
--- a/plugins/web-ui/test/slack-render-source.test.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-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 chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-const search = readFileSync(new URL("../src/search.ts", import.meta.url), "utf8");
-const slackText = readFileSync(new URL("../src/slack-text.ts", import.meta.url), "utf8");
-
-test("inbox slack text renders through the wire decoder, not raw", () => {
- assert.match(inbox, /import \{ splitSlackWire \} from "\.\/slack-text";/);
- const tpl = inbox.slice(inbox.indexOf("export function slackTextTpl"), inbox.indexOf("function itemImagesTpl"));
- assert.match(tpl, /splitSlackWire\(text\)/, "wire tokens (<@U…>, <url|label>) tokenize before render");
- assert.match(tpl, /withMentions\(seg\.label\)/, "@handles inside a link label still chip");
- assert.match(tpl, /withMentions\(seg\.text\)/, "@handles in plain segments still chip");
- assert.match(tpl, /if \(item\.source !== "slack"\) return html`\$\{text\}`;/, "gmail text is untouched");
-});
-
-test("the snippet inside the row button renders links as labels, never nested anchors", () => {
- assert.match(inbox, /slackTextTpl\(item, item\.snippet, \{ links: false \}\)/);
-});
-
-test("reply text and context messages go through the same decoder", () => {
- assert.match(inbox, /slackTextTpl\(item, item\.externalReplyText\)/);
- assert.match(inbox, /slackTextTpl\(item, m\.text\)/);
-});
-
-test("splitSlackWire tokenizes on the raw wire, then unescapes prose and labels", () => {
- const fn = slackText.slice(
- slackText.indexOf("export function splitSlackWire"),
- slackText.indexOf("export function slackWireToPlain"),
- );
- assert.match(
- fn,
- /segments\.push\(\{ kind: "text", text: decodeSlackEntities\(raw\) \}\)/,
- "prose decodes after tokenizing",
- );
-});
-
-test("read-only slack sessions strip directives and decode user wire at render", () => {
- assert.match(chat, /import \{ slackWireToPlain, splitSlackWire, stripSlackDirectives \} from "\.\/slack-text";/);
- const gate = chat.slice(chat.indexOf("function isReadOnlySlackView"), chat.indexOf("function assistantDisplayText"));
- assert.match(
- gate,
- /!chatState\.agent && chatState\.forkSession !== null && surfaceOf\(chatState\.forkSession\) === "slack"/,
- "the read-only Slack predicate lives in one place",
- );
- assert.match(chat, /return isReadOnlySlackView\(\) \? stripSlackDirectives\(text\) : text;/, "assistant text strips");
- assert.match(
- chat,
- /isReadOnlySlackView\(\) \? slackWireBubble\(messageText\(message\)\) : markdown\(messageText\(message\)\)/,
- "user bubbles wire-decode in a read-only Slack view",
- );
-});
-
-test("copy and search surface the displayed text, not raw wire/directives", () => {
- assert.match(chat, /function copyableText\(message: AgentMessage\): string/);
- assert.match(chat, /const text = copyableText\(message\)\.trim\(\);/);
- assert.match(
- search,
- /hit\.surface === "slack" \? slackWireToPlain\(stripSlackDirectives\(hit\.snippet\)\) : hit\.snippet/,
- );
-});
diff --git a/plugins/web-ui/test/speaker-labels.test.ts b/plugins/web-ui/test/speaker-labels.test.ts
deleted file mode 100644
index 77fb0318c..000000000
--- a/plugins/web-ui/test/speaker-labels.test.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-const server = readFileSync(new URL("../server/index.ts", import.meta.url), "utf8");
-
-test("user bubbles are labeled when several people spoke or when a speaker is not the viewer", () => {
- const rule = chat.match(/function updateSpeakerLabels[\s\S]*?\n {2}\}/)?.[0] ?? "";
- assert.match(rule, /const viewer = appState\.me\?\.displayName\?\.trim\(\)\.toLowerCase\(\);/);
- assert.match(
- rule,
- /labelSpeakers =\s*names\.size > 1 \|\| \(Boolean\(viewer\) && \[\.\.\.names\]\.some\(\(n\) => n\.toLowerCase\(\) !== viewer\)\)/,
- );
-});
-
-test("the BFF hands the browser the viewer's display name from the portal identity", () => {
- const me = server.match(/pathname === "\/me"[\s\S]*?permissions,\s*\}\);/)?.[0] ?? "";
- assert.match(me, /displayName: resolveIdentity\(req\)\?\.name \?\? null,/);
-});
diff --git a/plugins/web-ui/test/split-canvas-entry.test.ts b/plugins/web-ui/test/split-canvas-entry.test.ts
deleted file mode 100644
index ae97c7692..000000000
--- a/plugins/web-ui/test/split-canvas-entry.test.ts
+++ /dev/null
@@ -1,205 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const read = (f: string): string => readFileSync(new URL(`../src/${f}`, import.meta.url), "utf8");
-const split = read("split.ts");
-const sessions = read("sessions.ts");
-const shell = read("shell.ts");
-const chat = read("chat.ts");
-const layout = read("split-layout.ts");
-const css = read("shell.css");
-
-const fn = (src: string, name: string): string => {
- const top = src.match(new RegExp(`^(?:export )?(?:async )?function ${name}\\([\\s\\S]*?\\n\\}`, "m"))?.[0];
- const nested = src.match(new RegExp(`^ {2}(?:async )?function ${name}\\([\\s\\S]*?\\n {2}\\}`, "m"))?.[0];
- const body = top ?? nested ?? "";
- assert.ok(body, `${name} not found`);
- return body;
-};
-
-test("every new-chat affordance follows the shared placement rule", () => {
- const placed = fn(split, "startNewChatInCanvas");
- assert.match(placed, /dockApi\.panels\.length >= MAX_PANES/);
- assert.match(placed, /dockApi\.removePanel\(target\)/);
- assert.match(placed, /dockApi\.groups\.length === 2/);
- const start = fn(sessions, "startNewChat");
- assert.match(start, /const pane = startNewChatInCanvas/);
- assert.match(start, /addPendingSession\(conv\.newChat/);
- assert.match(shell, /startNewChatInLastScope\(\);/);
- assert.match(fn(sessions, "startProjectChat"), /startNewChat\(scopeId, name\);/);
- assert.match(fn(sessions, "startNewChatInLastScope"), /startNewChat\(/);
- assert.match(fn(shell, "openAppEditChat"), /startNewChat\(null, null, threadRef\)/);
- for (const file of ["contexts.ts", "search.ts", "crons.ts"]) {
- const source = read(file);
- assert.doesNotMatch(source, /\.newChat\(/);
- assert.match(source, /startNewChat\(/);
- }
- assert.match(sessions, /action: \{ label: "New chat", onClick: \(\) => startNewChat\(\) \}/);
-});
-
-test("a pane opened from a project's + starts its chat in that project", () => {
- assert.match(split, /scopeId\?: string;/, "PaneParams must carry the project");
- const load = split.match(/private async load\(\): Promise<void> \{[\s\S]*?\n {2}\}/)?.[0] ?? "";
- assert.ok(load, "the pane loader not found");
- const seeded = load.indexOf("contextsState.list.find((c) => c.scopeId === scopeId)");
- assert.ok(seeded > 0, "the seed scope must resolve against contexts the viewer can actually use");
- assert.ok(load.indexOf("if (!wanted)") < seeded, "an adopted session still wins over the seed scope");
- assert.doesNotMatch(load, /newChat\(\{ scopeId: scopeId/, "an unchecked scope must not reach newChat");
- assert.match(load, /newChat\(context \? \{ scopeId: context\.scopeId/);
-});
-
-test("a pane is an element in this document — never a second copy of the app", () => {
- assert.doesNotMatch(split, /iframe/i, "panes must not reload the whole SPA per conversation");
- assert.doesNotMatch(split, /postMessage/, "same-document panes talk by call, not by message");
- assert.doesNotMatch(split, /defaultRenderer: "always"/, "a pane behind a tab must cost nothing until shown");
- assert.match(split, /createConversation\(\{/, "each pane owns a conversation instance");
- assert.match(split, /disposeConversation\(this\.conversation\)/, "and releases it when the pane closes");
- const load = split.match(/private async load\(\): Promise<void> \{[\s\S]*?\n {2}\}/)?.[0] ?? "";
- assert.match(
- load,
- /if \(this\.loaded \|\| this\.disposed\) return;/,
- "a pane loads its transcript once, and never after it closes",
- );
- assert.match(load, /if \(this\.disposed\) return;/, "and drops the continuation if the pane closed mid-load");
- assert.match(
- split,
- /onDidVisibilityChange\(\(e\) => \{\s*this\.visible = e\.isVisible;\s*if \(!e\.isVisible\) return;/,
- );
-});
-
-test("a conversation dropped on a pane's tab strip joins that pane — and only there", () => {
- const accept = split.match(/api\.onUnhandledDragOver\(\(e\) => \{[\s\S]*?\n {2}\}\);/)?.[0] ?? "";
- assert.ok(accept, "onUnhandledDragOver not wired");
- assert.match(accept, /paneDrag && \(e\.target === "tab" \|\| e\.target === "header_space"\)/);
- assert.doesNotMatch(accept, /"content"|"edge"/);
-
- const drop = split.match(/api\.onDidDrop\(\(e\) => \{[\s\S]*?\n {2}\}\);/)?.[0] ?? "";
- assert.ok(drop, "onDidDrop not wired");
- assert.match(drop, /tabIntoPane\(anchor\.id, drag\.params/);
- assert.match(drop, /focusExistingPane\(drag\.existing\)/, "a pane already on screen is focused, not cloned");
- assert.match(drop, /endPaneDrag\(\);/, "the zone overlays must come down with the drag");
-
- assert.match(accept, /if \(paneDrag/, "only a live pane drag may be accepted");
-});
-
-test("a strip drop lands where a dragged pane header would, not merely at the end", () => {
- const drop = fn(split, "buildDock");
- assert.match(drop, /e\.panel \? e\.group\?\.panels\.indexOf\(e\.panel\) : undefined/);
- assert.match(drop, /tabIntoPane\([\s\S]{0,120}at === -1 \? undefined : at\)/);
-
- const into = fn(split, "tabIntoPane");
- assert.match(into, /index\?: number/, "tabIntoPane must accept an insertion index");
- assert.match(into, /direction: "within"/);
- assert.match(into, /index === undefined \? \{\} : \{ index \}/, "and forward it to addPane");
- const add = fn(split, "addPane");
- assert.match(add, /index\?: number/, "addPane must pass dockview its own position.index");
-});
-
-test("the pane body no longer offers a tab zone", () => {
- assert.doesNotMatch(layout, /"tab"/, "DropEdge must drop the zone that no longer exists");
- const zones = fn(split, "paneZonesTpl") + fn(split, "splitZonesTpl");
- assert.doesNotMatch(zones, /"tab"/);
- assert.match(zones, /zoneTpl\("center", "Replace pane"/);
- for (const edge of ["left", "right", "top", "bottom"]) assert.match(zones, new RegExp(`zoneTpl\\("${edge}"`));
- assert.doesNotMatch(css, /\.zone-tab \{/);
- const center = css.match(/\.zone-center \{[^}]*\}/)?.[0] ?? "";
- assert.match(center, /top: 25%;/);
- assert.match(center, /bottom: 25%;/);
- assert.doesNotMatch(css, /\.split-zones-single \.zone-center/, "with one zone layout the exception is dead");
-});
-
-test("the tile cap only judges dockview's own panel drags", () => {
- const hold = split.match(/const holdTileCap = \(e: DockviewWillDropEvent\): void => \{[\s\S]*?\n {2}\};/)?.[0] ?? "";
- assert.ok(hold, "holdTileCap not found");
- const bail = hold.indexOf("if (e.getData() === undefined) return;");
- assert.ok(bail > 0, "a foreign drag must be waved through");
- assert.ok(bail < hold.indexOf("dropAddsTile"), "before the tile arithmetic, not after");
-});
-
-test("boot mounts a restored canvas before it awaits the session list", () => {
- const boot = shell.match(/export async function boot\(\): Promise<void> \{[\s\S]*?\n\}/)?.[0] ?? "";
- assert.ok(boot, "boot not found");
- const early = boot.indexOf(
- "if (restoreLast && bareEntry && !restoredCanvasNeedsSessionList()) mountRestoredCanvas(true);",
- );
- const listStart = boot.indexOf("const sessions = refreshSessions({ showLoading: true });");
- const listAwait = boot.lastIndexOf("await sessions;");
- assert.ok(early > 0, "boot must offer the canvas its head start");
- assert.ok(listStart > 0, "boot still loads the session list");
- assert.ok(listStart < early, "the list overlaps runtime settings and remote layout reads");
- assert.ok(early < listAwait, "the restored canvas must not wait for the sidebar list");
-
- assert.match(boot, /const bareEntry = !viewIntent && !wantedSession && wanted !== "app-edit" && !connectedProvider;/);
-
- assert.match(
- boot.slice(listAwait),
- /\} else if \(!\(restoreLast && mountRestoredCanvas\(\)\) && !mainConversation\(\)\.state\.threadRef\) \{/,
- );
- const mount = fn(split, "mountRestoredCanvas");
- assert.match(mount, /if \(isPhone\(\) \|\| \(restoreOnly && !splitState\.active\)\) return false;/);
- assert.match(mount, /if \(dockApi\.panels\.length === 0\) addPane\(\{\}\);/);
-});
-
-test("boot's fallback never replaces a chat the user mounted during the wait", () => {
- const boot = shell.match(/export async function boot\(\): Promise<void> \{[\s\S]*?\n\}/)?.[0] ?? "";
- const listAwait = boot.lastIndexOf("await sessions;");
- const tail = boot.slice(listAwait);
- assert.match(
- tail,
- /\} else if \(!\(restoreLast && mountRestoredCanvas\(\)\) && !mainConversation\(\)\.state\.threadRef\) \{/,
- );
- const guard = tail.indexOf("!mainConversation().state.threadRef");
- const mint = tail.indexOf("newChat();", guard);
- assert.ok(guard > 0 && mint > guard, "the guard must gate the mint, not follow it");
-
- assert.match(chat, /^ {2}function mountContinuable\(/m);
- assert.match(fn(chat, "mountContinuable"), /chatState\.threadRef = threadRef;/);
-
- const reconcile = fn(split, "reconcileAfterClose");
- assert.match(reconcile, /if \(dockApi\.panels\.length === 0\) addPane\(\{\}\);/);
- assert.doesNotMatch(reconcile, /exitSplitIfActive|maximizePane|mainConversation/);
- assert.match(fn(split, "exitSplitIfActive"), /splitState\.active = false;/);
-});
-
-test("a pane gives the conversation the same height chain the full-screen .main does", () => {
- // .custom-chat sizes itself with flex: 1 / min-height: 0, so every container it
- // mounts into must be a flex column of definite height — .main is; the pane
- // wrapper must be too, or the transcript never scroll-contains and the composer
- // trails the content instead of pinning to the pane's bottom edge.
- const main = css.match(/^\.main \{[^}]*\}/m)?.[0] ?? "";
- assert.match(main, /display: flex;/);
- assert.match(main, /flex-direction: column;/);
- const pane = css.match(/^\.split-pane-chat \{[^}]*\}/m)?.[0] ?? "";
- assert.match(pane, /display: flex;/, "the pane wrapper must be a flex container");
- assert.match(pane, /flex-direction: column;/, "…a column, like .main");
- assert.match(pane, /height: 100%;/, "…of definite height");
- assert.match(pane, /overflow: hidden;/, "…that clips instead of growing the pane");
-});
-
-test("adopting a remote layout normalizes the mirrored timestamp to the server record", () => {
- const adopt = fn(split, "adoptRemoteSplit");
- assert.match(adopt, /persistedUpdatedAt = at;/, "the in-memory watermark takes the server record's time");
- assert.match(
- adopt,
- /JSON\.stringify\(\{ \.\.\.rec\.value, updatedAt: at \}\)/,
- "the local mirror must carry the server-clamped timestamp, not the value's inner claim",
- );
-});
-
-test("hidden panes retain agent state without rendering, and repaint when activated", () => {
- const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
- const draw = chat.slice(chat.indexOf(" function drawActiveChat("), chat.indexOf(" function sessionTopbar("));
- assert.match(draw, /if \(!ctx\.visible\(\)\) \{\s*postCurrentPaneState\(\);\s*return;/);
- assert.ok(draw.indexOf("if (!ctx.visible())") < draw.indexOf("transcriptViewport.beforeRender()"));
- assert.match(split, /this\.visible = p\.api\.isVisible;/);
- assert.match(split, /visible: \(\) => splitState\.active && appState\.currentView === "chats" && this\.visible/);
- assert.match(
- split,
- /this\.syncDensity\(\);\s*this\.conversation\?\.redraw\(\);\s*this\.conversation\?\.scrollToBottom\(\)/,
- );
- assert.match(
- split,
- /notePaneSession\(this\.panelId, paneState\.sessionId, paneState\.threadRef\);\s*notifyPanesChanged\(\);/,
- );
-});
diff --git a/plugins/web-ui/test/split-drop-legitimacy.test.ts b/plugins/web-ui/test/split-drop-legitimacy.test.ts
deleted file mode 100644
index 2b0d226b9..000000000
--- a/plugins/web-ui/test/split-drop-legitimacy.test.ts
+++ /dev/null
@@ -1,85 +0,0 @@
-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 split = readFileSync(new URL("../src/split.ts", import.meta.url), "utf8");
-const kinds = readFileSync(new URL("../src/pane-kinds.ts", import.meta.url), "utf8");
-
-test("a pane only offers the drops that will really happen", () => {
- const zones = split.match(/^function paneZonesTpl\([\s\S]*?\n\}/m)?.[0] ?? "";
- assert.ok(zones, "paneZonesTpl not found");
- assert.match(zones, /const showing = drag\.existing\(\);/, "a drag already on the canvas gets no split/tab targets");
- assert.match(
- zones,
- /"Show here", \(\) => \{\n\s*endPaneDrag\(\);\n\s*focusPane\(paneId\);/,
- "its own pane offers a target that really focuses it",
- );
- assert.match(zones, /groups\.length < MAX_TILES/, "split targets vanish at the tile cap");
- assert.match(zones, /panels\.length < MAX_PANES/, "split targets also vanish at the pane ceiling");
- assert.match(split, /render\(paneDrag \? paneZonesTpl\(this\.panelId\) : nothing, this\.zonesEl\);/);
-});
-
-test("the tab strips light up as targets from the moment the drag starts", () => {
- const refresh = split.match(/^function refreshPaneDrag\([\s\S]*?\n\}/m)?.[0] ?? "";
- assert.ok(refresh, "refreshPaneDrag not found");
- assert.match(
- refresh,
- /!drag\.existing\(\) && \(dockApi\?\.panels\.length \?\? 0\) < MAX_PANES/,
- "but only when a strip drop would really add a tab",
- );
- assert.match(split, /classList\.toggle\("session-dragging", addsTab\)/);
- assert.match(split, /classList\.remove\("session-dragging"\)/);
- assert.match(css, /\.split-canvas\.session-dragging \.dv-tabs-and-actions-container \{/);
-});
-
-test("targets and highlights stay honest when the layout changes mid-drag", () => {
- assert.match(
- split,
- /if \(paneDrag\) refreshPaneDrag\(\);\n\s*persistSoon\(\);/,
- "a layout change during a drag recomputes the drop targets and strip highlight, whatever the drag carries",
- );
-});
-
-test("single-pane chats share the canvas drag path", () => {
- assert.doesNotMatch(split, /showSingleDropOverlay|currentChatParams|splittableSingle/);
- assert.match(split, /beginPaneDrag\(sessionTarget\(sessionId, s\.threadRef\)\);/);
-});
-
-test("every pane kind shares one legitimacy path", () => {
- assert.doesNotMatch(split, /inboxView|inboxDrag|sessionDrag/, "split.ts knows kinds only through the registry");
- assert.match(kinds, /export function registerPaneKind\(kind: PaneKind\): void \{/);
- assert.doesNotMatch(
- kinds,
- /^import [^t]/m,
- "the registry stays dependency-free so registration never rides an import cycle",
- );
- const kindDrag = split.match(/^export function beginPaneKindDrag\([\s\S]*?\n\}/m)?.[0] ?? "";
- assert.ok(kindDrag, "beginPaneKindDrag not found");
- assert.match(
- kindDrag,
- /panelParams\(p\)\[kind\.paramsKey\] === id/,
- "a kind pane already on the canvas is found by its own params key",
- );
-});
-
-test("the highlighted strip is a real drop target, not just a glow", () => {
- const strip = split.match(/^class StripDrop[\s\S]*?\n\}/m)?.[0] ?? "";
- assert.ok(strip, "StripDrop not found");
- assert.match(split, /createPrefixHeaderActionComponent: \(\) => new StripDrop\(\)/, "dockview owns its lifecycle");
- assert.match(strip, /zoneTpl\("center", "Open as tab"/, "the strip offers an explicit join target");
- assert.match(strip, /tabIntoPane\(anchor\.id/, "dropping on the strip really adds a tab");
- assert.match(strip, /stripJoinable\(\)/, "and only when that drop would really add a tab");
- const end = split.match(/^export function endPaneDrag\([\s\S]*?\n\}/m)?.[0] ?? "";
- assert.match(end, /drawStripDrops\(\)/, "zones vanish when the drag ends");
- assert.match(css, /\.strip-zones \{/, "the overlay is styled");
-});
-
-test("drop regions tile the content without pointer-dead margins", () => {
- const zone = css.match(/\.split-zone \{[^}]*\}/)?.[0] ?? "";
- assert.match(zone, /margin: 0;/);
- for (const edge of ["left", "right"]) {
- assert.match(css.match(new RegExp(`\\.zone-${edge} \\{[^}]*\\}`))?.[0] ?? "", /width: 25%;/);
- }
- assert.match(css, /\.split-zones > \.split-zone:only-child \{/);
-});
diff --git a/plugins/web-ui/test/steer-recovery-source.test.ts b/plugins/web-ui/test/steer-recovery-source.test.ts
deleted file mode 100644
index 4818d5af9..000000000
--- a/plugins/web-ui/test/steer-recovery-source.test.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const bridge = readFileSync(new URL("../src/core-bridge.ts", import.meta.url), "utf8");
-const conversations = readFileSync(new URL("../src/conversations.ts", import.meta.url), "utf8");
-const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-
-test("signalLiveRun reports a terminal/vanished run as an outcome instead of throwing", () => {
- assert.match(
- bridge,
- /export type SignalOutcome = \{ ok: true \} \| \{ ok: false; reason: string; replayed\?: boolean \};/,
- );
- assert.match(bridge, /err\.status === 409 \|\| err\.status === 404/);
- assert.match(bridge, /\.\.\.\(body\.replayed \? \{ replayed: true \} : \{\}\)/);
-});
-
-test("a server-side run starting for an open conversation attaches the view (working event, not just visibilitychange)", () => {
- assert.match(conversations, /if \(event\.state === "working"\) for \(const conv of live\) conv\.resumeIfIdle\(\);/);
-});
-
-test("resuming a tracked run pulls the transcript first so the triggering message is on screen", () => {
- const at = chat.indexOf("async function resumeTrackedRun");
- assert.ok(at >= 0);
- const body = chat.slice(at, chat.indexOf("agent.streamFn = makeRunResumeStreamFn", at));
- assert.match(body, /await refreshTranscriptFromEntries\(agent\);/);
-});
-
-const composer = readFileSync(new URL("../src/composer.ts", import.meta.url), "utf8");
-
-test("a message typed mid-turn is never dropped by the run-slot window — it queues through core", () => {
- // sendSteer's held-steer machinery (steerWhenLive/deliverSteer) is gone: mid-turn Enter now
- // queues via POST /api/turn regardless of run-slot state, so there is no submit window in
- // which a message can silently vanish. The queue path gates only on text and thread.
- const at = composer.indexOf("async function queueDraft");
- assert.ok(at >= 0);
- const body = composer.slice(at, composer.indexOf("async function enqueueTurn", at));
- assert.doesNotMatch(body, /hasLiveRun\(\)/, "queueing must not depend on the run slot");
- assert.match(body, /if \(\(!text && !staged\.length\) \|\| !threadRef\) return;/);
- assert.match(
- body,
- /if \(!\(await enqueueTurn\(agent, threadRef, text, uploaded, queuedFilesKey\(sendable\)\)\)\) \{\s*if \(stillHere\(\)\) restoreStagedOnFailure\(text, sendable, composerState\.error\);/,
- "a queue core never took goes back in the composer, files included",
- );
- assert.ok(composer.indexOf("function steerWhenLive") < 0, "the held-steer shim is gone with its window");
-});
-
-test("a failed steer keeps the durable queue and does not resubmit into a different conversation", () => {
- const at = composer.indexOf("async function steerQueued");
- const body = composer.slice(at, composer.indexOf("async function sendPrompt", at));
- assert.doesNotMatch(body, /enqueueTurn|withdrawRun/);
- assert.match(body, /Could not confirm steering/);
- assert.match(body, /if \(agent !== ctx\.chat\.state\.agent \|\| threadRef !== ctx\.chat\.state\.threadRef\) return/);
-});
-
-test("concurrent clicks share one in-flight steer", () => {
- const at = composer.indexOf("async function steerQueued");
- const body = composer.slice(at, composer.indexOf("async function sendPrompt", at));
- assert.ok(body.indexOf("pendingSteers.has(queued.runId)") < body.indexOf('signalLiveRun("steer"'));
- assert.match(body, /pendingSteers.add\(queued.runId\)/);
- assert.match(body, /finally \{\s*pendingSteers.delete\(queued.runId\)/);
-});
diff --git a/plugins/web-ui/test/sticky-prompt-occlusion.test.ts b/plugins/web-ui/test/sticky-prompt-occlusion.test.ts
deleted file mode 100644
index ea16edace..000000000
--- a/plugins/web-ui/test/sticky-prompt-occlusion.test.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-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("transcript containers and assistant responses remain unmasked", () => {
- const surfaces = /\.(?:chat-scroll|message-stack|assistant-row|assistant-body)(?:[.:][\w-]+)*\s*(?:,|$)/;
- const rules = [...css.matchAll(/([^{}]+)\{([^{}]*)\}/g)].filter((rule) => surfaces.test(rule[1]));
- assert.ok(rules.length > 0);
- for (const [, selector, declarations] of rules) {
- assert.doesNotMatch(declarations, /(?:mask-image|backdrop-filter):/, selector.trim());
- assert.doesNotMatch(declarations, /linear-gradient\(\s*to (top|bottom),\s*var\(--background\)/s, selector.trim());
- }
-});
diff --git a/plugins/web-ui/test/tab-archive-button.test.ts b/plugins/web-ui/test/tab-archive-button.test.ts
deleted file mode 100644
index 2df174bf4..000000000
--- a/plugins/web-ui/test/tab-archive-button.test.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const read = (f: string): string => readFileSync(new URL(`../src/${f}`, import.meta.url), "utf8");
-const split = read("split.ts");
-const sessions = read("sessions.ts");
-
-const fn = (src: string, name: string): string => {
- const body = src.match(new RegExp(`^(?:export )?(?:async )?function ${name}\\([\\s\\S]*?\\n\\}`, "m"))?.[0] ?? "";
- assert.ok(body, `${name} not found`);
- return body;
-};
-
-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", () => {
- const body = fn(sessions, "archiveSessionById");
- assert.match(body, /sessionsState\.list\.find/, "resolves the session from the live list");
- assert.match(body, /if \(s && !s\.archived\)/, "idempotent — never double-archives a listed session");
- assert.match(body, /setArchived\(s, true\);/, "reuses the one archive path (optimistic list patch + surface close)");
- assert.match(body, /closeSessionSurfaces\(sessionId\);/, "still closes the pane when the list can't help");
- assert.match(
- body,
- /if \(!s\) void persistSessionPatch\(sessionId, \{ archived: true \}\);/,
- "archives by id when the session is not in the list yet",
- );
-});
-
-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, /\.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/);
-});
diff --git a/plugins/web-ui/test/tab-switch-scroll-snap.test.ts b/plugins/web-ui/test/tab-switch-scroll-snap.test.ts
deleted file mode 100644
index 1c8429725..000000000
--- a/plugins/web-ui/test/tab-switch-scroll-snap.test.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const split = readFileSync(new URL("../src/split.ts", import.meta.url), "utf8");
-const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-
-test("shown panes start at the end after refreshing their density", () => {
- const handler = split.match(/onDidVisibilityChange\(\(e\) => \{[\s\S]*?\}\);/)?.[0] ?? "";
- assert.match(handler, /this\.conversation\?\.scrollToBottom\(\)/);
- assert.match(handler, /this\.syncDensity\(\)/, "shown panes still refresh their responsive presentation");
-});
-
-test("hidden tabs do not require attached transcript DOM", () => {
- assert.doesNotMatch(split, /defaultRenderer: "always"/);
- assert.doesNotMatch(split, /restoreTranscriptViewport/);
- assert.doesNotMatch(chat, /transcriptTop/);
-});
-
-test("showing a pane that is already its tile's active tab does not re-open it", () => {
- const fn = split.match(/function activatePanel\(panel: IDockviewPanel\): void \{[\s\S]*?\n\}/)?.[0] ?? "";
- assert.match(fn, /panel\.group\.activePanel === panel\) panel\.group\.api\.setActive\(\)/);
- const focus = split.match(/function focusPane\(paneId: string\): void \{[\s\S]*?\n\}/)?.[0] ?? "";
- assert.match(focus, /activatePanel\(panel\)/);
- assert.doesNotMatch(focus, /panel\.api\.setActive\(\)/);
-});
-
-test("responsive pane summaries do not replace the transcript scroller", () => {
- assert.match(chat, /glanceTier\s*\?\s*paneGlance\([^)]+\)\s*:\s*nothing[\s\S]*?<section class="chat-scroll"/);
- assert.doesNotMatch(
- chat,
- /glanceTier\s*\?\s*paneGlance\([^)]+\)\s*:\s*html`<section class="chat-scroll"/,
- "presentation changes must not destroy the element that owns scrollTop",
- );
-});
-
-test("hidden panes retain their last meaningful density, and every measure writes the attribute", () => {
- const fn = split.match(/private syncDensity\(\): void \{[\s\S]*?\n {2}\}/)?.[0] ?? "";
- assert.match(fn, /if \(!next\) return;/, "an unmeasurable pane keeps its last density");
- assert.doesNotMatch(
- fn,
- /next === this\.density\) return;/,
- "the DOM write must not be skipped when the measured tier equals the starting one",
- );
- const write = fn.indexOf("this.element.dataset.density");
- const gate = fn.indexOf("if (!changed) return;");
- assert.ok(write >= 0, "the tier is published to the DOM");
- assert.ok(
- gate > write,
- "only the redraw callbacks are gated on an actual change — a pane that mounts at its starting tier still gets the attribute",
- );
-});
-
-test("pane density still controls compact transcript spacing", () => {
- const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
- const block = css.match(/\[data-density="compact"\] \.chat-scroll \{[^}]*\}/)?.[0] ?? "";
- assert.match(block, /--chat-scroll-pad-top: 8px;/);
- assert.match(block, /padding: var\(--chat-scroll-pad-top\) var\(--chat-pad\) var\(--chat-scroll-pad-bottom\);/);
-});
diff --git a/plugins/web-ui/test/thinking-placement.test.ts b/plugins/web-ui/test/thinking-placement.test.ts
deleted file mode 100644
index 1acc13b66..000000000
--- a/plugins/web-ui/test/thinking-placement.test.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
-const composer = readFileSync(new URL("../src/composer.ts", import.meta.url), "utf8");
-
-test("thinking follows the transcript outside the composer", () => {
- const stack = chat.slice(chat.indexOf('<div class="message-stack'), chat.indexOf('<div class="chat-bottom-dock">'));
- assert.match(stack, /liveWorkStatus\(agent\)/);
- assert.ok(stack.indexOf("messageContent") < stack.indexOf("liveWorkStatus(agent)"));
- const dock = chat.slice(
- chat.indexOf('<div class="chat-bottom-dock">'),
- chat.indexOf("transcriptViewport.afterRender();"),
- );
- assert.doesNotMatch(dock, /liveWorkStatus/);
- assert.doesNotMatch(chat, /typingRow|work-thinking/);
- assert.doesNotMatch(css, /\.composer-wrap > \.live-work-status/);
-});
-
-test("model-unavailable composer retains the activity header and approvals", () => {
- assert.match(composer, /<div class="composer-wrap">\s*\$\{header\} \$\{composerApprovalPanel/);
-});
diff --git a/plugins/web-ui/test/transcript-type-scale.test.ts b/plugins/web-ui/test/transcript-type-scale.test.ts
deleted file mode 100644
index 54b4b2f5e..000000000
--- a/plugins/web-ui/test/transcript-type-scale.test.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-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 rules = [...css.matchAll(/([^{}]+)\{([^{}]*)\}/g)].map((m) => [m[1].trim(), m[2]] as const);
-const fontSizes = (selector: string): string[] =>
- rules
- .filter(([sel]) => sel === selector)
- .flatMap(([, body]) => [...body.matchAll(/font-size: ([^;]+);/g)].map((m) => m[1]));
-
-test("every chat context sets one transcript base size on the chat shell", () => {
- const bases = rules.flatMap(([sel, body]) =>
- [...body.matchAll(/--chat-font-size: (\d+)px/g)].map((m) => [sel, Number(m[1])]),
- );
- assert.deepEqual(bases, [
- [".custom-chat-shell", 15],
- [".split-canvas:not(.single-pane) .split-pane-chat .custom-chat-shell", 12],
- ["body.app-edit-embed .custom-chat-shell", 13],
- ]);
- assert.doesNotMatch(css, /\.split-pane-chat \.(?:assistant-body|message-bubble|message-stack) \{[^}]*font-size:/);
- assert.doesNotMatch(
- css,
- /body\.app-edit-embed \.assistant-body,\s*body\.app-edit-embed \.user-bubble \{[^}]*font-size:/,
- );
-});
-
-test("desktop text scales with the chat base, including thinking and work messages", () => {
- for (const selector of [".assistant-body", ".message-bubble", ".work-head", ".work-said", ".live-work-line"]) {
- assert.deepEqual(
- fontSizes(selector),
- ["max(min(12px, var(--chat-font-size)), calc(var(--chat-font-size) * var(--text-scale)))"],
- selector,
- );
- }
- for (const selector of [
- ".activity-group > .work-head",
- ".tool-row,\n.tool-row .tool-summary",
- ".stopped-head",
- ".thinking-summary",
- ".thinking-body",
- ".work-message",
- ]) {
- assert.deepEqual(
- fontSizes(selector),
- ["max(min(12px, calc(var(--chat-font-size) - 1px)), calc((var(--chat-font-size) - 1px) * var(--text-scale)))"],
- selector,
- );
- }
- assert.deepEqual(fontSizes(".thinking"), [
- "max(min(12px, calc(var(--chat-font-size) - 2px)), calc((var(--chat-font-size) - 2px) * var(--text-scale)))",
- ]);
-});
-
-test("inline code stays relative to the prose it sits in", () => {
- assert.match(
- css,
- /\.assistant-body :is\(markdown-block, qm-markdown\)\.markdown-content :not\(pre\) > code,\s*\.user-bubble :is\(markdown-block, qm-markdown\)\.markdown-content :not\(pre\) > code \{[^}]*font-size: 0\.92em;/,
- );
-});
diff --git a/plugins/web-ui/test/user-message-cap.test.ts b/plugins/web-ui/test/user-message-cap.test.ts
deleted file mode 100644
index 1fd974189..000000000
--- a/plugins/web-ui/test/user-message-cap.test.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-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 shared = readFileSync(new URL("../src/shared-session.ts", import.meta.url), "utf8");
-
-test("only the collapsed pinned prompt is capped and overflow clips instead of nesting scrollbars", () => {
- const bubble =
- css.match(
- /\.message-stack\s+\.user-row\.latest-prompt:not\(\.pin-expanded\)\s+\.user-bubble\s+>\s+\.pin-content \{[^}]*\}/,
- )?.[0] ?? "";
- assert.match(bubble, /-webkit-line-clamp: 6;/);
- assert.match(bubble, /overflow: hidden;/);
- assert.doesNotMatch(css, /\.user-bubble > (?:markdown-block|\.slack-wire-text)\s*\{/);
- const base = css.match(/\n\.user-bubble \{[^}]*\}/)?.[0] ?? "";
- assert.doesNotMatch(base, /max-height|flex/);
-});
-
-test("the scroller is the size container the cap measures", () => {
- assert.match(css, /\n\.chat-scroll \{[^}]*container-type: size;/);
- assert.match(css, /\n\.readonly-chat \.custom-chat-shell \{[^}]*flex-direction: column;/);
- assert.match(css, /\n\.readonly-chat \.chat-scroll \{[^}]*flex: 1;/);
- assert.doesNotMatch(chat, /--chat-viewport/);
-});
-
-test("user images have inline previews before and after persistence", () => {
- const fn = chat.match(/function userAttachmentBadge\([\s\S]*?\n {2}\}/)?.[0] ?? "";
- assert.match(fn, /artifactHref \?\? localContentUrl\(a\) \?\? dataUrl/);
- assert.match(fn, /href && browserRenderableImage\(a\.mimeType\)/);
- assert.match(fn, /<img src=\$\{href\} alt=\$\{a\.fileName\}/);
- assert.match(fn, /return chipBadge\(FileImage/);
-});
-
-test("shared images open the original through the inline endpoint", () => {
- assert.match(shared, /const inlineImage = sharedInlineImage\(file\.mimetype\)/);
- assert.match(shared, /if \(inlineImage\) \{/);
- assert.doesNotMatch(shared, /inlineImage && message.role/);
- assert.match(shared, /href=\$\{`\$\{href\}\?inline=1`\} target="_blank"/);
- assert.doesNotMatch(shared, /download=\$\{file.name\}/);
-});
-
-test("both transcript renderers provide an accessible control and an observable inner body", () => {
- for (const source of [chat, shared]) {
- assert.match(source, /pin-content/);
- assert.match(source, /class="pin-toggle" type="button" hidden aria-expanded="false"/);
- }
- assert.match(shared, /viewport\.sync\(document\.querySelector<HTMLElement>\("\.chat-scroll"\)\)/);
- assert.match(css, /\.deleted-bubble > \.pin-content > :not\(\.revision-badge\) \{\s*text-decoration: line-through;/);
-});
diff --git a/plugins/web-ui/test/work-fold-source.test.ts b/plugins/web-ui/test/work-fold-source.test.ts
deleted file mode 100644
index 89773b00b..000000000
--- a/plugins/web-ui/test/work-fold-source.test.ts
+++ /dev/null
@@ -1,104 +0,0 @@
-import assert from "node:assert/strict";
-import { readFileSync } from "node:fs";
-import test from "node:test";
-
-const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
-
-test("live and completed work keep chronological folds split around steering", () => {
- assert.match(chat, /class=\$\{stopped && last \? "stopped-work" : `work work-fold work-\$\{work.status\}`\}/);
- assert.match(chat, /messageWorkTimeline\(work, active \? "" : text\)/);
- assert.match(chat, /let label = last \? workLabel\(work\) : "Worked"/);
- assert.match(chat, /const animating = active && last && !stopping;/);
- assert.match(chat, /sheenLabel\(label, animating\)/);
- assert.match(chat, /\?open=\$\{last && \(active \|\| !!work.pendingApprovals\?\.length\)\}/);
- assert.doesNotMatch(chat, /function segmentSummaryLabel/);
-});
-
-test("the reply text is hidden only while the work fold is active, never for a finished-but-streaming turn", () => {
- assert.match(
- chat,
- /const workActive =\s*hasWork && isStreaming && !streamingFinal && \(work\?\.status === "working" \|\| work\?\.status === "thinking"\);/,
- );
- assert.match(chat, /assistantDisplayText\(workActive \? "" : text, message\.stopReason\)/);
- assert.doesNotMatch(chat, /isStreaming && hasWork && !streamingFinal \? ""/);
-});
-
-test("promoted speech keeps full reply styling", () => {
- assert.match(css, /\.work-said \{[\s\S]{0,200}?color: var\(--foreground\);/);
-});
-
-test("a demoted post-delivery self-log remains auditable but is omitted from the UI", () => {
- const bridge = readFileSync(new URL("../src/core-bridge.ts", import.meta.url), "utf8");
- assert.match(bridge, /payload: \{ text, demoted: true \}/);
- const timeline = readFileSync(new URL("../src/timeline.ts", import.meta.url), "utf8");
- assert.match(timeline, /!payload\?\.demoted/);
-});
-
-test("the fold chevron rotates when a work-fold is open", () => {
- assert.match(css, /\.work-fold\[open\] > summary > \.activity-chevron[\s\S]{0,160}?transform: rotate\(90deg\);/);
-});
-
-test("expanded tool activity uses a compact log rhythm", () => {
- assert.match(css, /\.work-divider \{[\s\S]{0,120}?margin: 8px 0 10px;/);
- assert.match(css, /\.work-rows \{[\s\S]{0,120}?gap: 2px;/);
- assert.match(
- css,
- /\.tool-row,[\s\S]{0,220}?font-size: max\(min\(12px, calc\(var\(--chat-font-size\) - 1px\)\), calc\(\(var\(--chat-font-size\) - 1px\) \* var\(--text-scale\)\)\);[\s\S]{0,80}?line-height: 1\.35;/,
- );
- assert.match(css, /\.tool-row \.tool-summary \{[\s\S]{0,80}?min-height: 26px;/);
- assert.match(chat, /icon\(rowIcon, 15\)/);
- assert.match(chat, /icon\(Wrench, 13\)/);
-});
-
-test("execution shows only its command while other tools disclose input and result", () => {
- assert.match(chat, /function toolDisclosure\(/);
- assert.match(chat, /const output = execution \? "" : toolPayloadText\(result\);/);
- assert.match(chat, /toolPayloadCard\(execution \? null : "Input", input,/);
- assert.match(chat, /toolPayloadCard\("Result", output,/);
- assert.match(chat, /<details\s+class="\$\{classes\} tool-expandable"/);
- assert.match(css, /\.tool-payload-body \{[\s\S]{0,300}?white-space: pre-wrap;/);
-});
-
-test("unknown tools retain their name and a useful identifying argument", () => {
- assert.match(chat, /function toolName\(/);
- assert.match(chat, /function genericToolDetail\(/);
- assert.match(chat, /"command",[\s\S]{0,240}?"database",[\s\S]{0,80}?"filter"/);
- assert.match(chat, /knownMeta \? meta\.done : name/);
-});
-
-test("thinking stays in sequence but is independently collapsible", () => {
- assert.match(chat, /<details class="thinking-row">/);
- assert.match(chat, /<summary class="thinking-summary">/);
- assert.match(css, /\.thinking-row\[open\] > \.thinking-summary > \.icon:last-child/);
-});
-
-test("dense activity rows let their icons carry repeated type labels", () => {
- assert.match(chat, /thinkingPresentation\(/);
- assert.match(chat, /activityLabel\(row, status\)/);
- assert.match(chat, /sessionText \?\? visible\}<\/span>/);
- assert.doesNotMatch(chat, />Thinking\$\{preview/);
- assert.doesNotMatch(chat, />\$\{label\}\$\{detail/);
-});
-
-test("activity previews use the row width before ellipsizing", () => {
- assert.match(chat, /function firstLine\(s: string, max\?: number\)/);
- assert.match(css, /\.tool-label \{[\s\S]{0,80}?flex: 1 1 auto;/);
- assert.match(css, /\.tool-label \{[\s\S]{0,180}?text-overflow: ellipsis;/);
-});
-
-test("stopped work shares posted reply rendering and shows one status without activity", () => {
- assert.match(chat, /workBlock\(work, false, "", "", true\)/);
- const block = chat.slice(chat.indexOf(" function workBlock("), chat.indexOf(" function approvalSummaryView("));
- assert.match(block, /postSpeechText\(item.row\)/);
- assert.match(block, /replies.map\(\(reply\) => html`<div class="streaming-text"/);
- assert.match(block, /if \(stopped && last && fold === nothing\) fold = html`<div class="stopped-head">/);
- assert.doesNotMatch(chat, /stopped-note|function stoppedWork/);
-});
-
-test("session rows preserve aggregate details and only render named target chips", () => {
- assert.match(chat, /session && sessionView\?\.chipTitle \? html/);
- assert.match(chat, /subagentChip\(sessionView.chipTitle, sessionView.sessionId\)/);
- assert.match(chat, /\[session.label, sessionDetail\].filter\(Boolean\).join\(" "\)/);
- assert.match(chat, /const sessionDetail = \[sessionView\?\.detail, session\?\.preview\]/);
-});