/**
 * Multi-session Orchestration — Cross-Session Task Registry
 *
 * Wraps SessionTaskGraph with persistence to
 * `.goodvibes/goodvibes/sessions/task-graph.json` and reconnect/resume hydration.
 *
 * The registry is the single authoritative source for the cross-session task
 * graph within a process. Command handlers and sync integrations receive an
 * owned instance from the runtime service graph.
 */
import type { CrossSessionTaskRef, TaskHandoffRecord, CancellationRequest, CancellationResult, SessionTaskGraphSnapshot } from './types.js';
import type { TaskLifecycleState } from '../../runtime/store/domains/tasks.js';
/**
 * CrossSessionTaskRegistry — persistent wrapper around `SessionTaskGraph`.
 *
 * Responsibilities:
 * - Load the graph from disk on construction (reconnect/resume hydration).
 * - Flush the graph to disk after every mutation.
 * - Expose a stable interface for command handlers and sync adapters.
 * - Generate unique handoff IDs.
 */
export declare class CrossSessionTaskRegistry {
    private readonly _graph;
    private readonly _graphPath;
    private readonly _dir;
    private _dirEnsured;
    private _flushTimer;
    _exitHandler: (() => void) | null;
    /**
     * @param baseDir - Project base directory.
     *   The graph is persisted at `<baseDir>/.goodvibes/goodvibes/sessions/task-graph.json`.
     */
    constructor(baseDir: string);
    /**
     * Link a task into the global graph — registers the task as a
     * cross-session ref and optionally adds a dependency edge.
     *
     * @param ref - The task ref to link.
     * @param dependsOn - Optional ref this task depends on.
     * @param reason - Optional reason for the dependency edge.
     * @returns Result of the link operation.
     */
    linkTask(ref: CrossSessionTaskRef, dependsOn?: {
        sessionId: string;
        taskId: string;
    }, reason?: string): {
        ok: boolean;
        error?: string;
    };
    /**
     * Update the status of a task ref.
     *
     * @param sessionId - Owning session.
     * @param taskId - Target task.
     * @param status - New lifecycle status.
     * @returns `true` if the status changed and was flushed.
     */
    propagateStatus(sessionId: string, taskId: string, status: TaskLifecycleState): boolean;
    /**
     * Look up a ref by session + task ID.
     */
    getRef(sessionId: string, taskId: string): CrossSessionTaskRef | undefined;
    /**
     * Return all refs in the graph.
     */
    getAllRefs(): CrossSessionTaskRef[];
    /**
     * Return all refs for a given session.
     */
    getRefsBySession(sessionId: string): CrossSessionTaskRef[];
    /**
     * Return all direct dependencies of a task.
     */
    getDependencies(sessionId: string, taskId: string): CrossSessionTaskRef[];
    /**
     * Return all direct dependents of a task.
     */
    getDependents(sessionId: string, taskId: string): CrossSessionTaskRef[];
    /**
     * Initiate a task handoff from one session to another.
     *
     * Both sessions must have their task refs registered before calling this.
     * The originating task ref status is updated to 'blocked' (awaiting handoff).
     *
     * @param taskRef - The task being handed off.
     * @param fromSessionId - Source session.
     * @param toSessionId - Destination session.
     * @param reason - Optional human-readable reason.
     * @returns Result of the handoff operation.
     */
    initiateHandoff(taskRef: {
        sessionId: string;
        taskId: string;
    }, fromSessionId: string, toSessionId: string, reason?: string): {
        ok: boolean;
        handoffId?: string;
        error?: string;
    };
    /**
     * Acknowledge a handoff from the destination session.
     *
     * @param handoffId - The handoff to acknowledge.
     * @returns `true` if the handoff was found and acknowledged.
     */
    acknowledgeHandoff(handoffId: string): boolean;
    /**
     * Return all handoff records.
     */
    getHandoffs(): TaskHandoffRecord[];
    /**
     * Apply a scoped cancellation to the graph.
     *
     * @param request - The cancellation request.
     * @returns Result describing what was cancelled and what was skipped.
     */
    cancel(request: CancellationRequest): CancellationResult;
    /**
     * Take a snapshot of the current graph state.
     * Suitable for display (e.g. `/session graph`).
     */
    snapshot(): SessionTaskGraphSnapshot;
    /**
     * Force a synchronous flush to disk.
     * Use on shutdown/dispose to ensure all pending data is written.
     */
    flush(): void;
    /**
     * Release process-level resources held by the registry.
     *
     * Safe to call multiple times. Flushes pending state before detaching the
     * process exit handler.
     */
    dispose(): void;
    /**
     * Load the persisted graph from disk and hydrate the in-memory graph.
     * Non-fatal: if the file is missing or malformed, the graph starts empty.
     */
    private _load;
    /**
     * Flush the current graph snapshot to disk.
     * Non-fatal: if the write fails, logs a debug message and continues.
     */
    private _flush;
    /** Schedule a debounced async write (coalesces rapid successive mutations). */
    private _scheduledFlush;
    /** Perform a synchronous write — used by shutdown/dispose and flush(). */
    private _flushSync;
}
//# sourceMappingURL=registry.d.ts.map