@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
@@ -1,171 +1,174 @@
1
- import {
2
- AbstractStore,
3
- type NodeId,
4
- type NodeRec,
5
- type Store,
6
- } from "./store.js";
1
+ import { AbstractStore, type NodeId, type NodeRec, type Store } from "./store.js";
7
2
  import { type StoreConfig } from "./config.js";
8
3
  export interface SQliteStoreOptions extends Partial<StoreConfig> {
9
- path?: string;
10
- D?: number;
11
- /** Fold group size used during training — tells indexSubtree how tight the
12
- * reach-net epsilon should be (1 − 1/(2·maxGroup)). Defaults to the
13
- * Mind's geometry.maxGroup. */
14
- maxGroup?: number;
15
- /** Query-side RaBitQ estimator precision for both vector indices. */
16
- queryBits?: number;
4
+ path?: string;
5
+ D?: number;
6
+ /** Fold group size used during training — tells indexSubtree how tight the
7
+ * reach-net epsilon should be (1 − 1/(2·maxGroup)). Defaults to the
8
+ * Mind's geometry.maxGroup. */
9
+ maxGroup?: number;
10
+ /** Query-side RaBitQ estimator precision for both vector indices. */
11
+ queryBits?: number;
17
12
  }
18
13
  export declare class SQliteStore extends AbstractStore implements Store {
19
- private readonly opts;
20
- private readonly vectorCacheMb;
21
- private readonly vectorSeed;
22
- private content;
23
- private halos;
24
- private sqlite;
25
- private _inTx;
26
- private _insertNode;
27
- private _insertKid;
28
- private _selContain;
29
- private _selParents;
30
- private _selHalo;
31
- private _upHalo;
32
- private _selLeaf;
33
- private _selFlat;
34
- private _selKids;
35
- private _selNode;
36
- private _insertEdge;
37
- private _selNext;
38
- private _selPrev;
39
- private _setMeta;
40
- private _getMeta;
41
- private _delMeta;
42
- private _insSnapshot;
43
- private _selSnapshot;
44
- constructor(opts?: SQliteStoreOptions);
45
- private vectorDbPath;
46
- private openVectorDB;
47
- protected _dbOpen(): Promise<void>;
48
- protected _dbClose(): void;
49
- protected _dbBeginTx(): void;
50
- protected _dbCommitTx(): void;
51
- protected _dbInsertNode(
52
- id: NodeId,
53
- leaf: Uint8Array | null,
54
- kids: Uint8Array | null,
55
- h: number,
56
- ): void;
57
- protected _dbGetNode(id: NodeId): NodeRec | null;
58
- protected _dbFindLeaf(h: number, bytes: Uint8Array): NodeId | null;
59
- protected _dbFindBranchByLeaf(h: number, bytes: Uint8Array): NodeId | null;
60
- protected _dbFindBranchByKids(h: number, packed: Uint8Array): NodeId | null;
61
- protected _dbInsertKid(child: NodeId, parent: NodeId): void;
62
- protected _dbGetParents(id: NodeId): NodeId[];
63
- private _selParentsFirst;
64
- protected _dbGetParentsFirst(id: NodeId, limit: number): NodeId[];
65
- private _selChain;
66
- /** {@link Store.chainRun}'s walk as ONE recursive CTE: the whole
67
- * transparent chain (no edge in or out, exactly one parent) is descended
68
- * inside SQLite per-node work is the same three indexed probes as the
69
- * base class's loop, but without a JS↔SQLite round trip per node, which
70
- * dominates on the deep single-structure scaffolding this read exists
71
- * for. */
72
- protected _chainWalk(id: NodeId, cap: number): NodeId[];
73
- /** Width of the seq band inside the packed contain rowid: rowid =
74
- * child·SEQ_SPAN + seq. Page sizes are geometric, so a chain of k live
75
- * pages needs a base of ≥ 2^k · 4 bytes — seq stays ≤ ~50 for any
76
- * physically possible list; the append path guards the band anyway. */
77
- private static readonly SEQ_SPAN;
78
- private _selContainExists;
79
- protected _dbContainExists(child: NodeId): boolean;
80
- private _selContainPages;
81
- /** The child's page directory — (seq, byte length) per page, O(log fan-in)
82
- * rows, each read from the cell header without loading the blob. */
83
- private containPages;
84
- private _selContainPageSub;
85
- private _selContainPage;
86
- private containPage;
87
- protected _dbGetContainParentsSlice(
88
- child: NodeId,
89
- offset: number,
90
- limit: number,
91
- ): NodeId[];
92
- private _selContainCount;
93
- protected _dbGetContainCount(child: NodeId): number;
94
- protected _dbGetContainParents(child: NodeId): NodeId[];
95
- private _upsContainPage;
96
- private _delContainPage;
97
- protected _dbAppendContain(child: NodeId, parents: NodeId[]): void;
98
- protected _dbInsertEdge(src: NodeId, dst: NodeId): void;
99
- protected _dbGetNextEdges(id: NodeId): NodeId[];
100
- protected _dbGetPrevEdges(id: NodeId): NodeId[];
101
- private _selNextFirst;
102
- protected _dbGetNextEdgesFirst(id: NodeId, limit: number): NodeId[];
103
- private _selPrevFirst;
104
- protected _dbGetPrevEdgesFirst(id: NodeId, limit: number): NodeId[];
105
- private _selPrevCount;
106
- /** {@link Store.prevCount} — one indexed COUNT over idx_edge_dst, never a
107
- * row materialisation (a common continuation's reverse fan-in is
108
- * corpus-sized). */
109
- prevCount(id: NodeId): number;
110
- private _selSrcExists;
111
- protected _dbEdgeSrcExists(src: NodeId): boolean;
112
- protected _dbEdgeDistinctSrcCount(): number;
113
- protected _dbGetHalo(id: NodeId): {
114
- vec: Uint8Array;
115
- mass: number;
116
- } | null;
117
- protected _dbUpsertHalo(
118
- id: NodeId,
119
- encodedVec: Uint8Array,
120
- mass: number,
121
- ): void;
122
- protected _dbGetMeta(key: string): string | null;
123
- protected _dbSetMeta(key: string, val: string): void;
124
- protected _dbDeleteMeta(key: string): void;
125
- protected _dbSaveSnapshot(bytes: Uint8Array): void;
126
- protected _dbLoadSnapshot(): Uint8Array | null;
127
- protected _vecContentUpsert(
128
- entries: Array<{
129
- id: NodeId;
130
- vector: Float32Array;
131
- ef?: number;
132
- }>,
133
- ): void;
134
- protected _vecContentQuery(v: Float32Array, k: number, ef: number): Array<{
135
- id: number;
136
- distance: number;
137
- }>;
138
- protected _vecContentHas(id: NodeId): boolean;
139
- protected _vecContentSize(): number;
140
- protected _vecContentLastReads(): number;
141
- protected _vecContentPhysicalSize(): number;
142
- protected _vecContentCompact(): void;
143
- protected _vecContentDeleteMany(ids: NodeId[]): void;
144
- protected _vecContentEntriesSince(after: number): IterableIterator<{
145
- ext: NodeId;
146
- internal: number;
147
- }>;
148
- /** {@link AbstractStore._dbEdgeOrHaloIds} — one C-side scan; UNION dedups
149
- * and (with the ORDER BY) sorts, so the result is ready for the binary-
150
- * search membership probes and the ascending-id maintenance walks. */
151
- protected _dbEdgeOrHaloIds(): NodeId[];
152
- protected _vecHaloUpsert(
153
- entries: Array<{
154
- id: NodeId;
155
- vector: Float32Array;
156
- }>,
157
- ): void;
158
- protected _vecHaloQuery(v: Float32Array, k: number, ef: number): Array<{
159
- id: number;
160
- distance: number;
161
- }>;
162
- protected _vecHaloSize(): number;
163
- protected _vecHaloPhysicalSize(): number;
164
- protected _vecHaloCompact(): void;
165
- /** Pre-fill both vector indices' RAM caches with sequential scans (up to
166
- * their budget caps) seconds of streaming instead of the minutes of
167
- * random point reads a cold training/query session otherwise pays while
168
- * warming. Optional; call once after open before sustained work.
169
- * Returns rows warmed. */
170
- warmVectorCaches(): Promise<number>;
14
+ private readonly opts;
15
+ private readonly vectorCacheMb;
16
+ private readonly sqliteCacheMb;
17
+ private readonly vectorSeed;
18
+ private content;
19
+ private halos;
20
+ private sqlite;
21
+ private _inTx;
22
+ /** Bloom filter over every node row's content hash `h`. The dedup probes
23
+ * consult it first: "definitely absent" answers the training hot path's
24
+ * dominant miss case in RAM (profiled: the SQLite probes were 38.7% of
25
+ * ingest wall at 2.9M nodes). INVARIANT: every inserted h is added
26
+ * before the probe that could see it — a false negative would mint a
27
+ * duplicate node and silently break hash-consing. */
28
+ private _bloom;
29
+ /** Dedup probes answered by the filter alone this session (observability). */
30
+ bloomSkips: number;
31
+ private _insertNode;
32
+ private _insertKid;
33
+ private _selContain;
34
+ private _selParents;
35
+ private _selHalo;
36
+ private _upHalo;
37
+ private _selLeaf;
38
+ private _selFlat;
39
+ private _selKids;
40
+ private _selNode;
41
+ private _insertEdge;
42
+ private _selNext;
43
+ private _selPrev;
44
+ private _setMeta;
45
+ private _getMeta;
46
+ private _delMeta;
47
+ private _insSnapshot;
48
+ private _selSnapshot;
49
+ constructor(opts?: SQliteStoreOptions);
50
+ private vectorDbPath;
51
+ private openVectorDB;
52
+ protected _dbOpen(): Promise<void>;
53
+ /** Restore the persisted filter and top up the rows a crash left uncovered
54
+ * (id stored `upto`); a missing/undersized blob forces a full rebuild.
55
+ * Clean-close sessions restart with a 0-row top-up. */
56
+ private _bloomLoad;
57
+ /** Re-add the hashes of rows with id ≥ `from` (the tail a crash cut off).
58
+ * Re-adding a hash twice only re-sets its bits — never a correctness
59
+ * issue so overlap with the persisted coverage is harmless. */
60
+ private _bloomTopUp;
61
+ /** Build a fresh filter sized for the current node count from one
62
+ * sequential scan of the h column. Called at open when no usable blob is
63
+ * stored, and again whenever growth saturates the bits-per-key budget. */
64
+ private _bloomRebuild;
65
+ /** Persist the filter with its coverage watermark. Runs inside the
66
+ * caller's transaction when one is open (checkpoint/close both flush
67
+ * first). */
68
+ private _bloomPersist;
69
+ protected _dbClose(): void;
70
+ protected _dbBeginTx(): void;
71
+ protected _dbCommitTx(): void;
72
+ protected _dbInsertNode(id: NodeId, leaf: Uint8Array | null, kids: Uint8Array | null, h: number): void;
73
+ protected _dbGetNode(id: NodeId): NodeRec | null;
74
+ protected _dbFindLeaf(h: number, bytes: Uint8Array): NodeId | null;
75
+ protected _dbFindBranchByLeaf(h: number, bytes: Uint8Array): NodeId | null;
76
+ protected _dbFindBranchByKids(h: number, packed: Uint8Array): NodeId | null;
77
+ protected _dbInsertKid(child: NodeId, parent: NodeId): void;
78
+ protected _dbGetParents(id: NodeId): NodeId[];
79
+ private _selParentsFirst;
80
+ protected _dbGetParentsFirst(id: NodeId, limit: number): NodeId[];
81
+ private _selChain;
82
+ /** {@link Store.chainRun}'s walk as ONE recursive CTE: the whole
83
+ * transparent chain (no edge in or out, exactly one parent) is descended
84
+ * inside SQLite — per-node work is the same three indexed probes as the
85
+ * base class's loop, but without a JS↔SQLite round trip per node, which
86
+ * dominates on the deep single-structure scaffolding this read exists
87
+ * for. */
88
+ protected _chainWalk(id: NodeId, cap: number): NodeId[];
89
+ /** Width of the seq band inside the packed contain rowid: rowid =
90
+ * child·SEQ_SPAN + seq. Page sizes are geometric, so a chain of k live
91
+ * pages needs a base of ≥ 2^k · 4 bytes — seq stays ≤ ~50 for any
92
+ * physically possible list; the append path guards the band anyway. */
93
+ private static readonly SEQ_SPAN;
94
+ private _selContainExists;
95
+ protected _dbContainExists(child: NodeId): boolean;
96
+ private _selContainPages;
97
+ /** The child's page directory — (seq, byte length) per page, O(log fan-in)
98
+ * rows, each read from the cell header without loading the blob. */
99
+ private containPages;
100
+ private _selContainPageSub;
101
+ private _selContainPage;
102
+ private containPage;
103
+ protected _dbGetContainParentsSlice(child: NodeId, offset: number, limit: number): NodeId[];
104
+ private _selContainCount;
105
+ protected _dbGetContainCount(child: NodeId): number;
106
+ protected _dbGetContainParents(child: NodeId): NodeId[];
107
+ private _upsContainPage;
108
+ private _delContainPage;
109
+ protected _dbAppendContain(child: NodeId, parents: NodeId[]): void;
110
+ protected _dbInsertEdge(src: NodeId, dst: NodeId): void;
111
+ protected _dbGetNextEdges(id: NodeId): NodeId[];
112
+ protected _dbGetPrevEdges(id: NodeId): NodeId[];
113
+ private _selNextFirst;
114
+ protected _dbGetNextEdgesFirst(id: NodeId, limit: number): NodeId[];
115
+ private _selPrevFirst;
116
+ protected _dbGetPrevEdgesFirst(id: NodeId, limit: number): NodeId[];
117
+ private _selPrevCount;
118
+ /** {@link Store.prevCount} — one indexed COUNT over idx_edge_dst, never a
119
+ * row materialisation (a common continuation's reverse fan-in is
120
+ * corpus-sized). */
121
+ prevCount(id: NodeId): number;
122
+ private _selSrcExists;
123
+ protected _dbEdgeSrcExists(src: NodeId): boolean;
124
+ protected _dbEdgeDistinctSrcCount(): number;
125
+ protected _dbGetHalo(id: NodeId): {
126
+ vec: Uint8Array;
127
+ mass: number;
128
+ } | null;
129
+ protected _dbUpsertHalo(id: NodeId, encodedVec: Uint8Array, mass: number): void;
130
+ protected _dbGetMeta(key: string): string | null;
131
+ protected _dbSetMeta(key: string, val: string): void;
132
+ protected _dbDeleteMeta(key: string): void;
133
+ protected _dbSaveSnapshot(bytes: Uint8Array): void;
134
+ protected _dbLoadSnapshot(): Uint8Array | null;
135
+ protected _vecContentUpsert(entries: Array<{
136
+ id: NodeId;
137
+ vector: Float32Array;
138
+ }>): void;
139
+ protected _vecContentQuery(v: Float32Array, k: number, ef: number): Array<{
140
+ id: number;
141
+ distance: number;
142
+ }>;
143
+ protected _vecContentHas(id: NodeId): boolean;
144
+ protected _vecContentSize(): number;
145
+ protected _vecContentLastReads(): number;
146
+ protected _vecContentPhysicalSize(): number;
147
+ protected _vecContentCompact(): void;
148
+ protected _vecContentDeleteMany(ids: NodeId[]): void;
149
+ protected _vecContentEntriesSince(after: number): IterableIterator<{
150
+ ext: NodeId;
151
+ internal: number;
152
+ }>;
153
+ /** {@link AbstractStore._dbEdgeOrHaloIds} one C-side scan; UNION dedups
154
+ * and (with the ORDER BY) sorts, so the result is ready for the binary-
155
+ * search membership probes and the ascending-id maintenance walks. */
156
+ protected _dbEdgeOrHaloIds(): NodeId[];
157
+ protected _vecHaloUpsert(entries: Array<{
158
+ id: NodeId;
159
+ vector: Float32Array;
160
+ }>): void;
161
+ protected _vecHaloQuery(v: Float32Array, k: number, ef: number): Array<{
162
+ id: number;
163
+ distance: number;
164
+ }>;
165
+ protected _vecHaloSize(): number;
166
+ protected _vecHaloPhysicalSize(): number;
167
+ protected _vecHaloCompact(): void;
168
+ /** Pre-fill both vector indices' RAM caches with sequential scans (up to
169
+ * their budget caps) — seconds of streaming instead of the minutes of
170
+ * random point reads a cold training/query session otherwise pays while
171
+ * warming. Optional; call once after open before sustained work.
172
+ * Returns rows warmed. */
173
+ warmVectorCaches(): Promise<number>;
171
174
  }