@tangle-network/agent-eval 0.92.0 → 0.94.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/dist/adapters/otel.d.ts +4 -4
- package/dist/analyst/index.d.ts +10 -10
- package/dist/analyst/index.js +6 -6
- package/dist/{analyze-runs-DwCEkpO_.d.ts → analyze-runs-B6Ljo_dI.d.ts} +2 -2
- package/dist/{baseline-DE36-Np7.d.ts → baseline-Bbid3WoO.d.ts} +1 -1
- package/dist/belief-state/index.d.ts +2 -2
- package/dist/belief-state/index.js +1 -1
- package/dist/builder-eval/index.d.ts +3 -3
- package/dist/builder-eval/index.js +2 -2
- package/dist/{calibration-Cpr3WaX3.d.ts → calibration-BPmzuVPk.d.ts} +1 -1
- package/dist/campaign/index.d.ts +13 -13
- package/dist/campaign/index.js +8 -8
- package/dist/{chunk-TWS7AZEY.js → chunk-2K6UUZ7P.js} +2 -2
- package/dist/{chunk-Y47J2LJ3.js → chunk-2KNZHH3P.js} +5 -5
- package/dist/{chunk-LMZQ2Z4U.js → chunk-56GC6VYO.js} +126 -1
- package/dist/chunk-56GC6VYO.js.map +1 -0
- package/dist/{chunk-QG2OVF2D.js → chunk-CTBHKLEU.js} +99 -30
- package/dist/chunk-CTBHKLEU.js.map +1 -0
- package/dist/{chunk-CVVHBFGN.js → chunk-CWNP4DV4.js} +53 -5
- package/dist/chunk-CWNP4DV4.js.map +1 -0
- package/dist/{chunk-QS3RBQPI.js → chunk-D5KBVULY.js} +2 -2
- package/dist/{chunk-RTWFUK6A.js → chunk-E4GH6USR.js} +2 -2
- package/dist/{chunk-ZFIBGEOL.js → chunk-EGPMSBEZ.js} +4 -4
- package/dist/{chunk-GSH6QNNS.js → chunk-KW53MSA5.js} +101 -78
- package/dist/chunk-KW53MSA5.js.map +1 -0
- package/dist/{chunk-UMMZHCPB.js → chunk-MIFZUPEK.js} +7 -5
- package/dist/chunk-MIFZUPEK.js.map +1 -0
- package/dist/{chunk-XY4DDNEG.js → chunk-MPQWFX6Y.js} +2 -2
- package/dist/{chunk-L3JOU6XM.js → chunk-NACM5RS7.js} +3 -3
- package/dist/{chunk-3CKU6VGU.js → chunk-Q2JRAWRI.js} +2 -2
- package/dist/{chunk-D3V5B42D.js → chunk-Q5LIB7BC.js} +7 -4
- package/dist/{chunk-D3V5B42D.js.map → chunk-Q5LIB7BC.js.map} +1 -1
- package/dist/{chunk-QAY5UIJO.js → chunk-QMUEXQJS.js} +99 -57
- package/dist/chunk-QMUEXQJS.js.map +1 -0
- package/dist/{chunk-4FBZZIYD.js → chunk-QTMYW64F.js} +2 -2
- package/dist/{chunk-6SOJM3VR.js → chunk-SD2YFWQQ.js} +4 -4
- package/dist/{chunk-UHMJT4T7.js → chunk-TBDR6PAI.js} +2 -2
- package/dist/{chunk-47X6LRCE.js → chunk-UFSG7ACU.js} +10 -7
- package/dist/chunk-UFSG7ACU.js.map +1 -0
- package/dist/{chunk-CY6U5S3X.js → chunk-URWVKRCS.js} +2 -2
- package/dist/{chunk-NCRFYPS3.js → chunk-YEHAEDUD.js} +130 -44
- package/dist/chunk-YEHAEDUD.js.map +1 -0
- package/dist/{chunk-T375SUOZ.js → chunk-ZOPLCJSY.js} +86 -31
- package/dist/chunk-ZOPLCJSY.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/contract/index.d.ts +17 -17
- package/dist/contract/index.js +11 -11
- package/dist/{control-_Qb7skHX.d.ts → control-D6qwHXIR.d.ts} +4 -4
- package/dist/{control-runtime-DuFBYg7A.d.ts → control-runtime-Acf9CGhw.d.ts} +2 -2
- package/dist/control.d.ts +5 -5
- package/dist/control.js +2 -2
- package/dist/{corpus-BoR-041R.d.ts → corpus-B8A4BDR3.d.ts} +1 -1
- package/dist/{counterfactual-Dwibr5IW.d.ts → counterfactual-DlOz8PBx.d.ts} +3 -3
- package/dist/{default-registry-zoGHUQEH.d.ts → default-registry-6dhErQbs.d.ts} +2 -2
- package/dist/diagnose.d.ts +9 -9
- package/dist/diagnose.js +1 -1
- package/dist/{emitter-DEZwY14K.d.ts → emitter-C2rqGH_l.d.ts} +1 -1
- package/dist/{failure-cluster-CL7IVgkJ.d.ts → failure-cluster-DH9Flgcf.d.ts} +1 -1
- package/dist/{feedback-trajectory-D9OVLrg9.d.ts → feedback-trajectory-BxY0cKfs.d.ts} +1 -1
- package/dist/governance/index.d.ts +2 -2
- package/dist/{harness-optimizer-EnEnQPsr.d.ts → harness-optimizer-mOl9XX_O.d.ts} +1 -1
- package/dist/hosted/index.d.ts +4 -4
- package/dist/index.d.ts +181 -49
- package/dist/index.js +309 -90
- package/dist/index.js.map +1 -1
- package/dist/{insight-report-BBwvOh6x.d.ts → insight-report-DWl3z9tl.d.ts} +1 -1
- package/dist/{integrity-VJ9A7aST.d.ts → integrity-D2t12mMw.d.ts} +1 -1
- package/dist/{kind-factory-5b7xXXOr.d.ts → kind-factory-0BhLSI27.d.ts} +1 -1
- package/dist/knowledge/index.d.ts +3 -3
- package/dist/knowledge/index.js +2 -2
- package/dist/{llm-client-BeEcAokY.d.ts → llm-client-Bj7g0rqu.d.ts} +31 -0
- package/dist/meta-eval/index.d.ts +4 -4
- package/dist/meta-eval/index.js +1 -1
- package/dist/openapi.json +1 -1
- package/dist/pipelines/index.d.ts +6 -6
- package/dist/pipelines/index.js +40 -15
- package/dist/pipelines/index.js.map +1 -1
- package/dist/prm/index.d.ts +11 -7
- package/dist/prm/index.js +55 -12
- package/dist/prm/index.js.map +1 -1
- package/dist/{provenance-LnqRT0sS.d.ts → provenance-P-bCL2Fo.d.ts} +3 -3
- package/dist/{query-CqTxMwDw.d.ts → query-B7GGjRox.d.ts} +2 -1
- package/dist/{red-team-BXHil6c8.d.ts → red-team-BWdoyleI.d.ts} +1 -1
- package/dist/{release-report-euXIV_Sk.d.ts → release-report-BEbWmVYj.d.ts} +1 -1
- package/dist/reporting.d.ts +6 -6
- package/dist/reporting.js +3 -3
- package/dist/{researcher-DE6Gpnb4.d.ts → researcher-B0C2_fVO.d.ts} +5 -5
- package/dist/rl.d.ts +10 -10
- package/dist/rl.js +4 -4
- package/dist/{rubric-BOfxn4ja.d.ts → rubric-Cc6UHvUb.d.ts} +2 -2
- package/dist/{run-campaign-RDGAM5KJ.js → run-campaign-7WNXMDSN.js} +3 -3
- package/dist/{run-critic-BAIjX99r.d.ts → run-critic-CmMf05uV.d.ts} +1 -1
- package/dist/{run-improvement-loop-5z_l5zDz.d.ts → run-improvement-loop-DBahB8Ax.d.ts} +1 -1
- package/dist/{semantic-concept-judge-Dn8Z6KEG.d.ts → semantic-concept-judge-B9MgmBnM.d.ts} +3 -3
- package/dist/{statistics-C7PozGrZ.d.ts → statistics-CCJpTGOS.d.ts} +117 -2
- package/dist/{store-CKUAgsJz.d.ts → store-BcFXE6LG.d.ts} +16 -1
- package/dist/{summary-report-DGmUucwQ.d.ts → summary-report-BDOFevaT.d.ts} +1 -1
- package/dist/{test-graded-scenario-BdVaPyHT.d.ts → test-graded-scenario-DeODGLra.d.ts} +21 -2
- package/dist/traces.d.ts +19 -6
- package/dist/traces.js +4 -4
- package/dist/{trajectory-GEdXJCL5.d.ts → trajectory-2TkpSEVh.d.ts} +1 -1
- package/dist/{types-Croy5h7V.d.ts → types-C7DGg5ex.d.ts} +2 -0
- package/dist/{types-2VVIL04s.d.ts → types-Ce17tDlG.d.ts} +2 -2
- package/dist/wire/index.d.ts +8 -8
- package/dist/wire/index.js +2 -2
- package/dist/workflow/index.d.ts +13 -13
- package/dist/workflow/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-47X6LRCE.js.map +0 -1
- package/dist/chunk-CVVHBFGN.js.map +0 -1
- package/dist/chunk-GSH6QNNS.js.map +0 -1
- package/dist/chunk-LMZQ2Z4U.js.map +0 -1
- package/dist/chunk-NCRFYPS3.js.map +0 -1
- package/dist/chunk-QAY5UIJO.js.map +0 -1
- package/dist/chunk-QG2OVF2D.js.map +0 -1
- package/dist/chunk-T375SUOZ.js.map +0 -1
- package/dist/chunk-UMMZHCPB.js.map +0 -1
- /package/dist/{chunk-TWS7AZEY.js.map → chunk-2K6UUZ7P.js.map} +0 -0
- /package/dist/{chunk-Y47J2LJ3.js.map → chunk-2KNZHH3P.js.map} +0 -0
- /package/dist/{chunk-QS3RBQPI.js.map → chunk-D5KBVULY.js.map} +0 -0
- /package/dist/{chunk-RTWFUK6A.js.map → chunk-E4GH6USR.js.map} +0 -0
- /package/dist/{chunk-ZFIBGEOL.js.map → chunk-EGPMSBEZ.js.map} +0 -0
- /package/dist/{chunk-XY4DDNEG.js.map → chunk-MPQWFX6Y.js.map} +0 -0
- /package/dist/{chunk-L3JOU6XM.js.map → chunk-NACM5RS7.js.map} +0 -0
- /package/dist/{chunk-3CKU6VGU.js.map → chunk-Q2JRAWRI.js.map} +0 -0
- /package/dist/{chunk-4FBZZIYD.js.map → chunk-QTMYW64F.js.map} +0 -0
- /package/dist/{chunk-6SOJM3VR.js.map → chunk-SD2YFWQQ.js.map} +0 -0
- /package/dist/{chunk-UHMJT4T7.js.map → chunk-TBDR6PAI.js.map} +0 -0
- /package/dist/{chunk-CY6U5S3X.js.map → chunk-URWVKRCS.js.map} +0 -0
- /package/dist/{run-campaign-RDGAM5KJ.js.map → run-campaign-7WNXMDSN.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
checkBehavioralCanary,
|
|
10
10
|
checkCanaries,
|
|
11
11
|
runBehavioralCanaries
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-2KNZHH3P.js";
|
|
13
13
|
import {
|
|
14
14
|
classifyEuAiRisk,
|
|
15
15
|
euAiActReport,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
knowledgeReadinessTracePayload,
|
|
25
25
|
scoreKnowledgeReadiness,
|
|
26
26
|
userQuestionsForKnowledgeGaps
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-Q2JRAWRI.js";
|
|
28
28
|
import {
|
|
29
29
|
assertRecordIntegrity,
|
|
30
30
|
checkRecordIntegrity,
|
|
@@ -65,12 +65,12 @@ import {
|
|
|
65
65
|
scoreRedTeamOutput,
|
|
66
66
|
surfaceContentHash,
|
|
67
67
|
toolNamesForRun
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-EGPMSBEZ.js";
|
|
69
69
|
import {
|
|
70
70
|
BackendIntegrityError,
|
|
71
71
|
assertRealBackend,
|
|
72
72
|
summarizeBackendIntegrity
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-2K6UUZ7P.js";
|
|
74
74
|
import {
|
|
75
75
|
MODEL_PRICING,
|
|
76
76
|
MetricsCollector,
|
|
@@ -92,7 +92,7 @@ import {
|
|
|
92
92
|
computeToolUseMetrics,
|
|
93
93
|
iqr,
|
|
94
94
|
welchsTTest
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-NACM5RS7.js";
|
|
96
96
|
import {
|
|
97
97
|
analyzeSeries
|
|
98
98
|
} from "./chunk-BOD4O7OF.js";
|
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
pytestTestParser,
|
|
110
110
|
runTestGradedScenario,
|
|
111
111
|
vitestTestParser
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-ZOPLCJSY.js";
|
|
113
113
|
import {
|
|
114
114
|
DEFAULT_COMPLEXITY_WEIGHTS,
|
|
115
115
|
DEFAULT_RUN_SCORE_WEIGHTS,
|
|
@@ -129,11 +129,11 @@ import {
|
|
|
129
129
|
diffFindings,
|
|
130
130
|
resetLockedAppendersForTesting,
|
|
131
131
|
runSemanticConceptJudge
|
|
132
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-MPQWFX6Y.js";
|
|
133
133
|
import {
|
|
134
134
|
buildDefaultAnalystRegistry,
|
|
135
135
|
computeTraceMetrics
|
|
136
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-MIFZUPEK.js";
|
|
137
137
|
import {
|
|
138
138
|
AnalystRegistry,
|
|
139
139
|
DEFAULT_TRACE_ANALYST_KINDS,
|
|
@@ -143,7 +143,7 @@ import {
|
|
|
143
143
|
KNOWLEDGE_POISONING_KIND_SPEC,
|
|
144
144
|
createTraceAnalystKind,
|
|
145
145
|
renderPriorFindings
|
|
146
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-Q5LIB7BC.js";
|
|
147
147
|
import {
|
|
148
148
|
controlFailureClassFromVerification,
|
|
149
149
|
controlRunToRunRecord,
|
|
@@ -154,25 +154,29 @@ import {
|
|
|
154
154
|
runProposeReview,
|
|
155
155
|
runProposeReviewAsControlLoop,
|
|
156
156
|
scoreFromEvals
|
|
157
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-E4GH6USR.js";
|
|
158
158
|
import {
|
|
159
159
|
allCriticalPassed,
|
|
160
|
+
errorStreakDetector,
|
|
161
|
+
noProgressDetector,
|
|
160
162
|
objectiveEval,
|
|
163
|
+
observeAll,
|
|
164
|
+
repeatedActionDetector,
|
|
161
165
|
runAgentControlLoop,
|
|
162
166
|
stopOnNoProgress,
|
|
163
167
|
stopOnRepeatedAction,
|
|
164
168
|
subjectiveEval
|
|
165
|
-
} from "./chunk-
|
|
169
|
+
} from "./chunk-YEHAEDUD.js";
|
|
166
170
|
import {
|
|
167
171
|
assertReleaseConfidence,
|
|
168
172
|
bootstrapCi,
|
|
169
173
|
evaluateReleaseConfidence,
|
|
170
174
|
judgeReplayGate,
|
|
171
175
|
renderReleaseReport
|
|
172
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-QTMYW64F.js";
|
|
173
177
|
import {
|
|
174
178
|
runEvalCampaign
|
|
175
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-KW53MSA5.js";
|
|
176
180
|
import {
|
|
177
181
|
LlmCallError,
|
|
178
182
|
LlmClient,
|
|
@@ -184,7 +188,7 @@ import {
|
|
|
184
188
|
isTransientLlmError,
|
|
185
189
|
probeLlm,
|
|
186
190
|
stripFencedJson
|
|
187
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-CWNP4DV4.js";
|
|
188
192
|
import {
|
|
189
193
|
evaluateInterimReleaseConfidence,
|
|
190
194
|
pairedEvalueSequence
|
|
@@ -195,7 +199,7 @@ import {
|
|
|
195
199
|
paretoChart,
|
|
196
200
|
researchReport,
|
|
197
201
|
summaryTable
|
|
198
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-URWVKRCS.js";
|
|
199
203
|
import {
|
|
200
204
|
attributeCounterfactuals,
|
|
201
205
|
runCounterfactual
|
|
@@ -222,20 +226,26 @@ import {
|
|
|
222
226
|
interRaterReliability,
|
|
223
227
|
interpretCliffs,
|
|
224
228
|
mannWhitneyU,
|
|
229
|
+
mcnemar,
|
|
230
|
+
mcnemarPower,
|
|
231
|
+
mcnemarRequiredN,
|
|
225
232
|
mulberry32,
|
|
226
233
|
normalizeScores,
|
|
227
234
|
pairedBootstrap,
|
|
228
235
|
pairedMde,
|
|
236
|
+
pairedRiskDifference,
|
|
229
237
|
pairedTTest,
|
|
230
238
|
partialCredit,
|
|
239
|
+
passAtK,
|
|
231
240
|
positionalBias,
|
|
232
241
|
requiredSampleSize,
|
|
233
242
|
selfPreference,
|
|
234
243
|
verbosityBias,
|
|
235
244
|
weightedComposite,
|
|
236
245
|
weightedMean,
|
|
237
|
-
wilcoxonSignedRank
|
|
238
|
-
|
|
246
|
+
wilcoxonSignedRank,
|
|
247
|
+
wilson
|
|
248
|
+
} from "./chunk-56GC6VYO.js";
|
|
239
249
|
import {
|
|
240
250
|
FileSystemTraceStore,
|
|
241
251
|
InMemoryTraceStore,
|
|
@@ -266,7 +276,7 @@ import {
|
|
|
266
276
|
scoreTraceInsightReadiness,
|
|
267
277
|
tokenizeDomainWords,
|
|
268
278
|
traceAnalystOnRunComplete
|
|
269
|
-
} from "./chunk-
|
|
279
|
+
} from "./chunk-CTBHKLEU.js";
|
|
270
280
|
import {
|
|
271
281
|
DEFAULT_REDACTION_RULES,
|
|
272
282
|
REDACTION_VERSION,
|
|
@@ -282,7 +292,7 @@ import {
|
|
|
282
292
|
runFailureClass,
|
|
283
293
|
runsForScenario,
|
|
284
294
|
toolSpans
|
|
285
|
-
} from "./chunk-
|
|
295
|
+
} from "./chunk-UFSG7ACU.js";
|
|
286
296
|
import {
|
|
287
297
|
FAILURE_CLASSES,
|
|
288
298
|
TRACE_SCHEMA_VERSION,
|
|
@@ -297,7 +307,7 @@ import {
|
|
|
297
307
|
TRACE_ANALYST_ACTOR_DESCRIPTION_VERSION,
|
|
298
308
|
TRACE_ANALYST_SUBAGENT_DESCRIPTION,
|
|
299
309
|
analyzeTraces
|
|
300
|
-
} from "./chunk-
|
|
310
|
+
} from "./chunk-TBDR6PAI.js";
|
|
301
311
|
import {
|
|
302
312
|
DEFAULT_TRACE_ANALYST_BUDGETS,
|
|
303
313
|
OtlpFileTraceStore,
|
|
@@ -316,7 +326,7 @@ import {
|
|
|
316
326
|
readOtlpStatus,
|
|
317
327
|
stringField,
|
|
318
328
|
traceAnalystFunctionGroup
|
|
319
|
-
} from "./chunk-
|
|
329
|
+
} from "./chunk-QMUEXQJS.js";
|
|
320
330
|
import {
|
|
321
331
|
RunIntegrityError,
|
|
322
332
|
assertRunCaptured,
|
|
@@ -883,6 +893,14 @@ function parseJudgeResponse(judgeName, resp) {
|
|
|
883
893
|
}
|
|
884
894
|
|
|
885
895
|
// src/executor.ts
|
|
896
|
+
function describeShape(content, message) {
|
|
897
|
+
if (message === void 0 || message === null) return "no choices[0].message";
|
|
898
|
+
return `message.content of type ${content === null ? "null" : typeof content}`;
|
|
899
|
+
}
|
|
900
|
+
function errMessage(err) {
|
|
901
|
+
if (err instanceof Error) return `${err.name}: ${err.message}`;
|
|
902
|
+
return String(err);
|
|
903
|
+
}
|
|
886
904
|
async function executeScenario(tc, scenario, config) {
|
|
887
905
|
const startTime = Date.now();
|
|
888
906
|
const model = config.model ?? "gpt-4o";
|
|
@@ -903,7 +921,14 @@ async function executeScenario(tc, scenario, config) {
|
|
|
903
921
|
temperature: 0.4,
|
|
904
922
|
maxTokens: 3e3
|
|
905
923
|
});
|
|
906
|
-
const
|
|
924
|
+
const message = resp.choices?.[0]?.message;
|
|
925
|
+
const rawContent = message?.content;
|
|
926
|
+
if (message === void 0 || message === null || typeof rawContent !== "string") {
|
|
927
|
+
throw new CaptureIntegrityError(
|
|
928
|
+
`chat response for scenario "${scenario.id}" turn ${i} is malformed: expected choices[0].message.content to be a string, got ${describeShape(rawContent, message)}`
|
|
929
|
+
);
|
|
930
|
+
}
|
|
931
|
+
const content = rawContent;
|
|
907
932
|
messages.push({ role: "assistant", content });
|
|
908
933
|
const codeRe = /```(\w+)?\n([\s\S]*?)```/g;
|
|
909
934
|
let codeMatch = codeRe.exec(content);
|
|
@@ -984,26 +1009,44 @@ async function executeScenario(tc, scenario, config) {
|
|
|
984
1009
|
const judgeInput = { scenario, turns, artifacts };
|
|
985
1010
|
const judgeResults = [];
|
|
986
1011
|
let failedJudges = 0;
|
|
987
|
-
|
|
1012
|
+
const judgeFailures = [];
|
|
1013
|
+
const sleep2 = config.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
1014
|
+
for (let j = 0; j < config.judges.length; j++) {
|
|
1015
|
+
const judge = config.judges[j];
|
|
1016
|
+
const judgeName = judge.name || `judge[${j}]`;
|
|
1017
|
+
let lastError;
|
|
1018
|
+
let madeAttempts = 0;
|
|
988
1019
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
1020
|
+
madeAttempts = attempt + 1;
|
|
989
1021
|
try {
|
|
990
1022
|
if (attempt > 0) {
|
|
991
1023
|
const wait = attempt * 1e4;
|
|
992
|
-
console.log(`
|
|
993
|
-
await
|
|
1024
|
+
console.log(` ${judgeName} retry ${attempt}/2 (waiting ${wait / 1e3}s)`);
|
|
1025
|
+
await sleep2(wait);
|
|
994
1026
|
}
|
|
995
1027
|
const scores2 = await judge(tc, judgeInput);
|
|
996
1028
|
judgeResults.push(scores2);
|
|
997
|
-
await
|
|
1029
|
+
await sleep2(3e3);
|
|
1030
|
+
lastError = void 0;
|
|
998
1031
|
break;
|
|
999
1032
|
} catch (err) {
|
|
1033
|
+
lastError = err;
|
|
1000
1034
|
if (err instanceof JudgeParseError) {
|
|
1001
|
-
|
|
1035
|
+
console.error(` ${judgeName} unparseable (no retry): ${errMessage(err)}`);
|
|
1002
1036
|
break;
|
|
1003
1037
|
}
|
|
1004
|
-
|
|
1038
|
+
console.error(` ${judgeName} attempt ${attempt} failed: ${errMessage(err)}`);
|
|
1039
|
+
if (!isTransientLlmError(err)) break;
|
|
1005
1040
|
}
|
|
1006
1041
|
}
|
|
1042
|
+
if (lastError !== void 0) {
|
|
1043
|
+
failedJudges++;
|
|
1044
|
+
judgeFailures.push({
|
|
1045
|
+
judge: judgeName,
|
|
1046
|
+
attempts: madeAttempts,
|
|
1047
|
+
reason: errMessage(lastError)
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1007
1050
|
}
|
|
1008
1051
|
const allScores = judgeResults.flat();
|
|
1009
1052
|
const errorScores = allScores.filter(
|
|
@@ -1023,7 +1066,7 @@ async function executeScenario(tc, scenario, config) {
|
|
|
1023
1066
|
weight: weightMap.get(s.dimension) ?? 1
|
|
1024
1067
|
}))
|
|
1025
1068
|
);
|
|
1026
|
-
|
|
1069
|
+
const result = {
|
|
1027
1070
|
scenarioId: scenario.id,
|
|
1028
1071
|
persona: scenario.persona,
|
|
1029
1072
|
turns,
|
|
@@ -1034,6 +1077,8 @@ async function executeScenario(tc, scenario, config) {
|
|
|
1034
1077
|
totalDurationMs: Date.now() - startTime,
|
|
1035
1078
|
artifacts
|
|
1036
1079
|
};
|
|
1080
|
+
if (judgeFailures.length > 0) result.judgeFailures = judgeFailures;
|
|
1081
|
+
return result;
|
|
1037
1082
|
}
|
|
1038
1083
|
|
|
1039
1084
|
// src/benchmark.ts
|
|
@@ -1170,19 +1215,67 @@ var BenchmarkRunner = class {
|
|
|
1170
1215
|
};
|
|
1171
1216
|
|
|
1172
1217
|
// src/client.ts
|
|
1218
|
+
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
1173
1219
|
var ProductClient = class {
|
|
1174
1220
|
baseUrl;
|
|
1175
1221
|
routes;
|
|
1176
1222
|
cookies = "";
|
|
1223
|
+
timeoutMs;
|
|
1177
1224
|
constructor(config) {
|
|
1178
1225
|
this.baseUrl = config.baseUrl.replace(/\/+$/, "");
|
|
1179
1226
|
this.routes = config.routes;
|
|
1227
|
+
this.timeoutMs = config.timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
1180
1228
|
}
|
|
1181
1229
|
route(name) {
|
|
1182
1230
|
const path = this.routes[name];
|
|
1183
1231
|
if (!path) throw new Error(`Route "${name}" not configured`);
|
|
1184
1232
|
return path;
|
|
1185
1233
|
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Single HTTP boundary for every JSON request. Aborts after `timeoutMs`,
|
|
1236
|
+
* checks `res.ok` BEFORE parsing, and throws `${method} ${path} failed:
|
|
1237
|
+
* HTTP ${status} — ${body}` on a non-ok response so a 4xx/5xx error body
|
|
1238
|
+
* can never be parsed as a success shape. Callers inspect the resolved
|
|
1239
|
+
* value only after a successful return.
|
|
1240
|
+
*/
|
|
1241
|
+
async request(method, path, body) {
|
|
1242
|
+
const controller = new AbortController();
|
|
1243
|
+
const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
1244
|
+
let res;
|
|
1245
|
+
try {
|
|
1246
|
+
res = await fetch(`${this.baseUrl}${path}`, {
|
|
1247
|
+
method,
|
|
1248
|
+
headers: {
|
|
1249
|
+
...body ? { "Content-Type": "application/json" } : {},
|
|
1250
|
+
Origin: this.baseUrl,
|
|
1251
|
+
Cookie: this.cookies
|
|
1252
|
+
},
|
|
1253
|
+
...body ? { body: JSON.stringify(body) } : {},
|
|
1254
|
+
signal: controller.signal
|
|
1255
|
+
});
|
|
1256
|
+
} finally {
|
|
1257
|
+
clearTimeout(timeout);
|
|
1258
|
+
}
|
|
1259
|
+
if (!res.ok) {
|
|
1260
|
+
const text = await res.text().catch(() => "");
|
|
1261
|
+
throw new Error(`${method} ${path} failed: HTTP ${res.status} \u2014 ${text.slice(0, 500)}`);
|
|
1262
|
+
}
|
|
1263
|
+
return res.json();
|
|
1264
|
+
}
|
|
1265
|
+
/**
|
|
1266
|
+
* Read a required collection field. A missing/non-array field is a contract
|
|
1267
|
+
* violation (wrong route, drift, partial body) — surface it loud instead of
|
|
1268
|
+
* masking it as a healthy empty set. A genuinely empty `[]` passes through.
|
|
1269
|
+
*/
|
|
1270
|
+
requireArray(res, field) {
|
|
1271
|
+
const value = res[field];
|
|
1272
|
+
if (!Array.isArray(value)) {
|
|
1273
|
+
throw new Error(
|
|
1274
|
+
`Response missing array field "${field}" (got ${typeof value}: ${JSON.stringify(value)?.slice(0, 200)})`
|
|
1275
|
+
);
|
|
1276
|
+
}
|
|
1277
|
+
return value;
|
|
1278
|
+
}
|
|
1186
1279
|
async signup(name, email, password) {
|
|
1187
1280
|
const res = await this.post(this.route("signup"), { name, email, password });
|
|
1188
1281
|
const user = res.user;
|
|
@@ -1263,15 +1356,21 @@ var ProductClient = class {
|
|
|
1263
1356
|
}
|
|
1264
1357
|
async getTasks(workspaceId) {
|
|
1265
1358
|
const res = await this.get(`${this.route("tasks")}?workspaceId=${workspaceId}`);
|
|
1266
|
-
return
|
|
1359
|
+
return this.requireArray(
|
|
1360
|
+
res,
|
|
1361
|
+
"tasks"
|
|
1362
|
+
);
|
|
1267
1363
|
}
|
|
1268
1364
|
async getEvents(workspaceId) {
|
|
1269
1365
|
const res = await this.get(`${this.route("events")}?workspaceId=${workspaceId}`);
|
|
1270
|
-
return res
|
|
1366
|
+
return this.requireArray(res, "events");
|
|
1271
1367
|
}
|
|
1272
1368
|
async getApprovals(workspaceId) {
|
|
1273
1369
|
const res = await this.get(`${this.route("approvals")}?workspaceId=${workspaceId}`);
|
|
1274
|
-
return
|
|
1370
|
+
return this.requireArray(
|
|
1371
|
+
res,
|
|
1372
|
+
"actions"
|
|
1373
|
+
);
|
|
1275
1374
|
}
|
|
1276
1375
|
async getVaultTree(workspaceId) {
|
|
1277
1376
|
const res = await this.get(`${this.route("vault")}?workspaceId=${workspaceId}`);
|
|
@@ -1283,7 +1382,7 @@ var ProductClient = class {
|
|
|
1283
1382
|
if (node.children) extract(node.children);
|
|
1284
1383
|
}
|
|
1285
1384
|
}
|
|
1286
|
-
extract(res
|
|
1385
|
+
extract(this.requireArray(res, "tree"));
|
|
1287
1386
|
return paths;
|
|
1288
1387
|
}
|
|
1289
1388
|
async approveAction(workspaceId, id) {
|
|
@@ -1294,40 +1393,19 @@ var ProductClient = class {
|
|
|
1294
1393
|
}
|
|
1295
1394
|
async getGenerations(workspaceId) {
|
|
1296
1395
|
const res = await this.get(`${this.route("generations")}?workspaceId=${workspaceId}`);
|
|
1297
|
-
return res
|
|
1396
|
+
return this.requireArray(res, "generations");
|
|
1298
1397
|
}
|
|
1299
1398
|
/** Generic GET for custom routes */
|
|
1300
1399
|
async get(path) {
|
|
1301
|
-
|
|
1302
|
-
headers: { Cookie: this.cookies }
|
|
1303
|
-
});
|
|
1304
|
-
return res.json();
|
|
1400
|
+
return this.request("GET", path);
|
|
1305
1401
|
}
|
|
1306
1402
|
/** Generic POST for custom routes */
|
|
1307
1403
|
async post(path, body) {
|
|
1308
|
-
|
|
1309
|
-
method: "POST",
|
|
1310
|
-
headers: {
|
|
1311
|
-
"Content-Type": "application/json",
|
|
1312
|
-
Origin: this.baseUrl,
|
|
1313
|
-
Cookie: this.cookies
|
|
1314
|
-
},
|
|
1315
|
-
body: JSON.stringify(body)
|
|
1316
|
-
});
|
|
1317
|
-
return res.json();
|
|
1404
|
+
return this.request("POST", path, body);
|
|
1318
1405
|
}
|
|
1319
1406
|
/** Generic PATCH for custom routes */
|
|
1320
1407
|
async patch(path, body) {
|
|
1321
|
-
|
|
1322
|
-
method: "PATCH",
|
|
1323
|
-
headers: {
|
|
1324
|
-
"Content-Type": "application/json",
|
|
1325
|
-
Origin: this.baseUrl,
|
|
1326
|
-
Cookie: this.cookies
|
|
1327
|
-
},
|
|
1328
|
-
body: JSON.stringify(body)
|
|
1329
|
-
});
|
|
1330
|
-
return res.json();
|
|
1408
|
+
return this.request("PATCH", path, body);
|
|
1331
1409
|
}
|
|
1332
1410
|
};
|
|
1333
1411
|
async function runE2EWorkflow(client, name, workflow) {
|
|
@@ -1564,6 +1642,42 @@ Sign-off: respond with exactly "DONE" only when a ${persona.role} would act on t
|
|
|
1564
1642
|
|
|
1565
1643
|
Output ONLY your next message to the agent \u2014 in character, first person, no meta-commentary, no stage directions.`;
|
|
1566
1644
|
}
|
|
1645
|
+
function buildWorkerDriverSystemPrompt(ctx) {
|
|
1646
|
+
const harness = ctx.harness ?? "a coding agent";
|
|
1647
|
+
const brief = ctx.harnessBrief ? `
|
|
1648
|
+
This worker's harness (${harness}) can:
|
|
1649
|
+
${ctx.harnessBrief}
|
|
1650
|
+
Drive it to USE these \u2014 and never ask for a capability it lacks.
|
|
1651
|
+
` : `
|
|
1652
|
+
The worker runs in ${harness}. Drive it to exploit whatever its harness offers \u2014 parallel tool calls, sub-agents, run-to-completion \u2014 and never ask for a capability it lacks.
|
|
1653
|
+
`;
|
|
1654
|
+
const progress = ctx.progress ? `
|
|
1655
|
+
What the worker has done so far:
|
|
1656
|
+
${ctx.progress}
|
|
1657
|
+
` : "\nThe worker has not started yet \u2014 your first instruction sets the whole plan.\n";
|
|
1658
|
+
const context = ctx.context ? `
|
|
1659
|
+
Context:
|
|
1660
|
+
${ctx.context}
|
|
1661
|
+
` : "";
|
|
1662
|
+
return `You are a DRIVER: a meta-agent whose entire job is to drive a capable coding worker to ACHIEVE A GOAL by writing it precise, high-signal instructions. You do not do the work yourself \u2014 you direct the worker to do it, brilliantly, and you hold it to a standard it would not hold itself to.
|
|
1663
|
+
|
|
1664
|
+
The goal: ${ctx.goal}
|
|
1665
|
+
${context}${brief}${progress}
|
|
1666
|
+
THE BAR \u2014 non-negotiable. Every instruction you write is dense, specific, and complete. You write the message a world-class engineering lead writes to a strong report: the exact next objective, the concrete sub-steps, what to do in parallel vs in sequence, what to verify and how, what "done" looks like, and the failure modes to avoid. A thin steer \u2014 "try again", "fix the issues", a single vague sentence \u2014 is a failure on YOUR part, not the worker's. Out-drive a human power-user.
|
|
1667
|
+
|
|
1668
|
+
HOW to drive (each turn):
|
|
1669
|
+
1. Read what the worker actually did (its trace/state above), not what it claims. Find the real gap between here and the goal.
|
|
1670
|
+
2. Decide the next objective \u2014 the largest correct step the worker can take now.
|
|
1671
|
+
3. Decompose it: name the sub-tasks that can run IN PARALLEL (independent files/checks/searches) and tell the worker to fan them out (sub-agents / parallel tool calls where its harness allows); name what must run in SEQUENCE and why.
|
|
1672
|
+
4. Make it exploit the harness: drive it to run to completion under its own autonomy, spawn sub-agents for separable work, use its tools/MCP, and not stop at the first plausible stopping point.
|
|
1673
|
+
5. Specify verification: the exact command / test / check that proves the step landed, and tell it to run that and report the result \u2014 never accept "done" without the check.
|
|
1674
|
+
6. Name the traps: the specific failure modes for THIS step (editing the wrong file, a check that passes vacuously, scope creep) and forbid them.
|
|
1675
|
+
7. As the task gets harder, decompose MORE, not less \u2014 more parallel branches, deeper sub-agent trees, tighter verification.
|
|
1676
|
+
|
|
1677
|
+
COMPLETION: drive toward the goal's real acceptance check. Do not declare done \u2014 the deliverable's checker does. If the worker claims it is done, drive it to PROVE it with the check; if the check fails, drive the fix.
|
|
1678
|
+
|
|
1679
|
+
Output ONLY your next instruction to the worker \u2014 direct, detailed, actionable, in the first person as the driver. No meta-commentary, no preamble.`;
|
|
1680
|
+
}
|
|
1567
1681
|
async function decideNextUserTurn(tc, opts) {
|
|
1568
1682
|
const { persona, state, history, productContext = "", model = "claude-sonnet-4-6" } = opts;
|
|
1569
1683
|
const lastResponse = history.length > 0 ? history[history.length - 1].content.slice(0, 2e3) : "(no conversation yet \u2014 this is the first message)";
|
|
@@ -3485,6 +3599,7 @@ function ensembleJudge(opts) {
|
|
|
3485
3599
|
}
|
|
3486
3600
|
|
|
3487
3601
|
// src/judge-runner.ts
|
|
3602
|
+
import { cpus } from "os";
|
|
3488
3603
|
var JudgeRunner = class {
|
|
3489
3604
|
driver;
|
|
3490
3605
|
constructor(driver = new SubprocessSandboxDriver()) {
|
|
@@ -3514,11 +3629,22 @@ var JudgeRunner = class {
|
|
|
3514
3629
|
async function runJudgeFleet(specs, options = {}) {
|
|
3515
3630
|
const runner = new JudgeRunner(options.driver);
|
|
3516
3631
|
if (options.parallel === false) {
|
|
3517
|
-
const
|
|
3518
|
-
for (const spec of specs)
|
|
3519
|
-
return
|
|
3632
|
+
const results2 = [];
|
|
3633
|
+
for (const spec of specs) results2.push(await runner.run(spec));
|
|
3634
|
+
return results2;
|
|
3635
|
+
}
|
|
3636
|
+
const concurrency = Math.max(1, options.concurrency ?? cpus().length);
|
|
3637
|
+
const results = new Array(specs.length);
|
|
3638
|
+
let cursor = 0;
|
|
3639
|
+
async function worker() {
|
|
3640
|
+
while (true) {
|
|
3641
|
+
const i = cursor++;
|
|
3642
|
+
if (i >= specs.length) return;
|
|
3643
|
+
results[i] = await runner.run(specs[i]);
|
|
3644
|
+
}
|
|
3520
3645
|
}
|
|
3521
|
-
|
|
3646
|
+
await Promise.all(Array.from({ length: Math.min(concurrency, specs.length) }, () => worker()));
|
|
3647
|
+
return results;
|
|
3522
3648
|
}
|
|
3523
3649
|
function compilerJudge(id, config) {
|
|
3524
3650
|
return { id, kind: "compiler", config };
|
|
@@ -6781,8 +6907,15 @@ async function runSelfPlay(proposer, scorer, targets, options = {}) {
|
|
|
6781
6907
|
|
|
6782
6908
|
// src/command-runner.ts
|
|
6783
6909
|
import { spawnSync } from "child_process";
|
|
6784
|
-
import {
|
|
6785
|
-
|
|
6910
|
+
import {
|
|
6911
|
+
accessSync,
|
|
6912
|
+
existsSync as existsSync3,
|
|
6913
|
+
constants as fsConstants,
|
|
6914
|
+
readdirSync as readdirSync2,
|
|
6915
|
+
readFileSync as readFileSync3,
|
|
6916
|
+
statSync as statSync2
|
|
6917
|
+
} from "fs";
|
|
6918
|
+
import { delimiter, join as join2 } from "path";
|
|
6786
6919
|
var localCommandRunner = {
|
|
6787
6920
|
name: "local",
|
|
6788
6921
|
async run(input) {
|
|
@@ -6806,8 +6939,7 @@ var localCommandRunner = {
|
|
|
6806
6939
|
};
|
|
6807
6940
|
},
|
|
6808
6941
|
async hasBin(name) {
|
|
6809
|
-
|
|
6810
|
-
return r.status === 0 && (r.stdout ?? "").trim().length > 0;
|
|
6942
|
+
return resolveBinOnPath(name) !== null;
|
|
6811
6943
|
},
|
|
6812
6944
|
async fileExists(path) {
|
|
6813
6945
|
return existsSync3(path);
|
|
@@ -6815,16 +6947,18 @@ var localCommandRunner = {
|
|
|
6815
6947
|
async readFile(path) {
|
|
6816
6948
|
try {
|
|
6817
6949
|
return readFileSync3(path, "utf8");
|
|
6818
|
-
} catch {
|
|
6819
|
-
return null;
|
|
6950
|
+
} catch (err) {
|
|
6951
|
+
if (isErrnoCode(err, "ENOENT")) return null;
|
|
6952
|
+
throw err;
|
|
6820
6953
|
}
|
|
6821
6954
|
},
|
|
6822
6955
|
async readDir(path) {
|
|
6823
6956
|
let entries;
|
|
6824
6957
|
try {
|
|
6825
6958
|
entries = readdirSync2(path);
|
|
6826
|
-
} catch {
|
|
6827
|
-
return [];
|
|
6959
|
+
} catch (err) {
|
|
6960
|
+
if (isErrnoCode(err, "ENOENT")) return [];
|
|
6961
|
+
throw err;
|
|
6828
6962
|
}
|
|
6829
6963
|
const out = [];
|
|
6830
6964
|
for (const name of entries) {
|
|
@@ -6836,12 +6970,43 @@ var localCommandRunner = {
|
|
|
6836
6970
|
isFile: st.isFile(),
|
|
6837
6971
|
sizeBytes: st.isFile() ? st.size : null
|
|
6838
6972
|
});
|
|
6839
|
-
} catch {
|
|
6973
|
+
} catch (err) {
|
|
6974
|
+
if (isErrnoCode(err, "ENOENT")) continue;
|
|
6975
|
+
throw err;
|
|
6840
6976
|
}
|
|
6841
6977
|
}
|
|
6842
6978
|
return out;
|
|
6843
6979
|
}
|
|
6844
6980
|
};
|
|
6981
|
+
function isErrnoCode(err, code) {
|
|
6982
|
+
return typeof err === "object" && err !== null && err.code === code;
|
|
6983
|
+
}
|
|
6984
|
+
function resolveBinOnPath(name) {
|
|
6985
|
+
if (name.includes("/") || name.includes("\\")) {
|
|
6986
|
+
return isExecutable(name) ? name : null;
|
|
6987
|
+
}
|
|
6988
|
+
const pathEnv = process.env.PATH ?? "";
|
|
6989
|
+
const dirs = pathEnv.split(delimiter).filter((d) => d.length > 0);
|
|
6990
|
+
const exts = process.platform === "win32" ? (process.env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter((e) => e.length > 0) : [""];
|
|
6991
|
+
for (const dir of dirs) {
|
|
6992
|
+
for (const ext of exts) {
|
|
6993
|
+
const candidate = join2(dir, name + ext);
|
|
6994
|
+
if (isExecutable(candidate)) return candidate;
|
|
6995
|
+
}
|
|
6996
|
+
}
|
|
6997
|
+
return null;
|
|
6998
|
+
}
|
|
6999
|
+
function isExecutable(path) {
|
|
7000
|
+
try {
|
|
7001
|
+
accessSync(path, process.platform === "win32" ? fsConstants.F_OK : fsConstants.X_OK);
|
|
7002
|
+
return true;
|
|
7003
|
+
} catch (err) {
|
|
7004
|
+
if (isErrnoCode(err, "ENOENT") || isErrnoCode(err, "EACCES") || isErrnoCode(err, "ENOTDIR")) {
|
|
7005
|
+
return false;
|
|
7006
|
+
}
|
|
7007
|
+
throw err;
|
|
7008
|
+
}
|
|
7009
|
+
}
|
|
6845
7010
|
|
|
6846
7011
|
// src/deploy-gate-layer.ts
|
|
6847
7012
|
function deployGateLayer(input) {
|
|
@@ -8957,8 +9122,10 @@ function createSandboxPool(opts) {
|
|
|
8957
9122
|
const waiters = [];
|
|
8958
9123
|
const mutex = new Mutex();
|
|
8959
9124
|
let nextSlotId = 0;
|
|
9125
|
+
let reserving = 0;
|
|
8960
9126
|
let totalCheckouts = 0;
|
|
8961
9127
|
let busyMs = 0;
|
|
9128
|
+
let drained = false;
|
|
8962
9129
|
const startedAt = Date.now();
|
|
8963
9130
|
async function acquireSlot() {
|
|
8964
9131
|
let mintId;
|
|
@@ -8968,42 +9135,81 @@ function createSandboxPool(opts) {
|
|
|
8968
9135
|
idle.busy = true;
|
|
8969
9136
|
return idle;
|
|
8970
9137
|
}
|
|
8971
|
-
if (slots.length < opts.size) {
|
|
9138
|
+
if (slots.length + reserving < opts.size) {
|
|
8972
9139
|
mintId = `slot_${nextSlotId++}`;
|
|
9140
|
+
reserving++;
|
|
8973
9141
|
return null;
|
|
8974
9142
|
}
|
|
8975
9143
|
return null;
|
|
8976
9144
|
});
|
|
8977
9145
|
if (ready) return ready;
|
|
8978
9146
|
if (mintId !== void 0) {
|
|
8979
|
-
|
|
9147
|
+
let resource;
|
|
9148
|
+
try {
|
|
9149
|
+
resource = await opts.factory.create(mintId);
|
|
9150
|
+
} catch (err) {
|
|
9151
|
+
await mutex.runExclusive(() => {
|
|
9152
|
+
reserving--;
|
|
9153
|
+
});
|
|
9154
|
+
if (!drained) wakeWaiterToMint();
|
|
9155
|
+
throw err;
|
|
9156
|
+
}
|
|
8980
9157
|
const state = {
|
|
8981
9158
|
slot: { id: mintId, resource },
|
|
8982
9159
|
busy: true
|
|
8983
9160
|
};
|
|
8984
9161
|
await mutex.runExclusive(() => {
|
|
8985
9162
|
slots.push(state);
|
|
9163
|
+
reserving--;
|
|
8986
9164
|
});
|
|
8987
9165
|
return state;
|
|
8988
9166
|
}
|
|
8989
|
-
return new Promise((resolve) => {
|
|
8990
|
-
waiters.push(
|
|
8991
|
-
s.busy = true;
|
|
8992
|
-
resolve(s);
|
|
8993
|
-
});
|
|
9167
|
+
return new Promise((resolve, reject) => {
|
|
9168
|
+
waiters.push({ resolve, reject });
|
|
8994
9169
|
});
|
|
8995
9170
|
}
|
|
9171
|
+
function handOffCleanSlot(state) {
|
|
9172
|
+
const next = waiters.shift();
|
|
9173
|
+
if (next) {
|
|
9174
|
+
state.busy = true;
|
|
9175
|
+
next.resolve(state);
|
|
9176
|
+
}
|
|
9177
|
+
}
|
|
9178
|
+
function wakeWaiterToMint() {
|
|
9179
|
+
const next = waiters.shift();
|
|
9180
|
+
if (!next) return;
|
|
9181
|
+
acquireSlot().then(next.resolve, next.reject);
|
|
9182
|
+
}
|
|
8996
9183
|
function releaseSlot(state) {
|
|
8997
9184
|
void (async () => {
|
|
8998
9185
|
try {
|
|
8999
|
-
if (opts.factory.reset)
|
|
9000
|
-
|
|
9001
|
-
|
|
9186
|
+
if (opts.factory.reset) {
|
|
9187
|
+
await opts.factory.reset(state.slot);
|
|
9188
|
+
}
|
|
9189
|
+
state.busy = false;
|
|
9190
|
+
if (!drained) handOffCleanSlot(state);
|
|
9191
|
+
} catch (resetErr) {
|
|
9192
|
+
await mutex.runExclusive(() => {
|
|
9193
|
+
const i = slots.indexOf(state);
|
|
9194
|
+
if (i !== -1) slots.splice(i, 1);
|
|
9195
|
+
});
|
|
9196
|
+
try {
|
|
9197
|
+
await opts.factory.destroy(state.slot);
|
|
9198
|
+
} catch (destroyErr) {
|
|
9199
|
+
console.warn(
|
|
9200
|
+
`[sandbox-pool] destroy of dirty slot ${state.slot.id} failed after reset error:`,
|
|
9201
|
+
destroyErr
|
|
9202
|
+
);
|
|
9203
|
+
}
|
|
9204
|
+
console.warn(
|
|
9205
|
+
`[sandbox-pool] reset failed for slot ${state.slot.id} \u2014 slot destroyed, not recycled:`,
|
|
9206
|
+
resetErr
|
|
9207
|
+
);
|
|
9208
|
+
if (!drained) wakeWaiterToMint();
|
|
9002
9209
|
}
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
})();
|
|
9210
|
+
})().catch((err) => {
|
|
9211
|
+
console.warn(`[sandbox-pool] release of slot ${state.slot.id} faulted:`, err);
|
|
9212
|
+
});
|
|
9007
9213
|
}
|
|
9008
9214
|
async function checkout() {
|
|
9009
9215
|
const state = await acquireSlot();
|
|
@@ -9026,13 +9232,15 @@ function createSandboxPool(opts) {
|
|
|
9026
9232
|
}
|
|
9027
9233
|
}
|
|
9028
9234
|
async function drain() {
|
|
9029
|
-
|
|
9235
|
+
drained = true;
|
|
9236
|
+
const { snapshot, pending } = await mutex.runExclusive(() => {
|
|
9030
9237
|
const taken = slots.splice(0, slots.length);
|
|
9031
|
-
|
|
9032
|
-
|
|
9033
|
-
}
|
|
9034
|
-
return taken;
|
|
9238
|
+
const queued = waiters.splice(0, waiters.length);
|
|
9239
|
+
return { snapshot: taken, pending: queued };
|
|
9035
9240
|
});
|
|
9241
|
+
for (const w of pending) {
|
|
9242
|
+
w.reject(new Error("sandbox pool drained while a checkout was pending"));
|
|
9243
|
+
}
|
|
9036
9244
|
await Promise.allSettled(snapshot.map((s) => opts.factory.destroy(s.slot)));
|
|
9037
9245
|
}
|
|
9038
9246
|
function utilization() {
|
|
@@ -10033,6 +10241,7 @@ export {
|
|
|
10033
10241
|
buildTraceInsightContext,
|
|
10034
10242
|
buildTraceInsightPrompt,
|
|
10035
10243
|
buildTrajectory,
|
|
10244
|
+
buildWorkerDriverSystemPrompt,
|
|
10036
10245
|
byteLengthRange,
|
|
10037
10246
|
cachedJudge,
|
|
10038
10247
|
calibrateJudge,
|
|
@@ -10122,6 +10331,7 @@ export {
|
|
|
10122
10331
|
dominates,
|
|
10123
10332
|
eProcess,
|
|
10124
10333
|
ensembleJudge,
|
|
10334
|
+
errorStreakDetector,
|
|
10125
10335
|
estimateCost,
|
|
10126
10336
|
estimateTokens,
|
|
10127
10337
|
euAiActReport,
|
|
@@ -10226,6 +10436,9 @@ export {
|
|
|
10226
10436
|
mannWhitneyU,
|
|
10227
10437
|
matchGoldens,
|
|
10228
10438
|
matchSpan,
|
|
10439
|
+
mcnemar,
|
|
10440
|
+
mcnemarPower,
|
|
10441
|
+
mcnemarRequiredN,
|
|
10229
10442
|
mergeLayerResults,
|
|
10230
10443
|
mergeSteeringBundle,
|
|
10231
10444
|
modelDescriptionBits,
|
|
@@ -10233,15 +10446,18 @@ export {
|
|
|
10233
10446
|
mulberry32,
|
|
10234
10447
|
multiToolchainLayer,
|
|
10235
10448
|
nistAiRmfReport,
|
|
10449
|
+
noProgressDetector,
|
|
10236
10450
|
normalizeScores,
|
|
10237
10451
|
notBlocked,
|
|
10238
10452
|
objectiveEval,
|
|
10453
|
+
observeAll,
|
|
10239
10454
|
otelRunCompleteHook,
|
|
10240
10455
|
otlpToRunRecords,
|
|
10241
10456
|
otlpToTraceRunRecords,
|
|
10242
10457
|
pairedBootstrap,
|
|
10243
10458
|
pairedEvalueSequence,
|
|
10244
10459
|
pairedMde,
|
|
10460
|
+
pairedRiskDifference,
|
|
10245
10461
|
pairedTTest,
|
|
10246
10462
|
paraphraseRobustness,
|
|
10247
10463
|
paraphraseRobustnessScenarios,
|
|
@@ -10256,6 +10472,7 @@ export {
|
|
|
10256
10472
|
parseRuntimeTrajectoryHookEvent,
|
|
10257
10473
|
partialCredit,
|
|
10258
10474
|
partitionHeldOut,
|
|
10475
|
+
passAtK,
|
|
10259
10476
|
passOrthogonality,
|
|
10260
10477
|
pixelDeltaRatio,
|
|
10261
10478
|
planTraceInsightQuestions,
|
|
@@ -10290,6 +10507,7 @@ export {
|
|
|
10290
10507
|
renderPriorFindings,
|
|
10291
10508
|
renderReleaseReport,
|
|
10292
10509
|
renderSteeringText,
|
|
10510
|
+
repeatedActionDetector,
|
|
10293
10511
|
replayFeedbackTrajectories,
|
|
10294
10512
|
replayFeedbackTrajectory,
|
|
10295
10513
|
replayScorerOverCorpus,
|
|
@@ -10395,6 +10613,7 @@ export {
|
|
|
10395
10613
|
welchsTTest,
|
|
10396
10614
|
whitespaceCollapseMutator,
|
|
10397
10615
|
wilcoxonSignedRank,
|
|
10616
|
+
wilson,
|
|
10398
10617
|
withAssignedFeedbackSplit,
|
|
10399
10618
|
withJudgeRetry,
|
|
10400
10619
|
withOtelPipeline,
|