@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
|
@@ -235,5 +235,90 @@ window.ForgeDiff = (() => {
|
|
|
235
235
|
if (target && host.dataset.scrolledTo !== url + '\n' + spec.file) { host.dataset.scrolledTo = url + '\n' + spec.file; requestAnimationFrame(() => target.scrollIntoView({ block: 'start' })); }
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
|
|
238
|
+
|
|
239
|
+
// A proposal's unified diff (difflib, or diff --git). Same line table as a file hunk, text only.
|
|
240
|
+
function parsePatch(text) {
|
|
241
|
+
const files = [];
|
|
242
|
+
let file = null, hunk = null, sawMinus = false;
|
|
243
|
+
function startFile(name) {
|
|
244
|
+
file = { name: name || 'diff', hunks: [] };
|
|
245
|
+
files.push(file);
|
|
246
|
+
hunk = null;
|
|
247
|
+
}
|
|
248
|
+
for (let raw of String(text || '').split('\n')) {
|
|
249
|
+
if (raw.endsWith('\r')) raw = raw.slice(0, -1);
|
|
250
|
+
if (raw.startsWith('diff --git ')) {
|
|
251
|
+
const parts = raw.slice('diff --git '.length).trim().split(/\s+/);
|
|
252
|
+
const name = (parts[1] || parts[0] || 'diff').replace(/^b\//, '');
|
|
253
|
+
startFile(name);
|
|
254
|
+
sawMinus = false;
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
if (raw.startsWith('--- ')) {
|
|
258
|
+
const name = raw.slice(4).trim().replace(/^a\//, '');
|
|
259
|
+
startFile(name === '/dev/null' ? 'diff' : name);
|
|
260
|
+
sawMinus = true;
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
if (raw.startsWith('+++ ') && sawMinus) {
|
|
264
|
+
const name = raw.slice(4).trim().replace(/^b\//, '');
|
|
265
|
+
if (file && name && name !== '/dev/null') file.name = name;
|
|
266
|
+
sawMinus = false;
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
sawMinus = false;
|
|
270
|
+
const head = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(.*)$/.exec(raw);
|
|
271
|
+
if (head) {
|
|
272
|
+
if (!file) startFile('diff');
|
|
273
|
+
hunk = {
|
|
274
|
+
old_start: Number(head[1]), old_lines: head[2] == null ? 1 : Number(head[2]),
|
|
275
|
+
new_start: Number(head[3]), new_lines: head[4] == null ? 1 : Number(head[4]),
|
|
276
|
+
section: head[5].trim(), lines: [],
|
|
277
|
+
};
|
|
278
|
+
file.hunks.push(hunk);
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
if (hunk && (raw.startsWith('+') || raw.startsWith('-') || raw.startsWith(' ') || raw.startsWith('\\'))) hunk.lines.push(raw);
|
|
282
|
+
}
|
|
283
|
+
return files.filter(item => item.hunks.length);
|
|
284
|
+
}
|
|
285
|
+
function patchTable(file) {
|
|
286
|
+
const sec = el('section', undefined, 'diff-file');
|
|
287
|
+
if (file.name) sec.append(el('p', file.name, 'mono diff-path'));
|
|
288
|
+
const table = el('table', undefined, 'diff-table');
|
|
289
|
+
table.setAttribute('role', 'presentation');
|
|
290
|
+
const body = el('tbody');
|
|
291
|
+
for (const h of file.hunks) {
|
|
292
|
+
const hr = el('tr', undefined, 'diff-hunk');
|
|
293
|
+
const label = `@@ -${h.old_start},${h.old_lines} +${h.new_start},${h.new_lines} @@${h.section ? ' ' + h.section : ''}`;
|
|
294
|
+
const hc = el('td', label);
|
|
295
|
+
hc.colSpan = 4;
|
|
296
|
+
hr.append(hc);
|
|
297
|
+
body.append(hr);
|
|
298
|
+
let o = h.old_start, n = h.new_start;
|
|
299
|
+
for (const ln of h.lines) {
|
|
300
|
+
const m = ln[0];
|
|
301
|
+
const tr = el('tr', undefined, 'diff-line ' + (m === '+' ? 'add' : m === '-' ? 'del' : m === '\\' ? 'meta' : 'ctx'));
|
|
302
|
+
const on = m === '+' || m === '\\' ? '' : String(o++);
|
|
303
|
+
const nn = m === '-' || m === '\\' ? '' : String(n++);
|
|
304
|
+
tr.append(el('td', on, 'ln'), el('td', nn, 'ln'), el('td', m === '\\' ? '' : m, 'mk'), el('td', m === '\\' ? ln.slice(1).trim() : ln.slice(1), 'code'));
|
|
305
|
+
body.append(tr);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
table.append(body);
|
|
309
|
+
const scroll = el('div', undefined, 'diff-scroll');
|
|
310
|
+
scroll.append(table);
|
|
311
|
+
sec.append(scroll);
|
|
312
|
+
return sec;
|
|
313
|
+
}
|
|
314
|
+
function renderPatch(host, text, opts) {
|
|
315
|
+
if (!host) return;
|
|
316
|
+
host.replaceChildren();
|
|
317
|
+
opts = opts || {};
|
|
318
|
+
const files = parsePatch(text);
|
|
319
|
+
if (!files.length) host.append(el('pre', typeof text === 'string' ? text : '', 'mono brief-diff'));
|
|
320
|
+
else for (const file of files) host.append(patchTable(file));
|
|
321
|
+
if (opts.truncated) host.append(el('p', 'This diff was cut short.', 'warn'));
|
|
322
|
+
}
|
|
323
|
+
return { render, urlFor, cache, renderPatch };
|
|
239
324
|
})();
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
/* forge-ui groups (#140, #136): the run page's groups block and the group page.
|
|
2
|
+
window.ForgeGroups, and a CommonJS module under node:test.
|
|
3
|
+
Run data only ever enters the page as text. The group page reads
|
|
4
|
+
GET /api/runs/<key>/groups/<gid> and draws it; it never runs a command.
|
|
5
|
+
The pure helpers are tested in ui/tests/js/groupsview.test.js.
|
|
6
|
+
summary(run, ctx) is the run-page block, or null when the run has no groups.
|
|
7
|
+
ctx for the block: { groupHref(id), taskHref(id) }.
|
|
8
|
+
ctx for the page: { key, gid, run, plan, back, taskHref(id), transcriptHref(execution), fetchJSON(path) }. */
|
|
9
|
+
(function (root, factory) {
|
|
10
|
+
'use strict';
|
|
11
|
+
const api = factory(root);
|
|
12
|
+
if (typeof module === 'object' && module.exports) module.exports = api;
|
|
13
|
+
else root.ForgeGroups = api;
|
|
14
|
+
})(typeof self !== 'undefined' ? self : this, function (root) {
|
|
15
|
+
'use strict';
|
|
16
|
+
|
|
17
|
+
const list = v => Array.isArray(v) ? v : [];
|
|
18
|
+
// REVIEWING is a review in flight: the same amber lamp as a running task. The other words match task lamps.
|
|
19
|
+
const GROUP_LAMP = {
|
|
20
|
+
PASS: 'pass', FAIL: 'fail', NEEDS_DECISION: 'needs_decision', REVIEWING: 'running', WAITING: 'waiting',
|
|
21
|
+
UNKNOWN: 'unknown', CONFLICT: 'conflict', INFRA: 'infra', TIMEOUT: 'timeout', ERROR: 'error',
|
|
22
|
+
INVALIDATED: 'invalidated', INTERRUPTED: 'interrupted',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function env() {
|
|
26
|
+
return (typeof globalThis !== 'undefined' && globalThis) || root;
|
|
27
|
+
}
|
|
28
|
+
function doc() {
|
|
29
|
+
const g = env();
|
|
30
|
+
if (g && g.document && g.document.createElement) return g.document;
|
|
31
|
+
if (root && root.document && root.document.createElement) return root.document;
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
function el(tag, text, className) {
|
|
35
|
+
const node = doc().createElement(tag);
|
|
36
|
+
if (text !== undefined && text !== null) node.textContent = String(text);
|
|
37
|
+
if (className) node.className = className;
|
|
38
|
+
return node;
|
|
39
|
+
}
|
|
40
|
+
function runModel() {
|
|
41
|
+
if (root && root.ForgeRunModel) return root.ForgeRunModel;
|
|
42
|
+
const g = env();
|
|
43
|
+
return (g && g.ForgeRunModel) || null;
|
|
44
|
+
}
|
|
45
|
+
function icons() {
|
|
46
|
+
if (root && root.ForgeIcons) return root.ForgeIcons;
|
|
47
|
+
const g = env();
|
|
48
|
+
return (g && g.ForgeIcons) || null;
|
|
49
|
+
}
|
|
50
|
+
// A shell word, copied from the inspector: a path with a space is quoted, a safe path is left as it is.
|
|
51
|
+
function shellWord(s) {
|
|
52
|
+
const text = String(s);
|
|
53
|
+
return /^[\w@%+=:,./-]+$/.test(text) ? text : "'" + text.replace(/'/g, "'\\''") + "'";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function scopeText(review) {
|
|
57
|
+
return review === 'group' ? 'one review' : 'per-task review';
|
|
58
|
+
}
|
|
59
|
+
function lampOf(status) {
|
|
60
|
+
if (status && GROUP_LAMP[status]) return GROUP_LAMP[status];
|
|
61
|
+
const word = String(status || '').toLowerCase();
|
|
62
|
+
return /^[a-z0-9_]+$/.test(word) ? word : 'unknown';
|
|
63
|
+
}
|
|
64
|
+
function statusChip(status) {
|
|
65
|
+
return el('span', status || '—', 'chip st-' + lampOf(status));
|
|
66
|
+
}
|
|
67
|
+
function reviewerNode(qa) {
|
|
68
|
+
if (!qa) return el('span', '—', 'muted');
|
|
69
|
+
const plate = icons();
|
|
70
|
+
if (plate && plate.modelPlate) return plate.modelPlate(qa);
|
|
71
|
+
return el('span', String(qa), 'mono');
|
|
72
|
+
}
|
|
73
|
+
function taskById(run, id) {
|
|
74
|
+
return list(run && run.tasks).find(task => task && task.id === id) || null;
|
|
75
|
+
}
|
|
76
|
+
function memberStatus(run, id) {
|
|
77
|
+
const task = taskById(run, id);
|
|
78
|
+
if (!task) return 'unknown';
|
|
79
|
+
const model = runModel();
|
|
80
|
+
if (model && model.taskStatus) return String(model.taskStatus(task)).toLowerCase();
|
|
81
|
+
return String(task.status || 'pending').toLowerCase();
|
|
82
|
+
}
|
|
83
|
+
function memberChip(id, run, href) {
|
|
84
|
+
const node = href ? el('a', String(id), 'chip st-' + memberStatus(run, id)) : el('span', String(id), 'chip st-' + memberStatus(run, id));
|
|
85
|
+
if (href) node.href = href;
|
|
86
|
+
return node;
|
|
87
|
+
}
|
|
88
|
+
function membersRow(ids, run, hrefFor) {
|
|
89
|
+
const row = el('div', undefined, 'group-members');
|
|
90
|
+
const members = list(ids);
|
|
91
|
+
if (!members.length) { row.append(el('span', 'no members', 'muted')); return row; }
|
|
92
|
+
for (const id of members) row.append(memberChip(id, run, hrefFor ? hrefFor(id) : null));
|
|
93
|
+
return row;
|
|
94
|
+
}
|
|
95
|
+
function implicatedText(ids) {
|
|
96
|
+
const names = list(ids);
|
|
97
|
+
return names.length ? 'implicated ' + names.join(', ') : 'implicated none';
|
|
98
|
+
}
|
|
99
|
+
function rowTitle(group, href) {
|
|
100
|
+
const text = group.title || group.id || '';
|
|
101
|
+
if (group.review === 'group' && href) {
|
|
102
|
+
const link = el('a', text, 'group-title');
|
|
103
|
+
link.href = href;
|
|
104
|
+
return link;
|
|
105
|
+
}
|
|
106
|
+
return el('span', text, 'group-title');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// The run page's groups block. Nothing when the run has no groups, so that page stays as it was.
|
|
110
|
+
function summary(run, ctx) {
|
|
111
|
+
const groups = run && run.groups;
|
|
112
|
+
if (!Array.isArray(groups) || !groups.length) return null;
|
|
113
|
+
ctx = ctx || {};
|
|
114
|
+
const block = el('div', undefined, 'groups-block');
|
|
115
|
+
const head = el('div', undefined, 'module-head');
|
|
116
|
+
head.append(el('h2', 'Groups', 'module-title'), el('span', String(groups.length), 'module-count'));
|
|
117
|
+
const rows = el('div', undefined, 'group-rows');
|
|
118
|
+
for (const group of groups) {
|
|
119
|
+
if (!group || typeof group !== 'object') continue;
|
|
120
|
+
rows.append(groupRow(group, run, ctx));
|
|
121
|
+
}
|
|
122
|
+
block.append(head, rows);
|
|
123
|
+
return block;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function groupRow(group, run, ctx) {
|
|
127
|
+
const row = el('article', undefined, 'group-row');
|
|
128
|
+
row.append(rowTitle(group, ctx.groupHref ? ctx.groupHref(group.id) : null));
|
|
129
|
+
row.append(el('p', group.goal ? String(group.goal) : '(no goal)', 'group-goal'));
|
|
130
|
+
const meta = el('div', undefined, 'group-meta');
|
|
131
|
+
meta.append(el('span', scopeText(group.review), 'group-scope'), reviewerNode(group.qa));
|
|
132
|
+
row.append(meta);
|
|
133
|
+
row.append(membersRow(group.members, run, ctx.taskHref));
|
|
134
|
+
if (group.review === 'group') {
|
|
135
|
+
const state = el('p', undefined, 'group-state');
|
|
136
|
+
if (group.status) state.append(statusChip(group.status));
|
|
137
|
+
else state.append(el('span', 'no status', 'muted'));
|
|
138
|
+
state.append(el('span', group.round == null ? 'round —' : 'round ' + group.round, 'group-round'));
|
|
139
|
+
state.append(el('span', implicatedText(group.implicated), 'group-implicated'));
|
|
140
|
+
row.append(state);
|
|
141
|
+
}
|
|
142
|
+
return row;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// `forge group retry <plan> <gid> --tasks …`. Copyable text: the page does not run it.
|
|
146
|
+
function decisionCommand(group, plan) {
|
|
147
|
+
const path = plan ? shellWord(plan) : '<plan>';
|
|
148
|
+
const gid = shellWord(group && group.id ? group.id : '');
|
|
149
|
+
const members = list(group && group.members).map(id => String(id)).filter(Boolean);
|
|
150
|
+
const tasks = members.length ? shellWord(members.join(',')) : '…';
|
|
151
|
+
return 'forge group retry ' + path + ' ' + gid + ' --tasks ' + tasks;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// The attribution table. A finding is highlighted when it is flagged ambiguous or listed in attribution.ambiguous.
|
|
155
|
+
function findingsTable(attribution) {
|
|
156
|
+
const findings = attribution && Array.isArray(attribution.findings) ? attribution.findings : null;
|
|
157
|
+
if (!findings || !findings.length) return el('p', 'No findings.', 'muted');
|
|
158
|
+
const ambiguous = new Set(list(attribution.ambiguous));
|
|
159
|
+
const table = el('table', undefined, 'group-findings');
|
|
160
|
+
const headRow = el('tr');
|
|
161
|
+
for (const label of ['Severity', 'Status', 'File', 'Tasks', 'Blocking', 'Ambiguous']) headRow.append(el('th', label));
|
|
162
|
+
const head = el('thead');
|
|
163
|
+
head.append(headRow);
|
|
164
|
+
const body = el('tbody');
|
|
165
|
+
for (const finding of findings) {
|
|
166
|
+
if (!finding || typeof finding !== 'object') continue;
|
|
167
|
+
const flagged = finding.ambiguous === true || ambiguous.has(finding.n);
|
|
168
|
+
const tr = el('tr', undefined, flagged ? 'group-ambiguous' : '');
|
|
169
|
+
const file = finding.file ? (finding.line == null ? String(finding.file) : String(finding.file) + ':' + finding.line) : '—';
|
|
170
|
+
const tasks = list(finding.tasks);
|
|
171
|
+
const cells = [
|
|
172
|
+
[finding.severity || '—', ''],
|
|
173
|
+
[finding.status || '—', ''],
|
|
174
|
+
[file, 'mono'],
|
|
175
|
+
[tasks.length ? tasks.join(', ') : '—', ''],
|
|
176
|
+
[finding.blocking ? 'yes' : 'no', finding.blocking ? 'group-blocking' : ''],
|
|
177
|
+
[flagged ? 'yes' : 'no', ''],
|
|
178
|
+
];
|
|
179
|
+
for (const [text, className] of cells) tr.append(el('td', text, className || undefined));
|
|
180
|
+
body.append(tr);
|
|
181
|
+
}
|
|
182
|
+
table.append(head, body);
|
|
183
|
+
return table;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function decisionSection(group, plan) {
|
|
187
|
+
if (!group || group.status !== 'NEEDS_DECISION') return null;
|
|
188
|
+
const section = el('section', undefined, 'group-section group-decision');
|
|
189
|
+
section.append(el('h2', 'Decision', 'plate'));
|
|
190
|
+
section.append(el('p', group.decision ? String(group.decision) : 'No decision recorded.', group.decision ? '' : 'muted'));
|
|
191
|
+
section.append(el('pre', decisionCommand(group, plan), 'group-cmd'));
|
|
192
|
+
return section;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function roundsSection(group) {
|
|
196
|
+
const section = el('section', undefined, 'group-section group-rounds');
|
|
197
|
+
section.append(el('h2', 'Rounds', 'plate'));
|
|
198
|
+
const rounds = list(group.rounds);
|
|
199
|
+
if (!rounds.length) { section.append(el('p', 'No rounds.', 'muted')); return section; }
|
|
200
|
+
const byRound = new Map(list(group.members_by_round).filter(bucket => bucket && typeof bucket === 'object').map(bucket => [bucket.round, list(bucket.members)]));
|
|
201
|
+
for (const round of rounds) {
|
|
202
|
+
if (!round || typeof round !== 'object') continue;
|
|
203
|
+
const article = el('article', undefined, 'group-round-row');
|
|
204
|
+
article.append(el('h3', 'Round ' + round.round));
|
|
205
|
+
const meta = el('p', undefined, 'group-meta');
|
|
206
|
+
if (round.status) meta.append(statusChip(round.status));
|
|
207
|
+
meta.append(reviewerNode(round.reviewer));
|
|
208
|
+
meta.append(el('span', implicatedText(round.implicated), 'group-implicated'));
|
|
209
|
+
if (round.epoch != null && Number.isFinite(Number(round.epoch))) {
|
|
210
|
+
const when = new Date(Number(round.epoch) * 1000);
|
|
211
|
+
if (!Number.isNaN(when.getTime())) meta.append(el('span', when.toLocaleString(), 'muted'));
|
|
212
|
+
}
|
|
213
|
+
article.append(meta);
|
|
214
|
+
const members = byRound.get(round.round) || [];
|
|
215
|
+
if (members.length) {
|
|
216
|
+
const line = el('p', undefined, 'group-round-members mono');
|
|
217
|
+
line.textContent = members.map(member => {
|
|
218
|
+
if (!member || typeof member !== 'object') return '';
|
|
219
|
+
const attempt = member.attempt == null ? '' : ' attempt ' + member.attempt;
|
|
220
|
+
const commit = member.commit ? ' ' + member.commit : '';
|
|
221
|
+
return (member.task || '—') + commit + attempt;
|
|
222
|
+
}).filter(Boolean).join(', ');
|
|
223
|
+
article.append(line);
|
|
224
|
+
}
|
|
225
|
+
section.append(article);
|
|
226
|
+
}
|
|
227
|
+
return section;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function textSection(title, value, empty, className) {
|
|
231
|
+
const section = el('section', undefined, 'group-section ' + className);
|
|
232
|
+
section.append(el('h2', title, 'plate'));
|
|
233
|
+
if (value == null || value === '') section.append(el('p', empty, 'muted'));
|
|
234
|
+
else section.append(el('pre', String(value)));
|
|
235
|
+
return section;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function transcriptSection(group, ctx) {
|
|
239
|
+
const section = el('section', undefined, 'group-section group-transcript');
|
|
240
|
+
section.append(el('h2', 'Review transcript', 'plate'));
|
|
241
|
+
const execution = group && group.execution;
|
|
242
|
+
const href = execution && execution.id && ctx.transcriptHref ? ctx.transcriptHref(execution) : null;
|
|
243
|
+
if (!href) { section.append(el('p', 'No review transcript.', 'muted')); return section; }
|
|
244
|
+
const link = el('a', 'Review transcript', 'diff-link');
|
|
245
|
+
link.href = href;
|
|
246
|
+
section.append(link);
|
|
247
|
+
return section;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function pageHeader(group, ctx) {
|
|
251
|
+
const head = el('header', undefined, 'group-head');
|
|
252
|
+
const back = el('a', 'Back to the run', 'group-back');
|
|
253
|
+
back.href = ctx.back || '#/';
|
|
254
|
+
const title = el('h1', group.title || group.id || '', 'group-title');
|
|
255
|
+
head.append(back, title, el('p', group.goal ? String(group.goal) : '(no goal)', 'group-goal'));
|
|
256
|
+
const meta = el('div', undefined, 'group-meta');
|
|
257
|
+
meta.append(el('span', scopeText(group.review), 'group-scope'), reviewerNode(group.qa));
|
|
258
|
+
if (group.review === 'group') {
|
|
259
|
+
if (group.status) meta.append(statusChip(group.status));
|
|
260
|
+
else meta.append(el('span', 'no status', 'muted'));
|
|
261
|
+
meta.append(el('span', group.round == null ? 'round —' : 'round ' + group.round, 'group-round'));
|
|
262
|
+
meta.append(el('span', implicatedText(group.implicated), 'group-implicated'));
|
|
263
|
+
}
|
|
264
|
+
head.append(meta, membersRow(group.members, ctx.run, ctx.taskHref));
|
|
265
|
+
return head;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// The group page, from one group payload. Synchronous, so a test can read it without a fetch.
|
|
269
|
+
function pageView(group, ctx) {
|
|
270
|
+
ctx = ctx || {};
|
|
271
|
+
const page = el('div', undefined, 'group-page');
|
|
272
|
+
if (!group || typeof group !== 'object') {
|
|
273
|
+
page.append(el('p', 'This group is not in the run.', 'empty'));
|
|
274
|
+
return page;
|
|
275
|
+
}
|
|
276
|
+
page.append(pageHeader(group, ctx));
|
|
277
|
+
const decision = decisionSection(group, ctx.plan);
|
|
278
|
+
if (decision) page.append(decision);
|
|
279
|
+
const findings = el('section', undefined, 'group-section group-findings-section');
|
|
280
|
+
findings.append(el('h2', 'Findings', 'plate'));
|
|
281
|
+
// attribution.json is kept across rounds (the next prompt quotes it): a round that left no review has
|
|
282
|
+
// none of its own, so the table is an earlier round's and says so.
|
|
283
|
+
const attribution = group.attribution;
|
|
284
|
+
if (attribution && Number.isInteger(attribution.round) && Number.isInteger(group.round) && attribution.round !== group.round) {
|
|
285
|
+
findings.append(el('p', 'From round ' + attribution.round + ': round ' + group.round + ' has no attributed findings.', 'muted group-stale'));
|
|
286
|
+
}
|
|
287
|
+
findings.append(findingsTable(attribution));
|
|
288
|
+
page.append(findings, roundsSection(group));
|
|
289
|
+
page.append(textSection('Known issues', group.known_issues, 'None.', 'group-known'));
|
|
290
|
+
page.append(textSection('Review', group.qa_last, 'No review yet.', 'group-review'));
|
|
291
|
+
page.append(transcriptSection(group, ctx));
|
|
292
|
+
return page;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// A task's `group <id>` chip. Null when the task is in no group.
|
|
296
|
+
function taskChip(gid, href) {
|
|
297
|
+
if (!gid) return null;
|
|
298
|
+
const link = el('a', 'group ' + gid, 'group-chip');
|
|
299
|
+
if (href) link.href = href;
|
|
300
|
+
return link;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Fetch the group and draw it. A poll that still has the same run skips the fetch.
|
|
304
|
+
// A newer navigation (host._groupsSeq) drops a response that arrived late.
|
|
305
|
+
function render(host, ctx) {
|
|
306
|
+
ctx = ctx || {};
|
|
307
|
+
if (!ctx.run) {
|
|
308
|
+
host.replaceChildren(el('p', 'Loading the group…', 'empty'));
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const token = String(ctx.key) + '\n' + String(ctx.gid) + '\n' + String(ctx.run.updated);
|
|
312
|
+
if (host._groupsToken === token && host.childElementCount) return;
|
|
313
|
+
const seq = (host._groupsSeq = (host._groupsSeq || 0) + 1);
|
|
314
|
+
const same = host.dataset && host.dataset.group === String(ctx.gid) && host.dataset.run === String(ctx.key) && host._groupsData;
|
|
315
|
+
if (!same) host.replaceChildren(el('p', 'Loading the group…', 'empty'));
|
|
316
|
+
const path = '/api/runs/' + encodeURIComponent(ctx.key) + '/groups/' + encodeURIComponent(ctx.gid);
|
|
317
|
+
Promise.resolve().then(() => ctx.fetchJSON(path)).then(data => {
|
|
318
|
+
if (host.isConnected === false || host._groupsSeq !== seq) return;
|
|
319
|
+
host._groupsToken = token;
|
|
320
|
+
host._groupsData = data;
|
|
321
|
+
if (host.dataset) { host.dataset.group = String(ctx.gid); host.dataset.run = String(ctx.key); }
|
|
322
|
+
host.replaceChildren(pageView(data, ctx));
|
|
323
|
+
}, error => {
|
|
324
|
+
if (host.isConnected === false || host._groupsSeq !== seq) return;
|
|
325
|
+
host._groupsToken = '';
|
|
326
|
+
const missing = error && error.status === 404;
|
|
327
|
+
host.replaceChildren(el('p', missing ? 'This group is not in the run.' : 'Could not load this group.', 'empty'));
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return { summary, findingsTable, decisionCommand, taskChip, pageView, render, scopeText };
|
|
332
|
+
});
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
<script src="controls.js" defer></script>
|
|
28
28
|
<script src="verifyview.js" defer></script>
|
|
29
29
|
<script src="checksview.js" defer></script>
|
|
30
|
+
<script src="briefview.js" defer></script>
|
|
31
|
+
<script src="groupsview.js" defer></script>
|
|
30
32
|
<script src="panel.js" defer></script>
|
|
31
33
|
<script src="diffview.js" defer></script>
|
|
32
34
|
<script src="convo.js" defer></script>
|
|
@@ -36,6 +38,7 @@
|
|
|
36
38
|
<script src="leaderboard.js" defer></script>
|
|
37
39
|
<script src="findingsview.js" defer></script>
|
|
38
40
|
<script src="worktreesview.js" defer></script>
|
|
41
|
+
<script src="storageview.js" defer></script>
|
|
39
42
|
<script src="projectsview.js" defer></script>
|
|
40
43
|
<script src="rundelete.js" defer></script>
|
|
41
44
|
<script src="settings.js" defer></script>
|
|
@@ -53,6 +56,7 @@
|
|
|
53
56
|
<a class="top-link" href="#/projects">Projects</a>
|
|
54
57
|
<a class="top-link" href="#/models">Models</a>
|
|
55
58
|
<a class="top-link" href="#/worktrees">Worktrees</a>
|
|
59
|
+
<a class="top-link" href="#/disk">Disk</a>
|
|
56
60
|
<a class="top-link" href="#/settings">Settings</a>
|
|
57
61
|
</nav>
|
|
58
62
|
<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>
|