@giamme/forge 0.17.0 → 0.19.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.
- package/CHANGELOG.md +57 -0
- package/README.md +1 -0
- package/SKILL.md +32 -5
- package/VERSION +1 -1
- package/docs/artifacts.md +33 -1
- package/docs/commands.md +147 -16
- package/docs/dataset.md +5 -0
- package/docs/decomposed-runs.md +122 -1
- package/docs/development.md +2 -1
- package/docs/forge-ui.md +98 -8
- package/docs/memory.md +27 -4
- package/docs/models.md +8 -0
- package/docs/reviews.md +122 -0
- package/docs/safety.md +8 -0
- package/forge +44 -4
- package/package.json +2 -1
- package/references/dataset.md +39 -1
- package/references/decompose.md +737 -16
- package/references/harnesses.md +18 -3
- package/references/planning.md +43 -14
- package/references/solo.md +2 -1
- package/references/ui.md +56 -6
- package/registry.tsv +8 -3
- package/scripts/forge-artifact.sh +14 -0
- package/scripts/forge-brief.py +217 -0
- package/scripts/forge-compare.py +13 -2
- package/scripts/forge-config.py +176 -9
- package/scripts/forge-contract.py +246 -28
- package/scripts/forge-control.py +200 -15
- package/scripts/forge-dispatch.sh +48 -15
- package/scripts/forge-du.py +167 -0
- package/scripts/forge-group.py +496 -0
- package/scripts/forge-groups.py +89 -0
- package/scripts/forge-handoff.py +1128 -0
- package/scripts/forge-lib-adopt.sh +1 -0
- package/scripts/forge-lib-group.sh +641 -0
- package/scripts/forge-lib-plans.sh +343 -4
- package/scripts/forge-lib-review.sh +29 -1
- package/scripts/forge-lib-task.sh +197 -4
- package/scripts/forge-memory.sh +245 -3
- package/scripts/forge-metrics.sh +7 -3
- package/scripts/forge-parallel-options.sh +4 -0
- package/scripts/forge-parallel.sh +1216 -41
- package/scripts/forge-planner.py +104 -8
- package/scripts/forge-prompt.py +120 -0
- package/scripts/forge-retro.py +115 -0
- package/scripts/forge-route.py +190 -12
- package/scripts/forge-runs-compact.py +443 -0
- package/scripts/forge-runs-rm.py +2 -0
- package/scripts/forge-runs.py +27 -8
- package/scripts/forge-schedule.py +633 -49
- package/scripts/forge-shadow.py +7 -1
- package/scripts/forge-solo.sh +4 -0
- package/scripts/forge-summarize.py +698 -0
- package/scripts/forge-ui-options.sh +10 -0
- package/scripts/forge-worktrees.py +243 -0
- package/scripts/forge_brief/__init__.py +831 -0
- package/scripts/forge_brief/answers.py +506 -0
- package/scripts/forge_brief/proposals.py +1630 -0
- package/scripts/forge_dataset/__init__.py +10 -0
- package/scripts/forge_dataset/efforts.py +4 -3
- package/scripts/forge_dataset/export.py +36 -10
- package/scripts/forge_dataset/facts.py +8 -4
- package/scripts/forge_dataset/forecast.py +8 -18
- package/scripts/forge_dataset/harvest.py +241 -12
- package/scripts/forge_dataset/history.py +13 -6
- package/scripts/forge_dataset/importer.py +65 -1
- package/scripts/forge_dataset/names.py +66 -0
- package/scripts/forge_dataset/reviewers.py +5 -2
- package/scripts/forge_dataset/risk.py +6 -3
- package/scripts/forge_dataset/routing.py +6 -1
- package/scripts/forge_decide/__init__.py +11 -1
- package/scripts/forge_groups/__init__.py +308 -0
- package/scripts/forge_groups/attribute.py +289 -0
- package/scripts/forge_groups/review.py +286 -0
- package/scripts/forge_locations.py +366 -0
- package/scripts/forge_owner.py +152 -0
- package/scripts/forge_registry.py +19 -0
- package/scripts/forge_retro/__init__.py +417 -0
- package/scripts/forge_retro/issues.py +1193 -0
- package/scripts/forge_retro/report.py +671 -0
- package/scripts/forge_side/__init__.py +482 -0
- package/scripts/forge_storage.py +515 -0
- package/ui/README.md +68 -8
- package/ui/docs/api.md +375 -31
- package/ui/forge_ui/control.py +451 -11
- package/ui/forge_ui/executions.py +8 -1
- package/ui/forge_ui/export.py +53 -7
- package/ui/forge_ui/groups.py +264 -0
- package/ui/forge_ui/links.py +337 -0
- package/ui/forge_ui/models.py +125 -10
- package/ui/forge_ui/projects.py +4 -1
- package/ui/forge_ui/reader.py +919 -45
- package/ui/forge_ui/server.py +4 -0
- package/ui/forge_ui/static/app.js +173 -11
- package/ui/forge_ui/static/briefview.js +605 -0
- package/ui/forge_ui/static/checksview.js +6 -2
- package/ui/forge_ui/static/controls.js +5 -0
- package/ui/forge_ui/static/diffview.js +86 -1
- package/ui/forge_ui/static/groupsview.js +332 -0
- package/ui/forge_ui/static/index.html +4 -0
- package/ui/forge_ui/static/panel.js +394 -8
- package/ui/forge_ui/static/projectsview.js +189 -10
- package/ui/forge_ui/static/runmodel.js +27 -4
- package/ui/forge_ui/static/storageview.js +352 -0
- package/ui/forge_ui/static/style.css +176 -6
- package/ui/forge_ui/static/worktreesview.js +235 -14
- package/ui/forge_ui/storage.py +150 -0
- package/ui/forge_ui/transcripts.py +35 -10
- package/ui/forge_ui/worktrees.py +154 -13
package/ui/forge_ui/server.py
CHANGED
|
@@ -36,6 +36,7 @@ TOKEN_HEADER = 'X-Forge-UI-Token'
|
|
|
36
36
|
|
|
37
37
|
_RUN_PATH = re.compile(r'/api/runs/([0-9a-f]{12})')
|
|
38
38
|
_TASK_PATH = re.compile(r'/api/runs/([0-9a-f]{12})/tasks/([^/]+)')
|
|
39
|
+
_GROUP_PATH = re.compile(r'/api/runs/([0-9a-f]{12})/groups/([a-z0-9][a-z0-9-]{0,39})')
|
|
39
40
|
_EXEC_PATH = re.compile(r'/api/runs/([0-9a-f]{12})/executions/((?:task|dwarf|qa|solo|verification|parallel)-[0-9a-f]{32})')
|
|
40
41
|
_REVIEW_PATH = re.compile(r'/api/runs/([0-9a-f]{12})/final-reviews/((?:final-review|integrate)-[0-9]+-[0-9]+)')
|
|
41
42
|
_TASK_DIFF_PATH = re.compile(_TASK_PATH.pattern + r'/diff(?:/(current|prev|committed|existing))?')
|
|
@@ -130,6 +131,9 @@ def api_get(catalog, path):
|
|
|
130
131
|
if match:
|
|
131
132
|
task_id = _task_id(match.group(2))
|
|
132
133
|
return None if task_id is None else catalog.task(match.group(1), task_id)
|
|
134
|
+
match = _GROUP_PATH.fullmatch(path)
|
|
135
|
+
if match:
|
|
136
|
+
return catalog.group(*match.groups())
|
|
133
137
|
match = _EXEC_PATH.fullmatch(path)
|
|
134
138
|
if match:
|
|
135
139
|
return catalog.execution(*match.groups())
|
|
@@ -21,7 +21,7 @@ window.ForgeApp = (() => {
|
|
|
21
21
|
settings: false, lastKey: null, settingsRun: null, settingsPickedAt: null, settingsView: null,
|
|
22
22
|
models: false, modelsData: null, modelsText: null, modelsError: null, reviewerOutcomes: null, modelsPrefs: store.get('models', {}),
|
|
23
23
|
files: new Map(), findingsCount: new Map(), filesPrefs: store.get('files', {}), runSort: store.get('run-sort', 'updated'), tablePrefs: store.get('tables', {}),
|
|
24
|
-
findings: new Map() };
|
|
24
|
+
findings: new Map(), groupId: null };
|
|
25
25
|
state.stageMode = state.mode === 'exec' ? 'exec' : 'plan'; // the stage's own mode, kept while Files is shown
|
|
26
26
|
if (state.mode === 'files' && !window.ForgeFiles) state.mode = state.stageMode;
|
|
27
27
|
const $ = id => document.getElementById(id);
|
|
@@ -49,6 +49,7 @@ window.ForgeApp = (() => {
|
|
|
49
49
|
if (!sel) return base;
|
|
50
50
|
const e = encodeURIComponent;
|
|
51
51
|
if (sel.kind === 'task') return `${base}/tasks/${e(sel.id)}`;
|
|
52
|
+
if (sel.kind === 'group') return `${base}/group/${e(sel.id)}`;
|
|
52
53
|
if (sel.kind === 'execution') return sel.task ? `${base}/tasks/${e(sel.task)}/executions/${e(sel.exec)}` : `${base}/executions/${e(sel.exec)}`;
|
|
53
54
|
if (sel.kind === 'final') return `${base}/final-review${sel.name ? '/' + e(sel.name) : ''}`;
|
|
54
55
|
if (sel.kind === 'adoption') return `${base}/adoptions/${e(sel.name)}`;
|
|
@@ -80,6 +81,7 @@ window.ForgeApp = (() => {
|
|
|
80
81
|
if (/^#\/settings\/?$/.test(hash)) return { key: null, sel: null, settings: true };
|
|
81
82
|
const pj = hash.match(/^#\/projects(?:\/([0-9a-f]{8})(?:\/(runs|findings|memories))?)?\/?$/);
|
|
82
83
|
if (pj) return { key: null, sel: null, projects: { id: pj[1] || null, tab: pj[2] || 'runs' } };
|
|
84
|
+
if (/^#\/disk\/?$/.test(hash)) return { key: null, sel: null, disk: true };
|
|
83
85
|
const w = hash.match(/^#\/worktrees(?:\/(repo|runs)\/([^/]+))?\/?$/);
|
|
84
86
|
if (w) return { key: null, sel: null, worktrees: { repo: w[1] === 'repo' ? decodeURIComponent(w[2]) : '', run: w[1] === 'runs' ? decodeURIComponent(w[2]) : '' } };
|
|
85
87
|
const m = hash.match(/^#\/runs\/([^/]+)(\/.*)?$/);
|
|
@@ -87,6 +89,7 @@ window.ForgeApp = (() => {
|
|
|
87
89
|
const d = decodeURIComponent, rest = m[2] || '';
|
|
88
90
|
if (/^\/findings\/?$/.test(rest)) return { key: d(m[1]), sel: null, findings: true };
|
|
89
91
|
let sel = null, r;
|
|
92
|
+
if ((r = rest.match(/^\/group\/([^/]+)\/?$/))) return { key: d(m[1]), sel: null, group: d(r[1]) };
|
|
90
93
|
if ((r = rest.match(/^\/tasks\/([^/]+)\/diff(?:\/(?!file\/|finding\/)([^/]+))?(?:\/finding\/([^/]+))?(?:\/file\/(.+?))?\/?$/))) return { key: d(m[1]), sel: { kind: 'task', id: d(r[1]) }, diff: { kind: 'task', task: d(r[1]), source: r[2] ? d(r[2]) : 'current', finding: r[3] ? d(r[3]) : null, file: r[4] ? d(r[4]) : null } };
|
|
91
94
|
if ((r = rest.match(/^\/tasks\/([^/]+)\/fractal\/([^/]+)\/diff(?:\/file\/(.+?))?\/?$/))) return { key: d(m[1]), sel: { kind: 'task', id: d(r[1]) }, diff: { kind: 'fractal', task: d(r[1]), node: d(r[2]), file: r[3] ? d(r[3]) : null } };
|
|
92
95
|
if ((r = rest.match(/^\/final-review\/([^/]+)\/diff(?:\/finding\/([^/]+))?(?:\/file\/(.+?))?\/?$/))) return { key: d(m[1]), sel: { kind: 'final', name: d(r[1]) }, diff: { kind: 'final', name: d(r[1]), finding: r[2] ? d(r[2]) : null, file: r[3] ? d(r[3]) : null } };
|
|
@@ -115,7 +118,7 @@ window.ForgeApp = (() => {
|
|
|
115
118
|
function link(text, key, sel) { const a = el('a', text); a.href = hashFor(key, sel); return a; }
|
|
116
119
|
|
|
117
120
|
const statuses = new Set(['merged', 'pass', 'running', 'pending', 'fail', 'error', 'infra',
|
|
118
|
-
'timeout', 'unknown', 'invalidated', 'blocked', 'interrupted', 'nochanges', 'conflict', 'accepted', 'outdated', 'needs_input', 'needs_decision']);
|
|
121
|
+
'timeout', 'unknown', 'invalidated', 'blocked', 'interrupted', 'nochanges', 'conflict', 'accepted', 'outdated', 'needs_input', 'needs_decision', 'implemented']);
|
|
119
122
|
function chip(value, cls) {
|
|
120
123
|
const status = String(cls || value || 'unknown').toLowerCase();
|
|
121
124
|
return el('span', value || '—', 'chip st-' + (statuses.has(status) ? status : 'unknown'));
|
|
@@ -570,6 +573,20 @@ window.ForgeApp = (() => {
|
|
|
570
573
|
});
|
|
571
574
|
}
|
|
572
575
|
|
|
576
|
+
/* ---------- what forge takes on disk (#/disk) ---------- */
|
|
577
|
+
// It reads /api/storage itself, when opened and while a measurement runs: never on the page's poll.
|
|
578
|
+
function renderDisk() {
|
|
579
|
+
const main = $('main');
|
|
580
|
+
if (main.dataset.view === 'disk' && state.diskView) return;
|
|
581
|
+
setView(main, 'disk'); delete main.dataset.run;
|
|
582
|
+
main.replaceChildren();
|
|
583
|
+
const v = el('section', undefined, 'worktrees-view disk-view'); v.id = 'disk-view'; main.append(v);
|
|
584
|
+
state.diskView = window.ForgeStorage.render(v, {
|
|
585
|
+
runHref: key => '#/runs/' + encodeURIComponent(key),
|
|
586
|
+
tablePrefs: id => state.tablePrefs[id], saveTablePrefs: (id, p) => { state.tablePrefs = { ...state.tablePrefs, [id]: p }; store.set('tables', state.tablePrefs); },
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
|
|
573
590
|
/* ---------- each repository's runs, findings and memories (#/projects) ---------- */
|
|
574
591
|
function renderProjects() {
|
|
575
592
|
const main = $('main'), p = state.projects;
|
|
@@ -811,7 +828,7 @@ window.ForgeApp = (() => {
|
|
|
811
828
|
if (solo) where.append(document.createTextNode(' · solo run'));
|
|
812
829
|
// the describer: each state's count, the wall time so far, and how long since anything moved
|
|
813
830
|
const desc = el('span', undefined, 'describer');
|
|
814
|
-
for (const [s, n] of Object.entries(run.counts || {})) { const d = el('span', undefined, 'desc-count'); d.append(el('i', undefined, 'lamp st-' + String(s).toLowerCase()), document.createTextNode(` ${s} ${n}`)); desc.append(d); }
|
|
831
|
+
for (const [s, n] of Object.entries(run.counts || {})) { const d = el('span', undefined, 'desc-count'); d.append(el('i', undefined, 'lamp st-' + String(s).toLowerCase()), document.createTextNode(` ${RM.statusLabel(s)} ${n}`)); desc.append(d); }
|
|
815
832
|
const r = RM.timeRange(run, now());
|
|
816
833
|
if (r) desc.append(el('span', `WALL ${RM.fmtDur(r.end - r.start)}`, 'dim'));
|
|
817
834
|
const upd = el('span', relative(run.updated).replace(/^updated /, ''), 'dim updated'); upd.title = 'Last activity ' + time(run.updated);
|
|
@@ -835,9 +852,21 @@ window.ForgeApp = (() => {
|
|
|
835
852
|
return [
|
|
836
853
|
{ id: 'id', label: 'ID', mono: true, value: t => t.id, cell: t => link(t.id, run.key, { kind: 'task', id: t.id }) },
|
|
837
854
|
{ id: 'title', label: 'Title', value: t => t.title },
|
|
855
|
+
// the task's group, only while this run has groups: a run without groups.tsv keeps the columns it had
|
|
856
|
+
...(list(run.groups).length && window.ForgeGroups ? [{ id: 'group', label: 'Group', value: t => t.group || null,
|
|
857
|
+
cell: t => t.group ? window.ForgeGroups.taskChip(t.group, hashFor(run.key, { kind: 'group', id: t.group })) : '—' }] : []),
|
|
858
|
+
// the one-sentence summary, only while the run's summaries are on (#133 B): the column is not there otherwise
|
|
859
|
+
...(summariesOn(run) ? [{ id: 'summary', label: 'Summary', title: 'The one-sentence summary of each task (summaries are on for this run)', cls: 'sum-col',
|
|
860
|
+
value: t => t.summary && t.summary.sentence || null, cell: t => t.summary && t.summary.sentence || '—' }] : []),
|
|
838
861
|
{ id: 'difficulty', label: 'Difficulty', value: t => DIFF_RANK[t.difficulty] ?? null, cell: t => display(t.difficulty) },
|
|
839
862
|
{ id: 'wave', label: 'Wave', value: t => Number.isFinite(Number(t.wave)) && t.wave !== null && t.wave !== '' ? Number(t.wave) : null, cell: t => display(t.wave) },
|
|
840
|
-
{ id: 'status', label: 'Status', value: t => RM.taskStatus(t), cell: t =>
|
|
863
|
+
{ id: 'status', label: 'Status', value: t => RM.taskStatus(t), cell: t => {
|
|
864
|
+
const mark = window.ForgeBrief && window.ForgeBrief.affectedBadge && window.ForgeBrief.affectedBadge(t);
|
|
865
|
+
if (!mark) return chip(RM.statusText(t), RM.taskStatus(t));
|
|
866
|
+
const row = el('span', undefined, 'brief-affected-row');
|
|
867
|
+
row.append(chip(RM.statusText(t), RM.taskStatus(t)), mark);
|
|
868
|
+
return row;
|
|
869
|
+
} },
|
|
841
870
|
...(window.ForgeChecks ? [{ id: 'now', label: 'Now', title: 'What a running task is doing, or why one that is not running waits',
|
|
842
871
|
value: t => window.ForgeChecks.nowRank(t), cell: t => window.ForgeChecks.cell(t, now(), { hash: s => hashFor(run.key, s) }) }] : []),
|
|
843
872
|
{ id: 'dwarf', label: 'Dwarf', value: t => t.dwarf, cell: t => window.ForgeIcons.modelPlate(t.dwarf) },
|
|
@@ -878,6 +907,43 @@ window.ForgeApp = (() => {
|
|
|
878
907
|
scoped(host, run.key + ':');
|
|
879
908
|
}));
|
|
880
909
|
}
|
|
910
|
+
// The run's summary switch above its tasks (#133 B): `forge control set summaries on|off`, asked in controls.js's words
|
|
911
|
+
// and sent through the page's write path, with the model shown when on. A page that cannot write shows the state alone.
|
|
912
|
+
// Built once per run and per writability, then updated in place, so a poll never takes the keyboard off its keys.
|
|
913
|
+
const summariesOn = run => !!run.summaries && run.summaries.mode === 'on';
|
|
914
|
+
let summaryWritable = false;
|
|
915
|
+
function askWritable() {
|
|
916
|
+
if (SNAP || !window.ForgeUI || !window.ForgeUI.controlsEnabled) return;
|
|
917
|
+
window.ForgeUI.controlsEnabled().then(on => {
|
|
918
|
+
if (!!on === summaryWritable) return;
|
|
919
|
+
summaryWritable = !!on;
|
|
920
|
+
const cur = state.cache.get(state.key)?.data;
|
|
921
|
+
if (cur) renderSummarySwitch(cur);
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
function renderSummarySwitch(run) {
|
|
925
|
+
const host = $('run-summaries'); if (!host) return;
|
|
926
|
+
host.hidden = run.kind === 'solo' || !window.ForgePanel; // a solo run has one task and no switch
|
|
927
|
+
if (host.hidden) return;
|
|
928
|
+
askWritable();
|
|
929
|
+
const mode = summariesOn(run) ? 'on' : 'off', key = run.key;
|
|
930
|
+
const shape = `${key}|${summaryWritable ? 'write' : 'read'}`;
|
|
931
|
+
if (host.dataset.shape !== shape) {
|
|
932
|
+
host.dataset.shape = shape;
|
|
933
|
+
const kids = [el('span', 'Summaries:', 'plate')];
|
|
934
|
+
if (summaryWritable) {
|
|
935
|
+
kids.push(window.ForgePanel.summaryBank([['off', 'Off'], ['on', 'On']], mode,
|
|
936
|
+
value => window.ForgePanel.changeSummaries(host.querySelector('.sum-msgs'), null, key, { input: value }, () => loadRun(key)),
|
|
937
|
+
'Summaries for this run'));
|
|
938
|
+
} else kids.push(el('span', undefined, 'sum-state'));
|
|
939
|
+
kids.push(el('span', undefined, 'sum-model'), el('div', undefined, 'sum-msgs'));
|
|
940
|
+
host.replaceChildren(...kids);
|
|
941
|
+
}
|
|
942
|
+
for (const b of host.querySelectorAll('.sum-bank button')) b.setAttribute('aria-pressed', String(b.dataset.value === mode));
|
|
943
|
+
const word = host.querySelector('.sum-state');
|
|
944
|
+
if (word) word.textContent = mode;
|
|
945
|
+
host.querySelector('.sum-model').replaceChildren(...(mode === 'on' && run.summaries.model ? [window.ForgeIcons.modelPlate(run.summaries.model)] : []));
|
|
946
|
+
}
|
|
881
947
|
function renderInspector(run) {
|
|
882
948
|
const host = $('inspector'); if (!host || !window.ForgePanel) return;
|
|
883
949
|
const sel = state.sel || (run.kind === 'solo' ? { kind: 'task', id: list(run.tasks)[0]?.id } : null);
|
|
@@ -886,6 +952,7 @@ window.ForgeApp = (() => {
|
|
|
886
952
|
run, sel, now: now(),
|
|
887
953
|
fetchJSON: path => fetchJSON(path).then(r => r.data),
|
|
888
954
|
rerender: () => { const r = state.cache.get(state.key)?.data; if (r) renderInspector(r); },
|
|
955
|
+
refresh: () => loadRun(run.key), // a change made here shows at once, not at the next poll
|
|
889
956
|
hash: s => hashFor(run.key, s), onSelect: s => select(s), diffHash: spec => diffHash(run.key, spec),
|
|
890
957
|
convoHash: (s, event) => convoHash(run.key, s, event),
|
|
891
958
|
onFractal: (id, data) => { if (state.stage && state.stage.setFractal) state.stage.setFractal(id, data); },
|
|
@@ -1005,17 +1072,93 @@ window.ForgeApp = (() => {
|
|
|
1005
1072
|
const strip = el('div', undefined, 'strip-wrap'); strip.id = 'strip'; view.append(strip);
|
|
1006
1073
|
const diff = el('section', undefined, 'diff-view'); diff.id = 'diff-view'; diff.hidden = true; diff.tabIndex = -1; view.append(diff);
|
|
1007
1074
|
const box = el('section', undefined, 'module tasks-module'); box.setAttribute('aria-label', 'Tasks'); box.dataset.overlay = '';
|
|
1075
|
+
const questions = el('div', undefined, 'run-questions'); questions.id = 'run-questions'; questions.hidden = true; // open brief questions (#135)
|
|
1076
|
+
questions.setAttribute('aria-label', 'Open questions');
|
|
1077
|
+
const switchRow = el('div', undefined, 'tasks-switch'); switchRow.id = 'run-summaries'; switchRow.hidden = true; // the summaries switch (#133 B)
|
|
1008
1078
|
const tasks = el('div', undefined, 'run-tasks'); tasks.id = 'run-tasks';
|
|
1009
|
-
box.append(Shell.head('tasks', 'Tasks', ''), tasks, Shell.splitter('tasks'));
|
|
1079
|
+
box.append(Shell.head('tasks', 'Tasks', ''), questions, switchRow, tasks, Shell.splitter('tasks'));
|
|
1010
1080
|
view.append(box);
|
|
1081
|
+
// After the tasks module. Hidden until the run has groups, so a run without them lays out as before.
|
|
1082
|
+
const groups = el('section', undefined, 'module groups-module');
|
|
1083
|
+
groups.id = 'run-groups'; groups.hidden = true; groups.setAttribute('aria-label', 'Groups');
|
|
1084
|
+
view.append(groups);
|
|
1085
|
+
view.style.setProperty('--groups-h', '0px');
|
|
1086
|
+
// A width change (the side panels, the window) can rewrap the rows; republish the height then.
|
|
1087
|
+
if (window.ResizeObserver) new ResizeObserver(() => syncGroupsHeight(groups, view)).observe(groups);
|
|
1011
1088
|
}
|
|
1012
1089
|
document.body.classList.toggle('no-tasks', run.kind === 'solo');
|
|
1013
1090
|
ensureStage();
|
|
1014
1091
|
renderHeader(run);
|
|
1015
1092
|
renderRunBody(run);
|
|
1093
|
+
renderSummarySwitch(run);
|
|
1094
|
+
renderQuestions(run);
|
|
1016
1095
|
renderTable(run);
|
|
1096
|
+
renderGroups(run);
|
|
1017
1097
|
announce(run);
|
|
1018
1098
|
}
|
|
1099
|
+
// The groups block. Nothing in the host, and the run grid unchanged, when summary() returns null.
|
|
1100
|
+
// --groups-h is the block's border box, so the immersive strip and stage padding sit above it.
|
|
1101
|
+
function syncGroupsHeight(host, view) {
|
|
1102
|
+
if (!host || !view) return;
|
|
1103
|
+
const shown = !host.hidden && host.getClientRects().length > 0;
|
|
1104
|
+
const next = (shown ? host.getBoundingClientRect().height : 0) + 'px';
|
|
1105
|
+
if (view.style.getPropertyValue('--groups-h') !== next) view.style.setProperty('--groups-h', next);
|
|
1106
|
+
}
|
|
1107
|
+
function renderGroups(run) {
|
|
1108
|
+
const host = $('run-groups'), view = $('run-view');
|
|
1109
|
+
if (!host || !view) return;
|
|
1110
|
+
const block = window.ForgeGroups && window.ForgeGroups.summary(run, {
|
|
1111
|
+
groupHref: id => hashFor(run.key, { kind: 'group', id }),
|
|
1112
|
+
taskHref: id => hashFor(run.key, { kind: 'task', id }),
|
|
1113
|
+
});
|
|
1114
|
+
host.hidden = !block;
|
|
1115
|
+
view.classList.toggle('has-groups', !!block);
|
|
1116
|
+
if (!block) { host.replaceChildren(); syncGroupsHeight(host, view); return; }
|
|
1117
|
+
preserve(host, () => { host.append(block); syncGroupsHeight(host, view); });
|
|
1118
|
+
}
|
|
1119
|
+
// #/runs/<key>/group/<gid>. The run stays cached; the group payload is fetched by the view.
|
|
1120
|
+
function renderGroup() {
|
|
1121
|
+
const main = $('main'), gid = state.groupId, run = state.cache.get(state.key)?.data;
|
|
1122
|
+
if (main.dataset.view !== 'group' || main.dataset.run !== state.key || main.dataset.group !== gid) {
|
|
1123
|
+
setView(main, 'group'); main.dataset.run = state.key; main.dataset.group = gid;
|
|
1124
|
+
main.replaceChildren();
|
|
1125
|
+
const view = el('section', undefined, 'group-view'); view.id = 'group-view'; main.append(view);
|
|
1126
|
+
}
|
|
1127
|
+
const host = $('group-view');
|
|
1128
|
+
if (!window.ForgeGroups) { host.replaceChildren(el('p', 'Groups are not available in this page.', 'empty')); return; }
|
|
1129
|
+
if (run) { host.dataset.run = state.key; host.dataset.group = gid; }
|
|
1130
|
+
window.ForgeGroups.render(host, {
|
|
1131
|
+
key: state.key, gid, run, plan: run && run.path, back: '#/runs/' + encodeURIComponent(state.key),
|
|
1132
|
+
taskHref: id => hashFor(state.key, { kind: 'task', id }),
|
|
1133
|
+
transcriptHref: execution => execution && execution.id ? convoHash(state.key, { kind: 'execution', exec: execution.id }) : null,
|
|
1134
|
+
fetchJSON: path => fetchJSON(path).then(r => r.data),
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
// Open brief questions (#135), flagged first and then by the schedule projection, plus proposals (#136).
|
|
1138
|
+
// Hidden with the tasks module when that panel is folded, and hidden entirely when brief is off or there
|
|
1139
|
+
// is nothing to show. A proposal keeps the host open after every question is answered.
|
|
1140
|
+
function renderQuestions(run) {
|
|
1141
|
+
const host = $('run-questions');
|
|
1142
|
+
if (!host) return;
|
|
1143
|
+
const show = run.kind !== 'solo' && run.brief && window.ForgeBrief;
|
|
1144
|
+
const open = show ? window.ForgeBrief.openQuestions(run) : [];
|
|
1145
|
+
const proposals = show ? list(run.proposals).filter(item => item && typeof item === 'object') : [];
|
|
1146
|
+
if (!open.length && !proposals.length) {
|
|
1147
|
+
host.hidden = true;
|
|
1148
|
+
host.replaceChildren();
|
|
1149
|
+
delete host.dataset.proposals;
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
host.hidden = false;
|
|
1153
|
+
host.setAttribute('aria-label', proposals.length ? 'Questions and proposals' : 'Open questions');
|
|
1154
|
+
const clock = now();
|
|
1155
|
+
const projections = RM.projectSchedule(run, { now: clock });
|
|
1156
|
+
preserve(host, () => window.ForgeBrief.renderList(host, {
|
|
1157
|
+
run, projections, now: clock,
|
|
1158
|
+
href: id => hashFor(run.key, { kind: 'task', id }),
|
|
1159
|
+
refresh: () => loadRun(run.key),
|
|
1160
|
+
}));
|
|
1161
|
+
}
|
|
1019
1162
|
function renderMain() {
|
|
1020
1163
|
document.body.classList.toggle('cloud-mode', !!state.cloud);
|
|
1021
1164
|
if (!state.key) document.body.classList.remove('no-tasks');
|
|
@@ -1023,8 +1166,10 @@ window.ForgeApp = (() => {
|
|
|
1023
1166
|
if (state.models) { renderModels(); return; }
|
|
1024
1167
|
if (state.settings) { renderSettings(); return; }
|
|
1025
1168
|
if (state.worktrees) { renderWorktrees(); return; }
|
|
1169
|
+
if (state.disk) { renderDisk(); return; }
|
|
1026
1170
|
if (state.projects) { renderProjects(); return; }
|
|
1027
1171
|
if (state.key && state.findingsPage) { renderFindings(); return; }
|
|
1172
|
+
if (state.key && state.groupId) { renderGroup(); return; }
|
|
1028
1173
|
if (!state.key) { renderMap(); return; }
|
|
1029
1174
|
const cached = state.cache.get(state.key);
|
|
1030
1175
|
if (cached) renderRun(cached.data);
|
|
@@ -1034,7 +1179,8 @@ window.ForgeApp = (() => {
|
|
|
1034
1179
|
const prev = state.lastStatuses.get(run.key), cur = new Map(list(run.tasks).map(t => [t.id, t.status]));
|
|
1035
1180
|
state.lastStatuses.set(run.key, cur);
|
|
1036
1181
|
if (!prev || Date.now() - state.announced < 10000) return;
|
|
1037
|
-
const
|
|
1182
|
+
const word = s => { const label = RM.statusLabel(s); return label === String(s) ? String(s).toLowerCase() : label; };
|
|
1183
|
+
const changes = [...cur].filter(([id, s]) => prev.has(id) && prev.get(id) !== s).map(([id, s]) => `${id} ${word(prev.get(id))} → ${word(s)}`);
|
|
1038
1184
|
if (!changes.length) return;
|
|
1039
1185
|
state.announced = Date.now();
|
|
1040
1186
|
$('live').textContent = changes.slice(0, 5).join('; ');
|
|
@@ -1081,16 +1227,26 @@ window.ForgeApp = (() => {
|
|
|
1081
1227
|
if (state.cloud) renderCloud();
|
|
1082
1228
|
else if (state.settings) state.settingsView?.poll(); // the picker follows the run list; the page stays
|
|
1083
1229
|
else if (state.projects) state.projectsView?.poll();
|
|
1084
|
-
else if (!state.key && !state.models && !state.worktrees) renderMap({ rebuildBar: $('map-filters') ? !$('map-filters').contains(document.activeElement) : true });
|
|
1230
|
+
else if (!state.key && !state.models && !state.worktrees && !state.disk) renderMap({ rebuildBar: $('map-filters') ? !$('map-filters').contains(document.activeElement) : true });
|
|
1085
1231
|
}, 'Could not refresh runs');
|
|
1086
1232
|
}
|
|
1087
1233
|
function loadRun(key) {
|
|
1088
1234
|
return request('/api/runs/' + encodeURIComponent(key), result => {
|
|
1089
1235
|
const changed = state.cache.get(key)?.text !== result.text;
|
|
1090
1236
|
state.cache.set(key, result);
|
|
1091
|
-
if (state.key === key && changed && !state.findingsPage)
|
|
1237
|
+
if (state.key === key && changed && !state.findingsPage) {
|
|
1238
|
+
if (state.groupId) renderGroup(); else renderRun(result.data);
|
|
1239
|
+
}
|
|
1092
1240
|
}, 'Could not refresh run', error => {
|
|
1093
1241
|
if (state.key !== key || state.cache.has(key) || state.findingsPage) return;
|
|
1242
|
+
if (state.groupId) {
|
|
1243
|
+
if (error.status === 404) state.errors.delete('/api/runs/' + encodeURIComponent(key));
|
|
1244
|
+
const host = $('group-view');
|
|
1245
|
+
if (host) host.replaceChildren(el('p', error.status === 404
|
|
1246
|
+
? 'Waiting for this run to appear… checking again while this tab is visible. If its directory was removed, pick another run.'
|
|
1247
|
+
: 'Could not load this run. Select another run, or leave refresh enabled to retry.', 'empty'));
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1094
1250
|
if (error.status === 404) state.errors.delete('/api/runs/' + encodeURIComponent(key));
|
|
1095
1251
|
setView($('main'), 'waiting');
|
|
1096
1252
|
$('main').replaceChildren(el('p', error.status === 404 ?
|
|
@@ -1105,7 +1261,8 @@ window.ForgeApp = (() => {
|
|
|
1105
1261
|
history.replaceState(null, '', '#/runs/' + encodeURIComponent(SNAP.meta.key));
|
|
1106
1262
|
parsed = parseHash(location.hash);
|
|
1107
1263
|
}
|
|
1108
|
-
const
|
|
1264
|
+
const leavingGroup = !!state.groupId && state.groupId !== (parsed.group || null);
|
|
1265
|
+
const keyChanged = parsed.key !== state.key || (!!state.findingsPage && !parsed.findings) || leavingGroup; // findings and the group page replace the run's DOM
|
|
1109
1266
|
state.key = parsed.key;
|
|
1110
1267
|
const selWas = JSON.stringify(state.sel || null);
|
|
1111
1268
|
state.sel = parsed.sel;
|
|
@@ -1118,9 +1275,11 @@ window.ForgeApp = (() => {
|
|
|
1118
1275
|
state.models = !!parsed.models;
|
|
1119
1276
|
state.settings = !!parsed.settings && !!window.ForgeSettings && !SNAP;
|
|
1120
1277
|
state.worktrees = parsed.worktrees && window.ForgeWorktrees && !SNAP ? parsed.worktrees : null;
|
|
1278
|
+
state.disk = !!parsed.disk && !!window.ForgeStorage && !SNAP;
|
|
1121
1279
|
state.projects = parsed.projects && window.ForgeProjects && !SNAP ? parsed.projects : null;
|
|
1122
1280
|
if (parsed.key) state.lastKey = parsed.key;
|
|
1123
1281
|
state.findingsPage = !!parsed.findings && !!window.ForgeFindings;
|
|
1282
|
+
state.groupId = parsed.group && window.ForgeGroups ? parsed.group : null;
|
|
1124
1283
|
if (state.cloud && state.cloud.model) { // a model's runs: the cloud, filtered to it
|
|
1125
1284
|
cloudFilter({ models: { aliases: [state.cloud.model], role: 'any' } });
|
|
1126
1285
|
history.replaceState(null, '', '#/cloud'); state.cloud.model = null;
|
|
@@ -1128,7 +1287,7 @@ window.ForgeApp = (() => {
|
|
|
1128
1287
|
document.body.classList.toggle('cloud-mode', !!state.cloud);
|
|
1129
1288
|
if (!state.key) document.body.classList.remove('no-tasks');
|
|
1130
1289
|
for (const a of document.querySelectorAll('.topbar .top-link')) {
|
|
1131
|
-
const here = a.getAttribute('href') === (state.cloud ? '#/cloud' : state.models ? '#/models' : state.settings ? '#/settings' : state.worktrees ? '#/worktrees' : state.projects ? '#/projects' : !state.key ? '#/' : null);
|
|
1290
|
+
const here = a.getAttribute('href') === (state.cloud ? '#/cloud' : state.models ? '#/models' : state.settings ? '#/settings' : state.worktrees ? '#/worktrees' : state.disk ? '#/disk' : state.projects ? '#/projects' : !state.key ? '#/' : null);
|
|
1132
1291
|
if (here) a.setAttribute('aria-current', 'page'); else a.removeAttribute('aria-current');
|
|
1133
1292
|
}
|
|
1134
1293
|
renderErrors();
|
|
@@ -1137,8 +1296,10 @@ window.ForgeApp = (() => {
|
|
|
1137
1296
|
if (state.models) { renderModels(); loadModels(); return; }
|
|
1138
1297
|
if (state.settings) { renderSettings(); return; }
|
|
1139
1298
|
if (state.worktrees) { renderWorktrees(); return; }
|
|
1299
|
+
if (state.disk) { renderDisk(); return; }
|
|
1140
1300
|
if (state.projects) { renderProjects(); return; }
|
|
1141
1301
|
if (state.key && state.findingsPage) { renderFindings(); return; }
|
|
1302
|
+
if (state.key && state.groupId) { renderGroup(); loadRun(state.key); return; }
|
|
1142
1303
|
if (!state.key) { renderMap(); return; }
|
|
1143
1304
|
const cached = state.cache.get(state.key);
|
|
1144
1305
|
if (cached) {
|
|
@@ -1186,7 +1347,8 @@ window.ForgeApp = (() => {
|
|
|
1186
1347
|
{ id: 'cmd:map', label: 'Open the map of all runs', sub: 'the front page', ids: ['map', 'home'], href: '#/' },
|
|
1187
1348
|
{ id: 'cmd:models', label: 'Open the model leaderboard', sub: 'pass rates, retries, time and tokens per model', ids: ['models', 'leaderboard'], href: '#/models' },
|
|
1188
1349
|
...(window.ForgeProjects ? [{ id: 'cmd:projects', label: 'Open the projects', sub: 'each repository\'s runs, findings and memories', ids: ['projects', 'repos', 'memory', 'findings'], href: '#/projects' }] : []),
|
|
1189
|
-
...(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'
|
|
1350
|
+
...(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'], href: '#/worktrees' }] : []),
|
|
1351
|
+
...(window.ForgeStorage ? [{ id: 'cmd:disk', label: 'Open the disk report', sub: 'what forge takes on disk and the command that takes each part back', ids: ['disk', 'space', 'du', 'compact', 'cleanup'], href: '#/disk' }] : []),
|
|
1190
1352
|
...(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' }] : []),
|
|
1191
1353
|
{ id: 'cmd:notify', label: 'Notifications', sub: 'what finished or failed, and browser notifications', ids: ['alerts', 'bell'], action: () => window.ForgeNotify && window.ForgeNotify.open() },
|
|
1192
1354
|
{ 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'],
|