Guard swarm maintenance launches
This commit is contained in:
parent
4e091a6f45
commit
51025596f6
3 changed files with 34 additions and 1 deletions
|
|
@ -823,6 +823,14 @@ async function maybeStartRepoFaceMemoryMaintenance(input: {
|
|||
try {
|
||||
await mkdir(paths.statusDir, { recursive: true });
|
||||
await mkdir(paths.logDir, { recursive: true });
|
||||
const launchedAt = new Date();
|
||||
await writeJsonFile(paths.statusPath, {
|
||||
status: "starting",
|
||||
startedAt: launchedAt.toISOString(),
|
||||
stateFile: input.statePath,
|
||||
launcher: "repo_face_heartbeat",
|
||||
reason: input.projectedRest.isNapping ? "repo_face_napping_with_short_term_memory" : "repo_face_stale_short_term_memory",
|
||||
});
|
||||
const child = spawn(
|
||||
"powershell.exe",
|
||||
[
|
||||
|
|
@ -889,6 +897,11 @@ async function readJsonFile(path: string): Promise<Record<string, unknown> | und
|
|||
}
|
||||
}
|
||||
|
||||
async function writeJsonFile(path: string, value: unknown): Promise<void> {
|
||||
await mkdir(dirname(path), { recursive: true });
|
||||
await writeFile(path, `${JSON.stringify(value, null, 2)}\n`, "utf8");
|
||||
}
|
||||
|
||||
function isRecentRunningStatus(status: Record<string, unknown> | undefined, maxAgeMinutes: number): boolean {
|
||||
if (status?.status !== "running" && status?.status !== "running_skip_model" && status?.status !== "starting") {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue