import type { GitCommandResult } from "../repository/git.js"; import type { CoordinationExpected, CoordinationRecord } from "./types.js"; import type { HistoryCheck } from "./history.js"; import { type CoordinationCommitSubject, type SyntheticObjectPlan, type SyntheticPublication } from "./synthetic.js"; import { type SyntheticApplied, type SyntheticCandidate, type SyntheticPushGuard } from "./publication.js"; export interface CoordinationTransport { readonly repository: string; readonly repositoryId: string; readRef(ref: string): string | null; fetch(directory: string, sha: string): void; push(directory: string, sha: string, ref: string, expected: string | null): GitCommandResult; } export interface CoordinationCandidate { controlRef: string; expectedControlSha: string | null; controlSha: string; treeSha: string; record: CoordinationRecord; objectDirectory: string; } export interface CoordinationObservation { controlSha: string | null; record: CoordinationRecord | null; } export interface CoordinationApplied { candidate: CoordinationCandidate; current: CoordinationObservation; disposition: "current" | "superseded"; } export type CoordinationPreparation = Readonly<{ kind: "prepared-coordination-cas"; }>; export interface CoordinationWriteResult { candidate: CoordinationCandidate; pushed?: GitCommandResult; applied?: CoordinationApplied; error?: string; } export type WriteRecorder = ((result: T) => void) & { finish?: () => void; }; export interface CoordinationCommitIntent { transactionId: string; parentSha: string | null; treeSha: string; subject: CoordinationCommitSubject; objectDirectory: string; commitMetadataHash: string; } export type CoordinationCommitGuard = (intent: CoordinationCommitIntent) => (head: string | null) => void; /** No checkout, hooks, project config, credential env or second transaction ledger. */ export declare class GitCoordinationStore { private readonly controlRef; private readonly transport; private readonly beforePush; private readonly genesis?; private readonly historyCheck?; private readonly beforeCommit?; constructor(controlRef: string, transport: CoordinationTransport, beforePush: (candidate: CoordinationCandidate) => void | WriteRecorder, genesis?: SyntheticObjectPlan | undefined, historyCheck?: HistoryCheck | undefined, beforeCommit?: CoordinationCommitGuard | undefined); private directory; private readonly preparations; private entries; private snapshot; read(workItem: string): CoordinationObservation; bootstrap(publication: SyntheticPublication, beforePush: SyntheticPushGuard): SyntheticApplied; prepareBootstrap(publication: SyntheticPublication, beforePush: SyntheticPushGuard): Readonly<{ kind: "prepared-synthetic-publication"; }>; recoverBootstrap(candidate: SyntheticCandidate): SyntheticApplied; compareAndSwap(args: { workItem: string; expectedControlSha: string | null; expected: CoordinationExpected; next: CoordinationRecord; }): CoordinationApplied; /** Candidate quota is consumed now; no dispatch lock or remote write is held across the barrier. */ prepareCompareAndSwap(input: Parameters[0]): CoordinationPreparation; /** Single use and original parent only: the native Git CAS, not a fresh preflight, decides contention. */ dispatchPrepared(handle: CoordinationPreparation): CoordinationApplied; /** Recovery proves history, never replays a write or restores a lease from a transaction ID alone. */ recover(candidate: CoordinationCandidate): CoordinationApplied; /** Reconstruct only from fetched, validated history; no caller-provided record or retained directory is trusted. */ recoverRecordedCandidate(input: Pick & { recordHash: string; }): CoordinationApplied; } //# sourceMappingURL=store.d.ts.map