pty-manager 1.7.0 → 1.7.2

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.
@@ -489,6 +489,19 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
489
489
  if (this._status !== "busy" && this._status !== "authenticating") {
490
490
  return;
491
491
  }
492
+ if (this._status === "busy" && this.adapter.detectTaskComplete?.(this.outputBuffer)) {
493
+ this._status = "ready";
494
+ this._lastBlockingPromptHash = null;
495
+ this.outputBuffer = "";
496
+ this.clearStallTimer();
497
+ this.emit("status_changed", "ready");
498
+ this.emit("task_complete");
499
+ this.logger.info(
500
+ { sessionId: this.id },
501
+ "Task complete (adapter fast-path) \u2014 agent returned to idle prompt"
502
+ );
503
+ return;
504
+ }
492
505
  if (this.adapter.detectLoading?.(this.outputBuffer)) {
493
506
  this.logger.debug(
494
507
  { sessionId: this.id },
@@ -504,19 +517,6 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
504
517
  return;
505
518
  }
506
519
  this._lastStallHash = hash;
507
- if (this._status === "busy" && this.adapter.detectTaskComplete?.(this.outputBuffer)) {
508
- this._status = "ready";
509
- this._lastBlockingPromptHash = null;
510
- this.outputBuffer = "";
511
- this.clearStallTimer();
512
- this.emit("status_changed", "ready");
513
- this.emit("task_complete");
514
- this.logger.info(
515
- { sessionId: this.id },
516
- "Task complete (adapter fast-path) \u2014 agent returned to idle prompt"
517
- );
518
- return;
519
- }
520
520
  this._stallEmissionCount++;
521
521
  if (this._stallEmissionCount > _PTYSession.MAX_STALL_EMISSIONS) {
522
522
  this.logger.warn(
@@ -1185,6 +1185,7 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
1185
1185
  this._status = "busy";
1186
1186
  this.outputBuffer = "";
1187
1187
  this.emit("status_changed", "busy");
1188
+ this._stallEmissionCount = 0;
1188
1189
  this.resetStallTimer();
1189
1190
  const msg = {
1190
1191
  id: `${this.id}-msg-${++this.messageCounter}`,
@@ -1222,6 +1223,8 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
1222
1223
  throw new Error("Session not started");
1223
1224
  }
1224
1225
  const keyList = Array.isArray(keys) ? keys : [keys];
1226
+ this._stallEmissionCount = 0;
1227
+ this.resetStallTimer();
1225
1228
  for (const key of keyList) {
1226
1229
  const normalizedKey = key.toLowerCase().trim();
1227
1230
  const sequence = SPECIAL_KEYS[normalizedKey];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pty-manager",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
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",