@mcp-use/inspector 20.0.0-beta.13 → 20.0.0-beta.15
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 +4 -4
- package/dist/cdn/inspector.js +76858 -9272
- package/dist/cli.js +69 -24
- package/dist/server/asset-urls.d.ts +1 -4
- package/dist/server/asset-urls.d.ts.map +1 -1
- package/dist/server/asset-urls.js +3 -7
- package/dist/server/cdn-shell.d.ts.map +1 -1
- package/dist/server/cdn-shell.js +3 -3
- package/dist/server/{chunk-H6ZCIKBS.js → chunk-JZT7N2BJ.js} +10 -15
- package/dist/server/{chunk-YAYRN4DW.js → chunk-WNQGHIZ3.js} +61 -15
- package/dist/server/{chunk-QQP554HG.js → chunk-XKCUJ6ZJ.js} +1 -1
- package/dist/server/{chunk-2XQWLYOZ.js → chunk-ZPGABKXL.js} +1 -1
- package/dist/server/cli.js +3 -3
- package/dist/server/index.js +4 -4
- package/dist/server/middleware.js +4 -4
- package/dist/server/version.js +1 -1
- package/dist/web/assets/index-Bqfsh_Rp.js +643 -0
- package/dist/web/index.html +2 -10
- package/package.json +2 -2
- package/dist/cdn/AnimatePresence-D1bZ5_-l.js +0 -394
- package/dist/cdn/ChatTab-CokP5UlL.js +0 -6811
- package/dist/cdn/CheckboxIndicator-BjF73mGX.js +0 -252
- package/dist/cdn/ConnectionSettingsForm-CXCKdMZh.js +0 -929
- package/dist/cdn/ConnectionSettingsTab-Ag4WD55h.js +0 -151
- package/dist/cdn/ElicitationTab-PEmEDvC5.js +0 -655
- package/dist/cdn/FormContext-NtUiZclE.js +0 -135
- package/dist/cdn/InspectorContext-BBKCdfmK.js +0 -123
- package/dist/cdn/JSONDisplay-BJqMz7Ny.js +0 -324
- package/dist/cdn/ListTabHeader-DzmTtN1e.js +0 -89
- package/dist/cdn/MCPAppsDebugControls-C01DPDJv.js +0 -2174
- package/dist/cdn/ManufactOAuthCallback-ChbbjFIT.js +0 -31
- package/dist/cdn/MarkdownRenderer-CrG5JHAZ.js +0 -3610
- package/dist/cdn/McpAppsViewPanel-07_iHrne.js +0 -56
- package/dist/cdn/NotificationsTab-B7uebqMV.js +0 -290
- package/dist/cdn/OAuthCallback-Cku-R2uM.js +0 -58
- package/dist/cdn/PromptsTab-98ugje_q.js +0 -902
- package/dist/cdn/ResourcesTab-CxHilZjd.js +0 -566
- package/dist/cdn/SamplingTab-gOUjg7bt.js +0 -659
- package/dist/cdn/ServerMetadataTab-BM3VhSLf.js +0 -244
- package/dist/cdn/StatusIcon-Q3n3YRtE.js +0 -65
- package/dist/cdn/ToolsTab-Dm6n5OxE.js +0 -2045
- package/dist/cdn/ViewPreview-CCKWd8Qt.js +0 -238
- package/dist/cdn/WidgetDebugContext-B6yoOVVV.js +0 -314
- package/dist/cdn/WidgetWrapper-BlbQAh_X.js +0 -12
- package/dist/cdn/basePath-B8HuhIMu.js +0 -25
- package/dist/cdn/bell-GrTZcnD2.js +0 -10
- package/dist/cdn/browser-DG2Z8392.js +0 -42
- package/dist/cdn/brush-CelVvMGp.js +0 -17
- package/dist/cdn/button-CB4uOoUV.js +0 -2509
- package/dist/cdn/card-BA-DQk-G.js +0 -41
- package/dist/cdn/cfWorker-Bxcs9rNe.js +0 -10799
- package/dist/cdn/checkbox-kwVa4gRX.js +0 -20
- package/dist/cdn/chunk-QUQL4437-XnDcYQEx.js +0 -1508
- package/dist/cdn/clock-YMF8Gtw5.js +0 -12
- package/dist/cdn/code-C8sN2OGR.js +0 -10
- package/dist/cdn/createLucideIcon-BONxC1L5.js +0 -213
- package/dist/cdn/dialog-CJGnC5Ag.js +0 -1028
- package/dist/cdn/dist-C-AJLM5q.js +0 -2307
- package/dist/cdn/dist-CTJnCYmk.js +0 -616
- package/dist/cdn/external-link-Bo4lQxr1.js +0 -17
- package/dist/cdn/eye-pSGG7nvf.js +0 -29
- package/dist/cdn/folder-open-aM8CPtBO.js +0 -7
- package/dist/cdn/hash-DDs2vE1k.js +0 -33
- package/dist/cdn/history-BfUFpL1d.js +0 -17
- package/dist/cdn/index-browser-CCygKh3z.js +0 -1853
- package/dist/cdn/info-BMkB68mB.js +0 -19
- package/dist/cdn/input-BCpgLXU1.js +0 -9654
- package/dist/cdn/inspector-settings-layout-0VDsjeqb.js +0 -4
- package/dist/cdn/label-A0UGV8FE.js +0 -60
- package/dist/cdn/loader-circle-BKRHJEB7.js +0 -7
- package/dist/cdn/manufact-auth-BQMHhbLV.js +0 -423
- package/dist/cdn/maximize-2-DdrB_spi.js +0 -21
- package/dist/cdn/maximize-hSOCz133.js +0 -21
- package/dist/cdn/message-square-D3tKB3uJ.js +0 -7
- package/dist/cdn/not-found-BajFyZpp.js +0 -32
- package/dist/cdn/play-B1leulYf.js +0 -7
- package/dist/cdn/providerMeta-CjGU4rID.js +0 -436
- package/dist/cdn/react-BIs9pQ3H.js +0 -926
- package/dist/cdn/react-BiVEwoxA.js +0 -5421
- package/dist/cdn/refresh-cw-CyvXrS91.js +0 -21
- package/dist/cdn/save-CmdEPUAm.js +0 -34
- package/dist/cdn/schemaHelpers-DTV38jGq.js +0 -16
- package/dist/cdn/select-CCFHjOGk.js +0 -2595
- package/dist/cdn/servers-Dd0Vcp81.js +0 -30
- package/dist/cdn/shared-CJVHJhag.js +0 -1700
- package/dist/cdn/sheet-oyq1mIyg.js +0 -2078
- package/dist/cdn/sparkles-CxeZpVtX.js +0 -23
- package/dist/cdn/spinner-Be1GlSGX.js +0 -15
- package/dist/cdn/square-check-big-C_4wbfwF.js +0 -10
- package/dist/cdn/switch-DHXEA_N5.js +0 -665
- package/dist/cdn/tabs-subtle-Dubd6Kj8.js +0 -788
- package/dist/cdn/telemetry-DyrOzsAR.js +0 -208
- package/dist/cdn/textarea-CwmI8_uI.js +0 -14
- package/dist/cdn/trash-2-BhumJAFE.js +0 -25
- package/dist/cdn/useAriaLabelledBy-Cra6w3YY.js +0 -30
- package/dist/cdn/useCompositeItem-Dhnm-7el.js +0 -26
- package/dist/cdn/useConfig-BTDwEhra.js +0 -235
- package/dist/cdn/useSavedRequests-mSIsDd4c.js +0 -51
- package/dist/cdn/useViewHostProps-C5NRGTzJ.js +0 -364
- package/dist/cdn/wrench-DvK20LUT.js +0 -7
- package/dist/cdn/x-EilKPiCX.js +0 -10
- package/dist/cdn/zap-0Wr9QO7N.js +0 -10
- package/dist/web/assets/AnimatePresence-FfDQQNFJ.js +0 -9
- package/dist/web/assets/ChatTab-BEfFVccY.js +0 -18
- package/dist/web/assets/ConnectionSettingsTab-Bb_6a0Iv.js +0 -1
- package/dist/web/assets/ElicitationTab-BP4GKiyX.js +0 -1
- package/dist/web/assets/FormContext-sV-yByKz.js +0 -1
- package/dist/web/assets/ListTabHeader-CrGae306.js +0 -1
- package/dist/web/assets/MCPAppsDebugControls-BIyFdqol.js +0 -34
- package/dist/web/assets/ManufactOAuthCallback-C7FmBqhm.js +0 -1
- package/dist/web/assets/MarkdownRenderer-Dh79xxF3.js +0 -47
- package/dist/web/assets/McpAppsViewPanel-eC3j1-Vq.js +0 -1
- package/dist/web/assets/NotificationsTab-BiZcGnsE.js +0 -1
- package/dist/web/assets/OAuthCallback-0QMKMr_h.js +0 -1
- package/dist/web/assets/PromptsTab-DP25ApgP.js +0 -15
- package/dist/web/assets/ResourcesTab-CptaN3NT.js +0 -2
- package/dist/web/assets/SamplingTab-BcdnfiwQ.js +0 -1
- package/dist/web/assets/ServerMetadataTab-DfM-a-Kp.js +0 -1
- package/dist/web/assets/ToolsTab-hSGwy5-P.js +0 -8
- package/dist/web/assets/ViewPreview-r5Me72Dm.js +0 -1
- package/dist/web/assets/WidgetWrapper-cv_BM1bY.js +0 -1
- package/dist/web/assets/brush-DX0UZ_pI.js +0 -1
- package/dist/web/assets/button-C8Xa2k4x.js +0 -1
- package/dist/web/assets/checkbox-CiCqaf9B.js +0 -1
- package/dist/web/assets/code-B14rVdNt.js +0 -1
- package/dist/web/assets/createLucideIcon-BEHeJH0M.js +0 -1
- package/dist/web/assets/dist-igO5zKmw.js +0 -21
- package/dist/web/assets/index-lCF-0iyi.js +0 -499
- package/dist/web/assets/input-C0OQCUZy.js +0 -1
- package/dist/web/assets/inspector-settings-layout-yjKRJDai.js +0 -1
- package/dist/web/assets/label-CI7JWQOo.js +0 -1
- package/dist/web/assets/maximize-2-Br1WQzT2.js +0 -1
- package/dist/web/assets/maximize-CJNgRe6S.js +0 -1
- package/dist/web/assets/react-CU_d2d5K.js +0 -1
- package/dist/web/assets/refresh-cw-B5iaAZKn.js +0 -1
- package/dist/web/assets/save-TM6fvNrt.js +0 -1
- package/dist/web/assets/schemaHelpers-DLNTQr_6.js +0 -1
- package/dist/web/assets/select-D6jzbLJn.js +0 -1
- package/dist/web/assets/shared-ChslWC1c.js +0 -1
- package/dist/web/assets/sparkles-BGYTDThM.js +0 -1
- package/dist/web/assets/tabs-subtle-BqKfSXAk.js +0 -1
- package/dist/web/assets/textarea-CRTXuRmE.js +0 -1
- package/dist/web/assets/useConfig-BoaEj10z.js +0 -1
- package/dist/web/assets/useViewHostProps-BUcH84Z-.js +0 -1
- package/dist/web/assets/zap-BDWHCVHU.js +0 -1
|
@@ -1,566 +0,0 @@
|
|
|
1
|
-
import { s as e, t } from "./react-BIs9pQ3H.js";
|
|
2
|
-
import { f as n, sr as r } from "./input-BCpgLXU1.js";
|
|
3
|
-
import { n as i } from "./createLucideIcon-BONxC1L5.js";
|
|
4
|
-
import { t as a } from "./button-CB4uOoUV.js";
|
|
5
|
-
import { t as o } from "./AnimatePresence-D1bZ5_-l.js";
|
|
6
|
-
import { n as s, t as c } from "./MCPAppsDebugControls-C01DPDJv.js";
|
|
7
|
-
import { t as l } from "./brush-CelVvMGp.js";
|
|
8
|
-
import { a as u, i as d, t as f } from "./browser-DG2Z8392.js";
|
|
9
|
-
import { n as p, t as m } from "./zap-0Wr9QO7N.js";
|
|
10
|
-
import { t as h } from "./clock-YMF8Gtw5.js";
|
|
11
|
-
import { t as g } from "./code-C8sN2OGR.js";
|
|
12
|
-
import { a as _, t as v } from "./JSONDisplay-BJqMz7Ny.js";
|
|
13
|
-
import { t as y } from "./folder-open-aM8CPtBO.js";
|
|
14
|
-
import { a as b, i as x, n as S, o as C, r as w, t as T } from "./shared-CJVHJhag.js";
|
|
15
|
-
import { t as E } from "./maximize-hSOCz133.js";
|
|
16
|
-
import { d as D, t as O } from "./telemetry-DyrOzsAR.js";
|
|
17
|
-
import { c as k, r as A, s as j } from "./react-BiVEwoxA.js";
|
|
18
|
-
import { t as M } from "./spinner-Be1GlSGX.js";
|
|
19
|
-
import { n as N } from "./InspectorContext-BBKCdfmK.js";
|
|
20
|
-
import { t as P } from "./useConfig-BTDwEhra.js";
|
|
21
|
-
import { t as F } from "./useViewHostProps-C5NRGTzJ.js";
|
|
22
|
-
import { t as I } from "./WidgetWrapper-BlbQAh_X.js";
|
|
23
|
-
//#region src/client/components/resources/ResourceResultDisplay.tsx
|
|
24
|
-
var L = /* @__PURE__ */ e(t(), 1), R = i();
|
|
25
|
-
function z(e) {
|
|
26
|
-
if ("error" in e && e.error && typeof e.error == "string") return e.error;
|
|
27
|
-
if (!("isError" in e && e.isError)) return null;
|
|
28
|
-
if ("contents" in e && Array.isArray(e.contents)) {
|
|
29
|
-
let t = e.contents.filter((e) => "text" in e).map((e) => e.text).filter(Boolean);
|
|
30
|
-
if (t.length > 0) return t.join("\n");
|
|
31
|
-
}
|
|
32
|
-
return "An error occurred";
|
|
33
|
-
}
|
|
34
|
-
function B({ serverId: e, viewId: t, resourceUri: n, toolOutput: r, toolMetadata: i, readResource: a, customProps: o, displayMode: s, onDisplayModeChange: c }) {
|
|
35
|
-
let l = (0, L.useMemo)(() => ({}), []), u = F({
|
|
36
|
-
serverId: e,
|
|
37
|
-
viewId: t,
|
|
38
|
-
resourceUri: n,
|
|
39
|
-
toolName: n,
|
|
40
|
-
toolInput: l,
|
|
41
|
-
toolOutput: r,
|
|
42
|
-
toolMetadata: i,
|
|
43
|
-
readResource: a,
|
|
44
|
-
displayMode: s,
|
|
45
|
-
onDisplayModeChange: c
|
|
46
|
-
});
|
|
47
|
-
if (!u) return /* @__PURE__ */ (0, R.jsx)(I, {
|
|
48
|
-
className: "w-full h-full min-h-[240px]",
|
|
49
|
-
children: /* @__PURE__ */ (0, R.jsx)(M, { className: "size-5" })
|
|
50
|
-
});
|
|
51
|
-
let d = s === "inline" ? "w-full h-full flex items-center justify-center relative p-4 min-h-0" : "w-full h-full relative p-4", f = o ? JSON.stringify(o) : "no-custom-props";
|
|
52
|
-
return /* @__PURE__ */ (0, R.jsx)(I, {
|
|
53
|
-
className: "w-full h-full min-h-[240px]",
|
|
54
|
-
children: /* @__PURE__ */ (0, R.jsx)(A, {
|
|
55
|
-
viewId: t,
|
|
56
|
-
toolName: n,
|
|
57
|
-
toolInput: l,
|
|
58
|
-
toolOutput: r,
|
|
59
|
-
customProps: o,
|
|
60
|
-
className: d,
|
|
61
|
-
...u
|
|
62
|
-
}, f)
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function V({ result: e, isLoading: t, previewMode: n, serverId: i, readResource: o, onTogglePreview: s, onCopy: f, onDownload: p, onFullscreen: y, isCopied: b = !1, selectedResource: x, llmConfig: S }) {
|
|
66
|
-
let [C, w] = (0, L.useState)(null), T = (0, L.useCallback)((e) => {
|
|
67
|
-
w(e);
|
|
68
|
-
}, []), [D, O] = (0, L.useState)("inline"), A = e?.result && "contents" in e.result && Array.isArray(e.result.contents) && e.result.contents[0]?._meta || {}, N = {
|
|
69
|
-
...e?.resourceAnnotations,
|
|
70
|
-
...A
|
|
71
|
-
}, P = (0, L.useMemo)(() => {
|
|
72
|
-
let e = N?.["mcp-use/propsSchema"];
|
|
73
|
-
if (!e) return [];
|
|
74
|
-
let t = e.def?.shape;
|
|
75
|
-
return t ? Object.entries(t).filter(([, e]) => {
|
|
76
|
-
let t = e?.def?.type ?? e?.type;
|
|
77
|
-
return t !== "optional" && t !== "default";
|
|
78
|
-
}).map(([e]) => e) : e.required ?? [];
|
|
79
|
-
}, [N]), F = k(N) ? "mcp-apps" : null, I = e?.result && "contents" in e.result && Array.isArray(e.result.contents) && e.result.contents.some((e) => j(e.mimeType)), V = N?.ui?.resourceUri || A?.ui?.resourceUri || (I ? e.uri : void 0), H = (F === "mcp-apps" || I) && !!V, U = P.length > 0 && !C;
|
|
80
|
-
if (t) return /* @__PURE__ */ (0, R.jsx)("div", {
|
|
81
|
-
className: "flex absolute left-0 top-0 items-center justify-center w-full h-full",
|
|
82
|
-
children: /* @__PURE__ */ (0, R.jsx)(M, { className: "size-5" })
|
|
83
|
-
});
|
|
84
|
-
if (!e) return /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
85
|
-
className: "flex flex-col items-center justify-center h-full p-4 text-center",
|
|
86
|
-
children: [/* @__PURE__ */ (0, R.jsx)("p", {
|
|
87
|
-
className: "text-gray-500 dark:text-gray-400 mb-2",
|
|
88
|
-
children: "Select a resource to view its contents"
|
|
89
|
-
}), /* @__PURE__ */ (0, R.jsx)("p", {
|
|
90
|
-
className: "text-xs text-gray-400 dark:text-gray-500",
|
|
91
|
-
children: "Choose a resource from the list to see its data"
|
|
92
|
-
})]
|
|
93
|
-
});
|
|
94
|
-
let W = e.error || (e.result ? z(e.result) : null);
|
|
95
|
-
return W ? /* @__PURE__ */ (0, R.jsx)("div", {
|
|
96
|
-
className: "p-4",
|
|
97
|
-
children: /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
98
|
-
className: "bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",
|
|
99
|
-
children: [/* @__PURE__ */ (0, R.jsx)("p", {
|
|
100
|
-
className: "text-red-800 dark:text-red-300 font-medium",
|
|
101
|
-
children: "Error:"
|
|
102
|
-
}), /* @__PURE__ */ (0, R.jsx)("p", {
|
|
103
|
-
className: "text-red-700 dark:text-red-400 text-sm",
|
|
104
|
-
children: W
|
|
105
|
-
})]
|
|
106
|
-
})
|
|
107
|
-
}) : /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
108
|
-
className: "flex flex-col h-full",
|
|
109
|
-
children: [/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
110
|
-
className: "shrink-0 px-4 py-3 border-b border-gray-200 dark:border-zinc-700 flex items-center justify-between",
|
|
111
|
-
children: [/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
112
|
-
className: "flex items-center gap-2",
|
|
113
|
-
children: [
|
|
114
|
-
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
115
|
-
className: "flex items-center gap-1",
|
|
116
|
-
children: [/* @__PURE__ */ (0, R.jsx)(h, { className: "h-3 w-3 text-gray-400" }), /* @__PURE__ */ (0, R.jsx)("span", {
|
|
117
|
-
className: "text-xs text-gray-500 dark:text-gray-400",
|
|
118
|
-
children: new Date(e.timestamp).toLocaleTimeString()
|
|
119
|
-
})]
|
|
120
|
-
}),
|
|
121
|
-
(() => {
|
|
122
|
-
let t = e?.duration ?? e.result?.duration ?? e.result?.metrics?.durationMs;
|
|
123
|
-
return t === void 0 ? null : /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
124
|
-
className: "flex items-center gap-1",
|
|
125
|
-
children: [/* @__PURE__ */ (0, R.jsx)(m, { className: "h-3 w-3 text-gray-400" }), /* @__PURE__ */ (0, R.jsxs)("span", {
|
|
126
|
-
className: "text-xs text-gray-500 dark:text-gray-400",
|
|
127
|
-
children: [t, "ms"]
|
|
128
|
-
})]
|
|
129
|
-
});
|
|
130
|
-
})(),
|
|
131
|
-
H && /* @__PURE__ */ (0, R.jsx)(r, {
|
|
132
|
-
variant: "outline",
|
|
133
|
-
className: "text-xs bg-green-50 dark:bg-green-900/20 border-none border-green-200 dark:border-green-800/50 text-green-600 dark:text-green-400",
|
|
134
|
-
children: "MCP Apps"
|
|
135
|
-
})
|
|
136
|
-
]
|
|
137
|
-
}), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
138
|
-
className: "flex items-center gap-1",
|
|
139
|
-
children: [
|
|
140
|
-
H && /* @__PURE__ */ (0, R.jsxs)(a, {
|
|
141
|
-
variant: "ghost",
|
|
142
|
-
size: "sm",
|
|
143
|
-
onClick: s,
|
|
144
|
-
className: n ? "" : "text-purple-600 dark:text-purple-400",
|
|
145
|
-
children: [n ? /* @__PURE__ */ (0, R.jsx)(g, { className: "h-4 w-4 mr-1" }) : /* @__PURE__ */ (0, R.jsx)(l, { className: "h-4 w-4 mr-1" }), n ? "JSON" : "Preview"]
|
|
146
|
-
}),
|
|
147
|
-
/* @__PURE__ */ (0, R.jsx)(a, {
|
|
148
|
-
variant: "ghost",
|
|
149
|
-
size: "sm",
|
|
150
|
-
onClick: f,
|
|
151
|
-
children: b ? /* @__PURE__ */ (0, R.jsx)(u, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, R.jsx)(d, { className: "h-4 w-4" })
|
|
152
|
-
}),
|
|
153
|
-
/* @__PURE__ */ (0, R.jsx)(a, {
|
|
154
|
-
variant: "ghost",
|
|
155
|
-
size: "sm",
|
|
156
|
-
onClick: p,
|
|
157
|
-
children: /* @__PURE__ */ (0, R.jsx)(_, { className: "h-4 w-4" })
|
|
158
|
-
}),
|
|
159
|
-
/* @__PURE__ */ (0, R.jsx)(a, {
|
|
160
|
-
variant: "ghost",
|
|
161
|
-
size: "sm",
|
|
162
|
-
onClick: y,
|
|
163
|
-
children: /* @__PURE__ */ (0, R.jsx)(E, { className: "h-4 w-4" })
|
|
164
|
-
})
|
|
165
|
-
]
|
|
166
|
-
})]
|
|
167
|
-
}), /* @__PURE__ */ (0, R.jsx)("div", {
|
|
168
|
-
className: "flex-1 overflow-y-auto relative",
|
|
169
|
-
children: H && i && o && V ? n ? /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
170
|
-
className: "flex flex-1 h-full relative flex-col min-h-0",
|
|
171
|
-
"data-testid": "resource-widget-preview",
|
|
172
|
-
children: [/* @__PURE__ */ (0, R.jsx)("div", {
|
|
173
|
-
className: "absolute top-2 right-2 z-10 flex items-center gap-2",
|
|
174
|
-
children: /* @__PURE__ */ (0, R.jsx)(c, {
|
|
175
|
-
toolCallId: `resource-${e.timestamp}`,
|
|
176
|
-
displayMode: D,
|
|
177
|
-
onDisplayModeChange: O,
|
|
178
|
-
propsContext: "resource",
|
|
179
|
-
resourceUri: e.uri,
|
|
180
|
-
resourceAnnotations: N,
|
|
181
|
-
llmConfig: S || null,
|
|
182
|
-
resource: x || null,
|
|
183
|
-
onPropsChange: T,
|
|
184
|
-
requiredProps: P.length > 0 && !C ? P : void 0
|
|
185
|
-
})
|
|
186
|
-
}), U ? /* @__PURE__ */ (0, R.jsx)("div", {
|
|
187
|
-
className: "flex items-center justify-center w-full h-full min-h-[200px] rounded-xl border-2 border-dashed border-gray-300 dark:border-zinc-600 bg-gray-50 dark:bg-zinc-800/50 m-4",
|
|
188
|
-
children: /* @__PURE__ */ (0, R.jsx)("p", {
|
|
189
|
-
className: "text-sm text-gray-500 dark:text-gray-400 text-center px-6",
|
|
190
|
-
children: "This widget requires props, set or generate them in the props debugger"
|
|
191
|
-
})
|
|
192
|
-
}) : /* @__PURE__ */ (0, R.jsx)(B, {
|
|
193
|
-
serverId: i,
|
|
194
|
-
viewId: `resource-${e.timestamp}`,
|
|
195
|
-
resourceUri: V,
|
|
196
|
-
toolOutput: e.result,
|
|
197
|
-
toolMetadata: N,
|
|
198
|
-
readResource: o,
|
|
199
|
-
customProps: C || void 0,
|
|
200
|
-
displayMode: D,
|
|
201
|
-
onDisplayModeChange: O
|
|
202
|
-
})]
|
|
203
|
-
}) : /* @__PURE__ */ (0, R.jsx)("div", {
|
|
204
|
-
className: "px-4 pt-4",
|
|
205
|
-
"data-testid": "resource-result-json",
|
|
206
|
-
children: /* @__PURE__ */ (0, R.jsx)(v, {
|
|
207
|
-
data: e.result,
|
|
208
|
-
filename: `resource-${e.uri.replace(/[^a-zA-Z0-9]/g, "-")}-mcp-apps-${Date.now()}.json`
|
|
209
|
-
})
|
|
210
|
-
}) : /* @__PURE__ */ (0, R.jsx)("div", {
|
|
211
|
-
className: "px-4 pt-4",
|
|
212
|
-
"data-testid": "resource-result-json",
|
|
213
|
-
children: /* @__PURE__ */ (0, R.jsx)(v, {
|
|
214
|
-
data: e.result,
|
|
215
|
-
filename: `resource-${e.uri.replace(/[^a-zA-Z0-9]/g, "-")}-${Date.now()}.json`
|
|
216
|
-
})
|
|
217
|
-
})
|
|
218
|
-
})]
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
//#endregion
|
|
222
|
-
//#region src/client/components/resources/ResourcesList.tsx
|
|
223
|
-
function H({ resources: e, selectedResource: t, onResourceSelect: n, focusedIndex: r }) {
|
|
224
|
-
return e.length === 0 ? /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
225
|
-
className: "flex flex-1 flex-col items-center justify-center p-4 text-center",
|
|
226
|
-
children: [/* @__PURE__ */ (0, R.jsx)(s, { className: "h-12 w-12 text-gray-400 dark:text-gray-600 mb-3" }), /* @__PURE__ */ (0, R.jsx)("p", {
|
|
227
|
-
className: "text-gray-500 dark:text-gray-400",
|
|
228
|
-
children: "No resources available"
|
|
229
|
-
})]
|
|
230
|
-
}) : /* @__PURE__ */ (0, R.jsx)("div", { children: e.map((e, i) => {
|
|
231
|
-
let a = [e.description, e.mimeType && /* @__PURE__ */ (0, R.jsx)("span", {
|
|
232
|
-
className: "font-mono",
|
|
233
|
-
children: e.mimeType
|
|
234
|
-
}, "mime")].filter(Boolean);
|
|
235
|
-
return /* @__PURE__ */ (0, R.jsx)(w, {
|
|
236
|
-
id: `resource-${e.uri}`,
|
|
237
|
-
"data-testid": `resource-item-${e.name}`,
|
|
238
|
-
isSelected: t?.uri === e.uri,
|
|
239
|
-
isFocused: r === i,
|
|
240
|
-
title: e.name,
|
|
241
|
-
description: a.length > 0 ? /* @__PURE__ */ (0, R.jsxs)("span", {
|
|
242
|
-
className: "flex flex-col gap-1",
|
|
243
|
-
children: [e.description && /* @__PURE__ */ (0, R.jsx)("span", { children: e.description }), e.mimeType && /* @__PURE__ */ (0, R.jsx)("span", {
|
|
244
|
-
className: "text-xs text-gray-500 dark:text-gray-500 font-mono",
|
|
245
|
-
children: e.mimeType
|
|
246
|
-
})]
|
|
247
|
-
}) : void 0,
|
|
248
|
-
onClick: () => n(e)
|
|
249
|
-
}, e.uri);
|
|
250
|
-
}) });
|
|
251
|
-
}
|
|
252
|
-
//#endregion
|
|
253
|
-
//#region src/client/components/ResourcesTab.tsx
|
|
254
|
-
function U({ ref: e, resources: t, readResource: r, serverId: i, isConnected: s, mcpServerUrl: c, refreshResources: l }) {
|
|
255
|
-
let [u, d] = (0, L.useState)(!1), [m, h] = (0, L.useState)(null), { selectedResourceUri: g, setSelectedResourceUri: _ } = N(), { llmConfig: v } = P({ mcpServerUrl: c }), [w, E] = (0, L.useState)(null), [k, A] = (0, L.useState)(!1), [j, M] = (0, L.useState)(""), [F] = (0, L.useState)("resources"), [I, z] = (0, L.useState)(!0), [B, U] = (0, L.useState)(!1), [W, G] = (0, L.useState)(-1), [K, q] = (0, L.useState)(!1), J = (0, L.useRef)(null), Y = (0, L.useRef)(null), [ee, te] = (0, L.useState)(!1), [X, Z] = (0, L.useState)("list");
|
|
256
|
-
(0, L.useEffect)(() => {
|
|
257
|
-
let e = () => {
|
|
258
|
-
te(window.innerWidth < 1024);
|
|
259
|
-
};
|
|
260
|
-
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
261
|
-
}, []), (0, L.useEffect)(() => {
|
|
262
|
-
Z(m ? "detail" : "list");
|
|
263
|
-
}, [m]), (0, L.useImperativeHandle)(e, () => ({
|
|
264
|
-
focusSearch: () => {
|
|
265
|
-
U(!0), setTimeout(() => {
|
|
266
|
-
J.current && J.current.focus();
|
|
267
|
-
}, 0);
|
|
268
|
-
},
|
|
269
|
-
blurSearch: () => {
|
|
270
|
-
M(""), U(!1), J.current && J.current.blur();
|
|
271
|
-
}
|
|
272
|
-
})), (0, L.useEffect)(() => {
|
|
273
|
-
B && J.current && J.current.focus();
|
|
274
|
-
}, [B]);
|
|
275
|
-
let ne = (0, L.useCallback)(() => {
|
|
276
|
-
j.trim() || U(!1);
|
|
277
|
-
}, [j]), re = (0, L.useCallback)(async () => {
|
|
278
|
-
if (l) {
|
|
279
|
-
d(!0);
|
|
280
|
-
try {
|
|
281
|
-
await l();
|
|
282
|
-
} finally {
|
|
283
|
-
d(!1);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}, [l]), Q = (0, L.useMemo)(() => {
|
|
287
|
-
if (!j) return t;
|
|
288
|
-
let e = j.toLowerCase();
|
|
289
|
-
return t.filter((t) => t.name.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e) || t.uri.toLowerCase().includes(e));
|
|
290
|
-
}, [t, j]), $ = (0, L.useCallback)(async (e) => {
|
|
291
|
-
if (h(e), s) {
|
|
292
|
-
A(!0);
|
|
293
|
-
let t = Date.now();
|
|
294
|
-
try {
|
|
295
|
-
let n = await r(e.uri);
|
|
296
|
-
O(new D({
|
|
297
|
-
resourceUri: e.uri,
|
|
298
|
-
serverId: i,
|
|
299
|
-
success: !0
|
|
300
|
-
})).catch(() => {}), E({
|
|
301
|
-
uri: e.uri,
|
|
302
|
-
result: n,
|
|
303
|
-
timestamp: t,
|
|
304
|
-
resourceAnnotations: {
|
|
305
|
-
...e.annotations,
|
|
306
|
-
...e._meta || {}
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
} catch (n) {
|
|
310
|
-
O(new D({
|
|
311
|
-
resourceUri: e.uri,
|
|
312
|
-
serverId: i,
|
|
313
|
-
success: !1,
|
|
314
|
-
error: n instanceof Error ? n.message : "Unknown error"
|
|
315
|
-
})).catch(() => {}), E({
|
|
316
|
-
uri: e.uri,
|
|
317
|
-
result: {
|
|
318
|
-
contents: [],
|
|
319
|
-
_meta: {}
|
|
320
|
-
},
|
|
321
|
-
error: n instanceof Error ? n.message : "Unknown error",
|
|
322
|
-
timestamp: t,
|
|
323
|
-
resourceAnnotations: {
|
|
324
|
-
...e.annotations,
|
|
325
|
-
...e._meta || {}
|
|
326
|
-
}
|
|
327
|
-
});
|
|
328
|
-
} finally {
|
|
329
|
-
A(!1);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}, [
|
|
333
|
-
r,
|
|
334
|
-
i,
|
|
335
|
-
s
|
|
336
|
-
]);
|
|
337
|
-
(0, L.useEffect)(() => {
|
|
338
|
-
G(-1);
|
|
339
|
-
}, [j, F]), (0, L.useEffect)(() => {
|
|
340
|
-
let e = (e) => {
|
|
341
|
-
let t = e.target;
|
|
342
|
-
if (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.contentEditable === "true" || e.metaKey || e.ctrlKey || e.altKey) return;
|
|
343
|
-
let n = Q;
|
|
344
|
-
if (e.key === "ArrowDown") e.preventDefault(), G((e) => {
|
|
345
|
-
let t = e + 1;
|
|
346
|
-
return t >= n.length ? 0 : t;
|
|
347
|
-
});
|
|
348
|
-
else if (e.key === "ArrowUp") e.preventDefault(), G((e) => {
|
|
349
|
-
let t = e - 1;
|
|
350
|
-
return t < 0 ? n.length - 1 : t;
|
|
351
|
-
});
|
|
352
|
-
else if (e.key === "Enter" && W >= 0) {
|
|
353
|
-
e.preventDefault();
|
|
354
|
-
let t = Q[W];
|
|
355
|
-
t && $(t);
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
359
|
-
}, [
|
|
360
|
-
W,
|
|
361
|
-
Q,
|
|
362
|
-
$
|
|
363
|
-
]), (0, L.useEffect)(() => {
|
|
364
|
-
if (W >= 0) {
|
|
365
|
-
let e = `resource-${Q[W]?.uri}`, t = document.getElementById(e);
|
|
366
|
-
t && t.scrollIntoView({
|
|
367
|
-
behavior: "smooth",
|
|
368
|
-
block: "nearest"
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
}, [W, Q]), (0, L.useEffect)(() => {
|
|
372
|
-
if (g && t.length > 0) {
|
|
373
|
-
let e = t.find((e) => e.uri === g);
|
|
374
|
-
e && m?.uri !== e.uri && (_(null), setTimeout(() => {
|
|
375
|
-
$(e);
|
|
376
|
-
let t = document.getElementById(`resource-${e.uri}`);
|
|
377
|
-
t && t.scrollIntoView({
|
|
378
|
-
behavior: "smooth",
|
|
379
|
-
block: "nearest"
|
|
380
|
-
});
|
|
381
|
-
}, 100));
|
|
382
|
-
}
|
|
383
|
-
}, [
|
|
384
|
-
g,
|
|
385
|
-
t,
|
|
386
|
-
m,
|
|
387
|
-
$,
|
|
388
|
-
_
|
|
389
|
-
]), (0, L.useEffect)(() => {
|
|
390
|
-
if (m) {
|
|
391
|
-
let e = t.find((e) => e.uri === m.uri);
|
|
392
|
-
e && e !== m && (e.description !== m.description || e.mimeType !== m.mimeType || e.name !== m.name) && h(e);
|
|
393
|
-
}
|
|
394
|
-
}, [t, m]);
|
|
395
|
-
let ie = (0, L.useCallback)(async () => {
|
|
396
|
-
if (w) try {
|
|
397
|
-
await f(JSON.stringify(w.result, null, 2)), q(!0), setTimeout(() => q(!1), 2e3);
|
|
398
|
-
} catch (e) {
|
|
399
|
-
console.error("[ResourcesTab] Failed to copy result:", e);
|
|
400
|
-
}
|
|
401
|
-
}, [w]), ae = (0, L.useCallback)(() => {
|
|
402
|
-
if (w) try {
|
|
403
|
-
let e = new globalThis.Blob([JSON.stringify(w.result, null, 2)], { type: "application/json" }), t = URL.createObjectURL(e), n = document.createElement("a");
|
|
404
|
-
n.href = t, n.download = `resource-${Date.now()}.json`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(t);
|
|
405
|
-
} catch (e) {
|
|
406
|
-
console.error("[ResourcesTab] Failed to download result:", e);
|
|
407
|
-
}
|
|
408
|
-
}, [w]), oe = (0, L.useCallback)(async () => {
|
|
409
|
-
if (Y.current) try {
|
|
410
|
-
document.fullscreenElement ? await document.exitFullscreen() : await Y.current.requestFullscreen();
|
|
411
|
-
} catch (e) {
|
|
412
|
-
console.error("[ResourcesTab] Failed to toggle fullscreen:", e);
|
|
413
|
-
}
|
|
414
|
-
}, []);
|
|
415
|
-
return ee ? /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
416
|
-
className: "h-full flex flex-col overflow-hidden relative bg-background",
|
|
417
|
-
children: [X !== "list" && /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
418
|
-
className: "flex items-center gap-2 p-2 border-b shrink-0 bg-background z-10",
|
|
419
|
-
children: [/* @__PURE__ */ (0, R.jsx)(a, {
|
|
420
|
-
variant: "ghost",
|
|
421
|
-
size: "sm",
|
|
422
|
-
onClick: () => {
|
|
423
|
-
h(null), Z("list");
|
|
424
|
-
},
|
|
425
|
-
className: "p-0 h-8 w-8",
|
|
426
|
-
children: /* @__PURE__ */ (0, R.jsx)(p, { className: "h-4 w-4" })
|
|
427
|
-
}), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
428
|
-
className: "flex items-center text-sm font-medium",
|
|
429
|
-
children: [/* @__PURE__ */ (0, R.jsx)("button", {
|
|
430
|
-
onClick: () => {
|
|
431
|
-
h(null), Z("list");
|
|
432
|
-
},
|
|
433
|
-
className: "text-muted-foreground hover:text-foreground hover:underline cursor-pointer",
|
|
434
|
-
children: "Resources"
|
|
435
|
-
}), X === "detail" && /* @__PURE__ */ (0, R.jsxs)(R.Fragment, { children: [/* @__PURE__ */ (0, R.jsx)("span", {
|
|
436
|
-
className: "mx-2 text-muted-foreground",
|
|
437
|
-
children: "/"
|
|
438
|
-
}), /* @__PURE__ */ (0, R.jsx)("span", {
|
|
439
|
-
className: "text-foreground",
|
|
440
|
-
children: "Content"
|
|
441
|
-
})] })]
|
|
442
|
-
})]
|
|
443
|
-
}), /* @__PURE__ */ (0, R.jsx)("div", {
|
|
444
|
-
className: "flex-1 relative overflow-hidden",
|
|
445
|
-
children: /* @__PURE__ */ (0, R.jsxs)(o, {
|
|
446
|
-
initial: !1,
|
|
447
|
-
mode: "popLayout",
|
|
448
|
-
children: [X === "list" && /* @__PURE__ */ (0, R.jsx)(n.div, {
|
|
449
|
-
initial: { x: "-100%" },
|
|
450
|
-
animate: { x: 0 },
|
|
451
|
-
exit: { x: "-100%" },
|
|
452
|
-
transition: {
|
|
453
|
-
type: "spring",
|
|
454
|
-
stiffness: 300,
|
|
455
|
-
damping: 30
|
|
456
|
-
},
|
|
457
|
-
className: "absolute inset-0 flex flex-col bg-background z-0",
|
|
458
|
-
children: /* @__PURE__ */ (0, R.jsx)(S, { children: (e) => /* @__PURE__ */ (0, R.jsxs)(R.Fragment, { children: [/* @__PURE__ */ (0, R.jsx)(T, {
|
|
459
|
-
isScrolled: e,
|
|
460
|
-
title: "Resources",
|
|
461
|
-
icon: y,
|
|
462
|
-
count: Q.length,
|
|
463
|
-
isSearchExpanded: B,
|
|
464
|
-
searchQuery: j,
|
|
465
|
-
searchPlaceholder: "Search resources...",
|
|
466
|
-
onSearchExpand: () => U(!0),
|
|
467
|
-
onSearchChange: M,
|
|
468
|
-
onSearchBlur: ne,
|
|
469
|
-
searchInputRef: J,
|
|
470
|
-
onRefresh: l ? re : void 0,
|
|
471
|
-
isRefreshing: u
|
|
472
|
-
}), /* @__PURE__ */ (0, R.jsx)(H, {
|
|
473
|
-
resources: Q,
|
|
474
|
-
selectedResource: m,
|
|
475
|
-
onResourceSelect: $,
|
|
476
|
-
focusedIndex: W
|
|
477
|
-
})] }) })
|
|
478
|
-
}, "list"), X === "detail" && /* @__PURE__ */ (0, R.jsx)(n.div, {
|
|
479
|
-
initial: { x: "100%" },
|
|
480
|
-
animate: { x: 0 },
|
|
481
|
-
exit: { x: "100%" },
|
|
482
|
-
transition: {
|
|
483
|
-
type: "spring",
|
|
484
|
-
stiffness: 300,
|
|
485
|
-
damping: 30
|
|
486
|
-
},
|
|
487
|
-
className: "absolute inset-0 bg-white dark:bg-zinc-900 z-10",
|
|
488
|
-
children: /* @__PURE__ */ (0, R.jsx)("div", {
|
|
489
|
-
ref: Y,
|
|
490
|
-
className: "h-full",
|
|
491
|
-
children: /* @__PURE__ */ (0, R.jsx)(V, {
|
|
492
|
-
result: w,
|
|
493
|
-
isLoading: k,
|
|
494
|
-
previewMode: I,
|
|
495
|
-
serverId: i,
|
|
496
|
-
readResource: r,
|
|
497
|
-
onTogglePreview: () => z(!I),
|
|
498
|
-
onCopy: ie,
|
|
499
|
-
onDownload: ae,
|
|
500
|
-
onFullscreen: oe,
|
|
501
|
-
isCopied: K,
|
|
502
|
-
selectedResource: m,
|
|
503
|
-
llmConfig: v
|
|
504
|
-
})
|
|
505
|
-
})
|
|
506
|
-
}, "detail")]
|
|
507
|
-
})
|
|
508
|
-
})]
|
|
509
|
-
}) : /* @__PURE__ */ (0, R.jsxs)(C, {
|
|
510
|
-
orientation: "horizontal",
|
|
511
|
-
className: "h-full",
|
|
512
|
-
children: [
|
|
513
|
-
/* @__PURE__ */ (0, R.jsx)(b, {
|
|
514
|
-
defaultSize: "33%",
|
|
515
|
-
children: /* @__PURE__ */ (0, R.jsx)("div", {
|
|
516
|
-
className: "flex h-full flex-col overflow-hidden border-r dark:border-zinc-700",
|
|
517
|
-
children: /* @__PURE__ */ (0, R.jsx)(S, { children: (e) => /* @__PURE__ */ (0, R.jsxs)(R.Fragment, { children: [/* @__PURE__ */ (0, R.jsx)(T, {
|
|
518
|
-
isScrolled: e,
|
|
519
|
-
title: "Resources",
|
|
520
|
-
icon: y,
|
|
521
|
-
count: Q.length,
|
|
522
|
-
isSearchExpanded: B,
|
|
523
|
-
searchQuery: j,
|
|
524
|
-
searchPlaceholder: "Search resources...",
|
|
525
|
-
onSearchExpand: () => U(!0),
|
|
526
|
-
onSearchChange: M,
|
|
527
|
-
onSearchBlur: ne,
|
|
528
|
-
searchInputRef: J,
|
|
529
|
-
onRefresh: l ? re : void 0,
|
|
530
|
-
isRefreshing: u
|
|
531
|
-
}), /* @__PURE__ */ (0, R.jsx)(H, {
|
|
532
|
-
resources: Q,
|
|
533
|
-
selectedResource: m,
|
|
534
|
-
onResourceSelect: $,
|
|
535
|
-
focusedIndex: W
|
|
536
|
-
})] }) })
|
|
537
|
-
})
|
|
538
|
-
}),
|
|
539
|
-
/* @__PURE__ */ (0, R.jsx)(x, {}),
|
|
540
|
-
/* @__PURE__ */ (0, R.jsx)(b, {
|
|
541
|
-
defaultSize: "67%",
|
|
542
|
-
children: /* @__PURE__ */ (0, R.jsx)("div", {
|
|
543
|
-
ref: Y,
|
|
544
|
-
className: "h-full bg-white dark:bg-zinc-900",
|
|
545
|
-
children: /* @__PURE__ */ (0, R.jsx)(V, {
|
|
546
|
-
result: w,
|
|
547
|
-
isLoading: k,
|
|
548
|
-
previewMode: I,
|
|
549
|
-
serverId: i,
|
|
550
|
-
readResource: r,
|
|
551
|
-
onTogglePreview: () => z(!I),
|
|
552
|
-
onCopy: ie,
|
|
553
|
-
onDownload: ae,
|
|
554
|
-
onFullscreen: oe,
|
|
555
|
-
isCopied: K,
|
|
556
|
-
selectedResource: m,
|
|
557
|
-
llmConfig: v
|
|
558
|
-
})
|
|
559
|
-
})
|
|
560
|
-
})
|
|
561
|
-
]
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
U.displayName = "ResourcesTab";
|
|
565
|
-
//#endregion
|
|
566
|
-
export { U as ResourcesTab };
|