mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-18 08:31:49 -06:00
cb50289e28
* fix(agents): keep removed processes live until exit * test(agents): isolate process registry lifecycle coverage * chore(plugin-sdk): refresh API closure baseline
22 lines
800 B
TypeScript
22 lines
800 B
TypeScript
// Shared control seam for task-ledger and process-tool cancellation.
|
|
import { getProcessSupervisor } from "../process/supervisor/index.js";
|
|
import { getSession, hasActiveBackgroundExecSession } from "./bash-process-registry.js";
|
|
|
|
export function isBackgroundExecSessionActive(sessionId: string): boolean {
|
|
return hasActiveBackgroundExecSession(sessionId);
|
|
}
|
|
|
|
export function cancelBackgroundExecSession(sessionId: string): boolean {
|
|
const session = getSession(sessionId);
|
|
if (!session?.backgrounded || session.exited || session.finalizing) {
|
|
return false;
|
|
}
|
|
const supervisor = getProcessSupervisor();
|
|
const record = supervisor.getRecord(sessionId);
|
|
if (!record || record.state === "exited") {
|
|
return false;
|
|
}
|
|
supervisor.cancel(sessionId, "manual-cancel");
|
|
return true;
|
|
}
|