@tangle-network/agent-eval 0.174.0 → 0.176.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 +37 -0
- package/README.md +1 -1
- package/dist/adapters/http.d.ts +1 -1
- package/dist/agent-profile-cell-0gSi5ffD.js +374 -0
- package/dist/agent-profile-cell-0gSi5ffD.js.map +1 -0
- package/dist/analyst/index.d.ts +3 -3
- package/dist/analyst/index.js +4 -4
- package/dist/{benchmark-command-mZIlR-ra.js → benchmark-command-yPqjcZnC.js} +7 -7
- package/dist/{benchmark-command-mZIlR-ra.js.map → benchmark-command-yPqjcZnC.js.map} +1 -1
- package/dist/benchmarks/index.d.ts +1 -1
- package/dist/benchmarks/index.js +3 -3
- package/dist/campaign/index.d.ts +3 -3
- package/dist/campaign/index.js +9 -9
- package/dist/{campaign-BzMSCejE.js → campaign-85igdlgG.js} +12 -12
- package/dist/{campaign-BzMSCejE.js.map → campaign-85igdlgG.js.map} +1 -1
- package/dist/campaign-evidence-D8DBLqLI.js +2083 -0
- package/dist/campaign-evidence-D8DBLqLI.js.map +1 -0
- package/dist/{opencode-sqlite-eK6HW6dr.js → claude-jsonl-CxZZrDJ3.js} +9 -149
- package/dist/claude-jsonl-CxZZrDJ3.js.map +1 -0
- package/dist/cli.js +9 -2
- package/dist/cli.js.map +1 -1
- package/dist/contract/index.d.ts +4 -4
- package/dist/contract/index.js +9 -9
- package/dist/{default-registry-CrAp0pYq.js → default-registry-DBqVI4pq.js} +2 -2
- package/dist/{default-registry-CrAp0pYq.js.map → default-registry-DBqVI4pq.js.map} +1 -1
- package/dist/{define-agent-eval-V1jQyCDR.d.ts → define-agent-eval-CCbl8k2E.d.ts} +11 -4
- package/dist/define-agent-eval-CCbl8k2E.d.ts.map +1 -0
- package/dist/{define-agent-eval-ox5McL6e.js → define-agent-eval-DEMsu5eA.js} +54 -36
- package/dist/define-agent-eval-DEMsu5eA.js.map +1 -0
- package/dist/{dspy-rlm-engine-Caz2pl4L.js → dspy-rlm-engine-DqjER2sV.js} +2 -2
- package/dist/{dspy-rlm-engine-Caz2pl4L.js.map → dspy-rlm-engine-DqjER2sV.js.map} +1 -1
- package/dist/{eval-campaign-BeAjdhzC.js → eval-campaign-Cs-7MiCs.js} +4 -5
- package/dist/{eval-campaign-BeAjdhzC.js.map → eval-campaign-Cs-7MiCs.js.map} +1 -1
- package/dist/experiment/index.d.ts +3 -68
- package/dist/experiment/index.d.ts.map +1 -1
- package/dist/experiment/index.js +6 -128
- package/dist/experiment/index.js.map +1 -1
- package/dist/{attestation-XSUpbc4o.js → experiment-tracker-BKEumQug.js} +2 -96
- package/dist/experiment-tracker-BKEumQug.js.map +1 -0
- package/dist/{attestation-c1QvaBdX.d.ts → experiment-tracker-CNwqCZFD.d.ts} +2 -78
- package/dist/experiment-tracker-CNwqCZFD.d.ts.map +1 -0
- package/dist/{external-optimizer-process-CxnFL1hd.js → external-optimizer-process-Dlz8YxrT.js} +3 -3
- package/dist/{external-optimizer-process-CxnFL1hd.js.map → external-optimizer-process-Dlz8YxrT.js.map} +1 -1
- package/dist/{external-optimizer-subprocess-CQi27uEI.js → external-optimizer-subprocess-q3VzlGAO.js} +2 -2
- package/dist/{external-optimizer-subprocess-CQi27uEI.js.map → external-optimizer-subprocess-q3VzlGAO.js.map} +1 -1
- package/dist/{index-Bn-nlnSV.d.ts → index-BAAiSF3_.d.ts} +2 -2
- package/dist/{index-Bn-nlnSV.d.ts.map → index-BAAiSF3_.d.ts.map} +1 -1
- package/dist/{index-DKXuBPXf.d.ts → index-Bg6OT2Dd.d.ts} +23 -10
- package/dist/{index-DKXuBPXf.d.ts.map → index-Bg6OT2Dd.d.ts.map} +1 -1
- package/dist/{index-BTrx5s8m.d.ts → index-DBkcm_9H.d.ts} +4 -4
- package/dist/{index-BTrx5s8m.d.ts.map → index-DBkcm_9H.d.ts.map} +1 -1
- package/dist/{index-D-UdhAmg.d.ts → index-u0d1Jp4F.d.ts} +4 -2
- package/dist/{index-D-UdhAmg.d.ts.map → index-u0d1Jp4F.d.ts.map} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +15 -16
- package/dist/index.js.map +1 -1
- package/dist/{integrity-BWywb34E.js → integrity-DsHWCebQ.js} +11 -435
- package/dist/integrity-DsHWCebQ.js.map +1 -0
- package/dist/ledger-core/index.d.ts +2 -2
- package/dist/ledger-core/index.js +2 -2
- package/dist/{ledger-core-PIfjCbKn.js → ledger-core-Cs9f7385.js} +60 -47
- package/dist/{ledger-core-PIfjCbKn.js.map → ledger-core-Cs9f7385.js.map} +1 -1
- package/dist/{llm-judge-DmNaBrXB.js → llm-judge-DliimmRb.js} +994 -1517
- package/dist/llm-judge-DliimmRb.js.map +1 -0
- package/dist/{mint-vWOdD8Ae.js → mint-Cc1_zwRQ.js} +2 -2
- package/dist/{mint-vWOdD8Ae.js.map → mint-Cc1_zwRQ.js.map} +1 -1
- package/dist/openapi.json +1 -1
- package/dist/opencode-sqlite-CNw3vubS.js +145 -0
- package/dist/opencode-sqlite-CNw3vubS.js.map +1 -0
- package/dist/{produced-state-B8mw6zj9.js → produced-state-DrMqa2HD.js} +3 -2
- package/dist/{produced-state-B8mw6zj9.js.map → produced-state-DrMqa2HD.js.map} +1 -1
- package/dist/profile-cell.js +1 -268
- package/dist/{promotion-policy-LY9mVQ7W.js → promotion-policy-DWOm70gx.js} +2 -2
- package/dist/{promotion-policy-LY9mVQ7W.js.map → promotion-policy-DWOm70gx.js.map} +1 -1
- package/dist/{release-confidence-BsGEg_xg.js → release-confidence-BcGCclTB.js} +2 -2
- package/dist/{release-confidence-BsGEg_xg.js.map → release-confidence-BcGCclTB.js.map} +1 -1
- package/dist/report-command-DKlXfU5r.js +1528 -0
- package/dist/report-command-DKlXfU5r.js.map +1 -0
- package/dist/reporting.js +2 -2
- package/dist/{reward-hacking-CKW4teig.js → reward-hacking-D0XwhVWE.js} +2 -215
- package/dist/reward-hacking-D0XwhVWE.js.map +1 -0
- package/dist/rl.js +5 -4
- package/dist/rl.js.map +1 -1
- package/dist/rollout/index.js +4 -3
- package/dist/{rollout-C-znbbYg.js → rollout-DmoJVqrF.js} +4 -3
- package/dist/{rollout-C-znbbYg.js.map → rollout-DmoJVqrF.js.map} +1 -1
- package/dist/run-record-CR63CpHK.js +216 -0
- package/dist/run-record-CR63CpHK.js.map +1 -0
- package/dist/{run-record-ZIsR9Fif.js → run-record-DQpSf7t-.js} +2 -2
- package/dist/{run-record-ZIsR9Fif.js.map → run-record-DQpSf7t-.js.map} +1 -1
- package/dist/{semantic-concept-judge-E3s_fEjB.js → semantic-concept-judge-Dw-f7TEs.js} +3 -3
- package/dist/{semantic-concept-judge-E3s_fEjB.js.map → semantic-concept-judge-Dw-f7TEs.js.map} +1 -1
- package/dist/{sequential-B51qAYE4.js → sequential-B5gXgcyp.js} +3 -3
- package/dist/{sequential-B51qAYE4.js.map → sequential-B5gXgcyp.js.map} +1 -1
- package/dist/{skillopt-optimization-method-f7399oGb.js → skillopt-optimization-method-CV7go7ex.js} +6 -749
- package/dist/skillopt-optimization-method-CV7go7ex.js.map +1 -0
- package/dist/{statistical-heldout-Cqb73yE9.d.ts → statistical-heldout-Z9NROFFS.d.ts} +156 -3
- package/dist/statistical-heldout-Z9NROFFS.d.ts.map +1 -0
- package/dist/{summary-report-Bgh8CpNK.js → summary-report-B16xy9Kd.js} +2 -2
- package/dist/{summary-report-Bgh8CpNK.js.map → summary-report-B16xy9Kd.js.map} +1 -1
- package/dist/supervisor-run/index.d.ts +71 -6
- package/dist/supervisor-run/index.d.ts.map +1 -1
- package/dist/supervisor-run/index.js +6 -1357
- package/dist/supervisor-run/index.js.map +1 -1
- package/dist/terminal-record-Ce9_UjRz.js +539 -0
- package/dist/terminal-record-Ce9_UjRz.js.map +1 -0
- package/dist/traces.js +1 -1
- package/dist/{types-CoPUTiXb.d.ts → types-vUdAx2Cj.d.ts} +65 -3
- package/dist/types-vUdAx2Cj.d.ts.map +1 -0
- package/docs/public-api.md +62 -39
- package/docs/search-history-receipts.md +48 -1
- package/package.json +1 -1
- package/dist/attestation-XSUpbc4o.js.map +0 -1
- package/dist/attestation-c1QvaBdX.d.ts.map +0 -1
- package/dist/define-agent-eval-V1jQyCDR.d.ts.map +0 -1
- package/dist/define-agent-eval-ox5McL6e.js.map +0 -1
- package/dist/integrity-BWywb34E.js.map +0 -1
- package/dist/llm-judge-DmNaBrXB.js.map +0 -1
- package/dist/opencode-sqlite-eK6HW6dr.js.map +0 -1
- package/dist/power-preflight-CFXm0Vjo.js +0 -502
- package/dist/power-preflight-CFXm0Vjo.js.map +0 -1
- package/dist/pre-registration-D94b7Of5.js +0 -110
- package/dist/pre-registration-D94b7Of5.js.map +0 -1
- package/dist/profile-cell.js.map +0 -1
- package/dist/reward-hacking-CKW4teig.js.map +0 -1
- package/dist/skillopt-optimization-method-f7399oGb.js.map +0 -1
- package/dist/statistical-heldout-Cqb73yE9.d.ts.map +0 -1
- package/dist/types-CoPUTiXb.d.ts.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { c as unscreenedRewardFields } from "./reward-nw2xZGZG.js";
|
|
2
2
|
import { f as validateRolloutLine, r as ROLLOUT_SCHEMA, u as isRolloutLine } from "./schema-C1aaAxTf.js";
|
|
3
|
+
import { d as parseJson, p as parseSupervisorTree, r as readTerminalRecord, s as isUnavailable, u as asRecord } from "./terminal-record-Ce9_UjRz.js";
|
|
3
4
|
//#region src/supervisor-run/integrity-issues.ts
|
|
4
5
|
function evidence(path, value) {
|
|
5
6
|
return {
|
|
@@ -762,436 +763,6 @@ function treeIssues(tree, uncertainty = {}) {
|
|
|
762
763
|
//#region src/supervisor-run/integrity-types.ts
|
|
763
764
|
const SUPERVISOR_RUN_INTEGRITY_SCHEMA = "tangle.supervisor-run-integrity@1";
|
|
764
765
|
//#endregion
|
|
765
|
-
//#region src/supervisor-run/source-facts.ts
|
|
766
|
-
function asRecord(v) {
|
|
767
|
-
return typeof v === "object" && v !== null ? v : {};
|
|
768
|
-
}
|
|
769
|
-
function num(v) {
|
|
770
|
-
return typeof v === "number" && Number.isFinite(v) ? v : 0;
|
|
771
|
-
}
|
|
772
|
-
function readSpend(v) {
|
|
773
|
-
const rec = asRecord(v);
|
|
774
|
-
const tok = asRecord(rec.tokens);
|
|
775
|
-
const cacheRead = tok.cacheRead ?? tok.cache_read;
|
|
776
|
-
const cacheWrite = tok.cacheWrite ?? tok.cache_write;
|
|
777
|
-
return {
|
|
778
|
-
tokens: {
|
|
779
|
-
input: num(tok.input),
|
|
780
|
-
output: num(tok.output),
|
|
781
|
-
cacheRead: num(cacheRead),
|
|
782
|
-
cacheWrite: num(cacheWrite),
|
|
783
|
-
hasCache: cacheRead !== void 0 || cacheWrite !== void 0,
|
|
784
|
-
breakdownKnown: tok.cacheBreakdownKnown !== false
|
|
785
|
-
},
|
|
786
|
-
tokensKnown: rec.tokensKnown !== false,
|
|
787
|
-
usd: num(rec.usd),
|
|
788
|
-
usdKnown: rec.usdKnown !== false
|
|
789
|
-
};
|
|
790
|
-
}
|
|
791
|
-
function parseJsonl(text) {
|
|
792
|
-
return parseJsonlWithDiagnostics(text).rows;
|
|
793
|
-
}
|
|
794
|
-
function parseJsonlWithDiagnostics(text) {
|
|
795
|
-
if (text === null) return {
|
|
796
|
-
rows: [],
|
|
797
|
-
invalidRows: 0
|
|
798
|
-
};
|
|
799
|
-
const out = [];
|
|
800
|
-
let invalidRows = 0;
|
|
801
|
-
for (const line of text.split("\n")) {
|
|
802
|
-
const trimmed = line.trim();
|
|
803
|
-
if (!trimmed) continue;
|
|
804
|
-
try {
|
|
805
|
-
const parsed = JSON.parse(trimmed);
|
|
806
|
-
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) out.push(parsed);
|
|
807
|
-
else invalidRows += 1;
|
|
808
|
-
} catch {
|
|
809
|
-
invalidRows += 1;
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
return {
|
|
813
|
-
rows: out,
|
|
814
|
-
invalidRows
|
|
815
|
-
};
|
|
816
|
-
}
|
|
817
|
-
function parseJson(text) {
|
|
818
|
-
if (text === null) return null;
|
|
819
|
-
try {
|
|
820
|
-
const parsed = JSON.parse(text);
|
|
821
|
-
return typeof parsed === "object" && parsed !== null ? parsed : null;
|
|
822
|
-
} catch {
|
|
823
|
-
return null;
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
function ms(at) {
|
|
827
|
-
if (typeof at !== "string") return null;
|
|
828
|
-
const t = Date.parse(at);
|
|
829
|
-
return Number.isFinite(t) ? t : null;
|
|
830
|
-
}
|
|
831
|
-
function readVerdict(v) {
|
|
832
|
-
if (typeof v === "string") return {
|
|
833
|
-
label: v,
|
|
834
|
-
valid: null,
|
|
835
|
-
score: null,
|
|
836
|
-
raw: v
|
|
837
|
-
};
|
|
838
|
-
if (typeof v !== "object" || v === null) return {
|
|
839
|
-
label: null,
|
|
840
|
-
valid: null,
|
|
841
|
-
score: null,
|
|
842
|
-
raw: null
|
|
843
|
-
};
|
|
844
|
-
const rec = v;
|
|
845
|
-
const valid = typeof rec.valid === "boolean" ? rec.valid : null;
|
|
846
|
-
return {
|
|
847
|
-
label: valid === null ? null : valid ? "valid" : "invalid",
|
|
848
|
-
valid,
|
|
849
|
-
score: typeof rec.score === "number" && Number.isFinite(rec.score) ? rec.score : null,
|
|
850
|
-
raw: v
|
|
851
|
-
};
|
|
852
|
-
}
|
|
853
|
-
function workerSourceKey(worker) {
|
|
854
|
-
return worker.workerId ?? worker.label;
|
|
855
|
-
}
|
|
856
|
-
/** Event kinds this parser folds into the tree. */
|
|
857
|
-
const TREE_EVENT_KINDS = [
|
|
858
|
-
"spawned",
|
|
859
|
-
"settled",
|
|
860
|
-
"cancelled",
|
|
861
|
-
"metered"
|
|
862
|
-
];
|
|
863
|
-
/**
|
|
864
|
-
* Event kinds `agent-runtime` journals that this parser recognizes but does not model as
|
|
865
|
-
* tree nodes: `waiting` arms a wait node and `woken` settles it. They are counted by kind
|
|
866
|
-
* rather than dropped, so "understood, not modeled" can never be mistaken for "absent".
|
|
867
|
-
*/
|
|
868
|
-
const UNMODELLED_EVENT_KINDS = ["waiting", "woken"];
|
|
869
|
-
function treeEventKind(value) {
|
|
870
|
-
return TREE_EVENT_KINDS.includes(value) ? value : null;
|
|
871
|
-
}
|
|
872
|
-
/**
|
|
873
|
-
* Classify one parsed journal row. Every row lands in exactly one outcome — interpreted,
|
|
874
|
-
* recognized-but-not-modeled, or unreadable — because a row that falls through silently is
|
|
875
|
-
* how a run with events reads as a run with none.
|
|
876
|
-
*/
|
|
877
|
-
function readJournalRow(row) {
|
|
878
|
-
const kind = row.kind;
|
|
879
|
-
if (typeof kind !== "string") return { outcome: "unreadable" };
|
|
880
|
-
if (kind === "begin" && typeof row.root === "string") return {
|
|
881
|
-
outcome: "ignored",
|
|
882
|
-
dialect: "runtime-envelope",
|
|
883
|
-
kind: "begin"
|
|
884
|
-
};
|
|
885
|
-
if (kind === "event") {
|
|
886
|
-
const inner = row.event;
|
|
887
|
-
if (typeof inner !== "object" || inner === null || Array.isArray(inner)) return { outcome: "unreadable" };
|
|
888
|
-
const innerKind = inner.kind;
|
|
889
|
-
if (typeof innerKind !== "string") return { outcome: "unreadable" };
|
|
890
|
-
const tree = treeEventKind(innerKind);
|
|
891
|
-
if (tree !== null) return {
|
|
892
|
-
outcome: "event",
|
|
893
|
-
dialect: "runtime-envelope",
|
|
894
|
-
kind: tree,
|
|
895
|
-
event: inner
|
|
896
|
-
};
|
|
897
|
-
return {
|
|
898
|
-
outcome: "ignored",
|
|
899
|
-
dialect: "runtime-envelope",
|
|
900
|
-
kind: innerKind
|
|
901
|
-
};
|
|
902
|
-
}
|
|
903
|
-
const tree = treeEventKind(kind);
|
|
904
|
-
if (tree !== null) return {
|
|
905
|
-
outcome: "event",
|
|
906
|
-
dialect: "flat",
|
|
907
|
-
kind: tree,
|
|
908
|
-
event: row
|
|
909
|
-
};
|
|
910
|
-
if (UNMODELLED_EVENT_KINDS.includes(kind)) return {
|
|
911
|
-
outcome: "ignored",
|
|
912
|
-
dialect: "flat",
|
|
913
|
-
kind
|
|
914
|
-
};
|
|
915
|
-
return { outcome: "unreadable" };
|
|
916
|
-
}
|
|
917
|
-
function summarizeDialect(seen) {
|
|
918
|
-
if (seen.size === 0) return "none";
|
|
919
|
-
if (seen.size > 1) return "mixed";
|
|
920
|
-
return seen.has("runtime-envelope") ? "runtime-envelope" : "flat";
|
|
921
|
-
}
|
|
922
|
-
function parseSupervisorTree(src) {
|
|
923
|
-
const parsedJournal = parseJsonlWithDiagnostics(src.journal);
|
|
924
|
-
const events = parsedJournal.rows;
|
|
925
|
-
const state = parseJson(src.state);
|
|
926
|
-
const spawns = [];
|
|
927
|
-
const closes = [];
|
|
928
|
-
let brainIn = 0;
|
|
929
|
-
let brainOut = 0;
|
|
930
|
-
let brainCacheRead = 0;
|
|
931
|
-
let brainCacheWrite = 0;
|
|
932
|
-
let brainHasCache = false;
|
|
933
|
-
let brainCacheBreakdownKnown = true;
|
|
934
|
-
let brainTokensKnownCount = 0;
|
|
935
|
-
let brainTokensUnknownCount = 0;
|
|
936
|
-
let brainUsd = 0;
|
|
937
|
-
let brainUsdKnownCount = 0;
|
|
938
|
-
let brainUsdUnknownCount = 0;
|
|
939
|
-
let meteredCount = 0;
|
|
940
|
-
let rootId = null;
|
|
941
|
-
let unreadableRows = 0;
|
|
942
|
-
const ignoredByKind = /* @__PURE__ */ new Map();
|
|
943
|
-
const dialectsSeen = /* @__PURE__ */ new Set();
|
|
944
|
-
const meteredRows = [];
|
|
945
|
-
for (const [sourceRow, row] of events.entries()) {
|
|
946
|
-
const reading = readJournalRow(row);
|
|
947
|
-
if (reading.outcome === "unreadable") {
|
|
948
|
-
unreadableRows += 1;
|
|
949
|
-
continue;
|
|
950
|
-
}
|
|
951
|
-
dialectsSeen.add(reading.dialect);
|
|
952
|
-
if (reading.outcome === "ignored") {
|
|
953
|
-
ignoredByKind.set(reading.kind, (ignoredByKind.get(reading.kind) ?? 0) + 1);
|
|
954
|
-
continue;
|
|
955
|
-
}
|
|
956
|
-
const { kind, event: ev } = reading;
|
|
957
|
-
const id = typeof ev.id === "string" ? ev.id : "";
|
|
958
|
-
if (kind === "spawned") {
|
|
959
|
-
const parent = typeof ev.parent === "string" && ev.parent.length > 0 ? ev.parent : null;
|
|
960
|
-
const label = typeof ev.label === "string" ? ev.label : "";
|
|
961
|
-
const invalidFields = [];
|
|
962
|
-
if (id.length === 0) invalidFields.push("id");
|
|
963
|
-
const parentOmittedForFirstRoot = ev.parent === void 0 && rootId === null;
|
|
964
|
-
if (ev.parent !== null && !parentOmittedForFirstRoot && !(typeof ev.parent === "string" && ev.parent.length > 0)) invalidFields.push("parent");
|
|
965
|
-
if (label.length === 0) invalidFields.push("label");
|
|
966
|
-
if (ev.role !== void 0 && ev.role !== "supervisor" && ev.role !== "worker") invalidFields.push("role");
|
|
967
|
-
if (ev.profileDigest !== void 0 && !(typeof ev.profileDigest === "string" && ev.profileDigest.length > 0)) invalidFields.push("profileDigest");
|
|
968
|
-
if (ev.runtime !== void 0 && !(typeof ev.runtime === "string" && ev.runtime.length > 0)) invalidFields.push("runtime");
|
|
969
|
-
const role = ev.role === "supervisor" || ev.role === "worker" ? ev.role : null;
|
|
970
|
-
const valid = invalidFields.length === 0;
|
|
971
|
-
if (valid && parent === null && rootId === null) rootId = id;
|
|
972
|
-
spawns.push({
|
|
973
|
-
sourceRow,
|
|
974
|
-
id,
|
|
975
|
-
parent,
|
|
976
|
-
label,
|
|
977
|
-
role,
|
|
978
|
-
profileDigest: typeof ev.profileDigest === "string" && ev.profileDigest.length > 0 ? ev.profileDigest : null,
|
|
979
|
-
runtime: typeof ev.runtime === "string" && ev.runtime.length > 0 ? ev.runtime : null,
|
|
980
|
-
at: ms(ev.at),
|
|
981
|
-
valid,
|
|
982
|
-
invalidFields
|
|
983
|
-
});
|
|
984
|
-
} else if (kind === "settled") {
|
|
985
|
-
const verdict = readVerdict(ev.verdict);
|
|
986
|
-
closes.push({
|
|
987
|
-
id,
|
|
988
|
-
kind: "settled",
|
|
989
|
-
status: typeof ev.status === "string" ? ev.status : null,
|
|
990
|
-
verdict: verdict.label,
|
|
991
|
-
valid: verdict.valid,
|
|
992
|
-
score: verdict.score,
|
|
993
|
-
rawVerdict: verdict.raw,
|
|
994
|
-
reason: typeof ev.reason === "string" ? ev.reason : null,
|
|
995
|
-
infra: typeof ev.infra === "boolean" ? ev.infra : null,
|
|
996
|
-
at: ms(ev.at),
|
|
997
|
-
spend: readSpend(ev.spent),
|
|
998
|
-
hasSpend: asRecord(ev.spent).tokens !== void 0
|
|
999
|
-
});
|
|
1000
|
-
} else if (kind === "cancelled") closes.push({
|
|
1001
|
-
id,
|
|
1002
|
-
kind: "cancelled",
|
|
1003
|
-
status: "cancelled",
|
|
1004
|
-
verdict: typeof ev.reason === "string" ? ev.reason : null,
|
|
1005
|
-
valid: null,
|
|
1006
|
-
score: null,
|
|
1007
|
-
rawVerdict: typeof ev.reason === "string" ? ev.reason : null,
|
|
1008
|
-
reason: typeof ev.reason === "string" ? ev.reason : null,
|
|
1009
|
-
infra: null,
|
|
1010
|
-
at: ms(ev.at),
|
|
1011
|
-
spend: {
|
|
1012
|
-
tokens: {
|
|
1013
|
-
input: 0,
|
|
1014
|
-
output: 0,
|
|
1015
|
-
cacheRead: 0,
|
|
1016
|
-
cacheWrite: 0,
|
|
1017
|
-
hasCache: false,
|
|
1018
|
-
breakdownKnown: true
|
|
1019
|
-
},
|
|
1020
|
-
tokensKnown: true,
|
|
1021
|
-
usd: 0,
|
|
1022
|
-
usdKnown: true
|
|
1023
|
-
},
|
|
1024
|
-
hasSpend: false
|
|
1025
|
-
});
|
|
1026
|
-
else if (kind === "metered") meteredRows.push({
|
|
1027
|
-
id,
|
|
1028
|
-
spend: readSpend(ev.spend),
|
|
1029
|
-
at: ms(ev.at)
|
|
1030
|
-
});
|
|
1031
|
-
else throw new Error(`unhandled journal event kind ${JSON.stringify(kind)}`);
|
|
1032
|
-
}
|
|
1033
|
-
for (const row of meteredRows) {
|
|
1034
|
-
if (rootId === null || row.id !== rootId) continue;
|
|
1035
|
-
if (row.spend.tokensKnown) {
|
|
1036
|
-
brainIn += row.spend.tokens.input;
|
|
1037
|
-
brainOut += row.spend.tokens.output;
|
|
1038
|
-
brainCacheRead += row.spend.tokens.cacheRead;
|
|
1039
|
-
brainCacheWrite += row.spend.tokens.cacheWrite;
|
|
1040
|
-
brainHasCache = brainHasCache || row.spend.tokens.hasCache;
|
|
1041
|
-
brainCacheBreakdownKnown = brainCacheBreakdownKnown && row.spend.tokens.breakdownKnown;
|
|
1042
|
-
brainTokensKnownCount += 1;
|
|
1043
|
-
} else brainTokensUnknownCount += 1;
|
|
1044
|
-
if (row.spend.usdKnown) {
|
|
1045
|
-
brainUsd += row.spend.usd;
|
|
1046
|
-
brainUsdKnownCount += 1;
|
|
1047
|
-
} else brainUsdUnknownCount += 1;
|
|
1048
|
-
meteredCount += 1;
|
|
1049
|
-
}
|
|
1050
|
-
const workerSpawns = spawns.filter((s) => s.valid && s.id !== rootId);
|
|
1051
|
-
const workerIds = new Set(workerSpawns.map((s) => s.id));
|
|
1052
|
-
const workerCloses = closes.filter((c) => workerIds.has(c.id));
|
|
1053
|
-
const workerLogs = /* @__PURE__ */ new Map();
|
|
1054
|
-
const workerLogRows = [];
|
|
1055
|
-
for (const [sourceIndex, w] of (src.workers ?? []).entries()) {
|
|
1056
|
-
const facts = {
|
|
1057
|
-
sourceIndex,
|
|
1058
|
-
workerId: w.workerId ?? null,
|
|
1059
|
-
label: w.label,
|
|
1060
|
-
inboxCaptured: w.inbox !== null,
|
|
1061
|
-
eventsCaptured: w.events !== null,
|
|
1062
|
-
inboxInvalidRows: 0,
|
|
1063
|
-
eventsInvalidRows: 0,
|
|
1064
|
-
started: null,
|
|
1065
|
-
finished: false,
|
|
1066
|
-
finishedAt: null,
|
|
1067
|
-
passed: null,
|
|
1068
|
-
score: null,
|
|
1069
|
-
finishedPatchBytes: null,
|
|
1070
|
-
evidenceBytes: 0,
|
|
1071
|
-
steersQueued: null,
|
|
1072
|
-
steersDelivered: null,
|
|
1073
|
-
steersQueuedUnavailable: null,
|
|
1074
|
-
steersDeliveredUnavailable: null,
|
|
1075
|
-
questions: 0,
|
|
1076
|
-
steerRequests: [],
|
|
1077
|
-
steerAcknowledgements: []
|
|
1078
|
-
};
|
|
1079
|
-
const parsedInbox = parseJsonlWithDiagnostics(w.inbox);
|
|
1080
|
-
const parsedEvents = parseJsonlWithDiagnostics(w.events);
|
|
1081
|
-
facts.inboxInvalidRows = parsedInbox.invalidRows;
|
|
1082
|
-
facts.eventsInvalidRows = parsedEvents.invalidRows;
|
|
1083
|
-
for (const [row, req] of parsedInbox.rows.entries()) {
|
|
1084
|
-
if (typeof req.message !== "string" || req.message.trim().length === 0) continue;
|
|
1085
|
-
facts.steerRequests.push({
|
|
1086
|
-
requestId: typeof req.id === "string" && req.id.length > 0 ? req.id : null,
|
|
1087
|
-
row
|
|
1088
|
-
});
|
|
1089
|
-
}
|
|
1090
|
-
for (const [row, ev] of parsedEvents.rows.entries()) {
|
|
1091
|
-
const kind = ev.kind;
|
|
1092
|
-
if (kind === "message") {
|
|
1093
|
-
if (ev.direction === "up") {
|
|
1094
|
-
facts.questions += 1;
|
|
1095
|
-
continue;
|
|
1096
|
-
}
|
|
1097
|
-
facts.steerAcknowledgements.push({
|
|
1098
|
-
requestId: typeof ev.requestId === "string" && ev.requestId.length > 0 ? ev.requestId : null,
|
|
1099
|
-
delivered: typeof ev.delivered === "boolean" ? ev.delivered : null,
|
|
1100
|
-
row
|
|
1101
|
-
});
|
|
1102
|
-
} else if (kind === "started") facts.started = ms(ev.at);
|
|
1103
|
-
else if (kind === "finished") {
|
|
1104
|
-
facts.finished = true;
|
|
1105
|
-
facts.finishedAt = ms(ev.at);
|
|
1106
|
-
facts.passed = typeof ev.passed === "boolean" ? ev.passed : null;
|
|
1107
|
-
facts.score = typeof ev.score === "number" && Number.isFinite(ev.score) ? ev.score : null;
|
|
1108
|
-
facts.finishedPatchBytes = typeof ev.patchBytes === "number" ? ev.patchBytes : null;
|
|
1109
|
-
facts.evidenceBytes = typeof ev.evidence === "string" ? ev.evidence.length : 0;
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
const requestsById = /* @__PURE__ */ new Map();
|
|
1113
|
-
for (const request of facts.steerRequests) {
|
|
1114
|
-
if (request.requestId === null) continue;
|
|
1115
|
-
requestsById.set(request.requestId, (requestsById.get(request.requestId) ?? 0) + 1);
|
|
1116
|
-
}
|
|
1117
|
-
const acknowledgementsById = /* @__PURE__ */ new Map();
|
|
1118
|
-
for (const acknowledgement of facts.steerAcknowledgements) {
|
|
1119
|
-
if (acknowledgement.requestId === null) continue;
|
|
1120
|
-
const matches = acknowledgementsById.get(acknowledgement.requestId) ?? [];
|
|
1121
|
-
matches.push(acknowledgement);
|
|
1122
|
-
acknowledgementsById.set(acknowledgement.requestId, matches);
|
|
1123
|
-
}
|
|
1124
|
-
const queueProblems = [];
|
|
1125
|
-
if (!facts.inboxCaptured) queueProblems.push("inbox absent");
|
|
1126
|
-
if (!facts.eventsCaptured) queueProblems.push("events absent");
|
|
1127
|
-
if (facts.inboxInvalidRows > 0) queueProblems.push("inbox contains malformed rows");
|
|
1128
|
-
if (facts.eventsInvalidRows > 0) queueProblems.push("events contain malformed rows");
|
|
1129
|
-
if (facts.steerRequests.some((request) => request.requestId === null)) queueProblems.push("queued request id missing");
|
|
1130
|
-
if ([...requestsById.values()].some((count) => count > 1)) queueProblems.push("queued request id duplicated");
|
|
1131
|
-
if (facts.steerAcknowledgements.some((acknowledgement) => acknowledgement.requestId === null)) queueProblems.push("acknowledgement request id missing");
|
|
1132
|
-
if ([...acknowledgementsById.keys()].some((id) => !requestsById.has(id))) queueProblems.push("acknowledgement has no queued request");
|
|
1133
|
-
if (queueProblems.length === 0) facts.steersQueued = requestsById.size;
|
|
1134
|
-
else facts.steersQueuedUnavailable = [...new Set(queueProblems)].join("; ");
|
|
1135
|
-
const deliveryProblems = [...queueProblems];
|
|
1136
|
-
if ([...acknowledgementsById.values()].some((rows) => rows.length > 1)) deliveryProblems.push("acknowledgement request id duplicated");
|
|
1137
|
-
if (facts.steerAcknowledgements.some((acknowledgement) => acknowledgement.delivered === null)) deliveryProblems.push("acknowledgement delivery status missing");
|
|
1138
|
-
if (deliveryProblems.length === 0) facts.steersDelivered = [...requestsById.keys()].filter((id) => {
|
|
1139
|
-
const acknowledgement = acknowledgementsById.get(id);
|
|
1140
|
-
return acknowledgement?.length === 1 && acknowledgement[0]?.delivered === true;
|
|
1141
|
-
}).length;
|
|
1142
|
-
else facts.steersDeliveredUnavailable = [...new Set(deliveryProblems)].join("; ");
|
|
1143
|
-
workerLogRows.push(facts);
|
|
1144
|
-
workerLogs.set(workerSourceKey(w), facts);
|
|
1145
|
-
}
|
|
1146
|
-
const startedAt = ms(state?.startedAt) ?? spawns[0]?.at ?? null;
|
|
1147
|
-
const rootClose = rootId === null ? null : closes.find((close) => close.id === rootId);
|
|
1148
|
-
const completedAt = ms(state?.completedAt) ?? rootClose?.at ?? null;
|
|
1149
|
-
let firstEventAt = null;
|
|
1150
|
-
let lastEventAt = null;
|
|
1151
|
-
const widenEventSpan = (at) => {
|
|
1152
|
-
if (at === null) return;
|
|
1153
|
-
if (firstEventAt === null || at < firstEventAt) firstEventAt = at;
|
|
1154
|
-
if (lastEventAt === null || at > lastEventAt) lastEventAt = at;
|
|
1155
|
-
};
|
|
1156
|
-
for (const spawn of spawns) widenEventSpan(spawn.at);
|
|
1157
|
-
for (const close of closes) widenEventSpan(close.at);
|
|
1158
|
-
for (const metered of meteredRows) widenEventSpan(metered.at);
|
|
1159
|
-
return {
|
|
1160
|
-
rootId,
|
|
1161
|
-
spawns,
|
|
1162
|
-
closes,
|
|
1163
|
-
workerSpawns,
|
|
1164
|
-
workerCloses,
|
|
1165
|
-
brain: {
|
|
1166
|
-
tokensIn: brainIn,
|
|
1167
|
-
tokensOut: brainOut,
|
|
1168
|
-
cacheRead: brainCacheRead,
|
|
1169
|
-
cacheWrite: brainCacheWrite,
|
|
1170
|
-
hasCache: brainHasCache,
|
|
1171
|
-
cacheBreakdownKnown: brainCacheBreakdownKnown,
|
|
1172
|
-
tokensKnownCount: brainTokensKnownCount,
|
|
1173
|
-
tokensUnknownCount: brainTokensUnknownCount,
|
|
1174
|
-
usd: brainUsd,
|
|
1175
|
-
usdKnownCount: brainUsdKnownCount,
|
|
1176
|
-
usdUnknownCount: brainUsdUnknownCount,
|
|
1177
|
-
meteredCount
|
|
1178
|
-
},
|
|
1179
|
-
workerLogs,
|
|
1180
|
-
workerLogRows,
|
|
1181
|
-
journalRows: events.length + parsedJournal.invalidRows,
|
|
1182
|
-
journalInvalidRows: parsedJournal.invalidRows + unreadableRows,
|
|
1183
|
-
journalMalformedJsonRows: parsedJournal.invalidRows,
|
|
1184
|
-
journalIgnoredRowsByKind: Object.fromEntries(ignoredByKind),
|
|
1185
|
-
journalMeteredRows: meteredRows.length,
|
|
1186
|
-
journalDialect: summarizeDialect(dialectsSeen),
|
|
1187
|
-
state,
|
|
1188
|
-
startedAt,
|
|
1189
|
-
completedAt,
|
|
1190
|
-
firstEventAt,
|
|
1191
|
-
lastEventAt
|
|
1192
|
-
};
|
|
1193
|
-
}
|
|
1194
|
-
//#endregion
|
|
1195
766
|
//#region src/supervisor-run/rollout-nodes.ts
|
|
1196
767
|
/**
|
|
1197
768
|
* The supervision tree as `tangle.rollout.v1` rows.
|
|
@@ -1260,6 +831,11 @@ function supervisorRunRolloutLinesFromFacts(src, tree, opts = {}) {
|
|
|
1260
831
|
const result = parseJson(src.result);
|
|
1261
832
|
const judge = parseJson(src.judge);
|
|
1262
833
|
const stateResult = asRecord(state?.result);
|
|
834
|
+
const terminal = readTerminalRecord({
|
|
835
|
+
state,
|
|
836
|
+
result,
|
|
837
|
+
failure: src.failure === void 0 ? void 0 : parseJson(src.failure)
|
|
838
|
+
});
|
|
1263
839
|
const rootId = tree.rootId;
|
|
1264
840
|
const runId = opts.runId ?? rootId ?? src.runRef;
|
|
1265
841
|
const suite = opts.suite ?? "supervisor-run";
|
|
@@ -1314,7 +890,7 @@ function supervisorRunRolloutLinesFromFacts(src, tree, opts = {}) {
|
|
|
1314
890
|
verdict: judge ?? null,
|
|
1315
891
|
metrics: {
|
|
1316
892
|
arm: src.arm,
|
|
1317
|
-
sup_status:
|
|
893
|
+
sup_status: isUnavailable(terminal.supStatus) ? null : terminal.supStatus,
|
|
1318
894
|
sup_verdict: typeof state?.verdict === "string" ? state.verdict : null,
|
|
1319
895
|
delivered: typeof stateResult.delivered === "boolean" ? stateResult.delivered : null,
|
|
1320
896
|
verify_pass: typeof result?.verify_pass === "boolean" ? result.verify_pass : null,
|
|
@@ -1325,9 +901,9 @@ function supervisorRunRolloutLinesFromFacts(src, tree, opts = {}) {
|
|
|
1325
901
|
runtime: rootSpawn?.runtime ?? null,
|
|
1326
902
|
profile_digest: rootSpawn?.profileDigest ?? null
|
|
1327
903
|
},
|
|
1328
|
-
is_completed:
|
|
904
|
+
is_completed: terminal.completed === true,
|
|
1329
905
|
is_truncated: false,
|
|
1330
|
-
error:
|
|
906
|
+
error: terminal.completed !== false ? null : !isUnavailable(terminal.supReason) && terminal.supReason !== null ? terminal.supReason : !isUnavailable(terminal.failure) && terminal.failure !== null ? terminal.failure.message ?? terminal.failure.name : null,
|
|
1331
907
|
realness_gated: false
|
|
1332
908
|
},
|
|
1333
909
|
cost: {
|
|
@@ -1513,6 +1089,6 @@ function analyzeSupervisorRunIntegrity(input, options = {}) {
|
|
|
1513
1089
|
};
|
|
1514
1090
|
}
|
|
1515
1091
|
//#endregion
|
|
1516
|
-
export {
|
|
1092
|
+
export { supervisorRunRolloutLines as n, SUPERVISOR_RUN_INTEGRITY_SCHEMA as r, analyzeSupervisorRunIntegrity as t };
|
|
1517
1093
|
|
|
1518
|
-
//# sourceMappingURL=integrity-
|
|
1094
|
+
//# sourceMappingURL=integrity-DsHWCebQ.js.map
|