apteva 0.4.32 → 0.4.44

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 (113) hide show
  1. package/dist/ActivityPage.c48n83h2.js +3 -0
  2. package/dist/ApiDocsPage.yzcxx5ax.js +4 -0
  3. package/dist/App.09yb8t0b.js +1 -0
  4. package/dist/App.152mbs1r.js +4 -0
  5. package/dist/App.3a67nx9w.js +4 -0
  6. package/dist/App.9epx6785.js +4 -0
  7. package/dist/App.d8955awp.js +4 -0
  8. package/dist/App.drwb57jq.js +4 -0
  9. package/dist/App.gssbmajb.js +4 -0
  10. package/dist/App.qw70pc29.js +53 -0
  11. package/dist/App.qzbx5wtj.js +4 -0
  12. package/dist/App.r5serxkt.js +8 -0
  13. package/dist/App.tpmp9020.js +20 -0
  14. package/dist/App.v2wb4d7d.js +61 -0
  15. package/dist/App.vxmaaj0m.js +13 -0
  16. package/dist/App.w4p2tda9.js +4 -0
  17. package/dist/App.wv2ng55q.js +221 -0
  18. package/dist/App.yncnrn0f.js +4 -0
  19. package/dist/ConnectionsPage.k6cspyqq.js +3 -0
  20. package/dist/McpPage.cdxm48xj.js +3 -0
  21. package/dist/SettingsPage.evpv7c2y.js +3 -0
  22. package/dist/SkillsPage.pvzp6c1a.js +3 -0
  23. package/dist/TasksPage.6jnvbpsy.js +3 -0
  24. package/dist/TelemetryPage.t7vk24zc.js +3 -0
  25. package/dist/TestsPage.5x6658aa.js +3 -0
  26. package/dist/ThreadsPage.3fvhtevh.js +3 -0
  27. package/dist/apteva-kit.css +1 -1
  28. package/dist/index.html +1 -1
  29. package/dist/styles.css +1 -1
  30. package/package.json +10 -9
  31. package/src/crypto.ts +4 -3
  32. package/src/db.ts +171 -36
  33. package/src/integrations/agentdojo.ts +95 -12
  34. package/src/integrations/index.ts +7 -0
  35. package/src/mcp-platform.ts +870 -142
  36. package/src/openapi.ts +96 -0
  37. package/src/providers.ts +60 -34
  38. package/src/routes/api/agent-utils.ts +59 -47
  39. package/src/routes/api/agents.ts +71 -2
  40. package/src/routes/api/integrations.ts +11 -5
  41. package/src/routes/api/mcp.ts +5 -4
  42. package/src/routes/api/meta-agent.ts +37 -1
  43. package/src/routes/api/projects.ts +3 -3
  44. package/src/routes/api/providers.ts +121 -30
  45. package/src/routes/api/skills.ts +2 -3
  46. package/src/routes/api/system.ts +98 -14
  47. package/src/routes/api/telemetry.ts +19 -1
  48. package/src/routes/share.ts +85 -0
  49. package/src/server.ts +43 -32
  50. package/src/triggers/agentdojo.ts +2 -2
  51. package/src/web/App.tsx +107 -21
  52. package/src/web/components/activity/ActivityPage.tsx +242 -389
  53. package/src/web/components/agents/AgentCard.tsx +19 -27
  54. package/src/web/components/agents/AgentPanel.tsx +358 -198
  55. package/src/web/components/agents/AgentsView.tsx +4 -4
  56. package/src/web/components/agents/CreateAgentModal.tsx +21 -79
  57. package/src/web/components/api/ApiDocsPage.tsx +66 -66
  58. package/src/web/components/auth/CreateAccountStep.tsx +16 -16
  59. package/src/web/components/auth/LoginPage.tsx +10 -10
  60. package/src/web/components/common/Icons.tsx +8 -0
  61. package/src/web/components/common/LoadingSpinner.tsx +2 -2
  62. package/src/web/components/common/Modal.tsx +8 -8
  63. package/src/web/components/common/Select.tsx +11 -10
  64. package/src/web/components/connections/ConnectionsPage.tsx +4 -4
  65. package/src/web/components/connections/IntegrationsTab.tsx +18 -18
  66. package/src/web/components/connections/OverviewTab.tsx +13 -13
  67. package/src/web/components/connections/TriggersTab.tsx +99 -99
  68. package/src/web/components/dashboard/Dashboard.tsx +177 -52
  69. package/src/web/components/index.ts +1 -1
  70. package/src/web/components/layout/Header.tsx +50 -34
  71. package/src/web/components/layout/Sidebar.tsx +41 -16
  72. package/src/web/components/mcp/IntegrationsPanel.tsx +160 -69
  73. package/src/web/components/mcp/McpPage.tsx +218 -209
  74. package/src/web/components/meta-agent/MetaAgent.tsx +15 -11
  75. package/src/web/components/onboarding/OnboardingWizard.tsx +25 -25
  76. package/src/web/components/settings/SettingsPage.tsx +389 -221
  77. package/src/web/components/skills/SkillsPage.tsx +88 -88
  78. package/src/web/components/tasks/TasksPage.tsx +385 -68
  79. package/src/web/components/telemetry/TelemetryPage.tsx +294 -39
  80. package/src/web/components/tests/TestsPage.tsx +50 -50
  81. package/src/web/components/threads/ThreadsPage.tsx +315 -0
  82. package/src/web/context/AuthContext.tsx +3 -3
  83. package/src/web/context/ProjectContext.tsx +8 -3
  84. package/src/web/context/TelemetryContext.tsx +24 -6
  85. package/src/web/context/ThemeContext.tsx +69 -0
  86. package/src/web/context/index.ts +3 -1
  87. package/src/web/styles.css +25 -7
  88. package/src/web/themes.ts +99 -0
  89. package/src/web/types.ts +4 -7
  90. package/dist/ActivityPage.41nbye4r.js +0 -3
  91. package/dist/ApiDocsPage.4smnt8m3.js +0 -4
  92. package/dist/App.0sbax9et.js +0 -4
  93. package/dist/App.0ws427h8.js +0 -4
  94. package/dist/App.6q6bar8b.js +0 -4
  95. package/dist/App.80301vdb.js +0 -4
  96. package/dist/App.af2wg84v.js +0 -267
  97. package/dist/App.ca1rz1ph.js +0 -4
  98. package/dist/App.ensa6z0r.js +0 -4
  99. package/dist/App.f8g7tych.js +0 -13
  100. package/dist/App.mvtqv6qc.js +0 -20
  101. package/dist/App.ncgc9cxy.js +0 -4
  102. package/dist/App.p02f4ret.js +0 -1
  103. package/dist/App.p0fb1pds.js +0 -4
  104. package/dist/App.pmaq48sj.js +0 -4
  105. package/dist/App.yv87t9m5.js +0 -4
  106. package/dist/App.zjmfm8p6.js +0 -4
  107. package/dist/ConnectionsPage.anb3rv9a.js +0 -3
  108. package/dist/McpPage.y396h6fy.js +0 -3
  109. package/dist/SettingsPage.p1hc60gk.js +0 -3
  110. package/dist/SkillsPage.yj3xdsay.js +0 -3
  111. package/dist/TasksPage.sjv0khtv.js +0 -3
  112. package/dist/TelemetryPage.2qm4w16r.js +0 -3
  113. package/dist/TestsPage.zzs4qfj8.js +0 -3
@@ -1,4 +1,4 @@
1
- import React, { createContext, useContext, useState, useEffect, useCallback, type ReactNode } from "react";
1
+ import React, { createContext, useContext, useState, useEffect, useCallback, useMemo, type ReactNode } from "react";
2
2
  import { useAuth } from "./AuthContext";
3
3
 
4
4
  export interface Project {
@@ -20,6 +20,7 @@ interface ProjectContextValue {
20
20
  unassignedCount: number;
21
21
  projectsEnabled: boolean; // Feature flag
22
22
  metaAgentEnabled: boolean; // Feature flag
23
+ costTrackingEnabled: boolean; // Feature flag
23
24
  setCurrentProjectId: (id: string | null) => void;
24
25
  createProject: (data: { name: string; description?: string; color?: string }) => Promise<Project | null>;
25
26
  updateProject: (id: string, data: { name?: string; description?: string; color?: string }) => Promise<Project | null>;
@@ -58,6 +59,7 @@ export function ProjectProvider({ children }: ProjectProviderProps) {
58
59
  const [unassignedCount, setUnassignedCount] = useState(0);
59
60
  const [projectsEnabled, setProjectsEnabled] = useState(false);
60
61
  const [metaAgentEnabled, setMetaAgentEnabled] = useState(false);
62
+ const [costTrackingEnabled, setCostTrackingEnabled] = useState(true);
61
63
 
62
64
  // Fetch feature flags on mount
63
65
  useEffect(() => {
@@ -66,10 +68,12 @@ export function ProjectProvider({ children }: ProjectProviderProps) {
66
68
  .then(data => {
67
69
  setProjectsEnabled(data.projects === true);
68
70
  setMetaAgentEnabled(data.metaAgent === true);
71
+ setCostTrackingEnabled(data.costTracking !== false);
69
72
  })
70
73
  .catch(() => {
71
74
  setProjectsEnabled(false);
72
75
  setMetaAgentEnabled(false);
76
+ setCostTrackingEnabled(true);
73
77
  });
74
78
  }, []);
75
79
 
@@ -189,7 +193,7 @@ export function ProjectProvider({ children }: ProjectProviderProps) {
189
193
  }
190
194
  }, [authLoading, projectsEnabled, refreshProjects]);
191
195
 
192
- const value: ProjectContextValue = {
196
+ const value = useMemo<ProjectContextValue>(() => ({
193
197
  projects,
194
198
  currentProjectId,
195
199
  currentProject,
@@ -198,12 +202,13 @@ export function ProjectProvider({ children }: ProjectProviderProps) {
198
202
  unassignedCount,
199
203
  projectsEnabled,
200
204
  metaAgentEnabled,
205
+ costTrackingEnabled,
201
206
  setCurrentProjectId,
202
207
  createProject,
203
208
  updateProject,
204
209
  deleteProject,
205
210
  refreshProjects,
206
- };
211
+ }), [projects, currentProjectId, currentProject, isLoading, error, unassignedCount, projectsEnabled, metaAgentEnabled, costTrackingEnabled, setCurrentProjectId, createProject, updateProject, deleteProject, refreshProjects]);
207
212
 
208
213
  return <ProjectContext.Provider value={value}>{children}</ProjectContext.Provider>;
209
214
  }
@@ -23,6 +23,7 @@ interface TelemetryContextValue {
23
23
  taskChangeCounter: number;
24
24
  notificationCounter: number;
25
25
  clearEvents: () => void;
26
+ triggerRefresh: () => void;
26
27
  }
27
28
 
28
29
  const TelemetryContext = createContext<TelemetryContextValue | null>(null);
@@ -175,8 +176,17 @@ export function TelemetryProvider({ children }: { children: React.ReactNode }) {
175
176
  setEvents([]);
176
177
  }, []);
177
178
 
179
+ const triggerRefresh = useCallback(() => {
180
+ setStatusChangeCounter(c => c + 1);
181
+ setTaskChangeCounter(c => c + 1);
182
+ }, []);
183
+
184
+ const value = React.useMemo(() => ({
185
+ connected, events, lastActivityByAgent, activeAgents, statusChangeCounter, taskChangeCounter, notificationCounter, clearEvents, triggerRefresh,
186
+ }), [connected, events, lastActivityByAgent, activeAgents, statusChangeCounter, taskChangeCounter, notificationCounter, clearEvents, triggerRefresh]);
187
+
178
188
  return (
179
- <TelemetryContext.Provider value={{ connected, events, lastActivityByAgent, activeAgents, statusChangeCounter, taskChangeCounter, notificationCounter, clearEvents }}>
189
+ <TelemetryContext.Provider value={value}>
180
190
  {children}
181
191
  </TelemetryContext.Provider>
182
192
  );
@@ -251,11 +261,13 @@ export function useAgentActivity(agentId: string) {
251
261
  const { activeAgents } = useTelemetryContext();
252
262
  const activity = activeAgents[agentId];
253
263
 
254
- return {
255
- isActive: !!activity,
256
- type: activity?.type,
257
- label: activity ? getActivityLabel(activity.type) : undefined,
258
- };
264
+ const isActive = !!activity;
265
+ const type = activity?.type;
266
+ return React.useMemo(() => ({
267
+ isActive,
268
+ type,
269
+ label: isActive ? getActivityLabel(type!) : undefined,
270
+ }), [isActive, type]);
259
271
  }
260
272
 
261
273
  // Hook to trigger agent list refetch on status changes (started/stopped/crashed)
@@ -275,3 +287,9 @@ export function useNotificationChange(): number {
275
287
  const { notificationCounter } = useTelemetryContext();
276
288
  return notificationCounter;
277
289
  }
290
+
291
+ // Hook to manually trigger data refresh (e.g. after meta agent tool calls)
292
+ export function useTriggerRefresh(): () => void {
293
+ const { triggerRefresh } = useTelemetryContext();
294
+ return triggerRefresh;
295
+ }
@@ -0,0 +1,69 @@
1
+ import React, { createContext, useContext, useState, useEffect, useCallback, useMemo, type ReactNode } from "react";
2
+ import { themes, resolveTheme, type ThemeMode, type Theme } from "../themes";
3
+
4
+ interface ThemeContextValue {
5
+ mode: ThemeMode;
6
+ theme: Theme; // resolved theme
7
+ setMode: (mode: ThemeMode) => void;
8
+ }
9
+
10
+ const ThemeContext = createContext<ThemeContextValue | null>(null);
11
+
12
+ export function useTheme(): ThemeContextValue {
13
+ const context = useContext(ThemeContext);
14
+ if (!context) {
15
+ throw new Error("useTheme must be used within a ThemeProvider");
16
+ }
17
+ return context;
18
+ }
19
+
20
+ const STORAGE_KEY = "apteva_theme_mode";
21
+
22
+ function getSystemPrefersDark(): boolean {
23
+ if (typeof window === "undefined") return true;
24
+ return window.matchMedia("(prefers-color-scheme: dark)").matches;
25
+ }
26
+
27
+ function applyTheme(theme: Theme) {
28
+ const root = document.documentElement;
29
+ for (const [key, value] of Object.entries(theme.colors)) {
30
+ root.style.setProperty(key, value);
31
+ }
32
+ root.setAttribute("data-theme", theme.id);
33
+ }
34
+
35
+ export function ThemeProvider({ children }: { children: ReactNode }) {
36
+ const [mode, setModeState] = useState<ThemeMode>(() => {
37
+ if (typeof window !== "undefined") {
38
+ const stored = localStorage.getItem(STORAGE_KEY);
39
+ if (stored === "dark" || stored === "light" || stored === "auto") return stored;
40
+ }
41
+ return "auto";
42
+ });
43
+
44
+ const [prefersDark, setPrefersDark] = useState(getSystemPrefersDark);
45
+
46
+ // Listen for system theme changes
47
+ useEffect(() => {
48
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
49
+ const handler = (e: MediaQueryListEvent) => setPrefersDark(e.matches);
50
+ mq.addEventListener("change", handler);
51
+ return () => mq.removeEventListener("change", handler);
52
+ }, []);
53
+
54
+ const theme = useMemo(() => resolveTheme(mode, prefersDark), [mode, prefersDark]);
55
+
56
+ // Apply CSS variables whenever theme changes
57
+ useEffect(() => {
58
+ applyTheme(theme);
59
+ }, [theme]);
60
+
61
+ const setMode = useCallback((newMode: ThemeMode) => {
62
+ setModeState(newMode);
63
+ localStorage.setItem(STORAGE_KEY, newMode);
64
+ }, []);
65
+
66
+ const value = useMemo(() => ({ mode, theme, setMode }), [mode, theme, setMode]);
67
+
68
+ return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;
69
+ }
@@ -1,7 +1,9 @@
1
- export { TelemetryProvider, useTelemetryContext, useTelemetry, useAgentActivity, useAgentStatusChange, useTaskChange, useNotificationChange } from "./TelemetryContext";
1
+ export { TelemetryProvider, useTelemetryContext, useTelemetry, useAgentActivity, useAgentStatusChange, useTaskChange, useNotificationChange, useTriggerRefresh } from "./TelemetryContext";
2
2
  export type { TelemetryEvent } from "./TelemetryContext";
3
3
 
4
4
  export { AuthProvider, useAuth, useAuthHeaders } from "./AuthContext";
5
5
 
6
6
  export { ProjectProvider, useProjects } from "./ProjectContext";
7
7
  export type { Project } from "./ProjectContext";
8
+
9
+ export { ThemeProvider, useTheme } from "./ThemeContext";
@@ -3,7 +3,8 @@
3
3
  @tailwind utilities;
4
4
 
5
5
  html, body {
6
- background-color: #0a0a0a;
6
+ background-color: var(--color-bg, #0a0a0a);
7
+ color: var(--color-text, #e0e0e0);
7
8
  min-height: 100%;
8
9
  margin: 0;
9
10
  -webkit-font-smoothing: antialiased;
@@ -20,8 +21,8 @@ html, body {
20
21
  }
21
22
 
22
23
  ::selection {
23
- background-color: #f97316;
24
- color: #0a0a0a;
24
+ background-color: var(--color-selection-bg, #f97316);
25
+ color: var(--color-selection-text, #0a0a0a);
25
26
  }
26
27
 
27
28
  .line-clamp-2 {
@@ -40,14 +41,31 @@ html, body {
40
41
  display: none;
41
42
  }
42
43
 
43
- /* Telemetry event slide-in animation */
44
+ /* Activity timeline slide-in animation */
44
45
  @keyframes slideIn {
45
- from {
46
+ 0% {
46
47
  opacity: 0;
47
- transform: translateY(-8px);
48
+ transform: translateY(-12px);
49
+ max-height: 0;
48
50
  }
49
- to {
51
+ 40% {
52
+ opacity: 0.6;
53
+ max-height: 100px;
54
+ }
55
+ 100% {
50
56
  opacity: 1;
51
57
  transform: translateY(0);
58
+ max-height: 100px;
52
59
  }
53
60
  }
61
+
62
+ @keyframes highlightFade {
63
+ 0% { background-color: rgba(249, 115, 22, 0.08); }
64
+ 100% { background-color: transparent; }
65
+ }
66
+
67
+ .animate-slideIn {
68
+ animation: slideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1), highlightFade 2s 0.5s ease-out;
69
+ overflow: hidden;
70
+ }
71
+
@@ -0,0 +1,99 @@
1
+ /** Theme system — extensible for future custom themes */
2
+
3
+ export type ThemeMode = "auto" | "dark" | "light";
4
+
5
+ export interface ThemeColors {
6
+ "--color-bg": string;
7
+ "--color-bg-secondary": string;
8
+ "--color-surface": string;
9
+ "--color-surface-hover": string;
10
+ "--color-surface-raised": string;
11
+ "--color-border": string;
12
+ "--color-border-light": string;
13
+ "--color-text": string;
14
+ "--color-text-secondary": string;
15
+ "--color-text-muted": string;
16
+ "--color-text-faint": string;
17
+ "--color-accent": string;
18
+ "--color-accent-hover": string;
19
+ "--color-selection-bg": string;
20
+ "--color-selection-text": string;
21
+ "--color-scrollbar": string;
22
+ "--color-scrollbar-hover": string;
23
+ [key: string]: string;
24
+ }
25
+
26
+ export interface Theme {
27
+ id: string;
28
+ name: string;
29
+ colors: ThemeColors;
30
+ }
31
+
32
+ export const themes: Record<string, Theme> = {
33
+ dark: {
34
+ id: "dark",
35
+ name: "Dark",
36
+ colors: {
37
+ "--color-bg": "#0a0a0a",
38
+ "--color-bg-secondary": "#0f0f0f",
39
+ "--color-surface": "#111111",
40
+ "--color-surface-hover": "#0a0a0a",
41
+ "--color-surface-raised": "#1a1a1a",
42
+ "--color-border": "#1a1a1a",
43
+ "--color-border-light": "#222222",
44
+ "--color-text": "#e0e0e0",
45
+ "--color-text-secondary": "#888888",
46
+ "--color-text-muted": "#666666",
47
+ "--color-text-faint": "#555555",
48
+ "--color-accent": "#f97316",
49
+ "--color-accent-hover": "#ea580c",
50
+ "--color-accent-5": "rgba(249, 115, 22, 0.05)",
51
+ "--color-accent-10": "rgba(249, 115, 22, 0.1)",
52
+ "--color-accent-15": "rgba(249, 115, 22, 0.15)",
53
+ "--color-accent-20": "rgba(249, 115, 22, 0.2)",
54
+ "--color-accent-30": "rgba(249, 115, 22, 0.3)",
55
+ "--color-accent-70": "rgba(249, 115, 22, 0.7)",
56
+ "--color-selection-bg": "#f97316",
57
+ "--color-selection-text": "#0a0a0a",
58
+ "--color-scrollbar": "#222222",
59
+ "--color-scrollbar-hover": "#444444",
60
+ },
61
+ },
62
+ light: {
63
+ id: "light",
64
+ name: "Light",
65
+ colors: {
66
+ "--color-bg": "#ffffff",
67
+ "--color-bg-secondary": "#f7f7f7",
68
+ "--color-surface": "#ffffff",
69
+ "--color-surface-hover": "#f5f5f5",
70
+ "--color-surface-raised": "#f0f0f0",
71
+ "--color-border": "#e0e0e0",
72
+ "--color-border-light": "#e8e8e8",
73
+ "--color-text": "#1a1a1a",
74
+ "--color-text-secondary": "#555555",
75
+ "--color-text-muted": "#777777",
76
+ "--color-text-faint": "#999999",
77
+ "--color-accent": "#ea580c",
78
+ "--color-accent-hover": "#c2410c",
79
+ "--color-accent-5": "rgba(234, 88, 12, 0.05)",
80
+ "--color-accent-10": "rgba(234, 88, 12, 0.1)",
81
+ "--color-accent-15": "rgba(234, 88, 12, 0.15)",
82
+ "--color-accent-20": "rgba(234, 88, 12, 0.2)",
83
+ "--color-accent-30": "rgba(234, 88, 12, 0.3)",
84
+ "--color-accent-70": "rgba(234, 88, 12, 0.7)",
85
+ "--color-selection-bg": "#ea580c",
86
+ "--color-selection-text": "#ffffff",
87
+ "--color-scrollbar": "#cccccc",
88
+ "--color-scrollbar-hover": "#aaaaaa",
89
+ },
90
+ },
91
+ };
92
+
93
+ /** Resolve the effective theme ID from a mode + system preference */
94
+ export function resolveTheme(mode: ThemeMode, prefersDark: boolean): Theme {
95
+ if (mode === "auto") {
96
+ return prefersDark ? themes.dark : themes.light;
97
+ }
98
+ return themes[mode] || themes.dark;
99
+ }
package/src/web/types.ts CHANGED
@@ -1,10 +1,7 @@
1
1
  // Shared types for the Apteva UI
2
2
 
3
- export type AgentMode = "coordinator" | "worker";
4
-
5
3
  export interface MultiAgentConfig {
6
4
  enabled: boolean;
7
- mode?: AgentMode;
8
5
  group?: string; // Defaults to projectId if not specified
9
6
  }
10
7
 
@@ -15,7 +12,7 @@ export interface AgentBuiltinTools {
15
12
 
16
13
  export interface OperatorConfig {
17
14
  enabled: boolean;
18
- browser_provider?: string; // "browserbase" | "steel" | "browserengine" | "chrome"
15
+ browser_provider?: string; // "browserengine" | "browserbase" | "steel" | "cdp"
19
16
  display_width?: number;
20
17
  display_height?: number;
21
18
  max_actions_per_turn?: number;
@@ -60,7 +57,6 @@ export function getMultiAgentConfig(features: AgentFeatures, projectId?: string
60
57
  if (typeof agents === "boolean") {
61
58
  return {
62
59
  enabled: agents,
63
- mode: "worker",
64
60
  group: projectId || undefined,
65
61
  };
66
62
  }
@@ -100,6 +96,7 @@ export interface Agent {
100
96
  mcpServerDetails?: McpServerSummary[]; // Full details included from API
101
97
  skills: string[]; // Array of Skill IDs
102
98
  skillDetails?: SkillSummary[]; // Full details included from API
99
+ subscriptions?: { id: string; trigger_slug: string; enabled: boolean }[];
103
100
  projectId: string | null; // Optional project grouping
104
101
  createdAt: string;
105
102
  }
@@ -152,7 +149,7 @@ export interface Provider {
152
149
  keyHint: string | null;
153
150
  isValid: boolean | null;
154
151
  configured?: boolean; // for backwards compatibility
155
- isLocal?: boolean; // Uses URL instead of API key (ollama, browserengine, chrome)
152
+ isLocal?: boolean; // Uses URL instead of API key (ollama)
156
153
  }
157
154
 
158
155
  export interface OnboardingStatus {
@@ -161,7 +158,7 @@ export interface OnboardingStatus {
161
158
  has_any_keys: boolean;
162
159
  }
163
160
 
164
- export type Route = "dashboard" | "activity" | "agents" | "tasks" | "connections" | "mcp" | "skills" | "tests" | "telemetry" | "settings" | "api";
161
+ export type Route = "dashboard" | "threads" | "agents" | "activity" | "tasks" | "connections" | "mcp" | "skills" | "tests" | "telemetry" | "settings" | "api";
165
162
 
166
163
  // Tool use content block in trajectory
167
164
  export interface ToolUseBlock {
@@ -1,3 +0,0 @@
1
- import{d as a}from"./App.6q6bar8b.js";import"./App.ncgc9cxy.js";import"./App.mvtqv6qc.js";export{a as ActivityPage};
2
-
3
- //# debugId=A836402CCF3683F564756E2164756E21
@@ -1,4 +0,0 @@
1
- import{S as y,V as E,W as D,ca as l}from"./App.mvtqv6qc.js";var M=y(E(),1);var z=y(D(),1),V={get:"#61affe",post:"#49cc90",put:"#fca130",delete:"#f93e3e",patch:"#50e3c2"};function c({method:I,path:A,parameters:F,requestBody:L,authFetch:T}){let[U,R]=M.useState({}),[G,O]=M.useState(""),[_,k]=M.useState(null),[w,q]=M.useState(!1),[B,f]=M.useState(null);M.useEffect(()=>{if(L?.content?.["application/json"]?.schema){let W=L.content["application/json"].schema;if(W.example)O(JSON.stringify(W.example,null,2));else if(W.properties){let $={};for(let[N,Q]of Object.entries(W.properties))if(Q.example!==void 0)$[N]=Q.example;else if(Q.type==="string")$[N]="";else if(Q.type==="number"||Q.type==="integer")$[N]=0;else if(Q.type==="boolean")$[N]=!1;else if(Q.type==="array")$[N]=[];else if(Q.type==="object")$[N]={};O(JSON.stringify($,null,2))}}},[L]);let C=async()=>{q(!0),f(null),k(null);try{let W=A,$=[];for(let Z of F||[]){let H=U[Z.name]||"";if(Z.in==="path")W=W.replace(`{${Z.name}}`,encodeURIComponent(H));else if(Z.in==="query"&&H)$.push(`${Z.name}=${encodeURIComponent(H)}`)}if($.length>0)W+=`?${$.join("&")}`;let N={method:I.toUpperCase()};if(G&&["post","put","patch"].includes(I))N.headers={"Content-Type":"application/json"},N.body=G;let Q=await T(`/api${W}`,N),X;if(Q.headers.get("content-type")?.includes("application/json"))X=await Q.json();else X=await Q.text();k({status:Q.status,data:X})}catch(W){f(W.message||"Request failed")}finally{q(!1)}},b=F?.filter((W)=>W.in==="path")||[],K=F?.filter((W)=>W.in==="query")||[],S=["post","put","patch"].includes(I)&&L;return z.jsxDEV("div",{style:{marginTop:16,padding:16,background:"#0a0a14",borderRadius:6,border:"1px solid #222"},children:[z.jsxDEV("h4",{style:{fontSize:13,color:"#f97316",marginBottom:12,fontWeight:600},children:"Try it out"},void 0,!1,void 0,this),b.length>0&&z.jsxDEV("div",{style:{marginBottom:12},children:[z.jsxDEV("div",{style:{fontSize:11,color:"#666",marginBottom:6},children:"Path Parameters"},void 0,!1,void 0,this),b.map((W)=>z.jsxDEV("div",{style:{marginBottom:8},children:[z.jsxDEV("label",{style:{fontSize:12,color:"#888",display:"block",marginBottom:4},children:[W.name," ",W.required&&z.jsxDEV("span",{style:{color:"#f66"},children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("input",{type:"text",value:U[W.name]||"",onChange:($)=>R({...U,[W.name]:$.target.value}),placeholder:W.schema?.type||"string",style:{width:"100%",padding:"8px 12px",background:"#111",border:"1px solid #333",borderRadius:4,color:"#fff",fontSize:13,fontFamily:"monospace"}},void 0,!1,void 0,this)]},W.name,!0,void 0,this))]},void 0,!0,void 0,this),K.length>0&&z.jsxDEV("div",{style:{marginBottom:12},children:[z.jsxDEV("div",{style:{fontSize:11,color:"#666",marginBottom:6},children:"Query Parameters"},void 0,!1,void 0,this),K.map((W)=>z.jsxDEV("div",{style:{marginBottom:8},children:[z.jsxDEV("label",{style:{fontSize:12,color:"#888",display:"block",marginBottom:4},children:[W.name," ",W.required&&z.jsxDEV("span",{style:{color:"#f66"},children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("input",{type:"text",value:U[W.name]||"",onChange:($)=>R({...U,[W.name]:$.target.value}),placeholder:W.schema?.type||"string",style:{width:"100%",padding:"8px 12px",background:"#111",border:"1px solid #333",borderRadius:4,color:"#fff",fontSize:13,fontFamily:"monospace"}},void 0,!1,void 0,this)]},W.name,!0,void 0,this))]},void 0,!0,void 0,this),S&&z.jsxDEV("div",{style:{marginBottom:12},children:[z.jsxDEV("div",{style:{fontSize:11,color:"#666",marginBottom:6},children:"Request Body (JSON)"},void 0,!1,void 0,this),z.jsxDEV("textarea",{value:G,onChange:(W)=>O(W.target.value),rows:6,style:{width:"100%",padding:"8px 12px",background:"#111",border:"1px solid #333",borderRadius:4,color:"#fff",fontSize:12,fontFamily:"monospace",resize:"vertical"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("button",{onClick:C,disabled:w,style:{padding:"10px 20px",background:w?"#333":"#f97316",color:w?"#666":"#000",border:"none",borderRadius:4,cursor:w?"not-allowed":"pointer",fontSize:13,fontWeight:600},children:w?"Executing...":"Execute"},void 0,!1,void 0,this),B&&z.jsxDEV("div",{style:{marginTop:12,padding:12,background:"#2a1515",borderRadius:4,color:"#f66",fontSize:12},children:B},void 0,!1,void 0,this),_&&z.jsxDEV("div",{style:{marginTop:12},children:[z.jsxDEV("div",{style:{fontSize:11,color:"#666",marginBottom:6},children:["Response"," ",z.jsxDEV("span",{style:{color:_.status>=200&&_.status<300?"#49cc90":"#f66"},children:_.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("pre",{style:{padding:12,background:"#111",borderRadius:4,color:"#888",fontSize:11,fontFamily:"monospace",overflow:"auto",maxHeight:300,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:typeof _.data==="string"?_.data:JSON.stringify(_.data,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function h(){let{authFetch:I}=l(),[A,F]=M.useState(null),[L,T]=M.useState(!0),[U,R]=M.useState(new Set),[G,O]=M.useState(null),[_,k]=M.useState(!1);M.useEffect(()=>{B()},[]);async function w(){if(!A)return;try{await navigator.clipboard.writeText(JSON.stringify(A,null,2)),k(!0),setTimeout(()=>k(!1),2000)}catch(N){console.error("Failed to copy:",N)}}function q(){if(!A)return;let N=new Blob([JSON.stringify(A,null,2)],{type:"application/json"}),Q=URL.createObjectURL(N),X=document.createElement("a");X.href=Q,X.download="apteva-openapi.json",X.click(),URL.revokeObjectURL(Q)}async function B(){try{let N=await I("/api/openapi");if(N.ok){let Q=await N.json();F(Q)}}catch(N){console.error("Failed to load OpenAPI spec:",N)}finally{T(!1)}}function f(N){R((Q)=>{let X=new Set(Q);if(X.has(N))X.delete(N);else X.add(N);return X})}function C(N,Q=0){if(!N)return"{}";if(Q>2)return"...";if(N.$ref)return N.$ref.split("/").pop()||"Object";if(N.type==="array")return`${C(N.items,Q+1)}[]`;if(N.type==="object"&&N.properties){let X=Object.entries(N.properties).slice(0,3).map(([Z,H])=>`${Z}: ${H.type||"any"}`).join(", "),Y=Object.keys(N.properties).length>3?", ...":"";return`{ ${X}${Y} }`}return N.type||"any"}if(L)return z.jsxDEV("div",{style:{padding:24},children:z.jsxDEV("p",{style:{color:"#888"},children:"Loading API documentation..."},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(!A)return z.jsxDEV("div",{style:{padding:24},children:z.jsxDEV("p",{style:{color:"#f66"},children:"Failed to load API documentation"},void 0,!1,void 0,this)},void 0,!1,void 0,this);let b=A.tags||[],K=Object.entries(A.paths);function S(N){let Q=new Set;function X(Y){if(!Y)return;if(typeof Y==="object"){if(Y.$ref){let Z=Y.$ref.split("/").pop();if(Z)Q.add(Z)}for(let Z of Object.values(Y))X(Z)}}return X(N.requestBody),X(N.responses),Q}function W(){if(!G||!A.components?.schemas)return Object.keys(A.components?.schemas||{});let N=new Set;for(let[Q,X]of $)for(let[Y,Z]of Object.entries(X)){if(!["get","post","put","delete","patch"].includes(Y))continue;if(Z.tags?.includes(G))S(Z).forEach((g)=>N.add(g))}return Array.from(N)}let $=G?K.filter(([N,Q])=>Object.values(Q).some((X)=>X.tags?.includes(G))):K;return z.jsxDEV("div",{style:{padding:24,maxWidth:1000,height:"100%",overflowY:"auto"},children:[z.jsxDEV("div",{style:{marginBottom:24},children:[z.jsxDEV("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:8},children:[z.jsxDEV("h1",{style:{fontSize:24,fontWeight:600},children:A.info.title},void 0,!1,void 0,this),z.jsxDEV("div",{style:{display:"flex",gap:8},children:[z.jsxDEV("button",{onClick:w,style:{padding:"8px 16px",borderRadius:4,border:"1px solid #333",background:_?"#49cc90":"#1a1a2e",color:_?"#000":"#fff",cursor:"pointer",fontSize:12,fontFamily:"inherit"},children:_?"Copied!":"Copy JSON"},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:q,style:{padding:"8px 16px",borderRadius:4,border:"1px solid #333",background:"#1a1a2e",color:"#fff",cursor:"pointer",fontSize:12,fontFamily:"inherit"},children:"Download"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("p",{style:{color:"#888",marginBottom:8},children:A.info.description.split(`
2
- `)[0]},void 0,!1,void 0,this),z.jsxDEV("p",{style:{color:"#666",fontSize:12},children:["Version: ",A.info.version]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{background:"#1a1a2e",padding:12,borderRadius:6,marginBottom:24,fontFamily:"monospace"},children:[z.jsxDEV("span",{style:{color:"#888"},children:"Base URL: "},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#61affe"},children:[window.location.origin,"/api"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{marginBottom:24,display:"flex",flexWrap:"wrap",gap:8},children:[z.jsxDEV("button",{onClick:()=>O(null),style:{padding:"6px 12px",borderRadius:4,border:"1px solid #333",background:G===null?"#333":"transparent",color:G===null?"#fff":"#888",cursor:"pointer",fontSize:12},children:"All"},void 0,!1,void 0,this),b.map((N)=>z.jsxDEV("button",{onClick:()=>O(N.name),style:{padding:"6px 12px",borderRadius:4,border:"1px solid #333",background:G===N.name?"#333":"transparent",color:G===N.name?"#fff":"#888",cursor:"pointer",fontSize:12},title:N.description,children:N.name},N.name,!1,void 0,this))]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{display:"flex",flexDirection:"column",gap:8},children:$.map(([N,Q])=>Object.entries(Q).filter(([X])=>["get","post","put","delete","patch"].includes(X)).map(([X,Y])=>{let Z=`${X}:${N}`,H=U.has(Z),g=X.toUpperCase(),j=V[X]||"#888";return z.jsxDEV("div",{style:{border:"1px solid #333",borderRadius:6,overflow:"hidden"},children:[z.jsxDEV("div",{onClick:()=>f(Z),style:{display:"flex",alignItems:"center",gap:12,padding:"12px 16px",background:H?"#1a1a2e":"transparent",cursor:"pointer"},children:[z.jsxDEV("span",{style:{background:j,color:"#000",padding:"4px 8px",borderRadius:4,fontSize:11,fontWeight:600,minWidth:60,textAlign:"center"},children:g},void 0,!1,void 0,this),z.jsxDEV("span",{style:{fontFamily:"monospace",color:"#fff"},children:N},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#888",flex:1,fontSize:13},children:Y.summary},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#666",fontSize:12},children:H?"[-]":"[+]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H&&z.jsxDEV("div",{style:{padding:16,background:"#0d0d1a",borderTop:"1px solid #333"},children:[Y.description&&z.jsxDEV("p",{style:{color:"#888",marginBottom:16,fontSize:13},children:Y.description},void 0,!1,void 0,this),Y.parameters&&Y.parameters.length>0&&z.jsxDEV("div",{style:{marginBottom:16},children:[z.jsxDEV("h4",{style:{fontSize:13,color:"#888",marginBottom:8},children:"Parameters"},void 0,!1,void 0,this),z.jsxDEV("div",{style:{background:"#1a1a2e",borderRadius:4,padding:12},children:Y.parameters.map((J)=>z.jsxDEV("div",{style:{display:"flex",gap:12,marginBottom:8,fontSize:12},children:[z.jsxDEV("span",{style:{color:"#61affe",minWidth:100},children:[J.name,J.required&&z.jsxDEV("span",{style:{color:"#f66"},children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("span",{style:{color:"#666"},children:["(",J.in,")"]},void 0,!0,void 0,this),z.jsxDEV("span",{style:{color:"#888"},children:J.schema?.type||"string"},void 0,!1,void 0,this),J.description&&z.jsxDEV("span",{style:{color:"#666"},children:["- ",J.description]},void 0,!0,void 0,this)]},J.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.requestBody&&z.jsxDEV("div",{style:{marginBottom:16},children:[z.jsxDEV("h4",{style:{fontSize:13,color:"#888",marginBottom:8},children:["Request Body",Y.requestBody.required&&z.jsxDEV("span",{style:{color:"#f66"},children:" (required)"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{background:"#1a1a2e",borderRadius:4,padding:12,fontFamily:"monospace",fontSize:12,color:"#49cc90"},children:Object.entries(Y.requestBody.content||{}).map(([J,P])=>z.jsxDEV("div",{children:[z.jsxDEV("span",{style:{color:"#666"},children:[J,": "]},void 0,!0,void 0,this),C(P.schema)]},J,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.responses&&z.jsxDEV("div",{children:[z.jsxDEV("h4",{style:{fontSize:13,color:"#888",marginBottom:8},children:"Responses"},void 0,!1,void 0,this),z.jsxDEV("div",{style:{background:"#1a1a2e",borderRadius:4,padding:12},children:Object.entries(Y.responses).map(([J,P])=>{let v=P.content?.["application/json"]?.schema,u=v?.$ref?.split("/").pop(),n=v?.type,i=v?.items?.$ref?.split("/").pop();return z.jsxDEV("div",{style:{marginBottom:12,fontSize:12},children:[z.jsxDEV("div",{style:{display:"flex",gap:12,marginBottom:4},children:[z.jsxDEV("span",{style:{color:J.startsWith("2")?"#49cc90":"#f66",minWidth:40},children:J},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#888"},children:P.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&z.jsxDEV("div",{style:{marginLeft:52,padding:"8px 12px",background:"#0d0d1a",borderRadius:4,fontFamily:"monospace"},children:u?z.jsxDEV("span",{style:{color:"#61affe"},children:u},void 0,!1,void 0,this):n==="array"&&i?z.jsxDEV("span",{style:{color:"#61affe"},children:[i,"[]"]},void 0,!0,void 0,this):n==="array"?z.jsxDEV("span",{style:{color:"#888"},children:"array"},void 0,!1,void 0,this):z.jsxDEV("span",{style:{color:"#888"},children:C(v)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},J,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV(c,{method:X,path:N,parameters:Y.parameters,requestBody:Y.requestBody,authFetch:I},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},Z,!0,void 0,this)}))},void 0,!1,void 0,this),A.components?.schemas&&W().length>0&&z.jsxDEV("div",{style:{marginTop:32},children:[z.jsxDEV("h2",{style:{fontSize:18,fontWeight:600,marginBottom:16},children:["Schemas ",G&&z.jsxDEV("span",{style:{color:"#666",fontSize:14},children:["(",G,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{display:"flex",flexDirection:"column",gap:8},children:W().map((N)=>{let Q=A.components.schemas[N];if(!Q)return null;return z.jsxDEV("div",{style:{border:"1px solid #333",borderRadius:6,padding:12},children:[z.jsxDEV("h3",{style:{fontSize:14,color:"#61affe",marginBottom:8},children:N},void 0,!1,void 0,this),Q.properties&&z.jsxDEV("div",{style:{fontSize:12},children:Object.entries(Q.properties).map(([X,Y])=>z.jsxDEV("div",{style:{display:"flex",gap:8,marginBottom:4,fontFamily:"monospace"},children:[z.jsxDEV("span",{style:{color:"#fff",minWidth:120},children:X},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"#888"},children:[Y.type||(Y.$ref?Y.$ref.split("/").pop():"any"),Y.nullable&&" | null"]},void 0,!0,void 0,this),Y.enum&&z.jsxDEV("span",{style:{color:"#666"},children:["[",Y.enum.join(" | "),"]"]},void 0,!0,void 0,this)]},X,!0,void 0,this))},void 0,!1,void 0,this)]},N,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}export{h as ApiDocsPage};
3
-
4
- //# debugId=F1BCC3A63EFF032E64756E2164756E21
@@ -1,4 +0,0 @@
1
- import{O as V}from"./App.yv87t9m5.js";import{R as D}from"./App.p0fb1pds.js";import{S as P,V as Kk,W as v,Z as i,ca as o,fa as d}from"./App.mvtqv6qc.js";var J=P(Kk(),1);var q=P(v(),1);function Yk(){let{authFetch:K}=o(),{currentProjectId:X}=d(),{confirm:j,ConfirmDialog:E}=V(),[$,x]=J.useState([]),[A,c]=J.useState([]),[a,u]=J.useState(!0),[r,Y]=J.useState(!1),[H,C]=J.useState(null),[T,Q]=J.useState(new Set),[F,R]=J.useState(!1),[y,I]=J.useState(null),[w,f]=J.useState(null),[S,U]=J.useState({}),[M,N]=J.useState(""),[b,L]=J.useState(""),[g,B]=J.useState(""),Z=X&&X!=="all"&&X!=="unassigned"?X:null,n=Z?A.filter((k)=>k.projectId===Z):A,{events:p}=i({category:"test",limit:50}),_=J.useRef(new Set);J.useEffect(()=>{for(let k of p){if(_.current.has(k.id))continue;_.current.add(k.id);let z=k.data?.test_case_id;if(!z)continue;if(k.type==="test_started")U((G)=>({...G,[z]:{phase:"starting"}})),Q((G)=>new Set(G).add(z));else if(k.type==="test_planning")U((G)=>({...G,[z]:{phase:"planning"}}));else if(k.type==="test_executing"){let G=k.data?.agent_name;U((O)=>({...O,[z]:{phase:"executing",detail:G}}))}else if(k.type==="test_judging")U((G)=>({...G,[z]:{phase:"judging"}}));else if(k.type==="test_completed")U((G)=>{let O={...G};return delete O[z],O}),Q((G)=>{let O=new Set(G);return O.delete(z),O}),W()}if(_.current.size>500)_.current=new Set([..._.current].slice(-200))},[p]);let W=async()=>{try{let k=Z?`?project_id=${Z}`:"",z=await K(`/api/tests${k}`);if(z.ok)x(await z.json())}catch{}u(!1)},s=async()=>{try{let k=await K("/api/agents");if(k.ok){let z=await k.json();c((z.agents||z).map((G)=>({id:G.id,name:G.name,status:G.status,provider:G.provider,model:G.model,projectId:G.projectId||null})))}}catch{}};J.useEffect(()=>{Promise.all([W(),s()])},[X]);let l=()=>{C(null),N(""),L(""),B(""),Y(!0)},t=(k)=>{C(k),N(k.name),L(k.behavior||""),B(k.agent_id||""),Y(!0)},e=async()=>{if(!M||!b)return;let k={name:M,behavior:b,agent_id:g||null,project_id:Z||void 0};if(H)await K(`/api/tests/${H.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});else await K("/api/tests",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});Y(!1),W()},kk=async(k)=>{if(!await j("Delete this test case? Run history will also be deleted."))return;await K(`/api/tests/${k}`,{method:"DELETE"}),W()},qk=async(k)=>{Q((z)=>new Set(z).add(k));try{await K(`/api/tests/${k}/run`,{method:"POST"}),await W()}catch{}Q((z)=>{let G=new Set(z);return G.delete(k),G}),U((z)=>{let G={...z};return delete G[k],G})},zk=async()=>{R(!0);try{let k=$.map((z)=>z.id);Q(new Set(k)),await K("/api/tests/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({test_case_ids:k})}),await W()}catch{}Q(new Set),R(!1)},Gk=async(k)=>{try{let z=await K(`/api/tests/${k}/runs`);if(z.ok)I({testId:k,runs:await z.json()})}catch{}},h={starting:{label:"Starting",color:"bg-blue-900/50 text-blue-400 border-blue-500/30"},planning:{label:"Planning",color:"bg-purple-900/50 text-purple-400 border-purple-500/30"},executing:{label:"Executing",color:"bg-cyan-900/50 text-cyan-400 border-cyan-500/30"},judging:{label:"Judging",color:"bg-amber-900/50 text-amber-400 border-amber-500/30"}},m=(k)=>{return q.jsxDEV("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${{passed:"bg-green-900/50 text-green-400",failed:"bg-red-900/50 text-red-400",error:"bg-yellow-900/50 text-yellow-400",running:"bg-blue-900/50 text-blue-400"}[k]||"bg-[#222] text-[#666]"}`,children:k.toUpperCase()},void 0,!1,void 0,this)},Jk=(k)=>{let z=S[k];if(!z)return null;let G=h[z.phase]||h.starting;return q.jsxDEV("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-medium border ${G.color} animate-pulse`,children:[q.jsxDEV("span",{className:"w-1.5 h-1.5 rounded-full bg-current"},void 0,!1,void 0,this),G.label,z.detail?` · ${z.detail}`:""]},void 0,!0,void 0,this)};return q.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:[E,q.jsxDEV("div",{className:"flex items-center justify-between mb-6",children:[q.jsxDEV("div",{children:[q.jsxDEV("h1",{className:"text-xl font-bold",children:"Tests"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[#666] mt-1",children:"Describe behavior, AI handles the rest"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex gap-2",children:[$.length>0&&q.jsxDEV("button",{onClick:zk,disabled:F,className:"px-4 py-2 bg-[#1a1a1a] hover:bg-[#222] text-[#e0e0e0] rounded text-sm font-medium transition disabled:opacity-50",children:F?"Running...":"Run All"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:l,className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] text-white rounded text-sm font-medium transition",children:"+ New Test"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a?q.jsxDEV("div",{className:"text-[#666] text-sm",children:"Loading..."},void 0,!1,void 0,this):$.length===0?q.jsxDEV("div",{className:"text-center py-16",children:[q.jsxDEV("div",{className:"text-[#333] text-4xl mb-4",children:q.jsxDEV("svg",{className:"w-12 h-12 mx-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:q.jsxDEV("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-[#666] mb-2",children:"No tests yet"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#555] mb-4",children:"Describe what your agents should do and let AI verify it"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:l,className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] text-white rounded text-sm font-medium transition",children:"Create your first test"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"space-y-3",children:$.map((k)=>q.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4",children:q.jsxDEV("div",{className:"flex items-start justify-between",children:[q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("div",{className:"flex items-center gap-2 mb-1",children:[q.jsxDEV("span",{className:"font-medium text-sm",children:k.name},void 0,!1,void 0,this),S[k.id]?Jk(k.id):k.last_run&&q.jsxDEV(q.Fragment,{children:[m(k.last_run.status),k.last_run.score!=null&&q.jsxDEV("span",{className:"text-xs text-[#888] font-mono",children:[k.last_run.score,"/10"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.behavior&&q.jsxDEV("p",{className:"text-xs text-[#888] mb-1.5 line-clamp-2",children:k.behavior},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-xs text-[#666] space-y-0.5",children:[q.jsxDEV("div",{children:["Agent:"," ",q.jsxDEV("span",{className:"text-[#888]",children:k.agent_name||(k.last_run?.selected_agent_name?`${k.last_run.selected_agent_name} (auto-selected)`:"Auto (AI picks)")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.last_run?.generated_message&&q.jsxDEV("div",{className:"truncate",children:["Message: ",q.jsxDEV("span",{className:"text-[#888]",children:['"',k.last_run.generated_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.input_message&&!k.last_run?.generated_message&&q.jsxDEV("div",{className:"truncate",children:["Message: ",q.jsxDEV("span",{className:"text-[#888]",children:['"',k.input_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.last_run&&q.jsxDEV("div",{children:["Last run:"," ",q.jsxDEV("span",{className:"text-[#888]",children:[k.last_run.duration_ms?`${(k.last_run.duration_ms/1000).toFixed(1)}s`:"---",k.last_run.judge_reasoning&&` --- "${k.last_run.judge_reasoning.slice(0,80)}${k.last_run.judge_reasoning.length>80?"...":""}"`]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-1 ml-3 shrink-0",children:[q.jsxDEV("button",{onClick:()=>Gk(k.id),className:"px-2 py-1 text-xs text-[#666] hover:text-[#888] hover:bg-[#1a1a1a] rounded transition",title:"View run history",children:"History"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>qk(k.id),disabled:T.has(k.id),className:"px-3 py-1 text-xs bg-[#1a1a1a] hover:bg-[#222] text-[#e0e0e0] rounded transition disabled:opacity-50",children:T.has(k.id)?"Running...":"Run"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>t(k),className:"px-2 py-1 text-xs text-[#666] hover:text-[#888] hover:bg-[#1a1a1a] rounded transition",children:"Edit"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>kk(k.id),className:"px-2 py-1 text-xs text-[#666] hover:text-red-400 hover:bg-[#1a1a1a] rounded transition",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},k.id,!1,void 0,this))},void 0,!1,void 0,this),y&&q.jsxDEV("div",{className:"mt-6",children:[q.jsxDEV("div",{className:"flex items-center justify-between mb-3",children:[q.jsxDEV("h2",{className:"text-sm font-bold text-[#888]",children:"Run History"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:()=>{I(null),f(null)},className:"text-xs text-[#666] hover:text-[#888]",children:"Close"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y.runs.length===0?q.jsxDEV("p",{className:"text-sm text-[#666]",children:"No runs yet"},void 0,!1,void 0,this):q.jsxDEV("div",{className:"space-y-2",children:y.runs.map((k)=>q.jsxDEV("div",{className:"bg-[#0d0d0d] border border-[#1a1a1a] rounded p-3",children:[q.jsxDEV("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>f(w===k.id?null:k.id),children:[q.jsxDEV("div",{className:"flex items-center gap-3",children:[m(k.status),q.jsxDEV("span",{className:"text-xs text-[#666]",children:k.duration_ms?`${(k.duration_ms/1000).toFixed(1)}s`:"---"},void 0,!1,void 0,this),k.score!=null&&q.jsxDEV("span",{className:"text-xs text-[#888] font-mono",children:[k.score,"/10"]},void 0,!0,void 0,this),k.selected_agent_name&&q.jsxDEV("span",{className:"text-xs text-[#555]",children:["Agent: ",k.selected_agent_name]},void 0,!0,void 0,this),q.jsxDEV("span",{className:"text-xs text-[#555]",children:new Date(k.created_at).toLocaleString()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("span",{className:"text-xs text-[#555]",children:w===k.id?"---":"+"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w===k.id&&q.jsxDEV("div",{className:"mt-3 space-y-2",children:[k.planner_reasoning&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:"Planner:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[#aaa] bg-[#0a0a0a] p-2 rounded",children:[k.selected_agent_name&&q.jsxDEV("span",{className:"text-[#f97316]",children:k.selected_agent_name},void 0,!1,void 0,this),k.selected_agent_name&&" --- ",k.planner_reasoning]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.generated_message&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:"Generated Message:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[#aaa] bg-[#0a0a0a] p-2 rounded",children:['"',k.generated_message,'"']},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.judge_reasoning&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:"Judge:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-[#aaa] bg-[#0a0a0a] p-2 rounded",children:k.judge_reasoning},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.error&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-red-400 mb-1",children:"Error:"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"text-sm text-red-300 bg-[#0a0a0a] p-2 rounded",children:k.error},void 0,!1,void 0,this)]},void 0,!0,void 0,this),k.agent_response&&q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"text-xs text-[#666] mb-1",children:"Agent Response (Thread):"},void 0,!1,void 0,this),q.jsxDEV("pre",{className:"text-xs text-[#888] bg-[#0a0a0a] p-2 rounded overflow-auto max-h-64",children:k.agent_response},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},k.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r&&q.jsxDEV("div",{className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center",onClick:()=>Y(!1),children:q.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg w-full max-w-lg mx-4 p-6",onClick:(k)=>k.stopPropagation(),children:[q.jsxDEV("h2",{className:"text-lg font-bold mb-4",children:H?"Edit Test":"New Test"},void 0,!1,void 0,this),q.jsxDEV("div",{className:"space-y-4",children:[q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[#666] mb-1",children:"Name"},void 0,!1,void 0,this),q.jsxDEV("input",{value:M,onChange:(k)=>N(k.target.value),placeholder:"e.g. Social Media Posting",className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[#666] mb-1",children:"Behavior"},void 0,!1,void 0,this),q.jsxDEV("textarea",{value:b,onChange:(k)=>L(k.target.value),placeholder:"Describe what should happen, e.g. 'When asked to post on social media, the agent creates a proper post with relevant hashtags and confirms it was published'",rows:3,className:"w-full bg-[#0a0a0a] border border-[#222] rounded px-3 py-2 text-sm focus:outline-none focus:border-[#f97316] resize-none"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"AI will generate the test message and evaluate results based on this"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{children:[q.jsxDEV("label",{className:"block text-xs text-[#666] mb-1",children:"Agent"},void 0,!1,void 0,this),q.jsxDEV(D,{value:g,onChange:B,placeholder:"Auto (AI picks the best agent)",options:n.map((k)=>({value:k.id,label:`${k.name} (${k.status})`}))},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#555] mt-1",children:"Leave empty to let AI choose the right agent"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex justify-end gap-2 mt-6",children:[q.jsxDEV("button",{onClick:()=>Y(!1),className:"px-4 py-2 text-sm text-[#888] hover:text-[#e0e0e0] transition",children:"Cancel"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:e,disabled:!M||!b,className:"px-4 py-2 bg-[#f97316] hover:bg-[#fb923c] disabled:opacity-50 text-white rounded text-sm font-medium transition",children:H?"Save":"Create"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
2
- export{Yk as M};
3
-
4
- //# debugId=395511E423F4574664756E2164756E21
@@ -1,4 +0,0 @@
1
- import{R as P}from"./App.p0fb1pds.js";import{S as N,V as Qq,W as c,Y as o,ca as E,fa as u}from"./App.mvtqv6qc.js";var K=N(Qq(),1);var z=N(c(),1);function i(W){let H=W.category==="LLM",X=W.category==="TOOL",M=W.level==="error",$=W.data?.input_tokens||0,Z=W.data?.output_tokens||0;return{llm_calls:H?1:0,tool_calls:X?1:0,errors:M?1:0,input_tokens:$,output_tokens:Z}}function _q(){let{events:W,statusChangeCounter:H}=o(),{currentProjectId:X,currentProject:M}=u(),{authFetch:$}=E(),[Z,l]=K.useState(null),[C,v]=K.useState([]),[I,d]=K.useState([]),[r,h]=K.useState(!0),[Y,p]=K.useState({level:"",agent_id:""}),[k,n]=K.useState(new Set(["DATABASE"])),[R,a]=K.useState([]),[S,s]=K.useState(null),T=K.useRef(new Set),[t,m]=K.useState(new Set),f=K.useRef(new Set);K.useEffect(()=>{(async()=>{try{let G=await(await $("/api/agents")).json();a(G.agents||[])}catch(B){console.error("Failed to fetch agents:",B)}})()},[$]);let w=K.useMemo(()=>{if(X===null)return R;if(X==="unassigned")return R.filter((q)=>!q.projectId);return R.filter((q)=>q.projectId===X)},[R,X]),V=K.useMemo(()=>new Set(w.map((q)=>q.id)),[w]),g=async()=>{h(!0);try{let q=X==="unassigned"?"null":X||"",B=new URLSearchParams;if(q)B.set("project_id",q);let Q=await(await $(`/api/telemetry/stats${B.toString()?`?${B}`:""}`)).json();l(Q.stats);let J=new URLSearchParams;if(Y.level)J.set("level",Y.level);if(Y.agent_id)J.set("agent_id",Y.agent_id);if(q)J.set("project_id",q);J.set("limit","100");let O=(await(await $(`/api/telemetry/events?${J}`)).json()).events||[];v(O),T.current=new Set(O.map((Kq)=>Kq.id));let b=new URLSearchParams;if(b.set("group_by","agent"),q)b.set("project_id",q);let Jq=await(await $(`/api/telemetry/usage?${b}`)).json();d(Jq.usage||[])}catch(q){console.error("Failed to fetch telemetry:",q)}h(!1)};K.useEffect(()=>{g()},[Y,X,$,H]);let U=K.useMemo(()=>{if(!Z)return null;let q=0,B=0,G=0,Q=0,J=0,A=0;for(let y of W)if(!T.current.has(y.id)){q++;let O=i(y);B+=O.llm_calls,G+=O.tool_calls,Q+=O.errors,J+=O.input_tokens,A+=O.output_tokens}return{total_events:Z.total_events+q,total_llm_calls:Z.total_llm_calls+B,total_tool_calls:Z.total_tool_calls+G,total_errors:Z.total_errors+Q,total_input_tokens:Z.total_input_tokens+J,total_output_tokens:Z.total_output_tokens+A}},[Z,W]),D=K.useMemo(()=>{let q=new Map;for(let B of I)q.set(B.agent_id,{...B});for(let B of W)if(!T.current.has(B.id)){let G=i(B),Q=q.get(B.agent_id);if(Q)Q.llm_calls+=G.llm_calls,Q.tool_calls+=G.tool_calls,Q.errors+=G.errors,Q.input_tokens+=G.input_tokens,Q.output_tokens+=G.output_tokens;else q.set(B.agent_id,{agent_id:B.agent_id,llm_calls:G.llm_calls,tool_calls:G.tool_calls,errors:G.errors,input_tokens:G.input_tokens,output_tokens:G.output_tokens})}return Array.from(q.values())},[I,W]),F=K.default.useMemo(()=>{let q=W;if(X!==null)q=q.filter((J)=>V.has(J.agent_id));if(Y.agent_id)q=q.filter((J)=>J.agent_id===Y.agent_id);if(k.size>0)q=q.filter((J)=>!k.has(J.category));if(Y.level)q=q.filter((J)=>J.level===Y.level);let B=C;if(k.size>0)B=B.filter((J)=>!k.has(J.category));let G=new Set(q.map((J)=>J.id)),Q=[...q];for(let J of B)if(!G.has(J.id))Q.push(J),G.add(J.id);return Q.sort((J,A)=>new Date(A.timestamp).getTime()-new Date(J.timestamp).getTime()),Q.slice(0,100)},[W,C,Y,k,X,V]);K.useEffect(()=>{let q=[];for(let B of W)if(!f.current.has(B.id))f.current.add(B.id),q.push(B.id);if(q.length>0)m((B)=>{let G=new Set(B);return q.forEach((Q)=>G.add(Q)),G}),setTimeout(()=>{m((B)=>{let G=new Set(B);return q.forEach((Q)=>G.delete(Q)),G})},5000)},[W]);let x=(q)=>{return R.find((G)=>G.id===q)?.name||q},_=(q)=>{if(q>=1e6)return(q/1e6).toFixed(1)+"M";if(q>=1000)return(q/1000).toFixed(1)+"K";return q.toString()},e={debug:"text-[#555]",info:"text-blue-400",warn:"text-yellow-400",error:"text-red-400"},j={LLM:"bg-purple-500/20 text-purple-400 border-purple-500/30",TOOL:"bg-blue-500/20 text-blue-400 border-blue-500/30",CHAT:"bg-green-500/20 text-green-400 border-green-500/30",ERROR:"bg-red-500/20 text-red-400 border-red-500/30",SYSTEM:"bg-gray-500/20 text-gray-400 border-gray-500/30",TASK:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",MEMORY:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",MCP:"bg-orange-500/20 text-orange-400 border-orange-500/30",DATABASE:"bg-pink-500/20 text-pink-400 border-pink-500/30"},qq=["LLM","TOOL","CHAT","TASK","MEMORY","MCP","SYSTEM","DATABASE","ERROR"],zq=(q)=>{n((B)=>{let G=new Set(B);if(G.has(q))G.delete(q);else G.add(q);return G})},Bq=[{value:"",label:"All Agents"},...w.map((q)=>({value:q.id,label:q.name}))],Gq=[{value:"",label:"All Levels"},{value:"debug",label:"Debug"},{value:"info",label:"Info"},{value:"warn",label:"Warn"},{value:"error",label:"Error"}];return z.jsxDEV("div",{className:"flex-1 overflow-auto p-6",children:z.jsxDEV("div",{children:[z.jsxDEV("div",{className:"mb-6",children:[z.jsxDEV("div",{className:"flex items-center gap-3 mb-1",children:[M&&z.jsxDEV("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:M.color}},void 0,!1,void 0,this),z.jsxDEV("h1",{className:"text-2xl font-semibold",children:X===null?"Telemetry":X==="unassigned"?"Telemetry - Unassigned":`Telemetry - ${M?.name||""}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("p",{className:"text-[#666]",children:"Monitor agent activity, token usage, and errors."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&z.jsxDEV("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6",children:[z.jsxDEV(L,{label:"Events",value:_(U.total_events)},void 0,!1,void 0,this),z.jsxDEV(L,{label:"LLM Calls",value:_(U.total_llm_calls)},void 0,!1,void 0,this),z.jsxDEV(L,{label:"Tool Calls",value:_(U.total_tool_calls)},void 0,!1,void 0,this),z.jsxDEV(L,{label:"Errors",value:_(U.total_errors),color:"red"},void 0,!1,void 0,this),z.jsxDEV(L,{label:"Input Tokens",value:_(U.total_input_tokens)},void 0,!1,void 0,this),z.jsxDEV(L,{label:"Output Tokens",value:_(U.total_output_tokens)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),D.length>0&&z.jsxDEV("div",{className:"mb-6",children:[z.jsxDEV("h2",{className:"text-lg font-medium mb-3",children:"Usage by Agent"},void 0,!1,void 0,this),z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg overflow-hidden",children:z.jsxDEV("table",{className:"w-full text-sm",children:[z.jsxDEV("thead",{children:z.jsxDEV("tr",{className:"border-b border-[#1a1a1a] text-[#666]",children:[z.jsxDEV("th",{className:"text-left p-3",children:"Agent"},void 0,!1,void 0,this),z.jsxDEV("th",{className:"text-right p-3",children:"LLM Calls"},void 0,!1,void 0,this),z.jsxDEV("th",{className:"text-right p-3",children:"Tool Calls"},void 0,!1,void 0,this),z.jsxDEV("th",{className:"text-right p-3",children:"Input Tokens"},void 0,!1,void 0,this),z.jsxDEV("th",{className:"text-right p-3",children:"Output Tokens"},void 0,!1,void 0,this),z.jsxDEV("th",{className:"text-right p-3",children:"Errors"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("tbody",{children:D.map((q)=>z.jsxDEV("tr",{className:"border-b border-[#1a1a1a] last:border-0",children:[z.jsxDEV("td",{className:"p-3 font-medium",children:x(q.agent_id)},void 0,!1,void 0,this),z.jsxDEV("td",{className:"p-3 text-right text-[#888]",children:_(q.llm_calls)},void 0,!1,void 0,this),z.jsxDEV("td",{className:"p-3 text-right text-[#888]",children:_(q.tool_calls)},void 0,!1,void 0,this),z.jsxDEV("td",{className:"p-3 text-right text-[#888]",children:_(q.input_tokens)},void 0,!1,void 0,this),z.jsxDEV("td",{className:"p-3 text-right text-[#888]",children:_(q.output_tokens)},void 0,!1,void 0,this),z.jsxDEV("td",{className:"p-3 text-right",children:q.errors>0?z.jsxDEV("span",{className:"text-red-400",children:q.errors},void 0,!1,void 0,this):z.jsxDEV("span",{className:"text-[#444]",children:"0"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},q.agent_id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[z.jsxDEV("div",{className:"w-44",children:z.jsxDEV(P,{value:Y.agent_id,options:Bq,onChange:(q)=>p({...Y,agent_id:q}),placeholder:"All Agents"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex flex-wrap items-center gap-1.5 flex-1",children:qq.map((q)=>{let B=k.has(q),G=j[q]||"bg-[#222] text-[#888] border-[#333]";return z.jsxDEV("button",{onClick:()=>zq(q),className:`px-2 py-0.5 rounded text-xs border transition-all ${B?"bg-[#1a1a1a] text-[#555] border-[#333] opacity-50":G}`,children:q},q,!1,void 0,this)})},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("div",{className:"w-36",children:z.jsxDEV(P,{value:Y.level,options:Gq,onChange:(q)=>p({...Y,level:q}),placeholder:"All Levels"},void 0,!1,void 0,this)},void 0,!1,void 0,this),z.jsxDEV("button",{onClick:g,className:"px-3 py-2 bg-[#1a1a1a] hover:bg-[#222] border border-[#333] rounded text-sm transition",children:"Refresh"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg",children:[z.jsxDEV("div",{className:"p-3 border-b border-[#1a1a1a] flex items-center justify-between",children:[z.jsxDEV("h2",{className:"font-medium",children:"Recent Events"},void 0,!1,void 0,this),W.length>0&&z.jsxDEV("span",{className:"text-xs text-[#666]",children:[W.length," new"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),r&&F.length===0?z.jsxDEV("div",{className:"p-8 text-center text-[#666]",children:"Loading..."},void 0,!1,void 0,this):F.length===0?z.jsxDEV("div",{className:"p-8 text-center text-[#666]",children:"No telemetry events yet. Events will appear here in real-time once agents start sending data."},void 0,!1,void 0,this):z.jsxDEV("div",{className:"divide-y divide-[#1a1a1a]",children:F.map((q)=>{let B=t.has(q.id);return z.jsxDEV("div",{className:`p-3 hover:bg-[#0a0a0a] cursor-pointer transition-all duration-500 ${B?"bg-green-500/5":""}`,style:{animation:B?"slideIn 0.3s ease-out":void 0},onClick:()=>s(S===q.id?null:q.id),children:z.jsxDEV("div",{className:"flex items-start gap-3",children:[z.jsxDEV("span",{className:`px-2 py-0.5 rounded text-xs border transition-colors duration-300 ${j[q.category]||"bg-[#222] text-[#888] border-[#333]"}`,children:q.category},void 0,!1,void 0,this),z.jsxDEV("div",{className:"flex-1 min-w-0",children:[z.jsxDEV("div",{className:"flex items-center gap-2",children:[z.jsxDEV("span",{className:"font-medium text-sm",children:q.type},void 0,!1,void 0,this),z.jsxDEV("span",{className:`text-xs ${e[q.level]||"text-[#666]"}`,children:q.level},void 0,!1,void 0,this),q.duration_ms&&z.jsxDEV("span",{className:"text-xs text-[#555]",children:[q.duration_ms,"ms"]},void 0,!0,void 0,this),z.jsxDEV("span",{className:`w-1.5 h-1.5 rounded-full bg-green-400 transition-opacity duration-1000 ${B?"opacity-100":"opacity-0"}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{className:"text-xs text-[#555] mt-1",children:[x(q.agent_id)," · ",new Date(q.timestamp).toLocaleString()]},void 0,!0,void 0,this),q.error&&z.jsxDEV("div",{className:"text-xs text-red-400 mt-1 font-mono",children:q.error},void 0,!1,void 0,this),S===q.id&&q.data&&Object.keys(q.data).length>0&&z.jsxDEV("pre",{className:"text-xs text-[#666] mt-2 p-2 bg-[#0a0a0a] rounded overflow-x-auto",children:JSON.stringify(q.data,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},q.id,!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function L({label:W,value:H,color:X}){return z.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-4",children:[z.jsxDEV("div",{className:"text-[#666] text-xs mb-1",children:W},void 0,!1,void 0,this),z.jsxDEV("div",{className:`text-2xl font-semibold ${X==="red"?"text-red-400":""}`,children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
2
- export{_q as Q};
3
-
4
- //# debugId=95CAF9676B21055C64756E2164756E21
@@ -1,4 +0,0 @@
1
- import{H as u,I as c,J as E}from"./App.ncgc9cxy.js";import{S as A,V as a,W as h,Y as V,Z as x,_ as D,ca as T,fa as j}from"./App.mvtqv6qc.js";var X=A(a(),1);var q=A(h(),1);function Qq({agents:B,loading:Z,onNavigate:L}){let{authFetch:G}=T(),{currentProjectId:J}=j(),{events:$,statusChangeCounter:K}=V(),[H,Q]=X.useState(null),[W,U]=X.useState([]),[O,P]=X.useState([]),I=X.useRef(null),{events:R}=x({category:"TASK"}),N=X.useMemo(()=>{if(J===null)return B;if(J==="unassigned")return B.filter((z)=>!z.projectId);return B.filter((z)=>z.projectId===J)},[B,J]),b=X.useMemo(()=>{return[...N].sort((z,Y)=>{if(z.status==="running"&&Y.status!=="running")return-1;if(Y.status==="running"&&z.status!=="running")return 1;return z.name.localeCompare(Y.name)})},[N]),g=X.useMemo(()=>N.filter((z)=>z.status==="running").length,[N]),f=X.useMemo(()=>new Set(N.map((z)=>z.id)),[N]),d=X.useMemo(()=>{let z=new Map;return N.forEach((Y)=>z.set(Y.id,Y.name)),z},[N]),M=X.useCallback(async()=>{let z=J?`&project_id=${encodeURIComponent(J)}`:"",[Y,p]=await Promise.all([G(`/api/tasks?status=all${z}`).catch(()=>null),G(`/api/telemetry/events?type=thread_activity&limit=50${z}`).catch(()=>null)]);if(Y?.ok){let _=(await Y.json()).tasks||[];_.sort((F,w)=>{let S=F.status==="running"?0:F.status==="pending"?1:F.status==="completed"?2:3,v=w.status==="running"?0:w.status==="pending"?1:w.status==="completed"?2:3;if(S!==v)return S-v;if(S<=1){let r=F.next_run||F.execute_at?new Date(F.next_run||F.execute_at).getTime():1/0,n=w.next_run||w.execute_at?new Date(w.next_run||w.execute_at).getTime():1/0;return r-n}let o=F.completed_at||F.executed_at||F.created_at,i=w.completed_at||w.executed_at||w.created_at;return new Date(i).getTime()-new Date(o).getTime()}),U(_)}if(p?.ok){let C=await p.json();P(C.events||[])}},[G,J]);X.useEffect(()=>{M()},[M,K]),X.useEffect(()=>{if(!R.length)return;let z=R[0];if(!z||z.id===I.current)return;let Y=z.type;if(Y==="task_created"||Y==="task_updated"||Y==="task_deleted")I.current=z.id,M()},[R,M]);let y=X.useMemo(()=>{let z=$.filter((_)=>_.type==="thread_activity"),Y=new Set(z.map((_)=>_.id)),p=[...z];for(let _ of O)if(!Y.has(_.id))p.push(_),Y.add(_.id);let C=p.filter((_)=>f.has(_.agent_id));return C.sort((_,F)=>new Date(F.timestamp).getTime()-new Date(_.timestamp).getTime()),C.slice(0,50)},[$,O,f]);if(Z)return q.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[#666]",children:"Loading..."},void 0,!1,void 0,this);return q.jsxDEV("div",{className:"flex-1 flex flex-col overflow-hidden",children:[q.jsxDEV("div",{className:"px-6 pt-6 pb-4 shrink-0",children:q.jsxDEV("div",{className:"flex items-center justify-between",children:[q.jsxDEV("h1",{className:"text-xl font-semibold",children:"Activity"},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-sm text-[#666]",children:[g," of ",N.length," agents running"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[q.jsxDEV("div",{className:"flex-[2] flex flex-col overflow-hidden border-r border-[#1a1a1a]",children:[q.jsxDEV("div",{className:"px-4 py-2.5 border-b border-[#1a1a1a] shrink-0",children:q.jsxDEV("h3",{className:"text-xs font-semibold text-[#666] uppercase tracking-wider",children:"Agents"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex-1 overflow-auto px-3 py-2",children:[b.length===0?q.jsxDEV("p",{className:"text-sm text-[#555] px-2 py-4 text-center",children:"No agents found"},void 0,!1,void 0,this):q.jsxDEV("div",{className:"space-y-1",children:b.map((z)=>q.jsxDEV(s,{agent:z,selected:H===z.id,onSelect:()=>Q(H===z.id?null:z.id)},z.id,!1,void 0,this))},void 0,!1,void 0,this),H&&q.jsxDEV(t,{agent:N.find((z)=>z.id===H)||null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex-[3] flex flex-col min-h-0 overflow-hidden border-r border-[#1a1a1a]",children:[q.jsxDEV("div",{className:"px-4 py-2.5 border-b border-[#1a1a1a] flex items-center justify-between shrink-0",children:[q.jsxDEV("h3",{className:"text-xs font-semibold text-[#666] uppercase tracking-wider",children:"Activity Feed"},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-xs text-[#555]",children:y.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex-1 overflow-auto",children:y.length===0?q.jsxDEV("div",{className:"p-6 text-center text-[#555] text-sm",children:"No activity yet. Agent activity will appear here in real-time."},void 0,!1,void 0,this):q.jsxDEV("div",{className:"divide-y divide-[#1a1a1a]",children:y.map((z)=>q.jsxDEV("div",{className:"px-4 py-2.5 hover:bg-[#111]/50 transition",children:[q.jsxDEV("p",{className:"text-sm truncate",children:z.data?.activity||"Working..."},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-2 text-[10px] text-[#555] mt-0.5",children:[q.jsxDEV("span",{className:"text-[#666]",children:d.get(z.agent_id)||z.agent_id},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[#444]",children:"·"},void 0,!1,void 0,this),q.jsxDEV("span",{children:zq(z.timestamp)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},z.id,!0,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex-[3] flex flex-col overflow-hidden",children:[q.jsxDEV("div",{className:"px-4 py-2.5 border-b border-[#1a1a1a] flex items-center justify-between shrink-0",children:[q.jsxDEV("h3",{className:"text-xs font-semibold text-[#666] uppercase tracking-wider",children:"Tasks"},void 0,!1,void 0,this),L&&q.jsxDEV("button",{onClick:()=>L("tasks"),className:"text-xs text-[#3b82f6] hover:text-[#60a5fa]",children:"View All"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex-1 overflow-auto px-3 py-3",children:W.length===0?q.jsxDEV("p",{className:"text-sm text-[#555] px-2 py-4 text-center",children:"No tasks yet"},void 0,!1,void 0,this):q.jsxDEV("div",{className:"space-y-2.5",children:W.map((z)=>q.jsxDEV(e,{task:z},`${z.agentId}-${z.id}`,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function s({agent:B,selected:Z,onSelect:L}){let{isActive:G,label:J}=D(B.id),$=B.status==="running";return q.jsxDEV("button",{onClick:L,className:`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-left transition ${Z?"bg-[#f97316]/10 border border-[#f97316]/30":"hover:bg-[#1a1a1a] border border-transparent"}`,children:[q.jsxDEV("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${$&&G?"bg-green-400 animate-pulse":$?"bg-[#3b82f6]":"bg-[#444]"}`},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("div",{className:"flex items-center gap-2",children:[q.jsxDEV("span",{className:`text-sm font-medium truncate ${$?"":"text-[#666]"}`,children:B.name},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[10px] text-[#555] shrink-0",children:B.provider},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G&&J?q.jsxDEV("p",{className:"text-[11px] text-green-400 truncate",children:J},void 0,!1,void 0,this):q.jsxDEV("p",{className:`text-[11px] ${$?"text-[#555]":"text-[#444]"}`,children:$?"idle":"stopped"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function t({agent:B}){let{authFetch:Z}=T(),[L,G]=X.useState(""),[J,$]=X.useState(!1),[K,H]=X.useState(null);if(X.useEffect(()=>{G(""),H(null)},[B?.id]),!B)return null;let Q=B.status==="running",W=async()=>{if(!L.trim()||J)return;if(!Q){H("Agent is not running"),setTimeout(()=>H(null),3000);return}$(!0);try{let U=await Z(`/api/agents/${B.id}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:L,agent_id:B.id})});if(U.ok)H("Sent"),G("");else{let O=await U.json().catch(()=>({}));H(O.error||"Failed")}}catch{H("Failed to send")}finally{$(!1),setTimeout(()=>H(null),3000)}};return q.jsxDEV("div",{className:"mt-2 bg-[#0a0a0a] border border-[#1a1a1a] rounded-lg p-2.5",children:[q.jsxDEV("div",{className:"flex items-center justify-between mb-1.5",children:[q.jsxDEV("span",{className:"text-[10px] text-[#666]",children:["Send to ",q.jsxDEV("span",{className:"text-[#888]",children:B.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K&&q.jsxDEV("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${K==="Sent"?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,children:K},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex gap-1.5",children:[q.jsxDEV("input",{type:"text",value:L,onChange:(U)=>G(U.target.value),onKeyDown:(U)=>U.key==="Enter"&&W(),placeholder:Q?"Command...":"Not running",disabled:J||!Q,autoFocus:!0,className:"flex-1 bg-[#111] border border-[#1a1a1a] rounded px-2 py-1.5 text-xs focus:outline-none focus:border-[#f97316] placeholder-[#444] disabled:opacity-50"},void 0,!1,void 0,this),q.jsxDEV("button",{onClick:W,disabled:J||!L.trim()||!Q,className:"px-2.5 py-1.5 bg-[#f97316]/20 text-[#f97316] rounded text-xs font-medium hover:bg-[#f97316]/30 transition disabled:opacity-30",children:J?"...":"Send"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var k={pending:"bg-yellow-500/20 text-yellow-400",running:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",failed:"bg-red-500/20 text-red-400",cancelled:"bg-gray-500/20 text-gray-400"},m=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function e({task:B}){return q.jsxDEV("div",{className:"bg-[#111] border border-[#1a1a1a] rounded-lg p-3 hover:border-[#333] transition",children:[q.jsxDEV("div",{className:"flex items-start justify-between mb-1.5",children:[q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("h4",{className:"text-sm font-medium truncate",children:B.title},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-xs text-[#666]",children:B.agentName},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium shrink-0 ml-2 ${k[B.status]||k.pending}`,children:B.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-[#555]",children:[q.jsxDEV("span",{className:"flex items-center gap-1",children:[B.type==="recurring"?q.jsxDEV(u,{className:"w-3 h-3"},void 0,!1,void 0,this):B.execute_at?q.jsxDEV(c,{className:"w-3 h-3"},void 0,!1,void 0,this):q.jsxDEV(E,{className:"w-3 h-3"},void 0,!1,void 0,this),B.type==="recurring"&&B.recurrence?qq(B.recurrence):B.type]},void 0,!0,void 0,this),B.next_run&&q.jsxDEV("span",{className:"text-[#f97316]",children:l(B.next_run)},void 0,!1,void 0,this),!B.next_run&&B.execute_at&&q.jsxDEV("span",{className:"text-[#f97316]",children:l(B.execute_at)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function qq(B){try{let Z=B.trim().split(/\s+/);if(Z.length!==5)return B;let[L,G,J,$,K]=Z;if(L.startsWith("*/")&&G==="*"&&J==="*"&&$==="*"&&K==="*"){let Q=parseInt(L.slice(2));return Q===1?"Every min":`Every ${Q}min`}if(L!=="*"&&!L.includes("/")&&G==="*"&&J==="*"&&$==="*"&&K==="*")return"Hourly";if(G.startsWith("*/")&&J==="*"&&$==="*"&&K==="*"){let Q=parseInt(G.slice(2));return Q===1?"Hourly":`Every ${Q}h`}let H=(Q,W)=>{let U=parseInt(Q),O=parseInt(W);if(isNaN(U))return"";let P=U>=12?"PM":"AM";return`${U===0?12:U>12?U-12:U}:${O.toString().padStart(2,"0")} ${P}`};if(G!=="*"&&!G.includes("/")&&J==="*"&&$==="*"){let Q=H(G,L);if(K==="*")return`Daily ${Q}`;let W=K.split(",").map((U)=>m[parseInt(U.trim())]||U);if(W.length===1)return`${W[0]} ${Q}`;return`${W.join(", ")} ${Q}`}return B}catch{return B}}function l(B){let Z=new Date(B),L=new Date,G=Z.getTime()-L.getTime(),J=G>0,$=Math.abs(G),K=Math.floor($/60000),H=Math.floor($/3600000),Q=Z.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),W=Z.toDateString()===L.toDateString(),U=new Date(L);U.setDate(U.getDate()+1);let O=Z.toDateString()===U.toDateString();if(W){if(K<1)return"now";if(K<60)return J?`in ${K}m`:`${K}m ago`;return J?`in ${H}h (${Q})`:`${H}h ago`}if(O)return`Tomorrow ${Q}`;return`${m[Z.getDay()]} ${Q}`}function zq(B){let Z=Math.floor((Date.now()-new Date(B).getTime())/1000);if(Z<5)return"just now";if(Z<60)return`${Z}s ago`;let L=Math.floor(Z/60);if(L<60)return`${L}m ago`;let G=Math.floor(L/60);if(G<24)return`${G}h ago`;return`${Math.floor(G/24)}d ago`}
2
- export{Qq as d};
3
-
4
- //# debugId=A710C5DDE644C40564756E2164756E21