@tangle-network/agent-eval 0.148.0 → 0.150.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 +50 -0
- package/README.md +5 -1
- package/dist/analyst/index.d.ts +14 -14
- package/dist/analyst/index.d.ts.map +1 -1
- package/dist/analyst/index.js +4 -4
- package/dist/{backend-integrity-Bz8nSrRE.d.ts → backend-integrity-DaeroaEs.d.ts} +2 -2
- package/dist/{backend-integrity-Bz8nSrRE.d.ts.map → backend-integrity-DaeroaEs.d.ts.map} +1 -1
- package/dist/{benchmark-Cn7ZMFNW.d.ts → benchmark-A0E-JZ1H.d.ts} +3 -3
- package/dist/{benchmark-Cn7ZMFNW.d.ts.map → benchmark-A0E-JZ1H.d.ts.map} +1 -1
- package/dist/{benchmark-command-Cz4fDmsk.js → benchmark-command-CqGA0SJQ.js} +8 -7
- package/dist/benchmark-command-CqGA0SJQ.js.map +1 -0
- package/dist/benchmarks/index.d.ts +4 -4
- package/dist/benchmarks/index.js +3 -3
- package/dist/campaign/index.d.ts +9 -9
- package/dist/campaign/index.js +6 -6
- package/dist/{campaign-BcfXzmPM.js → campaign-CR6Yt5ZS.js} +80 -7
- package/dist/campaign-CR6Yt5ZS.js.map +1 -0
- package/dist/{capture-fetch-BAx3Gntt.d.ts → capture-fetch-Im0UN1i6.d.ts} +2 -2
- package/dist/{capture-fetch-BAx3Gntt.d.ts.map → capture-fetch-Im0UN1i6.d.ts.map} +1 -1
- package/dist/{chat-client-BX8Wh3fn.js → chat-client-sFiClniQ.js} +2 -2
- package/dist/{chat-client-BX8Wh3fn.js.map → chat-client-sFiClniQ.js.map} +1 -1
- package/dist/cli.js +2 -2
- package/dist/{client-BV7icIfy.d.ts → client-w6vVJhSp.d.ts} +2 -2
- package/dist/{client-BV7icIfy.d.ts.map → client-w6vVJhSp.d.ts.map} +1 -1
- package/dist/contract/index.d.ts +10 -10
- package/dist/contract/index.js +5 -5
- package/dist/{default-registry-BUtRMRKk.d.ts → default-registry-BhRNsP-D.d.ts} +6 -6
- package/dist/{default-registry-BUtRMRKk.d.ts.map → default-registry-BhRNsP-D.d.ts.map} +1 -1
- package/dist/{define-agent-eval-CvZQW4u9.js → define-agent-eval-ChrtErmg.js} +3 -3
- package/dist/define-agent-eval-ChrtErmg.js.map +1 -0
- package/dist/{define-agent-eval-hXLUBKtb.d.ts → define-agent-eval-Cw3mkB4-.d.ts} +6 -7
- package/dist/define-agent-eval-Cw3mkB4-.d.ts.map +1 -0
- package/dist/{dspy-rlm-engine-BmtOl_kP.js → dspy-rlm-engine-Csi3CUAT.js} +2 -2
- package/dist/{dspy-rlm-engine-BmtOl_kP.js.map → dspy-rlm-engine-Csi3CUAT.js.map} +1 -1
- package/dist/{engine-CIy18RTX.d.ts → engine-CgQdUh-r.d.ts} +4 -4
- package/dist/{engine-CIy18RTX.d.ts.map → engine-CgQdUh-r.d.ts.map} +1 -1
- package/dist/{eval-campaign-bmZ6NIIP.js → eval-campaign-Czc2TcW5.js} +2 -2
- package/dist/{eval-campaign-bmZ6NIIP.js.map → eval-campaign-Czc2TcW5.js.map} +1 -1
- package/dist/{exact-types-rdKFzEnK.d.ts → exact-types-D9_T83Ol.d.ts} +2 -2
- package/dist/{exact-types-rdKFzEnK.d.ts.map → exact-types-D9_T83Ol.d.ts.map} +1 -1
- package/dist/experiment/index.d.ts +73 -4
- package/dist/experiment/index.d.ts.map +1 -1
- package/dist/experiment/index.js +175 -1
- package/dist/experiment/index.js.map +1 -1
- package/dist/{experiment-tracker-D9VHwRm-.d.ts → experiment-tracker-Cp9ougHs.d.ts} +2 -2
- package/dist/{experiment-tracker-D9VHwRm-.d.ts.map → experiment-tracker-Cp9ougHs.d.ts.map} +1 -1
- package/dist/{external-optimizer-contracts-CSjDLLmr.d.ts → external-optimizer-contracts-mbhR9Ldu.d.ts} +13 -6
- package/dist/{external-optimizer-contracts-CSjDLLmr.d.ts.map → external-optimizer-contracts-mbhR9Ldu.d.ts.map} +1 -1
- package/dist/{external-optimizer-process-C4AyCcQd.js → external-optimizer-process-tDe72VRO.js} +4 -4
- package/dist/{external-optimizer-process-C4AyCcQd.js.map → external-optimizer-process-tDe72VRO.js.map} +1 -1
- package/dist/{external-optimizer-subprocess-DU1KM8yV.js → external-optimizer-subprocess-BepyNwtj.js} +341 -25
- package/dist/external-optimizer-subprocess-BepyNwtj.js.map +1 -0
- package/dist/{feedback-trajectory-niGeR6uJ.d.ts → feedback-trajectory-Cc9M2tNF.d.ts} +3 -3
- package/dist/{feedback-trajectory-niGeR6uJ.d.ts.map → feedback-trajectory-Cc9M2tNF.d.ts.map} +1 -1
- package/dist/fuzz.d.ts +1 -1
- package/dist/hosted/index.d.ts +2 -2
- package/dist/{index-gtjtfLEJ.d.ts → index-DL4MJuJL.d.ts} +8 -8
- package/dist/{index-gtjtfLEJ.d.ts.map → index-DL4MJuJL.d.ts.map} +1 -1
- package/dist/index-DjpxROrT.d.ts +1 -0
- package/dist/{index-Dzn8Q3C2.d.ts → index-dh0kp2GM.d.ts} +42 -11
- package/dist/index-dh0kp2GM.d.ts.map +1 -0
- package/dist/index.d.ts +21 -21
- package/dist/index.js +13 -20
- package/dist/index.js.map +1 -1
- package/dist/{integrity-CGfpTE5-.d.ts → integrity-D2MAlC_K.d.ts} +2 -2
- package/dist/{integrity-CGfpTE5-.d.ts.map → integrity-D2MAlC_K.d.ts.map} +1 -1
- package/dist/{llm-client-BMuxYoZy.js → llm-client-CxyJ8Oft.js} +15 -6
- package/dist/llm-client-CxyJ8Oft.js.map +1 -0
- package/dist/{llm-judge-DWq1Ptco.js → llm-judge-D7UuMI2t.js} +4 -3
- package/dist/llm-judge-D7UuMI2t.js.map +1 -0
- package/dist/{matrix-Bc111FKv.d.ts → matrix-D3hL68uV.d.ts} +2 -2
- package/dist/{matrix-Bc111FKv.d.ts.map → matrix-D3hL68uV.d.ts.map} +1 -1
- package/dist/meta-eval/index.d.ts +1 -1
- package/dist/{multi-layer-verifier-DIguZc8Z.d.ts → multi-layer-verifier-BUaQ4C17.d.ts} +3 -3
- package/dist/{multi-layer-verifier-DIguZc8Z.d.ts.map → multi-layer-verifier-BUaQ4C17.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/{produced-state-C0oJ4vr-.js → produced-state-WJs_enbZ.js} +3 -3
- package/dist/{produced-state-C0oJ4vr-.js.map → produced-state-WJs_enbZ.js.map} +1 -1
- package/dist/{promotion-policy-CewdjfCJ.d.ts → promotion-policy-DYRzXdTV.d.ts} +2 -2
- package/dist/{promotion-policy-CewdjfCJ.d.ts.map → promotion-policy-DYRzXdTV.d.ts.map} +1 -1
- package/dist/{provenance-DA-Pmyfv.d.ts → provenance-Bh9k3sjl.d.ts} +17 -6
- package/dist/{provenance-DA-Pmyfv.d.ts.map → provenance-Bh9k3sjl.d.ts.map} +1 -1
- package/dist/{registry-CaqJIDdN.d.ts → registry-DhpX9Bsg.d.ts} +4 -4
- package/dist/{registry-CaqJIDdN.d.ts.map → registry-DhpX9Bsg.d.ts.map} +1 -1
- package/dist/{researcher-BySlpla_.d.ts → researcher-CbCK-ppF.d.ts} +3 -3
- package/dist/{researcher-BySlpla_.d.ts.map → researcher-CbCK-ppF.d.ts.map} +1 -1
- package/dist/{reward-hacking-Bu8ev6PR.d.ts → reward-hacking-62tojkQd.d.ts} +2 -2
- package/dist/{reward-hacking-Bu8ev6PR.d.ts.map → reward-hacking-62tojkQd.d.ts.map} +1 -1
- package/dist/rl.d.ts +4 -4
- package/dist/rl.js +1 -1
- package/dist/{semantic-concept-judge-BI7Rrl5-.js → semantic-concept-judge-B7KPD57W.js} +2 -2
- package/dist/{semantic-concept-judge-BI7Rrl5-.js.map → semantic-concept-judge-B7KPD57W.js.map} +1 -1
- package/dist/{series-convergence-D2fsoJ2w.d.ts → series-convergence-VhTad5TM.d.ts} +2 -2
- package/dist/{series-convergence-D2fsoJ2w.d.ts.map → series-convergence-VhTad5TM.d.ts.map} +1 -1
- package/dist/{server-D9wQclzG.js → server-DNiUVirV.js} +2 -2
- package/dist/{server-D9wQclzG.js.map → server-DNiUVirV.js.map} +1 -1
- package/dist/{skillopt-optimization-method-CrY0OG17.d.ts → skillopt-optimization-method-BtgL6PMH.d.ts} +20 -14
- package/dist/{skillopt-optimization-method-CrY0OG17.d.ts.map → skillopt-optimization-method-BtgL6PMH.d.ts.map} +1 -1
- package/dist/{skillopt-optimization-method-Donmq4sq.js → skillopt-optimization-method-L8vi4h4m.js} +92 -14
- package/dist/skillopt-optimization-method-L8vi4h4m.js.map +1 -0
- package/dist/{statistical-heldout-uxSpFEjm.d.ts → statistical-heldout-Caxd30ZF.d.ts} +2 -2
- package/dist/{statistical-heldout-uxSpFEjm.d.ts.map → statistical-heldout-Caxd30ZF.d.ts.map} +1 -1
- package/dist/{store-tool-spans-D5FhM0_A.d.ts → store-tool-spans-BGg2QFk1.d.ts} +4 -4
- package/dist/{store-tool-spans-D5FhM0_A.d.ts.map → store-tool-spans-BGg2QFk1.d.ts.map} +1 -1
- package/dist/{tool-groups-zpufabP8.d.ts → tool-groups-BuhFx38z.d.ts} +3 -3
- package/dist/tool-groups-BuhFx38z.d.ts.map +1 -0
- package/dist/trace-repair/index.d.ts +1 -1
- package/dist/traces.d.ts +7 -7
- package/dist/{types-ColZlZtc.d.ts → types-B61iI2ZG.d.ts} +2 -2
- package/dist/{types-ColZlZtc.d.ts.map → types-B61iI2ZG.d.ts.map} +1 -1
- package/dist/{types-BohHewKK.d.ts → types-BNbhD_Vj.d.ts} +2 -2
- package/dist/{types-BohHewKK.d.ts.map → types-BNbhD_Vj.d.ts.map} +1 -1
- package/dist/{types-DOhGq4S1.d.ts → types-COAJy8Ku.d.ts} +15 -3
- package/dist/types-COAJy8Ku.d.ts.map +1 -0
- package/dist/{types-C1Bmeb8X.d.ts → types-COEjZMLY.d.ts} +3 -3
- package/dist/{types-C1Bmeb8X.d.ts.map → types-COEjZMLY.d.ts.map} +1 -1
- package/dist/wire/index.d.ts +2 -2
- package/dist/wire/index.js +1 -1
- package/docs/campaign-proposers.md +60 -3
- package/docs/experiment.md +2 -0
- package/docs/feature-guide.md +1 -1
- package/docs/multishot-golden-records.md +3 -0
- package/package.json +4 -2
- package/dist/benchmark-command-Cz4fDmsk.js.map +0 -1
- package/dist/campaign-BcfXzmPM.js.map +0 -1
- package/dist/define-agent-eval-CvZQW4u9.js.map +0 -1
- package/dist/define-agent-eval-hXLUBKtb.d.ts.map +0 -1
- package/dist/external-optimizer-subprocess-DU1KM8yV.js.map +0 -1
- package/dist/index-CKblBxtr.d.ts +0 -1
- package/dist/index-Dzn8Q3C2.d.ts.map +0 -1
- package/dist/llm-client-BMuxYoZy.js.map +0 -1
- package/dist/llm-judge-DWq1Ptco.js.map +0 -1
- package/dist/skillopt-optimization-method-Donmq4sq.js.map +0 -1
- package/dist/tool-groups-zpufabP8.d.ts.map +0 -1
- package/dist/types-DOhGq4S1.d.ts.map +0 -1
package/dist/{skillopt-optimization-method-Donmq4sq.js → skillopt-optimization-method-L8vi4h4m.js}
RENAMED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { n as contentHash, t as canonicalJson } from "./verdict-cache-mZf5FEiY.js";
|
|
2
|
-
import { C as optimizationTokenUsageFromSummary, G as assertGepaCandidatePopulationSummary, K as readGepaCandidatePopulationArtifact, S as costFromLedgerSummary, b as combineComparisonCosts, et as runCampaign, k as surfaceContentHash, t as llmJudge, z as campaignBreakdown } from "./llm-judge-
|
|
3
|
-
import { _ as resolveExternalOptimizerCallbackLimits, b as createRunCostLedger, d as assertJsonValue, f as assertNoCredentialValues, g as removeCredentialEnvironment, h as isRecord, i as startExternalOptimizerModelProxy, m as isExternalTextCandidate, n as closeExternalOptimizerResources, p as isCandidateText, r as runWithCleanup, t as runExternalOptimizerProcess, u as assertExternalOptimizerModelBudget, v as resolveExternalOptimizerProcessLimits, x as fsCampaignStorage, y as safePathComponent } from "./external-optimizer-subprocess-
|
|
2
|
+
import { C as optimizationTokenUsageFromSummary, G as assertGepaCandidatePopulationSummary, K as readGepaCandidatePopulationArtifact, S as costFromLedgerSummary, b as combineComparisonCosts, et as runCampaign, k as surfaceContentHash, t as llmJudge, z as campaignBreakdown } from "./llm-judge-D7UuMI2t.js";
|
|
3
|
+
import { _ as resolveExternalOptimizerCallbackLimits, b as createRunCostLedger, d as assertJsonValue, f as assertNoCredentialValues, g as removeCredentialEnvironment, h as isRecord, i as startExternalOptimizerModelProxy, m as isExternalTextCandidate, n as closeExternalOptimizerResources, p as isCandidateText, r as runWithCleanup, t as runExternalOptimizerProcess, u as assertExternalOptimizerModelBudget, v as resolveExternalOptimizerProcessLimits, x as fsCampaignStorage, y as safePathComponent } from "./external-optimizer-subprocess-BepyNwtj.js";
|
|
4
4
|
import { a as heldoutSignificance, o as pairHoldout } from "./power-preflight-DEw-uC7q.js";
|
|
5
5
|
import { c as deepFreezeCanonicalJson } from "./types-BI4fT3HN.js";
|
|
6
|
-
import {
|
|
6
|
+
import { y as assertServedModelPolicy } from "./llm-client-CxyJ8Oft.js";
|
|
7
|
+
import { n as acquireSingleRunLock, t as startExternalOptimizerCallback } from "./external-optimizer-process-tDe72VRO.js";
|
|
7
8
|
import { createHash, randomBytes } from "node:crypto";
|
|
8
9
|
import { z } from "zod";
|
|
9
10
|
import { mkdir } from "node:fs/promises";
|
|
@@ -1188,6 +1189,8 @@ function assertOptimizerModel(value, label) {
|
|
|
1188
1189
|
if (!value || typeof value !== "object") throw new Error(`${label} is required`);
|
|
1189
1190
|
for (const [field, item] of [["model", value.model], ["callRef", value.callRef]]) if (typeof item !== "string" || !item.trim() || item.trim() !== item) throw new Error(`${label}.${field} must be trimmed and non-empty`);
|
|
1190
1191
|
if (typeof value.call !== "function") throw new Error(`${label}.call must be a function`);
|
|
1192
|
+
assertServedModelPolicy(value.servedModelPolicy, `${label}.servedModelPolicy`);
|
|
1193
|
+
if (value.anthropicEndpoint !== void 0 && typeof value.anthropicEndpoint !== "boolean") throw new Error(`${label}.anthropicEndpoint must be a boolean`);
|
|
1191
1194
|
assertExternalOptimizerModelBudget(value.budget, `${label}.budget`);
|
|
1192
1195
|
}
|
|
1193
1196
|
function snapshotOptimizerModel(value) {
|
|
@@ -1195,9 +1198,20 @@ function snapshotOptimizerModel(value) {
|
|
|
1195
1198
|
model: value.model,
|
|
1196
1199
|
budget: structuredClone(value.budget),
|
|
1197
1200
|
call: value.call,
|
|
1198
|
-
callRef: value.callRef
|
|
1201
|
+
callRef: value.callRef,
|
|
1202
|
+
...value.servedModelPolicy ? { servedModelPolicy: value.servedModelPolicy } : {},
|
|
1203
|
+
...value.anthropicEndpoint === void 0 ? {} : { anthropicEndpoint: value.anthropicEndpoint }
|
|
1199
1204
|
};
|
|
1200
1205
|
}
|
|
1206
|
+
/**
|
|
1207
|
+
* GEPA engines that drive a `claude` CLI subprocess. With
|
|
1208
|
+
* `optimizer.anthropicEndpoint: true` their model traffic is metered through
|
|
1209
|
+
* the loopback proxy's Anthropic route instead of being refused.
|
|
1210
|
+
*/
|
|
1211
|
+
const GEPA_AGENT_CLI_ENGINES = /* @__PURE__ */ new Set(["autoresearch", "meta_harness"]);
|
|
1212
|
+
function gepaRecipeHasAgentCliEngine(recipe) {
|
|
1213
|
+
return recipeEngineOptions(recipe).some((run) => GEPA_AGENT_CLI_ENGINES.has(run.engine));
|
|
1214
|
+
}
|
|
1201
1215
|
const MAX_TIMER_DELAY_MS$1 = 2147483647;
|
|
1202
1216
|
function snapshotGepaOptimizationConfig(config) {
|
|
1203
1217
|
const runner = snapshotExternalOptimizerRunner(config.runner);
|
|
@@ -1229,7 +1243,7 @@ function assertGepaOptimizationConfig(config) {
|
|
|
1229
1243
|
if (config.optimizer !== void 0) {
|
|
1230
1244
|
assertOptimizerModel(config.optimizer, "gepaOptimizationMethod: optimizer");
|
|
1231
1245
|
if (config.engineModules?.length) throw new Error("gepaOptimizationMethod: optimizer cannot be combined with engineModules because proxied reflection requires the built-in GEPA engine");
|
|
1232
|
-
assertProxiedGepaRecipe(config.recipe);
|
|
1246
|
+
assertProxiedGepaRecipe(config.recipe, config.optimizer);
|
|
1233
1247
|
}
|
|
1234
1248
|
}
|
|
1235
1249
|
function gepaRecipeSupportsResume(recipe) {
|
|
@@ -1318,9 +1332,17 @@ function assertEngineOptions(run, label) {
|
|
|
1318
1332
|
if (run.sandbox !== void 0 && typeof run.sandbox !== "boolean") throw new Error(`gepaOptimizationMethod: ${label}.sandbox must be a boolean`);
|
|
1319
1333
|
assertJsonValue(run.engineConfig ?? {}, `gepaOptimizationMethod: ${label}.engineConfig`);
|
|
1320
1334
|
assertNoCredentialValues(run.engineConfig ?? {}, `gepaOptimizationMethod: ${label}.engineConfig`);
|
|
1335
|
+
if (run.engine === "gepa") {
|
|
1336
|
+
const nestedEngine = isRecord(run.engineConfig?.engine) ? run.engineConfig.engine : void 0;
|
|
1337
|
+
if (nestedEngine && Object.hasOwn(nestedEngine, "seed")) throw new Error(`gepaOptimizationMethod: ${label}.engineConfig.engine.seed conflicts with the comparison seed; the bridge forwards the run seed`);
|
|
1338
|
+
}
|
|
1321
1339
|
}
|
|
1322
|
-
function assertProxiedGepaRecipe(recipe) {
|
|
1340
|
+
function assertProxiedGepaRecipe(recipe, optimizer) {
|
|
1323
1341
|
for (const [index, run] of recipeEngineOptions(recipe).entries()) {
|
|
1342
|
+
if (GEPA_AGENT_CLI_ENGINES.has(run.engine)) {
|
|
1343
|
+
assertProxiedAgentCliEngine(run, index, optimizer);
|
|
1344
|
+
continue;
|
|
1345
|
+
}
|
|
1324
1346
|
if (run.engine !== "gepa") throw new Error(`gepaOptimizationMethod: optimizer requires GEPA's 'gepa' engine; recipe engine ${index} is '${run.engine}'`);
|
|
1325
1347
|
const reflection = isRecord(run.engineConfig?.reflection) ? run.engineConfig.reflection : void 0;
|
|
1326
1348
|
if (reflection && Object.hasOwn(reflection, "reflection_lm")) throw new Error("gepaOptimizationMethod: optimizer replaces engineConfig.reflection.reflection_lm; remove the duplicate setting");
|
|
@@ -1337,6 +1359,11 @@ function assertProxiedGepaRecipe(recipe) {
|
|
|
1337
1359
|
].some((key) => Object.hasOwn(reflectionOptions, key))) throw new Error("gepaOptimizationMethod: proxied reflection transport settings belong in optimizer");
|
|
1338
1360
|
}
|
|
1339
1361
|
}
|
|
1362
|
+
function assertProxiedAgentCliEngine(run, index, optimizer) {
|
|
1363
|
+
if (optimizer.anthropicEndpoint !== true) throw new Error(`gepaOptimizationMethod: agent engine '${run.engine}' (recipe engine ${index}) requires optimizer.anthropicEndpoint: true so the claude CLI meters through the loopback proxy`);
|
|
1364
|
+
if (run.engineConfig?.model !== optimizer.model) throw new Error(`gepaOptimizationMethod: recipe engine ${index} ('${run.engine}') must set engineConfig.model to the optimizer model '${optimizer.model}'`);
|
|
1365
|
+
if (run.engineConfig && Object.hasOwn(run.engineConfig, "max_thinking_tokens")) throw new Error(`gepaOptimizationMethod: recipe engine ${index} ('${run.engine}') cannot set engineConfig.max_thinking_tokens through the Anthropic endpoint`);
|
|
1366
|
+
}
|
|
1340
1367
|
function assertParallelControls(recipe) {
|
|
1341
1368
|
if (recipe.maxWorkers !== void 0) assertPositiveSafeInteger$1(recipe.maxWorkers, "recipe.maxWorkers");
|
|
1342
1369
|
}
|
|
@@ -1360,6 +1387,7 @@ function assertGepaBridgeOutput(result, name, maxCandidateChars, recipeKind, max
|
|
|
1360
1387
|
if (!isGepaCandidate(result.bestCandidate, maxCandidateChars) || expectsComponents !== (typeof result.bestCandidate !== "string")) throw new Error(`${name}: GEPA bridge returned an invalid candidate`);
|
|
1361
1388
|
if (!Number.isFinite(result.bestScore)) throw new Error(`${name}: GEPA bridge returned an invalid bestScore`);
|
|
1362
1389
|
if (!Number.isSafeInteger(result.totalEvaluations) || result.totalEvaluations < 0 || result.totalEvaluations > maxEvaluations) throw new Error(`${name}: GEPA bridge returned an invalid totalEvaluations`);
|
|
1390
|
+
if (result.upstreamReportedEvaluations !== void 0 && (!Number.isSafeInteger(result.upstreamReportedEvaluations) || result.upstreamReportedEvaluations < 0)) throw new Error(`${name}: GEPA bridge returned an invalid upstreamReportedEvaluations`);
|
|
1363
1391
|
if (result.proposerCostUsd !== void 0 && (!Number.isFinite(result.proposerCostUsd) || result.proposerCostUsd < 0)) throw new Error(`${name}: GEPA bridge returned an invalid proposerCostUsd`);
|
|
1364
1392
|
if (result.proposerCostAccounting !== "metered" && result.proposerCostAccounting !== "reported" && result.proposerCostAccounting !== "unavailable") throw new Error(`${name}: GEPA bridge returned invalid proposerCostAccounting`);
|
|
1365
1393
|
if (result.proposerCostAccounting !== "unavailable" !== (result.proposerCostUsd !== void 0)) throw new Error(`${name}: GEPA bridge returned inconsistent proposer cost accounting`);
|
|
@@ -1368,6 +1396,7 @@ function assertGepaBridgeOutput(result, name, maxCandidateChars, recipeKind, max
|
|
|
1368
1396
|
assertExternalOptimizerPackageSource(result.upstream, "gepa", name, "GEPA");
|
|
1369
1397
|
if (typeof result.runId !== "string" || result.runId.length === 0 || result.runId !== result.runId.trim()) throw new Error(`${name}: GEPA bridge returned an invalid runId`);
|
|
1370
1398
|
if (typeof result.resumed !== "boolean") throw new Error(`${name}: GEPA bridge returned an invalid resumed flag`);
|
|
1399
|
+
if (typeof result.seedApplied !== "boolean") throw new Error(`${name}: GEPA bridge returned an invalid seedApplied flag; upgrade agent-eval-rpc to a release that forwards the run seed`);
|
|
1371
1400
|
if (result.candidatePopulation !== void 0) {
|
|
1372
1401
|
assertGepaCandidatePopulationSummary(result.candidatePopulation);
|
|
1373
1402
|
if (result.candidatePopulation.runId !== result.runId) throw new Error(`${name}: GEPA candidate population has a different run ID`);
|
|
@@ -1388,6 +1417,27 @@ function isGepaCandidate(value, maxChars) {
|
|
|
1388
1417
|
* method without a test-set field. The local callback routes every candidate
|
|
1389
1418
|
* evaluation through the same dispatch and judges used by other methods.
|
|
1390
1419
|
*/
|
|
1420
|
+
/**
|
|
1421
|
+
* Environment for a bridge child that spawns `claude` CLI subprocesses.
|
|
1422
|
+
*
|
|
1423
|
+
* Both agent CLI engines start the CLI with the bridge's own environment, so
|
|
1424
|
+
* these variables travel bridge → engine → CLI. They merge AFTER
|
|
1425
|
+
* `removeCredentialEnvironment`: the ephemeral loopback token is the only
|
|
1426
|
+
* credential the child may see, and a caller-supplied ANTHROPIC_AUTH_TOKEN is
|
|
1427
|
+
* stripped like any other credential.
|
|
1428
|
+
*/
|
|
1429
|
+
function anthropicShimEnvironment(proxy, optimizer) {
|
|
1430
|
+
return {
|
|
1431
|
+
ANTHROPIC_BASE_URL: new URL(proxy.baseUrl).origin,
|
|
1432
|
+
ANTHROPIC_AUTH_TOKEN: proxy.apiKey,
|
|
1433
|
+
ANTHROPIC_MODEL: optimizer.model,
|
|
1434
|
+
ANTHROPIC_SMALL_FAST_MODEL: optimizer.model,
|
|
1435
|
+
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1",
|
|
1436
|
+
CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING: "1",
|
|
1437
|
+
CLAUDE_CODE_MAX_OUTPUT_TOKENS: String(Math.min(optimizer.budget.maxOutputTokensPerRequest, 64e3)),
|
|
1438
|
+
API_TIMEOUT_MS: String((optimizer.budget.requestTimeoutMs ?? 3e5) + 6e4)
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1391
1441
|
function gepaOptimizationMethod(config) {
|
|
1392
1442
|
assertGepaOptimizationConfig(config);
|
|
1393
1443
|
config = snapshotGepaOptimizationConfig(config);
|
|
@@ -1450,7 +1500,8 @@ function gepaOptimizationMethod(config) {
|
|
|
1450
1500
|
optimizerModel: config.optimizer ? {
|
|
1451
1501
|
model: config.optimizer.model,
|
|
1452
1502
|
callRef: config.optimizer.callRef,
|
|
1453
|
-
budget: config.optimizer.budget
|
|
1503
|
+
budget: config.optimizer.budget,
|
|
1504
|
+
...config.optimizer.anthropicEndpoint === true ? { anthropicEndpoint: true } : {}
|
|
1454
1505
|
} : null,
|
|
1455
1506
|
runner: externalOptimizerRunnerIdentity(bridgeRunner, "agent_eval_rpc.gepa_bridge"),
|
|
1456
1507
|
trustResumeState: config.trustResumeState === true
|
|
@@ -1506,6 +1557,18 @@ function gepaOptimizationMethod(config) {
|
|
|
1506
1557
|
});
|
|
1507
1558
|
const runnerEnv = bridgeRunner?.env ?? {};
|
|
1508
1559
|
let modelProxy;
|
|
1560
|
+
const bridgeRunnerForSpawn = () => {
|
|
1561
|
+
if (!modelProxy) return bridgeRunner;
|
|
1562
|
+
const anthropicChildEnv = config.optimizer?.anthropicEndpoint === true && gepaRecipeHasAgentCliEngine(config.recipe) ? anthropicShimEnvironment(modelProxy, config.optimizer) : void 0;
|
|
1563
|
+
if (!bridgeRunner && !anthropicChildEnv) return bridgeRunner;
|
|
1564
|
+
return {
|
|
1565
|
+
...bridgeRunner ?? {},
|
|
1566
|
+
env: {
|
|
1567
|
+
...removeCredentialEnvironment(runnerEnv),
|
|
1568
|
+
...anthropicChildEnv ?? {}
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
};
|
|
1509
1572
|
const closeResources = () => closeExternalOptimizerResources({
|
|
1510
1573
|
label: name,
|
|
1511
1574
|
callback,
|
|
@@ -1526,6 +1589,8 @@ function gepaOptimizationMethod(config) {
|
|
|
1526
1589
|
recordExecution: executionLog.observe,
|
|
1527
1590
|
model: config.optimizer.model,
|
|
1528
1591
|
budget: config.optimizer.budget,
|
|
1592
|
+
...config.optimizer.servedModelPolicy ? { servedModelPolicy: config.optimizer.servedModelPolicy } : {},
|
|
1593
|
+
...config.optimizer.anthropicEndpoint === true ? { anthropicEndpoint: true } : {},
|
|
1529
1594
|
costLedger,
|
|
1530
1595
|
phase: "gepa.optimizer-model",
|
|
1531
1596
|
actor: name,
|
|
@@ -1571,13 +1636,11 @@ function gepaOptimizationMethod(config) {
|
|
|
1571
1636
|
baseUrl: modelProxy.baseUrl,
|
|
1572
1637
|
apiKey: modelProxy.apiKey,
|
|
1573
1638
|
model: config.optimizer.model,
|
|
1574
|
-
budget: config.optimizer.budget
|
|
1639
|
+
budget: config.optimizer.budget,
|
|
1640
|
+
...config.optimizer.anthropicEndpoint === true ? { anthropicEndpoint: true } : {}
|
|
1575
1641
|
} } : {}
|
|
1576
1642
|
},
|
|
1577
|
-
runner:
|
|
1578
|
-
...bridgeRunner,
|
|
1579
|
-
env: removeCredentialEnvironment(runnerEnv)
|
|
1580
|
-
} : bridgeRunner,
|
|
1643
|
+
runner: bridgeRunnerForSpawn(),
|
|
1581
1644
|
timeoutMs,
|
|
1582
1645
|
...signal ? { signal } : {}
|
|
1583
1646
|
}),
|
|
@@ -1624,7 +1687,18 @@ function gepaOptimizationMethod(config) {
|
|
|
1624
1687
|
const reportedProposerCost = result.proposerCostUsd ?? 0;
|
|
1625
1688
|
if (modelProxy) {
|
|
1626
1689
|
modelProxy.assertExecutionComplete();
|
|
1627
|
-
|
|
1690
|
+
const wires = modelProxy.wireUsage();
|
|
1691
|
+
assertExternalOptimizerCompletionCount(result.tokenUsage, wires.openai.requestAttempts, wires.openai.successfulCompletions, name, "GEPA");
|
|
1692
|
+
if (config.optimizer?.anthropicEndpoint === true) {
|
|
1693
|
+
const anthropicReceipts = costLedger.list({
|
|
1694
|
+
phase: "gepa.optimizer-model",
|
|
1695
|
+
tags: {
|
|
1696
|
+
...runBudget.attemptTags,
|
|
1697
|
+
wire: "anthropic"
|
|
1698
|
+
}
|
|
1699
|
+
});
|
|
1700
|
+
if (anthropicReceipts.length !== wires.anthropic.requestAttempts) throw new Error(`${name}: the Anthropic endpoint admitted ${wires.anthropic.requestAttempts} model calls but the ledger holds ${anthropicReceipts.length} receipts`);
|
|
1701
|
+
}
|
|
1628
1702
|
}
|
|
1629
1703
|
const tokenUsage = modelProxy ? optimizationTokenUsageFromSummary(optimizerSummary, optimizerReceipts) : void 0;
|
|
1630
1704
|
const runtime = observedExternalOptimizerRuntime(runtimeIdentity);
|
|
@@ -1661,10 +1735,13 @@ function gepaOptimizationMethod(config) {
|
|
|
1661
1735
|
optimizerModel: config.optimizer.model,
|
|
1662
1736
|
optimizerCallRef: config.optimizer.callRef
|
|
1663
1737
|
} : {},
|
|
1738
|
+
...modelProxy && config.optimizer?.anthropicEndpoint === true ? { anthropicEndpoint: modelProxy.wireUsage().anthropic } : {},
|
|
1664
1739
|
compatibleRunId,
|
|
1665
1740
|
runId,
|
|
1666
1741
|
resumed: result.resumed,
|
|
1742
|
+
seedApplied: result.seedApplied,
|
|
1667
1743
|
evaluationCount: runBudget.acceptedEvaluations(),
|
|
1744
|
+
...result.upstreamReportedEvaluations !== void 0 ? { upstreamReportedEvaluations: result.upstreamReportedEvaluations } : {},
|
|
1668
1745
|
artifactDir: outputDir,
|
|
1669
1746
|
...tokenUsage ? { tokenUsage } : {},
|
|
1670
1747
|
observations: observationLog.summary(),
|
|
@@ -1889,6 +1966,7 @@ function skillOptOptimizationMethod(config) {
|
|
|
1889
1966
|
recordExecution: executionLog.observe,
|
|
1890
1967
|
model: config.optimizer.model,
|
|
1891
1968
|
budget: config.optimizer.budget,
|
|
1969
|
+
...config.optimizer.servedModelPolicy ? { servedModelPolicy: config.optimizer.servedModelPolicy } : {},
|
|
1892
1970
|
costLedger,
|
|
1893
1971
|
phase: "skillopt.optimizer-model",
|
|
1894
1972
|
actor: name,
|
|
@@ -2019,4 +2097,4 @@ function skillOptOptimizationMethod(config) {
|
|
|
2019
2097
|
//#endregion
|
|
2020
2098
|
export { externalTextOptimizationMethod as a, REFERENCE_EQUIVALENCE_INPUT_LIMITS as c, runReferenceEquivalenceJudge as d, composeGate as i, REFERENCE_EQUIVALENCE_JUDGE_VERSION as l, gepaOptimizationMethod as n, decodeExternalTextCandidate as o, heldOutGate as r, readExternalOptimizerObservationArtifact as s, skillOptOptimizationMethod as t, createReferenceEquivalenceJudge as u };
|
|
2021
2099
|
|
|
2022
|
-
//# sourceMappingURL=skillopt-optimization-method-
|
|
2100
|
+
//# sourceMappingURL=skillopt-optimization-method-L8vi4h4m.js.map
|