@remnic/core 9.63.6 → 9.63.8

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 (304) hide show
  1. package/dist/access-admin-ops-surface.d.ts +3 -2
  2. package/dist/access-admin-ops-surface.js +31 -27
  3. package/dist/access-authorization-probe.d.ts +3 -2
  4. package/dist/access-authorization-probe.js +32 -28
  5. package/dist/access-boundary.d.ts +3 -2
  6. package/dist/access-boundary.js +31 -27
  7. package/dist/access-cli.js +98 -95
  8. package/dist/access-cli.js.map +1 -1
  9. package/dist/access-extraction-force-flush.d.ts +3 -2
  10. package/dist/access-extraction-force-flush.js +31 -27
  11. package/dist/access-http-lcm-compaction.d.ts +3 -2
  12. package/dist/access-http-lifecycle-flush.d.ts +3 -2
  13. package/dist/access-http-offline-stream.d.ts +3 -2
  14. package/dist/access-http-query.js +33 -29
  15. package/dist/access-http.d.ts +4 -3
  16. package/dist/access-http.js +47 -43
  17. package/dist/access-identity-continuity-surface.d.ts +2 -1
  18. package/dist/access-identity-continuity-surface.js +31 -27
  19. package/dist/access-lcm-surface.d.ts +3 -2
  20. package/dist/access-lcm-surface.js +31 -27
  21. package/dist/access-mcp-output-schemas.js +1 -1
  22. package/dist/access-mcp.d.ts +3 -2
  23. package/dist/access-mcp.js +38 -34
  24. package/dist/access-namespace-preflight.js +31 -27
  25. package/dist/access-observe-write-surface.d.ts +3 -2
  26. package/dist/access-observe-write-surface.js +31 -27
  27. package/dist/access-offline-manifest.d.ts +2 -1
  28. package/dist/access-offline-manifest.js +5 -4
  29. package/dist/access-operations-batch.js +32 -28
  30. package/dist/access-operations.d.ts +3 -2
  31. package/dist/access-operations.js +36 -32
  32. package/dist/access-recall-concurrency.d.ts +3 -2
  33. package/dist/access-recall-concurrency.js +31 -27
  34. package/dist/access-recall-response.d.ts +3 -2
  35. package/dist/access-recall-response.js +31 -27
  36. package/dist/access-recall-surface.d.ts +3 -2
  37. package/dist/access-recall-surface.js +31 -27
  38. package/dist/access-schema.js +6 -5
  39. package/dist/{access-service-cKQrte9Z.d.ts → access-service-BaPa_km6.d.ts} +1 -1
  40. package/dist/access-service-helpers.d.ts +3 -2
  41. package/dist/access-service.d.ts +3 -2
  42. package/dist/access-service.js +31 -27
  43. package/dist/access-surface-catalog.d.ts +3 -2
  44. package/dist/access-surface-catalog.js +33 -29
  45. package/dist/access-surface-catalog.js.map +1 -1
  46. package/dist/active-recall.js +4 -2
  47. package/dist/active-recall.js.map +1 -1
  48. package/dist/adapters/index.js +4 -4
  49. package/dist/adapters/registry.js +2 -2
  50. package/dist/{auto-sync-BKRJDMKX.js → auto-sync-3SHMZVQS.js} +5 -3
  51. package/dist/{auto-sync-BKRJDMKX.js.map → auto-sync-3SHMZVQS.js.map} +1 -1
  52. package/dist/bootstrap.d.ts +2 -1
  53. package/dist/briefing.js +10 -10
  54. package/dist/calibration.d.ts +2 -1
  55. package/dist/calibration.js +7 -0
  56. package/dist/calibration.js.map +1 -1
  57. package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
  58. package/dist/causal-consolidation.js +11 -11
  59. package/dist/census-validation.d.ts +19 -0
  60. package/dist/census-validation.js +14 -0
  61. package/dist/census-validation.js.map +1 -0
  62. package/dist/{chunk-LEPOP46W.js → chunk-227UFSEQ.js} +4 -4
  63. package/dist/chunk-2YA5N2BY.js +65 -0
  64. package/dist/chunk-2YA5N2BY.js.map +1 -0
  65. package/dist/{chunk-PB4WVYGC.js → chunk-3IMYRX3W.js} +2 -2
  66. package/dist/{chunk-R6UMNP5C.js → chunk-3T6HIIKA.js} +2 -2
  67. package/dist/{chunk-77QZW2D6.js → chunk-3TDAA7VA.js} +2 -2
  68. package/dist/{chunk-TWTUGCTY.js → chunk-3YTTAGPB.js} +6 -1
  69. package/dist/chunk-3YTTAGPB.js.map +1 -0
  70. package/dist/{chunk-DXDAQZ2K.js → chunk-42TIIO2M.js} +2 -2
  71. package/dist/{chunk-Y7COCXY2.js → chunk-4F67JJPG.js} +2 -2
  72. package/dist/{chunk-OW7NVMGQ.js → chunk-5OOTHWGJ.js} +2 -2
  73. package/dist/{chunk-KYTRF64R.js → chunk-5SCFDQEJ.js} +2 -2
  74. package/dist/{chunk-DYZR3Z6D.js → chunk-5TF5STAV.js} +4 -4
  75. package/dist/{chunk-GG4DN63W.js → chunk-62Y5AGCM.js} +2 -2
  76. package/dist/{chunk-PMVPCZJZ.js → chunk-6433HV72.js} +2 -2
  77. package/dist/{chunk-KHCUVYCY.js → chunk-6UKSOXAO.js} +3 -3
  78. package/dist/{chunk-GF7RQWXC.js → chunk-AJRJDXYR.js} +2 -2
  79. package/dist/{chunk-YEQCMA5L.js → chunk-BOSIHHOH.js} +2 -2
  80. package/dist/{chunk-IVXVLDNT.js → chunk-BPQ7L27U.js} +77 -92
  81. package/dist/chunk-BPQ7L27U.js.map +1 -0
  82. package/dist/{chunk-7LF2OHIJ.js → chunk-BRHKW7GY.js} +2 -2
  83. package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
  84. package/dist/{chunk-LX4TNSAE.js → chunk-CBY54QYW.js} +4 -4
  85. package/dist/{chunk-CIAI24TQ.js → chunk-DGUVXXAU.js} +3 -3
  86. package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
  87. package/dist/{chunk-QI5RDDEL.js → chunk-EDZNW3HE.js} +3 -3
  88. package/dist/chunk-FEHIOYML.js +168 -0
  89. package/dist/chunk-FEHIOYML.js.map +1 -0
  90. package/dist/{chunk-Z4N7SVVF.js → chunk-FZEEWOI2.js} +9 -4
  91. package/dist/chunk-FZEEWOI2.js.map +1 -0
  92. package/dist/{chunk-6YMEU6OQ.js → chunk-G72IPMR7.js} +2 -2
  93. package/dist/{chunk-7AF243WZ.js → chunk-GBVRVYF4.js} +1 -1
  94. package/dist/{chunk-FPEZ74F7.js → chunk-I2HTKOOP.js} +3 -3
  95. package/dist/{chunk-R7TZ2HCS.js → chunk-JG22O53B.js} +58 -3
  96. package/dist/chunk-JG22O53B.js.map +1 -0
  97. package/dist/{chunk-VPHSMJ2E.js → chunk-JPWSYHLB.js} +2 -2
  98. package/dist/{chunk-X7LEDA74.js → chunk-KFB4YNXM.js} +2 -2
  99. package/dist/{chunk-I5FLIB2J.js → chunk-KXWE62IH.js} +2 -2
  100. package/dist/chunk-LQWOFU6L.js +17 -0
  101. package/dist/chunk-LQWOFU6L.js.map +1 -0
  102. package/dist/{chunk-TSTI6A3A.js → chunk-LTYH2L6E.js} +13 -13
  103. package/dist/{chunk-ZUPKNWRZ.js → chunk-MIUL6AUZ.js} +3 -3
  104. package/dist/{chunk-EJY3HJMT.js → chunk-MYI3RKI6.js} +2 -2
  105. package/dist/{chunk-UCLMKNHA.js → chunk-N7V3P4V5.js} +2 -2
  106. package/dist/{chunk-NA56NSKL.js → chunk-O52TB5SL.js} +2 -2
  107. package/dist/{chunk-7KQB4EBS.js → chunk-OPPBTPUU.js} +4 -4
  108. package/dist/{chunk-ERPBRXVZ.js → chunk-PHKU6BZ2.js} +2 -2
  109. package/dist/{chunk-GTD4Q62X.js → chunk-PQHNZ63P.js} +4 -4
  110. package/dist/{chunk-FHKXVTM5.js → chunk-Q5XKKDFQ.js} +16 -16
  111. package/dist/{chunk-QRWMS6SI.js → chunk-Q6OL23WM.js} +2 -2
  112. package/dist/{chunk-V3KIRICY.js → chunk-QQYHYW2N.js} +3 -3
  113. package/dist/{chunk-YFCEBB5P.js → chunk-QTXNS3HB.js} +2 -2
  114. package/dist/{chunk-2QSZNTDO.js → chunk-RKNJBZ55.js} +4 -4
  115. package/dist/{chunk-E4KMY4KR.js → chunk-SNEUAZ6B.js} +2 -2
  116. package/dist/{chunk-F6JYBVL6.js → chunk-SY5JUJ2X.js} +52 -52
  117. package/dist/{chunk-EFKZT6AY.js → chunk-T42L3S6A.js} +6 -11
  118. package/dist/chunk-T42L3S6A.js.map +1 -0
  119. package/dist/{chunk-YXMHUBN2.js → chunk-TOP3FSDW.js} +25 -102
  120. package/dist/chunk-TOP3FSDW.js.map +1 -0
  121. package/dist/{chunk-PBRCYYO7.js → chunk-ULZFZL7K.js} +2 -2
  122. package/dist/{chunk-YYQAKIDJ.js → chunk-VD2OT77P.js} +2 -2
  123. package/dist/chunk-VD2OT77P.js.map +1 -0
  124. package/dist/{chunk-IPLYGWQF.js → chunk-VDX2J7OX.js} +6 -6
  125. package/dist/{chunk-UGHCZS6K.js → chunk-VFZQXYN5.js} +2 -2
  126. package/dist/{chunk-NKB43PGI.js → chunk-VYMICVRA.js} +2 -2
  127. package/dist/{chunk-OETHJBAL.js → chunk-WBPD6SBZ.js} +109 -116
  128. package/dist/chunk-WBPD6SBZ.js.map +1 -0
  129. package/dist/{chunk-2UM6WHME.js → chunk-XE2QCCT2.js} +2 -2
  130. package/dist/{chunk-SYVGVK4S.js → chunk-XTMYB2HY.js} +2 -2
  131. package/dist/{chunk-AYVCKGA6.js → chunk-YTXNDEUS.js} +2 -2
  132. package/dist/{chunk-3Z5TGRFA.js → chunk-ZOAAY2OE.js} +9 -9
  133. package/dist/{chunk-L3CHRBHE.js → chunk-ZRUEP4IK.js} +17 -11
  134. package/dist/chunk-ZRUEP4IK.js.map +1 -0
  135. package/dist/{chunk-PRDJMOST.js → chunk-ZVZHG7AI.js} +65 -15
  136. package/dist/chunk-ZVZHG7AI.js.map +1 -0
  137. package/dist/{chunk-RYST72N5.js → chunk-ZWYXSF2T.js} +4 -154
  138. package/dist/chunk-ZWYXSF2T.js.map +1 -0
  139. package/dist/{cli-BFBDYV0D.d.ts → cli-D0tV7eeU.d.ts} +2 -2
  140. package/dist/cli.d.ts +4 -3
  141. package/dist/cli.js +69 -65
  142. package/dist/compounding/engine.js +10 -10
  143. package/dist/config.js +4 -2
  144. package/dist/connectors/codex-materialize-runner.js +10 -10
  145. package/dist/connectors/index.js +10 -10
  146. package/dist/consolidation-provenance-check.js +2 -2
  147. package/dist/convergence-refresh.js +12 -12
  148. package/dist/conversation-index/backend.js +2 -2
  149. package/dist/corpus-watermark.js +12 -12
  150. package/dist/entity-retrieval.js +10 -10
  151. package/dist/explicit-capture.d.ts +2 -1
  152. package/dist/external-wiki-access.d.ts +3 -2
  153. package/dist/external-wiki-access.js +32 -28
  154. package/dist/external-wiki-mcp-tools.d.ts +3 -2
  155. package/dist/extraction-judge.d.ts +2 -1
  156. package/dist/extraction-judge.js +6 -1
  157. package/dist/extraction-normalization.js +2 -2
  158. package/dist/extraction-prompt.d.ts +20 -1
  159. package/dist/extraction-prompt.js +11 -1
  160. package/dist/extraction.js +13 -13
  161. package/dist/harmonic-retrieval.js +1 -1
  162. package/dist/included-memories.d.ts +11 -0
  163. package/dist/included-memories.js +14 -0
  164. package/dist/included-memories.js.map +1 -0
  165. package/dist/index.d.ts +6 -5
  166. package/dist/index.js +117 -114
  167. package/dist/lcm/index.js +3 -3
  168. package/dist/maintenance/memory-governance.js +10 -10
  169. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +10 -10
  170. package/dist/maintenance/rebuild-memory-projection.js +11 -11
  171. package/dist/mcp-memory-inspector-app.d.ts +3 -2
  172. package/dist/namespaces/migrate.js +11 -11
  173. package/dist/namespaces/search.js +4 -4
  174. package/dist/namespaces/storage.js +10 -10
  175. package/dist/offline-sync.js +2 -1
  176. package/dist/operator-doctor-corpus.js +13 -13
  177. package/dist/operator-toolkit.js +23 -21
  178. package/dist/orchestration/maintenance.js +16 -16
  179. package/dist/{orchestrator-CSc9GfQv.d.ts → orchestrator-Bay_AofR.d.ts} +2 -3
  180. package/dist/orchestrator.d.ts +2 -1
  181. package/dist/orchestrator.js +100 -97
  182. package/dist/{public-http-8PcrDIYi.d.ts → public-http-BtjiyKah.d.ts} +1 -1
  183. package/dist/recall-explain-renderer.d.ts +1 -0
  184. package/dist/recall-state.d.ts +6 -2
  185. package/dist/recall-state.js +6 -2
  186. package/dist/reconcile/cursor.js +7 -3
  187. package/dist/reconcile/cursor.js.map +1 -1
  188. package/dist/reconcile/manifest.js +3 -7
  189. package/dist/reconcile/plan.d.ts +15 -1
  190. package/dist/reconcile/plan.js +6 -10
  191. package/dist/resume-bundles.js +5 -3
  192. package/dist/search/factory.js +3 -3
  193. package/dist/search/index.js +3 -3
  194. package/dist/semantic-consolidation.js +16 -16
  195. package/dist/semantic-rule-promotion.js +10 -10
  196. package/dist/semantic-rule-verifier.js +10 -10
  197. package/dist/source-agent-qualifier.js +10 -10
  198. package/dist/storage.js +9 -9
  199. package/dist/support-passport/index.d.ts +6 -5
  200. package/dist/support-passport/index.js +34 -30
  201. package/dist/transfer/autodetect.js +1 -1
  202. package/dist/transfer/backup.js +2 -2
  203. package/dist/transfer/capsule-export.js +3 -3
  204. package/dist/transfer/capsule-import.js +2 -2
  205. package/dist/verified-recall.js +10 -10
  206. package/package.json +2 -2
  207. package/src/access-mcp-output-schemas.ts +1 -1
  208. package/src/access-recall-response.ts +4 -2
  209. package/src/access-recall-surface.ts +9 -9
  210. package/src/access-service-namespace.test.ts +9 -9
  211. package/src/access-service-raw-excerpt-read-gate.test.ts +1 -1
  212. package/src/calibration.ts +3 -1
  213. package/src/census-validation.ts +25 -0
  214. package/src/coding/architecture-surfaces.test.ts +9 -10
  215. package/src/coding/architecture-surfaces.ts +2 -35
  216. package/src/coding/codegraph-runtime-loader.test.ts +228 -0
  217. package/src/coding/codegraph-runtime.ts +30 -50
  218. package/src/coding/codegraph-surfaces.ts +2 -2
  219. package/src/coding/coding-knowledge-config.ts +35 -1
  220. package/src/coding/decision-surfaces.test.ts +9 -10
  221. package/src/coding/decision-surfaces.ts +2 -40
  222. package/src/coding/session-delta-surfaces.test.ts +9 -10
  223. package/src/coding/session-delta-surfaces.ts +2 -33
  224. package/src/extraction-judge.ts +3 -1
  225. package/src/extraction-output-language.test.ts +116 -0
  226. package/src/extraction-prompt.ts +70 -1
  227. package/src/extraction.ts +23 -95
  228. package/src/included-memories.ts +88 -0
  229. package/src/offline-sync.ts +4 -4
  230. package/src/orchestration/recall-internal-deps.ts +2 -4
  231. package/src/orchestration/recall-internal.ts +9 -13
  232. package/src/orchestration/recall-result-formatter-display-safe.test.ts +13 -16
  233. package/src/orchestration/recall-result-formatter.ts +32 -45
  234. package/src/orchestration/recall-section-coordinator.ts +20 -26
  235. package/src/orchestrator.ts +2 -4
  236. package/src/recall-explain-renderer.test.ts +4 -0
  237. package/src/recall-state.test.ts +108 -5
  238. package/src/recall-state.ts +85 -23
  239. package/src/recall-token-budget.test.ts +1 -1
  240. package/src/reconcile/census-parity.test.ts +152 -0
  241. package/src/reconcile/cursor.ts +5 -5
  242. package/src/reconcile/manifest.ts +4 -11
  243. package/src/reconcile/plan.ts +18 -15
  244. package/dist/chunk-EFKZT6AY.js.map +0 -1
  245. package/dist/chunk-IVXVLDNT.js.map +0 -1
  246. package/dist/chunk-L3CHRBHE.js.map +0 -1
  247. package/dist/chunk-OETHJBAL.js.map +0 -1
  248. package/dist/chunk-PRDJMOST.js.map +0 -1
  249. package/dist/chunk-R7TZ2HCS.js.map +0 -1
  250. package/dist/chunk-RYST72N5.js.map +0 -1
  251. package/dist/chunk-TWTUGCTY.js.map +0 -1
  252. package/dist/chunk-YXMHUBN2.js.map +0 -1
  253. package/dist/chunk-YYQAKIDJ.js.map +0 -1
  254. package/dist/chunk-Z4N7SVVF.js.map +0 -1
  255. /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
  256. /package/dist/{chunk-LEPOP46W.js.map → chunk-227UFSEQ.js.map} +0 -0
  257. /package/dist/{chunk-PB4WVYGC.js.map → chunk-3IMYRX3W.js.map} +0 -0
  258. /package/dist/{chunk-R6UMNP5C.js.map → chunk-3T6HIIKA.js.map} +0 -0
  259. /package/dist/{chunk-77QZW2D6.js.map → chunk-3TDAA7VA.js.map} +0 -0
  260. /package/dist/{chunk-DXDAQZ2K.js.map → chunk-42TIIO2M.js.map} +0 -0
  261. /package/dist/{chunk-Y7COCXY2.js.map → chunk-4F67JJPG.js.map} +0 -0
  262. /package/dist/{chunk-OW7NVMGQ.js.map → chunk-5OOTHWGJ.js.map} +0 -0
  263. /package/dist/{chunk-KYTRF64R.js.map → chunk-5SCFDQEJ.js.map} +0 -0
  264. /package/dist/{chunk-DYZR3Z6D.js.map → chunk-5TF5STAV.js.map} +0 -0
  265. /package/dist/{chunk-GG4DN63W.js.map → chunk-62Y5AGCM.js.map} +0 -0
  266. /package/dist/{chunk-PMVPCZJZ.js.map → chunk-6433HV72.js.map} +0 -0
  267. /package/dist/{chunk-KHCUVYCY.js.map → chunk-6UKSOXAO.js.map} +0 -0
  268. /package/dist/{chunk-GF7RQWXC.js.map → chunk-AJRJDXYR.js.map} +0 -0
  269. /package/dist/{chunk-YEQCMA5L.js.map → chunk-BOSIHHOH.js.map} +0 -0
  270. /package/dist/{chunk-7LF2OHIJ.js.map → chunk-BRHKW7GY.js.map} +0 -0
  271. /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
  272. /package/dist/{chunk-LX4TNSAE.js.map → chunk-CBY54QYW.js.map} +0 -0
  273. /package/dist/{chunk-CIAI24TQ.js.map → chunk-DGUVXXAU.js.map} +0 -0
  274. /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
  275. /package/dist/{chunk-QI5RDDEL.js.map → chunk-EDZNW3HE.js.map} +0 -0
  276. /package/dist/{chunk-6YMEU6OQ.js.map → chunk-G72IPMR7.js.map} +0 -0
  277. /package/dist/{chunk-7AF243WZ.js.map → chunk-GBVRVYF4.js.map} +0 -0
  278. /package/dist/{chunk-FPEZ74F7.js.map → chunk-I2HTKOOP.js.map} +0 -0
  279. /package/dist/{chunk-VPHSMJ2E.js.map → chunk-JPWSYHLB.js.map} +0 -0
  280. /package/dist/{chunk-X7LEDA74.js.map → chunk-KFB4YNXM.js.map} +0 -0
  281. /package/dist/{chunk-I5FLIB2J.js.map → chunk-KXWE62IH.js.map} +0 -0
  282. /package/dist/{chunk-TSTI6A3A.js.map → chunk-LTYH2L6E.js.map} +0 -0
  283. /package/dist/{chunk-ZUPKNWRZ.js.map → chunk-MIUL6AUZ.js.map} +0 -0
  284. /package/dist/{chunk-EJY3HJMT.js.map → chunk-MYI3RKI6.js.map} +0 -0
  285. /package/dist/{chunk-UCLMKNHA.js.map → chunk-N7V3P4V5.js.map} +0 -0
  286. /package/dist/{chunk-NA56NSKL.js.map → chunk-O52TB5SL.js.map} +0 -0
  287. /package/dist/{chunk-7KQB4EBS.js.map → chunk-OPPBTPUU.js.map} +0 -0
  288. /package/dist/{chunk-ERPBRXVZ.js.map → chunk-PHKU6BZ2.js.map} +0 -0
  289. /package/dist/{chunk-GTD4Q62X.js.map → chunk-PQHNZ63P.js.map} +0 -0
  290. /package/dist/{chunk-FHKXVTM5.js.map → chunk-Q5XKKDFQ.js.map} +0 -0
  291. /package/dist/{chunk-QRWMS6SI.js.map → chunk-Q6OL23WM.js.map} +0 -0
  292. /package/dist/{chunk-V3KIRICY.js.map → chunk-QQYHYW2N.js.map} +0 -0
  293. /package/dist/{chunk-YFCEBB5P.js.map → chunk-QTXNS3HB.js.map} +0 -0
  294. /package/dist/{chunk-2QSZNTDO.js.map → chunk-RKNJBZ55.js.map} +0 -0
  295. /package/dist/{chunk-E4KMY4KR.js.map → chunk-SNEUAZ6B.js.map} +0 -0
  296. /package/dist/{chunk-F6JYBVL6.js.map → chunk-SY5JUJ2X.js.map} +0 -0
  297. /package/dist/{chunk-PBRCYYO7.js.map → chunk-ULZFZL7K.js.map} +0 -0
  298. /package/dist/{chunk-IPLYGWQF.js.map → chunk-VDX2J7OX.js.map} +0 -0
  299. /package/dist/{chunk-UGHCZS6K.js.map → chunk-VFZQXYN5.js.map} +0 -0
  300. /package/dist/{chunk-NKB43PGI.js.map → chunk-VYMICVRA.js.map} +0 -0
  301. /package/dist/{chunk-2UM6WHME.js.map → chunk-XE2QCCT2.js.map} +0 -0
  302. /package/dist/{chunk-SYVGVK4S.js.map → chunk-XTMYB2HY.js.map} +0 -0
  303. /package/dist/{chunk-AYVCKGA6.js.map → chunk-YTXNDEUS.js.map} +0 -0
  304. /package/dist/{chunk-3Z5TGRFA.js.map → chunk-ZOAAY2OE.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/reconcile/manifest.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { computeLegacyContentHash, normalizeLegacyContent } from \"../content-hash.js\";\nimport { inferMemoryStatus } from \"../memory-lifecycle-ledger-utils.js\";\nimport { ContentHashIndex, type ContentHashPathEntry } from \"../storage/content-hash-index.js\";\nimport { DEFAULT_CITATION_FORMAT, stripCitationForTemplate } from \"../source-attribution.js\";\nimport { storedContentIdentityCandidates } from \"../structured-attributes.js\";\nimport type { MemoryFrontmatter, MemoryStatus } from \"../types.js\";\nimport { RECALL_FALLBACK_DIRS } from \"../utils/category-dir.js\";\nimport {\n type ReconcileFileState,\n type ReconcilePlan,\n type ReconcilePlanEntry,\n type ReconcileSemanticAgreement,\n type ReconcileSemanticChange,\n compareReconcilePlanEntries,\n semanticAgreementKey,\n summarizeReconcilePlan,\n} from \"./plan.js\";\n\nexport const RECONCILE_MANIFEST_FORMAT = \"remnic-reconcile-manifest\";\nexport const RECONCILE_MANIFEST_SCHEMA_VERSION = 1;\nconst CONTENT_HASH_NORMALIZER_VERSION = 4;\n/**\n * Version of the identity-resolution LOGIC (alias recovery, candidate\n * ordering), independent of the content normalizer: a cached manifest entry\n * written before an identity-resolution change carries an older value and is\n * reparsed even when its normalizerVersion still matches (issue #2367\n * review round 2). Bump when parsedMemoryIdentity's output shape or\n * semantics change.\n */\nconst IDENTITY_RESOLUTION_VERSION = 2;\n\nexport interface ReconcileMemoryIdentity {\n id: string;\n category: string;\n contentHash: string;\n /**\n * Recovered current-normalizer identities for a record whose persisted hash\n * is ambiguous under the legacy normalizer (issue #2367). The persisted\n * hash stays primary; these participate in duplicate bucketing so a\n * replica carrying the current form of the same fact still collapses.\n */\n contentHashAliases?: readonly string[];\n /** See IDENTITY_RESOLUTION_VERSION; absent on pre-versioning cache entries. */\n normalizerVersion?: number;\n identityResolutionVersion?: number;\n status: MemoryStatus;\n}\n\nexport interface ReconcileManifestFile extends ReconcileFileState {\n memory?: ReconcileMemoryIdentity;\n}\n\ntype ActiveFactManifestFile = ReconcileManifestFile & { memory: ReconcileMemoryIdentity };\n\nexport interface ReconcileManifest {\n format: typeof RECONCILE_MANIFEST_FORMAT;\n schemaVersion: typeof RECONCILE_MANIFEST_SCHEMA_VERSION;\n files: ReconcileManifestFile[];\n}\n\nexport type ReconcileMemoryParser = (\n raw: string,\n) => { frontmatter: MemoryFrontmatter; content: string } | null;\n\nexport interface BuildReconcileManifestOptions {\n files: Iterable<ReconcileFileState>;\n readFile: (file: ReconcileFileState) => Promise<Buffer | string | null>;\n parseMemory: ReconcileMemoryParser;\n cachedFiles?: Iterable<ReconcileManifestFile>;\n citationTemplate?: string;\n}\n\nconst SHA256_PATTERN = /^[a-f0-9]{64}$/i;\nconst MEMORY_DIRS = new Set(RECALL_FALLBACK_DIRS);\n\nfunction isMemoryPath(filePath: string): boolean {\n if (!filePath.endsWith(\".md\")) return false;\n const segments = filePath.split(\"/\");\n let index = 0;\n if (segments[index] === \"cold\" || segments[index] === \"archive\") index += 1;\n return MEMORY_DIRS.has(segments[index] ?? \"\");\n}\n\n\nfunction parsedMemoryIdentity(\n filePath: string,\n raw: Buffer | string,\n parseMemory: ReconcileMemoryParser,\n citationTemplate: string,\n): ReconcileMemoryIdentity | undefined {\n if (!isMemoryPath(filePath)) return undefined;\n const parsed = parseMemory(Buffer.isBuffer(raw) ? raw.toString(\"utf8\") : raw);\n if (!parsed?.frontmatter.id) return undefined;\n\n const storedHash =\n parsed.frontmatter.contentHash &&\n SHA256_PATTERN.test(parsed.frontmatter.contentHash)\n ? parsed.frontmatter.contentHash.toLowerCase()\n : undefined;\n const candidates = storedContentIdentityCandidates(parsed.content, (content) =>\n stripCitationForTemplate(content, citationTemplate)\n );\n const bodyHash = ContentHashIndex.computeHash(candidates[0] ?? \"\");\n const currentMatch = candidates.find(\n (content) => ContentHashIndex.computeHash(content) === storedHash\n );\n const legacyMatch = [...candidates].reverse().find(\n (content) => computeLegacyContentHash(content) === storedHash\n );\n let contentHash: string;\n let contentHashAliases: string[] | undefined;\n if (currentMatch) {\n contentHash = ContentHashIndex.computeHash(currentMatch);\n } else if (legacyMatch && normalizeLegacyContent(legacyMatch).length > 0) {\n // A non-empty legacy equality is ambiguous (issue #2367): the persisted\n // hash may be an explicit contentHashSource identity that merely collides\n // with the body's ASCII skeleton under the lossy legacy normalizer, and\n // nothing in the record proves which it is. Keep the persisted hash as\n // the primary identity and expose the recovered current identity as an\n // alias so replicas carrying either form still collapse.\n contentHash = storedHash ?? bodyHash;\n const recovered = ContentHashIndex.computeHash(legacyMatch);\n if (recovered !== contentHash) contentHashAliases = [recovered];\n } else {\n // An EMPTY legacy skeleton identifies nothing (every non-ASCII body maps\n // to it), so preserving it would collapse unrelated records. Recovering\n // the current identity here is repair, not replacement.\n contentHash = legacyMatch ? ContentHashIndex.computeHash(legacyMatch) : storedHash ?? bodyHash;\n }\n\n return {\n id: parsed.frontmatter.id,\n category: parsed.frontmatter.category,\n contentHash,\n ...(contentHashAliases ? { contentHashAliases } : {}),\n normalizerVersion: CONTENT_HASH_NORMALIZER_VERSION,\n identityResolutionVersion: IDENTITY_RESOLUTION_VERSION,\n status: inferMemoryStatus(parsed.frontmatter, filePath),\n };\n}\n\nexport async function buildReconcileManifestFile(\n file: ReconcileFileState,\n readFile: (file: ReconcileFileState) => Promise<Buffer | string | null>,\n parseMemory: ReconcileMemoryParser,\n citationTemplate = DEFAULT_CITATION_FORMAT,\n): Promise<ReconcileManifestFile> {\n let raw: Buffer | string | null = null;\n if (isMemoryPath(file.path)) {\n try {\n raw = await readFile(file);\n } catch {\n raw = null;\n }\n }\n if (raw !== null && createHash(\"sha256\").update(raw).digest(\"hex\") !== file.sha256.toLowerCase()) {\n raw = null;\n }\n const memory = raw === null ? undefined : parsedMemoryIdentity(file.path, raw, parseMemory, citationTemplate);\n return { ...file, ...(memory ? { memory } : {}) };\n}\n\nexport async function buildReconcileManifest(options: BuildReconcileManifestOptions): Promise<ReconcileManifest> {\n const cachedByPath = new Map<string, ReconcileManifestFile>();\n for (const cached of options.cachedFiles ?? []) {\n cachedByPath.set(cached.path, cached);\n }\n\n const files: ReconcileManifestFile[] = [];\n for (const file of options.files) {\n const cached = cachedByPath.get(file.path);\n if (\n cached?.sha256.toLowerCase() === file.sha256.toLowerCase() &&\n (cached.memory === undefined ||\n (cached.memory.normalizerVersion === CONTENT_HASH_NORMALIZER_VERSION &&\n cached.memory.identityResolutionVersion === IDENTITY_RESOLUTION_VERSION))\n ) {\n files.push({ ...file, ...(cached.memory ? { memory: cached.memory } : {}) });\n continue;\n }\n\n files.push(await buildReconcileManifestFile(\n file,\n options.readFile,\n options.parseMemory,\n options.citationTemplate,\n ));\n }\n files.sort((left, right) => (left.path < right.path ? -1 : left.path > right.path ? 1 : 0));\n return {\n format: RECONCILE_MANIFEST_FORMAT,\n schemaVersion: RECONCILE_MANIFEST_SCHEMA_VERSION,\n files,\n };\n}\n\nfunction activeFactByPath(manifest: ReconcileManifest | undefined): Map<string, ActiveFactManifestFile> {\n const result = new Map<string, ActiveFactManifestFile>();\n for (const file of manifest?.files ?? []) {\n if (file.memory?.category === \"fact\" && file.memory.status === \"active\") {\n result.set(file.path, file as ActiveFactManifestFile);\n }\n }\n return result;\n}\n\nfunction memoryIdentityHashes(memory: ReconcileMemoryIdentity): string[] {\n return [memory.contentHash, ...(memory.contentHashAliases ?? [])];\n}\n\nfunction contentHashRows(\n files: Iterable<ActiveFactManifestFile>,\n contentHash: string,\n): ContentHashPathEntry[] {\n const rows: ContentHashPathEntry[] = [];\n for (const file of files) {\n rows.push({ path: file.path, contentHash });\n }\n return rows;\n}\n\nfunction classifySemanticChange(\n current: ReconcileSemanticAgreement,\n prior: ReconcileSemanticAgreement | undefined\n): ReconcileSemanticChange {\n if (!prior) return \"unchanged\";\n const localChanged = current.local.sha256 !== prior.local.sha256;\n const peerChanged = current.peer.sha256 !== prior.peer.sha256;\n if (localChanged && peerChanged) return \"both_modified\";\n if (localChanged) return \"local_changed\";\n if (peerChanged) return \"peer_changed\";\n return \"unchanged\";\n}\n\nexport function collapseActiveFactDuplicates(\n plan: ReconcilePlan,\n localManifests: ReadonlyMap<string, ReconcileManifest>,\n peerManifests: ReadonlyMap<string, ReconcileManifest>,\n priorSemanticAgreements?: ReadonlyMap<string, readonly ReconcileSemanticAgreement[]>,\n): ReconcilePlan {\n const entriesByNamespace = new Map<string, ReconcilePlanEntry[]>();\n for (const entry of plan.entries) {\n const entries = entriesByNamespace.get(entry.namespace) ?? [];\n entries.push({ ...entry });\n entriesByNamespace.set(entry.namespace, entries);\n }\n\n let changed = false;\n for (const namespace of new Set([...localManifests.keys(), ...peerManifests.keys()])) {\n const entries = entriesByNamespace.get(namespace) ?? [];\n const localManifest = localManifests.get(namespace);\n const peerManifest = peerManifests.get(namespace);\n const localByPath = activeFactByPath(localManifest);\n const peerByPath = activeFactByPath(peerManifest);\n const localFilesByPath = new Map((localManifest?.files ?? []).map((file) => [file.path, file]));\n const peerFilesByPath = new Map((peerManifest?.files ?? []).map((file) => [file.path, file]));\n const priorSemanticByPathPair = new Map(\n (priorSemanticAgreements?.get(namespace) ?? []).map((agreement) => [\n semanticAgreementKey(agreement),\n agreement,\n ])\n );\n const localByHash = new Map<string, ActiveFactManifestFile[]>();\n const peerByHash = new Map<string, ActiveFactManifestFile[]>();\n\n for (const file of localByPath.values()) {\n for (const hash of memoryIdentityHashes(file.memory)) {\n const bucket = localByHash.get(hash) ?? [];\n bucket.push(file);\n localByHash.set(hash, bucket);\n }\n }\n for (const file of peerByPath.values()) {\n for (const hash of memoryIdentityHashes(file.memory)) {\n const bucket = peerByHash.get(hash) ?? [];\n bucket.push(file);\n peerByHash.set(hash, bucket);\n }\n }\n\n const removed = new Set<ReconcilePlanEntry>();\n const replacements: ReconcilePlanEntry[] = [];\n const processedPathPairs = new Set<string>();\n for (const hash of new Set([...localByHash.keys(), ...peerByHash.keys()])) {\n const localCandidates = (localByHash.get(hash) ?? []).filter((file) => {\n const opposite = peerFilesByPath.get(file.path);\n const activeOpposite = peerByPath.get(file.path);\n return opposite === undefined || (\n activeOpposite !== undefined &&\n memoryIdentityHashes(activeOpposite.memory).includes(hash)\n );\n });\n const peerCandidates = (peerByHash.get(hash) ?? []).filter((file) => {\n const opposite = localFilesByPath.get(file.path);\n const activeOpposite = localByPath.get(file.path);\n return opposite === undefined || (\n activeOpposite !== undefined &&\n memoryIdentityHashes(activeOpposite.memory).includes(hash)\n );\n });\n const localPath = ContentHashIndex.resolvePathByHash(hash, contentHashRows(localCandidates, hash));\n const peerPath = ContentHashIndex.resolvePathByHash(hash, contentHashRows(peerCandidates, hash));\n\n if (localPath && peerPath && localPath !== peerPath) {\n const pathPair = `${localPath}\\0${peerPath}`;\n if (processedPathPairs.has(pathPair)) continue;\n processedPathPairs.add(pathPair);\n const localFile = localByPath.get(localPath);\n const peerFile = peerByPath.get(peerPath);\n if (!localFile || !peerFile) continue;\n const duplicatePaths = new Set([\n ...localCandidates.map((file) => file.path),\n ...peerCandidates.map((file) => file.path),\n ]);\n const authoritativeSamePathEntries = new Set(entries.filter(\n (entry) =>\n duplicatePaths.has(entry.path)\n && localFilesByPath.has(entry.path)\n && peerFilesByPath.has(entry.path)\n && entry.action !== \"identical\"\n ));\n if (authoritativeSamePathEntries.size > 0) {\n for (const entry of entries) {\n if (\n duplicatePaths.has(entry.path)\n && !authoritativeSamePathEntries.has(entry)\n && (entry.action === \"pull\" || entry.action === \"push\" || entry.action === \"identical\")\n ) {\n removed.add(entry);\n changed = true;\n }\n }\n continue;\n }\n const unsafeEntry = entries.some(\n (entry) => duplicatePaths.has(entry.path) && (entry.action === \"suppress\" || entry.action === \"conflict\")\n );\n if (unsafeEntry) continue;\n for (const entry of entries) {\n if (\n duplicatePaths.has(entry.path) &&\n (entry.action === \"pull\" || entry.action === \"push\" || entry.action === \"identical\")\n ) {\n removed.add(entry);\n }\n }\n const semanticAgreement: ReconcileSemanticAgreement = {\n local: { path: localPath, sha256: localFile.sha256 },\n peer: { path: peerPath, sha256: peerFile.sha256 },\n };\n replacements.push({\n path: localPath < peerPath ? localPath : peerPath,\n namespace,\n action: \"identical\",\n reason: \"semantic_duplicate\",\n semanticAgreement,\n semanticChange: classifySemanticChange(\n semanticAgreement,\n priorSemanticByPathPair.get(semanticAgreementKey(semanticAgreement))\n ),\n });\n changed = true;\n continue;\n }\n\n const sameSideEntries = entries.filter((entry) => {\n if (localPath && entry.reason === \"local_only\") {\n return localCandidates.some((file) => file.path === entry.path);\n }\n if (peerPath && entry.reason === \"peer_only\") {\n return peerCandidates.some((file) => file.path === entry.path);\n }\n return false;\n });\n const canonicalPath = localPath ?? peerPath;\n const hasSharedCanonical = localPath !== undefined && localPath === peerPath;\n if (!canonicalPath || sameSideEntries.length === 0 || (!hasSharedCanonical && sameSideEntries.length < 2)) {\n continue;\n }\n for (const entry of sameSideEntries) {\n if (entry.path !== canonicalPath) {\n removed.add(entry);\n changed = true;\n }\n }\n }\n\n if (removed.size > 0 || replacements.length > 0) {\n entriesByNamespace.set(\n namespace,\n [...entries.filter((entry) => !removed.has(entry)), ...replacements].sort(compareReconcilePlanEntries)\n );\n }\n }\n\n if (!changed) return plan;\n const entries = [...entriesByNamespace.values()].flat().sort(compareReconcilePlanEntries);\n return {\n entries,\n byNamespace: summarizeReconcilePlan(entries),\n converged: entries.every((entry) => entry.action === \"identical\"),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAmBpB,IAAM,4BAA4B;AAClC,IAAM,oCAAoC;AACjD,IAAM,kCAAkC;AASxC,IAAM,8BAA8B;AA2CpC,IAAM,iBAAiB;AACvB,IAAM,cAAc,IAAI,IAAI,oBAAoB;AAEhD,SAAS,aAAa,UAA2B;AAC/C,MAAI,CAAC,SAAS,SAAS,KAAK,EAAG,Q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aAAa,MAAM,WAAW,cAAc;AAC9C,iBAAO,gBAAgB,KAAK,CAAC,SAAS,KAAK,SAAS,MAAM,IAAI;AAAA,QAChE;AACA,YAAI,YAAY,MAAM,WAAW,aAAa;AAC5C,iBAAO,eAAe,KAAK,CAAC,SAAS,KAAK,SAAS,MAAM,IAAI;AAAA,QAC/D;AACA,eAAO;AAAA,MACT,CAAC;AACD,YAAM,gBAAgB,aAAa;AACnC,YAAM,qBAAqB,cAAc,UAAa,cAAc;AACpE,UAAI,CAAC,iBAAiB,gBAAgB,WAAW,KAAM,CAAC,sBAAsB,gBAAgB,SAAS,GAAI;AACzG;AAAA,MACF;AACA,iBAAW,SAAS,iBAAiB;AACnC,YAAI,MAAM,SAAS,eAAe;AAChC,kBAAQ,IAAI,KAAK;AACjB,oBAAU;AAAA,QACZ;AAAA,MACF;AAAA,IACF;AAEA,QAAI,QAAQ,OAAO,KAAK,aAAa,SAAS,GAAG;AAC/C,yBAAmB;AAAA,QACjB;AAAA,QACA,CAAC,GAAGA,SAAQ,OAAO,CAAC,UAAU,CAAC,QAAQ,IAAI,KAAK,CAAC,GAAG,GAAG,YAAY,EAAE,KAAK,2BAA2B;AAAA,MACvG;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,QAAS,QAAO;AACrB,QAAM,UAAU,CAAC,GAAG,mBAAmB,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,2BAA2B;AACxF,SAAO;AAAA,IACL;AAAA,IACA,aAAa,uBAAuB,OAAO;AAAA,IAC3C,WAAW,QAAQ,MAAM,CAAC,UAAU,MAAM,WAAW,WAAW;AAAA,EAClE;AACF;","names":["entries"]}
@@ -38,13 +38,7 @@ import {
38
38
  extractionCueAnchors,
39
39
  extractionText,
40
40
  isPlainRecord
41
- } from "./chunk-6YMEU6OQ.js";
42
- import {
43
- CUE_ANCHOR_PROMPT_INSTRUCTION,
44
- EXTRACTION_RESPONSE_SHAPE,
45
- buildExtractionInstructions,
46
- eventTimePromptInstruction
47
- } from "./chunk-R7TZ2HCS.js";
41
+ } from "./chunk-G72IPMR7.js";
48
42
  import {
49
43
  buildExtensionsFooterForSummary,
50
44
  formatDaySummaryMemories,
@@ -53,6 +47,17 @@ import {
53
47
  import {
54
48
  delinearize
55
49
  } from "./chunk-VEWZZM3H.js";
50
+ import {
51
+ CONSOLIDATION_RESPONSE_SCHEMA,
52
+ CUE_ANCHOR_PROMPT_INSTRUCTION,
53
+ EXTRACTION_RESPONSE_SHAPE,
54
+ OUTPUT_LANGUAGE_POLICY,
55
+ PROFILE_CONSOLIDATION_RESPONSE_SCHEMA,
56
+ buildConsolidationSystemPrompt,
57
+ buildExtractionInstructions,
58
+ buildProfileConsolidationSystemPrompt,
59
+ eventTimePromptInstruction
60
+ } from "./chunk-JG22O53B.js";
56
61
  import {
57
62
  AMBIENT_CAPTURE_PROMPT_SECTION_COMPACT,
58
63
  clampAmbientCaptureConfidence
@@ -175,19 +180,6 @@ async function revalidateDependentsViaLlm(deps, superseded, replacement, depende
175
180
 
176
181
  // src/extraction.ts
177
182
  var PROACTIVE_MIN_CONFIDENCE = 0.8;
178
- var CONSOLIDATION_RESPONSE_SCHEMA = `{
179
- "items": [
180
- {
181
- "existingId": "id",
182
- "action": "ADD",
183
- "mergeWith": "optional-existing-id",
184
- "updatedContent": "optional replacement content",
185
- "reason": "brief reason for this action"
186
- }
187
- ],
188
- "profileUpdates": ["optional profile update"],
189
- "entityUpdates": [{"name": "person-jane-doe", "type": "person", "facts": ["Now leads the backend team", "Recently migrated the user service to TypeScript"]}]
190
- }`;
191
183
  function extractionEntityType(value) {
192
184
  const type = extractionText(value);
193
185
  if (type === "person" || type === "project" || type === "tool" || type === "company" || type === "place" || type === "other") {
@@ -570,6 +562,7 @@ var ExtractionEngine = class {
570
562
  const prompt = [
571
563
  "You are doing a proactive second-pass memory extraction.",
572
564
  `Generate up to ${maxAdditional} additional high-value follow-up questions not already covered.${ambientCapture ? AMBIENT_CAPTURE_PROMPT_SECTION_COMPACT : ""}`,
565
+ OUTPUT_LANGUAGE_POLICY,
573
566
  "Return only valid JSON with this shape:",
574
567
  '{"questions":[{"question":"...","context":"...","priority":0.0}]}',
575
568
  "",
@@ -648,6 +641,7 @@ var ExtractionEngine = class {
648
641
  "You are answering proactive memory follow-up questions using only the provided buffered conversation.",
649
642
  `Return at most ${maxAdditional} additional high-confidence memory candidates that were omitted from the base extraction.`,
650
643
  `Only include information directly supported by the conversation. Do not speculate. Do not repeat the base extraction.${ambientCapture ? AMBIENT_CAPTURE_PROMPT_SECTION_COMPACT : ""}`,
644
+ OUTPUT_LANGUAGE_POLICY,
651
645
  "Return only valid JSON with this shape:",
652
646
  '{"facts":[{"category":"fact","content":"...","confidence":0.0,"tags":["..."],"entityRef":"optional","promptedByQuestion":"optional","quote":"optional verbatim span from a single turn"}],"profileUpdates":["..."],"entities":[{"name":"...","type":"person","facts":["..."],"structuredSections":[{"key":"beliefs","title":"Beliefs","facts":["..."]}],"promptedByQuestion":"optional"}],"relationships":[{"source":"...","target":"...","label":"...","promptedByQuestion":"optional"}]}',
653
647
  this.config.provenance?.enabled ? '- Source quotes: For each fact, include a "quote" field with the EXACT verbatim words from the conversation that support the fact (a contiguous span from a single turn, not a paraphrase). Cap at ~300 chars.' : "",
@@ -1187,9 +1181,10 @@ Rules:
1187
1181
  - Lines labelled [context user] or [context assistant] are reference context only. They may resolve references or complete a question-and-answer pair in a normal turn, but never alone establish durable information.
1188
1182
  - Questions are optional. Return an empty array when the conversation does not support a useful unresolved question.
1189
1183
  - Set confidence from source evidence: Explicit (0.95-1.0), Implied (0.70-0.94), Inferred (0.40-0.69), or Speculative (0.00-0.39). Corrections get highest confidence.
1190
- - Use normalized, hyphenated entity names and keep the entity list short.
1184
+ - Use normalized, hyphenated entity names and keep the entity list short. When the source language is not written in a Latin script, the source-script name IS the normalized form \u2014 never transliterate or translate it.
1191
1185
  - Keep facts standalone. Skip transient task state and operational noise such as routine scheduler, monitoring, or automation status.
1192
1186
  - Add structuredAttributes only for concrete values.
1187
+ - ${OUTPUT_LANGUAGE_POLICY}
1193
1188
  ${CUE_ANCHOR_PROMPT_INSTRUCTION}
1194
1189
  - Include at most five durable relationships.${this.config.provenance?.enabled ? `
1195
1190
  - Each fact must include a quote copied verbatim from one contiguous conversation span.` : ""}${lifecycleCaps.extractionScopeClassification ? `
@@ -1367,19 +1362,7 @@ ${EXTRACTION_RESPONSE_SHAPE}`
1367
1362
  [
1368
1363
  {
1369
1364
  role: "system",
1370
- content: `You are a memory consolidation system. Compare new memories against existing ones and decide what to do with each.
1371
-
1372
- Actions:
1373
- - ADD: Keep the new memory as-is (no duplicate exists)
1374
- - MERGE: Combine with an existing memory (provide mergeWith ID and updated content)
1375
- - UPDATE: Replace existing memory content (provide updated content)
1376
- - INVALIDATE: Remove existing memory (it's been superseded or is wrong)
1377
- - SKIP: This new memory is redundant (exact duplicate or subset of existing)
1378
-
1379
- Also:
1380
- - Suggest profile updates based on patterns across memories
1381
- - Identify entity updates for entity tracking${resolveRecallAuxiliaryCapabilities(this.config).causalRuleExtraction ? `
1382
- - When merging or updating memories, look for IF\u2192THEN causal patterns. If a memory describes "X failed/succeeded because Y" or "doing X led to Y", rewrite its content to make the causal rule explicit in the form "IF <condition> THEN <action/outcome>".` : ""}`
1365
+ content: buildConsolidationSystemPrompt(this.config)
1383
1366
  },
1384
1367
  {
1385
1368
  role: "user",
@@ -1410,19 +1393,7 @@ Consolidate the new memories against existing ones.`
1410
1393
  return { items: [], profileUpdates: [], entityUpdates: [] };
1411
1394
  }
1412
1395
  try {
1413
- const instructionText = `You are a memory consolidation system. Compare new memories against existing ones and decide what to do with each.
1414
-
1415
- Actions:
1416
- - ADD: Keep the new memory as-is (no duplicate exists)
1417
- - MERGE: Combine with an existing memory (provide mergeWith ID and updated content)
1418
- - UPDATE: Replace existing memory content (provide updated content)
1419
- - INVALIDATE: Remove existing memory (it's been superseded or is wrong)
1420
- - SKIP: This new memory is redundant (exact duplicate or subset of existing)
1421
-
1422
- Also:
1423
- - Suggest profile updates based on patterns across memories
1424
- - Identify entity updates for entity tracking${resolveRecallAuxiliaryCapabilities(this.config).causalRuleExtraction ? `
1425
- - When merging or updating memories, look for IF\u2192THEN causal patterns. If a memory describes "X failed/succeeded because Y" or "doing X led to Y", rewrite its content to make the causal rule explicit in the form "IF <condition> THEN <action/outcome>".` : ""}
1396
+ const instructionText = `${buildConsolidationSystemPrompt(this.config)}
1426
1397
 
1427
1398
  Current behavioral profile:
1428
1399
  ${currentProfile || "(empty)"}
@@ -1502,19 +1473,7 @@ ${CONSOLIDATION_RESPONSE_SCHEMA}`;
1502
1473
  this.config.localLlmMaxContext
1503
1474
  );
1504
1475
  log.debug(`Consolidation model context: ${contextSizes.description}`);
1505
- const prompt = `You are a memory consolidation system. Compare new memories against existing ones and decide what to do with each.
1506
-
1507
- Actions:
1508
- - ADD: Keep the new memory as-is (no duplicate exists)
1509
- - MERGE: Combine with an existing memory (provide mergeWith ID and updated content)
1510
- - UPDATE: Replace existing memory content (provide updated content)
1511
- - INVALIDATE: Remove existing memory (it's been superseded or is wrong)
1512
- - SKIP: This new memory is redundant (exact duplicate or subset of existing)
1513
-
1514
- Also:
1515
- - Suggest profile updates based on patterns across memories
1516
- - Identify entity updates for entity tracking${resolveRecallAuxiliaryCapabilities(this.config).causalRuleExtraction ? `
1517
- - When merging or updating memories, look for IF\u2192THEN causal patterns. If a memory describes "X failed/succeeded because Y" or "doing X led to Y", rewrite its content to make the causal rule explicit in the form "IF <condition> THEN <action/outcome>".` : ""}
1476
+ const prompt = `${buildConsolidationSystemPrompt(this.config)}
1518
1477
 
1519
1478
  Current behavioral profile:
1520
1479
  ${currentProfile || "(empty)"}
@@ -1600,17 +1559,7 @@ ${CONSOLIDATION_RESPONSE_SCHEMA}`;
1600
1559
  [
1601
1560
  {
1602
1561
  role: "system",
1603
- content: `You are a profile consolidation system. You are given a behavioral profile (markdown) that has grown too large. Your job is to produce a CONSOLIDATED version that:
1604
-
1605
- 1. PRESERVES all ## section headers and their structure
1606
- 2. MERGES duplicate or near-duplicate bullet points into single, clear statements
1607
- 3. REMOVES stale information that has been superseded by newer bullets
1608
- 4. REMOVES trivial or overly specific operational details that won't be useful across sessions
1609
- 5. KEEPS the most important, durable observations about the user's preferences, habits, identity, and working style
1610
- 6. Target roughly ${targetLines} lines \u2014 this is a soft target, prioritize quality over length
1611
- 7. Write in the same style as the existing profile \u2014 concise bullets, no fluff
1612
-
1613
- The output should be the COMPLETE consolidated profile as valid markdown, starting with "# Behavioral Profile".`
1562
+ content: buildProfileConsolidationSystemPrompt(targetLines)
1614
1563
  },
1615
1564
  { role: "user", content: fullProfileContent }
1616
1565
  ],
@@ -1627,24 +1576,10 @@ The output should be the COMPLETE consolidated profile as valid markdown, starti
1627
1576
  return null;
1628
1577
  }
1629
1578
  try {
1630
- const instructionText = `You are a profile consolidation system. You are given a behavioral profile (markdown) that has grown too large. Your job is to produce a CONSOLIDATED version that:
1631
-
1632
- 1. PRESERVES all ## section headers and their structure
1633
- 2. MERGES duplicate or near-duplicate bullet points into single, clear statements
1634
- 3. REMOVES stale information that has been superseded by newer bullets
1635
- 4. REMOVES trivial or overly specific operational details that won't be useful across sessions
1636
- 5. KEEPS the most important, durable observations about the user's preferences, habits, identity, and working style
1637
- 6. Target roughly ${targetLines} lines \u2014 this is a soft target, prioritize quality over length
1638
- 7. Write in the same style as the existing profile \u2014 concise bullets, no fluff
1639
-
1640
- The output should be the COMPLETE consolidated profile as valid markdown, starting with "# Behavioral Profile".
1579
+ const instructionText = `${buildProfileConsolidationSystemPrompt(targetLines)}
1641
1580
 
1642
1581
  Respond with valid JSON matching this schema:
1643
- {
1644
- "consolidatedProfile": "# Behavioral Profile\\n\\n... (complete markdown)",
1645
- "removedCount": 42,
1646
- "summary": "brief summary of what was consolidated"
1647
- }`;
1582
+ ${PROFILE_CONSOLIDATION_RESPONSE_SCHEMA}`;
1648
1583
  const response = await this.client.chat.completions.create({
1649
1584
  model: this.config.model,
1650
1585
  messages: [
@@ -1712,25 +1647,13 @@ Respond with valid JSON matching this schema:
1712
1647
  this.config.localLlmMaxContext
1713
1648
  );
1714
1649
  log.debug(`Profile consolidation model context: ${contextSizes.description}`);
1715
- const prompt = `You are a profile consolidation system. You are given a behavioral profile (markdown) that has grown too large. Your job is to produce a CONSOLIDATED version that:
1716
-
1717
- 1. PRESERVES all ## section headers and their structure
1718
- 2. MERGES duplicate or near-duplicate bullet points into single, clear statements
1719
- 3. REMOVES stale information that has been superseded by newer bullets
1720
- 4. REMOVES trivial or overly specific operational details that won't be useful across sessions
1721
- 5. KEEPS the most important, durable observations about the user's preferences, habits, identity, and working style
1722
- 6. Target roughly ${targetLines} lines \u2014 this is a soft target, prioritize quality over length
1723
- 7. Write in the same style as the existing profile \u2014 concise bullets, no fluff
1650
+ const prompt = `${buildProfileConsolidationSystemPrompt(targetLines)}
1724
1651
 
1725
1652
  Profile to consolidate:
1726
1653
  ${fullProfileContent}
1727
1654
 
1728
1655
  Respond with valid JSON matching this schema:
1729
- {
1730
- "consolidatedProfile": "# Behavioral Profile\\n\\n... (complete markdown)",
1731
- "removedCount": 42,
1732
- "summary": "brief summary of what was consolidated"
1733
- }`;
1656
+ ${PROFILE_CONSOLIDATION_RESPONSE_SCHEMA}`;
1734
1657
  const response = await this.localLlm.chatCompletion(
1735
1658
  [
1736
1659
  { role: "system", content: "You are a profile consolidation system. Output valid JSON only." },
@@ -2442,4 +2365,4 @@ export {
2442
2365
  shouldEnableLocalExtractionThinking,
2443
2366
  ExtractionEngine
2444
2367
  };
2445
- //# sourceMappingURL=chunk-YXMHUBN2.js.map
2368
+ //# sourceMappingURL=chunk-TOP3FSDW.js.map