pty-manager 1.6.5 → 1.6.7
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 +3 -4
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -7
- package/dist/index.mjs.map +1 -1
- package/dist/pty-worker.js +8 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -217,7 +217,7 @@ interface SpawnConfig {
|
|
|
217
217
|
timeout?: number; // Session timeout in ms
|
|
218
218
|
readySettleMs?: number; // Override adapter's ready settle delay
|
|
219
219
|
stallTimeoutMs?: number; // Override manager stall timeout for this session
|
|
220
|
-
traceTaskCompletion?: boolean; // Verbose completion trace logs (
|
|
220
|
+
traceTaskCompletion?: boolean; // Verbose completion trace logs (off by default)
|
|
221
221
|
}
|
|
222
222
|
```
|
|
223
223
|
|
|
@@ -498,14 +498,13 @@ If the fast-path timer doesn't fire (e.g. the prompt indicator disappears from t
|
|
|
498
498
|
- `debounce_reject_signal`
|
|
499
499
|
- `transition_ready`
|
|
500
500
|
|
|
501
|
-
|
|
501
|
+
Tracing is off by default. Enable per session:
|
|
502
502
|
|
|
503
503
|
```typescript
|
|
504
504
|
const handle = await manager.spawn({
|
|
505
505
|
name: 'agent',
|
|
506
506
|
type: 'claude',
|
|
507
|
-
traceTaskCompletion: true,
|
|
508
|
-
// traceTaskCompletion: false, // force off
|
|
507
|
+
traceTaskCompletion: true,
|
|
509
508
|
});
|
|
510
509
|
```
|
|
511
510
|
|
package/dist/index.d.mts
CHANGED
|
@@ -41,7 +41,7 @@ interface SpawnConfig {
|
|
|
41
41
|
* Ms of output silence after detectReady match before emitting session_ready. */
|
|
42
42
|
readySettleMs?: number;
|
|
43
43
|
/** Enable verbose task-completion trace logs.
|
|
44
|
-
*
|
|
44
|
+
* Disabled by default; set true to enable. */
|
|
45
45
|
traceTaskCompletion?: boolean;
|
|
46
46
|
/** Override or disable specific adapter auto-response rules for this session.
|
|
47
47
|
* Keys are regex source strings (from rule.pattern.source).
|
|
@@ -563,7 +563,7 @@ declare class PTYSession extends EventEmitter {
|
|
|
563
563
|
private isTaskCompleteSignal;
|
|
564
564
|
/**
|
|
565
565
|
* Claude-oriented task completion traces for PTY debugging.
|
|
566
|
-
*
|
|
566
|
+
* Disabled by default; enable via config.traceTaskCompletion.
|
|
567
567
|
*/
|
|
568
568
|
private traceTaskCompletion;
|
|
569
569
|
private shouldTraceTaskCompletion;
|
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ interface SpawnConfig {
|
|
|
41
41
|
* Ms of output silence after detectReady match before emitting session_ready. */
|
|
42
42
|
readySettleMs?: number;
|
|
43
43
|
/** Enable verbose task-completion trace logs.
|
|
44
|
-
*
|
|
44
|
+
* Disabled by default; set true to enable. */
|
|
45
45
|
traceTaskCompletion?: boolean;
|
|
46
46
|
/** Override or disable specific adapter auto-response rules for this session.
|
|
47
47
|
* Keys are regex source strings (from rule.pattern.source).
|
|
@@ -563,7 +563,7 @@ declare class PTYSession extends EventEmitter {
|
|
|
563
563
|
private isTaskCompleteSignal;
|
|
564
564
|
/**
|
|
565
565
|
* Claude-oriented task completion traces for PTY debugging.
|
|
566
|
-
*
|
|
566
|
+
* Disabled by default; enable via config.traceTaskCompletion.
|
|
567
567
|
*/
|
|
568
568
|
private traceTaskCompletion;
|
|
569
569
|
private shouldTraceTaskCompletion;
|
package/dist/index.js
CHANGED
|
@@ -97,6 +97,7 @@ var AdapterRegistry = class {
|
|
|
97
97
|
|
|
98
98
|
// src/pty-session.ts
|
|
99
99
|
var import_events = require("events");
|
|
100
|
+
var import_crypto = require("crypto");
|
|
100
101
|
var ptyCache = null;
|
|
101
102
|
function loadPty() {
|
|
102
103
|
if (!ptyCache) {
|
|
@@ -141,7 +142,7 @@ var consoleLogger = {
|
|
|
141
142
|
}
|
|
142
143
|
};
|
|
143
144
|
function generateId() {
|
|
144
|
-
return `pty-${Date.now()}-${
|
|
145
|
+
return `pty-${Date.now()}-${(0, import_crypto.randomUUID)().slice(0, 8)}`;
|
|
145
146
|
}
|
|
146
147
|
var SPECIAL_KEYS = {
|
|
147
148
|
// Control keys (Ctrl+letter = ASCII control code)
|
|
@@ -735,7 +736,7 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
735
736
|
}
|
|
736
737
|
/**
|
|
737
738
|
* Claude-oriented task completion traces for PTY debugging.
|
|
738
|
-
*
|
|
739
|
+
* Disabled by default; enable via config.traceTaskCompletion.
|
|
739
740
|
*/
|
|
740
741
|
traceTaskCompletion(event, ctx = {}) {
|
|
741
742
|
if (!this.shouldTraceTaskCompletion()) return;
|
|
@@ -764,10 +765,7 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
764
765
|
);
|
|
765
766
|
}
|
|
766
767
|
shouldTraceTaskCompletion() {
|
|
767
|
-
|
|
768
|
-
return this.config.traceTaskCompletion;
|
|
769
|
-
}
|
|
770
|
-
return this.adapter.adapterType === "claude";
|
|
768
|
+
return this.config.traceTaskCompletion === true;
|
|
771
769
|
}
|
|
772
770
|
/**
|
|
773
771
|
* Cancel a pending task_complete timer (new output arrived that
|
|
@@ -1002,6 +1000,7 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
|
|
|
1002
1000
|
}
|
|
1003
1001
|
if (detection.type === "login") {
|
|
1004
1002
|
this._status = "authenticating";
|
|
1003
|
+
this.emit("login_required", detection.instructions, detection.url);
|
|
1005
1004
|
}
|
|
1006
1005
|
this.logger.warn(
|
|
1007
1006
|
{
|
|
@@ -1420,7 +1419,8 @@ var PTYManager = class extends import_events2.EventEmitter {
|
|
|
1420
1419
|
const handle = session.toHandle();
|
|
1421
1420
|
this.emit("stall_detected", handle, recentOutput, stallDurationMs);
|
|
1422
1421
|
if (this._onStallClassify) {
|
|
1423
|
-
|
|
1422
|
+
const sanitized = recentOutput.slice(-1500).replace(/\b(ignore|disregard|forget)\s+(all\s+)?(previous|above|prior)\s+(instructions?|prompts?|rules?)\b/gi, "[REDACTED]").replace(/\b(you\s+are|act\s+as|pretend\s+to\s+be|you\s+must|system\s*:)\b/gi, "[REDACTED]");
|
|
1423
|
+
this._onStallClassify(session.id, sanitized, stallDurationMs).then((classification) => {
|
|
1424
1424
|
session.handleStallClassification(classification);
|
|
1425
1425
|
}).catch((err) => {
|
|
1426
1426
|
this.logger.error(
|
|
@@ -1449,6 +1449,7 @@ var PTYManager = class extends import_events2.EventEmitter {
|
|
|
1449
1449
|
}, timeout);
|
|
1450
1450
|
session.once("exit", () => {
|
|
1451
1451
|
clearTimeout(timer);
|
|
1452
|
+
session.removeAllListeners();
|
|
1452
1453
|
this.sessions.delete(sessionId);
|
|
1453
1454
|
this.outputLogs.delete(sessionId);
|
|
1454
1455
|
resolve();
|