@giamme/forge 0.21.0 → 0.23.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 +81 -0
- package/README.md +25 -15
- package/SKILL.md +137 -216
- package/VERSION +1 -1
- package/bin/forge.js +104 -0
- package/docs/README.md +2 -3
- package/docs/add-ons.md +5 -3
- package/docs/artifacts.md +17 -2
- package/docs/commands.md +85 -63
- package/docs/decomposed-runs.md +195 -21
- package/docs/development.md +12 -10
- package/docs/forge-ui.md +33 -4
- package/docs/install.md +127 -6
- package/docs/memory.md +6 -1
- package/docs/models.md +36 -10
- package/docs/reviews.md +50 -29
- package/docs/safety.md +27 -2
- package/docs/troubleshooting.md +8 -11
- package/forge +29 -4
- package/forge.cmd +56 -0
- package/package.json +6 -3
- package/references/dataset.md +10 -9
- package/references/decompose-integration.md +337 -0
- package/references/decompose-opt-in.md +527 -0
- package/references/decompose-recovery.md +569 -0
- package/references/decompose-review.md +256 -0
- package/references/decompose.md +99 -1606
- package/references/findings.md +68 -0
- package/references/harnesses.md +7 -12
- package/references/memory.md +13 -2
- package/references/planning.md +48 -18
- package/references/ripwire.md +38 -13
- package/references/runtime.md +22 -33
- package/references/setup.md +90 -0
- package/references/solo.md +13 -42
- package/references/ui.md +12 -5
- package/registry.tsv +40 -22
- package/scripts/forge-artifact.sh +148 -13
- package/scripts/forge-compare.py +5 -15
- package/scripts/forge-config.py +14 -1
- package/scripts/forge-contract.py +216 -53
- package/scripts/forge-control.py +781 -51
- package/scripts/forge-dispatch.sh +202 -42
- package/scripts/forge-du.py +13 -3
- package/scripts/forge-guard.py +137 -6
- package/scripts/forge-handoff.py +221 -39
- package/scripts/forge-install-ripwire.sh +100 -24
- package/scripts/forge-install.sh +100 -41
- package/scripts/forge-issues.py +6 -4
- package/scripts/forge-jev-options.sh +3 -5
- package/scripts/forge-lib-adopt.sh +169 -5
- package/scripts/forge-lib-attribute.sh +10 -3
- package/scripts/forge-lib-decompose.sh +454 -0
- package/scripts/forge-lib-env.sh +179 -0
- package/scripts/forge-lib-group.sh +9 -6
- package/scripts/forge-lib-plans.sh +38 -21
- package/scripts/forge-lib-review.sh +28 -8
- package/scripts/forge-lib-task.sh +263 -69
- package/scripts/forge-lib-verify.sh +59 -10
- package/scripts/forge-memory.sh +83 -4
- package/scripts/forge-metrics.sh +10 -3
- package/scripts/forge-parallel-options.sh +23 -4
- package/scripts/forge-parallel.sh +602 -217
- package/scripts/forge-plan-check.py +71 -8
- package/scripts/forge-planner.py +303 -17
- package/scripts/forge-pr.py +9 -1
- package/scripts/forge-prompt.py +2 -2
- package/scripts/forge-review-links.py +248 -0
- package/scripts/forge-ripwire.py +234 -16
- package/scripts/forge-route.py +19 -27
- package/scripts/forge-runs-rm.py +92 -21
- package/scripts/forge-runs.py +46 -5
- package/scripts/forge-runtime.py +39 -14
- package/scripts/forge-schedule.py +141 -33
- package/scripts/forge-setup-stale.py +236 -0
- package/scripts/forge-setup.py +804 -0
- package/scripts/forge-shadow.py +2 -20
- package/scripts/forge-solo-lock.py +46 -0
- package/scripts/forge-solo.sh +39 -58
- package/scripts/forge-sweep.py +3 -2
- package/scripts/forge-ui.py +8 -1
- package/scripts/forge-update.sh +8 -3
- package/scripts/forge-verify.py +17 -1
- package/scripts/forge-version.py +13 -1
- package/scripts/forge-watch.py +7 -2
- package/scripts/forge-win.sh +156 -0
- package/scripts/forge_brief/__init__.py +6 -1
- package/scripts/forge_brief/proposals.py +6 -1
- package/scripts/forge_dataset/__init__.py +1 -1
- package/scripts/forge_dataset/capture.py +0 -34
- package/scripts/forge_dataset/checks.py +0 -1
- package/scripts/forge_dataset/cli.py +5 -1
- package/scripts/forge_dataset/export.py +28 -6
- package/scripts/forge_dataset/facts.py +1 -2
- package/scripts/forge_dataset/forecast.py +1 -1
- package/scripts/forge_dataset/harvest.py +107 -7
- package/scripts/forge_dataset/importer.py +3 -2
- package/scripts/forge_dataset/pairs.py +3 -3
- package/scripts/forge_dataset/reviewers.py +4 -3
- package/scripts/forge_dataset/routing.py +6 -3
- package/scripts/forge_dataset/tiers.py +1 -1
- package/scripts/forge_decide/__init__.py +1 -1
- package/scripts/forge_decide/budget.py +12 -7
- package/scripts/forge_decide/profiles.py +11 -14
- package/scripts/forge_decide/replay.py +9 -4
- package/scripts/forge_decompose.py +987 -0
- package/scripts/forge_flock.py +17 -2
- package/scripts/forge_groups/review.py +6 -1
- package/scripts/forge_jev/__init__.py +1 -1
- package/scripts/forge_jev/cli.py +10 -1
- package/scripts/forge_jev/gates.py +10 -1
- package/scripts/forge_jev/verify.py +10 -2
- package/scripts/forge_legacy.py +86 -0
- package/scripts/forge_memory_home.py +57 -0
- package/scripts/forge_models.py +151 -0
- package/scripts/forge_posix.py +17 -0
- package/scripts/forge_prefs.py +138 -0
- package/scripts/forge_proc.py +108 -0
- package/scripts/forge_registry.py +2 -2
- package/scripts/forge_side/__init__.py +23 -4
- package/scripts/forge_storage.py +28 -15
- package/ui/README.md +22 -10
- package/ui/docs/api.md +121 -99
- package/ui/forge_ui/control.py +53 -16
- package/ui/forge_ui/export.py +0 -10
- package/ui/forge_ui/models.py +15 -2
- package/ui/forge_ui/projects.py +4 -1
- package/ui/forge_ui/reader.py +462 -60
- package/ui/forge_ui/server.py +0 -10
- package/ui/forge_ui/static/app.js +28 -9
- package/ui/forge_ui/static/checksview.js +12 -3
- package/ui/forge_ui/static/controls.js +147 -11
- package/ui/forge_ui/static/convo.js +5 -2
- package/ui/forge_ui/static/diffview.js +4 -5
- package/ui/forge_ui/static/panel.js +180 -77
- package/ui/forge_ui/static/projectsview.js +16 -2
- package/ui/forge_ui/static/runmodel.js +18 -4
- package/ui/forge_ui/static/scene3d.js +52 -31
- package/ui/forge_ui/static/settings.js +1 -1
- package/ui/forge_ui/static/storageview.js +2 -2
- package/ui/forge_ui/static/style.css +23 -6
- package/ui/forge_ui/static/worktreesview.js +8 -4
- package/ui/forge_ui/transcripts.py +6 -0
- package/ui/forge_ui/worktrees.py +13 -1
- package/docs/fractal.md +0 -181
- package/references/fractal-dashboard.md +0 -21
- package/references/fractal.md +0 -307
- package/scripts/forge-fractal-dispatch.sh +0 -4
- package/scripts/forge-fractal-options.sh +0 -54
- package/scripts/forge-fractal.py +0 -6
- package/scripts/forge-install-fractal.sh +0 -4
- package/scripts/forge_fractal/__init__.py +0 -88
- package/scripts/forge_fractal/bridge.py +0 -46
- package/scripts/forge_fractal/cli.py +0 -224
- package/scripts/forge_fractal/dashboard.css +0 -138
- package/scripts/forge_fractal/dashboard.html +0 -41
- package/scripts/forge_fractal/dashboard.js +0 -687
- package/scripts/forge_fractal/decomposition.py +0 -262
- package/scripts/forge_fractal/execution.py +0 -659
- package/scripts/forge_fractal/inspection.py +0 -261
- package/scripts/forge_fractal/install.py +0 -158
- package/scripts/forge_fractal/invocation.py +0 -95
- package/scripts/forge_fractal/pipeline.py +0 -125
- package/scripts/forge_fractal/selection.py +0 -180
- package/ui/forge_ui/fractal.py +0 -582
|
@@ -85,6 +85,7 @@ window.ForgePanel = (() => {
|
|
|
85
85
|
// the write controls of a plan run (task undefined) or of one of its tasks; a page without controls.js says it is read-only
|
|
86
86
|
function controlsSection(host, ctx, task) {
|
|
87
87
|
if (ctx.run.kind === 'solo') return;
|
|
88
|
+
if (ctx.run.removed) { muted(section(host, 'Controls'), `Read-only: this run was made with ${ctx.run.removed.name}, which forge ${ctx.run.removed.since} removed.`); return; }
|
|
88
89
|
if (window.ForgeControls && window.ForgeUI && window.ForgeUI.confirmInline) { window.ForgeControls[task ? 'mountTask' : 'mountRun'](host, ctx, task); return; }
|
|
89
90
|
const s = section(host, 'Controls');
|
|
90
91
|
muted(s, 'Read-only: this page cannot change the run.');
|
|
@@ -255,13 +256,14 @@ window.ForgePanel = (() => {
|
|
|
255
256
|
wrap.append(table);
|
|
256
257
|
parent.append(wrap);
|
|
257
258
|
}
|
|
258
|
-
// What a reviewer said about its own tests (FORGE_TESTS).
|
|
259
|
-
// rests on reading alone. A reply that says nothing shows nothing.
|
|
260
|
-
const TESTS_WORDS = { ran: 'Reviewer ran tests', not_needed: 'Reviewer needed no tests', could_not_run: 'Reviewer could not run tests', unclear: 'Reviewer\'s word on its tests is unclear' };
|
|
259
|
+
// What a reviewer said about its own tests (FORGE_TESTS). Reviews that could not run them or only finished partly stand out:
|
|
260
|
+
// their verdict rests on reading or partial checks alone. A reply that says nothing shows nothing.
|
|
261
|
+
const TESTS_WORDS = { ran: 'Reviewer ran tests', partial: 'Reviewer stopped or skipped some tests', not_needed: 'Reviewer needed no tests', could_not_run: 'Reviewer could not run tests', unclear: 'Reviewer\'s word on its tests is unclear' };
|
|
261
262
|
function testsLine(parent, tests) {
|
|
262
263
|
if (!tests || !TESTS_WORDS[tests.status]) return;
|
|
263
264
|
const text = TESTS_WORDS[tests.status] + (tests.reason ? `: ${tests.reason}` : '');
|
|
264
|
-
|
|
265
|
+
const warn = tests.status === 'could_not_run' || tests.status === 'partial';
|
|
266
|
+
parent.append(el('p', text, warn ? 'warn tests-line' : 'muted tests-line'));
|
|
265
267
|
}
|
|
266
268
|
// An attempt's chip. A failed attempt is red whatever its words; a send-back says what forge did in its title.
|
|
267
269
|
function attemptChip(word) {
|
|
@@ -437,6 +439,25 @@ window.ForgePanel = (() => {
|
|
|
437
439
|
muted(s, line);
|
|
438
440
|
if (run.retro.text != null) details(s, 'Report', run.retro.text, 'run-retro');
|
|
439
441
|
}
|
|
442
|
+
// the Handoff section (forge handoff): which session drives the run, then the notes sessions left, newest first.
|
|
443
|
+
// Notes are plain text, like the retro report.
|
|
444
|
+
function handoffSection(host, run) {
|
|
445
|
+
const h = run.handoff;
|
|
446
|
+
if (!h || typeof h !== 'object') return;
|
|
447
|
+
const s = section(host, 'Handoff');
|
|
448
|
+
muted(s, 'Driver: ' + (RM.handoffDriverLine(h.driver) || 'none recorded'));
|
|
449
|
+
const notes = list(h.notes);
|
|
450
|
+
if (!notes.length) return;
|
|
451
|
+
const ul = el('ul', undefined, 'handoff-notes');
|
|
452
|
+
for (const n of notes) {
|
|
453
|
+
const li = el('li');
|
|
454
|
+
li.append(el('span', time(n.at) + (n.actor ? ' · ' + n.actor : ''), 'muted'), el('div', n.text));
|
|
455
|
+
ul.append(li);
|
|
456
|
+
}
|
|
457
|
+
s.append(ul);
|
|
458
|
+
const total = num(h.notes_total);
|
|
459
|
+
if (total !== null && total > notes.length) muted(s, `${total - notes.length} older notes in handoff.notes.jsonl`);
|
|
460
|
+
}
|
|
440
461
|
// the run's record: what it was asked, how it was set up, and what verification printed (the header names and counts it)
|
|
441
462
|
function runRecord(host, ctx) {
|
|
442
463
|
const run = ctx.run, solo = run.kind === 'solo';
|
|
@@ -450,6 +471,7 @@ window.ForgePanel = (() => {
|
|
|
450
471
|
['Command', run.verification && run.verification.command, true]]);
|
|
451
472
|
details(host, 'Request', display(run.request), 'run-request');
|
|
452
473
|
retroSection(host, run);
|
|
474
|
+
handoffSection(host, run);
|
|
453
475
|
if (!solo) details(host, 'Waves', list(run.waves).map((ids, i) => `${i + 1}: ${list(ids).join(', ')}`).join('\n') || '—', 'waves');
|
|
454
476
|
if (run.verification && run.verification.log_tail != null) details(host, 'Verification output', run.verification.log_tail, 'verification-output');
|
|
455
477
|
}
|
|
@@ -457,6 +479,29 @@ window.ForgePanel = (() => {
|
|
|
457
479
|
// other ids on the page (mono). The hash is the other run's page, the same shape app.js uses.
|
|
458
480
|
function chainRows(run) {
|
|
459
481
|
const rows = [];
|
|
482
|
+
// A sub-plan (the subtasks of a split task): the task it belongs to, in the plan above.
|
|
483
|
+
const up = run.parent;
|
|
484
|
+
if (up && typeof up === 'object' && up.key && up.task) {
|
|
485
|
+
rows.push(['Subtasks of', link(`${up.task}${up.run_id ? ' · ' + up.run_id : ''}`, '#/runs/' + encodeURIComponent(up.key) + '/tasks/' + encodeURIComponent(up.task)), true]);
|
|
486
|
+
}
|
|
487
|
+
// The limits a split works within, and how much of the run was split (run.decomposition, when the plan records any).
|
|
488
|
+
const tree = run.decomposition, lim = tree && tree.limits;
|
|
489
|
+
if (lim && typeof lim === 'object') {
|
|
490
|
+
const off = lim.depth === 0 || lim.nodes === 0;
|
|
491
|
+
const text = off ? 'splitting is off for this run' : `depth ${lim.depth} · up to ${lim.children} subtasks per split · ${lim.nodes} subtasks in the run`;
|
|
492
|
+
const used = tree.split ? ` · ${tree.subtasks} subtask${tree.subtasks === 1 ? '' : 's'} in ${tree.split} split task${tree.split === 1 ? '' : 's'}` : '';
|
|
493
|
+
const value = el('span', text + (lim.frozen ? ' (frozen)' : '') + used);
|
|
494
|
+
value.title = 'The limits every split of a task works within: levels of subtasks, subtasks one split may make, and subtasks in the whole run. '
|
|
495
|
+
+ (lim.frozen ? 'They were frozen when the plan first ran.' : 'They can still change with plan --split-depth, --split-children and --split-nodes; the first run freezes them.');
|
|
496
|
+
rows.push(['Decomposition', value, true]);
|
|
497
|
+
}
|
|
498
|
+
// A goal larger than one plan: the stage this plan is, and the stages its planner proposed after it.
|
|
499
|
+
const later = run.later;
|
|
500
|
+
if (later && typeof later === 'object') {
|
|
501
|
+
const names = list(later.stages).map(st => st && st.title).filter(Boolean);
|
|
502
|
+
if (num(later.stage) !== null) rows.push(['Stage', `${later.stage} of a larger goal`]);
|
|
503
|
+
if (names.length) rows.push(['Later stages', names.join(' · ')]);
|
|
504
|
+
}
|
|
460
505
|
const prev = run.after;
|
|
461
506
|
if (prev && typeof prev === 'object') {
|
|
462
507
|
const label = prev.run_id || prev.key;
|
|
@@ -476,6 +521,8 @@ window.ForgePanel = (() => {
|
|
|
476
521
|
function runView(host, ctx) {
|
|
477
522
|
const run = ctx.run, now = ctx.now;
|
|
478
523
|
const tr = RM.timeRange(run, now);
|
|
524
|
+
// An old run of a backend forge no longer has: it reads as any run, and nothing here can run it again.
|
|
525
|
+
if (run.removed) host.append(el('p', `This run was ${run.removed.note}. Start a new run for the work that is left.`, 'warn'));
|
|
479
526
|
const s = section(host, 'Timeline');
|
|
480
527
|
fields(s, [['Started', time(tr && tr.start)], ['Last activity', time(tr && tr.end)], ['Wall time', tr ? RM.fmtDur(tr.end - tr.start) : '—'],
|
|
481
528
|
['Concurrency limit', run.settings && run.settings.max_parallel != null ? run.settings.max_parallel : (run.kind === 'solo' ? '—' : '3 (default; not recorded)')]]);
|
|
@@ -684,6 +731,14 @@ window.ForgePanel = (() => {
|
|
|
684
731
|
for (const item of items) {
|
|
685
732
|
const li = el('li', undefined, 'trail-line');
|
|
686
733
|
li.append(el('span', trailLine(item), 'trail-summary'));
|
|
734
|
+
const steered = list(item && item.steered);
|
|
735
|
+
if (steered.length) { // a person's message went into this attempt (#134)
|
|
736
|
+
const tag = el('span', 'steered', 'tag steered');
|
|
737
|
+
const live = steered.filter(m => m.mode === 'live').length;
|
|
738
|
+
tag.title = `${steered.length} message${steered.length === 1 ? '' : 's'} from ${[...new Set(steered.map(m => m.actor || '?'))].join(', ')} `
|
|
739
|
+
+ `(forge control steer${live ? `, ${live} sent live while it ran` : ''}); left out of routing and calibration statistics`;
|
|
740
|
+
li.append(tag);
|
|
741
|
+
}
|
|
687
742
|
const nav = executionLinks(ctx, task, item && item.executions);
|
|
688
743
|
if (nav.childElementCount) li.append(nav);
|
|
689
744
|
ol.append(li);
|
|
@@ -710,12 +765,13 @@ window.ForgePanel = (() => {
|
|
|
710
765
|
}
|
|
711
766
|
return seg;
|
|
712
767
|
}
|
|
713
|
-
// Asks, sends and answers one change to a summaries switch (`forge control set summaries`
|
|
768
|
+
// Asks, sends and answers one change to a summaries switch (`forge control set summaries`, or `change.key`
|
|
769
|
+
// summaries-model). `slot` takes the question
|
|
714
770
|
// 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
|
|
715
771
|
// question is open or the answer pends, the way controls.js keeps its own sections.
|
|
716
772
|
function changeSummaries(slot, held, runKey, change, done) {
|
|
717
773
|
const C = window.ForgeControls, U = window.ForgeUI, node = held || slot;
|
|
718
|
-
const plan = C.prepare({ kind: 'set', key: 'summaries', input: change.input, task: change.task });
|
|
774
|
+
const plan = C.prepare({ kind: 'set', key: change.key || 'summaries', input: change.input, task: change.task });
|
|
719
775
|
if (!plan.ok) { U.outcome(slot, { ok: false, status: 400, error: 'invalid', detail: plan.error }); return; }
|
|
720
776
|
if (node.dataset.busy) return;
|
|
721
777
|
node.dataset.editing = '1';
|
|
@@ -803,6 +859,74 @@ window.ForgePanel = (() => {
|
|
|
803
859
|
writable.then(on => { if (!on) { row.remove(); if (!sum) s.remove(); } });
|
|
804
860
|
}
|
|
805
861
|
|
|
862
|
+
// Messages for the task's next attempt (#134: `forge control steer`): the ones waiting, and where the page can write,
|
|
863
|
+
// a box that queues one. It starts nothing: the next implementer attempt, whatever starts it, gets them. While the
|
|
864
|
+
// task's implementer runs live (#252, claude and openclaude), Send now gives it the message at its next tool call.
|
|
865
|
+
function steerSection(host, ctx, task) {
|
|
866
|
+
const run = ctx.run, U = window.ForgeUI;
|
|
867
|
+
if (run.kind === 'solo' || task.status === 'MERGED') return;
|
|
868
|
+
const waiting = list(task.steer_waiting), sending = list(task.steer_sending), live = num(task.steer_live);
|
|
869
|
+
const s = section(host, live !== null ? 'Message for the implementer' : 'Message for the next attempt');
|
|
870
|
+
s.classList.add('steer-section');
|
|
871
|
+
s.dataset.hold = `steer:${run.key}:${task.id}`;
|
|
872
|
+
if (waiting.length) {
|
|
873
|
+
const ul = el('ul', undefined, 'steer-waiting');
|
|
874
|
+
for (const m of waiting) {
|
|
875
|
+
const li = el('li');
|
|
876
|
+
li.append(el('p', String(m.text || ''), 'steer-text'), el('p', `queued by ${m.actor || '?'}${num(m.at) !== null ? ', ' + ago(m.at, ctx.now) : ''}`, 'muted'));
|
|
877
|
+
ul.append(li);
|
|
878
|
+
}
|
|
879
|
+
s.append(ul);
|
|
880
|
+
}
|
|
881
|
+
muted(s, waiting.length ? 'Waiting: the task\'s next implementer attempt gets them, beside any review findings.'
|
|
882
|
+
: 'Nothing waiting. A message starts nothing: the task\'s next implementer attempt gets it (a retry, a resume, or the run\'s own next attempt). Steered attempts are marked and left out of routing and calibration statistics.');
|
|
883
|
+
if (sending.length) {
|
|
884
|
+
const ul = el('ul', undefined, 'steer-waiting steer-sending');
|
|
885
|
+
for (const m of sending) {
|
|
886
|
+
const li = el('li');
|
|
887
|
+
li.append(el('p', String(m.text || ''), 'steer-text'), el('p', `sending to the running implementer (from ${m.actor || '?'})`, 'muted'));
|
|
888
|
+
ul.append(li);
|
|
889
|
+
}
|
|
890
|
+
s.append(ul);
|
|
891
|
+
}
|
|
892
|
+
if (live !== null) muted(s, `The implementer of attempt ${live} is running live: Send now gives it a message at its next tool call, without stopping it. Queue message keeps it for the next attempt.`);
|
|
893
|
+
if (!U || !U.controlsEnabled) return;
|
|
894
|
+
const box = el('div', undefined, 'steer-box');
|
|
895
|
+
const field = el('textarea'); field.rows = 3; field.maxLength = 8000; field.autocomplete = 'off';
|
|
896
|
+
field.setAttribute('aria-label', 'Message for the next attempt');
|
|
897
|
+
const send = el('button', 'Queue message'); send.type = 'button';
|
|
898
|
+
const now = live !== null ? el('button', 'Send now') : null;
|
|
899
|
+
if (now) { now.type = 'button'; now.className = 'primary'; now.title = `Give it to the running implementer (attempt ${live}) at its next tool call`; }
|
|
900
|
+
const msgs = el('div', undefined, 'steer-msgs');
|
|
901
|
+
const mark = () => { s.dataset.editing = '1'; };
|
|
902
|
+
field.addEventListener('focus', mark);
|
|
903
|
+
field.addEventListener('input', mark);
|
|
904
|
+
field.addEventListener('blur', () => { if (!s.dataset.busy && !String(field.value || '').trim()) delete s.dataset.editing; });
|
|
905
|
+
const post = async (sendNow) => {
|
|
906
|
+
if (s.dataset.busy) return;
|
|
907
|
+
const text = String(field.value || '').trim();
|
|
908
|
+
if (!text) { U.outcome(msgs, { ok: false, status: 400, error: 'invalid', detail: 'the message is empty' }); return; }
|
|
909
|
+
s.dataset.busy = '1'; send.disabled = true; if (now) now.disabled = true;
|
|
910
|
+
const path = '/api/runs/' + encodeURIComponent(run.key) + '/tasks/' + encodeURIComponent(task.id) + '/steer';
|
|
911
|
+
let res;
|
|
912
|
+
try { res = await U.post(path, sendNow ? { text, now: true } : { text }); } catch (_) { res = { ok: false, error: 'failed', detail: 'could not send' }; }
|
|
913
|
+
delete s.dataset.busy; send.disabled = false; if (now) now.disabled = false;
|
|
914
|
+
if (!s.isConnected) return;
|
|
915
|
+
if (res && res.ok) {
|
|
916
|
+
field.value = ''; delete s.dataset.editing;
|
|
917
|
+
const n = res.data && num(res.data.waiting);
|
|
918
|
+
U.outcome(msgs, res, sendNow ? 'Sent: the running implementer gets it at its next tool call'
|
|
919
|
+
: `Queued for the next attempt${n ? ` (${n} waiting)` : ''}`);
|
|
920
|
+
if (ctx.refresh) ctx.refresh();
|
|
921
|
+
} else U.outcome(msgs, res);
|
|
922
|
+
};
|
|
923
|
+
send.addEventListener('click', () => post(false));
|
|
924
|
+
if (now) now.addEventListener('click', () => post(true));
|
|
925
|
+
box.append(field, ...(now ? [now] : []), send, msgs);
|
|
926
|
+
s.append(box);
|
|
927
|
+
U.controlsEnabled().then(on => { if (!on && box.isConnected) box.remove(); if (!on && !waiting.length && s.isConnected) s.remove(); });
|
|
928
|
+
}
|
|
929
|
+
|
|
806
930
|
function taskView(host, ctx, task) {
|
|
807
931
|
const run = ctx.run, now = ctx.now, solo = run.kind === 'solo';
|
|
808
932
|
const detail = lazy(ctx, `/api/runs/${encodeURIComponent(run.key)}/tasks/${encodeURIComponent(task.id)}`, run.updated);
|
|
@@ -837,6 +961,7 @@ window.ForgePanel = (() => {
|
|
|
837
961
|
if (!solo) fields(host, [['Difficulty', task.difficulty], ['Depends on', depLinks(task.deps, ctx)], ['Files', list(task.files).join('\n') || '—', true], ['Branch', task.branch, true]]);
|
|
838
962
|
if (C) C.nowSection(host, ctx, task);
|
|
839
963
|
sweepSection(host, ctx, task);
|
|
964
|
+
steerSection(host, ctx, task);
|
|
840
965
|
|
|
841
966
|
// the models: who owned it, how it was routed, what it was escalated to
|
|
842
967
|
const ms = section(host, 'Models');
|
|
@@ -902,7 +1027,7 @@ window.ForgePanel = (() => {
|
|
|
902
1027
|
as.append(box);
|
|
903
1028
|
}
|
|
904
1029
|
|
|
905
|
-
|
|
1030
|
+
decompositionSection(host, ctx, task);
|
|
906
1031
|
|
|
907
1032
|
// reviews and their findings
|
|
908
1033
|
const rs = section(host, 'Review findings');
|
|
@@ -988,79 +1113,58 @@ window.ForgePanel = (() => {
|
|
|
988
1113
|
if (list(d.warnings).length) details(ps, `Reader warnings (${d.warnings.length})`, d.warnings.join('\n'), `exec-${sel.exec}-warn`);
|
|
989
1114
|
}
|
|
990
1115
|
|
|
991
|
-
/* ----------
|
|
992
|
-
|
|
993
|
-
const
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1116
|
+
/* ---------- decomposition: the decision on a task, and the subtasks a split task has ---------- */
|
|
1117
|
+
// What a node spent, in tokens (input + output): forge records tokens, never a price.
|
|
1118
|
+
const spent = t => t && typeof t === 'object' ? (num(t.input) || 0) + (num(t.output) || 0) : null;
|
|
1119
|
+
const tok = v => v === null ? null : (v >= 1e6 ? (v / 1e6).toFixed(1) + 'M' : v >= 1e3 ? (v / 1e3).toFixed(1) + 'k' : String(v)) + ' tokens';
|
|
1120
|
+
const DECISIONS = { atomic: 'kept whole', split: 'split', bounded: 'kept whole at a limit' };
|
|
1121
|
+
// What each word means, shown when the pointer rests on it.
|
|
1122
|
+
const DECISION_HELP = {
|
|
1123
|
+
atomic: 'Done as one piece. Keeping a task whole is always a valid decision.',
|
|
1124
|
+
split: 'Split into subtasks. They run as a plan of their own, merge into this task, and the task is then reviewed on all of their work.',
|
|
1125
|
+
bounded: 'A split here would pass a limit of the run (levels, subtasks per split, or subtasks in the whole run), so it runs as one piece.',
|
|
1126
|
+
};
|
|
1127
|
+
const BY_HELP = {
|
|
1128
|
+
planner: 'The planner decided this when it planned.',
|
|
1129
|
+
user: 'A person decided this (retry --decide split).',
|
|
1130
|
+
auto: 'The run decided this: it was started with --auto-split, so the planner split a task that stopped on split.',
|
|
1131
|
+
default: 'Nobody decided: a task is one piece unless someone splits it.',
|
|
1132
|
+
};
|
|
1133
|
+
// task.decomposition: {decision, reason, by, at, sub: {key, run_id, path} | null, merged, waiting, start, kept,
|
|
1134
|
+
// nodes: [{id, parent, run, run_id, task, level, title, status, difficulty, model, qa, decision, reason, by, attempts,
|
|
1135
|
+
// tokens, has_diff}]}, the nodes in tree order through every level below the task. Absent on a plan with no record.
|
|
1136
|
+
function decompositionSection(host, ctx, task) {
|
|
1137
|
+
const D = task.decomposition, nodes = D ? list(D.nodes) : [];
|
|
1138
|
+
if (ctx.onSubtasks) ctx.onSubtasks(task.id, nodes.length ? nodes : null);
|
|
1139
|
+
if (!D || (!D.decision && !nodes.length)) return;
|
|
1140
|
+
// A task nobody decided about is one piece, as every task was before: nothing to say.
|
|
1141
|
+
if (D.decision === 'atomic' && D.by === 'default' && !nodes.length) return;
|
|
1142
|
+
const ds = section(host, 'Decomposition');
|
|
1003
1143
|
const chips = el('div', undefined, 'chips');
|
|
1004
|
-
if (
|
|
1005
|
-
if (
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1144
|
+
if (D.decision) { const c = el('span', DECISIONS[D.decision] || D.decision, 'tag'); c.title = DECISION_HELP[D.decision] || ''; chips.append(c); }
|
|
1145
|
+
if (D.by) { const c = el('span', 'decided by ' + D.by, 'plate src-plate'); c.title = BY_HELP[D.by] || ''; chips.append(c); }
|
|
1146
|
+
ds.append(chips);
|
|
1147
|
+
if (D.reason) ds.append(el('p', D.reason));
|
|
1148
|
+
if (!nodes.length) return;
|
|
1149
|
+
const total = nodes.reduce((a, n) => a + (spent(n.tokens) || 0), 0), merged = nodes.filter(n => n.status === 'MERGED').length;
|
|
1150
|
+
muted(ds, [`${nodes.length} subtask${nodes.length === 1 ? '' : 's'}`, `${merged} merged`, total ? tok(total) : null,
|
|
1151
|
+
D.merged ? "their work is on this task's branch, and the task is reviewed on all of it" : 'the task is reviewed on all of their work once every one has merged',
|
|
1152
|
+
D.start === 'fresh' ? 'started over from the task\'s base' + (D.kept ? ` (earlier work kept at ${String(D.kept).slice(0, 12)})` : '') : null].filter(Boolean).join(' · '));
|
|
1153
|
+
if (list(D.waiting).length) ds.append(el('p', 'Waiting for: ' + list(D.waiting).join(', '), 'muted'));
|
|
1154
|
+
if (D.sub && D.sub.key) { const open = el('p', undefined, 'muted'); open.append(link('Open the subtasks as a plan of their own →', '#/runs/' + encodeURIComponent(D.sub.key))); ds.append(open); }
|
|
1155
|
+
const T = RM.nodeTree(nodes), ul = el('ul', undefined, 'node-tree');
|
|
1011
1156
|
for (const n of nodes) {
|
|
1012
|
-
const li = el('li', undefined, 'ft-node ft-d' + Math.min(6, (T.pos[n.id] || {}).depth || 0)
|
|
1013
|
-
li.append(el('i', undefined, 'led st-' + String(n.
|
|
1014
|
-
const
|
|
1015
|
-
li.append(link(n.id, ctx.hash(target), () => ctx.onSelect(target)));
|
|
1016
|
-
const bits = [n.reserved ? 'reserved' : n.status, n.difficulty, n.phase ? `${n.phase}${n.iteration ? ' #' + n.iteration : ''}` : null, num(n.cost) !== null ? money(n.cost) : null].filter(Boolean);
|
|
1157
|
+
const li = el('li', undefined, 'ft-node ft-d' + Math.min(6, (T.pos[n.id] || {}).depth || 0));
|
|
1158
|
+
li.append(el('i', undefined, 'led st-' + String(n.status || 'unknown').toLowerCase()));
|
|
1159
|
+
const a = el('a', n.task || n.id); a.href = ctx.nodeHash ? ctx.nodeHash(n) : '#'; li.append(a);
|
|
1017
1160
|
if (n.model) li.append(plate(n.model));
|
|
1018
|
-
li.append(el('span',
|
|
1019
|
-
const
|
|
1020
|
-
if (
|
|
1021
|
-
|
|
1022
|
-
if (n.goal) li.title = n.goal;
|
|
1161
|
+
li.append(el('span', [n.status, n.difficulty, num(n.attempts) > 1 ? `${n.attempts} attempts` : null, tok(spent(n.tokens))].filter(Boolean).join(' · '), 'muted'));
|
|
1162
|
+
if (n.decision && n.decision !== 'atomic') { const c = el('span', DECISIONS[n.decision] || n.decision, 'tag'); c.title = DECISION_HELP[n.decision] || ''; li.append(c); }
|
|
1163
|
+
if (n.has_diff && ctx.nodeHash) { const d = el('a', 'diff', 'diff-link small'); d.href = ctx.nodeHash(n) + '/diff'; li.append(d); }
|
|
1164
|
+
li.title = [n.title, n.reason].filter(Boolean).join('\n');
|
|
1023
1165
|
ul.append(li);
|
|
1024
1166
|
}
|
|
1025
|
-
|
|
1026
|
-
if (list(F.events).length) details(fs, `Recent events (${F.events.length})`, F.events.map(e => `${time(e.at)} ${e.kind}${e.node ? ' · ' + e.node : ''}${e.decision ? ' · ' + e.decision : ''}${e.status ? ' · ' + e.status : ''}${e.reason ? ' — ' + e.reason : ''}`).join('\n'), `fractal-${task.id}-events`);
|
|
1027
|
-
if (list(F.warnings).length) details(fs, `Reader warnings (${F.warnings.length})`, F.warnings.join('\n'), `fractal-${task.id}-warn`);
|
|
1028
|
-
}
|
|
1029
|
-
function fractalNodeView(host, ctx, sel) {
|
|
1030
|
-
const run = ctx.run, path = `${fractalPath(run, sel.task)}/nodes/${encodeURIComponent(sel.node)}`;
|
|
1031
|
-
const entry = lazy(ctx, path, run.updated), n = entry.data;
|
|
1032
|
-
const head = el('div', undefined, 'insp-head');
|
|
1033
|
-
head.append(el('h2', sel.node), el('div', `Fractal node · task ${sel.task}`, 'insp-kind'));
|
|
1034
|
-
const back = { kind: 'task', id: sel.task };
|
|
1035
|
-
if (n) { const chips = el('div', undefined, 'chips'); chips.append(chip(n.reserved ? 'reserved' : n.ui_status || n.status, n.reserved ? 'none' : undefined)); if (n.decomposition && n.decomposition.decision) chips.append(el('span', n.decomposition.decision, 'tag')); head.append(chips); }
|
|
1036
|
-
head.append(link('← task ' + sel.task, ctx.hash(back), () => ctx.onSelect(back)));
|
|
1037
|
-
if (n && n.has_diff) { const a = diffLink(ctx, 'Its candidate diff →', { kind: 'fractal', task: sel.task, node: sel.node }); if (a) head.append(a); }
|
|
1038
|
-
host.append(head);
|
|
1039
|
-
if (loading(host, entry, 'this node')) return;
|
|
1040
|
-
if (n.goal) host.append(el('p', n.goal));
|
|
1041
|
-
fields(host, [['Parent', n.parent ? link(n.parent, ctx.hash({ kind: 'fractal', task: sel.task, node: n.parent }), () => ctx.onSelect({ kind: 'fractal', task: sel.task, node: n.parent })) : '—'],
|
|
1042
|
-
['Difficulty', n.difficulty], ['Model', n.model ? plate(n.model) : '—'], ['Resolved', n.resolved_model ? plate(n.resolved_model) : '—'], ['Paths', list(n.paths).join('\n') || '—', true], ['Depends on', list(n.deps).join(', ') || '—', true],
|
|
1043
|
-
['Phase', n.phase ? `${n.phase}${n.iteration ? ' · iteration ' + n.iteration : ''}` : '—'], ['Started', time(n.started_at)], ['Ended', time(n.ended_at)],
|
|
1044
|
-
['Cost', `${money(n.cost)}${n.unknown_cost_steps ? ` (+${n.unknown_cost_steps} steps of unknown cost)` : ''}`], ['Tokens', n.tokens ? `${display(n.tokens.input_tokens)} in (${display(n.tokens.cached_input_tokens)} cached) · ${display(n.tokens.output_tokens)} out` : '—']]);
|
|
1045
|
-
if (n.error) host.append(el('p', n.error, 'warn'));
|
|
1046
|
-
const dec = n.decomposition;
|
|
1047
|
-
if (dec) {
|
|
1048
|
-
const ds = section(host, 'Decomposition');
|
|
1049
|
-
fields(ds, [['Decision', dec.decision], ['Phase', dec.phase], ['Attempts', dec.attempts]]);
|
|
1050
|
-
if (dec.reason) ds.append(el('p', dec.reason));
|
|
1051
|
-
const adm = list(dec.admission);
|
|
1052
|
-
if (adm.length) {
|
|
1053
|
-
const ul = el('ul', undefined, 'plain');
|
|
1054
|
-
for (const a of adm) { const li = el('li'); li.append(link(a.name, ctx.hash({ kind: 'fractal', task: sel.task, node: a.name }), () => ctx.onSelect({ kind: 'fractal', task: sel.task, node: a.name })), document.createTextNode(` · ${a.difficulty || '—'} · `), plate(a.model), document.createTextNode(` — ${a.goal || ''}`)); ul.append(li); }
|
|
1055
|
-
ds.append(el('p', 'Children it admitted:', 'muted'), ul);
|
|
1056
|
-
}
|
|
1057
|
-
if (dec.error) ds.append(el('p', dec.error, 'warn'));
|
|
1058
|
-
}
|
|
1059
|
-
if (list(n.decomposition_history).length > 1) details(host, `Decomposition history (${n.decomposition_history.length})`, n.decomposition_history.map(h => `${h.phase || '—'} · ${h.decision || '—'}${h.reason ? ' — ' + h.reason : ''}`).join('\n'), `fnode-${sel.task}-${sel.node}-hist`);
|
|
1060
|
-
const ps = section(host, 'Output');
|
|
1061
|
-
if (n.last != null) details(ps, 'Last message', n.last, `fnode-${sel.task}-${sel.node}-last`);
|
|
1062
|
-
if (n.planning_last != null) details(ps, 'Planner\'s last message', n.planning_last, `fnode-${sel.task}-${sel.node}-plan`);
|
|
1063
|
-
if (n.last == null && n.planning_last == null) muted(ps, 'No output yet.');
|
|
1167
|
+
ds.append(ul);
|
|
1064
1168
|
}
|
|
1065
1169
|
|
|
1066
1170
|
// Commits made outside forge that `adopt` brought in, each reviewed alone: a person's work, so no task row claims them.
|
|
@@ -1240,9 +1344,8 @@ window.ForgePanel = (() => {
|
|
|
1240
1344
|
if (sel.kind === 'adoption') return adoptionView(host, ctx, sel);
|
|
1241
1345
|
if (sel.kind === 'verification') return verificationView(host, ctx);
|
|
1242
1346
|
if (sel.kind === 'integration') return integrationView(host, ctx);
|
|
1243
|
-
if (sel.kind === 'fractal') return fractalNodeView(host, ctx, sel);
|
|
1244
1347
|
return runView(host, ctx);
|
|
1245
1348
|
}
|
|
1246
|
-
return { render, cache, trailLine, reasonText, linkModel, headerActions, summaryBank, changeSummaries, answerOutcome };
|
|
1349
|
+
return { render, cache, trailLine, reasonText, linkModel, headerActions, summaryBank, changeSummaries, answerOutcome, decompositionSection };
|
|
1247
1350
|
})();
|
|
1248
1351
|
if (typeof module === 'object' && module.exports) module.exports = window.ForgePanel;
|
|
@@ -916,9 +916,17 @@
|
|
|
916
916
|
line.append(el('span', r.text == null ? '' : String(r.text)));
|
|
917
917
|
if (learningManual(r)) { line.append(document.createTextNode(' '), el('span', 'added by a person', 'chip prj-manual')); }
|
|
918
918
|
box.append(line);
|
|
919
|
-
if (!s.writes) { const commands = rowCommands(r); if (commands) box.append(commands); }
|
|
920
919
|
return box;
|
|
921
920
|
}
|
|
921
|
+
// Read-only: a row's copyable commands open below the filters on request, one row at a time, rather than
|
|
922
|
+
// two command lines in every Learning cell (#175).
|
|
923
|
+
function openCommands(r) {
|
|
924
|
+
const commands = rowCommands(r);
|
|
925
|
+
if (!commands) return;
|
|
926
|
+
const close = el('button', 'Close'); close.type = 'button'; close.setAttribute('aria-label', 'Close commands');
|
|
927
|
+
close.addEventListener('click', () => editHost.replaceChildren());
|
|
928
|
+
editHost.replaceChildren(el('p', 'Commands for ' + (learningKey(r) || String(r.text || ''))), commands, close);
|
|
929
|
+
}
|
|
922
930
|
const empty = memoryEmpty(d);
|
|
923
931
|
if (empty) {
|
|
924
932
|
parts.push(el('p', empty, 'muted prj-empty'));
|
|
@@ -968,7 +976,7 @@
|
|
|
968
976
|
});
|
|
969
977
|
lbar.append(lab, forget);
|
|
970
978
|
all.append(lbar, buildAddForm(), editHost, faction, lcount, lhost);
|
|
971
|
-
} else all.append(lbar, faction, lcount, lhost);
|
|
979
|
+
} else all.append(lbar, editHost, faction, lcount, lhost);
|
|
972
980
|
parts.push(all);
|
|
973
981
|
body.replaceChildren(...parts);
|
|
974
982
|
async function forgetSelected() {
|
|
@@ -1042,6 +1050,12 @@
|
|
|
1042
1050
|
b.disabled = s.forgetting || !key; b.setAttribute('aria-label', 'Edit ' + (key || 'learning'));
|
|
1043
1051
|
b.addEventListener('click', () => openEdit(r)); editButtons.push(b); return b;
|
|
1044
1052
|
} });
|
|
1053
|
+
if (!s.writes) columns.push({ id: 'commands', label: '', title: 'Commands', sortable: false, hideable: false, cell: r => {
|
|
1054
|
+
if (!rowCommands(r)) return '';
|
|
1055
|
+
const name = learningKey(r) || String(r.text || ''), b = el('button', 'Commands'); b.type = 'button';
|
|
1056
|
+
b.setAttribute('aria-label', 'Commands for ' + name);
|
|
1057
|
+
b.addEventListener('click', () => openCommands(r)); return b;
|
|
1058
|
+
} });
|
|
1045
1059
|
table(lhost, 'project-learnings', 'Learnings', columns, shown);
|
|
1046
1060
|
syncForget();
|
|
1047
1061
|
}
|
|
@@ -937,9 +937,23 @@
|
|
|
937
937
|
return `${word(n('notes'), 'note', 'notes')}: ${fixable.join(', ')} · ${n('verified')} verified, ${n('claimed')} claimed · ${n('blocking')} blocking`;
|
|
938
938
|
}
|
|
939
939
|
|
|
940
|
-
/* ----------
|
|
941
|
-
//
|
|
942
|
-
|
|
940
|
+
/* ---------- the handoff (forge handoff: handoff.driver.json, handoff.notes.jsonl) ---------- */
|
|
941
|
+
// RunDetail.handoff.driver → one line, e.g. "claude-code · session 1da3e1ef… · since 2h05m · seen 4m10s ago".
|
|
942
|
+
// A stale driver (last seen over 12 hours ago) says another session may claim the run. Null when no driver.
|
|
943
|
+
function handoffDriverLine(driver, nowSec) {
|
|
944
|
+
if (!driver || typeof driver !== 'object' || typeof driver.harness !== 'string' || !driver.harness) return null;
|
|
945
|
+
const now = num(nowSec) === null ? Date.now() / 1000 : nowSec, since = num(driver.since), seen = num(driver.last_seen);
|
|
946
|
+
const parts = [driver.harness];
|
|
947
|
+
if (typeof driver.session === 'string' && driver.session) parts.push('session ' + (driver.session.length > 12 ? driver.session.slice(0, 8) + '…' : driver.session));
|
|
948
|
+
if (since !== null) parts.push('since ' + fmtDur(now - since));
|
|
949
|
+
if (seen !== null) parts.push('seen ' + fmtDur(now - seen) + ' ago');
|
|
950
|
+
const line = parts.join(' · ');
|
|
951
|
+
return driver.stale ? line + ' (stale: another session can claim the run)' : line;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/* ---------- decomposition: a split task's subtasks as a tidy tree (depth across, siblings down) ---------- */
|
|
955
|
+
// nodes: a task's decomposition.nodes (tree order, parent ids); returns {pos: {id: {col, row, depth}}, edges: [[parent, child]], cols, rows}
|
|
956
|
+
function nodeTree(nodes) {
|
|
943
957
|
const ns = list(nodes).filter(n => n && n.id), ids = new Set(ns.map(n => n.id)), kids = new Map();
|
|
944
958
|
const roots = [];
|
|
945
959
|
for (const n of ns) {
|
|
@@ -965,5 +979,5 @@
|
|
|
965
979
|
finalStatus, runReviewStatus, reviewSinceLine, reviewAt, taskStatus, statusText, statusLabel, causeLabel, resetText, taskVerdict, attemptStatus, attemptNote, attemptFailed, isWaiting,
|
|
966
980
|
attributionLine, taskParts,
|
|
967
981
|
taskTimes, metricValue, overlap, projectSchedule, execModel, verifyLeds, criticalPath, concurrency, stateAt, timeRange, events, lineage, structureKey, innerKey,
|
|
968
|
-
fmtDur, alias, basename, weight, searchIndex, searchRank, statusEvents,
|
|
982
|
+
fmtDur, alias, basename, weight, searchIndex, searchRank, statusEvents, nodeTree, sweepLine, sweepState, retroSummary, handoffDriverLine };
|
|
969
983
|
});
|