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.
@@ -76,21 +76,23 @@ import { relativeTime } from './review-model.js';
76
76
  import { LAYER_DEFS, toggleLayer } from './layers.js';
77
77
  import { WORK_URL, groupWork, filterGroups, groupWords, workStatus, markWords } from './agents-model.js';
78
78
  import {
79
- RUNS_URL, runsUrl, stopUrl, runOnThread, threadRunWords, runOnPull, pullRunWords, canRetry, retryRefs, retryWords, limitsFromFields, defaultLimits, LIMIT_KEYS, briefUrl, runTone, answerUrl, answerBody, answerWordsFor, KINDS, aboutWords, statusWords, statusWhy, runMeta, canStop, runsStatus, runnerState, runnerWords, triggerNotice, totalsLines, handLines, startBody, startWords, stopWords, confirmStartWords, litOfRun, changeWords,
79
+ RUNS_URL, runsUrl, stopUrl, runOnThread, threadRunWords, runOnPull, pullRunWords, canRetry, retryRefs, retryWords, limitsFromFields, defaultLimits, LIMIT_KEYS, briefUrl, answerUrl, answerBody, answerWordsFor, KINDS, aboutWords, statusWords, statusWhy, runMeta, canStop, runsStatus, runnerState, runnerWords, triggerNotice, totalsLines, handLines, startBody, startWords, stopWords, confirmStartWords, litOfRun, changeWords,
80
80
  } from './runs-model.js';
81
- import { runsHtml, totalsHtml } from './runs-view.js';
81
+ import { runsHtml, totalsHtml, loadingRowsHtml, runPillHtml } from './runs-view.js';
82
82
  import { setRunsOnMap, clearRunsOnMap } from './runs-map.js';
83
83
  import {
84
84
  STATES, defaultFilters, listUrl, pullUrl, serverState, filterItems, facetsOf, stateWords, metaWords, checkWords, checksWords, litFor, errorWords,
85
85
  landingUrl, cancelLandingUrl, landingWords, mergeBlock, rerunWhy, confirmMerge, mergeBody, actionUrl, actionWords,
86
86
  specBlock, buildOffers, planUrl, confirmSpec, confirmBuild, specBody, buildBody, existingWords,
87
- listKeyOf, litForDeploy, nodesForRestarts, deployWords, deployMeta,
87
+ listKeyOf, litForDeploy, nodesForRestarts, deployWords, deployMeta, emptyWords, approvalWarning,
88
88
  DRAFTS_URL, notesUrl, sinceChoices, notesSummary, validTag, confirmWords, postedWords, draftRequest,
89
89
  threadsUrl, threadUrl, issueUrl, IDEAS_URL, threadKindWords, threadMeta, litForThread, mentionsIndex, ideaRequest, ideaWords,
90
90
  } from './forge-panel-model.js';
91
- import { cornStateAttr } from './corn-state.js';
91
+ import { cornStateAttr, stateIconHtml } from './corn-state.js';
92
+ import { sayResult, clearResult, resultOf, showResultIn, resetFeedbackForTests } from './feedback.js';
93
+ import { isOffline, initConnection, notSentWords, resetConnectionForTests } from './connection.js';
92
94
  import { proposalListing, onProposalListing, loadProposalList, hooks as proposalHooks } from './proposal.js';
93
- import { specRowHtml } from './proposal-model.js';
95
+ import { specRowHtml, mergeSpecs } from './proposal-model.js';
94
96
  import { t } from './strings.js';
95
97
 
96
98
  const $ = (id) => document.getElementById(id);
@@ -172,7 +174,8 @@ const current = () => (ui.kind === 'work' ? ui.work : ui.kind === 'specs' ? spec
172
174
  /** The proposals the Proposals menu lists (proposal.js reads them), as a list of the panel's own shape; null before the first answer */
173
175
  function specsList() {
174
176
  const { entries, problem, forgeProblem, at } = proposalListing();
175
- return entries ? { items: entries, at: at ? new Date(at).toISOString() : '', rate: '', stale: '', problem: problem || forgeProblem || '' } : null;
177
+ // One row for a proposal, however many places it is in: its spec PR and the copy in a checkout or a worktree are one (mergeSpecs)
178
+ return entries ? { items: mergeSpecs(entries), at: at ? new Date(at).toISOString() : '', rate: '', stale: '', problem: problem || forgeProblem || '' } : null;
176
179
  }
177
180
  const groupsShown = () => (ui.work ? filterGroups(ui.work.grouped.groups, ui.workFilters) : []);
178
181
  const plural = (n, word, more = `${word}s`) => `${n} ${n === 1 ? word : more}`;
@@ -184,6 +187,9 @@ const safeUrl = (u) => (typeof u === 'string' && /^https?:\/\//i.test(u) ? u : n
184
187
  // Asking the server
185
188
  // ---------------------------------------------------------------------------
186
189
 
190
+ /** A failed answer in words (the model's), said as offline when the browser is, and naming what could not be loaded */
191
+ const failWords = (res, what = '') => errorWords(res.status, res.body, { offline: isOffline(), what });
192
+
187
193
  /** One GET (or the one POST, with its JSON); `{ ok, status, body }`, with a status of null when the server did not answer */
188
194
  async function request(url, refresh, post) {
189
195
  try {
@@ -211,7 +217,7 @@ async function loadWork(refresh, token) {
211
217
  ui.work = { grouped: groupWork(b), problem: b.specsProblem || '', at: b.at, rate: b.rate || '', stale: b.stale || '' };
212
218
  announce(`${workStatus(groupsShown(), '', now())}${ui.work.stale ? '. This is an older answer' : ''}`);
213
219
  } else {
214
- ui.error = errorWords(res.status, res.body);
220
+ ui.error = failWords(res, 'the work');
215
221
  announce(ui.error);
216
222
  }
217
223
  paint();
@@ -221,7 +227,7 @@ async function loadWork(refresh, token) {
221
227
  async function loadRuns(refresh, { say = true } = {}) {
222
228
  const before = ui.runs && ui.runs.data ? ui.runs.data.runs : null;
223
229
  const res = await request(runsUrl(refresh), refresh);
224
- ui.runs = res.ok && Array.isArray(res.body.runs) ? { data: res.body, error: '' } : { data: ui.runs && ui.runs.data, error: errorWords(res.status, res.body) };
230
+ ui.runs = res.ok && Array.isArray(res.body.runs) ? { data: res.body, error: '' } : { data: ui.runs && ui.runs.data, error: failWords(res, 'the runs') };
225
231
  if (!(ui.runs && ui.runs.data)) return;
226
232
  // The map shows the open runs' nodes; a run lit on the map follows its nodes; what changed is said, once the first answer is in
227
233
  setRunsOnMap(ui.runs.data.runs);
@@ -285,7 +291,7 @@ async function loadList(refresh = false, quiet = false) {
285
291
  }
286
292
  if (!quiet) announce(`${plural(filterItems(ui.lists[key].items, ui.kind, ui.filters).length, kindWords())} shown${ui.lists[key].stale ? '. This is an older answer' : ''}`);
287
293
  } else {
288
- ui.error = errorWords(res.status, res.body);
294
+ ui.error = failWords(res, `the ${kindWords()}s`);
289
295
  if (!quiet) announce(ui.error);
290
296
  }
291
297
  paintFilters();
@@ -301,7 +307,7 @@ async function loadSpecs(token, quiet) {
301
307
  if (token !== listToken) return;
302
308
  ui.loading = false;
303
309
  const { entries, problem } = proposalListing();
304
- if (!entries) ui.error = `The proposals could not be listed: ${problem || 'no answer'}`;
310
+ if (!entries) ui.error = `Could not load the proposals. ${problem || 'cornfield did not answer.'}`;
305
311
  if (!quiet) announce(ui.error || `${plural(entries.length, 'spec')} shown`);
306
312
  paint();
307
313
  }
@@ -343,7 +349,7 @@ async function selectPull(n) {
343
349
  const res = await request(pullUrl(n), false);
344
350
  if (token !== pullToken) return;
345
351
  if (!res.ok) {
346
- ui.detailError = errorWords(res.status, res.body);
352
+ ui.detailError = failWords(res, `pull request ${n}`);
347
353
  announce(ui.detailError);
348
354
  paint();
349
355
  return;
@@ -508,7 +514,7 @@ async function selectThread(n) {
508
514
  // An answer without a thread in it is a failure too: nothing to show or light
509
515
  const thread = threadOf(res);
510
516
  if (!thread) {
511
- ui.threadError = res.ok ? `Thread ${n} could not be read: the answer had no thread in it. Refresh to ask again.` : errorWords(res.status, res.body);
517
+ ui.threadError = res.ok ? `Thread ${n} could not be read: the answer had no thread in it. Refresh to ask again.` : failWords(res, `thread ${n}`);
512
518
  announce(ui.threadError);
513
519
  paint();
514
520
  return;
@@ -753,7 +759,7 @@ async function loadNotes(refresh = false) {
753
759
  n.data = res.body;
754
760
  announce(`Release notes drafted. ${notesSummary(n.data)}${n.data.stale ? ' This is an older answer' : ''}`);
755
761
  } else {
756
- n.error = errorWords(res.status, res.body);
762
+ n.error = failWords(res, 'the release notes');
757
763
  announce(n.error);
758
764
  }
759
765
  paint();
@@ -827,7 +833,7 @@ async function postDraft() {
827
833
  $('notes-post').focus();
828
834
  return;
829
835
  }
830
- say(res.status === 401 ? 'Your sign-in has ended. Sign in again to post a draft.' : errorWords(res.status, res.body), true);
836
+ say(res.status === 401 ? 'Your sign-in has ended. Sign in again to post a draft.' : failWords(res), true);
831
837
  $('notes-tag').focus();
832
838
  }
833
839
 
@@ -933,7 +939,7 @@ function deployHtml(d) {
933
939
  const out = link ? `<a class="hx-forge-out" href="${escHtml(link)}" target="_blank" rel="noreferrer" aria-label="Open deploy ${escHtml(d.name)} on ${escHtml(forgeName())} (new tab)">↗</a>` : '';
934
940
  return `<li class="hx-forge-item"><button type="button" class="hx-forge-row" data-forge-deploy="${escHtml(d.id)}" aria-pressed="${ui.deploy === d.id}" data-corn="row">
935
941
  <span class="hx-forge-title">${escHtml(d.name)}${d.title && d.title !== d.name ? `<span class="hx-faint"> · ${escHtml(d.title)}</span>` : ''}</span>
936
- <span class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(d.state)}" data-corn="state-pill"${cornStateAttr(d.state)}>${escHtml(deployWords(d))}</span> ${escHtml(deployMeta(d, now()))}</span>
942
+ <span class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(d.state)}" data-corn="state-pill"${cornStateAttr(d.state)}>${stateIconHtml(d.state)}${escHtml(deployWords(d))}</span> ${escHtml(deployMeta(d, now()))}</span>
937
943
  <span class="hx-forge-labels"><span class="hx-forge-label">${escHtml(lightsWords(d))}</span></span></button>${out}</li>`;
938
944
  }
939
945
 
@@ -945,7 +951,7 @@ function threadHtml(t) {
945
951
  // The run that is about this thread, as a word (issue #104): the Agents tab's list, read for every tab, says it; the row only names its state
946
952
  const runs = ui.runs && ui.runs.data ? ui.runs.data.runs : null;
947
953
  const run = runOnThread(runs, t.number);
948
- const runWord = run ? `<span class="hx-forge-state hx-forge-state--${runTone(run)}" data-thread-run="${escHtml(run.runId)}" data-corn="state-pill"${cornStateAttr(run.status)}>${escHtml(threadRunWords(runs, t.number))}</span> ` : '';
954
+ const runWord = run ? `${runPillHtml({ esc: escHtml }, run, threadRunWords(runs, t.number), ` data-thread-run="${escHtml(run.runId)}"`)} ` : '';
949
955
  return `<li class="hx-forge-item"><button type="button" class="hx-forge-row" data-forge-thread="${t.number}" aria-pressed="${ui.thread === t.number}" data-corn="row">
950
956
  <span class="hx-forge-title">${escHtml(t.title)}</span>
951
957
  <span class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(t.state)}" data-corn="state-pill"${cornStateAttr(t.state)}>${escHtml(t.state === 'open' ? 'Open' : 'Closed')}</span> ${runWord}<span class="hx-forge-label">${escHtml(threadKindWords(t))}</span> ${escHtml(threadMeta(t, now()))}</span>${note ? `<span class="hx-forge-meta">${escHtml(note)}</span>` : ''}</button>${out}</li>`;
@@ -1012,7 +1018,7 @@ function deployDetailHtml() {
1012
1018
  const lit = ui.litDeploy;
1013
1019
  const url = safeUrl(d.url);
1014
1020
  const head = `${backHtml('clear-forge-deploy', 'All deploys')}<h3 class="hx-forge-detail-title">${escHtml(d.name)}</h3>
1015
- <p class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(d.state)}" data-corn="state-pill"${cornStateAttr(d.state)}>${escHtml(deployWords(d))}</span> ${escHtml(deployMeta(d, now()))}${url ? ` · <a class="hx-link" href="${escHtml(url)}" target="_blank" rel="noreferrer">Open on ${escHtml(forgeName())} ↗</a>` : ''}</p>`;
1021
+ <p class="hx-forge-meta"><span class="hx-forge-state hx-forge-state--${escHtml(d.state)}" data-corn="state-pill"${cornStateAttr(d.state)}>${stateIconHtml(d.state)}${escHtml(deployWords(d))}</span> ${escHtml(deployMeta(d, now()))}${url ? ` · <a class="hx-link" href="${escHtml(url)}" target="_blank" rel="noreferrer">Open on ${escHtml(forgeName())} ↗</a>` : ''}</p>`;
1016
1022
  const stale = ui.lists.deploys && ui.lists.deploys.stale;
1017
1023
  let body;
1018
1024
  if (!d.restarts.length) {
@@ -1073,7 +1079,7 @@ function detailHtml() {
1073
1079
  if (!shown) return '';
1074
1080
  const head = (title, meta) => `${backHtml('clear-forge-pr', ui.kind === 'work' ? 'All work' : 'All pull requests')}${meta || ''}<h3 class="hx-forge-detail-title">${title}</h3>`;
1075
1081
  if (ui.detailError) return `${head(`Pull request ${ui.selected}`)}<p class="hx-forge-notice" data-corn="notice">${escHtml(ui.detailError)}</p>`;
1076
- if (!ui.detail) return `${head(`Pull request ${ui.selected}`)}<p class="hx-faint">Loading its files and checks …</p>`;
1082
+ if (!ui.detail) return `${head(`Pull request ${ui.selected}`)}<p class="hx-faint">Loading its files and checks …</p><ul class="hx-forge-list" aria-hidden="true">${loadingRowsHtml(4)}</ul>`;
1077
1083
  const { pull, checks, stale } = ui.detail;
1078
1084
  const lit = ui.lit;
1079
1085
  const mapped = lit.files.filter((f) => f.nodes.length).length;
@@ -1093,7 +1099,7 @@ function detailHtml() {
1093
1099
  ? `<button type="button" class="hx-btn hx-forge-act" data-forge-rerun="${escHtml(c.id)}" aria-label="Re-run ${escHtml(c.name)}"${ui.busy ? ' disabled' : ''}>Re-run</button>`
1094
1100
  : '';
1095
1101
  const whyNot = why ? `<span class="hx-faint hx-forge-lights">${escHtml(why)}</span>` : '';
1096
- return `<li class="hx-forge-check"><span class="hx-forge-state hx-forge-state--${escHtml(c.state)}" data-corn="state-pill"${cornStateAttr(c.state)}>${escHtml(checkWords(c))}</span> ${name}${again}${lights}${whyNot}</li>`;
1102
+ return `<li class="hx-forge-check"><span class="hx-forge-state hx-forge-state--${escHtml(c.state)}" data-corn="state-pill"${cornStateAttr(c.state)}>${stateIconHtml(c.state)}${escHtml(checkWords(c))}</span> ${name}${again}${lights}${whyNot}</li>`;
1097
1103
  }).join('');
1098
1104
 
1099
1105
  const fileRows = lit.files.map((f) => {
@@ -1109,7 +1115,7 @@ function detailHtml() {
1109
1115
  const land = block
1110
1116
  ? `<button type="button" class="hx-btn hx-btn--approve" disabled data-corn-kind="approve">${escHtml(t('landIt'))}</button>`
1111
1117
  : `<button type="button" class="hx-btn hx-btn--approve hx-forge-act" data-forge-merge="${escHtml(String(pull.number))}"${ui.busy ? ' disabled' : ''} data-corn-kind="approve">${escHtml(t('landIt'))} …</button>`;
1112
- const act = `<div class="hx-forge-cta">${land}${url ? `<a class="hx-btn hx-forge-open" href="${escHtml(url)}" target="_blank" rel="noreferrer">Open on ${escHtml(forgeName())} ↗</a>` : ''}</div>${block ? `<p class="hx-forge-why hx-faint">${escHtml(block)}</p>` : ''}`;
1118
+ const act = `<div class="hx-forge-cta">${land}${url ? `<a class="hx-btn hx-forge-open" href="${escHtml(url)}" target="_blank" rel="noreferrer">Open on ${escHtml(forgeName())} ↗</a>` : ''}</div>${block ? `<p class="hx-forge-why hx-faint">${escHtml(block)}</p>` : ''}${approvalWarning(ui.detail) ? `<p class="hx-forge-why hx-faint" data-corn="notice" data-corn-state="waiting">${escHtml(approvalWarning(ui.detail))}</p>` : ''}`;
1113
1119
  // A spec approved with `proposals.approveLands` waits for its checks: said here, with a way to stop it
1114
1120
  const waiting = ui.landing && pull.state === 'open'
1115
1121
  ? `<div class="hx-forge-step"><p class="hx-forge-notice hx-forge-notice--ok" role="status" data-corn="notice" data-corn-state="success">${escHtml(landingWords(ui.landing, now()))}</p><button type="button" class="hx-btn hx-forge-act" data-forge-landing-cancel="${pull.number}"${ui.busy ? ' disabled' : ''}>Cancel</button></div>`
@@ -1124,13 +1130,13 @@ function detailHtml() {
1124
1130
  : '';
1125
1131
 
1126
1132
  const key = lit.changed.size || lit.failing.size
1127
- ? `<p class="hx-forge-key hx-faint"><span class="hx-mark-dot hx-mark-dot--changed" aria-hidden="true"></span>a file this pull request changes <span class="hx-mark-dot hx-mark-dot--removed" aria-hidden="true"></span>a test a failing check names</p>`
1133
+ ? `<p class="hx-forge-key hx-faint">${lit.changed.size ? '<span class="hx-mark-dot hx-mark-dot--changed" aria-hidden="true"></span>a file this pull request changes ' : ''}${lit.failing.size ? '<span class="hx-mark-dot hx-mark-dot--removed" aria-hidden="true"></span>a test a failing check names' : ''}</p>`
1128
1134
  : '';
1129
1135
  // Its run: who is running it, their state, the time and the cost (the runs are read for the Runs tab, and once for the first PR selected)
1130
1136
  const runs = ui.runs && ui.runs.data ? ui.runs.data.runs : null;
1131
1137
  const made = runOnPull(runs, pull.number);
1132
1138
  const runSection = made
1133
- ? `<h4 class="hx-forge-sub">Run</h4><p class="hx-forge-runline"${cornStateAttr(made.status)} data-corn="run">${escHtml(pullRunWords(made, now()))}</p>`
1139
+ ? `<h4 class="hx-forge-sub">Run</h4><p class="hx-forge-runline"${cornStateAttr(made.status)} data-corn="run">${runPillHtml({ esc: escHtml }, made, statusWords(made))} ${escHtml(pullRunWords(made, now(), { state: false }))}</p>`
1134
1140
  : '';
1135
1141
  const meta = `<p class="hx-forge-meta hx-forge-dmeta"><span class="hx-forge-state hx-forge-state--${escHtml(pull.draft ? 'draft' : pull.state)}" data-corn="state-pill"${cornStateAttr(pull.draft ? 'draft' : pull.state)}>${escHtml(stateWords(pull))}</span> <span>#${escHtml(String(pull.number))}</span> <span>${escHtml(pull.head.ref)} → ${escHtml(pull.base.ref)}</span> <span>${escHtml(pull.author ? pull.author.login : 'someone')}</span> <span>${escHtml(relativeTime(pull.createdAt || pull.updatedAt, now()))}</span></p>`;
1136
1142
  return `${head(escHtml(pull.title), meta)}
@@ -1174,15 +1180,30 @@ let shownKey = '';
1174
1180
  let shownKind = '';
1175
1181
  let returnTo = null; // the selector of the row that opened the selection
1176
1182
 
1183
+ const key0 = () => detailKey();
1184
+
1177
1185
  /** Everything the panel shows, from `ui` (a row or node button that had the focus has it again) */
1178
1186
  function paint() {
1179
1187
  const panel = $('forge-panel');
1180
1188
  if (!panel) return;
1181
1189
  const had = panel.contains(document.activeElement) ? document.activeElement : null;
1182
1190
  const again = had ? findAgain(had) : null;
1191
+ // A list drawn again must not move what the person is looking at: the scroll of the panel stays where it was
1192
+ const scroller = panel.querySelector('.hx-forge-body');
1193
+ const scrolled = scroller ? scroller.scrollTop : 0;
1194
+ const keyBefore = shownKey;
1183
1195
  draw(panel);
1196
+ if (scroller && scrolled && key0() === keyBefore && scroller.scrollTop !== scrolled) scroller.scrollTop = scrolled;
1184
1197
  const back = again && panel.querySelector(again);
1185
1198
  if (back && back !== document.activeElement && !back.closest('[hidden]')) back.focus();
1199
+ // Retry was pressed and its notice is gone (the list is being read again): the focus goes to the panel's title, never to the page
1200
+ if (had && had.dataset && had.dataset.action === 'retry-forge' && !panel.contains(document.activeElement)) $('forge-title').focus();
1201
+ // A control of a run card that is no longer drawn (the run went on): the focus goes to that run's card, never to the page
1202
+ const hadRun = had && !had.isConnected && had.closest('[data-run]');
1203
+ if (hadRun && !panel.contains(document.activeElement)) {
1204
+ const card = [...panel.querySelectorAll('[data-run]')].find((c) => c.dataset.run === hadRun.dataset.run);
1205
+ if (card) card.focus();
1206
+ }
1186
1207
  // A selection replaces the list: the focus goes to its back control, and returns to the row when it is let go of
1187
1208
  // (a tab changed leaves the focus on the tab)
1188
1209
  const key = detailKey();
@@ -1203,7 +1224,7 @@ function paint() {
1203
1224
  /** The tabs' counts, where there is one: the proposals, the open pull requests and issues and threads, the runs still open */
1204
1225
  function paintCounts() {
1205
1226
  const open = (key) => (ui.lists[key] ? ui.lists[key].items.length : null);
1206
- const specs = proposalListing().entries;
1227
+ const specs = specsList() && specsList().items;
1207
1228
  const runs = ui.runs && ui.runs.data ? ui.runs.data.open : null;
1208
1229
  const counts = { specs: specs ? specs.length : null, pulls: open('pulls|open'), issues: open('issues|open'), threads: ui.config && ui.config.threads === false ? null : open('threads|open'), work: runs };
1209
1230
  for (const btn of document.querySelectorAll('#forge-panel [data-forge-kind]')) {
@@ -1215,6 +1236,35 @@ function paintCounts() {
1215
1236
  }
1216
1237
  }
1217
1238
 
1239
+ /** Says (on the panel's top, for the CSS) that the tabs run on past an edge: a fade shows on that side, so Deploys is not simply missing on a phone */
1240
+ function paintTabsMore() {
1241
+ const top = document.querySelector('#forge-panel .hx-forge-top');
1242
+ const tabs = top && top.querySelector('.hx-forge-tabs');
1243
+ if (!tabs) return;
1244
+ const more = [];
1245
+ if (tabs.scrollLeft > 1) more.push('start');
1246
+ if (tabs.scrollWidth - tabs.clientWidth - tabs.scrollLeft > 1) more.push('end');
1247
+ if (more.length) top.dataset.more = more.join(' '); else delete top.dataset.more;
1248
+ // A row given the focus is scrolled clear of the fixed top, never left under it (its height changes with the theme and the width)
1249
+ const body = top.parentElement;
1250
+ if (body) body.style.scrollPaddingTop = `${top.offsetHeight}px`;
1251
+ }
1252
+
1253
+ /** A notice line: its words, and a Retry that reads the tab again (for a failure or an older answer) */
1254
+ function setNotice(el, words, retry) {
1255
+ el.hidden = !words;
1256
+ el.textContent = words;
1257
+ if (words && retry) {
1258
+ const again = document.createElement('button');
1259
+ again.type = 'button';
1260
+ again.className = 'hx-btn hx-forge-act';
1261
+ again.dataset.action = 'retry-forge';
1262
+ again.dataset.cornKind = 'quiet';
1263
+ again.textContent = 'Retry';
1264
+ el.append(' ', again);
1265
+ }
1266
+ }
1267
+
1218
1268
  function draw(panel) {
1219
1269
  for (const btn of panel.querySelectorAll('[data-forge-kind]')) btn.setAttribute('aria-pressed', String(btn.dataset.forgeKind === (ui.kind === 'notes' ? 'pulls' : ui.kind)));
1220
1270
  paintCounts();
@@ -1242,13 +1292,12 @@ function draw(panel) {
1242
1292
  if (ui.loading && !list) status.textContent = work ? `Loading the work from ${forgeName()} …` : specs ? 'Looking for proposals …' : `Loading ${kindWords()}s from ${forgeName()} …`;
1243
1293
  else if (!list) status.textContent = '';
1244
1294
  else if (work) status.textContent = workStatus(groups, list.at, now());
1245
- else if (specs) status.textContent = `${plural(list.items.length, 'open spec')}${list.at ? `, as of ${relativeTime(list.at, now())}` : ''}`;
1295
+ else if (specs) status.textContent = `${plural(list.items.length, 'proposal')}${list.at ? `, as of ${relativeTime(list.at, now())}` : ''}`;
1246
1296
  else status.textContent = `${shown.length} of ${plural(list.items.length, kindWords())}${list.at ? `, as of ${relativeTime(list.at, now())}` : ''}`;
1247
1297
 
1248
1298
  const notice = $('forge-notice');
1249
1299
  const words = ui.error || (list && list.stale ? `Showing an older answer. ${list.stale}` : '') || (specs && list && list.problem ? `The spec PRs could not be listed: ${list.problem}` : '') || (work && list && list.problem ? `Spec pull requests could not all be read: ${list.problem}` : '') || (ui.kind === 'threads' && list && list.problem ? `Some threads could not all be read: ${list.problem}` : '');
1250
- notice.hidden = !words;
1251
- notice.textContent = words;
1300
+ setNotice(notice, words, !!words);
1252
1301
 
1253
1302
  const act = $('forge-act-note');
1254
1303
  if (act) {
@@ -1260,13 +1309,16 @@ function draw(panel) {
1260
1309
  }
1261
1310
 
1262
1311
  const rows = $('forge-list');
1263
- if (!list) rows.innerHTML = '';
1312
+ const empty = (words) => `<li class="hx-forge-empty hx-faint" data-corn="empty">${escHtml(words)}</li>`;
1313
+ rows.setAttribute('aria-busy', String(!!ui.loading && !list));
1314
+ // A list that is being read holds its height with rows of the right size, so nothing jumps when the data comes
1315
+ if (!list) rows.innerHTML = ui.loading ? loadingRowsHtml(4) : '';
1264
1316
  else if (specs) {
1265
1317
  const open = state.proposal ? { slug: state.proposalSlug, source: state.proposalSource } : null;
1266
- rows.innerHTML = list.items.length ? list.items.map((e) => specRowHtml(e, { current: open })).join('') : '<li class="hx-forge-empty hx-faint">No proposals</li>';
1318
+ rows.innerHTML = list.items.length ? list.items.map((e) => specRowHtml(e, { current: open })).join('') : empty(emptyWords('specs', forgeName()));
1267
1319
  }
1268
- else if (work) rows.innerHTML = groups.length ? groupsHtml(groups) : `<li class="hx-forge-empty hx-faint">${ui.work.grouped.groups.length ? 'No work matches these filters.' : 'No work here yet.'}</li>`;
1269
- else rows.innerHTML = shown.length ? shown.map((i) => itemHtml(i)).join('') : `<li class="hx-forge-empty hx-faint">${list.items.length ? `No ${kindWords()} matches these filters.` : `No ${kindWords()}s here.`}</li>`;
1320
+ else if (work) rows.innerHTML = groups.length ? groupsHtml(groups) : empty(ui.work.grouped.groups.length ? 'No work matches these filters.' : emptyWords('work', forgeName()));
1321
+ else rows.innerHTML = shown.length ? shown.map((i) => itemHtml(i)).join('') : empty(list.items.length ? `No ${kindWords()} matches these filters.` : emptyWords(ui.kind, forgeName()));
1270
1322
 
1271
1323
  const detail = $('forge-detail');
1272
1324
  detail.hidden = !showing;
@@ -1279,6 +1331,7 @@ function draw(panel) {
1279
1331
  $('forge-rate').textContent = rate;
1280
1332
  paintRuns();
1281
1333
  paintButton();
1334
+ paintTabsMore();
1282
1335
  }
1283
1336
 
1284
1337
  /** The runs of the Agents tab: state, what each is about, links, and Stop. A runner's words are escaped like any text from the forge. */
@@ -1290,11 +1343,11 @@ function paintRuns() {
1290
1343
  const data = ui.runs && ui.runs.data;
1291
1344
  $('forge-runs-status').textContent = data ? runsStatus(data) : ui.loading ? 'Loading the runs …' : '';
1292
1345
  const note = $('forge-runs-note');
1293
- const words = (ui.runs && ui.runs.error) || (ui.runNote ? ui.runNote.text : '');
1294
- note.hidden = !words;
1295
- note.className = `hx-forge-notice${!(ui.runs && ui.runs.error) && ui.runNote && ui.runNote.ok ? ' hx-forge-notice--ok' : ''}`;
1296
- if (!(ui.runs && ui.runs.error) && ui.runNote && ui.runNote.ok) note.dataset.cornState = 'success'; else delete note.dataset.cornState;
1297
- note.textContent = words;
1346
+ const failed = ui.runs && ui.runs.error;
1347
+ const words = failed || (ui.runNote ? ui.runNote.text : '');
1348
+ note.className = `hx-forge-notice${!failed && ui.runNote && ui.runNote.ok ? ' hx-forge-notice--ok' : ''}`;
1349
+ if (!failed && ui.runNote && ui.runNote.ok) note.dataset.cornState = 'success'; else delete note.dataset.cornState;
1350
+ setNotice(note, words, !!failed);
1298
1351
  paintRunner('forge-runs-runner', data);
1299
1352
  const trig = $('forge-runs-trigger');
1300
1353
  if (trig) {
@@ -1315,8 +1368,77 @@ function paintRuns() {
1315
1368
  hand.innerHTML = lines.map((l) => `<li>${escHtml(l)}</li>`).join('');
1316
1369
  }
1317
1370
  const list = $('forge-runs-list');
1318
- if (!data) { list.innerHTML = ''; return; }
1319
- list.innerHTML = data.runs.length ? runsHtml(viewContext(), data.runs) : '<li class="hx-forge-empty hx-faint">No agent has been asked for yet. Start one from an issue or a proposal.</li>';
1371
+ list.setAttribute('aria-busy', String(!data && !!ui.loading));
1372
+ if (!data) { list.innerHTML = ui.loading ? loadingRowsHtml(3) : ''; return; }
1373
+ patchList(list, data.runs.length ? runsHtml(viewContext(), data.runs) : '<li class="hx-forge-empty hx-faint" data-corn="empty">No agent has been asked for yet. Start one from an issue or a proposal: Issues, then Start an agent.</li>');
1374
+ }
1375
+
1376
+ /**
1377
+ * Draws a list again without disturbing what the person is doing in it. The new rows are made first and set against the old by their key
1378
+ * (a run's id, a compare group's): a row that has not changed is left alone, a row that has is replaced, and **a row that holds the focus in
1379
+ * a field, or a reply typed and not sent, is kept as it is** (its result line is the one part brought up to date), so the caret, the
1380
+ * selection, the focus and the text stay where they were. A row whose field is no longer asked for is replaced like any other.
1381
+ */
1382
+ function patchList(list, html) {
1383
+ const tpl = document.createElement('template');
1384
+ tpl.innerHTML = html;
1385
+ const fresh = [...tpl.content.children];
1386
+ const keyOf = (el) => el.dataset.key || el.dataset.run || null;
1387
+ const old = new Map([...list.children].filter((el) => keyOf(el)).map((el) => [keyOf(el), el]));
1388
+ const typing = (el) => el.contains(document.activeElement) && document.activeElement.matches('input, textarea');
1389
+ const redraw = new Set(redrawRuns); // runs the page has just acted on: their cards say what the action did, so they are drawn anew (the focus is put back by hand)
1390
+ redrawRuns.clear();
1391
+ const unsent = (el) => [...el.querySelectorAll('[data-run-reply]')].some((f) => f.value !== '');
1392
+ const target = fresh.map((f) => {
1393
+ const was = keyOf(f) && old.get(keyOf(f));
1394
+ if (!was) return f;
1395
+ if (was.outerHTML === f.outerHTML) return was;
1396
+ const field = was.querySelector('[data-run-reply]');
1397
+ const twin = field && f.querySelector(`[data-run-reply="${field.dataset.runReply}"]`);
1398
+ if (!redraw.has(keyOf(f)) && (typing(was) || unsent(was)) && twin) {
1399
+ // The field stays (the very element, never taken out of the page, so the focus, caret, selection and a phone's keyboard stay);
1400
+ // everything around it is the new card's, so a state that changed is shown (graftAround)
1401
+ const theirs = twin.getAttribute('value') || '';
1402
+ graftAround(was, field, twin);
1403
+ // The typed text is in `ui.runReplies` as well, always (every keystroke); a field that differs from it was changed by the page itself
1404
+ if (field.value !== theirs) field.value = theirs;
1405
+ return was;
1406
+ }
1407
+ return f;
1408
+ });
1409
+ target.forEach((node, i) => {
1410
+ const at = list.children[i];
1411
+ if (at === node) return;
1412
+ if (at && keyOf(at) && keyOf(at) === keyOf(node)) at.replaceWith(node); else list.insertBefore(node, at || null);
1413
+ });
1414
+ while (list.children.length > target.length) list.lastElementChild.remove();
1415
+ }
1416
+
1417
+ /**
1418
+ * Makes `root` (an old row) what `fresh` (its new drawing) is, except that `keep` (inside `root`) stays the same element in the same place,
1419
+ * standing for `twin` (its match inside `fresh`): at each level from `keep` up to `root`, the parent takes the new parent's attributes and
1420
+ * children, with the kept branch in its place. `keep` itself is never taken out of the page.
1421
+ */
1422
+ function graftAround(root, keep, twin) {
1423
+ const sync = (to, from) => {
1424
+ for (const a of [...to.attributes]) if (!from.hasAttribute(a.name) && a.name !== 'value') to.removeAttribute(a.name);
1425
+ for (const a of [...from.attributes]) if (a.name !== 'value' && to.getAttribute(a.name) !== a.value) to.setAttribute(a.name, a.value);
1426
+ };
1427
+ sync(keep, twin);
1428
+ let w = keep;
1429
+ let f = twin;
1430
+ while (w !== root && w.parentElement && f.parentElement) {
1431
+ const wp = w.parentElement;
1432
+ const fp = f.parentElement;
1433
+ sync(wp, fp);
1434
+ const kids = [...fp.childNodes];
1435
+ const at = kids.indexOf(f);
1436
+ for (const n of [...wp.childNodes]) if (n !== w) n.remove();
1437
+ for (const n of kids.slice(0, at)) wp.insertBefore(n, w);
1438
+ for (const n of kids.slice(at + 1)) wp.append(n);
1439
+ w = wp;
1440
+ f = fp;
1441
+ }
1320
1442
  }
1321
1443
 
1322
1444
  /** The one line on whether a runner is polling (pull transport only), in the Runs view and the Start dialog; hidden where it does not apply */
@@ -1335,6 +1457,7 @@ function viewContext() {
1335
1457
  return {
1336
1458
  esc: escHtml, safeUrl, forgeName: forgeName(), forgeType: f ? f.type : 'github', repoUrl: base && f.repo ? `${base}/${f.repo}` : null,
1337
1459
  now: now(), nodes: state.nodes, selected: ui.runSel, timelines: ui.runTimelines, replies: ui.runReplies, busy: !!ui.busy,
1460
+ results: { get: (id) => resultOf(id) },
1338
1461
  };
1339
1462
  }
1340
1463
 
@@ -1378,8 +1501,7 @@ function drawNotes() {
1378
1501
  $('forge-status').textContent = n.loading && !n.data ? `Drafting the release notes from ${forgeName()} …` : n.data ? notesSummary(n.data) : '';
1379
1502
  const notice = $('forge-notice');
1380
1503
  const words = n.error || (n.data && n.data.stale ? `Showing an older answer. ${n.data.stale}` : '');
1381
- notice.hidden = !words;
1382
- notice.textContent = words;
1504
+ setNotice(notice, words, !!words);
1383
1505
  $('forge-detail').hidden = true;
1384
1506
  paintIdea();
1385
1507
  $('forge-rate').textContent = (n.data && n.data.rate) || '';
@@ -1664,7 +1786,7 @@ async function startAgain(runId) {
1664
1786
  const res = await request(briefUrl(runId), false);
1665
1787
  ui.retrying = false;
1666
1788
  if (!res.ok || typeof res.body.brief !== 'string') {
1667
- ui.runNote = { text: `The brief of ${runId} could not be read, so Start again did not open: ${errorWords(res.status, res.body)}`, ok: false };
1789
+ ui.runNote = { text: `The brief of ${runId} could not be read, so Start again did not open: ${failWords(res)}`, ok: false };
1668
1790
  paint();
1669
1791
  announce(ui.runNote.text);
1670
1792
  return;
@@ -1788,29 +1910,59 @@ function onAgentClick(e) {
1788
1910
  if (t.closest && t.closest('[data-action="agent-start-cancel"]') && ui.agent && !ui.agent.posting) closeAgent();
1789
1911
  }
1790
1912
 
1791
- /** Asks a run to stop: one POST, then the runs are read again */
1913
+ /** The runs whose card is drawn anew at the next paint, whatever holds the focus in it (the page itself changed what it says) */
1914
+ const redrawRuns = new Set();
1915
+
1916
+ /** Gives the focus to the first of `selectors` that is there and not disabled, inside the card of a run (else the card itself) */
1917
+ function focusInRun(runId, selectors) {
1918
+ const panel = $('forge-panel');
1919
+ const card = panel && [...panel.querySelectorAll('[data-run]')].find((c) => c.dataset.run === runId);
1920
+ if (!card) return;
1921
+ const to = selectors.map((sel) => card.querySelector(sel)).find((el) => el && !el.disabled) || card;
1922
+ if (to !== document.activeElement) to.focus();
1923
+ if (to.matches('input') && typeof to.setSelectionRange === 'function') to.setSelectionRange(to.value.length, to.value.length); // typing goes on at the end of what is there
1924
+ }
1925
+
1926
+ /** Back online: a tab that could not be read is read again, so its error does not outlive the cause (the same function each time, added once) */
1927
+ function readOnline() {
1928
+ if (ui.open && (ui.error || (ui.runs && ui.runs.error) || ui.detailError || (ui.kind === 'notes' && ui.notes.error))) refreshForge({ quiet: true });
1929
+ }
1930
+
1931
+ /** Lets go of a reply that was not sent because its run stopped waiting: the field goes, and the focus goes to the run's card */
1932
+ function discardReply(runId) {
1933
+ ui.runReplies.delete(runId);
1934
+ redrawRuns.add(runId);
1935
+ paint();
1936
+ focusInRun(runId, []);
1937
+ }
1938
+
1939
+ /** Asks a run to stop: one POST, then the runs are read again. What it came to is said in the run's own card, and to a screen reader */
1792
1940
  async function stopRun(runId) {
1793
1941
  if (ui.busy) return;
1794
1942
  ui.busy = 'stop';
1795
1943
  ui.runNote = null;
1796
- announce(`Asking ${runId} to stop`);
1944
+ clearResult(runId);
1945
+ announce('Asking this run to stop'); // the focus is in the run's card, whose controls name it
1797
1946
  paint();
1798
1947
  const res = await post(stopUrl(runId), {});
1799
1948
  ui.busy = '';
1800
- ui.runNote = { text: stopWords(res.status, res.body, runId), ok: res.ok };
1801
- announce(ui.runNote.text);
1949
+ sayResult(runId, res.status === null ? notSentWords('The stop request') : stopWords(res.status, res.body, 'this run'), res.ok);
1802
1950
  await loadRuns(false, { say: false });
1951
+ redrawRuns.add(runId);
1803
1952
  paint();
1953
+ // The Stop button is gone once the stop is asked for: the focus goes to the run's row, never to the page
1954
+ focusInRun(runId, [`[data-forge-stop="${runId}"]`]);
1804
1955
  }
1805
1956
 
1806
1957
  /** Answers a waiting run: Continue, Stop, or a reply with the text typed. One POST, then the runs are read again */
1807
1958
  async function answerRun(runId, action) {
1808
1959
  if (ui.busy) return;
1809
1960
  const text = ui.runReplies.get(runId) || '';
1961
+ clearResult(runId);
1810
1962
  if (action === 'reply' && text.trim() === '') {
1811
- ui.runNote = { text: 'Write a reply first.', ok: false };
1812
- announce(ui.runNote.text);
1963
+ sayResult(runId, 'Write a reply first.', false);
1813
1964
  paint();
1965
+ focusInRun(runId, [`[data-run-reply="${runId}"]`]);
1814
1966
  return;
1815
1967
  }
1816
1968
  // Where the focus goes back to once it is sent: the reply field after a reply (empty, for the next one), the button after Continue; while the
@@ -1818,18 +1970,17 @@ async function answerRun(runId, action) {
1818
1970
  const back = action === 'reply' ? `[data-run-reply="${runId}"]` : `[data-run-answer="${action}"][data-run-id="${runId}"]`;
1819
1971
  ui.busy = 'answer';
1820
1972
  ui.runNote = null;
1821
- announce(`Answering ${runId}`);
1973
+ announce(action === 'reply' ? 'Sending your reply' : 'Sending your answer');
1822
1974
  paint();
1823
1975
  const res = await post(answerUrl(runId), answerBody(action, text));
1824
1976
  ui.busy = '';
1825
- if (res.ok && action === 'reply') ui.runReplies.delete(runId);
1826
- ui.runNote = { text: answerWordsFor(res.status, res.body, runId, action), ok: res.ok };
1827
- announce(ui.runNote.text);
1977
+ if (res.ok && action === 'reply') ui.runReplies.delete(runId); // sent: the field is empty for the next; a reply that was not sent stays as it was typed
1978
+ const words = res.status === null ? notSentWords(action === 'reply' ? 'Your reply' : 'The answer') : answerWordsFor(res.status, res.body, 'this run', action);
1979
+ sayResult(runId, words, res.ok);
1828
1980
  await loadRuns(false, { say: false });
1981
+ redrawRuns.add(runId);
1829
1982
  paint();
1830
- const panel = $('forge-panel');
1831
- const to = panel && [back, `[data-run-timeline="${runId}"]`].map((sel) => panel.querySelector(sel)).find((el) => el && !el.disabled);
1832
- if (to && to !== document.activeElement) to.focus();
1983
+ focusInRun(runId, [back, `[data-run-timeline="${runId}"]`]);
1833
1984
  }
1834
1985
 
1835
1986
  // ---------------------------------------------------------------------------
@@ -1942,7 +2093,7 @@ async function issueNotListed(n) {
1942
2093
  announce(ui.actNote.text);
1943
2094
  return false;
1944
2095
  }
1945
- return linkMissing(res.status === 404 ? `There is no issue ${n}.` : errorWords(res.status, res.body));
2096
+ return linkMissing(res.status === 404 ? `There is no issue ${n}.` : failWords(res, `issue ${n}`));
1946
2097
  }
1947
2098
 
1948
2099
  /** Whether the Start dialog can open now: the server runs agents and the page has the dialog (the node panel's "Start a run" asks) */
@@ -2070,6 +2221,8 @@ function onClick(e) {
2070
2221
  if (goto) { goToRun(goto.dataset.runGoto); return; }
2071
2222
  const answer = t.closest('[data-run-answer]');
2072
2223
  if (answer) { answerRun(answer.dataset.runId, answer.dataset.runAnswer); return; }
2224
+ const discard = t.closest('[data-run-discard]');
2225
+ if (discard) { discardReply(discard.dataset.runDiscard); return; }
2073
2226
  const pick = t.closest('[data-run-select]');
2074
2227
  if (pick) { selectRun(pick.dataset.runSelect); return; }
2075
2228
  const timeline = t.closest('[data-run-timeline]');
@@ -2087,7 +2240,7 @@ function onClick(e) {
2087
2240
  const action = t.closest('[data-action]');
2088
2241
  if (!action) return;
2089
2242
  if (action.dataset.action === 'close-forge') closeForge();
2090
- else if (action.dataset.action === 'refresh-forge') refreshForge();
2243
+ else if (action.dataset.action === 'refresh-forge' || action.dataset.action === 'retry-forge') refreshForge();
2091
2244
  else if (action.dataset.action === 'copy-notes') copyNotes();
2092
2245
  else if (action.dataset.action === 'post-notes') { if (ui.notes.confirm) closeNotesConfirm(); else openNotesConfirm(); }
2093
2246
  else if (action.dataset.action === 'confirm-notes') postDraft();
@@ -2154,7 +2307,14 @@ function onChange(e) {
2154
2307
  }
2155
2308
 
2156
2309
  function onInput(e) {
2157
- if (e.target.dataset && e.target.dataset.runReply) { ui.runReplies.set(e.target.dataset.runReply, e.target.value); return; }
2310
+ if (e.target.dataset && e.target.dataset.runReply) {
2311
+ const id = e.target.dataset.runReply;
2312
+ ui.runReplies.set(id, e.target.value);
2313
+ // "Write a reply first" goes once something is written: a refusal does not outlive what it was about
2314
+ const said = resultOf(id);
2315
+ if (said && !said.ok && e.target.value.trim()) { clearResult(id); showResultIn(e.target.closest('[data-run]') && e.target.closest('[data-run]').querySelector(`[data-run-result="${id}"]`), id); }
2316
+ return;
2317
+ }
2158
2318
  if (e.target.id !== 'forge-text') return;
2159
2319
  ui.filters.text = e.target.value;
2160
2320
  filtersChanged(false);
@@ -2223,6 +2383,11 @@ export function initForgePanel(config, opts = {}) {
2223
2383
  }
2224
2384
  if (!wired) {
2225
2385
  wired = true;
2386
+ initConnection();
2387
+ if (typeof window !== 'undefined') window.addEventListener('online', readOnline);
2388
+ const tabs = panel.querySelector('.hx-forge-tabs');
2389
+ if (tabs) tabs.addEventListener('scroll', paintTabsMore, { passive: true });
2390
+ if (typeof window !== 'undefined') window.addEventListener('resize', paintTabsMore);
2226
2391
  wireToggles();
2227
2392
  panel.addEventListener('click', onClick);
2228
2393
  panel.addEventListener('change', onChange);
@@ -2291,4 +2456,6 @@ export function resetForgePanelForTests(clock = () => Date.now()) {
2291
2456
  pageAway = false;
2292
2457
  clearRunsOnMap();
2293
2458
  Object.assign(ui, { runSel: null, runTimelines: new Set(), runReplies: new Map(), thread: null, threadDetail: null, threadError: '', litThread: null, idea: freshIdea(), config: null, open: false, kind: 'specs', filtersOpen: false, filters: defaultFilters(), lists: {}, work: null, workFilters: { agentsOnly: false, finished: false }, loading: false, error: '', selected: null, selectedOn: '', detail: null, landing: null, detailError: '', lit: null, deploy: null, deployItem: null, litDeploy: null, nodesSeen: null, busy: '', note: null, confirm: null, actNote: null, notes: freshNotes(), runs: null, runnerSaid: null, runNote: null, agent: null, retrying: false });
2459
+ resetFeedbackForTests();
2460
+ resetConnectionForTests();
2294
2461
  }
@@ -235,8 +235,10 @@
235
235
  </section>
236
236
 
237
237
  <!-- The Work panel (forge-panel.js): Specs, PRs, Issues, Threads, Runs and Deploys, in the order of the loop. A slide-over from the left on desktop, a bottom sheet on a phone; hidden and inert until the config names a forge. `forge-panel` on the inner box is the old name of the hook, kept for one release (docs/theming.md) -->
238
+ <p id="offline-banner" class="hx-offline" data-corn="notice" hidden></p>
238
239
  <aside id="forge-panel" class="hx-forge glass" aria-label="Work" inert hidden data-corn="work-panel">
239
240
  <div class="hx-forge-body" data-corn="forge-panel">
241
+ <div class="hx-forge-top" data-corn="work-top">
240
242
  <div class="hx-forge-head">
241
243
  <h2 id="forge-title" class="hx-drawer-title" tabindex="-1">Work</h2>
242
244
  <button type="button" class="hx-btn hx-btn--quiet" data-action="refresh-forge" title="Ask the forge again" data-corn-kind="quiet">Refresh</button>
@@ -250,6 +252,7 @@
250
252
  <button type="button" class="hx-forge-tab" data-forge-kind="work" aria-pressed="false" title="Agent runs, and the work grouped by issue and proposal with agent-made work marked" data-corn="tab"><span data-corn-string="tabRuns">Runs</span><span class="hx-forge-count" hidden></span></button>
251
253
  <button type="button" class="hx-forge-tab" data-forge-kind="deploys" aria-pressed="false" data-corn="tab"><span data-corn-string="tabDeploys">Deploys</span><span class="hx-forge-count" hidden></span></button>
252
254
  </div>
255
+ </div>
253
256
  <div id="forge-bar" class="hx-forge-bar">
254
257
  <p id="forge-status" class="hx-forge-status hx-faint"></p>
255
258
  <button type="button" id="forge-filter-chip" class="hx-forge-chip" data-action="toggle-filters" aria-expanded="false" aria-controls="forge-filter-box" hidden>Filter<span class="hx-forge-count" hidden></span></button>
@@ -350,6 +353,7 @@
350
353
  <a id="drawer-open-btn" class="hx-open" href="#" target="_blank" rel="noreferrer" hidden>Open route ↗</a>
351
354
  <button type="button" id="drawer-run-btn" class="hx-btn hx-foot-btn" data-action="start-run" data-corn-string="startRun" hidden>Start a run</button>
352
355
  <button type="button" class="hx-btn hx-btn--quiet hx-foot-btn" data-action="copy-spec" data-corn-string="copySpec">Copy Spec</button>
356
+ <p id="copy-spec-result" class="hx-forge-result" data-corn="result" hidden></p>
353
357
  </div>
354
358
  </aside>
355
359
  </div>