open-agents-ai 0.138.10 → 0.138.11
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.js +44 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -52087,21 +52087,60 @@ var init_status_bar = __esm({
|
|
|
52087
52087
|
*
|
|
52088
52088
|
* Must be called after readline is created.
|
|
52089
52089
|
*/
|
|
52090
|
+
/**
|
|
52091
|
+
* Hook into readline to intercept scroll keys AND consume mouse escape
|
|
52092
|
+
* sequences so they don't leak as garbage text into the input area.
|
|
52093
|
+
*
|
|
52094
|
+
* Uses _ttyWrite monkey-patch — this is the ONLY reliable interception
|
|
52095
|
+
* point in Node.js because readline's internal input handler can't be
|
|
52096
|
+
* pre-empted by stream listeners (they're all observers).
|
|
52097
|
+
*
|
|
52098
|
+
* Mouse SGR sequences: \x1B[<N;X;YM / \x1B[<N;X;Ym
|
|
52099
|
+
* Readline splits these across multiple _ttyWrite calls, so we also
|
|
52100
|
+
* match partial fragments like ";25M" or "[<65;".
|
|
52101
|
+
*/
|
|
52090
52102
|
hookReadlineScroll(rl) {
|
|
52091
52103
|
if (!rl || !rl._ttyWrite)
|
|
52092
52104
|
return;
|
|
52093
|
-
const origTtyWrite = rl._ttyWrite.bind(rl);
|
|
52094
52105
|
const self = this;
|
|
52106
|
+
const origTtyWrite = rl._ttyWrite.bind(rl);
|
|
52107
|
+
let swallowingMouse = false;
|
|
52095
52108
|
rl._ttyWrite = function(s, key) {
|
|
52096
52109
|
if (!self.active)
|
|
52097
52110
|
return origTtyWrite(s, key);
|
|
52098
52111
|
const seq = s || "";
|
|
52099
|
-
|
|
52100
|
-
|
|
52112
|
+
const keySeq = key?.sequence || "";
|
|
52113
|
+
const fullMouse = /\x1B\[<(\d+);\d+;\d+[Mm]/.exec(seq) || /\x1B\[<(\d+);\d+;\d+[Mm]/.exec(keySeq);
|
|
52114
|
+
if (fullMouse) {
|
|
52115
|
+
const btn = parseInt(fullMouse[1]);
|
|
52116
|
+
if (btn === 64)
|
|
52117
|
+
self.scrollContentUp(3);
|
|
52118
|
+
else if (btn === 65)
|
|
52119
|
+
self.scrollContentDown(3);
|
|
52101
52120
|
return;
|
|
52102
52121
|
}
|
|
52103
|
-
if (seq.includes("[<
|
|
52104
|
-
|
|
52122
|
+
if (seq.includes("\x1B[<") || seq.includes("[<")) {
|
|
52123
|
+
swallowingMouse = true;
|
|
52124
|
+
if (/[Mm]/.test(seq.slice(seq.indexOf("<")))) {
|
|
52125
|
+
const match = /(\d+)/.exec(seq.slice(seq.indexOf("<") + 1));
|
|
52126
|
+
if (match) {
|
|
52127
|
+
const btn = parseInt(match[1]);
|
|
52128
|
+
if (btn === 64)
|
|
52129
|
+
self.scrollContentUp(3);
|
|
52130
|
+
else if (btn === 65)
|
|
52131
|
+
self.scrollContentDown(3);
|
|
52132
|
+
}
|
|
52133
|
+
swallowingMouse = false;
|
|
52134
|
+
}
|
|
52135
|
+
return;
|
|
52136
|
+
}
|
|
52137
|
+
if (swallowingMouse) {
|
|
52138
|
+
if (/[Mm]/.test(seq)) {
|
|
52139
|
+
swallowingMouse = false;
|
|
52140
|
+
}
|
|
52141
|
+
return;
|
|
52142
|
+
}
|
|
52143
|
+
if (/^\d+;\d+;\d*[Mm]?$/.test(seq) || /^;\d+[Mm]$/.test(seq)) {
|
|
52105
52144
|
return;
|
|
52106
52145
|
}
|
|
52107
52146
|
if (key?.name === "pageup" || seq === "\x1B[5~") {
|
|
@@ -52120,9 +52159,6 @@ var init_status_bar = __esm({
|
|
|
52120
52159
|
self.scrollContentDown(3);
|
|
52121
52160
|
return;
|
|
52122
52161
|
}
|
|
52123
|
-
if (seq.includes("[<")) {
|
|
52124
|
-
return;
|
|
52125
|
-
}
|
|
52126
52162
|
return origTtyWrite(s, key);
|
|
52127
52163
|
};
|
|
52128
52164
|
}
|
package/package.json
CHANGED