0agent 1.0.4 → 1.0.5
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/bin/0agent.js +60 -10
- package/package.json +1 -1
package/bin/0agent.js
CHANGED
|
@@ -115,27 +115,68 @@ async function runInit() {
|
|
|
115
115
|
mkdirSync(resolve(AGENT_DIR, 'skills', 'builtin'), { recursive: true });
|
|
116
116
|
mkdirSync(resolve(AGENT_DIR, 'skills', 'custom'), { recursive: true });
|
|
117
117
|
|
|
118
|
-
console.log(' Step 1 of
|
|
118
|
+
console.log(' Step 1 of 5: LLM Provider\n');
|
|
119
119
|
const provider = await choose(' Which LLM provider?', [
|
|
120
120
|
'Anthropic (Claude) ← recommended',
|
|
121
121
|
'OpenAI (GPT-4o)',
|
|
122
|
+
'xAI (Grok)',
|
|
123
|
+
'Google (Gemini)',
|
|
122
124
|
'Ollama (local, free)',
|
|
123
125
|
], 0);
|
|
124
|
-
const providerKey = ['anthropic', 'openai', 'ollama'][provider];
|
|
126
|
+
const providerKey = ['anthropic', 'openai', 'xai', 'gemini', 'ollama'][provider];
|
|
127
|
+
|
|
128
|
+
// Model selection per provider
|
|
129
|
+
const MODELS = {
|
|
130
|
+
anthropic: [
|
|
131
|
+
'claude-sonnet-4-6 ← recommended (fast + smart)',
|
|
132
|
+
'claude-opus-4-6 (most capable, slower)',
|
|
133
|
+
'claude-haiku-4-5 (fastest, cheapest)',
|
|
134
|
+
],
|
|
135
|
+
openai: [
|
|
136
|
+
'gpt-4o ← recommended',
|
|
137
|
+
'gpt-4o-mini (faster, cheaper)',
|
|
138
|
+
'o3-mini (reasoning)',
|
|
139
|
+
],
|
|
140
|
+
xai: [
|
|
141
|
+
'grok-3 ← recommended',
|
|
142
|
+
'grok-3-mini',
|
|
143
|
+
],
|
|
144
|
+
gemini: [
|
|
145
|
+
'gemini-2.0-flash ← recommended',
|
|
146
|
+
'gemini-2.0-pro',
|
|
147
|
+
],
|
|
148
|
+
ollama: [
|
|
149
|
+
'llama3.1 ← recommended',
|
|
150
|
+
'mistral',
|
|
151
|
+
'codellama',
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
let model = '';
|
|
156
|
+
if (MODELS[providerKey]) {
|
|
157
|
+
console.log();
|
|
158
|
+
const modelIdx = await choose(' Which model?', MODELS[providerKey], 0);
|
|
159
|
+
model = MODELS[providerKey][modelIdx].split(/\s+/)[0];
|
|
160
|
+
}
|
|
125
161
|
|
|
126
162
|
let apiKey = '';
|
|
127
163
|
if (providerKey !== 'ollama') {
|
|
128
164
|
apiKey = await ask(`\n API Key: `);
|
|
129
165
|
if (!apiKey.trim()) {
|
|
130
166
|
console.log(' ⚠️ No API key provided. You can set it later in ~/.0agent/config.yaml');
|
|
167
|
+
} else {
|
|
168
|
+
// Validate key format
|
|
169
|
+
const keyPrefixes = { anthropic: 'sk-ant-', openai: 'sk-', xai: 'xai-', gemini: 'AI' };
|
|
170
|
+
const expectedPrefix = keyPrefixes[providerKey];
|
|
171
|
+
if (expectedPrefix && !apiKey.startsWith(expectedPrefix)) {
|
|
172
|
+
console.log(` ⚠️ Key doesn't look like a ${providerKey} key (expected: ${expectedPrefix}...)`);
|
|
173
|
+
} else {
|
|
174
|
+
console.log(' ✓ API key format looks valid');
|
|
175
|
+
}
|
|
131
176
|
}
|
|
132
177
|
}
|
|
133
178
|
|
|
134
|
-
|
|
135
|
-
: providerKey === 'openai' ? 'gpt-4o'
|
|
136
|
-
: 'llama3';
|
|
137
|
-
|
|
138
|
-
console.log('\n Step 2 of 4: Embedding model\n');
|
|
179
|
+
console.log('\n Step 2 of 5: Embedding model\n');
|
|
139
180
|
const embedding = await choose(' Embedding backend?', [
|
|
140
181
|
'Local via Ollama (nomic-embed-text) ← free, private',
|
|
141
182
|
'OpenAI text-embedding-3-small (cloud)',
|
|
@@ -143,19 +184,28 @@ async function runInit() {
|
|
|
143
184
|
], 0);
|
|
144
185
|
const embeddingProvider = ['nomic-ollama', 'openai', 'none'][embedding];
|
|
145
186
|
|
|
146
|
-
console.log('\n Step 3 of
|
|
187
|
+
console.log('\n Step 3 of 5: Sandbox backend\n');
|
|
147
188
|
const sandboxes = detectSandboxes();
|
|
148
189
|
console.log(` Detected: ${sandboxes.join(', ') || 'process (fallback)'}`);
|
|
149
190
|
const sandboxChoice = sandboxes[0] ?? 'process';
|
|
150
191
|
console.log(` Using: ${sandboxChoice}`);
|
|
151
192
|
|
|
152
|
-
console.log('\n Step 4 of
|
|
193
|
+
console.log('\n Step 4 of 5: Seed graph\n');
|
|
153
194
|
const seed = await choose(' Start with a seed graph?', [
|
|
154
195
|
'software-engineering (skills + sprint workflow) ← recommended',
|
|
155
196
|
'scratch (empty graph)',
|
|
156
197
|
], 0);
|
|
157
198
|
const seedName = seed === 0 ? 'software-engineering' : null;
|
|
158
199
|
|
|
200
|
+
// Step 5: confirm
|
|
201
|
+
console.log('\n Step 5 of 5: Ready\n');
|
|
202
|
+
console.log(` Provider: ${providerKey}`);
|
|
203
|
+
console.log(` Model: ${model}`);
|
|
204
|
+
console.log(` API Key: ${apiKey ? apiKey.slice(0, 8) + '••••••••' : '(not set)'}`);
|
|
205
|
+
console.log(` Sandbox: ${sandboxChoice}`);
|
|
206
|
+
console.log(` Seed: ${seedName ?? 'scratch'}`);
|
|
207
|
+
console.log();
|
|
208
|
+
|
|
159
209
|
// Write config
|
|
160
210
|
const dbPath = resolve(AGENT_DIR, 'graph.db');
|
|
161
211
|
const hnswPath = resolve(AGENT_DIR, 'hnsw.bin');
|
|
@@ -168,7 +218,7 @@ version: "1"
|
|
|
168
218
|
llm_providers:
|
|
169
219
|
- provider: ${providerKey}
|
|
170
220
|
model: ${model}
|
|
171
|
-
api_key: ${apiKey || '
|
|
221
|
+
api_key: "${apiKey || ''}"
|
|
172
222
|
is_default: true
|
|
173
223
|
|
|
174
224
|
embedding:
|