@alpic-ai/api 0.0.0-staging.g7d77675 → 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 +5863 -172
  2. package/dist/index.mjs +2630 -199
  3. package/package.json +9 -9
package/dist/index.mjs CHANGED
@@ -2,7 +2,9 @@ import { z } from "zod";
2
2
  import * as z$1 from "zod/v4";
3
3
  import { oc } from "@orpc/contract";
4
4
  import ms from "ms";
5
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_supports-color@7.2.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
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
6
8
  /**
7
9
  * Reusable URL validation that disallows javascript: scheme
8
10
  */
@@ -119,7 +121,12 @@ z$1.object({
119
121
  token_type: z$1.string(),
120
122
  expires_in: z$1.coerce.number().optional(),
121
123
  scope: z$1.string().optional(),
122
- refresh_token: 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)
123
130
  }).strip();
124
131
  z$1.object({
125
132
  error: z$1.string(),
@@ -158,7 +165,12 @@ const OAuthClientInformationSchema = z$1.object({
158
165
  client_id: z$1.string(),
159
166
  client_secret: z$1.string().optional(),
160
167
  client_id_issued_at: z$1.number().optional(),
161
- client_secret_expires_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)
162
174
  }).strip();
163
175
  OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);
164
176
  z$1.object({
@@ -169,8 +181,1722 @@ z$1.object({
169
181
  token: z$1.string(),
170
182
  token_type_hint: z$1.string().optional()
171
183
  }).strip();
172
- //#endregion
173
- //#region ../domains/dist/index.mjs
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
+ })))();
174
1900
  const AI_PLATFORMS = ["chatgpt", "claudeai"];
175
1901
  const platformSchema = z.enum(AI_PLATFORMS);
176
1902
  const PLATFORM_LABELS = {
@@ -179,10 +1905,15 @@ const PLATFORM_LABELS = {
179
1905
  };
180
1906
  const WAF_PLATFORMS = [
181
1907
  "akamai",
1908
+ "cato",
182
1909
  "cloudflare",
183
1910
  "fastly"
184
1911
  ];
185
- const ALLOWED_PLATFORMS = [...AI_PLATFORMS, ...WAF_PLATFORMS];
1912
+ const ALLOWED_PLATFORMS = [...[
1913
+ ...AI_PLATFORMS,
1914
+ "meta",
1915
+ "google"
1916
+ ], ...WAF_PLATFORMS];
186
1917
  const allowedPlatformSchema = z.enum(ALLOWED_PLATFORMS);
187
1918
  const auditStatusSchema = z.enum([
188
1919
  "pending",
@@ -256,6 +1987,25 @@ z.object({
256
1987
  clientSecret: z.string(),
257
1988
  clientScopes: z.array(z.string())
258
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
+ });
259
2009
  const deploymentStatusSchema$1 = z.enum([
260
2010
  "ongoing",
261
2011
  "deployed",
@@ -283,33 +2033,18 @@ const deploymentSummarySchema = z.object({
283
2033
  createdAt: z.coerce.date(),
284
2034
  updatedAt: z.coerce.date()
285
2035
  });
286
- /**
287
- * Public environment
288
- *
289
- * Answers anonymously and exposes no OAuth metadata.
290
- */
2036
+ /** Public environment: answers anonymously and exposes no OAuth metadata. */
291
2037
  const publicEnvironmentSchema = z.object({
292
2038
  allowsAnonymous: z.literal(true),
293
2039
  oAuthMetadata: z.strictObject({})
294
2040
  });
295
- /**
296
- * Protected environment with an external resource metadata URL
297
- *
298
- * An external resource metadata URL is returned in the WWW-Authenticate header during the first 401 response.
299
- * Everything that follows is handled outside of the MCP server scope.
300
- */
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. */
301
2042
  const externalResourceMetadataEnvironmentSchema = z.object({
302
2043
  allowsAnonymous: z.boolean(),
303
2044
  oAuthMetadata: z.object({ externalResourceMetadataUrl: z.url() }),
304
2045
  scope: z.string().optional()
305
2046
  });
306
- /**
307
- * Protected environment with an external authorization server URL
308
- *
309
- * The server itself exposes the /.well-known/oauth-protected-resource endpoint.
310
- * An external authorization server URL is returned when requesting the endpoint.
311
- * Everything that follows is handled outside of the MCP server scope.
312
- */
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. */
313
2048
  const externalAuthorizationServerEnvironmentSchema = z.object({
314
2049
  allowsAnonymous: z.boolean(),
315
2050
  oAuthMetadata: z.object({
@@ -318,12 +2053,7 @@ const externalAuthorizationServerEnvironmentSchema = z.object({
318
2053
  }),
319
2054
  scope: z.string().optional()
320
2055
  });
321
- /**
322
- * Standalone protected environment
323
- *
324
- * The server itself exposes the /.well-known/oauth-protected-resource endpoint.
325
- * The server itself exposes the /.well-known/oauth-authorization-server endpoint.
326
- */
2056
+ /** Standalone protected environment: the server itself exposes both the /.well-known/oauth-protected-resource and /.well-known/oauth-authorization-server endpoints. */
327
2057
  const standaloneEnvironmentSchema = z.object({
328
2058
  allowsAnonymous: z.boolean(),
329
2059
  oAuthMetadata: z.object({
@@ -332,17 +2062,12 @@ const standaloneEnvironmentSchema = z.object({
332
2062
  }),
333
2063
  scope: z.string().optional()
334
2064
  });
335
- /**
336
- * Protected environment without OAuth discovery
337
- *
338
- * The server enforces authentication but exposes no OAuth discovery metadata.
339
- * Neither /.well-known/oauth-protected-resource nor /.well-known/oauth-authorization-server
340
- * are advertised. Clients must obtain credentials out-of-band.
341
- */
2065
+ /** Protected environment that enforces authentication but advertises no OAuth discovery metadata; clients must obtain credentials out-of-band. */
342
2066
  const protectedWithoutDiscoveryEnvironmentSchema = z.object({
343
2067
  allowsAnonymous: z.literal(false),
344
2068
  oAuthMetadata: z.strictObject({}),
345
- scope: z.string().optional()
2069
+ scope: z.string().optional(),
2070
+ wwwAuthenticate: z.string().optional()
346
2071
  });
347
2072
  const legacyPublicEnvironmentSchema = z.object({
348
2073
  isPublic: z.literal(true),
@@ -387,10 +2112,13 @@ z.union([
387
2112
  legacyProtectedWithoutDiscoveryEnvironmentSchema
388
2113
  ]);
389
2114
  const playgroundModelSchema = z.enum([
2115
+ "global.anthropic.claude-haiku-5-5",
390
2116
  "global.anthropic.claude-haiku-4-5-20251001-v1:0",
391
- "global.anthropic.claude-sonnet-4-5-20250929-v1:0",
2117
+ "global.anthropic.claude-sonnet-5-5",
392
2118
  "openai.gpt-5.4",
393
- "openai.gpt-5.5"
2119
+ "openai.gpt-5.5",
2120
+ "openai.gpt-6-luna",
2121
+ "openai.gpt-6.1-sol"
394
2122
  ]);
395
2123
  const environmentDomainSchema = z.object({
396
2124
  name: z.string(),
@@ -426,14 +2154,16 @@ z.object({
426
2154
  collectResponsePayload: z.boolean(),
427
2155
  collectErrorMessage: z.boolean(),
428
2156
  collectUserData: z.boolean(),
429
- identityTraitKey: z.string().min(1).max(200).nullable()
2157
+ identityTraitKey: z.string().min(1).max(200).nullable(),
2158
+ leadEventName: z.string().min(1).max(200).nullable()
430
2159
  });
431
- z.object({
2160
+ const feedbackSchema = z.object({
432
2161
  id: z.string(),
433
2162
  createdAt: z.coerce.date(),
434
2163
  environmentId: z.string(),
435
2164
  content: z.string(),
436
- source: z.enum(["model", "user"])
2165
+ source: z.enum(["model", "user"]),
2166
+ clientName: z.string().nullable()
437
2167
  });
438
2168
  z.object({
439
2169
  content: z.string(),
@@ -449,7 +2179,7 @@ const intentCategoryColorSchema = z.enum([
449
2179
  "pink",
450
2180
  "gray"
451
2181
  ]);
452
- intentCategoryColorSchema.options;
2182
+ const INTENT_CATEGORY_COLORS = intentCategoryColorSchema.options;
453
2183
  const intentCategorySchema = z.object({
454
2184
  id: z.string(),
455
2185
  createdAt: z.coerce.date(),
@@ -457,7 +2187,7 @@ const intentCategorySchema = z.object({
457
2187
  name: z.string(),
458
2188
  color: intentCategoryColorSchema
459
2189
  });
460
- z.object({
2190
+ const intentCategorySummarySchema = z.object({
461
2191
  id: z.string(),
462
2192
  name: z.string(),
463
2193
  color: intentCategoryColorSchema,
@@ -469,6 +2199,7 @@ z.object({
469
2199
  environmentId: z.string(),
470
2200
  toolName: z.string(),
471
2201
  message: z.string(),
2202
+ clientName: z.string().nullable(),
472
2203
  categories: z.array(intentCategorySchema)
473
2204
  });
474
2205
  const signalCategorySchema = z.object({
@@ -527,17 +2258,277 @@ z.object({
527
2258
  createdAt: z.coerce.date(),
528
2259
  updatedAt: z.coerce.date()
529
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]);
530
2271
  z.enum([
531
2272
  "INFO",
532
2273
  "WARNING",
533
2274
  "DEBUG",
534
2275
  "ERROR"
535
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]));
536
2525
  const runtimeSchema = z.enum([
537
2526
  "python3.13",
538
2527
  "python3.14",
2528
+ "python3.15",
539
2529
  "node22",
540
- "node24"
2530
+ "node24",
2531
+ "node26"
541
2532
  ]);
542
2533
  const transportSchema = z.enum([
543
2534
  "stdio",
@@ -610,15 +2601,7 @@ z.object({
610
2601
  serverFields: serverFieldsSchema$1,
611
2602
  source: z.enum(["registry", "defaults"])
612
2603
  });
613
- /**
614
- * Returns a variant of a `maxLength`-constrained string that clamps (truncates) instead of
615
- * rejecting on overflow — used for AI-generated copy where the model routinely overshoots.
616
- *
617
- * NOTE: this rebuilds the schema from scratch, carrying over only `maxLength` (as a clamp),
618
- * `minLength`, and the description. Any other validators on the source field (`.regex()`,
619
- * `.email()`, custom refinements) are intentionally dropped — this helper is meant for plain
620
- * free-text length caps only. A field with `null` `maxLength` is returned unchanged.
621
- */
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. */
622
2605
  const clampStringField = (field) => {
623
2606
  const max = field.maxLength;
624
2607
  if (max === null) return field;
@@ -626,6 +2609,10 @@ const clampStringField = (field) => {
626
2609
  const withMin = field.minLength === null ? clamped : clamped.min(field.minLength);
627
2610
  return field.description ? withMin.describe(field.description) : withMin;
628
2611
  };
2612
+ const unboundedArrayField = (field) => {
2613
+ const unbounded = z.array(field.element);
2614
+ return field.description ? unbounded.describe(field.description) : unbounded;
2615
+ };
629
2616
  const toolDefinitionSchema = z.object({
630
2617
  name: z.string(),
631
2618
  title: z.string().optional().describe("Human-friendly name for the tool, used in the UI. If not provided, `name` will be used."),
@@ -638,11 +2625,22 @@ const toolDefinitionSchema = z.object({
638
2625
  }).optional()
639
2626
  });
640
2627
  const positiveTestCaseSchema = z.object({
641
- scenario: z.string().describe("Short label for what this case demonstrates."),
642
- userPrompt: z.string().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."),
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."),
643
2630
  toolTriggered: z.string().optional().describe("The tool this prompt should invoke."),
644
2631
  expectedOutput: z.string().optional().describe("What the user should see, including post-interaction behaviour where relevant.")
645
- }).partial().describe("Each case: Scenario, User prompt, Tool triggered, Expected output.");
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());
646
2644
  const screenshotEntrySchema = z.object({
647
2645
  prompt: z.string(),
648
2646
  url: z.url()
@@ -955,20 +2953,25 @@ const chatgptTranslationLocaleSchema = z.enum([
955
2953
  "zh-TW"
956
2954
  ]);
957
2955
  const negativeTestCaseSchema = z.object({
958
- scenario: z.string(),
959
- userPrompt: z.string()
960
- }).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.");
961
2968
  const chatgptToolJustificationSchema = z.object({
962
2969
  toolName: z.string(),
963
2970
  readOnlyJustification: z.string().describe("One sentence on what the tool reads and returns."),
964
2971
  openWorldJustification: z.string().describe("One sentence on whether the tool reaches external systems beyond your own service."),
965
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.\"")
966
2973
  }).describe("Per-tool justification of each MCP annotation value (one specific sentence per hint).");
967
- /**
968
- * Base copy fields, defined once and reused by both the submission form and per-locale
969
- * translations so the constraints (tagline ≤ 30 chars) never drift. The translation generation
970
- * path wraps these in {@link clampStringField} since the LLM tends to overshoot the limit.
971
- */
2974
+ /** Defined once and reused by both the submission form and per-locale translations so the tagline ≤ 30 chars constraint never drifts. */
972
2975
  const chatgptTaglineSchema = z.string().max(30);
973
2976
  const chatgptDescriptionSchema = z.string();
974
2977
  const chatgptTranslationSchema = z.object({
@@ -977,34 +2980,32 @@ const chatgptTranslationSchema = z.object({
977
2980
  description: chatgptDescriptionSchema
978
2981
  }).describe("Locale-scoped override for tagline + description. English (US) is the default.");
979
2982
  chatgptTranslationSchema.extend({ tagline: clampStringField(chatgptTaglineSchema) });
980
- /**
981
- * Field order mirrors the ChatGPT (OpenAI) submission spreadsheet, grouped by section.
982
- * When adding/removing/reordering fields, keep this in sync with the sheet.
983
- */
2983
+ /** Field order mirrors the ChatGPT (OpenAI) submission spreadsheet, grouped by section; keep it in sync with the sheet. */
984
2984
  const chatgptSubmissionFormDataSchema = z.object({
985
2985
  logoLight: z.string().describe("Logo icon for light mode. Square PNG, no borders or rounded corners (clients apply circular cropping)."),
986
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."),
987
- appName: z.string().describe("The name users will see in ChatGPT and in the Apps Directory."),
2987
+ appName: z.string().describe("The name users will see in ChatGPT and in the Plugin Directory."),
988
2988
  tagline: chatgptTaglineSchema.describe("Plain-language phrase focused on function and user value, 30 chars max. Avoid generic superlatives like \"the best …\"."),
989
- description: chatgptDescriptionSchema.describe("Clear, engaging description highlighting what the app does and why people will love it. Appears publicly on the directory page. End it by naming the product categories or intents the app 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)."),
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)."),
990
2990
  category: chatgptCategorySchema.describe("Category from the OpenAI taxonomy."),
991
- developerName: z.string().describe("Developer name shown publicly on the app's directory page."),
2991
+ developerName: z.string().describe("Developer name shown publicly on the plugin's directory page."),
992
2992
  companyUrl: urlField.describe("Your company's main website URL."),
993
2993
  supportChannel: supportChannelSchema.describe("Customer support URL or email address."),
994
2994
  privacyPolicyUrl: urlField.describe("URL to your privacy policy."),
995
- termsOfServiceUrl: urlField.describe("URL to the app's terms of service."),
996
- demoRecordingUrl: urlField.describe("URL to a video demonstrating the app, recorded via OpenAI Developer Mode. Cover all main use cases on web, iOS, and Android."),
997
- 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."),
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."),
998
2998
  serverUrl: urlField.describe("URL of the MCP server."),
999
2999
  authentication: chatgptAuthenticationSchema.describe("OAuth 2.0 or No auth. OAuth configuration is auto-discovered from the MCP server's metadata."),
1000
3000
  tools: z.array(toolDefinitionSchema).describe("List of tools exposed by the MCP server (auto-populated from the production server's manifest)."),
1001
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."),
1002
- testCases: z.array(positiveTestCaseSchema).describe("At least 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."),
1003
- negativeTestCases: z.array(negativeTestCaseSchema).describe("3 negative test cases: prompts where the app 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 app does not carry, the right brand or domain but an intent the app does not serve, or a boundary with a sibling app."),
1004
- screenshots: z.array(screenshotEntrySchema.extend({ prompt: z.string().max(75, { error: "Screenshot prompts are limited to 75 characters." }) })).max(3).describe("In-app screenshots paired with the user prompt that produced them (each prompt is 75 characters max). Widget apps must show the widget UI; non-widget apps show the model response. Min 1, max 3 entries, all public. Images: 706px wide, 400–860px tall, PNG."),
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."),
1005
3006
  translations: z.array(chatgptTranslationSchema).describe("Per-locale translation of tagline + description. English (US) is the default."),
1006
3007
  allowedCountries: chatgptAllowedCountriesSchema.describe("Availability: all supported countries, or an allow-list / block-list of specific ones (ISO alpha-2)."),
1007
- releaseNotes: z.string().describe("Publicly displayed on the app details page.")
3008
+ releaseNotes: z.string().describe("Publicly displayed on the plugin details page.")
1008
3009
  });
1009
3010
  const chatgptSubmissionDraftSchema = chatgptSubmissionFormDataSchema.partial().extend({
1010
3011
  tagline: z.string().optional(),
@@ -1015,23 +3016,35 @@ const chatgptSubmissionDraftSchema = chatgptSubmissionFormDataSchema.partial().e
1015
3016
  demoRecordingUrl: z.string().optional(),
1016
3017
  serverUrl: z.string().optional(),
1017
3018
  screenshots: z.array(screenshotDraftEntrySchema).optional(),
3019
+ testCases: z.array(positiveTestCaseDraftSchema).optional(),
3020
+ negativeTestCases: z.array(negativeTestCaseDraftSchema).optional(),
1018
3021
  translations: z.array(chatgptTranslationSchema.extend({ tagline: z.string() })).optional()
1019
3022
  });
1020
- chatgptSubmissionFormDataSchema.pick({
3023
+ /** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "chatgpt" })` can populate. */
3024
+ const chatgptPrefillFormDataSchema = chatgptSubmissionFormDataSchema.pick({
1021
3025
  appName: true,
1022
3026
  developerName: true,
1023
3027
  serverUrl: true,
1024
3028
  tools: true,
3029
+ skills: true,
1025
3030
  authentication: true
1026
3031
  });
1027
- chatgptSubmissionFormDataSchema.pick({
3032
+ /** Source of truth for `SubmissionPrefillService.generate({ platform: "chatgpt" })`. */
3033
+ const chatgptAiGeneratedFormDataSchema = chatgptSubmissionFormDataSchema.pick({
1028
3034
  tagline: true,
1029
3035
  description: true,
1030
3036
  category: true,
1031
3037
  testCases: true,
1032
3038
  negativeTestCases: true,
1033
3039
  toolJustifications: true
1034
- }).extend({ tagline: clampStringField(chatgptSubmissionFormDataSchema.shape.tagline) });
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))
3047
+ });
1035
3048
  const claudeCategorySchema = z.enum([
1036
3049
  "Productivity",
1037
3050
  "Communication",
@@ -1077,11 +3090,7 @@ const claudePolicyAcknowledgementSchema = z.enum([
1077
3090
  "My connector does not collect conversation data beyond what is needed for its function.",
1078
3091
  "Public documentation for this connector will be live by the publish date."
1079
3092
  ]);
1080
- /**
1081
- * Field order mirrors the claude.ai directory submission wizard
1082
- * (`claude.ai/admin-settings/directory/submissions/new`), grouped by step.
1083
- * When adding/removing/reordering fields, keep this in sync with the wizard.
1084
- */
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. */
1085
3094
  const claudeSubmissionFormDataSchema = z.object({
1086
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
1087
3096
  from the custom connector you select — the connection is used to verify the URL and the tool list at submission time.
@@ -1158,7 +3167,8 @@ const claudeSubmissionDraftSchema = claudeSubmissionFormDataSchema.partial().ext
1158
3167
  categories: z.array(claudeCategorySchema).optional(),
1159
3168
  screenshots: z.array(screenshotDraftEntrySchema).optional()
1160
3169
  });
1161
- claudeSubmissionFormDataSchema.pick({
3170
+ /** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "claudeai" })` can populate. */
3171
+ const claudePrefillFormDataSchema = claudeSubmissionFormDataSchema.pick({
1162
3172
  serverUrl: true,
1163
3173
  name: true,
1164
3174
  slug: true,
@@ -1173,39 +3183,93 @@ claudeSubmissionFormDataSchema.pick({
1173
3183
  connectionRequirements: claudeSubmissionFormDataSchema.shape.connectionRequirements.optional(),
1174
3184
  testInstructions: claudeSubmissionFormDataSchema.shape.testInstructions.optional()
1175
3185
  });
1176
- /**
1177
- * Narrative fields the LLM-backed generation step produces for Claude submissions.
1178
- * This schema accepts the slightly loose shape returned by AI generation, then normalizes it into
1179
- * the strict form shape. Keep transforms here rather than in callers so generation leniency is
1180
- * colocated with the Claude contract.
1181
- */
3186
+ /** Loose shape returned by AI generation for Claude narrative fields; transforms live here so generation leniency stays colocated with the Claude contract. */
1182
3187
  const claudeAiGeneratedFormDataRawSchema = z.object({
1183
3188
  oneLiner: claudeSubmissionFormDataSchema.shape.oneLiner,
1184
3189
  description: claudeSubmissionFormDataSchema.shape.description,
1185
3190
  categories: z.array(claudeCategorySchema).describe(claudeCategoryDescription),
1186
3191
  primaryUseCases: claudeSubmissionFormDataSchema.shape.primaryUseCases
1187
3192
  });
1188
- claudeAiGeneratedFormDataRawSchema.extend({
3193
+ const claudeAiGeneratedFormDataSchema = claudeAiGeneratedFormDataRawSchema.extend({
1189
3194
  oneLiner: clampStringField(claudeSubmissionFormDataSchema.shape.oneLiner),
1190
3195
  categories: claudeAiGeneratedFormDataRawSchema.shape.categories.transform((categories) => categories.slice(0, 5))
1191
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.")
3245
+ });
1192
3246
  const submissionMetaFieldsSchema = z.object({
1193
3247
  id: z.string(),
1194
3248
  environmentId: z.string(),
1195
3249
  auditId: z.string().nullable(),
3250
+ urlVerification: urlVerificationSchema.nullable().default(null),
1196
3251
  createdAt: z.coerce.date(),
1197
3252
  updatedAt: z.coerce.date()
1198
3253
  });
1199
3254
  const claudeSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
1200
3255
  platform: z.literal("claudeai"),
1201
- formData: claudeSubmissionDraftSchema
3256
+ formData: claudeSubmissionDraftSchema,
3257
+ prefillSnapshot: claudeSubmissionDraftSchema.nullable().default(null)
1202
3258
  });
1203
3259
  const chatgptSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
1204
3260
  platform: z.literal("chatgpt"),
1205
- formData: chatgptSubmissionDraftSchema
3261
+ formData: chatgptSubmissionDraftSchema,
3262
+ prefillSnapshot: chatgptSubmissionDraftSchema.nullable().default(null)
1206
3263
  });
1207
- z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
3264
+ const submissionSchemaInternal = z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
1208
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
+ ]);
1209
3273
  const subscriptionPlanSchema = z.enum([
1210
3274
  "pro",
1211
3275
  "business",
@@ -1217,25 +3281,84 @@ const customerCreditsSchema = z.object({
1217
3281
  expiresAt: z.number().nullable(),
1218
3282
  currency: z.string()
1219
3283
  });
1220
- const customerUsageSchema = z.object({
1221
- amountInCents: z.number(),
1222
- currency: z.string(),
1223
- periodEnd: z.number()
1224
- });
1225
3284
  const partnerDiscountSchema = z.object({ endsAt: z.number() });
1226
3285
  z.object({
1227
3286
  customerCredits: customerCreditsSchema.nullable(),
1228
- customerUsage: customerUsageSchema.nullable(),
1229
3287
  partnerDiscount: partnerDiscountSchema.nullable()
1230
3288
  });
1231
- //#endregion
1232
- //#region src/auth-scope.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
1233
3357
  /** Accepts an API key or OAuth access token (default for most routes). */
1234
3358
  const AUTH_SCOPE_ANY = "any";
1235
3359
  /** Requires a user OAuth access token; API keys are not accepted. */
1236
3360
  const AUTH_SCOPE_USER = "user";
1237
- //#endregion
1238
- //#region src/schemas.ts
3361
+ // src/schemas.ts
1239
3362
  const RESERVED_KEYS = [
1240
3363
  "_HANDLER",
1241
3364
  "_X_AMZN_TRACE_ID",
@@ -1324,8 +3447,15 @@ const serverFieldsSchema = z.object({
1324
3447
  })).optional()
1325
3448
  })).optional()
1326
3449
  });
1327
- //#endregion
1328
- //#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
+ };
1329
3459
  const deploymentStatusSchema = z.enum([
1330
3460
  "ongoing",
1331
3461
  "deployed",
@@ -1354,21 +3484,20 @@ const deploymentSchema = z.object({
1354
3484
  isCurrent: z.boolean(),
1355
3485
  deploymentPageUrl: z.url().nullable()
1356
3486
  });
1357
- const isValidLogTimeInput = (value) => {
3487
+ const isValidTimeInput = (value) => {
1358
3488
  if (ms(value) !== void 0) return true;
1359
3489
  return !Number.isNaN(new Date(value).getTime());
1360
3490
  };
1361
- 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({
1362
3494
  path: "/v1/environments",
1363
3495
  method: "POST",
1364
3496
  summary: "Create an environment",
1365
3497
  description: "Create an environment for a project",
1366
3498
  tags: ["environments"],
1367
3499
  successDescription: "The environment has been created successfully"
1368
- }).errors({
1369
- NOT_FOUND: {},
1370
- BAD_REQUEST: {}
1371
- }).input(z.object({
3500
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1372
3501
  projectId: z.string().describe("The ID of the project to create the environment for"),
1373
3502
  name: z.string().min(1).describe("The name of the environment"),
1374
3503
  sourceBranch: z.string().min(1).describe("The branch used to build the environment"),
@@ -1381,7 +3510,7 @@ const createEnvironmentContractV1 = oc.route({
1381
3510
  createdAt: z.coerce.date(),
1382
3511
  projectId: z.string().describe("The ID of the project the environment belongs to")
1383
3512
  }));
1384
- const getEnvironmentContractV1 = oc.route({
3513
+ const getEnvironmentContractV1 = base.route({
1385
3514
  path: "/v1/environments/{environmentId}",
1386
3515
  method: "GET",
1387
3516
  summary: "Get an environment",
@@ -1397,6 +3526,14 @@ const getEnvironmentContractV1 = oc.route({
1397
3526
  createdAt: z.coerce.date(),
1398
3527
  projectId: z.string()
1399
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) }));
1400
3537
  const domainSchema = z.object({
1401
3538
  domain: z.string(),
1402
3539
  status: z.enum([
@@ -1438,7 +3575,7 @@ const projectOutputSchema = z.object({
1438
3575
  productionEnvironment: productionEnvironmentSchema.nullable(),
1439
3576
  environments: z.array(environmentSchema)
1440
3577
  });
1441
- const getProjectContractV1 = oc.route({
3578
+ const getProjectContractV1 = base.route({
1442
3579
  path: "/v1/projects/{projectId}",
1443
3580
  method: "GET",
1444
3581
  summary: "Get a project",
@@ -1446,18 +3583,15 @@ const getProjectContractV1 = oc.route({
1446
3583
  tags: ["projects"],
1447
3584
  successDescription: "The project details"
1448
3585
  }).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(projectOutputSchema);
1449
- const listProjectsContractV1 = oc.route({
3586
+ const listProjectsContractV1 = base.route({
1450
3587
  path: "/v1/projects",
1451
3588
  method: "GET",
1452
3589
  summary: "List projects",
1453
3590
  description: "List all projects for a team",
1454
3591
  tags: ["projects"],
1455
3592
  successDescription: "The list of projects"
1456
- }).errors({
1457
- NOT_FOUND: {},
1458
- BAD_REQUEST: {}
1459
- }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
1460
- 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({
1461
3595
  path: "/v1/projects",
1462
3596
  method: "POST",
1463
3597
  summary: "Create a project",
@@ -1466,7 +3600,6 @@ const createProjectContractV1 = oc.route({
1466
3600
  successDescription: "The project has been created successfully"
1467
3601
  }).errors({
1468
3602
  NOT_FOUND: {},
1469
- BAD_REQUEST: {},
1470
3603
  FORBIDDEN: {}
1471
3604
  }).input(z.object({
1472
3605
  teamId: z.string().optional(),
@@ -1507,7 +3640,101 @@ const environmentVariableOutputSchema = z.object({
1507
3640
  isSecret: z.boolean(),
1508
3641
  createdAt: z.coerce.date()
1509
3642
  });
1510
- 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({
1511
3738
  path: "/v1/environments/{environmentId}/environment-variables",
1512
3739
  method: "GET",
1513
3740
  summary: "List environment variables",
@@ -1515,48 +3742,39 @@ const listEnvironmentVariablesContractV1 = oc.route({
1515
3742
  tags: ["environments"],
1516
3743
  successDescription: "The list of environment variables"
1517
3744
  }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(environmentVariableOutputSchema));
1518
- const createEnvironmentVariablesContractV1 = oc.route({
3745
+ const createEnvironmentVariablesContractV1 = base.route({
1519
3746
  path: "/v1/environments/{environmentId}/environment-variables",
1520
3747
  method: "POST",
1521
3748
  summary: "Add environment variables",
1522
3749
  description: "Add one or more environment variables to an environment",
1523
3750
  tags: ["environments"],
1524
3751
  successDescription: "The environment variables have been added successfully"
1525
- }).errors({
1526
- NOT_FOUND: {},
1527
- BAD_REQUEST: {}
1528
- }).input(z.object({
3752
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1529
3753
  environmentId: z.string().describe("The ID of the environment"),
1530
3754
  environmentVariables: environmentVariablesSchema
1531
3755
  })).output(z.object({ success: z.literal(true) }));
1532
- const updateEnvironmentVariableContractV1 = oc.route({
3756
+ const updateEnvironmentVariableContractV1 = base.route({
1533
3757
  path: "/v1/environment-variables/{environmentVariableId}",
1534
3758
  method: "PATCH",
1535
3759
  summary: "Update an environment variable",
1536
3760
  description: "Update an environment variable by ID",
1537
3761
  tags: ["environments"],
1538
3762
  successDescription: "The environment variable has been updated successfully"
1539
- }).errors({
1540
- NOT_FOUND: {},
1541
- BAD_REQUEST: {}
1542
- }).input(z.object({
3763
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1543
3764
  environmentVariableId: z.string().describe("The ID of the environment variable"),
1544
3765
  key: environmentVariableSchema.shape.key,
1545
3766
  value: environmentVariableSchema.shape.value.optional(),
1546
3767
  isSecret: environmentVariableSchema.shape.isSecret.optional()
1547
3768
  })).output(z.object({ success: z.literal(true) }));
1548
- const deleteEnvironmentVariableContractV1 = oc.route({
3769
+ const deleteEnvironmentVariableContractV1 = base.route({
1549
3770
  path: "/v1/environment-variables/{environmentVariableId}",
1550
3771
  method: "DELETE",
1551
3772
  summary: "Delete an environment variable",
1552
3773
  description: "Delete an environment variable by ID",
1553
3774
  tags: ["environments"],
1554
3775
  successDescription: "The environment variable has been deleted successfully"
1555
- }).errors({
1556
- NOT_FOUND: {},
1557
- BAD_REQUEST: {}
1558
- }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
1559
- const deleteProjectContractV1 = oc.route({
3776
+ }).errors({ NOT_FOUND: {} }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
3777
+ const deleteProjectContractV1 = base.route({
1560
3778
  path: "/v1/projects/{projectId}",
1561
3779
  method: "DELETE",
1562
3780
  summary: "Delete a project",
@@ -1564,7 +3782,7 @@ const deleteProjectContractV1 = oc.route({
1564
3782
  tags: ["projects"],
1565
3783
  successDescription: "The project has been deleted successfully"
1566
3784
  }).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(z.object({ success: z.literal(true) }));
1567
- const updateProjectContractV1 = oc.route({
3785
+ const updateProjectContractV1 = base.route({
1568
3786
  path: "/v1/projects/{projectId}",
1569
3787
  method: "PATCH",
1570
3788
  summary: "Update a project",
@@ -1573,14 +3791,13 @@ const updateProjectContractV1 = oc.route({
1573
3791
  successDescription: "The project has been updated successfully"
1574
3792
  }).errors({
1575
3793
  NOT_FOUND: {},
1576
- BAD_REQUEST: {},
1577
3794
  FORBIDDEN: {}
1578
3795
  }).input(z.object({
1579
3796
  projectId: z.string().describe("The ID of the project"),
1580
3797
  name: z.string().min(1).max(100).optional().describe("The new name for the project"),
1581
3798
  sourceRepository: z.string().nullable().optional().describe("The source repository to connect to the project")
1582
3799
  })).output(projectOutputSchema);
1583
- const deployEnvironmentContractV1 = oc.route({
3800
+ const deployEnvironmentContractV1 = base.route({
1584
3801
  path: "/v1/environments/{environmentId}/deploy",
1585
3802
  method: "POST",
1586
3803
  summary: "Deploy an environment",
@@ -1589,29 +3806,25 @@ const deployEnvironmentContractV1 = oc.route({
1589
3806
  successDescription: "The environment has been deployed successfully"
1590
3807
  }).errors({
1591
3808
  NOT_FOUND: {},
1592
- BAD_REQUEST: {},
1593
3809
  CONFLICT: {}
1594
3810
  }).input(z.object({
1595
3811
  environmentId: z.string().describe("The ID of the environment to deploy"),
1596
3812
  token: z.string().describe("The token to identify the source archive").optional(),
1597
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.")
1598
3814
  })).output(deploymentSchema);
1599
- const uploadDeploymentArtifactContractV1 = oc.route({
3815
+ const uploadDeploymentArtifactContractV1 = base.route({
1600
3816
  path: "/v1/deployments/upload",
1601
3817
  method: "POST",
1602
3818
  summary: "Upload deployment artifacts",
1603
3819
  description: "Return a presigned S3 URL to upload a deployment artifact",
1604
3820
  tags: ["deployments"],
1605
3821
  successDescription: "The presigned upload URL has been generated successfully"
1606
- }).errors({
1607
- NOT_FOUND: {},
1608
- BAD_REQUEST: {}
1609
- }).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({
1610
3823
  uploadUrl: z.url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
1611
3824
  token: z.string().describe("Token to identify the source archive"),
1612
3825
  expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
1613
3826
  }));
1614
- const listDeploymentsContractV1 = oc.route({
3827
+ const listDeploymentsContractV1 = base.route({
1615
3828
  path: "/v1/projects/{projectId}/deployments",
1616
3829
  method: "GET",
1617
3830
  summary: "List project deployments",
@@ -1623,7 +3836,7 @@ const listDeploymentsContractV1 = oc.route({
1623
3836
  status: z.array(deploymentStatusSchema).optional().describe("Filter by one or more statuses"),
1624
3837
  environmentId: z.string().optional().describe("Filter by environment ID")
1625
3838
  })).output(z.array(deploymentSchema));
1626
- const getDeploymentContractV1 = oc.route({
3839
+ const getDeploymentContractV1 = base.route({
1627
3840
  path: "/v1/deployments/{deploymentId}",
1628
3841
  method: "GET",
1629
3842
  summary: "Get a deployment",
@@ -1646,20 +3859,17 @@ const logEntrySchema = z.object({
1646
3859
  method: z.string().optional(),
1647
3860
  durationInMs: z.number().optional()
1648
3861
  });
1649
- const getLogsContractV1 = oc.route({
3862
+ const getLogsContractV1 = base.route({
1650
3863
  path: "/v1/environments/{environmentId}/logs",
1651
3864
  method: "GET",
1652
3865
  summary: "Get logs",
1653
3866
  description: "Get logs for an environment",
1654
3867
  tags: ["environments"],
1655
3868
  successDescription: "The logs"
1656
- }).errors({
1657
- NOT_FOUND: {},
1658
- BAD_REQUEST: {}
1659
- }).input(z.object({
3869
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1660
3870
  environmentId: z.string().describe("The ID of the environment"),
1661
- 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)"),
1662
- 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"),
1663
3873
  limit: z.coerce.number().int().min(1).max(1e3).default(1e3).describe("Maximum number of log entries to return."),
1664
3874
  level: z.array(z.enum([
1665
3875
  "INFO",
@@ -1667,23 +3877,20 @@ const getLogsContractV1 = oc.route({
1667
3877
  "WARNING",
1668
3878
  "DEBUG"
1669
3879
  ])).optional().describe("Filter by log level"),
1670
- 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"),
1671
3881
  nextToken: z.string().optional().describe("Pagination token from a previous response")
1672
3882
  })).output(z.object({
1673
3883
  logs: z.array(logEntrySchema),
1674
3884
  nextToken: z.string().nullable()
1675
3885
  }));
1676
- const getLatestLogsContractV1 = oc.route({
3886
+ const getLatestLogsContractV1 = base.route({
1677
3887
  path: "/v1/environments/{environmentId}/latest-logs",
1678
3888
  method: "GET",
1679
3889
  summary: "Get latest logs",
1680
3890
  description: "Get the N most recent logs for an environment",
1681
3891
  tags: ["environments"],
1682
3892
  successDescription: "The latest logs"
1683
- }).errors({
1684
- NOT_FOUND: {},
1685
- BAD_REQUEST: {}
1686
- }).input(z.object({
3893
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1687
3894
  environmentId: z.string().describe("The ID of the environment"),
1688
3895
  limit: z.coerce.number().int().min(1).max(1e3).default(100).describe("Number of most recent log entries to return"),
1689
3896
  level: z.array(z.enum([
@@ -1692,9 +3899,9 @@ const getLatestLogsContractV1 = oc.route({
1692
3899
  "WARNING",
1693
3900
  "DEBUG"
1694
3901
  ])).optional().describe("Filter by log level"),
1695
- search: z.string().optional().describe("Filter pattern to search for in log content")
3902
+ search: logSearchSchema.optional().describe("Term to search for in log content")
1696
3903
  })).output(z.object({ logs: z.array(logEntrySchema) }));
1697
- const getDeploymentLogsContractV1 = oc.route({
3904
+ const getDeploymentLogsContractV1 = base.route({
1698
3905
  path: "/v1/deployments/{deploymentId}/logs",
1699
3906
  method: "GET",
1700
3907
  summary: "Get deployment logs",
@@ -1721,22 +3928,19 @@ const analyticsTimeSeriesSchema = z.object({
1721
3928
  output_token_mean: z.array(analyticsDataPointSchema),
1722
3929
  task_count: z.array(analyticsDataPointSchema)
1723
3930
  });
1724
- const getProjectAnalyticsContractV1 = oc.route({
3931
+ const getProjectAnalyticsContractV1 = base.route({
1725
3932
  path: "/v1/analytics/{projectId}",
1726
3933
  method: "GET",
1727
3934
  summary: "Get project analytics",
1728
3935
  description: "Get analytics data for a project over a time range",
1729
3936
  tags: ["analytics"],
1730
3937
  successDescription: "The project analytics data"
1731
- }).errors({
1732
- NOT_FOUND: {},
1733
- BAD_REQUEST: {}
1734
- }).input(z.object({
3938
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1735
3939
  projectId: z.string().describe("The ID of the project"),
1736
3940
  startTimestamp: z.coerce.number().describe("Start timestamp in milliseconds"),
1737
3941
  endTimestamp: z.coerce.number().describe("End timestamp in milliseconds"),
1738
3942
  timeZone: z.string().describe("IANA timezone (e.g. Europe/Paris)")
1739
- }).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({
1740
3944
  metadata: z.object({
1741
3945
  startTimestamp: z.number(),
1742
3946
  endTimestamp: z.number(),
@@ -1746,7 +3950,132 @@ const getProjectAnalyticsContractV1 = oc.route({
1746
3950
  }),
1747
3951
  timeSeries: analyticsTimeSeriesSchema
1748
3952
  }));
1749
- 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({
1750
4079
  path: "/v1/teams",
1751
4080
  method: "GET",
1752
4081
  summary: "List teams",
@@ -1759,7 +4088,22 @@ const listTeamsContractV1 = oc.route({
1759
4088
  createdAt: z.coerce.date(),
1760
4089
  hasStripeAccount: z.boolean()
1761
4090
  })));
1762
- 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({
1763
4107
  path: "/v1/tunnels/ticket",
1764
4108
  method: "GET",
1765
4109
  summary: "Get a tunnel ticket",
@@ -1771,16 +4115,13 @@ const getTunnelTicketContractV1 = oc.route({
1771
4115
  ticket: z.string().describe("The signed tunnel ticket"),
1772
4116
  tunnelHost: z.string().describe("The tunnel host to connect to")
1773
4117
  }));
1774
- const publishServerContractV1 = oc.route({
4118
+ const publishServerContractV1 = base.route({
1775
4119
  path: "/v1/distribution/publish",
1776
4120
  method: "POST",
1777
4121
  summary: "Publish a server to the MCP registry",
1778
4122
  tags: ["distribution"],
1779
4123
  successDescription: "The server has been published successfully"
1780
- }).errors({
1781
- NOT_FOUND: {},
1782
- BAD_REQUEST: {}
1783
- }).input(z.object({
4124
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1784
4125
  projectId: z.string(),
1785
4126
  domain: z.string(),
1786
4127
  title: z.string().min(1).max(100),
@@ -1789,17 +4130,14 @@ const publishServerContractV1 = oc.route({
1789
4130
  iconSrc: z.url().max(255).optional(),
1790
4131
  dryRun: z.boolean().optional()
1791
4132
  })).output(z.object({ serverFields: serverFieldsSchema }));
1792
- const getServerInfoContractV1 = oc.route({
4133
+ const getServerInfoContractV1 = base.route({
1793
4134
  path: "/v1/distribution/get",
1794
4135
  method: "GET",
1795
4136
  summary: "Get server info",
1796
4137
  description: "Get info about a server",
1797
4138
  tags: ["distribution"],
1798
4139
  successDescription: "The server info"
1799
- }).errors({
1800
- NOT_FOUND: {},
1801
- BAD_REQUEST: {}
1802
- }).input(z.object({
4140
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1803
4141
  projectId: z.string(),
1804
4142
  domain: z.string()
1805
4143
  })).output(z.object({ serverFields: serverFieldsSchema }));
@@ -1818,7 +4156,7 @@ const playgroundOutputSchema = z.object({
1818
4156
  isPlaygroundEnabled: z.boolean(),
1819
4157
  serverMetadata: playgroundServerMetadataOutputSchema.nullable()
1820
4158
  });
1821
- const getPlaygroundContractV1 = oc.route({
4159
+ const getPlaygroundContractV1 = base.route({
1822
4160
  path: "/v1/environments/{environmentId}/playground",
1823
4161
  method: "GET",
1824
4162
  summary: "Get playground configuration",
@@ -1826,17 +4164,14 @@ const getPlaygroundContractV1 = oc.route({
1826
4164
  tags: ["environments"],
1827
4165
  successDescription: "The playground configuration"
1828
4166
  }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(playgroundOutputSchema);
1829
- const upsertPlaygroundContractV1 = oc.route({
4167
+ const upsertPlaygroundContractV1 = base.route({
1830
4168
  path: "/v1/environments/{environmentId}/playground",
1831
4169
  method: "PUT",
1832
4170
  summary: "Update playground configuration",
1833
4171
  description: "Update the playground configuration for an environment. All fields are optional — only provided fields are updated.",
1834
4172
  tags: ["environments"],
1835
4173
  successDescription: "The updated playground configuration"
1836
- }).errors({
1837
- NOT_FOUND: {},
1838
- BAD_REQUEST: {}
1839
- }).input(z.object({
4174
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1840
4175
  environmentId: z.string().describe("The ID of the environment"),
1841
4176
  isPlaygroundEnabled: z.boolean().optional(),
1842
4177
  name: z.string().min(1).max(100).optional(),
@@ -1844,7 +4179,7 @@ const upsertPlaygroundContractV1 = oc.route({
1844
4179
  headers: z.array(playgroundHeaderSchema).optional(),
1845
4180
  examplePrompts: z.array(playgroundExamplePromptSchema).max(5).optional()
1846
4181
  })).output(playgroundOutputSchema);
1847
- const createBeaconContractV1 = oc.route({
4182
+ const createBeaconContractV1 = base.route({
1848
4183
  path: "/v1/beacon/audits",
1849
4184
  method: "POST",
1850
4185
  summary: "Create a beacon audit",
@@ -1853,7 +4188,6 @@ const createBeaconContractV1 = oc.route({
1853
4188
  successDescription: "The audit has been created"
1854
4189
  }).errors({
1855
4190
  NOT_FOUND: {},
1856
- BAD_REQUEST: {},
1857
4191
  DNS_RESOLUTION_FAILED: { status: 400 }
1858
4192
  }).input(z.object({
1859
4193
  targetUrl: z.url().describe("The HTTPS URL of the MCP server to audit"),
@@ -1861,7 +4195,7 @@ const createBeaconContractV1 = oc.route({
1861
4195
  projectId: z.string().optional().describe("The project ID to associate the audit with"),
1862
4196
  excludeCategories: z.array(checkCategorySchema).optional().describe("Check categories to exclude from the audit")
1863
4197
  })).output(z.object({ id: z.string() }));
1864
- const getBeaconContractV1 = oc.route({
4198
+ const getBeaconContractV1 = base.route({
1865
4199
  path: "/v1/beacon/audits/{auditId}",
1866
4200
  method: "GET",
1867
4201
  summary: "Get a beacon audit",
@@ -1876,9 +4210,73 @@ const getBeaconContractV1 = oc.route({
1876
4210
  createdAt: z.coerce.date(),
1877
4211
  report: auditReportWithScreenshotsSchema.nullable()
1878
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);
1879
4264
  const contract = {
1880
- teams: { list: { v1: listTeamsContractV1 } },
4265
+ teams: {
4266
+ list: { v1: listTeamsContractV1 },
4267
+ getUsage: { v1: getTeamUsageContractV1 }
4268
+ },
1881
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 } },
1882
4280
  deployments: {
1883
4281
  list: { v1: listDeploymentsContractV1 },
1884
4282
  get: { v1: getDeploymentContractV1 },
@@ -1888,6 +4286,7 @@ const contract = {
1888
4286
  environments: {
1889
4287
  create: { v1: createEnvironmentContractV1 },
1890
4288
  get: { v1: getEnvironmentContractV1 },
4289
+ delete: { v1: deleteEnvironmentContractV1 },
1891
4290
  deploy: { v1: deployEnvironmentContractV1 },
1892
4291
  getLogs: { v1: getLogsContractV1 },
1893
4292
  getLatestLogs: { v1: getLatestLogsContractV1 }
@@ -1898,6 +4297,12 @@ const contract = {
1898
4297
  update: { v1: updateEnvironmentVariableContractV1 },
1899
4298
  delete: { v1: deleteEnvironmentVariableContractV1 }
1900
4299
  },
4300
+ telemetryDestinations: {
4301
+ list: { v1: listTelemetryDestinationsContractV1 },
4302
+ create: { v1: createTelemetryDestinationContractV1 },
4303
+ update: { v1: updateTelemetryDestinationContractV1 },
4304
+ delete: { v1: deleteTelemetryDestinationContractV1 }
4305
+ },
1901
4306
  projects: {
1902
4307
  update: { v1: updateProjectContractV1 },
1903
4308
  get: { v1: getProjectContractV1 },
@@ -1917,6 +4322,12 @@ const contract = {
1917
4322
  beacon: {
1918
4323
  create: { v1: createBeaconContractV1 },
1919
4324
  get: { v1: getBeaconContractV1 }
4325
+ },
4326
+ submissions: {
4327
+ create: { v1: createSubmissionContractV1 },
4328
+ list: { v1: listSubmissionsContractV1 },
4329
+ get: { v1: getSubmissionContractV1 },
4330
+ update: { v1: updateSubmissionContractV1 }
1920
4331
  }
1921
4332
  };
1922
4333
  const { uploadArtifact: _discard, ...deploymentsForDocs } = contract.deployments;
@@ -1924,5 +4335,25 @@ const contractForDocs = {
1924
4335
  ...contract,
1925
4336
  deployments: deploymentsForDocs
1926
4337
  };
1927
- //#endregion
1928
- export { AUTH_SCOPE_ANY, AUTH_SCOPE_USER, PLATFORM_LABELS, buildSettingsSchema, contract, contractForDocs, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema, updateEnvironmentVariableSchema };
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 }
4357
+ }
4358
+ };
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 };