@remnic/core 9.3.719 → 9.3.721

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 (387) hide show
  1. package/dist/access-boundary.d.ts +10 -7
  2. package/dist/access-boundary.js +37 -34
  3. package/dist/access-cli.js +71 -66
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +11 -8
  6. package/dist/access-http.js +44 -41
  7. package/dist/access-mcp.d.ts +11 -8
  8. package/dist/access-mcp.js +40 -37
  9. package/dist/access-operations-batch.js +38 -35
  10. package/dist/access-operations.d.ts +11 -8
  11. package/dist/access-operations.js +39 -36
  12. package/dist/access-schema.d.ts +19 -19
  13. package/dist/access-schema.js +3 -3
  14. package/dist/{access-service-CZbnt0t2.d.ts → access-service-Dj3I-VBS.d.ts} +3 -3
  15. package/dist/access-service.d.ts +11 -8
  16. package/dist/access-service.js +36 -33
  17. package/dist/access-surface-catalog.d.ts +10 -7
  18. package/dist/action-confidence.d.ts +1 -1
  19. package/dist/active-memory-bridge.d.ts +1 -1
  20. package/dist/active-recall.d.ts +1 -1
  21. package/dist/active-recall.js +4 -2
  22. package/dist/active-recall.js.map +1 -1
  23. package/dist/adapters/index.js +7 -7
  24. package/dist/adapters/registry.js +3 -3
  25. package/dist/{auto-sync-24NNS3GU.js → auto-sync-F3KCSQFJ.js} +5 -5
  26. package/dist/behavior-learner.d.ts +1 -1
  27. package/dist/behavior-signals.d.ts +1 -1
  28. package/dist/bootstrap.d.ts +11 -8
  29. package/dist/briefing.d.ts +1 -1
  30. package/dist/briefing.js +12 -10
  31. package/dist/buffer-surprise-report.d.ts +1 -1
  32. package/dist/buffer.d.ts +1 -1
  33. package/dist/calibration.d.ts +1 -1
  34. package/dist/calibration.js +2 -2
  35. package/dist/capabilities.d.ts +30 -2
  36. package/dist/capabilities.js +3 -1
  37. package/dist/{catalog-CEYlMs9X.d.ts → catalog-F-OEVbRQ.d.ts} +1 -1
  38. package/dist/causal-behavior.d.ts +1 -1
  39. package/dist/causal-behavior.js +2 -2
  40. package/dist/causal-chain.js +2 -2
  41. package/dist/causal-consolidation.d.ts +1 -1
  42. package/dist/causal-consolidation.js +15 -13
  43. package/dist/causal-consolidation.js.map +1 -1
  44. package/dist/causal-retrieval.js +2 -2
  45. package/dist/causal-trajectory-graph.d.ts +4 -0
  46. package/dist/causal-trajectory-graph.js +2 -2
  47. package/dist/causal-trajectory.js +1 -1
  48. package/dist/{chunk-TH7WMHVK.js → chunk-3NN73CM7.js} +2 -2
  49. package/dist/{chunk-A5TUPZ3N.js → chunk-4SF232E6.js} +60 -30
  50. package/dist/chunk-4SF232E6.js.map +1 -0
  51. package/dist/{chunk-DGTDRIUO.js → chunk-4T3BMHKD.js} +2 -2
  52. package/dist/{chunk-EH27LHML.js → chunk-5O42UKXI.js} +2 -2
  53. package/dist/{chunk-KRGC4EDX.js → chunk-6FAMMBQ3.js} +2 -2
  54. package/dist/{chunk-FEB7W5JG.js → chunk-6OIDDKAA.js} +27 -6
  55. package/dist/chunk-6OIDDKAA.js.map +1 -0
  56. package/dist/{chunk-67HG7KFE.js → chunk-6YKIYQU7.js} +2 -2
  57. package/dist/{chunk-LXSG4L55.js → chunk-7CTNUVHZ.js} +2 -2
  58. package/dist/{chunk-UCJ5CDTK.js → chunk-A5XNBK2D.js} +22 -14
  59. package/dist/chunk-A5XNBK2D.js.map +1 -0
  60. package/dist/{chunk-7EEVXW7X.js → chunk-A7TJZLPK.js} +2 -2
  61. package/dist/{chunk-P5IPFZVH.js → chunk-B7WISIAJ.js} +5 -5
  62. package/dist/chunk-BCDKBDSY.js +173 -0
  63. package/dist/chunk-BCDKBDSY.js.map +1 -0
  64. package/dist/{chunk-JAKYZGV4.js → chunk-BXEOHV7K.js} +3 -3
  65. package/dist/chunk-C4X4QGIO.js +60 -0
  66. package/dist/chunk-C4X4QGIO.js.map +1 -0
  67. package/dist/{chunk-S3OPGGZB.js → chunk-D7EBTQ24.js} +2 -2
  68. package/dist/{chunk-IO5NQEGZ.js → chunk-DKT3X5C3.js} +2 -2
  69. package/dist/{chunk-PBH4JUAB.js → chunk-DVRHLN2O.js} +18 -3
  70. package/dist/chunk-DVRHLN2O.js.map +1 -0
  71. package/dist/{chunk-S35FX6MU.js → chunk-EBDA5TYA.js} +2 -2
  72. package/dist/{chunk-2PTBLS2S.js → chunk-EDOQM4E4.js} +2 -2
  73. package/dist/{chunk-YTZLBBEB.js → chunk-EEJMD2L2.js} +3 -3
  74. package/dist/{chunk-YGKUAX2B.js → chunk-EHQ5HO5T.js} +11 -11
  75. package/dist/chunk-EHQ5HO5T.js.map +1 -0
  76. package/dist/{chunk-JIZGYQYH.js → chunk-EM2LDXJ2.js} +4 -4
  77. package/dist/{chunk-YYOK4GVF.js → chunk-EVPNWN7Z.js} +10 -10
  78. package/dist/{chunk-HLIR3RJ7.js → chunk-EXUCUPV2.js} +2 -2
  79. package/dist/{chunk-F3PVXKHP.js → chunk-GDUOCHCD.js} +27 -21
  80. package/dist/chunk-GDUOCHCD.js.map +1 -0
  81. package/dist/{chunk-L5ASZA2F.js → chunk-GJSL4WG2.js} +17 -2
  82. package/dist/chunk-GJSL4WG2.js.map +1 -0
  83. package/dist/{chunk-2SXMCQEQ.js → chunk-GZQXOQQ2.js} +3 -3
  84. package/dist/{chunk-2KAYTPPT.js → chunk-HCVWF657.js} +12 -12
  85. package/dist/{chunk-N3DUH6OO.js → chunk-ILFSEIRT.js} +1 -1
  86. package/dist/chunk-ILFSEIRT.js.map +1 -0
  87. package/dist/{chunk-4KZGLDJJ.js → chunk-J3JPB7ZI.js} +2 -2
  88. package/dist/{chunk-3JJWNZTT.js → chunk-L2B3EE7B.js} +102 -42
  89. package/dist/chunk-L2B3EE7B.js.map +1 -0
  90. package/dist/{chunk-NFRBADNR.js → chunk-LA3HZKES.js} +610 -369
  91. package/dist/chunk-LA3HZKES.js.map +1 -0
  92. package/dist/{chunk-LQ6JI4VH.js → chunk-LD53WPMU.js} +4 -4
  93. package/dist/{chunk-URM3HW2R.js → chunk-LLUGAZ3B.js} +2 -2
  94. package/dist/{chunk-RVLB4E6N.js → chunk-MDBZTH7N.js} +5 -32
  95. package/dist/chunk-MDBZTH7N.js.map +1 -0
  96. package/dist/{chunk-U5H7WHTS.js → chunk-N77ELJ2D.js} +4 -4
  97. package/dist/{chunk-2VHMVWPU.js → chunk-NXRUUDUF.js} +2 -2
  98. package/dist/{chunk-DIFU33GU.js → chunk-OHTOPFRF.js} +2 -2
  99. package/dist/{chunk-74MYJSKB.js → chunk-ORAK3LNZ.js} +2 -2
  100. package/dist/{chunk-REWQAFSA.js → chunk-PD42EYQN.js} +2 -2
  101. package/dist/chunk-PHK3HARR.js +32 -0
  102. package/dist/chunk-PHK3HARR.js.map +1 -0
  103. package/dist/{chunk-773DPI6T.js → chunk-PKMQK2WY.js} +4 -4
  104. package/dist/{chunk-72VDBALG.js → chunk-QD6QP5P6.js} +63 -54
  105. package/dist/chunk-QD6QP5P6.js.map +1 -0
  106. package/dist/{chunk-CTOQEZSN.js → chunk-QR67FU5G.js} +2 -2
  107. package/dist/{chunk-AU7Q3LSC.js → chunk-RKNJBZ55.js} +7 -7
  108. package/dist/{chunk-YI7RZO7Y.js → chunk-SQNED75R.js} +1 -1
  109. package/dist/{chunk-5CEJH5ZN.js → chunk-TAPSNIMA.js} +4 -4
  110. package/dist/{chunk-IF362TF6.js → chunk-TQT3USCG.js} +2 -2
  111. package/dist/chunk-TQT3USCG.js.map +1 -0
  112. package/dist/{chunk-5RHM43BJ.js → chunk-TXQCG6SE.js} +3 -3
  113. package/dist/{chunk-ANI5DUAE.js → chunk-UIXXE6NI.js} +7 -7
  114. package/dist/{chunk-2COL35PK.js → chunk-UO5ZHIIH.js} +2 -2
  115. package/dist/{chunk-OJU73BUX.js → chunk-VCLGUIFM.js} +2 -2
  116. package/dist/{chunk-5J4OL7TJ.js → chunk-VUA4S7P6.js} +4 -4
  117. package/dist/{chunk-A66YRSOS.js → chunk-WQYSDPMA.js} +2 -2
  118. package/dist/chunk-XGTBNVIU.js +79 -0
  119. package/dist/chunk-XGTBNVIU.js.map +1 -0
  120. package/dist/{chunk-OZ2KQ7HF.js → chunk-YEE5KJQQ.js} +2 -2
  121. package/dist/chunk-YN2UN7N3.js +217 -0
  122. package/dist/chunk-YN2UN7N3.js.map +1 -0
  123. package/dist/{chunk-WRFKZEO6.js → chunk-YQGHW5ML.js} +4 -4
  124. package/dist/{chunk-APUJIMDM.js → chunk-Z4RU5VPM.js} +2 -2
  125. package/dist/{chunk-DCWIQFNA.js → chunk-ZUDM75KG.js} +4 -4
  126. package/dist/{cli-1orcdXOY.d.ts → cli-P_GaYcCY.d.ts} +3 -3
  127. package/dist/cli.d.ts +9 -6
  128. package/dist/cli.js +67 -63
  129. package/dist/compounding/engine.d.ts +1 -1
  130. package/dist/compounding/engine.js +12 -10
  131. package/dist/compounding/preference-consolidator.d.ts +1 -1
  132. package/dist/compression-optimizer.d.ts +1 -1
  133. package/dist/config.d.ts +1 -1
  134. package/dist/config.js +4 -2
  135. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  136. package/dist/connectors/codex-materialize-runner.js +12 -10
  137. package/dist/connectors/codex-materialize.d.ts +1 -1
  138. package/dist/connectors/index.d.ts +1 -1
  139. package/dist/connectors/index.js +13 -11
  140. package/dist/consolidation-provenance-check.d.ts +1 -1
  141. package/dist/consolidation-undo.d.ts +1 -1
  142. package/dist/contradiction/index.d.ts +1 -1
  143. package/dist/conversation-index/backend.d.ts +1 -1
  144. package/dist/conversation-index/backend.js +2 -2
  145. package/dist/conversation-index/chunker.d.ts +1 -1
  146. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  147. package/dist/conversation-index/indexer.d.ts +1 -1
  148. package/dist/conversation-index/search.d.ts +1 -1
  149. package/dist/day-summary.d.ts +1 -1
  150. package/dist/delinearize.d.ts +1 -1
  151. package/dist/direct-answer-wiring.d.ts +1 -1
  152. package/dist/direct-answer.d.ts +1 -1
  153. package/dist/embedding-fallback.d.ts +1 -1
  154. package/dist/enrichment/index.d.ts +1 -1
  155. package/dist/entity-retrieval.d.ts +1 -1
  156. package/dist/entity-retrieval.js +12 -10
  157. package/dist/entity-schema.d.ts +1 -1
  158. package/dist/explicit-capture.d.ts +11 -8
  159. package/dist/extraction-faithfulness.d.ts +8 -2
  160. package/dist/extraction-faithfulness.js +4 -3
  161. package/dist/extraction-judge-telemetry.d.ts +1 -1
  162. package/dist/extraction-judge-training.d.ts +1 -1
  163. package/dist/extraction-judge.d.ts +1 -1
  164. package/dist/extraction-judge.js +3 -3
  165. package/dist/extraction.d.ts +1 -1
  166. package/dist/extraction.js +5 -4
  167. package/dist/faithfulness-config.d.ts +55 -0
  168. package/dist/faithfulness-config.js +11 -0
  169. package/dist/faithfulness-config.js.map +1 -0
  170. package/dist/fallback-llm.d.ts +1 -1
  171. package/dist/fallback-llm.js +2 -2
  172. package/dist/{forget-U66KPDPY.js → forget-OEE5OELK.js} +2 -2
  173. package/dist/graph-dashboard-diff.d.ts +4 -0
  174. package/dist/graph-dashboard-key.d.ts +4 -0
  175. package/dist/graph-dashboard-parser.d.ts +4 -0
  176. package/dist/{graph-edge-decay-JLOF3YW4.js → graph-edge-decay-QPRJQ7DL.js} +3 -3
  177. package/dist/graph-edge-reinforcement.d.ts +4 -0
  178. package/dist/graph-snapshot.d.ts +7 -3
  179. package/dist/graph-snapshot.js +3 -3
  180. package/dist/graph.d.ts +7 -1
  181. package/dist/graph.js +2 -2
  182. package/dist/identity-continuity.d.ts +1 -1
  183. package/dist/importance.d.ts +1 -1
  184. package/dist/index.d.ts +571 -570
  185. package/dist/index.js +104 -99
  186. package/dist/index.js.map +1 -1
  187. package/dist/intent.d.ts +1 -1
  188. package/dist/lcm/engine.d.ts +1 -1
  189. package/dist/lcm/engine.js +2 -2
  190. package/dist/lcm/index.d.ts +1 -1
  191. package/dist/lcm/index.js +4 -4
  192. package/dist/lcm/tools.d.ts +1 -1
  193. package/dist/lifecycle.d.ts +1 -1
  194. package/dist/live-connectors-runner.d.ts +1 -1
  195. package/dist/local-llm.d.ts +1 -1
  196. package/dist/local-model-endpoint.d.ts +96 -0
  197. package/dist/local-model-endpoint.js +12 -0
  198. package/dist/local-model-endpoint.js.map +1 -0
  199. package/dist/maintenance/memory-governance.d.ts +1 -1
  200. package/dist/maintenance/memory-governance.js +12 -10
  201. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +12 -10
  202. package/dist/maintenance/rebuild-memory-projection.js +13 -11
  203. package/dist/mcp-memory-inspector-app.d.ts +11 -8
  204. package/dist/memory-action-policy.d.ts +1 -1
  205. package/dist/memory-cache.d.ts +1 -1
  206. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  207. package/dist/memory-projection-store.d.ts +1 -1
  208. package/dist/memory-provenance.d.ts +1 -1
  209. package/dist/memory-worth-outcomes.d.ts +1 -1
  210. package/dist/models-json.d.ts +1 -1
  211. package/dist/namespaces/migrate.d.ts +2 -2
  212. package/dist/namespaces/migrate.js +22 -20
  213. package/dist/namespaces/principal.d.ts +1 -1
  214. package/dist/namespaces/search.d.ts +1 -1
  215. package/dist/namespaces/search.js +9 -9
  216. package/dist/namespaces/storage.d.ts +2 -2
  217. package/dist/namespaces/storage.js +12 -10
  218. package/dist/native-knowledge.d.ts +1 -1
  219. package/dist/operator-toolkit.d.ts +3 -2
  220. package/dist/operator-toolkit.js +32 -28
  221. package/dist/orchestration/maintenance.d.ts +2 -2
  222. package/dist/orchestration/maintenance.js +14 -12
  223. package/dist/{orchestrator-kOxredSr.d.ts → orchestrator-f5xv19kp.d.ts} +178 -81
  224. package/dist/orchestrator.d.ts +8 -5
  225. package/dist/orchestrator.js +56 -52
  226. package/dist/patterns-cli.d.ts +1 -1
  227. package/dist/policy-runtime.d.ts +1 -1
  228. package/dist/provenance.d.ts +1 -1
  229. package/dist/provenance.js +2 -1
  230. package/dist/qmd-recall-cache.d.ts +1 -1
  231. package/dist/qmd.d.ts +1 -1
  232. package/dist/recall-disclosure-escalation.d.ts +1 -1
  233. package/dist/recall-explain-renderer.d.ts +1 -1
  234. package/dist/recall-explain-renderer.js +3 -3
  235. package/dist/recall-planner-llm.d.ts +1 -1
  236. package/dist/recall-planner-llm.js +2 -2
  237. package/dist/recall-state.d.ts +1 -1
  238. package/dist/recall-tag-filter.d.ts +1 -1
  239. package/dist/recall-xray-cli.d.ts +1 -1
  240. package/dist/recall-xray-cli.js +4 -4
  241. package/dist/recall-xray-renderer.d.ts +1 -1
  242. package/dist/recall-xray-renderer.js +3 -3
  243. package/dist/recall-xray.d.ts +18 -1
  244. package/dist/recall-xray.js +2 -2
  245. package/dist/resolve-auth-token.d.ts +1 -1
  246. package/dist/resume-bundles.js +5 -3
  247. package/dist/retrieval-agents.d.ts +1 -1
  248. package/dist/retrieval-tiers.d.ts +1 -1
  249. package/dist/routing/engine.d.ts +1 -1
  250. package/dist/routing/store.d.ts +1 -1
  251. package/dist/search/embed-helper.d.ts +1 -1
  252. package/dist/search/factory.d.ts +1 -1
  253. package/dist/search/factory.js +8 -8
  254. package/dist/search/index.d.ts +1 -1
  255. package/dist/search/index.js +14 -14
  256. package/dist/search/lancedb-backend.d.ts +1 -1
  257. package/dist/search/lancedb-backend.js +2 -2
  258. package/dist/search/meilisearch-backend.d.ts +1 -1
  259. package/dist/search/meilisearch-backend.js +2 -2
  260. package/dist/search/noop-backend.d.ts +1 -1
  261. package/dist/search/orama-backend.d.ts +1 -1
  262. package/dist/search/orama-backend.js +2 -2
  263. package/dist/search/port.d.ts +1 -1
  264. package/dist/search/remote-backend.d.ts +1 -1
  265. package/dist/{semantic-consolidation-B58v3S-a.d.ts → semantic-consolidation-BQm1e1Pn.d.ts} +1 -1
  266. package/dist/semantic-consolidation.d.ts +2 -2
  267. package/dist/semantic-consolidation.js +13 -11
  268. package/dist/semantic-rule-promotion.js +12 -10
  269. package/dist/semantic-rule-verifier.d.ts +1 -1
  270. package/dist/semantic-rule-verifier.js +12 -10
  271. package/dist/session-observer-bands.d.ts +1 -1
  272. package/dist/session-observer-state.d.ts +1 -1
  273. package/dist/shared-context/manager.d.ts +1 -1
  274. package/dist/signal.d.ts +1 -1
  275. package/dist/storage.d.ts +45 -1
  276. package/dist/storage.js +11 -9
  277. package/dist/summarizer.d.ts +1 -1
  278. package/dist/summarizer.js +3 -3
  279. package/dist/summary-snapshot.d.ts +1 -1
  280. package/dist/temporal-supersession.d.ts +1 -1
  281. package/dist/temporal-validity.d.ts +1 -1
  282. package/dist/threading.d.ts +1 -1
  283. package/dist/tier-migration.d.ts +1 -1
  284. package/dist/tier-routing.d.ts +1 -1
  285. package/dist/topics.d.ts +1 -1
  286. package/dist/transcript.d.ts +1 -1
  287. package/dist/transfer/backup.js +2 -2
  288. package/dist/transfer/capsule-export.js +2 -2
  289. package/dist/transfer/capsule-import.js +1 -1
  290. package/dist/trust-score-stage.d.ts +178 -0
  291. package/dist/trust-score-stage.js +18 -0
  292. package/dist/trust-score-stage.js.map +1 -0
  293. package/dist/trust-score.d.ts +164 -0
  294. package/dist/trust-score.js +22 -0
  295. package/dist/trust-score.js.map +1 -0
  296. package/dist/{types-ACmDOScJ.d.ts → types-DwO1Ot4n.d.ts} +56 -2
  297. package/dist/types.d.ts +1 -1
  298. package/dist/types.js +1 -1
  299. package/dist/utility-runtime.d.ts +1 -1
  300. package/dist/verified-recall.js +12 -10
  301. package/package.json +2 -2
  302. package/src/access-service.ts +8 -5
  303. package/src/capabilities-cluster-b.test.ts +78 -0
  304. package/src/capabilities.test.ts +11 -1
  305. package/src/capabilities.ts +58 -0
  306. package/src/cli/research-status-commands.ts +7 -3
  307. package/src/cli.ts +11 -6
  308. package/src/config.ts +60 -30
  309. package/src/extraction-faithfulness.test.ts +175 -0
  310. package/src/extraction-faithfulness.ts +53 -1
  311. package/src/faithfulness-config.test.ts +96 -0
  312. package/src/faithfulness-config.ts +138 -0
  313. package/src/graph-snapshot.ts +3 -3
  314. package/src/graph.ts +8 -7
  315. package/src/lifecycle/tombstones.test.ts +242 -1
  316. package/src/lifecycle/tombstones.ts +157 -70
  317. package/src/local-model-endpoint.test.ts +155 -0
  318. package/src/local-model-endpoint.ts +189 -0
  319. package/src/operator-toolkit.ts +24 -7
  320. package/src/orchestration/tier-migration-coordinator.ts +286 -0
  321. package/src/orchestrator.ts +331 -222
  322. package/src/recall-xray.test.ts +62 -0
  323. package/src/recall-xray.ts +34 -0
  324. package/src/trust-score-recall-paths.test.ts +157 -0
  325. package/src/trust-score-stage.test.ts +350 -0
  326. package/src/trust-score-stage.ts +398 -0
  327. package/src/trust-score.test.ts +282 -0
  328. package/src/trust-score.ts +449 -0
  329. package/src/types.ts +61 -1
  330. package/dist/chunk-3JJWNZTT.js.map +0 -1
  331. package/dist/chunk-72VDBALG.js.map +0 -1
  332. package/dist/chunk-A5TUPZ3N.js.map +0 -1
  333. package/dist/chunk-F3PVXKHP.js.map +0 -1
  334. package/dist/chunk-FEB7W5JG.js.map +0 -1
  335. package/dist/chunk-IF362TF6.js.map +0 -1
  336. package/dist/chunk-L5ASZA2F.js.map +0 -1
  337. package/dist/chunk-N3DUH6OO.js.map +0 -1
  338. package/dist/chunk-NFRBADNR.js.map +0 -1
  339. package/dist/chunk-PBH4JUAB.js.map +0 -1
  340. package/dist/chunk-RVLB4E6N.js.map +0 -1
  341. package/dist/chunk-UCJ5CDTK.js.map +0 -1
  342. package/dist/chunk-YGKUAX2B.js.map +0 -1
  343. /package/dist/{auto-sync-24NNS3GU.js.map → auto-sync-F3KCSQFJ.js.map} +0 -0
  344. /package/dist/{chunk-TH7WMHVK.js.map → chunk-3NN73CM7.js.map} +0 -0
  345. /package/dist/{chunk-DGTDRIUO.js.map → chunk-4T3BMHKD.js.map} +0 -0
  346. /package/dist/{chunk-EH27LHML.js.map → chunk-5O42UKXI.js.map} +0 -0
  347. /package/dist/{chunk-KRGC4EDX.js.map → chunk-6FAMMBQ3.js.map} +0 -0
  348. /package/dist/{chunk-67HG7KFE.js.map → chunk-6YKIYQU7.js.map} +0 -0
  349. /package/dist/{chunk-LXSG4L55.js.map → chunk-7CTNUVHZ.js.map} +0 -0
  350. /package/dist/{chunk-7EEVXW7X.js.map → chunk-A7TJZLPK.js.map} +0 -0
  351. /package/dist/{chunk-P5IPFZVH.js.map → chunk-B7WISIAJ.js.map} +0 -0
  352. /package/dist/{chunk-JAKYZGV4.js.map → chunk-BXEOHV7K.js.map} +0 -0
  353. /package/dist/{chunk-S3OPGGZB.js.map → chunk-D7EBTQ24.js.map} +0 -0
  354. /package/dist/{chunk-IO5NQEGZ.js.map → chunk-DKT3X5C3.js.map} +0 -0
  355. /package/dist/{chunk-S35FX6MU.js.map → chunk-EBDA5TYA.js.map} +0 -0
  356. /package/dist/{chunk-2PTBLS2S.js.map → chunk-EDOQM4E4.js.map} +0 -0
  357. /package/dist/{chunk-YTZLBBEB.js.map → chunk-EEJMD2L2.js.map} +0 -0
  358. /package/dist/{chunk-JIZGYQYH.js.map → chunk-EM2LDXJ2.js.map} +0 -0
  359. /package/dist/{chunk-YYOK4GVF.js.map → chunk-EVPNWN7Z.js.map} +0 -0
  360. /package/dist/{chunk-HLIR3RJ7.js.map → chunk-EXUCUPV2.js.map} +0 -0
  361. /package/dist/{chunk-2SXMCQEQ.js.map → chunk-GZQXOQQ2.js.map} +0 -0
  362. /package/dist/{chunk-2KAYTPPT.js.map → chunk-HCVWF657.js.map} +0 -0
  363. /package/dist/{chunk-4KZGLDJJ.js.map → chunk-J3JPB7ZI.js.map} +0 -0
  364. /package/dist/{chunk-LQ6JI4VH.js.map → chunk-LD53WPMU.js.map} +0 -0
  365. /package/dist/{chunk-URM3HW2R.js.map → chunk-LLUGAZ3B.js.map} +0 -0
  366. /package/dist/{chunk-U5H7WHTS.js.map → chunk-N77ELJ2D.js.map} +0 -0
  367. /package/dist/{chunk-2VHMVWPU.js.map → chunk-NXRUUDUF.js.map} +0 -0
  368. /package/dist/{chunk-DIFU33GU.js.map → chunk-OHTOPFRF.js.map} +0 -0
  369. /package/dist/{chunk-74MYJSKB.js.map → chunk-ORAK3LNZ.js.map} +0 -0
  370. /package/dist/{chunk-REWQAFSA.js.map → chunk-PD42EYQN.js.map} +0 -0
  371. /package/dist/{chunk-773DPI6T.js.map → chunk-PKMQK2WY.js.map} +0 -0
  372. /package/dist/{chunk-CTOQEZSN.js.map → chunk-QR67FU5G.js.map} +0 -0
  373. /package/dist/{chunk-AU7Q3LSC.js.map → chunk-RKNJBZ55.js.map} +0 -0
  374. /package/dist/{chunk-YI7RZO7Y.js.map → chunk-SQNED75R.js.map} +0 -0
  375. /package/dist/{chunk-5CEJH5ZN.js.map → chunk-TAPSNIMA.js.map} +0 -0
  376. /package/dist/{chunk-5RHM43BJ.js.map → chunk-TXQCG6SE.js.map} +0 -0
  377. /package/dist/{chunk-ANI5DUAE.js.map → chunk-UIXXE6NI.js.map} +0 -0
  378. /package/dist/{chunk-2COL35PK.js.map → chunk-UO5ZHIIH.js.map} +0 -0
  379. /package/dist/{chunk-OJU73BUX.js.map → chunk-VCLGUIFM.js.map} +0 -0
  380. /package/dist/{chunk-5J4OL7TJ.js.map → chunk-VUA4S7P6.js.map} +0 -0
  381. /package/dist/{chunk-A66YRSOS.js.map → chunk-WQYSDPMA.js.map} +0 -0
  382. /package/dist/{chunk-OZ2KQ7HF.js.map → chunk-YEE5KJQQ.js.map} +0 -0
  383. /package/dist/{chunk-WRFKZEO6.js.map → chunk-YQGHW5ML.js.map} +0 -0
  384. /package/dist/{chunk-APUJIMDM.js.map → chunk-Z4RU5VPM.js.map} +0 -0
  385. /package/dist/{chunk-DCWIQFNA.js.map → chunk-ZUDM75KG.js.map} +0 -0
  386. /package/dist/{forget-U66KPDPY.js.map → forget-OEE5OELK.js.map} +0 -0
  387. /package/dist/{graph-edge-decay-JLOF3YW4.js.map → graph-edge-decay-QPRJQ7DL.js.map} +0 -0
@@ -243,6 +243,7 @@ import {
243
243
  type ActionConfidenceResult,
244
244
  } from "./action-confidence.js";
245
245
  import { formatProfileTraceAscii } from "./profiling.js";
246
+ import { resolveAccessSetupCapabilities, resolveGraphConstructionCapabilities } from "./capabilities.js";
246
247
 
247
248
  export class EngramAccessInputError extends Error {}
248
249
 
@@ -1299,14 +1300,15 @@ export class EngramAccessService {
1299
1300
 
1300
1301
  constructor(private readonly orchestrator: Orchestrator) {
1301
1302
  this.idempotency = new AccessIdempotencyStore(orchestrator.config.memoryDir);
1303
+ const accessCaps = resolveAccessSetupCapabilities(orchestrator.config); // #1566 Cluster B
1302
1304
  this.budget = new CrossNamespaceBudget({
1303
- enabled: orchestrator.config.recallCrossNamespaceBudgetEnabled,
1305
+ enabled: accessCaps.recallCrossNamespaceBudget,
1304
1306
  windowMs: orchestrator.config.recallCrossNamespaceBudgetWindowMs,
1305
1307
  softLimit: orchestrator.config.recallCrossNamespaceBudgetSoftLimit,
1306
1308
  hardLimit: orchestrator.config.recallCrossNamespaceBudgetHardLimit,
1307
1309
  });
1308
1310
 
1309
- const auditEnabled = orchestrator.config.recallAuditAnomalyDetectionEnabled === true;
1311
+ const auditEnabled = accessCaps.recallAuditAnomalyDetection;
1310
1312
  const auditLogEnabled = false; // Audit JSONL logging — off until wired to a directory
1311
1313
  if (auditEnabled || auditLogEnabled) {
1312
1314
  const auditConfig: AccessAuditConfig = {
@@ -7512,6 +7514,7 @@ export class EngramAccessService {
7512
7514
  );
7513
7515
  const storage = await this.orchestrator.getStorage(namespace);
7514
7516
  const cfg = this.orchestrator.config;
7517
+ const graphCaps = resolveGraphConstructionCapabilities(cfg);
7515
7518
  // Canonicalize the storage root once — through `realpath` so that any
7516
7519
  // symlink in the namespace root path itself is resolved before we
7517
7520
  // compare children against it. This is required because
@@ -7608,9 +7611,9 @@ export class EngramAccessService {
7608
7611
  return buildGraphSnapshot({
7609
7612
  memoryDir: namespaceRootReal,
7610
7613
  graphConfig: {
7611
- entityGraphEnabled: cfg.entityGraphEnabled === true,
7612
- timeGraphEnabled: cfg.timeGraphEnabled === true,
7613
- causalGraphEnabled: cfg.causalGraphEnabled === true,
7614
+ entityGraph: graphCaps.entityGraph,
7615
+ timeGraph: graphCaps.timeGraph,
7616
+ causalGraph: graphCaps.causalGraph,
7614
7617
  },
7615
7618
  request: {
7616
7619
  limit: request.limit,
@@ -0,0 +1,78 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+
4
+ import { parseConfig } from "./config.js";
5
+ import {
6
+ resolveAccessSetupCapabilities,
7
+ type AccessSetupCapabilitySet,
8
+ } from "./capabilities.js";
9
+
10
+ /**
11
+ * Parity tests for the access-setup capability set (issue #1566 Cluster B).
12
+ *
13
+ * Every access-setup capability field must project from its `<field>Enabled`
14
+ * config flag, and the default-off semantics for both flags must be preserved.
15
+ */
16
+
17
+ const ACCESS_FIELD_TO_FLAG: Record<keyof AccessSetupCapabilitySet, string> = {
18
+ recallCrossNamespaceBudget: "recallCrossNamespaceBudgetEnabled",
19
+ recallAuditAnomalyDetection: "recallAuditAnomalyDetectionEnabled",
20
+ };
21
+
22
+ const ACCESS_FIELDS = Object.keys(ACCESS_FIELD_TO_FLAG) as Array<
23
+ keyof AccessSetupCapabilitySet
24
+ >;
25
+
26
+ test("resolveAccessSetupCapabilities projects every field from its flag (true variant)", () => {
27
+ const overrides: Record<string, boolean> = {};
28
+ for (const flag of Object.values(ACCESS_FIELD_TO_FLAG)) overrides[flag] = true;
29
+ const config = parseConfig(overrides);
30
+ const accessCaps = resolveAccessSetupCapabilities(config);
31
+
32
+ for (const field of ACCESS_FIELDS) {
33
+ const flag = ACCESS_FIELD_TO_FLAG[field];
34
+ assert.equal(
35
+ accessCaps[field],
36
+ (config as unknown as Record<string, boolean>)[flag],
37
+ `accessCaps.${field} must equal config.${flag} (true variant)`,
38
+ );
39
+ }
40
+ });
41
+
42
+ test("resolveAccessSetupCapabilities projects every field from its flag (false variant)", () => {
43
+ const overrides: Record<string, boolean> = {};
44
+ for (const flag of Object.values(ACCESS_FIELD_TO_FLAG)) overrides[flag] = false;
45
+ const config = parseConfig(overrides);
46
+ const accessCaps = resolveAccessSetupCapabilities(config);
47
+
48
+ for (const field of ACCESS_FIELDS) {
49
+ assert.equal(
50
+ accessCaps[field],
51
+ false,
52
+ `accessCaps.${field} must be false when its flag is false`,
53
+ );
54
+ }
55
+ });
56
+
57
+ test("resolveAccessSetupCapabilities preserves default-off semantics when flags are undefined", () => {
58
+ // parseConfig with no overrides exercises the documented defaults. Both
59
+ // access-setup flags default to false.
60
+ const config = parseConfig({});
61
+ const accessCaps = resolveAccessSetupCapabilities(config);
62
+
63
+ assert.equal(
64
+ accessCaps.recallCrossNamespaceBudget,
65
+ false,
66
+ "recallCrossNamespaceBudget must default to false",
67
+ );
68
+ assert.equal(
69
+ accessCaps.recallAuditAnomalyDetection,
70
+ false,
71
+ "recallAuditAnomalyDetection must default to false",
72
+ );
73
+ });
74
+
75
+ test("resolveAccessSetupCapabilities returns a frozen object", () => {
76
+ const accessCaps = resolveAccessSetupCapabilities(parseConfig({}));
77
+ assert.equal(Object.isFrozen(accessCaps), true, "AccessSetupCapabilitySet must be frozen");
78
+ });
@@ -2,7 +2,12 @@ import assert from "node:assert/strict";
2
2
  import test from "node:test";
3
3
 
4
4
  import { parseConfig } from "./config.js";
5
- import { resolveCapabilities, type CapabilitySet } from "./capabilities.js";
5
+ import {
6
+ resolveCapabilities,
7
+ resolveAccessSetupCapabilities,
8
+ type CapabilitySet,
9
+ type AccessSetupCapabilitySet,
10
+ } from "./capabilities.js";
6
11
 
7
12
  /**
8
13
  * Characterization tests for the recall-operation CapabilitySet (issue #1523).
@@ -22,6 +27,7 @@ const FIELD_TO_FLAG: Record<keyof CapabilitySet, string> = {
22
27
  rerankCache: "rerankCacheEnabled",
23
28
  recallDirectAnswer: "recallDirectAnswerEnabled",
24
29
  recallMemoryWorthFilter: "recallMemoryWorthFilterEnabled",
30
+ recallTrustScore: "trustScoreEnabled",
25
31
  recallMmr: "recallMmrEnabled",
26
32
  recallReasoningTraceBoost: "recallReasoningTraceBoostEnabled",
27
33
  recallPlannerLlm: "recallPlannerLlmEnabled",
@@ -30,6 +36,10 @@ const FIELD_TO_FLAG: Record<keyof CapabilitySet, string> = {
30
36
  graphRecall: "graphRecallEnabled",
31
37
  graphAssistInFullMode: "graphAssistInFullModeEnabled",
32
38
  graphExpandedIntent: "graphExpandedIntentEnabled",
39
+ // Issue #1566 Cluster C: mixed-operation flags.
40
+ rerank: "rerankEnabled",
41
+ harmonicRetrieval: "harmonicRetrievalEnabled",
42
+ parallelRetrieval: "parallelRetrievalEnabled",
33
43
  };
34
44
 
35
45
  const FIELDS = Object.keys(FIELD_TO_FLAG) as Array<keyof CapabilitySet>;
@@ -38,6 +38,8 @@ export interface CapabilitySet {
38
38
  readonly recallDirectAnswer: boolean;
39
39
  /** `recallMemoryWorthFilterEnabled` — Memory-Worth score reweighting. */
40
40
  readonly recallMemoryWorthFilter: boolean;
41
+ /** `trustScoreEnabled` — unified TrustScore recall stage (issue #1577). */
42
+ readonly recallTrustScore: boolean;
41
43
  /** `recallMmrEnabled` — maximal-marginal-relevance diversification. */
42
44
  readonly recallMmr: boolean;
43
45
  /** `recallReasoningTraceBoostEnabled` — boost reasoning-trace memories. */
@@ -54,6 +56,13 @@ export interface CapabilitySet {
54
56
  readonly graphAssistInFullMode: boolean;
55
57
  /** `graphExpandedIntentEnabled` — promote broad-intent asks to graph mode. */
56
58
  readonly graphExpandedIntent: boolean;
59
+ // --- Issue #1566 Cluster C: mixed-operation flags (recall + summarizer/CLI/writes) ---
60
+ /** `rerankEnabled` — optional LLM reranking of recall candidates. */
61
+ readonly rerank: boolean;
62
+ /** `harmonicRetrievalEnabled` — abstraction-node harmonic retrieval tier. */
63
+ readonly harmonicRetrieval: boolean;
64
+ /** `parallelRetrievalEnabled` — three-agent parallel retrieval (DirectFact + Contextual + Temporal). */
65
+ readonly parallelRetrieval: boolean;
57
66
  }
58
67
 
59
68
  /**
@@ -72,6 +81,9 @@ export function resolveCapabilities(config: PluginConfig): CapabilitySet {
72
81
  rerankCache: config.rerankCacheEnabled,
73
82
  recallDirectAnswer: config.recallDirectAnswerEnabled,
74
83
  recallMemoryWorthFilter: config.recallMemoryWorthFilterEnabled,
84
+ // Issue #1577: TrustScore subsumes the Memory Worth multiplier when on;
85
+ // the orchestrator runs exactly one of the two (mutual exclusion, rule 39).
86
+ recallTrustScore: config.trustScoreEnabled === true,
75
87
  recallMmr: config.recallMmrEnabled,
76
88
  recallReasoningTraceBoost: config.recallReasoningTraceBoostEnabled,
77
89
  recallPlannerLlm: config.recallPlannerLlmEnabled,
@@ -82,6 +94,10 @@ export function resolveCapabilities(config: PluginConfig): CapabilitySet {
82
94
  // migrated call sites used (`!== false` = default-on, `=== true` = default-off).
83
95
  graphAssistInFullMode: config.graphAssistInFullModeEnabled !== false,
84
96
  graphExpandedIntent: config.graphExpandedIntentEnabled === true,
97
+ // Issue #1566 Cluster C: mixed-operation flags resolved once per recall op.
98
+ rerank: config.rerankEnabled,
99
+ harmonicRetrieval: config.harmonicRetrievalEnabled,
100
+ parallelRetrieval: config.parallelRetrievalEnabled,
85
101
  });
86
102
  }
87
103
 
@@ -145,3 +161,45 @@ export function resolveGraphConstructionCapabilities(
145
161
  graphWriteSessionAdjacency: config.graphWriteSessionAdjacencyEnabled !== false,
146
162
  });
147
163
  }
164
+
165
+ // ---------------------------------------------------------------------------
166
+ // Access-setup capability set (issue #1566 Cluster B).
167
+ //
168
+ // These two flags gate cross-namespace recall budgeting and anomaly-detection
169
+ // auditing. Resolved once at access-service handler entry (and the operator
170
+ // doctor check) rather than re-derived from raw config at each site.
171
+ // ---------------------------------------------------------------------------
172
+
173
+ /**
174
+ * Frozen projection of access-setup feature gates (issue #1566 Cluster B).
175
+ *
176
+ * Every field is `readonly boolean`. Composition (including the default-off
177
+ * semantics for the optional `recallAuditAnomalyDetectionEnabled`) lives ONLY
178
+ * in {@link resolveAccessSetupCapabilities}.
179
+ */
180
+ export interface AccessSetupCapabilitySet {
181
+ /** `recallCrossNamespaceBudgetEnabled` — rolling cross-namespace recall budget. */
182
+ readonly recallCrossNamespaceBudget: boolean;
183
+ /** `recallAuditAnomalyDetectionEnabled` — access-audit anomaly detection (default-off). */
184
+ readonly recallAuditAnomalyDetection: boolean;
185
+ }
186
+
187
+ /**
188
+ * Resolve the {@link AccessSetupCapabilitySet} from parsed config.
189
+ *
190
+ * Call this ONCE at access-service handler entry and thread the result down.
191
+ */
192
+ export type AccessSetupConfigProjection = Pick<
193
+ PluginConfig,
194
+ "recallCrossNamespaceBudgetEnabled" | "recallAuditAnomalyDetectionEnabled"
195
+ >;
196
+
197
+ export function resolveAccessSetupCapabilities(
198
+ config: AccessSetupConfigProjection,
199
+ ): AccessSetupCapabilitySet {
200
+ return Object.freeze({
201
+ recallCrossNamespaceBudget: config.recallCrossNamespaceBudgetEnabled,
202
+ // Optional/default-off flag: preserve `=== true` semantics.
203
+ recallAuditAnomalyDetection: config.recallAuditAnomalyDetectionEnabled === true,
204
+ });
205
+ }
@@ -18,6 +18,7 @@
18
18
  */
19
19
 
20
20
  import type { Orchestrator } from "../orchestrator.js";
21
+ import { resolveCapabilities } from "../capabilities.js";
21
22
  import type { CliCommand } from "../cli.js";
22
23
  import type { UtilityTelemetryEvent } from "../utility-telemetry.js";
23
24
  import {
@@ -42,6 +43,9 @@ export function registerResearchStatusCommands(
42
43
  cmd: CliCommand,
43
44
  orchestrator: Orchestrator,
44
45
  ): void {
46
+ // Resolve recall-operation gates once (#1566 Cluster C — harmonicRetrieval is a
47
+ // mixed-op flag read here on the CLI-search path as well as in recall).
48
+ const caps = resolveCapabilities(orchestrator.config);
45
49
  cmd
46
50
  .command("objective-state-status")
47
51
  .description("Show objective-state store status, snapshot counts, and latest stored snapshot")
@@ -111,7 +115,7 @@ cmd
111
115
  const status = await runAbstractionNodeStatusCliCommand({
112
116
  memoryDir: orchestrator.config.memoryDir,
113
117
  abstractionNodeStoreDir: orchestrator.config.abstractionNodeStoreDir,
114
- harmonicRetrievalEnabled: orchestrator.config.harmonicRetrievalEnabled,
118
+ harmonicRetrievalEnabled: caps.harmonicRetrieval,
115
119
  abstractionAnchorsEnabled: orchestrator.config.abstractionAnchorsEnabled,
116
120
  });
117
121
  console.log(JSON.stringify(status, null, 2));
@@ -125,7 +129,7 @@ cmd
125
129
  const status = await runCueAnchorStatusCliCommand({
126
130
  memoryDir: orchestrator.config.memoryDir,
127
131
  abstractionNodeStoreDir: orchestrator.config.abstractionNodeStoreDir,
128
- harmonicRetrievalEnabled: orchestrator.config.harmonicRetrievalEnabled,
132
+ harmonicRetrievalEnabled: caps.harmonicRetrieval,
129
133
  abstractionAnchorsEnabled: orchestrator.config.abstractionAnchorsEnabled,
130
134
  });
131
135
  console.log(JSON.stringify(status, null, 2));
@@ -147,7 +151,7 @@ cmd
147
151
  const results = await runHarmonicSearchCliCommand({
148
152
  memoryDir: orchestrator.config.memoryDir,
149
153
  abstractionNodeStoreDir: orchestrator.config.abstractionNodeStoreDir,
150
- harmonicRetrievalEnabled: orchestrator.config.harmonicRetrievalEnabled,
154
+ harmonicRetrievalEnabled: caps.harmonicRetrieval,
151
155
  abstractionAnchorsEnabled: orchestrator.config.abstractionAnchorsEnabled,
152
156
  query,
153
157
  maxResults: Number.isFinite(maxResults) ? maxResults : 3,
package/src/cli.ts CHANGED
@@ -125,6 +125,7 @@ import {
125
125
  validateEvalBenchmarkPack,
126
126
  } from "./evals.js";
127
127
  import { analyzeGraphHealth, type GraphHealthReport } from "./graph.js";
128
+ import { resolveGraphConstructionCapabilities } from "./capabilities.js";
128
129
  import {
129
130
  getCausalTrajectoryStoreStatus,
130
131
  type CausalTrajectoryStoreStatus,
@@ -6360,11 +6361,12 @@ export function registerCli(
6360
6361
  .option("--repair-guidance", "Include non-destructive repair guidance")
6361
6362
  .action(async (...args: unknown[]) => {
6362
6363
  const options = (args[0] ?? {}) as Record<string, unknown>;
6364
+ const graphCaps = resolveGraphConstructionCapabilities(orchestrator.config);
6363
6365
  const report = await runGraphHealthCliCommand({
6364
6366
  memoryDir: orchestrator.config.memoryDir,
6365
- entityGraphEnabled: orchestrator.config.entityGraphEnabled,
6366
- timeGraphEnabled: orchestrator.config.timeGraphEnabled,
6367
- causalGraphEnabled: orchestrator.config.causalGraphEnabled,
6367
+ entityGraphEnabled: graphCaps.entityGraph,
6368
+ timeGraphEnabled: graphCaps.timeGraph,
6369
+ causalGraphEnabled: graphCaps.causalGraph,
6368
6370
  includeRepairGuidance: options.repairGuidance === true,
6369
6371
  });
6370
6372
  console.log(JSON.stringify(report, null, 2));
@@ -6415,12 +6417,15 @@ export function registerCli(
6415
6417
  .option("--json", "Emit machine-readable JSON only")
6416
6418
  .action(async (...args: unknown[]) => {
6417
6419
  const options = (args[0] ?? {}) as Record<string, unknown>;
6420
+ const repairGraphCaps = resolveGraphConstructionCapabilities(orchestrator.config);
6418
6421
  const report = await runOperatorRepair({
6419
6422
  config: {
6420
6423
  memoryDir: orchestrator.config.memoryDir,
6421
- entityGraphEnabled: orchestrator.config.entityGraphEnabled,
6422
- timeGraphEnabled: orchestrator.config.timeGraphEnabled,
6423
- causalGraphEnabled: orchestrator.config.causalGraphEnabled,
6424
+ entityGraphEnabled: repairGraphCaps.entityGraph,
6425
+ timeGraphEnabled: repairGraphCaps.timeGraph,
6426
+ causalGraphEnabled: repairGraphCaps.causalGraph,
6427
+ multiGraphMemoryEnabled: repairGraphCaps.multiGraphMemory,
6428
+ graphWriteSessionAdjacencyEnabled: repairGraphCaps.graphWriteSessionAdjacency,
6424
6429
  },
6425
6430
  apply: options.apply === true,
6426
6431
  dryRun: options.dryRun === true,
package/src/config.ts CHANGED
@@ -28,6 +28,7 @@ import type {
28
28
  SlotBehaviorConfig,
29
29
  SlotMismatchMode,
30
30
  TriggerMode,
31
+ TrustWeights,
31
32
  } from "./types.js";
32
33
  import { log } from "./logger.js";
33
34
  import { cloneDefaultSessionObserverBands } from "./session-observer-bands.js";
@@ -48,6 +49,7 @@ import { parseWearablesConfig } from "./wearables/config.js";
48
49
  import { parseProvenanceConfig } from "./provenance.js";
49
50
  import { parseCodingKnowledgeConfig } from "./coding/coding-knowledge-config.js";
50
51
  import { parseChatConfig } from "./chat/chat-config.js";
52
+ import { parseCorrectionIntentConfig, parseFaithfulnessGateConfig } from "./faithfulness-config.js";
51
53
  const DEFAULT_MEMORY_DIR = path.join(
52
54
  resolveHomeDir(),
53
55
  ".openclaw",
@@ -2336,6 +2338,27 @@ export function parseConfig(
2336
2338
  const n = coerceNumber(cfg.recallMemoryWorthHalfLifeMs);
2337
2339
  return n !== undefined && n >= 0 ? n : 0;
2338
2340
  })(),
2341
+ // Unified TrustScore recall stage (issue #1577). Default off: the stage
2342
+ // is absent and ranking is byte-identical to the pre-feature pipeline
2343
+ // (rule 39). Flip the master gate via #1574 ablation evidence only.
2344
+ trustScoreEnabled: coerceBool(cfg.trustScoreEnabled) ?? false,
2345
+ // Epistemic rendering ships behind its own gate so scoring can land first.
2346
+ trustScoreEpistemicRendering: coerceBool(cfg.trustScoreEpistemicRendering) ?? false,
2347
+ // Quarantine defaults on (only effective under the master gate); keeps
2348
+ // hard negatives out of injection but visible in X-ray (rule 34).
2349
+ trustScoreQuarantine: coerceBool(cfg.trustScoreQuarantine) ?? true,
2350
+ trustScoreMinMultiplier: (() => {
2351
+ const n = coerceNumber(cfg.trustScoreMinMultiplier);
2352
+ return n !== undefined && n >= 0 && n <= 1 ? n : 0.5;
2353
+ })(),
2354
+ trustScoreMaxMultiplier: (() => {
2355
+ const n = coerceNumber(cfg.trustScoreMaxMultiplier);
2356
+ return n !== undefined && n >= 1 && n <= 4 ? n : 1.25;
2357
+ })(),
2358
+ // Per-component weights. Accept a nested object from config; invalid
2359
+ // entries (non-finite, outside [0,1]) are dropped by resolveTrustWeights,
2360
+ // which falls back to the documented defaults (rule 51).
2361
+ trustScoreWeights: parseTrustScoreWeights(cfg.trustScoreWeights),
2339
2362
  // Memory Linking (Phase 3A)
2340
2363
  memoryLinkingEnabled: cfg.memoryLinkingEnabled === true, // Off by default initially
2341
2364
  // Conversation Threading (Phase 3B)
@@ -2996,36 +3019,14 @@ export function parseConfig(
2996
3019
  collectJudgeTrainingPairs: coerceBool(cfg.collectJudgeTrainingPairs) === true,
2997
3020
  judgeTrainingDir:
2998
3021
  typeof cfg.judgeTrainingDir === "string" ? cfg.judgeTrainingDir : "",
2999
- // Extraction faithfulness gate (issue #1576). Entailment-verification of
3000
- // extracted facts against verified source spans (#1575). Default "off"
3001
- // (rule 39: byte-identical pre-feature pipeline). Invalid values are
3002
- // rejected listing valid options (rule 51).
3003
- extractionFaithfulnessGate: (() => {
3004
- const v = cfg.extractionFaithfulnessGate;
3005
- if (v === undefined || v === null) return "off";
3006
- // Present-but-invalid (true/1/{}) must reject, not silently disable the gate (Ob4RQ).
3007
- const raw = typeof v === "string" ? v.trim().toLowerCase() : v;
3008
- if (raw === "off" || raw === "shadow" || raw === "enforce") return raw;
3009
- throw new Error(
3010
- `extractionFaithfulnessGate must be one of "off" | "shadow" | "enforce" (got ${JSON.stringify(v)})`,
3011
- );
3012
- })(),
3013
- extractionFaithfulnessModel:
3014
- typeof cfg.extractionFaithfulnessModel === "string"
3015
- ? cfg.extractionFaithfulnessModel
3016
- : "",
3017
- // Issue #1634 (#1576 follow-up): strict-integer validation via
3018
- // parseIntegerAtLeast — reject non-numeric, <=0, non-integer, NaN,
3019
- // Infinity, booleans, objects (gotcha #51). Mirrors qmdDaemonTimeoutMs.
3020
- // Valid CLI-string integers still coerce and clamp to the budget cap.
3021
- extractionFaithfulnessContextChars: Math.min(
3022
- parseIntegerAtLeast(cfg.extractionFaithfulnessContextChars, 400, 1, "extractionFaithfulnessContextChars"),
3023
- 4000,
3024
- ),
3025
- extractionFaithfulnessTimeoutMs: Math.min(
3026
- parseIntegerAtLeast(cfg.extractionFaithfulnessTimeoutMs, 8000, 1, "extractionFaithfulnessTimeoutMs"),
3027
- 60_000,
3028
- ),
3022
+ // Extraction faithfulness gate (issue #1576) + model-lab pointer
3023
+ // `extractionFaithfulnessBaseUrl` (issue #1585), and the correction-intent
3024
+ // model-lab pointer (issue #1581 / #1585). Parsed in faithfulness-config.ts
3025
+ // (extracted from this god file so the block can grow without tripping the
3026
+ // ratchet). Defaults preserve the byte-identical pre-feature pipeline
3027
+ // (rule 39); invalid values reject (rule 51 / #1634).
3028
+ ...parseFaithfulnessGateConfig(cfg),
3029
+ ...parseCorrectionIntentConfig(cfg),
3029
3030
  // Inline source attribution (issue #369). Opt-in to preserve
3030
3031
  // backwards compatibility with existing downstream consumers.
3031
3032
  inlineSourceAttributionEnabled: cfg.inlineSourceAttributionEnabled === true,
@@ -4639,3 +4640,32 @@ function buildRecallPipelineConfig(cfg: Record<string, unknown>): RecallPipeline
4639
4640
 
4640
4641
  return { recallBudgetChars, pipeline };
4641
4642
  }
4643
+
4644
+ /**
4645
+ * Parse the `trustScoreWeights` config value into a {@link TrustWeights}
4646
+ * object. Accepts a plain object of per-component numbers; non-finite or
4647
+ * out-of-`[0,1]` entries are dropped (the scorer falls back to defaults via
4648
+ * `resolveTrustWeights`). A non-object value yields `{}` → all defaults.
4649
+ * Rule 51: invalid weight rejected, never silently clamped to an extreme.
4650
+ */
4651
+ function parseTrustScoreWeights(value: unknown): TrustWeights {
4652
+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};
4653
+ const src = value as Record<string, unknown>;
4654
+ const out: TrustWeights = {};
4655
+ const keys: Array<keyof TrustWeights> = [
4656
+ "memoryWorth",
4657
+ "provenance",
4658
+ "faithfulness",
4659
+ "corroboration",
4660
+ "contradiction",
4661
+ "domainCalibration",
4662
+ "feedback",
4663
+ "recency",
4664
+ ];
4665
+ for (const key of keys) {
4666
+ const raw = src[key as string];
4667
+ if (typeof raw !== "number" || !Number.isFinite(raw) || raw < 0 || raw > 1) continue;
4668
+ (out as Record<string, number>)[key as string] = raw;
4669
+ }
4670
+ return out;
4671
+ }
@@ -1254,3 +1254,178 @@ test("parseFaithfulnessResponse: object-wrapped arrays unwrap (results/verdicts/
1254
1254
  // A wrapper object with no recognized array key still returns null (no over-match).
1255
1255
  assert.equal(parseFaithfulnessResponse('{"data": {"nested": []}}', 1), null);
1256
1256
  });
1257
+
1258
+ // ---------------------------------------------------------------------------
1259
+ // Issue #1585 model-lab pointer: local fine-tuned endpoint path
1260
+ // ---------------------------------------------------------------------------
1261
+
1262
+ /**
1263
+ * Build a fake fetch that responds for a specific base URL with a canned
1264
+ * openai-compatible chat-completions body. Records the request body so tests
1265
+ * can assert the gate routed to the local model.
1266
+ */
1267
+ function fakeFetchFor(
1268
+ baseUrl: string,
1269
+ responder: (body: Record<string, unknown>) => unknown,
1270
+ ): { fetch: typeof fetch; requests: Array<{ url: string; body: Record<string, unknown> }> } {
1271
+ const requests: Array<{ url: string; body: Record<string, unknown> }> = [];
1272
+ const fake = ((url: string, init: RequestInit) => {
1273
+ requests.push({ url, body: JSON.parse(String(init.body)) });
1274
+ const body = JSON.parse(String(init.body));
1275
+ const payload = responder(body);
1276
+ return Promise.resolve(
1277
+ new Response(JSON.stringify(payload), {
1278
+ status: 200,
1279
+ headers: { "content-type": "application/json" },
1280
+ }),
1281
+ );
1282
+ }) as typeof fetch;
1283
+ return { fetch: fake, requests };
1284
+ }
1285
+
1286
+ test("checkFaithfulnessBatch: local model-lab endpoint is tried first when configured (#1585)", async () => {
1287
+ const inputs = [{ factText: "Fact", quote: "Quote" }];
1288
+ const config = parseConfig({
1289
+ extractionFaithfulnessModel: "remnic-faithfulness-gate-v1",
1290
+ extractionFaithfulnessBaseUrl: "http://localhost:11434/v1",
1291
+ extractionFaithfulnessTimeoutMs: 5000,
1292
+ });
1293
+ const fallbackCalls: Array<{ messages: unknown; options: unknown }> = [];
1294
+ const { fetch: fakeFetch, requests } = fakeFetchFor("http://localhost:11434/v1", (body) => ({
1295
+ model: body.model,
1296
+ choices: [{ message: { content: JSON.stringify([{ index: 0, verdict: "contradicted" }]) } }],
1297
+ }));
1298
+ const result = await checkFaithfulnessBatch(
1299
+ inputs,
1300
+ config,
1301
+ null,
1302
+ stubFallbackLlm("[]", fallbackCalls),
1303
+ fakeFetch,
1304
+ );
1305
+ assert.equal(requests.length, 1, "local model-lab endpoint must be called");
1306
+ assert.equal(requests[0]?.url, "http://localhost:11434/v1/chat/completions");
1307
+ assert.equal(requests[0]?.body.model, "remnic-faithfulness-gate-v1");
1308
+ assert.equal(fallbackCalls.length, 0, "gateway fallback must NOT run when the local endpoint succeeds");
1309
+ assert.equal(result.results[0]?.ok, true);
1310
+ if (result.results[0]?.ok) {
1311
+ assert.equal(result.results[0].verdict, "contradicted", "local model verdict is used");
1312
+ assert.equal(result.results[0].model, "remnic-faithfulness-gate-v1");
1313
+ }
1314
+ });
1315
+
1316
+ test("checkFaithfulnessBatch: local endpoint failure falls back to the configured chain (#1585 graceful)", async () => {
1317
+ const inputs = [{ factText: "Fact", quote: "Quote" }];
1318
+ const config = parseConfig({
1319
+ extractionFaithfulnessModel: "remnic-faithfulness-gate-v1",
1320
+ extractionFaithfulnessBaseUrl: "http://localhost:11434/v1",
1321
+ extractionFaithfulnessTimeoutMs: 5000,
1322
+ });
1323
+ const fallbackCalls: Array<{ messages: unknown; options: unknown }> = [];
1324
+ // Local endpoint returns 500 → caller returns null → gate falls through to fallback.
1325
+ const failingFetch = (() =>
1326
+ Promise.resolve(new Response("err", { status: 500 }))) as unknown as typeof fetch;
1327
+ const result = await checkFaithfulnessBatch(
1328
+ inputs,
1329
+ config,
1330
+ null,
1331
+ stubFallbackLlm(JSON.stringify([{ index: 0, verdict: "entailed" }]), fallbackCalls),
1332
+ failingFetch,
1333
+ );
1334
+ assert.equal(fallbackCalls.length, 1, "must fall back to the configured chain on local-endpoint failure");
1335
+ assert.equal(result.results[0]?.ok, true);
1336
+ if (result.results[0]?.ok) {
1337
+ assert.equal(result.results[0].verdict, "entailed", "fallback chain verdict is used");
1338
+ }
1339
+ });
1340
+
1341
+ test("checkFaithfulnessBatch: a wedged local endpoint falls back to the chain BEFORE the batch timeout (codex P2 — probe budget)", async () => {
1342
+ // The local probe must use a SMALLER budget than the outer batch timeout so a
1343
+ // hanging endpoint returns null and the configured chain runs before the batch
1344
+ // timer fires. extractionFaithfulnessTimeoutMs: 1000 → probe budget = 500ms.
1345
+ const inputs = [{ factText: "Fact", quote: "Quote" }];
1346
+ const config = parseConfig({
1347
+ extractionFaithfulnessModel: "remnic-faithfulness-gate-v1",
1348
+ extractionFaithfulnessBaseUrl: "http://localhost:11434/v1",
1349
+ extractionFaithfulnessTimeoutMs: 1000,
1350
+ });
1351
+ const fallbackCalls: Array<{ messages: unknown; options: unknown }> = [];
1352
+ // A fetch that hangs forever on its own but HONORS the probe's AbortSignal —
1353
+ // the probe's controller aborts it at 500ms (half the batch budget), the call
1354
+ // returns null, and the gate falls through to the configured chain.
1355
+ const wedgedFetch = ((_url: string, init: RequestInit) =>
1356
+ new Promise<Response>((_resolve, reject) => {
1357
+ const sig = init.signal;
1358
+ if (!sig) return;
1359
+ if (sig.aborted) reject(new Error("aborted"));
1360
+ else sig.addEventListener("abort", () => reject(new Error("aborted")), { once: true });
1361
+ })) as unknown as typeof fetch;
1362
+ const result = await checkFaithfulnessBatch(
1363
+ inputs,
1364
+ config,
1365
+ null,
1366
+ stubFallbackLlm(JSON.stringify([{ index: 0, verdict: "entailed" }]), fallbackCalls),
1367
+ wedgedFetch,
1368
+ );
1369
+ assert.equal(
1370
+ fallbackCalls.length,
1371
+ 1,
1372
+ "a wedged local probe must reach the configured chain before the batch budget elapses",
1373
+ );
1374
+ assert.equal(result.results[0]?.ok, true);
1375
+ if (result.results[0]?.ok) {
1376
+ assert.equal(result.results[0].verdict, "entailed", "fallback chain verdict is used");
1377
+ }
1378
+ });
1379
+
1380
+ test("checkFaithfulnessBatch: no local endpoint pointer → byte-identical routing (regression guard)", async () => {
1381
+ // Default config (no baseUrl) must never attempt a local-endpoint fetch.
1382
+ const inputs = [{ factText: "Fact", quote: "Quote" }];
1383
+ const config = baseConfig();
1384
+ let fetchCalled = false;
1385
+ const spyFetch = (() => {
1386
+ fetchCalled = true;
1387
+ return Promise.resolve(new Response("{}", { status: 200 }));
1388
+ }) as unknown as typeof fetch;
1389
+ await checkFaithfulnessBatch(
1390
+ inputs,
1391
+ config,
1392
+ null,
1393
+ stubFallbackLlm(JSON.stringify([{ index: 0, verdict: "entailed" }])),
1394
+ spyFetch,
1395
+ );
1396
+ assert.equal(fetchCalled, false, "no local-endpoint fetch when pointer is unset");
1397
+ });
1398
+
1399
+
1400
+ test("checkFaithfulnessBatch: local-endpoint failure does NOT leak the local model name into the fallback chain (codex P2 PRRT_kwDORJXyws6Otp-L)", async () => {
1401
+ // extractionFaithfulnessModel is the LOCAL served model's name. When the
1402
+ // local endpoint is configured but fails, that name must NOT be forwarded to
1403
+ // the gateway/fallback as options.model — otherwise the configured chain is
1404
+ // forced onto an unavailable local-only model and a local outage becomes
1405
+ // backend_unavailable instead of graceful fallback to the configured chain.
1406
+ const inputs = [{ factText: "Fact", quote: "Quote" }];
1407
+ const config = parseConfig({
1408
+ extractionFaithfulnessModel: "remnic-faithfulness-gate-v1",
1409
+ extractionFaithfulnessBaseUrl: "http://localhost:11434/v1",
1410
+ extractionFaithfulnessTimeoutMs: 5000,
1411
+ });
1412
+ const fallbackCalls: Array<{ messages: unknown; options: unknown }> = [];
1413
+ // Local endpoint returns 500 -> caller returns null -> gate falls through.
1414
+ const failingFetch = (() =>
1415
+ Promise.resolve(new Response("err", { status: 500 }))) as unknown as typeof fetch;
1416
+ const result = await checkFaithfulnessBatch(
1417
+ inputs,
1418
+ config,
1419
+ null,
1420
+ stubFallbackLlm(JSON.stringify([{ index: 0, verdict: "entailed" }]), fallbackCalls),
1421
+ failingFetch,
1422
+ );
1423
+ assert.equal(fallbackCalls.length, 1, "fallback chain must run on local-endpoint failure");
1424
+ const opts = fallbackCalls[0]?.options as Record<string, unknown>;
1425
+ assert.equal(
1426
+ opts?.model,
1427
+ undefined,
1428
+ "local-only model name must NOT leak into the fallback chain on endpoint failure",
1429
+ );
1430
+ assert.equal(result.results[0]?.ok, true);
1431
+ });