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.
@@ -648,13 +648,14 @@ var PTYSession = class _PTYSession extends import_node_events.EventEmitter {
648
648
  return;
649
649
  }
650
650
  if (this._status === "busy" && this.adapter.detectTaskComplete?.(this.outputBuffer)) {
651
+ const turnOutput = this.outputBuffer;
651
652
  this._status = "ready";
652
653
  this._lastBlockingPromptHash = null;
653
654
  this._lastBlockingPromptEmitAt = 0;
654
655
  this.outputBuffer = "";
655
656
  this.clearStallTimer();
656
657
  this.emit("status_changed", "ready");
657
- this.emit("task_complete");
658
+ this.emit("task_complete", turnOutput);
658
659
  this.logger.info(
659
660
  { sessionId: this.id },
660
661
  "Task complete (adapter fast-path) \u2014 agent returned to idle prompt"
@@ -954,13 +955,14 @@ var PTYSession = class _PTYSession extends import_node_events.EventEmitter {
954
955
  this.traceTaskCompletion("debounce_reject_signal", { signal });
955
956
  return;
956
957
  }
958
+ const turnOutput = this.outputBuffer;
957
959
  this._status = "ready";
958
960
  this._lastBlockingPromptHash = null;
959
961
  this._lastBlockingPromptEmitAt = 0;
960
962
  this.outputBuffer = "";
961
963
  this.clearStallTimer();
962
964
  this.emit("status_changed", "ready");
963
- this.emit("task_complete");
965
+ this.emit("task_complete", turnOutput);
964
966
  this.traceTaskCompletion("transition_ready", { signal: true });
965
967
  this.logger.info(
966
968
  { sessionId: this.id },
@@ -1621,19 +1623,21 @@ var PTYSession = class _PTYSession extends import_node_events.EventEmitter {
1621
1623
  this._lastActivityAt = /* @__PURE__ */ new Date();
1622
1624
  this.resetStallTimer();
1623
1625
  break;
1624
- case "task_complete":
1626
+ case "task_complete": {
1627
+ const turnOutput = this.outputBuffer;
1625
1628
  this._status = "ready";
1626
1629
  this._lastBlockingPromptHash = null;
1627
1630
  this._lastBlockingPromptEmitAt = 0;
1628
1631
  this.outputBuffer = "";
1629
1632
  this.clearStallTimer();
1630
1633
  this.emit("status_changed", "ready");
1631
- this.emit("task_complete");
1634
+ this.emit("task_complete", turnOutput);
1632
1635
  this.logger.info(
1633
1636
  { sessionId: this.id, event },
1634
1637
  "Hook event: task_complete \u2192 ready"
1635
1638
  );
1636
1639
  break;
1640
+ }
1637
1641
  case "permission_approved":
1638
1642
  this._lastActivityAt = /* @__PURE__ */ new Date();
1639
1643
  this.outputBuffer = "";
@@ -1790,8 +1794,8 @@ var PTYManager = class extends import_node_events2.EventEmitter {
1790
1794
  session.on("status_changed", () => {
1791
1795
  this.emit("session_status_changed", session.toHandle());
1792
1796
  });
1793
- session.on("task_complete", () => {
1794
- this.emit("task_complete", session.toHandle());
1797
+ session.on("task_complete", (output) => {
1798
+ this.emit("task_complete", session.toHandle(), output);
1795
1799
  });
1796
1800
  session.on("tool_running", (info) => {
1797
1801
  this.emit("tool_running", session.toHandle(), info);
@@ -2176,10 +2180,11 @@ manager.on("session_status_changed", (handle) => {
2176
2180
  status: handle.status
2177
2181
  });
2178
2182
  });
2179
- manager.on("task_complete", (handle) => {
2183
+ manager.on("task_complete", (handle, output) => {
2180
2184
  emit({
2181
2185
  event: "task_complete",
2182
- id: handle.id
2186
+ id: handle.id,
2187
+ output
2183
2188
  });
2184
2189
  });
2185
2190
  manager.on("tool_running", (handle, info) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pty-manager",
3
- "version": "1.11.1",
3
+ "version": "1.12.0",
4
4
  "description": "PTY session manager with lifecycle management, pluggable adapters, and blocking prompt detection",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -23,17 +23,6 @@
23
23
  "README.md",
24
24
  "LICENSE"
25
25
  ],
26
- "scripts": {
27
- "build": "tsup",
28
- "dev": "tsup --watch",
29
- "test": "vitest",
30
- "test:run": "vitest run",
31
- "test:coverage": "vitest --coverage",
32
- "test:integration": "tsx test-integration.ts",
33
- "type-check": "tsc --noEmit",
34
- "clean": "rm -rf dist",
35
- "prepublishOnly": "pnpm run build"
36
- },
37
26
  "keywords": [
38
27
  "pty",
39
28
  "terminal",
@@ -71,5 +60,15 @@
71
60
  },
72
61
  "engines": {
73
62
  "node": ">=18"
63
+ },
64
+ "scripts": {
65
+ "build": "tsup",
66
+ "dev": "tsup --watch",
67
+ "test": "vitest",
68
+ "test:run": "vitest run",
69
+ "test:coverage": "vitest --coverage",
70
+ "test:integration": "tsx test-integration.ts",
71
+ "type-check": "tsc --noEmit",
72
+ "clean": "rm -rf dist"
74
73
  }
75
- }
74
+ }