export interface TriggerDefinition {
    id: string;
    command: string;
    args?: string[];
    cwd?: string;
    intervalSeconds: number;
    enabled?: boolean;
}
export interface TriggerEnvelope {
    version: 1;
    triggers: TriggerDefinition[];
}
export interface TriggerSchedulerOptions {
    projectDir: string;
    /** Tick interval in ms (default 1000). Tests override. */
    tickMs?: number;
    /** Startup cooldown in ms (default 30_000). */
    startupCooldownMs?: number;
    /** Output cap per run in bytes (default 4096). */
    outputCapBytes?: number;
    /** Returns true when the kill switch is engaged. */
    isKillSwitchActive(): boolean;
    /** Returns true when triggers are globally enabled. */
    isEnabled(): boolean;
    /**
     * Optional override of the spawn function for testing. When present, it is
     * called instead of the real spawn. Must yield { exitCode, stdout, stderr }.
     */
    spawn?: TriggerSpawnFn;
}
export interface TriggerExecutionResult {
    triggerId: string;
    exitCode: number | null;
    stdout: string;
    stderr: string;
    durationMs: number;
}
export type TriggerSpawnFn = (definition: TriggerDefinition, cwd: string) => Promise<{
    exitCode: number | null;
    stdout: string;
    stderr: string;
}>;
export declare const DEFAULT_TRIGGERS: TriggerDefinition[];
/**
 * Ensure that built-in default triggers exist in `.harness/triggers/triggers.json`.
 * Matches by `id`: existing entries (including user customizations) are preserved.
 * Only writes if at least one default is missing.
 */
export declare function ensureDefaultTriggers(projectDir: string): Promise<void>;
export declare function loadTriggers(projectDir: string): Promise<TriggerDefinition[]>;
export declare function saveTriggers(projectDir: string, triggers: TriggerDefinition[]): Promise<void>;
export declare function normalizeEnvelope(value: unknown): TriggerEnvelope;
export declare class TriggerScheduler {
    private timer;
    private startedAtMs;
    private lastRunMs;
    private inflight;
    private opts;
    constructor(opts: TriggerSchedulerOptions);
    start(): void;
    stop(): void;
    /**
     * Drop cached `lastRunMs` timestamps for triggers that no longer exist or
     * whose interval has changed. Call this whenever the on-disk
     * `triggers.json` is mutated so the running scheduler picks up changes
     * without waiting for the existing interval to elapse.
     */
    invalidate(): Promise<void>;
    /** Run one tick. Returns the executions that fired. Public for tests. */
    tick(now?: Date): Promise<TriggerExecutionResult[]>;
    private execute;
}
//# sourceMappingURL=triggerScheduler.d.ts.map