@snoai/memory 0.0.0-stage → 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 (478) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +7 -2
  3. package/config/b-profile-section-registry.json +118 -0
  4. package/config/llm/compiled/2026-05-19T230932Z/manifest.json +25 -0
  5. package/config/llm/compiled/2026-05-19T230932Z/registry-root.json +67 -0
  6. package/config/llm/compiled/2026-05-19T230932Z/resolved/mem_claw/openai_gpt_5_nano.json +5 -0
  7. package/config/llm/compiled/2026-05-19T230932Z/resolved/mem_claw/openrouter_auto.json +5 -0
  8. package/config/llm/compiled/2026-05-19T230932Z/resolved/mem_claw/sno_ai_extract.json +5 -0
  9. package/config/llm/compiled/2026-05-19T230932Z/source/mem_claw/openai_gpt_5_nano.mda +24 -0
  10. package/config/llm/compiled/2026-05-19T230932Z/source/mem_claw/openrouter_auto.mda +24 -0
  11. package/config/llm/compiled/2026-05-19T230932Z/source/mem_claw/sno_ai_extract.mda +24 -0
  12. package/config/llm/compiled/2026-07-21T001311Z/manifest.json +43 -0
  13. package/config/llm/compiled/2026-07-21T001311Z/registry-root.json +97 -0
  14. package/config/llm/compiled/2026-07-21T001311Z/resolved/mem_claw/openai_gpt_5_nano.json +5 -0
  15. package/config/llm/compiled/2026-07-21T001311Z/resolved/mem_claw/openrouter_auto.json +5 -0
  16. package/config/llm/compiled/2026-07-21T001311Z/resolved/mem_claw/sno_ai_extract.json +5 -0
  17. package/config/llm/compiled/2026-07-21T001311Z/resolved/mem_claw/sno_conflict_verdict.json +10 -0
  18. package/config/llm/compiled/2026-07-21T001311Z/resolved/mem_claw/sno_extract_chat.json +10 -0
  19. package/config/llm/compiled/2026-07-21T001311Z/resolved/mem_claw/sno_extract_profile.json +10 -0
  20. package/config/llm/compiled/2026-07-21T001311Z/source/mem_claw/openai_gpt_5_nano.mda +24 -0
  21. package/config/llm/compiled/2026-07-21T001311Z/source/mem_claw/openrouter_auto.mda +24 -0
  22. package/config/llm/compiled/2026-07-21T001311Z/source/mem_claw/sno_ai_extract.mda +24 -0
  23. package/config/llm/compiled/2026-07-21T001311Z/source/mem_claw/sno_conflict_verdict.mda +27 -0
  24. package/config/llm/compiled/2026-07-21T001311Z/source/mem_claw/sno_extract_chat.mda +27 -0
  25. package/config/llm/compiled/2026-07-21T001311Z/source/mem_claw/sno_extract_profile.mda +27 -0
  26. package/config/llm/compiled/2026-08-29T060335Z/manifest.json +43 -0
  27. package/config/llm/compiled/2026-08-29T060335Z/registry-root.json +97 -0
  28. package/config/llm/compiled/2026-08-29T060335Z/resolved/mem_claw/openai_gpt_5_nano.json +5 -0
  29. package/config/llm/compiled/2026-08-29T060335Z/resolved/mem_claw/openrouter_auto.json +5 -0
  30. package/config/llm/compiled/2026-08-29T060335Z/resolved/mem_claw/sno_ai_extract.json +5 -0
  31. package/config/llm/compiled/2026-08-29T060335Z/resolved/mem_claw/sno_conflict_verdict.json +10 -0
  32. package/config/llm/compiled/2026-08-29T060335Z/resolved/mem_claw/sno_extract_chat.json +10 -0
  33. package/config/llm/compiled/2026-08-29T060335Z/resolved/mem_claw/sno_extract_profile.json +10 -0
  34. package/config/llm/compiled/2026-08-29T060335Z/source/mem_claw/openai_gpt_5_nano.mda +24 -0
  35. package/config/llm/compiled/2026-08-29T060335Z/source/mem_claw/openrouter_auto.mda +24 -0
  36. package/config/llm/compiled/2026-08-29T060335Z/source/mem_claw/sno_ai_extract.mda +24 -0
  37. package/config/llm/compiled/2026-08-29T060335Z/source/mem_claw/sno_conflict_verdict.mda +27 -0
  38. package/config/llm/compiled/2026-08-29T060335Z/source/mem_claw/sno_extract_chat.mda +27 -0
  39. package/config/llm/compiled/2026-08-29T060335Z/source/mem_claw/sno_extract_profile.mda +27 -0
  40. package/config/llm/compiled/2026-09-04T004828Z/manifest.json +43 -0
  41. package/config/llm/compiled/2026-09-04T004828Z/registry-root.json +97 -0
  42. package/config/llm/compiled/2026-09-04T004828Z/resolved/mem_claw/openai_gpt_5_nano.json +5 -0
  43. package/config/llm/compiled/2026-09-04T004828Z/resolved/mem_claw/openrouter_auto.json +5 -0
  44. package/config/llm/compiled/2026-09-04T004828Z/resolved/mem_claw/sno_ai_extract.json +5 -0
  45. package/config/llm/compiled/2026-09-04T004828Z/resolved/mem_claw/sno_conflict_verdict.json +10 -0
  46. package/config/llm/compiled/2026-09-04T004828Z/resolved/mem_claw/sno_extract_chat.json +10 -0
  47. package/config/llm/compiled/2026-09-04T004828Z/resolved/mem_claw/sno_extract_profile.json +10 -0
  48. package/config/llm/compiled/2026-09-04T004828Z/source/mem_claw/openai_gpt_5_nano.mda +24 -0
  49. package/config/llm/compiled/2026-09-04T004828Z/source/mem_claw/openrouter_auto.mda +24 -0
  50. package/config/llm/compiled/2026-09-04T004828Z/source/mem_claw/sno_ai_extract.mda +24 -0
  51. package/config/llm/compiled/2026-09-04T004828Z/source/mem_claw/sno_conflict_verdict.mda +27 -0
  52. package/config/llm/compiled/2026-09-04T004828Z/source/mem_claw/sno_extract_chat.mda +27 -0
  53. package/config/llm/compiled/2026-09-04T004828Z/source/mem_claw/sno_extract_profile.mda +27 -0
  54. package/config/llm/current.json +4 -0
  55. package/config/llm/source/mem_claw/openai_gpt_5_nano.mda +24 -0
  56. package/config/llm/source/mem_claw/openrouter_auto.mda +24 -0
  57. package/config/llm/source/mem_claw/sno_ai_extract.mda +24 -0
  58. package/config/llm/source/mem_claw/sno_conflict_verdict.mda +27 -0
  59. package/config/llm/source/mem_claw/sno_extract_chat.mda +27 -0
  60. package/config/llm/source/mem_claw/sno_extract_profile.mda +27 -0
  61. package/config/llm.trust.json +37 -0
  62. package/dist/_types-CUKHSRkS.d.ts +103 -0
  63. package/dist/access-tracker-CSc21GtV.d.ts +110 -0
  64. package/dist/adapter-DMEmCTKo.d.ts +69 -0
  65. package/dist/adapter-XaRHZWZ2.js +333 -0
  66. package/dist/agent-llm-port-5oXgBpzJ.d.ts +53 -0
  67. package/dist/all-resources-BQK2ugjB.js +6379 -0
  68. package/dist/all-resources-Dij6l5h0.d.ts +18 -0
  69. package/dist/ambient-learning-text-normalizer-CxjATmMp.js +170 -0
  70. package/dist/ambient-learning-text-normalizer-_fH3LeuK.d.ts +10 -0
  71. package/dist/atomic-extraction-reply-BJ9XV_9s.js +863 -0
  72. package/dist/atomic-extraction-skill-CcXmuCqL.js +56 -0
  73. package/dist/atomic-memory-extraction-BpOUWPJM.d.ts +327 -0
  74. package/dist/atomic-memory-extraction-sdNf1-B1.js +3605 -0
  75. package/dist/b-profile-section-dictionary-provider-BHkoNqgk.js +1812 -0
  76. package/dist/b-profile-section-dictionary-provider-BxbksLj3.d.ts +62 -0
  77. package/dist/best-effort-BPZSzKk0.d.ts +9 -0
  78. package/dist/calendar-instruction-CzqZbAPG.js +194 -0
  79. package/dist/capture-policy-detector-CHz5GOPA.d.ts +53 -0
  80. package/dist/capture-policy-detector-DaMfy9CZ.js +357 -0
  81. package/dist/classifier-C96uH9OF.d.ts +272 -0
  82. package/dist/client.d.ts +34 -0
  83. package/dist/client.js +305 -0
  84. package/dist/coding-skin.d.ts +51 -0
  85. package/dist/coding-skin.js +55 -0
  86. package/dist/config-tSrvLXgV.js +2577 -0
  87. package/dist/connection-DAbzki8K.d.ts +391 -0
  88. package/dist/connection-DliCOBB2.js +297 -0
  89. package/dist/daily-log-generator-CH_KuWHs.js +469 -0
  90. package/dist/daily-log-generator-CsQPHl4A.d.ts +73 -0
  91. package/dist/daily-spend-estimator-DiwzBlo1.d.ts +8 -0
  92. package/dist/data-bootstrap-CYniFp8b.js +172 -0
  93. package/dist/data-bootstrap-CcJUwkqf.d.ts +30 -0
  94. package/dist/data-paths-C7sNdqvP.d.ts +22 -0
  95. package/dist/derived-suppression-cache-C7bGARc0.d.ts +36 -0
  96. package/dist/diagnostic-encoder.d.ts +6 -0
  97. package/dist/diagnostic-encoder.js +29 -0
  98. package/dist/embedding-provider-client-Q_hJonK9.js +294 -0
  99. package/dist/embedding-provider-client-vynZMuit.d.ts +94 -0
  100. package/dist/entry-metadata-parser-BIVSMCIk.js +20 -0
  101. package/dist/error-D-wb-rZw.js +23 -0
  102. package/dist/error-signals-D8_3vYu4.d.ts +28 -0
  103. package/dist/error-signals-lMH2uAdV.js +134 -0
  104. package/dist/errors-CeVRxf9V.d.ts +49 -0
  105. package/dist/extraction-text-sanitizer-B_AhIecT.d.ts +32 -0
  106. package/dist/i18n-text-DbD6Qify.d.ts +13 -0
  107. package/dist/index-BsMap4It.d.ts +650 -0
  108. package/dist/index-DL8AVj0Z.d.ts +571 -0
  109. package/dist/index-DQ7VL6d3.d.ts +350 -0
  110. package/dist/index.d.ts +65 -0
  111. package/dist/index.js +1201 -0
  112. package/dist/intent-analyzer-B5XVrWwe.d.ts +28 -0
  113. package/dist/internal/config/index.d.ts +2 -0
  114. package/dist/internal/config/index.js +581 -0
  115. package/dist/internal/config/plugin-config-schema.d.ts +2 -0
  116. package/dist/internal/config/plugin-config-schema.js +2 -0
  117. package/dist/internal/config/product-mode.d.ts +2 -0
  118. package/dist/internal/config/product-mode.js +36 -0
  119. package/dist/internal/config/settings.d.ts +2 -0
  120. package/dist/internal/config/settings.js +265 -0
  121. package/dist/internal/config/skill-categories.d.ts +4 -0
  122. package/dist/internal/config/skill-categories.js +68 -0
  123. package/dist/internal/config/skin-defaults.d.ts +6 -0
  124. package/dist/internal/config/skin-defaults.js +6 -0
  125. package/dist/internal/contract/discovery.d.ts +10 -0
  126. package/dist/internal/contract/discovery.js +53 -0
  127. package/dist/internal/contract/profile.d.ts +2 -0
  128. package/dist/internal/contract/profile.js +44 -0
  129. package/dist/internal/contract/routes.d.ts +2 -0
  130. package/dist/internal/contract/routes.js +61 -0
  131. package/dist/internal/engine/bindings/memory-cli-shared.d.ts +47 -0
  132. package/dist/internal/engine/bindings/memory-cli-shared.js +84 -0
  133. package/dist/internal/engine/bindings/memory-forget-tool.d.ts +5 -0
  134. package/dist/internal/engine/bindings/memory-forget-tool.js +66 -0
  135. package/dist/internal/engine/bindings/memory-list-tool.d.ts +5 -0
  136. package/dist/internal/engine/bindings/memory-list-tool.js +57 -0
  137. package/dist/internal/engine/bindings/memory-recall-tool.d.ts +10 -0
  138. package/dist/internal/engine/bindings/memory-recall-tool.js +283 -0
  139. package/dist/internal/engine/bindings/memory-reflection-resolve-tool.d.ts +5 -0
  140. package/dist/internal/engine/bindings/memory-reflection-resolve-tool.js +150 -0
  141. package/dist/internal/engine/bindings/memory-stats-tool.d.ts +5 -0
  142. package/dist/internal/engine/bindings/memory-stats-tool.js +43 -0
  143. package/dist/internal/engine/bindings/memory-store-tool.d.ts +5 -0
  144. package/dist/internal/engine/bindings/memory-store-tool.js +165 -0
  145. package/dist/internal/engine/bindings/memory-tool-access.d.ts +16 -0
  146. package/dist/internal/engine/bindings/memory-tool-access.js +46 -0
  147. package/dist/internal/engine/bindings/memory-tool-formatting.d.ts +62 -0
  148. package/dist/internal/engine/bindings/memory-tool-formatting.js +106 -0
  149. package/dist/internal/engine/bindings/memory-tool-results.d.ts +8 -0
  150. package/dist/internal/engine/bindings/memory-tool-results.js +41 -0
  151. package/dist/internal/engine/bindings/memory-tool-schemas.d.ts +109 -0
  152. package/dist/internal/engine/bindings/memory-tool-schemas.js +75 -0
  153. package/dist/internal/engine/bindings/memory-update-tool.d.ts +5 -0
  154. package/dist/internal/engine/bindings/memory-update-tool.js +127 -0
  155. package/dist/internal/engine/bindings/sno-station-mem-ambient-learning-hook.d.ts +14 -0
  156. package/dist/internal/engine/bindings/sno-station-mem-ambient-learning-hook.js +248 -0
  157. package/dist/internal/engine/bindings/sno-station-mem-auto-recall-hook.d.ts +12 -0
  158. package/dist/internal/engine/bindings/sno-station-mem-auto-recall-hook.js +324 -0
  159. package/dist/internal/engine/bindings/sno-station-mem-hook-types.d.ts +56 -0
  160. package/dist/internal/engine/bindings/sno-station-mem-hook-types.js +1 -0
  161. package/dist/internal/engine/bindings/sno-station-mem-insight-distill-factory.d.ts +14 -0
  162. package/dist/internal/engine/bindings/sno-station-mem-insight-distill-factory.js +119 -0
  163. package/dist/internal/engine/bindings/sno-station-mem-message-transcript.d.ts +52 -0
  164. package/dist/internal/engine/bindings/sno-station-mem-message-transcript.js +145 -0
  165. package/dist/internal/engine/bindings/sno-station-mem-reset-hook.d.ts +10 -0
  166. package/dist/internal/engine/bindings/sno-station-mem-reset-hook.js +9 -0
  167. package/dist/internal/engine/bindings/sno-station-mem-runtime-mode.d.ts +37 -0
  168. package/dist/internal/engine/bindings/sno-station-mem-runtime-mode.js +105 -0
  169. package/dist/internal/engine/bindings/sno-station-mem-session-state.d.ts +10 -0
  170. package/dist/internal/engine/bindings/sno-station-mem-session-state.js +27 -0
  171. package/dist/internal/engine/eval/trace.d.ts +2 -0
  172. package/dist/internal/engine/eval/trace.js +151 -0
  173. package/dist/internal/engine/extraction/ambient-learning-text-normalizer.d.ts +2 -0
  174. package/dist/internal/engine/extraction/ambient-learning-text-normalizer.js +2 -0
  175. package/dist/internal/engine/extraction/atomic-memory-extraction.d.ts +2 -0
  176. package/dist/internal/engine/extraction/atomic-memory-extraction.js +2 -0
  177. package/dist/internal/engine/extraction/b-profile-section-dictionary-provider.d.ts +2 -0
  178. package/dist/internal/engine/extraction/b-profile-section-dictionary-provider.js +2 -0
  179. package/dist/internal/engine/extraction/b-profile-section-rekey.d.ts +49 -0
  180. package/dist/internal/engine/extraction/b-profile-section-rekey.js +730 -0
  181. package/dist/internal/engine/extraction/capture-policy-detector.d.ts +2 -0
  182. package/dist/internal/engine/extraction/capture-policy-detector.js +2 -0
  183. package/dist/internal/engine/extraction/embedding-provider-client.d.ts +2 -0
  184. package/dist/internal/engine/extraction/embedding-provider-client.js +2 -0
  185. package/dist/internal/engine/extraction/extraction-text-sanitizer.d.ts +2 -0
  186. package/dist/internal/engine/extraction/extraction-text-sanitizer.js +114 -0
  187. package/dist/internal/engine/extraction/memory-metadata-codec.d.ts +3 -0
  188. package/dist/internal/engine/extraction/memory-metadata-codec.js +2 -0
  189. package/dist/internal/engine/extraction/memory-temporality-classifier.d.ts +2 -0
  190. package/dist/internal/engine/extraction/memory-temporality-classifier.js +2 -0
  191. package/dist/internal/engine/i18n/all-resources.d.ts +2 -0
  192. package/dist/internal/engine/i18n/all-resources.js +2 -0
  193. package/dist/internal/engine/i18n/locales.d.ts +2 -0
  194. package/dist/internal/engine/i18n/locales.js +19 -0
  195. package/dist/internal/engine/i18n/res/_types.d.ts +2 -0
  196. package/dist/internal/engine/i18n/res/_types.js +11 -0
  197. package/dist/internal/engine/observability/adapter.d.ts +2 -0
  198. package/dist/internal/engine/observability/adapter.js +2 -0
  199. package/dist/internal/engine/observability/best-effort.d.ts +2 -0
  200. package/dist/internal/engine/observability/best-effort.js +41 -0
  201. package/dist/internal/engine/observability/early-diagnostics.js +2 -0
  202. package/dist/internal/engine/observability/memory-snapshot.d.ts +2 -0
  203. package/dist/internal/engine/observability/memory-snapshot.js +44 -0
  204. package/dist/internal/engine/observability/observable-embedder.d.ts +2 -0
  205. package/dist/internal/engine/observability/observable-embedder.js +43 -0
  206. package/dist/internal/engine/observability/observable-llm-client.d.ts +2 -0
  207. package/dist/internal/engine/observability/observable-llm-client.js +98 -0
  208. package/dist/internal/engine/observability/observable-memory-store.d.ts +2 -0
  209. package/dist/internal/engine/observability/observable-memory-store.js +701 -0
  210. package/dist/internal/engine/observability/observable-retriever.d.ts +2 -0
  211. package/dist/internal/engine/observability/observable-retriever.js +95 -0
  212. package/dist/internal/engine/observability/runtime-diagnostics.d.ts +13 -0
  213. package/dist/internal/engine/observability/runtime-diagnostics.js +96 -0
  214. package/dist/internal/engine/observability/session-registry.d.ts +2 -0
  215. package/dist/internal/engine/observability/session-registry.js +58 -0
  216. package/dist/internal/engine/observability/version-metadata.d.ts +7 -0
  217. package/dist/internal/engine/observability/version-metadata.js +59 -0
  218. package/dist/internal/engine/operations/daily-spend-estimator.d.ts +2 -0
  219. package/dist/internal/engine/operations/daily-spend-estimator.js +97 -0
  220. package/dist/internal/engine/operations/learning-file-maintenance.d.ts +2 -0
  221. package/dist/internal/engine/operations/learning-file-maintenance.js +255 -0
  222. package/dist/internal/engine/operations/memory-tier-promoter.d.ts +2 -0
  223. package/dist/internal/engine/operations/memory-tier-promoter.js +95 -0
  224. package/dist/internal/engine/operations/runtime-audit-log.d.ts +3 -0
  225. package/dist/internal/engine/operations/runtime-audit-log.js +3 -0
  226. package/dist/internal/engine/provider/canonical-memory-corpus.d.ts +38 -0
  227. package/dist/internal/engine/provider/canonical-memory-corpus.js +253 -0
  228. package/dist/internal/engine/provider/provider-registration.d.ts +39 -0
  229. package/dist/internal/engine/provider/provider-registration.js +2 -0
  230. package/dist/internal/engine/provider/provider-row-renderer.d.ts +7 -0
  231. package/dist/internal/engine/provider/provider-row-renderer.js +53 -0
  232. package/dist/internal/engine/provider/provider-types.d.ts +2 -0
  233. package/dist/internal/engine/provider/provider-types.js +1 -0
  234. package/dist/internal/engine/reflection/daily-log-generator.d.ts +2 -0
  235. package/dist/internal/engine/reflection/daily-log-generator.js +2 -0
  236. package/dist/internal/engine/reflection/reflection-command-hooks.d.ts +2 -0
  237. package/dist/internal/engine/reflection/reflection-command-hooks.js +2 -0
  238. package/dist/internal/engine/reflection/reflection-deps.d.ts +2 -0
  239. package/dist/internal/engine/reflection/reflection-deps.js +1 -0
  240. package/dist/internal/engine/reflection/reflection-embedded-generator.d.ts +2 -0
  241. package/dist/internal/engine/reflection/reflection-embedded-generator.js +2 -0
  242. package/dist/internal/engine/reflection/reflection-injection-hooks.d.ts +2 -0
  243. package/dist/internal/engine/reflection/reflection-injection-hooks.js +219 -0
  244. package/dist/internal/engine/reflection/reflection-lifecycle-hooks.d.ts +2 -0
  245. package/dist/internal/engine/reflection/reflection-lifecycle-hooks.js +63 -0
  246. package/dist/internal/engine/reflection/strategy-hook-runner.d.ts +4 -0
  247. package/dist/internal/engine/reflection/strategy-hook-runner.js +3 -0
  248. package/dist/internal/engine/rem/classifier.d.ts +2 -0
  249. package/dist/internal/engine/rem/classifier.js +180 -0
  250. package/dist/internal/engine/rem/index.d.ts +4 -0
  251. package/dist/internal/engine/rem/index.js +2551 -0
  252. package/dist/internal/engine/rem/types.d.ts +2 -0
  253. package/dist/internal/engine/rem/types.js +40 -0
  254. package/dist/internal/engine/retrieval/access-tracker.d.ts +2 -0
  255. package/dist/internal/engine/retrieval/access-tracker.js +314 -0
  256. package/dist/internal/engine/retrieval/intent-analyzer.d.ts +2 -0
  257. package/dist/internal/engine/retrieval/intent-analyzer.js +27 -0
  258. package/dist/internal/engine/retrieval/retrieval-gate.d.ts +2 -0
  259. package/dist/internal/engine/retrieval/retrieval-gate.js +47 -0
  260. package/dist/internal/engine/retrieval/retriever.d.ts +2 -0
  261. package/dist/internal/engine/retrieval/retriever.js +2 -0
  262. package/dist/internal/engine/security/memory-scope-policy.d.ts +2 -0
  263. package/dist/internal/engine/security/memory-scope-policy.js +2 -0
  264. package/dist/internal/engine/security/redact.d.ts +2 -0
  265. package/dist/internal/engine/security/redact.js +34 -0
  266. package/dist/internal/engine/security/scopes.d.ts +3 -0
  267. package/dist/internal/engine/security/scopes.js +3 -0
  268. package/dist/internal/engine/shared/errors.d.ts +2 -0
  269. package/dist/internal/engine/shared/errors.js +66 -0
  270. package/dist/internal/engine/shared/i18n-text.d.ts +2 -0
  271. package/dist/internal/engine/shared/i18n-text.js +58 -0
  272. package/dist/internal/engine/shared/iso-date-time.d.ts +16 -0
  273. package/dist/internal/engine/shared/iso-date-time.js +40 -0
  274. package/dist/internal/engine/shared/lru.d.ts +2 -0
  275. package/dist/internal/engine/shared/lru.js +30 -0
  276. package/dist/internal/engine/shared/memory-kind-policy.d.ts +2 -0
  277. package/dist/internal/engine/shared/memory-kind-policy.js +64 -0
  278. package/dist/internal/engine/shared/paths.d.ts +3 -0
  279. package/dist/internal/engine/shared/paths.js +2 -0
  280. package/dist/internal/engine/shared/types.d.ts +3 -0
  281. package/dist/internal/engine/shared/types.js +25 -0
  282. package/dist/internal/engine/shared/utils.d.ts +2 -0
  283. package/dist/internal/engine/shared/utils.js +175 -0
  284. package/dist/internal/engine/telemetry/memory-telemetry-api.d.ts +134 -0
  285. package/dist/internal/engine/telemetry/memory-telemetry-api.js +730 -0
  286. package/dist/internal/engine/telemetry/memory-telemetry-observability.d.ts +24 -0
  287. package/dist/internal/engine/telemetry/memory-telemetry-observability.js +133 -0
  288. package/dist/internal/engine/telemetry/memory-telemetry-outbox.d.ts +2 -0
  289. package/dist/internal/engine/telemetry/memory-telemetry-outbox.js +443 -0
  290. package/dist/internal/engine/telemetry/memory-telemetry-types.d.ts +2 -0
  291. package/dist/internal/engine/telemetry/memory-telemetry-types.js +21 -0
  292. package/dist/internal/engine/telemetry/observe-ledger.d.ts +30 -0
  293. package/dist/internal/engine/telemetry/observe-ledger.js +111 -0
  294. package/dist/internal/model/agent-llm-port.d.ts +2 -0
  295. package/dist/internal/model/agent-llm-port.js +1 -0
  296. package/dist/internal/model/llm-client.d.ts +3 -0
  297. package/dist/internal/model/llm-client.js +3 -0
  298. package/dist/internal/model/llm-failure.d.ts +26 -0
  299. package/dist/internal/model/llm-failure.js +63 -0
  300. package/dist/internal/model/llm-mode-routing.d.ts +22 -0
  301. package/dist/internal/model/llm-mode-routing.js +37 -0
  302. package/dist/internal/store/atomic-memory-cutover-sql.d.ts +13 -0
  303. package/dist/internal/store/atomic-memory-cutover-sql.js +237 -0
  304. package/dist/internal/store/connection.d.ts +2 -0
  305. package/dist/internal/store/connection.js +2 -0
  306. package/dist/internal/store/data-bootstrap.d.ts +2 -0
  307. package/dist/internal/store/data-bootstrap.js +2 -0
  308. package/dist/internal/store/data-paths.d.ts +2 -0
  309. package/dist/internal/store/data-paths.js +65 -0
  310. package/dist/internal/store/maintenance.d.ts +75 -0
  311. package/dist/internal/store/maintenance.js +1401 -0
  312. package/dist/internal/store/memory-kinds-cutover-migrator.d.ts +28 -0
  313. package/dist/internal/store/memory-kinds-cutover-migrator.js +415 -0
  314. package/dist/internal/store/migrations.d.ts +27 -0
  315. package/dist/internal/store/migrations.js +201 -0
  316. package/dist/internal/store/sqlite-runtime.d.ts +2 -0
  317. package/dist/internal/store/sqlite-runtime.js +109 -0
  318. package/dist/internal/store/store.d.ts +3 -0
  319. package/dist/internal/store/store.js +2 -0
  320. package/dist/learning-file-maintenance-9b-Ut6Kv.d.ts +30 -0
  321. package/dist/llm-client-B7Xoxqou.js +1378 -0
  322. package/dist/llm-client-DOTSGzhe.d.ts +51 -0
  323. package/dist/locales-JxGmkG6t.d.ts +7 -0
  324. package/dist/log-site-catalog.generated-B9WYdnAM.js +2321 -0
  325. package/dist/log-site-catalog.json +1 -0
  326. package/dist/lru-DyoaTyIs.d.ts +14 -0
  327. package/dist/memdump.d.ts +52 -0
  328. package/dist/memdump.js +163 -0
  329. package/dist/memory-entry-projector-DHo8jH10.js +1015 -0
  330. package/dist/memory-kind-policy-LKt0u3gy.d.ts +23 -0
  331. package/dist/memory-metadata-codec-C3oQd47V.d.ts +68 -0
  332. package/dist/memory-metadata-codec-DL1sbJiN.js +577 -0
  333. package/dist/memory-runtime-BZtREuwW.js +19459 -0
  334. package/dist/memory-scope-policy-1gg5QlWZ.d.ts +67 -0
  335. package/dist/memory-scope-policy-DICSCURA.js +283 -0
  336. package/dist/memory-snapshot-3e44ND2i.d.ts +16 -0
  337. package/dist/memory-source-order-BtrIxaIt.js +134 -0
  338. package/dist/memory-store-base-XRA4S9Xl.d.ts +1095 -0
  339. package/dist/memory-store-shared-DeIDkhLj.js +158 -0
  340. package/dist/memory-store-write-validation-B_hDG2zf.js +243 -0
  341. package/dist/memory-telemetry-incidents-BWA9kcZx.js +8 -0
  342. package/dist/memory-telemetry-metadata-CA7W8tK6.js +77 -0
  343. package/dist/memory-telemetry-outbox-ddTdImt7.d.ts +74 -0
  344. package/dist/memory-telemetry-receipts-MAJecvXQ.d.ts +34 -0
  345. package/dist/memory-telemetry-receipts-YsxbwOAf.js +91 -0
  346. package/dist/memory-telemetry-types-CufVmrCs.d.ts +14 -0
  347. package/dist/memory-temporality-classifier-CEdRTN5J.d.ts +43 -0
  348. package/dist/memory-temporality-classifier-CKiTAHXe.js +184 -0
  349. package/dist/memory-tier-promoter-DbTpahkP.d.ts +43 -0
  350. package/dist/memory-tool-dependencies-CLODycUw.js +19 -0
  351. package/dist/memory-tool-dependencies-N69chrQc.d.ts +14 -0
  352. package/dist/model-call-table-CspopkBg.js +563 -0
  353. package/dist/model-reply-text-CKopStP2.js +334 -0
  354. package/dist/observable-embedder-DQnNgf9O.d.ts +17 -0
  355. package/dist/observable-llm-client-uwqPADpN.d.ts +21 -0
  356. package/dist/observable-memory-store-BaZKbhgq.d.ts +73 -0
  357. package/dist/observable-retriever-Dt_NUxAA.d.ts +23 -0
  358. package/dist/operation-cancellation-CTKWwNHk.js +81 -0
  359. package/dist/paths-qVF-5uBq.d.ts +1 -0
  360. package/dist/plugin-config-schema-C0UUbOmG.d.ts +413 -0
  361. package/dist/plugin-config-schema-YJLyIIcJ.js +361 -0
  362. package/dist/profile-TWPJ_myr.d.ts +13 -0
  363. package/dist/profile-section-writer-hIphqpUY.js +2149 -0
  364. package/dist/provider-registration-CF1tg8Xy.js +721 -0
  365. package/dist/provider-runtime-types-DFhtdA6d.d.ts +134 -0
  366. package/dist/provider-types-CZGm6v88.d.ts +23 -0
  367. package/dist/redact-BTIZcHQL.d.ts +5 -0
  368. package/dist/reflection-command-hooks-BeQiJI9-.js +644 -0
  369. package/dist/reflection-command-hooks-C1Vxgb-O.d.ts +32 -0
  370. package/dist/reflection-deps-RpLPFrSc.d.ts +19 -0
  371. package/dist/reflection-embedded-generator-CDUhgV96.js +130 -0
  372. package/dist/reflection-embedded-generator-CxOex5xK.d.ts +14 -0
  373. package/dist/reflection-injection-hooks-DfUgqu8f.d.ts +43 -0
  374. package/dist/reflection-lifecycle-hooks-Ct5HBdSG.d.ts +27 -0
  375. package/dist/relation-dictionary-Cev1kyLe.js +4248 -0
  376. package/dist/release-download.d.ts +8 -0
  377. package/dist/release-download.js +32 -0
  378. package/dist/relevant-memories-context-m8nuFZcM.js +23 -0
  379. package/dist/rem-batch-executor-Cbm5gfSe.js +31644 -0
  380. package/dist/rem-batch-executor-bc0IFlp2.js +2 -0
  381. package/dist/rem-consumer-retrieval-CRpvG8KS.js +246 -0
  382. package/dist/rem-trigger-BTxkcjgT.js +729 -0
  383. package/dist/resolver-Dy-hnjCR.js +103 -0
  384. package/dist/results-C3ZLroMb.js +140 -0
  385. package/dist/retrieval-gate-Bx2Zg7jD.d.ts +31 -0
  386. package/dist/retriever-CygHBazG.js +1757 -0
  387. package/dist/retriever-Ruk3zp7_.d.ts +469 -0
  388. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  389. package/dist/routes-Ce7SQKec.js +59 -0
  390. package/dist/runtime-audit-log-BCeujlEp.js +430 -0
  391. package/dist/runtime-audit-log-zpQiR9HT.d.ts +149 -0
  392. package/dist/scopes-CSOn6zdd.js +71 -0
  393. package/dist/scopes-CtrY-YQ3.d.ts +23 -0
  394. package/dist/server-BPAY4NTG.js +1410 -0
  395. package/dist/session-registry-DBoE7AvZ.d.ts +14 -0
  396. package/dist/sidecar/main.d.ts +1 -0
  397. package/dist/sidecar/main.js +56 -0
  398. package/dist/signed-registry-constants-Bv0fgZ8Q.d.ts +12 -0
  399. package/dist/signed-registry-constants-yq3DlG3B.js +82 -0
  400. package/dist/sno-station-mem-runtime-dependencies-Bu-MiqPX.d.ts +31 -0
  401. package/dist/sno-station-mem-runtime-dependencies-DjLOhB45.js +30 -0
  402. package/dist/sqlite-runtime-L_ywirTm.d.ts +58 -0
  403. package/dist/store-2pM0-dZg.d.ts +27 -0
  404. package/dist/store-DzpZBMEm.js +5830 -0
  405. package/dist/strategy-hook-runner-gBtU47tX.d.ts +16 -0
  406. package/dist/strategy-hook-runner-zmdIYOmQ.js +110 -0
  407. package/dist/token-counter-BD1f48Km.js +73 -0
  408. package/dist/trace-1t1n_wUm.d.ts +86 -0
  409. package/dist/types-DxKqU60b.d.ts +477 -0
  410. package/dist/types-pVomjzqR.d.ts +132 -0
  411. package/dist/unplaced-candidate-migration-CbQHzcEM.js +940 -0
  412. package/dist/utils-Ctb9aevJ.d.ts +34 -0
  413. package/drizzle/0000_initial.sql +10 -0
  414. package/drizzle/0001_virtual_tables.sql +34 -0
  415. package/drizzle/0002_add_indexes.sql +11 -0
  416. package/drizzle/0003_content_hash_lookup_index.sql +2 -0
  417. package/drizzle/0004_chunk_swap.sql +60 -0
  418. package/drizzle/0005_drop_legacy_vec_fts.sql +10 -0
  419. package/drizzle/0006_fts_simple.sql +45 -0
  420. package/drizzle/0007_restore_simple_fts.sql +40 -0
  421. package/drizzle/0008_widen_memory_hash_unique_index.sql +4 -0
  422. package/drizzle/0009_memory_telemetry.sql +109 -0
  423. package/drizzle/0010_provider_mappings.sql +27 -0
  424. package/drizzle/0011_db_optimization.sql +82 -0
  425. package/drizzle/0012_b_profile_lanes.sql +9 -0
  426. package/drizzle/0013_extraction_timestamps.sql +6 -0
  427. package/drizzle/0014_extraction_timestamp_source.sql +3 -0
  428. package/drizzle/0015_task_lifecycle_state.sql +101 -0
  429. package/drizzle/0016_task_lifecycle_legacy_migration.sql +144 -0
  430. package/drizzle/0017_unplaced_candidates.sql +15 -0
  431. package/drizzle/0018_rem_batch_chassis.sql +71 -0
  432. package/drizzle/0019_profile_recovery_entries.sql +17 -0
  433. package/drizzle/0020_rem_scan_retry_progress.down.sql +14 -0
  434. package/drizzle/0020_rem_scan_retry_progress.sql +24 -0
  435. package/drizzle/0021_rem_two_facet_storage.down.sql +14 -0
  436. package/drizzle/0021_rem_two_facet_storage.sql +42 -0
  437. package/drizzle/0022_rem_facet_chunk_versions.down.sql +4 -0
  438. package/drizzle/0022_rem_facet_chunk_versions.sql +4 -0
  439. package/drizzle/0023_rem_defect_ledger.sql +40 -0
  440. package/drizzle/0024_rem_unbuilt_foundations.down.sql +13 -0
  441. package/drizzle/0024_rem_unbuilt_foundations.sql +65 -0
  442. package/drizzle/0025_rem_journal_operation_constraint.sql +28 -0
  443. package/drizzle/0026_rem_journal_detail.sql +1 -0
  444. package/drizzle/0027_legacy_nodix_namespace.sql +3 -0
  445. package/drizzle/0028_memory_timezone.sql +23 -0
  446. package/drizzle/0029_rem_write_hash_symmetry.sql +17 -0
  447. package/drizzle/0030_atomic_memory_additive.sql +105 -0
  448. package/drizzle/0031_atomic_extraction_ledger.sql +23 -0
  449. package/drizzle/0032_atomic_memory_entities.sql +12 -0
  450. package/drizzle/0033_todo_own_store.sql +99 -0
  451. package/drizzle/meta/0000_snapshot.json +87 -0
  452. package/drizzle/meta/_journal.json +244 -0
  453. package/generated/rem-operations.json +1 -0
  454. package/package.json +126 -4
  455. package/scripts/download-simple-tokenizer.mjs +254 -0
  456. package/settings.default.json +243 -0
  457. package/skills/extract-atomic-memory/SKILL.md +298 -0
  458. package/skills/extract-atomic-memory/references/account-for-turns.md +9 -0
  459. package/skills/extract-atomic-memory/references/calendar-meaning.md +64 -0
  460. package/skills/extract-atomic-memory/references/capture.md +120 -0
  461. package/skills/extract-atomic-memory/references/enrichment.md +92 -0
  462. package/skills/extract-atomic-memory/references/missing-durable-half.md +6 -0
  463. package/skills/extract-atomic-memory/references/progress-classification.md +21 -0
  464. package/skills/extract-atomic-memory/references/resolve-subject.md +19 -0
  465. package/skills/extract-atomic-memory/references/surrounding-context.md +10 -0
  466. package/skills/extract-atomic-memory/references/user-subject-guard.md +29 -0
  467. package/skills/judge-group-closure/SKILL.md +25 -0
  468. package/skills/judge-rem-memory-updates/SKILL.md +56 -0
  469. package/skills/judge-rem-memory-updates/agents/openai.yaml +4 -0
  470. package/skills/judge-retired-position/SKILL.md +25 -0
  471. package/skills/judge-task-lifecycle/SKILL.md +45 -0
  472. package/skills/key-state-attribute/SKILL.md +16 -0
  473. package/skills/resolve-entity-identity/SKILL.md +24 -0
  474. package/skills/resolve-relative-time/SKILL.md +22 -0
  475. package/sqlite-extensions/LICENSE-simple-tokenizer +28 -0
  476. package/sqlite-extensions/LICENSE-sqlite-vec +21 -0
  477. package/sqlite-extensions/linux-arm64/vec0.so +0 -0
  478. package/sqlite-extensions/linux-x64/vec0.so +0 -0
@@ -0,0 +1,477 @@
1
+ import "./plugin-config-schema-C0UUbOmG.js";
2
+ import { z } from "zod";
3
+ import { ContentType } from "@snoai/chunking";
4
+ //#region src/engine/extraction/memory-metadata-types.d.ts
5
+ type EntryLike = {
6
+ text?: string;
7
+ category?: MemoryCategory;
8
+ importance?: number;
9
+ timestamp?: number;
10
+ metadata?: string;
11
+ };
12
+ interface MemoryRelation {
13
+ /** Predicate / edge label (e.g. "friend_of", "owns", "lives_in"). */
14
+ type: string;
15
+ /** Object — memory id when known, otherwise canonical-name slug. */
16
+ targetId: string;
17
+ /**
18
+ * Optional explicit subject. When omitted, the parent memory's
19
+ * `fact_key` is the implicit subject. Set explicitly when the
20
+ * relation describes a triple between two third parties (e.g. an
21
+ * `event` candidate that involves two entities).
22
+ */
23
+ source?: string;
24
+ }
25
+ declare const memoryCategory: z.ZodEnum<{
26
+ episodic: "episodic";
27
+ profile: "profile";
28
+ persona: "persona";
29
+ lesson: "lesson";
30
+ summary: "summary";
31
+ state: "state";
32
+ }>;
33
+ declare const memoryTier: z.ZodEnum<{
34
+ core: "core";
35
+ working: "working";
36
+ peripheral: "peripheral";
37
+ }>;
38
+ declare const memoryState: z.ZodEnum<{
39
+ pending: "pending";
40
+ confirmed: "confirmed";
41
+ archived: "archived";
42
+ }>;
43
+ declare const memorySource: z.ZodEnum<{
44
+ manual: "manual";
45
+ "ambient-learning": "ambient-learning";
46
+ agent_end: "agent_end";
47
+ reflection: "reflection";
48
+ "session-summary": "session-summary";
49
+ legacy: "legacy";
50
+ }>;
51
+ declare const memoryLayer: z.ZodEnum<{
52
+ durable: "durable";
53
+ working: "working";
54
+ reflection: "reflection";
55
+ archive: "archive";
56
+ }>;
57
+ type MemoryState = z.infer<typeof memoryState>;
58
+ type MemoryLayer = z.infer<typeof memoryLayer>;
59
+ type MemorySource = z.infer<typeof memorySource>;
60
+ type ActiveTaskStatusMetadata = "active" | "completed" | "removed";
61
+ type ActiveTaskOriginMetadata = {
62
+ kind: "runtime";
63
+ source_id: string;
64
+ normalized_description: string;
65
+ } | {
66
+ kind: "legacy";
67
+ omnibus_row_id: string;
68
+ item_index: number;
69
+ legacy_item_id: string;
70
+ };
71
+ type ActiveTaskLifecycleMetadata = {
72
+ from: ActiveTaskStatusMetadata | null;
73
+ to: ActiveTaskStatusMetadata;
74
+ at: number;
75
+ source_id: string;
76
+ };
77
+ declare const activeTaskStatus: z.ZodEnum<{
78
+ active: "active";
79
+ completed: "completed";
80
+ removed: "removed";
81
+ }>;
82
+ declare const activeTaskOrigin: z.ZodType<ActiveTaskOriginMetadata>;
83
+ declare const activeTaskLifecycleEvent: z.ZodType<ActiveTaskLifecycleMetadata>;
84
+ type MemoryMetadataCommonShape = {
85
+ l0_abstract: z.ZodString;
86
+ l1_overview: z.ZodString;
87
+ l2_content: z.ZodString;
88
+ tier: typeof memoryTier;
89
+ access_count: z.ZodNumber;
90
+ confidence: z.ZodNumber;
91
+ last_accessed_at: z.ZodNumber;
92
+ asserted_at: z.ZodNumber;
93
+ valid_from: z.ZodNumber;
94
+ invalidated_at: z.ZodOptional<z.ZodNumber>;
95
+ fact_key: z.ZodOptional<z.ZodString>;
96
+ supersedes: z.ZodOptional<z.ZodString>;
97
+ superseded_by: z.ZodOptional<z.ZodString>;
98
+ relations: z.ZodOptional<z.ZodArray<z.ZodObject<{
99
+ type: z.ZodString;
100
+ targetId: z.ZodString;
101
+ source: z.ZodOptional<z.ZodString>;
102
+ }>>>;
103
+ source_session: z.ZodOptional<z.ZodString>;
104
+ state: typeof memoryState;
105
+ source: typeof memorySource;
106
+ memory_layer: typeof memoryLayer;
107
+ injected_count: z.ZodNumber;
108
+ last_injected_at: z.ZodOptional<z.ZodNumber>;
109
+ last_confirmed_use_at: z.ZodOptional<z.ZodNumber>;
110
+ bad_recall_count: z.ZodNumber;
111
+ suppressed_until_turn: z.ZodNumber;
112
+ canonical_id: z.ZodOptional<z.ZodString>;
113
+ memory_temporal_type: z.ZodOptional<z.ZodEnum<{
114
+ static: "static";
115
+ dynamic: "dynamic";
116
+ }>>;
117
+ temporal_resolution_status: z.ZodOptional<z.ZodEnum<{
118
+ resolved: "resolved";
119
+ unresolved: "unresolved";
120
+ static: "static";
121
+ }>>;
122
+ temporal_phrase: z.ZodOptional<z.ZodString>;
123
+ valid_until: z.ZodOptional<z.ZodNumber>;
124
+ merge_lineage: z.ZodOptional<z.ZodArray<z.ZodString>>;
125
+ };
126
+ declare const memoryMetadataBase: z.ZodObject<MemoryMetadataCommonShape & {
127
+ kind: typeof memoryCategory;
128
+ memory_category: typeof memoryCategory;
129
+ }>;
130
+ declare const episodicMetadata: z.ZodObject<Omit<MemoryMetadataCommonShape, "valid_from"> & {
131
+ valid_from: z.ZodOptional<z.ZodNumber>;
132
+ kind: z.ZodLiteral<"episodic">;
133
+ memory_category: z.ZodLiteral<"episodic">;
134
+ event_at: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
135
+ entity_kind: z.ZodOptional<z.ZodString>;
136
+ }, z.core.$catchall<z.ZodUnknown>>;
137
+ declare const profileMetadata: z.ZodObject<MemoryMetadataCommonShape & {
138
+ kind: z.ZodLiteral<"profile">;
139
+ memory_category: z.ZodLiteral<"profile">;
140
+ section_name: z.ZodString;
141
+ rawTopicPhrase: z.ZodOptional<z.ZodString>;
142
+ active_task_kind: z.ZodOptional<z.ZodEnum<{
143
+ task: "task";
144
+ projection: "projection";
145
+ }>>;
146
+ active_task_id: z.ZodOptional<z.ZodString>;
147
+ active_task_origin: z.ZodOptional<typeof activeTaskOrigin>;
148
+ active_task_status: z.ZodOptional<typeof activeTaskStatus>;
149
+ active_task_created_at: z.ZodOptional<z.ZodNumber>;
150
+ active_task_transitioned_at: z.ZodOptional<z.ZodNumber>;
151
+ active_task_lifecycle: z.ZodOptional<z.ZodArray<typeof activeTaskLifecycleEvent>>;
152
+ active_task_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
153
+ active_task_titles: z.ZodOptional<z.ZodArray<z.ZodString>>;
154
+ }, z.core.$catchall<z.ZodUnknown>>;
155
+ declare const personaMetadata: z.ZodObject<MemoryMetadataCommonShape & {
156
+ kind: z.ZodLiteral<"persona">;
157
+ memory_category: z.ZodLiteral<"persona">;
158
+ section_name: z.ZodString;
159
+ }, z.core.$catchall<z.ZodUnknown>>;
160
+ declare const lessonMetadata: z.ZodObject<MemoryMetadataCommonShape & {
161
+ kind: z.ZodLiteral<"lesson">;
162
+ memory_category: z.ZodLiteral<"lesson">;
163
+ anti_pattern_signature: z.ZodString;
164
+ }, z.core.$catchall<z.ZodUnknown>>;
165
+ declare const summaryMetadata: z.ZodObject<MemoryMetadataCommonShape & {
166
+ kind: z.ZodLiteral<"summary">;
167
+ memory_category: z.ZodLiteral<"summary">;
168
+ children_ids: z.ZodArray<z.ZodString>;
169
+ depth: z.ZodNumber;
170
+ }, z.core.$catchall<z.ZodUnknown>>;
171
+ declare const stateMetadata: z.ZodObject<MemoryMetadataCommonShape & {
172
+ kind: z.ZodLiteral<"state">;
173
+ memory_category: z.ZodLiteral<"state">;
174
+ }, z.core.$catchall<z.ZodUnknown>>;
175
+ declare const memoryMetadata: z.ZodDiscriminatedUnion<[typeof episodicMetadata, typeof profileMetadata, typeof personaMetadata, typeof lessonMetadata, typeof summaryMetadata, typeof stateMetadata], "kind">;
176
+ type InsightMetadata = z.infer<typeof memoryMetadata>;
177
+ type InsightMetadataPatch = Partial<z.input<typeof memoryMetadataBase>> & Record<string, unknown>;
178
+ /**
179
+ * Flat inferred type of the shared insight-metadata base (all category-agnostic
180
+ * fields). This is the single source the loose `MemoryMetadata` structural view
181
+ * in `@/shared/types` derives its insight fields from — so a new field on the
182
+ * Zod schema (or a changed enum) propagates without hand-copying. The 5 category
183
+ * variants add a few discriminant-gated extras (event_at, entity_kind,
184
+ * section_name, anti_pattern_signature, children_ids, depth) that a
185
+ * discriminated union cannot be flattened into automatically; `MemoryMetadata`
186
+ * mirrors those six by hand. A compile-time assignability guard is not viable
187
+ * because the variants use `.catchall(z.unknown())`, whose index signature
188
+ * makes every storage-only field on `MemoryMetadata` resolve to `unknown`; the
189
+ * base-field bulk is instead kept in sync structurally via the `Partial<…>` it
190
+ * feeds, and the six extras are the only hand-maintained mirror.
191
+ */
192
+ type MemoryMetadataBaseFields = z.infer<typeof memoryMetadataBase>;
193
+ //#endregion
194
+ //#region src/engine/shared/types.d.ts
195
+ declare const MEMORY_CATEGORIES: readonly ["episodic", "profile", "persona", "lesson", "summary", "state"];
196
+ type MemoryCategory = (typeof MEMORY_CATEGORIES)[number];
197
+ type MemoryLane = "active" | "parked" | "quarantined";
198
+ declare const CANDIDATE_EXTRACTION_TRACE_VERSION = "insight-distill-2026-06-27";
199
+ interface MemoryEntry {
200
+ id: string;
201
+ factId?: string;
202
+ text: string;
203
+ category: MemoryCategory;
204
+ projectId: string;
205
+ importance: number;
206
+ timestamp: number;
207
+ timezone: string;
208
+ metadata: string;
209
+ contentHash: string;
210
+ lane: MemoryLane;
211
+ rawCandidateJson?: string;
212
+ dispositionReason?: string;
213
+ dispositionedAt?: number;
214
+ }
215
+ interface MemorySearchResult {
216
+ entry: MemoryEntry;
217
+ score: number;
218
+ /** Stable counted-event identity shared by current and history facets. */
219
+ eventIdentity?: string;
220
+ /** Rows in the filtered readable scope before the aggregation output ceiling. */
221
+ scopeRowCount?: number;
222
+ /** True when the requested aggregation population is not fully represented. */
223
+ aggregationIncomplete?: boolean;
224
+ distance?: number;
225
+ rank?: number;
226
+ /**
227
+ * Per-branch winning chunk id (the chunk that produced the highest score
228
+ * within the branch that emitted this result), populated by chunk-aware
229
+ * search wrappers (`searchSemantic` / `searchKeyword`). Required by the
230
+ * chunk-level reranker (PRD §6.0.1) to fetch `bestChunkVector` and by
231
+ * snippet expansion (PRD §6.M2) to anchor the neighbor window.
232
+ */
233
+ chunkId?: string;
234
+ /** Chunk index of the winning chunk within its parent memory. */
235
+ chunkIndex?: number;
236
+ /**
237
+ * Chunk-level score of the winning chunk before any fusion or rerank
238
+ * blending. Survives RRF fusion so the snippet anchor rule (PRD §4) can
239
+ * pick a deterministic winner when both branches surface the same parent
240
+ * with different best chunks.
241
+ */
242
+ bestChunkScore?: number;
243
+ /**
244
+ * Winning-chunk + neighbor snippet assembled by snippet expansion
245
+ * (PRD §M2). Empty string is treated as no-snippet; consumers must fall
246
+ * back to `entry.text` when undefined or empty.
247
+ */
248
+ snippet?: string;
249
+ }
250
+ declare const AGGREGATION_OPERATIONS: readonly ["count", "first", "last", "evidence"];
251
+ type AggregationOperation = (typeof AGGREGATION_OPERATIONS)[number];
252
+ interface AggregationQuery {
253
+ operation: AggregationOperation;
254
+ terms: string[];
255
+ }
256
+ /** Memory tier levels for lifecycle management. */
257
+ type MemoryTier = "core" | "working" | "peripheral";
258
+ declare const DEFAULT_MEMORY_TIER: MemoryTier;
259
+ /**
260
+ * Structural type for the JSON stored in `MemoryEntry.metadata`.
261
+ * All fields optional — legacy rows may lack any of them. Tier 1 suppression
262
+ * fields (last_bad_recall_at, bad_recall_count, suppressed_until_ms) lazy-heal
263
+ * on first write. `intrinsic` carries Retention Scorer inputs. Mixed
264
+ * camelCase + snake_case is intentional — matches the dual-style metadata
265
+ * persisted historically (e.g. accessCount + access_count).
266
+ */
267
+ interface MemoryMetadata extends Partial<MemoryMetadataBaseFields> {
268
+ accessCount?: number;
269
+ lastAccessedAt?: number;
270
+ last_bad_recall_at?: number;
271
+ suppressed_until_ms?: number;
272
+ contexts?: string[];
273
+ intrinsic?: {
274
+ confidence?: number;
275
+ importance?: number;
276
+ };
277
+ rem_update_source_version?: string;
278
+ rem_update_rewrite_config?: {
279
+ implementationVersion: string;
280
+ memoryKind: "profile" | "episodic";
281
+ locale: string;
282
+ localeResource: Readonly<Record<string, string>>;
283
+ };
284
+ rem_update_idempotency_key?: string;
285
+ event_at?: string | number;
286
+ entity_kind?: string;
287
+ section_name?: string;
288
+ rawTopicPhrase?: string;
289
+ anti_pattern_signature?: string;
290
+ children_ids?: string[];
291
+ depth?: number;
292
+ }
293
+ /** Decay score for a single memory (from decay-engine). */
294
+ interface DecayScore {
295
+ memoryId: string;
296
+ recency: number;
297
+ frequency: number;
298
+ intrinsic: number;
299
+ composite: number;
300
+ }
301
+ /** Minimal memory fields needed for decay calculation. */
302
+ interface DecayableMemory {
303
+ id: string;
304
+ importance: number;
305
+ confidence: number;
306
+ tier: MemoryTier;
307
+ accessCount: number;
308
+ createdAt: number;
309
+ lastAccessedAt: number;
310
+ metadata?: string;
311
+ temporalType?: "static" | "dynamic";
312
+ }
313
+ /** Subject-predicate-object triple emitted by extraction. */
314
+ interface CandidateRelation {
315
+ /** Predicate / edge label. */
316
+ type: string;
317
+ /**
318
+ * Object — canonical-name slug or memory id. Client stores whatever
319
+ * the LLM produces; cloud-side resolves slugs to memory ids.
320
+ */
321
+ target: string;
322
+ /**
323
+ * Optional explicit subject. Defaults to the parent candidate's
324
+ * `fact_key` (typically the entity's canonical-name slug). Set when
325
+ * the relation describes two third parties (e.g. on an `episodic`
326
+ * candidate).
327
+ */
328
+ source?: string;
329
+ }
330
+ interface CandidateExtractionTrace {
331
+ source: "llm-conversation-chunk" | "explicit-command-chunk";
332
+ chunkIndex: number;
333
+ chunkCount: number;
334
+ startOffset: number;
335
+ endOffset: number;
336
+ tokenCount: number;
337
+ contentType: ContentType;
338
+ chunkingVersion: string;
339
+ candidateIndex: number;
340
+ extractorVersion?: string;
341
+ }
342
+ /** A candidate memory extracted from conversation by LLM. */
343
+ interface CandidateMemory {
344
+ category: MemoryCategory;
345
+ /** L0: one-sentence index */
346
+ abstract: string;
347
+ /** L1: structured markdown summary */
348
+ overview: string;
349
+ /** L2: full narrative */
350
+ content: string;
351
+ /** Canonical profile/persona section name. Required for profile/persona candidates. */
352
+ sectionName?: string;
353
+ /** Original B-profile topic phrase retained for deterministic registry re-keying. */
354
+ rawTopicPhrase?: string;
355
+ /**
356
+ * Index of the user turn this candidate came from, recorded by the caller's own loop.
357
+ * It is never asked of the model: the deployed B-profile adapter answered "1" to 60 of 60
358
+ * position probes, so a model-reported position was never a truthful value.
359
+ */
360
+ sourceTurnIndex?: number;
361
+ /** Retrieval visibility selected by the B-profile no-drop classifier. */
362
+ lane?: MemoryLane;
363
+ /** Exact producer candidate retained for parked and quarantined audit rows. */
364
+ rawCandidateJson?: string;
365
+ /** Source messages cited by the producer, used by the universal subject gate. */
366
+ gateEvidenceText?: string;
367
+ /** Closed disposition code explaining a non-active row. */
368
+ dispositionReason?: string;
369
+ /** Structured lesson dedupe signature. Required for lesson candidates. */
370
+ antiPatternSignature?: string;
371
+ /** Summary child ids. Summary is system-derived, not ambient-extracted. */
372
+ childrenIds?: string[];
373
+ /** Summary hierarchy depth. Summary is system-derived, not ambient-extracted. */
374
+ summaryDepth?: number;
375
+ /**
376
+ * Absolute event timestamp, ISO-8601. Set on episodic candidates only
377
+ * when the LLM resolves an absolute date from the conversation.
378
+ */
379
+ eventAt?: string;
380
+ /** Original temporal phrase when the interval was mentioned in relative language. */
381
+ temporalPhrase?: string;
382
+ /**
383
+ * Typed entity nature. Open vocabulary — suggested values: person,
384
+ * pet, project, place, business, artwork, organization.
385
+ */
386
+ entityKind?: string;
387
+ /**
388
+ * Triples connecting this candidate to other entities. Implicit
389
+ * subject = the candidate's canonical name (its `fact_key`). Episodic
390
+ * candidates only; set `source` only when the relation does not anchor
391
+ * to this candidate.
392
+ */
393
+ relations?: CandidateRelation[];
394
+ extractionTrace?: CandidateExtractionTrace;
395
+ }
396
+ /** Dedup decision from LLM. */
397
+ type DedupDecision = "create" | "skip";
398
+ interface DedupResult {
399
+ decision: DedupDecision;
400
+ reason: string;
401
+ }
402
+ interface ExtractionStats {
403
+ created: number;
404
+ merged: number;
405
+ skipped: number;
406
+ /** Admission control rejections. */
407
+ rejected?: number;
408
+ /**
409
+ * Write attempts preserved outside the memory table because no gate could
410
+ * place them. Neither created nor skipped: nothing reached memory, and nothing
411
+ * was passed over.
412
+ */
413
+ unplaced?: number;
414
+ boundarySkipped?: number;
415
+ /** LLM extraction calls that failed before yielding candidates. */
416
+ llmFailures?: number;
417
+ /** Candidate processing failures after extraction yielded memories. */
418
+ processingFailures?: number;
419
+ /** Memory kinds whose failed model work still needs deterministic capture. */
420
+ deterministicFallbackCategories?: MemoryCategory[];
421
+ /** Timestamp ladder fallbacks, split by mutation site and selected source. */
422
+ taskTimestampFallbacks?: {
423
+ mutationSessionDateTime: number;
424
+ mutationValidAtNow: number;
425
+ completionSessionDateTime: number;
426
+ completionValidAtNow: number;
427
+ };
428
+ }
429
+ /** Validate and normalize a category string to a foundation kind. */
430
+ declare function normalizeCategory(raw: string): MemoryCategory | undefined;
431
+ interface RetrievalResult {
432
+ entry: MemoryEntry;
433
+ score: number;
434
+ /** Stable counted-event identity shared by current and history facets. */
435
+ eventIdentity?: string;
436
+ /** Rows in the filtered readable scope before the aggregation output ceiling. */
437
+ scopeRowCount?: number;
438
+ /** True when an aggregation had to return a ranked page instead of a known population. */
439
+ aggregationIncomplete?: boolean;
440
+ sources: {
441
+ vector?: {
442
+ score: number;
443
+ rank: number;
444
+ };
445
+ bm25?: {
446
+ score: number;
447
+ rank: number;
448
+ };
449
+ fused?: {
450
+ score: number;
451
+ };
452
+ reranked?: {
453
+ score: number;
454
+ };
455
+ };
456
+ /** Per-branch winning chunk metadata, propagated from `MemorySearchResult`. */
457
+ chunkId?: string;
458
+ chunkIndex?: number;
459
+ /** Survives RRF fusion via the anchor rule (PRD §4): higher branch wins, semantic tie-break. */
460
+ bestChunkScore?: number;
461
+ /** Winning-chunk + neighbor snippet from M2 snippet expansion. */
462
+ snippet?: string;
463
+ /**
464
+ * The (project, subject, attribute) group a recall row was expanded from. Set only on
465
+ * group-expanded manual-recall rows, so the token packer can keep a group's newest member with
466
+ * it rather than serving an older sibling alone.
467
+ */
468
+ recallGroupKey?: string;
469
+ /** Per-stage scores (PRD §5.2). Each pipeline stage populates the field it owns. */
470
+ denseScore?: number;
471
+ bm25Score?: number;
472
+ fusedScore?: number;
473
+ rerankScore?: number;
474
+ mmrScore?: number;
475
+ }
476
+ //#endregion
477
+ export { EntryLike as C, MemoryRelation as D, MemoryLayer as E, MemorySource as O, normalizeCategory as S, InsightMetadataPatch as T, MemoryLane as _, CandidateExtractionTrace as a, MemoryTier as b, DEFAULT_MEMORY_TIER as c, DedupDecision as d, DedupResult as f, MemoryEntry as g, MemoryCategory as h, CANDIDATE_EXTRACTION_TRACE_VERSION as i, MemoryState as k, DecayScore as l, MEMORY_CATEGORIES as m, AggregationOperation as n, CandidateMemory as o, ExtractionStats as p, AggregationQuery as r, CandidateRelation as s, AGGREGATION_OPERATIONS as t, DecayableMemory as u, MemoryMetadata as v, InsightMetadata as w, RetrievalResult as x, MemorySearchResult as y };
@@ -0,0 +1,132 @@
1
+ //#region src/engine/rem/types.d.ts
2
+ declare const REM_OPERATION_TYPES: readonly ["rem-update", "rem-replace", "rem-distill", "rem-retire"];
3
+ declare const REM_BUILT_OPERATION_TYPES: readonly ["rem-update", "rem-replace"];
4
+ type RemOperationType = (typeof REM_OPERATION_TYPES)[number];
5
+ type RemBuiltOperationType = (typeof REM_BUILT_OPERATION_TYPES)[number];
6
+ declare function parseRemOperationType(value: string): RemOperationType | undefined;
7
+ declare const REM_JOB_STATES: readonly ["queued", "running", "done", "failed"];
8
+ type RemJobState = (typeof REM_JOB_STATES)[number];
9
+ declare const REM_ROW_STATES: readonly ["transition", "stale-current", "pure-negation", "ambiguous"];
10
+ type RemRowState = (typeof REM_ROW_STATES)[number];
11
+ type RemOwner = "restate" | "verdict" | "none";
12
+ interface RemStatementLike {
13
+ get(...params: unknown[]): unknown;
14
+ all(...params: unknown[]): unknown[];
15
+ run(...params: unknown[]): unknown;
16
+ }
17
+ interface RemTransactionLike {
18
+ (...args: unknown[]): unknown;
19
+ immediate(...args: unknown[]): unknown;
20
+ }
21
+ interface RemDatabaseLike {
22
+ prepare(sql: string): RemStatementLike;
23
+ exec(sql: string): unknown;
24
+ transaction(fn: (...args: never[]) => unknown): RemTransactionLike;
25
+ }
26
+ interface RemClockPort {
27
+ now(): string;
28
+ }
29
+ interface MoveLaneInput {
30
+ rowId: string;
31
+ plannedContentHash: string;
32
+ targetLane: "active" | "parked" | "quarantined";
33
+ reason: string;
34
+ timestamp: string;
35
+ }
36
+ interface WriteTextVersionInput {
37
+ rowId: string;
38
+ plannedContentHash: string;
39
+ /**
40
+ * The invoking job, required so the journal row this write produces can name it. Callers never
41
+ * supply these two: `RemWriterOperation` omits them exactly as it omits `rowId`, and the mutation
42
+ * executor fills all four from the attempt it was opened with. That is the point — an identity a
43
+ * caller cannot pass is an identity a caller cannot pass wrongly, and one the executor must pass
44
+ * is one nobody can forget.
45
+ */
46
+ jobId: string;
47
+ jobType: RemOperationType;
48
+ /**
49
+ * The verified-write attempt this write belongs to. Filled by the mutation executor from the
50
+ * attempt it opened, never by a caller, for the same reason `jobId` and `jobType` are: the
51
+ * write transaction stamps the content hash it produced onto this attempt so crash recovery can
52
+ * tell a committed write from a lost one.
53
+ */
54
+ attemptId: string;
55
+ replacementText: string;
56
+ historyText?: string;
57
+ supersededItems?: readonly string[];
58
+ sourceVersion?: string;
59
+ rewriteConfig?: RemUpdateRewriteConfig;
60
+ idempotencyKey?: string;
61
+ reason: string;
62
+ timestamp: string;
63
+ }
64
+ interface RemUpdateRewriteConfig {
65
+ implementationVersion: string;
66
+ memoryKind: "profile" | "episodic" | "state";
67
+ locale: string;
68
+ localeResource: Readonly<{
69
+ valuePrefix: string;
70
+ listPrefix: string;
71
+ listSeparator: string;
72
+ spanSeparator: string;
73
+ anchorMode: "capitalized-sequence" | "explicit-script";
74
+ }>;
75
+ }
76
+ interface SoftCloseInput {
77
+ rowId: string;
78
+ successorId: string;
79
+ plannedContentHash: string;
80
+ plannedSuccessorContentHash: string;
81
+ reason: string;
82
+ timestamp: string;
83
+ }
84
+ type RemMutationRefusalReason = "content_changed" | "already_applied" | "missing" | "target_changed" | "target_missing";
85
+ type RemMutationResult = {
86
+ applied: true;
87
+ contentHash: string;
88
+ recoveryHandle: string;
89
+ } | {
90
+ applied: false;
91
+ reason: RemMutationRefusalReason;
92
+ };
93
+ interface RemConflictPort {
94
+ softClose(input: SoftCloseInput): Promise<RemMutationResult>;
95
+ writeTextVersion(input: WriteTextVersionInput): Promise<RemMutationResult>;
96
+ }
97
+ interface RemForgetPort {
98
+ moveLane(input: MoveLaneInput): Promise<RemMutationResult>;
99
+ }
100
+ interface RemPorts {
101
+ clock: RemClockPort;
102
+ conflict: RemConflictPort;
103
+ forget: RemForgetPort;
104
+ }
105
+ interface RemEnableGateArtifact {
106
+ schema_version: number;
107
+ job_type: RemBuiltOperationType;
108
+ implementation_version: string;
109
+ corpus_sha256: string;
110
+ baseline_sha256: string;
111
+ result: "pass" | "fail";
112
+ evaluated_at: string;
113
+ expires_at: string;
114
+ }
115
+ type RemVerdictCheckpoint = "before_llm" | "cancellation_requested" | "verdict_recorded" | "action_applied";
116
+ interface RemConfig {
117
+ stages: Readonly<Record<string, boolean>>;
118
+ }
119
+ /**
120
+ * Refuses a write whose audit identity is not real. A required `string` is not proof of one:
121
+ * TypeScript accepts `""`, the journal's `job_id`/`job_type` columns are `NOT NULL` but not
122
+ * non-blank, and a JavaScript caller can omit the field entirely.
123
+ *
124
+ * No valid identity, no write — the whole operation is refused before any transaction opens. This
125
+ * does not rescue the write; it refuses it, which is the intended trade: an unattributable row in
126
+ * the audit ledger is worse than a refused operation the caller can see and retry.
127
+ *
128
+ * The accepted set is `REM_OPERATION_TYPES` itself, so the runtime check and the type cannot drift.
129
+ */
130
+ declare function assertJobIdentity(jobId: string, jobType: string): void;
131
+ //#endregion
132
+ export { RemVerdictCheckpoint as C, parseRemOperationType as D, assertJobIdentity as E, RemUpdateRewriteConfig as S, WriteTextVersionInput as T, RemOwner as _, REM_ROW_STATES as a, RemStatementLike as b, RemConfig as c, RemEnableGateArtifact as d, RemForgetPort as f, RemOperationType as g, RemMutationResult as h, REM_OPERATION_TYPES as i, RemConflictPort as l, RemMutationRefusalReason as m, REM_BUILT_OPERATION_TYPES as n, RemBuiltOperationType as o, RemJobState as p, REM_JOB_STATES as r, RemClockPort as s, MoveLaneInput as t, RemDatabaseLike as u, RemPorts as v, SoftCloseInput as w, RemTransactionLike as x, RemRowState as y };