apteva 0.2.3 → 0.2.6
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/App.0mzj9cz9.js +213 -0
- package/dist/index.html +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -6
- package/src/binary.ts +271 -1
- package/src/crypto.ts +53 -0
- package/src/db.ts +492 -3
- package/src/mcp-client.ts +599 -0
- package/src/providers.ts +31 -0
- package/src/routes/api.ts +832 -64
- package/src/server.ts +169 -5
- package/src/web/App.tsx +44 -2
- package/src/web/components/agents/AgentCard.tsx +53 -9
- package/src/web/components/agents/AgentPanel.tsx +381 -0
- package/src/web/components/agents/AgentsView.tsx +27 -10
- package/src/web/components/agents/CreateAgentModal.tsx +7 -7
- package/src/web/components/agents/index.ts +1 -1
- package/src/web/components/common/Icons.tsx +8 -0
- package/src/web/components/common/Modal.tsx +2 -2
- package/src/web/components/common/Select.tsx +1 -1
- package/src/web/components/common/index.ts +1 -0
- package/src/web/components/dashboard/Dashboard.tsx +74 -25
- package/src/web/components/index.ts +5 -2
- package/src/web/components/layout/Sidebar.tsx +22 -2
- package/src/web/components/mcp/McpPage.tsx +1144 -0
- package/src/web/components/mcp/index.ts +1 -0
- package/src/web/components/onboarding/OnboardingWizard.tsx +5 -1
- package/src/web/components/settings/SettingsPage.tsx +312 -82
- package/src/web/components/tasks/TasksPage.tsx +129 -0
- package/src/web/components/tasks/index.ts +1 -0
- package/src/web/components/telemetry/TelemetryPage.tsx +359 -0
- package/src/web/context/TelemetryContext.tsx +202 -0
- package/src/web/context/index.ts +2 -0
- package/src/web/hooks/useAgents.ts +23 -0
- package/src/web/styles.css +18 -0
- package/src/web/types.ts +75 -1
- package/dist/App.wfhmfhx7.js +0 -213
- package/src/web/components/agents/ChatPanel.tsx +0 -63
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { Agent, Provider, Route } from "../../types";
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import type { Agent, Provider, Route, DashboardStats, Task } from "../../types";
|
|
3
3
|
|
|
4
4
|
interface DashboardProps {
|
|
5
5
|
agents: Agent[];
|
|
@@ -18,16 +18,49 @@ export function Dashboard({
|
|
|
18
18
|
onNavigate,
|
|
19
19
|
onSelectAgent,
|
|
20
20
|
}: DashboardProps) {
|
|
21
|
+
const [stats, setStats] = useState<DashboardStats | null>(null);
|
|
22
|
+
const [recentTasks, setRecentTasks] = useState<Task[]>([]);
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
fetchDashboardData();
|
|
26
|
+
const interval = setInterval(fetchDashboardData, 10000);
|
|
27
|
+
return () => clearInterval(interval);
|
|
28
|
+
}, []);
|
|
29
|
+
|
|
30
|
+
const fetchDashboardData = async () => {
|
|
31
|
+
try {
|
|
32
|
+
const [dashRes, tasksRes] = await Promise.all([
|
|
33
|
+
fetch("/api/dashboard"),
|
|
34
|
+
fetch("/api/tasks?status=all"),
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
if (dashRes.ok) {
|
|
38
|
+
const data = await dashRes.json();
|
|
39
|
+
setStats(data);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (tasksRes.ok) {
|
|
43
|
+
const data = await tasksRes.json();
|
|
44
|
+
setRecentTasks((data.tasks || []).slice(0, 5));
|
|
45
|
+
}
|
|
46
|
+
} catch (e) {
|
|
47
|
+
console.error("Failed to fetch dashboard data:", e);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const taskStats = stats?.tasks || { total: 0, pending: 0, running: 0, completed: 0 };
|
|
52
|
+
|
|
21
53
|
return (
|
|
22
54
|
<div className="flex-1 overflow-auto p-6">
|
|
23
55
|
{/* Stats Cards */}
|
|
24
|
-
<div className="grid grid-cols-
|
|
25
|
-
<StatCard label="
|
|
26
|
-
<StatCard label="
|
|
56
|
+
<div className="grid grid-cols-2 sm:grid-cols-4 gap-4 mb-6">
|
|
57
|
+
<StatCard label="Agents" value={agents.length} subValue={`${runningCount} running`} />
|
|
58
|
+
<StatCard label="Tasks" value={taskStats.total} subValue={`${taskStats.pending} pending`} />
|
|
59
|
+
<StatCard label="Completed" value={taskStats.completed} color="text-green-400" />
|
|
27
60
|
<StatCard label="Providers" value={configuredProviders.length} color="text-[#f97316]" />
|
|
28
61
|
</div>
|
|
29
62
|
|
|
30
|
-
<div className="grid grid-cols-2 gap-6">
|
|
63
|
+
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
|
31
64
|
{/* Agents List */}
|
|
32
65
|
<DashboardCard
|
|
33
66
|
title="Agents"
|
|
@@ -61,31 +94,29 @@ export function Dashboard({
|
|
|
61
94
|
)}
|
|
62
95
|
</DashboardCard>
|
|
63
96
|
|
|
64
|
-
{/*
|
|
97
|
+
{/* Recent Tasks */}
|
|
65
98
|
<DashboardCard
|
|
66
|
-
title="
|
|
67
|
-
actionLabel="
|
|
68
|
-
onAction={() => onNavigate("
|
|
99
|
+
title="Recent Tasks"
|
|
100
|
+
actionLabel="View All"
|
|
101
|
+
onAction={() => onNavigate("tasks")}
|
|
69
102
|
>
|
|
70
|
-
{
|
|
103
|
+
{recentTasks.length === 0 ? (
|
|
71
104
|
<div className="p-4 text-center text-[#666]">
|
|
72
|
-
<p>No
|
|
73
|
-
<
|
|
74
|
-
onClick={() => onNavigate("settings")}
|
|
75
|
-
className="text-[#f97316] hover:underline mt-1"
|
|
76
|
-
>
|
|
77
|
-
Add API Key
|
|
78
|
-
</button>
|
|
105
|
+
<p>No tasks yet</p>
|
|
106
|
+
<p className="text-sm text-[#444] mt-1">Tasks will appear when agents create them</p>
|
|
79
107
|
</div>
|
|
80
108
|
) : (
|
|
81
109
|
<div className="divide-y divide-[#1a1a1a]">
|
|
82
|
-
{
|
|
83
|
-
<div
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
110
|
+
{recentTasks.map((task) => (
|
|
111
|
+
<div
|
|
112
|
+
key={`${task.agentId}-${task.id}`}
|
|
113
|
+
className="px-4 py-3 flex items-center justify-between"
|
|
114
|
+
>
|
|
115
|
+
<div className="flex-1 min-w-0">
|
|
116
|
+
<p className="font-medium truncate">{task.title}</p>
|
|
117
|
+
<p className="text-sm text-[#666]">{task.agentName}</p>
|
|
87
118
|
</div>
|
|
88
|
-
<
|
|
119
|
+
<TaskStatusBadge status={task.status} />
|
|
89
120
|
</div>
|
|
90
121
|
))}
|
|
91
122
|
</div>
|
|
@@ -99,14 +130,16 @@ export function Dashboard({
|
|
|
99
130
|
interface StatCardProps {
|
|
100
131
|
label: string;
|
|
101
132
|
value: number;
|
|
133
|
+
subValue?: string;
|
|
102
134
|
color?: string;
|
|
103
135
|
}
|
|
104
136
|
|
|
105
|
-
function StatCard({ label, value, color }: StatCardProps) {
|
|
137
|
+
function StatCard({ label, value, subValue, color }: StatCardProps) {
|
|
106
138
|
return (
|
|
107
139
|
<div className="bg-[#111] rounded p-4 border border-[#1a1a1a]">
|
|
108
140
|
<p className="text-sm text-[#666] mb-1">{label}</p>
|
|
109
141
|
<p className={`text-2xl font-semibold ${color || ''}`}>{value}</p>
|
|
142
|
+
{subValue && <p className="text-xs text-[#555] mt-1">{subValue}</p>}
|
|
110
143
|
</div>
|
|
111
144
|
);
|
|
112
145
|
}
|
|
@@ -134,3 +167,19 @@ function DashboardCard({ title, actionLabel, onAction, children }: DashboardCard
|
|
|
134
167
|
</div>
|
|
135
168
|
);
|
|
136
169
|
}
|
|
170
|
+
|
|
171
|
+
function TaskStatusBadge({ status }: { status: Task["status"] }) {
|
|
172
|
+
const colors: Record<string, string> = {
|
|
173
|
+
pending: "bg-yellow-500/20 text-yellow-400",
|
|
174
|
+
running: "bg-blue-500/20 text-blue-400",
|
|
175
|
+
completed: "bg-green-500/20 text-green-400",
|
|
176
|
+
failed: "bg-red-500/20 text-red-400",
|
|
177
|
+
cancelled: "bg-gray-500/20 text-gray-400",
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<span className={`px-2 py-0.5 rounded text-xs font-medium ${colors[status] || colors.pending}`}>
|
|
182
|
+
{status}
|
|
183
|
+
</span>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Common components
|
|
2
|
-
export { LoadingSpinner, Modal, Select, CheckIcon, CloseIcon, DashboardIcon, AgentsIcon, SettingsIcon } from "./common";
|
|
2
|
+
export { LoadingSpinner, Modal, Select, CheckIcon, CloseIcon, DashboardIcon, AgentsIcon, SettingsIcon, TasksIcon } from "./common";
|
|
3
3
|
|
|
4
4
|
// Layout components
|
|
5
5
|
export { Header, Sidebar, ErrorBanner } from "./layout";
|
|
@@ -7,5 +7,8 @@ export { Header, Sidebar, ErrorBanner } from "./layout";
|
|
|
7
7
|
// Feature components
|
|
8
8
|
export { OnboardingWizard } from "./onboarding";
|
|
9
9
|
export { SettingsPage } from "./settings";
|
|
10
|
-
export { AgentCard, CreateAgentModal,
|
|
10
|
+
export { AgentCard, CreateAgentModal, AgentPanel, AgentsView } from "./agents";
|
|
11
11
|
export { Dashboard } from "./dashboard";
|
|
12
|
+
export { TasksPage } from "./tasks";
|
|
13
|
+
export { McpPage } from "./mcp";
|
|
14
|
+
export { TelemetryPage } from "./telemetry/TelemetryPage";
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { DashboardIcon, AgentsIcon, SettingsIcon } from "../common/Icons";
|
|
2
|
+
import { DashboardIcon, AgentsIcon, TasksIcon, McpIcon, TelemetryIcon, SettingsIcon } from "../common/Icons";
|
|
3
3
|
import type { Route } from "../../types";
|
|
4
4
|
|
|
5
5
|
interface SidebarProps {
|
|
6
6
|
route: Route;
|
|
7
7
|
agentCount: number;
|
|
8
|
+
taskCount?: number;
|
|
8
9
|
onNavigate: (route: Route) => void;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
export function Sidebar({ route, agentCount, onNavigate }: SidebarProps) {
|
|
12
|
+
export function Sidebar({ route, agentCount, taskCount, onNavigate }: SidebarProps) {
|
|
12
13
|
return (
|
|
13
14
|
<aside className="w-56 border-r border-[#1a1a1a] flex-shrink-0 p-4">
|
|
14
15
|
<nav className="space-y-1">
|
|
@@ -25,6 +26,25 @@ export function Sidebar({ route, agentCount, onNavigate }: SidebarProps) {
|
|
|
25
26
|
onClick={() => onNavigate("agents")}
|
|
26
27
|
badge={agentCount > 0 ? String(agentCount) : undefined}
|
|
27
28
|
/>
|
|
29
|
+
<NavButton
|
|
30
|
+
icon={<TasksIcon />}
|
|
31
|
+
label="Tasks"
|
|
32
|
+
active={route === "tasks"}
|
|
33
|
+
onClick={() => onNavigate("tasks")}
|
|
34
|
+
badge={taskCount && taskCount > 0 ? String(taskCount) : undefined}
|
|
35
|
+
/>
|
|
36
|
+
<NavButton
|
|
37
|
+
icon={<McpIcon />}
|
|
38
|
+
label="MCP"
|
|
39
|
+
active={route === "mcp"}
|
|
40
|
+
onClick={() => onNavigate("mcp")}
|
|
41
|
+
/>
|
|
42
|
+
<NavButton
|
|
43
|
+
icon={<TelemetryIcon />}
|
|
44
|
+
label="Telemetry"
|
|
45
|
+
active={route === "telemetry"}
|
|
46
|
+
onClick={() => onNavigate("telemetry")}
|
|
47
|
+
/>
|
|
28
48
|
<NavButton
|
|
29
49
|
icon={<SettingsIcon />}
|
|
30
50
|
label="Settings"
|