polygram 0.10.0-rc.3 → 0.10.0-rc.4

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://anthropic.com/claude-code/plugin.schema.json",
3
3
  "name": "polygram",
4
- "version": "0.10.0-rc.3",
4
+ "version": "0.10.0-rc.4",
5
5
  "description": "Telegram integration for Claude Code that preserves the OpenClaw per-chat session model. Migration target for OpenClaw users. Multi-bot, multi-chat, per-topic isolation; SQLite transcripts; inline-keyboard approvals. Bundles /polygram:status|logs|pair-code|approvals admin commands plus history (transcript queries) and polygram-send (out-of-turn IPC sends with file-upload validation) skills.",
6
6
  "keywords": [
7
7
  "telegram",
@@ -78,7 +78,14 @@ const TOOL_INVOCATION_RE = /⏺\s+([A-Za-z_]\w*)\s*\((.*?)\)\s*$/m;
78
78
 
79
79
  // ─── Defaults — overridable per construction for tests ───────────────
80
80
 
81
- const DEFAULT_READY_TIMEOUT_MS = 30_000;
81
+ // Cold-spawn budget for claude TUI to reach "? for shortcuts" / "accept
82
+ // edits on" state. 30s was enough in dev (interactive shell, warm
83
+ // keychain) but consistently timed out under launchd in production:
84
+ // MCP server starts each have a 30s connection timeout, and the
85
+ // keychain/Aqua context warm-up is slower outside an attached terminal.
86
+ // 120s is generous; the only cost is waiting longer when something is
87
+ // genuinely stuck (we kill + retry in that case anyway).
88
+ const DEFAULT_READY_TIMEOUT_MS = 120_000;
82
89
  const DEFAULT_TURN_TIMEOUT_MS = 5 * 60_000;
83
90
  const DEFAULT_POLL_MS = 250;
84
91
  const DEFAULT_QUIESCE_MS = 500; // require READY for this long before declaring done
@@ -624,22 +631,32 @@ class TmuxProcess extends Process {
624
631
 
625
632
  async _waitForReady() {
626
633
  const deadline = this._now() + this.readyTimeoutMs;
634
+ let lastBuf = '';
627
635
  if (this.pollScheduler) this.pollScheduler.acquire();
628
636
  try {
629
637
  while (this._now() < deadline) {
630
638
  // OPTIMIZATION: ready hint lives in the bottom ~5 lines of the
631
639
  // pane. Polling 1000 lines each tick is wasteful — cap at 80
632
640
  // for a ~12× cheaper tmux subprocess.
633
- const buf = await this.runner.captureWide(this.tmuxName, { lines: 80 });
634
- if (READY_HINTS_RE.test(buf)) return;
641
+ lastBuf = await this.runner.captureWide(this.tmuxName, { lines: 80 });
642
+ if (READY_HINTS_RE.test(lastBuf)) return;
635
643
  await this._waitForNextTick();
636
644
  }
637
645
  } finally {
638
646
  if (this.pollScheduler) this.pollScheduler.release();
639
647
  }
648
+ // On timeout, surface what the TUI was actually showing so the
649
+ // operator can diagnose whether it was hung, on a setup prompt,
650
+ // or just slow to render the ready hint. capture the last ~40
651
+ // lines for the error event payload + log.
652
+ const tail = lastBuf.split('\n').slice(-40).join('\n');
653
+ this.logger.warn?.(
654
+ `[${this.label}] TUI did not signal ready in ${this.readyTimeoutMs}ms; last pane tail:\n${tail}`,
655
+ );
640
656
  throw Object.assign(new Error('TmuxProcess: TUI did not signal ready'), {
641
657
  code: 'TMUX_READY_TIMEOUT',
642
658
  tmuxName: this.tmuxName,
659
+ paneTail: tail,
643
660
  });
644
661
  }
645
662
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polygram",
3
- "version": "0.10.0-rc.3",
3
+ "version": "0.10.0-rc.4",
4
4
  "description": "Telegram daemon for Claude Code that preserves the OpenClaw per-chat session model. Migration path for OpenClaw users moving to Claude Code.",
5
5
  "main": "lib/ipc/client.js",
6
6
  "bin": {