import { Sema } from "../sema.js"; import type { Input, MindContext } from "./types.js"; /** Intern a perceived tree into node ids, bottom-up, sharing equal subtrees. * Returns the root node id and a map from tree nodes to their ids. * * Memoized by NODE IDENTITY (ctx._internIds): the pyramid fold shares a * prefix's subtree OBJECTS across an accumulated context's deposits, and a * node already interned needs nothing again — its id is permanent * (content-addressed) and its intern-time side effects (gist capture, kid * rows) fired at first mint; re-interning was pure lookups. A memo hit * therefore skips the WHOLE shared subtree, making the intern walk * O(new nodes) per deposit instead of O(context). Only the hit node * itself enters `ids`; descendants stay reachable via the memo (see * idOf in indexSubSpans and the changedNodes prune). */ export declare function internTreeIds(ctx: MindContext, node: Sema, ids: Map): Promise; /** Index flat branches for sub-spans of a deposit's byte stream, linked to * their structural chunks via durable CONTAINMENT edges. */ export declare function indexSubSpans(ctx: MindContext, tree: Sema, ids: Map): Promise; /** Perceive, intern, and index a single input. Returns the perceived tree, * root id, id map, and the changed (new) subtrees for halo reinforcement. */ export declare function deposit(ctx: MindContext, input: Input, track: boolean, conversational?: boolean): Promise<{ tree: Sema; rootId: number; ids: Map; changed: Sema[]; }>; /** Ingest a single input (a bare experience, no continuation). */ export declare function ingestOne(ctx: MindContext, input: Input): Promise; /** What one ingested item deposited — reported through {@link ingest}'s * optional `onDeposit` callback. Pure provenance read-out: node ids are * content-addressed, so two byte-identical items report the SAME ids (that * is content addressing working, not an error), and the callback observes * the deposit without influencing it. */ export interface DepositReport { /** Zero-based position of the item in the ingested input (0 for a scalar * or single pair). */ index: number; /** Whether the item was a bare experience or a (context, continuation) * pair. */ kind: "one" | "pair"; /** Root node id of the item's (context) bytes. */ contextId: number; /** Root node id of the continuation bytes — pairs only. */ continuationId?: number; } /** Ingest a pair (context, continuation) — learn an edge and pour halos. * Returns the deposited root ids (context, continuation) — a pure * read-out; callers that ignore it behave exactly as before. */ export declare function ingestPair(ctx: MindContext, ctxInput: Input, cont: Input): Promise<{ ctxId: number; contId: number; }>; /** Dispatch the public ingest input shapes onto one-input / pair handlers — * THE one reading of ingest's polymorphic surface (scalar, (context, * continuation) pair, or a list mixing bare inputs and pairs). Both ingest * paths — the direct one below and {@link CachedIngest} — route through * this, so the shape-detection can never drift between them again (the * ingest cache once re-implemented it and drifted). */ export declare function dispatchIngest(input: Input | (Input | [Input, Input])[], second: Input | undefined, onOne: (input: Input) => Promise, onPair: (ctxInput: Input, cont: Input) => Promise): Promise<(Sema & { id: number; }) | undefined>; /** Ingest an input or array of inputs/pairs. The public ingest entry point. * * `onDeposit`, when given, is invoked once per ingested item with the * deposited root node ids ({@link DepositReport}) — item-level provenance * for tooling that needs to know which stored node an ingested item became. * Purely observational: the callback runs after the item's deposit * completed and nothing reads its result. */ export declare function ingest(ctx: MindContext, input: Input | (Input | [Input, Input])[], second?: Input, onDeposit?: (report: DepositReport) => void): Promise<(Sema & { id: number; }) | undefined>;