@tangle-network/agent-eval 0.190.1 → 0.191.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/dist/adapters/http.d.ts +2 -2
- package/dist/{agent-profile-DNV_U6QR.d.ts → agent-profile-DDfIjdyS.d.ts} +3 -3
- package/dist/{agent-profile-DNV_U6QR.d.ts.map → agent-profile-DDfIjdyS.d.ts.map} +1 -1
- package/dist/analyst/index.d.ts +11 -11
- package/dist/analyst/index.js +5 -5
- package/dist/{insight-report-CvPkEIcC.d.ts → analyze-runs-CPiKLJFs.d.ts} +73 -3
- package/dist/analyze-runs-CPiKLJFs.d.ts.map +1 -0
- package/dist/{attribute-vocabulary-DLJ6303h.d.ts → attribute-vocabulary-CcXqHODT.d.ts} +23 -12
- package/dist/attribute-vocabulary-CcXqHODT.d.ts.map +1 -0
- package/dist/{benchmark-command-BXIr_k8D.js → benchmark-command-3tZJnD82.js} +8 -8
- package/dist/{benchmark-command-BXIr_k8D.js.map → benchmark-command-3tZJnD82.js.map} +1 -1
- package/dist/benchmarks/index.d.ts +3 -3
- package/dist/benchmarks/index.js +3 -3
- package/dist/campaign/index.d.ts +6 -6
- package/dist/campaign/index.js +9 -7
- package/dist/{campaign-B7q74uIh.js → campaign-C8iWEF0M.js} +10 -8
- package/dist/{campaign-B7q74uIh.js.map → campaign-C8iWEF0M.js.map} +1 -1
- package/dist/{campaign-evidence-D40-LHIL.js → campaign-evidence-BqjlTM3P.js} +10 -111
- package/dist/campaign-evidence-BqjlTM3P.js.map +1 -0
- package/dist/claim-V9Zqbq0J.js +54 -0
- package/dist/claim-V9Zqbq0J.js.map +1 -0
- package/dist/cli.js +99 -2
- package/dist/cli.js.map +1 -1
- package/dist/client-wFyDisxi.d.ts +236 -0
- package/dist/client-wFyDisxi.d.ts.map +1 -0
- package/dist/contract/index.d.ts +10 -11
- package/dist/contract/index.js +9 -139
- package/dist/contract/index.js.map +1 -1
- package/dist/{default-registry-B5HrwrPM.d.ts → default-registry-DK_9aVJf.d.ts} +6 -6
- package/dist/{default-registry-B5HrwrPM.d.ts.map → default-registry-DK_9aVJf.d.ts.map} +1 -1
- package/dist/{default-registry-16I-Bxlf.js → default-registry-xMLX160E.js} +3 -3
- package/dist/{default-registry-16I-Bxlf.js.map → default-registry-xMLX160E.js.map} +1 -1
- package/dist/{define-agent-eval-DPizhHfy.js → define-agent-eval-BE43YTm4.js} +27 -109
- package/dist/define-agent-eval-BE43YTm4.js.map +1 -0
- package/dist/{define-agent-eval-DblGedQk.d.ts → define-agent-eval-P28y7mI1.d.ts} +16 -20
- package/dist/define-agent-eval-P28y7mI1.d.ts.map +1 -0
- package/dist/diagnosis/index.d.ts +2 -2
- package/dist/diagnosis/index.js +1 -1
- package/dist/{dspy-rlm-engine-Cs5LzJ-f.js → dspy-rlm-engine-MfpwoEaj.js} +3 -3
- package/dist/{dspy-rlm-engine-Cs5LzJ-f.js.map → dspy-rlm-engine-MfpwoEaj.js.map} +1 -1
- package/dist/{engine-BkLCnZQX.d.ts → engine-vNiM02Ub.d.ts} +4 -4
- package/dist/{engine-BkLCnZQX.d.ts.map → engine-vNiM02Ub.d.ts.map} +1 -1
- package/dist/evaluation.d.ts +2 -2
- package/dist/{exact-types-CfpP2A4Z.d.ts → exact-types-KGxBWH4b.d.ts} +2 -2
- package/dist/{exact-types-CfpP2A4Z.d.ts.map → exact-types-KGxBWH4b.d.ts.map} +1 -1
- package/dist/experiment/index.d.ts +1 -1
- package/dist/experiment/index.js +2 -1
- package/dist/experiment/index.js.map +1 -1
- package/dist/{external-optimizer-process-BnSmrkgL.js → external-optimizer-process-xFTliuiK.js} +2 -2
- package/dist/{external-optimizer-process-BnSmrkgL.js.map → external-optimizer-process-xFTliuiK.js.map} +1 -1
- package/dist/{external-optimizer-subprocess-kbcPu5po.js → external-optimizer-subprocess-B234V9V0.js} +4 -27
- package/dist/external-optimizer-subprocess-B234V9V0.js.map +1 -0
- package/dist/{extract-usage-BrQ8mCLX.js → extract-usage-DFATEuWW.js} +2 -2
- package/dist/{extract-usage-BrQ8mCLX.js.map → extract-usage-DFATEuWW.js.map} +1 -1
- package/dist/{feedback-trajectory-BYjh7NEM.d.ts → feedback-trajectory-BXCGTRkz.d.ts} +3 -3
- package/dist/{feedback-trajectory-BYjh7NEM.d.ts.map → feedback-trajectory-BXCGTRkz.d.ts.map} +1 -1
- package/dist/hosted/index.d.ts +66 -6
- package/dist/hosted/index.d.ts.map +1 -1
- package/dist/hosted/index.js +2 -2
- package/dist/{index-CJv56rhX.d.ts → index-CzfnASj_.d.ts} +18 -11
- package/dist/index-CzfnASj_.d.ts.map +1 -0
- package/dist/{index-2e_MTznj.d.ts → index-D-TN7ZRM.d.ts} +6 -6
- package/dist/{index-2e_MTznj.d.ts.map → index-D-TN7ZRM.d.ts.map} +1 -1
- package/dist/{index-CWoIJHmy.d.ts → index-DH-MWH5f.d.ts} +10 -104
- package/dist/index-DH-MWH5f.d.ts.map +1 -0
- package/dist/index.d.ts +16 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -11
- package/dist/jev.d.ts +2 -2
- package/dist/{kind-factory-ByZeXDqF.js → kind-factory-CdPPHtGZ.js} +10 -26
- package/dist/kind-factory-CdPPHtGZ.js.map +1 -0
- package/dist/{llm-judge-BnxAv7ed.js → llm-judge-NJOHM0iA.js} +9 -1426
- package/dist/llm-judge-NJOHM0iA.js.map +1 -0
- package/dist/{matrix-CNypzP-v.d.ts → matrix-CgqdFm5N.d.ts} +2 -2
- package/dist/{matrix-CNypzP-v.d.ts.map → matrix-CgqdFm5N.d.ts.map} +1 -1
- package/dist/multishot/golden/index.d.ts +1 -1
- package/dist/multishot/index.d.ts +2 -2
- package/dist/openapi.json +1 -1
- package/dist/{otel-spans-CQY1pNiN.js → otel-spans-DS7t1t1J.js} +8 -19
- package/dist/otel-spans-DS7t1t1J.js.map +1 -0
- package/dist/otlp-attributes-D9ptWaIJ.js +53 -0
- package/dist/otlp-attributes-D9ptWaIJ.js.map +1 -0
- package/dist/{prime-protocol-Fwvctmhm.d.ts → prime-protocol-T0i6xcAs.d.ts} +2 -2
- package/dist/{prime-protocol-Fwvctmhm.d.ts.map → prime-protocol-T0i6xcAs.d.ts.map} +1 -1
- package/dist/{produced-state-BXjXJHJT.js → produced-state-CY-L7CqS.js} +3 -3
- package/dist/{produced-state-BXjXJHJT.js.map → produced-state-CY-L7CqS.js.map} +1 -1
- package/dist/{registry-mAQVtuLx.d.ts → registry-Bu3lNole.d.ts} +3 -3
- package/dist/{registry-mAQVtuLx.d.ts.map → registry-Bu3lNole.d.ts.map} +1 -1
- package/dist/rl.d.ts +1 -1
- package/dist/rl.js +1 -1
- package/dist/{run-record-DnMFyg_g.js → run-record-tNnlQIrD.js} +2 -10
- package/dist/{run-record-DnMFyg_g.js.map → run-record-tNnlQIrD.js.map} +1 -1
- package/dist/search-ledger-CQ8Uy4FK.js +1451 -0
- package/dist/search-ledger-CQ8Uy4FK.js.map +1 -0
- package/dist/search-ledger-file-EvdDZRhv.js +27 -0
- package/dist/search-ledger-file-EvdDZRhv.js.map +1 -0
- package/dist/search-shipper-C55V7HE3.js +781 -0
- package/dist/search-shipper-C55V7HE3.js.map +1 -0
- package/dist/{semantic-concept-judge-ClB73cei.js → semantic-concept-judge-Bt7bXAAo.js} +3 -3
- package/dist/{semantic-concept-judge-ClB73cei.js.map → semantic-concept-judge-Bt7bXAAo.js.map} +1 -1
- package/dist/{skillopt-optimization-method-l2vDBtKp.js → skillopt-optimization-method-DwO3TOAV.js} +6 -5
- package/dist/{skillopt-optimization-method-l2vDBtKp.js.map → skillopt-optimization-method-DwO3TOAV.js.map} +1 -1
- package/dist/{statistical-heldout-CLpjYffJ.d.ts → statistical-heldout-BED3wBtX.d.ts} +2 -2
- package/dist/{statistical-heldout-CLpjYffJ.d.ts.map → statistical-heldout-BED3wBtX.d.ts.map} +1 -1
- package/dist/{store-otlp-84DH0OEH.js → store-otlp-BPowgPm6.js} +2 -2
- package/dist/{store-otlp-84DH0OEH.js.map → store-otlp-BPowgPm6.js.map} +1 -1
- package/dist/{store-tool-spans-DUiqyHvR.js → store-tool-spans-BcC_5ef-.js} +5 -5
- package/dist/{store-tool-spans-DUiqyHvR.js.map → store-tool-spans-BcC_5ef-.js.map} +1 -1
- package/dist/{store-tool-spans-BBXs8hDP.d.ts → store-tool-spans-Cfh9XUCm.d.ts} +5 -9
- package/dist/store-tool-spans-Cfh9XUCm.d.ts.map +1 -0
- package/dist/{task-failure-attributes-B34TiMBe.js → task-failure-attributes-CEqEfuIY.js} +17 -9
- package/dist/task-failure-attributes-CEqEfuIY.js.map +1 -0
- package/dist/{tool-groups-W7MJobX_.d.ts → tool-groups-D-mkeN0N.d.ts} +3 -3
- package/dist/tool-groups-D-mkeN0N.d.ts.map +1 -0
- package/dist/trace-attributes.d.ts +1 -1
- package/dist/trace-attributes.js +23 -75
- package/dist/trace-attributes.js.map +1 -1
- package/dist/trace-repair/index.d.ts +1 -1
- package/dist/traces.d.ts +11 -18
- package/dist/traces.d.ts.map +1 -1
- package/dist/traces.js +16 -16
- package/dist/traces.js.map +1 -1
- package/dist/{types-BvmWNjjs.d.ts → types-BmQRs661.d.ts} +2 -2
- package/dist/{types-BvmWNjjs.d.ts.map → types-BmQRs661.d.ts.map} +1 -1
- package/dist/{types-Bay1dh2o.d.ts → types-CeDfCRXp.d.ts} +11 -16
- package/dist/types-CeDfCRXp.d.ts.map +1 -0
- package/dist/{types-Cvqy7asY.d.ts → types-ClK-sHs8.d.ts} +2 -2
- package/dist/{types-Cvqy7asY.d.ts.map → types-ClK-sHs8.d.ts.map} +1 -1
- package/dist/wire/index.d.ts +1 -1
- package/docs/hosted-ingest-spec.md +92 -133
- package/docs/public-api.md +46 -35
- package/docs/search-ledger.md +17 -0
- package/package.json +2 -2
- package/dist/analyze-runs-BvK4-wSs.d.ts +0 -75
- package/dist/analyze-runs-BvK4-wSs.d.ts.map +0 -1
- package/dist/attribute-vocabulary-DLJ6303h.d.ts.map +0 -1
- package/dist/campaign-evidence-D40-LHIL.js.map +0 -1
- package/dist/client-BhEyAdfe.d.ts +0 -202
- package/dist/client-BhEyAdfe.d.ts.map +0 -1
- package/dist/client-QwJpsNYU.js +0 -655
- package/dist/client-QwJpsNYU.js.map +0 -1
- package/dist/define-agent-eval-DPizhHfy.js.map +0 -1
- package/dist/define-agent-eval-DblGedQk.d.ts.map +0 -1
- package/dist/external-optimizer-subprocess-kbcPu5po.js.map +0 -1
- package/dist/index-CJv56rhX.d.ts.map +0 -1
- package/dist/index-CWoIJHmy.d.ts.map +0 -1
- package/dist/insight-report-CvPkEIcC.d.ts.map +0 -1
- package/dist/kind-factory-ByZeXDqF.js.map +0 -1
- package/dist/llm-judge-BnxAv7ed.js.map +0 -1
- package/dist/otel-spans-CQY1pNiN.js.map +0 -1
- package/dist/otlp-attributes-BpC_blLF.js +0 -83
- package/dist/otlp-attributes-BpC_blLF.js.map +0 -1
- package/dist/store-tool-spans-BBXs8hDP.d.ts.map +0 -1
- package/dist/task-failure-attributes-B34TiMBe.js.map +0 -1
- package/dist/tool-groups-W7MJobX_.d.ts.map +0 -1
- package/dist/types-Bay1dh2o.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim-V9Zqbq0J.js","names":[],"sources":["../src/experiment/claim.ts"],"sourcesContent":["import { z } from 'zod'\nimport { ValidationError } from '../errors'\nimport { compareCodeUnits } from '../ledger-core/canonical'\nimport { type EvidenceRecord, readField } from './ast'\n\nconst nonEmpty = z\n .string()\n .min(1)\n .refine((value) => value.trim() === value)\n\n/** The claim's schema, shared by every record that binds a claim. */\nexport const evaluationClaimSchema = z\n .object({\n use: z.enum(['development', 'comparison', 'certification']),\n population: z.object({ id: nonEmpty, description: nonEmpty }).strict(),\n samplingFrame: nonEmpty,\n independentUnit: nonEmpty,\n generalization: z.enum(['fixed-roster', 'new-units']),\n minimumEffect: z.number().finite().positive().optional(),\n })\n .strict()\n\n/** The population and independent observations a measured result can describe. */\nexport type EvaluationClaim = z.infer<typeof evaluationClaimSchema>\n\n/** Validate a claim before binding it to a sealed experiment or final evidence. */\nexport function defineEvaluationClaim(input: EvaluationClaim): EvaluationClaim {\n const parsed = evaluationClaimSchema.safeParse(input)\n if (!parsed.success)\n throw new ValidationError(`invalid evaluation claim: ${parsed.error.message}`)\n return Object.freeze({ ...parsed.data, population: Object.freeze(parsed.data.population) })\n}\n\nexport interface EvaluationUnitSummary {\n observations: number\n independentUnits: number\n units: Array<{ id: string; observations: number }>\n}\n\n/** Repetitions retain their denominator without becoming additional independent units. */\nexport function summarizeEvaluationUnits(\n claim: EvaluationClaim,\n rows: readonly object[],\n): EvaluationUnitSummary {\n const validated = defineEvaluationClaim(claim)\n const counts = new Map<string, number>()\n for (const [index, row] of rows.entries()) {\n if (row === null || typeof row !== 'object' || Array.isArray(row)) {\n throw new ValidationError(`evaluation claim: row ${index} must be an object`)\n }\n const value = readField(row as EvidenceRecord, validated.independentUnit)\n if (typeof value !== 'string' || !value.trim() || value.trim() !== value) {\n throw new ValidationError(\n `evaluation claim: row ${index} needs a nonempty string at '${validated.independentUnit}'`,\n )\n }\n counts.set(value, (counts.get(value) ?? 0) + 1)\n }\n return {\n observations: rows.length,\n independentUnits: counts.size,\n units: [...counts]\n .sort(([left], [right]) => compareCodeUnits(left, right))\n .map(([id, observations]) => ({ id, observations })),\n }\n}\n"],"mappings":";;;;;AAKA,MAAM,WAAW,EACd,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,QAAQ,UAAU,MAAM,KAAK,MAAM,KAAK;;AAG3C,MAAa,wBAAwB,EAClC,OAAO;CACN,KAAK,EAAE,KAAK;EAAC;EAAe;EAAc;CAAe,CAAC;CAC1D,YAAY,EAAE,OAAO;EAAE,IAAI;EAAU,aAAa;CAAS,CAAC,CAAC,CAAC,OAAO;CACrE,eAAe;CACf,iBAAiB;CACjB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,WAAW,CAAC;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, t as SearchShipConflictError, u as SEARCH_LEDGER_BATCH_MAX_BYTES } from "./search-shipper-C55V7HE3.js";
|
|
2
3
|
import { i as runRolloutReleaseCli } from "./hf-dataset-CRqtSjnR.js";
|
|
3
4
|
import { t as createChatClient } from "./chat-client-B_ItsSBw.js";
|
|
4
|
-
import { t as runAnalystBenchmarkCommand } from "./benchmark-command-
|
|
5
|
+
import { t as runAnalystBenchmarkCommand } from "./benchmark-command-3tZJnD82.js";
|
|
5
6
|
import { a as runRpcBatch, o as runRpcOnce, p as handleVersion, r as startServerAsync, s as buildOpenApi } from "./server-DtetGGoA.js";
|
|
6
7
|
import { t as runSupervisorRunCommand } from "./report-command-DKJ_yAIj.js";
|
|
7
8
|
import { writeFileSync } from "node:fs";
|
|
9
|
+
import { open } from "node:fs/promises";
|
|
8
10
|
//#region src/cli-config.ts
|
|
9
11
|
/**
|
|
10
12
|
* Provider configuration for the `agent-eval` binary.
|
|
@@ -74,6 +76,96 @@ function nonEmpty(value) {
|
|
|
74
76
|
return trimmed ? trimmed : void 0;
|
|
75
77
|
}
|
|
76
78
|
//#endregion
|
|
79
|
+
//#region src/search-command.ts
|
|
80
|
+
/**
|
|
81
|
+
* `agent-eval search <subcommand>`: work with a search ledger from a terminal.
|
|
82
|
+
*
|
|
83
|
+
* agent-eval search ship <search-ledger.jsonl> --run-kind optimization|eval [--content full|digests]
|
|
84
|
+
*
|
|
85
|
+
* `ship` sends the ledger to the hosted store named by `TANGLE_INGEST_URL`,
|
|
86
|
+
* `TANGLE_INGEST_API_KEY` and `TANGLE_TENANT_ID`, starting from the store's
|
|
87
|
+
* head, so it finishes or resumes a ship that a loop could not complete.
|
|
88
|
+
*/
|
|
89
|
+
const USAGE = `usage: agent-eval search ship <search-ledger.jsonl> --run-kind optimization|eval [--content full|digests]
|
|
90
|
+
|
|
91
|
+
Ships the ledger's entries, and the blobs they name, to the hosted store in
|
|
92
|
+
TANGLE_INGEST_URL (or TANGLE_ORCHESTRATOR_URL) as tenant TANGLE_TENANT_ID with
|
|
93
|
+
TANGLE_INGEST_API_KEY (or TANGLE_API_KEY). It starts from the store's head, so
|
|
94
|
+
running it again sends only what the store lacks. Prints the result as JSON.
|
|
95
|
+
Exits 1 when the store holds a different chain for the search.`;
|
|
96
|
+
async function runSearchCommand(argv) {
|
|
97
|
+
const [subcommand, ...rest] = argv;
|
|
98
|
+
if ([subcommand, ...rest].some((arg) => arg === void 0 || arg === "--help" || arg === "-h")) {
|
|
99
|
+
process.stdout.write(`${USAGE}\n`);
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
if (subcommand !== "ship") {
|
|
103
|
+
process.stderr.write(`unknown search subcommand: ${subcommand}\n${USAGE}\n`);
|
|
104
|
+
return 1;
|
|
105
|
+
}
|
|
106
|
+
const { path, flags } = parseShipArgs(rest);
|
|
107
|
+
const runKind = SearchRunKindSchema.safeParse(flags["run-kind"]);
|
|
108
|
+
if (!runKind.success) throw new Error(`--run-kind must be optimization or eval\n${USAGE}`);
|
|
109
|
+
const content = flags.content ?? "full";
|
|
110
|
+
if (content !== "full" && content !== "digests") throw new Error(`--content must be full or digests\n${USAGE}`);
|
|
111
|
+
const tenant = hostedTenantFromEnv();
|
|
112
|
+
if (!tenant) throw new Error("set TANGLE_INGEST_URL, TANGLE_INGEST_API_KEY and TANGLE_TENANT_ID to name the store");
|
|
113
|
+
const searchId = await firstLineSearchId(path);
|
|
114
|
+
try {
|
|
115
|
+
const shipped = await shipSearchLedger({
|
|
116
|
+
tenant,
|
|
117
|
+
ledger: {
|
|
118
|
+
path,
|
|
119
|
+
searchId
|
|
120
|
+
},
|
|
121
|
+
runKind: runKind.data,
|
|
122
|
+
content
|
|
123
|
+
});
|
|
124
|
+
process.stdout.write(`${JSON.stringify(shipped, null, 2)}\n`);
|
|
125
|
+
return shipped.head.nextSequence === shipped.localLines ? 0 : 1;
|
|
126
|
+
} catch (error) {
|
|
127
|
+
if (!(error instanceof SearchShipConflictError)) throw error;
|
|
128
|
+
process.stderr.write(`${error.message}\n`);
|
|
129
|
+
return 1;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function parseShipArgs(argv) {
|
|
133
|
+
const flags = {};
|
|
134
|
+
const positional = [];
|
|
135
|
+
for (let index = 0; index < argv.length; index++) {
|
|
136
|
+
const token = argv[index];
|
|
137
|
+
if (!token.startsWith("--")) {
|
|
138
|
+
positional.push(token);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const [name, inline] = token.slice(2).split("=", 2);
|
|
142
|
+
if (name !== "run-kind" && name !== "content") throw new Error(`unknown flag --${name}`);
|
|
143
|
+
const value = inline ?? argv[++index];
|
|
144
|
+
if (value === void 0) throw new Error(`--${name} needs a value`);
|
|
145
|
+
flags[name] = value;
|
|
146
|
+
}
|
|
147
|
+
if (positional.length !== 1) throw new Error(USAGE);
|
|
148
|
+
return {
|
|
149
|
+
path: positional[0],
|
|
150
|
+
flags
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
/** The ledger names its search on every line; read the first. */
|
|
154
|
+
async function firstLineSearchId(path) {
|
|
155
|
+
const handle = await open(path, "r");
|
|
156
|
+
try {
|
|
157
|
+
const bytes = Buffer.alloc(SEARCH_LEDGER_BATCH_MAX_BYTES + 1);
|
|
158
|
+
const { bytesRead } = await handle.read(bytes, 0, bytes.byteLength, 0);
|
|
159
|
+
const newline = bytes.subarray(0, bytesRead).indexOf(10);
|
|
160
|
+
if (newline < 0) throw new Error(`${path} holds no complete ledger line`);
|
|
161
|
+
const first = JSON.parse(bytes.toString("utf8", 0, newline));
|
|
162
|
+
if (typeof first.searchId !== "string") throw new Error(`${path} line 1 names no searchId`);
|
|
163
|
+
return first.searchId;
|
|
164
|
+
} finally {
|
|
165
|
+
await handle.close();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
77
169
|
//#region src/cli.ts
|
|
78
170
|
/**
|
|
79
171
|
* agent-eval CLI.
|
|
@@ -83,6 +175,7 @@ function nonEmpty(value) {
|
|
|
83
175
|
* agent-eval rpc-batch <method> # JSONL stdin → JSONL stdout
|
|
84
176
|
* agent-eval analyst-benchmark ... # benchmark a real-model trace analyst
|
|
85
177
|
* agent-eval supervisor-run report <runDir> [--format headline|markdown|json]
|
|
178
|
+
* agent-eval search ship <search-ledger.jsonl> --run-kind optimization|eval
|
|
86
179
|
* agent-eval openapi [--out path] # write OpenAPI spec
|
|
87
180
|
* agent-eval version
|
|
88
181
|
*
|
|
@@ -143,6 +236,9 @@ Commands:
|
|
|
143
236
|
Report one Runtime or loops supervisor run directory. The status comes
|
|
144
237
|
from Runtime's own result.json / failure.json; every missing measurement
|
|
145
238
|
stays named. Exits 1 when the directory cannot be read.
|
|
239
|
+
search ship <search-ledger.jsonl> --run-kind optimization|eval [--content full|digests]
|
|
240
|
+
Ship a search ledger and its blobs to the hosted store in TANGLE_INGEST_URL,
|
|
241
|
+
starting from the store's head. Run with --help for the environment it reads.
|
|
146
242
|
version
|
|
147
243
|
Print server + wire-protocol version JSON.
|
|
148
244
|
|
|
@@ -157,6 +253,7 @@ async function main() {
|
|
|
157
253
|
const { command, positional, flags } = parseArgs(process.argv.slice(2));
|
|
158
254
|
assertKnownFlags(command, flags);
|
|
159
255
|
if (command === "analyst-benchmark" && flags.help === "true") return await runAnalystBenchmarkCommand(process.argv.slice(3));
|
|
256
|
+
if (command === "search") return await runSearchCommand(process.argv.slice(3));
|
|
160
257
|
if (flags.help === "true") {
|
|
161
258
|
process.stdout.write(`${HELP}\n`);
|
|
162
259
|
return 0;
|
|
@@ -242,7 +339,7 @@ const FLAGS_BY_COMMAND = {
|
|
|
242
339
|
"": /* @__PURE__ */ new Set()
|
|
243
340
|
};
|
|
244
341
|
function assertKnownFlags(command, flags) {
|
|
245
|
-
if (command === "rollout-release" || command === "analyst-benchmark" || command === "supervisor-run") return;
|
|
342
|
+
if (command === "rollout-release" || command === "analyst-benchmark" || command === "supervisor-run" || command === "search") return;
|
|
246
343
|
const allowed = FLAGS_BY_COMMAND[command];
|
|
247
344
|
if (!allowed) return;
|
|
248
345
|
const unknown = Object.keys(flags).filter((flag) => !allowed.has(flag));
|
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;CACZ,MAAM,SAAS,iBAAiB;EAC9B,WAAW;EACX,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,GAAI,eAAe,EAAE,aAAa,IAAI,CAAC;CACzC,CAAC;CACD,OAAO;EACL,GAAG;E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AiB,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,gBAAgB;CACjD,MAAM,QACJ,SAAS,IAAI,oBAAoB,KAAK,SAAS,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY;CAE/F,IAAI,CAAC,WAAW,CAAC,QAAQ,OAAO,KAAA;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";
|
|
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,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T,YAAY,aAAa,gBAAgB;;iBAuI3B,mBAAmB,QAAQ,eAAe;;;;;;;;;;iBAqG1C,oBACd,YAAW,QAAQ;EAAkB,MAAM;IAC1C;;;iBAmBa,oBACd,YAAW,QAAQ;EAAkB,MAAM;IAC1C"}
|
package/dist/contract/index.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
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-
|
|
6
|
-
import { $i as RunImprovementLoopOptions, $r as GepaOptimizationRecipe, Ao as
|
|
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-BED3wBtX.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-BmQRs661.js";
|
|
6
|
+
import { $i as RunImprovementLoopOptions, $r as GepaOptimizationRecipe, Ao as fsCampaignStorage, Bi as ReferenceEquivalenceJudgeInput, Ci as compareOptimizationMethods, Dr as DefaultProductionGateOptions, Er as DefaultProductionGateCheck, Gi as runReferenceEquivalenceJudge, Gr as SkillOptOptimizationMethodConfig, Hi as ReferenceEquivalenceJudgeResult, Ji as llmJudge, Jr as skillOptOptimizationMethod, Ki as LlmJudgeDimension, Kr as SkillOptRunnerCommand, Lo as campaignSplitDigest, Mo as FinalEvidencePolicy, No as FinalEvidenceUse, Oo as CampaignStorage, 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, _o as runCampaign, ai as ExternalTextOptimizationMethodConfig, ci as ExternalOptimizationExample, di as CompareOptimizationMethodsOptions, ea as RunImprovementLoopResult, ei as GepaRunnerCommand, fi as OptimizationMethod, fo as RunEvalOptions, go as RunCampaignOptions, hi as OptimizationMethodInput, ho as CampaignCellRetryPolicy, ii as externalTextOptimizationMethod, jo as inMemoryCampaignStorage, kr as defaultProductionGate, li as ExternalTextEvaluationResponse, mo as CampaignCellFailureReceipt, ni as OpenAICompatibleOptimizerModel, oi as ExternalTextOptimizerContext, pi as OptimizationMethodComparison, po as runEval, 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-CzfnASj_.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 {
|
|
9
|
-
import { n as
|
|
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-
|
|
11
|
-
import { $ as
|
|
12
|
-
import { n as buildDefaultAnalystRegistry, t as DefaultAnalystRegistryOptions } from "../default-registry-
|
|
13
|
-
|
|
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-P28y7mI1.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-DH-MWH5f.js";
|
|
12
|
+
import { n as buildDefaultAnalystRegistry, t as DefaultAnalystRegistryOptions } from "../default-registry-DK_9aVJf.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 };
|