cornfield 0.30.0 → 0.32.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.
@@ -1,7 +1,13 @@
1
1
  /**
2
2
  * @module explorer/forge-panel
3
3
  *
4
- * The issues and PRs panel (CF-07, spec 0001 section 4): the repo's pull requests and issues, from whichever forge
4
+ * The Work panel (CF-07, CF-42, spec 0001 section 4; it began as the issues and PRs panel): Specs, PRs, Issues, Threads, Runs and Deploys, in
5
+ * the order of the loop. Specs lists the proposals the header's Proposals menu lists (proposal.js `proposalListing`), a row opens one. A selection
6
+ * (a PR, a thread, a deploy) REPLACES the list, with a back control named by the list; the State, Label and Author selects sit behind one Filter
7
+ * chip; Release notes is an action at the foot of the PRs list; `openForge({ tab })` opens it on a tab, and any `data-action="toggle-forge"` toggles it.
8
+ * The text below describes each view as it was built.
9
+ *
10
+ * The repo's pull requests and issues, from whichever forge
5
11
  * the config names, read through the server (`/api/forge/…`, server/forge-routes.js; the signed-in maintainer's own
6
12
  * token never leaves it). A header button opens it: a slide-over from the left from 768px, a bottom sheet on a phone
7
13
  * (sheets.js). With no forge in the config, or no sign-in (Stage 1: there is nobody to ask the forge as, and the
@@ -69,7 +75,7 @@ import { relativeTime } from './review-model.js';
69
75
  import { LAYER_DEFS, toggleLayer } from './layers.js';
70
76
  import { WORK_URL, groupWork, filterGroups, groupWords, workStatus, markWords } from './agents-model.js';
71
77
  import {
72
- RUNS_URL, runsUrl, stopUrl, runOnThread, threadRunWords, 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,
78
+ 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,
73
79
  } from './runs-model.js';
74
80
  import { runsHtml, totalsHtml } from './runs-view.js';
75
81
  import { setRunsOnMap, clearRunsOnMap } from './runs-map.js';
@@ -82,6 +88,8 @@ import {
82
88
  threadsUrl, threadUrl, issueUrl, IDEAS_URL, threadKindWords, threadMeta, litForThread, mentionsIndex, ideaRequest, ideaWords,
83
89
  } from './forge-panel-model.js';
84
90
  import { cornStateAttr } from './corn-state.js';
91
+ import { proposalListing, onProposalListing, loadProposalList } from './proposal.js';
92
+ import { specRowHtml } from './proposal-model.js';
85
93
  import { t } from './strings.js';
86
94
 
87
95
  const $ = (id) => document.getElementById(id);
@@ -92,7 +100,8 @@ const SEARCH_ANNOUNCE_MS = 500;
92
100
  const ui = {
93
101
  config: null,
94
102
  open: false,
95
- kind: 'pulls',
103
+ kind: 'specs', // the tab: specs | pulls | issues | threads | work (Runs) | deploys; 'notes' is the Release notes view, reached from the PRs list
104
+ filtersOpen: false, // the Filter chip's box
96
105
  filters: defaultFilters(),
97
106
  lists: {}, // `${kind}|${server state}` -> { items, at, rate, stale }
98
107
  work: null, // { grouped, problem, at, rate, stale } of the Agents tab
@@ -100,6 +109,7 @@ const ui = {
100
109
  loading: false,
101
110
  error: '',
102
111
  selected: null, // the pull request's number
112
+ selectedOn: '', // the tab it was selected on ('pulls' or 'work')
103
113
  detail: null, // { pull, files, checks, at, rate, stale } of the selected one
104
114
  landing: null, // what waits to land on its approval for the selected pull request ({ slug, by, since }), or null
105
115
  detailError: '',
@@ -152,14 +162,20 @@ let pullToken = 0;
152
162
  let notesToken = 0;
153
163
  let searchTimer = null;
154
164
  let offScene = null;
165
+ let offListing = null;
155
166
  let now = () => Date.now();
156
167
 
157
168
  const forgeName = () => FORGE_NAMES[ui.config && ui.config.forge && ui.config.forge.type] || 'the forge';
158
169
  const listKey = () => listKeyOf(ui.kind, ui.filters.state);
159
- const current = () => (ui.kind === 'work' ? ui.work : ui.lists[listKey()]) || null;
170
+ const current = () => (ui.kind === 'work' ? ui.work : ui.kind === 'specs' ? specsList() : ui.lists[listKey()]) || null;
171
+ /** The proposals the Proposals menu lists (proposal.js reads them), as a list of the panel's own shape; null before the first answer */
172
+ function specsList() {
173
+ const { entries, problem, forgeProblem, at } = proposalListing();
174
+ return entries ? { items: entries, at: at ? new Date(at).toISOString() : '', rate: '', stale: '', problem: problem || forgeProblem || '' } : null;
175
+ }
160
176
  const groupsShown = () => (ui.work ? filterGroups(ui.work.grouped.groups, ui.workFilters) : []);
161
177
  const plural = (n, word, more = `${word}s`) => `${n} ${n === 1 ? word : more}`;
162
- const kindWords = () => ({ pulls: 'pull request', issues: 'issue', threads: 'thread', deploys: 'deploy' })[ui.kind] || 'piece of work';
178
+ const kindWords = () => ({ specs: 'spec', pulls: 'pull request', issues: 'issue', threads: 'thread', deploys: 'deploy' })[ui.kind] || 'piece of work';
163
179
  /** A link only if it is the forge's web address: a forge's JSON is data, not trusted markup */
164
180
  const safeUrl = (u) => (typeof u === 'string' && /^https?:\/\//i.test(u) ? u : null);
165
181
 
@@ -251,6 +267,7 @@ function onPageShow() { pageAway = false; syncRunsPoll(); }
251
267
  async function loadList(refresh = false, quiet = false) {
252
268
  const token = ++listToken;
253
269
  if (ui.kind === 'work') return loadWork(refresh, token);
270
+ if (ui.kind === 'specs') return loadSpecs(token, quiet);
254
271
  const key = listKey();
255
272
  ui.loading = true;
256
273
  ui.error = '';
@@ -274,6 +291,36 @@ async function loadList(refresh = false, quiet = false) {
274
291
  paint();
275
292
  }
276
293
 
294
+ /** Loads the Specs tab: the proposals the server finds (the list the header's Proposals menu shows, proposal.js); always asked again, worktrees come and go */
295
+ async function loadSpecs(token, quiet) {
296
+ ui.loading = true;
297
+ ui.error = '';
298
+ paint();
299
+ await loadProposalList();
300
+ if (token !== listToken) return;
301
+ ui.loading = false;
302
+ const { entries, problem } = proposalListing();
303
+ if (!entries) ui.error = `The proposals could not be listed: ${problem || 'no answer'}`;
304
+ if (!quiet) announce(ui.error || `${plural(entries.length, 'spec')} shown`);
305
+ paint();
306
+ }
307
+
308
+ /** The counts on the tabs, read quietly the first time the panel opens: the open pull requests and issues (the Threads and Runs counts come from what those tabs read anyway) */
309
+ function primeCounts() {
310
+ for (const kind of ['pulls', 'issues']) {
311
+ const key = listKeyOf(kind, 'open');
312
+ if (ui.lists[key] || primed.has(kind) || kind === ui.kind) continue;
313
+ primed.add(kind);
314
+ request(listUrl(kind, 'open'), false).then((res) => {
315
+ if (res.ok && !ui.lists[key]) ui.lists[key] = { items: res.body.items || [], at: res.body.at, rate: res.body.rate || '', stale: res.body.stale || '', problem: res.body.problem || '' };
316
+ if (ui.open) paint();
317
+ });
318
+ }
319
+ if (!primed.has('threads')) { primed.add('threads'); ensureThreadsList(); }
320
+ if (ui.kind !== 'specs' && !proposalListing().entries) loadProposalList();
321
+ }
322
+ const primed = new Set();
323
+
277
324
  /** Selects a pull request: asks for its files and checks, then lights what they are on the map */
278
325
  async function selectPull(n) {
279
326
  const token = ++pullToken;
@@ -282,6 +329,7 @@ async function selectPull(n) {
282
329
  ui.deployItem = null;
283
330
  ui.litDeploy = null;
284
331
  ui.selected = n;
332
+ ui.selectedOn = ui.kind; // the PRs list or the Runs tab's groups: its detail replaces that list only
285
333
  ui.detail = null;
286
334
  ui.landing = null;
287
335
  ui.detailError = '';
@@ -301,6 +349,8 @@ async function selectPull(n) {
301
349
  }
302
350
  ui.detail = { pull: res.body.pull, files: res.body.files || [], checks: res.body.checks || [], specs: res.body.specs || [], at: res.body.at, rate: res.body.rate || '', stale: res.body.stale || '' };
303
351
  relight();
352
+ // The run that made it is on the detail: the runs are read once, if the config has any
353
+ if (!ui.runs && ui.config.agents && ui.config.agents.runs) loadRuns(false, { say: false }).then(() => { if (ui.selected === n) paint(); }, () => {});
304
354
  await loadLanding(n, token);
305
355
  $('forge-panel').querySelector('.hx-forge-body').scrollTop = 0; // the pull request's files are what was asked for, not the row that was tapped
306
356
  announce(selectionWords());
@@ -611,9 +661,13 @@ async function afterIdea(res) {
611
661
  const n = res.body && res.body.number;
612
662
  let trouble = '';
613
663
  try {
664
+ // The new thread is shown where threads are: an idea opened from Specs goes on to the Threads tab
665
+ if (ui.kind !== 'threads') { ui.kind = 'threads'; ui.actNote = null; ui.filters = defaultFilters('threads'); paintFilters(); }
614
666
  ui.lists = {};
667
+ primed.clear(); // the tabs' counts are read again
615
668
  indexCache = null;
616
669
  await loadList(true, true);
670
+ if (ui.open) primeCounts();
617
671
  ensureThreadsList();
618
672
  // The new thread is selected in the list, so what it mentions lights on the map once its messages are in
619
673
  if (Number.isInteger(n)) await selectThread(n);
@@ -634,7 +688,8 @@ async function afterIdea(res) {
634
688
  function paintIdea() {
635
689
  const bar = $('forge-idea');
636
690
  if (!bar) return;
637
- bar.hidden = ui.kind !== 'threads';
691
+ // An idea is a thread: with threads off (`threads: false`) there is no New idea, on Specs either
692
+ bar.hidden = (ui.kind !== 'threads' && ui.kind !== 'specs') || !!detailKey() || !ui.config || ui.config.threads === false;
638
693
  $('idea-open').setAttribute('aria-expanded', String(ui.idea.open));
639
694
  $('idea-form').hidden = !ui.idea.open;
640
695
  $('idea-send').textContent = ui.idea.busy ? 'Opening …' : 'Open the idea';
@@ -817,13 +872,40 @@ function paintNotes() {
817
872
 
818
873
  const option = (value, label, on) => `<option value="${escHtml(value)}"${on ? ' selected' : ''}>${escHtml(label)}</option>`;
819
874
 
875
+ /** Whether the Filter chip applies to the view: the proposals and the release notes have nothing to filter */
876
+ const filterable = () => ui.kind !== 'specs' && ui.kind !== 'notes';
877
+
878
+ /** How many filters are on: a state other than the default, a label, an author, a search; on Runs, its two checkboxes */
879
+ function activeFilters() {
880
+ if (ui.kind === 'work') return Number(ui.workFilters.agentsOnly) + Number(ui.workFilters.finished);
881
+ if (!filterable()) return 0;
882
+ const f = ui.filters;
883
+ return Number(f.state !== defaultFilters(ui.kind).state) + Number(!!f.label) + Number(!!f.author) + Number(!!f.text);
884
+ }
885
+
886
+ /** The Filter chip, its count, and the box behind it */
887
+ function paintChip() {
888
+ const chip = $('forge-filter-chip');
889
+ const box = $('forge-filter-box');
890
+ const on = filterable() && !detailKey();
891
+ const n = activeFilters();
892
+ chip.hidden = !on;
893
+ chip.setAttribute('aria-expanded', String(on && ui.filtersOpen));
894
+ chip.setAttribute('aria-label', n ? `Filter, ${plural(n, 'filter')} on` : 'Filter');
895
+ const count = chip.querySelector('.hx-forge-count');
896
+ count.hidden = !n;
897
+ count.textContent = String(n);
898
+ chip.classList.toggle('is-on', n > 0);
899
+ box.hidden = !(on && ui.filtersOpen);
900
+ }
901
+
820
902
  /** The filters' choices: the states of the kind, the labels and authors of what is loaded */
821
903
  function paintFilters() {
822
- $('forge-filters').hidden = ui.kind === 'work' || ui.kind === 'notes';
904
+ $('forge-filters').hidden = ui.kind === 'work' || !filterable();
823
905
  $('forge-work-filters').hidden = ui.kind !== 'work';
824
906
  $('forge-work-agents').checked = ui.workFilters.agentsOnly;
825
907
  $('forge-work-finished').checked = ui.workFilters.finished;
826
- if (ui.kind === 'work' || ui.kind === 'notes') return;
908
+ if (ui.kind === 'work' || !filterable()) return;
827
909
  const items = current() && ui.kind !== 'deploys' ? current().items : [];
828
910
  const { labels, authors } = facetsOf(items);
829
911
  if (ui.filters.label && !labels.includes(ui.filters.label)) ui.filters.label = '';
@@ -912,13 +994,23 @@ function groupsHtml(groups) {
912
994
  }).join('');
913
995
  }
914
996
 
915
- /** The selected pull request: its checks, its files and the nodes they are */
997
+ /** Which selection replaces the list now, as a key ('pr:12', 'thread:3', 'deploy:9004'), or '' while the list shows. A selection stays lit on the map but shows only on the tab it belongs to. */
998
+ function detailKey() {
999
+ if (ui.kind === 'threads' && ui.thread !== null) return `thread:${ui.thread}`;
1000
+ if (ui.kind === 'deploys' && ui.deployItem) return `deploy:${ui.deploy}`;
1001
+ if (ui.selected !== null && ui.kind === ui.selectedOn) return `pr:${ui.selected}`;
1002
+ return '';
1003
+ }
1004
+
1005
+ /** The back control of a detail: an arrow and the name of the list it returns to ("All pull requests") */
1006
+ const backHtml = (action, words) => `<button type="button" class="hx-forge-back" data-action="${action}"><svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><path d="M10 3L5 8l5 5"/></svg><span class="hx-forge-back-text">${escHtml(words)}</span></button>`;
1007
+
916
1008
  /** The selected deploy: what it was, and the nodes it restarted (each a button that selects it on the map) */
917
1009
  function deployDetailHtml() {
918
1010
  const d = ui.deployItem;
919
1011
  const lit = ui.litDeploy;
920
1012
  const url = safeUrl(d.url);
921
- const head = `<div class="hx-forge-detail-head"><h3 class="hx-forge-detail-title">${escHtml(d.name)}</h3><button type="button" class="hx-btn hx-btn--quiet" data-action="clear-forge-deploy" data-corn-kind="quiet">Clear</button></div>
1013
+ const head = `${backHtml('clear-forge-deploy', 'All deploys')}<h3 class="hx-forge-detail-title">${escHtml(d.name)}</h3>
922
1014
  <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>`;
923
1015
  const stale = ui.lists.deploys && ui.lists.deploys.stale;
924
1016
  let body;
@@ -938,7 +1030,7 @@ const nodeButton = (n) => `<button type="button" class="hx-forge-node" data-forg
938
1030
 
939
1031
  /** The selected thread: read-only, its messages as written, a way to reply on the forge, and the nodes its text lights */
940
1032
  function threadDetailHtml() {
941
- const head = (title) => `<div class="hx-forge-detail-head"><h3 class="hx-forge-detail-title">${title}</h3><button type="button" class="hx-btn hx-btn--quiet" data-action="clear-forge-thread" data-corn-kind="quiet">Clear</button></div>`;
1033
+ const head = (title) => `${backHtml('clear-forge-thread', 'All threads')}<h3 class="hx-forge-detail-title">${title}</h3>`;
942
1034
  if (ui.threadError) return `${head(`Thread ${ui.thread}`)}<p class="hx-forge-notice" data-corn="notice">${escHtml(ui.threadError)}</p>`;
943
1035
  if (!ui.threadDetail) return `${head(`Thread ${ui.thread}`)}<p class="hx-faint">Loading its messages …</p>`;
944
1036
  const { thread: t, stale } = ui.threadDetail;
@@ -974,10 +1066,11 @@ function threadDetailHtml() {
974
1066
  }
975
1067
 
976
1068
  function detailHtml() {
977
- if (ui.thread !== null) return threadDetailHtml();
978
- if (ui.deployItem) return deployDetailHtml();
979
- if (ui.selected === null) return '';
980
- const head = (title, link) => `<div class="hx-forge-detail-head"><h3 class="hx-forge-detail-title">${title}</h3><button type="button" class="hx-btn hx-btn--quiet" data-action="clear-forge-pr" data-corn-kind="quiet">Clear</button></div>${link || ''}`;
1069
+ const shown = detailKey();
1070
+ if (shown.startsWith('thread:')) return threadDetailHtml();
1071
+ if (shown.startsWith('deploy:')) return deployDetailHtml();
1072
+ if (!shown) return '';
1073
+ 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>`;
981
1074
  if (ui.detailError) return `${head(`Pull request ${ui.selected}`)}<p class="hx-forge-notice" data-corn="notice">${escHtml(ui.detailError)}</p>`;
982
1075
  if (!ui.detail) return `${head(`Pull request ${ui.selected}`)}<p class="hx-faint">Loading its files and checks …</p>`;
983
1076
  const { pull, checks, stale } = ui.detail;
@@ -1010,10 +1103,12 @@ function detailHtml() {
1010
1103
  return `<li class="hx-forge-file"><span class="hx-forge-fstatus">${escHtml(f.status)}</span> <code class="hx-code">${escHtml(f.path)}</code>${renamed} <span class="hx-good">+${f.additions}</span> <span class="hx-forge-del">−${f.deletions}</span><span class="hx-forge-nodes">${nodes}</span></li>`;
1011
1104
  }).join('');
1012
1105
 
1106
+ // Land it is the one primary action, with Open on the forge beside it; a pull request that cannot land says why in one line
1013
1107
  const block = mergeBlock(ui.detail);
1014
- const act = block
1015
- ? `<p class="hx-forge-why hx-faint">${pull.state === 'merged' ? '' : 'Cannot be landed from here. '}${escHtml(block)}</p>`
1016
- : `<button type="button" class="hx-btn hx-btn--approve hx-forge-act" data-forge-merge="${pull.number}"${ui.busy ? ' disabled' : ''} data-corn-kind="approve">${escHtml(t('landIt'))} …</button><p class="hx-forge-why hx-faint">Opens a confirm step that shows what will land. Never forced, never deployed.</p>`;
1108
+ const land = block
1109
+ ? `<button type="button" class="hx-btn hx-btn--approve" disabled data-corn-kind="approve">${escHtml(t('landIt'))}</button>`
1110
+ : `<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>`;
1111
+ 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>` : ''}`;
1017
1112
  // A spec approved with `proposals.approveLands` waits for its checks: said here, with a way to stop it
1018
1113
  const waiting = ui.landing && pull.state === 'open'
1019
1114
  ? `<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>`
@@ -1030,23 +1125,31 @@ function detailHtml() {
1030
1125
  const key = lit.changed.size || lit.failing.size
1031
1126
  ? `<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>`
1032
1127
  : '';
1033
- return `${head(`#${pull.number} ${escHtml(pull.title)}`, `<p class="hx-forge-meta"><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> ${escHtml(pull.head.ref)} → ${escHtml(pull.base.ref)}${url ? ` · <a class="hx-link" href="${escHtml(url)}" target="_blank" rel="noreferrer">Open on ${escHtml(forgeName())} ↗</a>` : ''}</p>`)}
1128
+ // 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)
1129
+ const runs = ui.runs && ui.runs.data ? ui.runs.data.runs : null;
1130
+ const made = runOnPull(runs, pull.number);
1131
+ const runSection = made
1132
+ ? `<h4 class="hx-forge-sub">Run</h4><p class="hx-forge-runline"${cornStateAttr(made.status)} data-corn="run">${escHtml(pullRunWords(made, now()))}</p>`
1133
+ : '';
1134
+ 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>`;
1135
+ return `${head(escHtml(pull.title), meta)}
1136
+ ${act}
1034
1137
  ${stale ? `<p class="hx-forge-notice" data-corn="notice">${escHtml(`This is an older answer. ${stale}`)}</p>` : ''}
1035
- <h4 class="hx-forge-sub">Checks: ${escHtml(checksWords(checks))}</h4>
1036
- ${checks.length ? `<ul class="hx-forge-checks">${checkRows}</ul>` : ''}
1037
- ${build}
1038
- <h4 class="hx-forge-subact">${escHtml(t('landIt'))}</h4>
1039
1138
  ${note}
1040
1139
  ${waiting}
1041
- ${act}
1140
+ ${build}
1141
+ <h4 class="hx-forge-sub">Checks: ${escHtml(checksWords(checks))}</h4>
1142
+ ${checks.length ? `<ul class="hx-forge-checks">${checkRows}</ul>` : ''}
1042
1143
  <h4 class="hx-forge-sub">${escHtml(plural(lit.files.length, 'file'))} changed, ${mapped} on the map</h4>
1043
1144
  ${key}
1044
- <ul class="hx-forge-files">${fileRows}</ul>`;
1145
+ <ul class="hx-forge-files">${fileRows}</ul>
1146
+ ${runSection}`;
1045
1147
  }
1046
1148
 
1047
1149
  /** How to find an element of the panel again after it is drawn anew, or null */
1048
1150
  function findAgain(el) {
1049
1151
  if (!el || !el.dataset) return null;
1152
+ if (el.classList.contains('hx-forge-back') && el.closest('#forge-detail')) return '#forge-detail .hx-forge-back'; // the detail is drawn anew as its answer comes in
1050
1153
  if (el.dataset.forgePr) return `[data-forge-pr="${el.dataset.forgePr}"]`;
1051
1154
  if (el.dataset.forgeDeploy) return `[data-forge-deploy="${el.dataset.forgeDeploy}"]`;
1052
1155
  if (el.dataset.forgeThread) return `[data-forge-thread="${el.dataset.forgeThread}"]`;
@@ -1065,23 +1168,66 @@ function findAgain(el) {
1065
1168
  return null;
1066
1169
  }
1067
1170
 
1171
+ /** What the focus does when a selection replaces the list, and when it goes back: the key of the selection shown at the last paint, and the tab it was on */
1172
+ let shownKey = '';
1173
+ let shownKind = '';
1174
+ let returnTo = null; // the selector of the row that opened the selection
1175
+
1068
1176
  /** Everything the panel shows, from `ui` (a row or node button that had the focus has it again) */
1069
1177
  function paint() {
1070
1178
  const panel = $('forge-panel');
1071
1179
  if (!panel) return;
1072
- const again = panel.contains(document.activeElement) ? findAgain(document.activeElement) : null;
1180
+ const had = panel.contains(document.activeElement) ? document.activeElement : null;
1181
+ const again = had ? findAgain(had) : null;
1073
1182
  draw(panel);
1074
1183
  const back = again && panel.querySelector(again);
1075
- if (back && back !== document.activeElement) back.focus();
1184
+ if (back && back !== document.activeElement && !back.closest('[hidden]')) back.focus();
1185
+ // A selection replaces the list: the focus goes to its back control, and returns to the row when it is let go of
1186
+ // (a tab changed leaves the focus on the tab)
1187
+ const key = detailKey();
1188
+ if (key !== shownKey && shownKind === ui.kind) {
1189
+ if (key) {
1190
+ const target = panel.querySelector('#forge-detail .hx-forge-back');
1191
+ if (target && (had || !shownKey)) target.focus();
1192
+ } else {
1193
+ const row = returnTo && panel.querySelector(returnTo);
1194
+ if (row && !row.closest('[hidden]')) row.focus(); else $('forge-title').focus();
1195
+ returnTo = null;
1196
+ }
1197
+ }
1198
+ shownKey = key;
1199
+ shownKind = ui.kind;
1200
+ }
1201
+
1202
+ /** The tabs' counts, where there is one: the proposals, the open pull requests and issues and threads, the runs still open */
1203
+ function paintCounts() {
1204
+ const open = (key) => (ui.lists[key] ? ui.lists[key].items.length : null);
1205
+ const specs = proposalListing().entries;
1206
+ const runs = ui.runs && ui.runs.data ? ui.runs.data.open : null;
1207
+ 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 };
1208
+ for (const btn of document.querySelectorAll('#forge-panel [data-forge-kind]')) {
1209
+ const n = counts[btn.dataset.forgeKind];
1210
+ const el = btn.querySelector('.hx-forge-count');
1211
+ if (!el) continue;
1212
+ el.hidden = !n;
1213
+ el.textContent = n ? String(n) : '';
1214
+ }
1076
1215
  }
1077
1216
 
1078
1217
  function draw(panel) {
1079
- for (const btn of panel.querySelectorAll('[data-forge-kind]')) btn.setAttribute('aria-pressed', String(btn.dataset.forgeKind === ui.kind));
1218
+ for (const btn of panel.querySelectorAll('[data-forge-kind]')) btn.setAttribute('aria-pressed', String(btn.dataset.forgeKind === (ui.kind === 'notes' ? 'pulls' : ui.kind)));
1219
+ paintCounts();
1080
1220
  const notes = ui.kind === 'notes';
1081
- $('forge-filters').hidden = notes || ui.kind === 'work';
1221
+ const specs = ui.kind === 'specs';
1222
+ const showing = detailKey();
1223
+ $('forge-filters').hidden = notes || ui.kind === 'work' || specs;
1082
1224
  $('forge-work-filters').hidden = ui.kind !== 'work';
1083
- $('forge-list').hidden = notes;
1225
+ $('forge-bar').hidden = !!showing;
1226
+ paintChip();
1227
+ $('forge-list').hidden = notes || !!showing;
1084
1228
  $('forge-notes').hidden = !notes;
1229
+ $('notes-open').hidden = ui.kind !== 'pulls' || !!showing;
1230
+ $('forge-foot').hidden = notes || !!showing;
1085
1231
  if (notes) {
1086
1232
  drawNotes();
1087
1233
  return;
@@ -1090,15 +1236,16 @@ function draw(panel) {
1090
1236
  const list = current();
1091
1237
  const work = ui.kind === 'work';
1092
1238
  const groups = work ? groupsShown() : [];
1093
- const shown = list && !work ? filterItems(list.items, ui.kind, ui.filters) : [];
1239
+ const shown = list && !work && !specs ? filterItems(list.items, ui.kind, ui.filters) : [];
1094
1240
  const status = $('forge-status');
1095
- if (ui.loading && !list) status.textContent = work ? `Loading the work from ${forgeName()} …` : `Loading ${kindWords()}s from ${forgeName()} …`;
1241
+ if (ui.loading && !list) status.textContent = work ? `Loading the work from ${forgeName()} …` : specs ? 'Looking for proposals …' : `Loading ${kindWords()}s from ${forgeName()} …`;
1096
1242
  else if (!list) status.textContent = '';
1097
1243
  else if (work) status.textContent = workStatus(groups, list.at, now());
1244
+ else if (specs) status.textContent = `${plural(list.items.length, 'open spec')}${list.at ? `, as of ${relativeTime(list.at, now())}` : ''}`;
1098
1245
  else status.textContent = `${shown.length} of ${plural(list.items.length, kindWords())}${list.at ? `, as of ${relativeTime(list.at, now())}` : ''}`;
1099
1246
 
1100
1247
  const notice = $('forge-notice');
1101
- const words = ui.error || (list && list.stale ? `Showing an older answer. ${list.stale}` : '') || (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}` : '');
1248
+ 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}` : '');
1102
1249
  notice.hidden = !words;
1103
1250
  notice.textContent = words;
1104
1251
 
@@ -1113,16 +1260,21 @@ function draw(panel) {
1113
1260
 
1114
1261
  const rows = $('forge-list');
1115
1262
  if (!list) rows.innerHTML = '';
1263
+ else if (specs) {
1264
+ const open = state.proposal ? { slug: state.proposalSlug, source: state.proposalSource } : null;
1265
+ rows.innerHTML = list.items.length ? list.items.map((e) => specRowHtml(e, { current: open })).join('') : '<li class="hx-forge-empty hx-faint">No proposals</li>';
1266
+ }
1116
1267
  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>`;
1117
1268
  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>`;
1118
1269
 
1119
1270
  const detail = $('forge-detail');
1120
- detail.hidden = ui.selected === null && !ui.deployItem && ui.thread === null;
1121
- detail.setAttribute('aria-label', ui.thread !== null ? 'Selected thread' : ui.deployItem ? 'Selected deploy' : 'Selected pull request');
1271
+ detail.hidden = !showing;
1272
+ detail.setAttribute('aria-label', showing.startsWith('thread:') ? 'Selected thread' : showing.startsWith('deploy:') ? 'Selected deploy' : 'Selected pull request');
1122
1273
  detail.innerHTML = detailHtml();
1123
1274
 
1124
1275
  paintIdea();
1125
- const rate = (ui.threadDetail && ui.threadDetail.rate) || (ui.detail && ui.detail.rate) || (list && list.rate) || '';
1276
+ $('forge-foot').hidden = $('notes-open').hidden && $('forge-idea').hidden;
1277
+ const rate = (showing && ((ui.threadDetail && ui.threadDetail.rate) || (ui.detail && ui.detail.rate))) || (list && list.rate) || '';
1126
1278
  $('forge-rate').textContent = rate;
1127
1279
  paintRuns();
1128
1280
  paintButton();
@@ -1132,7 +1284,7 @@ function draw(panel) {
1132
1284
  function paintRuns() {
1133
1285
  const box = $('forge-runs');
1134
1286
  if (!box) return;
1135
- box.hidden = ui.kind !== 'work';
1287
+ box.hidden = ui.kind !== 'work' || !!detailKey();
1136
1288
  if (box.hidden) return;
1137
1289
  const data = ui.runs && ui.runs.data;
1138
1290
  $('forge-runs-status').textContent = data ? runsStatus(data) : ui.loading ? 'Loading the runs …' : '';
@@ -1234,16 +1386,18 @@ function drawNotes() {
1234
1386
  paintButton();
1235
1387
  }
1236
1388
 
1237
- /** The header button says which pull request is lit */
1389
+ /** The toggles that open the panel (`data-action="toggle-forge"`: the header's, whatever it calls it) say whether it is open, and the old button which selection is lit */
1238
1390
  function paintButton() {
1391
+ for (const toggle of document.querySelectorAll('[data-action="toggle-forge"]')) toggle.setAttribute('aria-expanded', String(ui.open));
1239
1392
  const btn = $('forge-btn');
1240
1393
  if (!btn) return;
1241
1394
  const lit = ui.selected !== null || !!ui.deployItem || ui.thread !== null || !!ui.runSel;
1242
1395
  const tag = $('forge-btn-lit');
1243
- tag.hidden = !lit;
1244
- tag.textContent = ui.runSel ? 'run' : ui.thread !== null ? `thread #${ui.thread}` : ui.deployItem ? 'deploy' : lit ? `#${ui.selected}` : '';
1245
- btn.setAttribute('aria-label', ui.runSel ? 'Issues and pull requests, a run lit on the map' : ui.thread !== null ? `Issues and pull requests, thread ${ui.thread} selected` : ui.deployItem ? 'Issues and pull requests, a deploy selected' : lit ? `Issues and pull requests, pull request ${ui.selected} selected` : 'Issues and pull requests');
1246
- btn.setAttribute('aria-expanded', String(ui.open));
1396
+ if (tag) {
1397
+ tag.hidden = !lit;
1398
+ tag.textContent = ui.runSel ? 'run' : ui.thread !== null ? `thread #${ui.thread}` : ui.deployItem ? 'deploy' : lit ? `#${ui.selected}` : '';
1399
+ }
1400
+ btn.setAttribute('aria-label', `${t('issuesAndPrs')}${ui.runSel ? ', a run lit on the map' : ui.thread !== null ? `, thread ${ui.thread} selected` : ui.deployItem ? ', a deploy selected' : lit ? `, pull request ${ui.selected} selected` : ''}`);
1247
1401
  }
1248
1402
 
1249
1403
  // ---------------------------------------------------------------------------
@@ -1695,10 +1849,21 @@ async function answerRun(runId, action) {
1695
1849
 
1696
1850
  export const isForgeOpen = () => ui.open;
1697
1851
 
1698
- /** Opens the panel with the focus on its title; the first time, loads the pull requests */
1699
- export function openForge({ load = true } = {}) {
1852
+ /** What opened the panel (a toggle in the header), so Escape and Close give the focus back to it */
1853
+ let openerEl = null;
1854
+
1855
+ /**
1856
+ * Opens the panel with the focus on its title; the first time, loads what its tab shows (the proposals, to start with).
1857
+ * `tab` opens it on that tab ('specs', 'pulls', 'issues', 'threads', 'work' for Runs, 'deploys'), whichever was shown last otherwise.
1858
+ */
1859
+ export function openForge({ load = true, tab } = {}) {
1700
1860
  const panel = $('forge-panel');
1701
1861
  if (!panel || panel.hidden) return;
1862
+ if (tab && tab !== (ui.kind === 'notes' ? 'pulls' : ui.kind) && TABS.includes(tab)) { // the Release notes are one level down on PRs
1863
+ ui.kind = tab;
1864
+ ui.filters = defaultFilters(tab);
1865
+ ui.actNote = null;
1866
+ }
1702
1867
  ui.open = true;
1703
1868
  panel.inert = false;
1704
1869
  panel.classList.add('forge-open');
@@ -1706,12 +1871,16 @@ export function openForge({ load = true } = {}) {
1706
1871
  paintButton();
1707
1872
  const title = $('forge-title');
1708
1873
  title.focus();
1709
- announce('Issues and pull requests');
1874
+ announce('Work');
1710
1875
  if (!load) return; // a deep link loads the list it wants itself (openTab)
1876
+ if (!tab) primeCounts(); // opened by a toggle, not for a tab: the other tabs' counts are read quietly
1711
1877
  if (ui.kind === 'notes') { if (!ui.notes.data && !ui.notes.loading) loadNotes(); else paint(); return; }
1712
- if (!current()) { paintFilters(); loadList(); } else paint();
1878
+ if (ui.kind === 'specs' || !current()) { paintFilters(); loadList(); } else paint();
1713
1879
  }
1714
1880
 
1881
+ /** The tabs, in the order of the loop */
1882
+ const TABS = ['specs', 'pulls', 'issues', 'threads', 'work', 'deploys'];
1883
+
1715
1884
  // ---------------------------------------------------------------------------
1716
1885
  // Deep links (explorer/deep-link.js): a run, an issue, a proposal's Start dialog
1717
1886
  // ---------------------------------------------------------------------------
@@ -1807,8 +1976,9 @@ export function closeForge({ restoreFocus = true } = {}) {
1807
1976
  panel.inert = true;
1808
1977
  collapseSheet('forge');
1809
1978
  paintButton();
1810
- if (restoreFocus && hadFocus) $('forge-btn').focus();
1811
- announce('Issues and pull requests closed');
1979
+ const back = openerEl && openerEl.isConnected ? openerEl : $('forge-btn');
1980
+ if (restoreFocus && hadFocus && back) back.focus();
1981
+ announce('Work closed');
1812
1982
  }
1813
1983
 
1814
1984
  export const toggleForge = () => (ui.open ? closeForge() : openForge());
@@ -1863,32 +2033,31 @@ function onClick(e) {
1863
2033
  const kind = t.closest('[data-forge-kind]');
1864
2034
  if (kind) {
1865
2035
  if (kind.dataset.forgeKind === ui.kind) return;
1866
- if (kind.dataset.forgeKind === 'notes') {
1867
- ui.kind = 'notes';
1868
- if (ui.notes.data || ui.notes.loading) { paint(); announce(`Release notes. ${ui.notes.data ? notesSummary(ui.notes.data) : ''}`); } else loadNotes();
1869
- return;
1870
- }
1871
2036
  ui.kind = kind.dataset.forgeKind;
1872
2037
  ui.actNote = null;
1873
2038
  ui.filters = defaultFilters(ui.kind);
1874
2039
  paintFilters();
1875
- if (current()) filtersChanged(); else { paint(); loadList(); }
2040
+ // The proposals are asked for again each time (worktrees come and go); the other lists keep what they have
2041
+ if (ui.kind === 'specs') { paint(); loadList(false, true); announce(current() ? `${plural(current().items.length, 'spec')} shown` : 'Looking for proposals'); } else if (current()) filtersChanged(); else { paint(); loadList(); }
1876
2042
  return;
1877
2043
  }
1878
2044
  const pr = t.closest('[data-forge-pr]');
1879
2045
  if (pr) {
1880
2046
  const n = Number(pr.dataset.forgePr);
2047
+ returnTo = findAgain(pr); // the row to give the focus back to when the selection is let go of
1881
2048
  if (ui.selected === n) clearPull(); else selectPull(n);
1882
2049
  return;
1883
2050
  }
1884
2051
  const thr = t.closest('[data-forge-thread]');
1885
2052
  if (thr) {
1886
2053
  const n = Number(thr.dataset.forgeThread);
2054
+ returnTo = findAgain(thr);
1887
2055
  if (ui.thread === n) clearThread(); else selectThread(n);
1888
2056
  return;
1889
2057
  }
1890
2058
  const dep = t.closest('[data-forge-deploy]');
1891
2059
  if (dep) {
2060
+ returnTo = findAgain(dep);
1892
2061
  if (ui.deploy === dep.dataset.forgeDeploy) clearDeploy(); else selectDeploy(dep.dataset.forgeDeploy);
1893
2062
  return;
1894
2063
  }
@@ -1934,9 +2103,13 @@ function onClick(e) {
1934
2103
  else if (action.dataset.action === 'post-notes') { if (ui.notes.confirm) closeNotesConfirm(); else openNotesConfirm(); }
1935
2104
  else if (action.dataset.action === 'confirm-notes') postDraft();
1936
2105
  else if (action.dataset.action === 'cancel-notes') { closeNotesConfirm(); announce('Cancelled. Nothing was posted.'); }
1937
- else if (action.dataset.action === 'clear-forge-pr') { clearPull(); $('forge-title').focus(); }
1938
- else if (action.dataset.action === 'clear-forge-deploy') { clearDeploy(); $('forge-title').focus(); }
1939
- else if (action.dataset.action === 'clear-forge-thread') { clearThread(); $('forge-title').focus(); }
2106
+ else if (action.dataset.action === 'clear-forge-pr') clearPull();
2107
+ else if (action.dataset.action === 'clear-forge-deploy') clearDeploy();
2108
+ else if (action.dataset.action === 'clear-forge-thread') clearThread();
2109
+ else if (action.dataset.action === 'toggle-filters') { ui.filtersOpen = !ui.filtersOpen; paintChip(); }
2110
+ else if (action.dataset.action === 'open-notes') openNotes();
2111
+ else if (action.dataset.action === 'close-notes') closeNotes();
2112
+ else if (action.dataset.action === 'open-proposal' && isPhone()) collapseSheet('forge'); // the proposal's own bar and the map are what is wanted now
1940
2113
  else if (action.dataset.action === 'idea-open') toggleIdea(!ui.idea.open);
1941
2114
  else if (action.dataset.action === 'idea-send') {
1942
2115
  // Nothing of it may escape as an unhandled rejection: what went wrong is said, and the form is usable again
@@ -1951,6 +2124,22 @@ function onClick(e) {
1951
2124
  else if (action.dataset.action === 'idea-cancel') { toggleIdea(false); announce('Cancelled. Nothing was opened.'); }
1952
2125
  }
1953
2126
 
2127
+ /** The Release notes view, from the PRs list: its own page with a way back */
2128
+ function openNotes() {
2129
+ ui.kind = 'notes';
2130
+ ui.actNote = null;
2131
+ if (ui.notes.data || ui.notes.loading) { paint(); announce(`Release notes. ${ui.notes.data ? notesSummary(ui.notes.data) : ''}`); } else loadNotes();
2132
+ $('notes-title').focus();
2133
+ }
2134
+
2135
+ /** Back from the Release notes to the PRs list, the focus on the button that opened them */
2136
+ function closeNotes() {
2137
+ ui.kind = 'pulls';
2138
+ paint();
2139
+ $('notes-open').focus();
2140
+ announce('All pull requests');
2141
+ }
2142
+
1954
2143
  function onChange(e) {
1955
2144
  const id = e.target.id;
1956
2145
  if (id === 'notes-since') {
@@ -2000,6 +2189,19 @@ function onKey(e) {
2000
2189
  closeForge();
2001
2190
  }
2002
2191
 
2192
+ /** Any `data-action="toggle-forge"` opens and closes the panel; one listener on the page, however many times the panel is wired */
2193
+ let onToggle = null;
2194
+ function wireToggles() {
2195
+ if (onToggle) document.removeEventListener('click', onToggle);
2196
+ onToggle = (e) => {
2197
+ const el = e.target.closest && e.target.closest('[data-action="toggle-forge"]');
2198
+ if (!el) return;
2199
+ openerEl = el;
2200
+ toggleForge();
2201
+ };
2202
+ document.addEventListener('click', onToggle);
2203
+ }
2204
+
2003
2205
  /**
2004
2206
  * Wires the panel (main.js calls this once the config is read). With no forge in the config, or nobody signed in,
2005
2207
  * the button and the panel stay hidden, and this returns false.
@@ -2008,13 +2210,15 @@ function onKey(e) {
2008
2210
  * @returns {boolean} whether the panel is on
2009
2211
  */
2010
2212
  export function initForgePanel(config, opts = {}) {
2011
- const btn = $('forge-btn');
2012
2213
  const panel = $('forge-panel');
2013
- if (!config || !config.forge || !config.signIn || !btn || !panel) return false;
2214
+ if (!config || !config.forge || !config.signIn || !panel) return false;
2014
2215
  ui.config = config;
2015
2216
  if (opts.clock) now = opts.clock;
2016
- btn.hidden = false;
2217
+ for (const toggle of document.querySelectorAll('[data-action="toggle-forge"]')) toggle.hidden = false;
2017
2218
  panel.hidden = false;
2219
+ // The Specs tab lists the proposals: the account menu's Proposals entry is only for a cornfield without the panel (no forge, or no sign-in)
2220
+ const proposalsEntry = $('proposal-wrap');
2221
+ if (proposalsEntry) proposalsEntry.hidden = true;
2018
2222
  // `threads: false` in the config turns the tab off; a server that does not say has threads
2019
2223
  const threadsOn = config.threads !== false;
2020
2224
  const tab = panel.querySelector('[data-forge-kind="threads"]');
@@ -2029,7 +2233,7 @@ export function initForgePanel(config, opts = {}) {
2029
2233
  }
2030
2234
  if (!wired) {
2031
2235
  wired = true;
2032
- btn.addEventListener('click', toggleForge);
2236
+ wireToggles();
2033
2237
  panel.addEventListener('click', onClick);
2034
2238
  panel.addEventListener('change', onChange);
2035
2239
  panel.addEventListener('input', onInput);
@@ -2051,6 +2255,8 @@ export function initForgePanel(config, opts = {}) {
2051
2255
  confirm.addEventListener('keydown', onConfirmKey);
2052
2256
  }
2053
2257
  offScene = onSceneTouch(onNodesChange);
2258
+ // The header's Proposals menu reads the same list: when it is read again the Specs tab and its count follow
2259
+ offListing = onProposalListing(() => { if (ui.open) paint(); });
2054
2260
  // A node's panel lists the threads that mention it; a click there shows one in this panel
2055
2261
  const drawer = $('spec-drawer');
2056
2262
  if (drawer) drawer.addEventListener('click', (e) => {
@@ -2067,8 +2273,17 @@ export function initForgePanel(config, opts = {}) {
2067
2273
  export function resetForgePanelForTests(clock = () => Date.now()) {
2068
2274
  if (ui.confirm) closeConfirm({ restoreFocus: false });
2069
2275
  if (ui.agent) closeAgent({ restoreFocus: false });
2276
+ if (onToggle) document.removeEventListener('click', onToggle);
2277
+ onToggle = null;
2278
+ openerEl = null;
2279
+ primed.clear();
2280
+ shownKey = '';
2281
+ shownKind = '';
2282
+ returnTo = null;
2070
2283
  if (offScene) offScene();
2071
2284
  offScene = null;
2285
+ if (offListing) offListing();
2286
+ offListing = null;
2072
2287
  clearTimeout(searchTimer);
2073
2288
  wired = false;
2074
2289
  now = clock;
@@ -2085,5 +2300,5 @@ export function resetForgePanelForTests(clock = () => Date.now()) {
2085
2300
  runsTimer = 0;
2086
2301
  pageAway = false;
2087
2302
  clearRunsOnMap();
2088
- 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: 'pulls', filters: defaultFilters(), lists: {}, work: null, workFilters: { agentsOnly: false, finished: false }, loading: false, error: '', selected: null, 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 });
2303
+ 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 });
2089
2304
  }