@tangle-network/agent-eval 0.144.9 → 0.144.10
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 +7 -0
- package/README.md +3 -0
- package/dist/analyst/index.d.ts +1 -1
- package/dist/analyst/index.js +7 -7
- package/dist/{benchmark-B181aMF9.js → benchmark-CWeqGl7x.js} +2 -2
- package/dist/{benchmark-B181aMF9.js.map → benchmark-CWeqGl7x.js.map} +1 -1
- package/dist/{benchmark-command-Dtym4pA-.js → benchmark-command-D3fEnKdf.js} +8 -8
- package/dist/{benchmark-command-Dtym4pA-.js.map → benchmark-command-D3fEnKdf.js.map} +1 -1
- package/dist/benchmarks/index.d.ts +1 -1
- package/dist/benchmarks/index.js +1 -1
- package/dist/{benchmarks-Ce4Ae5fX.js → benchmarks-BzqyTvAr.js} +4 -4
- package/dist/{benchmarks-Ce4Ae5fX.js.map → benchmarks-BzqyTvAr.js.map} +1 -1
- package/dist/campaign/index.d.ts +4 -4
- package/dist/campaign/index.js +5 -5
- package/dist/{campaign-FG3thH2m.js → campaign-ccOrVCuR.js} +4 -4
- package/dist/{campaign-FG3thH2m.js.map → campaign-ccOrVCuR.js.map} +1 -1
- package/dist/cli.js +1 -1
- package/dist/contract/index.d.ts +1 -1
- package/dist/contract/index.js +6 -6
- package/dist/{default-registry-BaQXW1Ow.js → default-registry-BmktKy8r.js} +3 -3
- package/dist/{default-registry-BaQXW1Ow.js.map → default-registry-BmktKy8r.js.map} +1 -1
- package/dist/{dspy-rlm-engine-BiN49gK6.js → dspy-rlm-engine-DbTk4JdR.js} +3 -3
- package/dist/{dspy-rlm-engine-BiN49gK6.js.map → dspy-rlm-engine-DbTk4JdR.js.map} +1 -1
- package/dist/{extract-usage-BW27f3XW.js → extract-usage-CdZdoj1s.js} +2 -2
- package/dist/{extract-usage-BW27f3XW.js.map → extract-usage-CdZdoj1s.js.map} +1 -1
- package/dist/{index-CLKMJTJF2.d.ts → index-CwYZNzMD2.d.ts} +3 -3
- package/dist/{index-CLKMJTJF2.d.ts.map → index-CwYZNzMD2.d.ts.map} +1 -1
- package/dist/{index-CBEMKO8d.d.ts → index-DvvvSho7.d.ts} +2 -2
- package/dist/{index-CBEMKO8d.d.ts.map → index-DvvvSho7.d.ts.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +11 -11
- package/dist/{kind-factory-BHIgPmzS.js → kind-factory-B8-r8-y8.js} +3 -16
- package/dist/kind-factory-B8-r8-y8.js.map +1 -0
- package/dist/openapi.json +1 -1
- package/dist/{replay-B3gACG_H.js → replay-CohS93nE.js} +4 -4
- package/dist/{replay-B3gACG_H.js.map → replay-CohS93nE.js.map} +1 -1
- package/dist/{semantic-concept-judge-Bmrq6yqU.js → semantic-concept-judge-D1z-KepS.js} +2 -2
- package/dist/{semantic-concept-judge-Bmrq6yqU.js.map → semantic-concept-judge-D1z-KepS.js.map} +1 -1
- package/dist/{single-run-lock-BMQEv1wG.js → single-run-lock-DFWHEB09.js} +123 -123
- package/dist/{single-run-lock-BMQEv1wG.js.map → single-run-lock-DFWHEB09.js.map} +1 -1
- package/dist/{skillopt-optimization-method-D8wysvU1.d.ts → skillopt-optimization-method-9J8dJbrM.d.ts} +35 -3
- package/dist/skillopt-optimization-method-9J8dJbrM.d.ts.map +1 -0
- package/dist/{skillopt-optimization-method-Dtzp7QpP.js → skillopt-optimization-method-D6Q4dLbh.js} +299 -132
- package/dist/skillopt-optimization-method-D6Q4dLbh.js.map +1 -0
- package/dist/{store-otlp-CKtTpRhv.js → store-otlp-Dw8PPIlL.js} +2 -2
- package/dist/{store-otlp-CKtTpRhv.js.map → store-otlp-Dw8PPIlL.js.map} +1 -1
- package/dist/traces.js +4 -4
- package/dist/{usage-receipt-EVI8B8Xu.js → usage-receipt-t7vAzCRQ.js} +15 -2
- package/dist/usage-receipt-t7vAzCRQ.js.map +1 -0
- package/package.json +1 -1
- package/dist/kind-factory-BHIgPmzS.js.map +0 -1
- package/dist/skillopt-optimization-method-D8wysvU1.d.ts.map +0 -1
- package/dist/skillopt-optimization-method-Dtzp7QpP.js.map +0 -1
- package/dist/usage-receipt-EVI8B8Xu.js.map +0 -1
|
@@ -3,7 +3,7 @@ import { a as RunRecord } from "./run-record-CF4Dwpxr.js";
|
|
|
3
3
|
import { A as ChatClient, U as LlmCallMetadata } from "./types-D216SgwM.js";
|
|
4
4
|
import { s as TraceStore } from "./store-CT9YIIve.js";
|
|
5
5
|
import { _ as ProposalFinding } from "./types-BvDKaULh.js";
|
|
6
|
-
import { _ as ExternalTextEvaluationRequest, c as ExternalOptimizerModelBudget, g as ExternalTextCandidate, h as ExternalOptimizerRunnerCommand, l as ExternalOptimizerModelCall, m as ExternalOptimizerResumeMode, r as ExternalOptimizerCallbackLimits } from "./external-optimizer-contracts-CZuJNcT5.js";
|
|
6
|
+
import { _ as ExternalTextEvaluationRequest, c as ExternalOptimizerModelBudget, g as ExternalTextCandidate, h as ExternalOptimizerRunnerCommand, l as ExternalOptimizerModelCall, m as ExternalOptimizerResumeMode, o as ExternalOptimizerEvaluationObservation, r as ExternalOptimizerCallbackLimits } from "./external-optimizer-contracts-CZuJNcT5.js";
|
|
7
7
|
import { C as JudgeDimension, H as SurfaceProposer, N as ParetoParent, R as Scenario, S as JudgeConfig, _ as GateDecision, a as CampaignResult, b as GenerationRecord, c as CampaignTraceWriter, d as DispatchContext, f as DispatchFn, g as GateContribution, i as CampaignCostMeter, j as MutableSurface, k as LabeledScenarioStore, o as CampaignScenarioIdentity, p as Gate, r as CampaignCellResult, v as GateResult, y as GenerationCandidate } from "./types-BnjdJ70P.js";
|
|
8
8
|
import { a as DatasetScenario, t as Dataset } from "./dataset-C8xaLXdY.js";
|
|
9
9
|
import { t as DetectRewardHackingInput } from "./reward-hacking-BI0OMAlo.js";
|
|
@@ -216,6 +216,37 @@ interface ExternalOptimizerExecutionSummary {
|
|
|
216
216
|
succeeded: number;
|
|
217
217
|
failed: number;
|
|
218
218
|
}
|
|
219
|
+
interface ExternalOptimizerSubmittedCandidate {
|
|
220
|
+
/** Exact text or named-component surface submitted to the evaluation callback. */
|
|
221
|
+
readonly candidate: ExternalTextCandidate;
|
|
222
|
+
/** Eval's canonical content identity for `candidate`. */
|
|
223
|
+
readonly candidateHash: string;
|
|
224
|
+
readonly candidateDigest: `sha256:${string}`;
|
|
225
|
+
readonly proposalSequence: number;
|
|
226
|
+
/** Exact observation artifact that proves this candidate was submitted. */
|
|
227
|
+
readonly provenance: {
|
|
228
|
+
readonly path: string;
|
|
229
|
+
readonly sha256: `sha256:${string}`;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
interface ExternalOptimizerObservationArtifact {
|
|
233
|
+
readonly summary: ExternalOptimizerObservationSummary;
|
|
234
|
+
readonly observations: readonly ExternalOptimizerEvaluationObservation[];
|
|
235
|
+
/** Every distinct callback-submitted candidate in proposal order. */
|
|
236
|
+
readonly candidates: readonly ExternalOptimizerSubmittedCandidate[];
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Read and verify the exact callback observation artifact addressed by method provenance.
|
|
240
|
+
*
|
|
241
|
+
* The reader checks the raw SHA-256, canonical JSONL bytes, sequence, candidate
|
|
242
|
+
* identities, and summary counts before it returns any candidate.
|
|
243
|
+
* This proves that the bytes match the supplied summary. The caller remains
|
|
244
|
+
* responsible for obtaining that summary from trusted provenance.
|
|
245
|
+
*/
|
|
246
|
+
declare function readExternalOptimizerObservationArtifact(input: {
|
|
247
|
+
summary: ExternalOptimizerObservationSummary;
|
|
248
|
+
storage?: CampaignStorage;
|
|
249
|
+
}): ExternalOptimizerObservationArtifact;
|
|
219
250
|
//#endregion
|
|
220
251
|
//#region src/campaign/run-campaign.d.ts
|
|
221
252
|
interface RunCampaignOptions<TScenario extends Scenario, TArtifact> {
|
|
@@ -627,6 +658,7 @@ interface ExternalTextEvaluationResponse {
|
|
|
627
658
|
artifact?: unknown;
|
|
628
659
|
};
|
|
629
660
|
}
|
|
661
|
+
declare function decodeExternalTextCandidate(candidate: ExternalTextCandidate): MutableSurface;
|
|
630
662
|
//#endregion
|
|
631
663
|
//#region src/campaign/external-text-optimization-contract.d.ts
|
|
632
664
|
interface ExternalTextOptimizerContext {
|
|
@@ -1507,5 +1539,5 @@ interface SkillOptOptimizationMethodConfig<TScenario extends Scenario, TArtifact
|
|
|
1507
1539
|
/** Run Microsoft's SkillOpt trainer as a complete optimization method. */
|
|
1508
1540
|
declare function skillOptOptimizationMethod<TScenario extends Scenario, TArtifact>(config: SkillOptOptimizationMethodConfig<TScenario, TArtifact>): OptimizationMethod<TScenario, TArtifact>;
|
|
1509
1541
|
//#endregion
|
|
1510
|
-
export { redTeamDataset as $,
|
|
1511
|
-
//# sourceMappingURL=skillopt-optimization-method-
|
|
1542
|
+
export { redTeamDataset as $, campaignSplitDigest as $t, RunEvalOptions as A, combineComparisonCosts as At, OptimizerModelBudget as B, runCampaign as Bt, RunImprovementLoopOptions as C, OptimizationMethodPairwise as Ct, RunOptimizationOptions as D, OptimizationMethodScore as Dt, PremeasuredOptimizationBaseline as E, OptimizationMethodRunOptions as Et, GepaOptimizationMethodConfig as F, CampaignRunPlan as Ft, DefaultProductionRewardHackingOptions as G, readExternalOptimizerObservationArtifact as Gt, heldOutGate as H, ExternalOptimizerObservationArtifact as Ht, GepaOptimizationRecipe as I, CampaignRunPlanCell as It, RedTeamCase as J, fsCampaignStorage as Jt, defaultProductionGate as K, CampaignStorage as Kt, GepaRunnerCommand as L, PlanCampaignRunOptions as Lt, GepaAdaptiveEngineRun as M, costFromLedgerSummary as Mt, GepaEngineOptions as N, optimizationTokenUsageFromSummary as Nt, RunOptimizationResult as O, OptimizationPackageSource as Ot, GepaEngineRun as P, CampaignCellFailureReceipt as Pt, RedTeamReport as Q, campaignScenarioIdentity as Qt, gepaOptimizationMethod as R, RunCampaignOptions as Rt, verifyLoopProvenanceRecord as S, OptimizationMethodInput as St, runImprovementLoop as T, OptimizationMethodResult as Tt, DefaultProductionGateCheck as U, ExternalOptimizerObservationSummary as Ut, HeldOutGateOptions as V, ExternalOptimizerExecutionSummary as Vt, DefaultProductionGateOptions as W, ExternalOptimizerSubmittedCandidate as Wt, RedTeamFinding as X, assertCampaignDesign as Xt, RedTeamCategory as Y, inMemoryCampaignStorage as Yt, RedTeamPayload as Z, assertCampaignSplitIdentity as Zt, emitLoopProvenance as _, decodeExternalTextCandidate as _t, BuildLoopProvenanceArgs as a, REFERENCE_EQUIVALENCE_JUDGE_VERSION as an, CanaryKind as at, provenanceRecordPath as b, OptimizationMethod as bt, LoopProvenanceArgsFromResult as c, ReferenceEquivalenceJudgeResult as cn, CanarySeverity as ct, LoopProvenanceEvidence as d, runReferenceEquivalenceJudge as dn, externalTextOptimizationMethod as dt, campaignSplitDigestFromIdentities as en, redTeamReport as et, LoopProvenanceOptimizationMethod as f, LlmJudgeDimension as fn, ExternalTextOptimizationMethodConfig as ft, canonicalDigest as g, ExternalTextEvaluationResponse as gt, campaignMeasurementDigest as h, ExternalOptimizationExample as ht, skillOptOptimizationMethod as i, REFERENCE_EQUIVALENCE_INPUT_LIMITS as in, CanaryEvaluation as it, runEval as j, compareOptimizationMethods as jt, runOptimization as k, OptimizationTokenUsage as kt, LoopProvenanceBackend as l, ReferenceEquivalenceScenario as ln, runCanaries as lt, buildLoopProvenanceRecord as m, llmJudge as mn, ExternalTextOptimizerResult as mt, SkillOptRunnerCommand as n, OpenAutoPrResult as nn, toolNamesForRun as nt, EmitLoopProvenanceArgs as o, ReferenceEquivalenceJudgeInput as on, CanaryOptions as ot, LoopProvenanceRecord as p, LlmJudgeOptions as pn, ExternalTextOptimizerContext as pt, DEFAULT_RED_TEAM_CORPUS as q, createRunCostLedger as qt, SkillOptTrainerConfig as r, openAutoPr as rn, CanaryAlert as rt, EmitLoopProvenanceResult as s, ReferenceEquivalenceJudgeOptions as sn, CanaryReport as st, SkillOptOptimizationMethodConfig as t, OpenAutoPrOptions as tn, scoreRedTeamOutput as tt, LoopProvenanceCandidate as u, createReferenceEquivalenceJudge as un, composeGate as ut, loopProvenanceArgsFromResult as v, CompareOptimizationMethodsOptions as vt, RunImprovementLoopResult as w, OptimizationMethodProvenance as wt, provenanceSpansPath as x, OptimizationMethodComparison as xt, loopProvenanceSpans as y, ComparisonCost as yt, OpenAICompatibleOptimizerModel as z, planCampaignRun as zt };
|
|
1543
|
+
//# sourceMappingURL=skillopt-optimization-method-9J8dJbrM.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillopt-optimization-method-9J8dJbrM.d.ts","names":[],"sources":["../src/llm-judge.ts","../src/reference-equivalence-judge.ts","../src/campaign/auto-pr.ts","../src/campaign/coverage.ts","../src/campaign/storage.ts","../src/campaign/external-optimizer-observations.ts","../src/campaign/run-campaign.ts","../src/campaign/presets/compare-optimization-methods.ts","../src/campaign/external-text-evaluation.ts","../src/campaign/external-text-optimization-contract.ts","../src/campaign/external-text-optimization.ts","../src/campaign/gates/compose.ts","../src/canary.ts","../src/red-team.ts","../src/campaign/gates/default-production-gate.ts","../src/campaign/gates/heldout-gate.ts","../src/campaign/optimizer-model.ts","../src/campaign/gepa-optimization-method.ts","../src/campaign/presets/run-eval.ts","../src/campaign/presets/run-optimization.ts","../src/campaign/presets/run-improvement-loop.ts","../src/campaign/provenance.ts","../src/campaign/skillopt-optimization-method.ts"],"mappings":";;;;;;;;;;;;;;KA6CY,6BAA6B;UAExB,gBAAgB,WAAW,kBAAkB,WAAW;;;;EAIvE,MAAM;;;EAGN,aAAa;;EAEb;;EAEA;EACA;EACA;;;EAGA,UAAU;;;;;EAKV;;EAEA,aAAa,UAAU;;;EAGvB,cAAc;IAAS,UAAU;IAAW,UAAU;;;EAEtD,aAAa;EACb;IAAmB;IAAc,QAAQ,EAAE;;;;;;;;;;;;;iBAoB7B,SAAS,qBAAqB,kBAAkB,WAAW,UACzE,cACA,gBACA,MAAM,gBAAgB,WAAW,aAChC,YAAY,WAAW;;;cC7Fb;cAEA;WACX;WACA;WACA;;UAGe,qCAA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WAAW,kBAAkB;EACzE;EACA;EACA;EACA,iBAAiB;EACjB,QAAQ,yBAAyB,WAAW;EAC5C,cAAc,cAAc;EAC5B;EACA;;;iBAIc,6BAA6B,WAAW,kBAAkB,UACxE,OAAO,6BAA6B,WAAW,aAC9C,wBAAwB,WAAW;;iBA4CtB,0BAA0B,WAAW,kBAAkB,UACrE,MAAM,wBAAwB,WAAW,aACxC;;iBAoRa,0BAA0B,WAAW,kBAAkB,UACrE,UAAU,eAAe,WAAW;;iBAqCtB,2BAA2B,QAAQ,uBAAuB;;iBAa1D,gBAAgB;;;;;;;;;;;;iBA2KhB,oBACd,QAAQ,sBACR;EAAQ;IACP;;iBAiJa,qBAAqB;;;;iBAMrB,oBAAoB;UAInB;EACf,QAAQ;EACR,OAAO;;EAEP;EACA;;UAGe,uBAAuB,WAAW,kBAAkB,kBAC3D,wBAAwB,WAAW;;EAE3C,SAAS;;;EAGT,eAAe;;;;;;;;;;;;iBA+EK,mBAAmB,WAAW,kBAAkB,UACpE,MAAM,uBAAuB,WAAW,aACvC,QAAQ;;;UCz8BM;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;EAKA,YAAY;;KAGF,wBAAwB;UAEnB,iCAAiC,kBAAkB,UAAU;EAC5E;;EAEA;EACA;;EAEA;EACA,SAAS;;;;;EAKT,WAAW;;EAEX;;EAEA;EACA;;EAEA;;EAEA,2BAA2B,QAAQ;EACnC;EACA,oBAAoB,UAAU;EAC9B,oBAAoB,UAAU,WAAW,UAAU;EACnD,SAAS;EACT,SAAS;;;iBAIK,2BAA2B,kBAAkB,UAAU,WACrE,QAAQ,iCAAiC,WAAW,aACnD,mBAAmB,WAAW"}
|
package/dist/{skillopt-optimization-method-Dtzp7QpP.js → skillopt-optimization-method-D6Q4dLbh.js}
RENAMED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { c as ValidationError, i as JudgeError, t as AgentEvalError } from "./errors-D-LKuDhb.js";
|
|
2
2
|
import { i as CostLedger, t as CostAccountingIncompleteError } from "./cost-ledger-DMFxsLKr.js";
|
|
3
3
|
import { f as maximumChargeForLlmRequest, l as costReceiptFromLlm, m as stripFencedJson, u as costReceiptFromLlmError } from "./llm-client-DzvMUsS_.js";
|
|
4
|
+
import { a as deepFreezeCanonicalJson } from "./usage-receipt-t7vAzCRQ.js";
|
|
4
5
|
import { a as clamp01, o as combineAbortSignals, t as assertProposalFindings } from "./proposal-findings-2GIUo1et.js";
|
|
5
|
-
import { C as isExternalTextCandidate, D as resolveExternalOptimizerProcessLimits, E as resolveExternalOptimizerCallbackLimits, O as safePathComponent, S as isCandidateText, T as removeCredentialEnvironment, b as assertJsonValue, d as closeExternalOptimizerResources, f as runWithCleanup,
|
|
6
|
+
import { C as isExternalTextCandidate, D as resolveExternalOptimizerProcessLimits, E as resolveExternalOptimizerCallbackLimits, O as safePathComponent, S as isCandidateText, T as removeCredentialEnvironment, b as assertJsonValue, d as closeExternalOptimizerResources, f as runWithCleanup, i as fsCampaignStorage, n as startExternalOptimizerCallback, p as startExternalOptimizerModelProxy, r as createRunCostLedger, t as acquireSingleRunLock, u as runExternalOptimizerProcess, w as isRecord, x as assertNoCredentialValues, y as assertExternalOptimizerModelBudget } from "./single-run-lock-DFWHEB09.js";
|
|
6
7
|
import { n as canonicalJson, r as contentHash } from "./verdict-cache-BCcOh0kF.js";
|
|
7
8
|
import { p as mapConcurrent } from "./ledger-core-DXZIqu17.js";
|
|
8
9
|
import { E as pairedBootstrap, H as weightedComposite, d as confidenceInterval } from "./statistics-ByxzSiOM.js";
|
|
@@ -1413,73 +1414,241 @@ function designedCellIds(scenarios, reps) {
|
|
|
1413
1414
|
return ids;
|
|
1414
1415
|
}
|
|
1415
1416
|
//#endregion
|
|
1416
|
-
//#region src/campaign/external-optimizer-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
const
|
|
1435
|
-
|
|
1436
|
-
|
|
1417
|
+
//#region src/campaign/external-optimizer-observations.ts
|
|
1418
|
+
/**
|
|
1419
|
+
* Read and verify the exact callback observation artifact addressed by method provenance.
|
|
1420
|
+
*
|
|
1421
|
+
* The reader checks the raw SHA-256, canonical JSONL bytes, sequence, candidate
|
|
1422
|
+
* identities, and summary counts before it returns any candidate.
|
|
1423
|
+
* This proves that the bytes match the supplied summary. The caller remains
|
|
1424
|
+
* responsible for obtaining that summary from trusted provenance.
|
|
1425
|
+
*/
|
|
1426
|
+
function readExternalOptimizerObservationArtifact(input) {
|
|
1427
|
+
const { summary } = input;
|
|
1428
|
+
assertObservationSummary(summary);
|
|
1429
|
+
const storage = input.storage ?? fsCampaignStorage();
|
|
1430
|
+
const contents = storage.read(summary.path);
|
|
1431
|
+
if (contents === void 0) {
|
|
1432
|
+
const state = storage.exists(summary.path) ? "unreadable" : "missing";
|
|
1433
|
+
throw new Error(`external optimizer observation artifact is ${state} at '${summary.path}'`);
|
|
1434
|
+
}
|
|
1435
|
+
const sha256 = `sha256:${createHash("sha256").update(contents).digest("hex")}`;
|
|
1436
|
+
if (sha256 !== summary.sha256) throw new Error(`external optimizer observation artifact digest mismatch at '${summary.path}': expected ${summary.sha256}, got ${sha256}`);
|
|
1437
|
+
if (contents.length > 0 && !contents.endsWith("\n")) throw new Error(`external optimizer observation artifact must end with a newline at '${summary.path}'`);
|
|
1438
|
+
const observations = contents.length === 0 ? [] : parseObservationLines(contents, summary.path);
|
|
1439
|
+
const candidates = [];
|
|
1440
|
+
const proposed = /* @__PURE__ */ new Map();
|
|
1441
|
+
const evaluationNumbers = /* @__PURE__ */ new Set();
|
|
1442
|
+
let evaluations = 0;
|
|
1443
|
+
let failedEvaluations = 0;
|
|
1444
|
+
let refusals = 0;
|
|
1445
|
+
for (const [index, observation] of observations.entries()) {
|
|
1446
|
+
if (observation.sequence !== index + 1) throw new Error(`external optimizer observation artifact expected sequence ${index + 1}, got ${observation.sequence}`);
|
|
1447
|
+
if (observation.kind === "proposal") {
|
|
1448
|
+
assertCandidateIdentity(observation.candidate, observation.candidateHash, observation.sequence);
|
|
1449
|
+
if (proposed.has(observation.candidateHash)) throw new Error(`external optimizer observation artifact repeats candidate ${observation.candidateHash}`);
|
|
1450
|
+
const candidate = {
|
|
1451
|
+
candidate: structuredClone(observation.candidate),
|
|
1452
|
+
candidateHash: observation.candidateHash,
|
|
1453
|
+
candidateDigest: `sha256:${observation.candidateHash}`,
|
|
1454
|
+
proposalSequence: observation.sequence,
|
|
1455
|
+
provenance: {
|
|
1456
|
+
path: summary.path,
|
|
1457
|
+
sha256: summary.sha256
|
|
1458
|
+
}
|
|
1459
|
+
};
|
|
1460
|
+
proposed.set(observation.candidateHash, candidate);
|
|
1461
|
+
candidates.push(candidate);
|
|
1462
|
+
continue;
|
|
1463
|
+
}
|
|
1464
|
+
if (observation.kind === "evaluation") {
|
|
1465
|
+
evaluations += 1;
|
|
1466
|
+
if (evaluationNumbers.has(observation.evaluationNumber)) throw new Error(`external optimizer observation artifact repeats evaluation number ${observation.evaluationNumber}`);
|
|
1467
|
+
evaluationNumbers.add(observation.evaluationNumber);
|
|
1468
|
+
assertObservedCandidate(observation, proposed);
|
|
1469
|
+
assertJsonValue(observation.response, "external optimizer evaluation response");
|
|
1470
|
+
continue;
|
|
1471
|
+
}
|
|
1472
|
+
refusals += 1;
|
|
1473
|
+
if (observation.reason !== "invalid-request" && observation.reason !== "evaluation-limit" && observation.reason !== "evaluation-failed") throw new Error(`external optimizer observation artifact has invalid refusal reason at sequence ${observation.sequence}`);
|
|
1474
|
+
if (observation.reason === "evaluation-failed") failedEvaluations += 1;
|
|
1475
|
+
const candidateFields = [observation.candidate, observation.candidateHash];
|
|
1476
|
+
if (observation.reason !== "invalid-request" && candidateFields.some((value) => value === void 0)) throw new Error(`external optimizer observation artifact omits a refused candidate at sequence ${observation.sequence}`);
|
|
1477
|
+
if (candidateFields.some((value) => value !== void 0)) {
|
|
1478
|
+
if (candidateFields.some((value) => value === void 0)) throw new Error(`external optimizer observation artifact has incomplete candidate identity at sequence ${observation.sequence}`);
|
|
1479
|
+
assertObservedCandidate(observation, proposed);
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
const acceptedEvaluations = evaluations + failedEvaluations;
|
|
1483
|
+
for (const evaluationNumber of evaluationNumbers) if (evaluationNumber > acceptedEvaluations) throw new Error(`external optimizer observation artifact has out-of-range evaluation number ${evaluationNumber}`);
|
|
1484
|
+
if (candidates.length !== summary.submittedCandidates || evaluations !== summary.evaluations || refusals !== summary.refusals) throw new Error(`external optimizer observation artifact counts disagree at '${summary.path}': expected ${summary.submittedCandidates}/${summary.evaluations}/${summary.refusals}, got ${candidates.length}/${evaluations}/${refusals}`);
|
|
1485
|
+
return deepFreezeCanonicalJson({
|
|
1486
|
+
summary: structuredClone(summary),
|
|
1487
|
+
observations,
|
|
1488
|
+
candidates
|
|
1437
1489
|
});
|
|
1490
|
+
}
|
|
1491
|
+
/** Append-only observation log for one external-optimizer attempt. */
|
|
1492
|
+
function openExternalOptimizerObservationLog(input) {
|
|
1493
|
+
if (input.storage.read(input.path) !== void 0 || input.storage.exists(input.path)) throw new Error(`external optimizer observation log already exists at '${input.path}'`);
|
|
1494
|
+
input.storage.write(input.path, "");
|
|
1495
|
+
let revision = 0;
|
|
1496
|
+
const counts = {
|
|
1497
|
+
submittedCandidates: 0,
|
|
1498
|
+
evaluations: 0,
|
|
1499
|
+
refusals: 0
|
|
1500
|
+
};
|
|
1438
1501
|
return {
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1502
|
+
observe(observation) {
|
|
1503
|
+
const expectedSequence = counts.submittedCandidates + counts.evaluations + counts.refusals + 1;
|
|
1504
|
+
if (observation.sequence !== expectedSequence) throw new Error(`external optimizer observation log expected sequence ${expectedSequence}, got ${observation.sequence}`);
|
|
1505
|
+
const line = `${canonicalJson(observation)}\n`;
|
|
1506
|
+
const next = input.storage.append(input.path, line, revision);
|
|
1507
|
+
if (next === void 0) throw new Error(`external optimizer observation log changed concurrently at '${input.path}'`);
|
|
1508
|
+
revision = next;
|
|
1509
|
+
if (observation.kind === "proposal") counts.submittedCandidates += 1;
|
|
1510
|
+
else if (observation.kind === "evaluation") counts.evaluations += 1;
|
|
1511
|
+
else counts.refusals += 1;
|
|
1512
|
+
},
|
|
1513
|
+
summary() {
|
|
1514
|
+
const contents = input.storage.read(input.path) ?? "";
|
|
1515
|
+
const bytes = new TextEncoder().encode(contents);
|
|
1516
|
+
if (bytes.byteLength !== revision) throw new Error(`external optimizer observation log revision changed at '${input.path}'`);
|
|
1517
|
+
return {
|
|
1518
|
+
scope: "callback-submitted-candidates",
|
|
1519
|
+
path: input.path,
|
|
1520
|
+
sha256: `sha256:${createHash("sha256").update(bytes).digest("hex")}`,
|
|
1521
|
+
...counts
|
|
1522
|
+
};
|
|
1459
1523
|
}
|
|
1460
1524
|
};
|
|
1461
1525
|
}
|
|
1462
|
-
function
|
|
1463
|
-
if (
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1526
|
+
function assertObservationSummary(summary) {
|
|
1527
|
+
if (summary.scope !== "callback-submitted-candidates") throw new Error("external optimizer observation summary has an invalid scope");
|
|
1528
|
+
if (typeof summary.path !== "string" || summary.path.trim().length === 0) throw new Error("external optimizer observation summary has an invalid path");
|
|
1529
|
+
if (!/^sha256:[a-f0-9]{64}$/u.test(summary.sha256)) throw new Error("external optimizer observation summary has an invalid SHA-256");
|
|
1530
|
+
for (const [field, value] of [
|
|
1531
|
+
["submittedCandidates", summary.submittedCandidates],
|
|
1532
|
+
["evaluations", summary.evaluations],
|
|
1533
|
+
["refusals", summary.refusals]
|
|
1534
|
+
]) if (!Number.isSafeInteger(value) || value < 0) throw new Error(`external optimizer observation summary ${field} must be a non-negative integer`);
|
|
1535
|
+
}
|
|
1536
|
+
function parseObservationLines(contents, path) {
|
|
1537
|
+
return contents.slice(0, -1).split("\n").map((line, index) => {
|
|
1538
|
+
let observation;
|
|
1471
1539
|
try {
|
|
1472
|
-
|
|
1540
|
+
observation = JSON.parse(line);
|
|
1473
1541
|
} catch (cause) {
|
|
1474
|
-
throw new Error(`external optimizer
|
|
1542
|
+
throw new Error(`external optimizer observation artifact has invalid JSON at '${path}' line ${index + 1}`, { cause });
|
|
1475
1543
|
}
|
|
1476
|
-
|
|
1477
|
-
|
|
1544
|
+
assertObservationShape(observation, index + 1);
|
|
1545
|
+
if (canonicalJson(observation) !== line) throw new Error(`external optimizer observation artifact is not canonical at '${path}' line ${index + 1}`);
|
|
1546
|
+
return observation;
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
function assertObservationShape(value, line) {
|
|
1550
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error(`external optimizer observation artifact line ${line} must be an object`);
|
|
1551
|
+
const observation = value;
|
|
1552
|
+
if (!Number.isSafeInteger(observation.sequence) || Number(observation.sequence) <= 0) throw new Error(`external optimizer observation artifact line ${line} has an invalid sequence`);
|
|
1553
|
+
if (observation.kind === "proposal") {
|
|
1554
|
+
assertExactKeys(observation, [
|
|
1555
|
+
"candidate",
|
|
1556
|
+
"candidateHash",
|
|
1557
|
+
"kind",
|
|
1558
|
+
"sequence"
|
|
1559
|
+
], line);
|
|
1560
|
+
assertCandidateFields(observation, line);
|
|
1561
|
+
return;
|
|
1478
1562
|
}
|
|
1479
|
-
if (
|
|
1563
|
+
if (observation.kind === "evaluation") {
|
|
1564
|
+
assertExactKeys(observation, [
|
|
1565
|
+
"candidate",
|
|
1566
|
+
"candidateHash",
|
|
1567
|
+
"evaluationNumber",
|
|
1568
|
+
"exampleId",
|
|
1569
|
+
"kind",
|
|
1570
|
+
"response",
|
|
1571
|
+
"sequence"
|
|
1572
|
+
], line);
|
|
1573
|
+
assertCandidateFields(observation, line);
|
|
1574
|
+
if (typeof observation.exampleId !== "string") throw new Error(`external optimizer observation artifact line ${line} has an invalid exampleId`);
|
|
1575
|
+
if (!Number.isSafeInteger(observation.evaluationNumber) || Number(observation.evaluationNumber) <= 0) throw new Error(`external optimizer observation artifact line ${line} has an invalid evaluationNumber`);
|
|
1576
|
+
assertJsonValue(observation.response, `external optimizer observation artifact line ${line}`);
|
|
1577
|
+
return;
|
|
1578
|
+
}
|
|
1579
|
+
if (observation.kind === "refusal") {
|
|
1580
|
+
assertAllowedKeys(observation, [
|
|
1581
|
+
"candidate",
|
|
1582
|
+
"candidateHash",
|
|
1583
|
+
"exampleId",
|
|
1584
|
+
"kind",
|
|
1585
|
+
"reason",
|
|
1586
|
+
"sequence"
|
|
1587
|
+
], line);
|
|
1588
|
+
if (typeof observation.reason !== "string") throw new Error(`external optimizer observation artifact line ${line} has an invalid reason`);
|
|
1589
|
+
if (observation.candidate !== void 0 || observation.candidateHash !== void 0) assertCandidateFields(observation, line);
|
|
1590
|
+
if (observation.exampleId !== void 0 && typeof observation.exampleId !== "string") throw new Error(`external optimizer observation artifact line ${line} has an invalid exampleId`);
|
|
1591
|
+
return;
|
|
1592
|
+
}
|
|
1593
|
+
throw new Error(`external optimizer observation artifact line ${line} has an invalid kind`);
|
|
1594
|
+
}
|
|
1595
|
+
function assertCandidateFields(observation, line) {
|
|
1596
|
+
if (!isExternalTextCandidate(observation.candidate)) throw new Error(`external optimizer observation artifact line ${line} has an invalid candidate`);
|
|
1597
|
+
if (typeof observation.candidateHash !== "string" || !/^[a-f0-9]{64}$/u.test(observation.candidateHash)) throw new Error(`external optimizer observation artifact line ${line} has an invalid candidateHash`);
|
|
1598
|
+
}
|
|
1599
|
+
function assertExactKeys(value, expected, line) {
|
|
1600
|
+
assertAllowedKeys(value, expected, line);
|
|
1601
|
+
for (const key of expected) if (!(key in value)) throw new Error(`external optimizer observation artifact line ${line} is missing ${key}`);
|
|
1602
|
+
}
|
|
1603
|
+
function assertAllowedKeys(value, allowed, line) {
|
|
1604
|
+
const extras = Object.keys(value).filter((key) => !allowed.includes(key));
|
|
1605
|
+
if (extras.length > 0) throw new Error(`external optimizer observation artifact line ${line} has unexpected field ${extras[0]}`);
|
|
1606
|
+
}
|
|
1607
|
+
function assertCandidateIdentity(candidate, candidateHash, sequence) {
|
|
1608
|
+
if (candidateHash !== contentHash({
|
|
1609
|
+
kind: "external-text-candidate",
|
|
1610
|
+
candidate
|
|
1611
|
+
})) throw new Error(`external optimizer observation artifact candidate hash mismatch at sequence ${sequence}`);
|
|
1612
|
+
}
|
|
1613
|
+
function assertObservedCandidate(observation, proposed) {
|
|
1614
|
+
assertCandidateIdentity(observation.candidate, observation.candidateHash, observation.sequence);
|
|
1615
|
+
const candidate = proposed.get(observation.candidateHash);
|
|
1616
|
+
if (!candidate) throw new Error(`external optimizer observation artifact references an unproposed candidate at sequence ${observation.sequence}`);
|
|
1617
|
+
if (!isDeepStrictEqual(observation.candidate, candidate.candidate)) throw new Error(`external optimizer observation artifact changes candidate bytes at sequence ${observation.sequence}`);
|
|
1618
|
+
}
|
|
1619
|
+
/** Append-only opaque Runtime execution records for one optimizer attempt. */
|
|
1620
|
+
function openExternalOptimizerExecutionLog(input) {
|
|
1621
|
+
if (input.storage.read(input.path) !== void 0 || input.storage.exists(input.path)) throw new Error(`external optimizer execution log already exists at '${input.path}'`);
|
|
1622
|
+
input.storage.write(input.path, "");
|
|
1623
|
+
let revision = 0;
|
|
1624
|
+
const counts = {
|
|
1625
|
+
calls: 0,
|
|
1626
|
+
succeeded: 0,
|
|
1627
|
+
failed: 0
|
|
1628
|
+
};
|
|
1480
1629
|
return {
|
|
1481
|
-
|
|
1482
|
-
|
|
1630
|
+
observe(observation) {
|
|
1631
|
+
if (observation.sequence !== counts.calls + 1) throw new Error(`external optimizer execution log expected sequence ${counts.calls + 1}, got ${observation.sequence}`);
|
|
1632
|
+
const line = `${canonicalJson(observation)}\n`;
|
|
1633
|
+
const next = input.storage.append(input.path, line, revision);
|
|
1634
|
+
if (next === void 0) throw new Error(`external optimizer execution log changed concurrently at '${input.path}'`);
|
|
1635
|
+
revision = next;
|
|
1636
|
+
counts.calls += 1;
|
|
1637
|
+
if (observation.succeeded) counts.succeeded += 1;
|
|
1638
|
+
else counts.failed += 1;
|
|
1639
|
+
},
|
|
1640
|
+
summary() {
|
|
1641
|
+
const contents = input.storage.read(input.path) ?? "";
|
|
1642
|
+
const bytes = new TextEncoder().encode(contents);
|
|
1643
|
+
if (bytes.byteLength !== revision) throw new Error(`external optimizer execution log revision changed at '${input.path}'`);
|
|
1644
|
+
if (counts.calls !== counts.succeeded + counts.failed) throw new Error(`external optimizer execution log counts disagree at '${input.path}'`);
|
|
1645
|
+
return {
|
|
1646
|
+
scope: "runtime-model-calls",
|
|
1647
|
+
path: input.path,
|
|
1648
|
+
sha256: `sha256:${createHash("sha256").update(bytes).digest("hex")}`,
|
|
1649
|
+
...counts
|
|
1650
|
+
};
|
|
1651
|
+
}
|
|
1483
1652
|
};
|
|
1484
1653
|
}
|
|
1485
1654
|
//#endregion
|
|
@@ -2830,6 +2999,76 @@ function deepFreeze$1(value) {
|
|
|
2830
2999
|
return value;
|
|
2831
3000
|
}
|
|
2832
3001
|
//#endregion
|
|
3002
|
+
//#region src/campaign/external-optimizer-run-budget.ts
|
|
3003
|
+
function externalOptimizerRunKey(input) {
|
|
3004
|
+
if (!input.attemptId.trim() || input.attemptId.trim() !== input.attemptId) throw new Error("external optimizer attemptId must be trimmed and non-empty");
|
|
3005
|
+
if (typeof input.resumeEnabled !== "boolean") throw new Error("external optimizer resumeEnabled must be a boolean");
|
|
3006
|
+
const compatible = externalOptimizerCompatibleRunKey(input.material);
|
|
3007
|
+
return input.resumeEnabled ? compatible : `${compatible}-${input.attemptId}`;
|
|
3008
|
+
}
|
|
3009
|
+
function externalOptimizerCompatibleRunKey(material) {
|
|
3010
|
+
return contentHash(material);
|
|
3011
|
+
}
|
|
3012
|
+
function openExternalOptimizerRunBudget(input) {
|
|
3013
|
+
if (!input.runKey.trim() || input.runKey.trim() !== input.runKey) throw new Error("external optimizer runKey must be trimmed and non-empty");
|
|
3014
|
+
if (!input.attemptId.trim() || input.attemptId.trim() !== input.attemptId) throw new Error("external optimizer attemptId must be trimmed and non-empty");
|
|
3015
|
+
if (!Number.isSafeInteger(input.maxEvaluations) || input.maxEvaluations <= 0) throw new Error("external optimizer maxEvaluations must be a positive safe integer");
|
|
3016
|
+
const budgetDir = `${input.runDir}/budgets`;
|
|
3017
|
+
const statePath = `${budgetDir}/${input.runKey}.jsonl`;
|
|
3018
|
+
input.storage.ensureDir(budgetDir);
|
|
3019
|
+
const runTags = Object.freeze({ optimizerRun: input.runKey });
|
|
3020
|
+
const attemptTags = Object.freeze({
|
|
3021
|
+
optimizerRun: input.runKey,
|
|
3022
|
+
optimizerAttempt: input.attemptId
|
|
3023
|
+
});
|
|
3024
|
+
return {
|
|
3025
|
+
runKey: input.runKey,
|
|
3026
|
+
attemptId: input.attemptId,
|
|
3027
|
+
runTags,
|
|
3028
|
+
attemptTags,
|
|
3029
|
+
acceptedEvaluations: () => readState(input.storage.read(statePath), input.maxEvaluations, statePath).accepted,
|
|
3030
|
+
acceptEvaluation() {
|
|
3031
|
+
for (let attempt = 0; attempt < 16; attempt += 1) {
|
|
3032
|
+
const current = input.storage.read(statePath) ?? "";
|
|
3033
|
+
const state = readState(current, input.maxEvaluations, statePath);
|
|
3034
|
+
if (state.accepted >= input.maxEvaluations) return void 0;
|
|
3035
|
+
if (!input.storage.append) throw new Error("external optimizer evaluation budgets require appendable storage");
|
|
3036
|
+
const next = state.accepted + 1;
|
|
3037
|
+
const event = `${JSON.stringify({
|
|
3038
|
+
maxEvaluations: input.maxEvaluations,
|
|
3039
|
+
accepted: next
|
|
3040
|
+
})}\n`;
|
|
3041
|
+
const expectedBytes = new TextEncoder().encode(current).byteLength;
|
|
3042
|
+
if (input.storage.append(statePath, event, expectedBytes) !== void 0) return next;
|
|
3043
|
+
}
|
|
3044
|
+
throw new Error(`external optimizer evaluation counter for '${input.runKey}' was updated concurrently`);
|
|
3045
|
+
}
|
|
3046
|
+
};
|
|
3047
|
+
}
|
|
3048
|
+
function readState(text, maxEvaluations, statePath) {
|
|
3049
|
+
if (text === void 0 || text === "") return {
|
|
3050
|
+
maxEvaluations,
|
|
3051
|
+
accepted: 0
|
|
3052
|
+
};
|
|
3053
|
+
let accepted = 0;
|
|
3054
|
+
for (const line of text.split("\n")) {
|
|
3055
|
+
if (!line) continue;
|
|
3056
|
+
let value;
|
|
3057
|
+
try {
|
|
3058
|
+
value = JSON.parse(line);
|
|
3059
|
+
} catch (cause) {
|
|
3060
|
+
throw new Error(`external optimizer evaluation state is invalid at '${statePath}'`, { cause });
|
|
3061
|
+
}
|
|
3062
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).sort().join(",") !== "accepted,maxEvaluations" || value.maxEvaluations !== maxEvaluations || value.accepted !== accepted + 1) throw new Error(`external optimizer evaluation state does not match at '${statePath}'`);
|
|
3063
|
+
accepted += 1;
|
|
3064
|
+
}
|
|
3065
|
+
if (accepted > maxEvaluations) throw new Error(`external optimizer evaluation state exceeds its limit at '${statePath}'`);
|
|
3066
|
+
return {
|
|
3067
|
+
maxEvaluations,
|
|
3068
|
+
accepted
|
|
3069
|
+
};
|
|
3070
|
+
}
|
|
3071
|
+
//#endregion
|
|
2833
3072
|
//#region src/campaign/external-text-optimization-contract.ts
|
|
2834
3073
|
const MAX_TIMER_DELAY_MS$3 = 2147483647;
|
|
2835
3074
|
function assertExternalTextOptimizationConfig(config) {
|
|
@@ -4493,78 +4732,6 @@ function assertExternalOptimizerCompletionCount(upstream, requestAttempts, succe
|
|
|
4493
4732
|
if (upstream.requestAttempts !== void 0 && upstream.requestAttempts !== requestAttempts) throw new Error(`${name}: ${optimizer} reported ${upstream.requestAttempts} model attempts but the proxy received ${requestAttempts}`);
|
|
4494
4733
|
}
|
|
4495
4734
|
//#endregion
|
|
4496
|
-
//#region src/campaign/external-optimizer-observations.ts
|
|
4497
|
-
/** Append-only observation log for one external-optimizer attempt. */
|
|
4498
|
-
function openExternalOptimizerObservationLog(input) {
|
|
4499
|
-
if (input.storage.read(input.path) !== void 0 || input.storage.exists(input.path)) throw new Error(`external optimizer observation log already exists at '${input.path}'`);
|
|
4500
|
-
input.storage.write(input.path, "");
|
|
4501
|
-
let revision = 0;
|
|
4502
|
-
const counts = {
|
|
4503
|
-
submittedCandidates: 0,
|
|
4504
|
-
evaluations: 0,
|
|
4505
|
-
refusals: 0
|
|
4506
|
-
};
|
|
4507
|
-
return {
|
|
4508
|
-
observe(observation) {
|
|
4509
|
-
const expectedSequence = counts.submittedCandidates + counts.evaluations + counts.refusals + 1;
|
|
4510
|
-
if (observation.sequence !== expectedSequence) throw new Error(`external optimizer observation log expected sequence ${expectedSequence}, got ${observation.sequence}`);
|
|
4511
|
-
const line = `${canonicalJson(observation)}\n`;
|
|
4512
|
-
const next = input.storage.append(input.path, line, revision);
|
|
4513
|
-
if (next === void 0) throw new Error(`external optimizer observation log changed concurrently at '${input.path}'`);
|
|
4514
|
-
revision = next;
|
|
4515
|
-
if (observation.kind === "proposal") counts.submittedCandidates += 1;
|
|
4516
|
-
else if (observation.kind === "evaluation") counts.evaluations += 1;
|
|
4517
|
-
else counts.refusals += 1;
|
|
4518
|
-
},
|
|
4519
|
-
summary() {
|
|
4520
|
-
const contents = input.storage.read(input.path) ?? "";
|
|
4521
|
-
const bytes = new TextEncoder().encode(contents);
|
|
4522
|
-
if (bytes.byteLength !== revision) throw new Error(`external optimizer observation log revision changed at '${input.path}'`);
|
|
4523
|
-
return {
|
|
4524
|
-
scope: "callback-submitted-candidates",
|
|
4525
|
-
path: input.path,
|
|
4526
|
-
sha256: `sha256:${createHash("sha256").update(bytes).digest("hex")}`,
|
|
4527
|
-
...counts
|
|
4528
|
-
};
|
|
4529
|
-
}
|
|
4530
|
-
};
|
|
4531
|
-
}
|
|
4532
|
-
/** Append-only opaque Runtime execution records for one optimizer attempt. */
|
|
4533
|
-
function openExternalOptimizerExecutionLog(input) {
|
|
4534
|
-
if (input.storage.read(input.path) !== void 0 || input.storage.exists(input.path)) throw new Error(`external optimizer execution log already exists at '${input.path}'`);
|
|
4535
|
-
input.storage.write(input.path, "");
|
|
4536
|
-
let revision = 0;
|
|
4537
|
-
const counts = {
|
|
4538
|
-
calls: 0,
|
|
4539
|
-
succeeded: 0,
|
|
4540
|
-
failed: 0
|
|
4541
|
-
};
|
|
4542
|
-
return {
|
|
4543
|
-
observe(observation) {
|
|
4544
|
-
if (observation.sequence !== counts.calls + 1) throw new Error(`external optimizer execution log expected sequence ${counts.calls + 1}, got ${observation.sequence}`);
|
|
4545
|
-
const line = `${canonicalJson(observation)}\n`;
|
|
4546
|
-
const next = input.storage.append(input.path, line, revision);
|
|
4547
|
-
if (next === void 0) throw new Error(`external optimizer execution log changed concurrently at '${input.path}'`);
|
|
4548
|
-
revision = next;
|
|
4549
|
-
counts.calls += 1;
|
|
4550
|
-
if (observation.succeeded) counts.succeeded += 1;
|
|
4551
|
-
else counts.failed += 1;
|
|
4552
|
-
},
|
|
4553
|
-
summary() {
|
|
4554
|
-
const contents = input.storage.read(input.path) ?? "";
|
|
4555
|
-
const bytes = new TextEncoder().encode(contents);
|
|
4556
|
-
if (bytes.byteLength !== revision) throw new Error(`external optimizer execution log revision changed at '${input.path}'`);
|
|
4557
|
-
if (counts.calls !== counts.succeeded + counts.failed) throw new Error(`external optimizer execution log counts disagree at '${input.path}'`);
|
|
4558
|
-
return {
|
|
4559
|
-
scope: "runtime-model-calls",
|
|
4560
|
-
path: input.path,
|
|
4561
|
-
sha256: `sha256:${createHash("sha256").update(bytes).digest("hex")}`,
|
|
4562
|
-
...counts
|
|
4563
|
-
};
|
|
4564
|
-
}
|
|
4565
|
-
};
|
|
4566
|
-
}
|
|
4567
|
-
//#endregion
|
|
4568
4735
|
//#region src/campaign/external-optimizer-run-config.ts
|
|
4569
4736
|
function externalOptimizerRunnerIdentity(runner, module) {
|
|
4570
4737
|
return {
|
|
@@ -6528,6 +6695,6 @@ function skillOptOptimizationMethod(config) {
|
|
|
6528
6695
|
};
|
|
6529
6696
|
}
|
|
6530
6697
|
//#endregion
|
|
6531
|
-
export {
|
|
6698
|
+
export { REFERENCE_EQUIVALENCE_JUDGE_VERSION as $, codeSurfaceIdentityMaterial as A, parseReflectionResponse as B, combineComparisonCosts as C, decodeExternalTextCandidate as D, optimizationTokenUsageFromSummary as E, campaignBreakdown as F, readExternalOptimizerObservationArtifact as G, runCampaign as H, campaignMeanComposite as I, campaignScenarioIdentity as J, assertCampaignDesign as K, compareRankKeys as L, renderSurfaceDiff as M, surfaceContentHash as N, assertCodeSurfaceIdentity as O, surfaceHash as P, REFERENCE_EQUIVALENCE_INPUT_LIMITS as Q, DEFAULT_MUTATION_PRIMITIVES as R, assertOptimizationResult as S, JudgeParseError as St, costFromLedgerSummary as T, resolveRunDir as U, planCampaignRun as V, tangleTracesRoot as W, campaignSplitDigestFromIdentities as X, campaignSplitDigest as Y, openAutoPr as Z, heldOutGate as _, BackendIntegrityError as _t, emitLoopProvenance as a, scoreRedTeamOutput as at, composeGate as b, summarizeAgentReceiptIntegrity as bt, provenanceRecordPath as c, HoldoutLockedError as ct, runImprovementLoop as d, crowdingDistance as dt, createReferenceEquivalenceJudge as et, runOptimization as f, dominates as ft, gepaOptimizationMethod as g, recoverTruncatedJson as gt, labelTrustRank as h, scalarScore as ht, canonicalDigest as i, redTeamReport as it, componentSurfaceIdentityMaterial as j, assertComponentSurface as k, provenanceSpansPath as l, hashScenarios as lt, isProposedCandidate as m, paretoFrontierWithCrowding as mt, buildLoopProvenanceRecord as n, DEFAULT_RED_TEAM_CORPUS as nt, loopProvenanceArgsFromResult as o, toolNamesForRun as ot, runEval as p, paretoFrontier as pt, assertCampaignSplitIdentity as q, campaignMeasurementDigest as r, redTeamDataset as rt, loopProvenanceSpans as s, Dataset as st, skillOptOptimizationMethod as t, runReferenceEquivalenceJudge as tt, verifyLoopProvenanceRecord as u, llmJudge as ut, defaultProductionGate as v, assertRealAgentReceipts as vt, compareOptimizationMethods as w, externalTextOptimizationMethod as x, summarizeBackendIntegrity as xt, runCanaries as y, assertRealBackend as yt, buildReflectionPrompt as z };
|
|
6532
6699
|
|
|
6533
|
-
//# sourceMappingURL=skillopt-optimization-method-
|
|
6700
|
+
//# sourceMappingURL=skillopt-optimization-method-D6Q4dLbh.js.map
|