import type { IntegrateOpsResult, TrellisVcsEngine } from '../engine.js'; import { SyncEngine } from './sync-engine.js'; import type { BranchPolicy, NackReason, PeerId, SyncNackMessage, SyncTransport } from './types.js'; export interface TrellisVcsSyncPeerOptions { peerId: string; engine: TrellisVcsEngine; transport: SyncTransport; branchPolicy?: BranchPolicy; onIntegrate?: (result: IntegrateOpsResult) => void | Promise; onRemoteNack?: (nack: SyncNackMessage) => void | Promise; } /** * A nack received from a remote peer in response to ops we pushed. * Mirrors `SyncNackMessage` minus the wire `type` field. */ export interface RemoteNackInfo { peerId: string; reason: NackReason; refs: string[]; details?: string; } export interface TrellisVcsSyncResult { peerId: string; beforeOpCount: number; afterOpCount: number; batches: IntegrateOpsResult[]; applied: number; skipped: number; rejected: number; /** Nacks the remote sent back while this sync session was running. */ remoteRejected: RemoteNackInfo[]; } /** * Thin VCS sync facade that connects a TrellisVcsEngine to a SyncTransport. */ export declare class TrellisVcsSyncPeer { private engine; private syncEngine; private transport; private integrationResults; private remoteNacks; constructor(opts: TrellisVcsSyncPeerOptions); pushTo(peerId: string): Promise; pullFrom(peerId: string): Promise; syncWith(peerId: string): Promise; /** Request a tail snapshot before a full sync (room peers only). */ requestSnapshot(peerId: string, maxOps?: number): Promise; listPeers(): PeerId[]; getSyncEngine(): SyncEngine; /** * Cumulative nacks received from remote peers since construction. * Useful for tests and for consumers that want to inspect the full history. * Sync results returned by `pushTo`/`pullFrom`/`syncWith` already include * the per-session slice in `remoteRejected`. */ getRemoteNacks(): readonly RemoteNackInfo[]; /** Underlying transport (for connect/close in client wrappers). */ getTransport(): SyncTransport; /** Tear down the transport connection if supported. */ close(): void; private captureSync; } //# sourceMappingURL=vcs-sync-peer.d.ts.map