pty-manager 1.11.1 → 1.12.0
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 +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -7
- package/dist/index.mjs.map +1 -1
- package/dist/pty-worker.js +13 -8
- package/package.json +12 -13
package/dist/index.d.mts
CHANGED
|
@@ -419,7 +419,13 @@ interface PTYSessionEvents {
|
|
|
419
419
|
error: (error: Error) => void;
|
|
420
420
|
stall_detected: (recentOutput: string, stallDurationMs: number) => void;
|
|
421
421
|
status_changed: (status: SessionStatus) => void;
|
|
422
|
-
|
|
422
|
+
/**
|
|
423
|
+
* Fired when the agent's turn completes. `output` is the session's
|
|
424
|
+
* output buffer captured just before it is cleared for the next turn —
|
|
425
|
+
* consumers must use this payload rather than `getOutputBuffer()`,
|
|
426
|
+
* which is already empty by the time the event fires.
|
|
427
|
+
*/
|
|
428
|
+
task_complete: (output: string) => void;
|
|
423
429
|
tool_running: (info: ToolRunningInfo) => void;
|
|
424
430
|
}
|
|
425
431
|
/**
|
|
@@ -731,7 +737,12 @@ interface PTYManagerEvents {
|
|
|
731
737
|
question: (session: SessionHandle, question: string) => void;
|
|
732
738
|
stall_detected: (session: SessionHandle, recentOutput: string, stallDurationMs: number) => void;
|
|
733
739
|
session_status_changed: (session: SessionHandle) => void;
|
|
734
|
-
|
|
740
|
+
/**
|
|
741
|
+
* Fired when a session's turn completes. `output` is the turn's output
|
|
742
|
+
* buffer captured before the session cleared it — use it instead of
|
|
743
|
+
* `getSession(id).getOutputBuffer()`, which is already empty here.
|
|
744
|
+
*/
|
|
745
|
+
task_complete: (session: SessionHandle, output: string) => void;
|
|
735
746
|
tool_running: (session: SessionHandle, info: ToolRunningInfo) => void;
|
|
736
747
|
}
|
|
737
748
|
declare class PTYManager extends EventEmitter {
|
package/dist/index.d.ts
CHANGED
|
@@ -419,7 +419,13 @@ interface PTYSessionEvents {
|
|
|
419
419
|
error: (error: Error) => void;
|
|
420
420
|
stall_detected: (recentOutput: string, stallDurationMs: number) => void;
|
|
421
421
|
status_changed: (status: SessionStatus) => void;
|
|
422
|
-
|
|
422
|
+
/**
|
|
423
|
+
* Fired when the agent's turn completes. `output` is the session's
|
|
424
|
+
* output buffer captured just before it is cleared for the next turn —
|
|
425
|
+
* consumers must use this payload rather than `getOutputBuffer()`,
|
|
426
|
+
* which is already empty by the time the event fires.
|
|
427
|
+
*/
|
|
428
|
+
task_complete: (output: string) => void;
|
|
423
429
|
tool_running: (info: ToolRunningInfo) => void;
|
|
424
430
|
}
|
|
425
431
|
/**
|
|
@@ -731,7 +737,12 @@ interface PTYManagerEvents {
|
|
|
731
737
|
question: (session: SessionHandle, question: string) => void;
|
|
732
738
|
stall_detected: (session: SessionHandle, recentOutput: string, stallDurationMs: number) => void;
|
|
733
739
|
session_status_changed: (session: SessionHandle) => void;
|
|
734
|
-
|
|
740
|
+
/**
|
|
741
|
+
* Fired when a session's turn completes. `output` is the turn's output
|
|
742
|
+
* buffer captured before the session cleared it — use it instead of
|
|
743
|
+
* `getSession(id).getOutputBuffer()`, which is already empty here.
|
|
744
|
+
*/
|
|
745
|
+
task_complete: (session: SessionHandle, output: string) => void;
|
|
735
746
|
tool_running: (session: SessionHandle, info: ToolRunningInfo) => void;
|
|
736
747
|
}
|
|
737
748
|
declare class PTYManager extends EventEmitter {
|
package/dist/index.js
CHANGED
|
@@ -359,7 +359,7 @@ var BunCompatiblePTYManager = class extends import_node_events.EventEmitter {
|
|
|
359
359
|
if (session) {
|
|
360
360
|
session.status = "ready";
|
|
361
361
|
session.lastActivityAt = /* @__PURE__ */ new Date();
|
|
362
|
-
this.emit("task_complete", session);
|
|
362
|
+
this.emit("task_complete", session, event.output ?? "");
|
|
363
363
|
}
|
|
364
364
|
break;
|
|
365
365
|
}
|
|
@@ -1255,13 +1255,14 @@ var PTYSession = class _PTYSession extends import_node_events2.EventEmitter {
|
|
|
1255
1255
|
return;
|
|
1256
1256
|
}
|
|
1257
1257
|
if (this._status === "busy" && this.adapter.detectTaskComplete?.(this.outputBuffer)) {
|
|
1258
|
+
const turnOutput = this.outputBuffer;
|
|
1258
1259
|
this._status = "ready";
|
|
1259
1260
|
this._lastBlockingPromptHash = null;
|
|
1260
1261
|
this._lastBlockingPromptEmitAt = 0;
|
|
1261
1262
|
this.outputBuffer = "";
|
|
1262
1263
|
this.clearStallTimer();
|
|
1263
1264
|
this.emit("status_changed", "ready");
|
|
1264
|
-
this.emit("task_complete");
|
|
1265
|
+
this.emit("task_complete", turnOutput);
|
|
1265
1266
|
this.logger.info(
|
|
1266
1267
|
{ sessionId: this.id },
|
|
1267
1268
|
"Task complete (adapter fast-path) \u2014 agent returned to idle prompt"
|
|
@@ -1561,13 +1562,14 @@ var PTYSession = class _PTYSession extends import_node_events2.EventEmitter {
|
|
|
1561
1562
|
this.traceTaskCompletion("debounce_reject_signal", { signal });
|
|
1562
1563
|
return;
|
|
1563
1564
|
}
|
|
1565
|
+
const turnOutput = this.outputBuffer;
|
|
1564
1566
|
this._status = "ready";
|
|
1565
1567
|
this._lastBlockingPromptHash = null;
|
|
1566
1568
|
this._lastBlockingPromptEmitAt = 0;
|
|
1567
1569
|
this.outputBuffer = "";
|
|
1568
1570
|
this.clearStallTimer();
|
|
1569
1571
|
this.emit("status_changed", "ready");
|
|
1570
|
-
this.emit("task_complete");
|
|
1572
|
+
this.emit("task_complete", turnOutput);
|
|
1571
1573
|
this.traceTaskCompletion("transition_ready", { signal: true });
|
|
1572
1574
|
this.logger.info(
|
|
1573
1575
|
{ sessionId: this.id },
|
|
@@ -2228,19 +2230,21 @@ var PTYSession = class _PTYSession extends import_node_events2.EventEmitter {
|
|
|
2228
2230
|
this._lastActivityAt = /* @__PURE__ */ new Date();
|
|
2229
2231
|
this.resetStallTimer();
|
|
2230
2232
|
break;
|
|
2231
|
-
case "task_complete":
|
|
2233
|
+
case "task_complete": {
|
|
2234
|
+
const turnOutput = this.outputBuffer;
|
|
2232
2235
|
this._status = "ready";
|
|
2233
2236
|
this._lastBlockingPromptHash = null;
|
|
2234
2237
|
this._lastBlockingPromptEmitAt = 0;
|
|
2235
2238
|
this.outputBuffer = "";
|
|
2236
2239
|
this.clearStallTimer();
|
|
2237
2240
|
this.emit("status_changed", "ready");
|
|
2238
|
-
this.emit("task_complete");
|
|
2241
|
+
this.emit("task_complete", turnOutput);
|
|
2239
2242
|
this.logger.info(
|
|
2240
2243
|
{ sessionId: this.id, event },
|
|
2241
2244
|
"Hook event: task_complete \u2192 ready"
|
|
2242
2245
|
);
|
|
2243
2246
|
break;
|
|
2247
|
+
}
|
|
2244
2248
|
case "permission_approved":
|
|
2245
2249
|
this._lastActivityAt = /* @__PURE__ */ new Date();
|
|
2246
2250
|
this.outputBuffer = "";
|
|
@@ -2397,8 +2401,8 @@ var PTYManager = class extends import_node_events3.EventEmitter {
|
|
|
2397
2401
|
session.on("status_changed", () => {
|
|
2398
2402
|
this.emit("session_status_changed", session.toHandle());
|
|
2399
2403
|
});
|
|
2400
|
-
session.on("task_complete", () => {
|
|
2401
|
-
this.emit("task_complete", session.toHandle());
|
|
2404
|
+
session.on("task_complete", (output) => {
|
|
2405
|
+
this.emit("task_complete", session.toHandle(), output);
|
|
2402
2406
|
});
|
|
2403
2407
|
session.on("tool_running", (info) => {
|
|
2404
2408
|
this.emit("tool_running", session.toHandle(), info);
|