@mcp-use/inspector 3.0.0 → 3.0.1-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/inspector.js +261 -256
- package/dist/client/components/ChatTab.d.ts +3 -1
- package/dist/client/components/ChatTab.d.ts.map +1 -1
- package/dist/client/context/InspectorContext.d.ts +2 -0
- package/dist/client/context/InspectorContext.d.ts.map +1 -1
- package/dist/client/index.js +4 -2
- package/dist/web/assets/{index-WJSIwfmI.js → index-DZZPL9Ox.js} +8 -8
- package/dist/web/index.html +2 -2
- package/package.json +3 -3
package/dist/cdn/inspector.js
CHANGED
|
@@ -26920,7 +26920,7 @@ var Gd = class {
|
|
|
26920
26920
|
//#region src/client/telemetry/utils.ts
|
|
26921
26921
|
function cf() {
|
|
26922
26922
|
try {
|
|
26923
|
-
return "3.0.
|
|
26923
|
+
return "3.0.1-canary.1";
|
|
26924
26924
|
} catch {
|
|
26925
26925
|
return "0.0.0";
|
|
26926
26926
|
}
|
|
@@ -48457,9 +48457,9 @@ var aj, oj, sj, cj, lj, uj, dj, fj, pj, mj, hj, gj, _j, vj, Lce, Rce, yj, bj, xj
|
|
|
48457
48457
|
}(), VF);
|
|
48458
48458
|
}));
|
|
48459
48459
|
//#endregion
|
|
48460
|
-
//#region ../mcp-use/dist/chunk-
|
|
48460
|
+
//#region ../mcp-use/dist/chunk-67APJLAD.js
|
|
48461
48461
|
Zp();
|
|
48462
|
-
var Hue = "1.25.
|
|
48462
|
+
var Hue = "1.25.1-canary.1";
|
|
48463
48463
|
function KF() {
|
|
48464
48464
|
return Hue;
|
|
48465
48465
|
}
|
|
@@ -110597,7 +110597,9 @@ function SFe() {
|
|
|
110597
110597
|
url: e,
|
|
110598
110598
|
name: n,
|
|
110599
110599
|
proxyConfig: r,
|
|
110600
|
-
transportType: i
|
|
110600
|
+
transportType: i,
|
|
110601
|
+
preventAutoAuth: !0,
|
|
110602
|
+
useRedirectFlow: !0
|
|
110601
110603
|
});
|
|
110602
110604
|
}, [t]), d = (0, A.useCallback)(async (e, t) => {
|
|
110603
110605
|
if (l.current.has(e)) {
|
|
@@ -110706,6 +110708,7 @@ function SFe() {
|
|
|
110706
110708
|
name: E.trim() || e,
|
|
110707
110709
|
transportType: "http",
|
|
110708
110710
|
preventAutoAuth: !0,
|
|
110711
|
+
useRedirectFlow: !0,
|
|
110709
110712
|
clientOptions: { capabilities: { extensions: { "io.modelcontextprotocol/ui": { mimeTypes: ["text/html;profile=mcp-app"] } } } },
|
|
110710
110713
|
...r ? {
|
|
110711
110714
|
proxyConfig: r,
|
|
@@ -111053,8 +111056,6 @@ function SFe() {
|
|
|
111053
111056
|
asChild: !0,
|
|
111054
111057
|
children: /* @__PURE__ */ (0, O.jsx)("a", {
|
|
111055
111058
|
href: e.authUrl,
|
|
111056
|
-
target: "_blank",
|
|
111057
|
-
rel: "noopener noreferrer",
|
|
111058
111059
|
onClick: (e) => e.stopPropagation(),
|
|
111059
111060
|
children: "Authenticate"
|
|
111060
111061
|
})
|
|
@@ -111187,7 +111188,8 @@ function CFe({ children: e }) {
|
|
|
111187
111188
|
embeddedConfig: t ? {
|
|
111188
111189
|
chatApiUrl: t,
|
|
111189
111190
|
chatStreamProtocol: "data-stream",
|
|
111190
|
-
chatCredentials: "include"
|
|
111191
|
+
chatCredentials: "include",
|
|
111192
|
+
chatEnableFreeTierUpgrade: !0
|
|
111191
111193
|
} : {}
|
|
111192
111194
|
}), i = (0, A.useCallback)((e) => {
|
|
111193
111195
|
r((t) => ({
|
|
@@ -134248,40 +134250,40 @@ var kZe = /(?:^\/$|\s+\/$)/, AZe = [
|
|
|
134248
134250
|
"Escape",
|
|
134249
134251
|
"Enter"
|
|
134250
134252
|
];
|
|
134251
|
-
function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeyboardShortcuts: r = !0, prompts: i, serverId: a, callPrompt: o, readResource: s, chatApiUrl: c, waitForChatApiUrl: l, initialMessages: u, managedLlmConfig: d,
|
|
134252
|
-
let [
|
|
134253
|
+
function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeyboardShortcuts: r = !0, prompts: i, serverId: a, callPrompt: o, readResource: s, chatApiUrl: c, waitForChatApiUrl: l, initialMessages: u, managedLlmConfig: d, enableFreeTierUpgrade: f = !1, clearButtonLabel: p, hideTitle: m, hideModelBadge: h, hideServerUrl: g, clearButtonHideIcon: _, clearButtonHideShortcut: v, clearButtonVariant: y, hideClearButton: b, hideToolSelector: x, chatQuickQuestions: S = [], chatFollowups: C = [], streamProtocol: w, credentials: T, extraHeaders: E, body: D }) {
|
|
134254
|
+
let [k, j] = (0, A.useState)(""), [M, N] = (0, A.useState)(!1), [P, F] = (0, A.useState)(-1), [I, L] = (0, A.useState)(S), [ee, te] = (0, A.useState)(C), [ne, re] = (0, A.useState)(/* @__PURE__ */ new Set()), ie = (0, A.useRef)(null), R = (0, A.useRef)(null), z = (0, A.useRef)(null), ae = (0, A.useMemo)(() => (e.tools ?? []).map((e) => ({
|
|
134253
134255
|
name: e.name,
|
|
134254
134256
|
description: e.description
|
|
134255
|
-
})), [e.tools]), { llmConfig:
|
|
134257
|
+
})), [e.tools]), { llmConfig: oe, authConfig: se, configDialogOpen: ce, setConfigDialogOpen: le, tempProvider: ue, setTempProvider: de, tempApiKey: fe, setTempApiKey: pe, tempModel: me, setTempModel: he, saveLLMConfig: ge, clearConfig: _e } = Y7({ mcpServerUrl: e.url }), [ve, ye] = (0, A.useState)(() => !!oe), be = n || ve || !!oe, xe = be ? oe : d ?? oe, Se = !be && !!d, { getAllModelContexts: Ce } = Z4(), we = Ce(), Te = {
|
|
134256
134258
|
connection: e,
|
|
134257
|
-
llmConfig:
|
|
134259
|
+
llmConfig: xe,
|
|
134258
134260
|
isConnected: t,
|
|
134259
134261
|
readResource: s,
|
|
134260
|
-
widgetModelContexts:
|
|
134261
|
-
disabledTools:
|
|
134262
|
-
},
|
|
134262
|
+
widgetModelContexts: we,
|
|
134263
|
+
disabledTools: ne
|
|
134264
|
+
}, Ee = yZe({
|
|
134263
134265
|
mcpServerUrl: e.url,
|
|
134264
|
-
llmConfig:
|
|
134265
|
-
authConfig:
|
|
134266
|
+
llmConfig: xe,
|
|
134267
|
+
authConfig: se,
|
|
134266
134268
|
isConnected: t,
|
|
134267
134269
|
chatApiUrl: c,
|
|
134268
134270
|
waitForChatApiUrl: l,
|
|
134269
|
-
widgetModelContexts:
|
|
134271
|
+
widgetModelContexts: we,
|
|
134270
134272
|
initialMessages: u,
|
|
134271
|
-
disabledTools:
|
|
134272
|
-
streamProtocol:
|
|
134273
|
-
credentials:
|
|
134274
|
-
extraHeaders:
|
|
134275
|
-
body:
|
|
134276
|
-
}),
|
|
134277
|
-
|
|
134278
|
-
}, [
|
|
134279
|
-
|
|
134280
|
-
}, [
|
|
134273
|
+
disabledTools: ne,
|
|
134274
|
+
streamProtocol: w,
|
|
134275
|
+
credentials: T,
|
|
134276
|
+
extraHeaders: E,
|
|
134277
|
+
body: D
|
|
134278
|
+
}), De = CZe(Te), { messages: Oe, isLoading: ke, attachments: Ae, sendMessage: je, clearMessages: Me, setMessages: Ne, stop: Pe, addAttachment: Fe, removeAttachment: Ie } = be ? De : Ee, Le = be ? null : Ee.rateLimitInfo ?? null, Re = be ? void 0 : Ee.clearRateLimitInfo, ze = (0, A.useCallback)(() => {
|
|
134279
|
+
Re?.(), ye(!0), le(!0);
|
|
134280
|
+
}, [Re, le]), [Be, Ve] = (0, A.useState)(!1), He = (0, A.useCallback)(() => {
|
|
134281
|
+
le(!1), Ve(!0);
|
|
134282
|
+
}, [le]), B = Se && f ? { onLoginClick: He } : void 0, { filteredPrompts: Ue, setSelectedPrompt: We, selectedPrompt: Ge, setPromptArgs: Ke, executePrompt: qe, results: Je, handleDeleteResult: Ye, clearPromptResults: Xe } = fIe({
|
|
134281
134283
|
prompts: i,
|
|
134282
134284
|
callPrompt: o,
|
|
134283
134285
|
serverId: a
|
|
134284
|
-
}),
|
|
134286
|
+
}), Ze = (0, A.useCallback)((e) => Array.isArray(e) ? e.filter((e) => typeof e == "string").map((e) => e.trim()).filter(Boolean).slice(0, 8) : [], []), Qe = (0, A.useCallback)((e) => {
|
|
134285
134287
|
if (typeof e.content == "string" && e.content.trim()) return e.content;
|
|
134286
134288
|
if (Array.isArray(e.content) && e.content.length > 0) return e.content.map((e) => typeof e == "string" ? e : e.text ?? "").join("");
|
|
134287
134289
|
if (e.parts && e.parts.length > 0) {
|
|
@@ -134289,7 +134291,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134289
134291
|
if (t.length > 0) return t.join("\n");
|
|
134290
134292
|
}
|
|
134291
134293
|
return "";
|
|
134292
|
-
}, []),
|
|
134294
|
+
}, []), $e = (0, A.useCallback)((e) => {
|
|
134293
134295
|
if (e == null) return "No result";
|
|
134294
134296
|
if (typeof e == "string") try {
|
|
134295
134297
|
let t = JSON.parse(e);
|
|
@@ -134312,8 +134314,8 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134312
134314
|
}).join("\n\n");
|
|
134313
134315
|
}
|
|
134314
134316
|
return JSON.stringify(e, null, 2);
|
|
134315
|
-
}, []),
|
|
134316
|
-
let t =
|
|
134317
|
+
}, []), et = (0, A.useCallback)(() => Oe.map((e) => {
|
|
134318
|
+
let t = Qe(e), n = e.parts?.filter((e) => e.type === "tool-invocation" && e.toolInvocation).map((e) => ({
|
|
134317
134319
|
toolName: e.toolInvocation.toolName,
|
|
134318
134320
|
args: e.toolInvocation.args,
|
|
134319
134321
|
state: e.toolInvocation.state,
|
|
@@ -134326,7 +134328,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134326
134328
|
timestamp: e.timestamp,
|
|
134327
134329
|
toolInvocations: n?.length ? n : void 0
|
|
134328
134330
|
};
|
|
134329
|
-
}), [
|
|
134331
|
+
}), [Oe, Qe]), tt = (0, A.useCallback)((e, t = {}) => {
|
|
134330
134332
|
typeof window > "u" || window.parent === window || window.parent.postMessage({
|
|
134331
134333
|
type: e,
|
|
134332
134334
|
serverId: a,
|
|
@@ -134334,7 +134336,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134334
134336
|
}, "*");
|
|
134335
134337
|
}, [a]);
|
|
134336
134338
|
(0, A.useEffect)(() => {
|
|
134337
|
-
|
|
134339
|
+
tt("mcp-inspector:chat:ready", { capabilities: {
|
|
134338
134340
|
send: !0,
|
|
134339
134341
|
clear: !0,
|
|
134340
134342
|
getState: !0,
|
|
@@ -134342,28 +134344,28 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134342
134344
|
setFollowups: !0,
|
|
134343
134345
|
loadMessages: !0
|
|
134344
134346
|
} });
|
|
134345
|
-
}, [
|
|
134346
|
-
|
|
134347
|
-
isLoading:
|
|
134348
|
-
messageCount:
|
|
134349
|
-
messages:
|
|
134350
|
-
quickQuestions:
|
|
134351
|
-
followups:
|
|
134347
|
+
}, [tt]), (0, A.useEffect)(() => {
|
|
134348
|
+
tt("mcp-inspector:chat:state_changed", {
|
|
134349
|
+
isLoading: ke,
|
|
134350
|
+
messageCount: Oe.length,
|
|
134351
|
+
messages: et(),
|
|
134352
|
+
quickQuestions: I,
|
|
134353
|
+
followups: ee
|
|
134352
134354
|
});
|
|
134353
134355
|
}, [
|
|
134354
|
-
|
|
134355
|
-
$e,
|
|
134356
|
-
Oe,
|
|
134357
|
-
De.length,
|
|
134356
|
+
ee,
|
|
134358
134357
|
et,
|
|
134359
|
-
|
|
134358
|
+
ke,
|
|
134359
|
+
Oe.length,
|
|
134360
|
+
tt,
|
|
134361
|
+
I
|
|
134360
134362
|
]), (0, A.useEffect)(() => {
|
|
134361
134363
|
let e = (e) => {
|
|
134362
134364
|
if (!e.data || typeof e.data != "object") return;
|
|
134363
134365
|
let n = e.data;
|
|
134364
134366
|
if (!n.type?.startsWith("mcp-inspector:chat:") || n.serverId && n.serverId !== a) return;
|
|
134365
134367
|
let r = n.requestId, i = (e, t = {}) => {
|
|
134366
|
-
|
|
134368
|
+
tt("mcp-inspector:chat:command_result", {
|
|
134367
134369
|
requestId: r,
|
|
134368
134370
|
ok: e,
|
|
134369
134371
|
...t
|
|
@@ -134375,12 +134377,12 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134375
134377
|
i(!1, { error: "Missing message" });
|
|
134376
134378
|
return;
|
|
134377
134379
|
}
|
|
134378
|
-
if (!
|
|
134380
|
+
if (!xe || !t) {
|
|
134379
134381
|
i(!1, { error: "Chat is not ready to send messages" });
|
|
134380
134382
|
return;
|
|
134381
134383
|
}
|
|
134382
|
-
|
|
134383
|
-
|
|
134384
|
+
je(e, []).then(() => {
|
|
134385
|
+
tt("mcp-inspector:chat:message_sent", {
|
|
134384
134386
|
requestId: r,
|
|
134385
134387
|
message: e,
|
|
134386
134388
|
source: "bridge"
|
|
@@ -134391,28 +134393,28 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134391
134393
|
return;
|
|
134392
134394
|
}
|
|
134393
134395
|
if (n.type === "mcp-inspector:chat:clear") {
|
|
134394
|
-
|
|
134396
|
+
Me(), tt("mcp-inspector:chat:cleared", { requestId: r }), i(!0);
|
|
134395
134397
|
return;
|
|
134396
134398
|
}
|
|
134397
134399
|
if (n.type === "mcp-inspector:chat:get_state") {
|
|
134398
|
-
|
|
134400
|
+
tt("mcp-inspector:chat:state", {
|
|
134399
134401
|
requestId: r,
|
|
134400
|
-
isLoading:
|
|
134401
|
-
messageCount:
|
|
134402
|
-
messages:
|
|
134403
|
-
quickQuestions:
|
|
134404
|
-
followups:
|
|
134402
|
+
isLoading: ke,
|
|
134403
|
+
messageCount: Oe.length,
|
|
134404
|
+
messages: et(),
|
|
134405
|
+
quickQuestions: I,
|
|
134406
|
+
followups: ee
|
|
134405
134407
|
}), i(!0);
|
|
134406
134408
|
return;
|
|
134407
134409
|
}
|
|
134408
134410
|
if (n.type === "mcp-inspector:chat:set_quick_questions") {
|
|
134409
|
-
let e =
|
|
134410
|
-
|
|
134411
|
+
let e = Ze(n.questions);
|
|
134412
|
+
L(e), i(!0, { quickQuestions: e });
|
|
134411
134413
|
return;
|
|
134412
134414
|
}
|
|
134413
134415
|
if (n.type === "mcp-inspector:chat:set_followups") {
|
|
134414
|
-
let e =
|
|
134415
|
-
|
|
134416
|
+
let e = Ze(n.followups);
|
|
134417
|
+
te(e), i(!0, { followups: e });
|
|
134416
134418
|
return;
|
|
134417
134419
|
}
|
|
134418
134420
|
if (n.type === "mcp-inspector:chat:load_messages") {
|
|
@@ -134421,7 +134423,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134421
134423
|
i(!1, { error: "messages must be an array" });
|
|
134422
134424
|
return;
|
|
134423
134425
|
}
|
|
134424
|
-
|
|
134426
|
+
Ne(e), i(!0, { count: e.length });
|
|
134425
134427
|
return;
|
|
134426
134428
|
}
|
|
134427
134429
|
if (n.type === "mcp-inspector:chat:screenshot") {
|
|
@@ -134433,7 +134435,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134433
134435
|
let e = document.querySelectorAll("[data-tool-call-id]");
|
|
134434
134436
|
e.length > 0 && (t = e[e.length - 1]);
|
|
134435
134437
|
}
|
|
134436
|
-
if (!t &&
|
|
134438
|
+
if (!t && R.current && (t = R.current), !t) {
|
|
134437
134439
|
i(!1, { error: "No screenshot target found" });
|
|
134438
134440
|
return;
|
|
134439
134441
|
}
|
|
@@ -134467,15 +134469,15 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134467
134469
|
} catch (e) {
|
|
134468
134470
|
s = e instanceof Error ? e.message : String(e);
|
|
134469
134471
|
}
|
|
134470
|
-
if (a)
|
|
134472
|
+
if (a) tt("mcp-inspector:chat:screenshot_result", {
|
|
134471
134473
|
requestId: r,
|
|
134472
134474
|
toolCallId: e || null,
|
|
134473
134475
|
image: a,
|
|
134474
134476
|
timestamp: Date.now()
|
|
134475
134477
|
}), i(!0);
|
|
134476
134478
|
else {
|
|
134477
|
-
let t =
|
|
134478
|
-
|
|
134479
|
+
let t = R.current || document.body, n = t.innerText?.substring(0, 5e3) || "", a = t.innerHTML?.substring(0, 1e4) || "";
|
|
134480
|
+
tt("mcp-inspector:chat:screenshot_result", {
|
|
134479
134481
|
requestId: r,
|
|
134480
134482
|
toolCallId: e || null,
|
|
134481
134483
|
image: "",
|
|
@@ -134486,8 +134488,8 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134486
134488
|
}), i(!1, { error: `html-to-image: ${o}; html2canvas: ${s}` });
|
|
134487
134489
|
}
|
|
134488
134490
|
} catch (t) {
|
|
134489
|
-
let n = (
|
|
134490
|
-
|
|
134491
|
+
let n = (R.current || document.body).innerText?.substring(0, 5e3) || "";
|
|
134492
|
+
tt("mcp-inspector:chat:screenshot_result", {
|
|
134491
134493
|
requestId: r,
|
|
134492
134494
|
toolCallId: e || null,
|
|
134493
134495
|
image: "",
|
|
@@ -134502,114 +134504,114 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134502
134504
|
};
|
|
134503
134505
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
134504
134506
|
}, [
|
|
134505
|
-
je,
|
|
134506
134507
|
Me,
|
|
134507
|
-
|
|
134508
|
-
|
|
134509
|
-
Oe,
|
|
134510
|
-
De.length,
|
|
134508
|
+
Ne,
|
|
134509
|
+
ee,
|
|
134511
134510
|
et,
|
|
134512
|
-
|
|
134513
|
-
|
|
134514
|
-
|
|
134511
|
+
ke,
|
|
134512
|
+
Oe.length,
|
|
134513
|
+
tt,
|
|
134514
|
+
I,
|
|
134515
|
+
Ze,
|
|
134516
|
+
je,
|
|
134515
134517
|
a,
|
|
134516
|
-
|
|
134518
|
+
xe,
|
|
134517
134519
|
t
|
|
134518
|
-
]), a0(r ? { onNewChat:
|
|
134519
|
-
let
|
|
134520
|
-
|
|
134521
|
-
}, []),
|
|
134522
|
-
if (!
|
|
134523
|
-
let e =
|
|
134524
|
-
|
|
134520
|
+
]), a0(r ? { onNewChat: Me } : {});
|
|
134521
|
+
let nt = (0, A.useCallback)(() => {
|
|
134522
|
+
F(-1), N(!1), z.current = null;
|
|
134523
|
+
}, []), rt = (0, A.useCallback)(() => {
|
|
134524
|
+
if (!ie.current) return;
|
|
134525
|
+
let e = ie.current.selectionStart, t = k.slice(0, e), n = kZe.test(t);
|
|
134526
|
+
N(n), n ? (z.current = {
|
|
134525
134527
|
start: e - 1,
|
|
134526
134528
|
end: e
|
|
134527
|
-
},
|
|
134528
|
-
}, [
|
|
134529
|
+
}, F(0)) : nt();
|
|
134530
|
+
}, [k, nt]);
|
|
134529
134531
|
(0, A.useEffect)(() => {
|
|
134530
|
-
|
|
134531
|
-
}, [
|
|
134532
|
-
!
|
|
134533
|
-
}, [
|
|
134534
|
-
|
|
134535
|
-
}, [
|
|
134536
|
-
let
|
|
134537
|
-
|
|
134538
|
-
}, [
|
|
134539
|
-
if (
|
|
134540
|
-
|
|
134532
|
+
xe && Oe.length === 0 && ie.current && ie.current.focus();
|
|
134533
|
+
}, [xe, Oe.length]), (0, A.useEffect)(() => {
|
|
134534
|
+
!ke && Oe.length > 0 && ie.current && ie.current.focus();
|
|
134535
|
+
}, [ke, Oe.length]), (0, A.useEffect)(() => {
|
|
134536
|
+
ie.current && rt();
|
|
134537
|
+
}, [k, rt]);
|
|
134538
|
+
let it = (0, A.useCallback)(() => {
|
|
134539
|
+
We(null), Ke({}), nt();
|
|
134540
|
+
}, [nt]), at = (0, A.useCallback)(async (e) => {
|
|
134541
|
+
if (We(e), e.arguments && e.arguments.length > 0) {
|
|
134542
|
+
We(null), EB.error("Prompts with arguments are not supported", { description: "This prompt requires arguments which are not yet supported in chat mode." });
|
|
134541
134543
|
return;
|
|
134542
134544
|
}
|
|
134543
134545
|
try {
|
|
134544
|
-
await
|
|
134546
|
+
await qe(e, {});
|
|
134545
134547
|
} catch (e) {
|
|
134546
134548
|
console.error("Error executing prompt", e);
|
|
134547
134549
|
} finally {
|
|
134548
|
-
if (
|
|
134549
|
-
let { start: e, end: t } =
|
|
134550
|
-
k
|
|
134551
|
-
|
|
134550
|
+
if (ie.current && z.current) {
|
|
134551
|
+
let { start: e, end: t } = z.current;
|
|
134552
|
+
j(k.slice(0, e) + k.slice(t)), requestAnimationFrame(() => {
|
|
134553
|
+
ie.current?.focus(), ie.current?.setSelectionRange(e, e);
|
|
134552
134554
|
});
|
|
134553
134555
|
}
|
|
134554
|
-
|
|
134556
|
+
it();
|
|
134555
134557
|
}
|
|
134556
134558
|
}, [
|
|
134557
|
-
Ke,
|
|
134558
|
-
rt,
|
|
134559
|
-
D
|
|
134560
|
-
]), at = (0, A.useCallback)(() => {
|
|
134561
|
-
(D.trim() || qe.length > 0 || ke.length > 0) && (Ae(D, qe), k(""), Ye());
|
|
134562
|
-
}, [
|
|
134563
|
-
D,
|
|
134564
134559
|
qe,
|
|
134565
|
-
Ae,
|
|
134566
|
-
Ye,
|
|
134567
|
-
ke
|
|
134568
|
-
]), ot = (0, A.useCallback)((e) => {
|
|
134569
|
-
if (e.key === "ArrowDown") P((e) => B.length === 0 ? -1 : (e + 1) % B.length);
|
|
134570
|
-
else if (e.key === "ArrowUp") P((e) => B.length === 0 ? -1 : (e - 1 + B.length) % B.length);
|
|
134571
|
-
else if (e.key === "Escape") e.stopPropagation(), tt();
|
|
134572
|
-
else if (e.key === "Enter" && N >= 0) {
|
|
134573
|
-
let e = B[N];
|
|
134574
|
-
e && it(e);
|
|
134575
|
-
}
|
|
134576
|
-
}, [
|
|
134577
|
-
B,
|
|
134578
|
-
N,
|
|
134579
134560
|
it,
|
|
134580
|
-
|
|
134561
|
+
k
|
|
134562
|
+
]), ot = (0, A.useCallback)(() => {
|
|
134563
|
+
(k.trim() || Je.length > 0 || Ae.length > 0) && (je(k, Je), j(""), Xe());
|
|
134564
|
+
}, [
|
|
134565
|
+
k,
|
|
134566
|
+
Je,
|
|
134567
|
+
je,
|
|
134568
|
+
Xe,
|
|
134569
|
+
Ae
|
|
134581
134570
|
]), st = (0, A.useCallback)((e) => {
|
|
134582
|
-
|
|
134571
|
+
if (e.key === "ArrowDown") F((e) => Ue.length === 0 ? -1 : (e + 1) % Ue.length);
|
|
134572
|
+
else if (e.key === "ArrowUp") F((e) => Ue.length === 0 ? -1 : (e - 1 + Ue.length) % Ue.length);
|
|
134573
|
+
else if (e.key === "Escape") e.stopPropagation(), nt();
|
|
134574
|
+
else if (e.key === "Enter" && P >= 0) {
|
|
134575
|
+
let e = Ue[P];
|
|
134576
|
+
e && at(e);
|
|
134577
|
+
}
|
|
134583
134578
|
}, [
|
|
134579
|
+
Ue,
|
|
134580
|
+
P,
|
|
134584
134581
|
at,
|
|
134585
|
-
|
|
134586
|
-
j
|
|
134582
|
+
nt
|
|
134587
134583
|
]), ct = (0, A.useCallback)((e) => {
|
|
134588
|
-
(e.key
|
|
134589
|
-
}, [
|
|
134584
|
+
AZe.includes(e.key) && M ? (e.preventDefault(), st(e)) : e.key === "Enter" && !e.shiftKey && (e.preventDefault(), ot());
|
|
134585
|
+
}, [
|
|
134586
|
+
ot,
|
|
134587
|
+
st,
|
|
134588
|
+
M
|
|
134589
|
+
]), lt = (0, A.useCallback)((e) => {
|
|
134590
|
+
(e.key === "ArrowLeft" || e.key === "ArrowRight") && rt();
|
|
134591
|
+
}, [rt]), ut = (0, A.useCallback)((e) => {
|
|
134590
134592
|
let t = `# Chat Export - ${(/* @__PURE__ */ new Date()).toLocaleString()}\n\n`;
|
|
134591
134593
|
return t += e.map((e) => {
|
|
134592
134594
|
let t = e.role.charAt(0).toUpperCase() + e.role.slice(1);
|
|
134593
134595
|
if (!e.parts || e.parts.length === 0) {
|
|
134594
|
-
let n =
|
|
134596
|
+
let n = Qe(e).trim();
|
|
134595
134597
|
return n ? `## ${t}\n${n}` : "";
|
|
134596
134598
|
}
|
|
134597
134599
|
let n = [];
|
|
134598
134600
|
for (let t of e.parts) if (t.type === "text" && t.text?.trim()) n.push(t.text.trim());
|
|
134599
134601
|
else if (t.type === "tool-invocation" && t.toolInvocation) {
|
|
134600
|
-
let e = t.toolInvocation, r =
|
|
134602
|
+
let e = t.toolInvocation, r = $e(e.result);
|
|
134601
134603
|
n.push(`#### ${e.toolName}\n**Arguments:**\n\`\`\`json\n${JSON.stringify(e.args, null, 2)}\n\`\`\`\n**Result:**\n\n${r}`);
|
|
134602
134604
|
}
|
|
134603
134605
|
return n.length === 0 ? "" : `## ${t}\n\n${n.join("\n\n")}`;
|
|
134604
134606
|
}).filter((e) => e !== "").join("\n\n---\n\n"), t;
|
|
134605
|
-
}, [
|
|
134606
|
-
yz(
|
|
134607
|
-
}, [
|
|
134607
|
+
}, [Qe, $e]), dt = (0, A.useCallback)(() => {
|
|
134608
|
+
yz(ut(Oe)).then(() => EB.success("Chat copied to clipboard"), () => EB.error("Failed to copy chat"));
|
|
134609
|
+
}, [Oe, ut]), ft = (0, A.useCallback)((e) => {
|
|
134608
134610
|
let t = `chat-export-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}`;
|
|
134609
|
-
if (e === "json") Uye(
|
|
134611
|
+
if (e === "json") Uye(Oe.map((e) => ({
|
|
134610
134612
|
id: e.id,
|
|
134611
134613
|
role: e.role,
|
|
134612
|
-
content:
|
|
134614
|
+
content: Qe(e),
|
|
134613
134615
|
timestamp: e.timestamp,
|
|
134614
134616
|
toolInvocations: e.parts?.filter((e) => e.type === "tool-invocation" && e.toolInvocation).map((e) => ({
|
|
134615
134617
|
toolName: e.toolInvocation.toolName,
|
|
@@ -134618,175 +134620,175 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134618
134620
|
}))
|
|
134619
134621
|
})), t + ".json");
|
|
134620
134622
|
else {
|
|
134621
|
-
let e =
|
|
134623
|
+
let e = ut(Oe), n = new Blob([e], { type: "text/markdown" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
134622
134624
|
i.href = r, i.download = t + ".md", document.body.appendChild(i), i.click(), document.body.removeChild(i), setTimeout(() => URL.revokeObjectURL(r), 100);
|
|
134623
134625
|
}
|
|
134624
134626
|
EB.success(`Chat exported as ${e.toUpperCase()}`);
|
|
134625
134627
|
}, [
|
|
134626
|
-
|
|
134627
|
-
|
|
134628
|
-
|
|
134629
|
-
]),
|
|
134630
|
-
|
|
134631
|
-
}, [
|
|
134632
|
-
e.trim() && (!
|
|
134633
|
-
|
|
134628
|
+
Oe,
|
|
134629
|
+
ut,
|
|
134630
|
+
Qe
|
|
134631
|
+
]), pt = (0, A.useCallback)(() => {
|
|
134632
|
+
_e(), Me();
|
|
134633
|
+
}, [_e, Me]), mt = (0, A.useCallback)((e) => {
|
|
134634
|
+
e.trim() && (!xe || !t || je(e, []).then(() => {
|
|
134635
|
+
tt("mcp-inspector:chat:message_sent", {
|
|
134634
134636
|
message: e,
|
|
134635
134637
|
source: "quick_question"
|
|
134636
134638
|
});
|
|
134637
134639
|
}));
|
|
134638
134640
|
}, [
|
|
134639
|
-
|
|
134640
|
-
|
|
134641
|
-
|
|
134641
|
+
tt,
|
|
134642
|
+
je,
|
|
134643
|
+
xe,
|
|
134642
134644
|
t
|
|
134643
|
-
]),
|
|
134644
|
-
e.trim() && (!
|
|
134645
|
-
|
|
134645
|
+
]), ht = (0, A.useCallback)((e) => {
|
|
134646
|
+
e.trim() && (!xe || !t || je(e, []).then(() => {
|
|
134647
|
+
tt("mcp-inspector:chat:message_sent", {
|
|
134646
134648
|
message: e,
|
|
134647
134649
|
source: "followup"
|
|
134648
134650
|
});
|
|
134649
134651
|
}));
|
|
134650
134652
|
}, [
|
|
134651
|
-
|
|
134652
|
-
|
|
134653
|
-
|
|
134653
|
+
tt,
|
|
134654
|
+
je,
|
|
134655
|
+
xe,
|
|
134654
134656
|
t
|
|
134655
|
-
]),
|
|
134657
|
+
]), gt = (Le || Be) && c ? /* @__PURE__ */ (0, O.jsx)(OZe, {
|
|
134656
134658
|
authOrigin: new URL(c).origin,
|
|
134657
134659
|
onDismiss: () => {
|
|
134658
|
-
|
|
134660
|
+
Re?.(), Ve(!1);
|
|
134659
134661
|
},
|
|
134660
|
-
onUseApiKey:
|
|
134662
|
+
onUseApiKey: ze
|
|
134661
134663
|
}) : null;
|
|
134662
|
-
return
|
|
134664
|
+
return xe && Oe.length === 0 ? /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
134663
134665
|
className: "flex flex-col h-full",
|
|
134664
134666
|
children: [
|
|
134665
134667
|
/* @__PURE__ */ (0, O.jsx)("div", {
|
|
134666
134668
|
className: "absolute top-4 right-4 z-10",
|
|
134667
134669
|
children: /* @__PURE__ */ (0, O.jsx)(GIe, {
|
|
134668
|
-
open:
|
|
134669
|
-
onOpenChange:
|
|
134670
|
-
tempProvider:
|
|
134671
|
-
tempModel:
|
|
134672
|
-
tempApiKey:
|
|
134673
|
-
onProviderChange:
|
|
134674
|
-
onModelChange:
|
|
134675
|
-
onApiKeyChange:
|
|
134676
|
-
onSave:
|
|
134677
|
-
onClear:
|
|
134678
|
-
showClearButton: !
|
|
134670
|
+
open: ce,
|
|
134671
|
+
onOpenChange: le,
|
|
134672
|
+
tempProvider: ue,
|
|
134673
|
+
tempModel: me,
|
|
134674
|
+
tempApiKey: fe,
|
|
134675
|
+
onProviderChange: de,
|
|
134676
|
+
onModelChange: he,
|
|
134677
|
+
onApiKeyChange: pe,
|
|
134678
|
+
onSave: ge,
|
|
134679
|
+
onClear: pt,
|
|
134680
|
+
showClearButton: !Se,
|
|
134679
134681
|
buttonLabel: "Change API Key",
|
|
134680
|
-
freeTierInfo:
|
|
134682
|
+
freeTierInfo: B
|
|
134681
134683
|
})
|
|
134682
134684
|
}),
|
|
134683
134685
|
/* @__PURE__ */ (0, O.jsx)(xLe, {
|
|
134684
134686
|
mcpServerUrl: e.url,
|
|
134685
|
-
inputValue:
|
|
134687
|
+
inputValue: k,
|
|
134686
134688
|
isConnected: t,
|
|
134687
|
-
isLoading:
|
|
134688
|
-
textareaRef:
|
|
134689
|
-
llmConfig:
|
|
134690
|
-
promptsDropdownOpen:
|
|
134691
|
-
promptFocusedIndex:
|
|
134692
|
-
prompts:
|
|
134693
|
-
selectedPrompt:
|
|
134694
|
-
promptResults:
|
|
134695
|
-
attachments:
|
|
134696
|
-
tools:
|
|
134697
|
-
disabledTools:
|
|
134698
|
-
onDisabledToolsChange:
|
|
134699
|
-
onDeletePromptResult:
|
|
134700
|
-
onPromptSelect:
|
|
134701
|
-
onInputChange:
|
|
134702
|
-
onKeyDown:
|
|
134703
|
-
onKeyUp:
|
|
134704
|
-
onClick:
|
|
134689
|
+
isLoading: ke,
|
|
134690
|
+
textareaRef: ie,
|
|
134691
|
+
llmConfig: xe,
|
|
134692
|
+
promptsDropdownOpen: M,
|
|
134693
|
+
promptFocusedIndex: P,
|
|
134694
|
+
prompts: Ue,
|
|
134695
|
+
selectedPrompt: Ge,
|
|
134696
|
+
promptResults: Je,
|
|
134697
|
+
attachments: Ae,
|
|
134698
|
+
tools: x ? void 0 : ae,
|
|
134699
|
+
disabledTools: x ? void 0 : ne,
|
|
134700
|
+
onDisabledToolsChange: x ? void 0 : re,
|
|
134701
|
+
onDeletePromptResult: Ye,
|
|
134702
|
+
onPromptSelect: at,
|
|
134703
|
+
onInputChange: j,
|
|
134704
|
+
onKeyDown: ct,
|
|
134705
|
+
onKeyUp: lt,
|
|
134706
|
+
onClick: rt,
|
|
134705
134707
|
onSubmit: (e) => {
|
|
134706
|
-
e.preventDefault(),
|
|
134707
|
-
},
|
|
134708
|
-
onConfigDialogOpenChange:
|
|
134709
|
-
onAttachmentAdd:
|
|
134710
|
-
onAttachmentRemove:
|
|
134711
|
-
hideModelBadge:
|
|
134712
|
-
hideServerUrl:
|
|
134713
|
-
quickQuestions:
|
|
134714
|
-
onQuickQuestionSelect:
|
|
134715
|
-
freeTierInfo:
|
|
134708
|
+
e.preventDefault(), ot();
|
|
134709
|
+
},
|
|
134710
|
+
onConfigDialogOpenChange: le,
|
|
134711
|
+
onAttachmentAdd: Fe,
|
|
134712
|
+
onAttachmentRemove: Ie,
|
|
134713
|
+
hideModelBadge: h && !be,
|
|
134714
|
+
hideServerUrl: g,
|
|
134715
|
+
quickQuestions: I,
|
|
134716
|
+
onQuickQuestionSelect: mt,
|
|
134717
|
+
freeTierInfo: B
|
|
134716
134718
|
}),
|
|
134717
|
-
|
|
134719
|
+
gt
|
|
134718
134720
|
]
|
|
134719
134721
|
}) : /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
134720
134722
|
className: "flex flex-col h-full relative",
|
|
134721
134723
|
children: [
|
|
134722
134724
|
/* @__PURE__ */ (0, O.jsx)(KIe, {
|
|
134723
|
-
llmConfig:
|
|
134724
|
-
hasMessages:
|
|
134725
|
-
configDialogOpen:
|
|
134726
|
-
onConfigDialogOpenChange:
|
|
134727
|
-
onClearChat:
|
|
134728
|
-
tempProvider:
|
|
134729
|
-
tempModel:
|
|
134730
|
-
tempApiKey:
|
|
134731
|
-
onProviderChange:
|
|
134732
|
-
onModelChange:
|
|
134733
|
-
onApiKeyChange:
|
|
134734
|
-
onSaveConfig:
|
|
134735
|
-
onClearConfig:
|
|
134736
|
-
hideConfigButton:
|
|
134737
|
-
freeTierInfo:
|
|
134738
|
-
onCopyChat:
|
|
134739
|
-
onExportChat:
|
|
134740
|
-
clearButtonLabel:
|
|
134741
|
-
hideTitle:
|
|
134742
|
-
clearButtonHideIcon:
|
|
134743
|
-
clearButtonHideShortcut:
|
|
134744
|
-
clearButtonVariant:
|
|
134745
|
-
hideClearButton:
|
|
134725
|
+
llmConfig: xe,
|
|
134726
|
+
hasMessages: Oe.length > 0,
|
|
134727
|
+
configDialogOpen: ce,
|
|
134728
|
+
onConfigDialogOpenChange: le,
|
|
134729
|
+
onClearChat: Me,
|
|
134730
|
+
tempProvider: ue,
|
|
134731
|
+
tempModel: me,
|
|
134732
|
+
tempApiKey: fe,
|
|
134733
|
+
onProviderChange: de,
|
|
134734
|
+
onModelChange: he,
|
|
134735
|
+
onApiKeyChange: pe,
|
|
134736
|
+
onSaveConfig: ge,
|
|
134737
|
+
onClearConfig: pt,
|
|
134738
|
+
hideConfigButton: Se && !B,
|
|
134739
|
+
freeTierInfo: B,
|
|
134740
|
+
onCopyChat: dt,
|
|
134741
|
+
onExportChat: ft,
|
|
134742
|
+
clearButtonLabel: p,
|
|
134743
|
+
hideTitle: m,
|
|
134744
|
+
clearButtonHideIcon: _,
|
|
134745
|
+
clearButtonHideShortcut: v,
|
|
134746
|
+
clearButtonVariant: y,
|
|
134747
|
+
hideClearButton: b
|
|
134746
134748
|
}),
|
|
134747
134749
|
/* @__PURE__ */ (0, O.jsx)("div", {
|
|
134748
|
-
ref:
|
|
134750
|
+
ref: R,
|
|
134749
134751
|
className: "flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]",
|
|
134750
|
-
children:
|
|
134751
|
-
messages:
|
|
134752
|
-
isLoading:
|
|
134752
|
+
children: xe ? /* @__PURE__ */ (0, O.jsx)(gZe, {
|
|
134753
|
+
messages: Oe,
|
|
134754
|
+
isLoading: ke,
|
|
134753
134755
|
serverId: e.url,
|
|
134754
134756
|
readResource: s,
|
|
134755
134757
|
tools: e.tools,
|
|
134756
|
-
sendMessage: (e, t) =>
|
|
134758
|
+
sendMessage: (e, t) => je(e, [], t),
|
|
134757
134759
|
serverBaseUrl: e.url,
|
|
134758
134760
|
pendingElicitationRequests: e.pendingElicitationRequests,
|
|
134759
134761
|
onApproveElicitation: e.approveElicitation,
|
|
134760
134762
|
onRejectElicitation: e.rejectElicitation
|
|
134761
|
-
}) : /* @__PURE__ */ (0, O.jsx)(SLe, { onConfigureClick: () =>
|
|
134763
|
+
}) : /* @__PURE__ */ (0, O.jsx)(SLe, { onConfigureClick: () => le(!0) })
|
|
134762
134764
|
}),
|
|
134763
|
-
|
|
134764
|
-
|
|
134765
|
-
inputValue:
|
|
134766
|
-
isConnected: t && !
|
|
134767
|
-
isLoading:
|
|
134768
|
-
textareaRef:
|
|
134769
|
-
promptsDropdownOpen:
|
|
134770
|
-
promptFocusedIndex:
|
|
134771
|
-
prompts:
|
|
134772
|
-
promptResults:
|
|
134773
|
-
selectedPrompt:
|
|
134774
|
-
attachments:
|
|
134775
|
-
tools:
|
|
134776
|
-
disabledTools:
|
|
134777
|
-
onDisabledToolsChange:
|
|
134778
|
-
onDeletePromptResult:
|
|
134779
|
-
onPromptSelect:
|
|
134780
|
-
onInputChange:
|
|
134781
|
-
onKeyDown:
|
|
134782
|
-
onKeyUp:
|
|
134783
|
-
onClick:
|
|
134784
|
-
onSendMessage:
|
|
134785
|
-
onStopStreaming:
|
|
134786
|
-
onAttachmentAdd:
|
|
134787
|
-
onAttachmentRemove:
|
|
134788
|
-
followups:
|
|
134789
|
-
onFollowupSelect:
|
|
134765
|
+
gt,
|
|
134766
|
+
xe && /* @__PURE__ */ (0, O.jsx)(yLe, {
|
|
134767
|
+
inputValue: k,
|
|
134768
|
+
isConnected: t && !Le,
|
|
134769
|
+
isLoading: ke,
|
|
134770
|
+
textareaRef: ie,
|
|
134771
|
+
promptsDropdownOpen: M,
|
|
134772
|
+
promptFocusedIndex: P,
|
|
134773
|
+
prompts: Ue,
|
|
134774
|
+
promptResults: Je,
|
|
134775
|
+
selectedPrompt: Ge,
|
|
134776
|
+
attachments: Ae,
|
|
134777
|
+
tools: x ? void 0 : ae,
|
|
134778
|
+
disabledTools: x ? void 0 : ne,
|
|
134779
|
+
onDisabledToolsChange: x ? void 0 : re,
|
|
134780
|
+
onDeletePromptResult: Ye,
|
|
134781
|
+
onPromptSelect: at,
|
|
134782
|
+
onInputChange: j,
|
|
134783
|
+
onKeyDown: ct,
|
|
134784
|
+
onKeyUp: lt,
|
|
134785
|
+
onClick: rt,
|
|
134786
|
+
onSendMessage: ot,
|
|
134787
|
+
onStopStreaming: Pe,
|
|
134788
|
+
onAttachmentAdd: Fe,
|
|
134789
|
+
onAttachmentRemove: Ie,
|
|
134790
|
+
followups: ee,
|
|
134791
|
+
onFollowupSelect: ht
|
|
134790
134792
|
})
|
|
134791
134793
|
]
|
|
134792
134794
|
});
|
|
@@ -142121,6 +142123,7 @@ function P1e({ selectedServer: e, activeTab: t, toolsSearchRef: n, promptsSearch
|
|
|
142121
142123
|
model: "claude-haiku-4-5",
|
|
142122
142124
|
apiKey: "server-managed"
|
|
142123
142125
|
},
|
|
142126
|
+
enableFreeTierUpgrade: o.chatEnableFreeTierUpgrade,
|
|
142124
142127
|
hideTitle: o.chatHideTitle,
|
|
142125
142128
|
hideModelBadge: o.chatHideModelBadge ?? !0,
|
|
142126
142129
|
hideServerUrl: o.chatHideServerUrl ?? !0,
|
|
@@ -142192,6 +142195,7 @@ function P1e({ selectedServer: e, activeTab: t, toolsSearchRef: n, promptsSearch
|
|
|
142192
142195
|
model: "claude-haiku-4-5",
|
|
142193
142196
|
apiKey: "server-managed"
|
|
142194
142197
|
} : void 0),
|
|
142198
|
+
enableFreeTierUpgrade: o.chatEnableFreeTierUpgrade,
|
|
142195
142199
|
hideTitle: o.chatHideTitle,
|
|
142196
142200
|
hideModelBadge: o.chatHideModelBadge ?? !!o.chatApiUrl,
|
|
142197
142201
|
hideServerUrl: o.chatHideServerUrl ?? !!o.chatApiUrl,
|
|
@@ -144436,6 +144440,7 @@ function O0e({ children: e }) {
|
|
|
144436
144440
|
proxyConfig: n,
|
|
144437
144441
|
transportType: r,
|
|
144438
144442
|
preventAutoAuth: !0,
|
|
144443
|
+
useRedirectFlow: !0,
|
|
144439
144444
|
clientOptions: { capabilities: { extensions: { "io.modelcontextprotocol/ui": { mimeTypes: ["text/html;profile=mcp-app"] } } } }
|
|
144440
144445
|
});
|
|
144441
144446
|
}, [i]), u = (0, A.useCallback)(async (e, t) => {
|