claude-tmux 1.0.3 → 1.0.5
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 +11 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -64,25 +64,29 @@ async function waitForIdle(session) {
|
|
|
64
64
|
const startTime = Date.now();
|
|
65
65
|
let lastOutput = "";
|
|
66
66
|
let idleCount = 0;
|
|
67
|
+
let sawBusy = false; // Must see Claude working before we consider it idle
|
|
67
68
|
while (Date.now() - startTime < timeout) {
|
|
68
69
|
await sleep(2000);
|
|
69
70
|
try {
|
|
70
71
|
const output = runTmux(`capture-pane -t "${session}" -p -S -${lines}`);
|
|
71
|
-
// If busy,
|
|
72
|
+
// If busy, mark that we've seen Claude working and reset idle count
|
|
72
73
|
if (isBusy(output)) {
|
|
74
|
+
sawBusy = true;
|
|
73
75
|
lastOutput = output;
|
|
74
76
|
idleCount = 0;
|
|
75
77
|
continue;
|
|
76
78
|
}
|
|
77
|
-
// Check for positive done signal
|
|
78
|
-
if (isDone(output)) {
|
|
79
|
+
// Check for positive done signal (only trust if we saw busy first)
|
|
80
|
+
if (isDone(output) && sawBusy) {
|
|
79
81
|
return filterUIChrome(output);
|
|
80
82
|
}
|
|
81
83
|
// Not busy but no done signal - use settling delay
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
+
}
|
|
86
90
|
}
|
|
87
91
|
lastOutput = output;
|
|
88
92
|
}
|