@atomicmemory/core 1.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 (589) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/LICENSE +201 -0
  3. package/README.md +314 -0
  4. package/dist/app/bind-ephemeral.d.ts +18 -0
  5. package/dist/app/bind-ephemeral.js +22 -0
  6. package/dist/app/cors-headers.d.ts +12 -0
  7. package/dist/app/cors-headers.js +18 -0
  8. package/dist/app/create-app.d.ts +25 -0
  9. package/dist/app/create-app.js +156 -0
  10. package/dist/app/runtime-config-route-snapshot.d.ts +27 -0
  11. package/dist/app/runtime-config-route-snapshot.js +27 -0
  12. package/dist/app/runtime-container.d.ts +281 -0
  13. package/dist/app/runtime-container.js +297 -0
  14. package/dist/app/startup-checks.d.ts +28 -0
  15. package/dist/app/startup-checks.js +45 -0
  16. package/dist/bin.d.ts +17 -0
  17. package/dist/bin.js +128 -0
  18. package/dist/config.d.ts +680 -0
  19. package/dist/config.js +808 -0
  20. package/dist/db/agent-trust-repository.d.ts +49 -0
  21. package/dist/db/agent-trust-repository.js +66 -0
  22. package/dist/db/belief-edges-repository.d.ts +68 -0
  23. package/dist/db/belief-edges-repository.js +124 -0
  24. package/dist/db/claim-repository.d.ts +6 -0
  25. package/dist/db/claim-repository.js +4 -0
  26. package/dist/db/contradictions-repository.d.ts +56 -0
  27. package/dist/db/contradictions-repository.js +88 -0
  28. package/dist/db/document-chunk-repository.d.ts +48 -0
  29. package/dist/db/document-chunk-repository.js +145 -0
  30. package/dist/db/document-chunk-types.d.ts +35 -0
  31. package/dist/db/document-chunk-types.js +9 -0
  32. package/dist/db/document-list-cursor.d.ts +45 -0
  33. package/dist/db/document-list-cursor.js +111 -0
  34. package/dist/db/document-list-repository.d.ts +103 -0
  35. package/dist/db/document-list-repository.js +204 -0
  36. package/dist/db/entity-cards-repository.d.ts +37 -0
  37. package/dist/db/entity-cards-repository.js +46 -0
  38. package/dist/db/entity-values-repository.d.ts +26 -0
  39. package/dist/db/entity-values-repository.js +57 -0
  40. package/dist/db/link-repository.d.ts +30 -0
  41. package/dist/db/link-repository.js +54 -0
  42. package/dist/db/memory-repository.d.ts +163 -0
  43. package/dist/db/memory-repository.js +232 -0
  44. package/dist/db/migrate.d.ts +6 -0
  45. package/dist/db/migrate.js +36 -0
  46. package/dist/db/mmr.d.ts +14 -0
  47. package/dist/db/mmr.js +57 -0
  48. package/dist/db/passport-feed-repository.d.ts +91 -0
  49. package/dist/db/passport-feed-repository.js +198 -0
  50. package/dist/db/pg-episode-store.d.ts +19 -0
  51. package/dist/db/pg-episode-store.js +17 -0
  52. package/dist/db/pg-link-store.d.ts +17 -0
  53. package/dist/db/pg-link-store.js +14 -0
  54. package/dist/db/pg-memory-store.d.ts +68 -0
  55. package/dist/db/pg-memory-store.js +53 -0
  56. package/dist/db/pg-recap-store.d.ts +13 -0
  57. package/dist/db/pg-recap-store.js +19 -0
  58. package/dist/db/pg-representation-store.d.ts +17 -0
  59. package/dist/db/pg-representation-store.js +17 -0
  60. package/dist/db/pg-search-store.d.ts +29 -0
  61. package/dist/db/pg-search-store.js +47 -0
  62. package/dist/db/pool.d.ts +5 -0
  63. package/dist/db/pool.js +21 -0
  64. package/dist/db/ppr.d.ts +56 -0
  65. package/dist/db/ppr.js +178 -0
  66. package/dist/db/query-helpers.d.ts +44 -0
  67. package/dist/db/query-helpers.js +60 -0
  68. package/dist/db/raw-doc-artifact-sync.d.ts +128 -0
  69. package/dist/db/raw-doc-artifact-sync.js +259 -0
  70. package/dist/db/raw-document-blob-repository.d.ts +148 -0
  71. package/dist/db/raw-document-blob-repository.js +300 -0
  72. package/dist/db/raw-document-repository.d.ts +104 -0
  73. package/dist/db/raw-document-repository.js +410 -0
  74. package/dist/db/raw-document-status-repository.d.ts +122 -0
  75. package/dist/db/raw-document-status-repository.js +183 -0
  76. package/dist/db/raw-document-types.d.ts +236 -0
  77. package/dist/db/raw-document-types.js +10 -0
  78. package/dist/db/raw-storage-reconciliation-repository.d.ts +110 -0
  79. package/dist/db/raw-storage-reconciliation-repository.js +200 -0
  80. package/dist/db/reflection-jobs-repository.d.ts +33 -0
  81. package/dist/db/reflection-jobs-repository.js +48 -0
  82. package/dist/db/reflections-repository.d.ts +41 -0
  83. package/dist/db/reflections-repository.js +83 -0
  84. package/dist/db/repository-claims.d.ts +141 -0
  85. package/dist/db/repository-claims.js +376 -0
  86. package/dist/db/repository-deferred-audn.d.ts +33 -0
  87. package/dist/db/repository-deferred-audn.js +69 -0
  88. package/dist/db/repository-document-delete.d.ts +53 -0
  89. package/dist/db/repository-document-delete.js +156 -0
  90. package/dist/db/repository-entities.d.ts +114 -0
  91. package/dist/db/repository-entities.js +317 -0
  92. package/dist/db/repository-entity-attributes.d.ts +41 -0
  93. package/dist/db/repository-entity-attributes.js +65 -0
  94. package/dist/db/repository-entity-graph.d.ts +32 -0
  95. package/dist/db/repository-entity-graph.js +87 -0
  96. package/dist/db/repository-first-mentions.d.ts +41 -0
  97. package/dist/db/repository-first-mentions.js +79 -0
  98. package/dist/db/repository-lessons.d.ts +51 -0
  99. package/dist/db/repository-lessons.js +90 -0
  100. package/dist/db/repository-links.d.ts +26 -0
  101. package/dist/db/repository-links.js +105 -0
  102. package/dist/db/repository-observation.d.ts +26 -0
  103. package/dist/db/repository-observation.js +51 -0
  104. package/dist/db/repository-read.d.ts +56 -0
  105. package/dist/db/repository-read.js +271 -0
  106. package/dist/db/repository-recaps.d.ts +59 -0
  107. package/dist/db/repository-recaps.js +158 -0
  108. package/dist/db/repository-representations.d.ts +48 -0
  109. package/dist/db/repository-representations.js +162 -0
  110. package/dist/db/repository-temporal-state.d.ts +35 -0
  111. package/dist/db/repository-temporal-state.js +46 -0
  112. package/dist/db/repository-tll.d.ts +88 -0
  113. package/dist/db/repository-tll.js +179 -0
  114. package/dist/db/repository-types.d.ts +313 -0
  115. package/dist/db/repository-types.js +142 -0
  116. package/dist/db/repository-user-profiles.d.ts +17 -0
  117. package/dist/db/repository-user-profiles.js +28 -0
  118. package/dist/db/repository-vector-search.d.ts +33 -0
  119. package/dist/db/repository-vector-search.js +373 -0
  120. package/dist/db/repository-wipe.d.ts +34 -0
  121. package/dist/db/repository-wipe.js +94 -0
  122. package/dist/db/repository-write.d.ts +61 -0
  123. package/dist/db/repository-write.js +279 -0
  124. package/dist/db/schema.sql +1355 -0
  125. package/dist/db/storage-artifact-delete-tx.d.ts +56 -0
  126. package/dist/db/storage-artifact-delete-tx.js +123 -0
  127. package/dist/db/storage-artifact-providers.d.ts +21 -0
  128. package/dist/db/storage-artifact-providers.js +21 -0
  129. package/dist/db/storage-artifact-recovery-repository.d.ts +66 -0
  130. package/dist/db/storage-artifact-recovery-repository.js +58 -0
  131. package/dist/db/storage-artifact-repository.d.ts +329 -0
  132. package/dist/db/storage-artifact-repository.js +497 -0
  133. package/dist/db/stores.d.ts +220 -0
  134. package/dist/db/stores.js +12 -0
  135. package/dist/db/summaries-repository.d.ts +74 -0
  136. package/dist/db/summaries-repository.js +125 -0
  137. package/dist/eval/beam-10m-loader.d.ts +98 -0
  138. package/dist/eval/beam-10m-loader.js +128 -0
  139. package/dist/index.d.ts +18 -0
  140. package/dist/index.js +17 -0
  141. package/dist/middleware/require-bearer.d.ts +27 -0
  142. package/dist/middleware/require-bearer.js +60 -0
  143. package/dist/middleware/validate-response.d.ts +33 -0
  144. package/dist/middleware/validate-response.js +55 -0
  145. package/dist/middleware/validate.d.ts +43 -0
  146. package/dist/middleware/validate.js +85 -0
  147. package/dist/routes/agents.d.ts +13 -0
  148. package/dist/routes/agents.js +89 -0
  149. package/dist/routes/document-response-formatters.d.ts +98 -0
  150. package/dist/routes/document-response-formatters.js +243 -0
  151. package/dist/routes/documents.d.ts +74 -0
  152. package/dist/routes/documents.js +425 -0
  153. package/dist/routes/memories.d.ts +29 -0
  154. package/dist/routes/memories.js +725 -0
  155. package/dist/routes/memory-response-formatters.d.ts +179 -0
  156. package/dist/routes/memory-response-formatters.js +210 -0
  157. package/dist/routes/public-raw-storage-metadata.d.ts +54 -0
  158. package/dist/routes/public-raw-storage-metadata.js +56 -0
  159. package/dist/routes/reflect.d.ts +14 -0
  160. package/dist/routes/reflect.js +19 -0
  161. package/dist/routes/response-schema-map.d.ts +14 -0
  162. package/dist/routes/response-schema-map.js +69 -0
  163. package/dist/routes/route-errors.d.ts +12 -0
  164. package/dist/routes/route-errors.js +30 -0
  165. package/dist/routes/storage-error-handlers.d.ts +34 -0
  166. package/dist/routes/storage-error-handlers.js +185 -0
  167. package/dist/routes/storage-response-formatters.d.ts +44 -0
  168. package/dist/routes/storage-response-formatters.js +155 -0
  169. package/dist/routes/storage.d.ts +38 -0
  170. package/dist/routes/storage.js +369 -0
  171. package/dist/routes/upstream-provider-errors.d.ts +19 -0
  172. package/dist/routes/upstream-provider-errors.js +95 -0
  173. package/dist/schemas/agents.d.ts +79 -0
  174. package/dist/schemas/agents.js +126 -0
  175. package/dist/schemas/common.d.ts +110 -0
  176. package/dist/schemas/common.js +190 -0
  177. package/dist/schemas/document-list-responses.d.ts +102 -0
  178. package/dist/schemas/document-list-responses.js +87 -0
  179. package/dist/schemas/document-list-schemas.d.ts +123 -0
  180. package/dist/schemas/document-list-schemas.js +174 -0
  181. package/dist/schemas/document-response-schemas.d.ts +610 -0
  182. package/dist/schemas/document-response-schemas.js +264 -0
  183. package/dist/schemas/document-status-envelope.d.ts +48 -0
  184. package/dist/schemas/document-status-envelope.js +54 -0
  185. package/dist/schemas/documents.d.ts +292 -0
  186. package/dist/schemas/documents.js +449 -0
  187. package/dist/schemas/errors.d.ts +75 -0
  188. package/dist/schemas/errors.js +105 -0
  189. package/dist/schemas/memories.d.ts +378 -0
  190. package/dist/schemas/memories.js +542 -0
  191. package/dist/schemas/openapi.d.ts +24 -0
  192. package/dist/schemas/openapi.js +1038 -0
  193. package/dist/schemas/response-scalars.d.ts +10 -0
  194. package/dist/schemas/response-scalars.js +10 -0
  195. package/dist/schemas/responses.d.ts +536 -0
  196. package/dist/schemas/responses.js +350 -0
  197. package/dist/schemas/search-response-parts.d.ts +97 -0
  198. package/dist/schemas/search-response-parts.js +103 -0
  199. package/dist/schemas/storage-schemas.d.ts +175 -0
  200. package/dist/schemas/storage-schemas.js +277 -0
  201. package/dist/schemas/zod-setup.d.ts +15 -0
  202. package/dist/schemas/zod-setup.js +17 -0
  203. package/dist/server.d.ts +13 -0
  204. package/dist/server.js +57 -0
  205. package/dist/services/abstract-query-policy.d.ts +13 -0
  206. package/dist/services/abstract-query-policy.js +50 -0
  207. package/dist/services/affinity-clustering.d.ts +66 -0
  208. package/dist/services/affinity-clustering.js +125 -0
  209. package/dist/services/agentic-retrieval.d.ts +38 -0
  210. package/dist/services/agentic-retrieval.js +126 -0
  211. package/dist/services/answer-format.d.ts +56 -0
  212. package/dist/services/answer-format.js +118 -0
  213. package/dist/services/answer-rescue.d.ts +72 -0
  214. package/dist/services/answer-rescue.js +177 -0
  215. package/dist/services/answer-verifier.d.ts +24 -0
  216. package/dist/services/answer-verifier.js +73 -0
  217. package/dist/services/api-retry.d.ts +6 -0
  218. package/dist/services/api-retry.js +41 -0
  219. package/dist/services/assistant-turn-filter.d.ts +20 -0
  220. package/dist/services/assistant-turn-filter.js +69 -0
  221. package/dist/services/atomicmem-uri.d.ts +33 -0
  222. package/dist/services/atomicmem-uri.js +86 -0
  223. package/dist/services/audit-events.d.ts +54 -0
  224. package/dist/services/audit-events.js +56 -0
  225. package/dist/services/chunked-extraction.d.ts +21 -0
  226. package/dist/services/chunked-extraction.js +108 -0
  227. package/dist/services/claim-slotting.d.ts +27 -0
  228. package/dist/services/claim-slotting.js +38 -0
  229. package/dist/services/claude-code-llm.d.ts +19 -0
  230. package/dist/services/claude-code-llm.js +96 -0
  231. package/dist/services/composite-dedup.d.ts +50 -0
  232. package/dist/services/composite-dedup.js +153 -0
  233. package/dist/services/composite-grouping.d.ts +41 -0
  234. package/dist/services/composite-grouping.js +111 -0
  235. package/dist/services/composite-staleness.d.ts +20 -0
  236. package/dist/services/composite-staleness.js +50 -0
  237. package/dist/services/conciseness-preference.d.ts +14 -0
  238. package/dist/services/conciseness-preference.js +42 -0
  239. package/dist/services/conflict-policy.d.ts +20 -0
  240. package/dist/services/conflict-policy.js +335 -0
  241. package/dist/services/consensus-extraction.d.ts +39 -0
  242. package/dist/services/consensus-extraction.js +147 -0
  243. package/dist/services/consensus-validation.d.ts +52 -0
  244. package/dist/services/consensus-validation.js +206 -0
  245. package/dist/services/consolidation-service.d.ts +60 -0
  246. package/dist/services/consolidation-service.js +171 -0
  247. package/dist/services/content-detection.d.ts +18 -0
  248. package/dist/services/content-detection.js +25 -0
  249. package/dist/services/contradiction-surfacing.d.ts +62 -0
  250. package/dist/services/contradiction-surfacing.js +111 -0
  251. package/dist/services/cost-telemetry.d.ts +39 -0
  252. package/dist/services/cost-telemetry.js +58 -0
  253. package/dist/services/counter-evidence.d.ts +34 -0
  254. package/dist/services/counter-evidence.js +92 -0
  255. package/dist/services/current-state-ranking.d.ts +21 -0
  256. package/dist/services/current-state-ranking.js +152 -0
  257. package/dist/services/deferred-audn.d.ts +47 -0
  258. package/dist/services/deferred-audn.js +162 -0
  259. package/dist/services/document-chunker.d.ts +50 -0
  260. package/dist/services/document-chunker.js +153 -0
  261. package/dist/services/document-failure-markers.d.ts +91 -0
  262. package/dist/services/document-failure-markers.js +305 -0
  263. package/dist/services/document-indexer.d.ts +122 -0
  264. package/dist/services/document-indexer.js +405 -0
  265. package/dist/services/document-service.d.ts +245 -0
  266. package/dist/services/document-service.js +325 -0
  267. package/dist/services/document-upload-artifact-sync.d.ts +80 -0
  268. package/dist/services/document-upload-artifact-sync.js +162 -0
  269. package/dist/services/document-upload-beta2-recovery.d.ts +72 -0
  270. package/dist/services/document-upload-beta2-recovery.js +94 -0
  271. package/dist/services/document-upload.d.ts +44 -0
  272. package/dist/services/document-upload.js +353 -0
  273. package/dist/services/embedding.d.ts +57 -0
  274. package/dist/services/embedding.js +416 -0
  275. package/dist/services/entity-attribute-extractor.d.ts +34 -0
  276. package/dist/services/entity-attribute-extractor.js +117 -0
  277. package/dist/services/entity-card-synthesis.d.ts +54 -0
  278. package/dist/services/entity-card-synthesis.js +92 -0
  279. package/dist/services/entity-dedup.d.ts +9 -0
  280. package/dist/services/entity-dedup.js +14 -0
  281. package/dist/services/entity-graph.d.ts +17 -0
  282. package/dist/services/entity-graph.js +135 -0
  283. package/dist/services/entropy-gate.d.ts +52 -0
  284. package/dist/services/entropy-gate.js +56 -0
  285. package/dist/services/episode-fetcher.d.ts +47 -0
  286. package/dist/services/episode-fetcher.js +128 -0
  287. package/dist/services/event-anchor-facts.d.ts +8 -0
  288. package/dist/services/event-anchor-facts.js +205 -0
  289. package/dist/services/event-chain-detector.d.ts +52 -0
  290. package/dist/services/event-chain-detector.js +83 -0
  291. package/dist/services/extraction-cache.d.ts +9 -0
  292. package/dist/services/extraction-cache.js +54 -0
  293. package/dist/services/extraction-enrichment.d.ts +9 -0
  294. package/dist/services/extraction-enrichment.js +223 -0
  295. package/dist/services/extraction.d.ts +69 -0
  296. package/dist/services/extraction.js +596 -0
  297. package/dist/services/fact-normalization.d.ts +12 -0
  298. package/dist/services/fact-normalization.js +248 -0
  299. package/dist/services/filecoin-observability.d.ts +127 -0
  300. package/dist/services/filecoin-observability.js +200 -0
  301. package/dist/services/first-mention-service.d.ts +76 -0
  302. package/dist/services/first-mention-service.js +186 -0
  303. package/dist/services/hierarchical-retrieval.d.ts +49 -0
  304. package/dist/services/hierarchical-retrieval.js +50 -0
  305. package/dist/services/ingest-fact-pipeline.d.ts +32 -0
  306. package/dist/services/ingest-fact-pipeline.js +212 -0
  307. package/dist/services/ingest-post-write.d.ts +50 -0
  308. package/dist/services/ingest-post-write.js +117 -0
  309. package/dist/services/ingest-trace.d.ts +32 -0
  310. package/dist/services/ingest-trace.js +60 -0
  311. package/dist/services/input-sanitizer.d.ts +41 -0
  312. package/dist/services/input-sanitizer.js +135 -0
  313. package/dist/services/iterative-retrieval.d.ts +26 -0
  314. package/dist/services/iterative-retrieval.js +139 -0
  315. package/dist/services/keyword-expansion.d.ts +10 -0
  316. package/dist/services/keyword-expansion.js +26 -0
  317. package/dist/services/lesson-service.d.ts +68 -0
  318. package/dist/services/lesson-service.js +178 -0
  319. package/dist/services/literal-extractor.d.ts +16 -0
  320. package/dist/services/literal-extractor.js +74 -0
  321. package/dist/services/literal-list-protection.d.ts +17 -0
  322. package/dist/services/literal-list-protection.js +134 -0
  323. package/dist/services/literal-query-expansion.d.ts +20 -0
  324. package/dist/services/literal-query-expansion.js +181 -0
  325. package/dist/services/llm.d.ts +61 -0
  326. package/dist/services/llm.js +265 -0
  327. package/dist/services/memcell-projection.d.ts +17 -0
  328. package/dist/services/memcell-projection.js +41 -0
  329. package/dist/services/memory-audn.d.ts +43 -0
  330. package/dist/services/memory-audn.js +419 -0
  331. package/dist/services/memory-crud.d.ts +93 -0
  332. package/dist/services/memory-crud.js +255 -0
  333. package/dist/services/memory-ingest.d.ts +21 -0
  334. package/dist/services/memory-ingest.js +249 -0
  335. package/dist/services/memory-lifecycle.d.ts +75 -0
  336. package/dist/services/memory-lifecycle.js +108 -0
  337. package/dist/services/memory-lineage.d.ts +181 -0
  338. package/dist/services/memory-lineage.js +232 -0
  339. package/dist/services/memory-network.d.ts +40 -0
  340. package/dist/services/memory-network.js +75 -0
  341. package/dist/services/memory-search-types.d.ts +25 -0
  342. package/dist/services/memory-search-types.js +10 -0
  343. package/dist/services/memory-search.d.ts +48 -0
  344. package/dist/services/memory-search.js +505 -0
  345. package/dist/services/memory-service-types.d.ts +371 -0
  346. package/dist/services/memory-service-types.js +8 -0
  347. package/dist/services/memory-service.d.ts +152 -0
  348. package/dist/services/memory-service.js +225 -0
  349. package/dist/services/memory-storage.d.ts +33 -0
  350. package/dist/services/memory-storage.js +328 -0
  351. package/dist/services/msr-aggregator.d.ts +38 -0
  352. package/dist/services/msr-aggregator.js +97 -0
  353. package/dist/services/msr-detector.d.ts +35 -0
  354. package/dist/services/msr-detector.js +65 -0
  355. package/dist/services/namespace-retrieval.d.ts +60 -0
  356. package/dist/services/namespace-retrieval.js +180 -0
  357. package/dist/services/observation-date-extraction.d.ts +12 -0
  358. package/dist/services/observation-date-extraction.js +50 -0
  359. package/dist/services/observation-service.d.ts +27 -0
  360. package/dist/services/observation-service.js +84 -0
  361. package/dist/services/packaging-observability.d.ts +29 -0
  362. package/dist/services/packaging-observability.js +146 -0
  363. package/dist/services/query-expansion.d.ts +83 -0
  364. package/dist/services/query-expansion.js +242 -0
  365. package/dist/services/query-keyword-matches.d.ts +6 -0
  366. package/dist/services/query-keyword-matches.js +56 -0
  367. package/dist/services/query-term-visibility.d.ts +28 -0
  368. package/dist/services/query-term-visibility.js +100 -0
  369. package/dist/services/quick-extraction.d.ts +25 -0
  370. package/dist/services/quick-extraction.js +431 -0
  371. package/dist/services/quoted-entity-extraction.d.ts +10 -0
  372. package/dist/services/quoted-entity-extraction.js +161 -0
  373. package/dist/services/raw-storage-reconciler-backoff.d.ts +8 -0
  374. package/dist/services/raw-storage-reconciler-backoff.js +14 -0
  375. package/dist/services/raw-storage-reconciler-scheduler.d.ts +29 -0
  376. package/dist/services/raw-storage-reconciler-scheduler.js +43 -0
  377. package/dist/services/raw-storage-reconciler.d.ts +71 -0
  378. package/dist/services/raw-storage-reconciler.js +278 -0
  379. package/dist/services/recap-builder.d.ts +49 -0
  380. package/dist/services/recap-builder.js +157 -0
  381. package/dist/services/reflect-jobs.d.ts +23 -0
  382. package/dist/services/reflect-jobs.js +36 -0
  383. package/dist/services/reflect-prompts.d.ts +71 -0
  384. package/dist/services/reflect-prompts.js +99 -0
  385. package/dist/services/reflect-retrieval.d.ts +33 -0
  386. package/dist/services/reflect-retrieval.js +30 -0
  387. package/dist/services/reflect.d.ts +49 -0
  388. package/dist/services/reflect.js +84 -0
  389. package/dist/services/relative-temporal.d.ts +14 -0
  390. package/dist/services/relative-temporal.js +163 -0
  391. package/dist/services/relevance-policy.d.ts +37 -0
  392. package/dist/services/relevance-policy.js +109 -0
  393. package/dist/services/rerank.d.ts +32 -0
  394. package/dist/services/rerank.js +118 -0
  395. package/dist/services/reranker.d.ts +20 -0
  396. package/dist/services/reranker.js +99 -0
  397. package/dist/services/retrieval-channel-rules.d.ts +34 -0
  398. package/dist/services/retrieval-channel-rules.js +41 -0
  399. package/dist/services/retrieval-config-overlay.d.ts +36 -0
  400. package/dist/services/retrieval-config-overlay.js +44 -0
  401. package/dist/services/retrieval-format.d.ts +119 -0
  402. package/dist/services/retrieval-format.js +559 -0
  403. package/dist/services/retrieval-policy.d.ts +69 -0
  404. package/dist/services/retrieval-policy.js +275 -0
  405. package/dist/services/retrieval-profiles.d.ts +37 -0
  406. package/dist/services/retrieval-profiles.js +90 -0
  407. package/dist/services/retrieval-side-effects.d.ts +14 -0
  408. package/dist/services/retrieval-side-effects.js +26 -0
  409. package/dist/services/retrieval-trace.d.ts +108 -0
  410. package/dist/services/retrieval-trace.js +147 -0
  411. package/dist/services/rrf-fusion.d.ts +18 -0
  412. package/dist/services/rrf-fusion.js +34 -0
  413. package/dist/services/search-pipeline.d.ts +71 -0
  414. package/dist/services/search-pipeline.js +788 -0
  415. package/dist/services/session-date.d.ts +20 -0
  416. package/dist/services/session-date.js +61 -0
  417. package/dist/services/session-packaging.d.ts +53 -0
  418. package/dist/services/session-packaging.js +182 -0
  419. package/dist/services/session-summary-generator.d.ts +53 -0
  420. package/dist/services/session-summary-generator.js +134 -0
  421. package/dist/services/specialists/cr-specialist.d.ts +52 -0
  422. package/dist/services/specialists/cr-specialist.js +121 -0
  423. package/dist/services/specialists/dispatch.d.ts +53 -0
  424. package/dist/services/specialists/dispatch.js +102 -0
  425. package/dist/services/specialists/ie-ku-specialist.d.ts +37 -0
  426. package/dist/services/specialists/ie-ku-specialist.js +63 -0
  427. package/dist/services/specialists/msr-specialist.d.ts +61 -0
  428. package/dist/services/specialists/msr-specialist.js +162 -0
  429. package/dist/services/specialists/tr-specialist.d.ts +37 -0
  430. package/dist/services/specialists/tr-specialist.js +146 -0
  431. package/dist/services/storage-key-prefix.d.ts +42 -0
  432. package/dist/services/storage-key-prefix.js +45 -0
  433. package/dist/services/storage-put-recovery.d.ts +71 -0
  434. package/dist/services/storage-put-recovery.js +269 -0
  435. package/dist/services/storage-service-errors.d.ts +124 -0
  436. package/dist/services/storage-service-errors.js +189 -0
  437. package/dist/services/storage-service.d.ts +176 -0
  438. package/dist/services/storage-service.js +423 -0
  439. package/dist/services/subject-aware-ranking.d.ts +19 -0
  440. package/dist/services/subject-aware-ranking.js +161 -0
  441. package/dist/services/supplemental-extraction.d.ts +7 -0
  442. package/dist/services/supplemental-extraction.js +116 -0
  443. package/dist/services/tbc-execution.d.ts +49 -0
  444. package/dist/services/tbc-execution.js +284 -0
  445. package/dist/services/temporal-classifier.d.ts +56 -0
  446. package/dist/services/temporal-classifier.js +94 -0
  447. package/dist/services/temporal-endpoint-evidence.d.ts +12 -0
  448. package/dist/services/temporal-endpoint-evidence.js +313 -0
  449. package/dist/services/temporal-fingerprint.d.ts +6 -0
  450. package/dist/services/temporal-fingerprint.js +12 -0
  451. package/dist/services/temporal-format.d.ts +9 -0
  452. package/dist/services/temporal-format.js +21 -0
  453. package/dist/services/temporal-intent.d.ts +39 -0
  454. package/dist/services/temporal-intent.js +78 -0
  455. package/dist/services/temporal-query-constraints.d.ts +16 -0
  456. package/dist/services/temporal-query-constraints.js +107 -0
  457. package/dist/services/temporal-query-expansion.d.ts +14 -0
  458. package/dist/services/temporal-query-expansion.js +131 -0
  459. package/dist/services/temporal-rerank.d.ts +22 -0
  460. package/dist/services/temporal-rerank.js +47 -0
  461. package/dist/services/temporal-result-protection.d.ts +7 -0
  462. package/dist/services/temporal-result-protection.js +60 -0
  463. package/dist/services/temporal-state-write.d.ts +57 -0
  464. package/dist/services/temporal-state-write.js +45 -0
  465. package/dist/services/tiered-context.d.ts +87 -0
  466. package/dist/services/tiered-context.js +214 -0
  467. package/dist/services/tiered-loading.d.ts +88 -0
  468. package/dist/services/tiered-loading.js +263 -0
  469. package/dist/services/timeline-pack.d.ts +36 -0
  470. package/dist/services/timeline-pack.js +50 -0
  471. package/dist/services/timing.d.ts +13 -0
  472. package/dist/services/timing.js +72 -0
  473. package/dist/services/tll-augmentation.d.ts +20 -0
  474. package/dist/services/tll-augmentation.js +125 -0
  475. package/dist/services/tll-retrieval.d.ts +55 -0
  476. package/dist/services/tll-retrieval.js +101 -0
  477. package/dist/services/topic-abstraction.d.ts +36 -0
  478. package/dist/services/topic-abstraction.js +105 -0
  479. package/dist/services/trust-scoring.d.ts +43 -0
  480. package/dist/services/trust-scoring.js +89 -0
  481. package/dist/services/typed-belief-calculus.d.ts +126 -0
  482. package/dist/services/typed-belief-calculus.js +204 -0
  483. package/dist/services/upload-config.d.ts +34 -0
  484. package/dist/services/upload-config.js +23 -0
  485. package/dist/services/upload-decision.d.ts +65 -0
  486. package/dist/services/upload-decision.js +98 -0
  487. package/dist/services/upload-helpers.d.ts +107 -0
  488. package/dist/services/upload-helpers.js +148 -0
  489. package/dist/services/user-profile-builder.d.ts +22 -0
  490. package/dist/services/user-profile-builder.js +109 -0
  491. package/dist/services/voyage-embedding.d.ts +22 -0
  492. package/dist/services/voyage-embedding.js +77 -0
  493. package/dist/services/write-security.d.ts +31 -0
  494. package/dist/services/write-security.js +64 -0
  495. package/dist/storage/artifact-public-redaction.d.ts +34 -0
  496. package/dist/storage/artifact-public-redaction.js +83 -0
  497. package/dist/storage/cleanup.d.ts +103 -0
  498. package/dist/storage/cleanup.js +138 -0
  499. package/dist/storage/codec-factory.d.ts +17 -0
  500. package/dist/storage/codec-factory.js +33 -0
  501. package/dist/storage/codecs/aes-gcm-codec.d.ts +44 -0
  502. package/dist/storage/codecs/aes-gcm-codec.js +108 -0
  503. package/dist/storage/codecs/noop-codec.d.ts +16 -0
  504. package/dist/storage/codecs/noop-codec.js +23 -0
  505. package/dist/storage/factory.d.ts +44 -0
  506. package/dist/storage/factory.js +99 -0
  507. package/dist/storage/filecoin-cid-validation.d.ts +82 -0
  508. package/dist/storage/filecoin-cid-validation.js +122 -0
  509. package/dist/storage/filecoin-public-metadata.d.ts +73 -0
  510. package/dist/storage/filecoin-public-metadata.js +110 -0
  511. package/dist/storage/local-fs-store.d.ts +39 -0
  512. package/dist/storage/local-fs-store.js +145 -0
  513. package/dist/storage/pointer-uri-allowlist.d.ts +38 -0
  514. package/dist/storage/pointer-uri-allowlist.js +70 -0
  515. package/dist/storage/provider-metadata-projection.d.ts +27 -0
  516. package/dist/storage/provider-metadata-projection.js +68 -0
  517. package/dist/storage/providers/filecoin/backend.d.ts +42 -0
  518. package/dist/storage/providers/filecoin/backend.js +250 -0
  519. package/dist/storage/providers/filecoin/config.d.ts +70 -0
  520. package/dist/storage/providers/filecoin/config.js +275 -0
  521. package/dist/storage/providers/filecoin/errors.d.ts +45 -0
  522. package/dist/storage/providers/filecoin/errors.js +56 -0
  523. package/dist/storage/providers/filecoin/filecoin-pin-car.d.ts +78 -0
  524. package/dist/storage/providers/filecoin/filecoin-pin-car.js +155 -0
  525. package/dist/storage/providers/filecoin/filecoin-pin-client.d.ts +92 -0
  526. package/dist/storage/providers/filecoin/filecoin-pin-client.js +199 -0
  527. package/dist/storage/providers/filecoin/filecoin-pin-mapping.d.ts +58 -0
  528. package/dist/storage/providers/filecoin/filecoin-pin-mapping.js +103 -0
  529. package/dist/storage/providers/filecoin/filecoin-pin-timeout.d.ts +30 -0
  530. package/dist/storage/providers/filecoin/filecoin-pin-timeout.js +53 -0
  531. package/dist/storage/providers/filecoin/filecoin-pin-vendor.d.ts +111 -0
  532. package/dist/storage/providers/filecoin/filecoin-pin-vendor.js +87 -0
  533. package/dist/storage/providers/filecoin/hints.d.ts +71 -0
  534. package/dist/storage/providers/filecoin/hints.js +123 -0
  535. package/dist/storage/providers/filecoin/index.d.ts +51 -0
  536. package/dist/storage/providers/filecoin/index.js +103 -0
  537. package/dist/storage/providers/filecoin/ipfs-cid.d.ts +50 -0
  538. package/dist/storage/providers/filecoin/ipfs-cid.js +64 -0
  539. package/dist/storage/providers/filecoin/metadata.d.ts +72 -0
  540. package/dist/storage/providers/filecoin/metadata.js +137 -0
  541. package/dist/storage/providers/filecoin/piece-cid.d.ts +48 -0
  542. package/dist/storage/providers/filecoin/piece-cid.js +57 -0
  543. package/dist/storage/providers/filecoin/provider-client.d.ts +234 -0
  544. package/dist/storage/providers/filecoin/provider-client.js +27 -0
  545. package/dist/storage/providers/filecoin/readiness.d.ts +62 -0
  546. package/dist/storage/providers/filecoin/readiness.js +85 -0
  547. package/dist/storage/providers/filecoin/retriever.d.ts +82 -0
  548. package/dist/storage/providers/filecoin/retriever.js +63 -0
  549. package/dist/storage/providers/filecoin/skeleton-client.d.ts +36 -0
  550. package/dist/storage/providers/filecoin/skeleton-client.js +55 -0
  551. package/dist/storage/providers/filecoin/synapse-client.d.ts +169 -0
  552. package/dist/storage/providers/filecoin/synapse-client.js +343 -0
  553. package/dist/storage/providers/filecoin/synapse-construction.d.ts +26 -0
  554. package/dist/storage/providers/filecoin/synapse-construction.js +47 -0
  555. package/dist/storage/providers/filecoin/synapse-error-mapping.d.ts +23 -0
  556. package/dist/storage/providers/filecoin/synapse-error-mapping.js +49 -0
  557. package/dist/storage/providers/filecoin/synapse-readiness.d.ts +37 -0
  558. package/dist/storage/providers/filecoin/synapse-readiness.js +231 -0
  559. package/dist/storage/providers/filecoin/uri.d.ts +49 -0
  560. package/dist/storage/providers/filecoin/uri.js +84 -0
  561. package/dist/storage/providers/filecoin/verified-fetch-lifecycle.d.ts +77 -0
  562. package/dist/storage/providers/filecoin/verified-fetch-lifecycle.js +196 -0
  563. package/dist/storage/providers/filecoin/verified-fetch-retriever.d.ts +54 -0
  564. package/dist/storage/providers/filecoin/verified-fetch-retriever.js +81 -0
  565. package/dist/storage/providers/filecoin/verified-fetch-vendor.d.ts +71 -0
  566. package/dist/storage/providers/filecoin/verified-fetch-vendor.js +94 -0
  567. package/dist/storage/raw-content-codec.d.ts +89 -0
  568. package/dist/storage/raw-content-codec.js +47 -0
  569. package/dist/storage/raw-content-store-backend-adapter.d.ts +28 -0
  570. package/dist/storage/raw-content-store-backend-adapter.js +67 -0
  571. package/dist/storage/raw-content-store.d.ts +228 -0
  572. package/dist/storage/raw-content-store.js +27 -0
  573. package/dist/storage/s3-store.d.ts +42 -0
  574. package/dist/storage/s3-store.js +181 -0
  575. package/dist/storage/storage-backend-registry.d.ts +58 -0
  576. package/dist/storage/storage-backend-registry.js +56 -0
  577. package/dist/storage/storage-backend.d.ts +82 -0
  578. package/dist/storage/storage-backend.js +14 -0
  579. package/dist/storage/storage-capabilities.d.ts +56 -0
  580. package/dist/storage/storage-capabilities.js +170 -0
  581. package/dist/storage/store-registry.d.ts +67 -0
  582. package/dist/storage/store-registry.js +77 -0
  583. package/dist/vector-math.d.ts +15 -0
  584. package/dist/vector-math.js +31 -0
  585. package/dist/xml-escape.d.ts +5 -0
  586. package/dist/xml-escape.js +7 -0
  587. package/openapi.json +15395 -0
  588. package/openapi.yaml +10794 -0
  589. package/package.json +119 -0
@@ -0,0 +1,680 @@
1
+ /**
2
+ * Runtime configuration for the prototype backend.
3
+ * Loads validated env-backed defaults, then allows limited in-memory updates
4
+ * for local UI experimentation via PUT /v1/memories/config.
5
+ */
6
+ import { type RetrievalProfile, type RetrievalProfileName } from './services/retrieval-profiles.js';
7
+ import { type FilecoinProviderConfig } from './storage/providers/filecoin/config.js';
8
+ export type EmbeddingProviderName = 'openai' | 'ollama' | 'openai-compatible' | 'transformers' | 'voyage';
9
+ export type LLMProviderName = EmbeddingProviderName | 'groq' | 'anthropic' | 'google-genai' | 'claude-code';
10
+ export type VectorBackendName = 'pgvector' | 'ruvector-mock' | 'zvec-mock';
11
+ export type CrossEncoderDtype = 'auto' | 'fp32' | 'fp16' | 'q8' | 'int8' | 'uint8' | 'q4' | 'bnb4' | 'q4f16';
12
+ /**
13
+ * Phases 1 + 3 of the large-file ingestion plan ship `pointer_only`
14
+ * and `managed_blob`. `inline_small_text` is reserved for a later
15
+ * phase — `parseRawStorageMode` rejects it explicitly.
16
+ */
17
+ export type RawStorageMode = 'pointer_only' | 'managed_blob';
18
+ /**
19
+ * Content-codec selector that sits between the upload service and the
20
+ * raw-content adapter. `none` is the pass-through (immediate providers'
21
+ * default); `aes_gcm` wraps the bytes in AES-256-GCM ciphertext so the
22
+ * adapter (and downstream content-addressing) only sees encrypted
23
+ * bytes. The codec keyring (`RAW_CONTENT_CODEC_KEYS` +
24
+ * `RAW_CONTENT_CODEC_ACTIVE_KEY_ID`) holds the rotation state.
25
+ */
26
+ export type RawContentCodecName = 'none' | 'aes_gcm';
27
+ /**
28
+ * Deployment-env classifier driving fail-closed policy decisions
29
+ * (plaintext-Filecoin escape hatch, error `.cause` sanitization).
30
+ * REQUIRED at startup; no `NODE_ENV` is read anywhere.
31
+ */
32
+ export type RawStorageDeploymentEnv = 'production' | 'staging' | 'local';
33
+ export interface RuntimeConfig {
34
+ databaseUrl: string;
35
+ openaiApiKey: string;
36
+ /**
37
+ * Shared API key required on every authenticated `/v1/*` request.
38
+ * Validated against `Authorization: Bearer <key>` by the
39
+ * `requireBearer` middleware. REQUIRED at startup in every
40
+ * environment; tests set it via `.env.test`. Operators rotate by
41
+ * restarting the server with a new value.
42
+ */
43
+ coreApiKey: string;
44
+ /**
45
+ * Hex-encoded secret used to derive per-user storage-key prefixes
46
+ * via HMAC-SHA256. Storage keys take the form `s/<32hex>/<uuid>.bin`
47
+ * where the 32 hex chars are the first 16 bytes of
48
+ * `HMAC_SHA256(secret, userId)`. REQUIRED whenever managed-mode
49
+ * storage is configured; pointer-only deployments still set it so
50
+ * the config gate is one consistent contract. Must be at least 64
51
+ * hex chars (32 bytes of entropy).
52
+ */
53
+ storageKeyHmacSecret: string;
54
+ port: number;
55
+ retrievalProfile: RetrievalProfileName;
56
+ retrievalProfileSettings: RetrievalProfile;
57
+ maxSearchResults: number;
58
+ similarityThreshold: number;
59
+ audnCandidateThreshold: number;
60
+ audnSafeReuseMinSimilarity: number;
61
+ crossAgentCandidateThreshold: number;
62
+ clarificationConflictThreshold: number;
63
+ adaptiveRetrievalEnabled: boolean;
64
+ adaptiveSimpleLimit: number;
65
+ adaptiveMediumLimit: number;
66
+ adaptiveComplexLimit: number;
67
+ adaptiveMultiHopLimit: number;
68
+ adaptiveAggregationLimit: number;
69
+ repairLoopEnabled: boolean;
70
+ hybridSearchEnabled: boolean;
71
+ repairLoopMinSimilarity: number;
72
+ repairSkipSimilarity: number;
73
+ mmrEnabled: boolean;
74
+ mmrLambda: number;
75
+ linkExpansionEnabled: boolean;
76
+ linkExpansionMax: number;
77
+ linkSimilarityThreshold: number;
78
+ scoringWeightSimilarity: number;
79
+ scoringWeightImportance: number;
80
+ scoringWeightRecency: number;
81
+ linkExpansionBeforeMMR: boolean;
82
+ pprEnabled: boolean;
83
+ pprDamping: number;
84
+ repairDeltaThreshold: number;
85
+ repairConfidenceFloor: number;
86
+ embeddingProvider: EmbeddingProviderName;
87
+ embeddingModel: string;
88
+ embeddingDimensions: number;
89
+ embeddingApiUrl?: string;
90
+ embeddingApiKey?: string;
91
+ voyageApiKey?: string;
92
+ voyageDocumentModel: string;
93
+ voyageQueryModel: string;
94
+ llmProvider: LLMProviderName;
95
+ llmModel: string;
96
+ llmApiUrl?: string;
97
+ llmApiKey?: string;
98
+ groqApiKey?: string;
99
+ ollamaBaseUrl: string;
100
+ vectorBackend: VectorBackendName;
101
+ skipVectorIndexes: boolean;
102
+ llmSeed?: number;
103
+ stagedLoadingEnabled: boolean;
104
+ retrievalTraceEnabled: boolean;
105
+ ingestTraceDir: string;
106
+ ingestTraceEnabled: boolean;
107
+ extractionCacheEnabled: boolean;
108
+ extractionCacheDir: string;
109
+ embeddingCacheEnabled: boolean;
110
+ chunkedExtractionEnabled: boolean;
111
+ chunkedExtractionFallbackEnabled: boolean;
112
+ chunkSizeTurns: number;
113
+ chunkOverlapTurns: number;
114
+ consensusExtractionEnabled: boolean;
115
+ consensusExtractionRuns: number;
116
+ observationDateExtractionEnabled: boolean;
117
+ quotedEntityExtractionEnabled: boolean;
118
+ entropyGateEnabled: boolean;
119
+ entropyGateThreshold: number;
120
+ entropyGateAlpha: number;
121
+ affinityClusteringThreshold: number;
122
+ affinityClusteringMinSize: number;
123
+ affinityClusteringBeta: number;
124
+ affinityClusteringTemporalLambda: number;
125
+ trustScoringEnabled: boolean;
126
+ trustScoreMinThreshold: number;
127
+ trustPenaltyEnabled: boolean;
128
+ auditLoggingEnabled: boolean;
129
+ decayCycleEnabled: boolean;
130
+ decayRetentionThreshold: number;
131
+ decayMinAgeDays: number;
132
+ memoryCapEnabled: boolean;
133
+ memoryCapMax: number;
134
+ memoryCapWarnRatio: number;
135
+ entityGraphEnabled: boolean;
136
+ entityResolutionThreshold: number;
137
+ entitySearchMinSimilarity: number;
138
+ lessonsEnabled: boolean;
139
+ lessonSimilarityThreshold: number;
140
+ consensusValidationEnabled: boolean;
141
+ consensusMinMemories: number;
142
+ queryExpansionEnabled: boolean;
143
+ queryExpansionMinSimilarity: number;
144
+ queryAugmentationEnabled: boolean;
145
+ queryAugmentationMaxEntities: number;
146
+ queryAugmentationMinSimilarity: number;
147
+ crossEncoderEnabled: boolean;
148
+ crossEncoderModel: string;
149
+ crossEncoderDtype: CrossEncoderDtype;
150
+ iterativeRetrievalEnabled: boolean;
151
+ namespaceClassificationEnabled: boolean;
152
+ fastAudnEnabled: boolean;
153
+ fastAudnDuplicateThreshold: number;
154
+ observationNetworkEnabled: boolean;
155
+ agenticRetrievalEnabled: boolean;
156
+ rerankSkipTopSimilarity: number;
157
+ rerankSkipMinGap: number;
158
+ literalListProtectionEnabled: boolean;
159
+ literalListProtectionMaxProtected: number;
160
+ temporalQueryConstraintEnabled: boolean;
161
+ temporalQueryConstraintBoost: number;
162
+ deferredAudnEnabled: boolean;
163
+ deferredAudnBatchSize: number;
164
+ compositeGroupingEnabled: boolean;
165
+ compositeMinClusterSize: number;
166
+ compositeMaxClusterSize: number;
167
+ compositeSimilarityThreshold: number;
168
+ anthropicApiKey?: string;
169
+ googleApiKey?: string;
170
+ costLoggingEnabled: boolean;
171
+ costLogDir: string;
172
+ costRunId: string;
173
+ conflictAutoResolveMs: number;
174
+ /**
175
+ * Typed Belief Calculus (TBC) gate. When true, the AUDN decision step
176
+ * defers to `decideBeliefOperator` from `services/typed-belief-calculus.ts`.
177
+ * Default false — Phase 1 ships only the type surface and stub resolver,
178
+ * so existing AUDN behavior is unchanged. See `docs/typed-belief-calculus.md`.
179
+ */
180
+ tbcEnabled: boolean;
181
+ /**
182
+ * Hierarchical retrieval (T2): adds a 5th RRF arm that searches over
183
+ * conversation/session summaries first, then expands to atomic facts within
184
+ * the matched sessions. Targets BEAM-10M scale (~14M tokens of context per
185
+ * system) where flat top-K retrieval loses signal.
186
+ * Default false. See `docs/hierarchical-retrieval.md`.
187
+ * Env var: HIERARCHICAL_RETRIEVAL_ENABLED=true
188
+ */
189
+ hierarchicalRetrievalEnabled: boolean;
190
+ /**
191
+ * Topic abstraction layer (Sprint 3 EO experiment): when true, ingest runs
192
+ * a second LLM pass per chunk to extract a 3-7 word conceptual topic, embeds
193
+ * it, and stores both alongside the raw fact. Retrieval fuses a topic-
194
+ * embedding similarity stream into RRF when topicSearchEnabled is also true.
195
+ * Default false. Design: benchmarks-sprint3/2026-05-10-am-baseline-and-rerank-design.md.
196
+ * Env var: TOPIC_ABSTRACTION_ENABLED=true
197
+ */
198
+ topicAbstractionEnabled: boolean;
199
+ /**
200
+ * Topic search arm: when true (and topic_embedding column populated), the
201
+ * search pipeline adds a topic-similarity RRF channel. Independent of the
202
+ * ingest-side flag so the retrieval lift can be measured against pre-existing
203
+ * topic-augmented memory state.
204
+ * Default false. Env var: TOPIC_SEARCH_ENABLED=true
205
+ */
206
+ topicSearchEnabled: boolean;
207
+ /**
208
+ * Cross-encoder reranker: when true, the search pipeline reranks the top-N
209
+ * RRF-fused candidates via an LLM-scored relevance pass. Adds ~50-150 ms
210
+ * p95 retrieve latency. Mirrors Hindsight's reranking layer.
211
+ * Default false. Env var: RERANKER_ENABLED=true
212
+ */
213
+ rerankerEnabled: boolean;
214
+ /** Top-N candidates fed into the reranker (default 20). Env: RERANKER_TOP_N */
215
+ rerankerTopN: number;
216
+ /**
217
+ * Recap layer (Sprint 3 v1, cross-session synthesis): when true, the
218
+ * post-write pipeline opportunistically synthesizes Recaps from clusters
219
+ * of memories sharing a topic_abstraction. Recaps are surfaced via their
220
+ * own RRF channel at retrieval. Cog-sci analogue: hippocampal consolidation.
221
+ * Requires topicAbstractionEnabled=true (clusters by topic field).
222
+ * Default false. Env var: RECAP_LAYER_ENABLED=true
223
+ */
224
+ recapLayerEnabled: boolean;
225
+ /** Min cluster size for recap building (default 4). Env: RECAP_MIN_CLUSTER_SIZE */
226
+ recapMinClusterSize: number;
227
+ /**
228
+ * Recap cluster pivot (Sprint 3 v1.1 — V2 backlog #2).
229
+ * 'topic' — group by topic_abstraction (original; needs topic-abstraction
230
+ * layer ON; empirically regressed fact abilities).
231
+ * 'session' — group by user_id + observed_at hour bucket (doesn't need
232
+ * topic-abstraction; captures cross-turn aggregation in a
233
+ * conversational window).
234
+ * Default 'topic' to preserve existing behavior. Env: RECAP_CLUSTER_PIVOT
235
+ */
236
+ recapClusterPivot: 'topic' | 'session';
237
+ /** When true, search pipeline adds a recap-similarity RRF channel.
238
+ * Independent of layer flag so retrieval can be measured against pre-existing
239
+ * recap state. Default false. Env: RECAP_SEARCH_ENABLED=true */
240
+ recapSearchEnabled: boolean;
241
+ /**
242
+ * Counter-evidence retrieval (Sprint 3 v1.1 — V2 backlog item 1): when
243
+ * true, the search pipeline expands the top-K result set with memories
244
+ * that COUNTER any retrieved memory via the belief_edges graph. Surfaces
245
+ * both sides of contradictions for CR-style queries.
246
+ * Requires TBC to have been ON at ingest (populates belief_edges).
247
+ * Default false. Env: COUNTER_EVIDENCE_ENABLED=true
248
+ */
249
+ counterEvidenceEnabled: boolean;
250
+ /**
251
+ * Temporal-aware packaging (Sprint 3 v1.2 — EO failure-mode fix).
252
+ * When true, retrieval-format.ts surfaces `observed_at` (the
253
+ * conversation timestamp captured during ingest) instead of
254
+ * `created_at` (the ingest wall-clock) for:
255
+ * - chronological sort of the injection block
256
+ * - the per-memory date attribute
257
+ * - the Timeline summary
258
+ * This restores within-conversation turn order for BEAM-style
259
+ * backloaded ingestion where many turns share a single ingest time.
260
+ * Default false (preserves existing behavior). Env:
261
+ * PACKAGING_USE_OBSERVED_AT=true
262
+ */
263
+ packagingUseObservedAt: boolean;
264
+ /**
265
+ * Dual-date packaging (Sprint 3 v1.3 — companion to packagingUseObservedAt).
266
+ * When true, retrieval-format.ts emits BOTH `created_at` and `observed_at`
267
+ * attributes on every `<memory>` element when they differ. Lets the answer
268
+ * LLM see ingest time AND conversation time and decide which to weight
269
+ * per question, instead of forcing a global swap.
270
+ * Independent of `packagingUseObservedAt` (which controls sort + label
271
+ * date). Default false. Env: PACKAGING_DUAL_DATE=true
272
+ */
273
+ packagingDualDate: boolean;
274
+ /**
275
+ * Timeline channel (Sprint 3 v1.4 — H3 from haiku-080 master plan).
276
+ * When true, retrieval-format.ts emits an additional `## TIMELINE`
277
+ * section in the injection text. Dates are derived from observed_at
278
+ * across the retrieved set, sorted ascending, deduplicated.
279
+ * Independent of packagingUseObservedAt and packagingDualDate.
280
+ * Default false. Env: TIMELINE_CHANNEL_ENABLED=true
281
+ */
282
+ timelineChannelEnabled: boolean;
283
+ /**
284
+ * Answer-only retrieval filter (Sprint 4 iter 1). When true, drop
285
+ * advisory-only memories from the retrieved set before formatting the
286
+ * injection. Insight: Sprint 3 incorrect-case analysis showed
287
+ * retrieved contexts mixed verbose [context] snippets with specific
288
+ * [answer] facts, and Haiku weighted the former over the latter.
289
+ * Failsafe: if <3 memories survive the filter, falls back to the
290
+ * unfiltered set. Default false. Env: ANSWER_ONLY_RETRIEVAL_FILTER=true
291
+ */
292
+ answerOnlyRetrievalFilter: boolean;
293
+ /**
294
+ * Near-duplicate dedup at retrieval (Sprint 4 iter 2). When true,
295
+ * deduplicate retrieved memories by content fingerprint (lowercased
296
+ * alphanumeric prefix of first 80 chars). Sprint 3 showed retrieved
297
+ * contexts had same fact in 3-5 paraphrases per query; dedup makes
298
+ * room for diverse memories.
299
+ * Failsafe: if <3 memories survive, falls back to unfiltered set.
300
+ * Default false. Env: RETRIEVAL_DEDUP_ENABLED=true
301
+ */
302
+ retrievalDedupEnabled: boolean;
303
+ /**
304
+ * BM25 keyword RRF weight (Sprint 4 iter 3). Default 1.0 (existing
305
+ * behavior). Boosting to 1.5-2.0 prioritizes keyword/BM25 matches in
306
+ * the hybrid RRF fan-in. Useful for queries that ask for specific
307
+ * named facts ("how many X", "what is Y"). Only fires when
308
+ * hybridSearchEnabled is true. Env: KEYWORD_RRF_WEIGHT=1.5
309
+ */
310
+ keywordRrfWeight: number;
311
+ /**
312
+ * Entity-Attribute Index (EAI — Sprint 4). When true, ingest extracts
313
+ * (entity, attribute, value) triples into the `entity_attributes` table
314
+ * and retrieval queries that table for fact-specific lookups (e.g.
315
+ * "how many columns did I add?", "what's the API quota?"). Storage
316
+ * foundation lands first; extraction (Task B) and retrieval (Task C)
317
+ * activate the channel.
318
+ * Default false. Env var: ENTITY_ATTRIBUTES_ENABLED=true
319
+ */
320
+ entityAttributesEnabled: boolean;
321
+ /**
322
+ * Top-K EAI rows to fetch when the entity-attributes channel is enabled
323
+ * (Sprint 4 — Task C). Clamped to [5, 40] inside `fetchEntityFactsForInjection`
324
+ * — too few drops near-misses, too many bloats the `## FACTS` block.
325
+ * Default 20. Env: ENTITY_ATTRIBUTES_TOP_K=20
326
+ */
327
+ entityAttributesTopK: number;
328
+ /**
329
+ * User-profile channel (Sprint 3 v1.5 — H2 from haiku-080 master plan).
330
+ * When true, post-write synthesizes a per-user profile document
331
+ * (Honcho-style) after each ingest that stores >= 3 new memories.
332
+ * The search pipeline prepends the profile as a `## USER PROFILE`
333
+ * block at the head of every answer prompt.
334
+ * Default false. Env: USER_PROFILE_CHANNEL_ENABLED=true
335
+ */
336
+ userProfileChannelEnabled: boolean;
337
+ /**
338
+ * Episodes-as-separate-channel (Sprint 3 v1.6 — H4 from haiku-080 master
339
+ * plan). When true, the search pipeline fetches the top-K recap rows for
340
+ * the query embedding via `RecapStore.findRecapCandidates` and threads
341
+ * them through the injection builder as a dedicated `## EPISODES` block,
342
+ * INSTEAD OF routing recaps through the RRF fan-in. Sprint 3 v1.1
343
+ * documented that the RRF route displaced 3-5 atomic facts per recap in
344
+ * top-K and regressed fact-anchored abilities; this flag lets recap
345
+ * narrative surface to the answer LLM without paying that displacement
346
+ * cost. Independent of `recapSearchEnabled` (recap-via-RRF) — typical
347
+ * config has the layer ON, recap-search OFF, and episodes-channel ON.
348
+ * Default false. Env: EPISODES_CHANNEL_ENABLED=true
349
+ */
350
+ episodesChannelEnabled: boolean;
351
+ /**
352
+ * Top-K recap rows to fetch when the episodes channel is enabled.
353
+ * Default 2. Clamped to [1, 5] inside memory-search to bound prompt
354
+ * growth — large K dilutes the channel signal without lifting recall.
355
+ * Env: EPISODES_CHANNEL_TOP_K=2
356
+ */
357
+ episodesChannelTopK: number;
358
+ /**
359
+ * Verifier pass (Sprint 3 v1.7 — H5 from haiku-080 master plan).
360
+ * Informational flag from AM core's perspective — the AMB adapter
361
+ * inspects `ATOMICMEMORY_VERIFIER_ENABLED` to decide whether to call
362
+ * `/v1/memories/verify` between its answer-LLM call and scoring. The
363
+ * flag is surfaced in core config for symmetry with the other channel
364
+ * flags so iteration env files can request the verifier pass.
365
+ * Default false. Env: VERIFIER_PASS_ENABLED=true
366
+ */
367
+ verifierPassEnabled: boolean;
368
+ /**
369
+ * Layer 1 answer-format alignment (BEAM-0.85 Phase 0): when true,
370
+ * `buildInjection` prepends a per-question-type FORMAT hint to the
371
+ * injection prompt so the answer LLM produces structured output that
372
+ * matches the query shape (e.g. ordered lists, yes/no, prose).
373
+ * Default false. Env: ANSWER_FORMAT_ALIGNMENT_ENABLED=true
374
+ */
375
+ answerFormatAlignmentEnabled: boolean;
376
+ /**
377
+ * Event-chain packaging (EO fix — data-driven detector). When true,
378
+ * `buildInjection` prepends a `## EVENT_CHAIN` block listing the
379
+ * chronological chain with the highest score detected in the retrieved
380
+ * top-K. The detector fires regardless of query phrasing — it inspects
381
+ * the retrieved data for 3+ memories sharing an entity across 3+ distinct
382
+ * observed_at dates. Default false (ships behind flag for incremental
383
+ * validation). Env: EVENT_CHAIN_PACKAGING_ENABLED=true
384
+ */
385
+ eventChainPackagingEnabled: boolean;
386
+ /**
387
+ * Reflect channel — query-time reflection retrieval (BEAM-0.85 Phase 1,
388
+ * Task 1.9). When true, after RRF + reranking produce the selected memories,
389
+ * the search pipeline also embeds the query and fetches top-K reflections
390
+ * from session_reflections. The result is threaded downstream to
391
+ * retrieval-format as a parallel signal alongside chainResult.
392
+ * Gated by question type (SUMMARY, CONTRADICTION, PREFERENCE, NUMERIC_COUNT,
393
+ * EXACT_DATE, ORDERED_LIST — see reflect-retrieval.ts ROUTED_TYPES).
394
+ * Default false. Env: REFLECT_ENABLED=true
395
+ */
396
+ reflectEnabled: boolean;
397
+ /**
398
+ * Top-K reflections to fetch when reflect retrieval is enabled.
399
+ * Default 3. Env: REFLECT_RETRIEVAL_TOP_K=3
400
+ */
401
+ reflectRetrievalTopK: number;
402
+ /**
403
+ * Anthropic model used by the reflect worker for observation generation.
404
+ * Default 'claude-sonnet-4-5'. Env: REFLECT_MODEL=<model-id>
405
+ */
406
+ reflectModel: string;
407
+ /**
408
+ * Maximum observations per conversation the reflect worker will persist.
409
+ * Default 12. Env: REFLECT_MAX_OBSERVATIONS=12
410
+ */
411
+ reflectMaxObservations: number;
412
+ /**
413
+ * Polling interval (ms) for the reflect background worker.
414
+ * Default 5000. Env: REFLECT_JOB_POLL_MS=5000
415
+ */
416
+ reflectJobPollMs: number;
417
+ /**
418
+ * Debounce delay (ms) before a reflect job becomes eligible for processing.
419
+ * Not enforced in v1 worker but reserved for future use.
420
+ * Default 60000. Env: REFLECT_DEBOUNCE_MS=60000
421
+ */
422
+ reflectDebounceMs: number;
423
+ /**
424
+ * Dev/test-only: when true, PUT /v1/memories/config mutates the runtime
425
+ * singleton. Production deploys leave this unset (false) — the route
426
+ * returns 410 Gone. Startup-validated; routes read the memoized value
427
+ * through configRouteAdapter, never re-check at request time.
428
+ */
429
+ runtimeConfigMutationEnabled: boolean;
430
+ /**
431
+ * Phase 2 specialists gate (BEAM-0.85 Phase 2). When true, the specialist
432
+ * dispatcher runs after RRF + reranking produce top-K memories. The first
433
+ * specialist that matches the query pattern AND returns handled=true
434
+ * short-circuits the shared spine — its answer replaces the LLM output.
435
+ * Ingest-side: extractLiteralsFromFact runs fire-and-forget per new
436
+ * memory to populate entity_values for the IE/KU SQL lookup.
437
+ * Priority: CR → TR → MSR → IE/KU → shared spine.
438
+ * Default false. Env: PHASE2_SPECIALISTS_ENABLED=true
439
+ */
440
+ phase2SpecialistsEnabled: boolean;
441
+ /**
442
+ * Master gate for all three abstention-rescue interventions.
443
+ * Compensates for Haiku over-abstention: the model writes answers like
444
+ * "context does not contain information (March 10, 2024)" — citing the
445
+ * answer while claiming not to find it.
446
+ * Interventions (all gated here):
447
+ * 1. Confidence prefix — prepended to injectionText on every call.
448
+ * 2. Iterative retrieval — second retrieval pass with extracted keywords
449
+ * when the first answer abstains and retrieval was non-empty.
450
+ * 3. Sonnet rescue — retry with Sonnet if Haiku still abstains.
451
+ * Default false. Env: ABSTENTION_RESCUE_ENABLED=true
452
+ */
453
+ abstentionRescueEnabled: boolean;
454
+ /** Top-K for the iterative-retrieval rescue pass. Default 8. Env: ABSTENTION_RESCUE_RETRIEVE_K */
455
+ abstentionRescueRetrieveK: number;
456
+ /** Model used for the Sonnet rescue step. Default 'claude-sonnet-4-5'. Env: ABSTENTION_RESCUE_SONNET_MODEL */
457
+ abstentionRescueSonnetModel: string;
458
+ /**
459
+ * Per-question-type adaptive confidence prefix (v36). When true, the forced
460
+ * FORBIDDEN-abstention prefix only applies to SUMMARY/PREFERENCE/
461
+ * NUMERIC_COUNT/EXACT_DATE (where v34 showed +0.09 to +0.27 lifts); a soft
462
+ * prefix (rubric phrasing + KU temporal anchor, no FORBIDDEN block) applies
463
+ * to ORDERED_LIST/CONTRADICTION/OTHER (where v34 regressed −0.13 to −0.22
464
+ * by fabricating); ABSTAIN passes through unchanged. Requires
465
+ * `abstentionRescueEnabled=true`. Default false. Env:
466
+ * CONFIDENCE_PREFIX_ADAPTIVE_ENABLED=true
467
+ */
468
+ confidencePrefixAdaptiveEnabled: boolean;
469
+ /**
470
+ * KU recency sort (v42). When true, NUMERIC_COUNT queries that ALSO match
471
+ * the KU-style framing pattern (isKuStyleQuery) reorder packaged retrieval
472
+ * by observed_at DESC before injection — so the answer LLM sees the most
473
+ * recent measurement first. Targets BEAM KU Mode B (wrong-value-forced)
474
+ * where Haiku picks the earlier of two competing values. Default false.
475
+ * Env: KU_RECENCY_SORT_ENABLED=true
476
+ */
477
+ kuRecencySortEnabled: boolean;
478
+ /**
479
+ * MSR cross-conversation aggregator (v39-multihop). When true, queries
480
+ * classified as multi-session-reasoning (regex via `msr-detector.ts`) get
481
+ * an extra `## CROSS-SESSION SUMMARY` channel inserted before the standard
482
+ * OBSERVATIONS / TIMELINE / ENTITY_STATE blocks. Retrieved memories are
483
+ * grouped by `episode_id`; groups with >=2 memories are summarized via the
484
+ * configured chat LLM (default Haiku, ~30 tokens each); 1-memory groups
485
+ * pass through verbatim. Targets BEAM MSR (v36: 0.156/0.172) where gold
486
+ * facts span 2-4 conversations and the answer LLM cannot synthesize across
487
+ * them. Fail-closed on summary errors. Default false. Env:
488
+ * MSR_AGGREGATOR_ENABLED=true
489
+ */
490
+ msrAggregatorEnabled: boolean;
491
+ /**
492
+ * Always-on ENTITY_CARD channel (BEAM-0.85 — Honcho parity). When true,
493
+ * the Reflect worker synthesizes per-entity summary cards alongside the
494
+ * existing observations, and the search pipeline injects all cards for
495
+ * the active conversation under `## ENTITY_STATE` at the top of every
496
+ * answer-LLM prompt. Default false. Env: ENTITY_CARD_ENABLED=true
497
+ */
498
+ entityCardEnabled: boolean;
499
+ /** Max entity cards synthesized per Reflect run. Default 5. Env: ENTITY_CARD_MAX_PER_SESSION */
500
+ entityCardMaxPerSession: number;
501
+ /**
502
+ * Minimum observations an entity needs in a Reflect run before its card
503
+ * is synthesized. Default 3. Env: ENTITY_CARD_MIN_OBSERVATIONS
504
+ */
505
+ entityCardMinObservations: number;
506
+ /**
507
+ * AUDN bilateral preservation for contradictions (BEAM CR fix). When true,
508
+ * AUDN's DELETE and SUPERSEDE outcomes are replaced by a bilateral path
509
+ * that keeps BOTH the prior memory and the new memory in `memories`,
510
+ * marks both with `contradiction_active=true` and bidirectional
511
+ * `contradicts_memory_id`, and records the pair in
512
+ * `memory_contradictions`. Targets the BEAM `contradiction_resolution`
513
+ * rubric, which requires the answer to quote BOTH sides verbatim.
514
+ * Default false. Env: CONTRADICTION_PRESERVATION_ENABLED=true
515
+ */
516
+ contradictionPreservationEnabled: boolean;
517
+ /**
518
+ * Retrieval-side surfacing of contradictions (BEAM CR fix). When true,
519
+ * after top-K assembly the search pipeline enriches the result set:
520
+ * - any memory in top-K with `contradiction_active=true` has its
521
+ * counterpart (`contradicts_memory_id`) injected into the final set,
522
+ * - a `## CONTRADICTIONS_DETECTED` section listing both sides verbatim
523
+ * is prepended to the injection text.
524
+ * Independent of `contradictionPreservationEnabled` so the retrieval
525
+ * lift can be measured against pre-existing contradiction state.
526
+ * Default false. Env: CONTRADICTION_SURFACING_ENABLED=true
527
+ */
528
+ contradictionSurfacingEnabled: boolean;
529
+ /**
530
+ * BEAM v38: temporal state layer (focused Mem0 temporal-reasoning subset).
531
+ * When true:
532
+ * - At ingest, an LLM classifier tags each stored memory with a stable
533
+ * `state_key` for stateful facts (e.g. "user lives in Austin"); newly
534
+ * stored stateful memories supersede prior memories with the same key
535
+ * by setting their `event_end` to the new `event_start`.
536
+ * - At read, a regex-based intent classifier flags CURRENT_STATE
537
+ * queries; the retrieval pipeline reranks candidates so memories with
538
+ * active state (`event_end IS NULL`) outrank superseded ones.
539
+ * Targets the KU rubric (currently 0.25). Fail-closed: supersede UPDATE
540
+ * failures abort the ingest. Default false. Env: TEMPORAL_STATE_ENABLED=true
541
+ */
542
+ temporalStateEnabled: boolean;
543
+ /**
544
+ * Document raw-content retention mode. `pointer_only` registers
545
+ * external references; `managed_blob` stores bytes through the
546
+ * configured raw-storage provider. `inline_small_text` is reserved.
547
+ */
548
+ rawStorageMode: RawStorageMode;
549
+ /**
550
+ * Adapter behind `rawStorageMode = 'managed_blob'`. NULL for the
551
+ * pointer-only path; required at startup when `rawStorageMode =
552
+ * 'managed_blob'`. No fallback — misconfigured setups fail closed.
553
+ */
554
+ rawStorageProvider: RawStorageProvider | null;
555
+ /** Optional global path prefix (e.g. `prod/core`) applied to every key. */
556
+ rawStoragePrefix: string;
557
+ /** Provider-specific options. Always populated, validated at startup. */
558
+ rawStorageLocalFsRoot: string | null;
559
+ rawStorageS3Bucket: string | null;
560
+ rawStorageS3Region: string | null;
561
+ rawStorageS3Endpoint: string | null;
562
+ rawStorageS3AccessKeyId: string | null;
563
+ rawStorageS3SecretAccessKey: string | null;
564
+ /** Per-request upload size cap for `PUT /v1/documents/:id/raw`. */
565
+ rawUploadMaxBytes: number;
566
+ /** Content codec applied between the upload service and the raw-content adapter. */
567
+ rawContentCodec: RawContentCodecName;
568
+ /**
569
+ * Parsed keyring entries keyed by operator-assigned id. Required and
570
+ * non-empty when `rawContentCodec='aes_gcm'`. Each value is a 32-byte
571
+ * key. Keys are kept in the ring so old rows stay decodable after
572
+ * rotation; new writes use `rawContentCodecActiveKeyId`.
573
+ */
574
+ rawContentCodecKeys: ReadonlyMap<string, Buffer>;
575
+ /** Key id chosen for NEW encode operations. Must reference an entry in the ring. */
576
+ rawContentCodecActiveKeyId: string | null;
577
+ /** Required at startup; drives fail-closed policy in cross-validation. */
578
+ rawStorageDeploymentEnv: RawStorageDeploymentEnv;
579
+ /**
580
+ * Parsed Synapse-shaped Filecoin provider config. Populated only
581
+ * when `rawStorageProvider === 'filecoin'`; `null` otherwise. The
582
+ * cross-provider guard in `validateRawStorageConfig` rejects any
583
+ * `RAW_STORAGE_FILECOIN_*` env var on non-filecoin deployments
584
+ * before this field is computed, so the operator cannot leave
585
+ * stale Filecoin knobs lying around.
586
+ */
587
+ filecoinProvider: FilecoinProviderConfig | null;
588
+ /**
589
+ * CSV of legacy providers kept registered as read-only stores so the
590
+ * cleanup-time registry can dispatch DELETEs against historical rows
591
+ * after the active provider has been switched. Validated for env-block
592
+ * completeness at startup. Never contains the active provider.
593
+ */
594
+ rawStorageLegacyProviders: ReadonlyArray<RawStorageProvider>;
595
+ /**
596
+ * Closed allowlist of pointer-mode URI schemes the direct storage
597
+ * API accepts. Defaults to the safe set `https://, s3://, gs://,
598
+ * ipfs://`. Operators can opt in `http://` and `local-fs://` via
599
+ * `RAW_STORAGE_POINTER_URI_SCHEMES` (csv). Unknown tokens fail
600
+ * closed at startup. The server NEVER fetches pointer URIs — this
601
+ * is downstream-consumer hygiene, not SSRF defence.
602
+ */
603
+ rawStoragePointerUriSchemes: ReadonlyArray<PointerUriScheme>;
604
+ }
605
+ /** Closed set of pointer-mode URI schemes operators can allowlist. */
606
+ export type PointerUriScheme = 'https' | 's3' | 'gs' | 'ipfs' | 'http' | 'local-fs';
607
+ /** Production providers backing `rawStorageMode='managed_blob'`. */
608
+ export type RawStorageProvider = 'local_fs' | 's3' | 'filecoin';
609
+ /**
610
+ * Fields accepted by `updateRuntimeConfig()`. Provider/model selection
611
+ * (embeddingProvider, embeddingModel, voyage*, llmProvider, llmModel) is
612
+ * intentionally absent: embedding.ts and llm.ts cache stateful provider
613
+ * instances at first call, so mid-flight mutation never took effect in v1.
614
+ * Freezing these as composition-time config is a bug fix. Server deployments
615
+ * still use env-backed startup config; isolated harnesses can pass an explicit
616
+ * RuntimeConfig to createCoreRuntime({ config }).
617
+ */
618
+ export interface RuntimeConfigUpdates {
619
+ similarityThreshold?: number;
620
+ audnCandidateThreshold?: number;
621
+ clarificationConflictThreshold?: number;
622
+ maxSearchResults?: number;
623
+ }
624
+ /**
625
+ * Cross-field guard for the raw-storage knobs. Runs once at startup and
626
+ * fails closed when `managed_blob` is enabled without the provider
627
+ * fields the chosen adapter needs. No default values, no fallback
628
+ * provider — misconfiguration must surface deterministically per the
629
+ * Phase-3 plan.
630
+ */
631
+ export interface RawStorageValidationInput {
632
+ mode: RawStorageMode;
633
+ provider: RawStorageProvider | null;
634
+ prefix: string;
635
+ localFsRoot: string | null;
636
+ s3Bucket: string | null;
637
+ s3Region: string | null;
638
+ s3AccessKeyId: string | null;
639
+ s3SecretAccessKey: string | null;
640
+ codec: RawContentCodecName;
641
+ codecKeys: ReadonlyMap<string, Buffer>;
642
+ codecActiveKeyId: string | null;
643
+ deploymentEnv: RawStorageDeploymentEnv;
644
+ legacyProviders: ReadonlyArray<RawStorageProvider>;
645
+ /**
646
+ * Names of `RAW_STORAGE_FILECOIN_*` env vars the operator set to a
647
+ * non-empty value, computed by
648
+ * `collectFilecoinProviderEnvKeys(process.env)` in `src/config.ts`.
649
+ * The cross-provider guard in `validateRawStorageConfig` rejects
650
+ * any non-empty list when `provider !== 'filecoin'`. Tests pass a
651
+ * fixed array directly.
652
+ */
653
+ filecoinEnvKeysSet: ReadonlyArray<string>;
654
+ }
655
+ export declare function validateRawStorageConfig(args: RawStorageValidationInput): void;
656
+ export declare const config: RuntimeConfig;
657
+ export declare function applyRuntimeConfigUpdates(target: RuntimeConfig, updates: RuntimeConfigUpdates): string[];
658
+ export declare function updateRuntimeConfig(updates: RuntimeConfigUpdates): string[];
659
+ /**
660
+ * Public/supported operator config surface. Fields listed here are part of
661
+ * v2's stable contract: consumers can rely on their semantics and presence,
662
+ * and changes go through a documented deprecation cycle.
663
+ *
664
+ * This is a documentation type — it does not constrain threading. The runtime
665
+ * still carries a single `RuntimeConfig` object; this array tags the public
666
+ * subset so docs, tests, and future config-split work have a single source of
667
+ * truth. See also: https://docs.atomicmemory.ai/platform/consuming-core.
668
+ */
669
+ export declare const SUPPORTED_RUNTIME_CONFIG_FIELDS: readonly ["databaseUrl", "openaiApiKey", "coreApiKey", "storageKeyHmacSecret", "port", "embeddingProvider", "embeddingModel", "embeddingDimensions", "embeddingApiUrl", "embeddingApiKey", "voyageApiKey", "voyageDocumentModel", "voyageQueryModel", "llmProvider", "llmModel", "llmApiUrl", "llmApiKey", "groqApiKey", "anthropicApiKey", "googleApiKey", "ollamaBaseUrl", "vectorBackend", "skipVectorIndexes", "llmSeed", "crossEncoderModel", "crossEncoderDtype", "maxSearchResults", "retrievalProfile", "retrievalProfileSettings", "entityGraphEnabled", "lessonsEnabled", "agenticRetrievalEnabled", "iterativeRetrievalEnabled", "hybridSearchEnabled", "repairLoopEnabled", "crossEncoderEnabled", "auditLoggingEnabled", "adaptiveRetrievalEnabled", "consensusValidationEnabled", "namespaceClassificationEnabled", "extractionCacheDir", "costLogDir", "costRunId", "costLoggingEnabled", "runtimeConfigMutationEnabled"];
670
+ /**
671
+ * Internal policy config — experimental / tuning flags. Fields here may
672
+ * change semantics, defaults, or be removed without notice. Consumers should
673
+ * NOT rely on these in production. Promoted into the supported contract when
674
+ * a field's behavior stabilizes.
675
+ */
676
+ export declare const INTERNAL_POLICY_CONFIG_FIELDS: readonly ["similarityThreshold", "audnCandidateThreshold", "audnSafeReuseMinSimilarity", "crossAgentCandidateThreshold", "clarificationConflictThreshold", "repairLoopMinSimilarity", "repairSkipSimilarity", "repairDeltaThreshold", "repairConfidenceFloor", "adaptiveSimpleLimit", "adaptiveMediumLimit", "adaptiveComplexLimit", "adaptiveMultiHopLimit", "adaptiveAggregationLimit", "mmrEnabled", "mmrLambda", "linkExpansionEnabled", "linkExpansionMax", "linkSimilarityThreshold", "linkExpansionBeforeMMR", "scoringWeightSimilarity", "scoringWeightImportance", "scoringWeightRecency", "pprEnabled", "pprDamping", "stagedLoadingEnabled", "retrievalTraceEnabled", "ingestTraceDir", "ingestTraceEnabled", "extractionCacheEnabled", "embeddingCacheEnabled", "chunkedExtractionEnabled", "chunkedExtractionFallbackEnabled", "chunkSizeTurns", "chunkOverlapTurns", "consensusExtractionEnabled", "consensusExtractionRuns", "observationDateExtractionEnabled", "quotedEntityExtractionEnabled", "entropyGateEnabled", "entropyGateThreshold", "entropyGateAlpha", "affinityClusteringThreshold", "affinityClusteringMinSize", "affinityClusteringBeta", "affinityClusteringTemporalLambda", "trustScoringEnabled", "trustScoreMinThreshold", "trustPenaltyEnabled", "decayCycleEnabled", "decayRetentionThreshold", "decayMinAgeDays", "memoryCapEnabled", "memoryCapMax", "memoryCapWarnRatio", "entityResolutionThreshold", "entitySearchMinSimilarity", "lessonSimilarityThreshold", "consensusMinMemories", "queryExpansionEnabled", "queryExpansionMinSimilarity", "queryAugmentationEnabled", "queryAugmentationMaxEntities", "queryAugmentationMinSimilarity", "rerankSkipTopSimilarity", "rerankSkipMinGap", "literalListProtectionEnabled", "literalListProtectionMaxProtected", "temporalQueryConstraintEnabled", "temporalQueryConstraintBoost", "fastAudnEnabled", "fastAudnDuplicateThreshold", "observationNetworkEnabled", "deferredAudnEnabled", "deferredAudnBatchSize", "compositeGroupingEnabled", "compositeMinClusterSize", "compositeMaxClusterSize", "compositeSimilarityThreshold", "conflictAutoResolveMs", "tbcEnabled", "hierarchicalRetrievalEnabled", "topicAbstractionEnabled", "topicSearchEnabled", "rerankerEnabled", "rerankerTopN", "recapLayerEnabled", "recapMinClusterSize", "recapSearchEnabled", "recapClusterPivot", "counterEvidenceEnabled", "packagingUseObservedAt", "packagingDualDate", "timelineChannelEnabled", "answerOnlyRetrievalFilter", "retrievalDedupEnabled", "keywordRrfWeight", "entityAttributesEnabled", "entityAttributesTopK", "userProfileChannelEnabled", "episodesChannelEnabled", "episodesChannelTopK", "verifierPassEnabled", "answerFormatAlignmentEnabled", "eventChainPackagingEnabled", "reflectEnabled", "reflectRetrievalTopK", "reflectModel", "reflectMaxObservations", "reflectJobPollMs", "reflectDebounceMs", "phase2SpecialistsEnabled", "abstentionRescueEnabled", "abstentionRescueRetrieveK", "abstentionRescueSonnetModel", "confidencePrefixAdaptiveEnabled", "kuRecencySortEnabled", "msrAggregatorEnabled", "entityCardEnabled", "entityCardMaxPerSession", "entityCardMinObservations", "contradictionPreservationEnabled", "contradictionSurfacingEnabled", "temporalStateEnabled", "rawStorageMode", "rawStorageProvider", "rawStoragePrefix", "rawStorageLocalFsRoot", "rawStorageS3Bucket", "rawStorageS3Region", "rawStorageS3Endpoint", "rawStorageS3AccessKeyId", "rawStorageS3SecretAccessKey", "rawUploadMaxBytes", "rawContentCodec", "rawContentCodecKeys", "rawContentCodecActiveKeyId", "rawStorageDeploymentEnv", "filecoinProvider", "rawStorageLegacyProviders", "rawStoragePointerUriSchemes"];
677
+ export type SupportedRuntimeConfigField = typeof SUPPORTED_RUNTIME_CONFIG_FIELDS[number];
678
+ export type InternalPolicyConfigField = typeof INTERNAL_POLICY_CONFIG_FIELDS[number];
679
+ export type SupportedRuntimeConfig = Pick<RuntimeConfig, SupportedRuntimeConfigField>;
680
+ export type InternalPolicyConfig = Pick<RuntimeConfig, InternalPolicyConfigField>;