/**
 * External Sync Daemon Service
 *
 * Background polling daemon that automates external service synchronization
 * (e.g., GitHub Issues, Linear). Follows the dispatch daemon lifecycle pattern:
 * - setInterval with configurable pollIntervalMs
 * - running flag to prevent concurrent cycles
 * - Tracks currentPollCycle promise for clean shutdown
 * - Each cycle: iterate all configured providers, run sync engine push + pull
 * - Log cycle results (pushed/pulled/conflicts/errors)
 *
 * Zero-overhead guarantee: The daemon is only instantiated when external sync
 * is enabled AND at least one provider has a configured token. Unconfigured
 * workspaces pay no cost — no daemon object, no timers, no polling.
 *
 * @module
 */
import type { ExternalSyncResult } from '@stoneforge/core';
import type { SyncEngine } from '@stoneforge/quarry';
/**
 * Default poll interval in milliseconds for external sync daemon (60 seconds)
 */
export declare const EXTERNAL_SYNC_DEFAULT_POLL_INTERVAL_MS = 60000;
/**
 * Minimum poll interval in milliseconds (10 seconds)
 */
export declare const EXTERNAL_SYNC_MIN_POLL_INTERVAL_MS = 10000;
/**
 * Maximum poll interval in milliseconds (30 minutes)
 */
export declare const EXTERNAL_SYNC_MAX_POLL_INTERVAL_MS: number;
/**
 * Configuration for the External Sync Daemon
 */
export interface ExternalSyncDaemonConfig {
    /**
     * Poll interval in milliseconds.
     * Default: 60000 (60 seconds)
     */
    readonly pollIntervalMs?: number;
}
/**
 * External Sync Daemon interface for automated bidirectional sync
 * with external services (GitHub, Linear, etc.).
 *
 * The daemon provides methods for:
 * - Starting and stopping the polling loop
 * - Manual trigger of a sync cycle
 * - Querying last sync result
 */
export interface ExternalSyncDaemon {
    /**
     * Start the polling loop.
     * No-op if already running.
     */
    start(): Promise<void>;
    /**
     * Stop the polling loop.
     * Waits for any in-flight cycle to complete before returning.
     */
    stop(): Promise<void>;
    /**
     * Whether the daemon is currently running.
     */
    isRunning(): boolean;
    /**
     * Force an immediate sync cycle.
     * Can be called whether the daemon is running or not.
     */
    triggerSync(): Promise<ExternalSyncResult>;
    /**
     * Get the result of the last completed sync cycle.
     * Returns null if no cycle has completed yet.
     */
    getLastResult(): ExternalSyncResult | null;
}
/**
 * ExternalSyncDaemon implementation.
 *
 * Wraps a SyncEngine in a setInterval-based polling loop.
 * Each cycle runs the engine's sync() method (push then pull)
 * across all configured providers.
 */
export declare class ExternalSyncDaemonImpl implements ExternalSyncDaemon {
    private running;
    private pollIntervalHandle?;
    private currentPollCycle?;
    private lastResult;
    private readonly config;
    private readonly syncEngine;
    constructor(syncEngine: SyncEngine, config?: ExternalSyncDaemonConfig);
    start(): Promise<void>;
    stop(): Promise<void>;
    isRunning(): boolean;
    triggerSync(): Promise<ExternalSyncResult>;
    getLastResult(): ExternalSyncResult | null;
    /**
     * Run a single sync cycle: push then pull via the sync engine.
     * Catches and logs errors so the polling loop continues.
     */
    private runSyncCycle;
}
/**
 * Create an ExternalSyncDaemon instance.
 *
 * @param syncEngine - The sync engine to drive push/pull operations
 * @param config - Optional daemon configuration (poll interval, etc.)
 * @returns A new ExternalSyncDaemon, ready to start()
 */
export declare function createExternalSyncDaemon(syncEngine: SyncEngine, config?: ExternalSyncDaemonConfig): ExternalSyncDaemon;
//# sourceMappingURL=external-sync-daemon.d.ts.map