import type { ChannelHeartbeatDeps } from "../channels/plugins/types.js"; import type { SKYKOIConfig } from "../config/config.js"; import type { KoiDefaultsConfig } from "../config/types.koi-defaults.js"; import type { OutboundSendDeps } from "./outbound/deliver.js"; import { type RuntimeEnv } from "../runtime.js"; import { type HeartbeatRunResult } from "./heartbeat-wake.js"; type HeartbeatDeps = OutboundSendDeps & ChannelHeartbeatDeps & { runtime?: RuntimeEnv; getQueueSize?: (lane?: string) => number; nowMs?: () => number; }; export declare function setHeartbeatsEnabled(enabled: boolean): void; type HeartbeatConfig = KoiDefaultsConfig["heartbeat"]; export type HeartbeatSummary = { enabled: boolean; every: string; everyMs: number | null; prompt: string; target: string; model?: string; ackMaxChars: number; }; export type HeartbeatRunner = { stop: () => void; updateConfig: (cfg: SKYKOIConfig) => void; }; /** Whether heartbeat is enabled for a specific koi (checks explicit config and default fallback). */ export declare function isHeartbeatEnabledForKoi(cfg: SKYKOIConfig, koiId?: string): boolean; /** * Builds a complete heartbeat summary for a koi, merging defaults with * per-koi overrides. Used by status/diagnostic endpoints. */ export declare function resolveHeartbeatSummaryForKoi(cfg: SKYKOIConfig, koiId?: string): HeartbeatSummary; /** Parses the heartbeat interval from config, returning milliseconds or null if disabled. */ export declare function resolveHeartbeatIntervalMs(cfg: SKYKOIConfig, overrideEvery?: string, heartbeat?: HeartbeatConfig): number | null; export declare function resolveHeartbeatPrompt(cfg: SKYKOIConfig, heartbeat?: HeartbeatConfig): string; /** * Runs a single heartbeat cycle for one koi: resolves the session, checks * active hours / queue depth / HEARTBEAT.md content, calls the LLM, normalizes * the reply, deduplicates, and delivers to the target channel. * * @param opts.cfg - Runtime config (defaults to `loadConfig()`) * @param opts.koiId - Koi to heartbeat (defaults to the default koi) * @param opts.heartbeat - Per-koi heartbeat config overrides * @param opts.reason - Why this heartbeat was triggered (e.g. "interval", "exec-event") * @returns Status indicating whether the heartbeat ran, was skipped, or failed */ export declare function runHeartbeatOnce(opts: { cfg?: SKYKOIConfig; koiId?: string; heartbeat?: HeartbeatConfig; reason?: string; deps?: HeartbeatDeps; }): Promise; /** * Creates and starts a heartbeat runner that schedules periodic heartbeats * for all configured kois. Responds to config reloads and manual wake * requests. * * @param opts.cfg - Initial config snapshot * @param opts.abortSignal - Signal to stop the runner and clean up timers * @returns Handle with `stop()` and `updateConfig()` methods */ export declare function startHeartbeatRunner(opts: { cfg?: SKYKOIConfig; runtime?: RuntimeEnv; abortSignal?: AbortSignal; runOnce?: typeof runHeartbeatOnce; }): HeartbeatRunner; export {};