import type { Tool } from '../../types/tools.js';
interface WorkflowDefinition {
    name: string;
    states: string[];
    transitions: Record<string, string[]>;
    description: string;
}
export declare const WORKFLOW_DEFINITIONS: Readonly<Record<string, WorkflowDefinition>>;
export interface WorkflowInstance {
    id: string;
    definition: string;
    currentState: string;
    task: string;
    startedAt: number;
    completedAt?: number;
    transitions: number;
    context: Record<string, unknown>;
    cancelled?: boolean;
}
export declare class WorkflowManager {
    private workflows;
    start(definition: string, task: string): WorkflowInstance;
    getStatus(id: string): WorkflowInstance | null;
    transition(id: string, targetState: string): {
        success: boolean;
        error?: string;
    };
    cancel(id: string): boolean;
    list(): WorkflowInstance[];
}
export interface TriggerDefinition {
    id: string;
    event: string;
    condition?: string;
    action: string;
    enabled: boolean;
}
export declare class TriggerManager {
    private triggers;
    add(def: {
        event: string;
        condition?: string;
        action: string;
    }): TriggerDefinition;
    remove(id: string): boolean;
    enable(id: string): boolean;
    disable(id: string): boolean;
    list(): TriggerDefinition[];
}
export interface ScheduleEntry {
    name: string;
    interval: string;
    command: string;
    lastRun?: number;
    nextRun?: number;
    enabled: boolean;
}
/**
 * Parse an interval string like '30s', '5m', '1h' to milliseconds.
 * Returns null if the format is unrecognised.
 */
export declare function parseInterval(interval: string): number | null;
export declare class ScheduleManager {
    private schedules;
    /** Timer IDs keyed by schedule name */
    private timers;
    /** Spawned process handles tracked for cleanup in destroy() */
    private spawnedProcs;
    add(name: string, interval: string, command: string): ScheduleEntry;
    remove(name: string): boolean;
    enable(name: string): boolean;
    disable(name: string): boolean;
    list(): ScheduleEntry[];
    /** Stop all timers and clear state when the manager is disposed. */
    destroy(): void;
    /** Execute a schedule tick: run the command and update lastRun/nextRun. */
    private _tick;
    private _clearTimer;
}
export interface WorkflowInput {
    mode: 'start' | 'status' | 'transition' | 'cancel' | 'list' | 'triggers' | 'schedule';
    definition?: string;
    task?: string;
    workflowId?: string;
    targetState?: string;
    triggerAction?: 'list' | 'add' | 'remove' | 'enable' | 'disable';
    triggerId?: string;
    triggerDefinition?: {
        event: string;
        condition?: string;
        action: string;
    };
    scheduleAction?: 'list' | 'add' | 'remove';
    scheduleName?: string;
    scheduleInterval?: string;
    scheduleCommand?: string;
}
export interface WorkflowServices {
    readonly workflowManager: WorkflowManager;
    readonly triggerManager: TriggerManager;
    readonly scheduleManager: ScheduleManager;
}
export declare function createWorkflowServices(): WorkflowServices;
export declare function createWorkflowTool(services: WorkflowServices): Tool;
export {};
//# sourceMappingURL=index.d.ts.map