import type { DKGAgent } 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; 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