pty-manager 1.2.20 → 1.2.21
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 +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -1
- package/dist/index.mjs.map +1 -1
- package/dist/pty-worker.js +17 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -277,6 +277,15 @@ var PTYSession = class extends EventEmitter {
|
|
|
277
277
|
this.logger = logger || consoleLogger;
|
|
278
278
|
this._stallDetectionEnabled = stallDetectionEnabled ?? false;
|
|
279
279
|
this._stallTimeoutMs = config.stallTimeoutMs ?? defaultStallTimeoutMs ?? 8e3;
|
|
280
|
+
if (config.ruleOverrides) {
|
|
281
|
+
for (const [key, value] of Object.entries(config.ruleOverrides)) {
|
|
282
|
+
if (value === null) {
|
|
283
|
+
this._disabledRulePatterns.add(key);
|
|
284
|
+
} else {
|
|
285
|
+
this._ruleOverrides.set(key, value);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
280
289
|
}
|
|
281
290
|
ptyProcess = null;
|
|
282
291
|
outputBuffer = "";
|
|
@@ -288,6 +297,8 @@ var PTYSession = class extends EventEmitter {
|
|
|
288
297
|
sessionRules = [];
|
|
289
298
|
_firedOnceRules = /* @__PURE__ */ new Set();
|
|
290
299
|
_lastBlockingPromptHash = null;
|
|
300
|
+
_ruleOverrides = /* @__PURE__ */ new Map();
|
|
301
|
+
_disabledRulePatterns = /* @__PURE__ */ new Set();
|
|
291
302
|
// Stall detection
|
|
292
303
|
_stallTimer = null;
|
|
293
304
|
_stallTimeoutMs;
|
|
@@ -510,6 +521,7 @@ var PTYSession = class extends EventEmitter {
|
|
|
510
521
|
this.writeRaw(resp + "\r");
|
|
511
522
|
}
|
|
512
523
|
this.emit("blocking_prompt", promptInfo, true);
|
|
524
|
+
this.outputBuffer = "";
|
|
513
525
|
} else {
|
|
514
526
|
this.emit("blocking_prompt", promptInfo, false);
|
|
515
527
|
}
|
|
@@ -679,6 +691,7 @@ var PTYSession = class extends EventEmitter {
|
|
|
679
691
|
this.writeRaw(resp + "\r");
|
|
680
692
|
}
|
|
681
693
|
this._lastBlockingPromptHash = null;
|
|
694
|
+
this.outputBuffer = "";
|
|
682
695
|
this.emit("blocking_prompt", promptInfo, true);
|
|
683
696
|
return true;
|
|
684
697
|
}
|
|
@@ -706,7 +719,10 @@ var PTYSession = class extends EventEmitter {
|
|
|
706
719
|
* Session rules are checked first, then adapter rules.
|
|
707
720
|
*/
|
|
708
721
|
tryAutoResponse() {
|
|
709
|
-
const adapterRules = this.adapter.autoResponseRules || []
|
|
722
|
+
const adapterRules = (this.adapter.autoResponseRules || []).filter((r) => !this._disabledRulePatterns.has(r.pattern.source)).map((r) => {
|
|
723
|
+
const override = this._ruleOverrides.get(r.pattern.source);
|
|
724
|
+
return override ? { ...r, ...override } : r;
|
|
725
|
+
});
|
|
710
726
|
const allRules = [...this.sessionRules, ...adapterRules];
|
|
711
727
|
if (allRules.length === 0) {
|
|
712
728
|
return false;
|