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/pty-worker.js
CHANGED
|
@@ -333,6 +333,7 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
333
333
|
static MAX_STALL_BACKOFF_MS = 3e4;
|
|
334
334
|
// Task completion detection (idle detection when busy)
|
|
335
335
|
_taskCompleteTimer = null;
|
|
336
|
+
_taskCompletePending = false;
|
|
336
337
|
static TASK_COMPLETE_DEBOUNCE_MS = 1500;
|
|
337
338
|
// Ready detection settle delay — defers session_ready until output goes quiet
|
|
338
339
|
_readySettleTimer = null;
|
|
@@ -545,7 +546,8 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
545
546
|
result = result.replace(/\x1b\[\d*(?:;\d+)?[Hf]/g, " ");
|
|
546
547
|
result = result.replace(/\x1b\[\d*[JK]/g, " ");
|
|
547
548
|
result = result.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
|
|
548
|
-
result = result.replace(/[\x00-\x08\x0b
|
|
549
|
+
result = result.replace(/[\x00-\x08\x0b-\x1f\x7f]/g, "");
|
|
550
|
+
result = result.replace(/\xa0/g, " ");
|
|
549
551
|
result = result.replace(/[│╭╰╮╯─═╌║╔╗╚╝╠╣╦╩╬┌┐└┘├┤┬┴┼●○❯❮▶◀⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⣾⣽⣻⢿⡿⣟⣯⣷✻✶✳✢⏺←→↑↓⬆⬇◆◇▪▫■□▲△▼▽◈⟨⟩⌘⏎⏏⌫⌦⇧⇪⌥]/g, " ");
|
|
550
552
|
result = result.replace(/\d+[hms](?:\s+\d+[hms])*/g, "0s");
|
|
551
553
|
result = result.replace(/ {2,}/g, " ");
|
|
@@ -622,13 +624,21 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
622
624
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
623
625
|
/**
|
|
624
626
|
* Schedule a task_complete transition after a debounce period.
|
|
625
|
-
*
|
|
626
|
-
*
|
|
627
|
+
* Uses a settle pattern: each call resets the debounce timer instead of
|
|
628
|
+
* being a no-op when already scheduled. This allows TUI agents that
|
|
629
|
+
* continue rendering decorative output (status bar, update notices) after
|
|
630
|
+
* the prompt to eventually settle, rather than having the timer cancelled
|
|
631
|
+
* by every new data chunk. The callback re-verifies detectReady() before
|
|
632
|
+
* transitioning, so stale triggers are safe.
|
|
627
633
|
*/
|
|
628
634
|
scheduleTaskComplete() {
|
|
629
|
-
if (this._taskCompleteTimer)
|
|
635
|
+
if (this._taskCompleteTimer) {
|
|
636
|
+
clearTimeout(this._taskCompleteTimer);
|
|
637
|
+
}
|
|
638
|
+
this._taskCompletePending = true;
|
|
630
639
|
this._taskCompleteTimer = setTimeout(() => {
|
|
631
640
|
this._taskCompleteTimer = null;
|
|
641
|
+
this._taskCompletePending = false;
|
|
632
642
|
if (this._status !== "busy") return;
|
|
633
643
|
if (!this.adapter.detectReady(this.outputBuffer)) return;
|
|
634
644
|
this._status = "ready";
|
|
@@ -649,6 +659,7 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
649
659
|
clearTimeout(this._taskCompleteTimer);
|
|
650
660
|
this._taskCompleteTimer = null;
|
|
651
661
|
}
|
|
662
|
+
this._taskCompletePending = false;
|
|
652
663
|
}
|
|
653
664
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
654
665
|
// Ready Detection Settle Delay
|
|
@@ -790,10 +801,10 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
790
801
|
this.scheduleReadySettle();
|
|
791
802
|
return;
|
|
792
803
|
}
|
|
793
|
-
if (this._status === "busy"
|
|
794
|
-
this.
|
|
795
|
-
|
|
796
|
-
|
|
804
|
+
if (this._status === "busy") {
|
|
805
|
+
if (this._taskCompletePending || this.adapter.detectReady(this.outputBuffer)) {
|
|
806
|
+
this.scheduleTaskComplete();
|
|
807
|
+
}
|
|
797
808
|
}
|
|
798
809
|
const blockingPrompt = this.detectAndHandleBlockingPrompt();
|
|
799
810
|
if (blockingPrompt) {
|
|
@@ -1011,6 +1022,7 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
1011
1022
|
*/
|
|
1012
1023
|
send(message) {
|
|
1013
1024
|
this._status = "busy";
|
|
1025
|
+
this.outputBuffer = "";
|
|
1014
1026
|
this.emit("status_changed", "busy");
|
|
1015
1027
|
this.resetStallTimer();
|
|
1016
1028
|
const msg = {
|
package/package.json
CHANGED