claude-tmux 1.0.5 → 1.0.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.
Files changed (2) hide show
  1. package/dist/index.js +13 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23,17 +23,8 @@ function sleep(ms) {
23
23
  return new Promise(resolve => setTimeout(resolve, ms));
24
24
  }
25
25
  function isBusy(output) {
26
- // Claude shows these patterns when actively working
27
- const busyPatterns = [
28
- 'ctrl+c to interrupt',
29
- 'esc to interrupt',
30
- ];
31
- for (const pattern of busyPatterns) {
32
- if (output.includes(pattern)) {
33
- return true;
34
- }
35
- }
36
- return false;
26
+ // Claude shows "(ctrl+c to interrupt" when actively working
27
+ return output.includes('(ctrl+c to interrupt');
37
28
  }
38
29
  function isDone(output) {
39
30
  // Claude shows "✻ [verb] for [duration]" when task completes
@@ -64,29 +55,27 @@ async function waitForIdle(session) {
64
55
  const startTime = Date.now();
65
56
  let lastOutput = "";
66
57
  let idleCount = 0;
67
- let sawBusy = false; // Must see Claude working before we consider it idle
58
+ // Initial delay to let Claude start working
59
+ await sleep(5000);
68
60
  while (Date.now() - startTime < timeout) {
69
61
  await sleep(2000);
70
62
  try {
71
63
  const output = runTmux(`capture-pane -t "${session}" -p -S -${lines}`);
72
- // If busy, mark that we've seen Claude working and reset idle count
64
+ // If busy, reset idle count and continue polling
73
65
  if (isBusy(output)) {
74
- sawBusy = true;
75
66
  lastOutput = output;
76
67
  idleCount = 0;
77
68
  continue;
78
69
  }
79
- // Check for positive done signal (only trust if we saw busy first)
80
- if (isDone(output) && sawBusy) {
70
+ // Check for explicit done signal
71
+ if (isDone(output)) {
81
72
  return filterUIChrome(output);
82
73
  }
83
- // Not busy but no done signal - use settling delay
84
- // Only start counting idle after we've seen Claude working
85
- if (sawBusy) {
86
- idleCount++;
87
- if (idleCount >= 2) {
88
- return filterUIChrome(output);
89
- }
74
+ // Not busy - count consecutive idle polls
75
+ // After 2 consecutive non-busy polls, consider done
76
+ idleCount++;
77
+ if (idleCount >= 2) {
78
+ return filterUIChrome(output);
90
79
  }
91
80
  lastOutput = output;
92
81
  }
@@ -98,7 +87,7 @@ async function waitForIdle(session) {
98
87
  }
99
88
  const server = new McpServer({
100
89
  name: "claude-tmux",
101
- version: "1.0.0",
90
+ version: "1.0.7",
102
91
  }, {
103
92
  instructions: `# claude-tmux: Autonomous Claude Agents
104
93
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-tmux",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "MCP server for orchestrating multiple Claude Code instances via tmux",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",