@tangle-network/agent-eval 0.189.0 → 0.190.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 (135) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +3 -2
  3. package/dist/adapters/http.d.ts +10 -1
  4. package/dist/adapters/http.d.ts.map +1 -1
  5. package/dist/adapters/http.js +75 -7
  6. package/dist/adapters/http.js.map +1 -1
  7. package/dist/analyst/index.d.ts +66 -3
  8. package/dist/analyst/index.d.ts.map +1 -1
  9. package/dist/analyst/index.js +212 -7
  10. package/dist/analyst/index.js.map +1 -1
  11. package/dist/{benchmark-command-BhhAYstU.js → benchmark-command-TZlsuAh9.js} +10 -10
  12. package/dist/{benchmark-command-BhhAYstU.js.map → benchmark-command-TZlsuAh9.js.map} +1 -1
  13. package/dist/benchmarks/index.d.ts +1 -1
  14. package/dist/benchmarks/index.js +3 -3
  15. package/dist/campaign/index.d.ts +4 -4
  16. package/dist/campaign/index.js +7 -7
  17. package/dist/{campaign-BWoSQPSU.js → campaign-_29Qpc9Z.js} +255 -10
  18. package/dist/campaign-_29Qpc9Z.js.map +1 -0
  19. package/dist/{campaign-evidence-CBlGJ3kC.js → campaign-evidence-CWF8pEIk.js} +5 -4
  20. package/dist/campaign-evidence-CWF8pEIk.js.map +1 -0
  21. package/dist/{chat-client-C4dg7Ng_.js → chat-client-DbH06Ek6.js} +2 -2
  22. package/dist/{chat-client-C4dg7Ng_.js.map → chat-client-DbH06Ek6.js.map} +1 -1
  23. package/dist/{chat-json-call-JVGbfx95.js → chat-json-call-B0xTEY0I.js} +2 -2
  24. package/dist/{chat-json-call-JVGbfx95.js.map → chat-json-call-B0xTEY0I.js.map} +1 -1
  25. package/dist/claim-BGOUqoMq.d.ts +38 -0
  26. package/dist/claim-BGOUqoMq.d.ts.map +1 -0
  27. package/dist/cli.js +3 -3
  28. package/dist/contract/index.d.ts +4 -4
  29. package/dist/contract/index.js +7 -7
  30. package/dist/{default-registry-m2jhbG6Q.js → default-registry-16I-Bxlf.js} +2 -2
  31. package/dist/{default-registry-m2jhbG6Q.js.map → default-registry-16I-Bxlf.js.map} +1 -1
  32. package/dist/{define-agent-eval-q6890HU4.d.ts → define-agent-eval-BWeyIpny.d.ts} +4 -3
  33. package/dist/define-agent-eval-BWeyIpny.d.ts.map +1 -0
  34. package/dist/{define-agent-eval-98sgUaC1.js → define-agent-eval-DrGfrCTZ.js} +4 -4
  35. package/dist/{define-agent-eval-98sgUaC1.js.map → define-agent-eval-DrGfrCTZ.js.map} +1 -1
  36. package/dist/diagnosis/index.d.ts +1 -1
  37. package/dist/diagnosis/index.d.ts.map +1 -1
  38. package/dist/diagnosis/index.js +3 -3
  39. package/dist/diagnosis/index.js.map +1 -1
  40. package/dist/{dspy-rlm-engine-DLYttKBm.js → dspy-rlm-engine-CTIGomgr.js} +3 -3
  41. package/dist/{dspy-rlm-engine-DLYttKBm.js.map → dspy-rlm-engine-CTIGomgr.js.map} +1 -1
  42. package/dist/{eval-campaign-C0Q1Eeo_.js → eval-campaign-CMKRjWl0.js} +2 -2
  43. package/dist/{eval-campaign-C0Q1Eeo_.js.map → eval-campaign-CMKRjWl0.js.map} +1 -1
  44. package/dist/experiment/index.d.ts +2 -1
  45. package/dist/experiment/index.d.ts.map +1 -1
  46. package/dist/experiment/index.js +1 -1
  47. package/dist/exporters-XMCYJlqT.d.ts +161 -0
  48. package/dist/exporters-XMCYJlqT.d.ts.map +1 -0
  49. package/dist/{external-optimizer-process-C3quNeKV.js → external-optimizer-process-Mc83UoWl.js} +2 -2
  50. package/dist/{external-optimizer-process-C3quNeKV.js.map → external-optimizer-process-Mc83UoWl.js.map} +1 -1
  51. package/dist/{external-optimizer-subprocess-BDwgKLO1.js → external-optimizer-subprocess-C0dHXH8e.js} +2 -2
  52. package/dist/{external-optimizer-subprocess-BDwgKLO1.js.map → external-optimizer-subprocess-C0dHXH8e.js.map} +1 -1
  53. package/dist/{feedback-trajectory-B3ZSkfAq.d.ts → feedback-trajectory-BYjh7NEM.d.ts} +2 -2
  54. package/dist/{feedback-trajectory-B3ZSkfAq.d.ts.map → feedback-trajectory-BYjh7NEM.d.ts.map} +1 -1
  55. package/dist/{index-Dk1dOUfm.d.ts → index-BR_R1eBE.d.ts} +4 -4
  56. package/dist/{index-Dk1dOUfm.d.ts.map → index-BR_R1eBE.d.ts.map} +1 -1
  57. package/dist/{index-CnJOPR_E.d.ts → index-Ci0-EYzc.d.ts} +673 -244
  58. package/dist/index-Ci0-EYzc.d.ts.map +1 -0
  59. package/dist/{index-Bcc9PkOz.d.ts → index-D4pC7Tvd.d.ts} +3 -2
  60. package/dist/index-D4pC7Tvd.d.ts.map +1 -0
  61. package/dist/index.d.ts +66 -17
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +375 -31
  64. package/dist/index.js.map +1 -1
  65. package/dist/{kind-factory-BGwN0nE6.js → kind-factory-ByZeXDqF.js} +2 -2
  66. package/dist/{kind-factory-BGwN0nE6.js.map → kind-factory-ByZeXDqF.js.map} +1 -1
  67. package/dist/{llm-client-DF9bPNYA.js → llm-client-BqmRnibA.js} +2 -2
  68. package/dist/{llm-client-DF9bPNYA.js.map → llm-client-BqmRnibA.js.map} +1 -1
  69. package/dist/{llm-judge-M_l_WXw2.js → llm-judge-bwbgDMP0.js} +1891 -1377
  70. package/dist/llm-judge-bwbgDMP0.js.map +1 -0
  71. package/dist/mint-C9Lojt1V.d.ts +147 -0
  72. package/dist/mint-C9Lojt1V.d.ts.map +1 -0
  73. package/dist/openapi.json +1 -1
  74. package/dist/pipelines/index.d.ts +1 -1
  75. package/dist/{produced-state-BOY98IJO.js → produced-state-zSaGDC_Q.js} +4 -4
  76. package/dist/{produced-state-BOY98IJO.js.map → produced-state-zSaGDC_Q.js.map} +1 -1
  77. package/dist/{raw-provider-sink-C96CcqeG.js → raw-provider-sink-DIRCZjP_.js} +2 -2
  78. package/dist/{raw-provider-sink-C96CcqeG.js.map → raw-provider-sink-DIRCZjP_.js.map} +1 -1
  79. package/dist/{redact-DxwlUAvh.js → redact-8fX8-uKr.js} +16 -7
  80. package/dist/redact-8fX8-uKr.js.map +1 -0
  81. package/dist/{redact-DPoH1-OW.d.ts → redact-Du3WKUOP.d.ts} +7 -5
  82. package/dist/redact-Du3WKUOP.d.ts.map +1 -0
  83. package/dist/rl.d.ts +3 -2
  84. package/dist/rl.d.ts.map +1 -1
  85. package/dist/rl.js +1 -1
  86. package/dist/rollout/index.d.ts +3 -2
  87. package/dist/search-ledger-types-C9anU2DX.d.ts +489 -0
  88. package/dist/search-ledger-types-C9anU2DX.d.ts.map +1 -0
  89. package/dist/{semantic-concept-judge-Cm2K2wAo.js → semantic-concept-judge-BY0me-Jq.js} +5 -5
  90. package/dist/{semantic-concept-judge-Cm2K2wAo.js.map → semantic-concept-judge-BY0me-Jq.js.map} +1 -1
  91. package/dist/{server-C8XvqCg8.js → server-DnJCDLf8.js} +2 -2
  92. package/dist/{server-C8XvqCg8.js.map → server-DnJCDLf8.js.map} +1 -1
  93. package/dist/{skillopt-optimization-method-BVSB676o.js → skillopt-optimization-method-CfnQEjgT.js} +363 -18
  94. package/dist/skillopt-optimization-method-CfnQEjgT.js.map +1 -0
  95. package/dist/{spans-W0o8pbEg.d.ts → spans-D1RftP_w.d.ts} +2 -2
  96. package/dist/{spans-W0o8pbEg.d.ts.map → spans-D1RftP_w.d.ts.map} +1 -1
  97. package/dist/{statistical-heldout-plAHG82H.d.ts → statistical-heldout-CLpjYffJ.d.ts} +2 -36
  98. package/dist/statistical-heldout-CLpjYffJ.d.ts.map +1 -0
  99. package/dist/{store-otlp-D0AV4cvB.js → store-otlp-84DH0OEH.js} +2 -2
  100. package/dist/{store-otlp-D0AV4cvB.js.map → store-otlp-84DH0OEH.js.map} +1 -1
  101. package/dist/{store-tool-spans-8PAyhRqb.d.ts → store-tool-spans-BBXs8hDP.d.ts} +2 -2
  102. package/dist/{store-tool-spans-8PAyhRqb.d.ts.map → store-tool-spans-BBXs8hDP.d.ts.map} +1 -1
  103. package/dist/{store-tool-spans-B_0mXvYl.js → store-tool-spans-DSbYpl7f.js} +5 -5
  104. package/dist/{store-tool-spans-B_0mXvYl.js.map → store-tool-spans-DSbYpl7f.js.map} +1 -1
  105. package/dist/traces.d.ts +3 -63
  106. package/dist/traces.d.ts.map +1 -1
  107. package/dist/traces.js +6 -195
  108. package/dist/traces.js.map +1 -1
  109. package/dist/wire/index.d.ts +1 -1
  110. package/dist/wire/index.js +1 -1
  111. package/docs/adapters-observability.md +31 -27
  112. package/docs/charter.md +1 -1
  113. package/docs/design/mlbenchmarks-book-review.md +1 -1
  114. package/docs/distributed-driver.md +1 -5
  115. package/docs/experiment.md +15 -0
  116. package/docs/public-api.md +174 -68
  117. package/docs/redaction.md +7 -1
  118. package/docs/search-ledger.md +174 -0
  119. package/docs/trace-contracts.md +48 -3
  120. package/package.json +1 -1
  121. package/dist/campaign-BWoSQPSU.js.map +0 -1
  122. package/dist/campaign-evidence-CBlGJ3kC.js.map +0 -1
  123. package/dist/define-agent-eval-q6890HU4.d.ts.map +0 -1
  124. package/dist/index-Bcc9PkOz.d.ts.map +0 -1
  125. package/dist/index-CnJOPR_E.d.ts.map +0 -1
  126. package/dist/llm-judge-M_l_WXw2.js.map +0 -1
  127. package/dist/mint-DsS38v5c.d.ts +0 -305
  128. package/dist/mint-DsS38v5c.d.ts.map +0 -1
  129. package/dist/redact-DPoH1-OW.d.ts.map +0 -1
  130. package/dist/redact-DxwlUAvh.js.map +0 -1
  131. package/dist/search-ledger-types-D7KDVg-o.d.ts +0 -302
  132. package/dist/search-ledger-types-D7KDVg-o.d.ts.map +0 -1
  133. package/dist/skillopt-optimization-method-BVSB676o.js.map +0 -1
  134. package/dist/statistical-heldout-plAHG82H.d.ts.map +0 -1
  135. package/docs/search-history-receipts.md +0 -233
package/CHANGELOG.md CHANGED
@@ -6,6 +6,85 @@ All notable changes to `@tangle-network/agent-eval` and its sibling `agent-eval-
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## [0.190.0] — 2026-09-25
10
+
11
+ ### Added
12
+
13
+ - `askTraceQuestions` (`/analyst`) asks many questions of one trace store in a bounded pool under one shared `CostLedger`, and runs an independent verifier on every admitted finding.
14
+ Each question is one `runTraceAnalyst` call, so a finding still needs its minimum distinct citations (default 2), each resolvable in the store.
15
+ The verifier reads the claim through `citedSpansOnly`, a store that exposes exactly the cited spans and refuses every wider read; a finding it does not support is returned with `verified: false`.
16
+ One failed question never stops the others; its failure is its outcome.
17
+ It is the question runner of the agent-runtime continuation panel (discovery `docs/38-one-loop-and-continuation.md`, section 5), and `traces ask` can call the same code.
18
+
19
+ ### Changed
20
+
21
+ - **Breaking:** the search ledger records a search as nodes, edges and cells instead of candidate slots.
22
+ Its schema tag is `tangle.search-ledger.2026-09`; a ledger under any other tag, including `tangle.search-ledger.v1`, is refused with the tag named and is not translated.
23
+ Events: `search-opened`, `operation-started`, `operation-recorded`, `node-registered`, `edge-recorded`, `cell-allocated`, `cell-settled`, `cell-cancelled`, `node-decided`, `search-closed` ([search ledger](./docs/search-ledger.md)).
24
+ A node is content-addressed (`searchNodeId(searchId, artifactDigest)`), so a re-proposal is a second edge into it; an edge's attribution is `explicit`, `correlated` or `unknown`; a cell is one node on one task in one split at one repeat, and its attempts run `cellId:attempt`.
25
+ The ledger enforces the split seal (only the root and finalists run test cells), held-out test units, retries only after a retryable error, and a dollar admission rule over committed spend, open reservations and the claim reserve.
26
+ - **Breaking:** `SearchState` replaces the replay projection.
27
+ `ledger.state()` and every `append` return a `SearchStateView` whose audit holds counts and sums only, and whose node, edge, cell and unit-score reads go to live indexes; a view read after the ledger moved on throws.
28
+ Taking a view costs the same at any search size: apply plus snapshot measured 2.6 to 5.6 µs per entry across a generated 100,000-entry search, and `FileSearchLedger.append` CPU stayed at 2.8 to 3.0 ms from the first to the 2,000th append.
29
+ `state.lineage(record.search)` is the `searchLineage` resolver `mintRolloutRows` takes.
30
+ - **Breaking:** `openSearchLedger({ path, searchId })` replaces `campaignId`, and `ledger.state()` replaces `replay()`.
31
+ - **Breaking:** `SearchRecorder` writes a search as it runs: `open`, `registerNode`, `recordEdge` (the rationale and label are redacted with the `share` profile; one diff blob per parent), `allocateCell`, `settleCell` (optionally binding the attempt's RunRecord, whose coordinates must match), `cancelCell`, `startOperation`, `recordOperation`, `decideNode`, `close`, and `receipt`.
32
+ Content goes to content-addressed blobs beside the ledger.
33
+ - **Breaking:** `runOptimization({ searchLedger })` records live through the recorder: the baseline as the seeded root with its cells, one candidate-generation operation per generation, one node and `explicit` edge (with the proposer's redacted rationale and the parent-to-child surface diff) per candidate, cells allocated before each campaign and settled after it, and one decision per node.
34
+ Its scenarios are the train split, and it makes no claim.
35
+ - **Breaking:** `gepaOptimizationMethod({ searchLedger })` records GEPA through `importGepaPopulation` (population entries as nodes with `correlated` edges; collapsed duplicates reported) and `importExternalEvaluations` (every callback evaluation as an `external` cell; a candidate GEPA kept out of its population gets an `unknown` edge and is decided `pruned`).
36
+ - **Breaking:** a `SearchHistoryReceipt` (schema `2026-09`) is built from the ledger's bytes by `createSearchHistoryReceipt({ producerId, runId, ledger })`, binds their raw SHA-256, and is complete exactly when the ledger holds `search-closed`.
37
+ `require-complete` therefore means the search closed with every cell, operation and node accounted for.
38
+ `assertSearchHistoryMatchesState` replaces `assertSearchHistoryMatchesReplay`.
39
+ - Migration: rebuild a search's ledger with the recorder; there is no translation from the candidate-slot format. Replace `openSearchLedger({ campaignId })` with `searchId`, `replay()` with `state()`, `recordCandidatePopulationSearch` with `importGepaPopulation`, and read counts from `state.audit`.
40
+ - The diagnosis engine's skipped arm-vs-arm comparison now says where that comparison lives: `diffSteps` from `/pipelines`, which `traces diff <file>#branch=<a> <file>#branch=<b>` runs.
41
+ - A trace contract's `run.requireCompleted` passes only for a run whose status is `completed`; a failed or aborted run now fails it.
42
+ It used to accept any terminal status, so a run that ended in an error passed.
43
+ Lint reports `run.completed-not-allowed` when `allowedStatuses` excludes `completed`.
44
+ - `REDACTION_VERSION` is `2.1.0`, because the `json-secret` detector and in-place known-secret removal change what the redaction core removes.
45
+ Work keyed on the version, such as a traces upload's dedup identity, sees the change.
46
+ - `knownSecrets` are cut out where they stand instead of replacing the whole string, so `redactText('cleanup failed: <key> was still set', { knownSecrets: [key] })` keeps `cleanup failed:` and `was still set`.
47
+ A whole-string base64 payload that holds a known secret at any byte offset is still replaced whole, and value shapes such as bearer tokens still replace the whole string.
48
+
49
+ ### Removed
50
+
51
+ - The candidate-slot ledger: `SearchPlan`, candidate slots, `search-planned`, `search-plan-extended`, `candidate-registered`, `candidate-slot-closed`, `task-attempted`, `candidate-decided`, `search-completed`, `lineageNodeId`, `SearchLedgerReplay`, `SearchLedgerAudit`, `search-ledger-projector.ts`, and `recordCandidatePopulationSearch`.
52
+ - The search-ledger, search-history receipt, `runOptimization` ledger and comparison-history unit tests. The proof is the two real VerticalBench GEPA climbs imported through the recorder and the GEPA importer, replayed from bytes, and checked against every invariant.
53
+
54
+ ### Added
55
+
56
+ - `estimateNode(state, nodeId, { against, split })` is the one statistic of a search node ([search ledger](./docs/search-ledger.md#estimates)).
57
+ It averages cells inside their units, pairs the units both nodes scored, and runs `pairedDeltaTest` on the per-unit deltas: `none` below 2 pairs, `insufficient` below 6, `descriptive` (interval as spread plus the exact one-sided sign p) below 20, and `bootstrap` from 20.
58
+ The bootstrap is seeded from `cellSetDigest`, the digest of exactly the cells read, so equal cells give equal bits in any process and any row order; an all-equal sample is `indeterminate` and reports no interval or p.
59
+ `estimateNodeFromCells` is the same computation over cells a verifier read from its own store, and `SEARCH_ESTIMATOR` names the estimator by a digest of its parameters.
60
+ On the 38 paired rows of the 2026-08-08 prime-vs-dspy CodeTraceBench report it gives delta 0.1386, interval [0.0636, 0.2167], against the report's 0.1385.
61
+ - `searchPosterior(state, { split })` gives every node a normal posterior on its improvement over the root: its mean per-unit improvement, and the search's pooled between-unit variance divided by its shared units.
62
+ It takes 295 ms CPU over 100,000 screened nodes.
63
+ - `NodeEstimate.indeterminate`; `SearchStateView.scoredCells`, `hasNode` and `nodeIds`; `searchUnitScores`.
64
+ A unit's mean now sums its cells in cellId order instead of settlement order.
65
+ - Trace contracts check what the harness enforced and whether a call repeated a side effect.
66
+ `tools.enforced: true` (the `toolsOffered` rule) reads the tools offered to the model from the OTel GenAI `gen_ai.tool.definitions` attribute.
67
+ It fails when no span records them, when a call names a tool that was never offered, or when the harness offered a tool that `tools.allowed` does not declare.
68
+ - `retries: { reads, writes }` (the `retrySafe` rule) treats a tool called again with the same arguments as a repeat of its side effect.
69
+ Reads may repeat, a write may repeat only when every call carries one idempotency key at its `idempotencyKey` pointer, and any other tool may not repeat.
70
+ The key is left out of the comparison, so a retry under a new key still counts as the same charge.
71
+
72
+ - The redaction core's `json-secret` detector removes a quoted credential field with a quoted value inside serialized text, such as `{"password": "hunter2"}`, whatever the value's length. Placeholders (`$VAR`, `{env:VAR}`, `[REDACTED…]`) and prose descriptions do not match.
73
+
74
+ ### Fixed
75
+
76
+ - `run.requireCompleted` no longer treats an unknown run as completed. A root span's status is now inferred as `completed` only from a declared `run.status` attribute; a span that ended without an error but with no declared status is `unknown`, and `requireCompleted`/`allowedStatuses` fail it instead of passing it. This closed a gap where a trace reader that saw no terminal record (a killed job, a truncated stream) exported an OK-status root span that the gate read as completed.
77
+ - A `run` rule with `requireCompleted: false` and no other check, an empty `tools.maxCallsPerTool: {}`, and an empty `llm: {}` are now rejected as checking nothing, instead of compiling into a rule that always passes. The declarative form also rejects `run.requireCompleted: false` outright, matching `tools.enforced`.
78
+ - `retries` now fails a declared write whose own call errored (a timeout included) and carries no idempotency key, independent of whether a repeat is detected by exact-argument grouping. This catches a retry the grouping missed because it re-encoded an argument's value.
79
+ - `llm.maxTotalTokens` now counts cache-read and cache-write tokens alongside prompt and completion tokens. A cache-heavy call's `llm.token_count.prompt` attribute carries only the uncached remainder, so the ceiling used to pass runs at a small fraction of their real token spend.
80
+
81
+ ### Removed
82
+
83
+ - `createOtelExporter`, `createOtelTracingStore` and their types (`OtelExporter`, `OtelExportConfig`, `ExportableSpan`) are gone from `/traces`.
84
+ The exporter never read the collector's response and dropped a failed batch in an empty `catch`, with no size limit on its queue.
85
+ No repository in the 2026-08-21 consumer sweep imported either function.
86
+ Post `exportRunAsOtlp` output yourself, or stream with `createOtelExporter` from `@tangle-network/agent-runtime`, which counts written and dropped spans.
87
+
9
88
  ## [0.189.0] — 2026-09-24
10
89
 
11
90
  ### Added
package/README.md CHANGED
@@ -96,6 +96,7 @@ The [existing-agent example](./examples/foreign-agent-quickstart/) shows how to
96
96
  | Register evidence and decision rules | [`defineEvaluationClaim()` and `sealExperiment()`](./docs/evaluation-integrity.md) from `/experiment` | A declared population, independent unit, optional practical effect, and sealed rules. |
97
97
  | Check the evaluator | [`auditEvaluator()`](./docs/evaluation-integrity.md) and [calibration tools](./docs/outcome-validity.md) from `/meta-eval` | Error rates, admission evidence, bias diagnostics, and outcome associations. |
98
98
  | Analyze completed work | [`analyzeRuns()`](./examples/analyze-existing-runs/) from `/contract`; [trace analysts](./docs/trace-analysis.md) from `/analyst` | Comparisons and findings with links to recorded evidence. |
99
+ | Gate on the path a run took | A [trace contract](./docs/trace-contracts.md) (`compileTraceContractSpec()` from the root), or `traces check` in CI (unreleased — `/traces` `feat/traces-check`, pending its redaction-core migration) | `pass`, `fail`, or `error` per rule, with the spans that broke it. |
99
100
 
100
101
  `defineAgentEval()` also exposes `improve()` when the same agent, cases, judge, and baseline should share configuration.
101
102
  Use direct [campaign controls](./docs/eval-surface-map.md) for scheduling, durable caches, model matrices, or custom release rules.
@@ -130,8 +131,8 @@ These controls check the evidence behind a result.
130
131
  They do not establish that an optimizer beats a direct edit or simple search.
131
132
  The [historical evidence audit](./docs/design/self-improvement-evidence-audit.md) records prior gains, failed transfer, and missing comparisons.
132
133
 
133
- Set `searchHistoryPolicy: 'require-complete'` when every attempted search slot must be accounted for before final evidence is exposed.
134
- The [search-history receipt](./docs/search-history-receipts.md) binds the planned denominator to Eval's existing search ledger.
134
+ Set `searchHistoryPolicy: 'require-complete'` when a method's search must be closed, with every cell, operation and node accounted for, before final evidence is exposed.
135
+ The [search ledger](./docs/search-ledger.md) records every search as nodes, edges and cells, and its receipt is the bounded proof.
135
136
 
136
137
  A `gateDecision` is `ship`, `hold`, `need_more_work`, `model_ceiling`, or `arch_ceiling`.
137
138
  Gate contributions distinguish missing evidence from measured failures and successful checks.
@@ -1,5 +1,6 @@
1
+ import { m as CostReceipt } from "../cost-ledger-DbQdN3nO.js";
1
2
  import { R as Scenario, d as DispatchContext, f as DispatchFn } from "../types-BvmWNjjs.js";
2
- import "../index-Dk1dOUfm.js";
3
+ import "../index-BR_R1eBE.js";
3
4
  //#region src/adapters/http.d.ts
4
5
  interface HttpDispatchOptions<TScenario extends Scenario, _TArtifact> {
5
6
  /** Static endpoint URL. Mutually exclusive with `resolveUrl`. */
@@ -37,6 +38,14 @@ interface HttpDispatchRequestBody<TScenario extends Scenario> {
37
38
  }
38
39
  interface HttpDispatchResponseBody<TArtifact> {
39
40
  artifact: TArtifact;
41
+ /**
42
+ * Every paid-call receipt the worker's `ctx.cost` settled while producing
43
+ * this artifact, in settlement order. Absent or empty when the worker
44
+ * recorded no paid calls (no `contextFactory`, or a dispatch that pays
45
+ * through some other channel entirely). `httpDispatch` replays each one
46
+ * into the coordinator's own `ctx.cost`.
47
+ */
48
+ receipts?: CostReceipt[];
40
49
  }
41
50
  /**
42
51
  * Wrap a remote HTTP endpoint as a `Dispatch`. The remote side should run
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","names":[],"sources":["../../src/adapters/http.ts"],"mappings":";;;UA0CiB,oBAAoB,kBAAkB,UAAU;;EAE/D;;;;;;EAMA,cAAc;IAAS,UAAU;IAAW;IAAoB;;;EAEhE,gCAAgC;;EAEhC,UAAU;;EAEV;;EAEA;;EAEA,mBAAmB;;UAGJ,wBAAwB,kBAAkB;EACzD,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,yBAAyB;EACxC,UAAU;;;;;;;;;;iBAiBI,aAAa,kBAAkB,UAAU,WACvD,MAAM,oBAAoB,WAAW,aACpC,WAAS,WAAW;UAqFN,yBAAyB,kBAAkB,UAAU;;EAEpE,UAAU,WAAS,WAAW;;EAE9B;;EAEA;;;;EAIA;;EAEA;;;;;;;;EAQA,kBACE,KAAK,wBAAwB,YAC7B,QAAQ,gBACL,QAAQ;;EAEb;;EAEA,aAAa;IACX;IACA;IACA;IACA;;;UAIa;;EAEf;;EAEA,aAAa;;;;;;;;;;;;;;;;;;;;iBAqBO,kBAAkB,kBAAkB,UAAU,WAClE,MAAM,yBAAyB,WAAW,aACzC,QAAQ"}
1
+ {"version":3,"file":"http.d.ts","names":[],"sources":["../../src/adapters/http.ts"],"mappings":";;;;UAyDiB,oBAAoB,kBAAkB,UAAU;;EAE/D;;;;;;EAMA,cAAc;IAAS,UAAU;IAAW;IAAoB;;;EAEhE,gCAAgC;;EAEhC,UAAU;;EAEV;;EAEA;;EAEA,mBAAmB;;UAGJ,wBAAwB,kBAAkB;EACzD,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,yBAAyB;EACxC,UAAU;;;;;;;;EAQV,WAAW;;;;;;;;;;iBAiBG,aAAa,kBAAkB,UAAU,WACvD,MAAM,oBAAoB,WAAW,aACpC,WAAS,WAAW;UA+JN,yBAAyB,kBAAkB,UAAU;;EAEpE,UAAU,WAAS,WAAW;;EAE9B;;EAEA;;;;EAIA;;EAEA;;;;;;;;EAQA,kBACE,KAAK,wBAAwB,YAC7B,QAAQ,gBACL,QAAQ;;EAEb;;EAEA,aAAa;IACX;IACA;IACA;IACA;;;UAIa;;EAEf;;EAEA,aAAa;;;;;;;;;;;;;;;;;;;;iBAqBO,kBAAkB,kBAAkB,UAAU,WAClE,MAAM,yBAAyB,WAAW,aACzC,QAAQ"}
@@ -51,14 +51,15 @@ function httpDispatch(opts) {
51
51
  signal: combinedSignal
52
52
  });
53
53
  if (!res.ok) {
54
- if (!(res.status >= 500 || res.status === 408 || res.status === 429) || attempt === maxRetries) {
55
- const text = await res.text().catch(() => "");
56
- throw new Error(`httpDispatch ${url} failed (${res.status}): ${text.slice(0, 500)}`);
57
- }
54
+ const text = await res.text().catch(() => "");
55
+ for (const receipt of parseErrorReceipts(text)) await replayReceipt(ctx.cost, receipt);
56
+ if (!(res.status >= 500 || res.status === 408 || res.status === 429) || attempt === maxRetries) throw new Error(`httpDispatch ${url} failed (${res.status}): ${text.slice(0, 500)}`);
58
57
  await sleep(2 ** attempt * 200 + Math.random() * 200);
59
58
  continue;
60
59
  }
61
- return (await res.json()).artifact;
60
+ const parsed = await res.json();
61
+ for (const receipt of parsed.receipts ?? []) await replayReceipt(ctx.cost, receipt);
62
+ return parsed.artifact;
62
63
  } catch (err) {
63
64
  if (ctx.signal.aborted) throw err;
64
65
  lastError = err;
@@ -75,6 +76,58 @@ function sleep(ms) {
75
76
  if (typeof t.unref === "function") t.unref();
76
77
  });
77
78
  }
79
+ /** Best-effort receipts from a non-2xx `runDispatchServer` body. Any shape
80
+ * that isn't `{ error, receipts? }` JSON (plain-text 401/404/413 bodies,
81
+ * a non-`runDispatchServer` peer) yields none — never itself a reason to
82
+ * fail the request. */
83
+ function parseErrorReceipts(text) {
84
+ try {
85
+ const parsed = JSON.parse(text);
86
+ return Array.isArray(parsed.receipts) ? parsed.receipts : [];
87
+ } catch {
88
+ return [];
89
+ }
90
+ }
91
+ /**
92
+ * Re-enter one already-settled remote receipt through `runPaidCall` — the
93
+ * only path `CampaignCostMeter` admits. `execute` does no new work (the
94
+ * spend already happened on the worker); it only replays the worker's
95
+ * outcome so the coordinator's ledger records the same receipt (a settled
96
+ * failure included, so its `error` and cost — a failed call can still burn
97
+ * tokens — are never dropped on the floor). Faithfully replaying a remote
98
+ * failure still returns `succeeded: false` from `runPaidCall`: that's not
99
+ * ours to raise. Only a `receipt`-less failure is — it means `runPaidCall`
100
+ * refused to admit the call at all (a duplicate `callId`, an unknown-cost
101
+ * receipt under a capped coordinator ledger, a breached cost ceiling), so
102
+ * the remote spend could not be accounted for.
103
+ */
104
+ async function replayReceipt(cost, receipt) {
105
+ const knownCostUsd = receipt.costUnknown ? void 0 : receipt.costUsd;
106
+ const observed = () => ({
107
+ model: receipt.model,
108
+ inputTokens: receipt.inputTokens,
109
+ outputTokens: receipt.outputTokens,
110
+ ...receipt.reasoningTokens === void 0 ? {} : { reasoningTokens: receipt.reasoningTokens },
111
+ ...receipt.cachedTokens === void 0 ? {} : { cachedTokens: receipt.cachedTokens },
112
+ ...receipt.cacheWriteTokens === void 0 ? {} : { cacheWriteTokens: receipt.cacheWriteTokens },
113
+ ...receipt.usageUnknown ? { usageUnknown: true } : {},
114
+ ...knownCostUsd === void 0 ? { costUnknown: true } : { actualCostUsd: knownCostUsd }
115
+ });
116
+ const result = await cost.runPaidCall({
117
+ callId: receipt.callId,
118
+ channel: receipt.channel,
119
+ actor: receipt.actor,
120
+ model: receipt.model,
121
+ maximumCharge: knownCostUsd === void 0 ? void 0 : { externallyEnforcedMaximumUsd: knownCostUsd },
122
+ execute: async () => {
123
+ if (receipt.error) throw new Error(receipt.error);
124
+ return null;
125
+ },
126
+ receipt: observed,
127
+ receiptFromError: observed
128
+ });
129
+ if (!result.succeeded && !result.receipt) throw result.error;
130
+ }
78
131
  /**
79
132
  * Start an HTTP server exposing a local `Dispatch` over the wire. Pair with
80
133
  * `httpDispatch` on the driver side.
@@ -104,6 +157,7 @@ async function runDispatchServer(opts) {
104
157
  let cellId = "unknown";
105
158
  let success = false;
106
159
  let errCaught;
160
+ const receipts = [];
107
161
  try {
108
162
  if (req.method !== "POST" || req.url?.split("?")[0] !== path) {
109
163
  res.statusCode = 404;
@@ -150,7 +204,18 @@ async function runDispatchServer(opts) {
150
204
  cost: NOOP_COST
151
205
  };
152
206
  if (ctx.runAttemptId !== body.runAttemptId) throw new Error("runDispatchServer: contextFactory must preserve request runAttemptId");
153
- const responseBody = { artifact: await opts.dispatch(body.scenario, ctx) };
207
+ const recordingCost = { async runPaidCall(input) {
208
+ const result = await ctx.cost.runPaidCall(input);
209
+ if (result.receipt) receipts.push(result.receipt);
210
+ return result;
211
+ } };
212
+ const responseBody = {
213
+ artifact: await opts.dispatch(body.scenario, {
214
+ ...ctx,
215
+ cost: recordingCost
216
+ }),
217
+ ...receipts.length ? { receipts } : {}
218
+ };
154
219
  res.statusCode = 200;
155
220
  res.setHeader("content-type", "application/json");
156
221
  res.end(JSON.stringify(responseBody));
@@ -164,7 +229,10 @@ async function runDispatchServer(opts) {
164
229
  }
165
230
  res.statusCode = 500;
166
231
  res.setHeader("content-type", "application/json");
167
- res.end(JSON.stringify({ error: err instanceof Error ? err.message : String(err) }));
232
+ res.end(JSON.stringify({
233
+ error: err instanceof Error ? err.message : String(err),
234
+ ...receipts.length ? { receipts } : {}
235
+ }));
168
236
  } finally {
169
237
  opts.onRequest?.({
170
238
  cellId,
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","names":[],"sources":["../../src/adapters/http.ts"],"sourcesContent":["/**\n * # `@tangle-network/agent-eval/adapters/http` — distributed Dispatch over HTTP.\n *\n * Decouples coordinator and worker. The coordinator (running\n * `runImprovementLoop` or `runCampaign`) can live anywhere — your VPC, a dev\n * laptop, a cron VM. The workers (running the actual agent) can live anywhere else — different\n * regions, different clouds, different boxes — as long as they speak HTTP.\n *\n * Both sides:\n *\n * - **`httpDispatch({ url | resolveUrl, ... })`** — client. Returns a\n * `Dispatch` that POSTs `{ scenario, ctx }` to a worker URL and parses\n * the artifact back. AbortSignal-aware, retries on idempotent errors,\n * bounded timeout per call.\n * - **`runDispatchServer({ dispatch, port, ... })`** — server. Wraps your\n * local `Dispatch` as an HTTP endpoint. Handles auth, JSON parsing,\n * error mapping, and cancellation when the client aborts.\n *\n * # Topology examples\n *\n * **Single-worker:** coordinator on box A, worker on box B. Set\n * `httpDispatch({ url: 'https://box-b/dispatch' })`.\n *\n * **Multi-region:** N workers across regions. Use `httpDispatch({ resolveUrl })`\n * with a function that picks the URL per cell from `ctx.placement`. Combined\n * with `cellPlacement` on `RunCampaignOptions`, the substrate fans cells\n * across geographies in parallel.\n *\n * **Coordinator-as-a-service:** coordinator runs as a long-lived process or service\n * (holds optimization state across generations); workers are stateless\n * HTTP services that can scale horizontally per cell.\n */\n\nimport type { Dispatch, DispatchContext, Scenario } from '../contract'\n\n// ── Client ───────────────────────────────────────────────────────────\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- TArtifact is unused\n// in this options interface but kept as a parameter so callers can write\n// `HttpDispatchOptions<MyScenario, MyArtifact>` symmetrically with\n// `Dispatch<MyScenario, MyArtifact>`. Marking it unused at the position\n// where it bites.\nexport interface HttpDispatchOptions<TScenario extends Scenario, _TArtifact> {\n /** Static endpoint URL. Mutually exclusive with `resolveUrl`. */\n url?: string\n /**\n * Dynamic per-cell URL resolver. Receives the scenario + the substrate\n * placement key (from `RunCampaignOptions.cellPlacement`) and returns the\n * worker URL to invoke. Mutually exclusive with `url`.\n */\n resolveUrl?: (input: { scenario: TScenario; placement?: string; cellId: string }) => string\n /** Bearer token or static auth string set as `Authorization`. */\n auth?: string | (() => string | Promise<string>)\n /** Extra headers merged into every request. */\n headers?: Record<string, string>\n /** Per-call timeout in ms. Default 5 minutes. */\n timeoutMs?: number\n /** How many idempotent retries on 5xx / network errors. Default 2. */\n retries?: number\n /** Optional fetch override (auth wrappers, custom agent, mocks). */\n fetchImpl?: typeof fetch\n}\n\nexport interface HttpDispatchRequestBody<TScenario extends Scenario> {\n scenario: TScenario\n cellId: string\n runAttemptId: string\n rep: number\n generation?: number\n seed: number\n placement?: string\n cycleId?: string\n}\n\nexport interface HttpDispatchResponseBody<TArtifact> {\n artifact: TArtifact\n}\n\nfunction resolveAuth(auth: HttpDispatchOptions<Scenario, unknown>['auth']): Promise<string | null> {\n if (!auth) return Promise.resolve(null)\n if (typeof auth === 'string') return Promise.resolve(auth)\n return Promise.resolve(auth())\n}\n\n/**\n * Wrap a remote HTTP endpoint as a `Dispatch`. The remote side should run\n * `runDispatchServer` (or any service that speaks the same wire shape).\n *\n * Cancellation: the substrate's per-cell `AbortSignal` is forwarded; the\n * server's `runDispatchServer` translates the resulting `AbortError` into\n * a 499 (client-closed) so the client doesn't retry.\n */\nexport function httpDispatch<TScenario extends Scenario, TArtifact>(\n opts: HttpDispatchOptions<TScenario, TArtifact>,\n): Dispatch<TScenario, TArtifact> {\n if (!opts.url && !opts.resolveUrl) {\n throw new Error('httpDispatch: pass exactly one of `url` or `resolveUrl`.')\n }\n if (opts.url && opts.resolveUrl) {\n throw new Error('httpDispatch: pass exactly one of `url` or `resolveUrl`, not both.')\n }\n const timeoutMs = opts.timeoutMs ?? 5 * 60 * 1000\n const maxRetries = opts.retries ?? 2\n const f: typeof fetch = opts.fetchImpl ?? ((...args) => fetch(...args))\n\n return async (scenario, ctx) => {\n const url =\n opts.url ?? opts.resolveUrl!({ scenario, placement: ctx.placement, cellId: ctx.cellId })\n const authValue = await resolveAuth(opts.auth)\n const body: HttpDispatchRequestBody<TScenario> = {\n scenario,\n cellId: ctx.cellId,\n runAttemptId: ctx.runAttemptId,\n rep: ctx.rep,\n generation: ctx.generation,\n seed: ctx.seed,\n placement: ctx.placement,\n cycleId: ctx.cycleId,\n }\n\n let lastError: unknown\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n // Compose the request signal: caller's signal OR our timeout.\n const ourTimeout = AbortSignal.timeout(timeoutMs)\n const combinedSignal = AbortSignal.any([ctx.signal, ourTimeout])\n try {\n const res = await f(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(authValue\n ? {\n Authorization: authValue.startsWith('Bearer ')\n ? authValue\n : `Bearer ${authValue}`,\n }\n : {}),\n ...opts.headers,\n },\n body: JSON.stringify(body),\n signal: combinedSignal,\n })\n if (!res.ok) {\n // 4xx is non-retryable (caller error, auth, bad scenario shape).\n // 5xx / 408 / 429 / 502 / 503 / 504 are retryable.\n const retryable = res.status >= 500 || res.status === 408 || res.status === 429\n if (!retryable || attempt === maxRetries) {\n const text = await res.text().catch(() => '')\n throw new Error(`httpDispatch ${url} failed (${res.status}): ${text.slice(0, 500)}`)\n }\n // exponential backoff with jitter\n await sleep(2 ** attempt * 200 + Math.random() * 200)\n continue\n }\n const parsed = (await res.json()) as HttpDispatchResponseBody<TArtifact>\n return parsed.artifact\n } catch (err) {\n // Caller-driven abort is terminal — never retry.\n if (ctx.signal.aborted) throw err\n lastError = err\n if (attempt === maxRetries) throw err\n await sleep(2 ** attempt * 200 + Math.random() * 200)\n }\n }\n throw lastError ?? new Error('httpDispatch exhausted retries')\n }\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => {\n const t = setTimeout(resolve, ms)\n // Don't keep node process alive purely for backoff sleeps.\n if (typeof (t as { unref?: () => void }).unref === 'function')\n (t as { unref: () => void }).unref()\n })\n}\n\n// ── Server ───────────────────────────────────────────────────────────\n\nexport interface RunDispatchServerOptions<TScenario extends Scenario, TArtifact> {\n /** The Dispatch this server exposes — what runs when a request lands. */\n dispatch: Dispatch<TScenario, TArtifact>\n /** TCP port to bind. */\n port: number\n /** Optional bind host; defaults to 0.0.0.0. */\n host?: string\n /** Required for any non-test deployment: the bearer token clients must\n * send. The substrate refuses to start without auth unless `auth: false`\n * is set explicitly (intended ONLY for closed-network/internal testing). */\n auth: string | false\n /** Path the server listens on. Default `/dispatch`. */\n path?: string\n /**\n * Per-request handler that wraps `dispatch` with whatever context the\n * worker side needs to construct a `DispatchContext` — typically the\n * trace writer, artifact writer, and cost meter. The substrate provides\n * synthetic-but-typed defaults if not supplied; production deployments\n * should wire real ones (e.g. ship traces to your OTel collector).\n */\n contextFactory?: (\n req: HttpDispatchRequestBody<TScenario>,\n signal: AbortSignal,\n ) => Promise<DispatchContext>\n /** Optional max payload size for the request body (bytes). Default 10 MB. */\n maxBodyBytes?: number\n /** Hook for observability — called on every successful or failed turn. */\n onRequest?: (event: {\n cellId: string\n durationMs: number\n success: boolean\n error?: unknown\n }) => void\n}\n\nexport interface DispatchServerHandle {\n /** The actual bound port (useful when `port: 0` requests an ephemeral port). */\n port: number\n /** Stop accepting new connections and drain existing ones. */\n close: () => Promise<void>\n}\n\n/**\n * Start an HTTP server exposing a local `Dispatch` over the wire. Pair with\n * `httpDispatch` on the driver side.\n *\n * Wire shape:\n *\n * POST /dispatch\n * Authorization: Bearer <token>\n * Body: HttpDispatchRequestBody\n * 200 OK: HttpDispatchResponseBody\n * 401: missing/invalid auth\n * 408: per-request timeout exceeded\n * 499: client aborted before completion\n * 500: dispatch threw\n *\n * The server is `node:http`-based to keep the runtime dependency surface\n * minimal — works in plain Node, sandbox, or any container.\n */\nexport async function runDispatchServer<TScenario extends Scenario, TArtifact>(\n opts: RunDispatchServerOptions<TScenario, TArtifact>,\n): Promise<DispatchServerHandle> {\n if (opts.auth === undefined) {\n throw new Error(\n \"runDispatchServer: 'auth' is required (pass a bearer-token string, or `auth: false` explicitly for a closed-network test deployment).\",\n )\n }\n const path = opts.path ?? '/dispatch'\n const maxBytes = opts.maxBodyBytes ?? 10 * 1024 * 1024\n const expectedAuth =\n typeof opts.auth === 'string' ? `Bearer ${opts.auth.replace(/^Bearer\\s+/, '')}` : null\n\n // Lazy-import node:http so the file is usable from non-Node bundlers\n // that import the client side only (e.g. an edge driver shipping\n // httpDispatch alone). Server side is opt-in by calling this function.\n const { createServer } = await import('node:http')\n\n const server = createServer(async (req, res) => {\n const start = Date.now()\n let cellId = 'unknown'\n let success = false\n let errCaught: unknown\n\n try {\n if (req.method !== 'POST' || req.url?.split('?')[0] !== path) {\n res.statusCode = 404\n res.end('not found')\n return\n }\n if (expectedAuth) {\n const got = req.headers.authorization\n if (got !== expectedAuth) {\n res.statusCode = 401\n res.end('unauthorized')\n return\n }\n }\n\n // Read body up to maxBytes\n const chunks: Buffer[] = []\n let totalBytes = 0\n const aborter = new AbortController()\n // The request stream's 'close' fires when the BODY completes, so it\n // cannot signal disconnection. The response stream's 'close' fires\n // once per exchange: with `writableEnded` still false it means the\n // client went away before the dispatch answered.\n res.on('close', () => {\n if (!res.writableEnded) aborter.abort()\n })\n\n for await (const chunk of req) {\n const buf = chunk as Buffer\n totalBytes += buf.length\n if (totalBytes > maxBytes) {\n res.statusCode = 413\n res.end('payload too large')\n return\n }\n chunks.push(buf)\n }\n\n const body = JSON.parse(\n Buffer.concat(chunks).toString('utf8'),\n ) as HttpDispatchRequestBody<TScenario>\n if (typeof body.runAttemptId !== 'string' || body.runAttemptId.trim().length === 0) {\n throw new Error('runDispatchServer: request runAttemptId is required')\n }\n cellId = body.cellId\n\n const ctx: DispatchContext = opts.contextFactory\n ? await opts.contextFactory(body, aborter.signal)\n : {\n cellId: body.cellId,\n runAttemptId: body.runAttemptId,\n rep: body.rep,\n generation: body.generation,\n seed: body.seed,\n signal: aborter.signal,\n placement: body.placement,\n cycleId: body.cycleId,\n trace: NOOP_TRACE,\n artifacts: NOOP_ARTIFACTS,\n cost: NOOP_COST,\n }\n if (ctx.runAttemptId !== body.runAttemptId) {\n throw new Error('runDispatchServer: contextFactory must preserve request runAttemptId')\n }\n\n const artifact = await opts.dispatch(body.scenario, ctx)\n const responseBody: HttpDispatchResponseBody<TArtifact> = { artifact }\n\n res.statusCode = 200\n res.setHeader('content-type', 'application/json')\n res.end(JSON.stringify(responseBody))\n success = true\n } catch (err) {\n errCaught = err\n // Client-cancelled — they don't care about the result.\n if ((err as Error)?.name === 'AbortError') {\n res.statusCode = 499\n res.end('client aborted')\n return\n }\n res.statusCode = 500\n res.setHeader('content-type', 'application/json')\n res.end(JSON.stringify({ error: err instanceof Error ? err.message : String(err) }))\n } finally {\n opts.onRequest?.({\n cellId,\n durationMs: Date.now() - start,\n success,\n error: errCaught,\n })\n }\n })\n\n await new Promise<void>((resolve, reject) => {\n server.once('error', reject)\n server.listen(opts.port, opts.host ?? '0.0.0.0', () => resolve())\n })\n\n const addr = server.address()\n const boundPort = typeof addr === 'object' && addr ? addr.port : opts.port\n\n return {\n port: boundPort,\n close: () =>\n new Promise<void>((resolve, reject) => {\n server.close((err) => (err ? reject(err) : resolve()))\n }),\n }\n}\n\n// ── No-op default ctx machinery (worker can replace via contextFactory) ──\n\nconst NOOP_TRACE = {\n span: () => ({\n end: () => {},\n setAttribute: () => {},\n setStatus: () => {},\n recordException: () => {},\n addEvent: () => {},\n }),\n} as unknown as DispatchContext['trace']\n\nconst NOOP_ARTIFACTS = {\n write: async () => undefined,\n read: async () => undefined,\n list: async () => [],\n} as unknown as DispatchContext['artifacts']\n\nconst NOOP_COST = {\n record: () => {},\n total: () => 0,\n} as unknown as DispatchContext['cost']\n"],"mappings":";AA8EA,SAAS,YAAY,MAA8E;CACjG,IAAI,CAAC,MAAM,OAAO,QAAQ,QAAQ,IAAI;CACtC,IAAI,OAAO,SAAS,UAAU,OAAO,QAAQ,QAAQ,IAAI;CACzD,OAAO,QAAQ,QAAQ,KAAK,CAAC;AAC/B;;;;;;;;;AAUA,SAAgB,aACd,MACgC;CAChC,IAAI,CAAC,KAAK,OAAO,CAAC,KAAK,YACrB,MAAM,IAAI,MAAM,0DAA0D;CAE5E,IAAI,KAAK,OAAO,KAAK,YACnB,MAAM,IAAI,MAAM,oEAAoE;CAEtF,MAAM,YAAY,KAAK,aAAa,MAAS;CAC7C,MAAM,aAAa,KAAK,WAAW;CACnC,MAAM,IAAkB,KAAK,eAAe,GAAG,SAAS,MAAM,GAAG,IAAI;CAErE,OAAO,OAAO,UAAU,QAAQ;EAC9B,MAAM,MACJ,KAAK,OAAO,KAAK,WAAY;GAAE;GAAU,WAAW,IAAI;GAAW,QAAQ,IAAI;EAAO,CAAC;EACzF,MAAM,YAAY,MAAM,YAAY,KAAK,IAAI;EAC7C,MAAM,OAA2C;GAC/C;GACA,QAAQ,IAAI;GACZ,cAAc,IAAI;GAClB,KAAK,IAAI;GACT,YAAY,IAAI;GAChB,MAAM,IAAI;GACV,WAAW,IAAI;GACf,SAAS,IAAI;EACf;EAEA,IAAI;EACJ,KAAK,IAAI,UAAU,GAAG,WAAW,YAAY,WAAW;GAEtD,MAAM,aAAa,YAAY,QAAQ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CACrB,OAAO,YAAY,KAAA;CACnB,MAAM,YAAY,KAAA;CAClB,MAAM,YAAY,CAAC;AACrB;AAEA,MAAM,YAAY;CAChB,cAAc,CAAC;CACf,aAAa;AACf"}
1
+ {"version":3,"file":"http.js","names":[],"sources":["../../src/adapters/http.ts"],"sourcesContent":["/**\n * # `@tangle-network/agent-eval/adapters/http` — distributed Dispatch over HTTP.\n *\n * Decouples coordinator and worker. The coordinator (running\n * `runImprovementLoop` or `runCampaign`) can live anywhere — your VPC, a dev\n * laptop, a cron VM. The workers (running the actual agent) can live anywhere else — different\n * regions, different clouds, different boxes — as long as they speak HTTP.\n *\n * Both sides:\n *\n * - **`httpDispatch({ url | resolveUrl, ... })`** — client. Returns a\n * `Dispatch` that POSTs `{ scenario, ctx }` to a worker URL and parses\n * the artifact back. AbortSignal-aware, retries on idempotent errors,\n * bounded timeout per call.\n * - **`runDispatchServer({ dispatch, port, ... })`** — server. Wraps your\n * local `Dispatch` as an HTTP endpoint. Handles auth, JSON parsing,\n * error mapping, and cancellation when the client aborts.\n *\n * # Cost receipts cross the wire too\n *\n * A worker dispatch pays for its own model calls through its own\n * `ctx.cost` (wired by `contextFactory`) — a different `CostLedger` than the\n * coordinator's. `runDispatchServer` records every receipt that dispatch\n * settles and returns them alongside the artifact; `httpDispatch` replays\n * each one into the coordinator's `ctx.cost`, the same paid-call path a\n * local dispatch uses. A remote cell's spend therefore reaches the\n * coordinator's `CostLedger` — its summary, its cost ceiling, its\n * `CampaignCellResult.costUsd` — exactly like an in-process cell's does.\n * A worker with no `contextFactory` (or one that never touches `ctx.cost`)\n * sends no receipts, and the coordinator sees the cell as free, same as\n * today.\n *\n * # Topology examples\n *\n * **Single-worker:** coordinator on box A, worker on box B. Set\n * `httpDispatch({ url: 'https://box-b/dispatch' })`.\n *\n * **Multi-region:** N workers across regions. Use `httpDispatch({ resolveUrl })`\n * with a function that picks the URL per cell from `ctx.placement`. Combined\n * with `cellPlacement` on `RunCampaignOptions`, the substrate fans cells\n * across geographies in parallel.\n *\n * **Coordinator-as-a-service:** coordinator runs as a long-lived process or service\n * (holds optimization state across generations); workers are stateless\n * HTTP services that can scale horizontally per cell.\n */\n\nimport type { CampaignCostMeter, Dispatch, DispatchContext, Scenario } from '../contract'\nimport type { CostReceipt, CostReceiptInput } from '../cost-ledger'\n\n// ── Client ───────────────────────────────────────────────────────────\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- TArtifact is unused\n// in this options interface but kept as a parameter so callers can write\n// `HttpDispatchOptions<MyScenario, MyArtifact>` symmetrically with\n// `Dispatch<MyScenario, MyArtifact>`. Marking it unused at the position\n// where it bites.\nexport interface HttpDispatchOptions<TScenario extends Scenario, _TArtifact> {\n /** Static endpoint URL. Mutually exclusive with `resolveUrl`. */\n url?: string\n /**\n * Dynamic per-cell URL resolver. Receives the scenario + the substrate\n * placement key (from `RunCampaignOptions.cellPlacement`) and returns the\n * worker URL to invoke. Mutually exclusive with `url`.\n */\n resolveUrl?: (input: { scenario: TScenario; placement?: string; cellId: string }) => string\n /** Bearer token or static auth string set as `Authorization`. */\n auth?: string | (() => string | Promise<string>)\n /** Extra headers merged into every request. */\n headers?: Record<string, string>\n /** Per-call timeout in ms. Default 5 minutes. */\n timeoutMs?: number\n /** How many idempotent retries on 5xx / network errors. Default 2. */\n retries?: number\n /** Optional fetch override (auth wrappers, custom agent, mocks). */\n fetchImpl?: typeof fetch\n}\n\nexport interface HttpDispatchRequestBody<TScenario extends Scenario> {\n scenario: TScenario\n cellId: string\n runAttemptId: string\n rep: number\n generation?: number\n seed: number\n placement?: string\n cycleId?: string\n}\n\nexport interface HttpDispatchResponseBody<TArtifact> {\n artifact: TArtifact\n /**\n * Every paid-call receipt the worker's `ctx.cost` settled while producing\n * this artifact, in settlement order. Absent or empty when the worker\n * recorded no paid calls (no `contextFactory`, or a dispatch that pays\n * through some other channel entirely). `httpDispatch` replays each one\n * into the coordinator's own `ctx.cost`.\n */\n receipts?: CostReceipt[]\n}\n\nfunction resolveAuth(auth: HttpDispatchOptions<Scenario, unknown>['auth']): Promise<string | null> {\n if (!auth) return Promise.resolve(null)\n if (typeof auth === 'string') return Promise.resolve(auth)\n return Promise.resolve(auth())\n}\n\n/**\n * Wrap a remote HTTP endpoint as a `Dispatch`. The remote side should run\n * `runDispatchServer` (or any service that speaks the same wire shape).\n *\n * Cancellation: the substrate's per-cell `AbortSignal` is forwarded; the\n * server's `runDispatchServer` translates the resulting `AbortError` into\n * a 499 (client-closed) so the client doesn't retry.\n */\nexport function httpDispatch<TScenario extends Scenario, TArtifact>(\n opts: HttpDispatchOptions<TScenario, TArtifact>,\n): Dispatch<TScenario, TArtifact> {\n if (!opts.url && !opts.resolveUrl) {\n throw new Error('httpDispatch: pass exactly one of `url` or `resolveUrl`.')\n }\n if (opts.url && opts.resolveUrl) {\n throw new Error('httpDispatch: pass exactly one of `url` or `resolveUrl`, not both.')\n }\n const timeoutMs = opts.timeoutMs ?? 5 * 60 * 1000\n const maxRetries = opts.retries ?? 2\n const f: typeof fetch = opts.fetchImpl ?? ((...args) => fetch(...args))\n\n return async (scenario, ctx) => {\n const url =\n opts.url ?? opts.resolveUrl!({ scenario, placement: ctx.placement, cellId: ctx.cellId })\n const authValue = await resolveAuth(opts.auth)\n const body: HttpDispatchRequestBody<TScenario> = {\n scenario,\n cellId: ctx.cellId,\n runAttemptId: ctx.runAttemptId,\n rep: ctx.rep,\n generation: ctx.generation,\n seed: ctx.seed,\n placement: ctx.placement,\n cycleId: ctx.cycleId,\n }\n\n let lastError: unknown\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n // Compose the request signal: caller's signal OR our timeout.\n const ourTimeout = AbortSignal.timeout(timeoutMs)\n const combinedSignal = AbortSignal.any([ctx.signal, ourTimeout])\n try {\n const res = await f(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(authValue\n ? {\n Authorization: authValue.startsWith('Bearer ')\n ? authValue\n : `Bearer ${authValue}`,\n }\n : {}),\n ...opts.headers,\n },\n body: JSON.stringify(body),\n signal: combinedSignal,\n })\n if (!res.ok) {\n const text = await res.text().catch(() => '')\n // A dispatch that pays for part of its work before failing (a judge\n // call that settles, then the provider call itself errors) still\n // owes that spend to the coordinator's ledger — read it before\n // deciding whether this attempt retries or this cell fails. A\n // non-JSON error body (401/404/413's plain text) carries none.\n for (const receipt of parseErrorReceipts(text)) {\n await replayReceipt(ctx.cost, receipt)\n }\n // 4xx is non-retryable (caller error, auth, bad scenario shape).\n // 5xx / 408 / 429 / 502 / 503 / 504 are retryable.\n const retryable = res.status >= 500 || res.status === 408 || res.status === 429\n if (!retryable || attempt === maxRetries) {\n throw new Error(`httpDispatch ${url} failed (${res.status}): ${text.slice(0, 500)}`)\n }\n // exponential backoff with jitter\n await sleep(2 ** attempt * 200 + Math.random() * 200)\n continue\n }\n const parsed = (await res.json()) as HttpDispatchResponseBody<TArtifact>\n for (const receipt of parsed.receipts ?? []) {\n await replayReceipt(ctx.cost, receipt)\n }\n return parsed.artifact\n } catch (err) {\n // Caller-driven abort is terminal — never retry.\n if (ctx.signal.aborted) throw err\n lastError = err\n if (attempt === maxRetries) throw err\n await sleep(2 ** attempt * 200 + Math.random() * 200)\n }\n }\n throw lastError ?? new Error('httpDispatch exhausted retries')\n }\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => {\n const t = setTimeout(resolve, ms)\n // Don't keep node process alive purely for backoff sleeps.\n if (typeof (t as { unref?: () => void }).unref === 'function')\n (t as { unref: () => void }).unref()\n })\n}\n\n/** Best-effort receipts from a non-2xx `runDispatchServer` body. Any shape\n * that isn't `{ error, receipts? }` JSON (plain-text 401/404/413 bodies,\n * a non-`runDispatchServer` peer) yields none — never itself a reason to\n * fail the request. */\nfunction parseErrorReceipts(text: string): CostReceipt[] {\n try {\n const parsed = JSON.parse(text) as { receipts?: CostReceipt[] }\n return Array.isArray(parsed.receipts) ? parsed.receipts : []\n } catch {\n return []\n }\n}\n\n/**\n * Re-enter one already-settled remote receipt through `runPaidCall` — the\n * only path `CampaignCostMeter` admits. `execute` does no new work (the\n * spend already happened on the worker); it only replays the worker's\n * outcome so the coordinator's ledger records the same receipt (a settled\n * failure included, so its `error` and cost — a failed call can still burn\n * tokens — are never dropped on the floor). Faithfully replaying a remote\n * failure still returns `succeeded: false` from `runPaidCall`: that's not\n * ours to raise. Only a `receipt`-less failure is — it means `runPaidCall`\n * refused to admit the call at all (a duplicate `callId`, an unknown-cost\n * receipt under a capped coordinator ledger, a breached cost ceiling), so\n * the remote spend could not be accounted for.\n */\nasync function replayReceipt(cost: CampaignCostMeter, receipt: CostReceipt): Promise<void> {\n const knownCostUsd = receipt.costUnknown ? undefined : receipt.costUsd\n const observed = (): CostReceiptInput => ({\n model: receipt.model,\n inputTokens: receipt.inputTokens,\n outputTokens: receipt.outputTokens,\n ...(receipt.reasoningTokens === undefined ? {} : { reasoningTokens: receipt.reasoningTokens }),\n ...(receipt.cachedTokens === undefined ? {} : { cachedTokens: receipt.cachedTokens }),\n ...(receipt.cacheWriteTokens === undefined\n ? {}\n : { cacheWriteTokens: receipt.cacheWriteTokens }),\n ...(receipt.usageUnknown ? { usageUnknown: true as const } : {}),\n ...(knownCostUsd === undefined\n ? { costUnknown: true as const }\n : { actualCostUsd: knownCostUsd }),\n })\n const result = await cost.runPaidCall({\n callId: receipt.callId,\n channel: receipt.channel,\n actor: receipt.actor,\n model: receipt.model,\n maximumCharge:\n knownCostUsd === undefined ? undefined : { externallyEnforcedMaximumUsd: knownCostUsd },\n // No `signal`: the call already happened remotely. Aborting the replay\n // would not undo the spend, only hide it from the ledger.\n execute: async () => {\n if (receipt.error) throw new Error(receipt.error)\n return null\n },\n receipt: observed,\n receiptFromError: observed,\n })\n if (!result.succeeded && !result.receipt) {\n throw result.error\n }\n}\n\n// ── Server ───────────────────────────────────────────────────────────\n\nexport interface RunDispatchServerOptions<TScenario extends Scenario, TArtifact> {\n /** The Dispatch this server exposes — what runs when a request lands. */\n dispatch: Dispatch<TScenario, TArtifact>\n /** TCP port to bind. */\n port: number\n /** Optional bind host; defaults to 0.0.0.0. */\n host?: string\n /** Required for any non-test deployment: the bearer token clients must\n * send. The substrate refuses to start without auth unless `auth: false`\n * is set explicitly (intended ONLY for closed-network/internal testing). */\n auth: string | false\n /** Path the server listens on. Default `/dispatch`. */\n path?: string\n /**\n * Per-request handler that wraps `dispatch` with whatever context the\n * worker side needs to construct a `DispatchContext` — typically the\n * trace writer, artifact writer, and cost meter. The substrate provides\n * synthetic-but-typed defaults if not supplied; production deployments\n * should wire real ones (e.g. ship traces to your OTel collector).\n */\n contextFactory?: (\n req: HttpDispatchRequestBody<TScenario>,\n signal: AbortSignal,\n ) => Promise<DispatchContext>\n /** Optional max payload size for the request body (bytes). Default 10 MB. */\n maxBodyBytes?: number\n /** Hook for observability — called on every successful or failed turn. */\n onRequest?: (event: {\n cellId: string\n durationMs: number\n success: boolean\n error?: unknown\n }) => void\n}\n\nexport interface DispatchServerHandle {\n /** The actual bound port (useful when `port: 0` requests an ephemeral port). */\n port: number\n /** Stop accepting new connections and drain existing ones. */\n close: () => Promise<void>\n}\n\n/**\n * Start an HTTP server exposing a local `Dispatch` over the wire. Pair with\n * `httpDispatch` on the driver side.\n *\n * Wire shape:\n *\n * POST /dispatch\n * Authorization: Bearer <token>\n * Body: HttpDispatchRequestBody\n * 200 OK: HttpDispatchResponseBody\n * 401: missing/invalid auth\n * 408: per-request timeout exceeded\n * 499: client aborted before completion\n * 500: dispatch threw\n *\n * The server is `node:http`-based to keep the runtime dependency surface\n * minimal — works in plain Node, sandbox, or any container.\n */\nexport async function runDispatchServer<TScenario extends Scenario, TArtifact>(\n opts: RunDispatchServerOptions<TScenario, TArtifact>,\n): Promise<DispatchServerHandle> {\n if (opts.auth === undefined) {\n throw new Error(\n \"runDispatchServer: 'auth' is required (pass a bearer-token string, or `auth: false` explicitly for a closed-network test deployment).\",\n )\n }\n const path = opts.path ?? '/dispatch'\n const maxBytes = opts.maxBodyBytes ?? 10 * 1024 * 1024\n const expectedAuth =\n typeof opts.auth === 'string' ? `Bearer ${opts.auth.replace(/^Bearer\\s+/, '')}` : null\n\n // Lazy-import node:http so the file is usable from non-Node bundlers\n // that import the client side only (e.g. an edge driver shipping\n // httpDispatch alone). Server side is opt-in by calling this function.\n const { createServer } = await import('node:http')\n\n const server = createServer(async (req, res) => {\n const start = Date.now()\n let cellId = 'unknown'\n let success = false\n let errCaught: unknown\n // Hoisted so a dispatch that throws AFTER paying for some of its work\n // still reports that spend in the error response — a partial spend is\n // still spend, and it must reach the coordinator's ledger exactly like\n // a locally-dispatched cell's failure accounting does.\n const receipts: CostReceipt[] = []\n\n try {\n if (req.method !== 'POST' || req.url?.split('?')[0] !== path) {\n res.statusCode = 404\n res.end('not found')\n return\n }\n if (expectedAuth) {\n const got = req.headers.authorization\n if (got !== expectedAuth) {\n res.statusCode = 401\n res.end('unauthorized')\n return\n }\n }\n\n // Read body up to maxBytes\n const chunks: Buffer[] = []\n let totalBytes = 0\n const aborter = new AbortController()\n // The request stream's 'close' fires when the BODY completes, so it\n // cannot signal disconnection. The response stream's 'close' fires\n // once per exchange: with `writableEnded` still false it means the\n // client went away before the dispatch answered.\n res.on('close', () => {\n if (!res.writableEnded) aborter.abort()\n })\n\n for await (const chunk of req) {\n const buf = chunk as Buffer\n totalBytes += buf.length\n if (totalBytes > maxBytes) {\n res.statusCode = 413\n res.end('payload too large')\n return\n }\n chunks.push(buf)\n }\n\n const body = JSON.parse(\n Buffer.concat(chunks).toString('utf8'),\n ) as HttpDispatchRequestBody<TScenario>\n if (typeof body.runAttemptId !== 'string' || body.runAttemptId.trim().length === 0) {\n throw new Error('runDispatchServer: request runAttemptId is required')\n }\n cellId = body.cellId\n\n const ctx: DispatchContext = opts.contextFactory\n ? await opts.contextFactory(body, aborter.signal)\n : {\n cellId: body.cellId,\n runAttemptId: body.runAttemptId,\n rep: body.rep,\n generation: body.generation,\n seed: body.seed,\n signal: aborter.signal,\n placement: body.placement,\n cycleId: body.cycleId,\n trace: NOOP_TRACE,\n artifacts: NOOP_ARTIFACTS,\n cost: NOOP_COST,\n }\n if (ctx.runAttemptId !== body.runAttemptId) {\n throw new Error('runDispatchServer: contextFactory must preserve request runAttemptId')\n }\n\n // Record every receipt this dispatch settles on ITS OWN `ctx.cost` (the\n // worker's ledger, not the coordinator's) so the response can carry\n // them back. `httpDispatch` replays each one into the coordinator's\n // ledger — see the module doc.\n const recordingCost: CampaignCostMeter = {\n async runPaidCall(input) {\n const result = await ctx.cost.runPaidCall(input)\n if (result.receipt) receipts.push(result.receipt)\n return result\n },\n }\n\n const artifact = await opts.dispatch(body.scenario, { ...ctx, cost: recordingCost })\n const responseBody: HttpDispatchResponseBody<TArtifact> = {\n artifact,\n ...(receipts.length ? { receipts } : {}),\n }\n\n res.statusCode = 200\n res.setHeader('content-type', 'application/json')\n res.end(JSON.stringify(responseBody))\n success = true\n } catch (err) {\n errCaught = err\n // Client-cancelled — they don't care about the result.\n if ((err as Error)?.name === 'AbortError') {\n res.statusCode = 499\n res.end('client aborted')\n return\n }\n res.statusCode = 500\n res.setHeader('content-type', 'application/json')\n res.end(\n JSON.stringify({\n error: err instanceof Error ? err.message : String(err),\n ...(receipts.length ? { receipts } : {}),\n }),\n )\n } finally {\n opts.onRequest?.({\n cellId,\n durationMs: Date.now() - start,\n success,\n error: errCaught,\n })\n }\n })\n\n await new Promise<void>((resolve, reject) => {\n server.once('error', reject)\n server.listen(opts.port, opts.host ?? '0.0.0.0', () => resolve())\n })\n\n const addr = server.address()\n const boundPort = typeof addr === 'object' && addr ? addr.port : opts.port\n\n return {\n port: boundPort,\n close: () =>\n new Promise<void>((resolve, reject) => {\n server.close((err) => (err ? reject(err) : resolve()))\n }),\n }\n}\n\n// ── No-op default ctx machinery (worker can replace via contextFactory) ──\n\nconst NOOP_TRACE = {\n span: () => ({\n end: () => {},\n setAttribute: () => {},\n setStatus: () => {},\n recordException: () => {},\n addEvent: () => {},\n }),\n} as unknown as DispatchContext['trace']\n\nconst NOOP_ARTIFACTS = {\n write: async () => undefined,\n read: async () => undefined,\n list: async () => [],\n} as unknown as DispatchContext['artifacts']\n\nconst NOOP_COST = {\n record: () => {},\n total: () => 0,\n} as unknown as DispatchContext['cost']\n"],"mappings":";AAqGA,SAAS,YAAY,MAA8E;CACjG,IAAI,CAAC,MAAM,OAAO,QAAQ,QAAQ,IAAI;CACtC,IAAI,OAAO,SAAS,UAAU,OAAO,QAAQ,QAAQ,IAAI;CACzD,OAAO,QAAQ,QAAQ,KAAK,CAAC;AAC/B;;;;;;;;;AAUA,SAAgB,aACd,MACgC;CAChC,IAAI,CAAC,KAAK,OAAO,CAAC,KAAK,YACrB,MAAM,IAAI,MAAM,0DAA0D;CAE5E,IAAI,KAAK,OAAO,KAAK,YACnB,MAAM,IAAI,MAAM,oEAAoE;CAEtF,MAAM,YAAY,KAAK,aAAa,MAAS;CAC7C,MAAM,aAAa,KAAK,WAAW;CACnC,MAAM,IAAkB,KAAK,eAAe,GAAG,SAAS,MAAM,GAAG,IAAI;CAErE,OAAO,OAAO,UAAU,QAAQ;EAC9B,MAAM,MACJ,KAAK,OAAO,KAAK,WAAY;GAAE;GAAU,WAAW,IAAI;GAAW,QAAQ,IAAI;EAAO,CAAC;EACzF,MAAM,YAAY,MAAM,YAAY,KAAK,IAAI;EAC7C,MAAM,OAA2C;GAC/C;GACA,QAAQ,IAAI;GACZ,cAAc,IAAI;GAClB,KAAK,IAAI;GACT,YAAY,IAAI;GAChB,MAAM,IAAI;GACV,WAAW,IAAI;GACf,SAAS,IAAI;EACf;EAEA,IAAI;EACJ,KAAK,IAAI,UAAU,GAAG,WAAW,YAAY,WAAW;GAEtD,MAAM,aAAa,YAAY,QAAQ,SAAS;GAChD,MAAM,iBAAiB,YAAY,IAAI,CAAC,IAAI,QAAQ,UAAU,CAAC;GAC/D,IAAI;IACF,MAAM,MAAM,MAAM,EAAE,KAAK;KACvB,QAAQ;KACR,SAAS;MACP,gBAAgB;MAChB,GAAI,YACA,EACE,eAAe,UAAU,WAAW,S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A,MAAM,aAAa,EACjB,aAAa;CACX,WAAW,CAAC;CACZ,oBAAoB,CAAC;CACrB,iBAAiB,CAAC;CAClB,uBAAuB,CAAC;CACxB,gBAAgB,CAAC;AACnB,GACF;AAEA,MAAM,iBAAiB;CACrB,OAAO,YAAY,KAAA;CACnB,MAAM,YAAY,KAAA;CAClB,MAAM,YAAY,CAAC;AACrB;AAEA,MAAM,YAAY;CAChB,cAAc,CAAC;CACf,aAAa;AACf"}
@@ -1181,11 +1181,11 @@ declare function runAnalystBenchmarkCommand(argv: readonly string[], env?: NodeJ
1181
1181
  declare const ANALYST_BENCHMARK_IMPLEMENTATION_DIGEST_ALGORITHM = "sha256-canonical-source-manifest";
1182
1182
  declare const ANALYST_BENCHMARK_DEPENDENCY_LOCK_DIGEST_ALGORITHM = "sha256-canonical-file-manifest";
1183
1183
  declare const ANALYST_BENCHMARK_DEPENDENCY_LOCK_FILES: readonly string[];
1184
- declare const ANALYST_BENCHMARK_DEPENDENCY_LOCK_SHA256 = "1f4d8421c7f2245ff9ebca6e92976bec103e3211bd5554d5394a5e03e26279e2";
1184
+ declare const ANALYST_BENCHMARK_DEPENDENCY_LOCK_SHA256 = "deece9c68c6c8fd8d4271821b2549b44f586d55480b5e4adff0cef24425ad506";
1185
1185
  declare const ANALYST_BENCHMARK_EVIDENCE_DEPENDENCY_LOCK_SHA256 = "1e03f2daed356d60316aabefb407ec1e437ac94d408d61eea4ae096e9c6fbb5b";
1186
1186
  declare const ANALYST_BENCHMARK_EVIDENCE_IMPLEMENTATION_SHA256 = "4dba263b6256a30d56c7fdb2d992d3a953c0035d731f359b704db806f68f75ac";
1187
1187
  declare const ANALYST_BENCHMARK_IMPLEMENTATION_FILES: readonly string[];
1188
- declare const ANALYST_BENCHMARK_IMPLEMENTATION_SHA256 = "61a0ba42d25e5c22c0d1a51149480d7e29be072b8abe8b5ba2c03669fb447cbc";
1188
+ declare const ANALYST_BENCHMARK_IMPLEMENTATION_SHA256 = "34d7abf915171873242a05dc08805b3f78edec593f72d4cdb4c8882dec24621f";
1189
1189
  declare function analystBenchmarkImplementationDigest(): string;
1190
1190
  declare function analystBenchmarkDependencyLockDigest(): string;
1191
1191
  //#endregion
@@ -1355,5 +1355,68 @@ declare function isProposalFinding(finding: unknown): finding is ProposalFinding
1355
1355
  */
1356
1356
  declare function assertProposalFindings(findings: unknown, context?: string): ReadonlyArray<ProposalFinding>;
1357
1357
  //#endregion
1358
- export { AGENT_RX_UPSTREAM_REVISION, ANALYST_BENCHMARK_COST_LEDGER_FILE, ANALYST_BENCHMARK_DEPENDENCY_LOCK_DIGEST_ALGORITHM, ANALYST_BENCHMARK_DEPENDENCY_LOCK_FILES, ANALYST_BENCHMARK_DEPENDENCY_LOCK_SHA256, ANALYST_BENCHMARK_EVIDENCE_DEPENDENCY_LOCK_SHA256, ANALYST_BENCHMARK_EVIDENCE_IMPLEMENTATION_SHA256, ANALYST_BENCHMARK_IMPLEMENTATION_DIGEST_ALGORITHM, ANALYST_BENCHMARK_IMPLEMENTATION_FILES, ANALYST_BENCHMARK_IMPLEMENTATION_SHA256, ANALYST_BENCHMARK_LOCAL_RECEIPT_FILE, ANALYST_BENCHMARK_MANIFEST_FILE, ANALYST_BENCHMARK_OBSERVATIONS_FILE, type AgentRxBenchmarkCaseOptions, type AgentRxCalibrationRunnerSummary, type AgentRxCalibrationSummary, type AgentRxFailure, type AgentRxPrediction, type AgentRxPredictionReport, type AgentRxRow, type Analyst, type AnalystBenchmarkArtifact, type AnalystBenchmarkCase, type AnalystBenchmarkCommandConfig, type AnalystBenchmarkCommandDependencies, type AnalystBenchmarkDatasetRef, type AnalystBenchmarkDescriptor, type AnalystBenchmarkError, type AnalystBenchmarkLabelState, type AnalystBenchmarkLocalRunReceipt, type AnalystBenchmarkObservation, type AnalystBenchmarkOutput, type AnalystBenchmarkProgressRow, type AnalystBenchmarkProvenance, type AnalystBenchmarkResult, type AnalystBenchmarkRunIdentity, type AnalystBenchmarkRunManifest, type AnalystBenchmarkRunner, type AnalystBenchmarkSummary, type AnalystBudgetDeclaration, type AnalystComparisonMetric, type AnalystContext, type AnalystCost, type AnalystDefinition, type AnalystDefinitionAsymmetry, type AnalystDefinitionAsymmetryReport, type AnalystEvidenceBinding, type AnalystEvidenceExpectation, type AnalystEvidenceResolution, type AnalystEvidenceResolutionError, type AnalystEvidenceResolver, AnalystExpressivenessError, type AnalystFinding, type AnalystFindingScore, type AnalystHooks, type AnalystInputKind, type AnalystInstructionsOverride, type AnalystIssueExpectation, type AnalystLatencyDistribution, type AnalystMetricComparison, type AnalystProfileFragment, AnalystRegistry, type AnalystRegistryOptions, type AnalystRepairDeclaration, type AnalystRequirements, type AnalystRowExpansion, type AnalystRunEvent, type AnalystRunInputs, type AnalystRunResult, type AnalystRunSummary, type AnalystRunnerComparison, type AnalystSeverity, type AnalystTransportBinding, type AnalystUsageReceipt, type BehavioralAnalystOptions, type BudgetPolicy, CODE_TRACE_BENCH_ANALYST_PROMPT, CONTROL_INTEGRITY_ANALYST, type ChatCallOpts, type ChatClient, type ChatRequest, type ChatResponse, type ChatTraceEngineOptions, type ChatTransport, type ChunkedEvidenceBinding, type CodeTraceBenchCaseOptions, type CodeTraceBenchLabelOptions, type CodeTraceBenchLabelSet, type CodeTraceBenchRow, type CodeTraceBlockDiagnostics, type CodeTraceCalibrationRunnerSummary, type CodeTraceCalibrationSummary, type CodeTraceFailureBlock, type CodeTraceStageAnnotation, type CodeTracerLabelGroup, type CodeTracerPredictionAdapterOptions, type CodeTracerPredictions, type CodeTracerStepLabel, ControlIntegrityAnalyst, type CreateChatClientOpts, type CreateTraceAnalystOptions, type CustomTransportOpts, DEFAULT_MAX_VERIFICATION_ARTIFACT_BYTES, DEFAULT_TRACE_ANALYST_KINDS, DEFAULT_TRACE_ANALYST_OUTPUT_TOKENS, type DecodedReply, type DefaultAnalystRegistryOptions, type DefineCustomAnalystOptions, type DefineExactCustomAnalystOptions, type DiffPolicy, type DspyRlmTraceEngineOptions, type EvidenceProjection, type EvidenceRef, type ExactAnalystBudgetPolicy, type ExactAnalystBudgetSnapshot, type ExactAnalystExecutionPlanSnapshot, type ExactAnalystRunCompletion, type ExactAnalystRunEvent, ExactAnalystRunExecutionError, type ExactAnalystRunPolicySnapshot, type ExactAnalystRunResult, type ExactAnalystRunSummary, type ExactAnalystSnapshot, type ExactCapableAnalyst, type ExactExecutionComponentIdentity, type ExactExecutionComponentSnapshot, type ExactRegistryRunOpts, type ExecutionProbe, type ExecutionProbeOutcome, type ExecutionProbeRequest, type ExpandRowsArgs, FAILURE_MODE_KIND_SPEC, FINDING_SUBJECT_KINDS, FINDING_SUBJECT_SYNTAX, type FindingSubject, type FindingSubjectKind, type FindingsDiff, FindingsStore, IMPROVEMENT_KIND_SPEC, type InlineEvidenceBinding, KIND_EXPECTED_SUBJECTS, KNOWLEDGE_GAP_KIND_SPEC, KNOWLEDGE_POISONING_KIND_SPEC, type LoadedVerificationArtifacts, MAX_INCORRECT_BLOCKS, MAX_INCORRECT_BLOCK_STEPS, type MockTransportOpts, type OpenAiCompatibleTransportOpts, type PersistedFinding, type PreparedPublicAnalystBenchmark, type PrimeBenchmarkRunnerOptions, type PrimeBridgeTransport, type PrimeBridgeTransportRequest, type PrimeBridgeTransportResult, type PrimeCodeTraceDefinitionArgs, type PrimeExchangeOptions, type PrimeExchangeOutcome, type PrimeFailure, type PrimeProjectionDelivery, type PrimeProjectionOutcome, type PrimeProjectionSource, type PrimePromptSpec, type PrimeProtocolIdentity, type PrimeRawUsage, type PrimeRejectedRow, type PrimeRepairPromptSpec, type PrimeRepairState, type PrimeReplyContract, type PrimeRowDecoded, type PrimeTurnRecord, type ProposalFinding, type ProposalFindingOrigin, type PublicAnalystBenchmarkDataset, type PublicAnalystBenchmarkModelConfig, type PublicAnalystBenchmarkModelOwner, type PublicAnalystBenchmarkModelSettings, type PublicBenchmarkDistributions, type PublicBenchmarkModelPrediction, type PublicBenchmarkSelectionReport, type PublicBenchmarkValueDistribution, type PublicDirectDefinitionArgs, type PublicRlmDefinitionArgs, RAW_FINDING_SCHEMA_PROMPT, type RawAnalystEvidence, type RawAnalystFinding, RawAnalystFindingSchema, type RegistryRunOpts, type ReplVariableConsensusPort, type ReplVariableEvidenceBinding, type ReplyContract, type ReplyEnvelope, type ReplyRowDecoded, type ReplyRowRejection, type RunAnalystBenchmarkOptions, SKILL_USAGE_ANALYST, type SandboxSdkTransportOpts, type SemanticConceptJudgeAdapterOpts, type SkillUsageRecord, type SkillUsageReport, type SkillUsageScanConfig, type StepLabelAdapterOptions, type TraceAnalysisEngine, type TraceAnalysisEngineRequest, type TraceAnalysisEngineResult, type TraceAnalystDefinition, type TraceAnalystLimits, type TraceToolGroupName, type UpstreamPredictionAdapterOptions, type VerificationArtifactFile, type VerificationArtifactManifest, type VerificationArtifactRole, type VerificationAvailabilitySummary, type VerificationOutcome, type VerificationOutcomeSource, type VerificationOutcomeStatus, type VerificationResultFile, adaptPublicBenchmarkFindings, agentRxBenchmarkCase, agentRxPredictionsToFindings, analystBenchmarkDependencyLockDigest, analystBenchmarkImplementationDigest, analystDefinitionAsymmetries, analystDefinitionProtocolSha256, analystInstructionsOverrideFromText, analystUsageReceiptFromPrimeUsage, appendVerificationArtifactsToOtlp, assertProposalFindings, behavioralAnalyst, bindAnalyst, buildDefaultAnalystRegistry, buildPrimePrompt, buildPrimeRepairPrompt, buildSkillUsageReport, buildTraceToolsForGroup, codeTraceBenchCase, codeTracerPredictionsToFindings, coerceJson, compareAnalystRunners, computeFindingId, createChatClient, createChatTraceEngine, createDspyRlmTraceEngine, createPrimeBenchmarkRunner, createPublicBenchmarkDirectRunner, createPublicBenchmarkRlmRunner, createSemanticConceptJudgeAdapter, createTraceAnalyst, decodeReplyRows, defaultIsMaterial, defineCustomAnalyst, defineTraceAnalyst, deriveEfficiencyFindings, diffFindings, effectiveAnalystProtocolSha256, emitControlIntegrityFindings, emitSkillUsageFindings, emptyPrimeRawUsage, emptyPublicBenchmarkRunner, evidenceRefsFromRawFinding, expandCodeTraceFailureBlocks, extractPrimeJsonObject, findingSubjectGrammarPromptFor, isProposalFinding, loadCodeTraceVerificationArtifacts, loadPublicBenchmarkRows, makeFinding, makeProposalFinding, mergePrimeRawUsage, nodeHttpPrimeBridgeTransport, normalizeAgentRxCategory, normalizeBenchmarkLabel, normalizePrimeUsage, parseFindingSubject, parseRawFinding, parseVerificationOutcome, preparePublicAnalystBenchmark, primeAnalystProtocolSha256, primeCodeTraceAnalystDefinition, primeProtocolSha256, primeReplyDefect, projectPrimeTrajectory, publicBenchmarkDistributions, publicBenchmarkProtocolSha256, publicBenchmarkRlmInstructions, publicBenchmarkSelectionReport, publicBenchmarkSystemPrompt, publicDirectAnalystDefinition, publicRlmAnalystDefinition, readAnalystBenchmarkArtifact, readAnalystInstructionsOverride, registryBenchmarkRunner, renderAgentRxCalibrationMarkdown, renderAnalystBenchmarkMarkdown, renderCodeTraceCalibrationMarkdown, renderFindingSubject, renderPriorFindings, resolveTraceAnalystLimits, rlmEngineLimits, roundAgentRxStep, runAnalystBenchmark, runAnalystBenchmarkCommand, runPrimeExchange, runTraceAnalyst, scoreAnalystFindings, selectPublicBenchmarkRows, stripCodeFences, summarizeAgentRxCalibration, summarizeAnalystBenchmarkRunner, summarizeCodeTraceCalibration, traceStoreEvidenceResolver };
1358
+ //#region src/analyst/trace-questions.d.ts
1359
+ /** One question to ask of the store. */
1360
+ interface TraceQuestionSpec {
1361
+ /** Stable id: letters, digits, dot, underscore, hyphen. */
1362
+ readonly id: string;
1363
+ readonly question: string;
1364
+ /** Guidance for this question only, after the shared rules. */
1365
+ readonly instructions?: string;
1366
+ }
1367
+ interface AskTraceQuestionsOptions {
1368
+ readonly questions: readonly TraceQuestionSpec[];
1369
+ readonly store: TraceAnalysisStore;
1370
+ readonly engine: TraceAnalysisEngine;
1371
+ /** Every question and verifier charges this ledger; its ceiling bounds the whole call. */
1372
+ readonly costLedger: CostLedgerHandle;
1373
+ /** Stable id for cost attribution and logs. */
1374
+ readonly runId: string;
1375
+ /** Material every question receives before its first model call, such as the check's verdict. */
1376
+ readonly context?: string;
1377
+ /** Investigations running at once. Default 4. */
1378
+ readonly concurrency?: number;
1379
+ /** Distinct citations a finding needs. Default 2. */
1380
+ readonly minimumEvidenceCitations?: number;
1381
+ /** Run the independent verifier on every admitted finding. Default true. */
1382
+ readonly verify?: boolean;
1383
+ readonly limits?: Partial<TraceAnalystLimits>;
1384
+ readonly signal?: AbortSignal;
1385
+ readonly log?: (message: string, fields?: Record<string, unknown>) => void;
1386
+ }
1387
+ /** A finding and what the verifier, shown only its cited spans, concluded. */
1388
+ interface VerifiedTraceFinding {
1389
+ readonly finding: RawAnalystFinding;
1390
+ /** The finding's trace citations, as `trace://` URIs. */
1391
+ readonly citations: readonly string[];
1392
+ /** `true` supported, `false` not supported, `null` when verification was off or failed. */
1393
+ readonly verified: boolean | null;
1394
+ /** The verifier's own words, when it answered. */
1395
+ readonly verifierAnswer?: string;
1396
+ }
1397
+ interface TraceQuestionOutcome {
1398
+ readonly id: string;
1399
+ readonly question: string;
1400
+ readonly status: 'answered' | 'failed';
1401
+ readonly failure?: string;
1402
+ /** The engine's prose answer, verbatim; `null` when it returned none. */
1403
+ readonly answer: string | null;
1404
+ readonly findings: readonly VerifiedTraceFinding[];
1405
+ /** `null` when the engine failed before reporting. */
1406
+ readonly modelCalls: number | null;
1407
+ readonly toolCalls: number | null;
1408
+ }
1409
+ /**
1410
+ * Ask every question, then verify every admitted finding. Never throws for a failed question or
1411
+ * verifier: each failure is recorded on its outcome. Throws before any model call for a malformed
1412
+ * question list or options.
1413
+ */
1414
+ declare function askTraceQuestions(opts: AskTraceQuestionsOptions): Promise<TraceQuestionOutcome[]>;
1415
+ /**
1416
+ * A store that exposes exactly the cited spans. Discovery and whole-trace reads refuse, so the
1417
+ * verifier cannot go looking for other support; the underlying store's bounds still apply.
1418
+ */
1419
+ declare function citedSpansOnly(store: TraceAnalysisStore, allowed: ReadonlyMap<string, ReadonlySet<string>>): TraceAnalysisStore;
1420
+ //#endregion
1421
+ export { AGENT_RX_UPSTREAM_REVISION, ANALYST_BENCHMARK_COST_LEDGER_FILE, ANALYST_BENCHMARK_DEPENDENCY_LOCK_DIGEST_ALGORITHM, ANALYST_BENCHMARK_DEPENDENCY_LOCK_FILES, ANALYST_BENCHMARK_DEPENDENCY_LOCK_SHA256, ANALYST_BENCHMARK_EVIDENCE_DEPENDENCY_LOCK_SHA256, ANALYST_BENCHMARK_EVIDENCE_IMPLEMENTATION_SHA256, ANALYST_BENCHMARK_IMPLEMENTATION_DIGEST_ALGORITHM, ANALYST_BENCHMARK_IMPLEMENTATION_FILES, ANALYST_BENCHMARK_IMPLEMENTATION_SHA256, ANALYST_BENCHMARK_LOCAL_RECEIPT_FILE, ANALYST_BENCHMARK_MANIFEST_FILE, ANALYST_BENCHMARK_OBSERVATIONS_FILE, type AgentRxBenchmarkCaseOptions, type AgentRxCalibrationRunnerSummary, type AgentRxCalibrationSummary, type AgentRxFailure, type AgentRxPrediction, type AgentRxPredictionReport, type AgentRxRow, type Analyst, type AnalystBenchmarkArtifact, type AnalystBenchmarkCase, type AnalystBenchmarkCommandConfig, type AnalystBenchmarkCommandDependencies, type AnalystBenchmarkDatasetRef, type AnalystBenchmarkDescriptor, type AnalystBenchmarkError, type AnalystBenchmarkLabelState, type AnalystBenchmarkLocalRunReceipt, type AnalystBenchmarkObservation, type AnalystBenchmarkOutput, type AnalystBenchmarkProgressRow, type AnalystBenchmarkProvenance, type AnalystBenchmarkResult, type AnalystBenchmarkRunIdentity, type AnalystBenchmarkRunManifest, type AnalystBenchmarkRunner, type AnalystBenchmarkSummary, type AnalystBudgetDeclaration, type AnalystComparisonMetric, type AnalystContext, type AnalystCost, type AnalystDefinition, type AnalystDefinitionAsymmetry, type AnalystDefinitionAsymmetryReport, type AnalystEvidenceBinding, type AnalystEvidenceExpectation, type AnalystEvidenceResolution, type AnalystEvidenceResolutionError, type AnalystEvidenceResolver, AnalystExpressivenessError, type AnalystFinding, type AnalystFindingScore, type AnalystHooks, type AnalystInputKind, type AnalystInstructionsOverride, type AnalystIssueExpectation, type AnalystLatencyDistribution, type AnalystMetricComparison, type AnalystProfileFragment, AnalystRegistry, type AnalystRegistryOptions, type AnalystRepairDeclaration, type AnalystRequirements, type AnalystRowExpansion, type AnalystRunEvent, type AnalystRunInputs, type AnalystRunResult, type AnalystRunSummary, type AnalystRunnerComparison, type AnalystSeverity, type AnalystTransportBinding, type AnalystUsageReceipt, type AskTraceQuestionsOptions, type BehavioralAnalystOptions, type BudgetPolicy, CODE_TRACE_BENCH_ANALYST_PROMPT, CONTROL_INTEGRITY_ANALYST, type ChatCallOpts, type ChatClient, type ChatRequest, type ChatResponse, type ChatTraceEngineOptions, type ChatTransport, type ChunkedEvidenceBinding, type CodeTraceBenchCaseOptions, type CodeTraceBenchLabelOptions, type CodeTraceBenchLabelSet, type CodeTraceBenchRow, type CodeTraceBlockDiagnostics, type CodeTraceCalibrationRunnerSummary, type CodeTraceCalibrationSummary, type CodeTraceFailureBlock, type CodeTraceStageAnnotation, type CodeTracerLabelGroup, type CodeTracerPredictionAdapterOptions, type CodeTracerPredictions, type CodeTracerStepLabel, ControlIntegrityAnalyst, type CreateChatClientOpts, type CreateTraceAnalystOptions, type CustomTransportOpts, DEFAULT_MAX_VERIFICATION_ARTIFACT_BYTES, DEFAULT_TRACE_ANALYST_KINDS, DEFAULT_TRACE_ANALYST_OUTPUT_TOKENS, type DecodedReply, type DefaultAnalystRegistryOptions, type DefineCustomAnalystOptions, type DefineExactCustomAnalystOptions, type DiffPolicy, type DspyRlmTraceEngineOptions, type EvidenceProjection, type EvidenceRef, type ExactAnalystBudgetPolicy, type ExactAnalystBudgetSnapshot, type ExactAnalystExecutionPlanSnapshot, type ExactAnalystRunCompletion, type ExactAnalystRunEvent, ExactAnalystRunExecutionError, type ExactAnalystRunPolicySnapshot, type ExactAnalystRunResult, type ExactAnalystRunSummary, type ExactAnalystSnapshot, type ExactCapableAnalyst, type ExactExecutionComponentIdentity, type ExactExecutionComponentSnapshot, type ExactRegistryRunOpts, type ExecutionProbe, type ExecutionProbeOutcome, type ExecutionProbeRequest, type ExpandRowsArgs, FAILURE_MODE_KIND_SPEC, FINDING_SUBJECT_KINDS, FINDING_SUBJECT_SYNTAX, type FindingSubject, type FindingSubjectKind, type FindingsDiff, FindingsStore, IMPROVEMENT_KIND_SPEC, type InlineEvidenceBinding, KIND_EXPECTED_SUBJECTS, KNOWLEDGE_GAP_KIND_SPEC, KNOWLEDGE_POISONING_KIND_SPEC, type LoadedVerificationArtifacts, MAX_INCORRECT_BLOCKS, MAX_INCORRECT_BLOCK_STEPS, type MockTransportOpts, type OpenAiCompatibleTransportOpts, type PersistedFinding, type PreparedPublicAnalystBenchmark, type PrimeBenchmarkRunnerOptions, type PrimeBridgeTransport, type PrimeBridgeTransportRequest, type PrimeBridgeTransportResult, type PrimeCodeTraceDefinitionArgs, type PrimeExchangeOptions, type PrimeExchangeOutcome, type PrimeFailure, type PrimeProjectionDelivery, type PrimeProjectionOutcome, type PrimeProjectionSource, type PrimePromptSpec, type PrimeProtocolIdentity, type PrimeRawUsage, type PrimeRejectedRow, type PrimeRepairPromptSpec, type PrimeRepairState, type PrimeReplyContract, type PrimeRowDecoded, type PrimeTurnRecord, type ProposalFinding, type ProposalFindingOrigin, type PublicAnalystBenchmarkDataset, type PublicAnalystBenchmarkModelConfig, type PublicAnalystBenchmarkModelOwner, type PublicAnalystBenchmarkModelSettings, type PublicBenchmarkDistributions, type PublicBenchmarkModelPrediction, type PublicBenchmarkSelectionReport, type PublicBenchmarkValueDistribution, type PublicDirectDefinitionArgs, type PublicRlmDefinitionArgs, RAW_FINDING_SCHEMA_PROMPT, type RawAnalystEvidence, type RawAnalystFinding, RawAnalystFindingSchema, type RegistryRunOpts, type ReplVariableConsensusPort, type ReplVariableEvidenceBinding, type ReplyContract, type ReplyEnvelope, type ReplyRowDecoded, type ReplyRowRejection, type RunAnalystBenchmarkOptions, SKILL_USAGE_ANALYST, type SandboxSdkTransportOpts, type SemanticConceptJudgeAdapterOpts, type SkillUsageRecord, type SkillUsageReport, type SkillUsageScanConfig, type StepLabelAdapterOptions, type TraceAnalysisEngine, type TraceAnalysisEngineRequest, type TraceAnalysisEngineResult, type TraceAnalystDefinition, type TraceAnalystLimits, type TraceQuestionOutcome, type TraceQuestionSpec, type TraceToolGroupName, type UpstreamPredictionAdapterOptions, type VerificationArtifactFile, type VerificationArtifactManifest, type VerificationArtifactRole, type VerificationAvailabilitySummary, type VerificationOutcome, type VerificationOutcomeSource, type VerificationOutcomeStatus, type VerificationResultFile, type VerifiedTraceFinding, adaptPublicBenchmarkFindings, agentRxBenchmarkCase, agentRxPredictionsToFindings, analystBenchmarkDependencyLockDigest, analystBenchmarkImplementationDigest, analystDefinitionAsymmetries, analystDefinitionProtocolSha256, analystInstructionsOverrideFromText, analystUsageReceiptFromPrimeUsage, appendVerificationArtifactsToOtlp, askTraceQuestions, assertProposalFindings, behavioralAnalyst, bindAnalyst, buildDefaultAnalystRegistry, buildPrimePrompt, buildPrimeRepairPrompt, buildSkillUsageReport, buildTraceToolsForGroup, citedSpansOnly, codeTraceBenchCase, codeTracerPredictionsToFindings, coerceJson, compareAnalystRunners, computeFindingId, createChatClient, createChatTraceEngine, createDspyRlmTraceEngine, createPrimeBenchmarkRunner, createPublicBenchmarkDirectRunner, createPublicBenchmarkRlmRunner, createSemanticConceptJudgeAdapter, createTraceAnalyst, decodeReplyRows, defaultIsMaterial, defineCustomAnalyst, defineTraceAnalyst, deriveEfficiencyFindings, diffFindings, effectiveAnalystProtocolSha256, emitControlIntegrityFindings, emitSkillUsageFindings, emptyPrimeRawUsage, emptyPublicBenchmarkRunner, evidenceRefsFromRawFinding, expandCodeTraceFailureBlocks, extractPrimeJsonObject, findingSubjectGrammarPromptFor, isProposalFinding, loadCodeTraceVerificationArtifacts, loadPublicBenchmarkRows, makeFinding, makeProposalFinding, mergePrimeRawUsage, nodeHttpPrimeBridgeTransport, normalizeAgentRxCategory, normalizeBenchmarkLabel, normalizePrimeUsage, parseFindingSubject, parseRawFinding, parseVerificationOutcome, preparePublicAnalystBenchmark, primeAnalystProtocolSha256, primeCodeTraceAnalystDefinition, primeProtocolSha256, primeReplyDefect, projectPrimeTrajectory, publicBenchmarkDistributions, publicBenchmarkProtocolSha256, publicBenchmarkRlmInstructions, publicBenchmarkSelectionReport, publicBenchmarkSystemPrompt, publicDirectAnalystDefinition, publicRlmAnalystDefinition, readAnalystBenchmarkArtifact, readAnalystInstructionsOverride, registryBenchmarkRunner, renderAgentRxCalibrationMarkdown, renderAnalystBenchmarkMarkdown, renderCodeTraceCalibrationMarkdown, renderFindingSubject, renderPriorFindings, resolveTraceAnalystLimits, rlmEngineLimits, roundAgentRxStep, runAnalystBenchmark, runAnalystBenchmarkCommand, runPrimeExchange, runTraceAnalyst, scoreAnalystFindings, selectPublicBenchmarkRows, stripCodeFences, summarizeAgentRxCalibration, summarizeAnalystBenchmarkRunner, summarizeCodeTraceCalibration, traceStoreEvidenceResolver };
1359
1422
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/analyst/adapters.ts","../../src/analyst/benchmark-agentrx-calibration.ts","../../src/analyst/benchmark-dataset-types.ts","../../src/analyst/benchmark-dataset-agentrx.ts","../../src/analyst/benchmark-dataset-codetrace.ts","../../src/analyst/benchmark-dataset-utils.ts","../../src/analyst/benchmark-verification-outcome.ts","../../src/analyst/benchmark-verification-artifacts.ts","../../src/analyst/benchmark-public-types.ts","../../src/analyst/benchmark-public-adapters.ts","../../src/analyst/benchmark-public-data.ts","../../src/analyst/definition.ts","../../src/analyst/benchmark-public-prompt.ts","../../src/analyst/benchmark-public-model.ts","../../src/analyst/benchmark-public-rlm.ts","../../src/analyst/benchmark-runner-prime.ts","../../src/analyst/benchmark-comparison.ts","../../src/analyst/benchmark-public-calibration.ts","../../src/analyst/benchmark-command-artifact.ts","../../src/analyst/benchmark-command-result.ts","../../src/analyst/benchmark-command.ts","../../src/analyst/benchmark-implementation.ts","../../src/analyst/benchmark-instructions-override.ts","../../src/analyst/benchmark-report.ts","../../src/analyst/benchmark-summary.ts","../../src/analyst/bind.ts","../../src/analyst/define.ts","../../src/analyst/kinds/skill-usage.ts","../../src/analyst/parse-tolerant.ts","../../src/analyst/proposal-findings.ts"],"mappings":";;;;;;;;;;;;;;UA8CiB;EACf;EACA;;EAEA,SAAS,KAAK;;EAEd;;iBAGc,kCACd,MAAM,kCACL,QAAQ;;;cCtDE;UAEI;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA,SAAS;;iBAGK,4BACd,QAAQ,wBACR,2BACC;iBAkBa,iCAAiC,SAAS;;;KCtD9C;UAEK;EACf,YAAY;EACZ;EACA;EACA;EACA;EACA;;UAGe;EACf,eAAe;EACf,mBAAmB;EACnB;IAAe,YAAY;IAAY;;EACvC,wBAAwB;EACxB;EACA;EACA;;UAGe;EACf,UAAU;EACV;EACA;EACA;EACA;;UAGe;EACf,UAAU;EACV,mBAAmB;EACnB;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA,iBAAiB;;KAGP,0CAEC,sCACA,iCACA;UAEI;EACf;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA,oCAAoC;;UAGrB;EACf,eAAe;EACf,WAAW,sBAAsB;;KAGvB;UAEK;;;;;EAKf,WAAW;;UAGI,kCACP,yBACN;UAEa,oCAAoC;EACnD;;EAEA;;UAGe,yCAAyC;EACxD;EACA;EACA;EACA;;UAGe,2CACP,kCACN;;;iBCtGY,qBAAqB,QACnC,KAAK,YACL,OAAO,QACP,UAAS,8BACR,qBAAqB;;iBAsGR,6BACd,mBAAmB,YACnB,iBACA,UAAS,mCACR;iBA6Ea,yBA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;EACf;EACA;EACA,SAAS;;iBAGK,8BACd,QAAQ,yBACP;iBAca,mCAAmC,SAAS;;;UCpC3C;EACf;EACA;EACA;IACE,SAAS;IACT;IACA;IACA;IACA;IACA,YAAY;MAAQ;MAAiB;MAAsB;;IAC3D,uBAAuB;IACvB,0BAA0B;IAC1B;MACE;MACA;MACA;MACA,QAAQ;;IAEV;MACE;MACA;;MAEA;MACA;;MAEA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,UAAU;MACV;QACE;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;MAEF;QACE;QACA;QACA;;MAEF;MACA;MACA;;MAEA;MACA;MACA;;;EAGJ,QAAQ;EACR,aAAa;EACb,uBAAuB;EACvB,qBAAqB;;UAGN;EACf;EACA;EACA;EACA;IACE;IACA;IACA;;;UAIa;EACf;IACE,SAAS;IACT;IACA;IACA;MACE;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,SAAS;MACT;QACE;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;MAEF;QACE;QACA;QACA;;;IAGJ;IACA;IACA;IACA;;IAEA;IACA;IACA;IACA;;IAEA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA,YAAY;MAAQ;MAAiB;MAAsB;;IAC3D;IACA;;;UAIa;EACf;EACA;EACA;EACA;EACA,UAAU;;UAGK;EACf;EACA;EACA;EACA;IACE;IACA;IACA;IACA;;IAEA;;EAEF;EACA;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;;;UAIa;EACf;EACA;EACA;EACA,aAAa;EACb;;cAGW;cACA;cACA;cACA;;;iBC5KS,6BACpB,eACC,QAAQ;;;UCuEM;EACf,uBACE,SAAS,+BACT,QAAQ,wCACL,uBAAuB;EAC5B,2BACE,mBACA;IACE;IACA,aAAa,SAAS,OAAO;QAE5B,QAAQ;;;;;;;;;KAUH;;UAGK;EACf;EACA;;UAGe;EACf,SAAS;EACT,SAAS;EACT;EACA;EACA;EACA;EACA;EACA;E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BAAkB,mBAAmB,WAAW;;;;;;iBAShD,uBACd,mBACA,mBACC,cAAc"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/analyst/adapters.ts","../../src/analyst/benchmark-agentrx-calibration.ts","../../src/analyst/benchmark-dataset-types.ts","../../src/analyst/benchmark-dataset-agentrx.ts","../../src/analyst/benchmark-dataset-codetrace.ts","../../src/analyst/benchmark-dataset-utils.ts","../../src/analyst/benchmark-verification-outcome.ts","../../src/analyst/benchmark-verification-artifacts.ts","../../src/analyst/benchmark-public-types.ts","../../src/analyst/benchmark-public-adapters.ts","../../src/analyst/benchmark-public-data.ts","../../src/analyst/definition.ts","../../src/analyst/benchmark-public-prompt.ts","../../src/analyst/benchmark-public-model.ts","../../src/analyst/benchmark-public-rlm.ts","../../src/analyst/benchmark-runner-prime.ts","../../src/analyst/benchmark-comparison.ts","../../src/analyst/benchmark-public-calibration.ts","../../src/analyst/benchmark-command-artifact.ts","../../src/analyst/benchmark-command-result.ts","../../src/analyst/benchmark-command.ts","../../src/analyst/benchmark-implementation.ts","../../src/analyst/benchmark-instructions-override.ts","../../src/analyst/benchmark-report.ts","../../src/analyst/benchmark-summary.ts","../../src/analyst/bind.ts","../../src/analyst/define.ts","../../src/analyst/kinds/skill-usage.ts","../../src/analyst/parse-tolerant.ts","../../src/analyst/proposal-findings.ts","../../src/analyst/trace-questions.ts"],"mappings":";;;;;;;;;;;;;;UA8CiB;EACf;EACA;;EAEA,SAAS,KAAK;;EAEd;;iBAGc,kCACd,MAAM,kCACL,QAAQ;;;cCtDE;UAEI;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA,SAAS;;iBAGK,4BACd,QAAQ,wBACR,2BACC;iBAkBa,iCAAiC,SAAS;;;KCtD9C;UAEK;EACf,YAAY;EACZ;EACA;EACA;EACA;EACA;;UAGe;EACf,eAAe;EACf,mBAAmB;EACnB;IAAe,YAAY;IAAY;;EACvC,wBAAwB;EACxB;EACA;EACA;;UAGe;EACf,UAAU;EACV;EACA;EACA;EACA;;UAGe;EACf,UAAU;EACV,mBAAmB;EACnB;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA,iBAAiB;;KAGP,0CAEC,sCACA,iCACA;UAEI;EACf;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA,oCAAoC;;UAGrB;EACf,eAAe;EACf,WAAW,sBAAsB;;KAGvB;UAEK;;;;;EAKf,WAAW;;UAGI,kCACP,yBACN;UAEa,oCAAoC;EACnD;;EAEA;;UAGe,yCAAyC;EACxD;EACA;EACA;EACA;;UAGe,2CACP,kCACN;;;iBCtGY,qBAAqB,QACnC,KAAK,YACL,OAAO,QACP,UAAS,8BACR,qBAAqB;;iBAsGR,6BACd,mBAAmB,YACnB,iBACA,UAAS,mCACR;iBA6Ea,yBAAyB;;iBAoNzB,iBAAiB;;;iBC/YjB,mBAAmB,QACjC,KAAK,mBACL,OAAO,QACP,UAAS,4BACR,qBAAqB;;iBAwFR,gCACd,2BACA,aAAa,uBACb,UAAS,qCACR;;;iBClHa,wBAAwB;;;KCA5B;UAEK;EACf;EACA;EACA,QAAQ;;UAGO;EACf,QAAQ;EACR;EAKA;IAAe;IAAe;;EAC9B,SAAS;EACT;EACA;EACA;EACA;;UAGe;EACf;EACA;;iBA8Ec,yBACd,gBAAgB,2BACf;;;cC/FU;KAED;UAEK;EACf,MAAM;EACN;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA,SAAS;EACT;EACA;EACA;EACA;EACA;EACA,OAAO;EACP,cAAc;EACd,UAAU,OAAO;;UAGF;EACf,UAAU;EACV,SAAS;EACT,OAAO,MAAM;IAA6B;;;iBAatB,mCAAmC;EACvD;EACA,KAAK;EACL;IACE,QAAQ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AuB;;iBAwBV,gBAAgB,QAAQ,oCAAoC;;;UCtI3D;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA,UAAU;;EAEV,YAAY;;;;;;iBA8EE;UAIC;;EAEf;;EAEA;;;;;;iBAOc,gCACd,MAAM,+BACL,kBAAkB;;iBAyDL,2BACd,SAAS,8BACR,uBAAuB;;;;;;;;;;cC5OpB;WACQ;WACC;WACK;WACd;WACkB;WACJ;WACO;WACD;WACJ;WACK;WACd;WACJ;WACM;WACC;WACG;WACH;WACI;WACT;;KAGC,uCAAuC;UAgBlC;EACf,QAAQ;EACR;;EAEA;;EAEA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA,SAAS;;iBASK,sBACd,QAAQ,wBACR;EACE;EACA;EACA;EACA;EACA;IAED;;;UC3Fc;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA,SAAS;;iBAGK,8BACd,QAAQ,yBACP;iBAca,mCAAmC,SAAS;;;UCpC3C;EACf;EACA;EACA;IACE,SAAS;IACT;IACA;IACA;IACA;IACA,YAAY;MAAQ;MAAiB;MAAsB;;IAC3D,uBAAuB;IACvB,0BAA0B;IAC1B;MACE;MACA;MACA;MACA,QAAQ;;IAEV;MACE;MACA;;MAEA;MACA;;MAEA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,UAAU;MACV;QACE;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;MAEF;QACE;QACA;QACA;;MAEF;MACA;MACA;;MAEA;MACA;MACA;;;EAGJ,QAAQ;EACR,aAAa;EACb,uBAAuB;EACvB,qBAAqB;;UAGN;EACf;EACA;EACA;EACA;IACE;IACA;IACA;;;UAIa;EACf;IACE,SAAS;IACT;IACA;IACA;MACE;MACA;MACA;MACA;MACA;MACA;MACA;M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