apteva 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/binary.ts +4 -58
- package/src/providers.ts +35 -53
- package/src/routes/api.ts +2 -2
package/package.json
CHANGED
package/src/binary.ts
CHANGED
|
@@ -181,70 +181,16 @@ export async function ensureBinary(binDir: string, silent = false): Promise<{
|
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
//
|
|
185
|
-
const url = getDownloadUrl();
|
|
186
|
-
|
|
187
|
-
if (!silent) {
|
|
188
|
-
process.stdout.write(`${c.orange}downloading...${c.reset}`);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
let lastError: string = "";
|
|
192
|
-
|
|
193
|
-
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
194
|
-
try {
|
|
195
|
-
if (!silent && attempt > 1) {
|
|
196
|
-
process.stdout.write(`\r Agent ${c.orange}retry ${attempt}/${MAX_RETRIES}...${c.reset} `);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
const arrayBuffer = await downloadWithTimeout(url);
|
|
200
|
-
await Bun.write(binaryPath, arrayBuffer);
|
|
201
|
-
|
|
202
|
-
// Make executable on Unix systems
|
|
203
|
-
if (process.platform !== "win32") {
|
|
204
|
-
chmodSync(binaryPath, 0o755);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Show success
|
|
208
|
-
if (!silent) {
|
|
209
|
-
const sizeMB = (arrayBuffer.byteLength / 1024 / 1024).toFixed(1);
|
|
210
|
-
console.log(`\r${c.green}ready${c.reset} ${c.gray}(${sizeMB}MB downloaded)${c.reset} `);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return {
|
|
214
|
-
success: true,
|
|
215
|
-
path: binaryPath,
|
|
216
|
-
downloaded: true,
|
|
217
|
-
source: "download"
|
|
218
|
-
};
|
|
219
|
-
} catch (err: any) {
|
|
220
|
-
if (err.message?.startsWith("HTTP 404")) {
|
|
221
|
-
if (!silent) {
|
|
222
|
-
console.log(`\r${c.red}not found${c.reset} `);
|
|
223
|
-
}
|
|
224
|
-
return {
|
|
225
|
-
success: false,
|
|
226
|
-
path: binaryPath,
|
|
227
|
-
error: `Binary not found at ${url}`,
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
lastError = err.name === "AbortError" ? "timeout" : String(err.message || err);
|
|
232
|
-
if (attempt < MAX_RETRIES) {
|
|
233
|
-
await sleep(RETRY_DELAY);
|
|
234
|
-
continue;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// All retries failed
|
|
184
|
+
// No npm package and no cached binary - show error
|
|
240
185
|
if (!silent) {
|
|
241
|
-
console.log(
|
|
186
|
+
console.log(`${c.red}not found${c.reset}`);
|
|
187
|
+
console.log(`\n Install the agent binary: npm install @apteva/agent-linux-x64`);
|
|
242
188
|
}
|
|
243
189
|
|
|
244
190
|
return {
|
|
245
191
|
success: false,
|
|
246
192
|
path: binaryPath,
|
|
247
|
-
error:
|
|
193
|
+
error: "Binary not found. Install via: npm install @apteva/agent-<platform>",
|
|
248
194
|
};
|
|
249
195
|
}
|
|
250
196
|
|
package/src/providers.ts
CHANGED
|
@@ -6,91 +6,61 @@ export const PROVIDERS = {
|
|
|
6
6
|
anthropic: {
|
|
7
7
|
id: "anthropic",
|
|
8
8
|
name: "Anthropic",
|
|
9
|
-
displayName: "Anthropic
|
|
9
|
+
displayName: "Anthropic",
|
|
10
10
|
envVar: "ANTHROPIC_API_KEY",
|
|
11
11
|
docsUrl: "https://console.anthropic.com/settings/keys",
|
|
12
12
|
testEndpoint: "https://api.anthropic.com/v1/messages",
|
|
13
13
|
models: [
|
|
14
|
-
{ value: "claude-sonnet-4-
|
|
15
|
-
{ value: "claude-
|
|
16
|
-
{ value: "claude-4-5-sonnet", label: "Claude 4.5 Sonnet" },
|
|
17
|
-
{ value: "claude-4-5-haiku", label: "Claude 4.5 Haiku (Fast)" },
|
|
14
|
+
{ value: "claude-sonnet-4-5", label: "Claude Sonnet 4.5", recommended: true },
|
|
15
|
+
{ value: "claude-haiku-4-5", label: "Claude Haiku 4.5 (Fast)" },
|
|
18
16
|
],
|
|
19
17
|
},
|
|
20
18
|
openai: {
|
|
21
19
|
id: "openai",
|
|
22
20
|
name: "OpenAI",
|
|
23
|
-
displayName: "OpenAI
|
|
21
|
+
displayName: "OpenAI",
|
|
24
22
|
envVar: "OPENAI_API_KEY",
|
|
25
23
|
docsUrl: "https://platform.openai.com/api-keys",
|
|
26
24
|
testEndpoint: "https://api.openai.com/v1/models",
|
|
27
25
|
models: [
|
|
28
26
|
{ value: "gpt-4o", label: "GPT-4o", recommended: true },
|
|
29
27
|
{ value: "gpt-4o-mini", label: "GPT-4o Mini (Fast)" },
|
|
30
|
-
{ value: "gpt-4-turbo", label: "GPT-4 Turbo" },
|
|
31
28
|
],
|
|
32
29
|
},
|
|
33
30
|
groq: {
|
|
34
31
|
id: "groq",
|
|
35
32
|
name: "Groq",
|
|
36
|
-
displayName: "Groq
|
|
33
|
+
displayName: "Groq",
|
|
37
34
|
envVar: "GROQ_API_KEY",
|
|
38
35
|
docsUrl: "https://console.groq.com/keys",
|
|
39
36
|
testEndpoint: "https://api.groq.com/openai/v1/models",
|
|
40
37
|
models: [
|
|
41
38
|
{ value: "llama-3.3-70b-versatile", label: "Llama 3.3 70B", recommended: true },
|
|
42
|
-
{ value: "llama-3.1-8b-instant", label: "Llama 3.1 8B (
|
|
43
|
-
{ value: "mixtral-8x7b-32768", label: "Mixtral 8x7B" },
|
|
39
|
+
{ value: "llama-3.1-8b-instant", label: "Llama 3.1 8B (Fast)" },
|
|
44
40
|
],
|
|
45
41
|
},
|
|
46
42
|
gemini: {
|
|
47
43
|
id: "gemini",
|
|
48
44
|
name: "Google",
|
|
49
|
-
displayName: "Google
|
|
45
|
+
displayName: "Google Gemini",
|
|
50
46
|
envVar: "GEMINI_API_KEY",
|
|
51
47
|
docsUrl: "https://aistudio.google.com/app/apikey",
|
|
52
48
|
testEndpoint: "https://generativelanguage.googleapis.com/v1/models",
|
|
53
49
|
models: [
|
|
54
|
-
{ value: "gemini-
|
|
55
|
-
{ value: "gemini-
|
|
56
|
-
{ value: "gemini-1.5-flash", label: "Gemini 1.5 Flash" },
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
fireworks: {
|
|
60
|
-
id: "fireworks",
|
|
61
|
-
name: "Fireworks",
|
|
62
|
-
displayName: "Fireworks AI",
|
|
63
|
-
envVar: "FIREWORKS_API_KEY",
|
|
64
|
-
docsUrl: "https://fireworks.ai/api-keys",
|
|
65
|
-
testEndpoint: "https://api.fireworks.ai/inference/v1/models",
|
|
66
|
-
models: [
|
|
67
|
-
{ value: "accounts/fireworks/models/llama-v3p3-70b-instruct", label: "Llama 3.3 70B", recommended: true },
|
|
68
|
-
{ value: "accounts/fireworks/models/deepseek-v3", label: "DeepSeek V3" },
|
|
69
|
-
{ value: "accounts/fireworks/models/qwen2p5-72b-instruct", label: "Qwen 2.5 72B" },
|
|
50
|
+
{ value: "gemini-3-pro-preview", label: "Gemini 3 Pro Preview (Latest)", recommended: true },
|
|
51
|
+
{ value: "gemini-3-flash-preview", label: "Gemini 3 Flash Preview (Fast)" },
|
|
70
52
|
],
|
|
71
53
|
},
|
|
72
54
|
xai: {
|
|
73
55
|
id: "xai",
|
|
74
56
|
name: "xAI",
|
|
75
|
-
displayName: "xAI
|
|
57
|
+
displayName: "xAI Grok",
|
|
76
58
|
envVar: "XAI_API_KEY",
|
|
77
59
|
docsUrl: "https://console.x.ai/",
|
|
78
60
|
testEndpoint: "https://api.x.ai/v1/models",
|
|
79
61
|
models: [
|
|
80
|
-
{ value: "grok-2
|
|
81
|
-
{ value: "grok-
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
moonshot: {
|
|
85
|
-
id: "moonshot",
|
|
86
|
-
name: "Moonshot",
|
|
87
|
-
displayName: "Moonshot AI (Kimi)",
|
|
88
|
-
envVar: "MOONSHOT_API_KEY",
|
|
89
|
-
docsUrl: "https://platform.moonshot.cn/console/api-keys",
|
|
90
|
-
testEndpoint: "https://api.moonshot.cn/v1/models",
|
|
91
|
-
models: [
|
|
92
|
-
{ value: "moonshot-v1-128k", label: "Moonshot V1 128K", recommended: true },
|
|
93
|
-
{ value: "moonshot-v1-32k", label: "Moonshot V1 32K" },
|
|
62
|
+
{ value: "grok-2", label: "Grok 2", recommended: true },
|
|
63
|
+
{ value: "grok-2-mini", label: "Grok 2 Mini (Fast)" },
|
|
94
64
|
],
|
|
95
65
|
},
|
|
96
66
|
together: {
|
|
@@ -101,20 +71,32 @@ export const PROVIDERS = {
|
|
|
101
71
|
docsUrl: "https://api.together.xyz/settings/api-keys",
|
|
102
72
|
testEndpoint: "https://api.together.xyz/v1/models",
|
|
103
73
|
models: [
|
|
104
|
-
{ value: "
|
|
105
|
-
{ value: "
|
|
106
|
-
{ value: "deepseek-ai/DeepSeek-V3", label: "DeepSeek V3" },
|
|
74
|
+
{ value: "moonshotai/Kimi-K2.5", label: "Kimi K2.5", recommended: true },
|
|
75
|
+
{ value: "moonshotai/Kimi-K2-Thinking", label: "Kimi K2 Thinking (Reasoning)" },
|
|
107
76
|
],
|
|
108
77
|
},
|
|
109
|
-
|
|
110
|
-
id: "
|
|
111
|
-
name: "
|
|
112
|
-
displayName: "
|
|
113
|
-
envVar: "
|
|
114
|
-
docsUrl: "https://
|
|
115
|
-
testEndpoint: "https://api.
|
|
78
|
+
fireworks: {
|
|
79
|
+
id: "fireworks",
|
|
80
|
+
name: "Fireworks",
|
|
81
|
+
displayName: "Fireworks AI",
|
|
82
|
+
envVar: "FIREWORKS_API_KEY",
|
|
83
|
+
docsUrl: "https://fireworks.ai/api-keys",
|
|
84
|
+
testEndpoint: "https://api.fireworks.ai/inference/v1/models",
|
|
85
|
+
models: [
|
|
86
|
+
{ value: "accounts/fireworks/models/kimi-k2p5", label: "Kimi K2.5", recommended: true },
|
|
87
|
+
{ value: "accounts/fireworks/models/kimi-k2-thinking", label: "Kimi K2 Thinking (Reasoning)" },
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
moonshot: {
|
|
91
|
+
id: "moonshot",
|
|
92
|
+
name: "Moonshot",
|
|
93
|
+
displayName: "Moonshot AI",
|
|
94
|
+
envVar: "MOONSHOT_API_KEY",
|
|
95
|
+
docsUrl: "https://platform.moonshot.cn/console/api-keys",
|
|
96
|
+
testEndpoint: "https://api.moonshot.cn/v1/models",
|
|
116
97
|
models: [
|
|
117
|
-
{ value: "
|
|
98
|
+
{ value: "moonshot-v1-128k", label: "Kimi 128K", recommended: true },
|
|
99
|
+
{ value: "moonshot-v1-32k", label: "Kimi 32K (Fast)" },
|
|
118
100
|
],
|
|
119
101
|
},
|
|
120
102
|
} as const;
|
package/src/routes/api.ts
CHANGED
|
@@ -172,8 +172,8 @@ export async function handleApiRequest(req: Request, path: string): Promise<Resp
|
|
|
172
172
|
const proc = spawn({
|
|
173
173
|
cmd: [BINARY_PATH],
|
|
174
174
|
env,
|
|
175
|
-
stdout: "
|
|
176
|
-
stderr: "
|
|
175
|
+
stdout: "ignore",
|
|
176
|
+
stderr: "ignore",
|
|
177
177
|
});
|
|
178
178
|
|
|
179
179
|
agentProcesses.set(agent.id, proc);
|