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.mjs CHANGED
@@ -318,7 +318,7 @@ var BunCompatiblePTYManager = class extends EventEmitter {
318
318
  if (session) {
319
319
  session.status = "ready";
320
320
  session.lastActivityAt = /* @__PURE__ */ new Date();
321
- this.emit("task_complete", session);
321
+ this.emit("task_complete", session, event.output ?? "");
322
322
  }
323
323
  break;
324
324
  }
@@ -1214,13 +1214,14 @@ var PTYSession = class _PTYSession extends EventEmitter2 {
1214
1214
  return;
1215
1215
  }
1216
1216
  if (this._status === "busy" && this.adapter.detectTaskComplete?.(this.outputBuffer)) {
1217
+ const turnOutput = this.outputBuffer;
1217
1218
  this._status = "ready";
1218
1219
  this._lastBlockingPromptHash = null;
1219
1220
  this._lastBlockingPromptEmitAt = 0;
1220
1221
  this.outputBuffer = "";
1221
1222
  this.clearStallTimer();
1222
1223
  this.emit("status_changed", "ready");
1223
- this.emit("task_complete");
1224
+ this.emit("task_complete", turnOutput);
1224
1225
  this.logger.info(
1225
1226
  { sessionId: this.id },
1226
1227
  "Task complete (adapter fast-path) \u2014 agent returned to idle prompt"
@@ -1520,13 +1521,14 @@ var PTYSession = class _PTYSession extends EventEmitter2 {
1520
1521
  this.traceTaskCompletion("debounce_reject_signal", { signal });
1521
1522
  return;
1522
1523
  }
1524
+ const turnOutput = this.outputBuffer;
1523
1525
  this._status = "ready";
1524
1526
  this._lastBlockingPromptHash = null;
1525
1527
  this._lastBlockingPromptEmitAt = 0;
1526
1528
  this.outputBuffer = "";
1527
1529
  this.clearStallTimer();
1528
1530
  this.emit("status_changed", "ready");
1529
- this.emit("task_complete");
1531
+ this.emit("task_complete", turnOutput);
1530
1532
  this.traceTaskCompletion("transition_ready", { signal: true });
1531
1533
  this.logger.info(
1532
1534
  { sessionId: this.id },
@@ -2187,19 +2189,21 @@ var PTYSession = class _PTYSession extends EventEmitter2 {
2187
2189
  this._lastActivityAt = /* @__PURE__ */ new Date();
2188
2190
  this.resetStallTimer();
2189
2191
  break;
2190
- case "task_complete":
2192
+ case "task_complete": {
2193
+ const turnOutput = this.outputBuffer;
2191
2194
  this._status = "ready";
2192
2195
  this._lastBlockingPromptHash = null;
2193
2196
  this._lastBlockingPromptEmitAt = 0;
2194
2197
  this.outputBuffer = "";
2195
2198
  this.clearStallTimer();
2196
2199
  this.emit("status_changed", "ready");
2197
- this.emit("task_complete");
2200
+ this.emit("task_complete", turnOutput);
2198
2201
  this.logger.info(
2199
2202
  { sessionId: this.id, event },
2200
2203
  "Hook event: task_complete \u2192 ready"
2201
2204
  );
2202
2205
  break;
2206
+ }
2203
2207
  case "permission_approved":
2204
2208
  this._lastActivityAt = /* @__PURE__ */ new Date();
2205
2209
  this.outputBuffer = "";
@@ -2356,8 +2360,8 @@ var PTYManager = class extends EventEmitter3 {
2356
2360
  session.on("status_changed", () => {
2357
2361
  this.emit("session_status_changed", session.toHandle());
2358
2362
  });
2359
- session.on("task_complete", () => {
2360
- this.emit("task_complete", session.toHandle());
2363
+ session.on("task_complete", (output) => {
2364
+ this.emit("task_complete", session.toHandle(), output);
2361
2365
  });
2362
2366
  session.on("tool_running", (info) => {
2363
2367
  this.emit("tool_running", session.toHandle(), info);