/**
 * Action Chaining Handler
 *
 * Listens for workflow_rule:matched events on the EventBus and automatically
 * spawns the next agent action when an on_enter rule fires.
 *
 * Example chain:
 *   implement completes → lifecycle hook moves to Review →
 *   on_enter rule fires merge → ticket moves to Done
 *
 * Safety guards:
 * - Max chain depth of 5 per ticket to prevent infinite loops
 * - Skips if an agent is already running for the ticket
 * - Only fires on_enter rules (manual rules are user-initiated)
 * - Respects the enabled flag on rules
 */
import type Database from 'better-sqlite3';
import type { SQLiteStorage } from '../pmo/storage-sqlite.js';
export declare class ActionChainingHandler {
    private unsubscribers;
    private chainDepths;
    private db;
    private storage;
    private pmoPath;
    private log;
    constructor(db: Database.Database, storage: SQLiteStorage, pmoPath: string, log?: (msg: string) => void);
    /**
     * Start listening for workflow rule matches.
     */
    start(): void;
    /**
     * Stop listening for events and clean up.
     */
    stop(): void;
    /**
     * Handle a workflow rule match by spawning the next action in the chain.
     */
    private handleRuleMatched;
    /**
     * Spawn an agent to execute the chained action.
     * Lazily resolves workspace info and agent selection.
     */
    private spawnChainedAction;
    /**
     * Get the current chain depth for a ticket (for testing/debugging).
     */
    getChainDepth(ticketId: string): number;
    /**
     * Reset chain depth for a ticket (e.g., when a ticket is manually moved).
     */
    resetChainDepth(ticketId: string): void;
}
/**
 * Initialize and start the action chaining handler.
 * Safe to call multiple times — subsequent calls are no-ops.
 */
export declare function initActionChaining(db: Database.Database, storage: SQLiteStorage, pmoPath: string, log?: (msg: string) => void): ActionChainingHandler;
/**
 * Stop the action chaining handler (primarily for testing).
 */
export declare function stopActionChaining(): void;
