pty-manager 1.2.22 → 1.3.1
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/README.md +36 -2
- package/dist/index.d.mts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -0
- package/dist/index.mjs.map +1 -1
- package/dist/pty-worker.js +14 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -448,6 +448,19 @@ var PTYSession = class _PTYSession extends EventEmitter {
|
|
|
448
448
|
return;
|
|
449
449
|
}
|
|
450
450
|
this._lastStallHash = hash;
|
|
451
|
+
if (this._status === "busy" && this.adapter.detectTaskComplete?.(this.outputBuffer)) {
|
|
452
|
+
this._status = "ready";
|
|
453
|
+
this._lastBlockingPromptHash = null;
|
|
454
|
+
this.outputBuffer = "";
|
|
455
|
+
this.clearStallTimer();
|
|
456
|
+
this.emit("status_changed", "ready");
|
|
457
|
+
this.emit("task_complete");
|
|
458
|
+
this.logger.info(
|
|
459
|
+
{ sessionId: this.id },
|
|
460
|
+
"Task complete (adapter fast-path) \u2014 agent returned to idle prompt"
|
|
461
|
+
);
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
451
464
|
const recentRaw = this.outputBuffer.slice(-2e3);
|
|
452
465
|
const recentOutput = this.stripAnsiForStall(recentRaw);
|
|
453
466
|
const stallDurationMs = this._stallStartedAt ? Date.now() - this._stallStartedAt : this._stallTimeoutMs;
|
|
@@ -490,6 +503,7 @@ var PTYSession = class _PTYSession extends EventEmitter {
|
|
|
490
503
|
result = result.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
|
|
491
504
|
result = result.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, "");
|
|
492
505
|
result = result.replace(/[│╭╰╮╯─═╌║╔╗╚╝╠╣╦╩╬┌┐└┘├┤┬┴┼●○❯❮▶◀⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⣾⣽⣻⢿⡿⣟⣯⣷✻✶✳✢⏺←→↑↓⬆⬇◆◇▪▫■□▲△▼▽◈⟨⟩⌘⏎⏏⌫⌦⇧⇪⌥]/g, " ");
|
|
506
|
+
result = result.replace(/\d+[hms](?:\s+\d+[hms])*/g, "0s");
|
|
493
507
|
result = result.replace(/ {2,}/g, " ");
|
|
494
508
|
return result;
|
|
495
509
|
}
|
|
@@ -1556,6 +1570,14 @@ var BaseCLIAdapter = class {
|
|
|
1556
1570
|
}
|
|
1557
1571
|
return { detected: false };
|
|
1558
1572
|
}
|
|
1573
|
+
/**
|
|
1574
|
+
* Default task completion detection — delegates to detectReady().
|
|
1575
|
+
* Subclasses should override to match high-confidence completion patterns
|
|
1576
|
+
* (e.g. duration summaries) that short-circuit the LLM stall classifier.
|
|
1577
|
+
*/
|
|
1578
|
+
detectTaskComplete(output) {
|
|
1579
|
+
return this.detectReady(output);
|
|
1580
|
+
}
|
|
1559
1581
|
/**
|
|
1560
1582
|
* Default input formatting - just return as-is
|
|
1561
1583
|
*/
|