trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
63 lines • 2.39 kB
TypeScript
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<void>;
onRemoteNack?: (nack: SyncNackMessage) => void | Promise<void>;
}
/**
* 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<TrellisVcsSyncResult>;
pullFrom(peerId: string): Promise<TrellisVcsSyncResult>;
syncWith(peerId: string): Promise<TrellisVcsSyncResult>;
/** Request a tail snapshot before a full sync (room peers only). */
requestSnapshot(peerId: string, maxOps?: number): Promise<void>;
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