pty-manager 1.6.0 → 1.6.2
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/README.md +8 -4
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -8
- package/dist/index.mjs.map +1 -1
- package/dist/pty-worker.js +20 -8
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -312,6 +312,7 @@ var PTYSession = class _PTYSession extends EventEmitter {
|
|
|
312
312
|
static MAX_STALL_BACKOFF_MS = 3e4;
|
|
313
313
|
// Task completion detection (idle detection when busy)
|
|
314
314
|
_taskCompleteTimer = null;
|
|
315
|
+
_taskCompletePending = false;
|
|
315
316
|
static TASK_COMPLETE_DEBOUNCE_MS = 1500;
|
|
316
317
|
// Ready detection settle delay — defers session_ready until output goes quiet
|
|
317
318
|
_readySettleTimer = null;
|
|
@@ -524,7 +525,8 @@ var PTYSession = class _PTYSession extends EventEmitter {
|
|
|
524
525
|
result = result.replace(/\x1b\[\d*(?:;\d+)?[Hf]/g, " ");
|
|
525
526
|
result = result.replace(/\x1b\[\d*[JK]/g, " ");
|
|
526
527
|
result = result.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
|
|
527
|
-
result = result.replace(/[\x00-\x08\x0b
|
|
528
|
+
result = result.replace(/[\x00-\x08\x0b-\x1f\x7f]/g, "");
|
|
529
|
+
result = result.replace(/\xa0/g, " ");
|
|
528
530
|
result = result.replace(/[│╭╰╮╯─═╌║╔╗╚╝╠╣╦╩╬┌┐└┘├┤┬┴┼●○❯❮▶◀⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⣾⣽⣻⢿⡿⣟⣯⣷✻✶✳✢⏺←→↑↓⬆⬇◆◇▪▫■□▲△▼▽◈⟨⟩⌘⏎⏏⌫⌦⇧⇪⌥]/g, " ");
|
|
529
531
|
result = result.replace(/\d+[hms](?:\s+\d+[hms])*/g, "0s");
|
|
530
532
|
result = result.replace(/ {2,}/g, " ");
|
|
@@ -601,13 +603,21 @@ var PTYSession = class _PTYSession extends EventEmitter {
|
|
|
601
603
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
602
604
|
/**
|
|
603
605
|
* Schedule a task_complete transition after a debounce period.
|
|
604
|
-
*
|
|
605
|
-
*
|
|
606
|
+
* Uses a settle pattern: each call resets the debounce timer instead of
|
|
607
|
+
* being a no-op when already scheduled. This allows TUI agents that
|
|
608
|
+
* continue rendering decorative output (status bar, update notices) after
|
|
609
|
+
* the prompt to eventually settle, rather than having the timer cancelled
|
|
610
|
+
* by every new data chunk. The callback re-verifies detectReady() before
|
|
611
|
+
* transitioning, so stale triggers are safe.
|
|
606
612
|
*/
|
|
607
613
|
scheduleTaskComplete() {
|
|
608
|
-
if (this._taskCompleteTimer)
|
|
614
|
+
if (this._taskCompleteTimer) {
|
|
615
|
+
clearTimeout(this._taskCompleteTimer);
|
|
616
|
+
}
|
|
617
|
+
this._taskCompletePending = true;
|
|
609
618
|
this._taskCompleteTimer = setTimeout(() => {
|
|
610
619
|
this._taskCompleteTimer = null;
|
|
620
|
+
this._taskCompletePending = false;
|
|
611
621
|
if (this._status !== "busy") return;
|
|
612
622
|
if (!this.adapter.detectReady(this.outputBuffer)) return;
|
|
613
623
|
this._status = "ready";
|
|
@@ -628,6 +638,7 @@ var PTYSession = class _PTYSession extends EventEmitter {
|
|
|
628
638
|
clearTimeout(this._taskCompleteTimer);
|
|
629
639
|
this._taskCompleteTimer = null;
|
|
630
640
|
}
|
|
641
|
+
this._taskCompletePending = false;
|
|
631
642
|
}
|
|
632
643
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
633
644
|
// Ready Detection Settle Delay
|
|
@@ -769,10 +780,10 @@ var PTYSession = class _PTYSession extends EventEmitter {
|
|
|
769
780
|
this.scheduleReadySettle();
|
|
770
781
|
return;
|
|
771
782
|
}
|
|
772
|
-
if (this._status === "busy"
|
|
773
|
-
this.
|
|
774
|
-
|
|
775
|
-
|
|
783
|
+
if (this._status === "busy") {
|
|
784
|
+
if (this._taskCompletePending || this.adapter.detectReady(this.outputBuffer)) {
|
|
785
|
+
this.scheduleTaskComplete();
|
|
786
|
+
}
|
|
776
787
|
}
|
|
777
788
|
const blockingPrompt = this.detectAndHandleBlockingPrompt();
|
|
778
789
|
if (blockingPrompt) {
|
|
@@ -990,6 +1001,7 @@ var PTYSession = class _PTYSession extends EventEmitter {
|
|
|
990
1001
|
*/
|
|
991
1002
|
send(message) {
|
|
992
1003
|
this._status = "busy";
|
|
1004
|
+
this.outputBuffer = "";
|
|
993
1005
|
this.emit("status_changed", "busy");
|
|
994
1006
|
this.resetStallTimer();
|
|
995
1007
|
const msg = {
|