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/index.mjs
CHANGED
|
@@ -293,6 +293,7 @@ var PTYSession = class extends EventEmitter {
|
|
|
293
293
|
_stallDetectionEnabled;
|
|
294
294
|
_lastStallHash = null;
|
|
295
295
|
_stallStartedAt = null;
|
|
296
|
+
_lastContentHash = null;
|
|
296
297
|
id;
|
|
297
298
|
config;
|
|
298
299
|
get status() {
|
|
@@ -379,12 +380,28 @@ var PTYSession = class extends EventEmitter {
|
|
|
379
380
|
/**
|
|
380
381
|
* Start or reset the stall detection timer.
|
|
381
382
|
* Active when status is "busy" or "authenticating" and stall detection is enabled.
|
|
383
|
+
*
|
|
384
|
+
* Content-based: hashes the ANSI-stripped buffer tail and only resets the
|
|
385
|
+
* timer when visible content actually changes. This prevents TUI spinners
|
|
386
|
+
* (which produce new ANSI sequences but no new visible text) from endlessly
|
|
387
|
+
* resetting the timer.
|
|
382
388
|
*/
|
|
383
389
|
resetStallTimer() {
|
|
384
|
-
this.clearStallTimer();
|
|
385
390
|
if (!this._stallDetectionEnabled || this._status !== "busy" && this._status !== "authenticating") {
|
|
391
|
+
this.clearStallTimer();
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
const tail = this.outputBuffer.slice(-500);
|
|
395
|
+
const stripped = this.stripAnsiForStall(tail);
|
|
396
|
+
const hash = this.simpleHash(stripped);
|
|
397
|
+
if (hash === this._lastContentHash) {
|
|
386
398
|
return;
|
|
387
399
|
}
|
|
400
|
+
this._lastContentHash = hash;
|
|
401
|
+
if (this._stallTimer) {
|
|
402
|
+
clearTimeout(this._stallTimer);
|
|
403
|
+
this._stallTimer = null;
|
|
404
|
+
}
|
|
388
405
|
this._stallStartedAt = Date.now();
|
|
389
406
|
this._lastStallHash = null;
|
|
390
407
|
this._stallTimer = setTimeout(() => {
|
|
@@ -400,6 +417,7 @@ var PTYSession = class extends EventEmitter {
|
|
|
400
417
|
this._stallTimer = null;
|
|
401
418
|
}
|
|
402
419
|
this._stallStartedAt = null;
|
|
420
|
+
this._lastContentHash = null;
|
|
403
421
|
}
|
|
404
422
|
/**
|
|
405
423
|
* Called when the stall timer fires (no output for stallTimeoutMs).
|
|
@@ -460,6 +478,7 @@ var PTYSession = class extends EventEmitter {
|
|
|
460
478
|
return;
|
|
461
479
|
}
|
|
462
480
|
if (!classification || classification.state === "still_working") {
|
|
481
|
+
this._lastContentHash = null;
|
|
463
482
|
this.resetStallTimer();
|
|
464
483
|
return;
|
|
465
484
|
}
|
|
@@ -1883,6 +1902,7 @@ var BunCompatiblePTYManager = class extends EventEmitter3 {
|
|
|
1883
1902
|
case "login_required": {
|
|
1884
1903
|
const session = this.sessions.get(id);
|
|
1885
1904
|
if (session) {
|
|
1905
|
+
session.status = "authenticating";
|
|
1886
1906
|
this.emit("login_required", session, event.instructions, event.url);
|
|
1887
1907
|
}
|
|
1888
1908
|
break;
|