pty-manager 1.6.2 → 1.6.3
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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -1
- package/dist/index.mjs.map +1 -1
- package/dist/pty-worker.js +15 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -460,6 +460,8 @@ declare class PTYSession extends EventEmitter {
|
|
|
460
460
|
private _lastContentHash;
|
|
461
461
|
private _stallBackoffMs;
|
|
462
462
|
private static readonly MAX_STALL_BACKOFF_MS;
|
|
463
|
+
private _stallEmissionCount;
|
|
464
|
+
private static readonly MAX_STALL_EMISSIONS;
|
|
463
465
|
private _taskCompleteTimer;
|
|
464
466
|
private _taskCompletePending;
|
|
465
467
|
private static readonly TASK_COMPLETE_DEBOUNCE_MS;
|
package/dist/index.d.ts
CHANGED
|
@@ -460,6 +460,8 @@ declare class PTYSession extends EventEmitter {
|
|
|
460
460
|
private _lastContentHash;
|
|
461
461
|
private _stallBackoffMs;
|
|
462
462
|
private static readonly MAX_STALL_BACKOFF_MS;
|
|
463
|
+
private _stallEmissionCount;
|
|
464
|
+
private static readonly MAX_STALL_EMISSIONS;
|
|
463
465
|
private _taskCompleteTimer;
|
|
464
466
|
private _taskCompletePending;
|
|
465
467
|
private static readonly TASK_COMPLETE_DEBOUNCE_MS;
|
package/dist/index.js
CHANGED
|
@@ -348,6 +348,8 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
348
348
|
_stallBackoffMs = 0;
|
|
349
349
|
// Initialized in constructor from _stallTimeoutMs
|
|
350
350
|
static MAX_STALL_BACKOFF_MS = 3e4;
|
|
351
|
+
_stallEmissionCount = 0;
|
|
352
|
+
static MAX_STALL_EMISSIONS = 5;
|
|
351
353
|
// Task completion detection (idle detection when busy)
|
|
352
354
|
_taskCompleteTimer = null;
|
|
353
355
|
_taskCompletePending = false;
|
|
@@ -465,6 +467,7 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
465
467
|
return;
|
|
466
468
|
}
|
|
467
469
|
this._lastContentHash = hash;
|
|
470
|
+
this._stallEmissionCount = 0;
|
|
468
471
|
if (this._stallTimer) {
|
|
469
472
|
clearTimeout(this._stallTimer);
|
|
470
473
|
this._stallTimer = null;
|
|
@@ -487,6 +490,7 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
487
490
|
this._stallStartedAt = null;
|
|
488
491
|
this._lastContentHash = null;
|
|
489
492
|
this._stallBackoffMs = this._stallTimeoutMs;
|
|
493
|
+
this._stallEmissionCount = 0;
|
|
490
494
|
}
|
|
491
495
|
/**
|
|
492
496
|
* Called when the stall timer fires (no output for stallTimeoutMs).
|
|
@@ -523,6 +527,15 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
523
527
|
);
|
|
524
528
|
return;
|
|
525
529
|
}
|
|
530
|
+
this._stallEmissionCount++;
|
|
531
|
+
if (this._stallEmissionCount > _PTYSession.MAX_STALL_EMISSIONS) {
|
|
532
|
+
this.logger.warn(
|
|
533
|
+
{ sessionId: this.id, count: this._stallEmissionCount },
|
|
534
|
+
"Max stall emissions reached \u2014 suspending stall detection for this task"
|
|
535
|
+
);
|
|
536
|
+
this.clearStallTimer();
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
526
539
|
const recentRaw = this.outputBuffer.slice(-2e3);
|
|
527
540
|
const recentOutput = this.stripAnsiForStall(recentRaw);
|
|
528
541
|
const stallDurationMs = this._stallStartedAt ? Date.now() - this._stallStartedAt : this._stallTimeoutMs;
|
|
@@ -562,6 +575,8 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
562
575
|
let result = str.replace(/\x1b\[\d*[CDABGdEF]/g, " ");
|
|
563
576
|
result = result.replace(/\x1b\[\d*(?:;\d+)?[Hf]/g, " ");
|
|
564
577
|
result = result.replace(/\x1b\[\d*[JK]/g, " ");
|
|
578
|
+
result = result.replace(/\x1b\](?:[^\x07\x1b]|\x1b[^\\])*(?:\x07|\x1b\\)/g, "");
|
|
579
|
+
result = result.replace(/\x1bP(?:[^\x1b]|\x1b[^\\])*\x1b\\/g, "");
|
|
565
580
|
result = result.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
|
|
566
581
|
result = result.replace(/[\x00-\x08\x0b-\x1f\x7f]/g, "");
|
|
567
582
|
result = result.replace(/\xa0/g, " ");
|
|
@@ -1799,7 +1814,9 @@ var BaseCLIAdapter = class {
|
|
|
1799
1814
|
*/
|
|
1800
1815
|
stripAnsi(str) {
|
|
1801
1816
|
const withSpaces = str.replace(/\x1b\[\d*C/g, " ");
|
|
1802
|
-
|
|
1817
|
+
const withoutOsc = withSpaces.replace(/\x1b\](?:[^\x07\x1b]|\x1b[^\\])*(?:\x07|\x1b\\)/g, "");
|
|
1818
|
+
const withoutDcs = withoutOsc.replace(/\x1bP(?:[^\x1b]|\x1b[^\\])*\x1b\\/g, "");
|
|
1819
|
+
return withoutDcs.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
|
|
1803
1820
|
}
|
|
1804
1821
|
};
|
|
1805
1822
|
|