/** * Scheduler initialization for MAMA OS. * * Extracted from cli/commands/start.ts to keep the orchestrator thin. * All logic and function signatures are unchanged. * * Responsibilities: * initCronScheduler: * 1. Creates CronWorker + EventEmitter (for gateway routing) * 2. Creates CronScheduler and wires executeCallback to CronWorker * 3. Loads cron jobs from config.scheduling.jobs * * initHeartbeat: * 1. Creates HeartbeatScheduler (interval, quiet hours, Discord notify) * 2. Wires scheduler + heartbeat into HealthCheckService * 3. Starts periodic health-warning interval (every 5 minutes) * 4. Creates TokenKeepAlive and starts it */ import { EventEmitter } from 'node:events'; import type { MAMAConfig } from '../config/types.js'; import { CronScheduler, CronWorker, TokenKeepAlive } from '../../scheduler/index.js'; import { HeartbeatScheduler } from '../../scheduler/heartbeat.js'; import { DiscordGateway } from '../../gateways/index.js'; import type { AgentLoop } from '../../agent/index.js'; import type { HealthCheckService } from '../../observability/health-check.js'; /** * Result returned by initCronScheduler. */ export interface CronSchedulerResult { scheduler: CronScheduler; cronWorker: CronWorker; cronEmitter: EventEmitter; } /** * Result returned by initHeartbeat. */ export interface HeartbeatResult { heartbeatScheduler: HeartbeatScheduler; tokenKeepAlive: TokenKeepAlive; healthWarningInterval: ReturnType | null; } /** * Initialize cron scheduler with a dedicated CronWorker and EventEmitter. * * Creates the scheduler, wires the execute callback to CronWorker, * and loads cron jobs from config.scheduling.jobs. */ export declare function initCronScheduler(config: MAMAConfig): CronSchedulerResult; /** * Initialize heartbeat scheduler, health warning interval, and token keep-alive. * * Wires the heartbeat and cron scheduler into HealthCheckService, * starts a periodic health-warning log every 5 minutes, * and starts the OAuth token keep-alive timer. */ export declare function initHeartbeat(config: MAMAConfig, agentLoop: AgentLoop, discordGateway: DiscordGateway | null, scheduler: CronScheduler, healthCheckService: HealthCheckService): HeartbeatResult; //# sourceMappingURL=scheduler-init.d.ts.map