@tangle-network/agent-eval 0.190.1 → 0.192.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 (167) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/adapters/http.d.ts +2 -2
  3. package/dist/{agent-profile-DNV_U6QR.d.ts → agent-profile-DDfIjdyS.d.ts} +3 -3
  4. package/dist/{agent-profile-DNV_U6QR.d.ts.map → agent-profile-DDfIjdyS.d.ts.map} +1 -1
  5. package/dist/analyst/index.d.ts +11 -11
  6. package/dist/analyst/index.js +5 -5
  7. package/dist/{insight-report-CvPkEIcC.d.ts → analyze-runs-CPiKLJFs.d.ts} +73 -3
  8. package/dist/analyze-runs-CPiKLJFs.d.ts.map +1 -0
  9. package/dist/{attribute-vocabulary-DLJ6303h.d.ts → attribute-vocabulary-CcXqHODT.d.ts} +23 -12
  10. package/dist/attribute-vocabulary-CcXqHODT.d.ts.map +1 -0
  11. package/dist/{benchmark-command-BXIr_k8D.js → benchmark-command-C458yEFK.js} +9 -9
  12. package/dist/{benchmark-command-BXIr_k8D.js.map → benchmark-command-C458yEFK.js.map} +1 -1
  13. package/dist/benchmarks/index.d.ts +3 -3
  14. package/dist/benchmarks/index.js +3 -3
  15. package/dist/campaign/index.d.ts +6 -6
  16. package/dist/campaign/index.js +8 -7
  17. package/dist/{campaign-B7q74uIh.js → campaign-BVQVBEfH.js} +13 -325
  18. package/dist/campaign-BVQVBEfH.js.map +1 -0
  19. package/dist/{campaign-evidence-D40-LHIL.js → campaign-evidence-DcQiYhJI.js} +18 -154
  20. package/dist/campaign-evidence-DcQiYhJI.js.map +1 -0
  21. package/dist/claim-V9Zqbq0J.js +54 -0
  22. package/dist/claim-V9Zqbq0J.js.map +1 -0
  23. package/dist/cli.js +99 -2
  24. package/dist/cli.js.map +1 -1
  25. package/dist/client-wFyDisxi.d.ts +236 -0
  26. package/dist/client-wFyDisxi.d.ts.map +1 -0
  27. package/dist/contract/index.d.ts +10 -11
  28. package/dist/contract/index.js +10 -140
  29. package/dist/contract/index.js.map +1 -1
  30. package/dist/{default-registry-B5HrwrPM.d.ts → default-registry-DdqA_-_o.d.ts} +6 -6
  31. package/dist/{default-registry-B5HrwrPM.d.ts.map → default-registry-DdqA_-_o.d.ts.map} +1 -1
  32. package/dist/{default-registry-16I-Bxlf.js → default-registry-xMLX160E.js} +3 -3
  33. package/dist/{default-registry-16I-Bxlf.js.map → default-registry-xMLX160E.js.map} +1 -1
  34. package/dist/{define-agent-eval-DPizhHfy.js → define-agent-eval-DQuos3Aw.js} +30 -113
  35. package/dist/define-agent-eval-DQuos3Aw.js.map +1 -0
  36. package/dist/{define-agent-eval-DblGedQk.d.ts → define-agent-eval-DcludNJS.d.ts} +25 -38
  37. package/dist/define-agent-eval-DcludNJS.d.ts.map +1 -0
  38. package/dist/diagnosis/index.d.ts +2 -2
  39. package/dist/diagnosis/index.js +1 -1
  40. package/dist/{dspy-rlm-engine-Cs5LzJ-f.js → dspy-rlm-engine-BX34vPVY.js} +3 -3
  41. package/dist/{dspy-rlm-engine-Cs5LzJ-f.js.map → dspy-rlm-engine-BX34vPVY.js.map} +1 -1
  42. package/dist/{engine-BkLCnZQX.d.ts → engine-C1DIAEpn.d.ts} +4 -4
  43. package/dist/{engine-BkLCnZQX.d.ts.map → engine-C1DIAEpn.d.ts.map} +1 -1
  44. package/dist/evaluation.d.ts +2 -2
  45. package/dist/{exact-types-CfpP2A4Z.d.ts → exact-types-KGxBWH4b.d.ts} +2 -2
  46. package/dist/{exact-types-CfpP2A4Z.d.ts.map → exact-types-KGxBWH4b.d.ts.map} +1 -1
  47. package/dist/experiment/index.d.ts +1 -1
  48. package/dist/experiment/index.js +2 -1
  49. package/dist/experiment/index.js.map +1 -1
  50. package/dist/{external-optimizer-process-BnSmrkgL.js → external-optimizer-process-D-Sab4v3.js} +3 -62
  51. package/dist/external-optimizer-process-D-Sab4v3.js.map +1 -0
  52. package/dist/{external-optimizer-subprocess-kbcPu5po.js → external-optimizer-subprocess-kbqC-iWf.js} +65 -27
  53. package/dist/external-optimizer-subprocess-kbqC-iWf.js.map +1 -0
  54. package/dist/{extract-usage-BrQ8mCLX.js → extract-usage-DFATEuWW.js} +2 -2
  55. package/dist/{extract-usage-BrQ8mCLX.js.map → extract-usage-DFATEuWW.js.map} +1 -1
  56. package/dist/{feedback-trajectory-BYjh7NEM.d.ts → feedback-trajectory-BXCGTRkz.d.ts} +3 -3
  57. package/dist/{feedback-trajectory-BYjh7NEM.d.ts.map → feedback-trajectory-BXCGTRkz.d.ts.map} +1 -1
  58. package/dist/hosted/index.d.ts +66 -6
  59. package/dist/hosted/index.d.ts.map +1 -1
  60. package/dist/hosted/index.js +2 -2
  61. package/dist/{index-I4UJGRno.d.ts → index-Bj96W0jZ.d.ts} +28 -2
  62. package/dist/{index-I4UJGRno.d.ts.map → index-Bj96W0jZ.d.ts.map} +1 -1
  63. package/dist/{index-2e_MTznj.d.ts → index-DBoXFaz0.d.ts} +6 -6
  64. package/dist/{index-2e_MTznj.d.ts.map → index-DBoXFaz0.d.ts.map} +1 -1
  65. package/dist/{index-CWoIJHmy.d.ts → index-DNVzu9Vv.d.ts} +10 -104
  66. package/dist/index-DNVzu9Vv.d.ts.map +1 -0
  67. package/dist/{index-CJv56rhX.d.ts → index-DwQxdWve.d.ts} +351 -135
  68. package/dist/index-DwQxdWve.d.ts.map +1 -0
  69. package/dist/index.d.ts +16 -17
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +11 -11
  72. package/dist/jev.d.ts +2 -2
  73. package/dist/{journal-c3qY0SDP.js → journal-DvKCvjty.js} +94 -2
  74. package/dist/{journal-c3qY0SDP.js.map → journal-DvKCvjty.js.map} +1 -1
  75. package/dist/{kind-factory-ByZeXDqF.js → kind-factory-CdPPHtGZ.js} +10 -26
  76. package/dist/kind-factory-CdPPHtGZ.js.map +1 -0
  77. package/dist/ledger-core/index.d.ts +2 -2
  78. package/dist/ledger-core/index.js +2 -2
  79. package/dist/{llm-judge-BnxAv7ed.js → llm-judge-Z6MkTkd0.js} +1805 -2012
  80. package/dist/llm-judge-Z6MkTkd0.js.map +1 -0
  81. package/dist/{matrix-CNypzP-v.d.ts → matrix-CQMMrEQ5.d.ts} +2 -2
  82. package/dist/{matrix-CNypzP-v.d.ts.map → matrix-CQMMrEQ5.d.ts.map} +1 -1
  83. package/dist/multishot/golden/index.d.ts +1 -1
  84. package/dist/multishot/index.d.ts +2 -2
  85. package/dist/openapi.json +1 -1
  86. package/dist/{otel-spans-CQY1pNiN.js → otel-spans-DS7t1t1J.js} +8 -19
  87. package/dist/otel-spans-DS7t1t1J.js.map +1 -0
  88. package/dist/otlp-attributes-D9ptWaIJ.js +53 -0
  89. package/dist/otlp-attributes-D9ptWaIJ.js.map +1 -0
  90. package/dist/{prime-protocol-Fwvctmhm.d.ts → prime-protocol-T0i6xcAs.d.ts} +2 -2
  91. package/dist/{prime-protocol-Fwvctmhm.d.ts.map → prime-protocol-T0i6xcAs.d.ts.map} +1 -1
  92. package/dist/{produced-state-BXjXJHJT.js → produced-state-CVmCPQDJ.js} +3 -3
  93. package/dist/{produced-state-BXjXJHJT.js.map → produced-state-CVmCPQDJ.js.map} +1 -1
  94. package/dist/{registry-mAQVtuLx.d.ts → registry-Bu3lNole.d.ts} +3 -3
  95. package/dist/{registry-mAQVtuLx.d.ts.map → registry-Bu3lNole.d.ts.map} +1 -1
  96. package/dist/rl.d.ts +1 -1
  97. package/dist/rl.js +1 -1
  98. package/dist/{run-record-DnMFyg_g.js → run-record-tNnlQIrD.js} +2 -10
  99. package/dist/{run-record-DnMFyg_g.js.map → run-record-tNnlQIrD.js.map} +1 -1
  100. package/dist/search-ledger-Ck7tok0h.js +1517 -0
  101. package/dist/search-ledger-Ck7tok0h.js.map +1 -0
  102. package/dist/search-ledger-file-DY0AXX3W.js +27 -0
  103. package/dist/search-ledger-file-DY0AXX3W.js.map +1 -0
  104. package/dist/search-shipper-BG182p-U.js +781 -0
  105. package/dist/search-shipper-BG182p-U.js.map +1 -0
  106. package/dist/{semantic-concept-judge-ClB73cei.js → semantic-concept-judge-Bg-560H0.js} +4 -4
  107. package/dist/{semantic-concept-judge-ClB73cei.js.map → semantic-concept-judge-Bg-560H0.js.map} +1 -1
  108. package/dist/{skillopt-optimization-method-l2vDBtKp.js → skillopt-optimization-method-DoayuM6D.js} +6 -5
  109. package/dist/{skillopt-optimization-method-l2vDBtKp.js.map → skillopt-optimization-method-DoayuM6D.js.map} +1 -1
  110. package/dist/{statistical-heldout-CLpjYffJ.d.ts → statistical-heldout-C1Ej5Ce8.d.ts} +2 -2
  111. package/dist/{statistical-heldout-CLpjYffJ.d.ts.map → statistical-heldout-C1Ej5Ce8.d.ts.map} +1 -1
  112. package/dist/{store-otlp-84DH0OEH.js → store-otlp-BPowgPm6.js} +2 -2
  113. package/dist/{store-otlp-84DH0OEH.js.map → store-otlp-BPowgPm6.js.map} +1 -1
  114. package/dist/{store-tool-spans-DUiqyHvR.js → store-tool-spans-BcC_5ef-.js} +5 -5
  115. package/dist/{store-tool-spans-DUiqyHvR.js.map → store-tool-spans-BcC_5ef-.js.map} +1 -1
  116. package/dist/{store-tool-spans-BBXs8hDP.d.ts → store-tool-spans-ByLdU26j.d.ts} +5 -9
  117. package/dist/store-tool-spans-ByLdU26j.d.ts.map +1 -0
  118. package/dist/{task-failure-attributes-B34TiMBe.js → task-failure-attributes-CEqEfuIY.js} +17 -9
  119. package/dist/task-failure-attributes-CEqEfuIY.js.map +1 -0
  120. package/dist/{tool-groups-W7MJobX_.d.ts → tool-groups-DiBi16ns.d.ts} +3 -3
  121. package/dist/tool-groups-DiBi16ns.d.ts.map +1 -0
  122. package/dist/trace-attributes.d.ts +1 -1
  123. package/dist/trace-attributes.js +23 -75
  124. package/dist/trace-attributes.js.map +1 -1
  125. package/dist/trace-repair/index.d.ts +1 -1
  126. package/dist/traces.d.ts +11 -18
  127. package/dist/traces.d.ts.map +1 -1
  128. package/dist/traces.js +16 -16
  129. package/dist/traces.js.map +1 -1
  130. package/dist/{types-Cvqy7asY.d.ts → types-ByZslIlr.d.ts} +2 -2
  131. package/dist/{types-Cvqy7asY.d.ts.map → types-ByZslIlr.d.ts.map} +1 -1
  132. package/dist/{types-BvmWNjjs.d.ts → types-C1CAD70_.d.ts} +15 -16
  133. package/dist/types-C1CAD70_.d.ts.map +1 -0
  134. package/dist/{types-Bay1dh2o.d.ts → types-CeDfCRXp.d.ts} +11 -16
  135. package/dist/types-CeDfCRXp.d.ts.map +1 -0
  136. package/dist/wire/index.d.ts +1 -1
  137. package/docs/campaign-proposers.md +14 -16
  138. package/docs/hosted-ingest-spec.md +92 -133
  139. package/docs/public-api.md +46 -35
  140. package/docs/search-ledger.md +79 -1
  141. package/package.json +2 -2
  142. package/dist/analyze-runs-BvK4-wSs.d.ts +0 -75
  143. package/dist/analyze-runs-BvK4-wSs.d.ts.map +0 -1
  144. package/dist/attribute-vocabulary-DLJ6303h.d.ts.map +0 -1
  145. package/dist/campaign-B7q74uIh.js.map +0 -1
  146. package/dist/campaign-evidence-D40-LHIL.js.map +0 -1
  147. package/dist/client-BhEyAdfe.d.ts +0 -202
  148. package/dist/client-BhEyAdfe.d.ts.map +0 -1
  149. package/dist/client-QwJpsNYU.js +0 -655
  150. package/dist/client-QwJpsNYU.js.map +0 -1
  151. package/dist/define-agent-eval-DPizhHfy.js.map +0 -1
  152. package/dist/define-agent-eval-DblGedQk.d.ts.map +0 -1
  153. package/dist/external-optimizer-process-BnSmrkgL.js.map +0 -1
  154. package/dist/external-optimizer-subprocess-kbcPu5po.js.map +0 -1
  155. package/dist/index-CJv56rhX.d.ts.map +0 -1
  156. package/dist/index-CWoIJHmy.d.ts.map +0 -1
  157. package/dist/insight-report-CvPkEIcC.d.ts.map +0 -1
  158. package/dist/kind-factory-ByZeXDqF.js.map +0 -1
  159. package/dist/llm-judge-BnxAv7ed.js.map +0 -1
  160. package/dist/otel-spans-CQY1pNiN.js.map +0 -1
  161. package/dist/otlp-attributes-BpC_blLF.js +0 -83
  162. package/dist/otlp-attributes-BpC_blLF.js.map +0 -1
  163. package/dist/store-tool-spans-BBXs8hDP.d.ts.map +0 -1
  164. package/dist/task-failure-attributes-B34TiMBe.js.map +0 -1
  165. package/dist/tool-groups-W7MJobX_.d.ts.map +0 -1
  166. package/dist/types-Bay1dh2o.d.ts.map +0 -1
  167. package/dist/types-BvmWNjjs.d.ts.map +0 -1
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../src/cli-config.ts","../src/cli.ts"],"sourcesContent":["/**\n * Provider configuration for the `agent-eval` binary.\n *\n * The binary reads endpoint and credential values from its environment.\n * TypeScript library callers bind a transport explicitly. The maintained\n * HTTP transport accepts their credential and sends provider requests.\n */\n\nimport { type ChatClient, createChatClient } from './analyst/chat-client'\n\nexport interface CliLlmConfig {\n /** Judge transport for the wire handlers. Absent when no provider is configured. */\n chat?: ChatClient\n model?: string\n}\n\n/** The endpoint the binary resolved from its environment. */\nexport interface CliProviderRoute {\n baseUrl: string\n apiKey: string\n model?: string\n}\n\n/**\n * Environment precedence for the binary's provider route, with no client built.\n *\n * Both halves are required: a base URL without a key, or a key without an\n * endpoint, is a half-configured server. `/v1/judge` then refuses with\n * `llm_not_configured` instead of calling an unintended endpoint.\n */\nexport function resolveCliProviderRoute(\n env: NodeJS.ProcessEnv = process.env,\n): CliProviderRoute | undefined {\n const explicitBaseUrl = nonEmpty(env.AGENT_EVAL_LLM_BASE_URL)\n const explicitApiKey = nonEmpty(env.AGENT_EVAL_LLM_API_KEY)\n const openAiApiKey = nonEmpty(env.OPENAI_API_KEY)\n const tangleApiKey = nonEmpty(env.TANGLE_API_KEY)\n const baseUrl =\n explicitBaseUrl ??\n nonEmpty(env.OPENAI_BASE_URL) ??\n nonEmpty(env.TANGLE_ROUTER_URL) ??\n (openAiApiKey ? 'https://api.openai.com/v1' : undefined) ??\n (tangleApiKey ? 'https://router.tangle.tools/v1' : undefined)\n const apiKey = explicitApiKey ?? openAiApiKey ?? tangleApiKey\n const model =\n nonEmpty(env.AGENT_EVAL_LLM_MODEL) ?? nonEmpty(env.OPENAI_MODEL) ?? nonEmpty(env.TANGLE_MODEL)\n\n if (!baseUrl || !apiKey) return undefined\n return { baseUrl, apiKey, ...(model ? { model } : {}) }\n}\n\nexport function resolveCliLlmConfig(env: NodeJS.ProcessEnv = process.env): CliLlmConfig {\n const route = resolveCliProviderRoute(env)\n if (!route) return {}\n return {\n chat: cliChatClient({ baseUrl: route.baseUrl, apiKey: route.apiKey }, route.model),\n ...(route.model ? { model: route.model } : {}),\n }\n}\n\n/**\n * The binary's transport IS the published one — `createChatClient({ transport:\n * 'openai-compatible' })` — so the server and a library consumer cannot drift\n * onto two different clients for the same endpoint.\n *\n * The one thing kept local is the error text. A generic \"no model on the\n * request\" tells a server operator nothing; this names the variable to set.\n */\nfunction cliChatClient(\n route: { baseUrl: string; apiKey: string },\n defaultModel: string | undefined,\n): ChatClient {\n const client = createChatClient({\n transport: 'openai-compatible',\n baseUrl: route.baseUrl,\n apiKey: route.apiKey,\n ...(defaultModel ? { defaultModel } : {}),\n })\n return {\n ...client,\n chat: (req, callOpts) => {\n if (!req.model && !defaultModel) {\n throw new Error(\n 'agent-eval: no model on the request and no AGENT_EVAL_LLM_MODEL configured',\n )\n }\n return client.chat(req, callOpts)\n },\n }\n}\n\nfunction nonEmpty(value: string | undefined): string | undefined {\n const trimmed = value?.trim()\n return trimmed ? trimmed : undefined\n}\n","#!/usr/bin/env node\n/**\n * agent-eval CLI.\n *\n * agent-eval serve [--port 5005] [--host 127.0.0.1]\n * agent-eval rpc <method> # one request from stdin → one response on stdout\n * agent-eval rpc-batch <method> # JSONL stdin → JSONL stdout\n * agent-eval analyst-benchmark ... # benchmark a real-model trace analyst\n * agent-eval supervisor-run report <runDir> [--format headline|markdown|json]\n * agent-eval openapi [--out path] # write OpenAPI spec\n * agent-eval version\n *\n * <method> is one of: judge, listRubrics, version. When omitted, the\n * stdin payload must be a full {method, params} envelope.\n */\nimport { writeFileSync } from 'node:fs'\nimport { runAnalystBenchmarkCommand } from './analyst/benchmark-command'\nimport { resolveCliLlmConfig } from './cli-config'\nimport { runRolloutReleaseCli } from './rollout/release/hf-dataset'\nimport { runSupervisorRunCommand } from './supervisor-run/report-command'\nimport { handleVersion } from './wire/handlers'\nimport { buildOpenApi } from './wire/openapi'\nimport { runRpcBatch, runRpcOnce } from './wire/rpc'\nimport { startServerAsync } from './wire/server'\n\ninterface Args {\n command: string\n positional: string[]\n flags: Record<string, string>\n}\n\nfunction parseArgs(argv: string[]): Args {\n const [command, ...rest] = argv\n const positional: string[] = []\n const flags: Record<string, string> = {}\n for (let i = 0; i < rest.length; i++) {\n const tok = rest[i]!\n if (tok.startsWith('--')) {\n const raw = tok.slice(2)\n const equalsAt = raw.indexOf('=')\n if (equalsAt >= 0) {\n flags[raw.slice(0, equalsAt)] = raw.slice(equalsAt + 1)\n continue\n }\n const key = raw\n if (key === 'help') {\n flags[key] = 'true'\n continue\n }\n const next = rest[i + 1]\n if (next != null && !next.startsWith('--')) {\n flags[key] = next\n i++\n } else {\n flags[key] = 'true'\n }\n } else if (tok === '-h') {\n flags.help = 'true'\n } else {\n positional.push(tok)\n }\n }\n return { command: command ?? 'help', positional, flags }\n}\n\nconst HELP = `agent-eval: evaluation RPC and HTTP server.\n\nCommands:\n serve [--port 5005] [--host 127.0.0.1]\n Start the HTTP server. POST /v1/judge, GET /v1/rubrics, GET /v1/version, GET /openapi.json.\n rpc <method>\n Read one JSON object from stdin (the params for <method>), write one\n JSON object to stdout. Methods: judge, listRubrics, version.\n rpc-batch <method>\n Like 'rpc' but JSONL in / JSONL out.\n openapi [--out openapi.json]\n Write the OpenAPI 3.1 spec.\n rollout-release <ledger.jsonl...> --out <dir> [--formats sft,verifiers,rft,raw] [--include-proposers] [--push <org/name>]\n Build a HuggingFace-ready dataset dir from tangle.rollout.v1 ledgers:\n validate, fail-closed split filter, scrub, export formats + card.\n analyst-benchmark --dataset <agentrx|codetracebench> --labels <path> --trace-dir <path> [--artifact-dir <path>] --out <dir> ...\n Compare an empty baseline with a real-model trace analyst on public labels.\n Run with --help for all required inputs and controls.\n supervisor-run report <runDir> [--format headline|markdown|json]\n Report one Runtime or loops supervisor run directory. The status comes\n from Runtime's own result.json / failure.json; every missing measurement\n stays named. Exits 1 when the directory cannot be read.\n version\n Print server + wire-protocol version JSON.\n\nJudge provider:\n Set AGENT_EVAL_LLM_BASE_URL, AGENT_EVAL_LLM_API_KEY, and AGENT_EVAL_LLM_MODEL.\n OPENAI_* and TANGLE_* equivalents are also accepted. This binary is the only\n place that reads a provider credential; the library never does. Without both\n a base URL and a key, /v1/judge refuses with llm_not_configured.\n\nWithout arguments, prints this help.`\n\nasync function main(): Promise<number> {\n const { command, positional, flags } = parseArgs(process.argv.slice(2))\n assertKnownFlags(command, flags)\n\n if (command === 'analyst-benchmark' && flags.help === 'true') {\n return await runAnalystBenchmarkCommand(process.argv.slice(3))\n }\n if (flags.help === 'true') {\n process.stdout.write(`${HELP}\\n`)\n return 0\n }\n\n switch (command) {\n case 'serve': {\n const port = parsePort(flags.port ?? '5005')\n const host = flags.host ?? '127.0.0.1'\n const llm = resolveCliLlmConfig()\n const { server } = await startServerAsync({\n port,\n host,\n ...(llm.chat ? { chat: llm.chat } : {}),\n ...(llm.model ? { judgeModel: llm.model } : {}),\n })\n // Keep process alive on SIGINT/SIGTERM\n const shutdown = (sig: string) => {\n // eslint-disable-next-line no-console\n console.log(`[agent-eval] received ${sig}, shutting down`)\n server.close(() => process.exit(0))\n // Force exit after 5s if close hangs\n setTimeout(() => process.exit(1), 5000).unref()\n }\n process.on('SIGINT', () => shutdown('SIGINT'))\n process.on('SIGTERM', () => shutdown('SIGTERM'))\n // Block forever\n await new Promise(() => {})\n return 0\n }\n case 'rpc': {\n const [method] = positional\n const llm = resolveCliLlmConfig()\n return await runRpcOnce(method, {\n ...(llm.chat ? { chat: llm.chat } : {}),\n ...(llm.model ? { judgeModel: llm.model } : {}),\n })\n }\n case 'rpc-batch': {\n const [method] = positional\n const llm = resolveCliLlmConfig()\n return await runRpcBatch(method, {\n ...(llm.chat ? { chat: llm.chat } : {}),\n ...(llm.model ? { judgeModel: llm.model } : {}),\n })\n }\n case 'openapi': {\n const out = flags.out ?? 'openapi.json'\n const spec = buildOpenApi(handleVersion().version)\n writeFileSync(out, `${JSON.stringify(spec, null, 2)}\\n`, 'utf-8')\n // eslint-disable-next-line no-console\n console.log(`[agent-eval] wrote OpenAPI 3.1 spec to ${out}`)\n return 0\n }\n case 'rollout-release': {\n // The subcommand owns its own flag grammar (multi-value --formats,\n // boolean --include-proposers) — pass raw argv through untouched.\n return await runRolloutReleaseCli(process.argv.slice(3))\n }\n case 'analyst-benchmark': {\n return await runAnalystBenchmarkCommand(process.argv.slice(3))\n }\n case 'supervisor-run': {\n // The subcommand owns its own flag grammar; pass raw argv through.\n return await runSupervisorRunCommand(process.argv.slice(3))\n }\n case 'version': {\n process.stdout.write(`${JSON.stringify(handleVersion(), null, 2)}\\n`)\n return 0\n }\n case '--version': {\n process.stdout.write(`${handleVersion().version}\\n`)\n return 0\n }\n case 'help':\n case '--help':\n case '-h':\n case '':\n process.stdout.write(`${HELP}\\n`)\n return 0\n default:\n process.stderr.write(`unknown command: ${command}\\n${HELP}\\n`)\n return 1\n }\n}\n\nconst FLAGS_BY_COMMAND: Record<string, ReadonlySet<string>> = {\n serve: new Set(['help', 'host', 'port']),\n rpc: new Set(['help']),\n 'rpc-batch': new Set(['help']),\n openapi: new Set(['help', 'out']),\n version: new Set(['help']),\n help: new Set(),\n '--help': new Set(),\n '-h': new Set(),\n '--version': new Set(),\n '': new Set(),\n}\n\nfunction assertKnownFlags(command: string, flags: Record<string, string>): void {\n // These subcommands parse their own argv.\n if (\n command === 'rollout-release' ||\n command === 'analyst-benchmark' ||\n command === 'supervisor-run'\n ) {\n return\n }\n const allowed = FLAGS_BY_COMMAND[command]\n if (!allowed) return\n const unknown = Object.keys(flags).filter((flag) => !allowed.has(flag))\n if (unknown.length > 0) {\n throw new Error(`unknown flag for ${command || 'help'}: --${unknown[0]}`)\n }\n}\n\nfunction parsePort(raw: string): number {\n const port = Number(raw)\n if (!Number.isInteger(port) || port < 0 || port > 65_535) {\n throw new Error(`--port must be an integer from 0 to 65535; received ${JSON.stringify(raw)}`)\n }\n return port\n}\n\nmain()\n .then((code) => process.exit(code))\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error('[agent-eval] cli error:', err)\n process.exit(1)\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,wBACd,MAAyB,QAAQ,KACH;CAC9B,MAAM,kBAAkB,SAAS,IAAI,uBAAuB;CAC5D,MAAM,iBAAiB,SAAS,IAAI,sBAAsB;CAC1D,MAAM,eAAe,SAAS,IAAI,cAAc;CAChD,MAAM,eAAe,SAAS,IAAI,cAAc;CAChD,MAAM,UACJ,mBACA,SAAS,IAAI,eAAe,KAC5B,SAAS,IAAI,iBAAiB,MAC7B,eAAe,8BAA8B,KAAA,OAC7C,eAAe,mCAAmC,KAAA;CACrD,MAAM,SAAS,kBAAkB,gBAAgB;CACjD,MAAM,QACJ,SAAS,IAAI,oBAAoB,KAAK,SAAS,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY;CAE/F,IAAI,CAAC,WAAW,CAAC,QAAQ,OAAO,KAAA;CAChC,OAAO;EAAE;EAAS;EAAQ,GAAI,QAAQ,EAAE,MAAM,IAAI,CAAC;CAAG;AACxD;AAEA,SAAgB,oBAAoB,MAAyB,QAAQ,KAAmB;CACtF,MAAM,QAAQ,wBAAwB,GAAG;CACzC,IAAI,CAAC,OAAO,OAAO,CAAC;CACpB,OAAO;EACL,MAAM,cAAc;GAAE,SAAS,MAAM;GAAS,QAAQ,MAAM;EAAO,GAAG,MAAM,KAAK;EACjF,GAAI,MAAM,QAAQ,EAAE,OAAO,MAAM,MAAM,IAAI,CAAC;CAC9C;AACF;;;;;;;;;AAUA,SAAS,cACP,OACA,cACY;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CAAC;CACzB,sBAAM,IAAI,IAAI;CACd,0BAAU,IAAI,IAAI;CAClB,sBAAM,IAAI,IAAI;CACd,6BAAa,IAAI,IAAI;CACrB,oBAAI,IAAI,IAAI;AACd;AAEA,SAAS,iBAAiB,SAAiB,OAAqC;CAE9E,IACE,YAAY,qBACZ,YAAY,uBACZ,YAAY,kBAEZ;CAEF,MAAM,UAAU,iBAAiB;CACjC,IAAI,CAAC,SAAS;CACd,MAAM,UAAU,OAAO,KAAK,KAAK,CAAC,CAAC,QAAQ,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC;CACtE,IAAI,QAAQ,SAAS,GACnB,MAAM,IAAI,MAAM,oBAAoB,WAAW,OAAO,MAAM,QAAQ,IAAI;AAE5E;AAEA,SAAS,UAAU,KAAqB;CACtC,MAAM,OAAO,OAAO,GAAG;CACvB,IAAI,CAAC,OAAO,UAAU,IAAI,KAAK,OAAO,KAAK,OAAO,OAChD,MAAM,IAAI,MAAM,uDAAuD,KAAK,UAAU,GAAG,GAAG;CAE9F,OAAO;AACT;AAEA,KAAK,CAAC,CACH,MAAM,SAAS,QAAQ,KAAK,IAAI,CAAC,CAAC,CAClC,OAAO,QAAQ;CAEd,QAAQ,MAAM,2BAA2B,GAAG;CAC5C,QAAQ,KAAK,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/cli-config.ts","../src/search-command.ts","../src/cli.ts"],"sourcesContent":["/**\n * Provider configuration for the `agent-eval` binary.\n *\n * The binary reads endpoint and credential values from its environment.\n * TypeScript library callers bind a transport explicitly. The maintained\n * HTTP transport accepts their credential and sends provider requests.\n */\n\nimport { type ChatClient, createChatClient } from './analyst/chat-client'\n\nexport interface CliLlmConfig {\n /** Judge transport for the wire handlers. Absent when no provider is configured. */\n chat?: ChatClient\n model?: string\n}\n\n/** The endpoint the binary resolved from its environment. */\nexport interface CliProviderRoute {\n baseUrl: string\n apiKey: string\n model?: string\n}\n\n/**\n * Environment precedence for the binary's provider route, with no client built.\n *\n * Both halves are required: a base URL without a key, or a key without an\n * endpoint, is a half-configured server. `/v1/judge` then refuses with\n * `llm_not_configured` instead of calling an unintended endpoint.\n */\nexport function resolveCliProviderRoute(\n env: NodeJS.ProcessEnv = process.env,\n): CliProviderRoute | undefined {\n const explicitBaseUrl = nonEmpty(env.AGENT_EVAL_LLM_BASE_URL)\n const explicitApiKey = nonEmpty(env.AGENT_EVAL_LLM_API_KEY)\n const openAiApiKey = nonEmpty(env.OPENAI_API_KEY)\n const tangleApiKey = nonEmpty(env.TANGLE_API_KEY)\n const baseUrl =\n explicitBaseUrl ??\n nonEmpty(env.OPENAI_BASE_URL) ??\n nonEmpty(env.TANGLE_ROUTER_URL) ??\n (openAiApiKey ? 'https://api.openai.com/v1' : undefined) ??\n (tangleApiKey ? 'https://router.tangle.tools/v1' : undefined)\n const apiKey = explicitApiKey ?? openAiApiKey ?? tangleApiKey\n const model =\n nonEmpty(env.AGENT_EVAL_LLM_MODEL) ?? nonEmpty(env.OPENAI_MODEL) ?? nonEmpty(env.TANGLE_MODEL)\n\n if (!baseUrl || !apiKey) return undefined\n return { baseUrl, apiKey, ...(model ? { model } : {}) }\n}\n\nexport function resolveCliLlmConfig(env: NodeJS.ProcessEnv = process.env): CliLlmConfig {\n const route = resolveCliProviderRoute(env)\n if (!route) return {}\n return {\n chat: cliChatClient({ baseUrl: route.baseUrl, apiKey: route.apiKey }, route.model),\n ...(route.model ? { model: route.model } : {}),\n }\n}\n\n/**\n * The binary's transport IS the published one — `createChatClient({ transport:\n * 'openai-compatible' })` — so the server and a library consumer cannot drift\n * onto two different clients for the same endpoint.\n *\n * The one thing kept local is the error text. A generic \"no model on the\n * request\" tells a server operator nothing; this names the variable to set.\n */\nfunction cliChatClient(\n route: { baseUrl: string; apiKey: string },\n defaultModel: string | undefined,\n): ChatClient {\n const client = createChatClient({\n transport: 'openai-compatible',\n baseUrl: route.baseUrl,\n apiKey: route.apiKey,\n ...(defaultModel ? { defaultModel } : {}),\n })\n return {\n ...client,\n chat: (req, callOpts) => {\n if (!req.model && !defaultModel) {\n throw new Error(\n 'agent-eval: no model on the request and no AGENT_EVAL_LLM_MODEL configured',\n )\n }\n return client.chat(req, callOpts)\n },\n }\n}\n\nfunction nonEmpty(value: string | undefined): string | undefined {\n const trimmed = value?.trim()\n return trimmed ? trimmed : undefined\n}\n","/**\n * `agent-eval search <subcommand>`: work with a search ledger from a terminal.\n *\n * agent-eval search ship <search-ledger.jsonl> --run-kind optimization|eval [--content full|digests]\n *\n * `ship` sends the ledger to the hosted store named by `TANGLE_INGEST_URL`,\n * `TANGLE_INGEST_API_KEY` and `TANGLE_TENANT_ID`, starting from the store's\n * head, so it finishes or resumes a ship that a loop could not complete.\n */\n\nimport { open } from 'node:fs/promises'\nimport { hostedTenantFromEnv } from './hosted/client'\nimport { SEARCH_LEDGER_BATCH_MAX_BYTES, SearchRunKindSchema } from './hosted/search-ledger-wire'\nimport { SearchShipConflictError, shipSearchLedger } from './hosted/search-shipper'\n\nconst USAGE = `usage: agent-eval search ship <search-ledger.jsonl> --run-kind optimization|eval [--content full|digests]\n\nShips the ledger's entries, and the blobs they name, to the hosted store in\nTANGLE_INGEST_URL (or TANGLE_ORCHESTRATOR_URL) as tenant TANGLE_TENANT_ID with\nTANGLE_INGEST_API_KEY (or TANGLE_API_KEY). It starts from the store's head, so\nrunning it again sends only what the store lacks. Prints the result as JSON.\nExits 1 when the store holds a different chain for the search.`\n\nexport async function runSearchCommand(argv: string[]): Promise<number> {\n const [subcommand, ...rest] = argv\n if ([subcommand, ...rest].some((arg) => arg === undefined || arg === '--help' || arg === '-h')) {\n process.stdout.write(`${USAGE}\\n`)\n return 0\n }\n if (subcommand !== 'ship') {\n process.stderr.write(`unknown search subcommand: ${subcommand}\\n${USAGE}\\n`)\n return 1\n }\n const { path, flags } = parseShipArgs(rest)\n const runKind = SearchRunKindSchema.safeParse(flags['run-kind'])\n if (!runKind.success) throw new Error(`--run-kind must be optimization or eval\\n${USAGE}`)\n const content = flags.content ?? 'full'\n if (content !== 'full' && content !== 'digests') {\n throw new Error(`--content must be full or digests\\n${USAGE}`)\n }\n const tenant = hostedTenantFromEnv()\n if (!tenant) {\n throw new Error(\n 'set TANGLE_INGEST_URL, TANGLE_INGEST_API_KEY and TANGLE_TENANT_ID to name the store',\n )\n }\n const searchId = await firstLineSearchId(path)\n try {\n const shipped = await shipSearchLedger({\n tenant,\n ledger: { path, searchId },\n runKind: runKind.data,\n content,\n })\n process.stdout.write(`${JSON.stringify(shipped, null, 2)}\\n`)\n return shipped.head.nextSequence === shipped.localLines ? 0 : 1\n } catch (error) {\n if (!(error instanceof SearchShipConflictError)) throw error\n process.stderr.write(`${error.message}\\n`)\n return 1\n }\n}\n\nfunction parseShipArgs(argv: string[]): { path: string; flags: Record<string, string> } {\n const flags: Record<string, string> = {}\n const positional: string[] = []\n for (let index = 0; index < argv.length; index++) {\n const token = argv[index]!\n if (!token.startsWith('--')) {\n positional.push(token)\n continue\n }\n const [name, inline] = token.slice(2).split('=', 2) as [string, string | undefined]\n if (name !== 'run-kind' && name !== 'content') throw new Error(`unknown flag --${name}`)\n const value = inline ?? argv[++index]\n if (value === undefined) throw new Error(`--${name} needs a value`)\n flags[name] = value\n }\n if (positional.length !== 1) throw new Error(USAGE)\n return { path: positional[0]!, flags }\n}\n\n/** The ledger names its search on every line; read the first. */\nasync function firstLineSearchId(path: string): Promise<string> {\n const handle = await open(path, 'r')\n try {\n // A line longer than one request's limit cannot ship anyway.\n const bytes = Buffer.alloc(SEARCH_LEDGER_BATCH_MAX_BYTES + 1)\n const { bytesRead } = await handle.read(bytes, 0, bytes.byteLength, 0)\n const newline = bytes.subarray(0, bytesRead).indexOf(0x0a)\n if (newline < 0) throw new Error(`${path} holds no complete ledger line`)\n const first = JSON.parse(bytes.toString('utf8', 0, newline)) as { searchId?: unknown }\n if (typeof first.searchId !== 'string') throw new Error(`${path} line 1 names no searchId`)\n return first.searchId\n } finally {\n await handle.close()\n }\n}\n","#!/usr/bin/env node\n/**\n * agent-eval CLI.\n *\n * agent-eval serve [--port 5005] [--host 127.0.0.1]\n * agent-eval rpc <method> # one request from stdin → one response on stdout\n * agent-eval rpc-batch <method> # JSONL stdin → JSONL stdout\n * agent-eval analyst-benchmark ... # benchmark a real-model trace analyst\n * agent-eval supervisor-run report <runDir> [--format headline|markdown|json]\n * agent-eval search ship <search-ledger.jsonl> --run-kind optimization|eval\n * agent-eval openapi [--out path] # write OpenAPI spec\n * agent-eval version\n *\n * <method> is one of: judge, listRubrics, version. When omitted, the\n * stdin payload must be a full {method, params} envelope.\n */\nimport { writeFileSync } from 'node:fs'\nimport { runAnalystBenchmarkCommand } from './analyst/benchmark-command'\nimport { resolveCliLlmConfig } from './cli-config'\nimport { runRolloutReleaseCli } from './rollout/release/hf-dataset'\nimport { runSearchCommand } from './search-command'\nimport { runSupervisorRunCommand } from './supervisor-run/report-command'\nimport { handleVersion } from './wire/handlers'\nimport { buildOpenApi } from './wire/openapi'\nimport { runRpcBatch, runRpcOnce } from './wire/rpc'\nimport { startServerAsync } from './wire/server'\n\ninterface Args {\n command: string\n positional: string[]\n flags: Record<string, string>\n}\n\nfunction parseArgs(argv: string[]): Args {\n const [command, ...rest] = argv\n const positional: string[] = []\n const flags: Record<string, string> = {}\n for (let i = 0; i < rest.length; i++) {\n const tok = rest[i]!\n if (tok.startsWith('--')) {\n const raw = tok.slice(2)\n const equalsAt = raw.indexOf('=')\n if (equalsAt >= 0) {\n flags[raw.slice(0, equalsAt)] = raw.slice(equalsAt + 1)\n continue\n }\n const key = raw\n if (key === 'help') {\n flags[key] = 'true'\n continue\n }\n const next = rest[i + 1]\n if (next != null && !next.startsWith('--')) {\n flags[key] = next\n i++\n } else {\n flags[key] = 'true'\n }\n } else if (tok === '-h') {\n flags.help = 'true'\n } else {\n positional.push(tok)\n }\n }\n return { command: command ?? 'help', positional, flags }\n}\n\nconst HELP = `agent-eval: evaluation RPC and HTTP server.\n\nCommands:\n serve [--port 5005] [--host 127.0.0.1]\n Start the HTTP server. POST /v1/judge, GET /v1/rubrics, GET /v1/version, GET /openapi.json.\n rpc <method>\n Read one JSON object from stdin (the params for <method>), write one\n JSON object to stdout. Methods: judge, listRubrics, version.\n rpc-batch <method>\n Like 'rpc' but JSONL in / JSONL out.\n openapi [--out openapi.json]\n Write the OpenAPI 3.1 spec.\n rollout-release <ledger.jsonl...> --out <dir> [--formats sft,verifiers,rft,raw] [--include-proposers] [--push <org/name>]\n Build a HuggingFace-ready dataset dir from tangle.rollout.v1 ledgers:\n validate, fail-closed split filter, scrub, export formats + card.\n analyst-benchmark --dataset <agentrx|codetracebench> --labels <path> --trace-dir <path> [--artifact-dir <path>] --out <dir> ...\n Compare an empty baseline with a real-model trace analyst on public labels.\n Run with --help for all required inputs and controls.\n supervisor-run report <runDir> [--format headline|markdown|json]\n Report one Runtime or loops supervisor run directory. The status comes\n from Runtime's own result.json / failure.json; every missing measurement\n stays named. Exits 1 when the directory cannot be read.\n search ship <search-ledger.jsonl> --run-kind optimization|eval [--content full|digests]\n Ship a search ledger and its blobs to the hosted store in TANGLE_INGEST_URL,\n starting from the store's head. Run with --help for the environment it reads.\n version\n Print server + wire-protocol version JSON.\n\nJudge provider:\n Set AGENT_EVAL_LLM_BASE_URL, AGENT_EVAL_LLM_API_KEY, and AGENT_EVAL_LLM_MODEL.\n OPENAI_* and TANGLE_* equivalents are also accepted. This binary is the only\n place that reads a provider credential; the library never does. Without both\n a base URL and a key, /v1/judge refuses with llm_not_configured.\n\nWithout arguments, prints this help.`\n\nasync function main(): Promise<number> {\n const { command, positional, flags } = parseArgs(process.argv.slice(2))\n assertKnownFlags(command, flags)\n\n if (command === 'analyst-benchmark' && flags.help === 'true') {\n return await runAnalystBenchmarkCommand(process.argv.slice(3))\n }\n if (command === 'search') return await runSearchCommand(process.argv.slice(3))\n if (flags.help === 'true') {\n process.stdout.write(`${HELP}\\n`)\n return 0\n }\n\n switch (command) {\n case 'serve': {\n const port = parsePort(flags.port ?? '5005')\n const host = flags.host ?? '127.0.0.1'\n const llm = resolveCliLlmConfig()\n const { server } = await startServerAsync({\n port,\n host,\n ...(llm.chat ? { chat: llm.chat } : {}),\n ...(llm.model ? { judgeModel: llm.model } : {}),\n })\n // Keep process alive on SIGINT/SIGTERM\n const shutdown = (sig: string) => {\n // eslint-disable-next-line no-console\n console.log(`[agent-eval] received ${sig}, shutting down`)\n server.close(() => process.exit(0))\n // Force exit after 5s if close hangs\n setTimeout(() => process.exit(1), 5000).unref()\n }\n process.on('SIGINT', () => shutdown('SIGINT'))\n process.on('SIGTERM', () => shutdown('SIGTERM'))\n // Block forever\n await new Promise(() => {})\n return 0\n }\n case 'rpc': {\n const [method] = positional\n const llm = resolveCliLlmConfig()\n return await runRpcOnce(method, {\n ...(llm.chat ? { chat: llm.chat } : {}),\n ...(llm.model ? { judgeModel: llm.model } : {}),\n })\n }\n case 'rpc-batch': {\n const [method] = positional\n const llm = resolveCliLlmConfig()\n return await runRpcBatch(method, {\n ...(llm.chat ? { chat: llm.chat } : {}),\n ...(llm.model ? { judgeModel: llm.model } : {}),\n })\n }\n case 'openapi': {\n const out = flags.out ?? 'openapi.json'\n const spec = buildOpenApi(handleVersion().version)\n writeFileSync(out, `${JSON.stringify(spec, null, 2)}\\n`, 'utf-8')\n // eslint-disable-next-line no-console\n console.log(`[agent-eval] wrote OpenAPI 3.1 spec to ${out}`)\n return 0\n }\n case 'rollout-release': {\n // The subcommand owns its own flag grammar (multi-value --formats,\n // boolean --include-proposers) — pass raw argv through untouched.\n return await runRolloutReleaseCli(process.argv.slice(3))\n }\n case 'analyst-benchmark': {\n return await runAnalystBenchmarkCommand(process.argv.slice(3))\n }\n case 'supervisor-run': {\n // The subcommand owns its own flag grammar; pass raw argv through.\n return await runSupervisorRunCommand(process.argv.slice(3))\n }\n case 'version': {\n process.stdout.write(`${JSON.stringify(handleVersion(), null, 2)}\\n`)\n return 0\n }\n case '--version': {\n process.stdout.write(`${handleVersion().version}\\n`)\n return 0\n }\n case 'help':\n case '--help':\n case '-h':\n case '':\n process.stdout.write(`${HELP}\\n`)\n return 0\n default:\n process.stderr.write(`unknown command: ${command}\\n${HELP}\\n`)\n return 1\n }\n}\n\nconst FLAGS_BY_COMMAND: Record<string, ReadonlySet<string>> = {\n serve: new Set(['help', 'host', 'port']),\n rpc: new Set(['help']),\n 'rpc-batch': new Set(['help']),\n openapi: new Set(['help', 'out']),\n version: new Set(['help']),\n help: new Set(),\n '--help': new Set(),\n '-h': new Set(),\n '--version': new Set(),\n '': new Set(),\n}\n\nfunction assertKnownFlags(command: string, flags: Record<string, string>): void {\n // These subcommands parse their own argv.\n if (\n command === 'rollout-release' ||\n command === 'analyst-benchmark' ||\n command === 'supervisor-run' ||\n command === 'search'\n ) {\n return\n }\n const allowed = FLAGS_BY_COMMAND[command]\n if (!allowed) return\n const unknown = Object.keys(flags).filter((flag) => !allowed.has(flag))\n if (unknown.length > 0) {\n throw new Error(`unknown flag for ${command || 'help'}: --${unknown[0]}`)\n }\n}\n\nfunction parsePort(raw: string): number {\n const port = Number(raw)\n if (!Number.isInteger(port) || port < 0 || port > 65_535) {\n throw new Error(`--port must be an integer from 0 to 65535; received ${JSON.stringify(raw)}`)\n }\n return port\n}\n\nmain()\n .then((code) => process.exit(code))\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error('[agent-eval] cli error:', err)\n process.exit(1)\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,wBACd,MAAyB,QAAQ,KACH;CAC9B,MAAM,kBAAkB,SAAS,IAAI,uBAAuB;CAC5D,MAAM,iBAAiB,SAAS,IAAI,sBAAsB;CAC1D,MAAM,eAAe,SAAS,IAAI,cAAc;CAChD,MAAM,eAAe,SAAS,IAAI,cAAc;CAChD,MAAM,UACJ,mBACA,SAAS,IAAI,eAAe,KAC5B,SAAS,IAAI,iBAAiB,MAC7B,eAAe,8BAA8B,KAAA,OAC7C,eAAe,mCAAmC,KAAA;CACrD,MAAM,SAAS,kBAAkB,gB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AC;AAChB,CAAC"}
@@ -0,0 +1,236 @@
1
+ import { D as SearchLedgerHash, E as SearchLedgerEvent, T as SearchLedgerEntry, i as SearchArtifactRef } from "./search-ledger-types-C9anU2DX.js";
2
+ import { z } from "zod";
3
+ //#region src/hosted/search-ledger-wire.d.ts
4
+ /** At most this many lines in one ingest request. */
5
+ declare const SEARCH_LEDGER_BATCH_MAX_LINES = 1000;
6
+ /** At most this many UTF-8 bytes across one request's lines. A single line
7
+ * larger than this cannot be shipped. */
8
+ declare const SEARCH_LEDGER_BATCH_MAX_BYTES = 1048576;
9
+ declare const SEARCH_LEDGER_INGEST_PATH = "/v1/ingest/search-ledger";
10
+ declare function searchLedgerHeadPath(searchId: string): string;
11
+ /** Blobs are addressed by the hex digest alone. */
12
+ declare function searchBlobPath(sha256: SearchLedgerHash): string;
13
+ /** What the run is for: an optimization, or an eval (a one-node search). */
14
+ declare const SearchRunKindSchema: z.ZodEnum<{
15
+ eval: "eval";
16
+ optimization: "optimization";
17
+ }>;
18
+ type SearchRunKind = z.infer<typeof SearchRunKindSchema>;
19
+ /** Where a store's copy of one search's chain ends. `headHash` is null exactly
20
+ * when the store holds no entry. */
21
+ declare const SearchLedgerHeadSchema: z.ZodObject<{
22
+ searchId: z.ZodString;
23
+ nextSequence: z.ZodNumber;
24
+ headHash: z.ZodNullable<z.ZodCustom<`sha256:${string}`, `sha256:${string}`>>;
25
+ }, z.core.$strict>;
26
+ type SearchLedgerHead = z.infer<typeof SearchLedgerHeadSchema>;
27
+ declare const IngestSearchLedgerRequestSchema: z.ZodObject<{
28
+ wireVersion: z.ZodLiteral<"2026-07-24.v1">;
29
+ searchId: z.ZodString;
30
+ runKind: z.ZodEnum<{
31
+ eval: "eval";
32
+ optimization: "optimization";
33
+ }>;
34
+ fromSequence: z.ZodNumber;
35
+ lines: z.ZodArray<z.ZodString>;
36
+ }, z.core.$strict>;
37
+ type IngestSearchLedgerRequest = z.infer<typeof IngestSearchLedgerRequestSchema>;
38
+ /** The body of a `409`: a fork or a gap, with the store's head. */
39
+ declare const SearchLedgerConflictSchema: z.ZodObject<{
40
+ error: z.ZodEnum<{
41
+ chain_conflict: "chain_conflict";
42
+ sequence_gap: "sequence_gap";
43
+ }>;
44
+ message: z.ZodString;
45
+ head: z.ZodObject<{
46
+ searchId: z.ZodString;
47
+ nextSequence: z.ZodNumber;
48
+ headHash: z.ZodNullable<z.ZodCustom<`sha256:${string}`, `sha256:${string}`>>;
49
+ }, z.core.$strict>;
50
+ }, z.core.$strict>;
51
+ type SearchLedgerConflict = z.infer<typeof SearchLedgerConflictSchema>;
52
+ /** What a store kept of one blob. `masked` and `withheld` come from the
53
+ * store's own redaction scan or the tenant's content posture. */
54
+ declare const SearchBlobPutResponseSchema: z.ZodObject<{
55
+ sha256: z.ZodCustom<`sha256:${string}`, `sha256:${string}`>;
56
+ byteLength: z.ZodNumber;
57
+ state: z.ZodEnum<{
58
+ masked: "masked";
59
+ stored: "stored";
60
+ withheld: "withheld";
61
+ }>;
62
+ }, z.core.$strict>;
63
+ type SearchBlobPutResponse = z.infer<typeof SearchBlobPutResponseSchema>;
64
+ /** Every blob an event names, once each. Ship these before the event. */
65
+ declare function searchLedgerArtifactRefs(event: SearchLedgerEvent): SearchArtifactRef[];
66
+ type SearchLedgerBatchAdmission = {
67
+ status: 'accepted';
68
+ /** Entries past the stored head, in order, with their exact lines. */
69
+ entries: SearchLedgerEntry[];
70
+ lines: string[];
71
+ /** The head after storing `entries`. */
72
+ head: SearchLedgerHead;
73
+ } | {
74
+ status: 'conflict';
75
+ conflict: SearchLedgerConflict;
76
+ };
77
+ interface AdmitSearchLedgerBatchInput {
78
+ request: IngestSearchLedgerRequest;
79
+ /** The store's head for `request.searchId` before this batch. */
80
+ head: SearchLedgerHead;
81
+ /** The stored hash at a sequence below the head. */
82
+ storedEntryHash(sequence: number): SearchLedgerHash | undefined;
83
+ }
84
+ /**
85
+ * Apply the wire's chain rule to one batch. Each line is verified in isolation
86
+ * (`parseSearchLedgerLine`) and linked to the stored head. A malformed line
87
+ * throws `SearchLedgerIntegrityError`, which a store answers with 422; the
88
+ * state machine (`SearchState`) runs after admission, on `entries`.
89
+ */
90
+ declare function admitSearchLedgerBatch(input: AdmitSearchLedgerBatchInput): SearchLedgerBatchAdmission;
91
+ //#endregion
92
+ //#region src/hosted/types.d.ts
93
+ /**
94
+ * # Hosted-tier wire format: the shapes every orchestrator (ours, a partner's
95
+ * self-hosted one, a future open implementation) must accept.
96
+ *
97
+ * This package implements exactly one wire version. Servers reject every
98
+ * other version instead of translating old payloads.
99
+ *
100
+ * The wire carries two streams in one transport:
101
+ *
102
+ * 1. **Search ledgers** (`/v1/search-blobs/*`, `/v1/ingest/search-ledger`).
103
+ * A producer ships a search's hash-chained ledger lines and the blobs
104
+ * they name; `./search-ledger-wire.ts` owns those shapes.
105
+ *
106
+ * 2. **Trace spans** (`POST /v1/ingest/traces`). Standard OTLP-shaped
107
+ * spans with a few additional attributes so the orchestrator can
108
+ * pivot from a search cell to its underlying execution. Compatible
109
+ * with any OTel collector.
110
+ *
111
+ * Every endpoint is authenticated with a bearer token and a tenant id
112
+ * header. Tenants isolate everything downstream of ingest; no tenant
113
+ * ever sees another tenant's data.
114
+ */
115
+ declare const HOSTED_WIRE_VERSION: '2026-07-24.v1';
116
+ type HostedWireVersion = typeof HOSTED_WIRE_VERSION;
117
+ /** Every ingest request carries these. */
118
+ interface HostedIngestHeaders {
119
+ /** Bearer token. The orchestrator validates against the tenant key. */
120
+ authorization: `Bearer ${string}`;
121
+ /** Stable tenant id (the orchestrator-side primary key for the tenant). */
122
+ 'x-tangle-tenant-id': string;
123
+ /** Wire-version pin so the server can reject incompatible payloads. */
124
+ 'x-tangle-wire-version': HostedWireVersion;
125
+ /** Stable request key generated once and reused across retries. */
126
+ 'idempotency-key': string;
127
+ }
128
+ /**
129
+ * Canonical unsigned 64-bit integer encoded as a base-10 string.
130
+ * JSON numbers cannot represent OTLP nanosecond timestamps exactly.
131
+ */
132
+ type UnixNanoTimestamp = string;
133
+ /**
134
+ * OTel-shape span with a few additional attributes for pivoting.
135
+ * Compatible with any OTLP collector — `name`, `traceId`, `spanId`,
136
+ * `startTimeUnixNano`, `endTimeUnixNano`, `attributes` are stock OTel.
137
+ */
138
+ interface TraceSpanEvent {
139
+ traceId: string;
140
+ spanId: string;
141
+ parentSpanId?: string;
142
+ name: string;
143
+ startTimeUnixNano: UnixNanoTimestamp;
144
+ endTimeUnixNano: UnixNanoTimestamp;
145
+ attributes: Record<string, string | number | boolean>;
146
+ events?: Array<{
147
+ timeUnixNano: UnixNanoTimestamp;
148
+ name: string;
149
+ attributes?: Record<string, string | number | boolean>;
150
+ }>;
151
+ status?: {
152
+ code: 'OK' | 'ERROR' | 'UNSET';
153
+ message?: string;
154
+ };
155
+ /** Pivot to the producing run. */
156
+ 'tangle.runId'?: string;
157
+ /** Pivot to the specific generation. */
158
+ 'tangle.generation'?: number;
159
+ /** Pivot to the specific cell. */
160
+ 'tangle.cellId'?: string;
161
+ /** Pivot to the specific scenario. */
162
+ 'tangle.scenarioId'?: string;
163
+ }
164
+ interface IngestTracesRequest {
165
+ wireVersion: HostedWireVersion;
166
+ spans: TraceSpanEvent[];
167
+ }
168
+ interface IngestResponse {
169
+ /** Accepted spans count. */
170
+ accepted: number;
171
+ /** Rejected spans with reasons (validation failures, conflicting identity). */
172
+ rejected: Array<{
173
+ index: number;
174
+ reason: string;
175
+ }>;
176
+ }
177
+ //#endregion
178
+ //#region src/hosted/client.d.ts
179
+ interface HostedTenant {
180
+ /** Orchestrator endpoint base URL (no trailing slash). Required. */
181
+ endpoint: string;
182
+ /** Bearer token issued by the orchestrator. Required. */
183
+ apiKey: string;
184
+ /** Tenant id — the orchestrator's primary key for this consumer. Required. */
185
+ tenantId: string;
186
+ /** Optional `fetch` override (auth wrappers, custom agent). */
187
+ fetchImpl?: typeof fetch;
188
+ /** Per-attempt timeout in ms. Default 30s. */
189
+ timeoutMs?: number;
190
+ /** Retries on network errors, 408, 429 and 5xx. Default 2. */
191
+ retries?: number;
192
+ }
193
+ /** A search-ledger batch the store accepted, or the fork or gap it refused. */
194
+ type SearchLedgerIngestOutcome = {
195
+ status: 'accepted';
196
+ head: SearchLedgerHead;
197
+ } | {
198
+ status: 'conflict';
199
+ conflict: SearchLedgerConflict;
200
+ };
201
+ interface HostedClient {
202
+ ingestTraces(spans: TraceSpanEvent[], idempotencyKey?: string): Promise<IngestResponse>;
203
+ /** The store's head for one search; `nextSequence` 0 when it holds nothing. */
204
+ searchLedgerHead(searchId: string, signal?: AbortSignal): Promise<SearchLedgerHead>;
205
+ ingestSearchLedger(request: IngestSearchLedgerRequest, signal?: AbortSignal): Promise<SearchLedgerIngestOutcome>;
206
+ putSearchBlob(sha256: `sha256:${string}`, bytes: Uint8Array<ArrayBuffer>, contentType: string, signal?: AbortSignal): Promise<SearchBlobPutResponse>;
207
+ readonly tenant: HostedTenant;
208
+ readonly wireVersion: HostedWireVersion;
209
+ }
210
+ /** A request the server refused, after any retries. */
211
+ declare class HostedRequestError extends Error {
212
+ readonly status: number;
213
+ readonly body: string;
214
+ constructor(url: string, status: number, body: string);
215
+ }
216
+ declare function createHostedClient(tenant: HostedTenant): HostedClient;
217
+ /**
218
+ * Build a {@link HostedTenant} from env, or `undefined` when ingest is not
219
+ * configured, so a product wires it unconditionally and it stays off until the
220
+ * env is set. Env precedence:
221
+ * - endpoint: `TANGLE_INGEST_URL` → `TANGLE_ORCHESTRATOR_URL`
222
+ * - apiKey: `TANGLE_INGEST_API_KEY` → `TANGLE_API_KEY`
223
+ * - tenantId: `TANGLE_TENANT_ID`
224
+ * A trailing slash on the endpoint is stripped. `overrides` win over env.
225
+ */
226
+ declare function hostedTenantFromEnv(overrides?: Partial<HostedTenant> & {
227
+ env?: Record<string, string | undefined>;
228
+ }): HostedTenant | undefined;
229
+ /** {@link createHostedClient} over {@link hostedTenantFromEnv}; `undefined`
230
+ * when ingest is not configured. */
231
+ declare function hostedClientFromEnv(overrides?: Partial<HostedTenant> & {
232
+ env?: Record<string, string | undefined>;
233
+ }): HostedClient | undefined;
234
+ //#endregion
235
+ export { admitSearchLedgerBatch as A, SearchLedgerBatchAdmission as C, SearchLedgerHeadSchema as D, SearchLedgerHead as E, searchLedgerArtifactRefs as M, searchLedgerHeadPath as N, SearchRunKind as O, SearchBlobPutResponseSchema as S, SearchLedgerConflictSchema as T, IngestSearchLedgerRequestSchema as _, createHostedClient as a, SEARCH_LEDGER_INGEST_PATH as b, HOSTED_WIRE_VERSION as c, IngestResponse as d, IngestTracesRequest as f, IngestSearchLedgerRequest as g, AdmitSearchLedgerBatchInput as h, SearchLedgerIngestOutcome as i, searchBlobPath as j, SearchRunKindSchema as k, HostedIngestHeaders as l, UnixNanoTimestamp as m, HostedRequestError as n, hostedClientFromEnv as o, TraceSpanEvent as p, HostedTenant as r, hostedTenantFromEnv as s, HostedClient as t, HostedWireVersion as u, SEARCH_LEDGER_BATCH_MAX_BYTES as v, SearchLedgerConflict as w, SearchBlobPutResponse as x, SEARCH_LEDGER_BATCH_MAX_LINES as y };
236
+ //# sourceMappingURL=client-wFyDisxi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-wFyDisxi.d.ts","names":[],"sources":["../src/hosted/search-ledger-wire.ts","../src/hosted/types.ts","../src/hosted/client.ts"],"mappings":";;;;cAkCa;;;cAGA;cAEA;iBAEG,qBAAqB;;iBAKrB,eAAe,QAAQ;;cAe1B,qBAAmB,EAAA;;;;KACpB,gBAAgB,EAAE,aAAa;;;cAI9B,wBAAsB,EAAA;;;;GAM/B,EAAA,KAAA;KACQ,mBAAmB,EAAE,aAAa;cAEjC,iCAA+B,EAAA;;;;;;;;;GAkBxC,EAAA,KAAA;KACQ,4BAA4B,EAAE,aAAa;;cAG1C,4BAA0B,EAAA;;;;;;;;;;;GAM5B,EAAA,KAAA;KACC,uBAAuB,EAAE,aAAa;;;cAIrC,6BAA2B,EAAA;;;;;;;;GAM7B,EAAA,KAAA;KACC,wBAAwB,EAAE,aAAa;;iBAWnC,yBAAyB,OAAO,oBAAoB;KAoBxD;EAEN;;EAEA,SAAS;EACT;;EAEA,MAAM;;EAEN;EAAoB,UAAU;;UAEnB;EACf,SAAS;;EAET,MAAM;;EAEN,gBAAgB,mBAAmB;;;;;;;;iBASrB,uBACd,OAAO,8BACN;;;;;;;;;;;;;;;;;;;;;;;;;cCtJU;KACD,2BAA2B;;UAKtB;;EAEf;;EAEA;;EAEA,yBAAyB;;EAEzB;;;;;;KASU;;;;;;UAOK;EACf;EACA;EACA;EACA;EACA,mBAAmB;EACnB,iBAAiB;EACjB,YAAY;EACZ,SAAS;IACP,cAAc;IACd;IACA,aAAa;;EAEf;IAAW;IAAgC;;;EAE3C;;EAEA;;EAEA;;EAEA;;UAKe;EACf,aAAa;EACb,OAAO;;UAGQ;;EAEf;;EAEA,UAAU;IAAQ;IAAe;;;;;UC7ClB;;EAEf;;EAEA;;EAEA;;EAEA,mBAAmB;;EAEnB;;EAEA;;;KAIU;EACN;EAAoB,MAAM;;EAC1B;EAAoB,UAAU;;UAEnB;EACf,aAAa,OAAO,kBAAkB,0BAA0B,QAAQ;;EAExE,iBAAiB,kBAAkB,SAAS,cAAc,QAAQ;EAClE,mBACE,SAAS,2BACT,SAAS,cACR,QAAQ;EACX,cACE,4BACA,OAAO,WAAW,cAClB,qBACA,SAAS,cACR,QAAQ;WACF,QAAQ;WACR,aAAa;;;cAIX,2BAA2B;WAC7B;WACA;EACT,YAAY,aAAa,gBAAgB;;iBAuI3B,mBAAmB,QAAQ,eAAe;;;;;;;;;;iBAqG1C,oBACd,YAAW,QAAQ;EAAkB,MAAM;IAC1C;;;iBAmBa,oBACd,YAAW,QAAQ;EAAkB,MAAM;IAC1C"}
@@ -1,14 +1,13 @@
1
1
  import { c as CostLedgerHandle } from "../cost-ledger-DbQdN3nO.js";
2
- import { _ as ProposalFinding, i as AnalystFinding, v as ProposalFindingOrigin, x as makeProposalFinding } from "../types-Bay1dh2o.js";
2
+ import { _ as ProposalFinding, i as AnalystFinding, v as ProposalFindingOrigin, x as makeProposalFinding } from "../types-CeDfCRXp.js";
3
3
  import { A as createChatClient, T as CreateChatClientOpts, x as ChatClient } from "../types-C0bWoSKC.js";
4
- import { $ as paretoSignificanceGate, G as BuildEvidenceVectorOptions, J as ParetoSignificanceGateOptions, K as EvidenceVector, Q as paretoPolicy, U as AxisEvidence, W as AxisVerdict, X as PromotionPolicy, Y as PromotionObjective, Z as buildEvidenceVector, q as ObjectiveSource } from "../statistical-heldout-CLpjYffJ.js";
5
- import { C as JudgeDimension, H as SurfaceProposer, M as OptimizerConfig, R as Scenario, S as JudgeConfig, V as SessionScript, _ as GateDecision, a as CampaignResult, b as GenerationRecord, c as CampaignTraceWriter, d as DispatchContext, f as DispatchFn, g as GateContribution, h as GateContext, i as CampaignCostMeter, j as MutableSurface, l as CodeSurface, m as GateCheckStatus, n as CampaignArtifactWriter, p as Gate, r as CampaignCellResult, t as CampaignAggregates, v as GateResult, w as JudgeScore, y as GenerationCandidate } from "../types-BvmWNjjs.js";
6
- import { $i as RunImprovementLoopOptions, $r as GepaOptimizationRecipe, Ao as inMemoryCampaignStorage, Bi as ReferenceEquivalenceJudgeInput, Ci as compareOptimizationMethods, Do as CampaignStorage, Dr as DefaultProductionGateOptions, Er as DefaultProductionGateCheck, Gi as runReferenceEquivalenceJudge, Gr as SkillOptOptimizationMethodConfig, Hi as ReferenceEquivalenceJudgeResult, Io as campaignSplitDigest, Ji as llmJudge, Jr as skillOptOptimizationMethod, Ki as LlmJudgeDimension, Kr as SkillOptRunnerCommand, Mo as FinalEvidenceUse, Or as DefaultProductionRewardHackingOptions, Qi as transientDispatchFailure, Qr as GepaOptimizationMethodConfig, Ri as REFERENCE_EQUIVALENCE_INPUT_LIMITS, Si as OptimizationTokenUsage, Ti as ComparisonCost, Tr as heldOutGate, Ui as ReferenceEquivalenceScenario, Vi as ReferenceEquivalenceJudgeOptions, Wi as createReferenceEquivalenceJudge, Wr as composeGate, Xr as GepaEngineOptions, Yr as GepaAdaptiveEngineRun, Zr as GepaEngineRun, _i as OptimizationMethodProvenance, ai as ExternalTextOptimizationMethodConfig, ci as ExternalOptimizationExample, di as CompareOptimizationMethodsOptions, do as RunEvalOptions, ea as RunImprovementLoopResult, ei as GepaRunnerCommand, fi as OptimizationMethod, fo as runEval, go as runCampaign, hi as OptimizationMethodInput, ho as RunCampaignOptions, ii as externalTextOptimizationMethod, jo as FinalEvidencePolicy, ko as fsCampaignStorage, kr as defaultProductionGate, li as ExternalTextEvaluationResponse, mo as CampaignCellRetryPolicy, ni as OpenAICompatibleOptimizerModel, oi as ExternalTextOptimizerContext, pi as OptimizationMethodComparison, po as CampaignCellFailureReceipt, qi as LlmJudgeOptions, qr as SkillOptTrainerConfig, ri as OptimizerModelBudget, si as ExternalTextOptimizerResult, ta as runImprovementLoop, ti as gepaOptimizationMethod, vi as OptimizationMethodResult, wr as HeldOutGateOptions, xi as OptimizationPackageSource, zi as REFERENCE_EQUIVALENCE_JUDGE_VERSION } from "../index-CJv56rhX.js";
4
+ import { $ as paretoSignificanceGate, G as BuildEvidenceVectorOptions, J as ParetoSignificanceGateOptions, K as EvidenceVector, Q as paretoPolicy, U as AxisEvidence, W as AxisVerdict, X as PromotionPolicy, Y as PromotionObjective, Z as buildEvidenceVector, q as ObjectiveSource } from "../statistical-heldout-C1Ej5Ce8.js";
5
+ import { C as JudgeDimension, H as SurfaceProposer, M as OptimizerConfig, R as Scenario, S as JudgeConfig, V as SessionScript, _ as GateDecision, a as CampaignResult, b as GenerationRecord, c as CampaignTraceWriter, d as DispatchContext, f as DispatchFn, g as GateContribution, h as GateContext, i as CampaignCostMeter, j as MutableSurface, l as CodeSurface, m as GateCheckStatus, n as CampaignArtifactWriter, p as Gate, r as CampaignCellResult, t as CampaignAggregates, v as GateResult, w as JudgeScore, y as GenerationCandidate } from "../types-C1CAD70_.js";
6
+ import { Ai as OptimizationMethod, Bi as OptimizationTokenUsage, Ci as ExternalTextOptimizationMethodConfig, Di as ExternalTextEvaluationResponse, Ei as ExternalOptimizationExample, Fi as OptimizationMethodProvenance, Fo as RunCampaignOptions, Gr as DefaultProductionGateOptions, Hr as HeldOutGateOptions, Ii as OptimizationMethodResult, Io as runCampaign, Kr as DefaultProductionRewardHackingOptions, Mo as runEval, Ni as OptimizationMethodInput, No as CampaignCellFailureReceipt, Po as CampaignCellRetryPolicy, Qo as FinalEvidenceUse, Si as externalTextOptimizationMethod, Ti as ExternalTextOptimizerResult, Ui as ComparisonCost, Ur as heldOutGate, Vi as compareOptimizationMethods, Wr as DefaultProductionGateCheck, Xo as inMemoryCampaignStorage, Yo as fsCampaignStorage, Zo as FinalEvidencePolicy, _a as RunImprovementLoopOptions, _i as GepaOptimizationRecipe, aa as ReferenceEquivalenceJudgeOptions, bi as OpenAICompatibleOptimizerModel, ca as createReferenceEquivalenceJudge, ci as composeGate, da as LlmJudgeOptions, di as SkillOptTrainerConfig, fa as llmJudge, fi as skillOptOptimizationMethod, ga as transientDispatchFailure, gi as GepaOptimizationMethodConfig, hi as GepaEngineRun, ia as ReferenceEquivalenceJudgeInput, ji as OptimizationMethodComparison, jo as RunEvalOptions, ki as CompareOptimizationMethodsOptions, la as runReferenceEquivalenceJudge, li as SkillOptOptimizationMethodConfig, mi as GepaEngineOptions, na as REFERENCE_EQUIVALENCE_INPUT_LIMITS, ns as campaignSplitDigest, oa as ReferenceEquivalenceJudgeResult, pi as GepaAdaptiveEngineRun, qo as CampaignStorage, qr as defaultProductionGate, ra as REFERENCE_EQUIVALENCE_JUDGE_VERSION, sa as ReferenceEquivalenceScenario, ua as LlmJudgeDimension, ui as SkillOptRunnerCommand, va as RunImprovementLoopResult, vi as GepaRunnerCommand, wi as ExternalTextOptimizerContext, xi as OptimizerModelBudget, ya as runImprovementLoop, yi as gepaOptimizationMethod, zi as OptimizationPackageSource } from "../index-DwQxdWve.js";
7
7
  import { i as InMemoryOutcomeStore, n as FileSystemOutcomeStore, o as OutcomeStore, r as FileSystemOutcomeStoreOptions, t as DeploymentOutcome } from "../outcome-store-CNt4iZ67.js";
8
- import { a as FailureClusterInsight, c as JudgeInsight, d as Recommendation, f as ReleaseSummary, i as FailureClassTally, l as LiftInsight, m as TokenUsageInsight, n as ExecutionErrorOutcomeCell, o as InsightReport, p as ScalarDistribution, r as ExecutionInsight, s as InterRaterInsight, t as CostProvenanceSummary, u as OutcomeCorrelationInsight } from "../insight-report-CvPkEIcC.js";
9
- import { n as HostedTenant } from "../client-BhEyAdfe.js";
10
- import { _ as SelfImproveMethodResult, a as DefinedAgentEval, c as SelfImproveMethodOptions, d as SelfImproveProposerOptions, f as SelfImproveProposerResult, g as SelfImproveMethodProvenance, h as selfImprove, i as DefineAgentEvalOptions, l as SelfImproveOptions, m as SelfImproveRunError, n as AgentEvalEvaluateOptions, o as defineAgentEval, p as SelfImproveResult, r as AgentEvalImproveOptions, s as SelfImproveBudget, t as AgentEvalAgent, u as SelfImproveProgressEvent } from "../define-agent-eval-DblGedQk.js";
11
- import { $ as diffRunBaselineToWinner, A as CodeAgentSessionActionStatus, At as measuredComparisonFromCandidateExperiment, B as AgentTraceFile, C as fromOpenCodeSession, Ct as EvaluatePairedMeasurementsOptions, D as streamCodeAgentJsonlFile, Dt as RunCandidateExperimentOptions, E as parseCodeAgentJsonlFile, Et as PairedMeasurementEvaluation, F as CodeAgentSessionTerminalStatus, Ft as verifyCandidateExperiment, G as PartitionByAuthoringModelResult, H as AgentTraceRange, I as observeCodeAgentSession, It as verifyCandidateExperimentComparison, J as EvalCellScoreDelta, K as parseAgentTrace, L as AgentTraceContributor, M as CodeAgentSessionExecutionReceipt, Mt as sealCandidateBenchmarkSuite, N as CodeAgentSessionObservation, Nt as sealCandidateBenchmarkTask, O as CodeAgentSessionAction, Ot as SealCandidateBenchmarkSuiteOptions, P as CodeAgentSessionSource, Pt as sealCandidateExperiment, Q as diffGenerations, R as AgentTraceContributorType, S as fromKimiCodeSession, St as CompareCandidateExperimentOptions, T as parseCodeAgentJsonl, Tt as PairedMeasurementAdapter, U as AgentTraceRecord, V as AgentTraceIndex, W as AuthoringProvenance, X as EvalGenerationDiff, Y as EvalDimensionDelta, Z as EvalRunDiff, _ as CodeAgentSessionIntakeResult, _t as sealAgentProfileImprovementSuite, a as FromFeedbackTableOptions, at as FromRunRecordDirOptions, b as fromClaudeCodeSession, bt as CandidateExperimentExecutionInput, c as CodeAgentStoreObservation, ct as fromRunRecordDir, d as CodeAgentStoreScope, dt as CompareAgentProfileImprovementExperimentOptions, et as diffRuns, f as CodeAgentStoreSession, ft as RunAgentProfileImprovementExperimentOptions, g as CodeAgentSessionIntakeOptions, gt as sealAgentProfileImprovementExperiment, h as CodeAgentSessionDiagnostic, ht as runAgentProfileImprovementExperiment, i as FeedbackTableRow, it as evalReportingSuite, j as CodeAgentSessionActionSurface, jt as runCandidateExperiment, k as CodeAgentSessionActionKind, kt as evaluatePairedMeasurements, l as CodeAgentStoreRejection, lt as AgentProfileImprovementExperimentExecutionInput, m as CodeAgentJsonlLine, mt as measuredComparisonFromAgentProfileImprovementExperiment, n as fromOtelSpans, nt as EvalReportingSuiteOptions, o as FromFeedbackTableResult, ot as FromRunRecordDirResult, p as observeCodeAgentStore, pt as SealAgentProfileImprovementSuiteOptions, q as partitionRunsByAuthoringModel, r as FeedbackTableMeta, rt as EvalReportingSuiteResult, s as fromFeedbackTable, st as RunRecordRejection, t as FromOtelSpansOptions, tt as EvalReportingSuiteInput, u as CodeAgentStoreRejections, ut as AgentProfileImprovementExperimentRun, v as CodeAgentSessionMetrics, vt as sealAgentProfileImprovementTask, w as fromPiSession, wt as PairedMeasurement, x as fromCodexSession, xt as CandidateExperimentRun, y as ParsedCodeAgentJsonl, yt as verifyAgentProfileImprovementExperimentComparison, z as AgentTraceConversation } from "../index-CWoIJHmy.js";
12
- import { n as buildDefaultAnalystRegistry, t as DefaultAnalystRegistryOptions } from "../default-registry-B5HrwrPM.js";
13
- import { a as summarizeExecution, i as analyzeRuns, n as ExecutionReport, r as SummarizeExecutionOptions, t as AnalyzeRunsOptions } from "../analyze-runs-BvK4-wSs.js";
14
- export { type AgentEvalAgent, type AgentEvalEvaluateOptions, type AgentEvalImproveOptions, type AgentProfileImprovementExperimentExecutionInput, type AgentProfileImprovementExperimentRun, type AgentTraceContributor, type AgentTraceContributorType, type AgentTraceConversation, type AgentTraceFile, type AgentTraceIndex, type AgentTraceRange, type AgentTraceRecord, type AnalystFinding, type AnalyzeRunsOptions, type AuthoringProvenance, type AxisEvidence, type AxisVerdict, type BuildEvidenceVectorOptions, type CampaignAggregates, type CampaignArtifactWriter, type CampaignCellFailureReceipt, type CampaignCellResult, type CampaignCellRetryPolicy, type CampaignCostMeter, type CampaignResult, type CampaignStorage, type CampaignTraceWriter, type CandidateExperimentExecutionInput, type CandidateExperimentRun, type ChatClient, type CodeAgentJsonlLine, type CodeAgentSessionAction, type CodeAgentSessionActionKind, type CodeAgentSessionActionStatus, type CodeAgentSessionActionSurface, type CodeAgentSessionDiagnostic, type CodeAgentSessionExecutionReceipt, type CodeAgentSessionIntakeOptions, type CodeAgentSessionIntakeResult, type CodeAgentSessionMetrics, type CodeAgentSessionObservation, type CodeAgentSessionSource, type CodeAgentSessionTerminalStatus, type CodeAgentStoreObservation, type CodeAgentStoreRejection, type CodeAgentStoreRejections, type CodeAgentStoreScope, type CodeAgentStoreSession, type CodeSurface, type CompareAgentProfileImprovementExperimentOptions, type CompareCandidateExperimentOptions, type CompareOptimizationMethodsOptions, type ComparisonCost, type CostLedgerHandle, type CostProvenanceSummary, type CreateChatClientOpts, type DefaultAnalystRegistryOptions, type DefaultProductionGateCheck, type DefaultProductionGateOptions, type DefaultProductionRewardHackingOptions, type DefineAgentEvalOptions, type DefinedAgentEval, type DeploymentOutcome, type DispatchFn as Dispatch, type DispatchContext, type EvalCellScoreDelta, type EvalDimensionDelta, type EvalGenerationDiff, type EvalReportingSuiteInput, type EvalReportingSuiteOptions, type EvalReportingSuiteResult, type EvalRunDiff, type EvaluatePairedMeasurementsOptions, type EvidenceVector, type ExecutionErrorOutcomeCell, type ExecutionInsight, type ExecutionReport, type ExternalOptimizationExample, type ExternalTextEvaluationResponse, type ExternalTextOptimizationMethodConfig, type ExternalTextOptimizerContext, type ExternalTextOptimizerResult, type FailureClassTally, type FailureClusterInsight, type FeedbackTableMeta, type FeedbackTableRow, FileSystemOutcomeStore, type FileSystemOutcomeStoreOptions, type FinalEvidencePolicy, type FinalEvidenceUse, type FromFeedbackTableOptions, type FromFeedbackTableResult, type FromOtelSpansOptions, type FromRunRecordDirOptions, type FromRunRecordDirResult, type Gate, type GateCheckStatus, type GateContext, type GateContribution, type GateDecision, type GateResult, type GenerationCandidate, type GenerationRecord, type GepaAdaptiveEngineRun, type GepaEngineOptions, type GepaEngineRun, type GepaOptimizationMethodConfig, type GepaOptimizationRecipe, type GepaRunnerCommand, type HeldOutGateOptions, type HostedTenant, InMemoryOutcomeStore, type InsightReport, type InterRaterInsight, type JudgeConfig, type JudgeDimension, type JudgeInsight, type JudgeScore, type LiftInsight, type LlmJudgeDimension, type LlmJudgeOptions, type MutableSurface, type ObjectiveSource, type OpenAICompatibleOptimizerModel, type OptimizationMethod, type OptimizationMethodComparison, type OptimizationMethodInput, type OptimizationMethodProvenance, type OptimizationMethodResult, type OptimizationPackageSource, type OptimizationTokenUsage, type OptimizerConfig, type OptimizerModelBudget, type OutcomeCorrelationInsight, type OutcomeStore, type PairedMeasurement, type PairedMeasurementAdapter, type PairedMeasurementEvaluation, type ParetoSignificanceGateOptions, type ParsedCodeAgentJsonl, type PartitionByAuthoringModelResult, type PromotionObjective, type PromotionPolicy, type ProposalFinding, type ProposalFindingOrigin, REFERENCE_EQUIVALENCE_INPUT_LIMITS, REFERENCE_EQUIVALENCE_JUDGE_VERSION, type Recommendation, type ReferenceEquivalenceJudgeInput, type ReferenceEquivalenceJudgeOptions, type ReferenceEquivalenceJudgeResult, type ReferenceEquivalenceScenario, type ReleaseSummary, type RunAgentProfileImprovementExperimentOptions, type RunCampaignOptions, type RunCandidateExperimentOptions, type RunEvalOptions, type RunImprovementLoopOptions, type RunImprovementLoopResult, type RunRecordRejection, type ScalarDistribution, type Scenario, type SealAgentProfileImprovementSuiteOptions, type SealCandidateBenchmarkSuiteOptions, type SelfImproveBudget, type SelfImproveMethodOptions, type SelfImproveMethodProvenance, type SelfImproveMethodResult, type SelfImproveOptions, type SelfImproveProgressEvent, type SelfImproveProposerOptions, type SelfImproveProposerResult, type SelfImproveResult, SelfImproveRunError, type SessionScript, type SkillOptOptimizationMethodConfig, type SkillOptRunnerCommand, type SkillOptTrainerConfig, type SummarizeExecutionOptions, type SurfaceProposer, type TokenUsageInsight, analyzeRuns, buildDefaultAnalystRegistry, buildEvidenceVector, campaignSplitDigest, compareOptimizationMethods, composeGate, createChatClient, createReferenceEquivalenceJudge, defaultProductionGate, defineAgentEval, diffGenerations, diffRunBaselineToWinner, diffRuns, evalReportingSuite, evaluatePairedMeasurements, externalTextOptimizationMethod, fromClaudeCodeSession, fromCodexSession, fromFeedbackTable, fromKimiCodeSession, fromOpenCodeSession, fromOtelSpans, fromPiSession, fromRunRecordDir, fsCampaignStorage, gepaOptimizationMethod, heldOutGate, inMemoryCampaignStorage, llmJudge, makeProposalFinding, measuredComparisonFromAgentProfileImprovementExperiment, measuredComparisonFromCandidateExperiment, observeCodeAgentSession, observeCodeAgentStore, paretoPolicy, paretoSignificanceGate, parseAgentTrace, parseCodeAgentJsonl, parseCodeAgentJsonlFile, partitionRunsByAuthoringModel, runAgentProfileImprovementExperiment, runCampaign, runCandidateExperiment, runEval, runImprovementLoop, runReferenceEquivalenceJudge, sealAgentProfileImprovementExperiment, sealAgentProfileImprovementSuite, sealAgentProfileImprovementTask, sealCandidateBenchmarkSuite, sealCandidateBenchmarkTask, sealCandidateExperiment, selfImprove, skillOptOptimizationMethod, streamCodeAgentJsonlFile, summarizeExecution, transientDispatchFailure, verifyAgentProfileImprovementExperimentComparison, verifyCandidateExperiment, verifyCandidateExperimentComparison };
8
+ import { r as HostedTenant } from "../client-wFyDisxi.js";
9
+ import { _ as ReleaseSummary, a as summarizeExecution, c as ExecutionInsight, d as InsightReport, f as InterRaterInsight, g as Recommendation, h as OutcomeCorrelationInsight, i as analyzeRuns, l as FailureClassTally, m as LiftInsight, n as ExecutionReport, o as CostProvenanceSummary, p as JudgeInsight, r as SummarizeExecutionOptions, s as ExecutionErrorOutcomeCell, t as AnalyzeRunsOptions, u as FailureClusterInsight, v as ScalarDistribution, y as TokenUsageInsight } from "../analyze-runs-CPiKLJFs.js";
10
+ import { _ as SelfImproveMethodResult, a as DefinedAgentEval, c as SelfImproveMethodOptions, d as SelfImproveProposerOptions, f as SelfImproveProposerResult, g as SelfImproveMethodProvenance, h as selfImprove, i as DefineAgentEvalOptions, l as SelfImproveOptions, m as SelfImproveRunError, n as AgentEvalEvaluateOptions, o as defineAgentEval, p as SelfImproveResult, r as AgentEvalImproveOptions, s as SelfImproveBudget, t as AgentEvalAgent, u as SelfImproveProgressEvent } from "../define-agent-eval-DcludNJS.js";
11
+ import { $ as FromRunRecordDirResult, A as CodeAgentSessionActionStatus, B as AgentTraceFile, C as fromOpenCodeSession, Ct as measuredComparisonFromCandidateExperiment, D as streamCodeAgentJsonlFile, Dt as sealCandidateExperiment, E as parseCodeAgentJsonlFile, Et as sealCandidateBenchmarkTask, F as CodeAgentSessionTerminalStatus, G as PartitionByAuthoringModelResult, H as AgentTraceRange, I as observeCodeAgentSession, J as EvalReportingSuiteInput, K as parseAgentTrace, L as AgentTraceContributor, M as CodeAgentSessionExecutionReceipt, N as CodeAgentSessionObservation, O as CodeAgentSessionAction, Ot as verifyCandidateExperiment, P as CodeAgentSessionSource, Q as FromRunRecordDirOptions, R as AgentTraceContributorType, S as fromKimiCodeSession, St as evaluatePairedMeasurements, T as parseCodeAgentJsonl, Tt as sealCandidateBenchmarkSuite, U as AgentTraceRecord, V as AgentTraceIndex, W as AuthoringProvenance, X as EvalReportingSuiteResult, Y as EvalReportingSuiteOptions, Z as evalReportingSuite, _ as CodeAgentSessionIntakeResult, _t as PairedMeasurement, a as FromFeedbackTableOptions, at as RunAgentProfileImprovementExperimentOptions, b as fromClaudeCodeSession, bt as RunCandidateExperimentOptions, c as CodeAgentStoreObservation, ct as runAgentProfileImprovementExperiment, d as CodeAgentStoreScope, dt as sealAgentProfileImprovementTask, et as RunRecordRejection, f as CodeAgentStoreSession, ft as verifyAgentProfileImprovementExperimentComparison, g as CodeAgentSessionIntakeOptions, gt as EvaluatePairedMeasurementsOptions, h as CodeAgentSessionDiagnostic, ht as CompareCandidateExperimentOptions, i as FeedbackTableRow, it as CompareAgentProfileImprovementExperimentOptions, j as CodeAgentSessionActionSurface, k as CodeAgentSessionActionKind, kt as verifyCandidateExperimentComparison, l as CodeAgentStoreRejection, lt as sealAgentProfileImprovementExperiment, m as CodeAgentJsonlLine, mt as CandidateExperimentRun, n as fromOtelSpans, nt as AgentProfileImprovementExperimentExecutionInput, o as FromFeedbackTableResult, ot as SealAgentProfileImprovementSuiteOptions, p as observeCodeAgentStore, pt as CandidateExperimentExecutionInput, q as partitionRunsByAuthoringModel, r as FeedbackTableMeta, rt as AgentProfileImprovementExperimentRun, s as fromFeedbackTable, st as measuredComparisonFromAgentProfileImprovementExperiment, t as FromOtelSpansOptions, tt as fromRunRecordDir, u as CodeAgentStoreRejections, ut as sealAgentProfileImprovementSuite, v as CodeAgentSessionMetrics, vt as PairedMeasurementAdapter, w as fromPiSession, wt as runCandidateExperiment, x as fromCodexSession, xt as SealCandidateBenchmarkSuiteOptions, y as ParsedCodeAgentJsonl, yt as PairedMeasurementEvaluation, z as AgentTraceConversation } from "../index-DNVzu9Vv.js";
12
+ import { n as buildDefaultAnalystRegistry, t as DefaultAnalystRegistryOptions } from "../default-registry-DdqA_-_o.js";
13
+ export { type AgentEvalAgent, type AgentEvalEvaluateOptions, type AgentEvalImproveOptions, type AgentProfileImprovementExperimentExecutionInput, type AgentProfileImprovementExperimentRun, type AgentTraceContributor, type AgentTraceContributorType, type AgentTraceConversation, type AgentTraceFile, type AgentTraceIndex, type AgentTraceRange, type AgentTraceRecord, type AnalystFinding, type AnalyzeRunsOptions, type AuthoringProvenance, type AxisEvidence, type AxisVerdict, type BuildEvidenceVectorOptions, type CampaignAggregates, type CampaignArtifactWriter, type CampaignCellFailureReceipt, type CampaignCellResult, type CampaignCellRetryPolicy, type CampaignCostMeter, type CampaignResult, type CampaignStorage, type CampaignTraceWriter, type CandidateExperimentExecutionInput, type CandidateExperimentRun, type ChatClient, type CodeAgentJsonlLine, type CodeAgentSessionAction, type CodeAgentSessionActionKind, type CodeAgentSessionActionStatus, type CodeAgentSessionActionSurface, type CodeAgentSessionDiagnostic, type CodeAgentSessionExecutionReceipt, type CodeAgentSessionIntakeOptions, type CodeAgentSessionIntakeResult, type CodeAgentSessionMetrics, type CodeAgentSessionObservation, type CodeAgentSessionSource, type CodeAgentSessionTerminalStatus, type CodeAgentStoreObservation, type CodeAgentStoreRejection, type CodeAgentStoreRejections, type CodeAgentStoreScope, type CodeAgentStoreSession, type CodeSurface, type CompareAgentProfileImprovementExperimentOptions, type CompareCandidateExperimentOptions, type CompareOptimizationMethodsOptions, type ComparisonCost, type CostLedgerHandle, type CostProvenanceSummary, type CreateChatClientOpts, type DefaultAnalystRegistryOptions, type DefaultProductionGateCheck, type DefaultProductionGateOptions, type DefaultProductionRewardHackingOptions, type DefineAgentEvalOptions, type DefinedAgentEval, type DeploymentOutcome, type DispatchFn as Dispatch, type DispatchContext, type EvalReportingSuiteInput, type EvalReportingSuiteOptions, type EvalReportingSuiteResult, type EvaluatePairedMeasurementsOptions, type EvidenceVector, type ExecutionErrorOutcomeCell, type ExecutionInsight, type ExecutionReport, type ExternalOptimizationExample, type ExternalTextEvaluationResponse, type ExternalTextOptimizationMethodConfig, type ExternalTextOptimizerContext, type ExternalTextOptimizerResult, type FailureClassTally, type FailureClusterInsight, type FeedbackTableMeta, type FeedbackTableRow, FileSystemOutcomeStore, type FileSystemOutcomeStoreOptions, type FinalEvidencePolicy, type FinalEvidenceUse, type FromFeedbackTableOptions, type FromFeedbackTableResult, type FromOtelSpansOptions, type FromRunRecordDirOptions, type FromRunRecordDirResult, type Gate, type GateCheckStatus, type GateContext, type GateContribution, type GateDecision, type GateResult, type GenerationCandidate, type GenerationRecord, type GepaAdaptiveEngineRun, type GepaEngineOptions, type GepaEngineRun, type GepaOptimizationMethodConfig, type GepaOptimizationRecipe, type GepaRunnerCommand, type HeldOutGateOptions, type HostedTenant, InMemoryOutcomeStore, type InsightReport, type InterRaterInsight, type JudgeConfig, type JudgeDimension, type JudgeInsight, type JudgeScore, type LiftInsight, type LlmJudgeDimension, type LlmJudgeOptions, type MutableSurface, type ObjectiveSource, type OpenAICompatibleOptimizerModel, type OptimizationMethod, type OptimizationMethodComparison, type OptimizationMethodInput, type OptimizationMethodProvenance, type OptimizationMethodResult, type OptimizationPackageSource, type OptimizationTokenUsage, type OptimizerConfig, type OptimizerModelBudget, type OutcomeCorrelationInsight, type OutcomeStore, type PairedMeasurement, type PairedMeasurementAdapter, type PairedMeasurementEvaluation, type ParetoSignificanceGateOptions, type ParsedCodeAgentJsonl, type PartitionByAuthoringModelResult, type PromotionObjective, type PromotionPolicy, type ProposalFinding, type ProposalFindingOrigin, REFERENCE_EQUIVALENCE_INPUT_LIMITS, REFERENCE_EQUIVALENCE_JUDGE_VERSION, type Recommendation, type ReferenceEquivalenceJudgeInput, type ReferenceEquivalenceJudgeOptions, type ReferenceEquivalenceJudgeResult, type ReferenceEquivalenceScenario, type ReleaseSummary, type RunAgentProfileImprovementExperimentOptions, type RunCampaignOptions, type RunCandidateExperimentOptions, type RunEvalOptions, type RunImprovementLoopOptions, type RunImprovementLoopResult, type RunRecordRejection, type ScalarDistribution, type Scenario, type SealAgentProfileImprovementSuiteOptions, type SealCandidateBenchmarkSuiteOptions, type SelfImproveBudget, type SelfImproveMethodOptions, type SelfImproveMethodProvenance, type SelfImproveMethodResult, type SelfImproveOptions, type SelfImproveProgressEvent, type SelfImproveProposerOptions, type SelfImproveProposerResult, type SelfImproveResult, SelfImproveRunError, type SessionScript, type SkillOptOptimizationMethodConfig, type SkillOptRunnerCommand, type SkillOptTrainerConfig, type SummarizeExecutionOptions, type SurfaceProposer, type TokenUsageInsight, analyzeRuns, buildDefaultAnalystRegistry, buildEvidenceVector, campaignSplitDigest, compareOptimizationMethods, composeGate, createChatClient, createReferenceEquivalenceJudge, defaultProductionGate, defineAgentEval, evalReportingSuite, evaluatePairedMeasurements, externalTextOptimizationMethod, fromClaudeCodeSession, fromCodexSession, fromFeedbackTable, fromKimiCodeSession, fromOpenCodeSession, fromOtelSpans, fromPiSession, fromRunRecordDir, fsCampaignStorage, gepaOptimizationMethod, heldOutGate, inMemoryCampaignStorage, llmJudge, makeProposalFinding, measuredComparisonFromAgentProfileImprovementExperiment, measuredComparisonFromCandidateExperiment, observeCodeAgentSession, observeCodeAgentStore, paretoPolicy, paretoSignificanceGate, parseAgentTrace, parseCodeAgentJsonl, parseCodeAgentJsonlFile, partitionRunsByAuthoringModel, runAgentProfileImprovementExperiment, runCampaign, runCandidateExperiment, runEval, runImprovementLoop, runReferenceEquivalenceJudge, sealAgentProfileImprovementExperiment, sealAgentProfileImprovementSuite, sealAgentProfileImprovementTask, sealCandidateBenchmarkSuite, sealCandidateBenchmarkTask, sealCandidateExperiment, selfImprove, skillOptOptimizationMethod, streamCodeAgentJsonlFile, summarizeExecution, transientDispatchFailure, verifyAgentProfileImprovementExperimentComparison, verifyCandidateExperiment, verifyCandidateExperimentComparison };
@@ -4,21 +4,21 @@ import { t as decidePairedPromotion } from "../paired-promotion-decision-6cn3bLc
4
4
  import { a as heldoutSignificance } from "../statistical-heldout-GcLIPxk4.js";
5
5
  import { n as summarizeExecution, t as analyzeRuns } from "../analyze-runs-SCSWYpy0.js";
6
6
  import { a as parseRunRecordSafe } from "../run-record-BRlM99rX.js";
7
- import { Y as defaultProductionGate, a as transientDispatchFailure, at as runEval, c as compareOptimizationMethods, h as runImprovementLoop, ot as runCampaign, t as llmJudge } from "../llm-judge-BnxAv7ed.js";
7
+ import { Y as defaultProductionGate, a as transientDispatchFailure, at as runEval, c as compareOptimizationMethods, h as runImprovementLoop, ot as runCampaign, t as llmJudge } from "../llm-judge-Z6MkTkd0.js";
8
8
  import { i as isModelPriced, n as estimateCost } from "../metrics-DOMpkoeb.js";
9
9
  import { i as CostLedger } from "../cost-ledger-_IbkejCF.js";
10
- import { Q as campaignSplitDigest } from "../campaign-evidence-D40-LHIL.js";
11
- import { m as mapConcurrentRange } from "../journal-c3qY0SDP.js";
12
- import { C as inMemoryCampaignStorage, S as fsCampaignStorage } from "../external-optimizer-subprocess-kbcPu5po.js";
13
- import { n as SelfImproveRunError, r as selfImprove, t as defineAgentEval } from "../define-agent-eval-DPizhHfy.js";
14
- import { t as buildDefaultAnalystRegistry } from "../default-registry-16I-Bxlf.js";
15
- import { t as extractUsage } from "../extract-usage-BrQ8mCLX.js";
10
+ import { q as campaignSplitDigest } from "../campaign-evidence-DcQiYhJI.js";
11
+ import { h as mapConcurrentRange } from "../journal-DvKCvjty.js";
12
+ import { C as fsCampaignStorage, w as inMemoryCampaignStorage } from "../external-optimizer-subprocess-kbqC-iWf.js";
13
+ import { n as SelfImproveRunError, r as selfImprove, t as defineAgentEval } from "../define-agent-eval-DQuos3Aw.js";
14
+ import { t as buildDefaultAnalystRegistry } from "../default-registry-xMLX160E.js";
15
+ import { t as extractUsage } from "../extract-usage-DFATEuWW.js";
16
16
  import { i as makeProposalFinding } from "../types-CW5b90JH.js";
17
17
  import { t as createChatClient } from "../chat-client-B_ItsSBw.js";
18
18
  import { n as InMemoryOutcomeStore, t as FileSystemOutcomeStore } from "../outcome-store-BXlkwMPR.js";
19
- import { c as composeGate, f as REFERENCE_EQUIVALENCE_INPUT_LIMITS, h as runReferenceEquivalenceJudge, l as externalTextOptimizationMethod, m as createReferenceEquivalenceJudge, n as gepaOptimizationMethod, p as REFERENCE_EQUIVALENCE_JUDGE_VERSION, s as heldOutGate, t as skillOptOptimizationMethod } from "../skillopt-optimization-method-l2vDBtKp.js";
19
+ import { c as composeGate, f as REFERENCE_EQUIVALENCE_INPUT_LIMITS, h as runReferenceEquivalenceJudge, l as externalTextOptimizationMethod, m as createReferenceEquivalenceJudge, n as gepaOptimizationMethod, p as REFERENCE_EQUIVALENCE_JUDGE_VERSION, s as heldOutGate, t as skillOptOptimizationMethod } from "../skillopt-optimization-method-DoayuM6D.js";
20
20
  import { n as paretoPolicy, r as paretoSignificanceGate, t as buildEvidenceVector } from "../promotion-policy-CfMNUro2.js";
21
- import { t as fromOtelSpans } from "../otel-spans-CQY1pNiN.js";
21
+ import { t as fromOtelSpans } from "../otel-spans-DS7t1t1J.js";
22
22
  import { createHash } from "node:crypto";
23
23
  import { agentCandidateBenchmarkSuiteSchema, agentCandidateBenchmarkTaskSchema, agentCandidateBundleSchema, agentCandidateEvaluationPolicySchema, agentCandidateExperimentSchema, agentImprovementMeasuredComparisonSchema, agentProfileImprovementExperimentSchema, agentProfileImprovementMeasuredComparisonSchema, agentProfileImprovementRunCellSchema, agentProfileImprovementRunReceiptSchema, agentProfileImprovementSuiteInputsSchema, agentProfileImprovementSuiteSchema, agentProfileImprovementTaskSchema, candidateExecutionEvidenceSchema, canonicalCandidateDigest, canonicalCandidateJson, numbersApproximatelyEqual, omitTopLevelDigest } from "@tangle-network/agent-interface";
24
24
  import { createReadStream } from "node:fs";
@@ -1318,136 +1318,6 @@ function resolveWriteTarget(write, sourcePath) {
1318
1318
  return sourcePath.endsWith(".json") || sourcePath.endsWith(".jsonl") ? join(dirname(sourcePath), ANALYSIS_ARTIFACT) : join(sourcePath, ANALYSIS_ARTIFACT);
1319
1319
  }
1320
1320
  //#endregion
1321
- //#region src/contract/diff.ts
1322
- function keyForCell(cell) {
1323
- return JSON.stringify([cell.scenarioId, cell.rep]);
1324
- }
1325
- /** Build the per-dimension delta map for a matched cell. Each judge name +
1326
- * dimension name encountered on EITHER side appears in the result. */
1327
- function diffDimensions(before, after) {
1328
- const out = {};
1329
- const judges = /* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)]);
1330
- for (const judge of judges) {
1331
- const beforeDims = before[judge] ?? {};
1332
- const afterDims = after[judge] ?? {};
1333
- const dims = /* @__PURE__ */ new Set([...Object.keys(beforeDims), ...Object.keys(afterDims)]);
1334
- const judgeOut = {};
1335
- for (const dim of dims) {
1336
- const rawBefore = beforeDims[dim];
1337
- const rawAfter = afterDims[dim];
1338
- const b = typeof rawBefore === "number" && Number.isFinite(rawBefore) ? rawBefore : null;
1339
- const a = typeof rawAfter === "number" && Number.isFinite(rawAfter) ? rawAfter : null;
1340
- judgeOut[dim] = {
1341
- before: b,
1342
- after: a,
1343
- delta: b !== null && a !== null ? a - b : null
1344
- };
1345
- }
1346
- out[judge] = judgeOut;
1347
- }
1348
- return out;
1349
- }
1350
- /**
1351
- * Diff two generation snapshots. Cells are matched on `(scenarioId, rep)`;
1352
- * unmatched cells surface in `added` / `removed`. Aggregate fields are
1353
- * recomputed from the snapshot's stored fields, not re-derived from cells —
1354
- * this keeps the diff consistent with whatever aggregation the substrate
1355
- * actually reported.
1356
- */
1357
- function diffGenerations(before, after) {
1358
- const beforeMap = new Map(before.cells.map((c) => [keyForCell(c), c]));
1359
- const afterMap = new Map(after.cells.map((c) => [keyForCell(c), c]));
1360
- const matched = [];
1361
- const removed = [];
1362
- const added = [];
1363
- for (const [key, beforeCell] of beforeMap) {
1364
- const afterCell = afterMap.get(key);
1365
- if (!afterCell) {
1366
- removed.push(beforeCell);
1367
- continue;
1368
- }
1369
- matched.push({
1370
- scenarioId: beforeCell.scenarioId,
1371
- rep: beforeCell.rep,
1372
- compositeBefore: beforeCell.compositeMean,
1373
- compositeAfter: afterCell.compositeMean,
1374
- compositeDelta: beforeCell.compositeMean === null || afterCell.compositeMean === null ? null : afterCell.compositeMean - beforeCell.compositeMean,
1375
- dimensions: diffDimensions(beforeCell.dimensions, afterCell.dimensions)
1376
- });
1377
- }
1378
- for (const [key, afterCell] of afterMap) if (!beforeMap.has(key)) added.push(afterCell);
1379
- return {
1380
- beforeIndex: before.index,
1381
- afterIndex: after.index,
1382
- beforeSurfaceHash: before.surfaceHash,
1383
- afterSurfaceHash: after.surfaceHash,
1384
- surfaceChanged: before.surfaceHash !== after.surfaceHash,
1385
- matched,
1386
- removed,
1387
- added,
1388
- compositeBefore: before.compositeMean,
1389
- compositeAfter: after.compositeMean,
1390
- compositeDelta: before.compositeMean === null || after.compositeMean === null ? null : after.compositeMean - before.compositeMean,
1391
- costUsdBefore: before.costUsd,
1392
- costUsdAfter: after.costUsd,
1393
- costUsdDelta: after.costUsd - before.costUsd,
1394
- durationMsBefore: before.durationMs,
1395
- durationMsAfter: after.durationMs,
1396
- durationMsDelta: after.durationMs - before.durationMs
1397
- };
1398
- }
1399
- /** Highest-index generation, or null if the run recorded none. */
1400
- function winnerOf(run) {
1401
- if (run.generations.length === 0) return null;
1402
- let winner = run.generations[0];
1403
- for (const gen of run.generations) if (gen.index > winner.index) winner = gen;
1404
- return winner;
1405
- }
1406
- /**
1407
- * Diff two full eval-runs. Produces baseline-vs-baseline and
1408
- * winner-vs-winner generation diffs when both sides expose them, plus
1409
- * run-level cost / lift / gate-decision deltas.
1410
- */
1411
- function diffRuns(before, after) {
1412
- const beforeWinner = winnerOf(before);
1413
- const afterWinner = winnerOf(after);
1414
- const baselineDiff = before.baseline && after.baseline ? diffGenerations(before.baseline, after.baseline) : null;
1415
- const winnersDiff = beforeWinner && afterWinner ? diffGenerations(beforeWinner, afterWinner) : null;
1416
- const beforeLift = before.holdoutLift ?? null;
1417
- const afterLift = after.holdoutLift ?? null;
1418
- return {
1419
- beforeRunId: before.runId,
1420
- afterRunId: after.runId,
1421
- beforeTimestamp: before.timestamp,
1422
- afterTimestamp: after.timestamp,
1423
- beforeGateDecision: before.gateDecision ?? null,
1424
- afterGateDecision: after.gateDecision ?? null,
1425
- beforeHoldoutLift: beforeLift,
1426
- afterHoldoutLift: afterLift,
1427
- holdoutLiftDelta: beforeLift !== null && afterLift !== null ? afterLift - beforeLift : null,
1428
- beforeTotalCostUsd: before.totalCostUsd,
1429
- afterTotalCostUsd: after.totalCostUsd,
1430
- totalCostUsdDelta: after.totalCostUsd - before.totalCostUsd,
1431
- beforeTotalDurationMs: before.totalDurationMs,
1432
- afterTotalDurationMs: after.totalDurationMs,
1433
- totalDurationMsDelta: after.totalDurationMs - before.totalDurationMs,
1434
- baselineDiff,
1435
- winnersDiff
1436
- };
1437
- }
1438
- /**
1439
- * Within-run baseline → winning-generation diff. The natural "what did the
1440
- * improvement loop produce" view for a single run. Returns null when the
1441
- * run never reached a generation past baseline (errored early, or the gate
1442
- * shipped the baseline as-is).
1443
- */
1444
- function diffRunBaselineToWinner(run) {
1445
- if (!run.baseline) return null;
1446
- const winner = winnerOf(run);
1447
- if (!winner || winner.index === run.baseline.index) return null;
1448
- return diffGenerations(run.baseline, winner);
1449
- }
1450
- //#endregion
1451
1321
  //#region src/contract/intake/agent-trace.ts
1452
1322
  function rangeLines(r) {
1453
1323
  return Math.max(0, r.end_line - r.start_line + 1);
@@ -3351,6 +3221,6 @@ function fromFeedbackTable(opts) {
3351
3221
  };
3352
3222
  }
3353
3223
  //#endregion
3354
- export { FileSystemOutcomeStore, InMemoryOutcomeStore, REFERENCE_EQUIVALENCE_INPUT_LIMITS, REFERENCE_EQUIVALENCE_JUDGE_VERSION, SelfImproveRunError, analyzeRuns, buildDefaultAnalystRegistry, buildEvidenceVector, campaignSplitDigest, compareOptimizationMethods, composeGate, createChatClient, createReferenceEquivalenceJudge, defaultProductionGate, defineAgentEval, diffGenerations, diffRunBaselineToWinner, diffRuns, evalReportingSuite, evaluatePairedMeasurements, externalTextOptimizationMethod, fromClaudeCodeSession, fromCodexSession, fromFeedbackTable, fromKimiCodeSession, fromOpenCodeSession, fromOtelSpans, fromPiSession, fromRunRecordDir, fsCampaignStorage, gepaOptimizationMethod, heldOutGate, inMemoryCampaignStorage, llmJudge, makeProposalFinding, measuredComparisonFromAgentProfileImprovementExperiment, measuredComparisonFromCandidateExperiment, observeCodeAgentSession, observeCodeAgentStore, paretoPolicy, paretoSignificanceGate, parseAgentTrace, parseCodeAgentJsonl, parseCodeAgentJsonlFile, partitionRunsByAuthoringModel, runAgentProfileImprovementExperiment, runCampaign, runCandidateExperiment, runEval, runImprovementLoop, runReferenceEquivalenceJudge, sealAgentProfileImprovementExperiment, sealAgentProfileImprovementSuite, sealAgentProfileImprovementTask, sealCandidateBenchmarkSuite, sealCandidateBenchmarkTask, sealCandidateExperiment, selfImprove, skillOptOptimizationMethod, streamCodeAgentJsonlFile, summarizeExecution, transientDispatchFailure, verifyAgentProfileImprovementExperimentComparison, verifyCandidateExperiment, verifyCandidateExperimentComparison };
3224
+ export { FileSystemOutcomeStore, InMemoryOutcomeStore, REFERENCE_EQUIVALENCE_INPUT_LIMITS, REFERENCE_EQUIVALENCE_JUDGE_VERSION, SelfImproveRunError, analyzeRuns, buildDefaultAnalystRegistry, buildEvidenceVector, campaignSplitDigest, compareOptimizationMethods, composeGate, createChatClient, createReferenceEquivalenceJudge, defaultProductionGate, defineAgentEval, evalReportingSuite, evaluatePairedMeasurements, externalTextOptimizationMethod, fromClaudeCodeSession, fromCodexSession, fromFeedbackTable, fromKimiCodeSession, fromOpenCodeSession, fromOtelSpans, fromPiSession, fromRunRecordDir, fsCampaignStorage, gepaOptimizationMethod, heldOutGate, inMemoryCampaignStorage, llmJudge, makeProposalFinding, measuredComparisonFromAgentProfileImprovementExperiment, measuredComparisonFromCandidateExperiment, observeCodeAgentSession, observeCodeAgentStore, paretoPolicy, paretoSignificanceGate, parseAgentTrace, parseCodeAgentJsonl, parseCodeAgentJsonlFile, partitionRunsByAuthoringModel, runAgentProfileImprovementExperiment, runCampaign, runCandidateExperiment, runEval, runImprovementLoop, runReferenceEquivalenceJudge, sealAgentProfileImprovementExperiment, sealAgentProfileImprovementSuite, sealAgentProfileImprovementTask, sealCandidateBenchmarkSuite, sealCandidateBenchmarkTask, sealCandidateExperiment, selfImprove, skillOptOptimizationMethod, streamCodeAgentJsonlFile, summarizeExecution, transientDispatchFailure, verifyAgentProfileImprovementExperimentComparison, verifyCandidateExperiment, verifyCandidateExperimentComparison };
3355
3225
 
3356
3226
  //# sourceMappingURL=index.js.map