@hviana/sema 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/AGENTS.md +6 -5
  2. package/CITATION.cff +49 -0
  3. package/HOW_IT_WORKS.md +11 -12
  4. package/README.md +7 -5
  5. package/dist/example/demo.js +25 -25
  6. package/dist/example/train_base.d.ts +19 -21
  7. package/dist/example/train_base.js +1687 -1952
  8. package/dist/src/alphabet.d.ts +3 -3
  9. package/dist/src/alphabet.js +24 -27
  10. package/dist/src/alu/src/alu.d.ts +169 -194
  11. package/dist/src/alu/src/alu.js +374 -414
  12. package/dist/src/alu/src/expr.d.ts +36 -43
  13. package/dist/src/alu/src/expr.js +252 -278
  14. package/dist/src/alu/src/index.d.ts +9 -98
  15. package/dist/src/alu/src/index.js +10 -64
  16. package/dist/src/alu/src/kernel-arith.d.ts +1 -5
  17. package/dist/src/alu/src/kernel-arith.js +195 -285
  18. package/dist/src/alu/src/kernel-bits.d.ts +1 -5
  19. package/dist/src/alu/src/kernel-bits.js +81 -115
  20. package/dist/src/alu/src/kernel-logic.js +33 -63
  21. package/dist/src/alu/src/kernel-nd.js +155 -195
  22. package/dist/src/alu/src/kernel-numeric.d.ts +16 -80
  23. package/dist/src/alu/src/kernel-numeric.js +259 -331
  24. package/dist/src/alu/src/operation.d.ts +112 -132
  25. package/dist/src/alu/src/operation.js +149 -163
  26. package/dist/src/alu/src/parser.d.ts +168 -175
  27. package/dist/src/alu/src/parser.js +382 -421
  28. package/dist/src/alu/src/resonance.d.ts +16 -25
  29. package/dist/src/alu/src/resonance.js +49 -56
  30. package/dist/src/alu/src/text.d.ts +3 -7
  31. package/dist/src/alu/src/text.js +31 -37
  32. package/dist/src/alu/src/value.d.ts +14 -14
  33. package/dist/src/alu/src/value.js +150 -160
  34. package/dist/src/alu/test/alu.test.js +543 -656
  35. package/dist/src/bytes.d.ts +1 -5
  36. package/dist/src/bytes.js +33 -40
  37. package/dist/src/config.d.ts +99 -102
  38. package/dist/src/config.js +78 -83
  39. package/dist/src/derive/src/deduction.d.ts +60 -62
  40. package/dist/src/derive/src/deduction.js +103 -109
  41. package/dist/src/derive/src/index.d.ts +1 -7
  42. package/dist/src/derive/src/priority-queue.d.ts +8 -8
  43. package/dist/src/derive/src/priority-queue.js +57 -61
  44. package/dist/src/derive/src/rewrite.d.ts +15 -18
  45. package/dist/src/derive/src/rewrite.js +59 -67
  46. package/dist/src/derive/src/trie.d.ts +56 -56
  47. package/dist/src/derive/src/trie.js +175 -179
  48. package/dist/src/derive/test/derive.test.js +96 -100
  49. package/dist/src/extension.d.ts +13 -16
  50. package/dist/src/geometry.d.ts +17 -42
  51. package/dist/src/geometry.js +235 -266
  52. package/dist/src/index.d.ts +2 -17
  53. package/dist/src/index.js +2 -12
  54. package/dist/src/ingest-cache.d.ts +25 -30
  55. package/dist/src/ingest-cache.js +108 -127
  56. package/dist/src/mind/articulation.d.ts +1 -5
  57. package/dist/src/mind/articulation.js +77 -112
  58. package/dist/src/mind/attention.d.ts +40 -108
  59. package/dist/src/mind/attention.js +749 -871
  60. package/dist/src/mind/canonical.d.ts +4 -19
  61. package/dist/src/mind/canonical.js +27 -31
  62. package/dist/src/mind/graph-search.d.ts +201 -225
  63. package/dist/src/mind/graph-search.js +742 -821
  64. package/dist/src/mind/index.d.ts +2 -10
  65. package/dist/src/mind/junction.d.ts +31 -58
  66. package/dist/src/mind/junction.js +172 -237
  67. package/dist/src/mind/learning.d.ts +16 -52
  68. package/dist/src/mind/learning.js +143 -165
  69. package/dist/src/mind/match.d.ts +20 -69
  70. package/dist/src/mind/match.js +259 -318
  71. package/dist/src/mind/mechanisms/alu.js +16 -16
  72. package/dist/src/mind/mechanisms/cast.d.ts +9 -13
  73. package/dist/src/mind/mechanisms/cast.js +363 -456
  74. package/dist/src/mind/mechanisms/confluence.d.ts +8 -12
  75. package/dist/src/mind/mechanisms/confluence.js +152 -183
  76. package/dist/src/mind/mechanisms/cover.d.ts +2 -8
  77. package/dist/src/mind/mechanisms/cover.js +148 -210
  78. package/dist/src/mind/mechanisms/extraction.d.ts +8 -34
  79. package/dist/src/mind/mechanisms/extraction.js +234 -288
  80. package/dist/src/mind/mechanisms/recall.d.ts +6 -10
  81. package/dist/src/mind/mechanisms/recall.js +126 -185
  82. package/dist/src/mind/mind.d.ts +129 -154
  83. package/dist/src/mind/mind.js +258 -288
  84. package/dist/src/mind/pipeline-mechanism.d.ts +112 -124
  85. package/dist/src/mind/pipeline-mechanism.js +161 -172
  86. package/dist/src/mind/pipeline.d.ts +4 -14
  87. package/dist/src/mind/pipeline.js +125 -189
  88. package/dist/src/mind/primitives.d.ts +8 -32
  89. package/dist/src/mind/primitives.js +99 -117
  90. package/dist/src/mind/rationale.d.ts +86 -98
  91. package/dist/src/mind/rationale.js +113 -121
  92. package/dist/src/mind/reasoning.d.ts +2 -13
  93. package/dist/src/mind/reasoning.js +129 -166
  94. package/dist/src/mind/recognition.d.ts +1 -4
  95. package/dist/src/mind/recognition.js +183 -208
  96. package/dist/src/mind/resonance.d.ts +5 -22
  97. package/dist/src/mind/resonance.js +0 -0
  98. package/dist/src/mind/trace.d.ts +6 -25
  99. package/dist/src/mind/trace.js +50 -58
  100. package/dist/src/mind/traverse.d.ts +16 -58
  101. package/dist/src/mind/traverse.js +304 -357
  102. package/dist/src/mind/types.d.ts +120 -127
  103. package/dist/src/mind/types.js +60 -69
  104. package/dist/src/rabitq-ivf/src/database.d.ts +113 -0
  105. package/dist/src/rabitq-ivf/src/database.js +201 -0
  106. package/dist/src/rabitq-ivf/src/index.d.ts +7 -0
  107. package/dist/src/{rabitq-hnsw → rabitq-ivf}/src/index.js +1 -3
  108. package/dist/src/rabitq-ivf/src/ivf.d.ts +200 -0
  109. package/dist/src/rabitq-ivf/src/ivf.js +1165 -0
  110. package/dist/src/rabitq-ivf/src/prng.d.ts +19 -0
  111. package/dist/src/rabitq-ivf/src/prng.js +36 -0
  112. package/dist/src/rabitq-ivf/src/rabitq.d.ts +95 -0
  113. package/dist/src/rabitq-ivf/src/rabitq.js +283 -0
  114. package/dist/src/sema.d.ts +9 -13
  115. package/dist/src/sema.js +26 -40
  116. package/dist/src/store-sqlite.d.ts +169 -166
  117. package/dist/src/store-sqlite.js +762 -662
  118. package/dist/src/store.d.ts +586 -630
  119. package/dist/src/store.js +1423 -1581
  120. package/dist/src/vec.d.ts +5 -9
  121. package/dist/src/vec.js +61 -73
  122. package/example/train_base.ts +13 -10
  123. package/package.json +1 -1
  124. package/src/alu/README.md +1 -1
  125. package/src/alu/src/index.ts +1 -1
  126. package/src/config.ts +19 -27
  127. package/src/index.ts +6 -11
  128. package/src/rabitq-ivf/README.md +56 -0
  129. package/src/rabitq-ivf/src/database.ts +276 -0
  130. package/src/{rabitq-hnsw → rabitq-ivf}/src/index.ts +2 -5
  131. package/src/rabitq-ivf/src/ivf.ts +1330 -0
  132. package/src/{rabitq-hnsw → rabitq-ivf}/src/prng.ts +1 -1
  133. package/src/store-sqlite.ts +196 -9
  134. package/src/store.ts +8 -32
  135. package/test/08-storage.test.mjs +3 -3
  136. package/test/14-scaling.test.mjs +2 -2
  137. package/test/35-ivf.test.mjs +263 -0
  138. package/test/36-bloom.test.mjs +123 -0
  139. package/dist/src/rabitq-hnsw/src/database.d.ts +0 -202
  140. package/dist/src/rabitq-hnsw/src/database.js +0 -405
  141. package/dist/src/rabitq-hnsw/src/heap.d.ts +0 -22
  142. package/dist/src/rabitq-hnsw/src/heap.js +0 -94
  143. package/dist/src/rabitq-hnsw/src/hnsw.d.ts +0 -125
  144. package/dist/src/rabitq-hnsw/src/hnsw.js +0 -500
  145. package/dist/src/rabitq-hnsw/src/index.d.ts +0 -15
  146. package/dist/src/rabitq-hnsw/src/prng.d.ts +0 -19
  147. package/dist/src/rabitq-hnsw/src/prng.js +0 -38
  148. package/dist/src/rabitq-hnsw/src/rabitq.d.ts +0 -95
  149. package/dist/src/rabitq-hnsw/src/rabitq.js +0 -299
  150. package/dist/src/rabitq-hnsw/src/store.d.ts +0 -162
  151. package/dist/src/rabitq-hnsw/src/store.js +0 -916
  152. package/dist/src/rabitq-hnsw/test/hnsw.test.d.ts +0 -1
  153. package/dist/src/rabitq-hnsw/test/hnsw.test.js +0 -1197
  154. package/src/rabitq-hnsw/README.md +0 -303
  155. package/src/rabitq-hnsw/src/database.ts +0 -492
  156. package/src/rabitq-hnsw/src/heap.ts +0 -90
  157. package/src/rabitq-hnsw/src/hnsw.ts +0 -514
  158. package/src/rabitq-hnsw/src/store.ts +0 -994
  159. package/src/rabitq-hnsw/test/hnsw.test.ts +0 -1213
  160. /package/src/{rabitq-hnsw → rabitq-ivf}/src/rabitq.ts +0 -0
@@ -8,165 +8,140 @@ import { GraphSearch, type Leaf, type Site } from "./graph-search.js";
8
8
  import type { ComputedSpan, ExtensionHost } from "../extension.js";
9
9
  export type { ComputedSpan, ExtensionHost };
10
10
  import { type InspectRationale, Rationale } from "./rationale.js";
11
- export type {
12
- InspectRationale,
13
- RationaleItem,
14
- RationaleStep,
15
- } from "./rationale.js";
11
+ export type { InspectRationale, RationaleItem, RationaleStep, } from "./rationale.js";
16
12
  export type Input = string | Uint8Array | Grid | Grid[];
17
13
  export interface Response {
18
- v: Vec | null;
19
- bytes: Uint8Array;
20
- /** How the answer was grounded (see {@link Provenance}). `"recall-echo"`
21
- * marks the last-resort fallback that returned the nearest stored form's
22
- * own bytes verbatim — an echo, NOT a grounded fact. Absent when there is
23
- * no answer. */
24
- provenance?: import("./pipeline.js").Provenance;
14
+ v: Vec | null;
15
+ bytes: Uint8Array;
16
+ /** How the answer was grounded (see {@link Provenance}). `"recall-echo"`
17
+ * marks the last-resort fallback that returned the nearest stored form's
18
+ * own bytes verbatim — an echo, NOT a grounded fact. Absent when there is
19
+ * no answer. */
20
+ provenance?: import("./pipeline.js").Provenance;
25
21
  }
26
22
  import type { AttentionRead, MindContext, Recognition } from "./types.js";
27
23
  export interface MindOptions {
28
- seed?: number;
29
- recallQueryK?: number;
30
- haloQueryK?: number;
31
- normalizeEpsilon?: number;
32
- cosineEpsilon?: number;
33
- geometry?: Partial<import("../config.js").GeometryConfig>;
34
- alphabet?: Partial<import("../config.js").AlphabetConfig>;
35
- storeConfig?: Partial<import("../config.js").StoreConfig>;
36
- store?: Store;
37
- /** Additional grounding mechanisms (appended after the built-in defaults). */
38
- mechanisms?: import("./pipeline-mechanism.js").PipelineMechanism[];
39
- /** Factories that receive the {@link ExtensionHost} and return mechanisms. */
40
- mechanismFactories?: ((
41
- host: import("../extension.js").ExtensionHost,
42
- ) => import("./pipeline-mechanism.js").PipelineMechanism)[];
24
+ seed?: number;
25
+ recallQueryK?: number;
26
+ haloQueryK?: number;
27
+ normalizeEpsilon?: number;
28
+ cosineEpsilon?: number;
29
+ geometry?: Partial<import("../config.js").GeometryConfig>;
30
+ alphabet?: Partial<import("../config.js").AlphabetConfig>;
31
+ storeConfig?: Partial<import("../config.js").StoreConfig>;
32
+ store?: Store;
33
+ /** Additional grounding mechanisms (appended after the built-in defaults). */
34
+ mechanisms?: import("./pipeline-mechanism.js").PipelineMechanism[];
35
+ /** Factories that receive the {@link ExtensionHost} and return mechanisms. */
36
+ mechanismFactories?: ((host: import("../extension.js").ExtensionHost) => import("./pipeline-mechanism.js").PipelineMechanism)[];
43
37
  }
44
38
  export declare class Mind implements MindContext {
45
- readonly space: Space;
46
- readonly alphabet: Alphabet;
47
- readonly store: Store;
48
- readonly cfg: MindConfig;
49
- /** The lightest-derivation engine over the Sema graph. */
50
- readonly search: GraphSearch;
51
- /** The grounding mechanisms iterated by {@link think}. */
52
- readonly mechanisms: import("./pipeline-mechanism.js").PipelineMechanism[];
53
- /** The live rationale tracer for the inference currently in flight, or null. */
54
- trace: Rationale | null;
55
- /** Per-response memo of the consensus climb. NOTE: this memo and
56
- * {@link recogniseMemo} are BYPASSED while a rationale trace is attached
57
- * (every mechanism must emit its own steps), so a traced respond re-pays
58
- * up to four consensus climbs plus repeat recognitions — that is where the
59
- * traced-vs-untraced latency multiple comes from, by design. */
60
- climbMemo: WeakMap<Uint8Array, Map<string, AttentionRead>> | null;
61
- /** Per-response memo of recognise() — see {@link MindContext.recogniseMemo}. */
62
- recogniseMemo: WeakMap<Uint8Array, Recognition> | null;
63
- /** Per-response memo of perceive() — see {@link MindContext.perceiveMemo}. */
64
- perceiveMemo: Map<string, import("../sema.js").Sema> | null;
65
- /** The perceived gist of the query currently being answered. Set by `think`
66
- * before the graph search runs; `chooseNext` consults it as a gate (a null
67
- * guide means no query is in flight, so structural walkers keep plain
68
- * first-edge behaviour) and the reverse projection uses it for
69
- * reverse-recall disambiguation via `chooseAmong`. */
70
- _edgeGuide: Vec | null;
71
- /** Per-response memo of {@link chooseNext} picks — ensures every mechanism
72
- * of a single response follows the SAME continuation for each ambiguous
73
- * context node. */
74
- _edgeChoice: Map<number, number>;
75
- /** Previous deposit's seen node ids for incremental change detection. */
76
- _prevSeen: Set<number> | null;
77
- /** Session cache of node-id → perceived gist for candidate scoring — see
78
- * {@link MindContext._gistCache}. 32 MB ≈ 8K gists at D=1024; hub
79
- * candidate sets (√N at most) fit comfortably and recur across queries. */
80
- _gistCache: BoundedMap<number, Vec>;
81
- _depositTrees: BoundedMap<string, import("../geometry.js").FoldPyramid>;
82
- _depositLens: Set<number>;
83
- _internIds: WeakMap<Sema, number>;
84
- /** Canonical node id of a byte span. Required by GraphSearchHost & MindContext. */
85
- resolve(bytes: Uint8Array): number | null;
86
- recogniseSpan(bytes: Uint8Array): {
87
- sites: ReadonlyArray<Site>;
88
- leaves: ReadonlyArray<Leaf>;
89
- splits: ReadonlySet<number>;
90
- };
91
- /** Disambiguate among multiple learnt continuations of the same context node.
92
- * Required by {@link GraphSearchHost} — the graph search calls this through the
93
- * host interface when a recognised form has more than one outgoing edge.
94
- * Delegates to the standalone {@link chooseNext} which picks the candidate
95
- * with the most distributional evidence (highest `prevOf` count — the
96
- * structural manifestation of its halo). When evidence is equal the
97
- * first-inserted edge wins. */
98
- chooseNext(node: number): number | undefined;
99
- constructor(opts?: MindOptions);
100
- constructor(cfg: MindConfig, store: Store, _fromStore: true);
101
- /** Exposed for tests: the consensus climb over query sub-regions. */
102
- climbAttention(
103
- query: Uint8Array,
104
- k: number,
105
- mode?: import("./types.js").DFMode,
106
- ): Promise<import("./types.js").Attention[]>;
107
- /** Exposed for tests: climb the structural DAG from a node to its
108
- * edge-bearing ancestor contexts. */
109
- edgeAncestors(
110
- id: number,
111
- contextCount: number,
112
- ): import("./types.js").AncestorReach;
113
- /** Exposed for tests: find the natural break point in a sorted vote list. */
114
- naturalBreak(votes: number[]): number;
115
- /** Perceive input into a content-defined tree. Deterministic — identical
116
- * bytes always produce an identical tree. Public for ingest-cache. */
117
- perceive(
118
- input: Input,
119
- leafAt?: (i: number) => number | null,
120
- lookup?: (ids: number[]) => number | null,
121
- ): Sema;
122
- /** Open one response's transient state — the tracer and the per-response
123
- * memos. Paired with {@link endResponse}; the ONE place this state is
124
- * created, so adding a memo cannot forget its reset. */
125
- private beginResponse;
126
- /** Close one response's transient state every per-response field, incl.
127
- * the edge guide/choices `think` sets mid-flight. */
128
- private endResponse;
129
- respond(input: Input, inspectRationale?: InspectRationale): Promise<Response>;
130
- /** Text view of {@link respond}. NUL bytes (0x00) are stripped before
131
- * decoding — they are structural padding in text answers. LOSSY for a
132
- * binary answer that legitimately contains NULs: use {@link respond} and
133
- * read `bytes` directly for binary/grid modalities. */
134
- respondText(
135
- input: string,
136
- inspectRationale?: InspectRationale,
137
- ): Promise<string>;
138
- embedding(input: Input): Promise<Vec | null>;
139
- /** Kinship note: the vector arm below is a miniature of recall's tier 3
140
- * (resonate reach gate read out the nearest form's bytes) — the
141
- * read-out direction of the same operation, without recall's grounding
142
- * ladder. If either side's acceptance rule changes, revisit the other. */
143
- express(idOrV: number | Vec): Promise<Uint8Array>;
144
- ingest(
145
- input: Input | (Input | [Input, Input])[],
146
- second?: Input,
147
- ): Promise<
148
- (Sema & {
149
- id: number;
150
- }) | undefined
151
- >;
152
- private extensionHost;
153
- private groundedContinuation;
154
- /** Re-index structurally-important nodes whose gists were evicted from the
155
- * pending cache before they reached the content index. See {@link
156
- * Store.repairContentIndex} for the contract; this method wires the
157
- * Mind's perception into the store's repair walk.
158
- *
159
- * Run this after training or at checkpoints to restore recall reach for
160
- * nodes that bridge experiences but were never indexed. A pure interior
161
- * node (no edges, no halo) is deliberately skipped — it is scaffolding,
162
- * not an experience root or bridge, and regenerating its gist would waste
163
- * I/O and index space for no recall benefit.
164
- *
165
- * @param minParents only repair nodes with ≥ this many structural parents
166
- * (default 2 — structural bridges)
167
- * @returns number of nodes added to the content index */
168
- repairContentIndex(minParents?: number): Promise<number>;
169
- save(): Promise<Uint8Array>;
170
- static load(snapshot: Uint8Array, store: Store): Promise<Mind>;
171
- static loadFromStore(store: Store): Promise<Mind>;
39
+ readonly space: Space;
40
+ readonly alphabet: Alphabet;
41
+ readonly store: Store;
42
+ readonly cfg: MindConfig;
43
+ /** The lightest-derivation engine over the Sema graph. */
44
+ readonly search: GraphSearch;
45
+ /** The grounding mechanisms iterated by {@link think}. */
46
+ readonly mechanisms: import("./pipeline-mechanism.js").PipelineMechanism[];
47
+ /** The live rationale tracer for the inference currently in flight, or null. */
48
+ trace: Rationale | null;
49
+ /** Per-response memo of the consensus climb. NOTE: this memo and
50
+ * {@link recogniseMemo} are BYPASSED while a rationale trace is attached
51
+ * (every mechanism must emit its own steps), so a traced respond re-pays
52
+ * up to four consensus climbs plus repeat recognitions — that is where the
53
+ * traced-vs-untraced latency multiple comes from, by design. */
54
+ climbMemo: WeakMap<Uint8Array, Map<string, AttentionRead>> | null;
55
+ /** Per-response memo of recognise() — see {@link MindContext.recogniseMemo}. */
56
+ recogniseMemo: WeakMap<Uint8Array, Recognition> | null;
57
+ /** Per-response memo of perceive() — see {@link MindContext.perceiveMemo}. */
58
+ perceiveMemo: Map<string, import("../sema.js").Sema> | null;
59
+ /** The perceived gist of the query currently being answered. Set by `think`
60
+ * before the graph search runs; `chooseNext` consults it as a gate (a null
61
+ * guide means no query is in flight, so structural walkers keep plain
62
+ * first-edge behaviour) and the reverse projection uses it for
63
+ * reverse-recall disambiguation via `chooseAmong`. */
64
+ _edgeGuide: Vec | null;
65
+ /** Per-response memo of {@link chooseNext} picks — ensures every mechanism
66
+ * of a single response follows the SAME continuation for each ambiguous
67
+ * context node. */
68
+ _edgeChoice: Map<number, number>;
69
+ /** Previous deposit's seen node ids for incremental change detection. */
70
+ _prevSeen: Set<number> | null;
71
+ /** Session cache of node-id → perceived gist for candidate scoring — see
72
+ * {@link MindContext._gistCache}. 32 MB ≈ 8K gists at D=1024; hub
73
+ * candidate sets (√N at most) fit comfortably and recur across queries. */
74
+ _gistCache: BoundedMap<number, Vec>;
75
+ _depositTrees: BoundedMap<string, import("../geometry.js").FoldPyramid>;
76
+ _depositLens: Set<number>;
77
+ _internIds: WeakMap<Sema, number>;
78
+ /** Canonical node id of a byte span. Required by GraphSearchHost & MindContext. */
79
+ resolve(bytes: Uint8Array): number | null;
80
+ recogniseSpan(bytes: Uint8Array): {
81
+ sites: ReadonlyArray<Site>;
82
+ leaves: ReadonlyArray<Leaf>;
83
+ splits: ReadonlySet<number>;
84
+ };
85
+ /** Disambiguate among multiple learnt continuations of the same context node.
86
+ * Required by {@link GraphSearchHost} — the graph search calls this through the
87
+ * host interface when a recognised form has more than one outgoing edge.
88
+ * Delegates to the standalone {@link chooseNext} which picks the candidate
89
+ * with the most distributional evidence (highest `prevOf` count — the
90
+ * structural manifestation of its halo). When evidence is equal the
91
+ * first-inserted edge wins. */
92
+ chooseNext(node: number): number | undefined;
93
+ constructor(opts?: MindOptions);
94
+ constructor(cfg: MindConfig, store: Store, _fromStore: true);
95
+ /** Exposed for tests: the consensus climb over query sub-regions. */
96
+ climbAttention(query: Uint8Array, k: number, mode?: import("./types.js").DFMode): Promise<import("./types.js").Attention[]>;
97
+ /** Exposed for tests: climb the structural DAG from a node to its
98
+ * edge-bearing ancestor contexts. */
99
+ edgeAncestors(id: number, contextCount: number): import("./types.js").AncestorReach;
100
+ /** Exposed for tests: find the natural break point in a sorted vote list. */
101
+ naturalBreak(votes: number[]): number;
102
+ /** Perceive input into a content-defined tree. Deterministic — identical
103
+ * bytes always produce an identical tree. Public for ingest-cache. */
104
+ perceive(input: Input, leafAt?: (i: number) => number | null, lookup?: (ids: number[]) => number | null): Sema;
105
+ /** Open one response's transient state — the tracer and the per-response
106
+ * memos. Paired with {@link endResponse}; the ONE place this state is
107
+ * created, so adding a memo cannot forget its reset. */
108
+ private beginResponse;
109
+ /** Close one response's transient state — every per-response field, incl.
110
+ * the edge guide/choices `think` sets mid-flight. */
111
+ private endResponse;
112
+ respond(input: Input, inspectRationale?: InspectRationale): Promise<Response>;
113
+ /** Text view of {@link respond}. NUL bytes (0x00) are stripped before
114
+ * decoding they are structural padding in text answers. LOSSY for a
115
+ * binary answer that legitimately contains NULs: use {@link respond} and
116
+ * read `bytes` directly for binary/grid modalities. */
117
+ respondText(input: string, inspectRationale?: InspectRationale): Promise<string>;
118
+ embedding(input: Input): Promise<Vec | null>;
119
+ /** Kinship note: the vector arm below is a miniature of recall's tier 3
120
+ * (resonate reach gate read out the nearest form's bytes) — the
121
+ * read-out direction of the same operation, without recall's grounding
122
+ * ladder. If either side's acceptance rule changes, revisit the other. */
123
+ express(idOrV: number | Vec): Promise<Uint8Array>;
124
+ ingest(input: Input | (Input | [Input, Input])[], second?: Input): Promise<(Sema & {
125
+ id: number;
126
+ }) | undefined>;
127
+ private extensionHost;
128
+ private groundedContinuation;
129
+ /** Re-index structurally-important nodes whose gists were evicted from the
130
+ * pending cache before they reached the content index. See {@link
131
+ * Store.repairContentIndex} for the contract; this method wires the
132
+ * Mind's perception into the store's repair walk.
133
+ *
134
+ * Run this after training or at checkpoints to restore recall reach for
135
+ * nodes that bridge experiences but were never indexed. A pure interior
136
+ * node (no edges, no halo) is deliberately skipped it is scaffolding,
137
+ * not an experience root or bridge, and regenerating its gist would waste
138
+ * I/O and index space for no recall benefit.
139
+ *
140
+ * @param minParents only repair nodes with ≥ this many structural parents
141
+ * (default 2 — structural bridges)
142
+ * @returns number of nodes added to the content index */
143
+ repairContentIndex(minParents?: number): Promise<number>;
144
+ save(): Promise<Uint8Array>;
145
+ static load(snapshot: Uint8Array, store: Store): Promise<Mind>;
146
+ static loadFromStore(store: Store): Promise<Mind>;
172
147
  }