@giamme/forge 0.16.0 → 0.18.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 +43 -0
- package/SKILL.md +16 -3
- package/VERSION +1 -1
- package/docs/artifacts.md +8 -0
- package/docs/commands.md +70 -6
- package/docs/dataset.md +13 -0
- package/docs/decomposed-runs.md +8 -0
- package/docs/forge-ui.md +23 -2
- package/docs/memory.md +2 -0
- package/docs/reviews.md +15 -1
- package/docs/safety.md +8 -0
- package/forge +24 -1
- package/package.json +1 -1
- package/references/dataset.md +143 -5
- package/references/decision-models.md +15 -2
- package/references/decompose.md +180 -11
- package/references/planning.md +3 -2
- package/references/solo.md +2 -1
- package/references/ui.md +5 -2
- package/scripts/forge-artifact.sh +14 -0
- package/scripts/forge-brief.py +132 -0
- package/scripts/forge-compare.py +11 -1
- package/scripts/forge-config.py +176 -9
- package/scripts/forge-contract.py +98 -4
- package/scripts/forge-control.py +86 -13
- package/scripts/forge-dispatch.sh +14 -10
- package/scripts/forge-du.py +167 -0
- package/scripts/forge-issues.py +4 -3
- package/scripts/forge-ledger.py +3 -1
- package/scripts/forge-lib-adopt.sh +8 -1
- package/scripts/forge-lib-plans.sh +5 -2
- package/scripts/forge-lib-review.sh +29 -1
- package/scripts/forge-metrics.sh +29 -3
- package/scripts/forge-parallel-options.sh +4 -0
- package/scripts/forge-parallel.sh +506 -10
- package/scripts/forge-plan-check.py +25 -2
- package/scripts/forge-planner.py +20 -6
- package/scripts/forge-prompt.py +120 -0
- package/scripts/forge-retro.py +115 -0
- package/scripts/forge-runs-compact.py +443 -0
- package/scripts/forge-runs-rm.py +2 -0
- package/scripts/forge-runs.py +18 -3
- package/scripts/forge-schedule.py +279 -4
- package/scripts/forge-shadow.py +35 -10
- package/scripts/forge-solo.sh +2 -0
- package/scripts/forge-summarize.py +698 -0
- package/scripts/forge-sweep.py +25 -10
- package/scripts/forge-ui-options.sh +10 -0
- package/scripts/forge_brief/__init__.py +587 -0
- package/scripts/forge_brief/answers.py +459 -0
- package/scripts/forge_dataset/__init__.py +10 -0
- package/scripts/forge_dataset/cli.py +83 -0
- package/scripts/forge_dataset/export.py +18 -4
- package/scripts/forge_dataset/facts.py +280 -0
- package/scripts/forge_dataset/harvest.py +56 -9
- package/scripts/forge_dataset/history.py +5 -3
- package/scripts/forge_dataset/outcomes.py +206 -58
- package/scripts/forge_dataset/pairs.py +174 -0
- package/scripts/forge_dataset/risk.py +108 -0
- package/scripts/forge_dataset/tiers.py +427 -0
- package/scripts/forge_decide/__init__.py +11 -1
- package/scripts/forge_decide/cli.py +23 -2
- package/scripts/forge_decide/labels.py +30 -6
- package/scripts/forge_decide/replay.py +10 -4
- package/scripts/forge_locations.py +366 -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 +477 -0
- package/scripts/forge_storage.py +515 -0
- package/ui/README.md +68 -8
- package/ui/docs/api.md +217 -20
- package/ui/forge_ui/control.py +92 -11
- package/ui/forge_ui/export.py +31 -5
- package/ui/forge_ui/findings.py +4 -2
- package/ui/forge_ui/links.py +337 -0
- package/ui/forge_ui/models.py +57 -4
- package/ui/forge_ui/projects.py +4 -1
- package/ui/forge_ui/reader.py +732 -34
- package/ui/forge_ui/server.py +8 -0
- package/ui/forge_ui/static/app.js +92 -5
- package/ui/forge_ui/static/briefview.js +302 -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 +7 -3
- package/ui/forge_ui/static/index.html +3 -0
- package/ui/forge_ui/static/panel.js +311 -4
- package/ui/forge_ui/static/runmodel.js +13 -1
- package/ui/forge_ui/static/storageview.js +271 -0
- package/ui/forge_ui/static/style.css +100 -3
- package/ui/forge_ui/static/worktreesview.js +3 -3
- package/ui/forge_ui/storage.py +136 -0
- package/ui/forge_ui/transcripts.py +35 -10
- package/ui/forge_ui/worktrees.py +154 -13
|
@@ -27,6 +27,7 @@
|
|
|
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>
|
|
30
31
|
<script src="panel.js" defer></script>
|
|
31
32
|
<script src="diffview.js" defer></script>
|
|
32
33
|
<script src="convo.js" defer></script>
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
<script src="leaderboard.js" defer></script>
|
|
37
38
|
<script src="findingsview.js" defer></script>
|
|
38
39
|
<script src="worktreesview.js" defer></script>
|
|
40
|
+
<script src="storageview.js" defer></script>
|
|
39
41
|
<script src="projectsview.js" defer></script>
|
|
40
42
|
<script src="rundelete.js" defer></script>
|
|
41
43
|
<script src="settings.js" defer></script>
|
|
@@ -53,6 +55,7 @@
|
|
|
53
55
|
<a class="top-link" href="#/projects">Projects</a>
|
|
54
56
|
<a class="top-link" href="#/models">Models</a>
|
|
55
57
|
<a class="top-link" href="#/worktrees">Worktrees</a>
|
|
58
|
+
<a class="top-link" href="#/disk">Disk</a>
|
|
56
59
|
<a class="top-link" href="#/settings">Settings</a>
|
|
57
60
|
</nav>
|
|
58
61
|
<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>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* forge-ui inspector: what a selected node is, which model owned it, what prompt launched it, how long it
|
|
2
2
|
took and what its reviewer found. Defines window.ForgePanel.render(host, ctx). All API values enter the
|
|
3
3
|
DOM as text. Large texts (prompts, reports) come from the lazy endpoints and are fetched once per node.
|
|
4
|
+
A task opens on its header (title, goal, links, and the prompt, approach and acceptance criteria) and
|
|
5
|
+
its attempt trail, then its summary (#133 B), then its brief questions (#135) when it has them, and the chips and the rest.
|
|
4
6
|
The run's and a task's write controls are controls.js's (ForgeControls); this file only says where they stand. */
|
|
5
7
|
window.ForgePanel = (() => {
|
|
6
8
|
'use strict';
|
|
@@ -12,6 +14,7 @@ window.ForgePanel = (() => {
|
|
|
12
14
|
const STATUSES = new Set(['merged', 'pass', 'running', 'pending', 'fail', 'error', 'infra', 'timeout', 'unknown', 'invalidated', 'blocked',
|
|
13
15
|
'interrupted', 'nochanges', 'conflict', 'accepted', 'none', 'outdated', 'needs_input', 'needs_decision', 'waiting']);
|
|
14
16
|
const cache = new Map(); // path → {data, error, at}
|
|
17
|
+
const shownText = new Map(); // task id → which header text is open (prompt, approach, criteria)
|
|
15
18
|
function el(tag, text, className) {
|
|
16
19
|
const node = document.createElement(tag);
|
|
17
20
|
if (text !== undefined) node.textContent = display(text);
|
|
@@ -336,6 +339,15 @@ window.ForgePanel = (() => {
|
|
|
336
339
|
const line = window.ForgeSettings && window.ForgeSettings.profileRowText && window.ForgeSettings.profileRowText(profile);
|
|
337
340
|
return line || undefined;
|
|
338
341
|
}
|
|
342
|
+
// the Retro section (retro mode only): the report's counts on one line, then the report, collapsed like the other long texts.
|
|
343
|
+
// The report is plain text: forge-ui has no Markdown renderer, and run data never goes in as HTML.
|
|
344
|
+
function retroSection(host, run) {
|
|
345
|
+
const line = RM.retroSummary(run.retro);
|
|
346
|
+
if (!line) return;
|
|
347
|
+
const s = section(host, 'Retro');
|
|
348
|
+
muted(s, line);
|
|
349
|
+
if (run.retro.text != null) details(s, 'Report', run.retro.text, 'run-retro');
|
|
350
|
+
}
|
|
339
351
|
// the run's record: what it was asked, how it was set up, and what verification printed (the header names and counts it)
|
|
340
352
|
function runRecord(host, ctx) {
|
|
341
353
|
const run = ctx.run, solo = run.kind === 'solo';
|
|
@@ -348,6 +360,7 @@ window.ForgePanel = (() => {
|
|
|
348
360
|
['Verification', chip((run.verification && run.verification.status) || run.verification_status)],
|
|
349
361
|
['Command', run.verification && run.verification.command, true]]);
|
|
350
362
|
details(host, 'Request', display(run.request), 'run-request');
|
|
363
|
+
retroSection(host, run);
|
|
351
364
|
if (!solo) details(host, 'Waves', list(run.waves).map((ids, i) => `${i + 1}: ${list(ids).join(', ')}`).join('\n') || '—', 'waves');
|
|
352
365
|
if (run.verification && run.verification.log_tail != null) details(host, 'Verification output', run.verification.log_tail, 'verification-output');
|
|
353
366
|
}
|
|
@@ -431,8 +444,260 @@ window.ForgePanel = (() => {
|
|
|
431
444
|
s.append(ul);
|
|
432
445
|
}
|
|
433
446
|
|
|
447
|
+
// Why an attempt ran, in the words the trail shows. Anything else reads as unrecorded.
|
|
448
|
+
const TRAIL_REASONS = {
|
|
449
|
+
first: 'first attempt', review: 'after review findings', prereview: 'after failing tests before review',
|
|
450
|
+
bounce: 'after unaddressed findings', message: 'after an unfinished message', answer: 'after your answer',
|
|
451
|
+
escalation: 'escalated to a stronger model', manual: 'manual retry', unknown: 'reason not recorded',
|
|
452
|
+
};
|
|
453
|
+
function reasonText(reason) {
|
|
454
|
+
return Object.prototype.hasOwnProperty.call(TRAIL_REASONS, reason) ? TRAIL_REASONS[reason] : TRAIL_REASONS.unknown;
|
|
455
|
+
}
|
|
456
|
+
function findingsText(item) {
|
|
457
|
+
const findings = item && item.findings;
|
|
458
|
+
const has = !!findings && typeof findings === 'object' && !Array.isArray(findings);
|
|
459
|
+
const count = has ? (num(findings.confirmed) === null ? 0 : num(findings.confirmed)) : null;
|
|
460
|
+
const worst = item && item.worst ? String(item.worst) : '';
|
|
461
|
+
if (count === null && !worst) return 'no findings';
|
|
462
|
+
const n = count === null ? 0 : count;
|
|
463
|
+
const noun = n === 1 ? 'finding' : 'findings';
|
|
464
|
+
return worst ? `${n} ${noun} (worst ${worst})` : `${n} ${noun}`;
|
|
465
|
+
}
|
|
466
|
+
// `#2 grok:xhigh · FAIL · 3 findings (worst P1) · after review findings`
|
|
467
|
+
function trailLine(item) {
|
|
468
|
+
const row = item || {};
|
|
469
|
+
const attempt = row.attempt == null || row.attempt === '' ? '—' : row.attempt;
|
|
470
|
+
const dwarf = row.dwarf ? String(row.dwarf) : '—';
|
|
471
|
+
const verdict = row.verdict ? String(row.verdict) : '—';
|
|
472
|
+
return `#${attempt} ${dwarf} · ${verdict} · ${findingsText(row)} · ${reasonText(row.reason)}`;
|
|
473
|
+
}
|
|
474
|
+
// A header link: `#123` or `PR #45` when it has a number, the url itself otherwise.
|
|
475
|
+
// Only an http(s) url is opened; anything else is shown as text.
|
|
476
|
+
function linkModel(link) {
|
|
477
|
+
if (!link || typeof link !== 'object') return { label: 'link', href: null };
|
|
478
|
+
const href = typeof link.url === 'string' && /^https?:\/\//i.test(link.url) ? link.url : null;
|
|
479
|
+
let label = 'link';
|
|
480
|
+
if (link.kind === 'pr' && link.number != null) label = `PR #${link.number}`;
|
|
481
|
+
else if (link.number != null) label = `#${link.number}`;
|
|
482
|
+
else if (href) label = href;
|
|
483
|
+
return { label, href };
|
|
484
|
+
}
|
|
485
|
+
function linkChip(item) {
|
|
486
|
+
const model = linkModel(item);
|
|
487
|
+
if (!model.href) return el('span', model.label, 'task-link-text');
|
|
488
|
+
const a = el('a', model.label, 'chip');
|
|
489
|
+
a.href = model.href; a.target = '_blank'; a.rel = 'noopener noreferrer';
|
|
490
|
+
return a;
|
|
491
|
+
}
|
|
492
|
+
const textMissing = v => v == null || v === '';
|
|
493
|
+
// Prompt and approach come from the lazy task detail once it has landed, and from the task until then.
|
|
494
|
+
// Acceptance criteria is header.criteria, already on the task. A missing text disables its button.
|
|
495
|
+
function knownTexts(task, detail) {
|
|
496
|
+
if (detail && detail.data) {
|
|
497
|
+
const t = detail.data.texts || {};
|
|
498
|
+
return { prompt: t.prompt ?? null, approach: t.approach ?? null, settled: true };
|
|
499
|
+
}
|
|
500
|
+
return { prompt: task.prompt ?? null, approach: task.approach ?? null, settled: false };
|
|
501
|
+
}
|
|
502
|
+
function headerActions(header, texts) {
|
|
503
|
+
const h = header || {}, t = texts || {};
|
|
504
|
+
return [
|
|
505
|
+
{ key: 'prompt', label: 'Prompt', disabled: textMissing(t.prompt), text: t.prompt ?? null },
|
|
506
|
+
{ key: 'approach', label: 'Approach', disabled: textMissing(t.approach), text: t.approach ?? null },
|
|
507
|
+
{ key: 'criteria', label: 'Acceptance criteria', disabled: textMissing(h.criteria), text: h.criteria ?? null },
|
|
508
|
+
];
|
|
509
|
+
}
|
|
510
|
+
function revealBody(key, detail, action) {
|
|
511
|
+
if (key === 'criteria') return action && action.text != null ? String(action.text) : '';
|
|
512
|
+
if (detail && detail.error) {
|
|
513
|
+
const err = detail.error;
|
|
514
|
+
return err.status === 404 ? 'This text is not available from this server.' : `Could not load it: ${err.message || 'error'}`;
|
|
515
|
+
}
|
|
516
|
+
if (!detail || !detail.data) return 'Loading…';
|
|
517
|
+
return action && action.text != null ? String(action.text) : '';
|
|
518
|
+
}
|
|
519
|
+
function taskHeader(host, ctx, task, detail) {
|
|
520
|
+
const header = task.header || {};
|
|
521
|
+
const texts = knownTexts(task, detail);
|
|
522
|
+
const actions = headerActions(header, texts);
|
|
523
|
+
let open = shownText.get(task.id) || null;
|
|
524
|
+
if (open && actions.some(a => a.key === open && a.disabled && texts.settled)) { shownText.delete(task.id); open = null; }
|
|
525
|
+
const box = el('div', undefined, 'task-header');
|
|
526
|
+
const top = el('div', undefined, 'task-header-top');
|
|
527
|
+
top.append(el('h2', header.title || task.title || 'Untitled task'));
|
|
528
|
+
if (header.goal) top.append(el('p', header.goal, 'task-goal'));
|
|
529
|
+
box.append(top);
|
|
530
|
+
const links = list(header.links);
|
|
531
|
+
if (links.length) {
|
|
532
|
+
const row = el('div', undefined, 'chips task-links');
|
|
533
|
+
for (const item of links) row.append(linkChip(item));
|
|
534
|
+
box.append(row);
|
|
535
|
+
}
|
|
536
|
+
const bank = el('div', undefined, 'seg task-texts');
|
|
537
|
+
bank.setAttribute('role', 'group'); bank.setAttribute('aria-label', 'Task text');
|
|
538
|
+
for (const action of actions) {
|
|
539
|
+
const button = el('button', action.label);
|
|
540
|
+
button.type = 'button'; button.dataset.text = action.key; button.disabled = action.disabled;
|
|
541
|
+
button.setAttribute('aria-pressed', open === action.key ? 'true' : 'false');
|
|
542
|
+
button.addEventListener('click', () => {
|
|
543
|
+
shownText.set(task.id, shownText.get(task.id) === action.key ? null : action.key);
|
|
544
|
+
ctx.rerender();
|
|
545
|
+
});
|
|
546
|
+
bank.append(button);
|
|
547
|
+
}
|
|
548
|
+
box.append(bank);
|
|
549
|
+
if (open) {
|
|
550
|
+
const action = actions.find(a => a.key === open);
|
|
551
|
+
const pre = el('pre', revealBody(open, detail, action), 'task-reveal');
|
|
552
|
+
pre.dataset.scroll = `task-${task.id}-header-text`;
|
|
553
|
+
box.append(pre);
|
|
554
|
+
}
|
|
555
|
+
host.append(box);
|
|
556
|
+
}
|
|
557
|
+
// The links to an attempt's executions, one per execution, labelled by role. The trail and a summary's sources share them.
|
|
558
|
+
function executionLinks(ctx, task, ids) {
|
|
559
|
+
const nav = el('span', undefined, 'trail-nav');
|
|
560
|
+
for (const id of list(ids)) {
|
|
561
|
+
const role = String(id).split('-')[0].toLowerCase();
|
|
562
|
+
const target = { kind: 'execution', task: task.id, id: task.id, exec: id, shadow: false };
|
|
563
|
+
nav.append(link(role, ctx.hash(target), () => ctx.onSelect(target)));
|
|
564
|
+
}
|
|
565
|
+
return nav;
|
|
566
|
+
}
|
|
567
|
+
// One line per attempt. Its executions open the same way the Attempts section opens them.
|
|
568
|
+
function attemptTrail(host, ctx, task) {
|
|
569
|
+
const items = list(task.trail);
|
|
570
|
+
if (!items.length) return;
|
|
571
|
+
const ol = el('ol', undefined, 'attempt-trail');
|
|
572
|
+
for (const item of items) {
|
|
573
|
+
const li = el('li', undefined, 'trail-line');
|
|
574
|
+
li.append(el('span', trailLine(item), 'trail-summary'));
|
|
575
|
+
const nav = executionLinks(ctx, task, item && item.executions);
|
|
576
|
+
if (nav.childElementCount) li.append(nav);
|
|
577
|
+
ol.append(li);
|
|
578
|
+
}
|
|
579
|
+
host.append(ol);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/* ---------- summaries (#133 B): a task's generated summary, and the switches that turn summaries on or off ---------- */
|
|
583
|
+
// A switch's question, answer and request body are controls.js's (prepare, savedText); the confirm strip and the POST
|
|
584
|
+
// are uikit's. An answer stays on the page for a few seconds, so a poll that draws the section again keeps it in view.
|
|
585
|
+
const ANSWER_MS = 9000;
|
|
586
|
+
const answers = new Map(); // a section's hold key → {res, text, at}
|
|
587
|
+
const ago = (at, now) => window.ForgeControls ? window.ForgeControls.agoText(at, now) : time(at);
|
|
588
|
+
const findingsId = taskId => `task-${taskId}-findings`;
|
|
589
|
+
// A bank of push keys: the value in force is pressed, and pressing the pressed key does nothing.
|
|
590
|
+
function summaryBank(options, current, pick, label) {
|
|
591
|
+
const seg = el('div', undefined, 'seg sum-bank');
|
|
592
|
+
seg.setAttribute('role', 'group'); seg.setAttribute('aria-label', label);
|
|
593
|
+
for (const [value, text] of options) {
|
|
594
|
+
const b = el('button', text); b.type = 'button'; b.dataset.value = value;
|
|
595
|
+
b.setAttribute('aria-pressed', String(value === current));
|
|
596
|
+
b.addEventListener('click', () => { if (b.getAttribute('aria-pressed') !== 'true') pick(value); });
|
|
597
|
+
seg.append(b);
|
|
598
|
+
}
|
|
599
|
+
return seg;
|
|
600
|
+
}
|
|
601
|
+
// Asks, sends and answers one change to a summaries switch (`forge control set summaries`). `slot` takes the question
|
|
602
|
+
// and the answer. `held` is the section that holds a task's switch (null for the run's): it is kept as it is while the
|
|
603
|
+
// question is open or the answer pends, the way controls.js keeps its own sections.
|
|
604
|
+
function changeSummaries(slot, held, runKey, change, done) {
|
|
605
|
+
const C = window.ForgeControls, U = window.ForgeUI, node = held || slot;
|
|
606
|
+
const plan = C.prepare({ kind: 'set', key: 'summaries', input: change.input, task: change.task });
|
|
607
|
+
if (!plan.ok) { U.outcome(slot, { ok: false, status: 400, error: 'invalid', detail: plan.error }); return; }
|
|
608
|
+
if (node.dataset.busy) return;
|
|
609
|
+
node.dataset.editing = '1';
|
|
610
|
+
U.confirmInline(slot, plan.confirm).then(async yes => {
|
|
611
|
+
if (!yes) { if (!slot.querySelector('.ui-confirm')) delete node.dataset.editing; return; } // a newer question took the strip
|
|
612
|
+
node.dataset.busy = '1';
|
|
613
|
+
if (held) held.setAttribute('aria-busy', 'true');
|
|
614
|
+
const res = await U.post(`/api/runs/${encodeURIComponent(runKey)}/controls`, plan.body);
|
|
615
|
+
delete node.dataset.busy; delete node.dataset.editing;
|
|
616
|
+
if (held) held.removeAttribute('aria-busy');
|
|
617
|
+
const text = C.savedText(res.data);
|
|
618
|
+
if (held) answers.set(held.dataset.hold, { res, text, at: Date.now() });
|
|
619
|
+
U.outcome(slot, res, text);
|
|
620
|
+
if (done) done(res);
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
// The summary's text as plain text, its model and when it was made, whether the task changed since, the error of a
|
|
624
|
+
// failed try, and where it came from.
|
|
625
|
+
function summaryText(s, ctx, task, sum) {
|
|
626
|
+
s.append(el('p', sum.text, 'sum-text'));
|
|
627
|
+
const by = el('p', undefined, 'muted sum-by');
|
|
628
|
+
by.title = time(sum.generated_at);
|
|
629
|
+
by.append(document.createTextNode('Generated by '), sum.model ? plate(sum.model) : el('span', 'an unrecorded model'),
|
|
630
|
+
document.createTextNode(`, ${ago(sum.generated_at, ctx.now)}`));
|
|
631
|
+
if (sum.stale) by.append(document.createTextNode(' '), chip('Out of date', 'outdated'));
|
|
632
|
+
s.append(by);
|
|
633
|
+
if (sum.error) s.append(el('p', `The last try failed: ${String(sum.error).trim()}`, 'warn sum-error'));
|
|
634
|
+
if (list(sum.sources).length) s.append(sourceList(ctx, task, sum.sources));
|
|
635
|
+
}
|
|
636
|
+
// Where a summary came from: an attempt's executions, as the trail links them; a finding, linked to the review findings
|
|
637
|
+
// section. A source the task no longer has is named, not linked.
|
|
638
|
+
function sourceList(ctx, task, sources) {
|
|
639
|
+
const ul = el('ul', undefined, 'sum-sources');
|
|
640
|
+
for (const src of sources) {
|
|
641
|
+
const li = el('li'), ref = String(src.ref || '');
|
|
642
|
+
if (src.kind === 'attempt') {
|
|
643
|
+
li.append(el('span', `attempt ${ref}`));
|
|
644
|
+
const item = list(task.trail).find(t => t && String(t.attempt) === ref);
|
|
645
|
+
const nav = executionLinks(ctx, task, item && item.executions);
|
|
646
|
+
if (nav.childElementCount) li.append(nav);
|
|
647
|
+
} else {
|
|
648
|
+
const cut = ref.indexOf(':'), attempt = cut > 0 ? ref.slice(0, cut) : null, title = cut > 0 ? ref.slice(cut + 1) : ref;
|
|
649
|
+
const a = el('a', title || 'finding'); a.href = '#' + findingsId(task.id);
|
|
650
|
+
a.addEventListener('click', e => {
|
|
651
|
+
e.preventDefault();
|
|
652
|
+
const node = document.getElementById(findingsId(task.id));
|
|
653
|
+
if (node) node.scrollIntoView({ block: 'nearest' });
|
|
654
|
+
});
|
|
655
|
+
li.append(el('span', 'finding: ', 'muted'), a);
|
|
656
|
+
if (attempt) li.append(el('span', `attempt ${attempt}`, 'muted'));
|
|
657
|
+
}
|
|
658
|
+
ul.append(li);
|
|
659
|
+
}
|
|
660
|
+
return ul;
|
|
661
|
+
}
|
|
662
|
+
// The task's own switch: inherit the run's, or on or off for this task (`forge control set summaries --task`).
|
|
663
|
+
function summaryOverride(s, ctx, task) {
|
|
664
|
+
const key = s.dataset.hold, run = ctx.run, own = task.summaries_override;
|
|
665
|
+
const current = own === 'on' || own === 'off' ? own : 'inherit';
|
|
666
|
+
const runOn = !!run.summaries && run.summaries.mode === 'on';
|
|
667
|
+
// A data-row inside the section's data-hold: controls.js's hold() puts the keyboard back on this key after a redraw.
|
|
668
|
+
const row = el('div', undefined, 'sum-switch'), msgs = el('div', undefined, 'sum-msgs');
|
|
669
|
+
row.dataset.row = 'summary-override';
|
|
670
|
+
const pick = value => changeSummaries(msgs, s, run.key, { input: value, task: task.id }, () => ctx.refresh && ctx.refresh());
|
|
671
|
+
const bank = summaryBank([['inherit', 'Inherit'], ['on', 'On'], ['off', 'Off']], current, pick, 'Summaries for this task');
|
|
672
|
+
row.append(el('p', 'Summaries for this task', 'sum-label'), bank,
|
|
673
|
+
el('p', current === 'inherit' ? `Follows the run: ${runOn ? 'on' : 'off'}.` : `${current === 'on' ? 'On' : 'Off'} for this task, whatever the run sets.`, 'muted sum-note'),
|
|
674
|
+
msgs);
|
|
675
|
+
const answer = answers.get(key);
|
|
676
|
+
if (answer && Date.now() - answer.at < ANSWER_MS && window.ForgeUI) window.ForgeUI.outcome(msgs, answer.res, answer.text, { silent: true });
|
|
677
|
+
return row;
|
|
678
|
+
}
|
|
679
|
+
// The task's summary, after its attempt trail: its text, what it came from, and the switch where this page can change
|
|
680
|
+
// the run. A solo run has none. A task with no summary shows only its switch; where the page cannot write, nothing.
|
|
681
|
+
function summarySection(host, ctx, task) {
|
|
682
|
+
const run = ctx.run, sum = task.summary || null, U = window.ForgeUI;
|
|
683
|
+
if (run.kind === 'solo') return;
|
|
684
|
+
const s = section(host, 'Summary');
|
|
685
|
+
s.classList.add('sum-section');
|
|
686
|
+
s.dataset.hold = `summary:${run.key}:${task.id}`;
|
|
687
|
+
if (sum) summaryText(s, ctx, task, sum); else muted(s, 'No summary yet.');
|
|
688
|
+
const row = summaryOverride(s, ctx, task);
|
|
689
|
+
s.append(row);
|
|
690
|
+
const writable = U && U.controlsEnabled && window.ForgeControls ? U.controlsEnabled() : Promise.resolve(false);
|
|
691
|
+
writable.then(on => { if (!on) { row.remove(); if (!sum) s.remove(); } });
|
|
692
|
+
}
|
|
693
|
+
|
|
434
694
|
function taskView(host, ctx, task) {
|
|
435
695
|
const run = ctx.run, now = ctx.now, solo = run.kind === 'solo';
|
|
696
|
+
const detail = lazy(ctx, `/api/runs/${encodeURIComponent(run.key)}/tasks/${encodeURIComponent(task.id)}`, run.updated);
|
|
697
|
+
taskHeader(host, ctx, task, detail);
|
|
698
|
+
attemptTrail(host, ctx, task);
|
|
699
|
+
summarySection(host, ctx, task);
|
|
700
|
+
if (window.ForgeBrief) window.ForgeBrief.taskSection(host, ctx, task);
|
|
436
701
|
const head = el('div', undefined, 'insp-head');
|
|
437
702
|
head.append(el('h2', solo ? (task.title || 'Solo run') : `${task.id} · ${task.title || 'Untitled task'}`), el('div', solo ? 'solo task' : `task · wave ${display(task.wave)}`, 'insp-kind'));
|
|
438
703
|
const chips = el('div', undefined, 'chips');
|
|
@@ -521,11 +786,11 @@ window.ForgePanel = (() => {
|
|
|
521
786
|
|
|
522
787
|
// reviews and their findings
|
|
523
788
|
const rs = section(host, 'Review findings');
|
|
789
|
+
rs.id = findingsId(task.id); // a summary's finding links here
|
|
524
790
|
gateLine(rs, task.gate);
|
|
525
791
|
findingCounts(rs, task.findings);
|
|
526
792
|
failFirst(rs, task.fail_first);
|
|
527
793
|
preReview(rs, task.pre_review);
|
|
528
|
-
const detail = lazy(ctx, `/api/runs/${encodeURIComponent(run.key)}/tasks/${encodeURIComponent(task.id)}`, run.updated);
|
|
529
794
|
if (!loading(rs, detail, 'the full findings')) {
|
|
530
795
|
const reviews = list(detail.data.reviews);
|
|
531
796
|
if (!reviews.length) muted(rs, 'No review has run yet.');
|
|
@@ -679,7 +944,8 @@ window.ForgePanel = (() => {
|
|
|
679
944
|
}
|
|
680
945
|
|
|
681
946
|
// Commits made outside forge that `adopt` brought in, each reviewed alone: a person's work, so no task row claims them.
|
|
682
|
-
|
|
947
|
+
// Each opens its review, its findings and the range's diff (#131).
|
|
948
|
+
function adoptionsList(host, run, ctx) {
|
|
683
949
|
const rows = list(run.adoptions);
|
|
684
950
|
if (!rows.length) return;
|
|
685
951
|
const s = section(host, `Adopted commits (${rows.length})`);
|
|
@@ -689,18 +955,57 @@ window.ForgePanel = (() => {
|
|
|
689
955
|
li.append(el('code', `${String(a.base).slice(0, 12)}..${String(a.tip).slice(0, 12)}`, 'mono'), document.createTextNode(' '),
|
|
690
956
|
chip(a.verdict, failed ? 'fail' : 'pass'));
|
|
691
957
|
if (a.approved) li.append(el('span', 'approved over the review', 'tag'));
|
|
958
|
+
if (a.findings && a.findings.worst) li.append(document.createTextNode(' '), sevChip(`${a.findings.worst}×${a.findings[a.findings.worst]}`, a.findings.worst));
|
|
692
959
|
if (a.reason) li.append(el('p', a.reason, 'muted'));
|
|
960
|
+
if (ctx && a.findings !== undefined && (a.findings !== null || a.diff)) {
|
|
961
|
+
const links = el('p', undefined, 'adoption-links'), sel = { kind: 'adoption', name: a.review };
|
|
962
|
+
links.append(link('Its review and findings →', ctx.hash(sel), () => ctx.onSelect(sel)));
|
|
963
|
+
const d = a.diff && diffLink(ctx, 'The range, findings pinned →', { kind: 'adoption', name: a.review });
|
|
964
|
+
if (d) links.append(document.createTextNode(' '), d);
|
|
965
|
+
li.append(links);
|
|
966
|
+
}
|
|
693
967
|
ul.append(li);
|
|
694
968
|
}
|
|
695
969
|
s.append(ul);
|
|
696
970
|
}
|
|
697
971
|
|
|
972
|
+
function adoptionView(host, ctx, sel) {
|
|
973
|
+
const run = ctx.run, a = list(run.adoptions).find(x => x.review === sel.name);
|
|
974
|
+
const head = el('div', undefined, 'insp-head');
|
|
975
|
+
head.append(el('h2', 'Adopted range'), el('div', 'finish · made outside forge, reviewed alone', 'insp-kind'));
|
|
976
|
+
host.append(head);
|
|
977
|
+
const back = { kind: 'final' };
|
|
978
|
+
if (!a) { muted(host, `This run adopted nothing under ${sel.name}.`); host.append(link('← Final review', ctx.hash(back), () => ctx.onSelect(back))); return; }
|
|
979
|
+
const chips = el('div', undefined, 'chips');
|
|
980
|
+
chips.append(chip(a.verdict, String(a.verdict).toUpperCase() === 'PASS' ? 'pass' : 'fail'));
|
|
981
|
+
if (a.approved) chips.append(el('span', 'approved over the review', 'tag'));
|
|
982
|
+
head.append(chips);
|
|
983
|
+
if (a.reason) host.append(el('p', a.reason));
|
|
984
|
+
fields(host, [['Reviewer', plate(a.spec)], ['Range', `${String(a.base).slice(0, 12)}..${String(a.tip).slice(0, 12)}`, true], ['Adopted', time(a.at)]]);
|
|
985
|
+
const d0 = a.diff && diffLink(ctx, 'The range, findings pinned →', { kind: 'adoption', name: a.review });
|
|
986
|
+
if (d0) host.append(d0);
|
|
987
|
+
const fs = section(host, 'Findings');
|
|
988
|
+
findingCounts(fs, a.findings);
|
|
989
|
+
const entry = lazy(ctx, `/api/runs/${encodeURIComponent(run.key)}/adoptions/${encodeURIComponent(a.review)}`, 'adoption:' + a.review);
|
|
990
|
+
if (!loading(fs, entry, 'the review')) {
|
|
991
|
+
const d = entry.data;
|
|
992
|
+
gateLine(fs, d.gate);
|
|
993
|
+
testsLine(fs, d.tests);
|
|
994
|
+
findingsList(fs, d.findings, `adoption-${a.review}`);
|
|
995
|
+
const ps = section(host, 'Report and prompt');
|
|
996
|
+
if (d.known_issues) details(ps, a.approved ? 'Findings kept (known_issues.md)' : 'Known issues', d.known_issues, `adoption-${a.review}-known`);
|
|
997
|
+
details(ps, 'Reviewer report (qa.last)', d.qa_last, `adoption-${a.review}-last`);
|
|
998
|
+
details(ps, 'Prompt (qa.input)', d.qa_input, `adoption-${a.review}-input`);
|
|
999
|
+
}
|
|
1000
|
+
host.append(el('p'), link('← Final review', ctx.hash(back), () => ctx.onSelect(back)));
|
|
1001
|
+
}
|
|
1002
|
+
|
|
698
1003
|
function finalView(host, ctx, sel) {
|
|
699
1004
|
const run = ctx.run, reviews = list(run.final_reviews);
|
|
700
1005
|
const head = el('div', undefined, 'insp-head');
|
|
701
1006
|
head.append(el('h2', 'Final review'), el('div', 'finish · whole-run review', 'insp-kind'));
|
|
702
1007
|
host.append(head);
|
|
703
|
-
adoptionsList(host, run);
|
|
1008
|
+
adoptionsList(host, run, ctx);
|
|
704
1009
|
const pick = sel.name ? reviews.find(r => r.name === sel.name) : reviews[0];
|
|
705
1010
|
if (!pick) {
|
|
706
1011
|
head.append(chip(run.settings && run.settings.final_qa ? 'pending' : 'not requested', 'none'));
|
|
@@ -812,10 +1117,12 @@ window.ForgePanel = (() => {
|
|
|
812
1117
|
}
|
|
813
1118
|
if (sel.kind === 'execution') return execView(host, ctx, task, sel);
|
|
814
1119
|
if (sel.kind === 'final') return finalView(host, ctx, sel);
|
|
1120
|
+
if (sel.kind === 'adoption') return adoptionView(host, ctx, sel);
|
|
815
1121
|
if (sel.kind === 'verification') return verificationView(host, ctx);
|
|
816
1122
|
if (sel.kind === 'integration') return integrationView(host, ctx);
|
|
817
1123
|
if (sel.kind === 'fractal') return fractalNodeView(host, ctx, sel);
|
|
818
1124
|
return runView(host, ctx);
|
|
819
1125
|
}
|
|
820
|
-
return { render, cache };
|
|
1126
|
+
return { render, cache, trailLine, reasonText, linkModel, headerActions, summaryBank, changeSummaries };
|
|
821
1127
|
})();
|
|
1128
|
+
if (typeof module === 'object' && module.exports) module.exports = window.ForgePanel;
|
|
@@ -914,6 +914,18 @@
|
|
|
914
914
|
return s ? { lamp: s[0], text: s[1] } : { lamp: 'pending', text: 'its fix task has not merged' };
|
|
915
915
|
}
|
|
916
916
|
|
|
917
|
+
/* ---------- the retro report (retro.md, retro/notes.jsonl) ---------- */
|
|
918
|
+
// RunDetail.retro → the Retro section's one line, e.g. "5 notes: 3 you can fix, 2 for forge · 4 verified, 1 claimed · 1 blocking".
|
|
919
|
+
// Unsure notes are named only when there are some. Null when the run has no retro record.
|
|
920
|
+
function retroSummary(retro) {
|
|
921
|
+
if (!retro || typeof retro !== 'object') return null;
|
|
922
|
+
const n = key => num(retro[key]) || 0, word = (count, one, many) => `${count} ${count === 1 ? one : many}`;
|
|
923
|
+
if (!n('notes')) return '0 notes';
|
|
924
|
+
const fixable = [`${n('user')} you can fix`, `${n('forge')} for forge`];
|
|
925
|
+
if (n('unsure')) fixable.push(`${n('unsure')} not sure who`);
|
|
926
|
+
return `${word(n('notes'), 'note', 'notes')}: ${fixable.join(', ')} · ${n('verified')} verified, ${n('claimed')} claimed · ${n('blocking')} blocking`;
|
|
927
|
+
}
|
|
928
|
+
|
|
917
929
|
/* ---------- Fractal: a task's child tasks as a tidy tree (depth across, siblings down) ---------- */
|
|
918
930
|
// nodes: TaskFractal.nodes (tree order, parent ids); returns {pos: {id: {col, row, depth}}, edges: [[parent, child]], cols, rows}
|
|
919
931
|
function fractalTree(nodes) {
|
|
@@ -942,5 +954,5 @@
|
|
|
942
954
|
finalStatus, runReviewStatus, reviewSinceLine, reviewAt, taskStatus, statusText, causeLabel, resetText, taskVerdict, attemptStatus, attemptNote, attemptFailed, isWaiting,
|
|
943
955
|
attributionLine, taskParts,
|
|
944
956
|
taskTimes, metricValue, overlap, projectSchedule, execModel, verifyLeds, criticalPath, concurrency, stateAt, timeRange, events, lineage, structureKey, innerKey,
|
|
945
|
-
fmtDur, alias, basename, weight, searchIndex, searchRank, statusEvents, fractalTree, sweepLine, sweepState };
|
|
957
|
+
fmtDur, alias, basename, weight, searchIndex, searchRank, statusEvents, fractalTree, sweepLine, sweepState, retroSummary };
|
|
946
958
|
});
|