0agent 1.0.95 → 1.0.97

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
@@ -330,7 +330,21 @@ async function runInit() {
330
330
  tgToken = await arrowPassword('Telegram bot token');
331
331
  tgToken = tgToken.trim();
332
332
  if (tgToken) {
333
- console.log(' \x1b[32m✓\x1b[0m Telegram connected. Message your bot to chat with 0agent.');
333
+ // Validate token immediately
334
+ process.stdout.write(' Verifying token...');
335
+ try {
336
+ const tgRes = await fetch(`https://api.telegram.org/bot${tgToken}/getMe`, { signal: AbortSignal.timeout(10000) });
337
+ const tgData = await tgRes.json();
338
+ if (tgData.ok) {
339
+ console.log(` \x1b[32m✓\x1b[0m @${tgData.result?.username ?? 'bot'}`);
340
+ console.log(` \x1b[32m✓\x1b[0m Message @${tgData.result?.username} on Telegram to chat with 0agent.`);
341
+ } else {
342
+ console.log(` \x1b[31m✗\x1b[0m Invalid token — check with @BotFather`);
343
+ tgToken = '';
344
+ }
345
+ } catch {
346
+ console.log(` \x1b[33m⚠\x1b[0m Could not verify (network issue) — will retry on daemon start`);
347
+ }
334
348
  }
335
349
  } else if (channelIdx === 1) {
336
350
  // Slack
package/bin/chat.js CHANGED
@@ -409,14 +409,13 @@ const history = []; // command history for arrow keys
409
409
 
410
410
  // ─── Header ──────────────────────────────────────────────────────────────────
411
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; }
412
+ const flag = resolve(homedir(), '.0agent', '.onboarded');
413
+ return !existsSync(flag);
414
+ }
415
+
416
+ function markOnboarded() {
417
+ const flag = resolve(homedir(), '.0agent', '.onboarded');
418
+ try { writeFileSync(flag, new Date().toISOString(), 'utf8'); } catch {}
420
419
  }
421
420
 
422
421
  function printHeader() {
@@ -445,6 +444,7 @@ function printHeader() {
445
444
  console.log();
446
445
  console.log(fmt(C.bold, ' Let\'s start by getting to know each other. Tell me about yourself!'));
447
446
  console.log(fmt(C.dim, ' (Your name, what you do, what you\'re working on)\n'));
447
+ markOnboarded();
448
448
  } else {
449
449
  console.log(fmt(C.dim, '\n Type a task, or / for commands.\n'));
450
450
  }
package/dist/daemon.mjs CHANGED
@@ -11219,7 +11219,7 @@ import { join as join4 } from "node:path";
11219
11219
  var TelegramAdapter = class {
11220
11220
  constructor(config) {
11221
11221
  this.config = config;
11222
- this.token = config.token;
11222
+ this.token = config.token || process.env.TELEGRAM_BOT_TOKEN || "";
11223
11223
  this.allowedUsers = new Set(config.allowed_users ?? []);
11224
11224
  this.daemonUrl = config.daemon_url ?? "http://localhost:4200";
11225
11225
  this.transcribeVoice = config.transcribe_voice ?? true;
@@ -11244,8 +11244,23 @@ var TelegramAdapter = class {
11244
11244
  }
11245
11245
  async start() {
11246
11246
  if (this.running) return;
11247
+ if (!this.token) {
11248
+ console.error("[0agent] Telegram: no token configured. Set surfaces.telegram.token in config.yaml or TELEGRAM_BOT_TOKEN env var.");
11249
+ return;
11250
+ }
11251
+ try {
11252
+ const res = await fetch(`https://api.telegram.org/bot${this.token}/getMe`, { signal: AbortSignal.timeout(1e4) });
11253
+ const data = await res.json();
11254
+ if (!data.ok) {
11255
+ console.error("[0agent] Telegram: invalid bot token \u2014 getMe failed. Check your token.");
11256
+ return;
11257
+ }
11258
+ console.log(`[0agent] Telegram: connected as @${data.result?.username ?? data.result?.first_name ?? "bot"}`);
11259
+ } catch (err) {
11260
+ console.error(`[0agent] Telegram: could not reach Telegram API \u2014 ${err instanceof Error ? err.message : err}`);
11261
+ return;
11262
+ }
11247
11263
  this.running = true;
11248
- console.log("[0agent] Telegram: adapter started");
11249
11264
  this._poll();
11250
11265
  }
11251
11266
  async stop() {
@@ -11544,7 +11559,8 @@ Sessions: ${h.active_sessions} active`
11544
11559
  }
11545
11560
  static isConfigured(config) {
11546
11561
  const c = config;
11547
- return !!(c?.token && typeof c.token === "string" && c.token.length > 10);
11562
+ const token = c?.token ?? process.env.TELEGRAM_BOT_TOKEN;
11563
+ return !!(token && typeof token === "string" && token.length > 10);
11548
11564
  }
11549
11565
  };
11550
11566
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "0agent",
3
- "version": "1.0.95",
3
+ "version": "1.0.97",
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",