apteva 0.1.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 (47) hide show
  1. package/LICENSE +63 -0
  2. package/README.md +84 -0
  3. package/bin/agent-linux-amd64 +0 -0
  4. package/bin/apteva.js +144 -0
  5. package/dist/App.g02zmbqf.js +213 -0
  6. package/dist/App.g02zmbqf.js.map +37 -0
  7. package/dist/App.mq6jqare.js +1 -0
  8. package/dist/apteva-kit.css +1 -0
  9. package/dist/index.html +14 -0
  10. package/dist/styles.css +1 -0
  11. package/package.json +65 -0
  12. package/src/binary.ts +116 -0
  13. package/src/crypto.ts +152 -0
  14. package/src/db.ts +446 -0
  15. package/src/providers.ts +255 -0
  16. package/src/routes/api.ts +380 -0
  17. package/src/routes/static.ts +47 -0
  18. package/src/server.ts +134 -0
  19. package/src/web/App.tsx +218 -0
  20. package/src/web/components/agents/AgentCard.tsx +71 -0
  21. package/src/web/components/agents/AgentsView.tsx +69 -0
  22. package/src/web/components/agents/ChatPanel.tsx +63 -0
  23. package/src/web/components/agents/CreateAgentModal.tsx +128 -0
  24. package/src/web/components/agents/index.ts +4 -0
  25. package/src/web/components/common/Icons.tsx +61 -0
  26. package/src/web/components/common/LoadingSpinner.tsx +44 -0
  27. package/src/web/components/common/Modal.tsx +16 -0
  28. package/src/web/components/common/Select.tsx +96 -0
  29. package/src/web/components/common/index.ts +4 -0
  30. package/src/web/components/dashboard/Dashboard.tsx +136 -0
  31. package/src/web/components/dashboard/index.ts +1 -0
  32. package/src/web/components/index.ts +11 -0
  33. package/src/web/components/layout/ErrorBanner.tsx +18 -0
  34. package/src/web/components/layout/Header.tsx +26 -0
  35. package/src/web/components/layout/Sidebar.tsx +66 -0
  36. package/src/web/components/layout/index.ts +3 -0
  37. package/src/web/components/onboarding/OnboardingWizard.tsx +344 -0
  38. package/src/web/components/onboarding/index.ts +1 -0
  39. package/src/web/components/settings/SettingsPage.tsx +285 -0
  40. package/src/web/components/settings/index.ts +1 -0
  41. package/src/web/hooks/index.ts +3 -0
  42. package/src/web/hooks/useAgents.ts +62 -0
  43. package/src/web/hooks/useOnboarding.ts +25 -0
  44. package/src/web/hooks/useProviders.ts +65 -0
  45. package/src/web/index.html +21 -0
  46. package/src/web/styles.css +23 -0
  47. package/src/web/types.ts +43 -0
package/LICENSE ADDED
@@ -0,0 +1,63 @@
1
+ Elastic License 2.0 (ELv2)
2
+
3
+ ## Acceptance
4
+
5
+ By using the software, you agree to all of the terms and conditions below.
6
+
7
+ ## Copyright License
8
+
9
+ The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below.
10
+
11
+ ## Limitations
12
+
13
+ You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
14
+
15
+ You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
16
+
17
+ You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor's trademarks is subject to applicable law.
18
+
19
+ ## Patents
20
+
21
+ The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
22
+
23
+ ## Notices
24
+
25
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
26
+
27
+ If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
28
+
29
+ ## No Other Rights
30
+
31
+ These terms do not imply any licenses other than those expressly granted in these terms.
32
+
33
+ ## Termination
34
+
35
+ If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
36
+
37
+ ## No Liability
38
+
39
+ *As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.*
40
+
41
+ ## Definitions
42
+
43
+ The **licensor** is the entity offering these terms, and the **software** is the software the licensor makes available under these terms, including any portion of it.
44
+
45
+ **you** refers to the individual or entity agreeing to these terms.
46
+
47
+ **your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
48
+
49
+ **your licenses** are all the licenses granted to you for the software under these terms.
50
+
51
+ **use** means anything you do with the software requiring one of your licenses.
52
+
53
+ **trademark** means trademarks, service marks, and similar rights.
54
+
55
+ ---
56
+
57
+ Copyright 2025 Apteva
58
+
59
+ Licensed under the Elastic License 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
60
+
61
+ https://www.elastic.co/licensing/elastic-license
62
+
63
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # Apteva
2
+
3
+ Run AI agents locally on your machine.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/apteva.svg)](https://www.npmjs.com/package/apteva)
6
+ [![license](https://img.shields.io/badge/license-ELv2-blue.svg)](LICENSE)
7
+
8
+ ## Features
9
+
10
+ - **Multi-Provider Support** - Claude, GPT, Gemini, Llama, Grok, and more
11
+ - **Local-First** - Your data and API keys stay on your machine
12
+ - **Web Dashboard** - Beautiful UI for managing agents
13
+ - **Secure** - API keys encrypted at rest
14
+
15
+ ## Quick Start
16
+
17
+ ```bash
18
+ npx apteva
19
+ ```
20
+
21
+ Open http://localhost:4280 in your browser.
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ # npm
27
+ npm install -g apteva
28
+
29
+ # bun
30
+ bun add -g apteva
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ```bash
36
+ # Start server (default port 4280)
37
+ apteva
38
+
39
+ # Custom port
40
+ apteva --port 8080
41
+
42
+ # Custom data directory
43
+ apteva --data-dir ./my-data
44
+ ```
45
+
46
+ ## Supported Providers
47
+
48
+ | Provider | Models |
49
+ |----------|--------|
50
+ | Anthropic | Claude Sonnet 4, Opus 4, Haiku |
51
+ | OpenAI | GPT-4o, GPT-4o Mini |
52
+ | Google | Gemini 2.0 Flash, 1.5 Pro |
53
+ | Groq | Llama 3.3 70B, Mixtral |
54
+ | xAI | Grok 2 |
55
+ | Fireworks | Llama, DeepSeek V3 |
56
+ | Together | Llama, DeepSeek R1 |
57
+ | Moonshot | Moonshot V1 |
58
+ | Venice | Llama 3.3 70B |
59
+
60
+ ## API
61
+
62
+ | Endpoint | Method | Description |
63
+ |----------|--------|-------------|
64
+ | `/api/agents` | GET | List agents |
65
+ | `/api/agents` | POST | Create agent |
66
+ | `/api/agents/:id/start` | POST | Start agent |
67
+ | `/api/agents/:id/stop` | POST | Stop agent |
68
+ | `/api/agents/:id/chat` | POST | Chat (streaming) |
69
+ | `/api/providers` | GET | List providers |
70
+ | `/api/health` | GET | Health check |
71
+
72
+ ## Requirements
73
+
74
+ - Node.js 18+ or Bun 1.0+
75
+ - Linux, macOS, or Windows
76
+
77
+ ## License
78
+
79
+ [Elastic License 2.0](LICENSE) - Free to use, cannot offer as a hosted service.
80
+
81
+ ## Links
82
+
83
+ - [Issues](https://github.com/apteva/apteva/issues)
84
+ - [Contributing](CONTRIBUTING.md)
Binary file
package/bin/apteva.js ADDED
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from "child_process";
4
+ import { fileURLToPath } from "url";
5
+ import { dirname, join } from "path";
6
+ import { existsSync } from "fs";
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = dirname(__filename);
10
+
11
+ // Parse command line arguments
12
+ const args = process.argv.slice(2);
13
+ let port = 4015;
14
+ let dataDir = null;
15
+ let configFile = null;
16
+ let showHelp = false;
17
+ let showVersion = false;
18
+
19
+ for (let i = 0; i < args.length; i++) {
20
+ const arg = args[i];
21
+ if (arg === "--port" || arg === "-p") {
22
+ port = parseInt(args[++i]) || 4015;
23
+ } else if (arg === "--data-dir" || arg === "-d") {
24
+ dataDir = args[++i];
25
+ } else if (arg === "--config" || arg === "-c") {
26
+ configFile = args[++i];
27
+ } else if (arg === "--help" || arg === "-h" || arg === "help") {
28
+ showHelp = true;
29
+ } else if (arg === "--version" || arg === "-v" || arg === "version") {
30
+ showVersion = true;
31
+ }
32
+ }
33
+
34
+ if (showVersion) {
35
+ const pkg = await import("../package.json", { assert: { type: "json" } });
36
+ console.log(`apteva v${pkg.default.version}`);
37
+ process.exit(0);
38
+ }
39
+
40
+ if (showHelp) {
41
+ console.log(`
42
+ apteva - Run AI agents locally
43
+
44
+ USAGE:
45
+ apteva [options]
46
+ apteva <command>
47
+
48
+ COMMANDS:
49
+ start Start the agent server (default)
50
+ version Show version information
51
+ help Show this help message
52
+
53
+ OPTIONS:
54
+ -p, --port <port> Port to listen on (default: 4015)
55
+ -d, --data-dir <dir> Directory for data storage
56
+ -c, --config <file> Path to config file
57
+ -h, --help Show this help message
58
+ -v, --version Show version information
59
+
60
+ ENVIRONMENT VARIABLES:
61
+ PORT Server port (default: 4015)
62
+ DATA_DIR Data directory
63
+ ANTHROPIC_API_KEY Anthropic (Claude) API key
64
+ OPENAI_API_KEY OpenAI API key
65
+ GROQ_API_KEY Groq API key
66
+ GEMINI_API_KEY Google Gemini API key
67
+ XAI_API_KEY xAI (Grok) API key
68
+ FIREWORKS_API_KEY Fireworks AI API key
69
+ MOONSHOT_API_KEY Moonshot AI API key
70
+ TOGETHER_API_KEY Together AI API key
71
+
72
+ EXAMPLES:
73
+ apteva Start on default port (4015)
74
+ apteva --port 8080 Start on port 8080
75
+ apteva --data-dir ./my-data Use custom data directory
76
+ apteva --config ./config.json Use config file
77
+
78
+ DOCUMENTATION:
79
+ https://github.com/apteva/apteva
80
+ https://apteva.com/docs
81
+ `);
82
+ process.exit(0);
83
+ }
84
+
85
+ // Find the server entry point
86
+ const serverPath = join(__dirname, "..", "src", "server.ts");
87
+ const distServerPath = join(__dirname, "..", "dist", "server.js");
88
+
89
+ let entryPoint;
90
+ if (existsSync(serverPath)) {
91
+ entryPoint = serverPath;
92
+ } else if (existsSync(distServerPath)) {
93
+ entryPoint = distServerPath;
94
+ } else {
95
+ console.error("Error: Could not find server entry point");
96
+ process.exit(1);
97
+ }
98
+
99
+ // Build environment
100
+ const env = { ...process.env };
101
+ env.PORT = String(port);
102
+ if (dataDir) env.DATA_DIR = dataDir;
103
+ if (configFile) env.CONFIG_FILE = configFile;
104
+
105
+ // Check if bun is available
106
+ const runtime = process.env.BUN_INSTALL ? "bun" : "node";
107
+
108
+ // Spawn the server
109
+ const child = spawn(runtime, ["run", entryPoint], {
110
+ env,
111
+ stdio: "inherit",
112
+ shell: false,
113
+ });
114
+
115
+ child.on("error", (err) => {
116
+ if (err.code === "ENOENT" && runtime === "bun") {
117
+ // Fallback to node if bun not found
118
+ const nodeChild = spawn("node", [entryPoint], {
119
+ env,
120
+ stdio: "inherit",
121
+ shell: false,
122
+ });
123
+ nodeChild.on("error", (nodeErr) => {
124
+ console.error("Error starting server:", nodeErr.message);
125
+ process.exit(1);
126
+ });
127
+ } else {
128
+ console.error("Error starting server:", err.message);
129
+ process.exit(1);
130
+ }
131
+ });
132
+
133
+ child.on("exit", (code) => {
134
+ process.exit(code || 0);
135
+ });
136
+
137
+ // Handle termination
138
+ process.on("SIGINT", () => {
139
+ child.kill("SIGINT");
140
+ });
141
+
142
+ process.on("SIGTERM", () => {
143
+ child.kill("SIGTERM");
144
+ });