@remnic/core 1.1.8 → 1.1.10

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 (267) hide show
  1. package/dist/access-cli.js +44 -41
  2. package/dist/access-cli.js.map +1 -1
  3. package/dist/access-http.d.ts +8 -7
  4. package/dist/access-http.js +20 -17
  5. package/dist/access-mcp.d.ts +8 -7
  6. package/dist/access-mcp.js +19 -16
  7. package/dist/{access-service-C0Rkioec.d.ts → access-service-BTTNyo1i.d.ts} +11 -9
  8. package/dist/access-service.d.ts +8 -7
  9. package/dist/access-service.js +18 -15
  10. package/dist/active-memory-bridge.d.ts +2 -1
  11. package/dist/active-recall.d.ts +3 -2
  12. package/dist/active-recall.js +2 -2
  13. package/dist/active-recall.js.map +1 -1
  14. package/dist/behavior-learner.d.ts +2 -1
  15. package/dist/behavior-signals.d.ts +2 -1
  16. package/dist/bootstrap.d.ts +7 -6
  17. package/dist/briefing.d.ts +3 -2
  18. package/dist/briefing.js +6 -6
  19. package/dist/buffer-surprise-report.d.ts +2 -1
  20. package/dist/buffer.d.ts +3 -2
  21. package/dist/calibration.d.ts +4 -1
  22. package/dist/calibration.js +10 -5
  23. package/dist/calibration.js.map +1 -1
  24. package/dist/causal-behavior.d.ts +2 -1
  25. package/dist/causal-consolidation.d.ts +5 -2
  26. package/dist/causal-consolidation.js +17 -11
  27. package/dist/causal-consolidation.js.map +1 -1
  28. package/dist/{chunk-AV2WSYZY.js → chunk-2YMTO4ZJ.js} +2 -2
  29. package/dist/{chunk-SYWJJTNL.js → chunk-363MWCD3.js} +42 -42
  30. package/dist/{chunk-65ZPH7QA.js → chunk-36CTNQY7.js} +7 -7
  31. package/dist/{chunk-GZCUW5IC.js → chunk-3IQ2TR4N.js} +5 -5
  32. package/dist/chunk-3IQ2TR4N.js.map +1 -0
  33. package/dist/{chunk-TUFG6VXY.js → chunk-4DWOBS2A.js} +2 -2
  34. package/dist/chunk-4DWOBS2A.js.map +1 -0
  35. package/dist/{chunk-SRIDOT64.js → chunk-4DXC6HQQ.js} +6 -4
  36. package/dist/chunk-4DXC6HQQ.js.map +1 -0
  37. package/dist/{chunk-L2IO2QPY.js → chunk-4IS4SXIQ.js} +17 -13
  38. package/dist/chunk-4IS4SXIQ.js.map +1 -0
  39. package/dist/{chunk-RJSVRPNU.js → chunk-57QNCUEZ.js} +19 -12
  40. package/dist/chunk-57QNCUEZ.js.map +1 -0
  41. package/dist/{chunk-GRDDGNYQ.js → chunk-5GCNE7CN.js} +105 -499
  42. package/dist/chunk-5GCNE7CN.js.map +1 -0
  43. package/dist/{chunk-LOBRX7VD.js → chunk-5UM2VJ6D.js} +12 -1
  44. package/dist/chunk-5UM2VJ6D.js.map +1 -0
  45. package/dist/{chunk-XVOIMCVW.js → chunk-6XA7UN4Z.js} +2 -2
  46. package/dist/{chunk-QJZ77K7F.js → chunk-6Z6UH6TK.js} +26 -12
  47. package/dist/chunk-6Z6UH6TK.js.map +1 -0
  48. package/dist/{chunk-ODWDQNRE.js → chunk-7SI52C65.js} +7 -3
  49. package/dist/chunk-7SI52C65.js.map +1 -0
  50. package/dist/{chunk-FIXIX6DE.js → chunk-C5HUWVH2.js} +33 -43
  51. package/dist/chunk-C5HUWVH2.js.map +1 -0
  52. package/dist/{chunk-NN3TS5BM.js → chunk-D54LZC5L.js} +4 -4
  53. package/dist/{chunk-KNQ5YJTO.js → chunk-ERUDW6DU.js} +209 -1
  54. package/dist/chunk-ERUDW6DU.js.map +1 -0
  55. package/dist/{chunk-E27HOXMX.js → chunk-EYNQTST2.js} +2 -2
  56. package/dist/chunk-FVQJYWH7.js +52 -0
  57. package/dist/chunk-FVQJYWH7.js.map +1 -0
  58. package/dist/{chunk-3FPTCC3Z.js → chunk-GVPWB7EY.js} +2 -2
  59. package/dist/chunk-HJYHRE4S.js +647 -0
  60. package/dist/chunk-HJYHRE4S.js.map +1 -0
  61. package/dist/{chunk-SWRJFKYW.js → chunk-I6BQZSML.js} +5 -5
  62. package/dist/chunk-IBX3VFOM.js +446 -0
  63. package/dist/chunk-IBX3VFOM.js.map +1 -0
  64. package/dist/{chunk-STB3GUYU.js → chunk-KBYWQWSB.js} +8 -8
  65. package/dist/chunk-KWBPHZUU.js +83 -0
  66. package/dist/chunk-KWBPHZUU.js.map +1 -0
  67. package/dist/{chunk-MYH2IBSP.js → chunk-LIO5X3CM.js} +3 -3
  68. package/dist/{chunk-XGX4TUF6.js → chunk-MCC6KDQF.js} +5 -5
  69. package/dist/{chunk-4KAN3GZ3.js → chunk-NN2DKE4T.js} +1 -1
  70. package/dist/chunk-NN2DKE4T.js.map +1 -0
  71. package/dist/{chunk-R2XRID2N.js → chunk-NN3LPQ5D.js} +5 -5
  72. package/dist/chunk-NN3LPQ5D.js.map +1 -0
  73. package/dist/{chunk-WXPPM426.js → chunk-O4XJUPSF.js} +2 -2
  74. package/dist/{chunk-WSZIHQBK.js → chunk-P77UEOU2.js} +4 -1
  75. package/dist/{chunk-WSZIHQBK.js.map → chunk-P77UEOU2.js.map} +1 -1
  76. package/dist/{chunk-RLV2F337.js → chunk-PB5KW5PL.js} +2 -2
  77. package/dist/{chunk-S5SQDIF5.js → chunk-PHNGXFQ6.js} +7 -5
  78. package/dist/chunk-PHNGXFQ6.js.map +1 -0
  79. package/dist/{chunk-FEMOX5AD.js → chunk-QR3C7BKQ.js} +7 -7
  80. package/dist/chunk-QR3C7BKQ.js.map +1 -0
  81. package/dist/{chunk-ETA2JXP5.js → chunk-RXTFCYQF.js} +2 -2
  82. package/dist/{chunk-Q7FJ5ZHM.js → chunk-S3IP6R6K.js} +8 -2
  83. package/dist/{chunk-Q7FJ5ZHM.js.map → chunk-S3IP6R6K.js.map} +1 -1
  84. package/dist/{chunk-3LCWFNVS.js → chunk-SKE7JYKA.js} +2 -2
  85. package/dist/{chunk-T65SHTJP.js → chunk-VQXK37XA.js} +1 -1
  86. package/dist/chunk-VQXK37XA.js.map +1 -0
  87. package/dist/{chunk-DWMXVUGO.js → chunk-VX2IUQFE.js} +98 -10
  88. package/dist/chunk-VX2IUQFE.js.map +1 -0
  89. package/dist/{chunk-KHJRMWO4.js → chunk-WGK4VHGP.js} +84 -22
  90. package/dist/chunk-WGK4VHGP.js.map +1 -0
  91. package/dist/{chunk-4IT6WL23.js → chunk-WTFWLUSX.js} +2 -2
  92. package/dist/{chunk-67YLUWLG.js → chunk-XJKFSSDW.js} +3 -3
  93. package/dist/chunk-XJKFSSDW.js.map +1 -0
  94. package/dist/{chunk-ASIQZXYO.js → chunk-XMVFHBHT.js} +2 -2
  95. package/dist/{chunk-Q5TJRAGE.js → chunk-Y5KDIOKF.js} +3 -3
  96. package/dist/{chunk-FCGWNWG4.js → chunk-Z5S5HNGY.js} +31 -29
  97. package/dist/chunk-Z5S5HNGY.js.map +1 -0
  98. package/dist/{chunk-OJMD2LIW.js → chunk-ZL4S7ARC.js} +3 -3
  99. package/dist/{cli-CIATRu8o.d.ts → cli-BrEwQTnW.d.ts} +4 -4
  100. package/dist/cli.d.ts +9 -8
  101. package/dist/cli.js +33 -31
  102. package/dist/codex-cli-fallback.d.ts +44 -0
  103. package/dist/codex-cli-fallback.js +12 -0
  104. package/dist/{codex-materialize-xVqbEmcm.d.ts → codex-materialize-CQlLTzke.d.ts} +1 -1
  105. package/dist/compression-optimizer.d.ts +2 -1
  106. package/dist/config.d.ts +2 -1
  107. package/dist/config.js +1 -1
  108. package/dist/consolidation-provenance-check.d.ts +3 -2
  109. package/dist/consolidation-undo.d.ts +3 -2
  110. package/dist/day-summary.d.ts +2 -1
  111. package/dist/day-summary.js +1 -1
  112. package/dist/delinearize.d.ts +2 -1
  113. package/dist/direct-answer-wiring.d.ts +2 -1
  114. package/dist/direct-answer.d.ts +2 -1
  115. package/dist/embedding-fallback.d.ts +2 -1
  116. package/dist/{engine-MEAYUA7A.js → engine-FOC3IJLA.js} +7 -7
  117. package/dist/entity-retrieval.d.ts +3 -2
  118. package/dist/entity-retrieval.js +6 -6
  119. package/dist/entity-schema.d.ts +2 -1
  120. package/dist/explicit-capture.d.ts +7 -6
  121. package/dist/explicit-capture.js +2 -2
  122. package/dist/explicit-cue-recall.js +1 -1
  123. package/dist/extraction-judge-telemetry.d.ts +2 -1
  124. package/dist/extraction-judge-training.d.ts +2 -1
  125. package/dist/extraction-judge.d.ts +2 -1
  126. package/dist/extraction.d.ts +2 -1
  127. package/dist/extraction.js +10 -8
  128. package/dist/fallback-llm.d.ts +8 -1
  129. package/dist/fallback-llm.js +5 -3
  130. package/dist/identity-continuity.d.ts +2 -1
  131. package/dist/importance.d.ts +2 -1
  132. package/dist/index-1qIcnbG1.d.ts +34 -0
  133. package/dist/index.d.ts +15 -13
  134. package/dist/index.js +175 -168
  135. package/dist/index.js.map +1 -1
  136. package/dist/intent.d.ts +2 -1
  137. package/dist/lifecycle.d.ts +2 -1
  138. package/dist/live-connectors-runner.d.ts +2 -1
  139. package/dist/live-connectors-runner.js +2 -2
  140. package/dist/local-llm.d.ts +2 -1
  141. package/dist/local-llm.js +1 -1
  142. package/dist/memory-action-policy.d.ts +2 -1
  143. package/dist/memory-cache.d.ts +2 -1
  144. package/dist/{memory-governance-G3XODEXW.js → memory-governance-F3QOJGEY.js} +7 -7
  145. package/dist/memory-lifecycle-ledger-utils.d.ts +2 -1
  146. package/dist/{memory-projection-store-lCzmu4JX.d.ts → memory-projection-store-CY8TU40w.d.ts} +1 -1
  147. package/dist/memory-projection-store.d.ts +3 -2
  148. package/dist/memory-projection-store.js +1 -1
  149. package/dist/memory-worth-outcomes.d.ts +3 -2
  150. package/dist/{migrate-from-identity-anchor-TTEDEJGX.js → migrate-from-identity-anchor-G27MCD6A.js} +2 -2
  151. package/dist/model-registry.js +1 -1
  152. package/dist/models-json.d.ts +2 -1
  153. package/dist/models-json.js +1 -1
  154. package/dist/native-knowledge.d.ts +2 -1
  155. package/dist/objective-state-writers.d.ts +23 -1
  156. package/dist/objective-state-writers.js +10 -306
  157. package/dist/objective-state-writers.js.map +1 -1
  158. package/dist/objective-state.d.ts +7 -1
  159. package/dist/objective-state.js +3 -1
  160. package/dist/operator-toolkit.d.ts +3 -2
  161. package/dist/operator-toolkit.js +11 -11
  162. package/dist/opik-exporter.js +2 -2
  163. package/dist/opik-exporter.js.map +1 -1
  164. package/dist/{orchestrator-CvUYwuaL.d.ts → orchestrator-6IvQ-Phj.d.ts} +6 -5
  165. package/dist/orchestrator.d.ts +7 -6
  166. package/dist/orchestrator.js +37 -35
  167. package/dist/patterns-cli.d.ts +2 -1
  168. package/dist/{peers-6OSQ3NK6.js → peers-HCVGHMAE.js} +3 -3
  169. package/dist/peers-HCVGHMAE.js.map +1 -0
  170. package/dist/policy-runtime.d.ts +2 -1
  171. package/dist/{port-BkWL7hqo.d.ts → port-B6VEDIkC.d.ts} +7 -1
  172. package/dist/qmd-recall-cache.d.ts +3 -2
  173. package/dist/qmd.d.ts +4 -2
  174. package/dist/qmd.js +1 -1
  175. package/dist/recall-disclosure-escalation.d.ts +2 -1
  176. package/dist/recall-explain-renderer.d.ts +2 -1
  177. package/dist/recall-explain-renderer.js +3 -3
  178. package/dist/recall-state.d.ts +2 -1
  179. package/dist/recall-tag-filter.d.ts +2 -1
  180. package/dist/recall-xray-cli.d.ts +2 -1
  181. package/dist/recall-xray-cli.js +4 -4
  182. package/dist/recall-xray-renderer.d.ts +2 -1
  183. package/dist/recall-xray-renderer.js +3 -3
  184. package/dist/recall-xray.d.ts +2 -1
  185. package/dist/recall-xray.js +2 -2
  186. package/dist/resolve-auth-token.d.ts +2 -1
  187. package/dist/resolve-provider-secret.d.ts +2 -1
  188. package/dist/resolve-provider-secret.js +3 -1
  189. package/dist/resume-bundles.js +4 -4
  190. package/dist/retrieval-agents.d.ts +3 -2
  191. package/dist/retrieval-tiers.d.ts +2 -1
  192. package/dist/sanitize.js +1 -1
  193. package/dist/schemas.d.ts +22 -22
  194. package/dist/{semantic-consolidation-CGiH52qa.d.ts → semantic-consolidation-ByBXb-sf.d.ts} +2 -2
  195. package/dist/semantic-consolidation.d.ts +4 -3
  196. package/dist/semantic-consolidation.js +6 -6
  197. package/dist/semantic-rule-promotion.js +6 -6
  198. package/dist/semantic-rule-verifier.d.ts +2 -1
  199. package/dist/semantic-rule-verifier.js +6 -6
  200. package/dist/session-observer-bands.d.ts +2 -1
  201. package/dist/session-observer-state.d.ts +2 -1
  202. package/dist/signal.d.ts +2 -1
  203. package/dist/source-attribution.d.ts +1 -1
  204. package/dist/source-attribution.js +1 -1
  205. package/dist/storage.d.ts +3 -2
  206. package/dist/storage.js +5 -5
  207. package/dist/summarizer.d.ts +2 -1
  208. package/dist/summarizer.js +8 -6
  209. package/dist/summary-snapshot.d.ts +2 -1
  210. package/dist/temporal-supersession.d.ts +3 -2
  211. package/dist/temporal-validity.d.ts +2 -1
  212. package/dist/threading.d.ts +2 -1
  213. package/dist/tier-migration.d.ts +4 -3
  214. package/dist/tier-routing.d.ts +2 -1
  215. package/dist/topics.d.ts +2 -1
  216. package/dist/transcript.d.ts +2 -1
  217. package/dist/types.d.ts +2693 -1
  218. package/dist/types.js +1 -1
  219. package/dist/utility-runtime.d.ts +2 -1
  220. package/dist/verified-recall.js +6 -6
  221. package/package.json +1 -1
  222. package/dist/chunk-4KAN3GZ3.js.map +0 -1
  223. package/dist/chunk-67YLUWLG.js.map +0 -1
  224. package/dist/chunk-DWMXVUGO.js.map +0 -1
  225. package/dist/chunk-FCGWNWG4.js.map +0 -1
  226. package/dist/chunk-FEMOX5AD.js.map +0 -1
  227. package/dist/chunk-FIXIX6DE.js.map +0 -1
  228. package/dist/chunk-GRDDGNYQ.js.map +0 -1
  229. package/dist/chunk-GZCUW5IC.js.map +0 -1
  230. package/dist/chunk-KHJRMWO4.js.map +0 -1
  231. package/dist/chunk-KNQ5YJTO.js.map +0 -1
  232. package/dist/chunk-L2IO2QPY.js.map +0 -1
  233. package/dist/chunk-LOBRX7VD.js.map +0 -1
  234. package/dist/chunk-M62O4P4T.js +0 -41
  235. package/dist/chunk-M62O4P4T.js.map +0 -1
  236. package/dist/chunk-ODWDQNRE.js.map +0 -1
  237. package/dist/chunk-QJZ77K7F.js.map +0 -1
  238. package/dist/chunk-R2XRID2N.js.map +0 -1
  239. package/dist/chunk-RJSVRPNU.js.map +0 -1
  240. package/dist/chunk-S5SQDIF5.js.map +0 -1
  241. package/dist/chunk-SRIDOT64.js.map +0 -1
  242. package/dist/chunk-T65SHTJP.js.map +0 -1
  243. package/dist/chunk-TUFG6VXY.js.map +0 -1
  244. package/dist/types-H85grL1f.d.ts +0 -2714
  245. /package/dist/{chunk-AV2WSYZY.js.map → chunk-2YMTO4ZJ.js.map} +0 -0
  246. /package/dist/{chunk-SYWJJTNL.js.map → chunk-363MWCD3.js.map} +0 -0
  247. /package/dist/{chunk-65ZPH7QA.js.map → chunk-36CTNQY7.js.map} +0 -0
  248. /package/dist/{chunk-XVOIMCVW.js.map → chunk-6XA7UN4Z.js.map} +0 -0
  249. /package/dist/{chunk-NN3TS5BM.js.map → chunk-D54LZC5L.js.map} +0 -0
  250. /package/dist/{chunk-E27HOXMX.js.map → chunk-EYNQTST2.js.map} +0 -0
  251. /package/dist/{chunk-3FPTCC3Z.js.map → chunk-GVPWB7EY.js.map} +0 -0
  252. /package/dist/{chunk-SWRJFKYW.js.map → chunk-I6BQZSML.js.map} +0 -0
  253. /package/dist/{chunk-STB3GUYU.js.map → chunk-KBYWQWSB.js.map} +0 -0
  254. /package/dist/{chunk-MYH2IBSP.js.map → chunk-LIO5X3CM.js.map} +0 -0
  255. /package/dist/{chunk-XGX4TUF6.js.map → chunk-MCC6KDQF.js.map} +0 -0
  256. /package/dist/{chunk-WXPPM426.js.map → chunk-O4XJUPSF.js.map} +0 -0
  257. /package/dist/{chunk-RLV2F337.js.map → chunk-PB5KW5PL.js.map} +0 -0
  258. /package/dist/{chunk-ETA2JXP5.js.map → chunk-RXTFCYQF.js.map} +0 -0
  259. /package/dist/{chunk-3LCWFNVS.js.map → chunk-SKE7JYKA.js.map} +0 -0
  260. /package/dist/{chunk-4IT6WL23.js.map → chunk-WTFWLUSX.js.map} +0 -0
  261. /package/dist/{chunk-ASIQZXYO.js.map → chunk-XMVFHBHT.js.map} +0 -0
  262. /package/dist/{chunk-Q5TJRAGE.js.map → chunk-Y5KDIOKF.js.map} +0 -0
  263. /package/dist/{chunk-OJMD2LIW.js.map → chunk-ZL4S7ARC.js.map} +0 -0
  264. /package/dist/{engine-MEAYUA7A.js.map → codex-cli-fallback.js.map} +0 -0
  265. /package/dist/{memory-governance-G3XODEXW.js.map → engine-FOC3IJLA.js.map} +0 -0
  266. /package/dist/{migrate-from-identity-anchor-TTEDEJGX.js.map → memory-governance-F3QOJGEY.js.map} +0 -0
  267. /package/dist/{peers-6OSQ3NK6.js.map → migrate-from-identity-anchor-G27MCD6A.js.map} +0 -0
@@ -2,12 +2,15 @@ import {
2
2
  CompoundingEngine,
3
3
  SharedContextManager,
4
4
  defaultTierMigrationCycleBudget
5
- } from "./chunk-SRIDOT64.js";
5
+ } from "./chunk-4DXC6HQQ.js";
6
6
  import {
7
7
  applyUtilityPromotionRuntimePolicy,
8
8
  applyUtilityRankingRuntimeDelta,
9
9
  loadUtilityRuntimeValues
10
10
  } from "./chunk-FSFEQI74.js";
11
+ import {
12
+ isValidAsOf
13
+ } from "./chunk-MDYG7VI7.js";
11
14
  import {
12
15
  TierMigrationExecutor
13
16
  } from "./chunk-Z5AAYHUC.js";
@@ -22,15 +25,12 @@ import {
22
25
  } from "./chunk-UHGBNIOS.js";
23
26
  import {
24
27
  HourlySummarizer
25
- } from "./chunk-S5SQDIF5.js";
28
+ } from "./chunk-PHNGXFQ6.js";
26
29
  import {
27
30
  applyTemporalSupersession,
28
31
  normalizeSupersessionKey,
29
32
  shouldFilterSupersededFromRecall
30
33
  } from "./chunk-ZTSE2ZJ6.js";
31
- import {
32
- isValidAsOf
33
- } from "./chunk-MDYG7VI7.js";
34
34
  import {
35
35
  SessionObserverState
36
36
  } from "./chunk-JR4ZC3G4.js";
@@ -103,13 +103,25 @@ import {
103
103
  } from "./chunk-GGD5W7TB.js";
104
104
  import {
105
105
  runLiveConnectorsOnce
106
- } from "./chunk-ASIQZXYO.js";
106
+ } from "./chunk-XMVFHBHT.js";
107
107
  import {
108
108
  classifyMemoryKind
109
109
  } from "./chunk-YAZNBMNF.js";
110
+ import {
111
+ ExtractionEngine
112
+ } from "./chunk-Z5S5HNGY.js";
113
+ import {
114
+ parseMemoryActionEligibilityContext
115
+ } from "./chunk-WW3QQF4H.js";
116
+ import {
117
+ ModelRegistry
118
+ } from "./chunk-QR3C7BKQ.js";
119
+ import {
120
+ LocalLlmClient
121
+ } from "./chunk-NN3LPQ5D.js";
110
122
  import {
111
123
  buildExplicitCueRecallSection
112
- } from "./chunk-KNQ5YJTO.js";
124
+ } from "./chunk-ERUDW6DU.js";
113
125
  import {
114
126
  recordJudgeTrainingPair
115
127
  } from "./chunk-DF3RVK3X.js";
@@ -120,21 +132,9 @@ import {
120
132
  judgeFactDurability,
121
133
  validateProcedureExtraction
122
134
  } from "./chunk-C4SQJZAF.js";
123
- import {
124
- ExtractionEngine
125
- } from "./chunk-FCGWNWG4.js";
126
- import {
127
- parseMemoryActionEligibilityContext
128
- } from "./chunk-WW3QQF4H.js";
129
- import {
130
- ModelRegistry
131
- } from "./chunk-FEMOX5AD.js";
132
- import {
133
- LocalLlmClient
134
- } from "./chunk-R2XRID2N.js";
135
135
  import {
136
136
  formatDaySummaryMemories
137
- } from "./chunk-GZCUW5IC.js";
137
+ } from "./chunk-3IQ2TR4N.js";
138
138
  import {
139
139
  tryDirectAnswer
140
140
  } from "./chunk-6AUUAZEX.js";
@@ -145,7 +145,7 @@ import {
145
145
  buildEntityRecallSection,
146
146
  entityRecentTranscriptLookbackHours,
147
147
  readRecentEntityTranscriptEntries
148
- } from "./chunk-MYH2IBSP.js";
148
+ } from "./chunk-LIO5X3CM.js";
149
149
  import {
150
150
  buildCompressionGuidelinesMarkdown,
151
151
  computeCompressionGuidelineCandidate,
@@ -158,13 +158,13 @@ import {
158
158
  } from "./chunk-SRBJUAMP.js";
159
159
  import {
160
160
  searchVerifiedEpisodes
161
- } from "./chunk-ETA2JXP5.js";
161
+ } from "./chunk-RXTFCYQF.js";
162
162
  import {
163
163
  ThreadingManager
164
164
  } from "./chunk-JRNQ3RNA.js";
165
165
  import {
166
166
  searchVerifiedSemanticRules
167
- } from "./chunk-RLV2F337.js";
167
+ } from "./chunk-PB5KW5PL.js";
168
168
  import {
169
169
  searchWorkProductLedgerEntries
170
170
  } from "./chunk-CULXMQJH.js";
@@ -178,16 +178,13 @@ import {
178
178
  createConversationIndexRuntime,
179
179
  createSearchBackend,
180
180
  writeConversationChunks
181
- } from "./chunk-RJSVRPNU.js";
181
+ } from "./chunk-57QNCUEZ.js";
182
182
  import {
183
183
  parseQmdExplain
184
- } from "./chunk-WSZIHQBK.js";
184
+ } from "./chunk-P77UEOU2.js";
185
185
  import {
186
186
  PolicyRuntimeManager
187
187
  } from "./chunk-EABGC2TL.js";
188
- import {
189
- searchObjectiveStateSnapshots
190
- } from "./chunk-LOBRX7VD.js";
191
188
  import {
192
189
  searchHarmonicRetrieval
193
190
  } from "./chunk-HMDCOMYU.js";
@@ -207,12 +204,12 @@ import {
207
204
  formatNativeKnowledgeSection,
208
205
  searchNativeKnowledge
209
206
  } from "./chunk-7SEAZFFB.js";
210
- import {
211
- CODEX_THREAD_KEY_PREFIX
212
- } from "./chunk-3PG3H5TD.js";
213
207
  import {
214
208
  applyCommitmentLedgerLifecycle
215
209
  } from "./chunk-FYIYMQ5N.js";
210
+ import {
211
+ CODEX_THREAD_KEY_PREFIX
212
+ } from "./chunk-3PG3H5TD.js";
216
213
  import {
217
214
  semanticChunkContent
218
215
  } from "./chunk-KVE7R4CG.js";
@@ -231,10 +228,10 @@ import {
231
228
  materializeAfterSemanticConsolidation,
232
229
  parseConsolidationResponse,
233
230
  parseOperatorAwareConsolidationResponse
234
- } from "./chunk-FIXIX6DE.js";
231
+ } from "./chunk-C5HUWVH2.js";
235
232
  import {
236
233
  FallbackLlmClient
237
- } from "./chunk-DWMXVUGO.js";
234
+ } from "./chunk-VX2IUQFE.js";
238
235
  import {
239
236
  buildRecallQueryPolicy
240
237
  } from "./chunk-6HZ6AO2P.js";
@@ -259,26 +256,33 @@ import {
259
256
  import {
260
257
  clusterByKey,
261
258
  stableHash
262
- } from "./chunk-NN3TS5BM.js";
259
+ } from "./chunk-D54LZC5L.js";
263
260
  import {
264
261
  listTrustZoneRecords,
265
262
  searchTrustZoneRecords
266
263
  } from "./chunk-EQINRHYR.js";
267
264
  import {
268
265
  buildXraySnapshot
269
- } from "./chunk-AV2WSYZY.js";
266
+ } from "./chunk-2YMTO4ZJ.js";
270
267
  import {
271
- shouldSkipImplicitExtraction
272
- } from "./chunk-3FPTCC3Z.js";
268
+ parseMessageParts
269
+ } from "./chunk-IBX3VFOM.js";
273
270
  import {
274
- selectRouteRule
275
- } from "./chunk-2LGMW3DJ.js";
271
+ objectiveStateStoreOverrideForNamespace,
272
+ searchObjectiveStateSnapshots
273
+ } from "./chunk-5UM2VJ6D.js";
276
274
  import {
277
275
  ProfilingCollector
278
276
  } from "./chunk-NBNN5GOB.js";
279
277
  import {
280
278
  launchProcessSync
281
279
  } from "./chunk-OR64ZGRZ.js";
280
+ import {
281
+ shouldSkipImplicitExtraction
282
+ } from "./chunk-GVPWB7EY.js";
283
+ import {
284
+ selectRouteRule
285
+ } from "./chunk-2LGMW3DJ.js";
282
286
  import {
283
287
  buildProcedurePersistBody
284
288
  } from "./chunk-QDW3E4RD.js";
@@ -306,28 +310,28 @@ import {
306
310
  normalizeAttributePairs,
307
311
  normalizeEntityName,
308
312
  parseEntityFile
309
- } from "./chunk-XGX4TUF6.js";
313
+ } from "./chunk-MCC6KDQF.js";
310
314
  import {
311
315
  attachCitation,
312
316
  hasCitationForTemplate,
313
317
  stripCitationForTemplate
314
- } from "./chunk-4KAN3GZ3.js";
318
+ } from "./chunk-NN2DKE4T.js";
315
319
  import {
316
320
  confidenceTier
317
- } from "./chunk-T65SHTJP.js";
321
+ } from "./chunk-VQXK37XA.js";
318
322
  import {
319
323
  isActiveMemoryStatus
320
324
  } from "./chunk-RULE4VG5.js";
321
325
  import {
322
326
  openBetterSqlite3
323
- } from "./chunk-67YLUWLG.js";
327
+ } from "./chunk-XJKFSSDW.js";
324
328
  import {
325
329
  lintWorkspaceFiles,
326
330
  rotateMarkdownFileToArchive
327
331
  } from "./chunk-DM2T26WE.js";
328
332
  import {
329
333
  sanitizeMemoryContent
330
- } from "./chunk-M62O4P4T.js";
334
+ } from "./chunk-FVQJYWH7.js";
331
335
  import {
332
336
  resolveHomeDir
333
337
  } from "./chunk-MARWOCVP.js";
@@ -1734,423 +1738,6 @@ function createTables(db) {
1734
1738
  );
1735
1739
  }
1736
1740
 
1737
- // src/message-parts/index.ts
1738
- var LCM_MESSAGE_PART_KINDS = [
1739
- "text",
1740
- "tool_call",
1741
- "tool_result",
1742
- "patch",
1743
- "file_read",
1744
- "file_write",
1745
- "step_start",
1746
- "step_finish",
1747
- "snapshot",
1748
- "retry"
1749
- ];
1750
- var SECRET_KEY_RE = /(api[_-]?key|authorization|bearer|credential|password|secret|token)/i;
1751
- var MAX_PAYLOAD_STRING = 8e3;
1752
- var MAX_FILE_SCAN_CHARS = 2e4;
1753
- function isLcmMessagePartKind(value) {
1754
- return typeof value === "string" && LCM_MESSAGE_PART_KINDS.includes(value);
1755
- }
1756
- function parseMessageParts(input, options = {}) {
1757
- const explicit = normalizeExplicitParts(input);
1758
- if (explicit.length > 0) return explicit;
1759
- const format = options.sourceFormat ?? inferSourceFormat(input);
1760
- switch (format) {
1761
- case "openai":
1762
- return withRenderedFallback(parseOpenAiMessageParts(input, options), options);
1763
- case "anthropic":
1764
- return withRenderedFallback(parseAnthropicMessageParts(input, options), options);
1765
- case "openclaw":
1766
- return withRenderedFallback(parseOpenClawMessageParts(input, options), options);
1767
- case "lossless-claw":
1768
- case "remnic":
1769
- return withRenderedFallback(normalizeExplicitParts(input), options);
1770
- default:
1771
- return renderedFallbackParts(options);
1772
- }
1773
- }
1774
- function normalizeExplicitParts(input) {
1775
- const rawParts = pickArray(input, "parts") ?? pickArray(input, "message_parts");
1776
- if (!rawParts) return [];
1777
- const parts = [];
1778
- rawParts.forEach((raw, index) => {
1779
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) return;
1780
- const obj = raw;
1781
- const kind = normalizeKind(obj.kind ?? obj.type);
1782
- if (!kind) return;
1783
- const payload = obj.payload && typeof obj.payload === "object" && !Array.isArray(obj.payload) ? obj.payload : { value: sanitizePayload(obj) };
1784
- const toolName = asNonEmptyString(obj.toolName ?? obj.tool_name ?? obj.name);
1785
- const filePath = asNonEmptyString(obj.filePath ?? obj.file_path ?? obj.path);
1786
- const ordinal = typeof obj.ordinal === "number" && Number.isInteger(obj.ordinal) ? Math.max(0, obj.ordinal) : index;
1787
- parts.push({
1788
- ordinal,
1789
- kind,
1790
- payload: sanitizePayload(payload),
1791
- toolName,
1792
- filePath,
1793
- createdAt: asNonEmptyString(obj.createdAt ?? obj.created_at)
1794
- });
1795
- });
1796
- return parts;
1797
- }
1798
- function parseOpenAiMessageParts(input, _options = {}) {
1799
- const items = gatherOpenAiItems(input);
1800
- const parts = [];
1801
- for (const item of items) {
1802
- const type = asNonEmptyString(item.type) ?? asNonEmptyString(item.kind);
1803
- if (!type) continue;
1804
- if (isOpenAiContentBlock(item)) {
1805
- const text = asNonEmptyString(item.text ?? item.content);
1806
- if (text) parts.push(makePart("text", { type, text }, { filePath: firstFilePath(text) }));
1807
- continue;
1808
- }
1809
- if (type === "message") {
1810
- for (const block of gatherContentBlocks(item.content)) {
1811
- const text = asNonEmptyString(block.text ?? block.content);
1812
- if (text) parts.push(makePart("text", { type, text }, { filePath: firstFilePath(text) }));
1813
- }
1814
- continue;
1815
- }
1816
- if (type === "function_call") {
1817
- const toolName = asNonEmptyString(item.name ?? item.tool_name);
1818
- const payload = {
1819
- id: item.id ?? item.call_id,
1820
- name: toolName,
1821
- arguments: parseMaybeJson(item.arguments)
1822
- };
1823
- parts.push(classifyToolPart(toolName, payload));
1824
- continue;
1825
- }
1826
- if (type === "function_call_output") {
1827
- const output = asNonEmptyString(item.output) ?? JSON.stringify(sanitizePayload(item.output ?? item));
1828
- parts.push(makePart("tool_result", { id: item.id ?? item.call_id, output }, {
1829
- filePath: firstFilePath(output)
1830
- }));
1831
- continue;
1832
- }
1833
- if (type === "reasoning") {
1834
- parts.push(makePart("step_start", { type, summary: sanitizePayload(item.summary ?? item) }));
1835
- continue;
1836
- }
1837
- if (type === "retry") {
1838
- parts.push(makePart("retry", { type, item: sanitizePayload(item) }));
1839
- }
1840
- }
1841
- return withOrdinals(parts);
1842
- }
1843
- function parseAnthropicMessageParts(input, _options = {}) {
1844
- const blocks = gatherContentBlocks(
1845
- Array.isArray(input) ? input : input && typeof input === "object" ? input.content : input
1846
- );
1847
- const parts = [];
1848
- for (const block of blocks) {
1849
- const type = asNonEmptyString(block.type);
1850
- if (type === "text") {
1851
- const text = asNonEmptyString(block.text);
1852
- if (text) parts.push(makePart("text", { type, text }, { filePath: firstFilePath(text) }));
1853
- continue;
1854
- }
1855
- if (type === "tool_use") {
1856
- const toolName = asNonEmptyString(block.name);
1857
- parts.push(classifyToolPart(toolName, {
1858
- id: block.id,
1859
- name: toolName,
1860
- input: sanitizePayload(block.input)
1861
- }));
1862
- continue;
1863
- }
1864
- if (type === "tool_result") {
1865
- const content = block.content;
1866
- const rendered = renderUnknownContent(content);
1867
- parts.push(makePart("tool_result", { id: block.tool_use_id, content: sanitizePayload(content) }, {
1868
- filePath: firstFilePath(rendered)
1869
- }));
1870
- continue;
1871
- }
1872
- if (type === "thinking") {
1873
- parts.push(makePart("step_start", {
1874
- type,
1875
- thinking: truncateString(asNonEmptyString(block.thinking) ?? ""),
1876
- signature: asNonEmptyString(block.signature)
1877
- }));
1878
- continue;
1879
- }
1880
- if (type === "redacted_thinking") {
1881
- parts.push(makePart("step_finish", { type }));
1882
- }
1883
- }
1884
- return withOrdinals(parts);
1885
- }
1886
- function parseOpenClawMessageParts(input, options = {}) {
1887
- const explicit = normalizeExplicitParts(input);
1888
- if (explicit.length > 0) return explicit;
1889
- if (!input || typeof input !== "object") return [];
1890
- const obj = input;
1891
- const content = obj.content;
1892
- if (Array.isArray(content)) {
1893
- const hasOpenAiBlocks = content.some(isOpenAiContentBlock);
1894
- if (hasOpenAiBlocks) return parseOpenAiMessageParts(content, options);
1895
- const hasAnthropicBlocks = content.some(
1896
- (block) => block && typeof block === "object" && typeof block.type === "string"
1897
- );
1898
- if (hasAnthropicBlocks) return parseAnthropicMessageParts({ content }, options);
1899
- }
1900
- const toolName = asNonEmptyString(obj.toolName ?? obj.tool_name ?? obj.name);
1901
- if (toolName) {
1902
- return withOrdinals([
1903
- classifyToolPart(toolName, {
1904
- name: toolName,
1905
- input: sanitizePayload(obj.input ?? obj.arguments ?? obj.params),
1906
- output: sanitizePayload(obj.output ?? obj.result)
1907
- })
1908
- ]);
1909
- }
1910
- const rendered = options.renderedContent ?? asNonEmptyString(obj.content);
1911
- return rendered ? withOrdinals(partsFromRenderedText(rendered)) : [];
1912
- }
1913
- function partsFromRenderedText(text) {
1914
- if (text.includes("*** Begin Patch")) {
1915
- const paths2 = extractFilePaths(text);
1916
- const patchPaths = extractPatchPaths(text);
1917
- return withOrdinals((patchPaths.length > 0 ? patchPaths : paths2).map(
1918
- (filePath) => makePart("patch", { text: truncateString(text) }, { filePath })
1919
- ));
1920
- }
1921
- const paths = extractFilePaths(text);
1922
- if (paths.length === 0) return [];
1923
- return withOrdinals(paths.map(
1924
- (filePath) => makePart("file_read", { text: truncateString(text) }, { filePath })
1925
- ));
1926
- }
1927
- function inferSourceFormat(input) {
1928
- if (input && typeof input === "object") {
1929
- const obj = input;
1930
- const explicit = asNonEmptyString(obj.sourceFormat ?? obj.source_format);
1931
- if (explicit === "openai" || explicit === "anthropic" || explicit === "openclaw" || explicit === "lossless-claw" || explicit === "remnic") {
1932
- return explicit;
1933
- }
1934
- if (Array.isArray(obj.output)) return "openai";
1935
- if (isOpenAiResponseItem(obj)) return "openai";
1936
- if (Array.isArray(obj.content) && obj.content.some(isOpenAiContentBlock)) return "openai";
1937
- if (Array.isArray(obj.content)) return "anthropic";
1938
- }
1939
- if (Array.isArray(input)) {
1940
- return input.some(
1941
- (item) => isRecord(item) && (isOpenAiResponseItem(item) || isOpenAiContentBlock(item))
1942
- ) ? "openai" : "anthropic";
1943
- }
1944
- return void 0;
1945
- }
1946
- function isOpenAiResponseItem(obj) {
1947
- const type = asNonEmptyString(obj.type ?? obj.kind);
1948
- return type === "message" || type === "function_call" || type === "function_call_output" || type === "reasoning" || type === "retry";
1949
- }
1950
- function isOpenAiContentBlock(value) {
1951
- if (!isRecord(value)) return false;
1952
- const type = asNonEmptyString(value.type);
1953
- return type === "input_text" || type === "output_text" || type === "input_image" || type === "input_file" || type === "refusal";
1954
- }
1955
- function gatherOpenAiItems(input) {
1956
- if (Array.isArray(input)) return input.filter(isRecord);
1957
- if (!isRecord(input)) return [];
1958
- if (Array.isArray(input.output)) return input.output.filter(isRecord);
1959
- if (Array.isArray(input.items)) return input.items.filter(isRecord);
1960
- return [input];
1961
- }
1962
- function gatherContentBlocks(input) {
1963
- if (Array.isArray(input)) return input.filter(isRecord);
1964
- if (typeof input === "string") return [{ type: "text", text: input }];
1965
- if (isRecord(input)) return [input];
1966
- return [];
1967
- }
1968
- function classifyToolPart(toolName, payload) {
1969
- const normalized = (toolName ?? "").toLowerCase();
1970
- const rendered = renderUnknownContent(payload);
1971
- const filePath = firstFilePathFromObject(payload) ?? firstFilePath(rendered) ?? null;
1972
- if (normalized.includes("apply_patch") || rendered.includes("*** Begin Patch")) {
1973
- return makePart("patch", payload, { toolName, filePath: filePath ?? extractPatchPaths(rendered)[0] ?? null });
1974
- }
1975
- if (/(write|edit|multiedit|create|save)/i.test(normalized)) {
1976
- return makePart("file_write", payload, { toolName, filePath });
1977
- }
1978
- if (/(read|grep|glob|search|list|ls)/i.test(normalized)) {
1979
- return makePart("file_read", payload, { toolName, filePath });
1980
- }
1981
- return makePart("tool_call", payload, { toolName, filePath });
1982
- }
1983
- function makePart(kind, payload, options = {}) {
1984
- return {
1985
- kind,
1986
- payload: sanitizePayload(payload),
1987
- toolName: options.toolName ?? null,
1988
- filePath: options.filePath ?? null
1989
- };
1990
- }
1991
- function withOrdinals(parts) {
1992
- return parts.map((part, ordinal) => ({ ...part, ordinal: part.ordinal ?? ordinal }));
1993
- }
1994
- function withRenderedFallback(parts, options) {
1995
- return parts.length > 0 ? parts : renderedFallbackParts(options);
1996
- }
1997
- function renderedFallbackParts(options) {
1998
- const rendered = asNonEmptyString(options.renderedContent);
1999
- return rendered ? partsFromRenderedText(rendered) : [];
2000
- }
2001
- function normalizeKind(value) {
2002
- if (isLcmMessagePartKind(value)) return value;
2003
- if (value === "tool_use" || value === "function_call") return "tool_call";
2004
- if (value === "function_call_output") return "tool_result";
2005
- if (value === "thinking" || value === "reasoning") return "step_start";
2006
- return null;
2007
- }
2008
- function pickArray(input, key) {
2009
- if (!input || typeof input !== "object" || Array.isArray(input)) return null;
2010
- const value = input[key];
2011
- return Array.isArray(value) ? value : null;
2012
- }
2013
- function asNonEmptyString(value) {
2014
- if (typeof value !== "string") return null;
2015
- const trimmed = value.trim();
2016
- return trimmed.length > 0 ? trimmed : null;
2017
- }
2018
- function isRecord(value) {
2019
- return !!value && typeof value === "object" && !Array.isArray(value);
2020
- }
2021
- function parseMaybeJson(value) {
2022
- if (typeof value !== "string") return sanitizePayload(value);
2023
- try {
2024
- return sanitizePayload(JSON.parse(value));
2025
- } catch {
2026
- return truncateString(value);
2027
- }
2028
- }
2029
- function sanitizePayload(value, depth = 0) {
2030
- if (value === null || value === void 0) return value;
2031
- if (typeof value === "string") return truncateString(value);
2032
- if (typeof value === "number" || typeof value === "boolean") return value;
2033
- if (Array.isArray(value)) {
2034
- if (depth >= 4) return "[truncated]";
2035
- return value.slice(0, 100).map((item) => sanitizePayload(item, depth + 1));
2036
- }
2037
- if (typeof value === "object") {
2038
- if (depth >= 4) return "[truncated]";
2039
- const out = {};
2040
- for (const [key, child] of Object.entries(value)) {
2041
- out[key] = SECRET_KEY_RE.test(key) ? "[redacted]" : sanitizePayload(child, depth + 1);
2042
- }
2043
- return out;
2044
- }
2045
- return String(value);
2046
- }
2047
- function truncateString(value) {
2048
- return value.length > MAX_PAYLOAD_STRING ? `${value.slice(0, MAX_PAYLOAD_STRING)}...[truncated]` : value;
2049
- }
2050
- function renderUnknownContent(value) {
2051
- if (typeof value === "string") return value;
2052
- try {
2053
- return JSON.stringify(value ?? "");
2054
- } catch {
2055
- return String(value ?? "");
2056
- }
2057
- }
2058
- function firstFilePathFromObject(value) {
2059
- if (!isRecord(value)) return null;
2060
- const keys = ["file_path", "filePath", "path", "filename", "cwd"];
2061
- for (const key of keys) {
2062
- const candidate = asNonEmptyString(value[key]);
2063
- if (candidate) return candidate;
2064
- }
2065
- for (const child of Object.values(value)) {
2066
- if (typeof child === "string") {
2067
- const fromText = extractPatchPaths(child)[0] ?? firstFilePath(child);
2068
- if (fromText) return fromText;
2069
- }
2070
- if (isRecord(child)) {
2071
- const nested = firstFilePathFromObject(child);
2072
- if (nested) return nested;
2073
- }
2074
- }
2075
- return null;
2076
- }
2077
- function firstFilePath(text) {
2078
- return extractFilePaths(text)[0] ?? null;
2079
- }
2080
- function extractFilePaths(text) {
2081
- const out = /* @__PURE__ */ new Set();
2082
- let token = "";
2083
- const scanLength = Math.min(text.length, MAX_FILE_SCAN_CHARS);
2084
- for (let index = 0; index <= scanLength; index += 1) {
2085
- const char = index < scanLength ? text[index] : " ";
2086
- if (isFilePathTokenSeparator(char)) {
2087
- addFilePathCandidate(out, token);
2088
- token = "";
2089
- continue;
2090
- }
2091
- token += char;
2092
- if (token.length > 512) {
2093
- addFilePathCandidate(out, token);
2094
- token = "";
2095
- }
2096
- }
2097
- return [...out].slice(0, 20);
2098
- }
2099
- function isFilePathTokenSeparator(char) {
2100
- return char === " " || char === "\n" || char === "\r" || char === " " || char === '"' || char === "'" || char === "`" || char === "(" || char === ")" || char === "[" || char === "]" || char === "{" || char === "}" || char === "<" || char === ">" || char === ",";
2101
- }
2102
- function addFilePathCandidate(out, raw) {
2103
- const candidate = trimFilePathPunctuation(raw);
2104
- if (candidate.length === 0 || candidate.includes("://")) return;
2105
- if (isLikelyFilePath(candidate)) out.add(candidate);
2106
- }
2107
- function trimFilePathPunctuation(raw) {
2108
- let start = 0;
2109
- let end = raw.length;
2110
- while (start < end && isLeadingFilePathPunctuation(raw[start])) start += 1;
2111
- while (end > start && isTrailingFilePathPunctuation(raw[end - 1])) end -= 1;
2112
- return raw.slice(start, end);
2113
- }
2114
- function isLeadingFilePathPunctuation(char) {
2115
- return char === ":" || char === ";" || char === "!" || char === "?" || char === "|" || char === "*" || char === "=";
2116
- }
2117
- function isTrailingFilePathPunctuation(char) {
2118
- return char === "." || char === ":" || char === ";" || char === "!" || char === "?" || char === "|" || char === "*" || char === "=";
2119
- }
2120
- function isLikelyFilePath(value) {
2121
- if (value.startsWith("/") || value.startsWith("./") || value.startsWith("../") || value.startsWith("~/")) {
2122
- return hasValidFileExtension(value);
2123
- }
2124
- if (value.includes("/")) return hasValidFileExtension(value);
2125
- return hasValidFileExtension(value);
2126
- }
2127
- function hasValidFileExtension(value) {
2128
- const lastSlash = value.lastIndexOf("/");
2129
- const basename = value.slice(lastSlash + 1);
2130
- const dot = basename.lastIndexOf(".");
2131
- if (dot <= 0 || dot === basename.length - 1) return false;
2132
- const ext = basename.slice(dot + 1);
2133
- if (ext.length < 1 || ext.length > 12) return false;
2134
- for (const char of ext) {
2135
- if (!isFileExtensionChar(char)) return false;
2136
- }
2137
- return true;
2138
- }
2139
- function isFileExtensionChar(char) {
2140
- const code = char.charCodeAt(0);
2141
- return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || char === "_" || char === "+" || char === "-";
2142
- }
2143
- function extractPatchPaths(text) {
2144
- const out = /* @__PURE__ */ new Set();
2145
- for (const line of text.split(/\r?\n/)) {
2146
- const match = line.match(/^\*\*\* (?:Add|Update|Delete) File: (.+)$/);
2147
- if (match?.[1]) out.add(match[1].trim());
2148
- const move = line.match(/^\*\*\* Move to: (.+)$/);
2149
- if (move?.[1]) out.add(move[1].trim());
2150
- }
2151
- return [...out].slice(0, 20);
2152
- }
2153
-
2154
1741
  // src/lcm/archive.ts
2155
1742
  function estimateTokens(text) {
2156
1743
  return Math.ceil(text.length / 4);
@@ -3751,8 +3338,10 @@ function fingerprintEntitySynthesisEvidence(entity) {
3751
3338
  entry.principal ?? "",
3752
3339
  entry.text
3753
3340
  ].join("\0")).sort();
3754
- fingerprint.update(timelineEntries.join(""));
3755
- fingerprint.update("");
3341
+ const timelineEntrySeparator = String.fromCharCode(1);
3342
+ const structuredFactsSeparator = String.fromCharCode(2);
3343
+ fingerprint.update(timelineEntries.join(timelineEntrySeparator));
3344
+ fingerprint.update(structuredFactsSeparator);
3756
3345
  fingerprint.update(fingerprintEntityStructuredFacts(entity) ?? "");
3757
3346
  return fingerprint.digest("hex");
3758
3347
  }
@@ -4221,7 +3810,7 @@ var Orchestrator = class _Orchestrator {
4221
3810
  memoryWorthCounterCache = /* @__PURE__ */ new Map();
4222
3811
  static MEMORY_WORTH_CACHE_TTL_MS = 3e4;
4223
3812
  /**
4224
- * Per-session workspace overrides keyed by sessionKey.
3813
+ * Per-session workspace selections keyed by sessionKey.
4225
3814
  * Set by the before_agent_start hook so recall() uses the correct
4226
3815
  * agent workspace for BOOT.md injection. Cleared after each recall.
4227
3816
  * Using a Map prevents concurrent sessions from overwriting each other.
@@ -4333,7 +3922,7 @@ var Orchestrator = class _Orchestrator {
4333
3922
  setRecallWorkspaceOverride(sessionKey, dir) {
4334
3923
  this._recallWorkspaceOverrides.set(sessionKey, dir);
4335
3924
  }
4336
- /** Remove a per-session workspace override (cleanup on error or early return). @internal */
3925
+ /** Remove a per-session workspace selection (cleanup on error or early return). @internal */
4337
3926
  clearRecallWorkspaceOverride(sessionKey) {
4338
3927
  this._recallWorkspaceOverrides.delete(sessionKey);
4339
3928
  }
@@ -4637,7 +4226,9 @@ var Orchestrator = class _Orchestrator {
4637
4226
  client.disableThinking = true;
4638
4227
  return client;
4639
4228
  })() : this.localLlm;
4640
- this._fastGatewayLlm = config.modelSource === "gateway" ? new FallbackLlmClient(config.gatewayConfig) : null;
4229
+ this._fastGatewayLlm = config.modelSource === "gateway" ? new FallbackLlmClient(config.gatewayConfig, {
4230
+ workspaceDir: config.workspaceDir
4231
+ }) : null;
4641
4232
  if (config.modelSource === "gateway") {
4642
4233
  log.debug(
4643
4234
  `orchestrator: gateway model source active` + (config.gatewayAgentId ? ` (primary: ${config.gatewayAgentId})` : "") + (config.fastGatewayAgentId ? ` (fast: ${config.fastGatewayAgentId})` : "")
@@ -4661,19 +4252,21 @@ var Orchestrator = class _Orchestrator {
4661
4252
  });
4662
4253
  if (config.lcmEnabled) {
4663
4254
  const summarizeFn = async (text, targetTokens, aggressive) => {
4664
- const systemPrompt = aggressive ? `Compress the following into bullet points. One bullet per distinct fact or decision. Maximum ${targetTokens} tokens total. No prose.` : `Compress the following conversation segment into a dense summary. Preserve: decisions made, code artifacts mentioned, errors encountered, open questions, and any commitments or next-steps. Omit: pleasantries, restatements, and anything the agent would not need to recall later. Output a single paragraph, maximum ${targetTokens} tokens.`;
4255
+ const instructionText = aggressive ? `Compress the following into bullet points. One bullet per distinct fact or decision. Maximum ${targetTokens} tokens total. No prose.` : `Compress the following conversation segment into a dense summary. Preserve: decisions made, code artifacts mentioned, errors encountered, open questions, and any commitments or next-steps. Omit: pleasantries, restatements, and anything the agent would not need to recall later. Output a single paragraph, maximum ${targetTokens} tokens.`;
4665
4256
  try {
4666
- const result = await this.localLlm.chatCompletion(
4667
- [
4668
- { role: "system", content: systemPrompt },
4669
- { role: "user", content: text.slice(0, 12e3) }
4670
- ],
4671
- {
4672
- maxTokens: targetTokens * 2,
4673
- operation: "lcm-summarize",
4674
- priority: "background"
4675
- }
4676
- );
4257
+ const messages = [
4258
+ { role: "system", content: instructionText },
4259
+ { role: "user", content: text.slice(0, 12e3) }
4260
+ ];
4261
+ const result = this.config.modelSource === "gateway" && this._fastGatewayLlm ? await this._fastGatewayLlm.chatCompletion(messages, {
4262
+ maxTokens: targetTokens * 2,
4263
+ timeoutMs: this.config.localLlmFastTimeoutMs,
4264
+ agentId: this.config.fastGatewayAgentId || this.config.gatewayAgentId || void 0
4265
+ }) : await this.localLlm.chatCompletion(messages, {
4266
+ maxTokens: targetTokens * 2,
4267
+ operation: "lcm-summarize",
4268
+ priority: "background"
4269
+ });
4677
4270
  return result?.content ?? null;
4678
4271
  } catch {
4679
4272
  return null;
@@ -5554,7 +5147,7 @@ ${doc.content}` : doc.content,
5554
5147
  }
5555
5148
  async runDeepSleepGovernanceNow(options) {
5556
5149
  const targetStorage = options?.storage ?? this.storage;
5557
- const { runMemoryGovernance } = await import("./memory-governance-G3XODEXW.js");
5150
+ const { runMemoryGovernance } = await import("./memory-governance-F3QOJGEY.js");
5558
5151
  const { summarizeGovernanceResultForDreams } = await import("./dreams-ledger-LR2NBAZE.js");
5559
5152
  const govResult = await runMemoryGovernance({
5560
5153
  memoryDir: targetStorage.dir,
@@ -5618,7 +5211,9 @@ ${doc.content}` : doc.content,
5618
5211
  log.info("[semantic-consolidation] using fast local LLM for synthesis");
5619
5212
  }
5620
5213
  const gatewayAgentId = useGateway ? modelSetting === "fast" && this.config.fastGatewayAgentId ? this.config.fastGatewayAgentId : this.config.gatewayAgentId || void 0 : void 0;
5621
- const llm = new FallbackLlmClient2(this.config.gatewayConfig);
5214
+ const llm = new FallbackLlmClient2(this.config.gatewayConfig, {
5215
+ workspaceDir: this.config.workspaceDir
5216
+ });
5622
5217
  if (!llm.isAvailable(gatewayAgentId) && !(modelSetting === "fast" && this.fastLlm && !useGateway)) {
5623
5218
  log.warn(
5624
5219
  "[semantic-consolidation] no LLM available \u2014 skipping synthesis"
@@ -5771,8 +5366,10 @@ ${doc.content}` : doc.content,
5771
5366
  }
5772
5367
  if (this.config.peerProfileReasonerEnabled) {
5773
5368
  try {
5774
- const { runPeerProfileReasoner } = await import("./peers-6OSQ3NK6.js");
5775
- const llm2 = new FallbackLlmClient2(this.config.gatewayConfig);
5369
+ const { runPeerProfileReasoner } = await import("./peers-HCVGHMAE.js");
5370
+ const llm2 = new FallbackLlmClient2(this.config.gatewayConfig, {
5371
+ workspaceDir: this.config.workspaceDir
5372
+ });
5776
5373
  const peerResult = await runPeerProfileReasoner({
5777
5374
  memoryDir: targetStorage.dir,
5778
5375
  enabled: true,
@@ -7995,7 +7592,7 @@ ${trimmedBody}`;
7995
7592
  if (!peerId) return null;
7996
7593
  const t0 = Date.now();
7997
7594
  try {
7998
- const { readPeerProfile: _readPeerProfile } = await import("./peers-6OSQ3NK6.js");
7595
+ const { readPeerProfile: _readPeerProfile } = await import("./peers-HCVGHMAE.js");
7999
7596
  const peerProfile = await _readPeerProfile(this.config.memoryDir, peerId);
8000
7597
  recordRecallSectionMetric({
8001
7598
  section: "peerProfile",
@@ -8241,13 +7838,27 @@ ${lines.join("\n\n")}`;
8241
7838
  });
8242
7839
  return null;
8243
7840
  }
8244
- const results = await searchObjectiveStateSnapshots({
8245
- memoryDir: this.config.memoryDir,
8246
- objectiveStateStoreDir: this.config.objectiveStateStoreDir,
8247
- query: retrievalQuery,
8248
- maxResults,
8249
- sessionKey
8250
- });
7841
+ const objectiveStateSearches = await Promise.all(
7842
+ recallNamespaces.map(async (namespace) => {
7843
+ const storage = this.config.namespacesEnabled ? await this.getStorage(namespace) : null;
7844
+ return searchObjectiveStateSnapshots({
7845
+ memoryDir: this.config.namespacesEnabled ? storage.dir : this.config.memoryDir,
7846
+ objectiveStateStoreDir: objectiveStateStoreOverrideForNamespace({
7847
+ memoryDir: this.config.memoryDir,
7848
+ configuredStoreDir: this.config.objectiveStateStoreDir,
7849
+ namespacesEnabled: this.config.namespacesEnabled,
7850
+ namespace
7851
+ }),
7852
+ query: retrievalQuery,
7853
+ maxResults,
7854
+ sessionKey
7855
+ });
7856
+ })
7857
+ );
7858
+ const results = objectiveStateSearches.flat().sort((left, right) => {
7859
+ if (right.score !== left.score) return right.score - left.score;
7860
+ return right.snapshot.recordedAt.localeCompare(left.snapshot.recordedAt);
7861
+ }).slice(0, maxResults);
8251
7862
  recordRecallSectionMetric({
8252
7863
  section: "objectiveState",
8253
7864
  priority: "core",
@@ -11834,7 +11445,9 @@ ${normalized}`).digest("hex");
11834
11445
  judgeCandidates,
11835
11446
  this.config,
11836
11447
  this.localLlm,
11837
- new FallbackLlmClient(this.config.gatewayConfig),
11448
+ new FallbackLlmClient(this.config.gatewayConfig, {
11449
+ workspaceDir: this.config.workspaceDir
11450
+ }),
11838
11451
  this.judgeVerdictCache,
11839
11452
  this.judgeDeferCounts,
11840
11453
  judgeTelemetryHandler
@@ -14748,13 +14361,6 @@ export {
14748
14361
  openLcmDatabase,
14749
14362
  ensureLcmStateDir,
14750
14363
  applyLcmSchema,
14751
- isLcmMessagePartKind,
14752
- parseMessageParts,
14753
- normalizeExplicitParts,
14754
- parseOpenAiMessageParts,
14755
- parseAnthropicMessageParts,
14756
- parseOpenClawMessageParts,
14757
- partsFromRenderedText,
14758
14364
  projectNamespaceName,
14759
14365
  branchNamespaceName,
14760
14366
  resolveCodingNamespaceOverlay,
@@ -14787,4 +14393,4 @@ export {
14787
14393
  resolvePersistedMemoryRelativePath,
14788
14394
  Orchestrator
14789
14395
  };
14790
- //# sourceMappingURL=chunk-GRDDGNYQ.js.map
14396
+ //# sourceMappingURL=chunk-5GCNE7CN.js.map