0agent 1.0.3 → 1.0.4
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 +20 -8
- package/dist/daemon.mjs +25 -6
- package/package.json +1 -1
package/bin/0agent.js
CHANGED
|
@@ -377,14 +377,16 @@ async function streamSession(sessionId) {
|
|
|
377
377
|
|
|
378
378
|
switch (event.type) {
|
|
379
379
|
case 'session.step':
|
|
380
|
-
console.log(`
|
|
380
|
+
console.log(` › ${event.step}`);
|
|
381
381
|
break;
|
|
382
|
-
case 'session.completed':
|
|
383
|
-
console.log('\n ✓
|
|
384
|
-
|
|
382
|
+
case 'session.completed': {
|
|
383
|
+
console.log('\n ✓ Done\n');
|
|
384
|
+
const out = event.result?.output ?? event.result;
|
|
385
|
+
if (out && typeof out === 'string') console.log(` ${out}\n`);
|
|
385
386
|
ws.close();
|
|
386
387
|
resolve();
|
|
387
388
|
break;
|
|
389
|
+
}
|
|
388
390
|
case 'session.failed':
|
|
389
391
|
console.log(`\n ✗ Failed: ${event.error}\n`);
|
|
390
392
|
ws.close();
|
|
@@ -406,21 +408,31 @@ async function streamSession(sessionId) {
|
|
|
406
408
|
}
|
|
407
409
|
|
|
408
410
|
async function pollSession(sessionId) {
|
|
411
|
+
let lastStepCount = 0;
|
|
409
412
|
for (let i = 0; i < 300; i++) {
|
|
410
|
-
await sleep(
|
|
413
|
+
await sleep(600);
|
|
411
414
|
const res = await fetch(`${BASE_URL}/api/sessions/${sessionId}`);
|
|
412
415
|
const s = await res.json();
|
|
416
|
+
|
|
417
|
+
// Print any new steps since last poll
|
|
418
|
+
const steps = s.steps ?? [];
|
|
419
|
+
for (let j = lastStepCount; j < steps.length; j++) {
|
|
420
|
+
console.log(` › ${steps[j].description}`);
|
|
421
|
+
}
|
|
422
|
+
lastStepCount = steps.length;
|
|
423
|
+
|
|
413
424
|
if (s.status === 'completed') {
|
|
414
|
-
console.log('\n ✓
|
|
415
|
-
|
|
425
|
+
console.log('\n ✓ Done\n');
|
|
426
|
+
const out = s.result?.output ?? s.result;
|
|
427
|
+
if (out && typeof out === 'string') console.log(` ${out}\n`);
|
|
416
428
|
return;
|
|
417
429
|
}
|
|
418
430
|
if (s.status === 'failed') {
|
|
419
431
|
console.log(`\n ✗ Failed: ${s.error}\n`);
|
|
420
432
|
return;
|
|
421
433
|
}
|
|
422
|
-
process.stdout.write('.');
|
|
423
434
|
}
|
|
435
|
+
console.log('\n Timed out waiting for session.\n');
|
|
424
436
|
}
|
|
425
437
|
|
|
426
438
|
// ─── 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
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
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.
|
|
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);
|