mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-16 19:51:11 +00:00
27 lines
858 B
TypeScript
27 lines
858 B
TypeScript
import { getLatestSubagentRunByChildSessionKey } from "../agents/subagent-registry-read.js";
|
|
|
|
async function loadSessionSubagentReactivationRuntime() {
|
|
return import("./session-subagent-reactivation.runtime.js");
|
|
}
|
|
|
|
export async function reactivateCompletedSubagentSession(params: {
|
|
sessionKey: string;
|
|
runId?: string;
|
|
}): Promise<boolean> {
|
|
const runId = params.runId?.trim();
|
|
if (!runId) {
|
|
return false;
|
|
}
|
|
const existing = getLatestSubagentRunByChildSessionKey(params.sessionKey);
|
|
if (!existing || typeof existing.endedAt !== "number") {
|
|
return false;
|
|
}
|
|
const { replaceSubagentRunAfterSteer } = await loadSessionSubagentReactivationRuntime();
|
|
return replaceSubagentRunAfterSteer({
|
|
previousRunId: existing.runId,
|
|
nextRunId: runId,
|
|
fallback: existing,
|
|
runTimeoutSeconds: existing.runTimeoutSeconds ?? 0,
|
|
});
|
|
}
|