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.d.mts
CHANGED
|
@@ -422,6 +422,7 @@ declare class PTYSession extends EventEmitter {
|
|
|
422
422
|
private _stallDetectionEnabled;
|
|
423
423
|
private _lastStallHash;
|
|
424
424
|
private _stallStartedAt;
|
|
425
|
+
private _lastContentHash;
|
|
425
426
|
readonly id: string;
|
|
426
427
|
readonly config: SpawnConfig;
|
|
427
428
|
constructor(adapter: CLIAdapter, config: SpawnConfig, logger?: Logger, stallDetectionEnabled?: boolean, defaultStallTimeoutMs?: number);
|
|
@@ -454,6 +455,11 @@ declare class PTYSession extends EventEmitter {
|
|
|
454
455
|
/**
|
|
455
456
|
* Start or reset the stall detection timer.
|
|
456
457
|
* Active when status is "busy" or "authenticating" and stall detection is enabled.
|
|
458
|
+
*
|
|
459
|
+
* Content-based: hashes the ANSI-stripped buffer tail and only resets the
|
|
460
|
+
* timer when visible content actually changes. This prevents TUI spinners
|
|
461
|
+
* (which produce new ANSI sequences but no new visible text) from endlessly
|
|
462
|
+
* resetting the timer.
|
|
457
463
|
*/
|
|
458
464
|
private resetStallTimer;
|
|
459
465
|
/**
|
|
@@ -829,7 +835,7 @@ interface WorkerSessionHandle {
|
|
|
829
835
|
id: string;
|
|
830
836
|
name: string;
|
|
831
837
|
type: string;
|
|
832
|
-
status:
|
|
838
|
+
status: SessionStatus;
|
|
833
839
|
pid: number | undefined;
|
|
834
840
|
cols: number;
|
|
835
841
|
rows: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -422,6 +422,7 @@ declare class PTYSession extends EventEmitter {
|
|
|
422
422
|
private _stallDetectionEnabled;
|
|
423
423
|
private _lastStallHash;
|
|
424
424
|
private _stallStartedAt;
|
|
425
|
+
private _lastContentHash;
|
|
425
426
|
readonly id: string;
|
|
426
427
|
readonly config: SpawnConfig;
|
|
427
428
|
constructor(adapter: CLIAdapter, config: SpawnConfig, logger?: Logger, stallDetectionEnabled?: boolean, defaultStallTimeoutMs?: number);
|
|
@@ -454,6 +455,11 @@ declare class PTYSession extends EventEmitter {
|
|
|
454
455
|
/**
|
|
455
456
|
* Start or reset the stall detection timer.
|
|
456
457
|
* Active when status is "busy" or "authenticating" and stall detection is enabled.
|
|
458
|
+
*
|
|
459
|
+
* Content-based: hashes the ANSI-stripped buffer tail and only resets the
|
|
460
|
+
* timer when visible content actually changes. This prevents TUI spinners
|
|
461
|
+
* (which produce new ANSI sequences but no new visible text) from endlessly
|
|
462
|
+
* resetting the timer.
|
|
457
463
|
*/
|
|
458
464
|
private resetStallTimer;
|
|
459
465
|
/**
|
|
@@ -829,7 +835,7 @@ interface WorkerSessionHandle {
|
|
|
829
835
|
id: string;
|
|
830
836
|
name: string;
|
|
831
837
|
type: string;
|
|
832
|
-
status:
|
|
838
|
+
status: SessionStatus;
|
|
833
839
|
pid: number | undefined;
|
|
834
840
|
cols: number;
|
|
835
841
|
rows: number;
|
package/dist/index.js
CHANGED
|
@@ -331,6 +331,7 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
331
331
|
_stallDetectionEnabled;
|
|
332
332
|
_lastStallHash = null;
|
|
333
333
|
_stallStartedAt = null;
|
|
334
|
+
_lastContentHash = null;
|
|
334
335
|
id;
|
|
335
336
|
config;
|
|
336
337
|
get status() {
|
|
@@ -417,12 +418,28 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
417
418
|
/**
|
|
418
419
|
* Start or reset the stall detection timer.
|
|
419
420
|
* Active when status is "busy" or "authenticating" and stall detection is enabled.
|
|
421
|
+
*
|
|
422
|
+
* Content-based: hashes the ANSI-stripped buffer tail and only resets the
|
|
423
|
+
* timer when visible content actually changes. This prevents TUI spinners
|
|
424
|
+
* (which produce new ANSI sequences but no new visible text) from endlessly
|
|
425
|
+
* resetting the timer.
|
|
420
426
|
*/
|
|
421
427
|
resetStallTimer() {
|
|
422
|
-
this.clearStallTimer();
|
|
423
428
|
if (!this._stallDetectionEnabled || this._status !== "busy" && this._status !== "authenticating") {
|
|
429
|
+
this.clearStallTimer();
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
const tail = this.outputBuffer.slice(-500);
|
|
433
|
+
const stripped = this.stripAnsiForStall(tail);
|
|
434
|
+
const hash = this.simpleHash(stripped);
|
|
435
|
+
if (hash === this._lastContentHash) {
|
|
424
436
|
return;
|
|
425
437
|
}
|
|
438
|
+
this._lastContentHash = hash;
|
|
439
|
+
if (this._stallTimer) {
|
|
440
|
+
clearTimeout(this._stallTimer);
|
|
441
|
+
this._stallTimer = null;
|
|
442
|
+
}
|
|
426
443
|
this._stallStartedAt = Date.now();
|
|
427
444
|
this._lastStallHash = null;
|
|
428
445
|
this._stallTimer = setTimeout(() => {
|
|
@@ -438,6 +455,7 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
438
455
|
this._stallTimer = null;
|
|
439
456
|
}
|
|
440
457
|
this._stallStartedAt = null;
|
|
458
|
+
this._lastContentHash = null;
|
|
441
459
|
}
|
|
442
460
|
/**
|
|
443
461
|
* Called when the stall timer fires (no output for stallTimeoutMs).
|
|
@@ -498,6 +516,7 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
498
516
|
return;
|
|
499
517
|
}
|
|
500
518
|
if (!classification || classification.state === "still_working") {
|
|
519
|
+
this._lastContentHash = null;
|
|
501
520
|
this.resetStallTimer();
|
|
502
521
|
return;
|
|
503
522
|
}
|
|
@@ -1921,6 +1940,7 @@ var BunCompatiblePTYManager = class extends import_events3.EventEmitter {
|
|
|
1921
1940
|
case "login_required": {
|
|
1922
1941
|
const session = this.sessions.get(id);
|
|
1923
1942
|
if (session) {
|
|
1943
|
+
session.status = "authenticating";
|
|
1924
1944
|
this.emit("login_required", session, event.instructions, event.url);
|
|
1925
1945
|
}
|
|
1926
1946
|
break;
|