@mcpjam/inspector 3.7.0 → 3.7.1
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/client/assets/{dead-clicks-autocapture-CPfW6ZJr.js → dead-clicks-autocapture-D4XO86KE.js} +2 -2
- package/dist/client/assets/{exception-autocapture-D6HvOFAK.js → exception-autocapture-B4GM6dj8.js} +2 -2
- package/dist/client/assets/{highlighted-body-OFNGDK62-t_ZJkwo3.js → highlighted-body-OFNGDK62-DVdJ1y68.js} +2 -2
- package/dist/client/assets/index-B_UEMZg7.css +1 -0
- package/dist/client/assets/{index-BPygr2AP.js → index-DtxMWUuT.js} +4 -4
- package/dist/client/assets/{jszip.min-D58OmF_2.js → jszip.min-Bt89Oyf7.js} +2 -2
- package/dist/client/assets/{posthog-recorder-BMZYBTqS.js → posthog-recorder-W3JvAsiu.js} +2 -2
- package/dist/client/assets/{surveys-CRu4KQim.js → surveys-lAZNJhhE.js} +2 -2
- package/dist/client/assets/{web-vitals-DWWB9Abt.js → web-vitals-D1MKog94.js} +2 -2
- package/dist/client/index.html +2 -2
- package/dist/server/{chunk-YCXJ5YSM.js → chunk-XTCUQXBF.js} +2 -2
- package/dist/server/harness-install-cli.js +1 -1
- package/dist/server/index.js +2030 -605
- package/package.json +4 -3
- package/dist/client/assets/index-DFTKFcSo.css +0 -1
package/dist/server/index.js
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
supportsOwnershipProof,
|
|
36
36
|
terminateOwnedProcess,
|
|
37
37
|
terminateOwnedProcessGroup
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-XTCUQXBF.js";
|
|
39
39
|
import {
|
|
40
40
|
ALLOWED_HOSTS,
|
|
41
41
|
BROWSER_CONSENT_HEADER,
|
|
@@ -241,7 +241,7 @@ function classifyToolFailurePart(part) {
|
|
|
241
241
|
if (part.type !== "tool-result") return null;
|
|
242
242
|
const toolName3 = typeof part.toolName === "string" ? part.toolName : void 0;
|
|
243
243
|
const toolCallId = typeof part.toolCallId === "string" ? part.toolCallId : void 0;
|
|
244
|
-
const
|
|
244
|
+
const record5 = (kind, message) => ({
|
|
245
245
|
kind,
|
|
246
246
|
...toolName3 ? { toolName: toolName3 } : {},
|
|
247
247
|
...toolCallId ? { toolCallId } : {},
|
|
@@ -253,20 +253,20 @@ function classifyToolFailurePart(part) {
|
|
|
253
253
|
...message && message.trim() ? { message: message.trim() } : {}
|
|
254
254
|
});
|
|
255
255
|
if (typeof part.error === "string" && part.error.trim())
|
|
256
|
-
return
|
|
256
|
+
return record5("protocol-error", part.error);
|
|
257
257
|
if (isRecord(part.error) && typeof part.error.message === "string" && part.error.message.trim()) {
|
|
258
|
-
return
|
|
258
|
+
return record5("protocol-error", part.error.message);
|
|
259
259
|
}
|
|
260
260
|
const output = part.output;
|
|
261
261
|
if (isRecord(output) && output.type === "error-text")
|
|
262
|
-
return
|
|
262
|
+
return record5("protocol-error", errorTextOf(output.value));
|
|
263
263
|
if (isRecord(part.result) && part.result.isError === true)
|
|
264
|
-
return
|
|
264
|
+
return record5("content-error", callToolResultText(part.result));
|
|
265
265
|
const unwrapped = unwrapToolOutput(output);
|
|
266
266
|
if (isRecord(unwrapped) && unwrapped.isError === true)
|
|
267
|
-
return
|
|
267
|
+
return record5("content-error", callToolResultText(unwrapped));
|
|
268
268
|
if (part.isError === true)
|
|
269
|
-
return
|
|
269
|
+
return record5("content-error", callToolResultText(part));
|
|
270
270
|
return null;
|
|
271
271
|
}
|
|
272
272
|
function traceMessagePartIndicatesToolFailure(part) {
|
|
@@ -849,10 +849,10 @@ function write(value, ancestors) {
|
|
|
849
849
|
"Cannot canonicalize a non-plain object (only plain objects, arrays and JSON primitives are part of the contract)"
|
|
850
850
|
);
|
|
851
851
|
}
|
|
852
|
-
const
|
|
852
|
+
const record5 = value;
|
|
853
853
|
const parts = [];
|
|
854
|
-
for (const key of Object.keys(
|
|
855
|
-
const entry3 =
|
|
854
|
+
for (const key of Object.keys(record5).sort()) {
|
|
855
|
+
const entry3 = record5[key];
|
|
856
856
|
if (entry3 === void 0) continue;
|
|
857
857
|
parts.push(`${JSON.stringify(key)}:${write(entry3, ancestors)}`);
|
|
858
858
|
}
|
|
@@ -2243,18 +2243,6 @@ __export(evaluate_exports, {
|
|
|
2243
2243
|
finalMessageEndsWithQuestion: () => finalMessageEndsWithQuestion
|
|
2244
2244
|
});
|
|
2245
2245
|
|
|
2246
|
-
// ../evaluators/dist/chunk-I4CRERJV.js
|
|
2247
|
-
var PROBE = "__predicate_arg_probe__";
|
|
2248
|
-
function argMatch(matcher, actualArgs) {
|
|
2249
|
-
const argumentMatching = matcher.argumentMatching ?? "partial";
|
|
2250
|
-
const result = evaluateToolCalls(
|
|
2251
|
-
[{ toolName: PROBE, arguments: matcher.args ?? {} }],
|
|
2252
|
-
[{ toolName: PROBE, arguments: actualArgs ?? {} }],
|
|
2253
|
-
{ argumentMatching }
|
|
2254
|
-
);
|
|
2255
|
-
return result.passed;
|
|
2256
|
-
}
|
|
2257
|
-
|
|
2258
2246
|
// ../evaluators/dist/chunk-PYTZA5U2.js
|
|
2259
2247
|
import { Validator } from "@cfworker/json-schema";
|
|
2260
2248
|
var DRAFT_2020_12_URIS = /* @__PURE__ */ new Set([
|
|
@@ -2329,7 +2317,19 @@ function validateAgainstSchema(schema, instance) {
|
|
|
2329
2317
|
}
|
|
2330
2318
|
}
|
|
2331
2319
|
|
|
2332
|
-
// ../evaluators/dist/chunk-
|
|
2320
|
+
// ../evaluators/dist/chunk-I4CRERJV.js
|
|
2321
|
+
var PROBE = "__predicate_arg_probe__";
|
|
2322
|
+
function argMatch(matcher, actualArgs) {
|
|
2323
|
+
const argumentMatching = matcher.argumentMatching ?? "partial";
|
|
2324
|
+
const result = evaluateToolCalls(
|
|
2325
|
+
[{ toolName: PROBE, arguments: matcher.args ?? {} }],
|
|
2326
|
+
[{ toolName: PROBE, arguments: actualArgs ?? {} }],
|
|
2327
|
+
{ argumentMatching }
|
|
2328
|
+
);
|
|
2329
|
+
return result.passed;
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
// ../evaluators/dist/chunk-YNFR3VPW.js
|
|
2333
2333
|
var MAX_VALUE_CHARS = 200;
|
|
2334
2334
|
var MAX_ERROR_MSG_CHARS = 200;
|
|
2335
2335
|
var MAX_ITEMS_SHOWN = 3;
|
|
@@ -3683,11 +3683,11 @@ function messagesOf(trace) {
|
|
|
3683
3683
|
}
|
|
3684
3684
|
function countUserTurns(messages) {
|
|
3685
3685
|
if (!Array.isArray(messages)) return void 0;
|
|
3686
|
-
let
|
|
3686
|
+
let count4 = 0;
|
|
3687
3687
|
for (const message of messages) {
|
|
3688
|
-
if (isRecord3(message) && message.role === "user")
|
|
3688
|
+
if (isRecord3(message) && message.role === "user") count4 += 1;
|
|
3689
3689
|
}
|
|
3690
|
-
return
|
|
3690
|
+
return count4;
|
|
3691
3691
|
}
|
|
3692
3692
|
function buildTurnTranscript(input) {
|
|
3693
3693
|
return {
|
|
@@ -3800,7 +3800,7 @@ __export(predicate_scorer_exports, {
|
|
|
3800
3800
|
predicateScorer: () => predicateScorer
|
|
3801
3801
|
});
|
|
3802
3802
|
|
|
3803
|
-
// ../evaluators/dist/chunk-
|
|
3803
|
+
// ../evaluators/dist/chunk-LICJIDQY.js
|
|
3804
3804
|
function assertLocallyEvaluable(predicate) {
|
|
3805
3805
|
if (!requiresRenderObservations(predicate.type)) return;
|
|
3806
3806
|
throw new Error(
|
|
@@ -3878,7 +3878,7 @@ function toEvaluatorRawOutcome(outcome) {
|
|
|
3878
3878
|
};
|
|
3879
3879
|
}
|
|
3880
3880
|
|
|
3881
|
-
// ../evaluators/dist/chunk-
|
|
3881
|
+
// ../evaluators/dist/chunk-K67IGSPF.js
|
|
3882
3882
|
function assertLocallyEvaluable2(rule) {
|
|
3883
3883
|
if (!requiresRenderObservations(rule.type)) return;
|
|
3884
3884
|
throw new Error(
|
|
@@ -8377,7 +8377,7 @@ var init_HostRunner = __esm({
|
|
|
8377
8377
|
this.mcpjamLeaseScope = config.mcpjamLeaseScope;
|
|
8378
8378
|
this.mcpjamProject = config.mcpjamProject;
|
|
8379
8379
|
this.baseUrls = config.baseUrls;
|
|
8380
|
-
this.systemPrompt = config.systemPrompt ?? (this.hostSnapshot?.systemPrompt && this.hostSnapshot.systemPrompt !== "" ? this.hostSnapshot.systemPrompt : "You are a helpful assistant.");
|
|
8380
|
+
this.systemPrompt = (config.systemPrompt ? config.systemPrompt : void 0) ?? (this.hostSnapshot?.systemPrompt && this.hostSnapshot.systemPrompt !== "" ? this.hostSnapshot.systemPrompt : "You are a helpful assistant.");
|
|
8381
8381
|
this.temperature = config.temperature ?? this.hostSnapshot?.temperature;
|
|
8382
8382
|
this.maxSteps = config.maxSteps ?? 10;
|
|
8383
8383
|
this.customProviders = config.customProviders;
|
|
@@ -21155,8 +21155,8 @@ function errorCheck(detail) {
|
|
|
21155
21155
|
function skippedCheck(detail) {
|
|
21156
21156
|
return { status: "skipped", detail };
|
|
21157
21157
|
}
|
|
21158
|
-
function describeCount(
|
|
21159
|
-
return `${
|
|
21158
|
+
function describeCount(count22, label) {
|
|
21159
|
+
return `${count22} ${label}${count22 === 1 ? "" : "s"} discovered.`;
|
|
21160
21160
|
}
|
|
21161
21161
|
function isServerDoctorError(error) {
|
|
21162
21162
|
return !!error && typeof error === "object" && typeof error.code === "string" && typeof error.message === "string";
|
|
@@ -23037,8 +23037,8 @@ var EVAL_VERDICT_DECISION_REASONS = [
|
|
|
23037
23037
|
...EVAL_VALIDITY_DECISION_REASONS,
|
|
23038
23038
|
...EVAL_TASK_DECISION_REASONS
|
|
23039
23039
|
];
|
|
23040
|
-
var evalVerdictDecisionReasonSchema = z2.enum(
|
|
23041
|
-
|
|
23040
|
+
var evalVerdictDecisionReasonSchema = z2.enum(EVAL_VERDICT_DECISION_REASONS).describe(
|
|
23041
|
+
"Why the verdict is what it is. The validity reasons are evaluated FIRST and make a run `inconclusive`; the task reasons decide `passed` / `failed` once validity holds. `configuredTrialsNotAttempted` \u2014 some configured trial never ran. `noGradeableTrials` \u2014 nothing in the suite was gradeable. `eligibleTrialsBelowMinimum` \u2014 the explicit `minEligibleTrials` was not reached. `completionRateBelowMinimum` \u2014 measured, and under the floor. `completionRateNotMeasured` \u2014 nothing was attempted, so the floor is unsatisfiable; a not-measured rate never passes one. `evaluatorErrorRateAboveMaximum` \u2014 the grader failed too often for the run to describe the server. `evaluatorErrorRateNotMeasured` \u2014 the same unsatisfiable case for the ceiling. `caseHasNoEligibleTrials` \u2014 a case graded nothing, which is inconclusive even at `passThreshold: 0`. `casePassRateMetThreshold` \u2014 a case's own passing reason. `casePassRateBelowThreshold` \u2014 a case failed its threshold, and so therefore did the suite. `allMeasuredCasesMetThreshold` \u2014 the suite's only passing reason."
|
|
23042
23042
|
);
|
|
23043
23043
|
function isEvalValidityDecisionReason(value) {
|
|
23044
23044
|
return typeof value === "string" && EVAL_VALIDITY_DECISION_REASONS.includes(value);
|
|
@@ -25683,6 +25683,416 @@ var evalBacktestContinuationSchema = z2.object({
|
|
|
25683
25683
|
evalBacktestDraftSchema.extend({
|
|
25684
25684
|
continuation: evalBacktestContinuationSchema.optional()
|
|
25685
25685
|
});
|
|
25686
|
+
var SWARM_SESSION_VERDICT_CONTRACT_VERSION = 1;
|
|
25687
|
+
var SWARM_ATTEMPT_STATUSES = [
|
|
25688
|
+
"pending",
|
|
25689
|
+
"running",
|
|
25690
|
+
"succeeded",
|
|
25691
|
+
"failed",
|
|
25692
|
+
"rate_limited"
|
|
25693
|
+
];
|
|
25694
|
+
var SWARM_SESSION_LIFECYCLES = [
|
|
25695
|
+
"pending",
|
|
25696
|
+
"running",
|
|
25697
|
+
"ran",
|
|
25698
|
+
"broke",
|
|
25699
|
+
"limited",
|
|
25700
|
+
"withdrawn"
|
|
25701
|
+
];
|
|
25702
|
+
var SWARM_SESSION_VERDICTS = [
|
|
25703
|
+
"passed",
|
|
25704
|
+
"failed",
|
|
25705
|
+
"inconclusive",
|
|
25706
|
+
"notEstablished"
|
|
25707
|
+
];
|
|
25708
|
+
var SWARM_GRADING_STATES = [
|
|
25709
|
+
"notRequested",
|
|
25710
|
+
"queued",
|
|
25711
|
+
"running",
|
|
25712
|
+
"settled",
|
|
25713
|
+
"unavailable"
|
|
25714
|
+
];
|
|
25715
|
+
var SWARM_SESSION_VERDICT_OF_REASON = {
|
|
25716
|
+
attemptPending: "notEstablished",
|
|
25717
|
+
attemptRunning: "notEstablished",
|
|
25718
|
+
withdrawn: "notEstablished",
|
|
25719
|
+
spendCapReached: "notEstablished",
|
|
25720
|
+
notRun: "notEstablished",
|
|
25721
|
+
executionFailed: "notEstablished",
|
|
25722
|
+
ungraded: "notEstablished",
|
|
25723
|
+
gradingNotClaimed: "notEstablished",
|
|
25724
|
+
criteriaPending: "notEstablished",
|
|
25725
|
+
judgePending: "notEstablished",
|
|
25726
|
+
gatingCriterionFailed: "failed",
|
|
25727
|
+
judgeFailed: "failed",
|
|
25728
|
+
criteriaGradingErrored: "inconclusive",
|
|
25729
|
+
gatingCriterionUnmeasured: "inconclusive",
|
|
25730
|
+
judgeErrored: "inconclusive",
|
|
25731
|
+
gradingUnavailable: "inconclusive",
|
|
25732
|
+
allGatingCriteriaPassed: "passed",
|
|
25733
|
+
judgePassed: "passed",
|
|
25734
|
+
allGradersPassed: "passed"
|
|
25735
|
+
};
|
|
25736
|
+
var SWARM_SESSION_VERDICT_REASONS = Object.keys(
|
|
25737
|
+
SWARM_SESSION_VERDICT_OF_REASON
|
|
25738
|
+
);
|
|
25739
|
+
var swarmSessionLifecycleSchema = z2.enum(SWARM_SESSION_LIFECYCLES);
|
|
25740
|
+
var swarmSessionVerdictValueSchema = z2.enum(SWARM_SESSION_VERDICTS);
|
|
25741
|
+
var swarmGraderRoleSchema = z2.enum(["advisory", "required"]);
|
|
25742
|
+
var swarmSessionAttemptInputSchema = z2.object({
|
|
25743
|
+
status: z2.enum(SWARM_ATTEMPT_STATUSES),
|
|
25744
|
+
errorCode: z2.string().nullable().optional()
|
|
25745
|
+
}).strict();
|
|
25746
|
+
var swarmGradingReadinessSchema = z2.object({
|
|
25747
|
+
/** Durable readiness for decisive grading only, not background observations. */
|
|
25748
|
+
state: z2.enum(SWARM_GRADING_STATES),
|
|
25749
|
+
reasonCode: z2.string().min(1).optional()
|
|
25750
|
+
}).strict();
|
|
25751
|
+
var criterionResultSchema = z2.object({
|
|
25752
|
+
criterionId: z2.string().min(1),
|
|
25753
|
+
passed: z2.boolean(),
|
|
25754
|
+
status: z2.enum(["scored", "error"]).optional()
|
|
25755
|
+
}).strict();
|
|
25756
|
+
z2.object({
|
|
25757
|
+
attempt: swarmSessionAttemptInputSchema.nullable(),
|
|
25758
|
+
hasTranscript: z2.boolean(),
|
|
25759
|
+
rubric: z2.array(
|
|
25760
|
+
z2.object({
|
|
25761
|
+
id: z2.string().min(1),
|
|
25762
|
+
role: swarmGraderRoleSchema,
|
|
25763
|
+
predicateType: z2.string().min(1).optional()
|
|
25764
|
+
}).strict()
|
|
25765
|
+
),
|
|
25766
|
+
criteria: z2.object({
|
|
25767
|
+
status: z2.enum(["pending", "completed", "failed"]),
|
|
25768
|
+
criterionIds: z2.array(z2.string().min(1)).optional(),
|
|
25769
|
+
results: z2.array(criterionResultSchema).optional()
|
|
25770
|
+
}).strict().nullable(),
|
|
25771
|
+
goalScore: z2.discriminatedUnion("status", [
|
|
25772
|
+
z2.object({ status: z2.literal("completed"), passed: z2.boolean() }).strict(),
|
|
25773
|
+
z2.object({ status: z2.literal("running") }).strict(),
|
|
25774
|
+
z2.object({ status: z2.literal("failed") }).strict()
|
|
25775
|
+
]).nullable(),
|
|
25776
|
+
judge: z2.object({
|
|
25777
|
+
automatic: z2.boolean(),
|
|
25778
|
+
role: swarmGraderRoleSchema,
|
|
25779
|
+
/** Explicit on-demand intent; automatic:false alone does not mean a judge was requested. */
|
|
25780
|
+
requested: z2.boolean().optional()
|
|
25781
|
+
}).strict(),
|
|
25782
|
+
grading: swarmGradingReadinessSchema
|
|
25783
|
+
}).strict().superRefine((value, ctx) => {
|
|
25784
|
+
const definitions = new Set(value.rubric.map((entry22) => entry22.id));
|
|
25785
|
+
if (definitions.size !== value.rubric.length) {
|
|
25786
|
+
ctx.addIssue({
|
|
25787
|
+
code: "custom",
|
|
25788
|
+
path: ["rubric"],
|
|
25789
|
+
message: "Duplicate criterion definition"
|
|
25790
|
+
});
|
|
25791
|
+
}
|
|
25792
|
+
for (const [field2, ids] of [
|
|
25793
|
+
["criterionIds", value.criteria?.criterionIds ?? []],
|
|
25794
|
+
["results", value.criteria?.results?.map((row2) => row2.criterionId) ?? []]
|
|
25795
|
+
]) {
|
|
25796
|
+
if (new Set(ids).size !== ids.length || ids.some((id3) => !definitions.has(id3))) {
|
|
25797
|
+
ctx.addIssue({
|
|
25798
|
+
code: "custom",
|
|
25799
|
+
path: ["criteria", field2],
|
|
25800
|
+
message: "Criterion IDs must be unique and defined in the snapshot"
|
|
25801
|
+
});
|
|
25802
|
+
}
|
|
25803
|
+
}
|
|
25804
|
+
const claimed = value.criteria?.criterionIds;
|
|
25805
|
+
if (claimed && value.criteria?.results?.some((row2) => !claimed.includes(row2.criterionId))) {
|
|
25806
|
+
ctx.addIssue({
|
|
25807
|
+
code: "custom",
|
|
25808
|
+
path: ["criteria", "results"],
|
|
25809
|
+
message: "Result outside claimed scope"
|
|
25810
|
+
});
|
|
25811
|
+
}
|
|
25812
|
+
});
|
|
25813
|
+
var SWARM_SESSION_TRIAL_STATUSES = [
|
|
25814
|
+
"pending",
|
|
25815
|
+
"running",
|
|
25816
|
+
"completed",
|
|
25817
|
+
"failed",
|
|
25818
|
+
"setup_failed",
|
|
25819
|
+
"cancelled"
|
|
25820
|
+
];
|
|
25821
|
+
var swarmSessionTrialSchema = z2.object({
|
|
25822
|
+
status: z2.enum(SWARM_SESSION_TRIAL_STATUSES),
|
|
25823
|
+
taskVerdict: z2.enum(["passed", "failed"]).optional(),
|
|
25824
|
+
evaluatorError: z2.literal(true).optional()
|
|
25825
|
+
}).strict().superRefine((value, ctx) => {
|
|
25826
|
+
const verdict = value.taskVerdict !== void 0;
|
|
25827
|
+
const error = value.evaluatorError === true;
|
|
25828
|
+
if (value.status === "completed" ? verdict === error : verdict || error) {
|
|
25829
|
+
ctx.addIssue({
|
|
25830
|
+
code: "custom",
|
|
25831
|
+
message: "Only completed trials carry exactly one verdict or evaluator error"
|
|
25832
|
+
});
|
|
25833
|
+
}
|
|
25834
|
+
});
|
|
25835
|
+
var swarmSessionGraderCountsSchema = z2.object({
|
|
25836
|
+
gating: z2.number().int().nonnegative(),
|
|
25837
|
+
gatingPassed: z2.number().int().nonnegative(),
|
|
25838
|
+
gatingFailed: z2.number().int().nonnegative(),
|
|
25839
|
+
gatingUnmeasured: z2.number().int().nonnegative(),
|
|
25840
|
+
advisoryFailed: z2.number().int().nonnegative()
|
|
25841
|
+
}).strict();
|
|
25842
|
+
var swarmSessionVerdictSchema = z2.object({
|
|
25843
|
+
contractVersion: z2.literal(SWARM_SESSION_VERDICT_CONTRACT_VERSION),
|
|
25844
|
+
lifecycle: swarmSessionLifecycleSchema,
|
|
25845
|
+
verdict: swarmSessionVerdictValueSchema,
|
|
25846
|
+
reason: z2.enum(SWARM_SESSION_VERDICT_REASONS),
|
|
25847
|
+
verdictSource: z2.enum([
|
|
25848
|
+
"goalJudge",
|
|
25849
|
+
"requiredAssertions",
|
|
25850
|
+
"combined",
|
|
25851
|
+
"none"
|
|
25852
|
+
]),
|
|
25853
|
+
grading: swarmGradingReadinessSchema,
|
|
25854
|
+
graders: z2.object({
|
|
25855
|
+
criteria: z2.enum([
|
|
25856
|
+
"notConfigured",
|
|
25857
|
+
"notClaimed",
|
|
25858
|
+
"pending",
|
|
25859
|
+
"scored",
|
|
25860
|
+
"errored"
|
|
25861
|
+
]),
|
|
25862
|
+
judge: z2.enum([
|
|
25863
|
+
"notConfigured",
|
|
25864
|
+
"silent",
|
|
25865
|
+
"pending",
|
|
25866
|
+
"scored",
|
|
25867
|
+
"errored"
|
|
25868
|
+
])
|
|
25869
|
+
}).strict(),
|
|
25870
|
+
counts: swarmSessionGraderCountsSchema,
|
|
25871
|
+
trial: swarmSessionTrialSchema.nullable()
|
|
25872
|
+
}).strict().superRefine((value, ctx) => {
|
|
25873
|
+
const fail3 = (message) => ctx.addIssue({ code: "custom", message });
|
|
25874
|
+
if (SWARM_SESSION_VERDICT_OF_REASON[value.reason] !== value.verdict)
|
|
25875
|
+
fail3("Reason contradicts verdict");
|
|
25876
|
+
const c = value.counts;
|
|
25877
|
+
if (c.gating !== c.gatingPassed + c.gatingFailed + c.gatingUnmeasured)
|
|
25878
|
+
fail3("Required measurement counts do not add up");
|
|
25879
|
+
const trial = value.trial;
|
|
25880
|
+
if (trial?.status === "completed") {
|
|
25881
|
+
if (value.lifecycle !== "ran")
|
|
25882
|
+
fail3("Only a completed execution can be a completed trial");
|
|
25883
|
+
if (trial.taskVerdict !== void 0 && trial.taskVerdict !== value.verdict)
|
|
25884
|
+
fail3("Trial contradicts goal result");
|
|
25885
|
+
if (trial.evaluatorError && value.verdict !== "inconclusive")
|
|
25886
|
+
fail3("Evaluator error requires inconclusive grading");
|
|
25887
|
+
}
|
|
25888
|
+
const expected = {
|
|
25889
|
+
pending: "pending",
|
|
25890
|
+
running: "running",
|
|
25891
|
+
broke: "failed",
|
|
25892
|
+
limited: "setup_failed",
|
|
25893
|
+
withdrawn: "cancelled"
|
|
25894
|
+
};
|
|
25895
|
+
if (value.lifecycle !== "ran" && trial?.status !== expected[value.lifecycle])
|
|
25896
|
+
fail3("Trial must preserve execution lifecycle");
|
|
25897
|
+
if (value.lifecycle === "ran" && trial !== null && trial.status !== "completed")
|
|
25898
|
+
fail3("Completed execution must not become skipped or running");
|
|
25899
|
+
if ((value.verdict === "passed" || value.verdict === "failed") && value.verdictSource === "none")
|
|
25900
|
+
fail3("A measured goal verdict needs a source");
|
|
25901
|
+
if (value.lifecycle === "ran" && value.verdict !== "notEstablished" && trial === null)
|
|
25902
|
+
fail3("Settled grading on completed execution needs an observation");
|
|
25903
|
+
if (value.verdict === "notEstablished" && value.verdictSource !== "none")
|
|
25904
|
+
fail3("An undecided goal has no verdict source");
|
|
25905
|
+
});
|
|
25906
|
+
var SWARM_REPORT_CONTRACT_VERSION = 1;
|
|
25907
|
+
var count = z2.number().int().nonnegative();
|
|
25908
|
+
var journeyRunVerdictSummarySchema = z2.discriminatedUnion("status", [
|
|
25909
|
+
z2.object({
|
|
25910
|
+
status: z2.literal("pending"),
|
|
25911
|
+
pendingSessions: count,
|
|
25912
|
+
updatedAt: count
|
|
25913
|
+
}).strict(),
|
|
25914
|
+
z2.object({
|
|
25915
|
+
status: z2.literal("decided"),
|
|
25916
|
+
decision: evalVerdictDecisionSchema,
|
|
25917
|
+
updatedAt: count
|
|
25918
|
+
}).strict(),
|
|
25919
|
+
z2.object({
|
|
25920
|
+
status: z2.literal("notEstablished"),
|
|
25921
|
+
reason: z2.literal("gradingNotConfigured"),
|
|
25922
|
+
updatedAt: count
|
|
25923
|
+
}).strict(),
|
|
25924
|
+
z2.object({
|
|
25925
|
+
status: z2.literal("integrityFailed"),
|
|
25926
|
+
reason: z2.string().min(1),
|
|
25927
|
+
updatedAt: count
|
|
25928
|
+
}).strict()
|
|
25929
|
+
]);
|
|
25930
|
+
var swarmObservationInputSchema = z2.object({
|
|
25931
|
+
evaluatorId: z2.string().min(1),
|
|
25932
|
+
predicateType: z2.enum(
|
|
25933
|
+
Object.keys(ASSERTION_STAGE)
|
|
25934
|
+
),
|
|
25935
|
+
role: z2.enum(["advisory", "required"]),
|
|
25936
|
+
/** Missing capture/error is unavailable; it must not use the compatibility passed:false. */
|
|
25937
|
+
status: z2.enum(["passed", "failed", "pending", "unavailable"])
|
|
25938
|
+
}).strict();
|
|
25939
|
+
var swarmReportSessionSchema = z2.object({
|
|
25940
|
+
/** Stable attempt/slot identity, including slots with no session document. */
|
|
25941
|
+
id: z2.string().min(1),
|
|
25942
|
+
/** A producer fact. Grade coverage and lifecycle alone cannot establish a non-start. */
|
|
25943
|
+
startEvidence: z2.enum(["started", "notStarted", "unknown"]),
|
|
25944
|
+
verdict: swarmSessionVerdictSchema,
|
|
25945
|
+
observations: z2.array(swarmObservationInputSchema)
|
|
25946
|
+
}).strict().superRefine((row2, ctx) => {
|
|
25947
|
+
if (new Set(row2.observations.map((o) => o.evaluatorId)).size !== row2.observations.length) {
|
|
25948
|
+
ctx.addIssue({
|
|
25949
|
+
code: "custom",
|
|
25950
|
+
path: ["observations"],
|
|
25951
|
+
message: "Duplicate evaluator in one session"
|
|
25952
|
+
});
|
|
25953
|
+
}
|
|
25954
|
+
if (row2.startEvidence === "notStarted" && ["running", "ran"].includes(row2.verdict.lifecycle)) {
|
|
25955
|
+
ctx.addIssue({
|
|
25956
|
+
code: "custom",
|
|
25957
|
+
path: ["startEvidence"],
|
|
25958
|
+
message: "Execution contradicts explicit non-start"
|
|
25959
|
+
});
|
|
25960
|
+
}
|
|
25961
|
+
});
|
|
25962
|
+
z2.object({
|
|
25963
|
+
runId: z2.string().min(1),
|
|
25964
|
+
executionComplete: z2.boolean(),
|
|
25965
|
+
configuredSessions: count,
|
|
25966
|
+
verdictSummary: journeyRunVerdictSummarySchema.nullable(),
|
|
25967
|
+
/** Frozen run-wide definitions: absent measurement rows still count as unavailable. */
|
|
25968
|
+
evaluatorDefinitions: z2.array(
|
|
25969
|
+
swarmObservationInputSchema.omit({ status: true })
|
|
25970
|
+
),
|
|
25971
|
+
sessions: z2.array(swarmReportSessionSchema)
|
|
25972
|
+
}).strict().superRefine((input, ctx) => {
|
|
25973
|
+
if (input.sessions.length > input.configuredSessions) {
|
|
25974
|
+
ctx.addIssue({
|
|
25975
|
+
code: "custom",
|
|
25976
|
+
path: ["sessions"],
|
|
25977
|
+
message: "Reported sessions exceed configured population"
|
|
25978
|
+
});
|
|
25979
|
+
}
|
|
25980
|
+
if (new Set(input.sessions.map((row2) => row2.id)).size !== input.sessions.length) {
|
|
25981
|
+
ctx.addIssue({
|
|
25982
|
+
code: "custom",
|
|
25983
|
+
path: ["sessions"],
|
|
25984
|
+
message: "Duplicate session/attempt identity"
|
|
25985
|
+
});
|
|
25986
|
+
}
|
|
25987
|
+
const definitions = new Map(
|
|
25988
|
+
input.evaluatorDefinitions.map((row2) => [row2.evaluatorId, row2])
|
|
25989
|
+
);
|
|
25990
|
+
if (definitions.size !== input.evaluatorDefinitions.length) {
|
|
25991
|
+
ctx.addIssue({
|
|
25992
|
+
code: "custom",
|
|
25993
|
+
path: ["evaluatorDefinitions"],
|
|
25994
|
+
message: "Duplicate evaluator definition"
|
|
25995
|
+
});
|
|
25996
|
+
}
|
|
25997
|
+
for (const session of input.sessions) {
|
|
25998
|
+
for (const observation of session.observations) {
|
|
25999
|
+
const definition = definitions.get(observation.evaluatorId);
|
|
26000
|
+
if (!definition || definition.role !== observation.role || definition.predicateType !== observation.predicateType) {
|
|
26001
|
+
ctx.addIssue({
|
|
26002
|
+
code: "custom",
|
|
26003
|
+
path: ["sessions"],
|
|
26004
|
+
message: "Observation contradicts the frozen evaluator definition"
|
|
26005
|
+
});
|
|
26006
|
+
}
|
|
26007
|
+
}
|
|
26008
|
+
}
|
|
26009
|
+
});
|
|
26010
|
+
var swarmObservationCoverageSchema = z2.object({
|
|
26011
|
+
evaluatorId: z2.string().min(1),
|
|
26012
|
+
predicateType: z2.enum(
|
|
26013
|
+
Object.keys(ASSERTION_STAGE)
|
|
26014
|
+
),
|
|
26015
|
+
role: z2.enum(["advisory", "required"]),
|
|
26016
|
+
stage: z2.enum(USER_VALUE_STAGES).describe(
|
|
26017
|
+
"The stage this observation was read from, and the only stage it is evidence ABOUT. `connection` \u2014 the server was reachable and the session initialized. `discovery` \u2014 its tools and resources were listed and readable. `selection` \u2014 the model chose the right tool for the request. `call` \u2014 the call was made with usable arguments. `response` \u2014 the server returned data the model could use. `userValue` \u2014 the user's actual request was satisfied."
|
|
26018
|
+
),
|
|
26019
|
+
unit: z2.literal("sessions"),
|
|
26020
|
+
total: count,
|
|
26021
|
+
passed: count,
|
|
26022
|
+
failed: count,
|
|
26023
|
+
pending: count,
|
|
26024
|
+
unavailable: count
|
|
26025
|
+
}).strict().superRefine((value, ctx) => {
|
|
26026
|
+
if (value.total !== value.passed + value.failed + value.pending + value.unavailable) {
|
|
26027
|
+
ctx.addIssue({
|
|
26028
|
+
code: "custom",
|
|
26029
|
+
message: "Observation coverage must partition its population"
|
|
26030
|
+
});
|
|
26031
|
+
}
|
|
26032
|
+
if (value.stage !== ASSERTION_STAGE[value.predicateType]) {
|
|
26033
|
+
ctx.addIssue({
|
|
26034
|
+
code: "custom",
|
|
26035
|
+
message: "Observation stage contradicts the shared evaluator map"
|
|
26036
|
+
});
|
|
26037
|
+
}
|
|
26038
|
+
});
|
|
26039
|
+
z2.object({
|
|
26040
|
+
contractVersion: z2.literal(SWARM_REPORT_CONTRACT_VERSION),
|
|
26041
|
+
runId: z2.string().min(1),
|
|
26042
|
+
verdict: swarmSessionVerdictValueSchema,
|
|
26043
|
+
verdictSource: z2.enum(["policyV2", "none"]),
|
|
26044
|
+
decision: evalVerdictDecisionSchema.optional(),
|
|
26045
|
+
undecidedReason: z2.enum([
|
|
26046
|
+
"executionPending",
|
|
26047
|
+
"gradingPending",
|
|
26048
|
+
"gradingNotConfigured",
|
|
26049
|
+
"verdictSummaryUnavailable",
|
|
26050
|
+
"integrityFailed"
|
|
26051
|
+
]).optional(),
|
|
26052
|
+
execution: z2.object({
|
|
26053
|
+
unit: z2.literal("sessions"),
|
|
26054
|
+
configured: count,
|
|
26055
|
+
reported: count,
|
|
26056
|
+
started: count,
|
|
26057
|
+
notStarted: count,
|
|
26058
|
+
unknown: count,
|
|
26059
|
+
completed: count,
|
|
26060
|
+
interrupted: count,
|
|
26061
|
+
/** Only explicit complete execution evidence can establish this. */
|
|
26062
|
+
neverLaunched: z2.boolean()
|
|
26063
|
+
}).strict(),
|
|
26064
|
+
goalGrading: z2.object({
|
|
26065
|
+
unit: z2.literal("sessions"),
|
|
26066
|
+
reported: count,
|
|
26067
|
+
passed: count,
|
|
26068
|
+
failed: count,
|
|
26069
|
+
pending: count,
|
|
26070
|
+
unavailable: count,
|
|
26071
|
+
notRequested: count,
|
|
26072
|
+
/** Readiness is separate: a proven failure can exist while other required grading is pending. */
|
|
26073
|
+
waitingForDecisiveGrading: count
|
|
26074
|
+
}).strict(),
|
|
26075
|
+
observations: z2.array(swarmObservationCoverageSchema)
|
|
26076
|
+
}).strict().superRefine((report, ctx) => {
|
|
26077
|
+
const fail3 = (message) => ctx.addIssue({ code: "custom", message });
|
|
26078
|
+
if (report.verdictSource === "policyV2") {
|
|
26079
|
+
if (!report.decision || report.verdict !== report.decision.verdict || report.undecidedReason !== void 0)
|
|
26080
|
+
fail3("Report must copy its authoritative decision");
|
|
26081
|
+
} else if (report.verdict !== "notEstablished" || report.decision !== void 0 || !report.undecidedReason)
|
|
26082
|
+
fail3("Missing authority must have an undecided reason");
|
|
26083
|
+
const e = report.execution;
|
|
26084
|
+
if (e.started + e.notStarted + e.unknown !== e.configured || e.reported > e.configured)
|
|
26085
|
+
fail3("Execution evidence does not cover its configured population");
|
|
26086
|
+
if (e.started + e.notStarted > e.reported || e.completed + e.interrupted > e.reported)
|
|
26087
|
+
fail3("Execution counts exceed reported evidence");
|
|
26088
|
+
if (e.neverLaunched !== (e.configured > 0 && e.reported === e.configured && e.notStarted === e.configured))
|
|
26089
|
+
fail3("Not run requires explicit evidence for the entire population");
|
|
26090
|
+
const g = report.goalGrading;
|
|
26091
|
+
if (g.reported !== e.reported || g.passed + g.failed + g.pending + g.unavailable + g.notRequested !== g.reported || g.waitingForDecisiveGrading > g.reported)
|
|
26092
|
+
fail3("Goal coverage must partition reported sessions");
|
|
26093
|
+
if (new Set(report.observations.map((o) => o.evaluatorId)).size !== report.observations.length || report.observations.some((o) => o.total > e.reported))
|
|
26094
|
+
fail3("Invalid observation population");
|
|
26095
|
+
});
|
|
25686
26096
|
var COMPARATIVE_GATE_FIELDS = [
|
|
25687
26097
|
"noDeterministicRegressions",
|
|
25688
26098
|
"maximumP95LatencyIncreaseMs",
|
|
@@ -25717,7 +26127,7 @@ var noopPosthog = {
|
|
|
25717
26127
|
var posthog = isTelemetryDisabled ? noopPosthog : new PostHog("phc_dTOPniyUNU2kD8Jx8yHMXSqiZHM8I91uWopTMX6EBE9", {
|
|
25718
26128
|
host: "https://us.i.posthog.com"
|
|
25719
26129
|
});
|
|
25720
|
-
var SDK_VERSION = "8.
|
|
26130
|
+
var SDK_VERSION = "8.10.0";
|
|
25721
26131
|
var SDK_RELEASE = `@mcpjam/sdk@${SDK_VERSION}`;
|
|
25722
26132
|
var CAPTURED_ERROR_SYMBOL = Symbol.for("@mcpjam/sdk/captured-eval-error");
|
|
25723
26133
|
init_internal();
|
|
@@ -25728,7 +26138,7 @@ init_eval_tool_execution();
|
|
|
25728
26138
|
init_internal();
|
|
25729
26139
|
init_internal();
|
|
25730
26140
|
function readSdkVersion() {
|
|
25731
|
-
return "8.
|
|
26141
|
+
return "8.10.0";
|
|
25732
26142
|
}
|
|
25733
26143
|
var DEFAULT_PLATFORM_USER_AGENT = `mcpjam-sdk/${readSdkVersion()}`;
|
|
25734
26144
|
init_HostRunner();
|
|
@@ -40733,7 +41143,7 @@ async function runTransportChecks(ctx, selectedCheckIds) {
|
|
|
40733
41143
|
const readErrors = sseResponses.map(
|
|
40734
41144
|
({ response }) => response.bodyError
|
|
40735
41145
|
);
|
|
40736
|
-
const allStreamsReadable = requestErrors.every((error) => error === void 0) && !responseFailures && readErrors.every((error) => error === void 0) && eventCounts.every((
|
|
41146
|
+
const allStreamsReadable = requestErrors.every((error) => error === void 0) && !responseFailures && readErrors.every((error) => error === void 0) && eventCounts.every((count22) => count22 > 0);
|
|
40737
41147
|
results.push(
|
|
40738
41148
|
allStreamsReadable ? passedResult2(
|
|
40739
41149
|
TRANSPORT_CHECK_METADATA["server-sse-streams-functional"],
|
|
@@ -74624,11 +75034,11 @@ function canonicalizeBooleanLeaves2(value, keys, fieldName) {
|
|
|
74624
75034
|
if (!isPlainObject32(value)) {
|
|
74625
75035
|
throw new Error(`hostConfigV2: ${fieldName} must be a plain object`);
|
|
74626
75036
|
}
|
|
74627
|
-
const
|
|
74628
|
-
assertOnlyKnownKeys2(
|
|
75037
|
+
const record5 = value;
|
|
75038
|
+
assertOnlyKnownKeys2(record5, new Set(keys), fieldName);
|
|
74629
75039
|
const out = {};
|
|
74630
75040
|
for (const key of keys) {
|
|
74631
|
-
const bool = readOptionalBoolean2(
|
|
75041
|
+
const bool = readOptionalBoolean2(record5, key, fieldName);
|
|
74632
75042
|
if (bool !== void 0) out[key] = bool;
|
|
74633
75043
|
}
|
|
74634
75044
|
return Object.keys(out).length > 0 ? out : void 0;
|
|
@@ -74641,10 +75051,10 @@ function canonicalizeResourceVisibility2(value, fieldName) {
|
|
|
74641
75051
|
if (!isPlainObject32(value)) {
|
|
74642
75052
|
throw new Error(`hostConfigV2: ${fieldName} must be a plain object`);
|
|
74643
75053
|
}
|
|
74644
|
-
const
|
|
74645
|
-
assertOnlyKnownKeys2(
|
|
74646
|
-
const text2 = readOptionalBoolean2(
|
|
74647
|
-
const blob = canonicalizeBlobVisibility2(
|
|
75054
|
+
const record5 = value;
|
|
75055
|
+
assertOnlyKnownKeys2(record5, new Set(RESOURCE_VISIBILITY_KEYS2), fieldName);
|
|
75056
|
+
const text2 = readOptionalBoolean2(record5, "text", fieldName);
|
|
75057
|
+
const blob = canonicalizeBlobVisibility2(record5.blob, `${fieldName}.blob`);
|
|
74648
75058
|
const out = {
|
|
74649
75059
|
...text2 !== void 0 ? { text: text2 } : {},
|
|
74650
75060
|
...blob !== void 0 ? { blob } : {}
|
|
@@ -74658,23 +75068,23 @@ function canonicalizeModelVisibleMcpToolResults2(value) {
|
|
|
74658
75068
|
"hostConfigV2: modelVisibleMcpToolResults must be a plain object"
|
|
74659
75069
|
);
|
|
74660
75070
|
}
|
|
74661
|
-
const
|
|
75071
|
+
const record5 = value;
|
|
74662
75072
|
assertOnlyKnownKeys2(
|
|
74663
|
-
|
|
75073
|
+
record5,
|
|
74664
75074
|
/* @__PURE__ */ new Set(["directContent", "embeddedResources", "linkedResources"]),
|
|
74665
75075
|
"modelVisibleMcpToolResults"
|
|
74666
75076
|
);
|
|
74667
75077
|
const directContent = canonicalizeBooleanLeaves2(
|
|
74668
|
-
|
|
75078
|
+
record5.directContent,
|
|
74669
75079
|
DIRECT_CONTENT_VISIBILITY_KEYS2,
|
|
74670
75080
|
"modelVisibleMcpToolResults.directContent"
|
|
74671
75081
|
);
|
|
74672
75082
|
const embeddedResources = canonicalizeResourceVisibility2(
|
|
74673
|
-
|
|
75083
|
+
record5.embeddedResources,
|
|
74674
75084
|
"modelVisibleMcpToolResults.embeddedResources"
|
|
74675
75085
|
);
|
|
74676
75086
|
const linkedResources = canonicalizeResourceVisibility2(
|
|
74677
|
-
|
|
75087
|
+
record5.linkedResources,
|
|
74678
75088
|
"modelVisibleMcpToolResults.linkedResources"
|
|
74679
75089
|
);
|
|
74680
75090
|
const out = {
|
|
@@ -74699,14 +75109,14 @@ function canonicalizeImageRenderingResource2(value, fieldName) {
|
|
|
74699
75109
|
if (!isPlainObject32(value)) {
|
|
74700
75110
|
throw new Error(`hostConfigV2: ${fieldName} must be a plain object`);
|
|
74701
75111
|
}
|
|
74702
|
-
const
|
|
75112
|
+
const record5 = value;
|
|
74703
75113
|
assertOnlyKnownKeys2(
|
|
74704
|
-
|
|
75114
|
+
record5,
|
|
74705
75115
|
new Set(MCP_TOOL_RESULT_IMAGE_RENDERING_RESOURCE_KEYS2),
|
|
74706
75116
|
fieldName
|
|
74707
75117
|
);
|
|
74708
75118
|
const blob = canonicalizeBooleanLeaves2(
|
|
74709
|
-
|
|
75119
|
+
record5.blob,
|
|
74710
75120
|
MCP_TOOL_RESULT_IMAGE_RENDERING_BLOB_KEYS2,
|
|
74711
75121
|
`${fieldName}.blob`
|
|
74712
75122
|
);
|
|
@@ -74722,28 +75132,28 @@ function canonicalizeMcpToolResultImageRenderingPolicy2(value) {
|
|
|
74722
75132
|
"hostConfigV2: mcpToolResultImageRendering must be a plain object"
|
|
74723
75133
|
);
|
|
74724
75134
|
}
|
|
74725
|
-
const
|
|
75135
|
+
const record5 = value;
|
|
74726
75136
|
assertOnlyKnownKeys2(
|
|
74727
|
-
|
|
75137
|
+
record5,
|
|
74728
75138
|
new Set(MCP_TOOL_RESULT_IMAGE_RENDERING_KEYS2),
|
|
74729
75139
|
"mcpToolResultImageRendering"
|
|
74730
75140
|
);
|
|
74731
75141
|
const placement = readOptionalMcpToolResultImageRenderPlacement2(
|
|
74732
|
-
|
|
75142
|
+
record5,
|
|
74733
75143
|
"placement",
|
|
74734
75144
|
"mcpToolResultImageRendering"
|
|
74735
75145
|
);
|
|
74736
75146
|
const directContent = canonicalizeBooleanLeaves2(
|
|
74737
|
-
|
|
75147
|
+
record5.directContent,
|
|
74738
75148
|
MCP_TOOL_RESULT_IMAGE_RENDERING_DIRECT_CONTENT_KEYS2,
|
|
74739
75149
|
"mcpToolResultImageRendering.directContent"
|
|
74740
75150
|
);
|
|
74741
75151
|
const embeddedResources = canonicalizeImageRenderingResource2(
|
|
74742
|
-
|
|
75152
|
+
record5.embeddedResources,
|
|
74743
75153
|
"mcpToolResultImageRendering.embeddedResources"
|
|
74744
75154
|
);
|
|
74745
75155
|
const linkedResources = canonicalizeImageRenderingResource2(
|
|
74746
|
-
|
|
75156
|
+
record5.linkedResources,
|
|
74747
75157
|
"mcpToolResultImageRendering.linkedResources"
|
|
74748
75158
|
);
|
|
74749
75159
|
const out = {
|
|
@@ -74868,11 +75278,11 @@ function canonicalizeSkillSelection2(value) {
|
|
|
74868
75278
|
if (!isPlainObject32(value)) {
|
|
74869
75279
|
throw new Error("hostConfigV2: skillSelection must be a plain object");
|
|
74870
75280
|
}
|
|
74871
|
-
const
|
|
74872
|
-
const mode =
|
|
75281
|
+
const record5 = value;
|
|
75282
|
+
const mode = record5.mode;
|
|
74873
75283
|
if (mode === "all-visible") {
|
|
74874
75284
|
assertOnlyKnownKeys2(
|
|
74875
|
-
|
|
75285
|
+
record5,
|
|
74876
75286
|
SKILL_SELECTION_ALL_VISIBLE_KEYS2,
|
|
74877
75287
|
"skillSelection"
|
|
74878
75288
|
);
|
|
@@ -74880,11 +75290,11 @@ function canonicalizeSkillSelection2(value) {
|
|
|
74880
75290
|
}
|
|
74881
75291
|
if (mode === "explicit") {
|
|
74882
75292
|
assertOnlyKnownKeys2(
|
|
74883
|
-
|
|
75293
|
+
record5,
|
|
74884
75294
|
SKILL_SELECTION_EXPLICIT_KEYS2,
|
|
74885
75295
|
"skillSelection"
|
|
74886
75296
|
);
|
|
74887
|
-
const skillIds =
|
|
75297
|
+
const skillIds = record5.skillIds;
|
|
74888
75298
|
if (!Array.isArray(skillIds)) {
|
|
74889
75299
|
throw new Error(
|
|
74890
75300
|
'hostConfigV2: skillSelection.skillIds must be a string[] when mode is "explicit"'
|
|
@@ -77605,8 +78015,8 @@ var init_result_guards2 = __esm2({
|
|
|
77605
78015
|
});
|
|
77606
78016
|
function ensureJsonSchemaObject2(schema) {
|
|
77607
78017
|
if (schema && typeof schema === "object") {
|
|
77608
|
-
const
|
|
77609
|
-
const base =
|
|
78018
|
+
const record5 = schema;
|
|
78019
|
+
const base = record5.jsonSchema ? ensureJsonSchemaObject2(record5.jsonSchema) : record5;
|
|
77610
78020
|
if (!("type" in base) || base.type === void 0) {
|
|
77611
78021
|
base.type = "object";
|
|
77612
78022
|
}
|
|
@@ -78211,7 +78621,7 @@ var init_HostRunner2 = __esm2({
|
|
|
78211
78621
|
this.mcpjamLeaseScope = config.mcpjamLeaseScope;
|
|
78212
78622
|
this.mcpjamProject = config.mcpjamProject;
|
|
78213
78623
|
this.baseUrls = config.baseUrls;
|
|
78214
|
-
this.systemPrompt = config.systemPrompt ?? (this.hostSnapshot?.systemPrompt && this.hostSnapshot.systemPrompt !== "" ? this.hostSnapshot.systemPrompt : "You are a helpful assistant.");
|
|
78624
|
+
this.systemPrompt = (config.systemPrompt ? config.systemPrompt : void 0) ?? (this.hostSnapshot?.systemPrompt && this.hostSnapshot.systemPrompt !== "" ? this.hostSnapshot.systemPrompt : "You are a helpful assistant.");
|
|
78215
78625
|
this.temperature = config.temperature ?? this.hostSnapshot?.temperature;
|
|
78216
78626
|
this.maxSteps = config.maxSteps ?? 10;
|
|
78217
78627
|
this.customProviders = config.customProviders;
|
|
@@ -82457,7 +82867,7 @@ var NEGATIVE_TEST_MODE_DETAILS = {
|
|
|
82457
82867
|
}
|
|
82458
82868
|
};
|
|
82459
82869
|
function readSdkVersion2() {
|
|
82460
|
-
return "8.
|
|
82870
|
+
return "8.10.0";
|
|
82461
82871
|
}
|
|
82462
82872
|
var CONFORMANCE_CHECKER_VERSION2 = readSdkVersion2();
|
|
82463
82873
|
var MUST_POINTS2 = 95;
|
|
@@ -88699,8 +89109,8 @@ var CommandQueue = class {
|
|
|
88699
89109
|
}
|
|
88700
89110
|
/** Whether every per-tab FIFO is drained. Used for profile snapshots. */
|
|
88701
89111
|
isIdle() {
|
|
88702
|
-
for (const
|
|
88703
|
-
if (
|
|
89112
|
+
for (const count4 of this.depth.values()) {
|
|
89113
|
+
if (count4 > 0) return false;
|
|
88704
89114
|
}
|
|
88705
89115
|
return true;
|
|
88706
89116
|
}
|
|
@@ -89175,7 +89585,7 @@ function redactAction(action, options = {}) {
|
|
|
89175
89585
|
return { kind: action.kind };
|
|
89176
89586
|
case "act": {
|
|
89177
89587
|
const target = action.target;
|
|
89178
|
-
const
|
|
89588
|
+
const record5 = {
|
|
89179
89589
|
kind: "act",
|
|
89180
89590
|
verb: action.verb,
|
|
89181
89591
|
...target ? {
|
|
@@ -89183,16 +89593,16 @@ function redactAction(action, options = {}) {
|
|
|
89183
89593
|
} : {}
|
|
89184
89594
|
};
|
|
89185
89595
|
if (typeof action.value === "string") {
|
|
89186
|
-
Object.assign(
|
|
89596
|
+
Object.assign(record5, redactTypedValue(action.value, action.verb, options));
|
|
89187
89597
|
}
|
|
89188
89598
|
if (action.fields?.length) {
|
|
89189
|
-
|
|
89599
|
+
record5.fields = action.fields.map((field) => ({
|
|
89190
89600
|
...field.selector ? { selector: field.selector } : {},
|
|
89191
89601
|
...redactTypedValue(field.value, "type", options)
|
|
89192
89602
|
}));
|
|
89193
89603
|
}
|
|
89194
|
-
if (action.submit !== void 0)
|
|
89195
|
-
return
|
|
89604
|
+
if (action.submit !== void 0) record5.submit = action.submit;
|
|
89605
|
+
return record5;
|
|
89196
89606
|
}
|
|
89197
89607
|
case "observe":
|
|
89198
89608
|
return { kind: "observe", mode: action.mode };
|
|
@@ -91137,26 +91547,26 @@ var FRAME_STREAM_MAX_PAYLOAD_BY_KIND = {
|
|
|
91137
91547
|
[5]: 512 * 1024
|
|
91138
91548
|
// video_delta
|
|
91139
91549
|
};
|
|
91140
|
-
function encodeFrameStreamRecord(
|
|
91141
|
-
const video = isVideoRecord(
|
|
91142
|
-
const payload =
|
|
91550
|
+
function encodeFrameStreamRecord(record5) {
|
|
91551
|
+
const video = isVideoRecord(record5);
|
|
91552
|
+
const payload = record5.kind === FRAME_STREAM_KIND.frame ? record5.jpeg : video ? record5.au : record5.kind === FRAME_STREAM_KIND.end ? new TextEncoder().encode(record5.reason) : record5.stats ? new TextEncoder().encode(JSON.stringify(record5.stats)) : new Uint8Array(0);
|
|
91143
91553
|
const bytes2 = new Uint8Array(FRAME_STREAM_HEADER_BYTES + payload.byteLength);
|
|
91144
91554
|
const view = new DataView(bytes2.buffer);
|
|
91145
91555
|
view.setUint8(0, video ? FRAME_STREAM_VERSION_VIDEO : FRAME_STREAM_VERSION);
|
|
91146
|
-
view.setUint8(1,
|
|
91147
|
-
if (
|
|
91148
|
-
view.setUint16(2, clampU16(
|
|
91149
|
-
view.setUint16(4, clampU16(
|
|
91150
|
-
view.setUint16(6, clampU16(Math.round(
|
|
91151
|
-
view.setFloat64(8,
|
|
91152
|
-
view.setUint32(16,
|
|
91556
|
+
view.setUint8(1, record5.kind);
|
|
91557
|
+
if (record5.kind === FRAME_STREAM_KIND.frame || video) {
|
|
91558
|
+
view.setUint16(2, clampU16(record5.deviceWidth), true);
|
|
91559
|
+
view.setUint16(4, clampU16(record5.deviceHeight), true);
|
|
91560
|
+
view.setUint16(6, clampU16(Math.round(record5.scale * 1e3)), true);
|
|
91561
|
+
view.setFloat64(8, record5.ts, true);
|
|
91562
|
+
view.setUint32(16, record5.seq >>> 0, true);
|
|
91153
91563
|
}
|
|
91154
91564
|
view.setUint32(20, payload.byteLength, true);
|
|
91155
91565
|
bytes2.set(payload, FRAME_STREAM_HEADER_BYTES);
|
|
91156
91566
|
return bytes2;
|
|
91157
91567
|
}
|
|
91158
|
-
function isVideoRecord(
|
|
91159
|
-
return
|
|
91568
|
+
function isVideoRecord(record5) {
|
|
91569
|
+
return record5.kind === FRAME_STREAM_KIND.video_key || record5.kind === FRAME_STREAM_KIND.video_delta;
|
|
91160
91570
|
}
|
|
91161
91571
|
function clampU16(value) {
|
|
91162
91572
|
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
@@ -91272,17 +91682,17 @@ function createFramePacer(sink, onDrop) {
|
|
|
91272
91682
|
});
|
|
91273
91683
|
};
|
|
91274
91684
|
return {
|
|
91275
|
-
push(bytes2,
|
|
91685
|
+
push(bytes2, record5 = {}) {
|
|
91276
91686
|
if (closed) return;
|
|
91277
91687
|
if (inFlight3) {
|
|
91278
91688
|
if (pending !== void 0) {
|
|
91279
|
-
if (pending.record.essential && !
|
|
91280
|
-
if (
|
|
91689
|
+
if (pending.record.essential && !record5.essential) {
|
|
91690
|
+
if (record5.counts !== false) onDrop?.();
|
|
91281
91691
|
return;
|
|
91282
91692
|
}
|
|
91283
91693
|
if (pending.record.counts !== false) onDrop?.();
|
|
91284
91694
|
}
|
|
91285
|
-
pending = { bytes: bytes2, record:
|
|
91695
|
+
pending = { bytes: bytes2, record: record5 };
|
|
91286
91696
|
return;
|
|
91287
91697
|
}
|
|
91288
91698
|
ship(bytes2);
|
|
@@ -91818,17 +92228,17 @@ function withSecretScrub(registry3, executor, documentKeyFor) {
|
|
|
91818
92228
|
const result = await executor(command2, context);
|
|
91819
92229
|
const scrubber = registry3.scrubber();
|
|
91820
92230
|
const output = result.output;
|
|
91821
|
-
const
|
|
92231
|
+
const record5 = typeof output === "object" && output !== null ? output : void 0;
|
|
91822
92232
|
let suppress = false;
|
|
91823
|
-
if (
|
|
92233
|
+
if (record5?.screenshot !== void 0 && registry3.hasExposure()) {
|
|
91824
92234
|
const tabId = command2.tabId ?? result.stateToken?.tabId;
|
|
91825
92235
|
const keyAfter = await readKey(tabId);
|
|
91826
92236
|
suppress = !keyAfter || registry3.exposedAt(keyAfter) || typedBefore && (!keyBefore || registry3.exposedAt(keyBefore));
|
|
91827
92237
|
}
|
|
91828
92238
|
if (!scrubber && !suppress) return result;
|
|
91829
92239
|
let scrubbedOutput = output;
|
|
91830
|
-
if (
|
|
91831
|
-
const { screenshot, ...rest } =
|
|
92240
|
+
if (record5 !== void 0) {
|
|
92241
|
+
const { screenshot, ...rest } = record5;
|
|
91832
92242
|
if (suppress) {
|
|
91833
92243
|
scrubbedOutput = {
|
|
91834
92244
|
...scrubber ? scrubber.scrubDeep(rest) : rest,
|
|
@@ -93710,14 +94120,14 @@ function assignRefs(root) {
|
|
|
93710
94120
|
const entries = /* @__PURE__ */ new Map();
|
|
93711
94121
|
if (!root) return entries;
|
|
93712
94122
|
const seen = /* @__PURE__ */ new Map();
|
|
93713
|
-
const
|
|
94123
|
+
const count4 = (node) => {
|
|
93714
94124
|
if (isRefWorthy(node)) {
|
|
93715
94125
|
const key = `${node.role}:${node.name ?? ""}`;
|
|
93716
94126
|
seen.set(key, (seen.get(key) ?? 0) + 1);
|
|
93717
94127
|
}
|
|
93718
|
-
for (const child of node.children ?? [])
|
|
94128
|
+
for (const child of node.children ?? []) count4(child);
|
|
93719
94129
|
};
|
|
93720
|
-
|
|
94130
|
+
count4(root);
|
|
93721
94131
|
const position = /* @__PURE__ */ new Map();
|
|
93722
94132
|
let next = 1;
|
|
93723
94133
|
const visit2 = (node) => {
|
|
@@ -93995,7 +94405,7 @@ var WebMcpBridge = class {
|
|
|
93995
94405
|
}
|
|
93996
94406
|
return false;
|
|
93997
94407
|
}
|
|
93998
|
-
allowChanges(
|
|
94408
|
+
allowChanges(count4) {
|
|
93999
94409
|
if (!this.localSecurity) return true;
|
|
94000
94410
|
if (this.discoveryBlocked) return false;
|
|
94001
94411
|
const now = Date.now();
|
|
@@ -94005,8 +94415,8 @@ var WebMcpBridge = class {
|
|
|
94005
94415
|
rate.tokens + Math.max(0, now - rate.at) * 1.024
|
|
94006
94416
|
);
|
|
94007
94417
|
rate.at = now;
|
|
94008
|
-
if (
|
|
94009
|
-
rate.tokens -=
|
|
94418
|
+
if (count4 > rate.tokens) return this.blockDiscovery();
|
|
94419
|
+
rate.tokens -= count4;
|
|
94010
94420
|
this.changeTokens = rate.tokens;
|
|
94011
94421
|
this.changeAt = now;
|
|
94012
94422
|
return true;
|
|
@@ -94742,9 +95152,9 @@ function canonicalJson3(value, depth = 0, budget = { left: CANONICAL_JSON_BUDGET
|
|
|
94742
95152
|
budget.left -= parts2.length + 1;
|
|
94743
95153
|
return `[${parts2.join(",")}]`;
|
|
94744
95154
|
}
|
|
94745
|
-
const
|
|
95155
|
+
const record5 = value;
|
|
94746
95156
|
const parts = [];
|
|
94747
|
-
for (const key of Object.keys(
|
|
95157
|
+
for (const key of Object.keys(record5).sort()) {
|
|
94748
95158
|
if (budget.left <= 0) {
|
|
94749
95159
|
parts.push('"[budget]":0');
|
|
94750
95160
|
break;
|
|
@@ -94753,7 +95163,7 @@ function canonicalJson3(value, depth = 0, budget = { left: CANONICAL_JSON_BUDGET
|
|
|
94753
95163
|
key.length > budget.left ? `${key.slice(0, budget.left)}\u2026` : key
|
|
94754
95164
|
);
|
|
94755
95165
|
budget.left -= encodedKey.length + 1;
|
|
94756
|
-
parts.push(`${encodedKey}:${canonicalJson3(
|
|
95166
|
+
parts.push(`${encodedKey}:${canonicalJson3(record5[key], depth + 1, budget)}`);
|
|
94757
95167
|
}
|
|
94758
95168
|
budget.left -= parts.length + 1;
|
|
94759
95169
|
return `{${parts.join(",")}}`;
|
|
@@ -102003,8 +102413,8 @@ function createFrameRelayStats(options) {
|
|
|
102003
102413
|
countDrop(n = 1) {
|
|
102004
102414
|
dropped += Math.max(0, Math.round(n));
|
|
102005
102415
|
},
|
|
102006
|
-
setSubscribers(
|
|
102007
|
-
subscribers3 = Math.max(0, Math.round(
|
|
102416
|
+
setSubscribers(count4) {
|
|
102417
|
+
subscribers3 = Math.max(0, Math.round(count4));
|
|
102008
102418
|
},
|
|
102009
102419
|
mergeDaemon(counters) {
|
|
102010
102420
|
daemon = counters;
|
|
@@ -107596,6 +108006,14 @@ async function fetchRuntimeServerSecrets(args) {
|
|
|
107596
108006
|
);
|
|
107597
108007
|
}
|
|
107598
108008
|
const RUNTIME_REVEAL_TIMEOUT_MS = 1e4;
|
|
108009
|
+
const scenarioServiceToken = args.scenarioId ? process.env.INSPECTOR_SERVICE_TOKEN : void 0;
|
|
108010
|
+
if (args.scenarioId && !scenarioServiceToken) {
|
|
108011
|
+
throw new WebRouteError(
|
|
108012
|
+
500,
|
|
108013
|
+
ErrorCode.INTERNAL_ERROR,
|
|
108014
|
+
"Server missing INSPECTOR_SERVICE_TOKEN for scenario secret delivery"
|
|
108015
|
+
);
|
|
108016
|
+
}
|
|
107599
108017
|
const controller = new AbortController();
|
|
107600
108018
|
const timeoutId = setTimeout(
|
|
107601
108019
|
() => controller.abort(),
|
|
@@ -107604,7 +108022,8 @@ async function fetchRuntimeServerSecrets(args) {
|
|
|
107604
108022
|
let response;
|
|
107605
108023
|
try {
|
|
107606
108024
|
const headers = {
|
|
107607
|
-
"Content-Type": "application/json"
|
|
108025
|
+
"Content-Type": "application/json",
|
|
108026
|
+
...scenarioServiceToken ? { "x-inspector-service-token": scenarioServiceToken } : {}
|
|
107608
108027
|
};
|
|
107609
108028
|
if (args.workosApiKeyActingAs) {
|
|
107610
108029
|
const serviceToken3 = process.env.INSPECTOR_SERVICE_TOKEN;
|
|
@@ -109074,9 +109493,9 @@ function sanitizeValue(value, keyPath, depth, args, state) {
|
|
|
109074
109493
|
}
|
|
109075
109494
|
return DROP;
|
|
109076
109495
|
}
|
|
109077
|
-
function sanitizeUnknownRecord(
|
|
109496
|
+
function sanitizeUnknownRecord(record5, args) {
|
|
109078
109497
|
const state = { reportedTooDeep: false };
|
|
109079
|
-
return sanitizeValue(
|
|
109498
|
+
return sanitizeValue(record5, "", 0, args, state);
|
|
109080
109499
|
}
|
|
109081
109500
|
var APP_ID_KEYS = ["app_id", "appId", "id"];
|
|
109082
109501
|
var SERVER_KEYS = ["server", "mcp_server", "mcpServer", "serverKey"];
|
|
@@ -109092,11 +109511,11 @@ function parsePluginAppConfig(args) {
|
|
|
109092
109511
|
);
|
|
109093
109512
|
return null;
|
|
109094
109513
|
}
|
|
109095
|
-
const
|
|
109514
|
+
const record5 = raw;
|
|
109096
109515
|
let appId;
|
|
109097
109516
|
let appIdKey;
|
|
109098
109517
|
for (const key of APP_ID_KEYS) {
|
|
109099
|
-
const value =
|
|
109518
|
+
const value = record5[key];
|
|
109100
109519
|
if (typeof value === "string" && value.length > 0) {
|
|
109101
109520
|
appId = value;
|
|
109102
109521
|
appIdKey = key;
|
|
@@ -109114,7 +109533,7 @@ function parsePluginAppConfig(args) {
|
|
|
109114
109533
|
let declaredServer;
|
|
109115
109534
|
let serverField;
|
|
109116
109535
|
for (const key of SERVER_KEYS) {
|
|
109117
|
-
const value =
|
|
109536
|
+
const value = record5[key];
|
|
109118
109537
|
if (typeof value === "string" && value.length > 0) {
|
|
109119
109538
|
declaredServer = value;
|
|
109120
109539
|
serverField = key;
|
|
@@ -109122,7 +109541,7 @@ function parsePluginAppConfig(args) {
|
|
|
109122
109541
|
}
|
|
109123
109542
|
}
|
|
109124
109543
|
const unknownFields = {};
|
|
109125
|
-
for (const [key, value] of Object.entries(
|
|
109544
|
+
for (const [key, value] of Object.entries(record5)) {
|
|
109126
109545
|
if (key === appIdKey || key === serverField) continue;
|
|
109127
109546
|
unknownFields[key] = value;
|
|
109128
109547
|
}
|
|
@@ -109661,8 +110080,8 @@ function applyMcpjamExtension(manifest, rawExtensions, filePaths, issues) {
|
|
|
109661
110080
|
);
|
|
109662
110081
|
return;
|
|
109663
110082
|
}
|
|
109664
|
-
const
|
|
109665
|
-
const displayName =
|
|
110083
|
+
const record5 = raw;
|
|
110084
|
+
const displayName = record5.displayName ?? record5.display_name;
|
|
109666
110085
|
if (displayName !== void 0) {
|
|
109667
110086
|
if (typeof displayName !== "string") {
|
|
109668
110087
|
issues.warn(
|
|
@@ -109674,7 +110093,7 @@ function applyMcpjamExtension(manifest, rawExtensions, filePaths, issues) {
|
|
|
109674
110093
|
}
|
|
109675
110094
|
}
|
|
109676
110095
|
for (const key of ["icon", "logo"]) {
|
|
109677
|
-
const value =
|
|
110096
|
+
const value = record5[key];
|
|
109678
110097
|
if (value === void 0) continue;
|
|
109679
110098
|
if (typeof value !== "string") {
|
|
109680
110099
|
issues.warn(
|
|
@@ -109708,8 +110127,8 @@ function normalizePluginManifest(raw, context) {
|
|
|
109708
110127
|
);
|
|
109709
110128
|
return { manifest: null };
|
|
109710
110129
|
}
|
|
109711
|
-
const
|
|
109712
|
-
const schema =
|
|
110130
|
+
const record5 = raw;
|
|
110131
|
+
const schema = record5.$schema;
|
|
109713
110132
|
const schemaVersion = typeof schema === "string" ? Object.keys(PLUGIN_MANIFEST_SCHEMAS).find(
|
|
109714
110133
|
(version) => PLUGIN_MANIFEST_SCHEMAS[version] === schema
|
|
109715
110134
|
) : void 0;
|
|
@@ -109722,7 +110141,7 @@ function normalizePluginManifest(raw, context) {
|
|
|
109722
110141
|
);
|
|
109723
110142
|
return { manifest: null };
|
|
109724
110143
|
}
|
|
109725
|
-
const name15 =
|
|
110144
|
+
const name15 = record5.name;
|
|
109726
110145
|
if (typeof name15 !== "string" || name15.length === 0 || name15.length > MAX_NAME_LENGTH || !AP_NAME.test(name15)) {
|
|
109727
110146
|
issues.error(
|
|
109728
110147
|
"MANIFEST_INVALID_NAME",
|
|
@@ -109735,18 +110154,18 @@ function normalizePluginManifest(raw, context) {
|
|
|
109735
110154
|
name: name15,
|
|
109736
110155
|
extensions: {}
|
|
109737
110156
|
};
|
|
109738
|
-
if (
|
|
109739
|
-
if (typeof
|
|
110157
|
+
if (record5.version !== void 0) {
|
|
110158
|
+
if (typeof record5.version !== "string" || record5.version.length === 0) {
|
|
109740
110159
|
issues.error(
|
|
109741
110160
|
"MANIFEST_INVALID_VERSION",
|
|
109742
110161
|
`manifest "version" must be a non-empty string when present`
|
|
109743
110162
|
);
|
|
109744
110163
|
} else {
|
|
109745
|
-
manifest.version =
|
|
110164
|
+
manifest.version = record5.version;
|
|
109746
110165
|
}
|
|
109747
110166
|
}
|
|
109748
110167
|
for (const key of STRING_FIELDS) {
|
|
109749
|
-
const value =
|
|
110168
|
+
const value = record5[key];
|
|
109750
110169
|
if (value === void 0) continue;
|
|
109751
110170
|
if (typeof value !== "string") {
|
|
109752
110171
|
issues.error(
|
|
@@ -109758,11 +110177,11 @@ function normalizePluginManifest(raw, context) {
|
|
|
109758
110177
|
manifest[key] = value;
|
|
109759
110178
|
}
|
|
109760
110179
|
for (const key of URL_FIELDS) {
|
|
109761
|
-
if (
|
|
109762
|
-
const url = readHttpsUrl(key,
|
|
110180
|
+
if (record5[key] === void 0) continue;
|
|
110181
|
+
const url = readHttpsUrl(key, record5[key], issues);
|
|
109763
110182
|
if (url !== void 0) manifest[key] = url;
|
|
109764
110183
|
}
|
|
109765
|
-
const author =
|
|
110184
|
+
const author = record5.author;
|
|
109766
110185
|
if (author !== void 0) {
|
|
109767
110186
|
if (author && typeof author === "object" && !Array.isArray(author)) {
|
|
109768
110187
|
const authorRecord = author;
|
|
@@ -109785,7 +110204,7 @@ function normalizePluginManifest(raw, context) {
|
|
|
109785
110204
|
);
|
|
109786
110205
|
}
|
|
109787
110206
|
}
|
|
109788
|
-
const keywords =
|
|
110207
|
+
const keywords = record5.keywords;
|
|
109789
110208
|
if (keywords !== void 0) {
|
|
109790
110209
|
if (!Array.isArray(keywords) || keywords.some((keyword) => typeof keyword !== "string")) {
|
|
109791
110210
|
issues.error(
|
|
@@ -109796,7 +110215,7 @@ function normalizePluginManifest(raw, context) {
|
|
|
109796
110215
|
manifest.keywords = keywords;
|
|
109797
110216
|
}
|
|
109798
110217
|
}
|
|
109799
|
-
const extensions =
|
|
110218
|
+
const extensions = record5.extensions;
|
|
109800
110219
|
if (extensions !== void 0) {
|
|
109801
110220
|
if (extensions === null || typeof extensions !== "object" || Array.isArray(extensions)) {
|
|
109802
110221
|
issues.warn(
|
|
@@ -109820,7 +110239,7 @@ function normalizePluginManifest(raw, context) {
|
|
|
109820
110239
|
);
|
|
109821
110240
|
}
|
|
109822
110241
|
}
|
|
109823
|
-
for (const key of Object.keys(
|
|
110242
|
+
for (const key of Object.keys(record5)) {
|
|
109824
110243
|
if (HANDLED_FIELDS.has(key)) continue;
|
|
109825
110244
|
if (EXECUTION_AMBIGUOUS_FIELDS.has(key)) {
|
|
109826
110245
|
issues.error(
|
|
@@ -110010,8 +110429,8 @@ function normalizeOAuthHint(serverKey, componentKey, raw, issues) {
|
|
|
110010
110429
|
}
|
|
110011
110430
|
return hint;
|
|
110012
110431
|
}
|
|
110013
|
-
function readDeclaredTransport(serverKey, componentKey,
|
|
110014
|
-
const declared =
|
|
110432
|
+
function readDeclaredTransport(serverKey, componentKey, record5, issues) {
|
|
110433
|
+
const declared = record5.type;
|
|
110015
110434
|
if (declared === "stdio" || declared === "streamable-http" || declared === "sse") {
|
|
110016
110435
|
return declared;
|
|
110017
110436
|
}
|
|
@@ -110032,16 +110451,16 @@ function normalizeServer(serverKey, sourcePath, raw, issues) {
|
|
|
110032
110451
|
);
|
|
110033
110452
|
return null;
|
|
110034
110453
|
}
|
|
110035
|
-
const
|
|
110454
|
+
const record5 = raw;
|
|
110036
110455
|
const declared = readDeclaredTransport(
|
|
110037
110456
|
serverKey,
|
|
110038
110457
|
componentKey,
|
|
110039
|
-
|
|
110458
|
+
record5,
|
|
110040
110459
|
issues
|
|
110041
110460
|
);
|
|
110042
110461
|
if (declared === null) return null;
|
|
110043
110462
|
const knownFields = declared === "stdio" ? STDIO_KNOWN_FIELDS : HTTP_KNOWN_FIELDS;
|
|
110044
|
-
for (const key of Object.keys(
|
|
110463
|
+
for (const key of Object.keys(record5)) {
|
|
110045
110464
|
if (!knownFields.has(key)) {
|
|
110046
110465
|
issues.error(
|
|
110047
110466
|
"MCP_UNKNOWN_FIELD",
|
|
@@ -110052,7 +110471,7 @@ function normalizeServer(serverKey, sourcePath, raw, issues) {
|
|
|
110052
110471
|
}
|
|
110053
110472
|
}
|
|
110054
110473
|
if (declared === "stdio") {
|
|
110055
|
-
const declaredCommand =
|
|
110474
|
+
const declaredCommand = record5.command;
|
|
110056
110475
|
if (typeof declaredCommand !== "string" || declaredCommand.length === 0) {
|
|
110057
110476
|
issues.error(
|
|
110058
110477
|
"MCP_MISSING_COMMAND",
|
|
@@ -110081,8 +110500,8 @@ function normalizeServer(serverKey, sourcePath, raw, issues) {
|
|
|
110081
110500
|
command2 = `${PLUGIN_ROOT_PLACEHOLDER}/${resolved.path}`;
|
|
110082
110501
|
}
|
|
110083
110502
|
let args = [];
|
|
110084
|
-
if (
|
|
110085
|
-
if (!Array.isArray(
|
|
110503
|
+
if (record5.args !== void 0) {
|
|
110504
|
+
if (!Array.isArray(record5.args) || record5.args.some((arg) => typeof arg !== "string")) {
|
|
110086
110505
|
issues.error(
|
|
110087
110506
|
"MCP_INVALID_SERVER",
|
|
110088
110507
|
`server "${serverKey}": "args" must be an array of strings`,
|
|
@@ -110090,18 +110509,18 @@ function normalizeServer(serverKey, sourcePath, raw, issues) {
|
|
|
110090
110509
|
);
|
|
110091
110510
|
return null;
|
|
110092
110511
|
}
|
|
110093
|
-
args =
|
|
110512
|
+
args = record5.args;
|
|
110094
110513
|
}
|
|
110095
110514
|
const envRequirements = normalizeEnv(
|
|
110096
110515
|
serverKey,
|
|
110097
110516
|
componentKey,
|
|
110098
|
-
|
|
110517
|
+
record5.env,
|
|
110099
110518
|
issues
|
|
110100
110519
|
);
|
|
110101
110520
|
if (envRequirements === null) return null;
|
|
110102
110521
|
let workingDirectory;
|
|
110103
|
-
if (
|
|
110104
|
-
const cwd =
|
|
110522
|
+
if (record5.cwd !== void 0) {
|
|
110523
|
+
const cwd = record5.cwd;
|
|
110105
110524
|
if (typeof cwd !== "string") {
|
|
110106
110525
|
issues.error(
|
|
110107
110526
|
"MCP_INVALID_SERVER",
|
|
@@ -110150,7 +110569,7 @@ function normalizeServer(serverKey, sourcePath, raw, issues) {
|
|
|
110150
110569
|
}
|
|
110151
110570
|
};
|
|
110152
110571
|
}
|
|
110153
|
-
const url =
|
|
110572
|
+
const url = record5.url;
|
|
110154
110573
|
if (typeof url !== "string" || url.length === 0) {
|
|
110155
110574
|
issues.error(
|
|
110156
110575
|
"MCP_MISSING_URL",
|
|
@@ -110190,12 +110609,12 @@ function normalizeServer(serverKey, sourcePath, raw, issues) {
|
|
|
110190
110609
|
const headerRequirements = normalizeHeaders4(
|
|
110191
110610
|
serverKey,
|
|
110192
110611
|
componentKey,
|
|
110193
|
-
|
|
110612
|
+
record5.headers,
|
|
110194
110613
|
issues
|
|
110195
110614
|
);
|
|
110196
110615
|
if (headerRequirements === null) return null;
|
|
110197
|
-
const hasOAuthHint =
|
|
110198
|
-
const oauth3 = hasOAuthHint ? normalizeOAuthHint(serverKey, componentKey,
|
|
110616
|
+
const hasOAuthHint = record5.oauth !== void 0 || record5.authentication !== void 0;
|
|
110617
|
+
const oauth3 = hasOAuthHint ? normalizeOAuthHint(serverKey, componentKey, record5, issues) : void 0;
|
|
110199
110618
|
return {
|
|
110200
110619
|
componentKey,
|
|
110201
110620
|
key: serverKey,
|
|
@@ -110227,8 +110646,8 @@ function normalizePluginMcpConfig(raw, context) {
|
|
|
110227
110646
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
110228
110647
|
return disabled("MCP_INVALID_CONFIG", "mcp.json must be a JSON object");
|
|
110229
110648
|
}
|
|
110230
|
-
const
|
|
110231
|
-
const schema =
|
|
110649
|
+
const record5 = raw;
|
|
110650
|
+
const schema = record5.$schema;
|
|
110232
110651
|
const documentVersion = typeof schema === "string" ? Object.keys(PLUGIN_MCP_SCHEMAS).find(
|
|
110233
110652
|
(version) => PLUGIN_MCP_SCHEMAS[version] === schema
|
|
110234
110653
|
) : void 0;
|
|
@@ -110244,7 +110663,7 @@ function normalizePluginMcpConfig(raw, context) {
|
|
|
110244
110663
|
`mcp.json targets Agent Plugins ${documentVersion} but plugin.json targets ${manifestSchemaVersion}; versions must match`
|
|
110245
110664
|
);
|
|
110246
110665
|
}
|
|
110247
|
-
for (const key of Object.keys(
|
|
110666
|
+
for (const key of Object.keys(record5)) {
|
|
110248
110667
|
if (key !== "$schema" && key !== "mcpServers") {
|
|
110249
110668
|
return disabled(
|
|
110250
110669
|
"MCP_INVALID_CONFIG",
|
|
@@ -110252,7 +110671,7 @@ function normalizePluginMcpConfig(raw, context) {
|
|
|
110252
110671
|
);
|
|
110253
110672
|
}
|
|
110254
110673
|
}
|
|
110255
|
-
const serverMap =
|
|
110674
|
+
const serverMap = record5.mcpServers;
|
|
110256
110675
|
if (serverMap === null || serverMap === void 0 || typeof serverMap !== "object" || Array.isArray(serverMap)) {
|
|
110257
110676
|
return disabled(
|
|
110258
110677
|
"MCP_INVALID_CONFIG",
|
|
@@ -112477,8 +112896,8 @@ function redactServerConfig(config) {
|
|
|
112477
112896
|
if (!config || typeof config !== "object") {
|
|
112478
112897
|
return config;
|
|
112479
112898
|
}
|
|
112480
|
-
const
|
|
112481
|
-
const redacted = { ...
|
|
112899
|
+
const record5 = config;
|
|
112900
|
+
const redacted = { ...record5 };
|
|
112482
112901
|
if ("env" in redacted) {
|
|
112483
112902
|
redacted.hasEnv = !!redacted.env && typeof redacted.env === "object" && Object.keys(redacted.env).length > 0;
|
|
112484
112903
|
delete redacted.env;
|
|
@@ -114285,12 +114704,12 @@ function pageToolFrom(value) {
|
|
|
114285
114704
|
return tool19;
|
|
114286
114705
|
}
|
|
114287
114706
|
function pageToolsFromObservation(output) {
|
|
114288
|
-
const
|
|
114289
|
-
const tools5 = Array.isArray(
|
|
114707
|
+
const record5 = isRecord15(output) ? output : {};
|
|
114708
|
+
const tools5 = Array.isArray(record5.tools) ? record5.tools.map(pageToolFrom).filter((tool19) => tool19 !== null) : [];
|
|
114290
114709
|
return {
|
|
114291
114710
|
ok: true,
|
|
114292
|
-
url: typeof
|
|
114293
|
-
webmcpSupported: typeof
|
|
114711
|
+
url: typeof record5.url === "string" ? record5.url : "",
|
|
114712
|
+
webmcpSupported: typeof record5.webmcpSupported === "boolean" ? record5.webmcpSupported : tools5.length > 0,
|
|
114294
114713
|
tools: tools5
|
|
114295
114714
|
};
|
|
114296
114715
|
}
|
|
@@ -114770,11 +115189,11 @@ function bindingRecordedFor(messages, toolCallId) {
|
|
|
114770
115189
|
if (role !== "assistant" || !Array.isArray(content)) continue;
|
|
114771
115190
|
for (const part of content) {
|
|
114772
115191
|
if (!part || typeof part !== "object") continue;
|
|
114773
|
-
const
|
|
114774
|
-
if (
|
|
115192
|
+
const record5 = part;
|
|
115193
|
+
if (record5.type !== "tool-call" || record5.toolCallId !== toolCallId) {
|
|
114775
115194
|
continue;
|
|
114776
115195
|
}
|
|
114777
|
-
return readPageToolBinding(
|
|
115196
|
+
return readPageToolBinding(record5.providerOptions);
|
|
114778
115197
|
}
|
|
114779
115198
|
}
|
|
114780
115199
|
return void 0;
|
|
@@ -115514,7 +115933,7 @@ async function ensureOnSandbox(deps, target, contextMode, args) {
|
|
|
115514
115933
|
handle2 = booted2;
|
|
115515
115934
|
await recordLogicalBoot(deps, args, booted2.bootId);
|
|
115516
115935
|
stream = target.watched ? await sandbox.ensureStream() : void 0;
|
|
115517
|
-
const
|
|
115936
|
+
const record5 = {
|
|
115518
115937
|
sandboxRowId: target.sandboxRowId,
|
|
115519
115938
|
bootId: booted2.bootId,
|
|
115520
115939
|
browserdToken: booted2.bearer,
|
|
@@ -115531,13 +115950,13 @@ async function ensureOnSandbox(deps, target, contextMode, args) {
|
|
|
115531
115950
|
...args.signal ? { signal: args.signal } : {}
|
|
115532
115951
|
};
|
|
115533
115952
|
return stream ? deps.store.record({
|
|
115534
|
-
...
|
|
115953
|
+
...record5,
|
|
115535
115954
|
watched: true,
|
|
115536
115955
|
stream: {
|
|
115537
115956
|
url: stream.streamUrl,
|
|
115538
115957
|
password: stream.streamPassword
|
|
115539
115958
|
}
|
|
115540
|
-
}) : deps.store.record({ ...
|
|
115959
|
+
}) : deps.store.record({ ...record5, watched: false });
|
|
115541
115960
|
},
|
|
115542
115961
|
onAdopt: () => {
|
|
115543
115962
|
handle2 = void 0;
|
|
@@ -115840,18 +116259,18 @@ function parseReadyLine(line2) {
|
|
|
115840
116259
|
return null;
|
|
115841
116260
|
}
|
|
115842
116261
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
115843
|
-
const
|
|
115844
|
-
if (
|
|
115845
|
-
if (typeof
|
|
115846
|
-
if (typeof
|
|
116262
|
+
const record5 = parsed;
|
|
116263
|
+
if (record5.event !== "listening") return null;
|
|
116264
|
+
if (typeof record5.port !== "number") return null;
|
|
116265
|
+
if (typeof record5.bootId !== "string" || record5.bootId.length === 0)
|
|
115847
116266
|
return null;
|
|
115848
|
-
const protocolVersion2 =
|
|
116267
|
+
const protocolVersion2 = record5.protocolVersion;
|
|
115849
116268
|
if (protocolVersion2 !== void 0 && (typeof protocolVersion2 !== "number" || !Number.isSafeInteger(protocolVersion2) || protocolVersion2 < 1)) {
|
|
115850
116269
|
return null;
|
|
115851
116270
|
}
|
|
115852
116271
|
return {
|
|
115853
|
-
port:
|
|
115854
|
-
bootId:
|
|
116272
|
+
port: record5.port,
|
|
116273
|
+
bootId: record5.bootId,
|
|
115855
116274
|
...typeof protocolVersion2 === "number" ? { protocolVersion: protocolVersion2 } : {}
|
|
115856
116275
|
};
|
|
115857
116276
|
}
|
|
@@ -116352,14 +116771,14 @@ var BrowserdClient = class {
|
|
|
116352
116771
|
reason = void 0;
|
|
116353
116772
|
break;
|
|
116354
116773
|
}
|
|
116355
|
-
for (const
|
|
116356
|
-
if (
|
|
116357
|
-
else if (
|
|
116358
|
-
args.onVideo?.(
|
|
116359
|
-
} else if (
|
|
116360
|
-
if (
|
|
116361
|
-
} else if (
|
|
116362
|
-
reason =
|
|
116774
|
+
for (const record5 of decoded.records) {
|
|
116775
|
+
if (record5.kind === FRAME_STREAM_KIND.frame) args.onFrame(record5);
|
|
116776
|
+
else if (record5.kind === FRAME_STREAM_KIND.video_key || record5.kind === FRAME_STREAM_KIND.video_delta) {
|
|
116777
|
+
args.onVideo?.(record5);
|
|
116778
|
+
} else if (record5.kind === FRAME_STREAM_KIND.heartbeat) {
|
|
116779
|
+
if (record5.stats) args.onStats?.(record5.stats);
|
|
116780
|
+
} else if (record5.kind === FRAME_STREAM_KIND.end)
|
|
116781
|
+
reason = record5.reason;
|
|
116363
116782
|
}
|
|
116364
116783
|
if (reason !== void 0) break;
|
|
116365
116784
|
}
|
|
@@ -116712,8 +117131,8 @@ async function startHostedRecording(handle2, deps) {
|
|
|
116712
117131
|
const { client: client3, sandboxRowId, sandboxId, sessionId, bootId } = handle2;
|
|
116713
117132
|
const existing = active.get(sandboxRowId);
|
|
116714
117133
|
if (existing?.bootId === bootId) return;
|
|
116715
|
-
const
|
|
116716
|
-
if (!
|
|
117134
|
+
const record5 = client3.record;
|
|
117135
|
+
if (!record5) return;
|
|
116717
117136
|
const now = deps.now ?? Date.now;
|
|
116718
117137
|
const id3 = recordingIdFor(sessionId);
|
|
116719
117138
|
let abandoned = false;
|
|
@@ -116730,7 +117149,7 @@ async function startHostedRecording(handle2, deps) {
|
|
|
116730
117149
|
(async () => {
|
|
116731
117150
|
const status = await client3.status();
|
|
116732
117151
|
if (status.kind !== "ok" || !status.features?.includes("record")) return;
|
|
116733
|
-
const started2 = await
|
|
117152
|
+
const started2 = await record5({
|
|
116734
117153
|
action: "start",
|
|
116735
117154
|
id: id3,
|
|
116736
117155
|
fps: HOSTED_RECORDING_FPS
|
|
@@ -116760,7 +117179,7 @@ async function startHostedRecording(handle2, deps) {
|
|
|
116760
117179
|
sandboxId,
|
|
116761
117180
|
bootId,
|
|
116762
117181
|
connect: () => deps.connect(sandboxId),
|
|
116763
|
-
stop: () =>
|
|
117182
|
+
stop: () => record5({ action: "stop" }),
|
|
116764
117183
|
fps: HOSTED_RECORDING_FPS,
|
|
116765
117184
|
startedAtMs: now()
|
|
116766
117185
|
});
|
|
@@ -124082,9 +124501,9 @@ function toAcpMcpServers(json) {
|
|
|
124082
124501
|
}
|
|
124083
124502
|
function attributeCursorToolCall(args) {
|
|
124084
124503
|
const { rawToolName, input, keyToServerId } = args;
|
|
124085
|
-
const
|
|
124086
|
-
const provider =
|
|
124087
|
-
const inner =
|
|
124504
|
+
const record5 = input && typeof input === "object" ? input : {};
|
|
124505
|
+
const provider = record5.providerIdentifier;
|
|
124506
|
+
const inner = record5.toolName;
|
|
124088
124507
|
if (typeof provider !== "string" || typeof inner !== "string" || !inner) {
|
|
124089
124508
|
return { toolName: rawToolName };
|
|
124090
124509
|
}
|
|
@@ -125177,7 +125596,7 @@ function cloneTraceValue(value) {
|
|
|
125177
125596
|
}
|
|
125178
125597
|
function getPromptIndex(messageHistory) {
|
|
125179
125598
|
const userCount = messageHistory.reduce(
|
|
125180
|
-
(
|
|
125599
|
+
(count4, message) => count4 + (message?.role === "user" ? 1 : 0),
|
|
125181
125600
|
0
|
|
125182
125601
|
);
|
|
125183
125602
|
return Math.max(0, userCount - 1);
|
|
@@ -127007,13 +127426,13 @@ function stageDerivationToMetadata(derivation) {
|
|
|
127007
127426
|
}
|
|
127008
127427
|
function projectStageDerivation(metadata) {
|
|
127009
127428
|
if (!metadata || typeof metadata !== "object") return {};
|
|
127010
|
-
const
|
|
127011
|
-
if (!("stageResults" in
|
|
127429
|
+
const record5 = metadata;
|
|
127430
|
+
if (!("stageResults" in record5)) return {};
|
|
127012
127431
|
const derivation = stageDerivationSchema2.safeParse({
|
|
127013
|
-
stageResults:
|
|
127014
|
-
...
|
|
127015
|
-
...
|
|
127016
|
-
stageAnalyzerVersion:
|
|
127432
|
+
stageResults: record5.stageResults,
|
|
127433
|
+
...record5.firstFailedStage !== void 0 ? { firstFailedStage: record5.firstFailedStage } : {},
|
|
127434
|
+
...record5.failureCategory !== void 0 ? { failureCategory: record5.failureCategory } : {},
|
|
127435
|
+
stageAnalyzerVersion: record5.stageAnalyzerVersion
|
|
127017
127436
|
});
|
|
127018
127437
|
if (derivation.success) {
|
|
127019
127438
|
return {
|
|
@@ -127023,7 +127442,7 @@ function projectStageDerivation(metadata) {
|
|
|
127023
127442
|
stageAnalyzerVersion: derivation.data.stageAnalyzerVersion
|
|
127024
127443
|
};
|
|
127025
127444
|
}
|
|
127026
|
-
const version =
|
|
127445
|
+
const version = record5.stageAnalyzerVersion;
|
|
127027
127446
|
return {
|
|
127028
127447
|
stageResultsUnverified: true,
|
|
127029
127448
|
...typeof version === "number" && Number.isInteger(version) && version >= 0 ? { stageAnalyzerVersion: version } : {}
|
|
@@ -128212,8 +128631,8 @@ var EVAL_VERDICT_DECISION_REASONS2 = [
|
|
|
128212
128631
|
...EVAL_VALIDITY_DECISION_REASONS2,
|
|
128213
128632
|
...EVAL_TASK_DECISION_REASONS2
|
|
128214
128633
|
];
|
|
128215
|
-
var evalVerdictDecisionReasonSchema2 = z14.enum(
|
|
128216
|
-
|
|
128634
|
+
var evalVerdictDecisionReasonSchema2 = z14.enum(EVAL_VERDICT_DECISION_REASONS2).describe(
|
|
128635
|
+
"Why the verdict is what it is. The validity reasons are evaluated FIRST and make a run `inconclusive`; the task reasons decide `passed` / `failed` once validity holds. `configuredTrialsNotAttempted` \u2014 some configured trial never ran. `noGradeableTrials` \u2014 nothing in the suite was gradeable. `eligibleTrialsBelowMinimum` \u2014 the explicit `minEligibleTrials` was not reached. `completionRateBelowMinimum` \u2014 measured, and under the floor. `completionRateNotMeasured` \u2014 nothing was attempted, so the floor is unsatisfiable; a not-measured rate never passes one. `evaluatorErrorRateAboveMaximum` \u2014 the grader failed too often for the run to describe the server. `evaluatorErrorRateNotMeasured` \u2014 the same unsatisfiable case for the ceiling. `caseHasNoEligibleTrials` \u2014 a case graded nothing, which is inconclusive even at `passThreshold: 0`. `casePassRateMetThreshold` \u2014 a case's own passing reason. `casePassRateBelowThreshold` \u2014 a case failed its threshold, and so therefore did the suite. `allMeasuredCasesMetThreshold` \u2014 the suite's only passing reason."
|
|
128217
128636
|
);
|
|
128218
128637
|
function isEvalValidityDecisionReason2(value) {
|
|
128219
128638
|
return typeof value === "string" && EVAL_VALIDITY_DECISION_REASONS2.includes(value);
|
|
@@ -128984,10 +129403,17 @@ function predicateResultsFrom(criteria) {
|
|
|
128984
129403
|
if (criteria?.status !== "completed") return void 0;
|
|
128985
129404
|
const results = criteria.results ?? [];
|
|
128986
129405
|
if (results.length === 0) return void 0;
|
|
128987
|
-
return results.map((entry3) => ({
|
|
129406
|
+
return results.map((entry3) => ({
|
|
129407
|
+
passed: entry3.passed,
|
|
129408
|
+
...entry3.status ? { status: entry3.status } : {},
|
|
129409
|
+
...entry3.predicate ? { predicate: entry3.predicate } : {}
|
|
129410
|
+
}));
|
|
128988
129411
|
}
|
|
128989
129412
|
function judgeEvidenceFrom(input) {
|
|
128990
|
-
const {
|
|
129413
|
+
const { goalJudge, hasUserAsk } = input;
|
|
129414
|
+
const criteria = input.source === "swarm" && input.swarmPolicy?.judgeDecisive ? void 0 : input.criteria;
|
|
129415
|
+
if (input.source === "swarm" && input.swarmPolicy && !input.swarmPolicy.judgeDecisive)
|
|
129416
|
+
return void 0;
|
|
128991
129417
|
if (criteria?.status === "failed") return void 0;
|
|
128992
129418
|
if (criteria?.status === "completed") {
|
|
128993
129419
|
if ((criteria.results ?? []).length > 0) return void 0;
|
|
@@ -129035,9 +129461,40 @@ function buildChatSessionStageInput(input) {
|
|
|
129035
129461
|
if (toolSignals) evidence.toolSignals = toolSignals;
|
|
129036
129462
|
const predicateResults = predicateResultsFrom(input.criteria);
|
|
129037
129463
|
if (predicateResults) evidence.predicateResults = predicateResults;
|
|
129038
|
-
if (input.
|
|
129464
|
+
if (input.source === "swarm" && input.swarmPolicy?.judgeDecisive) {
|
|
129465
|
+
evidence.predicateResults = predicateResults?.filter(
|
|
129466
|
+
(r) => r.passed === false || r.status === "error" || r.predicate?.type && ASSERTION_STAGE2[r.predicate.type] !== "userValue"
|
|
129467
|
+
);
|
|
129468
|
+
}
|
|
129469
|
+
if (input.criteria?.status === "failed" && (input.source !== "swarm" || !input.swarmPolicy || input.swarmPolicy.requiredCriteria > 0))
|
|
129470
|
+
evidence.evaluatorErrored = true;
|
|
129039
129471
|
const judgeEvidence = judgeEvidenceFrom(input);
|
|
129040
129472
|
if (judgeEvidence) evidence.judgeEvidence = judgeEvidence;
|
|
129473
|
+
if (input.source === "swarm" && input.swarmPolicy?.requiredCriteria) {
|
|
129474
|
+
const requiredResults = input.criteria?.results?.filter(
|
|
129475
|
+
(r) => r.predicate?.role !== "advisory"
|
|
129476
|
+
) ?? [];
|
|
129477
|
+
const requiredFailure = requiredResults.some(
|
|
129478
|
+
(r) => r.status !== "error" && !r.passed
|
|
129479
|
+
);
|
|
129480
|
+
if (!requiredFailure && input.criteria?.status !== "failed") {
|
|
129481
|
+
if (!input.criteria || input.criteria.status === "pending") {
|
|
129482
|
+
evidence.judgeEvidence = {
|
|
129483
|
+
status: "pending",
|
|
129484
|
+
pendingKind: "scheduled"
|
|
129485
|
+
};
|
|
129486
|
+
evidence.predicateResults = evidence.predicateResults?.filter(
|
|
129487
|
+
(r) => r.passed === false
|
|
129488
|
+
);
|
|
129489
|
+
} else if (requiredResults.length < input.swarmPolicy.requiredCriteria || requiredResults.some((r) => r.status === "error")) {
|
|
129490
|
+
evidence.evaluatorErrored = true;
|
|
129491
|
+
}
|
|
129492
|
+
}
|
|
129493
|
+
}
|
|
129494
|
+
if (input.source === "swarm" && input.swarmPolicy?.judgeDecisive && input.goalJudge?.status === "completed" && input.goalJudge.passed === false) {
|
|
129495
|
+
delete evidence.evaluatorErrored;
|
|
129496
|
+
if (judgeEvidence) evidence.judgeEvidence = judgeEvidence;
|
|
129497
|
+
}
|
|
129041
129498
|
return {
|
|
129042
129499
|
authored: buildChatSessionAuthoredCase(input),
|
|
129043
129500
|
evidence,
|
|
@@ -129682,16 +130139,16 @@ function buildFrictionCallRecords(args) {
|
|
|
129682
130139
|
const results = args.resultsByToolCallId;
|
|
129683
130140
|
const records = [];
|
|
129684
130141
|
for (const [index, call] of args.toolsCalled.entries()) {
|
|
129685
|
-
const
|
|
129686
|
-
const toolName22 = typeof
|
|
129687
|
-
const toolCallId = typeof
|
|
130142
|
+
const record5 = isRecord21(call) ? call : {};
|
|
130143
|
+
const toolName22 = typeof record5.toolName === "string" && record5.toolName.length > 0 ? record5.toolName : typeof record5.tool === "string" && record5.tool.length > 0 ? record5.tool : typeof record5.name === "string" && record5.name.length > 0 ? record5.name : "";
|
|
130144
|
+
const toolCallId = typeof record5.toolCallId === "string" && record5.toolCallId.length > 0 ? record5.toolCallId : void 0;
|
|
129688
130145
|
const entry3 = toolCallId ? results?.get(toolCallId) : void 0;
|
|
129689
130146
|
const timed = entry3 !== void 0 && typeof entry3.startedAtMs === "number" && typeof entry3.settledAtMs === "number";
|
|
129690
130147
|
records.push({
|
|
129691
130148
|
index,
|
|
129692
130149
|
toolName: toolName22,
|
|
129693
130150
|
...toolCallId ? { toolCallId } : {},
|
|
129694
|
-
arguments:
|
|
130151
|
+
arguments: record5.arguments,
|
|
129695
130152
|
...entry3 ? {
|
|
129696
130153
|
result: {
|
|
129697
130154
|
...normalizeFrictionResult(entry3.raw),
|
|
@@ -129746,18 +130203,18 @@ function compareSignals(a, b) {
|
|
|
129746
130203
|
function deriveTrialFrictionSignals(records) {
|
|
129747
130204
|
const callCount = records.length;
|
|
129748
130205
|
const resultAvailableCount = records.filter(
|
|
129749
|
-
(
|
|
130206
|
+
(record5) => record5.resultAvailable
|
|
129750
130207
|
).length;
|
|
129751
130208
|
const timedCallCount = records.filter(
|
|
129752
|
-
(
|
|
130209
|
+
(record5) => record5.ordering === "timed"
|
|
129753
130210
|
).length;
|
|
129754
130211
|
const counts = { callCount, resultAvailableCount, timedCallCount };
|
|
129755
130212
|
if (callCount === 0) return notMeasured("noToolCalls", counts);
|
|
129756
130213
|
if (callCount > MAX_FRICTION_CALLS) return notMeasured("truncated", counts);
|
|
129757
130214
|
const canonicalArguments = [];
|
|
129758
|
-
for (const
|
|
130215
|
+
for (const record5 of records) {
|
|
129759
130216
|
try {
|
|
129760
|
-
canonicalArguments.push((0, canonical_exports3.canonicalJson)(
|
|
130217
|
+
canonicalArguments.push((0, canonical_exports3.canonicalJson)(record5.arguments ?? null));
|
|
129761
130218
|
} catch (error) {
|
|
129762
130219
|
if (error instanceof canonical_exports3.CanonicalJsonError) {
|
|
129763
130220
|
return notMeasured("evidenceIncomplete", counts);
|
|
@@ -129810,7 +130267,7 @@ function deriveTrialFrictionSignals(records) {
|
|
|
129810
130267
|
if (resultAvailableCount !== callCount) {
|
|
129811
130268
|
identifierSignals = { state: "notMeasured", reason: "resultsUnavailable" };
|
|
129812
130269
|
} else {
|
|
129813
|
-
const modes = new Set(records.map((
|
|
130270
|
+
const modes = new Set(records.map((record5) => record5.ordering));
|
|
129814
130271
|
if (modes.size !== 1 || modes.has("unknown")) {
|
|
129815
130272
|
identifierSignals = { state: "notMeasured", reason: "orderingUnknown" };
|
|
129816
130273
|
}
|
|
@@ -129924,18 +130381,18 @@ function deriveTrialFrictionSignalsFromCalls(args) {
|
|
|
129924
130381
|
if (args.evidenceHole) {
|
|
129925
130382
|
return notMeasured(args.evidenceHole, {
|
|
129926
130383
|
callCount: records.length,
|
|
129927
|
-
resultAvailableCount: records.filter((
|
|
129928
|
-
timedCallCount: records.filter((
|
|
130384
|
+
resultAvailableCount: records.filter((record5) => record5.resultAvailable).length,
|
|
130385
|
+
timedCallCount: records.filter((record5) => record5.ordering === "timed").length
|
|
129929
130386
|
});
|
|
129930
130387
|
}
|
|
129931
130388
|
return deriveTrialFrictionSignals(records);
|
|
129932
130389
|
}
|
|
129933
130390
|
function projectFrictionSignals(metadata) {
|
|
129934
130391
|
if (!metadata || typeof metadata !== "object") return {};
|
|
129935
|
-
const
|
|
129936
|
-
if (!("frictionSignals" in
|
|
130392
|
+
const record5 = metadata;
|
|
130393
|
+
if (!("frictionSignals" in record5)) return {};
|
|
129937
130394
|
const parsed = evalTrialFrictionSignalsSchema.safeParse(
|
|
129938
|
-
|
|
130395
|
+
record5.frictionSignals
|
|
129939
130396
|
);
|
|
129940
130397
|
if (parsed.success) return { frictionSignals: parsed.data };
|
|
129941
130398
|
return { frictionSignalsUnverified: true };
|
|
@@ -130006,10 +130463,10 @@ var suspectedConditionVerdictSchema = z14.discriminatedUnion("status", [
|
|
|
130006
130463
|
]);
|
|
130007
130464
|
function projectSuspectedConditionVerdict(metadata) {
|
|
130008
130465
|
if (!metadata || typeof metadata !== "object") return {};
|
|
130009
|
-
const
|
|
130010
|
-
if (!("suspectedConditionVerdict" in
|
|
130466
|
+
const record5 = metadata;
|
|
130467
|
+
if (!("suspectedConditionVerdict" in record5)) return {};
|
|
130011
130468
|
const parsed = suspectedConditionVerdictSchema.safeParse(
|
|
130012
|
-
|
|
130469
|
+
record5.suspectedConditionVerdict
|
|
130013
130470
|
);
|
|
130014
130471
|
if (parsed.success) return { suspectedConditionVerdict: parsed.data };
|
|
130015
130472
|
return { suspectedConditionUnverified: true };
|
|
@@ -130633,10 +131090,10 @@ function assembleEvalRunDecisionSummary(input) {
|
|
|
130633
131090
|
}
|
|
130634
131091
|
function legacyTrialCounts(summary) {
|
|
130635
131092
|
if (!summary || typeof summary !== "object") return void 0;
|
|
130636
|
-
const
|
|
130637
|
-
const total =
|
|
130638
|
-
const passed2 =
|
|
130639
|
-
const failed3 =
|
|
131093
|
+
const count22 = (value) => typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : void 0;
|
|
131094
|
+
const total = count22(summary.total);
|
|
131095
|
+
const passed2 = count22(summary.passed);
|
|
131096
|
+
const failed3 = count22(summary.failed);
|
|
130640
131097
|
if (total === void 0 && passed2 === void 0 && failed3 === void 0) {
|
|
130641
131098
|
return void 0;
|
|
130642
131099
|
}
|
|
@@ -130762,8 +131219,8 @@ function nonEmptyString(value) {
|
|
|
130762
131219
|
}
|
|
130763
131220
|
function toolName(value) {
|
|
130764
131221
|
if (!value || typeof value !== "object") return void 0;
|
|
130765
|
-
const
|
|
130766
|
-
return nonEmptyString(
|
|
131222
|
+
const record5 = value;
|
|
131223
|
+
return nonEmptyString(record5.toolName) ?? nonEmptyString(record5.tool) ?? nonEmptyString(record5.name);
|
|
130767
131224
|
}
|
|
130768
131225
|
function toolNames(calls) {
|
|
130769
131226
|
const names = (calls ?? []).map(toolName).filter((name15) => name15 !== void 0);
|
|
@@ -132050,6 +132507,417 @@ var evalBacktestContinuationSchema2 = z14.object({
|
|
|
132050
132507
|
var evalBacktestRequestSchema = evalBacktestDraftSchema2.extend({
|
|
132051
132508
|
continuation: evalBacktestContinuationSchema2.optional()
|
|
132052
132509
|
});
|
|
132510
|
+
var SWARM_SESSION_VERDICT_CONTRACT_VERSION2 = 1;
|
|
132511
|
+
var SWARM_STAGE_EVIDENCE_VERSION = 2;
|
|
132512
|
+
var SWARM_ATTEMPT_STATUSES2 = [
|
|
132513
|
+
"pending",
|
|
132514
|
+
"running",
|
|
132515
|
+
"succeeded",
|
|
132516
|
+
"failed",
|
|
132517
|
+
"rate_limited"
|
|
132518
|
+
];
|
|
132519
|
+
var SWARM_SESSION_LIFECYCLES2 = [
|
|
132520
|
+
"pending",
|
|
132521
|
+
"running",
|
|
132522
|
+
"ran",
|
|
132523
|
+
"broke",
|
|
132524
|
+
"limited",
|
|
132525
|
+
"withdrawn"
|
|
132526
|
+
];
|
|
132527
|
+
var SWARM_SESSION_VERDICTS2 = [
|
|
132528
|
+
"passed",
|
|
132529
|
+
"failed",
|
|
132530
|
+
"inconclusive",
|
|
132531
|
+
"notEstablished"
|
|
132532
|
+
];
|
|
132533
|
+
var SWARM_GRADING_STATES2 = [
|
|
132534
|
+
"notRequested",
|
|
132535
|
+
"queued",
|
|
132536
|
+
"running",
|
|
132537
|
+
"settled",
|
|
132538
|
+
"unavailable"
|
|
132539
|
+
];
|
|
132540
|
+
var SWARM_SESSION_VERDICT_OF_REASON2 = {
|
|
132541
|
+
attemptPending: "notEstablished",
|
|
132542
|
+
attemptRunning: "notEstablished",
|
|
132543
|
+
withdrawn: "notEstablished",
|
|
132544
|
+
spendCapReached: "notEstablished",
|
|
132545
|
+
notRun: "notEstablished",
|
|
132546
|
+
executionFailed: "notEstablished",
|
|
132547
|
+
ungraded: "notEstablished",
|
|
132548
|
+
gradingNotClaimed: "notEstablished",
|
|
132549
|
+
criteriaPending: "notEstablished",
|
|
132550
|
+
judgePending: "notEstablished",
|
|
132551
|
+
gatingCriterionFailed: "failed",
|
|
132552
|
+
judgeFailed: "failed",
|
|
132553
|
+
criteriaGradingErrored: "inconclusive",
|
|
132554
|
+
gatingCriterionUnmeasured: "inconclusive",
|
|
132555
|
+
judgeErrored: "inconclusive",
|
|
132556
|
+
gradingUnavailable: "inconclusive",
|
|
132557
|
+
allGatingCriteriaPassed: "passed",
|
|
132558
|
+
judgePassed: "passed",
|
|
132559
|
+
allGradersPassed: "passed"
|
|
132560
|
+
};
|
|
132561
|
+
var SWARM_SESSION_VERDICT_REASONS2 = Object.keys(
|
|
132562
|
+
SWARM_SESSION_VERDICT_OF_REASON2
|
|
132563
|
+
);
|
|
132564
|
+
var swarmSessionLifecycleSchema2 = z14.enum(SWARM_SESSION_LIFECYCLES2);
|
|
132565
|
+
var swarmSessionVerdictValueSchema2 = z14.enum(SWARM_SESSION_VERDICTS2);
|
|
132566
|
+
var swarmGraderRoleSchema2 = z14.enum(["advisory", "required"]);
|
|
132567
|
+
var swarmSessionAttemptInputSchema2 = z14.object({
|
|
132568
|
+
status: z14.enum(SWARM_ATTEMPT_STATUSES2),
|
|
132569
|
+
errorCode: z14.string().nullable().optional()
|
|
132570
|
+
}).strict();
|
|
132571
|
+
var swarmGradingReadinessSchema2 = z14.object({
|
|
132572
|
+
/** Durable readiness for decisive grading only, not background observations. */
|
|
132573
|
+
state: z14.enum(SWARM_GRADING_STATES2),
|
|
132574
|
+
reasonCode: z14.string().min(1).optional()
|
|
132575
|
+
}).strict();
|
|
132576
|
+
var criterionResultSchema2 = z14.object({
|
|
132577
|
+
criterionId: z14.string().min(1),
|
|
132578
|
+
passed: z14.boolean(),
|
|
132579
|
+
status: z14.enum(["scored", "error"]).optional()
|
|
132580
|
+
}).strict();
|
|
132581
|
+
var swarmSessionVerdictInputSchema = z14.object({
|
|
132582
|
+
attempt: swarmSessionAttemptInputSchema2.nullable(),
|
|
132583
|
+
hasTranscript: z14.boolean(),
|
|
132584
|
+
rubric: z14.array(
|
|
132585
|
+
z14.object({
|
|
132586
|
+
id: z14.string().min(1),
|
|
132587
|
+
role: swarmGraderRoleSchema2,
|
|
132588
|
+
predicateType: z14.string().min(1).optional()
|
|
132589
|
+
}).strict()
|
|
132590
|
+
),
|
|
132591
|
+
criteria: z14.object({
|
|
132592
|
+
status: z14.enum(["pending", "completed", "failed"]),
|
|
132593
|
+
criterionIds: z14.array(z14.string().min(1)).optional(),
|
|
132594
|
+
results: z14.array(criterionResultSchema2).optional()
|
|
132595
|
+
}).strict().nullable(),
|
|
132596
|
+
goalScore: z14.discriminatedUnion("status", [
|
|
132597
|
+
z14.object({ status: z14.literal("completed"), passed: z14.boolean() }).strict(),
|
|
132598
|
+
z14.object({ status: z14.literal("running") }).strict(),
|
|
132599
|
+
z14.object({ status: z14.literal("failed") }).strict()
|
|
132600
|
+
]).nullable(),
|
|
132601
|
+
judge: z14.object({
|
|
132602
|
+
automatic: z14.boolean(),
|
|
132603
|
+
role: swarmGraderRoleSchema2,
|
|
132604
|
+
/** Explicit on-demand intent; automatic:false alone does not mean a judge was requested. */
|
|
132605
|
+
requested: z14.boolean().optional()
|
|
132606
|
+
}).strict(),
|
|
132607
|
+
grading: swarmGradingReadinessSchema2
|
|
132608
|
+
}).strict().superRefine((value, ctx) => {
|
|
132609
|
+
const definitions = new Set(value.rubric.map((entry3) => entry3.id));
|
|
132610
|
+
if (definitions.size !== value.rubric.length) {
|
|
132611
|
+
ctx.addIssue({
|
|
132612
|
+
code: "custom",
|
|
132613
|
+
path: ["rubric"],
|
|
132614
|
+
message: "Duplicate criterion definition"
|
|
132615
|
+
});
|
|
132616
|
+
}
|
|
132617
|
+
for (const [field, ids] of [
|
|
132618
|
+
["criterionIds", value.criteria?.criterionIds ?? []],
|
|
132619
|
+
["results", value.criteria?.results?.map((row2) => row2.criterionId) ?? []]
|
|
132620
|
+
]) {
|
|
132621
|
+
if (new Set(ids).size !== ids.length || ids.some((id3) => !definitions.has(id3))) {
|
|
132622
|
+
ctx.addIssue({
|
|
132623
|
+
code: "custom",
|
|
132624
|
+
path: ["criteria", field],
|
|
132625
|
+
message: "Criterion IDs must be unique and defined in the snapshot"
|
|
132626
|
+
});
|
|
132627
|
+
}
|
|
132628
|
+
}
|
|
132629
|
+
const claimed = value.criteria?.criterionIds;
|
|
132630
|
+
if (claimed && value.criteria?.results?.some((row2) => !claimed.includes(row2.criterionId))) {
|
|
132631
|
+
ctx.addIssue({
|
|
132632
|
+
code: "custom",
|
|
132633
|
+
path: ["criteria", "results"],
|
|
132634
|
+
message: "Result outside claimed scope"
|
|
132635
|
+
});
|
|
132636
|
+
}
|
|
132637
|
+
});
|
|
132638
|
+
var SWARM_SESSION_TRIAL_STATUSES2 = [
|
|
132639
|
+
"pending",
|
|
132640
|
+
"running",
|
|
132641
|
+
"completed",
|
|
132642
|
+
"failed",
|
|
132643
|
+
"setup_failed",
|
|
132644
|
+
"cancelled"
|
|
132645
|
+
];
|
|
132646
|
+
var swarmSessionTrialSchema2 = z14.object({
|
|
132647
|
+
status: z14.enum(SWARM_SESSION_TRIAL_STATUSES2),
|
|
132648
|
+
taskVerdict: z14.enum(["passed", "failed"]).optional(),
|
|
132649
|
+
evaluatorError: z14.literal(true).optional()
|
|
132650
|
+
}).strict().superRefine((value, ctx) => {
|
|
132651
|
+
const verdict = value.taskVerdict !== void 0;
|
|
132652
|
+
const error = value.evaluatorError === true;
|
|
132653
|
+
if (value.status === "completed" ? verdict === error : verdict || error) {
|
|
132654
|
+
ctx.addIssue({
|
|
132655
|
+
code: "custom",
|
|
132656
|
+
message: "Only completed trials carry exactly one verdict or evaluator error"
|
|
132657
|
+
});
|
|
132658
|
+
}
|
|
132659
|
+
});
|
|
132660
|
+
var swarmSessionGraderCountsSchema2 = z14.object({
|
|
132661
|
+
gating: z14.number().int().nonnegative(),
|
|
132662
|
+
gatingPassed: z14.number().int().nonnegative(),
|
|
132663
|
+
gatingFailed: z14.number().int().nonnegative(),
|
|
132664
|
+
gatingUnmeasured: z14.number().int().nonnegative(),
|
|
132665
|
+
advisoryFailed: z14.number().int().nonnegative()
|
|
132666
|
+
}).strict();
|
|
132667
|
+
var swarmSessionVerdictSchema2 = z14.object({
|
|
132668
|
+
contractVersion: z14.literal(SWARM_SESSION_VERDICT_CONTRACT_VERSION2),
|
|
132669
|
+
lifecycle: swarmSessionLifecycleSchema2,
|
|
132670
|
+
verdict: swarmSessionVerdictValueSchema2,
|
|
132671
|
+
reason: z14.enum(SWARM_SESSION_VERDICT_REASONS2),
|
|
132672
|
+
verdictSource: z14.enum([
|
|
132673
|
+
"goalJudge",
|
|
132674
|
+
"requiredAssertions",
|
|
132675
|
+
"combined",
|
|
132676
|
+
"none"
|
|
132677
|
+
]),
|
|
132678
|
+
grading: swarmGradingReadinessSchema2,
|
|
132679
|
+
graders: z14.object({
|
|
132680
|
+
criteria: z14.enum([
|
|
132681
|
+
"notConfigured",
|
|
132682
|
+
"notClaimed",
|
|
132683
|
+
"pending",
|
|
132684
|
+
"scored",
|
|
132685
|
+
"errored"
|
|
132686
|
+
]),
|
|
132687
|
+
judge: z14.enum([
|
|
132688
|
+
"notConfigured",
|
|
132689
|
+
"silent",
|
|
132690
|
+
"pending",
|
|
132691
|
+
"scored",
|
|
132692
|
+
"errored"
|
|
132693
|
+
])
|
|
132694
|
+
}).strict(),
|
|
132695
|
+
counts: swarmSessionGraderCountsSchema2,
|
|
132696
|
+
trial: swarmSessionTrialSchema2.nullable()
|
|
132697
|
+
}).strict().superRefine((value, ctx) => {
|
|
132698
|
+
const fail3 = (message) => ctx.addIssue({ code: "custom", message });
|
|
132699
|
+
if (SWARM_SESSION_VERDICT_OF_REASON2[value.reason] !== value.verdict)
|
|
132700
|
+
fail3("Reason contradicts verdict");
|
|
132701
|
+
const c = value.counts;
|
|
132702
|
+
if (c.gating !== c.gatingPassed + c.gatingFailed + c.gatingUnmeasured)
|
|
132703
|
+
fail3("Required measurement counts do not add up");
|
|
132704
|
+
const trial = value.trial;
|
|
132705
|
+
if (trial?.status === "completed") {
|
|
132706
|
+
if (value.lifecycle !== "ran")
|
|
132707
|
+
fail3("Only a completed execution can be a completed trial");
|
|
132708
|
+
if (trial.taskVerdict !== void 0 && trial.taskVerdict !== value.verdict)
|
|
132709
|
+
fail3("Trial contradicts goal result");
|
|
132710
|
+
if (trial.evaluatorError && value.verdict !== "inconclusive")
|
|
132711
|
+
fail3("Evaluator error requires inconclusive grading");
|
|
132712
|
+
}
|
|
132713
|
+
const expected = {
|
|
132714
|
+
pending: "pending",
|
|
132715
|
+
running: "running",
|
|
132716
|
+
broke: "failed",
|
|
132717
|
+
limited: "setup_failed",
|
|
132718
|
+
withdrawn: "cancelled"
|
|
132719
|
+
};
|
|
132720
|
+
if (value.lifecycle !== "ran" && trial?.status !== expected[value.lifecycle])
|
|
132721
|
+
fail3("Trial must preserve execution lifecycle");
|
|
132722
|
+
if (value.lifecycle === "ran" && trial !== null && trial.status !== "completed")
|
|
132723
|
+
fail3("Completed execution must not become skipped or running");
|
|
132724
|
+
if ((value.verdict === "passed" || value.verdict === "failed") && value.verdictSource === "none")
|
|
132725
|
+
fail3("A measured goal verdict needs a source");
|
|
132726
|
+
if (value.lifecycle === "ran" && value.verdict !== "notEstablished" && trial === null)
|
|
132727
|
+
fail3("Settled grading on completed execution needs an observation");
|
|
132728
|
+
if (value.verdict === "notEstablished" && value.verdictSource !== "none")
|
|
132729
|
+
fail3("An undecided goal has no verdict source");
|
|
132730
|
+
});
|
|
132731
|
+
var SWARM_REPORT_CONTRACT_VERSION2 = 1;
|
|
132732
|
+
var count2 = z14.number().int().nonnegative();
|
|
132733
|
+
var journeyRunVerdictSummarySchema2 = z14.discriminatedUnion("status", [
|
|
132734
|
+
z14.object({
|
|
132735
|
+
status: z14.literal("pending"),
|
|
132736
|
+
pendingSessions: count2,
|
|
132737
|
+
updatedAt: count2
|
|
132738
|
+
}).strict(),
|
|
132739
|
+
z14.object({
|
|
132740
|
+
status: z14.literal("decided"),
|
|
132741
|
+
decision: evalVerdictDecisionSchema2,
|
|
132742
|
+
updatedAt: count2
|
|
132743
|
+
}).strict(),
|
|
132744
|
+
z14.object({
|
|
132745
|
+
status: z14.literal("notEstablished"),
|
|
132746
|
+
reason: z14.literal("gradingNotConfigured"),
|
|
132747
|
+
updatedAt: count2
|
|
132748
|
+
}).strict(),
|
|
132749
|
+
z14.object({
|
|
132750
|
+
status: z14.literal("integrityFailed"),
|
|
132751
|
+
reason: z14.string().min(1),
|
|
132752
|
+
updatedAt: count2
|
|
132753
|
+
}).strict()
|
|
132754
|
+
]);
|
|
132755
|
+
var swarmObservationInputSchema2 = z14.object({
|
|
132756
|
+
evaluatorId: z14.string().min(1),
|
|
132757
|
+
predicateType: z14.enum(
|
|
132758
|
+
Object.keys(ASSERTION_STAGE2)
|
|
132759
|
+
),
|
|
132760
|
+
role: z14.enum(["advisory", "required"]),
|
|
132761
|
+
/** Missing capture/error is unavailable; it must not use the compatibility passed:false. */
|
|
132762
|
+
status: z14.enum(["passed", "failed", "pending", "unavailable"])
|
|
132763
|
+
}).strict();
|
|
132764
|
+
var swarmReportSessionSchema2 = z14.object({
|
|
132765
|
+
/** Stable attempt/slot identity, including slots with no session document. */
|
|
132766
|
+
id: z14.string().min(1),
|
|
132767
|
+
/** A producer fact. Grade coverage and lifecycle alone cannot establish a non-start. */
|
|
132768
|
+
startEvidence: z14.enum(["started", "notStarted", "unknown"]),
|
|
132769
|
+
verdict: swarmSessionVerdictSchema2,
|
|
132770
|
+
observations: z14.array(swarmObservationInputSchema2)
|
|
132771
|
+
}).strict().superRefine((row2, ctx) => {
|
|
132772
|
+
if (new Set(row2.observations.map((o) => o.evaluatorId)).size !== row2.observations.length) {
|
|
132773
|
+
ctx.addIssue({
|
|
132774
|
+
code: "custom",
|
|
132775
|
+
path: ["observations"],
|
|
132776
|
+
message: "Duplicate evaluator in one session"
|
|
132777
|
+
});
|
|
132778
|
+
}
|
|
132779
|
+
if (row2.startEvidence === "notStarted" && ["running", "ran"].includes(row2.verdict.lifecycle)) {
|
|
132780
|
+
ctx.addIssue({
|
|
132781
|
+
code: "custom",
|
|
132782
|
+
path: ["startEvidence"],
|
|
132783
|
+
message: "Execution contradicts explicit non-start"
|
|
132784
|
+
});
|
|
132785
|
+
}
|
|
132786
|
+
});
|
|
132787
|
+
var swarmReportInputSchema = z14.object({
|
|
132788
|
+
runId: z14.string().min(1),
|
|
132789
|
+
executionComplete: z14.boolean(),
|
|
132790
|
+
configuredSessions: count2,
|
|
132791
|
+
verdictSummary: journeyRunVerdictSummarySchema2.nullable(),
|
|
132792
|
+
/** Frozen run-wide definitions: absent measurement rows still count as unavailable. */
|
|
132793
|
+
evaluatorDefinitions: z14.array(
|
|
132794
|
+
swarmObservationInputSchema2.omit({ status: true })
|
|
132795
|
+
),
|
|
132796
|
+
sessions: z14.array(swarmReportSessionSchema2)
|
|
132797
|
+
}).strict().superRefine((input, ctx) => {
|
|
132798
|
+
if (input.sessions.length > input.configuredSessions) {
|
|
132799
|
+
ctx.addIssue({
|
|
132800
|
+
code: "custom",
|
|
132801
|
+
path: ["sessions"],
|
|
132802
|
+
message: "Reported sessions exceed configured population"
|
|
132803
|
+
});
|
|
132804
|
+
}
|
|
132805
|
+
if (new Set(input.sessions.map((row2) => row2.id)).size !== input.sessions.length) {
|
|
132806
|
+
ctx.addIssue({
|
|
132807
|
+
code: "custom",
|
|
132808
|
+
path: ["sessions"],
|
|
132809
|
+
message: "Duplicate session/attempt identity"
|
|
132810
|
+
});
|
|
132811
|
+
}
|
|
132812
|
+
const definitions = new Map(
|
|
132813
|
+
input.evaluatorDefinitions.map((row2) => [row2.evaluatorId, row2])
|
|
132814
|
+
);
|
|
132815
|
+
if (definitions.size !== input.evaluatorDefinitions.length) {
|
|
132816
|
+
ctx.addIssue({
|
|
132817
|
+
code: "custom",
|
|
132818
|
+
path: ["evaluatorDefinitions"],
|
|
132819
|
+
message: "Duplicate evaluator definition"
|
|
132820
|
+
});
|
|
132821
|
+
}
|
|
132822
|
+
for (const session of input.sessions) {
|
|
132823
|
+
for (const observation of session.observations) {
|
|
132824
|
+
const definition = definitions.get(observation.evaluatorId);
|
|
132825
|
+
if (!definition || definition.role !== observation.role || definition.predicateType !== observation.predicateType) {
|
|
132826
|
+
ctx.addIssue({
|
|
132827
|
+
code: "custom",
|
|
132828
|
+
path: ["sessions"],
|
|
132829
|
+
message: "Observation contradicts the frozen evaluator definition"
|
|
132830
|
+
});
|
|
132831
|
+
}
|
|
132832
|
+
}
|
|
132833
|
+
}
|
|
132834
|
+
});
|
|
132835
|
+
var swarmObservationCoverageSchema2 = z14.object({
|
|
132836
|
+
evaluatorId: z14.string().min(1),
|
|
132837
|
+
predicateType: z14.enum(
|
|
132838
|
+
Object.keys(ASSERTION_STAGE2)
|
|
132839
|
+
),
|
|
132840
|
+
role: z14.enum(["advisory", "required"]),
|
|
132841
|
+
stage: z14.enum(USER_VALUE_STAGES2).describe(
|
|
132842
|
+
"The stage this observation was read from, and the only stage it is evidence ABOUT. `connection` \u2014 the server was reachable and the session initialized. `discovery` \u2014 its tools and resources were listed and readable. `selection` \u2014 the model chose the right tool for the request. `call` \u2014 the call was made with usable arguments. `response` \u2014 the server returned data the model could use. `userValue` \u2014 the user's actual request was satisfied."
|
|
132843
|
+
),
|
|
132844
|
+
unit: z14.literal("sessions"),
|
|
132845
|
+
total: count2,
|
|
132846
|
+
passed: count2,
|
|
132847
|
+
failed: count2,
|
|
132848
|
+
pending: count2,
|
|
132849
|
+
unavailable: count2
|
|
132850
|
+
}).strict().superRefine((value, ctx) => {
|
|
132851
|
+
if (value.total !== value.passed + value.failed + value.pending + value.unavailable) {
|
|
132852
|
+
ctx.addIssue({
|
|
132853
|
+
code: "custom",
|
|
132854
|
+
message: "Observation coverage must partition its population"
|
|
132855
|
+
});
|
|
132856
|
+
}
|
|
132857
|
+
if (value.stage !== ASSERTION_STAGE2[value.predicateType]) {
|
|
132858
|
+
ctx.addIssue({
|
|
132859
|
+
code: "custom",
|
|
132860
|
+
message: "Observation stage contradicts the shared evaluator map"
|
|
132861
|
+
});
|
|
132862
|
+
}
|
|
132863
|
+
});
|
|
132864
|
+
var swarmReportSchema = z14.object({
|
|
132865
|
+
contractVersion: z14.literal(SWARM_REPORT_CONTRACT_VERSION2),
|
|
132866
|
+
runId: z14.string().min(1),
|
|
132867
|
+
verdict: swarmSessionVerdictValueSchema2,
|
|
132868
|
+
verdictSource: z14.enum(["policyV2", "none"]),
|
|
132869
|
+
decision: evalVerdictDecisionSchema2.optional(),
|
|
132870
|
+
undecidedReason: z14.enum([
|
|
132871
|
+
"executionPending",
|
|
132872
|
+
"gradingPending",
|
|
132873
|
+
"gradingNotConfigured",
|
|
132874
|
+
"verdictSummaryUnavailable",
|
|
132875
|
+
"integrityFailed"
|
|
132876
|
+
]).optional(),
|
|
132877
|
+
execution: z14.object({
|
|
132878
|
+
unit: z14.literal("sessions"),
|
|
132879
|
+
configured: count2,
|
|
132880
|
+
reported: count2,
|
|
132881
|
+
started: count2,
|
|
132882
|
+
notStarted: count2,
|
|
132883
|
+
unknown: count2,
|
|
132884
|
+
completed: count2,
|
|
132885
|
+
interrupted: count2,
|
|
132886
|
+
/** Only explicit complete execution evidence can establish this. */
|
|
132887
|
+
neverLaunched: z14.boolean()
|
|
132888
|
+
}).strict(),
|
|
132889
|
+
goalGrading: z14.object({
|
|
132890
|
+
unit: z14.literal("sessions"),
|
|
132891
|
+
reported: count2,
|
|
132892
|
+
passed: count2,
|
|
132893
|
+
failed: count2,
|
|
132894
|
+
pending: count2,
|
|
132895
|
+
unavailable: count2,
|
|
132896
|
+
notRequested: count2,
|
|
132897
|
+
/** Readiness is separate: a proven failure can exist while other required grading is pending. */
|
|
132898
|
+
waitingForDecisiveGrading: count2
|
|
132899
|
+
}).strict(),
|
|
132900
|
+
observations: z14.array(swarmObservationCoverageSchema2)
|
|
132901
|
+
}).strict().superRefine((report, ctx) => {
|
|
132902
|
+
const fail3 = (message) => ctx.addIssue({ code: "custom", message });
|
|
132903
|
+
if (report.verdictSource === "policyV2") {
|
|
132904
|
+
if (!report.decision || report.verdict !== report.decision.verdict || report.undecidedReason !== void 0)
|
|
132905
|
+
fail3("Report must copy its authoritative decision");
|
|
132906
|
+
} else if (report.verdict !== "notEstablished" || report.decision !== void 0 || !report.undecidedReason)
|
|
132907
|
+
fail3("Missing authority must have an undecided reason");
|
|
132908
|
+
const e = report.execution;
|
|
132909
|
+
if (e.started + e.notStarted + e.unknown !== e.configured || e.reported > e.configured)
|
|
132910
|
+
fail3("Execution evidence does not cover its configured population");
|
|
132911
|
+
if (e.started + e.notStarted > e.reported || e.completed + e.interrupted > e.reported)
|
|
132912
|
+
fail3("Execution counts exceed reported evidence");
|
|
132913
|
+
if (e.neverLaunched !== (e.configured > 0 && e.reported === e.configured && e.notStarted === e.configured))
|
|
132914
|
+
fail3("Not run requires explicit evidence for the entire population");
|
|
132915
|
+
const g = report.goalGrading;
|
|
132916
|
+
if (g.reported !== e.reported || g.passed + g.failed + g.pending + g.unavailable + g.notRequested !== g.reported || g.waitingForDecisiveGrading > g.reported)
|
|
132917
|
+
fail3("Goal coverage must partition reported sessions");
|
|
132918
|
+
if (new Set(report.observations.map((o) => o.evaluatorId)).size !== report.observations.length || report.observations.some((o) => o.total > e.reported))
|
|
132919
|
+
fail3("Invalid observation population");
|
|
132920
|
+
});
|
|
132053
132921
|
var export_CanonicalJsonError = canonical_exports3.CanonicalJsonError;
|
|
132054
132922
|
var export_EMIT_CANONICAL_ROLE = policy_spelling_exports3.EMIT_CANONICAL_ROLE;
|
|
132055
132923
|
var export_EVALUATOR_KINDS2 = evaluator_types_exports3.EVALUATOR_KINDS;
|
|
@@ -132318,7 +133186,7 @@ function collectResultText(output, depth = 0) {
|
|
|
132318
133186
|
if (Array.isArray(output)) {
|
|
132319
133187
|
return output.flatMap((entry3) => collectResultText(entry3, depth + 1));
|
|
132320
133188
|
}
|
|
132321
|
-
const
|
|
133189
|
+
const record5 = output;
|
|
132322
133190
|
const texts = [];
|
|
132323
133191
|
for (const key of [
|
|
132324
133192
|
"text",
|
|
@@ -132328,7 +133196,7 @@ function collectResultText(output, depth = 0) {
|
|
|
132328
133196
|
"value",
|
|
132329
133197
|
"stdout"
|
|
132330
133198
|
]) {
|
|
132331
|
-
const nested =
|
|
133199
|
+
const nested = record5[key];
|
|
132332
133200
|
if (nested !== void 0) {
|
|
132333
133201
|
texts.push(...collectResultText(nested, depth + 1));
|
|
132334
133202
|
}
|
|
@@ -132877,29 +133745,29 @@ function stableJson(value) {
|
|
|
132877
133745
|
if (Array.isArray(value)) {
|
|
132878
133746
|
return `[${value.map(stableJson).join(",")}]`;
|
|
132879
133747
|
}
|
|
132880
|
-
const
|
|
132881
|
-
return `{${Object.keys(
|
|
133748
|
+
const record5 = value;
|
|
133749
|
+
return `{${Object.keys(record5).sort().map((key) => `${JSON.stringify(key)}:${stableJson(record5[key])}`).join(",")}}`;
|
|
132882
133750
|
}
|
|
132883
133751
|
function scopeStepUpInputHash(input) {
|
|
132884
133752
|
return createHash14("sha256").update(stableJson(input)).digest("base64url");
|
|
132885
133753
|
}
|
|
132886
|
-
function expireIfNeeded(
|
|
132887
|
-
if ((
|
|
132888
|
-
|
|
132889
|
-
|
|
132890
|
-
|
|
132891
|
-
|
|
133754
|
+
function expireIfNeeded(record5) {
|
|
133755
|
+
if ((record5.status === "pending" || record5.status === "retrying") && record5.expiresAt <= Date.now()) {
|
|
133756
|
+
record5.status = "expired";
|
|
133757
|
+
record5.input = void 0;
|
|
133758
|
+
record5.inputPresent = false;
|
|
133759
|
+
record5.terminalReason = "continuation expired";
|
|
132892
133760
|
}
|
|
132893
|
-
return
|
|
133761
|
+
return record5;
|
|
132894
133762
|
}
|
|
132895
|
-
function scrubTerminal(
|
|
132896
|
-
|
|
132897
|
-
|
|
132898
|
-
|
|
132899
|
-
|
|
133763
|
+
function scrubTerminal(record5, status, reason) {
|
|
133764
|
+
record5.status = status;
|
|
133765
|
+
record5.input = void 0;
|
|
133766
|
+
record5.inputPresent = false;
|
|
133767
|
+
record5.terminalReason = reason;
|
|
132900
133768
|
const timer = setTimeout(() => {
|
|
132901
|
-
if (localContinuations.get(
|
|
132902
|
-
localContinuations.delete(
|
|
133769
|
+
if (localContinuations.get(record5.continuationId) === record5) {
|
|
133770
|
+
localContinuations.delete(record5.continuationId);
|
|
132903
133771
|
}
|
|
132904
133772
|
}, SCOPE_STEP_UP_LIVE_TTL_MS);
|
|
132905
133773
|
timer.unref?.();
|
|
@@ -132949,71 +133817,71 @@ function createLocalScopeStepUpContinuation(input) {
|
|
|
132949
133817
|
};
|
|
132950
133818
|
}
|
|
132951
133819
|
function claimLocalScopeStepUpContinuation(input) {
|
|
132952
|
-
const
|
|
132953
|
-
if (!
|
|
132954
|
-
expireIfNeeded(
|
|
132955
|
-
if (
|
|
133820
|
+
const record5 = localContinuations.get(input.continuationId);
|
|
133821
|
+
if (!record5) throw new Error("scope_step_up_continuation_not_found");
|
|
133822
|
+
expireIfNeeded(record5);
|
|
133823
|
+
if (record5.bindingKey !== input.bindingKey || record5.toolCallId !== input.toolCallId) {
|
|
132956
133824
|
throw new Error("scope_step_up_continuation_not_found");
|
|
132957
133825
|
}
|
|
132958
|
-
if (
|
|
133826
|
+
if (record5.status === "retrying") {
|
|
132959
133827
|
throw new Error("scope_step_up_retry_in_progress");
|
|
132960
133828
|
}
|
|
132961
|
-
if (
|
|
132962
|
-
throw new Error(`scope_step_up_continuation_${
|
|
133829
|
+
if (record5.status !== "pending" || !record5.inputPresent) {
|
|
133830
|
+
throw new Error(`scope_step_up_continuation_${record5.status}`);
|
|
132963
133831
|
}
|
|
132964
|
-
|
|
133832
|
+
record5.status = "retrying";
|
|
132965
133833
|
return {
|
|
132966
|
-
continuationId:
|
|
132967
|
-
bindingKey:
|
|
132968
|
-
serverId:
|
|
132969
|
-
...
|
|
132970
|
-
toolCallId:
|
|
132971
|
-
toolName:
|
|
132972
|
-
input:
|
|
132973
|
-
inputHash:
|
|
132974
|
-
challenge:
|
|
132975
|
-
expiresAt:
|
|
133834
|
+
continuationId: record5.continuationId,
|
|
133835
|
+
bindingKey: record5.bindingKey,
|
|
133836
|
+
serverId: record5.serverId,
|
|
133837
|
+
...record5.resourceUrl ? { resourceUrl: record5.resourceUrl } : {},
|
|
133838
|
+
toolCallId: record5.toolCallId,
|
|
133839
|
+
toolName: record5.toolName,
|
|
133840
|
+
input: record5.input,
|
|
133841
|
+
inputHash: record5.inputHash,
|
|
133842
|
+
challenge: record5.challenge,
|
|
133843
|
+
expiresAt: record5.expiresAt
|
|
132976
133844
|
};
|
|
132977
133845
|
}
|
|
132978
133846
|
function markLocalScopeStepUpWireStarted(continuationId) {
|
|
132979
|
-
const
|
|
132980
|
-
if (!
|
|
133847
|
+
const record5 = localContinuations.get(continuationId);
|
|
133848
|
+
if (!record5 || record5.status !== "retrying") {
|
|
132981
133849
|
throw new Error("scope_step_up_continuation_not_retrying");
|
|
132982
133850
|
}
|
|
132983
|
-
|
|
133851
|
+
record5.wireStartedAt = Date.now();
|
|
132984
133852
|
}
|
|
132985
133853
|
function completeLocalScopeStepUpContinuation(continuationId) {
|
|
132986
|
-
const
|
|
132987
|
-
if (!
|
|
132988
|
-
scrubTerminal(
|
|
133854
|
+
const record5 = localContinuations.get(continuationId);
|
|
133855
|
+
if (!record5) return;
|
|
133856
|
+
scrubTerminal(record5, "completed");
|
|
132989
133857
|
}
|
|
132990
133858
|
function failLocalScopeStepUpContinuation(continuationId, reason) {
|
|
132991
|
-
const
|
|
132992
|
-
if (!
|
|
132993
|
-
scrubTerminal(
|
|
133859
|
+
const record5 = localContinuations.get(continuationId);
|
|
133860
|
+
if (!record5) return;
|
|
133861
|
+
scrubTerminal(record5, "failed", reason);
|
|
132994
133862
|
}
|
|
132995
133863
|
function cancelLocalScopeStepUpContinuation(continuationId, reason) {
|
|
132996
|
-
const
|
|
132997
|
-
if (!
|
|
132998
|
-
if (
|
|
132999
|
-
scrubTerminal(
|
|
133864
|
+
const record5 = localContinuations.get(continuationId);
|
|
133865
|
+
if (!record5) return;
|
|
133866
|
+
if (record5.status === "retrying" && record5.wireStartedAt !== void 0) {
|
|
133867
|
+
scrubTerminal(record5, "indeterminate", reason);
|
|
133000
133868
|
return;
|
|
133001
133869
|
}
|
|
133002
|
-
scrubTerminal(
|
|
133870
|
+
scrubTerminal(record5, "cancelled", reason);
|
|
133003
133871
|
}
|
|
133004
133872
|
function cancelLocalScopeStepUpContinuationForRequest(input) {
|
|
133005
|
-
const
|
|
133006
|
-
if (!
|
|
133007
|
-
expireIfNeeded(
|
|
133008
|
-
if (
|
|
133873
|
+
const record5 = localContinuations.get(input.continuationId);
|
|
133874
|
+
if (!record5) throw new Error("scope_step_up_continuation_not_found");
|
|
133875
|
+
expireIfNeeded(record5);
|
|
133876
|
+
if (record5.bindingKey !== input.bindingKey || record5.toolCallId !== input.toolCallId) {
|
|
133009
133877
|
throw new Error("scope_step_up_continuation_not_found");
|
|
133010
133878
|
}
|
|
133011
|
-
if (
|
|
133012
|
-
throw new Error(`scope_step_up_continuation_${
|
|
133879
|
+
if (record5.status !== "pending") {
|
|
133880
|
+
throw new Error(`scope_step_up_continuation_${record5.status}`);
|
|
133013
133881
|
}
|
|
133014
|
-
const toolName3 =
|
|
133015
|
-
const serverId =
|
|
133016
|
-
scrubTerminal(
|
|
133882
|
+
const toolName3 = record5.toolName;
|
|
133883
|
+
const serverId = record5.serverId;
|
|
133884
|
+
scrubTerminal(record5, "cancelled", input.reason);
|
|
133017
133885
|
return { serverId, toolName: toolName3 };
|
|
133018
133886
|
}
|
|
133019
133887
|
|
|
@@ -134284,16 +135152,16 @@ async function readState() {
|
|
|
134284
135152
|
"the local harness grant store is not an object"
|
|
134285
135153
|
);
|
|
134286
135154
|
}
|
|
134287
|
-
const
|
|
134288
|
-
if (
|
|
135155
|
+
const record5 = parsed;
|
|
135156
|
+
if (record5.version !== 1 || !Array.isArray(record5.workspaces) || !Array.isArray(record5.harnessGrants) || !record5.workspaces.every(isWorkspaceGrant) || !record5.harnessGrants.every(isPersistedHarnessGrant)) {
|
|
134289
135157
|
throw new GrantStateUnreadableError(
|
|
134290
135158
|
"the local harness grant store has an unrecognized or malformed shape"
|
|
134291
135159
|
);
|
|
134292
135160
|
}
|
|
134293
135161
|
return {
|
|
134294
135162
|
version: 1,
|
|
134295
|
-
workspaces: [...
|
|
134296
|
-
harnessGrants: [...
|
|
135163
|
+
workspaces: [...record5.workspaces],
|
|
135164
|
+
harnessGrants: [...record5.harnessGrants]
|
|
134297
135165
|
};
|
|
134298
135166
|
}
|
|
134299
135167
|
async function writeState(state) {
|
|
@@ -137073,13 +137941,13 @@ async function readRegistry() {
|
|
|
137073
137941
|
"the local harness process registry is not an object"
|
|
137074
137942
|
);
|
|
137075
137943
|
}
|
|
137076
|
-
const
|
|
137077
|
-
if (
|
|
137944
|
+
const record5 = parsed;
|
|
137945
|
+
if (record5.version !== 1 || !Array.isArray(record5.records)) {
|
|
137078
137946
|
throw new RegistryUnreadableError(
|
|
137079
137947
|
"the local harness process registry has an unrecognized shape"
|
|
137080
137948
|
);
|
|
137081
137949
|
}
|
|
137082
|
-
return { version: 1, records:
|
|
137950
|
+
return { version: 1, records: record5.records };
|
|
137083
137951
|
}
|
|
137084
137952
|
async function writeRegistry(registry3) {
|
|
137085
137953
|
const dir = localHarnessStateRoot();
|
|
@@ -137094,22 +137962,22 @@ async function writeRegistry(registry3) {
|
|
|
137094
137962
|
function mintSupervisorNonce() {
|
|
137095
137963
|
return `sup_${randomUUID21()}`;
|
|
137096
137964
|
}
|
|
137097
|
-
function recordProcess(
|
|
137965
|
+
function recordProcess(record5) {
|
|
137098
137966
|
return withRegistryLock(async () => {
|
|
137099
137967
|
const registry3 = await readRegistry();
|
|
137100
137968
|
registry3.records = registry3.records.filter(
|
|
137101
|
-
(r) => r.sessionId !==
|
|
137969
|
+
(r) => r.sessionId !== record5.sessionId
|
|
137102
137970
|
);
|
|
137103
|
-
registry3.records.push(
|
|
137971
|
+
registry3.records.push(record5);
|
|
137104
137972
|
await writeRegistry(registry3);
|
|
137105
137973
|
});
|
|
137106
137974
|
}
|
|
137107
137975
|
function updateLifecycleState(sessionId, lifecycleState) {
|
|
137108
137976
|
return withRegistryLock(async () => {
|
|
137109
137977
|
const registry3 = await readRegistry();
|
|
137110
|
-
const
|
|
137111
|
-
if (!
|
|
137112
|
-
|
|
137978
|
+
const record5 = registry3.records.find((r) => r.sessionId === sessionId);
|
|
137979
|
+
if (!record5) return;
|
|
137980
|
+
record5.lifecycleState = lifecycleState;
|
|
137113
137981
|
await writeRegistry(registry3);
|
|
137114
137982
|
});
|
|
137115
137983
|
}
|
|
@@ -137123,14 +137991,14 @@ function forgetProcess(sessionId) {
|
|
|
137123
137991
|
if (registry3.records.length !== before) await writeRegistry(registry3);
|
|
137124
137992
|
});
|
|
137125
137993
|
}
|
|
137126
|
-
async function owningSupervisorProvablyExited(
|
|
137127
|
-
if (
|
|
137994
|
+
async function owningSupervisorProvablyExited(record5, platform) {
|
|
137995
|
+
if (record5.supervisorPid === void 0 || record5.supervisorBirthIdentity === void 0) {
|
|
137128
137996
|
return false;
|
|
137129
137997
|
}
|
|
137130
|
-
const probe = await probeProcess(
|
|
137998
|
+
const probe = await probeProcess(record5.supervisorPid, platform);
|
|
137131
137999
|
if (probe.state === "gone") return true;
|
|
137132
138000
|
if (probe.state === "unknown") return false;
|
|
137133
|
-
return probe.identity !==
|
|
138001
|
+
return probe.identity !== record5.supervisorBirthIdentity;
|
|
137134
138002
|
}
|
|
137135
138003
|
function janitorOutcomeForUnsettled(outcome) {
|
|
137136
138004
|
if (outcome === "escaped") return "escaped";
|
|
@@ -137155,90 +138023,90 @@ function reclaimAbandonedProcesses(args) {
|
|
|
137155
138023
|
const registry3 = await readRegistry();
|
|
137156
138024
|
const results = [];
|
|
137157
138025
|
const survivors = [];
|
|
137158
|
-
for (const
|
|
137159
|
-
if (
|
|
137160
|
-
survivors.push(
|
|
138026
|
+
for (const record5 of registry3.records) {
|
|
138027
|
+
if (record5.supervisorNonce === args.liveNonce) {
|
|
138028
|
+
survivors.push(record5);
|
|
137161
138029
|
results.push({
|
|
137162
|
-
sessionId:
|
|
138030
|
+
sessionId: record5.sessionId,
|
|
137163
138031
|
outcome: "skipped-live-supervisor"
|
|
137164
138032
|
});
|
|
137165
138033
|
continue;
|
|
137166
138034
|
}
|
|
137167
138035
|
if (!supportsOwnershipProof(platform)) {
|
|
137168
|
-
survivors.push(
|
|
138036
|
+
survivors.push(record5);
|
|
137169
138037
|
results.push({
|
|
137170
|
-
sessionId:
|
|
138038
|
+
sessionId: record5.sessionId,
|
|
137171
138039
|
outcome: "skipped-unprovable"
|
|
137172
138040
|
});
|
|
137173
138041
|
continue;
|
|
137174
138042
|
}
|
|
137175
|
-
if (!await owningSupervisorProvablyExited(
|
|
137176
|
-
survivors.push(
|
|
138043
|
+
if (!await owningSupervisorProvablyExited(record5, platform)) {
|
|
138044
|
+
survivors.push(record5);
|
|
137177
138045
|
results.push({
|
|
137178
|
-
sessionId:
|
|
138046
|
+
sessionId: record5.sessionId,
|
|
137179
138047
|
outcome: "skipped-live-supervisor"
|
|
137180
138048
|
});
|
|
137181
138049
|
continue;
|
|
137182
138050
|
}
|
|
137183
|
-
const rootProbe = await probeProcess(
|
|
138051
|
+
const rootProbe = await probeProcess(record5.rootPid, platform);
|
|
137184
138052
|
if (rootProbe.state === "unknown") {
|
|
137185
|
-
survivors.push(
|
|
138053
|
+
survivors.push(record5);
|
|
137186
138054
|
results.push({
|
|
137187
|
-
sessionId:
|
|
138055
|
+
sessionId: record5.sessionId,
|
|
137188
138056
|
outcome: "skipped-unprovable"
|
|
137189
138057
|
});
|
|
137190
138058
|
continue;
|
|
137191
138059
|
}
|
|
137192
138060
|
if (rootProbe.state === "gone") {
|
|
137193
|
-
const group = await probeProcessGroup(
|
|
138061
|
+
const group = await probeProcessGroup(record5.rootPid, platform);
|
|
137194
138062
|
if (group === "live") {
|
|
137195
|
-
survivors.push(
|
|
137196
|
-
results.push({ sessionId:
|
|
138063
|
+
survivors.push(record5);
|
|
138064
|
+
results.push({ sessionId: record5.sessionId, outcome: "escaped" });
|
|
137197
138065
|
logger.warn(
|
|
137198
138066
|
"[local-harness] descendants outlived their root; record kept",
|
|
137199
|
-
{ sessionId:
|
|
138067
|
+
{ sessionId: record5.sessionId }
|
|
137200
138068
|
);
|
|
137201
138069
|
continue;
|
|
137202
138070
|
}
|
|
137203
138071
|
if (group === "unknown") {
|
|
137204
|
-
survivors.push(
|
|
138072
|
+
survivors.push(record5);
|
|
137205
138073
|
results.push({
|
|
137206
|
-
sessionId:
|
|
138074
|
+
sessionId: record5.sessionId,
|
|
137207
138075
|
outcome: "skipped-unprovable"
|
|
137208
138076
|
});
|
|
137209
138077
|
continue;
|
|
137210
138078
|
}
|
|
137211
|
-
await removeSessionState(
|
|
137212
|
-
results.push({ sessionId:
|
|
138079
|
+
await removeSessionState(record5.sessionStateDir);
|
|
138080
|
+
results.push({ sessionId: record5.sessionId, outcome: "already-gone" });
|
|
137213
138081
|
continue;
|
|
137214
138082
|
}
|
|
137215
|
-
if (rootProbe.identity !==
|
|
137216
|
-
survivors.push(
|
|
137217
|
-
results.push({ sessionId:
|
|
138083
|
+
if (rootProbe.identity !== record5.processBirthIdentity) {
|
|
138084
|
+
survivors.push(record5);
|
|
138085
|
+
results.push({ sessionId: record5.sessionId, outcome: "not-owned" });
|
|
137218
138086
|
logger.warn("[local-harness] refusing to reclaim a reused pid", {
|
|
137219
|
-
sessionId:
|
|
138087
|
+
sessionId: record5.sessionId
|
|
137220
138088
|
});
|
|
137221
138089
|
continue;
|
|
137222
138090
|
}
|
|
137223
138091
|
const outcome = await terminateOwnedProcessGroup({
|
|
137224
|
-
pid:
|
|
137225
|
-
birthIdentity:
|
|
138092
|
+
pid: record5.rootPid,
|
|
138093
|
+
birthIdentity: record5.processBirthIdentity,
|
|
137226
138094
|
graceMs: args.graceMs ?? 5e3,
|
|
137227
138095
|
platform
|
|
137228
138096
|
});
|
|
137229
138097
|
if (outcome.outcome === "graceful" || outcome.outcome === "forced") {
|
|
137230
|
-
await removeSessionState(
|
|
137231
|
-
results.push({ sessionId:
|
|
138098
|
+
await removeSessionState(record5.sessionStateDir);
|
|
138099
|
+
results.push({ sessionId: record5.sessionId, outcome: "terminated" });
|
|
137232
138100
|
continue;
|
|
137233
138101
|
}
|
|
137234
138102
|
if (outcome.outcome === "already-gone") {
|
|
137235
|
-
await removeSessionState(
|
|
137236
|
-
results.push({ sessionId:
|
|
138103
|
+
await removeSessionState(record5.sessionStateDir);
|
|
138104
|
+
results.push({ sessionId: record5.sessionId, outcome: "already-gone" });
|
|
137237
138105
|
continue;
|
|
137238
138106
|
}
|
|
137239
|
-
survivors.push(
|
|
138107
|
+
survivors.push(record5);
|
|
137240
138108
|
results.push({
|
|
137241
|
-
sessionId:
|
|
138109
|
+
sessionId: record5.sessionId,
|
|
137242
138110
|
outcome: janitorOutcomeForUnsettled(outcome.outcome)
|
|
137243
138111
|
});
|
|
137244
138112
|
}
|
|
@@ -137569,7 +138437,7 @@ var LocalHarnessSupervisor = class {
|
|
|
137569
138437
|
);
|
|
137570
138438
|
}
|
|
137571
138439
|
if (request3.role === "root") {
|
|
137572
|
-
const
|
|
138440
|
+
const record5 = {
|
|
137573
138441
|
sessionId: request3.sessionId,
|
|
137574
138442
|
supervisorNonce: this.nonce,
|
|
137575
138443
|
supervisorPid: process.pid,
|
|
@@ -137585,7 +138453,7 @@ var LocalHarnessSupervisor = class {
|
|
|
137585
138453
|
sessionStateDir: request3.sessionStateDir
|
|
137586
138454
|
};
|
|
137587
138455
|
try {
|
|
137588
|
-
await recordProcess(
|
|
138456
|
+
await recordProcess(record5);
|
|
137589
138457
|
await updateLifecycleState(request3.sessionId, "running");
|
|
137590
138458
|
} catch (error) {
|
|
137591
138459
|
await abandon();
|
|
@@ -137832,48 +138700,48 @@ var LocalHarnessSupervisor = class {
|
|
|
137832
138700
|
// server/utils/harness/local/session-registry.ts
|
|
137833
138701
|
var sessions2 = /* @__PURE__ */ new Map();
|
|
137834
138702
|
var unstopped = /* @__PURE__ */ new Set();
|
|
137835
|
-
function registerLocalHarnessSession(
|
|
137836
|
-
sessions2.set(
|
|
138703
|
+
function registerLocalHarnessSession(record5) {
|
|
138704
|
+
sessions2.set(record5.sessionId, record5);
|
|
137837
138705
|
}
|
|
137838
138706
|
function forgetLocalHarnessSession(sessionId) {
|
|
137839
138707
|
sessions2.delete(sessionId);
|
|
137840
138708
|
}
|
|
137841
|
-
function forgetLocalHarnessSessionRecord(
|
|
137842
|
-
unstopped.delete(
|
|
137843
|
-
if (sessions2.get(
|
|
137844
|
-
sessions2.delete(
|
|
138709
|
+
function forgetLocalHarnessSessionRecord(record5) {
|
|
138710
|
+
unstopped.delete(record5);
|
|
138711
|
+
if (sessions2.get(record5.sessionId) !== record5) return false;
|
|
138712
|
+
sessions2.delete(record5.sessionId);
|
|
137845
138713
|
return true;
|
|
137846
138714
|
}
|
|
137847
|
-
function claimRecord(
|
|
137848
|
-
const claimed = sessions2.get(
|
|
138715
|
+
function claimRecord(record5) {
|
|
138716
|
+
const claimed = sessions2.get(record5.sessionId) === record5 || unstopped.has(record5);
|
|
137849
138717
|
if (!claimed) return false;
|
|
137850
|
-
if (sessions2.get(
|
|
137851
|
-
sessions2.delete(
|
|
138718
|
+
if (sessions2.get(record5.sessionId) === record5) {
|
|
138719
|
+
sessions2.delete(record5.sessionId);
|
|
137852
138720
|
}
|
|
137853
|
-
unstopped.delete(
|
|
138721
|
+
unstopped.delete(record5);
|
|
137854
138722
|
return true;
|
|
137855
138723
|
}
|
|
137856
|
-
async function endRecord(
|
|
137857
|
-
const sessionId =
|
|
138724
|
+
async function endRecord(record5) {
|
|
138725
|
+
const sessionId = record5.sessionId;
|
|
137858
138726
|
const errors = [];
|
|
137859
138727
|
try {
|
|
137860
|
-
|
|
138728
|
+
record5.gateway?.revoke();
|
|
137861
138729
|
} catch (error) {
|
|
137862
138730
|
errors.push(`gateway revoke: ${messageOf(error)}`);
|
|
137863
138731
|
}
|
|
137864
138732
|
try {
|
|
137865
|
-
await
|
|
138733
|
+
await record5.gateway?.close();
|
|
137866
138734
|
} catch (error) {
|
|
137867
138735
|
errors.push(`gateway close: ${messageOf(error)}`);
|
|
137868
138736
|
}
|
|
137869
138737
|
try {
|
|
137870
|
-
await
|
|
138738
|
+
await record5.revokeLease?.();
|
|
137871
138739
|
} catch (error) {
|
|
137872
138740
|
errors.push(`lease revoke: ${messageOf(error)}`);
|
|
137873
138741
|
}
|
|
137874
138742
|
let stopped = true;
|
|
137875
138743
|
try {
|
|
137876
|
-
const outcome = await
|
|
138744
|
+
const outcome = await record5.stop();
|
|
137877
138745
|
if (outcome?.stopped !== true) {
|
|
137878
138746
|
stopped = false;
|
|
137879
138747
|
errors.push(
|
|
@@ -137885,15 +138753,15 @@ async function endRecord(record4) {
|
|
|
137885
138753
|
errors.push(`stop: ${messageOf(error)}`);
|
|
137886
138754
|
}
|
|
137887
138755
|
if (stopped) {
|
|
137888
|
-
unstopped.delete(
|
|
138756
|
+
unstopped.delete(record5);
|
|
137889
138757
|
try {
|
|
137890
|
-
await
|
|
138758
|
+
await record5.releaseRuntime?.();
|
|
137891
138759
|
} catch (error) {
|
|
137892
138760
|
errors.push(`runtime release: ${messageOf(error)}`);
|
|
137893
138761
|
}
|
|
137894
138762
|
} else {
|
|
137895
|
-
unstopped.add(
|
|
137896
|
-
if (!sessions2.has(sessionId)) sessions2.set(sessionId,
|
|
138763
|
+
unstopped.add(record5);
|
|
138764
|
+
if (!sessions2.has(sessionId)) sessions2.set(sessionId, record5);
|
|
137897
138765
|
}
|
|
137898
138766
|
if (errors.length > 0) {
|
|
137899
138767
|
logger.warn("[local-harness] session teardown had failures", {
|
|
@@ -137908,7 +138776,7 @@ async function stopAllLocalHarnessSessions() {
|
|
|
137908
138776
|
const mine = candidates.filter(claimRecord);
|
|
137909
138777
|
const results = await Promise.all(
|
|
137910
138778
|
mine.map(
|
|
137911
|
-
(
|
|
138779
|
+
(record5) => endRecord(record5).catch(() => ({
|
|
137912
138780
|
stopped: false,
|
|
137913
138781
|
errors: ["unexpected"]
|
|
137914
138782
|
}))
|
|
@@ -140193,12 +141061,12 @@ async function fetchHarnessProxyTokens(args) {
|
|
|
140193
141061
|
}
|
|
140194
141062
|
function readHarnessEvidenceDecision(raw) {
|
|
140195
141063
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
140196
|
-
const
|
|
140197
|
-
if (typeof
|
|
140198
|
-
const gradingSource =
|
|
141064
|
+
const record5 = raw;
|
|
141065
|
+
if (typeof record5.captureEnabled !== "boolean") return void 0;
|
|
141066
|
+
const gradingSource = record5.gradingSource === "evidence" ? "evidence" : "narration";
|
|
140199
141067
|
return {
|
|
140200
|
-
captureEnabled:
|
|
140201
|
-
gradingSource:
|
|
141068
|
+
captureEnabled: record5.captureEnabled,
|
|
141069
|
+
gradingSource: record5.captureEnabled ? gradingSource : "narration"
|
|
140202
141070
|
};
|
|
140203
141071
|
}
|
|
140204
141072
|
|
|
@@ -140351,8 +141219,8 @@ function stableHarnessValue(value) {
|
|
|
140351
141219
|
if (Array.isArray(value)) {
|
|
140352
141220
|
return `[${value.map(stableHarnessValue).join(",")}]`;
|
|
140353
141221
|
}
|
|
140354
|
-
const
|
|
140355
|
-
return `{${Object.keys(
|
|
141222
|
+
const record5 = value;
|
|
141223
|
+
return `{${Object.keys(record5).sort().map((key) => `${JSON.stringify(key)}:${stableHarnessValue(record5[key])}`).join(",")}}`;
|
|
140356
141224
|
}
|
|
140357
141225
|
function matchHarnessScopeStepUpToolCall(args) {
|
|
140358
141226
|
const { observed, challenge } = args;
|
|
@@ -145595,11 +146463,11 @@ function unwrapJsonEnvelope(value) {
|
|
|
145595
146463
|
if (!current || typeof current !== "object" || Array.isArray(current)) {
|
|
145596
146464
|
return current;
|
|
145597
146465
|
}
|
|
145598
|
-
const
|
|
145599
|
-
if (
|
|
146466
|
+
const record5 = current;
|
|
146467
|
+
if (record5.type !== "json" || !("value" in record5)) {
|
|
145600
146468
|
return current;
|
|
145601
146469
|
}
|
|
145602
|
-
current =
|
|
146470
|
+
current = record5.value;
|
|
145603
146471
|
}
|
|
145604
146472
|
return current;
|
|
145605
146473
|
}
|
|
@@ -145608,11 +146476,11 @@ function isModelVisibleImageOutput(value) {
|
|
|
145608
146476
|
if (!output || typeof output !== "object" || Array.isArray(output)) {
|
|
145609
146477
|
return false;
|
|
145610
146478
|
}
|
|
145611
|
-
const
|
|
145612
|
-
if (
|
|
146479
|
+
const record5 = output;
|
|
146480
|
+
if (record5.type !== "content" || !Array.isArray(record5.value)) {
|
|
145613
146481
|
return false;
|
|
145614
146482
|
}
|
|
145615
|
-
return
|
|
146483
|
+
return record5.value.some((part) => {
|
|
145616
146484
|
if (!part || typeof part !== "object" || Array.isArray(part)) {
|
|
145617
146485
|
return false;
|
|
145618
146486
|
}
|
|
@@ -146707,6 +147575,10 @@ async function processOneStep(ctx) {
|
|
|
146707
147575
|
}
|
|
146708
147576
|
}
|
|
146709
147577
|
Object.assign(convexHeaders2, guestIpForwardHeaders(ipHash));
|
|
147578
|
+
const scenarioServiceToken = process.env.INSPECTOR_SERVICE_TOKEN?.trim();
|
|
147579
|
+
if (scenarioId && scenarioServiceToken) {
|
|
147580
|
+
convexHeaders2["x-inspector-service-token"] = scenarioServiceToken;
|
|
147581
|
+
}
|
|
146710
147582
|
let res;
|
|
146711
147583
|
onModelHandover?.();
|
|
146712
147584
|
try {
|
|
@@ -148402,23 +149274,23 @@ function stampMcpToolOriginProviderOptions(messages, tools5) {
|
|
|
148402
149274
|
if (!part || typeof part !== "object" || Array.isArray(part)) {
|
|
148403
149275
|
return part;
|
|
148404
149276
|
}
|
|
148405
|
-
const
|
|
148406
|
-
if (
|
|
149277
|
+
const record5 = part;
|
|
149278
|
+
if (record5.type !== "tool-call" && record5.type !== "tool-result") {
|
|
148407
149279
|
return part;
|
|
148408
149280
|
}
|
|
148409
|
-
const toolName3 =
|
|
149281
|
+
const toolName3 = record5.toolName;
|
|
148410
149282
|
if (typeof toolName3 !== "string") return part;
|
|
148411
149283
|
const serverId = readToolServerId(tools5, toolName3);
|
|
148412
149284
|
const providerOptions = mergePageToolBindingMetadata(
|
|
148413
149285
|
withPageToolAttributionMetadata(
|
|
148414
|
-
mergeMcpToolOriginMetadata(
|
|
149286
|
+
mergeMcpToolOriginMetadata(record5.providerOptions, serverId),
|
|
148415
149287
|
tools5[toolName3]
|
|
148416
149288
|
),
|
|
148417
|
-
|
|
149289
|
+
record5.type === "tool-call" ? pageToolBindingOf(tools5[toolName3]) : void 0
|
|
148418
149290
|
);
|
|
148419
149291
|
if (!providerOptions) return part;
|
|
148420
149292
|
messageChanged = true;
|
|
148421
|
-
return { ...
|
|
149293
|
+
return { ...record5, providerOptions };
|
|
148422
149294
|
}
|
|
148423
149295
|
);
|
|
148424
149296
|
if (!messageChanged) return message;
|
|
@@ -152397,8 +153269,37 @@ var PlatformApiError = class extends SdkError3 {
|
|
|
152397
153269
|
function isPlatformApiError(error) {
|
|
152398
153270
|
return error instanceof PlatformApiError;
|
|
152399
153271
|
}
|
|
153272
|
+
var REFUSAL_REASON_PATTERN = /^[a-z0-9_]{1,64}$/;
|
|
153273
|
+
function describePlatformRefusal(error) {
|
|
153274
|
+
if (!isPlatformApiError(error)) return void 0;
|
|
153275
|
+
if (error.status !== 429 && error.code !== "RATE_LIMITED") return void 0;
|
|
153276
|
+
const details = error.details ?? {};
|
|
153277
|
+
const text2 = (key) => {
|
|
153278
|
+
const value = details[key];
|
|
153279
|
+
return typeof value === "string" && REFUSAL_REASON_PATTERN.test(value) ? value : void 0;
|
|
153280
|
+
};
|
|
153281
|
+
const flag = (key) => typeof details[key] === "boolean" ? details[key] : void 0;
|
|
153282
|
+
const retryAfterMs = details.retryAfterMs;
|
|
153283
|
+
const retryAfterSeconds = error.retryAfter !== void 0 ? error.retryAfter : typeof retryAfterMs === "number" && Number.isFinite(retryAfterMs) && retryAfterMs >= 0 ? Math.ceil(retryAfterMs / 1e3) : void 0;
|
|
153284
|
+
const refusal = { status: error.status, code: error.code };
|
|
153285
|
+
const reason = text2("code");
|
|
153286
|
+
if (reason) refusal.reason = reason;
|
|
153287
|
+
const gatedBy = text2("gatedBy");
|
|
153288
|
+
if (gatedBy) refusal.gatedBy = gatedBy;
|
|
153289
|
+
const canTopUp = flag("canTopUp");
|
|
153290
|
+
if (canTopUp !== void 0) refusal.canTopUp = canTopUp;
|
|
153291
|
+
const retryable = flag("isRetryable");
|
|
153292
|
+
if (retryable !== void 0) refusal.retryable = retryable;
|
|
153293
|
+
if (retryAfterSeconds !== void 0)
|
|
153294
|
+
refusal.retryAfterSeconds = retryAfterSeconds;
|
|
153295
|
+
return refusal;
|
|
153296
|
+
}
|
|
153297
|
+
function platformRefusalHint(refusal) {
|
|
153298
|
+
const when = refusal.retryAfterSeconds !== void 0 ? `Retry after ${refusal.retryAfterSeconds}s, not sooner.` : "Wait before retrying; do not retry in a loop.";
|
|
153299
|
+
return refusal.canTopUp === false ? `${when} This is a usage limit: topping up credits does not lift it.` : when;
|
|
153300
|
+
}
|
|
152400
153301
|
function readSdkVersion3() {
|
|
152401
|
-
return "8.
|
|
153302
|
+
return "8.10.0";
|
|
152402
153303
|
}
|
|
152403
153304
|
var DEFAULT_PLATFORM_API_BASE_URL = "https://app.mcpjam.com/api/v1";
|
|
152404
153305
|
function resolvePlatformRequestUrl(spec) {
|
|
@@ -157633,8 +158534,8 @@ var EVAL_VERDICT_DECISION_REASONS3 = [
|
|
|
157633
158534
|
...EVAL_VALIDITY_DECISION_REASONS3,
|
|
157634
158535
|
...EVAL_TASK_DECISION_REASONS3
|
|
157635
158536
|
];
|
|
157636
|
-
var evalVerdictDecisionReasonSchema3 = z24.enum(
|
|
157637
|
-
|
|
158537
|
+
var evalVerdictDecisionReasonSchema3 = z24.enum(EVAL_VERDICT_DECISION_REASONS3).describe(
|
|
158538
|
+
"Why the verdict is what it is. The validity reasons are evaluated FIRST and make a run `inconclusive`; the task reasons decide `passed` / `failed` once validity holds. `configuredTrialsNotAttempted` \u2014 some configured trial never ran. `noGradeableTrials` \u2014 nothing in the suite was gradeable. `eligibleTrialsBelowMinimum` \u2014 the explicit `minEligibleTrials` was not reached. `completionRateBelowMinimum` \u2014 measured, and under the floor. `completionRateNotMeasured` \u2014 nothing was attempted, so the floor is unsatisfiable; a not-measured rate never passes one. `evaluatorErrorRateAboveMaximum` \u2014 the grader failed too often for the run to describe the server. `evaluatorErrorRateNotMeasured` \u2014 the same unsatisfiable case for the ceiling. `caseHasNoEligibleTrials` \u2014 a case graded nothing, which is inconclusive even at `passThreshold: 0`. `casePassRateMetThreshold` \u2014 a case's own passing reason. `casePassRateBelowThreshold` \u2014 a case failed its threshold, and so therefore did the suite. `allMeasuredCasesMetThreshold` \u2014 the suite's only passing reason."
|
|
157638
158539
|
);
|
|
157639
158540
|
function isEvalValidityDecisionReason3(value) {
|
|
157640
158541
|
return typeof value === "string" && EVAL_VALIDITY_DECISION_REASONS3.includes(value);
|
|
@@ -159241,10 +160142,10 @@ function assembleEvalRunDecisionSummary2(input) {
|
|
|
159241
160142
|
}
|
|
159242
160143
|
function legacyTrialCounts2(summary) {
|
|
159243
160144
|
if (!summary || typeof summary !== "object") return void 0;
|
|
159244
|
-
const
|
|
159245
|
-
const total =
|
|
159246
|
-
const passed2 =
|
|
159247
|
-
const failed3 =
|
|
160145
|
+
const count22 = (value) => typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : void 0;
|
|
160146
|
+
const total = count22(summary.total);
|
|
160147
|
+
const passed2 = count22(summary.passed);
|
|
160148
|
+
const failed3 = count22(summary.failed);
|
|
159248
160149
|
if (total === void 0 && passed2 === void 0 && failed3 === void 0) {
|
|
159249
160150
|
return void 0;
|
|
159250
160151
|
}
|
|
@@ -159370,8 +160271,8 @@ function nonEmptyString2(value) {
|
|
|
159370
160271
|
}
|
|
159371
160272
|
function toolName2(value) {
|
|
159372
160273
|
if (!value || typeof value !== "object") return void 0;
|
|
159373
|
-
const
|
|
159374
|
-
return nonEmptyString2(
|
|
160274
|
+
const record5 = value;
|
|
160275
|
+
return nonEmptyString2(record5.toolName) ?? nonEmptyString2(record5.tool) ?? nonEmptyString2(record5.name);
|
|
159375
160276
|
}
|
|
159376
160277
|
function toolNames2(calls) {
|
|
159377
160278
|
const names = (calls ?? []).map(toolName2).filter((name15) => name15 !== void 0);
|
|
@@ -160503,6 +161404,416 @@ var evalBacktestContinuationSchema3 = z24.object({
|
|
|
160503
161404
|
evalBacktestDraftSchema3.extend({
|
|
160504
161405
|
continuation: evalBacktestContinuationSchema3.optional()
|
|
160505
161406
|
});
|
|
161407
|
+
var SWARM_SESSION_VERDICT_CONTRACT_VERSION3 = 1;
|
|
161408
|
+
var SWARM_ATTEMPT_STATUSES3 = [
|
|
161409
|
+
"pending",
|
|
161410
|
+
"running",
|
|
161411
|
+
"succeeded",
|
|
161412
|
+
"failed",
|
|
161413
|
+
"rate_limited"
|
|
161414
|
+
];
|
|
161415
|
+
var SWARM_SESSION_LIFECYCLES3 = [
|
|
161416
|
+
"pending",
|
|
161417
|
+
"running",
|
|
161418
|
+
"ran",
|
|
161419
|
+
"broke",
|
|
161420
|
+
"limited",
|
|
161421
|
+
"withdrawn"
|
|
161422
|
+
];
|
|
161423
|
+
var SWARM_SESSION_VERDICTS3 = [
|
|
161424
|
+
"passed",
|
|
161425
|
+
"failed",
|
|
161426
|
+
"inconclusive",
|
|
161427
|
+
"notEstablished"
|
|
161428
|
+
];
|
|
161429
|
+
var SWARM_GRADING_STATES3 = [
|
|
161430
|
+
"notRequested",
|
|
161431
|
+
"queued",
|
|
161432
|
+
"running",
|
|
161433
|
+
"settled",
|
|
161434
|
+
"unavailable"
|
|
161435
|
+
];
|
|
161436
|
+
var SWARM_SESSION_VERDICT_OF_REASON3 = {
|
|
161437
|
+
attemptPending: "notEstablished",
|
|
161438
|
+
attemptRunning: "notEstablished",
|
|
161439
|
+
withdrawn: "notEstablished",
|
|
161440
|
+
spendCapReached: "notEstablished",
|
|
161441
|
+
notRun: "notEstablished",
|
|
161442
|
+
executionFailed: "notEstablished",
|
|
161443
|
+
ungraded: "notEstablished",
|
|
161444
|
+
gradingNotClaimed: "notEstablished",
|
|
161445
|
+
criteriaPending: "notEstablished",
|
|
161446
|
+
judgePending: "notEstablished",
|
|
161447
|
+
gatingCriterionFailed: "failed",
|
|
161448
|
+
judgeFailed: "failed",
|
|
161449
|
+
criteriaGradingErrored: "inconclusive",
|
|
161450
|
+
gatingCriterionUnmeasured: "inconclusive",
|
|
161451
|
+
judgeErrored: "inconclusive",
|
|
161452
|
+
gradingUnavailable: "inconclusive",
|
|
161453
|
+
allGatingCriteriaPassed: "passed",
|
|
161454
|
+
judgePassed: "passed",
|
|
161455
|
+
allGradersPassed: "passed"
|
|
161456
|
+
};
|
|
161457
|
+
var SWARM_SESSION_VERDICT_REASONS3 = Object.keys(
|
|
161458
|
+
SWARM_SESSION_VERDICT_OF_REASON3
|
|
161459
|
+
);
|
|
161460
|
+
var swarmSessionLifecycleSchema3 = z24.enum(SWARM_SESSION_LIFECYCLES3);
|
|
161461
|
+
var swarmSessionVerdictValueSchema3 = z24.enum(SWARM_SESSION_VERDICTS3);
|
|
161462
|
+
var swarmGraderRoleSchema3 = z24.enum(["advisory", "required"]);
|
|
161463
|
+
var swarmSessionAttemptInputSchema3 = z24.object({
|
|
161464
|
+
status: z24.enum(SWARM_ATTEMPT_STATUSES3),
|
|
161465
|
+
errorCode: z24.string().nullable().optional()
|
|
161466
|
+
}).strict();
|
|
161467
|
+
var swarmGradingReadinessSchema3 = z24.object({
|
|
161468
|
+
/** Durable readiness for decisive grading only, not background observations. */
|
|
161469
|
+
state: z24.enum(SWARM_GRADING_STATES3),
|
|
161470
|
+
reasonCode: z24.string().min(1).optional()
|
|
161471
|
+
}).strict();
|
|
161472
|
+
var criterionResultSchema3 = z24.object({
|
|
161473
|
+
criterionId: z24.string().min(1),
|
|
161474
|
+
passed: z24.boolean(),
|
|
161475
|
+
status: z24.enum(["scored", "error"]).optional()
|
|
161476
|
+
}).strict();
|
|
161477
|
+
z24.object({
|
|
161478
|
+
attempt: swarmSessionAttemptInputSchema3.nullable(),
|
|
161479
|
+
hasTranscript: z24.boolean(),
|
|
161480
|
+
rubric: z24.array(
|
|
161481
|
+
z24.object({
|
|
161482
|
+
id: z24.string().min(1),
|
|
161483
|
+
role: swarmGraderRoleSchema3,
|
|
161484
|
+
predicateType: z24.string().min(1).optional()
|
|
161485
|
+
}).strict()
|
|
161486
|
+
),
|
|
161487
|
+
criteria: z24.object({
|
|
161488
|
+
status: z24.enum(["pending", "completed", "failed"]),
|
|
161489
|
+
criterionIds: z24.array(z24.string().min(1)).optional(),
|
|
161490
|
+
results: z24.array(criterionResultSchema3).optional()
|
|
161491
|
+
}).strict().nullable(),
|
|
161492
|
+
goalScore: z24.discriminatedUnion("status", [
|
|
161493
|
+
z24.object({ status: z24.literal("completed"), passed: z24.boolean() }).strict(),
|
|
161494
|
+
z24.object({ status: z24.literal("running") }).strict(),
|
|
161495
|
+
z24.object({ status: z24.literal("failed") }).strict()
|
|
161496
|
+
]).nullable(),
|
|
161497
|
+
judge: z24.object({
|
|
161498
|
+
automatic: z24.boolean(),
|
|
161499
|
+
role: swarmGraderRoleSchema3,
|
|
161500
|
+
/** Explicit on-demand intent; automatic:false alone does not mean a judge was requested. */
|
|
161501
|
+
requested: z24.boolean().optional()
|
|
161502
|
+
}).strict(),
|
|
161503
|
+
grading: swarmGradingReadinessSchema3
|
|
161504
|
+
}).strict().superRefine((value, ctx) => {
|
|
161505
|
+
const definitions = new Set(value.rubric.map((entry3) => entry3.id));
|
|
161506
|
+
if (definitions.size !== value.rubric.length) {
|
|
161507
|
+
ctx.addIssue({
|
|
161508
|
+
code: "custom",
|
|
161509
|
+
path: ["rubric"],
|
|
161510
|
+
message: "Duplicate criterion definition"
|
|
161511
|
+
});
|
|
161512
|
+
}
|
|
161513
|
+
for (const [field, ids] of [
|
|
161514
|
+
["criterionIds", value.criteria?.criterionIds ?? []],
|
|
161515
|
+
["results", value.criteria?.results?.map((row2) => row2.criterionId) ?? []]
|
|
161516
|
+
]) {
|
|
161517
|
+
if (new Set(ids).size !== ids.length || ids.some((id3) => !definitions.has(id3))) {
|
|
161518
|
+
ctx.addIssue({
|
|
161519
|
+
code: "custom",
|
|
161520
|
+
path: ["criteria", field],
|
|
161521
|
+
message: "Criterion IDs must be unique and defined in the snapshot"
|
|
161522
|
+
});
|
|
161523
|
+
}
|
|
161524
|
+
}
|
|
161525
|
+
const claimed = value.criteria?.criterionIds;
|
|
161526
|
+
if (claimed && value.criteria?.results?.some((row2) => !claimed.includes(row2.criterionId))) {
|
|
161527
|
+
ctx.addIssue({
|
|
161528
|
+
code: "custom",
|
|
161529
|
+
path: ["criteria", "results"],
|
|
161530
|
+
message: "Result outside claimed scope"
|
|
161531
|
+
});
|
|
161532
|
+
}
|
|
161533
|
+
});
|
|
161534
|
+
var SWARM_SESSION_TRIAL_STATUSES3 = [
|
|
161535
|
+
"pending",
|
|
161536
|
+
"running",
|
|
161537
|
+
"completed",
|
|
161538
|
+
"failed",
|
|
161539
|
+
"setup_failed",
|
|
161540
|
+
"cancelled"
|
|
161541
|
+
];
|
|
161542
|
+
var swarmSessionTrialSchema3 = z24.object({
|
|
161543
|
+
status: z24.enum(SWARM_SESSION_TRIAL_STATUSES3),
|
|
161544
|
+
taskVerdict: z24.enum(["passed", "failed"]).optional(),
|
|
161545
|
+
evaluatorError: z24.literal(true).optional()
|
|
161546
|
+
}).strict().superRefine((value, ctx) => {
|
|
161547
|
+
const verdict = value.taskVerdict !== void 0;
|
|
161548
|
+
const error = value.evaluatorError === true;
|
|
161549
|
+
if (value.status === "completed" ? verdict === error : verdict || error) {
|
|
161550
|
+
ctx.addIssue({
|
|
161551
|
+
code: "custom",
|
|
161552
|
+
message: "Only completed trials carry exactly one verdict or evaluator error"
|
|
161553
|
+
});
|
|
161554
|
+
}
|
|
161555
|
+
});
|
|
161556
|
+
var swarmSessionGraderCountsSchema3 = z24.object({
|
|
161557
|
+
gating: z24.number().int().nonnegative(),
|
|
161558
|
+
gatingPassed: z24.number().int().nonnegative(),
|
|
161559
|
+
gatingFailed: z24.number().int().nonnegative(),
|
|
161560
|
+
gatingUnmeasured: z24.number().int().nonnegative(),
|
|
161561
|
+
advisoryFailed: z24.number().int().nonnegative()
|
|
161562
|
+
}).strict();
|
|
161563
|
+
var swarmSessionVerdictSchema3 = z24.object({
|
|
161564
|
+
contractVersion: z24.literal(SWARM_SESSION_VERDICT_CONTRACT_VERSION3),
|
|
161565
|
+
lifecycle: swarmSessionLifecycleSchema3,
|
|
161566
|
+
verdict: swarmSessionVerdictValueSchema3,
|
|
161567
|
+
reason: z24.enum(SWARM_SESSION_VERDICT_REASONS3),
|
|
161568
|
+
verdictSource: z24.enum([
|
|
161569
|
+
"goalJudge",
|
|
161570
|
+
"requiredAssertions",
|
|
161571
|
+
"combined",
|
|
161572
|
+
"none"
|
|
161573
|
+
]),
|
|
161574
|
+
grading: swarmGradingReadinessSchema3,
|
|
161575
|
+
graders: z24.object({
|
|
161576
|
+
criteria: z24.enum([
|
|
161577
|
+
"notConfigured",
|
|
161578
|
+
"notClaimed",
|
|
161579
|
+
"pending",
|
|
161580
|
+
"scored",
|
|
161581
|
+
"errored"
|
|
161582
|
+
]),
|
|
161583
|
+
judge: z24.enum([
|
|
161584
|
+
"notConfigured",
|
|
161585
|
+
"silent",
|
|
161586
|
+
"pending",
|
|
161587
|
+
"scored",
|
|
161588
|
+
"errored"
|
|
161589
|
+
])
|
|
161590
|
+
}).strict(),
|
|
161591
|
+
counts: swarmSessionGraderCountsSchema3,
|
|
161592
|
+
trial: swarmSessionTrialSchema3.nullable()
|
|
161593
|
+
}).strict().superRefine((value, ctx) => {
|
|
161594
|
+
const fail3 = (message) => ctx.addIssue({ code: "custom", message });
|
|
161595
|
+
if (SWARM_SESSION_VERDICT_OF_REASON3[value.reason] !== value.verdict)
|
|
161596
|
+
fail3("Reason contradicts verdict");
|
|
161597
|
+
const c = value.counts;
|
|
161598
|
+
if (c.gating !== c.gatingPassed + c.gatingFailed + c.gatingUnmeasured)
|
|
161599
|
+
fail3("Required measurement counts do not add up");
|
|
161600
|
+
const trial = value.trial;
|
|
161601
|
+
if (trial?.status === "completed") {
|
|
161602
|
+
if (value.lifecycle !== "ran")
|
|
161603
|
+
fail3("Only a completed execution can be a completed trial");
|
|
161604
|
+
if (trial.taskVerdict !== void 0 && trial.taskVerdict !== value.verdict)
|
|
161605
|
+
fail3("Trial contradicts goal result");
|
|
161606
|
+
if (trial.evaluatorError && value.verdict !== "inconclusive")
|
|
161607
|
+
fail3("Evaluator error requires inconclusive grading");
|
|
161608
|
+
}
|
|
161609
|
+
const expected = {
|
|
161610
|
+
pending: "pending",
|
|
161611
|
+
running: "running",
|
|
161612
|
+
broke: "failed",
|
|
161613
|
+
limited: "setup_failed",
|
|
161614
|
+
withdrawn: "cancelled"
|
|
161615
|
+
};
|
|
161616
|
+
if (value.lifecycle !== "ran" && trial?.status !== expected[value.lifecycle])
|
|
161617
|
+
fail3("Trial must preserve execution lifecycle");
|
|
161618
|
+
if (value.lifecycle === "ran" && trial !== null && trial.status !== "completed")
|
|
161619
|
+
fail3("Completed execution must not become skipped or running");
|
|
161620
|
+
if ((value.verdict === "passed" || value.verdict === "failed") && value.verdictSource === "none")
|
|
161621
|
+
fail3("A measured goal verdict needs a source");
|
|
161622
|
+
if (value.lifecycle === "ran" && value.verdict !== "notEstablished" && trial === null)
|
|
161623
|
+
fail3("Settled grading on completed execution needs an observation");
|
|
161624
|
+
if (value.verdict === "notEstablished" && value.verdictSource !== "none")
|
|
161625
|
+
fail3("An undecided goal has no verdict source");
|
|
161626
|
+
});
|
|
161627
|
+
var SWARM_REPORT_CONTRACT_VERSION3 = 1;
|
|
161628
|
+
var count3 = z24.number().int().nonnegative();
|
|
161629
|
+
var journeyRunVerdictSummarySchema3 = z24.discriminatedUnion("status", [
|
|
161630
|
+
z24.object({
|
|
161631
|
+
status: z24.literal("pending"),
|
|
161632
|
+
pendingSessions: count3,
|
|
161633
|
+
updatedAt: count3
|
|
161634
|
+
}).strict(),
|
|
161635
|
+
z24.object({
|
|
161636
|
+
status: z24.literal("decided"),
|
|
161637
|
+
decision: evalVerdictDecisionSchema3,
|
|
161638
|
+
updatedAt: count3
|
|
161639
|
+
}).strict(),
|
|
161640
|
+
z24.object({
|
|
161641
|
+
status: z24.literal("notEstablished"),
|
|
161642
|
+
reason: z24.literal("gradingNotConfigured"),
|
|
161643
|
+
updatedAt: count3
|
|
161644
|
+
}).strict(),
|
|
161645
|
+
z24.object({
|
|
161646
|
+
status: z24.literal("integrityFailed"),
|
|
161647
|
+
reason: z24.string().min(1),
|
|
161648
|
+
updatedAt: count3
|
|
161649
|
+
}).strict()
|
|
161650
|
+
]);
|
|
161651
|
+
var swarmObservationInputSchema3 = z24.object({
|
|
161652
|
+
evaluatorId: z24.string().min(1),
|
|
161653
|
+
predicateType: z24.enum(
|
|
161654
|
+
Object.keys(ASSERTION_STAGE3)
|
|
161655
|
+
),
|
|
161656
|
+
role: z24.enum(["advisory", "required"]),
|
|
161657
|
+
/** Missing capture/error is unavailable; it must not use the compatibility passed:false. */
|
|
161658
|
+
status: z24.enum(["passed", "failed", "pending", "unavailable"])
|
|
161659
|
+
}).strict();
|
|
161660
|
+
var swarmReportSessionSchema3 = z24.object({
|
|
161661
|
+
/** Stable attempt/slot identity, including slots with no session document. */
|
|
161662
|
+
id: z24.string().min(1),
|
|
161663
|
+
/** A producer fact. Grade coverage and lifecycle alone cannot establish a non-start. */
|
|
161664
|
+
startEvidence: z24.enum(["started", "notStarted", "unknown"]),
|
|
161665
|
+
verdict: swarmSessionVerdictSchema3,
|
|
161666
|
+
observations: z24.array(swarmObservationInputSchema3)
|
|
161667
|
+
}).strict().superRefine((row2, ctx) => {
|
|
161668
|
+
if (new Set(row2.observations.map((o) => o.evaluatorId)).size !== row2.observations.length) {
|
|
161669
|
+
ctx.addIssue({
|
|
161670
|
+
code: "custom",
|
|
161671
|
+
path: ["observations"],
|
|
161672
|
+
message: "Duplicate evaluator in one session"
|
|
161673
|
+
});
|
|
161674
|
+
}
|
|
161675
|
+
if (row2.startEvidence === "notStarted" && ["running", "ran"].includes(row2.verdict.lifecycle)) {
|
|
161676
|
+
ctx.addIssue({
|
|
161677
|
+
code: "custom",
|
|
161678
|
+
path: ["startEvidence"],
|
|
161679
|
+
message: "Execution contradicts explicit non-start"
|
|
161680
|
+
});
|
|
161681
|
+
}
|
|
161682
|
+
});
|
|
161683
|
+
z24.object({
|
|
161684
|
+
runId: z24.string().min(1),
|
|
161685
|
+
executionComplete: z24.boolean(),
|
|
161686
|
+
configuredSessions: count3,
|
|
161687
|
+
verdictSummary: journeyRunVerdictSummarySchema3.nullable(),
|
|
161688
|
+
/** Frozen run-wide definitions: absent measurement rows still count as unavailable. */
|
|
161689
|
+
evaluatorDefinitions: z24.array(
|
|
161690
|
+
swarmObservationInputSchema3.omit({ status: true })
|
|
161691
|
+
),
|
|
161692
|
+
sessions: z24.array(swarmReportSessionSchema3)
|
|
161693
|
+
}).strict().superRefine((input, ctx) => {
|
|
161694
|
+
if (input.sessions.length > input.configuredSessions) {
|
|
161695
|
+
ctx.addIssue({
|
|
161696
|
+
code: "custom",
|
|
161697
|
+
path: ["sessions"],
|
|
161698
|
+
message: "Reported sessions exceed configured population"
|
|
161699
|
+
});
|
|
161700
|
+
}
|
|
161701
|
+
if (new Set(input.sessions.map((row2) => row2.id)).size !== input.sessions.length) {
|
|
161702
|
+
ctx.addIssue({
|
|
161703
|
+
code: "custom",
|
|
161704
|
+
path: ["sessions"],
|
|
161705
|
+
message: "Duplicate session/attempt identity"
|
|
161706
|
+
});
|
|
161707
|
+
}
|
|
161708
|
+
const definitions = new Map(
|
|
161709
|
+
input.evaluatorDefinitions.map((row2) => [row2.evaluatorId, row2])
|
|
161710
|
+
);
|
|
161711
|
+
if (definitions.size !== input.evaluatorDefinitions.length) {
|
|
161712
|
+
ctx.addIssue({
|
|
161713
|
+
code: "custom",
|
|
161714
|
+
path: ["evaluatorDefinitions"],
|
|
161715
|
+
message: "Duplicate evaluator definition"
|
|
161716
|
+
});
|
|
161717
|
+
}
|
|
161718
|
+
for (const session of input.sessions) {
|
|
161719
|
+
for (const observation of session.observations) {
|
|
161720
|
+
const definition = definitions.get(observation.evaluatorId);
|
|
161721
|
+
if (!definition || definition.role !== observation.role || definition.predicateType !== observation.predicateType) {
|
|
161722
|
+
ctx.addIssue({
|
|
161723
|
+
code: "custom",
|
|
161724
|
+
path: ["sessions"],
|
|
161725
|
+
message: "Observation contradicts the frozen evaluator definition"
|
|
161726
|
+
});
|
|
161727
|
+
}
|
|
161728
|
+
}
|
|
161729
|
+
}
|
|
161730
|
+
});
|
|
161731
|
+
var swarmObservationCoverageSchema3 = z24.object({
|
|
161732
|
+
evaluatorId: z24.string().min(1),
|
|
161733
|
+
predicateType: z24.enum(
|
|
161734
|
+
Object.keys(ASSERTION_STAGE3)
|
|
161735
|
+
),
|
|
161736
|
+
role: z24.enum(["advisory", "required"]),
|
|
161737
|
+
stage: z24.enum(USER_VALUE_STAGES3).describe(
|
|
161738
|
+
"The stage this observation was read from, and the only stage it is evidence ABOUT. `connection` \u2014 the server was reachable and the session initialized. `discovery` \u2014 its tools and resources were listed and readable. `selection` \u2014 the model chose the right tool for the request. `call` \u2014 the call was made with usable arguments. `response` \u2014 the server returned data the model could use. `userValue` \u2014 the user's actual request was satisfied."
|
|
161739
|
+
),
|
|
161740
|
+
unit: z24.literal("sessions"),
|
|
161741
|
+
total: count3,
|
|
161742
|
+
passed: count3,
|
|
161743
|
+
failed: count3,
|
|
161744
|
+
pending: count3,
|
|
161745
|
+
unavailable: count3
|
|
161746
|
+
}).strict().superRefine((value, ctx) => {
|
|
161747
|
+
if (value.total !== value.passed + value.failed + value.pending + value.unavailable) {
|
|
161748
|
+
ctx.addIssue({
|
|
161749
|
+
code: "custom",
|
|
161750
|
+
message: "Observation coverage must partition its population"
|
|
161751
|
+
});
|
|
161752
|
+
}
|
|
161753
|
+
if (value.stage !== ASSERTION_STAGE3[value.predicateType]) {
|
|
161754
|
+
ctx.addIssue({
|
|
161755
|
+
code: "custom",
|
|
161756
|
+
message: "Observation stage contradicts the shared evaluator map"
|
|
161757
|
+
});
|
|
161758
|
+
}
|
|
161759
|
+
});
|
|
161760
|
+
z24.object({
|
|
161761
|
+
contractVersion: z24.literal(SWARM_REPORT_CONTRACT_VERSION3),
|
|
161762
|
+
runId: z24.string().min(1),
|
|
161763
|
+
verdict: swarmSessionVerdictValueSchema3,
|
|
161764
|
+
verdictSource: z24.enum(["policyV2", "none"]),
|
|
161765
|
+
decision: evalVerdictDecisionSchema3.optional(),
|
|
161766
|
+
undecidedReason: z24.enum([
|
|
161767
|
+
"executionPending",
|
|
161768
|
+
"gradingPending",
|
|
161769
|
+
"gradingNotConfigured",
|
|
161770
|
+
"verdictSummaryUnavailable",
|
|
161771
|
+
"integrityFailed"
|
|
161772
|
+
]).optional(),
|
|
161773
|
+
execution: z24.object({
|
|
161774
|
+
unit: z24.literal("sessions"),
|
|
161775
|
+
configured: count3,
|
|
161776
|
+
reported: count3,
|
|
161777
|
+
started: count3,
|
|
161778
|
+
notStarted: count3,
|
|
161779
|
+
unknown: count3,
|
|
161780
|
+
completed: count3,
|
|
161781
|
+
interrupted: count3,
|
|
161782
|
+
/** Only explicit complete execution evidence can establish this. */
|
|
161783
|
+
neverLaunched: z24.boolean()
|
|
161784
|
+
}).strict(),
|
|
161785
|
+
goalGrading: z24.object({
|
|
161786
|
+
unit: z24.literal("sessions"),
|
|
161787
|
+
reported: count3,
|
|
161788
|
+
passed: count3,
|
|
161789
|
+
failed: count3,
|
|
161790
|
+
pending: count3,
|
|
161791
|
+
unavailable: count3,
|
|
161792
|
+
notRequested: count3,
|
|
161793
|
+
/** Readiness is separate: a proven failure can exist while other required grading is pending. */
|
|
161794
|
+
waitingForDecisiveGrading: count3
|
|
161795
|
+
}).strict(),
|
|
161796
|
+
observations: z24.array(swarmObservationCoverageSchema3)
|
|
161797
|
+
}).strict().superRefine((report, ctx) => {
|
|
161798
|
+
const fail3 = (message) => ctx.addIssue({ code: "custom", message });
|
|
161799
|
+
if (report.verdictSource === "policyV2") {
|
|
161800
|
+
if (!report.decision || report.verdict !== report.decision.verdict || report.undecidedReason !== void 0)
|
|
161801
|
+
fail3("Report must copy its authoritative decision");
|
|
161802
|
+
} else if (report.verdict !== "notEstablished" || report.decision !== void 0 || !report.undecidedReason)
|
|
161803
|
+
fail3("Missing authority must have an undecided reason");
|
|
161804
|
+
const e = report.execution;
|
|
161805
|
+
if (e.started + e.notStarted + e.unknown !== e.configured || e.reported > e.configured)
|
|
161806
|
+
fail3("Execution evidence does not cover its configured population");
|
|
161807
|
+
if (e.started + e.notStarted > e.reported || e.completed + e.interrupted > e.reported)
|
|
161808
|
+
fail3("Execution counts exceed reported evidence");
|
|
161809
|
+
if (e.neverLaunched !== (e.configured > 0 && e.reported === e.configured && e.notStarted === e.configured))
|
|
161810
|
+
fail3("Not run requires explicit evidence for the entire population");
|
|
161811
|
+
const g = report.goalGrading;
|
|
161812
|
+
if (g.reported !== e.reported || g.passed + g.failed + g.pending + g.unavailable + g.notRequested !== g.reported || g.waitingForDecisiveGrading > g.reported)
|
|
161813
|
+
fail3("Goal coverage must partition reported sessions");
|
|
161814
|
+
if (new Set(report.observations.map((o) => o.evaluatorId)).size !== report.observations.length || report.observations.some((o) => o.total > e.reported))
|
|
161815
|
+
fail3("Invalid observation population");
|
|
161816
|
+
});
|
|
160506
161817
|
var DECISION_SUMMARY_FALLBACK_PAGE_LIMIT = 200;
|
|
160507
161818
|
var DECISION_SUMMARY_FALLBACK_MAX_PAGES = 100;
|
|
160508
161819
|
function buildEvalRunDecisionSummary(input) {
|
|
@@ -160869,13 +162180,13 @@ function primitiveStatusFromCheck(check) {
|
|
|
160869
162180
|
return "loaded";
|
|
160870
162181
|
}
|
|
160871
162182
|
function coerceToolInfo(value) {
|
|
160872
|
-
const
|
|
160873
|
-
const name15 =
|
|
160874
|
-
if (!
|
|
162183
|
+
const record5 = objectRecord(value);
|
|
162184
|
+
const name15 = record5 ? optionalString2(record5, "name") : void 0;
|
|
162185
|
+
if (!record5 || !name15) {
|
|
160875
162186
|
return void 0;
|
|
160876
162187
|
}
|
|
160877
|
-
const title = optionalString2(
|
|
160878
|
-
const description = optionalDescription(
|
|
162188
|
+
const title = optionalString2(record5, "title");
|
|
162189
|
+
const description = optionalDescription(record5);
|
|
160879
162190
|
return {
|
|
160880
162191
|
name: name15,
|
|
160881
162192
|
...title ? { title } : {},
|
|
@@ -160883,15 +162194,15 @@ function coerceToolInfo(value) {
|
|
|
160883
162194
|
};
|
|
160884
162195
|
}
|
|
160885
162196
|
function coerceResourceInfo(value) {
|
|
160886
|
-
const
|
|
160887
|
-
const uri =
|
|
160888
|
-
if (!
|
|
162197
|
+
const record5 = objectRecord(value);
|
|
162198
|
+
const uri = record5 ? optionalString2(record5, "uri") : void 0;
|
|
162199
|
+
if (!record5 || !uri) {
|
|
160889
162200
|
return void 0;
|
|
160890
162201
|
}
|
|
160891
|
-
const name15 = optionalString2(
|
|
160892
|
-
const title = optionalString2(
|
|
160893
|
-
const description = optionalDescription(
|
|
160894
|
-
const mimeType = optionalString2(
|
|
162202
|
+
const name15 = optionalString2(record5, "name");
|
|
162203
|
+
const title = optionalString2(record5, "title");
|
|
162204
|
+
const description = optionalDescription(record5);
|
|
162205
|
+
const mimeType = optionalString2(record5, "mimeType");
|
|
160895
162206
|
return {
|
|
160896
162207
|
uri,
|
|
160897
162208
|
...name15 ? { name: name15 } : {},
|
|
@@ -160901,14 +162212,14 @@ function coerceResourceInfo(value) {
|
|
|
160901
162212
|
};
|
|
160902
162213
|
}
|
|
160903
162214
|
function coercePromptInfo(value) {
|
|
160904
|
-
const
|
|
160905
|
-
const name15 =
|
|
160906
|
-
if (!
|
|
162215
|
+
const record5 = objectRecord(value);
|
|
162216
|
+
const name15 = record5 ? optionalString2(record5, "name") : void 0;
|
|
162217
|
+
if (!record5 || !name15) {
|
|
160907
162218
|
return void 0;
|
|
160908
162219
|
}
|
|
160909
|
-
const promptArguments = Array.isArray(
|
|
160910
|
-
const title = optionalString2(
|
|
160911
|
-
const description = optionalDescription(
|
|
162220
|
+
const promptArguments = Array.isArray(record5.arguments) ? record5.arguments.map(coercePromptArgumentInfo).filter(isPresent) : void 0;
|
|
162221
|
+
const title = optionalString2(record5, "title");
|
|
162222
|
+
const description = optionalDescription(record5);
|
|
160912
162223
|
return {
|
|
160913
162224
|
name: name15,
|
|
160914
162225
|
...title ? { title } : {},
|
|
@@ -160917,25 +162228,25 @@ function coercePromptInfo(value) {
|
|
|
160917
162228
|
};
|
|
160918
162229
|
}
|
|
160919
162230
|
function coercePromptArgumentInfo(value) {
|
|
160920
|
-
const
|
|
160921
|
-
const name15 =
|
|
160922
|
-
if (!
|
|
162231
|
+
const record5 = objectRecord(value);
|
|
162232
|
+
const name15 = record5 ? optionalString2(record5, "name") : void 0;
|
|
162233
|
+
if (!record5 || !name15) {
|
|
160923
162234
|
return void 0;
|
|
160924
162235
|
}
|
|
160925
|
-
const description = optionalDescription(
|
|
162236
|
+
const description = optionalDescription(record5);
|
|
160926
162237
|
return {
|
|
160927
162238
|
name: name15,
|
|
160928
162239
|
...description ? { description } : {},
|
|
160929
|
-
...typeof
|
|
162240
|
+
...typeof record5.required === "boolean" ? { required: record5.required } : {}
|
|
160930
162241
|
};
|
|
160931
162242
|
}
|
|
160932
162243
|
function coerceServerInfo(value) {
|
|
160933
|
-
const
|
|
160934
|
-
if (!
|
|
162244
|
+
const record5 = objectRecord(value);
|
|
162245
|
+
if (!record5) {
|
|
160935
162246
|
return void 0;
|
|
160936
162247
|
}
|
|
160937
|
-
const name15 = optionalString2(
|
|
160938
|
-
const version = optionalString2(
|
|
162248
|
+
const name15 = optionalString2(record5, "name");
|
|
162249
|
+
const version = optionalString2(record5, "version");
|
|
160939
162250
|
if (!name15 && !version) {
|
|
160940
162251
|
return void 0;
|
|
160941
162252
|
}
|
|
@@ -160947,12 +162258,12 @@ function coerceServerInfo(value) {
|
|
|
160947
162258
|
function objectRecord(value) {
|
|
160948
162259
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
160949
162260
|
}
|
|
160950
|
-
function optionalString2(
|
|
160951
|
-
const value =
|
|
162261
|
+
function optionalString2(record5, key) {
|
|
162262
|
+
const value = record5[key];
|
|
160952
162263
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
160953
162264
|
}
|
|
160954
|
-
function optionalDescription(
|
|
160955
|
-
const description = optionalString2(
|
|
162265
|
+
function optionalDescription(record5) {
|
|
162266
|
+
const description = optionalString2(record5, "description");
|
|
160956
162267
|
return description ? truncateText(description, MAX_PRIMITIVE_DESCRIPTION_LENGTH) : void 0;
|
|
160957
162268
|
}
|
|
160958
162269
|
function truncateText(value, maxLength) {
|
|
@@ -161310,27 +162621,27 @@ function evaluateHostCompat(requirements, profile) {
|
|
|
161310
162621
|
(name15) => !requirements.appOnlyWidgets.includes(name15)
|
|
161311
162622
|
);
|
|
161312
162623
|
if (blockedAppOnly.length > 0) {
|
|
161313
|
-
const
|
|
162624
|
+
const count22 = blockedAppOnly.length;
|
|
161314
162625
|
findings.push({
|
|
161315
162626
|
lane: "apps",
|
|
161316
162627
|
severity: "blocker",
|
|
161317
162628
|
code: "app_only_unrenderable",
|
|
161318
162629
|
tools: blockedAppOnly,
|
|
161319
|
-
title: `${
|
|
161320
|
-
detail: `${formatToolNames(blockedAppOnly)} only ${
|
|
162630
|
+
title: `${count22 === 1 ? "Interactive tool" : `${count22} interactive tools`} unavailable`,
|
|
162631
|
+
detail: `${formatToolNames(blockedAppOnly)} only ${count22 === 1 ? "works" : "work"} inside a widget. ${profile.label} does not render ${count22 === 1 ? "it" : "them"}.`,
|
|
161321
162632
|
remediation,
|
|
161322
162633
|
provenance: profile.provenance
|
|
161323
162634
|
});
|
|
161324
162635
|
}
|
|
161325
162636
|
if (degradedFallback.length > 0) {
|
|
161326
|
-
const
|
|
162637
|
+
const count22 = degradedFallback.length;
|
|
161327
162638
|
findings.push({
|
|
161328
162639
|
lane: "apps",
|
|
161329
162640
|
severity: "degraded",
|
|
161330
162641
|
code: "widget_text_fallback",
|
|
161331
162642
|
tools: degradedFallback,
|
|
161332
|
-
title: `${
|
|
161333
|
-
detail: `${formatToolNames(degradedFallback)} provide${
|
|
162643
|
+
title: `${count22 === 1 ? "Interactive view" : `${count22} interactive views`} unavailable`,
|
|
162644
|
+
detail: `${formatToolNames(degradedFallback)} provide${count22 === 1 ? "s" : ""} an interactive view. ${profile.label} shows the plain-text result instead.`,
|
|
161334
162645
|
remediation,
|
|
161335
162646
|
provenance: profile.provenance
|
|
161336
162647
|
});
|
|
@@ -167412,7 +168723,7 @@ var readinessRunScopedInput = z24.object({
|
|
|
167412
168723
|
});
|
|
167413
168724
|
var startReadinessInput = serverScopedInput.extend({
|
|
167414
168725
|
includeLlmObservations: z24.boolean().optional().describe(
|
|
167415
|
-
"Ask a model for optional experience observations. Included with MCPJam
|
|
168726
|
+
"Ask a model for optional experience observations. Included with MCPJam; no customer credits consumed; subject to MCPJam's daily analysis budget. Defaults false; the deterministic grade is complete without it."
|
|
167416
168727
|
),
|
|
167417
168728
|
idempotencyKey: z24.string().trim().min(1).max(200).optional().describe(
|
|
167418
168729
|
"Replay guard. A retry carrying the same key returns the run it already started rather than dialling the target twice."
|
|
@@ -167426,7 +168737,7 @@ var startOpenAIReadinessInput = startReadinessInput.extend({
|
|
|
167426
168737
|
var startClaudeReadinessRunOperation = {
|
|
167427
168738
|
name: "start_claude_readiness_run",
|
|
167428
168739
|
title: "Start a Claude directory readiness run",
|
|
167429
|
-
description: "Grade a saved MCP server against Anthropic's connector-directory rules. Starts a durable run and returns its id \u2014 poll `get_readiness_run` for the verdict, which is NOT in this response. `includeLlmObservations` adds an optional model pass: included with MCPJam, so no credits are consumed either way.",
|
|
168740
|
+
description: "Grade a saved MCP server against Anthropic's connector-directory rules. Starts a durable run and returns its id \u2014 poll `get_readiness_run` for the verdict, which is NOT in this response. `includeLlmObservations` adds an optional model pass: included with MCPJam, so no customer credits are consumed either way; it is subject to MCPJam's daily analysis budget.",
|
|
167430
168741
|
readOnly: false,
|
|
167431
168742
|
risk: "none",
|
|
167432
168743
|
permalink: noPermalink(
|
|
@@ -167464,7 +168775,7 @@ var startClaudeReadinessRunOperation = {
|
|
|
167464
168775
|
var startOpenAIReadinessRunOperation = {
|
|
167465
168776
|
name: "start_openai_readiness_run",
|
|
167466
168777
|
title: "Start an OpenAI directory readiness run",
|
|
167467
|
-
description: "Grade a saved MCP server against OpenAI's app-directory rules. Requires an explicit `submissionMode` \u2014 it is never inferred, because guessing turns a missing input into a clean bill of health. Starts a durable run and returns its id; poll `get_readiness_run` for the verdict. `includeLlmObservations` adds an optional model pass: included with MCPJam, so no credits are consumed either way.",
|
|
168778
|
+
description: "Grade a saved MCP server against OpenAI's app-directory rules. Requires an explicit `submissionMode` \u2014 it is never inferred, because guessing turns a missing input into a clean bill of health. Starts a durable run and returns its id; poll `get_readiness_run` for the verdict. `includeLlmObservations` adds an optional model pass: included with MCPJam, so no customer credits are consumed either way; it is subject to MCPJam's daily analysis budget.",
|
|
167468
168779
|
readOnly: false,
|
|
167469
168780
|
risk: "none",
|
|
167470
168781
|
permalink: noPermalink(
|
|
@@ -169901,14 +171212,14 @@ var generateEvalCasesInput = z24.object({
|
|
|
169901
171212
|
"Condition generated cases on a realistic range of user styles so the queries read like different users wrote them."
|
|
169902
171213
|
),
|
|
169903
171214
|
idempotencyKey: z24.string().trim().min(1).max(256).optional().describe(
|
|
169904
|
-
"Retry-safety key: pass one, because a retry must not take a second slice of the
|
|
171215
|
+
"Retry-safety key: pass one, because a retry must not take a second slice of the organization's daily generation quota. Repeating a call with the same key replays the first attempt's drafts and returns the cases it already created."
|
|
169905
171216
|
)
|
|
169906
171217
|
});
|
|
169907
171218
|
var generateEvalCasesOperation = {
|
|
169908
171219
|
name: "generate_eval_cases",
|
|
169909
171220
|
risk: "none",
|
|
169910
171221
|
title: "Generate MCPJam eval cases",
|
|
169911
|
-
description: "AI-generate test cases from the suite's server tools and persist them into the suite. Connects the servers to discover tools. Included with MCPJam
|
|
171222
|
+
description: "AI-generate test cases from the suite's server tools and persist them into the suite. Connects the servers to discover tools. Included with MCPJam; no customer credits consumed; subject to usage limits: a per-minute burst limit and the organization's daily generation quota. A refusal is RATE_LIMITED with a retry time \u2014 wait until then; topping up credits does not lift it. For a suite with attached project environments, tools are discovered from the environment's closed server set \u2014 pass environment to choose which one. The authoring model is platform-controlled; set caseModels to choose the generated cases' execution models. IDEMPOTENT on idempotencyKey: pass one, because a retry must not take a second slice of that quota.",
|
|
169912
171223
|
readOnly: false,
|
|
169913
171224
|
permalink: derivePermalinks(
|
|
169914
171225
|
(result) => result.created.flatMap(
|
|
@@ -170389,7 +171700,7 @@ var proposeEvalDescriptionRewriteInput = evalRunScopedInput.extend({
|
|
|
170389
171700
|
var proposeEvalDescriptionRewriteOperation = {
|
|
170390
171701
|
name: "propose_eval_description_rewrite",
|
|
170391
171702
|
title: "Propose an eval description rewrite",
|
|
170392
|
-
description: "Draft a rewritten tool description from a finished eval run's failed trials: the tool's current description and input schema, sibling tool names, the expected vs observed calls, and the failing prompts. Included with MCPJam
|
|
171703
|
+
description: "Draft a rewritten tool description from a finished eval run's failed trials: the tool's current description and input schema, sibling tool names, the expected vs observed calls, and the failing prompts. Included with MCPJam; no customer credits consumed; subject to MCPJam's daily analysis budget. Returns immediately with a proposing receipt \u2014 poll get_eval_description_experiment until status is proposed (or failed). Does not launch runs, write a verdict, or change a gate. Report-only throughout.",
|
|
170393
171704
|
readOnly: false,
|
|
170394
171705
|
risk: "none",
|
|
170395
171706
|
permalink: noPermalink("mutation-only"),
|
|
@@ -173343,7 +174654,7 @@ var journeyRunSessionsInput = journeyRunSelectorInput.extend({
|
|
|
173343
174654
|
var listJourneyRunSessionsOperation = {
|
|
173344
174655
|
name: "list_journey_run_sessions",
|
|
173345
174656
|
title: "List the sessions a journey run produced",
|
|
173346
|
-
description: "The chat sessions a journey run produced \u2014 one per persona attempt against each target \u2014 with readiness, goal scores and a first-message preview. Transcript bodies are not on this API yet; use the returned `id` in the app to open a session.",
|
|
174657
|
+
description: "The chat sessions a journey run produced \u2014 one per persona attempt against each target \u2014 with graded verdicts, check observations, readiness, goal scores and a first-message preview. `verdict` is the graded goal result; `outcome` is execution lifecycle. A broken execution may have met its goal. Transcript bodies are not on this API yet; use the returned `id` in the app to open a session.",
|
|
173347
174658
|
readOnly: true,
|
|
173348
174659
|
permalink: derivePermalinks(
|
|
173349
174660
|
(result) => result.items.map((session) => ({
|
|
@@ -174385,7 +175696,7 @@ var generatePersonasInput = generationGroundingInput.extend({
|
|
|
174385
175696
|
var generatePersonasOperation = {
|
|
174386
175697
|
name: "generate_personas",
|
|
174387
175698
|
title: "Draft MCPJam personas with a model",
|
|
174388
|
-
description: "Draft candidate personas grounded in what the project's servers actually do. NOTHING IS SAVED \u2014 pick what you want and pass it to create_persona. Runs a model
|
|
175699
|
+
description: "Draft candidate personas grounded in what the project's servers actually do. NOTHING IS SAVED \u2014 pick what you want and pass it to create_persona. Runs a model. Included with MCPJam; no customer credits consumed; subject to usage limits: a per-minute burst limit and the organization's daily generation quota. A refusal is RATE_LIMITED with a retry time \u2014 wait until then; topping up credits does not lift it. Exactly one of environmentId or serverAttachmentId.",
|
|
174389
175700
|
readOnly: false,
|
|
174390
175701
|
risk: "none",
|
|
174391
175702
|
permalink: noPermalink(
|
|
@@ -174426,7 +175737,7 @@ var generateJourneysInput = generationGroundingInput.extend({
|
|
|
174426
175737
|
var generateJourneysOperation = {
|
|
174427
175738
|
name: "generate_journeys",
|
|
174428
175739
|
title: "Draft MCPJam journeys with a model",
|
|
174429
|
-
description: "Draft candidate journeys for a persona, grounded in the project's servers. NOTHING IS SAVED \u2014 pass what you want to create_journey. Included with MCPJam
|
|
175740
|
+
description: "Draft candidate journeys for a persona, grounded in the project's servers. NOTHING IS SAVED \u2014 pass what you want to create_journey. Included with MCPJam; no customer credits consumed; subject to usage limits: a per-minute burst limit and the organization's daily generation quota. A refusal is RATE_LIMITED with a retry time \u2014 wait until then; topping up credits does not lift it. Exactly one of environmentId or serverAttachmentId.",
|
|
174430
175741
|
readOnly: false,
|
|
174431
175742
|
risk: "none",
|
|
174432
175743
|
permalink: noPermalink(
|
|
@@ -174571,10 +175882,11 @@ var waveSelectorInput = z24.object({
|
|
|
174571
175882
|
project: z24.string().trim().min(1).optional().describe(PROJECT_SELECTOR_DESCRIPTION),
|
|
174572
175883
|
wave: z24.string().trim().min(1).describe("Wave id \u2014 the `waveId` on a journey run.")
|
|
174573
175884
|
});
|
|
175885
|
+
var INCLUDED_ANALYSIS_FAILURE_NOTE = "A failed analysis carries errorCode: `platform_cap_exceeded` means MCPJam's own daily budget for this analysis is used up \u2014 nothing was charged, it resets at 00:00 UTC, and neither re-requesting nor topping up credits helps before then; `platform_unavailable` means MCPJam could not reserve capacity \u2014 try again later, not in a loop.";
|
|
174574
175886
|
var getWaveInsightsOperation = {
|
|
174575
175887
|
name: "get_wave_insights",
|
|
174576
175888
|
title: "Get an MCPJam wave's insights",
|
|
174577
|
-
description: "The model's analysis of a whole wave, if one has been requested. Poll this after request_wave_insights \u2014 status goes pending \u2192 completed. Not-found means nobody has requested it, which is different from 'requested and still working'.",
|
|
175889
|
+
description: "The model's analysis of a whole wave, if one has been requested. Poll this after request_wave_insights \u2014 status goes pending \u2192 completed. Not-found means nobody has requested it, which is different from 'requested and still working'. " + INCLUDED_ANALYSIS_FAILURE_NOTE,
|
|
174578
175890
|
readOnly: true,
|
|
174579
175891
|
permalink: derivePermalinks((result) => [
|
|
174580
175892
|
// A wave IS a journey run on the Swarms surface: `/swarms/<waveId>`.
|
|
@@ -174605,7 +175917,7 @@ var requestWaveInsightsInput = waveSelectorInput.extend({
|
|
|
174605
175917
|
var requestWaveInsightsOperation = {
|
|
174606
175918
|
name: "request_wave_insights",
|
|
174607
175919
|
title: "Request MCPJam wave insights",
|
|
174608
|
-
description: "Ask a model to analyze a whole wave. Returns immediately with status pending; poll get_wave_insights. Included with MCPJam
|
|
175920
|
+
description: "Ask a model to analyze a whole wave. Returns immediately with status pending; poll get_wave_insights. Included with MCPJam; no customer credits consumed; subject to usage limits: it COUNTS against the organization's daily insight quota, which is SHARED with user-testing insights, so a request here takes one from there. Read the run scorecards first; they cost no quota and usually explain the failure.",
|
|
174609
175921
|
readOnly: false,
|
|
174610
175922
|
risk: "none",
|
|
174611
175923
|
permalink: noPermalink("mutation-only"),
|
|
@@ -174918,7 +176230,7 @@ var userTestingWindowInput = userTestingScenarioSelectorInput.extend({
|
|
|
174918
176230
|
var getUserTestingInsightsOperation = {
|
|
174919
176231
|
name: "get_user_testing_insights",
|
|
174920
176232
|
title: "Get a user-testing window's insights",
|
|
174921
|
-
description: "The model's analysis of one analysis window, if one has been requested. Not-found means nobody has requested it, which is different from requested-and-still-working.",
|
|
176233
|
+
description: "The model's analysis of one analysis window, if one has been requested. Not-found means nobody has requested it, which is different from requested-and-still-working. " + INCLUDED_ANALYSIS_FAILURE_NOTE,
|
|
174922
176234
|
readOnly: true,
|
|
174923
176235
|
permalink: noPermalink(
|
|
174924
176236
|
"no-addressable-resource",
|
|
@@ -174951,7 +176263,7 @@ var requestUserTestingInsightsInput = userTestingScenarioSelectorInput.extend(
|
|
|
174951
176263
|
var requestUserTestingInsightsOperation = {
|
|
174952
176264
|
name: "request_user_testing_insights",
|
|
174953
176265
|
title: "Request insights for a user-testing scenario",
|
|
174954
|
-
description: "Ask a model to analyze the scenario's current window. Returns immediately with the windowId and status pending; poll get_user_testing_insights. Included with MCPJam
|
|
176266
|
+
description: "Ask a model to analyze the scenario's current window. Returns immediately with the windowId and status pending; poll get_user_testing_insights. Included with MCPJam; no customer credits consumed; subject to usage limits: it COUNTS against the organization's daily insight quota, which is SHARED with swarm wave insights. A 409 means the window has not been mined yet \u2014 wait, do not retry in a loop.",
|
|
174955
176267
|
readOnly: false,
|
|
174956
176268
|
risk: "none",
|
|
174957
176269
|
permalink: noPermalink("mutation-only"),
|
|
@@ -175975,6 +177287,13 @@ function capForModel(value) {
|
|
|
175975
177287
|
}
|
|
175976
177288
|
function toToolError(error, fallback) {
|
|
175977
177289
|
const message = error instanceof Error && error.message.trim() ? error.message : "";
|
|
177290
|
+
const refusal = describePlatformRefusal(error);
|
|
177291
|
+
if (refusal) {
|
|
177292
|
+
return {
|
|
177293
|
+
error: `${message || fallback} ${platformRefusalHint(refusal)}`,
|
|
177294
|
+
refusal
|
|
177295
|
+
};
|
|
177296
|
+
}
|
|
175978
177297
|
return { error: message || fallback };
|
|
175979
177298
|
}
|
|
175980
177299
|
function buildMcpjamTool(id3, opts) {
|
|
@@ -176672,12 +177991,12 @@ function linkedResourceReaderForPart(part, fallbackServerId, options) {
|
|
|
176672
177991
|
}
|
|
176673
177992
|
function readServerIdFromToolResultPart(part) {
|
|
176674
177993
|
if (!part || typeof part !== "object") return void 0;
|
|
176675
|
-
const
|
|
176676
|
-
const legacy =
|
|
177994
|
+
const record5 = part;
|
|
177995
|
+
const legacy = record5.serverId;
|
|
176677
177996
|
if (typeof legacy === "string" && legacy.length > 0) {
|
|
176678
177997
|
return legacy;
|
|
176679
177998
|
}
|
|
176680
|
-
return readMcpToolOriginServerId(
|
|
177999
|
+
return readMcpToolOriginServerId(record5.providerOptions);
|
|
176681
178000
|
}
|
|
176682
178001
|
function readToolCallId(part) {
|
|
176683
178002
|
if (!part || typeof part !== "object") return void 0;
|
|
@@ -176700,11 +178019,11 @@ function unwrapJsonToolOutput(output) {
|
|
|
176700
178019
|
if (!current || typeof current !== "object" || Array.isArray(current)) {
|
|
176701
178020
|
return current;
|
|
176702
178021
|
}
|
|
176703
|
-
const
|
|
176704
|
-
if (
|
|
178022
|
+
const record5 = current;
|
|
178023
|
+
if (record5.type !== "json" || !Object.prototype.hasOwnProperty.call(record5, "value")) {
|
|
176705
178024
|
return current;
|
|
176706
178025
|
}
|
|
176707
|
-
current =
|
|
178026
|
+
current = record5.value;
|
|
176708
178027
|
}
|
|
176709
178028
|
return current;
|
|
176710
178029
|
}
|
|
@@ -176731,14 +178050,14 @@ function readReplayableImageModelOutput(output, options) {
|
|
|
176731
178050
|
if (!output || typeof output !== "object" || Array.isArray(output)) {
|
|
176732
178051
|
return void 0;
|
|
176733
178052
|
}
|
|
176734
|
-
const
|
|
176735
|
-
if (
|
|
178053
|
+
const record5 = output;
|
|
178054
|
+
if (record5.type !== "content" || !Array.isArray(record5.value)) {
|
|
176736
178055
|
return void 0;
|
|
176737
178056
|
}
|
|
176738
178057
|
let sawImageCandidate = false;
|
|
176739
178058
|
let sawOmissionMarker = false;
|
|
176740
178059
|
const value = [];
|
|
176741
|
-
for (const part of
|
|
178060
|
+
for (const part of record5.value) {
|
|
176742
178061
|
if (!part || typeof part !== "object" || Array.isArray(part)) {
|
|
176743
178062
|
return void 0;
|
|
176744
178063
|
}
|
|
@@ -176786,10 +178105,10 @@ function readReplayableImageModelOutput(output, options) {
|
|
|
176786
178105
|
}
|
|
176787
178106
|
function stripInternalProviderOptions(part) {
|
|
176788
178107
|
if (!part || typeof part !== "object" || Array.isArray(part)) return part;
|
|
176789
|
-
const
|
|
176790
|
-
if (!
|
|
176791
|
-
const providerOptions = stripMcpToolOriginMetadata(
|
|
176792
|
-
const { providerOptions: _providerOptions, ...rest } =
|
|
178108
|
+
const record5 = part;
|
|
178109
|
+
if (!record5.providerOptions) return part;
|
|
178110
|
+
const providerOptions = stripMcpToolOriginMetadata(record5.providerOptions);
|
|
178111
|
+
const { providerOptions: _providerOptions, ...rest } = record5;
|
|
176793
178112
|
return providerOptions ? { ...rest, providerOptions } : rest;
|
|
176794
178113
|
}
|
|
176795
178114
|
async function mapMcpImageToolOutputs(messages, options = {}) {
|
|
@@ -177348,6 +178667,9 @@ chatV2.post("/", async (c) => {
|
|
|
177348
178667
|
}
|
|
177349
178668
|
);
|
|
177350
178669
|
const failClosedMessage = `Couldn't load this scenario's settings, so the turn was stopped to avoid running with the wrong configuration. ${runtime.error}`;
|
|
178670
|
+
if (runtime.code === "SCENARIO_SIGN_IN_REQUIRED") {
|
|
178671
|
+
return c.json({ error: runtime.error, code: runtime.code }, 401);
|
|
178672
|
+
}
|
|
177351
178673
|
if (runtime.code === "SCENARIO_ACCESS_STALE") {
|
|
177352
178674
|
return c.json(
|
|
177353
178675
|
{ error: failClosedMessage, code: "SCENARIO_ACCESS_STALE" },
|
|
@@ -177410,7 +178732,10 @@ chatV2.post("/", async (c) => {
|
|
|
177410
178732
|
let enabled = typeof hostRuntimeConfig?.localBrowserEnabled === "boolean" ? hostRuntimeConfig.localBrowserEnabled : void 0;
|
|
177411
178733
|
if (!hostRuntimeConfig && typeof body.projectId === "string" && body.projectId && c.req.header("authorization") && !isGuestChatRequest(c.req.header("authorization"))) {
|
|
177412
178734
|
try {
|
|
177413
|
-
enabled = await readLocalBrowserSetting(
|
|
178735
|
+
enabled = await readLocalBrowserSetting(
|
|
178736
|
+
await getConvexBearerForRequest(c),
|
|
178737
|
+
body.projectId
|
|
178738
|
+
);
|
|
177414
178739
|
} catch {
|
|
177415
178740
|
localBrowserSettingsUnavailable = true;
|
|
177416
178741
|
}
|
|
@@ -177657,9 +178982,7 @@ chatV2.post("/", async (c) => {
|
|
|
177657
178982
|
localConsentValid
|
|
177658
178983
|
});
|
|
177659
178984
|
const localBrowserRequested = body.browserEngine === "local";
|
|
177660
|
-
const browserRollout = !localBrowserSettingsUnavailable && resolvedExecution.builtInToolIds?.includes(
|
|
177661
|
-
BROWSER_BUILT_IN_TOOL_ID
|
|
177662
|
-
) ? await resolveBrowserRollout(c, localBrowserRequested) : { enabled: false, actor: null };
|
|
178985
|
+
const browserRollout = !localBrowserSettingsUnavailable && resolvedExecution.builtInToolIds?.includes(BROWSER_BUILT_IN_TOOL_ID) ? await resolveBrowserRollout(c, localBrowserRequested) : { enabled: false, actor: null };
|
|
177663
178986
|
const localBrowserGuestId = localBrowserRequested && browserRollout.enabled && browserRollout.actor?.guest ? browserRollout.actor.id : void 0;
|
|
177664
178987
|
const browserConsentToken = c.req.header(BROWSER_CONSENT_HEADER);
|
|
177665
178988
|
const browserConsentValid = browserRollout.enabled && (!requestIsGuest || Boolean(localBrowserGuestId)) && !isScenarioSession && await verifyLocalBrowserConsent(browserConsentToken);
|
|
@@ -183025,14 +184348,14 @@ function safeHost(url) {
|
|
|
183025
184348
|
}
|
|
183026
184349
|
}
|
|
183027
184350
|
function headersToRecord(input, init2) {
|
|
183028
|
-
const
|
|
184351
|
+
const record5 = {};
|
|
183029
184352
|
const raw = init2?.headers ?? input?.headers;
|
|
183030
184353
|
if (raw) {
|
|
183031
184354
|
new Headers(raw).forEach((value, key) => {
|
|
183032
|
-
|
|
184355
|
+
record5[key] = value;
|
|
183033
184356
|
});
|
|
183034
184357
|
}
|
|
183035
|
-
return
|
|
184358
|
+
return record5;
|
|
183036
184359
|
}
|
|
183037
184360
|
function encodeBody(body) {
|
|
183038
184361
|
if (body === null || body === void 0) return void 0;
|
|
@@ -184676,7 +185999,7 @@ async function createJourneyRun(convexHttpUrl3, bearer, args) {
|
|
|
184676
185999
|
...args.environmentIds?.length ? { environmentIds: args.environmentIds } : {},
|
|
184677
186000
|
// Asserted by this process, never a caller: the runner is the only
|
|
184678
186001
|
// honest source for what it can execute.
|
|
184679
|
-
runnerCapabilities: [...runnerCapabilities()]
|
|
186002
|
+
runnerCapabilities: [...runnerCapabilities(), "swarm-standard-checks-v1"]
|
|
184680
186003
|
},
|
|
184681
186004
|
NON_LLM_TIMEOUT_MS
|
|
184682
186005
|
);
|
|
@@ -184726,7 +186049,8 @@ async function claimSwarmChecks(convexHttpUrl3, bearer, args, signal) {
|
|
|
184726
186049
|
{
|
|
184727
186050
|
projectId: args.projectId,
|
|
184728
186051
|
runId: args.runId,
|
|
184729
|
-
chatSessionId: args.chatSessionId
|
|
186052
|
+
chatSessionId: args.chatSessionId,
|
|
186053
|
+
checkCapability: "swarm-standard-checks-v1"
|
|
184730
186054
|
},
|
|
184731
186055
|
NON_LLM_TIMEOUT_MS,
|
|
184732
186056
|
signal
|
|
@@ -187077,8 +188401,8 @@ var LAUNCH_REJECTION_STATUS = {
|
|
|
187077
188401
|
function environmentLaunchRejectionError(error) {
|
|
187078
188402
|
const data = error?.data;
|
|
187079
188403
|
if (!data || typeof data !== "object" || Array.isArray(data)) return null;
|
|
187080
|
-
const
|
|
187081
|
-
const code = typeof
|
|
188404
|
+
const record5 = data;
|
|
188405
|
+
const code = typeof record5.code === "string" ? record5.code : void 0;
|
|
187082
188406
|
if (!code) return null;
|
|
187083
188407
|
const status = LAUNCH_REJECTION_STATUS[code];
|
|
187084
188408
|
if (!status) return null;
|
|
@@ -187088,8 +188412,8 @@ function environmentLaunchRejectionError(error) {
|
|
|
187088
188412
|
reason: "env_not_found"
|
|
187089
188413
|
});
|
|
187090
188414
|
}
|
|
187091
|
-
const message = typeof
|
|
187092
|
-
const details =
|
|
188415
|
+
const message = typeof record5.message === "string" && record5.message.trim() ? record5.message : "This eval run could not be started as requested.";
|
|
188416
|
+
const details = record5.details && typeof record5.details === "object" && !Array.isArray(record5.details) ? record5.details : {};
|
|
187093
188417
|
return new WebRouteError(status, ErrorCode.VALIDATION_ERROR, message, {
|
|
187094
188418
|
code,
|
|
187095
188419
|
...details,
|
|
@@ -187099,10 +188423,10 @@ function environmentLaunchRejectionError(error) {
|
|
|
187099
188423
|
function environmentModelRequiredError(error) {
|
|
187100
188424
|
const data = error?.data;
|
|
187101
188425
|
if (!data || typeof data !== "object" || Array.isArray(data)) return null;
|
|
187102
|
-
const
|
|
187103
|
-
if (
|
|
187104
|
-
const message = typeof
|
|
187105
|
-
const details =
|
|
188426
|
+
const record5 = data;
|
|
188427
|
+
if (record5.code !== "ENV_MODEL_REQUIRED") return null;
|
|
188428
|
+
const message = typeof record5.message === "string" && record5.message.trim() ? record5.message : "This environment has no model to run. Set a model on the environment, or pin one on its client.";
|
|
188429
|
+
const details = record5.details && typeof record5.details === "object" && !Array.isArray(record5.details) ? record5.details : {};
|
|
187106
188430
|
return new WebRouteError(409, ErrorCode.CONFLICT, message, {
|
|
187107
188431
|
code: "ENV_MODEL_REQUIRED",
|
|
187108
188432
|
...details,
|
|
@@ -191893,7 +193217,7 @@ function slimPhaseSignal(signal) {
|
|
|
191893
193217
|
}
|
|
191894
193218
|
var SETUP_AUDIT_METADATA_KEY = "stageSetupAudit";
|
|
191895
193219
|
function capSetupAuditMetadata(raw, capBytes = SETUP_SIGNALS_METADATA_CAP_BYTES) {
|
|
191896
|
-
const fits = (
|
|
193220
|
+
const fits = (record5) => Buffer.byteLength(JSON.stringify(record5), "utf8") <= capBytes;
|
|
191897
193221
|
if (fits(raw)) return raw;
|
|
191898
193222
|
const withoutReasons = {
|
|
191899
193223
|
...raw,
|
|
@@ -192144,7 +193468,7 @@ function createRunSetupObserver(options) {
|
|
|
192144
193468
|
const lists = /* @__PURE__ */ new Map();
|
|
192145
193469
|
let canaryResult;
|
|
192146
193470
|
let canaryPromise;
|
|
192147
|
-
const
|
|
193471
|
+
const record5 = (into, serverId, init2) => {
|
|
192148
193472
|
const detail = init2.outcome === "failed" ? describeSetupFailure(init2.error, {
|
|
192149
193473
|
serverId,
|
|
192150
193474
|
...options.context?.(serverId) ?? {},
|
|
@@ -192193,8 +193517,8 @@ function createRunSetupObserver(options) {
|
|
|
192193
193517
|
};
|
|
192194
193518
|
};
|
|
192195
193519
|
return {
|
|
192196
|
-
recordConnect: (serverId, init2) =>
|
|
192197
|
-
recordToolsList: (serverId, init2) =>
|
|
193520
|
+
recordConnect: (serverId, init2) => record5(connects, serverId, init2),
|
|
193521
|
+
recordToolsList: (serverId, init2) => record5(lists, serverId, init2),
|
|
192198
193522
|
ensureEgressCanary,
|
|
192199
193523
|
buildSignals,
|
|
192200
193524
|
failureDetail: (serverId, phase) => (phase === "connection" ? connects : lists).get(serverId)?.detail,
|
|
@@ -204783,11 +206107,11 @@ function asRecord11(value) {
|
|
|
204783
206107
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
204784
206108
|
}
|
|
204785
206109
|
function summarizeTool(tool19) {
|
|
204786
|
-
const
|
|
204787
|
-
const name15 = typeof
|
|
206110
|
+
const record5 = asRecord11(tool19);
|
|
206111
|
+
const name15 = typeof record5?.name === "string" ? record5.name : void 0;
|
|
204788
206112
|
if (!name15) return void 0;
|
|
204789
|
-
const description = typeof
|
|
204790
|
-
const annotations2 = asRecord11(
|
|
206113
|
+
const description = typeof record5?.description === "string" ? record5.description : "";
|
|
206114
|
+
const annotations2 = asRecord11(record5?.annotations);
|
|
204791
206115
|
const hints = annotations2 ? Object.entries(annotations2).filter(([, value]) => typeof value === "boolean").map(([key, value]) => `${key}=${value}`).join(" ") : "";
|
|
204792
206116
|
return `- ${name15}${hints ? ` [${hints}]` : ""}: ${description.slice(0, 400)}`;
|
|
204793
206117
|
}
|
|
@@ -209839,13 +211163,13 @@ var SUPPORTED_AUDIO_FORMATS = /* @__PURE__ */ new Set([
|
|
|
209839
211163
|
]);
|
|
209840
211164
|
function readErrorMessage(payload, fallback) {
|
|
209841
211165
|
if (!payload || typeof payload !== "object") return fallback;
|
|
209842
|
-
const
|
|
209843
|
-
if (typeof
|
|
209844
|
-
if (
|
|
209845
|
-
const error =
|
|
211166
|
+
const record5 = payload;
|
|
211167
|
+
if (typeof record5.error === "string") return record5.error;
|
|
211168
|
+
if (record5.error && typeof record5.error === "object") {
|
|
211169
|
+
const error = record5.error;
|
|
209846
211170
|
if (typeof error.message === "string") return error.message;
|
|
209847
211171
|
}
|
|
209848
|
-
if (typeof
|
|
211172
|
+
if (typeof record5.message === "string") return record5.message;
|
|
209849
211173
|
return fallback;
|
|
209850
211174
|
}
|
|
209851
211175
|
function readUpstreamError(payload, fallback) {
|
|
@@ -209853,16 +211177,16 @@ function readUpstreamError(payload, fallback) {
|
|
|
209853
211177
|
if (!payload || typeof payload !== "object") {
|
|
209854
211178
|
return { error: message };
|
|
209855
211179
|
}
|
|
209856
|
-
const
|
|
209857
|
-
const code = typeof
|
|
211180
|
+
const record5 = payload;
|
|
211181
|
+
const code = typeof record5.code === "string" ? record5.code : void 0;
|
|
209858
211182
|
const isVoiceBudgetError = code === MCPJAM_VOICE_BUDGET_CODE;
|
|
209859
211183
|
const isVoiceInProgressError = code === MCPJAM_VOICE_IN_PROGRESS_CODE;
|
|
209860
211184
|
return {
|
|
209861
211185
|
error: isVoiceBudgetError ? MCPJAM_VOICE_BUDGET_MESSAGE : isVoiceInProgressError ? MCPJAM_VOICE_IN_PROGRESS_MESSAGE : message,
|
|
209862
211186
|
...code ? { code } : {},
|
|
209863
|
-
...typeof
|
|
209864
|
-
...typeof
|
|
209865
|
-
...isVoiceBudgetError && typeof
|
|
211187
|
+
...typeof record5.isRetryable === "boolean" ? { isRetryable: record5.isRetryable } : {},
|
|
211188
|
+
...typeof record5.retryAfter === "number" ? { retryAfter: record5.retryAfter } : {},
|
|
211189
|
+
...isVoiceBudgetError && typeof record5.details === "string" ? { details: record5.details } : {}
|
|
209866
211190
|
};
|
|
209867
211191
|
}
|
|
209868
211192
|
function validateRequest(body) {
|
|
@@ -216486,8 +217810,8 @@ function stableJson2(value) {
|
|
|
216486
217810
|
if (Array.isArray(value)) {
|
|
216487
217811
|
return `[${value.map(stableJson2).join(",")}]`;
|
|
216488
217812
|
}
|
|
216489
|
-
const
|
|
216490
|
-
return `{${Object.keys(
|
|
217813
|
+
const record5 = value;
|
|
217814
|
+
return `{${Object.keys(record5).sort().map((key) => `${JSON.stringify(key)}:${stableJson2(record5[key])}`).join(",")}}`;
|
|
216491
217815
|
}
|
|
216492
217816
|
function hashInput(value) {
|
|
216493
217817
|
return createHash24("sha256").update(stableJson2(value)).digest("base64url");
|
|
@@ -217661,12 +218985,12 @@ function turnSkillProvenance(spec, options) {
|
|
|
217661
218985
|
].filter(isProvenanceRow)
|
|
217662
218986
|
};
|
|
217663
218987
|
}
|
|
217664
|
-
function readString5(
|
|
217665
|
-
const value =
|
|
218988
|
+
function readString5(record5, key) {
|
|
218989
|
+
const value = record5[key];
|
|
217666
218990
|
return typeof value === "string" && value.length > 0 ? value : null;
|
|
217667
218991
|
}
|
|
217668
|
-
function readBoolean3(
|
|
217669
|
-
const value =
|
|
218992
|
+
function readBoolean3(record5, key) {
|
|
218993
|
+
const value = record5[key];
|
|
217670
218994
|
return typeof value === "boolean" ? value : null;
|
|
217671
218995
|
}
|
|
217672
218996
|
function toEnvironmentPreview(spec, options) {
|
|
@@ -217906,12 +219230,30 @@ chatV22.post("/", async (c) => {
|
|
|
217906
219230
|
rpcCollector = createHostedRpcLogCollector(rawBody);
|
|
217907
219231
|
const hostedBody = parseWithSchema(hostedChatSchema, rawBody);
|
|
217908
219232
|
if (!c.get("guestId") && hostedBody.projectId && hostedBody.chatSessionId) {
|
|
217909
|
-
const allowed = await apiSessionWriteAllowed(
|
|
217910
|
-
|
|
217911
|
-
|
|
217912
|
-
|
|
217913
|
-
|
|
217914
|
-
|
|
219233
|
+
const allowed = await apiSessionWriteAllowed(
|
|
219234
|
+
rawBody.origin,
|
|
219235
|
+
async (signal) => {
|
|
219236
|
+
const service = new BrowserSessionService();
|
|
219237
|
+
if (!service.enabled) return { writable: true };
|
|
219238
|
+
return service.agentRequest(
|
|
219239
|
+
"assert_web_writable",
|
|
219240
|
+
{
|
|
219241
|
+
bearer: bearerToken,
|
|
219242
|
+
projectId: hostedBody.projectId,
|
|
219243
|
+
body: { conversationId: hostedBody.chatSessionId },
|
|
219244
|
+
signal: AbortSignal.any([signal, c.req.raw.signal])
|
|
219245
|
+
}
|
|
219246
|
+
);
|
|
219247
|
+
}
|
|
219248
|
+
);
|
|
219249
|
+
if (!allowed)
|
|
219250
|
+
return c.json(
|
|
219251
|
+
{
|
|
219252
|
+
code: "API_SESSION_READ_ONLY",
|
|
219253
|
+
error: "This API session is view-only in Playground. Continue it through the session API."
|
|
219254
|
+
},
|
|
219255
|
+
409
|
|
219256
|
+
);
|
|
217915
219257
|
}
|
|
217916
219258
|
const { initializePins, mcpProtocolVersionsByServerId } = extractMcpInitializeOptions(rawBody);
|
|
217917
219259
|
const body = rawBody;
|
|
@@ -218086,6 +219428,11 @@ chatV22.post("/", async (c) => {
|
|
|
218086
219428
|
error: runtime.error
|
|
218087
219429
|
});
|
|
218088
219430
|
const failClosedMessage = `Couldn't load this scenario's settings, so the turn was stopped to avoid running with the wrong configuration. ${runtime.error}`;
|
|
219431
|
+
if (runtime.code === "SCENARIO_SIGN_IN_REQUIRED") {
|
|
219432
|
+
throw new WebRouteError(401, ErrorCode.UNAUTHORIZED, runtime.error, {
|
|
219433
|
+
code: runtime.code
|
|
219434
|
+
});
|
|
219435
|
+
}
|
|
218089
219436
|
if (runtime.code === "SCENARIO_ACCESS_STALE") {
|
|
218090
219437
|
throw new WebRouteError(
|
|
218091
219438
|
409,
|
|
@@ -220073,8 +221420,8 @@ mcpjamAgent.post("/widget-content", async (c) => {
|
|
|
220073
221420
|
if (!content || typeof content !== "object") {
|
|
220074
221421
|
return webError(c, 404, ErrorCode.NOT_FOUND, "No content in resource");
|
|
220075
221422
|
}
|
|
220076
|
-
const
|
|
220077
|
-
const contentMimeType = typeof
|
|
221423
|
+
const record5 = content;
|
|
221424
|
+
const contentMimeType = typeof record5.mimeType === "string" ? record5.mimeType : void 0;
|
|
220078
221425
|
const mimeTypeValid = contentMimeType !== void 0 && ACCEPTED_WIDGET_MIMETYPES2.has(contentMimeType);
|
|
220079
221426
|
const mimeTypeWarning = !mimeTypeValid ? contentMimeType ? `Invalid mimetype "${contentMimeType}" - expected one of: ${[
|
|
220080
221427
|
...ACCEPTED_WIDGET_MIMETYPES2
|
|
@@ -220082,10 +221429,10 @@ mcpjamAgent.post("/widget-content", async (c) => {
|
|
|
220082
221429
|
...ACCEPTED_WIDGET_MIMETYPES2
|
|
220083
221430
|
].join(", ")}` : null;
|
|
220084
221431
|
let html;
|
|
220085
|
-
if (typeof
|
|
220086
|
-
html =
|
|
220087
|
-
} else if (typeof
|
|
220088
|
-
html = Buffer.from(
|
|
221432
|
+
if (typeof record5.text === "string") {
|
|
221433
|
+
html = record5.text;
|
|
221434
|
+
} else if (typeof record5.blob === "string") {
|
|
221435
|
+
html = Buffer.from(record5.blob, "base64").toString("utf-8");
|
|
220089
221436
|
} else {
|
|
220090
221437
|
return webError(
|
|
220091
221438
|
c,
|
|
@@ -220094,7 +221441,7 @@ mcpjamAgent.post("/widget-content", async (c) => {
|
|
|
220094
221441
|
"No HTML content in resource"
|
|
220095
221442
|
);
|
|
220096
221443
|
}
|
|
220097
|
-
const resourceMeta =
|
|
221444
|
+
const resourceMeta = record5._meta;
|
|
220098
221445
|
const uiMeta = resolveUiResourceMeta({ contentMeta: resourceMeta });
|
|
220099
221446
|
const effectiveCspMode = body.cspMode ?? "permissive";
|
|
220100
221447
|
if (body.injectOpenAiCompat === true) {
|
|
@@ -220875,6 +222222,7 @@ async function runSyntheticHostSession(adapter) {
|
|
|
220875
222222
|
modelDefinition,
|
|
220876
222223
|
systemPrompt,
|
|
220877
222224
|
temperature,
|
|
222225
|
+
maxSteps,
|
|
220878
222226
|
requireToolApproval,
|
|
220879
222227
|
respectToolVisibility,
|
|
220880
222228
|
progressiveToolDiscovery,
|
|
@@ -221252,6 +222600,7 @@ async function runSyntheticHostSession(adapter) {
|
|
|
221252
222600
|
sourceType: persist.sourceType,
|
|
221253
222601
|
systemPrompt: prepared.enhancedSystemPrompt,
|
|
221254
222602
|
temperature: prepared.resolvedTemperature,
|
|
222603
|
+
...maxSteps !== void 0 ? { maxSteps } : {},
|
|
221255
222604
|
// `computer` / `finish_widget` merge into the advertised set; the
|
|
221256
222605
|
// prepareAdvertisedTools hook hides them until a widget is mounted.
|
|
221257
222606
|
tools: { ...prepared.allTools, ...browser.computerWidgetTools },
|
|
@@ -222298,10 +223647,37 @@ async function prepareTargetGrounding(args) {
|
|
|
222298
223647
|
}
|
|
222299
223648
|
}
|
|
222300
223649
|
|
|
223650
|
+
// server/services/checks/swarm-check-evidence.ts
|
|
223651
|
+
var record2 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
223652
|
+
function swarmCheckInventory(envelope) {
|
|
223653
|
+
if (!record2(envelope) || !record2(envelope.recordedContext)) return void 0;
|
|
223654
|
+
const snapshots = envelope.recordedContext.toolSnapshots;
|
|
223655
|
+
if (!Array.isArray(snapshots) || snapshots.length !== 1) return void 0;
|
|
223656
|
+
const entry3 = snapshots[0];
|
|
223657
|
+
if (!record2(entry3) || !record2(entry3.snapshot) || !Array.isArray(entry3.snapshot.servers))
|
|
223658
|
+
return void 0;
|
|
223659
|
+
const tools5 = {};
|
|
223660
|
+
for (const server2 of entry3.snapshot.servers) {
|
|
223661
|
+
if (!record2(server2) || server2.captureError || !Array.isArray(server2.tools))
|
|
223662
|
+
return void 0;
|
|
223663
|
+
for (const tool19 of server2.tools) {
|
|
223664
|
+
if (!record2(tool19) || typeof tool19.name !== "string" || Object.hasOwn(tools5, tool19.name))
|
|
223665
|
+
return void 0;
|
|
223666
|
+
tools5[tool19.name] = {
|
|
223667
|
+
inputSchema: tool19.inputSchema,
|
|
223668
|
+
...typeof tool19.description === "string" ? { description: tool19.description } : {},
|
|
223669
|
+
...record2(tool19.annotations) ? { annotations: tool19.annotations } : {}
|
|
223670
|
+
};
|
|
223671
|
+
}
|
|
223672
|
+
}
|
|
223673
|
+
return toTranscriptToolInventory(tools5);
|
|
223674
|
+
}
|
|
223675
|
+
|
|
222301
223676
|
// server/services/checks/run-predicates-on-chat-session.ts
|
|
222302
223677
|
function extractToolCallsFromEnvelopeMessages(messages) {
|
|
222303
223678
|
return extractToolCallsFromConversation({ messages }).map((toolCall) => ({
|
|
222304
223679
|
toolName: toolCall.toolName,
|
|
223680
|
+
...toolCall.toolCallId ? { toolCallId: toolCall.toolCallId } : {},
|
|
222305
223681
|
arguments: toolCall.arguments ?? {}
|
|
222306
223682
|
}));
|
|
222307
223683
|
}
|
|
@@ -222421,12 +223797,14 @@ async function runSwarmChecks(args) {
|
|
|
222421
223797
|
return { status: "failed", error };
|
|
222422
223798
|
};
|
|
222423
223799
|
const messages = Array.isArray(claim.envelope?.messages) ? claim.envelope.messages : null;
|
|
222424
|
-
if (messages === null) {
|
|
223800
|
+
if (messages === null || messages.length === 0 || claim.envelope?.traceComplete === false) {
|
|
222425
223801
|
return reportFailure("transcript envelope unreadable");
|
|
222426
223802
|
}
|
|
222427
223803
|
let criterionResults;
|
|
222428
223804
|
try {
|
|
222429
223805
|
const transcript = buildIterationTranscript({
|
|
223806
|
+
...extractTranscriptEvidence(claim.envelope),
|
|
223807
|
+
toolInventory: swarmCheckInventory(claim.envelope),
|
|
222430
223808
|
trace: {
|
|
222431
223809
|
messages,
|
|
222432
223810
|
...claim.envelope?.spans ? { spans: claim.envelope.spans } : {}
|
|
@@ -222434,8 +223812,8 @@ async function runSwarmChecks(args) {
|
|
|
222434
223812
|
// The SHARED walker, not a copy: two extractors would let an
|
|
222435
223813
|
// envelope-format or dedupe fix land on one grading path and not the
|
|
222436
223814
|
// other, so the same session could grade differently depending on who
|
|
222437
|
-
// asked.
|
|
222438
|
-
//
|
|
223815
|
+
// asked. Distinct call IDs preserve repeated calls; only duplicate
|
|
223816
|
+
// representations of the same call are collapsed.
|
|
222439
223817
|
toolCalls: extractToolCallsFromEnvelopeMessages(messages),
|
|
222440
223818
|
// Session-level token totals, materialized backend-side from turn-trace
|
|
222441
223819
|
// usage and returned on the claim. `null`/absent means no turn reported
|
|
@@ -222456,6 +223834,9 @@ async function runSwarmChecks(args) {
|
|
|
222456
223834
|
criterionResults = claim.criteria.map((entry3, index) => ({
|
|
222457
223835
|
criterionId: entry3.id,
|
|
222458
223836
|
passed: results[index]?.passed ?? false,
|
|
223837
|
+
// Older evaluators omit status on scored rows; only a missing result
|
|
223838
|
+
// or an explicit evaluator error is unmeasured.
|
|
223839
|
+
status: results[index] ? results[index].status ?? "scored" : "error",
|
|
222459
223840
|
reason: results[index]?.reason ?? "evaluator returned no verdict"
|
|
222460
223841
|
}));
|
|
222461
223842
|
} catch (error) {
|
|
@@ -223261,6 +224642,7 @@ async function withArtifactFlushDeadline(work) {
|
|
|
223261
224642
|
}
|
|
223262
224643
|
}
|
|
223263
224644
|
var MAX_CONCURRENT_TARGETS = 3;
|
|
224645
|
+
var SWARM_PERSONA_TURN_MAX_STEPS = 10;
|
|
223264
224646
|
function targetSessionIdentity(target) {
|
|
223265
224647
|
return {
|
|
223266
224648
|
hostId: target.hostId,
|
|
@@ -223755,6 +225137,7 @@ async function runJourneyFanOut(opts) {
|
|
|
223755
225137
|
modelDefinition,
|
|
223756
225138
|
systemPrompt: target.systemPrompt,
|
|
223757
225139
|
temperature: target.temperature,
|
|
225140
|
+
maxSteps: SWARM_PERSONA_TURN_MAX_STEPS,
|
|
223758
225141
|
requireToolApproval: target.requireToolApproval,
|
|
223759
225142
|
respectToolVisibility: target.respectToolVisibility,
|
|
223760
225143
|
progressiveToolDiscovery: target.progressiveToolDiscovery,
|
|
@@ -223917,7 +225300,7 @@ async function runJourneyFanOut(opts) {
|
|
|
223917
225300
|
error: err instanceof Error ? err.message : String(err)
|
|
223918
225301
|
});
|
|
223919
225302
|
}
|
|
223920
|
-
if (hasRubric
|
|
225303
|
+
if (hasRubric) {
|
|
223921
225304
|
try {
|
|
223922
225305
|
const graded = await runSwarmChecks({
|
|
223923
225306
|
convexHttpUrl: convexHttpUrl3,
|
|
@@ -224499,7 +225882,7 @@ async function launchJourneyRun(deps, input) {
|
|
|
224499
225882
|
// the yes/no — the criteria themselves come back from the claim, so
|
|
224500
225883
|
// the authoritative list is always the backend's pinned copy and
|
|
224501
225884
|
// never a value that rode along in process memory.
|
|
224502
|
-
hasRubric: (snapshot2.rubric?.length ?? 0) > 0,
|
|
225885
|
+
hasRubric: ((snapshot2.standardCheckProfile?.criteria ?? snapshot2.rubric)?.length ?? 0) > 0,
|
|
224503
225886
|
convexHttpUrl: convexHttpUrl3,
|
|
224504
225887
|
getBearer: deps.getRunBearer,
|
|
224505
225888
|
// Host-aware: each host connects ONLY its own pinned required servers
|
|
@@ -225616,10 +226999,10 @@ var ACCEPTED_WIDGET_MIMETYPES3 = /* @__PURE__ */ new Set([
|
|
|
225616
226999
|
]);
|
|
225617
227000
|
function extractHtmlFromResourceContent4(content) {
|
|
225618
227001
|
if (!content || typeof content !== "object") return "";
|
|
225619
|
-
const
|
|
225620
|
-
if (typeof
|
|
225621
|
-
if (typeof
|
|
225622
|
-
return Buffer.from(
|
|
227002
|
+
const record5 = content;
|
|
227003
|
+
if (typeof record5.text === "string") return record5.text;
|
|
227004
|
+
if (typeof record5.blob === "string") {
|
|
227005
|
+
return Buffer.from(record5.blob, "base64").toString("utf-8");
|
|
225623
227006
|
}
|
|
225624
227007
|
return "";
|
|
225625
227008
|
}
|
|
@@ -231749,8 +233132,8 @@ function asArray(value) {
|
|
|
231749
233132
|
return Array.isArray(value) ? value : void 0;
|
|
231750
233133
|
}
|
|
231751
233134
|
function isPredicateRow(value) {
|
|
231752
|
-
const
|
|
231753
|
-
return typeof
|
|
233135
|
+
const record5 = asRecord13(value);
|
|
233136
|
+
return typeof record5?.passed === "boolean" && asRecord13(record5.predicate) !== void 0;
|
|
231754
233137
|
}
|
|
231755
233138
|
function stepErrorFromStoredChain(stageResults) {
|
|
231756
233139
|
const rows = asArray(stageResults);
|
|
@@ -232119,7 +233502,8 @@ async function postServiceRoute(path8, body) {
|
|
|
232119
233502
|
}
|
|
232120
233503
|
async function claimNextStageDerivation(claimedBy) {
|
|
232121
233504
|
const { status, body } = await postServiceRoute(`${BASE_PATH2}/claim`, {
|
|
232122
|
-
claimedBy
|
|
233505
|
+
claimedBy,
|
|
233506
|
+
evidenceVersion: SWARM_STAGE_EVIDENCE_VERSION
|
|
232123
233507
|
});
|
|
232124
233508
|
if (status === 404) return { kind: "disabled" };
|
|
232125
233509
|
if (status !== 200 || !body?.ok) {
|
|
@@ -232253,7 +233637,13 @@ function normalizeCriteria(value) {
|
|
|
232253
233637
|
if (!isRecord37(entry3)) return [];
|
|
232254
233638
|
const criterionId = nonEmptyString4(entry3.criterionId);
|
|
232255
233639
|
if (!criterionId || typeof entry3.passed !== "boolean") return [];
|
|
232256
|
-
return [
|
|
233640
|
+
return [
|
|
233641
|
+
{
|
|
233642
|
+
criterionId,
|
|
233643
|
+
passed: entry3.passed,
|
|
233644
|
+
...entry3.status === "scored" || entry3.status === "error" ? { status: entry3.status } : {}
|
|
233645
|
+
}
|
|
233646
|
+
];
|
|
232257
233647
|
});
|
|
232258
233648
|
const droppedRows = results.length !== value.results.length;
|
|
232259
233649
|
const covered = new Set(results.map((row2) => row2.criterionId));
|
|
@@ -232296,6 +233686,22 @@ function normalizeClaimedEvidence(claim) {
|
|
|
232296
233686
|
const spans = normalizeSpans(envelope.spans);
|
|
232297
233687
|
const readiness2 = normalizeReadiness(claim.evidence.readiness);
|
|
232298
233688
|
const criteria = normalizeCriteria(claim.evidence.criteria);
|
|
233689
|
+
const definitions = claim.evidence.criterionDefinitions;
|
|
233690
|
+
if (criteria?.results && Array.isArray(definitions)) {
|
|
233691
|
+
criteria.results = criteria.results.map((row2) => {
|
|
233692
|
+
const definition = definitions.find(
|
|
233693
|
+
(d) => isRecord37(d) && d.id === row2.criterionId
|
|
233694
|
+
);
|
|
233695
|
+
return isRecord37(definition) && isRecord37(definition.predicate) && typeof definition.predicate.type === "string" ? {
|
|
233696
|
+
...row2,
|
|
233697
|
+
predicate: {
|
|
233698
|
+
type: definition.predicate.type,
|
|
233699
|
+
role: definition.predicate.role === "advisory" ? "advisory" : "required"
|
|
233700
|
+
}
|
|
233701
|
+
} : row2;
|
|
233702
|
+
});
|
|
233703
|
+
}
|
|
233704
|
+
const swarmPolicy = claim.evidence.swarmPolicy;
|
|
232299
233705
|
const goalJudge = normalizeGoalJudge(claim.evidence.goalScore);
|
|
232300
233706
|
return {
|
|
232301
233707
|
ok: true,
|
|
@@ -232306,7 +233712,13 @@ function normalizeClaimedEvidence(claim) {
|
|
|
232306
233712
|
...spans.length > 0 ? { spans } : {},
|
|
232307
233713
|
...readiness2 ? { readiness: readiness2 } : {},
|
|
232308
233714
|
...criteria ? { criteria } : {},
|
|
232309
|
-
...goalJudge ? { goalJudge } : {}
|
|
233715
|
+
...goalJudge ? { goalJudge } : {},
|
|
233716
|
+
...source === "swarm" && isRecord37(swarmPolicy) && typeof swarmPolicy.judgeDecisive === "boolean" && typeof swarmPolicy.requiredCriteria === "number" ? {
|
|
233717
|
+
swarmPolicy: {
|
|
233718
|
+
judgeDecisive: swarmPolicy.judgeDecisive,
|
|
233719
|
+
requiredCriteria: swarmPolicy.requiredCriteria
|
|
233720
|
+
}
|
|
233721
|
+
} : {}
|
|
232310
233722
|
}
|
|
232311
233723
|
};
|
|
232312
233724
|
}
|
|
@@ -233375,8 +234787,8 @@ function measureClientMessage(buffer2, holdsInput) {
|
|
|
233375
234787
|
return decide(20, true);
|
|
233376
234788
|
case RFB_CLIENT_MESSAGE.SET_ENCODINGS: {
|
|
233377
234789
|
if (buffer2.length < 4) return { kind: "incomplete" };
|
|
233378
|
-
const
|
|
233379
|
-
return decide(4 +
|
|
234790
|
+
const count4 = readU16(buffer2, 2);
|
|
234791
|
+
return decide(4 + count4 * 4, true);
|
|
233380
234792
|
}
|
|
233381
234793
|
case RFB_CLIENT_MESSAGE.FRAMEBUFFER_UPDATE_REQUEST:
|
|
233382
234794
|
return decide(10, true);
|
|
@@ -233486,10 +234898,10 @@ function parseProtocolVersion(bytes2) {
|
|
|
233486
234898
|
}
|
|
233487
234899
|
function parseSecurityTypes(bytes2) {
|
|
233488
234900
|
if (bytes2.length < 1) return null;
|
|
233489
|
-
const
|
|
233490
|
-
if (
|
|
233491
|
-
if (bytes2.length < 1 +
|
|
233492
|
-
return Array.from(bytes2.subarray(1, 1 +
|
|
234901
|
+
const count4 = bytes2[0];
|
|
234902
|
+
if (count4 === 0) return [];
|
|
234903
|
+
if (bytes2.length < 1 + count4) return null;
|
|
234904
|
+
return Array.from(bytes2.subarray(1, 1 + count4));
|
|
233493
234905
|
}
|
|
233494
234906
|
function vncPasswordKey(password) {
|
|
233495
234907
|
const key = Buffer.alloc(8, 0);
|
|
@@ -233895,14 +235307,14 @@ function createComputerBrowserFramesWsHandler(upgradeWebSocket2, deps = {}) {
|
|
|
233895
235307
|
...args.codec ? { codec: args.codec } : {},
|
|
233896
235308
|
...args.sharp ? { sharp: true } : {},
|
|
233897
235309
|
...args.onVideo ? {
|
|
233898
|
-
onVideo: (
|
|
233899
|
-
key:
|
|
233900
|
-
au:
|
|
233901
|
-
deviceWidth:
|
|
233902
|
-
deviceHeight:
|
|
233903
|
-
scale:
|
|
233904
|
-
ts:
|
|
233905
|
-
seq:
|
|
235310
|
+
onVideo: (record5) => args.onVideo?.({
|
|
235311
|
+
key: record5.kind === FRAME_STREAM_KIND.video_key,
|
|
235312
|
+
au: record5.au,
|
|
235313
|
+
deviceWidth: record5.deviceWidth,
|
|
235314
|
+
deviceHeight: record5.deviceHeight,
|
|
235315
|
+
scale: record5.scale,
|
|
235316
|
+
ts: record5.ts,
|
|
235317
|
+
seq: record5.seq
|
|
233906
235318
|
})
|
|
233907
235319
|
} : {},
|
|
233908
235320
|
signal: args.signal,
|
|
@@ -234112,20 +235524,20 @@ function createComputerBrowserFramesWsHandler(upgradeWebSocket2, deps = {}) {
|
|
|
234112
235524
|
...videoAgreed ? { codec: "h264" } : {},
|
|
234113
235525
|
...sharpAgreed ? { sharp: true } : {},
|
|
234114
235526
|
...videoAgreed ? {
|
|
234115
|
-
onVideo: (
|
|
235527
|
+
onVideo: (record5) => {
|
|
234116
235528
|
if (closed) {
|
|
234117
235529
|
stats3?.countDrop();
|
|
234118
235530
|
return;
|
|
234119
235531
|
}
|
|
234120
235532
|
const bytes2 = new Uint8Array(
|
|
234121
235533
|
encodeFrameStreamRecord({
|
|
234122
|
-
kind:
|
|
234123
|
-
deviceWidth:
|
|
234124
|
-
deviceHeight:
|
|
234125
|
-
scale:
|
|
235534
|
+
kind: record5.key ? FRAME_STREAM_KIND.video_key : FRAME_STREAM_KIND.video_delta,
|
|
235535
|
+
deviceWidth: record5.deviceWidth,
|
|
235536
|
+
deviceHeight: record5.deviceHeight,
|
|
235537
|
+
scale: record5.scale,
|
|
234126
235538
|
ts: Date.now(),
|
|
234127
|
-
seq:
|
|
234128
|
-
au:
|
|
235539
|
+
seq: record5.seq,
|
|
235540
|
+
au: record5.au
|
|
234129
235541
|
})
|
|
234130
235542
|
);
|
|
234131
235543
|
stats3?.offer(bytes2.byteLength, () => ws.send(bytes2));
|
|
@@ -234732,6 +236144,13 @@ function translateConvexWriteError(error, options) {
|
|
|
234732
236144
|
structuredMessage ?? "This feature is not available for your organization."
|
|
234733
236145
|
);
|
|
234734
236146
|
}
|
|
236147
|
+
if (code === "SIGN_IN_REQUIRED") {
|
|
236148
|
+
return new WebRouteError(
|
|
236149
|
+
401,
|
|
236150
|
+
ErrorCode.UNAUTHORIZED,
|
|
236151
|
+
structuredMessage ?? "Sign in to use this feature."
|
|
236152
|
+
);
|
|
236153
|
+
}
|
|
234735
236154
|
if (code === "EVAL_COMPARE_BASELINE_CONFLICT" || code === "EVAL_COMPARE_BASELINE_INVALID") {
|
|
234736
236155
|
return new WebRouteError(
|
|
234737
236156
|
400,
|
|
@@ -235465,8 +236884,8 @@ tools4.post(
|
|
|
235465
236884
|
);
|
|
235466
236885
|
const durationMs = Math.max(0, Date.now() - startedAt);
|
|
235467
236886
|
if (result && typeof result === "object" && !Array.isArray(result)) {
|
|
235468
|
-
const
|
|
235469
|
-
return "durationMs" in
|
|
236887
|
+
const record5 = result;
|
|
236888
|
+
return "durationMs" in record5 ? record5 : { ...record5, durationMs };
|
|
235470
236889
|
}
|
|
235471
236890
|
return result;
|
|
235472
236891
|
},
|
|
@@ -235750,12 +237169,12 @@ var ITERATION_SCORE_INTEGRITY = /* @__PURE__ */ new Set(["score_integrity_invali
|
|
|
235750
237169
|
var RUN_SCORE_INTEGRITY = /* @__PURE__ */ new Set(["valid", "invalid"]);
|
|
235751
237170
|
function toScoreProjection(metadata, vocabulary = 1) {
|
|
235752
237171
|
if (!metadata || typeof metadata !== "object") return {};
|
|
235753
|
-
const
|
|
235754
|
-
const integrity = typeof
|
|
237172
|
+
const record5 = metadata;
|
|
237173
|
+
const integrity = typeof record5.scoreIntegrity === "string" && ITERATION_SCORE_INTEGRITY.has(record5.scoreIntegrity) ? { scoreIntegrity: record5.scoreIntegrity } : {};
|
|
235755
237174
|
if ("scoreIntegrity" in integrity) return integrity;
|
|
235756
|
-
const scores = scoreResultArraySchema.safeParse(
|
|
237175
|
+
const scores = scoreResultArraySchema.safeParse(record5.scores);
|
|
235757
237176
|
const config = evaluationConfigSnapshotSchema2.safeParse(
|
|
235758
|
-
|
|
237177
|
+
record5.evaluationConfig
|
|
235759
237178
|
);
|
|
235760
237179
|
if (!scores.success || !config.success) return {};
|
|
235761
237180
|
return {
|
|
@@ -235944,12 +237363,12 @@ function costCoverage(value) {
|
|
|
235944
237363
|
const source = value;
|
|
235945
237364
|
const side = (raw) => {
|
|
235946
237365
|
const inner = isRecord38(raw) ? raw : {};
|
|
235947
|
-
const
|
|
237366
|
+
const count4 = (raw2) => {
|
|
235948
237367
|
const n = numOrNull(raw2);
|
|
235949
237368
|
return typeof n === "number" && Number.isSafeInteger(n) && n >= 0 ? n : 0;
|
|
235950
237369
|
};
|
|
235951
|
-
const costed =
|
|
235952
|
-
const total =
|
|
237370
|
+
const costed = count4(inner.costed);
|
|
237371
|
+
const total = count4(inner.total);
|
|
235953
237372
|
return { costed: costed <= total ? costed : 0, total };
|
|
235954
237373
|
};
|
|
235955
237374
|
return { base: side(source.base), compare: side(source.compare) };
|
|
@@ -237706,15 +239125,15 @@ function internalCaseToSteps(testCase) {
|
|
|
237706
239125
|
}
|
|
237707
239126
|
function toPublicCaseImportClaim(raw) {
|
|
237708
239127
|
if (!raw || typeof raw !== "object") return void 0;
|
|
237709
|
-
const
|
|
237710
|
-
const status =
|
|
239128
|
+
const record5 = raw;
|
|
239129
|
+
const status = record5.status;
|
|
237711
239130
|
if (typeof status !== "string" || !IMPORT_MAPPING_STATUSES2.includes(status)) {
|
|
237712
239131
|
return void 0;
|
|
237713
239132
|
}
|
|
237714
239133
|
return {
|
|
237715
239134
|
status,
|
|
237716
|
-
...typeof
|
|
237717
|
-
...typeof
|
|
239135
|
+
...typeof record5.sourceCaseKey === "string" && record5.sourceCaseKey ? { sourceCaseKey: record5.sourceCaseKey } : {},
|
|
239136
|
+
...typeof record5.note === "string" && record5.note ? { note: record5.note } : {}
|
|
237718
239137
|
};
|
|
237719
239138
|
}
|
|
237720
239139
|
function toCaseDto(testCase, vocabulary = 1) {
|
|
@@ -249040,6 +250459,8 @@ function toJourneyRunDto(row2) {
|
|
|
249040
250459
|
id: row2._id,
|
|
249041
250460
|
projectId: row2.projectId,
|
|
249042
250461
|
journeyId: row2.journeyRefId,
|
|
250462
|
+
...row2.verdictSummary ? { verdictSummary: row2.verdictSummary } : {},
|
|
250463
|
+
...row2.report ? { report: row2.report } : {},
|
|
249043
250464
|
// `swarmRunGroupId` upstream. Renamed because the public meaning is "the
|
|
249044
250465
|
// batch this run was launched with", and every run of a solo relaunch is
|
|
249045
250466
|
// a wave of one.
|
|
@@ -249096,6 +250517,9 @@ function toJourneySessionDto(row2, outcome) {
|
|
|
249096
250517
|
* A caller that listed a run's sessions could not then look one of them up.
|
|
249097
250518
|
*/
|
|
249098
250519
|
id: row2.id,
|
|
250520
|
+
...row2.verdict ? { verdict: row2.verdict } : {},
|
|
250521
|
+
...row2.observations ? { observations: row2.observations } : {},
|
|
250522
|
+
...row2.criteria ? { criteria: row2.criteria } : {},
|
|
249099
250523
|
/**
|
|
249100
250524
|
* The runtime key, kept but named for what it is. It is what the chat
|
|
249101
250525
|
* transport and the app's own deep links use, so dropping it would strand
|
|
@@ -252150,7 +253574,7 @@ var evalBacktestRequestSchema2 = evalBacktestDraftSchema4.extend({
|
|
|
252150
253574
|
});
|
|
252151
253575
|
|
|
252152
253576
|
// server/services/evals/assertion-backtest.ts
|
|
252153
|
-
var
|
|
253577
|
+
var record3 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
252154
253578
|
function originalResults(row2) {
|
|
252155
253579
|
return Array.isArray(row2.results) ? row2.results.flatMap((value) => {
|
|
252156
253580
|
const parsed = scoreResultSchema2.safeParse(value);
|
|
@@ -252159,7 +253583,7 @@ function originalResults(row2) {
|
|
|
252159
253583
|
}
|
|
252160
253584
|
function rulesFor(row2, draft) {
|
|
252161
253585
|
if (draft.assertions.mode === "replace") return draft.assertions.list;
|
|
252162
|
-
const original = Array.isArray(row2.predicates) ? row2.predicates :
|
|
253586
|
+
const original = Array.isArray(row2.predicates) ? row2.predicates : record3(row2.predicates) && Array.isArray(row2.predicates.list) ? row2.predicates.list : null;
|
|
252163
253587
|
if (!original || original.length + draft.assertions.list.length > 100)
|
|
252164
253588
|
return null;
|
|
252165
253589
|
const rules = [];
|
|
@@ -252191,7 +253615,7 @@ function backtestIteration(row2, draft) {
|
|
|
252191
253615
|
trace: { messages: evidence?.messages ?? [] }
|
|
252192
253616
|
});
|
|
252193
253617
|
const evaluated = missing ? [] : evaluatePredicates(transcript, rules);
|
|
252194
|
-
const definitions =
|
|
253618
|
+
const definitions = record3(row2.evaluationConfig) && Array.isArray(row2.evaluationConfig.definitions) ? row2.evaluationConfig.definitions.flatMap((value) => {
|
|
252195
253619
|
const parsed = resolvedScoreDefinitionSchema2.safeParse(value);
|
|
252196
253620
|
return parsed.success ? [parsed.data] : [];
|
|
252197
253621
|
}) : [];
|
|
@@ -252306,7 +253730,7 @@ async function runAssertionBacktest(input) {
|
|
|
252306
253730
|
const differences = [];
|
|
252307
253731
|
const seen = /* @__PURE__ */ new Set();
|
|
252308
253732
|
let page3;
|
|
252309
|
-
let
|
|
253733
|
+
let count4 = 0;
|
|
252310
253734
|
for (let n = 0; n < 10; n++) {
|
|
252311
253735
|
if (input.signal?.aborted) throw new Error("Backtest cancelled");
|
|
252312
253736
|
const priorPage = page3;
|
|
@@ -252355,7 +253779,7 @@ async function runAssertionBacktest(input) {
|
|
|
252355
253779
|
throw new Error("Duplicate or invalid backtest iteration identity");
|
|
252356
253780
|
seen.add(row2.iterationId);
|
|
252357
253781
|
differences.push(...backtestIteration(row2, draft));
|
|
252358
|
-
|
|
253782
|
+
count4++;
|
|
252359
253783
|
if (Date.now() > deadline2) throw new Error("Backtest deadline exceeded");
|
|
252360
253784
|
}
|
|
252361
253785
|
if (page3.isDone) break;
|
|
@@ -252368,7 +253792,7 @@ async function runAssertionBacktest(input) {
|
|
|
252368
253792
|
sourceHash: page3.sourceHash,
|
|
252369
253793
|
draftHash,
|
|
252370
253794
|
configRevision: page3.configRevision,
|
|
252371
|
-
complete: page3.isDone &&
|
|
253795
|
+
complete: page3.isDone && count4 > 0 && differences.length > 0 && comparable === differences.length,
|
|
252372
253796
|
continuationAvailable: !page3.isDone,
|
|
252373
253797
|
...!page3.isDone ? {
|
|
252374
253798
|
continuation: {
|
|
@@ -252379,7 +253803,7 @@ async function runAssertionBacktest(input) {
|
|
|
252379
253803
|
}
|
|
252380
253804
|
} : {},
|
|
252381
253805
|
counts: {
|
|
252382
|
-
iterations:
|
|
253806
|
+
iterations: count4,
|
|
252383
253807
|
comparable,
|
|
252384
253808
|
ungradable: differences.length - comparable,
|
|
252385
253809
|
flipped: differences.filter((row2) => row2.flipped).length
|
|
@@ -253083,8 +254507,8 @@ function describeClientImpact(input) {
|
|
|
253083
254507
|
[n("scenarioAttachmentCount"), "scenario attachment"],
|
|
253084
254508
|
[n("activeLegacyJourneyCount"), "active legacy journey"]
|
|
253085
254509
|
];
|
|
253086
|
-
const total = parts.reduce((sum2, [
|
|
253087
|
-
const listed = parts.map(([
|
|
254510
|
+
const total = parts.reduce((sum2, [count4]) => sum2 + count4, 0);
|
|
254511
|
+
const listed = parts.map(([count4, noun]) => `${count4} ${noun}${count4 === 1 ? "" : "s"}`).join(", ");
|
|
253088
254512
|
const affected = total === 0 ? "Nothing durable currently uses this client" : `This will affect ${listed}`;
|
|
253089
254513
|
return `${affected}; future direct client and playground use also follows the edit. ${unchanged}`;
|
|
253090
254514
|
}
|
|
@@ -253837,7 +255261,7 @@ var AGENT_OP_REGISTRY = [
|
|
|
253837
255261
|
confirmSeverity: "none"
|
|
253838
255262
|
},
|
|
253839
255263
|
promptNotes: [
|
|
253840
|
-
"- `propose_eval_description_rewrite` returns a proposing receipt, not a finished rewrite. Poll `get_eval_description_experiment` until status is proposed (or failed). Requesting again
|
|
255264
|
+
"- `propose_eval_description_rewrite` returns a proposing receipt, not a finished rewrite. Poll `get_eval_description_experiment` until status is proposed (or failed). Requesting again runs another analysis against MCPJam's daily analysis budget."
|
|
253841
255265
|
]
|
|
253842
255266
|
},
|
|
253843
255267
|
{
|
|
@@ -254147,7 +255571,8 @@ var AGENT_OP_REGISTRY = [
|
|
|
254147
255571
|
confirmSeverity: "none"
|
|
254148
255572
|
},
|
|
254149
255573
|
promptNotes: [
|
|
254150
|
-
"- `request_wave_insights` consumes no credits, but it counts against a daily insight QUOTA shared with user-testing insights \u2014 a request here takes one from there. Read the run scorecards first; they cost no quota and usually explain the failure without a model pass."
|
|
255574
|
+
"- `request_wave_insights` consumes no credits, but it counts against a daily insight QUOTA shared with user-testing insights \u2014 a request here takes one from there. Read the run scorecards first; they cost no quota and usually explain the failure without a model pass.",
|
|
255575
|
+
"- Included operations (generation and insights) can be refused with `RATE_LIMITED`. `canTopUp` is false on those refusals: tell the user when it lifts (`retryAfterSeconds`, or 00:00 UTC for a daily budget), and do not retry sooner, suggest topping up credits, or switch identities to get around it."
|
|
254151
255576
|
]
|
|
254152
255577
|
},
|
|
254153
255578
|
// ── USER TESTING ──────────────────────────────────────────────────────
|
|
@@ -255420,9 +256845,9 @@ proposedActions.post(
|
|
|
255420
256845
|
"Approved actions can only be executed from the surface that collected the approval."
|
|
255421
256846
|
);
|
|
255422
256847
|
}
|
|
255423
|
-
let
|
|
256848
|
+
let record5;
|
|
255424
256849
|
try {
|
|
255425
|
-
|
|
256850
|
+
record5 = await getProposedAction(actionId);
|
|
255426
256851
|
} catch (error) {
|
|
255427
256852
|
logger.error("[v1/proposed-actions] could not read the proposal", {
|
|
255428
256853
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -255434,20 +256859,20 @@ proposedActions.post(
|
|
|
255434
256859
|
"Could not reach MCPJam to check that approval. Try again in a moment."
|
|
255435
256860
|
);
|
|
255436
256861
|
}
|
|
255437
|
-
const recordTenantId =
|
|
255438
|
-
if (!
|
|
256862
|
+
const recordTenantId = record5?.surfaceTenantId ?? record5?.teamId ?? null;
|
|
256863
|
+
if (!record5 || (record5.surface ?? "slack") !== actor.surfaceKind || recordTenantId !== actor.tenantId) {
|
|
255439
256864
|
return v1Error(c, "NOT_FOUND", "That approval is no longer available.");
|
|
255440
256865
|
}
|
|
255441
|
-
if (
|
|
256866
|
+
if (record5.organizationId !== actor.organizationId) {
|
|
255442
256867
|
return v1Error(c, "NOT_FOUND", "That approval is no longer available.");
|
|
255443
256868
|
}
|
|
255444
|
-
if (
|
|
256869
|
+
if (record5.projectId !== projectId) {
|
|
255445
256870
|
return v1Error(c, "NOT_FOUND", "That approval is no longer available.");
|
|
255446
256871
|
}
|
|
255447
|
-
const operation = GATED_BY_NAME2.get(
|
|
256872
|
+
const operation = GATED_BY_NAME2.get(record5.operation);
|
|
255448
256873
|
if (!operation) {
|
|
255449
256874
|
logger.warn("[v1/proposed-actions] proposal names an unknown operation", {
|
|
255450
|
-
operation:
|
|
256875
|
+
operation: record5.operation.slice(0, 100).replace(/[\r\n]/g, "")
|
|
255451
256876
|
});
|
|
255452
256877
|
return v1Error(
|
|
255453
256878
|
c,
|
|
@@ -255468,7 +256893,7 @@ proposedActions.post(
|
|
|
255468
256893
|
"Could not check your organization's settings right now. Try again in a moment."
|
|
255469
256894
|
);
|
|
255470
256895
|
}
|
|
255471
|
-
if (disabledOperations.has(
|
|
256896
|
+
if (disabledOperations.has(record5.operation)) {
|
|
255472
256897
|
return v1Error(
|
|
255473
256898
|
c,
|
|
255474
256899
|
"FORBIDDEN",
|
|
@@ -255510,7 +256935,7 @@ proposedActions.post(
|
|
|
255510
256935
|
}
|
|
255511
256936
|
return v1Error(c, "NOT_FOUND", "That approval is no longer available.");
|
|
255512
256937
|
}
|
|
255513
|
-
if (claim.operation !==
|
|
256938
|
+
if (claim.operation !== record5.operation || claim.projectId !== record5.projectId) {
|
|
255514
256939
|
logger.error(
|
|
255515
256940
|
"[v1/proposed-actions] claim diverged from the pre-claim read",
|
|
255516
256941
|
{ actionId }
|
|
@@ -256240,15 +257665,15 @@ var commandSchema2 = z84.discriminatedUnion("op", [
|
|
|
256240
257665
|
|
|
256241
257666
|
// server/services/browser-tool-evidence.ts
|
|
256242
257667
|
var MAX_SCREENSHOT_CHARS = 512e3;
|
|
256243
|
-
var
|
|
257668
|
+
var record4 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
256244
257669
|
function screenshotOf(value) {
|
|
256245
|
-
const obj =
|
|
257670
|
+
const obj = record4(value);
|
|
256246
257671
|
if (!obj) return void 0;
|
|
256247
257672
|
if (typeof obj.screenshot === "string") return obj.screenshot;
|
|
256248
257673
|
for (const key of ["page", "output", "result"]) {
|
|
256249
|
-
const nested =
|
|
257674
|
+
const nested = record4(obj[key]);
|
|
256250
257675
|
if (typeof nested?.screenshot === "string") return nested.screenshot;
|
|
256251
|
-
const page3 =
|
|
257676
|
+
const page3 = record4(nested?.page);
|
|
256252
257677
|
if (typeof page3?.screenshot === "string") return page3.screenshot;
|
|
256253
257678
|
}
|
|
256254
257679
|
return void 0;
|
|
@@ -256264,7 +257689,7 @@ function capture(raw) {
|
|
|
256264
257689
|
function redactBrowserScreenshots(value, pointer) {
|
|
256265
257690
|
if (Array.isArray(value))
|
|
256266
257691
|
return value.map((item) => redactBrowserScreenshots(item, pointer));
|
|
256267
|
-
const obj =
|
|
257692
|
+
const obj = record4(value);
|
|
256268
257693
|
if (!obj) return value;
|
|
256269
257694
|
if (obj.type === "image-data" || obj.type === "image" || obj.type === "image_url")
|
|
256270
257695
|
return {
|
|
@@ -256320,7 +257745,7 @@ function wrapBrowserToolsForEvidence(tools5, args) {
|
|
|
256320
257745
|
source: "browser_tool",
|
|
256321
257746
|
ts: started2,
|
|
256322
257747
|
elapsedMs: Date.now() - started2,
|
|
256323
|
-
ok: result !== void 0 && !
|
|
257748
|
+
ok: result !== void 0 && !record4(result)?.error && record4(result)?.ok !== false,
|
|
256324
257749
|
...image ? { screenshotBase64: image.base64 } : {}
|
|
256325
257750
|
});
|
|
256326
257751
|
if (image && url) {
|
|
@@ -256340,7 +257765,7 @@ function wrapBrowserToolsForEvidence(tools5, args) {
|
|
|
256340
257765
|
function redactBrowserEvidenceTree(value, evidence) {
|
|
256341
257766
|
if (Array.isArray(value))
|
|
256342
257767
|
return value.map((item2) => redactBrowserEvidenceTree(item2, evidence));
|
|
256343
|
-
const obj =
|
|
257768
|
+
const obj = record4(value);
|
|
256344
257769
|
if (!obj) return value;
|
|
256345
257770
|
const item = evidence.find((entry3) => entry3.toolCallId === obj.toolCallId);
|
|
256346
257771
|
if (item) return redactBrowserScreenshots(obj, item);
|
|
@@ -256937,31 +258362,31 @@ function readToolOutput2(output) {
|
|
|
256937
258362
|
if (!output || typeof output !== "object" || Array.isArray(output)) {
|
|
256938
258363
|
return output;
|
|
256939
258364
|
}
|
|
256940
|
-
const
|
|
256941
|
-
if (typeof
|
|
256942
|
-
return
|
|
258365
|
+
const record5 = output;
|
|
258366
|
+
if (typeof record5.type === "string" && "value" in record5) {
|
|
258367
|
+
return record5.value;
|
|
256943
258368
|
}
|
|
256944
258369
|
return output;
|
|
256945
258370
|
}
|
|
256946
258371
|
function isErrorOutput(output) {
|
|
256947
258372
|
if (!output || typeof output !== "object") return false;
|
|
256948
|
-
const
|
|
256949
|
-
if (
|
|
256950
|
-
const value = "value" in
|
|
258373
|
+
const record5 = output;
|
|
258374
|
+
if (record5.type === "error-json" || record5.type === "error-text") return true;
|
|
258375
|
+
const value = "value" in record5 ? record5.value : output;
|
|
256951
258376
|
return Boolean(
|
|
256952
258377
|
value && typeof value === "object" && value.isError === true
|
|
256953
258378
|
);
|
|
256954
258379
|
}
|
|
256955
258380
|
function projectMessages(messages, offset) {
|
|
256956
258381
|
return messages.map((message, position) => {
|
|
256957
|
-
const
|
|
258382
|
+
const record5 = message && typeof message === "object" ? message : {};
|
|
256958
258383
|
const bounded = boundPayload(
|
|
256959
|
-
|
|
258384
|
+
record5.content ?? record5.parts ?? message,
|
|
256960
258385
|
MAX_MESSAGE_PAYLOAD_CHARS
|
|
256961
258386
|
);
|
|
256962
258387
|
return {
|
|
256963
258388
|
index: offset + position,
|
|
256964
|
-
role: typeof
|
|
258389
|
+
role: typeof record5.role === "string" ? record5.role : "unknown",
|
|
256965
258390
|
content: bounded.value,
|
|
256966
258391
|
...bounded.truncated ? { truncated: true } : {}
|
|
256967
258392
|
};
|
|
@@ -262041,12 +263466,12 @@ function verifySlackLinkState(token, secret, now = Date.now()) {
|
|
|
262041
263466
|
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
262042
263467
|
return null;
|
|
262043
263468
|
}
|
|
262044
|
-
const
|
|
262045
|
-
if (typeof
|
|
263469
|
+
const record5 = payload;
|
|
263470
|
+
if (typeof record5.linkSessionId !== "string" || record5.linkSessionId.length === 0 || typeof record5.exp !== "number") {
|
|
262046
263471
|
return null;
|
|
262047
263472
|
}
|
|
262048
|
-
if (
|
|
262049
|
-
return { linkSessionId:
|
|
263473
|
+
if (record5.exp <= now) return null;
|
|
263474
|
+
return { linkSessionId: record5.linkSessionId, exp: record5.exp };
|
|
262050
263475
|
}
|
|
262051
263476
|
function hashOauthState(state) {
|
|
262052
263477
|
return createHash30("sha256").update(state).digest("hex");
|
|
@@ -263169,20 +264594,20 @@ function verifyCliAuthState(token, secret, now = Date.now()) {
|
|
|
263169
264594
|
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
263170
264595
|
return null;
|
|
263171
264596
|
}
|
|
263172
|
-
const
|
|
263173
|
-
if (typeof
|
|
264597
|
+
const record5 = payload;
|
|
264598
|
+
if (typeof record5.cliRedirectUri !== "string" || typeof record5.cliState !== "string" || typeof record5.exp !== "number") {
|
|
263174
264599
|
return null;
|
|
263175
264600
|
}
|
|
263176
|
-
if (
|
|
264601
|
+
if (record5.exp <= now) {
|
|
263177
264602
|
return null;
|
|
263178
264603
|
}
|
|
263179
|
-
if (!isAllowedLoopbackRedirect(
|
|
264604
|
+
if (!isAllowedLoopbackRedirect(record5.cliRedirectUri)) {
|
|
263180
264605
|
return null;
|
|
263181
264606
|
}
|
|
263182
264607
|
return {
|
|
263183
|
-
cliRedirectUri:
|
|
263184
|
-
cliState:
|
|
263185
|
-
exp:
|
|
264608
|
+
cliRedirectUri: record5.cliRedirectUri,
|
|
264609
|
+
cliState: record5.cliState,
|
|
264610
|
+
exp: record5.exp
|
|
263186
264611
|
};
|
|
263187
264612
|
}
|
|
263188
264613
|
function isAllowedLoopbackRedirect(uri) {
|
|
@@ -264534,8 +265959,8 @@ async function startNetworkMonitor(sandbox, context) {
|
|
|
264534
265959
|
}
|
|
264535
265960
|
continue;
|
|
264536
265961
|
}
|
|
264537
|
-
const
|
|
264538
|
-
if (!
|
|
265962
|
+
const record5 = parseConnectionRecord(line2);
|
|
265963
|
+
if (!record5 || records >= RECORD_LIMIT_PER_MINUTE || total >= TOTAL_RECORD_LIMIT) {
|
|
264539
265964
|
dropped++;
|
|
264540
265965
|
continue;
|
|
264541
265966
|
}
|
|
@@ -264543,7 +265968,7 @@ async function startNetworkMonitor(sandbox, context) {
|
|
|
264543
265968
|
records++;
|
|
264544
265969
|
total++;
|
|
264545
265970
|
logger.info("[github-checks] network connection", {
|
|
264546
|
-
...
|
|
265971
|
+
...record5,
|
|
264547
265972
|
...base,
|
|
264548
265973
|
observedAt: now
|
|
264549
265974
|
});
|
|
@@ -265389,10 +266814,10 @@ function matchesServerCapabilitiesSchema(value) {
|
|
|
265389
266814
|
if (capability !== void 0 && !isPlainObject11(capability)) return false;
|
|
265390
266815
|
}
|
|
265391
266816
|
for (const field of ["experimental", "extensions"]) {
|
|
265392
|
-
const
|
|
265393
|
-
if (
|
|
265394
|
-
if (!isPlainObject11(
|
|
265395
|
-
const entries = Object.values(
|
|
266817
|
+
const record5 = capabilities2[field];
|
|
266818
|
+
if (record5 === void 0) continue;
|
|
266819
|
+
if (!isPlainObject11(record5)) return false;
|
|
266820
|
+
const entries = Object.values(record5);
|
|
265396
266821
|
if (!entries.every((entry3) => isPlainObject11(entry3))) return false;
|
|
265397
266822
|
}
|
|
265398
266823
|
for (const [field, flags] of CAPABILITY_BOOLEAN_FLAGS) {
|
|
@@ -266447,13 +267872,13 @@ function kindForMode(mode) {
|
|
|
266447
267872
|
}
|
|
266448
267873
|
function parseLsFilesEntries(stdout) {
|
|
266449
267874
|
const out = [];
|
|
266450
|
-
for (const
|
|
266451
|
-
if (
|
|
266452
|
-
const tab =
|
|
267875
|
+
for (const record5 of stdout.split("\0")) {
|
|
267876
|
+
if (record5.length === 0) continue;
|
|
267877
|
+
const tab = record5.indexOf(" ");
|
|
266453
267878
|
if (tab === -1) continue;
|
|
266454
|
-
const path8 =
|
|
267879
|
+
const path8 = record5.slice(tab + 1);
|
|
266455
267880
|
if (path8.length === 0) continue;
|
|
266456
|
-
const mode =
|
|
267881
|
+
const mode = record5.slice(0, tab).split(" ")[0] ?? "";
|
|
266457
267882
|
out.push({ path: path8, kind: kindForMode(mode) });
|
|
266458
267883
|
if (out.length >= MAX_REPO_FILES) break;
|
|
266459
267884
|
}
|
|
@@ -266635,8 +268060,8 @@ function parseListenerReport(stdout) {
|
|
|
266635
268060
|
try {
|
|
266636
268061
|
const parsed = JSON.parse(line2.slice(LISTENER_MARKER.length + 1));
|
|
266637
268062
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
266638
|
-
const
|
|
266639
|
-
const processes = Array.isArray(
|
|
268063
|
+
const record5 = parsed;
|
|
268064
|
+
const processes = Array.isArray(record5.processes) ? record5.processes : [];
|
|
266640
268065
|
return { processes };
|
|
266641
268066
|
} catch {
|
|
266642
268067
|
return null;
|