/** * Graph-native gap replay (#133-full) — StateCell + DiscreteStateTransition / * receipt chain over the QUERY read-leg (#119). Discrete crossings replay; * continuous transients do not. * * The dead-wrong `discreteSignalPayloadsFromPatch` (which derived a runtime state * VALUE from a {@link SignalNode}'s content-address) is DELETED. The next-state * value now arrives typed in the {@link DiscreteStateTransition} receipt payload * (`next`/`generation`), minted by the authority — nothing infers a value from * patch ops. Replay is attestation-checked (Law 15): a chain that fails the * structural floor (`validateChainDetailed`) applies nothing. * * @module */ import type { ContentAddress } from './brands.js'; import type { DocumentGraph } from './document-graph.js'; import { type ReceiptEnvelope } from './receipt.js'; import { createGraphQueryRefreshBase, type GraphQueryResponse } from './graph-query.js'; import type { StateCellStoreShape } from './state-cell.js'; import { type DiscreteStateTransition } from './state-transition.js'; import { type ReplayableRecoveryCell } from './stream-recovery.js'; /** A minted transition receipt paired with the {@link DiscreteStateTransition} it attests. */ export interface PatchReceiptEntry { readonly receipt: ReceiptEnvelope; readonly transition: DiscreteStateTransition; } /** Options for replaying discrete cells from a local transition/receipt chain. */ export interface ReplayDiscreteFromPatchReceiptsOptions { readonly localBaseId: ContentAddress; readonly serverGraphId: ContentAddress; readonly entries: readonly PatchReceiptEntry[]; readonly cellStore: StateCellStoreShape; /** Typed host reflection of an applied crossing (e.g. dispatch to the DOM). */ readonly applyTransition?: (transition: DiscreteStateTransition) => void; } /** Options for QUERY-backed graph-native gap replay (#133-full). */ export interface GraphNativeGapReplayOptions { readonly queryUrl: string; readonly localBase: DocumentGraph; readonly entries: readonly PatchReceiptEntry[]; readonly cellStore: StateCellStoreShape; readonly adopt: (graph: DocumentGraph) => void; /** Typed host reflection of an applied crossing (e.g. dispatch to the DOM). */ readonly applyTransition?: (transition: DiscreteStateTransition) => void; readonly fetchImpl?: typeof fetch; readonly maxRetries?: number; } /** Result of {@link runGraphNativeGapReplay}. */ export interface GraphNativeGapReplayResult { readonly query: GraphQueryResponse; readonly replayedCells: readonly ReplayableRecoveryCell[]; readonly transitions: readonly DiscreteStateTransition[]; } /** * Find the transition chain from `localBaseId` to `serverGraphId`. * * The receipt buffer may hold FORKS (multiple transitions sharing one base) and * partial branches (chains that never reach the server graph). Selection is a * depth-first path search over each transition's graph identity * (`base` → `resultId`): only the branch that actually ends at `serverGraphId` * is returned. A fork that dead-ends is backtracked, never replayed — replaying * a branch the server did not take would be silently wrong. When NO buffered * branch reaches the server graph (missing tail receipt, unrelated fork) the * result is EMPTY: the QUERY adoption already corrected the graph, and no * discrete replay beats a wrong one. */ export declare function chainPatchesBetween(localBaseId: ContentAddress, serverGraphId: ContentAddress, entries: readonly PatchReceiptEntry[]): readonly DiscreteStateTransition[]; /** * Replay missed discrete crossings from a transition/receipt chain. * * The selected branch's receipts are run through the structural floor * ({@link Receipt.validateChainDetailed}: hash self-consistency, chain * continuity, HLC ordering) BEFORE anything applies — a reordered / truncated / * forked / HLC-regressed chain applies nothing (Law 15). Surviving transitions * are grouped per cell and the HIGHEST-generation one is applied via * {@link applyTransition}; the store's generation guard is the belt-and-suspenders. */ export declare function replayDiscreteFromPatchReceipts(options: ReplayDiscreteFromPatchReceiptsOptions): Promise<{ readonly replayedCells: readonly ReplayableRecoveryCell[]; readonly transitions: readonly DiscreteStateTransition[]; }>; /** * Full graph-native gap replay: conditional QUERY read → adopt → transition/receipt * discrete replay. Does NOT widen the SSE replay payload with a signal. */ export declare function runGraphNativeGapReplay(options: GraphNativeGapReplayOptions): Promise; export { createGraphQueryRefreshBase }; //# sourceMappingURL=graph-query-gap-replay.d.ts.map