@mcp-use/inspector 20.0.0-beta.14 → 20.0.0-beta.16

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.
Files changed (140) hide show
  1. package/README.md +2 -2
  2. package/dist/cdn/inspector.js +76909 -9272
  3. package/dist/cli.js +1 -1
  4. package/dist/server/cdn-shell.js +2 -2
  5. package/dist/server/{chunk-3XD7J5NX.js → chunk-FHC5ZGMM.js} +1 -1
  6. package/dist/server/{chunk-N3VXWLT6.js → chunk-QXOCY5ZE.js} +1 -1
  7. package/dist/server/{chunk-DLHO3Q42.js → chunk-R5ZEVRE5.js} +1 -1
  8. package/dist/server/cli.js +2 -2
  9. package/dist/server/index.js +3 -3
  10. package/dist/server/middleware.js +3 -3
  11. package/dist/server/version.js +1 -1
  12. package/dist/web/assets/index-BgHcVJO3.js +643 -0
  13. package/dist/web/index.html +2 -10
  14. package/package.json +4 -4
  15. package/dist/cdn/AnimatePresence-D1bZ5_-l.js +0 -394
  16. package/dist/cdn/ChatTab-D_2TXR3X.js +0 -6811
  17. package/dist/cdn/CheckboxIndicator-BjF73mGX.js +0 -252
  18. package/dist/cdn/ConnectionSettingsForm-BqH0PcZF.js +0 -929
  19. package/dist/cdn/ConnectionSettingsTab-Duhb1uQP.js +0 -151
  20. package/dist/cdn/ElicitationTab-PEmEDvC5.js +0 -655
  21. package/dist/cdn/FormContext-NtUiZclE.js +0 -135
  22. package/dist/cdn/InspectorContext-BBKCdfmK.js +0 -123
  23. package/dist/cdn/JSONDisplay-BJqMz7Ny.js +0 -324
  24. package/dist/cdn/ListTabHeader-DzmTtN1e.js +0 -89
  25. package/dist/cdn/MCPAppsDebugControls-w5NRWhlZ.js +0 -2174
  26. package/dist/cdn/ManufactOAuthCallback-ChbbjFIT.js +0 -31
  27. package/dist/cdn/MarkdownRenderer-BIsUE0bf.js +0 -3610
  28. package/dist/cdn/McpAppsViewPanel-B3_76u7O.js +0 -56
  29. package/dist/cdn/NotificationsTab-B7uebqMV.js +0 -290
  30. package/dist/cdn/OAuthCallback-CtLoXa3h.js +0 -58
  31. package/dist/cdn/PromptsTab-DpE0XLzk.js +0 -902
  32. package/dist/cdn/ResourcesTab-DQS24z5p.js +0 -566
  33. package/dist/cdn/SamplingTab-ZDeu0CjJ.js +0 -659
  34. package/dist/cdn/ServerMetadataTab-BM3VhSLf.js +0 -244
  35. package/dist/cdn/StatusIcon-Q3n3YRtE.js +0 -65
  36. package/dist/cdn/ToolsTab-LtviZSWA.js +0 -2045
  37. package/dist/cdn/ViewPreview-BwC_tbF_.js +0 -238
  38. package/dist/cdn/WidgetDebugContext-B6yoOVVV.js +0 -314
  39. package/dist/cdn/WidgetWrapper-BlbQAh_X.js +0 -12
  40. package/dist/cdn/basePath-B8HuhIMu.js +0 -25
  41. package/dist/cdn/bell-GrTZcnD2.js +0 -10
  42. package/dist/cdn/browser-DG2Z8392.js +0 -42
  43. package/dist/cdn/brush-CelVvMGp.js +0 -17
  44. package/dist/cdn/button-CB4uOoUV.js +0 -2509
  45. package/dist/cdn/card-BA-DQk-G.js +0 -41
  46. package/dist/cdn/cfWorker-Bxcs9rNe.js +0 -10799
  47. package/dist/cdn/checkbox-kwVa4gRX.js +0 -20
  48. package/dist/cdn/chunk-QUQL4437-XnDcYQEx.js +0 -1508
  49. package/dist/cdn/clock-YMF8Gtw5.js +0 -12
  50. package/dist/cdn/code-C8sN2OGR.js +0 -10
  51. package/dist/cdn/createLucideIcon-BONxC1L5.js +0 -213
  52. package/dist/cdn/dialog-CJGnC5Ag.js +0 -1028
  53. package/dist/cdn/dist-CHKts0NS.js +0 -2307
  54. package/dist/cdn/dist-CTJnCYmk.js +0 -616
  55. package/dist/cdn/external-link-Bo4lQxr1.js +0 -17
  56. package/dist/cdn/eye-pSGG7nvf.js +0 -29
  57. package/dist/cdn/folder-open-aM8CPtBO.js +0 -7
  58. package/dist/cdn/hash-DDs2vE1k.js +0 -33
  59. package/dist/cdn/history-BfUFpL1d.js +0 -17
  60. package/dist/cdn/index-browser-DO-sd0TA.js +0 -1853
  61. package/dist/cdn/info-BMkB68mB.js +0 -19
  62. package/dist/cdn/input-BCpgLXU1.js +0 -9654
  63. package/dist/cdn/inspector-settings-layout-0VDsjeqb.js +0 -4
  64. package/dist/cdn/label-A0UGV8FE.js +0 -60
  65. package/dist/cdn/loader-circle-BKRHJEB7.js +0 -7
  66. package/dist/cdn/manufact-auth-BQMHhbLV.js +0 -423
  67. package/dist/cdn/maximize-2-DdrB_spi.js +0 -21
  68. package/dist/cdn/maximize-hSOCz133.js +0 -21
  69. package/dist/cdn/message-square-D3tKB3uJ.js +0 -7
  70. package/dist/cdn/not-found-BajFyZpp.js +0 -32
  71. package/dist/cdn/play-B1leulYf.js +0 -7
  72. package/dist/cdn/providerMeta-CjGU4rID.js +0 -436
  73. package/dist/cdn/react-BDA-xrgK.js +0 -5421
  74. package/dist/cdn/react-BIs9pQ3H.js +0 -926
  75. package/dist/cdn/refresh-cw-CyvXrS91.js +0 -21
  76. package/dist/cdn/save-CmdEPUAm.js +0 -34
  77. package/dist/cdn/schemaHelpers-DTV38jGq.js +0 -16
  78. package/dist/cdn/select-CCFHjOGk.js +0 -2595
  79. package/dist/cdn/servers-Dd0Vcp81.js +0 -30
  80. package/dist/cdn/shared-CJVHJhag.js +0 -1700
  81. package/dist/cdn/sheet-oyq1mIyg.js +0 -2078
  82. package/dist/cdn/sparkles-CxeZpVtX.js +0 -23
  83. package/dist/cdn/spinner-Be1GlSGX.js +0 -15
  84. package/dist/cdn/square-check-big-C_4wbfwF.js +0 -10
  85. package/dist/cdn/switch-DHXEA_N5.js +0 -665
  86. package/dist/cdn/tabs-subtle-Dubd6Kj8.js +0 -788
  87. package/dist/cdn/telemetry-e4uEESP7.js +0 -208
  88. package/dist/cdn/textarea-CwmI8_uI.js +0 -14
  89. package/dist/cdn/trash-2-BhumJAFE.js +0 -25
  90. package/dist/cdn/useAriaLabelledBy-Cra6w3YY.js +0 -30
  91. package/dist/cdn/useCompositeItem-Dhnm-7el.js +0 -26
  92. package/dist/cdn/useConfig-Dw_6Ztzr.js +0 -235
  93. package/dist/cdn/useSavedRequests-mSIsDd4c.js +0 -51
  94. package/dist/cdn/useViewHostProps-BPApUBaM.js +0 -364
  95. package/dist/cdn/wrench-DvK20LUT.js +0 -7
  96. package/dist/cdn/x-EilKPiCX.js +0 -10
  97. package/dist/cdn/zap-0Wr9QO7N.js +0 -10
  98. package/dist/web/assets/AnimatePresence-FfDQQNFJ.js +0 -9
  99. package/dist/web/assets/ChatTab-BhoU_ges.js +0 -18
  100. package/dist/web/assets/ConnectionSettingsTab-vJcr7uI3.js +0 -1
  101. package/dist/web/assets/ElicitationTab-4my-wtXf.js +0 -1
  102. package/dist/web/assets/FormContext-sV-yByKz.js +0 -1
  103. package/dist/web/assets/ListTabHeader-CrGae306.js +0 -1
  104. package/dist/web/assets/MCPAppsDebugControls-Cd4s9mr1.js +0 -34
  105. package/dist/web/assets/ManufactOAuthCallback-CCRWJhuT.js +0 -1
  106. package/dist/web/assets/MarkdownRenderer-BUDZYHqm.js +0 -47
  107. package/dist/web/assets/McpAppsViewPanel-Cil7Fdy4.js +0 -1
  108. package/dist/web/assets/NotificationsTab-Bl3O5PRb.js +0 -1
  109. package/dist/web/assets/OAuthCallback-CceVgo-9.js +0 -1
  110. package/dist/web/assets/PromptsTab-8lSxb8x-.js +0 -15
  111. package/dist/web/assets/ResourcesTab-DtGfgsPv.js +0 -2
  112. package/dist/web/assets/SamplingTab-XC-DTfOo.js +0 -1
  113. package/dist/web/assets/ServerMetadataTab-C5d_dI3_.js +0 -1
  114. package/dist/web/assets/ToolsTab-DuHPXItY.js +0 -8
  115. package/dist/web/assets/ViewPreview-DXswO9q8.js +0 -1
  116. package/dist/web/assets/WidgetWrapper-cv_BM1bY.js +0 -1
  117. package/dist/web/assets/brush-DX0UZ_pI.js +0 -1
  118. package/dist/web/assets/button-C8Xa2k4x.js +0 -1
  119. package/dist/web/assets/checkbox-DAfdiGl1.js +0 -1
  120. package/dist/web/assets/code-B14rVdNt.js +0 -1
  121. package/dist/web/assets/createLucideIcon-BEHeJH0M.js +0 -1
  122. package/dist/web/assets/dist-C2Y1wkk6.js +0 -21
  123. package/dist/web/assets/index-tu5-QdSJ.js +0 -499
  124. package/dist/web/assets/input-C0OQCUZy.js +0 -1
  125. package/dist/web/assets/inspector-settings-layout-yjKRJDai.js +0 -1
  126. package/dist/web/assets/label-CI7JWQOo.js +0 -1
  127. package/dist/web/assets/maximize-2-Br1WQzT2.js +0 -1
  128. package/dist/web/assets/maximize-CJNgRe6S.js +0 -1
  129. package/dist/web/assets/react-CU_d2d5K.js +0 -1
  130. package/dist/web/assets/refresh-cw-B5iaAZKn.js +0 -1
  131. package/dist/web/assets/save-TM6fvNrt.js +0 -1
  132. package/dist/web/assets/schemaHelpers-DLNTQr_6.js +0 -1
  133. package/dist/web/assets/select-D6jzbLJn.js +0 -1
  134. package/dist/web/assets/shared-c1Yr-wvV.js +0 -1
  135. package/dist/web/assets/sparkles-BGYTDThM.js +0 -1
  136. package/dist/web/assets/tabs-subtle-CHvFXVIA.js +0 -1
  137. package/dist/web/assets/textarea-CRTXuRmE.js +0 -1
  138. package/dist/web/assets/useConfig-9UVqLmR_.js +0 -1
  139. package/dist/web/assets/useViewHostProps-BBoPQYEl.js +0 -1
  140. package/dist/web/assets/zap-BDWHCVHU.js +0 -1
@@ -1,655 +0,0 @@
1
- import { s as e, t } from "./react-BIs9pQ3H.js";
2
- import { a as n, n as r, r as i, sr as a, t as o } from "./input-BCpgLXU1.js";
3
- import { n as s } from "./createLucideIcon-BONxC1L5.js";
4
- import { t as c } from "./button-CB4uOoUV.js";
5
- import { t as l } from "./label-A0UGV8FE.js";
6
- import { a as u, i as d, r as f, t as p } from "./browser-DG2Z8392.js";
7
- import { a as m, t as h } from "./JSONDisplay-BJqMz7Ny.js";
8
- import { t as g } from "./external-link-Bo4lQxr1.js";
9
- import { a as _, i as v, n as y, o as b, r as x, t as S } from "./shared-CJVHJhag.js";
10
- import { t as C } from "./maximize-2-DdrB_spi.js";
11
- import { t as w } from "./square-check-big-C_4wbfwF.js";
12
- import { t as T } from "./x-EilKPiCX.js";
13
- import { t as E } from "./not-found-BajFyZpp.js";
14
- import { n as D } from "./dist-CTJnCYmk.js";
15
- import { n as O } from "./InspectorContext-BBKCdfmK.js";
16
- import { t as k } from "./textarea-CwmI8_uI.js";
17
- import { t as A } from "./checkbox-kwVa4gRX.js";
18
- import { n as j, t as M } from "./schemaHelpers-DTV38jGq.js";
19
- //#region src/client/components/elicitation/ElicitationRequestsList.tsx
20
- var N = /* @__PURE__ */ e(t(), 1), P = s();
21
- function F({ requests: e, selectedRequest: t, onRequestSelect: n, focusedIndex: r, formatRelativeTime: i }) {
22
- return e.length === 0 ? /* @__PURE__ */ (0, P.jsx)("div", {
23
- className: "flex flex-1 flex-col items-center justify-center p-4 text-center",
24
- children: /* @__PURE__ */ (0, P.jsx)(E, {
25
- vertical: !0,
26
- noBorder: !0,
27
- message: "No elicitation requests"
28
- })
29
- }) : /* @__PURE__ */ (0, P.jsx)("div", { children: e.map((e, o) => {
30
- let s = e.request.mode || "form", c = s === "form" && "requestedSchema" in e.request && e.request.requestedSchema;
31
- return /* @__PURE__ */ (0, P.jsx)(x, {
32
- id: `elicitation-request-${e.id}`,
33
- "data-testid": `elicitation-request-item-${o}`,
34
- isSelected: t?.id === e.id,
35
- isFocused: r === o,
36
- title: /* @__PURE__ */ (0, P.jsxs)("span", {
37
- className: "flex items-center gap-3",
38
- children: [e.serverName, /* @__PURE__ */ (0, P.jsx)(a, {
39
- variant: "outline",
40
- className: s === "url" ? "bg-blue-500/20 text-blue-600 dark:text-blue-400 border-blue-500/50" : "bg-green-500/20 text-green-600 dark:text-green-400 border-green-500/50",
41
- children: s
42
- })]
43
- }),
44
- description: (() => {
45
- let t = i(e.timestamp), n = [];
46
- return c && n.push("with schema"), s === "url" && n.push("external action"), t + (n.length > 0 ? ` | ${n.join(", ")}` : "");
47
- })(),
48
- onClick: () => n(e)
49
- }, e.id);
50
- }) });
51
- }
52
- //#endregion
53
- //#region src/client/components/elicitation/shared/ElicitationFormFields.tsx
54
- function I({ request: e, formData: t, onFieldChange: n, idPrefix: r, testIdPrefix: i, fieldContainerClassName: a = "space-y-2", textareaRows: s = 4, showOuterLabelForBoolean: c = !0, emptyFallback: u }) {
55
- return /* @__PURE__ */ (0, P.jsx)(P.Fragment, { children: (0, N.useMemo)(() => {
56
- if (!("requestedSchema" in e.request)) return null;
57
- let d = e.request.requestedSchema;
58
- if (!d || d.type !== "object" || !d.properties) return u ?? /* @__PURE__ */ (0, P.jsx)("p", {
59
- className: "text-sm text-muted-foreground",
60
- children: "No form schema available"
61
- });
62
- let f = d.properties, p = d.required || [];
63
- return /* @__PURE__ */ (0, P.jsx)("div", {
64
- className: "space-y-4",
65
- children: Object.entries(f).map(([e, u]) => {
66
- let d = u, f = p.includes(e), m = d.type || "string", h = d.title || e, g = d.description, _ = j(d), v = _.length > 0, y = Array.isArray(d.enum), b = m === "array" && Array.isArray(d.items?.enum), x = M(d), S = m === "array" && x.length > 0, C = Array.isArray(t[e]) ? t[e] : [], w = `${r}-${e}`, T = `${i}-${e}`;
67
- return /* @__PURE__ */ (0, P.jsxs)("div", {
68
- className: a,
69
- children: [
70
- (m !== "boolean" || c) && /* @__PURE__ */ (0, P.jsxs)(l, {
71
- htmlFor: w,
72
- children: [h, f && /* @__PURE__ */ (0, P.jsx)("span", {
73
- className: "text-red-500 ml-1",
74
- children: "*"
75
- })]
76
- }),
77
- g && /* @__PURE__ */ (0, P.jsx)("p", {
78
- className: "text-xs text-muted-foreground",
79
- children: g
80
- }),
81
- m === "boolean" ? /* @__PURE__ */ (0, P.jsxs)("div", {
82
- className: "flex items-center space-x-2",
83
- children: [/* @__PURE__ */ (0, P.jsx)(A, {
84
- id: w,
85
- "data-testid": T,
86
- checked: t[e] || !1,
87
- onCheckedChange: (t) => n(e, t)
88
- }), /* @__PURE__ */ (0, P.jsxs)(l, {
89
- htmlFor: w,
90
- className: "text-sm font-normal cursor-pointer",
91
- children: [h, !c && f && /* @__PURE__ */ (0, P.jsx)("span", {
92
- className: "text-red-500 ml-1",
93
- children: "*"
94
- })]
95
- })]
96
- }) : m === "number" || m === "integer" ? /* @__PURE__ */ (0, P.jsx)(o, {
97
- id: w,
98
- "data-testid": T,
99
- type: "number",
100
- value: t[e] ?? "",
101
- onChange: (t) => {
102
- let r = m === "integer" ? parseInt(t.target.value, 10) : parseFloat(t.target.value);
103
- n(e, isNaN(r) ? "" : r);
104
- },
105
- placeholder: d.default?.toString() || ""
106
- }) : v ? /* @__PURE__ */ (0, P.jsxs)("select", {
107
- id: w,
108
- "data-testid": T,
109
- value: t[e] || "",
110
- onChange: (t) => n(e, t.target.value),
111
- className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
112
- children: [/* @__PURE__ */ (0, P.jsx)("option", {
113
- value: "",
114
- children: "Select..."
115
- }), _.map((e) => /* @__PURE__ */ (0, P.jsx)("option", {
116
- value: e.const,
117
- children: e.title || e.const
118
- }, e.const))]
119
- }) : y ? /* @__PURE__ */ (0, P.jsxs)("select", {
120
- id: w,
121
- "data-testid": T,
122
- value: t[e] || "",
123
- onChange: (t) => n(e, t.target.value),
124
- className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
125
- children: [/* @__PURE__ */ (0, P.jsx)("option", {
126
- value: "",
127
- children: "Select..."
128
- }), d.enum.map((e, t) => /* @__PURE__ */ (0, P.jsx)("option", {
129
- value: e,
130
- children: d.enumNames?.[t] || e
131
- }, e))]
132
- }) : b ? /* @__PURE__ */ (0, P.jsx)("div", {
133
- className: "space-y-2",
134
- "data-testid": T,
135
- children: d.items.enum.map((t) => {
136
- let r = `${w}-${t}`;
137
- return /* @__PURE__ */ (0, P.jsxs)("div", {
138
- className: "flex items-center space-x-2",
139
- children: [/* @__PURE__ */ (0, P.jsx)(A, {
140
- id: r,
141
- checked: C.includes(t),
142
- onCheckedChange: (r) => {
143
- n(e, r ? [...C, t] : C.filter((e) => e !== t));
144
- }
145
- }), /* @__PURE__ */ (0, P.jsx)(l, {
146
- htmlFor: r,
147
- className: "text-sm font-normal cursor-pointer",
148
- children: t
149
- })]
150
- }, t);
151
- })
152
- }) : S ? /* @__PURE__ */ (0, P.jsx)("div", {
153
- className: "space-y-2",
154
- "data-testid": T,
155
- children: x.map((t) => {
156
- let r = `${w}-${t.const}`;
157
- return /* @__PURE__ */ (0, P.jsxs)("div", {
158
- className: "flex items-center space-x-2",
159
- children: [/* @__PURE__ */ (0, P.jsx)(A, {
160
- id: r,
161
- checked: C.includes(t.const),
162
- onCheckedChange: (r) => {
163
- n(e, r ? [...C, t.const] : C.filter((e) => e !== t.const));
164
- }
165
- }), /* @__PURE__ */ (0, P.jsx)(l, {
166
- htmlFor: r,
167
- className: "text-sm font-normal cursor-pointer",
168
- children: t.title || t.const
169
- })]
170
- }, t.const);
171
- })
172
- }) : m === "string" && (d.format === "textarea" || d.maxLength > 100) ? /* @__PURE__ */ (0, P.jsx)(k, {
173
- id: w,
174
- "data-testid": T,
175
- value: t[e] || "",
176
- onChange: (t) => n(e, t.target.value),
177
- placeholder: d.default || "",
178
- rows: s
179
- }) : /* @__PURE__ */ (0, P.jsx)(o, {
180
- id: w,
181
- "data-testid": T,
182
- type: "text",
183
- value: t[e] || "",
184
- onChange: (t) => n(e, t.target.value),
185
- placeholder: d.default || ""
186
- })
187
- ]
188
- }, e);
189
- })
190
- });
191
- }, [
192
- e,
193
- t,
194
- n,
195
- r,
196
- i,
197
- a,
198
- s,
199
- c,
200
- u
201
- ]) });
202
- }
203
- //#endregion
204
- //#region src/client/components/elicitation/shared/useElicitationForm.ts
205
- function L(e) {
206
- let [t, n] = (0, N.useState)({}), [r, i] = (0, N.useState)(!1), a = e?.request.mode || "form", o = a === "form", s = a === "url";
207
- return (0, N.useEffect)(() => {
208
- if (e && o && "requestedSchema" in e.request) {
209
- let t = e.request.requestedSchema, r = {};
210
- if (t?.type === "object" && t.properties) for (let [e, n] of Object.entries(t.properties)) {
211
- let t = n;
212
- t.default === void 0 ? t.type === "array" ? r[e] = [] : t.type === "boolean" ? r[e] = !1 : t.type === "number" || t.type === "integer" ? r[e] = 0 : r[e] = "" : r[e] = t.default;
213
- }
214
- n(r);
215
- }
216
- i(!1);
217
- }, [e?.id, o]), {
218
- formData: t,
219
- setFieldValue: (0, N.useCallback)((e, t) => {
220
- n((n) => ({
221
- ...n,
222
- [e]: t
223
- }));
224
- }, []),
225
- getMissingRequiredFields: (0, N.useCallback)(() => !e || !o || !("requestedSchema" in e.request) ? [] : (e.request.requestedSchema?.required ?? []).filter((e) => t[e] === void 0 || t[e] === "" || t[e] === null), [
226
- e,
227
- t,
228
- o
229
- ]),
230
- urlCompleted: r,
231
- setUrlCompleted: i,
232
- mode: a,
233
- isFormMode: o,
234
- isUrlMode: s
235
- };
236
- }
237
- //#endregion
238
- //#region src/client/components/elicitation/ElicitationRequestDisplay.tsx
239
- function R({ request: t, onApprove: o, onReject: s, onClose: f, previewMode: p, onTogglePreview: _, isCopied: v, onCopy: y, onDownload: b, onFullscreen: x }) {
240
- let { formData: S, setFieldValue: w, getMissingRequiredFields: E, urlCompleted: O, setUrlCompleted: k, mode: j, isFormMode: M, isUrlMode: N } = L(t);
241
- return t ? /* @__PURE__ */ (0, P.jsxs)("div", {
242
- className: "flex flex-col h-full",
243
- children: [
244
- /* @__PURE__ */ (0, P.jsxs)("div", {
245
- className: "flex items-center justify-between p-4 border-b dark:border-zinc-700",
246
- children: [/* @__PURE__ */ (0, P.jsxs)("div", {
247
- className: "flex items-center gap-2",
248
- children: [
249
- /* @__PURE__ */ (0, P.jsx)("h3", {
250
- className: "font-medium text-gray-900 dark:text-gray-100",
251
- children: t.serverName
252
- }),
253
- /* @__PURE__ */ (0, P.jsx)(a, {
254
- variant: "outline",
255
- className: N ? "bg-blue-500/20 text-blue-600 dark:text-blue-400 border-blue-500/50" : "bg-green-500/20 text-green-600 dark:text-green-400 border-green-500/50",
256
- children: j
257
- }),
258
- /* @__PURE__ */ (0, P.jsx)("span", {
259
- className: "text-sm text-gray-500 dark:text-gray-400",
260
- children: new Date(t.timestamp).toLocaleString()
261
- })
262
- ]
263
- }), /* @__PURE__ */ (0, P.jsxs)("div", {
264
- className: "flex items-center gap-2",
265
- children: [
266
- /* @__PURE__ */ (0, P.jsxs)(r, { children: [/* @__PURE__ */ (0, P.jsx)(n, {
267
- render: /* @__PURE__ */ (0, P.jsx)(c, {
268
- variant: "ghost",
269
- size: "sm",
270
- onClick: y,
271
- className: "h-8 w-8 p-0",
272
- children: v ? /* @__PURE__ */ (0, P.jsx)(u, { className: "h-4 w-4 text-green-600" }) : /* @__PURE__ */ (0, P.jsx)(d, { className: "h-4 w-4" })
273
- }),
274
- nativeButton: !0
275
- }), /* @__PURE__ */ (0, P.jsx)(i, { children: "Copy request" })] }),
276
- /* @__PURE__ */ (0, P.jsxs)(r, { children: [/* @__PURE__ */ (0, P.jsx)(n, {
277
- render: /* @__PURE__ */ (0, P.jsx)(c, {
278
- variant: "ghost",
279
- size: "sm",
280
- onClick: b,
281
- className: "h-8 w-8 p-0",
282
- children: /* @__PURE__ */ (0, P.jsx)(m, { className: "h-4 w-4" })
283
- }),
284
- nativeButton: !0
285
- }), /* @__PURE__ */ (0, P.jsx)(i, { children: "Download request" })] }),
286
- /* @__PURE__ */ (0, P.jsxs)(r, { children: [/* @__PURE__ */ (0, P.jsx)(n, {
287
- render: /* @__PURE__ */ (0, P.jsx)(c, {
288
- variant: "ghost",
289
- size: "sm",
290
- onClick: x,
291
- className: "h-8 w-8 p-0",
292
- children: /* @__PURE__ */ (0, P.jsx)(C, { className: "h-4 w-4" })
293
- }),
294
- nativeButton: !0
295
- }), /* @__PURE__ */ (0, P.jsx)(i, { children: "Fullscreen" })] }),
296
- /* @__PURE__ */ (0, P.jsx)(c, {
297
- variant: "ghost",
298
- size: "sm",
299
- onClick: f,
300
- className: "h-8 w-8 p-0",
301
- children: /* @__PURE__ */ (0, P.jsx)(T, { className: "h-4 w-4" })
302
- })
303
- ]
304
- })]
305
- }),
306
- /* @__PURE__ */ (0, P.jsxs)("div", {
307
- className: "flex-1 overflow-y-auto p-4 space-y-6",
308
- children: [
309
- /* @__PURE__ */ (0, P.jsxs)("div", {
310
- className: "space-y-2",
311
- children: [/* @__PURE__ */ (0, P.jsx)("h4", {
312
- className: "text-sm font-semibold text-gray-900 dark:text-gray-100",
313
- children: "Message"
314
- }), /* @__PURE__ */ (0, P.jsx)("p", {
315
- className: "text-sm text-gray-700 dark:text-gray-300",
316
- children: t.request.message
317
- })]
318
- }),
319
- N && "url" in t.request && /* @__PURE__ */ (0, P.jsxs)("div", {
320
- className: "space-y-2",
321
- children: [/* @__PURE__ */ (0, P.jsx)("h4", {
322
- className: "text-sm font-semibold text-gray-900 dark:text-gray-100",
323
- children: "External Action Required"
324
- }), /* @__PURE__ */ (0, P.jsxs)("div", {
325
- className: "bg-muted rounded-lg p-4 space-y-3",
326
- children: [
327
- /* @__PURE__ */ (0, P.jsx)("p", {
328
- className: "text-sm text-muted-foreground",
329
- children: "This request requires you to complete an action at an external URL:"
330
- }),
331
- /* @__PURE__ */ (0, P.jsxs)("div", {
332
- className: "flex items-center gap-2 p-2 bg-background rounded border",
333
- children: [/* @__PURE__ */ (0, P.jsx)("code", {
334
- className: "flex-1 text-xs font-mono break-all",
335
- children: t.request.url
336
- }), /* @__PURE__ */ (0, P.jsxs)(c, {
337
- size: "sm",
338
- variant: "outline",
339
- onClick: () => {
340
- t && N && "url" in t.request && (window.open(t.request.url, "_blank"), k(!0));
341
- },
342
- className: "flex items-center gap-2",
343
- children: [/* @__PURE__ */ (0, P.jsx)(g, { className: "h-4 w-4" }), "Open URL"]
344
- })]
345
- }),
346
- /* @__PURE__ */ (0, P.jsxs)("div", {
347
- className: "flex items-center space-x-2 pt-2",
348
- children: [/* @__PURE__ */ (0, P.jsx)(A, {
349
- id: "url-completed",
350
- checked: O,
351
- onCheckedChange: (e) => k(!!e)
352
- }), /* @__PURE__ */ (0, P.jsx)(l, {
353
- htmlFor: "url-completed",
354
- className: "text-sm font-normal cursor-pointer",
355
- children: "I have completed the required action"
356
- })]
357
- })
358
- ]
359
- })]
360
- }),
361
- M && /* @__PURE__ */ (0, P.jsxs)("div", {
362
- className: "space-y-2",
363
- children: [/* @__PURE__ */ (0, P.jsx)("h4", {
364
- className: "text-sm font-semibold text-gray-900 dark:text-gray-100",
365
- children: "Form Data"
366
- }), /* @__PURE__ */ (0, P.jsx)(I, {
367
- request: t,
368
- formData: S,
369
- onFieldChange: w,
370
- idPrefix: "field",
371
- testIdPrefix: "elicitation-field",
372
- emptyFallback: /* @__PURE__ */ (0, P.jsx)("div", {
373
- className: "text-sm text-gray-500 dark:text-gray-400",
374
- children: "No form schema available"
375
- })
376
- })]
377
- }),
378
- M && "requestedSchema" in t.request && t.request.requestedSchema && /* @__PURE__ */ (0, P.jsxs)("details", {
379
- className: "space-y-2",
380
- children: [/* @__PURE__ */ (0, P.jsx)("summary", {
381
- className: "text-sm font-semibold text-gray-900 dark:text-gray-100 cursor-pointer",
382
- children: "Schema (for reference)"
383
- }), /* @__PURE__ */ (0, P.jsx)("div", {
384
- className: "bg-muted rounded-lg p-3 max-h-64 overflow-auto",
385
- children: /* @__PURE__ */ (0, P.jsx)(h, { data: t.request.requestedSchema })
386
- })]
387
- })
388
- ]
389
- }),
390
- /* @__PURE__ */ (0, P.jsxs)("div", {
391
- className: "flex gap-2 p-4 border-t dark:border-zinc-700",
392
- children: [
393
- /* @__PURE__ */ (0, P.jsx)(c, {
394
- onClick: () => {
395
- if (t) {
396
- if (M) {
397
- let e = E();
398
- if (e.length > 0) {
399
- D.error("Missing required fields", { description: `Please fill in: ${e.join(", ")}` });
400
- return;
401
- }
402
- o(t.id, {
403
- action: "accept",
404
- content: S
405
- });
406
- } else N && o(t.id, { action: "accept" });
407
- f(), import("./react-BIs9pQ3H.js").then((t) => /* @__PURE__ */ e(t.t(), 1)).then((e) => {
408
- let t = D(e.createElement("div", { className: "space-y-3" }, e.createElement("div", null, e.createElement("strong", null, "Elicitation Response Sent"), e.createElement("p", { className: "text-sm text-muted-foreground mt-1" }, "The tool will continue executing.")), e.createElement("div", { className: "flex gap-2" }, e.createElement("button", {
409
- "data-testid": "elicitation-view-tool-result",
410
- className: "px-3 py-1.5 text-xs font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90",
411
- onClick: () => {
412
- let e = new globalThis.CustomEvent("navigate-to-tool-result", { detail: { toolName: null } });
413
- window.dispatchEvent(e), D.dismiss(t);
414
- }
415
- }, "View Tool Result"))), { duration: 5e3 });
416
- });
417
- }
418
- },
419
- className: "flex-1",
420
- disabled: N && !O,
421
- "data-testid": "elicitation-accept-button",
422
- children: "Accept"
423
- }),
424
- /* @__PURE__ */ (0, P.jsx)(c, {
425
- onClick: () => {
426
- t && (o(t.id, { action: "decline" }), f());
427
- },
428
- variant: "outline",
429
- className: "flex-1",
430
- "data-testid": "elicitation-decline-button",
431
- children: "Decline"
432
- }),
433
- /* @__PURE__ */ (0, P.jsx)(c, {
434
- onClick: () => {
435
- t && (s(t.id, "User cancelled elicitation request"), f());
436
- },
437
- variant: "outline",
438
- className: "flex-1",
439
- "data-testid": "elicitation-cancel-button",
440
- children: "Cancel"
441
- })
442
- ]
443
- })
444
- ]
445
- }) : /* @__PURE__ */ (0, P.jsx)("div", {
446
- className: "flex flex-col items-center justify-center h-full p-4 text-center",
447
- children: /* @__PURE__ */ (0, P.jsx)("p", {
448
- className: "text-gray-500 dark:text-gray-400",
449
- children: "Select an elicitation request to view details"
450
- })
451
- });
452
- }
453
- //#endregion
454
- //#region src/client/components/ElicitationTab.tsx
455
- function z({ pendingRequests: e = [], onApprove: t, onReject: n, serverId: r, isConnected: i }) {
456
- let { selectedElicitationRequestId: a, setSelectedElicitationRequestId: o } = O(), [s, c] = (0, N.useState)(null), [l, u] = (0, N.useState)(""), [d, m] = (0, N.useState)(-1), [h, g] = (0, N.useState)(!0), [x, C] = (0, N.useState)(!1), [E, D] = (0, N.useState)(!0), [k, A] = (0, N.useState)(!1), j = (0, N.useRef)(null), M = (0, N.useRef)(null), I = (0, N.useRef)(null), L = (0, N.useRef)(!1);
457
- (0, N.useEffect)(() => {
458
- if (console.log("[ElicitationTab] Auto-selection check:", {
459
- selectedElicitationRequestId: a,
460
- pendingRequestsCount: e.length,
461
- currentSelectedId: s?.id
462
- }), a && e.length > 0) {
463
- let t = e.find((e) => e.id === a);
464
- console.log("[ElicitationTab] Found request for auto-selection:", !!t, t?.id), t && (console.log("[ElicitationTab] Auto-selecting request:", t.id), o(null), c(t), setTimeout(() => {
465
- let e = document.getElementById(`elicitation-request-${t.id}`);
466
- console.log("[ElicitationTab] Scrolling to element:", !!e), e && e.scrollIntoView({
467
- behavior: "smooth",
468
- block: "nearest"
469
- });
470
- }, 100));
471
- }
472
- }, [
473
- a,
474
- e,
475
- o
476
- ]), (0, N.useEffect)(() => {
477
- let t = (t) => {
478
- let n = t.detail.requestId;
479
- console.log("[ElicitationTab] Custom navigate event received:", n);
480
- let r = e.find((e) => e.id === n);
481
- r && (console.log("[ElicitationTab] Selecting request from event:", n), c(r), setTimeout(() => {
482
- let e = document.getElementById(`elicitation-request-${n}`);
483
- e && e.scrollIntoView({
484
- behavior: "smooth",
485
- block: "nearest"
486
- });
487
- }, 200));
488
- };
489
- return window.addEventListener("navigate-to-elicitation", t), () => window.removeEventListener("navigate-to-elicitation", t);
490
- }, [e]), (0, N.useEffect)(() => {
491
- h && e.length > 0 && j.current && !L.current && (j.current.scrollTop = 0);
492
- }, [e.length, h]), (0, N.useEffect)(() => {
493
- let e = j.current;
494
- if (!e) return;
495
- let t = () => {
496
- e.scrollTop > 0 && (L.current = !0, g(!1));
497
- };
498
- return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
499
- }, []), (0, N.useEffect)(() => {
500
- e.length === 0 && (L.current = !1, g(!0));
501
- }, [e.length]), (0, N.useEffect)(() => {
502
- x && I.current && I.current.focus();
503
- }, [x]);
504
- let z = (0, N.useCallback)(() => {
505
- l.trim() || C(!1);
506
- }, [l]), B = (0, N.useMemo)(() => {
507
- if (!l.trim()) return e;
508
- let t = l.toLowerCase();
509
- return e.filter((e) => e.serverName.toLowerCase().includes(t) || e.request.message.toLowerCase().includes(t) || JSON.stringify(e.request || {}).toLowerCase().includes(t));
510
- }, [e, l]);
511
- (0, N.useEffect)(() => {
512
- m(-1);
513
- }, [l]), (0, N.useEffect)(() => {
514
- let e = (e) => {
515
- let t = e.target;
516
- if (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.contentEditable === "true" || e.metaKey || e.ctrlKey || e.altKey) return;
517
- let n = B;
518
- if (e.key === "ArrowDown") e.preventDefault(), m((e) => {
519
- let t = e + 1;
520
- return t >= n.length ? 0 : t;
521
- });
522
- else if (e.key === "ArrowUp") e.preventDefault(), m((e) => {
523
- let t = e - 1;
524
- return t < 0 ? n.length - 1 : t;
525
- });
526
- else if (e.key === "Enter" && d >= 0) {
527
- e.preventDefault();
528
- let t = B[d];
529
- t && V(t);
530
- }
531
- };
532
- return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
533
- }, [d, B]), (0, N.useEffect)(() => {
534
- if (d >= 0) {
535
- let e = `elicitation-request-${B[d]?.id}`, t = document.getElementById(e);
536
- t && t.scrollIntoView({
537
- behavior: "smooth",
538
- block: "nearest"
539
- });
540
- }
541
- }, [d, B]);
542
- let V = (0, N.useCallback)((e) => {
543
- c(e);
544
- }, []), H = (0, N.useCallback)(() => {
545
- window.confirm("Are you sure you want to cancel all elicitation requests? This cannot be undone.") && (e.forEach((e) => {
546
- n(e.id, "User cancelled all requests");
547
- }), c(null));
548
- }, [e, n]), U = (0, N.useCallback)(async () => {
549
- if (s) try {
550
- await p(JSON.stringify({
551
- id: s.id,
552
- serverName: s.serverName,
553
- timestamp: s.timestamp,
554
- request: s.request
555
- }, null, 2)), A(!0), setTimeout(() => A(!1), 2e3);
556
- } catch (e) {
557
- console.error("[ElicitationTab] Failed to copy request:", e);
558
- }
559
- }, [s]), W = (0, N.useCallback)(() => {
560
- if (s) try {
561
- let e = new globalThis.Blob([JSON.stringify({
562
- id: s.id,
563
- serverName: s.serverName,
564
- timestamp: s.timestamp,
565
- request: s.request
566
- }, null, 2)], { type: "application/json" }), t = URL.createObjectURL(e), n = document.createElement("a");
567
- n.href = t, n.download = `elicitation-request-${Date.now()}.json`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(t);
568
- } catch (e) {
569
- console.error("[ElicitationTab] Failed to download request:", e);
570
- }
571
- }, [s]), G = (0, N.useCallback)(async () => {
572
- if (M.current) try {
573
- document.fullscreenElement ? await document.exitFullscreen() : await M.current.requestFullscreen();
574
- } catch (e) {
575
- console.error("[ElicitationTab] Failed to toggle fullscreen:", e);
576
- }
577
- }, []);
578
- return i ? /* @__PURE__ */ (0, P.jsxs)(b, {
579
- orientation: "horizontal",
580
- className: "h-full",
581
- children: [
582
- /* @__PURE__ */ (0, P.jsx)(_, {
583
- defaultSize: 40,
584
- minSize: 30,
585
- children: /* @__PURE__ */ (0, P.jsx)(b, {
586
- orientation: "vertical",
587
- className: "h-full border-r dark:border-zinc-700",
588
- children: /* @__PURE__ */ (0, P.jsx)(_, {
589
- defaultSize: 75,
590
- minSize: 30,
591
- className: "h-full overflow-hidden",
592
- children: /* @__PURE__ */ (0, P.jsx)(y, {
593
- scrollRef: j,
594
- children: (t) => /* @__PURE__ */ (0, P.jsxs)(P.Fragment, { children: [/* @__PURE__ */ (0, P.jsx)(S, {
595
- isScrolled: t,
596
- title: "Elicitation",
597
- icon: w,
598
- titleTestId: "elicitation-tab-header",
599
- count: B.length,
600
- isSearchExpanded: x,
601
- searchQuery: l,
602
- searchPlaceholder: "Search requests...",
603
- onSearchExpand: () => C(!0),
604
- onSearchChange: u,
605
- onSearchBlur: z,
606
- bulkAction: {
607
- icon: T,
608
- label: "Cancel all",
609
- onClick: H,
610
- disabled: e.length === 0
611
- },
612
- searchInputRef: I
613
- }), /* @__PURE__ */ (0, P.jsx)(F, {
614
- requests: B,
615
- selectedRequest: s,
616
- onRequestSelect: V,
617
- focusedIndex: d,
618
- formatRelativeTime: f
619
- })] })
620
- })
621
- })
622
- })
623
- }),
624
- /* @__PURE__ */ (0, P.jsx)(v, {}),
625
- /* @__PURE__ */ (0, P.jsx)(_, {
626
- defaultSize: 60,
627
- minSize: 40,
628
- children: /* @__PURE__ */ (0, P.jsx)("div", {
629
- ref: M,
630
- className: "h-full bg-white dark:bg-zinc-900",
631
- children: /* @__PURE__ */ (0, P.jsx)(R, {
632
- request: s,
633
- onApprove: t,
634
- onReject: n,
635
- onClose: () => c(null),
636
- previewMode: E,
637
- onTogglePreview: () => D(!E),
638
- isCopied: k,
639
- onCopy: U,
640
- onDownload: W,
641
- onFullscreen: G
642
- })
643
- })
644
- })
645
- ]
646
- }) : /* @__PURE__ */ (0, P.jsxs)("div", {
647
- className: "flex flex-col items-center justify-center h-full p-4 text-center",
648
- children: [/* @__PURE__ */ (0, P.jsx)(w, { className: "h-12 w-12 text-gray-400 dark:text-gray-600 mb-3" }), /* @__PURE__ */ (0, P.jsx)("p", {
649
- className: "text-gray-500 dark:text-gray-400",
650
- children: "Not connected to server"
651
- })]
652
- });
653
- }
654
- //#endregion
655
- export { z as ElicitationTab };