@remnic/core 9.3.690 → 9.3.692

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 (294) hide show
  1. package/dist/access-boundary.d.ts +7 -6
  2. package/dist/access-boundary.js +21 -21
  3. package/dist/access-cli.js +49 -47
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +7 -6
  6. package/dist/access-http.js +26 -26
  7. package/dist/access-mcp.d.ts +7 -6
  8. package/dist/access-mcp.js +23 -23
  9. package/dist/access-operations.d.ts +7 -6
  10. package/dist/access-operations.js +22 -22
  11. package/dist/{access-service-Dujr3MTm.d.ts → access-service-DvApf9LZ.d.ts} +2 -2
  12. package/dist/access-service.d.ts +7 -6
  13. package/dist/access-service.js +20 -20
  14. package/dist/access-surface-catalog.d.ts +7 -6
  15. package/dist/action-confidence.d.ts +1 -1
  16. package/dist/active-memory-bridge.d.ts +1 -1
  17. package/dist/active-recall.d.ts +1 -1
  18. package/dist/active-recall.js +1 -1
  19. package/dist/adapters/index.js +4 -4
  20. package/dist/adapters/registry.js +2 -2
  21. package/dist/{auto-sync-NUQWSFQD.js → auto-sync-RWXT6P5M.js} +5 -5
  22. package/dist/behavior-learner.d.ts +1 -1
  23. package/dist/behavior-signals.d.ts +1 -1
  24. package/dist/bootstrap.d.ts +6 -5
  25. package/dist/briefing.d.ts +1 -1
  26. package/dist/briefing.js +5 -5
  27. package/dist/buffer-surprise-report.d.ts +1 -1
  28. package/dist/buffer.d.ts +1 -1
  29. package/dist/calibration.d.ts +1 -1
  30. package/dist/calibration.js +2 -2
  31. package/dist/capabilities.d.ts +1 -1
  32. package/dist/{catalog-CKPtJ114.d.ts → catalog-BEWLjdOr.d.ts} +1 -1
  33. package/dist/causal-behavior.d.ts +1 -1
  34. package/dist/causal-consolidation.d.ts +1 -1
  35. package/dist/causal-consolidation.js +8 -8
  36. package/dist/{chunk-GTDH3IUH.js → chunk-2D27ODNX.js} +2 -2
  37. package/dist/{chunk-46URPRE6.js → chunk-2EN5WZQB.js} +2 -2
  38. package/dist/{chunk-3K37VPM3.js → chunk-3BRA3N5A.js} +2 -2
  39. package/dist/{chunk-RTFAZOIR.js → chunk-3VVH6ZQW.js} +2 -2
  40. package/dist/{chunk-ZU7N3S6V.js → chunk-4IQNAOP3.js} +6 -142
  41. package/dist/chunk-4IQNAOP3.js.map +1 -0
  42. package/dist/{chunk-FIVDN2SM.js → chunk-4RGWCRIJ.js} +4 -4
  43. package/dist/{chunk-AGJH5ISO.js → chunk-5KBNNUXS.js} +2 -2
  44. package/dist/{chunk-X7RLU5CR.js → chunk-66HROLW5.js} +2 -2
  45. package/dist/chunk-6C2BMUZA.js +444 -0
  46. package/dist/chunk-6C2BMUZA.js.map +1 -0
  47. package/dist/{chunk-TYF3D4MS.js → chunk-6ZNIUGXB.js} +11 -11
  48. package/dist/{chunk-UPIBE2DK.js → chunk-ADUAF5EV.js} +2 -2
  49. package/dist/{chunk-LLONI6PY.js → chunk-AFWEUTMS.js} +2 -2
  50. package/dist/{chunk-ZUDM75KG.js → chunk-DCWIQFNA.js} +4 -4
  51. package/dist/{chunk-OMKUJTVJ.js → chunk-DO7MDZMU.js} +4 -4
  52. package/dist/{chunk-NGFEWFNK.js → chunk-DQHZA7Y3.js} +1 -1
  53. package/dist/chunk-DQHZA7Y3.js.map +1 -0
  54. package/dist/{chunk-LXIEXSHU.js → chunk-E6BOD3UJ.js} +2 -2
  55. package/dist/{chunk-OBXTMFZQ.js → chunk-ECZPWSB5.js} +2 -2
  56. package/dist/{chunk-CWE74HRG.js → chunk-FM7KLRKN.js} +3 -3
  57. package/dist/{chunk-BFVPIKDY.js → chunk-GCOSQBQ2.js} +3 -3
  58. package/dist/chunk-HXNMDPHN.js +149 -0
  59. package/dist/chunk-HXNMDPHN.js.map +1 -0
  60. package/dist/{chunk-MDYG7VI7.js → chunk-IREVVFTM.js} +10 -1
  61. package/dist/{chunk-MDYG7VI7.js.map → chunk-IREVVFTM.js.map} +1 -1
  62. package/dist/{chunk-RKNJBZ55.js → chunk-JBPKEARU.js} +4 -4
  63. package/dist/{chunk-CP2NZQLT.js → chunk-KYH53EFD.js} +6 -6
  64. package/dist/{chunk-LQ6JI4VH.js → chunk-LD53WPMU.js} +4 -4
  65. package/dist/{chunk-SB6CQTKP.js → chunk-MCV2DD6F.js} +2 -2
  66. package/dist/{chunk-3FC6LW6T.js → chunk-MRFVMSTR.js} +2 -2
  67. package/dist/{chunk-WDXCNJSF.js → chunk-MXZWKOOR.js} +2 -2
  68. package/dist/{chunk-NSVXK7M5.js → chunk-NEILAC3H.js} +3 -3
  69. package/dist/{chunk-RGNEARXW.js → chunk-NUZ3N445.js} +7 -7
  70. package/dist/{chunk-WROKD3XC.js → chunk-O4ZIV62T.js} +35 -35
  71. package/dist/{chunk-PHZKALOE.js → chunk-QFG23CRE.js} +2 -2
  72. package/dist/{chunk-A4HH2EWA.js → chunk-QVG4LAQO.js} +2 -2
  73. package/dist/{chunk-54PVJDO5.js → chunk-SAC5V6JT.js} +2 -2
  74. package/dist/{chunk-XKUKJIOY.js → chunk-SEK4XIDN.js} +6 -6
  75. package/dist/{chunk-5CEJH5ZN.js → chunk-TAPSNIMA.js} +4 -4
  76. package/dist/{chunk-2N6UNJSX.js → chunk-U2OBZSGG.js} +2 -2
  77. package/dist/{chunk-BKAMHZYR.js → chunk-UOCLRM74.js} +2 -2
  78. package/dist/{chunk-A7UZR6RA.js → chunk-UTUYAPLY.js} +14 -1
  79. package/dist/chunk-UTUYAPLY.js.map +1 -0
  80. package/dist/{chunk-Z7KILAOU.js → chunk-V56S3A23.js} +19 -19
  81. package/dist/{chunk-CUNTLEJP.js → chunk-VFVG4NS2.js} +30 -9
  82. package/dist/chunk-VFVG4NS2.js.map +1 -0
  83. package/dist/{chunk-UD5OKH4J.js → chunk-W4ELOUNX.js} +2 -2
  84. package/dist/{chunk-CE6CBRCV.js → chunk-W4MICQIZ.js} +89 -407
  85. package/dist/chunk-W4MICQIZ.js.map +1 -0
  86. package/dist/{chunk-GR77Z2BM.js → chunk-WIKNVFBS.js} +2 -2
  87. package/dist/{chunk-WRFKZEO6.js → chunk-YQGHW5ML.js} +4 -4
  88. package/dist/{chunk-67MMWC74.js → chunk-ZLXGFAML.js} +2 -2
  89. package/dist/{cli-BkDp6WNi.d.ts → cli-BjsY9Le7.d.ts} +3 -3
  90. package/dist/cli.d.ts +8 -7
  91. package/dist/cli.js +45 -44
  92. package/dist/compounding/engine.d.ts +1 -1
  93. package/dist/compounding/engine.js +5 -5
  94. package/dist/compounding/preference-consolidator.d.ts +1 -1
  95. package/dist/compression-optimizer.d.ts +1 -1
  96. package/dist/config.d.ts +1 -1
  97. package/dist/config.js +1 -1
  98. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  99. package/dist/connectors/codex-materialize-runner.js +5 -5
  100. package/dist/connectors/codex-materialize.d.ts +1 -1
  101. package/dist/connectors/index.d.ts +1 -1
  102. package/dist/connectors/index.js +5 -5
  103. package/dist/consolidation-provenance-check.d.ts +1 -1
  104. package/dist/consolidation-undo.d.ts +1 -1
  105. package/dist/contradiction/index.d.ts +1 -1
  106. package/dist/conversation-index/backend.d.ts +1 -1
  107. package/dist/conversation-index/backend.js +2 -2
  108. package/dist/conversation-index/chunker.d.ts +1 -1
  109. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  110. package/dist/conversation-index/indexer.d.ts +1 -1
  111. package/dist/conversation-index/search.d.ts +1 -1
  112. package/dist/day-summary.d.ts +1 -1
  113. package/dist/delinearize.d.ts +1 -1
  114. package/dist/direct-answer-wiring.d.ts +1 -1
  115. package/dist/direct-answer.d.ts +1 -1
  116. package/dist/embedding-fallback.d.ts +1 -1
  117. package/dist/enrichment/index.d.ts +1 -1
  118. package/dist/entity-retrieval.d.ts +1 -1
  119. package/dist/entity-retrieval.js +5 -5
  120. package/dist/entity-schema.d.ts +1 -1
  121. package/dist/event-time.d.ts +35 -0
  122. package/dist/event-time.js +325 -0
  123. package/dist/event-time.js.map +1 -0
  124. package/dist/explicit-capture.d.ts +6 -5
  125. package/dist/extraction-judge-telemetry.d.ts +1 -1
  126. package/dist/extraction-judge-training.d.ts +1 -1
  127. package/dist/extraction-judge.d.ts +1 -1
  128. package/dist/extraction-judge.js +3 -3
  129. package/dist/extraction.d.ts +1 -1
  130. package/dist/extraction.js +3 -3
  131. package/dist/fallback-llm.d.ts +1 -1
  132. package/dist/fallback-llm.js +2 -2
  133. package/dist/identity-continuity.d.ts +1 -1
  134. package/dist/importance.d.ts +1 -1
  135. package/dist/index.d.ts +11 -10
  136. package/dist/index.js +77 -75
  137. package/dist/index.js.map +1 -1
  138. package/dist/intent.d.ts +1 -1
  139. package/dist/lcm/engine.d.ts +1 -1
  140. package/dist/lcm/index.d.ts +1 -1
  141. package/dist/lcm/tools.d.ts +1 -1
  142. package/dist/lifecycle.d.ts +1 -1
  143. package/dist/live-connectors-runner.d.ts +1 -1
  144. package/dist/local-llm.d.ts +1 -1
  145. package/dist/maintenance/memory-governance.d.ts +1 -1
  146. package/dist/maintenance/memory-governance.js +5 -5
  147. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +5 -5
  148. package/dist/maintenance/rebuild-memory-projection.js +6 -6
  149. package/dist/mcp-memory-inspector-app.d.ts +7 -6
  150. package/dist/memory-action-policy.d.ts +1 -1
  151. package/dist/memory-cache.d.ts +1 -1
  152. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  153. package/dist/memory-projection-store.d.ts +1 -1
  154. package/dist/memory-provenance.d.ts +1 -1
  155. package/dist/memory-worth-outcomes.d.ts +1 -1
  156. package/dist/models-json.d.ts +1 -1
  157. package/dist/namespaces/migrate.d.ts +2 -2
  158. package/dist/namespaces/migrate.js +15 -15
  159. package/dist/namespaces/principal.d.ts +1 -1
  160. package/dist/namespaces/search.d.ts +1 -1
  161. package/dist/namespaces/search.js +9 -9
  162. package/dist/namespaces/storage.d.ts +2 -2
  163. package/dist/namespaces/storage.js +5 -5
  164. package/dist/native-knowledge.d.ts +1 -1
  165. package/dist/operator-toolkit.d.ts +1 -1
  166. package/dist/operator-toolkit.js +20 -19
  167. package/dist/orchestration/maintenance.d.ts +112 -0
  168. package/dist/orchestration/maintenance.js +39 -0
  169. package/dist/orchestration/maintenance.js.map +1 -0
  170. package/dist/{orchestrator-B7ixmUkP.d.ts → orchestrator-CNJCYjZ1.d.ts} +12 -36
  171. package/dist/orchestrator.d.ts +5 -4
  172. package/dist/orchestrator.js +42 -40
  173. package/dist/patterns-cli.d.ts +1 -1
  174. package/dist/policy-runtime.d.ts +1 -1
  175. package/dist/provenance.d.ts +1 -1
  176. package/dist/qmd-recall-cache.d.ts +1 -1
  177. package/dist/qmd.d.ts +1 -1
  178. package/dist/recall-disclosure-escalation.d.ts +1 -1
  179. package/dist/recall-explain-renderer.d.ts +1 -1
  180. package/dist/recall-explain-renderer.js +3 -3
  181. package/dist/recall-planner-llm.d.ts +1 -1
  182. package/dist/recall-planner-llm.js +2 -2
  183. package/dist/recall-state.d.ts +1 -1
  184. package/dist/recall-tag-filter.d.ts +1 -1
  185. package/dist/recall-xray-cli.d.ts +1 -1
  186. package/dist/recall-xray-cli.js +4 -4
  187. package/dist/recall-xray-renderer.d.ts +1 -1
  188. package/dist/recall-xray-renderer.js +3 -3
  189. package/dist/recall-xray.d.ts +1 -1
  190. package/dist/recall-xray.js +2 -2
  191. package/dist/resolve-auth-token.d.ts +1 -1
  192. package/dist/resume-bundles.js +2 -2
  193. package/dist/retrieval-agents.d.ts +1 -1
  194. package/dist/retrieval-tiers.d.ts +1 -1
  195. package/dist/routing/engine.d.ts +1 -1
  196. package/dist/routing/store.d.ts +1 -1
  197. package/dist/search/embed-helper.d.ts +1 -1
  198. package/dist/search/factory.d.ts +1 -1
  199. package/dist/search/factory.js +8 -8
  200. package/dist/search/index.d.ts +1 -1
  201. package/dist/search/index.js +13 -13
  202. package/dist/search/lancedb-backend.d.ts +1 -1
  203. package/dist/search/lancedb-backend.js +2 -2
  204. package/dist/search/meilisearch-backend.d.ts +1 -1
  205. package/dist/search/meilisearch-backend.js +2 -2
  206. package/dist/search/noop-backend.d.ts +1 -1
  207. package/dist/search/orama-backend.d.ts +1 -1
  208. package/dist/search/orama-backend.js +2 -2
  209. package/dist/search/port.d.ts +1 -1
  210. package/dist/search/remote-backend.d.ts +1 -1
  211. package/dist/{semantic-consolidation-CWch5uM7.d.ts → semantic-consolidation-D5U0Mrdb.d.ts} +1 -1
  212. package/dist/semantic-consolidation.d.ts +2 -2
  213. package/dist/semantic-consolidation.js +6 -6
  214. package/dist/semantic-rule-promotion.js +5 -5
  215. package/dist/semantic-rule-verifier.d.ts +1 -1
  216. package/dist/semantic-rule-verifier.js +5 -5
  217. package/dist/session-observer-bands.d.ts +1 -1
  218. package/dist/session-observer-state.d.ts +1 -1
  219. package/dist/shared-context/manager.d.ts +1 -1
  220. package/dist/signal.d.ts +1 -1
  221. package/dist/storage.d.ts +3 -1
  222. package/dist/storage.js +4 -4
  223. package/dist/summarizer.d.ts +1 -1
  224. package/dist/summarizer.js +3 -3
  225. package/dist/summary-snapshot.d.ts +1 -1
  226. package/dist/temporal-supersession.d.ts +1 -1
  227. package/dist/temporal-supersession.js +2 -2
  228. package/dist/temporal-validity.d.ts +22 -2
  229. package/dist/temporal-validity.js +3 -1
  230. package/dist/threading.d.ts +1 -1
  231. package/dist/tier-migration.d.ts +1 -1
  232. package/dist/tier-routing.d.ts +1 -1
  233. package/dist/topics.d.ts +1 -1
  234. package/dist/transcript.d.ts +1 -1
  235. package/dist/{types-Dm5xxVrr.d.ts → types-2NoBoRBM.d.ts} +38 -0
  236. package/dist/types.d.ts +1 -1
  237. package/dist/types.js +1 -1
  238. package/dist/utility-runtime.d.ts +1 -1
  239. package/dist/verified-recall.js +5 -5
  240. package/package.json +12 -2
  241. package/src/bitemporal-frontmatter.test.ts +177 -0
  242. package/src/config.ts +13 -0
  243. package/src/event-time.test.ts +514 -0
  244. package/src/event-time.ts +548 -0
  245. package/src/orchestration/maintenance.test.ts +738 -0
  246. package/src/orchestration/maintenance.ts +557 -0
  247. package/src/orchestrator-flush.test.ts +0 -599
  248. package/src/orchestrator.ts +60 -420
  249. package/src/storage.ts +34 -0
  250. package/src/temporal-validity.ts +34 -0
  251. package/src/types.ts +38 -0
  252. package/dist/chunk-A7UZR6RA.js.map +0 -1
  253. package/dist/chunk-CE6CBRCV.js.map +0 -1
  254. package/dist/chunk-CUNTLEJP.js.map +0 -1
  255. package/dist/chunk-NGFEWFNK.js.map +0 -1
  256. package/dist/chunk-ZU7N3S6V.js.map +0 -1
  257. /package/dist/{auto-sync-NUQWSFQD.js.map → auto-sync-RWXT6P5M.js.map} +0 -0
  258. /package/dist/{chunk-GTDH3IUH.js.map → chunk-2D27ODNX.js.map} +0 -0
  259. /package/dist/{chunk-46URPRE6.js.map → chunk-2EN5WZQB.js.map} +0 -0
  260. /package/dist/{chunk-3K37VPM3.js.map → chunk-3BRA3N5A.js.map} +0 -0
  261. /package/dist/{chunk-RTFAZOIR.js.map → chunk-3VVH6ZQW.js.map} +0 -0
  262. /package/dist/{chunk-FIVDN2SM.js.map → chunk-4RGWCRIJ.js.map} +0 -0
  263. /package/dist/{chunk-AGJH5ISO.js.map → chunk-5KBNNUXS.js.map} +0 -0
  264. /package/dist/{chunk-X7RLU5CR.js.map → chunk-66HROLW5.js.map} +0 -0
  265. /package/dist/{chunk-TYF3D4MS.js.map → chunk-6ZNIUGXB.js.map} +0 -0
  266. /package/dist/{chunk-UPIBE2DK.js.map → chunk-ADUAF5EV.js.map} +0 -0
  267. /package/dist/{chunk-LLONI6PY.js.map → chunk-AFWEUTMS.js.map} +0 -0
  268. /package/dist/{chunk-ZUDM75KG.js.map → chunk-DCWIQFNA.js.map} +0 -0
  269. /package/dist/{chunk-OMKUJTVJ.js.map → chunk-DO7MDZMU.js.map} +0 -0
  270. /package/dist/{chunk-LXIEXSHU.js.map → chunk-E6BOD3UJ.js.map} +0 -0
  271. /package/dist/{chunk-OBXTMFZQ.js.map → chunk-ECZPWSB5.js.map} +0 -0
  272. /package/dist/{chunk-CWE74HRG.js.map → chunk-FM7KLRKN.js.map} +0 -0
  273. /package/dist/{chunk-BFVPIKDY.js.map → chunk-GCOSQBQ2.js.map} +0 -0
  274. /package/dist/{chunk-RKNJBZ55.js.map → chunk-JBPKEARU.js.map} +0 -0
  275. /package/dist/{chunk-CP2NZQLT.js.map → chunk-KYH53EFD.js.map} +0 -0
  276. /package/dist/{chunk-LQ6JI4VH.js.map → chunk-LD53WPMU.js.map} +0 -0
  277. /package/dist/{chunk-SB6CQTKP.js.map → chunk-MCV2DD6F.js.map} +0 -0
  278. /package/dist/{chunk-3FC6LW6T.js.map → chunk-MRFVMSTR.js.map} +0 -0
  279. /package/dist/{chunk-WDXCNJSF.js.map → chunk-MXZWKOOR.js.map} +0 -0
  280. /package/dist/{chunk-NSVXK7M5.js.map → chunk-NEILAC3H.js.map} +0 -0
  281. /package/dist/{chunk-RGNEARXW.js.map → chunk-NUZ3N445.js.map} +0 -0
  282. /package/dist/{chunk-WROKD3XC.js.map → chunk-O4ZIV62T.js.map} +0 -0
  283. /package/dist/{chunk-PHZKALOE.js.map → chunk-QFG23CRE.js.map} +0 -0
  284. /package/dist/{chunk-A4HH2EWA.js.map → chunk-QVG4LAQO.js.map} +0 -0
  285. /package/dist/{chunk-54PVJDO5.js.map → chunk-SAC5V6JT.js.map} +0 -0
  286. /package/dist/{chunk-XKUKJIOY.js.map → chunk-SEK4XIDN.js.map} +0 -0
  287. /package/dist/{chunk-5CEJH5ZN.js.map → chunk-TAPSNIMA.js.map} +0 -0
  288. /package/dist/{chunk-2N6UNJSX.js.map → chunk-U2OBZSGG.js.map} +0 -0
  289. /package/dist/{chunk-BKAMHZYR.js.map → chunk-UOCLRM74.js.map} +0 -0
  290. /package/dist/{chunk-Z7KILAOU.js.map → chunk-V56S3A23.js.map} +0 -0
  291. /package/dist/{chunk-UD5OKH4J.js.map → chunk-W4ELOUNX.js.map} +0 -0
  292. /package/dist/{chunk-GR77Z2BM.js.map → chunk-WIKNVFBS.js.map} +0 -0
  293. /package/dist/{chunk-WRFKZEO6.js.map → chunk-YQGHW5ML.js.map} +0 -0
  294. /package/dist/{chunk-67MMWC74.js.map → chunk-ZLXGFAML.js.map} +0 -0
@@ -4,19 +4,13 @@ import {
4
4
  loadSyncState,
5
5
  syncWearableSource,
6
6
  wearableSourceLabel
7
- } from "./chunk-AGJH5ISO.js";
7
+ } from "./chunk-5KBNNUXS.js";
8
+ import {
9
+ MaintenanceScheduler
10
+ } from "./chunk-6C2BMUZA.js";
8
11
  import {
9
12
  migrateFromEngram
10
13
  } from "./chunk-7HYPN2GC.js";
11
- import {
12
- ensureContradictionScanCron,
13
- ensureDaySummaryCron,
14
- ensureGraphEdgeDecayCron,
15
- ensureNightlyGovernanceCron,
16
- ensurePatternReinforcementCron,
17
- ensureProceduralMiningCron,
18
- graphEdgeDecayCadenceToCronExpr
19
- } from "./chunk-666A3MOW.js";
20
14
  import {
21
15
  LcmEngine
22
16
  } from "./chunk-X5J3JZR3.js";
@@ -29,7 +23,7 @@ import {
29
23
  import {
30
24
  CompoundingEngine,
31
25
  defaultTierMigrationCycleBudget
32
- } from "./chunk-BKAMHZYR.js";
26
+ } from "./chunk-UOCLRM74.js";
33
27
  import {
34
28
  SharedContextManager
35
29
  } from "./chunk-UFS7OXGL.js";
@@ -38,6 +32,15 @@ import {
38
32
  applyUtilityRankingRuntimeDelta,
39
33
  loadUtilityRuntimeValues
40
34
  } from "./chunk-LXOM6IQU.js";
35
+ import {
36
+ applyTemporalSupersession,
37
+ normalizeSupersessionKey,
38
+ shouldFilterSupersededFromRecall
39
+ } from "./chunk-MRFVMSTR.js";
40
+ import {
41
+ isValidAsOf,
42
+ isValidityExpiredNow
43
+ } from "./chunk-IREVVFTM.js";
41
44
  import {
42
45
  TierMigrationExecutor
43
46
  } from "./chunk-VOUOLGIP.js";
@@ -52,19 +55,11 @@ import {
52
55
  } from "./chunk-UHGBNIOS.js";
53
56
  import {
54
57
  HourlySummarizer
55
- } from "./chunk-A4HH2EWA.js";
58
+ } from "./chunk-QVG4LAQO.js";
56
59
  import {
57
60
  buildTargetedFactRecallSection,
58
61
  shouldRecallTargetedFactEvidence
59
62
  } from "./chunk-R5DB26G6.js";
60
- import {
61
- applyTemporalSupersession,
62
- normalizeSupersessionKey,
63
- shouldFilterSupersededFromRecall
64
- } from "./chunk-3FC6LW6T.js";
65
- import {
66
- isValidAsOf
67
- } from "./chunk-MDYG7VI7.js";
68
63
  import {
69
64
  SessionObserverState
70
65
  } from "./chunk-DKTSR7EK.js";
@@ -140,6 +135,18 @@ import {
140
135
  import {
141
136
  classifyMemoryKind
142
137
  } from "./chunk-YAZNBMNF.js";
138
+ import {
139
+ ExtractionEngine
140
+ } from "./chunk-MXZWKOOR.js";
141
+ import {
142
+ parseMemoryActionEligibilityContext
143
+ } from "./chunk-ROZJACKP.js";
144
+ import {
145
+ ModelRegistry
146
+ } from "./chunk-PWFWCGOO.js";
147
+ import {
148
+ LocalLlmClient
149
+ } from "./chunk-UPTZYUYJ.js";
143
150
  import {
144
151
  buildFocusedListRecallSection,
145
152
  shouldRecallFocusedListEvidence
@@ -160,19 +167,7 @@ import {
160
167
  getVerdictKind,
161
168
  judgeFactDurability,
162
169
  validateProcedureExtraction
163
- } from "./chunk-OBXTMFZQ.js";
164
- import {
165
- ExtractionEngine
166
- } from "./chunk-WDXCNJSF.js";
167
- import {
168
- parseMemoryActionEligibilityContext
169
- } from "./chunk-ROZJACKP.js";
170
- import {
171
- ModelRegistry
172
- } from "./chunk-PWFWCGOO.js";
173
- import {
174
- LocalLlmClient
175
- } from "./chunk-UPTZYUYJ.js";
170
+ } from "./chunk-ECZPWSB5.js";
176
171
  import {
177
172
  tryDirectAnswer
178
173
  } from "./chunk-OQH5XUH3.js";
@@ -183,27 +178,27 @@ import {
183
178
  buildEntityRecallSection,
184
179
  entityRecentTranscriptLookbackHours,
185
180
  readRecentEntityTranscriptEntries
186
- } from "./chunk-2N6UNJSX.js";
181
+ } from "./chunk-U2OBZSGG.js";
187
182
  import {
188
183
  formatDaySummaryMemories
189
184
  } from "./chunk-EO5QWINU.js";
190
- import {
191
- RoutingRulesStore
192
- } from "./chunk-WIWPSQYU.js";
193
185
  import {
194
186
  normalizeReplaySessionKey
195
187
  } from "./chunk-2PRQG7PV.js";
188
+ import {
189
+ RoutingRulesStore
190
+ } from "./chunk-WIWPSQYU.js";
196
191
  import {
197
192
  compareVerifiedEpisodeResults,
198
193
  searchVerifiedEpisodes
199
- } from "./chunk-RTFAZOIR.js";
194
+ } from "./chunk-3VVH6ZQW.js";
200
195
  import {
201
196
  ThreadingManager
202
197
  } from "./chunk-QRDOSYOR.js";
203
198
  import {
204
199
  compareVerifiedSemanticRuleResults,
205
200
  searchVerifiedSemanticRules
206
- } from "./chunk-67MMWC74.js";
201
+ } from "./chunk-ZLXGFAML.js";
207
202
  import {
208
203
  searchWorkProductLedgerEntries
209
204
  } from "./chunk-ZRWB5D4H.js";
@@ -214,15 +209,16 @@ import {
214
209
  PolicyRuntimeManager
215
210
  } from "./chunk-33JBK2XP.js";
216
211
  import {
217
- NamespaceCatalog,
218
- planNamespaceMaintenance,
219
- runNamespaceMaintenanceBatchPlan,
220
212
  runNamespaceMaintenanceFanout,
221
213
  summarizeNamespaceMaintenanceHealth
222
- } from "./chunk-ZU7N3S6V.js";
214
+ } from "./chunk-HXNMDPHN.js";
215
+ import {
216
+ NamespaceCatalog,
217
+ planNamespaceMaintenance
218
+ } from "./chunk-4IQNAOP3.js";
223
219
  import {
224
220
  NamespaceStorageRouter
225
- } from "./chunk-UD5OKH4J.js";
221
+ } from "./chunk-W4ELOUNX.js";
226
222
  import {
227
223
  isAboveImportanceThreshold,
228
224
  scoreImportance
@@ -267,7 +263,7 @@ import {
267
263
  materializeAfterSemanticConsolidation,
268
264
  parseConsolidationResponse,
269
265
  parseOperatorAwareConsolidationResponse
270
- } from "./chunk-PHZKALOE.js";
266
+ } from "./chunk-QFG23CRE.js";
271
267
  import {
272
268
  buildBehaviorSignalsForMemory,
273
269
  dedupeBehaviorSignalsByMemoryAndHash
@@ -294,7 +290,7 @@ import {
294
290
  FallbackLlmClient,
295
291
  fallbackLlmRuntimeContextFromConfig,
296
292
  gatewayTaskChainOptions
297
- } from "./chunk-FIVDN2SM.js";
293
+ } from "./chunk-4RGWCRIJ.js";
298
294
  import {
299
295
  compileCorrectionRule,
300
296
  correctionsFilePath,
@@ -325,18 +321,18 @@ import {
325
321
  } from "./chunk-FF4KLI5W.js";
326
322
  import {
327
323
  buildXraySnapshot
328
- } from "./chunk-LLONI6PY.js";
324
+ } from "./chunk-AFWEUTMS.js";
329
325
  import {
330
326
  objectiveStateStoreOverrideForNamespace,
331
327
  searchObjectiveStateSnapshots
332
328
  } from "./chunk-6HMYUWXR.js";
333
329
  import {
334
330
  NamespaceSearchRouter
335
- } from "./chunk-LXIEXSHU.js";
331
+ } from "./chunk-E6BOD3UJ.js";
336
332
  import {
337
333
  createConversationIndexRuntime,
338
334
  createSearchBackend
339
- } from "./chunk-TYF3D4MS.js";
335
+ } from "./chunk-6ZNIUGXB.js";
340
336
  import {
341
337
  NoopSearchBackend
342
338
  } from "./chunk-CYEPCZN5.js";
@@ -351,12 +347,12 @@ import {
351
347
  import {
352
348
  parseQmdExplain
353
349
  } from "./chunk-K43PI6DQ.js";
354
- import {
355
- shouldSkipImplicitExtraction
356
- } from "./chunk-U33LWTQQ.js";
357
350
  import {
358
351
  ProfilingCollector
359
352
  } from "./chunk-PNLCEFE4.js";
353
+ import {
354
+ shouldSkipImplicitExtraction
355
+ } from "./chunk-U33LWTQQ.js";
360
356
  import {
361
357
  buildProcedurePersistBody
362
358
  } from "./chunk-QDW3E4RD.js";
@@ -368,7 +364,7 @@ import {
368
364
  } from "./chunk-YN4ZT4CW.js";
369
365
  import {
370
366
  buildChainFollowupGenerator
371
- } from "./chunk-X7RLU5CR.js";
367
+ } from "./chunk-66HROLW5.js";
372
368
  import {
373
369
  ContentHashIndex,
374
370
  StorageManager,
@@ -376,7 +372,7 @@ import {
376
372
  fingerprintEntityStructuredFacts,
377
373
  normalizeAttributePairs,
378
374
  parseEntityFile
379
- } from "./chunk-CUNTLEJP.js";
375
+ } from "./chunk-VFVG4NS2.js";
380
376
  import {
381
377
  isValidTranscriptDate,
382
378
  loadSpeakerRegistry,
@@ -397,7 +393,7 @@ import {
397
393
  } from "./chunk-J6A3CX5N.js";
398
394
  import {
399
395
  confidenceTier
400
- } from "./chunk-NGFEWFNK.js";
396
+ } from "./chunk-DQHZA7Y3.js";
401
397
  import {
402
398
  buildQmdRecallCacheKey,
403
399
  getCachedQmdRecall,
@@ -441,9 +437,6 @@ import {
441
437
  isSafeRouteNamespace,
442
438
  selectRouteRule
443
439
  } from "./chunk-U3PN77QT.js";
444
- import {
445
- resolveHomeDir
446
- } from "./chunk-JUC24CTX.js";
447
440
  import {
448
441
  log
449
442
  } from "./chunk-NU3CSQ4H.js";
@@ -2392,10 +2385,6 @@ function resolvePersistedMemoryRelativePath(options) {
2392
2385
  }
2393
2386
  return path2.join(subtree, `${options.memoryId}.md`);
2394
2387
  }
2395
- function qmdMaintenanceSkipReasonForError(error) {
2396
- const message = error instanceof Error ? error.message : String(error);
2397
- return /^QMD (?:update|embed) skipped by .*min-interval gate$/.test(message) ? "throttled" : null;
2398
- }
2399
2388
  var Orchestrator = class _Orchestrator {
2400
2389
  storage;
2401
2390
  storageRouter;
@@ -2405,6 +2394,12 @@ var Orchestrator = class _Orchestrator {
2405
2394
  namespaceStorageDirHintsLoaded = false;
2406
2395
  namespaceSearchRouter;
2407
2396
  qmd;
2397
+ /**
2398
+ * Maintenance scheduler (issue #1526 PR1). Owns cron auto-registration,
2399
+ * debounced QMD index maintenance, and consolidation scheduling. Job
2400
+ * runners (consolidation/pattern-reinforcement/governance) stay here.
2401
+ */
2402
+ maintenanceScheduler;
2408
2403
  conversationQmd;
2409
2404
  conversationFaiss;
2410
2405
  conversationIndexBackend;
@@ -2513,17 +2508,9 @@ var Orchestrator = class _Orchestrator {
2513
2508
  queueProcessing = false;
2514
2509
  heartbeatObserverChains = /* @__PURE__ */ new Map();
2515
2510
  recentExtractionFingerprints = /* @__PURE__ */ new Map();
2516
- nonZeroExtractionsSinceConsolidation = 0;
2517
- lastConsolidationRunAtMs = 0;
2518
- consolidationInFlight = false;
2519
2511
  consolidationObservers = /* @__PURE__ */ new Set();
2520
- qmdMaintenanceTimer = null;
2521
2512
  wearablesServiceInstance = null;
2522
2513
  wearablesAutoSyncHandle = null;
2523
- qmdMaintenancePending = false;
2524
- qmdMaintenanceInFlight = false;
2525
- lastQmdEmbedAtMs = 0;
2526
- lastQmdEmbedAtMsByNamespace = /* @__PURE__ */ new Map();
2527
2514
  lastQmdReprobeAtMs = 0;
2528
2515
  tierMigrationInFlight = false;
2529
2516
  lastTierMigrationRunAtMs = 0;
@@ -2599,11 +2586,7 @@ var Orchestrator = class _Orchestrator {
2599
2586
  await this.wearablesAutoSyncHandle.stop();
2600
2587
  this.wearablesAutoSyncHandle = null;
2601
2588
  }
2602
- if (this.qmdMaintenanceTimer) {
2603
- clearTimeout(this.qmdMaintenanceTimer);
2604
- this.qmdMaintenanceTimer = null;
2605
- }
2606
- this.qmdMaintenancePending = false;
2589
+ this.maintenanceScheduler.dispose();
2607
2590
  await this.namespaceSearchRouter.dispose();
2608
2591
  await this.disposeSearchBackendIfNeeded();
2609
2592
  if (this.conversationQmd && this.conversationQmd !== this.qmd) {
@@ -2931,21 +2914,6 @@ var Orchestrator = class _Orchestrator {
2931
2914
  this.rememberNamespaceStorageDirHint(record.namespace, record.storageDir);
2932
2915
  }
2933
2916
  }
2934
- /**
2935
- * Shared namespace maintenance planner (issue #1500). This extends the
2936
- * #1499 catalog-union QMD helper into a reusable contract: configured
2937
- * namespaces are always considered, dynamic catalog namespaces are admitted
2938
- * only when their live router root still matches real memory data, and branch
2939
- * namespaces are opt-in. Recurring jobs use the per-cycle budget; startup and
2940
- * recovery discovery paths use the same safety filters without that cycle
2941
- * budget so every live namespace is ensured/synced.
2942
- */
2943
- async namespaceMaintenancePlan(jobName) {
2944
- return planNamespaceMaintenance(this.config, {
2945
- jobName,
2946
- catalog: this.namespaceCatalog
2947
- });
2948
- }
2949
2917
  async maintenanceNamespaces(jobName = "qmd", budgetMode = "unbounded") {
2950
2918
  const plan = await planNamespaceMaintenance(this.config, {
2951
2919
  jobName,
@@ -3147,6 +3115,16 @@ var Orchestrator = class _Orchestrator {
3147
3115
  }
3148
3116
  }
3149
3117
  this.qmd = createSearchBackend(config);
3118
+ this.maintenanceScheduler = new MaintenanceScheduler({
3119
+ config,
3120
+ // Live accessor: the orchestrator reassigns this.qmd to NoopSearchBackend
3121
+ // after construction when the collection is missing (initialize /
3122
+ // startupSearchSync); the scheduler must read the current backend so
3123
+ // debounced maintenance never runs against a stale/disposed one.
3124
+ getQmd: () => this.qmd,
3125
+ namespaceSearchRouter: this.namespaceSearchRouter,
3126
+ namespaceCatalog: this.namespaceCatalog
3127
+ });
3150
3128
  const conversationIndexRuntime = createConversationIndexRuntime(config, {
3151
3129
  getQmd: () => this.conversationQmd,
3152
3130
  getFaiss: () => this.conversationFaiss
@@ -3707,48 +3685,7 @@ var Orchestrator = class _Orchestrator {
3707
3685
  }
3708
3686
  }
3709
3687
  if (signal.aborted) return;
3710
- if (this.config.daySummaryEnabled) {
3711
- try {
3712
- await this.autoRegisterDaySummaryCron();
3713
- } catch (err) {
3714
- log.debug(`day-summary cron auto-register failed (non-fatal): ${err}`);
3715
- }
3716
- }
3717
- if (this.config.nightlyGovernanceCronAutoRegister) {
3718
- try {
3719
- await this.autoRegisterNightlyGovernanceCron();
3720
- } catch (err) {
3721
- log.debug(`nightly governance cron auto-register failed (non-fatal): ${err}`);
3722
- }
3723
- }
3724
- if (this.config.procedural?.proceduralMiningCronAutoRegister) {
3725
- try {
3726
- await this.autoRegisterProceduralMiningCron();
3727
- } catch (err) {
3728
- log.debug(`procedural mining cron auto-register failed (non-fatal): ${err}`);
3729
- }
3730
- }
3731
- if (this.config.contradictionScan?.enabled) {
3732
- try {
3733
- await this.autoRegisterContradictionScanCron();
3734
- } catch (err) {
3735
- log.debug(`contradiction scan cron auto-register failed (non-fatal): ${err}`);
3736
- }
3737
- }
3738
- if (this.config.patternReinforcementEnabled) {
3739
- try {
3740
- await this.autoRegisterPatternReinforcementCron();
3741
- } catch (err) {
3742
- log.debug(`pattern reinforcement cron auto-register failed (non-fatal): ${err}`);
3743
- }
3744
- }
3745
- if (this.config.graphEdgeDecayEnabled) {
3746
- try {
3747
- await this.autoRegisterGraphEdgeDecayCron();
3748
- } catch (err) {
3749
- log.debug(`graph edge decay cron auto-register failed (non-fatal): ${err}`);
3750
- }
3751
- }
3688
+ await this.maintenanceScheduler.autoRegisterCrons(signal);
3752
3689
  if (signal.aborted) return;
3753
3690
  if (this.config.lifecyclePolicyEnabled && this.config.qmdTierMigrationEnabled) {
3754
3691
  try {
@@ -3775,7 +3712,7 @@ var Orchestrator = class _Orchestrator {
3775
3712
  if (signal.aborted) return;
3776
3713
  if (!this.wearablesAutoSyncHandle && this.config.wearables.enabled && this.config.wearables.autoSyncEnabled && Object.values(this.config.wearables.sources).some((source) => source.enabled)) {
3777
3714
  try {
3778
- const { startWearablesAutoSync } = await import("./auto-sync-NUQWSFQD.js");
3715
+ const { startWearablesAutoSync } = await import("./auto-sync-RWXT6P5M.js");
3779
3716
  if (signal.aborted) return;
3780
3717
  this.wearablesAutoSyncHandle = startWearablesAutoSync(
3781
3718
  {
@@ -3903,147 +3840,6 @@ var Orchestrator = class _Orchestrator {
3903
3840
  }
3904
3841
  return true;
3905
3842
  }
3906
- /**
3907
- * Auto-register the engram-day-summary cron job in OpenClaw.
3908
- * Reconciles model and timezone on every startup so config changes propagate.
3909
- * Fire-and-forget — never blocks init or crashes on failure.
3910
- * Issues #1474, #1475.
3911
- */
3912
- async autoRegisterDaySummaryCron() {
3913
- const home = resolveHomeDir();
3914
- const jobsPath = path2.join(home, ".openclaw", "cron", "jobs.json");
3915
- try {
3916
- if (!existsSync(jobsPath)) {
3917
- log.debug(
3918
- "day-summary cron: jobs.json not found, skipping auto-register"
3919
- );
3920
- return;
3921
- }
3922
- const rawSummaryModel = this.config.summaryModel;
3923
- const taskPrimary = this.config.taskModelChain?.primary;
3924
- const isGateway = this.config.modelSource === "gateway";
3925
- const model = isGateway ? rawSummaryModel || taskPrimary || void 0 : void 0;
3926
- const fallbacks = [];
3927
- if (model && taskPrimary && model === taskPrimary) {
3928
- const seen = new Set(model ? [model] : []);
3929
- const addUnique = (value) => {
3930
- if (typeof value !== "string") return;
3931
- const trimmed = value.trim();
3932
- if (trimmed.length > 0 && !seen.has(trimmed)) {
3933
- seen.add(trimmed);
3934
- fallbacks.push(trimmed);
3935
- }
3936
- };
3937
- for (const fb of this.config.taskModelChain?.fallbacks ?? []) addUnique(fb);
3938
- const gwDefaults = this.config.gatewayConfig?.agents?.defaults?.model;
3939
- addUnique(gwDefaults?.primary);
3940
- if (Array.isArray(gwDefaults?.fallbacks)) {
3941
- for (const fb of gwDefaults.fallbacks) addUnique(fb);
3942
- }
3943
- }
3944
- const timezone = this.config.daySummaryTimezone || Intl.DateTimeFormat().resolvedOptions().timeZone;
3945
- const result = await ensureDaySummaryCron(jobsPath, {
3946
- timezone,
3947
- ...model ? { model } : {},
3948
- ...fallbacks.length > 0 ? { fallbacks } : {}
3949
- });
3950
- if (result.created) {
3951
- log.info(
3952
- `day-summary cron auto-registered (${result.jobId}, 23:47 ${timezone}${model ? `, model: ${model}` : ""})`
3953
- );
3954
- } else if (result.updated) {
3955
- log.info(
3956
- `day-summary cron reconciled (${result.jobId}, timezone: ${timezone}${model ? `, model: ${model}` : ""})`
3957
- );
3958
- } else {
3959
- log.debug("day-summary cron already up to date");
3960
- }
3961
- } catch (err) {
3962
- log.debug(`day-summary cron auto-register error: ${err}`);
3963
- }
3964
- }
3965
- async autoRegisterNightlyGovernanceCron() {
3966
- const home = resolveHomeDir();
3967
- const jobsPath = path2.join(home, ".openclaw", "cron", "jobs.json");
3968
- try {
3969
- if (!existsSync(jobsPath)) {
3970
- log.debug("nightly governance cron: jobs.json not found, skipping auto-register");
3971
- return;
3972
- }
3973
- const created = await ensureNightlyGovernanceCron(jobsPath, {
3974
- timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
3975
- });
3976
- if (created.created) {
3977
- log.info(
3978
- `nightly governance cron auto-registered (${created.jobId}, 02:23 ${Intl.DateTimeFormat().resolvedOptions().timeZone})`
3979
- );
3980
- } else {
3981
- log.debug("nightly governance cron already exists, skipping auto-register");
3982
- }
3983
- } catch (err) {
3984
- log.debug(`nightly governance cron auto-register error: ${err}`);
3985
- }
3986
- }
3987
- async autoRegisterProceduralMiningCron() {
3988
- const home = resolveHomeDir();
3989
- const jobsPath = path2.join(home, ".openclaw", "cron", "jobs.json");
3990
- try {
3991
- if (!existsSync(jobsPath)) {
3992
- log.debug("procedural mining cron: jobs.json not found, skipping auto-register");
3993
- return;
3994
- }
3995
- const created = await ensureProceduralMiningCron(jobsPath, {
3996
- timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
3997
- });
3998
- if (created.created) {
3999
- log.info(`procedural mining cron auto-registered (${created.jobId})`);
4000
- } else {
4001
- log.debug("procedural mining cron already exists, skipping auto-register");
4002
- }
4003
- } catch (err) {
4004
- log.debug(`procedural mining cron auto-register error: ${err}`);
4005
- }
4006
- }
4007
- async autoRegisterContradictionScanCron() {
4008
- const home = resolveHomeDir();
4009
- const jobsPath = path2.join(home, ".openclaw", "cron", "jobs.json");
4010
- try {
4011
- if (!existsSync(jobsPath)) {
4012
- log.debug("contradiction scan cron: jobs.json not found, skipping auto-register");
4013
- return;
4014
- }
4015
- const created = await ensureContradictionScanCron(jobsPath, {
4016
- timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
4017
- });
4018
- if (created.created) {
4019
- log.info(`contradiction scan cron auto-registered (${created.jobId})`);
4020
- } else {
4021
- log.debug("contradiction scan cron already exists, skipping auto-register");
4022
- }
4023
- } catch (err) {
4024
- log.debug(`contradiction scan cron auto-register error: ${err}`);
4025
- }
4026
- }
4027
- async autoRegisterPatternReinforcementCron() {
4028
- const home = resolveHomeDir();
4029
- const jobsPath = path2.join(home, ".openclaw", "cron", "jobs.json");
4030
- try {
4031
- if (!existsSync(jobsPath)) {
4032
- log.debug("pattern reinforcement cron: jobs.json not found, skipping auto-register");
4033
- return;
4034
- }
4035
- const created = await ensurePatternReinforcementCron(jobsPath, {
4036
- timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
4037
- });
4038
- if (created.created) {
4039
- log.info(`pattern reinforcement cron auto-registered (${created.jobId})`);
4040
- } else {
4041
- log.debug("pattern reinforcement cron already exists, skipping auto-register");
4042
- }
4043
- } catch (err) {
4044
- log.debug(`pattern reinforcement cron auto-register error: ${err}`);
4045
- }
4046
- }
4047
3843
  /**
4048
3844
  * Run the pattern-reinforcement maintenance job (issue #687 PR 2/4).
4049
3845
  *
@@ -4169,28 +3965,6 @@ var Orchestrator = class _Orchestrator {
4169
3965
  { enabled: this.config.dreamsPhases.deepSleep.enabled }
4170
3966
  );
4171
3967
  }
4172
- async autoRegisterGraphEdgeDecayCron() {
4173
- const home = resolveHomeDir();
4174
- const jobsPath = path2.join(home, ".openclaw", "cron", "jobs.json");
4175
- try {
4176
- if (!existsSync(jobsPath)) {
4177
- log.debug("graph edge decay cron: jobs.json not found, skipping auto-register");
4178
- return;
4179
- }
4180
- const scheduleExpr = graphEdgeDecayCadenceToCronExpr(this.config.graphEdgeDecayCadenceMs);
4181
- const created = await ensureGraphEdgeDecayCron(jobsPath, {
4182
- timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
4183
- scheduleExpr
4184
- });
4185
- if (created.created) {
4186
- log.info(`graph edge decay cron auto-registered (${created.jobId}, ${scheduleExpr})`);
4187
- } else {
4188
- log.debug("graph edge decay cron already exists, skipping auto-register");
4189
- }
4190
- } catch (err) {
4191
- log.debug(`graph edge decay cron auto-register error: ${err}`);
4192
- }
4193
- }
4194
3968
  async runLiveConnectors(options = {}) {
4195
3969
  return runLiveConnectorsOnce({
4196
3970
  memoryDir: this.config.memoryDir,
@@ -4570,7 +4344,7 @@ ${doc.content}` : doc.content,
4570
4344
  }
4571
4345
  async waitForConsolidationIdle(timeoutMs = 6e4) {
4572
4346
  const started = Date.now();
4573
- while (this.consolidationInFlight) {
4347
+ while (this.maintenanceScheduler.isConsolidationInFlight()) {
4574
4348
  if (Date.now() - started > timeoutMs) {
4575
4349
  log.warn(`waitForConsolidationIdle timed out after ${timeoutMs}ms`);
4576
4350
  return false;
@@ -11148,7 +10922,6 @@ ${normalized}`).digest("hex");
11148
10922
  }
11149
10923
  const nonZeroExtraction = durableOutputCount > 0;
11150
10924
  try {
11151
- if (nonZeroExtraction) this.nonZeroExtractionsSinceConsolidation += 1;
11152
10925
  this.maybeScheduleConsolidation(nonZeroExtraction);
11153
10926
  } catch (err) {
11154
10927
  log.warn(
@@ -11366,121 +11139,20 @@ ${normalized}`).digest("hex");
11366
11139
  });
11367
11140
  }
11368
11141
  maybeScheduleConsolidation(nonZeroExtraction) {
11369
- if (this.config.consolidationRequireNonZeroExtraction && !nonZeroExtraction)
11370
- return;
11371
- if (this.nonZeroExtractionsSinceConsolidation < this.config.consolidateEveryN)
11372
- return;
11373
- const now = Date.now();
11374
- if (now - this.lastConsolidationRunAtMs < this.config.consolidationMinIntervalMs)
11375
- return;
11376
- if (this.consolidationInFlight) return;
11377
- this.consolidationInFlight = true;
11378
- this.lastConsolidationRunAtMs = now;
11379
- this.nonZeroExtractionsSinceConsolidation = 0;
11380
- this.runConsolidation().catch((err) => log.error("background consolidation failed", err)).finally(() => {
11381
- this.consolidationInFlight = false;
11382
- });
11142
+ this.maintenanceScheduler.maybeScheduleConsolidation(
11143
+ nonZeroExtraction,
11144
+ () => this.runConsolidation()
11145
+ );
11383
11146
  }
11384
11147
  requestQmdMaintenance() {
11385
- if (!this.qmd.isAvailable()) return;
11386
- if (!this.config.qmdMaintenanceEnabled) return;
11387
- this.qmdMaintenancePending = true;
11388
- if (this.qmdMaintenanceTimer) return;
11389
- this.qmdMaintenanceTimer = setTimeout(() => {
11390
- this.qmdMaintenanceTimer = null;
11391
- this.runQmdMaintenance().catch(
11392
- (err) => log.debug(`background qmd maintenance failed: ${err}`)
11393
- );
11394
- }, this.config.qmdMaintenanceDebounceMs);
11148
+ this.maintenanceScheduler.requestQmdMaintenanceForTool("__internal__");
11395
11149
  }
11396
11150
  /**
11397
11151
  * Public entrypoint for tool-driven QMD maintenance requests.
11398
- * Routes through existing debounced/singleflight maintenance controls.
11152
+ * Delegates to the maintenance scheduler (issue #1526 PR1).
11399
11153
  */
11400
11154
  requestQmdMaintenanceForTool(reason) {
11401
- try {
11402
- this.requestQmdMaintenance();
11403
- } catch (err) {
11404
- const msg = err instanceof Error ? err.message : String(err);
11405
- log.warn(`qmd maintenance request failed (${reason}): ${msg}`);
11406
- }
11407
- }
11408
- async runQmdMaintenance() {
11409
- if (this.qmdMaintenanceInFlight) return;
11410
- if (!this.qmdMaintenancePending) return;
11411
- this.qmdMaintenanceInFlight = true;
11412
- this.qmdMaintenancePending = false;
11413
- try {
11414
- if (this.config.namespacesEnabled) {
11415
- const plan = await this.namespaceMaintenancePlan("qmd");
11416
- const now = Date.now();
11417
- const lastEmbedAtByNamespace = this.lastQmdEmbedAtMsByNamespace ?? (this.lastQmdEmbedAtMsByNamespace = /* @__PURE__ */ new Map());
11418
- const dueEmbedNamespaces = (namespaces) => {
11419
- if (!this.config.qmdAutoEmbedEnabled) return [];
11420
- return namespaces.filter(
11421
- (namespace) => now - (lastEmbedAtByNamespace.get(namespace) ?? 0) >= this.config.qmdEmbedMinIntervalMs
11422
- );
11423
- };
11424
- const markEmbedded = (namespaces) => {
11425
- if (namespaces.length === 0) return;
11426
- for (const namespace of namespaces) {
11427
- lastEmbedAtByNamespace.set(namespace, now);
11428
- }
11429
- this.lastQmdEmbedAtMs = now;
11430
- };
11431
- await runNamespaceMaintenanceBatchPlan(
11432
- this.config,
11433
- plan,
11434
- async (candidates) => {
11435
- const namespaces = candidates.map((candidate) => candidate.namespace);
11436
- const embedNamespaces = dueEmbedNamespaces(namespaces);
11437
- let result;
11438
- try {
11439
- result = await this.namespaceSearchRouter.updateNamespacesDetailed(
11440
- namespaces,
11441
- void 0,
11442
- { strict: true }
11443
- );
11444
- } catch (error) {
11445
- if (embedNamespaces.length > 0 && qmdMaintenanceSkipReasonForError(error) === "throttled") {
11446
- await this.namespaceSearchRouter.embedNamespaces(embedNamespaces, { strict: true });
11447
- markEmbedded(embedNamespaces);
11448
- }
11449
- throw error;
11450
- }
11451
- if (result.backendCount <= 0) {
11452
- throw new Error("no eligible QMD backend for selected namespaces");
11453
- }
11454
- if (result.eligibleNamespaces.length !== namespaces.length) {
11455
- const eligible = new Set(result.eligibleNamespaces);
11456
- const missing = namespaces.filter((namespace) => !eligible.has(namespace));
11457
- throw new Error(`QMD backend ineligible for selected namespaces (${missing.length})`);
11458
- }
11459
- if (embedNamespaces.length > 0) {
11460
- await this.namespaceSearchRouter.embedNamespaces(embedNamespaces, { strict: true });
11461
- markEmbedded(embedNamespaces);
11462
- }
11463
- return { itemCount: result.backendCount };
11464
- },
11465
- this.namespaceCatalog,
11466
- {
11467
- skipReasonForError: qmdMaintenanceSkipReasonForError
11468
- }
11469
- );
11470
- } else {
11471
- await this.qmd.update();
11472
- const now = Date.now();
11473
- if (this.config.qmdAutoEmbedEnabled && now - this.lastQmdEmbedAtMs >= this.config.qmdEmbedMinIntervalMs) {
11474
- await this.qmd.embed();
11475
- this.lastQmdEmbedAtMs = now;
11476
- }
11477
- }
11478
- } finally {
11479
- this.qmdMaintenanceInFlight = false;
11480
- if (this.qmdMaintenancePending) {
11481
- this.requestQmdMaintenance();
11482
- }
11483
- }
11155
+ this.maintenanceScheduler.requestQmdMaintenanceForTool(reason);
11484
11156
  }
11485
11157
  async persistExtraction(result, storage, threadIdForExtraction, sourceContext, baseNamespace, scopeProfileWritePlan, graphCaps = resolveGraphConstructionCapabilities(this.config)) {
11486
11158
  const citationEnabled = this.config.inlineSourceAttributionEnabled === true;
@@ -15000,6 +14672,7 @@ ${lines.join("\n\n")}`;
15000
14672
  filterSearchResultsByRecallSafety(results, memoryByPath, options) {
15001
14673
  let lifecycleFilteredCount = 0;
15002
14674
  let temporalSupersededFilteredCount = 0;
14675
+ let biTemporalExpiredFilteredCount = 0;
15003
14676
  let dedicatedSurfaceFilteredCount = 0;
15004
14677
  let forgottenFilteredCount = 0;
15005
14678
  let blockedPathFilteredCount = 0;
@@ -15047,6 +14720,10 @@ ${lines.join("\n\n")}`;
15047
14720
  temporalSupersededFilteredCount += 1;
15048
14721
  continue;
15049
14722
  }
14723
+ if (!asOfActive && this.config.temporalBiTemporal && !this.config.temporalExpiredInInjection && isValidityExpiredNow(memory.frontmatter, Date.now())) {
14724
+ biTemporalExpiredFilteredCount += 1;
14725
+ continue;
14726
+ }
15050
14727
  if (options?.allowDedicatedSurface !== true && (memory.frontmatter.memoryKind === "dream" || memory.frontmatter.memoryKind === "procedural")) {
15051
14728
  dedicatedSurfaceFilteredCount += 1;
15052
14729
  continue;
@@ -15064,6 +14741,11 @@ ${lines.join("\n\n")}`;
15064
14741
  `temporal supersession filter removed ${temporalSupersededFilteredCount} superseded candidates`
15065
14742
  );
15066
14743
  }
14744
+ if (biTemporalExpiredFilteredCount > 0) {
14745
+ log.debug(
14746
+ `bi-temporal validity filter removed ${biTemporalExpiredFilteredCount} expired-validity candidates from injection (temporal.biTemporal on)`
14747
+ );
14748
+ }
15067
14749
  if (dedicatedSurfaceFilteredCount > 0) {
15068
14750
  log.debug(
15069
14751
  `dedicated surface filter removed ${dedicatedSurfaceFilteredCount} dream/procedural candidates from generic recall`
@@ -15566,4 +15248,4 @@ export {
15566
15248
  resolvePersistedMemoryRelativePath,
15567
15249
  Orchestrator
15568
15250
  };
15569
- //# sourceMappingURL=chunk-CE6CBRCV.js.map
15251
+ //# sourceMappingURL=chunk-W4MICQIZ.js.map