@tangle-network/agent-eval 0.170.0 → 0.172.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.
Files changed (117) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +3 -0
  3. package/dist/adapters/http.d.ts +2 -2
  4. package/dist/analyst/index.d.ts +5 -5
  5. package/dist/analyst/index.js +2 -2
  6. package/dist/{experiment-tracker-Dm8yQMqb.d.ts → attestation-CJBGmMVh.d.ts} +78 -2
  7. package/dist/attestation-CJBGmMVh.d.ts.map +1 -0
  8. package/dist/{experiment-tracker-BKEumQug.js → attestation-XSUpbc4o.js} +96 -2
  9. package/dist/attestation-XSUpbc4o.js.map +1 -0
  10. package/dist/{benchmark-command-BA7qOdWw.js → benchmark-command-DoFcisuM.js} +2 -2
  11. package/dist/{benchmark-command-BA7qOdWw.js.map → benchmark-command-DoFcisuM.js.map} +1 -1
  12. package/dist/benchmarks/index.d.ts +4 -4
  13. package/dist/benchmarks/index.js +2 -2
  14. package/dist/bounded-process-CVOC_D3H.js +181 -0
  15. package/dist/bounded-process-CVOC_D3H.js.map +1 -0
  16. package/dist/builder-eval/index.js +39 -98
  17. package/dist/builder-eval/index.js.map +1 -1
  18. package/dist/campaign/index.d.ts +8 -7
  19. package/dist/campaign/index.js +4 -4
  20. package/dist/{campaign-BeCbxFqs.js → campaign-Dp35pBbS.js} +4 -4
  21. package/dist/{campaign-BeCbxFqs.js.map → campaign-Dp35pBbS.js.map} +1 -1
  22. package/dist/canonical-CFpojCN5.d.ts +31 -0
  23. package/dist/canonical-CFpojCN5.d.ts.map +1 -0
  24. package/dist/{chat-client-DEtybj5i.js → chat-client-DI79OPye.js} +2 -2
  25. package/dist/{chat-client-DEtybj5i.js.map → chat-client-DI79OPye.js.map} +1 -1
  26. package/dist/cli.js +1 -1
  27. package/dist/{client-_Fsa5c2_.d.ts → client-Df7wdslk.d.ts} +2 -2
  28. package/dist/{client-_Fsa5c2_.d.ts.map → client-Df7wdslk.d.ts.map} +1 -1
  29. package/dist/contract/index.d.ts +9 -9
  30. package/dist/contract/index.js +4 -4
  31. package/dist/{default-registry-ovxrOP0_.d.ts → default-registry-XxedTLwu.d.ts} +3 -3
  32. package/dist/{default-registry-ovxrOP0_.d.ts.map → default-registry-XxedTLwu.d.ts.map} +1 -1
  33. package/dist/{define-agent-eval-DVJm8Xlh.d.ts → define-agent-eval-0wW7gFhr.d.ts} +4 -4
  34. package/dist/{define-agent-eval-DVJm8Xlh.d.ts.map → define-agent-eval-0wW7gFhr.d.ts.map} +1 -1
  35. package/dist/{define-agent-eval-Clj-8igZ.js → define-agent-eval-jS8xj_Q_.js} +2 -2
  36. package/dist/{define-agent-eval-Clj-8igZ.js.map → define-agent-eval-jS8xj_Q_.js.map} +1 -1
  37. package/dist/descriptive-B2iPaT9J.d.ts +89 -0
  38. package/dist/descriptive-B2iPaT9J.d.ts.map +1 -0
  39. package/dist/{engine-D12Rb6WB.d.ts → engine-BfRay1qD.d.ts} +2 -2
  40. package/dist/{engine-D12Rb6WB.d.ts.map → engine-BfRay1qD.d.ts.map} +1 -1
  41. package/dist/experiment/index.d.ts +3 -54
  42. package/dist/experiment/index.d.ts.map +1 -1
  43. package/dist/experiment/index.js +1 -95
  44. package/dist/experiment/index.js.map +1 -1
  45. package/dist/{heldout-gate-Bn7_xWCv.d.ts → heldout-gate-JgNRDZwZ.d.ts} +3 -3
  46. package/dist/{heldout-gate-Bn7_xWCv.d.ts.map → heldout-gate-JgNRDZwZ.d.ts.map} +1 -1
  47. package/dist/hosted/index.d.ts +1 -1
  48. package/dist/{index-lfaSeKSD.d.ts → index-D-UdhAmg.d.ts} +3 -31
  49. package/dist/index-D-UdhAmg.d.ts.map +1 -0
  50. package/dist/{index-CM-SM00y.d.ts → index-DDAPhUJJ.d.ts} +4 -4
  51. package/dist/{index-CM-SM00y.d.ts.map → index-DDAPhUJJ.d.ts.map} +1 -1
  52. package/dist/{index-Bfs5aufo.d.ts → index-DnglhM0A.d.ts} +9 -9
  53. package/dist/{index-Bfs5aufo.d.ts.map → index-DnglhM0A.d.ts.map} +1 -1
  54. package/dist/{index-DBbivBNs.d.ts → index-_vPrVMRX.d.ts} +6 -6
  55. package/dist/{index-DBbivBNs.d.ts.map → index-_vPrVMRX.d.ts.map} +1 -1
  56. package/dist/index.d.ts +245 -15
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +712 -9
  59. package/dist/index.js.map +1 -1
  60. package/dist/{integrity-CyWSSoQS.js → integrity-BWywb34E.js} +34 -11
  61. package/dist/{integrity-CyWSSoQS.js.map → integrity-BWywb34E.js.map} +1 -1
  62. package/dist/ledger-core/index.d.ts +2 -1
  63. package/dist/{llm-judge-DbJdo8Nj.js → llm-judge-aQHIk5_-.js} +20 -11
  64. package/dist/llm-judge-aQHIk5_-.js.map +1 -0
  65. package/dist/{matrix-BpI5Trmo.d.ts → matrix-Ch8JO1pG.d.ts} +2 -2
  66. package/dist/{matrix-BpI5Trmo.d.ts.map → matrix-Ch8JO1pG.d.ts.map} +1 -1
  67. package/dist/meta-eval/index.d.ts +162 -2
  68. package/dist/meta-eval/index.d.ts.map +1 -1
  69. package/dist/meta-eval/index.js +287 -2
  70. package/dist/meta-eval/index.js.map +1 -1
  71. package/dist/multishot/golden/index.d.ts +1 -1
  72. package/dist/multishot/index.d.ts +2 -2
  73. package/dist/openapi.json +1 -1
  74. package/dist/{produced-state-CtSIp5cQ.js → produced-state-CxmbFxFd.js} +2 -2
  75. package/dist/{produced-state-CtSIp5cQ.js.map → produced-state-CxmbFxFd.js.map} +1 -1
  76. package/dist/{promotion-policy-CkXSgKkF.d.ts → promotion-policy-BBBcz5_3.d.ts} +2 -2
  77. package/dist/{promotion-policy-CkXSgKkF.d.ts.map → promotion-policy-BBBcz5_3.d.ts.map} +1 -1
  78. package/dist/{provenance-CIRUardl.d.ts → provenance-Dp-vvyrU.d.ts} +17 -5
  79. package/dist/provenance-Dp-vvyrU.d.ts.map +1 -0
  80. package/dist/rl.d.ts +1 -1
  81. package/dist/sandbox-harness-BlSOu4LX.d.ts.map +1 -1
  82. package/dist/{skillopt-optimization-method-B2R9C5aG.js → skillopt-optimization-method-LHi02MzH.js} +2 -2
  83. package/dist/{skillopt-optimization-method-B2R9C5aG.js.map → skillopt-optimization-method-LHi02MzH.js.map} +1 -1
  84. package/dist/{statistical-heldout-DFS7QGpS.d.ts → statistical-heldout-Yldkntvy.d.ts} +2 -2
  85. package/dist/{statistical-heldout-DFS7QGpS.d.ts.map → statistical-heldout-Yldkntvy.d.ts.map} +1 -1
  86. package/dist/{store-tool-spans-B2DJ_82T.d.ts → store-tool-spans-BvdUbeOB.d.ts} +3 -3
  87. package/dist/{store-tool-spans-B2DJ_82T.d.ts.map → store-tool-spans-BvdUbeOB.d.ts.map} +1 -1
  88. package/dist/supervisor-run/index.d.ts +35 -2
  89. package/dist/supervisor-run/index.d.ts.map +1 -1
  90. package/dist/supervisor-run/index.js +83 -38
  91. package/dist/supervisor-run/index.js.map +1 -1
  92. package/dist/{tool-groups-BnXlCJZQ.d.ts → tool-groups-DjwlMBvW.d.ts} +2 -2
  93. package/dist/tool-groups-DjwlMBvW.d.ts.map +1 -0
  94. package/dist/trace-repair/index.d.ts +1 -1
  95. package/dist/traces.d.ts +2 -2
  96. package/dist/{types-i21ccEkr.d.ts → types-CCZ34qmV.d.ts} +2 -2
  97. package/dist/{types-i21ccEkr.d.ts.map → types-CCZ34qmV.d.ts.map} +1 -1
  98. package/dist/{types-DeIUdzNd.d.ts → types-CoPUTiXb.d.ts} +23 -92
  99. package/dist/types-CoPUTiXb.d.ts.map +1 -0
  100. package/dist/{types-Dy237wiH.d.ts → types-nokrtr7M.d.ts} +21 -1
  101. package/dist/types-nokrtr7M.d.ts.map +1 -0
  102. package/dist/wire/index.d.ts +3 -3
  103. package/dist/wire/index.d.ts.map +1 -1
  104. package/docs/campaign-proposers.md +4 -0
  105. package/docs/eval-surface-map.md +36 -0
  106. package/docs/insight-report.md +19 -0
  107. package/docs/plants.md +123 -0
  108. package/docs/public-api.md +45 -20
  109. package/package.json +19 -18
  110. package/dist/experiment-tracker-BKEumQug.js.map +0 -1
  111. package/dist/experiment-tracker-Dm8yQMqb.d.ts.map +0 -1
  112. package/dist/index-lfaSeKSD.d.ts.map +0 -1
  113. package/dist/llm-judge-DbJdo8Nj.js.map +0 -1
  114. package/dist/provenance-CIRUardl.d.ts.map +0 -1
  115. package/dist/tool-groups-BnXlCJZQ.d.ts.map +0 -1
  116. package/dist/types-DeIUdzNd.d.ts.map +0 -1
  117. package/dist/types-Dy237wiH.d.ts.map +0 -1
@@ -1,6 +1,6 @@
1
- import { R as Scenario, b as GenerationRecord, p as Gate, w as JudgeScore } from "./types-Dy237wiH.js";
2
1
  import { T as EProcessState, r as SignedManifest } from "./pre-registration-DHz6P_6f.js";
3
2
  import { a as PairedPromotionDecision, d as PairedBootstrapResult, i as PairedMcNemarEvidence, r as PairedDecisionStatistic, t as PairedDecisionMethod } from "./paired-promotion-decision-CGzg0cI_.js";
3
+ import { R as Scenario, b as GenerationRecord, p as Gate, w as JudgeScore } from "./types-nokrtr7M.js";
4
4
  //#region src/campaign/gates/sequential.d.ts
5
5
  type SequentialDecision = 'promote' | 'continue' | 'undecided-at-maxN';
6
6
  interface SequentialObservation {
@@ -292,4 +292,4 @@ declare function dimensionRegressions(candidate: Map<string, Record<string, Judg
292
292
  }): DimensionRegression[];
293
293
  //#endregion
294
294
  export { sequentialPairedGate as _, detectScale as a, pairHoldout as c, SequentialDecision as d, SequentialObservation as f, sequentialDecide as g, SequentialStreamState as h, PairedHoldout as i, SequentialDecideFn as l, SequentialPairedGateOptions as m, HeldoutSignificance as n, dimensionRegressions as o, SequentialPairedGate as p, HeldoutSignificanceOptions as r, heldoutSignificance as s, DimensionRegression as t, SequentialDecideOptions as u };
295
- //# sourceMappingURL=statistical-heldout-DFS7QGpS.d.ts.map
295
+ //# sourceMappingURL=statistical-heldout-Yldkntvy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"statistical-heldout-DFS7QGpS.d.ts","names":[],"sources":["../src/campaign/gates/sequential.ts","../src/campaign/gates/statistical-heldout.ts"],"mappings":";;;;KAsCY;UAEK;EACf,UAAU;;EAEV;;EAEA;;;EAGA;;UAGe;;;EAGf;;;;EAIA;;;EAGA;;EAEA;;;;EAIA;;;EAGA;;;EAGA,kBAAkB;;EAElB;;;;;;;EAOA,SAAS;;;;;;KAOC,wBAAwB;EAAkB,UAAU;;UAE/C,qBAAqB,qBAAqB,kBAAkB,WAAW,kBAC9E,KAAK,WAAW;;;;;;;;EAQxB,QAAQ,gBAAgB;;;EAGxB,SAAS;;;;;;;;;;;;;;;;iBAsPK,qBAAqB,qBAAqB,kBAAkB,WAAW,UACrF,SAAS,8BACR,qBAAqB,WAAW;UAsFlB;;EAEf;;EAEA;;EAEA;;EAEA;;UAGe;GACd;IAAQ,SAAS;;IAAyB;IAAe;;;EAE1D,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BK,iBAAiB,UAAS,0BAA+B;;;UC/axD;;EAEf;;EAEA;;EAEA;;;;;;;;;;;;;iBAcc,YACd,WAAW,YAAY,eAAe,cACtC,UAAU,YAAY,eAAe,cACrC,aAAa,aACb,SAAS,GAAG,oCACX;UAsDc;EACf,QAAQ;;;;;;;;;;;;EAYR,WAAW;;;;EAIX,iBAAiB;;;;;;;EAOjB,UAAU;;EAEV,mBAAmB;;EAEnB,SAAS;;;;EAIT;;EAEA;;EAEA;;EAEA,gBAAgB;;EAEhB;;;;EAIA;;EAEA;;UAGe;EACf;EACA;EACA;EACA;;EAEA;EACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6Bc,oBACd,QAAQ,eACR,OAAM,6BACL;UAkEc;EACf;;;EAGA,WAAW;;;;EAIX;;EAEA;IAAM;IAAa;;;EAEnB,mBAAmB;;EAEnB,SAAS;;EAET;;;;;EAKA;EACA;EACA;;;;;iBAMc,YAAY;;;;;;;;;;;;;;;;;;;iBAsBZ,qBACd,WAAW,YAAY,eAAe,cACtC,UAAU,YAAY,eAAe,cACrC,aAAa,aACb,8BACA;EACE;EACA;EACA;EACA;;;EAGA;IAED"}
1
+ {"version":3,"file":"statistical-heldout-Yldkntvy.d.ts","names":[],"sources":["../src/campaign/gates/sequential.ts","../src/campaign/gates/statistical-heldout.ts"],"mappings":";;;;KAsCY;UAEK;EACf,UAAU;;EAEV;;EAEA;;;EAGA;;UAGe;;;EAGf;;;;EAIA;;;EAGA;;EAEA;;;;EAIA;;;EAGA;;;EAGA,kBAAkB;;EAElB;;;;;;;EAOA,SAAS;;;;;;KAOC,wBAAwB;EAAkB,UAAU;;UAE/C,qBAAqB,qBAAqB,kBAAkB,WAAW,kBAC9E,KAAK,WAAW;;;;;;;;EAQxB,QAAQ,gBAAgB;;;EAGxB,SAAS;;;;;;;;;;;;;;;;iBAsPK,qBAAqB,qBAAqB,kBAAkB,WAAW,UACrF,SAAS,8BACR,qBAAqB,WAAW;UAsFlB;;EAEf;;EAEA;;EAEA;;EAEA;;UAGe;GACd;IAAQ,SAAS;;IAAyB;IAAe;;;EAE1D,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BK,iBAAiB,UAAS,0BAA+B;;;UC/axD;;EAEf;;EAEA;;EAEA;;;;;;;;;;;;;iBAcc,YACd,WAAW,YAAY,eAAe,cACtC,UAAU,YAAY,eAAe,cACrC,aAAa,aACb,SAAS,GAAG,oCACX;UAsDc;EACf,QAAQ;;;;;;;;;;;;EAYR,WAAW;;;;EAIX,iBAAiB;;;;;;;EAOjB,UAAU;;EAEV,mBAAmB;;EAEnB,SAAS;;;;EAIT;;EAEA;;EAEA;;EAEA,gBAAgB;;EAEhB;;;;EAIA;;EAEA;;UAGe;EACf;EACA;EACA;EACA;;EAEA;EACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6Bc,oBACd,QAAQ,eACR,OAAM,6BACL;UAkEc;EACf;;;EAGA,WAAW;;;;EAIX;;EAEA;IAAM;IAAa;;;EAEnB,mBAAmB;;EAEnB,SAAS;;EAET;;;;;EAKA;EACA;EACA;;;;;iBAMc,YAAY;;;;;;;;;;;;;;;;;;;iBAsBZ,qBACd,WAAW,YAAY,eAAe,cACtC,UAAU,YAAY,eAAe,cACrC,aAAa,aACb,8BACA;EACE;EACA;EACA;EACA;;;EAGA;IAED"}
@@ -5,8 +5,8 @@ import { u as RunTokenUsage } from "./run-record-DQjRcYwA.js";
5
5
  import { A as SearchSpanResult, B as ViewSpansResult, D as DatasetOverview, F as TraceAnalystFilters, H as ViewTraceResult, S as BoundedTraceAnalysisStoreOptions, T as TraceAnalysisStoreContext, f as AnalystUsageReceipt, i as AnalystFinding, j as SearchTraceResult, k as QueryTracesPage, w as TraceAnalysisStore } from "./types-DMoNFDWi.js";
6
6
  import { l as RawProviderSink, o as ProviderRedactor } from "./raw-provider-sink-BU29Sh8h.js";
7
7
  import { s as TraceStore } from "./store-Cq9oOrI1.js";
8
- import { i as TraceAnalystLimits, r as TraceAnalysisEngineResult, t as TraceAnalysisEngine } from "./engine-D12Rb6WB.js";
9
- import { t as TraceToolGroupName } from "./tool-groups-BnXlCJZQ.js";
8
+ import { i as TraceAnalystLimits, r as TraceAnalysisEngineResult, t as TraceAnalysisEngine } from "./engine-BfRay1qD.js";
9
+ import { t as TraceToolGroupName } from "./tool-groups-DjwlMBvW.js";
10
10
  //#region src/trace-analyst/store-boundary.d.ts
11
11
  /** Apply the public validation, cancellation, not-found, and size rules to any adapter. */
12
12
  declare function createBoundedTraceAnalysisStore(source: TraceAnalysisStore, options?: BoundedTraceAnalysisStoreOptions): TraceAnalysisStore;
@@ -405,4 +405,4 @@ declare class ToolTraceMissingError extends CaptureIntegrityError {
405
405
  declare function toolSpansToTraceAnalysisStore(spans: readonly ToolSpan[] | null | undefined, options?: ToolSpansToTraceAnalysisStoreOptions): TraceAnalysisStore;
406
406
  //#endregion
407
407
  export { REDACTION_VERSION as A, exportRunAsOtlp as B, scoreTraceInsightReadiness as C, AnalyzeTracesResult as D, AnalyzeTracesOptions as E, OtlpFlatLine as F, ExtractedUsage as G, CaptureFetchOptions as H, OTEL_AGENT_EVAL_SCOPE as I, extractUsageFromResponse as J, SseUsageMode as K, OtlpExport as L, RedactionRule as M, redactString as N, analyzeTraces as O, redactValue as P, OtlpResourceSpans as R, planTraceInsightQuestions as S, AnalyzeTracesInput as T, captureFetchToRawSink as U, CaptureFetchContext as V, ExtractUsageFromSseOptions as W, createBoundedTraceAnalysisStore as X, extractUsageFromSse as Y, buildTraceInsightPrompt as _, ToolSpansToTraceAnalysisStoreOptions as a, domainEvidencePattern as b, TraceInsightFinding as c, TraceInsightQualityGate as d, TraceInsightQuestion as f, buildTraceInsightContext as g, TraceInsightTask as h, OtlpFileTraceStoreOptions as i, RedactionReport as j, DEFAULT_REDACTION_RULES as k, TraceInsightPanelRole as l, TraceInsightSuite as m, toolSpansToTraceAnalysisStore as n, otlpTextToTraceAnalysisStore as o, TraceInsightReadiness as p, extractUsage as q, OtlpFileTraceStore as r, TraceInsightContext as s, ToolTraceMissingError as t, TraceInsightPromptInput as u, defaultTraceInsightPanel as v, tokenizeDomainWords as w, inferDomainKeywords as x, describeTraceInsightScope as y, OtlpSpan as z };
408
- //# sourceMappingURL=store-tool-spans-B2DJ_82T.d.ts.map
408
+ //# sourceMappingURL=store-tool-spans-BvdUbeOB.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"store-tool-spans-B2DJ_82T.d.ts","names":[],"sources":["../src/trace-analyst/store-boundary.ts","../src/trace/extract-usage.ts","../src/trace/capture-fetch.ts","../src/trace/otel.ts","../src/trace/otlp-flat.ts","../src/trace/redact.ts","../src/trace-analyst/analyst.ts","../src/trace-analyst/insights.ts","../src/trace-analyst/store-otlp.ts","../src/trace-analyst/store-tool-spans.ts"],"mappings":";;;;;;;;;;;iBA6BgB,gCACd,QAAQ,oBACR,UAAS,mCACR;;;KChBS,iBAAiB;KACjB;UAEK;;EAEf,OAAO;;;;;;;iBAuDO,aAAa,gBAAgB;;;;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KAClE,UAAU,4BACT,QAAQ;;;EA6CL,cAAc,UAAU,4BAA4B;UAI5C;qBAmBK,WAAW,SAAS,cAAc,QAAQ;qBAE1C;UAEL;UAmBA;UAsHA;UA+DN;UAkBA;UAwDA;UAmBM;;cA+CH,2BAA2B;mBACrB;mBACA;EAEjB,YAAY,MAAM;;;YAYF,WAAW,SAAS,cAAc,QAAQ;YAkBhD;;;iBAwBI,6BACd,cACA,OAAM,uCACL;;;;cC/7BU,8BAA8B;EACzC;;;;;;iBASc,8BACd,gBAAgB,+BAChB,UAAS,uCACR"}
1
+ {"version":3,"file":"store-tool-spans-BvdUbeOB.d.ts","names":[],"sources":["../src/trace-analyst/store-boundary.ts","../src/trace/extract-usage.ts","../src/trace/capture-fetch.ts","../src/trace/otel.ts","../src/trace/otlp-flat.ts","../src/trace/redact.ts","../src/trace-analyst/analyst.ts","../src/trace-analyst/insights.ts","../src/trace-analyst/store-otlp.ts","../src/trace-analyst/store-tool-spans.ts"],"mappings":";;;;;;;;;;;iBA6BgB,gCACd,QAAQ,oBACR,UAAS,mCACR;;;KChBS,iBAAiB;KACjB;UAEK;;EAEf,OAAO;;;;;;;iBAuDO,aAAa,gBAAgB;;;;;;iBA6C7B,oBACd,cACA,UAAS,6BACR;;;;;;;iBA4DmB,yBACpB,UAAU,UACV,aAAa,6BACZ,QAAQ;;;UCrKM;;;EAGf;;EAEA;;;EAGA;;EAEA;;EAEA;;UAGe;;EAEf,WAAW;;;EAGX;;;EAGA;;;;;;;;EAQA,WAAW,OAAO,gBAAgB,KAAK;;EAEvC,eAAe;;iBAkDD,sBACd,cAAc,WAAW,OACzB,MAAM,iBACN,KAAK,qBACL,OAAM,6BACE,WAAW;;;cCxFR;EAA0B;EAAoC;;UAE1D;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YAAY;IACV;IACA;MAAS;MAAsB;MAAmB;MAAsB;;;EAE1E,SAAS;IAAQ;IAAsB;IAAc,aAAa;;EAClE;IAAW;IAAc;;;UAGV;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B,OAAO,0BAA0B;iBAsD3D,yBAAyB,OAAO,0BAA0B;iBAa1D,2BAA2B,SAAS,sBAAsB;iBA2D1D,4BAA4B;iBA6B5B,wBAAwB,OAAO;;;UC1K9B;;EAEf;;EAEA;;EAEA;;EAEA;;KAGG,gCAAgC;UAEpB,kCAAkC;;EAEjD;;;;;;;;EAQA;;uBAMa,kCAAkC;mBAC9B;mBACA;mBACA;mBACA;UACT;UACA;UACA;UACA;EAER,YAAY,MAAM;EAyBZ,SAAS,kBAAkB,UAAU,4BAA4B;EAOjE,SACJ;IAAQ;IAAkB;KAC1B,UAAU,4BACT;EAeG,YACJ,UAAU,qBACV,UAAU,4BACT,QAAQ;EAoDL,YACJ;IAAQ,UAAU;IAAqB;IAAe;KACtD,UAAU,4BACT,QAAQ;EAmBL,YACJ,UAAU,qBACV,UAAU,4BACT;EAMG,UACJ;IAAQ;IAAkB;KAC1B,UAAU,4BACT,QAAQ;EAuCL,UACJ;IAAQ;IAAkB;IAA6B;KACvD,UAAU,4BACT,QAAQ;EAsFL,YACJ;IAAQ;IAAkB;IAAuB;KACjD,UAAU,4BACT,QAAQ;EA4CL,WACJ;IAAQ;IAAkB;IAAiB;IAAuB;KAClE,UAAU,4BACT,QAAQ;;;EA6CL,cAAc,UAAU,4BAA4B;UAI5C;qBAmBK,WAAW,SAAS,cAAc,QAAQ;qBAE1C;UAEL;UAmBA;UAsHA;UA+DN;UAkBA;UAwDA;UAmBM;;cA+CH,2BAA2B;mBACrB;mBACA;EAEjB,YAAY,MAAM;;;YAYF,WAAW,SAAS,cAAc,QAAQ;YAkBhD;;;iBAwBI,6BACd,cACA,OAAM,uCACL;;;;cC/7BU,8BAA8B;EACzC;;;;;;iBASc,8BACd,gBAAgB,+BAChB,UAAS,uCACR"}
@@ -1,5 +1,5 @@
1
- import { A as unavailable, C as SupervisorRunTreeGap, D as WorkerLogSource, E as WallDistribution, O as isUnavailable, S as SupervisorRunTree, T as Unavailable, _ as SupervisorRunNodeRole, a as OrchestrationMetrics, b as SupervisorRunRollup, c as PerWorkerRow, d as SUPERVISOR_RUN_ROLLUP_SCHEMA, f as SUPERVISOR_RUN_SCHEMA, g as SteerBreakdown, h as SpendMeasurements, i as NO_SOURCE_LIMITS, k as showMeasured, l as RoleSpend, m as SpendMeasurement, n as EconomicsMetrics, o as OutcomeMetrics, p as SourceLimits, r as Measured, s as PatchStats, t as DecisionMetrics, u as RollupCellRow, v as SupervisorRunReader, w as SupervisorRunTreeGapCode, x as SupervisorRunSources, y as SupervisorRunReport } from "../types-DeIUdzNd.js";
2
1
  import { y as RolloutSplit } from "../schema-BzWDXhOR.js";
2
+ import { A as unavailable, C as SupervisorRunTreeGap, D as WorkerLogSource, E as WallDistribution, O as isUnavailable, S as SupervisorRunTree, T as Unavailable, _ as SupervisorRunNodeRole, a as OrchestrationMetrics, b as SupervisorRunRollup, c as PerWorkerRow, d as SUPERVISOR_RUN_ROLLUP_SCHEMA, f as SUPERVISOR_RUN_SCHEMA, g as SteerBreakdown, h as SpendMeasurements, i as NO_SOURCE_LIMITS, k as showMeasured, l as RoleSpend, m as SpendMeasurement, n as EconomicsMetrics, o as OutcomeMetrics, p as SourceLimits, r as Measured, s as PatchStats, t as DecisionMetrics, u as RollupCellRow, v as SupervisorRunReader, w as SupervisorRunTreeGapCode, x as SupervisorRunSources, y as SupervisorRunReport } from "../types-CoPUTiXb.js";
3
3
  //#region src/supervisor-run/source-facts.d.ts
4
4
  interface Tokens {
5
5
  input: number;
@@ -8,10 +8,28 @@ interface Tokens {
8
8
  cacheWrite: number;
9
9
  /** False when the event carried no cache counters at all — not "zero cached". */
10
10
  hasCache: boolean;
11
+ /**
12
+ * False only when the record carried `cacheBreakdownKnown: false` — Runtime's mark for a
13
+ * provider that reported a total without splitting cache reads from cache writes. The
14
+ * counters that ARE present are then a partial split, never a measured "zero cached".
15
+ */
16
+ breakdownKnown: boolean;
11
17
  }
12
18
  interface SpendLike {
13
19
  tokens: Tokens;
20
+ /**
21
+ * False only when the record carried `tokensKnown: false` — Runtime's mark for work that
22
+ * HAPPENED with an unreported token count. `tokens` then holds the known subtotal (often
23
+ * zero), never the measured total. An absent flag means the record is complete.
24
+ */
25
+ tokensKnown: boolean;
14
26
  usd: number;
27
+ /**
28
+ * False only when the record carried `usdKnown: false` — work that HAPPENED at a price the
29
+ * provider never reported. `usd` then holds a catalog estimate or zero, never a measured
30
+ * price. An absent flag means the record is complete.
31
+ */
32
+ usdKnown: boolean;
15
33
  }
16
34
  interface SpawnRow {
17
35
  /** Zero-based row among parsed journal objects. */
@@ -104,14 +122,29 @@ interface SupervisorTreeFacts {
104
122
  readonly workerSpawns: readonly SpawnRow[];
105
123
  readonly workerCloses: readonly CloseRow[];
106
124
  readonly brain: {
125
+ /**
126
+ * Summed over the root's metered rows that reported a token count. A row Runtime marked
127
+ * `tokensKnown: false` is EXCLUDED and counted in `tokensUnknownCount` instead, because
128
+ * its `tokens` field holds a known subtotal — folding it in would price unreported work
129
+ * at zero tokens.
130
+ */
107
131
  tokensIn: number;
108
132
  tokensOut: number;
109
133
  cacheRead: number;
110
134
  cacheWrite: number;
111
135
  /** False when no metered event carried cache counters — not "nothing cached". */
112
136
  hasCache: boolean;
137
+ /** False when any folded metered row declared `cacheBreakdownKnown: false`. */
138
+ cacheBreakdownKnown: boolean;
139
+ /** Root metered rows that reported a token count, and rows that did not. */
140
+ tokensKnownCount: number;
141
+ tokensUnknownCount: number;
142
+ /** Summed over the root's metered rows that reported a price, on the same rule. */
113
143
  usd: number;
114
- /** Root-attributed metered events only exactly the rows summed into this object. */
144
+ /** Root metered rows that reported a price, and rows Runtime marked `usdKnown: false`. */
145
+ usdKnownCount: number;
146
+ usdUnknownCount: number;
147
+ /** Root-attributed metered events only — every row this object folded or counted. */
115
148
  meteredCount: number;
116
149
  };
117
150
  readonly workerLogs: ReadonlyMap<string, WorkerLogFacts>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/supervisor-run/source-facts.ts","../../src/supervisor-run/analyze.ts","../../src/supervisor-run/claude-code-reader.ts","../../src/supervisor-run/integrity-types.ts","../../src/supervisor-run/integrity.ts","../../src/supervisor-run/loops-reader.ts","../../src/supervisor-run/render.ts","../../src/supervisor-run/rollout-nodes.ts","../../src/supervisor-run/runtime-reader.ts"],"mappings":";;;UAwBU;EACR;EACA;EACA;EACA;;EAEA;;UAGQ;EACR,QAAQ;EACR;;UAgFe;;EAEf;EACA;EACA;EACA;;EAEA,MAAM;;EAEN;;EAEA;EACA;;EAEA;EACA;;UAGe;EACf;EACA;EACA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA;EACA,OAAO;;EAEP;;UAGe;;EAEf;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;;EAEA;;EAEA;EACA;;EAEA;;EAEA;EACA;EACA;EACA;EACA,eAAe;EACf,uBAAuB;;UAGR;;EAEf;EACA;;UAGe;;EAEf;;EAEA;EACA;;;;;;UAOe;WACN;WACA,iBAAiB;WACjB,iBAAiB;WACjB,uBAAuB;WACvB,uBAAuB;WACvB;IACP;IACA;IACA;IACA;;IAEA;IACA;;IAEA;;WAEO,YAAY,oBAAoB;;WAEhC,wBAAwB;;WAExB;;;;;;;;;WASA;;WAEA;;;;;;WAMA,0BAA0B,SAAS;;;;;;;WAOnC;;WAEA,gBAAgB;;WAEhB,OAAO;WACP;WACA;;;;;;WAMA;WACA;;;;;;;;;;;;;;;;;;KAmDC;iBAiFI,oBAAoB,KAAK,uBAAuB;;;;;;;iBC5UhD,4BACd,KAAK,sBACL,qBACC;;iBAktBa,WAAW,eAAe;;;;;;iBA+C1B,qBAAqB,kBAAkB,wBAAwB;;;UChvB9D;;WAEN;;;;;WAKA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;;iBAmOW,4BACpB,MAAM,0BACL,QAAQ;;iBAiUK,8BAA8B,MAAM,0BAA0B;;;cCnoBjE;KAED;KAEA;KAKA;UAmCK;WACN;WACA;;UAGM;WACN,MAAM;WACN;WACA,UAAU;WACV;WACA;WACA;WACA,mBAAmB;WACnB;WACA,WAAW,SAAS;;UAGd;WACN,eAAe;WACf;WACA;WACA,MAAM;WACN,iBAAiB;;UAGX;;WAEN;;;;;;;;iBC5BK,8BACd,OAAO,uBAAuB,mBAC9B,UAAS,gCACR;;;;;;;iBCDmB,uBAAuB,aAAa;UAUzC;;WAEN;;WAEA;;WAEA;;WAEA;;;;;;;iBAQW,uBACpB,gBACA,OAAM,qBACL,QAAQ;;iBAmKK,yBACd,gBACA,OAAM,qBACL;;;;;;iBAkCmB,qBACpB,gBAAgB,sBAAsB,sBACtC,OAAM,qBACL,QAAQ;UAgBM,kCAAkC;;WAExC;;WAEA;;;;;;WAMA;;;;;;;;iBASW,yBACpB,gBACA,OAAM,4BACL,QAAQ;;;;;iBA0CW,6BACpB,gBACA,OAAM,4BACL,QAAQ;;;;;;iBAgBW,sBACpB,gBACA,OAAM;EAA8B;IACnC,QAAQ;;;;;;;iBA+BW,sBAAsB,eAAe;;;;;;;iBCzY3C,4BAA4B,GAAG;iBAiC/B,4BAA4B,GAAG;iBA+K/B,+BACd,QAAQ,qBACR;;;UC9Le;;WAEN;;WAEA,QAAQ;;WAER;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;;WAEA;;;;;;;iBAwBK,0BACd,KAAK,sBACL,OAAM,2BACL;;;UCsUc;;;;;;WAMN;;;;;;;;;;;;;;;;iBAsDW,yBACpB,gBACA,OAAM,uBACL,QAAQ;;iBAkEK,2BACd,gBACA,OAAM,uBACL;;iBAKmB,0BAA0B,iBAAiB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/supervisor-run/source-facts.ts","../../src/supervisor-run/analyze.ts","../../src/supervisor-run/claude-code-reader.ts","../../src/supervisor-run/integrity-types.ts","../../src/supervisor-run/integrity.ts","../../src/supervisor-run/loops-reader.ts","../../src/supervisor-run/render.ts","../../src/supervisor-run/rollout-nodes.ts","../../src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;WACN,eAAe;WACf;WACA;WACA,MAAM;WACN,iBAAiB;;UAGX;;WAEN;;;;;;;;iBC5BK,8BACd,OAAO,uBAAuB,mBAC9B,UAAS,gCACR;;;;;;;iBCDmB,uBAAuB,aAAa;UAUzC;;WAEN;;WAEA;;WAEA;;WAEA;;;;;;;iBAQW,uBACpB,gBACA,OAAM,qBACL,QAAQ;;iBAmKK,yBACd,gBACA,OAAM,qBACL;;;;;;iBAkCmB,qBACpB,gBAAgB,sBAAsB,sBACtC,OAAM,qBACL,QAAQ;UAgBM,kCAAkC;;WAExC;;WAEA;;;;;;WAMA;;;;;;;;iBASW,yBACpB,gBACA,OAAM,4BACL,QAAQ;;;;;iBA0CW,6BACpB,gBACA,OAAM,4BACL,QAAQ;;;;;;iBAgBW,sBACpB,gBACA,OAAM;EAA8B;IACnC,QAAQ;;;;;;;iBA+BW,sBAAsB,eAAe;;;;;;;iBCzY3C,4BAA4B,GAAG;iBAiC/B,4BAA4B,GAAG;iBA+K/B,+BACd,QAAQ,qBACR;;;UC9Le;;WAEN;;WAEA,QAAQ;;WAER;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;;WAEA;;;;;;;iBAwBK,0BACd,KAAK,sBACL,OAAM,2BACL;;;UC6Uc;;;;;;WAMN;;;;;;;;;;;;;;;;iBAsDW,yBACpB,gBACA,OAAM,uBACL,QAAQ;;iBAkEK,2BACd,gBACA,OAAM,uBACL;;iBAKmB,0BAA0B,iBAAiB"}
@@ -1,6 +1,6 @@
1
1
  import { o as summarizeNumberSeries } from "../descriptive-1V17A-qa.js";
2
2
  import { c as parseClaudeEntries, n as findOpencodeSessionsByDirectory, r as openOpencodeDb, t as DEFAULT_OPENCODE_DB, u as transcriptFromEntries } from "../opencode-sqlite-eK6HW6dr.js";
3
- import { a as parseJsonl, c as SUPERVISOR_RUN_INTEGRITY_SCHEMA, i as parseJson, n as supervisorRunRolloutLines, o as parseSupervisorTree, r as asRecord, s as workerSourceKey, t as analyzeSupervisorRunIntegrity } from "../integrity-CyWSSoQS.js";
3
+ import { a as parseJsonl, c as SUPERVISOR_RUN_INTEGRITY_SCHEMA, i as parseJson, n as supervisorRunRolloutLines, o as parseSupervisorTree, r as asRecord, s as workerSourceKey, t as analyzeSupervisorRunIntegrity } from "../integrity-BWywb34E.js";
4
4
  import { basename, dirname, join } from "node:path";
5
5
  import { appendFile, mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
6
6
  //#region src/supervisor-run/types.ts
@@ -35,6 +35,7 @@ const SUPERVISOR_RUN_ROLLUP_SCHEMA = "tangle.supervisor-run-rollup@1";
35
35
  * (`loops-reader.ts` is one).
36
36
  */
37
37
  const NO_CACHE_COUNTERS = "the journal carries no cache-token counters for this role";
38
+ const NO_CACHE_BREAKDOWN = "Runtime recorded cacheBreakdownKnown:false — the provider reported a total without splitting cache reads from writes";
38
39
  /**
39
40
  * Analyze already-read supervisor-run bytes. Pure and synchronous: same bytes
40
41
  * in, same report out (modulo `generatedAt`, which `now` pins in tests).
@@ -232,7 +233,7 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
232
233
  if (c.verdict !== null) settledVerdicts[c.verdict] = (settledVerdicts[c.verdict] ?? 0) + 1;
233
234
  }
234
235
  const verdictLimit = src.limits.workerVerdicts;
235
- const acceptedLimit = verdictLimit ?? src.limits.deliverables;
236
+ const deliverablesLimit = src.limits.deliverables;
236
237
  let accepted = 0;
237
238
  let emptyPass = 0;
238
239
  let evidenceBytes = 0;
@@ -243,7 +244,7 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
243
244
  const spawn = spawnForSource(w);
244
245
  const passed = (spawn === null ? null : closeById.get(spawn.id) ?? null)?.valid ?? f?.passed ?? null;
245
246
  if (passed !== null) sourceVerdicts.push(passed);
246
- if (passed === true) if ((w.patchBytes ?? f?.finishedPatchBytes ?? 0) > 0) accepted += 1;
247
+ if (passed === true) if (deliverablesLimit !== null || (w.patchBytes ?? f?.finishedPatchBytes ?? 0) > 0) accepted += 1;
247
248
  else emptyPass += 1;
248
249
  }
249
250
  const settledCloses = workerCloses.filter((close) => close.kind === "settled");
@@ -255,9 +256,9 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
255
256
  const decision = {
256
257
  settledByStatus: haveJournal ? settledByStatus : gap("settledByStatus", journalMissing),
257
258
  settledVerdicts: verdictLimit !== null ? unavailable(verdictLimit) : haveJournal ? settledVerdicts : unavailable(journalMissing),
258
- accepted: acceptedLimit !== null ? gap("accepted", acceptedLimit) : src.workers === null ? unavailable(workersGapReason) : accepted,
259
+ accepted: verdictLimit !== null ? gap("accepted", verdictLimit) : src.workers === null ? unavailable(workersGapReason) : accepted,
259
260
  rejected: rejectedLimit === null ? rejected : unavailable(rejectedLimit),
260
- emptyPass: acceptedLimit !== null ? gap("emptyPass", acceptedLimit) : src.workers === null ? unavailable(workersGapReason) : emptyPass,
261
+ emptyPass: verdictLimit !== null ? gap("emptyPass", verdictLimit) : deliverablesLimit !== null ? gap("emptyPass", deliverablesLimit) : src.workers === null ? unavailable(workersGapReason) : emptyPass,
261
262
  observeThenRespawn: haveJournal ? observeThenRespawn : unavailable(journalMissing),
262
263
  respawnWithoutEvidence: haveJournal ? respawnWithoutEvidence : unavailable(journalMissing),
263
264
  reviewActions: src.workers === null ? unavailable(workersGapReason) : queuedGapReason === null ? steerQueuedTotal + upLegMessages : unavailable(queuedGapReason),
@@ -265,41 +266,78 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
265
266
  };
266
267
  const rootChildIds = new Set(workerSpawns.filter((spawn) => spawn.parent === rootId).map((spawn) => spawn.id));
267
268
  const rootChildCloses = workerCloses.filter((close) => rootChildIds.has(close.id));
268
- const journalWorkerIn = rootChildCloses.reduce((a, c) => a + c.spend.tokens.input, 0);
269
- const journalWorkerOut = rootChildCloses.reduce((a, c) => a + c.spend.tokens.output, 0);
270
- const journalWorkerUsd = rootChildCloses.reduce((a, c) => a + c.spend.usd, 0);
269
+ const rootChildSpends = rootChildCloses.filter((close) => close.hasSpend);
270
+ const workerUsdUnknownNodes = rootChildSpends.filter((close) => !close.spend.usdKnown).map((close) => close.id);
271
+ const workerTokensUnknownNodes = rootChildSpends.filter((close) => !close.spend.tokensKnown).map((close) => close.id);
272
+ const workerTokenSpends = rootChildSpends.filter((close) => close.spend.tokensKnown);
273
+ const journalWorkerIn = workerTokenSpends.reduce((a, c) => a + c.spend.tokens.input, 0);
274
+ const journalWorkerOut = workerTokenSpends.reduce((a, c) => a + c.spend.tokens.output, 0);
275
+ const journalWorkerUsd = rootChildSpends.filter((close) => close.spend.usdKnown).reduce((a, c) => a + c.spend.usd, 0);
276
+ const usdUnknownIds = new Set(workerCloses.filter((close) => close.hasSpend && !close.spend.usdKnown).map((c) => c.id));
271
277
  const workerUsdById = /* @__PURE__ */ new Map();
272
- for (const c of workerCloses) workerUsdById.set(c.id, (workerUsdById.get(c.id) ?? 0) + c.spend.usd);
278
+ for (const c of workerCloses) {
279
+ if (usdUnknownIds.has(c.id)) continue;
280
+ workerUsdById.set(c.id, (workerUsdById.get(c.id) ?? 0) + c.spend.usd);
281
+ }
273
282
  const labelById = new Map(workerSpawns.map((spawn) => [spawn.id, spawn.label]));
283
+ const usdUnknownLabels = new Set([...usdUnknownIds].map((id) => labelById.get(id)).filter((l) => l !== void 0));
274
284
  const workerUsdByLabel = /* @__PURE__ */ new Map();
275
285
  for (const close of workerCloses) {
276
286
  const label = labelById.get(close.id);
277
- if (label === void 0) continue;
287
+ if (label === void 0 || usdUnknownLabels.has(label)) continue;
278
288
  workerUsdByLabel.set(label, (workerUsdByLabel.get(label) ?? 0) + close.spend.usd);
279
289
  }
290
+ const brainUsdUnknownNodes = tree.brain.usdUnknownCount > 0 && rootId !== null ? [rootId] : [];
291
+ const brainTokensUnknownNodes = tree.brain.tokensUnknownCount > 0 && rootId !== null ? [rootId] : [];
292
+ const usdKnownRecords = tree.brain.usdKnownCount + rootChildSpends.filter((close) => close.spend.usdKnown).length;
293
+ const usdUnknownRecords = tree.brain.usdUnknownCount + workerUsdUnknownNodes.length;
294
+ const usdUnknownNodes = [...brainUsdUnknownNodes, ...workerUsdUnknownNodes];
295
+ const NAMED_NODE_LIMIT = 5;
296
+ const nameNodes = (nodes) => {
297
+ if (nodes.length === 0) return "";
298
+ const shown = nodes.slice(0, NAMED_NODE_LIMIT);
299
+ const rest = nodes.length - shown.length;
300
+ return ` (${shown.join(", ")}${rest === 0 ? "" : ` +${rest} more`})`;
301
+ };
302
+ const unpriced = (unknown, total, nodes) => `Runtime recorded usdKnown:false on ${unknown} of ${total} spend record(s)${nameNodes(nodes)}`;
303
+ const unreportedTokens = (unknown, total, nodes) => `Runtime recorded tokensKnown:false on ${unknown} of ${total} spend record(s)${nameNodes(nodes)}`;
304
+ const usdPartial = usdKnownRecords > 0 && usdUnknownRecords > 0;
305
+ const usdAllUnknown = usdKnownRecords === 0 && usdUnknownRecords > 0;
306
+ const brainTokensUnreported = tree.brain.tokensUnknownCount === 0 ? null : unreportedTokens(tree.brain.tokensUnknownCount, tree.brain.meteredCount, brainTokensUnknownNodes);
307
+ const brainUsdUnreported = tree.brain.usdKnownCount > 0 || tree.brain.usdUnknownCount === 0 ? null : unpriced(tree.brain.usdUnknownCount, tree.brain.meteredCount, brainUsdUnknownNodes);
308
+ const workerUsdUnreported = workerUsdUnknownNodes.length === 0 || workerUsdUnknownNodes.length < rootChildSpends.length ? null : unpriced(workerUsdUnknownNodes.length, rootChildSpends.length, workerUsdUnknownNodes);
280
309
  const sq = src.harnessWorkerTokens;
281
310
  const harnessGapReason = src.harnessMissingReason ?? "harness session store unavailable and journal settled spend is 0";
282
311
  const workerTokenLimit = src.limits.workerTokens;
283
- const workerIn = workerTokenLimit !== null ? gap("workers.tokensIn", workerTokenLimit) : sq !== null ? journalWorkerIn + sq.input : haveJournal ? journalWorkerIn : gap("workers.tokensIn", harnessGapReason);
284
- const workerOut = workerTokenLimit !== null ? unavailable(workerTokenLimit) : sq !== null ? journalWorkerOut + sq.output : haveJournal ? journalWorkerOut : unavailable(harnessGapReason);
312
+ const workerTokensUnreported = workerTokensUnknownNodes.length === 0 ? null : unreportedTokens(workerTokensUnknownNodes.length, rootChildSpends.length, workerTokensUnknownNodes);
313
+ const workerIn = workerTokenLimit !== null ? gap("workers.tokensIn", workerTokenLimit) : workerTokensUnreported !== null ? gap("workers.tokensIn", workerTokensUnreported) : sq !== null ? journalWorkerIn + sq.input : haveJournal ? journalWorkerIn : gap("workers.tokensIn", harnessGapReason);
314
+ const workerOut = workerTokenLimit !== null ? unavailable(workerTokenLimit) : workerTokensUnreported !== null ? unavailable(workerTokensUnreported) : sq !== null ? journalWorkerOut + sq.output : haveJournal ? journalWorkerOut : unavailable(harnessGapReason);
285
315
  const stateResult = asRecord(state?.result);
286
316
  const stateUsd = typeof stateResult.spentUsd === "number" ? stateResult.spentUsd : null;
287
317
  const resultSpentTotal = asRecord(result?.spentTotal);
288
318
  const resultCloseUsd = typeof resultSpentTotal.usd === "number" && Number.isFinite(resultSpentTotal.usd) ? resultSpentTotal.usd : null;
289
319
  const closeUsd = stateUsd ?? resultCloseUsd;
290
320
  const usdLimit = src.limits.spendUsd;
291
- const totalUsd = usdLimit !== null ? gap("totalUsd", usdLimit) : stateUsd !== null ? round(stateUsd, 6) : haveJournal ? round(tree.brain.usd + journalWorkerUsd, 6) : gap("totalUsd", journalMissing);
292
- const journalSpendRecords = tree.brain.meteredCount + rootChildCloses.filter((close) => close.hasSpend).length;
293
- const journalDerivedAvailable = usdLimit === null && haveJournal;
294
- const closeRecordAvailable = usdLimit === null && closeUsd !== null;
321
+ const closeUsdUnreported = stateUsd === null && resultCloseUsd !== null && resultSpentTotal.usdKnown === false;
322
+ const usdUnreportedReason = unpriced(usdUnknownRecords, usdKnownRecords + usdUnknownRecords, usdUnknownNodes);
323
+ const totalUsd = usdLimit !== null ? gap("totalUsd", usdLimit) : stateUsd !== null ? round(stateUsd, 6) : !haveJournal ? gap("totalUsd", journalMissing) : usdUnknownRecords > 0 ? gap("totalUsd", usdUnreportedReason) : round(tree.brain.usd + journalWorkerUsd, 6);
324
+ const journalSpendRecords = usdKnownRecords;
325
+ const journalDerivedAvailable = usdLimit === null && haveJournal && !usdAllUnknown;
326
+ const closeRecordAvailable = usdLimit === null && closeUsd !== null && !closeUsdUnreported;
295
327
  const spend = {
296
328
  journalDerived: {
297
- usd: journalDerivedAvailable ? round(tree.brain.usd + journalWorkerUsd, 6) : unavailable(usdLimit ?? journalMissing),
298
- records: journalDerivedAvailable ? journalSpendRecords : 0
329
+ usd: journalDerivedAvailable ? round(tree.brain.usd + journalWorkerUsd, 6) : unavailable(usdLimit ?? (haveJournal ? usdUnreportedReason : journalMissing)),
330
+ records: journalDerivedAvailable ? journalSpendRecords : 0,
331
+ unknownRecords: usdLimit === null && haveJournal ? usdUnknownRecords : 0,
332
+ partial: journalDerivedAvailable && usdPartial,
333
+ unknownNodes: usdLimit === null && haveJournal ? usdUnknownNodes : []
299
334
  },
300
335
  closeRecord: {
301
- usd: closeRecordAvailable ? round(closeUsd, 6) : unavailable(usdLimit ?? "no close record: neither state.json result.spentUsd nor result.json spentTotal.usd is present"),
302
- records: closeRecordAvailable ? 1 : 0
336
+ usd: closeRecordAvailable ? round(closeUsd, 6) : unavailable(usdLimit ?? (closeUsdUnreported ? "close record incomplete: result.json spentTotal.usdKnown is false" : "no close record: neither state.json result.spentUsd nor result.json spentTotal.usd is present")),
337
+ records: closeRecordAvailable ? 1 : 0,
338
+ unknownRecords: closeUsdUnreported ? 1 : 0,
339
+ partial: false,
340
+ unknownNodes: closeUsdUnreported && rootId !== null ? [rootId] : []
303
341
  }
304
342
  };
305
343
  const perWorker = (src.workers ?? []).map((w) => {
@@ -322,8 +360,8 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
322
360
  failure: close?.reason ?? null,
323
361
  infra: close?.infra ?? null,
324
362
  wallMs: f?.started != null && f.finishedAt != null ? f.finishedAt - f.started : journalWallMs,
325
- tokensIn: w.tokensIn ?? (close?.hasSpend ? close.spend.tokens.input : null),
326
- tokensOut: w.tokensOut ?? (close?.hasSpend ? close.spend.tokens.output : null),
363
+ tokensIn: w.tokensIn ?? (close?.hasSpend === true && close.spend.tokensKnown ? close.spend.tokens.input : null),
364
+ tokensOut: w.tokensOut ?? (close?.hasSpend === true && close.spend.tokensKnown ? close.spend.tokens.output : null),
327
365
  usd: usdLimit !== null ? null : w.workerId === void 0 ? workerUsdByLabel.get(w.label) ?? null : workerUsdById.get(w.workerId) ?? null,
328
366
  patchBytes: w.patchBytes ?? f?.finishedPatchBytes ?? null,
329
367
  passed,
@@ -335,12 +373,12 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
335
373
  const managerTokenLimit = src.limits.managerTokens;
336
374
  const economics = {
337
375
  brain: {
338
- tokensIn: managerTokenLimit !== null ? gap("brain.tokensIn", managerTokenLimit) : haveJournal ? tree.brain.tokensIn : gap("brain.tokensIn", journalMissing),
339
- tokensOut: managerTokenLimit !== null ? unavailable(managerTokenLimit) : haveJournal ? tree.brain.tokensOut : unavailable(journalMissing),
340
- usd: usdLimit !== null ? unavailable(usdLimit) : haveJournal ? round(tree.brain.usd, 6) : unavailable(journalMissing),
341
- cacheRead: managerTokenLimit !== null ? unavailable(managerTokenLimit) : !haveJournal ? unavailable(journalMissing) : tree.brain.hasCache ? tree.brain.cacheRead : unavailable(NO_CACHE_COUNTERS),
342
- cacheWrite: managerTokenLimit !== null ? unavailable(managerTokenLimit) : !haveJournal ? unavailable(journalMissing) : tree.brain.hasCache ? tree.brain.cacheWrite : unavailable(NO_CACHE_COUNTERS),
343
- source: managerTokenLimit ?? (haveJournal ? `journal metered events (n=${tree.brain.meteredCount})` : journalMissing)
376
+ tokensIn: managerTokenLimit !== null ? gap("brain.tokensIn", managerTokenLimit) : !haveJournal ? gap("brain.tokensIn", journalMissing) : brainTokensUnreported !== null ? gap("brain.tokensIn", brainTokensUnreported) : tree.brain.tokensIn,
377
+ tokensOut: managerTokenLimit !== null ? unavailable(managerTokenLimit) : !haveJournal ? unavailable(journalMissing) : brainTokensUnreported !== null ? unavailable(brainTokensUnreported) : tree.brain.tokensOut,
378
+ usd: usdLimit !== null ? unavailable(usdLimit) : !haveJournal ? unavailable(journalMissing) : brainUsdUnreported !== null ? unavailable(brainUsdUnreported) : round(tree.brain.usd, 6),
379
+ 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),
380
+ 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),
381
+ source: managerTokenLimit ?? (haveJournal ? `journal metered events (n=${tree.brain.meteredCount})${tree.brain.usdKnownCount > 0 && tree.brain.usdUnknownCount > 0 ? ` — ${tree.brain.usdUnknownCount} unpriced` : ""}` : journalMissing)
344
382
  },
345
383
  brainTruncations: src.brainLog === null ? gap("brain.brainTruncations", src.brainLogMissingReason ?? (src.supRunDir === null ? "no supervisor run dir under <ws>/.agent/supervisor (or legacy <ws>/.loops/supervisor)" : "brain.jsonl absent — loops predates the brain-call tap, so truncation cannot be ruled out")) : brainCalls.filter((c) => c.finish_reason === "length").length,
346
384
  workers: {
@@ -348,12 +386,12 @@ function analyzeSupervisorRunSources(src, now = Date.now) {
348
386
  tokensOut: workerOut,
349
387
  cacheRead: workerTokenLimit !== null ? unavailable(workerTokenLimit) : sq?.cacheRead !== void 0 ? sq.cacheRead : unavailable(NO_CACHE_COUNTERS),
350
388
  cacheWrite: workerTokenLimit !== null ? unavailable(workerTokenLimit) : sq?.cacheWrite !== void 0 ? sq.cacheWrite : unavailable(NO_CACHE_COUNTERS),
351
- usd: usdLimit !== null ? unavailable(usdLimit) : haveJournal ? round(journalWorkerUsd, 6) : unavailable(journalMissing),
352
- 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"}`
389
+ usd: usdLimit !== null ? unavailable(usdLimit) : !haveJournal ? unavailable(journalMissing) : workerUsdUnreported !== null ? unavailable(workerUsdUnreported) : round(journalWorkerUsd, 6),
390
+ 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` : ""}`
353
391
  },
354
392
  spend,
355
393
  totalUsd,
356
- 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 ? "journal metered + settled usd" : journalMissing,
394
+ 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",
357
395
  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)") : round(totalUsd / decision.accepted, 6),
358
396
  workerWallMsDistribution: wallDistribution === null ? unavailable(src.workers === null ? workersGapReason : "no worker start/finish pairs captured") : wallDistribution,
359
397
  perWorker: src.workers === null ? unavailable(workersGapReason) : perWorker
@@ -1158,6 +1196,16 @@ function renderSupervisorRollupMarkdown(rollup, title = "Round rollup") {
1158
1196
  * supervisor-run analyzer. Runtime stores profile identity below `identity`
1159
1197
  * and does not emit Eval's role field, so this boundary projects those fields
1160
1198
  * without changing Runtime's journal dialect.
1199
+ *
1200
+ * The run's terminal status is Runtime's own `result.json` `kind` — `winner`,
1201
+ * `no-winner`, or whatever a later arm is called — read verbatim. The reader
1202
+ * does not decide which kinds count: a kind it refuses is a run that recorded
1203
+ * its outcome and got reported as having none.
1204
+ *
1205
+ * `usdKnown: false` / `tokensKnown: false` on ONE record is not a limit of this
1206
+ * store. The store recorded every other record completely, so the flags travel
1207
+ * through to the analyzer per record, which reports the measured nodes and
1208
+ * names the unreported ones.
1161
1209
  */
1162
1210
  const JOURNAL_FILE = "spawn-journal.jsonl";
1163
1211
  const RESULT_FILE = "result.json";
@@ -1328,7 +1376,6 @@ function sourceLimits(root, events, workerIds) {
1328
1376
  const terminal = settledById.get(id);
1329
1377
  return terminal?.length !== 1 || terminal[0]?.kind !== "settled" || spendRecord(terminal[0]?.spent) === null;
1330
1378
  });
1331
- const unknownUsd = [...rootMeters.map((event) => spendRecord(event.spend)), ...closes.filter((event) => event.kind === "settled").map((event) => spendRecord(event.spent))].filter((spend) => spend !== null).some((spend) => spend.usdKnown === false);
1332
1379
  const missingVerdicts = [...workerIds].filter((id) => {
1333
1380
  const terminal = settledById.get(id)?.[0];
1334
1381
  if (terminal?.kind !== "settled") return true;
@@ -1337,13 +1384,13 @@ function sourceLimits(root, events, workerIds) {
1337
1384
  return {
1338
1385
  managerTokens: rootMeterReason,
1339
1386
  workerTokens: incompleteWorkers.length === 0 ? null : `${incompleteWorkers.length}/${workerIds.size} child invocation(s) lack one settled spend record`,
1340
- spendUsd: rootMeterReason !== null ? rootMeterReason : unknownUsd ? "Runtime recorded usdKnown:false for at least one spend" : incompleteWorkers.length > 0 ? "at least one child invocation lacks a settled spend record" : null,
1387
+ spendUsd: rootMeterReason !== null ? rootMeterReason : incompleteWorkers.length > 0 ? "at least one child invocation lacks a settled spend record" : null,
1341
1388
  workerVerdicts: missingVerdicts.length === 0 ? null : `${missingVerdicts.length}/${workerIds.size} child invocation(s) lack a structured validity verdict`,
1342
1389
  deliverables: workerIds.size === 0 ? null : "Runtime FileRunContext does not retain per-child delivered patches"
1343
1390
  };
1344
1391
  }
1345
1392
  function runtimeState(root, startedAt, result, trajectory, resultPath, trajectoryPath) {
1346
- const resultKind = result?.kind === "completed" || result?.kind === "interrupted" ? result.kind : null;
1393
+ const resultKind = result === null ? null : nonEmptyString(result.kind);
1347
1394
  if (resultKind !== null && result !== null) {
1348
1395
  const resultRoot = nonEmptyString(record(result.tree)?.root);
1349
1396
  if (resultRoot === null) throw new Error(`${resultPath}: Runtime ${resultKind} result has no tree.root`);
@@ -1352,10 +1399,8 @@ function runtimeState(root, startedAt, result, trajectory, resultPath, trajector
1352
1399
  if (trajectory !== null && nonEmptyString(trajectory.root) === null) throw new Error(`${trajectoryPath}: Runtime trajectory has no root`);
1353
1400
  if (typeof trajectory?.root === "string" && trajectory.root !== root) throw new Error(`${trajectoryPath}: root ${JSON.stringify(trajectory.root)} does not match journal root ${JSON.stringify(root)}`);
1354
1401
  if (trajectory !== null && !Array.isArray(trajectory.nodes)) throw new Error(`${trajectoryPath}: Runtime trajectory nodes must be an array`);
1355
- let status = null;
1356
- if (resultKind === "completed") status = "completed";
1357
- else if (resultKind === "interrupted") status = "interrupted";
1358
- else if (Array.isArray(trajectory?.nodes)) {
1402
+ let status = resultKind;
1403
+ if (status === null && Array.isArray(trajectory?.nodes)) {
1359
1404
  const rootNodes = trajectory.nodes.map((node) => record(node)).filter((node) => node?.id === root);
1360
1405
  if (rootNodes.length > 1) throw new Error(`${trajectoryPath}: Runtime trajectory contains duplicate root nodes`);
1361
1406
  status = nonEmptyString(rootNodes[0]?.status);