import type { CatchupPassDecisionReason, DKGAgent, SwmSnapshotCoverage } from '@origintrail-official/dkg-agent'; import type { ContextGraphReadinessProvenance, DashboardDB } from '@origintrail-official/dkg-node-ui'; import { type CatchupJobResult } from './catchup-runner.js'; export { catchupPlaneCompletedWithoutFailure } from './catchup-runner.js'; export declare const CONTEXT_GRAPH_READINESS_VERSION = 1; /** * The shared-memory shortfall clause appended to the incomplete-progress * terminal message. * * Every figure comes from ONE {@link SwmSnapshotCoverage} record — the counts, * the peer they are attributed to, and the sample — so the sentence can never * describe a graph state no peer reported, and the named Knowledge Assets * always belong to the manifest the counts came from. * * Returns `''` whenever there is nothing to add, which is what keeps the base * sentence byte-identical on every other path: no snapshot inventory was * observed, or the selected manifest was fully retrieved AND fully written — in * which case the shortfall lies on another plane, and reporting "0 outstanding" * beside an `unreachable` verdict would misdirect the reader. */ export declare function swmShortfallClause(coverage: SwmSnapshotCoverage | undefined, continuationPasses: number | undefined, stopReason?: CatchupPassDecisionReason): string; export type ContextGraphReadinessStore = Pick; export interface ContextGraphSubscriptionReadinessState { synced?: boolean; sharedMemorySynced?: boolean; metaSynced?: boolean; pendingMeta?: boolean; } export interface ContextGraphSubscriptionStatePatch { synced: boolean; sharedMemorySynced: boolean; metaSynced: boolean; pendingMeta: boolean; } export interface ContextGraphReadinessPatch { durableVerified: boolean; sharedMemoryVerified: boolean; } export interface MissingMetadataReadinessPatches { statePatch: ContextGraphSubscriptionStatePatch; readinessPatch: ContextGraphReadinessPatch; } /** Canonical fail-closed state for a graph without authoritative metadata. */ export declare function missingMetadataReadinessPatches(): MissingMetadataReadinessPatches; export declare function classifyExistingContextGraphReadiness(input: { subscription: ContextGraphSubscriptionReadinessState; readiness: ContextGraphReadinessProvenance; includeSharedMemory: boolean; hasConfirmedMeta: boolean; }): { alreadyReady: boolean; statePatch?: ContextGraphSubscriptionStatePatch; readinessPatch?: ContextGraphReadinessPatch; }; export declare function catchupResultHasCleanResponse(result: CatchupJobResult): boolean; export interface ContextGraphCatchupReadinessClassification { jobStatus: 'done' | 'failed' | 'denied' | 'unreachable'; error?: string; statePatch?: ContextGraphSubscriptionStatePatch; readinessPatch?: ContextGraphReadinessPatch; eventPayload?: { dataSynced: number; sharedMemorySynced: number; verifiedPrivateOnlyResponses: number; }; } /** * Canonical policy for converting one catch-up result into externally visible * subscription readiness. The HTTP route gathers live metadata and applies * the returned patches; all readiness decisions remain in this pure function. */ export declare function classifyContextGraphCatchupReadiness(input: { result: CatchupJobResult; includeSharedMemory: boolean; hasConfirmedMeta: boolean; isPrivate: boolean; readinessBeforeCatchup: ContextGraphReadinessProvenance; }): ContextGraphCatchupReadinessClassification; export declare function readContextGraphReadiness(store: Partial, contextGraphId: string): ContextGraphReadinessProvenance; export declare function writeContextGraphReadiness(store: Partial, contextGraphId: string, readiness: Pick): void; /** * Revalidate live metadata and invalidate subscription/provenance together. * Returns false when authoritative metadata arrived before this reset acquired * the readiness lock, in which case newer PROJECT_SYNCED proof is preserved. */ export declare function resetContextGraphReadinessForMissingMetadata(input: { agent: DKGAgent; store: Partial; contextGraphId: string; }): Promise; /** * Persist readiness proven by the agent's automatic post-approval catch-up. * PROJECT_SYNCED is also used as a UI event, so fail closed unless it carries * actual inserted data or a cryptographically verified private-only response, * and the graph's authoritative metadata is present. */ export declare function persistProjectSyncedReadiness(input: { agent: DKGAgent; store: Partial; contextGraphId: string; dataSynced: number; sharedMemorySynced: number; verifiedPrivateOnlyResponses?: number; }): Promise; export interface ProjectSyncedReadinessPayload { contextGraphId: string; dataSynced: number; sharedMemorySynced: number; verifiedPrivateOnlyResponses: number; } export declare function parseProjectSyncedReadinessPayload(data: unknown): ProjectSyncedReadinessPayload | null; export declare function registerProjectSyncedReadinessPersistence(input: { agent: DKGAgent; store: Partial; log: (message: string) => void; }): void; /** * One-time migration for subscription flags written before readiness carried * durable per-plane proof. Private/unconfirmed rows fail closed and must * complete a new catch-up. Confirmed public rows retain historical clean-empty * compatibility and receive provenance matching their already-persisted bits. */ export declare function migrateLegacyContextGraphReadiness(input: { agent: DKGAgent; store: Partial; log: (message: string) => void; }): Promise; //# sourceMappingURL=context-graph-readiness.d.ts.map