@graphrefly/ts 0.0.0

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 (210) hide show
  1. package/LICENSE +21 -0
  2. package/dist/adapters/index.cjs +9015 -0
  3. package/dist/adapters/index.cjs.map +1 -0
  4. package/dist/adapters/index.d.cts +678 -0
  5. package/dist/adapters/index.d.ts +678 -0
  6. package/dist/adapters/index.js +2894 -0
  7. package/dist/adapters/index.js.map +1 -0
  8. package/dist/adapters/observe-storage.cjs +260 -0
  9. package/dist/adapters/observe-storage.cjs.map +1 -0
  10. package/dist/adapters/observe-storage.d.cts +77 -0
  11. package/dist/adapters/observe-storage.d.ts +77 -0
  12. package/dist/adapters/observe-storage.js +161 -0
  13. package/dist/adapters/observe-storage.js.map +1 -0
  14. package/dist/append-log-DisvEReb.d.cts +189 -0
  15. package/dist/append-log-DzKMmjxx.d.ts +189 -0
  16. package/dist/chunk-2ILL7HQI.js +1189 -0
  17. package/dist/chunk-2ILL7HQI.js.map +1 -0
  18. package/dist/chunk-4VLAQHZI.js +330 -0
  19. package/dist/chunk-4VLAQHZI.js.map +1 -0
  20. package/dist/chunk-6PHB5CJS.js +229 -0
  21. package/dist/chunk-6PHB5CJS.js.map +1 -0
  22. package/dist/chunk-COHO25CZ.js +2449 -0
  23. package/dist/chunk-COHO25CZ.js.map +1 -0
  24. package/dist/chunk-D6BG7U6A.js +161 -0
  25. package/dist/chunk-D6BG7U6A.js.map +1 -0
  26. package/dist/chunk-DJC4CHLQ.js +818 -0
  27. package/dist/chunk-DJC4CHLQ.js.map +1 -0
  28. package/dist/chunk-DK554R7P.js +67 -0
  29. package/dist/chunk-DK554R7P.js.map +1 -0
  30. package/dist/chunk-DKP56CSW.js +322 -0
  31. package/dist/chunk-DKP56CSW.js.map +1 -0
  32. package/dist/chunk-G4M3NHRJ.js +688 -0
  33. package/dist/chunk-G4M3NHRJ.js.map +1 -0
  34. package/dist/chunk-GAJW5I5P.js +1 -0
  35. package/dist/chunk-GAJW5I5P.js.map +1 -0
  36. package/dist/chunk-GDL26N2T.js +282 -0
  37. package/dist/chunk-GDL26N2T.js.map +1 -0
  38. package/dist/chunk-GTPCOEOZ.js +741 -0
  39. package/dist/chunk-GTPCOEOZ.js.map +1 -0
  40. package/dist/chunk-H2HTHFVN.js +1 -0
  41. package/dist/chunk-H2HTHFVN.js.map +1 -0
  42. package/dist/chunk-HDRL4VQQ.js +218 -0
  43. package/dist/chunk-HDRL4VQQ.js.map +1 -0
  44. package/dist/chunk-I3IHOHCJ.js +2267 -0
  45. package/dist/chunk-I3IHOHCJ.js.map +1 -0
  46. package/dist/chunk-JIMUDQN3.js +965 -0
  47. package/dist/chunk-JIMUDQN3.js.map +1 -0
  48. package/dist/chunk-JR4IKCR2.js +462 -0
  49. package/dist/chunk-JR4IKCR2.js.map +1 -0
  50. package/dist/chunk-K3FXTC3I.js +165 -0
  51. package/dist/chunk-K3FXTC3I.js.map +1 -0
  52. package/dist/chunk-OOEN33FB.js +65 -0
  53. package/dist/chunk-OOEN33FB.js.map +1 -0
  54. package/dist/chunk-PKVBHGBM.js +554 -0
  55. package/dist/chunk-PKVBHGBM.js.map +1 -0
  56. package/dist/chunk-RIIOUTGM.js +1857 -0
  57. package/dist/chunk-RIIOUTGM.js.map +1 -0
  58. package/dist/chunk-SCRFRCGR.js +33 -0
  59. package/dist/chunk-SCRFRCGR.js.map +1 -0
  60. package/dist/chunk-SWTLEQL6.js +53 -0
  61. package/dist/chunk-SWTLEQL6.js.map +1 -0
  62. package/dist/chunk-SZAETNNA.js +1 -0
  63. package/dist/chunk-SZAETNNA.js.map +1 -0
  64. package/dist/chunk-TEW47IVR.js +49 -0
  65. package/dist/chunk-TEW47IVR.js.map +1 -0
  66. package/dist/chunk-Y3ZLRGHC.js +1482 -0
  67. package/dist/chunk-Y3ZLRGHC.js.map +1 -0
  68. package/dist/chunk-Z2ANQ6JW.js +149 -0
  69. package/dist/chunk-Z2ANQ6JW.js.map +1 -0
  70. package/dist/codec-BB7p8fJc.d.cts +38 -0
  71. package/dist/codec-BB7p8fJc.d.ts +38 -0
  72. package/dist/composition/index.cjs +2505 -0
  73. package/dist/composition/index.cjs.map +1 -0
  74. package/dist/composition/index.d.cts +95 -0
  75. package/dist/composition/index.d.ts +95 -0
  76. package/dist/composition/index.js +19 -0
  77. package/dist/composition/index.js.map +1 -0
  78. package/dist/core/index.cjs +2475 -0
  79. package/dist/core/index.cjs.map +1 -0
  80. package/dist/core/index.d.cts +25 -0
  81. package/dist/core/index.d.ts +25 -0
  82. package/dist/core/index.js +74 -0
  83. package/dist/core/index.js.map +1 -0
  84. package/dist/cqrs/index.cjs +595 -0
  85. package/dist/cqrs/index.cjs.map +1 -0
  86. package/dist/cqrs/index.d.cts +200 -0
  87. package/dist/cqrs/index.d.ts +200 -0
  88. package/dist/cqrs/index.js +557 -0
  89. package/dist/cqrs/index.js.map +1 -0
  90. package/dist/data-structures/index.cjs +4277 -0
  91. package/dist/data-structures/index.cjs.map +1 -0
  92. package/dist/data-structures/index.d.cts +22 -0
  93. package/dist/data-structures/index.d.ts +22 -0
  94. package/dist/data-structures/index.js +31 -0
  95. package/dist/data-structures/index.js.map +1 -0
  96. package/dist/describe-BZb7AS2y.d.ts +57 -0
  97. package/dist/describe-Ciu8SUnN.d.cts +57 -0
  98. package/dist/graph/index.cjs +7832 -0
  99. package/dist/graph/index.cjs.map +1 -0
  100. package/dist/graph/index.d.cts +251 -0
  101. package/dist/graph/index.d.ts +251 -0
  102. package/dist/graph/index.js +131 -0
  103. package/dist/graph/index.js.map +1 -0
  104. package/dist/graph-DfdF9zy4.d.ts +666 -0
  105. package/dist/graph-s23RbbFO.d.cts +666 -0
  106. package/dist/index-CAEmLCYF.d.cts +166 -0
  107. package/dist/index-SnzZu3x7.d.ts +166 -0
  108. package/dist/index.cjs +15409 -0
  109. package/dist/index.cjs.map +1 -0
  110. package/dist/index.d.cts +23 -0
  111. package/dist/index.d.ts +23 -0
  112. package/dist/index.js +582 -0
  113. package/dist/index.js.map +1 -0
  114. package/dist/messages-BZqrGGm1.d.cts +55 -0
  115. package/dist/messages-BZqrGGm1.d.ts +55 -0
  116. package/dist/messaging/index.cjs +818 -0
  117. package/dist/messaging/index.cjs.map +1 -0
  118. package/dist/messaging/index.d.cts +235 -0
  119. package/dist/messaging/index.d.ts +235 -0
  120. package/dist/messaging/index.js +767 -0
  121. package/dist/messaging/index.js.map +1 -0
  122. package/dist/observe-event-log-0SVsx7JG.d.cts +88 -0
  123. package/dist/observe-event-log-Dnm76owp.d.ts +88 -0
  124. package/dist/operators/index.cjs +3774 -0
  125. package/dist/operators/index.cjs.map +1 -0
  126. package/dist/operators/index.d.cts +308 -0
  127. package/dist/operators/index.d.ts +308 -0
  128. package/dist/operators/index.js +112 -0
  129. package/dist/operators/index.js.map +1 -0
  130. package/dist/orchestration/index.cjs +3541 -0
  131. package/dist/orchestration/index.cjs.map +1 -0
  132. package/dist/orchestration/index.d.cts +302 -0
  133. package/dist/orchestration/index.d.ts +302 -0
  134. package/dist/orchestration/index.js +1004 -0
  135. package/dist/orchestration/index.js.map +1 -0
  136. package/dist/patterns/index.cjs +1045 -0
  137. package/dist/patterns/index.cjs.map +1 -0
  138. package/dist/patterns/index.d.cts +39 -0
  139. package/dist/patterns/index.d.ts +39 -0
  140. package/dist/patterns/index.js +33 -0
  141. package/dist/patterns/index.js.map +1 -0
  142. package/dist/reactive-collection-BxBqtIOE.d.cts +344 -0
  143. package/dist/reactive-collection-Cb1II1Fi.d.ts +344 -0
  144. package/dist/reactive-collection-storage-BNiEc-Gd.d.ts +217 -0
  145. package/dist/reactive-collection-storage-D-KmjE0J.d.cts +217 -0
  146. package/dist/reactive-map-BcB4KsQR.d.ts +256 -0
  147. package/dist/reactive-map-D-g3dv8I.d.cts +256 -0
  148. package/dist/read-through-B1CYPfq_.d.cts +82 -0
  149. package/dist/read-through-DwyJhGs1.d.ts +82 -0
  150. package/dist/render/index.cjs +250 -0
  151. package/dist/render/index.cjs.map +1 -0
  152. package/dist/render/index.d.cts +58 -0
  153. package/dist/render/index.d.ts +58 -0
  154. package/dist/render/index.js +20 -0
  155. package/dist/render/index.js.map +1 -0
  156. package/dist/resilience-Dig3Q7n0.d.cts +45 -0
  157. package/dist/resilience-Dig3Q7n0.d.ts +45 -0
  158. package/dist/semantic-memory-graph-BYoIlP35.d.cts +356 -0
  159. package/dist/semantic-memory-graph-CxyXLms3.d.ts +356 -0
  160. package/dist/solutions/index.cjs +3249 -0
  161. package/dist/solutions/index.cjs.map +1 -0
  162. package/dist/solutions/index.d.cts +520 -0
  163. package/dist/solutions/index.d.ts +520 -0
  164. package/dist/solutions/index.js +31 -0
  165. package/dist/solutions/index.js.map +1 -0
  166. package/dist/sources/browser.cjs +3095 -0
  167. package/dist/sources/browser.cjs.map +1 -0
  168. package/dist/sources/browser.d.cts +39 -0
  169. package/dist/sources/browser.d.ts +39 -0
  170. package/dist/sources/browser.js +137 -0
  171. package/dist/sources/browser.js.map +1 -0
  172. package/dist/sources/index.cjs +3021 -0
  173. package/dist/sources/index.cjs.map +1 -0
  174. package/dist/sources/index.d.cts +7 -0
  175. package/dist/sources/index.d.ts +7 -0
  176. package/dist/sources/index.js +63 -0
  177. package/dist/sources/index.js.map +1 -0
  178. package/dist/sources/node.cjs +675 -0
  179. package/dist/sources/node.cjs.map +1 -0
  180. package/dist/sources/node.d.cts +109 -0
  181. package/dist/sources/node.d.ts +109 -0
  182. package/dist/sources/node.js +639 -0
  183. package/dist/sources/node.js.map +1 -0
  184. package/dist/storage/browser.cjs +777 -0
  185. package/dist/storage/browser.cjs.map +1 -0
  186. package/dist/storage/browser.d.cts +40 -0
  187. package/dist/storage/browser.d.ts +40 -0
  188. package/dist/storage/browser.js +275 -0
  189. package/dist/storage/browser.js.map +1 -0
  190. package/dist/storage/index.cjs +1989 -0
  191. package/dist/storage/index.cjs.map +1 -0
  192. package/dist/storage/index.d.cts +92 -0
  193. package/dist/storage/index.d.ts +92 -0
  194. package/dist/storage/index.js +161 -0
  195. package/dist/storage/index.js.map +1 -0
  196. package/dist/storage/node.cjs +898 -0
  197. package/dist/storage/node.cjs.map +1 -0
  198. package/dist/storage/node.d.cts +66 -0
  199. package/dist/storage/node.d.ts +66 -0
  200. package/dist/storage/node.js +402 -0
  201. package/dist/storage/node.js.map +1 -0
  202. package/dist/testing/index.cjs +95 -0
  203. package/dist/testing/index.cjs.map +1 -0
  204. package/dist/testing/index.d.cts +20 -0
  205. package/dist/testing/index.d.ts +20 -0
  206. package/dist/testing/index.js +8 -0
  207. package/dist/testing/index.js.map +1 -0
  208. package/dist/types-bNMSWKqF.d.cts +732 -0
  209. package/dist/types-h12mNYbq.d.ts +732 -0
  210. package/package.json +250 -0
@@ -0,0 +1,356 @@
1
+ import { d as Graph } from './graph-DfdF9zy4.js';
2
+ import { N as Node } from './types-h12mNYbq.js';
3
+ import { b as StrictJsonValue } from './codec-BB7p8fJc.js';
4
+
5
+ /**
6
+ * Passive semantic-memory vocabulary and deterministic helpers.
7
+ *
8
+ * D158 splits semantic memory into horizontal patterns and vertical solutions.
9
+ * This module intentionally owns no graph nodes, storage restore, timers,
10
+ * subscriptions, vector indexes, knowledge graphs, or agentic runtime.
11
+ */
12
+
13
+ /** Stable identity for a semantic-memory fact. */
14
+ type FactId = string;
15
+ /** Shard partition key used by passive sharding helpers. */
16
+ type ShardKey = string | number;
17
+ /**
18
+ * A single semantic-memory fact. Pattern convention only: this is not a
19
+ * protocol message, storage record owner, restore contract, or graph runtime.
20
+ */
21
+ interface MemoryFragment<T = unknown> {
22
+ readonly id: FactId;
23
+ readonly payload: T;
24
+ /** Transaction time, typically monotonic nanoseconds. */
25
+ readonly tNs: bigint;
26
+ /** Valid-time start. Undefined means unbounded past. */
27
+ readonly validFrom?: bigint;
28
+ /** Valid-time end. Undefined means currently valid. */
29
+ readonly validTo?: bigint;
30
+ /** Confidence score in the closed interval [0, 1]. */
31
+ readonly confidence: number;
32
+ readonly tags: readonly string[];
33
+ /** Fact ids this fragment derives from or depends on. */
34
+ readonly sources: readonly FactId[];
35
+ readonly embedding?: readonly number[];
36
+ readonly parentFragmentId?: FactId;
37
+ readonly provenance?: string;
38
+ }
39
+ /** Columnar passive store vocabulary for callers that keep memory facts outside GraphReFly. */
40
+ interface FactStore<T = unknown> {
41
+ readonly byId: ReadonlyMap<FactId, MemoryFragment<T>>;
42
+ }
43
+ /** Read-only projection passed to scoring policies; it exposes no mutation surface. */
44
+ interface StoreReadHandle<T = unknown> {
45
+ get(id: FactId): MemoryFragment<T> | undefined;
46
+ has(id: FactId): boolean;
47
+ readonly size: number;
48
+ values(): IterableIterator<MemoryFragment<T>>;
49
+ }
50
+ type ScoringPolicy<T = unknown> = (fragment: MemoryFragment<T>, store: StoreReadHandle<T>) => number;
51
+ type DecayPolicy = (confidence: number, ageNs: bigint) => number;
52
+ type AdmissionFilter<T = unknown> = (fragment: MemoryFragment<T>) => boolean;
53
+ /** Outcome signal for policy learning. This is an application fact, not a protocol event. */
54
+ interface OutcomeSignal {
55
+ readonly factId: FactId;
56
+ readonly reward: number;
57
+ }
58
+ /** Passive structured query over semantic-memory facts. */
59
+ interface MemoryQuery {
60
+ readonly tags?: readonly string[];
61
+ readonly asOf?: bigint;
62
+ readonly minConfidence?: number;
63
+ readonly limit?: number;
64
+ }
65
+ interface MemoryAnswer<T = unknown> {
66
+ readonly query: MemoryQuery;
67
+ readonly results: readonly MemoryFragment<T>[];
68
+ }
69
+ type KnowledgeAssertionStrictJsonValue = StrictJsonValue;
70
+ /** Passive KG endpoint vocabulary. Entity ids are DATA keys, not graph node ids. */
71
+ interface KnowledgeAssertionSubject {
72
+ readonly id: FactId;
73
+ readonly type?: string;
74
+ }
75
+ /** Passive KG object/value vocabulary. */
76
+ type KnowledgeAssertionObject = {
77
+ readonly kind: "entity";
78
+ readonly id: FactId;
79
+ readonly type?: string;
80
+ } | {
81
+ readonly kind: "value";
82
+ readonly value: KnowledgeAssertionStrictJsonValue;
83
+ readonly valueType?: string;
84
+ };
85
+ /** Passive KG assertion fact consumed by lower semantic-memory graph patterns. */
86
+ interface KnowledgeAssertion {
87
+ readonly id: FactId;
88
+ readonly recordId?: FactId;
89
+ readonly fragmentId?: FactId;
90
+ readonly subject: KnowledgeAssertionSubject;
91
+ readonly predicate: string;
92
+ readonly object: KnowledgeAssertionObject;
93
+ readonly confidence?: number;
94
+ readonly sources?: readonly FactId[];
95
+ readonly provenance?: string;
96
+ }
97
+ /** Entry vocabulary for ranked collection-like memory views. */
98
+ interface CollectionEntry<T = unknown> {
99
+ readonly id: string;
100
+ readonly value: T;
101
+ readonly createdAtNs: bigint;
102
+ readonly lastAccessNs: bigint;
103
+ readonly baseScore: number;
104
+ }
105
+ type RankedCollectionEntry<T = unknown> = CollectionEntry<T> & {
106
+ readonly score: number;
107
+ };
108
+ type CollectionScoreFn<T = unknown> = (value: T) => number;
109
+ /** Query shape shared by passive retrieval/ranking helpers. */
110
+ interface RetrievalQuery {
111
+ readonly text?: string;
112
+ readonly vector?: readonly number[];
113
+ readonly entityIds?: readonly string[];
114
+ readonly context?: readonly string[];
115
+ }
116
+ interface VectorSearchResult<TMeta = unknown> {
117
+ readonly id: string;
118
+ readonly score: number;
119
+ readonly meta?: TMeta;
120
+ }
121
+ interface RetrievalEntry<TMem = unknown> {
122
+ readonly key: string;
123
+ readonly value: TMem;
124
+ readonly score: number;
125
+ readonly sources: ReadonlyArray<"vector" | "graph" | "store">;
126
+ readonly context?: readonly string[];
127
+ }
128
+ interface RetrievalTrace<TMem = unknown> {
129
+ readonly vectorCandidates: ReadonlyArray<VectorSearchResult<TMem>>;
130
+ readonly graphExpanded: ReadonlyArray<string>;
131
+ readonly ranked: ReadonlyArray<RetrievalEntry<TMem>>;
132
+ readonly packed: ReadonlyArray<RetrievalEntry<TMem>>;
133
+ }
134
+ /** Generic per-dimension thresholds. Any configured dimension below threshold is rejected. */
135
+ type AdmissionThresholds<Dims extends string> = Partial<Record<Dims, number>>;
136
+ interface AdmissionScoredOptions<Dims extends string, TRaw = unknown> {
137
+ readonly scoreFn: (raw: TRaw) => Readonly<Record<Dims, number>>;
138
+ readonly thresholds?: AdmissionThresholds<Dims>;
139
+ }
140
+ interface AdmissionScores {
141
+ readonly persistence: number;
142
+ readonly structure: number;
143
+ readonly personalValue: number;
144
+ }
145
+ interface AdmissionScore3DOptions {
146
+ readonly scoreFn: (raw: unknown) => AdmissionScores;
147
+ readonly persistenceThreshold?: number;
148
+ readonly personalValueThreshold?: number;
149
+ readonly requireStructured?: boolean;
150
+ }
151
+ interface ShardByTenantOptions {
152
+ readonly tenants?: readonly string[];
153
+ readonly shardCount?: number;
154
+ }
155
+ interface ShardByTenantConfig<T = unknown> {
156
+ readonly shardBy: (fragment: MemoryFragment<T>) => ShardKey;
157
+ readonly shardCount: number;
158
+ }
159
+ interface MemoryFragmentValidation {
160
+ readonly ok: boolean;
161
+ readonly errors: readonly string[];
162
+ }
163
+ /** Cosine similarity over zero-padded vectors. Non-finite results normalize to 0. */
164
+ declare function cosineSimilarity(a: readonly number[], b: readonly number[]): number;
165
+ /**
166
+ * Returns true when a fragment is valid at `asOf`.
167
+ *
168
+ * Omitted `asOf` has no clock to compare against, so it admits only fragments
169
+ * that are live and not valid-time delayed.
170
+ */
171
+ declare function memoryFragmentValidAt(fragment: MemoryFragment, asOf?: bigint): boolean;
172
+ /** Pure structured-query predicate over a single fragment. */
173
+ declare function memoryFragmentMatchesQuery(fragment: MemoryFragment, query?: MemoryQuery): boolean;
174
+ /** Filter and rank fragments by confidence desc, then transaction time desc. */
175
+ declare function filterMemoryFragments<T>(fragments: Iterable<MemoryFragment<T>>, query?: MemoryQuery): readonly MemoryFragment<T>[];
176
+ /** Validate the passive MemoryFragment shape without throwing. */
177
+ declare function validateMemoryFragment(value: unknown): MemoryFragmentValidation;
178
+ declare function isMemoryFragment(value: unknown): value is MemoryFragment;
179
+ /**
180
+ * Generic N-dimension admission filter. Missing or non-finite thresholded scores reject.
181
+ */
182
+ declare function admissionScored<Dims extends string, TRaw = unknown>(opts: AdmissionScoredOptions<Dims, TRaw>): (raw: TRaw) => boolean;
183
+ /** Three-axis admission sugar for persistence / structure / personal-value scoring. */
184
+ declare function admissionFilter3D(opts: AdmissionScore3DOptions): (raw: unknown) => boolean;
185
+ /** Build a passive `{ shardBy, shardCount }` pair for tenant-isolated sharding. */
186
+ declare function shardByTenant<T>(tenantOf: (fragment: MemoryFragment<T>) => string, opts?: ShardByTenantOptions): ShardByTenantConfig<T>;
187
+
188
+ /**
189
+ * Graph-visible semantic-memory retrieval patterns.
190
+ *
191
+ * D158 allows horizontal semantic-memory patterns when they are ordinary graph
192
+ * nodes with declared deps and graph-visible facts. This file intentionally
193
+ * owns no storage restore/hydration, scheduler, hidden subscription, vector DB,
194
+ * retention loop, consolidation loop, Graph subclass, or protocol behavior.
195
+ */
196
+
197
+ /** Query shape for the first graph-visible retrieval bundle. */
198
+ interface MemoryRetrievalQuery extends MemoryQuery {
199
+ /** Optional dense embedding used only for deterministic in-memory ranking. */
200
+ readonly vector?: readonly number[];
201
+ }
202
+ interface MemoryRetrievalCursor {
203
+ readonly evaluation: number;
204
+ readonly validFragments: number;
205
+ readonly invalidFragments: number;
206
+ readonly resultCount: number;
207
+ }
208
+ type MemoryRetrievalStatusState = "ready" | "empty" | "partial" | "error";
209
+ interface MemoryRetrievalStatus {
210
+ readonly state: MemoryRetrievalStatusState;
211
+ readonly query: MemoryRetrievalQuery;
212
+ readonly cursor: MemoryRetrievalCursor;
213
+ }
214
+ interface MemoryRetrievalIndex<T = unknown> {
215
+ readonly ids: readonly FactId[];
216
+ readonly byId: Readonly<Record<FactId, MemoryFragment<T>>>;
217
+ readonly cursor: MemoryRetrievalCursor;
218
+ }
219
+ type MemoryRetrievalErrorCode = "duplicate-fragment-id" | "invalid-fragments-input" | "invalid-fragment" | "invalid-query" | "invalid-query-vector";
220
+ interface MemoryRetrievalError {
221
+ readonly code: MemoryRetrievalErrorCode;
222
+ readonly message: string;
223
+ readonly index?: number;
224
+ readonly fragment?: unknown;
225
+ readonly validationErrors?: readonly string[];
226
+ readonly cursor: MemoryRetrievalCursor;
227
+ }
228
+ interface MemoryRetrievalSnapshot<T = unknown> {
229
+ readonly fragments: readonly MemoryFragment<T>[];
230
+ readonly indexed: MemoryRetrievalIndex<T>;
231
+ readonly ranked: MemoryAnswer<T>;
232
+ readonly status: MemoryRetrievalStatus;
233
+ readonly errors: readonly MemoryRetrievalError[];
234
+ readonly cursor: MemoryRetrievalCursor;
235
+ }
236
+ type MemoryRetrievalFact<T = unknown> = MemoryRetrievalSnapshot<T>;
237
+ interface KnowledgeGraphEntity {
238
+ readonly id: FactId;
239
+ readonly type?: string;
240
+ readonly assertionIds: readonly FactId[];
241
+ readonly subjectAssertionIds: readonly FactId[];
242
+ readonly objectAssertionIds: readonly FactId[];
243
+ }
244
+ interface KnowledgeGraphRelation {
245
+ readonly assertionId: FactId;
246
+ readonly subject: KnowledgeAssertionSubject;
247
+ readonly predicate: string;
248
+ readonly object: KnowledgeAssertionObject;
249
+ readonly confidence?: number;
250
+ readonly sources: readonly FactId[];
251
+ readonly provenance?: string;
252
+ }
253
+ interface KnowledgeGraphTopic {
254
+ readonly predicate: string;
255
+ readonly assertionIds: readonly FactId[];
256
+ readonly entityIds: readonly FactId[];
257
+ }
258
+ interface KnowledgeGraphIndex {
259
+ readonly assertionIds: readonly FactId[];
260
+ readonly entityIds: readonly FactId[];
261
+ readonly relationIds: readonly FactId[];
262
+ readonly predicates: readonly string[];
263
+ }
264
+ interface KnowledgeGraphPolicy {
265
+ readonly allowedPredicates?: readonly string[];
266
+ readonly requireEntityTypes?: boolean;
267
+ }
268
+ interface KnowledgeGraphCursor {
269
+ readonly evaluation: number;
270
+ readonly validAssertions: number;
271
+ readonly invalidAssertions: number;
272
+ readonly entityCount: number;
273
+ readonly relationCount: number;
274
+ readonly predicateCount: number;
275
+ }
276
+ type KnowledgeGraphStatusState = "ready" | "empty" | "partial" | "error";
277
+ interface KnowledgeGraphStatus {
278
+ readonly state: KnowledgeGraphStatusState;
279
+ readonly cursor: KnowledgeGraphCursor;
280
+ }
281
+ type KnowledgeGraphErrorCode = "invalid-assertions-input" | "invalid-assertion" | "duplicate-assertion-id" | "invalid-policy" | "policy-conflict";
282
+ interface KnowledgeGraphError {
283
+ readonly code: KnowledgeGraphErrorCode;
284
+ readonly message: string;
285
+ readonly index?: number;
286
+ readonly assertionId?: FactId;
287
+ readonly assertion?: unknown;
288
+ readonly validationErrors?: readonly string[];
289
+ readonly cursor: KnowledgeGraphCursor;
290
+ }
291
+ interface KnowledgeGraphSnapshot {
292
+ readonly assertions: readonly KnowledgeAssertion[];
293
+ readonly entities: readonly KnowledgeGraphEntity[];
294
+ readonly relations: readonly KnowledgeGraphRelation[];
295
+ readonly topics: readonly KnowledgeGraphTopic[];
296
+ readonly index: KnowledgeGraphIndex;
297
+ readonly status: KnowledgeGraphStatus;
298
+ readonly errors: readonly KnowledgeGraphError[];
299
+ readonly cursor: KnowledgeGraphCursor;
300
+ }
301
+ interface KnowledgeGraphReducerBundle {
302
+ readonly input: {
303
+ readonly assertions: Node<readonly unknown[]>;
304
+ readonly policy?: Node<KnowledgeGraphPolicy>;
305
+ };
306
+ readonly snapshot: Node<KnowledgeGraphSnapshot>;
307
+ readonly assertions: Node<readonly KnowledgeAssertion[]>;
308
+ readonly entities: Node<readonly KnowledgeGraphEntity[]>;
309
+ readonly relations: Node<readonly KnowledgeGraphRelation[]>;
310
+ readonly topics: Node<readonly KnowledgeGraphTopic[]>;
311
+ readonly index: Node<KnowledgeGraphIndex>;
312
+ readonly status: Node<KnowledgeGraphStatus>;
313
+ readonly errors: Node<readonly KnowledgeGraphError[]>;
314
+ readonly cursor: Node<KnowledgeGraphCursor>;
315
+ }
316
+ interface KnowledgeGraphReducerBundleOptions {
317
+ readonly name?: string;
318
+ readonly assertions: Node<readonly unknown[]>;
319
+ readonly policy?: Node<KnowledgeGraphPolicy>;
320
+ }
321
+ interface MemoryRetrievalBundle<T = unknown> {
322
+ readonly input: {
323
+ readonly fragments: Node<readonly unknown[]>;
324
+ readonly query: Node<MemoryRetrievalQuery>;
325
+ };
326
+ readonly snapshot: Node<MemoryRetrievalSnapshot<T>>;
327
+ readonly fragments: Node<readonly MemoryFragment<T>[]>;
328
+ readonly indexed: Node<MemoryRetrievalIndex<T>>;
329
+ readonly ranked: Node<MemoryAnswer<T>>;
330
+ readonly status: Node<MemoryRetrievalStatus>;
331
+ readonly errors: Node<readonly MemoryRetrievalError[]>;
332
+ readonly cursor: Node<MemoryRetrievalCursor>;
333
+ }
334
+ interface MemoryRetrievalBundleOptions {
335
+ readonly name?: string;
336
+ readonly fragments: Node<readonly unknown[]>;
337
+ readonly query: Node<MemoryRetrievalQuery>;
338
+ }
339
+ /**
340
+ * Build a graph-visible memory retrieval bundle from explicit fragment/query deps.
341
+ *
342
+ * Invalid fragments and ranking status are emitted as ordinary DATA facts. The
343
+ * bundle never owns storage restore or hidden mutation; callers that need
344
+ * persistence compose D161 collection/storage sidecars outside this pattern.
345
+ */
346
+ declare function memoryRetrievalBundle<T = unknown>(graph: Graph, opts: MemoryRetrievalBundleOptions): MemoryRetrievalBundle<T>;
347
+ /**
348
+ * D170 lower semantic-memory KG materializer.
349
+ *
350
+ * Assertion, entity, relation, and topic ids remain DATA keys. The bundle has
351
+ * static describe-visible topology and owns no storage, LLM extraction,
352
+ * scheduler, agent runtime, or dynamic graph node lifecycle.
353
+ */
354
+ declare function knowledgeGraphReducerBundle(graph: Graph, opts: KnowledgeGraphReducerBundleOptions): KnowledgeGraphReducerBundle;
355
+
356
+ export { type VectorSearchResult as $, type AdmissionFilter as A, type MemoryRetrievalBundle as B, type CollectionEntry as C, type DecayPolicy as D, type MemoryRetrievalBundleOptions as E, type FactId as F, type MemoryRetrievalCursor as G, type MemoryRetrievalError as H, type MemoryRetrievalErrorCode as I, type MemoryRetrievalFact as J, type KnowledgeAssertion as K, type MemoryRetrievalIndex as L, type MemoryAnswer as M, type MemoryRetrievalQuery as N, type MemoryRetrievalSnapshot as O, type MemoryRetrievalStatus as P, type MemoryRetrievalStatusState as Q, type OutcomeSignal as R, type RankedCollectionEntry as S, type RetrievalEntry as T, type RetrievalQuery as U, type RetrievalTrace as V, type ScoringPolicy as W, type ShardByTenantConfig as X, type ShardByTenantOptions as Y, type ShardKey as Z, type StoreReadHandle as _, type KnowledgeAssertionObject as a, admissionFilter3D as a0, admissionScored as a1, cosineSimilarity as a2, filterMemoryFragments as a3, isMemoryFragment as a4, memoryFragmentMatchesQuery as a5, memoryFragmentValidAt as a6, memoryRetrievalBundle as a7, shardByTenant as a8, validateMemoryFragment as a9, type KnowledgeAssertionStrictJsonValue as b, type KnowledgeAssertionSubject as c, type KnowledgeGraphCursor as d, type KnowledgeGraphEntity as e, type KnowledgeGraphError as f, type KnowledgeGraphErrorCode as g, type KnowledgeGraphIndex as h, type KnowledgeGraphPolicy as i, type KnowledgeGraphReducerBundle as j, type KnowledgeGraphReducerBundleOptions as k, type KnowledgeGraphRelation as l, type KnowledgeGraphSnapshot as m, type KnowledgeGraphStatus as n, type KnowledgeGraphStatusState as o, type KnowledgeGraphTopic as p, knowledgeGraphReducerBundle as q, type AdmissionScore3DOptions as r, type AdmissionScoredOptions as s, type AdmissionScores as t, type AdmissionThresholds as u, type CollectionScoreFn as v, type FactStore as w, type MemoryFragment as x, type MemoryFragmentValidation as y, type MemoryQuery as z };