0agent 1.0.3 → 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 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 4: LLM Provider\n');
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
- const model = providerKey === 'anthropic' ? 'claude-sonnet-4-6'
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 4: Sandbox backend\n');
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 4: Seed graph\n');
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:
@@ -377,14 +427,16 @@ async function streamSession(sessionId) {
377
427
 
378
428
  switch (event.type) {
379
429
  case 'session.step':
380
- console.log(` ${event.step}`);
430
+ console.log(` ${event.step}`);
381
431
  break;
382
- case 'session.completed':
383
- console.log('\n ✓ Completed\n');
384
- if (event.result?.output) console.log(` ${event.result.output}\n`);
432
+ case 'session.completed': {
433
+ console.log('\n ✓ Done\n');
434
+ const out = event.result?.output ?? event.result;
435
+ if (out && typeof out === 'string') console.log(` ${out}\n`);
385
436
  ws.close();
386
437
  resolve();
387
438
  break;
439
+ }
388
440
  case 'session.failed':
389
441
  console.log(`\n ✗ Failed: ${event.error}\n`);
390
442
  ws.close();
@@ -406,21 +458,31 @@ async function streamSession(sessionId) {
406
458
  }
407
459
 
408
460
  async function pollSession(sessionId) {
461
+ let lastStepCount = 0;
409
462
  for (let i = 0; i < 300; i++) {
410
- await sleep(1000);
463
+ await sleep(600);
411
464
  const res = await fetch(`${BASE_URL}/api/sessions/${sessionId}`);
412
465
  const s = await res.json();
466
+
467
+ // Print any new steps since last poll
468
+ const steps = s.steps ?? [];
469
+ for (let j = lastStepCount; j < steps.length; j++) {
470
+ console.log(` › ${steps[j].description}`);
471
+ }
472
+ lastStepCount = steps.length;
473
+
413
474
  if (s.status === 'completed') {
414
- console.log('\n ✓ Completed\n');
415
- if (s.result?.output) console.log(` ${s.result.output}\n`);
475
+ console.log('\n ✓ Done\n');
476
+ const out = s.result?.output ?? s.result;
477
+ if (out && typeof out === 'string') console.log(` ${out}\n`);
416
478
  return;
417
479
  }
418
480
  if (s.status === 'failed') {
419
481
  console.log(`\n ✗ Failed: ${s.error}\n`);
420
482
  return;
421
483
  }
422
- process.stdout.write('.');
423
484
  }
485
+ console.log('\n Timed out waiting for session.\n');
424
486
  }
425
487
 
426
488
  // ─── Chat REPL ───────────────────────────────────────────────────────────
package/dist/daemon.mjs CHANGED
@@ -1843,14 +1843,33 @@ var SessionManager = class {
1843
1843
  const session = this.createSession(enrichedReq);
1844
1844
  try {
1845
1845
  await this.startSession(session.id);
1846
+ this.addStep(session.id, `Extracting entities from: "${req.task.slice(0, 60)}${req.task.length > 60 ? "\u2026" : ""}"`);
1847
+ this.addStep(session.id, "Querying knowledge graph (structural + semantic)\u2026");
1846
1848
  if (session.plan) {
1847
- this.addStep(
1848
- session.id,
1849
- `Inference plan resolved: ${session.plan.reasoning}`,
1850
- session.plan
1851
- );
1849
+ const edge = session.plan.selected_edge;
1850
+ if (edge) {
1851
+ this.addStep(
1852
+ session.id,
1853
+ `Selected plan: ${edge.from_label} \u2192 ${edge.to_label} (weight: ${edge.weight.toFixed(2)}, mode: ${edge.mode})`,
1854
+ session.plan
1855
+ );
1856
+ } else {
1857
+ this.addStep(session.id, `No prior plan found \u2014 bootstrapping from scratch`, session.plan);
1858
+ }
1859
+ if (session.plan.skill) {
1860
+ this.addStep(session.id, `Matched skill: /${session.plan.skill}`);
1861
+ }
1862
+ } else {
1863
+ this.addStep(session.id, "No inference engine connected \u2014 executing task directly");
1852
1864
  }
1853
- this.completeSession(session.id, session.plan ?? { status: "no_plan" });
1865
+ this.addStep(session.id, "Executing\u2026");
1866
+ const output = session.plan?.reasoning ?? "Task queued \u2014 no plan selected";
1867
+ this.addStep(session.id, `Completed: ${output}`);
1868
+ this.completeSession(session.id, {
1869
+ output,
1870
+ plan: session.plan ?? null,
1871
+ steps: session.steps.length
1872
+ });
1854
1873
  } catch (err) {
1855
1874
  const message = err instanceof Error ? err.message : String(err);
1856
1875
  this.failSession(session.id, message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "0agent",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "A persistent, learning AI agent that runs on your machine. An agent that learns.",
5
5
  "private": false,
6
6
  "license": "Apache-2.0",