pty-manager 1.2.19 → 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/README.md +71 -1
- 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/pty-worker.js
CHANGED
|
@@ -298,6 +298,15 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
298
298
|
this.logger = logger || consoleLogger;
|
|
299
299
|
this._stallDetectionEnabled = stallDetectionEnabled ?? false;
|
|
300
300
|
this._stallTimeoutMs = config.stallTimeoutMs ?? defaultStallTimeoutMs ?? 8e3;
|
|
301
|
+
if (config.ruleOverrides) {
|
|
302
|
+
for (const [key, value] of Object.entries(config.ruleOverrides)) {
|
|
303
|
+
if (value === null) {
|
|
304
|
+
this._disabledRulePatterns.add(key);
|
|
305
|
+
} else {
|
|
306
|
+
this._ruleOverrides.set(key, value);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
301
310
|
}
|
|
302
311
|
ptyProcess = null;
|
|
303
312
|
outputBuffer = "";
|
|
@@ -309,6 +318,8 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
309
318
|
sessionRules = [];
|
|
310
319
|
_firedOnceRules = /* @__PURE__ */ new Set();
|
|
311
320
|
_lastBlockingPromptHash = null;
|
|
321
|
+
_ruleOverrides = /* @__PURE__ */ new Map();
|
|
322
|
+
_disabledRulePatterns = /* @__PURE__ */ new Set();
|
|
312
323
|
// Stall detection
|
|
313
324
|
_stallTimer = null;
|
|
314
325
|
_stallTimeoutMs;
|
|
@@ -531,6 +542,7 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
531
542
|
this.writeRaw(resp + "\r");
|
|
532
543
|
}
|
|
533
544
|
this.emit("blocking_prompt", promptInfo, true);
|
|
545
|
+
this.outputBuffer = "";
|
|
534
546
|
} else {
|
|
535
547
|
this.emit("blocking_prompt", promptInfo, false);
|
|
536
548
|
}
|
|
@@ -700,6 +712,7 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
700
712
|
this.writeRaw(resp + "\r");
|
|
701
713
|
}
|
|
702
714
|
this._lastBlockingPromptHash = null;
|
|
715
|
+
this.outputBuffer = "";
|
|
703
716
|
this.emit("blocking_prompt", promptInfo, true);
|
|
704
717
|
return true;
|
|
705
718
|
}
|
|
@@ -727,7 +740,10 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
727
740
|
* Session rules are checked first, then adapter rules.
|
|
728
741
|
*/
|
|
729
742
|
tryAutoResponse() {
|
|
730
|
-
const adapterRules = this.adapter.autoResponseRules || []
|
|
743
|
+
const adapterRules = (this.adapter.autoResponseRules || []).filter((r) => !this._disabledRulePatterns.has(r.pattern.source)).map((r) => {
|
|
744
|
+
const override = this._ruleOverrides.get(r.pattern.source);
|
|
745
|
+
return override ? { ...r, ...override } : r;
|
|
746
|
+
});
|
|
731
747
|
const allRules = [...this.sessionRules, ...adapterRules];
|
|
732
748
|
if (allRules.length === 0) {
|
|
733
749
|
return false;
|
package/package.json
CHANGED