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.
package/dist/index.mjs CHANGED
@@ -468,6 +468,19 @@ var PTYSession = class _PTYSession extends EventEmitter {
468
468
  if (this._status !== "busy" && this._status !== "authenticating") {
469
469
  return;
470
470
  }
471
+ if (this._status === "busy" && this.adapter.detectTaskComplete?.(this.outputBuffer)) {
472
+ this._status = "ready";
473
+ this._lastBlockingPromptHash = null;
474
+ this.outputBuffer = "";
475
+ this.clearStallTimer();
476
+ this.emit("status_changed", "ready");
477
+ this.emit("task_complete");
478
+ this.logger.info(
479
+ { sessionId: this.id },
480
+ "Task complete (adapter fast-path) \u2014 agent returned to idle prompt"
481
+ );
482
+ return;
483
+ }
471
484
  if (this.adapter.detectLoading?.(this.outputBuffer)) {
472
485
  this.logger.debug(
473
486
  { sessionId: this.id },
@@ -483,19 +496,6 @@ var PTYSession = class _PTYSession extends EventEmitter {
483
496
  return;
484
497
  }
485
498
  this._lastStallHash = hash;
486
- if (this._status === "busy" && this.adapter.detectTaskComplete?.(this.outputBuffer)) {
487
- this._status = "ready";
488
- this._lastBlockingPromptHash = null;
489
- this.outputBuffer = "";
490
- this.clearStallTimer();
491
- this.emit("status_changed", "ready");
492
- this.emit("task_complete");
493
- this.logger.info(
494
- { sessionId: this.id },
495
- "Task complete (adapter fast-path) \u2014 agent returned to idle prompt"
496
- );
497
- return;
498
- }
499
499
  this._stallEmissionCount++;
500
500
  if (this._stallEmissionCount > _PTYSession.MAX_STALL_EMISSIONS) {
501
501
  this.logger.warn(
@@ -1164,6 +1164,7 @@ var PTYSession = class _PTYSession extends EventEmitter {
1164
1164
  this._status = "busy";
1165
1165
  this.outputBuffer = "";
1166
1166
  this.emit("status_changed", "busy");
1167
+ this._stallEmissionCount = 0;
1167
1168
  this.resetStallTimer();
1168
1169
  const msg = {
1169
1170
  id: `${this.id}-msg-${++this.messageCounter}`,
@@ -1201,6 +1202,8 @@ var PTYSession = class _PTYSession extends EventEmitter {
1201
1202
  throw new Error("Session not started");
1202
1203
  }
1203
1204
  const keyList = Array.isArray(keys) ? keys : [keys];
1205
+ this._stallEmissionCount = 0;
1206
+ this.resetStallTimer();
1204
1207
  for (const key of keyList) {
1205
1208
  const normalizedKey = key.toLowerCase().trim();
1206
1209
  const sequence = SPECIAL_KEYS[normalizedKey];