@mcpjam/inspector 3.12.7 → 3.12.9
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/{OAuthDesktopReturnNotice-DUuacpVO.js → OAuthDesktopReturnNotice-DlTJhJwy.js} +5 -5
- package/dist/client/assets/OAuthDesktopReturnNotice-FnFv52Ym.css +2 -0
- package/dist/client/assets/{app-bootstrap-DiOYsEwh.js → app-bootstrap-BtbHLWDU.js} +335 -335
- package/dist/client/assets/button-12hqsTUk.js +3 -0
- package/dist/client/assets/{chunk-YOKDWASO-B2XCf4h4.js → chunk-YOKDWASO--Bd-6XAf.js} +10 -10
- package/dist/client/assets/{dead-clicks-autocapture-BAMovRYs.js → dead-clicks-autocapture-RCao2exY.js} +2 -2
- package/dist/client/assets/error-reporting-D3byeSLw.js +1 -0
- package/dist/client/assets/{error-reporting-BrfSwhO1.js → error-reporting-StyhxjHz.js} +40 -40
- package/dist/client/assets/{exception-autocapture-D5Eikj0K.js → exception-autocapture-CzpTtsxv.js} +2 -2
- package/dist/client/assets/{failed-request-tracker-CYWaDq0H.js → failed-request-tracker-CmHxaDPF.js} +2 -2
- package/dist/client/assets/highlighted-body-KPVGNVTW-BweERQbm.js +3 -0
- package/dist/client/assets/index-C0SfPmai.js +4 -0
- package/dist/client/assets/{jszip.min-BtiG5GuL.js → jszip.min-BmAHHtmZ.js} +2 -2
- package/dist/client/assets/mermaid-HWGCJPDP-C6s_jIuz.js +1 -0
- package/dist/client/assets/{posthog-recorder-D-Nq98cg.js → posthog-recorder-wc41pimR.js} +2 -2
- package/dist/client/assets/preload-helper-B22rzauv.js +3 -0
- package/dist/client/assets/react-BzkNdoI5.js +3 -0
- package/dist/client/assets/{rolldown-runtime-1PqeXL0B.js → rolldown-runtime-BNuWddGb.js} +1 -1
- package/dist/client/assets/{surveys-olC_pHGU.js → surveys-D-NcCeqw.js} +2 -2
- package/dist/client/assets/trace-timeline-Bg58ukyI.js +1 -0
- package/dist/client/assets/{trace-timeline-fl51h9sN.js → trace-timeline-CxoCCEiW.js} +8 -8
- package/dist/client/assets/{web-vitals-CIP57d68.js → web-vitals-D4bU8W1t.js} +2 -2
- package/dist/client/index.html +8 -7
- package/dist/server/{chunk-FQTRKEDA.js → chunk-DGAFFBDM.js} +2 -2
- package/dist/server/{chunk-76PAQUEP.js → chunk-WZVZ6LQX.js} +2 -2
- package/dist/server/harness-install-cli.js +1 -1
- package/dist/server/index.js +322 -86
- package/dist/server/{local-turn-3DH4OF7C.js → local-turn-ZWMMQGV3.js} +3 -3
- package/package.json +2 -2
- package/dist/client/assets/OAuthDesktopReturnNotice-B_x9xTE-.css +0 -2
- package/dist/client/assets/button-F4pHUjYC.js +0 -3
- package/dist/client/assets/error-reporting-CWlEVH2b.js +0 -1
- package/dist/client/assets/highlighted-body-KPVGNVTW-BjkaxPPc.js +0 -3
- package/dist/client/assets/index-B-8CVYYi.js +0 -4
- package/dist/client/assets/mermaid-HWGCJPDP-CYPKMbVd.js +0 -1
- package/dist/client/assets/preload-helper-CC679xXH.js +0 -3
- package/dist/client/assets/trace-timeline-D2FsrVpF.js +0 -1
package/dist/server/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
stopLocalHarnessProject,
|
|
29
29
|
stopLocalHarnessWorkspace,
|
|
30
30
|
validateWorkspaceCandidate
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-DGAFFBDM.js";
|
|
32
32
|
import {
|
|
33
33
|
LOCAL_HARNESS_MANIFEST,
|
|
34
34
|
LOCAL_HARNESS_POLICY_VERSION,
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
runtimeInstallRoot,
|
|
58
58
|
startRuntimeInstall,
|
|
59
59
|
supportsOwnershipProof
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-WZVZ6LQX.js";
|
|
61
61
|
import {
|
|
62
62
|
BROWSER_CONSENT_HEADER,
|
|
63
63
|
createBrowserConsentLifetime,
|
|
@@ -3086,18 +3086,6 @@ __export(evaluate_exports, {
|
|
|
3086
3086
|
finalMessageEndsWithQuestion: () => finalMessageEndsWithQuestion
|
|
3087
3087
|
});
|
|
3088
3088
|
|
|
3089
|
-
// ../evaluators/dist/chunk-I4CRERJV.js
|
|
3090
|
-
var PROBE = "__predicate_arg_probe__";
|
|
3091
|
-
function argMatch(matcher, actualArgs) {
|
|
3092
|
-
const argumentMatching = matcher.argumentMatching ?? "partial";
|
|
3093
|
-
const result = evaluateToolCalls(
|
|
3094
|
-
[{ toolName: PROBE, arguments: matcher.args ?? {} }],
|
|
3095
|
-
[{ toolName: PROBE, arguments: actualArgs ?? {} }],
|
|
3096
|
-
{ argumentMatching }
|
|
3097
|
-
);
|
|
3098
|
-
return result.passed;
|
|
3099
|
-
}
|
|
3100
|
-
|
|
3101
3089
|
// ../evaluators/dist/chunk-PYTZA5U2.js
|
|
3102
3090
|
import { Validator } from "@cfworker/json-schema";
|
|
3103
3091
|
var DRAFT_2020_12_URIS = /* @__PURE__ */ new Set([
|
|
@@ -3172,7 +3160,19 @@ function validateAgainstSchema(schema2, instance) {
|
|
|
3172
3160
|
}
|
|
3173
3161
|
}
|
|
3174
3162
|
|
|
3175
|
-
// ../evaluators/dist/chunk-
|
|
3163
|
+
// ../evaluators/dist/chunk-I4CRERJV.js
|
|
3164
|
+
var PROBE = "__predicate_arg_probe__";
|
|
3165
|
+
function argMatch(matcher, actualArgs) {
|
|
3166
|
+
const argumentMatching = matcher.argumentMatching ?? "partial";
|
|
3167
|
+
const result = evaluateToolCalls(
|
|
3168
|
+
[{ toolName: PROBE, arguments: matcher.args ?? {} }],
|
|
3169
|
+
[{ toolName: PROBE, arguments: actualArgs ?? {} }],
|
|
3170
|
+
{ argumentMatching }
|
|
3171
|
+
);
|
|
3172
|
+
return result.passed;
|
|
3173
|
+
}
|
|
3174
|
+
|
|
3175
|
+
// ../evaluators/dist/chunk-5MZTMUN3.js
|
|
3176
3176
|
var MAX_VALUE_CHARS = 200;
|
|
3177
3177
|
var MAX_ERROR_MSG_CHARS = 200;
|
|
3178
3178
|
var MAX_ITEMS_SHOWN = 3;
|
|
@@ -4886,7 +4886,7 @@ __export(predicate_scorer_exports, {
|
|
|
4886
4886
|
predicateScorer: () => predicateScorer
|
|
4887
4887
|
});
|
|
4888
4888
|
|
|
4889
|
-
// ../evaluators/dist/chunk-
|
|
4889
|
+
// ../evaluators/dist/chunk-HBQCMPNF.js
|
|
4890
4890
|
function assertLocallyEvaluable(predicate) {
|
|
4891
4891
|
if (!requiresRenderObservations(predicate.type)) return;
|
|
4892
4892
|
throw new Error(
|
|
@@ -4964,7 +4964,7 @@ function toEvaluatorRawOutcome(outcome) {
|
|
|
4964
4964
|
};
|
|
4965
4965
|
}
|
|
4966
4966
|
|
|
4967
|
-
// ../evaluators/dist/chunk-
|
|
4967
|
+
// ../evaluators/dist/chunk-LIHSUT4W.js
|
|
4968
4968
|
function assertLocallyEvaluable2(rule) {
|
|
4969
4969
|
if (!requiresRenderObservations(rule.type)) return;
|
|
4970
4970
|
throw new Error(
|
|
@@ -89334,7 +89334,7 @@ function getActiveTunnelDomains() {
|
|
|
89334
89334
|
}
|
|
89335
89335
|
|
|
89336
89336
|
// server/utils/guest-spend-ip.ts
|
|
89337
|
-
import { isIP, isIPv4, isIPv6 } from "net";
|
|
89337
|
+
import { isIP as isIP2, isIPv4, isIPv6 } from "net";
|
|
89338
89338
|
|
|
89339
89339
|
// server/utils/local-secret-store.ts
|
|
89340
89340
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
@@ -89400,6 +89400,7 @@ function getGuestSessionHashPepper() {
|
|
|
89400
89400
|
|
|
89401
89401
|
// server/utils/client-ip.ts
|
|
89402
89402
|
import { timingSafeEqual as timingSafeEqual3 } from "crypto";
|
|
89403
|
+
import { isIP } from "net";
|
|
89403
89404
|
import { getConnInfo } from "@hono/node-server/conninfo";
|
|
89404
89405
|
function getClientIp(c) {
|
|
89405
89406
|
const cfConnectingIp = c.req.header("cf-connecting-ip")?.trim();
|
|
@@ -89445,6 +89446,34 @@ function getAttestedClientIp(c) {
|
|
|
89445
89446
|
}
|
|
89446
89447
|
return null;
|
|
89447
89448
|
}
|
|
89449
|
+
function ipRateLimitKey(ip) {
|
|
89450
|
+
const address = ip.trim();
|
|
89451
|
+
if (isIP(address) !== 6) return address;
|
|
89452
|
+
const groups = ipv6Groups(address.split("%")[0]);
|
|
89453
|
+
if (groups.slice(0, 6).join(":") === "0:0:0:0:0:65535") {
|
|
89454
|
+
const [high, low] = groups.slice(6);
|
|
89455
|
+
return [high >> 8, high & 255, low >> 8, low & 255].join(".");
|
|
89456
|
+
}
|
|
89457
|
+
const prefix = groups.slice(0, 4).map((group) => group.toString(16));
|
|
89458
|
+
return `${prefix.join(":")}::/64`;
|
|
89459
|
+
}
|
|
89460
|
+
function ipv6Groups(address) {
|
|
89461
|
+
const v4Tail = /(\d+)\.(\d+)\.(\d+)\.(\d+)$/.exec(address);
|
|
89462
|
+
let text2 = address;
|
|
89463
|
+
if (v4Tail) {
|
|
89464
|
+
const [a, b, c, d] = v4Tail.slice(1).map(Number);
|
|
89465
|
+
const high = (a << 8 | b).toString(16);
|
|
89466
|
+
const low = (c << 8 | d).toString(16);
|
|
89467
|
+
text2 = `${address.slice(0, v4Tail.index)}${high}:${low}`;
|
|
89468
|
+
}
|
|
89469
|
+
const parse3 = (part) => part === "" ? [] : part.split(":").map((group) => parseInt(group, 16));
|
|
89470
|
+
const [head, tail] = text2.split("::");
|
|
89471
|
+
const left = parse3(head);
|
|
89472
|
+
if (tail === void 0) return left;
|
|
89473
|
+
const right = parse3(tail);
|
|
89474
|
+
const zeros = new Array(8 - left.length - right.length).fill(0);
|
|
89475
|
+
return [...left, ...zeros, ...right];
|
|
89476
|
+
}
|
|
89448
89477
|
|
|
89449
89478
|
// server/utils/guest-spend-ip.ts
|
|
89450
89479
|
var SCOPE = "guest-spend-ip";
|
|
@@ -89496,7 +89525,7 @@ function canonicalizeClientIp(rawIp) {
|
|
|
89496
89525
|
return null;
|
|
89497
89526
|
}
|
|
89498
89527
|
}
|
|
89499
|
-
return
|
|
89528
|
+
return isIP2(trimmed) ? trimmed.toLowerCase() : null;
|
|
89500
89529
|
}
|
|
89501
89530
|
async function hashGuestSpendIp(rawIp) {
|
|
89502
89531
|
const canonical4 = canonicalizeClientIp(rawIp);
|
|
@@ -92547,7 +92576,7 @@ async function sweepLocalHarnessScratch() {
|
|
|
92547
92576
|
var startup;
|
|
92548
92577
|
function startLocalHarnessJanitor() {
|
|
92549
92578
|
startup ??= (async () => {
|
|
92550
|
-
const { localHarnessSupervisor } = await import("./local-turn-
|
|
92579
|
+
const { localHarnessSupervisor } = await import("./local-turn-ZWMMQGV3.js");
|
|
92551
92580
|
await localHarnessSupervisor().reclaimOrphans();
|
|
92552
92581
|
await sweepLocalHarnessScratch();
|
|
92553
92582
|
})().catch((error) => {
|
|
@@ -92558,6 +92587,7 @@ function startLocalHarnessJanitor() {
|
|
|
92558
92587
|
|
|
92559
92588
|
// server/middleware/request-log-context.ts
|
|
92560
92589
|
import { HTTPException } from "hono/http-exception";
|
|
92590
|
+
import { matchedRoutes } from "hono/route";
|
|
92561
92591
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
92562
92592
|
|
|
92563
92593
|
// server/utils/error-classify.ts
|
|
@@ -92640,12 +92670,14 @@ async function requestLogContextMiddleware(c, next) {
|
|
|
92640
92670
|
thrown = err;
|
|
92641
92671
|
}
|
|
92642
92672
|
const route = c.req.routePath || "unmatched";
|
|
92673
|
+
const targetRoute = route.endsWith("*") ? matchedRoutes(c).slice(c.req.routeIndex + 1).find((r) => !r.path.endsWith("*"))?.path : void 0;
|
|
92643
92674
|
const status = c.res.status;
|
|
92644
92675
|
const reqLogger = getRequestLogger(c, "http");
|
|
92645
92676
|
const enriched = {
|
|
92646
92677
|
...c.var.requestLogContext,
|
|
92647
92678
|
component: "http",
|
|
92648
92679
|
route,
|
|
92680
|
+
...targetRoute ? { targetRoute } : {},
|
|
92649
92681
|
statusCode: status
|
|
92650
92682
|
};
|
|
92651
92683
|
c.set("requestLogContext", enriched);
|
|
@@ -121870,6 +121902,24 @@ async function listTools3(manager, params) {
|
|
|
121870
121902
|
tokenCountError
|
|
121871
121903
|
};
|
|
121872
121904
|
}
|
|
121905
|
+
async function listToolsMulti(manager, params) {
|
|
121906
|
+
const results = {};
|
|
121907
|
+
const failures = {};
|
|
121908
|
+
await Promise.all(
|
|
121909
|
+
params.serverIds.map(async (serverId) => {
|
|
121910
|
+
try {
|
|
121911
|
+
results[serverId] = await listTools3(manager, {
|
|
121912
|
+
serverId,
|
|
121913
|
+
modelId: params.modelId,
|
|
121914
|
+
cacheMode: params.cacheMode
|
|
121915
|
+
});
|
|
121916
|
+
} catch (error) {
|
|
121917
|
+
failures[serverId] = error;
|
|
121918
|
+
}
|
|
121919
|
+
})
|
|
121920
|
+
);
|
|
121921
|
+
return Object.keys(failures).length > 0 ? { results, failures } : { results };
|
|
121922
|
+
}
|
|
121873
121923
|
|
|
121874
121924
|
// server/routes/mcp/tools.ts
|
|
121875
121925
|
var tools = new Hono5();
|
|
@@ -194227,6 +194277,7 @@ function hasDedicatedPollBudget(method, path8) {
|
|
|
194227
194277
|
// server/middleware/guest-rate-limit.ts
|
|
194228
194278
|
var GUEST_RATE_LIMIT = 60;
|
|
194229
194279
|
var GUEST_WINDOW_MS = 6e4;
|
|
194280
|
+
var TOO_MANY_MESSAGE = "Guest rate limit exceeded. Try again later or sign in for higher limits.";
|
|
194230
194281
|
var guestWindows = /* @__PURE__ */ new Map();
|
|
194231
194282
|
setInterval(() => {
|
|
194232
194283
|
const now = Date.now();
|
|
@@ -194249,10 +194300,15 @@ async function guestRateLimitMiddleware(c, next) {
|
|
|
194249
194300
|
if (entry3) {
|
|
194250
194301
|
if (now - entry3.windowStart < GUEST_WINDOW_MS) {
|
|
194251
194302
|
if (entry3.count >= GUEST_RATE_LIMIT) {
|
|
194303
|
+
c.set("webErrorMeta", {
|
|
194304
|
+
status: 429,
|
|
194305
|
+
code: ErrorCode.RATE_LIMITED,
|
|
194306
|
+
message: TOO_MANY_MESSAGE
|
|
194307
|
+
});
|
|
194252
194308
|
return c.json(
|
|
194253
194309
|
{
|
|
194254
194310
|
code: ErrorCode.RATE_LIMITED,
|
|
194255
|
-
message:
|
|
194311
|
+
message: TOO_MANY_MESSAGE
|
|
194256
194312
|
},
|
|
194257
194313
|
429,
|
|
194258
194314
|
// This is a FIXED window, so the wait is exactly the remainder of it
|
|
@@ -194342,11 +194398,17 @@ var unattestedWindows = createFixedWindowMap(
|
|
|
194342
194398
|
function bearerKey(token) {
|
|
194343
194399
|
return createHash24("sha256").update(token).digest("hex").slice(0, 32);
|
|
194344
194400
|
}
|
|
194401
|
+
var TOO_MANY_MESSAGE2 = "Too many requests. Slow down and retry.";
|
|
194345
194402
|
function tooMany2(c, retryAfterMs) {
|
|
194403
|
+
c.set("webErrorMeta", {
|
|
194404
|
+
status: 429,
|
|
194405
|
+
code: ErrorCode.RATE_LIMITED,
|
|
194406
|
+
message: TOO_MANY_MESSAGE2
|
|
194407
|
+
});
|
|
194346
194408
|
return c.json(
|
|
194347
194409
|
{
|
|
194348
194410
|
code: ErrorCode.RATE_LIMITED,
|
|
194349
|
-
message:
|
|
194411
|
+
message: TOO_MANY_MESSAGE2
|
|
194350
194412
|
},
|
|
194351
194413
|
429,
|
|
194352
194414
|
{
|
|
@@ -197768,7 +197830,7 @@ var serverSkillsReadFileSchema = projectServerSchema.extend({
|
|
|
197768
197830
|
var promptsListSchema = projectServerSchema.extend({
|
|
197769
197831
|
cursor: z30.string().optional()
|
|
197770
197832
|
});
|
|
197771
|
-
var
|
|
197833
|
+
var projectServerBatchSchema = z30.object({
|
|
197772
197834
|
projectId: z30.string().min(1),
|
|
197773
197835
|
serverIds: z30.array(z30.string().min(1)).min(1),
|
|
197774
197836
|
serverNames: z30.array(z30.string().min(1)).optional(),
|
|
@@ -197789,6 +197851,10 @@ var promptsListMultiSchema = z30.object({
|
|
|
197789
197851
|
scenarioId: z30.string().min(1).optional(),
|
|
197790
197852
|
accessVersion: z30.number().int().nonnegative().optional()
|
|
197791
197853
|
});
|
|
197854
|
+
var promptsListMultiSchema = projectServerBatchSchema;
|
|
197855
|
+
var toolsListMultiSchema = projectServerBatchSchema.extend({
|
|
197856
|
+
modelId: z30.string().optional()
|
|
197857
|
+
});
|
|
197792
197858
|
var promptsGetSchema = projectServerSchema.extend({
|
|
197793
197859
|
promptName: z30.string().min(1),
|
|
197794
197860
|
arguments: z30.record(z30.string(), z30.union([z30.string(), z30.number(), z30.boolean()])).optional()
|
|
@@ -198282,14 +198348,16 @@ async function createAuthorizedManager(caller, bearerToken, projectId, serverIds
|
|
|
198282
198348
|
throw new WebRouteError(
|
|
198283
198349
|
500,
|
|
198284
198350
|
ErrorCode.INTERNAL_ERROR,
|
|
198285
|
-
`Authorization response is missing result for server "${serverId}"
|
|
198351
|
+
`Authorization response is missing result for server "${serverId}"`,
|
|
198352
|
+
{ serverId }
|
|
198286
198353
|
);
|
|
198287
198354
|
}
|
|
198288
198355
|
if (!auth.ok) {
|
|
198289
198356
|
throw new WebRouteError(
|
|
198290
198357
|
auth.status,
|
|
198291
198358
|
auth.code,
|
|
198292
|
-
auth.message
|
|
198359
|
+
auth.message,
|
|
198360
|
+
{ serverId, serverName: serverNamesById?.[serverId] ?? null }
|
|
198293
198361
|
);
|
|
198294
198362
|
}
|
|
198295
198363
|
const displayServerName = serverNamesById?.[serverId] ?? serverId;
|
|
@@ -199071,6 +199139,9 @@ function blockedEgressRouteError(error) {
|
|
|
199071
199139
|
}
|
|
199072
199140
|
return void 0;
|
|
199073
199141
|
}
|
|
199142
|
+
function mapEphemeralServerFailure(error) {
|
|
199143
|
+
return mapTargetServerError(blockedEgressRouteError(error) ?? error);
|
|
199144
|
+
}
|
|
199074
199145
|
async function withEphemeralConnection(c, schema2, fn, options) {
|
|
199075
199146
|
let rpcCollector;
|
|
199076
199147
|
try {
|
|
@@ -199100,7 +199171,7 @@ async function withEphemeralConnection(c, schema2, fn, options) {
|
|
|
199100
199171
|
);
|
|
199101
199172
|
} catch (error) {
|
|
199102
199173
|
const projected = projectRouteFailure(
|
|
199103
|
-
|
|
199174
|
+
mapEphemeralServerFailure(error),
|
|
199104
199175
|
error,
|
|
199105
199176
|
rpcCollector?.buildEnvelope()
|
|
199106
199177
|
);
|
|
@@ -203187,6 +203258,72 @@ function buildIterationMetadata(evaluation) {
|
|
|
203187
203258
|
return metadata;
|
|
203188
203259
|
}
|
|
203189
203260
|
|
|
203261
|
+
// server/services/evals/iteration-error-metadata.ts
|
|
203262
|
+
function buildIterationErrorMetadata(input) {
|
|
203263
|
+
const errors = /* @__PURE__ */ new Map();
|
|
203264
|
+
const add = (reason, message) => {
|
|
203265
|
+
const clean2 = redactForTelemetry2(message);
|
|
203266
|
+
if (typeof clean2 !== "string" || !clean2.trim()) return;
|
|
203267
|
+
const entry3 = { reason, message: clean2.trim() };
|
|
203268
|
+
errors.set(JSON.stringify(entry3), entry3);
|
|
203269
|
+
};
|
|
203270
|
+
const toolErrors = [
|
|
203271
|
+
...input.toolErrors ?? [],
|
|
203272
|
+
...extractToolErrors({
|
|
203273
|
+
spans: input.spans ?? [],
|
|
203274
|
+
messages: input.messages ?? []
|
|
203275
|
+
})
|
|
203276
|
+
];
|
|
203277
|
+
for (const error of toolErrors) {
|
|
203278
|
+
if (!error || typeof error !== "object") continue;
|
|
203279
|
+
const record5 = error;
|
|
203280
|
+
if (typeof record5.message !== "string") continue;
|
|
203281
|
+
add(
|
|
203282
|
+
record5.kind === "protocol-error" ? "protocolError" : "toolError",
|
|
203283
|
+
record5.message
|
|
203284
|
+
);
|
|
203285
|
+
}
|
|
203286
|
+
for (const observation of input.widgetRenderObservations ?? []) {
|
|
203287
|
+
if (observation.status === "rendered") continue;
|
|
203288
|
+
for (const message of observation.consoleErrors ?? [])
|
|
203289
|
+
add("renderFailed", message);
|
|
203290
|
+
}
|
|
203291
|
+
for (const step of input.browserInteractionSteps ?? []) {
|
|
203292
|
+
for (const call of step.widgetToolCalls ?? []) {
|
|
203293
|
+
if (call.error) add("protocolError", call.error);
|
|
203294
|
+
for (const error of extractToolErrors([
|
|
203295
|
+
{
|
|
203296
|
+
role: "tool",
|
|
203297
|
+
content: [
|
|
203298
|
+
{ type: "tool-result", toolName: call.name, result: call.result }
|
|
203299
|
+
]
|
|
203300
|
+
}
|
|
203301
|
+
])) {
|
|
203302
|
+
if (error.message)
|
|
203303
|
+
add(
|
|
203304
|
+
error.kind === "protocol-error" ? "protocolError" : "toolError",
|
|
203305
|
+
error.message
|
|
203306
|
+
);
|
|
203307
|
+
}
|
|
203308
|
+
}
|
|
203309
|
+
}
|
|
203310
|
+
const stopped = input.status !== "cancelled" && input.status !== "skipped" && (Boolean(input.error?.trim()) || ["failed", "setup_failed", "timed_out"].includes(input.status));
|
|
203311
|
+
if (input.error)
|
|
203312
|
+
add(
|
|
203313
|
+
input.stepError?.source === "model" ? "providerError" : "setupAborted",
|
|
203314
|
+
input.error
|
|
203315
|
+
);
|
|
203316
|
+
return {
|
|
203317
|
+
...errors.size ? { evalErrors: [...errors.values()] } : {},
|
|
203318
|
+
...stopped ? {
|
|
203319
|
+
evalExecutionFailure: {
|
|
203320
|
+
phase: input.status === "setup_failed" || input.stepError?.source === "setup" ? "setup" : "execution",
|
|
203321
|
+
reason: input.stepError?.code ?? (input.status === "timed_out" ? "iteration_timeout" : "execution_stopped")
|
|
203322
|
+
}
|
|
203323
|
+
} : {}
|
|
203324
|
+
};
|
|
203325
|
+
}
|
|
203326
|
+
|
|
203190
203327
|
// shared/hosted-criterion-id.ts
|
|
203191
203328
|
var HOSTED_TOOL_MATCH_SCORER_ID = "toolCalls:match";
|
|
203192
203329
|
var HOSTED_TOOL_ARGUMENTS_SCORER_ID = "toolCalls:arguments";
|
|
@@ -204316,6 +204453,16 @@ function buildIterationFinishParams(args) {
|
|
|
204316
204453
|
resultSource: "reported",
|
|
204317
204454
|
metadata: {
|
|
204318
204455
|
...iterationMetadataBase,
|
|
204456
|
+
...buildIterationErrorMetadata({
|
|
204457
|
+
messages,
|
|
204458
|
+
spans,
|
|
204459
|
+
toolErrors: stageToolErrors,
|
|
204460
|
+
browserInteractionSteps,
|
|
204461
|
+
widgetRenderObservations,
|
|
204462
|
+
status,
|
|
204463
|
+
error,
|
|
204464
|
+
stepError: args.stepError
|
|
204465
|
+
}),
|
|
204319
204466
|
...buildIterationMetadata(evaluation),
|
|
204320
204467
|
// Written for EVERY trial, from the same helper the `noEndingQuestion`
|
|
204321
204468
|
// check uses — not only when somebody authored that check.
|
|
@@ -212902,6 +213049,7 @@ async function persistSetupFailedIteration(args) {
|
|
|
212902
213049
|
resultSource: "reported",
|
|
212903
213050
|
metadata: {
|
|
212904
213051
|
...args.iterationMetadataBase,
|
|
213052
|
+
evalExecutionFailure: { phase: "setup", reason: "setup_failed" },
|
|
212905
213053
|
...buildStageMetadata({
|
|
212906
213054
|
...args.stageCase ? { stageCase: args.stageCase } : {},
|
|
212907
213055
|
// No real spans/prompts/messages: the analyzer reads that as
|
|
@@ -219324,10 +219472,22 @@ var AUTHENTICATION_FAILURE = /\b(unauthenticated|invalid token|token (has )?expi
|
|
|
219324
219472
|
function redactedReadRefusalError(error, notFoundMessage) {
|
|
219325
219473
|
if (error instanceof WebRouteError) return void 0;
|
|
219326
219474
|
if (hasConvexErrorData(error)) return void 0;
|
|
219327
|
-
|
|
219328
|
-
|
|
219475
|
+
const failure = classifyConvexReadError(error);
|
|
219476
|
+
if (failure.kind === "invalid-argument") {
|
|
219477
|
+
logRejectedReadArguments("v1.read-refusal", error);
|
|
219478
|
+
} else if (failure.kind === "redacted") {
|
|
219479
|
+
logRedactedReadAsNotFound("v1.read-refusal", error);
|
|
219480
|
+
} else {
|
|
219481
|
+
return void 0;
|
|
219482
|
+
}
|
|
219329
219483
|
return new WebRouteError(404, ErrorCode.NOT_FOUND, notFoundMessage);
|
|
219330
219484
|
}
|
|
219485
|
+
function logRejectedReadArguments(scope, error) {
|
|
219486
|
+
logger.warn(`[${scope}] convex rejected read arguments`, {
|
|
219487
|
+
scope,
|
|
219488
|
+
detail: redactForLog(error)
|
|
219489
|
+
});
|
|
219490
|
+
}
|
|
219331
219491
|
function logRedactedReadAsNotFound(scope, error) {
|
|
219332
219492
|
logger.warn(`[${scope}] redacted read failure answered as not found`, {
|
|
219333
219493
|
scope,
|
|
@@ -219358,10 +219518,7 @@ function translateConvexReadError(error, options) {
|
|
|
219358
219518
|
if (structured) return structured;
|
|
219359
219519
|
const failure = classifyConvexReadError(error);
|
|
219360
219520
|
if (failure.kind === "invalid-argument") {
|
|
219361
|
-
|
|
219362
|
-
scope: options.scope,
|
|
219363
|
-
detail: redactForLog(error)
|
|
219364
|
-
});
|
|
219521
|
+
logRejectedReadArguments(options.scope, error);
|
|
219365
219522
|
return new WebRouteError(
|
|
219366
219523
|
404,
|
|
219367
219524
|
ErrorCode.NOT_FOUND,
|
|
@@ -219415,6 +219572,12 @@ function requireConvexIdShape(value, param, options) {
|
|
|
219415
219572
|
});
|
|
219416
219573
|
throw new WebRouteError(404, ErrorCode.NOT_FOUND, options.notFoundMessage);
|
|
219417
219574
|
}
|
|
219575
|
+
function requireProjectIdArg(projectId, scope) {
|
|
219576
|
+
return requireConvexIdShape(projectId, "projectId", {
|
|
219577
|
+
scope,
|
|
219578
|
+
notFoundMessage: "Project not found"
|
|
219579
|
+
});
|
|
219580
|
+
}
|
|
219418
219581
|
function requireConvexIdParam(c, param, options) {
|
|
219419
219582
|
return requireConvexIdShape(c.req.param(param), param, options);
|
|
219420
219583
|
}
|
|
@@ -239119,7 +239282,7 @@ async function bucketKeys(c, family) {
|
|
|
239119
239282
|
}
|
|
239120
239283
|
return keys;
|
|
239121
239284
|
}
|
|
239122
|
-
var
|
|
239285
|
+
var TOO_MANY_MESSAGE3 = "Too many requests to this server. Slow down and retry.";
|
|
239123
239286
|
var TOO_MANY_DETAILS = {
|
|
239124
239287
|
reason: SERVER_REQUEST_BUDGET_REASON
|
|
239125
239288
|
};
|
|
@@ -239127,12 +239290,12 @@ function tooMany3(c, waitMs) {
|
|
|
239127
239290
|
c.set("webErrorMeta", {
|
|
239128
239291
|
status: 429,
|
|
239129
239292
|
code: ErrorCode.RATE_LIMITED,
|
|
239130
|
-
message:
|
|
239293
|
+
message: TOO_MANY_MESSAGE3
|
|
239131
239294
|
});
|
|
239132
239295
|
return c.json(
|
|
239133
239296
|
{
|
|
239134
239297
|
code: ErrorCode.RATE_LIMITED,
|
|
239135
|
-
message:
|
|
239298
|
+
message: TOO_MANY_MESSAGE3,
|
|
239136
239299
|
details: TOO_MANY_DETAILS
|
|
239137
239300
|
},
|
|
239138
239301
|
429,
|
|
@@ -239663,6 +239826,33 @@ tools3.post(
|
|
|
239663
239826
|
)
|
|
239664
239827
|
)
|
|
239665
239828
|
);
|
|
239829
|
+
function batchFailure(error) {
|
|
239830
|
+
const { routeError } = projectRouteFailure(
|
|
239831
|
+
mapEphemeralServerFailure(error),
|
|
239832
|
+
error,
|
|
239833
|
+
void 0
|
|
239834
|
+
);
|
|
239835
|
+
return {
|
|
239836
|
+
status: routeError.status,
|
|
239837
|
+
code: routeError.code,
|
|
239838
|
+
message: routeError.message
|
|
239839
|
+
};
|
|
239840
|
+
}
|
|
239841
|
+
tools3.post(
|
|
239842
|
+
"/list-multi",
|
|
239843
|
+
async (c) => withEphemeralConnection(c, toolsListMultiSchema, async (manager, body) => {
|
|
239844
|
+
const { results, failures } = await listToolsMulti(manager, {
|
|
239845
|
+
...body,
|
|
239846
|
+
cacheMode: "bypass"
|
|
239847
|
+
});
|
|
239848
|
+
if (!failures) return { results };
|
|
239849
|
+
const errors = {};
|
|
239850
|
+
for (const [serverId, failure] of Object.entries(failures)) {
|
|
239851
|
+
errors[serverId] = batchFailure(failure);
|
|
239852
|
+
}
|
|
239853
|
+
return { results, errors };
|
|
239854
|
+
})
|
|
239855
|
+
);
|
|
239666
239856
|
tools3.post(
|
|
239667
239857
|
"/execute",
|
|
239668
239858
|
async (c) => (
|
|
@@ -265360,20 +265550,16 @@ function createConvexClient3(convexAuthToken) {
|
|
|
265360
265550
|
client3.setAuth(convexAuthToken);
|
|
265361
265551
|
return client3;
|
|
265362
265552
|
}
|
|
265553
|
+
var PROJECT_OR_CLIENT_NOT_FOUND = "Project or client not found, or you do not have access to it.";
|
|
265363
265554
|
function translateConvexWriteError3(error) {
|
|
265364
265555
|
return translateConvexWriteError(error, {
|
|
265365
265556
|
resource: "Client",
|
|
265366
|
-
|
|
265367
|
-
// missing" into the same generic error, and the v1 surface deliberately
|
|
265368
|
-
// doesn't leak which. Keep the message neutral rather than asserting
|
|
265369
|
-
// "Client not found" — the failure on the list/create paths is usually the
|
|
265370
|
-
// PROJECT (bad id or no membership), where a client-specific message
|
|
265371
|
-
// misleads.
|
|
265372
|
-
notFoundMessage: "Project or client not found, or you do not have access to it.",
|
|
265557
|
+
notFoundMessage: PROJECT_OR_CLIENT_NOT_FOUND,
|
|
265373
265558
|
fallbackMessage: "Client write rejected by the platform"
|
|
265374
265559
|
});
|
|
265375
265560
|
}
|
|
265376
265561
|
async function listHostRows(convexAuthToken, projectId) {
|
|
265562
|
+
requireProjectIdArg(projectId, "v1.clients");
|
|
265377
265563
|
const readClient = createConvexClient3(convexAuthToken);
|
|
265378
265564
|
try {
|
|
265379
265565
|
return await readClient.query(
|
|
@@ -265381,13 +265567,10 @@ async function listHostRows(convexAuthToken, projectId) {
|
|
|
265381
265567
|
{ projectId }
|
|
265382
265568
|
) ?? [];
|
|
265383
265569
|
} catch (error) {
|
|
265384
|
-
throw redactedReadRefusalError(
|
|
265385
|
-
error,
|
|
265386
|
-
"Project or client not found, or you do not have access to it."
|
|
265387
|
-
) ?? translateConvexWriteError3(error);
|
|
265570
|
+
throw redactedReadRefusalError(error, PROJECT_OR_CLIENT_NOT_FOUND) ?? translateConvexWriteError3(error);
|
|
265388
265571
|
}
|
|
265389
265572
|
}
|
|
265390
|
-
async function readHostDetail(convexAuthToken, projectId, hostId) {
|
|
265573
|
+
async function readHostDetail(convexAuthToken, projectId, hostId, read3) {
|
|
265391
265574
|
const readClient = createConvexClient3(convexAuthToken);
|
|
265392
265575
|
let detail;
|
|
265393
265576
|
try {
|
|
@@ -265399,7 +265582,7 @@ async function readHostDetail(convexAuthToken, projectId, hostId) {
|
|
|
265399
265582
|
}
|
|
265400
265583
|
);
|
|
265401
265584
|
} catch (error) {
|
|
265402
|
-
throw translateConvexWriteError3(error);
|
|
265585
|
+
throw (read3 === "scope" ? redactedReadRefusalError(error, "Client not found") : void 0) ?? translateConvexWriteError3(error);
|
|
265403
265586
|
}
|
|
265404
265587
|
if (!detail) {
|
|
265405
265588
|
throw new WebRouteError(404, ErrorCode.NOT_FOUND, "Client not found");
|
|
@@ -265421,7 +265604,9 @@ async function resolveClientId(convexAuthToken, projectId, selector, includePriv
|
|
|
265421
265604
|
throw new WebRouteError(404, ErrorCode.NOT_FOUND, "Client not found");
|
|
265422
265605
|
} catch (error) {
|
|
265423
265606
|
if (error instanceof WebRouteError) throw error;
|
|
265424
|
-
if (!isMissingConvexFunction(error))
|
|
265607
|
+
if (!isMissingConvexFunction(error)) {
|
|
265608
|
+
throw redactedReadRefusalError(error, PROJECT_OR_CLIENT_NOT_FOUND) ?? translateConvexWriteError3(error);
|
|
265609
|
+
}
|
|
265425
265610
|
}
|
|
265426
265611
|
const rows = (await listHostRows(convexAuthToken, projectId)).filter(
|
|
265427
265612
|
(row2) => includePrivateBacking || !isPrivateBacking(row2)
|
|
@@ -265620,7 +265805,7 @@ async function getHandler(c, surface) {
|
|
|
265620
265805
|
const projectId = pathParam(c, "projectId");
|
|
265621
265806
|
const token = await getConvexBearerForRequest(c);
|
|
265622
265807
|
const clientId = await resolveSelector(c, token, surface);
|
|
265623
|
-
const detail = await readHostDetail(token, projectId, clientId);
|
|
265808
|
+
const detail = await readHostDetail(token, projectId, clientId, "scope");
|
|
265624
265809
|
if (!surface.legacy && !includePrivateBackingParam(c) && isPrivateBacking(detail)) {
|
|
265625
265810
|
throw new WebRouteError(404, ErrorCode.NOT_FOUND, "Client not found");
|
|
265626
265811
|
}
|
|
@@ -265647,7 +265832,12 @@ async function createHandler(c, surface) {
|
|
|
265647
265832
|
} catch (error) {
|
|
265648
265833
|
throw translateConvexWriteError3(error);
|
|
265649
265834
|
}
|
|
265650
|
-
const detail = await readHostDetail(
|
|
265835
|
+
const detail = await readHostDetail(
|
|
265836
|
+
token,
|
|
265837
|
+
projectId,
|
|
265838
|
+
created.hostId,
|
|
265839
|
+
"readBack"
|
|
265840
|
+
);
|
|
265651
265841
|
if (surface.legacy) {
|
|
265652
265842
|
markDeprecated2(c);
|
|
265653
265843
|
return v1Resource(c, toLegacyHostDetailDto(detail), 201);
|
|
@@ -265683,7 +265873,7 @@ async function updateClientHandler(c) {
|
|
|
265683
265873
|
try {
|
|
265684
265874
|
if (body.config !== void 0) {
|
|
265685
265875
|
assertConfigKeepsPinnedModel(
|
|
265686
|
-
await readHostDetail(token, projectId, clientId),
|
|
265876
|
+
await readHostDetail(token, projectId, clientId, "scope"),
|
|
265687
265877
|
body.config
|
|
265688
265878
|
);
|
|
265689
265879
|
await convexClient6.mutation(
|
|
@@ -265713,7 +265903,9 @@ async function updateClientHandler(c) {
|
|
|
265713
265903
|
}
|
|
265714
265904
|
return v1Resource(
|
|
265715
265905
|
c,
|
|
265716
|
-
toClientDetailDto(
|
|
265906
|
+
toClientDetailDto(
|
|
265907
|
+
await readHostDetail(token, projectId, clientId, "readBack")
|
|
265908
|
+
)
|
|
265717
265909
|
);
|
|
265718
265910
|
}
|
|
265719
265911
|
async function updateHostAliasHandler(c) {
|
|
@@ -265725,7 +265917,7 @@ async function updateHostAliasHandler(c) {
|
|
|
265725
265917
|
if (body.name !== void 0) updateArgs.name = body.name;
|
|
265726
265918
|
if (body.config !== void 0) {
|
|
265727
265919
|
assertConfigKeepsPinnedModel(
|
|
265728
|
-
await readHostDetail(token, projectId, hostId),
|
|
265920
|
+
await readHostDetail(token, projectId, hostId, "scope"),
|
|
265729
265921
|
body.config
|
|
265730
265922
|
);
|
|
265731
265923
|
updateArgs.input = normalizeConfigForWrite(body.config);
|
|
@@ -265739,7 +265931,9 @@ async function updateHostAliasHandler(c) {
|
|
|
265739
265931
|
markDeprecated2(c);
|
|
265740
265932
|
return v1Resource(
|
|
265741
265933
|
c,
|
|
265742
|
-
toLegacyHostDetailDto(
|
|
265934
|
+
toLegacyHostDetailDto(
|
|
265935
|
+
await readHostDetail(token, projectId, hostId, "readBack")
|
|
265936
|
+
)
|
|
265743
265937
|
);
|
|
265744
265938
|
}
|
|
265745
265939
|
async function setServersHandler(c, surface) {
|
|
@@ -265762,7 +265956,7 @@ async function setServersHandler(c, surface) {
|
|
|
265762
265956
|
}
|
|
265763
265957
|
return detailResponse(
|
|
265764
265958
|
c,
|
|
265765
|
-
await readHostDetail(token, projectId, clientId),
|
|
265959
|
+
await readHostDetail(token, projectId, clientId, "readBack"),
|
|
265766
265960
|
surface.legacy
|
|
265767
265961
|
);
|
|
265768
265962
|
}
|
|
@@ -265775,7 +265969,7 @@ async function duplicateHandler(c, surface) {
|
|
|
265775
265969
|
await readJsonObjectBody(c)
|
|
265776
265970
|
);
|
|
265777
265971
|
const convexClient6 = createConvexClient3(token);
|
|
265778
|
-
const source = await readHostDetail(token, projectId, clientId);
|
|
265972
|
+
const source = await readHostDetail(token, projectId, clientId, "scope");
|
|
265779
265973
|
if (!hostConfigPinsAModel(source.config)) {
|
|
265780
265974
|
throw new WebRouteError(
|
|
265781
265975
|
400,
|
|
@@ -265793,7 +265987,12 @@ async function duplicateHandler(c, surface) {
|
|
|
265793
265987
|
} catch (error) {
|
|
265794
265988
|
throw translateConvexWriteError3(error);
|
|
265795
265989
|
}
|
|
265796
|
-
const detail = await readHostDetail(
|
|
265990
|
+
const detail = await readHostDetail(
|
|
265991
|
+
token,
|
|
265992
|
+
projectId,
|
|
265993
|
+
created.hostId,
|
|
265994
|
+
"readBack"
|
|
265995
|
+
);
|
|
265797
265996
|
if (surface.legacy) {
|
|
265798
265997
|
markDeprecated2(c);
|
|
265799
265998
|
return v1Resource(c, toLegacyHostDetailDto(detail), 201);
|
|
@@ -266178,7 +266377,10 @@ environments2.get(
|
|
|
266178
266377
|
}
|
|
266179
266378
|
);
|
|
266180
266379
|
environments2.get("/projects/:projectId/environments", async (c) => {
|
|
266181
|
-
const projectId =
|
|
266380
|
+
const projectId = requireProjectIdArg(
|
|
266381
|
+
c.req.param("projectId"),
|
|
266382
|
+
"v1.environments"
|
|
266383
|
+
);
|
|
266182
266384
|
const includeArchived = c.req.query("includeArchived") === "true";
|
|
266183
266385
|
const readClient = createConvexClient4(await getConvexBearerForRequest(c));
|
|
266184
266386
|
let rows;
|
|
@@ -266224,7 +266426,10 @@ environments2.get(
|
|
|
266224
266426
|
{ projectId, environmentId }
|
|
266225
266427
|
);
|
|
266226
266428
|
} catch (error) {
|
|
266227
|
-
throw
|
|
266429
|
+
throw redactedReadRefusalError(
|
|
266430
|
+
error,
|
|
266431
|
+
"Environment or project not found, or you do not have access to it."
|
|
266432
|
+
) ?? translateResolveError(error);
|
|
266228
266433
|
}
|
|
266229
266434
|
if (!resolved || !resolved.environmentRef) {
|
|
266230
266435
|
throw new WebRouteError(
|
|
@@ -266488,7 +266693,7 @@ function translatePluginReadError(error) {
|
|
|
266488
266693
|
});
|
|
266489
266694
|
}
|
|
266490
266695
|
plugins2.get("/projects/:projectId/plugins", async (c) => {
|
|
266491
|
-
const projectId = c.req.param("projectId");
|
|
266696
|
+
const projectId = requireProjectIdArg(c.req.param("projectId"), "v1.plugins");
|
|
266492
266697
|
const readClient = createConvexClient5(await getConvexBearerForRequest(c));
|
|
266493
266698
|
let rows;
|
|
266494
266699
|
try {
|
|
@@ -266574,7 +266779,7 @@ function translateSkillReadError(error) {
|
|
|
266574
266779
|
});
|
|
266575
266780
|
}
|
|
266576
266781
|
skills4.get("/projects/:projectId/skills", async (c) => {
|
|
266577
|
-
const projectId = c.req.param("projectId");
|
|
266782
|
+
const projectId = requireProjectIdArg(c.req.param("projectId"), "v1.skills");
|
|
266578
266783
|
const readClient = createConvexClient6(await getConvexBearerForRequest(c));
|
|
266579
266784
|
let rows;
|
|
266580
266785
|
try {
|
|
@@ -266714,6 +266919,7 @@ async function parseBody(c, schema2) {
|
|
|
266714
266919
|
return parsed.data;
|
|
266715
266920
|
}
|
|
266716
266921
|
async function listPersonaRows(client3, projectId) {
|
|
266922
|
+
requireProjectIdArg(projectId, "v1.personas");
|
|
266717
266923
|
try {
|
|
266718
266924
|
return await client3.query(
|
|
266719
266925
|
"personas:listPersonas",
|
|
@@ -266737,7 +266943,7 @@ function idempotencyKeyOf(c) {
|
|
|
266737
266943
|
return key && key.length > 0 ? key : void 0;
|
|
266738
266944
|
}
|
|
266739
266945
|
personas.get("/projects/:projectId/personas", async (c) => {
|
|
266740
|
-
const projectId = c.req.param("projectId");
|
|
266946
|
+
const projectId = requireProjectIdArg(c.req.param("projectId"), "v1.personas");
|
|
266741
266947
|
const client3 = createConvexClient7(await getConvexBearerForRequest(c));
|
|
266742
266948
|
const rows = await listPersonaRows(client3, projectId);
|
|
266743
266949
|
return v1PageJson(
|
|
@@ -266938,7 +267144,7 @@ async function requireSwarmInProject(client3, projectId, swarmId) {
|
|
|
266938
267144
|
return row2;
|
|
266939
267145
|
}
|
|
266940
267146
|
swarms.get("/projects/:projectId/swarms", async (c) => {
|
|
266941
|
-
const projectId = c.req.param("projectId");
|
|
267147
|
+
const projectId = requireProjectIdArg(c.req.param("projectId"), "v1.swarms");
|
|
266942
267148
|
const client3 = createConvexClient7(await getConvexBearerForRequest(c));
|
|
266943
267149
|
let rows;
|
|
266944
267150
|
try {
|
|
@@ -267353,7 +267559,7 @@ both(
|
|
|
267353
267559
|
"/projects/:projectId/goals",
|
|
267354
267560
|
"/projects/:projectId/journeys",
|
|
267355
267561
|
async (c, surface) => {
|
|
267356
|
-
const projectId = c.req.param("projectId");
|
|
267562
|
+
const projectId = requireProjectIdArg(c.req.param("projectId"), "v1.goals");
|
|
267357
267563
|
const client3 = createConvexClient7(await getConvexBearerForRequest(c));
|
|
267358
267564
|
let rows;
|
|
267359
267565
|
try {
|
|
@@ -267820,7 +268026,7 @@ function idempotencyKeyOf2(c) {
|
|
|
267820
268026
|
return key && key.length > 0 ? key : void 0;
|
|
267821
268027
|
}
|
|
267822
268028
|
secrets.get("/projects/:projectId/secrets", async (c) => {
|
|
267823
|
-
const projectId = c.req.param("projectId");
|
|
268029
|
+
const projectId = requireProjectIdArg(c.req.param("projectId"), "v1.secrets");
|
|
267824
268030
|
const client3 = createConvexClient7(await getConvexBearerForRequest(c));
|
|
267825
268031
|
let rows;
|
|
267826
268032
|
try {
|
|
@@ -268658,6 +268864,7 @@ async function requireRunInProject2(client3, projectId, runId) {
|
|
|
268658
268864
|
}
|
|
268659
268865
|
}
|
|
268660
268866
|
async function listFindingRows(client3, projectId) {
|
|
268867
|
+
requireProjectIdArg(projectId, "v1.swarm-insights");
|
|
268661
268868
|
try {
|
|
268662
268869
|
return await client3.query(
|
|
268663
268870
|
"swarmWaveInsights:listSwarmFindings",
|
|
@@ -268688,7 +268895,10 @@ both2(
|
|
|
268688
268895
|
"/projects/:projectId/goals-overview",
|
|
268689
268896
|
"/projects/:projectId/journeys-overview",
|
|
268690
268897
|
async (c) => {
|
|
268691
|
-
const projectId =
|
|
268898
|
+
const projectId = requireProjectIdArg(
|
|
268899
|
+
c.req.param("projectId"),
|
|
268900
|
+
"v1.swarm-insights"
|
|
268901
|
+
);
|
|
268692
268902
|
const client3 = createConvexClient7(await getConvexBearerForRequest(c));
|
|
268693
268903
|
let row2;
|
|
268694
268904
|
try {
|
|
@@ -268735,7 +268945,10 @@ both2(
|
|
|
268735
268945
|
"/projects/:projectId/goal-findings",
|
|
268736
268946
|
"/projects/:projectId/journey-findings",
|
|
268737
268947
|
async (c) => {
|
|
268738
|
-
const projectId =
|
|
268948
|
+
const projectId = requireProjectIdArg(
|
|
268949
|
+
c.req.param("projectId"),
|
|
268950
|
+
"v1.swarm-insights"
|
|
268951
|
+
);
|
|
268739
268952
|
const client3 = createConvexClient7(await getConvexBearerForRequest(c));
|
|
268740
268953
|
const rows = await listFindingRows(client3, projectId);
|
|
268741
268954
|
return v1PageJson(c, rows.map(toFindingDto));
|
|
@@ -269280,6 +269493,8 @@ function isAbortError7(error) {
|
|
|
269280
269493
|
return error instanceof Error && (error.name === "AbortError" || error.code === "ABORT_ERR");
|
|
269281
269494
|
}
|
|
269282
269495
|
async function fetchConvexV1Read(c, convexPath, configure, options = {}) {
|
|
269496
|
+
const projectId = c.req.param("projectId");
|
|
269497
|
+
if (projectId !== void 0) requireProjectIdArg(projectId, "v1.catalog");
|
|
269283
269498
|
const convexUrl = process.env.CONVEX_HTTP_URL;
|
|
269284
269499
|
if (!convexUrl) {
|
|
269285
269500
|
throw new WebRouteError(
|
|
@@ -270450,7 +270665,7 @@ var validateBlueprintSchema = z81.strictObject({
|
|
|
270450
270665
|
blueprint: z81.string().min(1)
|
|
270451
270666
|
});
|
|
270452
270667
|
images.get("/projects/:projectId/images", async (c) => {
|
|
270453
|
-
const projectId = c.req.param("projectId");
|
|
270668
|
+
const projectId = requireProjectIdArg(c.req.param("projectId"), "v1.images");
|
|
270454
270669
|
const readClient = createConvexReadClient2(await getConvexBearerForRequest(c));
|
|
270455
270670
|
let rows;
|
|
270456
270671
|
try {
|
|
@@ -270499,7 +270714,10 @@ images.post("/projects/:projectId/images/validate", async (c) => {
|
|
|
270499
270714
|
{ projectId, blueprint: body.blueprint }
|
|
270500
270715
|
);
|
|
270501
270716
|
} catch (error) {
|
|
270502
|
-
throw
|
|
270717
|
+
throw redactedReadRefusalError(
|
|
270718
|
+
error,
|
|
270719
|
+
"Environment or project not found, or you do not have access to it."
|
|
270720
|
+
) ?? translateConvexWriteError4(error);
|
|
270503
270721
|
}
|
|
270504
270722
|
return v1Resource(c, result);
|
|
270505
270723
|
});
|
|
@@ -278673,7 +278891,10 @@ function deriveCapabilities(row2) {
|
|
|
278673
278891
|
};
|
|
278674
278892
|
}
|
|
278675
278893
|
capabilities.get("/projects/:projectId/capabilities", async (c) => {
|
|
278676
|
-
const projectId =
|
|
278894
|
+
const projectId = requireProjectIdArg(
|
|
278895
|
+
c.req.param("projectId"),
|
|
278896
|
+
"v1.capabilities"
|
|
278897
|
+
);
|
|
278677
278898
|
const client3 = createConvexClient7(await getConvexBearerForRequest(c));
|
|
278678
278899
|
let row2;
|
|
278679
278900
|
try {
|
|
@@ -280039,7 +280260,10 @@ readiness.get("/projects/:projectId/readiness-runs/:runId", async (c) => {
|
|
|
280039
280260
|
return v1Resource(c, toRunDto2(run3, projectId));
|
|
280040
280261
|
});
|
|
280041
280262
|
readiness.get("/projects/:projectId/readiness-runs", async (c) => {
|
|
280042
|
-
const projectId =
|
|
280263
|
+
const projectId = requireProjectIdArg(
|
|
280264
|
+
c.req.param("projectId"),
|
|
280265
|
+
"v1.readiness"
|
|
280266
|
+
);
|
|
280043
280267
|
const convex = createConvexClient9(await getConvexBearerForRequest(c));
|
|
280044
280268
|
const publisher = c.req.query("readinessKind");
|
|
280045
280269
|
if (publisher !== void 0 && !READINESS_PUBLISHERS.includes(publisher)) {
|
|
@@ -281010,7 +281234,10 @@ conformanceRuns.get(
|
|
|
281010
281234
|
}
|
|
281011
281235
|
);
|
|
281012
281236
|
conformanceRuns.get("/projects/:projectId/conformance-runs", async (c) => {
|
|
281013
|
-
const projectId =
|
|
281237
|
+
const projectId = requireProjectIdArg(
|
|
281238
|
+
c.req.param("projectId"),
|
|
281239
|
+
"v1.conformance-runs"
|
|
281240
|
+
);
|
|
281014
281241
|
const serverId = c.req.query("serverId");
|
|
281015
281242
|
const convex = createConvexClient10(await getConvexBearerForRequest(c));
|
|
281016
281243
|
let page3;
|
|
@@ -282585,6 +282812,8 @@ function flushRelayStats() {
|
|
|
282585
282812
|
setInterval(flushRelayStats, STATS_FLUSH_INTERVAL_MS).unref();
|
|
282586
282813
|
var RATE_LIMIT_PER_MIN = 600;
|
|
282587
282814
|
var RELAY_INGEST_LIMIT_PER_MIN = 60;
|
|
282815
|
+
var RELAY_UNATTESTED_INGEST_LIMIT_PER_MIN = 60;
|
|
282816
|
+
var RELAY_POOLED_INGEST_LIMIT_PER_MIN = 4 * RELAY_INGEST_LIMIT_PER_MIN;
|
|
282588
282817
|
var RATE_WINDOW_MS2 = 6e4;
|
|
282589
282818
|
var UNATTESTED_CLIENT_KEY3 = "unattested";
|
|
282590
282819
|
var relayWindows = createFixedWindowMap(RATE_LIMIT_PER_MIN, RATE_WINDOW_MS2);
|
|
@@ -282593,24 +282822,31 @@ var ingestWindows = createFixedWindowMap(
|
|
|
282593
282822
|
RATE_WINDOW_MS2
|
|
282594
282823
|
);
|
|
282595
282824
|
var unattestedIngestWindows = createFixedWindowMap(
|
|
282596
|
-
|
|
282825
|
+
RELAY_UNATTESTED_INGEST_LIMIT_PER_MIN,
|
|
282826
|
+
RATE_WINDOW_MS2
|
|
282827
|
+
);
|
|
282828
|
+
var pooledIngestWindows = createFixedWindowMap(
|
|
282829
|
+
RELAY_POOLED_INGEST_LIMIT_PER_MIN,
|
|
282597
282830
|
RATE_WINDOW_MS2
|
|
282598
282831
|
);
|
|
282599
282832
|
function isIngestSubpath(subpath) {
|
|
282600
282833
|
return /^\/(?:e|i\/v0\/e|s|i\/v1\/(?:logs|metrics))\/?$/.test(subpath);
|
|
282601
282834
|
}
|
|
282602
|
-
function
|
|
282603
|
-
|
|
282835
|
+
function attestedClientKey(c) {
|
|
282836
|
+
if (!edgeAttestationConfigured()) return null;
|
|
282837
|
+
const ip = getAttestedClientIp(c);
|
|
282838
|
+
return ip === null ? null : ipRateLimitKey(ip);
|
|
282604
282839
|
}
|
|
282605
282840
|
function relayClientKey(c) {
|
|
282606
|
-
return
|
|
282841
|
+
return attestedClientKey(c) ?? UNATTESTED_CLIENT_KEY3;
|
|
282607
282842
|
}
|
|
282608
|
-
function relayRateLimit(c,
|
|
282843
|
+
function relayRateLimit(c, ingest) {
|
|
282609
282844
|
if (!HOSTED_MODE) return null;
|
|
282610
|
-
const
|
|
282611
|
-
let refusedMs = relayWindows.charge(
|
|
282612
|
-
if (refusedMs === null &&
|
|
282613
|
-
|
|
282845
|
+
const clientKey = attestedClientKey(c);
|
|
282846
|
+
let refusedMs = relayWindows.charge(clientKey ?? UNATTESTED_CLIENT_KEY3);
|
|
282847
|
+
if (refusedMs === null && ingest) {
|
|
282848
|
+
const sharedWindows = edgeAttestationConfigured() ? unattestedIngestWindows : pooledIngestWindows;
|
|
282849
|
+
refusedMs = clientKey ? ingestWindows.charge(clientKey) : sharedWindows.charge(UNATTESTED_CLIENT_KEY3);
|
|
282614
282850
|
}
|
|
282615
282851
|
if (refusedMs === null) return null;
|
|
282616
282852
|
stats2.rateLimitRejects++;
|
|
@@ -283215,7 +283451,7 @@ async function checkProjectTokens(subpath, url, method, body) {
|
|
|
283215
283451
|
}
|
|
283216
283452
|
var relayRoutes = new Hono137();
|
|
283217
283453
|
relayRoutes.post("/launch-engagement", makeBodyLimit(2048), async (c) => {
|
|
283218
|
-
const limited = relayRateLimit(c,
|
|
283454
|
+
const limited = relayRateLimit(c, true);
|
|
283219
283455
|
if (limited) return limited;
|
|
283220
283456
|
const parsed = launchEngagementSchema.safeParse(
|
|
283221
283457
|
await c.req.json().catch(() => null)
|
|
@@ -283227,7 +283463,7 @@ relayRoutes.post("/launch-engagement", makeBodyLimit(2048), async (c) => {
|
|
|
283227
283463
|
relayRoutes.all("*", async (c) => {
|
|
283228
283464
|
const url = new URL(c.req.url);
|
|
283229
283465
|
const subpath = stripRelayPrefix(url.pathname);
|
|
283230
|
-
const limited = relayRateLimit(c, subpath);
|
|
283466
|
+
const limited = relayRateLimit(c, isIngestSubpath(subpath));
|
|
283231
283467
|
if (limited) {
|
|
283232
283468
|
return limited;
|
|
283233
283469
|
}
|
|
@@ -284076,7 +284312,7 @@ function egressOverrideWeakensDefaults(override) {
|
|
|
284076
284312
|
}
|
|
284077
284313
|
|
|
284078
284314
|
// server/services/github-checks/network-monitor.ts
|
|
284079
|
-
import { isIP as
|
|
284315
|
+
import { isIP as isIP3 } from "net";
|
|
284080
284316
|
|
|
284081
284317
|
// server/services/github-checks/network-monitor-script.ts
|
|
284082
284318
|
var NETWORK_MONITOR_SCRIPT = String.raw`
|
|
@@ -284287,7 +284523,7 @@ function parseConnectionRecord(line2) {
|
|
|
284287
284523
|
if (line2.length > LINE_LIMIT) return null;
|
|
284288
284524
|
try {
|
|
284289
284525
|
const row2 = JSON.parse(line2);
|
|
284290
|
-
if (!row2 || row2.kind !== "connection" || !outcomes.has(row2.outcome) || !["tcp", "udp"].includes(row2.protocol) || typeof row2.destinationIp !== "string" ||
|
|
284526
|
+
if (!row2 || row2.kind !== "connection" || !outcomes.has(row2.outcome) || !["tcp", "udp"].includes(row2.protocol) || typeof row2.destinationIp !== "string" || isIP3(row2.destinationIp) === 0 || row2.destinationIp.includes("%") || isIP3(row2.destinationIp) !== row2.family || !Number.isInteger(row2.destinationPort) || row2.destinationPort < 1 || row2.destinationPort > 65535 || !Number.isSafeInteger(row2.timestamp) || row2.timestamp < 0)
|
|
284291
284527
|
return null;
|
|
284292
284528
|
return {
|
|
284293
284529
|
destinationIp: row2.destinationIp,
|