apteva 0.4.57 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +216 -54
  2. package/cli.js +35 -0
  3. package/install.js +92 -0
  4. package/package.json +12 -79
  5. package/LICENSE +0 -63
  6. package/bin/apteva.js +0 -196
  7. package/dist/ActivityPage.kxzzb4yc.js +0 -3
  8. package/dist/ApiDocsPage.zq998hbm.js +0 -4
  9. package/dist/App.55rea8mn.js +0 -61
  10. package/dist/App.5ywb23z4.js +0 -53
  11. package/dist/App.6thds120.js +0 -4
  12. package/dist/App.9tctxzqm.js +0 -8
  13. package/dist/App.a8r8ttaz.js +0 -4
  14. package/dist/App.agsv5bje.js +0 -4
  15. package/dist/App.cepapqmx.js +0 -4
  16. package/dist/App.dp041gb3.js +0 -221
  17. package/dist/App.fds72zb5.js +0 -4
  18. package/dist/App.fg9qj2dq.js +0 -4
  19. package/dist/App.ndfejbm9.js +0 -4
  20. package/dist/App.nxmfmq1h.js +0 -13
  21. package/dist/App.qdfyt8ba.js +0 -4
  22. package/dist/App.x2d0ygt6.js +0 -4
  23. package/dist/App.yt9p4nr3.js +0 -20
  24. package/dist/App.zn4mw16t.js +0 -1
  25. package/dist/ConnectionsPage.8r96ryw7.js +0 -3
  26. package/dist/McpPage.3cwh0gnd.js +0 -3
  27. package/dist/SettingsPage.ykgdh5ev.js +0 -3
  28. package/dist/SkillsPage.4np1s65b.js +0 -3
  29. package/dist/TasksPage.4g08t7p6.js +0 -3
  30. package/dist/TelemetryPage.72w9pwcp.js +0 -3
  31. package/dist/TestsPage.z4fk3r7r.js +0 -3
  32. package/dist/ThreadsPage.63tcajeh.js +0 -3
  33. package/dist/apteva-kit.css +0 -1
  34. package/dist/icon.png +0 -0
  35. package/dist/index.html +0 -16
  36. package/dist/styles.css +0 -1
  37. package/scripts/postinstall.mjs +0 -102
  38. package/src/auth/index.ts +0 -394
  39. package/src/auth/middleware.ts +0 -213
  40. package/src/binary.ts +0 -536
  41. package/src/channels/index.ts +0 -40
  42. package/src/channels/telegram.ts +0 -311
  43. package/src/crypto.ts +0 -301
  44. package/src/db-tests.ts +0 -174
  45. package/src/db.ts +0 -3133
  46. package/src/integrations/agentdojo.ts +0 -559
  47. package/src/integrations/composio.ts +0 -437
  48. package/src/integrations/index.ts +0 -87
  49. package/src/integrations/skillsmp.ts +0 -318
  50. package/src/mcp-client.ts +0 -605
  51. package/src/mcp-handler.ts +0 -394
  52. package/src/mcp-platform.ts +0 -2403
  53. package/src/openapi.ts +0 -2410
  54. package/src/providers.ts +0 -597
  55. package/src/routes/api/agent-utils.ts +0 -890
  56. package/src/routes/api/agents.ts +0 -916
  57. package/src/routes/api/api-keys.ts +0 -95
  58. package/src/routes/api/channels.ts +0 -182
  59. package/src/routes/api/helpers.ts +0 -12
  60. package/src/routes/api/integrations.ts +0 -639
  61. package/src/routes/api/mcp.ts +0 -574
  62. package/src/routes/api/meta-agent.ts +0 -195
  63. package/src/routes/api/projects.ts +0 -112
  64. package/src/routes/api/providers.ts +0 -424
  65. package/src/routes/api/skills.ts +0 -537
  66. package/src/routes/api/system.ts +0 -333
  67. package/src/routes/api/telemetry.ts +0 -203
  68. package/src/routes/api/tests.ts +0 -148
  69. package/src/routes/api/triggers.ts +0 -518
  70. package/src/routes/api/users.ts +0 -148
  71. package/src/routes/api/webhooks.ts +0 -171
  72. package/src/routes/api.ts +0 -53
  73. package/src/routes/auth.ts +0 -251
  74. package/src/routes/share.ts +0 -86
  75. package/src/routes/static.ts +0 -131
  76. package/src/server.ts +0 -642
  77. package/src/test-runner.ts +0 -598
  78. package/src/triggers/agentdojo.ts +0 -253
  79. package/src/triggers/composio.ts +0 -264
  80. package/src/triggers/index.ts +0 -71
  81. package/src/tui/AgentList.tsx +0 -145
  82. package/src/tui/App.tsx +0 -102
  83. package/src/tui/Login.tsx +0 -104
  84. package/src/tui/api.ts +0 -72
  85. package/src/tui/index.tsx +0 -7
  86. package/src/web/App.tsx +0 -455
  87. package/src/web/components/activity/ActivityPage.tsx +0 -314
  88. package/src/web/components/activity/index.ts +0 -1
  89. package/src/web/components/agents/AgentCard.tsx +0 -189
  90. package/src/web/components/agents/AgentPanel.tsx +0 -2244
  91. package/src/web/components/agents/AgentsView.tsx +0 -180
  92. package/src/web/components/agents/CreateAgentModal.tsx +0 -475
  93. package/src/web/components/agents/index.ts +0 -4
  94. package/src/web/components/api/ApiDocsPage.tsx +0 -842
  95. package/src/web/components/auth/CreateAccountStep.tsx +0 -176
  96. package/src/web/components/auth/LoginPage.tsx +0 -91
  97. package/src/web/components/auth/index.ts +0 -2
  98. package/src/web/components/common/Icons.tsx +0 -250
  99. package/src/web/components/common/LoadingSpinner.tsx +0 -44
  100. package/src/web/components/common/Modal.tsx +0 -199
  101. package/src/web/components/common/Select.tsx +0 -97
  102. package/src/web/components/common/index.ts +0 -20
  103. package/src/web/components/connections/ConnectionsPage.tsx +0 -54
  104. package/src/web/components/connections/IntegrationsTab.tsx +0 -170
  105. package/src/web/components/connections/OverviewTab.tsx +0 -137
  106. package/src/web/components/connections/TriggersTab.tsx +0 -1346
  107. package/src/web/components/dashboard/Dashboard.tsx +0 -572
  108. package/src/web/components/dashboard/index.ts +0 -1
  109. package/src/web/components/index.ts +0 -21
  110. package/src/web/components/layout/ErrorBanner.tsx +0 -18
  111. package/src/web/components/layout/Header.tsx +0 -332
  112. package/src/web/components/layout/Sidebar.tsx +0 -231
  113. package/src/web/components/layout/index.ts +0 -3
  114. package/src/web/components/mcp/IntegrationsPanel.tsx +0 -857
  115. package/src/web/components/mcp/McpPage.tsx +0 -2515
  116. package/src/web/components/mcp/index.ts +0 -1
  117. package/src/web/components/meta-agent/MetaAgent.tsx +0 -245
  118. package/src/web/components/onboarding/OnboardingWizard.tsx +0 -404
  119. package/src/web/components/onboarding/index.ts +0 -1
  120. package/src/web/components/settings/SettingsPage.tsx +0 -2776
  121. package/src/web/components/settings/index.ts +0 -1
  122. package/src/web/components/skills/SkillsPage.tsx +0 -1200
  123. package/src/web/components/tasks/TasksPage.tsx +0 -1116
  124. package/src/web/components/tasks/index.ts +0 -1
  125. package/src/web/components/telemetry/TelemetryPage.tsx +0 -1129
  126. package/src/web/components/tests/TestsPage.tsx +0 -594
  127. package/src/web/components/threads/ThreadsPage.tsx +0 -315
  128. package/src/web/context/AuthContext.tsx +0 -242
  129. package/src/web/context/ProjectContext.tsx +0 -214
  130. package/src/web/context/TelemetryContext.tsx +0 -299
  131. package/src/web/context/ThemeContext.tsx +0 -90
  132. package/src/web/context/UIModeContext.tsx +0 -49
  133. package/src/web/context/index.ts +0 -12
  134. package/src/web/hooks/index.ts +0 -3
  135. package/src/web/hooks/useAgents.ts +0 -115
  136. package/src/web/hooks/useOnboarding.ts +0 -20
  137. package/src/web/hooks/useProviders.ts +0 -75
  138. package/src/web/icon.png +0 -0
  139. package/src/web/index.html +0 -16
  140. package/src/web/styles.css +0 -118
  141. package/src/web/themes.ts +0 -162
  142. package/src/web/types.ts +0 -298
@@ -1,195 +0,0 @@
1
- import { json } from "./helpers";
2
- import { META_AGENT_ENABLED, META_AGENT_ID, toApiAgent, startAgentProcess, setAgentStatus } from "./agent-utils";
3
- import { AgentDB } from "../../db";
4
- import { ProviderKeys, Onboarding, PROVIDERS } from "../../providers";
5
- import { agentProcesses } from "../../server";
6
-
7
- export async function handleMetaAgentRoutes(
8
- req: Request,
9
- path: string,
10
- method: string,
11
- ): Promise<Response | null> {
12
- // GET /api/meta-agent/status - Get meta agent status and config
13
- if (path === "/api/meta-agent/status" && method === "GET") {
14
- if (!META_AGENT_ENABLED) {
15
- return json({ enabled: false });
16
- }
17
-
18
- // Check if onboarding is complete
19
- if (!Onboarding.isComplete()) {
20
- return json({ enabled: true, available: false, reason: "onboarding_incomplete" });
21
- }
22
-
23
- // Get first configured provider
24
- const configuredProviders = ProviderKeys.getConfiguredProviders();
25
- if (configuredProviders.length === 0) {
26
- return json({ enabled: true, available: false, reason: "no_provider" });
27
- }
28
-
29
- const providerId = configuredProviders[0] as keyof typeof PROVIDERS;
30
- const provider = PROVIDERS[providerId];
31
- if (!provider) {
32
- return json({ enabled: true, available: false, reason: "invalid_provider" });
33
- }
34
-
35
- // Check if meta agent exists, create if not
36
- let metaAgent = AgentDB.findById(META_AGENT_ID);
37
- if (!metaAgent) {
38
- // Find a recommended model or use first one
39
- const defaultModel = provider.models.find((m: any) => m.recommended)?.value || provider.models[0]?.value;
40
- if (!defaultModel) {
41
- return json({ enabled: true, available: false, reason: "no_model" });
42
- }
43
-
44
- // Create the meta agent
45
- metaAgent = AgentDB.create({
46
- id: META_AGENT_ID,
47
- name: "Apteva Assistant",
48
- model: defaultModel,
49
- provider: providerId,
50
- system_prompt: `You are the Apteva Assistant, an AI that manages the Apteva agent platform. You have full control over the platform via your tools.
51
-
52
- WHAT YOU CAN DO:
53
- - **Agents**: Create, configure, start, stop, and delete AI agents
54
- - **Projects**: Create projects and organize agents into them
55
- - **MCP Servers**: Add tool integrations (HTTP, npm, pip) and assign them to agents
56
- - **Skills**: List, enable/disable, and assign skills to agents
57
- - **Providers**: Check which LLM providers have API keys configured
58
- - **Communication**: Send messages to running agents
59
- - **Integrations**: Connect third-party apps (GitHub, Slack, etc.) via API key, create MCP servers from them, and add them locally
60
- - **Tests**: Create and run automated tests for agent workflows
61
- - **Triggers**: Subscribe agents to external events (webhooks)
62
-
63
- WORKFLOW FOR CREATING AGENTS:
64
- 1. Use list_providers to check which providers have API keys
65
- 2. Use create_agent with a provider that has a key, pick a model, write a good system prompt
66
- 3. Optionally assign MCP servers (for tools) and skills (for behavior)
67
- 4. Use start_agent to run it
68
-
69
- WORKFLOW FOR ADDING INTEGRATIONS:
70
- 1. Use list_integration_providers to see available providers (agentdojo, composio)
71
- 2. Use list_integration_apps to browse available apps/toolkits
72
- 3. Use connect_integration_app to authenticate with an API key (for OAuth, direct user to Browse Toolkits UI)
73
- 4. Use create_integration_config to create an MCP server from the connected app
74
- 5. Use add_integration_config_locally to add it as a local MCP server
75
- 6. Use assign_mcp_server_to_agent to give an agent access
76
-
77
- AGENT FEATURES (enable when creating/updating):
78
- - **memory**: Persistent memory across conversations (needs OpenAI key for embeddings)
79
- - **tasks**: Scheduling and task tracking
80
- - **vision**: Image and PDF understanding
81
- - **mcp**: Required if assigning MCP servers — gives the agent tool-use capability
82
- - **files**: File read/write in agent workspace
83
-
84
- CRITICAL — PROJECT CONTEXT:
85
- Your chat context tells you the current project (name and id). **You MUST pass this project_id to EVERY tool call that accepts a project_id parameter.** API keys, integrations, MCP servers, and agents are scoped per project — calls without project_id will fail to find them. Extract the id from your context and always include it.
86
-
87
- ALWAYS use your tools proactively. When a user says "create an agent", don't explain how — just do it. Confirm what you did after.
88
- Be concise. Use markdown formatting.`,
89
- features: {
90
- memory: false,
91
- tasks: false,
92
- vision: false,
93
- operator: false,
94
- mcp: true,
95
- realtime: false,
96
- files: false,
97
- agents: false,
98
- builtinTools: {
99
- webSearch: providerId === "anthropic",
100
- webFetch: providerId === "anthropic",
101
- },
102
- },
103
- mcp_servers: [],
104
- skills: [],
105
- project_id: null, // Meta agent belongs to no project
106
- } as any);
107
- }
108
-
109
- // Return status
110
- return json({
111
- enabled: true,
112
- available: true,
113
- agent: {
114
- id: metaAgent.id,
115
- name: metaAgent.name,
116
- status: metaAgent.status,
117
- port: metaAgent.port,
118
- provider: metaAgent.provider,
119
- model: metaAgent.model,
120
- features: metaAgent.features,
121
- systemPrompt: metaAgent.system_prompt,
122
- },
123
- });
124
- }
125
-
126
- // POST /api/meta-agent/start - Start the meta agent
127
- if (path === "/api/meta-agent/start" && method === "POST") {
128
- if (!META_AGENT_ENABLED) {
129
- return json({ error: "Meta agent is not enabled" }, 400);
130
- }
131
-
132
- const metaAgent = AgentDB.findById(META_AGENT_ID);
133
- if (!metaAgent) {
134
- return json({ error: "Meta agent not found" }, 404);
135
- }
136
-
137
- if (metaAgent.status === "running") {
138
- return json({ agent: toApiAgent(metaAgent), message: "Already running" });
139
- }
140
-
141
- // Ensure builtinTools are enabled for anthropic provider
142
- if (metaAgent.provider === "anthropic" && !metaAgent.features?.builtinTools?.webSearch) {
143
- const updatedFeatures = {
144
- ...metaAgent.features,
145
- builtinTools: { webSearch: true, webFetch: true },
146
- };
147
- AgentDB.update(META_AGENT_ID, { features: updatedFeatures });
148
- console.log(`[meta-agent] Enabled builtinTools for anthropic provider`);
149
- }
150
- // Always re-read to get latest features
151
- const freshAgent = AgentDB.findById(META_AGENT_ID);
152
- if (!freshAgent) {
153
- return json({ error: "Meta agent not found after update" }, 500);
154
- }
155
- console.log(`[meta-agent] Starting with builtinTools:`, JSON.stringify(freshAgent.features?.builtinTools));
156
-
157
- // Start the agent using existing startAgentProcess function
158
- const result = await startAgentProcess(freshAgent, { silent: true });
159
- if (!result.success) {
160
- return json({ error: result.error || "Failed to start meta agent" }, 500);
161
- }
162
-
163
- const updated = AgentDB.findById(META_AGENT_ID);
164
- return json({ agent: updated ? toApiAgent(updated) : null });
165
- }
166
-
167
- // POST /api/meta-agent/stop - Stop the meta agent
168
- if (path === "/api/meta-agent/stop" && method === "POST") {
169
- if (!META_AGENT_ENABLED) {
170
- return json({ error: "Meta agent is not enabled" }, 400);
171
- }
172
-
173
- const metaAgent = AgentDB.findById(META_AGENT_ID);
174
- if (!metaAgent) {
175
- return json({ error: "Meta agent not found" }, 404);
176
- }
177
-
178
- if (metaAgent.status === "stopped") {
179
- return json({ agent: toApiAgent(metaAgent), message: "Already stopped" });
180
- }
181
-
182
- // Stop the agent
183
- const proc = agentProcesses.get(META_AGENT_ID);
184
- if (proc) {
185
- proc.proc.kill(); // BUG FIX: was proc.kill() which would fail
186
- agentProcesses.delete(META_AGENT_ID);
187
- }
188
- setAgentStatus(META_AGENT_ID, "stopped", "user_stopped");
189
-
190
- const updated = AgentDB.findById(META_AGENT_ID);
191
- return json({ agent: updated ? toApiAgent(updated) : null });
192
- }
193
-
194
- return null;
195
- }
@@ -1,112 +0,0 @@
1
- import { json } from "./helpers";
2
- import { AgentDB, ProjectDB, type Project } from "../../db";
3
- import { toApiAgent, toApiAgentsBatch, toApiProject, setAgentStatus } from "./agent-utils";
4
- import { agentProcesses } from "../../server";
5
-
6
- export async function handleProjectRoutes(
7
- req: Request,
8
- path: string,
9
- method: string,
10
- authContext?: unknown,
11
- ): Promise<Response | null> {
12
- // GET /api/projects - List all projects
13
- if (path === "/api/projects" && method === "GET") {
14
- const projects = ProjectDB.findAll();
15
- const agentCounts = ProjectDB.getAgentCounts();
16
- return json({
17
- projects: projects.map(p => ({
18
- ...toApiProject(p),
19
- agentCount: agentCounts.get(p.id) || 0,
20
- })),
21
- unassignedCount: agentCounts.get(null) || 0,
22
- });
23
- }
24
-
25
- // POST /api/projects - Create a new project
26
- if (path === "/api/projects" && method === "POST") {
27
- try {
28
- const body = await req.json();
29
- const { name, description, color } = body;
30
-
31
- if (!name) {
32
- return json({ error: "Name is required" }, 400);
33
- }
34
-
35
- const project = ProjectDB.create({
36
- name,
37
- description: description || null,
38
- color: color || "#6366f1",
39
- });
40
-
41
- return json({ project: toApiProject(project) }, 201);
42
- } catch (e) {
43
- console.error("Create project error:", e);
44
- return json({ error: "Invalid request body" }, 400);
45
- }
46
- }
47
-
48
- // GET /api/projects/:id - Get a specific project
49
- const projectMatch = path.match(/^\/api\/projects\/([^/]+)$/);
50
- if (projectMatch && method === "GET") {
51
- const project = ProjectDB.findById(projectMatch[1]);
52
- if (!project) {
53
- return json({ error: "Project not found" }, 404);
54
- }
55
- const agents = AgentDB.findByProject(project.id);
56
- return json({
57
- project: toApiProject(project),
58
- agents: toApiAgentsBatch(agents),
59
- });
60
- }
61
-
62
- // PUT /api/projects/:id - Update a project
63
- if (projectMatch && method === "PUT") {
64
- const project = ProjectDB.findById(projectMatch[1]);
65
- if (!project) {
66
- return json({ error: "Project not found" }, 404);
67
- }
68
-
69
- try {
70
- const body = await req.json();
71
- const updates: Partial<Project> = {};
72
-
73
- if (body.name !== undefined) updates.name = body.name;
74
- if (body.description !== undefined) updates.description = body.description;
75
- if (body.color !== undefined) updates.color = body.color;
76
-
77
- const updated = ProjectDB.update(projectMatch[1], updates);
78
- return json({ project: updated ? toApiProject(updated) : null });
79
- } catch (e) {
80
- return json({ error: "Invalid request body" }, 400);
81
- }
82
- }
83
-
84
- // DELETE /api/projects/:id - Delete a project
85
- if (projectMatch && method === "DELETE") {
86
- const project = ProjectDB.findById(projectMatch[1]);
87
- if (!project) {
88
- return json({ error: "Project not found" }, 404);
89
- }
90
-
91
- // Stop any running agents in this project first - in parallel
92
- const projectAgents = AgentDB.findByProject(projectMatch[1]);
93
- await Promise.allSettled(projectAgents.map(async (agent) => {
94
- if (agent.status === "running") {
95
- const entry = agentProcesses.get(agent.id);
96
- if (entry) {
97
- try {
98
- await fetch(`http://localhost:${entry.port}/shutdown`, { method: "POST", signal: AbortSignal.timeout(1000) }).catch(() => {});
99
- entry.proc.kill();
100
- } catch {}
101
- agentProcesses.delete(agent.id);
102
- }
103
- setAgentStatus(agent.id, "stopped", "project_deleted");
104
- }
105
- }));
106
-
107
- ProjectDB.delete(projectMatch[1]);
108
- return json({ success: true });
109
- }
110
-
111
- return null;
112
- }