/**
 * RuntimeHost - Internal host for WARP multi-writer graph database.
 *
 * Provides a factory for opening multi-writer graphs and methods for
 * creating patches, materializing state, and managing checkpoints.
 *
 * @module domain/RuntimeHost
 * @see WARP Spec Section 11
 */
import VersionVector from './crdt/VersionVector.ts';
import GCPolicy from './services/GCPolicy.ts';
import type { AuditReceiptService } from './services/audit/AuditReceiptService.ts';
import { TemporalQuery } from './services/TemporalQuery.ts';
import LogicalTraversal from './services/query/LogicalTraversal.ts';
import LRUCache from './utils/LRUCache.ts';
import SyncController from './services/controllers/SyncController.ts';
import StrandController from './services/controllers/StrandController.ts';
import ComparisonController from './services/controllers/ComparisonController.ts';
import SubscriptionController from './services/controllers/SubscriptionController.ts';
import ProvenanceController from './services/controllers/ProvenanceController.ts';
import ForkController from './services/controllers/ForkController.ts';
import QueryController from './services/controllers/QueryController.ts';
import PatchController from './services/controllers/PatchController.ts';
import CheckpointController from './services/controllers/CheckpointController.ts';
import SyncTrustGate from './services/sync/SyncTrustGate.ts';
import type MaterializedViewService from './services/MaterializedViewService.ts';
import StateHashService from './services/state/StateHashService.ts';
import MaterializeController, { type MaterializeResult } from './services/controllers/MaterializeController.ts';
import BitmapNeighborProvider, { type LogicalIndex } from './services/index/BitmapNeighborProvider.ts';
import { type StateDiffResult } from './services/state/StateDiff.ts';
import type { CorePersistence } from './types/WarpPersistence.ts';
import type LoggerPort from '../ports/LoggerPort.ts';
import type CryptoPort from '../ports/CryptoPort.ts';
import type CodecPort from '../ports/CodecPort.ts';
import type SeekCachePort from '../ports/SeekCachePort.ts';
import type WarpStateCachePort from '../ports/WarpStateCachePort.ts';
import type BlobStoragePort from '../ports/BlobStoragePort.ts';
import type PatchJournalPort from '../ports/PatchJournalPort.ts';
import type CommitMessageCodecPort from '../ports/CommitMessageCodecPort.ts';
import type CheckpointStorePort from '../ports/CheckpointStorePort.ts';
import type IndexStorePort from '../ports/IndexStorePort.ts';
import type RuntimeStorageCapabilityPort from '../ports/RuntimeStorageCapabilityPort.ts';
import type { EffectPipeline } from './services/EffectPipeline.ts';
import type WarpState from './services/state/WarpState.ts';
import type SnapshotWarpState from './services/snapshot/SnapshotWarpState.ts';
import type { ProvenanceIndex } from './services/provenance/ProvenanceIndex.ts';
import type { PatchDiff } from './types/PatchDiff.ts';
import type { TickReceipt } from './types/TickReceipt.ts';
import type PropertyIndexReader from './services/index/PropertyIndexReader.ts';
import type QueryCapability from './capabilities/QueryCapability.ts';
import type AdjacencyMap from './capabilities/AdjacencyMap.ts';
import { type TrustMode, type NormalizedTrustConfig } from './runtimeHelpers.ts';
import { type RuntimeHostOpenInput, type RuntimeHostConstructionOptions } from './warp/RuntimeHostBoot.ts';
import type { NeighborEdge } from '../ports/NeighborProviderPort.ts';
type AdjacencyMapShape = {
    outgoing: Map<string, readonly NeighborEdge[]> | ReadonlyMap<string, readonly NeighborEdge[]>;
    incoming: Map<string, readonly NeighborEdge[]> | ReadonlyMap<string, readonly NeighborEdge[]>;
};
export type MaterializedGraph = {
    state: WarpState;
    stateHash: string;
    adjacency: AdjacencyMapShape;
    provider?: BitmapNeighborProvider;
};
type MaterializeReceiptsResult = {
    state: SnapshotWarpState;
    receipts: readonly TickReceipt[];
};
type Subscriber = {
    onChange: (diff: StateDiffResult) => void;
    onError?: (error: Error) => void;
    pendingReplay?: boolean;
};
/**
 * RuntimeHost class for interacting with a WARP multi-writer graph.
 */
export default class RuntimeHost {
    _persistence: CorePersistence & Partial<RuntimeStorageCapabilityPort>;
    _graphName: string;
    _writerId: string;
    _versionVector: VersionVector;
    _cachedState: WarpState | null;
    _stateDirty: boolean;
    _gcPolicy: GCPolicy;
    _lastGCLamport: number;
    _patchesSinceGC: number;
    _patchesSinceCheckpoint: number;
    _maxObservedLamport: number;
    _checkpointPolicy: {
        every: number;
    } | null;
    _checkpointing: boolean;
    _autoMaterialize: boolean;
    traverse: LogicalTraversal;
    _materializedGraph: MaterializedGraph | null;
    _adjacencyCache: LRUCache<string, AdjacencyMapShape> | null;
    _lastFrontier: Map<string, string> | null;
    _logger: LoggerPort | null;
    _crypto: CryptoPort;
    _codec: CodecPort;
    _onDeleteWithData: 'reject' | 'cascade' | 'warn';
    _subscribers: Subscriber[];
    _lastNotifiedState: WarpState | null;
    _provenanceIndex: ProvenanceIndex | null;
    _temporalQuery: TemporalQuery | null;
    _seekCeiling: number | null;
    _cachedCeiling: number | null;
    _cachedFrontier: Map<string, string> | null;
    _seekCache: SeekCachePort | null;
    _stateCache: WarpStateCachePort | null;
    _blobStorage: BlobStoragePort | null;
    _patchBlobStorage: BlobStoragePort | null;
    _commitMessageCodec: CommitMessageCodecPort;
    _patchInProgress: boolean;
    _provenanceDegraded: boolean;
    _audit: boolean;
    _auditSkipCount: number;
    _trustConfig: NormalizedTrustConfig;
    _createSyncTrustGate: (override?: {
        mode?: TrustMode;
        pin?: string | null;
    } | null) => SyncTrustGate | null;
    _syncController: SyncController;
    _strandController: StrandController;
    _comparisonController: ComparisonController;
    _subscriptionController: SubscriptionController;
    _provenanceController: ProvenanceController;
    _forkController: ForkController;
    _queryController: QueryController;
    _patchController: PatchController;
    _checkpointController: CheckpointController;
    _materializeController: MaterializeController;
    _viewService: MaterializedViewService;
    _logicalIndex: LogicalIndex | null;
    _propertyReader: PropertyIndexReader | null;
    _cachedViewHash: string | null;
    _cachedIndexTree: Record<string, Uint8Array> | null;
    _indexDegraded: boolean;
    _effectPipeline: EffectPipeline | null;
    _patchJournal: PatchJournalPort;
    _checkpointStore: CheckpointStorePort;
    _indexStore: IndexStorePort;
    _stateHashService: StateHashService | null;
    _auditService: AuditReceiptService | null;
    /**
     * Constructs a RuntimeHost instance with injected dependencies and configuration.
     * @private
     */
    constructor(options: RuntimeHostConstructionOptions);
    /**
     * Advanced substrate replay primitive over the live frontier.
     */
    materialize(options: {
        receipts: true;
        ceiling?: number | null;
    }): Promise<MaterializeReceiptsResult>;
    materialize(options?: {
        receipts?: false;
        ceiling?: number | null;
    }): Promise<SnapshotWarpState>;
    /**
     * Advanced substrate replay primitive against an explicit pinned frontier.
     */
    materializeCoordinate(options: {
        frontier: Map<string, string> | Record<string, string>;
        ceiling?: number | null;
        receipts: true;
    }): Promise<MaterializeReceiptsResult>;
    materializeCoordinate(options: {
        frontier: Map<string, string> | Record<string, string>;
        ceiling?: number | null;
        receipts?: false;
    }): Promise<SnapshotWarpState>;
    materializeAt(checkpointSha: string): Promise<SnapshotWarpState>;
    _materializeGraph(options?: {
        ceiling?: number | null;
    }): Promise<MaterializedGraph>;
    _materializeCoordinateGraph(options: Parameters<MaterializeController['materializeCoordinate']>[0]): Promise<MaterializedGraph>;
    _materializeStrandGraph(strandId: string, options?: {
        ceiling?: number | null;
    }): Promise<MaterializedGraph>;
    _materializedGraphFromState(state: WarpState): Promise<MaterializedGraph>;
    _materializedGraphFromCachedState(): Promise<MaterializedGraph>;
    _buildAdjacency(state: WarpState): AdjacencyMap;
    _setMaterializedState(state: WarpState, optionsOrDiff?: PatchDiff | {
        diff?: PatchDiff | null;
    }): Promise<MaterializedGraph>;
    _buildView(): void;
    _resolveCeiling(): null;
    _persistSeekCacheEntry(): Promise<void>;
    _restoreIndexFromCache(): Promise<void>;
    verifyIndex(options?: {
        seed?: number;
        sampleRate?: number;
    }): import("./services/MaterializedViewVerifier.ts").VerifyResult;
    invalidateIndex(): void;
    /**
     * Inspection API: reads one node from the current materialized state.
     *
     * Prefer `worldline().query()` for stable product reads, or
     * `worldline().observer(...).query()` when you need a filtered aperture.
     */
    getNodeProps: QueryCapability['getNodeProps'];
    /**
     * Inspection API: walks visible neighbors from the current materialized state.
     *
     * For application-facing reads, prefer `Observer` query/traverse helpers over direct materialization.
     */
    neighbors: QueryCapability['neighbors'];
    /**
     * Inspection API: enumerates all visible nodes in the current materialized state.
     *
     * Prefer `worldline().query()` for stable product reads, or
     * `worldline().observer(...).query()` when you need a filtered aperture.
     */
    getNodes: QueryCapability['getNodes'];
    /**
     * Inspection API: enumerates all visible edges in the current materialized state.
     */
    getEdges: QueryCapability['getEdges'];
    /**
     * Advanced substrate replay primitive for this pinned source.
     */
    materializeSlice: ProvenanceController['materializeSlice'];
    /**
     * Advanced substrate replay primitive for a strand's pinned base observation plus overlay.
     */
    materializeStrand(strandId: string, options: {
        receipts: true;
        ceiling?: number | null;
    }): Promise<MaterializeReceiptsResult>;
    materializeStrand(strandId: string, options?: {
        receipts?: false;
        ceiling?: number | null;
    }): Promise<SnapshotWarpState>;
    createCheckpoint: CheckpointController['createCheckpoint'];
    _readCheckpointSha: CheckpointController['_readCheckpointSha'];
    syncCoverage: CheckpointController['syncCoverage'];
    _loadLatestCheckpoint: CheckpointController['_loadLatestCheckpoint'];
    _loadPatchesSince: CheckpointController['_loadPatchesSince'];
    _validateMigrationBoundary: CheckpointController['_validateMigrationBoundary'];
    _hasSchema1Patches: CheckpointController['_hasSchema1Patches'];
    _maybeRunGC: CheckpointController['_maybeRunGC'];
    maybeRunGC: CheckpointController['maybeRunGC'];
    runGC: CheckpointController['runGC'];
    getGCMetrics: CheckpointController['getGCMetrics'];
    createPatch: PatchController['createPatch'];
    patch: PatchController['patch'];
    patchMany: PatchController['patchMany'];
    _nextLamport: PatchController['_nextLamport'];
    _loadPatchChainFromSha: PatchController['_loadPatchChainFromSha'];
    _loadWriterPatches: PatchController['_loadWriterPatches'];
    getWriterPatches: PatchController['getWriterPatches'];
    _onPatchCommitted: PatchController['_onPatchCommitted'];
    writer: PatchController['writer'];
    _ensureFreshState: PatchController['_ensureFreshState'];
    _readPatchBlob: PatchController['_readPatchBlob'];
    discoverWriters: PatchController['discoverWriters'];
    discoverTicks: PatchController['discoverTicks'];
    join: PatchController['join'];
    _frontierEquals: PatchController['_frontierEquals'];
    createStrand: StrandController['createStrand'];
    braidStrand: StrandController['braidStrand'];
    getStrand: StrandController['getStrand'];
    listStrands: StrandController['listStrands'];
    dropStrand: StrandController['dropStrand'];
    getStrandPatches: StrandController['getStrandPatches'];
    patchesForStrand: StrandController['patchesForStrand'];
    createStrandPatch: StrandController['createStrandPatch'];
    patchStrand: StrandController['patchStrand'];
    queueStrandIntent: StrandController['queueStrandIntent'];
    listStrandIntents(strandId: string): Promise<import("./services/strand/strandTypes.ts").StrandQueuedIntent[]>;
    tickStrand: StrandController['tickStrand'];
    analyzeConflicts: StrandController['analyzeConflicts'];
    hasNode: QueryCapability['hasNode'];
    getEdgeProps: QueryCapability['getEdgeProps'];
    getStateSnapshot: QueryCapability['getStateSnapshot'];
    getPropertyCount: QueryCapability['getPropertyCount'];
    query: QueryCapability['query'];
    worldline: QueryCapability['worldline'];
    observer: QueryCapability['observer'];
    translationCost: QueryCapability['translationCost'];
    getContentOid: QueryCapability['getContentOid'];
    getContentMeta: QueryCapability['getContentMeta'];
    getContent: QueryCapability['getContent'];
    getEdgeContentOid: QueryCapability['getEdgeContentOid'];
    getEdgeContentMeta: QueryCapability['getEdgeContentMeta'];
    getEdgeContent: QueryCapability['getEdgeContent'];
    getContentStream: QueryCapability['getContentStream'];
    getEdgeContentStream: QueryCapability['getEdgeContentStream'];
    fork: ForkController['fork'];
    createWormhole: ForkController['createWormhole'];
    _isAncestor: ForkController['_isAncestor'];
    _relationToCheckpointHead: ForkController['_relationToCheckpointHead'];
    _validatePatchAgainstCheckpoint: ForkController['_validatePatchAgainstCheckpoint'];
    patchesFor: ProvenanceController['patchesFor'];
    _computeBackwardCone: ProvenanceController['_computeBackwardCone'];
    loadPatchBySha: ProvenanceController['loadPatchBySha'];
    _loadPatchBySha: ProvenanceController['_loadPatchBySha'];
    _loadPatchesBySha: ProvenanceController['_loadPatchesBySha'];
    _sortPatchesCausally: ProvenanceController['_sortPatchesCausally'];
    subscribe: SubscriptionController['subscribe'];
    watch: SubscriptionController['watch'];
    _notifySubscribers: SubscriptionController['_notifySubscribers'];
    buildPatchDivergence: ComparisonController['buildPatchDivergence'];
    compareStrand: ComparisonController['compareStrand'];
    planStrandTransfer: ComparisonController['planStrandTransfer'];
    planCoordinateTransfer: ComparisonController['planCoordinateTransfer'];
    compareCoordinates: ComparisonController['compareCoordinates'];
    diff: ComparisonController['diff'];
    getFrontier: SyncController['getFrontier'];
    hasFrontierChanged: SyncController['hasFrontierChanged'];
    status: SyncController['status'];
    createSyncRequest: SyncController['createSyncRequest'];
    processSyncRequest: SyncController['processSyncRequest'];
    applySyncResponse: SyncController['applySyncResponse'];
    syncNeeded: SyncController['syncNeeded'];
    syncWith: SyncController['syncWith'];
    serve: SyncController['serve'];
    /**
     * Returns the attached seek cache, or null if none is set.
     */
    get seekCache(): SeekCachePort | null;
    /**
     * Attaches a persistent seek cache after construction.
     */
    setSeekCache(cache: SeekCachePort): void;
    /**
     * Builds a SyncTrustGate from a resolved trust configuration.
     */
    _buildTrustGate(config: NormalizedTrustConfig): SyncTrustGate;
    /**
     * Extracts trusted writer IDs from a trust assessment result.
     */
    _extractTrustedWriters(assessment: {
        trust: {
            explanations: ReadonlyArray<{
                trusted: boolean;
                writerId: string;
            }>;
        };
    }): {
        trusted: Set<string>;
    };
    /**
     * Extracts the maximum Lamport timestamp from a WarpState.
     */
    _maxLamportFromState(state: WarpState): number;
    /**
     * Opens a multi-writer graph.
     *
     * @example
     * const graph = await RuntimeHost.open({
     *   persistence: gitAdapter,
     *   graphName: 'events',
     *   writerId: 'node-1'
     * });
     */
    static open(options: RuntimeHostOpenInput): Promise<RuntimeHost>;
    /** Gets the graph name. */
    get graphName(): string;
    /** Gets the writer ID. */
    get writerId(): string;
    /** Gets the persistence adapter. */
    get persistence(): CorePersistence;
    /** Gets the onDeleteWithData policy. */
    get onDeleteWithData(): 'reject' | 'cascade' | 'warn';
    /** Gets the current GC policy. */
    get gcPolicy(): GCPolicy;
    /**
     * Gets the temporal query interface for CTL*-style temporal operators.
     *
     * Returns a TemporalQuery instance that provides `always` and `eventually`
     * operators for evaluating predicates across the graph's history.
     */
    get temporal(): TemporalQuery;
    /**
     * Gets the current provenance index for this graph.
     */
    get provenanceIndex(): ProvenanceIndex | null;
    /**
     * Callback invoked by MaterializeController after every materialization.
     * Applies all host-level side effects: state caching, index build,
     * subscriber notification, GC, auto-checkpoint, timing.
     */
    _onMaterialized(result: MaterializeResult): Promise<void>;
    /**
     * Builds bitmap index from materialized state.
     */
    _buildViewFromResult(result: {
        state: WarpState;
        stateHash: string;
        diff?: PatchDiff | null | undefined;
    }): void;
    _tryAutoCheckpoint(patchCount: number): Promise<void>;
    _notifyAfterMaterialize(state: WarpState): void;
}
export declare function openRuntimeHost(options: RuntimeHostOpenInput): Promise<RuntimeHost>;
export {};
