Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
0.8.0 polish: #476 and #478 frontend leftovers (#479)
Oleksandr Ivanchenko6d4ee708d230
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsxindex 04a9085d..03b82d2d 100644--- a/frontend/src/App.tsx+++ b/frontend/src/App.tsx@@ -3718,6 +3718,7 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({const inbox = <InboxPage tab={inboxTab} onTab={setInboxTab} count={awayCount + prepushWaiting} onBack={backToList} newPage={away} loosePage={loose} />;const chat = (<ChatView+ dropOff={!!spaceSettingsTab}title={chatTitle}subtitle={chatSubtitle}spaceName={space.name}diff --git a/frontend/src/attachments.ts b/frontend/src/attachments.tsindex 63808e1a..f1b652ef 100644--- a/frontend/src/attachments.ts+++ b/frontend/src/attachments.ts@@ -4,6 +4,12 @@ import { parseMetaObject } from './questions';export const MAX_ATTACHMENT_BYTES = 20 * 1024 * 1024;/** Videos (mp4, mov, webm) may be bigger; the server enforces the same caps by the file's bytes. */export const MAX_VIDEO_BYTES = 100 * 1024 * 1024;+/** Whole megabytes, as the limits are shown ("20 MB"). */+const wholeMb = (bytes: number) => `${Math.round(bytes / (1024 * 1024))} MB`;+/** The drop card's limits line, built from the caps so it can't drift from them (#478 L2). */+export const LIMITS_LINE = `Up to ${wholeMb(MAX_ATTACHMENT_BYTES)} each · videos ${wholeMb(MAX_VIDEO_BYTES)}`;+/** The paperclip's tooltip, from the same caps. */+export const ATTACH_TITLE = `Attach files (or drop / paste them here). Max ${wholeMb(MAX_ATTACHMENT_BYTES)} each, videos ${wholeMb(MAX_VIDEO_BYTES)}.`;export const MAX_ATTACHMENTS = 10;/** What a message's `meta.attachments` holds. */diff --git a/frontend/src/claudeVm.ts b/frontend/src/claudeVm.tsindex fc8b2e76..db95a3aa 100644--- a/frontend/src/claudeVm.ts+++ b/frontend/src/claudeVm.ts@@ -251,10 +251,11 @@ export const queuedVmText = (slots?: number): string =>/*** The open chat's "in line" sentence. Calm on purpose: a reply can wait about five minutes behind* two replies held on approval cards (qa-446 P-5b), so no timeout, no warning tone, no spinner.+ * A row that names the bot it waits for says that bot's name instead of "this bot" (#476 L6).*/-export const queuedText = (reason: 'agent_busy' | 'server_busy' | 'vm_busy', slots?: number): string =>+export const queuedText = (reason: 'agent_busy' | 'server_busy' | 'vm_busy', slots?: number, botName?: string): string =>reason === 'vm_busy'? queuedVmText(slots): reason === 'server_busy'? 'The server is running as many turns as it allows right now; this one starts as soon as a slot frees up.'- : 'Waiting for this bot’s other replies to finish.';+ : `Waiting for ${botName?.trim() ? `${botName.trim()}’s` : 'this bot’s'} other replies to finish.`;diff --git a/frontend/src/components/ChatView.tsx b/frontend/src/components/ChatView.tsxindex 003c0ce5..dadbfd4d 100644--- a/frontend/src/components/ChatView.tsx+++ b/frontend/src/components/ChatView.tsx@@ -52,8 +52,9 @@ import {uploadWithRetry,uploadRetryable,uploadSlotsLeft,+ ATTACH_TITLE,} from '../attachments';-import { DropRecipient, FOLDER_NOTE, dragHasFiles, dropAnnouncement, dropCard, modalOpen, previewDrag, splitDrop, windowDragWatch } from '../dragPreview';+import { DropRecipient, FOLDER_NOTE, dragHasFiles, dropAnnouncement, dropCard, leaveMs, modalOpen, previewDrag, splitDrop, windowDragWatch } from '../dragPreview';import { DropBot, DropLayer, DropPhase } from './DropLayer';import { EarlierCopies, FileTiles, UploadChip } from './Attachments';import { arrangeSharedFiles, botDisplayName, botOf, shareInfo } from '../sharedFiles';@@ -175,6 +176,11 @@ export interface RoutingState {}export interface ChatViewProps {+ /**+ * The chat is mounted but covered by a page (Settings): it isn't a drop target, so a file drag+ * shows the "Open a chat" pill instead of a layer nobody can see (#478 L4).+ */+ dropOff?: boolean;title: string;subtitle: string;/** The open space, for "Message #general in Work" and Laya's lines. */@@ -430,6 +436,7 @@ const useNarrow = () => {};export const ChatView: React.FC<ChatViewProps> = ({+ dropOff = false,title,subtitle,spaceName,@@ -539,7 +546,7 @@ export const ChatView: React.FC<ChatViewProps> = ({// pointer is over its column (header, list and composer, not a side pane).const dragWatch = windowDragWatch();const winDrag = useSyncExternalStore(dragWatch.subscribe, dragWatch.get, dragWatch.get);- useEffect(() => dragWatch.registerChat(), [dragWatch]);+ useEffect(() => (dropOff ? undefined : dragWatch.registerChat()), [dragWatch, dropOff]);const overDepth = useRef(0);const [overChat, setOverChat] = useState(false);// The window watch renders the armed card at sync priority; the pane's own over/refused change has to@@ -1578,7 +1585,7 @@ export const ChatView: React.FC<ChatViewProps> = ({: { recipient: { kind: 'channel', name: title }, single: false, bots: roomBots };// A modal open when the drag came in keeps the layer away (the Import dialog has its own drop zone).const modalUp = useMemo(() => winDrag.active && typeof document !== 'undefined' && modalOpen(document), [winDrag.active]);- const dragOn = winDrag.active && !modalUp;+ const dragOn = winDrag.active && !modalUp && !dropOff;const dropPreview = previewDrag(winDrag.items, uploads.length);const card = dropCard({ preview: dropPreview, recipient: dropTo.recipient, ideaMode });const livePhase: DropPhase | null = !dragOn ? null : overChat ? (card.state === 'refused' ? 'refused' : 'over') : 'armed';@@ -1589,7 +1596,8 @@ export const ChatView: React.FC<ChatViewProps> = ({setOverChat(false);}}, [winDrag.active]);- // The layer runs its exit after the drag ends: the landing (160 ms) after a drop, else a fade (100 ms).+ // The layer runs its exit after the drag ends: the landing (160 ms) after a drop, else a fade (100 ms;+ // 120 ms with reduced motion, which is how long that fade runs there, #478 L7).const lastCard = useRef(card);if (livePhase) lastCard.current = card;const landed = useRef(false);@@ -1608,7 +1616,7 @@ export const ChatView: React.FC<ChatViewProps> = ({const how = landed.current ? 'landing' : 'leaving';landed.current = false;setExiting(how);- const t = setTimeout(() => setExiting(null), how === 'landing' ? 160 : 100);+ const t = setTimeout(() => setExiting(null), how === 'landing' ? 160 : leaveMs());return () => clearTimeout(t);}, [livePhase]);// Spoken on state changes only, never on every dragover.@@ -1656,7 +1664,7 @@ export const ChatView: React.FC<ChatViewProps> = ({// Not flushed: the drop ends the drag anyway, and the exit must see `landed` first.overNow.current = false;setOverChat(false);- if (!inColumn(e.target) || modalUp) return;+ if (!inColumn(e.target) || modalUp || dropOff) return;// What the drop itself holds decides, the same way the card did (an ignored drop does nothing).const items = e.dataTransfer.items as unknown as ArrayLike<DataTransferItem>;const now = dropCard({ preview: previewDrag(items?.length ? items : winDrag.items, uploads.length), recipient: dropTo.recipient, ideaMode });@@ -1955,9 +1963,10 @@ export const ChatView: React.FC<ChatViewProps> = ({{/* A held reply is being decided: the line stands in for the streamed draft and the consults */}{deciding && <DecidingLine botName={deciding.botName} consulted={deciding.consulted} />}- {/* P6: turns waiting behind the held reply stay visible while the team decides (under the line, aligned with its card) */}+ {/* P6: turns waiting behind the held reply stay visible while the team decides (under the line, aligned with its card).+ !mt-2 beats the list's space-y-5/6, so the line sits 8 px under the card as it does under a reply (#476 L7). */}{(deciding || (isStreaming && routingState?.phase === 'deciding')) && !queued && (queuedBeside?.length ?? 0) > 0 && (- <div className="w-full max-w-5xl pl-12" data-queued-beside-deciding="">+ <div className="w-full max-w-5xl pl-12 !mt-2" data-queued-beside-deciding=""><div className="max-w-4xl"><QueuedBeside items={queuedBeside} /></div>@@ -2332,7 +2341,7 @@ export const ChatView: React.FC<ChatViewProps> = ({type="button"onClick={() => fileInputRef.current?.click()}disabled={uploadSlotsLeft(uploads) === 0}- title={uploadSlotsLeft(uploads) === 0 ? `Up to ${MAX_ATTACHMENTS} files per message` : 'Attach files (or drop / paste them here). Max 20 MB each, videos 100 MB.'}+ title={uploadSlotsLeft(uploads) === 0 ? `Up to ${MAX_ATTACHMENTS} files per message` : ATTACH_TITLE}aria-label="Attach files"className={`${phone ? toolPhone : 'w-11 h-11 sm:w-9 sm:h-9 text-zinc-300 hover:text-zinc-50 hover:bg-white/[0.08] focus-visible:outline-sky-400'} rounded-xl flex items-center justify-center flex-shrink-0 disabled:opacity-40 disabled:cursor-not-allowed transition-colors focus-visible:outline focus-visible:outline-2`}>diff --git a/frontend/src/components/DropLayer.tsx b/frontend/src/components/DropLayer.tsxindex a876c9c3..9c6eebc6 100644--- a/frontend/src/components/DropLayer.tsx+++ b/frontend/src/components/DropLayer.tsx@@ -6,7 +6,8 @@ import React, { useEffect, useRef, useState, useSyncExternalStore } from 'react'import { AlertTriangle, Ban, File as FileIcon, FileText, Film, Image as ImageIcon, MessageSquare, Users } from 'lucide-react';import { ModernAvatar } from './ModernAvatar';import type { DropCardModel, Heading, KindPart } from '../dragPreview';-import { PILL_TEXT, modalOpen, windowDragWatch } from '../dragPreview';+import { PILL_TEXT, leaveMs, modalOpen, windowDragWatch } from '../dragPreview';+import { LIMITS_LINE } from '../attachments';export type DropPhase = 'armed' | 'over' | 'refused' | 'landing' | 'leaving';@@ -128,7 +129,7 @@ export const DropLayer: React.FC<DropLayerProps> = ({ phase, card, single, bots,))}</p>)}- <p className="kw-dd-lim">Up to 20 MB each · videos 100 MB</p>+ <p className="kw-dd-lim" data-drop-limits>{LIMITS_LINE}</p>{card.wont.length > 0 && (<div className="kw-dd-wont" data-drop-warning>{card.wont.map((w) => (@@ -174,7 +175,7 @@ export const DropPillHost: React.FC = () => {if (!was.current) return;was.current = false;setLeaving(true);- const t = setTimeout(() => setLeaving(false), 100);+ const t = setTimeout(() => setLeaving(false), leaveMs());return () => clearTimeout(t);}, [want]);return (diff --git a/frontend/src/components/QueuedBeside.tsx b/frontend/src/components/QueuedBeside.tsxindex 5fd4cb79..4b190b38 100644--- a/frontend/src/components/QueuedBeside.tsx+++ b/frontend/src/components/QueuedBeside.tsx@@ -10,7 +10,9 @@ import type { QueuedState } from './ChatView';* The reason sentence is said once: a row repeats it only when its reason, slots or named bot differ* from the row above ("#2 in line." alone otherwise). In a room, a turn waiting for a different bot* than the one replying leads with that bot's name, so "this bot" never points at the wrong one.- * The list is one polite live region; its rows stay plain list items.+ * The list is one polite live region (aria-live only: a status role would replace its list role and+ * leave the rows without a list, #476 L5); its rows stay plain list items. A named row says whose+ * other replies it waits for (#476 L6).*/export function QueuedBeside({ items }: { items?: QueuedState[] }) {if (!items || items.length === 0) return null;@@ -18,7 +20,6 @@ export function QueuedBeside({ items }: { items?: QueuedState[] }) {<ulclassName="mt-2 flex flex-col gap-1 w-full"data-queued-beside=""- role="status"aria-live="polite"aria-label="Waiting to start">@@ -32,7 +33,7 @@ export function QueuedBeside({ items }: { items?: QueuedState[] }) {<span className="mt-[5px] w-1.5 h-1.5 rounded-full bg-zinc-500 shrink-0" aria-hidden="true" /><span className="min-w-0"><strong className="font-medium text-zinc-200">{q.named ? `${q.speaker} · ${place}` : place}</strong>- {!sameAsAbove && <> {queuedText(q.reason, q.slots)}</>}+ {!sameAsAbove && <> {queuedText(q.reason, q.slots, q.named ? q.speaker : undefined)}</>}</span></li>);diff --git a/frontend/src/dragPreview.ts b/frontend/src/dragPreview.tsindex a7564112..e05aafdc 100644--- a/frontend/src/dragPreview.ts+++ b/frontend/src/dragPreview.ts@@ -472,5 +472,17 @@ export const windowDragWatch = (): DragWatch =>{ addEventListener() {}, removeEventListener() {}, setTimeout: (f: () => void, ms?: number) => setTimeout(f, ms) as unknown as number, clearTimeout: (t?: number) => clearTimeout(t) },));-/** True when a modal dialog is open: the chat's drop layer never shows over one (design §1). */-export const modalOpen = (doc: Document = document) => !!doc.querySelector('[aria-modal="true"], [role="alertdialog"], dialog[open]');+/**+ * True when a modal dialog is open: the chat's drop layer never shows over one (design §1). The+ * phone's full-screen Settings is a modal too, but it's a page, not a dialog with its own drop zone:+ * it gets the "Open a chat" pill like any page without a chat (#478 L4).+ */+export const modalOpen = (doc: Document = document) =>+ !!doc.querySelector('[aria-modal="true"]:not([data-space-settings]), [role="alertdialog"], dialog[open]');++/**+ * How long a drop layer or pill stays mounted for its leave fade: 100 ms, or 120 ms with reduced+ * motion, where dropLayer.css fades it in 120 ms (#478 L7).+ */+export const leaveMs = (reduce: boolean = typeof window !== 'undefined' && !!window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) =>+ reduce ? 120 : 100;diff --git a/frontend/src/styles/dropLayer.css b/frontend/src/styles/dropLayer.cssindex f218645b..4b69686c 100644--- a/frontend/src/styles/dropLayer.css+++ b/frontend/src/styles/dropLayer.css@@ -51,7 +51,7 @@.kw-dd-heading { font-size: 18px; line-height: 24px; font-weight: 600; color: #f5f4fb; letter-spacing: -0.01em; text-wrap: balance; }.kw-dd-what { margin-top: 6px; font-size: 13px; line-height: 18px; color: #c9c5e6; font-variant-numeric: tabular-nums; }.kw-dd-kind { display: inline-flex; align-items: center; gap: 4px; color: #e2dff5; }-.kw-dd-lim { margin-top: 4px; font-size: 11px; line-height: 16px; color: #8d87b8; }+.kw-dd-lim { margin-top: 4px; font-size: 11px; line-height: 16px; color: #8d87b8; text-wrap: balance; }.kw-dd-wont { margin-top: 14px; text-align: left; border-radius: 10px; border: 1px solid rgb(252 211 77 / 0.28); background: rgb(252 211 77 / 0.08); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }.kw-dd-wont > div { display: flex; gap: 8px; font-size: 12px; line-height: 17px; color: #fde68a; }.kw-dd-refuse { margin-top: 8px; display: inline-flex; gap: 6px; font-size: 13px; line-height: 18px; color: #fda4af; text-align: left; }@@ -61,7 +61,7 @@.kw-dd[data-phase='armed'] .kw-dd-veil { background: rgb(18 14 38 / 0.55); }.kw-dd[data-phase='armed'] .kw-dd-frame { box-shadow: inset 0 0 0 1.5px rgb(157 143 255 / 0.3); transition-duration: 120ms; }.kw-dd[data-phase='armed'] .kw-dd-corner { fill: #6c58e0; }-.kw-dd[data-phase='armed'] .kw-dd-card { transform: scale(0.96); opacity: 0.82; border-color: rgb(157 143 255 / 0.2); box-shadow: 0 24px 64px rgb(0 0 0 / 0.45); transition-duration: 120ms; }+.kw-dd[data-phase='armed'] .kw-dd-card { transform: scale(0.96); opacity: 0.94; border-color: rgb(157 143 255 / 0.2); box-shadow: 0 24px 64px rgb(0 0 0 / 0.45); transition-duration: 120ms; }.kw-dd[data-phase='armed'] .kw-dd-one { box-shadow: 0 0 0 2px #231b4d, 0 0 0 4px rgb(157 143 255 / 0.35); }.kw-dd[data-phase='armed'] .kw-dd-count { animation: none; }/* A -> B: the avatar hops and the badge pops */diff --git a/frontend/tests/dragDropPane.test.mjs b/frontend/tests/dragDropPane.test.mjsindex 02cfcd22..85ffd4a7 100644--- a/frontend/tests/dragDropPane.test.mjs+++ b/frontend/tests/dragDropPane.test.mjs@@ -7,6 +7,7 @@ import assert from 'node:assert/strict';import test from 'node:test';import { JSDOM } from 'jsdom';import { loadBundled } from './bundle.mjs';+import { readFileSync } from 'node:fs';const dom = new JSDOM('<!doctype html><html><body></body></html>', { url: 'http://localhost/', pretendToBeVisual: true });for (const k of ['window', 'document', 'navigator', 'HTMLElement', 'HTMLButtonElement', 'HTMLInputElement', 'HTMLTextAreaElement', 'Element', 'Node', 'Event', 'KeyboardEvent', 'FocusEvent', 'MutationObserver', 'requestAnimationFrame', 'cancelAnimationFrame', 'getComputedStyle', 'CSS', 'DOMException']) {@@ -495,3 +496,65 @@ test('no chat open: the "Open a chat" pill shows and is read out; with a chat opawait endDrag();}});++test('Settings open over the chat: the drag shows the "Open a chat" pill, not a hidden layer, and a drop adds nothing (#478 L4)', async () => {+ const p = ui.mountPill();+ // Settings covers the chat but the chat stays mounted under it (App passes dropOff).+ const v = ui.mount(props({ dropOff: true }));+ const side = elsewhere();+ try {+ const { list } = parts(v.host);+ await fire(side, 'dragenter', dataTransfer([mkFile('a.png')]));+ assert.equal(!!layer(v.host), false, 'no layer under Settings');+ assert.equal(p.host.querySelector('[data-drop-pill]')?.textContent, 'Open a chat to drop files there');+ assert.equal(p.host.querySelector('[data-drop-pill-announce]').textContent, 'Open a chat to drop files there.');+ // Even a drop that reaches the covered chat is not taken.+ await fire(list, 'dragenter', dataTransfer([mkFile('a.png')]));+ assert.equal(!!layer(v.host), false);+ await fire(list, 'drop', dataTransfer([mkFile('a.png')]));+ assert.equal(chips(v.host), 0, 'nothing added');+ await endDrag();++ // The phone's Settings is a full-screen modal page: it still gets the pill. A real dialog does not.+ const settings = document.createElement('div');+ settings.setAttribute('role', 'dialog');+ settings.setAttribute('aria-modal', 'true');+ settings.setAttribute('data-space-settings', '');+ document.body.appendChild(settings);+ await fire(side, 'dragenter', dataTransfer([mkFile('a.png')]));+ assert.equal(!!p.host.querySelector('[data-drop-pill]'), true, 'pill over the phone Settings page');+ await endDrag();+ const dialog = document.createElement('div');+ dialog.setAttribute('aria-modal', 'true');+ settings.appendChild(dialog);+ await fire(side, 'dragenter', dataTransfer([mkFile('a.png')]));+ assert.equal(!!p.host.querySelector('[data-drop-pill]'), false, 'a dialog opened from Settings keeps it away');+ settings.remove();+ } finally {+ side.remove();+ v.unmount();+ p.unmount();+ await endDrag();+ }+ // The app turns the chat's drop target off while Settings is open.+ const app = readFileSync(new URL('../src/App.tsx', import.meta.url), 'utf8');+ const at = app.indexOf('<ChatView');+ assert.ok(app.slice(at, app.indexOf('/>', at)).includes('dropOff={!!spaceSettingsTab}'), 'App passes dropOff');+});++test('the limits line is built from the caps, in the same words (#478 L2)', async () => {+ const v = ui.mount(props());+ try {+ await fire(parts(v.host).list, 'dragenter', dataTransfer([mkFile('a.png')]));+ assert.equal(v.host.querySelector('[data-drop-limits]')?.textContent, 'Up to 20 MB each · videos 100 MB');+ const clip = v.host.querySelector('button[aria-label="Attach files"]');+ assert.equal(clip.getAttribute('title'), 'Attach files (or drop / paste them here). Max 20 MB each, videos 100 MB.');+ } finally {+ v.unmount();+ await endDrag();+ }+ for (const f of ['../src/components/DropLayer.tsx', '../src/components/ChatView.tsx']) {+ const src = readFileSync(new URL(f, import.meta.url), 'utf8');+ assert.ok(!/\b(20|100) MB\b/.test(src.replace(/\/\/.*$|\/\*[\s\S]*?\*\//gm, '')), `${f} types no size limit`);+ }+});diff --git a/frontend/tests/dragPreview.test.mjs b/frontend/tests/dragPreview.test.mjsindex 310dc316..b7627d3e 100644--- a/frontend/tests/dragPreview.test.mjs+++ b/frontend/tests/dragPreview.test.mjs@@ -304,3 +304,54 @@ test('the Mac and Windows place window hands drops to the page', () => {assert.match(body, /\.disable_drag_drop_handler\(\)/);assert.equal(rs.match(/disable_drag_drop_handler/g).length, 1, 'only the place window; connect and nudge keep Tauri\'s');});++// #478 polish (Mira's ui-check-478 round 2 and Rigel's qa-478).+const css = readFileSync(new URL('../src/styles/dropLayer.css', import.meta.url), 'utf8');+const rule = (sel, from = css) => {+ const at = from.indexOf(sel + ' {');+ assert.ok(at >= 0, sel);+ return from.slice(at, from.indexOf('}', at));+};++test('the armed card is .94 opaque, so chat text does not show through (#478 L5)', () => {+ assert.match(rule(".kw-dd[data-phase='armed'] .kw-dd-card"), /opacity: 0\.94;/);+});++test('the limits line balances its wrap, so "100 MB" never sits alone (#478 L6)', () => {+ assert.match(rule('.kw-dd-lim'), /text-wrap: balance;/);+});++test('reduced motion: the leave timeout matches the 120 ms fade; elsewhere it stays 100 ms (#478 L7)', () => {+ const reduced = css.slice(css.indexOf('@media (prefers-reduced-motion: reduce)'));+ const fade = Number(rule(".kw-dd[data-phase='leaving'], .kw-dd[data-phase='landing']", reduced).match(/opacity (\d+)ms/)[1]);+ const pillFade = Number(rule('.kw-dd *, .kw-dd-pill', reduced).match(/transition-duration: (\d+)ms/)[1]);+ assert.equal(d.leaveMs(true), fade);+ assert.equal(d.leaveMs(true), pillFade);+ assert.equal(d.leaveMs(false), Number(rule(".kw-dd[data-phase='leaving']").match(/opacity (\d+)ms/)[1]));+ const was = globalThis.window;+ globalThis.window = { matchMedia: (q) => ({ matches: q === '(prefers-reduced-motion: reduce)' }) };+ try {+ assert.equal(d.leaveMs(), 120, 'reads the setting by default');+ } finally {+ globalThis.window = was;+ }+ // Both exits use it: the chat's layer fade and the "Open a chat" pill.+ const chat = readFileSync(new URL('../src/components/ChatView.tsx', import.meta.url), 'utf8');+ const layer = readFileSync(new URL('../src/components/DropLayer.tsx', import.meta.url), 'utf8');+ assert.match(chat, /setTimeout\(\(\) => setExiting\(null\), how === 'landing' \? 160 : leaveMs\(\)\)/);+ assert.match(layer, /setTimeout\(\(\) => setLeaving\(false\), leaveMs\(\)\)/);+});++test('the phone\'s Settings page is not a dialog that keeps the pill away; other modals still are (#478 L4)', () => {+ const doc = (html) => ({ querySelector: (sel) => (sel.split(/,\s*/).some((s) => matches(html, s)) ? {} : null) });+ // A tiny stand-in for querySelector over one element.+ const matches = (attrs, s) => {+ if (s === '[aria-modal="true"]:not([data-space-settings])') return attrs.modal && !attrs.settings;+ if (s === '[aria-modal="true"]') return !!attrs.modal;+ if (s === '[role="alertdialog"]') return attrs.role === 'alertdialog';+ return false;+ };+ assert.equal(d.modalOpen(doc({ modal: true, settings: true })), false);+ assert.equal(d.modalOpen(doc({ modal: true })), true);+ assert.equal(d.modalOpen(doc({ role: 'alertdialog' })), true);+});diff --git a/frontend/tests/queuedBesideRunning.test.mjs b/frontend/tests/queuedBesideRunning.test.mjsindex 0d774823..03d665ee 100644--- a/frontend/tests/queuedBesideRunning.test.mjs+++ b/frontend/tests/queuedBesideRunning.test.mjs@@ -12,6 +12,7 @@ const m = await loadBundled(`import { renderToStaticMarkup } from 'react-dom/server.browser';import { QueuedBeside } from './src/components/QueuedBeside';export * from './src/threads';+ export { queuedText } from './src/claudeVm';export const draw = (items) => renderToStaticMarkup(React.createElement(QueuedBeside, { items }));`);@@ -34,7 +35,7 @@ test('one running and one queued turn in the same chat: both show, the queued onassert.equal(q.alone, null, 'the running reply keeps the live bubble');assert.deepEqual(q.beside.map((x) => x.turn_id), ['q1'], 'the waiting turn is not hidden');const html = besideHtml(s, 'pixel');- assert.match(html, /role="status"/);+ assert.match(html, /aria-live="polite"/);assert.ok(html.includes('#1 in line.'), html);assert.ok(html.includes(WAIT), html);@@ -123,8 +124,10 @@ test('M2: in a room, a turn waiting for another bot leads with its name; the repconst html = m.draw(items);assert.ok(html.includes('Scout · #1 in line.'), html);assert.ok(!html.includes('Marketer ·'), 'the replying bot\'s own wait is not named');- // Different bots: each row says its own sentence, so "this bot" sits next to the right name.- assert.equal(html.split(WAIT).length - 1, 2, html);+ // Different bots: each row says its own sentence. The named row names its bot (#476 L6); the+ // replying bot's own row keeps "this bot".+ assert.ok(html.includes('Scout · #1 in line.</strong> Waiting for Scout’s other replies to finish.'), html);+ assert.equal(html.split(WAIT).length - 1, 1, html);// A one-bot chat looks as before: no name.const one = runningPlusQueued();@@ -144,9 +147,33 @@ test('S1: the waiting line also shows while "Team is deciding…" stands in forassert.ok(chat.slice(block, chat.indexOf('</div>', block)).includes('<QueuedBeside items={queuedBeside} />'));});-test('S2: one polite live region on the list; the rows stay plain list items', () => {+test('S2: one polite live region on the list; the list keeps its list role and the rows stay plain list items (#476 L5)', () => {const html = besideHtml(runningPlusQueued(), 'pixel');- assert.match(html, /^<ul[^>]*role="status"[^>]*aria-live="polite"/);+ assert.match(html, /^<ul[^>]*aria-live="polite"/);+ // A role on the <ul> (status) replaces its list role, and the rows lose their list parent (axe).+ assert.ok(!/^<ul[^>]*\srole=/.test(html), html);assert.match(html, /<li class="[^"]*">/);assert.ok(!/<li[^>]*role=/.test(html), html);});++test('L6: a named row says whose other replies it waits for; unnamed rows keep "this bot" (#476)', () => {+ assert.equal(m.queuedText('agent_busy', undefined, 'Scout'), 'Waiting for Scout’s other replies to finish.');+ assert.equal(m.queuedText('agent_busy'), WAIT);+ assert.equal(m.queuedText('agent_busy', undefined, ' '), WAIT, 'a blank name is no name');+ // Two rows for the same named bot: the sentence is said once, with the name.+ const html = m.draw([+ { position: 1, reason: 'agent_busy', speaker: 'Scout', named: true, turnId: 'a' },+ { position: 2, reason: 'agent_busy', speaker: 'Scout', named: true, turnId: 'b' },+ { position: 3, reason: 'agent_busy', speaker: 'Scout', named: false, turnId: 'c' },+ ]);+ assert.equal(html.split('Waiting for Scout’s other replies to finish.').length - 1, 1, html);+ assert.equal(html.split(WAIT).length - 1, 1, html);+});++test('L7: under "Team is deciding…" the waiting line sits 8 px below the card, over the list\'s space-y gap (#476)', () => {+ const chat = readFileSync(new URL('../src/components/ChatView.tsx', import.meta.url), 'utf8');+ const at = chat.indexOf('data-queued-beside-deciding');+ const open = chat.lastIndexOf('<div', at);+ const cls = chat.slice(open, at).match(/className="([^"]*)"/)?.[1] ?? '';+ assert.ok(cls.split(/\s+/).includes('!mt-2'), cls);+});