apteva 0.2.10 → 0.3.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.mvbdnw89.js +227 -0
- package/dist/index.html +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/auth/index.ts +11 -3
- package/src/auth/middleware.ts +1 -0
- package/src/binary.ts +7 -5
- package/src/crypto.ts +4 -0
- package/src/db.ts +437 -14
- package/src/integrations/skillsmp.ts +318 -0
- package/src/providers.ts +21 -0
- package/src/routes/api.ts +836 -16
- package/src/server.ts +58 -7
- package/src/web/App.tsx +24 -8
- package/src/web/components/agents/AgentCard.tsx +36 -11
- package/src/web/components/agents/AgentPanel.tsx +333 -24
- package/src/web/components/agents/AgentsView.tsx +1 -1
- package/src/web/components/agents/CreateAgentModal.tsx +169 -23
- package/src/web/components/common/Icons.tsx +8 -0
- package/src/web/components/common/index.ts +1 -0
- package/src/web/components/index.ts +1 -0
- package/src/web/components/layout/Header.tsx +4 -2
- package/src/web/components/layout/Sidebar.tsx +7 -1
- package/src/web/components/mcp/McpPage.tsx +602 -19
- package/src/web/components/meta-agent/MetaAgent.tsx +222 -0
- package/src/web/components/settings/SettingsPage.tsx +212 -150
- package/src/web/components/skills/SkillsPage.tsx +871 -0
- package/src/web/context/AuthContext.tsx +5 -0
- package/src/web/context/ProjectContext.tsx +26 -4
- package/src/web/types.ts +48 -3
- package/dist/App.44ge5b89.js +0 -218
|
@@ -9,6 +9,7 @@ interface User {
|
|
|
9
9
|
interface AuthStatus {
|
|
10
10
|
hasUsers: boolean;
|
|
11
11
|
authenticated: boolean;
|
|
12
|
+
isDev: boolean;
|
|
12
13
|
user?: User;
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -17,6 +18,7 @@ interface AuthContextValue {
|
|
|
17
18
|
isAuthenticated: boolean;
|
|
18
19
|
isLoading: boolean;
|
|
19
20
|
hasUsers: boolean | null;
|
|
21
|
+
isDev: boolean;
|
|
20
22
|
accessToken: string | null;
|
|
21
23
|
login: (username: string, password: string) => Promise<{ success: boolean; error?: string }>;
|
|
22
24
|
logout: () => Promise<void>;
|
|
@@ -44,6 +46,7 @@ export function AuthProvider({ children }: AuthProviderProps) {
|
|
|
44
46
|
const [accessToken, setAccessToken] = useState<string | null>(null);
|
|
45
47
|
const [isLoading, setIsLoading] = useState(true);
|
|
46
48
|
const [hasUsers, setHasUsers] = useState<boolean | null>(null);
|
|
49
|
+
const [isDev, setIsDev] = useState(false);
|
|
47
50
|
|
|
48
51
|
// Refs to track state without causing re-renders
|
|
49
52
|
const tokenRef = useRef<string | null>(null);
|
|
@@ -107,6 +110,7 @@ export function AuthProvider({ children }: AuthProviderProps) {
|
|
|
107
110
|
const data: AuthStatus = await res.json();
|
|
108
111
|
|
|
109
112
|
setHasUsers(data.hasUsers);
|
|
113
|
+
setIsDev(data.isDev ?? false);
|
|
110
114
|
|
|
111
115
|
if (data.authenticated && data.user) {
|
|
112
116
|
setUser(data.user as User);
|
|
@@ -212,6 +216,7 @@ export function AuthProvider({ children }: AuthProviderProps) {
|
|
|
212
216
|
isAuthenticated: !!user,
|
|
213
217
|
isLoading,
|
|
214
218
|
hasUsers,
|
|
219
|
+
isDev,
|
|
215
220
|
accessToken,
|
|
216
221
|
login,
|
|
217
222
|
logout,
|
|
@@ -18,6 +18,7 @@ interface ProjectContextValue {
|
|
|
18
18
|
isLoading: boolean;
|
|
19
19
|
error: string | null;
|
|
20
20
|
unassignedCount: number;
|
|
21
|
+
projectsEnabled: boolean; // Feature flag
|
|
21
22
|
setCurrentProjectId: (id: string | null) => void;
|
|
22
23
|
createProject: (data: { name: string; description?: string; color?: string }) => Promise<Project | null>;
|
|
23
24
|
updateProject: (id: string, data: { name?: string; description?: string; color?: string }) => Promise<Project | null>;
|
|
@@ -54,6 +55,19 @@ export function ProjectProvider({ children }: ProjectProviderProps) {
|
|
|
54
55
|
const [isLoading, setIsLoading] = useState(true);
|
|
55
56
|
const [error, setError] = useState<string | null>(null);
|
|
56
57
|
const [unassignedCount, setUnassignedCount] = useState(0);
|
|
58
|
+
const [projectsEnabled, setProjectsEnabled] = useState(false);
|
|
59
|
+
|
|
60
|
+
// Fetch feature flags on mount
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
fetch("/api/features")
|
|
63
|
+
.then(res => res.json())
|
|
64
|
+
.then(data => {
|
|
65
|
+
setProjectsEnabled(data.projects === true);
|
|
66
|
+
})
|
|
67
|
+
.catch(() => {
|
|
68
|
+
setProjectsEnabled(false);
|
|
69
|
+
});
|
|
70
|
+
}, []);
|
|
57
71
|
|
|
58
72
|
const setCurrentProjectId = useCallback((id: string | null) => {
|
|
59
73
|
setCurrentProjectIdState(id);
|
|
@@ -69,6 +83,13 @@ export function ProjectProvider({ children }: ProjectProviderProps) {
|
|
|
69
83
|
const currentProject = projects.find(p => p.id === currentProjectId) || null;
|
|
70
84
|
|
|
71
85
|
const refreshProjects = useCallback(async () => {
|
|
86
|
+
// Don't fetch if projects feature is disabled
|
|
87
|
+
if (!projectsEnabled) {
|
|
88
|
+
setProjects([]);
|
|
89
|
+
setIsLoading(false);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
72
93
|
if (!isAuthenticated && !authLoading) {
|
|
73
94
|
setProjects([]);
|
|
74
95
|
setIsLoading(false);
|
|
@@ -95,7 +116,7 @@ export function ProjectProvider({ children }: ProjectProviderProps) {
|
|
|
95
116
|
} finally {
|
|
96
117
|
setIsLoading(false);
|
|
97
118
|
}
|
|
98
|
-
}, [authFetch, isAuthenticated, authLoading, currentProjectId, setCurrentProjectId]);
|
|
119
|
+
}, [authFetch, isAuthenticated, authLoading, currentProjectId, setCurrentProjectId, projectsEnabled]);
|
|
99
120
|
|
|
100
121
|
const createProject = useCallback(async (data: { name: string; description?: string; color?: string }): Promise<Project | null> => {
|
|
101
122
|
try {
|
|
@@ -157,12 +178,12 @@ export function ProjectProvider({ children }: ProjectProviderProps) {
|
|
|
157
178
|
}
|
|
158
179
|
}, [authFetch, currentProjectId, setCurrentProjectId, refreshProjects]);
|
|
159
180
|
|
|
160
|
-
// Fetch projects when authenticated
|
|
181
|
+
// Fetch projects when authenticated and feature is enabled
|
|
161
182
|
useEffect(() => {
|
|
162
|
-
if (!authLoading) {
|
|
183
|
+
if (!authLoading && projectsEnabled) {
|
|
163
184
|
refreshProjects();
|
|
164
185
|
}
|
|
165
|
-
}, [authLoading, refreshProjects]);
|
|
186
|
+
}, [authLoading, projectsEnabled, refreshProjects]);
|
|
166
187
|
|
|
167
188
|
const value: ProjectContextValue = {
|
|
168
189
|
projects,
|
|
@@ -171,6 +192,7 @@ export function ProjectProvider({ children }: ProjectProviderProps) {
|
|
|
171
192
|
isLoading,
|
|
172
193
|
error,
|
|
173
194
|
unassignedCount,
|
|
195
|
+
projectsEnabled,
|
|
174
196
|
setCurrentProjectId,
|
|
175
197
|
createProject,
|
|
176
198
|
updateProject,
|
package/src/web/types.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
// Shared types for the Apteva UI
|
|
2
2
|
|
|
3
|
+
export type AgentMode = "coordinator" | "worker";
|
|
4
|
+
|
|
5
|
+
export interface MultiAgentConfig {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
mode?: AgentMode;
|
|
8
|
+
group?: string; // Defaults to projectId if not specified
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface AgentBuiltinTools {
|
|
12
|
+
webSearch: boolean;
|
|
13
|
+
webFetch: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
3
16
|
export interface AgentFeatures {
|
|
4
17
|
memory: boolean;
|
|
5
18
|
tasks: boolean;
|
|
@@ -8,7 +21,8 @@ export interface AgentFeatures {
|
|
|
8
21
|
mcp: boolean;
|
|
9
22
|
realtime: boolean;
|
|
10
23
|
files: boolean;
|
|
11
|
-
agents: boolean;
|
|
24
|
+
agents: boolean | MultiAgentConfig; // Can be boolean for backwards compat or full config
|
|
25
|
+
builtinTools?: AgentBuiltinTools;
|
|
12
26
|
}
|
|
13
27
|
|
|
14
28
|
export const DEFAULT_FEATURES: AgentFeatures = {
|
|
@@ -20,14 +34,40 @@ export const DEFAULT_FEATURES: AgentFeatures = {
|
|
|
20
34
|
realtime: false,
|
|
21
35
|
files: false,
|
|
22
36
|
agents: false,
|
|
37
|
+
builtinTools: { webSearch: false, webFetch: false },
|
|
23
38
|
};
|
|
24
39
|
|
|
40
|
+
// Helper to normalize agents feature to MultiAgentConfig
|
|
41
|
+
export function getMultiAgentConfig(features: AgentFeatures, projectId?: string | null): MultiAgentConfig {
|
|
42
|
+
const agents = features.agents;
|
|
43
|
+
if (typeof agents === "boolean") {
|
|
44
|
+
return {
|
|
45
|
+
enabled: agents,
|
|
46
|
+
mode: "worker",
|
|
47
|
+
group: projectId || undefined,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
...agents,
|
|
52
|
+
group: agents.group || projectId || undefined,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
25
56
|
export interface McpServerSummary {
|
|
26
57
|
id: string;
|
|
27
58
|
name: string;
|
|
28
59
|
type: string;
|
|
29
60
|
status: "stopped" | "running";
|
|
30
61
|
port: number | null;
|
|
62
|
+
url?: string | null; // For HTTP servers
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface SkillSummary {
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
description: string;
|
|
69
|
+
version: string;
|
|
70
|
+
enabled: boolean;
|
|
31
71
|
}
|
|
32
72
|
|
|
33
73
|
export interface Agent {
|
|
@@ -41,6 +81,8 @@ export interface Agent {
|
|
|
41
81
|
features: AgentFeatures;
|
|
42
82
|
mcpServers: string[]; // Array of MCP server IDs
|
|
43
83
|
mcpServerDetails?: McpServerSummary[]; // Full details included from API
|
|
84
|
+
skills: string[]; // Array of Skill IDs
|
|
85
|
+
skillDetails?: SkillSummary[]; // Full details included from API
|
|
44
86
|
projectId: string | null; // Optional project grouping
|
|
45
87
|
createdAt: string;
|
|
46
88
|
}
|
|
@@ -48,14 +90,16 @@ export interface Agent {
|
|
|
48
90
|
export interface McpServer {
|
|
49
91
|
id: string;
|
|
50
92
|
name: string;
|
|
51
|
-
type: "npm" | "github" | "http" | "custom";
|
|
93
|
+
type: "npm" | "pip" | "github" | "http" | "custom";
|
|
52
94
|
package: string | null;
|
|
95
|
+
pip_module: string | null; // For pip type: module to run (e.g., "late.mcp")
|
|
53
96
|
command: string | null;
|
|
54
97
|
url: string | null;
|
|
55
98
|
headers: Record<string, string>;
|
|
56
99
|
port: number | null;
|
|
57
100
|
status: "stopped" | "running";
|
|
58
101
|
source: string | null; // "composio", "smithery", or null for local
|
|
102
|
+
project_id: string | null; // null = global, otherwise project-scoped
|
|
59
103
|
}
|
|
60
104
|
|
|
61
105
|
export interface McpTool {
|
|
@@ -99,7 +143,7 @@ export interface OnboardingStatus {
|
|
|
99
143
|
has_any_keys: boolean;
|
|
100
144
|
}
|
|
101
145
|
|
|
102
|
-
export type Route = "dashboard" | "agents" | "tasks" | "mcp" | "telemetry" | "settings" | "api";
|
|
146
|
+
export type Route = "dashboard" | "agents" | "tasks" | "mcp" | "skills" | "telemetry" | "settings" | "api";
|
|
103
147
|
|
|
104
148
|
export interface Task {
|
|
105
149
|
id: string;
|
|
@@ -142,5 +186,6 @@ export interface NewAgentForm {
|
|
|
142
186
|
systemPrompt: string;
|
|
143
187
|
features: AgentFeatures;
|
|
144
188
|
mcpServers: string[];
|
|
189
|
+
skills: string[];
|
|
145
190
|
projectId?: string | null;
|
|
146
191
|
}
|