cornfield 0.34.3 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,6 +20,7 @@ import { t } from './strings.js';
20
20
  import { fileUrl } from './file-url.js';
21
21
  import { capped, toggleCapped } from './capped.js';
22
22
  import { canStartAgent, openProposalStart } from './forge-panel.js';
23
+ import { sayResult, clearResult, showResultIn, RESULT_MS } from './feedback.js';
23
24
 
24
25
  const $ = (id) => document.getElementById(id);
25
26
 
@@ -311,15 +312,20 @@ export function closeDrawer() {
311
312
  render();
312
313
  }
313
314
 
314
- /** Copies the selected node as JSON; the button says so for a moment */
315
+ let copyTimer = 0;
316
+ /** Copies the selected node as JSON; the result is said under the button and to a screen reader, and stays a few seconds */
315
317
  export async function copySpec(button) {
316
318
  if (!state.selectedNode) return;
317
319
  const text = JSON.stringify({ node: state.selectedNode }, null, 2);
320
+ clearTimeout(copyTimer);
321
+ clearResult('copy-spec');
322
+ const where = $('copy-spec-result');
318
323
  try {
319
324
  await navigator.clipboard.writeText(text);
320
- button.textContent = 'Copied ✓';
325
+ sayResult('copy-spec', `Copied the spec of ${state.selectedNode.label || state.selectedNode.id} to the clipboard.`, true);
321
326
  } catch {
322
- button.textContent = 'Copy blocked';
327
+ sayResult('copy-spec', 'The browser did not allow copying, so nothing was copied. Allow clipboard access for this page, then press Copy Spec again.', false);
323
328
  }
324
- setTimeout(() => { button.textContent = t('copySpec'); }, 1500);
329
+ showResultIn(where, 'copy-spec');
330
+ copyTimer = setTimeout(() => { clearResult('copy-spec'); showResultIn(where, 'copy-spec'); }, RESULT_MS);
325
331
  }
@@ -223,10 +223,39 @@ export function proposalPanelHtml(item) {
223
223
  /** What a listing entry's state pill says: its spec PR's state, or "Local" for a proposal that is only in a checkout or a worktree */
224
224
  export const specState = (entry) => (entry.pull ? (entry.pull.draft ? 'Draft' : 'Open') : 'Local');
225
225
 
226
- /** Where a listing entry is, as a line of meta: "PR #11", or the checkout or worktree it is in */
226
+ /** Where a listing entry is, as a line of meta: "PR #11", or the checkout or worktree it is in; a proposal that is also somewhere else says so ("PR #11, and a copy in the checkout") */
227
227
  export function specWhere(entry) {
228
- if (entry.pull) return `PR #${entry.pull.number}`;
229
- return entry.source === 'checkout' ? 'in the checkout' : `in worktree ${entry.source}`;
228
+ const place = (source) => (source === 'checkout' ? 'the checkout' : `worktree ${source}`);
229
+ const copies = Array.isArray(entry.also) ? entry.also : [];
230
+ if (entry.pull) return `PR #${entry.pull.number}${copies.length ? `, and a copy in ${copies.map(place).join(' and ')}` : ''}`;
231
+ return `in ${place(entry.source)}${copies.length ? `, and in ${copies.map(place).join(' and ')}` : ''}`;
232
+ }
233
+
234
+ /**
235
+ * One row for each proposal. A proposal that is a draft in a checkout or a worktree and also on a spec PR is listed twice by the server (the two
236
+ * are different sources); here it is one row, the PR's (the one that can be reviewed), which says there is a local copy too (`also`: the sources
237
+ * of the copies). Local copies only (a checkout and a worktree) are one row as well. An entry that could not be read is never hidden behind
238
+ * another: its row stays and says why. Spec PRs come first (open, then draft), then local drafts; within each, the listing's order.
239
+ * @template T
240
+ * @param {T[]} entries the server's listing
241
+ * @returns {T[]}
242
+ */
243
+ export function mergeSpecs(entries) {
244
+ const groups = new Map();
245
+ for (const entry of entries || []) groups.set(entry.slug, [...(groups.get(entry.slug) || []), entry]);
246
+ const out = [];
247
+ for (const group of groups.values()) {
248
+ const read = group.filter((e) => !e.error);
249
+ const prs = read.filter((e) => e.pull);
250
+ const locals = read.filter((e) => !e.pull);
251
+ const also = (list) => (list.length ? { also: list.map((e) => e.source) } : {});
252
+ if (prs.length) out.push({ ...prs[0], ...also(locals) }, ...prs.slice(1));
253
+ else if (locals.length) out.push({ ...locals[0], ...also(locals.slice(1)) });
254
+ out.push(...group.filter((e) => e.error)); // a copy that could not be read keeps its own row, with why
255
+ }
256
+ // The ones a maintainer can review come first: open spec PRs, then draft ones, then the drafts in a checkout (in the listing's order within each)
257
+ const rank = (e) => (e.pull ? (e.pull.draft ? 1 : 0) : 2);
258
+ return out.map((e, i) => [e, i]).sort((a, b) => rank(a[0]) - rank(b[0]) || a[1] - b[1]).map(([e]) => e);
230
259
  }
231
260
 
232
261
  /**
@@ -241,7 +270,7 @@ export function specRowHtml(entry, { current = null } = {}) {
241
270
  return `<li class="hx-forge-item"><div class="hx-forge-row hx-forge-spec" data-corn="row">${head}<span class="hx-forge-sum hx-error-text">${escHtml(entry.error)}</span><span class="hx-forge-meta">${escHtml(specWhere(entry))}</span></div></li>`;
242
271
  }
243
272
  const state = specState(entry);
244
- const tone = state === 'Local' ? '' : ` data-corn-state="${state === 'Draft' ? 'draft' : 'open'}"`;
273
+ const tone = ` data-corn-state="${state === 'Open' ? 'open' : 'draft'}"`; // a proposal only in a checkout is a draft too, as a branch with no pull request is
245
274
  const c = entry.counts || {};
246
275
  const meta = [
247
276
  entry.spec ? `<span>spec ${escHtml(entry.spec)}</span>` : '',
@@ -252,7 +281,7 @@ export function specRowHtml(entry, { current = null } = {}) {
252
281
  c.scenarios ? `<span>${c.scenarios} ${c.scenarios === 1 ? 'scenario' : 'scenarios'}</span>` : '',
253
282
  entry.errors ? `<span class="hx-warn">${entry.errors} ${entry.errors === 1 ? 'problem' : 'problems'}</span>` : '',
254
283
  ].filter(Boolean).join('');
255
- const mine = !!current && current.slug === entry.slug && current.source === entry.source;
284
+ const mine = !!current && current.slug === entry.slug && (current.source === entry.source || (Array.isArray(entry.also) && entry.also.includes(current.source)));
256
285
  return `<li class="hx-forge-item"><button type="button" class="hx-forge-row hx-forge-spec" data-action="open-proposal" data-slug="${escHtml(entry.slug)}" data-source="${escHtml(entry.source)}" aria-pressed="${mine}" data-corn="row">`
257
286
  + `<span class="hx-forge-line">${head}<span class="hx-forge-state hx-forge-state--${state === 'Draft' ? 'draft' : state === 'Open' ? 'open' : 'neutral'}" data-corn="state-pill"${tone}>${state}</span></span>`
258
287
  + `${entry.summary ? `<span class="hx-forge-sum">${escHtml(entry.summary)}</span>` : ''}<span class="hx-forge-meta hx-forge-facts">${meta}</span></button></li>`;
@@ -35,6 +35,7 @@ import { reviewWords } from './review-model.js';
35
35
  import { collapseSheet, visibleMapRect, isPhone } from './sheets.js';
36
36
  import { announce } from './keyboard.js';
37
37
  import { t } from './strings.js';
38
+ import { isOffline } from './connection.js';
38
39
 
39
40
  const $ = (id) => document.getElementById(id);
40
41
 
@@ -76,10 +77,12 @@ export function onProposalListing(fn) {
76
77
  /** Asks the server for the proposals it can serve */
77
78
  export async function loadProposalList() {
78
79
  try {
79
- const res = await fetch('/proposals', { cache: 'no-store' });
80
- if (!res.ok) throw new Error(`GET /proposals answered ${res.status}`);
81
- const body = await res.json();
82
- if (!Array.isArray(body)) throw new Error('GET /proposals did not answer with a list');
80
+ let res;
81
+ try { res = await fetch('/proposals', { cache: 'no-store' }); } catch { throw new Error(isOffline() ? 'You are offline.' : 'cornfield could not be reached. Check that it is still running.'); }
82
+ if (!res.ok) throw new Error(`The server could not list them (error ${res.status}).`);
83
+ let body;
84
+ try { body = await res.json(); } catch { throw new Error('cornfield sent a list this page could not read.'); }
85
+ if (!Array.isArray(body)) throw new Error('cornfield sent something that is not a list of proposals.');
83
86
  listing = body;
84
87
  listingProblem = null;
85
88
  const said = res.headers.get('X-Proposals-Forge-Error');
@@ -87,7 +90,7 @@ export async function loadProposalList() {
87
90
  } catch (err) {
88
91
  listing = null;
89
92
  forgeProblem = null;
90
- listingProblem = err.message || String(err);
93
+ listingProblem = err.message || 'cornfield did not answer.'; // always a plain sentence made above, never a parser's or a runtime's own words
91
94
  }
92
95
  listingAt = Date.now();
93
96
  renderMenu();
@@ -104,23 +107,27 @@ export async function openProposal(slug, source = null) {
104
107
  const token = ++openToken;
105
108
  setMessage(`Opening ${slug} …`);
106
109
  try {
107
- const res = await fetch(`/proposals/${encodeURIComponent(slug)}.json${source ? `?source=${encodeURIComponent(source)}` : ''}`, { cache: 'no-store' });
110
+ let res;
111
+ try { res = await fetch(`/proposals/${encodeURIComponent(slug)}.json${source ? `?source=${encodeURIComponent(source)}` : ''}`, { cache: 'no-store' }); } catch { throw new Error(isOffline() ? `${slug} could not be opened: you are offline.` : `${slug} could not be opened: cornfield could not be reached.`); }
108
112
  if (!res.ok) {
109
113
  let why = '';
110
114
  try { why = (await res.json()).error || ''; } catch { /* no body */ }
111
- const err = new Error(res.status === 404 ? notFoundWords(slug, source) : why || `The server answered ${res.status}.`);
115
+ const err = new Error(res.status === 404 ? notFoundWords(slug, source) : `${slug} could not be opened: ${why || `the server had a problem (error ${res.status}).`}`);
112
116
  err.notFound = res.status === 404;
113
117
  throw err;
114
118
  }
115
119
  const found = res.headers.get('X-Proposal-Source');
116
- showProposal(await res.json(), { slug, source: source || (found ? decodeURIComponent(found) : null), pinSource: !!source, view: 'diff', fit: true });
120
+ let item;
121
+ try { item = await res.json(); } catch { throw new Error(`${slug} could not be opened: cornfield sent a file this page could not read.`); }
122
+ showProposal(item, { slug, source: source || (found ? decodeURIComponent(found) : null), pinSource: !!source, view: 'diff', fit: true });
117
123
  // said once, here: a proposal opens on a person's asking, never on a background refresh
118
124
  announce(openedWords($('proposal-title').textContent, summarize(state.proposal), state.proposalView));
119
125
  return true;
120
126
  } catch (err) {
121
127
  console.error('Opening the proposal failed', err);
122
128
  // Said plainly, with the ways on: the Specs list, and the same name under another source when the list has one
123
- setMessage(err.message || String(err), true, err.notFound ? [specsWay()] : []);
129
+ // (a failure that is not "no such proposal" can be asked for again, or let go of: Retry and Close)
130
+ setMessage(err.message || `${slug} could not be opened.`, true, err.notFound ? [specsWay()] : [{ label: 'Retry', way: 'retry', slug, source }, { label: 'Close', way: 'close' }]);
124
131
  if (err.notFound && token === openToken) {
125
132
  await loadProposalList();
126
133
  const sources = new Set((Array.isArray(listing) ? listing : []).map((e) => e && e.source));
@@ -621,7 +628,7 @@ const ACTIONS = {
621
628
  'toggle-proposal-mode': () => toggleMode(),
622
629
  'toggle-proposal-more': () => (moreOpen() ? closeMore() : openMore()),
623
630
  'toggle-proposal-changes': () => toggleChanges(),
624
- 'proposal-way': (el) => (el.dataset.way === 'open' ? openProposal(el.dataset.slug, el.dataset.source || null) : openSpecs()),
631
+ 'proposal-way': (el) => (el.dataset.way === 'open' ? openProposal(el.dataset.slug, el.dataset.source || null) : el.dataset.way === 'retry' ? retryOpen(el.dataset.slug, el.dataset.source || null) : el.dataset.way === 'close' ? closeAfterFailure() : openSpecs()),
625
632
  'proposal-focus': (el) => focusChange(el.dataset.kind, el.dataset.key),
626
633
  };
627
634
 
@@ -636,6 +643,22 @@ function onClick(e) {
636
643
  if (menuOpen() && wrap && !wrap.contains(e.target) && !(target && target.dataset.action === 'proposal-way')) closeMenu(); // (a bad link's Specs list opens it from outside)
637
644
  }
638
645
 
646
+ /** Retry, after a proposal failed to open: the bar is drawn anew either way, so the focus goes somewhere stated, the proposal's name once it opened or the new Retry if it failed again */
647
+ async function retryOpen(slug, source) {
648
+ const opened = await openProposal(slug, source);
649
+ const to = opened ? $('proposal-title') : document.querySelector('#proposal-ways [data-way="retry"]');
650
+ if (!to) return;
651
+ if (opened) to.tabIndex = -1;
652
+ to.focus();
653
+ }
654
+
655
+ /** Close, after a proposal failed to open: the bar goes, and the focus goes to the map, never the page */
656
+ function closeAfterFailure() {
657
+ closeProposal();
658
+ const map = $('graph-canvas');
659
+ if (map) map.focus();
660
+ }
661
+
639
662
  /** A bad link's way on: the Work panel's Specs tab when there is one, else the header's Proposals menu */
640
663
  function openSpecs() {
641
664
  if (hooks.openSpecs) { hooks.openSpecs(); return; }
@@ -30,6 +30,7 @@ import { refreshMockups } from './mockups.js';
30
30
  import { getEdits, clearEdits } from './whatif.js';
31
31
  import { reviewParts, sendBackProblem, reviewBody, editsHint, isReviewable, NOT_ON_A_PR } from './review-model.js';
32
32
  import { t } from './strings.js';
33
+ import { isOffline, notSentWords } from './connection.js';
33
34
 
34
35
  const $ = (id) => document.getElementById(id);
35
36
 
@@ -40,6 +41,7 @@ const ui = {
40
41
  key: null, // `${source}/${slug}` of the proposal the review below belongs to
41
42
  reviewable: false, // whether it is on a spec PR
42
43
  review: null, // { verdict, at } | null: the last review of it
44
+ loadFailed: false, // the past reviews could not be read: the bar must not look as if there were none
43
45
  busy: false,
44
46
  noting: false, // the note field is open (Send back was pressed)
45
47
  message: '', // an inline refusal or failure
@@ -77,6 +79,7 @@ function mount() {
77
79
  <button type="button" class="hx-btn hx-btn--quiet" data-review-cancel data-corn-kind="quiet">Cancel</button>
78
80
  </div>
79
81
  </div>
82
+ <p class="hx-review-msg" data-review-loadfail role="alert" hidden data-corn="message" data-corn-state="failure"><span data-review-loadfail-text></span> <button type="button" class="hx-btn hx-btn--quiet" data-review-retry data-corn-kind="quiet">Retry</button></p>
80
83
  <p class="hx-review-msg" data-review-msg role="alert" hidden></p>
81
84
  <p class="hx-review-line" id="review-hint" data-review-hint role="status" hidden></p>
82
85
  `;
@@ -103,6 +106,10 @@ function paint() {
103
106
  if (said.textContent !== verdict) said.textContent = verdict;
104
107
  q('[data-review-when]').textContent = when ? ` ${when}` : '';
105
108
  status.hidden = !verdict;
109
+ // A failed read of the past reviews says so: an approved proposal must not look as if nobody had reviewed it
110
+ const failed = q('[data-review-loadfail]');
111
+ failed.hidden = !ui.loadFailed;
112
+ q('[data-review-loadfail-text]').textContent = ui.loadFailed ? `Could not load this proposal's reviews.${isOffline() ? ' You are offline.' : ''} It may already be approved or sent back; try again before you decide.` : '';
106
113
  // Off for good (not a spec PR's copy) is `disabled`, and the reason is the line next to it, which the buttons point at. While a review is being posted the button
107
114
  // only says it is busy (`aria-disabled`): a `disabled` button drops the focus to the page.
108
115
  for (const btn of document.querySelectorAll('#proposal-bar [data-review]')) {
@@ -159,6 +166,7 @@ function onBar(open) {
159
166
  ui.key = key;
160
167
  ui.reviewable = !!key && isReviewable(state.proposalSource);
161
168
  ui.review = null;
169
+ ui.loadFailed = false;
162
170
  ui.busy = false;
163
171
  ui.noting = false;
164
172
  ui.message = ui.hint = '';
@@ -169,20 +177,41 @@ function onBar(open) {
169
177
  }
170
178
 
171
179
  /** The latest admin review on the proposal's PR, as the server reads it from the comments (none yet is a 404) */
180
+ /** The reviews were read: the failure line goes, and Retry, if it had the focus, hands it to the proposal's name (the status line is a live region: it says the review itself, and is not a place for the focus) */
181
+ function readAgain() {
182
+ const retried = !!root && root.contains(document.activeElement) && document.activeElement.matches('[data-review-retry]');
183
+ ui.loadFailed = false;
184
+ paint();
185
+ const title = $('proposal-title');
186
+ if (!retried || !title) return;
187
+ title.tabIndex = -1;
188
+ title.focus();
189
+ }
190
+
191
+ function readOnline() {
192
+ if (ui.loadFailed && ui.key) loadReview(ui.key);
193
+ }
194
+
172
195
  async function loadReview(key) {
173
196
  try {
174
197
  const res = await fetch(reviewUrl(), { cache: 'no-store' });
175
- if (!res.ok) return;
198
+ if (key !== ui.key) return; // another proposal has opened since
199
+ if (res.status === 404) { readAgain(); return; } // none yet: the server says so with a 404
200
+ if (!res.ok) throw new Error(`The server answered ${res.status}.`);
176
201
  const found = await res.json();
177
- if (key !== ui.key || !found || typeof found.verdict !== 'string') return; // none, or another proposal has opened since
178
- ui.review = { verdict: found.verdict, at: found.at };
179
- paint();
180
- } catch { /* the server is not there: no review shown */ }
202
+ if (key !== ui.key) return;
203
+ if (found && typeof found.verdict === 'string') ui.review = { verdict: found.verdict, at: found.at };
204
+ readAgain();
205
+ } catch {
206
+ // Not "no review": the read failed, so the bar says it could not look (with Retry), and the buttons stay as they were
207
+ if (key === ui.key) { ui.loadFailed = true; paint(); }
208
+ }
181
209
  }
182
210
 
183
211
  function onClick(e) {
184
212
  if (ui.busy || !e.target.closest) return;
185
213
  if (e.target.closest('[data-review-cancel]')) { closeNote(); return; }
214
+ if (e.target.closest('[data-review-retry]')) { q('[data-review-loadfail-text]').textContent = 'Reading the reviews again …'; loadReview(ui.key); return; }
186
215
  const btn = e.target.closest('[data-review]');
187
216
  if (!btn || btn.disabled) return;
188
217
  if (btn.dataset.review === 'notes' && !ui.noting) openNote(); // the first press opens the field, the second sends
@@ -216,8 +245,18 @@ export async function sendReview(verdict) {
216
245
  const key = ui.key;
217
246
  const body = reviewBody(verdict, note, getEdits());
218
247
  let saved;
248
+ const what = verdict === 'approved' ? 'Your approval' : 'Your send back';
249
+ let res;
250
+ try {
251
+ res = await fetch(reviewUrl(), { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
252
+ } catch {
253
+ // No answer at all: offline, or the server is not there. Said so, not as a server's error; the note and the edits are kept, and it says it was not sent
254
+ ui.busy = false;
255
+ ui.message = notSentWords(what);
256
+ paint();
257
+ return false;
258
+ }
219
259
  try {
220
- const res = await fetch(reviewUrl(), { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
221
260
  let answer = null;
222
261
  try { answer = await res.json(); } catch { /* no body */ }
223
262
  if (!res.ok) throw new Error((answer && answer.error) || `The server answered ${res.status}.`);
@@ -258,6 +297,8 @@ export function initReview() {
258
297
  if (barBefore) barBefore(open);
259
298
  onBar(open);
260
299
  };
300
+ // Back online after a failed read: the reviews are read again (the same function each time, so it is added once)
301
+ if (typeof window !== 'undefined') window.addEventListener('online', readOnline);
261
302
  // "3 minutes ago" moves on without the bar being drawn again
262
303
  timer = setInterval(() => { if (ui.review) paint(); }, TICK_MS);
263
304
  onBar(!!state.proposal);
@@ -271,5 +312,5 @@ export function resetReviewForTests(clock = () => Date.now()) {
271
312
  wired = false;
272
313
  root = null;
273
314
  now = clock;
274
- Object.assign(ui, { key: null, reviewable: false, review: null, busy: false, noting: false, message: '', hint: '' });
315
+ Object.assign(ui, { key: null, reviewable: false, review: null, loadFailed: false, busy: false, noting: false, message: '', hint: '' });
275
316
  }
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  import { relativeTime } from './review-model.js';
10
+ import { RUN_STATES } from './corn-state.js';
10
11
 
11
12
  export const RUNS_URL = '/api/agent-runs';
12
13
  export const runsUrl = (follow) => (follow ? `${RUNS_URL}?follow=1` : RUNS_URL);
@@ -41,9 +42,32 @@ export function statusWords(run) {
41
42
  return words[run.status] || run.status;
42
43
  }
43
44
 
44
- /** The colour class (`hx-forge-state--<tone>`) of a run's state: done and merged are green, failed red, a run that is waiting on someone or has gone quiet amber, the rest in motion */
45
- export const RUN_TONE = Object.freeze({ done: 'success', merged: 'success', failed: 'failure', quiet: 'queued', 'stop-requested': 'queued', waiting: 'queued' });
46
- export const runTone = (run) => RUN_TONE[run.status] || 'running';
45
+ /**
46
+ * The tone of a run's state (the class `hx-forge-state--<tone>`, and the public `data-corn-state` through corn-state.js): each of the seven
47
+ * states of a run is its own, so none is told from another by colour alone. A run that went quiet waits on someone; one asked to stop is no
48
+ * longer under way; merged is done.
49
+ */
50
+ export const RUN_TONE = Object.freeze({ merged: 'done', closed: 'stopped', quiet: 'waiting', 'stop-requested': 'stopped' });
51
+ export const runTone = (run) => RUN_TONE[run.status] || (RUN_STATES.includes(run.status) ? run.status : 'working');
52
+
53
+ /** What a run is called where a person has to pick it out: what the card shows ("code on issue #5, profile claude, asked by maintainer-one"), never its id; `nowMs` adds how long ago it was asked, to tell two alike apart */
54
+ export function runName(run, nowMs) {
55
+ const when = nowMs != null && run.requestedAt ? relativeTime(run.requestedAt, nowMs) : '';
56
+ return [`${run.kind} on ${aboutWords(run.refs)}`, run.profile && `profile ${run.profile}`, run.requestedBy && `asked by ${run.requestedBy}`, when].filter(Boolean).join(', ');
57
+ }
58
+
59
+ /**
60
+ * Cost to two decimals with thousands separators ("1.45", "12,500.00"); '' when the runner reported none. The contract's `cost` is in the
61
+ * runner's own currency and names none (docs/agent-contract.md), so no currency sign is shown: the word "cost" is the unit. The API keeps the raw number.
62
+ */
63
+ export function formatCost(n) {
64
+ return typeof n === 'number' && Number.isFinite(n) ? n.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : '';
65
+ }
66
+
67
+ /** Tokens with thousands separators and the word ("47,000 tokens"); '' when none were reported */
68
+ export function formatTokens(n) {
69
+ return typeof n === 'number' && Number.isFinite(n) ? `${n.toLocaleString('en-US')} ${n === 1 ? 'token' : 'tokens'}` : '';
70
+ }
47
71
 
48
72
  /**
49
73
  * The run to show on the row of a thread (issue #104): the run whose conversation the thread is (`thread.number`, which the server fills in;
@@ -68,10 +92,10 @@ export function runOnPull(runs, number) {
68
92
  }
69
93
 
70
94
  /** A pull request's run in one line: who is running it, its state, how long ago it was asked for, and the cost the runner reported ("bucket-bot · Working · asked 12 min ago · cost 0.84") */
71
- export function pullRunWords(run, nowMs) {
95
+ export function pullRunWords(run, nowMs, { state = true } = {}) {
72
96
  const who = (run.report && run.report.by) || (run.pull && run.pull.by) || run.requestedBy;
73
97
  const when = relativeTime(run.requestedAt, nowMs);
74
- return [who, statusWords(run), when && `asked ${when}`, run.report && run.report.cost != null && `cost ${run.report.cost}`].filter(Boolean).join(' · ');
98
+ return [who, state && statusWords(run), when && `asked ${when}`, run.report && run.report.cost != null && `cost ${formatCost(run.report.cost)}`].filter(Boolean).join(' · ');
75
99
  }
76
100
 
77
101
  /** What a thread's row says of its run, in a few words: "Run: Working" (more than one run on it: "Run: Working (+1)") */
@@ -100,11 +124,11 @@ export function runMeta(run, nowMs) {
100
124
  const parts = [`asked ${relativeTime(run.requestedAt, nowMs)} by ${run.requestedBy}${run.byHand ? ' (by hand)' : ''}`];
101
125
  if (run.profile) parts.push(`profile ${run.profile}`);
102
126
  const l = run.limits || {};
103
- const limits = [l.minutes != null && `${l.minutes} min`, l.turns != null && `${l.turns} turns`, l.cost != null && `cost ${l.cost}`].filter(Boolean);
127
+ const limits = [l.minutes != null && `${l.minutes} min`, l.turns != null && `${l.turns} turns`, l.cost != null && `cost ${formatCost(l.cost)}`].filter(Boolean);
104
128
  if (limits.length) parts.push(`limits ${limits.join(', ')}`);
105
129
  const r = run.report;
106
130
  if (r) {
107
- const said = [r.tokens != null && `${r.tokens} tokens`, r.cost != null && `cost ${r.cost}`].filter(Boolean);
131
+ const said = [r.tokens != null && formatTokens(r.tokens), r.cost != null && `cost ${formatCost(r.cost)}`].filter(Boolean);
108
132
  if (said.length) parts.push(`reported ${said.join(', ')}`);
109
133
  }
110
134
  if (run.checks && run.checks !== 'none') parts.push(`checks ${run.checks === 'success' ? 'passing' : run.checks === 'failure' ? 'failing' : 'running'}`);
@@ -159,7 +183,7 @@ export function answerBody(action, text) {
159
183
  export function answerWordsFor(status, body, runId, action) {
160
184
  if (status === null) return 'cornfield did not answer; nothing was sent.';
161
185
  if (status === 401) return 'Your sign-in has ended. Sign in again to answer a run.';
162
- if (body && body.ok) return action === 'stop' ? `Asked ${runId} to stop. The runner decides what that means.` : `Answered ${runId}: ${action}. The runner picks it up and goes on.`;
186
+ if (body && body.ok) return action === 'stop' ? `Asked ${runId} to stop. The runner decides what that means.` : action === 'reply' ? `Sent your reply to ${runId}. The runner picks it up and goes on.` : `Told ${runId} to continue. The runner picks it up and goes on.`;
163
187
  return (body && body.error) || `The answer was refused (${status}).`;
164
188
  }
165
189
 
@@ -169,9 +193,9 @@ export function runsStatus(data) {
169
193
  return `${data.open} open of ${data.maxOpen} allowed, ${n} ${n === 1 ? 'run' : 'runs'}`;
170
194
  }
171
195
 
172
- /** "1200 tokens, cost 0.42", or '' when nothing was reported: the numbers as sent, never estimated; the cost to 2 decimals (the API keeps it raw) */
196
+ /** "1,200 tokens, cost 0.42", or '' when nothing was reported: the numbers as sent, never estimated; the cost to 2 decimals (the API keeps it raw) */
173
197
  function saidWords(t) {
174
- return [t.tokens != null && `${t.tokens} tokens`, typeof t.cost === 'number' && `cost ${t.cost.toFixed(2)}`].filter(Boolean).join(', ');
198
+ return [t.tokens != null && formatTokens(t.tokens), typeof t.cost === 'number' && `cost ${formatCost(t.cost)}`].filter(Boolean).join(', ');
175
199
  }
176
200
 
177
201
  /**
@@ -349,14 +373,14 @@ export function limitRows(run) {
349
373
  const l = run.limits || {};
350
374
  const r = run.report || {};
351
375
  const rows = [];
352
- const add = (name, limit, reported) => {
376
+ const add = (name, limit, reported, show = String) => {
353
377
  if (limit == null && reported == null) return;
354
- rows.push({ name, limit: limit == null ? 'no limit asked' : String(limit), reported: reported == null ? 'not reported' : String(reported) });
378
+ rows.push({ name, limit: limit == null ? 'no limit asked' : show(limit), reported: reported == null ? 'not reported' : show(reported) });
355
379
  };
356
380
  add('Minutes', l.minutes, null);
357
381
  add('Turns', l.turns, null);
358
- add('Cost', l.cost, r.cost);
359
- add('Tokens', null, r.tokens);
382
+ add('Cost', l.cost, r.cost, formatCost);
383
+ add('Tokens', null, r.tokens, (n) => n.toLocaleString('en-US'));
360
384
  return rows;
361
385
  }
362
386
 
@@ -437,14 +461,14 @@ export function changeWords(before, after) {
437
461
  const out = [];
438
462
  for (const run of after) {
439
463
  const old = was.get(run.runId);
440
- if (!old) { out.push(`New run ${run.runId}: ${run.kind} on ${aboutWords(run.refs)}, ${statusWords(run).toLowerCase()}`); continue; }
441
- if (old.status !== run.status) out.push(`Run ${run.runId} is now ${statusWords(run).toLowerCase()}`);
464
+ if (!old) { out.push(`New run: ${runName(run)}, ${statusWords(run).toLowerCase()}`); continue; }
465
+ if (old.status !== run.status) out.push(`Run ${runName(run)} is now ${statusWords(run).toLowerCase()}`);
442
466
  const was2 = new Set(old.open ? old.collidesWith || [] : []);
443
467
  const now2 = new Set(run.open ? run.collidesWith || [] : []);
444
468
  const added = [...now2].filter((id) => !was2.has(id));
445
469
  const gone = [...was2].filter((id) => !now2.has(id));
446
- if (added.length) out.push(`Run ${run.runId} now collides with ${listWords(added)}`);
447
- if (gone.length && !now2.size) out.push(`Run ${run.runId} no longer collides`);
470
+ if (added.length) out.push(`Run ${runName(run)} now collides with ${listWords(added.map((id) => { const other = after.find((r) => r.runId === id); return other ? runName(other) : 'another run'; }))}`);
471
+ if (gone.length && !now2.size) out.push(`Run ${runName(run)} no longer collides`);
448
472
  }
449
473
  return out;
450
474
  }
@@ -9,8 +9,8 @@
9
9
  */
10
10
 
11
11
  import { relativeTime } from './review-model.js';
12
- import { runTone, canRetry, aboutWords, statusWords, statusWhy, runMeta, canStop, canAnswer, groupRuns, compareTitle, limitRows, checksWords, timelineWords, nodeLabels, collisionWords, answerWords } from './runs-model.js';
13
- import { cornStateAttr } from './corn-state.js';
12
+ import { runTone, canRetry, aboutWords, runName, statusWords, statusWhy, runMeta, canStop, canAnswer, groupRuns, compareTitle, limitRows, checksWords, timelineWords, nodeLabels, collisionWords, answerWords } from './runs-model.js';
13
+ import { cornState, cornStateAttr, stateIconHtml } from './corn-state.js';
14
14
  import { t } from './strings.js';
15
15
 
16
16
 
@@ -27,6 +27,7 @@ import { t } from './strings.js';
27
27
  * @property {Set<string>} timelines the runs whose timeline is open
28
28
  * @property {boolean} busy an action is in flight
29
29
  * @property {Map<string, string>} [replies] the reply typed so far for each waiting run, so a repaint keeps it
30
+ * @property {Map<string, { text: string, ok: boolean }>} [results] what the last action on each run came to, shown in its card by the control that was used
30
31
  */
31
32
 
32
33
  /** A link that opens a new tab, said so for a screen reader */
@@ -53,8 +54,8 @@ function linksHtml(ctx, run) {
53
54
 
54
55
  /** A run id that is another run of the list is a button that takes you to it; otherwise it is plain text */
55
56
  function runLink(ctx, runId, all) {
56
- const there = (all || []).some((r) => r.runId === runId);
57
- return there ? `<button type="button" class="hx-btn hx-forge-act" data-run-goto="${ctx.esc(runId)}" aria-label="Go to run ${ctx.esc(runId)}">${ctx.esc(runId)}</button>` : ctx.esc(runId);
57
+ const there = (all || []).find((r) => r.runId === runId);
58
+ return there ? `<button type="button" class="hx-btn hx-forge-act" data-run-goto="${ctx.esc(runId)}" title="Go to this run">${ctx.esc(runName(there))}</button>` : 'an earlier run';
58
59
  }
59
60
 
60
61
  /** Which run this one starts again, and which start it again */
@@ -67,10 +68,11 @@ function retryHtml(ctx, run, all) {
67
68
  function timelineHtml(ctx, run, all) {
68
69
  const items = (run.timeline || []).map((e) => {
69
70
  const w = timelineWords(e);
70
- const goto = (e.kind === 'retry-of' || e.kind === 'retried-by') && e.ref && (all || []).some((r) => r.runId === e.ref) ? ` <button type="button" class="hx-btn hx-forge-act" data-run-goto="${ctx.esc(e.ref)}" aria-label="Go to run ${ctx.esc(e.ref)}">Go to it</button>` : '';
71
- return `<li><time datetime="${ctx.esc(e.at)}" title="${ctx.esc(e.at)}">${ctx.esc(relativeTime(e.at, ctx.now) || e.at)}</time>${ctx.esc(w.what)}${goto}${w.note ? `<span class="hx-run-note">${ctx.esc(w.note)}</span>` : ''}</li>`;
71
+ const other = (e.kind === 'retry-of' || e.kind === 'retried-by') && e.ref ? (all || []).find((r) => r.runId === e.ref) : null;
72
+ const goto = other ? ` <button type="button" class="hx-btn hx-forge-act" data-run-goto="${ctx.esc(e.ref)}" aria-label="Go to it: ${ctx.esc(runName(other))}">Go to it</button>` : '';
73
+ return `<li><time datetime="${ctx.esc(e.at)}" title="${ctx.esc(e.at)}">${ctx.esc(relativeTime(e.at, ctx.now) || e.at)}</time>${ctx.esc(w.what.replace(/run-[0-9A-Za-z]{26}/g, (id) => { const o = (all || []).find((r) => r.runId === id); return o ? runName(o) : 'an earlier run'; }))}${goto}${w.note ? `<span class="hx-run-note">${ctx.esc(w.note)}</span>` : ''}</li>`;
72
74
  });
73
- return `<ol class="hx-run-timeline" id="run-tl-${ctx.esc(run.runId)}" aria-label="Timeline of ${ctx.esc(run.runId)}, oldest first">${items.join('')}</ol>`;
75
+ return `<ol class="hx-run-timeline" id="run-tl-${ctx.esc(run.runId)}" aria-label="Timeline of ${ctx.esc(runName(run))}, oldest first">${items.join('')}</ol>`;
74
76
  }
75
77
 
76
78
  /** What was answered, escaped: the action, a reply's words, who and when */
@@ -79,16 +81,37 @@ function answeredHtml(ctx, run) {
79
81
  return `<p class="hx-forge-meta">Answered: ${ctx.esc(answerWords(a))} · ${ctx.esc(a.by || 'a maintainer')}, ${ctx.esc(relativeTime(a.at, ctx.now) || a.at)}</p>`;
80
82
  }
81
83
 
84
+
85
+ /** The run's result line: what the last action on it came to, by the control that was used; always in the card (hidden when empty) so a card kept as it is can take a new one */
86
+ function resultHtml(ctx, run) {
87
+ const r = ctx.results && ctx.results.get(run.runId);
88
+ return `<p class="hx-forge-result" data-run-result="${ctx.esc(run.runId)}" data-corn="result"${r ? ` data-corn-state="${r.ok ? 'success' : 'failure'}"` : ' hidden'}>${r ? ctx.esc(r.text) : ''}</p>`;
89
+ }
90
+
82
91
  /** A waiting run: what was asked (the note and link are shown above) and the three answers, plain buttons and a reply field */
83
92
  function answerHtml(ctx, run) {
84
93
  const id = ctx.esc(run.runId);
94
+ const name = ctx.esc(runName(run, ctx.now));
85
95
  const off = ctx.busy ? ' disabled' : '';
86
96
  const reply = ctx.replies && ctx.replies.get(run.runId) || '';
87
- return `${run.answer ? answeredHtml(ctx, run) : ''}<div class="hx-run-actions" role="group" aria-label="Answer run ${id}">
88
- <button type="button" class="hx-btn hx-forge-act" data-run-answer="continue" data-run-id="${id}" aria-label="${ctx.esc(t('continueRun'))} run ${id}"${off}>${ctx.esc(t('continueRun'))}</button>
89
- <button type="button" class="hx-btn hx-forge-act" data-run-answer="stop" data-run-id="${id}" aria-label="${ctx.esc(t('stop'))} run ${id}"${off} data-corn-kind="danger">${ctx.esc(t('stop'))}</button></div>
90
- <label class="hx-forge-field" data-corn="field">Reply to run ${id}<input type="text" class="hx-forge-input" data-run-reply="${id}" value="${ctx.esc(reply)}" maxlength="4000" autocomplete="off" /></label>
91
- <div class="hx-run-actions"><button type="button" class="hx-btn hx-forge-act" data-run-answer="reply" data-run-id="${id}" aria-label="${ctx.esc(t('reply'))} to run ${id}"${off}>${ctx.esc(t('reply'))}</button></div>`;
97
+ return `${run.answer ? answeredHtml(ctx, run) : ''}<div class="hx-run-actions" role="group" aria-label="Answer: ${name}">
98
+ <button type="button" class="hx-btn hx-forge-act" data-run-answer="continue" data-run-id="${id}" aria-label="${ctx.esc(t('continueRun'))}: ${name}"${off}>${ctx.esc(t('continueRun'))}</button>
99
+ <button type="button" class="hx-btn hx-forge-act" data-run-answer="stop" data-run-id="${id}" aria-label="${ctx.esc(t('stop'))}: ${name}"${off} data-corn-kind="danger">${ctx.esc(t('stop'))}</button></div>
100
+ <label class="hx-forge-field" data-corn="field">Reply to ${ctx.esc(`${run.kind} on ${aboutWords(run.refs)}`)}<input type="text" class="hx-forge-input" data-run-reply="${id}" value="${ctx.esc(reply)}" maxlength="4000" autocomplete="off" /></label>
101
+ <div class="hx-run-actions"><button type="button" class="hx-btn hx-forge-act" data-run-answer="reply" data-run-id="${id}" aria-label="${ctx.esc(t('reply'))}: ${name}"${off}>${ctx.esc(t('reply'))}</button></div>`;
102
+ }
103
+
104
+ /**
105
+ * A reply typed to a run that no longer waits (it went on, or was stopped, while the person typed): it was not sent, and it is not lost. The
106
+ * field stays, with what was typed, so it can be copied, and a line says the run changed; Discard lets it go. '' when nothing was typed.
107
+ */
108
+ function unsentHtml(ctx, run) {
109
+ const reply = ctx.replies && ctx.replies.get(run.runId) || '';
110
+ if (!reply) return '';
111
+ const id = ctx.esc(run.runId);
112
+ return `<p class="hx-forge-why" data-corn="message" data-corn-state="failure">This run is now ${ctx.esc(statusWords(run).toLowerCase())} and no longer waits for a reply, so what you typed was not sent. It is kept here to copy.</p>
113
+ <label class="hx-forge-field" data-corn="field">Your reply, not sent<input type="text" class="hx-forge-input" data-run-reply="${id}" value="${ctx.esc(reply)}" maxlength="4000" autocomplete="off" /></label>
114
+ <div class="hx-run-actions"><button type="button" class="hx-btn hx-forge-act" data-run-discard="${id}" aria-label="Discard: your reply to ${ctx.esc(runName(run, ctx.now))}">Discard</button></div>`;
92
115
  }
93
116
 
94
117
  /** The totals as plain lines (see `totalsLines`), escaped; '' when there are none */
@@ -96,34 +119,49 @@ export function totalsHtml(ctx, lines) {
96
119
  return lines.map((l) => `<p class="hx-forge-meta">${ctx.esc(l)}</p>`).join('');
97
120
  }
98
121
 
122
+ /** A run's state as a pill: an icon (a shape of its own), then the word. The waiting pill is the solid one (see the CSS), the others are outlines. */
123
+ export function runPillHtml(ctx, run, words, extra = '') {
124
+ return `<span class="hx-forge-state hx-forge-state--${runTone(run)}" data-corn="state-pill"${cornStateAttr(run.status)}${extra}>${stateIconHtml(cornState(run.status))}${ctx.esc(words)}</span>`;
125
+ }
126
+
127
+ /** Placeholder rows while a list loads: they hold the height the list will have, so nothing jumps when the data arrives */
128
+ export function loadingRowsHtml(n = 3) {
129
+ return Array.from({ length: n }, () => '<li class="hx-forge-skeleton" data-corn="skeleton" aria-hidden="true"><span></span><span></span></li>').join('');
130
+ }
131
+
99
132
  /** One run */
100
133
  export function runHtml(ctx, run, all) {
101
134
  const lit = ctx.selected === run.runId;
102
135
  const open = ctx.timelines.has(run.runId);
103
- const tone = runTone(run);
104
136
  const why = statusWhy(run);
137
+ const name = ctx.esc(runName(run, ctx.now));
105
138
  const note = run.report && run.report.note ? `<p class="hx-forge-meta">Runner: ${ctx.esc(run.report.note)}</p>` : '';
106
139
  const answering = canAnswer(run);
107
- const retry = canRetry(run) ? `<button type="button" class="hx-btn hx-forge-act" data-forge-retry="${ctx.esc(run.runId)}" aria-label="${ctx.esc(t('startAgain'))} on run ${ctx.esc(run.runId)}"${ctx.busy ? ' disabled' : ''}>${ctx.esc(t('startAgain'))}</button>` : '';
108
- const stop = canStop(run) && !answering ? `<button type="button" class="hx-btn hx-forge-act" data-forge-stop="${ctx.esc(run.runId)}" aria-label="${ctx.esc(t('stop'))} run ${ctx.esc(run.runId)}"${ctx.busy ? ' disabled' : ''} data-corn-kind="danger">${ctx.esc(t('stop'))}</button>` : '';
140
+ const off = ctx.busy ? ' disabled' : '';
141
+ const retry = canRetry(run) ? `<button type="button" class="hx-btn hx-forge-act" data-forge-retry="${ctx.esc(run.runId)}" aria-label="${ctx.esc(t('startAgain'))}: ${name}"${off}>${ctx.esc(t('startAgain'))}</button>` : '';
142
+ const stop = canStop(run) && !answering ? `<button type="button" class="hx-btn hx-forge-act" data-forge-stop="${ctx.esc(run.runId)}" aria-label="${ctx.esc(t('stop'))}: ${name}"${off} data-corn-kind="danger">${ctx.esc(t('stop'))}</button>` : '';
109
143
  const names = nodeLabels(run.nodes, ctx.nodes);
110
144
  const collision = collisionWords(run, all, ctx.nodes);
111
145
  const limits = limitRows(run);
112
146
  const count = (run.timeline || []).length;
113
147
  const links = linksHtml(ctx, run);
148
+ const noNodes = !(run.nodes || []).length;
149
+ const lightWords = lit ? 'Lit on the map' : 'Light on the map';
150
+ const result = resultHtml(ctx, run);
114
151
  return `<li class="hx-run hx-forge-file" data-run="${ctx.esc(run.runId)}" tabindex="-1" data-corn="run"${cornStateAttr(run.status)}>
115
- <div class="hx-run-head"><span class="hx-forge-state hx-forge-state--${tone}" data-corn="state-pill"${cornStateAttr(run.status)}>${ctx.esc(statusWords(run))}</span> <span class="hx-name">${ctx.esc(run.kind)} on ${ctx.esc(aboutWords(run.refs))}</span>${run.profile ? ` <span class="hx-faint">profile ${ctx.esc(run.profile)}</span>` : ''}</div>
152
+ <div class="hx-run-head">${runPillHtml(ctx, run, statusWords(run))} <span class="hx-name">${ctx.esc(run.kind)} on ${ctx.esc(aboutWords(run.refs))}</span>${run.profile ? ` <span class="hx-faint">profile ${ctx.esc(run.profile)}</span>` : ''}</div>
116
153
  ${collision ? `<p class="hx-run-collide"><span aria-hidden="true">⚠</span> ${ctx.esc(collision)}</p>` : ''}
117
154
  <p class="hx-forge-meta">${ctx.esc(runMeta(run, ctx.now))}</p>${why ? `<p class="hx-forge-why hx-faint">${ctx.esc(why)}</p>` : ''}${note}
118
155
  <dl class="hx-run-limits" aria-label="Limits and what the runner reported">${limits.length ? limits.map((r) => `<dt>${ctx.esc(r.name)}</dt><dd>limit: ${ctx.esc(r.limit)}; reported: ${ctx.esc(r.reported)}</dd>`).join('') : '<dt>Limits</dt><dd>none asked, nothing reported</dd>'}</dl>
119
156
  <p class="hx-forge-meta">${ctx.esc(checksWords(run))}</p>
120
- <p class="hx-forge-meta">${names.length ? `Changing ${run.nodesFrom === 'files' ? '' : 'or expected to change '}${ctx.esc(names.join(', '))}` : 'No node on the map yet.'}</p>
157
+ <p class="hx-forge-meta" id="run-nodes-${ctx.esc(run.runId)}">${names.length ? `Changing ${run.nodesFrom === 'files' ? '' : 'or expected to change '}${ctx.esc(names.join(', '))}` : 'No node on the map yet.'}</p>
121
158
  ${retryHtml(ctx, run, all)}
122
159
  ${links ? `<p class="hx-forge-meta">${links}</p>` : ''}
123
- ${answering ? answerHtml(ctx, run) : ''}${run.answer && !answering ? answeredHtml(ctx, run) : ''}
160
+ ${answering ? `${answerHtml(ctx, run)}${result}` : unsentHtml(ctx, run)}${run.answer && !answering ? answeredHtml(ctx, run) : ''}
124
161
  <div class="hx-run-actions">${stop}${retry}
125
- <button type="button" class="hx-btn hx-forge-act" data-run-select="${ctx.esc(run.runId)}" aria-pressed="${lit}" aria-label="Light the nodes of ${ctx.esc(run.runId)} on the map"${(run.nodes || []).length ? '' : ' disabled'}>${lit ? 'Lit on the map' : 'Light on the map'}</button>
162
+ <button type="button" class="hx-btn hx-forge-act" data-run-select="${ctx.esc(run.runId)}" aria-pressed="${lit}" aria-label="${lightWords}: ${name}"${noNodes ? ` disabled title="No node on the map yet, so there is nothing to light" aria-describedby="run-nodes-${ctx.esc(run.runId)}"` : ''}>${lightWords}</button>
126
163
  <button type="button" class="hx-btn hx-forge-act" data-run-timeline="${ctx.esc(run.runId)}" aria-expanded="${open}" aria-controls="run-tl-${ctx.esc(run.runId)}">Timeline (${count})</button></div>
164
+ ${answering ? '' : result}
127
165
  ${open ? timelineHtml(ctx, run, all) : ''}</li>`;
128
166
  }
129
167
 
@@ -136,7 +174,7 @@ export function runsHtml(ctx, runs) {
136
174
  return groupRuns(runs).map((g) => {
137
175
  if (g.kind === 'run') return runHtml(ctx, g.run, runs);
138
176
  const id = `cmp-${g.runs[0].runId}`;
139
- return `<li class="hx-run-group"><section class="hx-run-compare" aria-labelledby="${ctx.esc(id)}">
177
+ return `<li class="hx-run-group" data-key="${ctx.esc(id)}"><section class="hx-run-compare" aria-labelledby="${ctx.esc(id)}">
140
178
  <h4 class="hx-run-compare-title" id="${ctx.esc(id)}">${ctx.esc(compareTitle(g.runs))}</h4>
141
179
  <p class="hx-forge-meta hx-faint">The same request under each profile, side by side.</p>
142
180
  <ul class="hx-run-columns" aria-label="${ctx.esc(g.runs.length)} profiles compared">${g.runs.map((r) => runHtml(ctx, r, runs)).join('')}</ul></section></li>`;