@alpic-ai/api 0.0.0-staging.g7d209e8 → 0.0.0-staging.g7d9fbc3

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.
Files changed (3) hide show
  1. package/dist/index.d.mts +6771 -146
  2. package/dist/index.mjs +3395 -349
  3. package/package.json +26 -10
package/dist/index.mjs CHANGED
@@ -1,11 +1,1920 @@
1
1
  import { z } from "zod";
2
+ import * as z$1 from "zod/v4";
2
3
  import { oc } from "@orpc/contract";
3
4
  import ms from "ms";
4
- const platformSchema = z.enum(["chatgpt", "claudeai"]);
5
+ // \0rolldown/runtime.js
6
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
7
+ // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_supports-color@8.1.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
8
+ /**
9
+ * Reusable URL validation that disallows javascript: scheme
10
+ */
11
+ const SafeUrlSchema = z$1.url().superRefine((val, ctx) => {
12
+ if (!URL.canParse(val)) {
13
+ ctx.addIssue({
14
+ code: z$1.ZodIssueCode.custom,
15
+ message: "URL must be parseable",
16
+ fatal: true
17
+ });
18
+ return z$1.NEVER;
19
+ }
20
+ }).refine((url) => {
21
+ const u = new URL(url);
22
+ return u.protocol !== "javascript:" && u.protocol !== "data:" && u.protocol !== "vbscript:";
23
+ }, { message: "URL cannot use javascript:, data:, or vbscript: scheme" });
24
+ /**
25
+ * RFC 9728 OAuth Protected Resource Metadata
26
+ */
27
+ const OAuthProtectedResourceMetadataSchema = z$1.looseObject({
28
+ resource: z$1.string().url(),
29
+ authorization_servers: z$1.array(SafeUrlSchema).optional(),
30
+ jwks_uri: z$1.string().url().optional(),
31
+ scopes_supported: z$1.array(z$1.string()).optional(),
32
+ bearer_methods_supported: z$1.array(z$1.string()).optional(),
33
+ resource_signing_alg_values_supported: z$1.array(z$1.string()).optional(),
34
+ resource_name: z$1.string().optional(),
35
+ resource_documentation: z$1.string().optional(),
36
+ resource_policy_uri: z$1.string().url().optional(),
37
+ resource_tos_uri: z$1.string().url().optional(),
38
+ tls_client_certificate_bound_access_tokens: z$1.boolean().optional(),
39
+ authorization_details_types_supported: z$1.array(z$1.string()).optional(),
40
+ dpop_signing_alg_values_supported: z$1.array(z$1.string()).optional(),
41
+ dpop_bound_access_tokens_required: z$1.boolean().optional()
42
+ });
43
+ /**
44
+ * RFC 8414 OAuth 2.0 Authorization Server Metadata
45
+ */
46
+ const OAuthMetadataSchema = z$1.looseObject({
47
+ issuer: z$1.string(),
48
+ authorization_endpoint: SafeUrlSchema,
49
+ token_endpoint: SafeUrlSchema,
50
+ registration_endpoint: SafeUrlSchema.optional(),
51
+ scopes_supported: z$1.array(z$1.string()).optional(),
52
+ response_types_supported: z$1.array(z$1.string()),
53
+ response_modes_supported: z$1.array(z$1.string()).optional(),
54
+ grant_types_supported: z$1.array(z$1.string()).optional(),
55
+ token_endpoint_auth_methods_supported: z$1.array(z$1.string()).optional(),
56
+ token_endpoint_auth_signing_alg_values_supported: z$1.array(z$1.string()).optional(),
57
+ service_documentation: SafeUrlSchema.optional(),
58
+ revocation_endpoint: SafeUrlSchema.optional(),
59
+ revocation_endpoint_auth_methods_supported: z$1.array(z$1.string()).optional(),
60
+ revocation_endpoint_auth_signing_alg_values_supported: z$1.array(z$1.string()).optional(),
61
+ introspection_endpoint: z$1.string().optional(),
62
+ introspection_endpoint_auth_methods_supported: z$1.array(z$1.string()).optional(),
63
+ introspection_endpoint_auth_signing_alg_values_supported: z$1.array(z$1.string()).optional(),
64
+ code_challenge_methods_supported: z$1.array(z$1.string()).optional(),
65
+ client_id_metadata_document_supported: z$1.boolean().optional()
66
+ });
67
+ /**
68
+ * OpenID Connect Discovery 1.0 Provider Metadata
69
+ * see: https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
70
+ */
71
+ const OpenIdProviderMetadataSchema = z$1.looseObject({
72
+ issuer: z$1.string(),
73
+ authorization_endpoint: SafeUrlSchema,
74
+ token_endpoint: SafeUrlSchema,
75
+ userinfo_endpoint: SafeUrlSchema.optional(),
76
+ jwks_uri: SafeUrlSchema,
77
+ registration_endpoint: SafeUrlSchema.optional(),
78
+ scopes_supported: z$1.array(z$1.string()).optional(),
79
+ response_types_supported: z$1.array(z$1.string()),
80
+ response_modes_supported: z$1.array(z$1.string()).optional(),
81
+ grant_types_supported: z$1.array(z$1.string()).optional(),
82
+ acr_values_supported: z$1.array(z$1.string()).optional(),
83
+ subject_types_supported: z$1.array(z$1.string()),
84
+ id_token_signing_alg_values_supported: z$1.array(z$1.string()),
85
+ id_token_encryption_alg_values_supported: z$1.array(z$1.string()).optional(),
86
+ id_token_encryption_enc_values_supported: z$1.array(z$1.string()).optional(),
87
+ userinfo_signing_alg_values_supported: z$1.array(z$1.string()).optional(),
88
+ userinfo_encryption_alg_values_supported: z$1.array(z$1.string()).optional(),
89
+ userinfo_encryption_enc_values_supported: z$1.array(z$1.string()).optional(),
90
+ request_object_signing_alg_values_supported: z$1.array(z$1.string()).optional(),
91
+ request_object_encryption_alg_values_supported: z$1.array(z$1.string()).optional(),
92
+ request_object_encryption_enc_values_supported: z$1.array(z$1.string()).optional(),
93
+ token_endpoint_auth_methods_supported: z$1.array(z$1.string()).optional(),
94
+ token_endpoint_auth_signing_alg_values_supported: z$1.array(z$1.string()).optional(),
95
+ display_values_supported: z$1.array(z$1.string()).optional(),
96
+ claim_types_supported: z$1.array(z$1.string()).optional(),
97
+ claims_supported: z$1.array(z$1.string()).optional(),
98
+ service_documentation: z$1.string().optional(),
99
+ claims_locales_supported: z$1.array(z$1.string()).optional(),
100
+ ui_locales_supported: z$1.array(z$1.string()).optional(),
101
+ claims_parameter_supported: z$1.boolean().optional(),
102
+ request_parameter_supported: z$1.boolean().optional(),
103
+ request_uri_parameter_supported: z$1.boolean().optional(),
104
+ require_request_uri_registration: z$1.boolean().optional(),
105
+ op_policy_uri: SafeUrlSchema.optional(),
106
+ op_tos_uri: SafeUrlSchema.optional(),
107
+ client_id_metadata_document_supported: z$1.boolean().optional()
108
+ });
109
+ /**
110
+ * OpenID Connect Discovery metadata that may include OAuth 2.0 fields
111
+ * This schema represents the real-world scenario where OIDC providers
112
+ * return a mix of OpenID Connect and OAuth 2.0 metadata fields
113
+ */
114
+ const OpenIdProviderDiscoveryMetadataSchema = z$1.object({
115
+ ...OpenIdProviderMetadataSchema.shape,
116
+ ...OAuthMetadataSchema.pick({ code_challenge_methods_supported: true }).shape
117
+ });
118
+ z$1.object({
119
+ access_token: z$1.string(),
120
+ id_token: z$1.string().optional(),
121
+ token_type: z$1.string(),
122
+ expires_in: z$1.coerce.number().optional(),
123
+ scope: z$1.string().optional(),
124
+ refresh_token: z$1.string().optional(),
125
+ /**
126
+ * Not part of the wire format: the authorization server this value was obtained from, added by
127
+ * the client's `auth()` before it is stored and compared when it is read back.
128
+ */
129
+ issuer: z$1.string().optional().catch(void 0)
130
+ }).strip();
131
+ z$1.object({
132
+ error: z$1.string(),
133
+ error_description: z$1.string().optional(),
134
+ error_uri: z$1.string().optional()
135
+ });
136
+ /**
137
+ * Optional version of SafeUrlSchema that allows empty string for retrocompatibility on tos_uri and logo_uri
138
+ */
139
+ const OptionalSafeUrlSchema = SafeUrlSchema.optional().or(z$1.literal("").transform(() => void 0));
140
+ /**
141
+ * RFC 7591 OAuth 2.0 Dynamic Client Registration metadata
142
+ */
143
+ const OAuthClientMetadataSchema = z$1.object({
144
+ redirect_uris: z$1.array(SafeUrlSchema),
145
+ token_endpoint_auth_method: z$1.string().optional(),
146
+ grant_types: z$1.array(z$1.string()).optional(),
147
+ response_types: z$1.array(z$1.string()).optional(),
148
+ client_name: z$1.string().optional(),
149
+ client_uri: SafeUrlSchema.optional(),
150
+ logo_uri: OptionalSafeUrlSchema,
151
+ scope: z$1.string().optional(),
152
+ contacts: z$1.array(z$1.string()).optional(),
153
+ tos_uri: OptionalSafeUrlSchema,
154
+ policy_uri: z$1.string().optional(),
155
+ jwks_uri: SafeUrlSchema.optional(),
156
+ jwks: z$1.any().optional(),
157
+ software_id: z$1.string().optional(),
158
+ software_version: z$1.string().optional(),
159
+ software_statement: z$1.string().optional()
160
+ }).strip();
161
+ /**
162
+ * RFC 7591 OAuth 2.0 Dynamic Client Registration client information
163
+ */
164
+ const OAuthClientInformationSchema = z$1.object({
165
+ client_id: z$1.string(),
166
+ client_secret: z$1.string().optional(),
167
+ client_id_issued_at: z$1.number().optional(),
168
+ client_secret_expires_at: z$1.number().optional(),
169
+ /**
170
+ * Not part of the wire format: the authorization server this value was obtained from, added by
171
+ * the client's `auth()` before it is stored and compared when it is read back.
172
+ */
173
+ issuer: z$1.string().optional().catch(void 0)
174
+ }).strip();
175
+ OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);
176
+ z$1.object({
177
+ error: z$1.string(),
178
+ error_description: z$1.string().optional()
179
+ }).strip();
180
+ z$1.object({
181
+ token: z$1.string(),
182
+ token_type_hint: z$1.string().optional()
183
+ }).strip();
184
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/constants.js
185
+ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
186
+ module.exports = {
187
+ MAX_LENGTH: 256,
188
+ MAX_SAFE_COMPONENT_LENGTH: 16,
189
+ MAX_SAFE_BUILD_LENGTH: 250,
190
+ MAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER ||
191
+ /* istanbul ignore next */ 9007199254740991,
192
+ WHITESPACE_CHARACTERS: [
193
+ " ",
194
+ "\n",
195
+ "\v",
196
+ "\f",
197
+ "\r",
198
+ " ",
199
+ "\xA0",
200
+ " ",
201
+ " ",
202
+ " ",
203
+ " ",
204
+ " ",
205
+ " ",
206
+ " ",
207
+ " ",
208
+ " ",
209
+ " ",
210
+ " ",
211
+ " ",
212
+ "\u2028",
213
+ "\u2029",
214
+ " ",
215
+ " ",
216
+ " ",
217
+ ""
218
+ ],
219
+ RELEASE_TYPES: [
220
+ "major",
221
+ "premajor",
222
+ "minor",
223
+ "preminor",
224
+ "patch",
225
+ "prepatch",
226
+ "prerelease"
227
+ ],
228
+ SEMVER_SPEC_VERSION: "2.0.0",
229
+ FLAG_INCLUDE_PRERELEASE: 1,
230
+ FLAG_LOOSE: 2
231
+ };
232
+ }));
233
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/debug.js
234
+ var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
235
+ module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
236
+ }));
237
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/re.js
238
+ var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
239
+ const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
240
+ const debug = require_debug();
241
+ exports = module.exports = {};
242
+ const re = exports.re = [];
243
+ const safeRe = exports.safeRe = [];
244
+ const src = exports.src = [];
245
+ const safeSrc = exports.safeSrc = [];
246
+ const t = exports.t = {};
247
+ let R = 0;
248
+ const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
249
+ const safeRegexReplacements = [
250
+ ["\\s", 1],
251
+ ["\\d", MAX_LENGTH],
252
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
253
+ ];
254
+ const makeSafeRegex = (value) => {
255
+ for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
256
+ return value;
257
+ };
258
+ const createToken = (name, value, isGlobal) => {
259
+ const safe = makeSafeRegex(value);
260
+ const index = R++;
261
+ debug(name, index, value);
262
+ t[name] = index;
263
+ src[index] = value;
264
+ safeSrc[index] = safe;
265
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
266
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
267
+ };
268
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
269
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
270
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
271
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
272
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
273
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
274
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
275
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
276
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
277
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
278
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
279
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
280
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
281
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
282
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
283
+ createToken("GTLT", "((?:<|>)?=?)");
284
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
285
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
286
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
287
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
288
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
289
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
290
+ createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
291
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
292
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
293
+ createToken("COERCERTL", src[t.COERCE], true);
294
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
295
+ createToken("LONETILDE", "(?:~>?)");
296
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
297
+ exports.tildeTrimReplace = "$1~";
298
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
299
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
300
+ createToken("LONECARET", "(?:\\^)");
301
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
302
+ exports.caretTrimReplace = "$1^";
303
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
304
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
305
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
306
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
307
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
308
+ exports.comparatorTrimReplace = "$1$2$3";
309
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
310
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
311
+ createToken("STAR", "(<|>)?=?\\s*\\*");
312
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
313
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
314
+ }));
315
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/parse-options.js
316
+ var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
317
+ const looseOption = Object.freeze({ loose: true });
318
+ const emptyOpts = Object.freeze({});
319
+ const parseOptions = (options) => {
320
+ if (!options) return emptyOpts;
321
+ if (typeof options !== "object") return looseOption;
322
+ return options;
323
+ };
324
+ module.exports = parseOptions;
325
+ }));
326
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/identifiers.js
327
+ var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
328
+ const numeric = /^[0-9]+$/;
329
+ const compareIdentifiers = (a, b) => {
330
+ if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
331
+ const anum = numeric.test(a);
332
+ const bnum = numeric.test(b);
333
+ if (anum && bnum) {
334
+ a = +a;
335
+ b = +b;
336
+ }
337
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
338
+ };
339
+ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
340
+ module.exports = {
341
+ compareIdentifiers,
342
+ rcompareIdentifiers
343
+ };
344
+ }));
345
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/classes/semver.js
346
+ var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
347
+ const debug = require_debug();
348
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
349
+ const { safeRe: re, t } = require_re();
350
+ const parseOptions = require_parse_options();
351
+ const { compareIdentifiers } = require_identifiers();
352
+ const isPrereleaseIdentifier = (prerelease, identifier) => {
353
+ const identifiers = identifier.split(".");
354
+ if (identifiers.length > prerelease.length) return false;
355
+ for (let i = 0; i < identifiers.length; i++) if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) return false;
356
+ return true;
357
+ };
358
+ module.exports = class SemVer {
359
+ constructor(version, options) {
360
+ options = parseOptions(options);
361
+ if (version instanceof SemVer) {
362
+ if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
363
+ else version = version.version;
364
+ } else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
365
+ if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
366
+ debug("SemVer", version, options);
367
+ this.options = options;
368
+ this.loose = !!options.loose;
369
+ this.includePrerelease = !!options.includePrerelease;
370
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
371
+ if (!m) throw new TypeError(`Invalid Version: ${version}`);
372
+ this.raw = version;
373
+ this.major = +m[1];
374
+ this.minor = +m[2];
375
+ this.patch = +m[3];
376
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
377
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
378
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
379
+ if (!m[4]) this.prerelease = [];
380
+ else this.prerelease = m[4].split(".").map((id) => {
381
+ if (/^[0-9]+$/.test(id)) {
382
+ const num = +id;
383
+ if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
384
+ }
385
+ return id;
386
+ });
387
+ this.build = m[5] ? m[5].split(".") : [];
388
+ this.format();
389
+ }
390
+ format() {
391
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
392
+ if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
393
+ return this.version;
394
+ }
395
+ toString() {
396
+ return this.version;
397
+ }
398
+ compare(other) {
399
+ debug("SemVer.compare", this.version, this.options, other);
400
+ if (!(other instanceof SemVer)) {
401
+ if (typeof other === "string" && other === this.version) return 0;
402
+ other = new SemVer(other, this.options);
403
+ }
404
+ if (other.version === this.version) return 0;
405
+ return this.compareMain(other) || this.comparePre(other);
406
+ }
407
+ compareMain(other) {
408
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
409
+ if (this.major < other.major) return -1;
410
+ if (this.major > other.major) return 1;
411
+ if (this.minor < other.minor) return -1;
412
+ if (this.minor > other.minor) return 1;
413
+ if (this.patch < other.patch) return -1;
414
+ if (this.patch > other.patch) return 1;
415
+ return 0;
416
+ }
417
+ comparePre(other) {
418
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
419
+ if (this.prerelease.length && !other.prerelease.length) return -1;
420
+ else if (!this.prerelease.length && other.prerelease.length) return 1;
421
+ else if (!this.prerelease.length && !other.prerelease.length) return 0;
422
+ let i = 0;
423
+ do {
424
+ const a = this.prerelease[i];
425
+ const b = other.prerelease[i];
426
+ debug("prerelease compare", i, a, b);
427
+ if (a === void 0 && b === void 0) return 0;
428
+ else if (b === void 0) return 1;
429
+ else if (a === void 0) return -1;
430
+ else if (a === b) continue;
431
+ else return compareIdentifiers(a, b);
432
+ } while (++i);
433
+ }
434
+ compareBuild(other) {
435
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
436
+ let i = 0;
437
+ do {
438
+ const a = this.build[i];
439
+ const b = other.build[i];
440
+ debug("build compare", i, a, b);
441
+ if (a === void 0 && b === void 0) return 0;
442
+ else if (b === void 0) return 1;
443
+ else if (a === void 0) return -1;
444
+ else if (a === b) continue;
445
+ else return compareIdentifiers(a, b);
446
+ } while (++i);
447
+ }
448
+ inc(release, identifier, identifierBase) {
449
+ if (release.startsWith("pre")) {
450
+ if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
451
+ if (identifier) {
452
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
453
+ if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
454
+ }
455
+ }
456
+ switch (release) {
457
+ case "premajor":
458
+ this.prerelease.length = 0;
459
+ this.patch = 0;
460
+ this.minor = 0;
461
+ this.major++;
462
+ this.inc("pre", identifier, identifierBase);
463
+ break;
464
+ case "preminor":
465
+ this.prerelease.length = 0;
466
+ this.patch = 0;
467
+ this.minor++;
468
+ this.inc("pre", identifier, identifierBase);
469
+ break;
470
+ case "prepatch":
471
+ this.prerelease.length = 0;
472
+ this.inc("patch", identifier, identifierBase);
473
+ this.inc("pre", identifier, identifierBase);
474
+ break;
475
+ case "prerelease":
476
+ if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
477
+ this.inc("pre", identifier, identifierBase);
478
+ break;
479
+ case "release":
480
+ if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
481
+ this.prerelease.length = 0;
482
+ break;
483
+ case "major":
484
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
485
+ this.minor = 0;
486
+ this.patch = 0;
487
+ this.prerelease = [];
488
+ break;
489
+ case "minor":
490
+ if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
491
+ this.patch = 0;
492
+ this.prerelease = [];
493
+ break;
494
+ case "patch":
495
+ if (this.prerelease.length === 0) this.patch++;
496
+ this.prerelease = [];
497
+ break;
498
+ case "pre": {
499
+ const base = Number(identifierBase) ? 1 : 0;
500
+ if (this.prerelease.length === 0) this.prerelease = [base];
501
+ else {
502
+ let i = this.prerelease.length;
503
+ while (--i >= 0) if (typeof this.prerelease[i] === "number") {
504
+ this.prerelease[i]++;
505
+ i = -2;
506
+ }
507
+ if (i === -1) {
508
+ if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
509
+ this.prerelease.push(base);
510
+ }
511
+ }
512
+ if (identifier) {
513
+ let prerelease = [identifier, base];
514
+ if (identifierBase === false) prerelease = [identifier];
515
+ if (isPrereleaseIdentifier(this.prerelease, identifier)) {
516
+ const prereleaseBase = this.prerelease[identifier.split(".").length];
517
+ if (isNaN(prereleaseBase)) this.prerelease = prerelease;
518
+ } else this.prerelease = prerelease;
519
+ }
520
+ break;
521
+ }
522
+ default: throw new Error(`invalid increment argument: ${release}`);
523
+ }
524
+ this.raw = this.format();
525
+ if (this.build.length) this.raw += `+${this.build.join(".")}`;
526
+ return this;
527
+ }
528
+ };
529
+ }));
530
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/parse.js
531
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
532
+ const SemVer = require_semver$1();
533
+ const parse = (version, options, throwErrors = false) => {
534
+ if (version instanceof SemVer) return version;
535
+ try {
536
+ return new SemVer(version, options);
537
+ } catch (er) {
538
+ if (!throwErrors) return null;
539
+ throw er;
540
+ }
541
+ };
542
+ module.exports = parse;
543
+ }));
544
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/valid.js
545
+ var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
546
+ const parse = require_parse();
547
+ const valid = (version, options) => {
548
+ const v = parse(version, options);
549
+ return v ? v.version : null;
550
+ };
551
+ module.exports = valid;
552
+ }));
553
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/clean.js
554
+ var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
555
+ const parse = require_parse();
556
+ const clean = (version, options) => {
557
+ const s = parse(version.trim().replace(/^[=v]+/, ""), options);
558
+ return s ? s.version : null;
559
+ };
560
+ module.exports = clean;
561
+ }));
562
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/inc.js
563
+ var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
564
+ const SemVer = require_semver$1();
565
+ const inc = (version, release, options, identifier, identifierBase) => {
566
+ if (typeof options === "string") {
567
+ identifierBase = identifier;
568
+ identifier = options;
569
+ options = void 0;
570
+ }
571
+ try {
572
+ return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
573
+ } catch (er) {
574
+ return null;
575
+ }
576
+ };
577
+ module.exports = inc;
578
+ }));
579
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/diff.js
580
+ var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
581
+ const parse = require_parse();
582
+ const diff = (version1, version2) => {
583
+ const v1 = parse(version1, null, true);
584
+ const v2 = parse(version2, null, true);
585
+ const comparison = v1.compare(v2);
586
+ if (comparison === 0) return null;
587
+ const v1Higher = comparison > 0;
588
+ const highVersion = v1Higher ? v1 : v2;
589
+ const lowVersion = v1Higher ? v2 : v1;
590
+ const highHasPre = !!highVersion.prerelease.length;
591
+ if (!!lowVersion.prerelease.length && !highHasPre) {
592
+ if (!lowVersion.patch && !lowVersion.minor) return "major";
593
+ if (lowVersion.compareMain(highVersion) === 0) {
594
+ if (lowVersion.minor && !lowVersion.patch) return "minor";
595
+ return "patch";
596
+ }
597
+ }
598
+ const prefix = highHasPre ? "pre" : "";
599
+ if (v1.major !== v2.major) return prefix + "major";
600
+ if (v1.minor !== v2.minor) return prefix + "minor";
601
+ if (v1.patch !== v2.patch) return prefix + "patch";
602
+ return "prerelease";
603
+ };
604
+ module.exports = diff;
605
+ }));
606
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/major.js
607
+ var require_major = /* @__PURE__ */ __commonJSMin(((exports, module) => {
608
+ const SemVer = require_semver$1();
609
+ const major = (a, loose) => new SemVer(a, loose).major;
610
+ module.exports = major;
611
+ }));
612
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/minor.js
613
+ var require_minor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
614
+ const SemVer = require_semver$1();
615
+ const minor = (a, loose) => new SemVer(a, loose).minor;
616
+ module.exports = minor;
617
+ }));
618
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/patch.js
619
+ var require_patch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
620
+ const SemVer = require_semver$1();
621
+ const patch = (a, loose) => new SemVer(a, loose).patch;
622
+ module.exports = patch;
623
+ }));
624
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/prerelease.js
625
+ var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
626
+ const parse = require_parse();
627
+ const prerelease = (version, options) => {
628
+ const parsed = parse(version, options);
629
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
630
+ };
631
+ module.exports = prerelease;
632
+ }));
633
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/compare.js
634
+ var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
635
+ const SemVer = require_semver$1();
636
+ const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
637
+ module.exports = compare;
638
+ }));
639
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/rcompare.js
640
+ var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
641
+ const compare = require_compare();
642
+ const rcompare = (a, b, loose) => compare(b, a, loose);
643
+ module.exports = rcompare;
644
+ }));
645
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/compare-loose.js
646
+ var require_compare_loose = /* @__PURE__ */ __commonJSMin(((exports, module) => {
647
+ const compare = require_compare();
648
+ const compareLoose = (a, b) => compare(a, b, true);
649
+ module.exports = compareLoose;
650
+ }));
651
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/compare-build.js
652
+ var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
653
+ const SemVer = require_semver$1();
654
+ const compareBuild = (a, b, loose) => {
655
+ const versionA = new SemVer(a, loose);
656
+ const versionB = new SemVer(b, loose);
657
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
658
+ };
659
+ module.exports = compareBuild;
660
+ }));
661
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/sort.js
662
+ var require_sort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
663
+ const compareBuild = require_compare_build();
664
+ const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
665
+ module.exports = sort;
666
+ }));
667
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/rsort.js
668
+ var require_rsort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
669
+ const compareBuild = require_compare_build();
670
+ const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
671
+ module.exports = rsort;
672
+ }));
673
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/gt.js
674
+ var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
675
+ const compare = require_compare();
676
+ const gt = (a, b, loose) => compare(a, b, loose) > 0;
677
+ module.exports = gt;
678
+ }));
679
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/lt.js
680
+ var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
681
+ const compare = require_compare();
682
+ const lt = (a, b, loose) => compare(a, b, loose) < 0;
683
+ module.exports = lt;
684
+ }));
685
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/eq.js
686
+ var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
687
+ const compare = require_compare();
688
+ const eq = (a, b, loose) => compare(a, b, loose) === 0;
689
+ module.exports = eq;
690
+ }));
691
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/neq.js
692
+ var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
693
+ const compare = require_compare();
694
+ const neq = (a, b, loose) => compare(a, b, loose) !== 0;
695
+ module.exports = neq;
696
+ }));
697
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/gte.js
698
+ var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
699
+ const compare = require_compare();
700
+ const gte = (a, b, loose) => compare(a, b, loose) >= 0;
701
+ module.exports = gte;
702
+ }));
703
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/lte.js
704
+ var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
705
+ const compare = require_compare();
706
+ const lte = (a, b, loose) => compare(a, b, loose) <= 0;
707
+ module.exports = lte;
708
+ }));
709
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/cmp.js
710
+ var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
711
+ const eq = require_eq();
712
+ const neq = require_neq();
713
+ const gt = require_gt();
714
+ const gte = require_gte();
715
+ const lt = require_lt();
716
+ const lte = require_lte();
717
+ const cmp = (a, op, b, loose) => {
718
+ switch (op) {
719
+ case "===":
720
+ if (typeof a === "object") a = a.version;
721
+ if (typeof b === "object") b = b.version;
722
+ return a === b;
723
+ case "!==":
724
+ if (typeof a === "object") a = a.version;
725
+ if (typeof b === "object") b = b.version;
726
+ return a !== b;
727
+ case "":
728
+ case "=":
729
+ case "==": return eq(a, b, loose);
730
+ case "!=": return neq(a, b, loose);
731
+ case ">": return gt(a, b, loose);
732
+ case ">=": return gte(a, b, loose);
733
+ case "<": return lt(a, b, loose);
734
+ case "<=": return lte(a, b, loose);
735
+ default: throw new TypeError(`Invalid operator: ${op}`);
736
+ }
737
+ };
738
+ module.exports = cmp;
739
+ }));
740
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/coerce.js
741
+ var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
742
+ const SemVer = require_semver$1();
743
+ const parse = require_parse();
744
+ const { safeRe: re, t } = require_re();
745
+ const coerce = (version, options) => {
746
+ if (version instanceof SemVer) return version;
747
+ if (typeof version === "number") version = String(version);
748
+ if (typeof version !== "string") return null;
749
+ options = options || {};
750
+ let match = null;
751
+ if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
752
+ else {
753
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
754
+ let next;
755
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
756
+ if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
757
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
758
+ }
759
+ coerceRtlRegex.lastIndex = -1;
760
+ }
761
+ if (match === null) return null;
762
+ const major = match[2];
763
+ const minor = match[3] || "0";
764
+ const patch = match[4] || "0";
765
+ const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
766
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
767
+ return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
768
+ };
769
+ module.exports = coerce;
770
+ }));
771
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/truncate.js
772
+ var require_truncate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
773
+ const parse = require_parse();
774
+ const constants = require_constants();
775
+ const SemVer = require_semver$1();
776
+ const truncate = (version, truncation, options) => {
777
+ if (!constants.RELEASE_TYPES.includes(truncation)) return null;
778
+ const clonedVersion = cloneInputVersion(version, options);
779
+ return clonedVersion && doTruncation(clonedVersion, truncation);
780
+ };
781
+ const cloneInputVersion = (version, options) => {
782
+ const versionStringToParse = version instanceof SemVer ? version.version : version;
783
+ return parse(versionStringToParse, options);
784
+ };
785
+ const doTruncation = (version, truncation) => {
786
+ if (isPrerelease(truncation)) return version.version;
787
+ version.prerelease = [];
788
+ switch (truncation) {
789
+ case "major":
790
+ version.minor = 0;
791
+ version.patch = 0;
792
+ break;
793
+ case "minor": version.patch = 0;
794
+ }
795
+ return version.format();
796
+ };
797
+ const isPrerelease = (type) => {
798
+ return type.startsWith("pre");
799
+ };
800
+ module.exports = truncate;
801
+ }));
802
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/lrucache.js
803
+ var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
804
+ var LRUCache = class {
805
+ constructor() {
806
+ this.max = 1e3;
807
+ this.map = /* @__PURE__ */ new Map();
808
+ }
809
+ get(key) {
810
+ const value = this.map.get(key);
811
+ if (value === void 0) return;
812
+ else {
813
+ this.map.delete(key);
814
+ this.map.set(key, value);
815
+ return value;
816
+ }
817
+ }
818
+ delete(key) {
819
+ return this.map.delete(key);
820
+ }
821
+ set(key, value) {
822
+ if (!this.delete(key) && value !== void 0) {
823
+ if (this.map.size >= this.max) {
824
+ const firstKey = this.map.keys().next().value;
825
+ this.delete(firstKey);
826
+ }
827
+ this.map.set(key, value);
828
+ }
829
+ return this;
830
+ }
831
+ };
832
+ module.exports = LRUCache;
833
+ }));
834
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/trim-comparator-whitespace.js
835
+ var require_trim_comparator_whitespace = /* @__PURE__ */ __commonJSMin(((exports, module) => {
836
+ const { MAX_LENGTH, MAX_SAFE_BUILD_LENGTH, WHITESPACE_CHARACTERS } = require_constants();
837
+ /**
838
+ * Remembers the last two rows of digits so their characters need not be reread.
839
+ * Positions start at -1 until a row has been found.
840
+ *
841
+ * @typedef {object} DigitRunCache
842
+ * @property {number} start The first character of the most recently found row.
843
+ * @property {number} end The position after that row's last character.
844
+ * @property {number} previousStart The first character of the previous row.
845
+ * @property {number} previousEnd The position after the previous row.
846
+ */
847
+ const whitespace = /* @__PURE__ */ new Uint8Array(65536);
848
+ for (const char of WHITESPACE_CHARACTERS) whitespace[char.charCodeAt(0)] = 1;
849
+ /**
850
+ * Checks whether a character is whitespace, like a space, tab, or newline.
851
+ * Looking past the end of the string returns false.
852
+ *
853
+ * @param {string|undefined} char One character, or undefined past the string's end.
854
+ * @returns {boolean} Whether the character is whitespace.
855
+ * @example isWhitespace(' ') // true
856
+ * @example isWhitespace('1') // false
857
+ */
858
+ const isWhitespace = (char) => char !== void 0 && whitespace[char.charCodeAt(0)] === 1;
859
+ /**
860
+ * Checks for v, =, or whitespace before the version number.
861
+ * These are historical version prefixes, not range operators:
862
+ * < and > are handled separately, as are tilde and caret ranges.
863
+ *
864
+ * @param {string|undefined} char One character to check.
865
+ * @returns {boolean} Whether the character can belong to a version prefix.
866
+ * @example isVersionPrefix('=') // true
867
+ * @example isVersionPrefix('>') // false
868
+ */
869
+ const isVersionPrefix = (char) => char === "v" || char === "=" || isWhitespace(char);
870
+ /**
871
+ * Checks whether a character is one of the digits 0 through 9.
872
+ *
873
+ * @param {string|undefined} char One character to check.
874
+ * @returns {boolean} Whether the character is an ASCII digit.
875
+ * @example isDigit('7') // true
876
+ * @example isDigit('.') // false
877
+ */
878
+ const isDigit = (char) => char !== void 0 && char >= "0" && char <= "9";
879
+ /**
880
+ * Checks whether a character is an English letter, uppercase or lowercase.
881
+ *
882
+ * @param {string|undefined} char One character to check.
883
+ * @returns {boolean} Whether the character is an ASCII letter.
884
+ * @example isLetter('b') // true
885
+ * @example isLetter('7') // false
886
+ */
887
+ const isLetter = (char) => char !== void 0 && (char >= "a" && char <= "z" || char >= "A" && char <= "Z");
888
+ /**
889
+ * Checks for a letter, digit, or hyphen: the characters allowed inside
890
+ * prerelease and build names such as beta-1.
891
+ *
892
+ * @param {string|undefined} char One character to check.
893
+ * @returns {boolean} Whether the character can be part of an identifier.
894
+ * @example isIdentifierCharacter('-') // true
895
+ * @example isIdentifierCharacter('.') // false; dots separate identifiers
896
+ */
897
+ const isIdentifierCharacter = (char) => isDigit(char) || isLetter(char) || char === "-";
898
+ /**
899
+ * Checks whether a version component can begin here: with a digit or
900
+ * a wildcard such as x, X, or *.
901
+ *
902
+ * @param {string|undefined} char One character to check.
903
+ * @returns {boolean} Whether a number or wildcard can start with this character.
904
+ * @example isVersionStart('x') // true
905
+ * @example isVersionStart('v') // false; v belongs to the prefix
906
+ */
907
+ const isVersionStart = (char) => isDigit(char) || char === "x" || char === "X" || char === "*";
908
+ /**
909
+ * Finds the end of a row of digits, but returns no more than limit digits.
910
+ * Remembers the last two rows so looking at them again does not reread them.
911
+ *
912
+ * @param {string} range The text to read; it is not changed.
913
+ * @param {number} start The position of the first character to check.
914
+ * @param {number} limit The most digit characters the returned match can include.
915
+ * @param {DigitRunCache} digitRuns Shared cache of digit-run positions, updated in place.
916
+ * @returns {number} The position after the matched digits, or start if none match.
917
+ * @example findDigitsEndIndex('123abc', 0, 10, digitRuns) // 3, pointing at a
918
+ * @example findDigitsEndIndex('123abc', 0, 2, digitRuns) // 2, pointing at the unread 3
919
+ */
920
+ const findDigitsEndIndex = (range, start, limit, digitRuns) => {
921
+ if (!isDigit(range[start])) return start;
922
+ if (start >= digitRuns.start && start < digitRuns.end) return Math.min(start + limit, digitRuns.end);
923
+ if (start >= digitRuns.previousStart && start < digitRuns.previousEnd) return Math.min(start + limit, digitRuns.previousEnd);
924
+ let end = start + 1;
925
+ while (isDigit(range[end])) end++;
926
+ digitRuns.previousStart = digitRuns.start;
927
+ digitRuns.previousEnd = digitRuns.end;
928
+ digitRuns.start = start;
929
+ digitRuns.end = end;
930
+ return Math.min(start + limit, end);
931
+ };
932
+ /**
933
+ * Reads a number using the old regex's length and leading-zero rules.
934
+ * Strict mode reads just the first zero in 012; loose mode can read all three.
935
+ *
936
+ * @param {string} range The text to read; it is not changed.
937
+ * @param {number} start The position where the number should begin.
938
+ * @param {boolean} loose Whether to allow leading zeros.
939
+ * @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
940
+ * @returns {number} The position after the matched digits, not their numeric value.
941
+ * @example findVersionNumberEndIndex('012', 0, false, digitRuns) // 1
942
+ * @example findVersionNumberEndIndex('012', 0, true, digitRuns) // 3
943
+ */
944
+ const findVersionNumberEndIndex = (range, start, loose, digitRuns) => {
945
+ if (!loose && range[start] === "0") return start + 1;
946
+ return findDigitsEndIndex(range, start, loose ? MAX_LENGTH : MAX_LENGTH + 1, digitRuns);
947
+ };
948
+ /**
949
+ * Reads one piece of a prerelease name, such as beta or 1 in beta.1.
950
+ * Tries the letter-or-hyphen form first, then the number-only form.
951
+ *
952
+ * @param {string} range The text to read; it is not changed.
953
+ * @param {number} start The position where the identifier should begin.
954
+ * @param {boolean} loose Whether numeric identifiers may have leading zeros.
955
+ * @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
956
+ * @returns {number} The position after the identifier, or start if none matches.
957
+ * @example findPrereleaseIdentifierEndIndex('beta.1', 0, false, digitRuns) // 4, at the dot
958
+ * @example findPrereleaseIdentifierEndIndex('001beta', 0, false, digitRuns) // 7
959
+ */
960
+ const findPrereleaseIdentifierEndIndex = (range, start, loose, digitRuns) => {
961
+ const digitsEnd = findDigitsEndIndex(range, start, MAX_LENGTH, digitRuns);
962
+ if (isLetter(range[digitsEnd]) || range[digitsEnd] === "-") {
963
+ let end = digitsEnd + 1;
964
+ const limit = end + MAX_SAFE_BUILD_LENGTH;
965
+ while (end < limit && isIdentifierCharacter(range[end])) end++;
966
+ return end;
967
+ }
968
+ return findVersionNumberEndIndex(range, start, loose, digitRuns);
969
+ };
970
+ /**
971
+ * Reads a prerelease suffix such as -beta.1, one dot-separated piece at a time.
972
+ * Loose mode also allows the name without its opening hyphen.
973
+ *
974
+ * @param {string} range The text to read; it is not changed.
975
+ * @param {number} start The position where the suffix should begin, including -.
976
+ * @param {boolean} loose Whether the opening hyphen is optional and zeros allowed.
977
+ * @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
978
+ * @returns {number} The position after the matched suffix, or start if absent.
979
+ * @example findPrereleaseEndIndex('-beta.1+sha', 0, false, digitRuns) // 7, at the plus
980
+ * @example findPrereleaseEndIndex('beta', 0, false, digitRuns) // 0; no opening hyphen
981
+ */
982
+ const findPrereleaseEndIndex = (range, start, loose, digitRuns) => {
983
+ const hyphen = range[start] === "-";
984
+ if (!loose && !hyphen) return start;
985
+ const identifierStart = start + (hyphen ? 1 : 0);
986
+ let end = findPrereleaseIdentifierEndIndex(range, identifierStart, loose, digitRuns);
987
+ if (end === identifierStart) {
988
+ if (!loose || !hyphen) return start;
989
+ end = findPrereleaseIdentifierEndIndex(range, start, loose, digitRuns);
990
+ }
991
+ while (range[end] === ".") {
992
+ const next = findPrereleaseIdentifierEndIndex(range, end + 1, loose, digitRuns);
993
+ if (next === end + 1) break;
994
+ end = next;
995
+ }
996
+ return end;
997
+ };
998
+ /**
999
+ * Reads one build-name piece, such as sha or 123 in +sha.123.
1000
+ * Stops at a disallowed character or the old regex's length limit.
1001
+ *
1002
+ * @param {string} range The text to read; it is not changed.
1003
+ * @param {number} start The position where the identifier should begin.
1004
+ * @returns {number} The position after the identifier, or start if none matches.
1005
+ * @example findBuildIdentifierEndIndex('sha.123', 0) // 3, at the dot
1006
+ * @example findBuildIdentifierEndIndex('001', 0) // 3; leading zeros are allowed
1007
+ */
1008
+ const findBuildIdentifierEndIndex = (range, start) => {
1009
+ let end = start;
1010
+ while (end - start < MAX_SAFE_BUILD_LENGTH && isIdentifierCharacter(range[end])) end++;
1011
+ return end;
1012
+ };
1013
+ /**
1014
+ * Reads optional build metadata such as +sha.123.
1015
+ * Leaves the position unchanged if there is no plus sign followed by a name.
1016
+ *
1017
+ * @param {string} range The text to read; it is not changed.
1018
+ * @param {number} start The position where the opening + should be.
1019
+ * @returns {number} The position after the matched metadata, or start if absent.
1020
+ * @example findBuildEndIndex('+sha.123 <2', 0) // 8, at the space
1021
+ * @example findBuildEndIndex('+', 0) // 0; a plus sign alone is not a match
1022
+ */
1023
+ const findBuildEndIndex = (range, start) => {
1024
+ if (range[start] !== "+") return start;
1025
+ let end = findBuildIdentifierEndIndex(range, start + 1);
1026
+ if (end === start + 1) return start;
1027
+ while (range[end] === ".") {
1028
+ const next = findBuildIdentifierEndIndex(range, end + 1);
1029
+ if (next === end + 1) break;
1030
+ end = next;
1031
+ }
1032
+ return end;
1033
+ };
1034
+ /**
1035
+ * Reads three numbers separated by dots, then any prerelease and build suffixes.
1036
+ * Uses loose rules, so forms such as 01.02.03beta can match here.
1037
+ *
1038
+ * @param {string} range The text to read; it is not changed.
1039
+ * @param {number} start The position of the first number, after any prefix.
1040
+ * @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
1041
+ * @returns {number} The position after the version match, or start if none matches.
1042
+ * @example findLooseFullVersionEndIndex('1.2.3-beta+sha <2', 0, digitRuns) // 14
1043
+ * @example findLooseFullVersionEndIndex('1.2', 0, digitRuns) // 0; needs three numbers
1044
+ */
1045
+ const findLooseFullVersionEndIndex = (range, start, digitRuns) => {
1046
+ let end = start;
1047
+ for (let component = 0; component < 3; component++) {
1048
+ const next = findVersionNumberEndIndex(range, end, true, digitRuns);
1049
+ if (next === end) return start;
1050
+ end = next;
1051
+ if (component < 2) {
1052
+ if (range[end] !== ".") return start;
1053
+ end++;
1054
+ }
1055
+ }
1056
+ const prereleaseEnd = findPrereleaseEndIndex(range, end, true, digitRuns);
1057
+ return findBuildEndIndex(range, prereleaseEnd);
1058
+ };
1059
+ /**
1060
+ * Reads one component of a partial or wildcard version, such as 2 or x in 2.x.
1061
+ * Numbers use strict leading-zero rules; wildcards take up one character.
1062
+ *
1063
+ * @param {string} range The text to read; it is not changed.
1064
+ * @param {number} start The position where the component should begin.
1065
+ * @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
1066
+ * @returns {number} The position after the component, or start if none matches.
1067
+ * @example findPartialVersionComponentEndIndex('2.x', 0, digitRuns) // 1, at the dot
1068
+ * @example findPartialVersionComponentEndIndex('2.x', 2, digitRuns) // 3, after x
1069
+ */
1070
+ const findPartialVersionComponentEndIndex = (range, start, digitRuns) => {
1071
+ if (isDigit(range[start])) return findVersionNumberEndIndex(range, start, false, digitRuns);
1072
+ return isVersionStart(range[start]) ? start + 1 : start;
1073
+ };
1074
+ /**
1075
+ * Reads up to three components, allowing forms such as 1, 1.2, or 1.x.
1076
+ * After the third component, also reads any strict prerelease and build suffixes.
1077
+ *
1078
+ * @param {string} range The text to read; it is not changed.
1079
+ * @param {number} start The position of a number or wildcard, after any prefix.
1080
+ * @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
1081
+ * @returns {number} The position after the matched version text.
1082
+ * @example findPartialVersionEndIndex('1.x <2', 0, digitRuns) // 3, at the space
1083
+ * @example findPartialVersionEndIndex('1.', 0, digitRuns) // 1; the trailing dot is unread
1084
+ */
1085
+ const findPartialVersionEndIndex = (range, start, digitRuns) => {
1086
+ let end = findPartialVersionComponentEndIndex(range, start, digitRuns);
1087
+ for (let component = 0; component < 2; component++) {
1088
+ if (range[end] !== ".") return end;
1089
+ const next = findPartialVersionComponentEndIndex(range, end + 1, digitRuns);
1090
+ if (next === end + 1) return end;
1091
+ end = next;
1092
+ }
1093
+ const prereleaseEnd = findPrereleaseEndIndex(range, end, false, digitRuns);
1094
+ return findBuildEndIndex(range, prereleaseEnd);
1095
+ };
1096
+ /**
1097
+ * Finds where a version match ends, without deciding whether the range is valid.
1098
+ * Tries a loose full version first, then a partial or wildcard version, just
1099
+ * like the old regex's LOOSEPLAIN and XRANGEPLAIN alternatives.
1100
+ *
1101
+ * @param {string} range The text to read; it is not changed.
1102
+ * @param {number} start The position of a number or wildcard, after any prefix.
1103
+ * @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
1104
+ * @returns {number} The position where scanning the next candidate can resume.
1105
+ * @example findVersionEndIndex('1.2.3 <2', 0, digitRuns) // 5, at the space
1106
+ * @example findVersionEndIndex('1.x <2', 0, digitRuns) // 3, at the space
1107
+ */
1108
+ const findVersionEndIndex = (range, start, digitRuns) => {
1109
+ const fullVersionEnd = findLooseFullVersionEndIndex(range, start, digitRuns);
1110
+ return fullVersionEnd !== start ? fullVersionEnd : findPartialVersionEndIndex(range, start, digitRuns);
1111
+ };
1112
+ /**
1113
+ * Finds the one whitespace character the old replacement would remove.
1114
+ * Keeps leading whitespace, skips an optional operator, and checks immediately
1115
+ * after it. Returns -1 if there is nothing to remove.
1116
+ *
1117
+ * @param {string} range The text containing a candidate already found by the caller.
1118
+ * @param {number} matchStart The candidate's position, including leading whitespace.
1119
+ * @returns {number} The position of the removable whitespace, or -1 if absent.
1120
+ * @example findRemovableWhitespaceIndex(' > 1', 0) // 2; keep the space at position 0
1121
+ * @example findRemovableWhitespaceIndex('>1', 0) // -1
1122
+ */
1123
+ const findRemovableWhitespaceIndex = (range, matchStart) => {
1124
+ let position = matchStart;
1125
+ if (isWhitespace(range[position])) position++;
1126
+ if (range[position] === "<" || range[position] === ">") position++;
1127
+ if (range[position] === "=") position++;
1128
+ return isWhitespace(range[position]) ? position : -1;
1129
+ };
1130
+ /**
1131
+ * Joins an operator to its version, turning > 1.2.3 into >1.2.3.
1132
+ * Copies everything else according to the old regex's matching rules.
1133
+ * Moves forward through prefixes and whole versions to avoid repeatedly
1134
+ * searching the same characters on long inputs.
1135
+ *
1136
+ * @param {string} range The range text to process; the original string is unchanged.
1137
+ * @returns {string} The range with matched operator whitespace removed.
1138
+ * @example trimComparatorWhitespace('> 1.2.3 < 2') // '>1.2.3 <2'
1139
+ * @example trimComparatorWhitespace('> invalid') // '> invalid'
1140
+ */
1141
+ const trimComparatorWhitespace = (range) => {
1142
+ let result = "";
1143
+ let copyFrom = 0;
1144
+ let cursor = 0;
1145
+ const digitRuns = {
1146
+ start: -1,
1147
+ end: -1,
1148
+ previousStart: -1,
1149
+ previousEnd: -1
1150
+ };
1151
+ while (cursor < range.length) {
1152
+ const matchStart = cursor;
1153
+ if (range[cursor] === "<" || range[cursor] === ">") cursor++;
1154
+ else if (!isVersionPrefix(range[cursor]) && !isVersionStart(range[cursor])) {
1155
+ cursor++;
1156
+ continue;
1157
+ }
1158
+ while (cursor < range.length && isVersionPrefix(range[cursor])) cursor++;
1159
+ if (!isVersionStart(range[cursor])) continue;
1160
+ const whitespacePosition = findRemovableWhitespaceIndex(range, matchStart);
1161
+ if (whitespacePosition !== -1) {
1162
+ result += range.slice(copyFrom, whitespacePosition);
1163
+ copyFrom = whitespacePosition + 1;
1164
+ }
1165
+ cursor = findVersionEndIndex(range, cursor, digitRuns);
1166
+ }
1167
+ return result + range.slice(copyFrom);
1168
+ };
1169
+ module.exports = trimComparatorWhitespace;
1170
+ }));
1171
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/classes/range.js
1172
+ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1173
+ const SPACE_CHARACTERS = /\s+/g;
1174
+ module.exports = class Range {
1175
+ constructor(range, options) {
1176
+ options = parseOptions(options);
1177
+ if (range instanceof Range) {
1178
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
1179
+ else return new Range(range.raw, options);
1180
+ }
1181
+ if (range instanceof Comparator) {
1182
+ this.raw = range.value;
1183
+ this.set = [[range]];
1184
+ this.formatted = void 0;
1185
+ return this;
1186
+ }
1187
+ this.options = options;
1188
+ this.loose = !!options.loose;
1189
+ this.includePrerelease = !!options.includePrerelease;
1190
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
1191
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
1192
+ if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
1193
+ if (this.set.length > 1) {
1194
+ const first = this.set[0];
1195
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
1196
+ if (this.set.length === 0) this.set = [first];
1197
+ else if (this.set.length > 1) {
1198
+ for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
1199
+ this.set = [c];
1200
+ break;
1201
+ }
1202
+ }
1203
+ }
1204
+ this.formatted = void 0;
1205
+ }
1206
+ get range() {
1207
+ if (this.formatted === void 0) {
1208
+ this.formatted = "";
1209
+ for (let i = 0; i < this.set.length; i++) {
1210
+ if (i > 0) this.formatted += "||";
1211
+ const comps = this.set[i];
1212
+ for (let k = 0; k < comps.length; k++) {
1213
+ if (k > 0) this.formatted += " ";
1214
+ this.formatted += comps[k].toString().trim();
1215
+ }
1216
+ }
1217
+ }
1218
+ return this.formatted;
1219
+ }
1220
+ format() {
1221
+ return this.range;
1222
+ }
1223
+ toString() {
1224
+ return this.range;
1225
+ }
1226
+ parseRange(range) {
1227
+ range = range.replace(BUILDSTRIPRE, "");
1228
+ const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
1229
+ const cached = cache.get(memoKey);
1230
+ if (cached) return cached;
1231
+ const loose = this.options.loose;
1232
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
1233
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
1234
+ debug("hyphen replace", range);
1235
+ range = trimComparatorWhitespace(range);
1236
+ debug("comparator trim", range);
1237
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
1238
+ debug("tilde trim", range);
1239
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
1240
+ debug("caret trim", range);
1241
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
1242
+ if (loose) rangeList = rangeList.filter((comp) => {
1243
+ debug("loose invalid filter", comp, this.options);
1244
+ return !!comp.match(re[t.COMPARATORLOOSE]);
1245
+ });
1246
+ debug("range list", rangeList);
1247
+ const rangeMap = /* @__PURE__ */ new Map();
1248
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
1249
+ for (const comp of comparators) {
1250
+ if (isNullSet(comp)) return [comp];
1251
+ rangeMap.set(comp.value, comp);
1252
+ }
1253
+ if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
1254
+ const result = [...rangeMap.values()];
1255
+ cache.set(memoKey, result);
1256
+ return result;
1257
+ }
1258
+ intersects(range, options) {
1259
+ if (!(range instanceof Range)) throw new TypeError("a Range is required");
1260
+ return this.set.some((thisComparators) => {
1261
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
1262
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
1263
+ return rangeComparators.every((rangeComparator) => {
1264
+ return thisComparator.intersects(rangeComparator, options);
1265
+ });
1266
+ });
1267
+ });
1268
+ });
1269
+ }
1270
+ test(version) {
1271
+ if (!version) return false;
1272
+ if (typeof version === "string") try {
1273
+ version = new SemVer(version, this.options);
1274
+ } catch (er) {
1275
+ return false;
1276
+ }
1277
+ for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
1278
+ return false;
1279
+ }
1280
+ };
1281
+ const cache = new (require_lrucache())();
1282
+ const parseOptions = require_parse_options();
1283
+ const Comparator = require_comparator();
1284
+ const debug = require_debug();
1285
+ const SemVer = require_semver$1();
1286
+ const trimComparatorWhitespace = require_trim_comparator_whitespace();
1287
+ const { safeRe: re, src, t, tildeTrimReplace, caretTrimReplace } = require_re();
1288
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
1289
+ const BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
1290
+ const isNullSet = (c) => c.value === "<0.0.0-0";
1291
+ const isAny = (c) => c.value === "";
1292
+ const isSatisfiable = (comparators, options) => {
1293
+ let result = true;
1294
+ const remainingComparators = comparators.slice();
1295
+ let testComparator = remainingComparators.pop();
1296
+ while (result && remainingComparators.length) {
1297
+ result = remainingComparators.every((otherComparator) => {
1298
+ return testComparator.intersects(otherComparator, options);
1299
+ });
1300
+ testComparator = remainingComparators.pop();
1301
+ }
1302
+ return result;
1303
+ };
1304
+ const parseComparator = (comp, options) => {
1305
+ comp = comp.replace(re[t.BUILD], "");
1306
+ debug("comp", comp, options);
1307
+ comp = replaceCarets(comp, options);
1308
+ debug("caret", comp);
1309
+ comp = replaceTildes(comp, options);
1310
+ debug("tildes", comp);
1311
+ comp = replaceXRanges(comp, options);
1312
+ debug("xrange", comp);
1313
+ comp = replaceStars(comp, options);
1314
+ debug("stars", comp);
1315
+ return comp;
1316
+ };
1317
+ const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
1318
+ const invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
1319
+ const replaceTildes = (comp, options) => {
1320
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
1321
+ };
1322
+ const replaceTilde = (comp, options) => {
1323
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1324
+ const z = options.includePrerelease ? "-0" : "";
1325
+ return comp.replace(r, (_, M, m, p, pr) => {
1326
+ debug("tilde", comp, _, M, m, p, pr);
1327
+ let ret;
1328
+ if (isX(M)) ret = "";
1329
+ else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1330
+ else if (isX(p)) ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1331
+ else if (pr) {
1332
+ debug("replaceTilde pr", pr);
1333
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1334
+ } else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
1335
+ debug("tilde return", ret);
1336
+ return ret;
1337
+ });
1338
+ };
1339
+ const replaceCarets = (comp, options) => {
1340
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
1341
+ };
1342
+ const replaceCaret = (comp, options) => {
1343
+ debug("caret", comp, options);
1344
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1345
+ const z = options.includePrerelease ? "-0" : "";
1346
+ return comp.replace(r, (_, M, m, p, pr) => {
1347
+ debug("caret", comp, _, M, m, p, pr);
1348
+ let ret;
1349
+ if (isX(M)) ret = "";
1350
+ else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1351
+ else if (isX(p)) {
1352
+ if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1353
+ else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
1354
+ } else if (pr) {
1355
+ debug("replaceCaret pr", pr);
1356
+ if (M === "0") {
1357
+ if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
1358
+ else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1359
+ } else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
1360
+ } else {
1361
+ debug("no pr");
1362
+ if (M === "0") {
1363
+ if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
1364
+ else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
1365
+ } else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
1366
+ }
1367
+ debug("caret return", ret);
1368
+ return ret;
1369
+ });
1370
+ };
1371
+ const replaceXRanges = (comp, options) => {
1372
+ debug("replaceXRanges", comp, options);
1373
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
1374
+ };
1375
+ const replaceXRange = (comp, options) => {
1376
+ comp = comp.trim();
1377
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1378
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1379
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
1380
+ if (invalidXRangeOrder(M, m, p)) return comp;
1381
+ const xM = isX(M);
1382
+ const xm = xM || isX(m);
1383
+ const xp = xm || isX(p);
1384
+ const anyX = xp;
1385
+ if (gtlt === "=" && anyX) gtlt = "";
1386
+ pr = options.includePrerelease ? "-0" : "";
1387
+ if (xM) {
1388
+ if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
1389
+ else ret = "*";
1390
+ } else if (gtlt && anyX) {
1391
+ if (xm) m = 0;
1392
+ p = 0;
1393
+ if (gtlt === ">") {
1394
+ gtlt = ">=";
1395
+ if (xm) {
1396
+ M = +M + 1;
1397
+ m = 0;
1398
+ p = 0;
1399
+ } else {
1400
+ m = +m + 1;
1401
+ p = 0;
1402
+ }
1403
+ } else if (gtlt === "<=") {
1404
+ gtlt = "<";
1405
+ if (xm) M = +M + 1;
1406
+ else m = +m + 1;
1407
+ }
1408
+ if (gtlt === "<") pr = "-0";
1409
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
1410
+ } else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
1411
+ else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
1412
+ debug("xRange return", ret);
1413
+ return ret;
1414
+ });
1415
+ };
1416
+ const replaceStars = (comp, options) => {
1417
+ debug("replaceStars", comp, options);
1418
+ return comp.trim().replace(re[t.STAR], "");
1419
+ };
1420
+ const replaceGTE0 = (comp, options) => {
1421
+ debug("replaceGTE0", comp, options);
1422
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
1423
+ };
1424
+ const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
1425
+ if (isX(fM)) from = "";
1426
+ else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
1427
+ else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
1428
+ else if (fpr) from = `>=${from}`;
1429
+ else from = `>=${from}${incPr ? "-0" : ""}`;
1430
+ if (isX(tM)) to = "";
1431
+ else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
1432
+ else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
1433
+ else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
1434
+ else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
1435
+ else to = `<=${to}`;
1436
+ return `${from} ${to}`.trim();
1437
+ };
1438
+ const testSet = (set, version, options) => {
1439
+ for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
1440
+ if (version.prerelease.length && !options.includePrerelease) {
1441
+ for (let i = 0; i < set.length; i++) {
1442
+ debug(set[i].semver);
1443
+ if (set[i].semver === Comparator.ANY) continue;
1444
+ if (set[i].semver.prerelease.length > 0) {
1445
+ const allowed = set[i].semver;
1446
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
1447
+ }
1448
+ }
1449
+ return false;
1450
+ }
1451
+ return true;
1452
+ };
1453
+ }));
1454
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/classes/comparator.js
1455
+ var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1456
+ const ANY = Symbol("SemVer ANY");
1457
+ module.exports = class Comparator {
1458
+ static get ANY() {
1459
+ return ANY;
1460
+ }
1461
+ constructor(comp, options) {
1462
+ options = parseOptions(options);
1463
+ if (comp instanceof Comparator) {
1464
+ if (comp.loose === !!options.loose) return comp;
1465
+ else comp = comp.value;
1466
+ }
1467
+ comp = comp.trim().split(/\s+/).join(" ");
1468
+ debug("comparator", comp, options);
1469
+ this.options = options;
1470
+ this.loose = !!options.loose;
1471
+ this.parse(comp);
1472
+ if (this.semver === ANY) this.value = "";
1473
+ else this.value = this.operator + this.semver.version;
1474
+ debug("comp", this);
1475
+ }
1476
+ parse(comp) {
1477
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
1478
+ const m = comp.match(r);
1479
+ if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
1480
+ this.operator = m[1] !== void 0 ? m[1] : "";
1481
+ if (this.operator === "=") this.operator = "";
1482
+ if (!m[2]) this.semver = ANY;
1483
+ else this.semver = new SemVer(m[2], this.options.loose);
1484
+ }
1485
+ toString() {
1486
+ return this.value;
1487
+ }
1488
+ test(version) {
1489
+ debug("Comparator.test", version, this.options.loose);
1490
+ if (this.semver === ANY || version === ANY) return true;
1491
+ if (typeof version === "string") try {
1492
+ version = new SemVer(version, this.options);
1493
+ } catch (er) {
1494
+ return false;
1495
+ }
1496
+ return cmp(version, this.operator, this.semver, this.options);
1497
+ }
1498
+ intersects(comp, options) {
1499
+ if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
1500
+ if (this.operator === "") {
1501
+ if (this.value === "") return true;
1502
+ return new Range(comp.value, options).test(this.value);
1503
+ } else if (comp.operator === "") {
1504
+ if (comp.value === "") return true;
1505
+ return new Range(this.value, options).test(comp.semver);
1506
+ }
1507
+ options = parseOptions(options);
1508
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
1509
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
1510
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
1511
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
1512
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
1513
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
1514
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
1515
+ return false;
1516
+ }
1517
+ };
1518
+ const parseOptions = require_parse_options();
1519
+ const { safeRe: re, t } = require_re();
1520
+ const cmp = require_cmp();
1521
+ const debug = require_debug();
1522
+ const SemVer = require_semver$1();
1523
+ const Range = require_range();
1524
+ }));
1525
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/satisfies.js
1526
+ var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1527
+ const Range = require_range();
1528
+ const satisfies = (version, range, options) => {
1529
+ try {
1530
+ range = new Range(range, options);
1531
+ } catch (er) {
1532
+ return false;
1533
+ }
1534
+ return range.test(version);
1535
+ };
1536
+ module.exports = satisfies;
1537
+ }));
1538
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/to-comparators.js
1539
+ var require_to_comparators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1540
+ const Range = require_range();
1541
+ const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
1542
+ module.exports = toComparators;
1543
+ }));
1544
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/max-satisfying.js
1545
+ var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1546
+ const SemVer = require_semver$1();
1547
+ const Range = require_range();
1548
+ const maxSatisfying = (versions, range, options) => {
1549
+ let max = null;
1550
+ let maxSV = null;
1551
+ let rangeObj = null;
1552
+ try {
1553
+ rangeObj = new Range(range, options);
1554
+ } catch (er) {
1555
+ return null;
1556
+ }
1557
+ versions.forEach((v) => {
1558
+ if (rangeObj.test(v)) {
1559
+ if (!max || maxSV.compare(v) === -1) {
1560
+ max = v;
1561
+ maxSV = new SemVer(max, options);
1562
+ }
1563
+ }
1564
+ });
1565
+ return max;
1566
+ };
1567
+ module.exports = maxSatisfying;
1568
+ }));
1569
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/min-satisfying.js
1570
+ var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1571
+ const SemVer = require_semver$1();
1572
+ const Range = require_range();
1573
+ const minSatisfying = (versions, range, options) => {
1574
+ let min = null;
1575
+ let minSV = null;
1576
+ let rangeObj = null;
1577
+ try {
1578
+ rangeObj = new Range(range, options);
1579
+ } catch (er) {
1580
+ return null;
1581
+ }
1582
+ versions.forEach((v) => {
1583
+ if (rangeObj.test(v)) {
1584
+ if (!min || minSV.compare(v) === 1) {
1585
+ min = v;
1586
+ minSV = new SemVer(min, options);
1587
+ }
1588
+ }
1589
+ });
1590
+ return min;
1591
+ };
1592
+ module.exports = minSatisfying;
1593
+ }));
1594
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/min-version.js
1595
+ var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1596
+ const SemVer = require_semver$1();
1597
+ const Range = require_range();
1598
+ const gt = require_gt();
1599
+ const minVersion = (range, loose) => {
1600
+ range = new Range(range, loose);
1601
+ let minver = new SemVer("0.0.0");
1602
+ if (range.test(minver)) return minver;
1603
+ minver = new SemVer("0.0.0-0");
1604
+ if (range.test(minver)) return minver;
1605
+ minver = null;
1606
+ for (let i = 0; i < range.set.length; ++i) {
1607
+ const comparators = range.set[i];
1608
+ let setMin = null;
1609
+ comparators.forEach((comparator) => {
1610
+ const compver = new SemVer(comparator.semver.version);
1611
+ switch (comparator.operator) {
1612
+ case ">":
1613
+ if (compver.prerelease.length === 0) compver.patch++;
1614
+ else compver.prerelease.push(0);
1615
+ compver.raw = compver.format();
1616
+ case "":
1617
+ case ">=":
1618
+ if (!setMin || gt(compver, setMin)) setMin = compver;
1619
+ break;
1620
+ case "<":
1621
+ case "<=": break;
1622
+ /* istanbul ignore next */
1623
+ default: throw new Error(`Unexpected operation: ${comparator.operator}`);
1624
+ }
1625
+ });
1626
+ if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
1627
+ }
1628
+ if (minver && range.test(minver)) return minver;
1629
+ return null;
1630
+ };
1631
+ module.exports = minVersion;
1632
+ }));
1633
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/valid.js
1634
+ var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1635
+ const Range = require_range();
1636
+ const validRange = (range, options) => {
1637
+ try {
1638
+ return new Range(range, options).range || "*";
1639
+ } catch (er) {
1640
+ return null;
1641
+ }
1642
+ };
1643
+ module.exports = validRange;
1644
+ }));
1645
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/outside.js
1646
+ var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1647
+ const SemVer = require_semver$1();
1648
+ const Comparator = require_comparator();
1649
+ const { ANY } = Comparator;
1650
+ const Range = require_range();
1651
+ const satisfies = require_satisfies();
1652
+ const gt = require_gt();
1653
+ const lt = require_lt();
1654
+ const lte = require_lte();
1655
+ const gte = require_gte();
1656
+ const outside = (version, range, hilo, options) => {
1657
+ version = new SemVer(version, options);
1658
+ range = new Range(range, options);
1659
+ let gtfn, ltefn, ltfn, comp, ecomp;
1660
+ switch (hilo) {
1661
+ case ">":
1662
+ gtfn = gt;
1663
+ ltefn = lte;
1664
+ ltfn = lt;
1665
+ comp = ">";
1666
+ ecomp = ">=";
1667
+ break;
1668
+ case "<":
1669
+ gtfn = lt;
1670
+ ltefn = gte;
1671
+ ltfn = gt;
1672
+ comp = "<";
1673
+ ecomp = "<=";
1674
+ break;
1675
+ default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
1676
+ }
1677
+ if (satisfies(version, range, options)) return false;
1678
+ for (let i = 0; i < range.set.length; ++i) {
1679
+ const comparators = range.set[i];
1680
+ let high = null;
1681
+ let low = null;
1682
+ comparators.forEach((comparator) => {
1683
+ if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
1684
+ high = high || comparator;
1685
+ low = low || comparator;
1686
+ if (gtfn(comparator.semver, high.semver, options)) high = comparator;
1687
+ else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
1688
+ });
1689
+ if (high.operator === comp || high.operator === ecomp) return false;
1690
+ if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
1691
+ else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
1692
+ }
1693
+ return true;
1694
+ };
1695
+ module.exports = outside;
1696
+ }));
1697
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/gtr.js
1698
+ var require_gtr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1699
+ const outside = require_outside();
1700
+ const gtr = (version, range, options) => outside(version, range, ">", options);
1701
+ module.exports = gtr;
1702
+ }));
1703
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/ltr.js
1704
+ var require_ltr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1705
+ const outside = require_outside();
1706
+ const ltr = (version, range, options) => outside(version, range, "<", options);
1707
+ module.exports = ltr;
1708
+ }));
1709
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/intersects.js
1710
+ var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1711
+ const Range = require_range();
1712
+ const intersects = (r1, r2, options) => {
1713
+ r1 = new Range(r1, options);
1714
+ r2 = new Range(r2, options);
1715
+ return r1.intersects(r2, options);
1716
+ };
1717
+ module.exports = intersects;
1718
+ }));
1719
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/simplify.js
1720
+ var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1721
+ const satisfies = require_satisfies();
1722
+ const compare = require_compare();
1723
+ module.exports = (versions, range, options) => {
1724
+ const set = [];
1725
+ let first = null;
1726
+ let prev = null;
1727
+ const v = versions.sort((a, b) => compare(a, b, options));
1728
+ for (const version of v) if (satisfies(version, range, options)) {
1729
+ prev = version;
1730
+ if (!first) first = version;
1731
+ } else {
1732
+ if (prev) set.push([first, prev]);
1733
+ prev = null;
1734
+ first = null;
1735
+ }
1736
+ if (first) set.push([first, null]);
1737
+ const ranges = [];
1738
+ for (const [min, max] of set) if (min === max) ranges.push(min);
1739
+ else if (!max && min === v[0]) ranges.push("*");
1740
+ else if (!max) ranges.push(`>=${min}`);
1741
+ else if (min === v[0]) ranges.push(`<=${max}`);
1742
+ else ranges.push(`${min} - ${max}`);
1743
+ const simplified = ranges.join(" || ");
1744
+ const original = typeof range.raw === "string" ? range.raw : String(range);
1745
+ return simplified.length < original.length ? simplified : range;
1746
+ };
1747
+ }));
1748
+ // ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/subset.js
1749
+ var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1750
+ const Range = require_range();
1751
+ const Comparator = require_comparator();
1752
+ const { ANY } = Comparator;
1753
+ const satisfies = require_satisfies();
1754
+ const compare = require_compare();
1755
+ const subset = (sub, dom, options = {}) => {
1756
+ if (sub === dom) return true;
1757
+ sub = new Range(sub, options);
1758
+ dom = new Range(dom, options);
1759
+ let sawNonNull = false;
1760
+ OUTER: for (const simpleSub of sub.set) {
1761
+ for (const simpleDom of dom.set) {
1762
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
1763
+ sawNonNull = sawNonNull || isSub !== null;
1764
+ if (isSub) continue OUTER;
1765
+ }
1766
+ if (sawNonNull) return false;
1767
+ }
1768
+ return true;
1769
+ };
1770
+ const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
1771
+ const minimumVersion = [new Comparator(">=0.0.0")];
1772
+ const simpleSubset = (sub, dom, options) => {
1773
+ if (sub === dom) return true;
1774
+ if (sub.length === 1 && sub[0].semver === ANY) {
1775
+ if (dom.length === 1 && dom[0].semver === ANY) return true;
1776
+ else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
1777
+ else sub = minimumVersion;
1778
+ }
1779
+ if (dom.length === 1 && dom[0].semver === ANY) {
1780
+ if (options.includePrerelease) return true;
1781
+ else dom = minimumVersion;
1782
+ }
1783
+ const eqSet = /* @__PURE__ */ new Set();
1784
+ let gt, lt;
1785
+ for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
1786
+ else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
1787
+ else eqSet.add(c.semver);
1788
+ if (eqSet.size > 1) return null;
1789
+ let gtltComp;
1790
+ if (gt && lt) {
1791
+ gtltComp = compare(gt.semver, lt.semver, options);
1792
+ if (gtltComp > 0) return null;
1793
+ else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
1794
+ }
1795
+ for (const eq of eqSet) {
1796
+ if (gt && !satisfies(eq, String(gt), options)) return null;
1797
+ if (lt && !satisfies(eq, String(lt), options)) return null;
1798
+ for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
1799
+ return true;
1800
+ }
1801
+ let higher, lower;
1802
+ let hasDomLT, hasDomGT;
1803
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
1804
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
1805
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
1806
+ for (const c of dom) {
1807
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
1808
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
1809
+ if (gt) {
1810
+ if (needDomGTPre) {
1811
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) needDomGTPre = false;
1812
+ }
1813
+ if (c.operator === ">" || c.operator === ">=") {
1814
+ higher = higherGT(gt, c, options);
1815
+ if (higher === c && higher !== gt) return false;
1816
+ } else if (gt.operator === ">=" && !c.test(gt.semver)) return false;
1817
+ }
1818
+ if (lt) {
1819
+ if (needDomLTPre) {
1820
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) needDomLTPre = false;
1821
+ }
1822
+ if (c.operator === "<" || c.operator === "<=") {
1823
+ lower = lowerLT(lt, c, options);
1824
+ if (lower === c && lower !== lt) return false;
1825
+ } else if (lt.operator === "<=" && !c.test(lt.semver)) return false;
1826
+ }
1827
+ if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
1828
+ }
1829
+ if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
1830
+ if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
1831
+ if (needDomGTPre || needDomLTPre) return false;
1832
+ return true;
1833
+ };
1834
+ const higherGT = (a, b, options) => {
1835
+ if (!a) return b;
1836
+ const comp = compare(a.semver, b.semver, options);
1837
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
1838
+ };
1839
+ const lowerLT = (a, b, options) => {
1840
+ if (!a) return b;
1841
+ const comp = compare(a.semver, b.semver, options);
1842
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
1843
+ };
1844
+ module.exports = subset;
1845
+ }));
1846
+ (/* @__PURE__ */ __commonJSMin(((exports, module) => {
1847
+ const internalRe = require_re();
1848
+ const constants = require_constants();
1849
+ const SemVer = require_semver$1();
1850
+ const identifiers = require_identifiers();
1851
+ module.exports = {
1852
+ parse: require_parse(),
1853
+ valid: require_valid$1(),
1854
+ clean: require_clean(),
1855
+ inc: require_inc(),
1856
+ diff: require_diff(),
1857
+ major: require_major(),
1858
+ minor: require_minor(),
1859
+ patch: require_patch(),
1860
+ prerelease: require_prerelease(),
1861
+ compare: require_compare(),
1862
+ rcompare: require_rcompare(),
1863
+ compareLoose: require_compare_loose(),
1864
+ compareBuild: require_compare_build(),
1865
+ sort: require_sort(),
1866
+ rsort: require_rsort(),
1867
+ gt: require_gt(),
1868
+ lt: require_lt(),
1869
+ eq: require_eq(),
1870
+ neq: require_neq(),
1871
+ gte: require_gte(),
1872
+ lte: require_lte(),
1873
+ cmp: require_cmp(),
1874
+ coerce: require_coerce(),
1875
+ truncate: require_truncate(),
1876
+ Comparator: require_comparator(),
1877
+ Range: require_range(),
1878
+ satisfies: require_satisfies(),
1879
+ toComparators: require_to_comparators(),
1880
+ maxSatisfying: require_max_satisfying(),
1881
+ minSatisfying: require_min_satisfying(),
1882
+ minVersion: require_min_version(),
1883
+ validRange: require_valid(),
1884
+ outside: require_outside(),
1885
+ gtr: require_gtr(),
1886
+ ltr: require_ltr(),
1887
+ intersects: require_intersects(),
1888
+ simplifyRange: require_simplify(),
1889
+ subset: require_subset(),
1890
+ SemVer,
1891
+ re: internalRe.re,
1892
+ src: internalRe.src,
1893
+ tokens: internalRe.t,
1894
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
1895
+ RELEASE_TYPES: constants.RELEASE_TYPES,
1896
+ compareIdentifiers: identifiers.compareIdentifiers,
1897
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
1898
+ };
1899
+ })))();
1900
+ const AI_PLATFORMS = ["chatgpt", "claudeai"];
1901
+ const platformSchema = z.enum(AI_PLATFORMS);
5
1902
  const PLATFORM_LABELS = {
6
1903
  chatgpt: "ChatGPT",
7
1904
  claudeai: "Claude.ai"
8
1905
  };
1906
+ const WAF_PLATFORMS = [
1907
+ "akamai",
1908
+ "cato",
1909
+ "cloudflare",
1910
+ "fastly"
1911
+ ];
1912
+ const ALLOWED_PLATFORMS = [...[
1913
+ ...AI_PLATFORMS,
1914
+ "meta",
1915
+ "google"
1916
+ ], ...WAF_PLATFORMS];
1917
+ const allowedPlatformSchema = z.enum(ALLOWED_PLATFORMS);
9
1918
  const auditStatusSchema = z.enum([
10
1919
  "pending",
11
1920
  "partial",
@@ -71,6 +1980,32 @@ const auditReportWithScreenshotsSchema = auditReportSchema.extend({ widgetScreen
71
1980
  chatgpt: widgetScreenshotSchema.optional(),
72
1981
  claudeai: widgetScreenshotSchema.optional()
73
1982
  }) });
1983
+ z.object({
1984
+ id: z.string(),
1985
+ environmentId: z.string(),
1986
+ clientId: z.string(),
1987
+ clientSecret: z.string(),
1988
+ clientScopes: z.array(z.string())
1989
+ });
1990
+ const creditEntryReasonSchema = z.enum([
1991
+ "free_seed",
1992
+ "paid_conversion_floor",
1993
+ "top_up",
1994
+ "usage",
1995
+ "admin_adjustment"
1996
+ ]);
1997
+ z.enum(["playground"]);
1998
+ z.number().int().min(500);
1999
+ const creditActivityEntrySchema = z.object({
2000
+ reason: creditEntryReasonSchema,
2001
+ day: z.number(),
2002
+ amountInNanoUSD: z.number(),
2003
+ messageCount: z.number().nullable()
2004
+ });
2005
+ z.object({
2006
+ balanceInNanoUSD: z.number(),
2007
+ recentActivity: z.array(creditActivityEntrySchema)
2008
+ });
74
2009
  const deploymentStatusSchema$1 = z.enum([
75
2010
  "ongoing",
76
2011
  "deployed",
@@ -98,9 +2033,95 @@ const deploymentSummarySchema = z.object({
98
2033
  createdAt: z.coerce.date(),
99
2034
  updatedAt: z.coerce.date()
100
2035
  });
101
- const allowedPlatformSchema = platformSchema;
2036
+ /** Public environment: answers anonymously and exposes no OAuth metadata. */
2037
+ const publicEnvironmentSchema = z.object({
2038
+ allowsAnonymous: z.literal(true),
2039
+ oAuthMetadata: z.strictObject({})
2040
+ });
2041
+ /** Protected environment whose external resource metadata URL is returned in the WWW-Authenticate header on the first 401; everything after is handled outside the MCP server scope. */
2042
+ const externalResourceMetadataEnvironmentSchema = z.object({
2043
+ allowsAnonymous: z.boolean(),
2044
+ oAuthMetadata: z.object({ externalResourceMetadataUrl: z.url() }),
2045
+ scope: z.string().optional()
2046
+ });
2047
+ /** Protected environment whose own /.well-known/oauth-protected-resource endpoint points at an external authorization server; everything after is handled outside the MCP server scope. */
2048
+ const externalAuthorizationServerEnvironmentSchema = z.object({
2049
+ allowsAnonymous: z.boolean(),
2050
+ oAuthMetadata: z.object({
2051
+ externalAuthorizationServerUrl: z.url(),
2052
+ resourceMetadata: OAuthProtectedResourceMetadataSchema.optional()
2053
+ }),
2054
+ scope: z.string().optional()
2055
+ });
2056
+ /** Standalone protected environment: the server itself exposes both the /.well-known/oauth-protected-resource and /.well-known/oauth-authorization-server endpoints. */
2057
+ const standaloneEnvironmentSchema = z.object({
2058
+ allowsAnonymous: z.boolean(),
2059
+ oAuthMetadata: z.object({
2060
+ authorizationServerMetadata: z.union([OAuthMetadataSchema, OpenIdProviderDiscoveryMetadataSchema]),
2061
+ resourceMetadata: OAuthProtectedResourceMetadataSchema.optional()
2062
+ }),
2063
+ scope: z.string().optional()
2064
+ });
2065
+ /** Protected environment that enforces authentication but advertises no OAuth discovery metadata; clients must obtain credentials out-of-band. */
2066
+ const protectedWithoutDiscoveryEnvironmentSchema = z.object({
2067
+ allowsAnonymous: z.literal(false),
2068
+ oAuthMetadata: z.strictObject({}),
2069
+ scope: z.string().optional(),
2070
+ wwwAuthenticate: z.string().optional()
2071
+ });
2072
+ const legacyPublicEnvironmentSchema = z.object({
2073
+ isPublic: z.literal(true),
2074
+ oAuthMetadata: z.undefined().optional()
2075
+ });
2076
+ const legacyExternalResourceMetadataEnvironmentSchema = z.object({
2077
+ isPublic: z.literal(false),
2078
+ oAuthMetadata: z.object({ externalResourceMetadataUrl: z.url() }),
2079
+ scope: z.string().optional()
2080
+ });
2081
+ const legacyExternalAuthorizationServerEnvironmentSchema = z.object({
2082
+ isPublic: z.literal(false),
2083
+ oAuthMetadata: z.object({
2084
+ externalAuthorizationServerUrl: z.url(),
2085
+ resourceMetadata: OAuthProtectedResourceMetadataSchema.optional()
2086
+ }),
2087
+ scope: z.string().optional()
2088
+ });
2089
+ const legacyStandaloneEnvironmentSchema = z.object({
2090
+ isPublic: z.literal(false),
2091
+ oAuthMetadata: z.object({
2092
+ authorizationServerMetadata: z.union([OAuthMetadataSchema, OpenIdProviderDiscoveryMetadataSchema]),
2093
+ resourceMetadata: OAuthProtectedResourceMetadataSchema.optional()
2094
+ }),
2095
+ scope: z.string().optional()
2096
+ });
2097
+ const legacyProtectedWithoutDiscoveryEnvironmentSchema = z.object({
2098
+ isPublic: z.literal(false),
2099
+ oAuthMetadata: z.strictObject({}),
2100
+ scope: z.string().optional()
2101
+ });
2102
+ z.union([
2103
+ publicEnvironmentSchema,
2104
+ externalResourceMetadataEnvironmentSchema,
2105
+ externalAuthorizationServerEnvironmentSchema,
2106
+ standaloneEnvironmentSchema,
2107
+ protectedWithoutDiscoveryEnvironmentSchema,
2108
+ legacyPublicEnvironmentSchema,
2109
+ legacyExternalResourceMetadataEnvironmentSchema,
2110
+ legacyExternalAuthorizationServerEnvironmentSchema,
2111
+ legacyStandaloneEnvironmentSchema,
2112
+ legacyProtectedWithoutDiscoveryEnvironmentSchema
2113
+ ]);
2114
+ const playgroundModelSchema = z.enum([
2115
+ "global.anthropic.claude-haiku-5-5",
2116
+ "global.anthropic.claude-haiku-4-5-20251001-v1:0",
2117
+ "global.anthropic.claude-sonnet-5-5",
2118
+ "openai.gpt-5.4",
2119
+ "openai.gpt-5.5",
2120
+ "openai.gpt-6-luna",
2121
+ "openai.gpt-6.1-sol"
2122
+ ]);
102
2123
  const environmentDomainSchema = z.object({
103
- domain: z.string(),
2124
+ name: z.string(),
104
2125
  status: z.enum([
105
2126
  "ongoing",
106
2127
  "deployed",
@@ -118,6 +2139,7 @@ const environmentSchema$1 = z.object({
118
2139
  latestDeployment: deploymentSummarySchema.optional(),
119
2140
  openaiAppsChallenge: z.string().nullable().optional(),
120
2141
  isPlaygroundEnabled: z.boolean(),
2142
+ playgroundModel: playgroundModelSchema,
121
2143
  isIpWhitelistEnabled: z.boolean(),
122
2144
  ipAllowlist: z.array(z.string()).nullable(),
123
2145
  allowedPlatforms: z.array(allowedPlatformSchema),
@@ -127,11 +2149,21 @@ const environmentSchema$1 = z.object({
127
2149
  });
128
2150
  const environmentWithDomainsSchema = environmentSchema$1.extend({ domains: z.array(environmentDomainSchema) });
129
2151
  z.object({
2152
+ sessionReplayEnabled: z.boolean(),
2153
+ collectRequestPayload: z.boolean(),
2154
+ collectResponsePayload: z.boolean(),
2155
+ collectErrorMessage: z.boolean(),
2156
+ collectUserData: z.boolean(),
2157
+ identityTraitKey: z.string().min(1).max(200).nullable(),
2158
+ leadEventName: z.string().min(1).max(200).nullable()
2159
+ });
2160
+ const feedbackSchema = z.object({
130
2161
  id: z.string(),
131
2162
  createdAt: z.coerce.date(),
132
2163
  environmentId: z.string(),
133
2164
  content: z.string(),
134
- source: z.enum(["model", "user"])
2165
+ source: z.enum(["model", "user"]),
2166
+ clientName: z.string().nullable()
135
2167
  });
136
2168
  z.object({
137
2169
  content: z.string(),
@@ -147,7 +2179,7 @@ const intentCategoryColorSchema = z.enum([
147
2179
  "pink",
148
2180
  "gray"
149
2181
  ]);
150
- intentCategoryColorSchema.options;
2182
+ const INTENT_CATEGORY_COLORS = intentCategoryColorSchema.options;
151
2183
  const intentCategorySchema = z.object({
152
2184
  id: z.string(),
153
2185
  createdAt: z.coerce.date(),
@@ -155,7 +2187,7 @@ const intentCategorySchema = z.object({
155
2187
  name: z.string(),
156
2188
  color: intentCategoryColorSchema
157
2189
  });
158
- z.object({
2190
+ const intentCategorySummarySchema = z.object({
159
2191
  id: z.string(),
160
2192
  name: z.string(),
161
2193
  color: intentCategoryColorSchema,
@@ -167,6 +2199,7 @@ z.object({
167
2199
  environmentId: z.string(),
168
2200
  toolName: z.string(),
169
2201
  message: z.string(),
2202
+ clientName: z.string().nullable(),
170
2203
  categories: z.array(intentCategorySchema)
171
2204
  });
172
2205
  const signalCategorySchema = z.object({
@@ -225,17 +2258,277 @@ z.object({
225
2258
  createdAt: z.coerce.date(),
226
2259
  updatedAt: z.coerce.date()
227
2260
  });
2261
+ const alpicMcpRequestLogSchema = z.object({
2262
+ type: z.literal("mcp_request"),
2263
+ method: z.string()
2264
+ });
2265
+ const alpicMcpErrorLogSchema = z.object({
2266
+ type: z.literal("mcp_error"),
2267
+ method: z.string(),
2268
+ error: z.string()
2269
+ });
2270
+ z.union([alpicMcpRequestLogSchema, alpicMcpErrorLogSchema]);
228
2271
  z.enum([
229
2272
  "INFO",
230
2273
  "WARNING",
231
2274
  "DEBUG",
232
2275
  "ERROR"
233
2276
  ]);
2277
+ const LOG_SEARCH_MAX_ESCAPED_LENGTH = 960;
2278
+ function escapeLogSearchTerm(search) {
2279
+ return [...search].flatMap((character) => [...new TextEncoder().encode(character)]).map((byte) => {
2280
+ const character = String.fromCharCode(byte);
2281
+ return /^[a-zA-Z0-9]$/.test(character) ? character : `\\x${byte.toString(16).toUpperCase().padStart(2, "0")}`;
2282
+ }).join("");
2283
+ }
2284
+ const logSearchSchema = z.string().max(240, `Search must be 240 characters or fewer`).refine((search) => escapeLogSearchTerm(search).length <= LOG_SEARCH_MAX_ESCAPED_LENGTH, "Search is too complex; shorten it or use fewer special characters");
2285
+ /** Only names a vendor actually ships belong here: lookalikes like `claude-code-test` are customers' own scripts. */
2286
+ const MCP_CLIENT_GROUPS = [
2287
+ {
2288
+ id: "claude_code",
2289
+ label: "Claude Code",
2290
+ vendor: "anthropic",
2291
+ rawNames: ["claude-code", "Anthropic/ClaudeCodeDesktop"]
2292
+ },
2293
+ {
2294
+ id: "claude",
2295
+ label: "Claude",
2296
+ vendor: "anthropic",
2297
+ rawNames: [
2298
+ "Anthropic/ClaudeAI",
2299
+ "claude-ai",
2300
+ "claude",
2301
+ "Claude",
2302
+ "claude-desktop",
2303
+ "claude-desktop-3p"
2304
+ ]
2305
+ },
2306
+ {
2307
+ id: "claude_mobile",
2308
+ label: "Claude mobile",
2309
+ vendor: "anthropic",
2310
+ rawNames: ["claude-ios", "ClaudeAndroid"]
2311
+ },
2312
+ {
2313
+ id: "claude_cowork",
2314
+ label: "Claude Cowork",
2315
+ vendor: "anthropic",
2316
+ rawNames: ["Anthropic/Cowork"]
2317
+ },
2318
+ {
2319
+ id: "claude_sheet_add_in",
2320
+ label: "Claude (Sheet Add-In)",
2321
+ vendor: "anthropic",
2322
+ rawNames: ["sheet-add-in"]
2323
+ },
2324
+ {
2325
+ id: "claude_toolbox",
2326
+ label: "Claude Toolbox",
2327
+ vendor: "anthropic",
2328
+ rawNames: ["Anthropic/Toolbox", "Anthropic/toolbox-bootstrap"]
2329
+ },
2330
+ {
2331
+ id: "anthropic_api",
2332
+ label: "Anthropic API",
2333
+ vendor: "anthropic",
2334
+ rawNames: ["Anthropic/API"]
2335
+ },
2336
+ {
2337
+ id: "anthropic_connector_refresh",
2338
+ label: "Anthropic (connector refresh)",
2339
+ vendor: "anthropic",
2340
+ rawNames: ["Anthropic"]
2341
+ },
2342
+ {
2343
+ id: "codex",
2344
+ label: "Codex",
2345
+ vendor: "openai",
2346
+ rawNames: [
2347
+ "codex-mcp-client",
2348
+ "codex",
2349
+ "Codex",
2350
+ "codex-cli",
2351
+ "openai-mcp (Codex)"
2352
+ ]
2353
+ },
2354
+ {
2355
+ id: "chatgpt",
2356
+ label: "ChatGPT",
2357
+ vendor: "openai",
2358
+ rawNames: ["openai-mcp", "openai-mcp (ChatGPT)"]
2359
+ },
2360
+ {
2361
+ id: "openai_responses_api",
2362
+ label: "OpenAI Responses API",
2363
+ vendor: "openai",
2364
+ rawNames: ["openai-mcp (Responses API)"]
2365
+ },
2366
+ {
2367
+ id: "openai_agent_builder",
2368
+ label: "OpenAI Agent Builder",
2369
+ vendor: "openai",
2370
+ rawNames: ["openai-mcp (Agent Builder)"]
2371
+ },
2372
+ {
2373
+ id: "cursor",
2374
+ label: "Cursor",
2375
+ vendor: "cursor",
2376
+ rawNames: [
2377
+ "cursor-vscode",
2378
+ "Cursor",
2379
+ "cursor"
2380
+ ]
2381
+ },
2382
+ {
2383
+ id: "cline",
2384
+ label: "Cline",
2385
+ vendor: "cline",
2386
+ rawNames: [
2387
+ "Cline",
2388
+ "cline",
2389
+ "@cline/core"
2390
+ ]
2391
+ },
2392
+ {
2393
+ id: "github_copilot",
2394
+ label: "GitHub Copilot",
2395
+ vendor: "githubCopilot",
2396
+ rawNames: [
2397
+ "Copilot",
2398
+ "github-copilot-developer",
2399
+ "Copilot MCP Gateway",
2400
+ "Xcode/copilot-xcode"
2401
+ ]
2402
+ },
2403
+ {
2404
+ id: "gemini_cli",
2405
+ label: "Gemini CLI",
2406
+ vendor: "google",
2407
+ rawNames: ["gemini-cli-mcp-client", "gemini-cli"]
2408
+ },
2409
+ {
2410
+ id: "antigravity",
2411
+ label: "Antigravity",
2412
+ vendor: "google",
2413
+ rawNames: ["antigravity-client"]
2414
+ },
2415
+ {
2416
+ id: "gemini",
2417
+ label: "Gemini",
2418
+ vendor: "google",
2419
+ rawNames: ["Gemini", "google-ai-edge-gallery"]
2420
+ },
2421
+ {
2422
+ id: "windsurf",
2423
+ label: "Windsurf",
2424
+ vendor: "windsurf",
2425
+ rawNames: ["Windsurf", "windsurf-client"]
2426
+ },
2427
+ {
2428
+ id: "mistral",
2429
+ label: "Mistral / Le Chat",
2430
+ vendor: "mistral",
2431
+ rawNames: ["Mistral"],
2432
+ rawNamePrefixes: ["connector:custom-mcp:"]
2433
+ },
2434
+ {
2435
+ id: "n8n",
2436
+ label: "n8n",
2437
+ vendor: "n8n",
2438
+ rawNames: [
2439
+ "@n8n/n8n-nodes-langchain.mcpClient",
2440
+ "@n8n/n8n-nodes-langchain.mcpClientTool",
2441
+ "n8n"
2442
+ ]
2443
+ },
2444
+ {
2445
+ id: "alpic_playground",
2446
+ label: "Alpic Playground",
2447
+ vendor: "alpic",
2448
+ rawNames: ["alpic-playground", "playground"]
2449
+ },
2450
+ {
2451
+ id: "opencode",
2452
+ label: "opencode",
2453
+ vendor: "opencode",
2454
+ rawNames: ["opencode"]
2455
+ },
2456
+ {
2457
+ id: "zed",
2458
+ label: "Zed",
2459
+ vendor: "zed",
2460
+ rawNames: ["Zed", "zed"]
2461
+ },
2462
+ {
2463
+ id: "zapier",
2464
+ label: "Zapier",
2465
+ vendor: "zapier",
2466
+ rawNames: ["Zapier", "zapier"]
2467
+ },
2468
+ {
2469
+ id: "make",
2470
+ label: "Make",
2471
+ vendor: "make",
2472
+ rawNames: ["Make", "make"]
2473
+ },
2474
+ {
2475
+ id: "librechat",
2476
+ label: "LibreChat",
2477
+ vendor: "mcp",
2478
+ rawNames: ["LibreChat", "librechat"]
2479
+ },
2480
+ {
2481
+ id: "jan",
2482
+ label: "Jan",
2483
+ vendor: "mcp",
2484
+ rawNames: ["Jan", "jan"]
2485
+ },
2486
+ {
2487
+ id: "goose",
2488
+ label: "goose",
2489
+ vendor: "mcp",
2490
+ rawNames: ["goose", "Goose"]
2491
+ },
2492
+ {
2493
+ id: "mcphost",
2494
+ label: "mcphost",
2495
+ vendor: "mcp",
2496
+ rawNames: ["mcphost"]
2497
+ },
2498
+ {
2499
+ id: "mcporter",
2500
+ label: "mcporter",
2501
+ vendor: "mcp",
2502
+ rawNames: ["mcporter"]
2503
+ },
2504
+ {
2505
+ id: "rmcp",
2506
+ label: "rmcp",
2507
+ vendor: "mcp",
2508
+ rawNames: ["rmcp"]
2509
+ },
2510
+ {
2511
+ id: "unnamed_client",
2512
+ label: "Unnamed client",
2513
+ vendor: "mcp",
2514
+ rawNames: [
2515
+ "mcp",
2516
+ "unknown",
2517
+ ""
2518
+ ]
2519
+ }
2520
+ ];
2521
+ /** A source pattern, not a RegExp, because analytics renders the same rule into ClickHouse RE2, which shares this syntax. */
2522
+ const MCP_REMOTE_WRAPPER_SUFFIX = String.raw` \(via mcp-remote [^\n]+?\)$`;
2523
+ new RegExp(MCP_REMOTE_WRAPPER_SUFFIX);
2524
+ new Map(MCP_CLIENT_GROUPS.map((group) => [group.id, group]));
234
2525
  const runtimeSchema = z.enum([
235
2526
  "python3.13",
236
2527
  "python3.14",
2528
+ "python3.15",
237
2529
  "node22",
238
- "node24"
2530
+ "node24",
2531
+ "node26"
239
2532
  ]);
240
2533
  const transportSchema = z.enum([
241
2534
  "stdio",
@@ -259,15 +2552,27 @@ z.object({
259
2552
  environments: z.array(environmentWithDomainsSchema),
260
2553
  productionEnvironment: environmentWithDomainsSchema.nullable()
261
2554
  });
2555
+ const domainFailureReasonSchema = z.enum([
2556
+ "caa",
2557
+ "dns",
2558
+ "invalid_domain",
2559
+ "other"
2560
+ ]);
2561
+ const projectDomainMappingSchema = z.object({
2562
+ pathPrefix: z.string(),
2563
+ environment: environmentSchema$1
2564
+ });
262
2565
  z.object({
263
- domain: z.string(),
2566
+ name: z.string(),
264
2567
  createdAt: z.coerce.date(),
265
2568
  status: z.enum([
266
2569
  "ongoing",
267
2570
  "deployed",
268
2571
  "failed"
269
2572
  ]),
270
- environment: environmentSchema$1
2573
+ failureReason: domainFailureReasonSchema.nullable(),
2574
+ environment: environmentSchema$1,
2575
+ mappings: z.array(projectDomainMappingSchema)
271
2576
  });
272
2577
  const serverFieldsSchema$1 = z.object({
273
2578
  $schema: z.string(),
@@ -296,6 +2601,18 @@ z.object({
296
2601
  serverFields: serverFieldsSchema$1,
297
2602
  source: z.enum(["registry", "defaults"])
298
2603
  });
2604
+ /** Clamps instead of rejecting on max-length overflow (for AI-generated copy that overshoots); intentionally carries over only maxLength, minLength, and description, dropping any other validators. */
2605
+ const clampStringField = (field) => {
2606
+ const max = field.maxLength;
2607
+ if (max === null) return field;
2608
+ const clamped = z.string().overwrite((value) => value.slice(0, max)).max(max);
2609
+ const withMin = field.minLength === null ? clamped : clamped.min(field.minLength);
2610
+ return field.description ? withMin.describe(field.description) : withMin;
2611
+ };
2612
+ const unboundedArrayField = (field) => {
2613
+ const unbounded = z.array(field.element);
2614
+ return field.description ? unbounded.describe(field.description) : unbounded;
2615
+ };
299
2616
  const toolDefinitionSchema = z.object({
300
2617
  name: z.string(),
301
2618
  title: z.string().optional().describe("Human-friendly name for the tool, used in the UI. If not provided, `name` will be used."),
@@ -308,17 +2625,31 @@ const toolDefinitionSchema = z.object({
308
2625
  }).optional()
309
2626
  });
310
2627
  const positiveTestCaseSchema = z.object({
311
- scenario: z.string(),
312
- userPrompt: z.string(),
313
- toolTriggered: z.string().optional(),
314
- expectedOutput: z.string().optional()
315
- }).partial().describe("Each case: Scenario, User prompt, Tool triggered, Expected output.");
2628
+ scenario: z.string().min(1).describe("Short label for what this case demonstrates."),
2629
+ userPrompt: z.string().min(1).describe("A realistic, standalone user message a reviewer can paste and run with no prior state or multi-turn setup. Vary phrasing and tone across cases."),
2630
+ toolTriggered: z.string().optional().describe("The tool this prompt should invoke."),
2631
+ expectedOutput: z.string().optional().describe("What the user should see, including post-interaction behaviour where relevant.")
2632
+ }).describe("Each case: Scenario, User prompt, Tool triggered, Expected output.");
2633
+ const positiveTestCaseDraftSchema = positiveTestCaseSchema.partial().extend({
2634
+ scenario: z.string().optional(),
2635
+ userPrompt: z.string().optional()
2636
+ });
2637
+ const blankPositiveTestCase = () => ({
2638
+ scenario: "",
2639
+ userPrompt: "",
2640
+ toolTriggered: "",
2641
+ expectedOutput: ""
2642
+ });
2643
+ const toFixedLength = (entries, length, blank) => Array.from({ length }, (_, index) => entries[index] ?? blank());
316
2644
  const screenshotEntrySchema = z.object({
317
2645
  prompt: z.string(),
318
2646
  url: z.url()
319
2647
  }).describe("Each screenshot: the user prompt that produced it + the image URL.");
2648
+ const screenshotDraftEntrySchema = screenshotEntrySchema.extend({ url: z.string() });
320
2649
  /** Accepts either a valid email or URL. */
321
2650
  const supportChannelSchema = z.string().refine((value) => z.email().safeParse(value).success || z.url().safeParse(value).success, { error: "Must be a valid email or URL" });
2651
+ /** A URL field whose error spells out that the scheme is required. */
2652
+ const urlField = z.url({ error: "Enter a full URL including https:// (e.g. https://example.com)" });
322
2653
  const chatgptCategorySchema = z.enum([
323
2654
  "BUSINESS",
324
2655
  "COLLABORATION",
@@ -335,68 +2666,387 @@ const chatgptCategorySchema = z.enum([
335
2666
  "TRAVEL"
336
2667
  ]);
337
2668
  const chatgptAuthenticationSchema = z.enum(["No auth needed", "OAuth 2.0"]);
338
- const chatgptAllowedCountriesSchema = z.enum(["Allow all", "Restrict to specific countries"]);
2669
+ const chatgptCountryCodeSchema = z.enum([
2670
+ "AD",
2671
+ "AE",
2672
+ "AF",
2673
+ "AG",
2674
+ "AL",
2675
+ "AM",
2676
+ "AO",
2677
+ "AR",
2678
+ "AT",
2679
+ "AU",
2680
+ "AW",
2681
+ "AX",
2682
+ "AZ",
2683
+ "BA",
2684
+ "BB",
2685
+ "BD",
2686
+ "BE",
2687
+ "BF",
2688
+ "BG",
2689
+ "BH",
2690
+ "BI",
2691
+ "BJ",
2692
+ "BL",
2693
+ "BM",
2694
+ "BN",
2695
+ "BO",
2696
+ "BR",
2697
+ "BS",
2698
+ "BT",
2699
+ "BW",
2700
+ "BZ",
2701
+ "CA",
2702
+ "CD",
2703
+ "CF",
2704
+ "CG",
2705
+ "CH",
2706
+ "CI",
2707
+ "CL",
2708
+ "CM",
2709
+ "CO",
2710
+ "CR",
2711
+ "CV",
2712
+ "CY",
2713
+ "CZ",
2714
+ "DE",
2715
+ "DJ",
2716
+ "DK",
2717
+ "DM",
2718
+ "DO",
2719
+ "DZ",
2720
+ "EC",
2721
+ "EE",
2722
+ "EG",
2723
+ "ER",
2724
+ "ES",
2725
+ "ET",
2726
+ "FI",
2727
+ "FJ",
2728
+ "FM",
2729
+ "FO",
2730
+ "FR",
2731
+ "GA",
2732
+ "GB",
2733
+ "GD",
2734
+ "GE",
2735
+ "GF",
2736
+ "GH",
2737
+ "GL",
2738
+ "GM",
2739
+ "GN",
2740
+ "GP",
2741
+ "GQ",
2742
+ "GR",
2743
+ "GT",
2744
+ "GW",
2745
+ "GY",
2746
+ "HN",
2747
+ "HR",
2748
+ "HT",
2749
+ "HU",
2750
+ "ID",
2751
+ "IE",
2752
+ "IL",
2753
+ "IN",
2754
+ "IQ",
2755
+ "IS",
2756
+ "IT",
2757
+ "JM",
2758
+ "JO",
2759
+ "JP",
2760
+ "KE",
2761
+ "KG",
2762
+ "KH",
2763
+ "KI",
2764
+ "KM",
2765
+ "KN",
2766
+ "KR",
2767
+ "KW",
2768
+ "KY",
2769
+ "KZ",
2770
+ "LA",
2771
+ "LB",
2772
+ "LC",
2773
+ "LI",
2774
+ "LK",
2775
+ "LR",
2776
+ "LS",
2777
+ "LT",
2778
+ "LU",
2779
+ "LV",
2780
+ "LY",
2781
+ "MA",
2782
+ "MC",
2783
+ "MD",
2784
+ "ME",
2785
+ "MF",
2786
+ "MG",
2787
+ "MH",
2788
+ "MK",
2789
+ "ML",
2790
+ "MM",
2791
+ "MN",
2792
+ "MQ",
2793
+ "MR",
2794
+ "MT",
2795
+ "MU",
2796
+ "MV",
2797
+ "MW",
2798
+ "MX",
2799
+ "MY",
2800
+ "MZ",
2801
+ "NA",
2802
+ "NC",
2803
+ "NE",
2804
+ "NG",
2805
+ "NI",
2806
+ "NL",
2807
+ "NO",
2808
+ "NP",
2809
+ "NR",
2810
+ "NZ",
2811
+ "OM",
2812
+ "PA",
2813
+ "PE",
2814
+ "PF",
2815
+ "PG",
2816
+ "PH",
2817
+ "PK",
2818
+ "PL",
2819
+ "PM",
2820
+ "PS",
2821
+ "PT",
2822
+ "PW",
2823
+ "PY",
2824
+ "QA",
2825
+ "RE",
2826
+ "RO",
2827
+ "RS",
2828
+ "RW",
2829
+ "SA",
2830
+ "SB",
2831
+ "SC",
2832
+ "SD",
2833
+ "SE",
2834
+ "SG",
2835
+ "SH",
2836
+ "SI",
2837
+ "SJ",
2838
+ "SK",
2839
+ "SL",
2840
+ "SM",
2841
+ "SN",
2842
+ "SO",
2843
+ "SR",
2844
+ "SS",
2845
+ "ST",
2846
+ "SV",
2847
+ "SZ",
2848
+ "TD",
2849
+ "TF",
2850
+ "TG",
2851
+ "TH",
2852
+ "TJ",
2853
+ "TL",
2854
+ "TM",
2855
+ "TN",
2856
+ "TO",
2857
+ "TR",
2858
+ "TT",
2859
+ "TV",
2860
+ "TW",
2861
+ "TZ",
2862
+ "UA",
2863
+ "UG",
2864
+ "US",
2865
+ "UY",
2866
+ "UZ",
2867
+ "VA",
2868
+ "VC",
2869
+ "VN",
2870
+ "VU",
2871
+ "WF",
2872
+ "WS",
2873
+ "YE",
2874
+ "YT",
2875
+ "ZA",
2876
+ "ZM",
2877
+ "ZW"
2878
+ ]);
2879
+ const chatgptAllowedCountriesSchema = z.discriminatedUnion("mode", [
2880
+ z.object({ mode: z.literal("all") }),
2881
+ z.object({
2882
+ mode: z.literal("allow"),
2883
+ countries: z.array(chatgptCountryCodeSchema)
2884
+ }),
2885
+ z.object({
2886
+ mode: z.literal("block"),
2887
+ countries: z.array(chatgptCountryCodeSchema)
2888
+ })
2889
+ ]);
2890
+ const chatgptTranslationLocaleSchema = z.enum([
2891
+ "am",
2892
+ "ar",
2893
+ "bg-BG",
2894
+ "bn-BD",
2895
+ "bs-BA",
2896
+ "ca-ES",
2897
+ "cs-CZ",
2898
+ "da-DK",
2899
+ "de-DE",
2900
+ "el-GR",
2901
+ "es-419",
2902
+ "es-ES",
2903
+ "et-EE",
2904
+ "fi-FI",
2905
+ "fr-CA",
2906
+ "fr-FR",
2907
+ "gu-IN",
2908
+ "hi-IN",
2909
+ "hr-HR",
2910
+ "hu-HU",
2911
+ "hy-AM",
2912
+ "id-ID",
2913
+ "is-IS",
2914
+ "it-IT",
2915
+ "ja-JP",
2916
+ "ka-GE",
2917
+ "kk",
2918
+ "kn-IN",
2919
+ "ko-KR",
2920
+ "lt",
2921
+ "lv-LV",
2922
+ "mk-MK",
2923
+ "ml",
2924
+ "mn",
2925
+ "mr-IN",
2926
+ "ms-MY",
2927
+ "my-MM",
2928
+ "nb-NO",
2929
+ "nl-NL",
2930
+ "pa",
2931
+ "pl-PL",
2932
+ "pt-BR",
2933
+ "pt-PT",
2934
+ "ro-RO",
2935
+ "ru-RU",
2936
+ "sk-SK",
2937
+ "sl-SI",
2938
+ "so-SO",
2939
+ "sq-AL",
2940
+ "sr-RS",
2941
+ "sv-SE",
2942
+ "sw-TZ",
2943
+ "ta-IN",
2944
+ "te-IN",
2945
+ "th-TH",
2946
+ "tl",
2947
+ "tr-TR",
2948
+ "uk-UA",
2949
+ "ur",
2950
+ "vi-VN",
2951
+ "zh-CN",
2952
+ "zh-HK",
2953
+ "zh-TW"
2954
+ ]);
339
2955
  const negativeTestCaseSchema = z.object({
340
- scenario: z.string(),
341
- userPrompt: z.string()
342
- }).partial().describe("Each case: Scenario + User prompt (the app should NOT trigger).");
2956
+ scenario: z.string().min(1),
2957
+ userPrompt: z.string().min(1)
2958
+ }).describe("Each case: Scenario + User prompt (the plugin should NOT trigger).");
2959
+ const negativeTestCaseDraftSchema = negativeTestCaseSchema.partial().extend({
2960
+ scenario: z.string().optional(),
2961
+ userPrompt: z.string().optional()
2962
+ });
2963
+ const blankNegativeTestCase = () => ({
2964
+ scenario: "",
2965
+ userPrompt: ""
2966
+ });
2967
+ const chatgptSkillSchema = z.object({ name: z.string() }).describe("A skill discovered on the MCP server, by name.");
343
2968
  const chatgptToolJustificationSchema = z.object({
344
2969
  toolName: z.string(),
345
- readOnlyJustification: z.string(),
346
- openWorldJustification: z.string(),
347
- destructiveJustification: z.string()
348
- }).describe("Per-tool justification of each MCP annotation value (one sentence per hint).");
2970
+ readOnlyJustification: z.string().describe("One sentence on what the tool reads and returns."),
2971
+ openWorldJustification: z.string().describe("One sentence on whether the tool reaches external systems beyond your own service."),
2972
+ destructiveJustification: z.string().describe("One sentence on whether the tool changes data. For a read-only tool, state the full triad: \"No data is created, modified, or deleted.\"")
2973
+ }).describe("Per-tool justification of each MCP annotation value (one specific sentence per hint).");
2974
+ /** Defined once and reused by both the submission form and per-locale translations so the tagline ≤ 30 chars constraint never drifts. */
2975
+ const chatgptTaglineSchema = z.string().max(30);
2976
+ const chatgptDescriptionSchema = z.string();
349
2977
  const chatgptTranslationSchema = z.object({
350
- locale: z.string(),
351
- tagline: z.string().optional(),
352
- description: z.string().optional()
2978
+ locale: chatgptTranslationLocaleSchema,
2979
+ tagline: chatgptTaglineSchema,
2980
+ description: chatgptDescriptionSchema
353
2981
  }).describe("Locale-scoped override for tagline + description. English (US) is the default.");
354
- /**
355
- * Field order mirrors the ChatGPT (OpenAI) submission spreadsheet, grouped by section.
356
- * When adding/removing/reordering fields, keep this in sync with the sheet.
357
- */
2982
+ chatgptTranslationSchema.extend({ tagline: clampStringField(chatgptTaglineSchema) });
2983
+ /** Field order mirrors the ChatGPT (OpenAI) submission spreadsheet, grouped by section; keep it in sync with the sheet. */
358
2984
  const chatgptSubmissionFormDataSchema = z.object({
359
2985
  logoLight: z.string().describe("Logo icon for light mode. Square PNG, no borders or rounded corners (clients apply circular cropping)."),
360
2986
  logoDark: z.string().optional().describe("Optional dark-mode logo icon. Square PNG, same specs as the light icon. Leave empty if the light icon also works on dark backgrounds."),
361
- appName: z.string().describe("The name users will see in ChatGPT and in the Apps Directory."),
362
- tagline: z.string().max(30).describe("Plain-language phrase focused on function and user value. 30 chars max."),
363
- description: z.string().describe("Clear, engaging description highlighting what the app does and why people will love it. Appears publicly on the directory page."),
2987
+ appName: z.string().describe("The name users will see in ChatGPT and in the Plugin Directory."),
2988
+ tagline: chatgptTaglineSchema.describe("Plain-language phrase focused on function and user value, 30 chars max. Avoid generic superlatives like \"the best …\"."),
2989
+ description: chatgptDescriptionSchema.describe("Clear, engaging description highlighting what the plugin does and why people will love it. Appears publicly on the directory page. End it by naming the product categories or intents the plugin does NOT cover, so ChatGPT learns when not to route to it (define exclusions by absent categories or wrong intents, never by naming other brands)."),
364
2990
  category: chatgptCategorySchema.describe("Category from the OpenAI taxonomy."),
365
- developerName: z.string().describe("Developer name shown publicly on the app's directory page."),
366
- companyUrl: z.url().describe("Your company's main website URL."),
2991
+ developerName: z.string().describe("Developer name shown publicly on the plugin's directory page."),
2992
+ companyUrl: urlField.describe("Your company's main website URL."),
367
2993
  supportChannel: supportChannelSchema.describe("Customer support URL or email address."),
368
- privacyPolicyUrl: z.url().describe("URL to your privacy policy."),
369
- termsOfServiceUrl: z.url().describe("URL to the app's terms of service."),
370
- demoRecordingUrl: z.url().describe("URL to a video demonstrating the app, recorded via OpenAI Developer Mode. Cover all main use cases on web, iOS, and Android."),
371
- appCommerceAndPurchasing: z.boolean().describe("Checkbox: 'My app links or directs users out of ChatGPT to make purchases.' Defaults to false. Verify the app does not offer digital goods."),
372
- serverUrl: z.url().describe("URL of the MCP server."),
2994
+ privacyPolicyUrl: urlField.describe("URL to your privacy policy."),
2995
+ termsOfServiceUrl: urlField.describe("URL to the plugin's terms of service."),
2996
+ demoRecordingUrl: urlField.describe("URL to a video demonstrating the plugin, recorded via OpenAI Developer Mode. Cover all main use cases on web, iOS, and Android."),
2997
+ appCommerceAndPurchasing: z.boolean().describe("Checkbox: 'My plugin links or directs users out of ChatGPT to make purchases.' Defaults to false. Verify the plugin does not offer digital goods."),
2998
+ serverUrl: urlField.describe("URL of the MCP server."),
373
2999
  authentication: chatgptAuthenticationSchema.describe("OAuth 2.0 or No auth. OAuth configuration is auto-discovered from the MCP server's metadata."),
374
3000
  tools: z.array(toolDefinitionSchema).describe("List of tools exposed by the MCP server (auto-populated from the production server's manifest)."),
375
- toolJustifications: z.array(chatgptToolJustificationSchema).describe("Per-tool justification of `readOnlyHint`, `openWorldHint`, and `destructiveHint` annotation values."),
376
- testCases: z.array(positiveTestCaseSchema).describe("At least 5 positive test cases. Each: Scenario, User prompt, Tool triggered, Expected output. Coverage over all major use cases."),
377
- negativeTestCases: z.array(negativeTestCaseSchema).describe("3 negative test cases — prompts where the app should NOT trigger but the model might think it's relevant."),
378
- screenshots: z.array(screenshotEntrySchema).describe("In-app screenshots paired with the user prompt that produced them. Widget apps must show the widget UI; non-widget apps show the model response. Min 1, max 4 entries. First three are public. Images: 706px wide, 400–860px tall, PNG."),
3001
+ toolJustifications: z.array(chatgptToolJustificationSchema).describe("Per-tool justification of `readOnlyHint`, `openWorldHint`, and `destructiveHint` annotation values. One short, specific sentence per hint describing what the tool actually does."),
3002
+ skills: z.array(chatgptSkillSchema).optional().describe("Skills the server exposes over MCP (auto-populated from the production server's manifest). Left unset when the server does not advertise the skills extension, which is a different state from advertising it and exposing none."),
3003
+ testCases: z.array(positiveTestCaseSchema).length(5).describe("Exactly 5 positive test cases. Each: Scenario, User prompt, Tool triggered, Expected output. Collectively cover the full capability across different flow stages (initial search or browse, market or locale handling, post-interaction detail, an action ChatGPT performs on the user's behalf, and a conversion or secondary tool) rather than five variations of the same first step."),
3004
+ negativeTestCases: z.array(negativeTestCaseSchema).length(3).describe("Exactly 3 negative test cases: prompts where the plugin should NOT trigger but the model might think it is relevant. These become production routing metadata that teaches ChatGPT when to stay silent, so pick tight near-misses: a product category the plugin does not carry, the right brand or domain but an intent the plugin does not serve, or a boundary with a sibling plugin."),
3005
+ screenshots: z.array(screenshotEntrySchema.extend({ prompt: z.string().max(75, { error: "Screenshot prompts are limited to 75 characters." }) })).max(3).describe("In-plugin screenshots paired with the user prompt that produced them (each prompt is 75 characters max). Widget plugins must show the widget UI; non-widget plugins show the model response. Min 1, max 3 entries, all public. Images: 706px wide, 400–860px tall, PNG."),
379
3006
  translations: z.array(chatgptTranslationSchema).describe("Per-locale translation of tagline + description. English (US) is the default."),
380
- allowedCountries: chatgptAllowedCountriesSchema.describe("'Allow all' or restrict to a specific list. See OpenAI's supported countries list."),
381
- releaseNotes: z.string().describe("Publicly displayed on the app details page.")
3007
+ allowedCountries: chatgptAllowedCountriesSchema.describe("Availability: all supported countries, or an allow-list / block-list of specific ones (ISO alpha-2)."),
3008
+ releaseNotes: z.string().describe("Publicly displayed on the plugin details page.")
382
3009
  });
383
- chatgptSubmissionFormDataSchema.pick({
3010
+ const chatgptSubmissionDraftSchema = chatgptSubmissionFormDataSchema.partial().extend({
3011
+ tagline: z.string().optional(),
3012
+ companyUrl: z.string().optional(),
3013
+ supportChannel: z.string().optional(),
3014
+ privacyPolicyUrl: z.string().optional(),
3015
+ termsOfServiceUrl: z.string().optional(),
3016
+ demoRecordingUrl: z.string().optional(),
3017
+ serverUrl: z.string().optional(),
3018
+ screenshots: z.array(screenshotDraftEntrySchema).optional(),
3019
+ testCases: z.array(positiveTestCaseDraftSchema).optional(),
3020
+ negativeTestCases: z.array(negativeTestCaseDraftSchema).optional(),
3021
+ translations: z.array(chatgptTranslationSchema.extend({ tagline: z.string() })).optional()
3022
+ });
3023
+ /** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "chatgpt" })` can populate. */
3024
+ const chatgptPrefillFormDataSchema = chatgptSubmissionFormDataSchema.pick({
384
3025
  appName: true,
385
3026
  developerName: true,
386
3027
  serverUrl: true,
387
3028
  tools: true,
3029
+ skills: true,
388
3030
  authentication: true
389
3031
  });
390
- chatgptSubmissionFormDataSchema.pick({
3032
+ /** Source of truth for `SubmissionPrefillService.generate({ platform: "chatgpt" })`. */
3033
+ const chatgptAiGeneratedFormDataSchema = chatgptSubmissionFormDataSchema.pick({
391
3034
  tagline: true,
392
3035
  description: true,
393
3036
  category: true,
394
3037
  testCases: true,
395
3038
  negativeTestCases: true,
396
3039
  toolJustifications: true
3040
+ }).extend({
3041
+ testCases: unboundedArrayField(chatgptSubmissionFormDataSchema.shape.testCases),
3042
+ negativeTestCases: unboundedArrayField(chatgptSubmissionFormDataSchema.shape.negativeTestCases)
3043
+ }).extend({
3044
+ tagline: clampStringField(chatgptSubmissionFormDataSchema.shape.tagline),
3045
+ testCases: z.array(positiveTestCaseDraftSchema).transform((cases) => toFixedLength(cases, 5, blankPositiveTestCase)),
3046
+ negativeTestCases: z.array(negativeTestCaseDraftSchema).transform((cases) => toFixedLength(cases, 3, blankNegativeTestCase))
397
3047
  });
398
3048
  const claudeCategorySchema = z.enum([
399
- "Business & Productivity",
3049
+ "Productivity",
400
3050
  "Communication",
401
3051
  "Data & Analytics",
402
3052
  "Development tools",
@@ -404,207 +3054,222 @@ const claudeCategorySchema = z.enum([
404
3054
  "Consumer Health",
405
3055
  "Health & Life Sciences",
406
3056
  "Media & Entertainment",
407
- "Commerce & Shopping"
3057
+ "Commerce & Shopping",
3058
+ "Legal",
3059
+ "Sales and marketing",
3060
+ "Creative",
3061
+ "Nonprofit",
3062
+ "Education",
3063
+ "Other"
408
3064
  ]);
409
- z.enum([
410
- "No auth needed",
411
- "OAuth 2.0",
412
- "Custom URL"
413
- ]);
414
- const claudeMcpUrlTypeSchema = z.enum(["Universal URL", "Custom MCP URLs"]);
415
- z.enum(["Static OAuth Client", "Dynamic OAuth Client (DCR / CIMD)"]);
3065
+ const claudeCategoryDescription = `The categories used to filter connectors in the directory UI. Select up to 5 that best describe your connector.`;
416
3066
  const claudeReadWriteCapabilitiesSchema = z.enum([
417
- "Read only",
418
- "Write only",
419
- "Read + write"
3067
+ "read_only",
3068
+ "write_only",
3069
+ "read_write"
420
3070
  ]);
421
- const claudeTransportSchema = z.enum(["Streamable HTTP", "SSE"]);
422
- const claudeThirdPartySchema = z.enum([
423
- "Web access (open web fetch / scraping / arbitrary URLs)",
424
- "Third-party AI model integration",
425
- "Third-party data retrieval (via workflow / aggregator)",
426
- "Third-party data modification (via workflow / aggregator)",
427
- "N/A"
3071
+ const claudeAuthenticationSchema = z.enum([
3072
+ "oauth_dcr",
3073
+ "oauth_cimd",
3074
+ "oauth_anthropic_creds",
3075
+ "custom_connection",
3076
+ "none"
428
3077
  ]);
429
- const claudeDataHandlingSchema = z.enum([
430
- "Server only accesses data explicitly requested by user",
431
- "No data is stored beyond session requirements",
432
- "Data transmission is encrypted (HTTPS / TLS)",
433
- "GDPR compliant (if applicable)"
3078
+ const claudeApiOwnershipSchema = z.enum([
3079
+ "first_party",
3080
+ "proxied",
3081
+ "third_party"
434
3082
  ]);
435
- const claudeSponsoredContentSchema = z.enum([
436
- "No, there is no sponsored content or advertisements",
437
- "Yes, there are banner ads or other paid visual elements",
438
- "Yes, returned content or ranking is impacted by sponsorship or ad placement"
3083
+ const claudeYesNoOtherSchema = z.union([z.boolean(), z.object({ other: z.string() })]);
3084
+ const claudePolicyAcknowledgementSchema = z.enum([
3085
+ "I have read and understand the MCP Directory developer guidelines.",
3086
+ "My server calls our own first-party APIs (or APIs we legitimately proxy with permission).",
3087
+ "My connector does not transfer money, cryptocurrency, or other financial assets on a user's behalf.",
3088
+ "My connector does not use AI models to generate images, video, or audio.",
3089
+ "Tool descriptions contain no instructions about model behavior, other tools, or external instruction sources, and no hidden or encoded text.",
3090
+ "My connector does not collect conversation data beyond what is needed for its function.",
3091
+ "Public documentation for this connector will be live by the publish date."
439
3092
  ]);
440
- /**
441
- * Field order mirrors the Claude (Anthropic) submission spreadsheet, grouped by section.
442
- * When adding/removing/reordering fields, keep this in sync with the sheet.
443
- */
3093
+ /** Field order mirrors the claude.ai directory submission wizard (`claude.ai/admin-settings/directory/submissions/new`), grouped by step; keep it in sync with the wizard. */
444
3094
  const claudeSubmissionFormDataSchema = z.object({
445
- companyName: z.string().describe("Enter your company's legal name or the name under which your product is publicly known. This is used for internal tracking and may appear in directory listings."),
446
- companyUrl: z.url().describe("Your company's main website URL, e.g. https://mycompany.com. Must be a valid URL with https://. This should be the root domain of the company behind this MCP server."),
447
- primaryContactName: z.string().describe("Full name of the person Anthropic should contact about this submission. This person will receive review feedback, approval notices, and any follow-up questions."),
448
- primaryContactEmail: z.email().describe("Business email for the primary contact. Must be a valid email address. Anthropic uses this to communicate about your submission status, required changes, and post-listing issues. Avoid using personal email addresses."),
449
- primaryContactRole: z.string().optional().describe("The job title or role of the primary contact (e.g. 'CTO', 'Developer Relations Lead', 'Founder'). Optional but helps Anthropic route questions to the right person."),
450
- anthropicPointOfContact: z.string().optional().describe("If you have a direct contact at Anthropic (e.g. from a partnership or sales conversation), enter their name here. This is optional but can greatly help expedite the review process. Leave blank if you don't have one."),
451
- appName: z.string().describe(`The public display name for your connector as it will appear in the Connectors Directory.
452
-
453
- Rules:
454
- (1) Do NOT include the words 'MCP' or 'Server' — these are auto-rejected.
455
- (2) Use your brand/product name, e.g. 'Notion', 'Linear', 'Slack'.
456
- (3) You must own or have the right to use this brand name. For example, don't call it 'Google Drive Helper' if you're not Google.`),
457
- mcpUrlType: claudeMcpUrlTypeSchema.describe(`Choose how your server URL works:
458
- • 'Universal URL': one single URL that all users connect to (most common). Example: https://mcp.myapp.com
459
- • 'Custom MCP URLs': each user gets their own unique URL (e.g. based on their workspace or instance).
460
- If you choose this, you'll need to provide both a signup URL and a regex pattern that matches valid server URLs for your service.`),
461
- serverUrl: z.url().describe(`If 'Universal URL': enter the full https:// URL where your MCP server is hosted and reachable. Example: https://mcp.myapp.com/
462
- If 'Custom MCP URLs': provide (1) the signup/onboarding URL where users create an account, and (2) a regex pattern that matches all valid server URLs for your service (e.g. https://[a-z0-9-]+\\.myapp\\.com/mcp). The server must be publicly accessible without VPN or whitelisting required.`),
463
- tagline: z.string().max(55).describe(`A very short, punchy description shown below your server name in the directory listing. Max 55 characters including spaces.
464
- Think of it as a subtitle or elevator pitch fragment. Example: 'Manage tasks and projects in Linear' or 'Search and read your Notion workspace'. Avoid generic phrases like 'The best MCP server for...'`),
465
- description: z.string().describe(`A 50–100 word description of what your MCP server does. This appears in the connector's detail page inside Claude. Write it from a user perspective: what can users do with this connector? What are the key features/tools? Avoid marketing fluff. Be specific. Example: 'Connect Claude to your Linear workspace. Create and update issues, search projects, manage teams, and track engineering cycles, all from within Claude.' Anthropic reviewers check this for accuracy against your actual tools.`),
466
- testCases: z.array(positiveTestCaseSchema).describe(`Provide at least 3 concrete use cases, each with an example prompt a user could type to Claude. These are critical: Anthropic reviewers literally test your server using these prompts. Good examples are specific and demonstrate real value.
467
- Best format: [Use case]: [exact prompt]"
468
- Example for a task manager:
469
- 1. Create a task: 'Create a task called Review Q3 report, due Friday, assigned to Alice'
470
- 2. Search tasks: 'Show me all open bugs in the Mobile project'
471
- 3. Update status: 'Mark the Deploy v2.1 task as done'"`),
472
- connectionRequirements: z.string().describe(`Describe any prerequisites a user must have before they can connect your server. Be exhaustive. Examples of things to mention:
473
- • Account type required (free vs paid plan)
474
- • Admin permissions or specific roles needed
475
- • Geographic restrictions (e.g. 'US only' or 'Not available in EU')
476
- • If users need to provide their own server URL or instance domain
477
- • Any setup steps needed before connecting (e.g. 'Enable API access in your account settings')
478
- If there are genuinely no special requirements, write exactly: 'No special requirements.'`),
479
- readWriteCapabilities: claudeReadWriteCapabilitiesSchema.describe(`Select the option that best describes what your server can do:
480
-
481
- 'Read Only': your tools only fetch/retrieve data (GET operations). Claude cannot modify anything via your server.
482
- 'Write Only': your tools only create/update/delete data (rare).
483
- 'Read + Write': your tools can both retrieve AND modify data (most common for full-featured connectors).
484
-
485
- Note: Anthropic rejects catch-all tools that accept both safe (GET) and unsafe (POST, PUT, DELETE) HTTP methods via a parameter e.g. a single api_request(method, endpoint) tool. Each tool should have a fixed, specific purpose. `),
486
- isMcpApp: z.boolean().describe(`Select 'Yes' if your MCP server renders interactive UI elements (aka widgets or views) inside the Claude conversation.
487
- Select 'No' if your server only returns text/data responses.
488
- If 'Yes', you will also be required to provide screenshots of your UI (see Promotional Images section). MCP Apps are displayed with a special badge in the directory.`),
489
- thirdPartyConnectionsAndWebAccess: z.array(claudeThirdPartySchema).describe(`Multi-select all that apply to your server's behavior:
490
- • 'Web access' — your server fetches arbitrary URLs, scrapes websites, or makes open-ended HTTP requests to the web (not just your own API).
491
- • 'Third-party AI model integration' — your server calls another AI model (e.g. OpenAI, Gemini, Cohere) as part of its processing.
492
- • 'Third-party data retrieval' — your server retrieves data via a workflow or aggregator platform (e.g. Zapier, Make, n8n) rather than calling your own API directly.
493
- • 'Third-party data modification' — your server modifies data via such a platform.
494
- • 'N/A' — your server only calls your own first-party API and does nothing else. Select this only if none of the above apply.`),
495
- dataHandling: z.array(claudeDataHandlingSchema).describe(`Multi-select all data handling practices that accurately apply to your server. You must select at least 3. Key points:
496
- • 'Server only accesses data explicitly requested by user' — your server doesn't silently read unrelated user data.
497
- • 'No data is stored beyond session requirements' — you don't log or retain conversation data after the session.
498
- • 'Data transmission is encrypted (HTTPS/TLS)' — all data in transit is encrypted. This should always apply for remote servers.
499
- • 'GDPR compliant' — if you operate in the EU or serve EU users, check this only if you are genuinely compliant. Don't check it without having proper data processing agreements and procedures in place.
500
- Note: These are attestations — you are legally agreeing to these practices by submitting the form.`),
501
- personalDataHealthAccess: z.boolean().describe(`Select 'Yes' ONLY if your connector gives users access to their own personal health information — such as medical records, lab results, diagnoses, prescriptions, wearable health metrics (heart rate, sleep data, etc.), or mental health data.
502
- Select 'No' for the vast majority of business/productivity/dev tools. When in doubt, select 'No'. This field triggers additional compliance review if 'Yes'.`),
503
- categories: z.array(claudeCategorySchema).describe(`Select the category or categories that best describe your connector. This determines where it appears in the directory's browse experience. Choose the most specific fit:
504
- • Business & Productivity — project management, CRM, HR, office tools
505
- • Communication — email, chat, messaging, notifications
506
- • Data & Analytics — dashboards, reporting, databases, BI tools
507
- • Development tools — code repositories, CI/CD, issue trackers, monitoring
508
- • Financial Services — accounting, invoicing, fintech (note: financial transaction execution is not permitted)
509
- • Consumer Health — fitness, wellness, personal health tracking
510
- • Health & Life Sciences — clinical, pharma, medical professional tools
511
- • Media & Entertainment — content, publishing, streaming
512
- • Commerce & Shopping — e-commerce, inventory, orders
513
- Multiple categories are allowed if genuinely applicable.`),
514
- sponsoredContentsOrAdvertisement: claudeSponsoredContentSchema.describe(`Be honest here — advertising is not permitted in the Connectors Directory per Anthropic's policy. Select the option that accurately describes your server:
515
- • 'No, there is no sponsored content or advertisements' — the results your server returns are not influenced by paid placement or sponsorship. This is what almost all connectors should select.
516
- • 'Yes, there are banner ads or other paid visual elements' — your UI includes visual ads. NOTE: this will likely lead to rejection, as Anthropic prohibits advertising in Claude.
517
- • 'Yes, the returned content or ranking of returned content is impacted by sponsorship or ad placement' — paid results affect what you return. NOTE: this also likely leads to rejection.
518
- If your server returns organic results from a platform that has ads in its own UI (but your API results are not affected by ads), select 'No'.`),
519
- transportSupport: z.array(claudeTransportSchema).describe(`Select all transport protocols your server supports:
520
- • 'Streamable HTTP' — the modern, recommended transport. Anthropic strongly recommends implementing this. This is the future-proof option and should be your default.
521
- • 'SSE (Server-Sent Events)' — the older transport. SSE may be deprecated by Anthropic later in 2025/2026. If you currently only support SSE, you should plan to migrate to Streamable HTTP.
522
- If you support both, select both. If you're building from scratch, implement Streamable HTTP only.`),
523
- serverDocumentationLink: z.url().describe(`A public URL pointing to documentation that helps users understand and use your connector. This is displayed in the Directory listing and must be publicly accessible without login. Minimum requirements for the docs page:
524
- • What the connector does and its key capabilities
525
- • How to connect/set it up (step by step)
526
- • What each tool does (or at least the main ones)
527
- • How to troubleshoot common issues
528
- • A support contact or channel
529
- Acceptable formats: a dedicated docs page, a help center article, a README on GitHub, or a blog post — as long as it's comprehensive. Note: Anthropic requires public documentation to be live by your publish date.`),
530
- privacyPolicyUrl: z.url().describe(`URL to your privacy policy. This is mandatory and displayed in the directory listing. Missing or incomplete privacy policies result in immediate rejection. Your privacy policy must cover:
531
- • What data you collect (and how)
532
- • How you use the collected data
533
- • Where and how long you store it
534
- • Whether you share data with third parties (and who)
535
- • How users can contact you about data concerns
536
- The policy must be publicly accessible. If you don't have one yet, create one before submitting — there are free generators online, but make sure it accurately reflects your actual practices. If you're GDPR-compliant, your policy should reflect that.`),
537
- supportChannel: supportChannelSchema.describe(`A URL or email address where users can get help with your connector. This is displayed in the Directory listing. Acceptable options:
538
- • Email address (e.g. support@myapp.com)
539
- • Link to a GitHub Issues page
540
- • Link to a help center or support article
541
- • Link to a Discord/Slack community
542
- • Link to your documentation's troubleshooting section
543
- Also uses this to notify you of security or compliance issues, so make sure it's actively monitored.`),
544
- testingCredentials: z.string().describe(`Provide login credentials for a test account that Anthropic reviewers can use to verify your server works end-to-end. Critical requirements:
545
- • The account must have sample/demo data loaded — reviewers need to actually test your tools with real data.
546
- • No 2FA — reviewers can't receive SMS codes. Disable 2FA on this account.
547
- • If your service uses Google OAuth or another OAuth that requires email verification, use mcp-review@anthropic.com as the account email — Anthropic has access to this inbox.
548
- • Credentials must remain valid for at least 30 days from submission.
549
- • If your service requires API keys instead of a password, provide those.
550
- Format suggestion: Username/email: xxx | Password: xxx | Any other notes`),
551
- tools: z.array(toolDefinitionSchema).describe(`A comma-separated list of all tools your MCP server exposes. Use the format: tool_name (Human-Readable Name). The tool_name is the internal identifier (snake_case, max 64 characters). The Human-Readable Name is what users see.
552
- Example: list_issues (List Issues), create_issue (Create Issue), update_issue (Update Issue), delete_issue (Delete Issue), search_issues (Search Issues)
553
- Reviewers test every single tool you list here — don't list tools that don't work. Also: do not have a single catch-all tool like api_request(method, endpoint) — Anthropic rejects these. Each action should be its own purpose-built tool.`),
554
- toolTitlesAnnotationsConfirmed: z.boolean().describe(`This is a compliance confirmation — check both boxes only if you have actually implemented these in your server code:
555
- • 'I've specified user-friendly titles for all tools' — every tool has a 'title' annotation (a human-readable label, different from the tool name).
556
- • 'I've specified accurate tool annotations for all tools' — every tool has the correct annotation: readOnlyHint: true for read operations (search, get, list, fetch), OR destructiveHint: true for write operations (create, update, delete, send).
557
- This is the #1 reason submissions get rejected (30% of all rejections). Do not check these boxes without actually having implemented the annotations. See MCP spec for how to add them.`),
558
- logoLight: z.string().describe(`Your connector's logo for light backgrounds. Requirements:
559
- • Format: SVG only
560
- • Aspect ratio: square (1:1)
561
- • Should work on a light background
562
- • Provide via URL (Google Drive link is fine) or upload directly
563
- Tip: use a simple, recognizable icon — not a full wordmark. The logo appears at small sizes in the directory grid.`),
564
- logoDark: z.string().optional().describe(`Optional dark-mode variant of the connector logo. Same specs as the light variant (SVG, square 1:1) but designed to read on a dark background. Leave empty if the light logo already works on dark.`),
565
- screenshots: z.array(screenshotEntrySchema).describe(`Screenshots or promotional images of your connector in action within Claude. Strongly recommended for all connectors, and required for MCP Apps (interactive UI). Guidelines:
566
- • 3–5 images is ideal
567
- • Minimum 1000px width, PNG format preferred
568
- • Each screenshot is paired with the user prompt that produced it
569
- • Crop to just the relevant part of the Claude interface (the tool response area)
570
- • Show your connector doing something impressive and useful — real data, real results
571
- • If you're an MCP App, include screenshots of your interactive UI elements
572
- These images appear in your directory listing and are a key factor in driving user installs.`)
573
- });
574
- claudeSubmissionFormDataSchema.pick({
575
- companyName: true,
576
- appName: true,
577
- mcpUrlType: true,
3095
+ serverUrl: z.url().describe(`The full https:// URL where your MCP server is hosted and reachable. In the claude.ai wizard this is read live
3096
+ from the custom connector you select — the connection is used to verify the URL and the tool list at submission time.
3097
+ The server must be publicly accessible without VPN or whitelisting.`),
3098
+ name: z.string().max(100).describe(`The public display name for your connector as it appears in the directory. Use your brand/product name. You must
3099
+ own or have the right to use this name. Max 100 characters.`),
3100
+ slug: z.string().max(50).regex(/^[a-z0-9-]+$/).describe(`URL-safe identifier for your connector's directory page. Lowercase letters, numbers, and hyphens only.
3101
+ PERMANENT after submission — it cannot be changed. Pre-filled from the name. Max 50 characters.`),
3102
+ oneLiner: z.string().max(200).describe(`A short tagline shown below your connector name in the directory listing. Max 200 characters. Avoid generic
3103
+ phrases like 'The best MCP server for...'. Example: 'Manage tasks and projects in Linear'.`),
3104
+ description: z.string().max(2e3).describe(`A description of what your connector does and its key features, shown on the connector's detail page in
3105
+ claude.ai. Write it from a user perspective and be specific. Max 2000 characters.`),
3106
+ categories: z.array(claudeCategorySchema).max(5).describe(claudeCategoryDescription),
3107
+ iconUrl: z.url().optional().describe(`Optional custom icon for the directory listing — a square SVG. By default the favicon from your MCP URL is used
3108
+ (recommended); upload a custom icon only to override it.`),
3109
+ documentation: z.url().describe(`A public URL pointing to documentation that helps users understand and use your connector. Must be publicly
3110
+ accessible without login. IT admins often review these when deciding whether to approve a server. Required to be live
3111
+ by your publish date.`),
3112
+ support: supportChannelSchema.describe(`A support URL or email address where users can get help with your connector. Displayed in the directory listing and
3113
+ used to notify you of security or compliance issues, so make sure it's actively monitored.`),
3114
+ privacyPolicy: z.url().describe(`URL to your privacy policy. Mandatory and displayed in the directory listing. Must be publicly accessible and cover
3115
+ what data you collect, how you use and store it, and whether you share it with third parties.`),
3116
+ screenshots: z.array(screenshotEntrySchema).optional().describe(`Carousel images shown on your connector's directory page (PNG). Each is paired with the user prompt that produced
3117
+ it. This is editable on the directory page only after the connector is submitted — optional here so you can prepare it.`),
3118
+ primaryUseCases: z.string().describe(`Describe the main tasks users will accomplish with this connector, and include a few example prompts a user might
3119
+ type. These may be shown publicly but are primarily used for internal review — reviewers test your server using them.`),
3120
+ connectionRequirements: z.string().describe(`What accounts, permissions, or setup a user needs before connecting (e.g. 'Requires a paid Acme account with admin
3121
+ permissions'). If there are genuinely no special requirements, say so explicitly.`),
3122
+ readWriteCapabilities: claudeReadWriteCapabilitiesSchema.describe(`What your server can do:
3123
+ • 'read_only': retrieves data but never modifies it.
3124
+ • 'write_only': creates or modifies data but does not read it.
3125
+ • 'read_write': both retrieves and modifies data (most common).`),
3126
+ companyName: z.string().describe("The company or organization behind this connector — its legal name or publicly known product name."),
3127
+ companyWebsite: z.url().describe("The company's main website URL, e.g. https://example.com."),
3128
+ primaryContactName: z.string().describe("Full name of the person Anthropic should contact about this submission. Receives review feedback and follow-up questions."),
3129
+ primaryContactEmail: z.email().describe("Email for the primary contact (pre-filled from the Claude account). Anthropic uses this to communicate about your submission."),
3130
+ primaryContactRole: z.string().optional().describe("The primary contact's role at the company (e.g. 'Engineer', 'Product Manager'). Optional."),
3131
+ anthropicPointOfContact: z.string().optional().describe("If you've been working with someone at Anthropic, their name or email. Optional, can expedite review."),
3132
+ authentication: claudeAuthenticationSchema.describe(`How users authenticate with your server:
3133
+ • 'oauth_dcr': OAuth 2.0 + Dynamic Client Registration (RFC 7591) — clients register themselves.
3134
+ • 'oauth_cimd': OAuth 2.0 + Client ID Metadata Document — a published client_id metadata document.
3135
+ • 'oauth_anthropic_creds': OAuth 2.0 with Anthropic-held client credentials (a static client_id, and secret if needed).
3136
+ • 'custom_connection': users supply their own URL or client details at connection time (e.g. Snowflake).
3137
+ • 'none': no authentication (authless) — anyone can connect and call tools without credentials.`),
3138
+ partialAuth: z.boolean().optional().describe("Whether some tools return 401 and prompt for auth on demand while the server otherwise starts authless (partial auth)."),
3139
+ apiOwnership: claudeApiOwnershipSchema.describe(`How your connector relates to the API it calls:
3140
+ • 'first_party': the MCP server calls your own production APIs.
3141
+ • 'proxied': calls go to a third-party API you're authorized to integrate (e.g. a Zapier-style integration).
3142
+ • 'third_party': calls a third-party API you don't control — typically blocks listing; explain in 'additionalNotes'.`),
3143
+ personalHealthData: claudeYesNoOtherSchema.describe(`Whether this connector accesses, processes, or stores personal health information.
3144
+ No → false, Yes → true, or { other: explanation } when it depends on configuration.`),
3145
+ sponsoredContent: claudeYesNoOtherSchema.describe(`Whether this connector surfaces sponsored, promoted, or advertising content (prohibited in directory connectors).
3146
+ No → false, Yes → true, or { other: explanation }.`),
3147
+ testInstructions: z.string().optional().describe(`Clear test-account setup and access instructions for reviewers: every link, credential, and step needed to access
3148
+ the MCP server autonomously. For accounts that need to be populated, provide test credentials granting access to a
3149
+ fully populated account.`),
3150
+ selfTested: z.boolean().optional().describe("Confirmation that you have run every tool via MCP Inspector or as a custom connector in Claude."),
3151
+ policyAcknowledgements: z.array(claudePolicyAcknowledgementSchema).describe(`Anthropic directory policy acknowledgements. All items must be acknowledged before the claude.ai wizard allows
3152
+ submission. Each is an attestation you are legally agreeing to by submitting.`),
3153
+ additionalNotes: z.string().optional().describe("Anything else the review team should know about your connector. Optional.")
3154
+ });
3155
+ const claudeSubmissionDraftSchema = claudeSubmissionFormDataSchema.partial().extend({
3156
+ serverUrl: z.string().optional(),
3157
+ name: z.string().optional(),
3158
+ slug: z.string().optional(),
3159
+ oneLiner: z.string().optional(),
3160
+ description: z.string().optional(),
3161
+ iconUrl: z.string().optional(),
3162
+ documentation: z.string().optional(),
3163
+ support: z.string().optional(),
3164
+ privacyPolicy: z.string().optional(),
3165
+ companyWebsite: z.string().optional(),
3166
+ primaryContactEmail: z.string().optional(),
3167
+ categories: z.array(claudeCategorySchema).optional(),
3168
+ screenshots: z.array(screenshotDraftEntrySchema).optional()
3169
+ });
3170
+ /** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "claudeai" })` can populate. */
3171
+ const claudePrefillFormDataSchema = claudeSubmissionFormDataSchema.pick({
578
3172
  serverUrl: true,
579
- tools: true,
580
- readWriteCapabilities: true,
581
- isMcpApp: true,
582
- transportSupport: true,
3173
+ name: true,
3174
+ slug: true,
3175
+ companyName: true,
583
3176
  primaryContactEmail: true,
584
- primaryContactName: true
3177
+ primaryContactName: true,
3178
+ readWriteCapabilities: true,
3179
+ authentication: true,
3180
+ apiOwnership: true,
3181
+ personalHealthData: true
3182
+ }).extend({
3183
+ connectionRequirements: claudeSubmissionFormDataSchema.shape.connectionRequirements.optional(),
3184
+ testInstructions: claudeSubmissionFormDataSchema.shape.testInstructions.optional()
585
3185
  });
586
- claudeSubmissionFormDataSchema.pick({
587
- tagline: true,
588
- description: true,
589
- categories: true,
590
- testCases: true
3186
+ /** Loose shape returned by AI generation for Claude narrative fields; transforms live here so generation leniency stays colocated with the Claude contract. */
3187
+ const claudeAiGeneratedFormDataRawSchema = z.object({
3188
+ oneLiner: claudeSubmissionFormDataSchema.shape.oneLiner,
3189
+ description: claudeSubmissionFormDataSchema.shape.description,
3190
+ categories: z.array(claudeCategorySchema).describe(claudeCategoryDescription),
3191
+ primaryUseCases: claudeSubmissionFormDataSchema.shape.primaryUseCases
3192
+ });
3193
+ const claudeAiGeneratedFormDataSchema = claudeAiGeneratedFormDataRawSchema.extend({
3194
+ oneLiner: clampStringField(claudeSubmissionFormDataSchema.shape.oneLiner),
3195
+ categories: claudeAiGeneratedFormDataRawSchema.shape.categories.transform((categories) => categories.slice(0, 5))
3196
+ });
3197
+ function provenanceByField(prefillShape, aiGeneratedShape) {
3198
+ const byField = {};
3199
+ for (const field of Object.keys(prefillShape)) byField[field] = "prefilled";
3200
+ for (const field of Object.keys(aiGeneratedShape)) byField[field] = "ai-generated";
3201
+ return byField;
3202
+ }
3203
+ provenanceByField(claudePrefillFormDataSchema.shape, claudeAiGeneratedFormDataSchema.shape), provenanceByField(chatgptPrefillFormDataSchema.shape, chatgptAiGeneratedFormDataSchema.shape);
3204
+ const urlVerificationOutcomeSchema = z.enum([
3205
+ "pass",
3206
+ "fail",
3207
+ "unverified"
3208
+ ]);
3209
+ const VERIFIABLE_URL_FIELDS = {
3210
+ chatgpt: ["privacyPolicyUrl", "termsOfServiceUrl"],
3211
+ claudeai: ["privacyPolicy"]
3212
+ };
3213
+ const verifiableUrlFieldSchema = z.enum([...VERIFIABLE_URL_FIELDS.chatgpt, ...VERIFIABLE_URL_FIELDS.claudeai]);
3214
+ const policyDisclosureSchema = z.enum([
3215
+ "dataCategories",
3216
+ "purposesOfUse",
3217
+ "recipients",
3218
+ "retention"
3219
+ ]);
3220
+ const urlVerificationFieldResultSchema = z.object({
3221
+ field: verifiableUrlFieldSchema,
3222
+ url: z.string(),
3223
+ outcome: urlVerificationOutcomeSchema,
3224
+ reason: z.string(),
3225
+ concerns: z.array(z.string()).optional(),
3226
+ scrapedWith: z.enum(["fetch", "firecrawl"]).optional()
3227
+ });
3228
+ const urlVerificationSchema = z.object({
3229
+ verifiedAt: z.coerce.date(),
3230
+ results: z.array(urlVerificationFieldResultSchema)
3231
+ });
3232
+ const pageKindSchema = z.enum([
3233
+ "expectedDocument",
3234
+ "errorPage",
3235
+ "loginWall",
3236
+ "parkedDomain",
3237
+ "comingSoon",
3238
+ "marketingPage",
3239
+ "unrelatedDocument"
3240
+ ]);
3241
+ z.object({
3242
+ pageKind: pageKindSchema.describe("What the page actually is. Use 'expectedDocument' only when it is genuinely the document the field claims."),
3243
+ reason: z.string().max(200).describe("One sentence naming what the page is, addressed to the developer who entered the URL."),
3244
+ missingDisclosures: z.array(policyDisclosureSchema).describe("For a privacy policy only: which of the four required disclosures the text does not cover. Empty for every other page kind.")
591
3245
  });
592
3246
  const submissionMetaFieldsSchema = z.object({
593
3247
  id: z.string(),
594
3248
  environmentId: z.string(),
3249
+ auditId: z.string().nullable(),
3250
+ urlVerification: urlVerificationSchema.nullable().default(null),
595
3251
  createdAt: z.coerce.date(),
596
3252
  updatedAt: z.coerce.date()
597
3253
  });
598
3254
  const claudeSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
599
3255
  platform: z.literal("claudeai"),
600
- formData: claudeSubmissionFormDataSchema.partial()
3256
+ formData: claudeSubmissionDraftSchema,
3257
+ prefillSnapshot: claudeSubmissionDraftSchema.nullable().default(null)
601
3258
  });
602
3259
  const chatgptSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
603
3260
  platform: z.literal("chatgpt"),
604
- formData: chatgptSubmissionFormDataSchema.partial()
3261
+ formData: chatgptSubmissionDraftSchema,
3262
+ prefillSnapshot: chatgptSubmissionDraftSchema.nullable().default(null)
605
3263
  });
606
- z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
607
- z.union([claudeSubmissionFormDataSchema.partial(), chatgptSubmissionFormDataSchema.partial()]);
3264
+ const submissionSchemaInternal = z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
3265
+ z.union([claudeSubmissionDraftSchema, chatgptSubmissionDraftSchema]);
3266
+ /** Discriminated on `platform`, which pins the shape of `formData`: a Claude submission cannot carry chatgpt-only fields, and vice-versa. */
3267
+ const submissionSchema = submissionSchemaInternal;
3268
+ z.literal([
3269
+ 100,
3270
+ 75,
3271
+ 50
3272
+ ]);
608
3273
  const subscriptionPlanSchema = z.enum([
609
3274
  "pro",
610
3275
  "business",
@@ -616,19 +3281,84 @@ const customerCreditsSchema = z.object({
616
3281
  expiresAt: z.number().nullable(),
617
3282
  currency: z.string()
618
3283
  });
619
- const customerUsageSchema = z.object({
620
- amountInCents: z.number(),
621
- currency: z.string(),
622
- periodEnd: z.number()
623
- });
624
3284
  const partnerDiscountSchema = z.object({ endsAt: z.number() });
625
3285
  z.object({
626
3286
  customerCredits: customerCreditsSchema.nullable(),
627
- customerUsage: customerUsageSchema.nullable(),
628
3287
  partnerDiscount: partnerDiscountSchema.nullable()
629
3288
  });
630
- //#endregion
631
- //#region src/schemas.ts
3289
+ const metricsQueueEventSchema = z.object({
3290
+ ts: z.number().int(),
3291
+ method: z.string(),
3292
+ tool: z.string().nullable(),
3293
+ client: z.string(),
3294
+ sessionId: z.string().nullable(),
3295
+ conversationId: z.string().nullable().optional(),
3296
+ durationMs: z.number().int(),
3297
+ outputTokens: z.number().int().nullable(),
3298
+ errorType: z.enum([
3299
+ "mcp_error",
3300
+ "tool_error",
3301
+ "timeout"
3302
+ ]).nullable(),
3303
+ errorCode: z.number().int().nullable()
3304
+ });
3305
+ z.object({
3306
+ v: z.literal(1),
3307
+ envId: z.string(),
3308
+ events: z.array(metricsQueueEventSchema)
3309
+ });
3310
+ z.object({ v: z.number() });
3311
+ const TELEMETRY_SIGNALS = [
3312
+ "logs",
3313
+ "metrics",
3314
+ "traces"
3315
+ ];
3316
+ const telemetrySignalSchema = z.enum(TELEMETRY_SIGNALS);
3317
+ const OTLP_PROTOCOLS = ["http/protobuf", "http/json"];
3318
+ const otlpProtocolSchema = z.enum(OTLP_PROTOCOLS);
3319
+ const otlpEndpointSchema = z.string().trim().min(1).max(2048);
3320
+ const OTLP_HEADER_VALUE_MAX_LENGTH = 2048;
3321
+ const otlpHeaderNameSchema = z.string().trim().min(1, "Enter a header name").max(128).regex(/^[A-Za-z0-9!#$%&'*+\-.^_`|~]+$/, "Use letters, digits and !#$%&'*+-.^_`|~ only");
3322
+ const otlpHeaderValueSchema = z.string().trim().max(OTLP_HEADER_VALUE_MAX_LENGTH).refine((value) => !/[\r\n]/.test(value), "Line breaks are not allowed in a header value");
3323
+ const telemetryDestinationHeaderSchema = z.object({
3324
+ id: z.string(),
3325
+ name: otlpHeaderNameSchema,
3326
+ value: otlpHeaderValueSchema,
3327
+ isSecret: z.boolean()
3328
+ });
3329
+ const otlpPushFailureReasonSchema = z.enum([
3330
+ "credentials",
3331
+ "wrong-path",
3332
+ "wrong-protocol",
3333
+ "invalid-payload",
3334
+ "partial-rejection",
3335
+ "blocked-target",
3336
+ "timeout",
3337
+ "unreachable",
3338
+ "receiver-error",
3339
+ "unexpected-status"
3340
+ ]);
3341
+ const telemetryDestinationStatusSchema = z.enum(["active", "suspended"]);
3342
+ z.object({
3343
+ id: z.string(),
3344
+ signal: telemetrySignalSchema,
3345
+ endpoint: otlpEndpointSchema,
3346
+ protocol: otlpProtocolSchema,
3347
+ headers: z.array(telemetryDestinationHeaderSchema),
3348
+ status: telemetryDestinationStatusSchema,
3349
+ lastFailureReason: otlpPushFailureReasonSchema.nullable(),
3350
+ isScopedToIntentionalRequestsOnly: z.boolean()
3351
+ });
3352
+ const hasDuplicateHeaderNames = (headers) => {
3353
+ const names = headers.map(({ name }) => name.trim().toLowerCase());
3354
+ return new Set(names).size !== names.length;
3355
+ };
3356
+ // src/auth-scope.ts
3357
+ /** Accepts an API key or OAuth access token (default for most routes). */
3358
+ const AUTH_SCOPE_ANY = "any";
3359
+ /** Requires a user OAuth access token; API keys are not accepted. */
3360
+ const AUTH_SCOPE_USER = "user";
3361
+ // src/schemas.ts
632
3362
  const RESERVED_KEYS = [
633
3363
  "_HANDLER",
634
3364
  "_X_AMZN_TRACE_ID",
@@ -663,7 +3393,10 @@ const RESERVED_KEYS = [
663
3393
  "BUILD_ARG_START_COMMAND",
664
3394
  "ALPIC_HOST",
665
3395
  "ALPIC_CUSTOM_DOMAINS",
666
- "ALPIC_INTENT_META_KEY"
3396
+ "ALPIC_INTENT_META_KEY",
3397
+ "ALPIC_FEEDBACK_META_KEY",
3398
+ "ALPIC_EVENTS_META_KEY",
3399
+ "ALPIC_IDENTIFY_META_KEY"
667
3400
  ];
668
3401
  const environmentVariableSchema = z.object({
669
3402
  key: z.string().min(2, "Key must be at least 2 characters").regex(/^[a-zA-Z]([a-zA-Z0-9_])+$/, "Key must start with a letter and contain only letters, numbers, and underscores").refine((key) => !RESERVED_KEYS.includes(key), "This key is reserved and cannot be used as an environment variable key"),
@@ -714,8 +3447,15 @@ const serverFieldsSchema = z.object({
714
3447
  })).optional()
715
3448
  })).optional()
716
3449
  });
717
- //#endregion
718
- //#region src/api.contract.ts
3450
+ // src/api.contract.ts
3451
+ const isValidIanaTimeZone = (timeZone) => {
3452
+ try {
3453
+ new Intl.DateTimeFormat("en-US", { timeZone });
3454
+ return true;
3455
+ } catch {
3456
+ return false;
3457
+ }
3458
+ };
719
3459
  const deploymentStatusSchema = z.enum([
720
3460
  "ongoing",
721
3461
  "deployed",
@@ -744,21 +3484,20 @@ const deploymentSchema = z.object({
744
3484
  isCurrent: z.boolean(),
745
3485
  deploymentPageUrl: z.url().nullable()
746
3486
  });
747
- const isValidLogTimeInput = (value) => {
3487
+ const isValidTimeInput = (value) => {
748
3488
  if (ms(value) !== void 0) return true;
749
3489
  return !Number.isNaN(new Date(value).getTime());
750
3490
  };
751
- const createEnvironmentContractV1 = oc.route({
3491
+ const timeInputSchema = z.string().refine(isValidTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." });
3492
+ const base = oc.errors({ BAD_REQUEST: {} });
3493
+ const createEnvironmentContractV1 = base.route({
752
3494
  path: "/v1/environments",
753
3495
  method: "POST",
754
3496
  summary: "Create an environment",
755
3497
  description: "Create an environment for a project",
756
3498
  tags: ["environments"],
757
3499
  successDescription: "The environment has been created successfully"
758
- }).errors({
759
- NOT_FOUND: {},
760
- BAD_REQUEST: {}
761
- }).input(z.object({
3500
+ }).errors({ NOT_FOUND: {} }).input(z.object({
762
3501
  projectId: z.string().describe("The ID of the project to create the environment for"),
763
3502
  name: z.string().min(1).describe("The name of the environment"),
764
3503
  sourceBranch: z.string().min(1).describe("The branch used to build the environment"),
@@ -767,11 +3506,11 @@ const createEnvironmentContractV1 = oc.route({
767
3506
  id: z.string(),
768
3507
  name: z.string(),
769
3508
  sourceBranch: z.string().nullable().describe("The branch used to build the environment"),
770
- urls: z.array(z.string().url()).describe("The URLs of the MCP server"),
3509
+ urls: z.array(z.url()).describe("The URLs of the MCP server"),
771
3510
  createdAt: z.coerce.date(),
772
3511
  projectId: z.string().describe("The ID of the project the environment belongs to")
773
3512
  }));
774
- const getEnvironmentContractV1 = oc.route({
3513
+ const getEnvironmentContractV1 = base.route({
775
3514
  path: "/v1/environments/{environmentId}",
776
3515
  method: "GET",
777
3516
  summary: "Get an environment",
@@ -787,6 +3526,14 @@ const getEnvironmentContractV1 = oc.route({
787
3526
  createdAt: z.coerce.date(),
788
3527
  projectId: z.string()
789
3528
  }));
3529
+ const deleteEnvironmentContractV1 = base.route({
3530
+ path: "/v1/environments/{environmentId}",
3531
+ method: "DELETE",
3532
+ summary: "Delete an environment",
3533
+ description: "All environments can be deleted except the production environment. This operation is not reversible: associated logs, analytics, and metrics are deleted as well.",
3534
+ tags: ["environments"],
3535
+ successDescription: "The environment has been deleted successfully"
3536
+ }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.object({ success: z.literal(true) }));
790
3537
  const domainSchema = z.object({
791
3538
  domain: z.string(),
792
3539
  status: z.enum([
@@ -828,7 +3575,7 @@ const projectOutputSchema = z.object({
828
3575
  productionEnvironment: productionEnvironmentSchema.nullable(),
829
3576
  environments: z.array(environmentSchema)
830
3577
  });
831
- const getProjectContractV1 = oc.route({
3578
+ const getProjectContractV1 = base.route({
832
3579
  path: "/v1/projects/{projectId}",
833
3580
  method: "GET",
834
3581
  summary: "Get a project",
@@ -836,15 +3583,15 @@ const getProjectContractV1 = oc.route({
836
3583
  tags: ["projects"],
837
3584
  successDescription: "The project details"
838
3585
  }).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(projectOutputSchema);
839
- const listProjectsContractV1 = oc.route({
3586
+ const listProjectsContractV1 = base.route({
840
3587
  path: "/v1/projects",
841
3588
  method: "GET",
842
3589
  summary: "List projects",
843
3590
  description: "List all projects for a team",
844
3591
  tags: ["projects"],
845
3592
  successDescription: "The list of projects"
846
- }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
847
- const createProjectContractV1 = oc.route({
3593
+ }).errors({ NOT_FOUND: {} }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
3594
+ const createProjectContractV1 = base.route({
848
3595
  path: "/v1/projects",
849
3596
  method: "POST",
850
3597
  summary: "Create a project",
@@ -853,7 +3600,7 @@ const createProjectContractV1 = oc.route({
853
3600
  successDescription: "The project has been created successfully"
854
3601
  }).errors({
855
3602
  NOT_FOUND: {},
856
- BAD_REQUEST: {}
3603
+ FORBIDDEN: {}
857
3604
  }).input(z.object({
858
3605
  teamId: z.string().optional(),
859
3606
  name: z.string().trim().min(1).max(100),
@@ -893,7 +3640,101 @@ const environmentVariableOutputSchema = z.object({
893
3640
  isSecret: z.boolean(),
894
3641
  createdAt: z.coerce.date()
895
3642
  });
896
- const listEnvironmentVariablesContractV1 = oc.route({
3643
+ const telemetryDestinationHeaderOutputSchema = z.discriminatedUnion("isSecret", [z.object({
3644
+ id: z.string(),
3645
+ name: otlpHeaderNameSchema,
3646
+ value: z.null(),
3647
+ isSecret: z.literal(true)
3648
+ }), z.object({
3649
+ id: z.string(),
3650
+ name: otlpHeaderNameSchema,
3651
+ value: otlpHeaderValueSchema,
3652
+ isSecret: z.literal(false)
3653
+ })]);
3654
+ const telemetryDestinationOutputSchema = z.object({
3655
+ id: z.string(),
3656
+ signal: telemetrySignalSchema,
3657
+ endpoint: otlpEndpointSchema,
3658
+ protocol: otlpProtocolSchema,
3659
+ headers: z.array(telemetryDestinationHeaderOutputSchema),
3660
+ status: telemetryDestinationStatusSchema,
3661
+ lastFailureReason: otlpPushFailureReasonSchema.nullable(),
3662
+ isScopedToIntentionalRequestsOnly: z.boolean()
3663
+ });
3664
+ const createTelemetryDestinationHeaderInputSchema = z.object({
3665
+ name: otlpHeaderNameSchema,
3666
+ value: otlpHeaderValueSchema.min(1, "Enter a header value"),
3667
+ isSecret: z.boolean()
3668
+ });
3669
+ const updateTelemetryDestinationHeaderInputSchema = z.object({
3670
+ id: z.string().optional(),
3671
+ name: otlpHeaderNameSchema,
3672
+ value: otlpHeaderValueSchema.optional(),
3673
+ isSecret: z.boolean()
3674
+ });
3675
+ const uniqueTelemetryHeaders = (headers) => !hasDuplicateHeaderNames(headers);
3676
+ const listTelemetryDestinationsContractV1 = base.route({
3677
+ path: "/v1/environments/{environmentId}/telemetry-destinations",
3678
+ method: "GET",
3679
+ summary: "List telemetry destinations",
3680
+ description: "List the OTLP destinations configured for an environment. Secret header values are never returned.",
3681
+ tags: ["telemetry"],
3682
+ successDescription: "The list of telemetry destinations"
3683
+ }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(telemetryDestinationOutputSchema));
3684
+ const createTelemetryDestinationContractV1 = base.route({
3685
+ path: "/v1/environments/{environmentId}/telemetry-destinations",
3686
+ method: "POST",
3687
+ summary: "Create a telemetry destination",
3688
+ description: "Verify and save an OTLP destination for logs, metrics, or traces.",
3689
+ tags: ["telemetry"],
3690
+ successDescription: "The telemetry destination has been created"
3691
+ }).errors({
3692
+ NOT_FOUND: {},
3693
+ FORBIDDEN: {},
3694
+ OTLP_DESTINATION_UNVERIFIED: { status: 400 },
3695
+ INTERNAL_SERVER_ERROR: {}
3696
+ }).input(z.object({
3697
+ environmentId: z.string().describe("The ID of the environment"),
3698
+ signal: telemetrySignalSchema,
3699
+ endpoint: otlpEndpointSchema,
3700
+ protocol: otlpProtocolSchema.default("http/protobuf"),
3701
+ isScopedToIntentionalRequestsOnly: z.boolean().default(false),
3702
+ headers: z.array(createTelemetryDestinationHeaderInputSchema).default([]).refine(uniqueTelemetryHeaders, "Header names must be unique")
3703
+ })).output(telemetryDestinationOutputSchema);
3704
+ const updateTelemetryDestinationContractV1 = base.route({
3705
+ path: "/v1/environments/{environmentId}/telemetry-destinations/{destinationId}",
3706
+ method: "PATCH",
3707
+ summary: "Update a telemetry destination",
3708
+ description: "Verify and save changes to an OTLP destination. Omit headers to keep them unchanged; omit the value of an existing header to preserve it. A secret header value must be re-entered when the endpoint changes.",
3709
+ tags: ["telemetry"],
3710
+ successDescription: "The telemetry destination has been updated"
3711
+ }).errors({
3712
+ NOT_FOUND: {},
3713
+ FORBIDDEN: {},
3714
+ OTLP_DESTINATION_UNVERIFIED: { status: 400 }
3715
+ }).input(z.object({
3716
+ environmentId: z.string().describe("The ID of the environment"),
3717
+ destinationId: z.string().describe("The ID of the telemetry destination"),
3718
+ endpoint: otlpEndpointSchema.optional(),
3719
+ protocol: otlpProtocolSchema.optional(),
3720
+ isScopedToIntentionalRequestsOnly: z.boolean().optional(),
3721
+ headers: z.array(updateTelemetryDestinationHeaderInputSchema).refine(uniqueTelemetryHeaders, "Header names must be unique").optional()
3722
+ })).output(telemetryDestinationOutputSchema);
3723
+ const deleteTelemetryDestinationContractV1 = base.route({
3724
+ path: "/v1/environments/{environmentId}/telemetry-destinations/{destinationId}",
3725
+ method: "DELETE",
3726
+ summary: "Delete a telemetry destination",
3727
+ description: "Delete an OTLP destination from an environment.",
3728
+ tags: ["telemetry"],
3729
+ successDescription: "The telemetry destination has been deleted"
3730
+ }).errors({
3731
+ NOT_FOUND: {},
3732
+ INTERNAL_SERVER_ERROR: {}
3733
+ }).input(z.object({
3734
+ environmentId: z.string().describe("The ID of the environment"),
3735
+ destinationId: z.string().describe("The ID of the telemetry destination")
3736
+ })).output(z.object({ success: z.literal(true) }));
3737
+ const listEnvironmentVariablesContractV1 = base.route({
897
3738
  path: "/v1/environments/{environmentId}/environment-variables",
898
3739
  method: "GET",
899
3740
  summary: "List environment variables",
@@ -901,37 +3742,31 @@ const listEnvironmentVariablesContractV1 = oc.route({
901
3742
  tags: ["environments"],
902
3743
  successDescription: "The list of environment variables"
903
3744
  }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(environmentVariableOutputSchema));
904
- const createEnvironmentVariablesContractV1 = oc.route({
3745
+ const createEnvironmentVariablesContractV1 = base.route({
905
3746
  path: "/v1/environments/{environmentId}/environment-variables",
906
3747
  method: "POST",
907
3748
  summary: "Add environment variables",
908
3749
  description: "Add one or more environment variables to an environment",
909
3750
  tags: ["environments"],
910
3751
  successDescription: "The environment variables have been added successfully"
911
- }).errors({
912
- NOT_FOUND: {},
913
- BAD_REQUEST: {}
914
- }).input(z.object({
3752
+ }).errors({ NOT_FOUND: {} }).input(z.object({
915
3753
  environmentId: z.string().describe("The ID of the environment"),
916
3754
  environmentVariables: environmentVariablesSchema
917
3755
  })).output(z.object({ success: z.literal(true) }));
918
- const updateEnvironmentVariableContractV1 = oc.route({
3756
+ const updateEnvironmentVariableContractV1 = base.route({
919
3757
  path: "/v1/environment-variables/{environmentVariableId}",
920
3758
  method: "PATCH",
921
3759
  summary: "Update an environment variable",
922
3760
  description: "Update an environment variable by ID",
923
3761
  tags: ["environments"],
924
3762
  successDescription: "The environment variable has been updated successfully"
925
- }).errors({
926
- NOT_FOUND: {},
927
- BAD_REQUEST: {}
928
- }).input(z.object({
3763
+ }).errors({ NOT_FOUND: {} }).input(z.object({
929
3764
  environmentVariableId: z.string().describe("The ID of the environment variable"),
930
3765
  key: environmentVariableSchema.shape.key,
931
3766
  value: environmentVariableSchema.shape.value.optional(),
932
3767
  isSecret: environmentVariableSchema.shape.isSecret.optional()
933
3768
  })).output(z.object({ success: z.literal(true) }));
934
- const deleteEnvironmentVariableContractV1 = oc.route({
3769
+ const deleteEnvironmentVariableContractV1 = base.route({
935
3770
  path: "/v1/environment-variables/{environmentVariableId}",
936
3771
  method: "DELETE",
937
3772
  summary: "Delete an environment variable",
@@ -939,7 +3774,7 @@ const deleteEnvironmentVariableContractV1 = oc.route({
939
3774
  tags: ["environments"],
940
3775
  successDescription: "The environment variable has been deleted successfully"
941
3776
  }).errors({ NOT_FOUND: {} }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
942
- const deleteProjectContractV1 = oc.route({
3777
+ const deleteProjectContractV1 = base.route({
943
3778
  path: "/v1/projects/{projectId}",
944
3779
  method: "DELETE",
945
3780
  summary: "Delete a project",
@@ -947,7 +3782,7 @@ const deleteProjectContractV1 = oc.route({
947
3782
  tags: ["projects"],
948
3783
  successDescription: "The project has been deleted successfully"
949
3784
  }).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(z.object({ success: z.literal(true) }));
950
- const updateProjectContractV1 = oc.route({
3785
+ const updateProjectContractV1 = base.route({
951
3786
  path: "/v1/projects/{projectId}",
952
3787
  method: "PATCH",
953
3788
  summary: "Update a project",
@@ -956,13 +3791,13 @@ const updateProjectContractV1 = oc.route({
956
3791
  successDescription: "The project has been updated successfully"
957
3792
  }).errors({
958
3793
  NOT_FOUND: {},
959
- BAD_REQUEST: {}
3794
+ FORBIDDEN: {}
960
3795
  }).input(z.object({
961
3796
  projectId: z.string().describe("The ID of the project"),
962
3797
  name: z.string().min(1).max(100).optional().describe("The new name for the project"),
963
3798
  sourceRepository: z.string().nullable().optional().describe("The source repository to connect to the project")
964
3799
  })).output(projectOutputSchema);
965
- const deployEnvironmentContractV1 = oc.route({
3800
+ const deployEnvironmentContractV1 = base.route({
966
3801
  path: "/v1/environments/{environmentId}/deploy",
967
3802
  method: "POST",
968
3803
  summary: "Deploy an environment",
@@ -971,24 +3806,25 @@ const deployEnvironmentContractV1 = oc.route({
971
3806
  successDescription: "The environment has been deployed successfully"
972
3807
  }).errors({
973
3808
  NOT_FOUND: {},
974
- BAD_REQUEST: {}
3809
+ CONFLICT: {}
975
3810
  }).input(z.object({
976
3811
  environmentId: z.string().describe("The ID of the environment to deploy"),
977
- token: z.string().describe("The token to identify the source archive").optional()
3812
+ token: z.string().describe("The token to identify the source archive").optional(),
3813
+ settings: buildSettingsSchema.extend({ transport: transportSchema }).optional().describe("Project settings detected by the client from the source. When provided, the server skips downloading and extracting the source archive to detect them.")
978
3814
  })).output(deploymentSchema);
979
- const uploadDeploymentArtifactContractV1 = oc.route({
3815
+ const uploadDeploymentArtifactContractV1 = base.route({
980
3816
  path: "/v1/deployments/upload",
981
3817
  method: "POST",
982
3818
  summary: "Upload deployment artifacts",
983
3819
  description: "Return a presigned S3 URL to upload a deployment artifact",
984
3820
  tags: ["deployments"],
985
3821
  successDescription: "The presigned upload URL has been generated successfully"
986
- }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
3822
+ }).errors({ NOT_FOUND: {} }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
987
3823
  uploadUrl: z.url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
988
3824
  token: z.string().describe("Token to identify the source archive"),
989
3825
  expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
990
3826
  }));
991
- const listDeploymentsContractV1 = oc.route({
3827
+ const listDeploymentsContractV1 = base.route({
992
3828
  path: "/v1/projects/{projectId}/deployments",
993
3829
  method: "GET",
994
3830
  summary: "List project deployments",
@@ -1000,7 +3836,7 @@ const listDeploymentsContractV1 = oc.route({
1000
3836
  status: z.array(deploymentStatusSchema).optional().describe("Filter by one or more statuses"),
1001
3837
  environmentId: z.string().optional().describe("Filter by environment ID")
1002
3838
  })).output(z.array(deploymentSchema));
1003
- const getDeploymentContractV1 = oc.route({
3839
+ const getDeploymentContractV1 = base.route({
1004
3840
  path: "/v1/deployments/{deploymentId}",
1005
3841
  method: "GET",
1006
3842
  summary: "Get a deployment",
@@ -1008,20 +3844,32 @@ const getDeploymentContractV1 = oc.route({
1008
3844
  tags: ["deployments"],
1009
3845
  successDescription: "The deployment details"
1010
3846
  }).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(deploymentSchema);
1011
- const getLogsContractV1 = oc.route({
3847
+ const logEntrySchema = z.object({
3848
+ timestamp: z.coerce.date(),
3849
+ type: z.enum([
3850
+ "START",
3851
+ "END",
3852
+ "INFO",
3853
+ "ERROR",
3854
+ "WARNING",
3855
+ "DEBUG"
3856
+ ]),
3857
+ requestId: z.string(),
3858
+ content: z.string().optional(),
3859
+ method: z.string().optional(),
3860
+ durationInMs: z.number().optional()
3861
+ });
3862
+ const getLogsContractV1 = base.route({
1012
3863
  path: "/v1/environments/{environmentId}/logs",
1013
3864
  method: "GET",
1014
3865
  summary: "Get logs",
1015
3866
  description: "Get logs for an environment",
1016
3867
  tags: ["environments"],
1017
3868
  successDescription: "The logs"
1018
- }).errors({
1019
- NOT_FOUND: {},
1020
- BAD_REQUEST: {}
1021
- }).input(z.object({
3869
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1022
3870
  environmentId: z.string().describe("The ID of the environment"),
1023
- since: z.string().refine(isValidLogTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." }).optional().describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
1024
- until: z.string().refine(isValidLogTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." }).optional().describe("End time — ISO 8601 or relative"),
3871
+ since: timeInputSchema.optional().describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
3872
+ until: timeInputSchema.optional().describe("End time — ISO 8601 or relative"),
1025
3873
  limit: z.coerce.number().int().min(1).max(1e3).default(1e3).describe("Maximum number of log entries to return."),
1026
3874
  level: z.array(z.enum([
1027
3875
  "INFO",
@@ -1029,37 +3877,20 @@ const getLogsContractV1 = oc.route({
1029
3877
  "WARNING",
1030
3878
  "DEBUG"
1031
3879
  ])).optional().describe("Filter by log level"),
1032
- search: z.string().optional().describe("Filter pattern to search for in log content"),
3880
+ search: logSearchSchema.optional().describe("Term to search for in log content"),
1033
3881
  nextToken: z.string().optional().describe("Pagination token from a previous response")
1034
3882
  })).output(z.object({
1035
- logs: z.array(z.object({
1036
- timestamp: z.coerce.date(),
1037
- type: z.enum([
1038
- "START",
1039
- "END",
1040
- "INFO",
1041
- "ERROR",
1042
- "WARNING",
1043
- "DEBUG"
1044
- ]),
1045
- requestId: z.string(),
1046
- content: z.string().optional(),
1047
- method: z.string().optional(),
1048
- durationInMs: z.number().optional()
1049
- })),
3883
+ logs: z.array(logEntrySchema),
1050
3884
  nextToken: z.string().nullable()
1051
3885
  }));
1052
- const getLatestLogsContractV1 = oc.route({
3886
+ const getLatestLogsContractV1 = base.route({
1053
3887
  path: "/v1/environments/{environmentId}/latest-logs",
1054
3888
  method: "GET",
1055
3889
  summary: "Get latest logs",
1056
3890
  description: "Get the N most recent logs for an environment",
1057
3891
  tags: ["environments"],
1058
3892
  successDescription: "The latest logs"
1059
- }).errors({
1060
- NOT_FOUND: {},
1061
- BAD_REQUEST: {}
1062
- }).input(z.object({
3893
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1063
3894
  environmentId: z.string().describe("The ID of the environment"),
1064
3895
  limit: z.coerce.number().int().min(1).max(1e3).default(100).describe("Number of most recent log entries to return"),
1065
3896
  level: z.array(z.enum([
@@ -1068,23 +3899,9 @@ const getLatestLogsContractV1 = oc.route({
1068
3899
  "WARNING",
1069
3900
  "DEBUG"
1070
3901
  ])).optional().describe("Filter by log level"),
1071
- search: z.string().optional().describe("Filter pattern to search for in log content")
1072
- })).output(z.object({ logs: z.array(z.object({
1073
- timestamp: z.coerce.date(),
1074
- type: z.enum([
1075
- "START",
1076
- "END",
1077
- "INFO",
1078
- "ERROR",
1079
- "WARNING",
1080
- "DEBUG"
1081
- ]),
1082
- requestId: z.string(),
1083
- content: z.string().optional(),
1084
- method: z.string().optional(),
1085
- durationInMs: z.number().optional()
1086
- })) }));
1087
- const getDeploymentLogsContractV1 = oc.route({
3902
+ search: logSearchSchema.optional().describe("Term to search for in log content")
3903
+ })).output(z.object({ logs: z.array(logEntrySchema) }));
3904
+ const getDeploymentLogsContractV1 = base.route({
1088
3905
  path: "/v1/deployments/{deploymentId}/logs",
1089
3906
  method: "GET",
1090
3907
  summary: "Get deployment logs",
@@ -1111,22 +3928,19 @@ const analyticsTimeSeriesSchema = z.object({
1111
3928
  output_token_mean: z.array(analyticsDataPointSchema),
1112
3929
  task_count: z.array(analyticsDataPointSchema)
1113
3930
  });
1114
- const getProjectAnalyticsContractV1 = oc.route({
3931
+ const getProjectAnalyticsContractV1 = base.route({
1115
3932
  path: "/v1/analytics/{projectId}",
1116
3933
  method: "GET",
1117
3934
  summary: "Get project analytics",
1118
3935
  description: "Get analytics data for a project over a time range",
1119
3936
  tags: ["analytics"],
1120
3937
  successDescription: "The project analytics data"
1121
- }).errors({
1122
- NOT_FOUND: {},
1123
- BAD_REQUEST: {}
1124
- }).input(z.object({
3938
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1125
3939
  projectId: z.string().describe("The ID of the project"),
1126
3940
  startTimestamp: z.coerce.number().describe("Start timestamp in milliseconds"),
1127
3941
  endTimestamp: z.coerce.number().describe("End timestamp in milliseconds"),
1128
3942
  timeZone: z.string().describe("IANA timezone (e.g. Europe/Paris)")
1129
- }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp > 0, { message: "End date must be after start date" }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp <= 744 * 60 * 60 * 1e3, { message: "Date range must be less than 1 month" }).refine(({ timeZone }) => Intl.supportedValuesOf("timeZone").includes(timeZone), { message: "Time zone must be a valid IANA timezone" })).output(z.object({
3943
+ }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp > 0, { message: "End date must be after start date" }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp <= 26784e5, { message: "Date range must be less than 1 month" }).refine(({ timeZone }) => isValidIanaTimeZone(timeZone), { message: "Time zone must be a valid IANA timezone" })).output(z.object({
1130
3944
  metadata: z.object({
1131
3945
  startTimestamp: z.number(),
1132
3946
  endTimestamp: z.number(),
@@ -1136,7 +3950,132 @@ const getProjectAnalyticsContractV1 = oc.route({
1136
3950
  }),
1137
3951
  timeSeries: analyticsTimeSeriesSchema
1138
3952
  }));
1139
- const listTeamsContractV1 = oc.route({
3953
+ const paginatedInsightsInputShape = {
3954
+ environmentId: z.string().describe("The ID of the environment"),
3955
+ since: timeInputSchema.default("7d").describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
3956
+ until: timeInputSchema.optional().describe("End time — ISO 8601 or relative"),
3957
+ limit: z.coerce.number().int().min(1).max(200).default(50),
3958
+ offset: z.coerce.number().int().min(0).default(0),
3959
+ search: z.string().trim().min(1).max(200).optional()
3960
+ };
3961
+ const listIntentsContractV1 = base.route({
3962
+ path: "/v1/environments/{environmentId}/intents",
3963
+ method: "GET",
3964
+ summary: "List intents",
3965
+ description: "List grouped user intents for an environment over a time range",
3966
+ tags: ["insights"],
3967
+ successDescription: "The grouped user intents"
3968
+ }).errors({ NOT_FOUND: {} }).input(z.object({
3969
+ ...paginatedInsightsInputShape,
3970
+ tools: z.array(z.string().trim().min(1)).min(1).max(100).optional(),
3971
+ clientIds: z.array(z.string().min(1)).min(1).max(100).optional(),
3972
+ categoryIds: z.array(z.string().trim().min(1)).min(1).max(100).optional(),
3973
+ sortDir: z.enum(["asc", "desc"]).default("desc")
3974
+ })).output(z.object({
3975
+ intents: z.array(z.object({
3976
+ id: z.string(),
3977
+ intentIds: z.array(z.string()).min(1),
3978
+ environmentId: z.string(),
3979
+ message: z.string(),
3980
+ toolName: z.string(),
3981
+ createdAt: z.coerce.date(),
3982
+ occurrenceCount: z.number().int().positive(),
3983
+ clientName: z.string().nullable(),
3984
+ clientId: z.string().nullable(),
3985
+ categories: z.array(z.object({
3986
+ id: z.string(),
3987
+ name: z.string(),
3988
+ color: intentCategoryColorSchema
3989
+ }))
3990
+ })),
3991
+ totalCount: z.number().int().nonnegative()
3992
+ }));
3993
+ const listFeedbacksContractV1 = base.route({
3994
+ path: "/v1/environments/{environmentId}/feedbacks",
3995
+ method: "GET",
3996
+ summary: "List feedbacks",
3997
+ description: "List user feedback for an environment over a time range",
3998
+ tags: ["insights"],
3999
+ successDescription: "The user feedback"
4000
+ }).errors({ NOT_FOUND: {} }).input(z.object({
4001
+ ...paginatedInsightsInputShape,
4002
+ clientIds: z.array(z.string().min(1)).min(1).max(100).optional()
4003
+ })).output(z.object({
4004
+ feedbacks: z.array(feedbackSchema.extend({ clientId: z.string().nullable() })),
4005
+ totalCount: z.number().int().nonnegative()
4006
+ }));
4007
+ const intentCategoryNameSchema = z.string().trim().min(1).max(100).describe("The category name");
4008
+ const categorizableIntentIdsSchema = z.array(z.string().trim().min(1)).min(1).max(100).describe("IDs of the intents to categorize");
4009
+ const listIntentCategoriesContractV1 = base.route({
4010
+ path: "/v1/environments/{environmentId}/intent-categories",
4011
+ method: "GET",
4012
+ summary: "List intent categories",
4013
+ description: "List intent categories for an environment, including how many intents each category is linked to",
4014
+ tags: ["insights"],
4015
+ successDescription: "The intent categories"
4016
+ }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(intentCategorySummarySchema));
4017
+ const createIntentCategoryContractV1 = base.route({
4018
+ path: "/v1/environments/{environmentId}/intent-categories",
4019
+ method: "POST",
4020
+ summary: "Create an intent category",
4021
+ description: "Create an intent category, optionally linking it to existing intents",
4022
+ tags: ["insights"],
4023
+ successDescription: "The created intent category"
4024
+ }).errors({ NOT_FOUND: {} }).input(z.object({
4025
+ environmentId: z.string().describe("The ID of the environment"),
4026
+ name: intentCategoryNameSchema,
4027
+ color: intentCategoryColorSchema.optional().describe("The category color; derived from the name when omitted"),
4028
+ intentIds: categorizableIntentIdsSchema.optional().describe("IDs of intents to link to the new category")
4029
+ })).output(intentCategorySchema);
4030
+ const updateIntentCategoryContractV1 = base.route({
4031
+ path: "/v1/environments/{environmentId}/intent-categories/{categoryId}",
4032
+ method: "PATCH",
4033
+ summary: "Update an intent category",
4034
+ description: "Rename or recolor an intent category",
4035
+ tags: ["insights"],
4036
+ successDescription: "The updated intent category"
4037
+ }).errors({ NOT_FOUND: {} }).input(z.object({
4038
+ environmentId: z.string().describe("The ID of the environment"),
4039
+ categoryId: z.string().describe("The ID of the category"),
4040
+ name: intentCategoryNameSchema.optional(),
4041
+ color: intentCategoryColorSchema.optional().describe("The category color")
4042
+ }).refine(({ name, color }) => name !== void 0 || color !== void 0, { message: "At least one of name or color must be provided" })).output(intentCategorySchema);
4043
+ const deleteIntentCategoryContractV1 = base.route({
4044
+ path: "/v1/environments/{environmentId}/intent-categories/{categoryId}",
4045
+ method: "DELETE",
4046
+ summary: "Delete an intent category",
4047
+ description: "Delete an intent category; its intents are unlinked but not deleted",
4048
+ tags: ["insights"],
4049
+ successDescription: "The intent category has been deleted successfully"
4050
+ }).errors({ NOT_FOUND: {} }).input(z.object({
4051
+ environmentId: z.string().describe("The ID of the environment"),
4052
+ categoryId: z.string().describe("The ID of the category")
4053
+ })).output(z.object({ success: z.literal(true) }));
4054
+ const linkIntentCategoryContractV1 = base.route({
4055
+ path: "/v1/environments/{environmentId}/intent-categories/{categoryId}/link",
4056
+ method: "POST",
4057
+ summary: "Link an intent category",
4058
+ description: "Link an intent category to intents; already linked intents are ignored",
4059
+ tags: ["insights"],
4060
+ successDescription: "The intents have been linked successfully"
4061
+ }).errors({ NOT_FOUND: {} }).input(z.object({
4062
+ environmentId: z.string().describe("The ID of the environment"),
4063
+ categoryId: z.string().describe("The ID of the category"),
4064
+ intentIds: categorizableIntentIdsSchema
4065
+ })).output(z.object({ success: z.literal(true) }));
4066
+ const unlinkIntentCategoryContractV1 = base.route({
4067
+ path: "/v1/environments/{environmentId}/intent-categories/{categoryId}/unlink",
4068
+ method: "POST",
4069
+ summary: "Unlink an intent category",
4070
+ description: "Unlink an intent category from intents; intents without the category are ignored",
4071
+ tags: ["insights"],
4072
+ successDescription: "The intents have been unlinked successfully"
4073
+ }).errors({ NOT_FOUND: {} }).input(z.object({
4074
+ environmentId: z.string().describe("The ID of the environment"),
4075
+ categoryId: z.string().describe("The ID of the category"),
4076
+ intentIds: categorizableIntentIdsSchema
4077
+ })).output(z.object({ success: z.literal(true) }));
4078
+ const listTeamsContractV1 = base.route({
1140
4079
  path: "/v1/teams",
1141
4080
  method: "GET",
1142
4081
  summary: "List teams",
@@ -1149,28 +4088,40 @@ const listTeamsContractV1 = oc.route({
1149
4088
  createdAt: z.coerce.date(),
1150
4089
  hasStripeAccount: z.boolean()
1151
4090
  })));
1152
- const getTunnelTicketContractV1 = oc.route({
4091
+ const getTeamUsageContractV1 = base.route({
4092
+ path: "/v1/teams/{teamId}/usage",
4093
+ method: "GET",
4094
+ summary: "Get team usage",
4095
+ description: "Get the MCP request usage of a team for its current billing window. A team that has made no request in the window reports zero.",
4096
+ tags: ["teams"],
4097
+ successDescription: "The current billing window usage"
4098
+ }).errors({ NOT_FOUND: {} }).input(z.object({ teamId: z.string().describe("The ID of the team") })).output(z.object({
4099
+ teamId: z.string(),
4100
+ plan: subscriptionPlanSchema.nullable().describe("The plan in force for the window, null on the Free plan"),
4101
+ periodStart: z.coerce.date().describe("Start of the current billing window"),
4102
+ periodEnd: z.coerce.date().describe("End of the current billing window"),
4103
+ requestCount: z.number().int().describe("MCP requests settled during the current billing window"),
4104
+ includedRequests: z.number().int().nullable().describe("Requests included in the plan for one window, null when the allowance is contract-specific")
4105
+ }));
4106
+ const getTunnelTicketContractV1 = base.route({
1153
4107
  path: "/v1/tunnels/ticket",
1154
4108
  method: "GET",
1155
4109
  summary: "Get a tunnel ticket",
1156
4110
  description: "Get a signed ticket for establishing a tunnel connection. Requires user authentication (API keys are not supported).",
1157
4111
  tags: ["tunnels"],
1158
4112
  successDescription: "The tunnel ticket"
1159
- }).output(z.object({
4113
+ }).meta({ authScope: AUTH_SCOPE_USER }).errors({ FORBIDDEN: {} }).output(z.object({
1160
4114
  subdomain: z.string().describe("The subdomain assigned to the user"),
1161
4115
  ticket: z.string().describe("The signed tunnel ticket"),
1162
4116
  tunnelHost: z.string().describe("The tunnel host to connect to")
1163
4117
  }));
1164
- const publishServerContractV1 = oc.route({
4118
+ const publishServerContractV1 = base.route({
1165
4119
  path: "/v1/distribution/publish",
1166
4120
  method: "POST",
1167
4121
  summary: "Publish a server to the MCP registry",
1168
4122
  tags: ["distribution"],
1169
4123
  successDescription: "The server has been published successfully"
1170
- }).errors({
1171
- NOT_FOUND: {},
1172
- BAD_REQUEST: {}
1173
- }).input(z.object({
4124
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1174
4125
  projectId: z.string(),
1175
4126
  domain: z.string(),
1176
4127
  title: z.string().min(1).max(100),
@@ -1179,17 +4130,14 @@ const publishServerContractV1 = oc.route({
1179
4130
  iconSrc: z.url().max(255).optional(),
1180
4131
  dryRun: z.boolean().optional()
1181
4132
  })).output(z.object({ serverFields: serverFieldsSchema }));
1182
- const getServerInfoContractV1 = oc.route({
4133
+ const getServerInfoContractV1 = base.route({
1183
4134
  path: "/v1/distribution/get",
1184
4135
  method: "GET",
1185
4136
  summary: "Get server info",
1186
4137
  description: "Get info about a server",
1187
4138
  tags: ["distribution"],
1188
4139
  successDescription: "The server info"
1189
- }).errors({
1190
- NOT_FOUND: {},
1191
- BAD_REQUEST: {}
1192
- }).input(z.object({
4140
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1193
4141
  projectId: z.string(),
1194
4142
  domain: z.string()
1195
4143
  })).output(z.object({ serverFields: serverFieldsSchema }));
@@ -1208,7 +4156,7 @@ const playgroundOutputSchema = z.object({
1208
4156
  isPlaygroundEnabled: z.boolean(),
1209
4157
  serverMetadata: playgroundServerMetadataOutputSchema.nullable()
1210
4158
  });
1211
- const getPlaygroundContractV1 = oc.route({
4159
+ const getPlaygroundContractV1 = base.route({
1212
4160
  path: "/v1/environments/{environmentId}/playground",
1213
4161
  method: "GET",
1214
4162
  summary: "Get playground configuration",
@@ -1216,25 +4164,22 @@ const getPlaygroundContractV1 = oc.route({
1216
4164
  tags: ["environments"],
1217
4165
  successDescription: "The playground configuration"
1218
4166
  }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(playgroundOutputSchema);
1219
- const upsertPlaygroundContractV1 = oc.route({
4167
+ const upsertPlaygroundContractV1 = base.route({
1220
4168
  path: "/v1/environments/{environmentId}/playground",
1221
4169
  method: "PUT",
1222
4170
  summary: "Update playground configuration",
1223
4171
  description: "Update the playground configuration for an environment. All fields are optional — only provided fields are updated.",
1224
4172
  tags: ["environments"],
1225
4173
  successDescription: "The updated playground configuration"
1226
- }).errors({
1227
- NOT_FOUND: {},
1228
- BAD_REQUEST: {}
1229
- }).input(z.object({
4174
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1230
4175
  environmentId: z.string().describe("The ID of the environment"),
1231
4176
  isPlaygroundEnabled: z.boolean().optional(),
1232
4177
  name: z.string().min(1).max(100).optional(),
1233
4178
  description: z.string().min(1).max(500).optional(),
1234
4179
  headers: z.array(playgroundHeaderSchema).optional(),
1235
- examplePrompts: z.array(playgroundExamplePromptSchema).max(3).optional()
4180
+ examplePrompts: z.array(playgroundExamplePromptSchema).max(5).optional()
1236
4181
  })).output(playgroundOutputSchema);
1237
- const createBeaconContractV1 = oc.route({
4182
+ const createBeaconContractV1 = base.route({
1238
4183
  path: "/v1/beacon/audits",
1239
4184
  method: "POST",
1240
4185
  summary: "Create a beacon audit",
@@ -1243,7 +4188,6 @@ const createBeaconContractV1 = oc.route({
1243
4188
  successDescription: "The audit has been created"
1244
4189
  }).errors({
1245
4190
  NOT_FOUND: {},
1246
- BAD_REQUEST: {},
1247
4191
  DNS_RESOLUTION_FAILED: { status: 400 }
1248
4192
  }).input(z.object({
1249
4193
  targetUrl: z.url().describe("The HTTPS URL of the MCP server to audit"),
@@ -1251,7 +4195,7 @@ const createBeaconContractV1 = oc.route({
1251
4195
  projectId: z.string().optional().describe("The project ID to associate the audit with"),
1252
4196
  excludeCategories: z.array(checkCategorySchema).optional().describe("Check categories to exclude from the audit")
1253
4197
  })).output(z.object({ id: z.string() }));
1254
- const getBeaconContractV1 = oc.route({
4198
+ const getBeaconContractV1 = base.route({
1255
4199
  path: "/v1/beacon/audits/{auditId}",
1256
4200
  method: "GET",
1257
4201
  summary: "Get a beacon audit",
@@ -1266,9 +4210,73 @@ const getBeaconContractV1 = oc.route({
1266
4210
  createdAt: z.coerce.date(),
1267
4211
  report: auditReportWithScreenshotsSchema.nullable()
1268
4212
  }));
4213
+ const PLATFORM_DESCRIPTION = "The directory the package targets: `chatgpt` for the OpenAI App Directory, `claudeai` for the Anthropic MCP Directory";
4214
+ const submissionIdSchema = z.string().describe("The ID of the submission package");
4215
+ const claudeSubmissionUpdateSchema = claudeSubmissionDraftSchema.strict();
4216
+ const chatgptSubmissionUpdateSchema = chatgptSubmissionDraftSchema.strict();
4217
+ const createSubmissionContractV1 = base.route({
4218
+ path: "/v1/submissions",
4219
+ method: "POST",
4220
+ summary: "Create a submission package",
4221
+ description: "Create a submission package for an environment. Alpic reads the environment's live MCP server and prefills every field it can infer, so the response already carries the populated package. The environment must have a successful deployment and must not require authentication.",
4222
+ tags: ["submissions"],
4223
+ successDescription: "The created submission package, with its prefilled fields"
4224
+ }).errors({ NOT_FOUND: {} }).input(z.object({
4225
+ environmentId: z.string().describe("The ID of the environment to build the package from"),
4226
+ platform: platformSchema.describe(PLATFORM_DESCRIPTION)
4227
+ })).output(submissionSchema);
4228
+ const listSubmissionsContractV1 = base.route({
4229
+ path: "/v1/projects/{projectId}/submissions",
4230
+ method: "GET",
4231
+ summary: "List submission packages",
4232
+ description: "List the submission packages of a project, grouped by directory and most recently updated first, optionally narrowed to one environment or one directory",
4233
+ tags: ["submissions"],
4234
+ successDescription: "The list of submission packages"
4235
+ }).errors({ NOT_FOUND: {} }).input(z.object({
4236
+ projectId: z.string().describe("The ID of the project"),
4237
+ environmentId: z.string().optional().describe("Filter by environment ID"),
4238
+ platform: platformSchema.optional().describe(PLATFORM_DESCRIPTION)
4239
+ })).output(z.array(submissionSchema));
4240
+ const getSubmissionContractV1 = base.route({
4241
+ path: "/v1/submissions/{submissionId}",
4242
+ method: "GET",
4243
+ summary: "Get a submission package",
4244
+ description: "Get a submission package by ID, including its form data and the prefill it started from",
4245
+ tags: ["submissions"],
4246
+ successDescription: "The submission package"
4247
+ }).errors({ NOT_FOUND: {} }).input(z.object({ submissionId: submissionIdSchema })).output(submissionSchema);
4248
+ const updateSubmissionContractV1 = base.route({
4249
+ path: "/v1/submissions/{submissionId}",
4250
+ method: "PUT",
4251
+ summary: "Update a submission package",
4252
+ description: "Update the form data of a submission package. Only the fields you send are changed; the rest are left as they are. Unknown field names are rejected rather than ignored, so a typo fails the call. `platform` must match the package's own platform.",
4253
+ tags: ["submissions"],
4254
+ successDescription: "The updated submission package"
4255
+ }).errors({ NOT_FOUND: {} }).input(z.discriminatedUnion("platform", [z.object({
4256
+ submissionId: submissionIdSchema,
4257
+ platform: z.literal("claudeai").describe(PLATFORM_DESCRIPTION),
4258
+ formData: claudeSubmissionUpdateSchema
4259
+ }), z.object({
4260
+ submissionId: submissionIdSchema,
4261
+ platform: z.literal("chatgpt").describe(PLATFORM_DESCRIPTION),
4262
+ formData: chatgptSubmissionUpdateSchema
4263
+ })])).output(submissionSchema);
1269
4264
  const contract = {
1270
- teams: { list: { v1: listTeamsContractV1 } },
4265
+ teams: {
4266
+ list: { v1: listTeamsContractV1 },
4267
+ getUsage: { v1: getTeamUsageContractV1 }
4268
+ },
1271
4269
  analytics: { get: { v1: getProjectAnalyticsContractV1 } },
4270
+ intents: { list: { v1: listIntentsContractV1 } },
4271
+ intentCategories: {
4272
+ list: { v1: listIntentCategoriesContractV1 },
4273
+ create: { v1: createIntentCategoryContractV1 },
4274
+ update: { v1: updateIntentCategoryContractV1 },
4275
+ delete: { v1: deleteIntentCategoryContractV1 },
4276
+ link: { v1: linkIntentCategoryContractV1 },
4277
+ unlink: { v1: unlinkIntentCategoryContractV1 }
4278
+ },
4279
+ feedbacks: { list: { v1: listFeedbacksContractV1 } },
1272
4280
  deployments: {
1273
4281
  list: { v1: listDeploymentsContractV1 },
1274
4282
  get: { v1: getDeploymentContractV1 },
@@ -1278,6 +4286,7 @@ const contract = {
1278
4286
  environments: {
1279
4287
  create: { v1: createEnvironmentContractV1 },
1280
4288
  get: { v1: getEnvironmentContractV1 },
4289
+ delete: { v1: deleteEnvironmentContractV1 },
1281
4290
  deploy: { v1: deployEnvironmentContractV1 },
1282
4291
  getLogs: { v1: getLogsContractV1 },
1283
4292
  getLatestLogs: { v1: getLatestLogsContractV1 }
@@ -1288,6 +4297,12 @@ const contract = {
1288
4297
  update: { v1: updateEnvironmentVariableContractV1 },
1289
4298
  delete: { v1: deleteEnvironmentVariableContractV1 }
1290
4299
  },
4300
+ telemetryDestinations: {
4301
+ list: { v1: listTelemetryDestinationsContractV1 },
4302
+ create: { v1: createTelemetryDestinationContractV1 },
4303
+ update: { v1: updateTelemetryDestinationContractV1 },
4304
+ delete: { v1: deleteTelemetryDestinationContractV1 }
4305
+ },
1291
4306
  projects: {
1292
4307
  update: { v1: updateProjectContractV1 },
1293
4308
  get: { v1: getProjectContractV1 },
@@ -1307,7 +4322,38 @@ const contract = {
1307
4322
  beacon: {
1308
4323
  create: { v1: createBeaconContractV1 },
1309
4324
  get: { v1: getBeaconContractV1 }
4325
+ },
4326
+ submissions: {
4327
+ create: { v1: createSubmissionContractV1 },
4328
+ list: { v1: listSubmissionsContractV1 },
4329
+ get: { v1: getSubmissionContractV1 },
4330
+ update: { v1: updateSubmissionContractV1 }
4331
+ }
4332
+ };
4333
+ const { uploadArtifact: _discard, ...deploymentsForDocs } = contract.deployments;
4334
+ const contractForDocs = {
4335
+ ...contract,
4336
+ deployments: deploymentsForDocs
4337
+ };
4338
+ /** Shared by the served `openapi.json` and the snapshot test that guards it, so the two cannot drift. */
4339
+ const OPENAPI_DOC_OPTIONS = {
4340
+ info: {
4341
+ title: "Alpic API",
4342
+ version: "1.0.0"
4343
+ },
4344
+ servers: [{ url: "https://api.alpic.ai" }],
4345
+ security: [{ bearerAuth: [] }],
4346
+ components: { securitySchemes: { bearerAuth: {
4347
+ type: "http",
4348
+ description: "Bearer token for authentication. Use an API key from the API Keys page in team settings, or an OAuth access token.",
4349
+ scheme: "bearer"
4350
+ } } },
4351
+ commonSchemas: {
4352
+ Submission: { schema: submissionSchema },
4353
+ ClaudeSubmissionFormData: { schema: claudeSubmissionDraftSchema },
4354
+ ChatgptSubmissionFormData: { schema: chatgptSubmissionDraftSchema },
4355
+ ClaudeSubmissionFormDataUpdate: { schema: claudeSubmissionUpdateSchema },
4356
+ ChatgptSubmissionFormDataUpdate: { schema: chatgptSubmissionUpdateSchema }
1310
4357
  }
1311
4358
  };
1312
- //#endregion
1313
- export { PLATFORM_LABELS, buildSettingsSchema, contract, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema, updateEnvironmentVariableSchema };
4359
+ export { AI_PLATFORMS, AUTH_SCOPE_ANY, AUTH_SCOPE_USER, INTENT_CATEGORY_COLORS, OPENAPI_DOC_OPTIONS, OTLP_PROTOCOLS, PLATFORM_LABELS, TELEMETRY_SIGNALS, buildSettingsSchema, chatgptSubmissionUpdateSchema, claudeSubmissionUpdateSchema, contract, contractForDocs, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, intentCategoryColorSchema, otlpProtocolSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, telemetrySignalSchema, transportSchema, updateEnvironmentVariableSchema };