@alpic-ai/api 0.0.0-dev.gf56e95b → 0.0.0-dev.gf5803e4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6714 -97
- package/dist/index.mjs +2880 -410
- package/package.json +26 -10
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
|
-
|
|
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,11 +181,1740 @@ z$1.object({
|
|
|
169
181
|
token: z$1.string(),
|
|
170
182
|
token_type_hint: z$1.string().optional()
|
|
171
183
|
}).strip();
|
|
172
|
-
|
|
184
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/constants.js
|
|
185
|
+
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
186
|
+
module.exports = {
|
|
187
|
+
MAX_LENGTH: 256,
|
|
188
|
+
MAX_SAFE_COMPONENT_LENGTH: 16,
|
|
189
|
+
MAX_SAFE_BUILD_LENGTH: 250,
|
|
190
|
+
MAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER ||
|
|
191
|
+
/* istanbul ignore next */ 9007199254740991,
|
|
192
|
+
WHITESPACE_CHARACTERS: [
|
|
193
|
+
" ",
|
|
194
|
+
"\n",
|
|
195
|
+
"\v",
|
|
196
|
+
"\f",
|
|
197
|
+
"\r",
|
|
198
|
+
" ",
|
|
199
|
+
"\xA0",
|
|
200
|
+
" ",
|
|
201
|
+
" ",
|
|
202
|
+
" ",
|
|
203
|
+
" ",
|
|
204
|
+
" ",
|
|
205
|
+
" ",
|
|
206
|
+
" ",
|
|
207
|
+
" ",
|
|
208
|
+
" ",
|
|
209
|
+
" ",
|
|
210
|
+
" ",
|
|
211
|
+
" ",
|
|
212
|
+
"\u2028",
|
|
213
|
+
"\u2029",
|
|
214
|
+
" ",
|
|
215
|
+
" ",
|
|
216
|
+
" ",
|
|
217
|
+
""
|
|
218
|
+
],
|
|
219
|
+
RELEASE_TYPES: [
|
|
220
|
+
"major",
|
|
221
|
+
"premajor",
|
|
222
|
+
"minor",
|
|
223
|
+
"preminor",
|
|
224
|
+
"patch",
|
|
225
|
+
"prepatch",
|
|
226
|
+
"prerelease"
|
|
227
|
+
],
|
|
228
|
+
SEMVER_SPEC_VERSION: "2.0.0",
|
|
229
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
230
|
+
FLAG_LOOSE: 2
|
|
231
|
+
};
|
|
232
|
+
}));
|
|
233
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/debug.js
|
|
234
|
+
var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
235
|
+
module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
236
|
+
}));
|
|
237
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/re.js
|
|
238
|
+
var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
239
|
+
const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
|
|
240
|
+
const debug = require_debug();
|
|
241
|
+
exports = module.exports = {};
|
|
242
|
+
const re = exports.re = [];
|
|
243
|
+
const safeRe = exports.safeRe = [];
|
|
244
|
+
const src = exports.src = [];
|
|
245
|
+
const safeSrc = exports.safeSrc = [];
|
|
246
|
+
const t = exports.t = {};
|
|
247
|
+
let R = 0;
|
|
248
|
+
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
249
|
+
const safeRegexReplacements = [
|
|
250
|
+
["\\s", 1],
|
|
251
|
+
["\\d", MAX_LENGTH],
|
|
252
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
253
|
+
];
|
|
254
|
+
const makeSafeRegex = (value) => {
|
|
255
|
+
for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
256
|
+
return value;
|
|
257
|
+
};
|
|
258
|
+
const createToken = (name, value, isGlobal) => {
|
|
259
|
+
const safe = makeSafeRegex(value);
|
|
260
|
+
const index = R++;
|
|
261
|
+
debug(name, index, value);
|
|
262
|
+
t[name] = index;
|
|
263
|
+
src[index] = value;
|
|
264
|
+
safeSrc[index] = safe;
|
|
265
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
266
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
267
|
+
};
|
|
268
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
269
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
270
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
271
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
272
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
273
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
274
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
275
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
276
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
277
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
278
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
279
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
280
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
281
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
282
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
283
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
284
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
285
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
286
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
287
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
288
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
289
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
290
|
+
createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
291
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
292
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
293
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
294
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
295
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
296
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
297
|
+
exports.tildeTrimReplace = "$1~";
|
|
298
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
299
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
300
|
+
createToken("LONECARET", "(?:\\^)");
|
|
301
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
302
|
+
exports.caretTrimReplace = "$1^";
|
|
303
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
304
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
305
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
306
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
307
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
308
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
309
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
310
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
311
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
312
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
313
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
314
|
+
}));
|
|
315
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/parse-options.js
|
|
316
|
+
var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
317
|
+
const looseOption = Object.freeze({ loose: true });
|
|
318
|
+
const emptyOpts = Object.freeze({});
|
|
319
|
+
const parseOptions = (options) => {
|
|
320
|
+
if (!options) return emptyOpts;
|
|
321
|
+
if (typeof options !== "object") return looseOption;
|
|
322
|
+
return options;
|
|
323
|
+
};
|
|
324
|
+
module.exports = parseOptions;
|
|
325
|
+
}));
|
|
326
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/identifiers.js
|
|
327
|
+
var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
328
|
+
const numeric = /^[0-9]+$/;
|
|
329
|
+
const compareIdentifiers = (a, b) => {
|
|
330
|
+
if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
|
|
331
|
+
const anum = numeric.test(a);
|
|
332
|
+
const bnum = numeric.test(b);
|
|
333
|
+
if (anum && bnum) {
|
|
334
|
+
a = +a;
|
|
335
|
+
b = +b;
|
|
336
|
+
}
|
|
337
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
338
|
+
};
|
|
339
|
+
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
340
|
+
module.exports = {
|
|
341
|
+
compareIdentifiers,
|
|
342
|
+
rcompareIdentifiers
|
|
343
|
+
};
|
|
344
|
+
}));
|
|
345
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/classes/semver.js
|
|
346
|
+
var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
347
|
+
const debug = require_debug();
|
|
348
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
349
|
+
const { safeRe: re, t } = require_re();
|
|
350
|
+
const parseOptions = require_parse_options();
|
|
351
|
+
const { compareIdentifiers } = require_identifiers();
|
|
352
|
+
const isPrereleaseIdentifier = (prerelease, identifier) => {
|
|
353
|
+
const identifiers = identifier.split(".");
|
|
354
|
+
if (identifiers.length > prerelease.length) return false;
|
|
355
|
+
for (let i = 0; i < identifiers.length; i++) if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) return false;
|
|
356
|
+
return true;
|
|
357
|
+
};
|
|
358
|
+
module.exports = class SemVer {
|
|
359
|
+
constructor(version, options) {
|
|
360
|
+
options = parseOptions(options);
|
|
361
|
+
if (version instanceof SemVer) {
|
|
362
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
|
|
363
|
+
else version = version.version;
|
|
364
|
+
} else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
365
|
+
if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
366
|
+
debug("SemVer", version, options);
|
|
367
|
+
this.options = options;
|
|
368
|
+
this.loose = !!options.loose;
|
|
369
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
370
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
371
|
+
if (!m) throw new TypeError(`Invalid Version: ${version}`);
|
|
372
|
+
this.raw = version;
|
|
373
|
+
this.major = +m[1];
|
|
374
|
+
this.minor = +m[2];
|
|
375
|
+
this.patch = +m[3];
|
|
376
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
|
|
377
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
|
|
378
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
|
|
379
|
+
if (!m[4]) this.prerelease = [];
|
|
380
|
+
else this.prerelease = m[4].split(".").map((id) => {
|
|
381
|
+
if (/^[0-9]+$/.test(id)) {
|
|
382
|
+
const num = +id;
|
|
383
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
|
|
384
|
+
}
|
|
385
|
+
return id;
|
|
386
|
+
});
|
|
387
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
388
|
+
this.format();
|
|
389
|
+
}
|
|
390
|
+
format() {
|
|
391
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
392
|
+
if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
|
|
393
|
+
return this.version;
|
|
394
|
+
}
|
|
395
|
+
toString() {
|
|
396
|
+
return this.version;
|
|
397
|
+
}
|
|
398
|
+
compare(other) {
|
|
399
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
400
|
+
if (!(other instanceof SemVer)) {
|
|
401
|
+
if (typeof other === "string" && other === this.version) return 0;
|
|
402
|
+
other = new SemVer(other, this.options);
|
|
403
|
+
}
|
|
404
|
+
if (other.version === this.version) return 0;
|
|
405
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
406
|
+
}
|
|
407
|
+
compareMain(other) {
|
|
408
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
409
|
+
if (this.major < other.major) return -1;
|
|
410
|
+
if (this.major > other.major) return 1;
|
|
411
|
+
if (this.minor < other.minor) return -1;
|
|
412
|
+
if (this.minor > other.minor) return 1;
|
|
413
|
+
if (this.patch < other.patch) return -1;
|
|
414
|
+
if (this.patch > other.patch) return 1;
|
|
415
|
+
return 0;
|
|
416
|
+
}
|
|
417
|
+
comparePre(other) {
|
|
418
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
419
|
+
if (this.prerelease.length && !other.prerelease.length) return -1;
|
|
420
|
+
else if (!this.prerelease.length && other.prerelease.length) return 1;
|
|
421
|
+
else if (!this.prerelease.length && !other.prerelease.length) return 0;
|
|
422
|
+
let i = 0;
|
|
423
|
+
do {
|
|
424
|
+
const a = this.prerelease[i];
|
|
425
|
+
const b = other.prerelease[i];
|
|
426
|
+
debug("prerelease compare", i, a, b);
|
|
427
|
+
if (a === void 0 && b === void 0) return 0;
|
|
428
|
+
else if (b === void 0) return 1;
|
|
429
|
+
else if (a === void 0) return -1;
|
|
430
|
+
else if (a === b) continue;
|
|
431
|
+
else return compareIdentifiers(a, b);
|
|
432
|
+
} while (++i);
|
|
433
|
+
}
|
|
434
|
+
compareBuild(other) {
|
|
435
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
436
|
+
let i = 0;
|
|
437
|
+
do {
|
|
438
|
+
const a = this.build[i];
|
|
439
|
+
const b = other.build[i];
|
|
440
|
+
debug("build compare", i, a, b);
|
|
441
|
+
if (a === void 0 && b === void 0) return 0;
|
|
442
|
+
else if (b === void 0) return 1;
|
|
443
|
+
else if (a === void 0) return -1;
|
|
444
|
+
else if (a === b) continue;
|
|
445
|
+
else return compareIdentifiers(a, b);
|
|
446
|
+
} while (++i);
|
|
447
|
+
}
|
|
448
|
+
inc(release, identifier, identifierBase) {
|
|
449
|
+
if (release.startsWith("pre")) {
|
|
450
|
+
if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
|
|
451
|
+
if (identifier) {
|
|
452
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
453
|
+
if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
switch (release) {
|
|
457
|
+
case "premajor":
|
|
458
|
+
this.prerelease.length = 0;
|
|
459
|
+
this.patch = 0;
|
|
460
|
+
this.minor = 0;
|
|
461
|
+
this.major++;
|
|
462
|
+
this.inc("pre", identifier, identifierBase);
|
|
463
|
+
break;
|
|
464
|
+
case "preminor":
|
|
465
|
+
this.prerelease.length = 0;
|
|
466
|
+
this.patch = 0;
|
|
467
|
+
this.minor++;
|
|
468
|
+
this.inc("pre", identifier, identifierBase);
|
|
469
|
+
break;
|
|
470
|
+
case "prepatch":
|
|
471
|
+
this.prerelease.length = 0;
|
|
472
|
+
this.inc("patch", identifier, identifierBase);
|
|
473
|
+
this.inc("pre", identifier, identifierBase);
|
|
474
|
+
break;
|
|
475
|
+
case "prerelease":
|
|
476
|
+
if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
|
|
477
|
+
this.inc("pre", identifier, identifierBase);
|
|
478
|
+
break;
|
|
479
|
+
case "release":
|
|
480
|
+
if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
|
|
481
|
+
this.prerelease.length = 0;
|
|
482
|
+
break;
|
|
483
|
+
case "major":
|
|
484
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
|
|
485
|
+
this.minor = 0;
|
|
486
|
+
this.patch = 0;
|
|
487
|
+
this.prerelease = [];
|
|
488
|
+
break;
|
|
489
|
+
case "minor":
|
|
490
|
+
if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
|
|
491
|
+
this.patch = 0;
|
|
492
|
+
this.prerelease = [];
|
|
493
|
+
break;
|
|
494
|
+
case "patch":
|
|
495
|
+
if (this.prerelease.length === 0) this.patch++;
|
|
496
|
+
this.prerelease = [];
|
|
497
|
+
break;
|
|
498
|
+
case "pre": {
|
|
499
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
500
|
+
if (this.prerelease.length === 0) this.prerelease = [base];
|
|
501
|
+
else {
|
|
502
|
+
let i = this.prerelease.length;
|
|
503
|
+
while (--i >= 0) if (typeof this.prerelease[i] === "number") {
|
|
504
|
+
this.prerelease[i]++;
|
|
505
|
+
i = -2;
|
|
506
|
+
}
|
|
507
|
+
if (i === -1) {
|
|
508
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
|
|
509
|
+
this.prerelease.push(base);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
if (identifier) {
|
|
513
|
+
let prerelease = [identifier, base];
|
|
514
|
+
if (identifierBase === false) prerelease = [identifier];
|
|
515
|
+
if (isPrereleaseIdentifier(this.prerelease, identifier)) {
|
|
516
|
+
const prereleaseBase = this.prerelease[identifier.split(".").length];
|
|
517
|
+
if (isNaN(prereleaseBase)) this.prerelease = prerelease;
|
|
518
|
+
} else this.prerelease = prerelease;
|
|
519
|
+
}
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
default: throw new Error(`invalid increment argument: ${release}`);
|
|
523
|
+
}
|
|
524
|
+
this.raw = this.format();
|
|
525
|
+
if (this.build.length) this.raw += `+${this.build.join(".")}`;
|
|
526
|
+
return this;
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
}));
|
|
530
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/parse.js
|
|
531
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
532
|
+
const SemVer = require_semver$1();
|
|
533
|
+
const parse = (version, options, throwErrors = false) => {
|
|
534
|
+
if (version instanceof SemVer) return version;
|
|
535
|
+
try {
|
|
536
|
+
return new SemVer(version, options);
|
|
537
|
+
} catch (er) {
|
|
538
|
+
if (!throwErrors) return null;
|
|
539
|
+
throw er;
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
module.exports = parse;
|
|
543
|
+
}));
|
|
544
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/valid.js
|
|
545
|
+
var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
546
|
+
const parse = require_parse();
|
|
547
|
+
const valid = (version, options) => {
|
|
548
|
+
const v = parse(version, options);
|
|
549
|
+
return v ? v.version : null;
|
|
550
|
+
};
|
|
551
|
+
module.exports = valid;
|
|
552
|
+
}));
|
|
553
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/clean.js
|
|
554
|
+
var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
555
|
+
const parse = require_parse();
|
|
556
|
+
const clean = (version, options) => {
|
|
557
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
558
|
+
return s ? s.version : null;
|
|
559
|
+
};
|
|
560
|
+
module.exports = clean;
|
|
561
|
+
}));
|
|
562
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/inc.js
|
|
563
|
+
var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
564
|
+
const SemVer = require_semver$1();
|
|
565
|
+
const inc = (version, release, options, identifier, identifierBase) => {
|
|
566
|
+
if (typeof options === "string") {
|
|
567
|
+
identifierBase = identifier;
|
|
568
|
+
identifier = options;
|
|
569
|
+
options = void 0;
|
|
570
|
+
}
|
|
571
|
+
try {
|
|
572
|
+
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
573
|
+
} catch (er) {
|
|
574
|
+
return null;
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
module.exports = inc;
|
|
578
|
+
}));
|
|
579
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/diff.js
|
|
580
|
+
var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
581
|
+
const parse = require_parse();
|
|
582
|
+
const diff = (version1, version2) => {
|
|
583
|
+
const v1 = parse(version1, null, true);
|
|
584
|
+
const v2 = parse(version2, null, true);
|
|
585
|
+
const comparison = v1.compare(v2);
|
|
586
|
+
if (comparison === 0) return null;
|
|
587
|
+
const v1Higher = comparison > 0;
|
|
588
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
589
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
590
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
591
|
+
if (!!lowVersion.prerelease.length && !highHasPre) {
|
|
592
|
+
if (!lowVersion.patch && !lowVersion.minor) return "major";
|
|
593
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
594
|
+
if (lowVersion.minor && !lowVersion.patch) return "minor";
|
|
595
|
+
return "patch";
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
const prefix = highHasPre ? "pre" : "";
|
|
599
|
+
if (v1.major !== v2.major) return prefix + "major";
|
|
600
|
+
if (v1.minor !== v2.minor) return prefix + "minor";
|
|
601
|
+
if (v1.patch !== v2.patch) return prefix + "patch";
|
|
602
|
+
return "prerelease";
|
|
603
|
+
};
|
|
604
|
+
module.exports = diff;
|
|
605
|
+
}));
|
|
606
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/major.js
|
|
607
|
+
var require_major = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
608
|
+
const SemVer = require_semver$1();
|
|
609
|
+
const major = (a, loose) => new SemVer(a, loose).major;
|
|
610
|
+
module.exports = major;
|
|
611
|
+
}));
|
|
612
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/minor.js
|
|
613
|
+
var require_minor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
614
|
+
const SemVer = require_semver$1();
|
|
615
|
+
const minor = (a, loose) => new SemVer(a, loose).minor;
|
|
616
|
+
module.exports = minor;
|
|
617
|
+
}));
|
|
618
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/patch.js
|
|
619
|
+
var require_patch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
620
|
+
const SemVer = require_semver$1();
|
|
621
|
+
const patch = (a, loose) => new SemVer(a, loose).patch;
|
|
622
|
+
module.exports = patch;
|
|
623
|
+
}));
|
|
624
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/prerelease.js
|
|
625
|
+
var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
626
|
+
const parse = require_parse();
|
|
627
|
+
const prerelease = (version, options) => {
|
|
628
|
+
const parsed = parse(version, options);
|
|
629
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
630
|
+
};
|
|
631
|
+
module.exports = prerelease;
|
|
632
|
+
}));
|
|
633
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/compare.js
|
|
634
|
+
var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
635
|
+
const SemVer = require_semver$1();
|
|
636
|
+
const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
637
|
+
module.exports = compare;
|
|
638
|
+
}));
|
|
639
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/rcompare.js
|
|
640
|
+
var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
641
|
+
const compare = require_compare();
|
|
642
|
+
const rcompare = (a, b, loose) => compare(b, a, loose);
|
|
643
|
+
module.exports = rcompare;
|
|
644
|
+
}));
|
|
645
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/compare-loose.js
|
|
646
|
+
var require_compare_loose = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
647
|
+
const compare = require_compare();
|
|
648
|
+
const compareLoose = (a, b) => compare(a, b, true);
|
|
649
|
+
module.exports = compareLoose;
|
|
650
|
+
}));
|
|
651
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/compare-build.js
|
|
652
|
+
var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
653
|
+
const SemVer = require_semver$1();
|
|
654
|
+
const compareBuild = (a, b, loose) => {
|
|
655
|
+
const versionA = new SemVer(a, loose);
|
|
656
|
+
const versionB = new SemVer(b, loose);
|
|
657
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
658
|
+
};
|
|
659
|
+
module.exports = compareBuild;
|
|
660
|
+
}));
|
|
661
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/sort.js
|
|
662
|
+
var require_sort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
663
|
+
const compareBuild = require_compare_build();
|
|
664
|
+
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
665
|
+
module.exports = sort;
|
|
666
|
+
}));
|
|
667
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/rsort.js
|
|
668
|
+
var require_rsort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
669
|
+
const compareBuild = require_compare_build();
|
|
670
|
+
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
671
|
+
module.exports = rsort;
|
|
672
|
+
}));
|
|
673
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/gt.js
|
|
674
|
+
var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
675
|
+
const compare = require_compare();
|
|
676
|
+
const gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
677
|
+
module.exports = gt;
|
|
678
|
+
}));
|
|
679
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/lt.js
|
|
680
|
+
var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
681
|
+
const compare = require_compare();
|
|
682
|
+
const lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
683
|
+
module.exports = lt;
|
|
684
|
+
}));
|
|
685
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/eq.js
|
|
686
|
+
var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
687
|
+
const compare = require_compare();
|
|
688
|
+
const eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
689
|
+
module.exports = eq;
|
|
690
|
+
}));
|
|
691
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/neq.js
|
|
692
|
+
var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
693
|
+
const compare = require_compare();
|
|
694
|
+
const neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
695
|
+
module.exports = neq;
|
|
696
|
+
}));
|
|
697
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/gte.js
|
|
698
|
+
var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
699
|
+
const compare = require_compare();
|
|
700
|
+
const gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
701
|
+
module.exports = gte;
|
|
702
|
+
}));
|
|
703
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/lte.js
|
|
704
|
+
var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
705
|
+
const compare = require_compare();
|
|
706
|
+
const lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
707
|
+
module.exports = lte;
|
|
708
|
+
}));
|
|
709
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/cmp.js
|
|
710
|
+
var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
711
|
+
const eq = require_eq();
|
|
712
|
+
const neq = require_neq();
|
|
713
|
+
const gt = require_gt();
|
|
714
|
+
const gte = require_gte();
|
|
715
|
+
const lt = require_lt();
|
|
716
|
+
const lte = require_lte();
|
|
717
|
+
const cmp = (a, op, b, loose) => {
|
|
718
|
+
switch (op) {
|
|
719
|
+
case "===":
|
|
720
|
+
if (typeof a === "object") a = a.version;
|
|
721
|
+
if (typeof b === "object") b = b.version;
|
|
722
|
+
return a === b;
|
|
723
|
+
case "!==":
|
|
724
|
+
if (typeof a === "object") a = a.version;
|
|
725
|
+
if (typeof b === "object") b = b.version;
|
|
726
|
+
return a !== b;
|
|
727
|
+
case "":
|
|
728
|
+
case "=":
|
|
729
|
+
case "==": return eq(a, b, loose);
|
|
730
|
+
case "!=": return neq(a, b, loose);
|
|
731
|
+
case ">": return gt(a, b, loose);
|
|
732
|
+
case ">=": return gte(a, b, loose);
|
|
733
|
+
case "<": return lt(a, b, loose);
|
|
734
|
+
case "<=": return lte(a, b, loose);
|
|
735
|
+
default: throw new TypeError(`Invalid operator: ${op}`);
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
module.exports = cmp;
|
|
739
|
+
}));
|
|
740
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/coerce.js
|
|
741
|
+
var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
742
|
+
const SemVer = require_semver$1();
|
|
743
|
+
const parse = require_parse();
|
|
744
|
+
const { safeRe: re, t } = require_re();
|
|
745
|
+
const coerce = (version, options) => {
|
|
746
|
+
if (version instanceof SemVer) return version;
|
|
747
|
+
if (typeof version === "number") version = String(version);
|
|
748
|
+
if (typeof version !== "string") return null;
|
|
749
|
+
options = options || {};
|
|
750
|
+
let match = null;
|
|
751
|
+
if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
752
|
+
else {
|
|
753
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
754
|
+
let next;
|
|
755
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
756
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
|
|
757
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
758
|
+
}
|
|
759
|
+
coerceRtlRegex.lastIndex = -1;
|
|
760
|
+
}
|
|
761
|
+
if (match === null) return null;
|
|
762
|
+
const major = match[2];
|
|
763
|
+
const minor = match[3] || "0";
|
|
764
|
+
const patch = match[4] || "0";
|
|
765
|
+
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
766
|
+
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
767
|
+
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
768
|
+
};
|
|
769
|
+
module.exports = coerce;
|
|
770
|
+
}));
|
|
771
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/truncate.js
|
|
772
|
+
var require_truncate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
773
|
+
const parse = require_parse();
|
|
774
|
+
const constants = require_constants();
|
|
775
|
+
const SemVer = require_semver$1();
|
|
776
|
+
const truncate = (version, truncation, options) => {
|
|
777
|
+
if (!constants.RELEASE_TYPES.includes(truncation)) return null;
|
|
778
|
+
const clonedVersion = cloneInputVersion(version, options);
|
|
779
|
+
return clonedVersion && doTruncation(clonedVersion, truncation);
|
|
780
|
+
};
|
|
781
|
+
const cloneInputVersion = (version, options) => {
|
|
782
|
+
const versionStringToParse = version instanceof SemVer ? version.version : version;
|
|
783
|
+
return parse(versionStringToParse, options);
|
|
784
|
+
};
|
|
785
|
+
const doTruncation = (version, truncation) => {
|
|
786
|
+
if (isPrerelease(truncation)) return version.version;
|
|
787
|
+
version.prerelease = [];
|
|
788
|
+
switch (truncation) {
|
|
789
|
+
case "major":
|
|
790
|
+
version.minor = 0;
|
|
791
|
+
version.patch = 0;
|
|
792
|
+
break;
|
|
793
|
+
case "minor": version.patch = 0;
|
|
794
|
+
}
|
|
795
|
+
return version.format();
|
|
796
|
+
};
|
|
797
|
+
const isPrerelease = (type) => {
|
|
798
|
+
return type.startsWith("pre");
|
|
799
|
+
};
|
|
800
|
+
module.exports = truncate;
|
|
801
|
+
}));
|
|
802
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/lrucache.js
|
|
803
|
+
var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
804
|
+
var LRUCache = class {
|
|
805
|
+
constructor() {
|
|
806
|
+
this.max = 1e3;
|
|
807
|
+
this.map = /* @__PURE__ */ new Map();
|
|
808
|
+
}
|
|
809
|
+
get(key) {
|
|
810
|
+
const value = this.map.get(key);
|
|
811
|
+
if (value === void 0) return;
|
|
812
|
+
else {
|
|
813
|
+
this.map.delete(key);
|
|
814
|
+
this.map.set(key, value);
|
|
815
|
+
return value;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
delete(key) {
|
|
819
|
+
return this.map.delete(key);
|
|
820
|
+
}
|
|
821
|
+
set(key, value) {
|
|
822
|
+
if (!this.delete(key) && value !== void 0) {
|
|
823
|
+
if (this.map.size >= this.max) {
|
|
824
|
+
const firstKey = this.map.keys().next().value;
|
|
825
|
+
this.delete(firstKey);
|
|
826
|
+
}
|
|
827
|
+
this.map.set(key, value);
|
|
828
|
+
}
|
|
829
|
+
return this;
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
module.exports = LRUCache;
|
|
833
|
+
}));
|
|
834
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/internal/trim-comparator-whitespace.js
|
|
835
|
+
var require_trim_comparator_whitespace = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
836
|
+
const { MAX_LENGTH, MAX_SAFE_BUILD_LENGTH, WHITESPACE_CHARACTERS } = require_constants();
|
|
837
|
+
/**
|
|
838
|
+
* Remembers the last two rows of digits so their characters need not be reread.
|
|
839
|
+
* Positions start at -1 until a row has been found.
|
|
840
|
+
*
|
|
841
|
+
* @typedef {object} DigitRunCache
|
|
842
|
+
* @property {number} start The first character of the most recently found row.
|
|
843
|
+
* @property {number} end The position after that row's last character.
|
|
844
|
+
* @property {number} previousStart The first character of the previous row.
|
|
845
|
+
* @property {number} previousEnd The position after the previous row.
|
|
846
|
+
*/
|
|
847
|
+
const whitespace = /* @__PURE__ */ new Uint8Array(65536);
|
|
848
|
+
for (const char of WHITESPACE_CHARACTERS) whitespace[char.charCodeAt(0)] = 1;
|
|
849
|
+
/**
|
|
850
|
+
* Checks whether a character is whitespace, like a space, tab, or newline.
|
|
851
|
+
* Looking past the end of the string returns false.
|
|
852
|
+
*
|
|
853
|
+
* @param {string|undefined} char One character, or undefined past the string's end.
|
|
854
|
+
* @returns {boolean} Whether the character is whitespace.
|
|
855
|
+
* @example isWhitespace(' ') // true
|
|
856
|
+
* @example isWhitespace('1') // false
|
|
857
|
+
*/
|
|
858
|
+
const isWhitespace = (char) => char !== void 0 && whitespace[char.charCodeAt(0)] === 1;
|
|
859
|
+
/**
|
|
860
|
+
* Checks for v, =, or whitespace before the version number.
|
|
861
|
+
* These are historical version prefixes, not range operators:
|
|
862
|
+
* < and > are handled separately, as are tilde and caret ranges.
|
|
863
|
+
*
|
|
864
|
+
* @param {string|undefined} char One character to check.
|
|
865
|
+
* @returns {boolean} Whether the character can belong to a version prefix.
|
|
866
|
+
* @example isVersionPrefix('=') // true
|
|
867
|
+
* @example isVersionPrefix('>') // false
|
|
868
|
+
*/
|
|
869
|
+
const isVersionPrefix = (char) => char === "v" || char === "=" || isWhitespace(char);
|
|
870
|
+
/**
|
|
871
|
+
* Checks whether a character is one of the digits 0 through 9.
|
|
872
|
+
*
|
|
873
|
+
* @param {string|undefined} char One character to check.
|
|
874
|
+
* @returns {boolean} Whether the character is an ASCII digit.
|
|
875
|
+
* @example isDigit('7') // true
|
|
876
|
+
* @example isDigit('.') // false
|
|
877
|
+
*/
|
|
878
|
+
const isDigit = (char) => char !== void 0 && char >= "0" && char <= "9";
|
|
879
|
+
/**
|
|
880
|
+
* Checks whether a character is an English letter, uppercase or lowercase.
|
|
881
|
+
*
|
|
882
|
+
* @param {string|undefined} char One character to check.
|
|
883
|
+
* @returns {boolean} Whether the character is an ASCII letter.
|
|
884
|
+
* @example isLetter('b') // true
|
|
885
|
+
* @example isLetter('7') // false
|
|
886
|
+
*/
|
|
887
|
+
const isLetter = (char) => char !== void 0 && (char >= "a" && char <= "z" || char >= "A" && char <= "Z");
|
|
888
|
+
/**
|
|
889
|
+
* Checks for a letter, digit, or hyphen: the characters allowed inside
|
|
890
|
+
* prerelease and build names such as beta-1.
|
|
891
|
+
*
|
|
892
|
+
* @param {string|undefined} char One character to check.
|
|
893
|
+
* @returns {boolean} Whether the character can be part of an identifier.
|
|
894
|
+
* @example isIdentifierCharacter('-') // true
|
|
895
|
+
* @example isIdentifierCharacter('.') // false; dots separate identifiers
|
|
896
|
+
*/
|
|
897
|
+
const isIdentifierCharacter = (char) => isDigit(char) || isLetter(char) || char === "-";
|
|
898
|
+
/**
|
|
899
|
+
* Checks whether a version component can begin here: with a digit or
|
|
900
|
+
* a wildcard such as x, X, or *.
|
|
901
|
+
*
|
|
902
|
+
* @param {string|undefined} char One character to check.
|
|
903
|
+
* @returns {boolean} Whether a number or wildcard can start with this character.
|
|
904
|
+
* @example isVersionStart('x') // true
|
|
905
|
+
* @example isVersionStart('v') // false; v belongs to the prefix
|
|
906
|
+
*/
|
|
907
|
+
const isVersionStart = (char) => isDigit(char) || char === "x" || char === "X" || char === "*";
|
|
908
|
+
/**
|
|
909
|
+
* Finds the end of a row of digits, but returns no more than limit digits.
|
|
910
|
+
* Remembers the last two rows so looking at them again does not reread them.
|
|
911
|
+
*
|
|
912
|
+
* @param {string} range The text to read; it is not changed.
|
|
913
|
+
* @param {number} start The position of the first character to check.
|
|
914
|
+
* @param {number} limit The most digit characters the returned match can include.
|
|
915
|
+
* @param {DigitRunCache} digitRuns Shared cache of digit-run positions, updated in place.
|
|
916
|
+
* @returns {number} The position after the matched digits, or start if none match.
|
|
917
|
+
* @example findDigitsEndIndex('123abc', 0, 10, digitRuns) // 3, pointing at a
|
|
918
|
+
* @example findDigitsEndIndex('123abc', 0, 2, digitRuns) // 2, pointing at the unread 3
|
|
919
|
+
*/
|
|
920
|
+
const findDigitsEndIndex = (range, start, limit, digitRuns) => {
|
|
921
|
+
if (!isDigit(range[start])) return start;
|
|
922
|
+
if (start >= digitRuns.start && start < digitRuns.end) return Math.min(start + limit, digitRuns.end);
|
|
923
|
+
if (start >= digitRuns.previousStart && start < digitRuns.previousEnd) return Math.min(start + limit, digitRuns.previousEnd);
|
|
924
|
+
let end = start + 1;
|
|
925
|
+
while (isDigit(range[end])) end++;
|
|
926
|
+
digitRuns.previousStart = digitRuns.start;
|
|
927
|
+
digitRuns.previousEnd = digitRuns.end;
|
|
928
|
+
digitRuns.start = start;
|
|
929
|
+
digitRuns.end = end;
|
|
930
|
+
return Math.min(start + limit, end);
|
|
931
|
+
};
|
|
932
|
+
/**
|
|
933
|
+
* Reads a number using the old regex's length and leading-zero rules.
|
|
934
|
+
* Strict mode reads just the first zero in 012; loose mode can read all three.
|
|
935
|
+
*
|
|
936
|
+
* @param {string} range The text to read; it is not changed.
|
|
937
|
+
* @param {number} start The position where the number should begin.
|
|
938
|
+
* @param {boolean} loose Whether to allow leading zeros.
|
|
939
|
+
* @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
|
|
940
|
+
* @returns {number} The position after the matched digits, not their numeric value.
|
|
941
|
+
* @example findVersionNumberEndIndex('012', 0, false, digitRuns) // 1
|
|
942
|
+
* @example findVersionNumberEndIndex('012', 0, true, digitRuns) // 3
|
|
943
|
+
*/
|
|
944
|
+
const findVersionNumberEndIndex = (range, start, loose, digitRuns) => {
|
|
945
|
+
if (!loose && range[start] === "0") return start + 1;
|
|
946
|
+
return findDigitsEndIndex(range, start, loose ? MAX_LENGTH : MAX_LENGTH + 1, digitRuns);
|
|
947
|
+
};
|
|
948
|
+
/**
|
|
949
|
+
* Reads one piece of a prerelease name, such as beta or 1 in beta.1.
|
|
950
|
+
* Tries the letter-or-hyphen form first, then the number-only form.
|
|
951
|
+
*
|
|
952
|
+
* @param {string} range The text to read; it is not changed.
|
|
953
|
+
* @param {number} start The position where the identifier should begin.
|
|
954
|
+
* @param {boolean} loose Whether numeric identifiers may have leading zeros.
|
|
955
|
+
* @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
|
|
956
|
+
* @returns {number} The position after the identifier, or start if none matches.
|
|
957
|
+
* @example findPrereleaseIdentifierEndIndex('beta.1', 0, false, digitRuns) // 4, at the dot
|
|
958
|
+
* @example findPrereleaseIdentifierEndIndex('001beta', 0, false, digitRuns) // 7
|
|
959
|
+
*/
|
|
960
|
+
const findPrereleaseIdentifierEndIndex = (range, start, loose, digitRuns) => {
|
|
961
|
+
const digitsEnd = findDigitsEndIndex(range, start, MAX_LENGTH, digitRuns);
|
|
962
|
+
if (isLetter(range[digitsEnd]) || range[digitsEnd] === "-") {
|
|
963
|
+
let end = digitsEnd + 1;
|
|
964
|
+
const limit = end + MAX_SAFE_BUILD_LENGTH;
|
|
965
|
+
while (end < limit && isIdentifierCharacter(range[end])) end++;
|
|
966
|
+
return end;
|
|
967
|
+
}
|
|
968
|
+
return findVersionNumberEndIndex(range, start, loose, digitRuns);
|
|
969
|
+
};
|
|
970
|
+
/**
|
|
971
|
+
* Reads a prerelease suffix such as -beta.1, one dot-separated piece at a time.
|
|
972
|
+
* Loose mode also allows the name without its opening hyphen.
|
|
973
|
+
*
|
|
974
|
+
* @param {string} range The text to read; it is not changed.
|
|
975
|
+
* @param {number} start The position where the suffix should begin, including -.
|
|
976
|
+
* @param {boolean} loose Whether the opening hyphen is optional and zeros allowed.
|
|
977
|
+
* @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
|
|
978
|
+
* @returns {number} The position after the matched suffix, or start if absent.
|
|
979
|
+
* @example findPrereleaseEndIndex('-beta.1+sha', 0, false, digitRuns) // 7, at the plus
|
|
980
|
+
* @example findPrereleaseEndIndex('beta', 0, false, digitRuns) // 0; no opening hyphen
|
|
981
|
+
*/
|
|
982
|
+
const findPrereleaseEndIndex = (range, start, loose, digitRuns) => {
|
|
983
|
+
const hyphen = range[start] === "-";
|
|
984
|
+
if (!loose && !hyphen) return start;
|
|
985
|
+
const identifierStart = start + (hyphen ? 1 : 0);
|
|
986
|
+
let end = findPrereleaseIdentifierEndIndex(range, identifierStart, loose, digitRuns);
|
|
987
|
+
if (end === identifierStart) {
|
|
988
|
+
if (!loose || !hyphen) return start;
|
|
989
|
+
end = findPrereleaseIdentifierEndIndex(range, start, loose, digitRuns);
|
|
990
|
+
}
|
|
991
|
+
while (range[end] === ".") {
|
|
992
|
+
const next = findPrereleaseIdentifierEndIndex(range, end + 1, loose, digitRuns);
|
|
993
|
+
if (next === end + 1) break;
|
|
994
|
+
end = next;
|
|
995
|
+
}
|
|
996
|
+
return end;
|
|
997
|
+
};
|
|
998
|
+
/**
|
|
999
|
+
* Reads one build-name piece, such as sha or 123 in +sha.123.
|
|
1000
|
+
* Stops at a disallowed character or the old regex's length limit.
|
|
1001
|
+
*
|
|
1002
|
+
* @param {string} range The text to read; it is not changed.
|
|
1003
|
+
* @param {number} start The position where the identifier should begin.
|
|
1004
|
+
* @returns {number} The position after the identifier, or start if none matches.
|
|
1005
|
+
* @example findBuildIdentifierEndIndex('sha.123', 0) // 3, at the dot
|
|
1006
|
+
* @example findBuildIdentifierEndIndex('001', 0) // 3; leading zeros are allowed
|
|
1007
|
+
*/
|
|
1008
|
+
const findBuildIdentifierEndIndex = (range, start) => {
|
|
1009
|
+
let end = start;
|
|
1010
|
+
while (end - start < MAX_SAFE_BUILD_LENGTH && isIdentifierCharacter(range[end])) end++;
|
|
1011
|
+
return end;
|
|
1012
|
+
};
|
|
1013
|
+
/**
|
|
1014
|
+
* Reads optional build metadata such as +sha.123.
|
|
1015
|
+
* Leaves the position unchanged if there is no plus sign followed by a name.
|
|
1016
|
+
*
|
|
1017
|
+
* @param {string} range The text to read; it is not changed.
|
|
1018
|
+
* @param {number} start The position where the opening + should be.
|
|
1019
|
+
* @returns {number} The position after the matched metadata, or start if absent.
|
|
1020
|
+
* @example findBuildEndIndex('+sha.123 <2', 0) // 8, at the space
|
|
1021
|
+
* @example findBuildEndIndex('+', 0) // 0; a plus sign alone is not a match
|
|
1022
|
+
*/
|
|
1023
|
+
const findBuildEndIndex = (range, start) => {
|
|
1024
|
+
if (range[start] !== "+") return start;
|
|
1025
|
+
let end = findBuildIdentifierEndIndex(range, start + 1);
|
|
1026
|
+
if (end === start + 1) return start;
|
|
1027
|
+
while (range[end] === ".") {
|
|
1028
|
+
const next = findBuildIdentifierEndIndex(range, end + 1);
|
|
1029
|
+
if (next === end + 1) break;
|
|
1030
|
+
end = next;
|
|
1031
|
+
}
|
|
1032
|
+
return end;
|
|
1033
|
+
};
|
|
1034
|
+
/**
|
|
1035
|
+
* Reads three numbers separated by dots, then any prerelease and build suffixes.
|
|
1036
|
+
* Uses loose rules, so forms such as 01.02.03beta can match here.
|
|
1037
|
+
*
|
|
1038
|
+
* @param {string} range The text to read; it is not changed.
|
|
1039
|
+
* @param {number} start The position of the first number, after any prefix.
|
|
1040
|
+
* @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
|
|
1041
|
+
* @returns {number} The position after the version match, or start if none matches.
|
|
1042
|
+
* @example findLooseFullVersionEndIndex('1.2.3-beta+sha <2', 0, digitRuns) // 14
|
|
1043
|
+
* @example findLooseFullVersionEndIndex('1.2', 0, digitRuns) // 0; needs three numbers
|
|
1044
|
+
*/
|
|
1045
|
+
const findLooseFullVersionEndIndex = (range, start, digitRuns) => {
|
|
1046
|
+
let end = start;
|
|
1047
|
+
for (let component = 0; component < 3; component++) {
|
|
1048
|
+
const next = findVersionNumberEndIndex(range, end, true, digitRuns);
|
|
1049
|
+
if (next === end) return start;
|
|
1050
|
+
end = next;
|
|
1051
|
+
if (component < 2) {
|
|
1052
|
+
if (range[end] !== ".") return start;
|
|
1053
|
+
end++;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
const prereleaseEnd = findPrereleaseEndIndex(range, end, true, digitRuns);
|
|
1057
|
+
return findBuildEndIndex(range, prereleaseEnd);
|
|
1058
|
+
};
|
|
1059
|
+
/**
|
|
1060
|
+
* Reads one component of a partial or wildcard version, such as 2 or x in 2.x.
|
|
1061
|
+
* Numbers use strict leading-zero rules; wildcards take up one character.
|
|
1062
|
+
*
|
|
1063
|
+
* @param {string} range The text to read; it is not changed.
|
|
1064
|
+
* @param {number} start The position where the component should begin.
|
|
1065
|
+
* @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
|
|
1066
|
+
* @returns {number} The position after the component, or start if none matches.
|
|
1067
|
+
* @example findPartialVersionComponentEndIndex('2.x', 0, digitRuns) // 1, at the dot
|
|
1068
|
+
* @example findPartialVersionComponentEndIndex('2.x', 2, digitRuns) // 3, after x
|
|
1069
|
+
*/
|
|
1070
|
+
const findPartialVersionComponentEndIndex = (range, start, digitRuns) => {
|
|
1071
|
+
if (isDigit(range[start])) return findVersionNumberEndIndex(range, start, false, digitRuns);
|
|
1072
|
+
return isVersionStart(range[start]) ? start + 1 : start;
|
|
1073
|
+
};
|
|
1074
|
+
/**
|
|
1075
|
+
* Reads up to three components, allowing forms such as 1, 1.2, or 1.x.
|
|
1076
|
+
* After the third component, also reads any strict prerelease and build suffixes.
|
|
1077
|
+
*
|
|
1078
|
+
* @param {string} range The text to read; it is not changed.
|
|
1079
|
+
* @param {number} start The position of a number or wildcard, after any prefix.
|
|
1080
|
+
* @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
|
|
1081
|
+
* @returns {number} The position after the matched version text.
|
|
1082
|
+
* @example findPartialVersionEndIndex('1.x <2', 0, digitRuns) // 3, at the space
|
|
1083
|
+
* @example findPartialVersionEndIndex('1.', 0, digitRuns) // 1; the trailing dot is unread
|
|
1084
|
+
*/
|
|
1085
|
+
const findPartialVersionEndIndex = (range, start, digitRuns) => {
|
|
1086
|
+
let end = findPartialVersionComponentEndIndex(range, start, digitRuns);
|
|
1087
|
+
for (let component = 0; component < 2; component++) {
|
|
1088
|
+
if (range[end] !== ".") return end;
|
|
1089
|
+
const next = findPartialVersionComponentEndIndex(range, end + 1, digitRuns);
|
|
1090
|
+
if (next === end + 1) return end;
|
|
1091
|
+
end = next;
|
|
1092
|
+
}
|
|
1093
|
+
const prereleaseEnd = findPrereleaseEndIndex(range, end, false, digitRuns);
|
|
1094
|
+
return findBuildEndIndex(range, prereleaseEnd);
|
|
1095
|
+
};
|
|
1096
|
+
/**
|
|
1097
|
+
* Finds where a version match ends, without deciding whether the range is valid.
|
|
1098
|
+
* Tries a loose full version first, then a partial or wildcard version, just
|
|
1099
|
+
* like the old regex's LOOSEPLAIN and XRANGEPLAIN alternatives.
|
|
1100
|
+
*
|
|
1101
|
+
* @param {string} range The text to read; it is not changed.
|
|
1102
|
+
* @param {number} start The position of a number or wildcard, after any prefix.
|
|
1103
|
+
* @param {DigitRunCache} digitRuns Shared digit-run cache, updated as needed.
|
|
1104
|
+
* @returns {number} The position where scanning the next candidate can resume.
|
|
1105
|
+
* @example findVersionEndIndex('1.2.3 <2', 0, digitRuns) // 5, at the space
|
|
1106
|
+
* @example findVersionEndIndex('1.x <2', 0, digitRuns) // 3, at the space
|
|
1107
|
+
*/
|
|
1108
|
+
const findVersionEndIndex = (range, start, digitRuns) => {
|
|
1109
|
+
const fullVersionEnd = findLooseFullVersionEndIndex(range, start, digitRuns);
|
|
1110
|
+
return fullVersionEnd !== start ? fullVersionEnd : findPartialVersionEndIndex(range, start, digitRuns);
|
|
1111
|
+
};
|
|
1112
|
+
/**
|
|
1113
|
+
* Finds the one whitespace character the old replacement would remove.
|
|
1114
|
+
* Keeps leading whitespace, skips an optional operator, and checks immediately
|
|
1115
|
+
* after it. Returns -1 if there is nothing to remove.
|
|
1116
|
+
*
|
|
1117
|
+
* @param {string} range The text containing a candidate already found by the caller.
|
|
1118
|
+
* @param {number} matchStart The candidate's position, including leading whitespace.
|
|
1119
|
+
* @returns {number} The position of the removable whitespace, or -1 if absent.
|
|
1120
|
+
* @example findRemovableWhitespaceIndex(' > 1', 0) // 2; keep the space at position 0
|
|
1121
|
+
* @example findRemovableWhitespaceIndex('>1', 0) // -1
|
|
1122
|
+
*/
|
|
1123
|
+
const findRemovableWhitespaceIndex = (range, matchStart) => {
|
|
1124
|
+
let position = matchStart;
|
|
1125
|
+
if (isWhitespace(range[position])) position++;
|
|
1126
|
+
if (range[position] === "<" || range[position] === ">") position++;
|
|
1127
|
+
if (range[position] === "=") position++;
|
|
1128
|
+
return isWhitespace(range[position]) ? position : -1;
|
|
1129
|
+
};
|
|
1130
|
+
/**
|
|
1131
|
+
* Joins an operator to its version, turning > 1.2.3 into >1.2.3.
|
|
1132
|
+
* Copies everything else according to the old regex's matching rules.
|
|
1133
|
+
* Moves forward through prefixes and whole versions to avoid repeatedly
|
|
1134
|
+
* searching the same characters on long inputs.
|
|
1135
|
+
*
|
|
1136
|
+
* @param {string} range The range text to process; the original string is unchanged.
|
|
1137
|
+
* @returns {string} The range with matched operator whitespace removed.
|
|
1138
|
+
* @example trimComparatorWhitespace('> 1.2.3 < 2') // '>1.2.3 <2'
|
|
1139
|
+
* @example trimComparatorWhitespace('> invalid') // '> invalid'
|
|
1140
|
+
*/
|
|
1141
|
+
const trimComparatorWhitespace = (range) => {
|
|
1142
|
+
let result = "";
|
|
1143
|
+
let copyFrom = 0;
|
|
1144
|
+
let cursor = 0;
|
|
1145
|
+
const digitRuns = {
|
|
1146
|
+
start: -1,
|
|
1147
|
+
end: -1,
|
|
1148
|
+
previousStart: -1,
|
|
1149
|
+
previousEnd: -1
|
|
1150
|
+
};
|
|
1151
|
+
while (cursor < range.length) {
|
|
1152
|
+
const matchStart = cursor;
|
|
1153
|
+
if (range[cursor] === "<" || range[cursor] === ">") cursor++;
|
|
1154
|
+
else if (!isVersionPrefix(range[cursor]) && !isVersionStart(range[cursor])) {
|
|
1155
|
+
cursor++;
|
|
1156
|
+
continue;
|
|
1157
|
+
}
|
|
1158
|
+
while (cursor < range.length && isVersionPrefix(range[cursor])) cursor++;
|
|
1159
|
+
if (!isVersionStart(range[cursor])) continue;
|
|
1160
|
+
const whitespacePosition = findRemovableWhitespaceIndex(range, matchStart);
|
|
1161
|
+
if (whitespacePosition !== -1) {
|
|
1162
|
+
result += range.slice(copyFrom, whitespacePosition);
|
|
1163
|
+
copyFrom = whitespacePosition + 1;
|
|
1164
|
+
}
|
|
1165
|
+
cursor = findVersionEndIndex(range, cursor, digitRuns);
|
|
1166
|
+
}
|
|
1167
|
+
return result + range.slice(copyFrom);
|
|
1168
|
+
};
|
|
1169
|
+
module.exports = trimComparatorWhitespace;
|
|
1170
|
+
}));
|
|
1171
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/classes/range.js
|
|
1172
|
+
var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1173
|
+
const SPACE_CHARACTERS = /\s+/g;
|
|
1174
|
+
module.exports = class Range {
|
|
1175
|
+
constructor(range, options) {
|
|
1176
|
+
options = parseOptions(options);
|
|
1177
|
+
if (range instanceof Range) {
|
|
1178
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
|
|
1179
|
+
else return new Range(range.raw, options);
|
|
1180
|
+
}
|
|
1181
|
+
if (range instanceof Comparator) {
|
|
1182
|
+
this.raw = range.value;
|
|
1183
|
+
this.set = [[range]];
|
|
1184
|
+
this.formatted = void 0;
|
|
1185
|
+
return this;
|
|
1186
|
+
}
|
|
1187
|
+
this.options = options;
|
|
1188
|
+
this.loose = !!options.loose;
|
|
1189
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
1190
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
1191
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
1192
|
+
if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
1193
|
+
if (this.set.length > 1) {
|
|
1194
|
+
const first = this.set[0];
|
|
1195
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
1196
|
+
if (this.set.length === 0) this.set = [first];
|
|
1197
|
+
else if (this.set.length > 1) {
|
|
1198
|
+
for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
|
|
1199
|
+
this.set = [c];
|
|
1200
|
+
break;
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
this.formatted = void 0;
|
|
1205
|
+
}
|
|
1206
|
+
get range() {
|
|
1207
|
+
if (this.formatted === void 0) {
|
|
1208
|
+
this.formatted = "";
|
|
1209
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
1210
|
+
if (i > 0) this.formatted += "||";
|
|
1211
|
+
const comps = this.set[i];
|
|
1212
|
+
for (let k = 0; k < comps.length; k++) {
|
|
1213
|
+
if (k > 0) this.formatted += " ";
|
|
1214
|
+
this.formatted += comps[k].toString().trim();
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
return this.formatted;
|
|
1219
|
+
}
|
|
1220
|
+
format() {
|
|
1221
|
+
return this.range;
|
|
1222
|
+
}
|
|
1223
|
+
toString() {
|
|
1224
|
+
return this.range;
|
|
1225
|
+
}
|
|
1226
|
+
parseRange(range) {
|
|
1227
|
+
range = range.replace(BUILDSTRIPRE, "");
|
|
1228
|
+
const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
|
|
1229
|
+
const cached = cache.get(memoKey);
|
|
1230
|
+
if (cached) return cached;
|
|
1231
|
+
const loose = this.options.loose;
|
|
1232
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
1233
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
1234
|
+
debug("hyphen replace", range);
|
|
1235
|
+
range = trimComparatorWhitespace(range);
|
|
1236
|
+
debug("comparator trim", range);
|
|
1237
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
1238
|
+
debug("tilde trim", range);
|
|
1239
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
1240
|
+
debug("caret trim", range);
|
|
1241
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
1242
|
+
if (loose) rangeList = rangeList.filter((comp) => {
|
|
1243
|
+
debug("loose invalid filter", comp, this.options);
|
|
1244
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
1245
|
+
});
|
|
1246
|
+
debug("range list", rangeList);
|
|
1247
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
1248
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
1249
|
+
for (const comp of comparators) {
|
|
1250
|
+
if (isNullSet(comp)) return [comp];
|
|
1251
|
+
rangeMap.set(comp.value, comp);
|
|
1252
|
+
}
|
|
1253
|
+
if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
|
|
1254
|
+
const result = [...rangeMap.values()];
|
|
1255
|
+
cache.set(memoKey, result);
|
|
1256
|
+
return result;
|
|
1257
|
+
}
|
|
1258
|
+
intersects(range, options) {
|
|
1259
|
+
if (!(range instanceof Range)) throw new TypeError("a Range is required");
|
|
1260
|
+
return this.set.some((thisComparators) => {
|
|
1261
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
1262
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
1263
|
+
return rangeComparators.every((rangeComparator) => {
|
|
1264
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
1265
|
+
});
|
|
1266
|
+
});
|
|
1267
|
+
});
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
test(version) {
|
|
1271
|
+
if (!version) return false;
|
|
1272
|
+
if (typeof version === "string") try {
|
|
1273
|
+
version = new SemVer(version, this.options);
|
|
1274
|
+
} catch (er) {
|
|
1275
|
+
return false;
|
|
1276
|
+
}
|
|
1277
|
+
for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
|
|
1278
|
+
return false;
|
|
1279
|
+
}
|
|
1280
|
+
};
|
|
1281
|
+
const cache = new (require_lrucache())();
|
|
1282
|
+
const parseOptions = require_parse_options();
|
|
1283
|
+
const Comparator = require_comparator();
|
|
1284
|
+
const debug = require_debug();
|
|
1285
|
+
const SemVer = require_semver$1();
|
|
1286
|
+
const trimComparatorWhitespace = require_trim_comparator_whitespace();
|
|
1287
|
+
const { safeRe: re, src, t, tildeTrimReplace, caretTrimReplace } = require_re();
|
|
1288
|
+
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
1289
|
+
const BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
|
|
1290
|
+
const isNullSet = (c) => c.value === "<0.0.0-0";
|
|
1291
|
+
const isAny = (c) => c.value === "";
|
|
1292
|
+
const isSatisfiable = (comparators, options) => {
|
|
1293
|
+
let result = true;
|
|
1294
|
+
const remainingComparators = comparators.slice();
|
|
1295
|
+
let testComparator = remainingComparators.pop();
|
|
1296
|
+
while (result && remainingComparators.length) {
|
|
1297
|
+
result = remainingComparators.every((otherComparator) => {
|
|
1298
|
+
return testComparator.intersects(otherComparator, options);
|
|
1299
|
+
});
|
|
1300
|
+
testComparator = remainingComparators.pop();
|
|
1301
|
+
}
|
|
1302
|
+
return result;
|
|
1303
|
+
};
|
|
1304
|
+
const parseComparator = (comp, options) => {
|
|
1305
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
1306
|
+
debug("comp", comp, options);
|
|
1307
|
+
comp = replaceCarets(comp, options);
|
|
1308
|
+
debug("caret", comp);
|
|
1309
|
+
comp = replaceTildes(comp, options);
|
|
1310
|
+
debug("tildes", comp);
|
|
1311
|
+
comp = replaceXRanges(comp, options);
|
|
1312
|
+
debug("xrange", comp);
|
|
1313
|
+
comp = replaceStars(comp, options);
|
|
1314
|
+
debug("stars", comp);
|
|
1315
|
+
return comp;
|
|
1316
|
+
};
|
|
1317
|
+
const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
1318
|
+
const invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
|
|
1319
|
+
const replaceTildes = (comp, options) => {
|
|
1320
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
1321
|
+
};
|
|
1322
|
+
const replaceTilde = (comp, options) => {
|
|
1323
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
1324
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
1325
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1326
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
1327
|
+
let ret;
|
|
1328
|
+
if (isX(M)) ret = "";
|
|
1329
|
+
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
1330
|
+
else if (isX(p)) ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
1331
|
+
else if (pr) {
|
|
1332
|
+
debug("replaceTilde pr", pr);
|
|
1333
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
1334
|
+
} else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
1335
|
+
debug("tilde return", ret);
|
|
1336
|
+
return ret;
|
|
1337
|
+
});
|
|
1338
|
+
};
|
|
1339
|
+
const replaceCarets = (comp, options) => {
|
|
1340
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
1341
|
+
};
|
|
1342
|
+
const replaceCaret = (comp, options) => {
|
|
1343
|
+
debug("caret", comp, options);
|
|
1344
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
1345
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
1346
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1347
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
1348
|
+
let ret;
|
|
1349
|
+
if (isX(M)) ret = "";
|
|
1350
|
+
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
1351
|
+
else if (isX(p)) {
|
|
1352
|
+
if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
1353
|
+
else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
1354
|
+
} else if (pr) {
|
|
1355
|
+
debug("replaceCaret pr", pr);
|
|
1356
|
+
if (M === "0") {
|
|
1357
|
+
if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
1358
|
+
else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
1359
|
+
} else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
1360
|
+
} else {
|
|
1361
|
+
debug("no pr");
|
|
1362
|
+
if (M === "0") {
|
|
1363
|
+
if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
|
|
1364
|
+
else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
1365
|
+
} else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
1366
|
+
}
|
|
1367
|
+
debug("caret return", ret);
|
|
1368
|
+
return ret;
|
|
1369
|
+
});
|
|
1370
|
+
};
|
|
1371
|
+
const replaceXRanges = (comp, options) => {
|
|
1372
|
+
debug("replaceXRanges", comp, options);
|
|
1373
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
1374
|
+
};
|
|
1375
|
+
const replaceXRange = (comp, options) => {
|
|
1376
|
+
comp = comp.trim();
|
|
1377
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
1378
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
1379
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
1380
|
+
if (invalidXRangeOrder(M, m, p)) return comp;
|
|
1381
|
+
const xM = isX(M);
|
|
1382
|
+
const xm = xM || isX(m);
|
|
1383
|
+
const xp = xm || isX(p);
|
|
1384
|
+
const anyX = xp;
|
|
1385
|
+
if (gtlt === "=" && anyX) gtlt = "";
|
|
1386
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
1387
|
+
if (xM) {
|
|
1388
|
+
if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
|
|
1389
|
+
else ret = "*";
|
|
1390
|
+
} else if (gtlt && anyX) {
|
|
1391
|
+
if (xm) m = 0;
|
|
1392
|
+
p = 0;
|
|
1393
|
+
if (gtlt === ">") {
|
|
1394
|
+
gtlt = ">=";
|
|
1395
|
+
if (xm) {
|
|
1396
|
+
M = +M + 1;
|
|
1397
|
+
m = 0;
|
|
1398
|
+
p = 0;
|
|
1399
|
+
} else {
|
|
1400
|
+
m = +m + 1;
|
|
1401
|
+
p = 0;
|
|
1402
|
+
}
|
|
1403
|
+
} else if (gtlt === "<=") {
|
|
1404
|
+
gtlt = "<";
|
|
1405
|
+
if (xm) M = +M + 1;
|
|
1406
|
+
else m = +m + 1;
|
|
1407
|
+
}
|
|
1408
|
+
if (gtlt === "<") pr = "-0";
|
|
1409
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
1410
|
+
} else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
1411
|
+
else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
1412
|
+
debug("xRange return", ret);
|
|
1413
|
+
return ret;
|
|
1414
|
+
});
|
|
1415
|
+
};
|
|
1416
|
+
const replaceStars = (comp, options) => {
|
|
1417
|
+
debug("replaceStars", comp, options);
|
|
1418
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
1419
|
+
};
|
|
1420
|
+
const replaceGTE0 = (comp, options) => {
|
|
1421
|
+
debug("replaceGTE0", comp, options);
|
|
1422
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
1423
|
+
};
|
|
1424
|
+
const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
1425
|
+
if (isX(fM)) from = "";
|
|
1426
|
+
else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
1427
|
+
else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
1428
|
+
else if (fpr) from = `>=${from}`;
|
|
1429
|
+
else from = `>=${from}${incPr ? "-0" : ""}`;
|
|
1430
|
+
if (isX(tM)) to = "";
|
|
1431
|
+
else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
|
|
1432
|
+
else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
|
|
1433
|
+
else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
1434
|
+
else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
1435
|
+
else to = `<=${to}`;
|
|
1436
|
+
return `${from} ${to}`.trim();
|
|
1437
|
+
};
|
|
1438
|
+
const testSet = (set, version, options) => {
|
|
1439
|
+
for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
|
|
1440
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
1441
|
+
for (let i = 0; i < set.length; i++) {
|
|
1442
|
+
debug(set[i].semver);
|
|
1443
|
+
if (set[i].semver === Comparator.ANY) continue;
|
|
1444
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
1445
|
+
const allowed = set[i].semver;
|
|
1446
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
return false;
|
|
1450
|
+
}
|
|
1451
|
+
return true;
|
|
1452
|
+
};
|
|
1453
|
+
}));
|
|
1454
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/classes/comparator.js
|
|
1455
|
+
var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1456
|
+
const ANY = Symbol("SemVer ANY");
|
|
1457
|
+
module.exports = class Comparator {
|
|
1458
|
+
static get ANY() {
|
|
1459
|
+
return ANY;
|
|
1460
|
+
}
|
|
1461
|
+
constructor(comp, options) {
|
|
1462
|
+
options = parseOptions(options);
|
|
1463
|
+
if (comp instanceof Comparator) {
|
|
1464
|
+
if (comp.loose === !!options.loose) return comp;
|
|
1465
|
+
else comp = comp.value;
|
|
1466
|
+
}
|
|
1467
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
1468
|
+
debug("comparator", comp, options);
|
|
1469
|
+
this.options = options;
|
|
1470
|
+
this.loose = !!options.loose;
|
|
1471
|
+
this.parse(comp);
|
|
1472
|
+
if (this.semver === ANY) this.value = "";
|
|
1473
|
+
else this.value = this.operator + this.semver.version;
|
|
1474
|
+
debug("comp", this);
|
|
1475
|
+
}
|
|
1476
|
+
parse(comp) {
|
|
1477
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
1478
|
+
const m = comp.match(r);
|
|
1479
|
+
if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
|
|
1480
|
+
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
1481
|
+
if (this.operator === "=") this.operator = "";
|
|
1482
|
+
if (!m[2]) this.semver = ANY;
|
|
1483
|
+
else this.semver = new SemVer(m[2], this.options.loose);
|
|
1484
|
+
}
|
|
1485
|
+
toString() {
|
|
1486
|
+
return this.value;
|
|
1487
|
+
}
|
|
1488
|
+
test(version) {
|
|
1489
|
+
debug("Comparator.test", version, this.options.loose);
|
|
1490
|
+
if (this.semver === ANY || version === ANY) return true;
|
|
1491
|
+
if (typeof version === "string") try {
|
|
1492
|
+
version = new SemVer(version, this.options);
|
|
1493
|
+
} catch (er) {
|
|
1494
|
+
return false;
|
|
1495
|
+
}
|
|
1496
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
1497
|
+
}
|
|
1498
|
+
intersects(comp, options) {
|
|
1499
|
+
if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
|
|
1500
|
+
if (this.operator === "") {
|
|
1501
|
+
if (this.value === "") return true;
|
|
1502
|
+
return new Range(comp.value, options).test(this.value);
|
|
1503
|
+
} else if (comp.operator === "") {
|
|
1504
|
+
if (comp.value === "") return true;
|
|
1505
|
+
return new Range(this.value, options).test(comp.semver);
|
|
1506
|
+
}
|
|
1507
|
+
options = parseOptions(options);
|
|
1508
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
|
|
1509
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
|
|
1510
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
|
|
1511
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
|
|
1512
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
|
|
1513
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
|
|
1514
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
|
|
1515
|
+
return false;
|
|
1516
|
+
}
|
|
1517
|
+
};
|
|
1518
|
+
const parseOptions = require_parse_options();
|
|
1519
|
+
const { safeRe: re, t } = require_re();
|
|
1520
|
+
const cmp = require_cmp();
|
|
1521
|
+
const debug = require_debug();
|
|
1522
|
+
const SemVer = require_semver$1();
|
|
1523
|
+
const Range = require_range();
|
|
1524
|
+
}));
|
|
1525
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/functions/satisfies.js
|
|
1526
|
+
var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1527
|
+
const Range = require_range();
|
|
1528
|
+
const satisfies = (version, range, options) => {
|
|
1529
|
+
try {
|
|
1530
|
+
range = new Range(range, options);
|
|
1531
|
+
} catch (er) {
|
|
1532
|
+
return false;
|
|
1533
|
+
}
|
|
1534
|
+
return range.test(version);
|
|
1535
|
+
};
|
|
1536
|
+
module.exports = satisfies;
|
|
1537
|
+
}));
|
|
1538
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/to-comparators.js
|
|
1539
|
+
var require_to_comparators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1540
|
+
const Range = require_range();
|
|
1541
|
+
const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
1542
|
+
module.exports = toComparators;
|
|
1543
|
+
}));
|
|
1544
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/max-satisfying.js
|
|
1545
|
+
var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1546
|
+
const SemVer = require_semver$1();
|
|
1547
|
+
const Range = require_range();
|
|
1548
|
+
const maxSatisfying = (versions, range, options) => {
|
|
1549
|
+
let max = null;
|
|
1550
|
+
let maxSV = null;
|
|
1551
|
+
let rangeObj = null;
|
|
1552
|
+
try {
|
|
1553
|
+
rangeObj = new Range(range, options);
|
|
1554
|
+
} catch (er) {
|
|
1555
|
+
return null;
|
|
1556
|
+
}
|
|
1557
|
+
versions.forEach((v) => {
|
|
1558
|
+
if (rangeObj.test(v)) {
|
|
1559
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
1560
|
+
max = v;
|
|
1561
|
+
maxSV = new SemVer(max, options);
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
});
|
|
1565
|
+
return max;
|
|
1566
|
+
};
|
|
1567
|
+
module.exports = maxSatisfying;
|
|
1568
|
+
}));
|
|
1569
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/min-satisfying.js
|
|
1570
|
+
var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1571
|
+
const SemVer = require_semver$1();
|
|
1572
|
+
const Range = require_range();
|
|
1573
|
+
const minSatisfying = (versions, range, options) => {
|
|
1574
|
+
let min = null;
|
|
1575
|
+
let minSV = null;
|
|
1576
|
+
let rangeObj = null;
|
|
1577
|
+
try {
|
|
1578
|
+
rangeObj = new Range(range, options);
|
|
1579
|
+
} catch (er) {
|
|
1580
|
+
return null;
|
|
1581
|
+
}
|
|
1582
|
+
versions.forEach((v) => {
|
|
1583
|
+
if (rangeObj.test(v)) {
|
|
1584
|
+
if (!min || minSV.compare(v) === 1) {
|
|
1585
|
+
min = v;
|
|
1586
|
+
minSV = new SemVer(min, options);
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
});
|
|
1590
|
+
return min;
|
|
1591
|
+
};
|
|
1592
|
+
module.exports = minSatisfying;
|
|
1593
|
+
}));
|
|
1594
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/min-version.js
|
|
1595
|
+
var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1596
|
+
const SemVer = require_semver$1();
|
|
1597
|
+
const Range = require_range();
|
|
1598
|
+
const gt = require_gt();
|
|
1599
|
+
const minVersion = (range, loose) => {
|
|
1600
|
+
range = new Range(range, loose);
|
|
1601
|
+
let minver = new SemVer("0.0.0");
|
|
1602
|
+
if (range.test(minver)) return minver;
|
|
1603
|
+
minver = new SemVer("0.0.0-0");
|
|
1604
|
+
if (range.test(minver)) return minver;
|
|
1605
|
+
minver = null;
|
|
1606
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
1607
|
+
const comparators = range.set[i];
|
|
1608
|
+
let setMin = null;
|
|
1609
|
+
comparators.forEach((comparator) => {
|
|
1610
|
+
const compver = new SemVer(comparator.semver.version);
|
|
1611
|
+
switch (comparator.operator) {
|
|
1612
|
+
case ">":
|
|
1613
|
+
if (compver.prerelease.length === 0) compver.patch++;
|
|
1614
|
+
else compver.prerelease.push(0);
|
|
1615
|
+
compver.raw = compver.format();
|
|
1616
|
+
case "":
|
|
1617
|
+
case ">=":
|
|
1618
|
+
if (!setMin || gt(compver, setMin)) setMin = compver;
|
|
1619
|
+
break;
|
|
1620
|
+
case "<":
|
|
1621
|
+
case "<=": break;
|
|
1622
|
+
/* istanbul ignore next */
|
|
1623
|
+
default: throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
1624
|
+
}
|
|
1625
|
+
});
|
|
1626
|
+
if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
|
|
1627
|
+
}
|
|
1628
|
+
if (minver && range.test(minver)) return minver;
|
|
1629
|
+
return null;
|
|
1630
|
+
};
|
|
1631
|
+
module.exports = minVersion;
|
|
1632
|
+
}));
|
|
1633
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/valid.js
|
|
1634
|
+
var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1635
|
+
const Range = require_range();
|
|
1636
|
+
const validRange = (range, options) => {
|
|
1637
|
+
try {
|
|
1638
|
+
return new Range(range, options).range || "*";
|
|
1639
|
+
} catch (er) {
|
|
1640
|
+
return null;
|
|
1641
|
+
}
|
|
1642
|
+
};
|
|
1643
|
+
module.exports = validRange;
|
|
1644
|
+
}));
|
|
1645
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/outside.js
|
|
1646
|
+
var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1647
|
+
const SemVer = require_semver$1();
|
|
1648
|
+
const Comparator = require_comparator();
|
|
1649
|
+
const { ANY } = Comparator;
|
|
1650
|
+
const Range = require_range();
|
|
1651
|
+
const satisfies = require_satisfies();
|
|
1652
|
+
const gt = require_gt();
|
|
1653
|
+
const lt = require_lt();
|
|
1654
|
+
const lte = require_lte();
|
|
1655
|
+
const gte = require_gte();
|
|
1656
|
+
const outside = (version, range, hilo, options) => {
|
|
1657
|
+
version = new SemVer(version, options);
|
|
1658
|
+
range = new Range(range, options);
|
|
1659
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
1660
|
+
switch (hilo) {
|
|
1661
|
+
case ">":
|
|
1662
|
+
gtfn = gt;
|
|
1663
|
+
ltefn = lte;
|
|
1664
|
+
ltfn = lt;
|
|
1665
|
+
comp = ">";
|
|
1666
|
+
ecomp = ">=";
|
|
1667
|
+
break;
|
|
1668
|
+
case "<":
|
|
1669
|
+
gtfn = lt;
|
|
1670
|
+
ltefn = gte;
|
|
1671
|
+
ltfn = gt;
|
|
1672
|
+
comp = "<";
|
|
1673
|
+
ecomp = "<=";
|
|
1674
|
+
break;
|
|
1675
|
+
default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
|
|
1676
|
+
}
|
|
1677
|
+
if (satisfies(version, range, options)) return false;
|
|
1678
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
1679
|
+
const comparators = range.set[i];
|
|
1680
|
+
let high = null;
|
|
1681
|
+
let low = null;
|
|
1682
|
+
comparators.forEach((comparator) => {
|
|
1683
|
+
if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
|
|
1684
|
+
high = high || comparator;
|
|
1685
|
+
low = low || comparator;
|
|
1686
|
+
if (gtfn(comparator.semver, high.semver, options)) high = comparator;
|
|
1687
|
+
else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
|
|
1688
|
+
});
|
|
1689
|
+
if (high.operator === comp || high.operator === ecomp) return false;
|
|
1690
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
|
|
1691
|
+
else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
|
|
1692
|
+
}
|
|
1693
|
+
return true;
|
|
1694
|
+
};
|
|
1695
|
+
module.exports = outside;
|
|
1696
|
+
}));
|
|
1697
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/gtr.js
|
|
1698
|
+
var require_gtr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1699
|
+
const outside = require_outside();
|
|
1700
|
+
const gtr = (version, range, options) => outside(version, range, ">", options);
|
|
1701
|
+
module.exports = gtr;
|
|
1702
|
+
}));
|
|
1703
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/ltr.js
|
|
1704
|
+
var require_ltr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1705
|
+
const outside = require_outside();
|
|
1706
|
+
const ltr = (version, range, options) => outside(version, range, "<", options);
|
|
1707
|
+
module.exports = ltr;
|
|
1708
|
+
}));
|
|
1709
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/intersects.js
|
|
1710
|
+
var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1711
|
+
const Range = require_range();
|
|
1712
|
+
const intersects = (r1, r2, options) => {
|
|
1713
|
+
r1 = new Range(r1, options);
|
|
1714
|
+
r2 = new Range(r2, options);
|
|
1715
|
+
return r1.intersects(r2, options);
|
|
1716
|
+
};
|
|
1717
|
+
module.exports = intersects;
|
|
1718
|
+
}));
|
|
1719
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/simplify.js
|
|
1720
|
+
var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1721
|
+
const satisfies = require_satisfies();
|
|
1722
|
+
const compare = require_compare();
|
|
1723
|
+
module.exports = (versions, range, options) => {
|
|
1724
|
+
const set = [];
|
|
1725
|
+
let first = null;
|
|
1726
|
+
let prev = null;
|
|
1727
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
1728
|
+
for (const version of v) if (satisfies(version, range, options)) {
|
|
1729
|
+
prev = version;
|
|
1730
|
+
if (!first) first = version;
|
|
1731
|
+
} else {
|
|
1732
|
+
if (prev) set.push([first, prev]);
|
|
1733
|
+
prev = null;
|
|
1734
|
+
first = null;
|
|
1735
|
+
}
|
|
1736
|
+
if (first) set.push([first, null]);
|
|
1737
|
+
const ranges = [];
|
|
1738
|
+
for (const [min, max] of set) if (min === max) ranges.push(min);
|
|
1739
|
+
else if (!max && min === v[0]) ranges.push("*");
|
|
1740
|
+
else if (!max) ranges.push(`>=${min}`);
|
|
1741
|
+
else if (min === v[0]) ranges.push(`<=${max}`);
|
|
1742
|
+
else ranges.push(`${min} - ${max}`);
|
|
1743
|
+
const simplified = ranges.join(" || ");
|
|
1744
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
1745
|
+
return simplified.length < original.length ? simplified : range;
|
|
1746
|
+
};
|
|
1747
|
+
}));
|
|
1748
|
+
// ../../node_modules/.pnpm/semver@7.8.6/node_modules/semver/ranges/subset.js
|
|
1749
|
+
var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1750
|
+
const Range = require_range();
|
|
1751
|
+
const Comparator = require_comparator();
|
|
1752
|
+
const { ANY } = Comparator;
|
|
1753
|
+
const satisfies = require_satisfies();
|
|
1754
|
+
const compare = require_compare();
|
|
1755
|
+
const subset = (sub, dom, options = {}) => {
|
|
1756
|
+
if (sub === dom) return true;
|
|
1757
|
+
sub = new Range(sub, options);
|
|
1758
|
+
dom = new Range(dom, options);
|
|
1759
|
+
let sawNonNull = false;
|
|
1760
|
+
OUTER: for (const simpleSub of sub.set) {
|
|
1761
|
+
for (const simpleDom of dom.set) {
|
|
1762
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
1763
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
1764
|
+
if (isSub) continue OUTER;
|
|
1765
|
+
}
|
|
1766
|
+
if (sawNonNull) return false;
|
|
1767
|
+
}
|
|
1768
|
+
return true;
|
|
1769
|
+
};
|
|
1770
|
+
const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
1771
|
+
const minimumVersion = [new Comparator(">=0.0.0")];
|
|
1772
|
+
const simpleSubset = (sub, dom, options) => {
|
|
1773
|
+
if (sub === dom) return true;
|
|
1774
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
1775
|
+
if (dom.length === 1 && dom[0].semver === ANY) return true;
|
|
1776
|
+
else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
|
|
1777
|
+
else sub = minimumVersion;
|
|
1778
|
+
}
|
|
1779
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
1780
|
+
if (options.includePrerelease) return true;
|
|
1781
|
+
else dom = minimumVersion;
|
|
1782
|
+
}
|
|
1783
|
+
const eqSet = /* @__PURE__ */ new Set();
|
|
1784
|
+
let gt, lt;
|
|
1785
|
+
for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
|
|
1786
|
+
else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
|
|
1787
|
+
else eqSet.add(c.semver);
|
|
1788
|
+
if (eqSet.size > 1) return null;
|
|
1789
|
+
let gtltComp;
|
|
1790
|
+
if (gt && lt) {
|
|
1791
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
1792
|
+
if (gtltComp > 0) return null;
|
|
1793
|
+
else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
|
|
1794
|
+
}
|
|
1795
|
+
for (const eq of eqSet) {
|
|
1796
|
+
if (gt && !satisfies(eq, String(gt), options)) return null;
|
|
1797
|
+
if (lt && !satisfies(eq, String(lt), options)) return null;
|
|
1798
|
+
for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
|
|
1799
|
+
return true;
|
|
1800
|
+
}
|
|
1801
|
+
let higher, lower;
|
|
1802
|
+
let hasDomLT, hasDomGT;
|
|
1803
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
1804
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
1805
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
|
|
1806
|
+
for (const c of dom) {
|
|
1807
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
1808
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
1809
|
+
if (gt) {
|
|
1810
|
+
if (needDomGTPre) {
|
|
1811
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) needDomGTPre = false;
|
|
1812
|
+
}
|
|
1813
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
1814
|
+
higher = higherGT(gt, c, options);
|
|
1815
|
+
if (higher === c && higher !== gt) return false;
|
|
1816
|
+
} else if (gt.operator === ">=" && !c.test(gt.semver)) return false;
|
|
1817
|
+
}
|
|
1818
|
+
if (lt) {
|
|
1819
|
+
if (needDomLTPre) {
|
|
1820
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) needDomLTPre = false;
|
|
1821
|
+
}
|
|
1822
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
1823
|
+
lower = lowerLT(lt, c, options);
|
|
1824
|
+
if (lower === c && lower !== lt) return false;
|
|
1825
|
+
} else if (lt.operator === "<=" && !c.test(lt.semver)) return false;
|
|
1826
|
+
}
|
|
1827
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
|
|
1828
|
+
}
|
|
1829
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
|
|
1830
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
|
|
1831
|
+
if (needDomGTPre || needDomLTPre) return false;
|
|
1832
|
+
return true;
|
|
1833
|
+
};
|
|
1834
|
+
const higherGT = (a, b, options) => {
|
|
1835
|
+
if (!a) return b;
|
|
1836
|
+
const comp = compare(a.semver, b.semver, options);
|
|
1837
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
1838
|
+
};
|
|
1839
|
+
const lowerLT = (a, b, options) => {
|
|
1840
|
+
if (!a) return b;
|
|
1841
|
+
const comp = compare(a.semver, b.semver, options);
|
|
1842
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
1843
|
+
};
|
|
1844
|
+
module.exports = subset;
|
|
1845
|
+
}));
|
|
1846
|
+
(/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1847
|
+
const internalRe = require_re();
|
|
1848
|
+
const constants = require_constants();
|
|
1849
|
+
const SemVer = require_semver$1();
|
|
1850
|
+
const identifiers = require_identifiers();
|
|
1851
|
+
module.exports = {
|
|
1852
|
+
parse: require_parse(),
|
|
1853
|
+
valid: require_valid$1(),
|
|
1854
|
+
clean: require_clean(),
|
|
1855
|
+
inc: require_inc(),
|
|
1856
|
+
diff: require_diff(),
|
|
1857
|
+
major: require_major(),
|
|
1858
|
+
minor: require_minor(),
|
|
1859
|
+
patch: require_patch(),
|
|
1860
|
+
prerelease: require_prerelease(),
|
|
1861
|
+
compare: require_compare(),
|
|
1862
|
+
rcompare: require_rcompare(),
|
|
1863
|
+
compareLoose: require_compare_loose(),
|
|
1864
|
+
compareBuild: require_compare_build(),
|
|
1865
|
+
sort: require_sort(),
|
|
1866
|
+
rsort: require_rsort(),
|
|
1867
|
+
gt: require_gt(),
|
|
1868
|
+
lt: require_lt(),
|
|
1869
|
+
eq: require_eq(),
|
|
1870
|
+
neq: require_neq(),
|
|
1871
|
+
gte: require_gte(),
|
|
1872
|
+
lte: require_lte(),
|
|
1873
|
+
cmp: require_cmp(),
|
|
1874
|
+
coerce: require_coerce(),
|
|
1875
|
+
truncate: require_truncate(),
|
|
1876
|
+
Comparator: require_comparator(),
|
|
1877
|
+
Range: require_range(),
|
|
1878
|
+
satisfies: require_satisfies(),
|
|
1879
|
+
toComparators: require_to_comparators(),
|
|
1880
|
+
maxSatisfying: require_max_satisfying(),
|
|
1881
|
+
minSatisfying: require_min_satisfying(),
|
|
1882
|
+
minVersion: require_min_version(),
|
|
1883
|
+
validRange: require_valid(),
|
|
1884
|
+
outside: require_outside(),
|
|
1885
|
+
gtr: require_gtr(),
|
|
1886
|
+
ltr: require_ltr(),
|
|
1887
|
+
intersects: require_intersects(),
|
|
1888
|
+
simplifyRange: require_simplify(),
|
|
1889
|
+
subset: require_subset(),
|
|
1890
|
+
SemVer,
|
|
1891
|
+
re: internalRe.re,
|
|
1892
|
+
src: internalRe.src,
|
|
1893
|
+
tokens: internalRe.t,
|
|
1894
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
1895
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
1896
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
1897
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
1898
|
+
};
|
|
1899
|
+
})))();
|
|
1900
|
+
const AI_PLATFORMS = ["chatgpt", "claudeai"];
|
|
1901
|
+
const platformSchema = z.enum(AI_PLATFORMS);
|
|
173
1902
|
const PLATFORM_LABELS = {
|
|
174
1903
|
chatgpt: "ChatGPT",
|
|
175
1904
|
claudeai: "Claude.ai"
|
|
176
1905
|
};
|
|
1906
|
+
const WAF_PLATFORMS = [
|
|
1907
|
+
"akamai",
|
|
1908
|
+
"cato",
|
|
1909
|
+
"cloudflare",
|
|
1910
|
+
"fastly"
|
|
1911
|
+
];
|
|
1912
|
+
const ALLOWED_PLATFORMS = [...[
|
|
1913
|
+
...AI_PLATFORMS,
|
|
1914
|
+
"meta",
|
|
1915
|
+
"google"
|
|
1916
|
+
], ...WAF_PLATFORMS];
|
|
1917
|
+
const allowedPlatformSchema = z.enum(ALLOWED_PLATFORMS);
|
|
177
1918
|
const auditStatusSchema = z.enum([
|
|
178
1919
|
"pending",
|
|
179
1920
|
"partial",
|
|
@@ -246,6 +1987,25 @@ z.object({
|
|
|
246
1987
|
clientSecret: z.string(),
|
|
247
1988
|
clientScopes: z.array(z.string())
|
|
248
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
|
+
});
|
|
249
2009
|
const deploymentStatusSchema$1 = z.enum([
|
|
250
2010
|
"ongoing",
|
|
251
2011
|
"deployed",
|
|
@@ -273,34 +2033,52 @@ const deploymentSummarySchema = z.object({
|
|
|
273
2033
|
createdAt: z.coerce.date(),
|
|
274
2034
|
updatedAt: z.coerce.date()
|
|
275
2035
|
});
|
|
276
|
-
/**
|
|
277
|
-
* Public environment
|
|
278
|
-
*
|
|
279
|
-
* No OAuth metadata exposed.
|
|
280
|
-
*/
|
|
2036
|
+
/** Public environment: answers anonymously and exposes no OAuth metadata. */
|
|
281
2037
|
const publicEnvironmentSchema = z.object({
|
|
2038
|
+
allowsAnonymous: z.literal(true),
|
|
2039
|
+
oAuthMetadata: z.strictObject({})
|
|
2040
|
+
});
|
|
2041
|
+
/** Protected environment whose external resource metadata URL is returned in the WWW-Authenticate header on the first 401; everything after is handled outside the MCP server scope. */
|
|
2042
|
+
const externalResourceMetadataEnvironmentSchema = z.object({
|
|
2043
|
+
allowsAnonymous: z.boolean(),
|
|
2044
|
+
oAuthMetadata: z.object({ externalResourceMetadataUrl: z.url() }),
|
|
2045
|
+
scope: z.string().optional()
|
|
2046
|
+
});
|
|
2047
|
+
/** Protected environment whose own /.well-known/oauth-protected-resource endpoint points at an external authorization server; everything after is handled outside the MCP server scope. */
|
|
2048
|
+
const externalAuthorizationServerEnvironmentSchema = z.object({
|
|
2049
|
+
allowsAnonymous: z.boolean(),
|
|
2050
|
+
oAuthMetadata: z.object({
|
|
2051
|
+
externalAuthorizationServerUrl: z.url(),
|
|
2052
|
+
resourceMetadata: OAuthProtectedResourceMetadataSchema.optional()
|
|
2053
|
+
}),
|
|
2054
|
+
scope: z.string().optional()
|
|
2055
|
+
});
|
|
2056
|
+
/** Standalone protected environment: the server itself exposes both the /.well-known/oauth-protected-resource and /.well-known/oauth-authorization-server endpoints. */
|
|
2057
|
+
const standaloneEnvironmentSchema = z.object({
|
|
2058
|
+
allowsAnonymous: z.boolean(),
|
|
2059
|
+
oAuthMetadata: z.object({
|
|
2060
|
+
authorizationServerMetadata: z.union([OAuthMetadataSchema, OpenIdProviderDiscoveryMetadataSchema]),
|
|
2061
|
+
resourceMetadata: OAuthProtectedResourceMetadataSchema.optional()
|
|
2062
|
+
}),
|
|
2063
|
+
scope: z.string().optional()
|
|
2064
|
+
});
|
|
2065
|
+
/** Protected environment that enforces authentication but advertises no OAuth discovery metadata; clients must obtain credentials out-of-band. */
|
|
2066
|
+
const protectedWithoutDiscoveryEnvironmentSchema = z.object({
|
|
2067
|
+
allowsAnonymous: z.literal(false),
|
|
2068
|
+
oAuthMetadata: z.strictObject({}),
|
|
2069
|
+
scope: z.string().optional(),
|
|
2070
|
+
wwwAuthenticate: z.string().optional()
|
|
2071
|
+
});
|
|
2072
|
+
const legacyPublicEnvironmentSchema = z.object({
|
|
282
2073
|
isPublic: z.literal(true),
|
|
283
2074
|
oAuthMetadata: z.undefined().optional()
|
|
284
2075
|
});
|
|
285
|
-
|
|
286
|
-
* Protected environment with an external resource metadata URL
|
|
287
|
-
*
|
|
288
|
-
* An external resource metadata URL is returned in the WWW-Authenticate header during the first 401 response.
|
|
289
|
-
* Everything that follows is handled outside of the MCP server scope.
|
|
290
|
-
*/
|
|
291
|
-
const externalResourceMetadataEnvironmentSchema = z.object({
|
|
2076
|
+
const legacyExternalResourceMetadataEnvironmentSchema = z.object({
|
|
292
2077
|
isPublic: z.literal(false),
|
|
293
2078
|
oAuthMetadata: z.object({ externalResourceMetadataUrl: z.url() }),
|
|
294
2079
|
scope: z.string().optional()
|
|
295
2080
|
});
|
|
296
|
-
|
|
297
|
-
* Protected environment with an external authorization server URL
|
|
298
|
-
*
|
|
299
|
-
* The server itself exposes the /.well-known/oauth-protected-resource endpoint.
|
|
300
|
-
* An external authorization server URL is returned when requesting the endpoint.
|
|
301
|
-
* Everything that follows is handled outside of the MCP server scope.
|
|
302
|
-
*/
|
|
303
|
-
const externalAuthorizationServerEnvironmentSchema = z.object({
|
|
2081
|
+
const legacyExternalAuthorizationServerEnvironmentSchema = z.object({
|
|
304
2082
|
isPublic: z.literal(false),
|
|
305
2083
|
oAuthMetadata: z.object({
|
|
306
2084
|
externalAuthorizationServerUrl: z.url(),
|
|
@@ -308,13 +2086,7 @@ const externalAuthorizationServerEnvironmentSchema = z.object({
|
|
|
308
2086
|
}),
|
|
309
2087
|
scope: z.string().optional()
|
|
310
2088
|
});
|
|
311
|
-
|
|
312
|
-
* Standalone protected environment
|
|
313
|
-
*
|
|
314
|
-
* The server itself exposes the /.well-known/oauth-protected-resource endpoint.
|
|
315
|
-
* The server itself exposes the /.well-known/oauth-authorization-server endpoint.
|
|
316
|
-
*/
|
|
317
|
-
const standaloneEnvironmentSchema = z.object({
|
|
2089
|
+
const legacyStandaloneEnvironmentSchema = z.object({
|
|
318
2090
|
isPublic: z.literal(false),
|
|
319
2091
|
oAuthMetadata: z.object({
|
|
320
2092
|
authorizationServerMetadata: z.union([OAuthMetadataSchema, OpenIdProviderDiscoveryMetadataSchema]),
|
|
@@ -322,14 +2094,7 @@ const standaloneEnvironmentSchema = z.object({
|
|
|
322
2094
|
}),
|
|
323
2095
|
scope: z.string().optional()
|
|
324
2096
|
});
|
|
325
|
-
|
|
326
|
-
* Protected environment without OAuth discovery
|
|
327
|
-
*
|
|
328
|
-
* The server enforces authentication but exposes no OAuth discovery metadata.
|
|
329
|
-
* Neither /.well-known/oauth-protected-resource nor /.well-known/oauth-authorization-server
|
|
330
|
-
* are advertised. Clients must obtain credentials out-of-band.
|
|
331
|
-
*/
|
|
332
|
-
const protectedWithoutDiscoveryEnvironmentSchema = z.object({
|
|
2097
|
+
const legacyProtectedWithoutDiscoveryEnvironmentSchema = z.object({
|
|
333
2098
|
isPublic: z.literal(false),
|
|
334
2099
|
oAuthMetadata: z.strictObject({}),
|
|
335
2100
|
scope: z.string().optional()
|
|
@@ -339,11 +2104,24 @@ z.union([
|
|
|
339
2104
|
externalResourceMetadataEnvironmentSchema,
|
|
340
2105
|
externalAuthorizationServerEnvironmentSchema,
|
|
341
2106
|
standaloneEnvironmentSchema,
|
|
342
|
-
protectedWithoutDiscoveryEnvironmentSchema
|
|
2107
|
+
protectedWithoutDiscoveryEnvironmentSchema,
|
|
2108
|
+
legacyPublicEnvironmentSchema,
|
|
2109
|
+
legacyExternalResourceMetadataEnvironmentSchema,
|
|
2110
|
+
legacyExternalAuthorizationServerEnvironmentSchema,
|
|
2111
|
+
legacyStandaloneEnvironmentSchema,
|
|
2112
|
+
legacyProtectedWithoutDiscoveryEnvironmentSchema
|
|
2113
|
+
]);
|
|
2114
|
+
const playgroundModelSchema = z.enum([
|
|
2115
|
+
"global.anthropic.claude-haiku-5-5",
|
|
2116
|
+
"global.anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
2117
|
+
"global.anthropic.claude-sonnet-5-5",
|
|
2118
|
+
"openai.gpt-5.4",
|
|
2119
|
+
"openai.gpt-5.5",
|
|
2120
|
+
"openai.gpt-6-luna",
|
|
2121
|
+
"openai.gpt-6.1-sol"
|
|
343
2122
|
]);
|
|
344
|
-
const allowedPlatformSchema = platformSchema;
|
|
345
2123
|
const environmentDomainSchema = z.object({
|
|
346
|
-
|
|
2124
|
+
name: z.string(),
|
|
347
2125
|
status: z.enum([
|
|
348
2126
|
"ongoing",
|
|
349
2127
|
"deployed",
|
|
@@ -361,6 +2139,7 @@ const environmentSchema$1 = z.object({
|
|
|
361
2139
|
latestDeployment: deploymentSummarySchema.optional(),
|
|
362
2140
|
openaiAppsChallenge: z.string().nullable().optional(),
|
|
363
2141
|
isPlaygroundEnabled: z.boolean(),
|
|
2142
|
+
playgroundModel: playgroundModelSchema,
|
|
364
2143
|
isIpWhitelistEnabled: z.boolean(),
|
|
365
2144
|
ipAllowlist: z.array(z.string()).nullable(),
|
|
366
2145
|
allowedPlatforms: z.array(allowedPlatformSchema),
|
|
@@ -370,11 +2149,21 @@ const environmentSchema$1 = z.object({
|
|
|
370
2149
|
});
|
|
371
2150
|
const environmentWithDomainsSchema = environmentSchema$1.extend({ domains: z.array(environmentDomainSchema) });
|
|
372
2151
|
z.object({
|
|
2152
|
+
sessionReplayEnabled: z.boolean(),
|
|
2153
|
+
collectRequestPayload: z.boolean(),
|
|
2154
|
+
collectResponsePayload: z.boolean(),
|
|
2155
|
+
collectErrorMessage: z.boolean(),
|
|
2156
|
+
collectUserData: z.boolean(),
|
|
2157
|
+
identityTraitKey: z.string().min(1).max(200).nullable(),
|
|
2158
|
+
leadEventName: z.string().min(1).max(200).nullable()
|
|
2159
|
+
});
|
|
2160
|
+
const feedbackSchema = z.object({
|
|
373
2161
|
id: z.string(),
|
|
374
2162
|
createdAt: z.coerce.date(),
|
|
375
2163
|
environmentId: z.string(),
|
|
376
2164
|
content: z.string(),
|
|
377
|
-
source: z.enum(["model", "user"])
|
|
2165
|
+
source: z.enum(["model", "user"]),
|
|
2166
|
+
clientName: z.string().nullable()
|
|
378
2167
|
});
|
|
379
2168
|
z.object({
|
|
380
2169
|
content: z.string(),
|
|
@@ -390,7 +2179,7 @@ const intentCategoryColorSchema = z.enum([
|
|
|
390
2179
|
"pink",
|
|
391
2180
|
"gray"
|
|
392
2181
|
]);
|
|
393
|
-
intentCategoryColorSchema.options;
|
|
2182
|
+
const INTENT_CATEGORY_COLORS = intentCategoryColorSchema.options;
|
|
394
2183
|
const intentCategorySchema = z.object({
|
|
395
2184
|
id: z.string(),
|
|
396
2185
|
createdAt: z.coerce.date(),
|
|
@@ -398,7 +2187,7 @@ const intentCategorySchema = z.object({
|
|
|
398
2187
|
name: z.string(),
|
|
399
2188
|
color: intentCategoryColorSchema
|
|
400
2189
|
});
|
|
401
|
-
z.object({
|
|
2190
|
+
const intentCategorySummarySchema = z.object({
|
|
402
2191
|
id: z.string(),
|
|
403
2192
|
name: z.string(),
|
|
404
2193
|
color: intentCategoryColorSchema,
|
|
@@ -410,6 +2199,7 @@ z.object({
|
|
|
410
2199
|
environmentId: z.string(),
|
|
411
2200
|
toolName: z.string(),
|
|
412
2201
|
message: z.string(),
|
|
2202
|
+
clientName: z.string().nullable(),
|
|
413
2203
|
categories: z.array(intentCategorySchema)
|
|
414
2204
|
});
|
|
415
2205
|
const signalCategorySchema = z.object({
|
|
@@ -468,17 +2258,277 @@ z.object({
|
|
|
468
2258
|
createdAt: z.coerce.date(),
|
|
469
2259
|
updatedAt: z.coerce.date()
|
|
470
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]);
|
|
471
2271
|
z.enum([
|
|
472
2272
|
"INFO",
|
|
473
2273
|
"WARNING",
|
|
474
2274
|
"DEBUG",
|
|
475
2275
|
"ERROR"
|
|
476
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]));
|
|
477
2525
|
const runtimeSchema = z.enum([
|
|
478
2526
|
"python3.13",
|
|
479
2527
|
"python3.14",
|
|
2528
|
+
"python3.15",
|
|
480
2529
|
"node22",
|
|
481
|
-
"node24"
|
|
2530
|
+
"node24",
|
|
2531
|
+
"node26"
|
|
482
2532
|
]);
|
|
483
2533
|
const transportSchema = z.enum([
|
|
484
2534
|
"stdio",
|
|
@@ -502,15 +2552,27 @@ z.object({
|
|
|
502
2552
|
environments: z.array(environmentWithDomainsSchema),
|
|
503
2553
|
productionEnvironment: environmentWithDomainsSchema.nullable()
|
|
504
2554
|
});
|
|
2555
|
+
const domainFailureReasonSchema = z.enum([
|
|
2556
|
+
"caa",
|
|
2557
|
+
"dns",
|
|
2558
|
+
"invalid_domain",
|
|
2559
|
+
"other"
|
|
2560
|
+
]);
|
|
2561
|
+
const projectDomainMappingSchema = z.object({
|
|
2562
|
+
pathPrefix: z.string(),
|
|
2563
|
+
environment: environmentSchema$1
|
|
2564
|
+
});
|
|
505
2565
|
z.object({
|
|
506
|
-
|
|
2566
|
+
name: z.string(),
|
|
507
2567
|
createdAt: z.coerce.date(),
|
|
508
2568
|
status: z.enum([
|
|
509
2569
|
"ongoing",
|
|
510
2570
|
"deployed",
|
|
511
2571
|
"failed"
|
|
512
2572
|
]),
|
|
513
|
-
|
|
2573
|
+
failureReason: domainFailureReasonSchema.nullable(),
|
|
2574
|
+
environment: environmentSchema$1,
|
|
2575
|
+
mappings: z.array(projectDomainMappingSchema)
|
|
514
2576
|
});
|
|
515
2577
|
const serverFieldsSchema$1 = z.object({
|
|
516
2578
|
$schema: z.string(),
|
|
@@ -539,15 +2601,7 @@ z.object({
|
|
|
539
2601
|
serverFields: serverFieldsSchema$1,
|
|
540
2602
|
source: z.enum(["registry", "defaults"])
|
|
541
2603
|
});
|
|
542
|
-
/**
|
|
543
|
-
* Returns a variant of a `maxLength`-constrained string that clamps (truncates) instead of
|
|
544
|
-
* rejecting on overflow — used for AI-generated copy where the model routinely overshoots.
|
|
545
|
-
*
|
|
546
|
-
* NOTE: this rebuilds the schema from scratch, carrying over only `maxLength` (as a clamp),
|
|
547
|
-
* `minLength`, and the description. Any other validators on the source field (`.regex()`,
|
|
548
|
-
* `.email()`, custom refinements) are intentionally dropped — this helper is meant for plain
|
|
549
|
-
* free-text length caps only. A field with `null` `maxLength` is returned unchanged.
|
|
550
|
-
*/
|
|
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. */
|
|
551
2605
|
const clampStringField = (field) => {
|
|
552
2606
|
const max = field.maxLength;
|
|
553
2607
|
if (max === null) return field;
|
|
@@ -555,6 +2609,10 @@ const clampStringField = (field) => {
|
|
|
555
2609
|
const withMin = field.minLength === null ? clamped : clamped.min(field.minLength);
|
|
556
2610
|
return field.description ? withMin.describe(field.description) : withMin;
|
|
557
2611
|
};
|
|
2612
|
+
const unboundedArrayField = (field) => {
|
|
2613
|
+
const unbounded = z.array(field.element);
|
|
2614
|
+
return field.description ? unbounded.describe(field.description) : unbounded;
|
|
2615
|
+
};
|
|
558
2616
|
const toolDefinitionSchema = z.object({
|
|
559
2617
|
name: z.string(),
|
|
560
2618
|
title: z.string().optional().describe("Human-friendly name for the tool, used in the UI. If not provided, `name` will be used."),
|
|
@@ -567,17 +2625,31 @@ const toolDefinitionSchema = z.object({
|
|
|
567
2625
|
}).optional()
|
|
568
2626
|
});
|
|
569
2627
|
const positiveTestCaseSchema = z.object({
|
|
570
|
-
scenario: z.string().describe("Short label for what this case demonstrates."),
|
|
571
|
-
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."),
|
|
572
2630
|
toolTriggered: z.string().optional().describe("The tool this prompt should invoke."),
|
|
573
2631
|
expectedOutput: z.string().optional().describe("What the user should see, including post-interaction behaviour where relevant.")
|
|
574
|
-
}).
|
|
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());
|
|
575
2644
|
const screenshotEntrySchema = z.object({
|
|
576
2645
|
prompt: z.string(),
|
|
577
|
-
url: z.url()
|
|
2646
|
+
url: z.url()
|
|
578
2647
|
}).describe("Each screenshot: the user prompt that produced it + the image URL.");
|
|
2648
|
+
const screenshotDraftEntrySchema = screenshotEntrySchema.extend({ url: z.string() });
|
|
579
2649
|
/** Accepts either a valid email or URL. */
|
|
580
2650
|
const supportChannelSchema = z.string().refine((value) => z.email().safeParse(value).success || z.url().safeParse(value).success, { error: "Must be a valid email or URL" });
|
|
2651
|
+
/** A URL field whose error spells out that the scheme is required. */
|
|
2652
|
+
const urlField = z.url({ error: "Enter a full URL including https:// (e.g. https://example.com)" });
|
|
581
2653
|
const chatgptCategorySchema = z.enum([
|
|
582
2654
|
"BUSINESS",
|
|
583
2655
|
"COLLABORATION",
|
|
@@ -881,20 +2953,25 @@ const chatgptTranslationLocaleSchema = z.enum([
|
|
|
881
2953
|
"zh-TW"
|
|
882
2954
|
]);
|
|
883
2955
|
const negativeTestCaseSchema = z.object({
|
|
884
|
-
scenario: z.string(),
|
|
885
|
-
userPrompt: z.string()
|
|
886
|
-
}).
|
|
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.");
|
|
887
2968
|
const chatgptToolJustificationSchema = z.object({
|
|
888
2969
|
toolName: z.string(),
|
|
889
2970
|
readOnlyJustification: z.string().describe("One sentence on what the tool reads and returns."),
|
|
890
2971
|
openWorldJustification: z.string().describe("One sentence on whether the tool reaches external systems beyond your own service."),
|
|
891
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.\"")
|
|
892
2973
|
}).describe("Per-tool justification of each MCP annotation value (one specific sentence per hint).");
|
|
893
|
-
/**
|
|
894
|
-
* Base copy fields, defined once and reused by both the submission form and per-locale
|
|
895
|
-
* translations so the constraints (tagline ≤ 30 chars) never drift. The translation generation
|
|
896
|
-
* path wraps these in {@link clampStringField} since the LLM tends to overshoot the limit.
|
|
897
|
-
*/
|
|
2974
|
+
/** Defined once and reused by both the submission form and per-locale translations so the tagline ≤ 30 chars constraint never drifts. */
|
|
898
2975
|
const chatgptTaglineSchema = z.string().max(30);
|
|
899
2976
|
const chatgptDescriptionSchema = z.string();
|
|
900
2977
|
const chatgptTranslationSchema = z.object({
|
|
@@ -903,52 +2980,73 @@ const chatgptTranslationSchema = z.object({
|
|
|
903
2980
|
description: chatgptDescriptionSchema
|
|
904
2981
|
}).describe("Locale-scoped override for tagline + description. English (US) is the default.");
|
|
905
2982
|
chatgptTranslationSchema.extend({ tagline: clampStringField(chatgptTaglineSchema) });
|
|
906
|
-
/**
|
|
907
|
-
* Field order mirrors the ChatGPT (OpenAI) submission spreadsheet, grouped by section.
|
|
908
|
-
* When adding/removing/reordering fields, keep this in sync with the sheet.
|
|
909
|
-
*/
|
|
2983
|
+
/** Field order mirrors the ChatGPT (OpenAI) submission spreadsheet, grouped by section; keep it in sync with the sheet. */
|
|
910
2984
|
const chatgptSubmissionFormDataSchema = z.object({
|
|
911
2985
|
logoLight: z.string().describe("Logo icon for light mode. Square PNG, no borders or rounded corners (clients apply circular cropping)."),
|
|
912
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."),
|
|
913
|
-
appName: z.string().describe("The name users will see in ChatGPT and in the
|
|
2987
|
+
appName: z.string().describe("The name users will see in ChatGPT and in the Plugin Directory."),
|
|
914
2988
|
tagline: chatgptTaglineSchema.describe("Plain-language phrase focused on function and user value, 30 chars max. Avoid generic superlatives like \"the best …\"."),
|
|
915
|
-
description: chatgptDescriptionSchema.describe("Clear, engaging description highlighting what the
|
|
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)."),
|
|
916
2990
|
category: chatgptCategorySchema.describe("Category from the OpenAI taxonomy."),
|
|
917
|
-
developerName: z.string().describe("Developer name shown publicly on the
|
|
918
|
-
companyUrl:
|
|
2991
|
+
developerName: z.string().describe("Developer name shown publicly on the plugin's directory page."),
|
|
2992
|
+
companyUrl: urlField.describe("Your company's main website URL."),
|
|
919
2993
|
supportChannel: supportChannelSchema.describe("Customer support URL or email address."),
|
|
920
|
-
privacyPolicyUrl:
|
|
921
|
-
termsOfServiceUrl:
|
|
922
|
-
demoRecordingUrl:
|
|
923
|
-
appCommerceAndPurchasing: z.boolean().describe("Checkbox: 'My
|
|
924
|
-
serverUrl:
|
|
2994
|
+
privacyPolicyUrl: urlField.describe("URL to your privacy policy."),
|
|
2995
|
+
termsOfServiceUrl: urlField.describe("URL to the plugin's terms of service."),
|
|
2996
|
+
demoRecordingUrl: urlField.describe("URL to a video demonstrating the plugin, recorded via OpenAI Developer Mode. Cover all main use cases on web, iOS, and Android."),
|
|
2997
|
+
appCommerceAndPurchasing: z.boolean().describe("Checkbox: 'My plugin links or directs users out of ChatGPT to make purchases.' Defaults to false. Verify the plugin does not offer digital goods."),
|
|
2998
|
+
serverUrl: urlField.describe("URL of the MCP server."),
|
|
925
2999
|
authentication: chatgptAuthenticationSchema.describe("OAuth 2.0 or No auth. OAuth configuration is auto-discovered from the MCP server's metadata."),
|
|
926
3000
|
tools: z.array(toolDefinitionSchema).describe("List of tools exposed by the MCP server (auto-populated from the production server's manifest)."),
|
|
927
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."),
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
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."),
|
|
931
3006
|
translations: z.array(chatgptTranslationSchema).describe("Per-locale translation of tagline + description. English (US) is the default."),
|
|
932
3007
|
allowedCountries: chatgptAllowedCountriesSchema.describe("Availability: all supported countries, or an allow-list / block-list of specific ones (ISO alpha-2)."),
|
|
933
|
-
releaseNotes: z.string().describe("Publicly displayed on the
|
|
3008
|
+
releaseNotes: z.string().describe("Publicly displayed on the plugin details page.")
|
|
3009
|
+
});
|
|
3010
|
+
const chatgptSubmissionDraftSchema = chatgptSubmissionFormDataSchema.partial().extend({
|
|
3011
|
+
tagline: z.string().optional(),
|
|
3012
|
+
companyUrl: z.string().optional(),
|
|
3013
|
+
supportChannel: z.string().optional(),
|
|
3014
|
+
privacyPolicyUrl: z.string().optional(),
|
|
3015
|
+
termsOfServiceUrl: z.string().optional(),
|
|
3016
|
+
demoRecordingUrl: z.string().optional(),
|
|
3017
|
+
serverUrl: z.string().optional(),
|
|
3018
|
+
screenshots: z.array(screenshotDraftEntrySchema).optional(),
|
|
3019
|
+
testCases: z.array(positiveTestCaseDraftSchema).optional(),
|
|
3020
|
+
negativeTestCases: z.array(negativeTestCaseDraftSchema).optional(),
|
|
3021
|
+
translations: z.array(chatgptTranslationSchema.extend({ tagline: z.string() })).optional()
|
|
934
3022
|
});
|
|
935
|
-
|
|
3023
|
+
/** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "chatgpt" })` can populate. */
|
|
3024
|
+
const chatgptPrefillFormDataSchema = chatgptSubmissionFormDataSchema.pick({
|
|
936
3025
|
appName: true,
|
|
937
3026
|
developerName: true,
|
|
938
3027
|
serverUrl: true,
|
|
939
3028
|
tools: true,
|
|
3029
|
+
skills: true,
|
|
940
3030
|
authentication: true
|
|
941
3031
|
});
|
|
942
|
-
|
|
3032
|
+
/** Source of truth for `SubmissionPrefillService.generate({ platform: "chatgpt" })`. */
|
|
3033
|
+
const chatgptAiGeneratedFormDataSchema = chatgptSubmissionFormDataSchema.pick({
|
|
943
3034
|
tagline: true,
|
|
944
3035
|
description: true,
|
|
945
3036
|
category: true,
|
|
946
3037
|
testCases: true,
|
|
947
3038
|
negativeTestCases: true,
|
|
948
3039
|
toolJustifications: true
|
|
949
|
-
}).extend({
|
|
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
|
+
});
|
|
950
3048
|
const claudeCategorySchema = z.enum([
|
|
951
|
-
"
|
|
3049
|
+
"Productivity",
|
|
952
3050
|
"Communication",
|
|
953
3051
|
"Data & Analytics",
|
|
954
3052
|
"Development tools",
|
|
@@ -956,222 +3054,222 @@ const claudeCategorySchema = z.enum([
|
|
|
956
3054
|
"Consumer Health",
|
|
957
3055
|
"Health & Life Sciences",
|
|
958
3056
|
"Media & Entertainment",
|
|
959
|
-
"Commerce & Shopping"
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
"
|
|
963
|
-
"
|
|
964
|
-
"
|
|
3057
|
+
"Commerce & Shopping",
|
|
3058
|
+
"Legal",
|
|
3059
|
+
"Sales and marketing",
|
|
3060
|
+
"Creative",
|
|
3061
|
+
"Nonprofit",
|
|
3062
|
+
"Education",
|
|
3063
|
+
"Other"
|
|
965
3064
|
]);
|
|
966
|
-
const
|
|
967
|
-
z.enum(["Static OAuth Client", "Dynamic OAuth Client (DCR / CIMD)"]);
|
|
3065
|
+
const claudeCategoryDescription = `The categories used to filter connectors in the directory UI. Select up to 5 that best describe your connector.`;
|
|
968
3066
|
const claudeReadWriteCapabilitiesSchema = z.enum([
|
|
969
|
-
"
|
|
970
|
-
"
|
|
971
|
-
"
|
|
3067
|
+
"read_only",
|
|
3068
|
+
"write_only",
|
|
3069
|
+
"read_write"
|
|
972
3070
|
]);
|
|
973
|
-
const
|
|
974
|
-
|
|
975
|
-
"
|
|
976
|
-
"
|
|
977
|
-
"
|
|
978
|
-
"
|
|
979
|
-
]);
|
|
980
|
-
const claudeThirdPartySchema = z.enum([
|
|
981
|
-
"Web access: Fetches information from the open web (e.g., web scraping, search engines, or browsing arbitrary URLs, not just connecting to a specific API)",
|
|
982
|
-
"Third-party AI model integration: Sends data to or receives data from a generative AI model other than Claude",
|
|
983
|
-
"Third-party data retrieval: Connects to external services that themselves retrieve data from other sources (e.g., workflow automation platforms or other services that aggregate or relay data from multiple third-party sources)",
|
|
984
|
-
"Third-party data modification: Can connect to external services that themselves create, update, or delete data in other sources (e.g., workflow automation platforms or other services that write to multiple third-party sources)",
|
|
985
|
-
"N/A"
|
|
3071
|
+
const claudeAuthenticationSchema = z.enum([
|
|
3072
|
+
"oauth_dcr",
|
|
3073
|
+
"oauth_cimd",
|
|
3074
|
+
"oauth_anthropic_creds",
|
|
3075
|
+
"custom_connection",
|
|
3076
|
+
"none"
|
|
986
3077
|
]);
|
|
987
|
-
const
|
|
988
|
-
"
|
|
989
|
-
"
|
|
990
|
-
"
|
|
991
|
-
"GDPR compliant (if applicable)"
|
|
3078
|
+
const claudeApiOwnershipSchema = z.enum([
|
|
3079
|
+
"first_party",
|
|
3080
|
+
"proxied",
|
|
3081
|
+
"third_party"
|
|
992
3082
|
]);
|
|
993
|
-
const
|
|
994
|
-
|
|
995
|
-
"
|
|
996
|
-
"
|
|
3083
|
+
const claudeYesNoOtherSchema = z.union([z.boolean(), z.object({ other: z.string() })]);
|
|
3084
|
+
const claudePolicyAcknowledgementSchema = z.enum([
|
|
3085
|
+
"I have read and understand the MCP Directory developer guidelines.",
|
|
3086
|
+
"My server calls our own first-party APIs (or APIs we legitimately proxy with permission).",
|
|
3087
|
+
"My connector does not transfer money, cryptocurrency, or other financial assets on a user's behalf.",
|
|
3088
|
+
"My connector does not use AI models to generate images, video, or audio.",
|
|
3089
|
+
"Tool descriptions contain no instructions about model behavior, other tools, or external instruction sources, and no hidden or encoded text.",
|
|
3090
|
+
"My connector does not collect conversation data beyond what is needed for its function.",
|
|
3091
|
+
"Public documentation for this connector will be live by the publish date."
|
|
997
3092
|
]);
|
|
998
|
-
/**
|
|
999
|
-
* Field order mirrors the Claude (Anthropic) submission spreadsheet, grouped by section.
|
|
1000
|
-
* When adding/removing/reordering fields, keep this in sync with the sheet.
|
|
1001
|
-
*/
|
|
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. */
|
|
1002
3094
|
const claudeSubmissionFormDataSchema = z.object({
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
(
|
|
1013
|
-
|
|
1014
|
-
(
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
•
|
|
1032
|
-
•
|
|
1033
|
-
•
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
• '
|
|
1049
|
-
• '
|
|
1050
|
-
• '
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
• 'SSE (Server-Sent Events)' — the older transport. SSE may be deprecated by Anthropic later in 2025/2026. If you currently only support SSE, you should plan to migrate to Streamable HTTP.
|
|
1081
|
-
If you support both, select both. If you're building from scratch, implement Streamable HTTP only.`),
|
|
1082
|
-
serverDocumentationLink: z.url().describe(`A public URL pointing to documentation that helps users understand and use your connector. This is displayed in the Directory listing and must be publicly accessible without login. Minimum requirements for the docs page:
|
|
1083
|
-
• What the connector does and its key capabilities
|
|
1084
|
-
• How to connect/set it up (step by step)
|
|
1085
|
-
• What each tool does (or at least the main ones)
|
|
1086
|
-
• How to troubleshoot common issues
|
|
1087
|
-
• A support contact or channel
|
|
1088
|
-
Acceptable formats: a dedicated docs page, a help center article, a README on GitHub, or a blog post — as long as it's comprehensive. Note: Anthropic requires public documentation to be live by your publish date.`),
|
|
1089
|
-
privacyPolicyUrl: z.url().describe(`URL to your privacy policy. This is mandatory and displayed in the directory listing. Missing or incomplete privacy policies result in immediate rejection. Your privacy policy must cover:
|
|
1090
|
-
• What data you collect (and how)
|
|
1091
|
-
• How you use the collected data
|
|
1092
|
-
• Where and how long you store it
|
|
1093
|
-
• Whether you share data with third parties (and who)
|
|
1094
|
-
• How users can contact you about data concerns
|
|
1095
|
-
The policy must be publicly accessible. If you don't have one yet, create one before submitting — there are free generators online, but make sure it accurately reflects your actual practices. If you're GDPR-compliant, your policy should reflect that.`),
|
|
1096
|
-
supportChannel: supportChannelSchema.describe(`A URL or email address where users can get help with your connector. This is displayed in the Directory listing. Acceptable options:
|
|
1097
|
-
• Email address (e.g. support@myapp.com)
|
|
1098
|
-
• Link to a GitHub Issues page
|
|
1099
|
-
• Link to a help center or support article
|
|
1100
|
-
• Link to a Discord/Slack community
|
|
1101
|
-
• Link to your documentation's troubleshooting section
|
|
1102
|
-
Also uses this to notify you of security or compliance issues, so make sure it's actively monitored.`),
|
|
1103
|
-
testingCredentials: z.string().describe(`Provide login credentials for a test account that Anthropic reviewers can use to verify your server works end-to-end. Critical requirements:
|
|
1104
|
-
• The account must have sample/demo data loaded — reviewers need to actually test your tools with real data.
|
|
1105
|
-
• No 2FA — reviewers can't receive SMS codes. Disable 2FA on this account.
|
|
1106
|
-
• If your service uses Google OAuth or another OAuth that requires email verification, use mcp-review@anthropic.com as the account email — Anthropic has access to this inbox.
|
|
1107
|
-
• Credentials must remain valid for at least 30 days from submission.
|
|
1108
|
-
• If your service requires API keys instead of a password, provide those.
|
|
1109
|
-
Format suggestion: Username/email: xxx | Password: xxx | Any other notes`),
|
|
1110
|
-
tools: z.array(toolDefinitionSchema).describe(`A comma-separated list of all tools your MCP server exposes. Use the format: tool_name (Human-Readable Name). The tool_name is the internal identifier (snake_case, max 64 characters). The Human-Readable Name is what users see.
|
|
1111
|
-
Example: list_issues (List Issues), create_issue (Create Issue), update_issue (Update Issue), delete_issue (Delete Issue), search_issues (Search Issues)
|
|
1112
|
-
Reviewers test every single tool you list here — don't list tools that don't work. Also: do not have a single catch-all tool like api_request(method, endpoint) — Anthropic rejects these. Each action should be its own purpose-built tool.`),
|
|
1113
|
-
toolTitlesAnnotationsConfirmed: z.boolean().describe(`This is a compliance confirmation — check both boxes only if you have actually implemented these in your server code:
|
|
1114
|
-
• 'I've specified user-friendly titles for all tools' — every tool has a 'title' annotation (a human-readable label, different from the tool name).
|
|
1115
|
-
• 'I've specified accurate tool annotations for all tools' — every tool has the correct annotation: readOnlyHint: true for read operations (search, get, list, fetch), OR destructiveHint: true for write operations (create, update, delete, send).
|
|
1116
|
-
This is the #1 reason submissions get rejected (30% of all rejections). Do not check these boxes without actually having implemented the annotations. See MCP spec for how to add them.`),
|
|
1117
|
-
testedSurfaces: z.array(claudeTestedSurfaceSchema).describe(`Confirm testing is complete and your server works as intended in these surfaces. Select every surface you've verified. Claude.ai (web) and Claude Desktop are the usual targets for remote MCP servers; Claude Code and Cowork compatibility is not required. Anthropic requires at least two surfaces.`),
|
|
1118
|
-
logoLight: z.string().describe(`Your connector's logo for light backgrounds. Requirements:
|
|
1119
|
-
• Format: SVG only
|
|
1120
|
-
• Aspect ratio: square (1:1)
|
|
1121
|
-
• Should work on a light background
|
|
1122
|
-
• Provide via URL (Google Drive link is fine) or upload directly
|
|
1123
|
-
Tip: use a simple, recognizable icon — not a full wordmark. The logo appears at small sizes in the directory grid.`),
|
|
1124
|
-
logoDark: z.string().optional().describe(`Optional dark-mode variant of the connector logo. Same specs as the light variant (SVG, square 1:1) but designed to read on a dark background. Leave empty if the light logo already works on dark.`),
|
|
1125
|
-
screenshots: z.array(screenshotEntrySchema).describe(`Screenshots or promotional images of your connector in action within Claude. Strongly recommended for all connectors, and required for MCP Apps (interactive UI). Guidelines:
|
|
1126
|
-
• 3–5 images is ideal
|
|
1127
|
-
• Minimum 1000px width, PNG format preferred
|
|
1128
|
-
• Each screenshot is paired with the user prompt that produced it
|
|
1129
|
-
• Crop to just the relevant part of the Claude interface (the tool response area)
|
|
1130
|
-
• Show your connector doing something impressive and useful — real data, real results
|
|
1131
|
-
• If you're an MCP App, include screenshots of your interactive UI elements
|
|
1132
|
-
These images appear in your directory listing and are a key factor in driving user installs.`)
|
|
1133
|
-
});
|
|
1134
|
-
claudeSubmissionFormDataSchema.pick({
|
|
1135
|
-
companyName: true,
|
|
1136
|
-
appName: true,
|
|
1137
|
-
mcpUrlType: true,
|
|
3095
|
+
serverUrl: z.url().describe(`The full https:// URL where your MCP server is hosted and reachable. In the claude.ai wizard this is read live
|
|
3096
|
+
from the custom connector you select — the connection is used to verify the URL and the tool list at submission time.
|
|
3097
|
+
The server must be publicly accessible without VPN or whitelisting.`),
|
|
3098
|
+
name: z.string().max(100).describe(`The public display name for your connector as it appears in the directory. Use your brand/product name. You must
|
|
3099
|
+
own or have the right to use this name. Max 100 characters.`),
|
|
3100
|
+
slug: z.string().max(50).regex(/^[a-z0-9-]+$/).describe(`URL-safe identifier for your connector's directory page. Lowercase letters, numbers, and hyphens only.
|
|
3101
|
+
PERMANENT after submission — it cannot be changed. Pre-filled from the name. Max 50 characters.`),
|
|
3102
|
+
oneLiner: z.string().max(200).describe(`A short tagline shown below your connector name in the directory listing. Max 200 characters. Avoid generic
|
|
3103
|
+
phrases like 'The best MCP server for...'. Example: 'Manage tasks and projects in Linear'.`),
|
|
3104
|
+
description: z.string().max(2e3).describe(`A description of what your connector does and its key features, shown on the connector's detail page in
|
|
3105
|
+
claude.ai. Write it from a user perspective and be specific. Max 2000 characters.`),
|
|
3106
|
+
categories: z.array(claudeCategorySchema).max(5).describe(claudeCategoryDescription),
|
|
3107
|
+
iconUrl: z.url().optional().describe(`Optional custom icon for the directory listing — a square SVG. By default the favicon from your MCP URL is used
|
|
3108
|
+
(recommended); upload a custom icon only to override it.`),
|
|
3109
|
+
documentation: z.url().describe(`A public URL pointing to documentation that helps users understand and use your connector. Must be publicly
|
|
3110
|
+
accessible without login. IT admins often review these when deciding whether to approve a server. Required to be live
|
|
3111
|
+
by your publish date.`),
|
|
3112
|
+
support: supportChannelSchema.describe(`A support URL or email address where users can get help with your connector. Displayed in the directory listing and
|
|
3113
|
+
used to notify you of security or compliance issues, so make sure it's actively monitored.`),
|
|
3114
|
+
privacyPolicy: z.url().describe(`URL to your privacy policy. Mandatory and displayed in the directory listing. Must be publicly accessible and cover
|
|
3115
|
+
what data you collect, how you use and store it, and whether you share it with third parties.`),
|
|
3116
|
+
screenshots: z.array(screenshotEntrySchema).optional().describe(`Carousel images shown on your connector's directory page (PNG). Each is paired with the user prompt that produced
|
|
3117
|
+
it. This is editable on the directory page only after the connector is submitted — optional here so you can prepare it.`),
|
|
3118
|
+
primaryUseCases: z.string().describe(`Describe the main tasks users will accomplish with this connector, and include a few example prompts a user might
|
|
3119
|
+
type. These may be shown publicly but are primarily used for internal review — reviewers test your server using them.`),
|
|
3120
|
+
connectionRequirements: z.string().describe(`What accounts, permissions, or setup a user needs before connecting (e.g. 'Requires a paid Acme account with admin
|
|
3121
|
+
permissions'). If there are genuinely no special requirements, say so explicitly.`),
|
|
3122
|
+
readWriteCapabilities: claudeReadWriteCapabilitiesSchema.describe(`What your server can do:
|
|
3123
|
+
• 'read_only': retrieves data but never modifies it.
|
|
3124
|
+
• 'write_only': creates or modifies data but does not read it.
|
|
3125
|
+
• 'read_write': both retrieves and modifies data (most common).`),
|
|
3126
|
+
companyName: z.string().describe("The company or organization behind this connector — its legal name or publicly known product name."),
|
|
3127
|
+
companyWebsite: z.url().describe("The company's main website URL, e.g. https://example.com."),
|
|
3128
|
+
primaryContactName: z.string().describe("Full name of the person Anthropic should contact about this submission. Receives review feedback and follow-up questions."),
|
|
3129
|
+
primaryContactEmail: z.email().describe("Email for the primary contact (pre-filled from the Claude account). Anthropic uses this to communicate about your submission."),
|
|
3130
|
+
primaryContactRole: z.string().optional().describe("The primary contact's role at the company (e.g. 'Engineer', 'Product Manager'). Optional."),
|
|
3131
|
+
anthropicPointOfContact: z.string().optional().describe("If you've been working with someone at Anthropic, their name or email. Optional, can expedite review."),
|
|
3132
|
+
authentication: claudeAuthenticationSchema.describe(`How users authenticate with your server:
|
|
3133
|
+
• 'oauth_dcr': OAuth 2.0 + Dynamic Client Registration (RFC 7591) — clients register themselves.
|
|
3134
|
+
• 'oauth_cimd': OAuth 2.0 + Client ID Metadata Document — a published client_id metadata document.
|
|
3135
|
+
• 'oauth_anthropic_creds': OAuth 2.0 with Anthropic-held client credentials (a static client_id, and secret if needed).
|
|
3136
|
+
• 'custom_connection': users supply their own URL or client details at connection time (e.g. Snowflake).
|
|
3137
|
+
• 'none': no authentication (authless) — anyone can connect and call tools without credentials.`),
|
|
3138
|
+
partialAuth: z.boolean().optional().describe("Whether some tools return 401 and prompt for auth on demand while the server otherwise starts authless (partial auth)."),
|
|
3139
|
+
apiOwnership: claudeApiOwnershipSchema.describe(`How your connector relates to the API it calls:
|
|
3140
|
+
• 'first_party': the MCP server calls your own production APIs.
|
|
3141
|
+
• 'proxied': calls go to a third-party API you're authorized to integrate (e.g. a Zapier-style integration).
|
|
3142
|
+
• 'third_party': calls a third-party API you don't control — typically blocks listing; explain in 'additionalNotes'.`),
|
|
3143
|
+
personalHealthData: claudeYesNoOtherSchema.describe(`Whether this connector accesses, processes, or stores personal health information.
|
|
3144
|
+
No → false, Yes → true, or { other: explanation } when it depends on configuration.`),
|
|
3145
|
+
sponsoredContent: claudeYesNoOtherSchema.describe(`Whether this connector surfaces sponsored, promoted, or advertising content (prohibited in directory connectors).
|
|
3146
|
+
No → false, Yes → true, or { other: explanation }.`),
|
|
3147
|
+
testInstructions: z.string().optional().describe(`Clear test-account setup and access instructions for reviewers: every link, credential, and step needed to access
|
|
3148
|
+
the MCP server autonomously. For accounts that need to be populated, provide test credentials granting access to a
|
|
3149
|
+
fully populated account.`),
|
|
3150
|
+
selfTested: z.boolean().optional().describe("Confirmation that you have run every tool via MCP Inspector or as a custom connector in Claude."),
|
|
3151
|
+
policyAcknowledgements: z.array(claudePolicyAcknowledgementSchema).describe(`Anthropic directory policy acknowledgements. All items must be acknowledged before the claude.ai wizard allows
|
|
3152
|
+
submission. Each is an attestation you are legally agreeing to by submitting.`),
|
|
3153
|
+
additionalNotes: z.string().optional().describe("Anything else the review team should know about your connector. Optional.")
|
|
3154
|
+
});
|
|
3155
|
+
const claudeSubmissionDraftSchema = claudeSubmissionFormDataSchema.partial().extend({
|
|
3156
|
+
serverUrl: z.string().optional(),
|
|
3157
|
+
name: z.string().optional(),
|
|
3158
|
+
slug: z.string().optional(),
|
|
3159
|
+
oneLiner: z.string().optional(),
|
|
3160
|
+
description: z.string().optional(),
|
|
3161
|
+
iconUrl: z.string().optional(),
|
|
3162
|
+
documentation: z.string().optional(),
|
|
3163
|
+
support: z.string().optional(),
|
|
3164
|
+
privacyPolicy: z.string().optional(),
|
|
3165
|
+
companyWebsite: z.string().optional(),
|
|
3166
|
+
primaryContactEmail: z.string().optional(),
|
|
3167
|
+
categories: z.array(claudeCategorySchema).optional(),
|
|
3168
|
+
screenshots: z.array(screenshotDraftEntrySchema).optional()
|
|
3169
|
+
});
|
|
3170
|
+
/** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "claudeai" })` can populate. */
|
|
3171
|
+
const claudePrefillFormDataSchema = claudeSubmissionFormDataSchema.pick({
|
|
1138
3172
|
serverUrl: true,
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
transportSupport: true,
|
|
3173
|
+
name: true,
|
|
3174
|
+
slug: true,
|
|
3175
|
+
companyName: true,
|
|
1143
3176
|
primaryContactEmail: true,
|
|
1144
3177
|
primaryContactName: true,
|
|
3178
|
+
readWriteCapabilities: true,
|
|
1145
3179
|
authentication: true,
|
|
1146
|
-
|
|
1147
|
-
|
|
3180
|
+
apiOwnership: true,
|
|
3181
|
+
personalHealthData: true
|
|
1148
3182
|
}).extend({
|
|
1149
3183
|
connectionRequirements: claudeSubmissionFormDataSchema.shape.connectionRequirements.optional(),
|
|
1150
|
-
|
|
3184
|
+
testInstructions: claudeSubmissionFormDataSchema.shape.testInstructions.optional()
|
|
3185
|
+
});
|
|
3186
|
+
/** Loose shape returned by AI generation for Claude narrative fields; transforms live here so generation leniency stays colocated with the Claude contract. */
|
|
3187
|
+
const claudeAiGeneratedFormDataRawSchema = z.object({
|
|
3188
|
+
oneLiner: claudeSubmissionFormDataSchema.shape.oneLiner,
|
|
3189
|
+
description: claudeSubmissionFormDataSchema.shape.description,
|
|
3190
|
+
categories: z.array(claudeCategorySchema).describe(claudeCategoryDescription),
|
|
3191
|
+
primaryUseCases: claudeSubmissionFormDataSchema.shape.primaryUseCases
|
|
3192
|
+
});
|
|
3193
|
+
const claudeAiGeneratedFormDataSchema = claudeAiGeneratedFormDataRawSchema.extend({
|
|
3194
|
+
oneLiner: clampStringField(claudeSubmissionFormDataSchema.shape.oneLiner),
|
|
3195
|
+
categories: claudeAiGeneratedFormDataRawSchema.shape.categories.transform((categories) => categories.slice(0, 5))
|
|
3196
|
+
});
|
|
3197
|
+
function provenanceByField(prefillShape, aiGeneratedShape) {
|
|
3198
|
+
const byField = {};
|
|
3199
|
+
for (const field of Object.keys(prefillShape)) byField[field] = "prefilled";
|
|
3200
|
+
for (const field of Object.keys(aiGeneratedShape)) byField[field] = "ai-generated";
|
|
3201
|
+
return byField;
|
|
3202
|
+
}
|
|
3203
|
+
provenanceByField(claudePrefillFormDataSchema.shape, claudeAiGeneratedFormDataSchema.shape), provenanceByField(chatgptPrefillFormDataSchema.shape, chatgptAiGeneratedFormDataSchema.shape);
|
|
3204
|
+
const urlVerificationOutcomeSchema = z.enum([
|
|
3205
|
+
"pass",
|
|
3206
|
+
"fail",
|
|
3207
|
+
"unverified"
|
|
3208
|
+
]);
|
|
3209
|
+
const VERIFIABLE_URL_FIELDS = {
|
|
3210
|
+
chatgpt: ["privacyPolicyUrl", "termsOfServiceUrl"],
|
|
3211
|
+
claudeai: ["privacyPolicy"]
|
|
3212
|
+
};
|
|
3213
|
+
const verifiableUrlFieldSchema = z.enum([...VERIFIABLE_URL_FIELDS.chatgpt, ...VERIFIABLE_URL_FIELDS.claudeai]);
|
|
3214
|
+
const policyDisclosureSchema = z.enum([
|
|
3215
|
+
"dataCategories",
|
|
3216
|
+
"purposesOfUse",
|
|
3217
|
+
"recipients",
|
|
3218
|
+
"retention"
|
|
3219
|
+
]);
|
|
3220
|
+
const urlVerificationFieldResultSchema = z.object({
|
|
3221
|
+
field: verifiableUrlFieldSchema,
|
|
3222
|
+
url: z.string(),
|
|
3223
|
+
outcome: urlVerificationOutcomeSchema,
|
|
3224
|
+
reason: z.string(),
|
|
3225
|
+
concerns: z.array(z.string()).optional(),
|
|
3226
|
+
scrapedWith: z.enum(["fetch", "firecrawl"]).optional()
|
|
3227
|
+
});
|
|
3228
|
+
const urlVerificationSchema = z.object({
|
|
3229
|
+
verifiedAt: z.coerce.date(),
|
|
3230
|
+
results: z.array(urlVerificationFieldResultSchema)
|
|
3231
|
+
});
|
|
3232
|
+
const pageKindSchema = z.enum([
|
|
3233
|
+
"expectedDocument",
|
|
3234
|
+
"errorPage",
|
|
3235
|
+
"loginWall",
|
|
3236
|
+
"parkedDomain",
|
|
3237
|
+
"comingSoon",
|
|
3238
|
+
"marketingPage",
|
|
3239
|
+
"unrelatedDocument"
|
|
3240
|
+
]);
|
|
3241
|
+
z.object({
|
|
3242
|
+
pageKind: pageKindSchema.describe("What the page actually is. Use 'expectedDocument' only when it is genuinely the document the field claims."),
|
|
3243
|
+
reason: z.string().max(200).describe("One sentence naming what the page is, addressed to the developer who entered the URL."),
|
|
3244
|
+
missingDisclosures: z.array(policyDisclosureSchema).describe("For a privacy policy only: which of the four required disclosures the text does not cover. Empty for every other page kind.")
|
|
1151
3245
|
});
|
|
1152
|
-
claudeSubmissionFormDataSchema.pick({
|
|
1153
|
-
tagline: true,
|
|
1154
|
-
description: true,
|
|
1155
|
-
category: true,
|
|
1156
|
-
testCases: true
|
|
1157
|
-
}).extend({ tagline: clampStringField(claudeSubmissionFormDataSchema.shape.tagline) });
|
|
1158
3246
|
const submissionMetaFieldsSchema = z.object({
|
|
1159
3247
|
id: z.string(),
|
|
1160
3248
|
environmentId: z.string(),
|
|
1161
3249
|
auditId: z.string().nullable(),
|
|
3250
|
+
urlVerification: urlVerificationSchema.nullable().default(null),
|
|
1162
3251
|
createdAt: z.coerce.date(),
|
|
1163
3252
|
updatedAt: z.coerce.date()
|
|
1164
3253
|
});
|
|
1165
3254
|
const claudeSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
|
|
1166
3255
|
platform: z.literal("claudeai"),
|
|
1167
|
-
formData:
|
|
3256
|
+
formData: claudeSubmissionDraftSchema,
|
|
3257
|
+
prefillSnapshot: claudeSubmissionDraftSchema.nullable().default(null)
|
|
1168
3258
|
});
|
|
1169
3259
|
const chatgptSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
|
|
1170
3260
|
platform: z.literal("chatgpt"),
|
|
1171
|
-
formData:
|
|
3261
|
+
formData: chatgptSubmissionDraftSchema,
|
|
3262
|
+
prefillSnapshot: chatgptSubmissionDraftSchema.nullable().default(null)
|
|
1172
3263
|
});
|
|
1173
|
-
z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
|
|
1174
|
-
z.union([
|
|
3264
|
+
const submissionSchemaInternal = z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
|
|
3265
|
+
z.union([claudeSubmissionDraftSchema, chatgptSubmissionDraftSchema]);
|
|
3266
|
+
/** Discriminated on `platform`, which pins the shape of `formData`: a Claude submission cannot carry chatgpt-only fields, and vice-versa. */
|
|
3267
|
+
const submissionSchema = submissionSchemaInternal;
|
|
3268
|
+
z.literal([
|
|
3269
|
+
100,
|
|
3270
|
+
75,
|
|
3271
|
+
50
|
|
3272
|
+
]);
|
|
1175
3273
|
const subscriptionPlanSchema = z.enum([
|
|
1176
3274
|
"pro",
|
|
1177
3275
|
"business",
|
|
@@ -1183,19 +3281,84 @@ const customerCreditsSchema = z.object({
|
|
|
1183
3281
|
expiresAt: z.number().nullable(),
|
|
1184
3282
|
currency: z.string()
|
|
1185
3283
|
});
|
|
1186
|
-
const customerUsageSchema = z.object({
|
|
1187
|
-
amountInCents: z.number(),
|
|
1188
|
-
currency: z.string(),
|
|
1189
|
-
periodEnd: z.number()
|
|
1190
|
-
});
|
|
1191
3284
|
const partnerDiscountSchema = z.object({ endsAt: z.number() });
|
|
1192
3285
|
z.object({
|
|
1193
3286
|
customerCredits: customerCreditsSchema.nullable(),
|
|
1194
|
-
customerUsage: customerUsageSchema.nullable(),
|
|
1195
3287
|
partnerDiscount: partnerDiscountSchema.nullable()
|
|
1196
3288
|
});
|
|
1197
|
-
|
|
1198
|
-
|
|
3289
|
+
const metricsQueueEventSchema = z.object({
|
|
3290
|
+
ts: z.number().int(),
|
|
3291
|
+
method: z.string(),
|
|
3292
|
+
tool: z.string().nullable(),
|
|
3293
|
+
client: z.string(),
|
|
3294
|
+
sessionId: z.string().nullable(),
|
|
3295
|
+
conversationId: z.string().nullable().optional(),
|
|
3296
|
+
durationMs: z.number().int(),
|
|
3297
|
+
outputTokens: z.number().int().nullable(),
|
|
3298
|
+
errorType: z.enum([
|
|
3299
|
+
"mcp_error",
|
|
3300
|
+
"tool_error",
|
|
3301
|
+
"timeout"
|
|
3302
|
+
]).nullable(),
|
|
3303
|
+
errorCode: z.number().int().nullable()
|
|
3304
|
+
});
|
|
3305
|
+
z.object({
|
|
3306
|
+
v: z.literal(1),
|
|
3307
|
+
envId: z.string(),
|
|
3308
|
+
events: z.array(metricsQueueEventSchema)
|
|
3309
|
+
});
|
|
3310
|
+
z.object({ v: z.number() });
|
|
3311
|
+
const TELEMETRY_SIGNALS = [
|
|
3312
|
+
"logs",
|
|
3313
|
+
"metrics",
|
|
3314
|
+
"traces"
|
|
3315
|
+
];
|
|
3316
|
+
const telemetrySignalSchema = z.enum(TELEMETRY_SIGNALS);
|
|
3317
|
+
const OTLP_PROTOCOLS = ["http/protobuf", "http/json"];
|
|
3318
|
+
const otlpProtocolSchema = z.enum(OTLP_PROTOCOLS);
|
|
3319
|
+
const otlpEndpointSchema = z.string().trim().min(1).max(2048);
|
|
3320
|
+
const OTLP_HEADER_VALUE_MAX_LENGTH = 2048;
|
|
3321
|
+
const otlpHeaderNameSchema = z.string().trim().min(1, "Enter a header name").max(128).regex(/^[A-Za-z0-9!#$%&'*+\-.^_`|~]+$/, "Use letters, digits and !#$%&'*+-.^_`|~ only");
|
|
3322
|
+
const otlpHeaderValueSchema = z.string().trim().max(OTLP_HEADER_VALUE_MAX_LENGTH).refine((value) => !/[\r\n]/.test(value), "Line breaks are not allowed in a header value");
|
|
3323
|
+
const telemetryDestinationHeaderSchema = z.object({
|
|
3324
|
+
id: z.string(),
|
|
3325
|
+
name: otlpHeaderNameSchema,
|
|
3326
|
+
value: otlpHeaderValueSchema,
|
|
3327
|
+
isSecret: z.boolean()
|
|
3328
|
+
});
|
|
3329
|
+
const otlpPushFailureReasonSchema = z.enum([
|
|
3330
|
+
"credentials",
|
|
3331
|
+
"wrong-path",
|
|
3332
|
+
"wrong-protocol",
|
|
3333
|
+
"invalid-payload",
|
|
3334
|
+
"partial-rejection",
|
|
3335
|
+
"blocked-target",
|
|
3336
|
+
"timeout",
|
|
3337
|
+
"unreachable",
|
|
3338
|
+
"receiver-error",
|
|
3339
|
+
"unexpected-status"
|
|
3340
|
+
]);
|
|
3341
|
+
const telemetryDestinationStatusSchema = z.enum(["active", "suspended"]);
|
|
3342
|
+
z.object({
|
|
3343
|
+
id: z.string(),
|
|
3344
|
+
signal: telemetrySignalSchema,
|
|
3345
|
+
endpoint: otlpEndpointSchema,
|
|
3346
|
+
protocol: otlpProtocolSchema,
|
|
3347
|
+
headers: z.array(telemetryDestinationHeaderSchema),
|
|
3348
|
+
status: telemetryDestinationStatusSchema,
|
|
3349
|
+
lastFailureReason: otlpPushFailureReasonSchema.nullable(),
|
|
3350
|
+
isScopedToIntentionalRequestsOnly: z.boolean()
|
|
3351
|
+
});
|
|
3352
|
+
const hasDuplicateHeaderNames = (headers) => {
|
|
3353
|
+
const names = headers.map(({ name }) => name.trim().toLowerCase());
|
|
3354
|
+
return new Set(names).size !== names.length;
|
|
3355
|
+
};
|
|
3356
|
+
// src/auth-scope.ts
|
|
3357
|
+
/** Accepts an API key or OAuth access token (default for most routes). */
|
|
3358
|
+
const AUTH_SCOPE_ANY = "any";
|
|
3359
|
+
/** Requires a user OAuth access token; API keys are not accepted. */
|
|
3360
|
+
const AUTH_SCOPE_USER = "user";
|
|
3361
|
+
// src/schemas.ts
|
|
1199
3362
|
const RESERVED_KEYS = [
|
|
1200
3363
|
"_HANDLER",
|
|
1201
3364
|
"_X_AMZN_TRACE_ID",
|
|
@@ -1230,7 +3393,10 @@ const RESERVED_KEYS = [
|
|
|
1230
3393
|
"BUILD_ARG_START_COMMAND",
|
|
1231
3394
|
"ALPIC_HOST",
|
|
1232
3395
|
"ALPIC_CUSTOM_DOMAINS",
|
|
1233
|
-
"ALPIC_INTENT_META_KEY"
|
|
3396
|
+
"ALPIC_INTENT_META_KEY",
|
|
3397
|
+
"ALPIC_FEEDBACK_META_KEY",
|
|
3398
|
+
"ALPIC_EVENTS_META_KEY",
|
|
3399
|
+
"ALPIC_IDENTIFY_META_KEY"
|
|
1234
3400
|
];
|
|
1235
3401
|
const environmentVariableSchema = z.object({
|
|
1236
3402
|
key: z.string().min(2, "Key must be at least 2 characters").regex(/^[a-zA-Z]([a-zA-Z0-9_])+$/, "Key must start with a letter and contain only letters, numbers, and underscores").refine((key) => !RESERVED_KEYS.includes(key), "This key is reserved and cannot be used as an environment variable key"),
|
|
@@ -1281,8 +3447,15 @@ const serverFieldsSchema = z.object({
|
|
|
1281
3447
|
})).optional()
|
|
1282
3448
|
})).optional()
|
|
1283
3449
|
});
|
|
1284
|
-
|
|
1285
|
-
|
|
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
|
+
};
|
|
1286
3459
|
const deploymentStatusSchema = z.enum([
|
|
1287
3460
|
"ongoing",
|
|
1288
3461
|
"deployed",
|
|
@@ -1311,21 +3484,20 @@ const deploymentSchema = z.object({
|
|
|
1311
3484
|
isCurrent: z.boolean(),
|
|
1312
3485
|
deploymentPageUrl: z.url().nullable()
|
|
1313
3486
|
});
|
|
1314
|
-
const
|
|
3487
|
+
const isValidTimeInput = (value) => {
|
|
1315
3488
|
if (ms(value) !== void 0) return true;
|
|
1316
3489
|
return !Number.isNaN(new Date(value).getTime());
|
|
1317
3490
|
};
|
|
1318
|
-
const
|
|
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({
|
|
1319
3494
|
path: "/v1/environments",
|
|
1320
3495
|
method: "POST",
|
|
1321
3496
|
summary: "Create an environment",
|
|
1322
3497
|
description: "Create an environment for a project",
|
|
1323
3498
|
tags: ["environments"],
|
|
1324
3499
|
successDescription: "The environment has been created successfully"
|
|
1325
|
-
}).errors({
|
|
1326
|
-
NOT_FOUND: {},
|
|
1327
|
-
BAD_REQUEST: {}
|
|
1328
|
-
}).input(z.object({
|
|
3500
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1329
3501
|
projectId: z.string().describe("The ID of the project to create the environment for"),
|
|
1330
3502
|
name: z.string().min(1).describe("The name of the environment"),
|
|
1331
3503
|
sourceBranch: z.string().min(1).describe("The branch used to build the environment"),
|
|
@@ -1338,7 +3510,7 @@ const createEnvironmentContractV1 = oc.route({
|
|
|
1338
3510
|
createdAt: z.coerce.date(),
|
|
1339
3511
|
projectId: z.string().describe("The ID of the project the environment belongs to")
|
|
1340
3512
|
}));
|
|
1341
|
-
const getEnvironmentContractV1 =
|
|
3513
|
+
const getEnvironmentContractV1 = base.route({
|
|
1342
3514
|
path: "/v1/environments/{environmentId}",
|
|
1343
3515
|
method: "GET",
|
|
1344
3516
|
summary: "Get an environment",
|
|
@@ -1354,6 +3526,14 @@ const getEnvironmentContractV1 = oc.route({
|
|
|
1354
3526
|
createdAt: z.coerce.date(),
|
|
1355
3527
|
projectId: z.string()
|
|
1356
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) }));
|
|
1357
3537
|
const domainSchema = z.object({
|
|
1358
3538
|
domain: z.string(),
|
|
1359
3539
|
status: z.enum([
|
|
@@ -1395,7 +3575,7 @@ const projectOutputSchema = z.object({
|
|
|
1395
3575
|
productionEnvironment: productionEnvironmentSchema.nullable(),
|
|
1396
3576
|
environments: z.array(environmentSchema)
|
|
1397
3577
|
});
|
|
1398
|
-
const getProjectContractV1 =
|
|
3578
|
+
const getProjectContractV1 = base.route({
|
|
1399
3579
|
path: "/v1/projects/{projectId}",
|
|
1400
3580
|
method: "GET",
|
|
1401
3581
|
summary: "Get a project",
|
|
@@ -1403,18 +3583,15 @@ const getProjectContractV1 = oc.route({
|
|
|
1403
3583
|
tags: ["projects"],
|
|
1404
3584
|
successDescription: "The project details"
|
|
1405
3585
|
}).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(projectOutputSchema);
|
|
1406
|
-
const listProjectsContractV1 =
|
|
3586
|
+
const listProjectsContractV1 = base.route({
|
|
1407
3587
|
path: "/v1/projects",
|
|
1408
3588
|
method: "GET",
|
|
1409
3589
|
summary: "List projects",
|
|
1410
3590
|
description: "List all projects for a team",
|
|
1411
3591
|
tags: ["projects"],
|
|
1412
3592
|
successDescription: "The list of projects"
|
|
1413
|
-
}).errors({
|
|
1414
|
-
|
|
1415
|
-
BAD_REQUEST: {}
|
|
1416
|
-
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
|
|
1417
|
-
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({
|
|
1418
3595
|
path: "/v1/projects",
|
|
1419
3596
|
method: "POST",
|
|
1420
3597
|
summary: "Create a project",
|
|
@@ -1423,7 +3600,7 @@ const createProjectContractV1 = oc.route({
|
|
|
1423
3600
|
successDescription: "The project has been created successfully"
|
|
1424
3601
|
}).errors({
|
|
1425
3602
|
NOT_FOUND: {},
|
|
1426
|
-
|
|
3603
|
+
FORBIDDEN: {}
|
|
1427
3604
|
}).input(z.object({
|
|
1428
3605
|
teamId: z.string().optional(),
|
|
1429
3606
|
name: z.string().trim().min(1).max(100),
|
|
@@ -1463,7 +3640,101 @@ const environmentVariableOutputSchema = z.object({
|
|
|
1463
3640
|
isSecret: z.boolean(),
|
|
1464
3641
|
createdAt: z.coerce.date()
|
|
1465
3642
|
});
|
|
1466
|
-
const
|
|
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({
|
|
1467
3738
|
path: "/v1/environments/{environmentId}/environment-variables",
|
|
1468
3739
|
method: "GET",
|
|
1469
3740
|
summary: "List environment variables",
|
|
@@ -1471,48 +3742,39 @@ const listEnvironmentVariablesContractV1 = oc.route({
|
|
|
1471
3742
|
tags: ["environments"],
|
|
1472
3743
|
successDescription: "The list of environment variables"
|
|
1473
3744
|
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(environmentVariableOutputSchema));
|
|
1474
|
-
const createEnvironmentVariablesContractV1 =
|
|
3745
|
+
const createEnvironmentVariablesContractV1 = base.route({
|
|
1475
3746
|
path: "/v1/environments/{environmentId}/environment-variables",
|
|
1476
3747
|
method: "POST",
|
|
1477
3748
|
summary: "Add environment variables",
|
|
1478
3749
|
description: "Add one or more environment variables to an environment",
|
|
1479
3750
|
tags: ["environments"],
|
|
1480
3751
|
successDescription: "The environment variables have been added successfully"
|
|
1481
|
-
}).errors({
|
|
1482
|
-
NOT_FOUND: {},
|
|
1483
|
-
BAD_REQUEST: {}
|
|
1484
|
-
}).input(z.object({
|
|
3752
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1485
3753
|
environmentId: z.string().describe("The ID of the environment"),
|
|
1486
3754
|
environmentVariables: environmentVariablesSchema
|
|
1487
3755
|
})).output(z.object({ success: z.literal(true) }));
|
|
1488
|
-
const updateEnvironmentVariableContractV1 =
|
|
3756
|
+
const updateEnvironmentVariableContractV1 = base.route({
|
|
1489
3757
|
path: "/v1/environment-variables/{environmentVariableId}",
|
|
1490
3758
|
method: "PATCH",
|
|
1491
3759
|
summary: "Update an environment variable",
|
|
1492
3760
|
description: "Update an environment variable by ID",
|
|
1493
3761
|
tags: ["environments"],
|
|
1494
3762
|
successDescription: "The environment variable has been updated successfully"
|
|
1495
|
-
}).errors({
|
|
1496
|
-
NOT_FOUND: {},
|
|
1497
|
-
BAD_REQUEST: {}
|
|
1498
|
-
}).input(z.object({
|
|
3763
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1499
3764
|
environmentVariableId: z.string().describe("The ID of the environment variable"),
|
|
1500
3765
|
key: environmentVariableSchema.shape.key,
|
|
1501
3766
|
value: environmentVariableSchema.shape.value.optional(),
|
|
1502
3767
|
isSecret: environmentVariableSchema.shape.isSecret.optional()
|
|
1503
3768
|
})).output(z.object({ success: z.literal(true) }));
|
|
1504
|
-
const deleteEnvironmentVariableContractV1 =
|
|
3769
|
+
const deleteEnvironmentVariableContractV1 = base.route({
|
|
1505
3770
|
path: "/v1/environment-variables/{environmentVariableId}",
|
|
1506
3771
|
method: "DELETE",
|
|
1507
3772
|
summary: "Delete an environment variable",
|
|
1508
3773
|
description: "Delete an environment variable by ID",
|
|
1509
3774
|
tags: ["environments"],
|
|
1510
3775
|
successDescription: "The environment variable has been deleted successfully"
|
|
1511
|
-
}).errors({
|
|
1512
|
-
|
|
1513
|
-
BAD_REQUEST: {}
|
|
1514
|
-
}).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
|
|
1515
|
-
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({
|
|
1516
3778
|
path: "/v1/projects/{projectId}",
|
|
1517
3779
|
method: "DELETE",
|
|
1518
3780
|
summary: "Delete a project",
|
|
@@ -1520,7 +3782,7 @@ const deleteProjectContractV1 = oc.route({
|
|
|
1520
3782
|
tags: ["projects"],
|
|
1521
3783
|
successDescription: "The project has been deleted successfully"
|
|
1522
3784
|
}).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(z.object({ success: z.literal(true) }));
|
|
1523
|
-
const updateProjectContractV1 =
|
|
3785
|
+
const updateProjectContractV1 = base.route({
|
|
1524
3786
|
path: "/v1/projects/{projectId}",
|
|
1525
3787
|
method: "PATCH",
|
|
1526
3788
|
summary: "Update a project",
|
|
@@ -1529,13 +3791,13 @@ const updateProjectContractV1 = oc.route({
|
|
|
1529
3791
|
successDescription: "The project has been updated successfully"
|
|
1530
3792
|
}).errors({
|
|
1531
3793
|
NOT_FOUND: {},
|
|
1532
|
-
|
|
3794
|
+
FORBIDDEN: {}
|
|
1533
3795
|
}).input(z.object({
|
|
1534
3796
|
projectId: z.string().describe("The ID of the project"),
|
|
1535
3797
|
name: z.string().min(1).max(100).optional().describe("The new name for the project"),
|
|
1536
3798
|
sourceRepository: z.string().nullable().optional().describe("The source repository to connect to the project")
|
|
1537
3799
|
})).output(projectOutputSchema);
|
|
1538
|
-
const deployEnvironmentContractV1 =
|
|
3800
|
+
const deployEnvironmentContractV1 = base.route({
|
|
1539
3801
|
path: "/v1/environments/{environmentId}/deploy",
|
|
1540
3802
|
method: "POST",
|
|
1541
3803
|
summary: "Deploy an environment",
|
|
@@ -1544,27 +3806,25 @@ const deployEnvironmentContractV1 = oc.route({
|
|
|
1544
3806
|
successDescription: "The environment has been deployed successfully"
|
|
1545
3807
|
}).errors({
|
|
1546
3808
|
NOT_FOUND: {},
|
|
1547
|
-
|
|
3809
|
+
CONFLICT: {}
|
|
1548
3810
|
}).input(z.object({
|
|
1549
3811
|
environmentId: z.string().describe("The ID of the environment to deploy"),
|
|
1550
|
-
token: z.string().describe("The token to identify the source archive").optional()
|
|
3812
|
+
token: z.string().describe("The token to identify the source archive").optional(),
|
|
3813
|
+
settings: buildSettingsSchema.extend({ transport: transportSchema }).optional().describe("Project settings detected by the client from the source. When provided, the server skips downloading and extracting the source archive to detect them.")
|
|
1551
3814
|
})).output(deploymentSchema);
|
|
1552
|
-
const uploadDeploymentArtifactContractV1 =
|
|
3815
|
+
const uploadDeploymentArtifactContractV1 = base.route({
|
|
1553
3816
|
path: "/v1/deployments/upload",
|
|
1554
3817
|
method: "POST",
|
|
1555
3818
|
summary: "Upload deployment artifacts",
|
|
1556
3819
|
description: "Return a presigned S3 URL to upload a deployment artifact",
|
|
1557
3820
|
tags: ["deployments"],
|
|
1558
3821
|
successDescription: "The presigned upload URL has been generated successfully"
|
|
1559
|
-
}).errors({
|
|
1560
|
-
NOT_FOUND: {},
|
|
1561
|
-
BAD_REQUEST: {}
|
|
1562
|
-
}).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({
|
|
1563
3823
|
uploadUrl: z.url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
|
|
1564
3824
|
token: z.string().describe("Token to identify the source archive"),
|
|
1565
3825
|
expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
|
|
1566
3826
|
}));
|
|
1567
|
-
const listDeploymentsContractV1 =
|
|
3827
|
+
const listDeploymentsContractV1 = base.route({
|
|
1568
3828
|
path: "/v1/projects/{projectId}/deployments",
|
|
1569
3829
|
method: "GET",
|
|
1570
3830
|
summary: "List project deployments",
|
|
@@ -1576,7 +3836,7 @@ const listDeploymentsContractV1 = oc.route({
|
|
|
1576
3836
|
status: z.array(deploymentStatusSchema).optional().describe("Filter by one or more statuses"),
|
|
1577
3837
|
environmentId: z.string().optional().describe("Filter by environment ID")
|
|
1578
3838
|
})).output(z.array(deploymentSchema));
|
|
1579
|
-
const getDeploymentContractV1 =
|
|
3839
|
+
const getDeploymentContractV1 = base.route({
|
|
1580
3840
|
path: "/v1/deployments/{deploymentId}",
|
|
1581
3841
|
method: "GET",
|
|
1582
3842
|
summary: "Get a deployment",
|
|
@@ -1584,20 +3844,32 @@ const getDeploymentContractV1 = oc.route({
|
|
|
1584
3844
|
tags: ["deployments"],
|
|
1585
3845
|
successDescription: "The deployment details"
|
|
1586
3846
|
}).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(deploymentSchema);
|
|
1587
|
-
const
|
|
3847
|
+
const logEntrySchema = z.object({
|
|
3848
|
+
timestamp: z.coerce.date(),
|
|
3849
|
+
type: z.enum([
|
|
3850
|
+
"START",
|
|
3851
|
+
"END",
|
|
3852
|
+
"INFO",
|
|
3853
|
+
"ERROR",
|
|
3854
|
+
"WARNING",
|
|
3855
|
+
"DEBUG"
|
|
3856
|
+
]),
|
|
3857
|
+
requestId: z.string(),
|
|
3858
|
+
content: z.string().optional(),
|
|
3859
|
+
method: z.string().optional(),
|
|
3860
|
+
durationInMs: z.number().optional()
|
|
3861
|
+
});
|
|
3862
|
+
const getLogsContractV1 = base.route({
|
|
1588
3863
|
path: "/v1/environments/{environmentId}/logs",
|
|
1589
3864
|
method: "GET",
|
|
1590
3865
|
summary: "Get logs",
|
|
1591
3866
|
description: "Get logs for an environment",
|
|
1592
3867
|
tags: ["environments"],
|
|
1593
3868
|
successDescription: "The logs"
|
|
1594
|
-
}).errors({
|
|
1595
|
-
NOT_FOUND: {},
|
|
1596
|
-
BAD_REQUEST: {}
|
|
1597
|
-
}).input(z.object({
|
|
3869
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1598
3870
|
environmentId: z.string().describe("The ID of the environment"),
|
|
1599
|
-
since:
|
|
1600
|
-
until:
|
|
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"),
|
|
1601
3873
|
limit: z.coerce.number().int().min(1).max(1e3).default(1e3).describe("Maximum number of log entries to return."),
|
|
1602
3874
|
level: z.array(z.enum([
|
|
1603
3875
|
"INFO",
|
|
@@ -1605,37 +3877,20 @@ const getLogsContractV1 = oc.route({
|
|
|
1605
3877
|
"WARNING",
|
|
1606
3878
|
"DEBUG"
|
|
1607
3879
|
])).optional().describe("Filter by log level"),
|
|
1608
|
-
search:
|
|
3880
|
+
search: logSearchSchema.optional().describe("Term to search for in log content"),
|
|
1609
3881
|
nextToken: z.string().optional().describe("Pagination token from a previous response")
|
|
1610
3882
|
})).output(z.object({
|
|
1611
|
-
logs: z.array(
|
|
1612
|
-
timestamp: z.coerce.date(),
|
|
1613
|
-
type: z.enum([
|
|
1614
|
-
"START",
|
|
1615
|
-
"END",
|
|
1616
|
-
"INFO",
|
|
1617
|
-
"ERROR",
|
|
1618
|
-
"WARNING",
|
|
1619
|
-
"DEBUG"
|
|
1620
|
-
]),
|
|
1621
|
-
requestId: z.string(),
|
|
1622
|
-
content: z.string().optional(),
|
|
1623
|
-
method: z.string().optional(),
|
|
1624
|
-
durationInMs: z.number().optional()
|
|
1625
|
-
})),
|
|
3883
|
+
logs: z.array(logEntrySchema),
|
|
1626
3884
|
nextToken: z.string().nullable()
|
|
1627
3885
|
}));
|
|
1628
|
-
const getLatestLogsContractV1 =
|
|
3886
|
+
const getLatestLogsContractV1 = base.route({
|
|
1629
3887
|
path: "/v1/environments/{environmentId}/latest-logs",
|
|
1630
3888
|
method: "GET",
|
|
1631
3889
|
summary: "Get latest logs",
|
|
1632
3890
|
description: "Get the N most recent logs for an environment",
|
|
1633
3891
|
tags: ["environments"],
|
|
1634
3892
|
successDescription: "The latest logs"
|
|
1635
|
-
}).errors({
|
|
1636
|
-
NOT_FOUND: {},
|
|
1637
|
-
BAD_REQUEST: {}
|
|
1638
|
-
}).input(z.object({
|
|
3893
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1639
3894
|
environmentId: z.string().describe("The ID of the environment"),
|
|
1640
3895
|
limit: z.coerce.number().int().min(1).max(1e3).default(100).describe("Number of most recent log entries to return"),
|
|
1641
3896
|
level: z.array(z.enum([
|
|
@@ -1644,23 +3899,9 @@ const getLatestLogsContractV1 = oc.route({
|
|
|
1644
3899
|
"WARNING",
|
|
1645
3900
|
"DEBUG"
|
|
1646
3901
|
])).optional().describe("Filter by log level"),
|
|
1647
|
-
search:
|
|
1648
|
-
})).output(z.object({ logs: z.array(
|
|
1649
|
-
|
|
1650
|
-
type: z.enum([
|
|
1651
|
-
"START",
|
|
1652
|
-
"END",
|
|
1653
|
-
"INFO",
|
|
1654
|
-
"ERROR",
|
|
1655
|
-
"WARNING",
|
|
1656
|
-
"DEBUG"
|
|
1657
|
-
]),
|
|
1658
|
-
requestId: z.string(),
|
|
1659
|
-
content: z.string().optional(),
|
|
1660
|
-
method: z.string().optional(),
|
|
1661
|
-
durationInMs: z.number().optional()
|
|
1662
|
-
})) }));
|
|
1663
|
-
const getDeploymentLogsContractV1 = oc.route({
|
|
3902
|
+
search: logSearchSchema.optional().describe("Term to search for in log content")
|
|
3903
|
+
})).output(z.object({ logs: z.array(logEntrySchema) }));
|
|
3904
|
+
const getDeploymentLogsContractV1 = base.route({
|
|
1664
3905
|
path: "/v1/deployments/{deploymentId}/logs",
|
|
1665
3906
|
method: "GET",
|
|
1666
3907
|
summary: "Get deployment logs",
|
|
@@ -1687,22 +3928,19 @@ const analyticsTimeSeriesSchema = z.object({
|
|
|
1687
3928
|
output_token_mean: z.array(analyticsDataPointSchema),
|
|
1688
3929
|
task_count: z.array(analyticsDataPointSchema)
|
|
1689
3930
|
});
|
|
1690
|
-
const getProjectAnalyticsContractV1 =
|
|
3931
|
+
const getProjectAnalyticsContractV1 = base.route({
|
|
1691
3932
|
path: "/v1/analytics/{projectId}",
|
|
1692
3933
|
method: "GET",
|
|
1693
3934
|
summary: "Get project analytics",
|
|
1694
3935
|
description: "Get analytics data for a project over a time range",
|
|
1695
3936
|
tags: ["analytics"],
|
|
1696
3937
|
successDescription: "The project analytics data"
|
|
1697
|
-
}).errors({
|
|
1698
|
-
NOT_FOUND: {},
|
|
1699
|
-
BAD_REQUEST: {}
|
|
1700
|
-
}).input(z.object({
|
|
3938
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1701
3939
|
projectId: z.string().describe("The ID of the project"),
|
|
1702
3940
|
startTimestamp: z.coerce.number().describe("Start timestamp in milliseconds"),
|
|
1703
3941
|
endTimestamp: z.coerce.number().describe("End timestamp in milliseconds"),
|
|
1704
3942
|
timeZone: z.string().describe("IANA timezone (e.g. Europe/Paris)")
|
|
1705
|
-
}).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp > 0, { message: "End date must be after start date" }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp <=
|
|
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({
|
|
1706
3944
|
metadata: z.object({
|
|
1707
3945
|
startTimestamp: z.number(),
|
|
1708
3946
|
endTimestamp: z.number(),
|
|
@@ -1712,7 +3950,132 @@ const getProjectAnalyticsContractV1 = oc.route({
|
|
|
1712
3950
|
}),
|
|
1713
3951
|
timeSeries: analyticsTimeSeriesSchema
|
|
1714
3952
|
}));
|
|
1715
|
-
const
|
|
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({
|
|
1716
4079
|
path: "/v1/teams",
|
|
1717
4080
|
method: "GET",
|
|
1718
4081
|
summary: "List teams",
|
|
@@ -1725,28 +4088,40 @@ const listTeamsContractV1 = oc.route({
|
|
|
1725
4088
|
createdAt: z.coerce.date(),
|
|
1726
4089
|
hasStripeAccount: z.boolean()
|
|
1727
4090
|
})));
|
|
1728
|
-
const
|
|
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({
|
|
1729
4107
|
path: "/v1/tunnels/ticket",
|
|
1730
4108
|
method: "GET",
|
|
1731
4109
|
summary: "Get a tunnel ticket",
|
|
1732
4110
|
description: "Get a signed ticket for establishing a tunnel connection. Requires user authentication (API keys are not supported).",
|
|
1733
4111
|
tags: ["tunnels"],
|
|
1734
4112
|
successDescription: "The tunnel ticket"
|
|
1735
|
-
}).errors({ FORBIDDEN: {} }).output(z.object({
|
|
4113
|
+
}).meta({ authScope: AUTH_SCOPE_USER }).errors({ FORBIDDEN: {} }).output(z.object({
|
|
1736
4114
|
subdomain: z.string().describe("The subdomain assigned to the user"),
|
|
1737
4115
|
ticket: z.string().describe("The signed tunnel ticket"),
|
|
1738
4116
|
tunnelHost: z.string().describe("The tunnel host to connect to")
|
|
1739
4117
|
}));
|
|
1740
|
-
const publishServerContractV1 =
|
|
4118
|
+
const publishServerContractV1 = base.route({
|
|
1741
4119
|
path: "/v1/distribution/publish",
|
|
1742
4120
|
method: "POST",
|
|
1743
4121
|
summary: "Publish a server to the MCP registry",
|
|
1744
4122
|
tags: ["distribution"],
|
|
1745
4123
|
successDescription: "The server has been published successfully"
|
|
1746
|
-
}).errors({
|
|
1747
|
-
NOT_FOUND: {},
|
|
1748
|
-
BAD_REQUEST: {}
|
|
1749
|
-
}).input(z.object({
|
|
4124
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1750
4125
|
projectId: z.string(),
|
|
1751
4126
|
domain: z.string(),
|
|
1752
4127
|
title: z.string().min(1).max(100),
|
|
@@ -1755,17 +4130,14 @@ const publishServerContractV1 = oc.route({
|
|
|
1755
4130
|
iconSrc: z.url().max(255).optional(),
|
|
1756
4131
|
dryRun: z.boolean().optional()
|
|
1757
4132
|
})).output(z.object({ serverFields: serverFieldsSchema }));
|
|
1758
|
-
const getServerInfoContractV1 =
|
|
4133
|
+
const getServerInfoContractV1 = base.route({
|
|
1759
4134
|
path: "/v1/distribution/get",
|
|
1760
4135
|
method: "GET",
|
|
1761
4136
|
summary: "Get server info",
|
|
1762
4137
|
description: "Get info about a server",
|
|
1763
4138
|
tags: ["distribution"],
|
|
1764
4139
|
successDescription: "The server info"
|
|
1765
|
-
}).errors({
|
|
1766
|
-
NOT_FOUND: {},
|
|
1767
|
-
BAD_REQUEST: {}
|
|
1768
|
-
}).input(z.object({
|
|
4140
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1769
4141
|
projectId: z.string(),
|
|
1770
4142
|
domain: z.string()
|
|
1771
4143
|
})).output(z.object({ serverFields: serverFieldsSchema }));
|
|
@@ -1784,7 +4156,7 @@ const playgroundOutputSchema = z.object({
|
|
|
1784
4156
|
isPlaygroundEnabled: z.boolean(),
|
|
1785
4157
|
serverMetadata: playgroundServerMetadataOutputSchema.nullable()
|
|
1786
4158
|
});
|
|
1787
|
-
const getPlaygroundContractV1 =
|
|
4159
|
+
const getPlaygroundContractV1 = base.route({
|
|
1788
4160
|
path: "/v1/environments/{environmentId}/playground",
|
|
1789
4161
|
method: "GET",
|
|
1790
4162
|
summary: "Get playground configuration",
|
|
@@ -1792,17 +4164,14 @@ const getPlaygroundContractV1 = oc.route({
|
|
|
1792
4164
|
tags: ["environments"],
|
|
1793
4165
|
successDescription: "The playground configuration"
|
|
1794
4166
|
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(playgroundOutputSchema);
|
|
1795
|
-
const upsertPlaygroundContractV1 =
|
|
4167
|
+
const upsertPlaygroundContractV1 = base.route({
|
|
1796
4168
|
path: "/v1/environments/{environmentId}/playground",
|
|
1797
4169
|
method: "PUT",
|
|
1798
4170
|
summary: "Update playground configuration",
|
|
1799
4171
|
description: "Update the playground configuration for an environment. All fields are optional — only provided fields are updated.",
|
|
1800
4172
|
tags: ["environments"],
|
|
1801
4173
|
successDescription: "The updated playground configuration"
|
|
1802
|
-
}).errors({
|
|
1803
|
-
NOT_FOUND: {},
|
|
1804
|
-
BAD_REQUEST: {}
|
|
1805
|
-
}).input(z.object({
|
|
4174
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1806
4175
|
environmentId: z.string().describe("The ID of the environment"),
|
|
1807
4176
|
isPlaygroundEnabled: z.boolean().optional(),
|
|
1808
4177
|
name: z.string().min(1).max(100).optional(),
|
|
@@ -1810,7 +4179,7 @@ const upsertPlaygroundContractV1 = oc.route({
|
|
|
1810
4179
|
headers: z.array(playgroundHeaderSchema).optional(),
|
|
1811
4180
|
examplePrompts: z.array(playgroundExamplePromptSchema).max(5).optional()
|
|
1812
4181
|
})).output(playgroundOutputSchema);
|
|
1813
|
-
const createBeaconContractV1 =
|
|
4182
|
+
const createBeaconContractV1 = base.route({
|
|
1814
4183
|
path: "/v1/beacon/audits",
|
|
1815
4184
|
method: "POST",
|
|
1816
4185
|
summary: "Create a beacon audit",
|
|
@@ -1819,7 +4188,6 @@ const createBeaconContractV1 = oc.route({
|
|
|
1819
4188
|
successDescription: "The audit has been created"
|
|
1820
4189
|
}).errors({
|
|
1821
4190
|
NOT_FOUND: {},
|
|
1822
|
-
BAD_REQUEST: {},
|
|
1823
4191
|
DNS_RESOLUTION_FAILED: { status: 400 }
|
|
1824
4192
|
}).input(z.object({
|
|
1825
4193
|
targetUrl: z.url().describe("The HTTPS URL of the MCP server to audit"),
|
|
@@ -1827,7 +4195,7 @@ const createBeaconContractV1 = oc.route({
|
|
|
1827
4195
|
projectId: z.string().optional().describe("The project ID to associate the audit with"),
|
|
1828
4196
|
excludeCategories: z.array(checkCategorySchema).optional().describe("Check categories to exclude from the audit")
|
|
1829
4197
|
})).output(z.object({ id: z.string() }));
|
|
1830
|
-
const getBeaconContractV1 =
|
|
4198
|
+
const getBeaconContractV1 = base.route({
|
|
1831
4199
|
path: "/v1/beacon/audits/{auditId}",
|
|
1832
4200
|
method: "GET",
|
|
1833
4201
|
summary: "Get a beacon audit",
|
|
@@ -1842,9 +4210,73 @@ const getBeaconContractV1 = oc.route({
|
|
|
1842
4210
|
createdAt: z.coerce.date(),
|
|
1843
4211
|
report: auditReportWithScreenshotsSchema.nullable()
|
|
1844
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);
|
|
1845
4264
|
const contract = {
|
|
1846
|
-
teams: {
|
|
4265
|
+
teams: {
|
|
4266
|
+
list: { v1: listTeamsContractV1 },
|
|
4267
|
+
getUsage: { v1: getTeamUsageContractV1 }
|
|
4268
|
+
},
|
|
1847
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 } },
|
|
1848
4280
|
deployments: {
|
|
1849
4281
|
list: { v1: listDeploymentsContractV1 },
|
|
1850
4282
|
get: { v1: getDeploymentContractV1 },
|
|
@@ -1854,6 +4286,7 @@ const contract = {
|
|
|
1854
4286
|
environments: {
|
|
1855
4287
|
create: { v1: createEnvironmentContractV1 },
|
|
1856
4288
|
get: { v1: getEnvironmentContractV1 },
|
|
4289
|
+
delete: { v1: deleteEnvironmentContractV1 },
|
|
1857
4290
|
deploy: { v1: deployEnvironmentContractV1 },
|
|
1858
4291
|
getLogs: { v1: getLogsContractV1 },
|
|
1859
4292
|
getLatestLogs: { v1: getLatestLogsContractV1 }
|
|
@@ -1864,6 +4297,12 @@ const contract = {
|
|
|
1864
4297
|
update: { v1: updateEnvironmentVariableContractV1 },
|
|
1865
4298
|
delete: { v1: deleteEnvironmentVariableContractV1 }
|
|
1866
4299
|
},
|
|
4300
|
+
telemetryDestinations: {
|
|
4301
|
+
list: { v1: listTelemetryDestinationsContractV1 },
|
|
4302
|
+
create: { v1: createTelemetryDestinationContractV1 },
|
|
4303
|
+
update: { v1: updateTelemetryDestinationContractV1 },
|
|
4304
|
+
delete: { v1: deleteTelemetryDestinationContractV1 }
|
|
4305
|
+
},
|
|
1867
4306
|
projects: {
|
|
1868
4307
|
update: { v1: updateProjectContractV1 },
|
|
1869
4308
|
get: { v1: getProjectContractV1 },
|
|
@@ -1883,7 +4322,38 @@ const contract = {
|
|
|
1883
4322
|
beacon: {
|
|
1884
4323
|
create: { v1: createBeaconContractV1 },
|
|
1885
4324
|
get: { v1: getBeaconContractV1 }
|
|
4325
|
+
},
|
|
4326
|
+
submissions: {
|
|
4327
|
+
create: { v1: createSubmissionContractV1 },
|
|
4328
|
+
list: { v1: listSubmissionsContractV1 },
|
|
4329
|
+
get: { v1: getSubmissionContractV1 },
|
|
4330
|
+
update: { v1: updateSubmissionContractV1 }
|
|
4331
|
+
}
|
|
4332
|
+
};
|
|
4333
|
+
const { uploadArtifact: _discard, ...deploymentsForDocs } = contract.deployments;
|
|
4334
|
+
const contractForDocs = {
|
|
4335
|
+
...contract,
|
|
4336
|
+
deployments: deploymentsForDocs
|
|
4337
|
+
};
|
|
4338
|
+
/** Shared by the served `openapi.json` and the snapshot test that guards it, so the two cannot drift. */
|
|
4339
|
+
const OPENAPI_DOC_OPTIONS = {
|
|
4340
|
+
info: {
|
|
4341
|
+
title: "Alpic API",
|
|
4342
|
+
version: "1.0.0"
|
|
4343
|
+
},
|
|
4344
|
+
servers: [{ url: "https://api.alpic.ai" }],
|
|
4345
|
+
security: [{ bearerAuth: [] }],
|
|
4346
|
+
components: { securitySchemes: { bearerAuth: {
|
|
4347
|
+
type: "http",
|
|
4348
|
+
description: "Bearer token for authentication. Use an API key from the API Keys page in team settings, or an OAuth access token.",
|
|
4349
|
+
scheme: "bearer"
|
|
4350
|
+
} } },
|
|
4351
|
+
commonSchemas: {
|
|
4352
|
+
Submission: { schema: submissionSchema },
|
|
4353
|
+
ClaudeSubmissionFormData: { schema: claudeSubmissionDraftSchema },
|
|
4354
|
+
ChatgptSubmissionFormData: { schema: chatgptSubmissionDraftSchema },
|
|
4355
|
+
ClaudeSubmissionFormDataUpdate: { schema: claudeSubmissionUpdateSchema },
|
|
4356
|
+
ChatgptSubmissionFormDataUpdate: { schema: chatgptSubmissionUpdateSchema }
|
|
1886
4357
|
}
|
|
1887
4358
|
};
|
|
1888
|
-
|
|
1889
|
-
export { PLATFORM_LABELS, buildSettingsSchema, contract, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema, updateEnvironmentVariableSchema };
|
|
4359
|
+
export { AI_PLATFORMS, AUTH_SCOPE_ANY, AUTH_SCOPE_USER, INTENT_CATEGORY_COLORS, OPENAPI_DOC_OPTIONS, OTLP_PROTOCOLS, PLATFORM_LABELS, TELEMETRY_SIGNALS, buildSettingsSchema, chatgptSubmissionUpdateSchema, claudeSubmissionUpdateSchema, contract, contractForDocs, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, intentCategoryColorSchema, otlpProtocolSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, telemetrySignalSchema, transportSchema, updateEnvironmentVariableSchema };
|