@remnic/core 9.3.723 → 9.3.725

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 (270) hide show
  1. package/dist/access-boundary.d.ts +6 -11
  2. package/dist/access-boundary.js +9 -9
  3. package/dist/access-cli.js +29 -23
  4. package/dist/access-cli.js.map +1 -1
  5. package/dist/access-http.d.ts +5 -5
  6. package/dist/access-http.js +19 -14
  7. package/dist/access-mcp.d.ts +5 -5
  8. package/dist/access-mcp.js +18 -13
  9. package/dist/access-operations-batch.js +16 -10
  10. package/dist/access-operations.d.ts +5 -5
  11. package/dist/access-operations.js +17 -11
  12. package/dist/{access-service-Dj3I-VBS.d.ts → access-service-B2PlPtxh.d.ts} +3 -3
  13. package/dist/access-service.d.ts +5 -5
  14. package/dist/access-service.js +8 -8
  15. package/dist/access-surface-catalog.d.ts +5 -5
  16. package/dist/access-surface-catalog.js +82 -82
  17. package/dist/access-surface-catalog.js.map +1 -1
  18. package/dist/action-confidence.d.ts +1 -1
  19. package/dist/active-memory-bridge.d.ts +1 -1
  20. package/dist/active-recall.d.ts +1 -1
  21. package/dist/behavior-learner.d.ts +1 -1
  22. package/dist/behavior-signals.d.ts +1 -1
  23. package/dist/bootstrap.d.ts +4 -4
  24. package/dist/briefing.d.ts +1 -1
  25. package/dist/briefing.js +3 -3
  26. package/dist/buffer-surprise-report.d.ts +1 -1
  27. package/dist/buffer.d.ts +1 -1
  28. package/dist/calibration.d.ts +1 -1
  29. package/dist/capabilities.d.ts +1 -1
  30. package/dist/{catalog-F-OEVbRQ.d.ts → catalog-CzUb-GyD.d.ts} +1 -1
  31. package/dist/causal-behavior.d.ts +1 -1
  32. package/dist/causal-consolidation.d.ts +1 -1
  33. package/dist/causal-consolidation.js +4 -4
  34. package/dist/causal-trajectory-graph.d.ts +1 -1
  35. package/dist/{chunk-EVPNWN7Z.js → chunk-4R3CGCI5.js} +2 -2
  36. package/dist/{chunk-UO5ZHIIH.js → chunk-4WZ3J7M6.js} +2 -2
  37. package/dist/{chunk-PD42EYQN.js → chunk-5OPYYPJN.js} +2 -2
  38. package/dist/{chunk-EEJMD2L2.js → chunk-6CWGS2LY.js} +2 -2
  39. package/dist/{chunk-7CTNUVHZ.js → chunk-6SQQOJ4U.js} +2 -2
  40. package/dist/{chunk-ILFSEIRT.js → chunk-7AG54AF3.js} +1 -1
  41. package/dist/{chunk-ILFSEIRT.js.map → chunk-7AG54AF3.js.map} +1 -1
  42. package/dist/{chunk-UIXXE6NI.js → chunk-C6BWLYW5.js} +24 -15
  43. package/dist/chunk-C6BWLYW5.js.map +1 -0
  44. package/dist/{chunk-A5XNBK2D.js → chunk-DF3I6JGP.js} +6 -6
  45. package/dist/{chunk-GJSL4WG2.js → chunk-F3XZN24Z.js} +2 -2
  46. package/dist/{chunk-J3JPB7ZI.js → chunk-FACTVMXQ.js} +2 -2
  47. package/dist/{chunk-B7WISIAJ.js → chunk-FN6QP7JQ.js} +154 -1067
  48. package/dist/chunk-FN6QP7JQ.js.map +1 -0
  49. package/dist/{chunk-EBDA5TYA.js → chunk-FXCIOLRB.js} +2 -2
  50. package/dist/{chunk-TXQCG6SE.js → chunk-H7HUQIY7.js} +3 -3
  51. package/dist/{chunk-QD6QP5P6.js → chunk-I2HL5M6T.js} +17 -17
  52. package/dist/{chunk-M7R5R6OJ.js → chunk-IAIPNEHD.js} +20 -2
  53. package/dist/{chunk-M7R5R6OJ.js.map → chunk-IAIPNEHD.js.map} +1 -1
  54. package/dist/{chunk-Z4RU5VPM.js → chunk-J334N6QV.js} +2 -2
  55. package/dist/{chunk-NXRUUDUF.js → chunk-JJJCVCCQ.js} +2 -2
  56. package/dist/{chunk-GDUOCHCD.js → chunk-KGZF2VO3.js} +10 -10
  57. package/dist/{chunk-LA3HZKES.js → chunk-KLFYKC3K.js} +448 -49
  58. package/dist/chunk-KLFYKC3K.js.map +1 -0
  59. package/dist/{chunk-LLUGAZ3B.js → chunk-NT36GU6X.js} +30 -4
  60. package/dist/chunk-NT36GU6X.js.map +1 -0
  61. package/dist/{chunk-OHTOPFRF.js → chunk-SC2YAWRF.js} +2 -2
  62. package/dist/{chunk-YEE5KJQQ.js → chunk-T55EGZSJ.js} +2 -2
  63. package/dist/{chunk-N77ELJ2D.js → chunk-TT5U3UDO.js} +4 -4
  64. package/dist/{chunk-6FAMMBQ3.js → chunk-UBHVAGO7.js} +2 -2
  65. package/dist/chunk-VI5SGGXB.js +420 -0
  66. package/dist/chunk-VI5SGGXB.js.map +1 -0
  67. package/dist/{chunk-EDOQM4E4.js → chunk-WAFDHKES.js} +2 -2
  68. package/dist/{chunk-EXUCUPV2.js → chunk-WM7DNKBD.js} +2 -2
  69. package/dist/{dreams-ledger-3WSCI5V4.js → chunk-YF6FMLBT.js} +5 -6
  70. package/dist/{dreams-ledger-3WSCI5V4.js.map → chunk-YF6FMLBT.js.map} +1 -1
  71. package/dist/{chunk-WQYSDPMA.js → chunk-YQMPUYHE.js} +2 -2
  72. package/dist/{chunk-5O42UKXI.js → chunk-YUYPWJD3.js} +2 -2
  73. package/dist/{chunk-VCLGUIFM.js → chunk-Z3FGC3QE.js} +2 -2
  74. package/dist/{chunk-A7TJZLPK.js → chunk-ZK2L72VN.js} +2 -2
  75. package/dist/{chunk-BXEOHV7K.js → chunk-ZOHMPFOB.js} +3 -3
  76. package/dist/{graph-edge-decay-QPRJQ7DL.js → chunk-ZQNCHPTZ.js} +4 -5
  77. package/dist/{graph-edge-decay-QPRJQ7DL.js.map → chunk-ZQNCHPTZ.js.map} +1 -1
  78. package/dist/{cli-P_GaYcCY.d.ts → cli-IOlDHSBT.d.ts} +3 -3
  79. package/dist/cli.d.ts +6 -6
  80. package/dist/cli.js +31 -26
  81. package/dist/compounding/engine.d.ts +1 -1
  82. package/dist/compounding/engine.js +3 -3
  83. package/dist/compounding/preference-consolidator.d.ts +1 -1
  84. package/dist/compression-optimizer.d.ts +1 -1
  85. package/dist/config.d.ts +1 -1
  86. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  87. package/dist/connectors/codex-materialize-runner.js +3 -3
  88. package/dist/connectors/codex-materialize.d.ts +1 -1
  89. package/dist/connectors/index.d.ts +1 -1
  90. package/dist/connectors/index.js +3 -3
  91. package/dist/consolidation-provenance-check.d.ts +1 -1
  92. package/dist/consolidation-undo.d.ts +1 -1
  93. package/dist/contradiction/index.d.ts +1 -1
  94. package/dist/conversation-index/backend.d.ts +1 -1
  95. package/dist/conversation-index/chunker.d.ts +1 -1
  96. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  97. package/dist/conversation-index/indexer.d.ts +1 -1
  98. package/dist/conversation-index/search.d.ts +1 -1
  99. package/dist/day-summary.d.ts +1 -1
  100. package/dist/delinearize.d.ts +1 -1
  101. package/dist/direct-answer-wiring.d.ts +1 -1
  102. package/dist/direct-answer.d.ts +1 -1
  103. package/dist/dreams-ledger-6UODQOX6.js +22 -0
  104. package/dist/dreams-ledger-6UODQOX6.js.map +1 -0
  105. package/dist/embedding-fallback.d.ts +1 -1
  106. package/dist/enrichment/index.d.ts +1 -1
  107. package/dist/entity-retrieval.d.ts +1 -1
  108. package/dist/entity-retrieval.js +3 -3
  109. package/dist/entity-schema.d.ts +1 -1
  110. package/dist/event-time.d.ts +33 -1
  111. package/dist/event-time.js +3 -1
  112. package/dist/explicit-capture.d.ts +4 -4
  113. package/dist/extraction-faithfulness.d.ts +1 -1
  114. package/dist/extraction-judge-telemetry.d.ts +1 -1
  115. package/dist/extraction-judge-training.d.ts +1 -1
  116. package/dist/extraction-judge.d.ts +1 -1
  117. package/dist/extraction.d.ts +1 -1
  118. package/dist/fallback-llm.d.ts +1 -1
  119. package/dist/graph-dashboard-diff.d.ts +1 -1
  120. package/dist/graph-dashboard-key.d.ts +1 -1
  121. package/dist/graph-dashboard-parser.d.ts +1 -1
  122. package/dist/graph-edge-decay-RXUCJIN4.js +22 -0
  123. package/dist/graph-edge-decay-RXUCJIN4.js.map +1 -0
  124. package/dist/graph-edge-reinforcement.d.ts +1 -1
  125. package/dist/graph-snapshot.d.ts +1 -1
  126. package/dist/graph.d.ts +1 -1
  127. package/dist/identity-continuity.d.ts +1 -1
  128. package/dist/importance.d.ts +1 -1
  129. package/dist/index.d.ts +9 -9
  130. package/dist/index.js +58 -56
  131. package/dist/index.js.map +1 -1
  132. package/dist/intent.d.ts +1 -1
  133. package/dist/lcm/engine.d.ts +1 -1
  134. package/dist/lcm/index.d.ts +1 -1
  135. package/dist/lcm/tools.d.ts +1 -1
  136. package/dist/lifecycle.d.ts +1 -1
  137. package/dist/live-connectors-runner.d.ts +1 -1
  138. package/dist/local-llm.d.ts +1 -1
  139. package/dist/local-model-endpoint.d.ts +1 -1
  140. package/dist/maintenance/memory-governance.d.ts +1 -1
  141. package/dist/maintenance/memory-governance.js +3 -3
  142. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  143. package/dist/maintenance/rebuild-memory-projection.js +4 -4
  144. package/dist/mcp-memory-inspector-app.d.ts +5 -5
  145. package/dist/memory-action-policy.d.ts +1 -1
  146. package/dist/memory-cache.d.ts +1 -1
  147. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  148. package/dist/memory-projection-store.d.ts +1 -1
  149. package/dist/memory-provenance.d.ts +1 -1
  150. package/dist/memory-worth-outcomes.d.ts +1 -1
  151. package/dist/models-json.d.ts +1 -1
  152. package/dist/namespaces/migrate.d.ts +2 -2
  153. package/dist/namespaces/migrate.js +4 -4
  154. package/dist/namespaces/principal.d.ts +1 -1
  155. package/dist/namespaces/search.d.ts +1 -1
  156. package/dist/namespaces/storage.d.ts +2 -2
  157. package/dist/namespaces/storage.js +3 -3
  158. package/dist/native-knowledge.d.ts +1 -1
  159. package/dist/operator-toolkit.d.ts +1 -1
  160. package/dist/operator-toolkit.js +8 -8
  161. package/dist/orchestration/maintenance.d.ts +2 -2
  162. package/dist/orchestration/maintenance.js +5 -5
  163. package/dist/{orchestrator-f5xv19kp.d.ts → orchestrator-C_OMSIMZ.d.ts} +34 -3
  164. package/dist/orchestrator.d.ts +4 -4
  165. package/dist/orchestrator.js +17 -17
  166. package/dist/patterns-cli.d.ts +1 -1
  167. package/dist/policy-runtime.d.ts +1 -1
  168. package/dist/provenance.d.ts +1 -1
  169. package/dist/qmd-recall-cache.d.ts +1 -1
  170. package/dist/qmd.d.ts +1 -1
  171. package/dist/recall-disclosure-escalation.d.ts +1 -1
  172. package/dist/recall-explain-renderer.d.ts +1 -1
  173. package/dist/recall-explain-renderer.js +3 -3
  174. package/dist/recall-planner-llm.d.ts +1 -1
  175. package/dist/recall-state.d.ts +1 -1
  176. package/dist/recall-tag-filter.d.ts +1 -1
  177. package/dist/recall-xray-cli.d.ts +1 -1
  178. package/dist/recall-xray-cli.js +4 -4
  179. package/dist/recall-xray-renderer.d.ts +1 -1
  180. package/dist/recall-xray-renderer.js +3 -3
  181. package/dist/recall-xray.d.ts +1 -1
  182. package/dist/recall-xray.js +2 -2
  183. package/dist/resolve-auth-token.d.ts +1 -1
  184. package/dist/retrieval-agents.d.ts +1 -1
  185. package/dist/retrieval-tiers.d.ts +1 -1
  186. package/dist/routing/engine.d.ts +1 -1
  187. package/dist/routing/store.d.ts +1 -1
  188. package/dist/schemas.d.ts +22 -22
  189. package/dist/search/embed-helper.d.ts +1 -1
  190. package/dist/search/factory.d.ts +1 -1
  191. package/dist/search/index.d.ts +1 -1
  192. package/dist/search/lancedb-backend.d.ts +1 -1
  193. package/dist/search/meilisearch-backend.d.ts +1 -1
  194. package/dist/search/noop-backend.d.ts +1 -1
  195. package/dist/search/orama-backend.d.ts +1 -1
  196. package/dist/search/port.d.ts +1 -1
  197. package/dist/search/remote-backend.d.ts +1 -1
  198. package/dist/{semantic-consolidation-BQm1e1Pn.d.ts → semantic-consolidation-B8LiYtvx.d.ts} +1 -1
  199. package/dist/semantic-consolidation.d.ts +2 -2
  200. package/dist/semantic-consolidation.js +4 -4
  201. package/dist/semantic-rule-promotion.js +3 -3
  202. package/dist/semantic-rule-verifier.d.ts +1 -1
  203. package/dist/semantic-rule-verifier.js +3 -3
  204. package/dist/session-observer-bands.d.ts +1 -1
  205. package/dist/session-observer-state.d.ts +1 -1
  206. package/dist/shared-context/manager.d.ts +1 -1
  207. package/dist/signal.d.ts +1 -1
  208. package/dist/storage.d.ts +1 -1
  209. package/dist/storage.js +2 -2
  210. package/dist/summarizer.d.ts +1 -1
  211. package/dist/summary-snapshot.d.ts +1 -1
  212. package/dist/temporal-supersession.d.ts +1 -1
  213. package/dist/temporal-validity.d.ts +1 -1
  214. package/dist/threading.d.ts +1 -1
  215. package/dist/tier-migration.d.ts +1 -1
  216. package/dist/tier-routing.d.ts +1 -1
  217. package/dist/topics.d.ts +1 -1
  218. package/dist/transcript.d.ts +1 -1
  219. package/dist/transfer/types.d.ts +12 -12
  220. package/dist/trust-score-stage.d.ts +1 -1
  221. package/dist/trust-score.d.ts +1 -1
  222. package/dist/{types-DwO1Ot4n.d.ts → types-DmTaqob2.d.ts} +14 -0
  223. package/dist/types.d.ts +1 -1
  224. package/dist/types.js +1 -1
  225. package/dist/utility-runtime.d.ts +1 -1
  226. package/dist/verified-recall.js +3 -3
  227. package/package.json +2 -2
  228. package/src/access-boundary.ts +36 -2
  229. package/src/access-http.ts +17 -8
  230. package/src/access-mcp.ts +149 -1189
  231. package/src/access-operations-batch.ts +227 -1439
  232. package/src/access-surface-catalog.test.ts +4 -15
  233. package/src/access-surface-catalog.ts +82 -82
  234. package/src/bitemporal-dedup-backfill.test.ts +169 -0
  235. package/src/event-time.ts +57 -0
  236. package/src/extraction-eventtime-wiring.test.ts +101 -1
  237. package/src/orchestrator.ts +238 -43
  238. package/src/recall/archive-scoring.ts +526 -0
  239. package/src/types.ts +14 -0
  240. package/dist/chunk-B7WISIAJ.js.map +0 -1
  241. package/dist/chunk-EM2LDXJ2.js +0 -1315
  242. package/dist/chunk-EM2LDXJ2.js.map +0 -1
  243. package/dist/chunk-LA3HZKES.js.map +0 -1
  244. package/dist/chunk-LLUGAZ3B.js.map +0 -1
  245. package/dist/chunk-UIXXE6NI.js.map +0 -1
  246. /package/dist/{chunk-EVPNWN7Z.js.map → chunk-4R3CGCI5.js.map} +0 -0
  247. /package/dist/{chunk-UO5ZHIIH.js.map → chunk-4WZ3J7M6.js.map} +0 -0
  248. /package/dist/{chunk-PD42EYQN.js.map → chunk-5OPYYPJN.js.map} +0 -0
  249. /package/dist/{chunk-EEJMD2L2.js.map → chunk-6CWGS2LY.js.map} +0 -0
  250. /package/dist/{chunk-7CTNUVHZ.js.map → chunk-6SQQOJ4U.js.map} +0 -0
  251. /package/dist/{chunk-A5XNBK2D.js.map → chunk-DF3I6JGP.js.map} +0 -0
  252. /package/dist/{chunk-GJSL4WG2.js.map → chunk-F3XZN24Z.js.map} +0 -0
  253. /package/dist/{chunk-J3JPB7ZI.js.map → chunk-FACTVMXQ.js.map} +0 -0
  254. /package/dist/{chunk-EBDA5TYA.js.map → chunk-FXCIOLRB.js.map} +0 -0
  255. /package/dist/{chunk-TXQCG6SE.js.map → chunk-H7HUQIY7.js.map} +0 -0
  256. /package/dist/{chunk-QD6QP5P6.js.map → chunk-I2HL5M6T.js.map} +0 -0
  257. /package/dist/{chunk-Z4RU5VPM.js.map → chunk-J334N6QV.js.map} +0 -0
  258. /package/dist/{chunk-NXRUUDUF.js.map → chunk-JJJCVCCQ.js.map} +0 -0
  259. /package/dist/{chunk-GDUOCHCD.js.map → chunk-KGZF2VO3.js.map} +0 -0
  260. /package/dist/{chunk-OHTOPFRF.js.map → chunk-SC2YAWRF.js.map} +0 -0
  261. /package/dist/{chunk-YEE5KJQQ.js.map → chunk-T55EGZSJ.js.map} +0 -0
  262. /package/dist/{chunk-N77ELJ2D.js.map → chunk-TT5U3UDO.js.map} +0 -0
  263. /package/dist/{chunk-6FAMMBQ3.js.map → chunk-UBHVAGO7.js.map} +0 -0
  264. /package/dist/{chunk-EDOQM4E4.js.map → chunk-WAFDHKES.js.map} +0 -0
  265. /package/dist/{chunk-EXUCUPV2.js.map → chunk-WM7DNKBD.js.map} +0 -0
  266. /package/dist/{chunk-WQYSDPMA.js.map → chunk-YQMPUYHE.js.map} +0 -0
  267. /package/dist/{chunk-5O42UKXI.js.map → chunk-YUYPWJD3.js.map} +0 -0
  268. /package/dist/{chunk-VCLGUIFM.js.map → chunk-Z3FGC3QE.js.map} +0 -0
  269. /package/dist/{chunk-A7TJZLPK.js.map → chunk-ZK2L72VN.js.map} +0 -0
  270. /package/dist/{chunk-BXEOHV7K.js.map → chunk-ZOHMPFOB.js.map} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-4T3BMHKD.js";
8
8
  import {
9
9
  MaintenanceScheduler
10
- } from "./chunk-Z4RU5VPM.js";
10
+ } from "./chunk-J334N6QV.js";
11
11
  import {
12
12
  migrateFromEngram
13
13
  } from "./chunk-7HYPN2GC.js";
@@ -23,7 +23,7 @@ import {
23
23
  import {
24
24
  CompoundingEngine,
25
25
  defaultTierMigrationCycleBudget
26
- } from "./chunk-WQYSDPMA.js";
26
+ } from "./chunk-YQMPUYHE.js";
27
27
  import {
28
28
  SharedContextManager
29
29
  } from "./chunk-UFS7OXGL.js";
@@ -166,8 +166,9 @@ import {
166
166
  shouldRecallEventOrderEvidence
167
167
  } from "./chunk-FIOYURII.js";
168
168
  import {
169
+ pickFactEventTimeAnchor,
169
170
  resolveFactEventTime
170
- } from "./chunk-M7R5R6OJ.js";
171
+ } from "./chunk-IAIPNEHD.js";
171
172
  import {
172
173
  buildExplicitCueRecallSection
173
174
  } from "./chunk-4463LUIE.js";
@@ -184,7 +185,7 @@ import {
184
185
  buildEntityRecallSection,
185
186
  entityRecentTranscriptLookbackHours,
186
187
  readRecentEntityTranscriptEntries
187
- } from "./chunk-5O42UKXI.js";
188
+ } from "./chunk-YUYPWJD3.js";
188
189
  import {
189
190
  formatDaySummaryMemories
190
191
  } from "./chunk-EO5QWINU.js";
@@ -197,14 +198,14 @@ import {
197
198
  import {
198
199
  compareVerifiedEpisodeResults,
199
200
  searchVerifiedEpisodes
200
- } from "./chunk-EBDA5TYA.js";
201
+ } from "./chunk-FXCIOLRB.js";
201
202
  import {
202
203
  ThreadingManager
203
204
  } from "./chunk-QRDOSYOR.js";
204
205
  import {
205
206
  compareVerifiedSemanticRuleResults,
206
207
  searchVerifiedSemanticRules
207
- } from "./chunk-YEE5KJQQ.js";
208
+ } from "./chunk-T55EGZSJ.js";
208
209
  import {
209
210
  searchWorkProductLedgerEntries
210
211
  } from "./chunk-ZRWB5D4H.js";
@@ -217,14 +218,14 @@ import {
217
218
  import {
218
219
  runNamespaceMaintenanceFanout,
219
220
  summarizeNamespaceMaintenanceHealth
220
- } from "./chunk-PD42EYQN.js";
221
+ } from "./chunk-5OPYYPJN.js";
221
222
  import {
222
223
  NamespaceCatalog,
223
224
  planNamespaceMaintenance
224
- } from "./chunk-EXUCUPV2.js";
225
+ } from "./chunk-WM7DNKBD.js";
225
226
  import {
226
227
  NamespaceStorageRouter
227
- } from "./chunk-OHTOPFRF.js";
228
+ } from "./chunk-SC2YAWRF.js";
228
229
  import {
229
230
  isAboveImportanceThreshold,
230
231
  scoreImportance
@@ -262,7 +263,7 @@ import {
262
263
  materializeAfterSemanticConsolidation,
263
264
  parseConsolidationResponse,
264
265
  parseOperatorAwareConsolidationResponse
265
- } from "./chunk-NXRUUDUF.js";
266
+ } from "./chunk-JJJCVCCQ.js";
266
267
  import {
267
268
  buildRecallQueryPolicy
268
269
  } from "./chunk-LBJBNWS2.js";
@@ -303,7 +304,7 @@ import {
303
304
  clusterByKey,
304
305
  createCorrectionService,
305
306
  detectPassiveCorrections
306
- } from "./chunk-VCLGUIFM.js";
307
+ } from "./chunk-Z3FGC3QE.js";
307
308
  import {
308
309
  listTrustZoneRecords,
309
310
  searchTrustZoneRecords
@@ -313,7 +314,7 @@ import {
313
314
  } from "./chunk-FF4KLI5W.js";
314
315
  import {
315
316
  buildXraySnapshot
316
- } from "./chunk-GJSL4WG2.js";
317
+ } from "./chunk-F3XZN24Z.js";
317
318
  import {
318
319
  NamespaceSearchRouter
319
320
  } from "./chunk-QR67FU5G.js";
@@ -372,7 +373,7 @@ import {
372
373
  } from "./chunk-TBBDFYXW.js";
373
374
  import {
374
375
  buildChainFollowupGenerator
375
- } from "./chunk-UO5ZHIIH.js";
376
+ } from "./chunk-4WZ3J7M6.js";
376
377
  import {
377
378
  ContentHashIndex,
378
379
  StorageManager,
@@ -380,7 +381,7 @@ import {
380
381
  fingerprintEntityStructuredFacts,
381
382
  normalizeAttributePairs,
382
383
  parseEntityFile
383
- } from "./chunk-EVPNWN7Z.js";
384
+ } from "./chunk-4R3CGCI5.js";
384
385
  import {
385
386
  buildRetiredFactTombstoneInputs
386
387
  } from "./chunk-L2B3EE7B.js";
@@ -414,7 +415,7 @@ import {
414
415
  } from "./chunk-SVOZFLIQ.js";
415
416
  import {
416
417
  confidenceTier
417
- } from "./chunk-ILFSEIRT.js";
418
+ } from "./chunk-7AG54AF3.js";
418
419
  import {
419
420
  buildQmdRecallCacheKey,
420
421
  getCachedQmdRecall,
@@ -487,7 +488,7 @@ import {
487
488
 
488
489
  // src/orchestrator.ts
489
490
  import path3 from "path";
490
- import os from "os";
491
+ import os2 from "os";
491
492
  import { createHash, randomBytes } from "crypto";
492
493
  import { existsSync, readFileSync } from "fs";
493
494
  import {
@@ -1800,6 +1801,291 @@ function extractSnippet(body, index, matchLength) {
1800
1801
  return `${prefix}${body.slice(start, end).replace(/\s+/g, " ").trim()}${suffix}`;
1801
1802
  }
1802
1803
 
1804
+ // src/recall/archive-scoring.ts
1805
+ import os from "os";
1806
+ import { Worker } from "worker_threads";
1807
+ function scoreArchiveMemories(items, tokens) {
1808
+ if (items.length === 0 || tokens.length === 0) return [];
1809
+ const scored = [];
1810
+ for (const item of items) {
1811
+ const haystack = [item.content, item.category, ...item.tags].join(" ").toLowerCase();
1812
+ let hits = 0;
1813
+ for (const token of tokens) {
1814
+ if (haystack.includes(token)) hits += 1;
1815
+ }
1816
+ if (hits === 0) continue;
1817
+ scored.push({
1818
+ docid: item.id,
1819
+ path: item.path,
1820
+ score: hits / tokens.length,
1821
+ snippet: item.content.slice(0, 400).replace(/\n/g, " ")
1822
+ });
1823
+ }
1824
+ return scored;
1825
+ }
1826
+ function memoryFileToScoreItem(memory) {
1827
+ return {
1828
+ id: memory.frontmatter.id,
1829
+ path: memory.path,
1830
+ content: memory.content,
1831
+ category: memory.frontmatter.category,
1832
+ tags: memory.frontmatter.tags ?? []
1833
+ };
1834
+ }
1835
+ var SyncArchiveScoring = class {
1836
+ async score(items, tokens, abortSignal) {
1837
+ if (items.length === 0 || tokens.length === 0) return [];
1838
+ if (abortSignal?.aborted) return [];
1839
+ const CHUNK = 500;
1840
+ if (items.length <= CHUNK) return scoreArchiveMemories(items, tokens);
1841
+ const results = [];
1842
+ for (let i = 0; i < items.length; i += CHUNK) {
1843
+ if (abortSignal?.aborted) return [];
1844
+ const scored = scoreArchiveMemories(items.slice(i, i + CHUNK), tokens);
1845
+ for (const r of scored) results.push(r);
1846
+ }
1847
+ return results;
1848
+ }
1849
+ };
1850
+ var WORKER_SOURCE = String.raw`
1851
+ const { parentPort } = require('node:worker_threads');
1852
+
1853
+ function scoreArchiveMemories(items, tokens) {
1854
+ if (items.length === 0 || tokens.length === 0) return [];
1855
+ var scored = [];
1856
+ for (var i = 0; i < items.length; i++) {
1857
+ var item = items[i];
1858
+ var haystack = [item.content, item.category].concat(item.tags || []).join(' ').toLowerCase();
1859
+ var hits = 0;
1860
+ for (var j = 0; j < tokens.length; j++) {
1861
+ if (haystack.indexOf(tokens[j]) !== -1) hits++;
1862
+ }
1863
+ if (hits === 0) continue;
1864
+ scored.push({
1865
+ docid: item.id,
1866
+ path: item.path,
1867
+ score: hits / tokens.length,
1868
+ snippet: item.content.slice(0, 400).replace(/\n/g, ' '),
1869
+ });
1870
+ }
1871
+ return scored;
1872
+ }
1873
+
1874
+ if (parentPort) {
1875
+ parentPort.on('message', function(task) {
1876
+ try {
1877
+ var results = scoreArchiveMemories(task.items, task.tokens);
1878
+ parentPort.postMessage({ ok: true, results: results });
1879
+ } catch (err) {
1880
+ parentPort.postMessage({ ok: false, error: err && err.message ? err.message : String(err) });
1881
+ }
1882
+ });
1883
+ }
1884
+ `;
1885
+ function defaultPoolSize() {
1886
+ const cpus = typeof os.availableParallelism === "function" ? os.availableParallelism() : os.cpus().length;
1887
+ return Math.max(1, Math.min(Math.max(1, cpus - 1), 8));
1888
+ }
1889
+ var DISPATCH_TIMEOUT_MS = 12e4;
1890
+ var ArchiveScoringWorkerPool = class {
1891
+ targetSize;
1892
+ workers = [];
1893
+ idle = [];
1894
+ waiters = [];
1895
+ terminated = false;
1896
+ constructor(size = defaultPoolSize()) {
1897
+ this.targetSize = Math.max(1, size);
1898
+ }
1899
+ async run(task, abortSignal) {
1900
+ if (this.terminated) throw new Error("archive-scoring pool terminated");
1901
+ const worker = await this.acquire(abortSignal);
1902
+ if (abortSignal?.aborted) {
1903
+ this.release(worker);
1904
+ return [];
1905
+ }
1906
+ let abandoned = false;
1907
+ try {
1908
+ return await this.dispatch(worker, task, abortSignal, () => {
1909
+ abandoned = true;
1910
+ });
1911
+ } finally {
1912
+ if (abandoned) this.retireWorker(worker);
1913
+ else this.release(worker);
1914
+ }
1915
+ }
1916
+ async terminate() {
1917
+ if (this.terminated) return;
1918
+ this.terminated = true;
1919
+ const queued = this.waiters;
1920
+ this.waiters = [];
1921
+ for (const w of queued) w.reject(new Error("archive-scoring pool terminated"));
1922
+ const all = [...this.workers];
1923
+ this.workers = [];
1924
+ this.idle = [];
1925
+ await Promise.allSettled(all.map((w) => w.terminate()));
1926
+ }
1927
+ async acquire(abortSignal) {
1928
+ const idle = this.idle.pop();
1929
+ if (idle) return idle;
1930
+ if (this.workers.length < this.targetSize) return this.spawn();
1931
+ return new Promise((resolve, reject) => {
1932
+ const entry = { resolve, reject };
1933
+ this.waiters.push(entry);
1934
+ if (!abortSignal) return;
1935
+ const onAbort = () => {
1936
+ const idx = this.waiters.indexOf(entry);
1937
+ if (idx !== -1) this.waiters.splice(idx, 1);
1938
+ reject(new Error("archive-scoring acquire aborted"));
1939
+ };
1940
+ if (abortSignal.aborted) {
1941
+ onAbort();
1942
+ return;
1943
+ }
1944
+ abortSignal.addEventListener("abort", onAbort, { once: true });
1945
+ });
1946
+ }
1947
+ release(worker) {
1948
+ const next = this.waiters.shift();
1949
+ if (next) {
1950
+ next.resolve(worker);
1951
+ } else if (!this.terminated) {
1952
+ this.idle.push(worker);
1953
+ } else {
1954
+ void worker.terminate();
1955
+ }
1956
+ }
1957
+ /** Terminate a worker that may still be busy, then spawn a replacement
1958
+ * if a waiter is queued. */
1959
+ retireWorker(worker) {
1960
+ const idx = this.workers.indexOf(worker);
1961
+ if (idx !== -1) this.workers.splice(idx, 1);
1962
+ void worker.terminate();
1963
+ const next = this.waiters.shift();
1964
+ if (next) next.resolve(this.spawn());
1965
+ }
1966
+ spawn() {
1967
+ const worker = new Worker(WORKER_SOURCE, { eval: true });
1968
+ worker.unref();
1969
+ this.workers.push(worker);
1970
+ return worker;
1971
+ }
1972
+ dispatch(worker, task, abortSignal, onAbandon) {
1973
+ return new Promise((resolve, reject) => {
1974
+ let settled = false;
1975
+ const timer = setTimeout(() => {
1976
+ if (settled) return;
1977
+ settled = true;
1978
+ cleanup();
1979
+ onAbandon();
1980
+ log.debug(`archive-scoring dispatch timed out after ${DISPATCH_TIMEOUT_MS}ms \u2014 falling back to sync`);
1981
+ reject(new Error(`archive-scoring dispatch timed out after ${DISPATCH_TIMEOUT_MS}ms`));
1982
+ }, DISPATCH_TIMEOUT_MS);
1983
+ const onMessage = (reply) => {
1984
+ if (settled) return;
1985
+ settled = true;
1986
+ cleanup();
1987
+ if (reply.ok) resolve(reply.results);
1988
+ else reject(new Error(reply.error));
1989
+ };
1990
+ const onError = (err) => {
1991
+ if (settled) return;
1992
+ settled = true;
1993
+ cleanup();
1994
+ onAbandon();
1995
+ reject(err);
1996
+ };
1997
+ const onExit = (code) => {
1998
+ if (settled) return;
1999
+ settled = true;
2000
+ cleanup();
2001
+ onAbandon();
2002
+ reject(new Error(`archive-scoring worker exited with code ${code}`));
2003
+ };
2004
+ const onAbort = () => {
2005
+ if (settled) return;
2006
+ settled = true;
2007
+ cleanup();
2008
+ onAbandon();
2009
+ resolve([]);
2010
+ };
2011
+ const cleanup = () => {
2012
+ clearTimeout(timer);
2013
+ worker.off("message", onMessage);
2014
+ worker.off("error", onError);
2015
+ worker.off("exit", onExit);
2016
+ abortSignal?.removeEventListener("abort", onAbort);
2017
+ };
2018
+ worker.on("message", onMessage);
2019
+ worker.on("error", onError);
2020
+ worker.on("exit", onExit);
2021
+ abortSignal?.addEventListener("abort", onAbort, { once: true });
2022
+ worker.postMessage(task);
2023
+ });
2024
+ }
2025
+ };
2026
+ var OffThreadArchiveScoring = class {
2027
+ pool = null;
2028
+ poolFailed = false;
2029
+ syncFallback = new SyncArchiveScoring();
2030
+ constructor(poolSize) {
2031
+ if (poolSize !== void 0) {
2032
+ this.pool = new ArchiveScoringWorkerPool(poolSize);
2033
+ }
2034
+ }
2035
+ async score(items, tokens, abortSignal) {
2036
+ if (items.length === 0 || tokens.length === 0) return [];
2037
+ if (abortSignal?.aborted) return [];
2038
+ if (this.pool === null && !this.poolFailed) {
2039
+ try {
2040
+ this.pool = new ArchiveScoringWorkerPool();
2041
+ } catch (err) {
2042
+ this.poolFailed = true;
2043
+ log.debug(`archive-scoring: worker pool unavailable, using sync fallback \u2014 ${err.message}`);
2044
+ }
2045
+ }
2046
+ if (this.pool !== null) {
2047
+ const dispatchStart = Date.now();
2048
+ try {
2049
+ const task = {
2050
+ items,
2051
+ tokens
2052
+ };
2053
+ const results = await this.pool.run(task, abortSignal);
2054
+ if (abortSignal?.aborted) return [];
2055
+ return results;
2056
+ } catch (err) {
2057
+ if (abortSignal?.aborted) return [];
2058
+ if (Date.now() - dispatchStart > DISPATCH_TIMEOUT_MS * 0.5) return [];
2059
+ log.debug(`archive-scoring: worker dispatch failed, using sync fallback \u2014 ${err.message}`);
2060
+ }
2061
+ }
2062
+ return this.syncFallback.score(items, tokens, abortSignal);
2063
+ }
2064
+ /** @internal — terminate the underlying pool (tests / shutdown). */
2065
+ async terminate() {
2066
+ if (this.pool !== null) {
2067
+ await this.pool.terminate();
2068
+ this.pool = null;
2069
+ }
2070
+ }
2071
+ };
2072
+ var defaultStrategy = null;
2073
+ function getDefaultArchiveScoring() {
2074
+ if (defaultStrategy === null) {
2075
+ defaultStrategy = new OffThreadArchiveScoring();
2076
+ }
2077
+ return defaultStrategy;
2078
+ }
2079
+ async function disposeDefaultArchiveScoring() {
2080
+ if (defaultStrategy !== null) {
2081
+ const strategy = defaultStrategy;
2082
+ defaultStrategy = null;
2083
+ if (strategy instanceof OffThreadArchiveScoring) {
2084
+ await strategy.terminate();
2085
+ }
2086
+ }
2087
+ }
2088
+
1803
2089
  // src/orchestrator.ts
1804
2090
  var BulkImportBatchPartialFailureError = class extends Error {
1805
2091
  partialResult;
@@ -2056,7 +2342,7 @@ async function qmdStartupCollectionCheckWithTimeout(promise, controller, label)
2056
2342
  return await Promise.race([checkedPromise, timeoutPromise]);
2057
2343
  }
2058
2344
  function defaultWorkspaceDir() {
2059
- return path3.join(os.homedir(), ".openclaw", "workspace");
2345
+ return path3.join(os2.homedir(), ".openclaw", "workspace");
2060
2346
  }
2061
2347
  function sanitizeSessionKeyForFilename(sessionKey) {
2062
2348
  const readable = sessionKey.replace(/[^a-zA-Z0-9._-]/g, "_");
@@ -2795,6 +3081,7 @@ var Orchestrator = class _Orchestrator {
2795
3081
  if (this.conversationQmd && this.conversationQmd !== this.qmd) {
2796
3082
  await this.conversationQmd.dispose?.();
2797
3083
  }
3084
+ await disposeDefaultArchiveScoring();
2798
3085
  }
2799
3086
  /** Set per-session workspace for the next recall() call (compaction reset). @internal */
2800
3087
  setRecallWorkspaceOverride(sessionKey, dir) {
@@ -3261,6 +3548,81 @@ var Orchestrator = class _Orchestrator {
3261
3548
  );
3262
3549
  index.remove(memory.content);
3263
3550
  }
3551
+ /**
3552
+ * Issue #1671 — backfill bi-temporal bounds onto an existing promoted/deduped
3553
+ * copy that was written BEFORE the source fact carried a resolved
3554
+ * `invalid_at`/`observedAt`/`eventTimeSource`.
3555
+ *
3556
+ * On re-extraction/backfill, a fact may now carry a resolved end bound (e.g.
3557
+ * "until June 2025") that the existing copy lacks because it was promoted
3558
+ * before bi-temporal wiring existed. Without this backfill, recall keeps
3559
+ * surfacing an expired fact even though the source copy now expires correctly.
3560
+ *
3561
+ * Finds the active fact in `targetStorage` matching `dedupContent`, then
3562
+ * patches the temporal frontmatter the existing copy is missing. Best-effort
3563
+ * / fail-open — any I/O error is logged and swallowed so the dedup
3564
+ * short-circuit is never blocked by a backfill failure.
3565
+ *
3566
+ * Matching: the stored `frontmatter.contentHash` is compared against
3567
+ * `ContentHashIndex.computeHash(dedupContent)` first (the exact hash the
3568
+ * content-hash index uses), then falls back to stripping citations and
3569
+ * comparing normalized bodies. This handles inline-attribution deployments
3570
+ * where the persisted body carries a citation marker the dedup key does not.
3571
+ *
3572
+ * I/O gate: only triggers when `invalidAt` is present (the end bound that
3573
+ * actually changes recall behavior by expiring the fact). `observedAt` and
3574
+ * `eventTimeSource` alone don'\''t expire a fact, so backfilling them without
3575
+ * an end bound would cause a full readAllMemories scan on every dedup hit
3576
+ * under biTemporal for no recall benefit.
3577
+ *
3578
+ * Only patches fields the existing copy LACKS — never overwrites a bound the
3579
+ * copy already carries.
3580
+ */
3581
+ async backfillTemporalBoundsOnDedupHit(targetStorage, dedupContent, bounds, entityRef) {
3582
+ if (!bounds.invalidAt) return;
3583
+ try {
3584
+ const incomingHash = ContentHashIndex.computeHash(dedupContent);
3585
+ const normalizedIncoming = ContentHashIndex.normalizeContent(dedupContent);
3586
+ const incomingEntityNorm = entityRef ? normalizeSupersessionKey(entityRef) : void 0;
3587
+ const all = await targetStorage.readAllMemories();
3588
+ const existing = all.find((m) => {
3589
+ if (m.frontmatter.category !== "fact") return false;
3590
+ if ((m.frontmatter.status ?? "active") !== "active") return false;
3591
+ if (incomingEntityNorm && m.frontmatter.entityRef && normalizeSupersessionKey(m.frontmatter.entityRef) !== incomingEntityNorm) {
3592
+ return false;
3593
+ }
3594
+ if (m.frontmatter.contentHash) {
3595
+ return m.frontmatter.contentHash === incomingHash;
3596
+ }
3597
+ return ContentHashIndex.normalizeContent(
3598
+ stripCitationForTemplate(m.content ?? "", this.config.inlineSourceAttributionFormat)
3599
+ ) === normalizedIncoming;
3600
+ });
3601
+ if (!existing) return;
3602
+ const patch = {};
3603
+ const fm = existing.frontmatter;
3604
+ if (bounds.invalidAt && (!fm.invalid_at || fm.invalid_at.length === 0)) {
3605
+ patch.invalid_at = bounds.invalidAt;
3606
+ }
3607
+ if (bounds.observedAt && (!fm.observedAt || fm.observedAt.length === 0)) {
3608
+ patch.observedAt = bounds.observedAt;
3609
+ }
3610
+ if (bounds.eventTimeSource && (!fm.eventTimeSource || fm.eventTimeSource.length === 0)) {
3611
+ patch.eventTimeSource = bounds.eventTimeSource;
3612
+ }
3613
+ if (Object.keys(patch).length === 0) return;
3614
+ const ok = await targetStorage.writeMemoryFrontmatter(existing, patch);
3615
+ if (ok) {
3616
+ log.debug(
3617
+ `bitemporal-backfill: patched ${Object.keys(patch).join(",")} onto existing fact ${fm.id ?? "(unknown)"} in ${targetStorage.dir}`
3618
+ );
3619
+ }
3620
+ } catch (err) {
3621
+ log.warn(
3622
+ `bitemporal-backfill: failed open for ${targetStorage.dir}: ${err}`
3623
+ );
3624
+ }
3625
+ }
3264
3626
  async saveContentHashIndexes() {
3265
3627
  const indexes = /* @__PURE__ */ new Set();
3266
3628
  if (this.contentHashIndex) indexes.add(this.contentHashIndex);
@@ -4295,7 +4657,7 @@ ${doc.content}` : doc.content,
4295
4657
  async runDeepSleepGovernanceNow(options) {
4296
4658
  const targetStorage = options?.storage ?? this.storage;
4297
4659
  const { runMemoryGovernance } = await import("./maintenance/memory-governance.js");
4298
- const { summarizeGovernanceResultForDreams } = await import("./dreams-ledger-3WSCI5V4.js");
4660
+ const { summarizeGovernanceResultForDreams } = await import("./dreams-ledger-6UODQOX6.js");
4299
4661
  const govResult = await runMemoryGovernance({
4300
4662
  memoryDir: targetStorage.dir,
4301
4663
  mode: options?.dryRun === true ? "shadow" : "apply"
@@ -11555,6 +11917,18 @@ ${normalized}`).digest("hex");
11555
11917
  const targetStorage = await this.storageRouter.storageFor(target.namespace);
11556
11918
  if (targetStorage.dir === options.sourceStorage.dir) continue;
11557
11919
  if (options.category === "fact" && await targetStorage.hasFactContentHash(dedupContent)) {
11920
+ if (options.invalidAt) {
11921
+ await this.backfillTemporalBoundsOnDedupHit(
11922
+ targetStorage,
11923
+ dedupContent,
11924
+ {
11925
+ invalidAt: options.invalidAt,
11926
+ ...options.observedAt ? { observedAt: options.observedAt } : {},
11927
+ ...options.eventTimeSource ? { eventTimeSource: options.eventTimeSource } : {}
11928
+ },
11929
+ options.entityRef
11930
+ );
11931
+ }
11558
11932
  continue;
11559
11933
  }
11560
11934
  const promotedId = await targetStorage.writeMemory(
@@ -11637,6 +12011,18 @@ ${normalized}`).digest("hex");
11637
12011
  const dedupContent = options.category === "fact" && options.structuredAttributes && Object.keys(options.structuredAttributes).length > 0 ? `${sanitizedBase.text}
11638
12012
  [Attributes: ${normalizeAttributePairs(options.structuredAttributes)}]` : sanitizedBase.text;
11639
12013
  if (options.category === "fact" && await sharedStorage.hasFactContentHash(dedupContent)) {
12014
+ if (options.invalidAt) {
12015
+ await this.backfillTemporalBoundsOnDedupHit(
12016
+ sharedStorage,
12017
+ dedupContent,
12018
+ {
12019
+ invalidAt: options.invalidAt,
12020
+ ...options.observedAt ? { observedAt: options.observedAt } : {},
12021
+ ...options.eventTimeSource ? { eventTimeSource: options.eventTimeSource } : {}
12022
+ },
12023
+ options.entityRef
12024
+ );
12025
+ }
11640
12026
  if (this.config.temporalSupersessionEnabled && options.entityRef && options.structuredAttributes && Object.keys(options.structuredAttributes).length > 0) {
11641
12027
  let hashDedupMatchingFact;
11642
12028
  let hashDedupLookupComplete = false;
@@ -11969,7 +12355,8 @@ ${normalized}`).digest("hex");
11969
12355
  }
11970
12356
  fact.tags = Array.isArray(fact.tags) ? fact.tags.filter((t) => typeof t === "string") : [];
11971
12357
  fact.confidence = typeof fact.confidence === "number" ? fact.confidence : 0.7;
11972
- const biTemporal = this.config.temporalBiTemporal && sourceContext?.validAt ? resolveFactEventTime(fact.eventTime, sourceContext.validAt) : void 0;
12358
+ const factAnchor = pickFactEventTimeAnchor(fact, sourceContext?.validAt);
12359
+ const biTemporal = this.config.temporalBiTemporal && factAnchor ? resolveFactEventTime(fact.eventTime, factAnchor) : void 0;
11973
12360
  let writeCategory = fact.category;
11974
12361
  let targetStorage = storage;
11975
12362
  let targetNamespaceName = baseNamespace && baseNamespace.length > 0 ? baseNamespace : this.storageDirNamespace(targetStorage.dir);
@@ -12022,6 +12409,11 @@ ${normalized}`).digest("hex");
12022
12409
  }
12023
12410
  const canonicalContentForHash = citationEnabled && hasCitationForTemplate(fact.content, citationTemplate) ? stripCitationForTemplate(fact.content, citationTemplate) : fact.content;
12024
12411
  const contentHashDedupKey = writeCategory === "procedure" ? buildProcedurePersistBody(fact.content, fact.procedureSteps) : canonicalContentForHash;
12412
+ const importance = scoreImportance(
12413
+ fact.content,
12414
+ writeCategory,
12415
+ fact.tags
12416
+ );
12025
12417
  let exactDuplicate = false;
12026
12418
  try {
12027
12419
  exactDuplicate = await this.hasContentHashDedup(
@@ -12034,17 +12426,31 @@ ${normalized}`).digest("hex");
12034
12426
  );
12035
12427
  }
12036
12428
  if (exactDuplicate) {
12429
+ if (biTemporal && biTemporal.validUntil) {
12430
+ const fr = faithfulnessResultsByFactIndex?.get(factLoopIndex);
12431
+ const faithfulnessWouldPending = faithfulnessMode === "enforce" && fr?.ok === true && (fr.verdict === "unsupported" || fr.verdict === "contradicted");
12432
+ const requireSpansWouldPending = this.config.provenance?.requireSpans === true && fact.requireSpansPending === true;
12433
+ const judgeVerdict = judgeVerdictsByFactIndex?.get(factLoopIndex);
12434
+ const judgeWouldGate = !this.config.extractionJudgeShadow && judgeVerdict !== void 0 && !judgeVerdict.durable;
12435
+ if (isAboveImportanceThreshold(importance.level, this.config.extractionMinImportanceLevel) && !faithfulnessWouldPending && !requireSpansWouldPending && !judgeWouldGate) {
12436
+ await this.backfillTemporalBoundsOnDedupHit(
12437
+ targetStorage,
12438
+ contentHashDedupKey,
12439
+ {
12440
+ invalidAt: biTemporal.validUntil,
12441
+ observedAt: biTemporal.observedAt,
12442
+ eventTimeSource: biTemporal.eventTimeSource
12443
+ },
12444
+ fact.entityRef
12445
+ );
12446
+ }
12447
+ }
12037
12448
  log.debug(
12038
12449
  `dedup: skipping duplicate fact "${fact.content.slice(0, 60)}\u2026" in storage ${targetStorage.dir}`
12039
12450
  );
12040
12451
  dedupedCount++;
12041
12452
  continue;
12042
12453
  }
12043
- const importance = scoreImportance(
12044
- fact.content,
12045
- writeCategory,
12046
- fact.tags
12047
- );
12048
12454
  if (writeCategory === "procedure" && this.config.procedural?.enabled !== true) {
12049
12455
  log.debug("persistExtraction: skip procedure memory (procedural.enabled is false)");
12050
12456
  continue;
@@ -13534,7 +13940,7 @@ ${texts.map((t, i) => `[${i + 1}] ${t}`).join("\n\n")}`;
13534
13940
  }
13535
13941
  async recordScheduledDreamsPhaseRun(phase, itemsProcessed, notes, timing = {}) {
13536
13942
  try {
13537
- const { recordDreamsPhaseRun } = await import("./dreams-ledger-3WSCI5V4.js");
13943
+ const { recordDreamsPhaseRun } = await import("./dreams-ledger-6UODQOX6.js");
13538
13944
  await recordDreamsPhaseRun({
13539
13945
  memoryDir: this.storage.dir,
13540
13946
  phase,
@@ -14701,27 +15107,16 @@ ${lines.join("\n\n")}`;
14701
15107
  throwIfRecallAborted(abortSignal);
14702
15108
  const archivedMemories = await this.readArchivedMemoriesForNamespaces(recallNamespaces);
14703
15109
  if (archivedMemories.length === 0) return scopedSeedResults;
14704
- const scored = [];
14705
- for (const memory of archivedMemories) {
14706
- throwIfRecallAborted(abortSignal);
14707
- const haystack = [
14708
- memory.content,
14709
- memory.frontmatter.category,
14710
- ...memory.frontmatter.tags ?? []
14711
- ].join(" ").toLowerCase();
14712
- let hits = 0;
14713
- for (const token of tokens) {
14714
- if (haystack.includes(token)) hits += 1;
14715
- }
14716
- if (hits === 0) continue;
14717
- const normalized = hits / tokens.length;
14718
- scored.push({
14719
- docid: memory.frontmatter.id,
14720
- path: memory.path,
14721
- score: normalized,
14722
- snippet: memory.content.slice(0, 400).replace(/\n/g, " ")
14723
- });
14724
- }
15110
+ throwIfRecallAborted(abortSignal);
15111
+ const scoring = getDefaultArchiveScoring();
15112
+ const scoredResults = await scoring.score(archivedMemories.map(memoryFileToScoreItem), tokens, abortSignal);
15113
+ throwIfRecallAborted(abortSignal);
15114
+ const scored = scoredResults.map((r) => ({
15115
+ docid: r.docid,
15116
+ path: r.path,
15117
+ score: r.score,
15118
+ snippet: r.snippet
15119
+ }));
14725
15120
  const mergedByPath = /* @__PURE__ */ new Map();
14726
15121
  for (const result of [...scopedSeedResults, ...scored]) {
14727
15122
  const key = result.path || result.docid;
@@ -14845,6 +15240,9 @@ ${lines.join("\n\n")}`;
14845
15240
  }
14846
15241
  }
14847
15242
  if (longTerm.length === 0) {
15243
+ const da = new AbortController();
15244
+ if (options.abortSignal?.aborted) da.abort();
15245
+ else options.abortSignal?.addEventListener("abort", () => da.abort(), { once: true });
14848
15246
  longTerm = await runColdStepWithinDeadline(
14849
15247
  "archive scan",
14850
15248
  [],
@@ -14853,8 +15251,9 @@ ${lines.join("\n\n")}`;
14853
15251
  options.recallNamespaces,
14854
15252
  options.recallResultLimit,
14855
15253
  options.queryAwarePrefilter,
14856
- options.abortSignal
14857
- )
15254
+ da.signal
15255
+ ),
15256
+ () => da.abort()
14858
15257
  );
14859
15258
  if (longTerm.length > 0) {
14860
15259
  log.debug("cold-tier recall source=archive-scan");
@@ -15793,4 +16192,4 @@ export {
15793
16192
  resolvePersistedMemoryRelativePath,
15794
16193
  Orchestrator
15795
16194
  };
15796
- //# sourceMappingURL=chunk-LA3HZKES.js.map
16195
+ //# sourceMappingURL=chunk-KLFYKC3K.js.map