@dmsdc-ai/aigentry-telepty 0.1.73 → 0.1.74
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/cli.js +4 -6
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -871,21 +871,19 @@ async function main() {
|
|
|
871
871
|
const isCr = msg.data === '\r';
|
|
872
872
|
if (isCr && injectQueue.length > 0) {
|
|
873
873
|
// CR with pending queued text — queue CR too and flush immediately.
|
|
874
|
-
// Prevents the busy-session bug where CR fires before queued text,
|
|
875
|
-
// causing empty submit followed by orphaned text without Return.
|
|
876
874
|
injectQueue.push(msg.data);
|
|
877
875
|
if (queueFlushTimer) { clearTimeout(queueFlushTimer); queueFlushTimer = null; }
|
|
878
876
|
flushInjectQueue();
|
|
879
|
-
} else if (isCr
|
|
880
|
-
// CR
|
|
877
|
+
} else if (isCr) {
|
|
878
|
+
// CR always written immediately — never idle-gated
|
|
881
879
|
child.write(msg.data);
|
|
882
|
-
} else if (
|
|
880
|
+
} else if (isIdle()) {
|
|
883
881
|
// Text when idle — write immediately
|
|
884
882
|
child.write(msg.data);
|
|
885
883
|
promptReady = false;
|
|
886
884
|
lastInjectTextTime = Date.now();
|
|
887
885
|
} else {
|
|
888
|
-
//
|
|
886
|
+
// Text when not idle — queue for safe delivery
|
|
889
887
|
injectQueue.push(msg.data);
|
|
890
888
|
scheduleIdleFlush();
|
|
891
889
|
}
|