@fastino-ai/pioneer-cli 0.2.1 → 0.2.3
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/.claude/settings.local.json +7 -1
- package/.cursor/rules/api-documentation.mdc +14 -0
- package/.cursor/rules/backend-location-rule.mdc +5 -0
- package/Medical_NER_Dataset_1.jsonl +50 -0
- package/README.md +4 -1
- package/bun.lock +52 -0
- package/package.json +5 -2
- package/src/api.ts +551 -22
- package/src/chat/ChatApp.tsx +548 -263
- package/src/client/ToolExecutor.ts +175 -0
- package/src/client/WebSocketClient.ts +333 -0
- package/src/client/index.ts +2 -0
- package/src/config.ts +49 -139
- package/src/index.tsx +815 -107
- package/src/telemetry.ts +173 -0
- package/src/tests/config.test.ts +19 -0
- package/src/tools/bash.ts +1 -1
- package/src/tools/filesystem.ts +1 -1
- package/src/tools/index.ts +2 -9
- package/src/tools/sandbox.ts +1 -1
- package/src/tools/types.ts +25 -0
- package/src/utils/index.ts +6 -0
- package/fastino-ai-pioneer-cli-0.2.0.tgz +0 -0
- package/ner_dataset.json +0 -111
- package/src/agent/Agent.ts +0 -342
- package/src/agent/BudgetManager.ts +0 -167
- package/src/agent/LLMClient.ts +0 -435
- package/src/agent/ToolRegistry.ts +0 -97
- package/src/agent/index.ts +0 -15
- package/src/agent/types.ts +0 -84
- package/src/evolution/EvalRunner.ts +0 -301
- package/src/evolution/EvolutionEngine.ts +0 -319
- package/src/evolution/FeedbackCollector.ts +0 -197
- package/src/evolution/ModelTrainer.ts +0 -371
- package/src/evolution/index.ts +0 -18
- package/src/evolution/types.ts +0 -110
- package/src/tools/modal.ts +0 -269
- package/src/tools/training.ts +0 -443
- package/src/tools/wandb.ts +0 -348
- /package/src/{agent → utils}/FileResolver.ts +0 -0
package/src/config.ts
CHANGED
|
@@ -7,82 +7,40 @@ import fs from "fs";
|
|
|
7
7
|
import os from "os";
|
|
8
8
|
import path from "path";
|
|
9
9
|
|
|
10
|
-
export interface
|
|
11
|
-
provider: "anthropic" | "openai" | "local";
|
|
12
|
-
model: string;
|
|
13
|
-
apiKey?: string;
|
|
14
|
-
baseUrl?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface BudgetConfig {
|
|
18
|
-
maxTokens?: number;
|
|
19
|
-
maxCost?: number; // in USD
|
|
20
|
-
maxTime?: number; // in seconds
|
|
21
|
-
maxIterations?: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface SandboxConfig {
|
|
25
|
-
useDocker?: boolean;
|
|
26
|
-
dockerImage?: string;
|
|
27
|
-
timeout?: number;
|
|
28
|
-
memoryLimit?: string;
|
|
29
|
-
cpuLimit?: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface MLConfig {
|
|
33
|
-
modal?: {
|
|
34
|
-
tokenId?: string;
|
|
35
|
-
tokenSecret?: string;
|
|
36
|
-
};
|
|
37
|
-
wandb?: {
|
|
38
|
-
apiKey?: string;
|
|
39
|
-
entity?: string;
|
|
40
|
-
project?: string;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface EvolutionConfigOptions {
|
|
10
|
+
export interface TelemetryConfig {
|
|
45
11
|
enabled?: boolean;
|
|
46
|
-
|
|
47
|
-
maxIterations?: number;
|
|
48
|
-
budgetPerIteration?: BudgetConfig;
|
|
49
|
-
trainingProvider?: "openai" | "modal" | "local";
|
|
50
|
-
trainingBaseModel?: string;
|
|
12
|
+
anonymousId?: string;
|
|
51
13
|
}
|
|
52
14
|
|
|
53
15
|
export interface Config {
|
|
54
|
-
//
|
|
16
|
+
// Pioneer API configuration
|
|
55
17
|
apiKey?: string;
|
|
56
18
|
baseUrl?: string;
|
|
57
19
|
|
|
58
|
-
// Agent
|
|
59
|
-
|
|
60
|
-
budget?: BudgetConfig;
|
|
61
|
-
sandbox?: SandboxConfig;
|
|
62
|
-
ml?: MLConfig;
|
|
63
|
-
evolution?: EvolutionConfigOptions;
|
|
20
|
+
// MLE Agent model selection (for Pioneer server)
|
|
21
|
+
mleModel?: string;
|
|
64
22
|
|
|
65
|
-
//
|
|
66
|
-
|
|
23
|
+
// Hugging Face token for pushing datasets/models
|
|
24
|
+
hfToken?: string;
|
|
25
|
+
|
|
26
|
+
// Telemetry (opt-in analytics)
|
|
27
|
+
telemetry?: TelemetryConfig;
|
|
67
28
|
}
|
|
68
29
|
|
|
69
30
|
const CONFIG_DIR = path.join(os.homedir(), ".pioneer");
|
|
70
31
|
const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
71
32
|
|
|
72
33
|
export const DEFAULT_BASE_URL =
|
|
73
|
-
process.env.PIONEER_API_URL ?? "
|
|
34
|
+
process.env.PIONEER_API_URL ?? "https://api.fastino.ai";
|
|
74
35
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
36
|
+
// Available MLE models for server-side agent
|
|
37
|
+
export const AVAILABLE_MLE_MODELS = [
|
|
38
|
+
{ id: "claude-sonnet-4-5-20250929", name: "Claude Sonnet 4.5", description: "Balanced (default)" },
|
|
39
|
+
{ id: "claude-haiku-4-5-20251001", name: "Claude Haiku 4.5", description: "Fast & cheap" },
|
|
40
|
+
{ id: "claude-opus-4-5-20251101", name: "Claude Opus 4.5", description: "Most capable" },
|
|
41
|
+
] as const;
|
|
79
42
|
|
|
80
|
-
export const
|
|
81
|
-
maxTokens: 500000, // 500k tokens
|
|
82
|
-
maxCost: 5.0, // $5 USD
|
|
83
|
-
maxTime: 7200, // 2 hours
|
|
84
|
-
maxIterations: 100,
|
|
85
|
-
};
|
|
43
|
+
export const DEFAULT_MLE_MODEL = "claude-sonnet-4-5-20250929";
|
|
86
44
|
|
|
87
45
|
function ensureConfigDir(): void {
|
|
88
46
|
if (!fs.existsSync(CONFIG_DIR)) {
|
|
@@ -149,98 +107,50 @@ export function getApiKey(): string | undefined {
|
|
|
149
107
|
}
|
|
150
108
|
|
|
151
109
|
export function getBaseUrl(): string {
|
|
110
|
+
// Environment variable takes precedence
|
|
111
|
+
if (process.env.PIONEER_API_URL) {
|
|
112
|
+
return process.env.PIONEER_API_URL;
|
|
113
|
+
}
|
|
152
114
|
const config = loadConfig();
|
|
153
115
|
return config.baseUrl ?? DEFAULT_BASE_URL;
|
|
154
116
|
}
|
|
155
117
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const config = loadConfig();
|
|
159
|
-
|
|
160
|
-
// Check environment variables for API keys
|
|
161
|
-
const anthropicKey = process.env.ANTHROPIC_API_KEY;
|
|
162
|
-
const openaiKey = process.env.OPENAI_API_KEY;
|
|
163
|
-
|
|
164
|
-
if (config.agent) {
|
|
165
|
-
return {
|
|
166
|
-
...config.agent,
|
|
167
|
-
apiKey: config.agent.apiKey ||
|
|
168
|
-
(config.agent.provider === "anthropic" ? anthropicKey : openaiKey),
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Default to Anthropic if key is available
|
|
173
|
-
if (anthropicKey) {
|
|
174
|
-
return {
|
|
175
|
-
...DEFAULT_AGENT_CONFIG,
|
|
176
|
-
apiKey: anthropicKey,
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// Fall back to OpenAI
|
|
181
|
-
if (openaiKey) {
|
|
182
|
-
return {
|
|
183
|
-
provider: "openai",
|
|
184
|
-
model: "gpt-4o",
|
|
185
|
-
apiKey: openaiKey,
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return DEFAULT_AGENT_CONFIG;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export function getBudgetConfig(): BudgetConfig {
|
|
193
|
-
const config = loadConfig();
|
|
194
|
-
return {
|
|
195
|
-
...DEFAULT_BUDGET,
|
|
196
|
-
...config.budget,
|
|
197
|
-
};
|
|
118
|
+
export function getMleModel(): string | undefined {
|
|
119
|
+
return loadConfig().mleModel;
|
|
198
120
|
}
|
|
199
121
|
|
|
200
|
-
export function
|
|
201
|
-
|
|
202
|
-
return {
|
|
203
|
-
useDocker: false,
|
|
204
|
-
dockerImage: "python:3.11-slim",
|
|
205
|
-
timeout: 30000,
|
|
206
|
-
memoryLimit: "512m",
|
|
207
|
-
cpuLimit: 1,
|
|
208
|
-
...config.sandbox,
|
|
209
|
-
};
|
|
122
|
+
export function setMleModel(model: string): void {
|
|
123
|
+
saveConfig({ mleModel: model });
|
|
210
124
|
}
|
|
211
125
|
|
|
212
|
-
export function
|
|
213
|
-
|
|
214
|
-
return
|
|
215
|
-
modal: {
|
|
216
|
-
tokenId: process.env.MODAL_TOKEN_ID,
|
|
217
|
-
tokenSecret: process.env.MODAL_TOKEN_SECRET,
|
|
218
|
-
...config.ml?.modal,
|
|
219
|
-
},
|
|
220
|
-
wandb: {
|
|
221
|
-
apiKey: process.env.WANDB_API_KEY,
|
|
222
|
-
...config.ml?.wandb,
|
|
223
|
-
},
|
|
224
|
-
};
|
|
126
|
+
export function getConfigDir(): string {
|
|
127
|
+
ensureConfigDir();
|
|
128
|
+
return CONFIG_DIR;
|
|
225
129
|
}
|
|
226
130
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Get Hugging Face token with priority:
|
|
133
|
+
* 1. Explicit token passed as parameter (from --hf-token flag)
|
|
134
|
+
* 2. HF_TOKEN environment variable
|
|
135
|
+
* 3. Token stored in config file
|
|
136
|
+
*/
|
|
137
|
+
export function getHfToken(explicitToken?: string): string | undefined {
|
|
138
|
+
if (explicitToken) {
|
|
139
|
+
return explicitToken;
|
|
140
|
+
}
|
|
141
|
+
if (process.env.HF_TOKEN) {
|
|
142
|
+
return process.env.HF_TOKEN;
|
|
143
|
+
}
|
|
144
|
+
return loadConfig().hfToken;
|
|
236
145
|
}
|
|
237
146
|
|
|
238
|
-
export function
|
|
239
|
-
|
|
147
|
+
export function setHfToken(token: string): void {
|
|
148
|
+
saveConfig({ hfToken: token });
|
|
240
149
|
}
|
|
241
150
|
|
|
242
|
-
|
|
243
|
-
|
|
151
|
+
export function clearHfToken(): void {
|
|
152
|
+
const config = loadConfig();
|
|
153
|
+
delete config.hfToken;
|
|
244
154
|
ensureConfigDir();
|
|
245
|
-
|
|
155
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
246
156
|
}
|