apteva 0.4.41 → 0.4.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActivityPage.sw9p594m.js +3 -0
- package/dist/ApiDocsPage.90e03bz7.js +4 -0
- package/dist/App.0ws87fpx.js +53 -0
- package/dist/App.3vnrera5.js +4 -0
- package/dist/App.94x6mh7f.js +20 -0
- package/dist/{App.7fb3e7mp.js → App.9sryp183.js} +1 -1
- package/dist/App.d9tny4t0.js +221 -0
- package/dist/App.jhb45d7r.js +8 -0
- package/dist/App.p7jjw1zf.js +4 -0
- package/dist/App.pfbdzrhh.js +4 -0
- package/dist/App.stgng5bx.js +13 -0
- package/dist/App.tm3k7h4b.js +4 -0
- package/dist/App.vkg121c6.js +4 -0
- package/dist/App.wghtdzsk.js +1 -0
- package/dist/App.xf7wsckg.js +4 -0
- package/dist/App.xva0tfzh.js +4 -0
- package/dist/App.ysxy7akk.js +61 -0
- package/dist/App.yzkh4gq2.js +4 -0
- package/dist/ConnectionsPage.q5f9fd37.js +3 -0
- package/dist/McpPage.f3ccrezb.js +3 -0
- package/dist/SettingsPage.3sqx6wm4.js +3 -0
- package/dist/SkillsPage.whxnez67.js +3 -0
- package/dist/TasksPage.zp4jfevw.js +3 -0
- package/dist/TelemetryPage.a9fmxq87.js +3 -0
- package/dist/TestsPage.18krj0d1.js +3 -0
- package/dist/ThreadsPage.nnphgy98.js +3 -0
- package/dist/apteva-kit.css +1 -1
- package/dist/index.html +1 -1
- package/dist/styles.css +1 -1
- package/package.json +11 -10
- package/src/db.ts +61 -13
- package/src/integrations/agentdojo.ts +1 -0
- package/src/mcp-platform.ts +418 -63
- package/src/openapi.ts +96 -0
- package/src/providers.ts +55 -24
- package/src/routes/api/agent-utils.ts +25 -4
- package/src/routes/api/agents.ts +19 -1
- package/src/routes/api/meta-agent.ts +2 -0
- package/src/routes/api/system.ts +90 -1
- package/src/routes/api/telemetry.ts +38 -2
- package/src/routes/share.ts +85 -0
- package/src/server.ts +64 -1
- package/src/web/App.tsx +89 -11
- package/src/web/components/activity/ActivityPage.tsx +14 -14
- package/src/web/components/agents/AgentCard.tsx +19 -17
- package/src/web/components/agents/AgentPanel.tsx +541 -220
- package/src/web/components/agents/AgentsView.tsx +4 -4
- package/src/web/components/agents/CreateAgentModal.tsx +24 -82
- package/src/web/components/api/ApiDocsPage.tsx +66 -66
- package/src/web/components/auth/CreateAccountStep.tsx +16 -16
- package/src/web/components/auth/LoginPage.tsx +10 -10
- package/src/web/components/common/LoadingSpinner.tsx +2 -2
- package/src/web/components/common/Modal.tsx +9 -9
- package/src/web/components/common/Select.tsx +9 -9
- package/src/web/components/connections/ConnectionsPage.tsx +4 -4
- package/src/web/components/connections/IntegrationsTab.tsx +18 -18
- package/src/web/components/connections/OverviewTab.tsx +13 -13
- package/src/web/components/connections/TriggersTab.tsx +99 -99
- package/src/web/components/dashboard/Dashboard.tsx +32 -32
- package/src/web/components/layout/Header.tsx +50 -34
- package/src/web/components/layout/Sidebar.tsx +35 -15
- package/src/web/components/mcp/IntegrationsPanel.tsx +40 -40
- package/src/web/components/mcp/McpPage.tsx +208 -208
- package/src/web/components/meta-agent/MetaAgent.tsx +12 -10
- package/src/web/components/onboarding/OnboardingWizard.tsx +25 -25
- package/src/web/components/settings/SettingsPage.tsx +291 -175
- package/src/web/components/skills/SkillsPage.tsx +88 -88
- package/src/web/components/tasks/TasksPage.tsx +539 -78
- package/src/web/components/telemetry/TelemetryPage.tsx +405 -65
- package/src/web/components/tests/TestsPage.tsx +50 -50
- package/src/web/components/threads/ThreadsPage.tsx +23 -21
- package/src/web/context/ProjectContext.tsx +6 -1
- package/src/web/context/ThemeContext.tsx +90 -0
- package/src/web/context/index.ts +2 -0
- package/src/web/index.html +1 -6
- package/src/web/styles.css +52 -3
- package/src/web/themes.ts +162 -0
- package/src/web/types.ts +0 -4
- package/dist/ActivityPage.7907h64p.js +0 -3
- package/dist/ApiDocsPage.k3jjenpq.js +0 -4
- package/dist/App.01nq20st.js +0 -4
- package/dist/App.1maqvamf.js +0 -4
- package/dist/App.2yjrh32f.js +0 -4
- package/dist/App.3qw8nben.js +0 -20
- package/dist/App.7sy3wq8c.js +0 -4
- package/dist/App.apjrmctz.js +0 -57
- package/dist/App.av6t2yhe.js +0 -4
- package/dist/App.jqj5a094.js +0 -46
- package/dist/App.mc7xf85h.js +0 -4
- package/dist/App.myxqcj9x.js +0 -4
- package/dist/App.nm91r1mp.js +0 -13
- package/dist/App.p02f4ret.js +0 -1
- package/dist/App.qcknavjz.js +0 -221
- package/dist/App.vc7vfhg4.js +0 -4
- package/dist/App.z4s9zkw5.js +0 -4
- package/dist/ConnectionsPage.z1pw5xe2.js +0 -3
- package/dist/McpPage.8vc97z0b.js +0 -3
- package/dist/SettingsPage.p61bz8kd.js +0 -3
- package/dist/SkillsPage.r9x43g3g.js +0 -3
- package/dist/TasksPage.1e0zkye4.js +0 -3
- package/dist/TelemetryPage.p9vbe4gf.js +0 -3
- package/dist/TestsPage.d4xy504e.js +0 -3
- package/dist/ThreadsPage.m016am3x.js +0 -3
package/src/web/styles.css
CHANGED
|
@@ -2,8 +2,56 @@
|
|
|
2
2
|
@tailwind components;
|
|
3
3
|
@tailwind utilities;
|
|
4
4
|
|
|
5
|
+
/* ── Style variables (classic vs professional) ── */
|
|
6
|
+
:root, [data-style="classic"] {
|
|
7
|
+
--font-family: 'JetBrains Mono', monospace;
|
|
8
|
+
--radius-card: 8px;
|
|
9
|
+
--radius-button: 6px;
|
|
10
|
+
--radius-badge: 4px;
|
|
11
|
+
--shadow-card: none;
|
|
12
|
+
--shadow-card-hover: none;
|
|
13
|
+
--border-card: 1px solid var(--color-border);
|
|
14
|
+
--spacing-card: 1rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[data-style="professional"] {
|
|
18
|
+
--font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
|
19
|
+
--radius-card: 14px;
|
|
20
|
+
--radius-button: 10px;
|
|
21
|
+
--radius-badge: 8px;
|
|
22
|
+
--shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
|
|
23
|
+
--shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
|
|
24
|
+
--border-card: 1px solid var(--color-border);
|
|
25
|
+
--spacing-card: 1.25rem;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Dark professional gets stronger shadows */
|
|
29
|
+
[data-style="professional"][data-theme="professional-dark"] {
|
|
30
|
+
--shadow-card: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.12);
|
|
31
|
+
--shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.15);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* ── Utility class for cards ── */
|
|
35
|
+
.card {
|
|
36
|
+
border-radius: var(--radius-card);
|
|
37
|
+
border: var(--border-card);
|
|
38
|
+
box-shadow: var(--shadow-card);
|
|
39
|
+
transition: box-shadow 0.2s ease;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.card:hover {
|
|
43
|
+
box-shadow: var(--shadow-card-hover);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* ── Utility for buttons ── */
|
|
47
|
+
.btn {
|
|
48
|
+
border-radius: var(--radius-button);
|
|
49
|
+
}
|
|
50
|
+
|
|
5
51
|
html, body {
|
|
6
|
-
background-color: #0a0a0a;
|
|
52
|
+
background-color: var(--color-bg, #0a0a0a);
|
|
53
|
+
color: var(--color-text, #e0e0e0);
|
|
54
|
+
font-family: var(--font-family, 'JetBrains Mono', monospace);
|
|
7
55
|
min-height: 100%;
|
|
8
56
|
margin: 0;
|
|
9
57
|
-webkit-font-smoothing: antialiased;
|
|
@@ -20,8 +68,8 @@ html, body {
|
|
|
20
68
|
}
|
|
21
69
|
|
|
22
70
|
::selection {
|
|
23
|
-
background-color: #f97316;
|
|
24
|
-
color: #0a0a0a;
|
|
71
|
+
background-color: var(--color-selection-bg, #f97316);
|
|
72
|
+
color: var(--color-selection-text, #0a0a0a);
|
|
25
73
|
}
|
|
26
74
|
|
|
27
75
|
.line-clamp-2 {
|
|
@@ -67,3 +115,4 @@ html, body {
|
|
|
67
115
|
animation: slideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1), highlightFade 2s 0.5s ease-out;
|
|
68
116
|
overflow: hidden;
|
|
69
117
|
}
|
|
118
|
+
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/** Theme system — extensible for future custom themes */
|
|
2
|
+
|
|
3
|
+
export type ThemeMode = "auto" | "dark" | "light";
|
|
4
|
+
export type ThemeStyle = "classic" | "professional";
|
|
5
|
+
|
|
6
|
+
export interface ThemeColors {
|
|
7
|
+
"--color-bg": string;
|
|
8
|
+
"--color-bg-secondary": string;
|
|
9
|
+
"--color-surface": string;
|
|
10
|
+
"--color-surface-hover": string;
|
|
11
|
+
"--color-surface-raised": string;
|
|
12
|
+
"--color-border": string;
|
|
13
|
+
"--color-border-light": string;
|
|
14
|
+
"--color-text": string;
|
|
15
|
+
"--color-text-secondary": string;
|
|
16
|
+
"--color-text-muted": string;
|
|
17
|
+
"--color-text-faint": string;
|
|
18
|
+
"--color-accent": string;
|
|
19
|
+
"--color-accent-hover": string;
|
|
20
|
+
"--color-selection-bg": string;
|
|
21
|
+
"--color-selection-text": string;
|
|
22
|
+
"--color-scrollbar": string;
|
|
23
|
+
"--color-scrollbar-hover": string;
|
|
24
|
+
[key: string]: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Theme {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
colors: ThemeColors;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const themes: Record<string, Theme> = {
|
|
34
|
+
// ── Classic (terminal/hacker) ──────────────────────────
|
|
35
|
+
dark: {
|
|
36
|
+
id: "dark",
|
|
37
|
+
name: "Dark",
|
|
38
|
+
colors: {
|
|
39
|
+
"--color-bg": "#0a0a0a",
|
|
40
|
+
"--color-bg-secondary": "#0f0f0f",
|
|
41
|
+
"--color-surface": "#111111",
|
|
42
|
+
"--color-surface-hover": "#0a0a0a",
|
|
43
|
+
"--color-surface-raised": "#1a1a1a",
|
|
44
|
+
"--color-border": "#1a1a1a",
|
|
45
|
+
"--color-border-light": "#222222",
|
|
46
|
+
"--color-text": "#e0e0e0",
|
|
47
|
+
"--color-text-secondary": "#888888",
|
|
48
|
+
"--color-text-muted": "#666666",
|
|
49
|
+
"--color-text-faint": "#555555",
|
|
50
|
+
"--color-accent": "#f97316",
|
|
51
|
+
"--color-accent-hover": "#ea580c",
|
|
52
|
+
"--color-accent-5": "rgba(249, 115, 22, 0.05)",
|
|
53
|
+
"--color-accent-10": "rgba(249, 115, 22, 0.1)",
|
|
54
|
+
"--color-accent-15": "rgba(249, 115, 22, 0.15)",
|
|
55
|
+
"--color-accent-20": "rgba(249, 115, 22, 0.2)",
|
|
56
|
+
"--color-accent-30": "rgba(249, 115, 22, 0.3)",
|
|
57
|
+
"--color-accent-70": "rgba(249, 115, 22, 0.7)",
|
|
58
|
+
"--color-selection-bg": "#f97316",
|
|
59
|
+
"--color-selection-text": "#0a0a0a",
|
|
60
|
+
"--color-scrollbar": "#222222",
|
|
61
|
+
"--color-scrollbar-hover": "#444444",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
light: {
|
|
65
|
+
id: "light",
|
|
66
|
+
name: "Light",
|
|
67
|
+
colors: {
|
|
68
|
+
"--color-bg": "#ffffff",
|
|
69
|
+
"--color-bg-secondary": "#f7f7f7",
|
|
70
|
+
"--color-surface": "#ffffff",
|
|
71
|
+
"--color-surface-hover": "#f5f5f5",
|
|
72
|
+
"--color-surface-raised": "#f0f0f0",
|
|
73
|
+
"--color-border": "#e0e0e0",
|
|
74
|
+
"--color-border-light": "#e8e8e8",
|
|
75
|
+
"--color-text": "#1a1a1a",
|
|
76
|
+
"--color-text-secondary": "#555555",
|
|
77
|
+
"--color-text-muted": "#777777",
|
|
78
|
+
"--color-text-faint": "#999999",
|
|
79
|
+
"--color-accent": "#ea580c",
|
|
80
|
+
"--color-accent-hover": "#c2410c",
|
|
81
|
+
"--color-accent-5": "rgba(234, 88, 12, 0.05)",
|
|
82
|
+
"--color-accent-10": "rgba(234, 88, 12, 0.1)",
|
|
83
|
+
"--color-accent-15": "rgba(234, 88, 12, 0.15)",
|
|
84
|
+
"--color-accent-20": "rgba(234, 88, 12, 0.2)",
|
|
85
|
+
"--color-accent-30": "rgba(234, 88, 12, 0.3)",
|
|
86
|
+
"--color-accent-70": "rgba(234, 88, 12, 0.7)",
|
|
87
|
+
"--color-selection-bg": "#ea580c",
|
|
88
|
+
"--color-selection-text": "#ffffff",
|
|
89
|
+
"--color-scrollbar": "#cccccc",
|
|
90
|
+
"--color-scrollbar-hover": "#aaaaaa",
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
// ── Professional (enterprise/SaaS) ────────────────────
|
|
95
|
+
"professional-dark": {
|
|
96
|
+
id: "professional-dark",
|
|
97
|
+
name: "Professional Dark",
|
|
98
|
+
colors: {
|
|
99
|
+
"--color-bg": "#0f1117",
|
|
100
|
+
"--color-bg-secondary": "#131520",
|
|
101
|
+
"--color-surface": "#181a24",
|
|
102
|
+
"--color-surface-hover": "#1e2030",
|
|
103
|
+
"--color-surface-raised": "#232636",
|
|
104
|
+
"--color-border": "#252838",
|
|
105
|
+
"--color-border-light": "#2d3044",
|
|
106
|
+
"--color-text": "#d4d7e0",
|
|
107
|
+
"--color-text-secondary": "#8b8fa3",
|
|
108
|
+
"--color-text-muted": "#6b6f83",
|
|
109
|
+
"--color-text-faint": "#4e5266",
|
|
110
|
+
"--color-accent": "#7c3aed",
|
|
111
|
+
"--color-accent-hover": "#6d28d9",
|
|
112
|
+
"--color-accent-5": "rgba(124, 58, 237, 0.05)",
|
|
113
|
+
"--color-accent-10": "rgba(124, 58, 237, 0.1)",
|
|
114
|
+
"--color-accent-15": "rgba(124, 58, 237, 0.15)",
|
|
115
|
+
"--color-accent-20": "rgba(124, 58, 237, 0.2)",
|
|
116
|
+
"--color-accent-30": "rgba(124, 58, 237, 0.3)",
|
|
117
|
+
"--color-accent-70": "rgba(124, 58, 237, 0.7)",
|
|
118
|
+
"--color-selection-bg": "#7c3aed",
|
|
119
|
+
"--color-selection-text": "#ffffff",
|
|
120
|
+
"--color-scrollbar": "#2d3044",
|
|
121
|
+
"--color-scrollbar-hover": "#3d4058",
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
"professional-light": {
|
|
125
|
+
id: "professional-light",
|
|
126
|
+
name: "Professional Light",
|
|
127
|
+
colors: {
|
|
128
|
+
"--color-bg": "#f8f9fb",
|
|
129
|
+
"--color-bg-secondary": "#f0f2f5",
|
|
130
|
+
"--color-surface": "#ffffff",
|
|
131
|
+
"--color-surface-hover": "#f5f6f8",
|
|
132
|
+
"--color-surface-raised": "#eef0f4",
|
|
133
|
+
"--color-border": "#e2e4ea",
|
|
134
|
+
"--color-border-light": "#e8eaef",
|
|
135
|
+
"--color-text": "#1a1d2b",
|
|
136
|
+
"--color-text-secondary": "#4b5066",
|
|
137
|
+
"--color-text-muted": "#6b7088",
|
|
138
|
+
"--color-text-faint": "#9298ac",
|
|
139
|
+
"--color-accent": "#6d28d9",
|
|
140
|
+
"--color-accent-hover": "#5b21b6",
|
|
141
|
+
"--color-accent-5": "rgba(109, 40, 217, 0.05)",
|
|
142
|
+
"--color-accent-10": "rgba(109, 40, 217, 0.1)",
|
|
143
|
+
"--color-accent-15": "rgba(109, 40, 217, 0.15)",
|
|
144
|
+
"--color-accent-20": "rgba(109, 40, 217, 0.2)",
|
|
145
|
+
"--color-accent-30": "rgba(109, 40, 217, 0.3)",
|
|
146
|
+
"--color-accent-70": "rgba(109, 40, 217, 0.7)",
|
|
147
|
+
"--color-selection-bg": "#6d28d9",
|
|
148
|
+
"--color-selection-text": "#ffffff",
|
|
149
|
+
"--color-scrollbar": "#cdd0d8",
|
|
150
|
+
"--color-scrollbar-hover": "#b0b4c0",
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/** Resolve the effective theme from mode + style + system preference */
|
|
156
|
+
export function resolveTheme(mode: ThemeMode, style: ThemeStyle, prefersDark: boolean): Theme {
|
|
157
|
+
const isDark = mode === "auto" ? prefersDark : mode === "dark";
|
|
158
|
+
if (style === "professional") {
|
|
159
|
+
return isDark ? themes["professional-dark"] : themes["professional-light"];
|
|
160
|
+
}
|
|
161
|
+
return isDark ? themes.dark : themes.light;
|
|
162
|
+
}
|
package/src/web/types.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
// Shared types for the Apteva UI
|
|
2
2
|
|
|
3
|
-
export type AgentMode = "coordinator" | "worker";
|
|
4
|
-
|
|
5
3
|
export interface MultiAgentConfig {
|
|
6
4
|
enabled: boolean;
|
|
7
|
-
mode?: AgentMode;
|
|
8
5
|
group?: string; // Defaults to projectId if not specified
|
|
9
6
|
}
|
|
10
7
|
|
|
@@ -60,7 +57,6 @@ export function getMultiAgentConfig(features: AgentFeatures, projectId?: string
|
|
|
60
57
|
if (typeof agents === "boolean") {
|
|
61
58
|
return {
|
|
62
59
|
enabled: agents,
|
|
63
|
-
mode: "worker",
|
|
64
60
|
group: projectId || undefined,
|
|
65
61
|
};
|
|
66
62
|
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{V as A}from"./App.7sy3wq8c.js";import{$ as V,X as C,aa as L,ca as P,ja as S,ma as b}from"./App.3qw8nben.js";var W=C(V(),1);var q=C(L(),1),x=new Set(["thread_activity","agent_started","agent_stopped","agent_error","task_created","task_updated","task_deleted","task_executed","llm_request","tool_invocation","mcp_request","mcp_tool_execution"]),j={CHAT:"bg-green-400",LLM:"bg-purple-400",TOOL:"bg-blue-400",TASK:"bg-yellow-400",MEMORY:"bg-cyan-400",MCP:"bg-orange-400",SYSTEM:"bg-gray-400",ERROR:"bg-red-400"};function m($,G){let U=$.data||{};switch($.type){case"thread_activity":return U.activity||"Working...";case"agent_started":return"Agent started";case"agent_stopped":return U.reason?`Agent stopped (${U.reason})`:"Agent stopped";case"agent_error":return $.error||"Agent error";case"llm_request":return"Thinking...";case"tool_invocation":{let Q=U.tool_name||"";if(!Q)return"Using tools";return`Tool: ${Q.replace(/[-_]/g," ").replace(/\b\w/g,(Z)=>Z.toUpperCase())}`}case"task_created":return U.title?`Task created: ${U.title}`:"Task created";case"task_updated":{let{status:Q,title:X}=U,Z=Q?Q.charAt(0).toUpperCase()+Q.slice(1):null;if(X&&Z)return`Task ${Z}: ${X}`;if(Z)return`Task ${Z}`;if(X)return`Task updated: ${X}`;return"Task updated"}case"task_deleted":return"Task deleted";case"task_executed":{let Q=U.title;return Q?`Task started: ${Q}`:"Task started"}case"memory_stored":return"Memory stored";case"memory_retrieved":return"Memory retrieved";case"mcp_request":return U.server?`MCP request to ${U.server}`:"MCP request";case"mcp_tool_execution":{let Q=U.tool_name||U.tool||"";if(!Q)return"MCP tool call";return`MCP: ${(Q.includes("__")?Q.split("__").slice(1).join("__"):Q).replace(/[-_]/g," ").replace(/\b\w/g,(H)=>H.toUpperCase())}`}default:return $.type.replace(/_/g," ")}}function l({agents:$,loading:G,onNavigate:U}){let{authFetch:Q}=S(),{currentProjectId:X}=b(),{events:Z,statusChangeCounter:H}=P(),[_,p]=W.useState([]),[R,I]=W.useState(""),[O]=W.useState(()=>new Set),y=W.useRef(!1),Y=W.useMemo(()=>{if(X===null)return $;if(X==="unassigned")return $.filter((z)=>!z.projectId);return $.filter((z)=>z.projectId===X)},[$,X]),N=W.useMemo(()=>new Set(Y.map((z)=>z.id)),[Y]),h=W.useMemo(()=>{let z=new Map;return Y.forEach((J)=>z.set(J.id,J.name)),z},[Y]),w=W.useCallback(async()=>{let z=X?`&project_id=${encodeURIComponent(X)}`:"";try{let J=await Q(`/api/telemetry/events?limit=200${z}`);if(J.ok){let B=await J.json();p(B.events||[])}}catch{}},[Q,X]);W.useEffect(()=>{w()},[w,H]),W.useEffect(()=>{if(_.length>0&&!y.current){for(let z of _)O.add(z.id);for(let z of Z)O.add(z.id);y.current=!0}},[_,Z,O]);let M=W.useMemo(()=>{let z=new Set,J=[],B=(K)=>{if(!x.has(K.type)||!N.has(K.agent_id)||K.data?.parent_id)return!1;if(K.type==="mcp_tool_execution"&&!K.duration_ms)return!1;return!0};for(let K of Z)if(!z.has(K.id)&&B(K))J.push(K),z.add(K.id);for(let K of _)if(!z.has(K.id)&&B(K))J.push(K),z.add(K.id);let k=J;if(R)k=k.filter((K)=>K.agent_id===R);return k.sort((K,F)=>new Date(F.timestamp).getTime()-new Date(K.timestamp).getTime()),k.slice(0,200)},[Z,_,N,R]),f=W.useMemo(()=>{let z=[],J="",B=new Date().toDateString(),k=new Date(Date.now()-86400000).toDateString();for(let K of M){let F=new Date(K.timestamp).toDateString(),T=F===B?"Today":F===k?"Yesterday":F;if(T!==J)J=T,z.push({label:T,events:[]});z[z.length-1].events.push(K)}return z},[M]);if(G)return q.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:"Loading..."},void 0,!1,void 0,this);let D=Y.filter((z)=>z.status==="running").length;return q.jsxDEV("div",{className:"flex-1 flex flex-col overflow-hidden",children:[q.jsxDEV("div",{className:"px-6 pt-6 pb-4 shrink-0",children:q.jsxDEV("div",{className:"flex items-center justify-between gap-4",children:[q.jsxDEV("div",{children:[q.jsxDEV("h1",{className:"text-xl font-semibold",children:"Activity"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[#666] mt-0.5",children:[D," of ",Y.length," agents running"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"w-48",children:q.jsxDEV(A,{value:R,onChange:I,placeholder:"All agents",options:[{value:"",label:"All agents"},...Y.map((z)=>({value:z.id,label:z.name}))]},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex-1 overflow-auto px-6 pb-6",children:M.length===0?q.jsxDEV("div",{className:"flex flex-col items-center justify-center py-20 text-[#555]",children:[q.jsxDEV("p",{className:"text-lg mb-2",children:"No activity yet"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm",children:"Agent activity will appear here in real-time."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"max-w-2xl",children:f.map((z)=>q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"sticky top-0 z-10 bg-[#0a0a0a]/95 backdrop-blur-sm py-2 mb-1",children:q.jsxDEV("span",{className:"text-xs font-semibold text-[#666] uppercase tracking-wider",children:z.label},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("div",{className:"relative ml-3 border-l border-[#1a1a1a]",children:z.events.map((J)=>{let B=!O.has(J.id);if(B)O.add(J.id);let k=h.get(J.agent_id)||J.agent_id.slice(0,8),K=J.level==="error"?"bg-red-400":j[J.category]||"bg-[#555]";return q.jsxDEV("div",{className:`relative pl-6 pr-3 py-2.5 hover:bg-[#111]/50 transition-colors ${B?"animate-slideIn":""}`,children:[q.jsxDEV("span",{className:`absolute left-[-4.5px] top-[14px] w-[9px] h-[9px] rounded-full ${K} ring-2 ring-[#0a0a0a]`},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-start justify-between gap-3",children:[q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("p",{className:`text-sm ${J.level==="error"?"text-red-400":""}`,children:m(J,k)},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-2 text-[11px] text-[#555] mt-0.5",children:[q.jsxDEV("span",{className:"text-[#888] font-medium",children:k},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[#333]",children:"·"},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[#555]",children:J.category},void 0,!1,void 0,this),J.duration_ms!=null&&J.duration_ms>0&&q.jsxDEV(q.Fragment,{children:[q.jsxDEV("span",{className:"text-[#333]",children:"·"},void 0,!1,void 0,this),q.jsxDEV("span",{children:J.duration_ms<1000?`${J.duration_ms}ms`:`${(J.duration_ms/1000).toFixed(1)}s`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("span",{className:"text-[11px] text-[#555] shrink-0 pt-0.5",children:g(J.timestamp)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},J.id,!0,void 0,this)})},void 0,!1,void 0,this)]},z.label,!0,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function g($){let G=Math.floor((Date.now()-new Date($).getTime())/1000);if(G<5)return"just now";if(G<60)return`${G}s ago`;let U=Math.floor(G/60);if(U<60)return`${U}m ago`;let Q=Math.floor(U/60);if(Q<24)return`${Q}h ago`;return`${Math.floor(Q/24)}d ago`}export{l as ActivityPage};
|
|
2
|
-
|
|
3
|
-
//# debugId=7FD9FF2C4015E95064756E2164756E21
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{$ as E,X as y,aa as D,ja as l}from"./App.3qw8nben.js";var M=y(E(),1);var z=y(D(),1),V={get:"#61affe",post:"#49cc90",put:"#fca130",delete:"#f93e3e",patch:"#50e3c2"};function c({method:I,path:A,parameters:F,requestBody:L,authFetch:T}){let[U,R]=M.useState({}),[G,O]=M.useState(""),[_,k]=M.useState(null),[w,q]=M.useState(!1),[B,f]=M.useState(null);M.useEffect(()=>{if(L?.content?.["application/json"]?.schema){let W=L.content["application/json"].schema;if(W.example)O(JSON.stringify(W.example,null,2));else if(W.properties){let $={};for(let[N,Q]of Object.entries(W.properties))if(Q.example!==void 0)$[N]=Q.example;else if(Q.type==="string")$[N]="";else if(Q.type==="number"||Q.type==="integer")$[N]=0;else if(Q.type==="boolean")$[N]=!1;else if(Q.type==="array")$[N]=[];else if(Q.type==="object")$[N]={};O(JSON.stringify($,null,2))}}},[L]);let C=async()=>{q(!0),f(null),k(null);try{let W=A,$=[];for(let Z of F||[]){let H=U[Z.name]||"";if(Z.in==="path")W=W.replace(`{${Z.name}}`,encodeURIComponent(H));else if(Z.in==="query"&&H)$.push(`${Z.name}=${encodeURIComponent(H)}`)}if($.length>0)W+=`?${$.join("&")}`;let N={method:I.toUpperCase()};if(G&&["post","put","patch"].includes(I))N.headers={"Content-Type":"application/json"},N.body=G;let Q=await T(`/api${W}`,N),X;if(Q.headers.get("content-type")?.includes("application/json"))X=await Q.json();else X=await Q.text();k({status:Q.status,data:X})}catch(W){f(W.message||"Request failed")}finally{q(!1)}},b=F?.filter((W)=>W.in==="path")||[],K=F?.filter((W)=>W.in==="query")||[],S=["post","put","patch"].includes(I)&&L;return z.jsxDEV("div",{style:{marginTop:16,padding:16,background:"#0a0a14",borderRadius:6,border:"1px solid #222"},children:[z.jsxDEV("h4",{style:{fontSize:13,color:"#f97316",marginBottom:12,fontWeight:600},children:"Try it out"},void 0,!1,void 0,this),b.length>0&&z.jsxDEV("div",{style:{marginBottom:12},children:[z.jsxDEV("div",{style:{fontSize:11,color:"#666",marginBottom:6},children:"Path Parameters"},void 0,!1,void 0,this),b.map((W)=>z.jsxDEV("div",{style:{marginBottom:8},children:[z.jsxDEV("label",{style:{fontSize:12,color:"#888",display:"block",marginBottom:4},children:[W.name," ",W.required&&z.jsxDEV("span",{style:{color:"#f66"},children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("input",{type:"text",value:U[W.name]||"",onChange:($)=>R({...U,[W.name]:$.target.value}),placeholder:W.schema?.type||"string",style:{width:"100%",padding:"8px 12px",background:"#111",border:"1px solid #333",borderRadius:4,color:"#fff",fontSize:13,fontFamily:"monospace"}},void 0,!1,void 0,this)]},W.name,!0,void 0,this))]},void 0,!0,void 0,this),K.length>0&&z.jsxDEV("div",{style:{marginBottom:12},children:[z.jsxDEV("div",{style:{fontSize:11,color:"#666",marginBottom:6},children:"Query Parameters"},void 0,!1,void 0,this),K.map((W)=>z.jsxDEV("div",{style:{marginBottom:8},children:[z.jsxDEV("label",{style:{fontSize:12,color:"#888",display:"block",marginBottom:4},children:[W.name," ",W.required&&z.jsxDEV("span",{style:{color:"#f66"},children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("input",{type:"text",value:U[W.name]||"",onChange:($)=>R({...U,[W.name]:$.target.value}),placeholder:W.schema?.type||"string",style:{width:"100%",padding:"8px 12px",background:"#111",border:"1px solid #333",borderRadius:4,color:"#fff",fontSize:13,fontFamily:"monospace"}},void 0,!1,void 0,this)]},W.name,!0,void 0,this))]},void 0,!0,void 0,this),S&&z.jsxDEV("div",{style:{marginBottom:12},children:[z.jsxDEV("div",{style:{fontSize:11,color:"#666",marginBottom:6},children:"Request Body (JSON)"},void 0,!1,void 0,this),z.jsxDEV("textarea",{value:G,onChange:(W)=>O(W.target.value),rows:6,style:{width:"100%",padding:"8px 12px",background:"#111",border:"1px solid #333",borderRadius:4,color:"#fff",fontSize:12,fontFamily:"monospace",resize:"vertical"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:C,disabled:w,style:{padding:"10px 20px",background:w?"#333":"#f97316",color:w?"#666":"#000",border:"none",borderRadius:4,cursor:w?"not-allowed":"pointer",fontSize:13,fontWeight:600},children:w?"Executing...":"Execute"},void 0,!1,void 0,this),B&&z.jsxDEV("div",{style:{marginTop:12,padding:12,background:"#2a1515",borderRadius:4,color:"#f66",fontSize:12},children:B},void 0,!1,void 0,this),_&&z.jsxDEV("div",{style:{marginTop:12},children:[z.jsxDEV("div",{style:{fontSize:11,color:"#666",marginBottom:6},children:["Response"," ",z.jsxDEV("span",{style:{color:_.status>=200&&_.status<300?"#49cc90":"#f66"},children:_.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("pre",{style:{padding:12,background:"#111",borderRadius:4,color:"#888",fontSize:11,fontFamily:"monospace",overflow:"auto",maxHeight:300,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:typeof _.data==="string"?_.data:JSON.stringify(_.data,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function h(){let{authFetch:I}=l(),[A,F]=M.useState(null),[L,T]=M.useState(!0),[U,R]=M.useState(new Set),[G,O]=M.useState(null),[_,k]=M.useState(!1);M.useEffect(()=>{B()},[]);async function w(){if(!A)return;try{await navigator.clipboard.writeText(JSON.stringify(A,null,2)),k(!0),setTimeout(()=>k(!1),2000)}catch(N){console.error("Failed to copy:",N)}}function q(){if(!A)return;let N=new Blob([JSON.stringify(A,null,2)],{type:"application/json"}),Q=URL.createObjectURL(N),X=document.createElement("a");X.href=Q,X.download="apteva-openapi.json",X.click(),URL.revokeObjectURL(Q)}async function B(){try{let N=await I("/api/openapi");if(N.ok){let Q=await N.json();F(Q)}}catch(N){console.error("Failed to load OpenAPI spec:",N)}finally{T(!1)}}function f(N){R((Q)=>{let X=new Set(Q);if(X.has(N))X.delete(N);else X.add(N);return X})}function C(N,Q=0){if(!N)return"{}";if(Q>2)return"...";if(N.$ref)return N.$ref.split("/").pop()||"Object";if(N.type==="array")return`${C(N.items,Q+1)}[]`;if(N.type==="object"&&N.properties){let X=Object.entries(N.properties).slice(0,3).map(([Z,H])=>`${Z}: ${H.type||"any"}`).join(", "),Y=Object.keys(N.properties).length>3?", ...":"";return`{ ${X}${Y} }`}return N.type||"any"}if(L)return z.jsxDEV("div",{style:{padding:24},children:z.jsxDEV("p",{style:{color:"#888"},children:"Loading API documentation..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(!A)return z.jsxDEV("div",{style:{padding:24},children:z.jsxDEV("p",{style:{color:"#f66"},children:"Failed to load API documentation"},void 0,!1,void 0,this)},void 0,!1,void 0,this);let b=A.tags||[],K=Object.entries(A.paths);function S(N){let Q=new Set;function X(Y){if(!Y)return;if(typeof Y==="object"){if(Y.$ref){let Z=Y.$ref.split("/").pop();if(Z)Q.add(Z)}for(let Z of Object.values(Y))X(Z)}}return X(N.requestBody),X(N.responses),Q}function W(){if(!G||!A.components?.schemas)return Object.keys(A.components?.schemas||{});let N=new Set;for(let[Q,X]of $)for(let[Y,Z]of Object.entries(X)){if(!["get","post","put","delete","patch"].includes(Y))continue;if(Z.tags?.includes(G))S(Z).forEach((g)=>N.add(g))}return Array.from(N)}let $=G?K.filter(([N,Q])=>Object.values(Q).some((X)=>X.tags?.includes(G))):K;return z.jsxDEV("div",{style:{padding:24,maxWidth:1000,height:"100%",overflowY:"auto"},children:[z.jsxDEV("div",{style:{marginBottom:24},children:[z.jsxDEV("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:8},children:[z.jsxDEV("h1",{style:{fontSize:24,fontWeight:600},children:A.info.title},void 0,!1,void 0,this),z.jsxDEV("div",{style:{display:"flex",gap:8},children:[z.jsxDEV("button",{onClick:w,style:{padding:"8px 16px",borderRadius:4,border:"1px solid #333",background:_?"#49cc90":"#1a1a2e",color:_?"#000":"#fff",cursor:"pointer",fontSize:12,fontFamily:"inherit"},children:_?"Copied!":"Copy JSON"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:q,style:{padding:"8px 16px",borderRadius:4,border:"1px solid #333",background:"#1a1a2e",color:"#fff",cursor:"pointer",fontSize:12,fontFamily:"inherit"},children:"Download"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("p",{style:{color:"#888",marginBottom:8},children:A.info.description.split(`
|
|
2
|
-
`)[0]},void 0,!1,void 0,this),z.jsxDEV("p",{style:{color:"#666",fontSize:12},children:["Version: ",A.info.version]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{background:"#1a1a2e",padding:12,borderRadius:6,marginBottom:24,fontFamily:"monospace"},children:[z.jsxDEV("span",{style:{color:"#888"},children:"Base URL: "},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#61affe"},children:[window.location.origin,"/api"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{marginBottom:24,display:"flex",flexWrap:"wrap",gap:8},children:[z.jsxDEV("button",{onClick:()=>O(null),style:{padding:"6px 12px",borderRadius:4,border:"1px solid #333",background:G===null?"#333":"transparent",color:G===null?"#fff":"#888",cursor:"pointer",fontSize:12},children:"All"},void 0,!1,void 0,this),b.map((N)=>z.jsxDEV("button",{onClick:()=>O(N.name),style:{padding:"6px 12px",borderRadius:4,border:"1px solid #333",background:G===N.name?"#333":"transparent",color:G===N.name?"#fff":"#888",cursor:"pointer",fontSize:12},title:N.description,children:N.name},N.name,!1,void 0,this))]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{display:"flex",flexDirection:"column",gap:8},children:$.map(([N,Q])=>Object.entries(Q).filter(([X])=>["get","post","put","delete","patch"].includes(X)).map(([X,Y])=>{let Z=`${X}:${N}`,H=U.has(Z),g=X.toUpperCase(),j=V[X]||"#888";return z.jsxDEV("div",{style:{border:"1px solid #333",borderRadius:6,overflow:"hidden"},children:[z.jsxDEV("div",{onClick:()=>f(Z),style:{display:"flex",alignItems:"center",gap:12,padding:"12px 16px",background:H?"#1a1a2e":"transparent",cursor:"pointer"},children:[z.jsxDEV("span",{style:{background:j,color:"#000",padding:"4px 8px",borderRadius:4,fontSize:11,fontWeight:600,minWidth:60,textAlign:"center"},children:g},void 0,!1,void 0,this),z.jsxDEV("span",{style:{fontFamily:"monospace",color:"#fff"},children:N},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#888",flex:1,fontSize:13},children:Y.summary},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#666",fontSize:12},children:H?"[-]":"[+]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H&&z.jsxDEV("div",{style:{padding:16,background:"#0d0d1a",borderTop:"1px solid #333"},children:[Y.description&&z.jsxDEV("p",{style:{color:"#888",marginBottom:16,fontSize:13},children:Y.description},void 0,!1,void 0,this),Y.parameters&&Y.parameters.length>0&&z.jsxDEV("div",{style:{marginBottom:16},children:[z.jsxDEV("h4",{style:{fontSize:13,color:"#888",marginBottom:8},children:"Parameters"},void 0,!1,void 0,this),z.jsxDEV("div",{style:{background:"#1a1a2e",borderRadius:4,padding:12},children:Y.parameters.map((J)=>z.jsxDEV("div",{style:{display:"flex",gap:12,marginBottom:8,fontSize:12},children:[z.jsxDEV("span",{style:{color:"#61affe",minWidth:100},children:[J.name,J.required&&z.jsxDEV("span",{style:{color:"#f66"},children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("span",{style:{color:"#666"},children:["(",J.in,")"]},void 0,!0,void 0,this),z.jsxDEV("span",{style:{color:"#888"},children:J.schema?.type||"string"},void 0,!1,void 0,this),J.description&&z.jsxDEV("span",{style:{color:"#666"},children:["- ",J.description]},void 0,!0,void 0,this)]},J.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.requestBody&&z.jsxDEV("div",{style:{marginBottom:16},children:[z.jsxDEV("h4",{style:{fontSize:13,color:"#888",marginBottom:8},children:["Request Body",Y.requestBody.required&&z.jsxDEV("span",{style:{color:"#f66"},children:" (required)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{background:"#1a1a2e",borderRadius:4,padding:12,fontFamily:"monospace",fontSize:12,color:"#49cc90"},children:Object.entries(Y.requestBody.content||{}).map(([J,P])=>z.jsxDEV("div",{children:[z.jsxDEV("span",{style:{color:"#666"},children:[J,": "]},void 0,!0,void 0,this),C(P.schema)]},J,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.responses&&z.jsxDEV("div",{children:[z.jsxDEV("h4",{style:{fontSize:13,color:"#888",marginBottom:8},children:"Responses"},void 0,!1,void 0,this),z.jsxDEV("div",{style:{background:"#1a1a2e",borderRadius:4,padding:12},children:Object.entries(Y.responses).map(([J,P])=>{let v=P.content?.["application/json"]?.schema,u=v?.$ref?.split("/").pop(),n=v?.type,i=v?.items?.$ref?.split("/").pop();return z.jsxDEV("div",{style:{marginBottom:12,fontSize:12},children:[z.jsxDEV("div",{style:{display:"flex",gap:12,marginBottom:4},children:[z.jsxDEV("span",{style:{color:J.startsWith("2")?"#49cc90":"#f66",minWidth:40},children:J},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#888"},children:P.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&z.jsxDEV("div",{style:{marginLeft:52,padding:"8px 12px",background:"#0d0d1a",borderRadius:4,fontFamily:"monospace"},children:u?z.jsxDEV("span",{style:{color:"#61affe"},children:u},void 0,!1,void 0,this):n==="array"&&i?z.jsxDEV("span",{style:{color:"#61affe"},children:[i,"[]"]},void 0,!0,void 0,this):n==="array"?z.jsxDEV("span",{style:{color:"#888"},children:"array"},void 0,!1,void 0,this):z.jsxDEV("span",{style:{color:"#888"},children:C(v)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},J,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(c,{method:X,path:N,parameters:Y.parameters,requestBody:Y.requestBody,authFetch:I},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},Z,!0,void 0,this)}))},void 0,!1,void 0,this),A.components?.schemas&&W().length>0&&z.jsxDEV("div",{style:{marginTop:32},children:[z.jsxDEV("h2",{style:{fontSize:18,fontWeight:600,marginBottom:16},children:["Schemas ",G&&z.jsxDEV("span",{style:{color:"#666",fontSize:14},children:["(",G,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{display:"flex",flexDirection:"column",gap:8},children:W().map((N)=>{let Q=A.components.schemas[N];if(!Q)return null;return z.jsxDEV("div",{style:{border:"1px solid #333",borderRadius:6,padding:12},children:[z.jsxDEV("h3",{style:{fontSize:14,color:"#61affe",marginBottom:8},children:N},void 0,!1,void 0,this),Q.properties&&z.jsxDEV("div",{style:{fontSize:12},children:Object.entries(Q.properties).map(([X,Y])=>z.jsxDEV("div",{style:{display:"flex",gap:8,marginBottom:4,fontFamily:"monospace"},children:[z.jsxDEV("span",{style:{color:"#fff",minWidth:120},children:X},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#888"},children:[Y.type||(Y.$ref?Y.$ref.split("/").pop():"any"),Y.nullable&&" | null"]},void 0,!0,void 0,this),Y.enum&&z.jsxDEV("span",{style:{color:"#666"},children:["[",Y.enum.join(" | "),"]"]},void 0,!0,void 0,this)]},X,!0,void 0,this))},void 0,!1,void 0,this)]},N,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}export{h as ApiDocsPage};
|
|
3
|
-
|
|
4
|
-
//# debugId=1AB92358965FEA7164756E2164756E21
|
package/dist/App.01nq20st.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
function a(r){var n,f,t="";if(typeof r=="string"||typeof r=="number")t+=r;else if(typeof r=="object")if(Array.isArray(r)){var o=r.length;for(n=0;n<o;n++)r[n]&&(f=a(r[n]))&&(t&&(t+=" "),t+=f)}else for(f in r)r[f]&&(t&&(t+=" "),t+=f);return t}function e(){for(var r,n,f=0,t="",o=arguments.length;f<o;f++)(r=arguments[f])&&(n=a(r))&&(t&&(t+=" "),t+=n);return t}
|
|
2
|
-
export{e as W};
|
|
3
|
-
|
|
4
|
-
//# debugId=C80F2DB3063D851D64756E2164756E21
|
package/dist/App.1maqvamf.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{j as _0}from"./App.myxqcj9x.js";import{V as x}from"./App.7sy3wq8c.js";import{$ as X1,X as O,aa as n,ja as g,ma as j}from"./App.3qw8nben.js";var $0=O(X1(),1);var D=O(X1(),1);var U=O(n(),1);function m0(){let{authFetch:R}=g(),{currentProjectId:H}=j(),[J,F]=D.useState([]),[Q,V]=D.useState([]),[W,T]=D.useState(!0);if(D.useEffect(()=>{(async()=>{T(!0);let y=H&&H!=="unassigned"?`?project_id=${H}`:"";try{let[I,a]=await Promise.all([R(`/api/subscriptions${y}`).catch(()=>null),R("/api/agents").catch(()=>null)]);if(I?.ok){let G=await I.json();F(G.subscriptions||[])}if(a?.ok){let G=await a.json();V(G.agents||[])}}catch(I){console.error("Failed to fetch overview data:",I)}T(!1)})()},[R,H]),W)return U.jsxDEV("div",{className:"text-center py-12 text-[#666]",children:"Loading..."},void 0,!1,void 0,this);let A=J.filter((Y)=>Y.enabled),S=J.filter((Y)=>!Y.enabled),l=new Map(Q.map((Y)=>[Y.id,Y]));return U.jsxDEV("div",{className:"space-y-6",children:[U.jsxDEV("div",{className:"grid grid-cols-3 gap-4",children:[U.jsxDEV(C1,{label:"Active",value:A.length},void 0,!1,void 0,this),U.jsxDEV(C1,{label:"Disabled",value:S.length},void 0,!1,void 0,this),U.jsxDEV(C1,{label:"Total",value:J.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("section",{children:[U.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:["Subscriptions (",J.length,")"]},void 0,!0,void 0,this),J.length===0?U.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No subscriptions yet. Go to the Triggers tab to create one."},void 0,!1,void 0,this):U.jsxDEV("div",{className:"space-y-2",children:J.map((Y)=>{let y=l.get(Y.agent_id);return U.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[U.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${Y.enabled?"bg-green-400":"bg-[#555]"}`},void 0,!1,void 0,this),U.jsxDEV("div",{className:"flex-1 min-w-0",children:[U.jsxDEV("div",{className:"text-sm font-medium truncate",children:Y.trigger_slug.replace(/_/g," ").replace(/-/g," ")},void 0,!1,void 0,this),U.jsxDEV("div",{className:"text-xs text-[#666]",children:Y.trigger_instance_id?`ID: ${Y.trigger_instance_id.slice(0,12)}...`:"All instances"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("div",{className:"text-xs text-[#888] flex-shrink-0",children:[U.jsxDEV("span",{className:"text-[#555]",children:"→"},void 0,!1,void 0,this)," ",U.jsxDEV("span",{className:"text-[#f97316]",children:y?.name||"Unknown Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U.jsxDEV("span",{className:`text-xs px-2 py-0.5 rounded flex-shrink-0 ${Y.enabled?"bg-green-500/10 text-green-400":"bg-[#1a1a1a] text-[#555]"}`,children:Y.enabled?"active":"disabled"},void 0,!1,void 0,this)]},Y.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function C1({label:R,value:H,valueColor:J}){return U.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4",children:[U.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:R},void 0,!1,void 0,this),U.jsxDEV("div",{className:`text-2xl font-bold ${J||"text-[#e0e0e0]"}`,children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var $=O(X1(),1);var i=O(n(),1);function I0({message:R="Loading...",fullScreen:H=!1}){let J=i.jsxDEV("div",{className:"flex items-center gap-3 text-[#666]",children:[i.jsxDEV("svg",{className:"animate-spin h-5 w-5",viewBox:"0 0 24 24",children:[i.jsxDEV("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"},void 0,!1,void 0,this),i.jsxDEV("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.jsxDEV("span",{children:R},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(H)return i.jsxDEV("div",{className:"min-h-screen bg-[#0a0a0a] text-[#e0e0e0] font-mono flex items-center justify-center",children:J},void 0,!1,void 0,this);return i.jsxDEV("div",{className:"flex items-center justify-center py-20",children:J},void 0,!1,void 0,this)}var m=O(n(),1);function v0(){let{authFetch:R}=g(),{currentProjectId:H}=j(),[J,F]=$.useState([]),[Q,V]=$.useState(""),[W,T]=$.useState([]),[A,S]=$.useState(!0),[l,Y]=$.useState([]),[y,I]=$.useState([]),[a,G]=$.useState(!1),[b,k]=$.useState(""),[o,F1]=$.useState(""),[R0,v1]=$.useState(!1),[B,_1]=$.useState(null),[f1,z0]=$.useState([]),[$1,I1]=$.useState(""),[Y1,R1]=$.useState(!1),[r,n1]=$.useState(""),[Z1,P1]=$.useState({}),[l1,G0]=$.useState(""),[H0,q1]=$.useState(!1),[p,J0]=$.useState([]),[K0,k1]=$.useState(!1),[A1,U0]=$.useState([]),[Q1,X0]=$.useState([]),[s,y1]=$.useState(""),[t,W1]=$.useState(""),[e,h1]=$.useState(""),[i1,T1]=$.useState(!1),[B1,z1]=$.useState({}),[S1,Y0]=$.useState(""),[a1,G1]=$.useState(!1),[M1,p1]=$.useState(""),[u1,H1]=$.useState(!1),[O1,x1]=$.useState(""),[Z0,J1]=$.useState(!1),[c,L1]=$.useState(""),[K1,b1]=$.useState(""),[V1,c1]=$.useState(!1),[h,q0]=$.useState([]),[d1,Z]=$.useState(null),X=H&&H!=="unassigned"?`?project_id=${H}`:"",E1=$.useCallback(async()=>{try{let N=await R(`/api/triggers/providers${X}`);if(N.ok){let _=((await N.json()).providers||[]).filter((f)=>f.connected);if(F(_),_.length>0)V((f)=>{if(!f||!_.find((K)=>K.id===f))return _[0].id;return f})}}catch(N){console.error("Failed to fetch providers:",N)}},[R]),u=$.useCallback(async()=>{S(!0);try{let N=`provider=${Q}`,v=X?"&":"?",_=X?`/api/triggers${X}&${N}`:`/api/triggers?${N}`,f=await R(_);if(f.ok){let K=await f.json();T(K.triggers||[])}}catch(N){console.error("Failed to fetch triggers:",N)}S(!1)},[R,X,Q]),N1=$.useCallback(async()=>{try{let N=await R(`/api/subscriptions${X}`);if(N.ok){let v=await N.json();Y(v.subscriptions||[])}}catch(N){console.error("Failed to fetch subscriptions:",N)}},[R,X]),D1=$.useCallback(async()=>{try{let N=await R(`/api/agents${X}`);if(N.ok){let v=await N.json();q0(v.agents||[])}}catch(N){}},[R,X]);$.useEffect(()=>{E1(),u(),N1(),D1()},[E1,u,N1,D1]);let Q0=async(N)=>{G(!0);try{let v=`/api/triggers/types?provider=${Q}`;if(N)v+=`&toolkit_slugs=${N}`;if(H&&H!=="unassigned")v+=`&project_id=${H}`;let _=await R(v);if(_.ok){let f=await _.json();I(f.types||[])}else{let f=await _.json();Z(f.error||"Failed to fetch trigger types")}}catch(v){Z("Failed to fetch trigger types")}G(!1)},W0=async()=>{try{let N=await R(`/api/integrations/${Q}/connected${X}`);if(N.ok){let v=await N.json();z0((v.accounts||[]).filter((_)=>_.status==="active"))}}catch(N){}},B0=(N)=>{_1(N),I1(""),n1(""),P1({}),G0(""),v1(!0),W0()},C=Q==="agentdojo",M0=async()=>{q1(!0),W1(""),y1(""),h1(""),z1({}),Y0("");let N=async()=>{if(p.length>0)return;k1(!0);try{let f="/api/triggers/types?provider=agentdojo";if(H&&H!=="unassigned")f+=`&project_id=${H}`;let L=await(await R(f)).json();J0(L.types||[])}catch(f){console.error("Failed to load trigger types:",f)}k1(!1)},v=async()=>{try{let f=`/api/integrations/agentdojo/connected${X}`,q=((await(await R(f)).json()).accounts||[]).filter((E)=>E.status==="active");U0(q)}catch(f){console.error("Failed to load connected accounts:",f)}},_=async()=>{if(Q1.length>0)return;try{let f=`/api/integrations/agentdojo/apps${X}`,L=await(await R(f)).json();X0((L.apps||[]).map((q)=>({id:q.id,name:q.name,slug:q.slug,logo:q.logo})))}catch(f){console.error("Failed to load apps:",f)}};await Promise.all([N(),v(),_()])},O0=async()=>{let N=p.find((_)=>_.slug===t),v=U1;if(!N||!e||!v)return;T1(!0),Z(null);try{let _=h.find((F0)=>F0.id===e),f="provider=agentdojo",K=X?`/api/triggers${X}&provider=agentdojo`:"/api/triggers?provider=agentdojo",L={callback_url:`${window.location.origin}/api/webhooks/agentdojo`,title:`${N.name} → ${_?.name||"Agent"}`,server:N.toolkit_slug,agent_id:e,...B1},q=await R(K,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:N.slug,connectedAccountId:v.id,config:L})}),E=await q.json();if(!q.ok)Z(E.error||"Failed to create subscription");else q1(!1),u()}catch(_){Z(_.message||"Failed to create subscription")}T1(!1)},L0=async()=>{if(!B)return;if(C){if(!r||!m1)return;R1(!0),Z(null);try{let N=h.find((q)=>q.id===r),v=window.location.origin,_=`provider=${Q}`,f=X?`/api/triggers${X}&${_}`:`/api/triggers?${_}`,K=await R(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:B.slug,connectedAccountId:m1.id,config:{callback_url:`${v}/api/webhooks/agentdojo`,title:`${B.name} → ${N?.name||"Agent"}`,server:B.toolkit_slug,agent_id:r,...Z1}})}),L=await K.json();if(!K.ok)Z(L.error||"Failed to create subscription");else v1(!1),_1(null),u()}catch(N){Z(N.message||"Failed to create subscription")}R1(!1);return}if(!$1)return;R1(!0),Z(null);try{let N=`provider=${Q}`,v=X?`/api/triggers${X}&${N}`:`/api/triggers?${N}`,_=await R(v,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:B.slug,connectedAccountId:$1})}),f=await _.json();if(!_.ok)Z(f.error||"Failed to create trigger");else v1(!1),_1(null),u()}catch(N){Z(N.message||"Failed to create trigger")}R1(!1)},g1=async(N,v)=>{let _=v==="active"?"disable":"enable";try{let f=X?`&provider=${Q}`:`?provider=${Q}`,K=await R(`/api/triggers/${N}/${_}${X}${f}`,{method:"POST"});if(K.ok)u();else{let L=await K.json();Z(L.error||`Failed to ${_} trigger`)}}catch(f){Z(`Failed to ${_} trigger`)}},j1=async(N)=>{try{let v=X?`&provider=${Q}`:`?provider=${Q}`,_=await R(`/api/triggers/${N}${X}${v}`,{method:"DELETE"});if(_.ok)u();else{let f=await _.json();Z(f.error||"Failed to delete trigger")}}catch(v){Z("Failed to delete trigger")}},b0=async()=>{if(!c||!K1)return;let N=W.find((v)=>v.id===c);if(!N)return;c1(!0),Z(null);try{let v=await R("/api/subscriptions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({trigger_slug:N.trigger_slug,trigger_instance_id:N.id,agent_id:K1,provider:Q,project_id:H&&H!=="unassigned"?H:null,public_url:window.location.origin})}),_=await v.json();if(!v.ok)Z(_.error||"Failed to create subscription");else J1(!1),L1(""),b1(""),N1()}catch(v){Z(v.message||"Failed to create subscription")}c1(!1)},w0=async(N)=>{let v=N.enabled?"disable":"enable";try{if((await R(`/api/subscriptions/${N.id}/${v}`,{method:"POST"})).ok)N1()}catch(_){Z(`Failed to ${v} subscription`)}},C0=async(N)=>{try{if((await R(`/api/subscriptions/${N}`,{method:"DELETE"})).ok)N1()}catch(v){Z("Failed to delete subscription")}},w1=y.filter((N)=>{if(!o)return!0;let v=o.toLowerCase();return N.name.toLowerCase().includes(v)||N.slug.toLowerCase().includes(v)||N.description.toLowerCase().includes(v)}),o1=(N,v)=>{if(!v||N.length===0)return null;let _=v.toLowerCase().replace(/[-_]/g," "),f=N.find((q)=>q.appId?.toLowerCase()===v.toLowerCase()||q.appName?.toLowerCase()===v.toLowerCase());if(f)return f;let K=N.find((q)=>q.appId?.toLowerCase().includes(_)||q.appName?.toLowerCase().replace(/[-_]/g," ").includes(_)||_.includes(q.appId?.toLowerCase()||"")||_.includes(q.appName?.toLowerCase().replace(/[-_]/g," ")||""));if(K)return K;let L=_.split(/\s+/);return N.find((q)=>{let E=(q.appName||"").toLowerCase().replace(/[-_]/g," ").split(/\s+/);return L[0]&&E[0]&&L[0]===E[0]})||null},M=p.find((N)=>N.slug===t),r1=M?o1(A1,M.toolkit_slug):null,U1=S1?A1.find((N)=>N.id===S1)||r1:r1,s1=B&&C?o1(f1,B.toolkit_slug):null,m1=l1?f1.find((N)=>N.id===l1)||s1:s1,t1=$.default.useMemo(()=>{let N=new Map;for(let _ of Q1)if(_.logo)N.set(_.slug,_.logo);let v=new Map;for(let _ of p){let f=v.get(_.toolkit_slug);if(f)f.count++;else{let K=N.get(_.toolkit_slug)||_.logo||null;v.set(_.toolkit_slug,{slug:_.toolkit_slug,name:_.toolkit_name,logo:K,count:1})}}return Array.from(v.values()).sort((_,f)=>_.name.localeCompare(f.name))},[p,Q1]),e1=s?p.filter((N)=>N.toolkit_slug===s):[],d=t1.find((N)=>N.slug===s),N0=new Map(h.map((N)=>[N.id,N]));if(J.length===0&&!A)return m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-8 text-center",children:[m.jsxDEV("p",{className:"text-[#666]",children:"No trigger providers configured."},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-sm text-[#555] mt-1",children:"Add API keys for Composio or AgentDojo in Settings to enable triggers."},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return m.jsxDEV("div",{className:"space-y-6",children:[d1&&m.jsxDEV("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 border border-red-500/20 rounded-lg flex items-center justify-between",children:[m.jsxDEV("span",{children:d1},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>Z(null),className:"text-red-400 hover:text-red-300",children:"x"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J.length>1&&m.jsxDEV("div",{className:"flex items-center gap-2",children:[m.jsxDEV("span",{className:"text-xs text-[#666]",children:"Provider:"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex gap-1 bg-[#111] border border-[#1a1a1a] rounded-lg p-0.5",children:J.map((N)=>m.jsxDEV("button",{onClick:()=>{V(N.id),I([]),k(""),F1("")},className:`px-3 py-1 rounded text-xs font-medium transition ${Q===N.id?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:N.name},N.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!C&&m.jsxDEV("section",{children:[m.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888]",children:["Subscriptions (",l.length,")"]},void 0,!0,void 0,this),m.jsxDEV("button",{onClick:()=>J1(!0),className:"text-xs bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition",children:"+ Add Subscription"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l.length===0?m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No subscriptions yet. Add one to route trigger events to an agent."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-2",children:l.map((N)=>{let v=N0.get(N.agent_id);return m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[m.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${N.enabled?"bg-green-400":"bg-[#666]"}`},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:[N.trigger_slug.replace(/_/g," "),m.jsxDEV("span",{className:"text-[#555] mx-1.5",children:"→"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#f97316]",children:v?.name||"Unknown Agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:N.trigger_instance_id?`Instance: ${N.trigger_instance_id.slice(0,12)}...`:"All instances"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxDEV("button",{onClick:()=>w0(N),className:`text-xs px-3 py-1 rounded transition ${N.enabled?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:N.enabled?"Disable":"Enable"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>C0(N.id),className:"text-xs text-[#666] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},N.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!C&&m.jsxDEV("section",{children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:["Trigger Instances (",W.length,")"]},void 0,!0,void 0,this),A?m.jsxDEV("div",{className:"text-center py-6 text-[#666] text-sm",children:"Loading triggers..."},void 0,!1,void 0,this):W.length===0?m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No trigger instances. Browse trigger types below to create one."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-2",children:W.map((N)=>m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[m.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${N.status==="active"?"bg-green-400":"bg-[#666]"}`},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:N.trigger_slug.replace(/_/g," ")},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:["ID: ",N.id.slice(0,12),"... | Created: ",new Date(N.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxDEV("button",{onClick:()=>g1(N.id,N.status),className:`text-xs px-3 py-1 rounded transition ${N.status==="active"?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:N.status==="active"?"Disable":"Enable"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>j1(N.id),className:"text-xs text-[#666] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},N.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&m.jsxDEV("section",{children:[m.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888]",children:["Active Subscriptions (",W.length,")"]},void 0,!0,void 0,this),m.jsxDEV("button",{onClick:M0,className:"text-xs bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition",children:"+ Add Subscription"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A?m.jsxDEV("div",{className:"text-center py-6 text-[#666] text-sm",children:"Loading subscriptions..."},void 0,!1,void 0,this):W.length===0?m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center text-[#666] text-sm",children:"No active subscriptions. Browse trigger types below to create one."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-2",children:W.map((N)=>{let v=l.find((f)=>f.trigger_instance_id===N.id),_=v?N0.get(v.agent_id):null;return m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 flex items-center gap-3",children:[m.jsxDEV("div",{className:`w-2 h-2 rounded-full flex-shrink-0 ${N.status==="active"?"bg-green-400":"bg-[#666]"}`},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:[N.config?.title||N.trigger_slug.replace(/_/g," "),_&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("span",{className:"text-[#555] mx-1.5",children:"→"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#f97316]",children:_.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:[N.config?.server&&m.jsxDEV("span",{children:[String(N.config.server)," | "]},void 0,!0,void 0,this),"ID: ",String(N.id).slice(0,8)," | Created: ",new Date(N.created_at).toLocaleDateString()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxDEV("button",{onClick:()=>g1(N.id,N.status),className:`text-xs px-3 py-1 rounded transition ${N.status==="active"?"bg-yellow-500/10 text-yellow-400 hover:bg-yellow-500/20":"bg-green-500/10 text-green-400 hover:bg-green-500/20"}`,children:N.status==="active"?"Disable":"Enable"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>j1(N.id),className:"text-xs text-[#666] hover:text-red-400 transition px-2",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},N.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("section",{children:[m.jsxDEV("h3",{className:"text-sm font-medium text-[#888] mb-3",children:"Browse Trigger Types"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mb-3",children:[m.jsxDEV("input",{type:"text",value:b,onChange:(N)=>k(N.target.value),placeholder:"Toolkit filter (e.g. github, gmail, slack)",className:"flex-1 bg-[#111] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:()=>Q0(b||void 0),disabled:a,className:"text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-4 py-2 rounded transition disabled:opacity-50",children:a?"Loading...":"Browse"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y.length>0&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("input",{type:"text",value:o,onChange:(N)=>F1(N.target.value),placeholder:"Search trigger types...",className:"w-full bg-[#111] border border-[#333] rounded px-3 py-2 text-sm mb-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:w1.slice(0,30).map((N)=>m.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] hover:border-[#333] rounded-lg p-3 transition",children:[m.jsxDEV("div",{className:"flex items-start gap-3",children:[N.logo?m.jsxDEV("img",{src:N.logo,alt:N.toolkit_name,className:"w-8 h-8 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):m.jsxDEV("div",{className:"w-8 h-8 rounded bg-[#1a1a1a] flex items-center justify-center text-xs flex-shrink-0",children:N.toolkit_name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"text-sm font-medium truncate",children:N.name},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#666]",children:N.toolkit_name},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-xs text-[#555] mt-1 line-clamp-2",children:N.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("button",{onClick:()=>B0(N),className:"w-full mt-3 text-xs bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition",children:C?"Subscribe":"Create Trigger"},void 0,!1,void 0,this)]},N.slug,!0,void 0,this))},void 0,!1,void 0,this),w1.length>30&&m.jsxDEV("p",{className:"text-xs text-[#555] mt-3 text-center",children:["Showing first 30 of ",w1.length," types. Use search to filter."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),R0&&B&&m.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:m.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-md mx-4",children:[m.jsxDEV("h3",{className:"font-medium mb-1",children:C?"Create Subscription":"Create Trigger"},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-xs text-[#666] mb-4",children:[B.name,B.toolkit_name&&m.jsxDEV("span",{className:"text-[#555]",children:[" (",B.toolkit_name,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"space-y-4",children:[!C&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),f1.length===0?m.jsxDEV("div",{className:"text-xs text-[#666] bg-[#0a0a0a] rounded p-3",children:"No connected accounts available. Connect an app first in the Integrations tab."},void 0,!1,void 0,this):m.jsxDEV(x,{value:$1,onChange:I1,placeholder:"Select account...",options:f1.map((N)=>({value:N.id,label:`${N.appName} (${N.id.slice(0,8)}...)`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Route to Agent"},void 0,!1,void 0,this),h.length===0?m.jsxDEV("div",{className:"text-xs text-[#666] bg-[#0a0a0a] rounded p-3",children:"No agents available. Create an agent first."},void 0,!1,void 0,this):m.jsxDEV(x,{value:r,onChange:n1,placeholder:"Select agent...",options:h.map((N)=>({value:N.id,label:`${N.name} (${N.status})`}))},void 0,!1,void 0,this),m.jsxDEV("div",{className:"mt-3",children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),m1?m.jsxDEV("div",{className:"text-xs text-green-400 bg-green-500/10 border border-green-500/20 rounded p-3",children:["Connected: ",m1.appName]},void 0,!0,void 0,this):m.jsxDEV("div",{className:"text-xs text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded p-3",children:["No connected account for ",B?.toolkit_name||"this app",". Connect it first in the Integrations tab."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),B.config_schema&&Object.keys(B.config_schema.properties||{}).length>0&&m.jsxDEV("div",{className:"mt-3",children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Configuration"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"space-y-2",children:Object.entries(B.config_schema.properties||{}).map(([N,v])=>{let _=(B.config_schema.required||[]).includes(N);return m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-[11px] text-[#888] mb-1",children:[v.title||N,_&&m.jsxDEV("span",{className:"text-red-400 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("input",{type:"text",value:Z1[N]||"",onChange:(f)=>P1((K)=>({...K,[N]:f.target.value})),placeholder:v.description||`Enter ${v.title||N}...`,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},N,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mt-4",children:[m.jsxDEV("button",{onClick:()=>{v1(!1),_1(null)},className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:L0,disabled:C?!r||!m1||Y1||B?.config_schema&&(B.config_schema.required||[]).some((N)=>!Z1[N]?.trim()):!$1||Y1,className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:Y1?"Creating...":C?"Subscribe":"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Z0&&m.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:m.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-md mx-4",children:[m.jsxDEV("h3",{className:"font-medium mb-1",children:"Route Trigger to Agent"},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-xs text-[#666] mb-4",children:W.length===0?"No trigger instances yet. Create one first from the Browse section below.":"Select a trigger instance and the agent that should handle its events."},void 0,!1,void 0,this),W.length>0?m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:"space-y-4",children:[m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Trigger Instance"},void 0,!1,void 0,this),m.jsxDEV(x,{value:c,onChange:L1,placeholder:"Select trigger...",options:W.map((N)=>({value:N.id,label:`${N.trigger_slug.replace(/_/g," ")}`}))},void 0,!1,void 0,this),c&&m.jsxDEV("div",{className:"text-xs text-[#555] mt-1 font-mono",children:["ID: ",c.slice(0,16),"..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Target Agent"},void 0,!1,void 0,this),m.jsxDEV(x,{value:K1,onChange:b1,placeholder:"Select agent...",options:h.map((N)=>({value:N.id,label:`${N.name} (${N.status})`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mt-5",children:[m.jsxDEV("button",{onClick:()=>{J1(!1),L1(""),b1("")},className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:b0,disabled:!c||!K1||V1,className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:V1?"Adding...":"Add"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):m.jsxDEV("div",{className:"flex gap-2 mt-4",children:m.jsxDEV("button",{onClick:()=>J1(!1),className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Close"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),H0&&m.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:m.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg p-6 w-full max-w-lg mx-4",children:[m.jsxDEV("h3",{className:"font-medium mb-1",children:"Add Subscription"},void 0,!1,void 0,this),m.jsxDEV("p",{className:"text-xs text-[#666] mb-4",children:"Select an app and trigger, then route it to an agent."},void 0,!1,void 0,this),K0?m.jsxDEV("div",{className:"text-center py-8 text-[#666] text-sm",children:"Loading..."},void 0,!1,void 0,this):p.length===0?m.jsxDEV("div",{className:"text-center py-8 text-[#666] text-sm",children:"No triggers available. Connect an app first in the Integrations tab."},void 0,!1,void 0,this):m.jsxDEV("div",{className:"space-y-4",children:[m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"App"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"relative",children:[m.jsxDEV("button",{onClick:()=>{G1(!a1),H1(!1),p1("")},className:"w-full flex items-center gap-2 bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm text-left hover:border-[#555] transition",children:[d?m.jsxDEV(m.Fragment,{children:[d.logo?m.jsxDEV("img",{src:d.logo,alt:"",className:"w-5 h-5 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):m.jsxDEV("div",{className:"w-5 h-5 rounded bg-[#1a1a1a] flex items-center justify-center text-[10px] flex-shrink-0",children:d.name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"flex-1 truncate",children:d.name},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[10px] text-[#666]",children:[d.count," triggers"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):m.jsxDEV("span",{className:"text-[#666] flex-1",children:"Select app..."},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#666] text-xs ml-1",children:"▾"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a1&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:"fixed inset-0 z-10",onClick:()=>G1(!1)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[#0a0a0a] border border-[#333] rounded-lg shadow-xl z-20 max-h-64 flex flex-col",children:[m.jsxDEV("div",{className:"p-2 border-b border-[#1a1a1a] flex-shrink-0",children:m.jsxDEV("input",{type:"text",value:M1,onChange:(N)=>p1(N.target.value),placeholder:"Search apps...",className:"w-full bg-[#111] border border-[#333] rounded px-2 py-1.5 text-sm focus:outline-none focus:border-[#f97316]",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"overflow-y-auto flex-1",children:t1.filter((N)=>{if(!M1)return!0;let v=M1.toLowerCase();return N.name.toLowerCase().includes(v)||N.slug.toLowerCase().includes(v)}).map((N)=>m.jsxDEV("button",{onClick:()=>{y1(N.slug),W1(""),z1({}),G1(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition hover:bg-[#1a1a1a] ${s===N.slug?"bg-[#1a1a1a] text-[#f97316]":""}`,children:[N.logo?m.jsxDEV("img",{src:N.logo,alt:"",className:"w-5 h-5 rounded object-contain flex-shrink-0"},void 0,!1,void 0,this):m.jsxDEV("div",{className:"w-5 h-5 rounded bg-[#1a1a1a] flex items-center justify-center text-[10px] flex-shrink-0",children:N.name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),m.jsxDEV("span",{className:"flex-1 truncate",children:N.name},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[10px] text-[#666]",children:N.count},void 0,!1,void 0,this)]},N.slug,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),s&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Trigger"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"relative",children:[m.jsxDEV("button",{onClick:()=>{H1(!u1),G1(!1),x1("")},className:"w-full flex items-center gap-2 bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm text-left hover:border-[#555] transition",children:[M?m.jsxDEV(m.Fragment,{children:[m.jsxDEV("span",{className:"flex-1 truncate",children:M.name},void 0,!1,void 0,this),m.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 ${M.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:M.type},void 0,!1,void 0,this)]},void 0,!0,void 0,this):m.jsxDEV("span",{className:"text-[#666] flex-1",children:"Select trigger..."},void 0,!1,void 0,this),m.jsxDEV("span",{className:"text-[#666] text-xs ml-1",children:"▾"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u1&&m.jsxDEV(m.Fragment,{children:[m.jsxDEV("div",{className:"fixed inset-0 z-10",onClick:()=>H1(!1)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"absolute left-0 right-0 top-full mt-1 bg-[#0a0a0a] border border-[#333] rounded-lg shadow-xl z-20 max-h-64 flex flex-col",children:[e1.length>3&&m.jsxDEV("div",{className:"p-2 border-b border-[#1a1a1a] flex-shrink-0",children:m.jsxDEV("input",{type:"text",value:O1,onChange:(N)=>x1(N.target.value),placeholder:"Search triggers...",className:"w-full bg-[#111] border border-[#333] rounded px-2 py-1.5 text-sm focus:outline-none focus:border-[#f97316]",autoFocus:!0},void 0,!1,void 0,this)},void 0,!1,void 0,this),m.jsxDEV("div",{className:"overflow-y-auto flex-1",children:e1.filter((N)=>{if(!O1)return!0;let v=O1.toLowerCase();return N.name.toLowerCase().includes(v)||N.slug.toLowerCase().includes(v)||N.description.toLowerCase().includes(v)}).map((N)=>m.jsxDEV("button",{onClick:()=>{W1(N.slug),z1({}),H1(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition hover:bg-[#1a1a1a] ${t===N.slug?"bg-[#1a1a1a] text-[#f97316]":""}`,children:[m.jsxDEV("div",{className:"flex-1 min-w-0",children:[m.jsxDEV("div",{className:"truncate",children:N.name},void 0,!1,void 0,this),m.jsxDEV("div",{className:"text-[10px] text-[#666] truncate",children:N.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 ${N.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:N.type},void 0,!1,void 0,this)]},N.slug,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Connected Account"},void 0,!1,void 0,this),U1?m.jsxDEV("div",{className:"text-xs text-green-400 bg-green-500/10 border border-green-500/20 rounded p-3",children:["Connected: ",U1.appName]},void 0,!0,void 0,this):m.jsxDEV("div",{className:"text-xs text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded p-3",children:["No connected account for ",M?.toolkit_name||"this app",". Connect it first in the Integrations tab."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),M&&M.config_schema&&Object.keys(M.config_schema.properties||{}).length>0&&m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Configuration"},void 0,!1,void 0,this),m.jsxDEV("div",{className:"space-y-2",children:Object.entries(M.config_schema.properties||{}).map(([N,v])=>{let _=(M.config_schema.required||[]).includes(N);return m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-[11px] text-[#888] mb-1",children:[v.title||N,_&&m.jsxDEV("span",{className:"text-red-400 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("input",{type:"text",value:B1[N]||"",onChange:(f)=>z1((K)=>({...K,[N]:f.target.value})),placeholder:v.description||`Enter ${v.title||N}...`,className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},N,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{children:[m.jsxDEV("label",{className:"block text-xs text-[#888] mb-1.5",children:"Target Agent"},void 0,!1,void 0,this),h.length===0?m.jsxDEV("div",{className:"text-xs text-[#666] bg-[#0a0a0a] rounded p-3",children:"No agents available. Create an agent first."},void 0,!1,void 0,this):m.jsxDEV(x,{value:e,onChange:h1,placeholder:"Select agent...",options:h.map((N)=>({value:N.id,label:`${N.name} (${N.status})`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.jsxDEV("div",{className:"flex gap-2 mt-5",children:[m.jsxDEV("button",{onClick:()=>q1(!1),className:"flex-1 text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] px-4 py-2 rounded transition",children:"Cancel"},void 0,!1,void 0,this),m.jsxDEV("button",{onClick:O0,disabled:!t||!e||!U1||i1||M?.config_schema&&(M.config_schema.required||[]).some((N)=>!B1[N]?.trim()),className:"flex-1 text-sm bg-[#f97316] hover:bg-[#ea580c] text-white px-4 py-2 rounded transition disabled:opacity-50",children:i1?"Creating...":"Subscribe"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var P=O(X1(),1);var z=O(n(),1);function f0(){let{authFetch:R}=g(),{currentProjectId:H}=j(),J=H&&H!=="unassigned"?H:null,F=J?`?project_id=${J}`:"",[Q,V]=P.useState([]),[W,T]=P.useState("");P.useEffect(()=>{R(`/api/triggers/providers${F}`).then((G)=>G.json()).then((G)=>{let b=(G.providers||[]).filter((k)=>k.connected);if(V(b),b.length>0&&!b.find((k)=>k.id===W))T(b[0].id)}).catch(()=>{})},[R]);let[A,S]=P.useState(null),[l,Y]=P.useState([]),[y,I]=P.useState(!1),a=P.useCallback(async(G)=>{S(G),I(!0);try{let b=`/api/triggers/types?provider=${W}&toolkit_slugs=${G}`;if(J)b+=`&project_id=${J}`;let k=await R(b);if(k.ok){let o=await k.json();Y(o.types||[])}}catch(b){console.error("Failed to fetch trigger types:",b)}I(!1)},[R,J,W]);return z.jsxDEV("div",{children:[z.jsxDEV("p",{className:"text-sm text-[#666] mb-4",children:"Connect external apps via OAuth or API Key. Connected apps can be used for triggers and MCP integrations."},void 0,!1,void 0,this),Q.length>1&&z.jsxDEV("div",{className:"flex items-center gap-2 mb-4",children:[z.jsxDEV("span",{className:"text-xs text-[#666]",children:"Provider:"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex gap-1 bg-[#111] border border-[#1a1a1a] rounded-lg p-0.5",children:Q.map((G)=>z.jsxDEV("button",{onClick:()=>T(G.id),className:`px-3 py-1 rounded text-xs font-medium transition ${W===G.id?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:G.name},G.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q.length===0?z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-8 text-center",children:[z.jsxDEV("p",{className:"text-[#666]",children:"No integration providers configured."},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#555] mt-1",children:"Add API keys for Composio or AgentDojo in Settings."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV(_0,{providerId:W,projectId:J,hideMcpConfig:!0,onBrowseTriggers:a},void 0,!1,void 0,this),A&&z.jsxDEV("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:z.jsxDEV("div",{className:"bg-[#111] border border-[#333] rounded-lg w-full max-w-2xl mx-4 max-h-[80vh] flex flex-col",children:[z.jsxDEV("div",{className:"p-4 border-b border-[#1a1a1a] flex items-center justify-between",children:[z.jsxDEV("div",{children:[z.jsxDEV("h3",{className:"font-medium",children:"Trigger Types"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#666]",children:A},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:()=>{S(null),Y([])},className:"text-[#666] hover:text-white transition text-lg px-2",children:"x"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex-1 overflow-auto p-4",children:y?z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"Loading trigger types..."},void 0,!1,void 0,this):l.length===0?z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"No trigger types available for this app."},void 0,!1,void 0,this):z.jsxDEV("div",{className:"space-y-2",children:l.map((G)=>z.jsxDEV("div",{className:"bg-[#0a0a0a] border border-[#1a1a1a] rounded-lg p-3",children:z.jsxDEV("div",{className:"flex items-start gap-3",children:[G.logo?z.jsxDEV("img",{src:G.logo,alt:G.toolkit_name,className:"w-6 h-6 rounded object-contain flex-shrink-0 mt-0.5"},void 0,!1,void 0,this):z.jsxDEV("div",{className:"w-6 h-6 rounded bg-[#1a1a1a] flex items-center justify-center text-[10px] flex-shrink-0 mt-0.5",children:G.toolkit_name?.[0]?.toUpperCase()||"?"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"text-sm font-medium",children:G.name},void 0,!1,void 0,this),z.jsxDEV("div",{className:"text-xs text-[#666] mt-0.5",children:G.description},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2 mt-1.5",children:[z.jsxDEV("span",{className:"text-[10px] bg-[#1a1a1a] text-[#555] px-1.5 py-0.5 rounded font-mono",children:G.slug},void 0,!1,void 0,this),z.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${G.type==="webhook"?"bg-blue-500/10 text-blue-400":"bg-yellow-500/10 text-yellow-400"}`,children:G.type},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},G.slug,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var w=O(n(),1);function JN(){let[R,H]=$0.useState("overview");return w.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:w.jsxDEV("div",{className:"max-w-6xl",children:[w.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:w.jsxDEV("div",{children:[w.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"Connections"},void 0,!1,void 0,this),w.jsxDEV("p",{className:"text-[#666]",children:"Manage external app connections, triggers, and webhooks."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),w.jsxDEV("div",{className:"flex gap-1 mb-6 bg-[#111] border border-[#1a1a1a] rounded-lg p-1 w-fit",children:[{id:"overview",label:"Overview"},{id:"triggers",label:"Triggers"},{id:"integrations",label:"Integrations"}].map((F)=>w.jsxDEV("button",{onClick:()=>H(F.id),className:`px-4 py-2 rounded text-sm font-medium transition ${R===F.id?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:F.label},F.id,!1,void 0,this))},void 0,!1,void 0,this),R==="overview"&&w.jsxDEV(m0,{},void 0,!1,void 0,this),R==="triggers"&&w.jsxDEV(v0,{},void 0,!1,void 0,this),R==="integrations"&&w.jsxDEV(f0,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}
|
|
2
|
-
export{I0 as a,JN as b};
|
|
3
|
-
|
|
4
|
-
//# debugId=B89E2F0AA55E409E64756E2164756E21
|
package/dist/App.2yjrh32f.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./App.myxqcj9x.js";import{t as Oz}from"./App.7fb3e7mp.js";import{O as Jz,P as o}from"./App.mc7xf85h.js";import{V as t}from"./App.7sy3wq8c.js";import{$ as Qz,X as a,aa as zz,ja as c,ma as Gz}from"./App.3qw8nben.js";var J=a(Qz(),1);var z=a(zz(),1);function Mz(){let{authFetch:G}=c(),{projects:$,currentProjectId:H}=Gz(),[K,w]=J.useState([]),[X,B]=J.useState(!0),[q,F]=J.useState(!1),[U,T]=J.useState(null),[M,L]=J.useState(null),[Q,k]=J.useState("servers"),{confirm:y,ConfirmDialog:f}=Jz(),Y=$.length>0,A=async()=>{try{let b=await(await G("/api/mcp/servers")).json();w(b.servers||[])}catch(W){console.error("Failed to fetch MCP servers:",W)}B(!1)};J.useEffect(()=>{A()},[G]);let Z=K.filter((W)=>{if(!H)return!0;if(H==="unassigned")return W.project_id===null;return W.project_id===null||W.project_id===H}),S=async(W)=>{try{await G(`/api/mcp/servers/${W}/start`,{method:"POST"}),A()}catch(b){console.error("Failed to start server:",b)}},I=async(W)=>{try{await G(`/api/mcp/servers/${W}/stop`,{method:"POST"}),A()}catch(b){console.error("Failed to stop server:",b)}},p=async(W)=>{if(!await y("Delete this MCP server?",{confirmText:"Delete",title:"Delete Server"}))return;try{if(await G(`/api/mcp/servers/${W}`,{method:"DELETE"}),M?.id===W)L(null);A()}catch(C){console.error("Failed to delete server:",C)}},u=async(W,b)=>{try{await G(`/api/mcp/servers/${W}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:b})}),A()}catch(C){console.error("Failed to rename server:",C)}},i=async(W,b)=>{try{await G(`/api/mcp/servers/${W}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),A()}catch(C){throw console.error("Failed to update server:",C),C}};return z.jsxDEV(z.Fragment,{children:[f,z.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:[z.jsxDEV("div",{className:"max-w-6xl",children:[z.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[z.jsxDEV("div",{children:[z.jsxDEV("h1",{className:"text-2xl font-semibold mb-1",children:"MCP Servers"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-[#666]",children:"Manage Model Context Protocol servers for tool integrations."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q==="servers"&&z.jsxDEV("button",{onClick:()=>F(!0),className:"bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-2 rounded font-medium transition",children:"+ Add Server"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex gap-1 mb-6 bg-[#111] border border-[#1a1a1a] rounded-lg p-1 w-fit",children:[z.jsxDEV("button",{onClick:()=>k("servers"),className:`px-4 py-2 rounded text-sm font-medium transition ${Q==="servers"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"My Servers"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>k("hosted"),className:`px-4 py-2 rounded text-sm font-medium transition ${Q==="hosted"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"Hosted Services"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>k("registry"),className:`px-4 py-2 rounded text-sm font-medium transition ${Q==="registry"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"Browse Registry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q==="servers"&&z.jsxDEV(z.Fragment,{children:[X&&z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"Loading..."},void 0,!1,void 0,this),!X&&Z.length===0&&K.length===0&&z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-8 text-center",children:[z.jsxDEV(Oz,{className:"w-12 h-12 text-[#333] mx-auto mb-4"},void 0,!1,void 0,this),z.jsxDEV("h3",{className:"text-lg font-medium mb-2",children:"No MCP servers configured"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-[#666] mb-6 max-w-md mx-auto",children:"MCP servers extend your agents with tools like file access, web browsing, database connections, and more."},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex gap-3 justify-center",children:[z.jsxDEV("button",{onClick:()=>F(!0),className:"bg-[#f97316] hover:bg-[#fb923c] text-black px-4 py-2 rounded font-medium transition",children:"Add Manually"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>k("registry"),className:"border border-[#333] hover:border-[#666] px-4 py-2 rounded font-medium transition",children:"Browse Registry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!X&&Z.length===0&&K.length>0&&z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-6 text-center",children:z.jsxDEV("p",{className:"text-[#666]",children:"No servers match this filter."},void 0,!1,void 0,this)},void 0,!1,void 0,this),!X&&Z.length>0&&z.jsxDEV("div",{className:"flex gap-6",children:[z.jsxDEV("div",{className:`space-y-3 ${M?"w-1/2":"w-full"}`,children:Z.map((W)=>{let C=W.type==="http"&&W.url||W.status==="running",h=Y&&W.project_id?$.find((v)=>v.id===W.project_id):null;return z.jsxDEV(Wz,{server:W,project:h,selected:M?.id===W.id,onSelect:()=>L(C?W:null),onStart:()=>S(W.id),onStop:()=>I(W.id),onDelete:()=>p(W.id),onEdit:async()=>{try{let D=await(await G(`/api/mcp/servers/${W.id}`)).json();T(D.server||W)}catch{T(W)}}},W.id,!1,void 0,this)})},void 0,!1,void 0,this),M&&z.jsxDEV("div",{className:"w-1/2",children:z.jsxDEV(Xz,{server:M,onClose:()=>L(null)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Q==="hosted"&&z.jsxDEV(_z,{onServerAdded:A,projectId:H},void 0,!1,void 0,this),Q==="registry"&&z.jsxDEV(Zz,{onInstall:(W)=>{A(),k("servers")}},void 0,!1,void 0,this),Q==="servers"&&z.jsxDEV("div",{className:"mt-8 p-4 bg-[#111] border border-[#1a1a1a] rounded-lg",children:[z.jsxDEV("h3",{className:"font-medium mb-2",children:"Quick Start"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#666] mb-3",children:"Add an MCP server by providing its npm package name. For example:"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex flex-wrap gap-2",children:[{name:"filesystem",pkg:"@modelcontextprotocol/server-filesystem"},{name:"fetch",pkg:"@modelcontextprotocol/server-fetch"},{name:"memory",pkg:"@modelcontextprotocol/server-memory"}].map((W)=>z.jsxDEV("code",{className:"text-xs bg-[#0a0a0a] px-2 py-1 rounded",children:W.pkg},W.name,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q&&z.jsxDEV(Bz,{onClose:()=>F(!1),onAdded:()=>{F(!1),A()},projects:Y?$:void 0,defaultProjectId:H&&H!=="unassigned"?H:null},void 0,!1,void 0,this),U&&z.jsxDEV(Uz,{server:U,projects:Y?$:void 0,onClose:()=>T(null),onSaved:()=>{T(null),A()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Wz({server:G,project:$,selected:H,onSelect:K,onStart:w,onStop:X,onDelete:B,onEdit:q}){let F=G.type==="http"&&G.url,U=F||G.status==="running",T=()=>{if(F)return`${G.source||"remote"} • http`;return`${G.type} • ${G.package||G.command||"custom"}${G.status==="running"&&G.port?` • :${G.port}`:""}`},M=()=>{if($)return z.jsxDEV("span",{className:"text-xs px-1.5 py-0.5 rounded",style:{backgroundColor:`${$.color}20`,color:$.color},children:$.name},void 0,!1,void 0,this);if(G.project_id===null)return z.jsxDEV("span",{className:"text-xs text-[#666] bg-[#1a1a1a] px-1.5 py-0.5 rounded",children:"Global"},void 0,!1,void 0,this);return null};return z.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-4 cursor-pointer transition ${H?"border-[#f97316]":"border-[#1a1a1a] hover:border-[#333]"}`,onClick:U?K:void 0,children:z.jsxDEV("div",{className:"flex items-center justify-between",children:[z.jsxDEV("div",{className:"flex items-center gap-3",children:[z.jsxDEV("div",{className:`w-2 h-2 rounded-full ${U?"bg-green-400":"bg-[#444]"}`},void 0,!1,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("h3",{className:"font-medium",children:G.name},void 0,!1,void 0,this),M()]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#666]",children:T()},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("button",{onClick:(L)=>{L.stopPropagation(),q()},className:"text-sm text-[#666] hover:text-[#888] px-3 py-1 transition",title:"Edit server settings",children:"Edit"},void 0,!1,void 0,this),F?z.jsxDEV("button",{onClick:(L)=>{L.stopPropagation(),B()},className:"text-sm text-[#666] hover:text-red-400 px-3 py-1 transition",children:"Remove"},void 0,!1,void 0,this):G.status==="running"?z.jsxDEV(z.Fragment,{children:[z.jsxDEV("button",{onClick:(L)=>{L.stopPropagation(),K()},className:"text-sm text-[#f97316] hover:text-[#fb923c] px-3 py-1 transition",children:"Tools"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:(L)=>{L.stopPropagation(),X()},className:"text-sm text-[#666] hover:text-red-400 px-3 py-1 transition",children:"Stop"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:(L)=>{L.stopPropagation(),B()},className:"text-sm text-[#666] hover:text-red-400 px-3 py-1 transition",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV(z.Fragment,{children:[z.jsxDEV("button",{onClick:(L)=>{L.stopPropagation(),w()},className:"text-sm text-[#666] hover:text-green-400 px-3 py-1 transition",children:"Start"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:(L)=>{L.stopPropagation(),B()},className:"text-sm text-[#666] hover:text-red-400 px-3 py-1 transition",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Xz({server:G,onClose:$}){let{authFetch:H}=c(),[K,w]=J.useState([]),[X,B]=J.useState(null),[q,F]=J.useState(!0),[U,T]=J.useState(null),[M,L]=J.useState(null);return J.useEffect(()=>{(async()=>{F(!0),T(null);try{let k=await H(`/api/mcp/servers/${G.id}/tools`),y=await k.json();if(!k.ok){T(y.error||"Failed to fetch tools");return}w(y.tools||[]),B(y.serverInfo||null)}catch(k){T(`Failed to fetch tools: ${k}`)}finally{F(!1)}})()},[G.id,H]),z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg overflow-hidden",children:[z.jsxDEV("div",{className:"p-4 border-b border-[#1a1a1a] flex items-center justify-between",children:[z.jsxDEV("div",{children:[z.jsxDEV("h3",{className:"font-medium",children:[G.name," Tools"]},void 0,!0,void 0,this),X&&z.jsxDEV("p",{className:"text-xs text-[#666]",children:[X.name," v",X.version]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:$,className:"text-[#666] hover:text-[#888] text-xl leading-none",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-4 max-h-[500px] overflow-auto",children:[q&&z.jsxDEV("p",{className:"text-[#666]",children:"Loading tools..."},void 0,!1,void 0,this),U&&z.jsxDEV("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 rounded",children:U},void 0,!1,void 0,this),!q&&!U&&K.length===0&&z.jsxDEV("p",{className:"text-[#666]",children:"No tools available from this server."},void 0,!1,void 0,this),!q&&!U&&K.length>0&&!M&&z.jsxDEV("div",{className:"space-y-2",children:K.map((Q)=>z.jsxDEV("button",{onClick:()=>L(Q),className:"w-full text-left p-3 bg-[#0a0a0a] hover:bg-[#1a1a1a] border border-[#222] hover:border-[#333] rounded transition",children:[z.jsxDEV("div",{className:"font-medium text-sm",children:Q.name},void 0,!1,void 0,this),Q.description&&z.jsxDEV("div",{className:"text-xs text-[#666] mt-1",children:Q.description},void 0,!1,void 0,this)]},Q.name,!0,void 0,this))},void 0,!1,void 0,this),M&&z.jsxDEV(Yz,{serverId:G.id,tool:M,onBack:()=>L(null)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Yz({serverId:G,tool:$,onBack:H}){let{authFetch:K}=c(),[w,X]=J.useState("{}"),[B,q]=J.useState(null),[F,U]=J.useState(null),[T,M]=J.useState(!1);J.useEffect(()=>{let Q=$.inputSchema;if(Q&&typeof Q==="object"&&"properties"in Q){let k=Q.properties,y={};for(let[f,Y]of Object.entries(k))if(Y.default!==void 0)y[f]=Y.default;else if(Y.type==="string")y[f]="";else if(Y.type==="number"||Y.type==="integer")y[f]=0;else if(Y.type==="boolean")y[f]=!1;else if(Y.type==="array")y[f]=[];else if(Y.type==="object")y[f]={};X(JSON.stringify(y,null,2))}},[$]);let L=async()=>{M(!0),U(null),q(null);try{let Q=JSON.parse(w),k=await K(`/api/mcp/servers/${G}/tools/${encodeURIComponent($.name)}/call`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({arguments:Q})}),y=await k.json();if(!k.ok){U(y.error||"Failed to call tool");return}q(y.result)}catch(Q){U(`Error: ${Q}`)}finally{M(!1)}};return z.jsxDEV("div",{className:"space-y-4",children:[z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("button",{onClick:H,className:"text-[#666] hover:text-[#888] text-sm",children:"← Back"},void 0,!1,void 0,this),z.jsxDEV("span",{className:"text-[#444]",children:"/"},void 0,!1,void 0,this),z.jsxDEV("span",{className:"font-medium",children:$.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.description&&z.jsxDEV("p",{className:"text-sm text-[#666]",children:$.description},void 0,!1,void 0,this),$.inputSchema&&z.jsxDEV("div",{className:"text-xs",children:z.jsxDEV("details",{className:"cursor-pointer",children:[z.jsxDEV("summary",{className:"text-[#666] hover:text-[#888]",children:"Input Schema"},void 0,!1,void 0,this),z.jsxDEV("pre",{className:"mt-2 p-2 bg-[#0a0a0a] rounded text-[#888] overflow-auto max-h-32",children:JSON.stringify($.inputSchema,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Arguments (JSON)"},void 0,!1,void 0,this),z.jsxDEV("textarea",{value:w,onChange:(Q)=>X(Q.target.value),className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 h-32 font-mono text-sm focus:outline-none focus:border-[#f97316] resize-none",placeholder:"{}"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:L,disabled:T,className:"w-full bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-4 py-2 rounded font-medium transition",children:T?"Calling...":"Call Tool"},void 0,!1,void 0,this),F&&z.jsxDEV("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 rounded",children:F},void 0,!1,void 0,this),B&&z.jsxDEV("div",{className:"space-y-2",children:[z.jsxDEV("div",{className:"text-sm text-[#666]",children:["Result ",B.isError&&z.jsxDEV("span",{className:"text-red-400",children:"(error)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:`p-3 rounded text-sm ${B.isError?"bg-red-500/10":"bg-green-500/10"}`,children:B.content.map((Q,k)=>z.jsxDEV("div",{className:"mb-2 last:mb-0",children:[Q.type==="text"&&z.jsxDEV("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:Q.text},void 0,!1,void 0,this),Q.type==="image"&&Q.data&&z.jsxDEV("img",{src:`data:${Q.mimeType||"image/png"};base64,${Q.data}`,alt:"Tool result",className:"max-w-full rounded"},void 0,!1,void 0,this)]},k,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Zz({onInstall:G}){let{authFetch:$}=c(),[H,K]=J.useState(""),[w,X]=J.useState([]),[B,q]=J.useState(!1),[F,U]=J.useState(!1),[T,M]=J.useState(null),[L,Q]=J.useState(null),k=async(Y)=>{q(!0),Q(null);try{let A=await $(`/api/mcp/registry?search=${encodeURIComponent(Y)}&limit=20`),Z=await A.json();if(!A.ok)Q(Z.error||"Failed to search registry"),X([]);else X(Z.servers||[])}catch(A){Q(`Failed to search: ${A}`),X([])}finally{q(!1),U(!0)}},y=(Y)=>{if(Y.preventDefault(),H.trim())k(H.trim())};J.useEffect(()=>{k("")},[]);let f=async(Y)=>{if(!Y.npmPackage){Q("This server does not have an npm package");return}M(Y.id),Q(null);try{let A=await $("/api/mcp/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Y.name,type:"npm",package:Y.npmPackage})});if(!A.ok){let Z=await A.json();Q(Z.error||"Failed to add server");return}G(Y)}catch(A){Q(`Failed to add server: ${A}`)}finally{M(null)}};return z.jsxDEV("div",{className:"space-y-6",children:[z.jsxDEV("form",{onSubmit:y,className:"flex gap-2",children:[z.jsxDEV("input",{type:"text",value:H,onChange:(Y)=>K(Y.target.value),placeholder:"Search MCP servers (e.g., filesystem, github, slack...)",className:"flex-1 bg-[#111] border border-[#333] rounded-lg px-4 py-3 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("button",{type:"submit",disabled:B,className:"bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-black px-6 py-3 rounded-lg font-medium transition",children:B?"...":"Search"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L&&z.jsxDEV("div",{className:"text-red-400 text-sm p-3 bg-red-500/10 border border-red-500/20 rounded-lg",children:L},void 0,!1,void 0,this),!B&&F&&w.length===0&&z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"No servers found. Try a different search term."},void 0,!1,void 0,this),w.length>0&&z.jsxDEV("div",{className:"grid gap-4 md:grid-cols-2",children:w.map((Y)=>z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4 hover:border-[#333] transition",children:z.jsxDEV("div",{className:"flex items-start justify-between gap-3",children:[z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("h3",{className:"font-medium truncate",children:Y.name},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#666] mt-1 line-clamp-2",children:Y.description||"No description"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2 mt-2 text-xs text-[#555]",children:[Y.version&&z.jsxDEV("span",{children:["v",Y.version]},void 0,!0,void 0,this),z.jsxDEV("span",{className:`px-1.5 py-0.5 rounded ${Y.npmPackage?"bg-green-500/10 text-green-400":"bg-blue-500/10 text-blue-400"}`,children:Y.npmPackage?"npm":"remote"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("code",{className:"text-xs text-[#555] bg-[#0a0a0a] px-2 py-0.5 rounded mt-2 inline-block truncate max-w-full",children:Y.npmPackage||Y.fullName},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex-shrink-0",children:Y.npmPackage?z.jsxDEV("button",{onClick:()=>f(Y),disabled:T===Y.id,className:"text-sm bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-3 py-1.5 rounded transition disabled:opacity-50",children:T===Y.id?"Adding...":"Add"},void 0,!1,void 0,this):Y.repository?z.jsxDEV("a",{href:Y.repository,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-[#666] hover:text-[#f97316] transition",children:"View →"},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},Y.id,!1,void 0,this))},void 0,!1,void 0,this),B&&z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"Searching registry..."},void 0,!1,void 0,this),z.jsxDEV("div",{className:"p-4 bg-[#111] border border-[#1a1a1a] rounded-lg text-sm text-[#666]",children:z.jsxDEV("p",{children:["Servers are sourced from the"," ",z.jsxDEV("a",{href:"https://github.com/modelcontextprotocol/servers",target:"_blank",rel:"noopener noreferrer",className:"text-[#f97316] hover:underline",children:"official MCP registry"},void 0,!1,void 0,this),". Not all servers have npm packages - some require manual setup."]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function _z({onServerAdded:G,projectId:$}){let{authFetch:H}=c(),[K,w]=J.useState("composio"),[X,B]=J.useState("configs"),[q,F]=J.useState(!1),[U,T]=J.useState(!1),[M,L]=J.useState(!1),[Q,k]=J.useState([]),[y,f]=J.useState(new Set),[Y,A]=J.useState(!0),[Z,S]=J.useState(!1),[I,p]=J.useState(null),{alert:u,AlertDialog:i}=o(),W=async()=>{try{let P=$&&$!=="unassigned"?`/api/mcp/servers?project=${encodeURIComponent($)}`:"/api/mcp/servers",[x,_]=await Promise.all([H("/api/providers"),H(P)]),R=await x.json(),g=await _.json(),V=R.providers||[],O=g.servers||[],N=new Set(O.filter((E)=>E.source==="composio"&&E.url).map((E)=>{let e=E.url.match(/\/v3\/mcp\/([^/]+)/);return e?e[1]:null}).filter(Boolean));f(N);let m=V.find((E)=>E.id==="composio"),l=V.find((E)=>E.id==="smithery"),n=V.find((E)=>E.id==="agentdojo"),d=m?.hasKey||!1,j=l?.hasKey||!1,s=n?.hasKey||!1;if(F(d),T(j),L(s),d)w("composio"),b();else if(j)w("smithery");else if(s)w("agentdojo")}catch(P){console.error("Failed to fetch providers:",P)}A(!1)},b=async()=>{S(!0);try{let P=$&&$!=="unassigned"?`?project_id=${$}`:"",_=await(await H(`/api/integrations/composio/configs${P}`)).json();k(_.configs||[])}catch(P){console.error("Failed to fetch Composio configs:",P)}S(!1)},C=async(P)=>{p(P);try{let x=$&&$!=="unassigned"?`?project_id=${$}`:"",_=await H(`/api/integrations/composio/configs/${P}/add${x}`,{method:"POST"});if(_.ok)f((R)=>new Set([...R,P])),G?.();else{let R=await _.json();await u(R.error||"Failed to add config",{title:"Error",variant:"error"})}}catch(x){console.error("Failed to add config:",x)}p(null)},h=(P)=>{return y.has(P)};if(J.useEffect(()=>{W()},[H,$]),Y)return z.jsxDEV("div",{className:"text-center py-8 text-[#666]",children:"Loading..."},void 0,!1,void 0,this);let v=q||U||M,D=[q,U,M].filter(Boolean).length;if(!v)return z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-8 text-center",children:[z.jsxDEV("p",{className:"text-[#888] mb-2",children:"No hosted MCP services connected"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-sm text-[#666] mb-4",children:"Connect Composio, Smithery, or AgentDojo in Settings to access cloud-based MCP servers."},void 0,!1,void 0,this),z.jsxDEV("a",{href:"/settings",className:"inline-block bg-[#1a1a1a] hover:bg-[#222] border border-[#333] hover:border-[#f97316] px-4 py-2 rounded text-sm font-medium transition",children:"Go to Settings →"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return z.jsxDEV(z.Fragment,{children:[i,z.jsxDEV("div",{className:"space-y-6",children:[D>1&&z.jsxDEV("div",{className:"flex gap-1 bg-[#0a0a0a] border border-[#222] rounded-lg p-1 w-fit",children:[q&&z.jsxDEV("button",{onClick:()=>{w("composio"),B("configs")},className:`px-4 py-2 rounded text-sm font-medium transition flex items-center gap-2 ${K==="composio"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:[z.jsxDEV("span",{className:"w-2 h-2 rounded-full bg-purple-500"},void 0,!1,void 0,this),"Composio"]},void 0,!0,void 0,this),U&&z.jsxDEV("button",{onClick:()=>w("smithery"),className:`px-4 py-2 rounded text-sm font-medium transition flex items-center gap-2 ${K==="smithery"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:[z.jsxDEV("span",{className:"w-2 h-2 rounded-full bg-blue-500"},void 0,!1,void 0,this),"Smithery"]},void 0,!0,void 0,this),M&&z.jsxDEV("button",{onClick:()=>w("agentdojo"),className:`px-4 py-2 rounded text-sm font-medium transition flex items-center gap-2 ${K==="agentdojo"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:[z.jsxDEV("span",{className:"w-2 h-2 rounded-full bg-green-500"},void 0,!1,void 0,this),"AgentDojo"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q&&(D===1||K==="composio")&&z.jsxDEV(z.Fragment,{children:[z.jsxDEV("div",{className:"flex items-center justify-between",children:[z.jsxDEV("div",{className:"flex gap-1 bg-[#0a0a0a] border border-[#222] rounded-lg p-1",children:[z.jsxDEV("button",{onClick:()=>B("configs"),className:`px-4 py-2 rounded text-sm font-medium transition ${X==="configs"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"MCP Configs"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>B("connect"),className:`px-4 py-2 rounded text-sm font-medium transition ${X==="connect"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"Connect Apps"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),D===1&&z.jsxDEV("div",{className:"flex items-center gap-2 text-xs text-[#666]",children:[z.jsxDEV("span",{className:"w-2 h-2 rounded-full bg-purple-500"},void 0,!1,void 0,this),"Composio",z.jsxDEV("span",{className:"text-green-400",children:"Connected"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X==="connect"&&z.jsxDEV("div",{children:[z.jsxDEV("p",{className:"text-sm text-[#666] mb-4",children:"Connect your accounts to enable tools in MCP configs"},void 0,!1,void 0,this),z.jsxDEV(r,{providerId:"composio",projectId:$,onConnectionComplete:()=>{b()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="configs"&&z.jsxDEV("div",{children:[z.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[z.jsxDEV("p",{className:"text-sm text-[#666]",children:"Your MCP configs from Composio"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-3",children:[z.jsxDEV("button",{onClick:b,disabled:Z,className:"text-xs text-[#666] hover:text-[#888] transition",children:Z?"Loading...":"Refresh"},void 0,!1,void 0,this),z.jsxDEV("a",{href:"https://app.composio.dev/mcp_configs",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[#666] hover:text-[#f97316] transition",children:"Create Config →"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Z?z.jsxDEV("div",{className:"text-center py-6 text-[#666]",children:"Loading configs..."},void 0,!1,void 0,this):Q.length===0?z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4 text-center",children:[z.jsxDEV("p",{className:"text-sm text-[#666]",children:"No MCP configs found"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:["First ",z.jsxDEV("button",{onClick:()=>B("connect"),className:"text-[#f97316] hover:text-[#fb923c]",children:"connect some apps"},void 0,!1,void 0,this),", then create a config."]},void 0,!0,void 0,this),z.jsxDEV("a",{href:"https://app.composio.dev/mcp_configs",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[#f97316] hover:text-[#fb923c] mt-2 inline-block",children:"Create in Composio →"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV("div",{className:"space-y-2",children:Q.map((P)=>{let x=h(P.id),_=I===P.id;return z.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-3 transition flex items-center justify-between ${x?"border-green-500/30":"border-[#1a1a1a] hover:border-[#333]"}`,children:[z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("span",{className:"font-medium text-sm",children:P.name},void 0,!1,void 0,this),z.jsxDEV("span",{className:"text-xs text-[#555]",children:[P.toolsCount," tools"]},void 0,!0,void 0,this),x&&z.jsxDEV("span",{className:"text-xs text-green-400",children:"Added"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),P.toolkits.length>0&&z.jsxDEV("div",{className:"flex flex-wrap gap-1 mt-1",children:[P.toolkits.slice(0,4).map((R)=>z.jsxDEV("span",{className:"text-xs bg-[#1a1a1a] text-[#666] px-1.5 py-0.5 rounded",children:R},R,!1,void 0,this)),P.toolkits.length>4&&z.jsxDEV("span",{className:"text-xs text-[#555]",children:["+",P.toolkits.length-4]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2 ml-3",children:[x?z.jsxDEV("span",{className:"text-xs text-[#555] px-2 py-1",children:"In Servers"},void 0,!1,void 0,this):z.jsxDEV("button",{onClick:()=>C(P.id),disabled:_,className:"text-xs bg-[#f97316] hover:bg-[#fb923c] text-black px-3 py-1 rounded font-medium transition disabled:opacity-50",children:_?"Adding...":"Add"},void 0,!1,void 0,this),z.jsxDEV("a",{href:`https://app.composio.dev/mcp_configs/${P.id}`,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[#666] hover:text-[#888] transition",children:"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},P.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),U&&(D===1||K==="smithery")&&z.jsxDEV("div",{children:[D===1&&z.jsxDEV("div",{className:"flex items-center gap-2 text-xs text-[#666] mb-4",children:[z.jsxDEV("span",{className:"w-2 h-2 rounded-full bg-blue-500"},void 0,!1,void 0,this),"Smithery",z.jsxDEV("span",{className:"text-green-400",children:"Connected"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[z.jsxDEV("p",{className:"text-sm text-[#666]",children:"Add MCP servers from the Smithery registry"},void 0,!1,void 0,this),z.jsxDEV("a",{href:"https://smithery.ai/servers",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-[#666] hover:text-[#f97316] transition",children:"Browse Smithery →"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4 text-center",children:[z.jsxDEV("p",{className:"text-sm text-[#666]",children:["Smithery servers can be added from the ",z.jsxDEV("strong",{children:"Browse Registry"},void 0,!1,void 0,this)," tab."]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:"Your API key will be used automatically when adding Smithery servers."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),M&&(D===1||K==="agentdojo")&&z.jsxDEV($z,{projectId:$,onServerAdded:G,showProviderBadge:D===1},void 0,!1,void 0,this),z.jsxDEV("div",{className:"p-3 bg-[#0a0a0a] border border-[#222] rounded text-xs text-[#666]",children:[z.jsxDEV("strong",{className:"text-[#888]",children:"Tip:"},void 0,!1,void 0,this)," Connect apps first, then add MCP configs to make tools available to your agents."," · ",z.jsxDEV("a",{href:"/settings",className:"text-[#f97316] hover:text-[#fb923c]",children:"Add more providers in Settings"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function $z({projectId:G,onServerAdded:$,showProviderBadge:H}){let{authFetch:K}=c(),[w,X]=J.useState("configs"),[B,q]=J.useState([]),[F,U]=J.useState(new Set),[T,M]=J.useState(!1),[L,Q]=J.useState(null),{alert:k,AlertDialog:y}=o(),f=async()=>{M(!0);try{let Z=G&&G!=="unassigned"?`?project_id=${G}`:"",S=G&&G!=="unassigned"?`/api/mcp/servers?project=${encodeURIComponent(G)}`:"/api/mcp/servers";console.log(`[AgentDojo:fetchConfigs] projectId=${G} serversUrl=${S}`);let[I,p]=await Promise.all([K(`/api/integrations/agentdojo/configs${Z}`),K(S)]),u=await I.json(),i=await p.json();console.log(`[AgentDojo:fetchConfigs] configs=${(u.configs||[]).length} servers=${(i.servers||[]).length}`),q(u.configs||[]);let W=(i.servers||[]).filter((C)=>C.source==="agentdojo");console.log(`[AgentDojo:fetchConfigs] agentdojo servers found: ${W.length}`);for(let C of W){let h=C.url?.match(/\/mcp\/([^/?]+)/);console.log(`[AgentDojo:fetchConfigs] server: id=${C.id} name=${C.name} project_id=${C.project_id} url=${C.url?.substring(0,80)} extracted=${h?h[1]:C.name}`)}let b=new Set(W.map((C)=>{let h=C.url?.match(/\/mcp\/([^/?]+)/);return h?h[1]:C.name}));console.log("[AgentDojo:fetchConfigs] addedServers set:",[...b]),U(b)}catch(Z){console.error("Failed to fetch AgentDojo configs:",Z)}M(!1)},Y=async(Z)=>{Q(Z);try{let S=G&&G!=="unassigned"?`?project_id=${G}`:"";console.log(`[AgentDojo:addConfig] configId=${Z} projectParam=${S}`);let I=await K(`/api/integrations/agentdojo/configs/${Z}/add${S}`,{method:"POST"}),p=await I.json();if(console.log(`[AgentDojo:addConfig] response status=${I.status} ok=${I.ok} message=${p.message} server.id=${p.server?.id} server.project_id=${p.server?.project_id}`),I.ok){let u=B.find((W)=>W.id===Z),i=u?.slug||Z;console.log(`[AgentDojo:addConfig] marking as added: key=${i} config.slug=${u?.slug} config.id=${u?.id} config.name=${u?.name}`),U((W)=>new Set([...W,i])),$?.()}else await k(p.error||"Failed to add config",{title:"Error",variant:"error"})}catch(S){console.error("Failed to add config:",S)}Q(null)},A=(Z)=>{return F.has(Z.slug)||F.has(Z.id)||F.has(Z.name)};return J.useEffect(()=>{f()},[K,G]),z.jsxDEV(z.Fragment,{children:[y,z.jsxDEV("div",{children:[H&&z.jsxDEV("div",{className:"flex items-center gap-2 text-xs text-[#666] mb-4",children:[z.jsxDEV("span",{className:"w-2 h-2 rounded-full bg-green-500"},void 0,!1,void 0,this),"AgentDojo",z.jsxDEV("span",{className:"text-green-400",children:"Connected"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex items-center justify-between mb-4",children:z.jsxDEV("div",{className:"flex gap-1 bg-[#0a0a0a] border border-[#222] rounded-lg p-1",children:[z.jsxDEV("button",{onClick:()=>X("configs"),className:`px-4 py-2 rounded text-sm font-medium transition ${w==="configs"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"MCP Servers"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>X("toolkits"),className:`px-4 py-2 rounded text-sm font-medium transition ${w==="toolkits"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"Browse Toolkits"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),w==="configs"&&z.jsxDEV("div",{children:[z.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[z.jsxDEV("p",{className:"text-sm text-[#666]",children:"Your MCP servers from AgentDojo"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:f,disabled:T,className:"text-xs text-[#666] hover:text-[#888] transition",children:T?"Loading...":"Refresh"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T?z.jsxDEV("div",{className:"text-center py-6 text-[#666]",children:"Loading servers..."},void 0,!1,void 0,this):B.length===0?z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4 text-center",children:[z.jsxDEV("p",{className:"text-sm text-[#666]",children:"No MCP servers found"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:[z.jsxDEV("button",{onClick:()=>X("toolkits"),className:"text-[#f97316] hover:text-[#fb923c]",children:"Browse toolkits"},void 0,!1,void 0,this)," ","to create a new MCP server."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):z.jsxDEV("div",{className:"space-y-2",children:B.map((Z)=>{let S=A(Z),I=L===Z.id;return z.jsxDEV("div",{className:`bg-[#111] border rounded-lg p-3 transition flex items-center justify-between ${S?"border-green-500/30":"border-[#1a1a1a] hover:border-[#333]"}`,children:[z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("span",{className:"font-medium text-sm",children:Z.name},void 0,!1,void 0,this),z.jsxDEV("span",{className:"text-xs text-[#555]",children:[Z.toolsCount," tools"]},void 0,!0,void 0,this),S&&z.jsxDEV("span",{className:"text-xs text-green-400",children:"Added"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z.mcpUrl&&z.jsxDEV("code",{className:"text-xs text-[#555] mt-1 block truncate",children:Z.mcpUrl},void 0,!1,void 0,this),!Z.mcpUrl&&Z.slug&&z.jsxDEV("code",{className:"text-xs text-[#555] mt-1 block truncate",children:Z.slug},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2 ml-3",children:S?z.jsxDEV("span",{className:"text-xs text-[#555] px-2 py-1",children:"In Servers"},void 0,!1,void 0,this):z.jsxDEV("button",{onClick:()=>Y(Z.id),disabled:I,className:"text-xs bg-[#f97316] hover:bg-[#fb923c] text-black px-3 py-1 rounded font-medium transition disabled:opacity-50",children:I?"Adding...":"Add"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},Z.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w==="toolkits"&&z.jsxDEV("div",{children:[z.jsxDEV("p",{className:"text-sm text-[#666] mb-4",children:"Browse available toolkits and create MCP servers"},void 0,!1,void 0,this),z.jsxDEV(r,{providerId:"agentdojo",projectId:G,onConnectionComplete:()=>{f()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function qz(G){let $=[],H=G,K=null,w=G.match(/(?:npx\s+-y\s+)?(@?[\w-]+\/)?(@?[\w-]+)(?:@[\w.-]+)?/);if(w){let q=w[2]||w[1];if(q)K=q.replace(/^@/,"").replace(/-mcp$/,"").replace(/-server$/,"").replace(/^server-/,"").replace(/^mcp-/,"")}let X=/--(\w+[-\w]*)\s+(YOUR_\w+|<[\w_]+>|\{[\w_]+\}|\$[\w_]+|[\w_]*(?:TOKEN|KEY|SECRET|PASSWORD|USER|ID|APIKEY)[\w_]*)/gi,B;while((B=X.exec(G))!==null){let q=B[1],F=B[2],U=q.toUpperCase().replace(/-/g,"_"),T=K?`${K.toUpperCase().replace(/-/g,"_")}_${U}`:U;$.push({key:T,flag:q}),H=H.replace(new RegExp(`(--${q}\\s+)${F.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`,"i"),`--${q} $${T}`)}return{cleanCommand:H,credentials:$,serverName:K}}function Bz({onClose:G,onAdded:$,projects:H,defaultProjectId:K}){let{authFetch:w}=c(),[X,B]=J.useState("npm"),[q,F]=J.useState(""),[U,T]=J.useState(""),[M,L]=J.useState(""),[Q,k]=J.useState(""),[y,f]=J.useState(""),[Y,A]=J.useState(""),[Z,S]=J.useState(""),[I,p]=J.useState([]),[u,i]=J.useState(K||null),[W,b]=J.useState(!1),[C,h]=J.useState(null),v=H&&H.length>0,D=()=>{p([...I,{key:"",value:""}])},P=(O,N,m)=>{let l=[...I];l[O][N]=m,p(l)},x=(O)=>{p(I.filter((N,m)=>m!==O))},_=(O)=>{if(k(O),O.includes("YOUR_")||O.includes("<")||O.includes("{")||/TOKEN|KEY|SECRET|PASSWORD/i.test(O)){let{cleanCommand:N,credentials:m,serverName:l}=qz(O);if(!q&&l)F(l);if(m.length>0){let n=new Set(I.map((j)=>j.key)),d=m.filter((j)=>!n.has(j.key)).map((j)=>({key:j.key,value:""}));if(d.length>0)p([...I,...d]),k(N)}}},R=(O)=>{if(O.startsWith("npx ")||O.includes(" --")||O.includes("YOUR_")||O.includes("<")||/\s+(TOKEN|KEY|SECRET|PASSWORD)/i.test(O))B("command"),_(O);else if(T(O),!q&&O){let m=O.replace(/^@[\w-]+\//,"").replace(/@[\w.-]+$/,"").replace(/^server-/,"").replace(/-server$/,"").replace(/^mcp-/,"").replace(/-mcp$/,"");if(m&&m!==O)F(m)}},g=async()=>{if(!q){h("Name is required");return}if(X==="npm"&&!U){h("npm package is required");return}if(X==="pip"&&!U){h("pip package is required");return}if(X==="command"&&!Q){h("Command is required");return}if(X==="http"&&!y){h("URL is required");return}b(!0),h(null);let O={};for(let{key:N,value:m}of I)if(N.trim())O[N.trim()]=m;try{let N={name:q};if(X==="npm")N.type="npm",N.package=U;else if(X==="pip"){if(N.type="pip",N.package=U,M)N.pip_module=M}else if(X==="http"){N.type="http",N.url=y;let l={"Content-Type":"application/json"};if(Y&&Z){let n=btoa(`${Y}:${Z}`);l.Authorization=`Basic ${n}`}N.headers=l}else{let l=Q.trim().split(/\s+/);N.type="custom",N.command=l[0],N.args=l.slice(1).join(" ")}if(Object.keys(O).length>0)N.env=O;if(u)N.project_id=u;let m=await w("/api/mcp/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)});if(!m.ok){let l=await m.json();h(l.error||"Failed to add server"),b(!1);return}$()}catch(N){h("Failed to add server"),b(!1)}},V=(O,N)=>{B("npm"),F(O),T(N)};return z.jsxDEV("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-[2px] z-50 flex items-center justify-center p-4",children:z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[z.jsxDEV("div",{className:"p-4 border-b border-[#1a1a1a] flex items-center justify-between sticky top-0 bg-[#111]",children:[z.jsxDEV("h2",{className:"text-lg font-semibold",children:"Add MCP Server"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:G,className:"text-[#666] hover:text-[#888]",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-4 space-y-4",children:[z.jsxDEV("div",{children:[z.jsxDEV("p",{className:"text-sm text-[#666] mb-2",children:"Quick add:"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex flex-wrap gap-2",children:[{name:"filesystem",pkg:"@modelcontextprotocol/server-filesystem",type:"npm"},{name:"fetch",pkg:"@modelcontextprotocol/server-fetch",type:"npm"},{name:"memory",pkg:"@modelcontextprotocol/server-memory",type:"npm"},{name:"github",pkg:"@modelcontextprotocol/server-github",type:"npm"},{name:"time",pkg:"mcp-server-time",module:"mcp_server_time",type:"pip"}].map((O)=>z.jsxDEV("button",{onClick:()=>{if(B(O.type),F(O.name),T(O.pkg),O.type==="pip"&&"module"in O)L(O.module||"");else L("")},className:"text-sm bg-[#1a1a1a] hover:bg-[#222] px-3 py-1 rounded transition",children:O.name},O.name,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex gap-1 bg-[#0a0a0a] border border-[#222] rounded p-1",children:[z.jsxDEV("button",{onClick:()=>B("npm"),className:`flex-1 px-2 py-1.5 rounded text-sm transition ${X==="npm"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"npm"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>B("pip"),className:`flex-1 px-2 py-1.5 rounded text-sm transition ${X==="pip"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"pip"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>B("command"),className:`flex-1 px-2 py-1.5 rounded text-sm transition ${X==="command"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"Command"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>B("http"),className:`flex-1 px-2 py-1.5 rounded text-sm transition ${X==="http"?"bg-[#1a1a1a] text-white":"text-[#666] hover:text-[#888]"}`,children:"HTTP"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Name"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:q,onChange:(O)=>F(O.target.value),placeholder:"e.g., pushover",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Scope"},void 0,!1,void 0,this),z.jsxDEV(t,{value:u||"",onChange:(O)=>i(O||null),options:[{value:"",label:"Global (all projects)"},...H.map((O)=>({value:O.id,label:O.name}))],placeholder:"Select scope..."},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Global servers are available to all agents. Project-scoped servers are only available to agents in that project."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="npm"&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"npm Package"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:U,onChange:(O)=>R(O.target.value),placeholder:"e.g., @modelcontextprotocol/server-filesystem or paste full command",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Package name or paste a full npx command with credentials"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="pip"&&z.jsxDEV("div",{className:"space-y-4",children:[z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"pip Package"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:U,onChange:(O)=>{if(T(O.target.value),!M&&O.target.value){let N=O.target.value.split("[")[0].replace(/-/g,".");L(N)}},placeholder:"e.g., late-sdk[mcp]",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Python package with extras, e.g., late-sdk[mcp] or mcp-server-time"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Module (optional)"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:M,onChange:(O)=>L(O.target.value),placeholder:"e.g., late.mcp",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Python module to run with -m. Auto-detected from package name if not specified."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X==="command"&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Command"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:Q,onChange:(O)=>_(O.target.value),placeholder:"e.g., npx -y pushover-mcp@latest start --token YOUR_TOKEN",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Paste the full command - credentials like YOUR_TOKEN will be auto-extracted"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="http"&&z.jsxDEV("div",{className:"space-y-4",children:[z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"URL"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:y,onChange:(O)=>f(O.target.value),placeholder:"e.g., https://example.com/wp-json/mcp/v1/messages",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-3 bg-[#0a0a0a] border border-[#222] rounded",children:[z.jsxDEV("p",{className:"text-xs text-[#666] mb-3",children:"Optional: Basic Auth credentials (will be encoded and stored securely)"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"grid grid-cols-2 gap-3",children:[z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-xs text-[#555] mb-1",children:"Username"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:Y,onChange:(O)=>A(O.target.value),placeholder:"username",className:"w-full bg-[#111] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-xs text-[#555] mb-1",children:"Password"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"password",value:Z,onChange:(O)=>S(O.target.value),placeholder:"password or app key",className:"w-full bg-[#111] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("div",{className:"flex items-center justify-between mb-2",children:[z.jsxDEV("label",{className:"text-sm text-[#666]",children:"Environment Variables / Credentials"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:D,className:"text-xs text-[#f97316] hover:text-[#fb923c] transition",children:"+ Add Variable"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),I.length===0&&z.jsxDEV("p",{className:"text-xs text-[#555] bg-[#0a0a0a] border border-[#222] rounded p-3",children:"Add environment variables for API tokens and credentials. These are stored encrypted and passed to the server at startup."},void 0,!1,void 0,this),I.length>0&&z.jsxDEV("div",{className:"space-y-2",children:I.map((O,N)=>z.jsxDEV("div",{className:"flex gap-2",children:[z.jsxDEV("input",{type:"text",value:O.key,onChange:(m)=>P(N,"key",m.target.value),placeholder:"KEY",className:"w-1/3 bg-[#0a0a0a] border border-[#333] rounded px-2 py-1.5 text-sm font-mono focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"password",value:O.value,onChange:(m)=>P(N,"value",m.target.value),placeholder:"value",className:"flex-1 bg-[#0a0a0a] border border-[#333] rounded px-2 py-1.5 text-sm font-mono focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>x(N),className:"text-[#666] hover:text-red-400 px-2 transition",children:"✕"},void 0,!1,void 0,this)]},N,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&z.jsxDEV("p",{className:"text-red-400 text-sm",children:C},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-4 border-t border-[#1a1a1a] flex justify-end gap-2 sticky bottom-0 bg-[#111]",children:[z.jsxDEV("button",{onClick:G,className:"px-4 py-2 border border-[#333] hover:border-[#666] rounded transition",children:"Cancel"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:g,disabled:W||!q||(X==="npm"?!U:X==="pip"?!U:X==="http"?!y:!Q),className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] text-black rounded font-medium transition disabled:opacity-50",children:W?"Adding...":"Add Server"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Uz({server:G,projects:$,onClose:H,onSaved:K}){let{authFetch:w}=c(),[X,B]=J.useState(G.name),[q,F]=J.useState(G.package||""),[U,T]=J.useState(G.command||""),[M,L]=J.useState(G.args||""),[Q,k]=J.useState(G.url||""),[y,f]=J.useState(()=>{let _=G.headers?.Authorization||"";if(_.startsWith("Basic "))try{return atob(_.slice(6)).split(":")[0]||""}catch{return""}return""}),[Y,A]=J.useState(()=>{let _=G.headers?.Authorization||"";if(_.startsWith("Basic "))try{return atob(_.slice(6)).split(":").slice(1).join(":")||""}catch{return""}return""}),[Z,S]=J.useState(()=>{return Object.entries(G.env||{}).map(([_,R])=>({key:_,value:R}))}),[I,p]=J.useState(G.project_id),[u,i]=J.useState(!1),[W,b]=J.useState(null),C=$&&$.length>0,h=G.type==="http",v=()=>{S([...Z,{key:"",value:""}])},D=(_,R,g)=>{let V=[...Z];V[_][R]=g,S(V)},P=(_)=>{S(Z.filter((R,g)=>g!==_))},x=async()=>{if(!X.trim()){b("Name is required");return}i(!0),b(null);let _={};for(let{key:R,value:g}of Z)if(R.trim())_[R.trim()]=g;try{let R={name:X.trim(),env:_};if(h){if(Q.trim())R.url=Q.trim();let V={"Content-Type":"application/json"};if(y&&Y){let O=btoa(`${y}:${Y}`);V.Authorization=`Basic ${O}`}R.headers=V}else{if(G.type==="npm"&&q.trim())R.package=q.trim();if(G.type==="pip"&&q.trim())R.package=q.trim();if(G.type==="custom"){if(U.trim())R.command=U.trim();if(M.trim())R.args=M.trim()}}R.project_id=I;let g=await w(`/api/mcp/servers/${G.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(R)});if(!g.ok){let V=await g.json();b(V.error||"Failed to save changes"),i(!1);return}if(G.status==="running"&&!h)try{await w(`/api/mcp/servers/${G.id}/stop`,{method:"POST"}),await w(`/api/mcp/servers/${G.id}/start`,{method:"POST"})}catch(V){console.error("Failed to restart server:",V)}K()}catch(R){b("Failed to save changes"),i(!1)}};return z.jsxDEV("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-[2px] z-50 flex items-center justify-center p-4",children:z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg w-full max-w-lg max-h-[90vh] overflow-y-auto",children:[z.jsxDEV("div",{className:"p-4 border-b border-[#1a1a1a] flex items-center justify-between sticky top-0 bg-[#111]",children:[z.jsxDEV("h2",{className:"text-lg font-semibold",children:"Edit MCP Server"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:H,className:"text-[#666] hover:text-[#888]",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-4 space-y-4",children:[z.jsxDEV("div",{className:"text-sm text-[#666] bg-[#0a0a0a] border border-[#222] rounded p-3",children:["Type: ",z.jsxDEV("span",{className:"text-[#888]",children:G.type},void 0,!1,void 0,this),G.package&&z.jsxDEV(z.Fragment,{children:[" • Package: ",z.jsxDEV("span",{className:"text-[#888] font-mono",children:G.package},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.command&&z.jsxDEV(z.Fragment,{children:[" • Command: ",z.jsxDEV("span",{className:"text-[#888] font-mono",children:G.command},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Name"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:X,onChange:(_)=>B(_.target.value),className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Scope"},void 0,!1,void 0,this),z.jsxDEV(t,{value:I||"",onChange:(_)=>p(_||null),options:[{value:"",label:"Global (all projects)"},...$.map((_)=>({value:_.id,label:_.name}))],placeholder:"Select scope..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.type==="npm"&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"npm Package"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:q,onChange:(_)=>F(_.target.value),className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G.type==="pip"&&z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"pip Package"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:q,onChange:(_)=>F(_.target.value),className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),h&&z.jsxDEV(z.Fragment,{children:[z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Server URL"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:Q,onChange:(_)=>k(_.target.value),placeholder:"https://example.com/mcp",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Authentication (Basic Auth)"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex gap-2",children:[z.jsxDEV("input",{type:"text",value:y,onChange:(_)=>f(_.target.value),placeholder:"Username",className:"flex-1 bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"password",value:Y,onChange:(_)=>A(_.target.value),placeholder:"Password / App Password",className:"flex-1 bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Leave empty if no authentication required"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G.type==="custom"&&z.jsxDEV(z.Fragment,{children:[z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Command"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:U,onChange:(_)=>T(_.target.value),className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{children:[z.jsxDEV("label",{className:"block text-sm text-[#666] mb-1",children:"Arguments"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"text",value:M,onChange:(_)=>L(_.target.value),placeholder:"e.g., --token $TOKEN --verbose",className:"w-full bg-[#0a0a0a] border border-[#333] rounded px-3 py-2 font-mono text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!h&&z.jsxDEV("div",{children:[z.jsxDEV("div",{className:"flex items-center justify-between mb-2",children:[z.jsxDEV("label",{className:"text-sm text-[#666]",children:"Environment Variables / Credentials"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:v,className:"text-xs text-[#f97316] hover:text-[#fb923c] transition",children:"+ Add Variable"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z.length===0&&z.jsxDEV("p",{className:"text-xs text-[#555] bg-[#0a0a0a] border border-[#222] rounded p-3",children:"No environment variables configured."},void 0,!1,void 0,this),Z.length>0&&z.jsxDEV("div",{className:"space-y-2",children:Z.map((_,R)=>z.jsxDEV("div",{className:"flex gap-2",children:[z.jsxDEV("input",{type:"text",value:_.key,onChange:(g)=>D(R,"key",g.target.value),placeholder:"KEY",className:"w-1/3 bg-[#0a0a0a] border border-[#333] rounded px-2 py-1.5 text-sm font-mono focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("input",{type:"password",value:_.value,onChange:(g)=>D(R,"value",g.target.value),placeholder:"value",className:"flex-1 bg-[#0a0a0a] border border-[#333] rounded px-2 py-1.5 text-sm font-mono focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:()=>P(R),className:"text-[#666] hover:text-red-400 px-2 transition",children:"✕"},void 0,!1,void 0,this)]},R,!0,void 0,this))},void 0,!1,void 0,this),z.jsxDEV("p",{className:"text-xs text-[#555] mt-2",children:G.status==="running"?"Server will be automatically restarted to apply changes.":"Changes will take effect when the server is started."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W&&z.jsxDEV("p",{className:"text-red-400 text-sm",children:W},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"p-4 border-t border-[#1a1a1a] flex justify-end gap-2 sticky bottom-0 bg-[#111]",children:[z.jsxDEV("button",{onClick:H,className:"px-4 py-2 border border-[#333] hover:border-[#666] rounded transition",children:"Cancel"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:x,disabled:u||!X.trim(),className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] text-black rounded font-medium transition disabled:opacity-50",children:u?"Saving...":"Save Changes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}
|
|
2
|
-
export{Mz as i};
|
|
3
|
-
|
|
4
|
-
//# debugId=7936DF6F3383B76864756E2164756E21
|