@giamme/forge 0.15.0 → 0.16.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/VERSION +1 -1
  3. package/docs/artifacts.md +1 -1
  4. package/docs/commands.md +14 -3
  5. package/docs/forge-ui.md +14 -0
  6. package/docs/memory.md +22 -0
  7. package/docs/reviews.md +7 -0
  8. package/forge +11 -0
  9. package/package.json +1 -1
  10. package/references/dataset.md +5 -2
  11. package/references/decompose.md +51 -5
  12. package/references/harnesses.md +4 -1
  13. package/references/solo.md +5 -1
  14. package/references/ui.md +10 -1
  15. package/scripts/forge-artifact.sh +53 -0
  16. package/scripts/forge-contract.py +55 -8
  17. package/scripts/forge-control.py +0 -2
  18. package/scripts/forge-dispatch.sh +28 -12
  19. package/scripts/forge-fail-first.py +3 -1
  20. package/scripts/forge-guard.py +247 -8
  21. package/scripts/forge-issues.py +12 -0
  22. package/scripts/forge-lib-adopt.sh +260 -0
  23. package/scripts/forge-lib-attribute.sh +10 -2
  24. package/scripts/forge-lib-plans.sh +16 -4
  25. package/scripts/forge-lib-review.sh +8 -2
  26. package/scripts/forge-lib-task.sh +19 -5
  27. package/scripts/forge-memory.sh +41 -4
  28. package/scripts/forge-metrics.sh +7 -0
  29. package/scripts/forge-parallel.sh +96 -13
  30. package/scripts/forge-route.py +16 -2
  31. package/scripts/forge-runs-rm.py +23 -7
  32. package/scripts/forge-runtime.py +25 -2
  33. package/scripts/forge-schedule.py +5 -2
  34. package/scripts/forge-shadow.py +2 -0
  35. package/scripts/forge-solo.sh +6 -0
  36. package/scripts/forge_dataset/cli.py +16 -0
  37. package/scripts/forge_dataset/export.py +1 -0
  38. package/scripts/forge_dataset/harvest.py +11 -0
  39. package/scripts/forge_dataset/history.py +126 -0
  40. package/scripts/forge_dataset/worktrees.py +95 -0
  41. package/scripts/forge_memory_list.py +153 -0
  42. package/scripts/forge_worktrees.py +88 -0
  43. package/ui/README.md +31 -0
  44. package/ui/docs/api.md +81 -4
  45. package/ui/forge_ui/__init__.py +14 -1
  46. package/ui/forge_ui/__main__.py +1 -1
  47. package/ui/forge_ui/control.py +77 -0
  48. package/ui/forge_ui/findings.py +7 -0
  49. package/ui/forge_ui/projects.py +571 -0
  50. package/ui/forge_ui/reader.py +27 -7
  51. package/ui/forge_ui/static/app.js +99 -21
  52. package/ui/forge_ui/static/cloudui.js +6 -2
  53. package/ui/forge_ui/static/convo.js +1 -1
  54. package/ui/forge_ui/static/diffview.js +2 -2
  55. package/ui/forge_ui/static/files.js +1 -1
  56. package/ui/forge_ui/static/index.html +5 -1
  57. package/ui/forge_ui/static/panel.js +28 -2
  58. package/ui/forge_ui/static/projectsview.js +372 -0
  59. package/ui/forge_ui/static/settings.js +136 -4
  60. package/ui/forge_ui/static/style.css +93 -3
  61. package/ui/forge_ui/static/uikit.js +94 -1
  62. package/ui/forge_ui/static/worktreesview.js +250 -0
  63. package/ui/forge_ui/worktrees.py +570 -0
@@ -75,6 +75,10 @@ window.ForgeApp = (() => {
75
75
  if (c) return { key: null, sel: null, cloud: { sel: c[1] === 'runs' ? decodeURIComponent(c[2]) : null, focus: c[1] === 'projects' ? decodeURIComponent(c[2]) : null, model: c[1] === 'models' ? decodeURIComponent(c[2]) : null } };
76
76
  if (/^#\/models\/?$/.test(hash)) return { key: null, sel: null, models: true };
77
77
  if (/^#\/settings\/?$/.test(hash)) return { key: null, sel: null, settings: true };
78
+ const pj = hash.match(/^#\/projects(?:\/([0-9a-f]{8})(?:\/(runs|findings|memories))?)?\/?$/);
79
+ if (pj) return { key: null, sel: null, projects: { id: pj[1] || null, tab: pj[2] || 'runs' } };
80
+ const w = hash.match(/^#\/worktrees(?:\/(repo|runs)\/([^/]+))?\/?$/);
81
+ if (w) return { key: null, sel: null, worktrees: { repo: w[1] === 'repo' ? decodeURIComponent(w[2]) : '', run: w[1] === 'runs' ? decodeURIComponent(w[2]) : '' } };
78
82
  const m = hash.match(/^#\/runs\/([^/]+)(\/.*)?$/);
79
83
  if (!m) return { key: null, sel: null };
80
84
  const d = decodeURIComponent, rest = m[2] || '';
@@ -168,7 +172,12 @@ window.ForgeApp = (() => {
168
172
  return body;
169
173
  }
170
174
  // Restore disclosures, internal scroll and keyboard focus after changed data arrives.
171
- function preserve(parent, build, { restore = true } = {}) {
175
+ // A live refresh waits for what the user is doing (#115). An export has no uikit.js and never refreshes: it just draws.
176
+ const guard = (region, draw) => { if (window.ForgeUI?.guard) window.ForgeUI.guard(region, draw); else draw(); };
177
+ const keepOpen = (region, draw) => { if (window.ForgeUI?.keepOpen) window.ForgeUI.keepOpen(region, draw); else draw(); };
178
+ const forget = region => { if (window.ForgeUI?.forget) window.ForgeUI.forget(region); };
179
+ function preserve(parent, build, options) { guard(parent, () => preserveNow(parent, build, options)); }
180
+ function preserveNow(parent, build, { restore = true } = {}) {
172
181
  const open = new Map(Array.from(parent.querySelectorAll('details[data-keep]'), n => [n.dataset.keep, n.open]));
173
182
  const scroll = new Map(Array.from(parent.querySelectorAll('[data-scroll]'), n => [n.dataset.scroll, [n.scrollLeft, n.scrollTop]]));
174
183
  const active = parent.contains(document.activeElement) ? document.activeElement : null;
@@ -214,9 +223,11 @@ window.ForgeApp = (() => {
214
223
  // The worktree is "leaf (branch)": the leaf truncates first, the branch keeps its place. The title is the full path
215
224
  // and, on a second line, the full branch, since the branch can be truncated on screen.
216
225
  // No worktree: the name span alone, as before.
217
- function appendRepo(parent, run) {
226
+ function appendRepo(parent, run, linked) {
218
227
  const label = RM.repoLabel(run);
219
- const name = el('span', label.name, 'repo');
228
+ const href = linked && !SNAP && window.ForgeProjects ? projectHref(RM.repoKey(run)) : null;
229
+ const name = el(href ? 'a' : 'span', label.name, 'repo');
230
+ if (href) { name.href = href; name.title = 'This repository\'s project: its runs, findings and memories'; name.classList.add('project-link'); }
220
231
  if (!label.worktree) { parent.append(name); return; }
221
232
  const line = el('span', undefined, 'repo-line');
222
233
  const wt = el('span', undefined, 'muted repo-wt');
@@ -275,6 +286,7 @@ window.ForgeApp = (() => {
275
286
  }
276
287
  $('run-list').append(item);
277
288
  }
289
+ markSelection(); // inside: a held draw runs later, with new nodes to mark
278
290
  });
279
291
  markSelection();
280
292
  }
@@ -380,7 +392,10 @@ window.ForgeApp = (() => {
380
392
  const wrap = el('div', undefined, 'map-cards');
381
393
  for (const layer of A.layers) {
382
394
  const g = el('section', undefined, 'map-repo');
383
- g.append(el('h3', layer.name));
395
+ const h = el('h3'), href = !SNAP && window.ForgeProjects ? projectHref(layer.repo) : null;
396
+ if (href) { const a = el('a', layer.name, 'project-link'); a.href = href; a.title = 'This repository\'s project: its runs, findings and memories'; h.append(a); }
397
+ else h.textContent = layer.name;
398
+ g.append(h);
384
399
  const grid = el('div', undefined, 'map-grid');
385
400
  for (const m of A.modules.filter(x => x.layer === layer.id)) {
386
401
  const r = m.run, card = link(undefined, r.key);
@@ -418,6 +433,10 @@ window.ForgeApp = (() => {
418
433
  el('pre', 'forge ui open <run-dir>', 'cmd'),
419
434
  el('p', 'A run dir is a plan or solo directory forge wrote. Runs register under $XDG_CONFIG_HOME/forge/runs/ (default ~/.config/forge/runs/); FORGE_RUN_REGISTRY=off turns that off.', 'muted'));
420
435
  }
436
+ function mapCount(info) {
437
+ const counter = $('map-view')?.querySelector('.map-head .map-count');
438
+ if (counter) counter.textContent = `${info.matches} of ${info.shown} shown runs match${info.hidden ? ` · ${info.hidden} older hidden` : ''}`;
439
+ }
421
440
  function renderMap({ rebuildBar = true } = {}) {
422
441
  const main = $('main');
423
442
  if (state.listLoaded && !state.runs.length && !SNAP) { renderFirstRun(); return; }
@@ -449,10 +468,10 @@ window.ForgeApp = (() => {
449
468
  info = state.stage.showAtlas(state.runs, state.mapFilter, { showAll: state.showAll });
450
469
  $('map-cards').replaceChildren();
451
470
  } else {
452
- preserve($('map-cards'), () => { const A = mapCards($('map-cards')); info = { hidden: A.hidden, matches: A.matches, shown: A.modules.length, total: A.total }; });
471
+ // The count is set with the cards, so a held draw brings its own when it runs.
472
+ preserve($('map-cards'), () => { const A = mapCards($('map-cards')); mapCount({ hidden: A.hidden, matches: A.matches, shown: A.modules.length, total: A.total }); });
453
473
  }
454
- const counter = $('map-view').querySelector('.map-head .map-count');
455
- if (info) counter.textContent = `${info.matches} of ${info.shown} shown runs match${info.hidden ? ` · ${info.hidden} older hidden` : ''}`;
474
+ if (info) mapCount(info);
456
475
  }
457
476
 
458
477
  /* ---------- the run cloud: every run in 3D, full screen ---------- */
@@ -494,12 +513,12 @@ window.ForgeApp = (() => {
494
513
  host.replaceChildren(el('h1', 'Models', 'module-title'), el('p', state.modelsError ? `Could not load the model results (${state.modelsError}).` : 'Reading every run\'s attempts and reviews…', state.modelsError ? 'warn' : 'muted'));
495
514
  return;
496
515
  }
497
- window.ForgeLeaderboard.render(host, state.modelsData, {
516
+ guard(host, () => window.ForgeLeaderboard.render(host, state.modelsData, {
498
517
  runs: state.runs, prefs: state.modelsPrefs, now: () => Date.now() / 1000,
499
518
  savePrefs: p => { state.modelsPrefs = p; store.set('models', p); },
500
519
  tablePrefs: id => state.tablePrefs[id], saveTablePrefs: (id, p) => { state.tablePrefs = { ...state.tablePrefs, [id]: p }; store.set('tables', state.tablePrefs); },
501
520
  modelHref: alias => '#/cloud/models/' + encodeURIComponent(alias), reviewerOutcomes: state.reviewerOutcomes,
502
- });
521
+ }));
503
522
  }
504
523
  // How each reviewer's PASSed work held up (forge dataset reviewers). Advisory and optional: read once per
505
524
  // change of the models data, and a failure (an export, no dataset) only leaves the column empty.
@@ -532,6 +551,35 @@ window.ForgeApp = (() => {
532
551
  });
533
552
  }
534
553
 
554
+ /* ---------- every worktree forge created (#/worktrees) ---------- */
555
+ // It reads /api/worktrees itself, when opened and at a slow interval: never on the page's poll.
556
+ function renderWorktrees() {
557
+ const main = $('main');
558
+ if (main.dataset.view === 'worktrees' && state.worktreesView) { state.worktreesView.setFilter(state.worktrees); return; }
559
+ setView(main, 'worktrees'); delete main.dataset.run;
560
+ main.replaceChildren();
561
+ const v = el('section', undefined, 'worktrees-view'); v.id = 'worktrees-view'; main.append(v);
562
+ state.worktreesView = window.ForgeWorktrees.render(v, {
563
+ filter: state.worktrees, runHref: key => '#/runs/' + encodeURIComponent(key),
564
+ tablePrefs: id => state.tablePrefs[id], saveTablePrefs: (id, p) => { state.tablePrefs = { ...state.tablePrefs, [id]: p }; store.set('tables', state.tablePrefs); },
565
+ });
566
+ }
567
+
568
+ /* ---------- each repository's runs, findings and memories (#/projects) ---------- */
569
+ function renderProjects() {
570
+ const main = $('main'), p = state.projects;
571
+ if (main.dataset.view === 'projects' && state.projectsView) { state.projectsView.go(p.id, p.tab); return; }
572
+ setView(main, 'projects'); delete main.dataset.run;
573
+ main.replaceChildren();
574
+ const v = el('section', undefined, 'projects-view'); v.id = 'projects-view'; main.append(v);
575
+ state.projectsView = window.ForgeProjects.render(v, {
576
+ id: p.id, tab: p.tab, runHref: key => '#/runs/' + encodeURIComponent(key),
577
+ tablePrefs: id => state.tablePrefs[id], saveTablePrefs: (id, pr) => { state.tablePrefs = { ...state.tablePrefs, [id]: pr }; store.set('tables', state.tablePrefs); },
578
+ });
579
+ }
580
+ // a repository's project page: the id is the run cloud's (cloudmodel.js hashId of the repository root)
581
+ const projectHref = repo => window.ForgeCloudModel && repo ? '#/projects/' + window.ForgeCloudModel.hashId(String(repo)) : null;
582
+
535
583
  /* ---------- a run's open findings (#/runs/<key>/findings) ---------- */
536
584
  function renderFindings() {
537
585
  const main = $('main');
@@ -654,6 +702,12 @@ window.ForgeApp = (() => {
654
702
  rec.addEventListener('click', () => { Shell.toggle('insp', true); if (state.sel) select(null); });
655
703
  acts.append(rec);
656
704
  if (!SNAP && window.ForgeFindings) acts.append(findingsLink(state.key));
705
+ if (!SNAP && window.ForgeWorktrees && (state.cache.get(state.key)?.data || {}).kind !== 'solo') {
706
+ const wt = el('a', undefined, 'details-btn worktrees-link'); wt.href = '#/worktrees/runs/' + encodeURIComponent(state.key);
707
+ wt.title = 'This run\'s worktrees: what state each is in, and the command that removes it';
708
+ wt.append(icon('panel-right'), el('span', 'Worktrees'));
709
+ acts.append(wt);
710
+ }
657
711
  if (!SNAP) {
658
712
  const ex = el('button', undefined, 'export-btn'); ex.type = 'button'; ex.title = 'Download this run as one HTML file to share';
659
713
  ex.append(icon('download'), el('span', 'Export…'));
@@ -747,7 +801,7 @@ window.ForgeApp = (() => {
747
801
  const lamp = el('i', undefined, 'lamp st-' + LAMP[RM.runState(run)]);
748
802
  const title = el('h2', String(run.goal || 'Untitled run').split('\n')[0]); title.title = run.goal || '';
749
803
  const where = el('span', undefined, 'run-where'); where.title = `${run.repo || ''}\n${run.run_id || ''}`;
750
- appendRepo(where, run);
804
+ appendRepo(where, run, true);
751
805
  where.append(el('span', run.run_id, 'mono'));
752
806
  if (solo) where.append(document.createTextNode(' · solo run'));
753
807
  // the describer: each state's count, the wall time so far, and how long since anything moved
@@ -804,7 +858,8 @@ window.ForgeApp = (() => {
804
858
  const tools = box && box.querySelector('.module-tools');
805
859
  let slot = tools && tools.querySelector('.dt-tools');
806
860
  if (tools && !slot) { slot = el('span', undefined, 'dt-tools'); tools.prepend(slot); }
807
- preserve(host, () => {
861
+ // The table's column button lives in `slot`, outside `host`, and a redraw replaces it: both count as in use.
862
+ guard(slot || host, () => preserve(host, () => {
808
863
  if (run.kind === 'solo') { if (slot) slot.replaceChildren(); return; }
809
864
  if (!list(run.tasks).length) { if (slot) slot.replaceChildren(); host.append(el('p', 'This run has no tasks yet.', 'empty')); return; }
810
865
  Table.render(host, {
@@ -816,7 +871,7 @@ window.ForgeApp = (() => {
816
871
  }),
817
872
  });
818
873
  scoped(host, run.key + ':');
819
- });
874
+ }));
820
875
  }
821
876
  function renderInspector(run) {
822
877
  const host = $('inspector'); if (!host || !window.ForgePanel) return;
@@ -850,14 +905,14 @@ window.ForgeApp = (() => {
850
905
  const host = $('strip'); if (!host) return;
851
906
  const show = state.mode === 'exec' && run.kind !== 'solo';
852
907
  host.hidden = !show;
853
- if (show) window.ForgeGantt.strip(host, run, { now: now(), replay: state.replay }); else host.replaceChildren();
908
+ guard(host, () => { if (show) window.ForgeGantt.strip(host, run, { now: now(), replay: state.replay }); else host.replaceChildren(); });
854
909
  }
855
910
  // Files: which task touched which file, in the stage's place (the inspector stays beside it)
856
911
  function renderFiles(run) {
857
912
  const host = $('files-view'), view = $('run-view'); if (!host || !view) return;
858
913
  const open = state.mode === 'files' && !!window.ForgeFiles;
859
914
  view.classList.toggle('files-open', open); host.hidden = !open;
860
- if (!open) { host.filesSig = ''; return; }
915
+ if (!open) { host.filesSig = ''; forget(host); return; }
861
916
  const c = state.files.get(run.key);
862
917
  if (!c || c.updated !== run.updated) loadFiles(run);
863
918
  if (!c || !c.data) {
@@ -868,9 +923,9 @@ window.ForgeApp = (() => {
868
923
  const sig = JSON.stringify([c.at, state.sel]);
869
924
  if (host.filesSig === sig) return; // a poll that changed nothing here redraws nothing
870
925
  host.filesSig = sig;
871
- window.ForgeFiles.render(host, c.data, { run, sel: state.sel, onSelectTask: id => select({ kind: 'task', id }),
926
+ guard(host, () => keepOpen(host, () => window.ForgeFiles.render(host, c.data, { run, sel: state.sel, onSelectTask: id => select({ kind: 'task', id }),
872
927
  diffHref: (task, path) => diffHash(run.key, { kind: 'task', task, source: 'current', file: path }),
873
- prefs: state.filesPrefs, savePrefs: p => { state.filesPrefs = p; store.set('files', p); } });
928
+ prefs: state.filesPrefs, savePrefs: p => { state.filesPrefs = p; store.set('files', p); } })));
874
929
  }
875
930
  // every review's findings of the run, for the stage's marks: read again when the run changes
876
931
  function syncFindings(run) {
@@ -893,7 +948,8 @@ window.ForgeApp = (() => {
893
948
  const host = $('diff-view'), view = $('run-view'); if (!host || !view) return;
894
949
  const kind = state.convo && window.ForgeConvo ? 'convo' : state.diff && window.ForgeDiff ? 'diff' : null;
895
950
  view.classList.toggle('diff-open', !!kind); host.hidden = !kind;
896
- if (host.dataset.kind !== (kind || '')) { host.replaceChildren(); host.diffSig = ''; host.convoFrame = null; host.dataset.kind = kind || ''; }
951
+ // What was held for the view being left would draw it over what replaced it.
952
+ if (host.dataset.kind !== (kind || '')) { forget(host); host.replaceChildren(); host.diffSig = ''; host.convoFrame = null; host.dataset.kind = kind || ''; }
897
953
  if (!kind) return;
898
954
  const rerender = () => { const r = state.cache.get(state.key)?.data; if (r) renderDiff(r); };
899
955
  if (kind === 'convo') {
@@ -903,8 +959,9 @@ window.ForgeApp = (() => {
903
959
  fetchJSON: path => fetchJSON(path).then(r => r.data), rerender, diffHash: spec => diffHash(run.key, spec), closeHref: hashFor(run.key, state.sel) });
904
960
  return;
905
961
  }
906
- window.ForgeDiff.render(host, { run, spec: state.diff, fetchJSON: path => fetchJSON(path).then(r => r.data), rerender,
907
- href: spec => diffHash(run.key, spec), closeHref: hashFor(run.key, state.sel) });
962
+ const spec = state.diff; // this draw's, whenever a hold lets it run
963
+ guard(host, () => keepOpen(host, () => window.ForgeDiff.render(host, { run, spec, fetchJSON: path => fetchJSON(path).then(r => r.data), rerender,
964
+ href: spec => diffHash(run.key, spec), closeHref: hashFor(run.key, state.sel) })));
908
965
  }
909
966
  function renderRunBody(run) {
910
967
  renderDiff(run);
@@ -960,6 +1017,8 @@ window.ForgeApp = (() => {
960
1017
  if (state.cloud) { renderCloud(); return; }
961
1018
  if (state.models) { renderModels(); return; }
962
1019
  if (state.settings) { renderSettings(); return; }
1020
+ if (state.worktrees) { renderWorktrees(); return; }
1021
+ if (state.projects) { renderProjects(); return; }
963
1022
  if (state.key && state.findingsPage) { renderFindings(); return; }
964
1023
  if (!state.key) { renderMap(); return; }
965
1024
  const cached = state.cache.get(state.key);
@@ -1016,7 +1075,8 @@ window.ForgeApp = (() => {
1016
1075
  renderList();
1017
1076
  if (state.cloud) renderCloud();
1018
1077
  else if (state.settings) state.settingsView?.poll(); // the picker follows the run list; the page stays
1019
- else if (!state.key && !state.models) renderMap({ rebuildBar: $('map-filters') ? !$('map-filters').contains(document.activeElement) : true });
1078
+ else if (state.projects) state.projectsView?.poll();
1079
+ else if (!state.key && !state.models && !state.worktrees) renderMap({ rebuildBar: $('map-filters') ? !$('map-filters').contains(document.activeElement) : true });
1020
1080
  }, 'Could not refresh runs');
1021
1081
  }
1022
1082
  function loadRun(key) {
@@ -1052,6 +1112,8 @@ window.ForgeApp = (() => {
1052
1112
  state.cloud = parsed.cloud || null;
1053
1113
  state.models = !!parsed.models;
1054
1114
  state.settings = !!parsed.settings && !!window.ForgeSettings && !SNAP;
1115
+ state.worktrees = parsed.worktrees && window.ForgeWorktrees && !SNAP ? parsed.worktrees : null;
1116
+ state.projects = parsed.projects && window.ForgeProjects && !SNAP ? parsed.projects : null;
1055
1117
  if (parsed.key) state.lastKey = parsed.key;
1056
1118
  state.findingsPage = !!parsed.findings && !!window.ForgeFindings;
1057
1119
  if (state.cloud && state.cloud.model) { // a model's runs: the cloud, filtered to it
@@ -1061,7 +1123,7 @@ window.ForgeApp = (() => {
1061
1123
  document.body.classList.toggle('cloud-mode', !!state.cloud);
1062
1124
  if (!state.key) document.body.classList.remove('no-tasks');
1063
1125
  for (const a of document.querySelectorAll('.topbar .top-link')) {
1064
- const here = a.getAttribute('href') === (state.cloud ? '#/cloud' : state.models ? '#/models' : state.settings ? '#/settings' : !state.key ? '#/' : null);
1126
+ const here = a.getAttribute('href') === (state.cloud ? '#/cloud' : state.models ? '#/models' : state.settings ? '#/settings' : state.worktrees ? '#/worktrees' : state.projects ? '#/projects' : !state.key ? '#/' : null);
1065
1127
  if (here) a.setAttribute('aria-current', 'page'); else a.removeAttribute('aria-current');
1066
1128
  }
1067
1129
  renderErrors();
@@ -1069,6 +1131,8 @@ window.ForgeApp = (() => {
1069
1131
  if (state.cloud) { renderCloud(); return; }
1070
1132
  if (state.models) { renderModels(); loadModels(); return; }
1071
1133
  if (state.settings) { renderSettings(); return; }
1134
+ if (state.worktrees) { renderWorktrees(); return; }
1135
+ if (state.projects) { renderProjects(); return; }
1072
1136
  if (state.key && state.findingsPage) { renderFindings(); return; }
1073
1137
  if (!state.key) { renderMap(); return; }
1074
1138
  const cached = state.cache.get(state.key);
@@ -1116,6 +1180,8 @@ window.ForgeApp = (() => {
1116
1180
  { id: 'cmd:cloud', label: 'Open the run cloud', sub: 'every run in 3D, grouped by project', ids: ['cloud'], href: '#/cloud' },
1117
1181
  { id: 'cmd:map', label: 'Open the map of all runs', sub: 'the front page', ids: ['map', 'home'], href: '#/' },
1118
1182
  { id: 'cmd:models', label: 'Open the model leaderboard', sub: 'pass rates, retries, time and tokens per model', ids: ['models', 'leaderboard'], href: '#/models' },
1183
+ ...(window.ForgeProjects ? [{ id: 'cmd:projects', label: 'Open the projects', sub: 'each repository\'s runs, findings and memories', ids: ['projects', 'repos', 'memory', 'findings'], href: '#/projects' }] : []),
1184
+ ...(window.ForgeWorktrees ? [{ id: 'cmd:worktrees', label: 'Open the worktrees', sub: 'every worktree forge created, its state and the command that removes it', ids: ['worktrees', 'cleanup', 'disk'], href: '#/worktrees' }] : []),
1119
1185
  ...(window.ForgeSettings ? [{ id: 'cmd:settings', label: 'Open the settings', sub: 'model registry, Jev, and the .forge files of a repository', ids: ['settings', 'config', 'verify', 'jev'], href: '#/settings' }] : []),
1120
1186
  { id: 'cmd:notify', label: 'Notifications', sub: 'what finished or failed, and browser notifications', ids: ['alerts', 'bell'], action: () => window.ForgeNotify && window.ForgeNotify.open() },
1121
1187
  { id: 'cmd:dim', label: state.dim === '3d' ? 'Switch to 2D' : 'Switch to 3D', sub: state.dim === '3d' ? 'graphs and charts, no WebGL' : 'loads three.js from cdn.jsdelivr.net', ids: ['2d', '3d'],
@@ -1190,3 +1256,15 @@ window.ForgeApp = (() => {
1190
1256
  // window.ForgeUI is uikit.js's shared helpers; the page's own handles (state, refresh) join it, where the browser
1191
1257
  // tests and ui/tools/readme_media.py read them.
1192
1258
  window.ForgeUI = Object.assign(window.ForgeUI || {}, window.ForgeApp);
1259
+ // #113: the version of the server answering, beside the logo. An export has no server, so no label; nor when it is unknown.
1260
+ (function brandVersion() {
1261
+ const label = document.getElementById('brand-version');
1262
+ if (!label || !window.ForgeUI.get || document.getElementById('forge-snapshot')) return;
1263
+ window.ForgeUI.get('/api/health').then(res => {
1264
+ const version = res.ok && typeof res.data.version === 'string' ? res.data.version : '';
1265
+ if (!version) return;
1266
+ label.textContent = 'v' + version;
1267
+ label.title = typeof res.data.build === 'string' ? 'forge ' + version + ', build ' + res.data.build.slice(0, 12) : 'forge ' + version;
1268
+ label.hidden = false;
1269
+ });
1270
+ })();
@@ -220,7 +220,10 @@ window.ForgeCloudUI = (() => {
220
220
  if (q) q.addEventListener('input', () => { const t = q.value.trim().toLowerCase(); for (const li of ul.children) li.hidden = !!t && !li.dataset.name.includes(t); });
221
221
  box.append(ul); return box;
222
222
  }
223
- function buildPanel(keep) {
223
+ // A live refresh waits for what the user is doing (#115). An export has no uikit.js and never refreshes.
224
+ const guard = (region, draw) => { if (window.ForgeUI?.guard) window.ForgeUI.guard(region, draw); else draw(); };
225
+ function buildPanel(keep) { guard(panel, () => buildPanelNow(keep)); }
226
+ function buildPanelNow(keep) {
224
227
  const active = keep && panel.contains(document.activeElement) ? document.activeElement.dataset.key : null, top = panel.scrollTop;
225
228
  const f = prefs.filter, O = CM.options(S.facts), P = CM.projects(S.runs);
226
229
  panel.replaceChildren();
@@ -331,7 +334,8 @@ window.ForgeCloudUI = (() => {
331
334
  }
332
335
 
333
336
  /* ---------- without 3D: the same filtered runs as a list ---------- */
334
- function renderList() {
337
+ function renderList() { guard(listHost, renderListNow); }
338
+ function renderListNow() {
335
339
  listHost.replaceChildren();
336
340
  const head = el('div', undefined, 'cloud-list-head');
337
341
  if (S.mode === 'failed') head.append(el('p', S.note || '3D view unavailable.', 'warn'));
@@ -279,7 +279,7 @@ window.ForgeConvo = (() => {
279
279
  const status = [];
280
280
  const ws = list(D.warnings);
281
281
  if (ws.length) status.push(el('p', ws[0], 'warn'));
282
- if (ws.length > 1) { const d = el('details', undefined, 'diff-warnings'); d.append(el('summary', `${ws.length - 1} more warning${ws.length === 2 ? '' : 's'}`), el('pre', ws.slice(1).join('\n'))); status.push(d); }
282
+ if (ws.length > 1) { const d = el('details', undefined, 'diff-warnings'); d.open = v.open.has('warnings'); d.addEventListener('toggle', () => { if (d.open) v.open.add('warnings'); else v.open.delete('warnings'); }); d.append(el('summary', `${ws.length - 1} more warning${ws.length === 2 ? '' : 's'}`), el('pre', ws.slice(1).join('\n'))); status.push(d); }
283
283
  if (D.format === 'text' && list(D.events).length) status.push(el('p', `${D.harness || 'This harness'} left plain text, not a stream of events: its log is shown as it is.`, 'muted'));
284
284
  if (!list(D.events).length) status.push(el('p', running ? 'Nothing logged yet: the agent has just started.' : D.source === 'none' ? 'No log was kept for this execution.' : 'Its log holds no conversation.', 'muted convo-empty'));
285
285
  f.status.replaceChildren(...status);
@@ -56,7 +56,7 @@ window.ForgeDiff = (() => {
56
56
  if (where) head.append(el('span', where, 'mono muted'));
57
57
  box.append(head, el('p', said(f)));
58
58
  const more = String(f.text || '').trim();
59
- if (more && more !== String(f.summary || '').trim()) { const d = el('details'); d.append(el('summary', 'Details'), el('pre', more)); box.append(d); }
59
+ if (more && more !== String(f.summary || '').trim()) { const d = el('details'); d.dataset.keep = `finding-${f.id ?? where ?? said(f)}`; d.append(el('summary', 'Details'), el('pre', more)); box.append(d); }
60
60
  return box;
61
61
  }
62
62
 
@@ -193,7 +193,7 @@ window.ForgeDiff = (() => {
193
193
  for (const p of loose) { const b = findingBox(p.f, `${p.f.location || 'no location'} · ${p.f.off_diff || 'not located'}`); b.id = 'diff-finding-' + p.i; b.tabIndex = -1; ls.append(b); }
194
194
  main.append(ls);
195
195
  }
196
- if (list(D.warnings).length) { const d = el('details', undefined, 'diff-warnings'); d.append(el('summary', `Reader warnings (${D.warnings.length})`), el('pre', D.warnings.join('\n'))); main.append(d); }
196
+ if (list(D.warnings).length) { const d = el('details', undefined, 'diff-warnings'); d.dataset.keep = 'diff-warnings'; d.append(el('summary', `Reader warnings (${D.warnings.length})`), el('pre', D.warnings.join('\n'))); main.append(d); }
197
197
  if (files.length || loose.length) body.append(nav); else body.classList.add('no-files');
198
198
  body.append(main); host.append(body);
199
199
 
@@ -743,7 +743,7 @@
743
743
  else if (rows.length - fold <= 4) s.append(items(rows));
744
744
  else {
745
745
  if (fold) s.append(items(rows.slice(0, fold)));
746
- const det = el('details', undefined, 'fm-more');
746
+ const det = el('details', undefined, 'fm-more'); det.dataset.keep = `fm-more-${title}`;
747
747
  det.append(el('summary', `${fmt(rows.length - fold)} ${more}`), items(rows.slice(fold)));
748
748
  s.append(det);
749
749
  }
@@ -35,6 +35,8 @@
35
35
  <script src="cloudui.js" defer></script>
36
36
  <script src="leaderboard.js" defer></script>
37
37
  <script src="findingsview.js" defer></script>
38
+ <script src="worktreesview.js" defer></script>
39
+ <script src="projectsview.js" defer></script>
38
40
  <script src="rundelete.js" defer></script>
39
41
  <script src="settings.js" defer></script>
40
42
  <script src="search.js" defer></script>
@@ -44,11 +46,13 @@
44
46
  <body data-shell="immersive" data-runs="open" data-insp="open" data-tasks="open">
45
47
  <script src="shell.js"></script>
46
48
  <header class="topbar">
47
- <a class="brand" href="#/" title="forge-ui · local run viewer"><span class="brand-plate">forge</span><span class="brand-sub">ui</span></a>
49
+ <a class="brand" href="#/" title="forge-ui · local run viewer"><span class="brand-plate">forge</span><span class="brand-sub">ui</span><span class="brand-version" id="brand-version" hidden></span></a>
48
50
  <nav class="desk-nav" aria-label="Views">
49
51
  <a class="top-link" href="#/">Map</a>
50
52
  <a class="top-link" href="#/cloud">Cloud</a>
53
+ <a class="top-link" href="#/projects">Projects</a>
51
54
  <a class="top-link" href="#/models">Models</a>
55
+ <a class="top-link" href="#/worktrees">Worktrees</a>
52
56
  <a class="top-link" href="#/settings">Settings</a>
53
57
  </nav>
54
58
  <button class="top-search" type="button" data-jump title="Jump to a run, task, project, model or command (/)"><span class="top-search-label"><span>Search</span></span> <kbd>Ctrl K</kbd></button>
@@ -163,6 +163,14 @@ window.ForgePanel = (() => {
163
163
  wrap.append(table);
164
164
  parent.append(wrap);
165
165
  }
166
+ // What a reviewer said about its own tests (FORGE_TESTS). A review that could not run them stands out: its verdict
167
+ // rests on reading alone. A reply that says nothing shows nothing.
168
+ const TESTS_WORDS = { ran: 'Reviewer ran tests', not_needed: 'Reviewer needed no tests', could_not_run: 'Reviewer could not run tests', unclear: 'Reviewer\'s word on its tests is unclear' };
169
+ function testsLine(parent, tests) {
170
+ if (!tests || !TESTS_WORDS[tests.status]) return;
171
+ const text = TESTS_WORDS[tests.status] + (tests.reason ? `: ${tests.reason}` : '');
172
+ parent.append(el('p', text, tests.status === 'could_not_run' ? 'warn tests-line' : 'muted tests-line'));
173
+ }
166
174
  // An attempt's chip. A failed attempt is red whatever its words; a send-back says what forge did in its title.
167
175
  function attemptChip(word) {
168
176
  const c = chip(word, RM.attemptFailed(word) ? 'fail' : undefined), note = RM.attemptNote(word);
@@ -527,7 +535,7 @@ window.ForgePanel = (() => {
527
535
  h.append(el('strong', `${r.kind} review · attempt ${display(r.attempt)}`), plate(r.spec), chip(r.verdict || r.state || 'unknown'));
528
536
  box.append(h);
529
537
  if (r.state === 'running') muted(box, 'Still reviewing; findings appear when it finishes.');
530
- else findingsList(box, r.findings, `task-${task.id}-r${i}`);
538
+ else { testsLine(box, r.tests); findingsList(box, r.findings, `task-${task.id}-r${i}`); }
531
539
  rs.append(box);
532
540
  });
533
541
  }
@@ -670,11 +678,29 @@ window.ForgePanel = (() => {
670
678
  if (n.last == null && n.planning_last == null) muted(ps, 'No output yet.');
671
679
  }
672
680
 
681
+ // Commits made outside forge that `adopt` brought in, each reviewed alone: a person's work, so no task row claims them.
682
+ function adoptionsList(host, run) {
683
+ const rows = list(run.adoptions);
684
+ if (!rows.length) return;
685
+ const s = section(host, `Adopted commits (${rows.length})`);
686
+ const ul = el('ul', undefined, 'adoptions');
687
+ for (const a of rows) {
688
+ const li = el('li'), failed = String(a.verdict).toUpperCase() !== 'PASS';
689
+ li.append(el('code', `${String(a.base).slice(0, 12)}..${String(a.tip).slice(0, 12)}`, 'mono'), document.createTextNode(' '),
690
+ chip(a.verdict, failed ? 'fail' : 'pass'));
691
+ if (a.approved) li.append(el('span', 'approved over the review', 'tag'));
692
+ if (a.reason) li.append(el('p', a.reason, 'muted'));
693
+ ul.append(li);
694
+ }
695
+ s.append(ul);
696
+ }
697
+
673
698
  function finalView(host, ctx, sel) {
674
699
  const run = ctx.run, reviews = list(run.final_reviews);
675
700
  const head = el('div', undefined, 'insp-head');
676
701
  head.append(el('h2', 'Final review'), el('div', 'finish · whole-run review', 'insp-kind'));
677
702
  host.append(head);
703
+ adoptionsList(host, run);
678
704
  const pick = sel.name ? reviews.find(r => r.name === sel.name) : reviews[0];
679
705
  if (!pick) {
680
706
  head.append(chip(run.settings && run.settings.final_qa ? 'pending' : 'not requested', 'none'));
@@ -700,7 +726,7 @@ window.ForgePanel = (() => {
700
726
  const entry = lazy(ctx, `/api/runs/${encodeURIComponent(run.key)}/final-reviews/${encodeURIComponent(pick.name)}`, pick.state === 'done' ? 'done:' + pick.verdict : run.updated);
701
727
  if (!loading(fs, entry, 'the review')) {
702
728
  const d = entry.data;
703
- if (pick.state !== 'running') findingsList(fs, d.findings, `final-${pick.name}`);
729
+ if (pick.state !== 'running') { testsLine(fs, d.tests); findingsList(fs, d.findings, `final-${pick.name}`); }
704
730
  const ps = section(host, 'Report and prompt');
705
731
  details(ps, 'Reviewer report (qa.last)', d.qa_last, `final-${pick.name}-last`);
706
732
  details(ps, 'Prompt (qa.input)', d.qa_input, `final-${pick.name}-input`);