@modelcontextprotocol/inspector 0.3.0 → 0.4.0
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/README.md +14 -4
- package/bin/cli.js +31 -3
- package/client/dist/assets/OAuthCallback-HUNd2OJn.js +33 -0
- package/client/dist/assets/{index-BKN3G2r3.js → index-DjoEM10P.js} +1646 -701
- package/client/dist/assets/{index-DxcZhiGz.css → index-eOhPEcGC.css} +13 -11
- package/client/dist/index.html +2 -2
- package/package.json +3 -1
- package/server/build/index.js +43 -17
- package/server/build/mcpProxy.js +13 -7
|
@@ -7346,6 +7346,70 @@ function Q(t2) {
|
|
|
7346
7346
|
}));
|
|
7347
7347
|
}));
|
|
7348
7348
|
}
|
|
7349
|
+
const scriptRel = "modulepreload";
|
|
7350
|
+
const assetsURL = function(dep) {
|
|
7351
|
+
return "/" + dep;
|
|
7352
|
+
};
|
|
7353
|
+
const seen = {};
|
|
7354
|
+
const __vitePreload = function preload(baseModule, deps, importerUrl) {
|
|
7355
|
+
let promise = Promise.resolve();
|
|
7356
|
+
if (deps && deps.length > 0) {
|
|
7357
|
+
document.getElementsByTagName("link");
|
|
7358
|
+
const cspNonceMeta = document.querySelector(
|
|
7359
|
+
"meta[property=csp-nonce]"
|
|
7360
|
+
);
|
|
7361
|
+
const cspNonce = (cspNonceMeta == null ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta == null ? void 0 : cspNonceMeta.getAttribute("nonce"));
|
|
7362
|
+
promise = Promise.allSettled(
|
|
7363
|
+
deps.map((dep) => {
|
|
7364
|
+
dep = assetsURL(dep);
|
|
7365
|
+
if (dep in seen) return;
|
|
7366
|
+
seen[dep] = true;
|
|
7367
|
+
const isCss = dep.endsWith(".css");
|
|
7368
|
+
const cssSelector = isCss ? '[rel="stylesheet"]' : "";
|
|
7369
|
+
if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) {
|
|
7370
|
+
return;
|
|
7371
|
+
}
|
|
7372
|
+
const link = document.createElement("link");
|
|
7373
|
+
link.rel = isCss ? "stylesheet" : scriptRel;
|
|
7374
|
+
if (!isCss) {
|
|
7375
|
+
link.as = "script";
|
|
7376
|
+
}
|
|
7377
|
+
link.crossOrigin = "";
|
|
7378
|
+
link.href = dep;
|
|
7379
|
+
if (cspNonce) {
|
|
7380
|
+
link.setAttribute("nonce", cspNonce);
|
|
7381
|
+
}
|
|
7382
|
+
document.head.appendChild(link);
|
|
7383
|
+
if (isCss) {
|
|
7384
|
+
return new Promise((res, rej) => {
|
|
7385
|
+
link.addEventListener("load", res);
|
|
7386
|
+
link.addEventListener(
|
|
7387
|
+
"error",
|
|
7388
|
+
() => rej(new Error(`Unable to preload CSS for ${dep}`))
|
|
7389
|
+
);
|
|
7390
|
+
});
|
|
7391
|
+
}
|
|
7392
|
+
})
|
|
7393
|
+
);
|
|
7394
|
+
}
|
|
7395
|
+
function handlePreloadError(err) {
|
|
7396
|
+
const e = new Event("vite:preloadError", {
|
|
7397
|
+
cancelable: true
|
|
7398
|
+
});
|
|
7399
|
+
e.payload = err;
|
|
7400
|
+
window.dispatchEvent(e);
|
|
7401
|
+
if (!e.defaultPrevented) {
|
|
7402
|
+
throw err;
|
|
7403
|
+
}
|
|
7404
|
+
}
|
|
7405
|
+
return promise.then((res) => {
|
|
7406
|
+
for (const item of res || []) {
|
|
7407
|
+
if (item.status !== "rejected") continue;
|
|
7408
|
+
handlePreloadError(item.reason);
|
|
7409
|
+
}
|
|
7410
|
+
return baseModule().catch(handlePreloadError);
|
|
7411
|
+
});
|
|
7412
|
+
};
|
|
7349
7413
|
var util;
|
|
7350
7414
|
(function(util2) {
|
|
7351
7415
|
util2.assertEqual = (val) => val;
|
|
@@ -7500,6 +7564,9 @@ const quotelessJson = (obj) => {
|
|
|
7500
7564
|
return json.replace(/"([^"]+)":/g, "$1:");
|
|
7501
7565
|
};
|
|
7502
7566
|
class ZodError extends Error {
|
|
7567
|
+
get errors() {
|
|
7568
|
+
return this.issues;
|
|
7569
|
+
}
|
|
7503
7570
|
constructor(issues) {
|
|
7504
7571
|
super();
|
|
7505
7572
|
this.issues = [];
|
|
@@ -7518,9 +7585,6 @@ class ZodError extends Error {
|
|
|
7518
7585
|
this.name = "ZodError";
|
|
7519
7586
|
this.issues = issues;
|
|
7520
7587
|
}
|
|
7521
|
-
get errors() {
|
|
7522
|
-
return this.issues;
|
|
7523
|
-
}
|
|
7524
7588
|
format(_mapper) {
|
|
7525
7589
|
const mapper = _mapper || function(issue) {
|
|
7526
7590
|
return issue.message;
|
|
@@ -7731,8 +7795,11 @@ function addIssueToContext(ctx, issueData) {
|
|
|
7731
7795
|
path: ctx.path,
|
|
7732
7796
|
errorMaps: [
|
|
7733
7797
|
ctx.common.contextualErrorMap,
|
|
7798
|
+
// contextual error map is first priority
|
|
7734
7799
|
ctx.schemaErrorMap,
|
|
7800
|
+
// then schema-bound map if available
|
|
7735
7801
|
overrideMap,
|
|
7802
|
+
// then global override map
|
|
7736
7803
|
overrideMap === errorMap ? void 0 : errorMap
|
|
7737
7804
|
// then global default map
|
|
7738
7805
|
].filter((x2) => !!x2)
|
|
@@ -7803,11 +7870,11 @@ const isDirty = (x2) => x2.status === "dirty";
|
|
|
7803
7870
|
const isValid = (x2) => x2.status === "valid";
|
|
7804
7871
|
const isAsync = (x2) => typeof Promise !== "undefined" && x2 instanceof Promise;
|
|
7805
7872
|
function __classPrivateFieldGet(receiver, state, kind, f2) {
|
|
7806
|
-
if (typeof state === "function" ? receiver !== state ||
|
|
7873
|
+
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
7807
7874
|
return state.get(receiver);
|
|
7808
7875
|
}
|
|
7809
7876
|
function __classPrivateFieldSet(receiver, state, value, kind, f2) {
|
|
7810
|
-
if (typeof state === "function" ? receiver !== state ||
|
|
7877
|
+
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
7811
7878
|
return state.set(receiver, value), value;
|
|
7812
7879
|
}
|
|
7813
7880
|
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
@@ -7883,34 +7950,6 @@ function processCreateParams(params2) {
|
|
|
7883
7950
|
return { errorMap: customMap, description };
|
|
7884
7951
|
}
|
|
7885
7952
|
class ZodType {
|
|
7886
|
-
constructor(def) {
|
|
7887
|
-
this.spa = this.safeParseAsync;
|
|
7888
|
-
this._def = def;
|
|
7889
|
-
this.parse = this.parse.bind(this);
|
|
7890
|
-
this.safeParse = this.safeParse.bind(this);
|
|
7891
|
-
this.parseAsync = this.parseAsync.bind(this);
|
|
7892
|
-
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
7893
|
-
this.spa = this.spa.bind(this);
|
|
7894
|
-
this.refine = this.refine.bind(this);
|
|
7895
|
-
this.refinement = this.refinement.bind(this);
|
|
7896
|
-
this.superRefine = this.superRefine.bind(this);
|
|
7897
|
-
this.optional = this.optional.bind(this);
|
|
7898
|
-
this.nullable = this.nullable.bind(this);
|
|
7899
|
-
this.nullish = this.nullish.bind(this);
|
|
7900
|
-
this.array = this.array.bind(this);
|
|
7901
|
-
this.promise = this.promise.bind(this);
|
|
7902
|
-
this.or = this.or.bind(this);
|
|
7903
|
-
this.and = this.and.bind(this);
|
|
7904
|
-
this.transform = this.transform.bind(this);
|
|
7905
|
-
this.brand = this.brand.bind(this);
|
|
7906
|
-
this.default = this.default.bind(this);
|
|
7907
|
-
this.catch = this.catch.bind(this);
|
|
7908
|
-
this.describe = this.describe.bind(this);
|
|
7909
|
-
this.pipe = this.pipe.bind(this);
|
|
7910
|
-
this.readonly = this.readonly.bind(this);
|
|
7911
|
-
this.isNullable = this.isNullable.bind(this);
|
|
7912
|
-
this.isOptional = this.isOptional.bind(this);
|
|
7913
|
-
}
|
|
7914
7953
|
get description() {
|
|
7915
7954
|
return this._def.description;
|
|
7916
7955
|
}
|
|
@@ -7974,6 +8013,43 @@ class ZodType {
|
|
|
7974
8013
|
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
|
7975
8014
|
return handleResult(ctx, result);
|
|
7976
8015
|
}
|
|
8016
|
+
"~validate"(data) {
|
|
8017
|
+
var _a, _b;
|
|
8018
|
+
const ctx = {
|
|
8019
|
+
common: {
|
|
8020
|
+
issues: [],
|
|
8021
|
+
async: !!this["~standard"].async
|
|
8022
|
+
},
|
|
8023
|
+
path: [],
|
|
8024
|
+
schemaErrorMap: this._def.errorMap,
|
|
8025
|
+
parent: null,
|
|
8026
|
+
data,
|
|
8027
|
+
parsedType: getParsedType(data)
|
|
8028
|
+
};
|
|
8029
|
+
if (!this["~standard"].async) {
|
|
8030
|
+
try {
|
|
8031
|
+
const result = this._parseSync({ data, path: [], parent: ctx });
|
|
8032
|
+
return isValid(result) ? {
|
|
8033
|
+
value: result.value
|
|
8034
|
+
} : {
|
|
8035
|
+
issues: ctx.common.issues
|
|
8036
|
+
};
|
|
8037
|
+
} catch (err) {
|
|
8038
|
+
if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
|
|
8039
|
+
this["~standard"].async = true;
|
|
8040
|
+
}
|
|
8041
|
+
ctx.common = {
|
|
8042
|
+
issues: [],
|
|
8043
|
+
async: true
|
|
8044
|
+
};
|
|
8045
|
+
}
|
|
8046
|
+
}
|
|
8047
|
+
return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
|
|
8048
|
+
value: result.value
|
|
8049
|
+
} : {
|
|
8050
|
+
issues: ctx.common.issues
|
|
8051
|
+
});
|
|
8052
|
+
}
|
|
7977
8053
|
async parseAsync(data, params2) {
|
|
7978
8054
|
const result = await this.safeParseAsync(data, params2);
|
|
7979
8055
|
if (result.success)
|
|
@@ -8051,6 +8127,39 @@ class ZodType {
|
|
|
8051
8127
|
superRefine(refinement) {
|
|
8052
8128
|
return this._refinement(refinement);
|
|
8053
8129
|
}
|
|
8130
|
+
constructor(def) {
|
|
8131
|
+
this.spa = this.safeParseAsync;
|
|
8132
|
+
this._def = def;
|
|
8133
|
+
this.parse = this.parse.bind(this);
|
|
8134
|
+
this.safeParse = this.safeParse.bind(this);
|
|
8135
|
+
this.parseAsync = this.parseAsync.bind(this);
|
|
8136
|
+
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
8137
|
+
this.spa = this.spa.bind(this);
|
|
8138
|
+
this.refine = this.refine.bind(this);
|
|
8139
|
+
this.refinement = this.refinement.bind(this);
|
|
8140
|
+
this.superRefine = this.superRefine.bind(this);
|
|
8141
|
+
this.optional = this.optional.bind(this);
|
|
8142
|
+
this.nullable = this.nullable.bind(this);
|
|
8143
|
+
this.nullish = this.nullish.bind(this);
|
|
8144
|
+
this.array = this.array.bind(this);
|
|
8145
|
+
this.promise = this.promise.bind(this);
|
|
8146
|
+
this.or = this.or.bind(this);
|
|
8147
|
+
this.and = this.and.bind(this);
|
|
8148
|
+
this.transform = this.transform.bind(this);
|
|
8149
|
+
this.brand = this.brand.bind(this);
|
|
8150
|
+
this.default = this.default.bind(this);
|
|
8151
|
+
this.catch = this.catch.bind(this);
|
|
8152
|
+
this.describe = this.describe.bind(this);
|
|
8153
|
+
this.pipe = this.pipe.bind(this);
|
|
8154
|
+
this.readonly = this.readonly.bind(this);
|
|
8155
|
+
this.isNullable = this.isNullable.bind(this);
|
|
8156
|
+
this.isOptional = this.isOptional.bind(this);
|
|
8157
|
+
this["~standard"] = {
|
|
8158
|
+
version: 1,
|
|
8159
|
+
vendor: "zod",
|
|
8160
|
+
validate: (data) => this["~validate"](data)
|
|
8161
|
+
};
|
|
8162
|
+
}
|
|
8054
8163
|
optional() {
|
|
8055
8164
|
return ZodOptional.create(this, this._def);
|
|
8056
8165
|
}
|
|
@@ -8061,7 +8170,7 @@ class ZodType {
|
|
|
8061
8170
|
return this.nullable().optional();
|
|
8062
8171
|
}
|
|
8063
8172
|
array() {
|
|
8064
|
-
return ZodArray.create(this
|
|
8173
|
+
return ZodArray.create(this);
|
|
8065
8174
|
}
|
|
8066
8175
|
promise() {
|
|
8067
8176
|
return ZodPromise.create(this, this._def);
|
|
@@ -8127,16 +8236,20 @@ class ZodType {
|
|
|
8127
8236
|
}
|
|
8128
8237
|
const cuidRegex = /^c[^\s-]{8,}$/i;
|
|
8129
8238
|
const cuid2Regex = /^[0-9a-z]+$/;
|
|
8130
|
-
const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}
|
|
8239
|
+
const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
|
|
8131
8240
|
const uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
|
8132
8241
|
const nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
8242
|
+
const jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
|
8133
8243
|
const durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
|
8134
8244
|
const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
8135
8245
|
const _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
8136
8246
|
let emojiRegex;
|
|
8137
8247
|
const ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
8138
|
-
const
|
|
8248
|
+
const ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
|
|
8249
|
+
const ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
|
8250
|
+
const ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
8139
8251
|
const base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
8252
|
+
const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
|
8140
8253
|
const dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
|
8141
8254
|
const dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
8142
8255
|
function timeRegexSource(args) {
|
|
@@ -8169,6 +8282,33 @@ function isValidIP(ip, version2) {
|
|
|
8169
8282
|
}
|
|
8170
8283
|
return false;
|
|
8171
8284
|
}
|
|
8285
|
+
function isValidJWT(jwt, alg) {
|
|
8286
|
+
if (!jwtRegex.test(jwt))
|
|
8287
|
+
return false;
|
|
8288
|
+
try {
|
|
8289
|
+
const [header] = jwt.split(".");
|
|
8290
|
+
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
|
8291
|
+
const decoded = JSON.parse(atob(base64));
|
|
8292
|
+
if (typeof decoded !== "object" || decoded === null)
|
|
8293
|
+
return false;
|
|
8294
|
+
if (!decoded.typ || !decoded.alg)
|
|
8295
|
+
return false;
|
|
8296
|
+
if (alg && decoded.alg !== alg)
|
|
8297
|
+
return false;
|
|
8298
|
+
return true;
|
|
8299
|
+
} catch (_a) {
|
|
8300
|
+
return false;
|
|
8301
|
+
}
|
|
8302
|
+
}
|
|
8303
|
+
function isValidCidr(ip, version2) {
|
|
8304
|
+
if ((version2 === "v4" || !version2) && ipv4CidrRegex.test(ip)) {
|
|
8305
|
+
return true;
|
|
8306
|
+
}
|
|
8307
|
+
if ((version2 === "v6" || !version2) && ipv6CidrRegex.test(ip)) {
|
|
8308
|
+
return true;
|
|
8309
|
+
}
|
|
8310
|
+
return false;
|
|
8311
|
+
}
|
|
8172
8312
|
class ZodString extends ZodType {
|
|
8173
8313
|
_parse(input) {
|
|
8174
8314
|
if (this._def.coerce) {
|
|
@@ -8425,6 +8565,26 @@ class ZodString extends ZodType {
|
|
|
8425
8565
|
});
|
|
8426
8566
|
status.dirty();
|
|
8427
8567
|
}
|
|
8568
|
+
} else if (check.kind === "jwt") {
|
|
8569
|
+
if (!isValidJWT(input.data, check.alg)) {
|
|
8570
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
8571
|
+
addIssueToContext(ctx, {
|
|
8572
|
+
validation: "jwt",
|
|
8573
|
+
code: ZodIssueCode.invalid_string,
|
|
8574
|
+
message: check.message
|
|
8575
|
+
});
|
|
8576
|
+
status.dirty();
|
|
8577
|
+
}
|
|
8578
|
+
} else if (check.kind === "cidr") {
|
|
8579
|
+
if (!isValidCidr(input.data, check.version)) {
|
|
8580
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
8581
|
+
addIssueToContext(ctx, {
|
|
8582
|
+
validation: "cidr",
|
|
8583
|
+
code: ZodIssueCode.invalid_string,
|
|
8584
|
+
message: check.message
|
|
8585
|
+
});
|
|
8586
|
+
status.dirty();
|
|
8587
|
+
}
|
|
8428
8588
|
} else if (check.kind === "base64") {
|
|
8429
8589
|
if (!base64Regex.test(input.data)) {
|
|
8430
8590
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -8435,6 +8595,16 @@ class ZodString extends ZodType {
|
|
|
8435
8595
|
});
|
|
8436
8596
|
status.dirty();
|
|
8437
8597
|
}
|
|
8598
|
+
} else if (check.kind === "base64url") {
|
|
8599
|
+
if (!base64urlRegex.test(input.data)) {
|
|
8600
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
8601
|
+
addIssueToContext(ctx, {
|
|
8602
|
+
validation: "base64url",
|
|
8603
|
+
code: ZodIssueCode.invalid_string,
|
|
8604
|
+
message: check.message
|
|
8605
|
+
});
|
|
8606
|
+
status.dirty();
|
|
8607
|
+
}
|
|
8438
8608
|
} else {
|
|
8439
8609
|
util.assertNever(check);
|
|
8440
8610
|
}
|
|
@@ -8481,9 +8651,21 @@ class ZodString extends ZodType {
|
|
|
8481
8651
|
base64(message) {
|
|
8482
8652
|
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
|
8483
8653
|
}
|
|
8654
|
+
base64url(message) {
|
|
8655
|
+
return this._addCheck({
|
|
8656
|
+
kind: "base64url",
|
|
8657
|
+
...errorUtil.errToObj(message)
|
|
8658
|
+
});
|
|
8659
|
+
}
|
|
8660
|
+
jwt(options) {
|
|
8661
|
+
return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
|
|
8662
|
+
}
|
|
8484
8663
|
ip(options) {
|
|
8485
8664
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
8486
8665
|
}
|
|
8666
|
+
cidr(options) {
|
|
8667
|
+
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
|
8668
|
+
}
|
|
8487
8669
|
datetime(options) {
|
|
8488
8670
|
var _a, _b;
|
|
8489
8671
|
if (typeof options === "string") {
|
|
@@ -8574,8 +8756,7 @@ class ZodString extends ZodType {
|
|
|
8574
8756
|
});
|
|
8575
8757
|
}
|
|
8576
8758
|
/**
|
|
8577
|
-
*
|
|
8578
|
-
* @see {@link ZodString.min}
|
|
8759
|
+
* Equivalent to `.min(1)`
|
|
8579
8760
|
*/
|
|
8580
8761
|
nonempty(message) {
|
|
8581
8762
|
return this.min(1, errorUtil.errToObj(message));
|
|
@@ -8637,9 +8818,15 @@ class ZodString extends ZodType {
|
|
|
8637
8818
|
get isIP() {
|
|
8638
8819
|
return !!this._def.checks.find((ch2) => ch2.kind === "ip");
|
|
8639
8820
|
}
|
|
8821
|
+
get isCIDR() {
|
|
8822
|
+
return !!this._def.checks.find((ch2) => ch2.kind === "cidr");
|
|
8823
|
+
}
|
|
8640
8824
|
get isBase64() {
|
|
8641
8825
|
return !!this._def.checks.find((ch2) => ch2.kind === "base64");
|
|
8642
8826
|
}
|
|
8827
|
+
get isBase64url() {
|
|
8828
|
+
return !!this._def.checks.find((ch2) => ch2.kind === "base64url");
|
|
8829
|
+
}
|
|
8643
8830
|
get minLength() {
|
|
8644
8831
|
let min2 = null;
|
|
8645
8832
|
for (const ch2 of this._def.checks) {
|
|
@@ -8917,17 +9104,15 @@ class ZodBigInt extends ZodType {
|
|
|
8917
9104
|
}
|
|
8918
9105
|
_parse(input) {
|
|
8919
9106
|
if (this._def.coerce) {
|
|
8920
|
-
|
|
9107
|
+
try {
|
|
9108
|
+
input.data = BigInt(input.data);
|
|
9109
|
+
} catch (_a) {
|
|
9110
|
+
return this._getInvalidInput(input);
|
|
9111
|
+
}
|
|
8921
9112
|
}
|
|
8922
9113
|
const parsedType = this._getType(input);
|
|
8923
9114
|
if (parsedType !== ZodParsedType.bigint) {
|
|
8924
|
-
|
|
8925
|
-
addIssueToContext(ctx2, {
|
|
8926
|
-
code: ZodIssueCode.invalid_type,
|
|
8927
|
-
expected: ZodParsedType.bigint,
|
|
8928
|
-
received: ctx2.parsedType
|
|
8929
|
-
});
|
|
8930
|
-
return INVALID;
|
|
9115
|
+
return this._getInvalidInput(input);
|
|
8931
9116
|
}
|
|
8932
9117
|
let ctx = void 0;
|
|
8933
9118
|
const status = new ParseStatus();
|
|
@@ -8974,6 +9159,15 @@ class ZodBigInt extends ZodType {
|
|
|
8974
9159
|
}
|
|
8975
9160
|
return { status: status.value, value: input.data };
|
|
8976
9161
|
}
|
|
9162
|
+
_getInvalidInput(input) {
|
|
9163
|
+
const ctx = this._getOrReturnCtx(input);
|
|
9164
|
+
addIssueToContext(ctx, {
|
|
9165
|
+
code: ZodIssueCode.invalid_type,
|
|
9166
|
+
expected: ZodParsedType.bigint,
|
|
9167
|
+
received: ctx.parsedType
|
|
9168
|
+
});
|
|
9169
|
+
return INVALID;
|
|
9170
|
+
}
|
|
8977
9171
|
gte(value, message) {
|
|
8978
9172
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
8979
9173
|
}
|
|
@@ -11309,8 +11503,8 @@ const JSONRPCResponseSchema = z.object({
|
|
|
11309
11503
|
}).strict();
|
|
11310
11504
|
var ErrorCode;
|
|
11311
11505
|
(function(ErrorCode2) {
|
|
11312
|
-
ErrorCode2[ErrorCode2["ConnectionClosed"] = -
|
|
11313
|
-
ErrorCode2[ErrorCode2["RequestTimeout"] = -
|
|
11506
|
+
ErrorCode2[ErrorCode2["ConnectionClosed"] = -32e3] = "ConnectionClosed";
|
|
11507
|
+
ErrorCode2[ErrorCode2["RequestTimeout"] = -32001] = "RequestTimeout";
|
|
11314
11508
|
ErrorCode2[ErrorCode2["ParseError"] = -32700] = "ParseError";
|
|
11315
11509
|
ErrorCode2[ErrorCode2["InvalidRequest"] = -32600] = "InvalidRequest";
|
|
11316
11510
|
ErrorCode2[ErrorCode2["MethodNotFound"] = -32601] = "MethodNotFound";
|
|
@@ -11438,7 +11632,13 @@ const InitializeResultSchema = ResultSchema.extend({
|
|
|
11438
11632
|
*/
|
|
11439
11633
|
protocolVersion: z.string(),
|
|
11440
11634
|
capabilities: ServerCapabilitiesSchema,
|
|
11441
|
-
serverInfo: ImplementationSchema
|
|
11635
|
+
serverInfo: ImplementationSchema,
|
|
11636
|
+
/**
|
|
11637
|
+
* Instructions describing how to use the server and its features.
|
|
11638
|
+
*
|
|
11639
|
+
* This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt.
|
|
11640
|
+
*/
|
|
11641
|
+
instructions: z.optional(z.string())
|
|
11442
11642
|
});
|
|
11443
11643
|
const InitializedNotificationSchema = NotificationSchema.extend({
|
|
11444
11644
|
method: z.literal("notifications/initialized")
|
|
@@ -12077,13 +12277,13 @@ class Protocol {
|
|
|
12077
12277
|
});
|
|
12078
12278
|
}
|
|
12079
12279
|
_onprogress(notification) {
|
|
12080
|
-
const {
|
|
12280
|
+
const { progressToken, ...params2 } = notification.params;
|
|
12081
12281
|
const handler = this._progressHandlers.get(Number(progressToken));
|
|
12082
12282
|
if (handler === void 0) {
|
|
12083
12283
|
this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(notification)}`));
|
|
12084
12284
|
return;
|
|
12085
12285
|
}
|
|
12086
|
-
handler(
|
|
12286
|
+
handler(params2);
|
|
12087
12287
|
}
|
|
12088
12288
|
_onresponse(response) {
|
|
12089
12289
|
const messageId = response.id;
|
|
@@ -12222,6 +12422,14 @@ class Protocol {
|
|
|
12222
12422
|
removeRequestHandler(method) {
|
|
12223
12423
|
this._requestHandlers.delete(method);
|
|
12224
12424
|
}
|
|
12425
|
+
/**
|
|
12426
|
+
* Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.
|
|
12427
|
+
*/
|
|
12428
|
+
assertCanSetRequestHandler(method) {
|
|
12429
|
+
if (this._requestHandlers.has(method)) {
|
|
12430
|
+
throw new Error(`A request handler for ${method} already exists, which would be overridden`);
|
|
12431
|
+
}
|
|
12432
|
+
}
|
|
12225
12433
|
/**
|
|
12226
12434
|
* Registers a handler to invoke when this protocol object receives a notification with the given method.
|
|
12227
12435
|
*
|
|
@@ -12237,14 +12445,36 @@ class Protocol {
|
|
|
12237
12445
|
this._notificationHandlers.delete(method);
|
|
12238
12446
|
}
|
|
12239
12447
|
}
|
|
12448
|
+
function mergeCapabilities(base, additional) {
|
|
12449
|
+
return Object.entries(additional).reduce((acc, [key, value]) => {
|
|
12450
|
+
if (value && typeof value === "object") {
|
|
12451
|
+
acc[key] = acc[key] ? { ...acc[key], ...value } : value;
|
|
12452
|
+
} else {
|
|
12453
|
+
acc[key] = value;
|
|
12454
|
+
}
|
|
12455
|
+
return acc;
|
|
12456
|
+
}, { ...base });
|
|
12457
|
+
}
|
|
12240
12458
|
class Client extends Protocol {
|
|
12241
12459
|
/**
|
|
12242
12460
|
* Initializes this client with the given name and version information.
|
|
12243
12461
|
*/
|
|
12244
12462
|
constructor(_clientInfo, options) {
|
|
12463
|
+
var _a;
|
|
12245
12464
|
super(options);
|
|
12246
12465
|
this._clientInfo = _clientInfo;
|
|
12247
|
-
this._capabilities = options.capabilities;
|
|
12466
|
+
this._capabilities = (_a = options === null || options === void 0 ? void 0 : options.capabilities) !== null && _a !== void 0 ? _a : {};
|
|
12467
|
+
}
|
|
12468
|
+
/**
|
|
12469
|
+
* Registers new capabilities. This can only be called before connecting to a transport.
|
|
12470
|
+
*
|
|
12471
|
+
* The new capabilities will be merged with any existing capabilities previously given (e.g., at initialization).
|
|
12472
|
+
*/
|
|
12473
|
+
registerCapabilities(capabilities) {
|
|
12474
|
+
if (this.transport) {
|
|
12475
|
+
throw new Error("Cannot register capabilities after connecting to transport");
|
|
12476
|
+
}
|
|
12477
|
+
this._capabilities = mergeCapabilities(this._capabilities, capabilities);
|
|
12248
12478
|
}
|
|
12249
12479
|
assertCapability(capability, method) {
|
|
12250
12480
|
var _a;
|
|
@@ -12271,6 +12501,7 @@ class Client extends Protocol {
|
|
|
12271
12501
|
}
|
|
12272
12502
|
this._serverCapabilities = result.capabilities;
|
|
12273
12503
|
this._serverVersion = result.serverInfo;
|
|
12504
|
+
this._instructions = result.instructions;
|
|
12274
12505
|
await this.notification({
|
|
12275
12506
|
method: "notifications/initialized"
|
|
12276
12507
|
});
|
|
@@ -12291,6 +12522,12 @@ class Client extends Protocol {
|
|
|
12291
12522
|
getServerVersion() {
|
|
12292
12523
|
return this._serverVersion;
|
|
12293
12524
|
}
|
|
12525
|
+
/**
|
|
12526
|
+
* After initialization has completed, this may be populated with information about the server's instructions.
|
|
12527
|
+
*/
|
|
12528
|
+
getInstructions() {
|
|
12529
|
+
return this._instructions;
|
|
12530
|
+
}
|
|
12294
12531
|
assertCapabilityForMethod(method) {
|
|
12295
12532
|
var _a, _b, _c, _d, _e;
|
|
12296
12533
|
switch (method) {
|
|
@@ -12394,94 +12631,771 @@ class Client extends Protocol {
|
|
|
12394
12631
|
return this.notification({ method: "notifications/roots/list_changed" });
|
|
12395
12632
|
}
|
|
12396
12633
|
}
|
|
12397
|
-
|
|
12398
|
-
|
|
12399
|
-
|
|
12400
|
-
|
|
12401
|
-
start() {
|
|
12402
|
-
if (this._eventSource) {
|
|
12403
|
-
throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");
|
|
12404
|
-
}
|
|
12405
|
-
return new Promise((resolve, reject) => {
|
|
12406
|
-
this._eventSource = new EventSource(this._url.href);
|
|
12407
|
-
this._abortController = new AbortController();
|
|
12408
|
-
this._eventSource.onerror = (event) => {
|
|
12409
|
-
var _a;
|
|
12410
|
-
const error = new Error(`SSE error: ${JSON.stringify(event)}`);
|
|
12411
|
-
reject(error);
|
|
12412
|
-
(_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);
|
|
12413
|
-
};
|
|
12414
|
-
this._eventSource.onopen = () => {
|
|
12415
|
-
};
|
|
12416
|
-
this._eventSource.addEventListener("endpoint", (event) => {
|
|
12417
|
-
var _a;
|
|
12418
|
-
const messageEvent = event;
|
|
12419
|
-
try {
|
|
12420
|
-
this._endpoint = new URL(messageEvent.data, this._url);
|
|
12421
|
-
if (this._endpoint.origin !== this._url.origin) {
|
|
12422
|
-
throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`);
|
|
12423
|
-
}
|
|
12424
|
-
} catch (error) {
|
|
12425
|
-
reject(error);
|
|
12426
|
-
(_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);
|
|
12427
|
-
void this.close();
|
|
12428
|
-
return;
|
|
12429
|
-
}
|
|
12430
|
-
resolve();
|
|
12431
|
-
});
|
|
12432
|
-
this._eventSource.onmessage = (event) => {
|
|
12433
|
-
var _a, _b;
|
|
12434
|
-
const messageEvent = event;
|
|
12435
|
-
let message;
|
|
12436
|
-
try {
|
|
12437
|
-
message = JSONRPCMessageSchema.parse(JSON.parse(messageEvent.data));
|
|
12438
|
-
} catch (error) {
|
|
12439
|
-
(_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);
|
|
12440
|
-
return;
|
|
12441
|
-
}
|
|
12442
|
-
(_b = this.onmessage) === null || _b === void 0 ? void 0 : _b.call(this, message);
|
|
12443
|
-
};
|
|
12444
|
-
});
|
|
12634
|
+
var __defProp = Object.defineProperty, __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value, __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
12635
|
+
class ParseError extends Error {
|
|
12636
|
+
constructor(message, options) {
|
|
12637
|
+
super(message), __publicField(this, "type"), __publicField(this, "field"), __publicField(this, "value"), __publicField(this, "line"), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
12445
12638
|
}
|
|
12446
|
-
|
|
12447
|
-
|
|
12448
|
-
|
|
12449
|
-
|
|
12450
|
-
|
|
12639
|
+
}
|
|
12640
|
+
function noop(_arg) {
|
|
12641
|
+
}
|
|
12642
|
+
function createParser(callbacks) {
|
|
12643
|
+
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
|
|
12644
|
+
let incompleteLine = "", isFirstChunk = true, id2, data = "", eventType = "";
|
|
12645
|
+
function feed(newChunk) {
|
|
12646
|
+
const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
|
|
12647
|
+
for (const line of complete)
|
|
12648
|
+
parseLine(line);
|
|
12649
|
+
incompleteLine = incomplete, isFirstChunk = false;
|
|
12451
12650
|
}
|
|
12452
|
-
|
|
12453
|
-
|
|
12454
|
-
|
|
12455
|
-
|
|
12651
|
+
function parseLine(line) {
|
|
12652
|
+
if (line === "") {
|
|
12653
|
+
dispatchEvent();
|
|
12654
|
+
return;
|
|
12456
12655
|
}
|
|
12457
|
-
|
|
12458
|
-
|
|
12459
|
-
|
|
12460
|
-
|
|
12461
|
-
|
|
12462
|
-
|
|
12463
|
-
|
|
12464
|
-
|
|
12465
|
-
|
|
12466
|
-
if (!response.ok) {
|
|
12467
|
-
const text = await response.text().catch(() => null);
|
|
12468
|
-
throw new Error(`Error POSTing to endpoint (HTTP ${response.status}): ${text}`);
|
|
12469
|
-
}
|
|
12470
|
-
} catch (error) {
|
|
12471
|
-
(_b = this.onerror) === null || _b === void 0 ? void 0 : _b.call(this, error);
|
|
12472
|
-
throw error;
|
|
12656
|
+
if (line.startsWith(":")) {
|
|
12657
|
+
onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
|
|
12658
|
+
return;
|
|
12659
|
+
}
|
|
12660
|
+
const fieldSeparatorIndex = line.indexOf(":");
|
|
12661
|
+
if (fieldSeparatorIndex !== -1) {
|
|
12662
|
+
const field = line.slice(0, fieldSeparatorIndex), offset2 = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset2);
|
|
12663
|
+
processField(field, value, line);
|
|
12664
|
+
return;
|
|
12473
12665
|
}
|
|
12666
|
+
processField(line, "", line);
|
|
12474
12667
|
}
|
|
12475
|
-
|
|
12476
|
-
|
|
12477
|
-
|
|
12478
|
-
|
|
12479
|
-
|
|
12480
|
-
|
|
12481
|
-
}
|
|
12482
|
-
|
|
12668
|
+
function processField(field, value, line) {
|
|
12669
|
+
switch (field) {
|
|
12670
|
+
case "event":
|
|
12671
|
+
eventType = value;
|
|
12672
|
+
break;
|
|
12673
|
+
case "data":
|
|
12674
|
+
data = `${data}${value}
|
|
12675
|
+
`;
|
|
12676
|
+
break;
|
|
12677
|
+
case "id":
|
|
12678
|
+
id2 = value.includes("\0") ? void 0 : value;
|
|
12679
|
+
break;
|
|
12680
|
+
case "retry":
|
|
12681
|
+
/^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
|
|
12682
|
+
new ParseError(`Invalid \`retry\` value: "${value}"`, {
|
|
12683
|
+
type: "invalid-retry",
|
|
12684
|
+
value,
|
|
12685
|
+
line
|
|
12686
|
+
})
|
|
12687
|
+
);
|
|
12688
|
+
break;
|
|
12689
|
+
default:
|
|
12690
|
+
onError(
|
|
12691
|
+
new ParseError(
|
|
12692
|
+
`Unknown field "${field.length > 20 ? `${field.slice(0, 20)}…` : field}"`,
|
|
12693
|
+
{ type: "unknown-field", field, value, line }
|
|
12694
|
+
)
|
|
12695
|
+
);
|
|
12696
|
+
break;
|
|
12697
|
+
}
|
|
12698
|
+
}
|
|
12699
|
+
function dispatchEvent() {
|
|
12700
|
+
data.length > 0 && onEvent({
|
|
12701
|
+
id: id2,
|
|
12702
|
+
event: eventType || void 0,
|
|
12703
|
+
// If the data buffer's last character is a U+000A LINE FEED (LF) character,
|
|
12704
|
+
// then remove the last character from the data buffer.
|
|
12705
|
+
data: data.endsWith(`
|
|
12706
|
+
`) ? data.slice(0, -1) : data
|
|
12707
|
+
}), id2 = void 0, data = "", eventType = "";
|
|
12708
|
+
}
|
|
12709
|
+
function reset(options = {}) {
|
|
12710
|
+
incompleteLine && options.consume && parseLine(incompleteLine), id2 = void 0, data = "", eventType = "", incompleteLine = "";
|
|
12711
|
+
}
|
|
12712
|
+
return { feed, reset };
|
|
12713
|
+
}
|
|
12714
|
+
function splitLines(chunk) {
|
|
12715
|
+
const lines = [];
|
|
12716
|
+
let incompleteLine = "";
|
|
12717
|
+
const totalLength = chunk.length;
|
|
12718
|
+
for (let i = 0; i < totalLength; i++) {
|
|
12719
|
+
const char = chunk[i];
|
|
12720
|
+
char === "\r" && chunk[i + 1] === `
|
|
12721
|
+
` ? (lines.push(incompleteLine), incompleteLine = "", i++) : char === "\r" || char === `
|
|
12722
|
+
` ? (lines.push(incompleteLine), incompleteLine = "") : incompleteLine += char;
|
|
12723
|
+
}
|
|
12724
|
+
return [lines, incompleteLine];
|
|
12725
|
+
}
|
|
12726
|
+
class ErrorEvent extends Event {
|
|
12727
|
+
/**
|
|
12728
|
+
* Constructs a new `ErrorEvent` instance. This is typically not called directly,
|
|
12729
|
+
* but rather emitted by the `EventSource` object when an error occurs.
|
|
12730
|
+
*
|
|
12731
|
+
* @param type - The type of the event (should be "error")
|
|
12732
|
+
* @param errorEventInitDict - Optional properties to include in the error event
|
|
12733
|
+
*/
|
|
12734
|
+
constructor(type, errorEventInitDict) {
|
|
12735
|
+
var _a, _b;
|
|
12736
|
+
super(type), this.code = (_a = errorEventInitDict == null ? void 0 : errorEventInitDict.code) != null ? _a : void 0, this.message = (_b = errorEventInitDict == null ? void 0 : errorEventInitDict.message) != null ? _b : void 0;
|
|
12737
|
+
}
|
|
12738
|
+
/**
|
|
12739
|
+
* Node.js "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
12740
|
+
* when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,
|
|
12741
|
+
* we explicitly include the properties in the `inspect` method.
|
|
12742
|
+
*
|
|
12743
|
+
* This is automatically called by Node.js when you `console.log` an instance of this class.
|
|
12744
|
+
*
|
|
12745
|
+
* @param _depth - The current depth
|
|
12746
|
+
* @param options - The options passed to `util.inspect`
|
|
12747
|
+
* @param inspect - The inspect function to use (prevents having to import it from `util`)
|
|
12748
|
+
* @returns A string representation of the error
|
|
12749
|
+
*/
|
|
12750
|
+
[Symbol.for("nodejs.util.inspect.custom")](_depth, options, inspect) {
|
|
12751
|
+
return inspect(inspectableError(this), options);
|
|
12752
|
+
}
|
|
12753
|
+
/**
|
|
12754
|
+
* Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
|
|
12755
|
+
* when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,
|
|
12756
|
+
* we explicitly include the properties in the `inspect` method.
|
|
12757
|
+
*
|
|
12758
|
+
* This is automatically called by Deno when you `console.log` an instance of this class.
|
|
12759
|
+
*
|
|
12760
|
+
* @param inspect - The inspect function to use (prevents having to import it from `util`)
|
|
12761
|
+
* @param options - The options passed to `Deno.inspect`
|
|
12762
|
+
* @returns A string representation of the error
|
|
12763
|
+
*/
|
|
12764
|
+
[Symbol.for("Deno.customInspect")](inspect, options) {
|
|
12765
|
+
return inspect(inspectableError(this), options);
|
|
12766
|
+
}
|
|
12767
|
+
}
|
|
12768
|
+
function syntaxError(message) {
|
|
12769
|
+
const DomException = globalThis.DOMException;
|
|
12770
|
+
return typeof DomException == "function" ? new DomException(message, "SyntaxError") : new SyntaxError(message);
|
|
12771
|
+
}
|
|
12772
|
+
function flattenError(err) {
|
|
12773
|
+
return err instanceof Error ? "errors" in err && Array.isArray(err.errors) ? err.errors.map(flattenError).join(", ") : "cause" in err && err.cause instanceof Error ? `${err}: ${flattenError(err.cause)}` : err.message : `${err}`;
|
|
12774
|
+
}
|
|
12775
|
+
function inspectableError(err) {
|
|
12776
|
+
return {
|
|
12777
|
+
type: err.type,
|
|
12778
|
+
message: err.message,
|
|
12779
|
+
code: err.code,
|
|
12780
|
+
defaultPrevented: err.defaultPrevented,
|
|
12781
|
+
cancelable: err.cancelable,
|
|
12782
|
+
timeStamp: err.timeStamp
|
|
12783
|
+
};
|
|
12784
|
+
}
|
|
12785
|
+
var __typeError = (msg) => {
|
|
12786
|
+
throw TypeError(msg);
|
|
12787
|
+
}, __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg), __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value), __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value), __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method), _readyState, _url, _redirectUrl, _withCredentials, _fetch, _reconnectInterval, _reconnectTimer, _lastEventId, _controller, _parser, _onError, _onMessage, _onOpen, _EventSource_instances, connect_fn, _onFetchResponse, _onFetchError, getRequestOptions_fn, _onEvent, _onRetryChange, failConnection_fn, scheduleReconnect_fn, _reconnect;
|
|
12788
|
+
class EventSource extends EventTarget {
|
|
12789
|
+
constructor(url, eventSourceInitDict) {
|
|
12790
|
+
var _a, _b;
|
|
12791
|
+
super(), __privateAdd(this, _EventSource_instances), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, __privateAdd(this, _readyState), __privateAdd(this, _url), __privateAdd(this, _redirectUrl), __privateAdd(this, _withCredentials), __privateAdd(this, _fetch), __privateAdd(this, _reconnectInterval), __privateAdd(this, _reconnectTimer), __privateAdd(this, _lastEventId, null), __privateAdd(this, _controller), __privateAdd(this, _parser), __privateAdd(this, _onError, null), __privateAdd(this, _onMessage, null), __privateAdd(this, _onOpen, null), __privateAdd(this, _onFetchResponse, async (response) => {
|
|
12792
|
+
var _a2;
|
|
12793
|
+
__privateGet(this, _parser).reset();
|
|
12794
|
+
const { body, redirected, status, headers } = response;
|
|
12795
|
+
if (status === 204) {
|
|
12796
|
+
__privateMethod(this, _EventSource_instances, failConnection_fn).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
12797
|
+
return;
|
|
12798
|
+
}
|
|
12799
|
+
if (redirected ? __privateSet(this, _redirectUrl, new URL(response.url)) : __privateSet(this, _redirectUrl, void 0), status !== 200) {
|
|
12800
|
+
__privateMethod(this, _EventSource_instances, failConnection_fn).call(this, `Non-200 status code (${status})`, status);
|
|
12801
|
+
return;
|
|
12802
|
+
}
|
|
12803
|
+
if (!(headers.get("content-type") || "").startsWith("text/event-stream")) {
|
|
12804
|
+
__privateMethod(this, _EventSource_instances, failConnection_fn).call(this, 'Invalid content type, expected "text/event-stream"', status);
|
|
12805
|
+
return;
|
|
12806
|
+
}
|
|
12807
|
+
if (__privateGet(this, _readyState) === this.CLOSED)
|
|
12808
|
+
return;
|
|
12809
|
+
__privateSet(this, _readyState, this.OPEN);
|
|
12810
|
+
const openEvent = new Event("open");
|
|
12811
|
+
if ((_a2 = __privateGet(this, _onOpen)) == null || _a2.call(this, openEvent), this.dispatchEvent(openEvent), typeof body != "object" || !body || !("getReader" in body)) {
|
|
12812
|
+
__privateMethod(this, _EventSource_instances, failConnection_fn).call(this, "Invalid response body, expected a web ReadableStream", status), this.close();
|
|
12813
|
+
return;
|
|
12814
|
+
}
|
|
12815
|
+
const decoder = new TextDecoder(), reader = body.getReader();
|
|
12816
|
+
let open = true;
|
|
12817
|
+
do {
|
|
12818
|
+
const { done, value } = await reader.read();
|
|
12819
|
+
value && __privateGet(this, _parser).feed(decoder.decode(value, { stream: !done })), done && (open = false, __privateGet(this, _parser).reset(), __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this));
|
|
12820
|
+
} while (open);
|
|
12821
|
+
}), __privateAdd(this, _onFetchError, (err) => {
|
|
12822
|
+
__privateSet(this, _controller, void 0), !(err.name === "AbortError" || err.type === "aborted") && __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this, flattenError(err));
|
|
12823
|
+
}), __privateAdd(this, _onEvent, (event) => {
|
|
12824
|
+
typeof event.id == "string" && __privateSet(this, _lastEventId, event.id);
|
|
12825
|
+
const messageEvent = new MessageEvent(event.event || "message", {
|
|
12826
|
+
data: event.data,
|
|
12827
|
+
origin: __privateGet(this, _redirectUrl) ? __privateGet(this, _redirectUrl).origin : __privateGet(this, _url).origin,
|
|
12828
|
+
lastEventId: event.id || ""
|
|
12829
|
+
});
|
|
12830
|
+
__privateGet(this, _onMessage) && (!event.event || event.event === "message") && __privateGet(this, _onMessage).call(this, messageEvent), this.dispatchEvent(messageEvent);
|
|
12831
|
+
}), __privateAdd(this, _onRetryChange, (value) => {
|
|
12832
|
+
__privateSet(this, _reconnectInterval, value);
|
|
12833
|
+
}), __privateAdd(this, _reconnect, () => {
|
|
12834
|
+
__privateSet(this, _reconnectTimer, void 0), __privateGet(this, _readyState) === this.CONNECTING && __privateMethod(this, _EventSource_instances, connect_fn).call(this);
|
|
12835
|
+
});
|
|
12836
|
+
try {
|
|
12837
|
+
if (url instanceof URL)
|
|
12838
|
+
__privateSet(this, _url, url);
|
|
12839
|
+
else if (typeof url == "string")
|
|
12840
|
+
__privateSet(this, _url, new URL(url, getBaseURL()));
|
|
12841
|
+
else
|
|
12842
|
+
throw new Error("Invalid URL");
|
|
12843
|
+
} catch {
|
|
12844
|
+
throw syntaxError("An invalid or illegal string was specified");
|
|
12845
|
+
}
|
|
12846
|
+
__privateSet(this, _parser, createParser({
|
|
12847
|
+
onEvent: __privateGet(this, _onEvent),
|
|
12848
|
+
onRetry: __privateGet(this, _onRetryChange)
|
|
12849
|
+
})), __privateSet(this, _readyState, this.CONNECTING), __privateSet(this, _reconnectInterval, 3e3), __privateSet(this, _fetch, (_a = eventSourceInitDict == null ? void 0 : eventSourceInitDict.fetch) != null ? _a : globalThis.fetch), __privateSet(this, _withCredentials, (_b = eventSourceInitDict == null ? void 0 : eventSourceInitDict.withCredentials) != null ? _b : false), __privateMethod(this, _EventSource_instances, connect_fn).call(this);
|
|
12850
|
+
}
|
|
12851
|
+
/**
|
|
12852
|
+
* Returns the state of this EventSource object's connection. It can have the values described below.
|
|
12853
|
+
*
|
|
12854
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
|
|
12855
|
+
*
|
|
12856
|
+
* Note: typed as `number` instead of `0 | 1 | 2` for compatibility with the `EventSource` interface,
|
|
12857
|
+
* defined in the TypeScript `dom` library.
|
|
12858
|
+
*
|
|
12859
|
+
* @public
|
|
12860
|
+
*/
|
|
12861
|
+
get readyState() {
|
|
12862
|
+
return __privateGet(this, _readyState);
|
|
12863
|
+
}
|
|
12864
|
+
/**
|
|
12865
|
+
* Returns the URL providing the event stream.
|
|
12866
|
+
*
|
|
12867
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
|
|
12868
|
+
*
|
|
12869
|
+
* @public
|
|
12870
|
+
*/
|
|
12871
|
+
get url() {
|
|
12872
|
+
return __privateGet(this, _url).href;
|
|
12873
|
+
}
|
|
12874
|
+
/**
|
|
12875
|
+
* Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
|
|
12876
|
+
*
|
|
12877
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
|
|
12878
|
+
*/
|
|
12879
|
+
get withCredentials() {
|
|
12880
|
+
return __privateGet(this, _withCredentials);
|
|
12881
|
+
}
|
|
12882
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
|
|
12883
|
+
get onerror() {
|
|
12884
|
+
return __privateGet(this, _onError);
|
|
12885
|
+
}
|
|
12886
|
+
set onerror(value) {
|
|
12887
|
+
__privateSet(this, _onError, value);
|
|
12888
|
+
}
|
|
12889
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
12890
|
+
get onmessage() {
|
|
12891
|
+
return __privateGet(this, _onMessage);
|
|
12892
|
+
}
|
|
12893
|
+
set onmessage(value) {
|
|
12894
|
+
__privateSet(this, _onMessage, value);
|
|
12895
|
+
}
|
|
12896
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
|
|
12897
|
+
get onopen() {
|
|
12898
|
+
return __privateGet(this, _onOpen);
|
|
12899
|
+
}
|
|
12900
|
+
set onopen(value) {
|
|
12901
|
+
__privateSet(this, _onOpen, value);
|
|
12902
|
+
}
|
|
12903
|
+
addEventListener(type, listener, options) {
|
|
12904
|
+
const listen = listener;
|
|
12905
|
+
super.addEventListener(type, listen, options);
|
|
12906
|
+
}
|
|
12907
|
+
removeEventListener(type, listener, options) {
|
|
12908
|
+
const listen = listener;
|
|
12909
|
+
super.removeEventListener(type, listen, options);
|
|
12910
|
+
}
|
|
12911
|
+
/**
|
|
12912
|
+
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
12913
|
+
*
|
|
12914
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
|
|
12915
|
+
*
|
|
12916
|
+
* @public
|
|
12917
|
+
*/
|
|
12918
|
+
close() {
|
|
12919
|
+
__privateGet(this, _reconnectTimer) && clearTimeout(__privateGet(this, _reconnectTimer)), __privateGet(this, _readyState) !== this.CLOSED && (__privateGet(this, _controller) && __privateGet(this, _controller).abort(), __privateSet(this, _readyState, this.CLOSED), __privateSet(this, _controller, void 0));
|
|
12920
|
+
}
|
|
12921
|
+
}
|
|
12922
|
+
_readyState = /* @__PURE__ */ new WeakMap(), _url = /* @__PURE__ */ new WeakMap(), _redirectUrl = /* @__PURE__ */ new WeakMap(), _withCredentials = /* @__PURE__ */ new WeakMap(), _fetch = /* @__PURE__ */ new WeakMap(), _reconnectInterval = /* @__PURE__ */ new WeakMap(), _reconnectTimer = /* @__PURE__ */ new WeakMap(), _lastEventId = /* @__PURE__ */ new WeakMap(), _controller = /* @__PURE__ */ new WeakMap(), _parser = /* @__PURE__ */ new WeakMap(), _onError = /* @__PURE__ */ new WeakMap(), _onMessage = /* @__PURE__ */ new WeakMap(), _onOpen = /* @__PURE__ */ new WeakMap(), _EventSource_instances = /* @__PURE__ */ new WeakSet(), /**
|
|
12923
|
+
* Connect to the given URL and start receiving events
|
|
12924
|
+
*
|
|
12925
|
+
* @internal
|
|
12926
|
+
*/
|
|
12927
|
+
connect_fn = function() {
|
|
12928
|
+
__privateSet(this, _readyState, this.CONNECTING), __privateSet(this, _controller, new AbortController()), __privateGet(this, _fetch)(__privateGet(this, _url), __privateMethod(this, _EventSource_instances, getRequestOptions_fn).call(this)).then(__privateGet(this, _onFetchResponse)).catch(__privateGet(this, _onFetchError));
|
|
12929
|
+
}, _onFetchResponse = /* @__PURE__ */ new WeakMap(), _onFetchError = /* @__PURE__ */ new WeakMap(), /**
|
|
12930
|
+
* Get request options for the `fetch()` request
|
|
12931
|
+
*
|
|
12932
|
+
* @returns The request options
|
|
12933
|
+
* @internal
|
|
12934
|
+
*/
|
|
12935
|
+
getRequestOptions_fn = function() {
|
|
12936
|
+
var _a;
|
|
12937
|
+
const init = {
|
|
12938
|
+
// [spec] Let `corsAttributeState` be `Anonymous`…
|
|
12939
|
+
// [spec] …will have their mode set to "cors"…
|
|
12940
|
+
mode: "cors",
|
|
12941
|
+
redirect: "follow",
|
|
12942
|
+
headers: { Accept: "text/event-stream", ...__privateGet(this, _lastEventId) ? { "Last-Event-ID": __privateGet(this, _lastEventId) } : void 0 },
|
|
12943
|
+
cache: "no-store",
|
|
12944
|
+
signal: (_a = __privateGet(this, _controller)) == null ? void 0 : _a.signal
|
|
12945
|
+
};
|
|
12946
|
+
return "window" in globalThis && (init.credentials = this.withCredentials ? "include" : "same-origin"), init;
|
|
12947
|
+
}, _onEvent = /* @__PURE__ */ new WeakMap(), _onRetryChange = /* @__PURE__ */ new WeakMap(), /**
|
|
12948
|
+
* Handles the process referred to in the EventSource specification as "failing a connection".
|
|
12949
|
+
*
|
|
12950
|
+
* @param error - The error causing the connection to fail
|
|
12951
|
+
* @param code - The HTTP status code, if available
|
|
12952
|
+
* @internal
|
|
12953
|
+
*/
|
|
12954
|
+
failConnection_fn = function(message, code) {
|
|
12955
|
+
var _a;
|
|
12956
|
+
__privateGet(this, _readyState) !== this.CLOSED && __privateSet(this, _readyState, this.CLOSED);
|
|
12957
|
+
const errorEvent = new ErrorEvent("error", { code, message });
|
|
12958
|
+
(_a = __privateGet(this, _onError)) == null || _a.call(this, errorEvent), this.dispatchEvent(errorEvent);
|
|
12959
|
+
}, /**
|
|
12960
|
+
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
12961
|
+
*
|
|
12962
|
+
* @param message - The error causing the connection to fail
|
|
12963
|
+
* @param code - The HTTP status code, if available
|
|
12964
|
+
* @internal
|
|
12965
|
+
*/
|
|
12966
|
+
scheduleReconnect_fn = function(message, code) {
|
|
12967
|
+
var _a;
|
|
12968
|
+
if (__privateGet(this, _readyState) === this.CLOSED)
|
|
12969
|
+
return;
|
|
12970
|
+
__privateSet(this, _readyState, this.CONNECTING);
|
|
12971
|
+
const errorEvent = new ErrorEvent("error", { code, message });
|
|
12972
|
+
(_a = __privateGet(this, _onError)) == null || _a.call(this, errorEvent), this.dispatchEvent(errorEvent), __privateSet(this, _reconnectTimer, setTimeout(__privateGet(this, _reconnect), __privateGet(this, _reconnectInterval)));
|
|
12973
|
+
}, _reconnect = /* @__PURE__ */ new WeakMap(), /**
|
|
12974
|
+
* ReadyState representing an EventSource currently trying to connect
|
|
12975
|
+
*
|
|
12976
|
+
* @public
|
|
12977
|
+
*/
|
|
12978
|
+
EventSource.CONNECTING = 0, /**
|
|
12979
|
+
* ReadyState representing an EventSource connection that is open (eg connected)
|
|
12980
|
+
*
|
|
12981
|
+
* @public
|
|
12982
|
+
*/
|
|
12983
|
+
EventSource.OPEN = 1, /**
|
|
12984
|
+
* ReadyState representing an EventSource connection that is closed (eg disconnected)
|
|
12985
|
+
*
|
|
12986
|
+
* @public
|
|
12987
|
+
*/
|
|
12988
|
+
EventSource.CLOSED = 2;
|
|
12989
|
+
function getBaseURL() {
|
|
12990
|
+
const doc = "document" in globalThis ? globalThis.document : void 0;
|
|
12991
|
+
return doc && typeof doc == "object" && "baseURI" in doc && typeof doc.baseURI == "string" ? doc.baseURI : void 0;
|
|
12992
|
+
}
|
|
12993
|
+
class SseError extends Error {
|
|
12994
|
+
constructor(code, message, event) {
|
|
12995
|
+
super(`SSE error: ${message}`);
|
|
12996
|
+
this.code = code;
|
|
12997
|
+
this.event = event;
|
|
12998
|
+
}
|
|
12999
|
+
}
|
|
13000
|
+
class SSEClientTransport {
|
|
13001
|
+
constructor(url, opts) {
|
|
13002
|
+
this._url = url;
|
|
13003
|
+
this._eventSourceInit = opts === null || opts === void 0 ? void 0 : opts.eventSourceInit;
|
|
13004
|
+
this._requestInit = opts === null || opts === void 0 ? void 0 : opts.requestInit;
|
|
13005
|
+
}
|
|
13006
|
+
start() {
|
|
13007
|
+
if (this._eventSource) {
|
|
13008
|
+
throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");
|
|
13009
|
+
}
|
|
13010
|
+
return new Promise((resolve, reject) => {
|
|
13011
|
+
this._eventSource = new EventSource(this._url.href, this._eventSourceInit);
|
|
13012
|
+
this._abortController = new AbortController();
|
|
13013
|
+
this._eventSource.onerror = (event) => {
|
|
13014
|
+
var _a;
|
|
13015
|
+
const error = new SseError(event.code, event.message, event);
|
|
13016
|
+
reject(error);
|
|
13017
|
+
(_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);
|
|
13018
|
+
};
|
|
13019
|
+
this._eventSource.onopen = () => {
|
|
13020
|
+
};
|
|
13021
|
+
this._eventSource.addEventListener("endpoint", (event) => {
|
|
13022
|
+
var _a;
|
|
13023
|
+
const messageEvent = event;
|
|
13024
|
+
try {
|
|
13025
|
+
this._endpoint = new URL(messageEvent.data, this._url);
|
|
13026
|
+
if (this._endpoint.origin !== this._url.origin) {
|
|
13027
|
+
throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`);
|
|
13028
|
+
}
|
|
13029
|
+
} catch (error) {
|
|
13030
|
+
reject(error);
|
|
13031
|
+
(_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);
|
|
13032
|
+
void this.close();
|
|
13033
|
+
return;
|
|
13034
|
+
}
|
|
13035
|
+
resolve();
|
|
13036
|
+
});
|
|
13037
|
+
this._eventSource.onmessage = (event) => {
|
|
13038
|
+
var _a, _b;
|
|
13039
|
+
const messageEvent = event;
|
|
13040
|
+
let message;
|
|
13041
|
+
try {
|
|
13042
|
+
message = JSONRPCMessageSchema.parse(JSON.parse(messageEvent.data));
|
|
13043
|
+
} catch (error) {
|
|
13044
|
+
(_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);
|
|
13045
|
+
return;
|
|
13046
|
+
}
|
|
13047
|
+
(_b = this.onmessage) === null || _b === void 0 ? void 0 : _b.call(this, message);
|
|
13048
|
+
};
|
|
13049
|
+
});
|
|
13050
|
+
}
|
|
13051
|
+
async close() {
|
|
13052
|
+
var _a, _b, _c;
|
|
13053
|
+
(_a = this._abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
13054
|
+
(_b = this._eventSource) === null || _b === void 0 ? void 0 : _b.close();
|
|
13055
|
+
(_c = this.onclose) === null || _c === void 0 ? void 0 : _c.call(this);
|
|
13056
|
+
}
|
|
13057
|
+
async send(message) {
|
|
13058
|
+
var _a, _b, _c;
|
|
13059
|
+
if (!this._endpoint) {
|
|
13060
|
+
throw new Error("Not connected");
|
|
13061
|
+
}
|
|
13062
|
+
try {
|
|
13063
|
+
const headers = new Headers((_a = this._requestInit) === null || _a === void 0 ? void 0 : _a.headers);
|
|
13064
|
+
headers.set("content-type", "application/json");
|
|
13065
|
+
const init = {
|
|
13066
|
+
...this._requestInit,
|
|
13067
|
+
method: "POST",
|
|
13068
|
+
headers,
|
|
13069
|
+
body: JSON.stringify(message),
|
|
13070
|
+
signal: (_b = this._abortController) === null || _b === void 0 ? void 0 : _b.signal
|
|
13071
|
+
};
|
|
13072
|
+
const response = await fetch(this._endpoint, init);
|
|
13073
|
+
if (!response.ok) {
|
|
13074
|
+
const text = await response.text().catch(() => null);
|
|
13075
|
+
throw new Error(`Error POSTing to endpoint (HTTP ${response.status}): ${text}`);
|
|
13076
|
+
}
|
|
13077
|
+
} catch (error) {
|
|
13078
|
+
(_c = this.onerror) === null || _c === void 0 ? void 0 : _c.call(this, error);
|
|
13079
|
+
throw error;
|
|
13080
|
+
}
|
|
13081
|
+
}
|
|
13082
|
+
}
|
|
13083
|
+
let crypto;
|
|
13084
|
+
crypto = globalThis.crypto;
|
|
13085
|
+
function getRandomValues(size2) {
|
|
13086
|
+
return crypto.getRandomValues(new Uint8Array(size2));
|
|
13087
|
+
}
|
|
13088
|
+
function random(size2) {
|
|
13089
|
+
const mask = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
|
|
13090
|
+
let result = "";
|
|
13091
|
+
const randomUints = getRandomValues(size2);
|
|
13092
|
+
for (let i = 0; i < size2; i++) {
|
|
13093
|
+
const randomIndex = randomUints[i] % mask.length;
|
|
13094
|
+
result += mask[randomIndex];
|
|
13095
|
+
}
|
|
13096
|
+
return result;
|
|
13097
|
+
}
|
|
13098
|
+
function generateVerifier(length) {
|
|
13099
|
+
return random(length);
|
|
13100
|
+
}
|
|
13101
|
+
async function generateChallenge(code_verifier) {
|
|
13102
|
+
const buffer = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
|
|
13103
|
+
return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
13104
|
+
}
|
|
13105
|
+
async function pkceChallenge(length) {
|
|
13106
|
+
if (!length)
|
|
13107
|
+
length = 43;
|
|
13108
|
+
if (length < 43 || length > 128) {
|
|
13109
|
+
throw `Expected a length between 43 and 128. Received ${length}.`;
|
|
13110
|
+
}
|
|
13111
|
+
const verifier = generateVerifier(length);
|
|
13112
|
+
const challenge = await generateChallenge(verifier);
|
|
13113
|
+
return {
|
|
13114
|
+
code_verifier: verifier,
|
|
13115
|
+
code_challenge: challenge
|
|
13116
|
+
};
|
|
13117
|
+
}
|
|
13118
|
+
const SESSION_KEYS = {
|
|
13119
|
+
CODE_VERIFIER: "mcp_code_verifier",
|
|
13120
|
+
SERVER_URL: "mcp_server_url",
|
|
13121
|
+
ACCESS_TOKEN: "mcp_access_token"
|
|
13122
|
+
};
|
|
13123
|
+
async function discoverOAuthMetadata(serverUrl) {
|
|
13124
|
+
try {
|
|
13125
|
+
const url = new URL("/.well-known/oauth-authorization-server", serverUrl);
|
|
13126
|
+
const response = await fetch(url.toString());
|
|
13127
|
+
if (response.ok) {
|
|
13128
|
+
const metadata = await response.json();
|
|
13129
|
+
return {
|
|
13130
|
+
authorization_endpoint: metadata.authorization_endpoint,
|
|
13131
|
+
token_endpoint: metadata.token_endpoint
|
|
13132
|
+
};
|
|
13133
|
+
}
|
|
13134
|
+
} catch (error) {
|
|
13135
|
+
console.warn("OAuth metadata discovery failed:", error);
|
|
13136
|
+
}
|
|
13137
|
+
const baseUrl = new URL(serverUrl);
|
|
13138
|
+
return {
|
|
13139
|
+
authorization_endpoint: new URL("/authorize", baseUrl).toString(),
|
|
13140
|
+
token_endpoint: new URL("/token", baseUrl).toString()
|
|
13141
|
+
};
|
|
13142
|
+
}
|
|
13143
|
+
async function startOAuthFlow(serverUrl) {
|
|
13144
|
+
const challenge = await pkceChallenge();
|
|
13145
|
+
const codeVerifier = challenge.code_verifier;
|
|
13146
|
+
const codeChallenge = challenge.code_challenge;
|
|
13147
|
+
sessionStorage.setItem(SESSION_KEYS.CODE_VERIFIER, codeVerifier);
|
|
13148
|
+
const metadata = await discoverOAuthMetadata(serverUrl);
|
|
13149
|
+
const authUrl = new URL(metadata.authorization_endpoint);
|
|
13150
|
+
authUrl.searchParams.set("response_type", "code");
|
|
13151
|
+
authUrl.searchParams.set("code_challenge", codeChallenge);
|
|
13152
|
+
authUrl.searchParams.set("code_challenge_method", "S256");
|
|
13153
|
+
authUrl.searchParams.set(
|
|
13154
|
+
"redirect_uri",
|
|
13155
|
+
window.location.origin + "/oauth/callback"
|
|
13156
|
+
);
|
|
13157
|
+
return authUrl.toString();
|
|
13158
|
+
}
|
|
13159
|
+
async function handleOAuthCallback(serverUrl, code) {
|
|
13160
|
+
const codeVerifier = sessionStorage.getItem(SESSION_KEYS.CODE_VERIFIER);
|
|
13161
|
+
if (!codeVerifier) {
|
|
13162
|
+
throw new Error("No code verifier found");
|
|
13163
|
+
}
|
|
13164
|
+
const metadata = await discoverOAuthMetadata(serverUrl);
|
|
13165
|
+
const response = await fetch(metadata.token_endpoint, {
|
|
13166
|
+
method: "POST",
|
|
13167
|
+
headers: {
|
|
13168
|
+
"Content-Type": "application/json"
|
|
13169
|
+
},
|
|
13170
|
+
body: JSON.stringify({
|
|
13171
|
+
grant_type: "authorization_code",
|
|
13172
|
+
code,
|
|
13173
|
+
code_verifier: codeVerifier,
|
|
13174
|
+
redirect_uri: window.location.origin + "/oauth/callback"
|
|
13175
|
+
})
|
|
13176
|
+
});
|
|
13177
|
+
if (!response.ok) {
|
|
13178
|
+
throw new Error("Token exchange failed");
|
|
13179
|
+
}
|
|
13180
|
+
const data = await response.json();
|
|
13181
|
+
return data.access_token;
|
|
13182
|
+
}
|
|
13183
|
+
const StdErrNotificationSchema = NotificationSchema.extend({
|
|
13184
|
+
method: z.literal("notifications/stderr"),
|
|
13185
|
+
params: z.object({
|
|
13186
|
+
content: z.string()
|
|
13187
|
+
})
|
|
13188
|
+
});
|
|
13189
|
+
ClientNotificationSchema.or(
|
|
12483
13190
|
StdErrNotificationSchema
|
|
12484
13191
|
);
|
|
13192
|
+
const DEFAULT_REQUEST_TIMEOUT_MSEC = 1e4;
|
|
13193
|
+
function useConnection({
|
|
13194
|
+
transportType,
|
|
13195
|
+
command,
|
|
13196
|
+
args,
|
|
13197
|
+
sseUrl,
|
|
13198
|
+
env,
|
|
13199
|
+
proxyServerUrl,
|
|
13200
|
+
requestTimeout = DEFAULT_REQUEST_TIMEOUT_MSEC,
|
|
13201
|
+
onNotification,
|
|
13202
|
+
onStdErrNotification,
|
|
13203
|
+
onPendingRequest,
|
|
13204
|
+
getRoots
|
|
13205
|
+
}) {
|
|
13206
|
+
const [connectionStatus, setConnectionStatus] = reactExports.useState("disconnected");
|
|
13207
|
+
const [serverCapabilities, setServerCapabilities] = reactExports.useState(null);
|
|
13208
|
+
const [mcpClient, setMcpClient] = reactExports.useState(null);
|
|
13209
|
+
const [requestHistory, setRequestHistory] = reactExports.useState([]);
|
|
13210
|
+
const pushHistory = (request, response) => {
|
|
13211
|
+
setRequestHistory((prev) => [
|
|
13212
|
+
...prev,
|
|
13213
|
+
{
|
|
13214
|
+
request: JSON.stringify(request),
|
|
13215
|
+
response: response !== void 0 ? JSON.stringify(response) : void 0
|
|
13216
|
+
}
|
|
13217
|
+
]);
|
|
13218
|
+
};
|
|
13219
|
+
const makeRequest = async (request, schema) => {
|
|
13220
|
+
if (!mcpClient) {
|
|
13221
|
+
throw new Error("MCP client not connected");
|
|
13222
|
+
}
|
|
13223
|
+
try {
|
|
13224
|
+
const abortController = new AbortController();
|
|
13225
|
+
const timeoutId = setTimeout(() => {
|
|
13226
|
+
abortController.abort("Request timed out");
|
|
13227
|
+
}, requestTimeout);
|
|
13228
|
+
let response;
|
|
13229
|
+
try {
|
|
13230
|
+
response = await mcpClient.request(request, schema, {
|
|
13231
|
+
signal: abortController.signal
|
|
13232
|
+
});
|
|
13233
|
+
pushHistory(request, response);
|
|
13234
|
+
} catch (error) {
|
|
13235
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
13236
|
+
pushHistory(request, { error: errorMessage });
|
|
13237
|
+
throw error;
|
|
13238
|
+
} finally {
|
|
13239
|
+
clearTimeout(timeoutId);
|
|
13240
|
+
}
|
|
13241
|
+
return response;
|
|
13242
|
+
} catch (e) {
|
|
13243
|
+
const errorString = e.message ?? String(e);
|
|
13244
|
+
B.error(errorString);
|
|
13245
|
+
throw e;
|
|
13246
|
+
}
|
|
13247
|
+
};
|
|
13248
|
+
const sendNotification = async (notification) => {
|
|
13249
|
+
if (!mcpClient) {
|
|
13250
|
+
throw new Error("MCP client not connected");
|
|
13251
|
+
}
|
|
13252
|
+
try {
|
|
13253
|
+
await mcpClient.notification(notification);
|
|
13254
|
+
pushHistory(notification);
|
|
13255
|
+
} catch (e) {
|
|
13256
|
+
B.error(e.message ?? String(e));
|
|
13257
|
+
throw e;
|
|
13258
|
+
}
|
|
13259
|
+
};
|
|
13260
|
+
const connect = async () => {
|
|
13261
|
+
try {
|
|
13262
|
+
const client = new Client(
|
|
13263
|
+
{
|
|
13264
|
+
name: "mcp-inspector",
|
|
13265
|
+
version: "0.0.1"
|
|
13266
|
+
},
|
|
13267
|
+
{
|
|
13268
|
+
capabilities: {
|
|
13269
|
+
sampling: {},
|
|
13270
|
+
roots: {
|
|
13271
|
+
listChanged: true
|
|
13272
|
+
}
|
|
13273
|
+
}
|
|
13274
|
+
}
|
|
13275
|
+
);
|
|
13276
|
+
const backendUrl = new URL(`${proxyServerUrl}/sse`);
|
|
13277
|
+
backendUrl.searchParams.append("transportType", transportType);
|
|
13278
|
+
if (transportType === "stdio") {
|
|
13279
|
+
backendUrl.searchParams.append("command", command);
|
|
13280
|
+
backendUrl.searchParams.append("args", args);
|
|
13281
|
+
backendUrl.searchParams.append("env", JSON.stringify(env));
|
|
13282
|
+
} else {
|
|
13283
|
+
backendUrl.searchParams.append("url", sseUrl);
|
|
13284
|
+
}
|
|
13285
|
+
const headers = {};
|
|
13286
|
+
const accessToken = sessionStorage.getItem(SESSION_KEYS.ACCESS_TOKEN);
|
|
13287
|
+
if (accessToken) {
|
|
13288
|
+
headers["Authorization"] = `Bearer ${accessToken}`;
|
|
13289
|
+
}
|
|
13290
|
+
const clientTransport = new SSEClientTransport(backendUrl, {
|
|
13291
|
+
eventSourceInit: {
|
|
13292
|
+
fetch: (url, init) => fetch(url, { ...init, headers })
|
|
13293
|
+
},
|
|
13294
|
+
requestInit: {
|
|
13295
|
+
headers
|
|
13296
|
+
}
|
|
13297
|
+
});
|
|
13298
|
+
if (onNotification) {
|
|
13299
|
+
client.setNotificationHandler(
|
|
13300
|
+
ProgressNotificationSchema,
|
|
13301
|
+
onNotification
|
|
13302
|
+
);
|
|
13303
|
+
}
|
|
13304
|
+
if (onStdErrNotification) {
|
|
13305
|
+
client.setNotificationHandler(
|
|
13306
|
+
StdErrNotificationSchema,
|
|
13307
|
+
onStdErrNotification
|
|
13308
|
+
);
|
|
13309
|
+
}
|
|
13310
|
+
try {
|
|
13311
|
+
await client.connect(clientTransport);
|
|
13312
|
+
} catch (error) {
|
|
13313
|
+
console.error("Failed to connect to MCP server:", error);
|
|
13314
|
+
if (error instanceof SseError && error.code === 401) {
|
|
13315
|
+
sessionStorage.setItem(SESSION_KEYS.SERVER_URL, sseUrl);
|
|
13316
|
+
const redirectUrl = await startOAuthFlow(sseUrl);
|
|
13317
|
+
window.location.href = redirectUrl;
|
|
13318
|
+
return;
|
|
13319
|
+
}
|
|
13320
|
+
throw error;
|
|
13321
|
+
}
|
|
13322
|
+
const capabilities = client.getServerCapabilities();
|
|
13323
|
+
setServerCapabilities(capabilities ?? null);
|
|
13324
|
+
if (onPendingRequest) {
|
|
13325
|
+
client.setRequestHandler(CreateMessageRequestSchema, (request) => {
|
|
13326
|
+
return new Promise((resolve, reject) => {
|
|
13327
|
+
onPendingRequest(request, resolve, reject);
|
|
13328
|
+
});
|
|
13329
|
+
});
|
|
13330
|
+
}
|
|
13331
|
+
if (getRoots) {
|
|
13332
|
+
client.setRequestHandler(ListRootsRequestSchema, async () => {
|
|
13333
|
+
return { roots: getRoots() };
|
|
13334
|
+
});
|
|
13335
|
+
}
|
|
13336
|
+
setMcpClient(client);
|
|
13337
|
+
setConnectionStatus("connected");
|
|
13338
|
+
} catch (e) {
|
|
13339
|
+
console.error(e);
|
|
13340
|
+
setConnectionStatus("error");
|
|
13341
|
+
}
|
|
13342
|
+
};
|
|
13343
|
+
return {
|
|
13344
|
+
connectionStatus,
|
|
13345
|
+
serverCapabilities,
|
|
13346
|
+
mcpClient,
|
|
13347
|
+
requestHistory,
|
|
13348
|
+
makeRequest,
|
|
13349
|
+
sendNotification,
|
|
13350
|
+
connect
|
|
13351
|
+
};
|
|
13352
|
+
}
|
|
13353
|
+
function useDraggablePane(initialHeight) {
|
|
13354
|
+
const [height, setHeight] = reactExports.useState(initialHeight);
|
|
13355
|
+
const [isDragging, setIsDragging] = reactExports.useState(false);
|
|
13356
|
+
const dragStartY = reactExports.useRef(0);
|
|
13357
|
+
const dragStartHeight = reactExports.useRef(0);
|
|
13358
|
+
const handleDragStart = reactExports.useCallback(
|
|
13359
|
+
(e) => {
|
|
13360
|
+
setIsDragging(true);
|
|
13361
|
+
dragStartY.current = e.clientY;
|
|
13362
|
+
dragStartHeight.current = height;
|
|
13363
|
+
document.body.style.userSelect = "none";
|
|
13364
|
+
},
|
|
13365
|
+
[height]
|
|
13366
|
+
);
|
|
13367
|
+
const handleDragMove = reactExports.useCallback(
|
|
13368
|
+
(e) => {
|
|
13369
|
+
if (!isDragging) return;
|
|
13370
|
+
const deltaY = dragStartY.current - e.clientY;
|
|
13371
|
+
const newHeight = Math.max(
|
|
13372
|
+
100,
|
|
13373
|
+
Math.min(800, dragStartHeight.current + deltaY)
|
|
13374
|
+
);
|
|
13375
|
+
setHeight(newHeight);
|
|
13376
|
+
},
|
|
13377
|
+
[isDragging]
|
|
13378
|
+
);
|
|
13379
|
+
const handleDragEnd = reactExports.useCallback(() => {
|
|
13380
|
+
setIsDragging(false);
|
|
13381
|
+
document.body.style.userSelect = "";
|
|
13382
|
+
}, []);
|
|
13383
|
+
reactExports.useEffect(() => {
|
|
13384
|
+
if (isDragging) {
|
|
13385
|
+
window.addEventListener("mousemove", handleDragMove);
|
|
13386
|
+
window.addEventListener("mouseup", handleDragEnd);
|
|
13387
|
+
return () => {
|
|
13388
|
+
window.removeEventListener("mousemove", handleDragMove);
|
|
13389
|
+
window.removeEventListener("mouseup", handleDragEnd);
|
|
13390
|
+
};
|
|
13391
|
+
}
|
|
13392
|
+
}, [isDragging, handleDragMove, handleDragEnd]);
|
|
13393
|
+
return {
|
|
13394
|
+
height,
|
|
13395
|
+
isDragging,
|
|
13396
|
+
handleDragStart
|
|
13397
|
+
};
|
|
13398
|
+
}
|
|
12485
13399
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
12486
13400
|
return function handleEvent(event) {
|
|
12487
13401
|
originalEventHandler == null ? void 0 : originalEventHandler(event);
|
|
@@ -12490,7 +13404,7 @@ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForD
|
|
|
12490
13404
|
}
|
|
12491
13405
|
};
|
|
12492
13406
|
}
|
|
12493
|
-
function createContextScope
|
|
13407
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
12494
13408
|
let defaultContexts = [];
|
|
12495
13409
|
function createContext3(rootComponentName, defaultContext) {
|
|
12496
13410
|
const BaseContext = reactExports.createContext(defaultContext);
|
|
@@ -12527,66 +13441,9 @@ function createContextScope$3(scopeName, createContextScopeDeps = []) {
|
|
|
12527
13441
|
};
|
|
12528
13442
|
};
|
|
12529
13443
|
createScope.scopeName = scopeName;
|
|
12530
|
-
return [createContext3, composeContextScopes
|
|
12531
|
-
}
|
|
12532
|
-
function composeContextScopes$3(...scopes) {
|
|
12533
|
-
const baseScope = scopes[0];
|
|
12534
|
-
if (scopes.length === 1) return baseScope;
|
|
12535
|
-
const createScope = () => {
|
|
12536
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
12537
|
-
useScope: createScope2(),
|
|
12538
|
-
scopeName: createScope2.scopeName
|
|
12539
|
-
}));
|
|
12540
|
-
return function useComposedScopes(overrideScopes) {
|
|
12541
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
12542
|
-
const scopeProps = useScope(overrideScopes);
|
|
12543
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
12544
|
-
return { ...nextScopes2, ...currentScope };
|
|
12545
|
-
}, {});
|
|
12546
|
-
return reactExports.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
12547
|
-
};
|
|
12548
|
-
};
|
|
12549
|
-
createScope.scopeName = baseScope.scopeName;
|
|
12550
|
-
return createScope;
|
|
12551
|
-
}
|
|
12552
|
-
function createContextScope$2(scopeName, createContextScopeDeps = []) {
|
|
12553
|
-
let defaultContexts = [];
|
|
12554
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
12555
|
-
const BaseContext = reactExports.createContext(defaultContext);
|
|
12556
|
-
const index2 = defaultContexts.length;
|
|
12557
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
12558
|
-
function Provider(props) {
|
|
12559
|
-
const { scope, children, ...context } = props;
|
|
12560
|
-
const Context = (scope == null ? void 0 : scope[scopeName][index2]) || BaseContext;
|
|
12561
|
-
const value = reactExports.useMemo(() => context, Object.values(context));
|
|
12562
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value, children });
|
|
12563
|
-
}
|
|
12564
|
-
function useContext2(consumerName, scope) {
|
|
12565
|
-
const Context = (scope == null ? void 0 : scope[scopeName][index2]) || BaseContext;
|
|
12566
|
-
const context = reactExports.useContext(Context);
|
|
12567
|
-
if (context) return context;
|
|
12568
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
12569
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
12570
|
-
}
|
|
12571
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
12572
|
-
return [Provider, useContext2];
|
|
12573
|
-
}
|
|
12574
|
-
const createScope = () => {
|
|
12575
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
12576
|
-
return reactExports.createContext(defaultContext);
|
|
12577
|
-
});
|
|
12578
|
-
return function useScope(scope) {
|
|
12579
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
12580
|
-
return reactExports.useMemo(
|
|
12581
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
12582
|
-
[scope, contexts]
|
|
12583
|
-
);
|
|
12584
|
-
};
|
|
12585
|
-
};
|
|
12586
|
-
createScope.scopeName = scopeName;
|
|
12587
|
-
return [createContext3, composeContextScopes$2(createScope, ...createContextScopeDeps)];
|
|
13444
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
12588
13445
|
}
|
|
12589
|
-
function composeContextScopes
|
|
13446
|
+
function composeContextScopes(...scopes) {
|
|
12590
13447
|
const baseScope = scopes[0];
|
|
12591
13448
|
if (scopes.length === 1) return baseScope;
|
|
12592
13449
|
const createScope = () => {
|
|
@@ -12608,13 +13465,34 @@ function composeContextScopes$2(...scopes) {
|
|
|
12608
13465
|
}
|
|
12609
13466
|
function setRef(ref, value) {
|
|
12610
13467
|
if (typeof ref === "function") {
|
|
12611
|
-
ref(value);
|
|
13468
|
+
return ref(value);
|
|
12612
13469
|
} else if (ref !== null && ref !== void 0) {
|
|
12613
13470
|
ref.current = value;
|
|
12614
13471
|
}
|
|
12615
13472
|
}
|
|
12616
13473
|
function composeRefs(...refs) {
|
|
12617
|
-
return (node) =>
|
|
13474
|
+
return (node) => {
|
|
13475
|
+
let hasCleanup = false;
|
|
13476
|
+
const cleanups = refs.map((ref) => {
|
|
13477
|
+
const cleanup = setRef(ref, node);
|
|
13478
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
13479
|
+
hasCleanup = true;
|
|
13480
|
+
}
|
|
13481
|
+
return cleanup;
|
|
13482
|
+
});
|
|
13483
|
+
if (hasCleanup) {
|
|
13484
|
+
return () => {
|
|
13485
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
13486
|
+
const cleanup = cleanups[i];
|
|
13487
|
+
if (typeof cleanup == "function") {
|
|
13488
|
+
cleanup();
|
|
13489
|
+
} else {
|
|
13490
|
+
setRef(refs[i], null);
|
|
13491
|
+
}
|
|
13492
|
+
}
|
|
13493
|
+
};
|
|
13494
|
+
}
|
|
13495
|
+
};
|
|
12618
13496
|
}
|
|
12619
13497
|
function useComposedRefs(...refs) {
|
|
12620
13498
|
return reactExports.useCallback(composeRefs(...refs), refs);
|
|
@@ -12696,7 +13574,7 @@ function getElementRef$1(element) {
|
|
|
12696
13574
|
}
|
|
12697
13575
|
function createCollection(name) {
|
|
12698
13576
|
const PROVIDER_NAME = name + "CollectionProvider";
|
|
12699
|
-
const [createCollectionContext, createCollectionScope2] = createContextScope
|
|
13577
|
+
const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME);
|
|
12700
13578
|
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
12701
13579
|
PROVIDER_NAME,
|
|
12702
13580
|
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
@@ -12754,63 +13632,6 @@ function createCollection(name) {
|
|
|
12754
13632
|
createCollectionScope2
|
|
12755
13633
|
];
|
|
12756
13634
|
}
|
|
12757
|
-
function createContextScope$1(scopeName, createContextScopeDeps = []) {
|
|
12758
|
-
let defaultContexts = [];
|
|
12759
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
12760
|
-
const BaseContext = reactExports.createContext(defaultContext);
|
|
12761
|
-
const index2 = defaultContexts.length;
|
|
12762
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
12763
|
-
function Provider(props) {
|
|
12764
|
-
const { scope, children, ...context } = props;
|
|
12765
|
-
const Context = (scope == null ? void 0 : scope[scopeName][index2]) || BaseContext;
|
|
12766
|
-
const value = reactExports.useMemo(() => context, Object.values(context));
|
|
12767
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value, children });
|
|
12768
|
-
}
|
|
12769
|
-
function useContext2(consumerName, scope) {
|
|
12770
|
-
const Context = (scope == null ? void 0 : scope[scopeName][index2]) || BaseContext;
|
|
12771
|
-
const context = reactExports.useContext(Context);
|
|
12772
|
-
if (context) return context;
|
|
12773
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
12774
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
12775
|
-
}
|
|
12776
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
12777
|
-
return [Provider, useContext2];
|
|
12778
|
-
}
|
|
12779
|
-
const createScope = () => {
|
|
12780
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
12781
|
-
return reactExports.createContext(defaultContext);
|
|
12782
|
-
});
|
|
12783
|
-
return function useScope(scope) {
|
|
12784
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
12785
|
-
return reactExports.useMemo(
|
|
12786
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
12787
|
-
[scope, contexts]
|
|
12788
|
-
);
|
|
12789
|
-
};
|
|
12790
|
-
};
|
|
12791
|
-
createScope.scopeName = scopeName;
|
|
12792
|
-
return [createContext3, composeContextScopes$1(createScope, ...createContextScopeDeps)];
|
|
12793
|
-
}
|
|
12794
|
-
function composeContextScopes$1(...scopes) {
|
|
12795
|
-
const baseScope = scopes[0];
|
|
12796
|
-
if (scopes.length === 1) return baseScope;
|
|
12797
|
-
const createScope = () => {
|
|
12798
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
12799
|
-
useScope: createScope2(),
|
|
12800
|
-
scopeName: createScope2.scopeName
|
|
12801
|
-
}));
|
|
12802
|
-
return function useComposedScopes(overrideScopes) {
|
|
12803
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
12804
|
-
const scopeProps = useScope(overrideScopes);
|
|
12805
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
12806
|
-
return { ...nextScopes2, ...currentScope };
|
|
12807
|
-
}, {});
|
|
12808
|
-
return reactExports.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
12809
|
-
};
|
|
12810
|
-
};
|
|
12811
|
-
createScope.scopeName = baseScope.scopeName;
|
|
12812
|
-
return createScope;
|
|
12813
|
-
}
|
|
12814
13635
|
var useLayoutEffect2 = Boolean(globalThis == null ? void 0 : globalThis.document) ? reactExports.useLayoutEffect : () => {
|
|
12815
13636
|
};
|
|
12816
13637
|
var useReactId = React$1["useId".toString()] || (() => void 0);
|
|
@@ -12818,9 +13639,9 @@ var count$1 = 0;
|
|
|
12818
13639
|
function useId(deterministicId) {
|
|
12819
13640
|
const [id2, setId] = reactExports.useState(useReactId());
|
|
12820
13641
|
useLayoutEffect2(() => {
|
|
12821
|
-
|
|
13642
|
+
setId((reactId) => reactId ?? String(count$1++));
|
|
12822
13643
|
}, [deterministicId]);
|
|
12823
|
-
return
|
|
13644
|
+
return id2 ? `radix-${id2}` : "";
|
|
12824
13645
|
}
|
|
12825
13646
|
var NODES = [
|
|
12826
13647
|
"a",
|
|
@@ -12914,7 +13735,7 @@ var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
|
12914
13735
|
var EVENT_OPTIONS$1 = { bubbles: false, cancelable: true };
|
|
12915
13736
|
var GROUP_NAME$1 = "RovingFocusGroup";
|
|
12916
13737
|
var [Collection$1, useCollection$1, createCollectionScope$1] = createCollection(GROUP_NAME$1);
|
|
12917
|
-
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope
|
|
13738
|
+
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
|
|
12918
13739
|
GROUP_NAME$1,
|
|
12919
13740
|
[createCollectionScope$1]
|
|
12920
13741
|
);
|
|
@@ -13240,7 +14061,7 @@ function getElementRef(element) {
|
|
|
13240
14061
|
return element.props.ref || element.ref;
|
|
13241
14062
|
}
|
|
13242
14063
|
var TABS_NAME = "Tabs";
|
|
13243
|
-
var [createTabsContext, createTabsScope] = createContextScope
|
|
14064
|
+
var [createTabsContext, createTabsScope] = createContextScope(TABS_NAME, [
|
|
13244
14065
|
createRovingFocusGroupScope
|
|
13245
14066
|
]);
|
|
13246
14067
|
var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
@@ -16002,6 +16823,31 @@ const Bell = createLucideIcon("Bell", [
|
|
|
16002
16823
|
["path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9", key: "1qo2s2" }],
|
|
16003
16824
|
["path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0", key: "qgo35s" }]
|
|
16004
16825
|
]);
|
|
16826
|
+
/**
|
|
16827
|
+
* @license lucide-react v0.447.0 - ISC
|
|
16828
|
+
*
|
|
16829
|
+
* This source code is licensed under the ISC license.
|
|
16830
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16831
|
+
*/
|
|
16832
|
+
const Bug = createLucideIcon("Bug", [
|
|
16833
|
+
["path", { d: "m8 2 1.88 1.88", key: "fmnt4t" }],
|
|
16834
|
+
["path", { d: "M14.12 3.88 16 2", key: "qol33r" }],
|
|
16835
|
+
["path", { d: "M9 7.13v-1a3.003 3.003 0 1 1 6 0v1", key: "d7y7pr" }],
|
|
16836
|
+
[
|
|
16837
|
+
"path",
|
|
16838
|
+
{
|
|
16839
|
+
d: "M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",
|
|
16840
|
+
key: "xs1cw7"
|
|
16841
|
+
}
|
|
16842
|
+
],
|
|
16843
|
+
["path", { d: "M12 20v-9", key: "1qisl0" }],
|
|
16844
|
+
["path", { d: "M6.53 9C4.6 8.8 3 7.1 3 5", key: "32zzws" }],
|
|
16845
|
+
["path", { d: "M6 13H2", key: "82j7cp" }],
|
|
16846
|
+
["path", { d: "M3 21c0-2.1 1.7-3.9 3.8-4", key: "4p0ekp" }],
|
|
16847
|
+
["path", { d: "M20.97 5c0 2.1-1.6 3.8-3.5 4", key: "18gb23" }],
|
|
16848
|
+
["path", { d: "M22 13h-4", key: "1jl80f" }],
|
|
16849
|
+
["path", { d: "M17.2 17c2.1.1 3.8 1.9 3.8 4", key: "k3fwyw" }]
|
|
16850
|
+
]);
|
|
16005
16851
|
/**
|
|
16006
16852
|
* @license lucide-react v0.447.0 - ISC
|
|
16007
16853
|
*
|
|
@@ -16031,6 +16877,17 @@ const CircleAlert = createLucideIcon("CircleAlert", [
|
|
|
16031
16877
|
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
16032
16878
|
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
16033
16879
|
]);
|
|
16880
|
+
/**
|
|
16881
|
+
* @license lucide-react v0.447.0 - ISC
|
|
16882
|
+
*
|
|
16883
|
+
* This source code is licensed under the ISC license.
|
|
16884
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16885
|
+
*/
|
|
16886
|
+
const CircleHelp = createLucideIcon("CircleHelp", [
|
|
16887
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
16888
|
+
["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
|
|
16889
|
+
["path", { d: "M12 17h.01", key: "p32p05" }]
|
|
16890
|
+
]);
|
|
16034
16891
|
/**
|
|
16035
16892
|
* @license lucide-react v0.447.0 - ISC
|
|
16036
16893
|
*
|
|
@@ -16041,6 +16898,46 @@ const Copy = createLucideIcon("Copy", [
|
|
|
16041
16898
|
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
16042
16899
|
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
16043
16900
|
]);
|
|
16901
|
+
/**
|
|
16902
|
+
* @license lucide-react v0.447.0 - ISC
|
|
16903
|
+
*
|
|
16904
|
+
* This source code is licensed under the ISC license.
|
|
16905
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16906
|
+
*/
|
|
16907
|
+
const EyeOff = createLucideIcon("EyeOff", [
|
|
16908
|
+
[
|
|
16909
|
+
"path",
|
|
16910
|
+
{
|
|
16911
|
+
d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
|
|
16912
|
+
key: "ct8e1f"
|
|
16913
|
+
}
|
|
16914
|
+
],
|
|
16915
|
+
["path", { d: "M14.084 14.158a3 3 0 0 1-4.242-4.242", key: "151rxh" }],
|
|
16916
|
+
[
|
|
16917
|
+
"path",
|
|
16918
|
+
{
|
|
16919
|
+
d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",
|
|
16920
|
+
key: "13bj9a"
|
|
16921
|
+
}
|
|
16922
|
+
],
|
|
16923
|
+
["path", { d: "m2 2 20 20", key: "1ooewy" }]
|
|
16924
|
+
]);
|
|
16925
|
+
/**
|
|
16926
|
+
* @license lucide-react v0.447.0 - ISC
|
|
16927
|
+
*
|
|
16928
|
+
* This source code is licensed under the ISC license.
|
|
16929
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16930
|
+
*/
|
|
16931
|
+
const Eye = createLucideIcon("Eye", [
|
|
16932
|
+
[
|
|
16933
|
+
"path",
|
|
16934
|
+
{
|
|
16935
|
+
d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
|
|
16936
|
+
key: "1nclc0"
|
|
16937
|
+
}
|
|
16938
|
+
],
|
|
16939
|
+
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
16940
|
+
]);
|
|
16044
16941
|
/**
|
|
16045
16942
|
* @license lucide-react v0.447.0 - ISC
|
|
16046
16943
|
*
|
|
@@ -16089,6 +16986,22 @@ const FolderTree = createLucideIcon("FolderTree", [
|
|
|
16089
16986
|
["path", { d: "M3 5a2 2 0 0 0 2 2h3", key: "f2jnh7" }],
|
|
16090
16987
|
["path", { d: "M3 3v13a2 2 0 0 0 2 2h3", key: "k8epm1" }]
|
|
16091
16988
|
]);
|
|
16989
|
+
/**
|
|
16990
|
+
* @license lucide-react v0.447.0 - ISC
|
|
16991
|
+
*
|
|
16992
|
+
* This source code is licensed under the ISC license.
|
|
16993
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16994
|
+
*/
|
|
16995
|
+
const Github = createLucideIcon("Github", [
|
|
16996
|
+
[
|
|
16997
|
+
"path",
|
|
16998
|
+
{
|
|
16999
|
+
d: "M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",
|
|
17000
|
+
key: "tonef"
|
|
17001
|
+
}
|
|
17002
|
+
],
|
|
17003
|
+
["path", { d: "M9 18c-4.51 2-5-2-7-2", key: "9comsn" }]
|
|
17004
|
+
]);
|
|
16092
17005
|
/**
|
|
16093
17006
|
* @license lucide-react v0.447.0 - ISC
|
|
16094
17007
|
*
|
|
@@ -18287,7 +19200,7 @@ function isTopLayer(element) {
|
|
|
18287
19200
|
function isContainingBlock(elementOrCss) {
|
|
18288
19201
|
const webkit = isWebKit();
|
|
18289
19202
|
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
18290
|
-
return
|
|
19203
|
+
return ["transform", "translate", "scale", "rotate", "perspective"].some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
|
|
18291
19204
|
}
|
|
18292
19205
|
function getContainingBlock(element) {
|
|
18293
19206
|
let currentNode = getParentNode(element);
|
|
@@ -18793,6 +19706,9 @@ const platform = {
|
|
|
18793
19706
|
isElement,
|
|
18794
19707
|
isRTL
|
|
18795
19708
|
};
|
|
19709
|
+
function rectsAreEqual(a, b2) {
|
|
19710
|
+
return a.x === b2.x && a.y === b2.y && a.width === b2.width && a.height === b2.height;
|
|
19711
|
+
}
|
|
18796
19712
|
function observeMove(element, onMove) {
|
|
18797
19713
|
let io = null;
|
|
18798
19714
|
let timeoutId;
|
|
@@ -18811,12 +19727,13 @@ function observeMove(element, onMove) {
|
|
|
18811
19727
|
threshold = 1;
|
|
18812
19728
|
}
|
|
18813
19729
|
cleanup();
|
|
19730
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
18814
19731
|
const {
|
|
18815
19732
|
left,
|
|
18816
19733
|
top,
|
|
18817
19734
|
width,
|
|
18818
19735
|
height
|
|
18819
|
-
} =
|
|
19736
|
+
} = elementRectForRootMargin;
|
|
18820
19737
|
if (!skip) {
|
|
18821
19738
|
onMove();
|
|
18822
19739
|
}
|
|
@@ -18847,6 +19764,9 @@ function observeMove(element, onMove) {
|
|
|
18847
19764
|
refresh(false, ratio);
|
|
18848
19765
|
}
|
|
18849
19766
|
}
|
|
19767
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
19768
|
+
refresh();
|
|
19769
|
+
}
|
|
18850
19770
|
isFirstUpdate = false;
|
|
18851
19771
|
}
|
|
18852
19772
|
try {
|
|
@@ -18910,7 +19830,7 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
18910
19830
|
}
|
|
18911
19831
|
function frameLoop() {
|
|
18912
19832
|
const nextRefRect = getBoundingClientRect(reference);
|
|
18913
|
-
if (prevRefRect && (
|
|
19833
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
18914
19834
|
update();
|
|
18915
19835
|
}
|
|
18916
19836
|
prevRefRect = nextRefRect;
|
|
@@ -19247,63 +20167,6 @@ var Arrow$1 = reactExports.forwardRef((props, forwardedRef) => {
|
|
|
19247
20167
|
});
|
|
19248
20168
|
Arrow$1.displayName = NAME$1;
|
|
19249
20169
|
var Root = Arrow$1;
|
|
19250
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
19251
|
-
let defaultContexts = [];
|
|
19252
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
19253
|
-
const BaseContext = reactExports.createContext(defaultContext);
|
|
19254
|
-
const index2 = defaultContexts.length;
|
|
19255
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
19256
|
-
function Provider(props) {
|
|
19257
|
-
const { scope, children, ...context } = props;
|
|
19258
|
-
const Context = (scope == null ? void 0 : scope[scopeName][index2]) || BaseContext;
|
|
19259
|
-
const value = reactExports.useMemo(() => context, Object.values(context));
|
|
19260
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value, children });
|
|
19261
|
-
}
|
|
19262
|
-
function useContext2(consumerName, scope) {
|
|
19263
|
-
const Context = (scope == null ? void 0 : scope[scopeName][index2]) || BaseContext;
|
|
19264
|
-
const context = reactExports.useContext(Context);
|
|
19265
|
-
if (context) return context;
|
|
19266
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
19267
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
19268
|
-
}
|
|
19269
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
19270
|
-
return [Provider, useContext2];
|
|
19271
|
-
}
|
|
19272
|
-
const createScope = () => {
|
|
19273
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
19274
|
-
return reactExports.createContext(defaultContext);
|
|
19275
|
-
});
|
|
19276
|
-
return function useScope(scope) {
|
|
19277
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
19278
|
-
return reactExports.useMemo(
|
|
19279
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
19280
|
-
[scope, contexts]
|
|
19281
|
-
);
|
|
19282
|
-
};
|
|
19283
|
-
};
|
|
19284
|
-
createScope.scopeName = scopeName;
|
|
19285
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
19286
|
-
}
|
|
19287
|
-
function composeContextScopes(...scopes) {
|
|
19288
|
-
const baseScope = scopes[0];
|
|
19289
|
-
if (scopes.length === 1) return baseScope;
|
|
19290
|
-
const createScope = () => {
|
|
19291
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
19292
|
-
useScope: createScope2(),
|
|
19293
|
-
scopeName: createScope2.scopeName
|
|
19294
|
-
}));
|
|
19295
|
-
return function useComposedScopes(overrideScopes) {
|
|
19296
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
19297
|
-
const scopeProps = useScope(overrideScopes);
|
|
19298
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
19299
|
-
return { ...nextScopes2, ...currentScope };
|
|
19300
|
-
}, {});
|
|
19301
|
-
return reactExports.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
19302
|
-
};
|
|
19303
|
-
};
|
|
19304
|
-
createScope.scopeName = baseScope.scopeName;
|
|
19305
|
-
return createScope;
|
|
19306
|
-
}
|
|
19307
20170
|
function useSize(element) {
|
|
19308
20171
|
const [size2, setSize] = reactExports.useState(void 0);
|
|
19309
20172
|
useLayoutEffect2(() => {
|
|
@@ -19633,7 +20496,7 @@ var VisuallyHidden = reactExports.forwardRef(
|
|
|
19633
20496
|
...props,
|
|
19634
20497
|
ref: forwardedRef,
|
|
19635
20498
|
style: {
|
|
19636
|
-
// See: https://github.com/twbs/bootstrap/blob/
|
|
20499
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
19637
20500
|
position: "absolute",
|
|
19638
20501
|
border: 0,
|
|
19639
20502
|
width: 1,
|
|
@@ -20249,9 +21112,9 @@ var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
|
20249
21112
|
!targetInLock && target !== document.body || // self content
|
|
20250
21113
|
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
20251
21114
|
);
|
|
20252
|
-
if (isDeltaPositive && (Math.abs(availableScroll) < 1 ||
|
|
21115
|
+
if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
|
|
20253
21116
|
shouldCancelScroll = true;
|
|
20254
|
-
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 ||
|
|
21117
|
+
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
|
|
20255
21118
|
shouldCancelScroll = true;
|
|
20256
21119
|
}
|
|
20257
21120
|
return shouldCancelScroll;
|
|
@@ -20333,7 +21196,7 @@ function RemoveScrollSideCar(props) {
|
|
|
20333
21196
|
return true;
|
|
20334
21197
|
}
|
|
20335
21198
|
var cancelingAxis = activeAxis.current || currentAxis;
|
|
20336
|
-
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY
|
|
21199
|
+
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY);
|
|
20337
21200
|
}, []);
|
|
20338
21201
|
var shouldPrevent = reactExports.useCallback(function(_event) {
|
|
20339
21202
|
var event = _event;
|
|
@@ -20428,7 +21291,7 @@ var OPEN_KEYS = [" ", "Enter", "ArrowUp", "ArrowDown"];
|
|
|
20428
21291
|
var SELECTION_KEYS = [" ", "Enter"];
|
|
20429
21292
|
var SELECT_NAME = "Select";
|
|
20430
21293
|
var [Collection, useCollection, createCollectionScope] = createCollection(SELECT_NAME);
|
|
20431
|
-
var [createSelectContext, createSelectScope] = createContextScope
|
|
21294
|
+
var [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME, [
|
|
20432
21295
|
createCollectionScope,
|
|
20433
21296
|
createPopperScope
|
|
20434
21297
|
]);
|
|
@@ -21697,7 +22560,7 @@ const useTheme = () => {
|
|
|
21697
22560
|
}, [])
|
|
21698
22561
|
];
|
|
21699
22562
|
};
|
|
21700
|
-
const version = "0.
|
|
22563
|
+
const version = "0.4.0";
|
|
21701
22564
|
const Sidebar = ({
|
|
21702
22565
|
connectionStatus,
|
|
21703
22566
|
transportType,
|
|
@@ -21715,6 +22578,7 @@ const Sidebar = ({
|
|
|
21715
22578
|
}) => {
|
|
21716
22579
|
const [theme, setTheme] = useTheme();
|
|
21717
22580
|
const [showEnvVars, setShowEnvVars] = reactExports.useState(false);
|
|
22581
|
+
const [shownEnvVars, setShownEnvVars] = reactExports.useState(/* @__PURE__ */ new Set());
|
|
21718
22582
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-80 bg-card border-r border-border flex flex-col h-full", children: [
|
|
21719
22583
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("h1", { className: "ml-2 text-lg font-semibold", children: [
|
|
21720
22584
|
"MCP Inspector v",
|
|
@@ -21746,7 +22610,8 @@ const Sidebar = ({
|
|
|
21746
22610
|
{
|
|
21747
22611
|
placeholder: "Command",
|
|
21748
22612
|
value: command,
|
|
21749
|
-
onChange: (e) => setCommand(e.target.value)
|
|
22613
|
+
onChange: (e) => setCommand(e.target.value),
|
|
22614
|
+
className: "font-mono"
|
|
21750
22615
|
}
|
|
21751
22616
|
)
|
|
21752
22617
|
] }),
|
|
@@ -21757,7 +22622,8 @@ const Sidebar = ({
|
|
|
21757
22622
|
{
|
|
21758
22623
|
placeholder: "Arguments (space-separated)",
|
|
21759
22624
|
value: args,
|
|
21760
|
-
onChange: (e) => setArgs(e.target.value)
|
|
22625
|
+
onChange: (e) => setArgs(e.target.value),
|
|
22626
|
+
className: "font-mono"
|
|
21761
22627
|
}
|
|
21762
22628
|
)
|
|
21763
22629
|
] })
|
|
@@ -21768,7 +22634,8 @@ const Sidebar = ({
|
|
|
21768
22634
|
{
|
|
21769
22635
|
placeholder: "URL",
|
|
21770
22636
|
value: sseUrl,
|
|
21771
|
-
onChange: (e) => setSseUrl(e.target.value)
|
|
22637
|
+
onChange: (e) => setSseUrl(e.target.value),
|
|
22638
|
+
className: "font-mono"
|
|
21772
22639
|
}
|
|
21773
22640
|
)
|
|
21774
22641
|
] }),
|
|
@@ -21786,53 +22653,94 @@ const Sidebar = ({
|
|
|
21786
22653
|
}
|
|
21787
22654
|
),
|
|
21788
22655
|
showEnvVars && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
21789
|
-
Object.entries(env).map(([key, value], idx) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "
|
|
21790
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "
|
|
22656
|
+
Object.entries(env).map(([key, value], idx) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2 pb-4", children: [
|
|
22657
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
|
|
21791
22658
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
21792
22659
|
Input,
|
|
21793
22660
|
{
|
|
21794
22661
|
placeholder: "Key",
|
|
21795
22662
|
value: key,
|
|
21796
22663
|
onChange: (e) => {
|
|
22664
|
+
const newKey = e.target.value;
|
|
21797
22665
|
const newEnv = { ...env };
|
|
21798
22666
|
delete newEnv[key];
|
|
21799
|
-
newEnv[
|
|
22667
|
+
newEnv[newKey] = value;
|
|
21800
22668
|
setEnv(newEnv);
|
|
21801
|
-
|
|
22669
|
+
setShownEnvVars((prev) => {
|
|
22670
|
+
const next = new Set(prev);
|
|
22671
|
+
if (next.has(key)) {
|
|
22672
|
+
next.delete(key);
|
|
22673
|
+
next.add(newKey);
|
|
22674
|
+
}
|
|
22675
|
+
return next;
|
|
22676
|
+
});
|
|
22677
|
+
},
|
|
22678
|
+
className: "font-mono"
|
|
21802
22679
|
}
|
|
21803
22680
|
),
|
|
22681
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22682
|
+
Button,
|
|
22683
|
+
{
|
|
22684
|
+
variant: "destructive",
|
|
22685
|
+
size: "icon",
|
|
22686
|
+
className: "h-9 w-9 p-0 shrink-0",
|
|
22687
|
+
onClick: () => {
|
|
22688
|
+
const { [key]: _removed, ...rest } = env;
|
|
22689
|
+
setEnv(rest);
|
|
22690
|
+
},
|
|
22691
|
+
children: "×"
|
|
22692
|
+
}
|
|
22693
|
+
)
|
|
22694
|
+
] }),
|
|
22695
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
|
|
21804
22696
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
21805
22697
|
Input,
|
|
21806
22698
|
{
|
|
22699
|
+
type: shownEnvVars.has(key) ? "text" : "password",
|
|
21807
22700
|
placeholder: "Value",
|
|
21808
22701
|
value,
|
|
21809
22702
|
onChange: (e) => {
|
|
21810
22703
|
const newEnv = { ...env };
|
|
21811
22704
|
newEnv[key] = e.target.value;
|
|
21812
22705
|
setEnv(newEnv);
|
|
21813
|
-
}
|
|
22706
|
+
},
|
|
22707
|
+
className: "font-mono"
|
|
22708
|
+
}
|
|
22709
|
+
),
|
|
22710
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22711
|
+
Button,
|
|
22712
|
+
{
|
|
22713
|
+
variant: "outline",
|
|
22714
|
+
size: "icon",
|
|
22715
|
+
className: "h-9 w-9 p-0 shrink-0",
|
|
22716
|
+
onClick: () => {
|
|
22717
|
+
setShownEnvVars((prev) => {
|
|
22718
|
+
const next = new Set(prev);
|
|
22719
|
+
if (next.has(key)) {
|
|
22720
|
+
next.delete(key);
|
|
22721
|
+
} else {
|
|
22722
|
+
next.add(key);
|
|
22723
|
+
}
|
|
22724
|
+
return next;
|
|
22725
|
+
});
|
|
22726
|
+
},
|
|
22727
|
+
"aria-label": shownEnvVars.has(key) ? "Hide value" : "Show value",
|
|
22728
|
+
"aria-pressed": shownEnvVars.has(key),
|
|
22729
|
+
title: shownEnvVars.has(key) ? "Hide value" : "Show value",
|
|
22730
|
+
children: shownEnvVars.has(key) ? /* @__PURE__ */ jsxRuntimeExports.jsx(Eye, { className: "h-4 w-4", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(EyeOff, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
21814
22731
|
}
|
|
21815
22732
|
)
|
|
21816
|
-
] })
|
|
21817
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
21818
|
-
Button,
|
|
21819
|
-
{
|
|
21820
|
-
variant: "destructive",
|
|
21821
|
-
onClick: () => {
|
|
21822
|
-
const { [key]: removed, ...rest } = env;
|
|
21823
|
-
setEnv(rest);
|
|
21824
|
-
},
|
|
21825
|
-
children: "Remove"
|
|
21826
|
-
}
|
|
21827
|
-
)
|
|
22733
|
+
] })
|
|
21828
22734
|
] }, idx)),
|
|
21829
22735
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
21830
22736
|
Button,
|
|
21831
22737
|
{
|
|
21832
22738
|
variant: "outline",
|
|
22739
|
+
className: "w-full mt-2",
|
|
21833
22740
|
onClick: () => {
|
|
22741
|
+
const key = "";
|
|
21834
22742
|
const newEnv = { ...env };
|
|
21835
|
-
newEnv[
|
|
22743
|
+
newEnv[key] = "";
|
|
21836
22744
|
setEnv(newEnv);
|
|
21837
22745
|
},
|
|
21838
22746
|
children: "Add Environment Variable"
|
|
@@ -21867,21 +22775,59 @@ const Sidebar = ({
|
|
|
21867
22775
|
] }) })
|
|
21868
22776
|
] })
|
|
21869
22777
|
] }) }),
|
|
21870
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 border-t", children: /* @__PURE__ */ jsxRuntimeExports.
|
|
21871
|
-
|
|
21872
|
-
|
|
21873
|
-
|
|
21874
|
-
|
|
21875
|
-
|
|
21876
|
-
|
|
21877
|
-
|
|
21878
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
21879
|
-
|
|
21880
|
-
|
|
21881
|
-
|
|
21882
|
-
|
|
21883
|
-
|
|
21884
|
-
|
|
22778
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 border-t", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
22779
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
22780
|
+
Select,
|
|
22781
|
+
{
|
|
22782
|
+
value: theme,
|
|
22783
|
+
onValueChange: (value) => setTheme(value),
|
|
22784
|
+
children: [
|
|
22785
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-[100px]", id: "theme-select", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, {}) }),
|
|
22786
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
|
|
22787
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "system", children: "System" }),
|
|
22788
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "light", children: "Light" }),
|
|
22789
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "dark", children: "Dark" })
|
|
22790
|
+
] })
|
|
22791
|
+
]
|
|
22792
|
+
}
|
|
22793
|
+
),
|
|
22794
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
22795
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22796
|
+
"a",
|
|
22797
|
+
{
|
|
22798
|
+
href: "https://modelcontextprotocol.io/docs/tools/inspector",
|
|
22799
|
+
target: "_blank",
|
|
22800
|
+
rel: "noopener noreferrer",
|
|
22801
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", title: "Inspector Documentation", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CircleHelp, { className: "w-4 h-4 text-gray-800" }) })
|
|
22802
|
+
}
|
|
22803
|
+
),
|
|
22804
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22805
|
+
"a",
|
|
22806
|
+
{
|
|
22807
|
+
href: "https://modelcontextprotocol.io/docs/tools/debugging",
|
|
22808
|
+
target: "_blank",
|
|
22809
|
+
rel: "noopener noreferrer",
|
|
22810
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", title: "Debugging Guide", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Bug, { className: "w-4 h-4 text-gray-800" }) })
|
|
22811
|
+
}
|
|
22812
|
+
),
|
|
22813
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22814
|
+
"a",
|
|
22815
|
+
{
|
|
22816
|
+
href: "https://github.com/modelcontextprotocol/inspector",
|
|
22817
|
+
target: "_blank",
|
|
22818
|
+
rel: "noopener noreferrer",
|
|
22819
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22820
|
+
Button,
|
|
22821
|
+
{
|
|
22822
|
+
variant: "ghost",
|
|
22823
|
+
title: "Report bugs or contribute on GitHub",
|
|
22824
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Github, { className: "w-4 h-4 text-gray-800" })
|
|
22825
|
+
}
|
|
22826
|
+
)
|
|
22827
|
+
}
|
|
22828
|
+
)
|
|
22829
|
+
] })
|
|
22830
|
+
] }) })
|
|
21885
22831
|
] });
|
|
21886
22832
|
};
|
|
21887
22833
|
const ToolsTab = ({
|
|
@@ -21896,6 +22842,9 @@ const ToolsTab = ({
|
|
|
21896
22842
|
error
|
|
21897
22843
|
}) => {
|
|
21898
22844
|
const [params2, setParams] = reactExports.useState({});
|
|
22845
|
+
reactExports.useEffect(() => {
|
|
22846
|
+
setParams({});
|
|
22847
|
+
}, [selectedTool]);
|
|
21899
22848
|
const renderToolResult = () => {
|
|
21900
22849
|
if (!toolResult) return null;
|
|
21901
22850
|
if ("content" in toolResult) {
|
|
@@ -21922,23 +22871,34 @@ const ToolsTab = ({
|
|
|
21922
22871
|
"Tool Result: ",
|
|
21923
22872
|
isError ? "Error" : "Success"
|
|
21924
22873
|
] }),
|
|
21925
|
-
structuredResult.content.map((item, index2) =>
|
|
21926
|
-
|
|
21927
|
-
|
|
21928
|
-
"
|
|
21929
|
-
|
|
21930
|
-
|
|
21931
|
-
|
|
21932
|
-
|
|
21933
|
-
|
|
21934
|
-
|
|
21935
|
-
|
|
21936
|
-
|
|
22874
|
+
structuredResult.content.map((item, index2) => {
|
|
22875
|
+
var _a, _b;
|
|
22876
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2", children: [
|
|
22877
|
+
item.type === "text" && /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "bg-gray-50 dark:bg-gray-800 dark:text-gray-100 p-4 rounded text-sm overflow-auto max-h-64", children: item.text }),
|
|
22878
|
+
item.type === "image" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22879
|
+
"img",
|
|
22880
|
+
{
|
|
22881
|
+
src: `data:${item.mimeType};base64,${item.data}`,
|
|
22882
|
+
alt: "Tool result image",
|
|
22883
|
+
className: "max-w-full h-auto"
|
|
22884
|
+
}
|
|
22885
|
+
),
|
|
22886
|
+
item.type === "resource" && (((_b = (_a = item.resource) == null ? void 0 : _a.mimeType) == null ? void 0 : _b.startsWith("audio/")) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22887
|
+
"audio",
|
|
22888
|
+
{
|
|
22889
|
+
controls: true,
|
|
22890
|
+
src: `data:${item.resource.mimeType};base64,${item.resource.blob}`,
|
|
22891
|
+
className: "w-full",
|
|
22892
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Your browser does not support audio playback" })
|
|
22893
|
+
}
|
|
22894
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "bg-gray-50 dark:bg-gray-800 dark:text-gray-100 whitespace-pre-wrap break-words p-4 rounded text-sm overflow-auto max-h-64", children: JSON.stringify(item.resource, null, 2) }))
|
|
22895
|
+
] }, index2);
|
|
22896
|
+
})
|
|
21937
22897
|
] });
|
|
21938
22898
|
} else if ("toolResult" in toolResult) {
|
|
21939
22899
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
21940
22900
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "font-semibold mb-2", children: "Tool Result (Legacy):" }),
|
|
21941
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "bg-gray-50 p-4 rounded text-sm overflow-auto max-h-64", children: JSON.stringify(toolResult.toolResult, null, 2) })
|
|
22901
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "bg-gray-50 dark:bg-gray-800 dark:text-gray-100 p-4 rounded text-sm overflow-auto max-h-64", children: JSON.stringify(toolResult.toolResult, null, 2) })
|
|
21942
22902
|
] });
|
|
21943
22903
|
}
|
|
21944
22904
|
};
|
|
@@ -21948,7 +22908,10 @@ const ToolsTab = ({
|
|
|
21948
22908
|
{
|
|
21949
22909
|
items: tools,
|
|
21950
22910
|
listItems: listTools,
|
|
21951
|
-
clearItems:
|
|
22911
|
+
clearItems: () => {
|
|
22912
|
+
clearTools();
|
|
22913
|
+
setSelectedTool(null);
|
|
22914
|
+
},
|
|
21952
22915
|
setSelectedItem: setSelectedTool,
|
|
21953
22916
|
renderItem: (tool) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
21954
22917
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex-1", children: tool.name }),
|
|
@@ -21990,22 +22953,47 @@ const ToolsTab = ({
|
|
|
21990
22953
|
}),
|
|
21991
22954
|
className: "mt-1"
|
|
21992
22955
|
}
|
|
21993
|
-
) :
|
|
21994
|
-
|
|
21995
|
-
|
|
21996
|
-
|
|
21997
|
-
|
|
21998
|
-
|
|
21999
|
-
|
|
22000
|
-
|
|
22001
|
-
|
|
22002
|
-
|
|
22003
|
-
|
|
22004
|
-
|
|
22005
|
-
|
|
22006
|
-
|
|
22007
|
-
|
|
22008
|
-
|
|
22956
|
+
) : (
|
|
22957
|
+
/* @ts-expect-error value type is currently unknown */
|
|
22958
|
+
value.type === "object" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22959
|
+
Textarea,
|
|
22960
|
+
{
|
|
22961
|
+
id: key,
|
|
22962
|
+
name: key,
|
|
22963
|
+
placeholder: value.description,
|
|
22964
|
+
onChange: (e) => {
|
|
22965
|
+
try {
|
|
22966
|
+
const parsed = JSON.parse(e.target.value);
|
|
22967
|
+
setParams({
|
|
22968
|
+
...params2,
|
|
22969
|
+
[key]: parsed
|
|
22970
|
+
});
|
|
22971
|
+
} catch (err) {
|
|
22972
|
+
setParams({
|
|
22973
|
+
...params2,
|
|
22974
|
+
[key]: e.target.value
|
|
22975
|
+
});
|
|
22976
|
+
}
|
|
22977
|
+
},
|
|
22978
|
+
className: "mt-1"
|
|
22979
|
+
}
|
|
22980
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22981
|
+
Input,
|
|
22982
|
+
{
|
|
22983
|
+
type: value.type === "number" ? "number" : "text",
|
|
22984
|
+
id: key,
|
|
22985
|
+
name: key,
|
|
22986
|
+
placeholder: value.description,
|
|
22987
|
+
onChange: (e) => setParams({
|
|
22988
|
+
...params2,
|
|
22989
|
+
[key]: (
|
|
22990
|
+
// @ts-expect-error value type is currently unknown
|
|
22991
|
+
value.type === "number" ? Number(e.target.value) : e.target.value
|
|
22992
|
+
)
|
|
22993
|
+
}),
|
|
22994
|
+
className: "mt-1"
|
|
22995
|
+
}
|
|
22996
|
+
)
|
|
22009
22997
|
)
|
|
22010
22998
|
] }, key)
|
|
22011
22999
|
),
|
|
@@ -22018,13 +23006,16 @@ const ToolsTab = ({
|
|
|
22018
23006
|
] })
|
|
22019
23007
|
] });
|
|
22020
23008
|
};
|
|
22021
|
-
const DEFAULT_REQUEST_TIMEOUT_MSEC = 1e4;
|
|
22022
23009
|
const params = new URLSearchParams(window.location.search);
|
|
22023
23010
|
const PROXY_PORT = params.get("proxyPort") ?? "3000";
|
|
22024
|
-
const REQUEST_TIMEOUT = parseInt(params.get("timeout") ?? "") || DEFAULT_REQUEST_TIMEOUT_MSEC;
|
|
22025
23011
|
const PROXY_SERVER_URL = `http://localhost:${PROXY_PORT}`;
|
|
22026
23012
|
const App = () => {
|
|
22027
|
-
|
|
23013
|
+
if (window.location.pathname === "/oauth/callback") {
|
|
23014
|
+
const OAuthCallback = React.lazy(
|
|
23015
|
+
() => __vitePreload(() => import("./OAuthCallback-HUNd2OJn.js"), true ? [] : void 0)
|
|
23016
|
+
);
|
|
23017
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(OAuthCallback, {}) });
|
|
23018
|
+
}
|
|
22028
23019
|
const [resources, setResources] = reactExports.useState([]);
|
|
22029
23020
|
const [resourceTemplates, setResourceTemplates] = reactExports.useState([]);
|
|
22030
23021
|
const [resourceContent, setResourceContent] = reactExports.useState("");
|
|
@@ -22043,10 +23034,12 @@ const App = () => {
|
|
|
22043
23034
|
const [args, setArgs] = reactExports.useState(() => {
|
|
22044
23035
|
return localStorage.getItem("lastArgs") || "";
|
|
22045
23036
|
});
|
|
22046
|
-
const [sseUrl, setSseUrl] = reactExports.useState(
|
|
22047
|
-
|
|
22048
|
-
|
|
22049
|
-
const [
|
|
23037
|
+
const [sseUrl, setSseUrl] = reactExports.useState(() => {
|
|
23038
|
+
return localStorage.getItem("lastSseUrl") || "http://localhost:3001/sse";
|
|
23039
|
+
});
|
|
23040
|
+
const [transportType, setTransportType] = reactExports.useState(() => {
|
|
23041
|
+
return localStorage.getItem("lastTransportType") || "stdio";
|
|
23042
|
+
});
|
|
22050
23043
|
const [notifications, setNotifications] = reactExports.useState([]);
|
|
22051
23044
|
const [stdErrNotifications, setStdErrNotifications] = reactExports.useState([]);
|
|
22052
23045
|
const [roots, setRoots] = reactExports.useState([]);
|
|
@@ -22078,51 +23071,81 @@ const App = () => {
|
|
|
22078
23071
|
const [nextPromptCursor, setNextPromptCursor] = reactExports.useState();
|
|
22079
23072
|
const [nextToolCursor, setNextToolCursor] = reactExports.useState();
|
|
22080
23073
|
const progressTokenRef = reactExports.useRef(0);
|
|
22081
|
-
const
|
|
22082
|
-
const
|
|
22083
|
-
|
|
22084
|
-
|
|
22085
|
-
|
|
22086
|
-
|
|
22087
|
-
|
|
22088
|
-
|
|
22089
|
-
|
|
22090
|
-
|
|
23074
|
+
const { height: historyPaneHeight, handleDragStart } = useDraggablePane(300);
|
|
23075
|
+
const {
|
|
23076
|
+
connectionStatus,
|
|
23077
|
+
serverCapabilities,
|
|
23078
|
+
mcpClient,
|
|
23079
|
+
requestHistory,
|
|
23080
|
+
makeRequest: makeConnectionRequest,
|
|
23081
|
+
sendNotification,
|
|
23082
|
+
connect: connectMcpServer
|
|
23083
|
+
} = useConnection({
|
|
23084
|
+
transportType,
|
|
23085
|
+
command,
|
|
23086
|
+
args,
|
|
23087
|
+
sseUrl,
|
|
23088
|
+
env,
|
|
23089
|
+
proxyServerUrl: PROXY_SERVER_URL,
|
|
23090
|
+
onNotification: (notification) => {
|
|
23091
|
+
setNotifications((prev) => [...prev, notification]);
|
|
22091
23092
|
},
|
|
22092
|
-
|
|
22093
|
-
|
|
22094
|
-
|
|
22095
|
-
|
|
22096
|
-
|
|
22097
|
-
const deltaY = dragStartY.current - e.clientY;
|
|
22098
|
-
const newHeight = Math.max(
|
|
22099
|
-
100,
|
|
22100
|
-
Math.min(800, dragStartHeight.current + deltaY)
|
|
22101
|
-
);
|
|
22102
|
-
setHistoryPaneHeight(newHeight);
|
|
23093
|
+
onStdErrNotification: (notification) => {
|
|
23094
|
+
setStdErrNotifications((prev) => [
|
|
23095
|
+
...prev,
|
|
23096
|
+
notification
|
|
23097
|
+
]);
|
|
22103
23098
|
},
|
|
22104
|
-
|
|
22105
|
-
|
|
22106
|
-
|
|
22107
|
-
|
|
22108
|
-
|
|
22109
|
-
|
|
22110
|
-
|
|
22111
|
-
|
|
22112
|
-
|
|
22113
|
-
|
|
22114
|
-
|
|
22115
|
-
|
|
22116
|
-
|
|
22117
|
-
}
|
|
23099
|
+
onPendingRequest: (request, resolve, reject) => {
|
|
23100
|
+
setPendingSampleRequests((prev) => [
|
|
23101
|
+
...prev,
|
|
23102
|
+
{ id: nextRequestId.current++, request, resolve, reject }
|
|
23103
|
+
]);
|
|
23104
|
+
},
|
|
23105
|
+
getRoots: () => rootsRef.current
|
|
23106
|
+
});
|
|
23107
|
+
const makeRequest = async (request, schema, tabKey) => {
|
|
23108
|
+
try {
|
|
23109
|
+
const response = await makeConnectionRequest(request, schema);
|
|
23110
|
+
if (tabKey !== void 0) {
|
|
23111
|
+
clearError(tabKey);
|
|
23112
|
+
}
|
|
23113
|
+
return response;
|
|
23114
|
+
} catch (e) {
|
|
23115
|
+
const errorString = e.message ?? String(e);
|
|
23116
|
+
if (tabKey !== void 0) {
|
|
23117
|
+
setErrors((prev) => ({
|
|
23118
|
+
...prev,
|
|
23119
|
+
[tabKey]: errorString
|
|
23120
|
+
}));
|
|
23121
|
+
}
|
|
23122
|
+
throw e;
|
|
22118
23123
|
}
|
|
22119
|
-
}
|
|
23124
|
+
};
|
|
22120
23125
|
reactExports.useEffect(() => {
|
|
22121
23126
|
localStorage.setItem("lastCommand", command);
|
|
22122
23127
|
}, [command]);
|
|
22123
23128
|
reactExports.useEffect(() => {
|
|
22124
23129
|
localStorage.setItem("lastArgs", args);
|
|
22125
23130
|
}, [args]);
|
|
23131
|
+
reactExports.useEffect(() => {
|
|
23132
|
+
localStorage.setItem("lastSseUrl", sseUrl);
|
|
23133
|
+
}, [sseUrl]);
|
|
23134
|
+
reactExports.useEffect(() => {
|
|
23135
|
+
localStorage.setItem("lastTransportType", transportType);
|
|
23136
|
+
}, [transportType]);
|
|
23137
|
+
reactExports.useEffect(() => {
|
|
23138
|
+
const serverUrl = params.get("serverUrl");
|
|
23139
|
+
if (serverUrl) {
|
|
23140
|
+
setSseUrl(serverUrl);
|
|
23141
|
+
setTransportType("sse");
|
|
23142
|
+
const newUrl = new URL(window.location.href);
|
|
23143
|
+
newUrl.searchParams.delete("serverUrl");
|
|
23144
|
+
window.history.replaceState({}, "", newUrl.toString());
|
|
23145
|
+
B.success("Successfully authenticated with OAuth");
|
|
23146
|
+
connectMcpServer();
|
|
23147
|
+
}
|
|
23148
|
+
}, []);
|
|
22126
23149
|
reactExports.useEffect(() => {
|
|
22127
23150
|
fetch(`${PROXY_SERVER_URL}/config`).then((response) => response.json()).then((data) => {
|
|
22128
23151
|
setEnv(data.defaultEnvironment);
|
|
@@ -22139,65 +23162,14 @@ const App = () => {
|
|
|
22139
23162
|
reactExports.useEffect(() => {
|
|
22140
23163
|
rootsRef.current = roots;
|
|
22141
23164
|
}, [roots]);
|
|
22142
|
-
|
|
22143
|
-
|
|
22144
|
-
|
|
22145
|
-
|
|
22146
|
-
|
|
22147
|
-
response: response !== void 0 ? JSON.stringify(response) : void 0
|
|
22148
|
-
}
|
|
22149
|
-
]);
|
|
22150
|
-
};
|
|
23165
|
+
reactExports.useEffect(() => {
|
|
23166
|
+
if (!window.location.hash) {
|
|
23167
|
+
window.location.hash = "resources";
|
|
23168
|
+
}
|
|
23169
|
+
}, []);
|
|
22151
23170
|
const clearError = (tabKey) => {
|
|
22152
23171
|
setErrors((prev) => ({ ...prev, [tabKey]: null }));
|
|
22153
23172
|
};
|
|
22154
|
-
const makeRequest = async (request, schema, tabKey) => {
|
|
22155
|
-
if (!mcpClient) {
|
|
22156
|
-
throw new Error("MCP client not connected");
|
|
22157
|
-
}
|
|
22158
|
-
try {
|
|
22159
|
-
const abortController = new AbortController();
|
|
22160
|
-
const timeoutId = setTimeout(() => {
|
|
22161
|
-
abortController.abort("Request timed out");
|
|
22162
|
-
}, REQUEST_TIMEOUT);
|
|
22163
|
-
let response;
|
|
22164
|
-
try {
|
|
22165
|
-
response = await mcpClient.request(request, schema, {
|
|
22166
|
-
signal: abortController.signal
|
|
22167
|
-
});
|
|
22168
|
-
} finally {
|
|
22169
|
-
clearTimeout(timeoutId);
|
|
22170
|
-
}
|
|
22171
|
-
pushHistory(request, response);
|
|
22172
|
-
if (tabKey !== void 0) {
|
|
22173
|
-
clearError(tabKey);
|
|
22174
|
-
}
|
|
22175
|
-
return response;
|
|
22176
|
-
} catch (e) {
|
|
22177
|
-
const errorString = e.message ?? String(e);
|
|
22178
|
-
if (tabKey === void 0) {
|
|
22179
|
-
B.error(errorString);
|
|
22180
|
-
} else {
|
|
22181
|
-
setErrors((prev) => ({
|
|
22182
|
-
...prev,
|
|
22183
|
-
[tabKey]: errorString
|
|
22184
|
-
}));
|
|
22185
|
-
}
|
|
22186
|
-
throw e;
|
|
22187
|
-
}
|
|
22188
|
-
};
|
|
22189
|
-
const sendNotification = async (notification) => {
|
|
22190
|
-
if (!mcpClient) {
|
|
22191
|
-
throw new Error("MCP client not connected");
|
|
22192
|
-
}
|
|
22193
|
-
try {
|
|
22194
|
-
await mcpClient.notification(notification);
|
|
22195
|
-
pushHistory(notification);
|
|
22196
|
-
} catch (e) {
|
|
22197
|
-
B.error(e.message ?? String(e));
|
|
22198
|
-
throw e;
|
|
22199
|
-
}
|
|
22200
|
-
};
|
|
22201
23173
|
const listResources = async () => {
|
|
22202
23174
|
const response = await makeRequest(
|
|
22203
23175
|
{
|
|
@@ -22290,70 +23262,6 @@ const App = () => {
|
|
|
22290
23262
|
const handleRootsChange = async () => {
|
|
22291
23263
|
await sendNotification({ method: "notifications/roots/list_changed" });
|
|
22292
23264
|
};
|
|
22293
|
-
const connectMcpServer = async () => {
|
|
22294
|
-
try {
|
|
22295
|
-
const client = new Client(
|
|
22296
|
-
{
|
|
22297
|
-
name: "mcp-inspector",
|
|
22298
|
-
version: "0.0.1"
|
|
22299
|
-
},
|
|
22300
|
-
{
|
|
22301
|
-
capabilities: {
|
|
22302
|
-
// Support all client capabilities since we're an inspector tool
|
|
22303
|
-
sampling: {},
|
|
22304
|
-
roots: {
|
|
22305
|
-
listChanged: true
|
|
22306
|
-
}
|
|
22307
|
-
}
|
|
22308
|
-
}
|
|
22309
|
-
);
|
|
22310
|
-
const backendUrl = new URL(`${PROXY_SERVER_URL}/sse`);
|
|
22311
|
-
backendUrl.searchParams.append("transportType", transportType);
|
|
22312
|
-
if (transportType === "stdio") {
|
|
22313
|
-
backendUrl.searchParams.append("command", command);
|
|
22314
|
-
backendUrl.searchParams.append("args", args);
|
|
22315
|
-
backendUrl.searchParams.append("env", JSON.stringify(env));
|
|
22316
|
-
} else {
|
|
22317
|
-
backendUrl.searchParams.append("url", sseUrl);
|
|
22318
|
-
}
|
|
22319
|
-
const clientTransport = new SSEClientTransport(backendUrl);
|
|
22320
|
-
client.setNotificationHandler(
|
|
22321
|
-
ProgressNotificationSchema,
|
|
22322
|
-
(notification) => {
|
|
22323
|
-
setNotifications((prevNotifications) => [
|
|
22324
|
-
...prevNotifications,
|
|
22325
|
-
notification
|
|
22326
|
-
]);
|
|
22327
|
-
}
|
|
22328
|
-
);
|
|
22329
|
-
client.setNotificationHandler(
|
|
22330
|
-
StdErrNotificationSchema,
|
|
22331
|
-
(notification) => {
|
|
22332
|
-
setStdErrNotifications((prevErrorNotifications) => [
|
|
22333
|
-
...prevErrorNotifications,
|
|
22334
|
-
notification
|
|
22335
|
-
]);
|
|
22336
|
-
}
|
|
22337
|
-
);
|
|
22338
|
-
await client.connect(clientTransport);
|
|
22339
|
-
client.setRequestHandler(CreateMessageRequestSchema, (request) => {
|
|
22340
|
-
return new Promise((resolve, reject) => {
|
|
22341
|
-
setPendingSampleRequests((prev) => [
|
|
22342
|
-
...prev,
|
|
22343
|
-
{ id: nextRequestId.current++, request, resolve, reject }
|
|
22344
|
-
]);
|
|
22345
|
-
});
|
|
22346
|
-
});
|
|
22347
|
-
client.setRequestHandler(ListRootsRequestSchema, async () => {
|
|
22348
|
-
return { roots: rootsRef.current };
|
|
22349
|
-
});
|
|
22350
|
-
setMcpClient(client);
|
|
22351
|
-
setConnectionStatus("connected");
|
|
22352
|
-
} catch (e) {
|
|
22353
|
-
console.error(e);
|
|
22354
|
-
setConnectionStatus("error");
|
|
22355
|
-
}
|
|
22356
|
-
};
|
|
22357
23265
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-screen bg-background", children: [
|
|
22358
23266
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22359
23267
|
Sidebar,
|
|
@@ -22374,156 +23282,187 @@ const App = () => {
|
|
|
22374
23282
|
}
|
|
22375
23283
|
),
|
|
22376
23284
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 flex flex-col overflow-hidden", children: [
|
|
22377
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto", children: mcpClient ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
22378
|
-
|
|
22379
|
-
|
|
22380
|
-
|
|
22381
|
-
|
|
22382
|
-
|
|
22383
|
-
|
|
22384
|
-
|
|
22385
|
-
|
|
22386
|
-
|
|
22387
|
-
|
|
22388
|
-
|
|
22389
|
-
|
|
22390
|
-
|
|
22391
|
-
|
|
22392
|
-
|
|
22393
|
-
|
|
22394
|
-
|
|
22395
|
-
|
|
22396
|
-
|
|
22397
|
-
|
|
22398
|
-
|
|
22399
|
-
|
|
22400
|
-
|
|
22401
|
-
|
|
22402
|
-
|
|
22403
|
-
|
|
22404
|
-
|
|
22405
|
-
|
|
22406
|
-
|
|
22407
|
-
|
|
22408
|
-
|
|
22409
|
-
|
|
22410
|
-
|
|
22411
|
-
|
|
22412
|
-
|
|
22413
|
-
|
|
22414
|
-
|
|
22415
|
-
|
|
22416
|
-
|
|
22417
|
-
|
|
22418
|
-
|
|
22419
|
-
|
|
22420
|
-
|
|
22421
|
-
|
|
22422
|
-
|
|
22423
|
-
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
|
|
22428
|
-
|
|
22429
|
-
|
|
22430
|
-
|
|
22431
|
-
|
|
22432
|
-
|
|
22433
|
-
|
|
22434
|
-
|
|
22435
|
-
|
|
22436
|
-
|
|
22437
|
-
|
|
22438
|
-
|
|
22439
|
-
|
|
22440
|
-
|
|
22441
|
-
|
|
22442
|
-
|
|
22443
|
-
PromptsTab,
|
|
22444
|
-
{
|
|
22445
|
-
prompts,
|
|
22446
|
-
listPrompts: () => {
|
|
22447
|
-
clearError("prompts");
|
|
22448
|
-
listPrompts();
|
|
22449
|
-
},
|
|
22450
|
-
clearPrompts: () => {
|
|
22451
|
-
setPrompts([]);
|
|
22452
|
-
setNextPromptCursor(void 0);
|
|
22453
|
-
},
|
|
22454
|
-
getPrompt: (name, args2) => {
|
|
22455
|
-
clearError("prompts");
|
|
22456
|
-
getPrompt(name, args2);
|
|
22457
|
-
},
|
|
22458
|
-
selectedPrompt,
|
|
22459
|
-
setSelectedPrompt: (prompt) => {
|
|
22460
|
-
clearError("prompts");
|
|
22461
|
-
setSelectedPrompt(prompt);
|
|
22462
|
-
},
|
|
22463
|
-
promptContent,
|
|
22464
|
-
nextCursor: nextPromptCursor,
|
|
22465
|
-
error: errors.prompts
|
|
22466
|
-
}
|
|
22467
|
-
),
|
|
22468
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22469
|
-
ToolsTab,
|
|
22470
|
-
{
|
|
22471
|
-
tools,
|
|
22472
|
-
listTools: () => {
|
|
22473
|
-
clearError("tools");
|
|
22474
|
-
listTools();
|
|
22475
|
-
},
|
|
22476
|
-
clearTools: () => {
|
|
22477
|
-
setTools([]);
|
|
22478
|
-
setNextToolCursor(void 0);
|
|
22479
|
-
},
|
|
22480
|
-
callTool: (name, params2) => {
|
|
22481
|
-
clearError("tools");
|
|
22482
|
-
callTool(name, params2);
|
|
22483
|
-
},
|
|
22484
|
-
selectedTool,
|
|
22485
|
-
setSelectedTool: (tool) => {
|
|
22486
|
-
clearError("tools");
|
|
22487
|
-
setSelectedTool(tool);
|
|
22488
|
-
setToolResult(null);
|
|
22489
|
-
},
|
|
22490
|
-
toolResult,
|
|
22491
|
-
nextCursor: nextToolCursor,
|
|
22492
|
-
error: errors.tools
|
|
22493
|
-
}
|
|
22494
|
-
),
|
|
22495
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ConsoleTab, {}),
|
|
22496
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
22497
|
-
PingTab,
|
|
22498
|
-
{
|
|
22499
|
-
onPingClick: () => {
|
|
22500
|
-
void makeRequest(
|
|
22501
|
-
{
|
|
22502
|
-
method: "ping"
|
|
23285
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto", children: mcpClient ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
23286
|
+
Tabs,
|
|
23287
|
+
{
|
|
23288
|
+
defaultValue: Object.keys(serverCapabilities ?? {}).includes(
|
|
23289
|
+
window.location.hash.slice(1)
|
|
23290
|
+
) ? window.location.hash.slice(1) : (serverCapabilities == null ? void 0 : serverCapabilities.resources) ? "resources" : (serverCapabilities == null ? void 0 : serverCapabilities.prompts) ? "prompts" : (serverCapabilities == null ? void 0 : serverCapabilities.tools) ? "tools" : "ping",
|
|
23291
|
+
className: "w-full p-4",
|
|
23292
|
+
onValueChange: (value) => window.location.hash = value,
|
|
23293
|
+
children: [
|
|
23294
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "mb-4 p-0", children: [
|
|
23295
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
23296
|
+
TabsTrigger,
|
|
23297
|
+
{
|
|
23298
|
+
value: "resources",
|
|
23299
|
+
disabled: !(serverCapabilities == null ? void 0 : serverCapabilities.resources),
|
|
23300
|
+
children: [
|
|
23301
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Files, { className: "w-4 h-4 mr-2" }),
|
|
23302
|
+
"Resources"
|
|
23303
|
+
]
|
|
23304
|
+
}
|
|
23305
|
+
),
|
|
23306
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
23307
|
+
TabsTrigger,
|
|
23308
|
+
{
|
|
23309
|
+
value: "prompts",
|
|
23310
|
+
disabled: !(serverCapabilities == null ? void 0 : serverCapabilities.prompts),
|
|
23311
|
+
children: [
|
|
23312
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MessageSquare, { className: "w-4 h-4 mr-2" }),
|
|
23313
|
+
"Prompts"
|
|
23314
|
+
]
|
|
23315
|
+
}
|
|
23316
|
+
),
|
|
23317
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
23318
|
+
TabsTrigger,
|
|
23319
|
+
{
|
|
23320
|
+
value: "tools",
|
|
23321
|
+
disabled: !(serverCapabilities == null ? void 0 : serverCapabilities.tools),
|
|
23322
|
+
children: [
|
|
23323
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Hammer, { className: "w-4 h-4 mr-2" }),
|
|
23324
|
+
"Tools"
|
|
23325
|
+
]
|
|
23326
|
+
}
|
|
23327
|
+
),
|
|
23328
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "ping", children: [
|
|
23329
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Bell, { className: "w-4 h-4 mr-2" }),
|
|
23330
|
+
"Ping"
|
|
23331
|
+
] }),
|
|
23332
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "sampling", className: "relative", children: [
|
|
23333
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Hash, { className: "w-4 h-4 mr-2" }),
|
|
23334
|
+
"Sampling",
|
|
23335
|
+
pendingSampleRequests.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full h-4 w-4 flex items-center justify-center", children: pendingSampleRequests.length })
|
|
23336
|
+
] }),
|
|
23337
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "roots", children: [
|
|
23338
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(FolderTree, { className: "w-4 h-4 mr-2" }),
|
|
23339
|
+
"Roots"
|
|
23340
|
+
] })
|
|
23341
|
+
] }),
|
|
23342
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full", children: !(serverCapabilities == null ? void 0 : serverCapabilities.resources) && !(serverCapabilities == null ? void 0 : serverCapabilities.prompts) && !(serverCapabilities == null ? void 0 : serverCapabilities.tools) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-lg text-gray-500", children: "The connected server does not support any MCP capabilities" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
23343
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
23344
|
+
ResourcesTab,
|
|
23345
|
+
{
|
|
23346
|
+
resources,
|
|
23347
|
+
resourceTemplates,
|
|
23348
|
+
listResources: () => {
|
|
23349
|
+
clearError("resources");
|
|
23350
|
+
listResources();
|
|
22503
23351
|
},
|
|
22504
|
-
|
|
22505
|
-
|
|
22506
|
-
|
|
22507
|
-
|
|
22508
|
-
|
|
22509
|
-
|
|
22510
|
-
|
|
22511
|
-
|
|
22512
|
-
|
|
22513
|
-
|
|
22514
|
-
|
|
22515
|
-
|
|
22516
|
-
|
|
22517
|
-
|
|
22518
|
-
|
|
22519
|
-
|
|
22520
|
-
|
|
22521
|
-
|
|
22522
|
-
|
|
22523
|
-
|
|
22524
|
-
|
|
22525
|
-
|
|
22526
|
-
|
|
23352
|
+
clearResources: () => {
|
|
23353
|
+
setResources([]);
|
|
23354
|
+
setNextResourceCursor(void 0);
|
|
23355
|
+
},
|
|
23356
|
+
listResourceTemplates: () => {
|
|
23357
|
+
clearError("resources");
|
|
23358
|
+
listResourceTemplates();
|
|
23359
|
+
},
|
|
23360
|
+
clearResourceTemplates: () => {
|
|
23361
|
+
setResourceTemplates([]);
|
|
23362
|
+
setNextResourceTemplateCursor(void 0);
|
|
23363
|
+
},
|
|
23364
|
+
readResource: (uri) => {
|
|
23365
|
+
clearError("resources");
|
|
23366
|
+
readResource(uri);
|
|
23367
|
+
},
|
|
23368
|
+
selectedResource,
|
|
23369
|
+
setSelectedResource: (resource) => {
|
|
23370
|
+
clearError("resources");
|
|
23371
|
+
setSelectedResource(resource);
|
|
23372
|
+
},
|
|
23373
|
+
resourceContent,
|
|
23374
|
+
nextCursor: nextResourceCursor,
|
|
23375
|
+
nextTemplateCursor: nextResourceTemplateCursor,
|
|
23376
|
+
error: errors.resources
|
|
23377
|
+
}
|
|
23378
|
+
),
|
|
23379
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
23380
|
+
PromptsTab,
|
|
23381
|
+
{
|
|
23382
|
+
prompts,
|
|
23383
|
+
listPrompts: () => {
|
|
23384
|
+
clearError("prompts");
|
|
23385
|
+
listPrompts();
|
|
23386
|
+
},
|
|
23387
|
+
clearPrompts: () => {
|
|
23388
|
+
setPrompts([]);
|
|
23389
|
+
setNextPromptCursor(void 0);
|
|
23390
|
+
},
|
|
23391
|
+
getPrompt: (name, args2) => {
|
|
23392
|
+
clearError("prompts");
|
|
23393
|
+
getPrompt(name, args2);
|
|
23394
|
+
},
|
|
23395
|
+
selectedPrompt,
|
|
23396
|
+
setSelectedPrompt: (prompt) => {
|
|
23397
|
+
clearError("prompts");
|
|
23398
|
+
setSelectedPrompt(prompt);
|
|
23399
|
+
},
|
|
23400
|
+
promptContent,
|
|
23401
|
+
nextCursor: nextPromptCursor,
|
|
23402
|
+
error: errors.prompts
|
|
23403
|
+
}
|
|
23404
|
+
),
|
|
23405
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
23406
|
+
ToolsTab,
|
|
23407
|
+
{
|
|
23408
|
+
tools,
|
|
23409
|
+
listTools: () => {
|
|
23410
|
+
clearError("tools");
|
|
23411
|
+
listTools();
|
|
23412
|
+
},
|
|
23413
|
+
clearTools: () => {
|
|
23414
|
+
setTools([]);
|
|
23415
|
+
setNextToolCursor(void 0);
|
|
23416
|
+
},
|
|
23417
|
+
callTool: (name, params2) => {
|
|
23418
|
+
clearError("tools");
|
|
23419
|
+
callTool(name, params2);
|
|
23420
|
+
},
|
|
23421
|
+
selectedTool,
|
|
23422
|
+
setSelectedTool: (tool) => {
|
|
23423
|
+
clearError("tools");
|
|
23424
|
+
setSelectedTool(tool);
|
|
23425
|
+
setToolResult(null);
|
|
23426
|
+
},
|
|
23427
|
+
toolResult,
|
|
23428
|
+
nextCursor: nextToolCursor,
|
|
23429
|
+
error: errors.tools
|
|
23430
|
+
}
|
|
23431
|
+
),
|
|
23432
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ConsoleTab, {}),
|
|
23433
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
23434
|
+
PingTab,
|
|
23435
|
+
{
|
|
23436
|
+
onPingClick: () => {
|
|
23437
|
+
void makeRequest(
|
|
23438
|
+
{
|
|
23439
|
+
method: "ping"
|
|
23440
|
+
},
|
|
23441
|
+
EmptyResultSchema
|
|
23442
|
+
);
|
|
23443
|
+
}
|
|
23444
|
+
}
|
|
23445
|
+
),
|
|
23446
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
23447
|
+
SamplingTab,
|
|
23448
|
+
{
|
|
23449
|
+
pendingRequests: pendingSampleRequests,
|
|
23450
|
+
onApprove: handleApproveSampling,
|
|
23451
|
+
onReject: handleRejectSampling
|
|
23452
|
+
}
|
|
23453
|
+
),
|
|
23454
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
23455
|
+
RootsTab,
|
|
23456
|
+
{
|
|
23457
|
+
roots,
|
|
23458
|
+
setRoots,
|
|
23459
|
+
onRootsChange: handleRootsChange
|
|
23460
|
+
}
|
|
23461
|
+
)
|
|
23462
|
+
] }) })
|
|
23463
|
+
]
|
|
23464
|
+
}
|
|
23465
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-lg text-gray-500", children: "Connect to an MCP server to start inspecting" }) }) }),
|
|
22527
23466
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
22528
23467
|
"div",
|
|
22529
23468
|
{
|
|
@@ -22559,3 +23498,9 @@ createRoot(document.getElementById("root")).render(
|
|
|
22559
23498
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Q, {})
|
|
22560
23499
|
] })
|
|
22561
23500
|
);
|
|
23501
|
+
export {
|
|
23502
|
+
SESSION_KEYS as S,
|
|
23503
|
+
handleOAuthCallback as h,
|
|
23504
|
+
jsxRuntimeExports as j,
|
|
23505
|
+
reactExports as r
|
|
23506
|
+
};
|