@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.
Files changed (40) hide show
  1. package/.claude/settings.local.json +7 -1
  2. package/.cursor/rules/api-documentation.mdc +14 -0
  3. package/.cursor/rules/backend-location-rule.mdc +5 -0
  4. package/Medical_NER_Dataset_1.jsonl +50 -0
  5. package/README.md +4 -1
  6. package/bun.lock +52 -0
  7. package/package.json +5 -2
  8. package/src/api.ts +551 -22
  9. package/src/chat/ChatApp.tsx +548 -263
  10. package/src/client/ToolExecutor.ts +175 -0
  11. package/src/client/WebSocketClient.ts +333 -0
  12. package/src/client/index.ts +2 -0
  13. package/src/config.ts +49 -139
  14. package/src/index.tsx +815 -107
  15. package/src/telemetry.ts +173 -0
  16. package/src/tests/config.test.ts +19 -0
  17. package/src/tools/bash.ts +1 -1
  18. package/src/tools/filesystem.ts +1 -1
  19. package/src/tools/index.ts +2 -9
  20. package/src/tools/sandbox.ts +1 -1
  21. package/src/tools/types.ts +25 -0
  22. package/src/utils/index.ts +6 -0
  23. package/fastino-ai-pioneer-cli-0.2.0.tgz +0 -0
  24. package/ner_dataset.json +0 -111
  25. package/src/agent/Agent.ts +0 -342
  26. package/src/agent/BudgetManager.ts +0 -167
  27. package/src/agent/LLMClient.ts +0 -435
  28. package/src/agent/ToolRegistry.ts +0 -97
  29. package/src/agent/index.ts +0 -15
  30. package/src/agent/types.ts +0 -84
  31. package/src/evolution/EvalRunner.ts +0 -301
  32. package/src/evolution/EvolutionEngine.ts +0 -319
  33. package/src/evolution/FeedbackCollector.ts +0 -197
  34. package/src/evolution/ModelTrainer.ts +0 -371
  35. package/src/evolution/index.ts +0 -18
  36. package/src/evolution/types.ts +0 -110
  37. package/src/tools/modal.ts +0 -269
  38. package/src/tools/training.ts +0 -443
  39. package/src/tools/wandb.ts +0 -348
  40. /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 AgentProviderConfig {
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
- targetScore?: number;
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
- // Existing Pioneer config
16
+ // Pioneer API configuration
55
17
  apiKey?: string;
56
18
  baseUrl?: string;
57
19
 
58
- // Agent config
59
- agent?: AgentProviderConfig;
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
- // System prompt customization
66
- systemPrompt?: string;
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 ?? "http://localhost:5001";
34
+ process.env.PIONEER_API_URL ?? "https://api.fastino.ai";
74
35
 
75
- export const DEFAULT_AGENT_CONFIG: AgentProviderConfig = {
76
- provider: "anthropic",
77
- model: "claude-sonnet-4-5-20250929",
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 DEFAULT_BUDGET: BudgetConfig = {
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
- // Agent configuration helpers
157
- export function getAgentConfig(): AgentProviderConfig {
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 getSandboxConfig(): SandboxConfig {
201
- const config = loadConfig();
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 getMLConfig(): MLConfig {
213
- const config = loadConfig();
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
- export function getEvolutionConfig(): EvolutionConfigOptions {
228
- const config = loadConfig();
229
- return {
230
- enabled: false,
231
- targetScore: 0.9,
232
- maxIterations: 10,
233
- trainingProvider: "local",
234
- ...config.evolution,
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 getSystemPrompt(): string | undefined {
239
- return loadConfig().systemPrompt;
147
+ export function setHfToken(token: string): void {
148
+ saveConfig({ hfToken: token });
240
149
  }
241
150
 
242
- // Get config directory path
243
- export function getConfigDir(): string {
151
+ export function clearHfToken(): void {
152
+ const config = loadConfig();
153
+ delete config.hfToken;
244
154
  ensureConfigDir();
245
- return CONFIG_DIR;
155
+ fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
246
156
  }