0agent 1.0.84 → 1.0.85
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 +50 -1
- package/bin/chat.js +33 -1
- package/dist/daemon.mjs +6 -1
- package/package.json +1 -1
package/bin/0agent.js
CHANGED
|
@@ -438,7 +438,56 @@ ${surfacesYaml}
|
|
|
438
438
|
console.log('\n Starting...');
|
|
439
439
|
await startDaemon();
|
|
440
440
|
|
|
441
|
-
//
|
|
441
|
+
// Wait for daemon to be ready
|
|
442
|
+
for (let i = 0; i < 10; i++) {
|
|
443
|
+
if (await isDaemonRunning()) break;
|
|
444
|
+
await sleep(500);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// ── First-run onboarding: agent learns about the user ──────────────────
|
|
448
|
+
console.log('\n \x1b[1m┌─────────────────────────────────────────────────┐\x1b[0m');
|
|
449
|
+
console.log(' \x1b[1m│ Your agent is ready! │\x1b[0m');
|
|
450
|
+
console.log(' \x1b[1m│ │\x1b[0m');
|
|
451
|
+
console.log(' \x1b[1m│ Here\'s what you can do: │\x1b[0m');
|
|
452
|
+
console.log(' \x1b[1m│ │\x1b[0m');
|
|
453
|
+
console.log(' \x1b[1m│ \x1b[36m0agent "build a landing page"\x1b[0m\x1b[1m │\x1b[0m');
|
|
454
|
+
console.log(' \x1b[1m│ \x1b[36m0agent chat\x1b[0m\x1b[1m — persistent chat │\x1b[0m');
|
|
455
|
+
if (tgToken) {
|
|
456
|
+
console.log(' \x1b[1m│ \x1b[36mTelegram bot\x1b[0m\x1b[1m — message your bot │\x1b[0m');
|
|
457
|
+
} else if (slackBotToken) {
|
|
458
|
+
console.log(' \x1b[1m│ \x1b[36mSlack bot\x1b[0m\x1b[1m — @mention in Slack │\x1b[0m');
|
|
459
|
+
}
|
|
460
|
+
console.log(' \x1b[1m│ \x1b[36m0agent skill list\x1b[0m\x1b[1m — see all skills │\x1b[0m');
|
|
461
|
+
console.log(' \x1b[1m│ \x1b[36m0agent help\x1b[0m\x1b[1m — full command list │\x1b[0m');
|
|
462
|
+
console.log(' \x1b[1m│ │\x1b[0m');
|
|
463
|
+
console.log(' \x1b[1m└─────────────────────────────────────────────────┘\x1b[0m');
|
|
464
|
+
|
|
465
|
+
// Fire the onboarding session — agent introduces itself and learns about the user
|
|
466
|
+
console.log('\n \x1b[2mYour agent would like to get to know you...\x1b[0m\n');
|
|
467
|
+
try {
|
|
468
|
+
const onboardingTask = [
|
|
469
|
+
'This is your very first conversation with a new user who just set up 0agent.',
|
|
470
|
+
'Introduce yourself warmly and briefly — you are their personal AI agent that lives on their machine, learns from every interaction, and can code, browse, automate tasks, and more.',
|
|
471
|
+
'',
|
|
472
|
+
'Then ask them a few questions to learn about them (ONE at a time):',
|
|
473
|
+
'1. What\'s your name?',
|
|
474
|
+
'2. What do you do? (role, field, what kind of work)',
|
|
475
|
+
'3. What are you hoping to use 0agent for? (coding, automation, research, etc.)',
|
|
476
|
+
'',
|
|
477
|
+
'Save everything they tell you to memory_write immediately.',
|
|
478
|
+
'Keep it conversational — not a form. Be genuinely curious.',
|
|
479
|
+
'If they mention a specific project or tech stack, remember that too.',
|
|
480
|
+
'End by suggesting one thing you can do for them right now based on what they shared.',
|
|
481
|
+
].join('\n');
|
|
482
|
+
|
|
483
|
+
await fetch(`${BASE_URL}/api/sessions`, {
|
|
484
|
+
method: 'POST',
|
|
485
|
+
headers: { 'Content-Type': 'application/json' },
|
|
486
|
+
body: JSON.stringify({ task: onboardingTask }),
|
|
487
|
+
});
|
|
488
|
+
} catch {}
|
|
489
|
+
|
|
490
|
+
// Open chat TUI — the onboarding response will stream in
|
|
442
491
|
const chatSc = resolve(dirname(new URL(import.meta.url).pathname), 'chat.js');
|
|
443
492
|
if (existsSync(chatSc)) {
|
|
444
493
|
const { spawn: sp } = await import('node:child_process');
|
package/bin/chat.js
CHANGED
|
@@ -408,14 +408,46 @@ const spinner = new Spinner('Thinking');
|
|
|
408
408
|
const history = []; // command history for arrow keys
|
|
409
409
|
|
|
410
410
|
// ─── Header ──────────────────────────────────────────────────────────────────
|
|
411
|
+
function isFirstRun() {
|
|
412
|
+
// Check if the graph DB has any conversations yet
|
|
413
|
+
try {
|
|
414
|
+
const dbPath = cfg?.graph?.db_path;
|
|
415
|
+
if (!dbPath || !existsSync(dbPath)) return true;
|
|
416
|
+
// If DB exists but is tiny (<10KB), likely first run
|
|
417
|
+
const { statSync } = require('node:fs');
|
|
418
|
+
return statSync(dbPath).size < 10240;
|
|
419
|
+
} catch { return true; }
|
|
420
|
+
}
|
|
421
|
+
|
|
411
422
|
function printHeader() {
|
|
412
423
|
const provider = getCurrentProvider(cfg);
|
|
413
424
|
const modelStr = provider ? `${provider.provider}/${provider.model}` : 'no model';
|
|
414
425
|
const ws = cfg?.workspace?.path ?? null;
|
|
426
|
+
const first = isFirstRun();
|
|
415
427
|
console.log();
|
|
416
428
|
console.log(` ${fmt(C.bold, '0agent')} ${fmt(C.dim, '·')} ${fmt(C.cyan, modelStr)}`);
|
|
417
429
|
if (ws) console.log(fmt(C.dim, ` ${ws}`));
|
|
418
|
-
|
|
430
|
+
|
|
431
|
+
if (first) {
|
|
432
|
+
console.log();
|
|
433
|
+
console.log(fmt(C.bold, ' Welcome! I\'m your personal AI agent.'));
|
|
434
|
+
console.log(fmt(C.dim, ' I live on your machine, learn from every interaction, and get better over time.'));
|
|
435
|
+
console.log();
|
|
436
|
+
console.log(` ${fmt(C.bold, 'What I can do:')}`);
|
|
437
|
+
console.log(` ${fmt(C.cyan, 'Code')} — build features, fix bugs, refactor, test, review`);
|
|
438
|
+
console.log(` ${fmt(C.cyan, 'Automate')} — browse websites, fill forms, book tickets, file taxes`);
|
|
439
|
+
console.log(` ${fmt(C.cyan, 'Monitor')} — watch prices, slots, availability — act when ready`);
|
|
440
|
+
console.log(` ${fmt(C.cyan, 'Publish')} — create HTML artifacts and share via live surge.sh links`);
|
|
441
|
+
console.log(` ${fmt(C.cyan, 'Remember')} — I learn your preferences, patterns, and project context`);
|
|
442
|
+
if (cfg?.surfaces?.telegram) console.log(` ${fmt(C.cyan, 'Telegram')} — message your bot to chat with me from anywhere`);
|
|
443
|
+
if (cfg?.surfaces?.slack) console.log(` ${fmt(C.cyan, 'Slack')} — @mention me or DM me in Slack`);
|
|
444
|
+
if (cfg?.surfaces?.whatsapp) console.log(` ${fmt(C.cyan, 'WhatsApp')} — send me a message on WhatsApp`);
|
|
445
|
+
console.log();
|
|
446
|
+
console.log(fmt(C.bold, ' Let\'s start by getting to know each other. Tell me about yourself!'));
|
|
447
|
+
console.log(fmt(C.dim, ' (Your name, what you do, what you\'re working on)\n'));
|
|
448
|
+
} else {
|
|
449
|
+
console.log(fmt(C.dim, '\n Type a task, or / for commands.\n'));
|
|
450
|
+
}
|
|
419
451
|
}
|
|
420
452
|
|
|
421
453
|
function printInsights() {
|
package/dist/daemon.mjs
CHANGED
|
@@ -6345,10 +6345,15 @@ content = element.text if element else page.get_all_text()` : `content = page.ge
|
|
|
6345
6345
|
const isJustdoTask = !!(task && /book|file.*itr|tax.*file|irctc|train.*ticket|flight|passport|appointment|login.*portal|pan.*card|aadhaar|monitor.*watch|price.*drop|slot.*available|justdo/i.test(task));
|
|
6346
6346
|
const dateStr = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
6347
6347
|
const lines = [
|
|
6348
|
-
`You are 0agent,
|
|
6348
|
+
`You are 0agent, a persistent AI agent that lives on the user's machine.`,
|
|
6349
|
+
`You learn from every interaction, remember across sessions, and can code, automate, browse, and more.`,
|
|
6349
6350
|
`Working directory: ${this.cwd}`,
|
|
6350
6351
|
`Date: ${dateStr}`,
|
|
6351
6352
|
``,
|
|
6353
|
+
`PERSONALITY: Be warm, helpful, and genuinely curious about the user. You are their personal agent.`,
|
|
6354
|
+
`If this is the first interaction, introduce yourself and learn about them \u2014 their name, role, goals.`,
|
|
6355
|
+
`Save anything they share about themselves to memory_write immediately.`,
|
|
6356
|
+
``,
|
|
6352
6357
|
`Use tools to accomplish tasks \u2014 don't describe what to do, do it.`,
|
|
6353
6358
|
`For background processes, always redirect output: cmd > /tmp/log 2>&1 &`,
|
|
6354
6359
|
`Prefer file_op edit (find-and-replace) over rewriting entire files.`,
|