@julianpedro/plugin-dev-ai-hub 0.3.0 → 0.4.0

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 (49) hide show
  1. package/dist/api/DevAiHubClient.esm.js +5 -0
  2. package/dist/api/DevAiHubClient.esm.js.map +1 -1
  3. package/dist/components/AdminPage/AdminPage.esm.js +106 -0
  4. package/dist/components/AdminPage/AdminPage.esm.js.map +1 -0
  5. package/dist/components/AdminPage/index.esm.js +6 -0
  6. package/dist/components/AdminPage/index.esm.js.map +1 -0
  7. package/dist/components/AssetCard/AssetCard.esm.js +36 -17
  8. package/dist/components/AssetCard/AssetCard.esm.js.map +1 -1
  9. package/dist/components/AssetDetailPanel/AssetDetailPanel.esm.js +10 -13
  10. package/dist/components/AssetDetailPanel/AssetDetailPanel.esm.js.map +1 -1
  11. package/dist/components/AssetFilters/AssetFilters.esm.js +5 -3
  12. package/dist/components/AssetFilters/AssetFilters.esm.js.map +1 -1
  13. package/dist/components/AssetHelpDialog/AssetHelpDialog.esm.js +1 -1
  14. package/dist/components/AssetHelpDialog/AssetHelpDialog.esm.js.map +1 -1
  15. package/dist/components/AssetInstallDialog/AssetInstallDialog.esm.js +3 -3
  16. package/dist/components/AssetInstallDialog/AssetInstallDialog.esm.js.map +1 -1
  17. package/dist/components/AssetsTab/AssetsTab.esm.js +221 -0
  18. package/dist/components/AssetsTab/AssetsTab.esm.js.map +1 -0
  19. package/dist/components/AssetsTab/index.esm.js +6 -0
  20. package/dist/components/AssetsTab/index.esm.js.map +1 -0
  21. package/dist/components/DevAiHubPage/DevAiHubPage.esm.js +194 -111
  22. package/dist/components/DevAiHubPage/DevAiHubPage.esm.js.map +1 -1
  23. package/dist/components/McpConfigDialog/McpConfigDialog.esm.js +3 -581
  24. package/dist/components/McpConfigDialog/McpConfigDialog.esm.js.map +1 -1
  25. package/dist/components/McpPage/McpPage.esm.js +478 -0
  26. package/dist/components/McpPage/McpPage.esm.js.map +1 -0
  27. package/dist/components/McpPage/index.esm.js +6 -0
  28. package/dist/components/McpPage/index.esm.js.map +1 -0
  29. package/dist/components/ModelIcon/ModelBadge.esm.js +73 -0
  30. package/dist/components/ModelIcon/ModelBadge.esm.js.map +1 -0
  31. package/dist/components/ModelIcon/ModelIcon.esm.js +45 -0
  32. package/dist/components/ModelIcon/ModelIcon.esm.js.map +1 -0
  33. package/dist/components/ToolIcon/ToolIcon.esm.js +1 -1
  34. package/dist/components/ToolIcon/ToolIcon.esm.js.map +1 -1
  35. package/dist/context/UiConfigContext.esm.js +79 -0
  36. package/dist/context/UiConfigContext.esm.js.map +1 -0
  37. package/dist/hooks/index.esm.js +22 -1
  38. package/dist/hooks/index.esm.js.map +1 -1
  39. package/dist/index.d.ts +140 -20
  40. package/dist/index.esm.js +1 -1
  41. package/dist/locales/es.esm.js +18 -9
  42. package/dist/locales/es.esm.js.map +1 -1
  43. package/dist/locales/pt-BR.esm.js +18 -9
  44. package/dist/locales/pt-BR.esm.js.map +1 -1
  45. package/dist/plugin.esm.js +35 -6
  46. package/dist/plugin.esm.js.map +1 -1
  47. package/dist/translation.esm.js +27 -11
  48. package/dist/translation.esm.js.map +1 -1
  49. package/package.json +15 -5
@@ -1,283 +1,18 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useState, useMemo, useEffect } from 'react';
3
2
  import Box from '@mui/material/Box';
4
3
  import Button from '@mui/material/Button';
5
- import Chip from '@mui/material/Chip';
6
- import Collapse from '@mui/material/Collapse';
7
4
  import Dialog from '@mui/material/Dialog';
8
- import Grid from '@mui/material/Grid';
9
5
  import DialogActions from '@mui/material/DialogActions';
10
6
  import DialogContent from '@mui/material/DialogContent';
11
7
  import DialogTitle from '@mui/material/DialogTitle';
12
- import Divider from '@mui/material/Divider';
13
- import FormControlLabel from '@mui/material/FormControlLabel';
14
- import IconButton from '@mui/material/IconButton';
15
- import Switch from '@mui/material/Switch';
16
- import Tab from '@mui/material/Tab';
17
- import Tabs from '@mui/material/Tabs';
18
- import Tooltip from '@mui/material/Tooltip';
19
8
  import Typography from '@mui/material/Typography';
20
- import { useTheme } from '@mui/material/styles';
21
- import ContentCopyIcon from '@mui/icons-material/ContentCopy';
22
- import CheckIcon from '@mui/icons-material/Check';
23
- import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
24
- import StorageIcon from '@mui/icons-material/Storage';
25
- import OpenInBrowserIcon from '@mui/icons-material/OpenInBrowser';
26
9
  import AppsIcon from '@mui/icons-material/Apps';
27
- import TuneIcon from '@mui/icons-material/Tune';
28
- import { useApi, discoveryApiRef } from '@backstage/core-plugin-api';
29
- import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
30
- import { ToolIcon } from '../ToolIcon/ToolIcon.esm.js';
31
- import { useCopyToClipboard, useProviders, useMcpCatalog } from '../../hooks/index.esm.js';
10
+ import { useTranslationRef } from '@backstage/frontend-plugin-api';
32
11
  import { devAiHubTranslationRef } from '../../translation.esm.js';
12
+ import { McpPage } from '../McpPage/McpPage.esm.js';
33
13
 
34
- const TYPE_ACCENT = {
35
- http: "#2563EB",
36
- stdio: "#059669"
37
- };
38
- function providerLabel(target) {
39
- return target.split("/").pop()?.replace(/\.git$/, "") ?? target;
40
- }
41
- function CatalogEntryCard({ entry }) {
42
- const { t } = useTranslationRef(devAiHubTranslationRef);
43
- const accent = TYPE_ACCENT[entry.type] ?? "#64748b";
44
- const handleInstallVscode = () => {
45
- const config = { name: entry.id, type: entry.type };
46
- if (entry.type === "http") config.url = entry.url;
47
- if (entry.type === "stdio") {
48
- config.command = entry.command;
49
- if (entry.args?.length) config.args = entry.args;
50
- if (entry.env && Object.keys(entry.env).length) config.env = entry.env;
51
- }
52
- window.location.href = `vscode:mcp/install?${encodeURIComponent(JSON.stringify(config))}`;
53
- };
54
- const handleInstallCursor = () => {
55
- const config = { type: entry.type };
56
- if (entry.type === "http") config.url = entry.url;
57
- if (entry.type === "stdio") {
58
- config.command = entry.command;
59
- if (entry.args?.length) config.args = entry.args;
60
- if (entry.env && Object.keys(entry.env).length) config.env = entry.env;
61
- }
62
- window.location.href = `cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(entry.name)}&config=${btoa(JSON.stringify(config))}`;
63
- };
64
- const canInstall = entry.type === "http" && !!entry.url || entry.type === "stdio" && !!entry.command;
65
- return /* @__PURE__ */ jsxs(
66
- Box,
67
- {
68
- sx: {
69
- border: "1px solid",
70
- borderColor: "divider",
71
- borderLeft: `3px solid ${accent}`,
72
- borderRadius: 2,
73
- p: 2,
74
- display: "flex",
75
- flexDirection: "column",
76
- gap: 1.25,
77
- height: "100%",
78
- minHeight: 148,
79
- transition: "all 0.15s ease",
80
- "&:hover": {
81
- boxShadow: `0 4px 16px ${accent}25`,
82
- borderColor: `${accent}60`
83
- }
84
- },
85
- children: [
86
- /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "flex-start", gap: 1.25 }, children: [
87
- /* @__PURE__ */ jsx(
88
- Box,
89
- {
90
- sx: {
91
- width: 48,
92
- height: 48,
93
- borderRadius: 2,
94
- backgroundColor: `${accent}18`,
95
- display: "flex",
96
- alignItems: "center",
97
- justifyContent: "center",
98
- flexShrink: 0,
99
- boxShadow: `0 2px 8px ${accent}20`
100
- },
101
- children: entry.icon ? /* @__PURE__ */ jsx(
102
- Box,
103
- {
104
- component: "img",
105
- src: entry.icon,
106
- alt: entry.name,
107
- sx: { width: 32, height: 32, objectFit: "contain" },
108
- onError: (e) => {
109
- e.target.style.display = "none";
110
- }
111
- }
112
- ) : /* @__PURE__ */ jsx(StorageIcon, { sx: { fontSize: "1.4rem", color: accent } })
113
- }
114
- ),
115
- /* @__PURE__ */ jsxs(Box, { sx: { flex: 1, minWidth: 0 }, children: [
116
- /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 0.75, mb: 0.25, flexWrap: "wrap" }, children: [
117
- /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", fontWeight: 700, noWrap: true, title: entry.name, sx: { flex: 1 }, children: entry.name }),
118
- /* @__PURE__ */ jsx(
119
- Chip,
120
- {
121
- label: entry.type,
122
- size: "small",
123
- sx: {
124
- height: 18,
125
- fontSize: "0.6rem",
126
- fontFamily: "monospace",
127
- fontWeight: 700,
128
- bgcolor: `${accent}18`,
129
- color: accent,
130
- border: "1px solid",
131
- borderColor: `${accent}40`
132
- }
133
- }
134
- )
135
- ] }),
136
- entry.description && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", title: entry.description, sx: { display: "block", lineHeight: 1.4 }, children: entry.description }),
137
- entry.type === "http" && entry.url && /* @__PURE__ */ jsx(
138
- Typography,
139
- {
140
- variant: "caption",
141
- sx: { display: "block", fontFamily: "monospace", fontSize: "0.68rem", color: "text.disabled", mt: 0.25, wordBreak: "break-all" },
142
- children: entry.url
143
- }
144
- ),
145
- entry.type === "stdio" && entry.command && /* @__PURE__ */ jsx(
146
- Typography,
147
- {
148
- variant: "caption",
149
- sx: { display: "block", fontFamily: "monospace", fontSize: "0.68rem", color: "text.disabled", mt: 0.25 },
150
- children: [entry.command, ...entry.args ?? []].join(" ")
151
- }
152
- )
153
- ] })
154
- ] }),
155
- canInstall && /* @__PURE__ */ jsx(Divider, { sx: { mt: "auto" } }),
156
- canInstall && /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", gap: 0.75 }, children: [
157
- /* @__PURE__ */ jsx(
158
- Button,
159
- {
160
- size: "small",
161
- variant: "outlined",
162
- startIcon: /* @__PURE__ */ jsx(OpenInBrowserIcon, { sx: { fontSize: "0.85rem !important" } }),
163
- onClick: handleInstallVscode,
164
- fullWidth: true,
165
- sx: {
166
- fontSize: "0.75rem",
167
- fontWeight: 700,
168
- py: 0.5,
169
- borderColor: `${accent}50`,
170
- color: accent,
171
- "&:hover": { borderColor: accent, bgcolor: `${accent}0a` }
172
- },
173
- children: t("mcpConfigDialog.installInVscode")
174
- }
175
- ),
176
- /* @__PURE__ */ jsx(
177
- Button,
178
- {
179
- size: "small",
180
- variant: "outlined",
181
- startIcon: /* @__PURE__ */ jsx(ToolIcon, { tool: "cursor", branded: false, sx: { fontSize: "0.85rem !important", color: `${accent} !important` } }),
182
- onClick: handleInstallCursor,
183
- fullWidth: true,
184
- sx: {
185
- fontSize: "0.75rem",
186
- fontWeight: 700,
187
- py: 0.5,
188
- borderColor: `${accent}50`,
189
- color: accent,
190
- "&:hover": { borderColor: accent, bgcolor: `${accent}0a` }
191
- },
192
- children: t("mcpConfigDialog.installInCursor")
193
- }
194
- )
195
- ] })
196
- ]
197
- }
198
- );
199
- }
200
14
  function McpConfigDialog({ open, onClose }) {
201
- const theme = useTheme();
202
15
  const { t } = useTranslationRef(devAiHubTranslationRef);
203
- const discoveryApi = useApi(discoveryApiRef);
204
- const { copy: copyUrl, copied: copiedUrl } = useCopyToClipboard();
205
- const { copy: copySnippet, copied: copiedSnippet } = useCopyToClipboard();
206
- const [tab, setTab] = useState(0);
207
- const [baseUrl, setBaseUrl] = useState("");
208
- const [selectedProvider, setSelectedProvider] = useState("");
209
- const [proactiveEnabled, setProactiveEnabled] = useState(false);
210
- const [toolConfigExpanded, setToolConfigExpanded] = useState(false);
211
- const [manualExpanded, setManualExpanded] = useState(false);
212
- const { providers } = useProviders();
213
- const { catalog } = useMcpCatalog();
214
- const showProviderFilter = providers.length > 1;
215
- const toolConfigs = useMemo(() => [
216
- {
217
- tool: "claude-code",
218
- label: "Claude Code",
219
- file: ".mcp.json",
220
- description: t("mcpConfigDialog.claudeConfigDesc"),
221
- buildConfig: (url) => JSON.stringify({
222
- mcpServers: { "dev-ai-hub": { type: "http", url } }
223
- }, null, 2)
224
- },
225
- {
226
- tool: "github-copilot",
227
- label: "GitHub Copilot",
228
- file: ".vscode/settings.json",
229
- description: t("mcpConfigDialog.copilotConfigDesc"),
230
- buildConfig: (url) => JSON.stringify({
231
- "github.copilot.chat.mcp.servers": { "dev-ai-hub": { type: "http", url } }
232
- }, null, 2)
233
- },
234
- {
235
- tool: "google-gemini",
236
- label: "Google Gemini",
237
- file: "gemini-config.json",
238
- description: t("mcpConfigDialog.geminiConfigDesc"),
239
- buildConfig: (url) => JSON.stringify({
240
- mcpServers: { "dev-ai-hub": { url } }
241
- }, null, 2)
242
- },
243
- {
244
- tool: "cursor",
245
- label: "Cursor",
246
- file: ".cursor/mcp.json",
247
- description: t("mcpConfigDialog.cursorConfigDesc"),
248
- buildConfig: (url) => JSON.stringify({
249
- mcpServers: { "dev-ai-hub": { type: "http", url } }
250
- }, null, 2)
251
- }
252
- ], [t]);
253
- useEffect(() => {
254
- if (open) {
255
- discoveryApi.getBaseUrl("dev-ai-hub").then((url) => setBaseUrl(url));
256
- }
257
- }, [open, discoveryApi]);
258
- const cfg = toolConfigs[tab] ?? toolConfigs[0];
259
- const buildMcpUrl = () => {
260
- if (!baseUrl) return "loading...";
261
- const params = new URLSearchParams();
262
- params.set("tool", cfg.tool);
263
- if (selectedProvider) params.set("provider", selectedProvider);
264
- if (proactiveEnabled) params.set("proactive", "true");
265
- return `${baseUrl}/mcp?${params.toString()}`;
266
- };
267
- const mcpUrl = buildMcpUrl();
268
- const configSnippet = baseUrl ? cfg.buildConfig(mcpUrl) : "";
269
- const handleInstallInVscode = () => {
270
- if (!baseUrl) return;
271
- const config = JSON.stringify({ name: "dev-ai-hub", type: "http", url: mcpUrl });
272
- window.location.href = `vscode:mcp/install?${encodeURIComponent(config)}`;
273
- };
274
- const handleInstallInCursor = () => {
275
- if (!baseUrl) return;
276
- const config = btoa(JSON.stringify({ type: "http", url: mcpUrl }));
277
- window.location.href = `cursor://anysphere.cursor-deeplink/mcp/install?name=dev-ai-hub&config=${config}`;
278
- };
279
- const showVscodeButton = cfg.tool === "github-copilot";
280
- const showCursorButton = cfg.tool === "cursor";
281
16
  return /* @__PURE__ */ jsxs(Dialog, { open, onClose, maxWidth: "md", fullWidth: true, children: [
282
17
  /* @__PURE__ */ jsx(DialogTitle, { sx: { pb: 1 }, children: /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
283
18
  /* @__PURE__ */ jsx(
@@ -302,320 +37,7 @@ function McpConfigDialog({ open, onClose }) {
302
37
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: t("mcpConfigDialog.subtitle") })
303
38
  ] })
304
39
  ] }) }),
305
- /* @__PURE__ */ jsxs(DialogContent, { sx: { pt: 0 }, children: [
306
- /* @__PURE__ */ jsxs(Box, { sx: { mb: 2 }, children: [
307
- /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 0.75, mb: 1, pt: 0.5 }, children: [
308
- /* @__PURE__ */ jsx(AppsIcon, { sx: { fontSize: "0.95rem", color: "text.secondary" } }),
309
- /* @__PURE__ */ jsx(
310
- Typography,
311
- {
312
- variant: "caption",
313
- fontWeight: 700,
314
- color: "text.secondary",
315
- sx: { textTransform: "uppercase", letterSpacing: 0.8, flex: 1 },
316
- children: t("mcpConfigDialog.catalogTab")
317
- }
318
- ),
319
- catalog.length > 0 && /* @__PURE__ */ jsx(
320
- Chip,
321
- {
322
- label: catalog.length,
323
- size: "small",
324
- sx: { height: 18, fontSize: "0.65rem", fontWeight: 700, bgcolor: "action.selected", color: "text.secondary", border: "1px solid", borderColor: "divider" }
325
- }
326
- )
327
- ] }),
328
- /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", sx: { mb: 1.5, fontSize: "0.8rem" }, children: t("mcpConfigDialog.catalogDescription") }),
329
- catalog.length === 0 ? /* @__PURE__ */ jsxs(
330
- Box,
331
- {
332
- sx: {
333
- border: "1px dashed",
334
- borderColor: "divider",
335
- borderRadius: 2,
336
- p: 3,
337
- textAlign: "center"
338
- },
339
- children: [
340
- /* @__PURE__ */ jsx(AppsIcon, { sx: { fontSize: "2rem", color: "text.disabled", mb: 1 } }),
341
- /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", children: t("mcpConfigDialog.catalogEmpty") }),
342
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.disabled", children: t("mcpConfigDialog.catalogAddHint") })
343
- ]
344
- }
345
- ) : /* @__PURE__ */ jsx(Grid, { container: true, spacing: 1.5, children: catalog.map((entry) => /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, sm: 6, children: /* @__PURE__ */ jsx(CatalogEntryCard, { entry }) }, entry.id)) })
346
- ] }),
347
- /* @__PURE__ */ jsx(Divider, { sx: { mb: 0 } }),
348
- /* @__PURE__ */ jsxs(Box, { children: [
349
- /* @__PURE__ */ jsxs(
350
- Box,
351
- {
352
- onClick: () => setToolConfigExpanded((v) => !v),
353
- sx: {
354
- display: "flex",
355
- alignItems: "center",
356
- gap: 0.75,
357
- cursor: "pointer",
358
- userSelect: "none",
359
- py: 1.25,
360
- "&:hover": { opacity: 0.8 }
361
- },
362
- children: [
363
- /* @__PURE__ */ jsx(TuneIcon, { sx: { fontSize: "0.95rem", color: "text.secondary" } }),
364
- /* @__PURE__ */ jsx(
365
- Typography,
366
- {
367
- variant: "caption",
368
- fontWeight: 700,
369
- color: "text.secondary",
370
- sx: { textTransform: "uppercase", letterSpacing: 0.8, flex: 1 },
371
- children: t("mcpConfigDialog.toolConfigSection")
372
- }
373
- ),
374
- /* @__PURE__ */ jsx(
375
- ExpandMoreIcon,
376
- {
377
- fontSize: "small",
378
- sx: {
379
- color: "text.disabled",
380
- transition: "transform 0.2s ease",
381
- transform: toolConfigExpanded ? "rotate(180deg)" : "rotate(0deg)"
382
- }
383
- }
384
- )
385
- ]
386
- }
387
- ),
388
- /* @__PURE__ */ jsxs(Collapse, { in: toolConfigExpanded, children: [
389
- /* @__PURE__ */ jsx(
390
- Tabs,
391
- {
392
- value: tab,
393
- onChange: (_, v) => setTab(v),
394
- sx: { mb: 2, borderBottom: 1, borderColor: "divider" },
395
- children: toolConfigs.map((toolCfg, i) => /* @__PURE__ */ jsx(
396
- Tab,
397
- {
398
- value: i,
399
- sx: {
400
- color: "text.secondary",
401
- minHeight: 40,
402
- "&.Mui-selected": { color: "primary.main" },
403
- "&:hover": {
404
- backgroundColor: "transparent",
405
- color: "text.primary"
406
- },
407
- "&.Mui-selected:hover": {
408
- backgroundColor: "transparent"
409
- }
410
- },
411
- label: /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 0.75 }, children: [
412
- /* @__PURE__ */ jsx(ToolIcon, { tool: toolCfg.tool, branded: false, sx: { fontSize: "1rem" } }),
413
- /* @__PURE__ */ jsx("span", { children: toolCfg.label })
414
- ] })
415
- },
416
- toolCfg.tool
417
- ))
418
- }
419
- ),
420
- showProviderFilter && /* @__PURE__ */ jsxs(Box, { sx: { mb: 2 }, children: [
421
- /* @__PURE__ */ jsx(Typography, { variant: "caption", fontWeight: 600, color: "text.secondary", sx: { textTransform: "uppercase", letterSpacing: 0.5, display: "block", mb: 0.75 }, children: t("mcpConfigDialog.scopeToProvider") }),
422
- /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", gap: 0.75, flexWrap: "wrap" }, children: [
423
- /* @__PURE__ */ jsx(
424
- Chip,
425
- {
426
- label: t("mcpConfigDialog.allProviders"),
427
- size: "small",
428
- clickable: true,
429
- onClick: () => setSelectedProvider(""),
430
- sx: {
431
- fontWeight: 600,
432
- fontSize: "0.75rem",
433
- borderRadius: 2,
434
- border: "1.5px solid",
435
- borderColor: !selectedProvider ? "text.primary" : "divider",
436
- backgroundColor: !selectedProvider ? "text.primary" : "transparent",
437
- color: !selectedProvider ? "background.paper" : "text.secondary",
438
- transition: "all 0.15s ease"
439
- }
440
- }
441
- ),
442
- providers.map((p) => {
443
- const isSelected = selectedProvider === p.id;
444
- const label = providerLabel(p.target);
445
- return /* @__PURE__ */ jsx(
446
- Chip,
447
- {
448
- icon: /* @__PURE__ */ jsx(StorageIcon, { sx: { fontSize: "0.8rem !important", color: isSelected ? "background.paper" : "inherit" } }),
449
- label,
450
- size: "small",
451
- clickable: true,
452
- onClick: () => setSelectedProvider(isSelected ? "" : p.id),
453
- sx: {
454
- fontWeight: 600,
455
- fontSize: "0.75rem",
456
- borderRadius: 2,
457
- border: "1.5px solid",
458
- borderColor: isSelected ? "text.primary" : "divider",
459
- backgroundColor: isSelected ? "text.primary" : "transparent",
460
- color: isSelected ? "background.paper" : "text.secondary",
461
- transition: "all 0.15s ease"
462
- }
463
- },
464
- p.id
465
- );
466
- })
467
- ] })
468
- ] }),
469
- /* @__PURE__ */ jsx(Box, { sx: { mb: 2 }, children: /* @__PURE__ */ jsx(
470
- FormControlLabel,
471
- {
472
- control: /* @__PURE__ */ jsx(
473
- Switch,
474
- {
475
- size: "small",
476
- checked: proactiveEnabled,
477
- onChange: (e) => setProactiveEnabled(e.target.checked)
478
- }
479
- ),
480
- label: /* @__PURE__ */ jsxs(Box, { children: [
481
- /* @__PURE__ */ jsx(Typography, { variant: "body2", fontWeight: 600, children: t("mcpConfigDialog.proactiveSuggestions") }),
482
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: t("mcpConfigDialog.proactiveDescription") })
483
- ] }),
484
- sx: { alignItems: "flex-start", ml: 0, gap: 1 }
485
- }
486
- ) }),
487
- /* @__PURE__ */ jsx(Typography, { variant: "caption", fontWeight: 600, color: "text.secondary", sx: { textTransform: "uppercase", letterSpacing: 0.5 }, children: t("mcpConfigDialog.mcpEndpoint") }),
488
- /* @__PURE__ */ jsxs(
489
- Box,
490
- {
491
- sx: {
492
- display: "flex",
493
- alignItems: "center",
494
- gap: 1,
495
- mt: 0.5,
496
- mb: showVscodeButton || showCursorButton ? 1.5 : 1.5,
497
- px: 1.5,
498
- py: 1,
499
- borderRadius: 1.5,
500
- border: "1px solid",
501
- borderColor: "divider",
502
- backgroundColor: theme.palette.mode === "dark" ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.03)"
503
- },
504
- children: [
505
- /* @__PURE__ */ jsx(
506
- Typography,
507
- {
508
- variant: "body2",
509
- sx: { flex: 1, fontFamily: "monospace", fontSize: "0.8rem", wordBreak: "break-all" },
510
- children: mcpUrl
511
- }
512
- ),
513
- /* @__PURE__ */ jsx(Tooltip, { title: copiedUrl ? t("assetInstallDialog.copied") : t("mcpConfigDialog.copyUrl"), children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => copyUrl(mcpUrl), children: copiedUrl ? /* @__PURE__ */ jsx(CheckIcon, { fontSize: "small", color: "success" }) : /* @__PURE__ */ jsx(ContentCopyIcon, { fontSize: "small" }) }) })
514
- ]
515
- }
516
- ),
517
- showVscodeButton && /* @__PURE__ */ jsx(
518
- Button,
519
- {
520
- variant: "contained",
521
- startIcon: /* @__PURE__ */ jsx(OpenInBrowserIcon, {}),
522
- onClick: handleInstallInVscode,
523
- disabled: !baseUrl,
524
- fullWidth: true,
525
- sx: { mb: 2, fontSize: "0.8rem" },
526
- children: t("mcpConfigDialog.installInVscode")
527
- }
528
- ),
529
- showCursorButton && /* @__PURE__ */ jsx(
530
- Button,
531
- {
532
- variant: "contained",
533
- startIcon: /* @__PURE__ */ jsx(ToolIcon, { tool: "cursor", branded: false, sx: { fontSize: "1rem !important" } }),
534
- onClick: handleInstallInCursor,
535
- disabled: !baseUrl,
536
- fullWidth: true,
537
- sx: { mb: 2, fontSize: "0.8rem" },
538
- children: t("mcpConfigDialog.installInCursor")
539
- }
540
- ),
541
- /* @__PURE__ */ jsx(Divider, { sx: { mb: 1.5 } }),
542
- /* @__PURE__ */ jsxs(
543
- Box,
544
- {
545
- onClick: () => setManualExpanded((v) => !v),
546
- sx: {
547
- display: "flex",
548
- alignItems: "center",
549
- justifyContent: "space-between",
550
- cursor: "pointer",
551
- userSelect: "none",
552
- py: 0.75
553
- },
554
- children: [
555
- /* @__PURE__ */ jsx(Typography, { variant: "caption", fontWeight: 600, color: "text.secondary", sx: { textTransform: "uppercase", letterSpacing: 0.5 }, children: t("mcpConfigDialog.manualConfig", { file: cfg.file }) }),
556
- /* @__PURE__ */ jsx(
557
- ExpandMoreIcon,
558
- {
559
- fontSize: "small",
560
- sx: {
561
- color: "text.disabled",
562
- transition: "transform 0.2s ease",
563
- transform: manualExpanded ? "rotate(180deg)" : "rotate(0deg)"
564
- }
565
- }
566
- )
567
- ]
568
- }
569
- ),
570
- /* @__PURE__ */ jsxs(Collapse, { in: manualExpanded, children: [
571
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", sx: { display: "block", mb: 1, mt: 0.5 }, children: cfg.description }),
572
- /* @__PURE__ */ jsxs(Box, { sx: { position: "relative" }, children: [
573
- /* @__PURE__ */ jsx(
574
- Box,
575
- {
576
- component: "pre",
577
- sx: {
578
- m: 0,
579
- p: 2,
580
- borderRadius: 2,
581
- border: "1px solid",
582
- borderColor: "divider",
583
- backgroundColor: theme.palette.mode === "dark" ? "#0d1117" : "#f6f8fa",
584
- color: theme.palette.mode === "dark" ? "#e6edf3" : "#24292f",
585
- fontFamily: "monospace",
586
- fontSize: "0.8rem",
587
- overflowX: "auto",
588
- whiteSpace: "pre"
589
- },
590
- children: configSnippet
591
- }
592
- ),
593
- /* @__PURE__ */ jsx(Tooltip, { title: copiedSnippet ? t("assetInstallDialog.copied") : t("mcpConfigDialog.copyUrl"), children: /* @__PURE__ */ jsx(
594
- IconButton,
595
- {
596
- size: "small",
597
- onClick: (e) => {
598
- e.stopPropagation();
599
- copySnippet(configSnippet);
600
- },
601
- sx: {
602
- position: "absolute",
603
- top: 8,
604
- right: 8,
605
- backgroundColor: theme.palette.mode === "dark" ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.06)",
606
- "&:hover": {
607
- backgroundColor: theme.palette.mode === "dark" ? "rgba(255,255,255,0.2)" : "rgba(0,0,0,0.12)"
608
- }
609
- },
610
- children: copiedSnippet ? /* @__PURE__ */ jsx(CheckIcon, { fontSize: "small", color: "success" }) : /* @__PURE__ */ jsx(ContentCopyIcon, { fontSize: "small" })
611
- }
612
- ) })
613
- ] }),
614
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.disabled", sx: { display: "block", mt: 1.5 }, children: t("mcpConfigDialog.omitToolHint") })
615
- ] })
616
- ] })
617
- ] })
618
- ] }),
40
+ /* @__PURE__ */ jsx(DialogContent, { sx: { pt: 0 }, children: open && /* @__PURE__ */ jsx(McpPage, { embedded: true }) }),
619
41
  /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, { onClick: onClose, children: t("mcpConfigDialog.close") }) })
620
42
  ] });
621
43
  }