@remnic/core 10.0.142 → 10.0.144

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 (312) hide show
  1. package/dist/abstraction-nodes.js +4 -4
  2. package/dist/access-admin-ops-surface.js +137 -135
  3. package/dist/access-cli.js +137 -135
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-extraction-force-flush-preempt.js +137 -135
  6. package/dist/access-extraction-force-flush.js +137 -135
  7. package/dist/access-http-briefing.js +137 -135
  8. package/dist/access-http-query.js +137 -135
  9. package/dist/access-http.js +137 -135
  10. package/dist/access-identity-continuity-surface.js +137 -135
  11. package/dist/access-lcm-surface.js +137 -135
  12. package/dist/access-mcp.d.ts.map +1 -1
  13. package/dist/access-mcp.js +137 -135
  14. package/dist/access-observe-write-category.js +9 -9
  15. package/dist/access-observe-write-surface.js +137 -135
  16. package/dist/access-offline-manifest.js +5 -5
  17. package/dist/access-operations-batch.js +137 -135
  18. package/dist/access-operations.js +137 -135
  19. package/dist/access-recall-concurrency.js +137 -135
  20. package/dist/access-recall-mcp-search-options.d.ts +42 -0
  21. package/dist/access-recall-mcp-search-options.d.ts.map +1 -0
  22. package/dist/access-recall-mcp-search-options.js +8 -0
  23. package/dist/access-recall-response.js +137 -135
  24. package/dist/access-recall-surface.d.ts.map +1 -1
  25. package/dist/access-recall-surface.js +137 -135
  26. package/dist/access-schema.d.ts +36 -0
  27. package/dist/access-schema.d.ts.map +1 -1
  28. package/dist/access-schema.js +10 -8
  29. package/dist/access-service.js +137 -135
  30. package/dist/active-recall.js +26 -26
  31. package/dist/adapters/index.js +4 -4
  32. package/dist/adapters/registry.js +2 -2
  33. package/dist/briefing.js +23 -23
  34. package/dist/buffer.js +8 -8
  35. package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
  36. package/dist/{capsule-merge-ILR35DIB.js → capsule-merge-PCSDJOAO.js} +5 -5
  37. package/dist/causal-consolidation.js +23 -23
  38. package/dist/{chunk-UF5RTFN3.js → chunk-2IMKMMUS.js} +5 -5
  39. package/dist/{chunk-IUXTKLZY.js → chunk-2LQUPEWF.js} +22 -22
  40. package/dist/{chunk-27N6SGEY.js → chunk-2S4XW47C.js} +2 -2
  41. package/dist/{chunk-DOJBV6WR.js → chunk-3DJ6R4CC.js} +2 -2
  42. package/dist/{chunk-BYWNF25B.js → chunk-3KQPFIVV.js} +2 -2
  43. package/dist/chunk-3TKX7ZMV.js +27 -0
  44. package/dist/chunk-3TKX7ZMV.js.map +1 -0
  45. package/dist/{chunk-KUQLUYIR.js → chunk-4QEDFEBY.js} +3 -3
  46. package/dist/{chunk-C64XATK7.js → chunk-4U5VHHVF.js} +39 -3
  47. package/dist/chunk-4U5VHHVF.js.map +1 -0
  48. package/dist/{chunk-PFUXPTBT.js → chunk-66DUCUOC.js} +2 -2
  49. package/dist/{chunk-NM6UL4W5.js → chunk-6CSWINXA.js} +9 -9
  50. package/dist/{chunk-AA6G3W3B.js → chunk-6DHSEJIO.js} +2 -2
  51. package/dist/{chunk-ZANNIXXE.js → chunk-6MEQHJTF.js} +3 -3
  52. package/dist/{chunk-342VFB56.js → chunk-74BX5NCU.js} +3 -3
  53. package/dist/{chunk-SZ6QV3DY.js → chunk-A3EWNU5V.js} +2 -2
  54. package/dist/{chunk-VRBGYSSQ.js → chunk-AGJJTD3Q.js} +2 -2
  55. package/dist/chunk-AGJJTD3Q.js.map +1 -0
  56. package/dist/{chunk-QZUT4VTV.js → chunk-AOZYOS4G.js} +2 -2
  57. package/dist/{chunk-O3JG4PD3.js → chunk-AW56K4SI.js} +2 -2
  58. package/dist/{chunk-G2CGIFRP.js → chunk-AXR472RS.js} +2 -2
  59. package/dist/{chunk-CFSCKCT5.js → chunk-B4I37XX6.js} +4 -4
  60. package/dist/{chunk-FREKFMCA.js → chunk-B72X3KWL.js} +2 -2
  61. package/dist/{chunk-NWA6IXR3.js → chunk-B7HYXVME.js} +27 -1
  62. package/dist/chunk-B7HYXVME.js.map +1 -0
  63. package/dist/{chunk-HXFIILGF.js → chunk-BFPF5N3H.js} +4 -4
  64. package/dist/{chunk-ZG4GNPRE.js → chunk-BNQJKWWZ.js} +8 -8
  65. package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
  66. package/dist/{chunk-63JPXUFA.js → chunk-CBJRI6VJ.js} +2 -2
  67. package/dist/{chunk-USVA4XWY.js → chunk-CBTERRF5.js} +3 -3
  68. package/dist/chunk-CQ3IG3GZ.js +30 -0
  69. package/dist/chunk-CQ3IG3GZ.js.map +1 -0
  70. package/dist/{chunk-DLZGSZVC.js → chunk-DLR3SBOM.js} +2 -2
  71. package/dist/{chunk-7NSGKXFD.js → chunk-DLX277NS.js} +4 -4
  72. package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
  73. package/dist/{chunk-SU63UQPL.js → chunk-E23BTVB2.js} +2 -2
  74. package/dist/{chunk-FONPAA43.js → chunk-EDGWAJLS.js} +2 -2
  75. package/dist/{chunk-D6IGZYTN.js → chunk-FJEYZSJD.js} +3 -3
  76. package/dist/{chunk-XOOYE37V.js → chunk-FJVWKIDV.js} +2 -2
  77. package/dist/{chunk-ITAUMNQU.js → chunk-FPII4O7C.js} +2 -2
  78. package/dist/{chunk-JLD44JR7.js → chunk-FWDVW2BD.js} +435 -406
  79. package/dist/chunk-FWDVW2BD.js.map +1 -0
  80. package/dist/{chunk-DGLNT6VO.js → chunk-FYH62SF3.js} +3 -3
  81. package/dist/{chunk-FL3O34XF.js → chunk-FYJYQ65N.js} +3 -3
  82. package/dist/{chunk-7YD5XSJK.js → chunk-IJBOJJVS.js} +5 -5
  83. package/dist/{chunk-FJTRNFI4.js → chunk-JVSHXYOO.js} +2 -2
  84. package/dist/{chunk-3PZDG5ZH.js → chunk-JY3WATTF.js} +2 -2
  85. package/dist/{chunk-MGN2RQRG.js → chunk-KAGLV5KH.js} +2 -2
  86. package/dist/{chunk-2NJ74RQU.js → chunk-LE27GU4M.js} +2 -2
  87. package/dist/{chunk-LPDOCXHH.js → chunk-M43GO34S.js} +2 -2
  88. package/dist/{chunk-GAVFANAB.js → chunk-MEALRZYB.js} +2 -2
  89. package/dist/{chunk-TAUHAP5J.js → chunk-MFDEEOOZ.js} +4 -4
  90. package/dist/{chunk-GNIMBEOK.js → chunk-MIG4KRYU.js} +11 -11
  91. package/dist/{chunk-F476AJQJ.js → chunk-MPQQIHA7.js} +2 -2
  92. package/dist/{chunk-EIZUL6JC.js → chunk-N7LYEA3K.js} +3 -3
  93. package/dist/{chunk-2HI22OK7.js → chunk-NLSMLRH4.js} +2 -2
  94. package/dist/{chunk-WGM2KSWN.js → chunk-NWS4I4K7.js} +2 -2
  95. package/dist/{chunk-BDIXKROL.js → chunk-OV3XHQAB.js} +8 -8
  96. package/dist/{chunk-UX7KPVAM.js → chunk-OYHGCAGQ.js} +2 -2
  97. package/dist/{chunk-6WV76JHC.js → chunk-OYUTSLBU.js} +2 -2
  98. package/dist/{chunk-SZK2DX5U.js → chunk-PCMGMPQZ.js} +2 -2
  99. package/dist/{chunk-4IMMF5W6.js → chunk-POXJ3KXJ.js} +3 -3
  100. package/dist/{chunk-DIBOWE53.js → chunk-QJJURIZV.js} +19 -4
  101. package/dist/chunk-QJJURIZV.js.map +1 -0
  102. package/dist/{chunk-H6VQ7L5D.js → chunk-QPOWOQYH.js} +5 -5
  103. package/dist/{chunk-KQAFEZQX.js → chunk-R45L4TV6.js} +6 -6
  104. package/dist/{chunk-HRMOKGQM.js → chunk-RHQSAXN3.js} +5 -5
  105. package/dist/{chunk-3DAWHP5K.js → chunk-RQBYC7EK.js} +5 -5
  106. package/dist/{chunk-NCS2NXSP.js → chunk-RSRHWNNM.js} +3 -3
  107. package/dist/{chunk-EGDUG2ZX.js → chunk-RVUD4WN3.js} +2 -2
  108. package/dist/{chunk-M5GVCJSJ.js → chunk-TVWLYSX4.js} +2 -2
  109. package/dist/{chunk-JCBKGPFE.js → chunk-UC3KG7KX.js} +3 -3
  110. package/dist/{chunk-O3GZPLVY.js → chunk-UUSL22HE.js} +2 -2
  111. package/dist/{chunk-3RJU7QFE.js → chunk-VAVCFMMQ.js} +2 -2
  112. package/dist/{chunk-3GHQCNNG.js → chunk-VEPT6DXJ.js} +5 -5
  113. package/dist/{chunk-VH4UCI3R.js → chunk-WVV54HL2.js} +14 -14
  114. package/dist/{chunk-GCHM5BYL.js → chunk-WWQMZBDI.js} +4 -4
  115. package/dist/{chunk-OZNBZJ3S.js → chunk-WZ55LEUN.js} +8 -8
  116. package/dist/{chunk-UM22PKA3.js → chunk-XGDWR2L6.js} +2 -2
  117. package/dist/{chunk-K5CM4M65.js → chunk-XUKBX3GO.js} +13 -13
  118. package/dist/{chunk-YXFY4YOF.js → chunk-Y6IRNAWT.js} +3 -3
  119. package/dist/{chunk-OVZIYLBZ.js → chunk-YCK26VSL.js} +2 -2
  120. package/dist/{chunk-WIV37T4U.js → chunk-YWXFO7G2.js} +5 -5
  121. package/dist/{chunk-QHDBKC5Z.js → chunk-ZFJOPBQD.js} +2 -2
  122. package/dist/cli.js +137 -135
  123. package/dist/coding/export-okf-codegraph.js +22 -22
  124. package/dist/compounding/engine.js +23 -23
  125. package/dist/config.js +26 -26
  126. package/dist/connectors/codex-materialize-runner.js +22 -22
  127. package/dist/connectors/index.js +22 -22
  128. package/dist/consolidation-provenance-check.js +5 -5
  129. package/dist/consolidation-undo.js +4 -4
  130. package/dist/contradiction/index.js +3 -3
  131. package/dist/convergence-refresh.js +24 -24
  132. package/dist/corpus-watermark.js +24 -24
  133. package/dist/cue-anchors.js +5 -5
  134. package/dist/deep-recall-http-glue.js +9 -9
  135. package/dist/deep-recall.js +2 -2
  136. package/dist/{entity-canonical-id-migration-IG77BOGD.js → entity-canonical-id-migration-ZOWR44RK.js} +4 -4
  137. package/dist/entity-retrieval.js +23 -23
  138. package/dist/explicit-capture.js +137 -135
  139. package/dist/extraction.js +26 -26
  140. package/dist/harmonic-construction.js +6 -6
  141. package/dist/harmonic-graph-version.js +3 -3
  142. package/dist/harmonic-retrieval.js +25 -25
  143. package/dist/index.js +201 -197
  144. package/dist/lcm/engine.js +3 -3
  145. package/dist/lcm/index.js +9 -9
  146. package/dist/lcm-summarize-budget.d.ts +13 -0
  147. package/dist/lcm-summarize-budget.d.ts.map +1 -0
  148. package/dist/lcm-summarize-budget.js +11 -0
  149. package/dist/lcm-summarize-budget.js.map +1 -0
  150. package/dist/location/index.js +23 -23
  151. package/dist/maintenance/memory-governance.js +22 -22
  152. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +22 -22
  153. package/dist/maintenance/rebuild-memory-projection-runner.js +24 -24
  154. package/dist/maintenance/rebuild-memory-projection.js +23 -23
  155. package/dist/memory-browse.js +7 -7
  156. package/dist/memory-cache.d.ts +5 -0
  157. package/dist/memory-cache.d.ts.map +1 -1
  158. package/dist/memory-cache.js +9 -1
  159. package/dist/memory-corpus-version.js +2 -2
  160. package/dist/namespaces/migrate.js +23 -23
  161. package/dist/namespaces/search.js +11 -11
  162. package/dist/namespaces/storage.js +22 -22
  163. package/dist/offline-sync-changeset-generations.js +3 -3
  164. package/dist/offline-sync-embedding-generation.js +2 -2
  165. package/dist/offline-sync-snapshot-stream.js +5 -5
  166. package/dist/offline-sync.js +6 -6
  167. package/dist/operator-doctor-corpus.js +25 -25
  168. package/dist/operator-toolkit.js +34 -34
  169. package/dist/orchestration/backlog-scheduler.js +138 -136
  170. package/dist/orchestration/backlog-scheduler.js.map +1 -1
  171. package/dist/orchestration/buffer-drain-runner.js +138 -136
  172. package/dist/orchestration/maintenance.js +30 -30
  173. package/dist/orchestration/orchestrator-helpers.d.ts +3 -15
  174. package/dist/orchestration/orchestrator-helpers.d.ts.map +1 -1
  175. package/dist/orchestration/recall-internal-deps.d.ts +2 -1
  176. package/dist/orchestration/recall-internal-deps.d.ts.map +1 -1
  177. package/dist/orchestration/recall-internal.d.ts.map +1 -1
  178. package/dist/orchestration/recall-search-pipeline.d.ts +3 -10
  179. package/dist/orchestration/recall-search-pipeline.d.ts.map +1 -1
  180. package/dist/orchestrator.d.ts +2 -2
  181. package/dist/orchestrator.d.ts.map +1 -1
  182. package/dist/orchestrator.js +137 -135
  183. package/dist/page-versioning.js +4 -4
  184. package/dist/qmd.js +8 -8
  185. package/dist/recall-composition-decision.js +2 -2
  186. package/dist/recall-navigation.js +137 -135
  187. package/dist/recall-state-view-admission.js +7 -7
  188. package/dist/recall-why-service.js +7 -7
  189. package/dist/{resolution-7XBNQVKU.js → resolution-A3NAI3YE.js} +4 -4
  190. package/dist/resolution-A3NAI3YE.js.map +1 -0
  191. package/dist/resume-bundles.js +27 -27
  192. package/dist/search/factory.js +10 -10
  193. package/dist/search/index.js +14 -14
  194. package/dist/search/lancedb-backend.js +2 -2
  195. package/dist/search/meilisearch-backend.js +2 -2
  196. package/dist/search/orama-backend.js +2 -2
  197. package/dist/search/port.d.ts +2 -0
  198. package/dist/search/port.d.ts.map +1 -1
  199. package/dist/search/port.js +3 -1
  200. package/dist/search/remote-backend.js +2 -2
  201. package/dist/semantic-consolidation.js +23 -23
  202. package/dist/semantic-rule-promotion.js +22 -22
  203. package/dist/semantic-rule-verifier.js +22 -22
  204. package/dist/source-agent-qualifier.js +25 -25
  205. package/dist/standup/build.js +22 -22
  206. package/dist/storage.js +21 -21
  207. package/dist/transfer/autodetect.js +1 -1
  208. package/dist/transfer/backup.js +2 -2
  209. package/dist/transfer/capsule-export.js +3 -3
  210. package/dist/transfer/capsule-import.js +6 -6
  211. package/dist/transfer/export-okf.js +23 -23
  212. package/dist/verified-recall.js +22 -22
  213. package/dist/who-knows-cli.js +23 -23
  214. package/dist/who-knows.js +22 -22
  215. package/package.json +2 -2
  216. package/src/access-mcp.test.ts +25 -0
  217. package/src/access-mcp.ts +2 -0
  218. package/src/access-recall-mcp-search-options.ts +26 -0
  219. package/src/access-recall-surface.ts +2 -3
  220. package/src/access-schema.ts +24 -0
  221. package/src/lcm-summarize-budget.test.ts +66 -0
  222. package/src/lcm-summarize-budget.ts +34 -0
  223. package/src/memory-cache.test.ts +27 -0
  224. package/src/memory-cache.ts +45 -2
  225. package/src/orchestration/orchestrator-helpers.ts +4 -16
  226. package/src/orchestration/recall-internal-deps.ts +2 -0
  227. package/src/orchestration/recall-internal.ts +9 -8
  228. package/src/orchestration/recall-search-pipeline.test.ts +65 -0
  229. package/src/orchestration/recall-search-pipeline.ts +17 -20
  230. package/src/orchestrator.ts +25 -59
  231. package/src/recall-navigation-surface.test.ts +3 -3
  232. package/src/recall-search-options.test.ts +64 -0
  233. package/src/search/port.ts +35 -0
  234. package/dist/chunk-C64XATK7.js.map +0 -1
  235. package/dist/chunk-DIBOWE53.js.map +0 -1
  236. package/dist/chunk-JLD44JR7.js.map +0 -1
  237. package/dist/chunk-NWA6IXR3.js.map +0 -1
  238. package/dist/chunk-VRBGYSSQ.js.map +0 -1
  239. /package/dist/{capsule-crypto-7FJQINUR.js.map → access-recall-mcp-search-options.js.map} +0 -0
  240. /package/dist/{entity-canonical-id-migration-IG77BOGD.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
  241. /package/dist/{capsule-merge-ILR35DIB.js.map → capsule-merge-PCSDJOAO.js.map} +0 -0
  242. /package/dist/{chunk-UF5RTFN3.js.map → chunk-2IMKMMUS.js.map} +0 -0
  243. /package/dist/{chunk-IUXTKLZY.js.map → chunk-2LQUPEWF.js.map} +0 -0
  244. /package/dist/{chunk-27N6SGEY.js.map → chunk-2S4XW47C.js.map} +0 -0
  245. /package/dist/{chunk-DOJBV6WR.js.map → chunk-3DJ6R4CC.js.map} +0 -0
  246. /package/dist/{chunk-BYWNF25B.js.map → chunk-3KQPFIVV.js.map} +0 -0
  247. /package/dist/{chunk-KUQLUYIR.js.map → chunk-4QEDFEBY.js.map} +0 -0
  248. /package/dist/{chunk-PFUXPTBT.js.map → chunk-66DUCUOC.js.map} +0 -0
  249. /package/dist/{chunk-NM6UL4W5.js.map → chunk-6CSWINXA.js.map} +0 -0
  250. /package/dist/{chunk-AA6G3W3B.js.map → chunk-6DHSEJIO.js.map} +0 -0
  251. /package/dist/{chunk-ZANNIXXE.js.map → chunk-6MEQHJTF.js.map} +0 -0
  252. /package/dist/{chunk-342VFB56.js.map → chunk-74BX5NCU.js.map} +0 -0
  253. /package/dist/{chunk-SZ6QV3DY.js.map → chunk-A3EWNU5V.js.map} +0 -0
  254. /package/dist/{chunk-QZUT4VTV.js.map → chunk-AOZYOS4G.js.map} +0 -0
  255. /package/dist/{chunk-O3JG4PD3.js.map → chunk-AW56K4SI.js.map} +0 -0
  256. /package/dist/{chunk-G2CGIFRP.js.map → chunk-AXR472RS.js.map} +0 -0
  257. /package/dist/{chunk-CFSCKCT5.js.map → chunk-B4I37XX6.js.map} +0 -0
  258. /package/dist/{chunk-FREKFMCA.js.map → chunk-B72X3KWL.js.map} +0 -0
  259. /package/dist/{chunk-HXFIILGF.js.map → chunk-BFPF5N3H.js.map} +0 -0
  260. /package/dist/{chunk-ZG4GNPRE.js.map → chunk-BNQJKWWZ.js.map} +0 -0
  261. /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
  262. /package/dist/{chunk-63JPXUFA.js.map → chunk-CBJRI6VJ.js.map} +0 -0
  263. /package/dist/{chunk-USVA4XWY.js.map → chunk-CBTERRF5.js.map} +0 -0
  264. /package/dist/{chunk-DLZGSZVC.js.map → chunk-DLR3SBOM.js.map} +0 -0
  265. /package/dist/{chunk-7NSGKXFD.js.map → chunk-DLX277NS.js.map} +0 -0
  266. /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
  267. /package/dist/{chunk-SU63UQPL.js.map → chunk-E23BTVB2.js.map} +0 -0
  268. /package/dist/{chunk-FONPAA43.js.map → chunk-EDGWAJLS.js.map} +0 -0
  269. /package/dist/{chunk-D6IGZYTN.js.map → chunk-FJEYZSJD.js.map} +0 -0
  270. /package/dist/{chunk-XOOYE37V.js.map → chunk-FJVWKIDV.js.map} +0 -0
  271. /package/dist/{chunk-ITAUMNQU.js.map → chunk-FPII4O7C.js.map} +0 -0
  272. /package/dist/{chunk-DGLNT6VO.js.map → chunk-FYH62SF3.js.map} +0 -0
  273. /package/dist/{chunk-FL3O34XF.js.map → chunk-FYJYQ65N.js.map} +0 -0
  274. /package/dist/{chunk-7YD5XSJK.js.map → chunk-IJBOJJVS.js.map} +0 -0
  275. /package/dist/{chunk-FJTRNFI4.js.map → chunk-JVSHXYOO.js.map} +0 -0
  276. /package/dist/{chunk-3PZDG5ZH.js.map → chunk-JY3WATTF.js.map} +0 -0
  277. /package/dist/{chunk-MGN2RQRG.js.map → chunk-KAGLV5KH.js.map} +0 -0
  278. /package/dist/{chunk-2NJ74RQU.js.map → chunk-LE27GU4M.js.map} +0 -0
  279. /package/dist/{chunk-LPDOCXHH.js.map → chunk-M43GO34S.js.map} +0 -0
  280. /package/dist/{chunk-GAVFANAB.js.map → chunk-MEALRZYB.js.map} +0 -0
  281. /package/dist/{chunk-TAUHAP5J.js.map → chunk-MFDEEOOZ.js.map} +0 -0
  282. /package/dist/{chunk-GNIMBEOK.js.map → chunk-MIG4KRYU.js.map} +0 -0
  283. /package/dist/{chunk-F476AJQJ.js.map → chunk-MPQQIHA7.js.map} +0 -0
  284. /package/dist/{chunk-EIZUL6JC.js.map → chunk-N7LYEA3K.js.map} +0 -0
  285. /package/dist/{chunk-2HI22OK7.js.map → chunk-NLSMLRH4.js.map} +0 -0
  286. /package/dist/{chunk-WGM2KSWN.js.map → chunk-NWS4I4K7.js.map} +0 -0
  287. /package/dist/{chunk-BDIXKROL.js.map → chunk-OV3XHQAB.js.map} +0 -0
  288. /package/dist/{chunk-UX7KPVAM.js.map → chunk-OYHGCAGQ.js.map} +0 -0
  289. /package/dist/{chunk-6WV76JHC.js.map → chunk-OYUTSLBU.js.map} +0 -0
  290. /package/dist/{chunk-SZK2DX5U.js.map → chunk-PCMGMPQZ.js.map} +0 -0
  291. /package/dist/{chunk-4IMMF5W6.js.map → chunk-POXJ3KXJ.js.map} +0 -0
  292. /package/dist/{chunk-H6VQ7L5D.js.map → chunk-QPOWOQYH.js.map} +0 -0
  293. /package/dist/{chunk-KQAFEZQX.js.map → chunk-R45L4TV6.js.map} +0 -0
  294. /package/dist/{chunk-HRMOKGQM.js.map → chunk-RHQSAXN3.js.map} +0 -0
  295. /package/dist/{chunk-3DAWHP5K.js.map → chunk-RQBYC7EK.js.map} +0 -0
  296. /package/dist/{chunk-NCS2NXSP.js.map → chunk-RSRHWNNM.js.map} +0 -0
  297. /package/dist/{chunk-EGDUG2ZX.js.map → chunk-RVUD4WN3.js.map} +0 -0
  298. /package/dist/{chunk-M5GVCJSJ.js.map → chunk-TVWLYSX4.js.map} +0 -0
  299. /package/dist/{chunk-JCBKGPFE.js.map → chunk-UC3KG7KX.js.map} +0 -0
  300. /package/dist/{chunk-O3GZPLVY.js.map → chunk-UUSL22HE.js.map} +0 -0
  301. /package/dist/{chunk-3RJU7QFE.js.map → chunk-VAVCFMMQ.js.map} +0 -0
  302. /package/dist/{chunk-3GHQCNNG.js.map → chunk-VEPT6DXJ.js.map} +0 -0
  303. /package/dist/{chunk-VH4UCI3R.js.map → chunk-WVV54HL2.js.map} +0 -0
  304. /package/dist/{chunk-GCHM5BYL.js.map → chunk-WWQMZBDI.js.map} +0 -0
  305. /package/dist/{chunk-OZNBZJ3S.js.map → chunk-WZ55LEUN.js.map} +0 -0
  306. /package/dist/{chunk-UM22PKA3.js.map → chunk-XGDWR2L6.js.map} +0 -0
  307. /package/dist/{chunk-K5CM4M65.js.map → chunk-XUKBX3GO.js.map} +0 -0
  308. /package/dist/{chunk-YXFY4YOF.js.map → chunk-Y6IRNAWT.js.map} +0 -0
  309. /package/dist/{chunk-OVZIYLBZ.js.map → chunk-YCK26VSL.js.map} +0 -0
  310. /package/dist/{chunk-WIV37T4U.js.map → chunk-YWXFO7G2.js.map} +0 -0
  311. /package/dist/{chunk-QHDBKC5Z.js.map → chunk-ZFJOPBQD.js.map} +0 -0
  312. /package/dist/{resolution-7XBNQVKU.js.map → entity-canonical-id-migration-ZOWR44RK.js.map} +0 -0
@@ -261,10 +261,52 @@ interface QmdCacheEntry {
261
261
  const QMD_CACHE_TTL_MS = 60_000;
262
262
  const qmdSearchCache = new Map<string, QmdCacheEntry>();
263
263
 
264
+ /** While depth > 0, QMD search cache uses extended TTL (primary + top-up share one recall cycle, R4). */
265
+ let qmdSearchCacheRecallScopeDepth = 0;
266
+ let qmdSearchCacheRecallTtlMs: number | undefined;
267
+
268
+ export function beginQmdSearchCacheRecallScope(ttlMs: number): void {
269
+ if (!Number.isFinite(ttlMs) || ttlMs <= 0) return;
270
+ const next = Math.floor(ttlMs);
271
+ qmdSearchCacheRecallScopeDepth += 1;
272
+ qmdSearchCacheRecallTtlMs = Math.max(qmdSearchCacheRecallTtlMs ?? 0, next);
273
+ }
274
+
275
+ export function endQmdSearchCacheRecallScope(): void {
276
+ if (qmdSearchCacheRecallScopeDepth <= 0) return;
277
+ qmdSearchCacheRecallScopeDepth -= 1;
278
+ if (qmdSearchCacheRecallScopeDepth === 0) {
279
+ qmdSearchCacheRecallTtlMs = undefined;
280
+ }
281
+ }
282
+
283
+ export async function runInQmdSearchCacheRecallScope<T>(
284
+ ttlMs: number,
285
+ run: () => Promise<T>,
286
+ ): Promise<T> {
287
+ const acquired = Number.isFinite(ttlMs) && ttlMs > 0;
288
+ if (acquired) beginQmdSearchCacheRecallScope(ttlMs);
289
+ try {
290
+ return await run();
291
+ } finally {
292
+ if (acquired) endQmdSearchCacheRecallScope();
293
+ }
294
+ }
295
+
296
+ /** Observable refcount for unit tests (R4 scope guard). */
297
+ export function peekQmdSearchCacheRecallScopeDepth(): number {
298
+ return qmdSearchCacheRecallScopeDepth;
299
+ }
300
+
301
+ function effectiveQmdSearchCacheTtlMs(): number {
302
+ return Math.max(QMD_CACHE_TTL_MS, qmdSearchCacheRecallTtlMs ?? 0);
303
+ }
304
+
264
305
  export function getCachedQmdSearch(cacheKey: string): unknown[] | null {
265
306
  const entry = qmdSearchCache.get(cacheKey);
266
307
  if (!entry) return null;
267
- if (Date.now() - entry.cachedAt > QMD_CACHE_TTL_MS) {
308
+ const ttl = effectiveQmdSearchCacheTtlMs();
309
+ if (Date.now() - entry.cachedAt > ttl) {
268
310
  qmdSearchCache.delete(cacheKey);
269
311
  return null;
270
312
  }
@@ -276,8 +318,9 @@ export function setCachedQmdSearch(cacheKey: string, results: unknown[]): void {
276
318
  // Evict old entries to prevent unbounded growth
277
319
  if (qmdSearchCache.size > 200) {
278
320
  const now = Date.now();
321
+ const ttl = effectiveQmdSearchCacheTtlMs();
279
322
  for (const [key, entry] of qmdSearchCache) {
280
- if (now - entry.cachedAt > QMD_CACHE_TTL_MS) qmdSearchCache.delete(key);
323
+ if (now - entry.cachedAt > ttl) qmdSearchCache.delete(key);
281
324
  }
282
325
  }
283
326
  }
@@ -1,18 +1,4 @@
1
- /**
2
- * Orchestrator module-level helpers — relocated from orchestrator.ts
3
- * (issue #1526, seam 25).
4
- *
5
- * Pure functions, types, and constants that previously lived at module
6
- * level in orchestrator.ts: recall-mode planning, recall snapshots and
7
- * parsers, abort/race helpers, artifact recall limits, replay
8
- * source-time slicing, day-summary date utilities, and QMD startup
9
- * checks. orchestrator.ts re-exports the previously-public names so
10
- * every existing importer (coordinators, tests, root shims) keeps
11
- * working unchanged.
12
- *
13
- * Behavior-preserving move — no logic changes.
14
- */
15
-
1
+ /** Orchestrator module-level helpers relocated from orchestrator.ts (#1526); behavior-preserving move. */
16
2
  import { createHash } from "node:crypto";
17
3
  import os from "node:os";
18
4
  import path from "node:path";
@@ -26,7 +12,7 @@ import { log } from "../logger.js";
26
12
  import type { GraphRecallRankedResult, GraphRecallShadowComparison } from "./graph-recall-coordinator.js";
27
13
  import { parseQmdExplain } from "../qmd.js";
28
14
  import type { GraphRecallExpandedEntry } from "../recall-state.js";
29
- import type { SearchDegradation } from "../search/port.js";
15
+ import type { SearchDegradation, SearchQueryOptions } from "../search/port.js";
30
16
  import type { RecallXrayServedBy } from "../recall-xray.js";
31
17
  import type { RecallContextComposition } from "../recall-context-composition.js";
32
18
  import { type BufferTurn, type MemoryActionEvent, type MemoryFile, type MemoryFrontmatter, type MemoryIntent, type PluginConfig, type QmdSearchResult, type RecallPlanMode, confidenceTier } from "../types.js";
@@ -262,6 +248,8 @@ export interface RecallInvocationOptions {
262
248
  * config flag; a change-intent query is still required for any effect.
263
249
  */
264
250
  stateView?: boolean;
251
+ /** Per-call QMD options (HTTP/MCP `searchOptions`). */
252
+ searchOptions?: SearchQueryOptions;
265
253
  /**
266
254
  * User-aware context scopes active for this recall. Used by X-ray
267
255
  * provenance safety checks so boundary-scoped memories are evaluated
@@ -92,6 +92,7 @@ export interface RecallInternalDeps {
92
92
  deadlineAtMs?: number | null;
93
93
  /** Issue #681 — when true, bypass graphTraversalConfidenceFloor. */
94
94
  includeLowConfidence?: boolean;
95
+ searchOptions?: SearchQueryOptions;
95
96
  }): Promise<QmdSearchResult[]>;
96
97
  applyTrustScoreToBranch(
97
98
  results: QmdSearchResult[],
@@ -144,6 +145,7 @@ export interface RecallInternalDeps {
144
145
  buildCompressionGuidelineRecallSection(): Promise<string | null>;
145
146
  buildConfiguredQmdSearchOptions(
146
147
  queryText: string,
148
+ requestOverride?: SearchQueryOptions,
147
149
  ): SearchQueryOptions | undefined;
148
150
  buildGraphRecallRankedResults(
149
151
  results: QmdSearchResult[],
@@ -346,8 +346,7 @@ export class RecallInternalCoordinator {
346
346
  this.deps.profiler.endSpan("planning", profileTraceId);
347
347
  const recallMode: RecallPlanMode = requestedMode ?? recallDecision.effectiveMode;
348
348
  const queryIntent = inferIntentFromText(retrievalQuery);
349
- const qmdSearchOptions =
350
- this.deps.buildConfiguredQmdSearchOptions(retrievalQuery);
349
+ const qmdSearchOptions = this.deps.buildConfiguredQmdSearchOptions(retrievalQuery, options.searchOptions);
351
350
  timings.recallPlan = recallMode;
352
351
  const plannerRecallResultLimit =
353
352
  recallMode === "no_recall"
@@ -4224,11 +4223,10 @@ export class RecallInternalCoordinator {
4224
4223
  deadlineAtMs: enrichmentAssemblyDeadlineAtMs,
4225
4224
  asOfMs,
4226
4225
  requestingConnector: options.sourceConnector,
4226
+ searchOptions: qmdSearchOptions,
4227
4227
  ...(options.includeLowConfidence === true ? { includeLowConfidence: true } : {}),
4228
4228
  });
4229
- // Issue #1577 — read the cold pipeline's trust map back so cold
4230
- // results feed X-ray + epistemic rendering + publisher quarantine
4231
- // filtering (rule 41 parity; review: the sink was never read back).
4229
+ // #1577: read cold trust map back for X-ray/epistemic (rule 41).
4232
4230
  recallTrustByPath = trustByPathSink.trustByPath;
4233
4231
  if (longTerm.length > 0) {
4234
4232
  if (shouldPersistGraphSnapshot) {
@@ -4471,9 +4469,10 @@ export class RecallInternalCoordinator {
4471
4469
  deadlineAtMs: enrichmentAssemblyDeadlineAtMs,
4472
4470
  asOfMs,
4473
4471
  requestingConnector: options.sourceConnector,
4472
+ searchOptions: qmdSearchOptions,
4474
4473
  ...(options.includeLowConfidence === true ? { includeLowConfidence: true } : {}),
4475
4474
  });
4476
- // Issue #1577 — read the cold pipeline's trust map back (rule 41).
4475
+ // #1577: cold trust map back.
4477
4476
  recallTrustByPath = trustByPathSink.trustByPath;
4478
4477
  if (longTerm.length > 0) {
4479
4478
  recallSource = "cold_fallback";
@@ -4651,9 +4650,10 @@ export class RecallInternalCoordinator {
4651
4650
  deadlineAtMs: enrichmentAssemblyDeadlineAtMs,
4652
4651
  asOfMs,
4653
4652
  requestingConnector: options.sourceConnector,
4653
+ searchOptions: qmdSearchOptions,
4654
4654
  ...(options.includeLowConfidence === true ? { includeLowConfidence: true } : {}),
4655
4655
  });
4656
- // Issue #1577 — read the cold pipeline's trust map back (rule 41).
4656
+ // #1577: cold trust map back.
4657
4657
  recallTrustByPath = trustByPathSink.trustByPath;
4658
4658
  if (longTerm.length > 0) {
4659
4659
  if (shouldPersistGraphSnapshot) {
@@ -4710,9 +4710,10 @@ export class RecallInternalCoordinator {
4710
4710
  deadlineAtMs: enrichmentAssemblyDeadlineAtMs,
4711
4711
  asOfMs,
4712
4712
  requestingConnector: options.sourceConnector,
4713
+ searchOptions: qmdSearchOptions,
4713
4714
  ...(options.includeLowConfidence === true ? { includeLowConfidence: true } : {}),
4714
4715
  });
4715
- // Issue #1577 — read the cold pipeline's trust map back (rule 41).
4716
+ // #1577: cold trust map back.
4716
4717
  recallTrustByPath = trustByPathSink.trustByPath;
4717
4718
  if (longTerm.length > 0) {
4718
4719
  if (shouldPersistGraphSnapshot) {
@@ -15,6 +15,24 @@ function result(namespace: string, path: string): QmdSearchResult {
15
15
  return { docid: `${namespace}:${path}`, namespace, path, score: 1, snippet: path };
16
16
  }
17
17
 
18
+ /** Unit stub: only search/hybridSearch are exercised by hybrid top-up tests. */
19
+ function makeHybridTopUpStubCoordinator(
20
+ qmd: Pick<RecallSearchPipelineDeps["qmd"], "search" | "hybridSearch">,
21
+ namespaceFromPath: (p: string) => string,
22
+ ): RecallSearchPipelineCoordinator {
23
+ const partial = {
24
+ config: {
25
+ memoryDir: "/mem",
26
+ qmdSearchStrategy: "hybrid",
27
+ searchBackend: "qmd",
28
+ },
29
+ qmd,
30
+ namespaceFromPath,
31
+ };
32
+ // SAFETY: hybrid top-up tests call fetchQmdMemoryResultsWithArtifactTopUp only; other deps are never read.
33
+ return new RecallSearchPipelineCoordinator(partial as RecallSearchPipelineDeps);
34
+ }
35
+
18
36
  function memory(path: string, status: string): MemoryFile {
19
37
  return {
20
38
  path,
@@ -523,6 +541,53 @@ test("QMD hybrid top-up runs when primary results are archive-only", async () =>
523
541
  assert.deepEqual(out.map((candidate) => candidate.path), ["facts/hybrid-live.md"]);
524
542
  });
525
543
 
544
+ test("QMD skips hybrid top-up when namespace-deliverable page is already full", async () => {
545
+ const inScope = Array.from({ length: 4 }, (_, index) =>
546
+ resultScored("default", `facts/in-scope-${index}.md`, 1 - index * 0.01),
547
+ );
548
+ const outOfScope = Array.from({ length: 4 }, (_, index) =>
549
+ resultScored("other-ns", `facts/other-${index}.md`, 2),
550
+ );
551
+ let hybridCalls = 0;
552
+ const coordinator = makeHybridTopUpStubCoordinator(
553
+ {
554
+ search: async () => [...inScope, ...outOfScope],
555
+ hybridSearch: async () => {
556
+ hybridCalls += 1;
557
+ return [resultScored("default", "facts/hybrid-extra.md", 0.5)];
558
+ },
559
+ },
560
+ (p: string) => (p.includes("other") ? "other-ns" : "default"),
561
+ );
562
+
563
+ const out = await coordinator.fetchQmdMemoryResultsWithArtifactTopUp(
564
+ "namespace-saturated",
565
+ 4,
566
+ 4,
567
+ {
568
+ namespacesEnabled: true,
569
+ recallNamespaces: ["default"],
570
+ resolveNamespace: (p: string) =>
571
+ p.includes("other") ? "other-ns" : "default",
572
+ collection: "openclaw-engram",
573
+ queryAwarePrefilter: {
574
+ candidatePaths: null,
575
+ temporalFromDate: null,
576
+ matchedTags: [],
577
+ expandedTags: [],
578
+ combination: "none",
579
+ filteredToFullSearch: false,
580
+ },
581
+ },
582
+ );
583
+
584
+ assert.equal(hybridCalls, 0, "raw recallable count must not force hybrid when deliverable page is full");
585
+ assert.deepEqual(
586
+ out.map((candidate) => candidate.path),
587
+ inScope.map((r) => r.path),
588
+ );
589
+ });
590
+
526
591
  test("QMD stops after an underfilled archive-only page", async () => {
527
592
  const archived = [resultScored("default", "archive/2026-07-25/only.md", 2)];
528
593
  let searchCalls = 0;
@@ -70,6 +70,7 @@ import {
70
70
  type QueryAwarePrefilter,
71
71
  } from "../orchestrator.js";
72
72
  import { isActivityDigestPath } from "./orchestrator-helpers.js";
73
+ import { runInQmdSearchCacheRecallScope } from "../memory-cache.js";
73
74
  import { isGenericRecallExcludedPath, isTopLevelArchivePath } from "./generic-recall-paths.js";
74
75
  import { isSupportPassportPrivateMemory } from "../support-passport/card-projection.js";
75
76
 
@@ -108,9 +109,7 @@ export interface RecallSearchPipelineDeps {
108
109
  requestingConnector?: string;
109
110
  },
110
111
  ): Promise<QmdSearchResult[]>;
111
- buildConfiguredQmdSearchOptions(
112
- queryText: string,
113
- ): SearchQueryOptions | undefined;
112
+ buildConfiguredQmdSearchOptions(queryText: string, requestOverride?: SearchQueryOptions): SearchQueryOptions | undefined;
114
113
  buildQueryAwarePrefilter(
115
114
  prompt: string,
116
115
  recallNamespaces: string[],
@@ -275,7 +274,6 @@ export class RecallSearchPipelineCoordinator {
275
274
  return buildQueryAwarePrefilterHelper(this.deps, prompt, recallNamespaces);
276
275
  }
277
276
 
278
-
279
277
  async fetchQmdMemoryResultsWithArtifactTopUp(
280
278
  prompt: string,
281
279
  qmdFetchLimit: number,
@@ -319,6 +317,7 @@ export class RecallSearchPipelineCoordinator {
319
317
  const qmdRecallBudgetMs = this.deps.config.recallEnrichmentDeadlineMs ?? 60_000;
320
318
  const qmdRecallBudgetEnabled = qmdRecallBudgetMs > 0;
321
319
  const startedAtMs = Date.now();
320
+ return runInQmdSearchCacheRecallScope(qmdRecallBudgetMs, async () => {
322
321
  let lastPrimaryResultCount = 0;
323
322
  let lastHybridResultCount = 0;
324
323
  let lastHybridTopUpUsed = false;
@@ -432,14 +431,19 @@ export class RecallSearchPipelineCoordinator {
432
431
  lastHybridTopUpUsed = false;
433
432
  lastHybridTopUpSkippedReason = undefined;
434
433
  let mergedResults = primaryResults;
435
- const primaryRecallableCount = primaryResults.filter(recallable).length;
434
+ const primaryDeliverableCount = filterRecallCandidates(primaryResults, {
435
+ namespacesEnabled: options.namespacesEnabled,
436
+ recallNamespaces: options.recallNamespaces,
437
+ resolveNamespace: options.resolveNamespace,
438
+ limit: qmdFetchLimit,
439
+ pathPolicy: this.deps.config,
440
+ }).length;
436
441
  const primaryIncludesArchivePath = primaryResults.some((result) =>
437
442
  isTopLevelArchivePath(result.path, this.deps.config, "qmd"),
438
443
  );
439
-
440
- // Backfill with hybrid results when the recallable primary page underfills.
441
- if (
442
- primaryRecallableCount < qmdFetchLimit &&
444
+ if (primaryDeliverableCount >= qmdFetchLimit) {
445
+ lastHybridTopUpSkippedReason = "primary_deliverable_sufficient";
446
+ } else if (
443
447
  (primaryResults.length < qmdFetchLimit || primaryIncludesArchivePath) &&
444
448
  (!qmdRecallBudgetEnabled ||
445
449
  Date.now() - startedAtMs < qmdRecallBudgetMs)
@@ -540,6 +544,7 @@ export class RecallSearchPipelineCoordinator {
540
544
  const capped = bestFiltered.slice(0, qmdFetchLimit);
541
545
  await emitDebugSnapshot(capped, fetchLimit);
542
546
  return await applyDirectorySidecarDrillDown(this.deps.storage?.dir ?? "", prompt, capped, { enabled: Boolean(this.deps.storage?.dir) && isDirectorySidecarsEnabledForDir(this.deps.storage.dir), namespaces: options.namespacesEnabled ? options.recallNamespaces ?? [] : undefined });
547
+ });
543
548
  }
544
549
 
545
550
  async searchEmbeddingFallback(
@@ -562,7 +567,6 @@ export class RecallSearchPipelineCoordinator {
562
567
  return searchQueryAwareFallbackHelper(this.deps, prompt, limit, queryAwarePrefilter, abortSignal);
563
568
  }
564
569
 
565
-
566
570
  async applyColdFallbackPipeline(options: {
567
571
  prompt: string;
568
572
  recallNamespaces: string[];
@@ -594,19 +598,12 @@ export class RecallSearchPipelineCoordinator {
594
598
  */
595
599
  xrayPoolSizeSink?: { size: number };
596
600
  resultPartitionSink?: RecallResultPartitionSink;
597
- /**
598
- * Issue #1577 — out-parameter that receives the TrustScore stage's
599
- * per-path trust map (admitted + quarantined) when the cold path runs
600
- * trust scoring. Mirrors the xrayPoolSizeSink pattern so recallInternal
601
- can propagate trust data for epistemic rendering and X-ray visibility
602
- without changing the cold pipeline's return type.
603
- */
601
+ /** #1577 trust map out-param (xrayPoolSizeSink pattern). */
604
602
  trustByPathSink?: { trustByPath: Map<string, TrustStageResultItem> | null };
605
603
  deadlineAtMs?: number | null;
606
- /** Issue #681 — when true, bypass graphTraversalConfidenceFloor. */
607
604
  includeLowConfidence?: boolean;
608
- /** #1952 state-view admission — resolved by the caller from config/override + change intent. */
609
605
  stateViewActive?: boolean;
606
+ searchOptions?: SearchQueryOptions;
610
607
  }): Promise<QmdSearchResult[]> {
611
608
  // Prefer the threaded set; fall back to a config-derived set so direct
612
609
  // callers (unit tests) behave identically to the recall pipeline (#1523).
@@ -726,7 +723,7 @@ export class RecallSearchPipelineCoordinator {
726
723
  resolveNamespace: (p) => this.deps.namespaceFromPath(p),
727
724
  collection: coldCollection,
728
725
  queryAwarePrefilter: options.queryAwarePrefilter,
729
- searchOptions: this.deps.buildConfiguredQmdSearchOptions(options.prompt),
726
+ searchOptions: this.deps.buildConfiguredQmdSearchOptions(options.prompt, options.searchOptions),
730
727
  abortSignal: stepSignal,
731
728
  onDegradation: (degradation) => {
732
729
  if (coldQmdObserverActive) {
@@ -71,11 +71,12 @@ import {
71
71
  // legacy archive path — replaced by skip-with-warning (Finding 2 — Urgw).
72
72
  // stripCitationForTemplate IS used for pre-tagged dedup canonicalization.
73
73
  import { findUnresolvedEntityRefs } from "./reconstruct.js";
74
- import type {
75
- SearchBackend,
76
- SearchDegradation,
77
- SearchExecutionOptions,
78
- SearchQueryOptions,
74
+ import {
75
+ mergeSearchQueryOptions,
76
+ type SearchBackend,
77
+ type SearchDegradation,
78
+ type SearchExecutionOptions,
79
+ type SearchQueryOptions,
79
80
  } from "./search/port.js";
80
81
  import {
81
82
  createSearchBackend,
@@ -108,7 +109,7 @@ import { LifecyclePolicyCoordinator } from "./orchestration/lifecycle-policy-coo
108
109
  import { EntitySynthesisCoordinator } from "./orchestration/entity-synthesis-coordinator.js";
109
110
  import { RecallResultFormatter } from "./orchestration/recall-result-formatter.js";
110
111
  import { ConversationIndexCoordinator } from "./orchestration/conversation-index-coordinator.js";
111
- import { RecallRerankCoordinator, type RecallResultPartitionSink } from "./orchestration/recall-rerank-coordinator.js";
112
+ import { RecallRerankCoordinator } from "./orchestration/recall-rerank-coordinator.js";
112
113
  import {
113
114
  RecallSectionCoordinator,
114
115
  type RecallSectionAppendOptions,
@@ -438,6 +439,7 @@ import {
438
439
  type MemoryIntent,
439
440
  type MemorySummary,
440
441
  } from "./types.js";
442
+ import { scaleLcmSummarizeBudget } from "./lcm-summarize-budget.js";
441
443
  import { LcmEngine } from "./lcm/index.js";
442
444
  import { shouldSkipImplicitExtraction } from "./explicit-capture.js";
443
445
  import {
@@ -1315,8 +1317,9 @@ export class Orchestrator {
1315
1317
  return summarizeNamespaceMaintenanceHealth(this.config);
1316
1318
  }
1317
1319
 
1318
- private buildConfiguredQmdSearchOptions(
1320
+ buildConfiguredQmdSearchOptions(
1319
1321
  queryText: string,
1322
+ requestOverride?: SearchQueryOptions,
1320
1323
  ): SearchQueryOptions | undefined {
1321
1324
  const intentHint = resolveQmdCapabilities(this.config).qmdIntentHints
1322
1325
  ? buildQmdIntentHint(inferIntentFromText(queryText))
@@ -1329,7 +1332,10 @@ export class Orchestrator {
1329
1332
  if (explain) {
1330
1333
  searchOptions.explain = true;
1331
1334
  }
1332
- return Object.keys(searchOptions).length > 0 ? searchOptions : undefined;
1335
+ return mergeSearchQueryOptions(
1336
+ Object.keys(searchOptions).length > 0 ? searchOptions : undefined,
1337
+ requestOverride,
1338
+ );
1333
1339
  }
1334
1340
 
1335
1341
  async searchAcrossNamespaces(options: {
@@ -1767,17 +1773,19 @@ export class Orchestrator {
1767
1773
  targetTokens: number,
1768
1774
  aggressive: boolean,
1769
1775
  ) => {
1776
+ const budget = scaleLcmSummarizeBudget(text, targetTokens);
1777
+ const { promptText, effectiveTargetTokens, maxCompletionTokens } = budget;
1770
1778
  const instructionText = aggressive
1771
- ? `Compress the following into bullet points. One bullet per distinct fact or decision. Maximum ${targetTokens} tokens total. No prose.`
1772
- : `Compress the following conversation segment into a dense summary. Preserve: decisions made, code artifacts mentioned, errors encountered, open questions, and any commitments or next-steps. Omit: pleasantries, restatements, and anything the agent would not need to recall later. Output a single paragraph, maximum ${targetTokens} tokens.`;
1779
+ ? `Compress the following into bullet points. One bullet per distinct fact or decision. Maximum ${effectiveTargetTokens} tokens total. No prose.`
1780
+ : `Compress the following conversation segment into a dense summary. Preserve: decisions made, code artifacts mentioned, errors encountered, open questions, and any commitments or next-steps. Omit: pleasantries, restatements, and anything the agent would not need to recall later. Output a single paragraph, maximum ${effectiveTargetTokens} tokens.`;
1773
1781
  try {
1774
1782
  const messages = [
1775
1783
  { role: "system" as const, content: instructionText },
1776
- { role: "user" as const, content: text.slice(0, 12000) },
1784
+ { role: "user" as const, content: promptText },
1777
1785
  ];
1778
1786
  const result = this.config.modelSource === "gateway" && this._fastGatewayLlm
1779
1787
  ? await this._fastGatewayLlm.chatCompletion(messages, {
1780
- maxTokens: targetTokens * 2,
1788
+ maxTokens: maxCompletionTokens,
1781
1789
  timeoutMs: this.config.localLlmFastTimeoutMs,
1782
1790
  // LCM is latency-sensitive. A configured fast persona is the
1783
1791
  // explicit fast-tier route; otherwise use taskModelChain so LCM
@@ -1787,7 +1795,7 @@ export class Orchestrator {
1787
1795
  : gatewayTaskChainOptions(this.config)),
1788
1796
  })
1789
1797
  : await this.fastLlm.chatCompletion(messages, {
1790
- maxTokens: targetTokens * 2,
1798
+ maxTokens: maxCompletionTokens,
1791
1799
  operation: "lcm-summarize",
1792
1800
  priority: "background",
1793
1801
  });
@@ -3621,52 +3629,10 @@ export class Orchestrator {
3621
3629
  );
3622
3630
  }
3623
3631
 
3624
- private async applyColdFallbackPipeline(options: {
3625
- prompt: string;
3626
- recallNamespaces: string[];
3627
- recallResultLimit: number;
3628
- recallMode: RecallPlanMode;
3629
- /**
3630
- * Recall-operation capability gates resolved once at recall entry (#1523).
3631
- * OPTIONAL and additive: the recall pipeline threads a resolved set, but
3632
- * callers that omit it (e.g. direct unit-test invocations) get an
3633
- * equivalent config-derived set — behavior-preserving.
3634
- */
3635
- caps?: CapabilitySet;
3636
- /** Graph-construction gates resolved at recall entry (#1566 Cluster A). */
3637
- graphCaps?: GraphConstructionCapabilitySet;
3638
- queryAwarePrefilter?: QueryAwarePrefilter;
3639
- abortSignal?: AbortSignal;
3640
- /** Backend degradation observer — cold-tier QMD must report like hot (#1536). */
3641
- onDegradation?: (degradation: SearchDegradation) => void;
3642
- /** Issue #680 — historical recall point in ms-since-epoch. */
3643
- asOfMs?: number;
3644
- requestingConnector?: string;
3645
- /**
3646
- * Optional out-parameter that receives the pre-MMR / pre-truncation
3647
- * pool size captured inside the pipeline (issue #570 PR 1). The
3648
- * X-ray capture block in `recallInternal` passes a small sink so
3649
- * the cold-fallback branch's pre-truncation pool size can be
3650
- * attributed back to the branch when `recallSource === "cold_fallback"`.
3651
- * Unset by default so existing call sites are unaffected.
3652
- */
3653
- xrayPoolSizeSink?: { size: number };
3654
- resultPartitionSink?: RecallResultPartitionSink;
3655
- /**
3656
- * Issue #1577 — out-parameter that receives the TrustScore stage's
3657
- * per-path trust map (admitted + quarantined) when the cold path runs
3658
- * trust scoring. Mirrors the xrayPoolSizeSink pattern so recallInternal
3659
- can propagate trust data for epistemic rendering and X-ray visibility
3660
- without changing the cold pipeline's return type.
3661
- */
3662
- trustByPathSink?: { trustByPath: Map<string, TrustStageResultItem> | null };
3663
- deadlineAtMs?: number | null;
3664
- /** Issue #681 — when true, bypass graphTraversalConfidenceFloor. */
3665
- includeLowConfidence?: boolean;
3666
- }): Promise<QmdSearchResult[]> {
3667
- return this.recallSearchPipelineCoordinator.applyColdFallbackPipeline(
3668
- options,
3669
- );
3632
+ private async applyColdFallbackPipeline(
3633
+ options: Parameters<RecallSearchPipelineCoordinator["applyColdFallbackPipeline"]>[0],
3634
+ ): Promise<QmdSearchResult[]> {
3635
+ return this.recallSearchPipelineCoordinator.applyColdFallbackPipeline(options);
3670
3636
  }
3671
3637
 
3672
3638
  // ---------------------------------------------------------------------------
@@ -460,12 +460,12 @@ test("CLI navigate expand uses the shared service and accepts a handle", async (
460
460
  });
461
461
 
462
462
  test("god files stay under ratchet caps after navigation review fixes", async () => {
463
- const caps: Record<string, number> = {
463
+ const caps = {
464
464
  "access-service.ts": 5910,
465
465
  "config.ts": 4568,
466
466
  "cli.ts": 9428,
467
- "orchestration/recall-internal.ts": 5344,
468
- };
467
+ "orchestration/recall-internal.ts": 5347,
468
+ } satisfies Record<string, number>;
469
469
  for (const [rel, cap] of Object.entries(caps)) {
470
470
  const text = await readFile(path.join(import.meta.dirname, rel), "utf8");
471
471
  const lines = text.endsWith("\n") ? text.slice(0, -1).split("\n").length : text.split("\n").length;
@@ -0,0 +1,64 @@
1
+ import test from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { parseConfig } from "./config.js";
4
+ import { recallRequestSchema, validateRequest, type RecallRequest } from "./access-schema.js";
5
+ import { mergeSearchQueryOptions } from "./search/port.js";
6
+ import { Orchestrator } from "./orchestrator.js";
7
+
8
+ test("recallRequestSchema accepts structuredSearches under searchOptions", () => {
9
+ const ok = recallRequestSchema.safeParse({
10
+ query: "q",
11
+ searchOptions: { rerank: false, structuredSearches: [{ type: "lex", query: "q" }] },
12
+ });
13
+ assert.equal(ok.success, true);
14
+ });
15
+
16
+ test("recallRequestSchema accepts searchOptions.rerank and rejects unknown nested keys", () => {
17
+ const ok = recallRequestSchema.safeParse({
18
+ query: "cos388",
19
+ searchOptions: { rerank: false },
20
+ });
21
+ assert.equal(ok.success, true);
22
+ assert.equal(ok.success && ok.data.searchOptions?.rerank, false);
23
+
24
+ const strict = recallRequestSchema.safeParse({
25
+ query: "cos388",
26
+ searchOptions: { rerank: false, extra: true },
27
+ });
28
+ assert.equal(strict.success, false, "nested searchOptions must be strict");
29
+ });
30
+
31
+ test("validateRequest(recall) preserves searchOptions for HTTP", () => {
32
+ const parsed = validateRequest<RecallRequest>("recall", {
33
+ query: "hello",
34
+ searchOptions: { rerank: false, explain: true },
35
+ });
36
+ assert.equal(parsed.success, true);
37
+ if (parsed.success) {
38
+ assert.deepEqual(parsed.data.searchOptions, { rerank: false, explain: true });
39
+ }
40
+ });
41
+
42
+ test("mergeSearchQueryOptions: rerank false, explain false, rerank true no-op", () => {
43
+ const merged = mergeSearchQueryOptions({ explain: true, intent: "goal:review" }, { rerank: false });
44
+ assert.deepEqual(merged, { explain: true, intent: "goal:review", rerank: false });
45
+ const explainOff = mergeSearchQueryOptions({ explain: true }, { explain: false });
46
+ assert.deepEqual(explainOff, { explain: false });
47
+ const noop = mergeSearchQueryOptions({ explain: true }, { rerank: true });
48
+ assert.deepEqual(noop, { explain: true });
49
+ });
50
+
51
+ test("buildConfiguredQmdSearchOptions threads recall searchOptions override", () => {
52
+ const cfg = parseConfig({
53
+ openaiApiKey: "sk-test",
54
+ memoryDir: "/tmp/mem",
55
+ workspaceDir: "/tmp/ws",
56
+ qmdIntentHintsEnabled: false,
57
+ qmdExplainEnabled: false,
58
+ });
59
+ const orchestrator = new Orchestrator(cfg);
60
+ const off = orchestrator.buildConfiguredQmdSearchOptions("fleet status", { rerank: false });
61
+ assert.deepEqual(off, { rerank: false });
62
+ const none = orchestrator.buildConfiguredQmdSearchOptions("fleet status");
63
+ assert.equal(none, undefined);
64
+ });
@@ -12,6 +12,41 @@ export interface SearchQueryOptions {
12
12
  structuredSearches?: Array<{ type: "lex" | "vec" | "hyde"; query: string }>;
13
13
  }
14
14
 
15
+ /** Merge config-derived QMD options with an optional per-recall HTTP/MCP override. */
16
+ export function mergeSearchQueryOptions(
17
+ configured: SearchQueryOptions | undefined,
18
+ request?: SearchQueryOptions,
19
+ ): SearchQueryOptions | undefined {
20
+ if (!configured && !request) return undefined;
21
+ const out: SearchQueryOptions = { ...(configured ?? {}) };
22
+ if (!request) {
23
+ return Object.keys(out).length > 0 ? out : undefined;
24
+ }
25
+ if (request.intent !== undefined) {
26
+ const intent = request.intent.trim();
27
+ if (intent.length > 0) out.intent = intent;
28
+ }
29
+ if (request.explain !== undefined) {
30
+ out.explain = request.explain;
31
+ }
32
+ // QMD wire path only honors explicit opt-out (`rerank: false`); `true` is a no-op.
33
+ if (request.rerank === false) out.rerank = false;
34
+ if (request.chunkStrategy === "auto" || request.chunkStrategy === "regex") {
35
+ out.chunkStrategy = request.chunkStrategy;
36
+ }
37
+ if (
38
+ request.candidateLimit !== undefined &&
39
+ Number.isFinite(request.candidateLimit) &&
40
+ request.candidateLimit > 0
41
+ ) {
42
+ out.candidateLimit = Math.floor(request.candidateLimit);
43
+ }
44
+ if (request.structuredSearches !== undefined && request.structuredSearches.length > 0) {
45
+ out.structuredSearches = request.structuredSearches;
46
+ }
47
+ return Object.keys(out).length > 0 ? out : undefined;
48
+ }
49
+
15
50
  /**
16
51
  * A search that returned empty (or partial) results because the backend was
17
52
  * unavailable, still loading, or timed out — cases that are otherwise