import { HsonNode } from '../../../core/types.js'; import { HSON_META_QUID } from '../../../core/constants.js'; import { type HsonNodeQuidClaim } from '../../../core/hson-node-quid.js'; import { type LiveTreeRuntime } from "../runtime/livetree-runtime.js"; /** * LiveTree runtime identity registry. * * Each runtime owns an independent QUID claim space. Ownership is an * object-identity concern, not a DOM-mount concern. * Detaching a branch from the DOM or from its parent graph must not release its * claimed QUIDs; detached branches remain valid objects that may be grafted again. * * A runtime's reverse index is weak, but its forward index strongly retains * registered nodes until an explicit identity disposal/reset path calls * `drop_quid()`. */ export declare const LIVETREE_QUID_MINT_RETRY_LIMIT = 32; export type SuppliedLiveTreeQuidReservation = Readonly<{ readonly applied: boolean; claim: () => void; rollback: () => void; release: () => void; }>; export type LiveTreeQuidLineageTransfer = Readonly<{ apply: () => void; }>; /** Generate one canonical 45-bit persisted QUID from secure random bytes. */ export declare function mint_quid(): string; /** Validate one complete incoming graph against LiveTree's active ownership. */ export declare function preflight_livetree_quid_graph(root: HsonNode, runtime?: LiveTreeRuntime): readonly HsonNodeQuidClaim[]; /** * Atomically claim supplied graph identity and ensure identity for its handle root. * * Absent descendants remain unquidded. Supplied descendant QUIDs are active as * soon as the graph is admitted, even before descendant handles are created. */ export declare function admit_livetree_quid_graph(root: HsonNode, runtime?: LiveTreeRuntime): string; /** * Admit only QUIDs supplied by an authority-owned graph. * * Unlike standalone admission, this path never mints and preserves an absent * root claim. It is used by LiveMap-linked Reflection. */ export declare function admit_livetree_quid_graph_preserving_absence(root: HsonNode, runtime?: LiveTreeRuntime): string | undefined; /*************************************** * get_quid * * Return the QUID (stable identity token) * associated with a node, if any. * * Sources: * - n.$_meta["quid"] if present, * - otherwise the NODE_TO_QUID registry. * * Returns `undefined` if the node has never * been assigned a QUID. ***************************************/ export declare function get_quid(n: HsonNode, runtime?: LiveTreeRuntime): string | undefined; /*************************************** * ensure_quid * * Ensure a node has a QUID. * * Behavior: * - Reuses existing QUID if present. * - Otherwise generates a new one via mint_quid(). * - Claims the QUID for this node and indexes both directions: * QUID → node (Map) * node → QUID (WeakMap) * - Rejects any QUID that is already claimed by another node. * - If `persist` (default true), writes the QUID * into n.$_meta["quid"] so it survives * serialization. * * Returns the node’s QUID. ***************************************/ export declare function ensure_quid(n: HsonNode, opts?: { persist?: boolean; }, runtime?: LiveTreeRuntime): string; /*************************************** * get_node_by_quid * * O(1) lookup: * Given a QUID string, return the associated * HsonNode if known. Returns undefined if the * QUID is unregistered. ***************************************/ export declare function get_node_by_quid(q: string, runtime?: LiveTreeRuntime): HsonNode | undefined; /*************************************** * reindex_quid * * Re-establish complete registry bindings for an already-active exact node. * * This is not a detach/remove or restoration operation. An issued-but-inactive * QUID cannot be reindexed onto replacement content in the same runtime. ***************************************/ export declare function reindex_quid(n: HsonNode, runtime?: LiveTreeRuntime): void; export { HSON_META_QUID }; export declare const HSON_QUID_MARKUP_NAME: "hson:quid"; /*************************************** * drop_quid * * Remove a node’s QUID from both registries. * * Behavior: * - Deletes: * QUID_TO_NODE[quid] * NODE_TO_QUID[node] * - If `scrubMeta`, removes the QUID from * n.$_meta so future serialization does not * embed identity. * - If `stripDomAttr`, removes the DOM-side * `hson:quid` attribute if the node is * currently mounted. * * Used when explicitly destroying active identity ownership. The runtime's * issued ledger remains monotonic and is not reset here. * * Not used for normal detach/remove flows. A detached branch still owns its * Hson nodes and persisted QUIDs so it can remain valid while unmounted and may * be grafted again later. ***************************************/ export declare function drop_quid(n: HsonNode, opts?: { scrubMeta?: boolean; stripDomAttr?: boolean; }, runtime?: LiveTreeRuntime): void; /** * Terminally destroy every QUID identity trace in an Hson subtree. * * Traversal is graph-derived and post-order. Registry ownership, persisted * metadata, and mapped DOM attributes are removed for the root and every * descendant without minting or reclaiming identity. */ export declare function destroy_subtree_quids(root: HsonNode, runtime?: LiveTreeRuntime): number; /*************************************** * has_quid * * Boolean check for whether a node already * carries an identity token, either via meta * or registry. ***************************************/ export declare function has_quid(n: HsonNode): boolean; export declare function remint_quid(n: HsonNode, opts?: { persist?: boolean; scrubMeta?: boolean; }, runtime?: LiveTreeRuntime): string; export declare function get_el_if_quid(el: Element): string | undefined; //# sourceMappingURL=data-quid.d.ts.map