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