pty-manager 1.2.16 → 1.2.17
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.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -1
- package/dist/index.mjs.map +1 -1
- package/dist/pty-worker.js +20 -1
- package/package.json +1 -1
package/dist/pty-worker.js
CHANGED
|
@@ -314,6 +314,7 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
314
314
|
_stallDetectionEnabled;
|
|
315
315
|
_lastStallHash = null;
|
|
316
316
|
_stallStartedAt = null;
|
|
317
|
+
_lastContentHash = null;
|
|
317
318
|
id;
|
|
318
319
|
config;
|
|
319
320
|
get status() {
|
|
@@ -400,12 +401,28 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
400
401
|
/**
|
|
401
402
|
* Start or reset the stall detection timer.
|
|
402
403
|
* Active when status is "busy" or "authenticating" and stall detection is enabled.
|
|
404
|
+
*
|
|
405
|
+
* Content-based: hashes the ANSI-stripped buffer tail and only resets the
|
|
406
|
+
* timer when visible content actually changes. This prevents TUI spinners
|
|
407
|
+
* (which produce new ANSI sequences but no new visible text) from endlessly
|
|
408
|
+
* resetting the timer.
|
|
403
409
|
*/
|
|
404
410
|
resetStallTimer() {
|
|
405
|
-
this.clearStallTimer();
|
|
406
411
|
if (!this._stallDetectionEnabled || this._status !== "busy" && this._status !== "authenticating") {
|
|
412
|
+
this.clearStallTimer();
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
const tail = this.outputBuffer.slice(-500);
|
|
416
|
+
const stripped = this.stripAnsiForStall(tail);
|
|
417
|
+
const hash = this.simpleHash(stripped);
|
|
418
|
+
if (hash === this._lastContentHash) {
|
|
407
419
|
return;
|
|
408
420
|
}
|
|
421
|
+
this._lastContentHash = hash;
|
|
422
|
+
if (this._stallTimer) {
|
|
423
|
+
clearTimeout(this._stallTimer);
|
|
424
|
+
this._stallTimer = null;
|
|
425
|
+
}
|
|
409
426
|
this._stallStartedAt = Date.now();
|
|
410
427
|
this._lastStallHash = null;
|
|
411
428
|
this._stallTimer = setTimeout(() => {
|
|
@@ -421,6 +438,7 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
421
438
|
this._stallTimer = null;
|
|
422
439
|
}
|
|
423
440
|
this._stallStartedAt = null;
|
|
441
|
+
this._lastContentHash = null;
|
|
424
442
|
}
|
|
425
443
|
/**
|
|
426
444
|
* Called when the stall timer fires (no output for stallTimeoutMs).
|
|
@@ -481,6 +499,7 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
481
499
|
return;
|
|
482
500
|
}
|
|
483
501
|
if (!classification || classification.state === "still_working") {
|
|
502
|
+
this._lastContentHash = null;
|
|
484
503
|
this.resetStallTimer();
|
|
485
504
|
return;
|
|
486
505
|
}
|
package/package.json
CHANGED