@inetafrica/open-claudia 1.3.2 → 1.3.3

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 +28 -1
  2. package/package.json +1 -1
package/bot.js CHANGED
@@ -480,6 +480,8 @@ ${lastSessionId ? "Resuming conversation — you have prior context." : "New con
480
480
  - When asked about yourself, you are Open Claudia — an AI coding assistant running Claude Code via Telegram.
481
481
  - If a task will take a while, let the user know upfront.
482
482
  - Don't ask for confirmation on simple tasks — just do them.
483
+ - NEVER start long-running processes (dev servers, watchers, tails) in the foreground. They block all further messages. Instead, run them in the background: \`nohup command &\` or \`command &disown\`. Then report the PID so the user can stop it later.
484
+ - If asked to "start" or "run" a dev server, ALWAYS background it.
483
485
  `.trim();
484
486
  }
485
487
 
@@ -623,13 +625,17 @@ async function runClaude(prompt, cwd, replyToMsgId, opts = {}) {
623
625
  cwd,
624
626
  env: { ...process.env, PATH: FULL_PATH, HOME: process.env.HOME },
625
627
  stdio: ["ignore", "pipe", "pipe"],
628
+ detached: process.platform !== "win32", // Create process group so /stop kills children too
626
629
  });
627
630
 
628
631
  runningProcess = proc;
632
+ const startTime = Date.now();
633
+ let longRunningNotified = false;
629
634
 
630
635
  let lastUpdate = "";
631
636
  streamInterval = setInterval(async () => {
632
637
  bot.sendChatAction(CHAT_ID, "typing");
638
+ const elapsed = Math.floor((Date.now() - startTime) / 1000);
633
639
  const display = formatProgress(assistantText, toolUses, currentTool);
634
640
  if (display && display !== lastUpdate) {
635
641
  if (!statusMessageId && assistantText) {
@@ -639,6 +645,11 @@ async function runClaude(prompt, cwd, replyToMsgId, opts = {}) {
639
645
  }
640
646
  lastUpdate = display;
641
647
  }
648
+ // Notify after 5 minutes that it's still running
649
+ if (elapsed > 300 && !longRunningNotified) {
650
+ longRunningNotified = true;
651
+ await send(`Still working (${Math.floor(elapsed / 60)}min)... Send /stop to cancel.`);
652
+ }
642
653
  }, 1500);
643
654
 
644
655
  proc.stdout.on("data", (data) => {
@@ -898,7 +909,23 @@ bot.onText(/\/worktree$/, (msg) => { if (!isAuthorized(msg)) return; settings.wo
898
909
 
899
910
  bot.onText(/\/stop/, async (msg) => {
900
911
  if (!isAuthorized(msg)) return;
901
- if (runningProcess) { runningProcess.kill("SIGTERM"); runningProcess = null; if (streamInterval) clearInterval(streamInterval); messageQueue = []; await send("Cancelled."); }
912
+ if (runningProcess) {
913
+ const pid = runningProcess.pid;
914
+ try {
915
+ // Kill entire process group to catch child processes (dev servers, etc.)
916
+ process.kill(-pid, "SIGTERM");
917
+ } catch (e) {
918
+ try { runningProcess.kill("SIGTERM"); } catch (e2) {}
919
+ }
920
+ // Force kill after 3 seconds if still alive
921
+ setTimeout(() => {
922
+ try { process.kill(-pid, "SIGKILL"); } catch (e) {}
923
+ }, 3000);
924
+ runningProcess = null;
925
+ if (streamInterval) clearInterval(streamInterval);
926
+ messageQueue = [];
927
+ await send("Cancelled.");
928
+ }
902
929
  else await send("Nothing running.");
903
930
  });
904
931
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inetafrica/open-claudia",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Your always-on AI coding assistant — Claude Code via Telegram",
5
5
  "main": "bot.js",
6
6
  "bin": {