nox-mem 3.1.0 → 3.2.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 (398) hide show
  1. package/README.md +24 -16
  2. package/dist/__tests__/brief-diversity.test.js +266 -0
  3. package/dist/__tests__/brief.test.js +287 -0
  4. package/dist/__tests__/churn.test.js +66 -0
  5. package/dist/__tests__/edge-typing.test.js +99 -0
  6. package/dist/__tests__/ingest-event.test.js +151 -0
  7. package/dist/__tests__/op-audit-e2e.test.js +130 -0
  8. package/dist/__tests__/pragma-alignment.test.js +123 -0
  9. package/dist/__tests__/reranker.test.js +326 -0
  10. package/dist/__tests__/retention.test.js +99 -0
  11. package/dist/__tests__/search-track-access.test.js +49 -0
  12. package/dist/__tests__/spo-injection.test.js +172 -0
  13. package/dist/__tests__/temporal-detector.test.js +103 -0
  14. package/dist/api/wire-up.js +12 -381
  15. package/dist/api-server.js +6 -102
  16. package/dist/db.js +61 -2
  17. package/dist/embed.js +23 -2
  18. package/dist/index.js +3 -23
  19. package/dist/knowledge-graph.js +20 -0
  20. package/dist/lib/answer/__tests__/e2e-gemini.test.js +229 -0
  21. package/dist/lib/answer/__tests__/integration-sqlite.test.js +388 -0
  22. package/dist/lib/answer/__tests__/integration.test.js +347 -0
  23. package/dist/lib/answer/__tests__/prompt.test.js +117 -0
  24. package/dist/lib/answer/__tests__/t5-t10.test.js +501 -0
  25. package/dist/lib/answer/provider.js +29 -4
  26. package/dist/lib/api/__tests__/safe-error-message.test.js +155 -0
  27. package/dist/lib/auth/__tests__/localhost-guard.test.js +144 -0
  28. package/dist/lib/error-sanitizer/__tests__/sanitize.test.js +354 -0
  29. package/dist/lib/events/__tests__/bus.test.js +208 -0
  30. package/dist/lib/ingest-router.js +0 -43
  31. package/dist/lib/op-audit-extension/__tests__/ran-at-guard.test.js +109 -0
  32. package/dist/lib/regex-extract/__tests__/extractor.test.js +197 -0
  33. package/dist/lib/regex-extract/__tests__/frontmatter.test.js +75 -0
  34. package/dist/lib/regex-extract/__tests__/ingest-router-l4.test.js +139 -0
  35. package/dist/lib/regex-extract/__tests__/production-wire.test.js +177 -0
  36. package/dist/lib/regex-extract/__tests__/reconcile.test.js +170 -0
  37. package/dist/lib/regex-extract/__tests__/strip-code.test.js +36 -0
  38. package/dist/mcp-server.js +2 -1
  39. package/dist/privacy/__tests__/filter.test.js +352 -0
  40. package/dist/providers/__tests__/conformance-extended.test.js +249 -0
  41. package/dist/providers/__tests__/conformance.test.js +98 -0
  42. package/dist/providers/__tests__/cost-cap.test.js +151 -0
  43. package/dist/providers/__tests__/e2e-real.test.js +79 -0
  44. package/dist/providers/__tests__/factory.test.js +80 -0
  45. package/dist/providers/__tests__/fallback.test.js +223 -0
  46. package/dist/providers/__tests__/gemini.test.js +191 -0
  47. package/dist/providers/__tests__/health.test.js +128 -0
  48. package/dist/providers/__tests__/telemetry.test.js +219 -0
  49. package/dist/reindex.js +2 -2
  50. package/dist/version.js +22 -0
  51. package/package.json +3 -4
  52. package/dist/api/answer.d.ts +0 -116
  53. package/dist/api/answer.validate-patch.d.ts +0 -72
  54. package/dist/api/brief-diversity.d.ts +0 -64
  55. package/dist/api/brief.d.ts +0 -114
  56. package/dist/api/conflict.d.ts +0 -33
  57. package/dist/api/conflict.js +0 -143
  58. package/dist/api/cors.d.ts +0 -73
  59. package/dist/api/events-stream-limited.d.ts +0 -133
  60. package/dist/api/events-stream-limited.js +0 -217
  61. package/dist/api/events-stream.d.ts +0 -53
  62. package/dist/api/events-stream.js +0 -125
  63. package/dist/api/export.d.ts +0 -42
  64. package/dist/api/export.js +0 -85
  65. package/dist/api/health-confidence-adapter.d.ts +0 -29
  66. package/dist/api/health-confidence-adapter.js +0 -73
  67. package/dist/api/health-confidence.d.ts +0 -36
  68. package/dist/api/health-confidence.js +0 -141
  69. package/dist/api/hooks.d.ts +0 -50
  70. package/dist/api/hooks.js +0 -115
  71. package/dist/api/import.d.ts +0 -38
  72. package/dist/api/import.js +0 -87
  73. package/dist/api/ingest-event.d.ts +0 -65
  74. package/dist/api/mark.d.ts +0 -42
  75. package/dist/api/mark.js +0 -127
  76. package/dist/api/server-deps-a2.d.ts +0 -55
  77. package/dist/api/server-deps-a2.js +0 -138
  78. package/dist/api/server-deps-l2-l3.d.ts +0 -68
  79. package/dist/api/server-deps-l2-l3.js +0 -123
  80. package/dist/api/server-deps-p1.d.ts +0 -84
  81. package/dist/api/server-deps-p2.d.ts +0 -32
  82. package/dist/api/server-deps-p2.js +0 -84
  83. package/dist/api/server-deps-p5.d.ts +0 -66
  84. package/dist/api/server-deps-p5.js +0 -139
  85. package/dist/api/viewer-static.d.ts +0 -30
  86. package/dist/api/viewer-static.js +0 -102
  87. package/dist/api/wire-up.d.ts +0 -54
  88. package/dist/api-impact.d.ts +0 -30
  89. package/dist/api-server.d.ts +0 -2
  90. package/dist/backfill-fts-anchor.d.ts +0 -15
  91. package/dist/backfill-source-type.d.ts +0 -20
  92. package/dist/churn.d.ts +0 -31
  93. package/dist/cli/answer.d.ts +0 -66
  94. package/dist/cli/conflict.d.ts +0 -38
  95. package/dist/cli/conflict.js +0 -282
  96. package/dist/cli/export.d.ts +0 -51
  97. package/dist/cli/export.js +0 -280
  98. package/dist/cli/hooks.d.ts +0 -54
  99. package/dist/cli/hooks.js +0 -133
  100. package/dist/cli/import.d.ts +0 -52
  101. package/dist/cli/import.js +0 -274
  102. package/dist/cli/mark.d.ts +0 -33
  103. package/dist/cli/mark.js +0 -130
  104. package/dist/cli/ocr-batch.d.ts +0 -12
  105. package/dist/cli/ocr-batch.js +0 -411
  106. package/dist/cli/snapshot-main.d.ts +0 -30
  107. package/dist/cli/snapshot-main.js +0 -47
  108. package/dist/cli/viewer.d.ts +0 -35
  109. package/dist/cli/viewer.js +0 -71
  110. package/dist/cli-telemetry.d.ts +0 -36
  111. package/dist/cli-telemetry.js +0 -150
  112. package/dist/compact.d.ts +0 -7
  113. package/dist/consolidate.d.ts +0 -18
  114. package/dist/consolidation.d.ts +0 -32
  115. package/dist/cross-agent-v2.d.ts +0 -45
  116. package/dist/cross-search.d.ts +0 -11
  117. package/dist/crystallize.d.ts +0 -43
  118. package/dist/db.d.ts +0 -11
  119. package/dist/dedup.d.ts +0 -1
  120. package/dist/detect-changes.d.ts +0 -29
  121. package/dist/digest.d.ts +0 -1
  122. package/dist/doctor.d.ts +0 -1
  123. package/dist/embed.d.ts +0 -57
  124. package/dist/evals.d.ts +0 -176
  125. package/dist/evals.js +0 -351
  126. package/dist/generate-user-profile.d.ts +0 -18
  127. package/dist/graphify-ingest.d.ts +0 -18
  128. package/dist/impact.d.ts +0 -39
  129. package/dist/index.d.ts +0 -2
  130. package/dist/ingest-entity.d.ts +0 -44
  131. package/dist/ingest.d.ts +0 -13
  132. package/dist/kg-llm.d.ts +0 -39
  133. package/dist/knowledge-graph.d.ts +0 -72
  134. package/dist/lib/answer/config.d.ts +0 -41
  135. package/dist/lib/answer/index.d.ts +0 -47
  136. package/dist/lib/answer/prompt.d.ts +0 -37
  137. package/dist/lib/answer/provider.d.ts +0 -47
  138. package/dist/lib/answer/retrieval.d.ts +0 -36
  139. package/dist/lib/answer/telemetry.d.ts +0 -99
  140. package/dist/lib/answer/types.d.ts +0 -108
  141. package/dist/lib/api/error-leak-fix.d.ts +0 -54
  142. package/dist/lib/api/safe-error-message.d.ts +0 -70
  143. package/dist/lib/archive/common-passwords.d.ts +0 -37
  144. package/dist/lib/archive/common-passwords.js +0 -753
  145. package/dist/lib/archive/encryption.d.ts +0 -81
  146. package/dist/lib/archive/encryption.js +0 -236
  147. package/dist/lib/archive/enforce-strength.d.ts +0 -54
  148. package/dist/lib/archive/enforce-strength.js +0 -70
  149. package/dist/lib/archive/entropy.d.ts +0 -34
  150. package/dist/lib/archive/entropy.js +0 -180
  151. package/dist/lib/archive/export-locking.d.ts +0 -102
  152. package/dist/lib/archive/export-locking.js +0 -202
  153. package/dist/lib/archive/format.d.ts +0 -20
  154. package/dist/lib/archive/format.js +0 -174
  155. package/dist/lib/archive/index.d.ts +0 -23
  156. package/dist/lib/archive/index.js +0 -17
  157. package/dist/lib/archive/manifest.d.ts +0 -53
  158. package/dist/lib/archive/manifest.js +0 -183
  159. package/dist/lib/archive/migration.d.ts +0 -36
  160. package/dist/lib/archive/migration.js +0 -100
  161. package/dist/lib/archive/migrations/v18_to_v19.d.ts +0 -16
  162. package/dist/lib/archive/migrations/v18_to_v19.js +0 -18
  163. package/dist/lib/archive/orchestrator.d.ts +0 -166
  164. package/dist/lib/archive/orchestrator.js +0 -428
  165. package/dist/lib/archive/serializers/chunks.d.ts +0 -30
  166. package/dist/lib/archive/serializers/chunks.js +0 -113
  167. package/dist/lib/archive/serializers/embeddings.d.ts +0 -36
  168. package/dist/lib/archive/serializers/embeddings.js +0 -115
  169. package/dist/lib/archive/serializers/kg.d.ts +0 -28
  170. package/dist/lib/archive/serializers/kg.js +0 -184
  171. package/dist/lib/archive/serializers/ops_audit.d.ts +0 -21
  172. package/dist/lib/archive/serializers/ops_audit.js +0 -97
  173. package/dist/lib/archive/server-deps.d.ts +0 -131
  174. package/dist/lib/archive/server-deps.js +0 -232
  175. package/dist/lib/archive/strength.d.ts +0 -50
  176. package/dist/lib/archive/strength.js +0 -77
  177. package/dist/lib/archive/types.d.ts +0 -159
  178. package/dist/lib/archive/types.js +0 -45
  179. package/dist/lib/archive/unpack-streaming.d.ts +0 -70
  180. package/dist/lib/archive/unpack-streaming.js +0 -255
  181. package/dist/lib/auth/localhost-guard.d.ts +0 -106
  182. package/dist/lib/confidence/config.d.ts +0 -37
  183. package/dist/lib/confidence/config.js +0 -107
  184. package/dist/lib/confidence/db-shim-singleton.d.ts +0 -20
  185. package/dist/lib/confidence/db-shim-singleton.js +0 -41
  186. package/dist/lib/confidence/db-shim.d.ts +0 -47
  187. package/dist/lib/confidence/db-shim.js +0 -141
  188. package/dist/lib/confidence/mark.d.ts +0 -58
  189. package/dist/lib/confidence/mark.js +0 -168
  190. package/dist/lib/confidence/ranking.d.ts +0 -69
  191. package/dist/lib/confidence/ranking.js +0 -101
  192. package/dist/lib/confidence/search-filter.d.ts +0 -44
  193. package/dist/lib/confidence/search-filter.js +0 -103
  194. package/dist/lib/confidence/types.d.ts +0 -146
  195. package/dist/lib/confidence/types.js +0 -20
  196. package/dist/lib/confidence/write-hooks.d.ts +0 -50
  197. package/dist/lib/confidence/write-hooks.js +0 -159
  198. package/dist/lib/conflict/audit-fk-check.d.ts +0 -72
  199. package/dist/lib/conflict/audit-fk-check.js +0 -131
  200. package/dist/lib/conflict/audit-writer.d.ts +0 -39
  201. package/dist/lib/conflict/audit-writer.js +0 -133
  202. package/dist/lib/conflict/db-singleton.d.ts +0 -28
  203. package/dist/lib/conflict/db-singleton.js +0 -61
  204. package/dist/lib/conflict/db.d.ts +0 -27
  205. package/dist/lib/conflict/db.js +0 -20
  206. package/dist/lib/conflict/detector-direct.d.ts +0 -21
  207. package/dist/lib/conflict/detector-direct.js +0 -105
  208. package/dist/lib/conflict/evidence.d.ts +0 -24
  209. package/dist/lib/conflict/evidence.js +0 -76
  210. package/dist/lib/conflict/index.d.ts +0 -14
  211. package/dist/lib/conflict/index.js +0 -12
  212. package/dist/lib/conflict/scheduler.d.ts +0 -78
  213. package/dist/lib/conflict/scheduler.js +0 -111
  214. package/dist/lib/conflict/shadow.d.ts +0 -75
  215. package/dist/lib/conflict/shadow.js +0 -161
  216. package/dist/lib/conflict/types.d.ts +0 -133
  217. package/dist/lib/conflict/types.js +0 -19
  218. package/dist/lib/cost-cap.d.ts +0 -94
  219. package/dist/lib/deps/deps-registry.d.ts +0 -111
  220. package/dist/lib/error-sanitizer/middleware.d.ts +0 -43
  221. package/dist/lib/error-sanitizer/sanitize.d.ts +0 -78
  222. package/dist/lib/eval-batch.d.ts +0 -34
  223. package/dist/lib/eval-batch.js +0 -103
  224. package/dist/lib/eval-metrics.d.ts +0 -36
  225. package/dist/lib/eval-metrics.js +0 -95
  226. package/dist/lib/eval.d.ts +0 -106
  227. package/dist/lib/eval.js +0 -343
  228. package/dist/lib/events/bus.d.ts +0 -135
  229. package/dist/lib/fts-anchor.d.ts +0 -1
  230. package/dist/lib/hooks/classifier.d.ts +0 -47
  231. package/dist/lib/hooks/classifier.js +0 -129
  232. package/dist/lib/hooks/config.d.ts +0 -49
  233. package/dist/lib/hooks/config.js +0 -106
  234. package/dist/lib/hooks/decorators.d.ts +0 -35
  235. package/dist/lib/hooks/decorators.js +0 -59
  236. package/dist/lib/hooks/pipeline.d.ts +0 -76
  237. package/dist/lib/hooks/pipeline.js +0 -213
  238. package/dist/lib/hooks/privacy-filter-adapter.d.ts +0 -55
  239. package/dist/lib/hooks/privacy-filter-adapter.js +0 -84
  240. package/dist/lib/hooks/rate-limit-constant-time.d.ts +0 -57
  241. package/dist/lib/hooks/rate-limit-constant-time.js +0 -69
  242. package/dist/lib/hooks/rate-limit-dryrun-fix.d.ts +0 -71
  243. package/dist/lib/hooks/rate-limit-dryrun-fix.js +0 -110
  244. package/dist/lib/hooks/rate-limit.d.ts +0 -54
  245. package/dist/lib/hooks/rate-limit.js +0 -122
  246. package/dist/lib/hooks/server-deps.d.ts +0 -61
  247. package/dist/lib/hooks/server-deps.js +0 -92
  248. package/dist/lib/hooks/source-allowlist.d.ts +0 -26
  249. package/dist/lib/hooks/source-allowlist.js +0 -53
  250. package/dist/lib/hooks/types.d.ts +0 -129
  251. package/dist/lib/hooks/types.js +0 -24
  252. package/dist/lib/hooks/worker.d.ts +0 -56
  253. package/dist/lib/hooks/worker.js +0 -150
  254. package/dist/lib/ingest-router.d.ts +0 -25
  255. package/dist/lib/ocr-detector.d.ts +0 -61
  256. package/dist/lib/ocr-detector.js +0 -138
  257. package/dist/lib/ocr-engine-stub.d.ts +0 -48
  258. package/dist/lib/ocr-engine-stub.js +0 -190
  259. package/dist/lib/ocr-engines/google-doc-ai.d.ts +0 -36
  260. package/dist/lib/ocr-engines/google-doc-ai.js +0 -164
  261. package/dist/lib/ocr-jobs.d.ts +0 -67
  262. package/dist/lib/ocr-jobs.js +0 -129
  263. package/dist/lib/op-audit-extension/ran-at-guard.d.ts +0 -86
  264. package/dist/lib/op-audit.d.ts +0 -71
  265. package/dist/lib/privacy-br/detector.d.ts +0 -42
  266. package/dist/lib/privacy-br/detector.js +0 -130
  267. package/dist/lib/privacy-br/index.d.ts +0 -20
  268. package/dist/lib/privacy-br/index.js +0 -20
  269. package/dist/lib/privacy-br/integration.d.ts +0 -71
  270. package/dist/lib/privacy-br/integration.js +0 -74
  271. package/dist/lib/privacy-br/patterns.d.ts +0 -117
  272. package/dist/lib/privacy-br/patterns.js +0 -434
  273. package/dist/lib/privacy-br/redact.d.ts +0 -42
  274. package/dist/lib/privacy-br/redact.js +0 -103
  275. package/dist/lib/privacy-br/types.d.ts +0 -55
  276. package/dist/lib/privacy-br/types.js +0 -25
  277. package/dist/lib/regex-extract/extractor.d.ts +0 -30
  278. package/dist/lib/regex-extract/frontmatter.d.ts +0 -44
  279. package/dist/lib/regex-extract/index.d.ts +0 -14
  280. package/dist/lib/regex-extract/ingest-router-l4.d.ts +0 -76
  281. package/dist/lib/regex-extract/patterns.d.ts +0 -61
  282. package/dist/lib/regex-extract/production-wire.d.ts +0 -128
  283. package/dist/lib/regex-extract/reconcile.d.ts +0 -162
  284. package/dist/lib/regex-extract/strip-code.d.ts +0 -24
  285. package/dist/lib/regex-extract/types.d.ts +0 -48
  286. package/dist/lib/reranker.d.ts +0 -80
  287. package/dist/lib/shadow-tracker.d.ts +0 -191
  288. package/dist/lib/shadow-tracker.js +0 -384
  289. package/dist/lib/spo-injection.d.ts +0 -52
  290. package/dist/lib/telemetry-collector.d.ts +0 -158
  291. package/dist/lib/telemetry-collector.js +0 -249
  292. package/dist/lib/temporal-detector.d.ts +0 -27
  293. package/dist/lib/viewer/auth.d.ts +0 -37
  294. package/dist/lib/viewer/auth.js +0 -70
  295. package/dist/lib/viewer/backpressure.d.ts +0 -59
  296. package/dist/lib/viewer/backpressure.js +0 -100
  297. package/dist/lib/viewer/broadcast-singleton.d.ts +0 -34
  298. package/dist/lib/viewer/broadcast-singleton.js +0 -49
  299. package/dist/lib/viewer/broadcast.d.ts +0 -66
  300. package/dist/lib/viewer/broadcast.js +0 -96
  301. package/dist/lib/viewer/event-types.d.ts +0 -132
  302. package/dist/lib/viewer/event-types.js +0 -74
  303. package/dist/lib/viewer/instrumentation.d.ts +0 -106
  304. package/dist/lib/viewer/instrumentation.js +0 -224
  305. package/dist/lib/viewer/migration.d.ts +0 -23
  306. package/dist/lib/viewer/migration.js +0 -56
  307. package/dist/lib/viewer/redaction.d.ts +0 -44
  308. package/dist/lib/viewer/redaction.js +0 -139
  309. package/dist/lib/viewer/session.d.ts +0 -51
  310. package/dist/lib/viewer/session.js +0 -87
  311. package/dist/mcp/tools/answer.d.ts +0 -94
  312. package/dist/mcp/tools/archive.d.ts +0 -152
  313. package/dist/mcp/tools/archive.js +0 -170
  314. package/dist/mcp/tools/conflict.d.ts +0 -44
  315. package/dist/mcp/tools/conflict.js +0 -130
  316. package/dist/mcp/tools/hooks.d.ts +0 -29
  317. package/dist/mcp/tools/hooks.js +0 -78
  318. package/dist/mcp/tools/mark.d.ts +0 -38
  319. package/dist/mcp/tools/mark.js +0 -82
  320. package/dist/mcp/tools/viewer.d.ts +0 -58
  321. package/dist/mcp/tools/viewer.js +0 -64
  322. package/dist/mcp-server.d.ts +0 -2
  323. package/dist/metrics.d.ts +0 -3
  324. package/dist/noise-filter.d.ts +0 -18
  325. package/dist/notion-sync.d.ts +0 -7
  326. package/dist/notion-sync.js +0 -97
  327. package/dist/observability/adapters/a3-adapter.d.ts +0 -63
  328. package/dist/observability/adapters/a3-adapter.js +0 -83
  329. package/dist/observability/adapters/p1-adapter.d.ts +0 -49
  330. package/dist/observability/adapters/p1-adapter.js +0 -63
  331. package/dist/observability/adapters/p5-adapter.d.ts +0 -36
  332. package/dist/observability/adapters/p5-adapter.js +0 -71
  333. package/dist/observability/cardinality.d.ts +0 -61
  334. package/dist/observability/cardinality.js +0 -300
  335. package/dist/observability/collectors/db-stats.collector.d.ts +0 -9
  336. package/dist/observability/collectors/db-stats.collector.js +0 -88
  337. package/dist/observability/collectors/eventbus.collector.d.ts +0 -6
  338. package/dist/observability/collectors/eventbus.collector.js +0 -50
  339. package/dist/observability/collectors/process.collector.d.ts +0 -7
  340. package/dist/observability/collectors/process.collector.js +0 -93
  341. package/dist/observability/collectors/provider-telemetry.collector.d.ts +0 -11
  342. package/dist/observability/collectors/provider-telemetry.collector.js +0 -112
  343. package/dist/observability/collectors/search-telemetry.collector.d.ts +0 -12
  344. package/dist/observability/collectors/search-telemetry.collector.js +0 -76
  345. package/dist/observability/exporter.d.ts +0 -30
  346. package/dist/observability/exporter.js +0 -182
  347. package/dist/observability/index.d.ts +0 -22
  348. package/dist/observability/index.js +0 -21
  349. package/dist/observability/metrics.d.ts +0 -53
  350. package/dist/observability/metrics.js +0 -213
  351. package/dist/observability/privacy-guard.d.ts +0 -32
  352. package/dist/observability/privacy-guard.js +0 -116
  353. package/dist/observability/record.d.ts +0 -83
  354. package/dist/observability/record.js +0 -217
  355. package/dist/observability/registry.d.ts +0 -60
  356. package/dist/observability/registry.js +0 -93
  357. package/dist/observability/types.d.ts +0 -115
  358. package/dist/observability/types.js +0 -235
  359. package/dist/observability.d.ts +0 -131
  360. package/dist/plugins/nox-hooks/index.d.ts +0 -61
  361. package/dist/plugins/nox-hooks/index.js +0 -99
  362. package/dist/primer.d.ts +0 -1
  363. package/dist/privacy/filter.d.ts +0 -27
  364. package/dist/privacy/patterns.d.ts +0 -29
  365. package/dist/privacy/tag-parser.d.ts +0 -24
  366. package/dist/project-context-gen.d.ts +0 -10
  367. package/dist/providers/embedding/gemini.d.ts +0 -73
  368. package/dist/providers/embedding/openai.d.ts +0 -76
  369. package/dist/providers/embedding/types.d.ts +0 -39
  370. package/dist/providers/embedding/voyage.d.ts +0 -36
  371. package/dist/providers/index.d.ts +0 -116
  372. package/dist/providers/llm/anthropic.d.ts +0 -29
  373. package/dist/providers/llm/chain.d.ts +0 -99
  374. package/dist/providers/llm/gemini.d.ts +0 -48
  375. package/dist/providers/llm/openai.d.ts +0 -64
  376. package/dist/providers/llm/types.d.ts +0 -47
  377. package/dist/providers/telemetry.d.ts +0 -87
  378. package/dist/providers/types.d.ts +0 -42
  379. package/dist/query-entity-count.d.ts +0 -54
  380. package/dist/reflect.d.ts +0 -26
  381. package/dist/reindex-errors.d.ts +0 -7
  382. package/dist/reindex.d.ts +0 -16
  383. package/dist/retention.d.ts +0 -40
  384. package/dist/salience.d.ts +0 -85
  385. package/dist/scripts/migrate-v17-ops-audit.d.ts +0 -17
  386. package/dist/search-dedup.d.ts +0 -44
  387. package/dist/search-expansion.d.ts +0 -20
  388. package/dist/search.d.ts +0 -62
  389. package/dist/seh-detector.d.ts +0 -31
  390. package/dist/self-improve.d.ts +0 -1
  391. package/dist/session-distill.d.ts +0 -29
  392. package/dist/session-update.d.ts +0 -1
  393. package/dist/shared-memory.d.ts +0 -24
  394. package/dist/stats.d.ts +0 -1
  395. package/dist/temporal-retrieval.d.ts +0 -132
  396. package/dist/tier-manager.d.ts +0 -69
  397. package/dist/vectorize.d.ts +0 -16
  398. package/dist/watch.d.ts +0 -8
@@ -1,183 +0,0 @@
1
- /**
2
- * T2 — Manifest schema, canonical writer, parser.
3
- *
4
- * Canonical JSON serialization (sorted keys, no extra whitespace, UTF-8) is
5
- * mandatory because the manifest plaintext is the AAD source for AES-256-GCM.
6
- * Any whitespace or key-order drift between writer and parser would break
7
- * `sha256(manifestBytes)` equality on the receiving end → all encrypted files
8
- * fail decrypt. T2 owns this invariant.
9
- */
10
- import { createHash } from "node:crypto";
11
- import { ENCRYPTION_FORMAT_VERSION, MANIFEST_FORMAT_VERSION, ManifestError, } from "./types.js";
12
- const SUPPORTED_FORMAT_VERSIONS = new Set([MANIFEST_FORMAT_VERSION]);
13
- /** Build an in-memory ManifestV1 from a seed. Encryption defaults to disabled. */
14
- export function buildManifest(seed) {
15
- return {
16
- format_version: MANIFEST_FORMAT_VERSION,
17
- schema_version: seed.schema_version,
18
- created_at: seed.created_at ?? new Date().toISOString(),
19
- source_hostname: seed.source_hostname,
20
- source_nox_mem_version: seed.source_nox_mem_version,
21
- embedding_provider: seed.embedding_provider,
22
- embedding_model: seed.embedding_model,
23
- embedding_dim: seed.embedding_dim,
24
- sqlite_vec_version: seed.sqlite_vec_version ?? null,
25
- includes: seed.includes,
26
- filters: {
27
- project: seed.filters?.project ?? null,
28
- since: seed.filters?.since ?? null,
29
- until: seed.filters?.until ?? null,
30
- },
31
- counts: seed.counts,
32
- checksums: seed.checksums,
33
- encryption: seed.encryption ?? defaultEncryptionDisabled(),
34
- integrity_warnings: seed.integrity_warnings ?? [],
35
- };
36
- }
37
- export function defaultEncryptionDisabled() {
38
- return {
39
- enabled: false,
40
- algorithm: null,
41
- kdf: null,
42
- kdf_params: null,
43
- kdf_salt_b64: null,
44
- files: {},
45
- aad_source: null,
46
- format_version: ENCRYPTION_FORMAT_VERSION,
47
- };
48
- }
49
- /**
50
- * Canonical JSON serializer. Sorts object keys recursively, no whitespace.
51
- * Stable across Node versions (does NOT depend on V8 object insertion order).
52
- */
53
- export function canonicalize(value) {
54
- return canon(value);
55
- }
56
- function canon(value) {
57
- if (value === null)
58
- return "null";
59
- if (typeof value === "boolean")
60
- return value ? "true" : "false";
61
- if (typeof value === "number") {
62
- if (!Number.isFinite(value)) {
63
- throw new ManifestError(`Cannot canonicalize non-finite number: ${value}`);
64
- }
65
- return Number.isInteger(value) ? value.toString() : JSON.stringify(value);
66
- }
67
- if (typeof value === "string")
68
- return JSON.stringify(value);
69
- if (Array.isArray(value)) {
70
- return "[" + value.map(canon).join(",") + "]";
71
- }
72
- if (typeof value === "object") {
73
- const obj = value;
74
- const keys = Object.keys(obj).sort();
75
- return ("{" +
76
- keys
77
- .map((k) => JSON.stringify(k) + ":" + canon(obj[k]))
78
- .join(",") +
79
- "}");
80
- }
81
- throw new ManifestError(`Cannot canonicalize ${typeof value}`);
82
- }
83
- /** Serialize manifest to a UTF-8 Buffer using canonical JSON. */
84
- export function writeManifest(m) {
85
- validateManifest(m);
86
- return Buffer.from(canonicalize(m), "utf8");
87
- }
88
- /** Parse manifest bytes. Throws ManifestError on schema mismatch. */
89
- export function parseManifest(buf) {
90
- let raw;
91
- try {
92
- raw = JSON.parse(buf.toString("utf8"));
93
- }
94
- catch (err) {
95
- throw new ManifestError(`Manifest JSON parse failed: ${err.message}`);
96
- }
97
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
98
- throw new ManifestError("Manifest must be a JSON object");
99
- }
100
- const r = raw;
101
- if (typeof r.format_version !== "string" ||
102
- !SUPPORTED_FORMAT_VERSIONS.has(r.format_version)) {
103
- throw new ManifestError(`Unsupported manifest format_version: ${String(r.format_version)}`);
104
- }
105
- // Normalize: re-build manifest through buildManifest to ensure invariants.
106
- const seed = {
107
- schema_version: asNumber(r.schema_version, "schema_version"),
108
- source_hostname: asString(r.source_hostname, "source_hostname"),
109
- source_nox_mem_version: asString(r.source_nox_mem_version, "source_nox_mem_version"),
110
- embedding_provider: asString(r.embedding_provider, "embedding_provider"),
111
- embedding_model: asString(r.embedding_model, "embedding_model"),
112
- embedding_dim: asNumber(r.embedding_dim, "embedding_dim"),
113
- sqlite_vec_version: r.sqlite_vec_version ?? null,
114
- includes: asArray(r.includes, "includes"),
115
- filters: r.filters ?? undefined,
116
- counts: r.counts,
117
- checksums: r.checksums,
118
- encryption: r.encryption,
119
- integrity_warnings: r.integrity_warnings ?? [],
120
- created_at: r.created_at,
121
- };
122
- return buildManifest(seed);
123
- }
124
- /**
125
- * AAD source: sha256 of the canonical manifest bytes computed BEFORE any
126
- * encryption metadata is filled in. The full encryption block (enabled flag,
127
- * algorithm, KDF params, salt, per-file nonces/tags, etc.) is stripped to the
128
- * "disabled" sentinel so the AAD is identical pre/post-encrypt write.
129
- *
130
- * Pipeline:
131
- * 1. Build manifest with `encryption: defaultEncryptionDisabled()`
132
- * 2. AAD = sha256(manifestAADSource(this))
133
- * 3. Encrypt files using that AAD
134
- * 4. Re-assemble manifest with full `encryption: ...` filled in
135
- * 5. AAD source still produces the SAME bytes → tag verifies on decrypt
136
- */
137
- export function manifestAADSource(m) {
138
- const stripped = {
139
- ...m,
140
- encryption: defaultEncryptionDisabled(),
141
- };
142
- return writeManifest(stripped);
143
- }
144
- export function manifestAADHash(m) {
145
- return createHash("sha256").update(manifestAADSource(m)).digest();
146
- }
147
- function asString(v, field) {
148
- if (typeof v !== "string") {
149
- throw new ManifestError(`Manifest field ${field} must be a string`);
150
- }
151
- return v;
152
- }
153
- function asNumber(v, field) {
154
- if (typeof v !== "number" || !Number.isFinite(v)) {
155
- throw new ManifestError(`Manifest field ${field} must be a finite number`);
156
- }
157
- return v;
158
- }
159
- function asArray(v, field) {
160
- if (!Array.isArray(v)) {
161
- throw new ManifestError(`Manifest field ${field} must be an array`);
162
- }
163
- return v;
164
- }
165
- function validateManifest(m) {
166
- if (!SUPPORTED_FORMAT_VERSIONS.has(m.format_version)) {
167
- throw new ManifestError(`Unsupported manifest format_version: ${m.format_version}`);
168
- }
169
- if (!Number.isInteger(m.schema_version) || m.schema_version < 1) {
170
- throw new ManifestError(`Invalid schema_version: ${m.schema_version}`);
171
- }
172
- if (!m.created_at || !/^\d{4}-\d{2}-\d{2}T/.test(m.created_at)) {
173
- throw new ManifestError(`Invalid created_at: ${m.created_at}`);
174
- }
175
- if (m.embedding_dim < 1) {
176
- throw new ManifestError(`Invalid embedding_dim: ${m.embedding_dim}`);
177
- }
178
- for (const [name, hash] of Object.entries(m.checksums)) {
179
- if (!/^[0-9a-f]{64}$/.test(hash)) {
180
- throw new ManifestError(`Invalid sha256 hex for ${name}: ${hash}`);
181
- }
182
- }
183
- }
@@ -1,36 +0,0 @@
1
- /**
2
- * T9 — Schema migration logic.
3
- *
4
- * Forward-only auto-migration. Backward attempts fail clearly with an
5
- * actionable message (per spec §6). Migrations live in `migrations/v<N>_to_v<N+1>.ts`
6
- * as pure data transforms (no DB side effects).
7
- *
8
- * Public API:
9
- * - canImport(archive, current) → { ok, reason? }
10
- * - migrationPath(archive, current) → ordered list of step ids
11
- * - migrateChunks(rows, from, to) → applies the chain to a chunk row set
12
- *
13
- * The actual import pipeline (T11) wires this to its serializers; here we
14
- * keep the planning + chunk-migration logic pure so it's trivially testable.
15
- */
16
- import { ChunkRow } from "./types.js";
17
- export type ImportabilityResult = {
18
- ok: true;
19
- } | {
20
- ok: false;
21
- reason: string;
22
- };
23
- export declare function canImport(archiveVersion: number, currentVersion: number): ImportabilityResult;
24
- export declare function migrationPath(archiveVersion: number, currentVersion: number): string[];
25
- /**
26
- * Apply the migration chain to a set of chunk rows. Each step is a pure
27
- * transform; if any step throws, the whole chain aborts and the error
28
- * propagates (T11 wraps in a transaction with rollback).
29
- */
30
- export declare function migrateChunks(rows: ChunkRow[], archiveVersion: number, currentVersion: number): ChunkRow[];
31
- /** Exposed for tests — list registered migrations. */
32
- export declare function listMigrations(): ReadonlyArray<{
33
- id: string;
34
- from: number;
35
- to: number;
36
- }>;
@@ -1,100 +0,0 @@
1
- /**
2
- * T9 — Schema migration logic.
3
- *
4
- * Forward-only auto-migration. Backward attempts fail clearly with an
5
- * actionable message (per spec §6). Migrations live in `migrations/v<N>_to_v<N+1>.ts`
6
- * as pure data transforms (no DB side effects).
7
- *
8
- * Public API:
9
- * - canImport(archive, current) → { ok, reason? }
10
- * - migrationPath(archive, current) → ordered list of step ids
11
- * - migrateChunks(rows, from, to) → applies the chain to a chunk row set
12
- *
13
- * The actual import pipeline (T11) wires this to its serializers; here we
14
- * keep the planning + chunk-migration logic pure so it's trivially testable.
15
- */
16
- import { SchemaVersionError } from "./types.js";
17
- import * as v18_to_v19 from "./migrations/v18_to_v19.js";
18
- const STEPS = [
19
- {
20
- id: v18_to_v19.MIGRATION_ID,
21
- from: v18_to_v19.FROM_VERSION,
22
- to: v18_to_v19.TO_VERSION,
23
- migrateChunks: v18_to_v19.migrateChunks,
24
- },
25
- ];
26
- const STEP_BY_FROM = new Map(STEPS.map((s) => [s.from, s]));
27
- export function canImport(archiveVersion, currentVersion) {
28
- if (!Number.isInteger(archiveVersion) || archiveVersion < 1) {
29
- return { ok: false, reason: `Invalid archive schema version: ${archiveVersion}` };
30
- }
31
- if (!Number.isInteger(currentVersion) || currentVersion < 1) {
32
- return { ok: false, reason: `Invalid current schema version: ${currentVersion}` };
33
- }
34
- if (archiveVersion === currentVersion) {
35
- return { ok: true };
36
- }
37
- if (archiveVersion > currentVersion) {
38
- return {
39
- ok: false,
40
- reason: `Archive schema version ${archiveVersion} is newer than current nox-mem schema version ${currentVersion}. ` +
41
- `Upgrade nox-mem before importing: \`npm install -g openclaw-nox-mem@latest\`.`,
42
- };
43
- }
44
- // archive < current — verify a chain exists
45
- let v = archiveVersion;
46
- while (v < currentVersion) {
47
- const step = STEP_BY_FROM.get(v);
48
- if (!step) {
49
- return {
50
- ok: false,
51
- reason: `No migration registered from v${v} to v${v + 1}. ` +
52
- `Chain v${archiveVersion} → v${currentVersion} cannot complete.`,
53
- };
54
- }
55
- v = step.to;
56
- }
57
- return { ok: true };
58
- }
59
- export function migrationPath(archiveVersion, currentVersion) {
60
- const verdict = canImport(archiveVersion, currentVersion);
61
- if (!verdict.ok)
62
- throw new SchemaVersionError(verdict.reason);
63
- if (archiveVersion === currentVersion)
64
- return [];
65
- const path = [];
66
- let v = archiveVersion;
67
- while (v < currentVersion) {
68
- const step = STEP_BY_FROM.get(v);
69
- path.push(step.id);
70
- v = step.to;
71
- }
72
- return path;
73
- }
74
- /**
75
- * Apply the migration chain to a set of chunk rows. Each step is a pure
76
- * transform; if any step throws, the whole chain aborts and the error
77
- * propagates (T11 wraps in a transaction with rollback).
78
- */
79
- export function migrateChunks(rows, archiveVersion, currentVersion) {
80
- const verdict = canImport(archiveVersion, currentVersion);
81
- if (!verdict.ok)
82
- throw new SchemaVersionError(verdict.reason);
83
- let current = rows;
84
- let v = archiveVersion;
85
- while (v < currentVersion) {
86
- const step = STEP_BY_FROM.get(v);
87
- try {
88
- current = step.migrateChunks(current);
89
- }
90
- catch (err) {
91
- throw new SchemaVersionError(`Migration ${step.id} failed at v${v}→v${step.to}: ${err.message}`);
92
- }
93
- v = step.to;
94
- }
95
- return current;
96
- }
97
- /** Exposed for tests — list registered migrations. */
98
- export function listMigrations() {
99
- return STEPS.map(({ id, from, to }) => ({ id, from, to }));
100
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * Placeholder migration v18 → v19.
3
- *
4
- * Real v19 schema lands later. This shim demonstrates the contract:
5
- * - takes rows in v18 shape
6
- * - returns rows in v19 shape
7
- * - idempotent (re-run = no-op)
8
- *
9
- * Until v19 ships, this is a literal identity transform so the migration
10
- * chain can be wired and tested end-to-end with synthetic version numbers.
11
- */
12
- import { ChunkRow } from "../types.js";
13
- export declare const MIGRATION_ID = "v18_to_v19_placeholder";
14
- export declare const FROM_VERSION = 18;
15
- export declare const TO_VERSION = 19;
16
- export declare function migrateChunks(rows: ChunkRow[]): ChunkRow[];
@@ -1,18 +0,0 @@
1
- /**
2
- * Placeholder migration v18 → v19.
3
- *
4
- * Real v19 schema lands later. This shim demonstrates the contract:
5
- * - takes rows in v18 shape
6
- * - returns rows in v19 shape
7
- * - idempotent (re-run = no-op)
8
- *
9
- * Until v19 ships, this is a literal identity transform so the migration
10
- * chain can be wired and tested end-to-end with synthetic version numbers.
11
- */
12
- export const MIGRATION_ID = "v18_to_v19_placeholder";
13
- export const FROM_VERSION = 18;
14
- export const TO_VERSION = 19;
15
- export function migrateChunks(rows) {
16
- // Identity. Real migration logic will go here.
17
- return rows.map((r) => ({ ...r }));
18
- }
@@ -1,166 +0,0 @@
1
- /**
2
- * Orchestrator — T10/T11/T13/T14 backing module.
3
- *
4
- * Wires the T1-T9 primitives (format/manifest/serializers/encryption/migration)
5
- * into two top-level operations: `runExport` and `runImport`. Framework-agnostic
6
- * — CLI, HTTP and MCP layers all funnel through here.
7
- *
8
- * Design constraints (D41 #2 + spec §3 §6):
9
- * 1. Encrypt-by-default — `unencrypted: true` is opt-out (CLI / HTTP / MCP
10
- * surfaces enforce ACK separately).
11
- * 2. Passphrase never via argv — caller passes a string OR a `getPassphrase`
12
- * thunk; this module never inspects `process.argv`.
13
- * 3. Streaming-friendly outputs — `runExport` returns a Buffer for now
14
- * (T10/T11 pivot). The format module already exposes `packArchiveStream`
15
- * for callers that need to pipe directly to disk.
16
- * 4. Progress events — caller passes an optional `onProgress` callback. Tests
17
- * assert callback is invoked for each major phase.
18
- * 5. Cancellation — caller passes an optional `AbortSignal`. We abort
19
- * between phases (no partial DB writes possible because we build a single
20
- * tarball in memory before writing).
21
- * 6. ops_audit append-only — see T11 import path; merge/replace never DELETE
22
- * audit rows (enforced by `planOpsAuditImport`).
23
- * 7. Manifest AAD invariant — re-built via `manifestAADHash` after encryption
24
- * metadata is filled in, so decrypt side recomputes identically.
25
- */
26
- import { BadPassphraseError, ChunkRow, ImportMode, ImportStats, KgEntityRow, KgRelationRow, ManifestV1, OpsAuditRow, TamperedArchiveError } from "./types.js";
27
- import { EmbeddingInput } from "./serializers/embeddings.js";
28
- export interface ExportRequest {
29
- schema_version: number;
30
- source_hostname: string;
31
- source_nox_mem_version: string;
32
- embedding_provider: string;
33
- embedding_model: string;
34
- embedding_dim: number;
35
- sqlite_vec_version?: string | null;
36
- chunks: ChunkRow[];
37
- embeddings?: EmbeddingInput[];
38
- kg_entities?: KgEntityRow[];
39
- kg_relations?: KgRelationRow[];
40
- ops_audit?: OpsAuditRow[];
41
- filters?: {
42
- project?: string | null;
43
- since?: string | null;
44
- until?: string | null;
45
- };
46
- /** D41 #2: default false (encrypt-by-default). */
47
- unencrypted?: boolean;
48
- /** Required if !unencrypted. */
49
- passphrase?: string;
50
- /** Cancellation. Aborts between phases. */
51
- signal?: AbortSignal;
52
- /** Progress callback. */
53
- onProgress?: (ev: ProgressEvent) => void;
54
- }
55
- export interface ExportResult {
56
- archive: Buffer;
57
- manifest: ManifestV1;
58
- /** Size of the packed (gzipped) archive in bytes. */
59
- size_bytes: number;
60
- /** Wall-clock ms for the full export. */
61
- duration_ms: number;
62
- }
63
- export interface ImportRequest {
64
- archive: Buffer;
65
- /** Required if archive is encrypted. */
66
- passphrase?: string;
67
- mode?: ImportMode;
68
- /** Skip actual writes (T11 --dry-run). */
69
- dry_run?: boolean;
70
- /** Skip integrity check + writes (T11 --verify). */
71
- verify_only?: boolean;
72
- /** Current DB schema version — used for migration planning. */
73
- current_schema_version: number;
74
- /** Existing rows in target DB (empty for clean imports). */
75
- existing?: {
76
- chunks?: ChunkRow[];
77
- kg_entities?: KgEntityRow[];
78
- kg_relations?: KgRelationRow[];
79
- ops_audit?: OpsAuditRow[];
80
- };
81
- signal?: AbortSignal;
82
- onProgress?: (ev: ProgressEvent) => void;
83
- }
84
- export interface ImportResult {
85
- manifest: ManifestV1;
86
- stats: {
87
- chunks: ImportStats;
88
- kg_entities: ImportStats;
89
- kg_relations: ImportStats;
90
- ops_audit: ImportStats;
91
- embeddings: {
92
- embedded: number;
93
- skipped: number;
94
- };
95
- };
96
- /** Resolved rows ready to be persisted to a DB (caller's responsibility). */
97
- resolved: {
98
- chunks: ChunkRow[];
99
- kg_entities: KgEntityRow[];
100
- kg_relations: KgRelationRow[];
101
- ops_audit: OpsAuditRow[];
102
- embeddings: Map<number, EmbeddingInput>;
103
- };
104
- duration_ms: number;
105
- /** True when caller asked for verify_only or dry_run; no resolved.persist intended. */
106
- applied: boolean;
107
- }
108
- export type ProgressEvent = {
109
- phase: "export.start";
110
- total?: number;
111
- } | {
112
- phase: "export.chunks";
113
- emitted: number;
114
- total: number;
115
- } | {
116
- phase: "export.embeddings";
117
- emitted: number;
118
- total: number;
119
- } | {
120
- phase: "export.kg";
121
- emitted: number;
122
- total: number;
123
- } | {
124
- phase: "export.encrypt";
125
- files: number;
126
- } | {
127
- phase: "export.pack";
128
- entries: number;
129
- } | {
130
- phase: "export.done";
131
- size_bytes: number;
132
- duration_ms: number;
133
- } | {
134
- phase: "import.start";
135
- } | {
136
- phase: "import.unpack";
137
- entries: number;
138
- } | {
139
- phase: "import.decrypt";
140
- files: number;
141
- } | {
142
- phase: "import.migrate";
143
- from: number;
144
- to: number;
145
- steps: number;
146
- } | {
147
- phase: "import.chunks";
148
- imported: number;
149
- total: number;
150
- } | {
151
- phase: "import.embeddings";
152
- imported: number;
153
- total: number;
154
- } | {
155
- phase: "import.kg";
156
- imported: number;
157
- total: number;
158
- } | {
159
- phase: "import.done";
160
- duration_ms: number;
161
- };
162
- export declare function runExport(req: ExportRequest): Promise<ExportResult>;
163
- export declare function runImport(req: ImportRequest): Promise<ImportResult>;
164
- /** Synchronous list of archive entries (open-toolchain DoD #4 hook). */
165
- export declare function listArchiveEntries(archive: Buffer): string[];
166
- export { BadPassphraseError, TamperedArchiveError };