apteva 0.2.6 → 0.2.8
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.hzbfeg94.js +217 -0
- package/dist/index.html +3 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/auth/index.ts +386 -0
- package/src/auth/middleware.ts +183 -0
- package/src/binary.ts +19 -1
- package/src/db.ts +570 -32
- package/src/routes/api.ts +913 -38
- package/src/routes/auth.ts +242 -0
- package/src/server.ts +60 -8
- package/src/web/App.tsx +61 -19
- package/src/web/components/agents/AgentCard.tsx +30 -41
- package/src/web/components/agents/AgentPanel.tsx +751 -11
- package/src/web/components/agents/AgentsView.tsx +81 -9
- package/src/web/components/agents/CreateAgentModal.tsx +28 -1
- package/src/web/components/auth/CreateAccountStep.tsx +176 -0
- package/src/web/components/auth/LoginPage.tsx +91 -0
- package/src/web/components/auth/index.ts +2 -0
- package/src/web/components/common/Icons.tsx +48 -0
- package/src/web/components/common/Modal.tsx +1 -1
- package/src/web/components/dashboard/Dashboard.tsx +91 -31
- package/src/web/components/index.ts +3 -0
- package/src/web/components/layout/Header.tsx +145 -15
- package/src/web/components/layout/Sidebar.tsx +81 -43
- package/src/web/components/mcp/McpPage.tsx +261 -32
- package/src/web/components/onboarding/OnboardingWizard.tsx +64 -8
- package/src/web/components/settings/SettingsPage.tsx +404 -18
- package/src/web/components/tasks/TasksPage.tsx +21 -19
- package/src/web/components/telemetry/TelemetryPage.tsx +271 -81
- package/src/web/context/AuthContext.tsx +230 -0
- package/src/web/context/ProjectContext.tsx +182 -0
- package/src/web/context/TelemetryContext.tsx +98 -76
- package/src/web/context/index.ts +5 -0
- package/src/web/hooks/useAgents.ts +18 -6
- package/src/web/hooks/useOnboarding.ts +20 -4
- package/src/web/hooks/useProviders.ts +15 -5
- package/src/web/icon.png +0 -0
- package/src/web/styles.css +12 -0
- package/src/web/types.ts +6 -0
- package/dist/App.0mzj9cz9.js +0 -213
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import { useState, useEffect, useCallback } from "react";
|
|
2
2
|
import type { Agent, AgentFeatures } from "../types";
|
|
3
|
+
import { useAuth } from "../context";
|
|
3
4
|
|
|
4
5
|
export function useAgents(enabled: boolean) {
|
|
6
|
+
const { accessToken } = useAuth();
|
|
5
7
|
const [agents, setAgents] = useState<Agent[]>([]);
|
|
6
8
|
const [loading, setLoading] = useState(true);
|
|
7
9
|
|
|
10
|
+
const getHeaders = useCallback((): Record<string, string> => {
|
|
11
|
+
const headers: Record<string, string> = { "Content-Type": "application/json" };
|
|
12
|
+
if (accessToken) {
|
|
13
|
+
headers.Authorization = `Bearer ${accessToken}`;
|
|
14
|
+
}
|
|
15
|
+
return headers;
|
|
16
|
+
}, [accessToken]);
|
|
17
|
+
|
|
8
18
|
const fetchAgents = useCallback(async () => {
|
|
9
|
-
const res = await fetch("/api/agents");
|
|
19
|
+
const res = await fetch("/api/agents", { headers: getHeaders() });
|
|
10
20
|
const data = await res.json();
|
|
11
21
|
setAgents(data.agents || []);
|
|
12
22
|
setLoading(false);
|
|
13
|
-
}, []);
|
|
23
|
+
}, [getHeaders]);
|
|
14
24
|
|
|
15
25
|
useEffect(() => {
|
|
16
26
|
if (enabled) {
|
|
@@ -25,17 +35,18 @@ export function useAgents(enabled: boolean) {
|
|
|
25
35
|
systemPrompt: string;
|
|
26
36
|
features: AgentFeatures;
|
|
27
37
|
mcpServers?: string[];
|
|
38
|
+
projectId?: string | null;
|
|
28
39
|
}) => {
|
|
29
40
|
await fetch("/api/agents", {
|
|
30
41
|
method: "POST",
|
|
31
|
-
headers:
|
|
42
|
+
headers: getHeaders(),
|
|
32
43
|
body: JSON.stringify(agent),
|
|
33
44
|
});
|
|
34
45
|
await fetchAgents();
|
|
35
46
|
};
|
|
36
47
|
|
|
37
48
|
const deleteAgent = async (id: string) => {
|
|
38
|
-
await fetch(`/api/agents/${id}`, { method: "DELETE" });
|
|
49
|
+
await fetch(`/api/agents/${id}`, { method: "DELETE", headers: getHeaders() });
|
|
39
50
|
await fetchAgents();
|
|
40
51
|
};
|
|
41
52
|
|
|
@@ -46,10 +57,11 @@ export function useAgents(enabled: boolean) {
|
|
|
46
57
|
systemPrompt?: string;
|
|
47
58
|
features?: AgentFeatures;
|
|
48
59
|
mcpServers?: string[];
|
|
60
|
+
projectId?: string | null;
|
|
49
61
|
}): Promise<{ error?: string }> => {
|
|
50
62
|
const res = await fetch(`/api/agents/${id}`, {
|
|
51
63
|
method: "PUT",
|
|
52
|
-
headers:
|
|
64
|
+
headers: getHeaders(),
|
|
53
65
|
body: JSON.stringify(updates),
|
|
54
66
|
});
|
|
55
67
|
const data = await res.json();
|
|
@@ -62,7 +74,7 @@ export function useAgents(enabled: boolean) {
|
|
|
62
74
|
|
|
63
75
|
const toggleAgent = async (agent: Agent): Promise<{ error?: string }> => {
|
|
64
76
|
const action = agent.status === "running" ? "stop" : "start";
|
|
65
|
-
const res = await fetch(`/api/agents/${agent.id}/${action}`, { method: "POST" });
|
|
77
|
+
const res = await fetch(`/api/agents/${agent.id}/${action}`, { method: "POST", headers: getHeaders() });
|
|
66
78
|
const data = await res.json();
|
|
67
79
|
await fetchAgents();
|
|
68
80
|
if (!res.ok && data.error) {
|
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
import { useState, useEffect, useCallback } from "react";
|
|
2
|
+
import { useAuth } from "../context";
|
|
2
3
|
|
|
3
4
|
export function useOnboarding() {
|
|
5
|
+
const { accessToken, isAuthenticated } = useAuth();
|
|
4
6
|
const [isComplete, setIsComplete] = useState<boolean | null>(null);
|
|
5
7
|
|
|
8
|
+
const getHeaders = useCallback((): Record<string, string> => {
|
|
9
|
+
const headers: Record<string, string> = {};
|
|
10
|
+
if (accessToken) {
|
|
11
|
+
headers.Authorization = `Bearer ${accessToken}`;
|
|
12
|
+
}
|
|
13
|
+
return headers;
|
|
14
|
+
}, [accessToken]);
|
|
15
|
+
|
|
6
16
|
useEffect(() => {
|
|
7
|
-
|
|
17
|
+
// Only check onboarding status when authenticated
|
|
18
|
+
if (!isAuthenticated) {
|
|
19
|
+
setIsComplete(null);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
fetch("/api/onboarding/status", { headers: getHeaders() })
|
|
8
24
|
.then(res => res.json())
|
|
9
25
|
.then(data => {
|
|
10
26
|
setIsComplete(data.completed || data.has_any_keys);
|
|
11
27
|
})
|
|
12
28
|
.catch(() => setIsComplete(true)); // Fallback to showing app
|
|
13
|
-
}, []);
|
|
29
|
+
}, [isAuthenticated, getHeaders]);
|
|
14
30
|
|
|
15
31
|
const complete = useCallback(async () => {
|
|
16
|
-
await fetch("/api/onboarding/complete", { method: "POST" });
|
|
32
|
+
await fetch("/api/onboarding/complete", { method: "POST", headers: getHeaders() });
|
|
17
33
|
setIsComplete(true);
|
|
18
|
-
}, []);
|
|
34
|
+
}, [getHeaders]);
|
|
19
35
|
|
|
20
36
|
return {
|
|
21
37
|
isComplete,
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { useState, useEffect, useCallback } from "react";
|
|
2
2
|
import type { Provider } from "../types";
|
|
3
|
+
import { useAuth } from "../context";
|
|
3
4
|
|
|
4
5
|
export function useProviders(enabled: boolean) {
|
|
6
|
+
const { accessToken } = useAuth();
|
|
5
7
|
const [providers, setProviders] = useState<Provider[]>([]);
|
|
6
8
|
|
|
9
|
+
const getHeaders = useCallback((): Record<string, string> => {
|
|
10
|
+
const headers: Record<string, string> = { "Content-Type": "application/json" };
|
|
11
|
+
if (accessToken) {
|
|
12
|
+
headers.Authorization = `Bearer ${accessToken}`;
|
|
13
|
+
}
|
|
14
|
+
return headers;
|
|
15
|
+
}, [accessToken]);
|
|
16
|
+
|
|
7
17
|
const fetchProviders = useCallback(async () => {
|
|
8
|
-
const res = await fetch("/api/providers");
|
|
18
|
+
const res = await fetch("/api/providers", { headers: getHeaders() });
|
|
9
19
|
const data = await res.json();
|
|
10
20
|
setProviders(data.providers || []);
|
|
11
|
-
}, []);
|
|
21
|
+
}, [getHeaders]);
|
|
12
22
|
|
|
13
23
|
useEffect(() => {
|
|
14
24
|
if (enabled) {
|
|
@@ -25,7 +35,7 @@ export function useProviders(enabled: boolean) {
|
|
|
25
35
|
// First test the key
|
|
26
36
|
const testRes = await fetch(`/api/keys/${providerId}/test`, {
|
|
27
37
|
method: "POST",
|
|
28
|
-
headers:
|
|
38
|
+
headers: getHeaders(),
|
|
29
39
|
body: JSON.stringify({ key: apiKey }),
|
|
30
40
|
});
|
|
31
41
|
const testData = await testRes.json();
|
|
@@ -37,7 +47,7 @@ export function useProviders(enabled: boolean) {
|
|
|
37
47
|
// Save the key
|
|
38
48
|
const saveRes = await fetch(`/api/keys/${providerId}`, {
|
|
39
49
|
method: "POST",
|
|
40
|
-
headers:
|
|
50
|
+
headers: getHeaders(),
|
|
41
51
|
body: JSON.stringify({ key: apiKey }),
|
|
42
52
|
});
|
|
43
53
|
|
|
@@ -51,7 +61,7 @@ export function useProviders(enabled: boolean) {
|
|
|
51
61
|
};
|
|
52
62
|
|
|
53
63
|
const deleteKey = async (providerId: string) => {
|
|
54
|
-
await fetch(`/api/keys/${providerId}`, { method: "DELETE" });
|
|
64
|
+
await fetch(`/api/keys/${providerId}`, { method: "DELETE", headers: getHeaders() });
|
|
55
65
|
await fetchProviders();
|
|
56
66
|
};
|
|
57
67
|
|
package/src/web/icon.png
ADDED
|
Binary file
|
package/src/web/styles.css
CHANGED
|
@@ -39,3 +39,15 @@ html, body {
|
|
|
39
39
|
.scrollbar-hide::-webkit-scrollbar {
|
|
40
40
|
display: none;
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
/* Telemetry event slide-in animation */
|
|
44
|
+
@keyframes slideIn {
|
|
45
|
+
from {
|
|
46
|
+
opacity: 0;
|
|
47
|
+
transform: translateY(-8px);
|
|
48
|
+
}
|
|
49
|
+
to {
|
|
50
|
+
opacity: 1;
|
|
51
|
+
transform: translateY(0);
|
|
52
|
+
}
|
|
53
|
+
}
|
package/src/web/types.ts
CHANGED
|
@@ -7,6 +7,8 @@ export interface AgentFeatures {
|
|
|
7
7
|
operator: boolean;
|
|
8
8
|
mcp: boolean;
|
|
9
9
|
realtime: boolean;
|
|
10
|
+
files: boolean;
|
|
11
|
+
agents: boolean;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
export const DEFAULT_FEATURES: AgentFeatures = {
|
|
@@ -16,6 +18,8 @@ export const DEFAULT_FEATURES: AgentFeatures = {
|
|
|
16
18
|
operator: false,
|
|
17
19
|
mcp: false,
|
|
18
20
|
realtime: false,
|
|
21
|
+
files: false,
|
|
22
|
+
agents: false,
|
|
19
23
|
};
|
|
20
24
|
|
|
21
25
|
export interface McpServerSummary {
|
|
@@ -37,6 +41,7 @@ export interface Agent {
|
|
|
37
41
|
features: AgentFeatures;
|
|
38
42
|
mcpServers: string[]; // Array of MCP server IDs
|
|
39
43
|
mcpServerDetails?: McpServerSummary[]; // Full details included from API
|
|
44
|
+
projectId: string | null; // Optional project grouping
|
|
40
45
|
createdAt: string;
|
|
41
46
|
}
|
|
42
47
|
|
|
@@ -134,4 +139,5 @@ export interface NewAgentForm {
|
|
|
134
139
|
systemPrompt: string;
|
|
135
140
|
features: AgentFeatures;
|
|
136
141
|
mcpServers: string[];
|
|
142
|
+
projectId?: string | null;
|
|
137
143
|
}
|