@inetafrica/open-claudia 1.0.7 → 1.0.9

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.
Files changed (2) hide show
  1. package/bot.js +55 -1
  2. package/package.json +1 -1
package/bot.js CHANGED
@@ -79,6 +79,8 @@ bot.setMyCommands([
79
79
  { command: "status", description: "Session & settings info" },
80
80
  { command: "stop", description: "Cancel running task" },
81
81
  { command: "end", description: "End current session" },
82
+ { command: "restart", description: "Restart the bot" },
83
+ { command: "upgrade", description: "Upgrade and restart" },
82
84
  { command: "help", description: "Show all commands" },
83
85
  ]);
84
86
 
@@ -347,7 +349,7 @@ function findProject(query) {
347
349
 
348
350
  function projectKeyboard() {
349
351
  const projects = listProjects();
350
- const rows = [];
352
+ const rows = [[{ text: "\u{1F4C1} Workspace (root)", callback_data: "s:__workspace__" }]];
351
353
  for (let i = 0; i < projects.length; i += 2) {
352
354
  const row = [{ text: projects[i], callback_data: `s:${projects[i]}` }];
353
355
  if (projects[i + 1]) row.push({ text: projects[i + 1], callback_data: `s:${projects[i + 1]}` });
@@ -574,6 +576,12 @@ function initCrons() {
574
576
  // ── Session ─────────────────────────────────────────────────────────
575
577
 
576
578
  function startSession(name) {
579
+ if (name === "__workspace__") {
580
+ currentSession = { name: "Workspace", dir: WORKSPACE };
581
+ lastSessionId = null; messageQueue = []; resetSettings();
582
+ send(`Session: Workspace (root)\n\nSend text, voice, or images.`);
583
+ return;
584
+ }
577
585
  const result = findProject(name);
578
586
  if (!result) return send(`No match for "${name}".`, { keyboard: projectKeyboard() });
579
587
  if (Array.isArray(result)) return send("Multiple matches:", { keyboard: { inline_keyboard: result.map((p) => [{ text: p, callback_data: `s:${p}` }]) } });
@@ -601,12 +609,58 @@ bot.onText(/\/help/, (msg) => {
601
609
  "Session: /session /projects /continue /status /stop /end",
602
610
  "Settings: /model /effort /budget /plan /compact /worktree",
603
611
  "Automation: /cron /vault /soul",
612
+ "System: /restart /upgrade",
604
613
  "",
605
614
  "Send text, voice, photos, or files.",
606
615
  "Reply to any message for context.",
607
616
  ].join("\n"));
608
617
  });
609
618
 
619
+ bot.onText(/\/restart$/, async (msg) => {
620
+ if (!isOwner(msg)) return;
621
+ await send("Restarting...");
622
+ const botPath = path.join(__dirname, "bot.js");
623
+ const child = spawn(process.execPath, [botPath], {
624
+ detached: true,
625
+ stdio: "ignore",
626
+ env: { ...process.env, PATH: FULL_PATH },
627
+ });
628
+ child.unref();
629
+ setTimeout(() => process.exit(0), 500);
630
+ });
631
+
632
+ bot.onText(/\/upgrade$/, async (msg) => {
633
+ if (!isOwner(msg)) return;
634
+ await send("Upgrading...");
635
+ try {
636
+ const output = execSync("npm install -g @inetafrica/open-claudia@latest 2>&1", {
637
+ encoding: "utf-8", timeout: 60000,
638
+ env: { ...process.env, PATH: FULL_PATH },
639
+ });
640
+ const versionMatch = output.match(/@inetafrica\/open-claudia@([\d.]+)/);
641
+ const version = versionMatch ? versionMatch[1] : "latest";
642
+ await send(`Upgraded to v${version}. Restarting...`);
643
+ } catch (e) {
644
+ await send(`Upgrade failed: ${e.message}`);
645
+ return;
646
+ }
647
+ // Restart with the new code — resolve fresh path from npm
648
+ let botPath;
649
+ try {
650
+ const root = execSync("npm root -g", { encoding: "utf-8" }).trim();
651
+ botPath = path.join(root, "@inetafrica", "open-claudia", "bot.js");
652
+ } catch (e) {
653
+ botPath = path.join(__dirname, "bot.js");
654
+ }
655
+ const child = spawn(process.execPath, [botPath], {
656
+ detached: true,
657
+ stdio: "ignore",
658
+ env: { ...process.env, PATH: FULL_PATH },
659
+ });
660
+ child.unref();
661
+ setTimeout(() => process.exit(0), 500);
662
+ });
663
+
610
664
  bot.onText(/\/projects$/, (msg) => { if (isAuthorized(msg)) send("Pick:", { keyboard: projectKeyboard() }); });
611
665
  bot.onText(/\/session$/, (msg) => {
612
666
  if (!isAuthorized(msg)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inetafrica/open-claudia",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Your always-on AI coding assistant — Claude Code via Telegram",
5
5
  "main": "bot.js",
6
6
  "bin": {