pty-manager 1.10.2 → 1.11.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.
- package/dist/index.d.mts +39 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -0
- package/dist/index.mjs.map +1 -1
- package/dist/pty-worker.js +48 -0
- package/package.json +1 -1
package/dist/pty-worker.js
CHANGED
|
@@ -967,6 +967,20 @@ var PTYSession = class _PTYSession extends import_node_events.EventEmitter {
|
|
|
967
967
|
);
|
|
968
968
|
}, _PTYSession.TASK_COMPLETE_DEBOUNCE_MS);
|
|
969
969
|
}
|
|
970
|
+
/**
|
|
971
|
+
* Whether the adapter's `detectLoading()` currently classifies the
|
|
972
|
+
* session as actively processing work.
|
|
973
|
+
*
|
|
974
|
+
* This wraps `adapter.detectLoading(outputBuffer)` for consumers outside
|
|
975
|
+
* the PTY layer (e.g. milady's swarm idle watchdog) that need a
|
|
976
|
+
* reliable "is the agent busy right now?" signal without reimplementing
|
|
977
|
+
* heuristics over raw terminal output.
|
|
978
|
+
*
|
|
979
|
+
* Returns `false` if the adapter does not implement `detectLoading`.
|
|
980
|
+
*/
|
|
981
|
+
isLoading() {
|
|
982
|
+
return this.adapter.detectLoading?.(this.outputBuffer) ?? false;
|
|
983
|
+
}
|
|
970
984
|
/**
|
|
971
985
|
* Adapter-level task completion check with compatibility fallback.
|
|
972
986
|
* Prefer detectTaskComplete() because detectReady() may be broad for TUIs.
|
|
@@ -1983,6 +1997,20 @@ var PTYManager = class extends import_node_events2.EventEmitter {
|
|
|
1983
1997
|
getSession(sessionId) {
|
|
1984
1998
|
return this.sessions.get(sessionId);
|
|
1985
1999
|
}
|
|
2000
|
+
/**
|
|
2001
|
+
* Whether the adapter currently classifies the session as actively
|
|
2002
|
+
* processing work (e.g. Codex's "esc to interrupt" status row).
|
|
2003
|
+
*
|
|
2004
|
+
* Orchestrators (like milady's swarm idle watchdog) should consult
|
|
2005
|
+
* this before assuming a session is idle based on output byte diffs,
|
|
2006
|
+
* which are fooled by TUIs that redraw the same status row in place.
|
|
2007
|
+
*
|
|
2008
|
+
* Returns `false` for unknown sessions or adapters that don't
|
|
2009
|
+
* implement `detectLoading`.
|
|
2010
|
+
*/
|
|
2011
|
+
isSessionLoading(sessionId) {
|
|
2012
|
+
return this.sessions.get(sessionId)?.isLoading() ?? false;
|
|
2013
|
+
}
|
|
1986
2014
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
1987
2015
|
// Stall Detection Configuration
|
|
1988
2016
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -2269,6 +2297,19 @@ async function handleKill(id, signal) {
|
|
|
2269
2297
|
ack("kill", id, false, err instanceof Error ? err.message : String(err));
|
|
2270
2298
|
}
|
|
2271
2299
|
}
|
|
2300
|
+
function handleIsSessionLoading(id) {
|
|
2301
|
+
try {
|
|
2302
|
+
const loading = manager.isSessionLoading(id);
|
|
2303
|
+
emit({ event: "isSessionLoading", id, loading });
|
|
2304
|
+
} catch (err) {
|
|
2305
|
+
emit({
|
|
2306
|
+
event: "isSessionLoading",
|
|
2307
|
+
id,
|
|
2308
|
+
loading: false,
|
|
2309
|
+
error: err instanceof Error ? err.message : String(err)
|
|
2310
|
+
});
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2272
2313
|
function handleList() {
|
|
2273
2314
|
const sessions = manager.list();
|
|
2274
2315
|
const sessionList = sessions.map((s) => ({
|
|
@@ -2544,6 +2585,13 @@ function processCommand(line) {
|
|
|
2544
2585
|
case "list":
|
|
2545
2586
|
handleList();
|
|
2546
2587
|
break;
|
|
2588
|
+
case "isSessionLoading":
|
|
2589
|
+
if (!command.id) {
|
|
2590
|
+
ack("isSessionLoading", command.id, false, "Missing id");
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
handleIsSessionLoading(command.id);
|
|
2594
|
+
break;
|
|
2547
2595
|
case "shutdown":
|
|
2548
2596
|
handleShutdown();
|
|
2549
2597
|
break;
|
package/package.json
CHANGED