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.d.mts
CHANGED
|
@@ -37,6 +37,11 @@ interface SpawnConfig {
|
|
|
37
37
|
adapterConfig?: Record<string, unknown>;
|
|
38
38
|
/** Per-session stall timeout in ms. Overrides PTYManagerConfig.stallTimeoutMs. */
|
|
39
39
|
stallTimeoutMs?: number;
|
|
40
|
+
/** Override or disable specific adapter auto-response rules for this session.
|
|
41
|
+
* Keys are regex source strings (from rule.pattern.source).
|
|
42
|
+
* - null value disables that rule entirely
|
|
43
|
+
* - Object value merges fields into the matching adapter rule */
|
|
44
|
+
ruleOverrides?: Record<string, Partial<Omit<AutoResponseRule, 'pattern'>> | null>;
|
|
40
45
|
}
|
|
41
46
|
/**
|
|
42
47
|
* Handle to a running session
|
|
@@ -420,6 +425,8 @@ declare class PTYSession extends EventEmitter {
|
|
|
420
425
|
private sessionRules;
|
|
421
426
|
private _firedOnceRules;
|
|
422
427
|
private _lastBlockingPromptHash;
|
|
428
|
+
private _ruleOverrides;
|
|
429
|
+
private _disabledRulePatterns;
|
|
423
430
|
private _stallTimer;
|
|
424
431
|
private _stallTimeoutMs;
|
|
425
432
|
private _stallDetectionEnabled;
|
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,11 @@ interface SpawnConfig {
|
|
|
37
37
|
adapterConfig?: Record<string, unknown>;
|
|
38
38
|
/** Per-session stall timeout in ms. Overrides PTYManagerConfig.stallTimeoutMs. */
|
|
39
39
|
stallTimeoutMs?: number;
|
|
40
|
+
/** Override or disable specific adapter auto-response rules for this session.
|
|
41
|
+
* Keys are regex source strings (from rule.pattern.source).
|
|
42
|
+
* - null value disables that rule entirely
|
|
43
|
+
* - Object value merges fields into the matching adapter rule */
|
|
44
|
+
ruleOverrides?: Record<string, Partial<Omit<AutoResponseRule, 'pattern'>> | null>;
|
|
40
45
|
}
|
|
41
46
|
/**
|
|
42
47
|
* Handle to a running session
|
|
@@ -420,6 +425,8 @@ declare class PTYSession extends EventEmitter {
|
|
|
420
425
|
private sessionRules;
|
|
421
426
|
private _firedOnceRules;
|
|
422
427
|
private _lastBlockingPromptHash;
|
|
428
|
+
private _ruleOverrides;
|
|
429
|
+
private _disabledRulePatterns;
|
|
423
430
|
private _stallTimer;
|
|
424
431
|
private _stallTimeoutMs;
|
|
425
432
|
private _stallDetectionEnabled;
|
package/dist/index.js
CHANGED
|
@@ -315,6 +315,15 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
315
315
|
this.logger = logger || consoleLogger;
|
|
316
316
|
this._stallDetectionEnabled = stallDetectionEnabled ?? false;
|
|
317
317
|
this._stallTimeoutMs = config.stallTimeoutMs ?? defaultStallTimeoutMs ?? 8e3;
|
|
318
|
+
if (config.ruleOverrides) {
|
|
319
|
+
for (const [key, value] of Object.entries(config.ruleOverrides)) {
|
|
320
|
+
if (value === null) {
|
|
321
|
+
this._disabledRulePatterns.add(key);
|
|
322
|
+
} else {
|
|
323
|
+
this._ruleOverrides.set(key, value);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
318
327
|
}
|
|
319
328
|
ptyProcess = null;
|
|
320
329
|
outputBuffer = "";
|
|
@@ -326,6 +335,8 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
326
335
|
sessionRules = [];
|
|
327
336
|
_firedOnceRules = /* @__PURE__ */ new Set();
|
|
328
337
|
_lastBlockingPromptHash = null;
|
|
338
|
+
_ruleOverrides = /* @__PURE__ */ new Map();
|
|
339
|
+
_disabledRulePatterns = /* @__PURE__ */ new Set();
|
|
329
340
|
// Stall detection
|
|
330
341
|
_stallTimer = null;
|
|
331
342
|
_stallTimeoutMs;
|
|
@@ -548,6 +559,7 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
548
559
|
this.writeRaw(resp + "\r");
|
|
549
560
|
}
|
|
550
561
|
this.emit("blocking_prompt", promptInfo, true);
|
|
562
|
+
this.outputBuffer = "";
|
|
551
563
|
} else {
|
|
552
564
|
this.emit("blocking_prompt", promptInfo, false);
|
|
553
565
|
}
|
|
@@ -717,6 +729,7 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
717
729
|
this.writeRaw(resp + "\r");
|
|
718
730
|
}
|
|
719
731
|
this._lastBlockingPromptHash = null;
|
|
732
|
+
this.outputBuffer = "";
|
|
720
733
|
this.emit("blocking_prompt", promptInfo, true);
|
|
721
734
|
return true;
|
|
722
735
|
}
|
|
@@ -744,7 +757,10 @@ var PTYSession = class extends import_events.EventEmitter {
|
|
|
744
757
|
* Session rules are checked first, then adapter rules.
|
|
745
758
|
*/
|
|
746
759
|
tryAutoResponse() {
|
|
747
|
-
const adapterRules = this.adapter.autoResponseRules || []
|
|
760
|
+
const adapterRules = (this.adapter.autoResponseRules || []).filter((r) => !this._disabledRulePatterns.has(r.pattern.source)).map((r) => {
|
|
761
|
+
const override = this._ruleOverrides.get(r.pattern.source);
|
|
762
|
+
return override ? { ...r, ...override } : r;
|
|
763
|
+
});
|
|
748
764
|
const allRules = [...this.sessionRules, ...adapterRules];
|
|
749
765
|
if (allRules.length === 0) {
|
|
750
766
|
return false;
|