/** * Semantic work accepted by the parallel-sync scheduler. * * AreaId and CanonicalPath are local aliases until the area-resolver lane lands. * TODO(parallel-sync): import these aliases from ./area-resolver.js. */ import type { ReconcileCursor as DurableReconcileCursor } from "./reconcile-cursor.js"; export type AreaId = string; export type CanonicalPath = string; export type ReconcileCursor = DurableReconcileCursor; export type RealtimeSyncWork = { class: "realtime"; source: "watcher" | "receiver" | "wake"; direction: "push" | "pull"; /** Absent callers retain the slow-lane scheduling behavior. */ lane?: "fast" | "slow"; paths: readonly CanonicalPath[]; causality: string; }; export type ChoreSyncWork = { class: "chore"; kind: "cadence" | "full-reconcile" | "rotation" | "backlog" | "migration"; areas: readonly AreaId[]; cursor?: ReconcileCursor; }; export type SyncWork = RealtimeSyncWork | ChoreSyncWork; /** The only completion states a caller needs in order to apply publish/ack policy. */ export type WorkPathStatus = "remoteCommitted" | "durable" | "refused" | "retryable"; export type PathWorkOutcome = { path: CanonicalPath; status: WorkPathStatus; /** Monotonic fencing token assigned by the coordinator. */ epoch: number; reason?: string; }; export type WorkOutcome = { paths: readonly PathWorkOutcome[]; error?: string; }; /** A resolved, concrete mutation path. It is internal coordinator/worker data. */ export type ScheduledPath = { canonicalPath: CanonicalPath; targetUid: string; areaId: AreaId; epoch: number; }; /** * The structured payload for an execution adapter. Callers submit SyncWork and * never construct this type, choose a worker, or acquire a lease. */ export type WorkSlice = { id: string; work: SyncWork; paths: readonly ScheduledPath[]; signal: AbortSignal; }; export interface SyncWorkerAdapter { execute(slice: WorkSlice): Promise; /** Optional lifecycle hook for long-lived out-of-process adapters. */ shutdown?(): Promise; } export type InlineSyncWorkerHandler = (slice: WorkSlice) => Promise; /** A deterministic in-process adapter intended only for coordinator tests. */ export declare class InlineSyncWorkerAdapter implements SyncWorkerAdapter { private readonly handler; constructor(handler: InlineSyncWorkerHandler); execute(slice: WorkSlice): Promise; } //# sourceMappingURL=sync-work.d.ts.map