nox-mem 3.1.1 → 3.2.1

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/crystallize.js +3 -5
  17. package/dist/db.js +61 -2
  18. package/dist/embed.js +23 -2
  19. package/dist/index.js +1 -22
  20. package/dist/knowledge-graph.js +20 -0
  21. package/dist/lib/answer/__tests__/e2e-gemini.test.js +229 -0
  22. package/dist/lib/answer/__tests__/integration-sqlite.test.js +388 -0
  23. package/dist/lib/answer/__tests__/integration.test.js +347 -0
  24. package/dist/lib/answer/__tests__/prompt.test.js +117 -0
  25. package/dist/lib/answer/__tests__/t5-t10.test.js +501 -0
  26. package/dist/lib/answer/provider.js +29 -4
  27. package/dist/lib/api/__tests__/safe-error-message.test.js +155 -0
  28. package/dist/lib/auth/__tests__/localhost-guard.test.js +144 -0
  29. package/dist/lib/error-sanitizer/__tests__/sanitize.test.js +354 -0
  30. package/dist/lib/events/__tests__/bus.test.js +208 -0
  31. package/dist/lib/ingest-router.js +0 -43
  32. package/dist/lib/op-audit-extension/__tests__/ran-at-guard.test.js +109 -0
  33. package/dist/lib/regex-extract/__tests__/extractor.test.js +197 -0
  34. package/dist/lib/regex-extract/__tests__/frontmatter.test.js +75 -0
  35. package/dist/lib/regex-extract/__tests__/ingest-router-l4.test.js +139 -0
  36. package/dist/lib/regex-extract/__tests__/production-wire.test.js +177 -0
  37. package/dist/lib/regex-extract/__tests__/reconcile.test.js +170 -0
  38. package/dist/lib/regex-extract/__tests__/strip-code.test.js +36 -0
  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/package.json +3 -4
  51. package/dist/api/answer.d.ts +0 -116
  52. package/dist/api/answer.validate-patch.d.ts +0 -72
  53. package/dist/api/brief-diversity.d.ts +0 -64
  54. package/dist/api/brief.d.ts +0 -114
  55. package/dist/api/conflict.d.ts +0 -33
  56. package/dist/api/conflict.js +0 -143
  57. package/dist/api/cors.d.ts +0 -73
  58. package/dist/api/events-stream-limited.d.ts +0 -133
  59. package/dist/api/events-stream-limited.js +0 -217
  60. package/dist/api/events-stream.d.ts +0 -53
  61. package/dist/api/events-stream.js +0 -125
  62. package/dist/api/export.d.ts +0 -42
  63. package/dist/api/export.js +0 -85
  64. package/dist/api/health-confidence-adapter.d.ts +0 -29
  65. package/dist/api/health-confidence-adapter.js +0 -73
  66. package/dist/api/health-confidence.d.ts +0 -36
  67. package/dist/api/health-confidence.js +0 -141
  68. package/dist/api/hooks.d.ts +0 -50
  69. package/dist/api/hooks.js +0 -115
  70. package/dist/api/import.d.ts +0 -38
  71. package/dist/api/import.js +0 -87
  72. package/dist/api/ingest-event.d.ts +0 -65
  73. package/dist/api/mark.d.ts +0 -42
  74. package/dist/api/mark.js +0 -127
  75. package/dist/api/server-deps-a2.d.ts +0 -55
  76. package/dist/api/server-deps-a2.js +0 -138
  77. package/dist/api/server-deps-l2-l3.d.ts +0 -68
  78. package/dist/api/server-deps-l2-l3.js +0 -123
  79. package/dist/api/server-deps-p1.d.ts +0 -84
  80. package/dist/api/server-deps-p2.d.ts +0 -32
  81. package/dist/api/server-deps-p2.js +0 -84
  82. package/dist/api/server-deps-p5.d.ts +0 -66
  83. package/dist/api/server-deps-p5.js +0 -139
  84. package/dist/api/viewer-static.d.ts +0 -30
  85. package/dist/api/viewer-static.js +0 -102
  86. package/dist/api/wire-up.d.ts +0 -54
  87. package/dist/api-impact.d.ts +0 -30
  88. package/dist/api-server.d.ts +0 -2
  89. package/dist/backfill-fts-anchor.d.ts +0 -15
  90. package/dist/backfill-source-type.d.ts +0 -20
  91. package/dist/churn.d.ts +0 -31
  92. package/dist/cli/answer.d.ts +0 -66
  93. package/dist/cli/conflict.d.ts +0 -38
  94. package/dist/cli/conflict.js +0 -282
  95. package/dist/cli/export.d.ts +0 -51
  96. package/dist/cli/export.js +0 -280
  97. package/dist/cli/hooks.d.ts +0 -54
  98. package/dist/cli/hooks.js +0 -133
  99. package/dist/cli/import.d.ts +0 -52
  100. package/dist/cli/import.js +0 -274
  101. package/dist/cli/mark.d.ts +0 -33
  102. package/dist/cli/mark.js +0 -130
  103. package/dist/cli/ocr-batch.d.ts +0 -12
  104. package/dist/cli/ocr-batch.js +0 -411
  105. package/dist/cli/snapshot-main.d.ts +0 -30
  106. package/dist/cli/snapshot-main.js +0 -47
  107. package/dist/cli/viewer.d.ts +0 -35
  108. package/dist/cli/viewer.js +0 -71
  109. package/dist/cli-telemetry.d.ts +0 -36
  110. package/dist/cli-telemetry.js +0 -150
  111. package/dist/compact.d.ts +0 -7
  112. package/dist/consolidate.d.ts +0 -18
  113. package/dist/consolidation.d.ts +0 -32
  114. package/dist/cross-agent-v2.d.ts +0 -45
  115. package/dist/cross-search.d.ts +0 -11
  116. package/dist/crystallize.d.ts +0 -43
  117. package/dist/db.d.ts +0 -11
  118. package/dist/dedup.d.ts +0 -1
  119. package/dist/detect-changes.d.ts +0 -29
  120. package/dist/digest.d.ts +0 -1
  121. package/dist/doctor.d.ts +0 -1
  122. package/dist/embed.d.ts +0 -57
  123. package/dist/evals.d.ts +0 -176
  124. package/dist/evals.js +0 -351
  125. package/dist/generate-user-profile.d.ts +0 -18
  126. package/dist/graphify-ingest.d.ts +0 -18
  127. package/dist/impact.d.ts +0 -39
  128. package/dist/index.d.ts +0 -2
  129. package/dist/ingest-entity.d.ts +0 -44
  130. package/dist/ingest.d.ts +0 -13
  131. package/dist/kg-llm.d.ts +0 -39
  132. package/dist/knowledge-graph.d.ts +0 -72
  133. package/dist/lib/answer/config.d.ts +0 -41
  134. package/dist/lib/answer/index.d.ts +0 -47
  135. package/dist/lib/answer/prompt.d.ts +0 -37
  136. package/dist/lib/answer/provider.d.ts +0 -47
  137. package/dist/lib/answer/retrieval.d.ts +0 -36
  138. package/dist/lib/answer/telemetry.d.ts +0 -99
  139. package/dist/lib/answer/types.d.ts +0 -108
  140. package/dist/lib/api/error-leak-fix.d.ts +0 -54
  141. package/dist/lib/api/safe-error-message.d.ts +0 -70
  142. package/dist/lib/archive/common-passwords.d.ts +0 -37
  143. package/dist/lib/archive/common-passwords.js +0 -753
  144. package/dist/lib/archive/encryption.d.ts +0 -81
  145. package/dist/lib/archive/encryption.js +0 -236
  146. package/dist/lib/archive/enforce-strength.d.ts +0 -54
  147. package/dist/lib/archive/enforce-strength.js +0 -70
  148. package/dist/lib/archive/entropy.d.ts +0 -34
  149. package/dist/lib/archive/entropy.js +0 -180
  150. package/dist/lib/archive/export-locking.d.ts +0 -102
  151. package/dist/lib/archive/export-locking.js +0 -202
  152. package/dist/lib/archive/format.d.ts +0 -20
  153. package/dist/lib/archive/format.js +0 -174
  154. package/dist/lib/archive/index.d.ts +0 -23
  155. package/dist/lib/archive/index.js +0 -17
  156. package/dist/lib/archive/manifest.d.ts +0 -53
  157. package/dist/lib/archive/manifest.js +0 -183
  158. package/dist/lib/archive/migration.d.ts +0 -36
  159. package/dist/lib/archive/migration.js +0 -100
  160. package/dist/lib/archive/migrations/v18_to_v19.d.ts +0 -16
  161. package/dist/lib/archive/migrations/v18_to_v19.js +0 -18
  162. package/dist/lib/archive/orchestrator.d.ts +0 -166
  163. package/dist/lib/archive/orchestrator.js +0 -428
  164. package/dist/lib/archive/serializers/chunks.d.ts +0 -30
  165. package/dist/lib/archive/serializers/chunks.js +0 -113
  166. package/dist/lib/archive/serializers/embeddings.d.ts +0 -36
  167. package/dist/lib/archive/serializers/embeddings.js +0 -115
  168. package/dist/lib/archive/serializers/kg.d.ts +0 -28
  169. package/dist/lib/archive/serializers/kg.js +0 -184
  170. package/dist/lib/archive/serializers/ops_audit.d.ts +0 -21
  171. package/dist/lib/archive/serializers/ops_audit.js +0 -97
  172. package/dist/lib/archive/server-deps.d.ts +0 -131
  173. package/dist/lib/archive/server-deps.js +0 -232
  174. package/dist/lib/archive/strength.d.ts +0 -50
  175. package/dist/lib/archive/strength.js +0 -77
  176. package/dist/lib/archive/types.d.ts +0 -159
  177. package/dist/lib/archive/types.js +0 -45
  178. package/dist/lib/archive/unpack-streaming.d.ts +0 -70
  179. package/dist/lib/archive/unpack-streaming.js +0 -255
  180. package/dist/lib/auth/localhost-guard.d.ts +0 -106
  181. package/dist/lib/confidence/config.d.ts +0 -37
  182. package/dist/lib/confidence/config.js +0 -107
  183. package/dist/lib/confidence/db-shim-singleton.d.ts +0 -20
  184. package/dist/lib/confidence/db-shim-singleton.js +0 -41
  185. package/dist/lib/confidence/db-shim.d.ts +0 -47
  186. package/dist/lib/confidence/db-shim.js +0 -141
  187. package/dist/lib/confidence/mark.d.ts +0 -58
  188. package/dist/lib/confidence/mark.js +0 -168
  189. package/dist/lib/confidence/ranking.d.ts +0 -69
  190. package/dist/lib/confidence/ranking.js +0 -101
  191. package/dist/lib/confidence/search-filter.d.ts +0 -44
  192. package/dist/lib/confidence/search-filter.js +0 -103
  193. package/dist/lib/confidence/types.d.ts +0 -146
  194. package/dist/lib/confidence/types.js +0 -20
  195. package/dist/lib/confidence/write-hooks.d.ts +0 -50
  196. package/dist/lib/confidence/write-hooks.js +0 -159
  197. package/dist/lib/conflict/audit-fk-check.d.ts +0 -72
  198. package/dist/lib/conflict/audit-fk-check.js +0 -131
  199. package/dist/lib/conflict/audit-writer.d.ts +0 -39
  200. package/dist/lib/conflict/audit-writer.js +0 -133
  201. package/dist/lib/conflict/db-singleton.d.ts +0 -28
  202. package/dist/lib/conflict/db-singleton.js +0 -61
  203. package/dist/lib/conflict/db.d.ts +0 -27
  204. package/dist/lib/conflict/db.js +0 -20
  205. package/dist/lib/conflict/detector-direct.d.ts +0 -21
  206. package/dist/lib/conflict/detector-direct.js +0 -105
  207. package/dist/lib/conflict/evidence.d.ts +0 -24
  208. package/dist/lib/conflict/evidence.js +0 -76
  209. package/dist/lib/conflict/index.d.ts +0 -14
  210. package/dist/lib/conflict/index.js +0 -12
  211. package/dist/lib/conflict/scheduler.d.ts +0 -78
  212. package/dist/lib/conflict/scheduler.js +0 -111
  213. package/dist/lib/conflict/shadow.d.ts +0 -75
  214. package/dist/lib/conflict/shadow.js +0 -161
  215. package/dist/lib/conflict/types.d.ts +0 -133
  216. package/dist/lib/conflict/types.js +0 -19
  217. package/dist/lib/cost-cap.d.ts +0 -94
  218. package/dist/lib/deps/deps-registry.d.ts +0 -111
  219. package/dist/lib/error-sanitizer/middleware.d.ts +0 -43
  220. package/dist/lib/error-sanitizer/sanitize.d.ts +0 -78
  221. package/dist/lib/eval-batch.d.ts +0 -34
  222. package/dist/lib/eval-batch.js +0 -103
  223. package/dist/lib/eval-metrics.d.ts +0 -36
  224. package/dist/lib/eval-metrics.js +0 -95
  225. package/dist/lib/eval.d.ts +0 -106
  226. package/dist/lib/eval.js +0 -343
  227. package/dist/lib/events/bus.d.ts +0 -135
  228. package/dist/lib/fts-anchor.d.ts +0 -1
  229. package/dist/lib/hooks/classifier.d.ts +0 -47
  230. package/dist/lib/hooks/classifier.js +0 -129
  231. package/dist/lib/hooks/config.d.ts +0 -49
  232. package/dist/lib/hooks/config.js +0 -106
  233. package/dist/lib/hooks/decorators.d.ts +0 -35
  234. package/dist/lib/hooks/decorators.js +0 -59
  235. package/dist/lib/hooks/pipeline.d.ts +0 -76
  236. package/dist/lib/hooks/pipeline.js +0 -213
  237. package/dist/lib/hooks/privacy-filter-adapter.d.ts +0 -55
  238. package/dist/lib/hooks/privacy-filter-adapter.js +0 -84
  239. package/dist/lib/hooks/rate-limit-constant-time.d.ts +0 -57
  240. package/dist/lib/hooks/rate-limit-constant-time.js +0 -69
  241. package/dist/lib/hooks/rate-limit-dryrun-fix.d.ts +0 -71
  242. package/dist/lib/hooks/rate-limit-dryrun-fix.js +0 -110
  243. package/dist/lib/hooks/rate-limit.d.ts +0 -54
  244. package/dist/lib/hooks/rate-limit.js +0 -122
  245. package/dist/lib/hooks/server-deps.d.ts +0 -61
  246. package/dist/lib/hooks/server-deps.js +0 -92
  247. package/dist/lib/hooks/source-allowlist.d.ts +0 -26
  248. package/dist/lib/hooks/source-allowlist.js +0 -53
  249. package/dist/lib/hooks/types.d.ts +0 -129
  250. package/dist/lib/hooks/types.js +0 -24
  251. package/dist/lib/hooks/worker.d.ts +0 -56
  252. package/dist/lib/hooks/worker.js +0 -150
  253. package/dist/lib/ingest-router.d.ts +0 -25
  254. package/dist/lib/ocr-detector.d.ts +0 -61
  255. package/dist/lib/ocr-detector.js +0 -138
  256. package/dist/lib/ocr-engine-stub.d.ts +0 -48
  257. package/dist/lib/ocr-engine-stub.js +0 -190
  258. package/dist/lib/ocr-engines/google-doc-ai.d.ts +0 -36
  259. package/dist/lib/ocr-engines/google-doc-ai.js +0 -164
  260. package/dist/lib/ocr-jobs.d.ts +0 -67
  261. package/dist/lib/ocr-jobs.js +0 -129
  262. package/dist/lib/op-audit-extension/ran-at-guard.d.ts +0 -86
  263. package/dist/lib/op-audit.d.ts +0 -71
  264. package/dist/lib/privacy-br/detector.d.ts +0 -42
  265. package/dist/lib/privacy-br/detector.js +0 -130
  266. package/dist/lib/privacy-br/index.d.ts +0 -20
  267. package/dist/lib/privacy-br/index.js +0 -20
  268. package/dist/lib/privacy-br/integration.d.ts +0 -71
  269. package/dist/lib/privacy-br/integration.js +0 -74
  270. package/dist/lib/privacy-br/patterns.d.ts +0 -117
  271. package/dist/lib/privacy-br/patterns.js +0 -434
  272. package/dist/lib/privacy-br/redact.d.ts +0 -42
  273. package/dist/lib/privacy-br/redact.js +0 -103
  274. package/dist/lib/privacy-br/types.d.ts +0 -55
  275. package/dist/lib/privacy-br/types.js +0 -25
  276. package/dist/lib/regex-extract/extractor.d.ts +0 -30
  277. package/dist/lib/regex-extract/frontmatter.d.ts +0 -44
  278. package/dist/lib/regex-extract/index.d.ts +0 -14
  279. package/dist/lib/regex-extract/ingest-router-l4.d.ts +0 -76
  280. package/dist/lib/regex-extract/patterns.d.ts +0 -61
  281. package/dist/lib/regex-extract/production-wire.d.ts +0 -128
  282. package/dist/lib/regex-extract/reconcile.d.ts +0 -162
  283. package/dist/lib/regex-extract/strip-code.d.ts +0 -24
  284. package/dist/lib/regex-extract/types.d.ts +0 -48
  285. package/dist/lib/reranker.d.ts +0 -80
  286. package/dist/lib/shadow-tracker.d.ts +0 -191
  287. package/dist/lib/shadow-tracker.js +0 -384
  288. package/dist/lib/spo-injection.d.ts +0 -52
  289. package/dist/lib/telemetry-collector.d.ts +0 -158
  290. package/dist/lib/telemetry-collector.js +0 -249
  291. package/dist/lib/temporal-detector.d.ts +0 -27
  292. package/dist/lib/viewer/auth.d.ts +0 -37
  293. package/dist/lib/viewer/auth.js +0 -70
  294. package/dist/lib/viewer/backpressure.d.ts +0 -59
  295. package/dist/lib/viewer/backpressure.js +0 -100
  296. package/dist/lib/viewer/broadcast-singleton.d.ts +0 -34
  297. package/dist/lib/viewer/broadcast-singleton.js +0 -49
  298. package/dist/lib/viewer/broadcast.d.ts +0 -66
  299. package/dist/lib/viewer/broadcast.js +0 -96
  300. package/dist/lib/viewer/event-types.d.ts +0 -132
  301. package/dist/lib/viewer/event-types.js +0 -74
  302. package/dist/lib/viewer/instrumentation.d.ts +0 -106
  303. package/dist/lib/viewer/instrumentation.js +0 -224
  304. package/dist/lib/viewer/migration.d.ts +0 -23
  305. package/dist/lib/viewer/migration.js +0 -56
  306. package/dist/lib/viewer/redaction.d.ts +0 -44
  307. package/dist/lib/viewer/redaction.js +0 -139
  308. package/dist/lib/viewer/session.d.ts +0 -51
  309. package/dist/lib/viewer/session.js +0 -87
  310. package/dist/mcp/tools/answer.d.ts +0 -94
  311. package/dist/mcp/tools/archive.d.ts +0 -152
  312. package/dist/mcp/tools/archive.js +0 -170
  313. package/dist/mcp/tools/conflict.d.ts +0 -44
  314. package/dist/mcp/tools/conflict.js +0 -130
  315. package/dist/mcp/tools/hooks.d.ts +0 -29
  316. package/dist/mcp/tools/hooks.js +0 -78
  317. package/dist/mcp/tools/mark.d.ts +0 -38
  318. package/dist/mcp/tools/mark.js +0 -82
  319. package/dist/mcp/tools/viewer.d.ts +0 -58
  320. package/dist/mcp/tools/viewer.js +0 -64
  321. package/dist/mcp-server.d.ts +0 -2
  322. package/dist/metrics.d.ts +0 -3
  323. package/dist/noise-filter.d.ts +0 -18
  324. package/dist/notion-sync.d.ts +0 -7
  325. package/dist/notion-sync.js +0 -97
  326. package/dist/observability/adapters/a3-adapter.d.ts +0 -63
  327. package/dist/observability/adapters/a3-adapter.js +0 -83
  328. package/dist/observability/adapters/p1-adapter.d.ts +0 -49
  329. package/dist/observability/adapters/p1-adapter.js +0 -63
  330. package/dist/observability/adapters/p5-adapter.d.ts +0 -36
  331. package/dist/observability/adapters/p5-adapter.js +0 -71
  332. package/dist/observability/cardinality.d.ts +0 -61
  333. package/dist/observability/cardinality.js +0 -300
  334. package/dist/observability/collectors/db-stats.collector.d.ts +0 -9
  335. package/dist/observability/collectors/db-stats.collector.js +0 -88
  336. package/dist/observability/collectors/eventbus.collector.d.ts +0 -6
  337. package/dist/observability/collectors/eventbus.collector.js +0 -50
  338. package/dist/observability/collectors/process.collector.d.ts +0 -7
  339. package/dist/observability/collectors/process.collector.js +0 -93
  340. package/dist/observability/collectors/provider-telemetry.collector.d.ts +0 -11
  341. package/dist/observability/collectors/provider-telemetry.collector.js +0 -112
  342. package/dist/observability/collectors/search-telemetry.collector.d.ts +0 -12
  343. package/dist/observability/collectors/search-telemetry.collector.js +0 -76
  344. package/dist/observability/exporter.d.ts +0 -30
  345. package/dist/observability/exporter.js +0 -182
  346. package/dist/observability/index.d.ts +0 -22
  347. package/dist/observability/index.js +0 -21
  348. package/dist/observability/metrics.d.ts +0 -53
  349. package/dist/observability/metrics.js +0 -213
  350. package/dist/observability/privacy-guard.d.ts +0 -32
  351. package/dist/observability/privacy-guard.js +0 -116
  352. package/dist/observability/record.d.ts +0 -83
  353. package/dist/observability/record.js +0 -217
  354. package/dist/observability/registry.d.ts +0 -60
  355. package/dist/observability/registry.js +0 -93
  356. package/dist/observability/types.d.ts +0 -115
  357. package/dist/observability/types.js +0 -235
  358. package/dist/observability.d.ts +0 -131
  359. package/dist/plugins/nox-hooks/index.d.ts +0 -61
  360. package/dist/plugins/nox-hooks/index.js +0 -99
  361. package/dist/primer.d.ts +0 -1
  362. package/dist/privacy/filter.d.ts +0 -27
  363. package/dist/privacy/patterns.d.ts +0 -29
  364. package/dist/privacy/tag-parser.d.ts +0 -24
  365. package/dist/project-context-gen.d.ts +0 -10
  366. package/dist/providers/embedding/gemini.d.ts +0 -73
  367. package/dist/providers/embedding/openai.d.ts +0 -76
  368. package/dist/providers/embedding/types.d.ts +0 -39
  369. package/dist/providers/embedding/voyage.d.ts +0 -36
  370. package/dist/providers/index.d.ts +0 -116
  371. package/dist/providers/llm/anthropic.d.ts +0 -29
  372. package/dist/providers/llm/chain.d.ts +0 -99
  373. package/dist/providers/llm/gemini.d.ts +0 -48
  374. package/dist/providers/llm/openai.d.ts +0 -64
  375. package/dist/providers/llm/types.d.ts +0 -47
  376. package/dist/providers/telemetry.d.ts +0 -87
  377. package/dist/providers/types.d.ts +0 -42
  378. package/dist/query-entity-count.d.ts +0 -54
  379. package/dist/reflect.d.ts +0 -26
  380. package/dist/reindex-errors.d.ts +0 -7
  381. package/dist/reindex.d.ts +0 -16
  382. package/dist/retention.d.ts +0 -40
  383. package/dist/salience.d.ts +0 -85
  384. package/dist/scripts/migrate-v17-ops-audit.d.ts +0 -17
  385. package/dist/search-dedup.d.ts +0 -44
  386. package/dist/search-expansion.d.ts +0 -20
  387. package/dist/search.d.ts +0 -62
  388. package/dist/seh-detector.d.ts +0 -31
  389. package/dist/self-improve.d.ts +0 -1
  390. package/dist/session-distill.d.ts +0 -29
  391. package/dist/session-update.d.ts +0 -1
  392. package/dist/shared-memory.d.ts +0 -24
  393. package/dist/stats.d.ts +0 -1
  394. package/dist/temporal-retrieval.d.ts +0 -132
  395. package/dist/tier-manager.d.ts +0 -69
  396. package/dist/vectorize.d.ts +0 -16
  397. package/dist/version.d.ts +0 -1
  398. package/dist/watch.d.ts +0 -8
@@ -1,94 +0,0 @@
1
- /**
2
- * src/mcp/tools/answer.ts — P1 T10: `nox_mem_answer` MCP tool.
3
- *
4
- * Mirrors the HTTP shape (kickoff §5/§6). Single code path: under the hood
5
- * we call the same `answer()` library function used by CLI/HTTP. The only
6
- * difference is the MCP `content` envelope expected by the protocol.
7
- *
8
- * MCP tool contract (CallToolResult):
9
- * {
10
- * content: [{ type: "text", text: "<JSON or human-readable>" }],
11
- * isError?: boolean
12
- * }
13
- *
14
- * We always emit a JSON payload in `content[0].text` so the consumer (LLM
15
- * agent / Claude desktop) can JSON.parse it deterministically. We also set
16
- * `isError: true` on hard failures (hallucination_after_retry, llm_error).
17
- *
18
- * Registration: production `src/mcp/tools/index.ts` imports
19
- * `noxMemAnswerTool` and pushes into its tool registry. Shape is intentionally
20
- * MCP-SDK-agnostic — same factory works with `@modelcontextprotocol/sdk` v0.x
21
- * or the in-tree minimal MCP runner used by VPS.
22
- */
23
- import type { AnswerOpts, AnswerResult } from "../../lib/answer/index.js";
24
- import { type TelemetryStore } from "../../lib/answer/telemetry.js";
25
- export interface McpToolDefinition {
26
- name: string;
27
- description: string;
28
- inputSchema: Record<string, unknown>;
29
- handler: (input: unknown, ctx?: McpCallContext) => Promise<McpCallResult>;
30
- }
31
- export interface McpCallContext {
32
- sessionId?: string | null;
33
- telemetryStore?: TelemetryStore;
34
- /** Test seam: replace answer() under test. */
35
- answer?: (opts: AnswerOpts) => Promise<AnswerResult>;
36
- }
37
- export interface McpCallResult {
38
- content: Array<{
39
- type: "text";
40
- text: string;
41
- }>;
42
- isError?: boolean;
43
- }
44
- export declare const INPUT_SCHEMA: {
45
- readonly type: "object";
46
- readonly properties: {
47
- readonly question: {
48
- readonly type: "string";
49
- readonly minLength: 1;
50
- readonly maxLength: 2000;
51
- };
52
- readonly top_k: {
53
- readonly type: "integer";
54
- readonly minimum: 1;
55
- readonly maximum: 20;
56
- readonly default: 8;
57
- };
58
- readonly max_tokens: {
59
- readonly type: "integer";
60
- readonly minimum: 64;
61
- readonly maximum: 8192;
62
- readonly default: 1500;
63
- };
64
- readonly provider: {
65
- readonly type: "string";
66
- };
67
- readonly model: {
68
- readonly type: "string";
69
- };
70
- readonly temperature: {
71
- readonly type: "number";
72
- readonly minimum: 0;
73
- readonly maximum: 1;
74
- };
75
- readonly no_citations: {
76
- readonly type: "boolean";
77
- readonly default: false;
78
- };
79
- };
80
- readonly required: readonly ["question"];
81
- readonly additionalProperties: false;
82
- };
83
- interface ParsedInput {
84
- question: string;
85
- topK?: number;
86
- maxTokens?: number;
87
- provider?: string;
88
- model?: string;
89
- temperature?: number;
90
- noCitations: boolean;
91
- }
92
- export declare function parseInput(input: unknown): ParsedInput;
93
- export declare const noxMemAnswerTool: McpToolDefinition;
94
- export default noxMemAnswerTool;
@@ -1,152 +0,0 @@
1
- /**
2
- * T14 — MCP tools `archive_export` + `archive_import`.
3
- *
4
- * Adds 2 tools to the existing 16 → 18 MCP tools served by nox-mem.
5
- * Schema follows the MCP convention: name, description, inputSchema (JSON
6
- * Schema draft-07-ish), result type. The MCP server in the parent repo wires
7
- * these into its registry.
8
- *
9
- * Security:
10
- * - `passphrase` parameter accepted ONLY when the MCP transport is
11
- * authenticated (stdio over OS pipe, OR HTTPS). Parent server enforces
12
- * transport-level auth; this module does not re-validate.
13
- * - `passphrase_env` is the preferred parameter — the MCP server expands it
14
- * from its own process env, never the client's argv.
15
- */
16
- import { ExportRequest } from "../../lib/archive/orchestrator.js";
17
- import { ChunkRow, KgEntityRow, KgRelationRow, OpsAuditRow } from "../../lib/archive/types.js";
18
- export declare const archiveExportToolSchema: {
19
- readonly name: "archive_export";
20
- readonly description: string;
21
- readonly inputSchema: {
22
- readonly type: "object";
23
- readonly properties: {
24
- readonly unencrypted: {
25
- readonly type: "boolean";
26
- readonly default: false;
27
- };
28
- readonly passphrase: {
29
- readonly type: "string";
30
- readonly description: string;
31
- };
32
- readonly passphrase_env: {
33
- readonly type: "string";
34
- readonly description: string;
35
- };
36
- readonly project: {
37
- readonly type: "string";
38
- };
39
- readonly since: {
40
- readonly type: "string";
41
- readonly format: "date-time";
42
- };
43
- readonly until: {
44
- readonly type: "string";
45
- readonly format: "date-time";
46
- };
47
- readonly exclude_embeddings: {
48
- readonly type: "boolean";
49
- readonly default: false;
50
- };
51
- };
52
- };
53
- };
54
- export declare const archiveImportToolSchema: {
55
- readonly name: "archive_import";
56
- readonly description: string;
57
- readonly inputSchema: {
58
- readonly type: "object";
59
- readonly required: readonly ["archive_b64"];
60
- readonly properties: {
61
- readonly archive_b64: {
62
- readonly type: "string";
63
- readonly description: "Base64-encoded archive.";
64
- };
65
- readonly passphrase: {
66
- readonly type: "string";
67
- };
68
- readonly passphrase_env: {
69
- readonly type: "string";
70
- };
71
- readonly mode: {
72
- readonly enum: readonly ["merge", "replace"];
73
- readonly default: "merge";
74
- };
75
- readonly dry_run: {
76
- readonly type: "boolean";
77
- readonly default: false;
78
- };
79
- readonly verify_only: {
80
- readonly type: "boolean";
81
- readonly default: false;
82
- };
83
- };
84
- };
85
- };
86
- export interface ArchiveExportInput {
87
- unencrypted?: boolean;
88
- passphrase?: string;
89
- passphrase_env?: string;
90
- project?: string;
91
- since?: string;
92
- until?: string;
93
- exclude_embeddings?: boolean;
94
- }
95
- export interface ArchiveImportInput {
96
- archive_b64: string;
97
- passphrase?: string;
98
- passphrase_env?: string;
99
- mode?: "merge" | "replace";
100
- dry_run?: boolean;
101
- verify_only?: boolean;
102
- }
103
- export interface ArchiveExportResult {
104
- success: true;
105
- archive_b64: string;
106
- bytes: number;
107
- encrypted: boolean;
108
- manifest: {
109
- schema_version: number;
110
- counts: import("../../lib/archive/types.js").ManifestCounts;
111
- created_at: string;
112
- };
113
- duration_ms: number;
114
- }
115
- export interface ArchiveExportError {
116
- success: false;
117
- error: string;
118
- code?: string;
119
- }
120
- export interface ArchiveImportResult {
121
- success: true;
122
- encrypted: boolean;
123
- applied: boolean;
124
- schema_version_archive: number;
125
- schema_version_target: number;
126
- stats: import("../../lib/archive/orchestrator.js").ImportResult["stats"];
127
- duration_ms: number;
128
- }
129
- export interface ArchiveImportError {
130
- success: false;
131
- error: string;
132
- code?: string;
133
- }
134
- export interface McpExportDeps {
135
- dbReader: () => Promise<Omit<ExportRequest, "passphrase" | "unencrypted" | "signal" | "onProgress">>;
136
- env?: NodeJS.ProcessEnv;
137
- signal?: AbortSignal;
138
- }
139
- export declare function archiveExportTool(input: ArchiveExportInput, deps: McpExportDeps): Promise<ArchiveExportResult | ArchiveExportError>;
140
- export interface McpImportDeps {
141
- loadExisting: () => Promise<{
142
- chunks: ChunkRow[];
143
- kg_entities: KgEntityRow[];
144
- kg_relations: KgRelationRow[];
145
- ops_audit: OpsAuditRow[];
146
- }>;
147
- currentSchemaVersion: () => Promise<number>;
148
- persist?: (resolved: import("../../lib/archive/orchestrator.js").ImportResult["resolved"]) => Promise<void>;
149
- env?: NodeJS.ProcessEnv;
150
- signal?: AbortSignal;
151
- }
152
- export declare function archiveImportTool(input: ArchiveImportInput, deps: McpImportDeps): Promise<ArchiveImportResult | ArchiveImportError>;
@@ -1,170 +0,0 @@
1
- /**
2
- * T14 — MCP tools `archive_export` + `archive_import`.
3
- *
4
- * Adds 2 tools to the existing 16 → 18 MCP tools served by nox-mem.
5
- * Schema follows the MCP convention: name, description, inputSchema (JSON
6
- * Schema draft-07-ish), result type. The MCP server in the parent repo wires
7
- * these into its registry.
8
- *
9
- * Security:
10
- * - `passphrase` parameter accepted ONLY when the MCP transport is
11
- * authenticated (stdio over OS pipe, OR HTTPS). Parent server enforces
12
- * transport-level auth; this module does not re-validate.
13
- * - `passphrase_env` is the preferred parameter — the MCP server expands it
14
- * from its own process env, never the client's argv.
15
- */
16
- import { runExport, runImport, } from "../../lib/archive/orchestrator.js";
17
- // -- JSON Schemas -------------------------------------------------------------
18
- export const archiveExportToolSchema = {
19
- name: "archive_export",
20
- description: "Export nox-mem memory state to a portable .tgz archive. Encrypt-by-default (D41 #2). " +
21
- "Returns archive bytes base64 + manifest summary.",
22
- inputSchema: {
23
- type: "object",
24
- properties: {
25
- unencrypted: { type: "boolean", default: false },
26
- passphrase: {
27
- type: "string",
28
- description: "Passphrase for AES-256-GCM. Required unless unencrypted=true. " +
29
- "PREFER passphrase_env for automation.",
30
- },
31
- passphrase_env: {
32
- type: "string",
33
- description: "Name of an env var on the MCP server process containing the passphrase. " +
34
- "Server reads it; the value never crosses the wire.",
35
- },
36
- project: { type: "string" },
37
- since: { type: "string", format: "date-time" },
38
- until: { type: "string", format: "date-time" },
39
- exclude_embeddings: { type: "boolean", default: false },
40
- },
41
- },
42
- };
43
- export const archiveImportToolSchema = {
44
- name: "archive_import",
45
- description: "Import a nox-mem archive. Auto-detects encryption via manifest. " +
46
- "Validates schema version + checksums BEFORE writing.",
47
- inputSchema: {
48
- type: "object",
49
- required: ["archive_b64"],
50
- properties: {
51
- archive_b64: { type: "string", description: "Base64-encoded archive." },
52
- passphrase: { type: "string" },
53
- passphrase_env: { type: "string" },
54
- mode: { enum: ["merge", "replace"], default: "merge" },
55
- dry_run: { type: "boolean", default: false },
56
- verify_only: { type: "boolean", default: false },
57
- },
58
- },
59
- };
60
- export async function archiveExportTool(input, deps) {
61
- const env = deps.env ?? process.env;
62
- let passphrase = input.passphrase;
63
- if (input.passphrase_env) {
64
- const v = env[input.passphrase_env];
65
- if (typeof v !== "string" || v.length === 0) {
66
- return {
67
- success: false,
68
- error: `passphrase_env ${input.passphrase_env} not set on server`,
69
- code: "MISSING_ENV",
70
- };
71
- }
72
- passphrase = v;
73
- }
74
- if (!input.unencrypted &&
75
- (typeof passphrase !== "string" || passphrase.length === 0)) {
76
- return {
77
- success: false,
78
- error: "passphrase required (D41 #2 encrypt-by-default) — pass passphrase or passphrase_env",
79
- code: "PASSPHRASE_REQUIRED",
80
- };
81
- }
82
- const corpus = await deps.dbReader();
83
- if (input.exclude_embeddings)
84
- corpus.embeddings = undefined;
85
- try {
86
- const out = await runExport({
87
- ...corpus,
88
- filters: {
89
- project: input.project ?? null,
90
- since: input.since ?? null,
91
- until: input.until ?? null,
92
- },
93
- unencrypted: input.unencrypted === true,
94
- passphrase,
95
- signal: deps.signal,
96
- });
97
- return {
98
- success: true,
99
- archive_b64: out.archive.toString("base64"),
100
- bytes: out.size_bytes,
101
- encrypted: out.manifest.encryption.enabled,
102
- manifest: {
103
- schema_version: out.manifest.schema_version,
104
- counts: out.manifest.counts,
105
- created_at: out.manifest.created_at,
106
- },
107
- duration_ms: out.duration_ms,
108
- };
109
- }
110
- catch (err) {
111
- return {
112
- success: false,
113
- error: err.message,
114
- };
115
- }
116
- }
117
- export async function archiveImportTool(input, deps) {
118
- if (!input.archive_b64) {
119
- return { success: false, error: "archive_b64 required" };
120
- }
121
- const env = deps.env ?? process.env;
122
- let passphrase = input.passphrase;
123
- if (input.passphrase_env) {
124
- const v = env[input.passphrase_env];
125
- if (typeof v !== "string" || v.length === 0) {
126
- return {
127
- success: false,
128
- error: `passphrase_env ${input.passphrase_env} not set on server`,
129
- };
130
- }
131
- passphrase = v;
132
- }
133
- let archive;
134
- try {
135
- archive = Buffer.from(input.archive_b64, "base64");
136
- }
137
- catch (err) {
138
- return { success: false, error: `bad base64: ${err.message}` };
139
- }
140
- const existing = await deps.loadExisting();
141
- const currentSchemaVersion = await deps.currentSchemaVersion();
142
- const req = {
143
- archive,
144
- passphrase,
145
- mode: input.mode ?? "merge",
146
- dry_run: input.dry_run === true,
147
- verify_only: input.verify_only === true,
148
- current_schema_version: currentSchemaVersion,
149
- existing,
150
- signal: deps.signal,
151
- };
152
- try {
153
- const out = await runImport(req);
154
- if (!input.dry_run && !input.verify_only && deps.persist) {
155
- await deps.persist(out.resolved);
156
- }
157
- return {
158
- success: true,
159
- encrypted: out.manifest.encryption.enabled,
160
- applied: out.applied,
161
- schema_version_archive: out.manifest.schema_version,
162
- schema_version_target: currentSchemaVersion,
163
- stats: out.stats,
164
- duration_ms: out.duration_ms,
165
- };
166
- }
167
- catch (err) {
168
- return { success: false, error: err.message };
169
- }
170
- }
@@ -1,44 +0,0 @@
1
- /**
2
- * L2 T9 — MCP tools.
3
- *
4
- * Three tools exposed to MCP clients (e.g. Claude Code, agents):
5
- * - conflict_scan → triggers a detection pass under current mode
6
- * - conflict_list → list audit rows by status
7
- * - conflict_resolve → write resolution (terminal status only)
8
- *
9
- * MCP write tools must be gated by `NOX_MCP_ALLOW_WRITES=1` per existing
10
- * pattern in nox-mem MCP server. `conflict_resolve` returns an
11
- * `mcp_write_disabled` error when the env var is unset.
12
- *
13
- * Tools return JSON payloads matching the HTTP API shapes for
14
- * consistency (see ../../api/conflict.ts).
15
- */
16
- import type { DBHandle } from "../../lib/conflict/db.js";
17
- import type { ConflictMode, ConflictStatus, ResolutionKind } from "../../lib/conflict/types.js";
18
- export interface ScanInput {
19
- min_confidence?: number;
20
- predicate_allowlist?: string[];
21
- mode_override?: ConflictMode;
22
- }
23
- export interface ListInput {
24
- status?: ConflictStatus;
25
- limit?: number;
26
- }
27
- export interface ResolveInput {
28
- id: number;
29
- kind: ResolutionKind;
30
- picked_relation_id?: number;
31
- merge_target?: string;
32
- notes?: string;
33
- actor?: string;
34
- }
35
- export interface ToolResult<T = unknown> {
36
- ok: boolean;
37
- data?: T;
38
- error?: string;
39
- /** Surface a structured detail object for clients to render. */
40
- detail?: Record<string, unknown>;
41
- }
42
- export declare function conflict_scan(db: DBHandle, input?: ScanInput): ToolResult;
43
- export declare function conflict_list(db: DBHandle, input?: ListInput): ToolResult;
44
- export declare function conflict_resolve(db: DBHandle, input: ResolveInput, env?: Record<string, string | undefined>): ToolResult;
@@ -1,130 +0,0 @@
1
- /**
2
- * L2 T9 — MCP tools.
3
- *
4
- * Three tools exposed to MCP clients (e.g. Claude Code, agents):
5
- * - conflict_scan → triggers a detection pass under current mode
6
- * - conflict_list → list audit rows by status
7
- * - conflict_resolve → write resolution (terminal status only)
8
- *
9
- * MCP write tools must be gated by `NOX_MCP_ALLOW_WRITES=1` per existing
10
- * pattern in nox-mem MCP server. `conflict_resolve` returns an
11
- * `mcp_write_disabled` error when the env var is unset.
12
- *
13
- * Tools return JSON payloads matching the HTTP API shapes for
14
- * consistency (see ../../api/conflict.ts).
15
- */
16
- import { getConflictById, listConflicts, updateConflictStatus, } from "../../lib/conflict/audit-writer.js";
17
- import { runConflictPass, resolveMode } from "../../lib/conflict/shadow.js";
18
- import { collectEvidence } from "../../lib/conflict/evidence.js";
19
- const VALID_STATUSES = [
20
- "open",
21
- "reviewed",
22
- "resolved_pick_one",
23
- "resolved_both_valid",
24
- "resolved_merged",
25
- "dismissed",
26
- ];
27
- const VALID_KINDS = ["pick_one", "both_valid", "merged", "dismissed"];
28
- export function conflict_scan(db, input = {}) {
29
- // Honor mode env unless explicit override. `disabled` short-circuits to
30
- // a successful no-op with zero counts (predictable).
31
- const mode = input.mode_override ?? resolveMode();
32
- const effective = mode === "disabled" ? "shadow" : mode;
33
- const result = runConflictPass(db, {
34
- min_confidence: input.min_confidence,
35
- predicate_allowlist: input.predicate_allowlist,
36
- }, effective);
37
- return { ok: true, data: result };
38
- }
39
- export function conflict_list(db, input = {}) {
40
- const status = input.status ?? "open";
41
- if (!VALID_STATUSES.includes(status)) {
42
- return { ok: false, error: "invalid_status", detail: { value: status } };
43
- }
44
- const limit = clampInt(input.limit ?? 20, 1, 500);
45
- const rows = listConflicts(db, status, limit);
46
- return { ok: true, data: { count: rows.length, rows } };
47
- }
48
- export function conflict_resolve(db, input, env = process.env) {
49
- if (env.NOX_MCP_ALLOW_WRITES !== "1") {
50
- return {
51
- ok: false,
52
- error: "mcp_write_disabled",
53
- detail: { hint: "set NOX_MCP_ALLOW_WRITES=1 to enable MCP write tools" },
54
- };
55
- }
56
- if (!Number.isFinite(input.id) || input.id <= 0) {
57
- return { ok: false, error: "invalid_id" };
58
- }
59
- if (!VALID_KINDS.includes(input.kind)) {
60
- return { ok: false, error: "invalid_kind", detail: { value: input.kind } };
61
- }
62
- const actor = input.actor ?? "mcp";
63
- let resolution;
64
- switch (input.kind) {
65
- case "pick_one":
66
- if (input.picked_relation_id == null) {
67
- return { ok: false, error: "picked_relation_id_required" };
68
- }
69
- resolution = {
70
- status: "resolved_pick_one",
71
- resolution_kind: "pick_one",
72
- resolved_by: actor,
73
- picked_relation_id: input.picked_relation_id,
74
- notes: input.notes,
75
- };
76
- break;
77
- case "both_valid":
78
- resolution = {
79
- status: "resolved_both_valid",
80
- resolution_kind: "both_valid",
81
- resolved_by: actor,
82
- notes: input.notes,
83
- };
84
- break;
85
- case "merged":
86
- if (!input.merge_target) {
87
- return { ok: false, error: "merge_target_required" };
88
- }
89
- resolution = {
90
- status: "resolved_merged",
91
- resolution_kind: "merged",
92
- resolved_by: actor,
93
- merge_target: input.merge_target,
94
- notes: input.notes,
95
- };
96
- break;
97
- case "dismissed":
98
- resolution = {
99
- status: "dismissed",
100
- resolution_kind: "dismissed",
101
- resolved_by: actor,
102
- notes: input.notes,
103
- };
104
- break;
105
- }
106
- try {
107
- updateConflictStatus(db, input.id, resolution);
108
- }
109
- catch (err) {
110
- return {
111
- ok: false,
112
- error: "resolution_failed",
113
- detail: { message: err.message },
114
- };
115
- }
116
- const row = getConflictById(db, input.id);
117
- if (!row)
118
- return { ok: false, error: "conflict_not_found", detail: { id: input.id } };
119
- const conflict = {
120
- kind: row.kind,
121
- subject_entity_id: row.subject_entity_id,
122
- predicate: row.predicate,
123
- variants: row.variants,
124
- };
125
- const evidence = collectEvidence(db, conflict);
126
- return { ok: true, data: { row, evidence } };
127
- }
128
- function clampInt(n, lo, hi) {
129
- return Math.max(lo, Math.min(hi, Math.floor(n)));
130
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * src/mcp/tools/hooks.ts — T13: MCP tool wrappers around the CLI/HTTP API.
3
- *
4
- * Exposes 4 tools to MCP clients (Claude Desktop, Claude Code, etc.):
5
- *
6
- * nox_hooks_status → { config, queue_depth }
7
- * nox_hooks_recent → { rows[] } (metadata only, no content)
8
- * nox_hooks_dryrun → { result, trace } (input: { text, role?, source? })
9
- * nox_hooks_stats → { last_24h, last_7d } (counters)
10
- *
11
- * Schema follows the Anthropic MCP spec (JSON schema for inputs/outputs).
12
- * Implementation defers to the same handlers as HTTP (T12) and CLI (T11)
13
- * to keep one source of truth per verb.
14
- */
15
- import { type HooksApiDeps } from "../../api/hooks.js";
16
- import { type HooksCliDeps } from "../../cli/hooks.js";
17
- export interface McpToolSchema {
18
- name: string;
19
- description: string;
20
- inputSchema: Record<string, unknown>;
21
- }
22
- export declare const HOOK_TOOLS: ReadonlyArray<McpToolSchema>;
23
- export interface McpDeps extends HooksApiDeps, Pick<HooksCliDeps, "readStats"> {
24
- }
25
- /** Dispatch a single MCP tool call by name. */
26
- export declare function callHookTool(name: string, args: Record<string, unknown>, deps: McpDeps): Promise<{
27
- ok: boolean;
28
- content: unknown;
29
- }>;