Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
feat(view): shouts read as cards with a one-bar composer [N26]
Corey Olson2ad0d203b281
diff --git a/src/cockpit.js b/src/cockpit.jsindex 3ec2d602..9ea53ebf 100644--- a/src/cockpit.js+++ b/src/cockpit.js@@ -124,10 +124,10 @@ export function cockpitPage(key = '', { snapshot = false, readOnly = false, requ</form></aside></section>- <section data-pane="shouts" class="two narrow">+ <section data-pane="shouts" class="two narrow" id="shouts-pane"><div class="primary"><section class="needs-you" id="decisions" aria-label="Decisions needed" hidden></section>- <form id="shout-form" class="card-panel inline"><p class="answering" id="answering" hidden><span>Answering <b id="answering-who"></b>: <span id="answering-q"></span></span><button class="ghost" id="answer-cancel" type="button">Cancel</button></p><label>To<input id="shout-to" list="shout-targets" required placeholder="all, a lane or an agent"></label><datalist id="shout-targets"></datalist><label class="wide">Message<input id="shout-text" required></label><button class="go" id="shout-send" type="submit">Shout</button></form>+ <form id="shout-form" class="card-panel shout-form"><p class="answering" id="answering" hidden><span>Answering <b id="answering-who"></b>: <span id="answering-q"></span></span><button class="ghost" id="answer-cancel" type="button">Cancel</button></p><div class="composer"><label class="to"><span>to</span><input id="shout-to" list="shout-targets" required placeholder="all" aria-label="To: all, a lane or an agent"></label><datalist id="shout-targets"></datalist><textarea id="shout-text" required rows="1" placeholder="Shout to the board" aria-label="Message"></textarea><button class="send" id="shout-send" type="submit" aria-label="Shout" title="Shout (Enter; Shift+Enter for a new line)"><svg viewBox="0 0 16 16" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" d="M8 13V3M3.5 7.5 8 3l4.5 4.5"/></svg></button></div></form><div class="card-panel feed" id="feed"></div></div><aside class="card-panel detail" aria-label="Agents and lanes">@@ -184,7 +184,7 @@ function homeTab() {const kept = keep('pb.tab');return kept && kept !== 'roadmap' ? kept : 'items';}-const view = { root: keep('pb.project'), tab: addressTab() || homeTab(), seen: {}, code: {}, item: null, adding: false, declining: null, state: 'active', rows: { spec: 'decide', doctrine: 'all' }, row: { spec: null, doctrine: null } };+const view = { root: keep('pb.project'), tab: addressTab() || homeTab(), seen: {}, code: {}, item: null, adding: false, declining: null, state: 'active', rows: { spec: 'decide', doctrine: 'all' }, row: { spec: null, doctrine: null }, agent: null, agentsHidden: keep('pb.agents') === 'hidden', allAgents: false };if (snapshot) view.state = 'all';let data = null;let seen = '';@@ -213,7 +213,11 @@ const esc = (text) => String(text ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&am// is in columns, as a terminal counts them: CJK, full-width and emoji characters take two.const wideChar = (c) => { const p = c.codePointAt(0); return (p >= 0x1100 && p <= 0x115f) || (p >= 0x2e80 && p <= 0xa4cf) || (p >= 0xac00 && p <= 0xd7a3) || (p >= 0xf900 && p <= 0xfaff) || (p >= 0xfe30 && p <= 0xfe4f) || (p >= 0xff00 && p <= 0xff60) || (p >= 0xffe0 && p <= 0xffe6) || (p >= 0x1f300 && p <= 0x1faff) || (p >= 0x20000 && p <= 0x3fffd); };const columns = (text) => [...String(text)].reduce((n, c) => n + (wideChar(c) ? 2 : 1), 0);-const codeChip = (text) => '<code class="inline' + (columns(text) > 24 ? ' long' : '') + '">' + esc(text) + '</code>';+const codeChip = (text, kind = '') => kind === 'sha' && String(text).length > 10+ ? '<code class="inline sha" title="' + esc(text) + '">' + esc(String(text).slice(0, 10)) + '</code>'+ : '<code class="inline' + (kind ? ' ' + kind : '') + (columns(text) > 24 ? ' long' : '') + '">' + esc(text) + '</code>';+// An age said in words, as a shout's card shows it: now, 2m ago, 1h ago.+const agoLong = (iso) => { const short = ago(iso); return short === 'now' ? 'now' : short + ' ago'; };const ago = (iso) => { const m = Math.round((Date.now() - Date.parse(iso)) / 60000); return m < 1 ? 'now' : m < 60 ? m + 'm' : m < 2880 ? Math.round(m / 60) + 'h' : Math.round(m / 1440) + 'd'; };// An age as the page shows it: the moment it counts from stays on it, so tickAges can move it on.const age = (iso) => '<time data-ago="' + esc(iso) + '">' + ago(iso) + '</time>';@@ -228,6 +232,11 @@ const dayName = (iso) => {};// A feed's rows, newest first, with the day named above each run of rows from the same day.const byDay = (rows, at, row) => rows.map((x, i) => (i && new Date(at(x)).toDateString() === new Date(at(rows[i - 1])).toDateString() ? '' : '<h4 class="day">' + dayName(at(x)) + '</h4>') + row(x)).join('');+// Where the shouts cross into an earlier day, a rule names it in the middle; today needs no label at the top.+const dayRules = (rows, at, row) => rows.map((x, i) => {+ const day = new Date(at(x)).toDateString(), before = i ? new Date(at(rows[i - 1])).toDateString() : new Date().toDateString();+ return (day === before ? '' : '<div class="day-rule" role="separator"><span>' + dayName(at(x)) + '</span></div>') + row(x);+}).join('');const firstLine = (text) => String(text ?? '').split('\\n').map((line) => line.trim()).find(Boolean) || '';// The latest verdict is a reject and no accept followed: open again, being reworked, resubmitted, or// withdrawn after it.@@ -857,7 +866,9 @@ function renderSide() {if (allowLinks && validRef) return codeRef(part, textBefore.slice(-2000));return codeChip(part);}- if (/^(?:${COMMAND_SOURCE}|--[\\w-]+|(?:\\/|\\.\\.?\\/|[\\w.-]+\\/)\\w[\\w./-]*\\.[A-Za-z0-9]+|\\b[0-9a-fA-F]{7,40}\\b)$/.test(part)) return codeChip(part);+ if (/^(?:${COMMAND_SOURCE}|--[\\w-]+)$/.test(part)) return codeChip(part, 'cmd');+ if (/^(?:\\/|\\.\\.?\\/|[\\w.-]+\\/)\\w[\\w./-]*\\.[A-Za-z0-9]+$/.test(part)) return codeChip(part, 'path');+ if (/^[0-9a-fA-F]{7,40}$/.test(part)) return codeChip(part, 'sha');return linked(part, titles, allowLinks);}).join(''); }/** Render inline text and fenced or shell command blocks with escaped contents.@@ -890,7 +901,7 @@ function renderSide() {open.push({ indent: indent.length, node });}const list = (nodes) => '<ul class="text-list">' + nodes.map((node) => '<li>'- + (wholeCommand(node.text) ? codeChip(node.text) : inline(node.text, titles, allowLinks))+ + (wholeCommand(node.text) ? codeChip(node.text, 'cmd') : inline(node.text, titles, allowLinks))+ (node.children.length ? list(node.children) : '') + '</li>').join('') + '</ul>';return list(roots);}@@ -1129,24 +1140,57 @@ function render() {const mark = (x) => (x.shout_decision ? '<span class="mark ask">decision</span> ' : x.shout_answers ? '<span class="mark">answer</span> ' : '');// Evidence a shout carries (B22), as the fields it is: its kind and outcome, the item, who sent it,// and the commit, shortened, with the full SHA on hover.- const evidence = (x) => (x.shout_evidence_kind ? '<span class="ev"><b>' + esc(x.shout_evidence_kind) + '</b> ' + esc(x.shout_evidence_outcome) + ' · ' + linked('#' + x.shout_evidence_item, titles) + ' · ' + esc(x.shout_from) + ' · <code title="' + esc(x.shout_evidence_commit) + '">' + esc(String(x.shout_evidence_commit).slice(0, 12)) + '</code></span>' : '');- $('feed').innerHTML = p.shouts.length ? byDay(p.shouts, (x) => x.shout_at, (x) => '<div><time>' + clock(x.shout_at) + '</time><div><b>' + esc(x.shout_from) + ' → ' + esc(x.shout_to) + '</b> ' + mark(x) + rich(x.shout_text, titles) + evidence(x) + '</div></div>') : '<div class="empty">No shouts yet.</div>';+ const evidence = (x) => (x.shout_evidence_kind ? '<div class="receipt"><div><span class="badge">' + esc(x.shout_evidence_kind) + '</span> <span class="outcome">' + esc(x.shout_evidence_outcome) + '</span></div>'+ + '<div class="receipt-foot">' + linked('#' + x.shout_evidence_item, titles) + ' · ' + esc(x.shout_from) + ' · ' + codeChip(String(x.shout_evidence_commit), 'sha') + '</div></div>' : '');+ // A shout as a card (#250): who, in a colour of their own, to whom, its item and when on top; what was said+ // below. An ask carries a band until it is answered; a long shout folds at six lines.+ const hue = (id) => [...String(id)].reduce((h, c) => (h * 31 + c.charCodeAt(0)) >>> 0, 7) % 8;+ const initials = (id) => { const [name, rest = ''] = String(id).split(/[-_ ]/); const digits = rest.replace(/\\D/g, ''); return (name.slice(0, digits ? 1 : 2) + digits.slice(0, 3)).toUpperCase(); };+ const open = new Set([...p.decisions, ...p.asked].map((d) => d.shout_id));+ const answerOf = new Map(p.shouts.filter((y) => y.shout_answers).map((y) => [y.shout_answers, y]));+ const band = (x) => !x.shout_decision ? '' : open.has(x.shout_id) ? '<div class="band">Decision needed</div>'+ : '<div class="band done">Answered' + (answerOf.has(x.shout_id) ? ' by ' + esc(answerOf.get(x.shout_id).shout_from) + ': <a href="#shout-' + answerOf.get(x.shout_id).shout_id + '">see the answer</a>' : '') + '</div>';+ // The shout's item: its evidence's, or the first #N in its text that names an item on this board.+ const itemOf = (x) => x.shout_evidence_item || ([...String(x.shout_text).matchAll(/#(\\d+)/g)].map((m) => m[1]).find((id) => titles.has(id)));+ // The coordinator's mark is the board's own: a square with the Pullboard logo, so it stands out from the agents.+ const LEAD = '<svg viewBox="0 0 64 64" aria-hidden="true"><path fill="currentColor" d="M8 7h35a6 6 0 0 1 6 6v7H8a5 5 0 0 1-5-5v-3a5 5 0 0 1 5-5Z"/><rect width="56" height="14" x="3" y="25" fill="var(--accent)" rx="5"/><path fill="currentColor" d="M8 43h35a6 6 0 0 1 6 6v8H8a5 5 0 0 1-5-5v-4a5 5 0 0 1 5-5Z"/></svg>';+ const lead = (from) => from === 'coordinator';+ const heard = view.agent ? p.shouts.filter((x) => x.shout_from === view.agent || x.shout_to === view.agent) : p.shouts;+ const bar = '<div class="feed-bar">' + (view.agent ? '<span>Shouts with <b>' + esc(view.agent) + '</b> <button class="link" data-agent="" type="button">show all</button></span>' : '<span></span>')+ + '<button class="link" data-agents-toggle type="button">' + (view.agentsHidden ? 'Show agents' : 'Hide agents') + '</button></div>';+ $('shouts-pane').classList.toggle('bare', view.agentsHidden);+ // One card for a shout, in the feed and among the asks; tail adds what the place needs, such as Answer. Only the+ // feed's copy carries the band and the id an answer's link lands on, so an ask shown twice never repeats an id.+ const card = (x, tail = '', inFeed = true) => '<article class="shout h' + hue(x.shout_from) + (lead(x.shout_from) ? ' lead' : '') + (openShouts.has(x.shout_id) ? ' open' : '') + '"' + (inFeed ? ' id="shout-' + x.shout_id + '"' : '') + ' data-shout-id="' + x.shout_id + '">'+ + (lead(x.shout_from) ? '<span class="avatar">' + LEAD + '</span>' : '<span class="avatar' + (initials(x.shout_from).length > 3 ? ' wide' : '') + '" aria-hidden="true">' + esc(initials(x.shout_from)) + '</span>') + '<div class="shout-main"><header><b class="who">' + esc(x.shout_from) + '</b><span class="to">→ ' + esc(x.shout_to) + '</span>'+ + (itemOf(x) ? '<span class="item">#' + esc(itemOf(x)) + '</span>' : '') + mark(x) + '<time class="long" data-ago="' + esc(x.shout_at) + '" title="' + esc(when(x.shout_at)) + '">' + agoLong(x.shout_at) + '</time></header>'+ + '<div class="text">' + rich(x.shout_text, titles) + '</div><button class="more" data-more type="button">' + (openShouts.has(x.shout_id) ? 'less' : 'more') + '</button>' + (inFeed ? band(x) : '') + evidence(x) + tail + '</div></article>';+ $('feed').innerHTML = bar + (heard.length ? dayRules(heard, (x) => x.shout_at, card) : '<div class="empty">' + (view.agent ? 'No shouts with ' + esc(view.agent) + ' among the last forty.' : 'No shouts yet.') + '</div>');+ foldShouts();// Each ask waits here until it is answered (B21); the answer itself is typed in the form below. The// person answers the ones passed up to them; the rest wait on whoever holds them (B26).$('decisions').hidden = !p.decisions.length && !p.asked.length;- $('decisions').innerHTML = (p.decisions.length ? '<div class="head"><i></i>Decision needed</div>' + p.decisions.map((d) => '<div class="ask"><p><small><b>' + esc(d.shout_from) + '</b> asks, ' + age(d.shout_at) + '</small></p><p>' + rich(d.shout_text, titles) + '</p><button class="ghost" data-go="decide:' + d.shout_id + '" type="button">Answer</button></div>').join('') : '')- + (p.asked.length ? '<div class="head quiet">Waiting on others</div>' + p.asked.map((d) => '<div class="ask other"><p><small><b>' + esc(d.shout_from) + '</b> asks <b>' + esc(d.shout_to) + '</b>, ' + age(d.shout_at) + '</small></p><p>' + rich(d.shout_text, titles) + '</p></div>').join('') : '');+ // The asks as the feed's cards, folded to three lines: the person's to answer, then those waiting on others.+ $('decisions').innerHTML = (p.decisions.length ? '<div class="head"><i></i>Decision needed</div>' + p.decisions.map((d) => card(d, '<button class="ghost answer" data-go="decide:' + d.shout_id + '" type="button">Answer</button>', false)).join('') : '')+ + (p.asked.length ? '<div class="head quiet">Waiting on others</div>' + p.asked.map((d) => card(d, '', false)).join('') : '');+ foldShouts();$('shout-targets').innerHTML = ['all', ...lanes, ...p.agents.map((a) => a.agent_id)].map((t) => '<option value="' + esc(t) + '">').join('');// Each agent with what it holds: its claim, then its work sent back, then its work waiting for a// verdict. The worktree path is there on hover; what the person reads is who is doing what.// A review an agent holds (V15) comes right after its claim.const rank = (a, i) => i.status === 'claimed' ? 0 : i.reviewer === a.agent_id ? 1 : stateOf(i) === 'back' ? 2 : 3;const holding = (a) => items.filter((i) => i.status === 'claimed' ? i.owner === a.agent_id : i.reviewer === a.agent_id || (i.builtBy === a.agent_id && ['back', 'verify'].includes(stateOf(i)))).sort((x, y) => rank(a, x) - rank(a, y));- $('agents').innerHTML = p.agents.length ? p.agents.map((a) => {+ // The agents at work: holding a claim or a review now, or moved in the last hour. Every agent is one click away;+ // work an idle agent left sent back or waiting stays on the Items tab.+ const recent = (a) => p.items.some((i) => (i.status === 'claimed' && i.owner === a.agent_id) || (i.status === 'submitted' && i.reviewer === a.agent_id))+ || (a.lastMoveAt && Date.now() - Date.parse(a.lastMoveAt) < 36e5);+ const listed = view.allAgents ? p.agents : p.agents.filter(recent);+ $('agents').innerHTML = (listed.length ? listed.map((a) => {const mine = holding(a);- return '<div class="agent"><div><b title="' + esc(a.agent_path) + '">' + esc(a.agent_id) + '</b><span class="muted">' + esc(a.agent_lane) + ' · ' + esc(a.agent_route) + '</span>' + (a.lastMoveAt ? '<time data-ago="' + esc(a.lastMoveAt) + '" title="last moved ' + when(a.lastMoveAt) + '">' + ago(a.lastMoveAt) + '</time>' : '') + '</div>'+ return '<div class="agent' + (view.agent === a.agent_id ? ' on' : '') + '"><div><button class="agent-name" data-agent="' + esc(a.agent_id) + '" title="Shouts with ' + esc(a.agent_id) + ' (' + esc(a.agent_path) + ')" type="button">' + esc(a.agent_id) + '</button><span class="muted">' + esc(a.agent_lane) + ' · ' + esc(a.agent_route) + '</span>' + (a.lastMoveAt ? '<time data-ago="' + esc(a.lastMoveAt) + '" title="last moved ' + when(a.lastMoveAt) + '">' + ago(a.lastMoveAt) + '</time>' : '') + '</div>'+ (mine.length ? mine.map((i) => '<div class="agent-work" data-item="' + i.id + '"><span>#' + i.id + ' ' + rich(i.title, titles) + '</span>' + (i.reviewer === a.agent_id ? '<span class="chip warn">reviewing</span>' : chip(stateOf(i))) + '</div>').join('') : '<small>idle</small>') + '</div>';- }).join('') : '<div class="empty">No agents yet.</div>';+ }).join('') : '<div class="empty">' + (p.agents.length ? 'No agent has moved today.' : 'No agents yet.') + '</div>')+ + (p.agents.length > p.agents.filter(recent).length ? '<button class="link all-agents" data-all-agents type="button">' + (view.allAgents ? 'show only agents at work' : 'show all ' + p.agents.length) + '</button>' : '');const held = new Map(p.holds.map((h) => [h.hold_lane, h]));$('lanes').innerHTML = working.map((l) => '<div class="lane"><span><b>' + esc(l) + '</b> ' + (held.has(l) ? '<span class="chip no">held by ' + esc(held.get(l).hold_by) + '</span> <span class="muted">' + linked(held.get(l).hold_reason, titles) + '</span>' : '<span class="chip ok">open</span>') + '</span>' + (held.has(l) ? '<button class="ghost" data-release="' + esc(l) + '" type="button">Release</button>' : '') + '</div>').join('');@@ -1226,6 +1270,7 @@ function showTab() {document.querySelectorAll('[data-pane]').forEach((pane) => { pane.hidden = pane.dataset.pane !== view.tab; });document.querySelectorAll('.tab').forEach((button) => button.classList.toggle('on', button.dataset.tab === view.tab));countUnseen();+ if (view.tab === 'shouts') foldShouts();}/** The address that names a tab: the Roadmap's own, or the board's, keeping the rest as it is. */@@ -1311,7 +1356,9 @@ function answer(id) {else $('answering-q').textContent = ask ? ask.shout_text : '';if (ask) $('shout-to').value = ask.shout_from;$('shout-to').disabled = Boolean(ask);- $('shout-send').textContent = ask ? 'Answer' : 'Shout';+ const verb = ask ? 'Answer' : 'Shout';+ $('shout-send').setAttribute('aria-label', verb);+ $('shout-send').title = verb + ' (Enter; Shift+Enter for a new line)';if (ask) $('shout-text').focus();}@@ -1460,9 +1507,10 @@ async function decideSpec(command, args, anchor) {async function act(command, args, anchor) {const out = $('console');if (snapshot || (readOnly && !requests)) { out.hidden = false; out.className = 'console no'; out.textContent = snapshot ? 'This is a read-only snapshot.' : 'This is a read-only view.'; return false; }+ // A form's result stands above its actions, or above the shout composer's bar, never inside that one row.if (anchor) {const target = anchor.matches('form')- ? anchor.querySelector('.actions') || anchor.querySelector('[type="submit"]') || anchor+ ? anchor.querySelector('.actions') || anchor.querySelector('.composer') || anchor.querySelector('[type="submit"]') || anchor: anchor.closest('#lanes') || anchor;target.insertAdjacentElement(anchor.matches('form') ? 'beforebegin' : 'afterend', out);}@@ -1506,8 +1554,21 @@ async function act(command, args, anchor) {* changes, so a click is never lost to a rebuild; on a quiet board the ages would otherwise stay* as old as the page.*/+/** Shouts the person opened past their six lines, kept across refreshes. */+const openShouts = new Set();++/** Fold each shout taller than six lines, with 'more' to open it; measured only while Shouts shows. */+function foldShouts() {+ if ($('feed').offsetParent === null) return;+ document.querySelectorAll('#feed .shout, #decisions .shout').forEach((card) => {+ const text = card.querySelector('.text');+ card.classList.add('clamp');+ card.classList.toggle('clamp', card.classList.contains('open') || text.scrollHeight > text.clientHeight + 1);+ });+}+function tickAges() {- document.querySelectorAll('[data-ago]').forEach((node) => { node.textContent = ago(node.dataset.ago); });+ document.querySelectorAll('[data-ago]').forEach((node) => { node.textContent = node.classList.contains('long') ? agoLong(node.dataset.ago) : ago(node.dataset.ago); });}/** Open or close the project list where the sidebar is folded into a top bar (under 900px). */@@ -1537,6 +1598,26 @@ function switchTo(root, target = null, record = true) {});}+// The Shouts tab's own controls: a folded shout's more and less, every agent or only those at work, the agents+// panel hidden or shown, and an agent's name, which filters the feed to its shouts and addresses the composer to it.+$('shouts-pane').addEventListener('click', (event) => {+ const more = event.target.closest('[data-more]'), pick = event.target.closest('[data-agent]');+ if (more) {+ const card = more.closest('.shout'), id = Number(card.dataset.shoutId);+ if (openShouts.has(id)) openShouts.delete(id); else openShouts.add(id);+ card.classList.toggle('open', openShouts.has(id));+ more.textContent = openShouts.has(id) ? 'less' : 'more';+ return;+ }+ if (event.target.closest('[data-all-agents]')) { view.allAgents = !view.allAgents; render(); return; }+ if (event.target.closest('[data-agents-toggle]')) { view.agentsHidden = !view.agentsHidden; keep('pb.agents', view.agentsHidden ? 'hidden' : 'shown'); render(); return; }+ if (!pick) return;+ view.agent = pick.dataset.agent && pick.dataset.agent !== view.agent ? pick.dataset.agent : null;+ if (view.agent && !view.answering) $('shout-to').value = view.agent;+ render();+});+// Enter shouts; Shift+Enter starts a new line.+$('shout-text').addEventListener('keydown', (event) => { if (event.key === 'Enter' && !event.shiftKey && !event.isComposing) { event.preventDefault(); $('shout-form').requestSubmit(); } });document.addEventListener('click', (event) => {const t = event.target.closest('[data-root],[data-tab],[data-go],[data-item],[data-state],[data-rows],[data-row],[data-row-decision],[data-section-approve],[data-release],[data-shout],[data-new],[data-code],#proj-switch,#console');if (!event.target.closest('.side')) fold(false);diff --git a/src/view.css b/src/view.cssindex 4c68c7be..64375a1b 100644--- a/src/view.css+++ b/src/view.css@@ -168,7 +168,6 @@ input:disabled { background: var(--surface-2); color: var(--ink-muted); }.needs-you .head { font-weight: 700; display: flex; gap: 8px; align-items: center; }.needs-you .head i { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); display: inline-block; }.needs-you .head.quiet { color: var(--ink-muted); font-weight: 600; }-.needs-you .ask + .head.quiet { margin-top: 12px; }.needs-you .more { padding: 2px 4px; }.ny { display: grid; grid-template-columns: auto minmax(5em, 1fr) minmax(0, max-content); gap: 10px; align-items: baseline; text-align: left; border: 0; background: none; padding: 6px 4px; border-radius: 8px; width: 100%; min-height: 44px; }.ny:has(.ny-open):hover { background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }@@ -177,17 +176,10 @@ input:disabled { background: var(--surface-2); color: var(--ink-muted); }.ny .ny-open { min-height: 44px; border: 0; padding: 0; background: none; color: var(--warn); cursor: pointer; text-align: right; }.ny em { font-style: normal; color: var(--warn); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }@media (width < 480px) { .ny { grid-template-columns: auto minmax(0, 1fr); row-gap: 1px; } .ny .ny-open { grid-column: 2; } }-.ask { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 6px 4px; }-.ask > p { grid-column: 1; margin: 0; overflow-wrap: anywhere; }-.ask small { color: var(--ink-muted); }-.ask button { grid-row: 1 / span 2; grid-column: 2; }.answering { flex: 1 1 100%; display: flex; gap: 10px; align-items: baseline; justify-content: space-between; margin: 0; font-size: 13px; color: var(--ink-muted); }.answering > span { min-width: 0; overflow-wrap: anywhere; }.mark { font: 600 11px var(--mono); padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-muted); }.mark.ask { display: inline; background: var(--warn-soft); color: var(--warn); }-.ev { display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; width: fit-content; max-width: 100%; margin-top: 4px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 12px; color: var(--ink-muted); }-.ev b { font: 600 11px var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink); }-.ev code { font: 12px var(--mono); }.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px; }.chips button { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 9px; cursor: pointer; font-size: 13px; }@@ -296,6 +288,69 @@ form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; paddin.feed > div { display: grid; grid-template-columns: 4.6em minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); overflow-wrap: break-word; }.feed > .empty { display: block; }.feed > div:first-child, .feed > .day + div { border-top: 0; }+/* The shout composer: one bar, to on the left, the message growing with what is typed, send on the right. */+.shout-form { padding: 8px; }+.composer { display: flex; align-items: flex-end; gap: 6px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }+.composer:focus-within { border-color: var(--accent); }+.composer .to { display: flex; flex: none; align-items: center; gap: 4px; padding: 0 4px 0 10px; border-right: 1px solid var(--line); color: var(--ink-faint); font-size: 12px; }+.composer .to input { width: 7.5em; min-height: 44px; border: 0; padding: 0 4px; background: none; color: var(--ink); font-weight: 600; }+.composer textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 12em; padding: 11px 8px; border: 0; background: none; resize: none; field-sizing: content; line-height: 1.5; }+.composer input:focus-visible, .composer textarea:focus-visible { outline: 0; }+.composer .send { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 9px; background: var(--ink); color: var(--surface); cursor: pointer; }+.composer .send:hover { background: var(--accent-strong); color: var(--on-accent); }+.composer .send svg { width: 18px; height: 18px; }+/* The feed's bar: whose shouts these are, and the agents panel shown or hidden. */+#feed > .feed-bar { display: flex; border-top: 0; justify-content: space-between; align-items: center; gap: 8px; padding: 0 4px; color: var(--ink-muted); font-size: 13px; }+.link { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; color: var(--accent-strong); font: inherit; font-weight: 600; cursor: pointer; }+[data-pane="shouts"].bare { grid-template-columns: minmax(0, 1fr); }+[data-pane="shouts"].bare > aside { display: none; }+/* The asks as cards in a quiet panel; the amber lives in the heading's dot, not in a box. */+#decisions { background: var(--surface); border-color: var(--line); padding: 10px 12px 4px; }+#decisions > .shout { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 0 12px; padding: 10px 2px; border-top: 1px solid var(--line); }+#decisions > .head + .shout { border-top: 0; }+#decisions .shout.clamp:not(.open) .text { -webkit-line-clamp: 3; }+#decisions .answer { margin-top: 6px; }+.all-agents { margin-top: 2px; font-size: 13px; }+.agent-name { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; }+.agent-name:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; }+.agent.on .agent-name { color: var(--accent-strong); }+/* Shouts as cards (#250): who and when on top, what was said below, each agent in a colour of its own. No+ * card carries a coloured edge; colour lives in the avatar, the name and the chips. */+:root { --hue-0: light-dark(#0f766e, #5eead4); --hue-1: light-dark(#1d4ed8, #93b4f8); --hue-2: light-dark(#6d28d9, #c4b5fd); --hue-3: light-dark(#be185d, #f9a8d4);+ --hue-4: light-dark(#b45309, #fcd34d); --hue-5: light-dark(#15803d, #86efac); --hue-6: light-dark(#b91c1c, #fca5a5); --hue-7: light-dark(#475569, #cbd5e1); }+.shout.h0 { --h: var(--hue-0); } .shout.h1 { --h: var(--hue-1); } .shout.h2 { --h: var(--hue-2); } .shout.h3 { --h: var(--hue-3); }+.shout.h4 { --h: var(--hue-4); } .shout.h5 { --h: var(--hue-5); } .shout.h6 { --h: var(--hue-6); } .shout.h7 { --h: var(--hue-7); }+#feed > .shout { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 0 12px; align-items: start; padding: 14px 4px; border-top: 1px solid var(--line); }+#feed > .shout:first-child, #feed > .day-rule + .shout { border-top: 0; }+#feed > .day-rule { display: flex; align-items: center; gap: 12px; margin: 10px 0 2px; color: var(--ink-faint); font: 600 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; }+#feed > .day-rule::before, #feed > .day-rule::after { content: ""; flex: 1; border-top: 1px solid var(--line); }+#feed > .day-rule:first-child { margin-top: 2px; }+.shout.lead .avatar { border-radius: 9px; background: var(--ink); color: var(--surface); }+.shout.lead .avatar svg { width: 18px; height: 18px; }+.shout.lead .who { color: var(--ink); }+.shout .avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--h) 16%, var(--surface)); color: var(--h); font: 700 11px var(--mono); }+.shout .avatar.wide { font-size: 9px; letter-spacing: -.02em; }+.shout-main { min-width: 0; }+.shout header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 7px; }+.shout .who { color: var(--h); font-weight: 700; }+.shout .to, .shout .item { color: var(--ink-faint); }+.shout .item { font: 12px var(--mono); }+.shout header time { margin-left: auto; color: var(--ink-faint); font-size: 12px; white-space: nowrap; }+.shout .text { margin-top: 3px; overflow-wrap: break-word; }+.shout.clamp:not(.open) .text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; overflow: hidden; }+.shout .more { display: none; align-items: center; min-height: 44px; margin: -8px 0 -10px; padding: 0; border: 0; background: none; color: var(--accent-strong); font-weight: 600; font-size: 13px; cursor: pointer; }+.shout.clamp .more { display: inline-flex; }+.shout .band { margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 13px; }+.shout .band.done { background: var(--surface-2); color: var(--ink-muted); font-weight: 500; }+.shout .receipt { display: grid; gap: 4px; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }+.shout .receipt .badge { padding: 1px 7px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font: 600 11px var(--mono); text-transform: capitalize; }+.shout .receipt .outcome { color: var(--ink-muted); }+.shout .receipt-foot { color: var(--ink-faint); font-size: 12px; }+/* In a shout, a chip says what it is: an item, a path, a commit, a command. */+.shout button.ref[data-go] { padding: 0 5px; border-radius: 5px; background: var(--violet-soft); color: var(--violet); font-weight: 600; text-decoration: none; }+.shout code.inline.path { background: var(--blue-soft); color: var(--blue); }+.shout code.inline.sha { background: var(--warn-soft); color: var(--warn); }+.shout code.inline.cmd { background: var(--accent-soft); color: var(--accent-strong); }.feed .day { margin: 0; padding: 12px 0 4px; font: 600 11px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); }.feed .day:first-child { padding-top: 6px; }button.ref { width: auto; min-height: 0; border: 0; border-radius: 0; background: none; padding: 0; color: var(--accent-strong); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; display: inline; vertical-align: baseline; line-height: inherit; font: inherit; }diff --git a/test/cockpit.test.js b/test/cockpit.test.jsindex 8b119535..8cdbbfcf 100644--- a/test/cockpit.test.js+++ b/test/cockpit.test.js@@ -15,7 +15,7 @@ import { after, test } from 'node:test';import vm from 'node:vm';import { loadConfig } from '../src/config.js';import { loadDoctrine } from '../src/doctrine.js';-import { addItem, closeBoard, completeCheckBaseline, openBoard } from '../src/board.js';+import { addItem, closeBoard, completeCheckBaseline, openBoard, register, shout as shoutOnBoard } from '../src/board.js';import { exportBoard, importBoard } from '../src/exchange.js';import { MACHINE } from '../src/machine.js';import { cockpitPage, PULLBOARD_COMMANDS } from '../src/cockpit.js';@@ -286,12 +286,13 @@ function element(id) {* the moment it counts from, and setting its text changes that node alone.*/function ageNodes(element) {- const AGE = /<time data-ago="([^"]*)"([^>]*)>([^<]*)<\/time>/g;+ const AGE = /<time((?: class="[^"]*")?) data-ago="([^"]*)"([^>]*)>([^<]*)<\/time>/g;return [...element.innerHTML.matchAll(AGE)].map((match, n) => ({- dataset: { ago: match[1] },+ dataset: { ago: match[2] },+ classList: { contains: (name) => (/class="([^"]*)"/.exec(match[1])?.[1] ?? '').split(' ').includes(name) },set textContent(text) {let k = 0;- element.patch((html) => html.replace(AGE, (whole, at, rest) => (k++ === n ? `<time data-ago="${at}"${rest}>${text}</time>` : whole)));+ element.patch((html) => html.replace(AGE, (whole, cls, at, rest) => (k++ === n ? `<time${cls} data-ago="${at}"${rest}>${text}</time>` : whole)));},}));}@@ -863,7 +864,7 @@ test('a pullboard command in prose chips only the command [N26]', async () => {const page = await openPage(view);page.run("view.tab = 'shouts'; render();");const feed = page.show('feed');- const chips = [...feed.matchAll(/<code class="inline(?: long)?">([^<]*)<\/code>/g)].map((match) => match[1].replaceAll('"', '"'));+ const chips = [...feed.matchAll(/<code class="inline(?: [a-z]+)*"(?: title="[^"]*")?>([^<]*)<\/code>/g)].map((match) => match[1].replaceAll('"', '"'));assert.deepEqual(chips.filter((chip) => chip.startsWith('pullboard')), ['pullboard spec check', 'pullboard view', 'pullboard next --verify 235', 'pullboard verify 235', 'pullboard relay on', 'pullboard hold', 'pullboard milestone add', 'pullboard prompt review'],`each chip is the command and its arguments, never the words after it: ${JSON.stringify(chips)}`);assert.ok(chips.includes('docs/api.md') && chips.includes('--reason'), 'a path and a flag in the prose after a command still chip on their own');@@ -1097,9 +1098,9 @@ test("the history is a timeline of the item's states [N26]", async () => {* reads idle, and its entry's text with the tags taken out.*/function agentEntries(html) {- return html.split('<div class="agent">').slice(1).map((entry) => ({- id: /<b[^>]*>([^<]*)<\/b>/.exec(entry)?.[1],- path: /<b title="([^"]*)"/.exec(entry)?.[1],+ return html.split(/<div class="agent(?: on)?">/).slice(1).map((entry) => ({+ id: /data-agent="([^"]*)"/.exec(entry)?.[1],+ path: /title="Shouts with [^"(]* \(([^"]*)\)"/.exec(entry)?.[1],age: /<time[^>]*>([^<]*)<\/time>/.exec(entry)?.[1],holds: [...entry.matchAll(/data-item="(\d+)"[^>]*><span>([^]*?)<\/span><span class="chip[^"]*">([^<]*)</g)].map((match) => `${match[2]}: ${match[3]}`),idle: entry.includes('<small>idle</small>'),@@ -1475,15 +1476,16 @@ test('ages stay true while the board is quiet [N26]', async () => {row: /<time data-ago="[^"]+">([^<]*)<\/time>/.exec(itemRow(page.show('chain'), 1))?.[1],needs: /decide, <time data-ago="[^"]+">([^<]*)<\/time>/.exec(page.show('needs'))?.[1],agent: agentEntries(page.show('agents')).find((agent) => agent.id === 'web-1')?.age,+ shout: /<time class="long" data-ago="[^"]+" title="[^"]*">([^<]*)<\/time>/.exec(page.show('feed'))?.[1],});- assert.deepEqual(ages(), { row: 'now', needs: 'now', agent: 'now' });- const rebuilds = () => ['chain', 'needs', 'agents'].map((id) => page.element(id).writes);+ assert.deepEqual(ages(), { row: 'now', needs: 'now', agent: 'now', shout: 'now' });+ const rebuilds = () => ['chain', 'needs', 'agents', 'feed'].map((id) => page.element(id).writes);const before = rebuilds();// Three hours pass, nothing on the board changes, and the minute timer fires.page.run('const D = Date; globalThis.Date = class extends D { constructor(...a) { super(...(a.length ? a : [D.now() + 3 * 3600e3])); } static now() { return D.now() + 3 * 3600e3; } };');page.run('tickAges()');- assert.deepEqual(ages(), { row: '3h', needs: '3h', agent: '3h' });+ assert.deepEqual(ages(), { row: '3h', needs: '3h', agent: '3h', shout: '3h ago' }, 'a shout says how long ago in words');assert.deepEqual(rebuilds(), before, 'each age moved where it stands; nothing was rebuilt');} finally {await view.stop();@@ -1846,7 +1848,7 @@ test('a decision waits in needs-you until the view answers it [B21, B26, N27]',// An agent asks its coordinator (B25): the ask waits on the board with who holds it, never in Needs-you.assert.doesNotMatch(page.show('needs'), /decide:/, "an agent's ask is its coordinator's to answer");assert.equal(page.element('decisions').hidden, false);- assert.match(page.show('decisions'), new RegExp(`^<div class="head quiet">Waiting on others</div><div class="ask other"><p><small><b>web-1</b> asks <b>coordinator</b>, <time data-ago="[^"]+">now</time></small></p><p>${question}</p></div>$`), 'above the shouts, saying who holds it, with no Answer button');+ assert.match(page.show('decisions'), new RegExp(`^<div class="head quiet">Waiting on others</div><article class="shout h\\d" data-shout-id="1"><span class="avatar" aria-hidden="true">W1</span><div class="shout-main"><header><b class="who">web-1</b><span class="to">→ coordinator</span><span class="mark ask">decision</span> <time class="long" data-ago="[^"]+" title="[^"]+">now</time></header><div class="text">${question}</div><button class="more" data-more type="button">more</button></div></article>$`), 'above the shouts as a card, saying who asked whom, with no Answer button');assert.doesNotMatch(page.show('feed'), /Greet in/, 'though the feed no longer reaches it');// The coordinator passes it up with its note (B27): now it is the person's call.@@ -1854,7 +1856,7 @@ test('a decision waits in needs-you until the view answers it [B21, B26, N27]',await page.run('refresh()');const passed = `Passed up from web-1: ${question}\nCoordinator note: over to you`;assert.match(page.show('needs'), new RegExp(`^<div class="head"><i></i>Needs you</div><div class="ny"><code>coordinator</code><span class="ny-text">${passed.replace('\n', '<br>')}</span><button class="ny-open" data-go="decide:42" type="button"><em>decide, <time data-ago="[^"]+">now</time> →</em></button></div>`), 'first in Needs-you: who passed it, what, and since when');- assert.match(page.show('decisions'), new RegExp(`^<div class="head"><i></i>Decision needed</div><div class="ask"><p><small><b>coordinator</b> asks, <time data-ago="[^"]+">now</time></small></p><p>${passed.replace('\n', '<br>')}</p><button class="ghost" data-go="decide:42" type="button">Answer</button></div>$`), 'and above the shouts, with an Answer button');+ assert.match(page.show('decisions'), new RegExp(`^<div class="head"><i></i>Decision needed</div><article class="shout h\\d lead" data-shout-id="42"><span class="avatar"><svg [\\s\\S]*?</svg></span><div class="shout-main"><header><b class="who">coordinator</b><span class="to">→ person</span><span class="mark ask">decision</span> <time class="long" data-ago="[^"]+" title="[^"]+">now</time></header><div class="text">${passed.replace('\n', '<br>')}</div><button class="more" data-more type="button">more</button><button class="ghost answer" data-go="decide:42" type="button">Answer</button></div></article>$`), 'and above the shouts as the coordinator\'s card, with an Answer button');const form = () => ({answering: !page.element('answering').hidden,@@ -1862,7 +1864,7 @@ test('a decision waits in needs-you until the view answers it [B21, B26, N27]',question: page.element('answering-q').textContent,to: page.element('shout-to').value,locked: Boolean(page.element('shout-to').disabled),- button: page.element('shout-send').textContent,+ button: page.element('shout-send').getAttribute('aria-label'),});page.element('shout-to').value = 'web';await page.click({ go: 'decide:42' });@@ -1888,8 +1890,8 @@ test('a decision waits in needs-you until the view answers it [B21, B26, N27]',box.run(alpha.repo, 'pass', '45', 'yours');await page.run('refresh()');const feed = page.show('feed');- assert.match(feed, /<b>web-1 → coordinator<\/b> <span class="mark ask">decision<\/span> Ship today\?/, 'the feed marks an ask');- assert.match(feed, /<b>person → coordinator<\/b> <span class="mark">answer<\/span> French, then English/, 'and an answer');+ assert.match(feed, /<b class="who">web-1<\/b><span class="to">→ coordinator<\/span><span class="mark ask">decision<\/span> <time [^>]*>[^<]*<\/time><\/header><div class="text">Ship today\?<\/div>/, 'the feed marks an ask');+ assert.match(feed, /<b class="who">person<\/b><span class="to">→ coordinator<\/span><span class="mark">answer<\/span> <time [^>]*>[^<]*<\/time><\/header><div class="text">French, then English<\/div>/, 'and an answer');assert.match(page.show('needs'), /data-go="decide:46"/);// An answer belongs to the project whose question it shows.@@ -1947,7 +1949,7 @@ test("needs-you holds only the person's calls; the rest show on the board with wassert.match(needs, /<code>web<\/code><span class="ny-text">G3 is open<\/span><button class="ny-open" data-go="tab:shouts" type="button"><em>lane held by coordinator, <time data-ago="[^"]+">(?:now|\d+[mhd])<\/time> →<\/em><\/button>/, 'a held lane says who set it and shows the API-provided hold age');// Each of the rest is on the board, with who holds it.- assert.match(page.show('decisions'), /<div class="head quiet">Waiting on others<\/div><div class="ask other"><p><small><b>web-1<\/b> asks <b>coordinator<\/b>, /, "the agent's ask waits on its coordinator");+ assert.match(page.show('decisions'), /<div class="head quiet">Waiting on others<\/div><article class="shout h\d" data-shout-id="\d+"><span class="avatar" aria-hidden="true">W1<\/span><div class="shout-main"><header><b class="who">web-1<\/b><span class="to">→ coordinator<\/span>/, "the agent's ask waits on its coordinator");assert.match(itemRow(page.show('chain'), 1), /<span class="chip [^"]*">to verify<\/span><\/li>$/, 'work waiting for a verdict');assert.ok(itemRow(page.show('chain'), 2).includes('BEHAVIOR_MISMATCH: no farewell yet'), 'and work sent back, with why');assert.deepEqual(agentEntries(page.show('agents')).find((agent) => agent.id === 'web-1').holds, ['#2 Farewell: sent back', '#1 Greeting: to verify'], 'the agent that built them holds both');@@ -2259,12 +2261,15 @@ test('times say which day they were [N26]', async () => {box.run(alpha.repo, 'shout', 'web', '#1 is in');const view = await startView(box);try {- const days = (html) => [...html.matchAll(/<h4 class="day">([^<]*)<\/h4>/g)].map((match) => match[1]);+ const days = (html) => [...html.matchAll(/<h4 class="day">([^<]*)<\/h4>|<div class="day-rule" role="separator"><span>([^<]*)<\/span><\/div>/g)].map((match) => match[1] ?? match[2]);+ // A shout says how long ago it was, with its clock time on hover.+ const ages = (html) => [...html.matchAll(/<time class="long" data-ago="[^"]+" title="([^"]*)">([^<]*)<\/time>/g)].map((match) => [match[2], match[1]]);const times = (html) => [...html.matchAll(/<time>([^<]*)<\/time>/g)].map((match) => match[1]);const bare = (list) => list.length > 0 && list.every((time) => /^\d\d:\d\d$/.test(time));const now = await openPage(view);- assert.deepEqual([days(now.show('feed')), days(now.show('activity'))], [['Today'], ['Today']]);+ assert.deepEqual([days(now.show('feed')), days(now.show('activity'))], [[], ['Today']], 'shouts from today need no rule above them');+ assert.deepEqual(ages(now.show('feed')).map(([age, clock]) => [age, /^\d\d:\d\d$/.test(clock)]), [['now', true]], 'a shout from today says now, its clock time on hover');assert.ok(bare(times(now.show('detail'))), 'a history from today shows bare times');const tomorrow = await openPage(view, { later: 1 });@@ -2274,7 +2279,8 @@ test('times say which day they were [N26]', async () => {const date = new Date().toLocaleDateString([], { month: 'short', day: 'numeric' });const later = await openPage(view, { later: 2 });assert.deepEqual([days(later.show('feed')), days(later.show('activity'))], [[weekday], [weekday]], 'two days on, the feeds name the day');- assert.ok(bare(times(later.show('feed'))) && bare(times(later.show('activity'))), 'their rows keep the clock time');+ assert.ok(bare(times(later.show('activity'))), 'activity rows keep the clock time');+ assert.deepEqual(ages(later.show('feed')).map(([age, clock]) => [age, new RegExp(`^${date} \\d\\d:\\d\\d$`).test(clock)]), [['2d ago', true]], 'a shout says how long ago, with its date and time on hover');const history = times(later.show('detail'));assert.ok(history.length === 3 && history.every((time) => new RegExp(`^${date} \\d\\d:\\d\\d$`).test(time)), `the history dates each move: ${history}`);@@ -2283,6 +2289,10 @@ test('times say which day they were [N26]', async () => {const rows = JSON.stringify([at(6, 15), at(6, 9), at(5, 20), at(3, 12)].map((iso) => ({ iso })));const html = now.run(`byDay(${rows}, (x) => x.iso, () => '<div></div>')`);assert.equal(html.replace(/<h4 class="day">[^<]*<\/h4>/g, 'H').replaceAll('<div></div>', 'r'), 'HrrHrHr');+ // Shouts get a rule only where the day changes, and none above today's.+ const rule = (list) => now.run(`dayRules(${JSON.stringify(list.map((iso) => ({ iso })))}, (x) => x.iso, () => '<div></div>')`).replace(/<div class="day-rule" role="separator"><span>[^<]*<\/span><\/div>/g, 'H').replaceAll('<div></div>', 'r');+ assert.equal(rule([at(6, 15), at(6, 9), at(5, 20), at(3, 12)]), 'HrrHrHr', 'an older first day still gets its rule');+ assert.equal(rule([new Date().toISOString(), at(6, 9)]), 'rHr', 'today has no rule; the first earlier day does');} finally {await view.stop();}@@ -2509,7 +2519,7 @@ test('an empty feed says so on one line [N26]', async () => {const view = await startView(box);try {const page = await openPage(view);- assert.equal(page.show('feed'), '<div class="empty">No shouts yet.</div>');+ assert.equal(page.show('feed'), '<div class="feed-bar"><span></span><button class="link" data-agents-toggle type="button">Hide agents</button></div><div class="empty">No shouts yet.</div>', 'one line under the bar that hides the agents');assert.match(page.html, /<div class="card-panel feed" id="feed"><\/div>/, 'the shouts feed');assert.match(page.html, /<div class="card-panel feed" id="activity"><\/div>/, 'and the activity feed are both feeds');const style = await styleOf(view);@@ -2530,9 +2540,11 @@ test('a shout shows the evidence it carries [B22]', async () => {const view = await startView(box);try {const feed = (await openPage(view)).show('feed');- const card = (kind, outcome) => `<span class="ev"><b>${kind}</b> ${outcome} · <button class="ref" data-go="item:1" title="Greeting" type="button">#1</button> · web-1 · <code title="${head}">${head.slice(0, 12)}</code></span>`;- assert.ok(feed.includes('the page loads in 80ms' + card('receipt', 'measured <fast>')), 'what was measured, for which item, by whom, at which commit');- assert.ok(feed.includes('tried a cache' + card('attempt', 'failed')), 'and what was tried');+ const card = (kind, outcome) => `<div class="receipt"><div><span class="badge">${kind}</span> <span class="outcome">${outcome}</span></div><div class="receipt-foot"><button class="ref" data-go="item:1" title="Greeting" type="button">#1</button> · web-1 · <code class="inline sha" title="${head}">${head.slice(0, 10)}</code></div></div>`;+ const after = (text) => feed.slice(feed.indexOf(text + '</div>') + text.length + 6).replace(/^<button class="more" data-more type="button">more<\/button>/, '');+ assert.ok(after('the page loads in 80ms').startsWith(card('receipt', 'measured <fast>')), `what was measured, for which item, by whom, at which commit: ${after('the page loads in 80ms').slice(0, 400)}`);+ assert.ok(after('tried a cache').startsWith(card('attempt', 'failed')), 'and what was tried');+ assert.match(feed, /<span class="item">#1<\/span>/, 'the card names its item on top');assert.ok(feed.includes('nothing to show</div>'), 'a shout with no evidence has no card');} finally {await view.stop();@@ -3736,7 +3748,7 @@ test('real Chrome keeps the demo board usable at phone and desktop widths [H5,N2return JSON.parse(await chrome.evaluate(`JSON.stringify((() => {const visible=e=>{const s=getComputedStyle(e),r=e.getBoundingClientRect();return !e.disabled&&s.display!=='none'&&s.visibility!=='hidden'&&Number(s.opacity)!==0&&r.width>0&&r.height>0&&!e.closest('[hidden]')};const selector='button,a[href],input:not([type=hidden]),select,textarea,[role=button],[data-root],[data-tab],[data-go],[data-item],[data-state],[data-rows],[data-row],[data-release],[data-shout],[data-new],[data-code]';- const controls=[...new Set(document.querySelectorAll(selector))].filter(visible).map(e=>{const r=e.getBoundingClientRect();return {tag:e.tagName,id:e.id||'',text:(e.innerText||e.getAttribute('aria-label')||'').trim().slice(0,60),x:r.x,y:r.y,right:r.right,bottom:r.bottom,width:r.width,height:r.height,inlineReference:e.matches('.feed button.ref, .ask button.ref, .detail button.ref')||!!e.closest('#chain .meta .gate, #detail .kv dd.waits-on')}});+ const controls=[...new Set(document.querySelectorAll(selector))].filter(visible).map(e=>{const r=e.getBoundingClientRect();return {tag:e.tagName,id:e.id||'',text:(e.innerText||e.getAttribute('aria-label')||'').trim().slice(0,60),x:r.x,y:r.y,right:r.right,bottom:r.bottom,width:r.width,height:r.height,inlineReference:e.matches('.feed button.ref, .shout button.ref, .shout .band a, .detail button.ref')||!!e.closest('#chain .meta .gate, #detail .kv dd.waits-on')}});const notice=document.querySelector('#console');const noticeBox=visible(notice)?notice.getBoundingClientRect():null;const toast=noticeBox?{x:noticeBox.x,y:noticeBox.y,right:noticeBox.right,bottom:noticeBox.bottom,visible:noticeBox.y>=0&¬iceBox.bottom<=innerHeight,@@ -3813,34 +3825,30 @@ test('real Chrome keeps the demo board usable at phone and desktop widths [H5,N2assert.ok(wrap.tokenLines > 1, `${width}: only the overflowing unbroken token splits: ${JSON.stringify(wrap)}`);}if (tab === 'shouts') {- await waitRendered([- '#decisions .ask.other', '#decisions .ask.other p:first-child', '#decisions .ask.other p:nth-child(2)',- '#decisions .ask:not(.other) p:first-child', '#decisions .ask:not(.other) button',- ]);+ await waitRendered(['#decisions .shout:not(:has(.answer)) header', '#decisions .shout:not(:has(.answer)) .text', '#decisions .shout .answer']);const asks = JSON.parse(await chrome.evaluate(`JSON.stringify((() => {- const waiting = document.querySelector('#decisions .ask.other');- const waitingMeta = waiting?.querySelector('p:first-child');- const waitingText = waiting?.querySelector('p:nth-child(2)');- const answer = document.querySelector('#decisions .ask:not(.other)');- const answerMeta = answer?.querySelector('p:first-child');- const button = answer?.querySelector('button');- const rect = e => { const r=e.getBoundingClientRect(); return {left:r.left,right:r.right,width:r.width,height:r.height}; };+ const waiting = document.querySelector('#decisions .shout:not(:has(.answer))');+ const waitingMeta = waiting?.querySelector('header');+ const waitingText = waiting?.querySelector('.text');+ const button = document.querySelector('#decisions .shout .answer');+ const answerText = button?.closest('.shout-main').querySelector('.text');+ const rect = e => { const r=e.getBoundingClientRect(); return {left:r.left,right:r.right,top:r.top,bottom:r.bottom,width:r.width,height:r.height}; };return {waitingIsNeedsYou: document.querySelector('#decisions').classList.contains('needs-you'),- waitingHasNoButton: !!waiting && !waiting.querySelector('button'),+ waitingHasNoAnswer: !!waiting && !waiting.querySelector('.answer'),waitingMeta: waitingMeta && rect(waitingMeta),- waitingMetaLine: waitingMeta && parseFloat(getComputedStyle(waitingMeta).lineHeight),- waitingAsk: waiting && rect(waiting), waitingText: waitingText && rect(waitingText),- answerMeta: answerMeta && rect(answerMeta), button: button && rect(button),+ waitingMetaLine: waitingMeta && parseFloat(getComputedStyle(waitingMeta.querySelector('.who')).lineHeight),+ waitingMain: waiting && rect(waiting.querySelector('.shout-main')), waitingText: waitingText && rect(waitingText),+ answerText: answerText && rect(answerText), button: button && rect(button),};})())`));- assert.ok(asks.waitingIsNeedsYou && asks.waitingHasNoButton, `${width}: the waiting ask is shown in the Needs-you card without an answer button`);+ assert.ok(asks.waitingIsNeedsYou && asks.waitingHasNoAnswer, `${width}: the waiting ask is a card in the Needs-you panel without an Answer button`);assert.ok(asks.waitingMeta.width > 0 && asks.waitingMeta.height <= asks.waitingMetaLine + 1,`${width}: waiting ask who/when stays on one line: ${JSON.stringify(asks)}`);- assert.ok(asks.waitingText.width >= asks.waitingAsk.width - 24,- `${width}: waiting ask text spans the row: ${JSON.stringify(asks)}`);- assert.ok(asks.button.left > asks.answerMeta.right,- `${width}: an answer button keeps its own grid column: ${JSON.stringify(asks)}`);+ assert.ok(asks.waitingText.width >= asks.waitingMain.width - 1,+ `${width}: waiting ask text spans the card: ${JSON.stringify(asks)}`);+ assert.ok(asks.button.top >= asks.answerText.bottom && asks.button.left >= asks.answerText.left - 1 && asks.button.height >= 44,+ `${width}: the Answer button sits under the ask it answers: ${JSON.stringify(asks)}`);}}await click('[data-tab="items"]');@@ -4267,7 +4275,7 @@ test('real Chrome styles shout code and item text without growing linked lines [if (message.method === 'Log.entryAdded' && message.params.entry.level === 'error') consoleErrors.push(message.params.entry.text);});await chrome.send('Log.enable');- await chrome.waitFor('typeof data !== "undefined" && data?.project?.shouts?.length >= 4 && document.querySelectorAll("#feed > div:not(.day)").length >= 4');+ await chrome.waitFor('typeof data !== "undefined" && data?.project?.shouts?.length >= 4 && document.querySelectorAll("#feed > .shout").length >= 4');await chrome.send('Emulation.setDeviceMetricsOverride', { width: 1280, height: 900, deviceScaleFactor: 1, mobile: false });await chrome.waitFor('innerWidth === 1280 && document.querySelector("#detail .text.muted code.inline")?.getBoundingClientRect().width > 0');const desktopBrief = JSON.parse(await chrome.evaluate(`JSON.stringify((() => {@@ -4293,21 +4301,21 @@ test('real Chrome styles shout code and item text without growing linked lines [await chrome.evaluate(`document.querySelector('[data-tab="shouts"]').click()`);const rendered = JSON.parse(await chrome.evaluate(`JSON.stringify((() => {- const shout = [...document.querySelectorAll('#feed > div:not(.day)')].find((row) => row.textContent.includes('Inline'));- const shoutCode=[...(shout?.querySelectorAll('code.inline')||[])].find(code=>code.textContent==='--flag'), shoutLine=shout?.children[1];+ const shout = [...document.querySelectorAll('#feed > .shout')].find((row) => row.textContent.includes('Inline'));+ const shoutCode=[...(shout?.querySelectorAll('code.inline')||[])].find(code=>code.textContent==='--flag'), shoutLine=shout?.querySelector('.text');const shoutRect=shoutCode?.getBoundingClientRect(), shoutLineRect=shoutLine?.getBoundingClientRect();- const ask = [...document.querySelectorAll('#decisions .ask')].find((row) => row.textContent.includes('Inline'));+ const ask = [...document.querySelectorAll('#decisions .shout')].find((row) => row.textContent.includes('Inline'));const titleNode = document.querySelector('#chain .row .t');- const outside = [...document.querySelectorAll('#feed > div:not(.day)')].find((row) => row.textContent.includes('alert(2)'));+ const outside = [...document.querySelectorAll('#feed > .shout')].find((row) => row.textContent.includes('alert(2)'));const itemDetail = document.querySelector('#detail');const agentItem = document.querySelector('#agents .agent [data-item="1"]');/** Measure the complete rendered content line box, including its item link. */const lineMetrics = (message) => {- const row = [...document.querySelectorAll('#feed > div:not(.day)')].find((entry) => {- const content = entry.children[1];- return content && content.textContent.slice(content.querySelector('b')?.textContent.length ?? 0).trim() === message;+ const row = [...document.querySelectorAll('#feed > .shout')].find((entry) => {+ const content = entry.querySelector('.text');+ return content && content.textContent.trim() === message;});- const content = row.children[1];+ const content = row.querySelector('.text');const height = content.getBoundingClientRect().height;const lineHeight = parseFloat(getComputedStyle(content).lineHeight);return { height, lineHeight, lines: Math.round(height / lineHeight) };@@ -4318,9 +4326,9 @@ test('real Chrome styles shout code and item text without growing linked lines [askHtml: ask.innerHTML, titleHtml: titleNode.innerHTML,linkedMetrics: lineMetrics('X #1'), plainMetrics: lineMetrics('X'),wrapLinked: lineMetrics(${JSON.stringify(wrappedLinkedText)}), wrapPlain: lineMetrics('OK'),- linkedButtons: [...document.querySelectorAll('#feed > div:not(.day)')].find((entry) => entry.textContent.includes('A linked line'))?.querySelectorAll('button.ref').length,+ linkedButtons: [...document.querySelectorAll('#feed > .shout')].find((entry) => entry.textContent.includes('A linked line'))?.querySelectorAll('button.ref').length,previewLinks: shout.querySelectorAll('button[data-code^="SPEC.md:1-2@"]').length,- outsideHtml: outside.innerHTML, askNestedButtons: ask.querySelector('p').querySelectorAll('button').length,+ outsideHtml: outside.innerHTML, askNestedButtons: [...ask.querySelectorAll('button')].filter(link => link.parentElement.closest('button')).length,criterionHtml: itemDetail.querySelector('.text')?.innerHTML, briefHtml: itemDetail.querySelector('.text.muted')?.innerHTML,needsNestedButtons: [...document.querySelectorAll('#needs button.ref')].filter(link => link.parentElement.closest('button')).length,agentNestedButtons: [...document.querySelectorAll('#agents .agent button.ref')].filter(link => link.parentElement.closest('button')).length,@@ -4331,10 +4339,10 @@ test('real Chrome styles shout code and item text without growing linked lines [assert.ok(rendered.shoutCodeMetrics.width > 0 && rendered.shoutCodeMetrics.width < rendered.shoutCodeMetrics.lineWidth / 2,`1280px shout code is a compact chip: ${JSON.stringify(rendered.shoutCodeMetrics)}`);assert.match(rendered.shoutHtml, /<code class="inline">code <b>safe<\/b><\/code>/, 'backticks create escaped inline code');- assert.match(rendered.shoutHtml, /<code class="inline(?: long)?">pullboard shout --decision<\/code>/, 'a pullboard command is inline code, with the flags that follow it');- assert.match(rendered.shoutHtml, /<code class="inline">--flag<\/code>/, 'a flag on its own is inline code');- assert.match(rendered.shoutHtml, /<code class="inline">src\/cockpit\.js<\/code>/, 'slash paths are inline code');- assert.match(rendered.shoutHtml, /<code class="inline long">0123456789abcdef0123456789abcdef01234567<\/code>/, 'hex SHAs are inline code, long enough to wrap');+ assert.match(rendered.shoutHtml, /<code class="inline cmd(?: long)?">pullboard shout --decision<\/code>/, 'a pullboard command is inline code, with the flags that follow it');+ assert.match(rendered.shoutHtml, /<code class="inline cmd">--flag<\/code>/, 'a flag on its own is a command chip');+ assert.match(rendered.shoutHtml, /<code class="inline path">src\/cockpit\.js<\/code>/, 'slash paths are path chips');+ assert.match(rendered.shoutHtml, /<code class="inline sha" title="0123456789abcdef0123456789abcdef01234567">0123456789<\/code>/, 'a hex SHA is a ten-character chip with the whole SHA on hover');assert.ok((rendered.shoutHtml.match(/<code class="code block">/g) ?? []).length >= 2, 'fences and dollar-prefixed lines are code blocks');assert.match(rendered.shoutHtml, /<code class="code block">\$ pullboard claim 1<\/code>/, 'the shell prompt stays visible in command blocks');assert.match(rendered.shoutHtml, /<script>alert\(1\)<\/script>/, 'script text is escaped inside code');@@ -4346,7 +4354,7 @@ test('real Chrome styles shout code and item text without growing linked lines [await chrome.waitFor(`document.querySelector('#feed button[data-code^="SPEC.md:1-2@"]').getAttribute('aria-expanded') === 'true'`);await chrome.waitFor(`document.querySelector('#feed button[data-code^="SPEC.md:1-2@"] + .code')?.textContent.includes('Demo spec')`);assert.match(await chrome.evaluate(`document.querySelector('#feed button[data-code^="SPEC.md:1-2@"] + .code')?.textContent || ''`), /Demo spec/, 'the original code preview still opens its referenced lines');- assert.match(rendered.askHtml, /<code class="inline(?: long)?">pullboard shout --decision<\/code>/, 'needs-you uses the same code renderer');+ assert.match(rendered.askHtml, /<code class="inline cmd(?: long)?">pullboard shout --decision<\/code>/, 'needs-you uses the same code renderer');assert.equal(rendered.askNestedButtons, 0, 'formatted text in an ask cannot nest interactive controls');assert.equal(rendered.needsNestedButtons, 0, 'needs-you keeps its button markup valid');assert.equal(rendered.agentNestedButtons, 0, 'agent item buttons never nest reference controls');@@ -4361,7 +4369,7 @@ test('real Chrome styles shout code and item text without growing linked lines [assert.ok(Math.abs(rendered.linkedMetrics.height - rendered.plainMetrics.height) < 1, 'the complete one-line desktop boxes match within 1px');assert.ok(Math.abs(rendered.linkedMetrics.height - rendered.linkedMetrics.lineHeight) < 1, 'the linked desktop box equals one computed line-height');await chrome.send('Emulation.setDeviceMetricsOverride', { width: 375, height: 900, deviceScaleFactor: 1, mobile: false });- await chrome.waitFor('innerWidth === 375 && document.querySelector("#feed > div:not(.day)")?.getBoundingClientRect().width > 0');+ await chrome.waitFor('innerWidth === 375 && document.querySelector("#feed > .shout")?.getBoundingClientRect().width > 0');await chrome.evaluate("document.querySelector('[data-tab=items]').click()");await chrome.waitFor('document.querySelector("[data-pane=items]:not([hidden])") && document.querySelector("#detail .text.muted code.inline")?.getBoundingClientRect().width > 0');const phoneBrief = JSON.parse(await chrome.evaluate(`JSON.stringify((() => {@@ -4389,17 +4397,17 @@ test('real Chrome styles shout code and item text without growing linked lines [const phoneMetrics = JSON.parse(await chrome.evaluate(`JSON.stringify((() => {/** Measure the complete rendered content line box, including its item link. */const lineMetrics = (message) => {- const row = [...document.querySelectorAll('#feed > div:not(.day)')].find((entry) => {- const content = entry.children[1];- return content && content.textContent.slice(content.querySelector('b')?.textContent.length ?? 0).trim() === message;+ const row = [...document.querySelectorAll('#feed > .shout')].find((entry) => {+ const content = entry.querySelector('.text');+ return content && content.textContent.trim() === message;});- const content = row.children[1];+ const content = row.querySelector('.text');const height = content.getBoundingClientRect().height;const lineHeight = parseFloat(getComputedStyle(content).lineHeight);return { height, lineHeight, lines: Math.round(height / lineHeight) };};- const row=[...document.querySelectorAll('#feed > div:not(.day)')].find(entry=>entry.textContent.includes('Inline'));- const code=[...(row?.querySelectorAll('code.inline')||[])].find(entry=>entry.textContent==='--flag'), line=row?.children[1], codeRect=code?.getBoundingClientRect(), lineRect=line?.getBoundingClientRect();+ const row=[...document.querySelectorAll('#feed > .shout')].find(entry=>entry.textContent.includes('Inline'));+ const code=[...(row?.querySelectorAll('code.inline')||[])].find(entry=>entry.textContent==='--flag'), line=row?.querySelector('.text'), codeRect=code?.getBoundingClientRect(), lineRect=line?.getBoundingClientRect();return { linked: lineMetrics('X #1'), plain: lineMetrics('X'), wrapLinked: lineMetrics(${JSON.stringify(wrappedLinkedText)}), wrapPlain: lineMetrics('OK'), shoutCode:{display:code&&getComputedStyle(code).display,width:codeRect?.width,lineWidth:lineRect?.width} };})())`));assert.equal(phoneMetrics.shoutCode.display, 'inline', `375px shout code computes inline: ${JSON.stringify(phoneMetrics.shoutCode)}`);@@ -4424,6 +4432,320 @@ test('real Chrome styles shout code and item text without growing linked lines [}});+/**+ * Write to a project's board as it was some time ago, through the board's own writers on a clock set back:+ * a card's age, its day rule and whether its agent is at work all depend on when, and the CLI only writes now.+ */+function earlier(repo, at, write) {+ const board = openBoard(join(repo, '.git', 'pullboard', 'board.sqlite'), { now: () => new Date(at) });+ try {+ return write(board);+ } finally {+ closeBoard(board);+ }+}++/** Put the page in a width and a colour scheme, and wait for the shouts to lay out again. */+async function shoutsAt(chrome, width, scheme) {+ await chrome.send('Emulation.setDeviceMetricsOverride', { width, height: 900, deviceScaleFactor: 1, mobile: false });+ await chrome.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-color-scheme', value: scheme }] });+ await chrome.waitFor(`innerWidth === ${width} && matchMedia('(prefers-color-scheme: ${scheme})').matches && document.querySelector('#feed .shout')?.getBoundingClientRect().width > 0`);+ await chrome.evaluate('new Promise((done) => requestAnimationFrame(() => requestAnimationFrame(done)))');+}++test('shouts read as cards [N26]', { timeout: 120_000 }, async (t) => {+ const executable = chromeExecutable();+ if (!executable) return t.skip('Install Chrome or set PULLBOARD_CHROME for rendered shout checks.');++ const box = machine();+ const alpha = project(box, 'cards');+ box.run(alpha.repo, 'add', 'web', 'Greeting', '--specs', 'G1', '--criterion', 'greets');+ box.run(alpha.web, 'claim', '1');+ const second = join(box.dir, 'cards-web-2');+ box.git(alpha.repo, 'worktree', 'add', '-q', second, '-b', 'web/cards2');+ box.run(second, 'join', 'web');+ const head = box.git(alpha.repo, 'rev-parse', 'HEAD');+ const sha = '0123456789abcdef0123456789abcdef01234567';+ const lines = (first, n) => [first, ...Array.from({ length: n - 1 }, (_, k) => `Line ${k + 2} of the note.`)].join('\n');+ const older = 'Started on #1 two days back.';+ const colour = lines('Which colour for the button? #99 is no item.', 8);+ const ship = 'Ship #1 today?';+ const chips = `See #1 in src/cockpit.js at ${sha}; run pullboard check --json, then \`npm test\`.`;+ const long = lines('A long note that folds.', 12);+ const twoDays = new Date(); twoDays.setDate(twoDays.getDate() - 2); twoDays.setHours(12, 0, 0, 0);+ earlier(alpha.repo, twoDays, (board) => shoutOnBoard(board, { from: 'web-1', to: 'coordinator', text: older, lanes: ['web'] }));+ earlier(alpha.repo, Date.now() - 65 * 60e3, (board) => shoutOnBoard(board, { from: 'web-2', to: 'coordinator', text: colour, decision: true, lanes: ['web'] }));+ earlier(alpha.repo, Date.now() - 125e3, (board) => shoutOnBoard(board, { from: 'web-1', to: 'coordinator', text: ship, decision: true, lanes: ['web'] }));+ const asked = JSON.parse(box.run(alpha.repo, 'decisions', '--json')).decisions.find((d) => d.shout_text === ship);+ box.run(alpha.repo, 'answer', String(asked.shout_id), 'Yes, ship it.');+ box.run(alpha.web, 'shout', 'all', 'the page loads in 80ms', '--evidence', 'receipt', '--outcome', 'measured 80ms', '--item', '1', '--commit', head);+ box.run(alpha.web, 'shout', 'all', chips);+ box.run(alpha.repo, 'shout', 'person', 'Launch on Friday?', '--decision');+ box.run(alpha.web, 'shout', 'all', long);++ const view = await startView(box);+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-cards-chrome-'));+ let chrome;+ try {+ chrome = await openSnapshotChrome(executable, view.link.href, profile);+ await chrome.waitFor('typeof data !== "undefined" && data?.project?.shouts?.length >= 8');+ await chrome.evaluate("document.querySelector('[data-tab=shouts]').click()");+ await chrome.waitFor('document.querySelector("[data-pane=shouts]:not([hidden]) #feed .shout")');+ const ids = JSON.parse(await chrome.evaluate('JSON.stringify(Object.fromEntries(data.project.shouts.map((s) => [s.shout_text, s.shout_id])))'));+ const answerId = await chrome.evaluate(`data.project.shouts.find((s) => s.shout_answers === ${asked.shout_id}).shout_id`);+ const stamps = JSON.parse(await chrome.evaluate('JSON.stringify(data.project.shouts.map((s) => [s.shout_id, s.shout_at]))'));++ /** Everything a card shows, measured where it stands. */+ const read = async () => JSON.parse(await chrome.evaluate(`JSON.stringify((() => {+ const box = (e) => { if (!e) return null; const r = e.getBoundingClientRect(); return { left: r.left, right: r.right, top: r.top, bottom: r.bottom, width: r.width, height: r.height }; };+ const style = (e) => getComputedStyle(e);+ const card = (place, id) => {+ const e = document.querySelector(place + ' #shout-' + id) ?? [...document.querySelectorAll(place + ' .shout')].find((c) => c.dataset.shoutId === String(id));+ if (!e) return null;+ const avatar = e.querySelector('.avatar'), who = e.querySelector('.who'), time = e.querySelector('header time'), text = e.querySelector('.text');+ const edges = [e, ...e.querySelectorAll('.receipt, .band')].map((part) => { const s = style(part); return { left: [s.borderLeftWidth, s.borderLeftColor], right: [s.borderRightWidth, s.borderRightColor] }; });+ return {+ classes: e.className, avatar: { text: avatar.textContent, svg: !!avatar.querySelector('svg'), radius: style(avatar).borderTopLeftRadius, color: style(avatar).color, background: style(avatar).backgroundColor, box: box(avatar) },+ who: { text: who.textContent, color: style(who).color }, to: e.querySelector('.to')?.textContent, item: e.querySelector('header .item')?.textContent ?? null,+ item_color: e.querySelector('header .item') && style(e.querySelector('header .item')).color, ink: style(text).color,+ time: { text: time.textContent, title: time.title, box: box(time) }, header: box(e.querySelector('header')), text: { box: box(text), lines: Math.round(text.clientHeight / parseFloat(style(text).lineHeight)), clamped: text.scrollHeight > text.clientHeight + 1 },+ more: (() => { const m = e.querySelector('.more'); return m && style(m).display !== 'none' ? m.textContent : null; })(),+ band: e.querySelector('.band') ? { text: e.querySelector('.band').textContent, done: e.querySelector('.band').classList.contains('done'), href: e.querySelector('.band a')?.getAttribute('href') ?? null } : null,+ receipt: e.querySelector('.receipt') ? { badge: e.querySelector('.receipt .badge').textContent, outcome: e.querySelector('.receipt .outcome').textContent, foot: e.querySelector('.receipt-foot').textContent,+ sha: e.querySelector('.receipt-foot code.sha')?.textContent, shaTitle: e.querySelector('.receipt-foot code.sha')?.title } : null,+ answer: e.querySelector('.answer')?.textContent ?? null, edges,+ };+ };+ const chip = (selector) => { const e = document.querySelector('#feed #shout-${ids[chips]} .text ' + selector); return e && { text: e.textContent, title: e.title, display: style(e).display, rects: e.getClientRects().length, color: style(e).color, background: style(e).backgroundColor }; };+ const feed = document.querySelector('#feed'), rule = feed.querySelector('.day-rule'), label = rule?.querySelector('span');+ return {+ page: { width: document.documentElement.clientWidth, scroll: document.documentElement.scrollWidth, body: document.body.scrollWidth },+ feedKinds: [...feed.children].map((e) => e.classList.contains('day-rule') ? 'rule:' + e.textContent : e.classList.contains('shout') ? 'shout:' + e.dataset.shoutId : e.className),+ rule: rule && { box: box(rule), label: box(label) },+ heads: [...document.querySelectorAll('#decisions .head')].map((h) => h.textContent),+ decisions: [...document.querySelectorAll('#decisions .shout')].map((e) => e.dataset.shoutId),+ feed: { older: card('#feed', ${ids[older]}), colour: card('#feed', ${ids[colour]}), ship: card('#feed', ${ids[ship]}), chips: card('#feed', ${ids[chips]}), long: card('#feed', ${ids[long]}),+ receipt: card('#feed', ${ids['the page loads in 80ms']}), answer: card('#feed', ${answerId}), friday: card('#feed', ${ids['Launch on Friday?']}) },+ asks: { friday: card('#decisions', ${ids['Launch on Friday?']}), colour: card('#decisions', ${ids[colour]}) },+ answerTarget: !!document.getElementById('shout-${answerId}'),+ repeated: [...document.querySelectorAll('[id]')].map((e) => e.id).filter((id, n, all) => all.indexOf(id) !== n),+ chips: { ref: chip('button.ref'), path: chip('code.path'), sha: chip('code.sha'), cmd: chip('code.cmd'), code: chip('code.inline:not(.path):not(.sha):not(.cmd)') },+ };+ })())`));++ const seen = {};+ for (const scheme of ['light', 'dark']) {+ for (const width of [1280, 375]) {+ await shoutsAt(chrome, width, scheme);+ const at = `${width}px ${scheme}`;+ const r = await read();+ assert.ok(r.page.scroll <= r.page.width && r.page.body <= r.page.width, `${at}: no sideways scroll: ${JSON.stringify(r.page)}`);+ const { older: old, colour: asking, ship: shipped, chips: chipCard, long: folded, receipt, answer, friday } = r.feed;++ // A card: avatar, name in its colour, arrow and recipient, item, and the age at the top right over the text.+ for (const [name, c] of Object.entries(r.feed)) {+ assert.ok(c, `${at}: the ${name} shout is a card`);+ assert.equal(c.classes.includes('lead') ? c.avatar.background : c.avatar.color, c.who.color, `${at}: ${name}: the name is in its avatar's colour`);+ assert.ok(Math.abs(c.time.box.right - c.header.right) <= 1 && c.time.box.top < c.text.box.top, `${at}: ${name}: the age sits at the top right: ${JSON.stringify([c.time, c.header])}`);+ assert.ok(c.text.box.top >= c.header.bottom - 1, `${at}: ${name}: the text sits below the header`);+ for (const edge of c.edges) assert.deepEqual(edge.left, edge.right, `${at}: ${name}: no box in the card carries a coloured edge`);+ }+ assert.deepEqual([old.avatar.text, old.who.text, old.to], ['W1', 'web-1', '→ coordinator'], `${at}: initials, name, arrow and recipient`);+ assert.equal(old.avatar.radius, '50%', `${at}: an agent's avatar is a circle`);+ assert.equal(chipCard.avatar.color, old.avatar.color, `${at}: one agent keeps one colour`);+ assert.notEqual(asking.avatar.color, old.avatar.color, `${at}: another agent has its own`);+ assert.ok(answer.avatar.svg && answer.avatar.radius !== '50%' && Math.abs(answer.avatar.box.width - answer.avatar.box.height) < 1 && answer.classes.includes('lead'),+ `${at}: the coordinator's avatar is a square with the Pullboard mark: ${JSON.stringify(answer.avatar)}`);+ assert.deepEqual([old.item, chipCard.item, receipt.item, asking.item], ['#1', '#1', '#1', null], `${at}: the item is the first #N that names one, or the evidence's`);+ assert.notEqual(old.item_color, old.who.color, `${at}: the item is muted, not the agent's colour`);+ assert.deepEqual([folded.time.text, shipped.time.text, asking.time.text], ['now', '2m ago', '1h ago'], `${at}: ages read now, 2m ago, 1h ago`);+ assert.ok(/\d\d:\d\d$/.test(shipped.time.title) && /^\S+ \d+ \d\d:\d\d$/.test(old.time.title), `${at}: the clock time is on hover, with the date when it was another day`);++ // Chips: inline, whole, ref, path and hash each in a colour of their own; a sha shows ten characters.+ for (const [kind, c] of Object.entries(r.chips)) {+ assert.ok(c, `${at}: the ${kind} chip renders`);+ assert.match(c.display, /^inline/, `${at}: the ${kind} chip stays inline`);+ assert.equal(c.rects, 1, `${at}: the ${kind} chip never breaks across lines`);+ }+ assert.equal(new Set([r.chips.ref.color, r.chips.path.color, r.chips.sha.color]).size, 3, `${at}: item refs, paths and hashes each have a colour: ${JSON.stringify(r.chips)}`);+ assert.deepEqual([r.chips.sha.text, r.chips.sha.title], [sha.slice(0, 10), sha], `${at}: a full sha shows its first ten characters, the whole on hover`);+ assert.deepEqual([r.chips.ref.text, r.chips.path.text, r.chips.cmd.text, r.chips.code.text], ['#1', 'src/cockpit.js', 'pullboard check --json', 'npm test']);++ // Decisions: a band until answered, then who answered and a link to the answer.+ assert.deepEqual(asking.band, { text: 'Decision needed', done: false, href: null }, `${at}: an open ask carries a Decision needed band`);+ assert.deepEqual(shipped.band, { text: 'Answered by coordinator: see the answer', done: true, href: `#shout-${answerId}` }, `${at}: an answered one says who answered, linking the answer`);+ assert.ok(r.answerTarget, `${at}: the link lands on the answer`);+ assert.deepEqual(r.repeated, [], `${at}: an ask shown in the feed and above the composer never repeats an id`);++ // Evidence: a receipt with kind, outcome and a footer of item, agent and short sha.+ assert.deepEqual([receipt.receipt.badge, receipt.receipt.outcome], ['receipt', 'measured 80ms']);+ assert.ok(receipt.receipt.foot.startsWith('#1 · web-1 · ') && receipt.receipt.sha === head.slice(0, 10) && receipt.receipt.shaTitle === head, `${at}: the receipt's footer: ${JSON.stringify(receipt.receipt)}`);++ // A long shout folds at six lines; the asks above the composer are the same cards, folded at three.+ assert.deepEqual([folded.text.lines, folded.text.clamped, folded.more], [6, true, 'more'], `${at}: a long shout folds at six lines with more`);+ assert.equal(old.more, null, `${at}: a short shout has no more`);+ assert.deepEqual(r.heads, ['Decision needed', 'Waiting on others'], `${at}: the asks above the composer`);+ assert.deepEqual([r.asks.friday.answer, r.asks.colour.answer], ['Answer', null], `${at}: the person's ask has an Answer button; one waiting on others has none`);+ assert.deepEqual([r.asks.colour.text.lines, r.asks.colour.text.clamped, r.asks.colour.more], [3, true, 'more'], `${at}: an ask folds at three lines`);+ assert.ok(r.asks.friday.avatar.svg && r.asks.friday.who.text === 'coordinator', `${at}: the asks are the feed's cards`);++ // Days: none above today's shouts; a rule in the middle names the earlier day where the feed crosses into it.+ let day = new Date().toDateString();+ const expected = ['feed-bar', ...stamps.flatMap(([id, iso]) => { const was = day; day = new Date(iso).toDateString(); return day === was ? [`shout:${id}`] : ['rule', `shout:${id}`]; })];+ assert.deepEqual(r.feedKinds.map((k) => k.startsWith('rule:') ? 'rule' : k), expected, `${at}: a rule only where the day changes, none above today's: ${r.feedKinds}`);+ assert.ok(r.feedKinds[r.feedKinds.indexOf(`shout:${ids[older]}`) - 1].startsWith('rule:') && !r.feedKinds.some((k) => k === 'rule:Today'), `${at}: the earlier day is named above its first shout`);+ assert.ok(Math.abs((r.rule.label.left + r.rule.label.right) / 2 - (r.rule.box.left + r.rule.box.right) / 2) < 2, `${at}: the day sits in the middle of its rule`);+ seen[at] = { ink: old.ink, who: old.who.color };+ }+ }+ assert.notDeepEqual(seen['1280px light'], seen['1280px dark'], 'dark mode changes the cards');++ // Folding: more opens the whole shout, less closes it, and an open shout stays open across a refresh.+ await shoutsAt(chrome, 1280, 'light');+ const foldOf = () => chrome.evaluate(`JSON.stringify((() => { const c = document.querySelector('#feed #shout-${ids[long]}'), t = c.querySelector('.text'); return [c.querySelector('.more').textContent, Math.round(t.clientHeight / parseFloat(getComputedStyle(t).lineHeight))]; })())`).then(JSON.parse);+ await chrome.evaluate(`document.querySelector('#feed #shout-${ids[long]} .more').click()`);+ assert.deepEqual(await foldOf(), ['less', 12], 'more shows every line');+ box.run(alpha.web, 'shout', 'all', 'A later shout.');+ await chrome.waitFor(`data.project.shouts.some((s) => s.shout_text === 'A later shout.') && document.querySelector('#feed .shout .text')?.textContent === 'A later shout.'`, 15_000);+ assert.deepEqual(await foldOf(), ['less', 12], 'an open shout stays open across a refresh');+ await chrome.evaluate(`document.querySelector('#feed #shout-${ids[long]} .more').click()`);+ assert.deepEqual(await foldOf(), ['more', 6], 'less folds it again');+ assert.deepEqual(chrome.exceptions, [], 'the page raises no uncaught exception');+ } finally {+ if (chrome) await closeSnapshotChrome(chrome);+ rmSync(profile, { recursive: true, force: true });+ await view.stop();+ }+});++test('the shout composer, agent filter and agents panel [N26]', { timeout: 120_000 }, async (t) => {+ const executable = chromeExecutable();+ if (!executable) return t.skip('Install Chrome or set PULLBOARD_CHROME for rendered shout checks.');++ const box = machine();+ const alpha = project(box, 'composer');+ box.run(alpha.repo, 'add', 'web', 'Greeting', '--specs', 'G1', '--criterion', 'greets');+ box.run(alpha.web, 'claim', '1');+ const idle = join(box.dir, 'composer-web-2'), fresh = join(box.dir, 'composer-web-3');+ box.git(alpha.repo, 'worktree', 'add', '-q', idle, '-b', 'web/composer2');+ // web-2 joined and spoke three hours ago, and has not moved since.+ earlier(alpha.repo, Date.now() - 3 * 36e5, (board) => {+ assert.equal(register(board, { lane: 'web', path: idle }), 'web-2');+ shoutOnBoard(board, { from: 'web-2', to: 'coordinator', text: 'An idle agent spoke this morning.', lanes: ['web'] });+ });+ box.run(alpha.repo, 'shout', 'web-2', 'The coordinator wrote to the idle agent.');+ box.git(alpha.repo, 'worktree', 'add', '-q', fresh, '-b', 'web/composer3');+ box.run(fresh, 'join', 'web');+ box.run(fresh, 'shout', 'all', 'A fresh agent says hello.');+ box.run(alpha.web, 'shout', 'all', 'The claim holder reports in.');++ const view = await startView(box);+ const profile = mkdtempSync(join(tmpdir(), 'pullboard-composer-chrome-'));+ let chrome;+ try {+ chrome = await openSnapshotChrome(executable, view.link.href, profile);+ await chrome.waitFor('typeof data !== "undefined" && data?.project?.shouts?.length >= 4');+ await chrome.evaluate("document.querySelector('[data-tab=shouts]').click()");+ await chrome.waitFor('document.querySelector("[data-pane=shouts]:not([hidden]) #feed .shout")');+ const agents = JSON.parse(await chrome.evaluate('JSON.stringify(data.project.agents.map((a) => [a.agent_id, a.agent_path]))'));+ assert.deepEqual(agents.filter(([, path]) => [alpha.web, idle, fresh].includes(path)).map(([id]) => id).sort(), ['web-1', 'web-2', 'web-3'], 'three agents joined the web lane');+ const total = await chrome.evaluate('data.project.shouts.length');+ const state = async () => JSON.parse(await chrome.evaluate(`JSON.stringify((() => {+ const box = (e) => { if (!e) return null; const r = e.getBoundingClientRect(); return { left: r.left, right: r.right, top: r.top, bottom: r.bottom, width: r.width, height: r.height }; };+ const pane = document.querySelector('[data-pane=shouts]'), list = document.querySelector('#agents');+ return {+ page: { width: document.documentElement.clientWidth, scroll: document.documentElement.scrollWidth, body: document.body.scrollWidth },+ listed: [...list.querySelectorAll('.agent-name')].map((e) => e.dataset.agent), on: [...list.querySelectorAll('.agent.on .agent-name')].map((e) => e.dataset.agent),+ all: list.querySelector('.all-agents')?.textContent ?? null, panel: list.offsetParent !== null, bare: pane.classList.contains('bare'),+ toggle: document.querySelector('#feed [data-agents-toggle]')?.textContent, bar: document.querySelector('#feed .feed-bar span')?.textContent ?? '',+ cards: [...document.querySelectorAll('#feed .shout')].map((c) => [c.querySelector('.who').textContent, c.querySelector('.to').textContent.replace('→ ', '')]),+ to: document.querySelector('#shout-to').value, feed: box(document.querySelector('#feed')),+ composer: box(document.querySelector('.composer')), label: box(document.querySelector('.composer label.to')), message: box(document.querySelector('#shout-text')), send: box(document.querySelector('#shout-send')),+ kept: (() => { try { return localStorage.getItem('pb.agents'); } catch { return 'unreadable'; } })(),+ };+ })())`));+ const click = (selector) => chrome.evaluate(`document.querySelector(${JSON.stringify(selector)}).click()`);+ const key = async (modifiers) => {+ for (const type of ['keyDown', 'keyUp']) await chrome.send('Input.dispatchKeyEvent', { type, key: 'Enter', code: 'Enter', windowsVirtualKeyCode: 13, nativeVirtualKeyCode: 13, modifiers, ...(type === 'keyDown' ? { text: '\r', unmodifiedText: '\r' } : {}) });+ };++ for (const scheme of ['light', 'dark']) {+ for (const width of [1280, 375]) {+ await shoutsAt(chrome, width, scheme);+ const at = `${width}px ${scheme}`;+ const s = await state();+ assert.ok(s.page.scroll <= s.page.width && s.page.body <= s.page.width, `${at}: no sideways scroll: ${JSON.stringify(s.page)}`);+ // One bar: to on the left, the message, the send button on the right, all in one row.+ for (const part of ['label', 'message', 'send']) assert.ok(s[part].top >= s.composer.top - 0.5 && s[part].bottom <= s.composer.bottom + 0.5, `${at}: the ${part} sits inside the composer bar: ${JSON.stringify(s)}`);+ assert.ok(s.label.right <= s.message.left + 0.5 && s.message.right <= s.send.left + 0.5 && s.composer.right - s.send.right < 12, `${at}: to, message, send from left to right: ${JSON.stringify(s)}`);+ assert.ok(s.send.width >= 44 && s.send.height >= 44, `${at}: the send button is a 44px target`);+ // Only agents at work are listed, with show all.+ assert.ok(s.panel && s.listed.includes('web-1') && s.listed.includes('web-3') && !s.listed.includes('web-2'), `${at}: the agents at work, and not the idle one: ${s.listed}`);+ assert.equal(s.all, `show all ${agents.length}`, `${at}: every agent is one click away`);+ }+ }++ await shoutsAt(chrome, 1280, 'light');+ await click('#agents .all-agents');+ let s = await state();+ assert.ok(s.listed.includes('web-2') && s.listed.length === agents.length && s.all === 'show only agents at work', `show all lists every agent: ${JSON.stringify(s.listed)}`);++ // An agent's name filters the feed to its shouts, from or to it, and addresses the composer to it.+ await click('#agents [data-agent="web-2"]');+ s = await state();+ assert.deepEqual(s.cards, [['coordinator', 'web-2'], ['web-2', 'coordinator']], 'only shouts from or to web-2');+ assert.deepEqual([s.bar, s.to, s.on], ['Shouts with web-2 show all', 'web-2', ['web-2']], 'the bar says whose, the composer is addressed to them, and the agent is marked');+ await click('#feed .feed-bar [data-agent=""]');+ s = await state();+ assert.deepEqual([s.cards.length, s.bar, s.on], [total, '', []], 'show all undoes the filter');+ await click('#agents .all-agents');++ // The message grows as it is typed; Shift+Enter starts a line, Enter sends.+ await chrome.evaluate("document.querySelector('#shout-to').value = 'all'; document.querySelector('#shout-text').focus()");+ const height = () => chrome.evaluate("document.querySelector('#shout-text').getBoundingClientRect().height");+ const one = await height();+ await chrome.send('Input.insertText', { text: 'First line' });+ await key(8);+ await chrome.send('Input.insertText', { text: 'second line' });+ await key(8);+ await chrome.send('Input.insertText', { text: 'third line' });+ assert.equal(await chrome.evaluate("document.querySelector('#shout-text').value"), 'First line\nsecond line\nthird line', 'Shift+Enter starts a new line');+ assert.ok(await height() > one + 20, 'the message grows as it is typed');+ assert.equal(await chrome.evaluate('data.project.shouts.length'), total, 'and sends nothing');+ await key(0);+ await chrome.waitFor("data.project.shouts.some((s) => s.shout_text === 'First line\\nsecond line\\nthird line' && s.shout_to === 'all')", 15_000);+ await chrome.waitFor("document.querySelector('#shout-text').value === ''");+ assert.ok(Math.abs(await height() - one) < 1, 'Enter sends, and the bar shrinks back to one line');+ assert.ok(await chrome.evaluate("!document.querySelector('#console').hidden && !document.querySelector('.composer #console') && document.querySelector('#console').getBoundingClientRect().bottom <= document.querySelector('.composer').getBoundingClientRect().top"),+ 'the result stands above the bar, never inside it');++ // The panel hides and shows, and the browser remembers.+ await click('#feed [data-agents-toggle]');+ s = await state();+ const wide = s.feed.width;+ assert.deepEqual([s.bare, s.panel, s.toggle, s.kept], [true, false, 'Show agents', 'hidden'], 'Hide agents hides the panel and remembers it');+ await chrome.send('Page.reload');+ await chrome.waitFor('typeof data !== "undefined" && data?.project?.shouts?.length > 0 && !!document.querySelector("[data-tab=shouts]")');+ await chrome.evaluate("document.querySelector('[data-tab=shouts]').click()");+ await chrome.waitFor('document.querySelector("[data-pane=shouts]:not([hidden]) #feed .shout")');+ s = await state();+ assert.deepEqual([s.bare, s.panel, s.toggle], [true, false, 'Show agents'], 'still hidden after a reload');+ for (const width of [375, 1280]) {+ await shoutsAt(chrome, width, 'dark');+ s = await state();+ assert.ok(s.page.scroll <= s.page.width && s.page.body <= s.page.width, `${width}px hidden: no sideways scroll`);+ }+ await click('#feed [data-agents-toggle]');+ s = await state();+ assert.deepEqual([s.bare, s.panel, s.toggle, s.kept], [false, true, 'Hide agents', 'shown'], 'Show agents brings it back');+ assert.ok(s.feed.width < wide, 'and the feed gives it room');+ assert.deepEqual(chrome.exceptions, [], 'the page raises no uncaught exception');+ } finally {+ if (chrome) await closeSnapshotChrome(chrome);+ rmSync(profile, { recursive: true, force: true });+ await view.stop();+ }+});test("item detail merges API facts and moves in one responsive timeline [B33,B29]", { timeout: 120_000 }, async (t) => {const executable = chromeExecutable();if (!executable) return t.skip('Install Chrome or set PULLBOARD_CHROME for item-thread rendering checks.');