@tangle-network/agent-eval 0.136.0 → 0.137.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 +38 -1
- package/README.md +4 -2
- package/dist/{agent-profile-cell-OhuTee9n.js → agent-profile-cell-CbfBm2g6.js} +2 -2
- package/dist/{agent-profile-cell-OhuTee9n.js.map → agent-profile-cell-CbfBm2g6.js.map} +1 -1
- package/dist/{agent-profile-cell-CCm3l2v2.d.ts → agent-profile-cell-Cw0PVwDr.d.ts} +2 -2
- package/dist/{agent-profile-cell-CCm3l2v2.d.ts.map → agent-profile-cell-Cw0PVwDr.d.ts.map} +1 -1
- package/dist/analyst/index.d.ts +139 -17
- package/dist/analyst/index.d.ts.map +1 -1
- package/dist/analyst/index.js +606 -4
- package/dist/analyst/index.js.map +1 -1
- package/dist/{analyze-runs-jjCmF8pU.js → analyze-runs-BScZvqMV.js} +6 -6
- package/dist/{analyze-runs-jjCmF8pU.js.map → analyze-runs-BScZvqMV.js.map} +1 -1
- package/dist/{analyze-runs-Cda5Xkj1.d.ts → analyze-runs-PVtnfjvA.d.ts} +6 -6
- package/dist/{analyze-runs-Cda5Xkj1.d.ts.map → analyze-runs-PVtnfjvA.d.ts.map} +1 -1
- package/dist/{baseline-BUeFcgrn.js → baseline-C-GocmIW.js} +2 -2
- package/dist/{baseline-BUeFcgrn.js.map → baseline-C-GocmIW.js.map} +1 -1
- package/dist/benchmark-CHX4orG7.d.ts +184 -0
- package/dist/benchmark-CHX4orG7.d.ts.map +1 -0
- package/dist/benchmark-YDrpumqB.js +414 -0
- package/dist/benchmark-YDrpumqB.js.map +1 -0
- package/dist/benchmarks/index.d.ts +1 -1
- package/dist/benchmarks/index.js +1 -1
- package/dist/{benchmarks-Dfgm9ts5.js → benchmarks-DCLkQOmc.js} +3 -3
- package/dist/{benchmarks-Dfgm9ts5.js.map → benchmarks-DCLkQOmc.js.map} +1 -1
- package/dist/builder-eval/index.js +2 -2
- package/dist/campaign/index.d.ts +6 -6
- package/dist/campaign/index.js +3 -3
- package/dist/{campaign-Dz8uQnhC.js → campaign-lgObcHFC.js} +212 -78
- package/dist/campaign-lgObcHFC.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/client-C8L6h6Wf.d.ts +202 -0
- package/dist/client-C8L6h6Wf.d.ts.map +1 -0
- package/dist/completion-verifier-DSyRNVzU.d.ts +240 -0
- package/dist/completion-verifier-DSyRNVzU.d.ts.map +1 -0
- package/dist/contract/index.d.ts +10 -9
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/contract/index.js +10 -10
- package/dist/control.d.ts +2 -2
- package/dist/control.js +1 -1
- package/dist/{cost-ledger-DHAjwNj7.js → cost-ledger-D-5_-dhi.js} +2 -2
- package/dist/{cost-ledger-DHAjwNj7.js.map → cost-ledger-D-5_-dhi.js.map} +1 -1
- package/dist/{cost-ledger-fGS_u_O1.d.ts → cost-ledger-D2o6JOrL.d.ts} +2 -2
- package/dist/{cost-ledger-fGS_u_O1.d.ts.map → cost-ledger-D2o6JOrL.d.ts.map} +1 -1
- package/dist/{dataset-BvtnC8Dc.d.ts → dataset-v_Y5902-.d.ts} +2 -2
- package/dist/{dataset-BvtnC8Dc.d.ts.map → dataset-v_Y5902-.d.ts.map} +1 -1
- package/dist/{default-registry-CHmdy2An.js → default-registry-CLXbRt0f.js} +119 -38
- package/dist/default-registry-CLXbRt0f.js.map +1 -0
- package/dist/{default-registry-Brxr728w.d.ts → default-registry-Dc5D_Loc.d.ts} +63 -137
- package/dist/default-registry-Dc5D_Loc.d.ts.map +1 -0
- package/dist/{errors-8YnH8WlF.js → errors-D-LKuDhb.js} +8 -2
- package/dist/errors-D-LKuDhb.js.map +1 -0
- package/dist/{errors-CEk209JS.d.ts → errors-DkfjIDvD.d.ts} +9 -3
- package/dist/errors-DkfjIDvD.d.ts.map +1 -0
- package/dist/{eval-campaign-Cc8WZJ6b.js → eval-campaign-CHqfLnff.js} +6 -6
- package/dist/{eval-campaign-Cc8WZJ6b.js.map → eval-campaign-CHqfLnff.js.map} +1 -1
- package/dist/{extract-usage-DIQpN-ww.js → extract-usage-p-56bh8q.js} +3 -3
- package/dist/{extract-usage-DIQpN-ww.js.map → extract-usage-p-56bh8q.js.map} +1 -1
- package/dist/{feedback-trajectory-CVaeREXV.d.ts → feedback-trajectory-N_F0PwHz.d.ts} +90 -3
- package/dist/feedback-trajectory-N_F0PwHz.d.ts.map +1 -0
- package/dist/fuzz.d.ts +1 -1
- package/dist/fuzz.js +2 -2
- package/dist/hosted/index.d.ts +3 -2
- package/dist/hosted/index.d.ts.map +1 -1
- package/dist/index-BipJlj-C.d.ts +316 -0
- package/dist/index-BipJlj-C.d.ts.map +1 -0
- package/dist/{index-CQsJcqch.d.ts → index-BnP1QJUv.d.ts} +5 -5
- package/dist/{index-CQsJcqch.d.ts.map → index-BnP1QJUv.d.ts.map} +1 -1
- package/dist/{index-B4Fjfo5U.d.ts → index-C-Pr4OWg.d.ts} +88 -317
- package/dist/index-C-Pr4OWg.d.ts.map +1 -0
- package/dist/{index-DuhJaaiH.d.ts → index-DEb46kc6.d.ts} +2 -2
- package/dist/{index-DuhJaaiH.d.ts.map → index-DEb46kc6.d.ts.map} +1 -1
- package/dist/{index-C2fkZhv_.d.ts → index-DRNl6g_N.d.ts} +3 -3
- package/dist/{index-C2fkZhv_.d.ts.map → index-DRNl6g_N.d.ts.map} +1 -1
- package/dist/{index-AbhwHp0V.d.ts → index-U3RHOShi.d.ts} +2 -2
- package/dist/{index-AbhwHp0V.d.ts.map → index-U3RHOShi.d.ts.map} +1 -1
- package/dist/index.d.ts +29 -70
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +507 -33
- package/dist/index.js.map +1 -1
- package/dist/{client-DcvgkaZi.d.ts → insight-report-B9ooYH_g.d.ts} +5 -203
- package/dist/insight-report-B9ooYH_g.d.ts.map +1 -0
- package/dist/integrity-CCXTftiL.js +1360 -0
- package/dist/integrity-CCXTftiL.js.map +1 -0
- package/dist/{integrity-rmVhXWA7.d.ts → integrity-CKxosZ5Z.d.ts} +3 -3
- package/dist/{integrity-rmVhXWA7.d.ts.map → integrity-CKxosZ5Z.d.ts.map} +1 -1
- package/dist/{integrity-BzRbCHzi.js → integrity-fdt8XPAv.js} +2 -2
- package/dist/{integrity-BzRbCHzi.js.map → integrity-fdt8XPAv.js.map} +1 -1
- package/dist/ledger-core/index.d.ts +1 -1
- package/dist/ledger-core/index.js +1 -1
- package/dist/{ledger-core-DAKFKRzi.js → ledger-core-t6sItivm.js} +85 -85
- package/dist/{ledger-core-DAKFKRzi.js.map → ledger-core-t6sItivm.js.map} +1 -1
- package/dist/{llm-client-DHx8pzyJ.js → llm-client-DKB25jV8.js} +3 -3
- package/dist/{llm-client-DHx8pzyJ.js.map → llm-client-DKB25jV8.js.map} +1 -1
- package/dist/meta-eval/index.d.ts +2 -2
- package/dist/meta-eval/index.js +3 -3
- package/dist/{mint-DyRUc9k6.js → mint-Ctwk079K.js} +4 -4
- package/dist/{mint-DyRUc9k6.js.map → mint-Ctwk079K.js.map} +1 -1
- package/dist/multishot/index.d.ts +2 -2
- package/dist/openapi.json +1 -1
- package/dist/{paired-arms-BbFKrAU-.js → paired-arms-iZ08VFMN.js} +3 -3
- package/dist/{paired-arms-BbFKrAU-.js.map → paired-arms-iZ08VFMN.js.map} +1 -1
- package/dist/pipelines/index.js +2 -2
- package/dist/profile-cell.d.ts +1 -1
- package/dist/profile-cell.js +1 -1
- package/dist/{propose-review-control-SQ-n9-We.js → propose-review-control-DLXz4FCX.js} +2 -2
- package/dist/{propose-review-control-SQ-n9-We.js.map → propose-review-control-DLXz4FCX.js.map} +1 -1
- package/dist/registry-BdM7SuTr.d.ts +124 -0
- package/dist/registry-BdM7SuTr.d.ts.map +1 -0
- package/dist/{release-report-DooPguBc.js → release-report-B5XPBvAU.js} +4 -4
- package/dist/{release-report-DooPguBc.js.map → release-report-B5XPBvAU.js.map} +1 -1
- package/dist/{release-report-DpBxGGI1.d.ts → release-report-CofgVNZt.d.ts} +4 -4
- package/dist/{release-report-DpBxGGI1.d.ts.map → release-report-CofgVNZt.d.ts.map} +1 -1
- package/dist/{replay-C6wRg47C.js → replay-Bju0T8Ls.js} +248 -8
- package/dist/replay-Bju0T8Ls.js.map +1 -0
- package/dist/{replay-BRfMIs81.d.ts → replay-K8FaC0CB.d.ts} +227 -52
- package/dist/replay-K8FaC0CB.d.ts.map +1 -0
- package/dist/reporting.d.ts +4 -4
- package/dist/reporting.js +4 -4
- package/dist/{researcher-Doo95b50.d.ts → researcher-Da0Wj-bt.d.ts} +6 -7
- package/dist/researcher-Da0Wj-bt.d.ts.map +1 -0
- package/dist/{reward-hacking-D-QqXvg-.d.ts → reward-hacking-CQ3hTCO3.d.ts} +2 -2
- package/dist/{reward-hacking-D-QqXvg-.d.ts.map → reward-hacking-CQ3hTCO3.d.ts.map} +1 -1
- package/dist/{reward-hacking-a-kYs0-i.js → reward-hacking-GyN0kMd8.js} +3 -3
- package/dist/{reward-hacking-a-kYs0-i.js.map → reward-hacking-GyN0kMd8.js.map} +1 -1
- package/dist/rl.d.ts +6 -6
- package/dist/rl.js +9 -9
- package/dist/rollout/index.d.ts +1 -1
- package/dist/rollout/index.js +3 -3
- package/dist/{rollout-DLSUIWLu.js → rollout-DQFl0UXA.js} +2 -2
- package/dist/{rollout-DLSUIWLu.js.map → rollout-DQFl0UXA.js.map} +1 -1
- package/dist/{rubric-predictive-validity-BJf-8ejY.js → rubric-predictive-validity-BRR632r1.js} +2 -2
- package/dist/{rubric-predictive-validity-BJf-8ejY.js.map → rubric-predictive-validity-BRR632r1.js.map} +1 -1
- package/dist/{rubric-predictive-validity-C1dCLcvb.d.ts → rubric-predictive-validity-C4sztLR3.d.ts} +2 -2
- package/dist/{rubric-predictive-validity-C1dCLcvb.d.ts.map → rubric-predictive-validity-C4sztLR3.d.ts.map} +1 -1
- package/dist/{run-evidence-DokQtX0-.d.ts → run-evidence-BDIircdA.d.ts} +3 -3
- package/dist/{run-evidence-DokQtX0-.d.ts.map → run-evidence-BDIircdA.d.ts.map} +1 -1
- package/dist/{run-record-DcObtIGh.d.ts → run-record-BPCa2rQ8.d.ts} +4 -4
- package/dist/{run-record-DcObtIGh.d.ts.map → run-record-BPCa2rQ8.d.ts.map} +1 -1
- package/dist/{run-record-BIwU2wdV.js → run-record-vRgqWmJw.js} +3 -3
- package/dist/{run-record-BIwU2wdV.js.map → run-record-vRgqWmJw.js.map} +1 -1
- package/dist/{semantic-concept-judge-Btozx3Vc.js → semantic-concept-judge-Bz64IckK.js} +4 -4
- package/dist/{semantic-concept-judge-Btozx3Vc.js.map → semantic-concept-judge-Bz64IckK.js.map} +1 -1
- package/dist/{server-Bz3WQJs6.js → server-KjXZZUDX.js} +3 -3
- package/dist/{server-Bz3WQJs6.js.map → server-KjXZZUDX.js.map} +1 -1
- package/dist/{skill-usage-BDQVPIG1.d.ts → skill-usage-CFDLLlhF.d.ts} +25 -47
- package/dist/skill-usage-CFDLLlhF.d.ts.map +1 -0
- package/dist/{skillopt-optimization-method-CwSYkv35.d.ts → skillopt-optimization-method-BpbnlvAZ.d.ts} +11 -12
- package/dist/skillopt-optimization-method-BpbnlvAZ.d.ts.map +1 -0
- package/dist/{skillopt-optimization-method-0UmPD6aP.js → skillopt-optimization-method-f4o9sUT4.js} +7 -7
- package/dist/{skillopt-optimization-method-0UmPD6aP.js.map → skillopt-optimization-method-f4o9sUT4.js.map} +1 -1
- package/dist/{statistics-CnGCLLqc.js → statistics-ByxzSiOM.js} +2 -2
- package/dist/{statistics-CnGCLLqc.js.map → statistics-ByxzSiOM.js.map} +1 -1
- package/dist/{statistics-CKOqre5S.d.ts → statistics-_7P642CN.d.ts} +2 -2
- package/dist/{statistics-CKOqre5S.d.ts.map → statistics-_7P642CN.d.ts.map} +1 -1
- package/dist/{summary-report-BEk8OFLs.js → summary-report-9A5y7EsK.js} +4 -4
- package/dist/{summary-report-BEk8OFLs.js.map → summary-report-9A5y7EsK.js.map} +1 -1
- package/dist/{summary-report-CPMINBqs.d.ts → summary-report-DHipz9Kx.d.ts} +3 -3
- package/dist/{summary-report-CPMINBqs.d.ts.map → summary-report-DHipz9Kx.d.ts.map} +1 -1
- package/dist/supervisor-run/index.d.ts +3 -2
- package/dist/supervisor-run/index.js +3 -2
- package/dist/{supervisor-run-Dr5HnTup.js → supervisor-run-B2EWUmQY.js} +28 -454
- package/dist/supervisor-run-B2EWUmQY.js.map +1 -0
- package/dist/{test-graded-scenario-BsqWLmPt.js → test-graded-scenario-JHcKQNpq.js} +2 -2
- package/dist/{test-graded-scenario-BsqWLmPt.js.map → test-graded-scenario-JHcKQNpq.js.map} +1 -1
- package/dist/tools-DZk2Jn64.js +1876 -0
- package/dist/tools-DZk2Jn64.js.map +1 -0
- package/dist/traces.d.ts +6 -7
- package/dist/traces.js +5 -6
- package/dist/{types-DVjczBM9.d.ts → types-CKswbJGO.d.ts} +260 -6
- package/dist/types-CKswbJGO.d.ts.map +1 -0
- package/dist/{types-DiWLru6Z.d.ts → types-CTGbIm57.d.ts} +5 -5
- package/dist/{types-DiWLru6Z.d.ts.map → types-CTGbIm57.d.ts.map} +1 -1
- package/dist/types-CTvKfr5F.d.ts +804 -0
- package/dist/types-CTvKfr5F.d.ts.map +1 -0
- package/dist/{index-CyC1BTmn.d.ts → types-Dea6tiVI.d.ts} +16 -238
- package/dist/types-Dea6tiVI.d.ts.map +1 -0
- package/dist/wire/index.d.ts +3 -3
- package/dist/wire/index.js +1 -1
- package/docs/feedback-trajectories.md +100 -1
- package/docs/trace-analysis.md +374 -58
- package/package.json +5 -1
- package/dist/analyst-BkTS3C58.d.ts +0 -89
- package/dist/analyst-BkTS3C58.d.ts.map +0 -1
- package/dist/analyst-j5je5J7c.js +0 -152
- package/dist/analyst-j5je5J7c.js.map +0 -1
- package/dist/campaign-Dz8uQnhC.js.map +0 -1
- package/dist/client-DcvgkaZi.d.ts.map +0 -1
- package/dist/default-registry-Brxr728w.d.ts.map +0 -1
- package/dist/default-registry-CHmdy2An.js.map +0 -1
- package/dist/errors-8YnH8WlF.js.map +0 -1
- package/dist/errors-CEk209JS.d.ts.map +0 -1
- package/dist/feedback-trajectory-CVaeREXV.d.ts.map +0 -1
- package/dist/index-B4Fjfo5U.d.ts.map +0 -1
- package/dist/index-CyC1BTmn.d.ts.map +0 -1
- package/dist/llm-client-BiK4HW0u.d.ts +0 -290
- package/dist/llm-client-BiK4HW0u.d.ts.map +0 -1
- package/dist/raw-provider-sink-BU29Sh8h.d.ts +0 -134
- package/dist/raw-provider-sink-BU29Sh8h.d.ts.map +0 -1
- package/dist/replay-BRfMIs81.d.ts.map +0 -1
- package/dist/replay-C6wRg47C.js.map +0 -1
- package/dist/researcher-Doo95b50.d.ts.map +0 -1
- package/dist/skill-usage-BDQVPIG1.d.ts.map +0 -1
- package/dist/skillopt-optimization-method-CwSYkv35.d.ts.map +0 -1
- package/dist/store-CxJry_cs.d.ts +0 -229
- package/dist/store-CxJry_cs.d.ts.map +0 -1
- package/dist/supervisor-run-Dr5HnTup.js.map +0 -1
- package/dist/tools-D8yTtNSN.js +0 -1190
- package/dist/tools-D8yTtNSN.js.map +0 -1
- package/dist/types-Cc3qbqzj.d.ts +0 -387
- package/dist/types-Cc3qbqzj.d.ts.map +0 -1
- package/dist/types-DVjczBM9.d.ts.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { f as isRolloutLine, i as ROLLOUT_SCHEMA } from "./schema-C6DW4ZHR.js";
|
|
1
|
+
import { a as parseJsonl, i as parseJson, o as parseSupervisorTree, r as asRecord, s as workerSourceKey } from "./integrity-CCXTftiL.js";
|
|
3
2
|
import { d as transcriptFromEntries, i as openOpencodeDb, l as parseClaudeEntries, r as findOpencodeSessionsByDirectory, t as DEFAULT_OPENCODE_DB } from "./opencode-sqlite-8r6WUfHc.js";
|
|
4
3
|
import { basename, dirname, join } from "node:path";
|
|
5
4
|
import { appendFile, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
@@ -34,216 +33,7 @@ const SUPERVISOR_RUN_ROLLUP_SCHEMA = "tangle.supervisor-run-rollup@1";
|
|
|
34
33
|
* with no filesystem, no process, and no network. All I/O lives in a reader
|
|
35
34
|
* (`loops-reader.ts` is one).
|
|
36
35
|
*/
|
|
37
|
-
function asRecord(v) {
|
|
38
|
-
return typeof v === "object" && v !== null ? v : {};
|
|
39
|
-
}
|
|
40
|
-
function num(v) {
|
|
41
|
-
return typeof v === "number" && Number.isFinite(v) ? v : 0;
|
|
42
|
-
}
|
|
43
|
-
function readSpend(v) {
|
|
44
|
-
const rec = asRecord(v);
|
|
45
|
-
const tok = asRecord(rec.tokens);
|
|
46
|
-
const cacheRead = tok.cacheRead ?? tok.cache_read;
|
|
47
|
-
const cacheWrite = tok.cacheWrite ?? tok.cache_write;
|
|
48
|
-
return {
|
|
49
|
-
tokens: {
|
|
50
|
-
input: num(tok.input),
|
|
51
|
-
output: num(tok.output),
|
|
52
|
-
cacheRead: num(cacheRead),
|
|
53
|
-
cacheWrite: num(cacheWrite),
|
|
54
|
-
hasCache: cacheRead !== void 0 || cacheWrite !== void 0
|
|
55
|
-
},
|
|
56
|
-
usd: num(rec.usd)
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
36
|
const NO_CACHE_COUNTERS = "the journal carries no cache-token counters for this role";
|
|
60
|
-
function parseJsonl(text) {
|
|
61
|
-
if (text === null) return [];
|
|
62
|
-
const out = [];
|
|
63
|
-
for (const line of text.split("\n")) {
|
|
64
|
-
const trimmed = line.trim();
|
|
65
|
-
if (!trimmed) continue;
|
|
66
|
-
try {
|
|
67
|
-
const parsed = JSON.parse(trimmed);
|
|
68
|
-
if (typeof parsed === "object" && parsed !== null) out.push(parsed);
|
|
69
|
-
} catch {}
|
|
70
|
-
}
|
|
71
|
-
return out;
|
|
72
|
-
}
|
|
73
|
-
function parseJson(text) {
|
|
74
|
-
if (text === null) return null;
|
|
75
|
-
try {
|
|
76
|
-
const parsed = JSON.parse(text);
|
|
77
|
-
return typeof parsed === "object" && parsed !== null ? parsed : null;
|
|
78
|
-
} catch {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function ms(at) {
|
|
83
|
-
if (typeof at !== "string") return null;
|
|
84
|
-
const t = Date.parse(at);
|
|
85
|
-
return Number.isFinite(t) ? t : null;
|
|
86
|
-
}
|
|
87
|
-
function readVerdict(v) {
|
|
88
|
-
if (typeof v === "string") return {
|
|
89
|
-
label: v,
|
|
90
|
-
valid: null,
|
|
91
|
-
score: null,
|
|
92
|
-
raw: v
|
|
93
|
-
};
|
|
94
|
-
if (typeof v !== "object" || v === null) return {
|
|
95
|
-
label: null,
|
|
96
|
-
valid: null,
|
|
97
|
-
score: null,
|
|
98
|
-
raw: null
|
|
99
|
-
};
|
|
100
|
-
const rec = v;
|
|
101
|
-
const valid = typeof rec.valid === "boolean" ? rec.valid : null;
|
|
102
|
-
return {
|
|
103
|
-
label: valid === null ? null : valid ? "valid" : "invalid",
|
|
104
|
-
valid,
|
|
105
|
-
score: typeof rec.score === "number" && Number.isFinite(rec.score) ? rec.score : null,
|
|
106
|
-
raw: v
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
function workerSourceKey(worker) {
|
|
110
|
-
return worker.workerId ?? worker.label;
|
|
111
|
-
}
|
|
112
|
-
function parseSupervisorTree(src) {
|
|
113
|
-
const events = parseJsonl(src.journal);
|
|
114
|
-
const state = parseJson(src.state);
|
|
115
|
-
const spawns = [];
|
|
116
|
-
const closes = [];
|
|
117
|
-
let brainIn = 0;
|
|
118
|
-
let brainOut = 0;
|
|
119
|
-
let brainCacheRead = 0;
|
|
120
|
-
let brainCacheWrite = 0;
|
|
121
|
-
let brainHasCache = false;
|
|
122
|
-
let brainUsd = 0;
|
|
123
|
-
let meteredCount = 0;
|
|
124
|
-
let rootId = null;
|
|
125
|
-
for (const ev of events) {
|
|
126
|
-
const kind = typeof ev.kind === "string" ? ev.kind : "";
|
|
127
|
-
const id = typeof ev.id === "string" ? ev.id : "";
|
|
128
|
-
if (kind === "spawned") {
|
|
129
|
-
const parent = typeof ev.parent === "string" ? ev.parent : null;
|
|
130
|
-
const label = typeof ev.label === "string" ? ev.label : "";
|
|
131
|
-
if (parent === null && rootId === null) rootId = id;
|
|
132
|
-
const role = parent === null || ev.role === "supervisor" ? "supervisor" : "worker";
|
|
133
|
-
spawns.push({
|
|
134
|
-
id,
|
|
135
|
-
parent,
|
|
136
|
-
label,
|
|
137
|
-
role,
|
|
138
|
-
at: ms(ev.at)
|
|
139
|
-
});
|
|
140
|
-
} else if (kind === "settled") {
|
|
141
|
-
const verdict = readVerdict(ev.verdict);
|
|
142
|
-
closes.push({
|
|
143
|
-
id,
|
|
144
|
-
kind: "settled",
|
|
145
|
-
status: typeof ev.status === "string" ? ev.status : null,
|
|
146
|
-
verdict: verdict.label,
|
|
147
|
-
valid: verdict.valid,
|
|
148
|
-
score: verdict.score,
|
|
149
|
-
rawVerdict: verdict.raw,
|
|
150
|
-
at: ms(ev.at),
|
|
151
|
-
spend: readSpend(ev.spent),
|
|
152
|
-
hasSpend: asRecord(ev.spent).tokens !== void 0
|
|
153
|
-
});
|
|
154
|
-
} else if (kind === "cancelled") closes.push({
|
|
155
|
-
id,
|
|
156
|
-
kind: "cancelled",
|
|
157
|
-
status: "cancelled",
|
|
158
|
-
verdict: typeof ev.reason === "string" ? ev.reason : null,
|
|
159
|
-
valid: null,
|
|
160
|
-
score: null,
|
|
161
|
-
rawVerdict: typeof ev.reason === "string" ? ev.reason : null,
|
|
162
|
-
at: ms(ev.at),
|
|
163
|
-
spend: {
|
|
164
|
-
tokens: {
|
|
165
|
-
input: 0,
|
|
166
|
-
output: 0,
|
|
167
|
-
cacheRead: 0,
|
|
168
|
-
cacheWrite: 0,
|
|
169
|
-
hasCache: false
|
|
170
|
-
},
|
|
171
|
-
usd: 0
|
|
172
|
-
},
|
|
173
|
-
hasSpend: false
|
|
174
|
-
});
|
|
175
|
-
else if (kind === "metered") {
|
|
176
|
-
const s = readSpend(ev.spend);
|
|
177
|
-
brainIn += s.tokens.input;
|
|
178
|
-
brainOut += s.tokens.output;
|
|
179
|
-
brainCacheRead += s.tokens.cacheRead;
|
|
180
|
-
brainCacheWrite += s.tokens.cacheWrite;
|
|
181
|
-
brainHasCache = brainHasCache || s.tokens.hasCache;
|
|
182
|
-
brainUsd += s.usd;
|
|
183
|
-
meteredCount += 1;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
const workerSpawns = spawns.filter((s) => s.id !== rootId);
|
|
187
|
-
const workerIds = new Set(workerSpawns.map((s) => s.id));
|
|
188
|
-
const workerCloses = closes.filter((c) => workerIds.has(c.id));
|
|
189
|
-
const workerLogs = /* @__PURE__ */ new Map();
|
|
190
|
-
for (const w of src.workers ?? []) {
|
|
191
|
-
const facts = {
|
|
192
|
-
started: null,
|
|
193
|
-
finished: false,
|
|
194
|
-
finishedAt: null,
|
|
195
|
-
passed: null,
|
|
196
|
-
score: null,
|
|
197
|
-
finishedPatchBytes: null,
|
|
198
|
-
evidenceBytes: 0,
|
|
199
|
-
steersQueued: 0,
|
|
200
|
-
steersDelivered: 0,
|
|
201
|
-
questions: 0
|
|
202
|
-
};
|
|
203
|
-
for (const req of parseJsonl(w.inbox)) if (typeof req.message === "string" && req.message.trim().length > 0) facts.steersQueued += 1;
|
|
204
|
-
for (const ev of parseJsonl(w.events)) {
|
|
205
|
-
const kind = ev.kind;
|
|
206
|
-
if (kind === "message") {
|
|
207
|
-
if (ev.direction === "up") {
|
|
208
|
-
facts.questions += 1;
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
if (typeof ev.requestId !== "string") facts.steersQueued += 1;
|
|
212
|
-
if (ev.delivered === true) facts.steersDelivered += 1;
|
|
213
|
-
} else if (kind === "started") facts.started = ms(ev.at);
|
|
214
|
-
else if (kind === "finished") {
|
|
215
|
-
facts.finished = true;
|
|
216
|
-
facts.finishedAt = ms(ev.at);
|
|
217
|
-
facts.passed = typeof ev.passed === "boolean" ? ev.passed : null;
|
|
218
|
-
facts.score = typeof ev.score === "number" && Number.isFinite(ev.score) ? ev.score : null;
|
|
219
|
-
facts.finishedPatchBytes = typeof ev.patchBytes === "number" ? ev.patchBytes : null;
|
|
220
|
-
facts.evidenceBytes = typeof ev.evidence === "string" ? ev.evidence.length : 0;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
workerLogs.set(workerSourceKey(w), facts);
|
|
224
|
-
}
|
|
225
|
-
const startedAt = ms(state?.startedAt) ?? spawns[0]?.at ?? null;
|
|
226
|
-
const completedAt = ms(state?.completedAt) ?? [...spawns.map((s) => s.at), ...closes.map((c) => c.at)].reduce((acc, t) => t === null ? acc : acc === null ? t : Math.max(acc, t), null);
|
|
227
|
-
return {
|
|
228
|
-
rootId,
|
|
229
|
-
spawns,
|
|
230
|
-
closes,
|
|
231
|
-
workerSpawns,
|
|
232
|
-
workerCloses,
|
|
233
|
-
brain: {
|
|
234
|
-
tokensIn: brainIn,
|
|
235
|
-
tokensOut: brainOut,
|
|
236
|
-
cacheRead: brainCacheRead,
|
|
237
|
-
cacheWrite: brainCacheWrite,
|
|
238
|
-
hasCache: brainHasCache,
|
|
239
|
-
usd: brainUsd,
|
|
240
|
-
meteredCount
|
|
241
|
-
},
|
|
242
|
-
workerLogs,
|
|
243
|
-
startedAt,
|
|
244
|
-
completedAt
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
37
|
/**
|
|
248
38
|
* Analyze already-read supervisor-run bytes. Pure and synchronous: same bytes
|
|
249
39
|
* in, same report out (modulo `generatedAt`, which `now` pins in tests).
|
|
@@ -256,10 +46,10 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
256
46
|
};
|
|
257
47
|
const journalMissing = src.supRunDir === null ? "no supervisor run dir under <ws>/.loops/supervisor" : "journal.jsonl absent";
|
|
258
48
|
const haveJournal = src.journal !== null;
|
|
259
|
-
const
|
|
49
|
+
const tree = parseSupervisorTree(src);
|
|
50
|
+
const state = tree.state;
|
|
260
51
|
const result = parseJson(src.result);
|
|
261
52
|
const judge = parseJson(src.judge);
|
|
262
|
-
const tree = parseSupervisorTree(src);
|
|
263
53
|
const { rootId, workerSpawns, workerCloses, startedAt, completedAt } = tree;
|
|
264
54
|
const spawnById = new Map(workerSpawns.map((spawn) => [spawn.id, spawn]));
|
|
265
55
|
const spawnsByLabel = /* @__PURE__ */ new Map();
|
|
@@ -284,22 +74,29 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
284
74
|
let upLegMessages = 0;
|
|
285
75
|
if (src.workers !== null) for (const w of src.workers) {
|
|
286
76
|
const facts = tree.workerLogs.get(workerSourceKey(w));
|
|
287
|
-
const queued = facts?.steersQueued ??
|
|
288
|
-
const delivered = facts?.steersDelivered ??
|
|
77
|
+
const queued = facts?.steersQueued ?? null;
|
|
78
|
+
const delivered = facts?.steersDelivered ?? null;
|
|
289
79
|
upLegMessages += facts?.questions ?? 0;
|
|
290
|
-
steerRows.push({
|
|
80
|
+
if (queued !== null && delivered !== null) steerRows.push({
|
|
291
81
|
workerId: w.workerId ?? null,
|
|
292
82
|
worker: w.label,
|
|
293
83
|
queued,
|
|
294
84
|
delivered
|
|
295
85
|
});
|
|
296
|
-
steerQueuedTotal += queued;
|
|
297
|
-
steerDeliveredTotal += delivered;
|
|
86
|
+
if (queued !== null) steerQueuedTotal += queued;
|
|
87
|
+
if (delivered !== null) steerDeliveredTotal += delivered;
|
|
298
88
|
}
|
|
299
89
|
const workersGapReason = src.workersMissingReason ?? "workers/ directory absent";
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
|
|
90
|
+
const unavailableReasons = (pick) => {
|
|
91
|
+
const reasons = tree.workerLogRows.map((facts) => pick(facts)).filter((reason) => reason !== null);
|
|
92
|
+
return reasons.length === 0 ? null : `exact steer accounting unavailable for ${reasons.length} worker row(s): ${[...new Set(reasons)].join(" | ")}`;
|
|
93
|
+
};
|
|
94
|
+
const queuedGapReason = unavailableReasons((facts) => facts.steersQueuedUnavailable);
|
|
95
|
+
const deliveredGapReason = unavailableReasons((facts) => facts.steersDeliveredUnavailable);
|
|
96
|
+
const workerEventsGapReason = unavailableReasons((facts) => !facts.eventsCaptured ? "events absent" : facts.eventsInvalidRows > 0 ? "events contain malformed rows" : null);
|
|
97
|
+
const steers = src.workers === null ? gap("steers", workersGapReason) : queuedGapReason === null ? steerQueuedTotal : gap("steers", queuedGapReason);
|
|
98
|
+
const steersDelivered = src.workers === null ? unavailable(workersGapReason) : deliveredGapReason === null ? steerDeliveredTotal : unavailable(deliveredGapReason);
|
|
99
|
+
const steersByWorker = src.workers === null ? unavailable(workersGapReason) : queuedGapReason === null && deliveredGapReason === null ? steerRows : unavailable(queuedGapReason ?? deliveredGapReason ?? workersGapReason);
|
|
303
100
|
const driverSteerCalls = src.driverLog === null ? gap("driverSteerCalls", "driver.log absent") : Math.max(0, (src.driverLog.match(/supervisor_steer/g) ?? []).length - registrationMentions(src.driverLog));
|
|
304
101
|
const timeline = [];
|
|
305
102
|
for (const s of workerSpawns) if (s.at !== null) timeline.push({
|
|
@@ -445,8 +242,8 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
|
|
|
445
242
|
emptyPass: acceptedLimit !== null ? gap("emptyPass", acceptedLimit) : src.workers === null ? unavailable(workersGapReason) : emptyPass,
|
|
446
243
|
observeThenRespawn: haveJournal ? observeThenRespawn : unavailable(journalMissing),
|
|
447
244
|
respawnWithoutEvidence: haveJournal ? respawnWithoutEvidence : unavailable(journalMissing),
|
|
448
|
-
reviewActions: src.workers === null ? unavailable(workersGapReason) : steerQueuedTotal + upLegMessages,
|
|
449
|
-
workerEvidenceBytes: src.workers === null ? unavailable(workersGapReason) : evidenceBytes
|
|
245
|
+
reviewActions: src.workers === null ? unavailable(workersGapReason) : queuedGapReason === null ? steerQueuedTotal + upLegMessages : unavailable(queuedGapReason),
|
|
246
|
+
workerEvidenceBytes: src.workers === null ? unavailable(workersGapReason) : workerEventsGapReason === null ? evidenceBytes : unavailable(workerEventsGapReason)
|
|
450
247
|
};
|
|
451
248
|
const journalWorkerIn = workerCloses.reduce((a, c) => a + c.spend.tokens.input, 0);
|
|
452
249
|
const journalWorkerOut = workerCloses.reduce((a, c) => a + c.spend.tokens.output, 0);
|
|
@@ -954,6 +751,7 @@ async function readClaudeCodeSupervisorRun(opts) {
|
|
|
954
751
|
const delivered = structured?.success === true || str(structured?.resumedAgentId) === target;
|
|
955
752
|
const rows = steersByTarget.get(target) ?? [];
|
|
956
753
|
rows.push({
|
|
754
|
+
requestId: use.id,
|
|
957
755
|
at: use.at,
|
|
958
756
|
delivered
|
|
959
757
|
});
|
|
@@ -982,13 +780,12 @@ async function readClaudeCodeSupervisorRun(opts) {
|
|
|
982
780
|
role: "supervisor",
|
|
983
781
|
at: startedAt
|
|
984
782
|
})];
|
|
985
|
-
const supervisorIds = new Set(spawns.map((spawn) => spawn.parentId));
|
|
986
783
|
for (const s of spawns) journalLines.push(line({
|
|
987
784
|
kind: "spawned",
|
|
988
785
|
id: s.agentId,
|
|
989
786
|
parent: s.parentId,
|
|
990
787
|
label: s.label,
|
|
991
|
-
role:
|
|
788
|
+
role: "worker",
|
|
992
789
|
at: s.at
|
|
993
790
|
}));
|
|
994
791
|
const lastNotification = /* @__PURE__ */ new Map();
|
|
@@ -1046,7 +843,7 @@ async function readClaudeCodeSupervisorRun(opts) {
|
|
|
1046
843
|
}));
|
|
1047
844
|
for (const steer of steersByTarget.get(agentId) ?? []) {
|
|
1048
845
|
inbox.push(line({
|
|
1049
|
-
id:
|
|
846
|
+
id: steer.requestId,
|
|
1050
847
|
at: steer.at,
|
|
1051
848
|
worker: label,
|
|
1052
849
|
message: "steer"
|
|
@@ -1056,7 +853,7 @@ async function readClaudeCodeSupervisorRun(opts) {
|
|
|
1056
853
|
label,
|
|
1057
854
|
direction: "down",
|
|
1058
855
|
at: steer.at,
|
|
1059
|
-
requestId:
|
|
856
|
+
requestId: steer.requestId,
|
|
1060
857
|
delivered: steer.delivered
|
|
1061
858
|
}));
|
|
1062
859
|
}
|
|
@@ -1070,8 +867,8 @@ async function readClaudeCodeSupervisorRun(opts) {
|
|
|
1070
867
|
workers.push({
|
|
1071
868
|
workerId: agentId,
|
|
1072
869
|
label,
|
|
1073
|
-
events: events.length === 0 ?
|
|
1074
|
-
inbox: inbox.length === 0 ?
|
|
870
|
+
events: events.length === 0 ? "" : `${events.join("\n")}\n`,
|
|
871
|
+
inbox: inbox.length === 0 ? "" : `${inbox.join("\n")}\n`,
|
|
1075
872
|
patchBytes: null,
|
|
1076
873
|
transcriptRef: child?.path ?? null,
|
|
1077
874
|
patchPath: null,
|
|
@@ -1579,229 +1376,6 @@ async function findSupervisorRunDirs(root) {
|
|
|
1579
1376
|
return found.sort();
|
|
1580
1377
|
}
|
|
1581
1378
|
//#endregion
|
|
1582
|
-
|
|
1583
|
-
/**
|
|
1584
|
-
* The supervision tree as `tangle.rollout.v1` rows.
|
|
1585
|
-
*
|
|
1586
|
-
* A supervisor run IS a tree of rollouts, so its nodes are not a new shape:
|
|
1587
|
-
* the root becomes one `RolloutLine` with `role: 'supervisor'`, and every
|
|
1588
|
-
* spawned invocation keeps its explicit supervisor/worker role with
|
|
1589
|
-
* `parent_rollout_id` pointing at its spawner. The rows append to the same
|
|
1590
|
-
* ledger as solo-agent rollouts and join to them with the same keys.
|
|
1591
|
-
*
|
|
1592
|
-
* What the journal CANNOT supply is the transcript: a worker's messages live
|
|
1593
|
-
* in its harness store (opencode sqlite, Claude Code jsonl), which the
|
|
1594
|
-
* `src/rollout/readers/*` intake readers own. Rows minted here are therefore
|
|
1595
|
-
* GAP lines (`messages: []`, `provenance.gap` set) carrying identity,
|
|
1596
|
-
* structure, outcome and cost; hydrating them with messages is the readers'
|
|
1597
|
-
* job, keyed on `artifacts.transcript_ref`.
|
|
1598
|
-
*
|
|
1599
|
-
* Timing lives in `outcome.metrics` (`spawned_at` / `settled_at` / `wall_ms`)
|
|
1600
|
-
* rather than a schema field: `tangle.rollout.v1` describes ONE invocation,
|
|
1601
|
-
* and the inter-invocation event timeline — which is what waves, concurrency,
|
|
1602
|
-
* idle and utilization are computed from — is a property of the journal, not
|
|
1603
|
-
* of any single row. The analyzer reads that timeline; these rows carry the
|
|
1604
|
-
* per-node facts.
|
|
1605
|
-
*/
|
|
1606
|
-
const EMPTY_COST = {
|
|
1607
|
-
usd: null,
|
|
1608
|
-
tokens_in: null,
|
|
1609
|
-
tokens_out: null,
|
|
1610
|
-
tokens_reasoning: null,
|
|
1611
|
-
cache_read: null,
|
|
1612
|
-
cache_write: null,
|
|
1613
|
-
wall_s: null
|
|
1614
|
-
};
|
|
1615
|
-
function hasWorkerId(worker) {
|
|
1616
|
-
return worker.workerId !== void 0;
|
|
1617
|
-
}
|
|
1618
|
-
/**
|
|
1619
|
-
* Mint the supervision tree as rollout rows. Returns the rows plus the gaps
|
|
1620
|
-
* that made any of them incomplete — same unavailable-vs-zero discipline as
|
|
1621
|
-
* the report: a row with no transcript says WHY, it never pretends to be empty.
|
|
1622
|
-
*/
|
|
1623
|
-
function supervisorRunRolloutLines(src, opts = {}) {
|
|
1624
|
-
const gaps = [];
|
|
1625
|
-
const tree = parseSupervisorTree(src);
|
|
1626
|
-
if (src.journal === null) {
|
|
1627
|
-
gaps.push(`tree: ${src.supRunDir === null ? "no supervisor run dir" : "journal absent"} — no nodes recoverable`);
|
|
1628
|
-
return {
|
|
1629
|
-
rootId: null,
|
|
1630
|
-
nodes: [],
|
|
1631
|
-
gaps
|
|
1632
|
-
};
|
|
1633
|
-
}
|
|
1634
|
-
const state = parseJson(src.state);
|
|
1635
|
-
const result = parseJson(src.result);
|
|
1636
|
-
const judge = parseJson(src.judge);
|
|
1637
|
-
const stateResult = asRecord(state?.result);
|
|
1638
|
-
const rootId = tree.rootId;
|
|
1639
|
-
const runId = opts.runId ?? rootId ?? src.runRef;
|
|
1640
|
-
const suite = opts.suite ?? "supervisor-run";
|
|
1641
|
-
const instanceId = src.instanceId ?? src.runRef;
|
|
1642
|
-
const split = opts.split ?? "search";
|
|
1643
|
-
const capturedAt = opts.capturedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
1644
|
-
const base = {
|
|
1645
|
-
schema: ROLLOUT_SCHEMA,
|
|
1646
|
-
run_id: runId,
|
|
1647
|
-
experiment_id: opts.experimentId ?? null,
|
|
1648
|
-
candidate_id: opts.candidateId ?? null,
|
|
1649
|
-
generation: opts.generation ?? null,
|
|
1650
|
-
candidate_index: opts.candidateIndex ?? null,
|
|
1651
|
-
task: {
|
|
1652
|
-
suite,
|
|
1653
|
-
instance_id: instanceId,
|
|
1654
|
-
split,
|
|
1655
|
-
seed: opts.seed ?? null,
|
|
1656
|
-
rep: opts.rep ?? 0
|
|
1657
|
-
},
|
|
1658
|
-
messages: [],
|
|
1659
|
-
tool_defs: []
|
|
1660
|
-
};
|
|
1661
|
-
const nodes = [];
|
|
1662
|
-
if (rootId !== null) {
|
|
1663
|
-
const judgeResolved = typeof judge?.resolved === "boolean" ? judge.resolved : null;
|
|
1664
|
-
const reward = (typeof judge?.score === "number" ? judge.score : null) ?? (judgeResolved === null ? null : judgeResolved ? 1 : 0);
|
|
1665
|
-
if (reward === null) gaps.push("root.outcome.reward: no judge verdict for this run");
|
|
1666
|
-
const wallMs = tree.startedAt !== null && tree.completedAt !== null && tree.completedAt >= tree.startedAt ? tree.completedAt - tree.startedAt : null;
|
|
1667
|
-
nodes.push({
|
|
1668
|
-
...base,
|
|
1669
|
-
rollout_id: rootId,
|
|
1670
|
-
parent_rollout_id: null,
|
|
1671
|
-
role: "supervisor",
|
|
1672
|
-
policy: {
|
|
1673
|
-
harness: opts.supervisorHarness ?? null,
|
|
1674
|
-
harness_version: null,
|
|
1675
|
-
model: opts.supervisorModel ?? null,
|
|
1676
|
-
provider: null,
|
|
1677
|
-
profile_commit: null,
|
|
1678
|
-
sampling: null
|
|
1679
|
-
},
|
|
1680
|
-
outcome: {
|
|
1681
|
-
...unscreenedRewardFields(reward),
|
|
1682
|
-
reward_source: src.judgeSource,
|
|
1683
|
-
verdict: judge ?? null,
|
|
1684
|
-
metrics: {
|
|
1685
|
-
arm: src.arm,
|
|
1686
|
-
sup_status: typeof state?.status === "string" ? state.status : null,
|
|
1687
|
-
sup_verdict: typeof state?.verdict === "string" ? state.verdict : null,
|
|
1688
|
-
delivered: typeof stateResult.delivered === "boolean" ? stateResult.delivered : null,
|
|
1689
|
-
verify_pass: typeof result?.verify_pass === "boolean" ? result.verify_pass : null,
|
|
1690
|
-
started_at: tree.startedAt,
|
|
1691
|
-
completed_at: tree.completedAt,
|
|
1692
|
-
workers_spawned: tree.workerSpawns.length,
|
|
1693
|
-
brain_metered_events: tree.brain.meteredCount
|
|
1694
|
-
},
|
|
1695
|
-
is_completed: state?.status === "completed",
|
|
1696
|
-
is_truncated: false,
|
|
1697
|
-
error: null,
|
|
1698
|
-
realness_gated: false
|
|
1699
|
-
},
|
|
1700
|
-
cost: {
|
|
1701
|
-
...EMPTY_COST,
|
|
1702
|
-
usd: src.limits.spendUsd !== null ? null : typeof stateResult.spentUsd === "number" ? stateResult.spentUsd : tree.brain.usd,
|
|
1703
|
-
tokens_in: src.limits.managerTokens === null ? tree.brain.tokensIn : null,
|
|
1704
|
-
tokens_out: src.limits.managerTokens === null ? tree.brain.tokensOut : null,
|
|
1705
|
-
cache_read: src.limits.managerTokens === null && tree.brain.hasCache ? tree.brain.cacheRead : null,
|
|
1706
|
-
cache_write: src.limits.managerTokens === null && tree.brain.hasCache ? tree.brain.cacheWrite : null,
|
|
1707
|
-
wall_s: wallMs === null ? null : wallMs / 1e3
|
|
1708
|
-
},
|
|
1709
|
-
artifacts: {
|
|
1710
|
-
patch_path: typeof result?.patchPath === "string" ? result.patchPath : null,
|
|
1711
|
-
run_dir: src.supRunDir,
|
|
1712
|
-
transcript_ref: src.rootTranscriptRef !== void 0 ? src.rootTranscriptRef : src.supRunDir === null ? null : `${src.supRunDir}/journal.jsonl`
|
|
1713
|
-
},
|
|
1714
|
-
provenance: {
|
|
1715
|
-
captured_at: capturedAt,
|
|
1716
|
-
capture: "backfill",
|
|
1717
|
-
gap: "supervision journal carries structure and spend, not the brain transcript"
|
|
1718
|
-
}
|
|
1719
|
-
});
|
|
1720
|
-
} else gaps.push("tree.root: no parentless `spawned` event in the journal");
|
|
1721
|
-
const closeById = new Map(tree.closes.map((c) => [c.id, c]));
|
|
1722
|
-
const sourceById = new Map((src.workers ?? []).filter(hasWorkerId).map((worker) => [worker.workerId, worker]));
|
|
1723
|
-
const fallbackSourceByLabel = new Map((src.workers ?? []).filter((worker) => worker.workerId === void 0).map((worker) => [worker.label, worker]));
|
|
1724
|
-
for (const spawn of tree.workerSpawns) {
|
|
1725
|
-
const close = closeById.get(spawn.id) ?? null;
|
|
1726
|
-
const workerSource = sourceById.get(spawn.id) ?? fallbackSourceByLabel.get(spawn.label) ?? null;
|
|
1727
|
-
const facts = tree.workerLogs.get(workerSource?.workerId ?? workerSource?.label ?? spawn.label) ?? null;
|
|
1728
|
-
const wallMs = facts?.started != null && facts.finishedAt != null ? facts.finishedAt - facts.started : null;
|
|
1729
|
-
const score = close?.score ?? facts?.score ?? null;
|
|
1730
|
-
const passed = close?.valid ?? facts?.passed ?? null;
|
|
1731
|
-
const reward = score ?? (passed === null ? null : passed ? 1 : 0);
|
|
1732
|
-
if (reward === null) gaps.push(`child ${spawn.label}: no verify verdict (child logs absent or unfinished)`);
|
|
1733
|
-
const isSupervisor = spawn.role === "supervisor";
|
|
1734
|
-
nodes.push({
|
|
1735
|
-
...base,
|
|
1736
|
-
rollout_id: spawn.id,
|
|
1737
|
-
parent_rollout_id: spawn.parent,
|
|
1738
|
-
role: spawn.role,
|
|
1739
|
-
policy: {
|
|
1740
|
-
harness: isSupervisor ? opts.supervisorHarness ?? null : opts.workerHarness ?? null,
|
|
1741
|
-
harness_version: null,
|
|
1742
|
-
model: isSupervisor ? opts.supervisorModel ?? null : opts.workerModel ?? null,
|
|
1743
|
-
provider: null,
|
|
1744
|
-
profile_commit: null,
|
|
1745
|
-
sampling: null
|
|
1746
|
-
},
|
|
1747
|
-
outcome: {
|
|
1748
|
-
...unscreenedRewardFields(reward),
|
|
1749
|
-
reward_source: reward === null ? null : score === null ? "worker-self-verify" : "worker-verdict-score",
|
|
1750
|
-
verdict: close === null ? null : {
|
|
1751
|
-
kind: close.kind,
|
|
1752
|
-
status: close.status,
|
|
1753
|
-
verdict: close.rawVerdict,
|
|
1754
|
-
valid: close.valid,
|
|
1755
|
-
score: close.score
|
|
1756
|
-
},
|
|
1757
|
-
metrics: {
|
|
1758
|
-
label: spawn.label,
|
|
1759
|
-
spawned_at: spawn.at,
|
|
1760
|
-
settled_at: close?.at ?? null,
|
|
1761
|
-
started_at: facts?.started ?? null,
|
|
1762
|
-
finished_at: facts?.finishedAt ?? null,
|
|
1763
|
-
wall_ms: wallMs,
|
|
1764
|
-
patch_bytes: workerSource?.patchBytes ?? facts?.finishedPatchBytes ?? null,
|
|
1765
|
-
evidence_bytes: facts?.evidenceBytes ?? null,
|
|
1766
|
-
steers_queued: facts?.steersQueued ?? null,
|
|
1767
|
-
steers_delivered: facts?.steersDelivered ?? null,
|
|
1768
|
-
questions: facts?.questions ?? null
|
|
1769
|
-
},
|
|
1770
|
-
is_completed: close?.kind === "settled",
|
|
1771
|
-
is_truncated: close?.kind === "cancelled",
|
|
1772
|
-
error: close?.kind === "cancelled" ? close.verdict ?? "cancelled" : null,
|
|
1773
|
-
realness_gated: false
|
|
1774
|
-
},
|
|
1775
|
-
cost: {
|
|
1776
|
-
...EMPTY_COST,
|
|
1777
|
-
usd: src.limits.spendUsd !== null || !close?.hasSpend ? null : close.spend.usd,
|
|
1778
|
-
tokens_in: workerSource?.tokensIn ?? (close?.hasSpend ? close.spend.tokens.input : null),
|
|
1779
|
-
tokens_out: workerSource?.tokensOut ?? (close?.hasSpend ? close.spend.tokens.output : null),
|
|
1780
|
-
cache_read: workerSource?.cacheRead ?? (close?.hasSpend && close.spend.tokens.hasCache ? close.spend.tokens.cacheRead : null),
|
|
1781
|
-
cache_write: workerSource?.cacheWrite ?? (close?.hasSpend && close.spend.tokens.hasCache ? close.spend.tokens.cacheWrite : null),
|
|
1782
|
-
wall_s: wallMs === null ? null : wallMs / 1e3
|
|
1783
|
-
},
|
|
1784
|
-
artifacts: {
|
|
1785
|
-
patch_path: workerSource?.patchPath !== void 0 ? workerSource.patchPath : src.supRunDir === null ? null : `${src.supRunDir}/workers/${spawn.label}.patch`,
|
|
1786
|
-
run_dir: src.supRunDir,
|
|
1787
|
-
transcript_ref: workerSource?.transcriptRef !== void 0 ? workerSource.transcriptRef : src.supRunDir === null ? null : `${src.supRunDir}/workers/${spawn.label}.ndjson`
|
|
1788
|
-
},
|
|
1789
|
-
provenance: {
|
|
1790
|
-
captured_at: capturedAt,
|
|
1791
|
-
capture: "backfill",
|
|
1792
|
-
gap: workerSource?.transcriptRef == null ? "worker transcript lives in the harness session store — hydrate via src/rollout/readers" : "worker transcript recorded by the harness; messages not inlined into this row"
|
|
1793
|
-
}
|
|
1794
|
-
});
|
|
1795
|
-
}
|
|
1796
|
-
const invalid = nodes.filter((n) => !isRolloutLine(n));
|
|
1797
|
-
if (invalid.length > 0) gaps.push(`${invalid.length} node(s) failed tangle.rollout.v1 validation`);
|
|
1798
|
-
return {
|
|
1799
|
-
rootId,
|
|
1800
|
-
nodes,
|
|
1801
|
-
gaps
|
|
1802
|
-
};
|
|
1803
|
-
}
|
|
1804
|
-
//#endregion
|
|
1805
|
-
export { NO_SOURCE_LIMITS as C, showMeasured as D, isUnavailable as E, unavailable as O, rollupSupervisorRuns as S, SUPERVISOR_RUN_SCHEMA as T, claudeCodeSupervisorRunReader as _, loopsSupervisorRunReader as a, parsePatch as b, supervisorReportStem as c, renderSupervisorRollupMarkdown as d, renderSupervisorRunHeadline as f, DEFAULT_STEER_TOOLS as g, DEFAULT_SPAWN_TOOLS as h, findSupervisorRunDirs as i, writeSupervisorRunReport as l, DEFAULT_CANCEL_TOOLS as m, analyzeSupervisorRun as n, readLoopsSupervisorRun as o, renderSupervisorRunMarkdown as p, findSupervisorRunDirIn as r, reportSupervisorRound as s, supervisorRunRolloutLines as t, writeSupervisorRunReportSafe as u, readClaudeCodeSupervisorRun as v, SUPERVISOR_RUN_ROLLUP_SCHEMA as w, parseSupervisorTree as x, analyzeSupervisorRunSources as y };
|
|
1379
|
+
export { SUPERVISOR_RUN_SCHEMA as C, unavailable as E, SUPERVISOR_RUN_ROLLUP_SCHEMA as S, showMeasured as T, readClaudeCodeSupervisorRun as _, readLoopsSupervisorRun as a, rollupSupervisorRuns as b, writeSupervisorRunReport as c, renderSupervisorRunHeadline as d, renderSupervisorRunMarkdown as f, claudeCodeSupervisorRunReader as g, DEFAULT_STEER_TOOLS as h, loopsSupervisorRunReader as i, writeSupervisorRunReportSafe as l, DEFAULT_SPAWN_TOOLS as m, findSupervisorRunDirIn as n, reportSupervisorRound as o, DEFAULT_CANCEL_TOOLS as p, findSupervisorRunDirs as r, supervisorReportStem as s, analyzeSupervisorRun as t, renderSupervisorRollupMarkdown as u, analyzeSupervisorRunSources as v, isUnavailable as w, NO_SOURCE_LIMITS as x, parsePatch as y };
|
|
1806
1380
|
|
|
1807
|
-
//# sourceMappingURL=supervisor-run-
|
|
1381
|
+
//# sourceMappingURL=supervisor-run-B2EWUmQY.js.map
|