apteva 0.4.57 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +216 -54
  2. package/cli.js +35 -0
  3. package/install.js +92 -0
  4. package/package.json +12 -79
  5. package/LICENSE +0 -63
  6. package/bin/apteva.js +0 -196
  7. package/dist/ActivityPage.kxzzb4yc.js +0 -3
  8. package/dist/ApiDocsPage.zq998hbm.js +0 -4
  9. package/dist/App.55rea8mn.js +0 -61
  10. package/dist/App.5ywb23z4.js +0 -53
  11. package/dist/App.6thds120.js +0 -4
  12. package/dist/App.9tctxzqm.js +0 -8
  13. package/dist/App.a8r8ttaz.js +0 -4
  14. package/dist/App.agsv5bje.js +0 -4
  15. package/dist/App.cepapqmx.js +0 -4
  16. package/dist/App.dp041gb3.js +0 -221
  17. package/dist/App.fds72zb5.js +0 -4
  18. package/dist/App.fg9qj2dq.js +0 -4
  19. package/dist/App.ndfejbm9.js +0 -4
  20. package/dist/App.nxmfmq1h.js +0 -13
  21. package/dist/App.qdfyt8ba.js +0 -4
  22. package/dist/App.x2d0ygt6.js +0 -4
  23. package/dist/App.yt9p4nr3.js +0 -20
  24. package/dist/App.zn4mw16t.js +0 -1
  25. package/dist/ConnectionsPage.8r96ryw7.js +0 -3
  26. package/dist/McpPage.3cwh0gnd.js +0 -3
  27. package/dist/SettingsPage.ykgdh5ev.js +0 -3
  28. package/dist/SkillsPage.4np1s65b.js +0 -3
  29. package/dist/TasksPage.4g08t7p6.js +0 -3
  30. package/dist/TelemetryPage.72w9pwcp.js +0 -3
  31. package/dist/TestsPage.z4fk3r7r.js +0 -3
  32. package/dist/ThreadsPage.63tcajeh.js +0 -3
  33. package/dist/apteva-kit.css +0 -1
  34. package/dist/icon.png +0 -0
  35. package/dist/index.html +0 -16
  36. package/dist/styles.css +0 -1
  37. package/scripts/postinstall.mjs +0 -102
  38. package/src/auth/index.ts +0 -394
  39. package/src/auth/middleware.ts +0 -213
  40. package/src/binary.ts +0 -536
  41. package/src/channels/index.ts +0 -40
  42. package/src/channels/telegram.ts +0 -311
  43. package/src/crypto.ts +0 -301
  44. package/src/db-tests.ts +0 -174
  45. package/src/db.ts +0 -3133
  46. package/src/integrations/agentdojo.ts +0 -559
  47. package/src/integrations/composio.ts +0 -437
  48. package/src/integrations/index.ts +0 -87
  49. package/src/integrations/skillsmp.ts +0 -318
  50. package/src/mcp-client.ts +0 -605
  51. package/src/mcp-handler.ts +0 -394
  52. package/src/mcp-platform.ts +0 -2403
  53. package/src/openapi.ts +0 -2410
  54. package/src/providers.ts +0 -597
  55. package/src/routes/api/agent-utils.ts +0 -890
  56. package/src/routes/api/agents.ts +0 -916
  57. package/src/routes/api/api-keys.ts +0 -95
  58. package/src/routes/api/channels.ts +0 -182
  59. package/src/routes/api/helpers.ts +0 -12
  60. package/src/routes/api/integrations.ts +0 -639
  61. package/src/routes/api/mcp.ts +0 -574
  62. package/src/routes/api/meta-agent.ts +0 -195
  63. package/src/routes/api/projects.ts +0 -112
  64. package/src/routes/api/providers.ts +0 -424
  65. package/src/routes/api/skills.ts +0 -537
  66. package/src/routes/api/system.ts +0 -333
  67. package/src/routes/api/telemetry.ts +0 -203
  68. package/src/routes/api/tests.ts +0 -148
  69. package/src/routes/api/triggers.ts +0 -518
  70. package/src/routes/api/users.ts +0 -148
  71. package/src/routes/api/webhooks.ts +0 -171
  72. package/src/routes/api.ts +0 -53
  73. package/src/routes/auth.ts +0 -251
  74. package/src/routes/share.ts +0 -86
  75. package/src/routes/static.ts +0 -131
  76. package/src/server.ts +0 -642
  77. package/src/test-runner.ts +0 -598
  78. package/src/triggers/agentdojo.ts +0 -253
  79. package/src/triggers/composio.ts +0 -264
  80. package/src/triggers/index.ts +0 -71
  81. package/src/tui/AgentList.tsx +0 -145
  82. package/src/tui/App.tsx +0 -102
  83. package/src/tui/Login.tsx +0 -104
  84. package/src/tui/api.ts +0 -72
  85. package/src/tui/index.tsx +0 -7
  86. package/src/web/App.tsx +0 -455
  87. package/src/web/components/activity/ActivityPage.tsx +0 -314
  88. package/src/web/components/activity/index.ts +0 -1
  89. package/src/web/components/agents/AgentCard.tsx +0 -189
  90. package/src/web/components/agents/AgentPanel.tsx +0 -2244
  91. package/src/web/components/agents/AgentsView.tsx +0 -180
  92. package/src/web/components/agents/CreateAgentModal.tsx +0 -475
  93. package/src/web/components/agents/index.ts +0 -4
  94. package/src/web/components/api/ApiDocsPage.tsx +0 -842
  95. package/src/web/components/auth/CreateAccountStep.tsx +0 -176
  96. package/src/web/components/auth/LoginPage.tsx +0 -91
  97. package/src/web/components/auth/index.ts +0 -2
  98. package/src/web/components/common/Icons.tsx +0 -250
  99. package/src/web/components/common/LoadingSpinner.tsx +0 -44
  100. package/src/web/components/common/Modal.tsx +0 -199
  101. package/src/web/components/common/Select.tsx +0 -97
  102. package/src/web/components/common/index.ts +0 -20
  103. package/src/web/components/connections/ConnectionsPage.tsx +0 -54
  104. package/src/web/components/connections/IntegrationsTab.tsx +0 -170
  105. package/src/web/components/connections/OverviewTab.tsx +0 -137
  106. package/src/web/components/connections/TriggersTab.tsx +0 -1346
  107. package/src/web/components/dashboard/Dashboard.tsx +0 -572
  108. package/src/web/components/dashboard/index.ts +0 -1
  109. package/src/web/components/index.ts +0 -21
  110. package/src/web/components/layout/ErrorBanner.tsx +0 -18
  111. package/src/web/components/layout/Header.tsx +0 -332
  112. package/src/web/components/layout/Sidebar.tsx +0 -231
  113. package/src/web/components/layout/index.ts +0 -3
  114. package/src/web/components/mcp/IntegrationsPanel.tsx +0 -857
  115. package/src/web/components/mcp/McpPage.tsx +0 -2515
  116. package/src/web/components/mcp/index.ts +0 -1
  117. package/src/web/components/meta-agent/MetaAgent.tsx +0 -245
  118. package/src/web/components/onboarding/OnboardingWizard.tsx +0 -404
  119. package/src/web/components/onboarding/index.ts +0 -1
  120. package/src/web/components/settings/SettingsPage.tsx +0 -2776
  121. package/src/web/components/settings/index.ts +0 -1
  122. package/src/web/components/skills/SkillsPage.tsx +0 -1200
  123. package/src/web/components/tasks/TasksPage.tsx +0 -1116
  124. package/src/web/components/tasks/index.ts +0 -1
  125. package/src/web/components/telemetry/TelemetryPage.tsx +0 -1129
  126. package/src/web/components/tests/TestsPage.tsx +0 -594
  127. package/src/web/components/threads/ThreadsPage.tsx +0 -315
  128. package/src/web/context/AuthContext.tsx +0 -242
  129. package/src/web/context/ProjectContext.tsx +0 -214
  130. package/src/web/context/TelemetryContext.tsx +0 -299
  131. package/src/web/context/ThemeContext.tsx +0 -90
  132. package/src/web/context/UIModeContext.tsx +0 -49
  133. package/src/web/context/index.ts +0 -12
  134. package/src/web/hooks/index.ts +0 -3
  135. package/src/web/hooks/useAgents.ts +0 -115
  136. package/src/web/hooks/useOnboarding.ts +0 -20
  137. package/src/web/hooks/useProviders.ts +0 -75
  138. package/src/web/icon.png +0 -0
  139. package/src/web/index.html +0 -16
  140. package/src/web/styles.css +0 -118
  141. package/src/web/themes.ts +0 -162
  142. package/src/web/types.ts +0 -298
package/bin/apteva.js DELETED
@@ -1,196 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { spawn, execFileSync } from "child_process";
4
- import { createRequire } from "module";
5
- import { fileURLToPath } from "url";
6
- import { dirname, join } from "path";
7
- import { existsSync, readFileSync } from "fs";
8
-
9
- const __filename = fileURLToPath(import.meta.url);
10
- const __dirname = dirname(__filename);
11
- const require = createRequire(import.meta.url);
12
-
13
- // Parse command line arguments
14
- const args = process.argv.slice(2);
15
- let port = 4280;
16
- let dataDir = null;
17
- let configFile = null;
18
- let showHelp = false;
19
- let showVersion = false;
20
-
21
- for (let i = 0; i < args.length; i++) {
22
- const arg = args[i];
23
- if (arg === "--port" || arg === "-p") {
24
- port = parseInt(args[++i]) || 4280;
25
- } else if (arg === "--data-dir" || arg === "-d") {
26
- dataDir = args[++i];
27
- } else if (arg === "--config" || arg === "-c") {
28
- configFile = args[++i];
29
- } else if (arg === "--help" || arg === "-h" || arg === "help") {
30
- showHelp = true;
31
- } else if (arg === "--version" || arg === "-v" || arg === "version") {
32
- showVersion = true;
33
- }
34
- }
35
-
36
- if (showVersion) {
37
- const pkgPath = join(__dirname, "..", "package.json");
38
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
39
- console.log(`apteva v${pkg.version}`);
40
- process.exit(0);
41
- }
42
-
43
- if (showHelp) {
44
- console.log(`
45
- apteva - Run AI agents locally
46
-
47
- USAGE:
48
- apteva [options]
49
- apteva <command>
50
-
51
- COMMANDS:
52
- start Start the agent server (default)
53
- version Show version information
54
- help Show this help message
55
-
56
- OPTIONS:
57
- -p, --port <port> Port to listen on (default: 4280)
58
- -d, --data-dir <dir> Directory for data storage
59
- -c, --config <file> Path to config file
60
- -h, --help Show this help message
61
- -v, --version Show version information
62
-
63
- ENVIRONMENT VARIABLES:
64
- PORT Server port (default: 4280)
65
- DATA_DIR Data directory
66
- ANTHROPIC_API_KEY Anthropic (Claude) API key
67
- OPENAI_API_KEY OpenAI API key
68
- GROQ_API_KEY Groq API key
69
- GEMINI_API_KEY Google Gemini API key
70
- XAI_API_KEY xAI (Grok) API key
71
- FIREWORKS_API_KEY Fireworks AI API key
72
- MOONSHOT_API_KEY Moonshot AI API key
73
- TOGETHER_API_KEY Together AI API key
74
-
75
- EXAMPLES:
76
- apteva Start on default port (4280)
77
- apteva --port 8080 Start on port 8080
78
- apteva --data-dir ./my-data Use custom data directory
79
- apteva --config ./config.json Use config file
80
-
81
- DOCUMENTATION:
82
- https://github.com/apteva/apteva
83
- https://apteva.com/docs
84
- `);
85
- process.exit(0);
86
- }
87
-
88
- // ============ Find the server executable ============
89
-
90
- // Build environment
91
- const env = { ...process.env };
92
- env.PORT = String(port);
93
- if (dataDir) env.DATA_DIR = dataDir;
94
- if (configFile) env.CONFIG_FILE = configFile;
95
-
96
- // Strategy 1: Compiled platform binary (works without Bun)
97
- function findCompiledBinary() {
98
- const platform = { darwin: "darwin", linux: "linux", win32: "win32" }[process.platform];
99
- const arch = { x64: "x64", arm64: "arm64" }[process.arch];
100
- if (!platform || !arch) return null;
101
-
102
- const packageName = `@apteva/apteva-${platform}-${arch}`;
103
-
104
- // Try require.resolve() first (most reliable for npm-installed packages)
105
- try {
106
- const binaryPath = require(packageName);
107
- if (existsSync(binaryPath)) return binaryPath;
108
- } catch {
109
- // Package not installed
110
- }
111
-
112
- // Try direct paths in node_modules
113
- const binaryName = process.platform === "win32" ? "apteva.exe" : "apteva";
114
- const directPaths = [
115
- join(__dirname, "..", "node_modules", packageName, binaryName),
116
- join(__dirname, "..", "..", packageName, binaryName),
117
- ];
118
- for (const p of directPaths) {
119
- if (existsSync(p)) return p;
120
- }
121
-
122
- // Try postinstall symlink
123
- const symlinkPath = join(__dirname, process.platform === "win32" ? "apteva-server.exe" : "apteva-server");
124
- if (existsSync(symlinkPath)) return symlinkPath;
125
-
126
- return null;
127
- }
128
-
129
- // Strategy 2: Source mode with Bun
130
- function findSourceEntry() {
131
- const serverPath = join(__dirname, "..", "src", "server.ts");
132
- if (existsSync(serverPath)) return serverPath;
133
- return null;
134
- }
135
-
136
- function hasBun() {
137
- try {
138
- execFileSync("bun", ["--version"], { stdio: "ignore" });
139
- return true;
140
- } catch {
141
- return false;
142
- }
143
- }
144
-
145
- // Try compiled binary first
146
- const compiledBinary = findCompiledBinary();
147
- if (compiledBinary) {
148
- // Run the compiled binary directly — no Bun needed
149
- const child = spawn(compiledBinary, [], {
150
- env,
151
- stdio: "inherit",
152
- shell: false,
153
- });
154
-
155
- child.on("error", (err) => {
156
- console.error("Error starting apteva:", err.message);
157
- process.exit(1);
158
- });
159
-
160
- child.on("exit", (code) => process.exit(code || 0));
161
- process.on("SIGINT", () => child.kill("SIGINT"));
162
- process.on("SIGTERM", () => child.kill("SIGTERM"));
163
- } else {
164
- // Fall back to source mode
165
- const sourceEntry = findSourceEntry();
166
-
167
- if (sourceEntry && hasBun()) {
168
- // Run with Bun (development mode)
169
- const child = spawn("bun", ["--silent", sourceEntry], {
170
- env,
171
- stdio: "inherit",
172
- shell: false,
173
- });
174
-
175
- child.on("error", (err) => {
176
- console.error("Error starting apteva:", err.message);
177
- process.exit(1);
178
- });
179
-
180
- child.on("exit", (code) => process.exit(code || 0));
181
- process.on("SIGINT", () => child.kill("SIGINT"));
182
- process.on("SIGTERM", () => child.kill("SIGTERM"));
183
- } else {
184
- // No binary, no Bun — show helpful error
185
- console.error("Error: Could not find apteva binary for your platform.");
186
- console.error("");
187
- console.error("Options:");
188
- console.error(" 1. Install Bun (recommended for development):");
189
- console.error(" curl -fsSL https://bun.sh/install | bash # macOS/Linux");
190
- console.error(" powershell -c \"irm bun.sh/install.ps1 | iex\" # Windows");
191
- console.error("");
192
- console.error(" 2. Reinstall apteva (to get the platform binary):");
193
- console.error(" npm install -g apteva");
194
- process.exit(1);
195
- }
196
- }
@@ -1,3 +0,0 @@
1
- import{V as A}from"./App.fg9qj2dq.js";import{Y as C,aa as V,ba as L,da as P,ka as S,na as b}from"./App.yt9p4nr3.js";var W=C(V(),1);var q=C(L(),1),x=new Set(["thread_activity","agent_started","agent_stopped","agent_error","task_created","task_updated","task_deleted","task_executed","llm_request","tool_invocation","mcp_request","mcp_tool_execution"]),j={CHAT:"bg-green-400",LLM:"bg-purple-400",TOOL:"bg-blue-400",TASK:"bg-yellow-400",MEMORY:"bg-cyan-400",MCP:"bg-orange-400",SYSTEM:"bg-gray-400",ERROR:"bg-red-400"};function m($,G){let U=$.data||{};switch($.type){case"thread_activity":return U.activity||"Working...";case"agent_started":return"Agent started";case"agent_stopped":return U.reason?`Agent stopped (${U.reason})`:"Agent stopped";case"agent_error":return $.error||"Agent error";case"llm_request":return"Thinking...";case"tool_invocation":{let Q=U.tool_name||"";if(!Q)return"Using tools";return`Tool: ${Q.replace(/[-_]/g," ").replace(/\b\w/g,(Z)=>Z.toUpperCase())}`}case"task_created":return U.title?`Task created: ${U.title}`:"Task created";case"task_updated":{let{status:Q,title:X}=U,Z=Q?Q.charAt(0).toUpperCase()+Q.slice(1):null;if(X&&Z)return`Task ${Z}: ${X}`;if(Z)return`Task ${Z}`;if(X)return`Task updated: ${X}`;return"Task updated"}case"task_deleted":return"Task deleted";case"task_executed":{let Q=U.title;return Q?`Task started: ${Q}`:"Task started"}case"memory_stored":return"Memory stored";case"memory_retrieved":return"Memory retrieved";case"mcp_request":return U.server?`MCP request to ${U.server}`:"MCP request";case"mcp_tool_execution":{let Q=U.tool_name||U.tool||"";if(!Q)return"MCP tool call";return`MCP: ${(Q.includes("__")?Q.split("__").slice(1).join("__"):Q).replace(/[-_]/g," ").replace(/\b\w/g,(H)=>H.toUpperCase())}`}default:return $.type.replace(/_/g," ")}}function l({agents:$,loading:G,onNavigate:U}){let{authFetch:Q}=S(),{currentProjectId:X}=b(),{events:Z,statusChangeCounter:H}=P(),[_,p]=W.useState([]),[R,I]=W.useState(""),[O]=W.useState(()=>new Set),y=W.useRef(!1),Y=W.useMemo(()=>{if(X===null)return $;if(X==="unassigned")return $.filter((z)=>!z.projectId);return $.filter((z)=>z.projectId===X)},[$,X]),N=W.useMemo(()=>new Set(Y.map((z)=>z.id)),[Y]),h=W.useMemo(()=>{let z=new Map;return Y.forEach((J)=>z.set(J.id,J.name)),z},[Y]),w=W.useCallback(async()=>{let z=X?`&project_id=${encodeURIComponent(X)}`:"";try{let J=await Q(`/api/telemetry/events?limit=200${z}`);if(J.ok){let B=await J.json();p(B.events||[])}}catch{}},[Q,X]);W.useEffect(()=>{w()},[w,H]),W.useEffect(()=>{if(_.length>0&&!y.current){for(let z of _)O.add(z.id);for(let z of Z)O.add(z.id);y.current=!0}},[_,Z,O]);let M=W.useMemo(()=>{let z=new Set,J=[],B=(K)=>{if(!x.has(K.type)||!N.has(K.agent_id)||K.data?.parent_id)return!1;if(K.type==="mcp_tool_execution"&&!K.duration_ms)return!1;return!0};for(let K of Z)if(!z.has(K.id)&&B(K))J.push(K),z.add(K.id);for(let K of _)if(!z.has(K.id)&&B(K))J.push(K),z.add(K.id);let k=J;if(R)k=k.filter((K)=>K.agent_id===R);return k.sort((K,F)=>new Date(F.timestamp).getTime()-new Date(K.timestamp).getTime()),k.slice(0,200)},[Z,_,N,R]),f=W.useMemo(()=>{let z=[],J="",B=new Date().toDateString(),k=new Date(Date.now()-86400000).toDateString();for(let K of M){let F=new Date(K.timestamp).toDateString(),T=F===B?"Today":F===k?"Yesterday":F;if(T!==J)J=T,z.push({label:T,events:[]});z[z.length-1].events.push(K)}return z},[M]);if(G)return q.jsxDEV("div",{className:"flex-1 flex items-center justify-center text-[var(--color-text-muted)]",children:"Loading..."},void 0,!1,void 0,this);let D=Y.filter((z)=>z.status==="running").length;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 gap-4",children:[q.jsxDEV("div",{children:[q.jsxDEV("h1",{className:"text-xl font-semibold",children:"Activity"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm text-[var(--color-text-muted)] mt-0.5",children:[D," of ",Y.length," agents running"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("div",{className:"w-48",children:q.jsxDEV(A,{value:R,onChange:I,placeholder:"All agents",options:[{value:"",label:"All agents"},...Y.map((z)=>({value:z.id,label:z.name}))]},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex-1 overflow-auto px-6 pb-6",children:M.length===0?q.jsxDEV("div",{className:"flex flex-col items-center justify-center py-20 text-[var(--color-text-faint)]",children:[q.jsxDEV("p",{className:"text-lg mb-2",children:"No activity yet"},void 0,!1,void 0,this),q.jsxDEV("p",{className:"text-sm",children:"Agent activity will appear here in real-time."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q.jsxDEV("div",{className:"max-w-2xl",children:f.map((z)=>q.jsxDEV("div",{children:[q.jsxDEV("div",{className:"sticky top-0 z-10 bg-[var(--color-bg)] backdrop-blur-sm py-2 mb-1",children:q.jsxDEV("span",{className:"text-xs font-semibold text-[var(--color-text-muted)] uppercase tracking-wider",children:z.label},void 0,!1,void 0,this)},void 0,!1,void 0,this),q.jsxDEV("div",{className:"relative ml-3 border-l border-[var(--color-border)]",children:z.events.map((J)=>{let B=!O.has(J.id);if(B)O.add(J.id);let k=h.get(J.agent_id)||J.agent_id.slice(0,8),K=J.level==="error"?"bg-red-400":j[J.category]||"bg-[var(--color-text-faint)]";return q.jsxDEV("div",{className:`relative pl-6 pr-3 py-2.5 hover:bg-[var(--color-surface-hover)] transition-colors ${B?"animate-slideIn":""}`,children:[q.jsxDEV("span",{className:`absolute left-[-4.5px] top-[14px] w-[9px] h-[9px] rounded-full ${K} ring-2 ring-[#0a0a0a]`},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-start justify-between gap-3",children:[q.jsxDEV("div",{className:"flex-1 min-w-0",children:[q.jsxDEV("p",{className:`text-sm ${J.level==="error"?"text-red-400":""}`,children:m(J,k)},void 0,!1,void 0,this),q.jsxDEV("div",{className:"flex items-center gap-2 text-[11px] text-[var(--color-text-faint)] mt-0.5",children:[q.jsxDEV("span",{className:"text-[var(--color-text-secondary)] font-medium",children:k},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[var(--color-border-light)]",children:"·"},void 0,!1,void 0,this),q.jsxDEV("span",{className:"text-[var(--color-text-faint)]",children:J.category},void 0,!1,void 0,this),J.duration_ms!=null&&J.duration_ms>0&&q.jsxDEV(q.Fragment,{children:[q.jsxDEV("span",{className:"text-[var(--color-border-light)]",children:"·"},void 0,!1,void 0,this),q.jsxDEV("span",{children:J.duration_ms<1000?`${J.duration_ms}ms`:`${(J.duration_ms/1000).toFixed(1)}s`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.jsxDEV("span",{className:"text-[11px] text-[var(--color-text-faint)] shrink-0 pt-0.5",children:g(J.timestamp)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},J.id,!0,void 0,this)})},void 0,!1,void 0,this)]},z.label,!0,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function g($){let G=Math.floor((Date.now()-new Date($).getTime())/1000);if(G<5)return"just now";if(G<60)return`${G}s ago`;let U=Math.floor(G/60);if(U<60)return`${U}m ago`;let Q=Math.floor(U/60);if(Q<24)return`${Q}h ago`;return`${Math.floor(Q/24)}d ago`}export{l as ActivityPage};
2
-
3
- //# debugId=4FC9AA385DD2FB5464756E2164756E21
@@ -1,4 +0,0 @@
1
- import{Y as y,aa as E,ba as D,ka as l}from"./App.yt9p4nr3.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:"var(--color-bg)",borderRadius:6,border:"1px solid var(--color-border-light)"},children:[z.jsxDEV("h4",{style:{fontSize:13,color:"var(--color-accent)",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:"var(--color-text-muted)",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:"var(--color-text-secondary)",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:"var(--color-surface)",border:"1px solid var(--color-border-light)",borderRadius:4,color:"var(--color-text)",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:"var(--color-text-muted)",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:"var(--color-text-secondary)",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:"var(--color-surface)",border:"1px solid var(--color-border-light)",borderRadius:4,color:"var(--color-text)",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:"var(--color-text-muted)",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:"var(--color-surface)",border:"1px solid var(--color-border-light)",borderRadius:4,color:"var(--color-text)",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?"var(--color-border-light)":"var(--color-accent)",color:w?"var(--color-text-muted)":"#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:"var(--color-text-muted)",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:"var(--color-surface)",borderRadius:4,color:"var(--color-text-secondary)",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:"var(--color-text-secondary)"},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 var(--color-border-light)",background:_?"#49cc90":"var(--color-surface-raised)",color:_?"#000":"var(--color-text)",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 var(--color-border-light)",background:"var(--color-surface-raised)",color:"var(--color-text)",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:"var(--color-text-secondary)",marginBottom:8},children:A.info.description.split(`
2
- `)[0]},void 0,!1,void 0,this),z.jsxDEV("p",{style:{color:"var(--color-text-muted)",fontSize:12},children:["Version: ",A.info.version]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z.jsxDEV("div",{style:{background:"var(--color-surface-raised)",padding:12,borderRadius:6,marginBottom:24,fontFamily:"monospace"},children:[z.jsxDEV("span",{style:{color:"var(--color-text-secondary)"},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 var(--color-border-light)",background:G===null?"var(--color-border-light)":"transparent",color:G===null?"var(--color-text)":"var(--color-text-secondary)",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 var(--color-border-light)",background:G===N.name?"var(--color-border-light)":"transparent",color:G===N.name?"var(--color-text)":"var(--color-text-secondary)",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]||"var(--color-text-secondary)";return z.jsxDEV("div",{style:{border:"1px solid var(--color-border-light)",borderRadius:6,overflow:"hidden"},children:[z.jsxDEV("div",{onClick:()=>f(Z),style:{display:"flex",alignItems:"center",gap:12,padding:"12px 16px",background:H?"var(--color-surface-raised)":"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:"var(--color-text)"},children:N},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"var(--color-text-secondary)",flex:1,fontSize:13},children:Y.summary},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"var(--color-text-muted)",fontSize:12},children:H?"[-]":"[+]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H&&z.jsxDEV("div",{style:{padding:16,background:"var(--color-bg)",borderTop:"1px solid var(--color-border-light)"},children:[Y.description&&z.jsxDEV("p",{style:{color:"var(--color-text-secondary)",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:"var(--color-text-secondary)",marginBottom:8},children:"Parameters"},void 0,!1,void 0,this),z.jsxDEV("div",{style:{background:"var(--color-surface-raised)",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:"var(--color-text-muted)"},children:["(",J.in,")"]},void 0,!0,void 0,this),z.jsxDEV("span",{style:{color:"var(--color-text-secondary)"},children:J.schema?.type||"string"},void 0,!1,void 0,this),J.description&&z.jsxDEV("span",{style:{color:"var(--color-text-muted)"},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:"var(--color-text-secondary)",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:"var(--color-surface-raised)",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:"var(--color-text-muted)"},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:"var(--color-text-secondary)",marginBottom:8},children:"Responses"},void 0,!1,void 0,this),z.jsxDEV("div",{style:{background:"var(--color-surface-raised)",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:"var(--color-text-secondary)"},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:"var(--color-bg)",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:"var(--color-text-secondary)"},children:"array"},void 0,!1,void 0,this):z.jsxDEV("span",{style:{color:"var(--color-text-secondary)"},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:"var(--color-text-muted)",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 var(--color-border-light)",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:"var(--color-text)",minWidth:120},children:X},void 0,!1,void 0,this),z.jsxDEV("span",{style:{color:"var(--color-text-secondary)"},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:"var(--color-text-muted)"},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=3E356E19A1D010AB64756E2164756E21