@mcp-use/inspector 3.0.1-canary.1 → 3.0.1-canary.3
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
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.1-canary.
|
|
26923
|
+
return "3.0.1-canary.3";
|
|
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-ZLQASX62.js
|
|
48461
48461
|
Zp();
|
|
48462
|
-
var Hue = "1.25.1-canary.
|
|
48462
|
+
var Hue = "1.25.1-canary.3";
|
|
48463
48463
|
function KF() {
|
|
48464
48464
|
return Hue;
|
|
48465
48465
|
}
|
|
@@ -129584,7 +129584,7 @@ function QYe({ serverId: e, toolCallId: t, toolName: n, toolInput: r, toolOutput
|
|
|
129584
129584
|
onLoad: () => te(!0),
|
|
129585
129585
|
onMessage: Fe,
|
|
129586
129586
|
title: `MCP App: ${n}`,
|
|
129587
|
-
className: V(Se === "inline" && "w-full", Se === "fullscreen" && "w-full h-full rounded-none", Se === "pip" && "w-full h-full", Se !== "fullscreen" && ve && "rounded-lg", "overflow-hidden
|
|
129587
|
+
className: V(Se === "inline" && "w-full", Se === "fullscreen" && "w-full h-full rounded-none", Se === "pip" && "w-full h-full", Se !== "fullscreen" && ve && "rounded-lg", "overflow-hidden", ve && "border border-zinc-200 dark:border-zinc-700"),
|
|
129588
129588
|
style: Ve
|
|
129589
129589
|
}),
|
|
129590
129590
|
" "
|
|
@@ -132559,7 +132559,7 @@ function aZe({ componentUrl: e, toolName: t, toolArgs: n, toolResult: r, serverI
|
|
|
132559
132559
|
children: /* @__PURE__ */ (0, O.jsx)(Jp, { className: "w-4 h-4 text-foreground" })
|
|
132560
132560
|
}),
|
|
132561
132561
|
/* @__PURE__ */ (0, O.jsx)("div", {
|
|
132562
|
-
className: V("flex-1 w-full flex justify-center items-center relative
|
|
132562
|
+
className: V("flex-1 w-full flex justify-center items-center relative", P === "fullscreen" && "pt-14", M && "items-center", P === "inline" && (d || f) && "pt-8"),
|
|
132563
132563
|
children: /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
132564
132564
|
className: "relative w-full max-w-[768px]",
|
|
132565
132565
|
children: [P === "inline" && (d || f) && /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
@@ -134254,36 +134254,36 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134254
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) => ({
|
|
134255
134255
|
name: e.name,
|
|
134256
134256
|
description: e.description
|
|
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 }),
|
|
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 = !n && d != null, [ye, be] = (0, A.useState)(() => ve ? !1 : !!oe), xe = ve ? ye : n || ye || !!oe, Se = xe ? oe : d ?? oe, Ce = !xe && !!d, { getAllModelContexts: we } = Z4(), Te = we(), Ee = {
|
|
134258
134258
|
connection: e,
|
|
134259
|
-
llmConfig:
|
|
134259
|
+
llmConfig: Se,
|
|
134260
134260
|
isConnected: t,
|
|
134261
134261
|
readResource: s,
|
|
134262
|
-
widgetModelContexts:
|
|
134262
|
+
widgetModelContexts: Te,
|
|
134263
134263
|
disabledTools: ne
|
|
134264
|
-
},
|
|
134264
|
+
}, De = yZe({
|
|
134265
134265
|
mcpServerUrl: e.url,
|
|
134266
|
-
llmConfig:
|
|
134266
|
+
llmConfig: Se,
|
|
134267
134267
|
authConfig: se,
|
|
134268
134268
|
isConnected: t,
|
|
134269
134269
|
chatApiUrl: c,
|
|
134270
134270
|
waitForChatApiUrl: l,
|
|
134271
|
-
widgetModelContexts:
|
|
134271
|
+
widgetModelContexts: Te,
|
|
134272
134272
|
initialMessages: u,
|
|
134273
134273
|
disabledTools: ne,
|
|
134274
134274
|
streamProtocol: w,
|
|
134275
134275
|
credentials: T,
|
|
134276
134276
|
extraHeaders: E,
|
|
134277
134277
|
body: D
|
|
134278
|
-
}),
|
|
134279
|
-
|
|
134280
|
-
}, [
|
|
134281
|
-
le(!1),
|
|
134282
|
-
}, [le]),
|
|
134278
|
+
}), Oe = CZe(Ee), { messages: ke, isLoading: Ae, attachments: je, sendMessage: Me, clearMessages: Ne, setMessages: Pe, stop: Fe, addAttachment: Ie, removeAttachment: Le } = xe ? Oe : De, Re = xe ? null : De.rateLimitInfo ?? null, ze = xe ? void 0 : De.clearRateLimitInfo, Be = (0, A.useCallback)(() => {
|
|
134279
|
+
ze?.(), be(!0), le(!0);
|
|
134280
|
+
}, [ze, le]), [Ve, He] = (0, A.useState)(!1), B = (0, A.useCallback)(() => {
|
|
134281
|
+
le(!1), He(!0);
|
|
134282
|
+
}, [le]), Ue = Ce && f ? { onLoginClick: B } : void 0, We = !!d && !!h, Ge = We || !!h && !xe, { filteredPrompts: Ke, setSelectedPrompt: qe, selectedPrompt: Je, setPromptArgs: Ye, executePrompt: Xe, results: Ze, handleDeleteResult: Qe, clearPromptResults: $e } = fIe({
|
|
134283
134283
|
prompts: i,
|
|
134284
134284
|
callPrompt: o,
|
|
134285
134285
|
serverId: a
|
|
134286
|
-
}),
|
|
134286
|
+
}), et = (0, A.useCallback)((e) => Array.isArray(e) ? e.filter((e) => typeof e == "string").map((e) => e.trim()).filter(Boolean).slice(0, 8) : [], []), tt = (0, A.useCallback)((e) => {
|
|
134287
134287
|
if (typeof e.content == "string" && e.content.trim()) return e.content;
|
|
134288
134288
|
if (Array.isArray(e.content) && e.content.length > 0) return e.content.map((e) => typeof e == "string" ? e : e.text ?? "").join("");
|
|
134289
134289
|
if (e.parts && e.parts.length > 0) {
|
|
@@ -134291,7 +134291,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134291
134291
|
if (t.length > 0) return t.join("\n");
|
|
134292
134292
|
}
|
|
134293
134293
|
return "";
|
|
134294
|
-
}, []),
|
|
134294
|
+
}, []), nt = (0, A.useCallback)((e) => {
|
|
134295
134295
|
if (e == null) return "No result";
|
|
134296
134296
|
if (typeof e == "string") try {
|
|
134297
134297
|
let t = JSON.parse(e);
|
|
@@ -134314,8 +134314,8 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134314
134314
|
}).join("\n\n");
|
|
134315
134315
|
}
|
|
134316
134316
|
return JSON.stringify(e, null, 2);
|
|
134317
|
-
}, []),
|
|
134318
|
-
let t =
|
|
134317
|
+
}, []), rt = (0, A.useCallback)(() => ke.map((e) => {
|
|
134318
|
+
let t = tt(e), n = e.parts?.filter((e) => e.type === "tool-invocation" && e.toolInvocation).map((e) => ({
|
|
134319
134319
|
toolName: e.toolInvocation.toolName,
|
|
134320
134320
|
args: e.toolInvocation.args,
|
|
134321
134321
|
state: e.toolInvocation.state,
|
|
@@ -134328,7 +134328,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134328
134328
|
timestamp: e.timestamp,
|
|
134329
134329
|
toolInvocations: n?.length ? n : void 0
|
|
134330
134330
|
};
|
|
134331
|
-
}), [
|
|
134331
|
+
}), [ke, tt]), it = (0, A.useCallback)((e, t = {}) => {
|
|
134332
134332
|
typeof window > "u" || window.parent === window || window.parent.postMessage({
|
|
134333
134333
|
type: e,
|
|
134334
134334
|
serverId: a,
|
|
@@ -134336,7 +134336,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134336
134336
|
}, "*");
|
|
134337
134337
|
}, [a]);
|
|
134338
134338
|
(0, A.useEffect)(() => {
|
|
134339
|
-
|
|
134339
|
+
it("mcp-inspector:chat:ready", { capabilities: {
|
|
134340
134340
|
send: !0,
|
|
134341
134341
|
clear: !0,
|
|
134342
134342
|
getState: !0,
|
|
@@ -134344,20 +134344,20 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134344
134344
|
setFollowups: !0,
|
|
134345
134345
|
loadMessages: !0
|
|
134346
134346
|
} });
|
|
134347
|
-
}, [
|
|
134348
|
-
|
|
134349
|
-
isLoading:
|
|
134350
|
-
messageCount:
|
|
134351
|
-
messages:
|
|
134347
|
+
}, [it]), (0, A.useEffect)(() => {
|
|
134348
|
+
it("mcp-inspector:chat:state_changed", {
|
|
134349
|
+
isLoading: Ae,
|
|
134350
|
+
messageCount: ke.length,
|
|
134351
|
+
messages: rt(),
|
|
134352
134352
|
quickQuestions: I,
|
|
134353
134353
|
followups: ee
|
|
134354
134354
|
});
|
|
134355
134355
|
}, [
|
|
134356
134356
|
ee,
|
|
134357
|
-
|
|
134358
|
-
|
|
134359
|
-
|
|
134360
|
-
|
|
134357
|
+
rt,
|
|
134358
|
+
Ae,
|
|
134359
|
+
ke.length,
|
|
134360
|
+
it,
|
|
134361
134361
|
I
|
|
134362
134362
|
]), (0, A.useEffect)(() => {
|
|
134363
134363
|
let e = (e) => {
|
|
@@ -134365,7 +134365,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134365
134365
|
let n = e.data;
|
|
134366
134366
|
if (!n.type?.startsWith("mcp-inspector:chat:") || n.serverId && n.serverId !== a) return;
|
|
134367
134367
|
let r = n.requestId, i = (e, t = {}) => {
|
|
134368
|
-
|
|
134368
|
+
it("mcp-inspector:chat:command_result", {
|
|
134369
134369
|
requestId: r,
|
|
134370
134370
|
ok: e,
|
|
134371
134371
|
...t
|
|
@@ -134377,12 +134377,12 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134377
134377
|
i(!1, { error: "Missing message" });
|
|
134378
134378
|
return;
|
|
134379
134379
|
}
|
|
134380
|
-
if (!
|
|
134380
|
+
if (!Se || !t) {
|
|
134381
134381
|
i(!1, { error: "Chat is not ready to send messages" });
|
|
134382
134382
|
return;
|
|
134383
134383
|
}
|
|
134384
|
-
|
|
134385
|
-
|
|
134384
|
+
Me(e, []).then(() => {
|
|
134385
|
+
it("mcp-inspector:chat:message_sent", {
|
|
134386
134386
|
requestId: r,
|
|
134387
134387
|
message: e,
|
|
134388
134388
|
source: "bridge"
|
|
@@ -134393,27 +134393,27 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134393
134393
|
return;
|
|
134394
134394
|
}
|
|
134395
134395
|
if (n.type === "mcp-inspector:chat:clear") {
|
|
134396
|
-
|
|
134396
|
+
Ne(), it("mcp-inspector:chat:cleared", { requestId: r }), i(!0);
|
|
134397
134397
|
return;
|
|
134398
134398
|
}
|
|
134399
134399
|
if (n.type === "mcp-inspector:chat:get_state") {
|
|
134400
|
-
|
|
134400
|
+
it("mcp-inspector:chat:state", {
|
|
134401
134401
|
requestId: r,
|
|
134402
|
-
isLoading:
|
|
134403
|
-
messageCount:
|
|
134404
|
-
messages:
|
|
134402
|
+
isLoading: Ae,
|
|
134403
|
+
messageCount: ke.length,
|
|
134404
|
+
messages: rt(),
|
|
134405
134405
|
quickQuestions: I,
|
|
134406
134406
|
followups: ee
|
|
134407
134407
|
}), i(!0);
|
|
134408
134408
|
return;
|
|
134409
134409
|
}
|
|
134410
134410
|
if (n.type === "mcp-inspector:chat:set_quick_questions") {
|
|
134411
|
-
let e =
|
|
134411
|
+
let e = et(n.questions);
|
|
134412
134412
|
L(e), i(!0, { quickQuestions: e });
|
|
134413
134413
|
return;
|
|
134414
134414
|
}
|
|
134415
134415
|
if (n.type === "mcp-inspector:chat:set_followups") {
|
|
134416
|
-
let e =
|
|
134416
|
+
let e = et(n.followups);
|
|
134417
134417
|
te(e), i(!0, { followups: e });
|
|
134418
134418
|
return;
|
|
134419
134419
|
}
|
|
@@ -134423,7 +134423,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134423
134423
|
i(!1, { error: "messages must be an array" });
|
|
134424
134424
|
return;
|
|
134425
134425
|
}
|
|
134426
|
-
|
|
134426
|
+
Pe(e), i(!0, { count: e.length });
|
|
134427
134427
|
return;
|
|
134428
134428
|
}
|
|
134429
134429
|
if (n.type === "mcp-inspector:chat:screenshot") {
|
|
@@ -134469,7 +134469,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134469
134469
|
} catch (e) {
|
|
134470
134470
|
s = e instanceof Error ? e.message : String(e);
|
|
134471
134471
|
}
|
|
134472
|
-
if (a)
|
|
134472
|
+
if (a) it("mcp-inspector:chat:screenshot_result", {
|
|
134473
134473
|
requestId: r,
|
|
134474
134474
|
toolCallId: e || null,
|
|
134475
134475
|
image: a,
|
|
@@ -134477,7 +134477,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134477
134477
|
}), i(!0);
|
|
134478
134478
|
else {
|
|
134479
134479
|
let t = R.current || document.body, n = t.innerText?.substring(0, 5e3) || "", a = t.innerHTML?.substring(0, 1e4) || "";
|
|
134480
|
-
|
|
134480
|
+
it("mcp-inspector:chat:screenshot_result", {
|
|
134481
134481
|
requestId: r,
|
|
134482
134482
|
toolCallId: e || null,
|
|
134483
134483
|
image: "",
|
|
@@ -134489,7 +134489,7 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134489
134489
|
}
|
|
134490
134490
|
} catch (t) {
|
|
134491
134491
|
let n = (R.current || document.body).innerText?.substring(0, 5e3) || "";
|
|
134492
|
-
|
|
134492
|
+
it("mcp-inspector:chat:screenshot_result", {
|
|
134493
134493
|
requestId: r,
|
|
134494
134494
|
toolCallId: e || null,
|
|
134495
134495
|
image: "",
|
|
@@ -134504,46 +134504,46 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134504
134504
|
};
|
|
134505
134505
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
134506
134506
|
}, [
|
|
134507
|
-
Me,
|
|
134508
134507
|
Ne,
|
|
134508
|
+
Pe,
|
|
134509
134509
|
ee,
|
|
134510
|
-
|
|
134511
|
-
|
|
134512
|
-
|
|
134513
|
-
|
|
134510
|
+
rt,
|
|
134511
|
+
Ae,
|
|
134512
|
+
ke.length,
|
|
134513
|
+
it,
|
|
134514
134514
|
I,
|
|
134515
|
-
|
|
134516
|
-
|
|
134515
|
+
et,
|
|
134516
|
+
Me,
|
|
134517
134517
|
a,
|
|
134518
|
-
|
|
134518
|
+
Se,
|
|
134519
134519
|
t
|
|
134520
|
-
]), a0(r ? { onNewChat:
|
|
134521
|
-
let
|
|
134520
|
+
]), a0(r ? { onNewChat: Ne } : {});
|
|
134521
|
+
let at = (0, A.useCallback)(() => {
|
|
134522
134522
|
F(-1), N(!1), z.current = null;
|
|
134523
|
-
}, []),
|
|
134523
|
+
}, []), ot = (0, A.useCallback)(() => {
|
|
134524
134524
|
if (!ie.current) return;
|
|
134525
134525
|
let e = ie.current.selectionStart, t = k.slice(0, e), n = kZe.test(t);
|
|
134526
134526
|
N(n), n ? (z.current = {
|
|
134527
134527
|
start: e - 1,
|
|
134528
134528
|
end: e
|
|
134529
|
-
}, F(0)) :
|
|
134530
|
-
}, [k,
|
|
134529
|
+
}, F(0)) : at();
|
|
134530
|
+
}, [k, at]);
|
|
134531
134531
|
(0, A.useEffect)(() => {
|
|
134532
|
-
|
|
134533
|
-
}, [
|
|
134534
|
-
!
|
|
134535
|
-
}, [
|
|
134536
|
-
ie.current &&
|
|
134537
|
-
}, [k,
|
|
134538
|
-
let
|
|
134539
|
-
|
|
134540
|
-
}, [
|
|
134541
|
-
if (
|
|
134542
|
-
|
|
134532
|
+
Se && ke.length === 0 && ie.current && ie.current.focus();
|
|
134533
|
+
}, [Se, ke.length]), (0, A.useEffect)(() => {
|
|
134534
|
+
!Ae && ke.length > 0 && ie.current && ie.current.focus();
|
|
134535
|
+
}, [Ae, ke.length]), (0, A.useEffect)(() => {
|
|
134536
|
+
ie.current && ot();
|
|
134537
|
+
}, [k, ot]);
|
|
134538
|
+
let st = (0, A.useCallback)(() => {
|
|
134539
|
+
qe(null), Ye({}), at();
|
|
134540
|
+
}, [at]), ct = (0, A.useCallback)(async (e) => {
|
|
134541
|
+
if (qe(e), e.arguments && e.arguments.length > 0) {
|
|
134542
|
+
qe(null), EB.error("Prompts with arguments are not supported", { description: "This prompt requires arguments which are not yet supported in chat mode." });
|
|
134543
134543
|
return;
|
|
134544
134544
|
}
|
|
134545
134545
|
try {
|
|
134546
|
-
await
|
|
134546
|
+
await Xe(e, {});
|
|
134547
134547
|
} catch (e) {
|
|
134548
134548
|
console.error("Error executing prompt", e);
|
|
134549
134549
|
} finally {
|
|
@@ -134553,65 +134553,65 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134553
134553
|
ie.current?.focus(), ie.current?.setSelectionRange(e, e);
|
|
134554
134554
|
});
|
|
134555
134555
|
}
|
|
134556
|
-
|
|
134556
|
+
st();
|
|
134557
134557
|
}
|
|
134558
134558
|
}, [
|
|
134559
|
-
|
|
134560
|
-
|
|
134559
|
+
Xe,
|
|
134560
|
+
st,
|
|
134561
134561
|
k
|
|
134562
|
-
]),
|
|
134563
|
-
(k.trim() ||
|
|
134562
|
+
]), lt = (0, A.useCallback)(() => {
|
|
134563
|
+
(k.trim() || Ze.length > 0 || je.length > 0) && (Me(k, Ze), j(""), $e());
|
|
134564
134564
|
}, [
|
|
134565
134565
|
k,
|
|
134566
|
-
|
|
134567
|
-
|
|
134568
|
-
|
|
134569
|
-
|
|
134570
|
-
]),
|
|
134571
|
-
if (e.key === "ArrowDown") F((e) =>
|
|
134572
|
-
else if (e.key === "ArrowUp") F((e) =>
|
|
134573
|
-
else if (e.key === "Escape") e.stopPropagation(),
|
|
134566
|
+
Ze,
|
|
134567
|
+
Me,
|
|
134568
|
+
$e,
|
|
134569
|
+
je
|
|
134570
|
+
]), ut = (0, A.useCallback)((e) => {
|
|
134571
|
+
if (e.key === "ArrowDown") F((e) => Ke.length === 0 ? -1 : (e + 1) % Ke.length);
|
|
134572
|
+
else if (e.key === "ArrowUp") F((e) => Ke.length === 0 ? -1 : (e - 1 + Ke.length) % Ke.length);
|
|
134573
|
+
else if (e.key === "Escape") e.stopPropagation(), at();
|
|
134574
134574
|
else if (e.key === "Enter" && P >= 0) {
|
|
134575
|
-
let e =
|
|
134576
|
-
e &&
|
|
134575
|
+
let e = Ke[P];
|
|
134576
|
+
e && ct(e);
|
|
134577
134577
|
}
|
|
134578
134578
|
}, [
|
|
134579
|
-
|
|
134579
|
+
Ke,
|
|
134580
134580
|
P,
|
|
134581
|
-
|
|
134582
|
-
|
|
134583
|
-
]),
|
|
134584
|
-
AZe.includes(e.key) && M ? (e.preventDefault(),
|
|
134581
|
+
ct,
|
|
134582
|
+
at
|
|
134583
|
+
]), dt = (0, A.useCallback)((e) => {
|
|
134584
|
+
AZe.includes(e.key) && M ? (e.preventDefault(), ut(e)) : e.key === "Enter" && !e.shiftKey && (e.preventDefault(), lt());
|
|
134585
134585
|
}, [
|
|
134586
|
-
|
|
134587
|
-
|
|
134586
|
+
lt,
|
|
134587
|
+
ut,
|
|
134588
134588
|
M
|
|
134589
|
-
]),
|
|
134590
|
-
(e.key === "ArrowLeft" || e.key === "ArrowRight") &&
|
|
134591
|
-
}, [
|
|
134589
|
+
]), ft = (0, A.useCallback)((e) => {
|
|
134590
|
+
(e.key === "ArrowLeft" || e.key === "ArrowRight") && ot();
|
|
134591
|
+
}, [ot]), pt = (0, A.useCallback)((e) => {
|
|
134592
134592
|
let t = `# Chat Export - ${(/* @__PURE__ */ new Date()).toLocaleString()}\n\n`;
|
|
134593
134593
|
return t += e.map((e) => {
|
|
134594
134594
|
let t = e.role.charAt(0).toUpperCase() + e.role.slice(1);
|
|
134595
134595
|
if (!e.parts || e.parts.length === 0) {
|
|
134596
|
-
let n =
|
|
134596
|
+
let n = tt(e).trim();
|
|
134597
134597
|
return n ? `## ${t}\n${n}` : "";
|
|
134598
134598
|
}
|
|
134599
134599
|
let n = [];
|
|
134600
134600
|
for (let t of e.parts) if (t.type === "text" && t.text?.trim()) n.push(t.text.trim());
|
|
134601
134601
|
else if (t.type === "tool-invocation" && t.toolInvocation) {
|
|
134602
|
-
let e = t.toolInvocation, r =
|
|
134602
|
+
let e = t.toolInvocation, r = nt(e.result);
|
|
134603
134603
|
n.push(`#### ${e.toolName}\n**Arguments:**\n\`\`\`json\n${JSON.stringify(e.args, null, 2)}\n\`\`\`\n**Result:**\n\n${r}`);
|
|
134604
134604
|
}
|
|
134605
134605
|
return n.length === 0 ? "" : `## ${t}\n\n${n.join("\n\n")}`;
|
|
134606
134606
|
}).filter((e) => e !== "").join("\n\n---\n\n"), t;
|
|
134607
|
-
}, [
|
|
134608
|
-
yz(
|
|
134609
|
-
}, [
|
|
134607
|
+
}, [tt, nt]), mt = (0, A.useCallback)(() => {
|
|
134608
|
+
yz(pt(ke)).then(() => EB.success("Chat copied to clipboard"), () => EB.error("Failed to copy chat"));
|
|
134609
|
+
}, [ke, pt]), ht = (0, A.useCallback)((e) => {
|
|
134610
134610
|
let t = `chat-export-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}`;
|
|
134611
|
-
if (e === "json") Uye(
|
|
134611
|
+
if (e === "json") Uye(ke.map((e) => ({
|
|
134612
134612
|
id: e.id,
|
|
134613
134613
|
role: e.role,
|
|
134614
|
-
content:
|
|
134614
|
+
content: tt(e),
|
|
134615
134615
|
timestamp: e.timestamp,
|
|
134616
134616
|
toolInvocations: e.parts?.filter((e) => e.type === "tool-invocation" && e.toolInvocation).map((e) => ({
|
|
134617
134617
|
toolName: e.toolInvocation.toolName,
|
|
@@ -134620,48 +134620,48 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134620
134620
|
}))
|
|
134621
134621
|
})), t + ".json");
|
|
134622
134622
|
else {
|
|
134623
|
-
let e =
|
|
134623
|
+
let e = pt(ke), n = new Blob([e], { type: "text/markdown" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
134624
134624
|
i.href = r, i.download = t + ".md", document.body.appendChild(i), i.click(), document.body.removeChild(i), setTimeout(() => URL.revokeObjectURL(r), 100);
|
|
134625
134625
|
}
|
|
134626
134626
|
EB.success(`Chat exported as ${e.toUpperCase()}`);
|
|
134627
134627
|
}, [
|
|
134628
|
-
|
|
134629
|
-
|
|
134630
|
-
|
|
134631
|
-
]),
|
|
134632
|
-
_e(),
|
|
134633
|
-
}, [_e,
|
|
134634
|
-
e.trim() && (!
|
|
134635
|
-
|
|
134628
|
+
ke,
|
|
134629
|
+
pt,
|
|
134630
|
+
tt
|
|
134631
|
+
]), gt = (0, A.useCallback)(() => {
|
|
134632
|
+
_e(), Ne();
|
|
134633
|
+
}, [_e, Ne]), _t = (0, A.useCallback)((e) => {
|
|
134634
|
+
e.trim() && (!Se || !t || Me(e, []).then(() => {
|
|
134635
|
+
it("mcp-inspector:chat:message_sent", {
|
|
134636
134636
|
message: e,
|
|
134637
134637
|
source: "quick_question"
|
|
134638
134638
|
});
|
|
134639
134639
|
}));
|
|
134640
134640
|
}, [
|
|
134641
|
-
|
|
134642
|
-
|
|
134643
|
-
|
|
134641
|
+
it,
|
|
134642
|
+
Me,
|
|
134643
|
+
Se,
|
|
134644
134644
|
t
|
|
134645
|
-
]),
|
|
134646
|
-
e.trim() && (!
|
|
134647
|
-
|
|
134645
|
+
]), vt = (0, A.useCallback)((e) => {
|
|
134646
|
+
e.trim() && (!Se || !t || Me(e, []).then(() => {
|
|
134647
|
+
it("mcp-inspector:chat:message_sent", {
|
|
134648
134648
|
message: e,
|
|
134649
134649
|
source: "followup"
|
|
134650
134650
|
});
|
|
134651
134651
|
}));
|
|
134652
134652
|
}, [
|
|
134653
|
-
|
|
134654
|
-
|
|
134655
|
-
|
|
134653
|
+
it,
|
|
134654
|
+
Me,
|
|
134655
|
+
Se,
|
|
134656
134656
|
t
|
|
134657
|
-
]),
|
|
134657
|
+
]), yt = (Re || Ve) && c ? /* @__PURE__ */ (0, O.jsx)(OZe, {
|
|
134658
134658
|
authOrigin: new URL(c).origin,
|
|
134659
134659
|
onDismiss: () => {
|
|
134660
|
-
|
|
134660
|
+
ze?.(), He(!1);
|
|
134661
134661
|
},
|
|
134662
|
-
onUseApiKey:
|
|
134662
|
+
onUseApiKey: Be
|
|
134663
134663
|
}) : null;
|
|
134664
|
-
return
|
|
134664
|
+
return Se && ke.length === 0 ? /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
134665
134665
|
className: "flex flex-col h-full",
|
|
134666
134666
|
children: [
|
|
134667
134667
|
/* @__PURE__ */ (0, O.jsx)("div", {
|
|
@@ -134676,57 +134676,57 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134676
134676
|
onModelChange: he,
|
|
134677
134677
|
onApiKeyChange: pe,
|
|
134678
134678
|
onSave: ge,
|
|
134679
|
-
onClear:
|
|
134680
|
-
showClearButton: !
|
|
134679
|
+
onClear: gt,
|
|
134680
|
+
showClearButton: !Ce,
|
|
134681
134681
|
buttonLabel: "Change API Key",
|
|
134682
|
-
freeTierInfo:
|
|
134682
|
+
freeTierInfo: Ue
|
|
134683
134683
|
})
|
|
134684
134684
|
}),
|
|
134685
134685
|
/* @__PURE__ */ (0, O.jsx)(xLe, {
|
|
134686
134686
|
mcpServerUrl: e.url,
|
|
134687
134687
|
inputValue: k,
|
|
134688
134688
|
isConnected: t,
|
|
134689
|
-
isLoading:
|
|
134689
|
+
isLoading: Ae,
|
|
134690
134690
|
textareaRef: ie,
|
|
134691
|
-
llmConfig:
|
|
134691
|
+
llmConfig: Se,
|
|
134692
134692
|
promptsDropdownOpen: M,
|
|
134693
134693
|
promptFocusedIndex: P,
|
|
134694
|
-
prompts:
|
|
134695
|
-
selectedPrompt:
|
|
134696
|
-
promptResults:
|
|
134697
|
-
attachments:
|
|
134694
|
+
prompts: Ke,
|
|
134695
|
+
selectedPrompt: Je,
|
|
134696
|
+
promptResults: Ze,
|
|
134697
|
+
attachments: je,
|
|
134698
134698
|
tools: x ? void 0 : ae,
|
|
134699
134699
|
disabledTools: x ? void 0 : ne,
|
|
134700
134700
|
onDisabledToolsChange: x ? void 0 : re,
|
|
134701
|
-
onDeletePromptResult:
|
|
134702
|
-
onPromptSelect:
|
|
134701
|
+
onDeletePromptResult: Qe,
|
|
134702
|
+
onPromptSelect: ct,
|
|
134703
134703
|
onInputChange: j,
|
|
134704
|
-
onKeyDown:
|
|
134705
|
-
onKeyUp:
|
|
134706
|
-
onClick:
|
|
134704
|
+
onKeyDown: dt,
|
|
134705
|
+
onKeyUp: ft,
|
|
134706
|
+
onClick: ot,
|
|
134707
134707
|
onSubmit: (e) => {
|
|
134708
|
-
e.preventDefault(),
|
|
134708
|
+
e.preventDefault(), lt();
|
|
134709
134709
|
},
|
|
134710
134710
|
onConfigDialogOpenChange: le,
|
|
134711
|
-
onAttachmentAdd:
|
|
134712
|
-
onAttachmentRemove:
|
|
134713
|
-
hideModelBadge:
|
|
134711
|
+
onAttachmentAdd: Ie,
|
|
134712
|
+
onAttachmentRemove: Le,
|
|
134713
|
+
hideModelBadge: Ge,
|
|
134714
134714
|
hideServerUrl: g,
|
|
134715
134715
|
quickQuestions: I,
|
|
134716
|
-
onQuickQuestionSelect:
|
|
134717
|
-
freeTierInfo:
|
|
134716
|
+
onQuickQuestionSelect: _t,
|
|
134717
|
+
freeTierInfo: Ue
|
|
134718
134718
|
}),
|
|
134719
|
-
|
|
134719
|
+
yt
|
|
134720
134720
|
]
|
|
134721
134721
|
}) : /* @__PURE__ */ (0, O.jsxs)("div", {
|
|
134722
134722
|
className: "flex flex-col h-full relative",
|
|
134723
134723
|
children: [
|
|
134724
134724
|
/* @__PURE__ */ (0, O.jsx)(KIe, {
|
|
134725
|
-
llmConfig:
|
|
134726
|
-
hasMessages:
|
|
134725
|
+
llmConfig: Se,
|
|
134726
|
+
hasMessages: ke.length > 0,
|
|
134727
134727
|
configDialogOpen: ce,
|
|
134728
134728
|
onConfigDialogOpenChange: le,
|
|
134729
|
-
onClearChat:
|
|
134729
|
+
onClearChat: Ne,
|
|
134730
134730
|
tempProvider: ue,
|
|
134731
134731
|
tempModel: me,
|
|
134732
134732
|
tempApiKey: fe,
|
|
@@ -134734,11 +134734,11 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134734
134734
|
onModelChange: he,
|
|
134735
134735
|
onApiKeyChange: pe,
|
|
134736
134736
|
onSaveConfig: ge,
|
|
134737
|
-
onClearConfig:
|
|
134738
|
-
hideConfigButton:
|
|
134739
|
-
freeTierInfo:
|
|
134740
|
-
onCopyChat:
|
|
134741
|
-
onExportChat:
|
|
134737
|
+
onClearConfig: gt,
|
|
134738
|
+
hideConfigButton: Ce && !Ue || We,
|
|
134739
|
+
freeTierInfo: Ue,
|
|
134740
|
+
onCopyChat: mt,
|
|
134741
|
+
onExportChat: ht,
|
|
134742
134742
|
clearButtonLabel: p,
|
|
134743
134743
|
hideTitle: m,
|
|
134744
134744
|
clearButtonHideIcon: _,
|
|
@@ -134749,46 +134749,46 @@ function jZe({ connection: e, isConnected: t, useClientSide: n = !0, enableKeybo
|
|
|
134749
134749
|
/* @__PURE__ */ (0, O.jsx)("div", {
|
|
134750
134750
|
ref: R,
|
|
134751
134751
|
className: "flex-1 overflow-y-auto p-2 sm:p-4 pt-[80px] sm:pt-[100px]",
|
|
134752
|
-
children:
|
|
134753
|
-
messages:
|
|
134754
|
-
isLoading:
|
|
134752
|
+
children: Se ? /* @__PURE__ */ (0, O.jsx)(gZe, {
|
|
134753
|
+
messages: ke,
|
|
134754
|
+
isLoading: Ae,
|
|
134755
134755
|
serverId: e.url,
|
|
134756
134756
|
readResource: s,
|
|
134757
134757
|
tools: e.tools,
|
|
134758
|
-
sendMessage: (e, t) =>
|
|
134758
|
+
sendMessage: (e, t) => Me(e, [], t),
|
|
134759
134759
|
serverBaseUrl: e.url,
|
|
134760
134760
|
pendingElicitationRequests: e.pendingElicitationRequests,
|
|
134761
134761
|
onApproveElicitation: e.approveElicitation,
|
|
134762
134762
|
onRejectElicitation: e.rejectElicitation
|
|
134763
134763
|
}) : /* @__PURE__ */ (0, O.jsx)(SLe, { onConfigureClick: () => le(!0) })
|
|
134764
134764
|
}),
|
|
134765
|
-
|
|
134766
|
-
|
|
134765
|
+
yt,
|
|
134766
|
+
Se && /* @__PURE__ */ (0, O.jsx)(yLe, {
|
|
134767
134767
|
inputValue: k,
|
|
134768
|
-
isConnected: t && !
|
|
134769
|
-
isLoading:
|
|
134768
|
+
isConnected: t && !Re,
|
|
134769
|
+
isLoading: Ae,
|
|
134770
134770
|
textareaRef: ie,
|
|
134771
134771
|
promptsDropdownOpen: M,
|
|
134772
134772
|
promptFocusedIndex: P,
|
|
134773
|
-
prompts:
|
|
134774
|
-
promptResults:
|
|
134775
|
-
selectedPrompt:
|
|
134776
|
-
attachments:
|
|
134773
|
+
prompts: Ke,
|
|
134774
|
+
promptResults: Ze,
|
|
134775
|
+
selectedPrompt: Je,
|
|
134776
|
+
attachments: je,
|
|
134777
134777
|
tools: x ? void 0 : ae,
|
|
134778
134778
|
disabledTools: x ? void 0 : ne,
|
|
134779
134779
|
onDisabledToolsChange: x ? void 0 : re,
|
|
134780
|
-
onDeletePromptResult:
|
|
134781
|
-
onPromptSelect:
|
|
134780
|
+
onDeletePromptResult: Qe,
|
|
134781
|
+
onPromptSelect: ct,
|
|
134782
134782
|
onInputChange: j,
|
|
134783
|
-
onKeyDown:
|
|
134784
|
-
onKeyUp:
|
|
134785
|
-
onClick:
|
|
134786
|
-
onSendMessage:
|
|
134787
|
-
onStopStreaming:
|
|
134788
|
-
onAttachmentAdd:
|
|
134789
|
-
onAttachmentRemove:
|
|
134783
|
+
onKeyDown: dt,
|
|
134784
|
+
onKeyUp: ft,
|
|
134785
|
+
onClick: ot,
|
|
134786
|
+
onSendMessage: lt,
|
|
134787
|
+
onStopStreaming: Fe,
|
|
134788
|
+
onAttachmentAdd: Ie,
|
|
134789
|
+
onAttachmentRemove: Le,
|
|
134790
134790
|
followups: ee,
|
|
134791
|
-
onFollowupSelect:
|
|
134791
|
+
onFollowupSelect: vt
|
|
134792
134792
|
})
|
|
134793
134793
|
]
|
|
134794
134794
|
});
|