@remnic/core 10.0.164 → 10.0.166

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 (418) hide show
  1. package/dist/access-admin-ops-surface.js +128 -127
  2. package/dist/access-authorization-probe.js +4 -4
  3. package/dist/access-boundary.js +3 -3
  4. package/dist/access-cli.d.ts.map +1 -1
  5. package/dist/access-cli.js +144 -137
  6. package/dist/access-cli.js.map +1 -1
  7. package/dist/access-coding-context-resolution.d.ts +37 -0
  8. package/dist/access-coding-context-resolution.d.ts.map +1 -1
  9. package/dist/access-coding-context-resolution.js +48 -4
  10. package/dist/access-errors.d.ts +5 -0
  11. package/dist/access-errors.d.ts.map +1 -1
  12. package/dist/access-errors.js +3 -1
  13. package/dist/access-extraction-force-flush-preempt.js +128 -127
  14. package/dist/access-extraction-force-flush.js +128 -127
  15. package/dist/access-http-briefing.js +128 -127
  16. package/dist/access-http-query.js +128 -127
  17. package/dist/access-http.d.ts.map +1 -1
  18. package/dist/access-http.js +128 -127
  19. package/dist/access-identity-continuity-surface.js +128 -127
  20. package/dist/access-lcm-surface.js +128 -127
  21. package/dist/access-mcp.js +128 -127
  22. package/dist/access-memory-search-fanout.js +2 -2
  23. package/dist/access-namespace-preflight.js +4 -4
  24. package/dist/access-observe-transcript.js +3 -2
  25. package/dist/access-observe-write-category.js +9 -9
  26. package/dist/access-observe-write-surface.d.ts +1 -0
  27. package/dist/access-observe-write-surface.d.ts.map +1 -1
  28. package/dist/access-observe-write-surface.js +128 -127
  29. package/dist/access-offline-manifest.js +9 -8
  30. package/dist/access-operations-batch.js +128 -127
  31. package/dist/access-operations.d.ts +1 -1
  32. package/dist/access-operations.js +128 -127
  33. package/dist/access-recall-concurrency.d.ts +3 -16
  34. package/dist/access-recall-concurrency.d.ts.map +1 -1
  35. package/dist/access-recall-concurrency.js +128 -127
  36. package/dist/access-recall-corpus-versions.d.ts +4 -1
  37. package/dist/access-recall-corpus-versions.d.ts.map +1 -1
  38. package/dist/access-recall-corpus-versions.js +4 -1
  39. package/dist/access-recall-diagnostics.js +3 -3
  40. package/dist/access-recall-response.d.ts.map +1 -1
  41. package/dist/access-recall-response.js +128 -127
  42. package/dist/access-recall-surface.d.ts +1 -0
  43. package/dist/access-recall-surface.d.ts.map +1 -1
  44. package/dist/access-recall-surface.js +128 -127
  45. package/dist/access-schema.d.ts +1 -0
  46. package/dist/access-schema.d.ts.map +1 -1
  47. package/dist/access-schema.js +2 -2
  48. package/dist/access-service.d.ts +3 -15
  49. package/dist/access-service.d.ts.map +1 -1
  50. package/dist/access-service.js +130 -127
  51. package/dist/access-surface-catalog.js +5 -5
  52. package/dist/access-token-capabilities.js +2 -2
  53. package/dist/active-recall.js +21 -21
  54. package/dist/artifact-search.js +2 -2
  55. package/dist/auto-sync-L3M4RKJD.js +1 -1
  56. package/dist/briefing.js +19 -19
  57. package/dist/buffer-add-turns-bounded.js +2 -2
  58. package/dist/buffer-turn-helpers.d.ts.map +1 -1
  59. package/dist/buffer-turn-helpers.js +1 -1
  60. package/dist/buffer.js +11 -10
  61. package/dist/calibration.js +2 -2
  62. package/dist/capsule-import-gate.js +2 -2
  63. package/dist/causal-consolidation.js +20 -20
  64. package/dist/{chunk-5V3IBSVB.js → chunk-22V3CMIW.js} +4 -4
  65. package/dist/{chunk-IHOKB3L3.js → chunk-2FCZIWRI.js} +785 -515
  66. package/dist/chunk-2FCZIWRI.js.map +1 -0
  67. package/dist/{chunk-7IWRLYFJ.js → chunk-2TJSGIKT.js} +2 -2
  68. package/dist/{chunk-V6M6N3EE.js → chunk-333SBFXB.js} +2 -2
  69. package/dist/{chunk-XBW7U7GM.js → chunk-3PNJZTDV.js} +5 -2
  70. package/dist/chunk-3PNJZTDV.js.map +1 -0
  71. package/dist/{chunk-XE4UYWW3.js → chunk-3YOX2BQD.js} +3 -3
  72. package/dist/{chunk-V4ASAWRP.js → chunk-47LDDGAL.js} +3 -3
  73. package/dist/{chunk-XEBNSY7N.js → chunk-4D2EY4WM.js} +2 -2
  74. package/dist/{chunk-5HFCXTGY.js → chunk-4D77BI3J.js} +29 -189
  75. package/dist/chunk-4D77BI3J.js.map +1 -0
  76. package/dist/{chunk-LPV72KRQ.js → chunk-4IMOGAFF.js} +3 -3
  77. package/dist/{chunk-QBREZ4QL.js → chunk-4L25GAYL.js} +2 -2
  78. package/dist/{chunk-HADD45AR.js → chunk-4WCLZBM2.js} +2 -2
  79. package/dist/{chunk-B3GKQ6DU.js → chunk-5MA6ZQ4Z.js} +2 -2
  80. package/dist/{chunk-3QLAOYBL.js → chunk-5QDTZIGH.js} +3 -3
  81. package/dist/{chunk-WXDTOE6F.js → chunk-5VMRM2X3.js} +2 -2
  82. package/dist/{chunk-VE23DIBH.js → chunk-6QWFZ3X5.js} +2 -2
  83. package/dist/{chunk-SDGD6MYV.js → chunk-7F7HRJI2.js} +2 -2
  84. package/dist/{chunk-QFPNWSVH.js → chunk-7OCKK5M5.js} +6 -6
  85. package/dist/{chunk-YAVIBVCU.js → chunk-7QF26EWO.js} +5 -5
  86. package/dist/{chunk-WAJL65KW.js → chunk-7VIJUZYW.js} +3 -3
  87. package/dist/{chunk-EI2M2CFJ.js → chunk-A5UOREWD.js} +3 -3
  88. package/dist/{chunk-32CA7B6L.js → chunk-AQZL7JBZ.js} +2 -2
  89. package/dist/{chunk-EDA6CDBT.js → chunk-AVWOULJH.js} +2 -2
  90. package/dist/{chunk-4HKK5HUI.js → chunk-B3M56D2A.js} +2 -2
  91. package/dist/{chunk-SRN5M4LQ.js → chunk-BKTCVXMK.js} +4 -4
  92. package/dist/{chunk-TXVTNDQT.js → chunk-BPCR5DZP.js} +2 -2
  93. package/dist/chunk-CKELO7Q6.js +113 -0
  94. package/dist/chunk-CKELO7Q6.js.map +1 -0
  95. package/dist/{chunk-IEB6XYW6.js → chunk-CKZWLAHN.js} +2 -2
  96. package/dist/{chunk-JVIWVJ2A.js → chunk-CUPILBIP.js} +3 -3
  97. package/dist/{chunk-274UY54Z.js → chunk-DFZYZOLH.js} +3 -3
  98. package/dist/{chunk-6S4DM53Y.js → chunk-E6EESRJ6.js} +6 -6
  99. package/dist/{chunk-FSI45NUK.js → chunk-EZG54YDS.js} +2 -2
  100. package/dist/{chunk-7ZFB4VZS.js → chunk-FFWFFAP3.js} +2 -2
  101. package/dist/{chunk-22VXXA67.js → chunk-FGT7CUYZ.js} +2 -2
  102. package/dist/{chunk-Z3SXC3MP.js → chunk-FOTFLHBN.js} +2 -2
  103. package/dist/{chunk-RH6XWXMA.js → chunk-FRYCXXTB.js} +3 -3
  104. package/dist/{chunk-B377OKUP.js → chunk-G64WYD2S.js} +4 -4
  105. package/dist/{chunk-JJEQRSYU.js → chunk-GBSXTTLP.js} +2 -2
  106. package/dist/{chunk-2YODOG2O.js → chunk-GIL2M2OI.js} +3 -3
  107. package/dist/{chunk-YVRQ5JRA.js → chunk-GYOKVJPB.js} +14 -8
  108. package/dist/chunk-GYOKVJPB.js.map +1 -0
  109. package/dist/{chunk-ARJ3KCX4.js → chunk-HDLNSDLK.js} +2 -2
  110. package/dist/{chunk-VXUO5JZC.js → chunk-HDWISXFH.js} +6 -6
  111. package/dist/{chunk-RNFMFC37.js → chunk-IDYYGOOQ.js} +28 -1
  112. package/dist/chunk-IDYYGOOQ.js.map +1 -0
  113. package/dist/{chunk-EZ47HOJ6.js → chunk-IXI6S2VJ.js} +4 -4
  114. package/dist/{chunk-VXMWTRQX.js → chunk-J74YOBB3.js} +4 -4
  115. package/dist/{chunk-AMW3IDCO.js → chunk-JFMMEHVG.js} +2 -2
  116. package/dist/{chunk-6TPWIPE3.js → chunk-JFZZDMEZ.js} +3 -3
  117. package/dist/{chunk-JTSSSR4L.js → chunk-KIUFT2WZ.js} +3 -3
  118. package/dist/{chunk-L6BLTV4D.js → chunk-L7SEYUHS.js} +2 -2
  119. package/dist/{chunk-WRAK5LLB.js → chunk-LPUEBFX2.js} +3 -3
  120. package/dist/{chunk-DBVSU3HE.js → chunk-LVGTH6IQ.js} +9 -9
  121. package/dist/{chunk-33VVVP57.js → chunk-MEVBSF6T.js} +4 -1
  122. package/dist/chunk-MEVBSF6T.js.map +1 -0
  123. package/dist/{chunk-CJCTKL6Y.js → chunk-MGKCKY7X.js} +4 -1
  124. package/dist/chunk-MGKCKY7X.js.map +1 -0
  125. package/dist/{chunk-SOGOHLWN.js → chunk-N7AIFTSH.js} +1 -1
  126. package/dist/chunk-N7AIFTSH.js.map +1 -0
  127. package/dist/chunk-O3XGASU5.js +197 -0
  128. package/dist/chunk-O3XGASU5.js.map +1 -0
  129. package/dist/{chunk-OGBQMY46.js → chunk-O544TUJO.js} +2 -2
  130. package/dist/{chunk-TFNZXOXK.js → chunk-OAQRZ4SV.js} +2 -2
  131. package/dist/{chunk-IEEV27BC.js → chunk-OO2HEUZ4.js} +2 -2
  132. package/dist/{chunk-YMC4AYJK.js → chunk-OWM2VWNX.js} +10 -10
  133. package/dist/{chunk-4LPTSB5V.js → chunk-PFLN6TTW.js} +2 -2
  134. package/dist/{chunk-YOR5QBEU.js → chunk-QFTK6EDM.js} +4 -4
  135. package/dist/{chunk-A2WFUMUN.js → chunk-QKDXO4FD.js} +4 -4
  136. package/dist/{chunk-Y7HLGKKU.js → chunk-QLQUAVVP.js} +4 -4
  137. package/dist/{chunk-MUMQWCE2.js → chunk-QPFM6DHY.js} +2 -2
  138. package/dist/{chunk-YWPCDR3I.js → chunk-QVXEXGIM.js} +3 -3
  139. package/dist/{chunk-UPE7TJWN.js → chunk-QWWHYBPT.js} +2 -2
  140. package/dist/{chunk-NZHZQGLB.js → chunk-QXTKN25V.js} +2 -2
  141. package/dist/{chunk-OAGTKS73.js → chunk-RFLC6PKQ.js} +2 -2
  142. package/dist/{chunk-ZRLTQ2Y7.js → chunk-RO5EGRAI.js} +2 -2
  143. package/dist/{chunk-5D4NBANY.js → chunk-SIONKXLU.js} +2 -2
  144. package/dist/{chunk-6XTUZKCZ.js → chunk-SMDZTJ2D.js} +2 -2
  145. package/dist/{chunk-OFSAKEZB.js → chunk-T4BT4FQN.js} +2 -2
  146. package/dist/{chunk-IC35ZYLM.js → chunk-TAD6QMMD.js} +4 -4
  147. package/dist/{chunk-EAHNSQ7H.js → chunk-TB6VFEHQ.js} +2 -2
  148. package/dist/{chunk-6ARSFTLD.js → chunk-TNRGWJYT.js} +2 -2
  149. package/dist/{chunk-JCAMHTS2.js → chunk-UBG65KEY.js} +7 -5
  150. package/dist/{chunk-JCAMHTS2.js.map → chunk-UBG65KEY.js.map} +1 -1
  151. package/dist/{chunk-CGOPDXLK.js → chunk-UMEUU66X.js} +2 -2
  152. package/dist/{chunk-5LTXYM7D.js → chunk-UYIBNDQE.js} +2 -2
  153. package/dist/{chunk-UGQEJWR3.js → chunk-VHXRLD6S.js} +2 -2
  154. package/dist/{chunk-WJ6S54ES.js → chunk-VOLTQNAP.js} +2 -2
  155. package/dist/{chunk-SBU5GDOT.js → chunk-VRHY7Y5A.js} +7 -7
  156. package/dist/{chunk-E5RJPLNL.js → chunk-W7N7NWG5.js} +3 -3
  157. package/dist/{chunk-UPWOMMVU.js → chunk-WECKZ3KT.js} +7 -7
  158. package/dist/{chunk-PCUDFWX5.js → chunk-WEFFO2MJ.js} +2 -2
  159. package/dist/{chunk-QCP75JGO.js → chunk-WQUGCOKF.js} +5 -5
  160. package/dist/{chunk-FKBGK3NC.js → chunk-WWUQ6CP3.js} +2 -2
  161. package/dist/{chunk-KR6PEAM4.js → chunk-X67XNZ64.js} +8 -8
  162. package/dist/{chunk-UYHDMCY2.js → chunk-XUVCQ4YZ.js} +2 -2
  163. package/dist/{chunk-7IJ2H43M.js → chunk-YY57TRKN.js} +2 -2
  164. package/dist/{chunk-AU6AEUFD.js → chunk-YYXYZM2I.js} +2 -2
  165. package/dist/{chunk-3FBAEPCU.js → chunk-ZDUE44CC.js} +2 -2
  166. package/dist/{chunk-PRE7R3RQ.js → chunk-ZQUOUPP3.js} +12 -3
  167. package/dist/chunk-ZQUOUPP3.js.map +1 -0
  168. package/dist/{chunk-RDO6AMDL.js → chunk-ZWDDY4WF.js} +2 -2
  169. package/dist/{chunk-QASTQVGK.js → chunk-ZX546Y3Y.js} +2 -2
  170. package/dist/chunk-ZX546Y3Y.js.map +1 -0
  171. package/dist/cli.js +128 -127
  172. package/dist/coding/architecture-surfaces.d.ts +0 -24
  173. package/dist/coding/architecture-surfaces.d.ts.map +1 -1
  174. package/dist/coding/codegraph-surfaces.d.ts.map +1 -1
  175. package/dist/coding/export-okf-codegraph.js +51 -24
  176. package/dist/coding/export-okf-codegraph.js.map +1 -1
  177. package/dist/coding/git-context.d.ts +23 -0
  178. package/dist/coding/git-context.d.ts.map +1 -1
  179. package/dist/coding/git-context.js +31 -0
  180. package/dist/coding/git-context.js.map +1 -0
  181. package/dist/coding/session-delta-surfaces.d.ts +0 -23
  182. package/dist/coding/session-delta-surfaces.d.ts.map +1 -1
  183. package/dist/compounding/engine.js +20 -20
  184. package/dist/config.js +21 -21
  185. package/dist/connectors/codex-materialize-runner.js +19 -19
  186. package/dist/connectors/index.js +23 -23
  187. package/dist/convergence-refresh.js +21 -21
  188. package/dist/conversation-index/backend.js +2 -2
  189. package/dist/corpus-watermark.js +23 -23
  190. package/dist/deep-recall-config.js +2 -2
  191. package/dist/deep-recall-http-glue.js +4 -4
  192. package/dist/entity-recall-cancellation.js +2 -2
  193. package/dist/entity-recall-reads.js +3 -3
  194. package/dist/entity-retrieval.js +21 -21
  195. package/dist/explicit-capture.js +128 -127
  196. package/dist/external-wiki-access.js +4 -4
  197. package/dist/extraction-judge.js +1 -1
  198. package/dist/extraction.js +31 -30
  199. package/dist/harmonic-retrieval.js +19 -19
  200. package/dist/index.js +207 -205
  201. package/dist/local-llm.js +2 -2
  202. package/dist/location/index.js +21 -21
  203. package/dist/maintenance/memory-governance.js +19 -19
  204. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +19 -19
  205. package/dist/maintenance/rebuild-memory-projection-runner.js +21 -21
  206. package/dist/maintenance/rebuild-memory-projection.js +20 -20
  207. package/dist/memory-browse-http-glue.js +2 -2
  208. package/dist/memory-browse-operations.js +4 -4
  209. package/dist/memory-browse.js +6 -6
  210. package/dist/namespaces/migrate.js +20 -20
  211. package/dist/namespaces/search.js +8 -8
  212. package/dist/namespaces/storage.js +19 -19
  213. package/dist/offline-sync-impression-drain.js +8 -7
  214. package/dist/operator-doctor-corpus.js +26 -26
  215. package/dist/operator-doctor-replica.js +4 -4
  216. package/dist/operator-toolkit.js +35 -34
  217. package/dist/orchestration/backlog-scheduler.js +129 -128
  218. package/dist/orchestration/backlog-scheduler.js.map +1 -1
  219. package/dist/orchestration/buffer-drain-runner.js +129 -128
  220. package/dist/orchestration/episodic-context-section.d.ts +3 -2
  221. package/dist/orchestration/episodic-context-section.d.ts.map +1 -1
  222. package/dist/orchestration/maintenance.js +34 -33
  223. package/dist/orchestration/orchestrator-helpers.d.ts +10 -0
  224. package/dist/orchestration/orchestrator-helpers.d.ts.map +1 -1
  225. package/dist/orchestration/orchestrator-init.d.ts +12 -13
  226. package/dist/orchestration/orchestrator-init.d.ts.map +1 -1
  227. package/dist/orchestration/recall-entry.d.ts.map +1 -1
  228. package/dist/orchestration/recall-internal.d.ts.map +1 -1
  229. package/dist/orchestration/session-context.d.ts +5 -1
  230. package/dist/orchestration/session-context.d.ts.map +1 -1
  231. package/dist/orchestration/startup-search-sync.d.ts +73 -0
  232. package/dist/orchestration/startup-search-sync.d.ts.map +1 -0
  233. package/dist/orchestration/turn-ingestion.d.ts.map +1 -1
  234. package/dist/orchestrator.d.ts +4 -1
  235. package/dist/orchestrator.d.ts.map +1 -1
  236. package/dist/orchestrator.js +128 -127
  237. package/dist/qmd-daemon-session.js +2 -2
  238. package/dist/qmd.js +3 -3
  239. package/dist/recall-explain-renderer.js +3 -3
  240. package/dist/recall-navigate-access.js +2 -2
  241. package/dist/recall-navigate-disclosure.js +2 -2
  242. package/dist/recall-navigate.js +2 -2
  243. package/dist/recall-navigation-http-glue.js +2 -2
  244. package/dist/recall-navigation-operations.js +4 -4
  245. package/dist/recall-navigation.js +128 -127
  246. package/dist/recall-qos.d.ts +26 -0
  247. package/dist/recall-qos.d.ts.map +1 -1
  248. package/dist/recall-qos.js +9 -1
  249. package/dist/recall-state-view-admission.js +6 -6
  250. package/dist/recall-why-service.js +6 -6
  251. package/dist/recall-xray-cli.js +4 -4
  252. package/dist/recall-xray-renderer.js +3 -3
  253. package/dist/recall-xray.js +2 -2
  254. package/dist/relay/mission.d.ts +3 -3
  255. package/dist/replica-divergence.js +3 -3
  256. package/dist/resume-bundles.js +23 -23
  257. package/dist/search/factory.js +7 -7
  258. package/dist/search/index.js +9 -9
  259. package/dist/semantic-consolidation.js +20 -20
  260. package/dist/semantic-rule-promotion.js +19 -19
  261. package/dist/semantic-rule-verifier.js +19 -19
  262. package/dist/source-agent-qualifier.js +29 -28
  263. package/dist/standup/build.js +20 -20
  264. package/dist/storage/buffer-drain-claims.js +2 -2
  265. package/dist/storage/buffer-session-files.js +2 -2
  266. package/dist/storage.js +18 -18
  267. package/dist/summarizer.js +3 -3
  268. package/dist/support-passport/index.js +7 -7
  269. package/dist/tokens.js +3 -3
  270. package/dist/transfer/export-okf.js +19 -19
  271. package/dist/types.d.ts +1 -0
  272. package/dist/types.d.ts.map +1 -1
  273. package/dist/types.js +1 -1
  274. package/dist/verified-recall.js +19 -19
  275. package/dist/who-knows-cli.js +21 -21
  276. package/dist/who-knows.js +20 -20
  277. package/package.json +12 -2
  278. package/src/access-cli.ts +18 -9
  279. package/src/access-coding-context-resolution.ts +138 -0
  280. package/src/access-errors.ts +5 -0
  281. package/src/access-http-admission.test.ts +76 -0
  282. package/src/access-http.test.ts +2 -0
  283. package/src/access-http.ts +4 -0
  284. package/src/access-observe-write-surface.ts +2 -1
  285. package/src/access-operations-batch.ts +2 -2
  286. package/src/access-recall-concurrency.ts +179 -22
  287. package/src/access-recall-corpus-versions.ts +12 -7
  288. package/src/access-recall-response.ts +25 -2
  289. package/src/access-recall-surface.ts +6 -4
  290. package/src/access-schema.ts +9 -0
  291. package/src/access-service-raw-excerpt-read-gate.test.ts +7 -2
  292. package/src/access-service-recall-concurrency.test.ts +242 -0
  293. package/src/access-service-set-coding-context.test.ts +210 -0
  294. package/src/access-service.ts +43 -58
  295. package/src/buffer-turn-helpers.ts +3 -0
  296. package/src/capsule-import-gate.test.ts +106 -0
  297. package/src/coding/access-coding-context.test.ts +3 -0
  298. package/src/coding/architecture-surfaces.ts +2 -1
  299. package/src/coding/codegraph-surfaces.test.ts +34 -0
  300. package/src/coding/codegraph-surfaces.ts +3 -2
  301. package/src/coding/git-context.test.ts +29 -0
  302. package/src/coding/git-context.ts +63 -2
  303. package/src/coding/session-delta-surfaces.ts +2 -1
  304. package/src/harmonic-graph-version.test.ts +63 -0
  305. package/src/orchestration/episodic-context-section.ts +6 -7
  306. package/src/orchestration/orchestrator-helpers.ts +10 -0
  307. package/src/orchestration/orchestrator-init.ts +57 -303
  308. package/src/orchestration/recall-entry.ts +59 -4
  309. package/src/orchestration/recall-internal.ts +10 -10
  310. package/src/orchestration/session-context.ts +11 -1
  311. package/src/orchestration/startup-search-sync.ts +492 -0
  312. package/src/orchestration/task-exit.test.ts +45 -0
  313. package/src/orchestration/turn-ingestion-buffered.test.ts +224 -0
  314. package/src/orchestration/turn-ingestion.ts +28 -35
  315. package/src/orchestrator-flush.test.ts +7 -7
  316. package/src/orchestrator-init.test.ts +364 -12
  317. package/src/orchestrator-source-attribution.test.ts +100 -0
  318. package/src/orchestrator-startup-ready-path.test.ts +133 -10
  319. package/src/orchestrator.ts +16 -1
  320. package/src/recall-qos.test.ts +62 -0
  321. package/src/recall-qos.ts +75 -0
  322. package/src/recall-retrieval-failure.test.ts +282 -18
  323. package/src/recall-search-options.test.ts +13 -1
  324. package/src/storage/buffer-drain-handin-memo.test.ts +140 -0
  325. package/src/types.ts +1 -1
  326. package/dist/chunk-33VVVP57.js.map +0 -1
  327. package/dist/chunk-3QNFHI6T.js +0 -38
  328. package/dist/chunk-3QNFHI6T.js.map +0 -1
  329. package/dist/chunk-5HFCXTGY.js.map +0 -1
  330. package/dist/chunk-CJCTKL6Y.js.map +0 -1
  331. package/dist/chunk-IHOKB3L3.js.map +0 -1
  332. package/dist/chunk-PRE7R3RQ.js.map +0 -1
  333. package/dist/chunk-QASTQVGK.js.map +0 -1
  334. package/dist/chunk-RNFMFC37.js.map +0 -1
  335. package/dist/chunk-SOGOHLWN.js.map +0 -1
  336. package/dist/chunk-XBW7U7GM.js.map +0 -1
  337. package/dist/chunk-YVRQ5JRA.js.map +0 -1
  338. /package/dist/{chunk-5V3IBSVB.js.map → chunk-22V3CMIW.js.map} +0 -0
  339. /package/dist/{chunk-7IWRLYFJ.js.map → chunk-2TJSGIKT.js.map} +0 -0
  340. /package/dist/{chunk-V6M6N3EE.js.map → chunk-333SBFXB.js.map} +0 -0
  341. /package/dist/{chunk-XE4UYWW3.js.map → chunk-3YOX2BQD.js.map} +0 -0
  342. /package/dist/{chunk-V4ASAWRP.js.map → chunk-47LDDGAL.js.map} +0 -0
  343. /package/dist/{chunk-XEBNSY7N.js.map → chunk-4D2EY4WM.js.map} +0 -0
  344. /package/dist/{chunk-LPV72KRQ.js.map → chunk-4IMOGAFF.js.map} +0 -0
  345. /package/dist/{chunk-QBREZ4QL.js.map → chunk-4L25GAYL.js.map} +0 -0
  346. /package/dist/{chunk-HADD45AR.js.map → chunk-4WCLZBM2.js.map} +0 -0
  347. /package/dist/{chunk-B3GKQ6DU.js.map → chunk-5MA6ZQ4Z.js.map} +0 -0
  348. /package/dist/{chunk-3QLAOYBL.js.map → chunk-5QDTZIGH.js.map} +0 -0
  349. /package/dist/{chunk-WXDTOE6F.js.map → chunk-5VMRM2X3.js.map} +0 -0
  350. /package/dist/{chunk-VE23DIBH.js.map → chunk-6QWFZ3X5.js.map} +0 -0
  351. /package/dist/{chunk-SDGD6MYV.js.map → chunk-7F7HRJI2.js.map} +0 -0
  352. /package/dist/{chunk-QFPNWSVH.js.map → chunk-7OCKK5M5.js.map} +0 -0
  353. /package/dist/{chunk-YAVIBVCU.js.map → chunk-7QF26EWO.js.map} +0 -0
  354. /package/dist/{chunk-WAJL65KW.js.map → chunk-7VIJUZYW.js.map} +0 -0
  355. /package/dist/{chunk-EI2M2CFJ.js.map → chunk-A5UOREWD.js.map} +0 -0
  356. /package/dist/{chunk-32CA7B6L.js.map → chunk-AQZL7JBZ.js.map} +0 -0
  357. /package/dist/{chunk-EDA6CDBT.js.map → chunk-AVWOULJH.js.map} +0 -0
  358. /package/dist/{chunk-4HKK5HUI.js.map → chunk-B3M56D2A.js.map} +0 -0
  359. /package/dist/{chunk-SRN5M4LQ.js.map → chunk-BKTCVXMK.js.map} +0 -0
  360. /package/dist/{chunk-TXVTNDQT.js.map → chunk-BPCR5DZP.js.map} +0 -0
  361. /package/dist/{chunk-IEB6XYW6.js.map → chunk-CKZWLAHN.js.map} +0 -0
  362. /package/dist/{chunk-JVIWVJ2A.js.map → chunk-CUPILBIP.js.map} +0 -0
  363. /package/dist/{chunk-274UY54Z.js.map → chunk-DFZYZOLH.js.map} +0 -0
  364. /package/dist/{chunk-6S4DM53Y.js.map → chunk-E6EESRJ6.js.map} +0 -0
  365. /package/dist/{chunk-FSI45NUK.js.map → chunk-EZG54YDS.js.map} +0 -0
  366. /package/dist/{chunk-7ZFB4VZS.js.map → chunk-FFWFFAP3.js.map} +0 -0
  367. /package/dist/{chunk-22VXXA67.js.map → chunk-FGT7CUYZ.js.map} +0 -0
  368. /package/dist/{chunk-Z3SXC3MP.js.map → chunk-FOTFLHBN.js.map} +0 -0
  369. /package/dist/{chunk-RH6XWXMA.js.map → chunk-FRYCXXTB.js.map} +0 -0
  370. /package/dist/{chunk-B377OKUP.js.map → chunk-G64WYD2S.js.map} +0 -0
  371. /package/dist/{chunk-JJEQRSYU.js.map → chunk-GBSXTTLP.js.map} +0 -0
  372. /package/dist/{chunk-2YODOG2O.js.map → chunk-GIL2M2OI.js.map} +0 -0
  373. /package/dist/{chunk-ARJ3KCX4.js.map → chunk-HDLNSDLK.js.map} +0 -0
  374. /package/dist/{chunk-VXUO5JZC.js.map → chunk-HDWISXFH.js.map} +0 -0
  375. /package/dist/{chunk-EZ47HOJ6.js.map → chunk-IXI6S2VJ.js.map} +0 -0
  376. /package/dist/{chunk-VXMWTRQX.js.map → chunk-J74YOBB3.js.map} +0 -0
  377. /package/dist/{chunk-AMW3IDCO.js.map → chunk-JFMMEHVG.js.map} +0 -0
  378. /package/dist/{chunk-6TPWIPE3.js.map → chunk-JFZZDMEZ.js.map} +0 -0
  379. /package/dist/{chunk-JTSSSR4L.js.map → chunk-KIUFT2WZ.js.map} +0 -0
  380. /package/dist/{chunk-L6BLTV4D.js.map → chunk-L7SEYUHS.js.map} +0 -0
  381. /package/dist/{chunk-WRAK5LLB.js.map → chunk-LPUEBFX2.js.map} +0 -0
  382. /package/dist/{chunk-DBVSU3HE.js.map → chunk-LVGTH6IQ.js.map} +0 -0
  383. /package/dist/{chunk-OGBQMY46.js.map → chunk-O544TUJO.js.map} +0 -0
  384. /package/dist/{chunk-TFNZXOXK.js.map → chunk-OAQRZ4SV.js.map} +0 -0
  385. /package/dist/{chunk-IEEV27BC.js.map → chunk-OO2HEUZ4.js.map} +0 -0
  386. /package/dist/{chunk-YMC4AYJK.js.map → chunk-OWM2VWNX.js.map} +0 -0
  387. /package/dist/{chunk-4LPTSB5V.js.map → chunk-PFLN6TTW.js.map} +0 -0
  388. /package/dist/{chunk-YOR5QBEU.js.map → chunk-QFTK6EDM.js.map} +0 -0
  389. /package/dist/{chunk-A2WFUMUN.js.map → chunk-QKDXO4FD.js.map} +0 -0
  390. /package/dist/{chunk-Y7HLGKKU.js.map → chunk-QLQUAVVP.js.map} +0 -0
  391. /package/dist/{chunk-MUMQWCE2.js.map → chunk-QPFM6DHY.js.map} +0 -0
  392. /package/dist/{chunk-YWPCDR3I.js.map → chunk-QVXEXGIM.js.map} +0 -0
  393. /package/dist/{chunk-UPE7TJWN.js.map → chunk-QWWHYBPT.js.map} +0 -0
  394. /package/dist/{chunk-NZHZQGLB.js.map → chunk-QXTKN25V.js.map} +0 -0
  395. /package/dist/{chunk-OAGTKS73.js.map → chunk-RFLC6PKQ.js.map} +0 -0
  396. /package/dist/{chunk-ZRLTQ2Y7.js.map → chunk-RO5EGRAI.js.map} +0 -0
  397. /package/dist/{chunk-5D4NBANY.js.map → chunk-SIONKXLU.js.map} +0 -0
  398. /package/dist/{chunk-6XTUZKCZ.js.map → chunk-SMDZTJ2D.js.map} +0 -0
  399. /package/dist/{chunk-OFSAKEZB.js.map → chunk-T4BT4FQN.js.map} +0 -0
  400. /package/dist/{chunk-IC35ZYLM.js.map → chunk-TAD6QMMD.js.map} +0 -0
  401. /package/dist/{chunk-EAHNSQ7H.js.map → chunk-TB6VFEHQ.js.map} +0 -0
  402. /package/dist/{chunk-6ARSFTLD.js.map → chunk-TNRGWJYT.js.map} +0 -0
  403. /package/dist/{chunk-CGOPDXLK.js.map → chunk-UMEUU66X.js.map} +0 -0
  404. /package/dist/{chunk-5LTXYM7D.js.map → chunk-UYIBNDQE.js.map} +0 -0
  405. /package/dist/{chunk-UGQEJWR3.js.map → chunk-VHXRLD6S.js.map} +0 -0
  406. /package/dist/{chunk-WJ6S54ES.js.map → chunk-VOLTQNAP.js.map} +0 -0
  407. /package/dist/{chunk-SBU5GDOT.js.map → chunk-VRHY7Y5A.js.map} +0 -0
  408. /package/dist/{chunk-E5RJPLNL.js.map → chunk-W7N7NWG5.js.map} +0 -0
  409. /package/dist/{chunk-UPWOMMVU.js.map → chunk-WECKZ3KT.js.map} +0 -0
  410. /package/dist/{chunk-PCUDFWX5.js.map → chunk-WEFFO2MJ.js.map} +0 -0
  411. /package/dist/{chunk-QCP75JGO.js.map → chunk-WQUGCOKF.js.map} +0 -0
  412. /package/dist/{chunk-FKBGK3NC.js.map → chunk-WWUQ6CP3.js.map} +0 -0
  413. /package/dist/{chunk-KR6PEAM4.js.map → chunk-X67XNZ64.js.map} +0 -0
  414. /package/dist/{chunk-UYHDMCY2.js.map → chunk-XUVCQ4YZ.js.map} +0 -0
  415. /package/dist/{chunk-7IJ2H43M.js.map → chunk-YY57TRKN.js.map} +0 -0
  416. /package/dist/{chunk-AU6AEUFD.js.map → chunk-YYXYZM2I.js.map} +0 -0
  417. /package/dist/{chunk-3FBAEPCU.js.map → chunk-ZDUE44CC.js.map} +0 -0
  418. /package/dist/{chunk-RDO6AMDL.js.map → chunk-ZWDDY4WF.js.map} +0 -0
@@ -7,6 +7,7 @@ import test from "node:test";
7
7
 
8
8
  import { parseConfig } from "./config.js";
9
9
  import { Orchestrator } from "./orchestrator.js";
10
+ import { initLogger, resetLogger } from "./logger.js";
10
11
  import { NoopSearchBackend } from "./search/noop-backend.js";
11
12
 
12
13
  /**
@@ -102,9 +103,11 @@ test("initialize and its init gate survive an enabled catalog planner timeout",
102
103
  ensuredNamespaces.push(namespace);
103
104
  return "present";
104
105
  };
105
- (orchestrator as any).namespaceSearchRouter.updateNamespaces = async (namespaces: string[]) => {
106
+ // SAFETY: namespaceSearchRouter is a private orchestrator seam; the stub returns the
107
+ // router's NamespaceUpdateResult shape (backendCount, eligibleNamespaces).
108
+ (orchestrator as any).namespaceSearchRouter.updateNamespacesDetailed = async (namespaces: string[]) => {
106
109
  updatedNamespaces.push([...namespaces]);
107
- return namespaces.length;
110
+ return { backendCount: namespaces.length, eligibleNamespaces: [...namespaces] };
108
111
  };
109
112
 
110
113
  const initPromise = (orchestrator as any).initPromise as Promise<void>;
@@ -234,9 +237,11 @@ test("aborted deferred and retry discovery do not start QMD work after the sourc
234
237
  ensureStarts += 1;
235
238
  return "present";
236
239
  };
237
- (orchestrator as any).namespaceSearchRouter.updateNamespaces = async () => {
240
+ // SAFETY: namespaceSearchRouter is a private orchestrator seam; the stub returns the
241
+ // router's NamespaceUpdateResult shape (backendCount, eligibleNamespaces).
242
+ (orchestrator as any).namespaceSearchRouter.updateNamespacesDetailed = async (ns: string[]) => {
238
243
  updateStarts += 1;
239
- return 1;
244
+ return { backendCount: 1, eligibleNamespaces: [...ns] };
240
245
  };
241
246
 
242
247
  const deferred = (orchestrator as any).deferredInitialize(deferredAbort.signal);
@@ -334,9 +339,11 @@ test("a late correction catalog result recovers a dynamic stale plan once withou
334
339
  ensuredNamespaces.push(namespace);
335
340
  return "present";
336
341
  };
337
- (orchestrator as any).namespaceSearchRouter.updateNamespaces = async (namespaces: string[]) => {
342
+ // SAFETY: namespaceSearchRouter is a private orchestrator seam; the stub returns the
343
+ // router's NamespaceUpdateResult shape (backendCount, eligibleNamespaces).
344
+ (orchestrator as any).namespaceSearchRouter.updateNamespacesDetailed = async (namespaces: string[]) => {
338
345
  updatedNamespaces.push([...namespaces]);
339
- return namespaces.length;
346
+ return { backendCount: namespaces.length, eligibleNamespaces: [...namespaces] };
340
347
  };
341
348
 
342
349
  const initialized = await withTestDeadline(orchestrator.initialize().then(() => "settled" as const));
@@ -452,9 +459,11 @@ test("destroy retires a timed-out correction catalog epoch while a fresh epoch r
452
459
  firstEnsuredNamespaces.push(namespace);
453
460
  return "present";
454
461
  };
455
- (firstOrchestrator as any).namespaceSearchRouter.updateNamespaces = async (namespaces: string[]) => {
462
+ // SAFETY: namespaceSearchRouter is a private orchestrator seam; the stub returns the
463
+ // router's NamespaceUpdateResult shape (backendCount, eligibleNamespaces).
464
+ (firstOrchestrator as any).namespaceSearchRouter.updateNamespacesDetailed = async (namespaces: string[]) => {
456
465
  firstUpdatedNamespaces.push([...namespaces]);
457
- return namespaces.length;
466
+ return { backendCount: namespaces.length, eligibleNamespaces: [...namespaces] };
458
467
  };
459
468
 
460
469
  const firstInitialized = await withTestDeadline(firstOrchestrator.initialize().then(() => "settled" as const));
@@ -545,7 +554,9 @@ test("destroy retires a timed-out correction catalog epoch while a fresh epoch r
545
554
  freshEnsuredNamespaces.push(namespace);
546
555
  return "present";
547
556
  };
548
- (freshOrchestrator as any).namespaceSearchRouter.updateNamespaces = async (namespaces: string[]) => namespaces.length;
557
+ // SAFETY: namespaceSearchRouter is a private orchestrator seam; the stub returns the
558
+ // router's NamespaceUpdateResult shape (backendCount, eligibleNamespaces).
559
+ (freshOrchestrator as any).namespaceSearchRouter.updateNamespacesDetailed = async (namespaces: string[]) => ({ backendCount: namespaces.length, eligibleNamespaces: [...namespaces] });
549
560
 
550
561
  const freshInitialized = await withTestDeadline(freshOrchestrator.initialize().then(() => "settled" as const));
551
562
  assert.equal(freshInitialized, "settled", "a fresh orchestrator must start a new epoch");
@@ -632,9 +643,11 @@ test("startup retries share one pending maintenance discovery and only a later r
632
643
  ensuredNamespaces.push(namespace);
633
644
  return "present";
634
645
  };
635
- (orchestrator as any).namespaceSearchRouter.updateNamespaces = async (namespaces: string[]) => {
646
+ // SAFETY: namespaceSearchRouter is a private orchestrator seam; the stub returns the
647
+ // router's NamespaceUpdateResult shape (backendCount, eligibleNamespaces).
648
+ (orchestrator as any).namespaceSearchRouter.updateNamespacesDetailed = async (namespaces: string[]) => {
636
649
  updatedNamespaces.push([...namespaces]);
637
- return namespaces.length;
650
+ return { backendCount: namespaces.length, eligibleNamespaces: [...namespaces] };
638
651
  };
639
652
 
640
653
  const initialized = await withTestDeadline(orchestrator.initialize().then(() => "settled" as const));
@@ -859,7 +872,9 @@ test("a superseded paused initializer cannot admit discovery or resolve the newe
859
872
  };
860
873
  (orchestrator as any).namespaceSearchRouter.clearCache = () => undefined;
861
874
  (orchestrator as any).namespaceSearchRouter.ensureNamespaceCollection = async () => "present";
862
- (orchestrator as any).namespaceSearchRouter.updateNamespaces = async (namespaces: string[]) => namespaces.length;
875
+ // SAFETY: namespaceSearchRouter is a private orchestrator seam; the stub returns the
876
+ // router's NamespaceUpdateResult shape (backendCount, eligibleNamespaces).
877
+ (orchestrator as any).namespaceSearchRouter.updateNamespacesDetailed = async (namespaces: string[]) => ({ backendCount: namespaces.length, eligibleNamespaces: [...namespaces] });
863
878
 
864
879
  const initGate = (orchestrator as any).initPromise as Promise<void>;
865
880
  let initGateSettled = false;
@@ -1789,3 +1804,340 @@ test("an unverified collection ensure does not complete the maintenance-off sync
1789
1804
  await rm(memoryDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 50 });
1790
1805
  }
1791
1806
  });
1807
+
1808
+ test("post-ready corpus sync fires for a runtime with no server retry loop (#3525)", async () => {
1809
+ // Runtimes that drive Orchestrator without remnic-server (the OpenClaw
1810
+ // service, `remnic` CLI invocations, the bench adapter) have no retry loop:
1811
+ // #3518 moved the corpus update out of the awaited deferredReady path into
1812
+ // startupSearchSync, so the update must be scheduled by the core lifecycle.
1813
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-post-ready-sync-"));
1814
+ const orchestrator = new Orchestrator(
1815
+ parseConfig({
1816
+ memoryDir,
1817
+ workspaceDir: path.join(memoryDir, "workspace"),
1818
+ qmdEnabled: true,
1819
+ qmdMaintenanceEnabled: true,
1820
+ namespacesEnabled: false,
1821
+ defaultNamespace: "default",
1822
+ sharedNamespace: "shared",
1823
+ namespacePolicies: [],
1824
+ embeddingFallbackEnabled: false,
1825
+ identityContinuityEnabled: false,
1826
+ transcriptEnabled: false,
1827
+ hourlySummariesEnabled: false,
1828
+ compoundingEnabled: false,
1829
+ knowledgeIndexEnabled: false,
1830
+ }),
1831
+ );
1832
+ let updateCalls = 0;
1833
+ try {
1834
+ // SAFETY: the stub covers every qmd member startupSearchSync touches;
1835
+ // the field is private so the test injects it through `any`.
1836
+ (orchestrator as any).qmd = {
1837
+ probe: async () => true,
1838
+ debugStatus: () => "synthetic-qmd",
1839
+ isAvailable: () => true,
1840
+ search: async () => [],
1841
+ ensureCollection: async () => "present",
1842
+ update: async () => { updateCalls += 1; },
1843
+ // SAFETY: the qmd timestamps are nullable number fields on the private
1844
+ // backend shape; literal values keep the stub honest.
1845
+ lastUpdateRanAtMs: 1 as number | null,
1846
+ lastUpdateFailedAtMs: null as number | null,
1847
+ resetUpdateThrottles: () => undefined,
1848
+ };
1849
+ await orchestrator.initialize();
1850
+ const deferred = await withTestDeadline(
1851
+ // SAFETY: deferredReady is a private promise the test awaits
1852
+ // deliberately; `any` exposes it without widening the class API.
1853
+ (orchestrator as any).deferredReady.then(() => "settled" as const),
1854
+ );
1855
+ assert.equal(deferred, "settled", "the deferred gate must settle");
1856
+ // The post-ready fire lands on a later microtask, so poll rather than await
1857
+ // a one-shot promise: a pending promise with no live handles reads as a
1858
+ // runner cancellation instead of this assertion.
1859
+ const deadlineAt = Date.now() + 5_000;
1860
+ while (updateCalls === 0 && Date.now() < deadlineAt) {
1861
+ await new Promise((resolve) => setTimeout(resolve, 10));
1862
+ }
1863
+ assert.equal(
1864
+ updateCalls, 1,
1865
+ "the post-ready corpus update must fire without the server retry loop",
1866
+ );
1867
+ assert.equal(
1868
+ // SAFETY: deferredSyncSucceeded is the private flag shared with the
1869
+ // server retry loop; the test reads it through `any` on purpose.
1870
+ (orchestrator as any).deferredSyncSucceeded, true,
1871
+ "the post-ready success must share the retry loop's bookkeeping",
1872
+ );
1873
+ } finally {
1874
+ await orchestrator.destroy().catch(() => undefined);
1875
+ await rm(memoryDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 50 });
1876
+ }
1877
+ });
1878
+
1879
+ test("concurrent startupSearchSync calls join one in-flight update (#3525)", async () => {
1880
+ // The post-ready fire and the server retry loop can both call
1881
+ // startupSearchSync while one is already running: the second must join the
1882
+ // in-flight call, not spawn a second `qmd update` over the same index.
1883
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-sync-join-"));
1884
+ const orchestrator = new Orchestrator(
1885
+ parseConfig({
1886
+ memoryDir,
1887
+ workspaceDir: path.join(memoryDir, "workspace"),
1888
+ qmdEnabled: true,
1889
+ qmdMaintenanceEnabled: true,
1890
+ namespacesEnabled: false,
1891
+ defaultNamespace: "default",
1892
+ sharedNamespace: "shared",
1893
+ namespacePolicies: [],
1894
+ embeddingFallbackEnabled: false,
1895
+ identityContinuityEnabled: false,
1896
+ transcriptEnabled: false,
1897
+ hourlySummariesEnabled: false,
1898
+ compoundingEnabled: false,
1899
+ knowledgeIndexEnabled: false,
1900
+ }),
1901
+ );
1902
+ let updateCalls = 0;
1903
+ let release: (() => void) | undefined;
1904
+ const gate = new Promise<void>((resolve) => { release = resolve; });
1905
+ try {
1906
+ // SAFETY: the stub covers every qmd member startupSearchSync touches;
1907
+ // the field is private so the test injects it through `any`.
1908
+ (orchestrator as any).qmd = {
1909
+ probe: async () => true,
1910
+ debugStatus: () => "synthetic-qmd",
1911
+ isAvailable: () => true,
1912
+ search: async () => [],
1913
+ ensureCollection: async () => "present",
1914
+ update: async () => { updateCalls += 1; await gate; },
1915
+ // SAFETY: the qmd timestamps are nullable number fields on the private
1916
+ // backend shape; literal values keep the stub honest.
1917
+ lastUpdateRanAtMs: 1 as number | null,
1918
+ lastUpdateFailedAtMs: null as number | null,
1919
+ resetUpdateThrottles: () => undefined,
1920
+ };
1921
+ const first = orchestrator.startupSearchSync();
1922
+ const second = orchestrator.startupSearchSync();
1923
+ release?.();
1924
+ const [a, b] = await Promise.all([first, second]);
1925
+ assert.equal(updateCalls, 1, "the joiner must not spawn a second update");
1926
+ assert.equal(a, true);
1927
+ assert.equal(b, true);
1928
+ } finally {
1929
+ release?.();
1930
+ await orchestrator.destroy().catch(() => undefined);
1931
+ await rm(memoryDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 50 });
1932
+ }
1933
+ });
1934
+
1935
+ test("one-shot query joins the post-ready sync instead of reading a stale index (#3525)", async () => {
1936
+ // cmdXray and the other one-shot diagnostic commands boot a local
1937
+ // Orchestrator, await deferredReady, then query. Between the ready mark
1938
+ // and the query the post-ready sync (#3525) holds a corpus update open;
1939
+ // a freshness-dependent caller that skips the join reads the stale index
1940
+ // and its finally-block abort cancels the update it wanted.
1941
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-one-shot-"));
1942
+ const orchestrator = new Orchestrator(
1943
+ parseConfig({
1944
+ memoryDir,
1945
+ workspaceDir: path.join(memoryDir, "workspace"),
1946
+ qmdEnabled: true,
1947
+ qmdMaintenanceEnabled: true,
1948
+ namespacesEnabled: false,
1949
+ defaultNamespace: "default",
1950
+ sharedNamespace: "shared",
1951
+ namespacePolicies: [],
1952
+ embeddingFallbackEnabled: false,
1953
+ identityContinuityEnabled: false,
1954
+ transcriptEnabled: false,
1955
+ hourlySummariesEnabled: false,
1956
+ compoundingEnabled: false,
1957
+ knowledgeIndexEnabled: false,
1958
+ }),
1959
+ );
1960
+ let updateCalls = 0;
1961
+ let indexFresh = false;
1962
+ let release: (() => void) | undefined;
1963
+ const gate = new Promise<void>((resolve) => { release = resolve; });
1964
+ try {
1965
+ // SAFETY: the stub covers every qmd member startupSearchSync touches;
1966
+ // the field is private so the test injects it through `any`.
1967
+ (orchestrator as any).qmd = {
1968
+ probe: async () => true,
1969
+ debugStatus: () => "synthetic-qmd",
1970
+ isAvailable: () => true,
1971
+ search: async () => [],
1972
+ ensureCollection: async () => "present",
1973
+ update: async () => { updateCalls += 1; await gate; indexFresh = true; },
1974
+ // SAFETY: the qmd timestamps are nullable number fields on the private
1975
+ // backend shape; literal values keep the stub honest.
1976
+ lastUpdateRanAtMs: 1 as number | null,
1977
+ lastUpdateFailedAtMs: null as number | null,
1978
+ resetUpdateThrottles: () => undefined,
1979
+ };
1980
+ await orchestrator.initialize();
1981
+ // SAFETY: deferredReady is a private promise the test awaits
1982
+ // deliberately; `any` exposes it without widening the class API.
1983
+ await (orchestrator as any).deferredReady;
1984
+ // The post-ready fire has started the shared sync and the update is held
1985
+ // open. The one-shot caller joins before querying; on the pre-fix head
1986
+ // no join point exists, the optional call is a no-op, and this query
1987
+ // reads the stale index — the regression this test pins.
1988
+ // SAFETY: joinStartupSearchSync is the #3525 API under test; `any`
1989
+ // keeps the call a behavioral red where the method does not yet exist.
1990
+ const join = (orchestrator as any).joinStartupSearchSync?.();
1991
+ if (join) {
1992
+ // The join holds the caller until the corpus update commits; release
1993
+ // the held update and let it land.
1994
+ release?.();
1995
+ await join;
1996
+ }
1997
+ const sawFresh = indexFresh;
1998
+ orchestrator.abortDeferredInit();
1999
+ assert.equal(
2000
+ sawFresh, true,
2001
+ "the one-shot query must land after the committed corpus update",
2002
+ );
2003
+ assert.equal(updateCalls, 1, "the join must not spawn a second update");
2004
+ } finally {
2005
+ release?.();
2006
+ await orchestrator.destroy().catch(() => undefined);
2007
+ await rm(memoryDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 50 });
2008
+ }
2009
+ });
2010
+
2011
+ function syncTestConfig(memoryDir: string, namespacesEnabled: boolean) {
2012
+ return parseConfig({
2013
+ memoryDir,
2014
+ workspaceDir: path.join(memoryDir, "workspace"),
2015
+ qmdEnabled: true,
2016
+ qmdMaintenanceEnabled: true,
2017
+ namespacesEnabled,
2018
+ namespaceCatalogEnabled: false,
2019
+ defaultNamespace: "default",
2020
+ sharedNamespace: "shared",
2021
+ namespacePolicies: [],
2022
+ embeddingFallbackEnabled: false,
2023
+ identityContinuityEnabled: false,
2024
+ transcriptEnabled: false,
2025
+ hourlySummariesEnabled: false,
2026
+ compoundingEnabled: false,
2027
+ knowledgeIndexEnabled: false,
2028
+ });
2029
+ }
2030
+
2031
+ interface SyncTestQmd {
2032
+ probe(): Promise<boolean>;
2033
+ debugStatus(): string;
2034
+ isAvailable(): boolean;
2035
+ search(): Promise<never[]>;
2036
+ ensureCollection(): Promise<string>;
2037
+ update(): Promise<void>;
2038
+ lastUpdateRanAtMs: number | null;
2039
+ lastUpdateFailedAtMs: number | null;
2040
+ resetUpdateThrottles(): void;
2041
+ }
2042
+
2043
+ function syncTestQmd(overrides: Partial<SyncTestQmd> = {}): SyncTestQmd {
2044
+ return {
2045
+ probe: async () => true,
2046
+ debugStatus: () => "synthetic-qmd",
2047
+ isAvailable: () => true,
2048
+ search: async () => [],
2049
+ ensureCollection: async () => "present",
2050
+ update: async () => undefined,
2051
+ lastUpdateRanAtMs: 1,
2052
+ lastUpdateFailedAtMs: null,
2053
+ resetUpdateThrottles: () => undefined,
2054
+ ...overrides,
2055
+ };
2056
+ }
2057
+
2058
+ test("a rejected shared startup sync resolves false for callers with and without a signal (#3527)", async () => {
2059
+ // The local CLI joins without a signal. A rejection would skip its
2060
+ // stale-index warning, its query and its cleanup, so a failed shared run
2061
+ // must settle every caller with false.
2062
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-sync-reject-"));
2063
+ const orchestrator = new Orchestrator(syncTestConfig(memoryDir, false));
2064
+ const warnings: string[] = [];
2065
+ initLogger({ info() {}, warn: (msg) => { warnings.push(msg); }, error() {}, debug() {} }, false);
2066
+ try {
2067
+ // SAFETY: the stub covers every qmd member startupSearchSync touches;
2068
+ // the field is private so the test injects it through `any`.
2069
+ (orchestrator as any).qmd = syncTestQmd({
2070
+ ensureCollection: async () => { throw new Error("collection check exploded"); },
2071
+ });
2072
+ const unsignalled = orchestrator.startupSearchSync();
2073
+ const signalled = orchestrator.startupSearchSync(new AbortController().signal);
2074
+ // Await the unsignalled caller first: a rejection fails the test here.
2075
+ assert.equal(await unsignalled, false);
2076
+ assert.equal(await signalled, false);
2077
+ assert.ok(
2078
+ warnings.some((msg) => msg.includes("collection check exploded")),
2079
+ "the failure detail stays in the log",
2080
+ );
2081
+ } finally {
2082
+ resetLogger();
2083
+ await orchestrator.destroy().catch(() => undefined);
2084
+ await rm(memoryDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 50 });
2085
+ }
2086
+ });
2087
+
2088
+ test("a startup sync that skips a namespace names it and counts namespaces, not backends (#3527)", async () => {
2089
+ const memoryDir = await mkdtemp(path.join(os.tmpdir(), "remnic-sync-coverage-"));
2090
+ const orchestrator = new Orchestrator(syncTestConfig(memoryDir, true));
2091
+ const warnings: string[] = [];
2092
+ const infos: string[] = [];
2093
+ initLogger({
2094
+ info: (msg) => { infos.push(msg); },
2095
+ warn: (msg) => { warnings.push(msg); },
2096
+ error() {},
2097
+ debug() {},
2098
+ }, false);
2099
+ // SAFETY: the router and qmd are private orchestrator seams the
2100
+ // neighbouring lifecycle tests stub the same way.
2101
+ const orch = orchestrator as any;
2102
+ try {
2103
+ orch.qmd = syncTestQmd();
2104
+ orch.maintenanceNamespaces = () => Promise.resolve(orch.configuredNamespaceList());
2105
+ // "shared" has a missing collection: the router excludes it from the
2106
+ // update while the default namespace's backend still updates.
2107
+ orch.namespaceSearchRouter.ensureNamespaceCollection = async (namespace: string) =>
2108
+ namespace === "shared" ? "missing" : "present";
2109
+ orch.namespaceSearchRouter.updateNamespacesDetailed = async () => ({
2110
+ backendCount: 1,
2111
+ eligibleNamespaces: ["default"],
2112
+ });
2113
+
2114
+ const synced = await orchestrator.startupSearchSync();
2115
+
2116
+ assert.equal(synced, true, "a namespace with no collection has no index to refresh, so it does not fail the sync");
2117
+ assert.ok(
2118
+ warnings.some((msg) => msg.includes("skipped") && msg.includes("shared")),
2119
+ `the skipped namespace must be reported by name; warnings: ${JSON.stringify(warnings)}`,
2120
+ );
2121
+
2122
+ // One global backend updates both namespaces: the success line must count
2123
+ // two namespaces, not one backend.
2124
+ warnings.length = 0;
2125
+ infos.length = 0;
2126
+ orch.namespaceSearchRouter.ensureNamespaceCollection = async () => "present";
2127
+ orch.namespaceSearchRouter.updateNamespacesDetailed = async () => ({
2128
+ backendCount: 1,
2129
+ eligibleNamespaces: ["default", "shared"],
2130
+ });
2131
+ orch.deferredSyncSucceeded = false;
2132
+ assert.equal(await orchestrator.startupSearchSync(), true);
2133
+ assert.ok(
2134
+ infos.some((msg) => msg.includes("2/2 namespaces updated")),
2135
+ `the success line counts namespaces; infos: ${JSON.stringify(infos)}`,
2136
+ );
2137
+ assert.deepEqual(warnings, []);
2138
+ } finally {
2139
+ resetLogger();
2140
+ await orchestrator.destroy().catch(() => undefined);
2141
+ await rm(memoryDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 50 });
2142
+ }
2143
+ });
@@ -14,6 +14,7 @@ import {
14
14
  attachCitation,
15
15
  } from "./source-attribution.js";
16
16
  import type { ExtractionResult } from "./types.js";
17
+ import type { ExtractionPreemptHandle } from "./orchestration/extraction-queue-coordinator.js";
17
18
 
18
19
  /**
19
20
  * Issue #369 — Orchestrator-level source attribution end-to-end.
@@ -359,6 +360,105 @@ test("ingestReplayBatch globally queues source timestamps across sessions", asyn
359
360
  ]);
360
361
  });
361
362
 
363
+ test("ingestReplayBatch keeps global source order when a later slice would overtake", async () => {
364
+ // #3532 bounded the extraction queue to concurrent slots, so slices from
365
+ // different sessions run in parallel and a later-sorted slice can reach
366
+ // extraction before an earlier one that stalls mid-flight. Hold the first
367
+ // slice inside its task until the later slice's extraction starts (or a
368
+ // bound, so serialized execution still completes) and require the sorted
369
+ // order either way.
370
+ const { orchestrator } = await makeOrchestrator({
371
+ extractionMinChars: 0,
372
+ extractionMinUserTurns: 1,
373
+ threadingEnabled: false,
374
+ extractionQueueConcurrency: 2,
375
+ });
376
+
377
+ const observedTargets: Array<{
378
+ sessionKey: string | undefined;
379
+ content: string;
380
+ }> = [];
381
+ let releaseLaterExtract: () => void = () => {};
382
+ const laterExtractStarted = new Promise<void>((resolve) => {
383
+ releaseLaterExtract = resolve;
384
+ });
385
+ orchestrator.extraction = {
386
+ extract: async (turns: any[]) => {
387
+ const firstTarget = turns.find(
388
+ (turn) => turn.extractionContextOnly !== true,
389
+ );
390
+ observedTargets.push({
391
+ sessionKey: firstTarget?.sessionKey,
392
+ content: firstTarget?.content,
393
+ });
394
+ if (firstTarget?.content === "Later session source-dated turn.") {
395
+ releaseLaterExtract();
396
+ }
397
+ // SAFETY: the stub returns the ExtractionResult fields the drain reads;
398
+ // the remaining shape is unused by the queue path under test.
399
+ return {
400
+ facts: [makeFact(`Observed cross-session slice ${observedTargets.length}.`)],
401
+ entities: [],
402
+ relationships: [],
403
+ questions: [],
404
+ profileUpdates: [],
405
+ } as ExtractionResult;
406
+ },
407
+ };
408
+
409
+ const coordinator = orchestrator.extractionQueueCoordinator;
410
+ const originalRunPreemptable = coordinator.runPreemptable.bind(coordinator);
411
+ let held = false;
412
+ coordinator.runPreemptable = async <T>(
413
+ preempt: ExtractionPreemptHandle | undefined,
414
+ preemptable: boolean,
415
+ parent: AbortSignal | undefined,
416
+ run: (signal: AbortSignal) => Promise<T>,
417
+ ): Promise<T> => {
418
+ if (!held && preemptable === false) {
419
+ held = true;
420
+ await Promise.race([
421
+ laterExtractStarted,
422
+ new Promise<void>((resolve) => setTimeout(resolve, 250)),
423
+ ]);
424
+ }
425
+ return originalRunPreemptable(preempt, preemptable, parent, run);
426
+ };
427
+
428
+ await orchestrator.ingestReplayBatch(
429
+ [
430
+ {
431
+ source: "openclaw",
432
+ sessionKey: "beam-cross-session-later",
433
+ role: "user",
434
+ content: "Later session source-dated turn.",
435
+ timestamp: "2025-01-03T00:00:00Z",
436
+ sourceValidAt: "2025-01-03T00:00:00Z",
437
+ },
438
+ {
439
+ source: "openclaw",
440
+ sessionKey: "beam-cross-session-earlier",
441
+ role: "user",
442
+ content: "Earlier session source-dated turn.",
443
+ timestamp: "2025-01-01T00:00:00Z",
444
+ sourceValidAt: "2025-01-01T00:00:00Z",
445
+ },
446
+ ],
447
+ { archiveLcm: false },
448
+ );
449
+
450
+ assert.deepEqual(observedTargets, [
451
+ {
452
+ sessionKey: "beam-cross-session-earlier",
453
+ content: "Earlier session source-dated turn.",
454
+ },
455
+ {
456
+ sessionKey: "beam-cross-session-later",
457
+ content: "Later session source-dated turn.",
458
+ },
459
+ ]);
460
+ });
461
+
362
462
  test("ingestReplayBatch preserves undated replay batches without synthetic valid_at slicing", async () => {
363
463
  const { orchestrator, storage } = await makeOrchestrator({
364
464
  extractionMinChars: 0,