Skip to content

armgit / kwant

Public Imported from GitHub
0

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.

Inbox: Done, and here's the check card (UI) (#577)

Oleksandr Ivanchenkoe036b283a660
diff --git a/frontend/src/api/inbox.ts b/frontend/src/api/inbox.ts
index 6085af16..0c3d9f7b 100644
--- a/frontend/src/api/inbox.ts
+++ b/frontend/src/api/inbox.ts
@@ -150,6 +150,8 @@ export interface DoneTrailStep {
by: string | null;
}
+import type { Checked } from '../doneCheck';
+
export type DoneSource =
| { kind: 'routine'; routine_id: string; run_id: string; trigger: string; task_id?: string }
| { kind: 'task'; task_id: string }
@@ -184,6 +186,11 @@ export interface DoneFields {
/** Team jobs only: who led it and whom it handed work to. */
lead?: TeamMember;
members?: TeamMember[];
+ /**
+ * 0.9.8 done-check (Vega #566): whether anything checked this done item, and how. Optional: an older server
+ * sends none and the Inbox draws no check box. Read it through doneCheck.knownChecked.
+ */
+ checked?: Checked | null;
}
// `task_id` is a review's task (ReviewFields) or a watch item's (P1, null when none), so it takes both.
diff --git a/frontend/src/components/DoneCheck.tsx b/frontend/src/components/DoneCheck.tsx
new file mode 100644
index 00000000..2cfe58ee
--- /dev/null
+++ b/frontend/src/components/DoneCheck.tsx
@@ -0,0 +1,153 @@
+// 0.9.8 done-check (autonomy/done-check/design.md): one box between the chips and the answer that says whether
+// anything checked a done item, with each check on demand; and the one-word marker on done rows in the list.
+// Server text (line, what, how, evidence) is drawn as text only, never as links or HTML.
+
+import React, { useId, useState } from 'react';
+import { AlertTriangle, Check, ChevronDown, CircleDashed, Clock, Shield, ShieldCheck, ShieldHalf, ShieldX, X, type LucideIcon } from 'lucide-react';
+import {
+ ADD_A_CHECK,
+ type Checked,
+ type CheckState,
+ EMPTY_HELP,
+ ITEM_COLOUR,
+ ITEM_WORD,
+ type ItemKind,
+ MARKER,
+ SECTION_LABEL,
+ STATE_STYLE,
+ droppedLine,
+ howText,
+ itemKind,
+ splitLine,
+ toggleLabel,
+} from '../doneCheck';
+import { Sticker } from './Sticker';
+
+const linkBtn = 'kw-focus kw-hit inline-flex items-center gap-0.5 rounded text-meta font-semibold text-violet-300 hover:text-violet-200';
+
+const STATE_ICON: Record<CheckState, LucideIcon> = {
+ checked: ShieldCheck,
+ partly: ShieldHalf,
+ failed: ShieldX,
+ not_checked: Shield,
+};
+
+const ITEM_ICON: Record<ItemKind, { Icon: LucideIcon; cls: string }> = {
+ passed: { Icon: Check, cls: 'text-ok' },
+ failed: { Icon: X, cls: 'text-bad' },
+ waiting: { Icon: Clock, cls: 'text-zinc-300' },
+ not_checked: { Icon: CircleDashed, cls: 'text-zinc-400' },
+ claim: { Icon: AlertTriangle, cls: 'text-warn' },
+};
+
+export const DoneCheck: React.FC<{
+ checked: Checked & { state: CheckState };
+ /** "Add a check" on an empty box: only for a routine whose editor is wired. */
+ onAddCheck?: () => void;
+}> = ({ checked, onAddCheck }) => {
+ const listId = `${useId()}-checks`;
+ const state = checked.state;
+ const style = STATE_STYLE[state];
+ const [open, setOpen] = useState(style.open);
+ const { prefix, rest } = splitLine(state, checked.line);
+ const Icon = STATE_ICON[state];
+ const items = checked.items;
+ const n = items.length + checked.items_dropped;
+ return (
+ <section aria-label={SECTION_LABEL} data-done-check={state} className={`rounded-2xl border px-4 py-3 flex flex-col gap-2 min-w-0 ${style.box}`}>
+ <p className="grid grid-cols-[16px_minmax(0,1fr)] gap-x-2.5 text-body text-zinc-100" data-check-line>
+ <Icon size={16} className={`mt-[3px] ${style.icon}`} aria-hidden="true" />
+ <span className="min-w-0 break-words [overflow-wrap:anywhere]">
+ {prefix ? (
+ <>
+ <b className={`font-semibold ${style.prefix}`} data-check-prefix>
+ {prefix}
+ </b>{' '}
+ {rest}
+ </>
+ ) : (
+ rest
+ )}
+ </span>
+ </p>
+ {items.length > 0 ? (
+ <>
+ <div className="ml-[26px]">
+ <button type="button" aria-expanded={open} aria-controls={listId} onClick={() => setOpen((o) => !o)} className={linkBtn} data-compact data-check-toggle>
+ {toggleLabel(open, n)}
+ <ChevronDown size={14} aria-hidden="true" className={`transition-transform motion-reduce:transition-none ${open ? 'rotate-180' : ''}`} />
+ </button>
+ </div>
+ <ul id={listId} hidden={!open} className={`ml-[26px] border-t border-hairline ${open ? 'kw-fade-in' : ''}`} data-check-list>
+ {items.map((it, i) => {
+ const kind = itemKind(it);
+ const { Icon: ItemIcon, cls } = ITEM_ICON[kind];
+ return (
+ <li key={i} className="grid grid-cols-[14px_minmax(0,1fr)] gap-x-2.5 py-2 border-b border-hairline last:border-b-0" data-check-item={kind}>
+ <ItemIcon size={14} className={`mt-1 ${cls}`} aria-hidden="true" />
+ <div className="min-w-0">
+ <p className="text-body text-zinc-100 break-words [overflow-wrap:anywhere]" data-check-what>
+ {it.what}
+ </p>
+ <p className="text-meta break-words [overflow-wrap:anywhere]">
+ <span className={`font-semibold ${ITEM_COLOUR[kind]}`} data-check-result>
+ {ITEM_WORD[kind]}
+ </span>
+ {howText(it.how) && <span className="text-zinc-400"> · {howText(it.how)}</span>}
+ </p>
+ {typeof it.evidence === 'string' && it.evidence.trim() !== '' && (
+ <p className="mt-1 border-l-2 border-hairline-strong pl-2 text-meta text-zinc-300 whitespace-pre-wrap break-words [overflow-wrap:anywhere]" data-check-evidence>
+ {it.evidence}
+ </p>
+ )}
+ </div>
+ </li>
+ );
+ })}
+ </ul>
+ {checked.items_dropped > 0 && (
+ <p className="ml-[26px] text-meta text-zinc-400" data-check-dropped>
+ {droppedLine(checked.items_dropped)}
+ </p>
+ )}
+ </>
+ ) : (
+ <p className="ml-[26px] text-meta leading-6 text-zinc-400" data-check-help>
+ {EMPTY_HELP}
+ {onAddCheck && (
+ <>
+ {' '}
+ <button type="button" onClick={onAddCheck} className={linkBtn} data-compact data-add-check>
+ {ADD_A_CHECK}
+ </button>
+ </>
+ )}
+ </p>
+ )}
+ </section>
+ );
+};
+
+/** The list row's marker before the summary: the holo sticker for Checked, words for the rest. */
+export const CheckMarker: React.FC<{ state: CheckState; summary: React.ReactNode }> = ({ state, summary }) => {
+ const has = summary !== null && summary !== undefined && summary !== '';
+ if (state === 'checked') {
+ return (
+ <>
+ <Sticker tone="holo" size="sm" tilt={-2} icon={<ShieldCheck size={10} aria-hidden />}>
+ {MARKER.checked.word}
+ </Sticker>
+ {has && <> {summary}</>}
+ </>
+ );
+ }
+ const m = MARKER[state];
+ return (
+ <>
+ <span className={m.cls} data-check-marker={state}>
+ {m.word}
+ </span>
+ {has && <> · {summary}</>}
+ </>
+ );
+};
diff --git a/frontend/src/components/DoneDetail.tsx b/frontend/src/components/DoneDetail.tsx
index 516c906c..df475841 100644
--- a/frontend/src/components/DoneDetail.tsx
+++ b/frontend/src/components/DoneDetail.tsx
@@ -29,6 +29,8 @@ import {
trailHeading,
whyLead,
} from '../doneAway';
+import { knownChecked } from '../doneCheck';
+import { DoneCheck } from './DoneCheck';
import { MarkdownRenderer } from './MarkdownRenderer';
import { ModernAvatar } from './ModernAvatar';
@@ -134,14 +136,17 @@ const label = 'text-[11px] font-semibold uppercase tracking-[0.06em] text-zinc-4
// 44×44 tap area, so the chip and the Why line keep their own height.
const linkBtn = 'kw-focus kw-hit inline-flex items-center gap-0.5 rounded text-meta font-semibold text-violet-300 hover:text-violet-200';
-/** "Read only · changed nothing" and "No checks set · Add one". */
+/**
+ * "Read only · changed nothing" and "No checks set · Add one". With a done-check box (the item has `checked`),
+ * the box says "Not checked" and carries "Add a check", so the chip is left out.
+ */
export const DoneChips: React.FC<{
item: InboxItem;
d: DoneDetailData;
onAddCheck?: () => void;
}> = ({ item, d, onAddCheck }) => {
const changed = changedState(item, d.message);
- const noChecks = noChecksSet(item);
+ const noChecks = noChecksSet(item) && !knownChecked(item.checked);
if (changed !== false && !noChecks) return null;
return (
<div className="flex flex-wrap items-center gap-1.5" data-done-chips>
@@ -173,6 +178,21 @@ export const DoneChips: React.FC<{
);
};
+/** The chips, then the done-check box when the server sent `checked` (design.md: the trust line before the answer). */
+export const DoneChipsAndCheck: React.FC<{
+ item: InboxItem;
+ d: DoneDetailData;
+ onAddCheck?: () => void;
+}> = ({ item, d, onAddCheck }) => {
+ const checked = knownChecked(item.checked);
+ return (
+ <>
+ <DoneChips item={item} d={d} onAddCheck={onAddCheck} />
+ {checked && <DoneCheck key={item.id} checked={checked} onAddCheck={onAddCheck} />}
+ </>
+ );
+};
+
/** The answer, "What <bot> did" and "Why", in the mockup's order. */
export const DoneSections: React.FC<{
item: InboxItem;
@@ -344,7 +364,7 @@ export const DoneItemView: React.FC<{
</p>
</div>
</header>
- <DoneChips item={item} d={d} onAddCheck={d.routine && onEditRoutine ? () => onEditRoutine(d.routine!.id) : undefined} />
+ <DoneChipsAndCheck item={item} d={d} onAddCheck={d.routine && onEditRoutine ? () => onEditRoutine(d.routine!.id) : undefined} />
<DoneSections item={item} d={d} place={place} onOpenChat={onOpenChat} onEditRoutine={onEditRoutine} />
{onOpenChat && (
<div className={phone ? 'grid gap-2' : 'flex flex-wrap gap-2'} data-actions>
diff --git a/frontend/src/components/InboxNew.tsx b/frontend/src/components/InboxNew.tsx
index 8dfae87e..c021621c 100644
--- a/frontend/src/components/InboxNew.tsx
+++ b/frontend/src/components/InboxNew.tsx
@@ -26,8 +26,10 @@ import { ModernAvatar } from './ModernAvatar';
import { ModernApprovalCard } from './ModernApprovalCard';
import { ReviewDone, VERDICT_STYLE } from './ReviewItemStub';
import { ReviewItemView } from './ReviewItemView';
-import { type DoneApi, type DoneDetailData, type MessageTarget, DoneChips, DoneItemView, DoneSections, defaultDoneApi, useDoneDetail } from './DoneDetail';
+import { type DoneApi, type DoneDetailData, type MessageTarget, DoneChipsAndCheck, DoneItemView, DoneSections, defaultDoneApi, useDoneDetail } from './DoneDetail';
import { DONE_EMPTY, DONE_FOOTER, changedState, doneTitle, isDoneGroup, isRoutineItem, isUnread, metaLine, rowKicker, sectionItems, teamSize, unreadLine } from '../doneAway';
+import { knownChecked, listsCriteria } from '../doneCheck';
+import { CheckMarker, DoneCheck } from './DoneCheck';
import { usePhoneLayout } from '../usePhoneLayout';
import { approvalFromAway, awayTitle, lateAnswerText } from '../approvals';
import { ApprovalDecision, AwayError, AwayItem, actionFailureNotice, awayApi, awaySummary, itemLabel, stoppedAction, windowLabel } from '../away';
@@ -236,6 +238,8 @@ const QueueRow: React.FC<RowProps> = ({ item, selected, focusable, wide, busy, o
const who = (item.kind === 'team_job' ? teamSize(item) : null) ?? item.kwant_name;
const unread = isUnread(item);
const doneRow = !review && isDoneGroup(item.group) && opensInPane(item);
+ // done-check: one word before the summary on done rows whose item says how it was checked.
+ const check = isDoneGroup(item.group) ? knownChecked(item.checked) : null;
return (
<li role="presentation" className={`relative rounded-xl border transition-colors ${tint}`} data-row={item.id} data-group={item.group}>
<div
@@ -278,15 +282,15 @@ const QueueRow: React.FC<RowProps> = ({ item, selected, focusable, wide, busy, o
</span>
<span className="block mt-0.5 text-sm font-semibold text-zinc-100 break-words max-md:line-clamp-3 md:truncate">{title}</span>
<span className="block mt-1 text-xs">
- {review && doneSummary ? (
+ {review && (doneSummary || check) ? (
<span className="block text-zinc-400 max-md:line-clamp-2 md:truncate" data-done-summary>
- {doneSummary}
+ {check ? <CheckMarker state={check.state} summary={doneSummary || item.summary || null} /> : doneSummary}
</span>
) : review ? (
<ReviewSubline item={review} />
- ) : doneRow && item.summary ? (
+ ) : doneRow && (item.summary || check) ? (
<span className="block text-zinc-400 max-md:line-clamp-2 md:truncate" data-done-summary>
- {item.summary}
+ {check ? <CheckMarker state={check.state} summary={item.summary || null} /> : item.summary}
</span>
) : (
<AwaySubline item={item} />
@@ -620,7 +624,11 @@ const ItemPane: React.FC<{
const phone = usePhoneLayout();
const d = useDoneDetail(item, runItem, api ?? defaultDoneApi, initial);
const doneLayout = isDoneGroup(item.group) && (!isReview(item) || isRoutineItem(item));
- if (isReview(item) && !doneLayout) return <ReviewItemView item={item} entry={entry} onDone={onDone} onHeldResolved={onHeldResolved} />;
+ if (isReview(item) && !doneLayout) {
+ // done-check: a to-review task in Done keeps the full review layout and gets the check box above the verdict.
+ const checked = isDoneGroup(item.group) ? knownChecked(item.checked) : null;
+ return <ReviewItemView item={item} entry={entry} onDone={onDone} onHeldResolved={onHeldResolved} checkBox={checked ? <DoneCheck key={item.id} checked={checked} /> : undefined} />;
+ }
const target = d.target ?? servedTarget(item);
const openChat = () => (target && onOpenMessage ? onOpenMessage(target) : onOpenItemChat(runItem ?? item));
// Part B's result_link names where the answer is when the routine isn't loaded (and for team jobs).
@@ -638,9 +646,10 @@ const ItemPane: React.FC<{
done={{
title: doneTitle(item),
meta: metaLine(item, d.routine, d.run),
- chips: <DoneChips item={item} d={d} onAddCheck={edit} />,
+ chips: <DoneChipsAndCheck item={item} d={d} onAddCheck={edit} />,
body: <DoneSections item={item} d={d} place={place} onOpenChat={openChat} onEditRoutine={onEditRoutine} />,
changed: changedState(item, d.message),
+ hideCriteria: listsCriteria(knownChecked(item.checked)),
}}
/>
);
diff --git a/frontend/src/components/ReviewItemView.tsx b/frontend/src/components/ReviewItemView.tsx
index 8e8e5c03..f49af70e 100644
--- a/frontend/src/components/ReviewItemView.tsx
+++ b/frontend/src/components/ReviewItemView.tsx
@@ -104,6 +104,11 @@ export interface ReviewItemViewProps {
onHeldResolved?: (approvalId: string, status: Exclude<HeldStatus, 'pending'>) => void;
/** The phone page draws its own top bar with the title; the view then starts at the chips. */
hideTitle?: boolean;
+ /**
+ * done-check: the "How it was checked" box for a to-review task in Done that opens in this full layout
+ * (the done layout passes it inside `done.chips` instead). Drawn where the chips go, above the verdict.
+ */
+ checkBox?: React.ReactNode;
/**
* 0.9.5 F, a done item in the Inbox (a routine's review task): its own title and meta line, the chips, and
* the answer, trail and Why above the actions. The verdict box then shows only when there is a verdict.
@@ -114,6 +119,8 @@ export interface ReviewItemViewProps {
chips: React.ReactNode;
body: React.ReactNode;
changed: boolean | null;
+ /** done-check: the check box above already lists each task criterion and its evidence. */
+ hideCriteria?: boolean;
};
}
@@ -187,6 +194,7 @@ const ReviewBody: React.FC<ReviewItemViewProps & { item: ReviewItem }> = ({
onHeldResolved,
hideTitle = false,
done: doneView,
+ checkBox,
}) => {
const phone = usePhoneLayout();
const uid = useId();
@@ -386,10 +394,10 @@ const ReviewBody: React.FC<ReviewItemViewProps & { item: ReviewItem }> = ({
const lockAll = done || busy !== null;
const changed = doneView ? doneView.changed : typeof item.changed === 'boolean' ? item.changed : null;
const rollbackShown = rollbackFor(item, changed);
- const showVerdict = !doneView || checking || v.result !== 'none';
+ const showVerdict = checking || v.result !== 'none' || (!doneView && !checkBox);
// The done layout (0.9.5 F) leaves out what has nothing to say: a low risk chip, no criteria, no evidence.
const showRisk = !!item.risk.level && !(doneView && item.risk.level === 'low');
- const showCriteria = !doneView || item.criteria.length > 0;
+ const showCriteria = !doneView || (item.criteria.length > 0 && !doneView.hideCriteria);
const ev = item.evidence;
const showEvidence = !doneView || ev.checks.length > 0 || ev.screenshots.length > 0 || !!ev.pr;
@@ -445,6 +453,7 @@ const ReviewBody: React.FC<ReviewItemViewProps & { item: ReviewItem }> = ({
</header>
{doneView?.chips}
+ {!doneView && checkBox}
{doneView?.body}
{/* Verdict */}
diff --git a/frontend/src/doneCheck.ts b/frontend/src/doneCheck.ts
new file mode 100644
index 00000000..3fb5ea37
--- /dev/null
+++ b/frontend/src/doneCheck.ts
@@ -0,0 +1,108 @@
+// 0.9.8 done-check (autonomy/done-check/design.md, Mira): the "Done, and here's the check" box and the list
+// row marker read the `checked` object Vega's #566 puts on every done item in GET /api/inbox. Server text is
+// text only; nothing here computes a new number, it only picks words for the server's state and results.
+
+export type CheckState = 'checked' | 'partly' | 'not_checked' | 'failed';
+export type CheckResult = 'passed' | 'failed' | 'waiting' | 'not_checked';
+
+export interface CheckedItem {
+ what: string;
+ how: string;
+ result: CheckResult | string;
+ evidence: string | null;
+}
+
+export interface Checked {
+ state: CheckState | string;
+ items: CheckedItem[];
+ items_dropped: number;
+ line: string;
+}
+
+const STATES: readonly CheckState[] = ['checked', 'partly', 'not_checked', 'failed'];
+
+/** The `checked` object when it has a known state; null for an older server or anything malformed. */
+export function knownChecked(v: unknown): (Checked & { state: CheckState }) | null {
+ if (!v || typeof v !== 'object') return null;
+ const c = v as Partial<Checked>;
+ if (typeof c.state !== 'string' || !(STATES as readonly string[]).includes(c.state)) return null;
+ const items = Array.isArray(c.items)
+ ? c.items.filter((i): i is CheckedItem => !!i && typeof i === 'object' && typeof (i as CheckedItem).what === 'string')
+ : [];
+ const dropped = typeof c.items_dropped === 'number' && Number.isFinite(c.items_dropped) && c.items_dropped > 0 ? Math.floor(c.items_dropped) : 0;
+ return { state: c.state as CheckState, items, items_dropped: dropped, line: typeof c.line === 'string' ? c.line : '' };
+}
+
+/** design.md section 4: the line when the server's is blank. */
+export const FALLBACK_LINE: Record<CheckState, string> = {
+ checked: 'Checked: every check passed.',
+ partly: 'Partly checked: some checks passed.',
+ failed: 'Failed: a check failed.',
+ not_checked: 'Not checked: nothing verified this result.',
+};
+
+/** Splits "Partly checked: 1 of 2 …" into its prefix (with the colon) and the rest; no match draws it whole. */
+export function splitLine(state: CheckState, line: string): { prefix: string | null; rest: string } {
+ const text = line.trim() ? line.trim() : FALLBACK_LINE[state];
+ const m = /^(Checked|Partly checked|Failed|Not checked):\s*/.exec(text);
+ if (!m) return { prefix: null, rest: text };
+ return { prefix: `${m[1]}:`, rest: text.slice(m[0].length) };
+}
+
+/** Box tone per state (design.md section 1 table). */
+export const STATE_STYLE: Record<CheckState, { box: string; icon: string; prefix: string; open: boolean }> = {
+ checked: { box: 'border-teal-300/25 bg-teal-300/[0.05]', icon: 'text-ok', prefix: 'text-ok', open: false },
+ partly: { box: 'border-amber-300/30 bg-amber-300/[0.05]', icon: 'text-warn', prefix: 'text-warn', open: false },
+ failed: { box: 'border-rose-300/35 bg-rose-300/[0.06]', icon: 'text-bad', prefix: 'text-bad', open: true },
+ not_checked: { box: 'border-dashed border-hairline-strong bg-transparent', icon: 'text-zinc-400', prefix: 'text-zinc-200', open: false },
+};
+
+export type ItemKind = 'passed' | 'failed' | 'waiting' | 'not_checked' | 'claim';
+
+/** A claim: "marked met with no evidence (a claim)". Any unknown result reads as not checked, never passed. */
+export function itemKind(i: Pick<CheckedItem, 'result' | 'how'>): ItemKind {
+ if (i.result === 'passed' || i.result === 'failed' || i.result === 'waiting') return i.result;
+ return typeof i.how === 'string' && i.how.includes('(a claim)') ? 'claim' : 'not_checked';
+}
+
+export const ITEM_WORD: Record<ItemKind, string> = {
+ passed: 'Passed',
+ failed: 'Failed',
+ waiting: 'Still waiting',
+ not_checked: 'Not checked',
+ claim: 'Not checked',
+};
+
+export const ITEM_COLOUR: Record<ItemKind, string> = {
+ passed: 'text-ok',
+ failed: 'text-bad',
+ waiting: 'text-zinc-300',
+ not_checked: 'text-zinc-400',
+ claim: 'text-warn',
+};
+
+/** how's first letter capitalised, unless it starts with "kwant". */
+export function howText(how: string): string {
+ const t = typeof how === 'string' ? how.trim() : '';
+ if (!t || t.startsWith('kwant')) return t;
+ return t.charAt(0).toUpperCase() + t.slice(1);
+}
+
+export const toggleLabel = (open: boolean, n: number): string => (open ? 'Hide what was checked' : `Show what was checked (${n})`);
+export const droppedLine = (n: number): string => `${n} more not shown.`;
+export const EMPTY_HELP = 'Read the answer before you rely on it.';
+export const ADD_A_CHECK = 'Add a check';
+export const SECTION_LABEL = 'How it was checked';
+
+/** The review layout drops "What done looks like" when the box already lists the task's criteria. */
+export function listsCriteria(c: Checked | null): boolean {
+ return !!c && c.items.some((i) => typeof i.how === 'string' && i.how.startsWith('task criterion'));
+}
+
+/** List row marker words (design.md section 2). */
+export const MARKER: Record<CheckState, { word: string; cls: string }> = {
+ checked: { word: 'Checked', cls: '' },
+ partly: { word: 'Partly checked', cls: 'font-semibold text-warn' },
+ failed: { word: 'Check failed', cls: 'font-semibold text-bad' },
+ not_checked: { word: 'Not checked', cls: 'font-medium text-zinc-300' },
+};
diff --git a/frontend/src/doneCheckFixture.ts b/frontend/src/doneCheckFixture.ts
new file mode 100644
index 00000000..4e99344e
--- /dev/null
+++ b/frontend/src/doneCheckFixture.ts
@@ -0,0 +1,50 @@
+// done-check samples for tests and shots. The partly, checked and not-checked objects are Vega's real
+// GET /api/inbox output from #566 (autonomy/done-check/impl.md, "Real sample"); the failed one and the long
+// URL are made-up data in the same shape.
+import type { Checked } from './doneCheck';
+
+export const CHECKED_PARTLY: Checked = {
+ state: 'partly',
+ items: [
+ { what: 'https://kwant.si/pricing', how: 'opened the address', result: 'passed', evidence: 'HTTP 200 in 212 ms' },
+ { what: 'npm run check-prices', how: 'ran the command', result: 'not_checked', evidence: null },
+ {
+ what: 'The three plan prices match the plan sheet',
+ how: 'task criterion, met with evidence',
+ result: 'passed',
+ evidence: 'Pricing page preview: https://kwant.si/pricing',
+ },
+ { what: 'The FAQ mentions the yearly discount', how: 'task criterion, marked met with no evidence (a claim)', result: 'not_checked', evidence: null },
+ ],
+ items_dropped: 0,
+ line: 'Partly checked: 1 of 2 checks passed, 1 of 2 criteria have evidence.',
+};
+
+export const CHECKED_OK: Checked = {
+ state: 'checked',
+ items: [{ what: 'The link you asked for', how: 'kwant compared the reply with what you asked for', result: 'passed', evidence: 'the link is in the reply' }],
+ items_dropped: 0,
+ line: 'Checked: the link you asked for is in the reply.',
+};
+
+export const CHECKED_NONE: Checked = { state: 'not_checked', items: [], items_dropped: 0, line: 'Not checked: nothing verified this result.' };
+
+export const CHECKED_FAILED: Checked = {
+ state: 'failed',
+ items: [
+ {
+ what: 'cargo test --locked',
+ how: 'ran the command',
+ result: 'failed',
+ evidence: 'test inbox_done::a_failed_check_fails_the_item ... FAILED\nthread panicked at src/server/inbox_done.rs:412:5',
+ },
+ { what: 'The product photos are 1200 px wide', how: 'task criterion, marked not met', result: 'failed', evidence: null },
+ { what: 'https://shop.example/products/spring-blend', how: 'opened the address', result: 'passed', evidence: 'HTTP 200 in 340 ms' },
+ { what: 'Review by Rigel', how: 'a teammate’s review', result: 'waiting', evidence: null },
+ ],
+ items_dropped: 2,
+ line: 'Failed: 1 of 5 checks failed, the criterion is not met.',
+};
+
+/** A 120-character URL for the 390 px overflow check. */
+export const LONG_URL = 'https://shop.example/products/spring-blend/variants/house-blend-1kg/photos/originals/2026-11-13/front-view-large.jpg?v=1';
diff --git a/frontend/tests/doneCheck.test.mjs b/frontend/tests/doneCheck.test.mjs
new file mode 100644
index 00000000..2450ccc0
--- /dev/null
+++ b/frontend/tests/doneCheck.test.mjs
@@ -0,0 +1,324 @@
+// 0.9.8 done-check (autonomy/done-check/design.md section 5): the "Done, and here's the check" box in both done
+// layouts and the one-word marker on done rows. Data: Vega's #566 `checked` object (impl.md, real sample).
+process.env.TZ = 'UTC';
+import assert from 'node:assert/strict';
+import test from 'node:test';
+import { JSDOM } from 'jsdom';
+import { loadBundled } from './bundle.mjs';
+
+const dom = new JSDOM('<!doctype html><html><body></body></html>', { url: 'http://localhost/inbox', pretendToBeVisual: true });
+const g = globalThis;
+for (const k of ['window', 'document', 'navigator', 'HTMLElement', 'HTMLButtonElement', 'HTMLTextAreaElement', 'HTMLInputElement', 'Element', 'Node', 'Event', 'CustomEvent', 'MouseEvent', 'KeyboardEvent', 'FocusEvent', 'DOMParser', 'requestAnimationFrame', 'cancelAnimationFrame', 'getComputedStyle', 'localStorage', 'sessionStorage']) {
+ if (!(k in dom.window)) continue;
+ Object.defineProperty(g, k, { value: dom.window[k], configurable: true, writable: true });
+}
+g.IS_REACT_ACT_ENVIRONMENT = false;
+g.fetch = async () => ({ ok: false, status: 404, json: async () => ({}) });
+
+const m = await loadBundled(`
+ export { default as React } from 'react';
+ export { createRoot } from 'react-dom/client';
+ export * as dc from './src/doneCheck';
+ export * as cx from './src/doneCheckFixture';
+ export * as fx from './src/doneAwayFixture';
+ export * as store from './src/inboxStore';
+ export { InboxNew } from './src/components/InboxNew';
+ export { DoneItemView } from './src/components/DoneDetail';
+ export { DoneCheck, CheckMarker } from './src/components/DoneCheck';
+`);
+const { React, createRoot, dc, cx, fx, store: s } = m;
+const h = React.createElement;
+const settle = async (n = 12) => {
+ for (let i = 0; i < n; i++) await new Promise((r) => setTimeout(r, 0));
+};
+const clone = (x) => JSON.parse(JSON.stringify(x));
+const click = async (b) => {
+ b.dispatchEvent(new MouseEvent('click', { bubbles: true }));
+ await settle();
+};
+const text = (e) => e.textContent.replace(/\s+/g, ' ').trim();
+
+async function mount(node) {
+ document.body.innerHTML = '';
+ const el = document.createElement('div');
+ document.body.appendChild(el);
+ const root = createRoot(el);
+ root.render(node);
+ await settle();
+ return { el, root, q: (x) => el.querySelector(x), qa: (x) => [...el.querySelectorAll(x)] };
+}
+
+const box = (checked, props = {}) => mount(h(m.DoneCheck, { checked: dc.knownChecked(checked), ...props }));
+
+async function mountInbox(props = {}, data = clone(fx.AWAY_INBOX)) {
+ document.body.innerHTML = '';
+ sessionStorage.clear();
+ window.history.replaceState(null, '', '/inbox');
+ s.inboxStore.reset();
+ s.inboxSource.get = async () => data;
+ s.inboxStore.patch({ data });
+ const el = document.createElement('div');
+ document.body.appendChild(el);
+ const root = createRoot(el);
+ root.render(h(m.InboxNew, { onOpen: () => {}, noLoad: true, wide: true, now: Date.parse(data.now), placeName: fx.awayPlaceName, ...props }));
+ await settle();
+ return { el, root, q: (x) => el.querySelector(x), qa: (x) => [...el.querySelectorAll(x)] };
+}
+
+const withChecked = (id, checked) => {
+ const data = clone(fx.AWAY_INBOX);
+ data.items.find((i) => i.id === id).checked = clone(checked);
+ return data;
+};
+
+test('each state draws its box classes, its icon and its prefix colour; failed starts open, the rest folded', async () => {
+ const want = {
+ checked: { box: 'border-teal-300/25', icon: 'lucide-shield-check', prefix: 'text-ok', open: false, sample: cx.CHECKED_OK, word: 'Checked:' },
+ partly: { box: 'border-amber-300/30', icon: 'lucide-shield-half', prefix: 'text-warn', open: false, sample: cx.CHECKED_PARTLY, word: 'Partly checked:' },
+ failed: { box: 'border-rose-300/35', icon: 'lucide-shield-x', prefix: 'text-bad', open: true, sample: cx.CHECKED_FAILED, word: 'Failed:' },
+ not_checked: { box: 'border-dashed', icon: 'lucide-shield', prefix: 'text-zinc-200', open: false, sample: cx.CHECKED_NONE, word: 'Not checked:' },
+ };
+ for (const [state, w] of Object.entries(want)) {
+ const { q, root } = await box(w.sample);
+ const sec = q('section');
+ assert.equal(sec.getAttribute('aria-label'), 'How it was checked');
+ assert.equal(sec.getAttribute('data-done-check'), state);
+ assert.match(sec.className, new RegExp(w.box.replace(/[/[\].]/g, '\\$&')), `${state} box`);
+ const icon = q('[data-check-line] svg');
+ assert.ok(icon.classList.contains(w.icon), `${state} icon ${icon.getAttribute('class')}`);
+ assert.equal(icon.getAttribute('aria-hidden'), 'true');
+ assert.equal(q('[data-check-prefix]').textContent, w.word);
+ assert.ok(q('[data-check-prefix]').classList.contains(w.prefix), `${state} prefix colour`);
+ assert.equal(text(q('[data-check-line]')), w.sample.line, 'the server line as sent');
+ const t = q('[data-check-toggle]');
+ if (w.sample.items.length) {
+ assert.equal(t.getAttribute('aria-expanded'), String(w.open));
+ assert.equal(t.getAttribute('aria-controls'), q('[data-check-list]').id);
+ assert.equal(q('[data-check-list]').hidden, !w.open);
+ } else assert.equal(t, null);
+ root.unmount();
+ }
+});
+
+test('the line: unknown prefix drawn whole, blank line uses the fallback words', async () => {
+ assert.deepEqual(dc.splitLine('partly', 'Partly checked: 1 of 2 checks passed.'), { prefix: 'Partly checked:', rest: '1 of 2 checks passed.' });
+ assert.deepEqual(dc.splitLine('checked', 'All good here.'), { prefix: null, rest: 'All good here.' });
+ assert.equal(dc.splitLine('checked', '').prefix + ' ' + dc.splitLine('checked', '').rest, 'Checked: every check passed.');
+ assert.equal(dc.FALLBACK_LINE.partly, 'Partly checked: some checks passed.');
+ assert.equal(dc.FALLBACK_LINE.failed, 'Failed: a check failed.');
+ assert.equal(dc.FALLBACK_LINE.not_checked, 'Not checked: nothing verified this result.');
+ const { q, root } = await box({ ...cx.CHECKED_FAILED, line: ' ' });
+ assert.equal(text(q('[data-check-line]')), 'Failed: a check failed.');
+ root.unmount();
+});
+
+test('toggle: Show what was checked (n) / Hide, chevron turns, the open list has each check in server order', async () => {
+ const { q, qa, root } = await box(cx.CHECKED_PARTLY);
+ const t = q('[data-check-toggle]');
+ assert.equal(text(t), 'Show what was checked (4)');
+ assert.ok(t.hasAttribute('data-compact'));
+ assert.match(t.className, /kw-focus/);
+ assert.match(t.className, /kw-hit/);
+ assert.match(t.querySelector('svg').getAttribute('class'), /motion-reduce:transition-none/);
+ await click(t);
+ assert.equal(text(t), 'Hide what was checked');
+ assert.equal(t.getAttribute('aria-expanded'), 'true');
+ assert.match(t.querySelector('svg').getAttribute('class'), /rotate-180/);
+ assert.match(q('[data-check-list]').className, /kw-fade-in/);
+ assert.deepEqual(qa('[data-check-what]').map((e) => e.textContent), cx.CHECKED_PARTLY.items.map((i) => i.what));
+ const rows = qa('[data-check-item]').map((li) => [...li.querySelectorAll('p')].map(text).join(' | '));
+ assert.equal(rows[0], 'https://kwant.si/pricing | Passed · Opened the address | HTTP 200 in 212 ms');
+ assert.equal(rows[1], 'npm run check-prices | Not checked · Ran the command');
+ assert.equal(q('[data-check-list] a'), null, 'server text is text, never a link');
+ await click(t);
+ assert.equal(q('[data-check-list]').hidden, true);
+ root.unmount();
+});
+
+test('a claim gets the amber triangle and "Not checked"; an unknown result is "Not checked", never "Passed"', async () => {
+ const odd = { ...cx.CHECKED_PARTLY, items: [...cx.CHECKED_PARTLY.items, { what: 'Mystery', how: 'ran the command', result: 'exploded', evidence: null }] };
+ const { q, qa, root } = await box(odd);
+ await click(q('[data-check-toggle]'));
+ const claim = qa('[data-check-item]')[3];
+ assert.equal(claim.getAttribute('data-check-item'), 'claim');
+ assert.ok(claim.querySelector('svg').classList.contains('lucide-triangle-alert') || claim.querySelector('svg').classList.contains('lucide-alert-triangle'));
+ assert.ok(claim.querySelector('svg').classList.contains('text-warn'));
+ assert.equal(claim.querySelector('[data-check-result]').textContent, 'Not checked');
+ assert.ok(claim.querySelector('[data-check-result]').classList.contains('text-warn'));
+ assert.match(text(claim), /Task criterion, marked met with no evidence \(a claim\)/);
+ assert.equal(claim.querySelector('[data-sticker]'), null, 'a claim is never holographic');
+ const unknown = qa('[data-check-item]')[4];
+ assert.equal(unknown.getAttribute('data-check-item'), 'not_checked');
+ assert.equal(unknown.querySelector('[data-check-result]').textContent, 'Not checked');
+ assert.equal(dc.itemKind({ result: undefined, how: '' }), 'not_checked');
+ assert.equal(dc.ITEM_WORD.waiting, 'Still waiting');
+ assert.equal(dc.howText('kwant compared the reply with what you asked for'), 'kwant compared the reply with what you asked for');
+ assert.equal(dc.howText('opened the address'), 'Opened the address');
+ root.unmount();
+});
+
+test('items_dropped: 2 gives "2 more not shown." and the toggle count includes it; failed evidence keeps its line breaks', async () => {
+ const { q, qa, root } = await box(cx.CHECKED_FAILED);
+ assert.equal(text(q('[data-check-toggle]')), 'Hide what was checked', 'failed starts open');
+ assert.equal(q('[data-check-dropped]').textContent, '2 more not shown.');
+ assert.equal(dc.droppedLine(1), '1 more not shown.');
+ const ev = q('[data-check-evidence]');
+ assert.ok(ev.textContent.includes('\n'));
+ assert.match(ev.className, /whitespace-pre-wrap/);
+ assert.equal(qa('[data-check-item="waiting"] [data-check-result]')[0].textContent, 'Still waiting');
+ await click(q('[data-check-toggle]'));
+ assert.equal(text(q('[data-check-toggle]')), 'Show what was checked (6)');
+ root.unmount();
+});
+
+test('no items: the help line and no toggle; "Add a check" only for a routine with onEditRoutine', async () => {
+ let r = await box(cx.CHECKED_NONE);
+ assert.equal(r.q('[data-check-toggle]'), null);
+ assert.equal(r.q('[data-check-help]').textContent, 'Read the answer before you rely on it.');
+ assert.equal(r.q('[data-add-check]'), null);
+ r.root.unmount();
+ const edits = [];
+ r = await box(cx.CHECKED_NONE, { onAddCheck: () => edits.push('x') });
+ assert.equal(text(r.q('[data-check-help]')), 'Read the answer before you rely on it. Add a check');
+ await click(r.q('[data-add-check]'));
+ assert.deepEqual(edits, ['x']);
+ r.root.unmount();
+ // In the pane: the routine review with onEditRoutine gets Add a check; a hand-off with no routine does not.
+ const data = withChecked('r-prices', cx.CHECKED_NONE);
+ const got = [];
+ r = await mountInbox({ doneDetails: { 'r-prices': fx.AWAY_DETAIL }, onEditRoutine: (id) => got.push(id) }, data);
+ await click(r.q('[data-option="r-prices"]'));
+ assert.ok(r.q('[data-done-check="not_checked"]'));
+ assert.equal(r.q('[data-chip="no-checks"]'), null, 'the box replaces the No checks set chip');
+ await click(r.q('[data-done-check] [data-add-check]'));
+ assert.deepEqual(got, ['rt-prices']);
+ r.root.unmount();
+ r = await mount(h(m.DoneItemView, { item: { ...fx.AWAY_HANDOFF, checked: cx.CHECKED_NONE }, d: { loading: false, error: null, routine: null, run: null, message: null, target: null }, place: null, onEditRoutine: () => {} }));
+ assert.ok(r.q('[data-done-check="not_checked"]'));
+ assert.equal(r.q('[data-add-check]'), null, 'no routine: no Add a check');
+ r.root.unmount();
+});
+
+test('pane order: chips, then the check box, then the answer; criteria fold hidden when the box lists task criteria', async () => {
+ const data = withChecked('r-prices', cx.CHECKED_PARTLY);
+ const it = data.items.find((i) => i.id === 'r-prices');
+ it.criteria = [{ index: 0, text: 'The three plan prices match the plan sheet', status: 'met', evidence: [], note: null }];
+ it.criteria_summary = { met: 1, total: 1, not_met: 0, not_checked: 0 };
+ const r = await mountInbox({ doneDetails: { 'r-prices': fx.AWAY_DETAIL } }, data);
+ await click(r.q('[data-option="r-prices"]'));
+ const chips = r.q('[data-done-chips]');
+ const boxEl = r.q('[data-done-check]');
+ const ans = r.q('[data-done-answer]');
+ assert.ok(chips && boxEl && ans);
+ assert.ok(chips.compareDocumentPosition(boxEl) & Node.DOCUMENT_POSITION_FOLLOWING);
+ assert.ok(boxEl.compareDocumentPosition(ans) & Node.DOCUMENT_POSITION_FOLLOWING);
+ assert.equal(r.el.textContent.includes('What done looks like'), false, 'criteria are in the box');
+ r.root.unmount();
+ // Without task criteria in the box, the fold stays.
+ const keep = withChecked('r-prices', cx.CHECKED_OK);
+ Object.assign(keep.items.find((i) => i.id === 'r-prices'), { criteria: it.criteria, criteria_summary: it.criteria_summary });
+ const r2 = await mountInbox({ doneDetails: { 'r-prices': fx.AWAY_DETAIL } }, keep);
+ await click(r2.q('[data-option="r-prices"]'));
+ assert.equal(r2.el.textContent.includes('What done looks like'), true);
+ r2.root.unmount();
+});
+
+test('no checked object (older server) or an unknown state: no box, the No checks set chip as before', async () => {
+ assert.equal(dc.knownChecked(undefined), null);
+ assert.equal(dc.knownChecked({ state: 'mostly', items: [] }), null);
+ let r = await mountInbox({ doneDetails: { 'r-prices': fx.AWAY_DETAIL }, onEditRoutine: () => {} });
+ await click(r.q('[data-option="r-prices"]'));
+ assert.equal(r.q('[data-done-check]'), null);
+ assert.match(r.q('[data-chip="no-checks"]').textContent, /No checks set · Add one/);
+ assert.equal(r.q('[data-row="r-prices"] [data-check-marker]'), null);
+ assert.equal(r.q('[data-row="r-prices"] [data-sticker]'), null);
+ r.root.unmount();
+ r = await mountInbox({ doneDetails: { 'r-prices': fx.AWAY_DETAIL } }, withChecked('r-prices', { state: 'mostly', items: [], items_dropped: 0, line: 'x' }));
+ await click(r.q('[data-option="r-prices"]'));
+ assert.equal(r.q('[data-done-check]'), null);
+ r.root.unmount();
+});
+
+test('list row: the marker comes before the summary; the holo sticker only for checked', async () => {
+ const cases = [
+ ['checked', cx.CHECKED_OK, 'Checked No change since last week. Beanline still cheapest.'],
+ ['partly', cx.CHECKED_PARTLY, 'Partly checked · No change since last week. Beanline still cheapest.'],
+ ['failed', cx.CHECKED_FAILED, 'Check failed · No change since last week. Beanline still cheapest.'],
+ ['not_checked', cx.CHECKED_NONE, 'Not checked · No change since last week. Beanline still cheapest.'],
+ ];
+ for (const [state, c, want] of cases) {
+ const r = await mountInbox({ doneDetails: { 'r-prices': fx.AWAY_DETAIL } }, withChecked('r-prices', c));
+ const sum = r.q('[data-row="r-prices"] [data-done-summary]');
+ assert.equal(text(sum), want, state);
+ const holo = sum.querySelector('[data-sticker="holo"]');
+ if (state === 'checked') {
+ assert.ok(holo, 'checked is the holo sticker');
+ assert.equal(sum.firstElementChild, holo, 'the marker comes first');
+ } else {
+ assert.equal(holo, null, `${state} is never holographic`);
+ assert.equal(sum.firstElementChild.getAttribute('data-check-marker'), state);
+ assert.match(sum.firstElementChild.className, { partly: /text-warn/, failed: /text-bad/, not_checked: /text-zinc-300/ }[state]);
+ }
+ assert.equal(r.qa('[data-sticker]').length, state === 'checked' ? 1 : 0, 'the only sticker on the list');
+ r.root.unmount();
+ }
+ // A done (non-review) row and a team job get it too; a row with no summary shows the marker alone.
+ const data = withChecked('tj-spring', cx.CHECKED_FAILED);
+ data.items.find((i) => i.id === 'tj-spring').summary = '';
+ const r = await mountInbox({}, data);
+ assert.equal(text(r.q('[data-row="tj-spring"] [data-done-summary]')), 'Check failed');
+ r.root.unmount();
+});
+
+test('390 px: a 120-character URL as what wraps anywhere instead of pushing the box sideways', async () => {
+ assert.equal(cx.LONG_URL.length, 120);
+ const { q, root } = await box({ ...cx.CHECKED_FAILED, items: [{ what: cx.LONG_URL, how: 'opened the address', result: 'failed', evidence: `HTTP 404 at ${cx.LONG_URL}` }] });
+ for (const sel of ['[data-check-what]', '[data-check-evidence]']) assert.match(q(sel).className, /\[overflow-wrap:anywhere\]/, sel);
+ assert.match(q('section').className, /min-w-0/);
+ assert.match(q('[data-check-item] > div').className, /min-w-0/);
+ assert.match(q('[data-check-line]').className, /minmax\(0,1fr\)/);
+ root.unmount();
+});
+
+test('a plain to-review task in Done keeps the full review layout and gets the box above the verdict', async () => {
+ const data = withChecked('r-prices', cx.CHECKED_PARTLY);
+ const it = data.items.find((i) => i.id === 'r-prices');
+ it.title = 'Refresh the pricing page';
+ it.verdict = { ...it.verdict, result: 'pass' };
+ const r = await mountInbox({}, data);
+ await click(r.q('[data-option="r-prices"]'));
+ const boxEl = r.q('[data-done-check="partly"]');
+ assert.ok(boxEl, 'the box is drawn');
+ assert.equal(r.q('[data-done-answer]'), null, 'not the done layout');
+ assert.equal(text(r.q('[data-row="r-prices"] [data-done-summary]')), `Partly checked · ${it.summary}`, 'a plain review row: marker then its summary');
+ const verdict = r.q('[data-verdict]');
+ if (verdict) assert.ok(boxEl.compareDocumentPosition(verdict) & Node.DOCUMENT_POSITION_FOLLOWING, 'box before the verdict');
+ r.root.unmount();
+});
+
+test('full review layout with the box: no "Not checked yet" panel under it, a real verdict still follows it', async () => {
+ const data = withChecked('r-prices', cx.CHECKED_PARTLY);
+ const it = data.items.find((i) => i.id === 'r-prices');
+ it.title = 'Refresh the pricing page';
+ it.verdict = { ...it.verdict, result: 'none' };
+ const r = await mountInbox({}, data);
+ await click(r.q('[data-option="r-prices"]'));
+ assert.ok(r.q('[data-done-check="partly"]'), 'the box is drawn');
+ assert.equal(r.q('[data-done-answer]'), null, 'not the done layout');
+ assert.equal(r.q('[data-verdict]'), null, 'verdict none is not stacked under the box');
+ r.root.unmount();
+});
+
+test('full review layout with the box: a pass verdict still shows, after the box', async () => {
+ const data = withChecked('r-prices', cx.CHECKED_PARTLY);
+ const it = data.items.find((i) => i.id === 'r-prices');
+ it.title = 'Refresh the pricing page';
+ it.verdict = { ...it.verdict, result: 'pass' };
+ const r = await mountInbox({}, data);
+ await click(r.q('[data-option="r-prices"]'));
+ const boxEl = r.q('[data-done-check="partly"]');
+ const verdict = r.q('[data-verdict="pass"]');
+ assert.ok(boxEl && verdict, 'box and pass verdict both drawn');
+ assert.ok(boxEl.compareDocumentPosition(verdict) & Node.DOCUMENT_POSITION_FOLLOWING, 'box before the verdict');
+ r.root.unmount();
+});
diff --git a/frontend/tests/wording.test.mjs b/frontend/tests/wording.test.mjs
index c0af24c7..229a40d8 100644
--- a/frontend/tests/wording.test.mjs
+++ b/frontend/tests/wording.test.mjs
@@ -31,7 +31,8 @@ const MAESTRO = /\bAgent Maestro\b|\bHermes Agent\b/g;
// the https-only reason ("kwant only downloads from github.com").
// Worktrees tab (0.9.0 H1): Mira's h1-worktrees.md names kwant, the program that makes and cleans the folders, in its
// status and inline-error copy.
-const RULED = /\bkwant (?:can remove it|won’t delete it|won’t write into it|suggests one from the task|cleans build output)\b|\bmade outside kwant\b|\bso kwant can read\b|\bmanifests kwant knows\b|\bnames kwant knows\b|\bkwant’s (?:browser|log|own data|tools)\b|\bkwant (?:adds it|couldn’t|won’t share|keeps|is running as root|can’t pass|can’t fetch|can’t download|only downloads)\b|\b[Rr]estart kwant\b|\bStart kwant as\b|\bkwant (?:looked|never follows|downloads it|found nothing|doesn’t fetch)\b|\bNothing kwant can bring\b|\bwhere kwant looked\b|\bsent kwant somewhere\b/g;
+// Done-check card (0.9.8): Mira's done-check/design.md keeps kwant as the subject of the server's `how` 'kwant compared the reply with what you asked for'.
+const RULED = /\bkwant compared the reply with what you asked for\b|\bkwant (?:can remove it|won’t delete it|won’t write into it|suggests one from the task|cleans build output)\b|\bmade outside kwant\b|\bso kwant can read\b|\bmanifests kwant knows\b|\bnames kwant knows\b|\bkwant’s (?:browser|log|own data|tools)\b|\bkwant (?:adds it|couldn’t|won’t share|keeps|is running as root|can’t pass|can’t fetch|can’t download|only downloads)\b|\b[Rr]estart kwant\b|\bStart kwant as\b|\bkwant (?:looked|never follows|downloads it|found nothing|doesn’t fetch)\b|\bNothing kwant can bring\b|\bwhere kwant looked\b|\bsent kwant somewhere\b/g;
/** Whether a literal reads like text a person sees (a sentence, or a capitalised word). */
const looksVisible = (text, node) => {