import { type Cron, type CronRunRecord } from '../core/canvas/crons.js'; /** Output head caps for the run log (spec: "capped, e.g. 4KB"). */ export declare const CRON_OUTPUT_HEAD_BYTES: number; /** One id per daemon process instance — distinguishes THIS process's own * in-flight run leases from a stale 'running' row a prior (crashed/restarted) * daemon left behind. */ export declare const cronDaemonInstanceId: `${string}-${string}-${string}-${string}-${string}`; export interface RunDueCronOptions { /** Invoked synchronously the instant each settlement promise is created, so * the caller can register it for a graceful-teardown drain. */ register?: (work: Promise) => void; /** Broker-capacity admission for a run that will LAUNCH OR REVIVE a node * (`cronLaunchesNode`). Returns false when the live fleet is at the * automatic-revive cap; the daemon wires in its own `hasBrokerCapacity` * (crtrd.ts), which owns the fleet count and the throttled capacity event. * Absent → every run is admitted (out-of-band/test callers own no fleet). */ hasBrokerCapacity?: () => boolean; } /** Will this cron's run consume broker capacity? True when its armed sink * births a node, or its command invokes a node-launching crtr verb. A cron * that merely runs a shell command or sends a message reads false and is * never gated. */ export declare function cronLaunchesNode(c: Cron): boolean; /** Recover stale 'running' rows left by a PRIOR daemon instance: a pid that is * not VERIFIABLY still the process this lease launched resets straight to * idle; a confirmed-live process group past its own run_timeout_s is killed * and settled as a timeout run through the SAME failure path a live timeout * takes (pause + escalation unless silent). Rows this SAME instance owns are * genuinely in flight and left alone. * * The verification is `verifyLeasedCronRun`, not `isPidAlive`, and it is * FAIL-CLOSED: this row was written by a daemon life that has since ended, so * after a host reboot its `run_pid` names a slot in a dead kernel's pid space * that the OS has probably recycled, and the timeout comparison below is * trivially satisfied by any downtime. Liveness alone would therefore SIGTERM * a stranger's process group. Only a matching launch-time identity authorizes * the signal; everything else releases the lease. */ export declare function recoverStaleCronLeases(now: number, options?: RunDueCronOptions): void; /** Kick off ONE cron run and return its settlement promise, resolving with * the settled run record (null = the idle→running lease was lost, or the row * was quarantined — nothing was recorded by THIS call). The subprocess * starts synchronously (spawn + lease + recurrence advance happen before * this returns); the promise resolves only after the child has CLOSED and * every durable transition — disposition/delivery, run record, lease * release, one-shot consumption — is written. * * `outOfBand` (the `cron run` verb) takes the same lease but does NOT * advance a recurrence, does NOT consume a one-shot, and never * escalates/pauses — it delivers per disposition and hands the record back * to the invoker. */ export declare function executeCron(c: Cron, opts: { outOfBand: boolean; }): Promise; /** The daemon's cron pass: expire clock-bounded rows, apply overlap policies, * then kick off every due active idle cron. Each child starts synchronously * but is NEVER awaited in the tick; returns one settlement promise per * admitted run. * * A run that would launch or revive a node (`cronLaunchesNode`) is admitted * only while the fleet is under its automatic-revive cap. An unadmitted run is * DEFERRED, never consumed: nothing is recorded, no recurrence advances, no * one-shot is deleted, and no failure escalates — the row keeps its past-due * `fire_at` and is retried on the next poll once capacity frees up. */ export declare function runDueCrons(now: number, options?: RunDueCronOptions): Promise[];