import { PathLeaseManager } from "./path-leases.js"; import { type AreaId, type CanonicalPath, type ChoreSyncWork, type SyncWork, type SyncWorkerAdapter, type WorkOutcome } from "./sync-work.js"; export type PathIdentity = { targetUid: string; areaId: AreaId; }; export type CoordinatorClock = { now(): number; }; export type ParallelSyncCoordinatorOptions = { /** Permanently reserved for realtime work; it is never assigned a chore. */ realtimeWorker: SyncWorkerAdapter; /** Runs bounded chore slices only. */ choreWorker: SyncWorkerAdapter; /** Resolves storage ownership without exposing it to SyncWork callers. */ identifyPath: (path: CanonicalPath) => PathIdentity; /** Turns a chore cursor into its next bounded concrete mutation slice. */ planChorePaths: (work: ChoreSyncWork) => readonly CanonicalPath[]; clock?: CoordinatorClock; }; export type CoordinatorSnapshot = { realtimeQueued: number; choreQueued: number; realtimeRunning: boolean; choreRunning: boolean; leases: ReturnType; now: number; }; export interface ParallelSyncCoordinator { submit(work: SyncWork): Promise; inspect(): CoordinatorSnapshot; shutdown(): Promise; } /** * Scheduler and fencing authority for semantic sync work. It deliberately owns * mailboxes, lease acquisition, path epochs, and adapter selection so callers * cannot smuggle in a lane, lock, argv, or worker choice. */ export declare class DefaultParallelSyncCoordinator implements ParallelSyncCoordinator { private readonly options; private readonly leases; private readonly realtimeQueue; private readonly choreQueue; private epochs; private readonly clock; private readonly identifyPath; private readonly planChorePaths; private nextId; private nextEpoch; private readonly realtimeRunningByLane; private choreRunning?; private stopping; private shutdownPromise?; constructor(options: ParallelSyncCoordinatorOptions); submit(work: SyncWork): Promise; inspect(): CoordinatorSnapshot; shutdown(): Promise; private createSubmission; private pathsFor; private registerEpochs; private hasInternallyConflictingPaths; private preemptForRealtime; private drain; private startNext; private requestsFor; private execute; private applyWorkerOutcome; private isStale; private completeAfterWorkerFailure; private setResult; private completeRemaining; private finishIfEmpty; private pruneEpochs; private realtimeLane; private refusedOutcome; private retryableOutcome; } //# sourceMappingURL=parallel-sync-coordinator.d.ts.map