@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.
- package/README.md +2 -2
- package/dist/cdn/inspector.js +76909 -9272
- package/dist/cli.js +1 -1
- package/dist/server/cdn-shell.js +2 -2
- package/dist/server/{chunk-3XD7J5NX.js → chunk-FHC5ZGMM.js} +1 -1
- package/dist/server/{chunk-N3VXWLT6.js → chunk-QXOCY5ZE.js} +1 -1
- package/dist/server/{chunk-DLHO3Q42.js → chunk-R5ZEVRE5.js} +1 -1
- package/dist/server/cli.js +2 -2
- package/dist/server/index.js +3 -3
- package/dist/server/middleware.js +3 -3
- package/dist/server/version.js +1 -1
- package/dist/web/assets/index-BgHcVJO3.js +643 -0
- package/dist/web/index.html +2 -10
- package/package.json +4 -4
- package/dist/cdn/AnimatePresence-D1bZ5_-l.js +0 -394
- package/dist/cdn/ChatTab-D_2TXR3X.js +0 -6811
- package/dist/cdn/CheckboxIndicator-BjF73mGX.js +0 -252
- package/dist/cdn/ConnectionSettingsForm-BqH0PcZF.js +0 -929
- package/dist/cdn/ConnectionSettingsTab-Duhb1uQP.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-w5NRWhlZ.js +0 -2174
- package/dist/cdn/ManufactOAuthCallback-ChbbjFIT.js +0 -31
- package/dist/cdn/MarkdownRenderer-BIsUE0bf.js +0 -3610
- package/dist/cdn/McpAppsViewPanel-B3_76u7O.js +0 -56
- package/dist/cdn/NotificationsTab-B7uebqMV.js +0 -290
- package/dist/cdn/OAuthCallback-CtLoXa3h.js +0 -58
- package/dist/cdn/PromptsTab-DpE0XLzk.js +0 -902
- package/dist/cdn/ResourcesTab-DQS24z5p.js +0 -566
- package/dist/cdn/SamplingTab-ZDeu0CjJ.js +0 -659
- package/dist/cdn/ServerMetadataTab-BM3VhSLf.js +0 -244
- package/dist/cdn/StatusIcon-Q3n3YRtE.js +0 -65
- package/dist/cdn/ToolsTab-LtviZSWA.js +0 -2045
- package/dist/cdn/ViewPreview-BwC_tbF_.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-CHKts0NS.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-DO-sd0TA.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-BDA-xrgK.js +0 -5421
- package/dist/cdn/react-BIs9pQ3H.js +0 -926
- 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-e4uEESP7.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-Dw_6Ztzr.js +0 -235
- package/dist/cdn/useSavedRequests-mSIsDd4c.js +0 -51
- package/dist/cdn/useViewHostProps-BPApUBaM.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-BhoU_ges.js +0 -18
- package/dist/web/assets/ConnectionSettingsTab-vJcr7uI3.js +0 -1
- package/dist/web/assets/ElicitationTab-4my-wtXf.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-Cd4s9mr1.js +0 -34
- package/dist/web/assets/ManufactOAuthCallback-CCRWJhuT.js +0 -1
- package/dist/web/assets/MarkdownRenderer-BUDZYHqm.js +0 -47
- package/dist/web/assets/McpAppsViewPanel-Cil7Fdy4.js +0 -1
- package/dist/web/assets/NotificationsTab-Bl3O5PRb.js +0 -1
- package/dist/web/assets/OAuthCallback-CceVgo-9.js +0 -1
- package/dist/web/assets/PromptsTab-8lSxb8x-.js +0 -15
- package/dist/web/assets/ResourcesTab-DtGfgsPv.js +0 -2
- package/dist/web/assets/SamplingTab-XC-DTfOo.js +0 -1
- package/dist/web/assets/ServerMetadataTab-C5d_dI3_.js +0 -1
- package/dist/web/assets/ToolsTab-DuHPXItY.js +0 -8
- package/dist/web/assets/ViewPreview-DXswO9q8.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-DAfdiGl1.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-C2Y1wkk6.js +0 -21
- package/dist/web/assets/index-tu5-QdSJ.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-c1Yr-wvV.js +0 -1
- package/dist/web/assets/sparkles-BGYTDThM.js +0 -1
- package/dist/web/assets/tabs-subtle-CHvFXVIA.js +0 -1
- package/dist/web/assets/textarea-CRTXuRmE.js +0 -1
- package/dist/web/assets/useConfig-9UVqLmR_.js +0 -1
- package/dist/web/assets/useViewHostProps-BBoPQYEl.js +0 -1
- package/dist/web/assets/zap-BDWHCVHU.js +0 -1
|
@@ -1,659 +0,0 @@
|
|
|
1
|
-
import { s as e, t } from "./react-BIs9pQ3H.js";
|
|
2
|
-
import { a as n, n as r, r as i, t as a } from "./input-BCpgLXU1.js";
|
|
3
|
-
import { n as o } from "./createLucideIcon-BONxC1L5.js";
|
|
4
|
-
import { t as s } from "./button-CB4uOoUV.js";
|
|
5
|
-
import { t as c } from "./label-A0UGV8FE.js";
|
|
6
|
-
import { a as l, i as u, n as d, r as f, t as p } from "./select-CCFHjOGk.js";
|
|
7
|
-
import { a as m, i as h, r as g, t as _ } from "./browser-DG2Z8392.js";
|
|
8
|
-
import { a as v, t as y } from "./JSONDisplay-BJqMz7Ny.js";
|
|
9
|
-
import { a as b, i as ee, n as x, o as S, r as C, t as te } from "./shared-CJVHJhag.js";
|
|
10
|
-
import { t as w } from "./hash-DDs2vE1k.js";
|
|
11
|
-
import { t as T } from "./loader-circle-BKRHJEB7.js";
|
|
12
|
-
import { t as E } from "./maximize-2-DdrB_spi.js";
|
|
13
|
-
import { t as D } from "./sparkles-CxeZpVtX.js";
|
|
14
|
-
import { t as O } from "./trash-2-BhumJAFE.js";
|
|
15
|
-
import { t as k } from "./x-EilKPiCX.js";
|
|
16
|
-
import { t as A } from "./not-found-BajFyZpp.js";
|
|
17
|
-
import { u as j } from "./cfWorker-Bxcs9rNe.js";
|
|
18
|
-
import "./react-BDA-xrgK.js";
|
|
19
|
-
import { n as M } from "./dist-CTJnCYmk.js";
|
|
20
|
-
import { n as N } from "./InspectorContext-BBKCdfmK.js";
|
|
21
|
-
import { a as P } from "./dist-CHKts0NS.js";
|
|
22
|
-
import { t as F } from "./useConfig-Dw_6Ztzr.js";
|
|
23
|
-
import { t as I } from "./textarea-CwmI8_uI.js";
|
|
24
|
-
//#region src/client/components/sampling/SamplingRequestsList.tsx
|
|
25
|
-
var L = /* @__PURE__ */ e(t(), 1), R = o();
|
|
26
|
-
function z({ requests: e, selectedRequest: t, onRequestSelect: n, focusedIndex: r, formatRelativeTime: i }) {
|
|
27
|
-
return e.length === 0 ? /* @__PURE__ */ (0, R.jsx)("div", {
|
|
28
|
-
className: "flex flex-1 flex-col items-center justify-center p-4 text-center",
|
|
29
|
-
children: /* @__PURE__ */ (0, R.jsx)(A, {
|
|
30
|
-
vertical: !0,
|
|
31
|
-
noBorder: !0,
|
|
32
|
-
message: "No sampling requests"
|
|
33
|
-
})
|
|
34
|
-
}) : /* @__PURE__ */ (0, R.jsx)("div", { children: e.map((e, a) => {
|
|
35
|
-
let o = e.request.params?.messages?.length || 0, s = e.request.params?.maxTokens;
|
|
36
|
-
return /* @__PURE__ */ (0, R.jsx)(C, {
|
|
37
|
-
id: `sampling-request-${e.id}`,
|
|
38
|
-
isSelected: t?.id === e.id,
|
|
39
|
-
isFocused: r === a,
|
|
40
|
-
title: /* @__PURE__ */ (0, R.jsxs)("span", {
|
|
41
|
-
className: "flex items-center gap-3",
|
|
42
|
-
children: [e.serverName, /* @__PURE__ */ (0, R.jsx)("span", { className: "size-1.5 block rounded-full bg-orange-500" })]
|
|
43
|
-
}),
|
|
44
|
-
description: (() => {
|
|
45
|
-
let t = i(e.timestamp), n = [];
|
|
46
|
-
return o > 0 && n.push(`${o} message${o > 1 ? "s" : ""}`), s && n.push(`max ${s} tokens`), t + (n.length > 0 ? ` | ${n.join(", ")}` : "");
|
|
47
|
-
})(),
|
|
48
|
-
onClick: () => n(e)
|
|
49
|
-
}, e.id);
|
|
50
|
-
}) });
|
|
51
|
-
}
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/client/components/sampling/useSamplingLLM.ts
|
|
54
|
-
function B({ llmConfig: e }) {
|
|
55
|
-
return {
|
|
56
|
-
generateResponse: (0, L.useCallback)(async ({ request: t }) => {
|
|
57
|
-
if (!e) throw Error("LLM config is not available");
|
|
58
|
-
let n = t.params || {}, r = n.maxTokens, i = n.temperature, a = n.messages || [];
|
|
59
|
-
if (a.length === 0) throw Error("No messages found in sampling request");
|
|
60
|
-
let o = [];
|
|
61
|
-
for (let e of a) {
|
|
62
|
-
if (!e || !e.role) continue;
|
|
63
|
-
let t = Array.isArray(e.content) ? e.content[0] : e.content;
|
|
64
|
-
t && t.type === "text" && t.text && (e.role === "user" || e.role === "assistant") && o.push({
|
|
65
|
-
role: e.role,
|
|
66
|
-
content: t.text
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
if (o.length === 0) throw Error("No valid messages could be converted. Please ensure messages have 'text' content type.");
|
|
70
|
-
return {
|
|
71
|
-
role: "assistant",
|
|
72
|
-
content: {
|
|
73
|
-
type: "text",
|
|
74
|
-
text: await P({
|
|
75
|
-
config: {
|
|
76
|
-
provider: e.provider,
|
|
77
|
-
model: e.model,
|
|
78
|
-
apiKey: e.apiKey,
|
|
79
|
-
temperature: i ?? e.temperature,
|
|
80
|
-
maxTokens: r,
|
|
81
|
-
baseUrl: e.baseUrl
|
|
82
|
-
},
|
|
83
|
-
messages: o
|
|
84
|
-
})
|
|
85
|
-
},
|
|
86
|
-
model: e.model,
|
|
87
|
-
stopReason: "endTurn"
|
|
88
|
-
};
|
|
89
|
-
}, [e]),
|
|
90
|
-
isAvailable: e !== null
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
//#endregion
|
|
94
|
-
//#region src/client/components/sampling/SamplingRequestDisplay.tsx
|
|
95
|
-
function V({ request: t, onApprove: o, onReject: g, onClose: _, previewMode: b, onTogglePreview: ee, isCopied: x, onCopy: S, onDownload: C, onFullscreen: te, llmConfig: w }) {
|
|
96
|
-
let [O, A] = (0, L.useState)("manual"), [N, P] = (0, L.useState)("stub-model"), [F, z] = (0, L.useState)("endTurn"), [V, H] = (0, L.useState)("assistant"), [U, W] = (0, L.useState)("text"), [G, K] = (0, L.useState)("positive"), [q, J] = (0, L.useState)(""), [Y, X] = (0, L.useState)("image/png"), [Z, ne] = (0, L.useState)(!1), [re, Q] = (0, L.useState)(null), { generateResponse: ie, isAvailable: $ } = B({ llmConfig: w });
|
|
97
|
-
(0, L.useEffect)(() => {
|
|
98
|
-
t && (P(O === "llm" && w?.model ? w.model : "stub-model"), z("endTurn"), H("assistant"), W("text"), K("positive"), J(""), X("image/png"), Q(null));
|
|
99
|
-
}, [t?.id]), (0, L.useEffect)(() => {
|
|
100
|
-
O === "llm" && w?.model && P(w.model);
|
|
101
|
-
}, [O, w?.model]);
|
|
102
|
-
let ae = async () => {
|
|
103
|
-
if (!t || !$) {
|
|
104
|
-
console.log("[SamplingRequestDisplay] Cannot generate:", {
|
|
105
|
-
hasRequest: !!t,
|
|
106
|
-
isAvailable: $
|
|
107
|
-
});
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
console.log("[SamplingRequestDisplay] Starting LLM generation:", {
|
|
111
|
-
requestId: t.id,
|
|
112
|
-
llmConfig: w
|
|
113
|
-
}), ne(!0), Q(null);
|
|
114
|
-
try {
|
|
115
|
-
let e = await ie({ request: t.request });
|
|
116
|
-
console.log("[SamplingRequestDisplay] LLM generation result:", {
|
|
117
|
-
result: e,
|
|
118
|
-
model: e.model,
|
|
119
|
-
stopReason: e.stopReason,
|
|
120
|
-
role: e.role,
|
|
121
|
-
contentIsArray: Array.isArray(e.content),
|
|
122
|
-
content: e.content
|
|
123
|
-
}), P(e.model || w?.model || "stub-model"), z(e.stopReason || "endTurn"), H(e.role || "assistant");
|
|
124
|
-
let n = Array.isArray(e.content) ? e.content[0] : e.content;
|
|
125
|
-
console.log("[SamplingRequestDisplay] Setting content:", {
|
|
126
|
-
contentType: n.type,
|
|
127
|
-
hasText: "text" in n,
|
|
128
|
-
text: "text" in n ? n.text : void 0
|
|
129
|
-
}), n.type === "text" ? (W("text"), K(n.text || ""), console.log("[SamplingRequestDisplay] Set text content:", n.text)) : n.type === "image" && (W("image"), J(n.data || ""), X(n.mimeType || "image/png"), console.log("[SamplingRequestDisplay] Set image content")), console.log("[SamplingRequestDisplay] Form state after update:", {
|
|
130
|
-
model: N,
|
|
131
|
-
stopReason: F,
|
|
132
|
-
role: V,
|
|
133
|
-
contentType: U,
|
|
134
|
-
textContent: G
|
|
135
|
-
});
|
|
136
|
-
} catch (e) {
|
|
137
|
-
console.error("[SamplingRequestDisplay] LLM generation error:", e);
|
|
138
|
-
let t = e instanceof Error ? e.message : "Failed to generate response";
|
|
139
|
-
Q(t), M.error("LLM Generation Failed", { description: t });
|
|
140
|
-
} finally {
|
|
141
|
-
ne(!1), console.log("[SamplingRequestDisplay] Generation complete");
|
|
142
|
-
}
|
|
143
|
-
}, oe = (0, L.useMemo)(() => {
|
|
144
|
-
let e = {
|
|
145
|
-
model: N,
|
|
146
|
-
stopReason: F,
|
|
147
|
-
role: V,
|
|
148
|
-
content: { type: U }
|
|
149
|
-
};
|
|
150
|
-
return U === "text" ? e.content.text = G : U === "image" && (e.content.data = q, e.content.mimeType = Y), e;
|
|
151
|
-
}, [
|
|
152
|
-
N,
|
|
153
|
-
F,
|
|
154
|
-
V,
|
|
155
|
-
U,
|
|
156
|
-
G,
|
|
157
|
-
q,
|
|
158
|
-
Y
|
|
159
|
-
]);
|
|
160
|
-
return t ? /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
161
|
-
className: "flex flex-col h-full",
|
|
162
|
-
children: [
|
|
163
|
-
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
164
|
-
className: "flex items-center justify-between p-4 border-b dark:border-zinc-700",
|
|
165
|
-
children: [/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
166
|
-
className: "flex items-center gap-2",
|
|
167
|
-
children: [/* @__PURE__ */ (0, R.jsx)("h3", {
|
|
168
|
-
className: "font-medium text-gray-900 dark:text-gray-100",
|
|
169
|
-
children: t.serverName
|
|
170
|
-
}), /* @__PURE__ */ (0, R.jsx)("span", {
|
|
171
|
-
className: "text-sm text-gray-500 dark:text-gray-400",
|
|
172
|
-
children: new Date(t.timestamp).toLocaleString()
|
|
173
|
-
})]
|
|
174
|
-
}), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
175
|
-
className: "flex items-center gap-2",
|
|
176
|
-
children: [
|
|
177
|
-
/* @__PURE__ */ (0, R.jsxs)(r, { children: [/* @__PURE__ */ (0, R.jsx)(n, {
|
|
178
|
-
render: /* @__PURE__ */ (0, R.jsx)(s, {
|
|
179
|
-
variant: "ghost",
|
|
180
|
-
size: "sm",
|
|
181
|
-
onClick: S,
|
|
182
|
-
className: "h-8 w-8 p-0",
|
|
183
|
-
children: x ? /* @__PURE__ */ (0, R.jsx)(m, { className: "h-4 w-4 text-green-600" }) : /* @__PURE__ */ (0, R.jsx)(h, { className: "h-4 w-4" })
|
|
184
|
-
}),
|
|
185
|
-
nativeButton: !0
|
|
186
|
-
}), /* @__PURE__ */ (0, R.jsx)(i, { children: "Copy request" })] }),
|
|
187
|
-
/* @__PURE__ */ (0, R.jsxs)(r, { children: [/* @__PURE__ */ (0, R.jsx)(n, {
|
|
188
|
-
render: /* @__PURE__ */ (0, R.jsx)(s, {
|
|
189
|
-
variant: "ghost",
|
|
190
|
-
size: "sm",
|
|
191
|
-
onClick: C,
|
|
192
|
-
className: "h-8 w-8 p-0",
|
|
193
|
-
children: /* @__PURE__ */ (0, R.jsx)(v, { className: "h-4 w-4" })
|
|
194
|
-
}),
|
|
195
|
-
nativeButton: !0
|
|
196
|
-
}), /* @__PURE__ */ (0, R.jsx)(i, { children: "Download request" })] }),
|
|
197
|
-
/* @__PURE__ */ (0, R.jsxs)(r, { children: [/* @__PURE__ */ (0, R.jsx)(n, {
|
|
198
|
-
render: /* @__PURE__ */ (0, R.jsx)(s, {
|
|
199
|
-
variant: "ghost",
|
|
200
|
-
size: "sm",
|
|
201
|
-
onClick: te,
|
|
202
|
-
className: "h-8 w-8 p-0",
|
|
203
|
-
children: /* @__PURE__ */ (0, R.jsx)(E, { className: "h-4 w-4" })
|
|
204
|
-
}),
|
|
205
|
-
nativeButton: !0
|
|
206
|
-
}), /* @__PURE__ */ (0, R.jsx)(i, { children: "Fullscreen" })] }),
|
|
207
|
-
/* @__PURE__ */ (0, R.jsx)(s, {
|
|
208
|
-
variant: "ghost",
|
|
209
|
-
size: "sm",
|
|
210
|
-
onClick: _,
|
|
211
|
-
className: "h-8 w-8 p-0",
|
|
212
|
-
children: /* @__PURE__ */ (0, R.jsx)(k, { className: "h-4 w-4" })
|
|
213
|
-
})
|
|
214
|
-
]
|
|
215
|
-
})]
|
|
216
|
-
}),
|
|
217
|
-
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
218
|
-
className: "flex-1 overflow-y-auto p-4 space-y-6",
|
|
219
|
-
children: [/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
220
|
-
className: "space-y-2",
|
|
221
|
-
children: [/* @__PURE__ */ (0, R.jsx)("h4", {
|
|
222
|
-
className: "text-sm font-semibold text-gray-900 dark:text-gray-100",
|
|
223
|
-
children: "Request"
|
|
224
|
-
}), /* @__PURE__ */ (0, R.jsx)("div", {
|
|
225
|
-
className: "bg-muted rounded-lg p-3 max-h-64 overflow-auto",
|
|
226
|
-
children: /* @__PURE__ */ (0, R.jsx)(y, { data: t.request })
|
|
227
|
-
})]
|
|
228
|
-
}), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
229
|
-
className: "space-y-4",
|
|
230
|
-
children: [
|
|
231
|
-
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
232
|
-
className: "flex items-center justify-between",
|
|
233
|
-
children: [/* @__PURE__ */ (0, R.jsx)("h4", {
|
|
234
|
-
className: "text-sm font-semibold text-gray-900 dark:text-gray-100",
|
|
235
|
-
children: "Response"
|
|
236
|
-
}), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
237
|
-
className: "flex items-center gap-2",
|
|
238
|
-
children: [/* @__PURE__ */ (0, R.jsx)(c, {
|
|
239
|
-
htmlFor: `responseMode-${t.id}`,
|
|
240
|
-
className: "text-xs text-gray-500 dark:text-gray-400",
|
|
241
|
-
children: "Mode:"
|
|
242
|
-
}), /* @__PURE__ */ (0, R.jsxs)(p, {
|
|
243
|
-
value: O,
|
|
244
|
-
onValueChange: (e) => A(e),
|
|
245
|
-
children: [/* @__PURE__ */ (0, R.jsx)(u, {
|
|
246
|
-
id: `responseMode-${t.id}`,
|
|
247
|
-
className: "w-32 h-8 text-xs",
|
|
248
|
-
"data-testid": "sampling-response-mode-select",
|
|
249
|
-
children: /* @__PURE__ */ (0, R.jsx)(l, {})
|
|
250
|
-
}), /* @__PURE__ */ (0, R.jsxs)(d, { children: [/* @__PURE__ */ (0, R.jsx)(f, {
|
|
251
|
-
value: "manual",
|
|
252
|
-
"data-testid": "sampling-response-mode-manual",
|
|
253
|
-
children: "Manual"
|
|
254
|
-
}), /* @__PURE__ */ (0, R.jsx)(f, {
|
|
255
|
-
value: "llm",
|
|
256
|
-
"data-testid": "sampling-response-mode-llm",
|
|
257
|
-
children: "LLM"
|
|
258
|
-
})] })]
|
|
259
|
-
})]
|
|
260
|
-
})]
|
|
261
|
-
}),
|
|
262
|
-
O === "llm" && /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
263
|
-
className: "space-y-2 p-3 bg-muted rounded-lg",
|
|
264
|
-
children: [$ ? /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
265
|
-
className: "flex items-center gap-2",
|
|
266
|
-
children: [/* @__PURE__ */ (0, R.jsx)(s, {
|
|
267
|
-
onClick: ae,
|
|
268
|
-
disabled: Z,
|
|
269
|
-
size: "sm",
|
|
270
|
-
className: "flex items-center gap-2",
|
|
271
|
-
"data-testid": "sampling-generate-llm-button",
|
|
272
|
-
children: Z ? /* @__PURE__ */ (0, R.jsxs)("span", {
|
|
273
|
-
"data-testid": "sampling-generating",
|
|
274
|
-
className: "flex items-center gap-2",
|
|
275
|
-
children: [/* @__PURE__ */ (0, R.jsx)(T, { className: "h-4 w-4 animate-spin" }), "Generating..."]
|
|
276
|
-
}) : /* @__PURE__ */ (0, R.jsxs)(R.Fragment, { children: [/* @__PURE__ */ (0, R.jsx)(D, { className: "h-4 w-4" }), "Generate with LLM"] })
|
|
277
|
-
}), /* @__PURE__ */ (0, R.jsxs)("span", {
|
|
278
|
-
className: "text-xs text-gray-500 dark:text-gray-400",
|
|
279
|
-
children: [
|
|
280
|
-
"Using ",
|
|
281
|
-
w?.provider,
|
|
282
|
-
" (",
|
|
283
|
-
w?.model,
|
|
284
|
-
")"
|
|
285
|
-
]
|
|
286
|
-
})]
|
|
287
|
-
}) : /* @__PURE__ */ (0, R.jsx)("div", {
|
|
288
|
-
className: "text-xs text-gray-500 dark:text-gray-400",
|
|
289
|
-
children: "LLM not configured. Please configure LLM in the Chat tab."
|
|
290
|
-
}), re && /* @__PURE__ */ (0, R.jsx)("div", {
|
|
291
|
-
className: "text-xs text-red-600 dark:text-red-400",
|
|
292
|
-
"data-testid": "sampling-generation-error",
|
|
293
|
-
children: re
|
|
294
|
-
})]
|
|
295
|
-
}),
|
|
296
|
-
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
297
|
-
className: "space-y-2",
|
|
298
|
-
children: [/* @__PURE__ */ (0, R.jsx)(c, {
|
|
299
|
-
htmlFor: `model-${t.id}`,
|
|
300
|
-
children: "Model"
|
|
301
|
-
}), /* @__PURE__ */ (0, R.jsx)(a, {
|
|
302
|
-
id: `model-${t.id}`,
|
|
303
|
-
value: N,
|
|
304
|
-
onChange: (e) => P(e.target.value),
|
|
305
|
-
placeholder: "stub-model",
|
|
306
|
-
disabled: O === "llm" && Z,
|
|
307
|
-
"data-testid": "sampling-model-input"
|
|
308
|
-
})]
|
|
309
|
-
}),
|
|
310
|
-
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
311
|
-
className: "space-y-2",
|
|
312
|
-
children: [/* @__PURE__ */ (0, R.jsx)(c, {
|
|
313
|
-
htmlFor: `stopReason-${t.id}`,
|
|
314
|
-
children: "Stop Reason"
|
|
315
|
-
}), /* @__PURE__ */ (0, R.jsx)(a, {
|
|
316
|
-
id: `stopReason-${t.id}`,
|
|
317
|
-
value: F,
|
|
318
|
-
onChange: (e) => z(e.target.value),
|
|
319
|
-
placeholder: "endTurn",
|
|
320
|
-
disabled: O === "llm" && Z,
|
|
321
|
-
"data-testid": "sampling-stop-reason-input"
|
|
322
|
-
})]
|
|
323
|
-
}),
|
|
324
|
-
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
325
|
-
className: "space-y-2",
|
|
326
|
-
children: [/* @__PURE__ */ (0, R.jsx)(c, {
|
|
327
|
-
htmlFor: `role-${t.id}`,
|
|
328
|
-
children: "Role"
|
|
329
|
-
}), /* @__PURE__ */ (0, R.jsxs)(p, {
|
|
330
|
-
value: V,
|
|
331
|
-
onValueChange: (e) => H(e),
|
|
332
|
-
disabled: O === "llm" && Z,
|
|
333
|
-
children: [/* @__PURE__ */ (0, R.jsx)(u, {
|
|
334
|
-
id: `role-${t.id}`,
|
|
335
|
-
"data-testid": "sampling-role-select",
|
|
336
|
-
children: /* @__PURE__ */ (0, R.jsx)(l, {})
|
|
337
|
-
}), /* @__PURE__ */ (0, R.jsxs)(d, { children: [/* @__PURE__ */ (0, R.jsx)(f, {
|
|
338
|
-
value: "assistant",
|
|
339
|
-
children: "assistant"
|
|
340
|
-
}), /* @__PURE__ */ (0, R.jsx)(f, {
|
|
341
|
-
value: "user",
|
|
342
|
-
children: "user"
|
|
343
|
-
})] })]
|
|
344
|
-
})]
|
|
345
|
-
}),
|
|
346
|
-
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
347
|
-
className: "space-y-2",
|
|
348
|
-
children: [/* @__PURE__ */ (0, R.jsx)(c, {
|
|
349
|
-
htmlFor: `contentType-${t.id}`,
|
|
350
|
-
children: "Content Type"
|
|
351
|
-
}), /* @__PURE__ */ (0, R.jsxs)(p, {
|
|
352
|
-
value: U,
|
|
353
|
-
onValueChange: (e) => W(e),
|
|
354
|
-
disabled: O === "llm" && Z,
|
|
355
|
-
children: [/* @__PURE__ */ (0, R.jsx)(u, {
|
|
356
|
-
id: `contentType-${t.id}`,
|
|
357
|
-
"data-testid": "sampling-content-type-select",
|
|
358
|
-
children: /* @__PURE__ */ (0, R.jsx)(l, {})
|
|
359
|
-
}), /* @__PURE__ */ (0, R.jsxs)(d, { children: [/* @__PURE__ */ (0, R.jsx)(f, {
|
|
360
|
-
value: "text",
|
|
361
|
-
children: "text"
|
|
362
|
-
}), /* @__PURE__ */ (0, R.jsx)(f, {
|
|
363
|
-
value: "image",
|
|
364
|
-
children: "image"
|
|
365
|
-
})] })]
|
|
366
|
-
})]
|
|
367
|
-
}),
|
|
368
|
-
U === "text" && /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
369
|
-
className: "space-y-2",
|
|
370
|
-
children: [/* @__PURE__ */ (0, R.jsx)(c, {
|
|
371
|
-
htmlFor: `text-${t.id}`,
|
|
372
|
-
children: "Text Content"
|
|
373
|
-
}), /* @__PURE__ */ (0, R.jsx)(I, {
|
|
374
|
-
id: `text-${t.id}`,
|
|
375
|
-
value: G,
|
|
376
|
-
onChange: (e) => K(e.target.value),
|
|
377
|
-
placeholder: "Enter response text...",
|
|
378
|
-
rows: 6,
|
|
379
|
-
disabled: O === "llm" && Z,
|
|
380
|
-
"data-testid": "sampling-text-content"
|
|
381
|
-
})]
|
|
382
|
-
}),
|
|
383
|
-
U === "image" && /* @__PURE__ */ (0, R.jsxs)(R.Fragment, { children: [/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
384
|
-
className: "space-y-2",
|
|
385
|
-
children: [/* @__PURE__ */ (0, R.jsx)(c, {
|
|
386
|
-
htmlFor: `imageData-${t.id}`,
|
|
387
|
-
children: "Base64 Image Data"
|
|
388
|
-
}), /* @__PURE__ */ (0, R.jsx)(I, {
|
|
389
|
-
id: `imageData-${t.id}`,
|
|
390
|
-
value: q,
|
|
391
|
-
onChange: (e) => J(e.target.value),
|
|
392
|
-
placeholder: "Base64 encoded image data...",
|
|
393
|
-
rows: 4,
|
|
394
|
-
disabled: O === "llm" && Z
|
|
395
|
-
})]
|
|
396
|
-
}), /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
397
|
-
className: "space-y-2",
|
|
398
|
-
children: [/* @__PURE__ */ (0, R.jsx)(c, {
|
|
399
|
-
htmlFor: `mimeType-${t.id}`,
|
|
400
|
-
children: "MIME Type"
|
|
401
|
-
}), /* @__PURE__ */ (0, R.jsx)(a, {
|
|
402
|
-
id: `mimeType-${t.id}`,
|
|
403
|
-
value: Y,
|
|
404
|
-
onChange: (e) => X(e.target.value),
|
|
405
|
-
placeholder: "image/png",
|
|
406
|
-
disabled: O === "llm" && Z
|
|
407
|
-
})]
|
|
408
|
-
})] })
|
|
409
|
-
]
|
|
410
|
-
})]
|
|
411
|
-
}),
|
|
412
|
-
/* @__PURE__ */ (0, R.jsxs)("div", {
|
|
413
|
-
className: "flex gap-2 p-4 border-t dark:border-zinc-700",
|
|
414
|
-
children: [/* @__PURE__ */ (0, R.jsx)(s, {
|
|
415
|
-
onClick: () => {
|
|
416
|
-
if (!t) return;
|
|
417
|
-
let n = j.CreateMessageResult["~standard"].validate(oe);
|
|
418
|
-
if (n.issues) {
|
|
419
|
-
M.error("Invalid response", { description: `Validation failed: ${n.issues.map((e) => e.message).join(", ")}` });
|
|
420
|
-
return;
|
|
421
|
-
}
|
|
422
|
-
o(t.id, n.value), _(), import("./react-BIs9pQ3H.js").then((t) => /* @__PURE__ */ e(t.t(), 1)).then((e) => {
|
|
423
|
-
let n = M(e.createElement("div", { className: "space-y-3" }, e.createElement("div", null, e.createElement("strong", null, "Sampling 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", {
|
|
424
|
-
"data-testid": "sampling-view-tool-result",
|
|
425
|
-
className: "px-3 py-1.5 text-xs font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90",
|
|
426
|
-
onClick: () => {
|
|
427
|
-
let e = new globalThis.CustomEvent("navigate-to-tool-result", { detail: { toolName: t.toolName } });
|
|
428
|
-
window.dispatchEvent(e), M.dismiss(n);
|
|
429
|
-
}
|
|
430
|
-
}, "View Tool Result"))), { duration: 5e3 });
|
|
431
|
-
});
|
|
432
|
-
},
|
|
433
|
-
className: "flex-1",
|
|
434
|
-
disabled: O === "llm" && Z,
|
|
435
|
-
"data-testid": "sampling-approve-button",
|
|
436
|
-
children: "Approve"
|
|
437
|
-
}), /* @__PURE__ */ (0, R.jsx)(s, {
|
|
438
|
-
onClick: () => {
|
|
439
|
-
t && (g(t.id, "User rejected sampling request"), _());
|
|
440
|
-
},
|
|
441
|
-
variant: "outline",
|
|
442
|
-
className: "flex-1",
|
|
443
|
-
disabled: O === "llm" && Z,
|
|
444
|
-
"data-testid": "sampling-reject-button",
|
|
445
|
-
children: "Reject"
|
|
446
|
-
})]
|
|
447
|
-
})
|
|
448
|
-
]
|
|
449
|
-
}) : /* @__PURE__ */ (0, R.jsx)("div", {
|
|
450
|
-
className: "flex flex-col items-center justify-center h-full p-4 text-center",
|
|
451
|
-
children: /* @__PURE__ */ (0, R.jsx)("p", {
|
|
452
|
-
className: "text-gray-500 dark:text-gray-400",
|
|
453
|
-
children: "Select a sampling request to view details"
|
|
454
|
-
})
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
//#endregion
|
|
458
|
-
//#region src/client/components/SamplingTab.tsx
|
|
459
|
-
function H({ pendingRequests: e, onApprove: t, onReject: n, serverId: r, isConnected: i, mcpServerUrl: a }) {
|
|
460
|
-
let { selectedSamplingRequestId: o, setSelectedSamplingRequestId: s } = N(), { llmConfig: c } = F({ mcpServerUrl: a }), [l, u] = (0, L.useState)(null), [d, f] = (0, L.useState)(""), [p, m] = (0, L.useState)(-1), [h, v] = (0, L.useState)(!0), [y, C] = (0, L.useState)(!1), [T, E] = (0, L.useState)(!0), [D, k] = (0, L.useState)(!1), A = (0, L.useRef)(null), j = (0, L.useRef)(null), M = (0, L.useRef)(null), P = (0, L.useRef)(!1);
|
|
461
|
-
(0, L.useEffect)(() => {
|
|
462
|
-
if (console.log("[SamplingTab] Auto-selection check:", {
|
|
463
|
-
selectedSamplingRequestId: o,
|
|
464
|
-
pendingRequestsCount: e.length,
|
|
465
|
-
currentSelectedId: l?.id
|
|
466
|
-
}), o && e.length > 0) {
|
|
467
|
-
let t = e.find((e) => e.id === o);
|
|
468
|
-
console.log("[SamplingTab] Found request for auto-selection:", !!t, t?.id), t && (console.log("[SamplingTab] Auto-selecting request:", t.id), s(null), u(t), setTimeout(() => {
|
|
469
|
-
let e = document.getElementById(`sampling-request-${t.id}`);
|
|
470
|
-
console.log("[SamplingTab] Scrolling to element:", !!e), e && e.scrollIntoView({
|
|
471
|
-
behavior: "smooth",
|
|
472
|
-
block: "nearest"
|
|
473
|
-
});
|
|
474
|
-
}, 100));
|
|
475
|
-
}
|
|
476
|
-
}, [
|
|
477
|
-
o,
|
|
478
|
-
e,
|
|
479
|
-
s
|
|
480
|
-
]), (0, L.useEffect)(() => {
|
|
481
|
-
let t = (t) => {
|
|
482
|
-
let n = t.detail.requestId;
|
|
483
|
-
console.log("[SamplingTab] Custom navigate event received:", n);
|
|
484
|
-
let r = e.find((e) => e.id === n);
|
|
485
|
-
r && (console.log("[SamplingTab] Selecting request from event:", n), u(r), setTimeout(() => {
|
|
486
|
-
let e = document.getElementById(`sampling-request-${n}`);
|
|
487
|
-
e && e.scrollIntoView({
|
|
488
|
-
behavior: "smooth",
|
|
489
|
-
block: "nearest"
|
|
490
|
-
});
|
|
491
|
-
}, 200));
|
|
492
|
-
};
|
|
493
|
-
return window.addEventListener("navigate-to-sampling", t), () => window.removeEventListener("navigate-to-sampling", t);
|
|
494
|
-
}, [e]), (0, L.useEffect)(() => {
|
|
495
|
-
h && e.length > 0 && A.current && !P.current && (A.current.scrollTop = 0);
|
|
496
|
-
}, [e.length, h]), (0, L.useEffect)(() => {
|
|
497
|
-
let e = A.current;
|
|
498
|
-
if (!e) return;
|
|
499
|
-
let t = () => {
|
|
500
|
-
e.scrollTop > 0 && (P.current = !0, v(!1));
|
|
501
|
-
};
|
|
502
|
-
return e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
|
|
503
|
-
}, []), (0, L.useEffect)(() => {
|
|
504
|
-
e.length === 0 && (P.current = !1, v(!0));
|
|
505
|
-
}, [e.length]), (0, L.useEffect)(() => {
|
|
506
|
-
y && M.current && M.current.focus();
|
|
507
|
-
}, [y]);
|
|
508
|
-
let I = (0, L.useCallback)(() => {
|
|
509
|
-
d.trim() || C(!1);
|
|
510
|
-
}, [d]), B = (0, L.useMemo)(() => {
|
|
511
|
-
if (!d.trim()) return e;
|
|
512
|
-
let t = d.toLowerCase();
|
|
513
|
-
return e.filter((e) => e.serverName.toLowerCase().includes(t) || JSON.stringify(e.request || {}).toLowerCase().includes(t));
|
|
514
|
-
}, [e, d]);
|
|
515
|
-
(0, L.useEffect)(() => {
|
|
516
|
-
m(-1);
|
|
517
|
-
}, [d]), (0, L.useEffect)(() => {
|
|
518
|
-
let e = (e) => {
|
|
519
|
-
let t = e.target;
|
|
520
|
-
if (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.contentEditable === "true" || e.metaKey || e.ctrlKey || e.altKey) return;
|
|
521
|
-
let n = B;
|
|
522
|
-
if (e.key === "ArrowDown") e.preventDefault(), m((e) => {
|
|
523
|
-
let t = e + 1;
|
|
524
|
-
return t >= n.length ? 0 : t;
|
|
525
|
-
});
|
|
526
|
-
else if (e.key === "ArrowUp") e.preventDefault(), m((e) => {
|
|
527
|
-
let t = e - 1;
|
|
528
|
-
return t < 0 ? n.length - 1 : t;
|
|
529
|
-
});
|
|
530
|
-
else if (e.key === "Enter" && p >= 0) {
|
|
531
|
-
e.preventDefault();
|
|
532
|
-
let t = B[p];
|
|
533
|
-
t && H(t);
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
537
|
-
}, [p, B]), (0, L.useEffect)(() => {
|
|
538
|
-
if (p >= 0) {
|
|
539
|
-
let e = `sampling-request-${B[p]?.id}`, t = document.getElementById(e);
|
|
540
|
-
t && t.scrollIntoView({
|
|
541
|
-
behavior: "smooth",
|
|
542
|
-
block: "nearest"
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
}, [p, B]);
|
|
546
|
-
let H = (0, L.useCallback)((e) => {
|
|
547
|
-
u(e);
|
|
548
|
-
}, []), U = (0, L.useCallback)(() => {
|
|
549
|
-
window.confirm("Are you sure you want to reject all sampling requests? This cannot be undone.") && (e.forEach((e) => {
|
|
550
|
-
n(e.id, "User rejected all requests");
|
|
551
|
-
}), u(null));
|
|
552
|
-
}, [e, n]), W = (0, L.useCallback)(async () => {
|
|
553
|
-
if (l) try {
|
|
554
|
-
await _(JSON.stringify({
|
|
555
|
-
id: l.id,
|
|
556
|
-
serverName: l.serverName,
|
|
557
|
-
timestamp: l.timestamp,
|
|
558
|
-
request: l.request
|
|
559
|
-
}, null, 2)), k(!0), setTimeout(() => k(!1), 2e3);
|
|
560
|
-
} catch (e) {
|
|
561
|
-
console.error("[SamplingTab] Failed to copy request:", e);
|
|
562
|
-
}
|
|
563
|
-
}, [l]), G = (0, L.useCallback)(() => {
|
|
564
|
-
if (l) try {
|
|
565
|
-
let e = new globalThis.Blob([JSON.stringify({
|
|
566
|
-
id: l.id,
|
|
567
|
-
serverName: l.serverName,
|
|
568
|
-
timestamp: l.timestamp,
|
|
569
|
-
request: l.request
|
|
570
|
-
}, null, 2)], { type: "application/json" }), t = URL.createObjectURL(e), n = document.createElement("a");
|
|
571
|
-
n.href = t, n.download = `sampling-request-${Date.now()}.json`, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(t);
|
|
572
|
-
} catch (e) {
|
|
573
|
-
console.error("[SamplingTab] Failed to download request:", e);
|
|
574
|
-
}
|
|
575
|
-
}, [l]), K = (0, L.useCallback)(async () => {
|
|
576
|
-
if (j.current) try {
|
|
577
|
-
document.fullscreenElement ? await document.exitFullscreen() : await j.current.requestFullscreen();
|
|
578
|
-
} catch (e) {
|
|
579
|
-
console.error("[SamplingTab] Failed to toggle fullscreen:", e);
|
|
580
|
-
}
|
|
581
|
-
}, []);
|
|
582
|
-
return i ? /* @__PURE__ */ (0, R.jsxs)(S, {
|
|
583
|
-
orientation: "horizontal",
|
|
584
|
-
className: "h-full",
|
|
585
|
-
children: [
|
|
586
|
-
/* @__PURE__ */ (0, R.jsx)(b, {
|
|
587
|
-
defaultSize: 40,
|
|
588
|
-
minSize: 30,
|
|
589
|
-
children: /* @__PURE__ */ (0, R.jsx)(S, {
|
|
590
|
-
orientation: "vertical",
|
|
591
|
-
className: "h-full border-r dark:border-zinc-700",
|
|
592
|
-
children: /* @__PURE__ */ (0, R.jsx)(b, {
|
|
593
|
-
defaultSize: 75,
|
|
594
|
-
minSize: 30,
|
|
595
|
-
className: "h-full overflow-hidden",
|
|
596
|
-
children: /* @__PURE__ */ (0, R.jsx)(x, {
|
|
597
|
-
scrollRef: A,
|
|
598
|
-
children: (t) => /* @__PURE__ */ (0, R.jsxs)(R.Fragment, { children: [/* @__PURE__ */ (0, R.jsx)(te, {
|
|
599
|
-
isScrolled: t,
|
|
600
|
-
title: "Sampling",
|
|
601
|
-
icon: w,
|
|
602
|
-
count: B.length,
|
|
603
|
-
isSearchExpanded: y,
|
|
604
|
-
searchQuery: d,
|
|
605
|
-
searchPlaceholder: "Search requests...",
|
|
606
|
-
onSearchExpand: () => C(!0),
|
|
607
|
-
onSearchChange: f,
|
|
608
|
-
onSearchBlur: I,
|
|
609
|
-
bulkAction: {
|
|
610
|
-
icon: O,
|
|
611
|
-
label: "Reject all",
|
|
612
|
-
onClick: U,
|
|
613
|
-
disabled: e.length === 0
|
|
614
|
-
},
|
|
615
|
-
searchInputRef: M
|
|
616
|
-
}), /* @__PURE__ */ (0, R.jsx)(z, {
|
|
617
|
-
requests: B,
|
|
618
|
-
selectedRequest: l,
|
|
619
|
-
onRequestSelect: H,
|
|
620
|
-
focusedIndex: p,
|
|
621
|
-
formatRelativeTime: g
|
|
622
|
-
})] })
|
|
623
|
-
})
|
|
624
|
-
})
|
|
625
|
-
})
|
|
626
|
-
}),
|
|
627
|
-
/* @__PURE__ */ (0, R.jsx)(ee, {}),
|
|
628
|
-
/* @__PURE__ */ (0, R.jsx)(b, {
|
|
629
|
-
defaultSize: 60,
|
|
630
|
-
minSize: 40,
|
|
631
|
-
children: /* @__PURE__ */ (0, R.jsx)("div", {
|
|
632
|
-
ref: j,
|
|
633
|
-
className: "h-full bg-white dark:bg-zinc-900",
|
|
634
|
-
children: /* @__PURE__ */ (0, R.jsx)(V, {
|
|
635
|
-
request: l,
|
|
636
|
-
onApprove: t,
|
|
637
|
-
onReject: n,
|
|
638
|
-
onClose: () => u(null),
|
|
639
|
-
previewMode: T,
|
|
640
|
-
onTogglePreview: () => E(!T),
|
|
641
|
-
isCopied: D,
|
|
642
|
-
onCopy: W,
|
|
643
|
-
onDownload: G,
|
|
644
|
-
onFullscreen: K,
|
|
645
|
-
llmConfig: c
|
|
646
|
-
})
|
|
647
|
-
})
|
|
648
|
-
})
|
|
649
|
-
]
|
|
650
|
-
}) : /* @__PURE__ */ (0, R.jsxs)("div", {
|
|
651
|
-
className: "flex flex-col items-center justify-center h-full p-4 text-center",
|
|
652
|
-
children: [/* @__PURE__ */ (0, R.jsx)(w, { className: "h-12 w-12 text-gray-400 dark:text-gray-600 mb-3" }), /* @__PURE__ */ (0, R.jsx)("p", {
|
|
653
|
-
className: "text-gray-500 dark:text-gray-400",
|
|
654
|
-
children: "Not connected to server"
|
|
655
|
-
})]
|
|
656
|
-
});
|
|
657
|
-
}
|
|
658
|
-
//#endregion
|
|
659
|
-
export { H as SamplingTab };
|