nox-mem 3.1.1 → 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 (397) 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 +1 -22
  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/privacy/__tests__/filter.test.js +352 -0
  39. package/dist/providers/__tests__/conformance-extended.test.js +249 -0
  40. package/dist/providers/__tests__/conformance.test.js +98 -0
  41. package/dist/providers/__tests__/cost-cap.test.js +151 -0
  42. package/dist/providers/__tests__/e2e-real.test.js +79 -0
  43. package/dist/providers/__tests__/factory.test.js +80 -0
  44. package/dist/providers/__tests__/fallback.test.js +223 -0
  45. package/dist/providers/__tests__/gemini.test.js +191 -0
  46. package/dist/providers/__tests__/health.test.js +128 -0
  47. package/dist/providers/__tests__/telemetry.test.js +219 -0
  48. package/dist/reindex.js +2 -2
  49. package/package.json +3 -4
  50. package/dist/api/answer.d.ts +0 -116
  51. package/dist/api/answer.validate-patch.d.ts +0 -72
  52. package/dist/api/brief-diversity.d.ts +0 -64
  53. package/dist/api/brief.d.ts +0 -114
  54. package/dist/api/conflict.d.ts +0 -33
  55. package/dist/api/conflict.js +0 -143
  56. package/dist/api/cors.d.ts +0 -73
  57. package/dist/api/events-stream-limited.d.ts +0 -133
  58. package/dist/api/events-stream-limited.js +0 -217
  59. package/dist/api/events-stream.d.ts +0 -53
  60. package/dist/api/events-stream.js +0 -125
  61. package/dist/api/export.d.ts +0 -42
  62. package/dist/api/export.js +0 -85
  63. package/dist/api/health-confidence-adapter.d.ts +0 -29
  64. package/dist/api/health-confidence-adapter.js +0 -73
  65. package/dist/api/health-confidence.d.ts +0 -36
  66. package/dist/api/health-confidence.js +0 -141
  67. package/dist/api/hooks.d.ts +0 -50
  68. package/dist/api/hooks.js +0 -115
  69. package/dist/api/import.d.ts +0 -38
  70. package/dist/api/import.js +0 -87
  71. package/dist/api/ingest-event.d.ts +0 -65
  72. package/dist/api/mark.d.ts +0 -42
  73. package/dist/api/mark.js +0 -127
  74. package/dist/api/server-deps-a2.d.ts +0 -55
  75. package/dist/api/server-deps-a2.js +0 -138
  76. package/dist/api/server-deps-l2-l3.d.ts +0 -68
  77. package/dist/api/server-deps-l2-l3.js +0 -123
  78. package/dist/api/server-deps-p1.d.ts +0 -84
  79. package/dist/api/server-deps-p2.d.ts +0 -32
  80. package/dist/api/server-deps-p2.js +0 -84
  81. package/dist/api/server-deps-p5.d.ts +0 -66
  82. package/dist/api/server-deps-p5.js +0 -139
  83. package/dist/api/viewer-static.d.ts +0 -30
  84. package/dist/api/viewer-static.js +0 -102
  85. package/dist/api/wire-up.d.ts +0 -54
  86. package/dist/api-impact.d.ts +0 -30
  87. package/dist/api-server.d.ts +0 -2
  88. package/dist/backfill-fts-anchor.d.ts +0 -15
  89. package/dist/backfill-source-type.d.ts +0 -20
  90. package/dist/churn.d.ts +0 -31
  91. package/dist/cli/answer.d.ts +0 -66
  92. package/dist/cli/conflict.d.ts +0 -38
  93. package/dist/cli/conflict.js +0 -282
  94. package/dist/cli/export.d.ts +0 -51
  95. package/dist/cli/export.js +0 -280
  96. package/dist/cli/hooks.d.ts +0 -54
  97. package/dist/cli/hooks.js +0 -133
  98. package/dist/cli/import.d.ts +0 -52
  99. package/dist/cli/import.js +0 -274
  100. package/dist/cli/mark.d.ts +0 -33
  101. package/dist/cli/mark.js +0 -130
  102. package/dist/cli/ocr-batch.d.ts +0 -12
  103. package/dist/cli/ocr-batch.js +0 -411
  104. package/dist/cli/snapshot-main.d.ts +0 -30
  105. package/dist/cli/snapshot-main.js +0 -47
  106. package/dist/cli/viewer.d.ts +0 -35
  107. package/dist/cli/viewer.js +0 -71
  108. package/dist/cli-telemetry.d.ts +0 -36
  109. package/dist/cli-telemetry.js +0 -150
  110. package/dist/compact.d.ts +0 -7
  111. package/dist/consolidate.d.ts +0 -18
  112. package/dist/consolidation.d.ts +0 -32
  113. package/dist/cross-agent-v2.d.ts +0 -45
  114. package/dist/cross-search.d.ts +0 -11
  115. package/dist/crystallize.d.ts +0 -43
  116. package/dist/db.d.ts +0 -11
  117. package/dist/dedup.d.ts +0 -1
  118. package/dist/detect-changes.d.ts +0 -29
  119. package/dist/digest.d.ts +0 -1
  120. package/dist/doctor.d.ts +0 -1
  121. package/dist/embed.d.ts +0 -57
  122. package/dist/evals.d.ts +0 -176
  123. package/dist/evals.js +0 -351
  124. package/dist/generate-user-profile.d.ts +0 -18
  125. package/dist/graphify-ingest.d.ts +0 -18
  126. package/dist/impact.d.ts +0 -39
  127. package/dist/index.d.ts +0 -2
  128. package/dist/ingest-entity.d.ts +0 -44
  129. package/dist/ingest.d.ts +0 -13
  130. package/dist/kg-llm.d.ts +0 -39
  131. package/dist/knowledge-graph.d.ts +0 -72
  132. package/dist/lib/answer/config.d.ts +0 -41
  133. package/dist/lib/answer/index.d.ts +0 -47
  134. package/dist/lib/answer/prompt.d.ts +0 -37
  135. package/dist/lib/answer/provider.d.ts +0 -47
  136. package/dist/lib/answer/retrieval.d.ts +0 -36
  137. package/dist/lib/answer/telemetry.d.ts +0 -99
  138. package/dist/lib/answer/types.d.ts +0 -108
  139. package/dist/lib/api/error-leak-fix.d.ts +0 -54
  140. package/dist/lib/api/safe-error-message.d.ts +0 -70
  141. package/dist/lib/archive/common-passwords.d.ts +0 -37
  142. package/dist/lib/archive/common-passwords.js +0 -753
  143. package/dist/lib/archive/encryption.d.ts +0 -81
  144. package/dist/lib/archive/encryption.js +0 -236
  145. package/dist/lib/archive/enforce-strength.d.ts +0 -54
  146. package/dist/lib/archive/enforce-strength.js +0 -70
  147. package/dist/lib/archive/entropy.d.ts +0 -34
  148. package/dist/lib/archive/entropy.js +0 -180
  149. package/dist/lib/archive/export-locking.d.ts +0 -102
  150. package/dist/lib/archive/export-locking.js +0 -202
  151. package/dist/lib/archive/format.d.ts +0 -20
  152. package/dist/lib/archive/format.js +0 -174
  153. package/dist/lib/archive/index.d.ts +0 -23
  154. package/dist/lib/archive/index.js +0 -17
  155. package/dist/lib/archive/manifest.d.ts +0 -53
  156. package/dist/lib/archive/manifest.js +0 -183
  157. package/dist/lib/archive/migration.d.ts +0 -36
  158. package/dist/lib/archive/migration.js +0 -100
  159. package/dist/lib/archive/migrations/v18_to_v19.d.ts +0 -16
  160. package/dist/lib/archive/migrations/v18_to_v19.js +0 -18
  161. package/dist/lib/archive/orchestrator.d.ts +0 -166
  162. package/dist/lib/archive/orchestrator.js +0 -428
  163. package/dist/lib/archive/serializers/chunks.d.ts +0 -30
  164. package/dist/lib/archive/serializers/chunks.js +0 -113
  165. package/dist/lib/archive/serializers/embeddings.d.ts +0 -36
  166. package/dist/lib/archive/serializers/embeddings.js +0 -115
  167. package/dist/lib/archive/serializers/kg.d.ts +0 -28
  168. package/dist/lib/archive/serializers/kg.js +0 -184
  169. package/dist/lib/archive/serializers/ops_audit.d.ts +0 -21
  170. package/dist/lib/archive/serializers/ops_audit.js +0 -97
  171. package/dist/lib/archive/server-deps.d.ts +0 -131
  172. package/dist/lib/archive/server-deps.js +0 -232
  173. package/dist/lib/archive/strength.d.ts +0 -50
  174. package/dist/lib/archive/strength.js +0 -77
  175. package/dist/lib/archive/types.d.ts +0 -159
  176. package/dist/lib/archive/types.js +0 -45
  177. package/dist/lib/archive/unpack-streaming.d.ts +0 -70
  178. package/dist/lib/archive/unpack-streaming.js +0 -255
  179. package/dist/lib/auth/localhost-guard.d.ts +0 -106
  180. package/dist/lib/confidence/config.d.ts +0 -37
  181. package/dist/lib/confidence/config.js +0 -107
  182. package/dist/lib/confidence/db-shim-singleton.d.ts +0 -20
  183. package/dist/lib/confidence/db-shim-singleton.js +0 -41
  184. package/dist/lib/confidence/db-shim.d.ts +0 -47
  185. package/dist/lib/confidence/db-shim.js +0 -141
  186. package/dist/lib/confidence/mark.d.ts +0 -58
  187. package/dist/lib/confidence/mark.js +0 -168
  188. package/dist/lib/confidence/ranking.d.ts +0 -69
  189. package/dist/lib/confidence/ranking.js +0 -101
  190. package/dist/lib/confidence/search-filter.d.ts +0 -44
  191. package/dist/lib/confidence/search-filter.js +0 -103
  192. package/dist/lib/confidence/types.d.ts +0 -146
  193. package/dist/lib/confidence/types.js +0 -20
  194. package/dist/lib/confidence/write-hooks.d.ts +0 -50
  195. package/dist/lib/confidence/write-hooks.js +0 -159
  196. package/dist/lib/conflict/audit-fk-check.d.ts +0 -72
  197. package/dist/lib/conflict/audit-fk-check.js +0 -131
  198. package/dist/lib/conflict/audit-writer.d.ts +0 -39
  199. package/dist/lib/conflict/audit-writer.js +0 -133
  200. package/dist/lib/conflict/db-singleton.d.ts +0 -28
  201. package/dist/lib/conflict/db-singleton.js +0 -61
  202. package/dist/lib/conflict/db.d.ts +0 -27
  203. package/dist/lib/conflict/db.js +0 -20
  204. package/dist/lib/conflict/detector-direct.d.ts +0 -21
  205. package/dist/lib/conflict/detector-direct.js +0 -105
  206. package/dist/lib/conflict/evidence.d.ts +0 -24
  207. package/dist/lib/conflict/evidence.js +0 -76
  208. package/dist/lib/conflict/index.d.ts +0 -14
  209. package/dist/lib/conflict/index.js +0 -12
  210. package/dist/lib/conflict/scheduler.d.ts +0 -78
  211. package/dist/lib/conflict/scheduler.js +0 -111
  212. package/dist/lib/conflict/shadow.d.ts +0 -75
  213. package/dist/lib/conflict/shadow.js +0 -161
  214. package/dist/lib/conflict/types.d.ts +0 -133
  215. package/dist/lib/conflict/types.js +0 -19
  216. package/dist/lib/cost-cap.d.ts +0 -94
  217. package/dist/lib/deps/deps-registry.d.ts +0 -111
  218. package/dist/lib/error-sanitizer/middleware.d.ts +0 -43
  219. package/dist/lib/error-sanitizer/sanitize.d.ts +0 -78
  220. package/dist/lib/eval-batch.d.ts +0 -34
  221. package/dist/lib/eval-batch.js +0 -103
  222. package/dist/lib/eval-metrics.d.ts +0 -36
  223. package/dist/lib/eval-metrics.js +0 -95
  224. package/dist/lib/eval.d.ts +0 -106
  225. package/dist/lib/eval.js +0 -343
  226. package/dist/lib/events/bus.d.ts +0 -135
  227. package/dist/lib/fts-anchor.d.ts +0 -1
  228. package/dist/lib/hooks/classifier.d.ts +0 -47
  229. package/dist/lib/hooks/classifier.js +0 -129
  230. package/dist/lib/hooks/config.d.ts +0 -49
  231. package/dist/lib/hooks/config.js +0 -106
  232. package/dist/lib/hooks/decorators.d.ts +0 -35
  233. package/dist/lib/hooks/decorators.js +0 -59
  234. package/dist/lib/hooks/pipeline.d.ts +0 -76
  235. package/dist/lib/hooks/pipeline.js +0 -213
  236. package/dist/lib/hooks/privacy-filter-adapter.d.ts +0 -55
  237. package/dist/lib/hooks/privacy-filter-adapter.js +0 -84
  238. package/dist/lib/hooks/rate-limit-constant-time.d.ts +0 -57
  239. package/dist/lib/hooks/rate-limit-constant-time.js +0 -69
  240. package/dist/lib/hooks/rate-limit-dryrun-fix.d.ts +0 -71
  241. package/dist/lib/hooks/rate-limit-dryrun-fix.js +0 -110
  242. package/dist/lib/hooks/rate-limit.d.ts +0 -54
  243. package/dist/lib/hooks/rate-limit.js +0 -122
  244. package/dist/lib/hooks/server-deps.d.ts +0 -61
  245. package/dist/lib/hooks/server-deps.js +0 -92
  246. package/dist/lib/hooks/source-allowlist.d.ts +0 -26
  247. package/dist/lib/hooks/source-allowlist.js +0 -53
  248. package/dist/lib/hooks/types.d.ts +0 -129
  249. package/dist/lib/hooks/types.js +0 -24
  250. package/dist/lib/hooks/worker.d.ts +0 -56
  251. package/dist/lib/hooks/worker.js +0 -150
  252. package/dist/lib/ingest-router.d.ts +0 -25
  253. package/dist/lib/ocr-detector.d.ts +0 -61
  254. package/dist/lib/ocr-detector.js +0 -138
  255. package/dist/lib/ocr-engine-stub.d.ts +0 -48
  256. package/dist/lib/ocr-engine-stub.js +0 -190
  257. package/dist/lib/ocr-engines/google-doc-ai.d.ts +0 -36
  258. package/dist/lib/ocr-engines/google-doc-ai.js +0 -164
  259. package/dist/lib/ocr-jobs.d.ts +0 -67
  260. package/dist/lib/ocr-jobs.js +0 -129
  261. package/dist/lib/op-audit-extension/ran-at-guard.d.ts +0 -86
  262. package/dist/lib/op-audit.d.ts +0 -71
  263. package/dist/lib/privacy-br/detector.d.ts +0 -42
  264. package/dist/lib/privacy-br/detector.js +0 -130
  265. package/dist/lib/privacy-br/index.d.ts +0 -20
  266. package/dist/lib/privacy-br/index.js +0 -20
  267. package/dist/lib/privacy-br/integration.d.ts +0 -71
  268. package/dist/lib/privacy-br/integration.js +0 -74
  269. package/dist/lib/privacy-br/patterns.d.ts +0 -117
  270. package/dist/lib/privacy-br/patterns.js +0 -434
  271. package/dist/lib/privacy-br/redact.d.ts +0 -42
  272. package/dist/lib/privacy-br/redact.js +0 -103
  273. package/dist/lib/privacy-br/types.d.ts +0 -55
  274. package/dist/lib/privacy-br/types.js +0 -25
  275. package/dist/lib/regex-extract/extractor.d.ts +0 -30
  276. package/dist/lib/regex-extract/frontmatter.d.ts +0 -44
  277. package/dist/lib/regex-extract/index.d.ts +0 -14
  278. package/dist/lib/regex-extract/ingest-router-l4.d.ts +0 -76
  279. package/dist/lib/regex-extract/patterns.d.ts +0 -61
  280. package/dist/lib/regex-extract/production-wire.d.ts +0 -128
  281. package/dist/lib/regex-extract/reconcile.d.ts +0 -162
  282. package/dist/lib/regex-extract/strip-code.d.ts +0 -24
  283. package/dist/lib/regex-extract/types.d.ts +0 -48
  284. package/dist/lib/reranker.d.ts +0 -80
  285. package/dist/lib/shadow-tracker.d.ts +0 -191
  286. package/dist/lib/shadow-tracker.js +0 -384
  287. package/dist/lib/spo-injection.d.ts +0 -52
  288. package/dist/lib/telemetry-collector.d.ts +0 -158
  289. package/dist/lib/telemetry-collector.js +0 -249
  290. package/dist/lib/temporal-detector.d.ts +0 -27
  291. package/dist/lib/viewer/auth.d.ts +0 -37
  292. package/dist/lib/viewer/auth.js +0 -70
  293. package/dist/lib/viewer/backpressure.d.ts +0 -59
  294. package/dist/lib/viewer/backpressure.js +0 -100
  295. package/dist/lib/viewer/broadcast-singleton.d.ts +0 -34
  296. package/dist/lib/viewer/broadcast-singleton.js +0 -49
  297. package/dist/lib/viewer/broadcast.d.ts +0 -66
  298. package/dist/lib/viewer/broadcast.js +0 -96
  299. package/dist/lib/viewer/event-types.d.ts +0 -132
  300. package/dist/lib/viewer/event-types.js +0 -74
  301. package/dist/lib/viewer/instrumentation.d.ts +0 -106
  302. package/dist/lib/viewer/instrumentation.js +0 -224
  303. package/dist/lib/viewer/migration.d.ts +0 -23
  304. package/dist/lib/viewer/migration.js +0 -56
  305. package/dist/lib/viewer/redaction.d.ts +0 -44
  306. package/dist/lib/viewer/redaction.js +0 -139
  307. package/dist/lib/viewer/session.d.ts +0 -51
  308. package/dist/lib/viewer/session.js +0 -87
  309. package/dist/mcp/tools/answer.d.ts +0 -94
  310. package/dist/mcp/tools/archive.d.ts +0 -152
  311. package/dist/mcp/tools/archive.js +0 -170
  312. package/dist/mcp/tools/conflict.d.ts +0 -44
  313. package/dist/mcp/tools/conflict.js +0 -130
  314. package/dist/mcp/tools/hooks.d.ts +0 -29
  315. package/dist/mcp/tools/hooks.js +0 -78
  316. package/dist/mcp/tools/mark.d.ts +0 -38
  317. package/dist/mcp/tools/mark.js +0 -82
  318. package/dist/mcp/tools/viewer.d.ts +0 -58
  319. package/dist/mcp/tools/viewer.js +0 -64
  320. package/dist/mcp-server.d.ts +0 -2
  321. package/dist/metrics.d.ts +0 -3
  322. package/dist/noise-filter.d.ts +0 -18
  323. package/dist/notion-sync.d.ts +0 -7
  324. package/dist/notion-sync.js +0 -97
  325. package/dist/observability/adapters/a3-adapter.d.ts +0 -63
  326. package/dist/observability/adapters/a3-adapter.js +0 -83
  327. package/dist/observability/adapters/p1-adapter.d.ts +0 -49
  328. package/dist/observability/adapters/p1-adapter.js +0 -63
  329. package/dist/observability/adapters/p5-adapter.d.ts +0 -36
  330. package/dist/observability/adapters/p5-adapter.js +0 -71
  331. package/dist/observability/cardinality.d.ts +0 -61
  332. package/dist/observability/cardinality.js +0 -300
  333. package/dist/observability/collectors/db-stats.collector.d.ts +0 -9
  334. package/dist/observability/collectors/db-stats.collector.js +0 -88
  335. package/dist/observability/collectors/eventbus.collector.d.ts +0 -6
  336. package/dist/observability/collectors/eventbus.collector.js +0 -50
  337. package/dist/observability/collectors/process.collector.d.ts +0 -7
  338. package/dist/observability/collectors/process.collector.js +0 -93
  339. package/dist/observability/collectors/provider-telemetry.collector.d.ts +0 -11
  340. package/dist/observability/collectors/provider-telemetry.collector.js +0 -112
  341. package/dist/observability/collectors/search-telemetry.collector.d.ts +0 -12
  342. package/dist/observability/collectors/search-telemetry.collector.js +0 -76
  343. package/dist/observability/exporter.d.ts +0 -30
  344. package/dist/observability/exporter.js +0 -182
  345. package/dist/observability/index.d.ts +0 -22
  346. package/dist/observability/index.js +0 -21
  347. package/dist/observability/metrics.d.ts +0 -53
  348. package/dist/observability/metrics.js +0 -213
  349. package/dist/observability/privacy-guard.d.ts +0 -32
  350. package/dist/observability/privacy-guard.js +0 -116
  351. package/dist/observability/record.d.ts +0 -83
  352. package/dist/observability/record.js +0 -217
  353. package/dist/observability/registry.d.ts +0 -60
  354. package/dist/observability/registry.js +0 -93
  355. package/dist/observability/types.d.ts +0 -115
  356. package/dist/observability/types.js +0 -235
  357. package/dist/observability.d.ts +0 -131
  358. package/dist/plugins/nox-hooks/index.d.ts +0 -61
  359. package/dist/plugins/nox-hooks/index.js +0 -99
  360. package/dist/primer.d.ts +0 -1
  361. package/dist/privacy/filter.d.ts +0 -27
  362. package/dist/privacy/patterns.d.ts +0 -29
  363. package/dist/privacy/tag-parser.d.ts +0 -24
  364. package/dist/project-context-gen.d.ts +0 -10
  365. package/dist/providers/embedding/gemini.d.ts +0 -73
  366. package/dist/providers/embedding/openai.d.ts +0 -76
  367. package/dist/providers/embedding/types.d.ts +0 -39
  368. package/dist/providers/embedding/voyage.d.ts +0 -36
  369. package/dist/providers/index.d.ts +0 -116
  370. package/dist/providers/llm/anthropic.d.ts +0 -29
  371. package/dist/providers/llm/chain.d.ts +0 -99
  372. package/dist/providers/llm/gemini.d.ts +0 -48
  373. package/dist/providers/llm/openai.d.ts +0 -64
  374. package/dist/providers/llm/types.d.ts +0 -47
  375. package/dist/providers/telemetry.d.ts +0 -87
  376. package/dist/providers/types.d.ts +0 -42
  377. package/dist/query-entity-count.d.ts +0 -54
  378. package/dist/reflect.d.ts +0 -26
  379. package/dist/reindex-errors.d.ts +0 -7
  380. package/dist/reindex.d.ts +0 -16
  381. package/dist/retention.d.ts +0 -40
  382. package/dist/salience.d.ts +0 -85
  383. package/dist/scripts/migrate-v17-ops-audit.d.ts +0 -17
  384. package/dist/search-dedup.d.ts +0 -44
  385. package/dist/search-expansion.d.ts +0 -20
  386. package/dist/search.d.ts +0 -62
  387. package/dist/seh-detector.d.ts +0 -31
  388. package/dist/self-improve.d.ts +0 -1
  389. package/dist/session-distill.d.ts +0 -29
  390. package/dist/session-update.d.ts +0 -1
  391. package/dist/shared-memory.d.ts +0 -24
  392. package/dist/stats.d.ts +0 -1
  393. package/dist/temporal-retrieval.d.ts +0 -132
  394. package/dist/tier-manager.d.ts +0 -69
  395. package/dist/vectorize.d.ts +0 -16
  396. package/dist/version.d.ts +0 -1
  397. 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
- }>;