Expand description
Opt-in operational webhook alerts.
A supervised loop polls runtime health every alerts.interval_secs and
POSTs a JSON alert to the configured webhook when a condition trips:
scheduler DLQ growth, provider down, token-budget exhaustion, or a
supervised-loop restart storm. Threshold/dedupe decisions live in pure
functions over snapshots so they are testable without a runtime; every
delivery attempt is recorded in the tamper-evident audit chain
(kind = "alert").
Structs§
- Alert
- Alert
Loop State - Mutable state carried between polls: the previous sample (deltas) and per-class last-sent times (cooldown).
- Health
Sample - One poll’s worth of health numbers, gathered from the shared sources.
Functions§
- budget_
refusal_ count - evaluate_
alerts - Pure alert policy: compare the current sample against the previous one and the per-class cooldowns. The first poll only establishes a baseline.
- note_
budget_ refusal - run_
alerts_ once - One poll: gather, evaluate, deliver. Extracted from the loop for testability; returns how many alerts were delivered (or attempted).
- spawn_
alerts - Spawn the supervised alerts loop; a no-op unless alerts are enabled with a webhook configured.