apteva 0.4.57 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +216 -54
- package/cli.js +35 -0
- package/install.js +92 -0
- package/package.json +15 -76
- package/LICENSE +0 -63
- package/bin/apteva.js +0 -196
- package/dist/ActivityPage.kxzzb4yc.js +0 -3
- package/dist/ApiDocsPage.zq998hbm.js +0 -4
- package/dist/App.55rea8mn.js +0 -61
- package/dist/App.5ywb23z4.js +0 -53
- package/dist/App.6thds120.js +0 -4
- package/dist/App.9tctxzqm.js +0 -8
- package/dist/App.a8r8ttaz.js +0 -4
- package/dist/App.agsv5bje.js +0 -4
- package/dist/App.cepapqmx.js +0 -4
- package/dist/App.dp041gb3.js +0 -221
- package/dist/App.fds72zb5.js +0 -4
- package/dist/App.fg9qj2dq.js +0 -4
- package/dist/App.ndfejbm9.js +0 -4
- package/dist/App.nxmfmq1h.js +0 -13
- package/dist/App.qdfyt8ba.js +0 -4
- package/dist/App.x2d0ygt6.js +0 -4
- package/dist/App.yt9p4nr3.js +0 -20
- package/dist/App.zn4mw16t.js +0 -1
- package/dist/ConnectionsPage.8r96ryw7.js +0 -3
- package/dist/McpPage.3cwh0gnd.js +0 -3
- package/dist/SettingsPage.ykgdh5ev.js +0 -3
- package/dist/SkillsPage.4np1s65b.js +0 -3
- package/dist/TasksPage.4g08t7p6.js +0 -3
- package/dist/TelemetryPage.72w9pwcp.js +0 -3
- package/dist/TestsPage.z4fk3r7r.js +0 -3
- package/dist/ThreadsPage.63tcajeh.js +0 -3
- package/dist/apteva-kit.css +0 -1
- package/dist/icon.png +0 -0
- package/dist/index.html +0 -16
- package/dist/styles.css +0 -1
- package/scripts/postinstall.mjs +0 -102
- package/src/auth/index.ts +0 -394
- package/src/auth/middleware.ts +0 -213
- package/src/binary.ts +0 -536
- package/src/channels/index.ts +0 -40
- package/src/channels/telegram.ts +0 -311
- package/src/crypto.ts +0 -301
- package/src/db-tests.ts +0 -174
- package/src/db.ts +0 -3133
- package/src/integrations/agentdojo.ts +0 -559
- package/src/integrations/composio.ts +0 -437
- package/src/integrations/index.ts +0 -87
- package/src/integrations/skillsmp.ts +0 -318
- package/src/mcp-client.ts +0 -605
- package/src/mcp-handler.ts +0 -394
- package/src/mcp-platform.ts +0 -2403
- package/src/openapi.ts +0 -2410
- package/src/providers.ts +0 -597
- package/src/routes/api/agent-utils.ts +0 -890
- package/src/routes/api/agents.ts +0 -916
- package/src/routes/api/api-keys.ts +0 -95
- package/src/routes/api/channels.ts +0 -182
- package/src/routes/api/helpers.ts +0 -12
- package/src/routes/api/integrations.ts +0 -639
- package/src/routes/api/mcp.ts +0 -574
- package/src/routes/api/meta-agent.ts +0 -195
- package/src/routes/api/projects.ts +0 -112
- package/src/routes/api/providers.ts +0 -424
- package/src/routes/api/skills.ts +0 -537
- package/src/routes/api/system.ts +0 -333
- package/src/routes/api/telemetry.ts +0 -203
- package/src/routes/api/tests.ts +0 -148
- package/src/routes/api/triggers.ts +0 -518
- package/src/routes/api/users.ts +0 -148
- package/src/routes/api/webhooks.ts +0 -171
- package/src/routes/api.ts +0 -53
- package/src/routes/auth.ts +0 -251
- package/src/routes/share.ts +0 -86
- package/src/routes/static.ts +0 -131
- package/src/server.ts +0 -642
- package/src/test-runner.ts +0 -598
- package/src/triggers/agentdojo.ts +0 -253
- package/src/triggers/composio.ts +0 -264
- package/src/triggers/index.ts +0 -71
- package/src/tui/AgentList.tsx +0 -145
- package/src/tui/App.tsx +0 -102
- package/src/tui/Login.tsx +0 -104
- package/src/tui/api.ts +0 -72
- package/src/tui/index.tsx +0 -7
- package/src/web/App.tsx +0 -455
- package/src/web/components/activity/ActivityPage.tsx +0 -314
- package/src/web/components/activity/index.ts +0 -1
- package/src/web/components/agents/AgentCard.tsx +0 -189
- package/src/web/components/agents/AgentPanel.tsx +0 -2244
- package/src/web/components/agents/AgentsView.tsx +0 -180
- package/src/web/components/agents/CreateAgentModal.tsx +0 -475
- package/src/web/components/agents/index.ts +0 -4
- package/src/web/components/api/ApiDocsPage.tsx +0 -842
- package/src/web/components/auth/CreateAccountStep.tsx +0 -176
- package/src/web/components/auth/LoginPage.tsx +0 -91
- package/src/web/components/auth/index.ts +0 -2
- package/src/web/components/common/Icons.tsx +0 -250
- package/src/web/components/common/LoadingSpinner.tsx +0 -44
- package/src/web/components/common/Modal.tsx +0 -199
- package/src/web/components/common/Select.tsx +0 -97
- package/src/web/components/common/index.ts +0 -20
- package/src/web/components/connections/ConnectionsPage.tsx +0 -54
- package/src/web/components/connections/IntegrationsTab.tsx +0 -170
- package/src/web/components/connections/OverviewTab.tsx +0 -137
- package/src/web/components/connections/TriggersTab.tsx +0 -1346
- package/src/web/components/dashboard/Dashboard.tsx +0 -572
- package/src/web/components/dashboard/index.ts +0 -1
- package/src/web/components/index.ts +0 -21
- package/src/web/components/layout/ErrorBanner.tsx +0 -18
- package/src/web/components/layout/Header.tsx +0 -332
- package/src/web/components/layout/Sidebar.tsx +0 -231
- package/src/web/components/layout/index.ts +0 -3
- package/src/web/components/mcp/IntegrationsPanel.tsx +0 -857
- package/src/web/components/mcp/McpPage.tsx +0 -2515
- package/src/web/components/mcp/index.ts +0 -1
- package/src/web/components/meta-agent/MetaAgent.tsx +0 -245
- package/src/web/components/onboarding/OnboardingWizard.tsx +0 -404
- package/src/web/components/onboarding/index.ts +0 -1
- package/src/web/components/settings/SettingsPage.tsx +0 -2776
- package/src/web/components/settings/index.ts +0 -1
- package/src/web/components/skills/SkillsPage.tsx +0 -1200
- package/src/web/components/tasks/TasksPage.tsx +0 -1116
- package/src/web/components/tasks/index.ts +0 -1
- package/src/web/components/telemetry/TelemetryPage.tsx +0 -1129
- package/src/web/components/tests/TestsPage.tsx +0 -594
- package/src/web/components/threads/ThreadsPage.tsx +0 -315
- package/src/web/context/AuthContext.tsx +0 -242
- package/src/web/context/ProjectContext.tsx +0 -214
- package/src/web/context/TelemetryContext.tsx +0 -299
- package/src/web/context/ThemeContext.tsx +0 -90
- package/src/web/context/UIModeContext.tsx +0 -49
- package/src/web/context/index.ts +0 -12
- package/src/web/hooks/index.ts +0 -3
- package/src/web/hooks/useAgents.ts +0 -115
- package/src/web/hooks/useOnboarding.ts +0 -20
- package/src/web/hooks/useProviders.ts +0 -75
- package/src/web/icon.png +0 -0
- package/src/web/index.html +0 -16
- package/src/web/styles.css +0 -118
- package/src/web/themes.ts +0 -162
- package/src/web/types.ts +0 -298
package/src/web/App.tsx
DELETED
|
@@ -1,455 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useMemo, lazy, Suspense } from "react";
|
|
2
|
-
import { createRoot } from "react-dom/client";
|
|
3
|
-
import { Chat, Call } from "@apteva/apteva-kit";
|
|
4
|
-
import "@apteva/apteva-kit/styles.css";
|
|
5
|
-
|
|
6
|
-
// Types
|
|
7
|
-
import type { Agent, Provider, Route, NewAgentForm } from "./types";
|
|
8
|
-
import { DEFAULT_FEATURES } from "./types";
|
|
9
|
-
|
|
10
|
-
// Context
|
|
11
|
-
import { TelemetryProvider, AuthProvider, ProjectProvider, ThemeProvider, UIModeProvider, useTheme, useAuth, useProjects, useAgentStatusChange, useTaskChange } from "./context";
|
|
12
|
-
|
|
13
|
-
// Hooks
|
|
14
|
-
import { useAgents, useProviders, useOnboarding } from "./hooks";
|
|
15
|
-
|
|
16
|
-
// Core components (always needed)
|
|
17
|
-
import {
|
|
18
|
-
LoadingSpinner,
|
|
19
|
-
Header,
|
|
20
|
-
Sidebar,
|
|
21
|
-
ErrorBanner,
|
|
22
|
-
OnboardingWizard,
|
|
23
|
-
CreateAgentModal,
|
|
24
|
-
AgentsView,
|
|
25
|
-
Dashboard,
|
|
26
|
-
LoginPage,
|
|
27
|
-
} from "./components";
|
|
28
|
-
import { MetaAgentProvider, MetaAgentPanel } from "./components/meta-agent/MetaAgent";
|
|
29
|
-
|
|
30
|
-
// Lazy-loaded page components (only loaded when navigated to)
|
|
31
|
-
const SettingsPage = lazy(() => import("./components/settings/SettingsPage").then(m => ({ default: m.SettingsPage })));
|
|
32
|
-
const TasksPage = lazy(() => import("./components/tasks/TasksPage").then(m => ({ default: m.TasksPage })));
|
|
33
|
-
const McpPage = lazy(() => import("./components/mcp/McpPage").then(m => ({ default: m.McpPage })));
|
|
34
|
-
const SkillsPage = lazy(() => import("./components/skills/SkillsPage").then(m => ({ default: m.SkillsPage })));
|
|
35
|
-
const TestsPage = lazy(() => import("./components/tests/TestsPage").then(m => ({ default: m.TestsPage })));
|
|
36
|
-
const ThreadsPage = lazy(() => import("./components/threads/ThreadsPage").then(m => ({ default: m.ThreadsPage })));
|
|
37
|
-
const TelemetryPage = lazy(() => import("./components/telemetry/TelemetryPage").then(m => ({ default: m.TelemetryPage })));
|
|
38
|
-
const ConnectionsPage = lazy(() => import("./components/connections/ConnectionsPage").then(m => ({ default: m.ConnectionsPage })));
|
|
39
|
-
const ActivityPage = lazy(() => import("./components/activity/ActivityPage").then(m => ({ default: m.ActivityPage })));
|
|
40
|
-
const ApiDocsPage = lazy(() => import("./components/api/ApiDocsPage").then(m => ({ default: m.ApiDocsPage })));
|
|
41
|
-
|
|
42
|
-
function AppContent() {
|
|
43
|
-
// Auth state
|
|
44
|
-
const { isAuthenticated, isLoading: authLoading, hasUsers, accessToken, checkAuth } = useAuth();
|
|
45
|
-
const { currentProjectId, refreshProjects } = useProjects();
|
|
46
|
-
const statusChangeCounter = useAgentStatusChange();
|
|
47
|
-
const taskChangeCounter = useTaskChange();
|
|
48
|
-
|
|
49
|
-
// Onboarding state
|
|
50
|
-
const { isComplete: onboardingComplete, setIsComplete: setOnboardingComplete } = useOnboarding();
|
|
51
|
-
|
|
52
|
-
// Helper to get auth headers
|
|
53
|
-
const getAuthHeaders = (): Record<string, string> => {
|
|
54
|
-
return accessToken ? { Authorization: `Bearer ${accessToken}` } : {};
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// Data hooks - only fetch when authenticated and onboarding complete
|
|
58
|
-
const shouldFetchData = isAuthenticated && onboardingComplete === true;
|
|
59
|
-
|
|
60
|
-
const {
|
|
61
|
-
agents,
|
|
62
|
-
loading,
|
|
63
|
-
runningCount,
|
|
64
|
-
fetchAgents,
|
|
65
|
-
createAgent,
|
|
66
|
-
updateAgent,
|
|
67
|
-
deleteAgent,
|
|
68
|
-
toggleAgent,
|
|
69
|
-
} = useAgents(shouldFetchData, currentProjectId);
|
|
70
|
-
|
|
71
|
-
const {
|
|
72
|
-
providers,
|
|
73
|
-
configuredProviders,
|
|
74
|
-
fetchProviders,
|
|
75
|
-
} = useProviders(shouldFetchData);
|
|
76
|
-
|
|
77
|
-
// Filter to only LLM providers for agent creation
|
|
78
|
-
const llmProviders = configuredProviders.filter(p => p.type === "llm");
|
|
79
|
-
|
|
80
|
-
// Project-scoped agent count (same logic as AgentsView)
|
|
81
|
-
const filteredAgentCount = useMemo(() => {
|
|
82
|
-
if (currentProjectId === null) return agents.length;
|
|
83
|
-
if (currentProjectId === "unassigned") return agents.filter(a => !a.projectId).length;
|
|
84
|
-
return agents.filter(a => a.projectId === currentProjectId).length;
|
|
85
|
-
}, [agents, currentProjectId]);
|
|
86
|
-
|
|
87
|
-
// UI state
|
|
88
|
-
const [showCreate, setShowCreate] = useState(false);
|
|
89
|
-
const [selectedAgent, setSelectedAgent] = useState<Agent | null>(null);
|
|
90
|
-
const [route, setRoute] = useState<Route>("dashboard");
|
|
91
|
-
const [startError, setStartError] = useState<string | null>(null);
|
|
92
|
-
const [taskCount, setTaskCount] = useState(0);
|
|
93
|
-
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
|
94
|
-
|
|
95
|
-
// Fetch task count on telemetry status changes (project-scoped)
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
if (!shouldFetchData) return;
|
|
98
|
-
|
|
99
|
-
const fetchTaskCount = async () => {
|
|
100
|
-
try {
|
|
101
|
-
let url = "/api/tasks?status=pending";
|
|
102
|
-
if (currentProjectId !== null) {
|
|
103
|
-
url += `&project_id=${encodeURIComponent(currentProjectId)}`;
|
|
104
|
-
}
|
|
105
|
-
const res = await fetch(url, { headers: getAuthHeaders() });
|
|
106
|
-
if (res.ok) {
|
|
107
|
-
const data = await res.json();
|
|
108
|
-
setTaskCount(data.count ?? (data.tasks || []).length);
|
|
109
|
-
}
|
|
110
|
-
} catch {
|
|
111
|
-
// Ignore errors
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
fetchTaskCount();
|
|
116
|
-
}, [shouldFetchData, accessToken, currentProjectId, statusChangeCounter, taskChangeCounter]);
|
|
117
|
-
|
|
118
|
-
// Form state
|
|
119
|
-
const [newAgent, setNewAgent] = useState<NewAgentForm>({
|
|
120
|
-
name: "",
|
|
121
|
-
model: "",
|
|
122
|
-
provider: "",
|
|
123
|
-
systemPrompt: "You are a helpful assistant.",
|
|
124
|
-
features: { ...DEFAULT_FEATURES },
|
|
125
|
-
mcpServers: [],
|
|
126
|
-
skills: [],
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
// Set default provider when providers are loaded
|
|
130
|
-
useEffect(() => {
|
|
131
|
-
if (llmProviders.length > 0 && !newAgent.provider) {
|
|
132
|
-
const defaultProvider = llmProviders[0];
|
|
133
|
-
const defaultModel = defaultProvider.models.find(m => m.recommended)?.value || defaultProvider.models[0]?.value || "";
|
|
134
|
-
setNewAgent(prev => ({
|
|
135
|
-
...prev,
|
|
136
|
-
provider: defaultProvider.id,
|
|
137
|
-
model: defaultModel,
|
|
138
|
-
}));
|
|
139
|
-
}
|
|
140
|
-
}, [llmProviders, newAgent.provider]);
|
|
141
|
-
|
|
142
|
-
// Update selected agent when agents list changes
|
|
143
|
-
useEffect(() => {
|
|
144
|
-
if (selectedAgent) {
|
|
145
|
-
const updated = agents.find(a => a.id === selectedAgent.id);
|
|
146
|
-
if (updated) {
|
|
147
|
-
setSelectedAgent(updated);
|
|
148
|
-
} else {
|
|
149
|
-
setSelectedAgent(null);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}, [agents, selectedAgent]);
|
|
153
|
-
|
|
154
|
-
const handleProviderChange = (providerId: string) => {
|
|
155
|
-
const provider = providers.find(p => p.id === providerId);
|
|
156
|
-
const defaultModel = provider?.models.find(m => m.recommended)?.value || provider?.models[0]?.value || "";
|
|
157
|
-
setNewAgent(prev => ({
|
|
158
|
-
...prev,
|
|
159
|
-
provider: providerId,
|
|
160
|
-
model: defaultModel,
|
|
161
|
-
}));
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const handleCreateAgent = async () => {
|
|
165
|
-
if (!newAgent.name) return;
|
|
166
|
-
await createAgent(newAgent);
|
|
167
|
-
await refreshProjects(); // Refresh project agent counts
|
|
168
|
-
const defaultProvider = llmProviders[0];
|
|
169
|
-
const defaultModel = defaultProvider?.models.find(m => m.recommended)?.value || defaultProvider?.models[0]?.value || "";
|
|
170
|
-
setNewAgent({
|
|
171
|
-
name: "",
|
|
172
|
-
model: defaultModel,
|
|
173
|
-
provider: defaultProvider?.id || "",
|
|
174
|
-
systemPrompt: "You are a helpful assistant.",
|
|
175
|
-
features: { ...DEFAULT_FEATURES },
|
|
176
|
-
mcpServers: [],
|
|
177
|
-
skills: [],
|
|
178
|
-
});
|
|
179
|
-
setShowCreate(false);
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
const handleToggleAgent = async (agent: Agent, e?: React.MouseEvent) => {
|
|
183
|
-
e?.stopPropagation();
|
|
184
|
-
setStartError(null);
|
|
185
|
-
const result = await toggleAgent(agent);
|
|
186
|
-
if (result.error) {
|
|
187
|
-
setStartError(result.error);
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const handleDeleteAgent = async (id: string, e?: React.MouseEvent) => {
|
|
192
|
-
e?.stopPropagation();
|
|
193
|
-
if (selectedAgent?.id === id) {
|
|
194
|
-
setSelectedAgent(null);
|
|
195
|
-
}
|
|
196
|
-
await deleteAgent(id);
|
|
197
|
-
await refreshProjects(); // Refresh project agent counts
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
const handleSelectAgent = (agent: Agent) => {
|
|
201
|
-
setSelectedAgent(agent);
|
|
202
|
-
setStartError(null);
|
|
203
|
-
setRoute("agents");
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
const handleNavigate = (newRoute: Route) => {
|
|
207
|
-
setRoute(newRoute);
|
|
208
|
-
setSelectedAgent(null);
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
const handleOnboardingComplete = () => {
|
|
212
|
-
setOnboardingComplete(true);
|
|
213
|
-
fetchProviders();
|
|
214
|
-
// Refresh auth to pick up new state
|
|
215
|
-
checkAuth();
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
// Show loading while checking auth
|
|
219
|
-
if (authLoading || hasUsers === null) {
|
|
220
|
-
return <LoadingSpinner fullScreen />;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// No users exist - show onboarding with account creation
|
|
224
|
-
if (!hasUsers) {
|
|
225
|
-
return <OnboardingWizard onComplete={handleOnboardingComplete} needsAccount={true} />;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// Users exist but not authenticated - show login
|
|
229
|
-
if (!isAuthenticated) {
|
|
230
|
-
return <LoginPage />;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// Show loading while checking onboarding
|
|
234
|
-
if (onboardingComplete === null) {
|
|
235
|
-
return <LoadingSpinner fullScreen />;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// Show onboarding if not complete (but already has account)
|
|
239
|
-
if (!onboardingComplete) {
|
|
240
|
-
return <OnboardingWizard onComplete={handleOnboardingComplete} needsAccount={false} />;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return (
|
|
244
|
-
<div className="h-screen flex flex-col overflow-hidden" style={{ backgroundColor: "var(--color-bg)", color: "var(--color-text)" }}>
|
|
245
|
-
<Header onMenuClick={() => setMobileMenuOpen(true)} agents={agents} />
|
|
246
|
-
|
|
247
|
-
{startError && (
|
|
248
|
-
<ErrorBanner message={startError} onDismiss={() => setStartError(null)} />
|
|
249
|
-
)}
|
|
250
|
-
|
|
251
|
-
<div className="flex flex-1 overflow-hidden">
|
|
252
|
-
<Sidebar
|
|
253
|
-
route={route}
|
|
254
|
-
agentCount={filteredAgentCount}
|
|
255
|
-
taskCount={taskCount}
|
|
256
|
-
onNavigate={handleNavigate}
|
|
257
|
-
isOpen={mobileMenuOpen}
|
|
258
|
-
onClose={() => setMobileMenuOpen(false)}
|
|
259
|
-
/>
|
|
260
|
-
|
|
261
|
-
<main className="flex-1 overflow-hidden flex">
|
|
262
|
-
<Suspense fallback={<LoadingSpinner />}>
|
|
263
|
-
{route === "settings" && <SettingsPage />}
|
|
264
|
-
|
|
265
|
-
{route === "agents" && (
|
|
266
|
-
<AgentsView
|
|
267
|
-
agents={agents}
|
|
268
|
-
loading={loading}
|
|
269
|
-
selectedAgent={selectedAgent}
|
|
270
|
-
providers={providers}
|
|
271
|
-
onSelectAgent={handleSelectAgent}
|
|
272
|
-
onCloseAgent={() => setSelectedAgent(null)}
|
|
273
|
-
onToggleAgent={handleToggleAgent}
|
|
274
|
-
onDeleteAgent={handleDeleteAgent}
|
|
275
|
-
onUpdateAgent={updateAgent}
|
|
276
|
-
onNewAgent={() => setShowCreate(true)}
|
|
277
|
-
canCreateAgent={llmProviders.length > 0}
|
|
278
|
-
/>
|
|
279
|
-
)}
|
|
280
|
-
|
|
281
|
-
{route === "dashboard" && (
|
|
282
|
-
<Dashboard
|
|
283
|
-
agents={agents}
|
|
284
|
-
loading={loading}
|
|
285
|
-
runningCount={runningCount}
|
|
286
|
-
configuredProviders={configuredProviders}
|
|
287
|
-
onNavigate={handleNavigate}
|
|
288
|
-
onSelectAgent={handleSelectAgent}
|
|
289
|
-
/>
|
|
290
|
-
)}
|
|
291
|
-
|
|
292
|
-
{route === "threads" && (
|
|
293
|
-
<ThreadsPage
|
|
294
|
-
agents={agents}
|
|
295
|
-
onNavigate={setRoute}
|
|
296
|
-
/>
|
|
297
|
-
)}
|
|
298
|
-
|
|
299
|
-
{route === "activity" && (
|
|
300
|
-
<ActivityPage
|
|
301
|
-
agents={agents}
|
|
302
|
-
loading={loading}
|
|
303
|
-
onNavigate={handleNavigate}
|
|
304
|
-
/>
|
|
305
|
-
)}
|
|
306
|
-
|
|
307
|
-
{route === "tasks" && <TasksPage />}
|
|
308
|
-
|
|
309
|
-
{route === "connections" && <ConnectionsPage />}
|
|
310
|
-
|
|
311
|
-
{route === "mcp" && <McpPage />}
|
|
312
|
-
|
|
313
|
-
{route === "skills" && <SkillsPage />}
|
|
314
|
-
|
|
315
|
-
{route === "tests" && <TestsPage />}
|
|
316
|
-
|
|
317
|
-
{route === "analytics" && <TelemetryPage />}
|
|
318
|
-
|
|
319
|
-
{route === "api" && <ApiDocsPage />}
|
|
320
|
-
</Suspense>
|
|
321
|
-
</main>
|
|
322
|
-
</div>
|
|
323
|
-
|
|
324
|
-
{showCreate && (
|
|
325
|
-
<CreateAgentModal
|
|
326
|
-
form={newAgent}
|
|
327
|
-
providers={providers}
|
|
328
|
-
configuredProviders={configuredProviders}
|
|
329
|
-
onFormChange={setNewAgent}
|
|
330
|
-
onProviderChange={handleProviderChange}
|
|
331
|
-
onCreate={handleCreateAgent}
|
|
332
|
-
onClose={() => setShowCreate(false)}
|
|
333
|
-
onGoToSettings={() => {
|
|
334
|
-
setShowCreate(false);
|
|
335
|
-
setRoute("settings");
|
|
336
|
-
}}
|
|
337
|
-
/>
|
|
338
|
-
)}
|
|
339
|
-
|
|
340
|
-
{/* Meta Agent - side drawer */}
|
|
341
|
-
<MetaAgentPanel />
|
|
342
|
-
</div>
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// ==================== Share Page (public, no auth) ====================
|
|
347
|
-
function SharePage({ token }: { token: string }) {
|
|
348
|
-
const { theme } = useTheme();
|
|
349
|
-
const [status, setStatus] = useState<"checking" | "online" | "offline">("checking");
|
|
350
|
-
const [agentName, setAgentName] = useState("Agent");
|
|
351
|
-
const [voiceEnabled, setVoiceEnabled] = useState(false);
|
|
352
|
-
|
|
353
|
-
useEffect(() => {
|
|
354
|
-
const check = async () => {
|
|
355
|
-
try {
|
|
356
|
-
const res = await fetch(`/share/${token}/info`);
|
|
357
|
-
if (res.ok) {
|
|
358
|
-
const data = await res.json();
|
|
359
|
-
setAgentName(data.name || "Agent");
|
|
360
|
-
setVoiceEnabled(!!data.voiceEnabled);
|
|
361
|
-
setStatus(data.status === "running" ? "online" : "offline");
|
|
362
|
-
} else {
|
|
363
|
-
setStatus("offline");
|
|
364
|
-
}
|
|
365
|
-
} catch {
|
|
366
|
-
setStatus("offline");
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
check();
|
|
370
|
-
const interval = setInterval(check, 15000);
|
|
371
|
-
return () => clearInterval(interval);
|
|
372
|
-
}, [token]);
|
|
373
|
-
|
|
374
|
-
if (status === "checking") {
|
|
375
|
-
return (
|
|
376
|
-
<div className="min-h-[100dvh] flex items-center justify-center" style={{ backgroundColor: "var(--color-bg)" }}>
|
|
377
|
-
<div className="text-sm" style={{ color: "var(--color-text-muted)" }}>Connecting...</div>
|
|
378
|
-
</div>
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
if (status === "offline") {
|
|
383
|
-
return (
|
|
384
|
-
<div className="min-h-[100dvh] flex items-center justify-center" style={{ backgroundColor: "var(--color-bg)" }}>
|
|
385
|
-
<div className="text-center">
|
|
386
|
-
<div className="w-2.5 h-2.5 rounded-full mx-auto mb-3" style={{ backgroundColor: "var(--color-text-muted)" }} />
|
|
387
|
-
<div className="text-base font-semibold mb-1.5" style={{ color: "var(--color-text)" }}>{agentName}</div>
|
|
388
|
-
<div className="text-sm" style={{ color: "var(--color-text-muted)" }}>This agent is currently offline</div>
|
|
389
|
-
</div>
|
|
390
|
-
</div>
|
|
391
|
-
);
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
return (
|
|
395
|
-
<div className="min-h-[100dvh] flex items-center justify-center p-0 md:p-4" style={{ backgroundColor: "var(--color-bg)" }}>
|
|
396
|
-
<div className="w-full max-w-[640px] h-[100dvh] md:h-[calc(100dvh-32px)] md:max-h-[800px] md:rounded-xl overflow-hidden md:border flex flex-col" style={{ backgroundColor: "var(--color-bg)", borderColor: "var(--color-border)" }}>
|
|
397
|
-
{voiceEnabled ? (
|
|
398
|
-
<Call
|
|
399
|
-
agentId="default"
|
|
400
|
-
agentName={agentName}
|
|
401
|
-
apiUrl={`/share/${token}`}
|
|
402
|
-
variant="default"
|
|
403
|
-
theme={theme.id as "light" | "dark"}
|
|
404
|
-
showTranscript={false}
|
|
405
|
-
/>
|
|
406
|
-
) : (
|
|
407
|
-
<Chat
|
|
408
|
-
agentId="default"
|
|
409
|
-
apiUrl={`/share/${token}`}
|
|
410
|
-
placeholder="Type a message..."
|
|
411
|
-
variant="terminal"
|
|
412
|
-
theme={theme.id as "light" | "dark"}
|
|
413
|
-
headerTitle={agentName}
|
|
414
|
-
enableMarkdown
|
|
415
|
-
enableWidgets
|
|
416
|
-
availableWidgets={["form", "kpi"]}
|
|
417
|
-
/>
|
|
418
|
-
)}
|
|
419
|
-
</div>
|
|
420
|
-
</div>
|
|
421
|
-
);
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
// Wrapper component that provides all contexts
|
|
425
|
-
function App() {
|
|
426
|
-
// Check if this is a /share/:token URL — render public share page without auth
|
|
427
|
-
const shareMatch = window.location.pathname.match(/^\/share\/([a-f0-9]{32})$/);
|
|
428
|
-
if (shareMatch) {
|
|
429
|
-
return (
|
|
430
|
-
<ThemeProvider>
|
|
431
|
-
<SharePage token={shareMatch[1]} />
|
|
432
|
-
</ThemeProvider>
|
|
433
|
-
);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
return (
|
|
437
|
-
<ThemeProvider>
|
|
438
|
-
<UIModeProvider>
|
|
439
|
-
<AuthProvider>
|
|
440
|
-
<ProjectProvider>
|
|
441
|
-
<MetaAgentProvider>
|
|
442
|
-
<TelemetryProvider>
|
|
443
|
-
<AppContent />
|
|
444
|
-
</TelemetryProvider>
|
|
445
|
-
</MetaAgentProvider>
|
|
446
|
-
</ProjectProvider>
|
|
447
|
-
</AuthProvider>
|
|
448
|
-
</UIModeProvider>
|
|
449
|
-
</ThemeProvider>
|
|
450
|
-
);
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
// Mount the app
|
|
454
|
-
const root = createRoot(document.getElementById("root")!);
|
|
455
|
-
root.render(<App />);
|