import { type CatalogOrigin, type CatalogSelectionPolicy, type AutomationTriggerMode, type ConnectorKind, type HookTrigger, type SkillScope } from './runtime-assets.js';
export interface ConnectorBinding {
    kind: ConnectorKind;
    target: string;
    method?: 'POST' | 'PUT';
    eventName?: string;
}
export interface ConnectorDeliveryRecord {
    kind: ConnectorKind;
    target: string;
    status: 'queued' | 'delivered' | 'failed';
    responseCode?: number;
    message: string;
}
export interface AutomationArtifact {
    automationId: string;
    version: number;
    name: string;
    description: string;
    domain?: string;
    triggerMode: AutomationTriggerMode;
    eventTrigger?: HookTrigger;
    schedule?: string;
    connectorEvent?: string;
    workflowSelectors: string[];
    hookSelectors: string[];
    skillSelectors: string[];
    connectors: ConnectorBinding[];
    scope: SkillScope;
    provenance: string;
    validationStatus: 'pending' | 'validated' | 'rejected';
    rolloutStatus: 'staged' | 'hot' | 'promoted' | 'revoked';
    catalogOrigin: CatalogOrigin;
    catalogPath?: string;
    catalogPriority: number;
    effectiveness: {
        queuedRuns: number;
        deliveries: number;
        failures: number;
    };
}
export interface AutomationDispatch {
    trigger: HookTrigger | 'schedule';
    automationId: string;
    name: string;
    queuedRun?: {
        goal: string;
        workflowSelectors: string[];
        skillSelectors: string[];
        hookSelectors: string[];
        triggerMode?: AutomationTriggerMode;
        schedule?: string;
    };
    deliveries: ConnectorDeliveryRecord[];
}
export interface ScheduledAutomationSnapshot {
    automationId: string;
    name: string;
    schedule: string;
    triggerMode: 'schedule';
    registeredAt: number;
    lastRunAt: number | null;
    nextRunAt: number | null;
    due: boolean;
    status: 'pending' | 'due' | 'waiting' | 'complete' | 'invalid';
    reason?: string;
}
export interface ScheduledDispatchContext {
    now?: number;
    goal?: string;
    executeConnectors?: boolean;
    payload?: Record<string, unknown>;
}
export declare class AutomationRuntime {
    private rootDir;
    private workspaceRoot;
    private clock;
    private artifacts;
    private scheduleStates;
    private bootstrapped;
    constructor(rootDir?: string, workspaceRoot?: string, clock?: () => number);
    listArtifacts(options?: {
        selectionPolicy?: CatalogSelectionPolicy;
        dedupe?: boolean;
    }): AutomationArtifact[];
    getArtifact(automationId: string): AutomationArtifact | undefined;
    findByName(name: string): AutomationArtifact | undefined;
    createAutomation(input: Omit<AutomationArtifact, 'automationId' | 'version' | 'validationStatus' | 'rolloutStatus' | 'catalogOrigin' | 'catalogPath' | 'catalogPriority' | 'effectiveness'>): AutomationArtifact;
    deploy(automationId: string, scope?: SkillScope): AutomationArtifact | undefined;
    revoke(automationId: string): AutomationArtifact | undefined;
    resolveAutomationSelectors(names: string[], goal: string, triggerMode?: AutomationTriggerMode): AutomationArtifact[];
    dispatch(trigger: HookTrigger, automations: AutomationArtifact[], context: {
        goal: string;
        executeConnectors?: boolean;
        payload?: Record<string, unknown>;
    }): Promise<AutomationDispatch[]>;
    listScheduledAutomations(options?: {
        now?: number;
    }): ScheduledAutomationSnapshot[];
    getDueScheduledAutomations(options?: {
        now?: number;
    }): ScheduledAutomationSnapshot[];
    dispatchScheduled(options?: ScheduledDispatchContext): Promise<AutomationDispatch[]>;
    private stage;
    private validate;
    private syncScheduleState;
    private snapshotScheduledAutomation;
    private completeScheduleRun;
    private deliverConnectors;
    private lastLocalRefresh;
    private ensureBootstrapped;
    private persistArtifact;
}
export declare const createAutomationRuntime: (rootDir?: string, workspaceRoot?: string, clock?: () => number) => AutomationRuntime;
