Public: anyone can read this; the crew can change it.

Talk calls the Do it card a confirm, and fixes the designer's six: the list in its column, one last line, Display as a dialog, tables that scroll, Pause in its own strip, a useful empty pane #16299

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

talk/look-7-six-rename → main 0 commits

  • Merged. talk/look-7-six-rename was merged into main as ac3083b.

Review

Sign in to review this change.
14 files changed +241 −140
docs/design/areas/talk.md +5 −3
@@ -8,7 +8,6 @@
88 - `.talk-person` — the person's words: right-aligned, a quiet bubble (`--muted` surface, 18px radius), pre-wrapped; the time under it.
99 - `.talk-agent` — the agent's reply, markdown, full width, no bubble; its time, cost and actions show only under the last block of a reply.
1010 - `.talk-tool` — what the agent did, one muted small line.
11 - `.talk-confirm` — a held action: the sentence, then Do it and Not now at 44px high.
1211 - `.talk-compose` — the composer, sticky to the bottom of the viewport above the keyboard (padded for the phone's safe area), faded into the page above it; on an empty conversation it sits under the greeting instead.
1312 - `.talk-status` — one polite line (sending, answering, an error); it always takes its line, so nothing shifts.
1413 - `.talk-more` — the "Earlier" link above the log.
@@ -127,7 +126,10 @@ Prior art: Claude and ChatGPT (one centred column, the person's words in a quiet
127126 - `.talk-work-line`: under a receipt that names an issue, what the crew is doing on it now (queued, working for how long, the pull it pushed and its checks, waiting for you, landed), a live region swapped from `/live/talk-work`.
128127 - `.talk-to`: the line above the composer's field while its words go to an issue (Reply on a receipt): to whom, and the way back to the forge.
129128 - `.talk-when`: a turn's or receipt's time, said quietly; in a receipt's line it stands apart from the title, as the time does in a reply's last row.
130 - `.talk-asks`, `.talk-asks-count`, `.talk-ask-list`: the dock directly above the composer holding what waits on the person (held actions): always in view, never in the thread; several read as a count and a stack, the first open, never taller than a third of the screen.
131 - `.talk-ask`, `.talk-ask-does`, `.talk-ask-left`, `.talk-ask-acts`: one ask: the engine's sentence of what will happen, the time left only under two minutes, Do it and a quiet Not now. Answered, it collapses out of the dock.
129 - `.talk-confirms`, `.talk-confirms-count`, `.talk-confirm-list`: the dock directly above the composer holding what waits on the person (confirms): always in view, never in the thread; several read as a count and a stack, the first open, never taller than a third of the screen.
130 - `.talk-confirm`, `.talk-confirm-does`, `.talk-confirm-left`, `.talk-confirm-acts`: one confirm: the engine's sentence of what will happen, the time left only under two minutes, Do it and a quiet Not now. Answered, it collapses out of the dock.
132131 - `.talk-code`, `.talk-code-changed`, `.talk-code-files`, `.talk-code-tree`, `.talk-code-file`, `.talk-code-n`, `.talk-code-add`, `.talk-code-del`: the pane's Code tab: the files this conversation changed (with what each added and removed) above the repository's own explorer tree at the conversation's branch; a file opens in the pane from the blob page's fragment, with the way back to the files.
133132 - `.talk-diff`, `.talk-diff-head`, `.talk-diff-versions`, `.talk-diff-pull`: the pane's Diff tab: which change (all, or one version), the totals, the pull as a quiet link with its checks in words, then the forge's own diff, each file folded open inline.
133 - `.talk-display-sheet`: Display as its own small dialog from the conversation menu, every choice in view; without the script it stays a disclosure in the menu.
134 - `.talk-links`: what a reply opened or changed, folded behind its count ("3 files") on the reply's one last line, each file by its path in its repository.
135 - `.talk-stage-files`: before a first version, the pane says what will appear and when, and shows the files the app starts from.
docs/design/size-budget.json +2 −2
@@ -68,8 +68,8 @@
6868 "css": 48384
6969 },
7070 "/talk": {
71 "js": 37632,
72 "css": 53760
71 "js": 37888,
72 "css": 54528
7373 },
7474 "/:owner/:name/pulls/:number": {
7575 "js": 32000,
docs/features/talk.md +5 −5
@@ -136,7 +136,7 @@ A reply is drawn by the README renderer and then, for Talk alone, by `linkTalk`
136136
137137 An agent reply is Markdown, drawn on the server by the same renderer as a README: fenced code is highlighted, tables and links render, and everything else is escaped (a `<script>` in a reply shows as text). A table wider than the column scrolls inside it; the page does not. The reply sits in the column like a person's turn, with none of the README's padding or line measure.
138138
139 A reply grows in one live element while it is written (see "Live") and is then stored as one finished turn; the page only appends a turn whose id it has not drawn (a repeat is ignored). Turns already on the page are not touched, so nothing above a new reply moves, and the page follows the end only if you were already there (otherwise "Latest" appears). An unfinished fence in a stored reply is closed for drawing. The page's own bytes are held by a test (`test/talk-page.test.ts`): the stylesheet under 16,900 B, the script under 42,300 B, and a page with a code reply under 49,500 B (its own page: one question and a code reply; the widgets' rules ride every page, so a chart drawn in a live reply is styled at once).
139 A reply grows in one live element while it is written (see "Live") and is then stored as one finished turn; the page only appends a turn whose id it has not drawn (a repeat is ignored). Turns already on the page are not touched, so nothing above a new reply moves, and the page follows the end only if you were already there (otherwise "Latest" appears). An unfinished fence in a stored reply is closed for drawing. The page's own bytes are held by a test (`test/talk-page.test.ts`): the stylesheet under 18,000 B, the script under 43,500 B, and a page with a code reply under 50,000 B (its own page: one question and a code reply; the widgets' rules ride every page, so a chart drawn in a live reply is styled at once).
140140
141141 ## Following
142142
@@ -207,15 +207,15 @@ A receipt is one calm line in the thread: a check, what was done and its link, t
207207
208208 **In the terminal** a conversation keeps a receipt that names an issue in view (never folded with steps), with the same work line under it, and `c` comments on that issue through the same `addCommentThrough`.
209209
210 ## Asks wait above the composer (#15734)
210 ## Confirms wait above the composer (#15734)
211211
212 A held action (one that asks before it acts) is never drawn in the scrolled thread, where a long reply could push it off screen. It waits in a dock directly above the composer, always in view: the engine's one sentence of what will happen and to what, **Do it**, and a quiet **Not now**, with the time left only when under two minutes. Several read as "2 waiting" and a stack, the first open and the rest one line each; the stack never grows past a third of the screen and scrolls inside itself beyond that. The dock is part of the composer, so the thread's end stays clear of it and following holds; its buttons come before the box in the Tab order, Enter on Do it answers, and Escape is never Not now. A new ask is said once, politely.
212 A confirm (an action held for the person's yes) is never drawn in the scrolled thread, where a long reply could push it off screen. It waits in a dock directly above the composer, always in view: the engine's one sentence of what will happen and to what, **Do it**, and a quiet **Not now**, with the time left only when under two minutes. Several read as "2 waiting" and a stack, the first open and the rest one line each; the stack never grows past a third of the screen and scrolls inside itself beyond that. The dock is part of the composer, so the thread's end stays clear of it and following holds; its buttons come before the box in the Tab order, Enter on Do it answers, and Escape is never Not now. A new confirm is said once, politely.
213213
214 Its buttons belong to the composer's form and post to the confirm's own address (`formaction`), so the dock works without the script. Answered, the ask collapses out of the dock (instantly where motion is reduced) and its outcome arrives in the thread where it happened: the receipt for Do it, or "Not now: nothing was done." Only an ask that ran out says so in the thread, with Ask again.
214 Its buttons belong to the composer's form and post to the confirm's own address (`formaction`), so the dock works without the script. Answered, the confirm collapses out of the dock (instantly where motion is reduced) and its outcome arrives in the thread where it happened: the receipt for Do it, or "Not now: nothing was done." Only a confirm that ran out says so in the thread, with Ask again.
215215
216216 **Things done fold:** a run of receipts and steps in one reply reads as one line with a check, "2 things done, 3 steps", opening to the list; one receipt alone stays as itself. Proof: `test/talk-page.test.ts`, `test/talk-live.test.ts`.
217217
218 **In the terminal** an ask still waiting is never in the scrolled thread either: it waits at the foot of the conversation with its sentence, and `a` opens Confirms, where `y` does it and `n` says not now.
218 **In the terminal** a confirm still waiting is never in the scrolled thread either: it waits at the foot of the conversation with its sentence, and `a` opens Confirms, where `y` does it and `n` says not now.
219219
220220 ## The pane's Code and Diff (#15734)
221221
src/tui/screens/talk_chats.ts +1 −1
@@ -52,7 +52,7 @@ import { fresh, mayAct, pressCard, PRESS_REFUSED } from "../../actions/talk_act.
5252
5353 const BAD_TITLE = `A title is up to ${TITLE_MAX} characters, on one line.`;
5454
55 const WHO: Readonly<Record<string, string>> = { person: "You", agent: "Forge", tool: "Tool", confirm: "Asks" };
55 const WHO: Readonly<Record<string, string>> = { person: "You", agent: "Forge", tool: "Tool", confirm: "Confirm" };
5656
5757 /**
5858 * The person's conversation as the Markdown the page's /talk/:id/download serves; none when it is
src/web/pages/talk.ts +28 −20
@@ -131,13 +131,13 @@ const parse = (text: string): Record<string, unknown> | undefined => {
131131 * own address (`formaction`), so the dock needs no form of its own and works without the script.
132132 * A result shown once is answered in Settings → Confirms, which draws it there.
133133 */
134 export function askItem(id: string, tool: string, does: string, expiresAt: string, shown = ""): Html {
134 export function confirmItem(id: string, tool: string, does: string, expiresAt: string, shown = ""): Html {
135135 const once = ASKING[tool]?.once !== undefined;
136 return html`<div class="talk-ask" id="ask-${id}" data-ask="${id}" data-expires="${expiresAt}">
137 <p class="talk-ask-does">${does}</p>
136 return html`<div class="talk-confirm" id="confirm-${id}" data-confirm-id="${id}" data-expires="${expiresAt}">
137 <p class="talk-confirm-does">${does}</p>
138138 ${shown === "" ? null : html`<details><summary>Everything it will send</summary><pre>${shown}</pre></details>`}
139 <p class="talk-ask-left small muted">${WAITS}</p>
140 <div class="talk-ask-acts">
139 <p class="talk-confirm-left small muted">${WAITS}</p>
140 <div class="talk-confirm-acts">
141141 <button type="submit" class="btn" data-variant="primary" formaction="${once ? `/settings/confirms/${id}` : `${HERE}/confirm/${id}`}" formnovalidate name="answer" value="yes"${once ? null : raw(" data-answer")}>${icon("check")} Do it</button>
142142 <button type="submit" class="btn" data-variant="ghost" formaction="${HERE}/confirm/${id}" formnovalidate name="answer" value="no" data-answer>Not now</button>
143143 </div>
@@ -148,20 +148,20 @@ export function askItem(id: string, tool: string, does: string, expiresAt: strin
148148 * What waits on the person in this conversation, docked directly above the composer: always in
149149 * view, never in the thread. One shows whole; several are a count and a stack, the first open.
150150 */
151 function asksDock(asks: Html[]): Html {
152 return html`<div class="talk-asks" data-asks role="region" aria-label="Waiting for your answer"${asks.length === 0 ? raw(" hidden") : null}${asks.length > 1 ? raw(" data-many") : null}>
153 <p class="talk-asks-count small muted" data-asks-count>${asks.length > 1 ? `${asks.length} waiting` : ""}</p>
154 <div class="talk-ask-list">${asks}</div>
151 function confirmsDock(held: Html[]): Html {
152 return html`<div class="talk-confirms" data-confirms role="region" aria-label="Waiting for your answer"${held.length === 0 ? raw(" hidden") : null}${held.length > 1 ? raw(" data-many") : null}>
153 <p class="talk-confirms-count small muted" data-confirms-count>${held.length > 1 ? `${held.length} waiting` : ""}</p>
154 <div class="talk-confirm-list">${held}</div>
155155 </div>`;
156156 }
157157
158 /** The asks still waiting among these turns, in order, drawn for the dock. */
159 const asksOf = (turns: readonly Turn[], waiting: readonly Waiting[]): Html[] =>
158 /** The confirms still waiting among these turns, in order, drawn for the dock. */
159 const confirmsOf = (turns: readonly Turn[], waiting: readonly Waiting[]): Html[] =>
160160 turns.flatMap((t) => {
161161 if (t.role !== "confirm" || t.replaced) return [];
162162 const d = parse(t.text);
163163 const w = waiting.find((x) => x.id === String(d?.["confirm"] ?? ""));
164 return w === undefined ? [] : [askItem(w.id, w.tool, typeof d?.["does"] === "string" ? d["does"] : w.does, w.expiresAt, typeof d?.["shown"] === "string" ? d["shown"] : "")];
164 return w === undefined ? [] : [confirmItem(w.id, w.tool, typeof d?.["does"] === "string" ? d["does"] : w.does, w.expiresAt, typeof d?.["shown"] === "string" ? d["shown"] : "")];
165165 });
166166
167167 /** The turns a page holds that say they undid another: those receipts have no Undo left. */
@@ -291,7 +291,14 @@ export function foldSteps(open: boolean, turns: readonly Html[]): Html[] {
291291
292292 /** The quiet steps line and the links to what the turn opened or changed, under its reply. */
293293 const workHtml = (work: Work): Html =>
294 html`<p class="talk-steps small muted">${work.steps.charAt(0).toUpperCase() + work.steps.slice(1)}</p>${work.links.length === 0 ? null : html`<p class="talk-links small">${work.links.map((l) => html`<a href="${l.href}">${l.label}</a>`)}</p>`}`;
294 html`<p class="talk-steps small muted">${work.steps.charAt(0).toUpperCase() + work.steps.slice(1)}</p>${work.links.length === 0 ? null : linksFold(work.links)}`;
295
296 /** What a turn opened or changed, folded behind its count; a file named by its path in its repository. */
297 const linksFold = (links: Work["links"]): Html => {
298 const files = links.every((l) => l.href.includes("/blob/"));
299 const n = links.length;
300 return html`<details class="talk-links small"><summary>${n} ${files ? (n === 1 ? "file" : "files") : n === 1 ? "link" : "links"}</summary><p>${links.map((l) => html`<a href="${l.href}" title="${l.label}">${l.href.includes("/blob/") ? l.label.replace(/^[^/\s]+\/[^/\s]+\//, "") : l.label}</a>`)}</p></details>`;
301 };
295302
296303 /** Ask again as a form, so it works without the script; the script only enhances it. */
297304 const againForm = (base: string, how: "regenerate" | "retry", label: string, words: string, turn?: string): Html =>
@@ -373,7 +380,7 @@ export function turnHtml(turn: Turn, waiting: ReadonlySet<string>, cost?: Spend,
373380 </li>`;
374381 const data = parse(turn.text);
375382 const thought = thinkingOf(turn);
376 // An ask waits in the dock, not here; once answered, the thread keeps its outcome (the receipt,
383 // A confirm waits in the dock, not here; once answered, the thread keeps its outcome (the receipt,
377384 // or Not now) in the place it happened. Only one that ran out says so here, with the way on.
378385 if (turn.role === "confirm") {
379386 const confirm = String(data?.["confirm"] ?? "");
@@ -542,7 +549,7 @@ async function talkPage(ctx: Ctx, conversation: Conversation, before0: string |
542549 const turns = listed.ok ? listed.value : [];
543550 const waitingList = waitingConfirms(ctx, user);
544551 const waiting = new Set(waitingList.map((w) => w.id));
545 const asks = asksOf(turns, waitingList);
552 const pendingConfirms = confirmsOf(turns, waitingList);
546553 const expired = ranOutOf(ctx, user.id, turns);
547554 const undone = undoneIn(turns);
548555 const sent = filesOfTurns(ctx.app.db, user.id, turns.filter((t) => t.role === "person").map((t) => t.id));
@@ -581,12 +588,13 @@ async function talkPage(ctx: Ctx, conversation: Conversation, before0: string |
581588 const builtRepo = buildRow === undefined ? undefined : getRepoById(ctx.app.db, buildRow.repoId);
582589 const v = Number(ctx.url.searchParams.get("v") ?? "");
583590 const wait = panel === null ? undefined : pending ? "Starting the preview…" : undefined;
584 const idle = panel === null ? undefined : running ? "Making the first version…" : "Your app appears here as soon as the first change is made.";
591 const idle = panel === null ? undefined : running ? "Making the first version. The preview shows here once it is built, and each version after it reloads in place." : "Your app shows here once its first version is made: say what to change and the crew makes it. Below are the files it starts from.";
585592 const pane = await talkPane(ctx, user, builtRepo === undefined ? cited : `${builtRepo.ownerName}/${builtRepo.name}`, works, view, undefined, {
586593 ...(buildRow === undefined ? {} : { build: buildRow }),
587594 ...(Number.isInteger(v) && v > 0 ? { version: v } : {}),
588595 ...(wait === undefined ? {} : { wait }),
589596 ...(idle === undefined ? {} : { idle }),
597 busy: pending || running,
590598 });
591599 // A tab asks for the pane alone, so it swaps in place without the page.
592600 if (ctx.url.searchParams.get("fragment") === "pane") return fragment(pane.html, { request: ctx.request });
@@ -621,8 +629,8 @@ async function talkPage(ctx: Ctx, conversation: Conversation, before0: string |
621629 ${about}
622630 ${editing === undefined && about !== null ? html`<input type="hidden" name="about" value="${ctx.url.searchParams.get("about")}" />` : null}
623631 ${chosen === undefined ? null : html`<input type="hidden" name="template" value="${chosen}" />`}
624 ${asksDock(asks)}
625 <p class="sr-only" role="status" data-asks-said></p>
632 ${confirmsDock(pendingConfirms)}
633 <p class="sr-only" role="status" data-confirms-said></p>
626634 <div class="talk-box">
627635 <div class="talk-chips" data-chips role="group" aria-label="Attached files"></div>
628636 <p class="talk-to small" data-to-line hidden><span></span> <button type="button" class="btn btn-icon" data-variant="ghost" data-to-off aria-label="Talk to the forge instead" title="Talk to the forge instead">${icon("x")}</button></p>
@@ -945,8 +953,8 @@ export function talkStream(ctx: Ctx): Response {
945953 const look = talkLook(app.db, user, fresh.filter((t) => t.role === "agent").map((t) => t.text), appLook(app, user));
946954 for (const turn of fresh) {
947955 // A frame lands in a page whose sprite is its own: its icons are drawn inline (`inlineIcons`).
948 const ask = asksOf([turn], waitingList)[0];
949 emit("turn", { id: turn.id, role: turn.role, html: inlineIcons(turnHtml(turn, waiting, undefined, undefined, works.get(turn.id), sent.get(turn.id), expired, undone, refs, voice, look, receiptLines(app.db, user, [turn])).text), ...(ask === undefined ? {} : { ask: inlineIcons(ask.text) }) }, turn.id);
956 const held = confirmsOf([turn], waitingList)[0];
957 emit("turn", { id: turn.id, role: turn.role, html: inlineIcons(turnHtml(turn, waiting, undefined, undefined, works.get(turn.id), sent.get(turn.id), expired, undone, refs, voice, look, receiptLines(app.db, user, [turn])).text), ...(held === undefined ? {} : { held: inlineIcons(held.text) }) }, turn.id);
950958 cursor = turn.id;
951959 }
952960 // The page is told at once what the block holds after these turns, empty once it is
src/web/pages/talk_client.ts +80 −56
@@ -87,12 +87,18 @@ body:has(.talk-page) .foot { display: none; }
8787 .talk-tabs { flex: none; }
8888 [data-split] .talk-head > form { display: none; }
8989 .talk-tabs a { min-height: 2.75rem; display: inline-flex; align-items: center; }
90 .talk-chats { display: grid; gap: 8px; }
90 .talk-body table { display: block; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; background: linear-gradient(to right, var(--bg) 30%, transparent) left / 24px 100% no-repeat local, linear-gradient(to left, var(--bg) 30%, transparent) right / 24px 100% no-repeat local, linear-gradient(to right, var(--border-strong), transparent) left / 8px 100% no-repeat scroll, linear-gradient(to left, var(--border-strong), transparent) right / 8px 100% no-repeat scroll; }
91 .talk-body :is(td, th) { overflow-wrap: normal; word-break: normal; }
92 .talk-body td code { white-space: nowrap; }
93 .talk-display-sheet .dialog-body { display: grid; gap: 12px; }
94 .talk-chats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
9195 .talk-new { width: 100%; justify-content: flex-start; min-height: 2.75rem; }
9296 .talk-find .input { width: 100%; font-size: 16px; }
9397 .talk-chats .list { margin: 0; }
9498 .talk-chats .row { min-height: 2.75rem; border-radius: var(--radius-sm); }
95 .talk-chats :is(.row-meta, .row-title) { overflow-wrap: anywhere; }
99 .talk-chats .row-main { min-width: 0; }
100 .talk-chats .row-title { overflow: hidden; text-overflow: ellipsis; }
101 .talk-chats .row-meta { overflow-wrap: anywhere; }
96102 .talk-chats .row-meta { font-variant-numeric: tabular-nums; }
97103 .talk-archived { padding: 8px; }
98104 @media (min-width: 56.25rem) {
@@ -113,6 +119,7 @@ body:has(.talk-page) .foot { display: none; }
113119 [data-split] .talk-work { display: block; position: sticky; top: var(--topbar-h); height: calc(100dvh - var(--topbar-h)); overflow-y: auto; padding-block: 12px; padding-inline: 16px 0; border-inline-start: 1px solid var(--border); }
114120 }
115121 .talk-work { min-width: 0; }
122 .talk:has(form[data-answering]) .talk-log { padding-bottom: calc(2.75rem + 24px); }
116123 .talk-log { list-style: none; margin: 0; padding: 8px 0 4px; display: grid; gap: 16px; align-content: end; flex: 1; min-width: 0; font-size: 15px; line-height: 1.65; }
117124 .talk-turn { min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
118125 .talk-turn p { margin: 0 0 8px; }
@@ -141,18 +148,23 @@ body:has(.talk-page) .foot { display: none; }
141148 @media (prefers-reduced-motion: no-preference) {
142149 .talk:not([data-motion=reduced]) :is(.talk-log > [data-in], .talk-fold-list > [data-in], .talk-jump:not([hidden])) { animation: talk-in var(--dur-3) var(--ease); }
143150 .talk:not([data-motion=reduced]) .talk-live [data-in] { animation: talk-fade var(--dur-3) var(--ease); }
144 .talk:not([data-motion=reduced]) .talk-ask[data-in] { animation: talk-in var(--dur-3) var(--ease); }
145 .talk:not([data-motion=reduced]) .talk-asks { transition: height var(--dur-3) var(--ease), padding var(--dur-3) var(--ease); }
146 .talk:not([data-motion=reduced]) .talk-ask[data-out] { transition: opacity var(--dur-2) var(--ease); }
151 .talk:not([data-motion=reduced]) .talk-confirm[data-in] { animation: talk-in var(--dur-3) var(--ease); }
152 .talk:not([data-motion=reduced]) .talk-confirms { transition: height var(--dur-3) var(--ease), padding var(--dur-3) var(--ease); }
153 .talk:not([data-motion=reduced]) .talk-confirm[data-out] { transition: opacity var(--dur-2) var(--ease); }
147154 .talk-versions [data-in] { animation: talk-in var(--dur-3) var(--ease); }
148155 }
149156 .talk[data-motion=reduced] :is(*, ::before, ::after) { animation: none !important; transition: none !important; }
150157 .talk-person > .talk-body { min-width: 0; max-width: min(calc(100% - 4.5rem), 36rem); padding: 8px 16px; border-radius: 18px; background: var(--muted); white-space: pre-wrap; }
151158 .talk-agent > .talk-body, .talk-person > .talk-body + .talk-files, .talk-agent > .talk-steps { flex: 1 0 100%; }
152 .talk-agent > .talk-links { order: 1; margin: 0; margin-inline-end: 8px; font-size: 12.5px; }
159 .talk-agent > .talk-links { order: 2; margin: 0; font-size: 12.5px; color: var(--muted-fg); }
160 .talk-links > summary { cursor: pointer; min-height: 2rem; display: inline-flex; align-items: center; }
161 .talk-links[open] { flex-basis: 100%; }
162 .talk-links > p { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; }
163 .talk-agent > .talk-body { margin-bottom: 16px; }
164 .talk-agent { column-gap: 12px; }
153165 .talk-links a { color: var(--muted-fg); }
154 .talk-agent > .talk-cost { order: 1; margin: 0; margin-inline-end: 8px; font-size: 12.5px; }
155 .talk-agent > .talk-acts { order: 2; }
166 .talk-agent > .talk-cost { order: 1; margin: 0; font-size: 12.5px; }
167 .talk-agent > .talk-acts { order: 3; }
156168 .talk-agent > .talk-body { max-width: 100%; }
157169 .talk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; font-size: 12.5px; }
158170 .talk-turn > :is(.talk-meta, .talk-links, .talk-cost) { margin-block: 0; }
@@ -176,26 +188,24 @@ body:has(.talk-page) .foot { display: none; }
176188 .talk-fold > details > summary:hover { color: var(--fg); }
177189 .talk-fold-list { list-style: none; margin: 0; margin-inline-start: 8px; padding: 0; padding-inline-start: 12px; border-inline-start: 2px solid var(--border); display: grid; gap: 2px; }
178190 .talk-steps { margin: 4px 0 0; }
179 .talk-live .talk-steps:last-child, .talk-status:not(:empty), .talk-stage-note { background: linear-gradient(90deg, var(--muted-fg) 40%, var(--fg) 50%, var(--muted-fg) 60%) 0 0 / 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: talk-shine 2s linear infinite; }
191 .talk-live .talk-steps:last-child, .talk-status:not(:empty), .talk-stage[data-busy] .talk-stage-note { background: linear-gradient(90deg, var(--muted-fg) 40%, var(--fg) 50%, var(--muted-fg) 60%) 0 0 / 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: talk-shine 2s linear infinite; }
180192 @keyframes talk-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }
181 @media (prefers-reduced-motion: reduce) { .talk-live .talk-steps:last-child, .talk-status:not(:empty), .talk-stage-note { animation: none; color: var(--muted-fg); background: none; } }
182 .talk-links { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 2px 0 0; font-size: 13px; }
183 .talk-confirm { padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); }
184 .talk-asks { display: grid; align-content: start; gap: 4px; padding-bottom: 8px; overflow: hidden; }
185 .talk-asks[data-out] { padding-bottom: 0; }
186 .talk-asks[hidden], .talk-asks-count:empty { display: none; }
187 .talk-asks-count { margin: 0; padding-inline: 4px; }
188 .talk-ask-list { display: grid; gap: 4px; }
189 .talk-asks[data-many] .talk-ask-list { max-height: 33dvh; overflow-y: auto; overscroll-behavior: contain; }
190 .talk-ask { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border); }
191 .talk-ask-does, .talk-ask-left { margin: 0; }
192 .talk-ask-does { font-size: 15px; }
193 .talk-ask-acts { display: flex; flex-wrap: wrap; gap: 8px; }
194 .talk-ask-acts .btn { min-height: 2.75rem; }
195 .talk-ask[data-out] { opacity: 0; }
196 .talk-asks[data-many] .talk-ask:not(:first-child) { padding-block: 8px; }
197 .talk-asks[data-many] .talk-ask:not(:first-child) .talk-ask-does { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; color: var(--muted-fg); }
198 .talk-asks[data-many] .talk-ask:not(:first-child) :is(.talk-ask-acts, .talk-ask-left) { display: none; }
193 @media (prefers-reduced-motion: reduce) { .talk-live .talk-steps:last-child, .talk-status:not(:empty), .talk-stage[data-busy] .talk-stage-note { animation: none; color: var(--muted-fg); background: none; } }
194 .talk-confirms { display: grid; align-content: start; gap: 4px; padding-bottom: 8px; overflow: hidden; }
195 .talk-confirms[data-out] { padding-bottom: 0; }
196 .talk-confirms[hidden], .talk-confirms-count:empty { display: none; }
197 .talk-confirms-count { margin: 0; padding-inline: 4px; }
198 .talk-confirm-list { display: grid; gap: 4px; }
199 .talk-confirms[data-many] .talk-confirm-list { max-height: 33dvh; overflow-y: auto; overscroll-behavior: contain; }
200 .talk-confirm { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border); }
201 .talk-confirm-does, .talk-confirm-left { margin: 0; }
202 .talk-confirm-does { font-size: 15px; }
203 .talk-confirm-acts { display: flex; flex-wrap: wrap; gap: 8px; }
204 .talk-confirm-acts .btn { min-height: 2.75rem; }
205 .talk-confirm[data-out] { opacity: 0; }
206 .talk-confirms[data-many] .talk-confirm:not(:first-child) { padding-block: 8px; }
207 .talk-confirms[data-many] .talk-confirm:not(:first-child) .talk-confirm-does { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; color: var(--muted-fg); }
208 .talk-confirms[data-many] .talk-confirm:not(:first-child) :is(.talk-confirm-acts, .talk-confirm-left) { display: none; }
199209 .talk-fold[data-dones] summary > .ico { margin-inline-end: 8px; vertical-align: -3px; color: var(--muted-fg); }
200210 .talk:has(.talk-hello) .talk-log { flex: 0; margin-top: auto; }
201211 .talk:has(.talk-hello) .talk-compose { position: static; margin-bottom: auto; padding-bottom: 32px; }
@@ -228,7 +238,7 @@ body:has(.talk-page) .foot { display: none; }
228238 [data-answering] .talk-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
229239 .talk-error { margin: 6px 4px 0; color: var(--danger); }
230240 .talk-error[hidden] { display: none; }
231 .talk-jump { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); min-height: 2.75rem; border-radius: 999px; box-shadow: var(--shadow-2); gap: 6px; }
241 .talk-jump { position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%); min-height: 2.75rem; border-radius: 999px; box-shadow: var(--shadow-2); gap: 6px; }
232242 .talk-jump[data-follow="pause"] .ico + .ico, .talk-jump:not([data-follow="pause"]) .ico:first-child, .talk-jump:not([data-new]) .talk-dot { display: none; }
233243 .talk-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
234244 .talk-code { margin: 0 0 12px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
@@ -470,7 +480,7 @@ if (root) {
470480 grown = h;
471481 draw();
472482 });
473 for (const el of [root, log, form, ...root.children]) sizes.observe(el);
483 for (const el of [root, log, form, ...root.children]) sizes.observe(el, { box: "border-box" });
474484 document.addEventListener("scroll", (e) => {
475485 const s = sc();
476486 if (e.target !== s && !(e.target === document && s === page)) return;
@@ -633,8 +643,8 @@ if (root) {
633643 answering = on;
634644 form.toggleAttribute("data-answering", on);
635645 paint();
636 // The composer just changed (Steer and Stop, a row that wraps): a follower stays at the end
637 // now, in this task, rather than for a frame until the size observer catches up.
646 // The composer and the thread's end strip just changed: a follower stays at the end now, in
647 // this task, rather than for a frame until the size observer catches up.
638648 if (stuck) toEnd();
639649 draw();
640650 };
@@ -675,7 +685,7 @@ if (root) {
675685 source.addEventListener("turn", (e) => {
676686 const turn = JSON.parse(e.data);
677687 last = turn.id;
678 if (turn.ask) addAsk(turn.ask);
688 if (turn.held) addConfirm(turn.held);
679689 if (!document.getElementById("t-" + turn.id)) {
680690 place(turn.html);
681691 decorate(log);
@@ -729,37 +739,37 @@ if (root) {
729739 if (r && !e.metaKey && !e.ctrlKey && !e.shiftKey) { e.preventDefault(); talkTo(r.dataset.reply, r.dataset.replyTo); }
730740 if (e.target.closest && e.target.closest("[data-to-off]")) talkTo("", "");
731741 });
732 // The dock: what waits on the person, above the composer. An answered ask collapses out of it
742 // The dock: what waits on the person, above the composer. An answered confirm collapses out of it
733743 // (instantly where motion is reduced) and its outcome arrives in the thread as a turn.
734 const dock = form.querySelector("[data-asks]"), asks = dock.querySelector(".talk-ask-list"), said = form.querySelector("[data-asks-said]");
744 const dock = form.querySelector("[data-confirms]"), pending = dock.querySelector(".talk-confirm-list"), said = form.querySelector("[data-confirms-said]");
735745 const tell = (words) => { said.textContent = words; };
736746 // The stream is read again only to bring the answer's outcome: its end says nothing.
737747 let hush = false;
738 const countAsks = () => {
739 const n = asks.children.length;
748 const countConfirms = () => {
749 const n = pending.children.length;
740750 dock.hidden = !n;
741751 dock.toggleAttribute("data-many", n > 1);
742 dock.querySelector("[data-asks-count]").textContent = n > 1 ? n + " waiting" : "";
743 for (const a of asks.children) timeLeft(a);
752 dock.querySelector("[data-confirms-count]").textContent = n > 1 ? n + " waiting" : "";
753 for (const a of pending.children) timeLeft(a);
744754 };
745755 // The time left is said once it is under two minutes, by one timeout per confirm set for that
746756 // moment and for its end: never a clock that ticks.
747757 const timeLeft = (a) => {
748758 if (a.dataset.timed) return;
749759 a.dataset.timed = "1";
750 const end = Date.parse(a.dataset.expires), p = a.querySelector(".talk-ask-left");
760 const end = Date.parse(a.dataset.expires), p = a.querySelector(".talk-confirm-left");
751761 const tell = (words, over) => { if (!a.isConnected) return; p.hidden = false; p.textContent = words; if (over) a.querySelectorAll("button").forEach((b) => { b.disabled = true; }); };
752762 setTimeout(() => tell("Less than 2 minutes left.", false), Math.max(0, end - 120000 - Date.now()));
753763 setTimeout(() => tell("This ran out: nothing was done.", true), Math.max(0, end - Date.now()));
754764 };
755 // The dock moves once, from the height it had to the one it has now (the next ask opened, or
765 // The dock moves once, from the height it had to the one it has now (the next confirm opened, or
756766 // none left), so the thread above glides with it and never jumps. Reduced motion: at once.
757 const dropAsk = (a) => {
758 const from = dock.offsetHeight, last = asks.children.length === 1;
759 if (last) { a.setAttribute("data-out", ""); dock.setAttribute("data-out", ""); } else { a.remove(); countAsks(); }
767 const dropConfirm = (a) => {
768 const from = dock.offsetHeight, last = pending.children.length === 1;
769 if (last) { a.setAttribute("data-out", ""); dock.setAttribute("data-out", ""); } else { a.remove(); countConfirms(); }
760770 const to = last ? 0 : dock.offsetHeight;
761771 let over = false;
762 const done = () => { if (over) return; over = true; dock.style.height = ""; dock.removeAttribute("data-out"); if (last) { a.remove(); countAsks(); } };
772 const done = () => { if (over) return; over = true; dock.style.height = ""; dock.removeAttribute("data-out"); if (last) { a.remove(); countConfirms(); } };
763773 dock.style.height = from + "px";
764774 const glide = (parseFloat(window.getComputedStyle(dock).transitionDuration) || 0) * 1000;
765775 if (!glide || from === to) return done();
@@ -769,20 +779,20 @@ if (root) {
769779 const end = (e) => { if (e.target === dock && e.propertyName === "height") { dock.removeEventListener("transitionend", end); done(); } };
770780 dock.addEventListener("transitionend", end);
771781 };
772 const addAsk = (markup) => {
782 const addConfirm = (markup) => {
773783 const t = document.createElement("template");
774784 t.innerHTML = markup.trim();
775785 const a = t.content.firstElementChild;
776 if (!a || asks.querySelector('[data-ask="' + a.dataset.ask + '"]')) return;
786 if (!a || pending.querySelector('[data-confirm-id="' + a.dataset.confirmId + '"]')) return;
777787 a.setAttribute("data-in", "");
778 asks.append(a);
779 countAsks();
780 tell("Waiting for your answer: " + a.querySelector(".talk-ask-does").textContent);
788 pending.append(a);
789 countConfirms();
790 tell("Waiting for your answer: " + a.querySelector(".talk-confirm-does").textContent);
781791 };
782 const answerAsk = async (b) => {
783 const a = b.closest(".talk-ask"), yes = b.value === "yes", buttons = a.querySelectorAll("button");
784 // Said without a visible line, so answering moves nothing; a refusal is said on the ask itself.
785 const refused = (why) => { const p = a.querySelector(".talk-ask-left"); p.hidden = false; p.textContent = why; tell(why); buttons.forEach((x) => { x.disabled = false; }); };
792 const answerConfirm = async (b) => {
793 const a = b.closest(".talk-confirm"), yes = b.value === "yes", buttons = a.querySelectorAll("button");
794 // Said without a visible line, so answering moves nothing; a refusal is said on the confirm itself.
795 const refused = (why) => { const p = a.querySelector(".talk-confirm-left"); p.hidden = false; p.textContent = why; tell(why); buttons.forEach((x) => { x.disabled = false; }); };
786796 buttons.forEach((x) => { x.disabled = true; });
787797 try {
788798 const res = await fetch(b.getAttribute("formaction"), { method: "POST", headers: { accept: "application/json" }, body: new URLSearchParams({ answer: b.value }) });
@@ -790,14 +800,14 @@ if (root) {
790800 if (res.status === 410) { window.location.reload(); return; }
791801 if (!res.ok) return refused(out.message || "Nothing was done.");
792802 tell(yes ? "Done." : "Not now: nothing was done.");
793 dropAsk(a);
803 dropConfirm(a);
794804 hush = !paged;
795805 follow();
796806 } catch (_) {
797807 refused("That was not sent: no connection.");
798808 }
799809 };
800 countAsks();
810 countConfirms();
801811 const picker = form.querySelector("[data-files]");
802812 const attach = form.querySelector("[data-attach]");
803813 if (attach) { attach.hidden = false; attach.addEventListener("click", () => picker.click()); }
@@ -845,7 +855,7 @@ ${dictateJs}
845855 });
846856 const send = async (e) => {
847857 const by = e.submitter;
848 if (by && by.hasAttribute("formaction")) { if (by.hasAttribute("data-answer")) { e.preventDefault(); answerAsk(by); } return; }
858 if (by && by.hasAttribute("formaction")) { if (by.hasAttribute("data-answer")) { e.preventDefault(); answerConfirm(by); } return; }
849859 if (form.hasAttribute("data-build")) { clearTimeout(draftTimer); draft.save(""); return; }
850860 e.preventDefault();
851861 hush = false;
@@ -1054,6 +1064,20 @@ ${dictateJs}
10541064 f.addEventListener("load", () => clearTimeout(late), { once: true });
10551065 };
10561066 document.querySelectorAll("[data-frame]").forEach(watchFrame);
1067 // Display opens as its own small dialog, every choice in view; the menu closes behind it.
1068 document.addEventListener("click", (e) => {
1069 const s = e.target.closest && e.target.closest(".talk-display > summary");
1070 if (!s || !window.forgeOverlay) return;
1071 e.preventDefault();
1072 const box = s.parentElement, f = box.querySelector("form"), menu = s.closest("details[open]:not(.talk-display)"), opener = menu ? menu.querySelector("summary") : s;
1073 if (menu) menu.open = false;
1074 const d = Object.assign(document.createElement("dialog"), { className: "dialog talk-display-sheet", innerHTML: '<div class="dialog-head"><h2 id="talk-display-title">Display</h2></div><div class="dialog-body"></div><div class="dialog-foot"><form method="dialog"><button class="btn" type="submit">Close</button></form></div>' });
1075 d.setAttribute("aria-labelledby", "talk-display-title");
1076 d.querySelector(".dialog-body").append(f);
1077 document.body.append(d);
1078 d.addEventListener("close", () => { box.append(f); d.remove(); });
1079 window.forgeOverlay.open(d, { opener, name: "display" });
1080 });
10571081 codePane();
10581082 }
10591083 `;
src/web/pages/talk_preview.ts +6 −2
@@ -39,6 +39,8 @@ export interface PaneAsk {
3939 readonly version?: number;
4040 readonly wait?: string;
4141 readonly idle?: string;
42 /** Something is under way (a preview starting, a first version being made): its words shimmer. */
43 readonly busy?: boolean;
4244 }
4345
4446 export async function talkPane(ctx: Ctx, user: User, name: string | undefined, works: ReadonlyMap<string, Work>, view: View = "preview", apps?: Apps, ask: PaneAsk = {}): Promise<Pane> {
@@ -60,7 +62,7 @@ export async function talkPane(ctx: Ctx, user: User, name: string | undefined, w
6062 : view === "diff"
6163 ? await diffView(ctx.app, work, ask.version)
6264 : url === undefined || ask.wait !== undefined
63 ? html`<div class="talk-stage talk-stage-wait" data-stage><p class="talk-stage-note small" data-stage-note>${ask.wait ?? ask.idle ?? "Nothing is running yet: the app appears here once it is built."}</p></div>`
65 ? html`<div class="talk-stage talk-stage-wait" data-stage${ask.busy === true ? raw(" data-busy") : null}><p class="talk-stage-note" data-stage-note>${ask.wait ?? ask.idle ?? "Nothing is running yet: the app appears here once it is built."}</p></div>${ask.build === undefined ? null : html`<h2 class="talk-stage-files small muted">The files it starts from</h2>${await codeView(ctx.app, work)}`}`
6466 : html`<div class="talk-stage" data-stage><iframe class="talk-frame" data-frame src="${url}" title="Live preview of ${name}" referrerpolicy="no-referrer" sandbox="allow-scripts allow-same-origin allow-forms allow-popups"></iframe><p class="talk-stage-note small" data-stage-note hidden>Updating the preview…</p></div>`;
6567 // The address bar of what runs: which environment, where it lives, reload and open on its own.
6668 const where = url === undefined ? null : html`<span class="talk-addr small" title="${url}"><span class="muted">${pull === undefined ? "Production" : `Pull #${String(pull)}`}</span> ${new URL(url).host}</span>`;
@@ -90,7 +92,9 @@ export const paneCss = /* css */ `
9092 .talk-frame { display: block; width: 100%; height: calc(100dvh - 14rem); min-height: 24rem; border: 0; transition: opacity var(--dur-3) var(--ease); }
9193 .talk-stage[data-busy] .talk-frame { opacity: .35; }
9294 .talk-stage-note { position: absolute; inset: auto 0 45% 0; margin: 0; padding: 0 24px; text-align: center; }
93 .talk-stage-wait { height: calc(100dvh - 14rem); min-height: 24rem; }
95 .talk-stage-wait { padding: 16px; }
96 .talk-stage-wait .talk-stage-note { position: static; padding: 0; text-align: start; }
97 .talk-stage-files { margin: 16px 0 8px; font-size: 12.5px; font-weight: 600; }
9498 .talk-stage-note[hidden] { display: none; }
9599 @media (max-width: 30rem) { .talk-addr { display: none; } }
96100 @media (prefers-reduced-motion: reduce) { .talk-frame { transition: none; } }
src/web/talk_build.ts +7 −7
@@ -63,6 +63,11 @@ export function buildPanel(state: BuildState, base: string, chosen: number | und
6363 <div class="talk-build-head">
6464 <strong class="talk-build-name">${state.repoName}</strong>
6565 ${state.published ? badge("Published", { tone: "success" }) : env === undefined ? html`<span class="small muted">${newest === undefined ? "No version yet" : "Preview on its way"}</span>` : envStateBadge(env)}
66 ${state.versions.length === 0
67 ? null
68 : html`<nav class="talk-versions" aria-label="Versions">${state.versions.map(
69 (v) => html`<a class="btn" data-size="sm" href="${base}?v=${v.number}"${v.number === shown ? html` aria-current="true"` : null} title="${v.subject}">v${v.number}</a>`,
70 )}</nav>`}
6671 <span class="spacer"></span>
6772 ${state.published
6873 ? state.productionUrl === null
@@ -72,11 +77,6 @@ export function buildPanel(state: BuildState, base: string, chosen: number | und
7277 ? null
7378 : html`<form method="post" action="${base}/build/publish">${btn("Publish", { variant: "primary", icon: "rocket", label: "Publish: merge to main and deploy production" })}</form>`}
7479 </div>
75 ${state.versions.length === 0
76 ? null
77 : html`<nav class="talk-versions" aria-label="Versions">${state.versions.map(
78 (v) => html`<a class="btn" data-size="sm" href="${base}?v=${v.number}"${v.number === shown ? html` aria-current="true"` : null} title="${v.subject}">v${v.number}</a>`,
79 )}</nav>`}
8080 ${chosen === undefined || diff === undefined
8181 ? null
8282 : html`<div class="talk-build-chosen"><p><strong>v${chosen}</strong> ${state.versions.find((v) => v.number === chosen)?.subject ?? ""} <span class="small muted">${time(state.versions.find((v) => v.number === chosen)?.date ?? "")}</span></p>
@@ -152,8 +152,8 @@ export async function talkPublish(ctx: Ctx): Promise<Response> {
152152 /** Styles for the box and the panel; added to Talk's own only on a page that draws one. Spacing is the 4px scale. */
153153 export const buildCss = /* css */ `
154154 .talk-build { display: grid; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
155 .talk-build-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
156 .talk-build-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
155 .talk-build-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
156 .talk-build-name { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
157157 .talk-versions { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
158158 .talk-versions .btn { min-height: 2.75rem; min-width: 2.75rem; justify-content: center; border-radius: 999px; font-variant-numeric: tabular-nums; }
159159 .talk-versions [aria-current] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
src/web/talk_code.ts +1
@@ -197,6 +197,7 @@ export const codePaneCss = `
197197 .talk-code-files p { display: flex; align-items: center; gap: 8px; min-width: 0; }
198198 .talk-code-files a, .talk-code-tree a { display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 2.75rem; flex: 1; }
199199 .talk-code-n { flex: none; font-size: 12.5px; font-variant-numeric: tabular-nums; }
200 .talk-code-tree .ex-dir > summary { color: var(--muted-fg); }
200201 .talk-code-tree .ex-file[data-changed]::after { content: "changed"; margin-inline-start: auto; font-size: 11.5px; color: var(--muted-fg); }
201202 .talk-code-file { display: grid; gap: 8px; min-width: 0; }
202203 .talk-code-file[hidden], .talk-code[data-open] > :is(.talk-code-changed, .talk-code-tree) { display: none; }
test/conversation-holds.test.ts +2 −2
@@ -21,7 +21,7 @@ import { mintViaToken } from "../src/core/via_token.ts";
2121 import { ASKING, UNDOABLE } from "../src/crew/conversation_confirm.ts";
2222 import { ASKED_WRITES_MAX } from "../src/http/mcp/shared.ts";
2323 import { serve, type Servers } from "../src/http/server.ts";
24 import { ASK_AGAIN, askItem, turnHtml, WAITS } from "../src/web/pages/talk.ts";
24 import { ASK_AGAIN, confirmItem, turnHtml, WAITS } from "../src/web/pages/talk.ts";
2525 import { promote } from "./helpers/members.ts";
2626
2727 let dataDir: string;
@@ -155,7 +155,7 @@ describe("what nobody asked for stays held, with buttons", () => {
155155 for (const t of turns) {
156156 expect(turnHtml(t, waiting).text).toBe("");
157157 const c = listed.find((x) => x.id === JSON.parse(t.text).confirm)!;
158 const docked = askItem(c.id, c.tool, c.does, c.expiresAt).text;
158 const docked = confirmItem(c.id, c.tool, c.does, c.expiresAt).text;
159159 expect(docked).toContain(`/talk/confirm/${c.id}`);
160160 expect(docked).toContain("Do it");
161161 expect(docked).toContain("Not now");
test/talk-live.test.ts +2 −2
@@ -838,8 +838,8 @@ describe("a turn stored by another door", () => {
838838 const confirm = await s.until((f) => f.event === "turn" && f.data["role"] === "confirm");
839839 // The ask goes to the dock above the composer, whole; the thread draws no copy of it.
840840 expect(String(confirm.data["html"])).toBe("");
841 expect(String(confirm.data["ask"])).toContain("Do it");
842 expect(String(confirm.data["ask"])).toContain("Not now");
841 expect(String(confirm.data["held"])).toContain("Do it");
842 expect(String(confirm.data["held"])).toContain("Not now");
843843 s.close();
844844 await s.ended;
845845 } finally {
test/talk-page.test.ts +81 −39
@@ -290,6 +290,35 @@ describe("the page", () => {
290290 expect(out).not.toMatch(/<details open/);
291291 });
292292
293 test("a reply ends in one line: what it opened folds behind its count, each file by its path in its repository", async () => {
294 const { turnHtml } = await import("../src/web/pages/talk.ts");
295 const work = { steps: "read 3 files", links: ["a.ts", "src/b.ts", "README.md"].map((p) => ({ href: `/erin/site/blob/main/${p}`, label: `erin/site/${p}` })) };
296 const out = turnHtml({ id: "9", role: "agent", text: "Done.", createdAt: "2026-01-01T00:00:00Z" } as any, new Set(), undefined, undefined, work as any).text;
297 expect(out).toContain('<details class="talk-links small"><summary>3 files</summary>');
298 expect(out).toContain('href="/erin/site/blob/main/src/b.ts" title="erin/site/src/b.ts">src/b.ts</a>');
299 // One file is "1 file"; anything that is not a file is counted as links, named as it was.
300 const one = turnHtml({ id: "10", role: "agent", text: "Done.", createdAt: "2026-01-01T00:00:00Z" } as any, new Set(), undefined, undefined, { steps: "read a file", links: [{ href: "/erin/site/blob/main/a.ts", label: "erin/site/a.ts" }] } as any).text;
301 expect(one).toContain("<summary>1 file</summary>");
302 const mixed = turnHtml({ id: "11", role: "agent", text: "Done.", createdAt: "2026-01-01T00:00:00Z" } as any, new Set(), undefined, undefined, { steps: "opened #12", links: [{ href: "/erin/site/issues/12", label: "#12" }, { href: "/erin/site/blob/main/a.ts", label: "erin/site/a.ts" }] } as any).text;
303 expect(mixed).toContain("<summary>2 links</summary>");
304 expect(mixed).toContain('href="/erin/site/issues/12" title="#12">#12</a>');
305 const { talkCss } = await import("../src/web/pages/talk_client.ts");
306 expect(talkCss).toContain(".talk-agent > .talk-body { margin-bottom: 16px; }");
307 });
308
309 test("the stylesheet keeps the list inside its column, a table inside its box, and the pause control clear of the thread", async () => {
310 const { talkCss } = await import("../src/web/pages/talk_client.ts");
311 // The list's one column may shrink below its longest title, which ends in an ellipsis.
312 expect(talkCss).toContain(".talk-chats { display: grid; grid-template-columns: minmax(0, 1fr);");
313 expect(talkCss).toContain(".talk-chats .row-title { overflow: hidden; text-overflow: ellipsis; }");
314 // A table scrolls inside its own box and never breaks a word or a code value.
315 expect(talkCss).toMatch(/\.talk-body table \{ display: block; max-width: 100%; overflow-x: auto;/);
316 expect(talkCss).toContain(".talk-body td code { white-space: nowrap; }");
317 // While a reply is written the thread keeps a strip at its end for the control, 12 px clear.
318 expect(talkCss).toContain(".talk:has(form[data-answering]) .talk-log { padding-bottom: calc(2.75rem + 24px); }");
319 expect(talkCss).toContain("bottom: calc(100% + 12px);");
320 });
321
293322 test("the server folds a run of things done into one line, \"2 things done\", and leaves one alone as itself", async () => {
294323 const { foldSteps, turnHtml } = await import("../src/web/pages/talk.ts");
295324 const filed = (id: string, n: number) => turnHtml({ id, role: "tool", text: JSON.stringify({ done: true, filed: true, receipt: { verb: "Filed", object: `#${n}`, href: `/a/b/issues/${n}` } }), createdAt: "2026-01-01T00:00:00Z" } as any, new Set());
@@ -371,7 +400,7 @@ describe("the page", () => {
371400 const { talkCss, talkJs } = await import("../src/web/pages/talk_client.ts");
372401 const page = await (await get("/talk", alice)).text();
373402 expect(page).not.toMatch(/tabindex="-1"/);
374 expect(talkCss).toMatch(/\.talk-ask-acts \.btn \{[^}]*min-height: 2\.75rem/);
403 expect(talkCss).toMatch(/\.talk-confirm-acts \.btn \{[^}]*min-height: 2\.75rem/);
375404 expect(talkCss).not.toContain("outline: none");
376405 expect(talkCss).not.toContain("outline: 0");
377406 expect(talkJs).not.toContain('tabindex", "-1"');
@@ -406,7 +435,7 @@ describe("the page", () => {
406435 // form sent to the confirm's own address, and the thread holds no copy of it.
407436 const composer = doc1.querySelector("form.talk-compose");
408437 expect(composer?.getAttribute("method")).toBe("post");
409 const buttons = [...composer!.querySelectorAll(`[data-asks] button[formaction="/talk/confirm/${id}"]`)];
438 const buttons = [...composer!.querySelectorAll(`[data-confirms] button[formaction="/talk/confirm/${id}"]`)];
410439 expect(buttons.map((b) => [b.getAttribute("type"), b.getAttribute("name"), b.getAttribute("value"), b.hasAttribute("formnovalidate")])).toEqual([
411440 ["submit", "answer", "yes", true],
412441 ["submit", "answer", "no", true],
@@ -416,8 +445,8 @@ describe("the page", () => {
416445
417446 test("the page's own bytes are held: stylesheet and script stay small", async () => {
418447 const { talkCss, talkJs } = await import("../src/web/pages/talk_client.ts");
419 expect(Buffer.byteLength(talkCss)).toBeLessThan(16_900);
420 expect(Buffer.byteLength(talkJs)).toBeLessThan(42_300);
448 expect(Buffer.byteLength(talkCss)).toBeLessThan(18_000);
449 expect(Buffer.byteLength(talkJs)).toBeLessThan(43_500);
421450 // A page of its own, so what other tests said to alice never counts: one question and a code reply.
422451 const sizer = await createUser(app.db, { origin: "seed", trusted: true, username: "sizer", email: "[email protected]", password: "a-good-passphrase" });
423452 if (!sizer.ok) throw new Error(sizer.error);
@@ -426,8 +455,9 @@ describe("the page", () => {
426455 const size = (await (await get("/talk", sizer.value)).arrayBuffer()).byteLength;
427456 // Raised from 47,000 by the widgets' rules and no more (widgetCss, 2,495 B raw): they ride every
428457 // Talk page, because a chart can arrive in a live reply, and a page drawn without them would
429 // show it unstyled until a reload. 48,328 measured.
430 expect(size).toBeLessThan(49_500);
458 // show it unstyled until a reload. 48,328 measured. Then to 50,000 by the reply's one last line
459 // and the pane's first-version words: 49,466 measured.
460 expect(size).toBeLessThan(50_000);
431461 });
432462
433463 describe("the script, driven against a DOM", () => {
@@ -521,7 +551,7 @@ describe("the page", () => {
521551 const doc = window.document as any;
522552 doc.body.innerHTML = `<div class="talk" data-talk data-user="${user}" data-c="${conv}" data-paged="0" data-running="1"><header class="talk-head"><details><summary>More</summary></details></header><div>
523553 <ol class="talk-log" role="log" data-last=""><li class="talk-turn talk-agent" id="t-1"><div class="talk-body"><pre><code>let a = 1;</code></pre></div><p class="talk-meta">Forge · now</p></li></ol><div id="end"></div></div>
524 <form class="talk-compose"><div data-asks hidden><p data-asks-count></p><div class="talk-ask-list"></div></div><p data-asks-said></p><div class="talk-box"><div data-chips></div><p data-to-line hidden><span></span><button type="button" data-to-off>x</button></p><textarea name="text" required></textarea><div class="talk-tools"><button type="button" data-attach hidden aria-label="Attach files"></button><input type="file" multiple hidden data-files /><span data-compose-hint></span><button class="btn" type="button" data-steer hidden>Steer</button><button class="btn" type="button" data-stop hidden aria-label="Stop the answer">Stop</button><button class="btn talk-send" type="submit" aria-label="Send">Send</button></div></div><p data-error hidden></p><p class="talk-status" role="status"></p><button type="button" class="btn talk-jump" data-jump hidden><span data-word></span></button></form></div>`;
554 <form class="talk-compose"><div data-confirms hidden><p data-confirms-count></p><div class="talk-confirm-list"></div></div><p data-confirms-said></p><div class="talk-box"><div data-chips></div><p data-to-line hidden><span></span><button type="button" data-to-off>x</button></p><textarea name="text" required></textarea><div class="talk-tools"><button type="button" data-attach hidden aria-label="Attach files"></button><input type="file" multiple hidden data-files /><span data-compose-hint></span><button class="btn" type="button" data-steer hidden>Steer</button><button class="btn" type="button" data-stop hidden aria-label="Stop the answer">Stop</button><button class="btn talk-send" type="submit" aria-label="Send">Send</button></div></div><p data-error hidden></p><p class="talk-status" role="status"></p><button type="button" class="btn talk-jump" data-jump hidden><span data-word></span></button></form></div>`;
525555 const how = { value: "started" };
526556 const cancel = { status: 200 };
527557 const answer = { status: 200 };
@@ -556,10 +586,10 @@ describe("the page", () => {
556586 new Function("document", "window", "EventSource", "fetch", "localStorage", "navigator", "setTimeout", "clearTimeout", talkJs)(doc, window, ES, fetchStub, local, nav, timers.setTimeout, timers.clearTimeout);
557587 const box = doc.querySelector("textarea");
558588 const key = (init: object) => box.dispatchEvent(new window.KeyboardEvent("keydown", { key: "Enter", bubbles: true, cancelable: true, ...init }));
559 const emitAsk = (id: string, ask: string) => sources.at(-1)!.on["turn"]!({ data: JSON.stringify({ id, html: "", ask }) });
589 const emitConfirm = (id: string, held: string) => sources.at(-1)!.on["turn"]!({ data: JSON.stringify({ id, html: "", held }) });
560590 const emit = (id: string, html: string) => sources.at(-1)!.on["turn"]!({ data: JSON.stringify({ id, html }) });
561591 const grow = () => { for (const f of grows) f(); };
562 return { how, cancel, answer, emitAsk, redirects, page, emit, bodies, sources, urls, window, doc, box, sent, copied, store, key, view, grow, hand: () => doc.documentElement.dispatchEvent(new window.PointerEvent("pointerdown", { bubbles: true })), jump: doc.querySelector("[data-jump]"), status: doc.querySelector(".talk-status") };
592 return { how, cancel, answer, emitConfirm, redirects, page, emit, bodies, sources, urls, window, doc, box, sent, copied, store, key, view, grow, hand: () => doc.documentElement.dispatchEvent(new window.PointerEvent("pointerdown", { bubbles: true })), jump: doc.querySelector("[data-jump]"), status: doc.querySelector(".talk-status") };
563593 };
564594 /** An element that scrolls `height` px in a `client` px view; each programmatic move is kept. */
565595 const scrollable = (el: any, height: number, client: number) => {
@@ -1030,40 +1060,40 @@ describe("the page", () => {
10301060 expect(t.sent.at(-1)).toBe("back to the forge");
10311061 });
10321062
1033 test("an ask the stream brings docks above the composer, said once; Do it posts the yes, and the ask leaves the dock", async () => {
1063 test("a confirm the stream brings docks above the composer, said once; Do it posts the yes, and the confirm leaves the dock", async () => {
10341064 const t = await boot();
1035 const dock = t.doc.querySelector("[data-asks]");
1065 const dock = t.doc.querySelector("[data-confirms]");
10361066 expect(dock.hidden).toBe(true);
1037 const { askItem } = await import("../src/web/pages/talk.ts");
1038 const ask = (id: string, does: string) => askItem(id, "archive", does, new Date(Date.now() + 600_000).toISOString()).text;
1039 t.emitAsk("5", ask("h1", "Archive alice/site."));
1040 t.emitAsk("5", ask("h1", "Archive alice/site."));
1041 const said = t.doc.querySelector("[data-asks-said]");
1042 expect([dock.hidden, dock.querySelectorAll(".talk-ask").length, said.textContent]).toEqual([false, 1, "Waiting for your answer: Archive alice/site."]);
1067 const { confirmItem } = await import("../src/web/pages/talk.ts");
1068 const ask = (id: string, does: string) => confirmItem(id, "archive", does, new Date(Date.now() + 600_000).toISOString()).text;
1069 t.emitConfirm("5", ask("h1", "Archive alice/site."));
1070 t.emitConfirm("5", ask("h1", "Archive alice/site."));
1071 const said = t.doc.querySelector("[data-confirms-said]");
1072 expect([dock.hidden, dock.querySelectorAll(".talk-confirm").length, said.textContent]).toEqual([false, 1, "Waiting for your answer: Archive alice/site."]);
10431073 expect(t.doc.querySelector(".talk-log").textContent).not.toContain("Archive alice/site.");
1044 t.emitAsk("6", ask("h2", "Close alice/site#4."));
1045 expect([dock.hasAttribute("data-many"), dock.querySelector("[data-asks-count]").textContent]).toEqual([true, "2 waiting"]);
1074 t.emitConfirm("6", ask("h2", "Close alice/site#4."));
1075 expect([dock.hasAttribute("data-many"), dock.querySelector("[data-confirms-count]").textContent]).toEqual([true, "2 waiting"]);
10461076 // Before the composer in the order, so Tab reaches the ask first.
10471077 const order = [...t.doc.querySelectorAll("form.talk-compose button, form.talk-compose textarea")];
10481078 expect(order.indexOf(dock.querySelector("[data-answer]"))).toBeLessThan(order.indexOf(t.box));
1049 t.doc.querySelector("form.talk-compose").requestSubmit(dock.querySelector('#ask-h1 button[value="yes"]'));
1079 t.doc.querySelector("form.talk-compose").requestSubmit(dock.querySelector('#confirm-h1 button[value="yes"]'));
10501080 await tick();
10511081 expect(t.sent).toEqual(["answer:/talk/confirm/h1:answer=yes"]);
1052 expect([dock.querySelectorAll(".talk-ask").length, dock.querySelector("[data-asks-count]").textContent, said.textContent, t.status.textContent]).toEqual([1, "", "Done.", ""]);
1053 t.doc.querySelector("form.talk-compose").requestSubmit(dock.querySelector('#ask-h2 button[value="no"]'));
1082 expect([dock.querySelectorAll(".talk-confirm").length, dock.querySelector("[data-confirms-count]").textContent, said.textContent, t.status.textContent]).toEqual([1, "", "Done.", ""]);
1083 t.doc.querySelector("form.talk-compose").requestSubmit(dock.querySelector('#confirm-h2 button[value="no"]'));
10541084 await tick();
10551085 expect(t.sent.at(-1)).toBe("answer:/talk/confirm/h2:answer=no");
10561086 expect([dock.hidden, said.textContent]).toEqual([true, "Not now: nothing was done."]);
10571087 });
10581088
1059 test("an ask says its time left under two minutes and, run out, takes its buttons away; nothing ticks", async () => {
1089 test("a confirm says its time left under two minutes and, run out, takes its buttons away; nothing ticks", async () => {
10601090 const due: (() => void)[] = [];
10611091 const timers = { setTimeout: ((f: () => void) => due.push(f)) as unknown as typeof setTimeout, clearTimeout: (() => {}) as unknown as typeof clearTimeout };
10621092 const t = await boot("u1", {}, "c1", timers);
1063 const { askItem } = await import("../src/web/pages/talk.ts");
1064 t.emitAsk("5", askItem("h1", "archive", "Archive alice/site.", new Date(Date.now() + 600_000).toISOString()).text);
1065 const left = t.doc.querySelector("#ask-h1 .talk-ask-left");
1066 const buttons = [...t.doc.querySelectorAll("#ask-h1 button")];
1093 const { confirmItem } = await import("../src/web/pages/talk.ts");
1094 t.emitConfirm("5", confirmItem("h1", "archive", "Archive alice/site.", new Date(Date.now() + 600_000).toISOString()).text);
1095 const left = t.doc.querySelector("#confirm-h1 .talk-confirm-left");
1096 const buttons = [...t.doc.querySelectorAll("#confirm-h1 button")];
10671097 // Two timeouts set, one for each moment: never an interval.
10681098 expect(due.length).toBe(2);
10691099 due.shift()!();
@@ -1074,16 +1104,16 @@ describe("the page", () => {
10741104
10751105 test("an answer hushes only the stream it opens: the next reply is still announced", async () => {
10761106 const t = await boot();
1077 const { askItem } = await import("../src/web/pages/talk.ts");
1078 t.emitAsk("5", askItem("h1", "archive", "Archive alice/site.", new Date(Date.now() + 600_000).toISOString()).text);
1079 t.doc.querySelector("form.talk-compose").requestSubmit(t.doc.querySelector('#ask-h1 button[value="yes"]'));
1107 const { confirmItem } = await import("../src/web/pages/talk.ts");
1108 t.emitConfirm("5", confirmItem("h1", "archive", "Archive alice/site.", new Date(Date.now() + 600_000).toISOString()).text);
1109 t.doc.querySelector("form.talk-compose").requestSubmit(t.doc.querySelector('#confirm-h1 button[value="yes"]'));
10801110 await tick();
10811111 // The answer's own stream ends unannounced.
10821112 t.sources.at(-1)!.on["done"]!({ data: "{}" });
10831113 expect(t.status.textContent).not.toBe("The forge replied.");
10841114 // A send that follows is announced when its reply ends, even had the answer's stream never ended.
1085 t.emitAsk("6", askItem("h2", "archive", "Archive alice/two.", new Date(Date.now() + 600_000).toISOString()).text);
1086 t.doc.querySelector("form.talk-compose").requestSubmit(t.doc.querySelector('#ask-h2 button[value="yes"]'));
1115 t.emitConfirm("6", confirmItem("h2", "archive", "Archive alice/two.", new Date(Date.now() + 600_000).toISOString()).text);
1116 t.doc.querySelector("form.talk-compose").requestSubmit(t.doc.querySelector('#confirm-h2 button[value="yes"]'));
10871117 await tick();
10881118 t.box.value = "and then?";
10891119 t.key({});
@@ -1092,16 +1122,16 @@ describe("the page", () => {
10921122 expect(t.status.textContent).toBe("The forge replied.");
10931123 });
10941124
1095 test("a refused answer keeps the ask, says why, and gives the buttons back", async () => {
1125 test("a refused answer keeps the confirm, says why, and gives the buttons back", async () => {
10961126 const t = await boot();
1097 const { askItem } = await import("../src/web/pages/talk.ts");
1098 t.emitAsk("5", askItem("h1", "archive", "Archive alice/site.", new Date(Date.now() + 600_000).toISOString()).text);
1127 const { confirmItem } = await import("../src/web/pages/talk.ts");
1128 t.emitConfirm("5", confirmItem("h1", "archive", "Archive alice/site.", new Date(Date.now() + 600_000).toISOString()).text);
10991129 t.answer.status = 409;
1100 const yes = t.doc.querySelector('#ask-h1 button[value="yes"]');
1130 const yes = t.doc.querySelector('#confirm-h1 button[value="yes"]');
11011131 t.doc.querySelector("form.talk-compose").requestSubmit(yes);
11021132 await tick();
1103 const left = t.doc.querySelector("#ask-h1 .talk-ask-left");
1104 expect([t.doc.querySelectorAll(".talk-ask").length, left.hidden, left.textContent, yes.disabled]).toEqual([1, false, "this confirm was already answered; it does nothing twice", false]);
1133 const left = t.doc.querySelector("#confirm-h1 .talk-confirm-left");
1134 expect([t.doc.querySelectorAll(".talk-confirm").length, left.hidden, left.textContent, yes.disabled]).toEqual([1, false, "this confirm was already answered; it does nothing twice", false]);
11051135 });
11061136
11071137 test("things done in a row fold into one line as they stream in; one alone stays itself", async () => {
@@ -1132,6 +1162,18 @@ describe("the page", () => {
11321162 expect([file.hasAttribute("data-changed"), file.hasAttribute("tabindex"), !!dir.querySelector("[data-stub]")]).toEqual([true, false, false]);
11331163 });
11341164
1165 test("Display opens as its own dialog from the menu, and its form goes back when it closes", async () => {
1166 const t = await boot();
1167 const opened: unknown[] = [];
1168 (t.window as any).forgeOverlay = { open: (d: any) => { opened.push(d); d.setAttribute("open", ""); } };
1169 t.doc.body.insertAdjacentHTML("beforeend", '<details class="menu" open><summary>More</summary><details class="talk-display"><summary>Display</summary><form><select name="density"></select></form></details></details>');
1170 t.doc.querySelector(".talk-display > summary").dispatchEvent(new t.window.MouseEvent("click", { bubbles: true, cancelable: true }));
1171 const d = t.doc.querySelector("dialog.talk-display-sheet");
1172 expect([opened.length, !!d.querySelector(".dialog-body form select"), t.doc.querySelector("details.menu").open, d.getAttribute("aria-labelledby")]).toEqual([1, true, false, "talk-display-title"]);
1173 d.dispatchEvent(new t.window.Event("close"));
1174 expect([!!t.doc.querySelector(".talk-display > form"), !!t.doc.querySelector("dialog.talk-display-sheet")]).toEqual([true, false]);
1175 });
1176
11351177 test("a code block in a streamed turn gets its Copy button too", async () => {
11361178 const t = await boot();
11371179 t.emit("2", '<li class="talk-turn" id="t-2"><div class="talk-body"><pre><code>x</code></pre></div><p class="talk-meta">Forge</p></li>');
@@ -1182,7 +1224,7 @@ describe("the page", () => {
11821224 test("a reply starting changes the composer, and a follower is at the end in that same moment, before any size is observed", async () => {
11831225 const t = await boot();
11841226 expect(t.view.top).toBe(4200);
1185 // Steer and Stop appear and the composer's row wraps (wider fonts): 52 px more page.
1227 // The action slot changes and the thread keeps its strip for the pause control: 52 px more page.
11861228 t.view.height = 5052;
11871229 t.sources.at(-1)!.on["running"]!({ data: "{}" });
11881230 expect(t.view.top).toBe(4252);
test/talk-steps.test.ts +9
@@ -134,6 +134,15 @@ describe("a repository the person can read", () => {
134134 expect((await commitToBranch(app, user, repo, { message: "start", files: [{ path: "README.md", content: "# site\n" }, { path: "src/a.ts", content: "export const a = 1;\n" }] })).ok).toBe(true);
135135 const build = startChatBuild(app.db, openConversation(app.db, user.id).id, repo.id);
136136 // Before anything changed: the tree alone, from the first moment, never "no files touched yet".
137 // Before a first version the preview tab says what will appear and when, with the files it starts from.
138 const waiting = (await talkPane(ctx, user, "erin/site", works, "preview", apps(undefined, {}), { build, idle: "Your app shows here once its first version is made." })).html.text;
139 expect(waiting).toContain("Your app shows here once its first version is made.");
140 expect(waiting).toContain("The files it starts from");
141 expect(waiting).toContain('class="explorer talk-code-tree"');
142 expect(waiting).not.toContain("data-busy");
143 // While a first version is being made, its words shimmer: only what is under way does.
144 const making = (await talkPane(ctx, user, "erin/site", works, "preview", apps(undefined, {}), { build, idle: "Making the first version.", busy: true })).html.text;
145 expect(making).toContain("data-stage data-busy");
137146 const before = await talkPane(ctx, user, "erin/site", works, "code", apps(undefined, {}), { build });
138147 expect(before.html.text).toContain('class="explorer talk-code-tree"');
139148 expect(before.html.text).toContain('href="/erin/site/blob/main/README.md"');
test/tui-talk-chats.test.ts +12 −1
@@ -275,7 +275,7 @@ describe("the terminal's conversations screen", () => {
275275 const text = await drive(alice, [...open, "/", "Dock here", "\r", "\r"]);
276276 expect(text).toContain("Waiting for you:");
277277 expect(text).toContain("a answers: y does it, n not now.");
278 expect(text).not.toContain("Asks ·");
278 expect(text).not.toContain("Confirm ·");
279279 expect(text.indexOf("Waiting for you:")).toBeGreaterThan(text.indexOf("archive it"));
280280 const confirms = await drive(alice, [...open, "/", "Dock here", "\r", "\r", "a"]);
281281 expect(confirms).toContain("y does it once, as you; n says not now.");
@@ -298,6 +298,17 @@ describe("the terminal's conversations screen", () => {
298298 expect(text).toContain("-export const a = 1;");
299299 });
300300
301 test("the terminal names an answered confirm a confirm, as the page does, never an ask", async () => {
302 const made = createConversation(app.db, alice.id);
303 if (!made.ok) throw new Error(made.error);
304 appendTurn(app.db, alice.id, made.value.id, { role: "person", text: "archive it" });
305 appendTurn(app.db, alice.id, made.value.id, { role: "confirm", text: JSON.stringify({ confirm: "gone", tool: "archive", does: "Archive it." }) });
306 renameConversation(app.db, alice.id, made.value.id, "Confirm here");
307 const text = await drive(alice, [...open, "/", "Confirm here", "\r", "\r"]);
308 expect(text).toContain("Confirm · ");
309 expect(text).not.toContain("Asks ·");
310 });
311
301312 test("turns are read when the chat opens and on r, not on every draw", async () => {
302313 const made = createConversation(app.db, bob.id);
303314 if (!made.ok) throw new Error(made.error);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs