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.
- package/dist/index.js +13 -24
- 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
|
|
27
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
|
80
|
-
if (isDone(output)
|
|
70
|
+
// Check for explicit done signal
|
|
71
|
+
if (isDone(output)) {
|
|
81
72
|
return filterUIChrome(output);
|
|
82
73
|
}
|
|
83
|
-
// Not busy
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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.
|
|
90
|
+
version: "1.0.7",
|
|
102
91
|
}, {
|
|
103
92
|
instructions: `# claude-tmux: Autonomous Claude Agents
|
|
104
93
|
|