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
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import type { AuthContext } from "../../auth/middleware";
|
|
2
|
-
import { ApiKeyDB } from "../../db";
|
|
3
|
-
import { json } from "./helpers";
|
|
4
|
-
|
|
5
|
-
const MAX_KEYS_PER_USER = 10;
|
|
6
|
-
|
|
7
|
-
export async function handleApiKeyRoutes(
|
|
8
|
-
req: Request,
|
|
9
|
-
path: string,
|
|
10
|
-
method: string,
|
|
11
|
-
authContext?: AuthContext,
|
|
12
|
-
): Promise<Response | null> {
|
|
13
|
-
// All API key routes require authentication
|
|
14
|
-
if (!authContext?.isAuthenticated || !authContext.user) {
|
|
15
|
-
return null; // Let other handlers deal with it
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const userId = authContext.user.id;
|
|
19
|
-
|
|
20
|
-
// POST /api/keys/personal - Create a new API key
|
|
21
|
-
if (path === "/api/keys/personal" && method === "POST") {
|
|
22
|
-
try {
|
|
23
|
-
const body = await req.json();
|
|
24
|
-
const { name, expires_in_days } = body;
|
|
25
|
-
|
|
26
|
-
if (!name || typeof name !== "string" || name.trim().length === 0) {
|
|
27
|
-
return json({ error: "Name is required" }, 400);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (name.length > 100) {
|
|
31
|
-
return json({ error: "Name must be 100 characters or less" }, 400);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Limit keys per user
|
|
35
|
-
const count = ApiKeyDB.countByUser(userId);
|
|
36
|
-
if (count >= MAX_KEYS_PER_USER) {
|
|
37
|
-
return json({ error: `Maximum ${MAX_KEYS_PER_USER} API keys allowed per user` }, 400);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Calculate expiration
|
|
41
|
-
let expires_at: string | null = null;
|
|
42
|
-
if (expires_in_days && typeof expires_in_days === "number" && expires_in_days > 0) {
|
|
43
|
-
const expiry = new Date();
|
|
44
|
-
expiry.setDate(expiry.getDate() + expires_in_days);
|
|
45
|
-
expires_at = expiry.toISOString();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const { apiKey, rawKey } = ApiKeyDB.create({
|
|
49
|
-
name: name.trim(),
|
|
50
|
-
user_id: userId,
|
|
51
|
-
expires_at,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
return json({
|
|
55
|
-
id: apiKey.id,
|
|
56
|
-
name: apiKey.name,
|
|
57
|
-
key: rawKey,
|
|
58
|
-
prefix: apiKey.key_prefix,
|
|
59
|
-
expires_at: apiKey.expires_at,
|
|
60
|
-
created_at: apiKey.created_at,
|
|
61
|
-
}, 201);
|
|
62
|
-
} catch (e: any) {
|
|
63
|
-
return json({ error: e.message || "Failed to create API key" }, 500);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// GET /api/keys/personal - List user's API keys
|
|
68
|
-
if (path === "/api/keys/personal" && method === "GET") {
|
|
69
|
-
const keys = ApiKeyDB.findByUser(userId);
|
|
70
|
-
return json({
|
|
71
|
-
keys: keys.map(k => ({
|
|
72
|
-
id: k.id,
|
|
73
|
-
name: k.name,
|
|
74
|
-
prefix: k.key_prefix,
|
|
75
|
-
is_active: k.is_active,
|
|
76
|
-
expires_at: k.expires_at,
|
|
77
|
-
last_used_at: k.last_used_at,
|
|
78
|
-
created_at: k.created_at,
|
|
79
|
-
})),
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// DELETE /api/keys/personal/:id - Revoke/delete an API key
|
|
84
|
-
const deleteMatch = path.match(/^\/api\/keys\/personal\/([^/]+)$/);
|
|
85
|
-
if (deleteMatch && method === "DELETE") {
|
|
86
|
-
const keyId = deleteMatch[1];
|
|
87
|
-
const deleted = ApiKeyDB.delete(keyId, userId);
|
|
88
|
-
if (!deleted) {
|
|
89
|
-
return json({ error: "API key not found" }, 404);
|
|
90
|
-
}
|
|
91
|
-
return json({ success: true });
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { json } from "./helpers";
|
|
2
|
-
import { ChannelDB, AgentDB } from "../../db";
|
|
3
|
-
import { encryptObject } from "../../crypto";
|
|
4
|
-
import { startChannel, stopChannel } from "../../channels";
|
|
5
|
-
|
|
6
|
-
export async function handleChannelRoutes(
|
|
7
|
-
req: Request,
|
|
8
|
-
path: string,
|
|
9
|
-
method: string,
|
|
10
|
-
): Promise<Response | null> {
|
|
11
|
-
// GET /api/channels - List all channels
|
|
12
|
-
if (path === "/api/channels" && method === "GET") {
|
|
13
|
-
const channels = ChannelDB.findAll();
|
|
14
|
-
// Strip encrypted config from list response
|
|
15
|
-
const safe = channels.map(ch => ({
|
|
16
|
-
id: ch.id,
|
|
17
|
-
type: ch.type,
|
|
18
|
-
name: ch.name,
|
|
19
|
-
agent_id: ch.agent_id,
|
|
20
|
-
status: ch.status,
|
|
21
|
-
error: ch.error,
|
|
22
|
-
project_id: ch.project_id,
|
|
23
|
-
created_at: ch.created_at,
|
|
24
|
-
updated_at: ch.updated_at,
|
|
25
|
-
}));
|
|
26
|
-
return json({ channels: safe });
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// POST /api/channels - Create a new channel
|
|
30
|
-
if (path === "/api/channels" && method === "POST") {
|
|
31
|
-
const body = await req.json();
|
|
32
|
-
const { type, name, agent_id, config, project_id } = body;
|
|
33
|
-
|
|
34
|
-
if (!type || !name || !agent_id || !config) {
|
|
35
|
-
return json({ error: "Missing required fields: type, name, agent_id, config" }, 400);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (type !== "telegram") {
|
|
39
|
-
return json({ error: `Unsupported channel type: ${type}. Supported: telegram` }, 400);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Validate agent exists
|
|
43
|
-
const agent = AgentDB.findById(agent_id);
|
|
44
|
-
if (!agent) {
|
|
45
|
-
return json({ error: "Agent not found" }, 404);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Validate config has required fields
|
|
49
|
-
if (!config.botToken) {
|
|
50
|
-
return json({ error: "Missing botToken in config" }, 400);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Encrypt config before storing
|
|
54
|
-
const encryptedConfig = encryptObject(config);
|
|
55
|
-
|
|
56
|
-
const channel = ChannelDB.create({
|
|
57
|
-
type,
|
|
58
|
-
name,
|
|
59
|
-
agent_id,
|
|
60
|
-
config: encryptedConfig,
|
|
61
|
-
project_id: project_id || null,
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
return json({
|
|
65
|
-
channel: {
|
|
66
|
-
id: channel.id,
|
|
67
|
-
type: channel.type,
|
|
68
|
-
name: channel.name,
|
|
69
|
-
agent_id: channel.agent_id,
|
|
70
|
-
status: channel.status,
|
|
71
|
-
error: channel.error,
|
|
72
|
-
project_id: channel.project_id,
|
|
73
|
-
created_at: channel.created_at,
|
|
74
|
-
},
|
|
75
|
-
}, 201);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Routes with channel ID
|
|
79
|
-
const channelMatch = path.match(/^\/api\/channels\/([^/]+)$/);
|
|
80
|
-
const channelActionMatch = path.match(/^\/api\/channels\/([^/]+)\/(start|stop)$/);
|
|
81
|
-
|
|
82
|
-
// GET /api/channels/:id - Get channel detail
|
|
83
|
-
if (channelMatch && method === "GET") {
|
|
84
|
-
const channel = ChannelDB.findById(channelMatch[1]);
|
|
85
|
-
if (!channel) return json({ error: "Channel not found" }, 404);
|
|
86
|
-
|
|
87
|
-
return json({
|
|
88
|
-
channel: {
|
|
89
|
-
id: channel.id,
|
|
90
|
-
type: channel.type,
|
|
91
|
-
name: channel.name,
|
|
92
|
-
agent_id: channel.agent_id,
|
|
93
|
-
status: channel.status,
|
|
94
|
-
error: channel.error,
|
|
95
|
-
project_id: channel.project_id,
|
|
96
|
-
created_at: channel.created_at,
|
|
97
|
-
updated_at: channel.updated_at,
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// PUT /api/channels/:id - Update channel
|
|
103
|
-
if (channelMatch && method === "PUT") {
|
|
104
|
-
const channel = ChannelDB.findById(channelMatch[1]);
|
|
105
|
-
if (!channel) return json({ error: "Channel not found" }, 404);
|
|
106
|
-
|
|
107
|
-
if (channel.status === "running") {
|
|
108
|
-
return json({ error: "Stop the channel before updating" }, 400);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const body = await req.json();
|
|
112
|
-
const updates: Record<string, any> = {};
|
|
113
|
-
|
|
114
|
-
if (body.name !== undefined) updates.name = body.name;
|
|
115
|
-
if (body.agent_id !== undefined) {
|
|
116
|
-
const agent = AgentDB.findById(body.agent_id);
|
|
117
|
-
if (!agent) return json({ error: "Agent not found" }, 404);
|
|
118
|
-
updates.agent_id = body.agent_id;
|
|
119
|
-
}
|
|
120
|
-
if (body.config !== undefined) {
|
|
121
|
-
if (!body.config.botToken) {
|
|
122
|
-
return json({ error: "Missing botToken in config" }, 400);
|
|
123
|
-
}
|
|
124
|
-
updates.config = encryptObject(body.config);
|
|
125
|
-
}
|
|
126
|
-
if (body.project_id !== undefined) updates.project_id = body.project_id;
|
|
127
|
-
|
|
128
|
-
const updated = ChannelDB.update(channelMatch[1], updates);
|
|
129
|
-
return json({
|
|
130
|
-
channel: updated ? {
|
|
131
|
-
id: updated.id,
|
|
132
|
-
type: updated.type,
|
|
133
|
-
name: updated.name,
|
|
134
|
-
agent_id: updated.agent_id,
|
|
135
|
-
status: updated.status,
|
|
136
|
-
project_id: updated.project_id,
|
|
137
|
-
} : null,
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// DELETE /api/channels/:id - Delete channel
|
|
142
|
-
if (channelMatch && method === "DELETE") {
|
|
143
|
-
const channel = ChannelDB.findById(channelMatch[1]);
|
|
144
|
-
if (!channel) return json({ error: "Channel not found" }, 404);
|
|
145
|
-
|
|
146
|
-
// Stop if running
|
|
147
|
-
if (channel.status === "running") {
|
|
148
|
-
await stopChannel(channel.id);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
ChannelDB.delete(channelMatch[1]);
|
|
152
|
-
return json({ deleted: true });
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// POST /api/channels/:id/start - Start channel
|
|
156
|
-
if (channelActionMatch && channelActionMatch[2] === "start" && method === "POST") {
|
|
157
|
-
const channel = ChannelDB.findById(channelActionMatch[1]);
|
|
158
|
-
if (!channel) return json({ error: "Channel not found" }, 404);
|
|
159
|
-
|
|
160
|
-
if (channel.status === "running") {
|
|
161
|
-
return json({ error: "Channel is already running" }, 400);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const result = await startChannel(channel.id);
|
|
165
|
-
if (!result.success) {
|
|
166
|
-
return json({ error: result.error || "Failed to start channel" }, 500);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return json({ started: true });
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// POST /api/channels/:id/stop - Stop channel
|
|
173
|
-
if (channelActionMatch && channelActionMatch[2] === "stop" && method === "POST") {
|
|
174
|
-
const channel = ChannelDB.findById(channelActionMatch[1]);
|
|
175
|
-
if (!channel) return json({ error: "Channel not found" }, 404);
|
|
176
|
-
|
|
177
|
-
await stopChannel(channel.id);
|
|
178
|
-
return json({ stopped: true });
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export function json(data: unknown, status = 200): Response {
|
|
2
|
-
return new Response(JSON.stringify(data), {
|
|
3
|
-
status,
|
|
4
|
-
headers: { "Content-Type": "application/json" },
|
|
5
|
-
});
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const isDev = process.env.NODE_ENV !== "production";
|
|
9
|
-
|
|
10
|
-
export function debug(...args: unknown[]) {
|
|
11
|
-
if (isDev) console.log("[api]", ...args);
|
|
12
|
-
}
|