import type { LTWorkflowConfig, LTAgent, AgentSchedule } from '../../types'; import type { LTYamlWorkflowRecord } from '../../types/yaml-workflow'; /** * Validate a cron expression and enforce a minimum interval. * Throws if the expression is invalid or fires more often than once per minute. */ export declare function validateCronSchedule(expr: string): void; /** * Singleton registry for workflow cron schedules. * * Follows the same pattern as maintenanceRegistry: * - connect() — load configs with cron_schedule, start Virtual.cron for each * - disconnect() — interrupt all crons * - restartCron() — stop + start a single cron after config change * - clear() — reset for tests */ declare class LTCronRegistry { private activeCrons; private connected; private systemPrincipal; /** * Load all workflow configs with a cron_schedule and start Virtual.cron for each. * Call after workers and migrations are ready. */ connect(): Promise; /** * Start a single Virtual.cron for a workflow config. */ startCron(config: LTWorkflowConfig): Promise; /** * Stop a single cron for a workflow type. */ stopCron(workflowType: string): Promise; /** * Restart a cron after a config change. * Stops the old cron (if any) and starts a new one if cron_schedule is set. */ restartCron(config: LTWorkflowConfig): Promise; /** * Load all YAML workflows with a cron_schedule and start Virtual.cron for each. */ connectYamlCrons(): Promise; /** * Start a single Virtual.cron for a YAML workflow. */ startYamlCron(wf: LTYamlWorkflowRecord): Promise; /** * Stop a single YAML workflow cron. */ stopYamlCron(yamlWfId: string): Promise; /** * Restart a YAML workflow cron after config change. */ restartYamlCron(wf: LTYamlWorkflowRecord): Promise; /** * Start a single agent schedule cron. */ startAgentCron(agent: LTAgent, schedule: AgentSchedule, idx: number): Promise; /** * Stop all cron schedules for an agent. */ stopAgentCrons(agentId: string): Promise; /** * Restart all cron schedules for an agent (after config change or pause/resume). */ restartAgentCrons(agent: LTAgent): Promise; /** * Arm all cron schedules for active agents. Called at startup. */ connectAgentCrons(): Promise; /** * Disconnect on graceful shutdown. Clears the local registry so this * container stops consuming cron streams. Does NOT call Virtual.interrupt() * — cron jobs are durable rows shared across the fleet. Another container * (or this one on restart) will continue servicing them. * * Use stopCron/stopAgentCrons/stopYamlCron for intentional permanent kills * (e.g. user deletes an agent or changes a schedule via the dashboard). */ disconnect(): Promise; /** * Reset state. Used in tests. */ clear(): void; get hasActiveCrons(): boolean; get activeWorkflowTypes(): string[]; } /** Singleton cron registry */ export declare const cronRegistry: LTCronRegistry; export {};