/** * GC Daemon — Sidecar background process for autonomous transcript cleanup. * * Architecture (Pattern B from T751 §2.2): * - Spawned via `cleo daemon start` as a detached Node.js process * - All three required flags: `detached: true`, file stdio, `child.unref()` * - Persists across CLI invocations * - Crash recovery via `.cleo/gc-state.json` startup-check * - node-cron v4 for scheduling (zero runtime deps, cross-platform) * * R5 migration (T11256) * ---------------------- * The standalone cron loop that previously lived inside `bootstrapDaemon` has * been migrated to the `@cleocode/runtime` subsystem framework * (`gc-subsystem.ts`). `bootstrapDaemon` now delegates to * `createGcSubsystem(cleoDir).start()` so the same startup algorithm (crash * recovery → missed-run recovery → cron schedule) is expressed once, in the * `Subsystem` shape, and the standalone entry-point * (`daemon-entry.ts`) drives it through the uniform lifecycle. * * The spawn helpers (`spawnGCDaemon`, `stopGCDaemon`, `getGCDaemonStatus`) are * preserved unchanged — they are the parent-process-side interface and are * unaffected by the internal lifecycle migration. * * @see packages/core/src/gc/gc-subsystem.ts — subsystem adapter (R5-T1) * @see ADR-047 — Autonomous GC and Disk Safety * @see T751 §2.2 for sidecar daemon pattern rationale * @task T731 * @epic T726 */ /** * Bootstrap the GC daemon process. * * Delegates to `createGcSubsystem(cleoDir).start()` which performs crash * recovery, missed-run recovery, and schedules future GC runs — the * standalone cron loop no longer lives here (R5 migration, T11256). * * @param cleoDir - Absolute path to the `.cleo/` directory */ export declare function bootstrapDaemon(cleoDir: string): Promise; /** * Spawn the GC daemon as a detached background process. * * All three requirements from T751 §2.2 are met: * 1. `detached: true` — process group leader (survives parent exit) * 2. File stdio — stdout/stderr redirected to gc.log (not inherited) * 3. `child.unref()` — parent CLI exits immediately * * @param cleoDir - Absolute path to the `.cleo/` directory * @returns PID of the spawned daemon process */ export declare function spawnGCDaemon(cleoDir: string): Promise; /** * Stop the GC daemon by sending SIGTERM to its PID. * * Uses `process.kill(pid, 0)` as a no-throw liveness probe before signalling. * * @param cleoDir - Absolute path to the `.cleo/` directory * @returns `{ stopped: boolean; pid: number | null; reason: string }` */ export declare function stopGCDaemon(cleoDir: string): Promise<{ stopped: boolean; pid: number | null; reason: string; }>; /** * Check whether the GC daemon is currently running. * * @param cleoDir - Absolute path to the `.cleo/` directory * @returns `{ running: boolean; pid: number | null; startedAt: string | null }` */ export declare function getGCDaemonStatus(cleoDir: string): Promise<{ running: boolean; pid: number | null; startedAt: string | null; lastRunAt: string | null; lastDiskUsedPct: number | null; escalationNeeded: boolean; }>; //# sourceMappingURL=daemon.d.ts.map