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.js CHANGED
@@ -508,6 +508,19 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
508
508
  if (this._status !== "busy" && this._status !== "authenticating") {
509
509
  return;
510
510
  }
511
+ if (this._status === "busy" && this.adapter.detectTaskComplete?.(this.outputBuffer)) {
512
+ this._status = "ready";
513
+ this._lastBlockingPromptHash = null;
514
+ this.outputBuffer = "";
515
+ this.clearStallTimer();
516
+ this.emit("status_changed", "ready");
517
+ this.emit("task_complete");
518
+ this.logger.info(
519
+ { sessionId: this.id },
520
+ "Task complete (adapter fast-path) \u2014 agent returned to idle prompt"
521
+ );
522
+ return;
523
+ }
511
524
  if (this.adapter.detectLoading?.(this.outputBuffer)) {
512
525
  this.logger.debug(
513
526
  { sessionId: this.id },
@@ -523,19 +536,6 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
523
536
  return;
524
537
  }
525
538
  this._lastStallHash = hash;
526
- if (this._status === "busy" && this.adapter.detectTaskComplete?.(this.outputBuffer)) {
527
- this._status = "ready";
528
- this._lastBlockingPromptHash = null;
529
- this.outputBuffer = "";
530
- this.clearStallTimer();
531
- this.emit("status_changed", "ready");
532
- this.emit("task_complete");
533
- this.logger.info(
534
- { sessionId: this.id },
535
- "Task complete (adapter fast-path) \u2014 agent returned to idle prompt"
536
- );
537
- return;
538
- }
539
539
  this._stallEmissionCount++;
540
540
  if (this._stallEmissionCount > _PTYSession.MAX_STALL_EMISSIONS) {
541
541
  this.logger.warn(
@@ -1204,6 +1204,7 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
1204
1204
  this._status = "busy";
1205
1205
  this.outputBuffer = "";
1206
1206
  this.emit("status_changed", "busy");
1207
+ this._stallEmissionCount = 0;
1207
1208
  this.resetStallTimer();
1208
1209
  const msg = {
1209
1210
  id: `${this.id}-msg-${++this.messageCounter}`,
@@ -1241,6 +1242,8 @@ var PTYSession = class _PTYSession extends import_events.EventEmitter {
1241
1242
  throw new Error("Session not started");
1242
1243
  }
1243
1244
  const keyList = Array.isArray(keys) ? keys : [keys];
1245
+ this._stallEmissionCount = 0;
1246
+ this.resetStallTimer();
1244
1247
  for (const key of keyList) {
1245
1248
  const normalizedKey = key.toLowerCase().trim();
1246
1249
  const sequence = SPECIAL_KEYS[normalizedKey];