@iletai/nzb 1.4.6 → 1.4.7

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.
@@ -362,7 +362,8 @@ function isRecoverableError(err) {
362
362
  const msg = err instanceof Error ? err.message : String(err);
363
363
  return /timeout|disconnect|connection|EPIPE|ECONNRESET|ECONNREFUSED|socket|closed|ENOENT|spawn|not found|expired|stale/i.test(msg);
364
364
  }
365
- export async function sendToOrchestrator(prompt, source, callback, onToolEvent, onUsage) {
365
+ const MAX_AUTO_CONTINUE = 3;
366
+ export async function sendToOrchestrator(prompt, source, callback, onToolEvent, onUsage, _autoContinueCount = 0) {
366
367
  const sourceLabel = source.type === "telegram" ? "telegram" : source.type === "tui" ? "tui" : "background";
367
368
  logMessage("in", sourceLabel, prompt);
368
369
  // Tag the prompt with its source channel
@@ -434,18 +435,11 @@ export async function sendToOrchestrator(prompt, source, callback, onToolEvent,
434
435
  await callback(finalContent, true, { assistantLogId });
435
436
  // Auto-continue: if the response was cut short by timeout, automatically
436
437
  // send a follow-up "Continue" message so the user doesn't have to
437
- if (finalContent.includes("⏱ Response was cut short (timeout)")) {
438
- console.log("[nzb] Auto-continuing after timeout…");
439
- // Notify user that auto-continue is happening
440
- if (source.type === "telegram") {
441
- try {
442
- const { sendProactiveMessage } = await import("../telegram/bot.js");
443
- await sendProactiveMessage("🔄 Auto-continuing...");
444
- }
445
- catch { }
446
- }
438
+ if (finalContent.includes("⏱ Response was cut short (timeout)") &&
439
+ _autoContinueCount < MAX_AUTO_CONTINUE) {
440
+ console.log(`[nzb] Auto-continuing after timeout (${_autoContinueCount + 1}/${MAX_AUTO_CONTINUE})…`);
447
441
  await sleep(1000);
448
- void sendToOrchestrator("Continue from where you left off. Do not repeat what was already said.", source, callback, onToolEvent, onUsage);
442
+ void sendToOrchestrator("Continue from where you left off. Do not repeat what was already said.", source, callback, onToolEvent, onUsage, _autoContinueCount + 1);
449
443
  }
450
444
  return;
451
445
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iletai/nzb",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "description": "NZB — a personal AI assistant for developers, built on the GitHub Copilot SDK",
5
5
  "bin": {
6
6
  "nzb": "dist/cli.js"