@tangle-network/agent-eval 0.217.1 → 0.218.1
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 +36 -1
- package/dist/adapters/http.d.ts +2 -2
- package/dist/analyst/index.d.ts +1 -1
- package/dist/analyst/index.d.ts.map +1 -1
- package/dist/analyst/index.js +9 -9
- package/dist/analyst/index.js.map +1 -1
- package/dist/{analyze-runs-DyeNcenW.d.ts → analyze-runs-DjlZOVXx.d.ts} +2 -2
- package/dist/{analyze-runs-DyeNcenW.d.ts.map → analyze-runs-DjlZOVXx.d.ts.map} +1 -1
- package/dist/{benchmark-command-xQK8nOI6.js → benchmark-command-BupdHRyf.js} +661 -562
- package/dist/benchmark-command-BupdHRyf.js.map +1 -0
- package/dist/benchmarks/index.d.ts +4 -4
- package/dist/benchmarks/index.js +3 -3
- package/dist/campaign/index.d.ts +4 -4
- package/dist/campaign/index.js +10 -10
- package/dist/{campaign-CJGkxAQ6.js → campaign-CGvUTnmc.js} +312 -281
- package/dist/{campaign-CJGkxAQ6.js.map → campaign-CGvUTnmc.js.map} +1 -1
- package/dist/{campaign-evidence-CQYw8_0H.js → campaign-evidence-DunzcJGv.js} +2 -2
- package/dist/{campaign-evidence-CQYw8_0H.js.map → campaign-evidence-DunzcJGv.js.map} +1 -1
- package/dist/{chat-client-ldqxYYTN.js → chat-client-B2pXlPdx.js} +2 -2
- package/dist/{chat-client-ldqxYYTN.js.map → chat-client-B2pXlPdx.js.map} +1 -1
- package/dist/{chat-json-call-DavzexSp.js → chat-json-call-Dm9c-b41.js} +2 -2
- package/dist/{chat-json-call-DavzexSp.js.map → chat-json-call-Dm9c-b41.js.map} +1 -1
- package/dist/cli.js +10 -10
- package/dist/{completion-verifier-B_jw6C9p.js → completion-verifier-DbLVf3i8.js} +4 -4
- package/dist/{completion-verifier-B_jw6C9p.js.map → completion-verifier-DbLVf3i8.js.map} +1 -1
- package/dist/contract/index.d.ts +7 -7
- package/dist/contract/index.js +90 -10
- package/dist/contract/index.js.map +1 -1
- package/dist/{default-registry-ClYjq3QE.js → default-registry-BJ-Pq6yL.js} +309 -277
- package/dist/{default-registry-ClYjq3QE.js.map → default-registry-BJ-Pq6yL.js.map} +1 -1
- package/dist/{define-agent-eval-BDxNlP3D.js → define-agent-eval-BGdFKlrc.js} +165 -105
- package/dist/define-agent-eval-BGdFKlrc.js.map +1 -0
- package/dist/{define-agent-eval-BIkH_gAR.d.ts → define-agent-eval-BlH10zEw.d.ts} +6 -6
- package/dist/{define-agent-eval-BIkH_gAR.d.ts.map → define-agent-eval-BlH10zEw.d.ts.map} +1 -1
- package/dist/diagnosis/index.d.ts +1 -1
- package/dist/{dspy-rlm-engine-DhdCr1Dc.js → dspy-rlm-engine-CSMwudLO.js} +2 -2
- package/dist/{dspy-rlm-engine-DhdCr1Dc.js.map → dspy-rlm-engine-CSMwudLO.js.map} +1 -1
- package/dist/eval-campaign-BUMIxKTE.js +393 -0
- package/dist/eval-campaign-BUMIxKTE.js.map +1 -0
- package/dist/{evaluation-jTjC_QQD.d.ts → evaluation-BOZ38vOH.d.ts} +2 -2
- package/dist/{evaluation-jTjC_QQD.d.ts.map → evaluation-BOZ38vOH.d.ts.map} +1 -1
- package/dist/evaluation.d.ts +1 -1
- package/dist/experiment/index.d.ts +1 -1
- package/dist/experiment/index.d.ts.map +1 -1
- package/dist/experiment/index.js +110 -71
- package/dist/experiment/index.js.map +1 -1
- package/dist/{exporters-Cl6IeNAu.js → exporters-DWvM16LE.js} +2 -2
- package/dist/{exporters-Cl6IeNAu.js.map → exporters-DWvM16LE.js.map} +1 -1
- package/dist/{external-optimizer-process-KVFGvYX1.js → external-optimizer-process-C3Wm7Vhn.js} +2 -2
- package/dist/{external-optimizer-process-KVFGvYX1.js.map → external-optimizer-process-C3Wm7Vhn.js.map} +1 -1
- package/dist/{external-optimizer-subprocess-XIHBOSKt.js → external-optimizer-subprocess-B5gdLRZv.js} +3 -3
- package/dist/{external-optimizer-subprocess-XIHBOSKt.js.map → external-optimizer-subprocess-B5gdLRZv.js.map} +1 -1
- package/dist/{findings-store-BMVQtEsm.js → findings-store-BtTzPL0d.js} +5 -5
- package/dist/{findings-store-BMVQtEsm.js.map → findings-store-BtTzPL0d.js.map} +1 -1
- package/dist/{hf-dataset-D9f7-oX7.js → hf-dataset-CKxIJQba.js} +3 -3
- package/dist/{hf-dataset-D9f7-oX7.js.map → hf-dataset-CKxIJQba.js.map} +1 -1
- package/dist/hosted/index.js +1 -1
- package/dist/{index-ZuWx52WG.d.ts → index-B16FNdW5.d.ts} +34 -17
- package/dist/index-B16FNdW5.d.ts.map +1 -0
- package/dist/{index-9jJ2fKSX.d.ts → index-CalAsXMR.d.ts} +7 -5
- package/dist/index-CalAsXMR.d.ts.map +1 -0
- package/dist/{index-BiT6RtNH.d.ts → index-DbMOXYnP.d.ts} +6 -6
- package/dist/{index-BiT6RtNH.d.ts.map → index-DbMOXYnP.d.ts.map} +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +611 -688
- package/dist/index.js.map +1 -1
- package/dist/{integrity-DOd9Q86O.js → integrity-C8oUeB0g.js} +322 -197
- package/dist/integrity-C8oUeB0g.js.map +1 -0
- package/dist/{journal-CR4QikYp.js → journal-C7om8Gum.js} +48 -38
- package/dist/journal-C7om8Gum.js.map +1 -0
- package/dist/ledger-core/index.d.ts +1 -1
- package/dist/ledger-core/index.js +2 -2
- package/dist/ledger-core/lock-holder.d.ts +2 -0
- package/dist/ledger-core/lock-holder.js +181 -0
- package/dist/ledger-core/lock-holder.js.map +1 -0
- package/dist/{ledger-core-DrJhbms9.js → ledger-core-CAxUdDk0.js} +2 -2
- package/dist/{ledger-core-DrJhbms9.js.map → ledger-core-CAxUdDk0.js.map} +1 -1
- package/dist/{llm-client-BshCREn6.js → llm-client-_Y6ic-tf.js} +238 -248
- package/dist/llm-client-_Y6ic-tf.js.map +1 -0
- package/dist/{llm-judge-C8jMTNNG.js → llm-judge-Djxh-Uhs.js} +646 -458
- package/dist/llm-judge-Djxh-Uhs.js.map +1 -0
- package/dist/lock-holder-DaJbfpci.d.ts +86 -0
- package/dist/lock-holder-DaJbfpci.d.ts.map +1 -0
- package/dist/{matrix-DHe-dwVJ.d.ts → matrix-CCSBna4q.d.ts} +2 -2
- package/dist/{matrix-DHe-dwVJ.d.ts.map → matrix-CCSBna4q.d.ts.map} +1 -1
- package/dist/{mint-zszyYlpA.js → mint-CbdwjTPW.js} +2 -2
- package/dist/{mint-zszyYlpA.js.map → mint-CbdwjTPW.js.map} +1 -1
- package/dist/multishot/golden/index.d.ts +1 -1
- package/dist/multishot/index.d.ts +2 -2
- package/dist/openapi.json +1 -1
- package/dist/{pareto-BzsxidFD.js → pareto-CTv8vozZ.js} +4 -4
- package/dist/{pareto-BzsxidFD.js.map → pareto-CTv8vozZ.js.map} +1 -1
- package/dist/{promotion-gate-DaY95yU6.d.ts → promotion-gate-CxEHRsZW.d.ts} +2 -2
- package/dist/{promotion-gate-DaY95yU6.d.ts.map → promotion-gate-CxEHRsZW.d.ts.map} +1 -1
- package/dist/{proposal-findings-BbWidvUk.js → proposal-findings-n-5WBbEx.js} +2 -2
- package/dist/{proposal-findings-BbWidvUk.js.map → proposal-findings-n-5WBbEx.js.map} +1 -1
- package/dist/{render-C-w2EZ6p.js → render-Cs34y0iX.js} +404 -208
- package/dist/render-Cs34y0iX.js.map +1 -0
- package/dist/reporting.d.ts +2 -2
- package/dist/{researcher-0ABVIdGa.d.ts → researcher-GU1tV4dn.d.ts} +2 -2
- package/dist/{researcher-0ABVIdGa.d.ts.map → researcher-GU1tV4dn.d.ts.map} +1 -1
- package/dist/rl.d.ts +2 -2
- package/dist/rl.js +4 -4
- package/dist/rollout/index.js +5 -5
- package/dist/{rollout-D6C50mfA.js → rollout-Dd1ucT_M.js} +5 -5
- package/dist/{rollout-D6C50mfA.js.map → rollout-Dd1ucT_M.js.map} +1 -1
- package/dist/schema-C-ziyJD7.d.ts.map +1 -1
- package/dist/{schema-DxcKTzbi.js → schema-CvhfLjtZ.js} +77 -47
- package/dist/schema-CvhfLjtZ.js.map +1 -0
- package/dist/search/index.d.ts +2 -2
- package/dist/search/index.d.ts.map +1 -1
- package/dist/search/index.js +2 -2
- package/dist/{search-kernel-DxqjBxA-.d.ts → search-kernel-p9JB3SmL.d.ts} +3 -3
- package/dist/{search-kernel-DxqjBxA-.d.ts.map → search-kernel-p9JB3SmL.d.ts.map} +1 -1
- package/dist/{search-ledger-TUvB5gWH.js → search-ledger-ClpN4I3e.js} +4 -4
- package/dist/{search-ledger-TUvB5gWH.js.map → search-ledger-ClpN4I3e.js.map} +1 -1
- package/dist/{search-ledger-file-UKCO2r8a.js → search-ledger-file-Bd5Tioq6.js} +3 -3
- package/dist/{search-ledger-file-UKCO2r8a.js.map → search-ledger-file-Bd5Tioq6.js.map} +1 -1
- package/dist/{search-shipper-Cw2z3-td.js → search-shipper-Bg2HW3Uv.js} +3 -3
- package/dist/{search-shipper-Cw2z3-td.js.map → search-shipper-Bg2HW3Uv.js.map} +1 -1
- package/dist/{search-summary-DQIvJsSB.js → search-summary-CrBuvVnf.js} +3 -3
- package/dist/{search-summary-DQIvJsSB.js.map → search-summary-CrBuvVnf.js.map} +1 -1
- package/dist/{server-DoVbqqtJ.js → server-C6M0qR8h.js} +2 -2
- package/dist/{server-DoVbqqtJ.js.map → server-C6M0qR8h.js.map} +1 -1
- package/dist/{single-run-lock-U58yf8N6.js → single-run-lock-Dekd8_Wv.js} +7 -7
- package/dist/single-run-lock-Dekd8_Wv.js.map +1 -0
- package/dist/{skillopt-optimization-method-kyL94-ri.js → skillopt-optimization-method-5dlex7MJ.js} +1339 -1059
- package/dist/skillopt-optimization-method-5dlex7MJ.js.map +1 -0
- package/dist/{statistical-heldout-C9AbgREN.d.ts → statistical-heldout-BHfLZHrm.d.ts} +2 -2
- package/dist/{statistical-heldout-C9AbgREN.d.ts.map → statistical-heldout-BHfLZHrm.d.ts.map} +1 -1
- package/dist/{summary-report-DM7tlml1.d.ts → summary-report-CkbRcSuu.d.ts} +16 -1
- package/dist/summary-report-CkbRcSuu.d.ts.map +1 -0
- package/dist/supervisor-run/index.d.ts.map +1 -1
- package/dist/supervisor-run/index.js +3 -3
- package/dist/{systemone-Bp_Ac0p1.d.ts → systemone-BMzDJb1i.d.ts} +3 -3
- package/dist/{systemone-Bp_Ac0p1.d.ts.map → systemone-BMzDJb1i.d.ts.map} +1 -1
- package/dist/systemone.d.ts +2 -2
- package/dist/{terminal-record-78g6E4vh.js → terminal-record-D4Rv-j1W.js} +241 -193
- package/dist/{terminal-record-78g6E4vh.js.map → terminal-record-D4Rv-j1W.js.map} +1 -1
- package/dist/trajectory-replay/index.d.ts +4 -1
- package/dist/trajectory-replay/index.d.ts.map +1 -1
- package/dist/trajectory-replay/index.js +834 -824
- package/dist/trajectory-replay/index.js.map +1 -1
- package/dist/{tree-BGRglkKd.js → tree-B5e1uAeL.js} +122 -14
- package/dist/tree-B5e1uAeL.js.map +1 -0
- package/dist/{types-DtMbFw6U.d.ts → types-BKCzzmit.d.ts} +2 -2
- package/dist/{types-DtMbFw6U.d.ts.map → types-BKCzzmit.d.ts.map} +1 -1
- package/dist/{types-D8GhJoHk.d.ts → types-DtkO1G9L.d.ts} +2 -2
- package/dist/{types-D8GhJoHk.d.ts.map → types-DtkO1G9L.d.ts.map} +1 -1
- package/dist/wire/index.js +1 -1
- package/docs/design/statistics-decisions.md +1 -1
- package/docs/eval-surface-map.md +1 -0
- package/docs/profile-json-identity.md +1 -2
- package/docs/public-api.md +27 -16
- package/package.json +7 -2
- package/dist/benchmark-command-xQK8nOI6.js.map +0 -1
- package/dist/define-agent-eval-BDxNlP3D.js.map +0 -1
- package/dist/eval-campaign-BLEfBGbA.js +0 -343
- package/dist/eval-campaign-BLEfBGbA.js.map +0 -1
- package/dist/index-9jJ2fKSX.d.ts.map +0 -1
- package/dist/index-ZuWx52WG.d.ts.map +0 -1
- package/dist/integrity-DOd9Q86O.js.map +0 -1
- package/dist/journal-CR4QikYp.js.map +0 -1
- package/dist/llm-client-BshCREn6.js.map +0 -1
- package/dist/llm-judge-C8jMTNNG.js.map +0 -1
- package/dist/render-C-w2EZ6p.js.map +0 -1
- package/dist/schema-DxcKTzbi.js.map +0 -1
- package/dist/single-run-lock-U58yf8N6.js.map +0 -1
- package/dist/skillopt-optimization-method-kyL94-ri.js.map +0 -1
- package/dist/summary-report-DM7tlml1.d.ts.map +0 -1
- package/dist/tree-BGRglkKd.js.map +0 -1
|
@@ -1,55 +1,12 @@
|
|
|
1
1
|
import { a as hashCanonical } from "./canonical-Dq2hOQ8L.js";
|
|
2
2
|
import { o as summarizeNumberSeries } from "./descriptive-CVNy48rR.js";
|
|
3
3
|
import { t as roundDecimal } from "./round-decimal-COrKglMh.js";
|
|
4
|
-
import { a as nonEmptyString, c as parseSupervisorTree, d as NO_SOURCE_LIMITS, g as unavailable, h as showMeasured, i as asRecord, l as recordOrNull, m as isUnavailable, o as parseJsonRecord, p as SUPERVISOR_RUN_SCHEMA, r as readTerminalRecord, s as parseJsonl, u as workerSourceKey } from "./terminal-record-
|
|
4
|
+
import { a as nonEmptyString, c as parseSupervisorTree, d as NO_SOURCE_LIMITS, g as unavailable, h as showMeasured, i as asRecord, l as recordOrNull, m as isUnavailable, o as parseJsonRecord, p as SUPERVISOR_RUN_SCHEMA, r as readTerminalRecord, s as parseJsonl, u as workerSourceKey } from "./terminal-record-D4Rv-j1W.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { readFile, readdir, stat } from "node:fs/promises";
|
|
7
|
-
//#region src/supervisor-run/
|
|
8
|
-
/**
|
|
9
|
-
function
|
|
10
|
-
const files = /* @__PURE__ */ new Set();
|
|
11
|
-
const testFiles = /* @__PURE__ */ new Set();
|
|
12
|
-
let added = 0;
|
|
13
|
-
let removed = 0;
|
|
14
|
-
for (const line of text.split("\n")) {
|
|
15
|
-
if (line.startsWith("+++ ")) {
|
|
16
|
-
const p = line.slice(4).trim().replace(/^b\//, "");
|
|
17
|
-
if (p !== "/dev/null") {
|
|
18
|
-
files.add(p);
|
|
19
|
-
if (isTestPath(p)) testFiles.add(p);
|
|
20
|
-
}
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
if (line.startsWith("--- ") || line.startsWith("diff --git") || line.startsWith("index ")) continue;
|
|
24
|
-
if (line.startsWith("+")) added += 1;
|
|
25
|
-
else if (line.startsWith("-")) removed += 1;
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
files: files.size,
|
|
29
|
-
linesAdded: added,
|
|
30
|
-
linesRemoved: removed,
|
|
31
|
-
testFilesTouched: [...testFiles].sort()
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function isTestPath(p) {
|
|
35
|
-
const base = p.split("/").pop() ?? p;
|
|
36
|
-
return /(^|\/)(tests?|__tests__|testing|spec)(\/|$)/.test(p) || /\.(test|spec)\.[cm]?[jt]sx?$/.test(base) || /^test_.*\.py$/.test(base) || /_test\.py$/.test(base);
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/supervisor-run/analyze.ts
|
|
40
|
-
/**
|
|
41
|
-
* The pure analyzer. Takes already-read bytes (`SupervisorRunSources`) and
|
|
42
|
-
* returns the report — every metric derivable from a synthetic journal string
|
|
43
|
-
* with no filesystem, no process, and no network. All I/O lives in a reader
|
|
44
|
-
* (`reader.ts` is one).
|
|
45
|
-
*/
|
|
46
|
-
const NO_CACHE_COUNTERS = "the journal carries no cache-token counters for this role";
|
|
47
|
-
const NO_CACHE_BREAKDOWN = "Runtime recorded cacheBreakdownKnown:false — the provider reported a total without splitting cache reads from writes";
|
|
48
|
-
/**
|
|
49
|
-
* Analyze already-read supervisor-run bytes. Pure and synchronous: same bytes
|
|
50
|
-
* in, same report out (modulo `generatedAt`, which `now` pins in tests).
|
|
51
|
-
*/
|
|
52
|
-
function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
7
|
+
//#region src/supervisor-run/analyze-context.ts
|
|
8
|
+
/** The parsed sources and shared lookups every metric group reads. `gap` records an unavailable measurement on the report. */
|
|
9
|
+
function createAnalysis(src) {
|
|
53
10
|
const gaps = [];
|
|
54
11
|
const gap = (what, reason) => {
|
|
55
12
|
gaps.push(`${what}: ${reason}`);
|
|
@@ -84,6 +41,182 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
84
41
|
const matches = spawnsForSource(worker);
|
|
85
42
|
return matches.length === 1 ? matches[0] ?? null : null;
|
|
86
43
|
};
|
|
44
|
+
return {
|
|
45
|
+
src,
|
|
46
|
+
gaps,
|
|
47
|
+
gap,
|
|
48
|
+
journalMissing,
|
|
49
|
+
haveJournal,
|
|
50
|
+
tree,
|
|
51
|
+
state,
|
|
52
|
+
result,
|
|
53
|
+
judge,
|
|
54
|
+
terminal,
|
|
55
|
+
rootId,
|
|
56
|
+
rootSpawn,
|
|
57
|
+
workerSpawns,
|
|
58
|
+
workerCloses,
|
|
59
|
+
startedAt,
|
|
60
|
+
completedAt,
|
|
61
|
+
spawnsForSource,
|
|
62
|
+
spawnForSource,
|
|
63
|
+
closeById: new Map(workerCloses.map((close) => [close.id, close])),
|
|
64
|
+
workersGapReason: src.workersMissingReason ?? "workers/ directory absent"
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/supervisor-run/analyze-decision.ts
|
|
69
|
+
/** Settled verdicts, acceptance and review effort, with a named gap wherever the store never said. */
|
|
70
|
+
function measureDecision(a, m) {
|
|
71
|
+
const { src, gap, journalMissing, haveJournal, tree, workerCloses, spawnForSource, closeById, workersGapReason } = a;
|
|
72
|
+
const { steerQueuedTotal, upLegMessages, queuedGapReason, workerEventsGapReason, observeThenRespawn, respawnWithoutEvidence } = m;
|
|
73
|
+
const settledByStatus = {};
|
|
74
|
+
const settledVerdicts = {};
|
|
75
|
+
for (const c of workerCloses) {
|
|
76
|
+
const key = c.status ?? "unknown";
|
|
77
|
+
settledByStatus[key] = (settledByStatus[key] ?? 0) + 1;
|
|
78
|
+
if (c.verdict !== null) settledVerdicts[c.verdict] = (settledVerdicts[c.verdict] ?? 0) + 1;
|
|
79
|
+
}
|
|
80
|
+
const verdictLimit = src.limits.workerVerdicts;
|
|
81
|
+
const deliverablesLimit = src.limits.deliverables;
|
|
82
|
+
let accepted = 0;
|
|
83
|
+
let emptyPass = 0;
|
|
84
|
+
let evidenceBytes = 0;
|
|
85
|
+
const sourceVerdicts = [];
|
|
86
|
+
for (const w of src.workers ?? []) {
|
|
87
|
+
const f = tree.workerLogs.get(workerSourceKey(w));
|
|
88
|
+
if (f?.finished) evidenceBytes += f.evidenceBytes;
|
|
89
|
+
const spawn = spawnForSource(w);
|
|
90
|
+
const passed = (spawn === null ? null : closeById.get(spawn.id) ?? null)?.valid ?? f?.passed ?? null;
|
|
91
|
+
if (passed !== null) sourceVerdicts.push(passed);
|
|
92
|
+
if (passed === true) {
|
|
93
|
+
if (deliverablesLimit !== null || (w.patchBytes ?? f?.finishedPatchBytes ?? 0) > 0) accepted += 1;
|
|
94
|
+
else emptyPass += 1;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const settledCloses = workerCloses.filter((close) => close.kind === "settled");
|
|
98
|
+
const structuredVerdicts = settledCloses.map((close) => close.valid).filter((valid) => valid !== null);
|
|
99
|
+
const journalVerdictsComplete = settledCloses.length > 0 && structuredVerdicts.length === settledCloses.length;
|
|
100
|
+
const sourceVerdictsComplete = sourceVerdicts.length > 0 && sourceVerdicts.length >= settledCloses.length;
|
|
101
|
+
const rejected = journalVerdictsComplete ? structuredVerdicts.filter((valid) => !valid).length : sourceVerdictsComplete ? sourceVerdicts.filter((valid) => !valid).length : 0;
|
|
102
|
+
const rejectedLimit = journalVerdictsComplete || sourceVerdictsComplete ? null : settledCloses.length > 0 ? verdictLimit ?? "a settled journal verdict has no validity and no matched worker log" : verdictLimit !== null ? verdictLimit : !haveJournal && src.workers === null ? workersGapReason : null;
|
|
103
|
+
return {
|
|
104
|
+
settledByStatus: haveJournal ? settledByStatus : gap("settledByStatus", journalMissing),
|
|
105
|
+
settledVerdicts: verdictLimit !== null ? unavailable(verdictLimit) : haveJournal ? settledVerdicts : unavailable(journalMissing),
|
|
106
|
+
accepted: verdictLimit !== null ? gap("accepted", verdictLimit) : src.workers === null ? unavailable(workersGapReason) : accepted,
|
|
107
|
+
rejected: rejectedLimit === null ? rejected : unavailable(rejectedLimit),
|
|
108
|
+
emptyPass: verdictLimit !== null ? gap("emptyPass", verdictLimit) : deliverablesLimit !== null ? gap("emptyPass", deliverablesLimit) : src.workers === null ? unavailable(workersGapReason) : emptyPass,
|
|
109
|
+
observeThenRespawn: haveJournal ? observeThenRespawn : unavailable(journalMissing),
|
|
110
|
+
respawnWithoutEvidence: haveJournal ? respawnWithoutEvidence : unavailable(journalMissing),
|
|
111
|
+
reviewActions: src.workers === null ? unavailable(workersGapReason) : queuedGapReason === null ? steerQueuedTotal + upLegMessages : unavailable(queuedGapReason),
|
|
112
|
+
workerEvidenceBytes: src.workers === null ? unavailable(workersGapReason) : workerEventsGapReason === null ? evidenceBytes : unavailable(workerEventsGapReason)
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/supervisor-run/analyze-economics.ts
|
|
117
|
+
const NO_CACHE_COUNTERS = "the journal carries no cache-token counters for this role";
|
|
118
|
+
const NO_CACHE_BREAKDOWN = "Runtime recorded cacheBreakdownKnown:false — the provider reported a total without splitting cache reads from writes";
|
|
119
|
+
/** One row per worker log, plus the capture gaps of the root and every worker. */
|
|
120
|
+
function buildPerWorker(a, f, t) {
|
|
121
|
+
const { src, gaps, tree, rootId, spawnsForSource, spawnForSource, closeById } = a;
|
|
122
|
+
const { workerUsdById, workerUsdByLabel } = f;
|
|
123
|
+
const { usdLimit } = t;
|
|
124
|
+
const noteCaptureGaps = (owner, captures) => {
|
|
125
|
+
if (captures === null || captures?.length === 0) gaps.push(`${owner} workspaceCapture: no retained output capture evidence`);
|
|
126
|
+
else if (captures !== void 0) for (const [index, capture] of captures.entries()) {
|
|
127
|
+
const source = `${owner} workspaceCapture[${index + 1}]`;
|
|
128
|
+
if (capture.projectionGap !== null) gaps.push(`${source}: ${capture.projectionGap}`);
|
|
129
|
+
if (capture.coverageComplete === false) gaps.push(`${source}: ${capture.incompleteReason ?? "provider reported incomplete coverage"}`);
|
|
130
|
+
if (capture.coverageComplete === null && capture.projectionGap === null) gaps.push(`${source}: capture coverage was not recorded`);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
noteCaptureGaps(`root ${rootId ?? src.runRef}`, src.rootWorkspaceCaptures);
|
|
134
|
+
return (src.workers ?? []).map((w) => {
|
|
135
|
+
noteCaptureGaps(`worker ${w.workerId ?? w.label}`, w.workspaceCaptures);
|
|
136
|
+
const f = tree.workerLogs.get(workerSourceKey(w));
|
|
137
|
+
const matchingSpawns = spawnsForSource(w);
|
|
138
|
+
const spawn = spawnForSource(w);
|
|
139
|
+
const close = spawn === null ? null : closeById.get(spawn.id) ?? null;
|
|
140
|
+
const passed = close?.valid ?? f?.passed ?? null;
|
|
141
|
+
const matchingRoles = new Set(matchingSpawns.map((candidate) => candidate.role));
|
|
142
|
+
const matchingRuntimes = new Set(matchingSpawns.map((candidate) => candidate.runtime));
|
|
143
|
+
const matchingProfiles = new Set(matchingSpawns.map((candidate) => candidate.profileDigest));
|
|
144
|
+
const journalWallMs = spawn?.at !== null && spawn?.at !== void 0 && close?.at !== null && close?.at !== void 0 && close.at >= spawn.at ? close.at - spawn.at : null;
|
|
145
|
+
return {
|
|
146
|
+
workerId: w.workerId ?? null,
|
|
147
|
+
worker: w.label,
|
|
148
|
+
role: matchingRoles.size === 1 ? matchingSpawns[0]?.role ?? null : null,
|
|
149
|
+
runtime: matchingRuntimes.size === 1 ? matchingSpawns[0]?.runtime ?? null : null,
|
|
150
|
+
profileDigest: matchingProfiles.size === 1 ? matchingSpawns[0]?.profileDigest ?? null : null,
|
|
151
|
+
status: close?.status ?? null,
|
|
152
|
+
failure: close?.reason ?? null,
|
|
153
|
+
infra: close?.infra ?? null,
|
|
154
|
+
wallMs: f?.started != null && f.finishedAt != null ? f.finishedAt - f.started : journalWallMs,
|
|
155
|
+
tokensIn: w.tokensIn ?? (close?.hasSpend === true && close.spend.tokensKnown ? close.spend.tokens.input : null),
|
|
156
|
+
tokensOut: w.tokensOut ?? (close?.hasSpend === true && close.spend.tokensKnown ? close.spend.tokens.output : null),
|
|
157
|
+
usd: usdLimit !== null ? null : w.workerId === void 0 ? workerUsdByLabel.get(w.label) ?? null : workerUsdById.get(w.workerId) ?? null,
|
|
158
|
+
patchBytes: w.patchBytes ?? f?.finishedPatchBytes ?? null,
|
|
159
|
+
passed,
|
|
160
|
+
score: close?.score ?? f?.score ?? null,
|
|
161
|
+
workspaceCaptures: w.workspaceCaptures ?? null
|
|
162
|
+
};
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/** The supervisor brain's tokens, cache and USD. */
|
|
166
|
+
function buildBrainSpend(a, f, t) {
|
|
167
|
+
const { src, gap, journalMissing, haveJournal, tree } = a;
|
|
168
|
+
const { brainTokensUnreported, brainUsdUnreported } = f;
|
|
169
|
+
const { usdLimit } = t;
|
|
170
|
+
const managerTokenLimit = src.limits.managerTokens;
|
|
171
|
+
return {
|
|
172
|
+
tokensIn: managerTokenLimit !== null ? gap("brain.tokensIn", managerTokenLimit) : !haveJournal ? gap("brain.tokensIn", journalMissing) : brainTokensUnreported !== null ? gap("brain.tokensIn", brainTokensUnreported) : tree.brain.tokensIn,
|
|
173
|
+
tokensOut: managerTokenLimit !== null ? unavailable(managerTokenLimit) : !haveJournal ? unavailable(journalMissing) : brainTokensUnreported !== null ? unavailable(brainTokensUnreported) : tree.brain.tokensOut,
|
|
174
|
+
usd: usdLimit !== null ? unavailable(usdLimit) : !haveJournal ? unavailable(journalMissing) : brainUsdUnreported !== null ? unavailable(brainUsdUnreported) : roundDecimal(tree.brain.usd, 6),
|
|
175
|
+
cacheRead: managerTokenLimit !== null ? unavailable(managerTokenLimit) : !haveJournal ? unavailable(journalMissing) : brainTokensUnreported !== null ? unavailable(brainTokensUnreported) : !tree.brain.hasCache ? unavailable(NO_CACHE_COUNTERS) : tree.brain.cacheBreakdownKnown ? tree.brain.cacheRead : unavailable(NO_CACHE_BREAKDOWN),
|
|
176
|
+
cacheWrite: managerTokenLimit !== null ? unavailable(managerTokenLimit) : !haveJournal ? unavailable(journalMissing) : brainTokensUnreported !== null ? unavailable(brainTokensUnreported) : !tree.brain.hasCache ? unavailable(NO_CACHE_COUNTERS) : tree.brain.cacheBreakdownKnown ? tree.brain.cacheWrite : unavailable(NO_CACHE_BREAKDOWN),
|
|
177
|
+
source: managerTokenLimit ?? (haveJournal ? `journal metered events (n=${tree.brain.meteredCount})${tree.brain.usdKnownCount > 0 && tree.brain.usdUnknownCount > 0 ? ` — ${tree.brain.usdUnknownCount} unpriced` : ""}` : journalMissing)
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/** The workers' tokens, cache and USD. */
|
|
181
|
+
function buildWorkerSpend(a, f, t, w) {
|
|
182
|
+
const { src, journalMissing, haveJournal } = a;
|
|
183
|
+
const { rootChildSpends, workerUsdUnknownNodes, journalWorkerUsd, workerUsdUnreported } = f;
|
|
184
|
+
const { usdLimit } = t;
|
|
185
|
+
const { sq, workerTokenLimit, workerIn, workerOut } = w;
|
|
186
|
+
return {
|
|
187
|
+
tokensIn: workerIn,
|
|
188
|
+
tokensOut: workerOut,
|
|
189
|
+
cacheRead: workerTokenLimit !== null ? unavailable(workerTokenLimit) : sq?.cacheRead !== void 0 ? sq.cacheRead : unavailable(NO_CACHE_COUNTERS),
|
|
190
|
+
cacheWrite: workerTokenLimit !== null ? unavailable(workerTokenLimit) : sq?.cacheWrite !== void 0 ? sq.cacheWrite : unavailable(NO_CACHE_COUNTERS),
|
|
191
|
+
usd: usdLimit !== null ? unavailable(usdLimit) : !haveJournal ? unavailable(journalMissing) : workerUsdUnreported !== null ? unavailable(workerUsdUnreported) : roundDecimal(journalWorkerUsd, 6),
|
|
192
|
+
source: `${workerTokenLimit !== null ? workerTokenLimit : sq !== null ? `journal settled spend + ${sq.store} sessions (n=${sq.sessions})` : `journal settled spend only — ${src.harnessMissingReason ?? "harness session store unavailable"}`}${workerUsdUnknownNodes.length > 0 && workerUsdUnknownNodes.length < rootChildSpends.length ? ` — ${workerUsdUnknownNodes.length} unpriced` : ""}`
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function buildEconomics(a, f, t, w, e) {
|
|
196
|
+
const { src, gap, journalMissing, haveJournal, tree, workersGapReason } = a;
|
|
197
|
+
const { rootChildCloses, journalWorkerUsd, usdUnknownRecords } = f;
|
|
198
|
+
const { stateUsd, usdLimit, totalUsd, usdUnreportedReason } = t;
|
|
199
|
+
const { decision, spend, perWorker } = e;
|
|
200
|
+
const wallDistribution = summarizeNumberSeries(perWorker.map((w) => w.wallMs).filter((w) => w !== null));
|
|
201
|
+
const brainCalls = parseJsonl(src.brainLog);
|
|
202
|
+
return {
|
|
203
|
+
resourceRecords: src.journal === null && !tree.resourceRecords?.length ? unavailable(journalMissing) : tree.resourceRecords ?? [],
|
|
204
|
+
brain: buildBrainSpend(a, f, t),
|
|
205
|
+
brainTruncations: src.brainLog === null ? gap("brain.brainTruncations", src.brainLogMissingReason ?? (src.supRunDir === null ? "no Runtime supervisor run directory" : "brain.jsonl absent — this source has no brain-call tap, so truncation cannot be ruled out")) : brainCalls.filter((c) => c.finish_reason === "length").length,
|
|
206
|
+
workers: buildWorkerSpend(a, f, t, w),
|
|
207
|
+
spend,
|
|
208
|
+
totalUsd,
|
|
209
|
+
totalUsdSource: usdLimit !== null ? usdLimit : stateUsd !== null ? `state.json result.spentUsd${rootChildCloses.length > 0 && journalWorkerUsd === 0 ? " — brain-priced only; worker CLI inference is unpriced (see worker token counts)" : ""}` : !haveJournal ? journalMissing : usdUnknownRecords > 0 ? usdUnreportedReason : "journal metered + settled usd",
|
|
210
|
+
costPerAcceptedPatchUsd: isUnavailable(totalUsd) ? unavailable(totalUsd.unavailable) : isUnavailable(decision.accepted) ? unavailable(decision.accepted.unavailable) : decision.accepted === 0 ? unavailable("no accepted worker patch (cost has no denominator)") : roundDecimal(totalUsd / decision.accepted, 6),
|
|
211
|
+
workerWallMsDistribution: wallDistribution === null ? unavailable(src.workers === null ? workersGapReason : "no worker start/finish pairs captured") : wallDistribution,
|
|
212
|
+
perWorker: src.workers === null ? unavailable(workersGapReason) : perWorker
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/supervisor-run/analyze-orchestration.ts
|
|
217
|
+
/** Supervisor wall time and where it ends. Explicit stamps win; the journal span is a lower bound; an inverted stamp pair stays unavailable. */
|
|
218
|
+
function measureWall(a) {
|
|
219
|
+
const { gap, journalMissing, haveJournal, tree, startedAt, completedAt } = a;
|
|
87
220
|
const wallSpanStart = startedAt ?? tree.firstEventAt;
|
|
88
221
|
const wallSpanEnd = tree.lastEventAt;
|
|
89
222
|
let supervisorWallMs;
|
|
@@ -99,7 +232,15 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
99
232
|
supervisorWallMs = gap("supervisorWallMs", reason);
|
|
100
233
|
supervisorWallSource = unavailable(reason);
|
|
101
234
|
}
|
|
102
|
-
|
|
235
|
+
return {
|
|
236
|
+
supervisorWallMs,
|
|
237
|
+
supervisorWallSource,
|
|
238
|
+
wallEndAt: completedAt ?? (supervisorWallSource === "journal-span" ? wallSpanEnd : null)
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/** Steer counts from worker inboxes and the driver log. */
|
|
242
|
+
function measureSteers(a) {
|
|
243
|
+
const { src, gap, tree, workersGapReason } = a;
|
|
103
244
|
const steerRows = [];
|
|
104
245
|
let steerQueuedTotal = 0;
|
|
105
246
|
let steerDeliveredTotal = 0;
|
|
@@ -118,7 +259,6 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
118
259
|
if (queued !== null) steerQueuedTotal += queued;
|
|
119
260
|
if (delivered !== null) steerDeliveredTotal += delivered;
|
|
120
261
|
}
|
|
121
|
-
const workersGapReason = src.workersMissingReason ?? "workers/ directory absent";
|
|
122
262
|
const unavailableReasons = (pick) => {
|
|
123
263
|
const reasons = tree.workerLogRows.map((facts) => pick(facts)).filter((reason) => reason !== null);
|
|
124
264
|
return reasons.length === 0 ? null : `exact steer accounting unavailable for ${reasons.length} worker row(s): ${[...new Set(reasons)].join(" | ")}`;
|
|
@@ -126,10 +266,20 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
126
266
|
const queuedGapReason = unavailableReasons((facts) => facts.steersQueuedUnavailable);
|
|
127
267
|
const deliveredGapReason = unavailableReasons((facts) => facts.steersDeliveredUnavailable);
|
|
128
268
|
const workerEventsGapReason = unavailableReasons((facts) => !facts.eventsCaptured ? "events absent" : facts.eventsInvalidRows > 0 ? "events contain malformed rows" : null);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
269
|
+
return {
|
|
270
|
+
steers: src.workers === null ? gap("steers", workersGapReason) : queuedGapReason === null ? steerQueuedTotal : gap("steers", queuedGapReason),
|
|
271
|
+
steersDelivered: src.workers === null ? unavailable(workersGapReason) : deliveredGapReason === null ? steerDeliveredTotal : unavailable(deliveredGapReason),
|
|
272
|
+
steersByWorker: src.workers === null ? unavailable(workersGapReason) : queuedGapReason === null && deliveredGapReason === null ? steerRows : unavailable(queuedGapReason ?? deliveredGapReason ?? workersGapReason),
|
|
273
|
+
driverSteerCalls: src.driverLog === null ? gap("driverSteerCalls", "driver.log absent") : Math.max(0, (src.driverLog.match(/supervisor_steer/g) ?? []).length - registrationMentions(src.driverLog)),
|
|
274
|
+
steerQueuedTotal,
|
|
275
|
+
upLegMessages,
|
|
276
|
+
queuedGapReason,
|
|
277
|
+
workerEventsGapReason
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
/** Waves, peak concurrency, idle time and summed worker wall from the spawn/close timeline. */
|
|
281
|
+
function measureConcurrency(a, wallEndAt) {
|
|
282
|
+
const { workerSpawns, workerCloses, startedAt } = a;
|
|
133
283
|
const timeline = [];
|
|
134
284
|
for (const s of workerSpawns) if (s.at !== null) timeline.push({
|
|
135
285
|
at: s.at,
|
|
@@ -171,8 +321,17 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
171
321
|
if (live === 0) idleMs += span;
|
|
172
322
|
sumWorkerWallMs += span * live;
|
|
173
323
|
}
|
|
174
|
-
|
|
175
|
-
|
|
324
|
+
return {
|
|
325
|
+
waves,
|
|
326
|
+
waveSizes,
|
|
327
|
+
maxConcurrency,
|
|
328
|
+
idleMs,
|
|
329
|
+
sumWorkerWallMs
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
/** Respawn counts per parent, split by whether a sibling closed in between. */
|
|
333
|
+
function measureRespawns(a) {
|
|
334
|
+
const { workerSpawns, closeById } = a;
|
|
176
335
|
const childSpawnsByParent = /* @__PURE__ */ new Map();
|
|
177
336
|
for (const spawn of workerSpawns) {
|
|
178
337
|
if (spawn.parent === null) continue;
|
|
@@ -205,6 +364,16 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
205
364
|
}
|
|
206
365
|
}
|
|
207
366
|
const repeatedLabels = [...repeatedLabelSet];
|
|
367
|
+
return {
|
|
368
|
+
respawns,
|
|
369
|
+
observeThenRespawn,
|
|
370
|
+
respawnWithoutEvidence,
|
|
371
|
+
repeatedLabels
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
/** The deepest chain of spawns below the root. */
|
|
375
|
+
function measureDelegationDepth(a) {
|
|
376
|
+
const { tree, rootId, workerSpawns } = a;
|
|
208
377
|
const parentOf = new Map(tree.spawns.map((s) => [s.id, s.parent]));
|
|
209
378
|
let delegationDepth = 0;
|
|
210
379
|
for (const s of workerSpawns) {
|
|
@@ -218,7 +387,13 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
218
387
|
}
|
|
219
388
|
if (d > delegationDepth) delegationDepth = d;
|
|
220
389
|
}
|
|
221
|
-
|
|
390
|
+
return delegationDepth;
|
|
391
|
+
}
|
|
392
|
+
function buildOrchestration(a, m) {
|
|
393
|
+
const { gap, journalMissing, haveJournal, workerSpawns, workerCloses, startedAt } = a;
|
|
394
|
+
const { supervisorWallMs, supervisorWallSource, steers, steersDelivered, steersByWorker, driverSteerCalls, waves, waveSizes, maxConcurrency, idleMs, sumWorkerWallMs, respawns, repeatedLabels, delegationDepth } = m;
|
|
395
|
+
const firstWorkerSpawnAt = workerSpawns.reduce((acc, s) => s.at === null ? acc : acc === null ? s.at : Math.min(acc, s.at), null);
|
|
396
|
+
return {
|
|
222
397
|
workersSpawned: haveJournal ? workerSpawns.length : gap("workersSpawned", journalMissing),
|
|
223
398
|
workersSettled: haveJournal ? workerCloses.filter((c) => c.kind === "settled").length : unavailable(journalMissing),
|
|
224
399
|
workersCancelled: haveJournal ? workerCloses.filter((c) => c.kind === "cancelled").length : unavailable(journalMissing),
|
|
@@ -239,47 +414,89 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
239
414
|
idlePct: isUnavailable(supervisorWallMs) || supervisorWallMs === 0 ? isUnavailable(supervisorWallMs) ? unavailable(supervisorWallMs.unavailable) : unavailable("supervisor wall is 0ms") : roundDecimal(idleMs / supervisorWallMs * 100, 1),
|
|
240
415
|
workerUtilization: isUnavailable(supervisorWallMs) || supervisorWallMs === 0 ? isUnavailable(supervisorWallMs) ? unavailable(supervisorWallMs.unavailable) : unavailable("supervisor wall is 0ms") : roundDecimal(sumWorkerWallMs / supervisorWallMs, 3)
|
|
241
416
|
};
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
417
|
+
}
|
|
418
|
+
/** Whether sorted values contain one value in the inclusive interval. */
|
|
419
|
+
function hasNumberBetween(sorted, low, high) {
|
|
420
|
+
let left = 0;
|
|
421
|
+
let right = sorted.length;
|
|
422
|
+
while (left < right) {
|
|
423
|
+
const middle = left + Math.floor((right - left) / 2);
|
|
424
|
+
if (sorted[middle] < low) left = middle + 1;
|
|
425
|
+
else right = middle;
|
|
248
426
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
let
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
427
|
+
return left < sorted.length && sorted[left] <= high;
|
|
428
|
+
}
|
|
429
|
+
/** `[driver] registered tools: …supervisor_steer…` is a banner, not an invocation. */
|
|
430
|
+
function registrationMentions(driverLog) {
|
|
431
|
+
let n = 0;
|
|
432
|
+
for (const line of driverLog.split("\n")) if (line.includes("registered tools:") && line.includes("supervisor_steer")) n += 1;
|
|
433
|
+
return n;
|
|
434
|
+
}
|
|
435
|
+
//#endregion
|
|
436
|
+
//#region src/supervisor-run/patch-stats.ts
|
|
437
|
+
/** Unified-diff stats. Counts `+++ b/<path>` targets, body +/- lines, and test-file touches. */
|
|
438
|
+
function parsePatch(text) {
|
|
439
|
+
const files = /* @__PURE__ */ new Set();
|
|
440
|
+
const testFiles = /* @__PURE__ */ new Set();
|
|
441
|
+
let added = 0;
|
|
442
|
+
let removed = 0;
|
|
443
|
+
for (const line of text.split("\n")) {
|
|
444
|
+
if (line.startsWith("+++ ")) {
|
|
445
|
+
const p = line.slice(4).trim().replace(/^b\//, "");
|
|
446
|
+
if (p !== "/dev/null") {
|
|
447
|
+
files.add(p);
|
|
448
|
+
if (isTestPath(p)) testFiles.add(p);
|
|
449
|
+
}
|
|
450
|
+
continue;
|
|
264
451
|
}
|
|
452
|
+
if (line.startsWith("--- ") || line.startsWith("diff --git") || line.startsWith("index ")) continue;
|
|
453
|
+
if (line.startsWith("+")) added += 1;
|
|
454
|
+
else if (line.startsWith("-")) removed += 1;
|
|
265
455
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const rejectedLimit = journalVerdictsComplete || sourceVerdictsComplete ? null : settledCloses.length > 0 ? verdictLimit ?? "a settled journal verdict has no validity and no matched worker log" : verdictLimit !== null ? verdictLimit : !haveJournal && src.workers === null ? workersGapReason : null;
|
|
272
|
-
const decision = {
|
|
273
|
-
settledByStatus: haveJournal ? settledByStatus : gap("settledByStatus", journalMissing),
|
|
274
|
-
settledVerdicts: verdictLimit !== null ? unavailable(verdictLimit) : haveJournal ? settledVerdicts : unavailable(journalMissing),
|
|
275
|
-
accepted: verdictLimit !== null ? gap("accepted", verdictLimit) : src.workers === null ? unavailable(workersGapReason) : accepted,
|
|
276
|
-
rejected: rejectedLimit === null ? rejected : unavailable(rejectedLimit),
|
|
277
|
-
emptyPass: verdictLimit !== null ? gap("emptyPass", verdictLimit) : deliverablesLimit !== null ? gap("emptyPass", deliverablesLimit) : src.workers === null ? unavailable(workersGapReason) : emptyPass,
|
|
278
|
-
observeThenRespawn: haveJournal ? observeThenRespawn : unavailable(journalMissing),
|
|
279
|
-
respawnWithoutEvidence: haveJournal ? respawnWithoutEvidence : unavailable(journalMissing),
|
|
280
|
-
reviewActions: src.workers === null ? unavailable(workersGapReason) : queuedGapReason === null ? steerQueuedTotal + upLegMessages : unavailable(queuedGapReason),
|
|
281
|
-
workerEvidenceBytes: src.workers === null ? unavailable(workersGapReason) : workerEventsGapReason === null ? evidenceBytes : unavailable(workerEventsGapReason)
|
|
456
|
+
return {
|
|
457
|
+
files: files.size,
|
|
458
|
+
linesAdded: added,
|
|
459
|
+
linesRemoved: removed,
|
|
460
|
+
testFilesTouched: [...testFiles].sort()
|
|
282
461
|
};
|
|
462
|
+
}
|
|
463
|
+
function isTestPath(p) {
|
|
464
|
+
const base = p.split("/").pop() ?? p;
|
|
465
|
+
return /(^|\/)(tests?|__tests__|testing|spec)(\/|$)/.test(p) || /\.(test|spec)\.[cm]?[jt]sx?$/.test(base) || /^test_.*\.py$/.test(base) || /_test\.py$/.test(base);
|
|
466
|
+
}
|
|
467
|
+
//#endregion
|
|
468
|
+
//#region src/supervisor-run/analyze-outcome.ts
|
|
469
|
+
/** Terminal status, verdicts, judge result and the delivered patch. */
|
|
470
|
+
function buildOutcome(a, t) {
|
|
471
|
+
const { src, gap, state, result, judge, terminal } = a;
|
|
472
|
+
const { stateResult } = t;
|
|
473
|
+
const patchStats = src.patch === null ? gap("patch", src.limits.deliverables ?? "delivered patch file absent") : parsePatch(src.patch);
|
|
474
|
+
return {
|
|
475
|
+
supStatus: isUnavailable(terminal.supStatus) ? gap("supStatus", terminal.supStatus.unavailable) : terminal.supStatus,
|
|
476
|
+
supStatusSource: terminal.supStatusSource,
|
|
477
|
+
supReason: terminal.supReason,
|
|
478
|
+
failure: terminal.failure,
|
|
479
|
+
supVerdict: pickString(state, "verdict") ?? pickString(result, "sup_verdict") ?? unavailable("no state.json / result.json verdict"),
|
|
480
|
+
delivered: typeof stateResult.delivered === "boolean" ? stateResult.delivered : typeof result?.delivered === "boolean" ? result.delivered : unavailable("no delivered flag in state.json or result.json"),
|
|
481
|
+
judgeResolved: judge === null ? gap("judge", "judge.json absent") : typeof judge.resolved === "boolean" ? judge.resolved : null,
|
|
482
|
+
judgeScore: judge === null ? unavailable("judge.json absent") : typeof judge.score === "number" ? judge.score : null,
|
|
483
|
+
judgePassed: judge === null ? unavailable("judge.json absent") : typeof judge.passed === "number" ? judge.passed : null,
|
|
484
|
+
judgeTotal: judge === null ? unavailable("judge.json absent") : typeof judge.total === "number" ? judge.total : null,
|
|
485
|
+
verifyPass: typeof result?.verify_pass === "boolean" ? result.verify_pass : gap("verifyPass", "result.json absent or has no verify_pass"),
|
|
486
|
+
verifyRc: typeof result?.verify_rc === "number" ? result.verify_rc : unavailable("result.json absent or has no verify_rc"),
|
|
487
|
+
patch: patchStats,
|
|
488
|
+
judgeSource: src.judgeSource
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
function pickString(rec, key) {
|
|
492
|
+
const v = rec?.[key];
|
|
493
|
+
return typeof v === "string" ? v : null;
|
|
494
|
+
}
|
|
495
|
+
//#endregion
|
|
496
|
+
//#region src/supervisor-run/analyze-spend.ts
|
|
497
|
+
/** Spend records of the root and its children, split into reporting and unreporting. */
|
|
498
|
+
function collectSpendFacts(a) {
|
|
499
|
+
const { tree, rootId, workerSpawns, workerCloses } = a;
|
|
283
500
|
const rootChildIds = new Set(workerSpawns.filter((spawn) => spawn.parent === rootId).map((spawn) => spawn.id));
|
|
284
501
|
const rootChildCloses = workerCloses.filter((close) => rootChildIds.has(close.id));
|
|
285
502
|
const rootChildSpends = rootChildCloses.filter((close) => close.hasSpend);
|
|
@@ -317,17 +534,49 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
317
534
|
};
|
|
318
535
|
const unpriced = (unknown, total, nodes) => `Runtime recorded usdKnown:false on ${unknown} of ${total} spend record(s)${nameNodes(nodes)}`;
|
|
319
536
|
const unreportedTokens = (unknown, total, nodes) => `Runtime recorded tokensKnown:false on ${unknown} of ${total} spend record(s)${nameNodes(nodes)}`;
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
537
|
+
return {
|
|
538
|
+
rootChildCloses,
|
|
539
|
+
rootChildSpends,
|
|
540
|
+
workerUsdUnknownNodes,
|
|
541
|
+
workerTokensUnknownNodes,
|
|
542
|
+
journalWorkerIn,
|
|
543
|
+
journalWorkerOut,
|
|
544
|
+
journalWorkerUsd,
|
|
545
|
+
workerUsdById,
|
|
546
|
+
workerUsdByLabel,
|
|
547
|
+
usdKnownRecords,
|
|
548
|
+
usdUnknownRecords,
|
|
549
|
+
usdUnknownNodes,
|
|
550
|
+
brainUsdUnknownNodes,
|
|
551
|
+
brainTokensUnknownNodes,
|
|
552
|
+
unpriced,
|
|
553
|
+
unreportedTokens,
|
|
554
|
+
usdPartial: usdKnownRecords > 0 && usdUnknownRecords > 0,
|
|
555
|
+
usdAllUnknown: usdKnownRecords === 0 && usdUnknownRecords > 0,
|
|
556
|
+
brainTokensUnreported: tree.brain.tokensUnknownCount === 0 ? null : unreportedTokens(tree.brain.tokensUnknownCount, tree.brain.meteredCount, brainTokensUnknownNodes),
|
|
557
|
+
brainUsdUnreported: tree.brain.usdKnownCount > 0 || tree.brain.usdUnknownCount === 0 ? null : unpriced(tree.brain.usdUnknownCount, tree.brain.meteredCount, brainUsdUnknownNodes),
|
|
558
|
+
workerUsdUnreported: workerUsdUnknownNodes.length === 0 || workerUsdUnknownNodes.length < rootChildSpends.length ? null : unpriced(workerUsdUnknownNodes.length, rootChildSpends.length, workerUsdUnknownNodes)
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
/** Worker token totals: journal spend plus harness session counts, or the reason they are absent. */
|
|
562
|
+
function measureWorkerTokens(a, f) {
|
|
563
|
+
const { src, gap, haveJournal } = a;
|
|
564
|
+
const { rootChildSpends, workerTokensUnknownNodes, journalWorkerIn, journalWorkerOut, unreportedTokens } = f;
|
|
325
565
|
const sq = src.harnessWorkerTokens;
|
|
326
566
|
const harnessGapReason = src.harnessMissingReason ?? "harness session store unavailable and journal settled spend is 0";
|
|
327
567
|
const workerTokenLimit = src.limits.workerTokens;
|
|
328
568
|
const workerTokensUnreported = workerTokensUnknownNodes.length === 0 ? null : unreportedTokens(workerTokensUnknownNodes.length, rootChildSpends.length, workerTokensUnknownNodes);
|
|
329
|
-
|
|
330
|
-
|
|
569
|
+
return {
|
|
570
|
+
sq,
|
|
571
|
+
workerTokenLimit,
|
|
572
|
+
workerIn: workerTokenLimit !== null ? gap("workers.tokensIn", workerTokenLimit) : workerTokensUnreported !== null ? gap("workers.tokensIn", workerTokensUnreported) : sq !== null ? journalWorkerIn + sq.input : haveJournal ? journalWorkerIn : gap("workers.tokensIn", harnessGapReason),
|
|
573
|
+
workerOut: workerTokenLimit !== null ? unavailable(workerTokenLimit) : workerTokensUnreported !== null ? unavailable(workerTokensUnreported) : sq !== null ? journalWorkerOut + sq.output : haveJournal ? journalWorkerOut : unavailable(harnessGapReason)
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
/** Total USD and the close record it is read against. */
|
|
577
|
+
function measureTotalUsd(a, f) {
|
|
578
|
+
const { src, gap, journalMissing, haveJournal, tree, state, result } = a;
|
|
579
|
+
const { journalWorkerUsd, usdKnownRecords, usdUnknownRecords, usdUnknownNodes, unpriced } = f;
|
|
331
580
|
const stateResult = asRecord(state?.result);
|
|
332
581
|
const stateUsd = typeof stateResult.spentUsd === "number" ? stateResult.spentUsd : null;
|
|
333
582
|
const resultSpentTotal = asRecord(result?.spentTotal);
|
|
@@ -336,11 +585,24 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
336
585
|
const usdLimit = src.limits.spendUsd;
|
|
337
586
|
const closeUsdUnreported = stateUsd === null && resultCloseUsd !== null && resultSpentTotal.usdKnown === false;
|
|
338
587
|
const usdUnreportedReason = unpriced(usdUnknownRecords, usdKnownRecords + usdUnknownRecords, usdUnknownNodes);
|
|
339
|
-
|
|
588
|
+
return {
|
|
589
|
+
stateResult,
|
|
590
|
+
stateUsd,
|
|
591
|
+
usdLimit,
|
|
592
|
+
totalUsd: usdLimit !== null ? gap("totalUsd", usdLimit) : stateUsd !== null ? roundDecimal(stateUsd, 6) : !haveJournal ? gap("totalUsd", journalMissing) : usdUnknownRecords > 0 ? gap("totalUsd", usdUnreportedReason) : roundDecimal(tree.brain.usd + journalWorkerUsd, 6),
|
|
593
|
+
closeUsd,
|
|
594
|
+
closeUsdUnreported,
|
|
595
|
+
usdUnreportedReason
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
function buildSpend(a, f, t) {
|
|
599
|
+
const { journalMissing, haveJournal, tree, rootId } = a;
|
|
600
|
+
const { journalWorkerUsd, usdKnownRecords, usdUnknownRecords, usdUnknownNodes, usdPartial, usdAllUnknown } = f;
|
|
601
|
+
const { usdLimit, closeUsd, closeUsdUnreported, usdUnreportedReason } = t;
|
|
340
602
|
const journalSpendRecords = usdKnownRecords;
|
|
341
603
|
const journalDerivedAvailable = usdLimit === null && haveJournal && !usdAllUnknown;
|
|
342
604
|
const closeRecordAvailable = usdLimit === null && closeUsd !== null && !closeUsdUnreported;
|
|
343
|
-
|
|
605
|
+
return {
|
|
344
606
|
journalDerived: {
|
|
345
607
|
usd: journalDerivedAvailable ? roundDecimal(tree.brain.usd + journalWorkerUsd, 6) : unavailable(usdLimit ?? (haveJournal ? usdUnreportedReason : journalMissing)),
|
|
346
608
|
records: journalDerivedAvailable ? journalSpendRecords : 0,
|
|
@@ -356,92 +618,47 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
356
618
|
unknownNodes: closeUsdUnreported && rootId !== null ? [rootId] : []
|
|
357
619
|
}
|
|
358
620
|
};
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
621
|
+
}
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/supervisor-run/analyze.ts
|
|
624
|
+
/**
|
|
625
|
+
* The pure analyzer. Takes already-read bytes (`SupervisorRunSources`) and
|
|
626
|
+
* returns the report — every metric derivable from a synthetic journal string
|
|
627
|
+
* with no filesystem, no process, and no network. All I/O lives in a reader
|
|
628
|
+
* (`reader.ts` is one).
|
|
629
|
+
*
|
|
630
|
+
* The metric groups live in `analyze-*.ts`; this file only runs them in the
|
|
631
|
+
* order the report's `gaps` list is written.
|
|
632
|
+
*/
|
|
633
|
+
/**
|
|
634
|
+
* Analyze already-read supervisor-run bytes. Pure and synchronous: same bytes
|
|
635
|
+
* in, same report out (modulo `generatedAt`, which `now` pins in tests).
|
|
636
|
+
*/
|
|
637
|
+
function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
638
|
+
const a = createAnalysis(src);
|
|
639
|
+
const { gap, gaps, rootId, rootSpawn, journalMissing } = a;
|
|
640
|
+
const wall = measureWall(a);
|
|
641
|
+
const steerFacts = measureSteers(a);
|
|
642
|
+
const concurrency = measureConcurrency(a, wall.wallEndAt);
|
|
643
|
+
const respawns = measureRespawns(a);
|
|
644
|
+
const steps = {
|
|
645
|
+
...wall,
|
|
646
|
+
...steerFacts,
|
|
647
|
+
...concurrency,
|
|
648
|
+
...respawns,
|
|
649
|
+
delegationDepth: measureDelegationDepth(a)
|
|
367
650
|
};
|
|
368
|
-
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
const matchingRuntimes = new Set(matchingSpawns.map((candidate) => candidate.runtime));
|
|
378
|
-
const matchingProfiles = new Set(matchingSpawns.map((candidate) => candidate.profileDigest));
|
|
379
|
-
const journalWallMs = spawn?.at !== null && spawn?.at !== void 0 && close?.at !== null && close?.at !== void 0 && close.at >= spawn.at ? close.at - spawn.at : null;
|
|
380
|
-
return {
|
|
381
|
-
workerId: w.workerId ?? null,
|
|
382
|
-
worker: w.label,
|
|
383
|
-
role: matchingRoles.size === 1 ? matchingSpawns[0]?.role ?? null : null,
|
|
384
|
-
runtime: matchingRuntimes.size === 1 ? matchingSpawns[0]?.runtime ?? null : null,
|
|
385
|
-
profileDigest: matchingProfiles.size === 1 ? matchingSpawns[0]?.profileDigest ?? null : null,
|
|
386
|
-
status: close?.status ?? null,
|
|
387
|
-
failure: close?.reason ?? null,
|
|
388
|
-
infra: close?.infra ?? null,
|
|
389
|
-
wallMs: f?.started != null && f.finishedAt != null ? f.finishedAt - f.started : journalWallMs,
|
|
390
|
-
tokensIn: w.tokensIn ?? (close?.hasSpend === true && close.spend.tokensKnown ? close.spend.tokens.input : null),
|
|
391
|
-
tokensOut: w.tokensOut ?? (close?.hasSpend === true && close.spend.tokensKnown ? close.spend.tokens.output : null),
|
|
392
|
-
usd: usdLimit !== null ? null : w.workerId === void 0 ? workerUsdByLabel.get(w.label) ?? null : workerUsdById.get(w.workerId) ?? null,
|
|
393
|
-
patchBytes: w.patchBytes ?? f?.finishedPatchBytes ?? null,
|
|
394
|
-
passed,
|
|
395
|
-
score: close?.score ?? f?.score ?? null,
|
|
396
|
-
workspaceCaptures: w.workspaceCaptures ?? null
|
|
397
|
-
};
|
|
651
|
+
const orchestration = buildOrchestration(a, steps);
|
|
652
|
+
const decision = measureDecision(a, steps);
|
|
653
|
+
const spendFacts = collectSpendFacts(a);
|
|
654
|
+
const tokens = measureWorkerTokens(a, spendFacts);
|
|
655
|
+
const totals = measureTotalUsd(a, spendFacts);
|
|
656
|
+
const economics = buildEconomics(a, spendFacts, totals, tokens, {
|
|
657
|
+
decision,
|
|
658
|
+
spend: buildSpend(a, spendFacts, totals),
|
|
659
|
+
perWorker: buildPerWorker(a, spendFacts, totals)
|
|
398
660
|
});
|
|
399
|
-
const
|
|
400
|
-
const brainCalls = parseJsonl(src.brainLog);
|
|
401
|
-
const managerTokenLimit = src.limits.managerTokens;
|
|
402
|
-
const economics = {
|
|
403
|
-
resourceRecords: src.journal === null && !tree.resourceRecords?.length ? unavailable(journalMissing) : tree.resourceRecords ?? [],
|
|
404
|
-
brain: {
|
|
405
|
-
tokensIn: managerTokenLimit !== null ? gap("brain.tokensIn", managerTokenLimit) : !haveJournal ? gap("brain.tokensIn", journalMissing) : brainTokensUnreported !== null ? gap("brain.tokensIn", brainTokensUnreported) : tree.brain.tokensIn,
|
|
406
|
-
tokensOut: managerTokenLimit !== null ? unavailable(managerTokenLimit) : !haveJournal ? unavailable(journalMissing) : brainTokensUnreported !== null ? unavailable(brainTokensUnreported) : tree.brain.tokensOut,
|
|
407
|
-
usd: usdLimit !== null ? unavailable(usdLimit) : !haveJournal ? unavailable(journalMissing) : brainUsdUnreported !== null ? unavailable(brainUsdUnreported) : roundDecimal(tree.brain.usd, 6),
|
|
408
|
-
cacheRead: managerTokenLimit !== null ? unavailable(managerTokenLimit) : !haveJournal ? unavailable(journalMissing) : brainTokensUnreported !== null ? unavailable(brainTokensUnreported) : !tree.brain.hasCache ? unavailable(NO_CACHE_COUNTERS) : tree.brain.cacheBreakdownKnown ? tree.brain.cacheRead : unavailable(NO_CACHE_BREAKDOWN),
|
|
409
|
-
cacheWrite: managerTokenLimit !== null ? unavailable(managerTokenLimit) : !haveJournal ? unavailable(journalMissing) : brainTokensUnreported !== null ? unavailable(brainTokensUnreported) : !tree.brain.hasCache ? unavailable(NO_CACHE_COUNTERS) : tree.brain.cacheBreakdownKnown ? tree.brain.cacheWrite : unavailable(NO_CACHE_BREAKDOWN),
|
|
410
|
-
source: managerTokenLimit ?? (haveJournal ? `journal metered events (n=${tree.brain.meteredCount})${tree.brain.usdKnownCount > 0 && tree.brain.usdUnknownCount > 0 ? ` — ${tree.brain.usdUnknownCount} unpriced` : ""}` : journalMissing)
|
|
411
|
-
},
|
|
412
|
-
brainTruncations: src.brainLog === null ? gap("brain.brainTruncations", src.brainLogMissingReason ?? (src.supRunDir === null ? "no Runtime supervisor run directory" : "brain.jsonl absent — this source has no brain-call tap, so truncation cannot be ruled out")) : brainCalls.filter((c) => c.finish_reason === "length").length,
|
|
413
|
-
workers: {
|
|
414
|
-
tokensIn: workerIn,
|
|
415
|
-
tokensOut: workerOut,
|
|
416
|
-
cacheRead: workerTokenLimit !== null ? unavailable(workerTokenLimit) : sq?.cacheRead !== void 0 ? sq.cacheRead : unavailable(NO_CACHE_COUNTERS),
|
|
417
|
-
cacheWrite: workerTokenLimit !== null ? unavailable(workerTokenLimit) : sq?.cacheWrite !== void 0 ? sq.cacheWrite : unavailable(NO_CACHE_COUNTERS),
|
|
418
|
-
usd: usdLimit !== null ? unavailable(usdLimit) : !haveJournal ? unavailable(journalMissing) : workerUsdUnreported !== null ? unavailable(workerUsdUnreported) : roundDecimal(journalWorkerUsd, 6),
|
|
419
|
-
source: `${workerTokenLimit !== null ? workerTokenLimit : sq !== null ? `journal settled spend + ${sq.store} sessions (n=${sq.sessions})` : `journal settled spend only — ${src.harnessMissingReason ?? "harness session store unavailable"}`}${workerUsdUnknownNodes.length > 0 && workerUsdUnknownNodes.length < rootChildSpends.length ? ` — ${workerUsdUnknownNodes.length} unpriced` : ""}`
|
|
420
|
-
},
|
|
421
|
-
spend,
|
|
422
|
-
totalUsd,
|
|
423
|
-
totalUsdSource: usdLimit !== null ? usdLimit : stateUsd !== null ? `state.json result.spentUsd${rootChildCloses.length > 0 && journalWorkerUsd === 0 ? " — brain-priced only; worker CLI inference is unpriced (see worker token counts)" : ""}` : !haveJournal ? journalMissing : usdUnknownRecords > 0 ? usdUnreportedReason : "journal metered + settled usd",
|
|
424
|
-
costPerAcceptedPatchUsd: isUnavailable(totalUsd) ? unavailable(totalUsd.unavailable) : isUnavailable(decision.accepted) ? unavailable(decision.accepted.unavailable) : decision.accepted === 0 ? unavailable("no accepted worker patch (cost has no denominator)") : roundDecimal(totalUsd / decision.accepted, 6),
|
|
425
|
-
workerWallMsDistribution: wallDistribution === null ? unavailable(src.workers === null ? workersGapReason : "no worker start/finish pairs captured") : wallDistribution,
|
|
426
|
-
perWorker: src.workers === null ? unavailable(workersGapReason) : perWorker
|
|
427
|
-
};
|
|
428
|
-
const patchStats = src.patch === null ? gap("patch", src.limits.deliverables ?? "delivered patch file absent") : parsePatch(src.patch);
|
|
429
|
-
const outcome = {
|
|
430
|
-
supStatus: isUnavailable(terminal.supStatus) ? gap("supStatus", terminal.supStatus.unavailable) : terminal.supStatus,
|
|
431
|
-
supStatusSource: terminal.supStatusSource,
|
|
432
|
-
supReason: terminal.supReason,
|
|
433
|
-
failure: terminal.failure,
|
|
434
|
-
supVerdict: pickString(state, "verdict") ?? pickString(result, "sup_verdict") ?? unavailable("no state.json / result.json verdict"),
|
|
435
|
-
delivered: typeof stateResult.delivered === "boolean" ? stateResult.delivered : typeof result?.delivered === "boolean" ? result.delivered : unavailable("no delivered flag in state.json or result.json"),
|
|
436
|
-
judgeResolved: judge === null ? gap("judge", "judge.json absent") : typeof judge.resolved === "boolean" ? judge.resolved : null,
|
|
437
|
-
judgeScore: judge === null ? unavailable("judge.json absent") : typeof judge.score === "number" ? judge.score : null,
|
|
438
|
-
judgePassed: judge === null ? unavailable("judge.json absent") : typeof judge.passed === "number" ? judge.passed : null,
|
|
439
|
-
judgeTotal: judge === null ? unavailable("judge.json absent") : typeof judge.total === "number" ? judge.total : null,
|
|
440
|
-
verifyPass: typeof result?.verify_pass === "boolean" ? result.verify_pass : gap("verifyPass", "result.json absent or has no verify_pass"),
|
|
441
|
-
verifyRc: typeof result?.verify_rc === "number" ? result.verify_rc : unavailable("result.json absent or has no verify_rc"),
|
|
442
|
-
patch: patchStats,
|
|
443
|
-
judgeSource: src.judgeSource
|
|
444
|
-
};
|
|
661
|
+
const outcome = buildOutcome(a, totals);
|
|
445
662
|
return {
|
|
446
663
|
schema: SUPERVISOR_RUN_SCHEMA,
|
|
447
664
|
runRef: src.runRef,
|
|
@@ -459,27 +676,6 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
459
676
|
traceCommand: src.traceCommand ?? "npx --yes @tangle-network/traces@latest analyze --harness opencode --cwd <worker-clone-cwd>"
|
|
460
677
|
};
|
|
461
678
|
}
|
|
462
|
-
/** Whether sorted values contain one value in the inclusive interval. */
|
|
463
|
-
function hasNumberBetween(sorted, low, high) {
|
|
464
|
-
let left = 0;
|
|
465
|
-
let right = sorted.length;
|
|
466
|
-
while (left < right) {
|
|
467
|
-
const middle = left + Math.floor((right - left) / 2);
|
|
468
|
-
if (sorted[middle] < low) left = middle + 1;
|
|
469
|
-
else right = middle;
|
|
470
|
-
}
|
|
471
|
-
return left < sorted.length && sorted[left] <= high;
|
|
472
|
-
}
|
|
473
|
-
/** `[driver] registered tools: …supervisor_steer…` is a banner, not an invocation. */
|
|
474
|
-
function registrationMentions(driverLog) {
|
|
475
|
-
let n = 0;
|
|
476
|
-
for (const line of driverLog.split("\n")) if (line.includes("registered tools:") && line.includes("supervisor_steer")) n += 1;
|
|
477
|
-
return n;
|
|
478
|
-
}
|
|
479
|
-
function pickString(rec, key) {
|
|
480
|
-
const v = rec?.[key];
|
|
481
|
-
return typeof v === "string" ? v : null;
|
|
482
|
-
}
|
|
483
679
|
//#endregion
|
|
484
680
|
//#region src/supervisor-run/coordination-reader.ts
|
|
485
681
|
/**
|
|
@@ -1433,4 +1629,4 @@ function renderSupervisorRollupMarkdown(rollup, title = "Round rollup") {
|
|
|
1433
1629
|
//#endregion
|
|
1434
1630
|
export { findSupervisorRunDirs as a, analyzeSupervisorRunSources as c, analyzeSupervisorRun as i, parsePatch as l, renderSupervisorRunHeadline as n, isRuntimeSupervisorRunDir as o, renderSupervisorRunMarkdown as r, readRuntimeSupervisorRun as s, renderSupervisorRollupMarkdown as t };
|
|
1435
1631
|
|
|
1436
|
-
//# sourceMappingURL=render-
|
|
1632
|
+
//# sourceMappingURL=render-Cs34y0iX.js.map
|