@remnic/core 9.66.1 → 9.66.3

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 (606) hide show
  1. package/dist/access-admin-ops-surface.js +30 -30
  2. package/dist/access-authorization-probe.js +31 -31
  3. package/dist/access-boundary.js +30 -30
  4. package/dist/access-cli.js +96 -94
  5. package/dist/access-cli.js.map +1 -1
  6. package/dist/access-extraction-force-flush.js +30 -30
  7. package/dist/access-http-query.js +32 -32
  8. package/dist/access-http.js +45 -45
  9. package/dist/access-identity-continuity-surface.js +30 -30
  10. package/dist/access-lcm-surface.js +30 -30
  11. package/dist/access-mcp.js +38 -38
  12. package/dist/access-namespace-preflight.js +30 -30
  13. package/dist/access-observe-write-surface.js +30 -30
  14. package/dist/access-operations-batch.js +33 -33
  15. package/dist/access-operations.js +37 -37
  16. package/dist/access-recall-concurrency.js +30 -30
  17. package/dist/access-recall-response.js +30 -30
  18. package/dist/access-recall-surface.js +30 -30
  19. package/dist/access-schema.js +3 -3
  20. package/dist/access-service.js +30 -30
  21. package/dist/access-surface-catalog.js +32 -32
  22. package/dist/active-recall.js +3 -3
  23. package/dist/briefing.js +13 -13
  24. package/dist/buffer.js +4 -4
  25. package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
  26. package/dist/causal-behavior.js +2 -2
  27. package/dist/causal-chain.js +2 -2
  28. package/dist/causal-consolidation.js +16 -16
  29. package/dist/causal-retrieval.js +2 -2
  30. package/dist/causal-trajectory-graph.js +2 -2
  31. package/dist/causal-trajectory.js +1 -1
  32. package/dist/{chunk-XKNHFDTT.js → chunk-3A2Z4OOS.js} +2 -2
  33. package/dist/{chunk-CHGG74CY.js → chunk-3HHTN5X7.js} +2 -2
  34. package/dist/{chunk-TCF4MU7L.js → chunk-3PO35HUU.js} +1218 -104
  35. package/dist/chunk-3PO35HUU.js.map +1 -0
  36. package/dist/{chunk-XOHYGIWF.js → chunk-3Z4SFJA5.js} +2 -2
  37. package/dist/{chunk-RDGKVH6T.js → chunk-4NKIGSJM.js} +2 -2
  38. package/dist/{chunk-GPFZFCRN.js → chunk-4PTTMTTQ.js} +1 -1
  39. package/dist/{chunk-VG4SSPAW.js → chunk-4XESAT4V.js} +2 -2
  40. package/dist/{chunk-S4CDUXQY.js → chunk-5KGLNBUB.js} +2 -2
  41. package/dist/{chunk-2X6BGKQL.js → chunk-5XRZANCW.js} +10 -10
  42. package/dist/{chunk-TCQRIIIN.js → chunk-6DODJYBY.js} +2 -2
  43. package/dist/{chunk-KWIGDKM2.js → chunk-73CAEYI3.js} +2 -2
  44. package/dist/{chunk-J2R275FN.js → chunk-7DXW5V2W.js} +2 -2
  45. package/dist/{chunk-LYUUA6QB.js → chunk-7JJHIVMG.js} +2 -2
  46. package/dist/{chunk-2FA7U5XY.js → chunk-7NNMRMLZ.js} +2 -2
  47. package/dist/{chunk-227UFSEQ.js → chunk-7RZJWZ46.js} +5 -5
  48. package/dist/{chunk-EWKVYCFP.js → chunk-B2OKCCXX.js} +1 -1
  49. package/dist/{chunk-NSTNGMSS.js → chunk-B7AGLMGP.js} +7 -7
  50. package/dist/chunk-BLUYQFRH.js +36 -0
  51. package/dist/chunk-BLUYQFRH.js.map +1 -0
  52. package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
  53. package/dist/{chunk-CEH2AFXG.js → chunk-C24UZSFW.js} +6 -6
  54. package/dist/{chunk-LTBKKSCX.js → chunk-C2JCVZWX.js} +2 -2
  55. package/dist/{chunk-65JOGLIS.js → chunk-D4R3OUZA.js} +2 -2
  56. package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
  57. package/dist/chunk-E4X2YX2F.js +22 -0
  58. package/dist/chunk-E4X2YX2F.js.map +1 -0
  59. package/dist/{chunk-IGZCAHFL.js → chunk-EGGNFLAT.js} +2 -2
  60. package/dist/{chunk-H2IRSXZN.js → chunk-ESDOAP7W.js} +3 -3
  61. package/dist/{chunk-D3UXGE5D.js → chunk-EZWIEFYD.js} +8 -8
  62. package/dist/{chunk-ZPS724LT.js → chunk-F5H5QINZ.js} +2 -2
  63. package/dist/{chunk-S4Z2OBTX.js → chunk-FPSOXMLK.js} +3 -3
  64. package/dist/chunk-FYDW33ZB.js +13 -0
  65. package/dist/chunk-FYDW33ZB.js.map +1 -0
  66. package/dist/{chunk-CX4OLNIH.js → chunk-G5UKF2GJ.js} +2 -2
  67. package/dist/{chunk-OJUEUQDJ.js → chunk-GGY2747C.js} +2 -2
  68. package/dist/{chunk-TNGH4ZYI.js → chunk-GNWLTCKC.js} +2 -2
  69. package/dist/{chunk-YWPLOJ7T.js → chunk-GZPGI45F.js} +2 -2
  70. package/dist/{chunk-NFP4KPTA.js → chunk-IDEPEHUG.js} +2 -2
  71. package/dist/{chunk-LJABGXC4.js → chunk-IN5EUWCA.js} +3 -3
  72. package/dist/{chunk-U6NGKS32.js → chunk-JJAOVJ3E.js} +9 -9
  73. package/dist/{chunk-RPIS5FQ7.js → chunk-JWCS3VYQ.js} +50 -50
  74. package/dist/{chunk-U65VJSCJ.js → chunk-KE23ZIEW.js} +13 -13
  75. package/dist/{chunk-NACLNNFQ.js → chunk-KSZKQTZS.js} +2 -2
  76. package/dist/{chunk-KJXCD7VR.js → chunk-KWJNEWTM.js} +5 -5
  77. package/dist/chunk-MAG6M3B6.js +51 -0
  78. package/dist/chunk-MAG6M3B6.js.map +1 -0
  79. package/dist/chunk-MKD3OMPS.js +20 -0
  80. package/dist/chunk-MKD3OMPS.js.map +1 -0
  81. package/dist/{chunk-UW4RYPWC.js → chunk-MLTGALDY.js} +2 -2
  82. package/dist/{chunk-MUEGIKKY.js → chunk-OKGQDI4Y.js} +17 -16
  83. package/dist/chunk-OKGQDI4Y.js.map +1 -0
  84. package/dist/{chunk-YMOPYG3K.js → chunk-OLT3YTDH.js} +4 -4
  85. package/dist/{chunk-2PSX5BJU.js → chunk-OPQKVVYG.js} +2 -2
  86. package/dist/{chunk-D6Q5EPOV.js → chunk-PGD3DXZP.js} +2 -2
  87. package/dist/chunk-Q3SHEAXR.js +80 -0
  88. package/dist/chunk-Q3SHEAXR.js.map +1 -0
  89. package/dist/{chunk-GBEOUCBB.js → chunk-Q6LC3ZD5.js} +2 -2
  90. package/dist/{chunk-QBNE55VA.js → chunk-QELYSDAU.js} +2 -2
  91. package/dist/{chunk-INUBU6I5.js → chunk-S6PRJGQL.js} +2 -2
  92. package/dist/{chunk-B4AOWRYF.js → chunk-TCJO7LOG.js} +5 -5
  93. package/dist/{chunk-SZMYGDSM.js → chunk-TO5U47YK.js} +2 -2
  94. package/dist/{chunk-GAJK3DQ5.js → chunk-U3L6GRUX.js} +2 -2
  95. package/dist/{chunk-4XLTUR6R.js → chunk-U4RGSLI4.js} +3 -3
  96. package/dist/{chunk-M5ERTI4I.js → chunk-UH53XVQ3.js} +2 -2
  97. package/dist/{chunk-NUF7VSEX.js → chunk-UXERIBOJ.js} +2 -2
  98. package/dist/{chunk-FFUMTH27.js → chunk-VA2CSIPC.js} +2 -2
  99. package/dist/{chunk-KQAFEZQX.js → chunk-VDX2J7OX.js} +2 -2
  100. package/dist/{chunk-AF5H7TKI.js → chunk-VPJNGE2R.js} +2 -2
  101. package/dist/{chunk-OMX6TKXH.js → chunk-VTJZSLDR.js} +2 -2
  102. package/dist/{chunk-TBCDF556.js → chunk-WHFFAS4A.js} +4 -4
  103. package/dist/{chunk-7UOXCCCI.js → chunk-WVNETF4Q.js} +2 -2
  104. package/dist/{chunk-EH65UV2Z.js → chunk-XSTMPZMY.js} +2 -2
  105. package/dist/{chunk-PD66CVSD.js → chunk-Z3SQEEB6.js} +2 -2
  106. package/dist/{chunk-JKTV3JNX.js → chunk-ZBYOXIIF.js} +3 -3
  107. package/dist/{chunk-2ITZ74A6.js → chunk-ZC5IHL5X.js} +11 -11
  108. package/dist/{chunk-KI64TTBL.js → chunk-ZDMTCO7N.js} +2 -2
  109. package/dist/{chunk-C5IUOBCN.js → chunk-ZET6A3OF.js} +2 -2
  110. package/dist/{chunk-ZZZWEDF4.js → chunk-ZVAKRZZD.js} +2 -2
  111. package/dist/cli.js +67 -67
  112. package/dist/coding/export-okf-codegraph.js +13 -13
  113. package/dist/coding/pre-action-gate.js +2 -2
  114. package/dist/compounding/engine.js +13 -13
  115. package/dist/config.js +3 -3
  116. package/dist/connectors/codex-materialize-runner.js +13 -13
  117. package/dist/connectors/index.js +13 -13
  118. package/dist/convergence-refresh.js +15 -15
  119. package/dist/conversation-index/backend.js +2 -2
  120. package/dist/corpus-watermark.js +15 -15
  121. package/dist/entity-retrieval.js +13 -13
  122. package/dist/external-wiki-access.js +31 -31
  123. package/dist/extraction-span-bench.d.ts +14 -0
  124. package/dist/extraction-span-bench.js +17 -0
  125. package/dist/extraction-span-bench.js.map +1 -0
  126. package/dist/extraction-span-clip.d.ts +22 -0
  127. package/dist/extraction-span-clip.js +19 -0
  128. package/dist/extraction-span-clip.js.map +1 -0
  129. package/dist/extraction-span-contains.d.ts +12 -0
  130. package/dist/extraction-span-contains.js +17 -0
  131. package/dist/extraction-span-contains.js.map +1 -0
  132. package/dist/extraction-span-join.d.ts +23 -0
  133. package/dist/extraction-span-join.js +19 -0
  134. package/dist/extraction-span-join.js.map +1 -0
  135. package/dist/extraction-span-length.d.ts +11 -0
  136. package/dist/extraction-span-length.js +17 -0
  137. package/dist/extraction-span-length.js.map +1 -0
  138. package/dist/extraction-span-overlap.d.ts +14 -0
  139. package/dist/extraction-span-overlap.js +16 -0
  140. package/dist/extraction-span-overlap.js.map +1 -0
  141. package/dist/extraction-span-shift.d.ts +15 -0
  142. package/dist/extraction-span-shift.js +17 -0
  143. package/dist/extraction-span-shift.js.map +1 -0
  144. package/dist/extraction-span-slice.d.ts +12 -0
  145. package/dist/extraction-span-slice.js +17 -0
  146. package/dist/extraction-span-slice.js.map +1 -0
  147. package/dist/extraction-span-validate.d.ts +20 -0
  148. package/dist/extraction-span-validate.js +20 -0
  149. package/dist/extraction-span-validate.js.map +1 -0
  150. package/dist/extraction-span-wire.d.ts +17 -0
  151. package/dist/extraction-span-wire.js +13 -0
  152. package/dist/extraction-span-wire.js.map +1 -0
  153. package/dist/extraction-span.d.ts +17 -0
  154. package/dist/extraction-span.js +8 -0
  155. package/dist/extraction.js +16 -16
  156. package/dist/{graph-edge-decay-A4SDFMMS.js → graph-edge-decay-DGTBFALQ.js} +4 -4
  157. package/dist/graph-edge-decay-DGTBFALQ.js.map +1 -0
  158. package/dist/graph-snapshot.js +3 -3
  159. package/dist/graph.js +2 -2
  160. package/dist/harmonic-retrieval.js +1 -1
  161. package/dist/index.d.ts +387 -1
  162. package/dist/index.js +203 -122
  163. package/dist/lcm/engine.js +3 -3
  164. package/dist/lcm/index.js +9 -9
  165. package/dist/location/index.js +15 -15
  166. package/dist/maintenance/memory-governance.js +13 -13
  167. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +13 -13
  168. package/dist/maintenance/rebuild-memory-projection.js +14 -14
  169. package/dist/namespaces/migrate.js +14 -14
  170. package/dist/namespaces/search.js +9 -9
  171. package/dist/namespaces/storage.js +13 -13
  172. package/dist/operator-doctor-corpus.js +16 -16
  173. package/dist/operator-toolkit.js +26 -26
  174. package/dist/orchestration/maintenance.js +21 -21
  175. package/dist/orchestrator.js +98 -96
  176. package/dist/qmd.js +4 -4
  177. package/dist/recall-deep-access.d.ts +30 -0
  178. package/dist/recall-deep-access.js +50 -0
  179. package/dist/recall-deep-access.js.map +1 -0
  180. package/dist/recall-deep-budget-left.d.ts +8 -0
  181. package/dist/recall-deep-budget-left.js +15 -0
  182. package/dist/recall-deep-budget-left.js.map +1 -0
  183. package/dist/recall-deep-budget.d.ts +9 -0
  184. package/dist/recall-deep-budget.js +15 -0
  185. package/dist/recall-deep-budget.js.map +1 -0
  186. package/dist/recall-deep-expand.d.ts +12 -0
  187. package/dist/recall-deep-expand.js +17 -0
  188. package/dist/recall-deep-expand.js.map +1 -0
  189. package/dist/recall-deep-policy.d.ts +17 -0
  190. package/dist/recall-deep-policy.js +18 -0
  191. package/dist/recall-deep-policy.js.map +1 -0
  192. package/dist/recall-deep-query.d.ts +15 -0
  193. package/dist/recall-deep-query.js +12 -0
  194. package/dist/recall-deep-query.js.map +1 -0
  195. package/dist/recall-deep-refine.d.ts +12 -0
  196. package/dist/recall-deep-refine.js +17 -0
  197. package/dist/recall-deep-refine.js.map +1 -0
  198. package/dist/recall-deep-render.d.ts +11 -0
  199. package/dist/recall-deep-render.js +28 -0
  200. package/dist/recall-deep-render.js.map +1 -0
  201. package/dist/recall-deep-step-count.d.ts +8 -0
  202. package/dist/recall-deep-step-count.js +15 -0
  203. package/dist/recall-deep-step-count.js.map +1 -0
  204. package/dist/recall-deep-stop-reason.d.ts +17 -0
  205. package/dist/recall-deep-stop-reason.js +23 -0
  206. package/dist/recall-deep-stop-reason.js.map +1 -0
  207. package/dist/recall-deep-stop.d.ts +17 -0
  208. package/dist/recall-deep-stop.js +23 -0
  209. package/dist/recall-deep-stop.js.map +1 -0
  210. package/dist/recall-deep-working-set.d.ts +9 -0
  211. package/dist/recall-deep-working-set.js +14 -0
  212. package/dist/recall-deep-working-set.js.map +1 -0
  213. package/dist/recall-deep.js +6 -73
  214. package/dist/recall-deep.js.map +1 -1
  215. package/dist/recall-navigate-access.d.ts +39 -0
  216. package/dist/recall-navigate-access.js +31 -0
  217. package/dist/recall-navigate-access.js.map +1 -0
  218. package/dist/recall-navigate-action.d.ts +17 -0
  219. package/dist/recall-navigate-action.js +14 -0
  220. package/dist/recall-navigate-action.js.map +1 -0
  221. package/dist/recall-navigate-budget.d.ts +16 -0
  222. package/dist/recall-navigate-budget.js +18 -0
  223. package/dist/recall-navigate-budget.js.map +1 -0
  224. package/dist/recall-navigate-cost.d.ts +8 -0
  225. package/dist/recall-navigate-cost.js +15 -0
  226. package/dist/recall-navigate-cost.js.map +1 -0
  227. package/dist/recall-navigate-depth.d.ts +8 -0
  228. package/dist/recall-navigate-depth.js +15 -0
  229. package/dist/recall-navigate-depth.js.map +1 -0
  230. package/dist/recall-navigate-link.d.ts +17 -0
  231. package/dist/recall-navigate-link.js +20 -0
  232. package/dist/recall-navigate-link.js.map +1 -0
  233. package/dist/recall-navigate-max-children.d.ts +8 -0
  234. package/dist/recall-navigate-max-children.js +15 -0
  235. package/dist/recall-navigate-max-children.js.map +1 -0
  236. package/dist/recall-navigate-node.d.ts +15 -0
  237. package/dist/recall-navigate-node.js +13 -0
  238. package/dist/recall-navigate-node.js.map +1 -0
  239. package/dist/recall-navigate-path.d.ts +9 -0
  240. package/dist/recall-navigate-path.js +14 -0
  241. package/dist/recall-navigate-path.js.map +1 -0
  242. package/dist/recall-navigate-render.d.ts +15 -0
  243. package/dist/recall-navigate-render.js +23 -0
  244. package/dist/recall-navigate-render.js.map +1 -0
  245. package/dist/recall-navigate.js +6 -42
  246. package/dist/recall-navigate.js.map +1 -1
  247. package/dist/recall-state-view-current.d.ts +18 -0
  248. package/dist/recall-state-view-current.js +14 -0
  249. package/dist/recall-state-view-current.js.map +1 -0
  250. package/dist/recall-state-view-inject.d.ts +15 -0
  251. package/dist/recall-state-view-inject.js +16 -0
  252. package/dist/recall-state-view-inject.js.map +1 -0
  253. package/dist/recall-state-view-kind.d.ts +17 -0
  254. package/dist/recall-state-view-kind.js +14 -0
  255. package/dist/recall-state-view-kind.js.map +1 -0
  256. package/dist/recall-state-view-label.d.ts +17 -0
  257. package/dist/recall-state-view-label.js +16 -0
  258. package/dist/recall-state-view-label.js.map +1 -0
  259. package/dist/recall-state-view-render.d.ts +18 -0
  260. package/dist/recall-state-view-render.js +11 -0
  261. package/dist/recall-state-view-render.js.map +1 -0
  262. package/dist/recall-state-view-successor.d.ts +15 -0
  263. package/dist/recall-state-view-successor.js +13 -0
  264. package/dist/recall-state-view-successor.js.map +1 -0
  265. package/dist/recall-state-view-superseded.d.ts +15 -0
  266. package/dist/recall-state-view-superseded.js +14 -0
  267. package/dist/recall-state-view-superseded.js.map +1 -0
  268. package/dist/recall-state-view-transition.d.ts +18 -0
  269. package/dist/recall-state-view-transition.js +14 -0
  270. package/dist/recall-state-view-transition.js.map +1 -0
  271. package/dist/recall-state-view-widen.d.ts +13 -0
  272. package/dist/recall-state-view-widen.js +11 -0
  273. package/dist/recall-state-view-widen.js.map +1 -0
  274. package/dist/recall-state-view-wire.d.ts +3 -4
  275. package/dist/recall-state-view-wire.js +2 -1
  276. package/dist/resume-bundles.js +4 -4
  277. package/dist/search/factory.js +8 -8
  278. package/dist/search/index.js +14 -14
  279. package/dist/semantic-consolidation.js +14 -14
  280. package/dist/semantic-rule-promotion.js +13 -13
  281. package/dist/semantic-rule-verifier.js +13 -13
  282. package/dist/source-agent-qualifier.js +15 -15
  283. package/dist/storage.js +12 -12
  284. package/dist/support-passport/index.js +33 -33
  285. package/dist/transfer/backup.js +2 -2
  286. package/dist/transfer/capsule-export.js +2 -2
  287. package/dist/transfer/capsule-import.js +2 -2
  288. package/dist/transfer/export-okf.js +14 -14
  289. package/dist/verified-recall.js +13 -13
  290. package/dist/who-knows-cli.js +14 -14
  291. package/dist/who-knows.js +13 -13
  292. package/package.json +2 -2
  293. package/src/activity/dwell.test.ts +28 -0
  294. package/src/activity/dwell.ts +22 -0
  295. package/src/activity/from-ms.test.ts +25 -0
  296. package/src/activity/from-ms.ts +13 -0
  297. package/src/activity/heading-level.test.ts +23 -0
  298. package/src/activity/heading-level.ts +21 -0
  299. package/src/activity/heading-title.test.ts +21 -0
  300. package/src/activity/heading-title.ts +26 -0
  301. package/src/activity/index.ts +9 -0
  302. package/src/activity/journal-heading.test.ts +22 -0
  303. package/src/activity/journal-heading.ts +18 -0
  304. package/src/activity/journal-mode.test.ts +32 -0
  305. package/src/activity/journal-mode.ts +20 -0
  306. package/src/activity/journal-path.test.ts +25 -0
  307. package/src/activity/journal-path.ts +27 -0
  308. package/src/activity/journal-section.test.ts +37 -0
  309. package/src/activity/journal-section.ts +75 -0
  310. package/src/activity/journal-source.test.ts +37 -0
  311. package/src/activity/journal-source.ts +23 -0
  312. package/src/activity/journal-vault-read.test.ts +153 -0
  313. package/src/activity/journal-vault-read.ts +214 -0
  314. package/src/activity/journal.ts +1 -1
  315. package/src/activity/privacy-enabled.test.ts +30 -0
  316. package/src/activity/privacy-enabled.ts +33 -0
  317. package/src/activity/privacy-keys.test.ts +22 -0
  318. package/src/activity/privacy-keys.ts +12 -0
  319. package/src/activity/privacy-redact.test.ts +25 -0
  320. package/src/activity/privacy-redact.ts +23 -0
  321. package/src/activity/privacy-window.test.ts +49 -0
  322. package/src/activity/privacy-window.ts +32 -0
  323. package/src/activity/retain-days.test.ts +20 -0
  324. package/src/activity/retain-days.ts +14 -0
  325. package/src/activity/timeline/analysis-batch.test.ts +56 -0
  326. package/src/activity/timeline/analysis-batch.ts +45 -0
  327. package/src/activity/timeline/analysis-claim.test.ts +33 -0
  328. package/src/activity/timeline/analysis-claim.ts +16 -0
  329. package/src/activity/timeline/analysis-dup.test.ts +28 -0
  330. package/src/activity/timeline/analysis-dup.ts +10 -0
  331. package/src/activity/timeline/analysis-empty.test.ts +21 -0
  332. package/src/activity/timeline/analysis-empty.ts +14 -0
  333. package/src/activity/timeline/analysis-evidence.test.ts +32 -0
  334. package/src/activity/timeline/analysis-evidence.ts +20 -0
  335. package/src/activity/timeline/analysis-max.test.ts +26 -0
  336. package/src/activity/timeline/analysis-max.ts +14 -0
  337. package/src/activity/timeline/analysis-order.test.ts +28 -0
  338. package/src/activity/timeline/analysis-order.ts +10 -0
  339. package/src/activity/timeline/analysis-prompt.test.ts +50 -0
  340. package/src/activity/timeline/analysis-prompt.ts +24 -0
  341. package/src/activity/timeline/analysis.test.ts +413 -0
  342. package/src/activity/timeline/analysis.ts +362 -0
  343. package/src/activity/timeline/index.ts +13 -0
  344. package/src/activity/timeline/journal-recap-persist.test.ts +148 -0
  345. package/src/activity/timeline/journal-recap-persist.ts +37 -0
  346. package/src/activity/timeline/recap-card-id.test.ts +21 -0
  347. package/src/activity/timeline/recap-card-id.ts +16 -0
  348. package/src/activity/timeline/recap-date.test.ts +21 -0
  349. package/src/activity/timeline/recap-date.ts +19 -0
  350. package/src/activity/timeline/recap-empty.test.ts +21 -0
  351. package/src/activity/timeline/recap-empty.ts +14 -0
  352. package/src/activity/timeline/recap-export.test.ts +78 -0
  353. package/src/activity/timeline/recap-export.ts +41 -0
  354. package/src/activity/timeline/recap-id.test.ts +28 -0
  355. package/src/activity/timeline/recap-id.ts +10 -0
  356. package/src/activity/timeline/recap-markdown.test.ts +56 -0
  357. package/src/activity/timeline/recap-markdown.ts +26 -0
  358. package/src/activity/timeline/recap-sort-key.test.ts +18 -0
  359. package/src/activity/timeline/recap-sort-key.ts +14 -0
  360. package/src/activity/timeline/recap-tz.test.ts +35 -0
  361. package/src/activity/timeline/recap-tz.ts +19 -0
  362. package/src/activity/timeline/week-count.test.ts +19 -0
  363. package/src/activity/timeline/week-count.ts +13 -0
  364. package/src/activity/timeline/week-days.test.ts +26 -0
  365. package/src/activity/timeline/week-days.ts +23 -0
  366. package/src/activity/timeline/week-export.test.ts +59 -0
  367. package/src/activity/timeline/week-export.ts +44 -0
  368. package/src/activity/timeline/week-iso.test.ts +29 -0
  369. package/src/activity/timeline/week-iso.ts +20 -0
  370. package/src/activity/timeline/week-monday.test.ts +17 -0
  371. package/src/activity/timeline/week-monday.ts +12 -0
  372. package/src/activity/timeline/week-range.test.ts +23 -0
  373. package/src/activity/timeline/week-range.ts +26 -0
  374. package/src/activity/timeline/week-snapshot.test.ts +66 -0
  375. package/src/activity/timeline/week-snapshot.ts +40 -0
  376. package/src/activity/timeline/week-sunday.test.ts +17 -0
  377. package/src/activity/timeline/week-sunday.ts +12 -0
  378. package/src/activity/timeline/weekly-persist.test.ts +121 -0
  379. package/src/activity/timeline/weekly-persist.ts +103 -0
  380. package/src/activity/to-ms.test.ts +25 -0
  381. package/src/activity/to-ms.ts +13 -0
  382. package/src/activity/vault-begin.test.ts +20 -0
  383. package/src/activity/vault-begin.ts +13 -0
  384. package/src/activity/vault-end.test.ts +20 -0
  385. package/src/activity/vault-end.ts +13 -0
  386. package/src/activity/vault-frontmatter.test.ts +28 -0
  387. package/src/activity/vault-frontmatter.ts +39 -0
  388. package/src/activity/vault-join.test.ts +21 -0
  389. package/src/activity/vault-join.ts +31 -0
  390. package/src/activity/vault-marker.test.ts +23 -0
  391. package/src/activity/vault-marker.ts +27 -0
  392. package/src/activity/vault-name-trim.test.ts +22 -0
  393. package/src/activity/vault-name-trim.ts +16 -0
  394. package/src/activity/vault-path.test.ts +38 -0
  395. package/src/activity/vault-path.ts +59 -0
  396. package/src/activity/vault-publish.test.ts +102 -0
  397. package/src/activity/vault-publish.ts +92 -13
  398. package/src/activity/vault-region-pair.test.ts +26 -0
  399. package/src/activity/vault-region-pair.ts +24 -0
  400. package/src/activity/vault-region.test.ts +24 -0
  401. package/src/activity/vault-region.ts +24 -0
  402. package/src/activity/vault-suffix.test.ts +20 -0
  403. package/src/activity/vault-suffix.ts +12 -0
  404. package/src/activity/vault-wikilink.test.ts +27 -0
  405. package/src/activity/vault-wikilink.ts +28 -0
  406. package/src/activity/window-order.test.ts +27 -0
  407. package/src/activity/window-order.ts +24 -0
  408. package/src/dedup/merge-count.test.ts +19 -0
  409. package/src/dedup/merge-count.ts +13 -0
  410. package/src/dedup/merge-dup.test.ts +21 -0
  411. package/src/dedup/merge-dup.ts +16 -0
  412. package/src/dedup/merge-empty.test.ts +22 -0
  413. package/src/dedup/merge-empty.ts +18 -0
  414. package/src/dedup/merge-id.test.ts +18 -0
  415. package/src/dedup/merge-id.ts +14 -0
  416. package/src/dedup/merge-min-score.test.ts +37 -0
  417. package/src/dedup/merge-min-score.ts +22 -0
  418. package/src/dedup/merge-on-write-wire.test.ts +101 -0
  419. package/src/dedup/merge-on-write-wire.ts +34 -0
  420. package/src/dedup/merge-pair.test.ts +19 -0
  421. package/src/dedup/merge-pair.ts +13 -0
  422. package/src/dedup/merge-score.test.ts +20 -0
  423. package/src/dedup/merge-score.ts +14 -0
  424. package/src/dedup/merge-self.test.ts +19 -0
  425. package/src/dedup/merge-self.ts +17 -0
  426. package/src/dedup/merge-threshold.test.ts +46 -0
  427. package/src/dedup/merge-threshold.ts +26 -0
  428. package/src/dedup/merge-tie.test.ts +22 -0
  429. package/src/dedup/merge-tie.ts +13 -0
  430. package/src/extraction-span-bench.test.ts +27 -0
  431. package/src/extraction-span-bench.ts +28 -0
  432. package/src/extraction-span-clip.test.ts +71 -0
  433. package/src/extraction-span-clip.ts +26 -0
  434. package/src/extraction-span-contains.test.ts +30 -0
  435. package/src/extraction-span-contains.ts +20 -0
  436. package/src/extraction-span-join.test.ts +50 -0
  437. package/src/extraction-span-join.ts +30 -0
  438. package/src/extraction-span-length.test.ts +25 -0
  439. package/src/extraction-span-length.ts +16 -0
  440. package/src/extraction-span-overlap.test.ts +34 -0
  441. package/src/extraction-span-overlap.ts +23 -0
  442. package/src/extraction-span-shift.test.ts +25 -0
  443. package/src/extraction-span-shift.ts +20 -0
  444. package/src/extraction-span-slice.test.ts +32 -0
  445. package/src/extraction-span-slice.ts +20 -0
  446. package/src/extraction-span-validate.test.ts +42 -0
  447. package/src/extraction-span-validate.ts +27 -0
  448. package/src/extraction-span-wire.test.ts +20 -0
  449. package/src/extraction-span-wire.ts +17 -0
  450. package/src/extraction-span.test.ts +59 -0
  451. package/src/extraction-span.ts +39 -0
  452. package/src/index.ts +1 -0
  453. package/src/recall-deep-access.test.ts +58 -0
  454. package/src/recall-deep-access.ts +71 -0
  455. package/src/recall-deep-budget-left.test.ts +20 -0
  456. package/src/recall-deep-budget-left.ts +13 -0
  457. package/src/recall-deep-budget.test.ts +19 -0
  458. package/src/recall-deep-budget.ts +14 -0
  459. package/src/recall-deep-expand.test.ts +23 -0
  460. package/src/recall-deep-expand.ts +19 -0
  461. package/src/recall-deep-policy.test.ts +32 -0
  462. package/src/recall-deep-policy.ts +22 -0
  463. package/src/recall-deep-query.test.ts +23 -0
  464. package/src/recall-deep-query.ts +15 -0
  465. package/src/recall-deep-refine.test.ts +23 -0
  466. package/src/recall-deep-refine.ts +19 -0
  467. package/src/recall-deep-render.test.ts +68 -0
  468. package/src/recall-deep-render.ts +32 -0
  469. package/src/recall-deep-step-count.test.ts +20 -0
  470. package/src/recall-deep-step-count.ts +13 -0
  471. package/src/recall-deep-stop-reason.test.ts +46 -0
  472. package/src/recall-deep-stop-reason.ts +27 -0
  473. package/src/recall-deep-stop.test.ts +34 -0
  474. package/src/recall-deep-stop.ts +31 -0
  475. package/src/recall-deep-working-set.test.ts +21 -0
  476. package/src/recall-deep-working-set.ts +14 -0
  477. package/src/recall-navigate-access.test.ts +73 -0
  478. package/src/recall-navigate-access.ts +48 -0
  479. package/src/recall-navigate-action.test.ts +32 -0
  480. package/src/recall-navigate-action.ts +20 -0
  481. package/src/recall-navigate-budget.test.ts +23 -0
  482. package/src/recall-navigate-budget.ts +22 -0
  483. package/src/recall-navigate-cost.test.ts +20 -0
  484. package/src/recall-navigate-cost.ts +13 -0
  485. package/src/recall-navigate-depth.test.ts +20 -0
  486. package/src/recall-navigate-depth.ts +13 -0
  487. package/src/recall-navigate-link.test.ts +19 -0
  488. package/src/recall-navigate-link.ts +26 -0
  489. package/src/recall-navigate-max-children.test.ts +20 -0
  490. package/src/recall-navigate-max-children.ts +13 -0
  491. package/src/recall-navigate-node.test.ts +21 -0
  492. package/src/recall-navigate-node.ts +16 -0
  493. package/src/recall-navigate-path.test.ts +21 -0
  494. package/src/recall-navigate-path.ts +14 -0
  495. package/src/recall-navigate-render.test.ts +63 -0
  496. package/src/recall-navigate-render.ts +31 -0
  497. package/src/recall-state-view-current.test.ts +23 -0
  498. package/src/recall-state-view-current.ts +24 -0
  499. package/src/recall-state-view-inject.test.ts +32 -0
  500. package/src/recall-state-view-inject.ts +14 -0
  501. package/src/recall-state-view-kind.test.ts +19 -0
  502. package/src/recall-state-view-kind.ts +20 -0
  503. package/src/recall-state-view-label.test.ts +36 -0
  504. package/src/recall-state-view-label.ts +22 -0
  505. package/src/recall-state-view-render.test.ts +94 -0
  506. package/src/recall-state-view-render.ts +24 -0
  507. package/src/recall-state-view-successor.test.ts +21 -0
  508. package/src/recall-state-view-successor.ts +16 -0
  509. package/src/recall-state-view-superseded.test.ts +20 -0
  510. package/src/recall-state-view-superseded.ts +17 -0
  511. package/src/recall-state-view-transition.test.ts +30 -0
  512. package/src/recall-state-view-transition.ts +24 -0
  513. package/src/recall-state-view-widen.test.ts +66 -0
  514. package/src/recall-state-view-widen.ts +49 -0
  515. package/src/recall-state-view-wire.ts +6 -16
  516. package/src/shared-context/authority.test.ts +35 -0
  517. package/src/shared-context/authority.ts +25 -0
  518. package/src/shared-context/claim-key.test.ts +21 -0
  519. package/src/shared-context/claim-key.ts +16 -0
  520. package/src/shared-context/contradictions.test.ts +39 -0
  521. package/src/shared-context/contradictions.ts +32 -0
  522. package/src/shared-context/envelope-actor.test.ts +21 -0
  523. package/src/shared-context/envelope-actor.ts +16 -0
  524. package/src/shared-context/envelope-at.test.ts +19 -0
  525. package/src/shared-context/envelope-at.ts +17 -0
  526. package/src/shared-context/envelope-id.test.ts +21 -0
  527. package/src/shared-context/envelope-id.ts +16 -0
  528. package/src/shared-context/envelope-required.test.ts +24 -0
  529. package/src/shared-context/envelope-required.ts +15 -0
  530. package/src/shared-context/envelope-ttl.test.ts +29 -0
  531. package/src/shared-context/envelope-ttl.ts +35 -0
  532. package/src/shared-context/provenance.test.ts +35 -0
  533. package/src/shared-context/provenance.ts +68 -0
  534. package/src/shared-context/staleness.test.ts +36 -0
  535. package/src/shared-context/staleness.ts +38 -0
  536. package/src/shared-context/trajectories.test.ts +77 -0
  537. package/src/shared-context/trajectories.ts +49 -0
  538. package/dist/chunk-MUEGIKKY.js.map +0 -1
  539. package/dist/chunk-TCF4MU7L.js.map +0 -1
  540. package/dist/chunk-WFCWP4XU.js +0 -17
  541. package/dist/chunk-WFCWP4XU.js.map +0 -1
  542. /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
  543. /package/dist/{chunk-XKNHFDTT.js.map → chunk-3A2Z4OOS.js.map} +0 -0
  544. /package/dist/{chunk-CHGG74CY.js.map → chunk-3HHTN5X7.js.map} +0 -0
  545. /package/dist/{chunk-XOHYGIWF.js.map → chunk-3Z4SFJA5.js.map} +0 -0
  546. /package/dist/{chunk-RDGKVH6T.js.map → chunk-4NKIGSJM.js.map} +0 -0
  547. /package/dist/{chunk-GPFZFCRN.js.map → chunk-4PTTMTTQ.js.map} +0 -0
  548. /package/dist/{chunk-VG4SSPAW.js.map → chunk-4XESAT4V.js.map} +0 -0
  549. /package/dist/{chunk-S4CDUXQY.js.map → chunk-5KGLNBUB.js.map} +0 -0
  550. /package/dist/{chunk-2X6BGKQL.js.map → chunk-5XRZANCW.js.map} +0 -0
  551. /package/dist/{chunk-TCQRIIIN.js.map → chunk-6DODJYBY.js.map} +0 -0
  552. /package/dist/{chunk-KWIGDKM2.js.map → chunk-73CAEYI3.js.map} +0 -0
  553. /package/dist/{chunk-J2R275FN.js.map → chunk-7DXW5V2W.js.map} +0 -0
  554. /package/dist/{chunk-LYUUA6QB.js.map → chunk-7JJHIVMG.js.map} +0 -0
  555. /package/dist/{chunk-2FA7U5XY.js.map → chunk-7NNMRMLZ.js.map} +0 -0
  556. /package/dist/{chunk-227UFSEQ.js.map → chunk-7RZJWZ46.js.map} +0 -0
  557. /package/dist/{chunk-EWKVYCFP.js.map → chunk-B2OKCCXX.js.map} +0 -0
  558. /package/dist/{chunk-NSTNGMSS.js.map → chunk-B7AGLMGP.js.map} +0 -0
  559. /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
  560. /package/dist/{chunk-CEH2AFXG.js.map → chunk-C24UZSFW.js.map} +0 -0
  561. /package/dist/{chunk-LTBKKSCX.js.map → chunk-C2JCVZWX.js.map} +0 -0
  562. /package/dist/{chunk-65JOGLIS.js.map → chunk-D4R3OUZA.js.map} +0 -0
  563. /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
  564. /package/dist/{chunk-IGZCAHFL.js.map → chunk-EGGNFLAT.js.map} +0 -0
  565. /package/dist/{chunk-H2IRSXZN.js.map → chunk-ESDOAP7W.js.map} +0 -0
  566. /package/dist/{chunk-D3UXGE5D.js.map → chunk-EZWIEFYD.js.map} +0 -0
  567. /package/dist/{chunk-ZPS724LT.js.map → chunk-F5H5QINZ.js.map} +0 -0
  568. /package/dist/{chunk-S4Z2OBTX.js.map → chunk-FPSOXMLK.js.map} +0 -0
  569. /package/dist/{chunk-CX4OLNIH.js.map → chunk-G5UKF2GJ.js.map} +0 -0
  570. /package/dist/{chunk-OJUEUQDJ.js.map → chunk-GGY2747C.js.map} +0 -0
  571. /package/dist/{chunk-TNGH4ZYI.js.map → chunk-GNWLTCKC.js.map} +0 -0
  572. /package/dist/{chunk-YWPLOJ7T.js.map → chunk-GZPGI45F.js.map} +0 -0
  573. /package/dist/{chunk-NFP4KPTA.js.map → chunk-IDEPEHUG.js.map} +0 -0
  574. /package/dist/{chunk-LJABGXC4.js.map → chunk-IN5EUWCA.js.map} +0 -0
  575. /package/dist/{chunk-U6NGKS32.js.map → chunk-JJAOVJ3E.js.map} +0 -0
  576. /package/dist/{chunk-RPIS5FQ7.js.map → chunk-JWCS3VYQ.js.map} +0 -0
  577. /package/dist/{chunk-U65VJSCJ.js.map → chunk-KE23ZIEW.js.map} +0 -0
  578. /package/dist/{chunk-NACLNNFQ.js.map → chunk-KSZKQTZS.js.map} +0 -0
  579. /package/dist/{chunk-KJXCD7VR.js.map → chunk-KWJNEWTM.js.map} +0 -0
  580. /package/dist/{chunk-UW4RYPWC.js.map → chunk-MLTGALDY.js.map} +0 -0
  581. /package/dist/{chunk-YMOPYG3K.js.map → chunk-OLT3YTDH.js.map} +0 -0
  582. /package/dist/{chunk-2PSX5BJU.js.map → chunk-OPQKVVYG.js.map} +0 -0
  583. /package/dist/{chunk-D6Q5EPOV.js.map → chunk-PGD3DXZP.js.map} +0 -0
  584. /package/dist/{chunk-GBEOUCBB.js.map → chunk-Q6LC3ZD5.js.map} +0 -0
  585. /package/dist/{chunk-QBNE55VA.js.map → chunk-QELYSDAU.js.map} +0 -0
  586. /package/dist/{chunk-INUBU6I5.js.map → chunk-S6PRJGQL.js.map} +0 -0
  587. /package/dist/{chunk-B4AOWRYF.js.map → chunk-TCJO7LOG.js.map} +0 -0
  588. /package/dist/{chunk-SZMYGDSM.js.map → chunk-TO5U47YK.js.map} +0 -0
  589. /package/dist/{chunk-GAJK3DQ5.js.map → chunk-U3L6GRUX.js.map} +0 -0
  590. /package/dist/{chunk-4XLTUR6R.js.map → chunk-U4RGSLI4.js.map} +0 -0
  591. /package/dist/{chunk-M5ERTI4I.js.map → chunk-UH53XVQ3.js.map} +0 -0
  592. /package/dist/{chunk-NUF7VSEX.js.map → chunk-UXERIBOJ.js.map} +0 -0
  593. /package/dist/{chunk-FFUMTH27.js.map → chunk-VA2CSIPC.js.map} +0 -0
  594. /package/dist/{chunk-KQAFEZQX.js.map → chunk-VDX2J7OX.js.map} +0 -0
  595. /package/dist/{chunk-AF5H7TKI.js.map → chunk-VPJNGE2R.js.map} +0 -0
  596. /package/dist/{chunk-OMX6TKXH.js.map → chunk-VTJZSLDR.js.map} +0 -0
  597. /package/dist/{chunk-TBCDF556.js.map → chunk-WHFFAS4A.js.map} +0 -0
  598. /package/dist/{chunk-7UOXCCCI.js.map → chunk-WVNETF4Q.js.map} +0 -0
  599. /package/dist/{chunk-EH65UV2Z.js.map → chunk-XSTMPZMY.js.map} +0 -0
  600. /package/dist/{chunk-PD66CVSD.js.map → chunk-Z3SQEEB6.js.map} +0 -0
  601. /package/dist/{chunk-JKTV3JNX.js.map → chunk-ZBYOXIIF.js.map} +0 -0
  602. /package/dist/{chunk-2ITZ74A6.js.map → chunk-ZC5IHL5X.js.map} +0 -0
  603. /package/dist/{chunk-KI64TTBL.js.map → chunk-ZDMTCO7N.js.map} +0 -0
  604. /package/dist/{chunk-C5IUOBCN.js.map → chunk-ZET6A3OF.js.map} +0 -0
  605. /package/dist/{chunk-ZZZWEDF4.js.map → chunk-ZVAKRZZD.js.map} +0 -0
  606. /package/dist/{graph-edge-decay-A4SDFMMS.js.map → extraction-span.js.map} +0 -0
@@ -7,22 +7,22 @@ import {
7
7
  syncWearableSource,
8
8
  wearableSourceLabel
9
9
  } from "./chunk-3TSU662L.js";
10
- import {
11
- CompressionGuidelineCoordinator
12
- } from "./chunk-UXREWVW4.js";
13
10
  import {
14
11
  ActivityStore,
15
12
  MaintenanceScheduler
16
- } from "./chunk-NSTNGMSS.js";
13
+ } from "./chunk-B7AGLMGP.js";
17
14
  import {
18
15
  runPeerProfileReasoner
19
16
  } from "./chunk-I74SUMNI.js";
20
17
  import {
21
18
  migrateFromEngram
22
19
  } from "./chunk-7HYPN2GC.js";
20
+ import {
21
+ CompressionGuidelineCoordinator
22
+ } from "./chunk-UXREWVW4.js";
23
23
  import {
24
24
  LcmEngine
25
- } from "./chunk-D3UXGE5D.js";
25
+ } from "./chunk-EZWIEFYD.js";
26
26
  import {
27
27
  chunkTranscriptEntries
28
28
  } from "./chunk-TECVW3JP.js";
@@ -32,7 +32,7 @@ import {
32
32
  import {
33
33
  CompoundingEngine,
34
34
  defaultTierMigrationCycleBudget
35
- } from "./chunk-IGZCAHFL.js";
35
+ } from "./chunk-EGGNFLAT.js";
36
36
  import {
37
37
  SharedContextManager
38
38
  } from "./chunk-VI637ILW.js";
@@ -41,9 +41,15 @@ import {
41
41
  applyUtilityRankingRuntimeDelta,
42
42
  loadUtilityRuntimeValues
43
43
  } from "./chunk-SEF4IOFE.js";
44
+ import {
45
+ extractTopics
46
+ } from "./chunk-KVDUKH5E.js";
44
47
  import {
45
48
  cleanArchivedUserMessage
46
49
  } from "./chunk-47DU4SGJ.js";
50
+ import {
51
+ CODEX_THREAD_KEY_PREFIX
52
+ } from "./chunk-4EX5WZ4M.js";
47
53
  import {
48
54
  TierMigrationExecutor
49
55
  } from "./chunk-YRFAYOFQ.js";
@@ -54,24 +60,22 @@ import {
54
60
  TmtBuilder
55
61
  } from "./chunk-ECZU5BJH.js";
56
62
  import {
57
- extractTopics
58
- } from "./chunk-KVDUKH5E.js";
63
+ buildTargetedFactRecallSection,
64
+ shouldRecallTargetedFactEvidence
65
+ } from "./chunk-T67LUYCR.js";
59
66
  import {
60
67
  buildTemporalTimelineRecallSection
61
68
  } from "./chunk-2NKY7OC6.js";
62
- import {
63
- CODEX_THREAD_KEY_PREFIX
64
- } from "./chunk-4EX5WZ4M.js";
65
69
  import {
66
70
  HourlySummarizer
67
71
  } from "./chunk-IEZ6CGTW.js";
68
- import {
69
- buildTargetedFactRecallSection,
70
- shouldRecallTargetedFactEvidence
71
- } from "./chunk-T67LUYCR.js";
72
72
  import {
73
73
  SessionObserverState
74
74
  } from "./chunk-ODZKV2F7.js";
75
+ import {
76
+ buildResponseGuidanceRecallSection,
77
+ shouldRecallResponseGuidance
78
+ } from "./chunk-6TCXIRP5.js";
75
79
  import {
76
80
  mergeWithAgentResults,
77
81
  runDirectAgent,
@@ -96,6 +100,9 @@ import {
96
100
  import {
97
101
  applyRuntimeRetrievalPolicy
98
102
  } from "./chunk-5IZL4DCV.js";
103
+ import {
104
+ findUnresolvedEntityRefs
105
+ } from "./chunk-X7XN6YU4.js";
99
106
  import {
100
107
  RelevanceStore
101
108
  } from "./chunk-KATEWTQJ.js";
@@ -104,16 +111,9 @@ import {
104
111
  reorderByRankedKeys,
105
112
  rerankLocalOrNoop
106
113
  } from "./chunk-LUDXM7MD.js";
107
- import {
108
- buildResponseGuidanceRecallSection,
109
- shouldRecallResponseGuidance
110
- } from "./chunk-6TCXIRP5.js";
111
- import {
112
- findUnresolvedEntityRefs
113
- } from "./chunk-X7XN6YU4.js";
114
114
  import {
115
115
  applyRecallStateViews
116
- } from "./chunk-WFCWP4XU.js";
116
+ } from "./chunk-FYDW33ZB.js";
117
117
  import {
118
118
  dedupeResultsByNamespace,
119
119
  hasMemoryForResult,
@@ -141,9 +141,6 @@ import {
141
141
  import {
142
142
  runLiveConnectorsOnce
143
143
  } from "./chunk-HTIIXNJQ.js";
144
- import {
145
- scoreEvidencePathDetail
146
- } from "./chunk-XXSOVESA.js";
147
144
  import {
148
145
  deriveHarmonicRecords,
149
146
  harmonicEntityReferenceMatches,
@@ -155,18 +152,21 @@ import {
155
152
  classifyMemoryKind
156
153
  } from "./chunk-YAZNBMNF.js";
157
154
  import {
158
- buildFocusedListRecallSection,
159
- shouldRecallFocusedListEvidence
160
- } from "./chunk-OH7QLI6W.js";
155
+ scoreEvidencePathDetail
156
+ } from "./chunk-XXSOVESA.js";
161
157
  import {
162
158
  ExtractionEngine
163
- } from "./chunk-XKNHFDTT.js";
159
+ } from "./chunk-3A2Z4OOS.js";
164
160
  import {
165
161
  parseMemoryActionEligibilityContext
166
162
  } from "./chunk-AJTG3CP7.js";
167
163
  import {
168
164
  ModelRegistry
169
165
  } from "./chunk-WLZYGLJ4.js";
166
+ import {
167
+ buildFocusedListRecallSection,
168
+ shouldRecallFocusedListEvidence
169
+ } from "./chunk-OH7QLI6W.js";
170
170
  import {
171
171
  recordJudgeTrainingPair
172
172
  } from "./chunk-PWFCHOB3.js";
@@ -194,7 +194,7 @@ import {
194
194
  buildEntityRecallSection,
195
195
  entityRecentTranscriptLookbackHours,
196
196
  readRecentEntityTranscriptEntries
197
- } from "./chunk-LYUUA6QB.js";
197
+ } from "./chunk-7JJHIVMG.js";
198
198
  import {
199
199
  planEpisodeWindowsWithFallback
200
200
  } from "./chunk-T3GIETKV.js";
@@ -209,31 +209,31 @@ import {
209
209
  } from "./chunk-LVXBC6YB.js";
210
210
  import {
211
211
  refreshConvergedNamespaces
212
- } from "./chunk-KI64TTBL.js";
212
+ } from "./chunk-ZDMTCO7N.js";
213
213
  import {
214
214
  builtInConnectorPackageSpecifier,
215
215
  ensureBuiltInWearableConnectors,
216
216
  getWearableConnector,
217
217
  listWearableConnectors,
218
218
  screenCandidateFact
219
- } from "./chunk-RPIS5FQ7.js";
220
- import {
221
- normalizeReplaySessionKey
222
- } from "./chunk-AJVLDJU6.js";
219
+ } from "./chunk-JWCS3VYQ.js";
223
220
  import {
224
221
  RoutingRulesStore
225
222
  } from "./chunk-TBUEE7XF.js";
223
+ import {
224
+ normalizeReplaySessionKey
225
+ } from "./chunk-AJVLDJU6.js";
226
226
  import {
227
227
  compareVerifiedEpisodeResults,
228
228
  searchVerifiedEpisodes
229
- } from "./chunk-ZPS724LT.js";
229
+ } from "./chunk-F5H5QINZ.js";
230
230
  import {
231
231
  ThreadingManager
232
232
  } from "./chunk-OJP3N7UK.js";
233
233
  import {
234
234
  compareVerifiedSemanticRuleResults,
235
235
  searchVerifiedSemanticRules
236
- } from "./chunk-M5ERTI4I.js";
236
+ } from "./chunk-UH53XVQ3.js";
237
237
  import {
238
238
  searchWorkProductLedgerEntries
239
239
  } from "./chunk-NRLELHAY.js";
@@ -246,17 +246,17 @@ import {
246
246
  import {
247
247
  runNamespaceMaintenanceFanout,
248
248
  summarizeNamespaceMaintenanceHealth
249
- } from "./chunk-2X6BGKQL.js";
249
+ } from "./chunk-5XRZANCW.js";
250
250
  import {
251
251
  planNamespaceMaintenance
252
- } from "./chunk-S4Z2OBTX.js";
252
+ } from "./chunk-FPSOXMLK.js";
253
+ import {
254
+ searchHarmonicRetrieval
255
+ } from "./chunk-B2OKCCXX.js";
253
256
  import {
254
257
  isAboveImportanceThreshold,
255
258
  scoreImportance
256
259
  } from "./chunk-UOBPK2OS.js";
257
- import {
258
- searchHarmonicRetrieval
259
- } from "./chunk-EWKVYCFP.js";
260
260
  import {
261
261
  EXTRACTION_JUDGE_VERDICT_CATEGORY,
262
262
  recordJudgeVerdict
@@ -284,7 +284,7 @@ import {
284
284
  materializeAfterSemanticConsolidation,
285
285
  parseConsolidationResponse,
286
286
  parseOperatorAwareConsolidationResponse
287
- } from "./chunk-INUBU6I5.js";
287
+ } from "./chunk-S6PRJGQL.js";
288
288
  import {
289
289
  semanticChunkContent
290
290
  } from "./chunk-2GBFKHBZ.js";
@@ -293,7 +293,7 @@ import {
293
293
  } from "./chunk-6TBIWIAG.js";
294
294
  import {
295
295
  SmartBuffer
296
- } from "./chunk-NACLNNFQ.js";
296
+ } from "./chunk-KSZKQTZS.js";
297
297
  import {
298
298
  buildRecallQueryPolicy
299
299
  } from "./chunk-C6WMSXCJ.js";
@@ -317,7 +317,7 @@ import {
317
317
  applyNoveltyGate,
318
318
  detectMeetings,
319
319
  embeddingsFromCosineHits
320
- } from "./chunk-AF5H7TKI.js";
320
+ } from "./chunk-VPJNGE2R.js";
321
321
  import {
322
322
  compileCorrectionRule,
323
323
  correctionsFilePath,
@@ -330,14 +330,14 @@ import {
330
330
  } from "./chunk-QW27DOHG.js";
331
331
  import {
332
332
  MeetingsInputError
333
- } from "./chunk-U65VJSCJ.js";
333
+ } from "./chunk-KE23ZIEW.js";
334
334
  import {
335
335
  WearablesInputError,
336
336
  describeErrorForOperator
337
337
  } from "./chunk-V7IZKJI3.js";
338
338
  import {
339
339
  NamespaceCatalog
340
- } from "./chunk-GAJK3DQ5.js";
340
+ } from "./chunk-U3L6GRUX.js";
341
341
  import {
342
342
  recordDreamsPhaseRun
343
343
  } from "./chunk-EQWEIIKQ.js";
@@ -353,11 +353,13 @@ import {
353
353
  detectPassiveCorrections,
354
354
  filterRecallCandidates,
355
355
  isGenericRecallExcludedPath,
356
- isTopLevelArchivePath
357
- } from "./chunk-MUEGIKKY.js";
356
+ isTopLevelArchivePath,
357
+ journalPath,
358
+ writeJournalFile
359
+ } from "./chunk-OKGQDI4Y.js";
358
360
  import {
359
361
  importCapsule
360
- } from "./chunk-J2R275FN.js";
362
+ } from "./chunk-7DXW5V2W.js";
361
363
  import {
362
364
  isCodingGraphInstalled
363
365
  } from "./chunk-VQ7B2Q6M.js";
@@ -385,16 +387,16 @@ import {
385
387
  objectiveStateStoreOverrideForNamespace,
386
388
  searchObjectiveStateSnapshots
387
389
  } from "./chunk-HTP6XRUI.js";
388
- import {
389
- contentMatchesRedactionRules,
390
- loadRedactionRules
391
- } from "./chunk-LTHVM4XN.js";
392
390
  import {
393
391
  ProfilingCollector
394
392
  } from "./chunk-NLE6TSLG.js";
395
393
  import {
396
394
  LocalLlmClient
397
395
  } from "./chunk-IVKIODHO.js";
396
+ import {
397
+ contentMatchesRedactionRules,
398
+ loadRedactionRules
399
+ } from "./chunk-LTHVM4XN.js";
398
400
  import {
399
401
  shouldSkipImplicitExtraction
400
402
  } from "./chunk-X5YYSAZX.js";
@@ -408,10 +410,10 @@ import {
408
410
  } from "./chunk-7ZNJN5WZ.js";
409
411
  import {
410
412
  NamespaceStorageRouter
411
- } from "./chunk-S4CDUXQY.js";
413
+ } from "./chunk-5KGLNBUB.js";
412
414
  import {
413
415
  GraphIndex
414
- } from "./chunk-YMOPYG3K.js";
416
+ } from "./chunk-OLT3YTDH.js";
415
417
  import {
416
418
  BulkImportBatchPartialFailureError,
417
419
  COMPACTION_SIGNAL_MAX_AGE_MS,
@@ -452,7 +454,7 @@ import {
452
454
  throwIfRecallAborted,
453
455
  tokenizeRecallQuery,
454
456
  utcDateKeysForLocalDay
455
- } from "./chunk-RDGKVH6T.js";
457
+ } from "./chunk-4NKIGSJM.js";
456
458
  import {
457
459
  inferIntentFromText,
458
460
  intentCompatibilityScore,
@@ -465,7 +467,7 @@ import {
465
467
  } from "./chunk-TBBDFYXW.js";
466
468
  import {
467
469
  buildChainFollowupGenerator
468
- } from "./chunk-7UOXCCCI.js";
470
+ } from "./chunk-WVNETF4Q.js";
469
471
  import {
470
472
  QmdResultResolver,
471
473
  StorageManager,
@@ -484,10 +486,7 @@ import {
484
486
  reconstructFusionInputs,
485
487
  selfDeps,
486
488
  serializeFusionDay
487
- } from "./chunk-2ITZ74A6.js";
488
- import {
489
- buildRetiredFactTombstoneInputs
490
- } from "./chunk-4ZWCQJNM.js";
489
+ } from "./chunk-ZC5IHL5X.js";
491
490
  import {
492
491
  bodyIsEscaped,
493
492
  decodeTranscriptBody,
@@ -498,15 +497,18 @@ import {
498
497
  saveSpeakerRegistry,
499
498
  speakerRegistryKey
500
499
  } from "./chunk-UHVXE24Y.js";
500
+ import {
501
+ buildRetiredFactTombstoneInputs
502
+ } from "./chunk-4ZWCQJNM.js";
501
503
  import {
502
504
  NamespaceSearchRouter,
503
505
  namespaceCollectionName
504
- } from "./chunk-C5IUOBCN.js";
506
+ } from "./chunk-ZET6A3OF.js";
505
507
  import {
506
508
  createConversationIndexRuntime,
507
509
  createSearchBackend,
508
510
  isSearchBackendEnabled
509
- } from "./chunk-U6NGKS32.js";
511
+ } from "./chunk-JJAOVJ3E.js";
510
512
  import {
511
513
  NoopSearchBackend
512
514
  } from "./chunk-CYEPCZN5.js";
@@ -582,6 +584,9 @@ import {
582
584
  fallbackLlmRuntimeContextFromConfig,
583
585
  gatewayTaskChainOptions
584
586
  } from "./chunk-JALOAKSZ.js";
587
+ import {
588
+ extractJsonCandidates
589
+ } from "./chunk-RGMVMVMF.js";
585
590
  import {
586
591
  estimateTokenCount
587
592
  } from "./chunk-TOTT6S2V.js";
@@ -593,12 +598,14 @@ import {
593
598
  } from "./chunk-QDW3E4RD.js";
594
599
  import {
595
600
  activityDayWindow,
601
+ assertValidTimezone,
602
+ hashActivityBody,
596
603
  isValidActivityDate,
597
604
  timezoneOffsetIso
598
605
  } from "./chunk-M6L7HI7R.js";
599
606
  import {
600
607
  searchCausalTrajectories
601
- } from "./chunk-GPFZFCRN.js";
608
+ } from "./chunk-4PTTMTTQ.js";
602
609
  import {
603
610
  evaluateSubjectGuard,
604
611
  isSharedPromotionTarget,
@@ -2316,7 +2323,7 @@ var RecallRerankCoordinator = class _RecallRerankCoordinator {
2316
2323
  namespaces,
2317
2324
  {
2318
2325
  readNamespaceMemories: async (ns) => (await this.getStorage(ns)).readAllMemories(),
2319
- readMemoryFrontmatter: async (path35, preferredNamespace) => {
2326
+ readMemoryFrontmatter: async (path40, preferredNamespace) => {
2320
2327
  if (!fallbackReader) {
2321
2328
  for (const ns of namespaces) {
2322
2329
  try {
@@ -2328,7 +2335,7 @@ var RecallRerankCoordinator = class _RecallRerankCoordinator {
2328
2335
  }
2329
2336
  if (!fallbackReader) return null;
2330
2337
  const memory = await this.readQmdResultMemory(
2331
- path35,
2338
+ path40,
2332
2339
  fallbackReader,
2333
2340
  namespaces,
2334
2341
  preferredNamespace
@@ -17083,8 +17090,8 @@ function fuseMeeting(input, config, options = {}) {
17083
17090
  }
17084
17091
  const clipped = [];
17085
17092
  for (const conv of input.conversations) {
17086
- const clip = clipConversation(conv, windowStartMs, windowEndMs);
17087
- if (clip !== null) clipped.push(clip);
17093
+ const clip2 = clipConversation(conv, windowStartMs, windowEndMs);
17094
+ if (clip2 !== null) clipped.push(clip2);
17088
17095
  }
17089
17096
  const fused = clipped.length > 0 ? fuseCluster(clipped, {
17090
17097
  ...options.sourceTrust !== void 0 ? { sourceTrust: options.sourceTrust } : {},
@@ -22330,9 +22337,9 @@ function readStructuralSymbol(entry) {
22330
22337
  const rec = entry;
22331
22338
  const symbol = typeof rec.symbol === "string" ? rec.symbol.trim() : "";
22332
22339
  if (!symbol) return null;
22333
- const path35 = typeof rec.path === "string" && rec.path.length > 0 ? rec.path : void 0;
22340
+ const path40 = typeof rec.path === "string" && rec.path.length > 0 ? rec.path : void 0;
22334
22341
  const kind = typeof rec.kind === "string" && rec.kind.length > 0 ? rec.kind : void 0;
22335
- const item = path35 !== void 0 && kind !== void 0 ? { symbol, path: path35, kind } : path35 !== void 0 ? { symbol, path: path35 } : kind !== void 0 ? { symbol, kind } : { symbol };
22342
+ const item = path40 !== void 0 && kind !== void 0 ? { symbol, path: path40, kind } : path40 !== void 0 ? { symbol, path: path40 } : kind !== void 0 ? { symbol, kind } : { symbol };
22336
22343
  return item;
22337
22344
  }
22338
22345
  function classifySpawnError(err) {
@@ -26628,6 +26635,793 @@ function renderDeterministicJournal(cards, options) {
26628
26635
  ].join("\n");
26629
26636
  }
26630
26637
 
26638
+ // src/activity/timeline/journal-recap-persist.ts
26639
+ function persistDeterministicJournal(input) {
26640
+ const filePath = journalPath(input.memoryDir, input.date);
26641
+ const wrote = writeJournalFile(
26642
+ filePath,
26643
+ renderDeterministicJournal(input.cards, {
26644
+ date: input.date,
26645
+ timezone: input.timezone
26646
+ }),
26647
+ input.force === true
26648
+ );
26649
+ return { path: filePath, wrote };
26650
+ }
26651
+
26652
+ // src/activity/timeline/weekly.ts
26653
+ var WEEKLY_ACTIVITY_FORMAT_VERSION = 1;
26654
+ function parseBound(value, label) {
26655
+ const ms = parseFlexibleIsoTimestamp(value);
26656
+ if (ms === null) {
26657
+ throw new RangeError(`${label} is not a valid ISO timestamp`);
26658
+ }
26659
+ return ms;
26660
+ }
26661
+ function clip(start, end, winStart, winEnd) {
26662
+ const clippedStart = Math.max(start, winStart);
26663
+ const clippedEnd = Math.min(end, winEnd);
26664
+ return clippedEnd > clippedStart ? [clippedStart, clippedEnd] : null;
26665
+ }
26666
+ function unionDuration(intervals) {
26667
+ const sorted = [...intervals].sort((a, b) => a[0] - b[0] || a[1] - b[1]);
26668
+ let total = 0;
26669
+ let curStart = Number.NaN;
26670
+ let curEnd = Number.NaN;
26671
+ for (const [start, end] of sorted) {
26672
+ if (!Number.isFinite(curStart)) {
26673
+ curStart = start;
26674
+ curEnd = end;
26675
+ continue;
26676
+ }
26677
+ if (start <= curEnd) {
26678
+ curEnd = Math.max(curEnd, end);
26679
+ continue;
26680
+ }
26681
+ total += curEnd - curStart;
26682
+ curStart = start;
26683
+ curEnd = end;
26684
+ }
26685
+ if (Number.isFinite(curStart)) total += curEnd - curStart;
26686
+ return total;
26687
+ }
26688
+ function localDateOf(ms, timezone) {
26689
+ const parts = new Intl.DateTimeFormat("en-CA", {
26690
+ timeZone: timezone,
26691
+ year: "numeric",
26692
+ month: "2-digit",
26693
+ day: "2-digit"
26694
+ }).formatToParts(new Date(ms));
26695
+ const get = (type) => parts.find((part) => part.type === type)?.value ?? "";
26696
+ return `${get("year")}-${get("month")}-${get("day")}`;
26697
+ }
26698
+ function shiftIsoDate(date, days) {
26699
+ const parsed = /* @__PURE__ */ new Date(`${date}T00:00:00Z`);
26700
+ parsed.setUTCDate(parsed.getUTCDate() + days);
26701
+ return parsed.toISOString().slice(0, 10);
26702
+ }
26703
+ function daysOverlappingWeek(weekStartMs, weekEndMs, timezone) {
26704
+ if (weekEndMs <= weekStartMs) return [];
26705
+ let date = localDateOf(weekStartMs, timezone);
26706
+ let window = activityDayWindow(date, timezone);
26707
+ if (Date.parse(window.startUtc) > weekStartMs) {
26708
+ date = shiftIsoDate(date, -1);
26709
+ window = activityDayWindow(date, timezone);
26710
+ }
26711
+ const days = [];
26712
+ while (Date.parse(window.startUtc) < weekEndMs) {
26713
+ const startMs = Math.max(Date.parse(window.startUtc), weekStartMs);
26714
+ const endMs = Math.min(Date.parse(window.endUtc), weekEndMs);
26715
+ if (endMs > startMs) days.push({ date, startMs, endMs });
26716
+ date = shiftIsoDate(date, 1);
26717
+ window = activityDayWindow(date, timezone);
26718
+ }
26719
+ return days;
26720
+ }
26721
+ function emptyAcc(categoryIds) {
26722
+ return {
26723
+ activeMs: 0,
26724
+ idleMs: 0,
26725
+ pauseMs: 0,
26726
+ gapMs: 0,
26727
+ unclassifiedMs: 0,
26728
+ byCategory: new Map(categoryIds.map((id) => [id, 0])),
26729
+ intervals: []
26730
+ };
26731
+ }
26732
+ function addClipped(acc, kind, categoryId, known, start, end) {
26733
+ const duration = end - start;
26734
+ acc.intervals.push([start, end]);
26735
+ if (kind === "idle") acc.idleMs += duration;
26736
+ else if (kind === "pause") acc.pauseMs += duration;
26737
+ else acc.activeMs += duration;
26738
+ if (known.has(categoryId)) {
26739
+ acc.byCategory.set(categoryId, (acc.byCategory.get(categoryId) ?? 0) + duration);
26740
+ } else {
26741
+ acc.unclassifiedMs += duration;
26742
+ }
26743
+ }
26744
+ function sortCategoryTotals(byCategory) {
26745
+ return [...byCategory.entries()].map(([categoryId, durationMs]) => ({ categoryId, durationMs })).sort((a, b) => b.durationMs - a.durationMs || (a.categoryId < b.categoryId ? -1 : a.categoryId > b.categoryId ? 1 : 0));
26746
+ }
26747
+ function finish(acc, windowMs) {
26748
+ const covered = unionDuration(acc.intervals);
26749
+ return {
26750
+ activeMs: acc.activeMs,
26751
+ idleMs: acc.idleMs,
26752
+ pauseMs: acc.pauseMs,
26753
+ gapMs: Math.max(0, windowMs - covered),
26754
+ unclassifiedMs: acc.unclassifiedMs,
26755
+ categories: sortCategoryTotals(acc.byCategory)
26756
+ };
26757
+ }
26758
+ function buildWeeklyActivitySummary(cards, options) {
26759
+ assertValidTimezone(options.timezone);
26760
+ const weekStartMs = parseBound(options.weekStartUtc, "weekStartUtc");
26761
+ const weekEndMs = parseBound(options.weekEndUtc, "weekEndUtc");
26762
+ if (weekStartMs > weekEndMs) {
26763
+ throw new RangeError("reversed range: weekStartUtc must be <= weekEndUtc");
26764
+ }
26765
+ const categoryIds = options.categories.map((category) => category.id);
26766
+ const known = new Set(categoryIds);
26767
+ const week = emptyAcc(categoryIds);
26768
+ const dayWindows = daysOverlappingWeek(weekStartMs, weekEndMs, options.timezone);
26769
+ const dayAccs = dayWindows.map(() => emptyAcc(categoryIds));
26770
+ for (const card of cards) {
26771
+ const start = Date.parse(card.startUtc);
26772
+ const end = Date.parse(card.endUtc);
26773
+ if (!Number.isFinite(start) || !Number.isFinite(end) || end <= start) continue;
26774
+ const weekClip = clip(start, end, weekStartMs, weekEndMs);
26775
+ if (!weekClip) continue;
26776
+ addClipped(week, card.kind, card.categoryId, known, weekClip[0], weekClip[1]);
26777
+ for (let i = 0; i < dayWindows.length; i++) {
26778
+ const day = dayWindows[i];
26779
+ const dayClip = clip(start, end, day.startMs, day.endMs);
26780
+ if (dayClip) addClipped(dayAccs[i], card.kind, card.categoryId, known, dayClip[0], dayClip[1]);
26781
+ }
26782
+ }
26783
+ const weekTotals = finish(week, weekEndMs - weekStartMs);
26784
+ const days = dayWindows.map((day, i) => {
26785
+ const totals = finish(dayAccs[i], day.endMs - day.startMs);
26786
+ return {
26787
+ date: day.date,
26788
+ startUtc: new Date(day.startMs).toISOString(),
26789
+ endUtc: new Date(day.endMs).toISOString(),
26790
+ ...totals
26791
+ };
26792
+ });
26793
+ return {
26794
+ formatVersion: WEEKLY_ACTIVITY_FORMAT_VERSION,
26795
+ timezone: options.timezone,
26796
+ weekStartUtc: new Date(weekStartMs).toISOString(),
26797
+ weekEndUtc: new Date(weekEndMs).toISOString(),
26798
+ ...weekTotals,
26799
+ days,
26800
+ previousPeriod: { available: false }
26801
+ };
26802
+ }
26803
+
26804
+ // src/activity/timeline/weekly-persist.ts
26805
+ import { randomBytes as randomBytes3 } from "crypto";
26806
+ import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync, unlinkSync, writeFileSync } from "fs";
26807
+ import path33 from "path";
26808
+ var WEEKLY_SNAPSHOT_FORMAT_VERSION = 1;
26809
+ var WEEKLY_SNAPSHOT_DIR = path33.join("activity", "weekly");
26810
+ function requireToken(value, name) {
26811
+ if (typeof value !== "string" || value.trim().length === 0) {
26812
+ throw new TypeError(`${name} must be a non-empty string`);
26813
+ }
26814
+ return value.trim();
26815
+ }
26816
+ function weeklySnapshotPath(input) {
26817
+ const memoryDir = requireToken(input.memoryDir, "memoryDir");
26818
+ const namespace = requireToken(input.namespace, "namespace");
26819
+ const sourceRevision = requireToken(input.sourceRevision, "sourceRevision");
26820
+ const configHash = requireToken(input.configHash, "configHash");
26821
+ const weekStartUtc = input.summary?.weekStartUtc;
26822
+ if (typeof weekStartUtc !== "string") {
26823
+ throw new TypeError("summary.weekStartUtc must be an ISO timestamp");
26824
+ }
26825
+ const weekDate = weekStartUtc.slice(0, 10);
26826
+ if (!isValidActivityDate(weekDate)) {
26827
+ throw new RangeError("summary.weekStartUtc must be an ISO timestamp");
26828
+ }
26829
+ const identity = hashActivityBody(
26830
+ `${input.summary.weekStartUtc}\0${input.summary.weekEndUtc}\0${sourceRevision}\0${configHash}`
26831
+ );
26832
+ return path33.join(
26833
+ path33.resolve(memoryDir),
26834
+ WEEKLY_SNAPSHOT_DIR,
26835
+ namespaceIdentityToken(namespace),
26836
+ `${weekDate}--${identity}.json`
26837
+ );
26838
+ }
26839
+ function persistWeeklySnapshot(input) {
26840
+ const namespace = requireToken(input.namespace, "namespace");
26841
+ const sourceRevision = requireToken(input.sourceRevision, "sourceRevision");
26842
+ const configHash = requireToken(input.configHash, "configHash");
26843
+ const filePath = weeklySnapshotPath(input);
26844
+ const payload = {
26845
+ formatVersion: WEEKLY_SNAPSHOT_FORMAT_VERSION,
26846
+ namespace,
26847
+ sourceRevision,
26848
+ configHash,
26849
+ summary: input.summary
26850
+ };
26851
+ const contentHash = hashActivityBody(JSON.stringify(payload));
26852
+ const text = `${JSON.stringify({ ...payload, contentHash })}
26853
+ `;
26854
+ try {
26855
+ if (readFileSync2(filePath, "utf8") === text) {
26856
+ return { path: filePath, written: false };
26857
+ }
26858
+ } catch (error) {
26859
+ if (!(typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")) {
26860
+ throw error;
26861
+ }
26862
+ }
26863
+ mkdirSync2(path33.dirname(filePath), { recursive: true, mode: 448 });
26864
+ const tmpPath = `${filePath}.${process.pid}.${randomBytes3(8).toString("hex")}.tmp`;
26865
+ writeFileSync(tmpPath, text, { encoding: "utf8", mode: 384 });
26866
+ try {
26867
+ renameSync(tmpPath, filePath);
26868
+ } catch (error) {
26869
+ try {
26870
+ unlinkSync(tmpPath);
26871
+ } catch {
26872
+ }
26873
+ throw error;
26874
+ }
26875
+ return { path: filePath, written: true };
26876
+ }
26877
+
26878
+ // src/activity/timeline/analysis.ts
26879
+ var TIMELINE_ANALYSIS_PROMPT_VERSION = 1;
26880
+ var TIMELINE_ANALYSIS_BATCH_SIZE = 40;
26881
+ var TIMELINE_ANALYSIS_BATCH_OVERLAP = 2;
26882
+ var TIMELINE_ANALYSIS_DEFAULT_TIMEOUT_MS = 15e3;
26883
+ var TimelineAnalysisConfigError = class extends Error {
26884
+ name = "TimelineAnalysisConfigError";
26885
+ code = "invalid_config";
26886
+ constructor(message) {
26887
+ super(message);
26888
+ }
26889
+ };
26890
+ var INSTRUCTIONS = [
26891
+ "Use only supplied evidence.",
26892
+ "Preserve chronology.",
26893
+ "Do not invent people, places, or tasks.",
26894
+ "Avoid productivity or emotional claims.",
26895
+ "Merge adjacent activity only when the evidence justifies it.",
26896
+ 'Return strict JSON: {"ops":[...]} with evidenceRange, title, summary, categoryId, confidence, uncertainty.',
26897
+ "Cite evidence ranges for every op. Empty ops is a valid no-op."
26898
+ ].join(" ");
26899
+ function fail(status, cards, provider, model) {
26900
+ log.info(`timeline analysis status=${status} provider=${provider} model=${model} promptVersion=${TIMELINE_ANALYSIS_PROMPT_VERSION}`);
26901
+ return {
26902
+ status,
26903
+ cards,
26904
+ provider,
26905
+ model,
26906
+ promptVersion: TIMELINE_ANALYSIS_PROMPT_VERSION
26907
+ };
26908
+ }
26909
+ function requiredToken(value, name) {
26910
+ if (typeof value !== "string" || value.trim().length === 0) {
26911
+ throw new TimelineAnalysisConfigError(`${name} is required`);
26912
+ }
26913
+ return value.trim();
26914
+ }
26915
+ function evidenceKeyOf2(observation) {
26916
+ const parsed = Date.parse(observation.capturedAtUtc);
26917
+ const instant = Number.isFinite(parsed) ? new Date(parsed).toISOString() : observation.capturedAtUtc;
26918
+ return `${observation.machine}|${instant}|${observation.contentHash}`;
26919
+ }
26920
+ function sortObservations(observations) {
26921
+ return [...observations].sort((a, b) => {
26922
+ const time = Date.parse(a.capturedAtUtc) - Date.parse(b.capturedAtUtc);
26923
+ if (time !== 0) return time;
26924
+ if (a.contentHash !== b.contentHash) return a.contentHash < b.contentHash ? -1 : 1;
26925
+ return a.id - b.id;
26926
+ });
26927
+ }
26928
+ function batchObservations(observations) {
26929
+ if (observations.length === 0) return [[]];
26930
+ const size = TIMELINE_ANALYSIS_BATCH_SIZE;
26931
+ const overlap = TIMELINE_ANALYSIS_BATCH_OVERLAP;
26932
+ const step = size - overlap;
26933
+ const batches = [];
26934
+ for (let start = 0; start < observations.length; start += step) {
26935
+ batches.push(observations.slice(start, start + size));
26936
+ if (start + size >= observations.length) break;
26937
+ }
26938
+ return batches;
26939
+ }
26940
+ function safeObservation(observation) {
26941
+ return {
26942
+ id: observation.id,
26943
+ machine: observation.machine,
26944
+ capturedAtUtc: observation.capturedAtUtc,
26945
+ app: observation.app,
26946
+ windowTitle: observation.windowTitle,
26947
+ ...observation.browserUrl ? { browserUrl: observation.browserUrl } : {},
26948
+ contentHash: observation.contentHash
26949
+ };
26950
+ }
26951
+ function safeCard(card) {
26952
+ return {
26953
+ id: card.id,
26954
+ kind: card.kind,
26955
+ title: card.title,
26956
+ summary: card.summary,
26957
+ categoryId: card.categoryId,
26958
+ confidence: card.confidence,
26959
+ startUtc: card.startUtc,
26960
+ endUtc: card.endUtc,
26961
+ machine: card.machine,
26962
+ evidenceIds: card.evidenceIds,
26963
+ evidenceRange: card.evidenceRange,
26964
+ ...card.manualEdit ? { manualEdit: card.manualEdit } : {}
26965
+ };
26966
+ }
26967
+ function buildTimelineAnalysisPrompt(input) {
26968
+ const payload = {
26969
+ date: input.date ?? null,
26970
+ timezone: input.timezone ?? null,
26971
+ categories: input.categories.map((category) => ({ id: category.id, name: category.name })),
26972
+ preferences: input.preferences ?? [],
26973
+ priorEdits: input.priorEdits ?? [],
26974
+ cards: input.cards.map(safeCard),
26975
+ observations: input.observations.map(safeObservation)
26976
+ };
26977
+ return `${INSTRUCTIONS}
26978
+ ${JSON.stringify(payload)}`;
26979
+ }
26980
+ async function callComplete(complete, prompt, provider, model, timeoutMs, parent) {
26981
+ const { promise: timeoutPromise, reject } = Promise.withResolvers();
26982
+ const failOnce = (message, name) => {
26983
+ reject(Object.assign(new Error(message), { name }));
26984
+ };
26985
+ const timer = setTimeout(() => failOnce("timeline analysis timed out", "TimeoutError"), timeoutMs);
26986
+ if (parent?.aborted) {
26987
+ clearTimeout(timer);
26988
+ throw Object.assign(new Error("timeline analysis aborted"), { name: "AbortError" });
26989
+ }
26990
+ const onAbort = () => failOnce("timeline analysis aborted", "AbortError");
26991
+ parent?.addEventListener("abort", onAbort, { once: true });
26992
+ const signal = parent ? AbortSignal.any([parent, AbortSignal.timeout(timeoutMs)]) : AbortSignal.timeout(timeoutMs);
26993
+ try {
26994
+ return await Promise.race([complete({ prompt, provider, model, signal }), timeoutPromise]);
26995
+ } finally {
26996
+ clearTimeout(timer);
26997
+ parent?.removeEventListener("abort", onAbort);
26998
+ }
26999
+ }
27000
+ function parseOps(raw) {
27001
+ if (typeof raw !== "string" || raw.trim().length === 0) return null;
27002
+ for (const candidate of extractJsonCandidates(raw)) {
27003
+ try {
27004
+ const parsed = JSON.parse(candidate);
27005
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed) || !("ops" in parsed)) continue;
27006
+ const ops = parsed.ops;
27007
+ if (!Array.isArray(ops)) continue;
27008
+ const out = [];
27009
+ let valid = true;
27010
+ for (const item of ops) {
27011
+ const op = asOp(item);
27012
+ if (!op) {
27013
+ valid = false;
27014
+ break;
27015
+ }
27016
+ out.push(op);
27017
+ }
27018
+ if (valid) return out;
27019
+ } catch {
27020
+ continue;
27021
+ }
27022
+ }
27023
+ return null;
27024
+ }
27025
+ function asOp(value) {
27026
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
27027
+ if (!("cardId" in value) || typeof value.cardId !== "string" || value.cardId.length === 0) return null;
27028
+ if (!("evidenceRange" in value)) return null;
27029
+ const range = value.evidenceRange;
27030
+ if (!range || typeof range !== "object" || Array.isArray(range)) return null;
27031
+ if (!("firstKey" in range) || typeof range.firstKey !== "string" || range.firstKey.length === 0) return null;
27032
+ if (!("lastKey" in range) || typeof range.lastKey !== "string" || range.lastKey.length === 0) return null;
27033
+ if ("title" in value && value.title !== void 0 && typeof value.title !== "string") return null;
27034
+ if ("summary" in value && value.summary !== void 0 && typeof value.summary !== "string") return null;
27035
+ if ("categoryId" in value && value.categoryId !== void 0 && typeof value.categoryId !== "string") return null;
27036
+ if ("uncertainty" in value && value.uncertainty !== void 0 && typeof value.uncertainty !== "string") return null;
27037
+ if ("confidence" in value && value.confidence !== void 0 && (typeof value.confidence !== "number" || value.confidence < 0 || value.confidence > 1)) {
27038
+ return null;
27039
+ }
27040
+ return {
27041
+ cardId: value.cardId,
27042
+ title: "title" in value && typeof value.title === "string" ? value.title : void 0,
27043
+ summary: "summary" in value && typeof value.summary === "string" ? value.summary : void 0,
27044
+ categoryId: "categoryId" in value && typeof value.categoryId === "string" ? value.categoryId : void 0,
27045
+ confidence: "confidence" in value && typeof value.confidence === "number" ? value.confidence : void 0,
27046
+ uncertainty: "uncertainty" in value && typeof value.uncertainty === "string" ? value.uncertainty : void 0,
27047
+ evidenceRange: { firstKey: range.firstKey, lastKey: range.lastKey }
27048
+ };
27049
+ }
27050
+ function knownEvidenceKeys(cards, observations) {
27051
+ const keys = /* @__PURE__ */ new Set();
27052
+ for (const observation of observations) keys.add(evidenceKeyOf2(observation));
27053
+ for (const card of cards) {
27054
+ if (card.evidenceRange) {
27055
+ keys.add(card.evidenceRange.firstKey);
27056
+ keys.add(card.evidenceRange.lastKey);
27057
+ }
27058
+ }
27059
+ return keys;
27060
+ }
27061
+ function applyOps(cards, ops, categories, evidenceKeys) {
27062
+ if (ops.length === 0) return cards;
27063
+ const byId = new Map(cards.map((card) => [card.id, card]));
27064
+ const allowedCategories = new Set(categories.map((category) => category.id));
27065
+ const next = /* @__PURE__ */ new Map();
27066
+ for (const op of ops) {
27067
+ const card = byId.get(op.cardId);
27068
+ if (!card) return null;
27069
+ if (!evidenceKeys.has(op.evidenceRange.firstKey) || !evidenceKeys.has(op.evidenceRange.lastKey)) return null;
27070
+ if (op.categoryId !== void 0 && !allowedCategories.has(op.categoryId)) return null;
27071
+ if (card.manualEdit) continue;
27072
+ next.set(card.id, {
27073
+ ...card,
27074
+ ...op.title !== void 0 ? { title: op.title } : {},
27075
+ ...op.summary !== void 0 ? { summary: op.summary } : {},
27076
+ ...op.categoryId !== void 0 ? { categoryId: op.categoryId } : {},
27077
+ ...op.confidence !== void 0 ? { confidence: op.confidence } : {}
27078
+ });
27079
+ }
27080
+ if (next.size === 0) return cards;
27081
+ return cards.map((card) => next.get(card.id) ?? card);
27082
+ }
27083
+ async function analyzeTimelineCards(input) {
27084
+ const cards = input.cards;
27085
+ if (!input.enabled) {
27086
+ return { status: "disabled", cards };
27087
+ }
27088
+ const provider = requiredToken(input.provider, "provider");
27089
+ const model = requiredToken(input.model, "model");
27090
+ const complete = input.complete;
27091
+ if (typeof complete !== "function") {
27092
+ throw new TimelineAnalysisConfigError("complete is required");
27093
+ }
27094
+ const timeoutMs = input.timeoutMs ?? TIMELINE_ANALYSIS_DEFAULT_TIMEOUT_MS;
27095
+ if (!Number.isInteger(timeoutMs) || timeoutMs <= 0) {
27096
+ throw new TimelineAnalysisConfigError("timeoutMs must be a positive integer");
27097
+ }
27098
+ if (input.cards.length === 0 && input.observations.length === 0) {
27099
+ return fail("invalid_output", cards, provider, model);
27100
+ }
27101
+ const categories = input.categories ?? DEFAULT_TIMELINE_CATEGORIES;
27102
+ const ordered = sortObservations(input.observations);
27103
+ const batches = batchObservations(ordered);
27104
+ const merged = /* @__PURE__ */ new Map();
27105
+ try {
27106
+ for (const batch of batches) {
27107
+ const prompt = buildTimelineAnalysisPrompt({
27108
+ date: input.date,
27109
+ timezone: input.timezone,
27110
+ cards: input.cards,
27111
+ observations: batch,
27112
+ categories,
27113
+ preferences: input.preferences,
27114
+ priorEdits: input.priorEdits
27115
+ });
27116
+ const raw = await callComplete(complete, prompt, provider, model, timeoutMs, input.signal);
27117
+ const ops = parseOps(raw);
27118
+ if (!ops) return fail("invalid_output", cards, provider, model);
27119
+ for (const op of ops) merged.set(op.cardId, op);
27120
+ }
27121
+ } catch {
27122
+ return fail("provider_failed", cards, provider, model);
27123
+ }
27124
+ const applied = applyOps(cards, [...merged.values()], categories, knownEvidenceKeys(cards, ordered));
27125
+ if (!applied) return fail("invalid_output", cards, provider, model);
27126
+ log.info(`timeline analysis status=ok provider=${provider} model=${model} promptVersion=${TIMELINE_ANALYSIS_PROMPT_VERSION}`);
27127
+ return {
27128
+ status: "ok",
27129
+ cards: applied,
27130
+ provider,
27131
+ model,
27132
+ promptVersion: TIMELINE_ANALYSIS_PROMPT_VERSION
27133
+ };
27134
+ }
27135
+
27136
+ // src/activity/timeline/recap-export.ts
27137
+ function compareCardIds(a, b) {
27138
+ if (a.id < b.id) return -1;
27139
+ if (a.id > b.id) return 1;
27140
+ return 0;
27141
+ }
27142
+ function exportDeterministicRecap(options) {
27143
+ return {
27144
+ date: options.date,
27145
+ timezone: options.timezone,
27146
+ cards: [...options.cards].sort(compareCardIds)
27147
+ };
27148
+ }
27149
+
27150
+ // src/activity/timeline/recap-markdown.ts
27151
+ function compareCardIds2(a, b) {
27152
+ if (a.id < b.id) return -1;
27153
+ if (a.id > b.id) return 1;
27154
+ return 0;
27155
+ }
27156
+ function renderRecapMarkdown(options) {
27157
+ const cards = [...options.cards].sort(compareCardIds2);
27158
+ const body = cards.length === 0 ? ["(empty)"] : cards.map((card) => `- ${card.id}`);
27159
+ return [`# Recap \u2014 ${options.date} (${options.timezone})`, "", ...body, ""].join("\n");
27160
+ }
27161
+
27162
+ // src/activity/timeline/week-export.ts
27163
+ function compareDates(a, b) {
27164
+ if (a.date < b.date) return -1;
27165
+ if (a.date > b.date) return 1;
27166
+ return 0;
27167
+ }
27168
+ function exportDeterministicWeek(options) {
27169
+ return {
27170
+ weekStart: options.weekStart,
27171
+ timezone: options.timezone,
27172
+ days: [...options.days].sort(compareDates)
27173
+ };
27174
+ }
27175
+
27176
+ // src/activity/timeline/week-snapshot.ts
27177
+ function compareDates2(a, b) {
27178
+ if (a.date < b.date) return -1;
27179
+ if (a.date > b.date) return 1;
27180
+ return 0;
27181
+ }
27182
+ function renderWeekSnapshot(options) {
27183
+ const days = [...options.days].sort(compareDates2);
27184
+ const body = days.length === 0 ? ["## Days", "(empty)"] : days.flatMap((day) => [`## ${day.date}`, "(empty)", ""]);
27185
+ return [
27186
+ "# Week snapshot",
27187
+ "",
27188
+ `- weekStart: ${options.weekStart}`,
27189
+ `- timezone: ${options.timezone}`,
27190
+ "",
27191
+ ...body,
27192
+ ""
27193
+ ].join("\n");
27194
+ }
27195
+
27196
+ // src/activity/timeline/analysis-batch.ts
27197
+ function compareObservations(a, b) {
27198
+ const time = Date.parse(a.capturedAtUtc) - Date.parse(b.capturedAtUtc);
27199
+ if (time !== 0) return time;
27200
+ return a.id - b.id;
27201
+ }
27202
+ function batchObservations2(observations, options) {
27203
+ const { maxBatch, overlap } = options;
27204
+ if (!Number.isInteger(overlap) || overlap < 0) {
27205
+ throw new RangeError("overlap must be a non-negative integer");
27206
+ }
27207
+ if (maxBatch === 0) return [];
27208
+ if (!Number.isInteger(maxBatch) || maxBatch < 1) {
27209
+ throw new RangeError("maxBatch must be 0 or a positive integer");
27210
+ }
27211
+ if (overlap >= maxBatch) {
27212
+ throw new RangeError("overlap must be less than maxBatch");
27213
+ }
27214
+ if (observations.length === 0) return [];
27215
+ const ordered = [...observations].sort(compareObservations);
27216
+ const step = maxBatch - overlap;
27217
+ const batches = [];
27218
+ for (let start = 0; start < ordered.length; start += step) {
27219
+ batches.push(ordered.slice(start, start + maxBatch));
27220
+ if (start + maxBatch >= ordered.length) break;
27221
+ }
27222
+ return batches;
27223
+ }
27224
+
27225
+ // src/activity/timeline/analysis-evidence.ts
27226
+ function boundEvidence(claims, observations) {
27227
+ if (observations.length === 0) return [];
27228
+ const ids = new Set(observations.map((observation) => observation.id));
27229
+ return claims.filter((claim) => ids.has(claim.observationId));
27230
+ }
27231
+
27232
+ // src/activity/timeline/analysis-prompt.ts
27233
+ var INSTRUCTIONS2 = "Use only supplied evidence. Preserve chronology. Do not invent people, places, or tasks. Return strict JSON.";
27234
+ function listedObservation(observation) {
27235
+ return { id: observation.id, capturedAtUtc: observation.capturedAtUtc };
27236
+ }
27237
+ function buildAnalysisPrompt(input) {
27238
+ const listed = [...input.observations].sort((a, b) => a.id - b.id).map(listedObservation);
27239
+ const body = listed.length === 0 ? "(empty)" : JSON.stringify(listed);
27240
+ return `${INSTRUCTIONS2}
27241
+ Observations: ${body}`;
27242
+ }
27243
+
27244
+ // src/activity/timeline/analysis-claim.ts
27245
+ function parseClaimObservationId(claim) {
27246
+ const raw = claim.observationId;
27247
+ if (raw == null) return { ok: false, error: "missing_observation" };
27248
+ const observationId = raw.trim();
27249
+ if (observationId.length === 0) return { ok: false, error: "missing_observation" };
27250
+ return { ok: true, observationId };
27251
+ }
27252
+
27253
+ // src/activity/timeline/analysis-order.ts
27254
+ function sortObservationIds(ids) {
27255
+ return ids.filter((id) => id !== "").sort((a, b) => a.localeCompare(b));
27256
+ }
27257
+
27258
+ // src/activity/journal-vault-read.ts
27259
+ var REMNIC_OPEN = "<!-- remnic:";
27260
+ function readVaultJournal(input) {
27261
+ if (input.fileText === null || input.fileText === void 0) {
27262
+ return { ok: true, exists: false, reason: "missing_file" };
27263
+ }
27264
+ if (input.journalSection.length === 0) {
27265
+ return { ok: true, exists: false, reason: "missing_heading" };
27266
+ }
27267
+ const lines = splitFileLines(input.fileText);
27268
+ const hits = [];
27269
+ const levels = [];
27270
+ for (let i = 0; i < lines.length; i++) {
27271
+ const heading = parseAtxHeading(lines[i]);
27272
+ if (heading && heading.text === input.journalSection) {
27273
+ hits.push(i + 1);
27274
+ levels.push(heading.level);
27275
+ }
27276
+ }
27277
+ if (hits.length === 0) return { ok: true, exists: false, reason: "missing_heading" };
27278
+ if (hits.length > 1) return { ok: false, reason: "duplicate_heading", lines: hits };
27279
+ const headingIndex = hits[0] - 1;
27280
+ const level = levels[0];
27281
+ let endIndex = lines.length;
27282
+ for (let i = headingIndex + 1; i < lines.length; i++) {
27283
+ const heading = parseAtxHeading(lines[i]);
27284
+ if (heading && heading.level <= level) {
27285
+ endIndex = i;
27286
+ break;
27287
+ }
27288
+ }
27289
+ const body = lines.slice(headingIndex + 1, endIndex).join("\n");
27290
+ const stripped = stripRemnicOwnedRegions(body, input.publishSectionNames ?? []);
27291
+ return {
27292
+ ok: true,
27293
+ exists: true,
27294
+ text: trimNewlines(stripped.text),
27295
+ heading: input.journalSection,
27296
+ warnings: stripped.warnings
27297
+ };
27298
+ }
27299
+ function stripRemnicOwnedRegions(text, publishSectionNames = []) {
27300
+ const marked = cutIntervals(text, remnicIntervals(text));
27301
+ return {
27302
+ text: stripPublishHeadings(marked.text, publishSectionNames),
27303
+ warnings: marked.warnings
27304
+ };
27305
+ }
27306
+ function splitFileLines(fileText) {
27307
+ const lines = fileText.split("\n");
27308
+ for (let i = 0; i < lines.length; i++) {
27309
+ const line = lines[i];
27310
+ if (line.endsWith("\r")) lines[i] = line.slice(0, -1);
27311
+ }
27312
+ return lines;
27313
+ }
27314
+ function parseAtxHeading(line) {
27315
+ let level = 0;
27316
+ while (level < line.length && level < 6 && line[level] === "#") level++;
27317
+ if (level === 0) return null;
27318
+ const after = line[level];
27319
+ if (after !== " " && after !== " ") return null;
27320
+ let start = level + 1;
27321
+ let end = line.length;
27322
+ while (start < end && (line[start] === " " || line[start] === " ")) start++;
27323
+ while (end > start && (line[end - 1] === " " || line[end - 1] === " ")) end--;
27324
+ let hashEnd = end;
27325
+ while (hashEnd > start && line[hashEnd - 1] === "#") hashEnd--;
27326
+ if (hashEnd < end && hashEnd > start && (line[hashEnd - 1] === " " || line[hashEnd - 1] === " ")) {
27327
+ end = hashEnd;
27328
+ while (end > start && (line[end - 1] === " " || line[end - 1] === " ")) end--;
27329
+ }
27330
+ return { level, text: line.slice(start, end) };
27331
+ }
27332
+ function remnicIntervals(text) {
27333
+ const starts = [];
27334
+ const ends = [];
27335
+ let from = 0;
27336
+ while (from < text.length) {
27337
+ const open = text.indexOf(REMNIC_OPEN, from);
27338
+ if (open === -1) break;
27339
+ const afterOpen = open + REMNIC_OPEN.length;
27340
+ const commentEnd = text.indexOf("-->", afterOpen);
27341
+ if (commentEnd === -1) break;
27342
+ const inner = text.slice(afterOpen, commentEnd).trim();
27343
+ if (inner.endsWith(":start")) {
27344
+ const name = inner.slice(0, -":start".length);
27345
+ if (name.length > 0) starts.push({ name, start: open, after: commentEnd + 3 });
27346
+ } else if (inner.endsWith(":end")) {
27347
+ const name = inner.slice(0, -":end".length);
27348
+ if (name.length > 0) ends.push({ name, start: open, end: commentEnd + 3 });
27349
+ }
27350
+ from = commentEnd + 3;
27351
+ }
27352
+ const usedEnds = /* @__PURE__ */ new Set();
27353
+ const intervals = [];
27354
+ const warnings = [];
27355
+ for (const start of starts) {
27356
+ const match = ends.find((end) => end.name === start.name && end.start >= start.after && !usedEnds.has(end.start));
27357
+ if (match) {
27358
+ usedEnds.add(match.start);
27359
+ intervals.push({ start: start.start, end: eatTrailingNewline(text, match.end) });
27360
+ } else {
27361
+ intervals.push({ start: start.start, end: text.length });
27362
+ warnings.push(`unclosed remnic region "${start.name}"`);
27363
+ }
27364
+ }
27365
+ for (const end of ends) {
27366
+ if (usedEnds.has(end.start)) continue;
27367
+ const startBefore = starts.some((start) => start.start < end.start);
27368
+ if (!startBefore) intervals.push({ start: 0, end: eatTrailingNewline(text, end.end) });
27369
+ }
27370
+ return { intervals: mergeIntervals2(intervals), warnings };
27371
+ }
27372
+ function eatTrailingNewline(text, index) {
27373
+ if (text[index] === "\n") return index + 1;
27374
+ if (text[index] === "\r" && text[index + 1] === "\n") return index + 2;
27375
+ if (text[index] === "\r") return index + 1;
27376
+ return index;
27377
+ }
27378
+ function mergeIntervals2(items) {
27379
+ if (items.length === 0) return [];
27380
+ const sorted = items.slice().sort((a, b) => a.start - b.start || a.end - b.end);
27381
+ const out = [{ start: sorted[0].start, end: sorted[0].end }];
27382
+ for (let i = 1; i < sorted.length; i++) {
27383
+ const cur = sorted[i];
27384
+ const last = out[out.length - 1];
27385
+ if (cur.start <= last.end) last.end = Math.max(last.end, cur.end);
27386
+ else out.push({ start: cur.start, end: cur.end });
27387
+ }
27388
+ return out;
27389
+ }
27390
+ function cutIntervals(text, found) {
27391
+ let out = "";
27392
+ let pos = 0;
27393
+ for (const interval of found.intervals) {
27394
+ if (interval.start > pos) out += text.slice(pos, interval.start);
27395
+ pos = Math.max(pos, interval.end);
27396
+ }
27397
+ if (pos < text.length) out += text.slice(pos);
27398
+ return { text: out, warnings: found.warnings };
27399
+ }
27400
+ function stripPublishHeadings(text, names) {
27401
+ if (names.length === 0 || text.length === 0) return text;
27402
+ const lines = text.split("\n");
27403
+ const keep = lines.map(() => true);
27404
+ for (let i = 0; i < lines.length; i++) {
27405
+ if (!keep[i]) continue;
27406
+ const heading = parseAtxHeading(lines[i]);
27407
+ if (!heading || !names.includes(heading.text)) continue;
27408
+ keep[i] = false;
27409
+ for (let j = i + 1; j < lines.length; j++) {
27410
+ const next = parseAtxHeading(lines[j]);
27411
+ if (next && next.level <= heading.level) break;
27412
+ keep[j] = false;
27413
+ }
27414
+ }
27415
+ return lines.filter((_, i) => keep[i]).join("\n");
27416
+ }
27417
+ function trimNewlines(text) {
27418
+ let start = 0;
27419
+ let end = text.length;
27420
+ while (start < end && (text[start] === "\n" || text[start] === "\r")) start++;
27421
+ while (end > start && (text[end - 1] === "\n" || text[end - 1] === "\r")) end--;
27422
+ return text.slice(start, end);
27423
+ }
27424
+
26631
27425
  // src/activity/memory-gen.ts
26632
27426
  var ACTIVITY_ALLOWED_CATEGORIES = {
26633
27427
  decision: true,
@@ -26932,10 +27726,296 @@ function observationsForExport(observations, policy) {
26932
27726
  return observations;
26933
27727
  }
26934
27728
 
27729
+ // src/activity/privacy-window.ts
27730
+ function filterPrivacyWindow(items, options) {
27731
+ const { fromMs, toMs, retainDays } = options;
27732
+ if (toMs <= fromMs) return [];
27733
+ return items.filter((item) => {
27734
+ const capturedAtMs = item.capturedAtMs;
27735
+ if (capturedAtMs < fromMs || capturedAtMs >= toMs) return false;
27736
+ return shouldRetain(capturedAtMs, toMs, retainDays);
27737
+ });
27738
+ }
27739
+
27740
+ // src/activity/vault-path.ts
27741
+ import path34 from "path";
27742
+ var TOKEN_RE = /\{yyyy\}|\{yy\}|\{MM\}|\{dd\}|\{M\}|\{d\}|\{ww\}/g;
27743
+ function resolveVaultNotePath(template, date, options) {
27744
+ if (!isValidActivityDate(date)) {
27745
+ throw new RangeError(`Invalid vault date "${date}"; expected YYYY-MM-DD.`);
27746
+ }
27747
+ if (options?.timezone !== void 0) {
27748
+ assertValidTimezone(options.timezone);
27749
+ }
27750
+ if (typeof template !== "string" || template.length === 0) {
27751
+ throw new RangeError("Vault note path template must be a non-empty relative path.");
27752
+ }
27753
+ if (path34.posix.isAbsolute(template) || path34.win32.isAbsolute(template)) {
27754
+ throw new RangeError("Vault note path template must be relative; absolute templates are rejected.");
27755
+ }
27756
+ const [yyyy, mm, dd] = date.split("-");
27757
+ const tokens = {
27758
+ "{yyyy}": yyyy,
27759
+ "{yy}": yyyy.slice(2),
27760
+ "{MM}": mm,
27761
+ "{dd}": dd,
27762
+ "{M}": String(Number(mm)),
27763
+ "{d}": String(Number(dd)),
27764
+ "{ww}": isoWeekNumber(date)
27765
+ };
27766
+ const expanded = template.replace(TOKEN_RE, (token) => tokens[token] ?? token);
27767
+ if (expanded.split(/[\\/]/).some((segment) => segment === "..")) {
27768
+ throw new RangeError("Vault note path template must not contain `..` segments.");
27769
+ }
27770
+ if (path34.posix.isAbsolute(expanded) || path34.win32.isAbsolute(expanded)) {
27771
+ throw new RangeError("Vault note path template must be relative; absolute templates are rejected.");
27772
+ }
27773
+ return expanded;
27774
+ }
27775
+ function isoWeekNumber(date) {
27776
+ const [year, month, day] = date.split("-").map(Number);
27777
+ const utc = new Date(Date.UTC(year, month - 1, day));
27778
+ const dayNum = utc.getUTCDay() || 7;
27779
+ utc.setUTCDate(utc.getUTCDate() + 4 - dayNum);
27780
+ const yearStart = new Date(Date.UTC(utc.getUTCFullYear(), 0, 1));
27781
+ const weekNo = Math.ceil(((utc.getTime() - yearStart.getTime()) / 864e5 + 1) / 7);
27782
+ return String(weekNo).padStart(2, "0");
27783
+ }
27784
+
27785
+ // src/activity/vault-publish.ts
27786
+ import { createHash as createHash10, randomBytes as randomBytes4 } from "crypto";
27787
+ import { readFileSync as readFileSync3, renameSync as renameSync2, statSync as statSync2, unlinkSync as unlinkSync2, writeFileSync as writeFileSync2 } from "fs";
27788
+ import path35 from "path";
27789
+ function applyManagedRegion(fileText, opts) {
27790
+ if (opts.strategy === "heading") return applyHeadingRegion(fileText, opts.name, opts.content);
27791
+ const startMarker = `<!-- remnic:${opts.name}:start -->`;
27792
+ const endMarker = `<!-- remnic:${opts.name}:end -->`;
27793
+ const startIdx = fileText.indexOf(startMarker);
27794
+ if (startIdx === -1) return { ok: false, reason: "no_marker", text: fileText };
27795
+ const endIdx = fileText.indexOf(endMarker, startIdx + startMarker.length);
27796
+ if (endIdx === -1) return { ok: false, reason: "no_marker", text: fileText };
27797
+ const { body, eol } = ownedBody(fileText, opts.content);
27798
+ return {
27799
+ ok: true,
27800
+ text: `${fileText.slice(0, startIdx + startMarker.length)}${eol}${body}${eol}${fileText.slice(endIdx)}`
27801
+ };
27802
+ }
27803
+ function applyHeadingRegion(fileText, name, content) {
27804
+ const wanted = name.trim();
27805
+ const hits = [];
27806
+ for (const row of fileLines(fileText)) {
27807
+ const heading = parseAtxHeading2(row.line);
27808
+ if (heading && heading.text === wanted) {
27809
+ hits.push({ line: row.number, level: heading.level, next: row.next });
27810
+ }
27811
+ }
27812
+ if (hits.length === 0) return { ok: false, reason: "no_heading", text: fileText };
27813
+ if (hits.length > 1) {
27814
+ return { ok: false, reason: "duplicate_heading", lines: hits.map((hit2) => hit2.line), text: fileText };
27815
+ }
27816
+ const hit = hits[0];
27817
+ let sectionEnd = fileText.length;
27818
+ for (const row of fileLines(fileText)) {
27819
+ if (row.start < hit.next) continue;
27820
+ const heading = parseAtxHeading2(row.line);
27821
+ if (heading && heading.level <= hit.level) {
27822
+ sectionEnd = row.start;
27823
+ break;
27824
+ }
27825
+ }
27826
+ const { body, eol } = ownedBody(fileText, content);
27827
+ const prefix = hit.next === fileText.length && !fileText.endsWith("\n") && !fileText.endsWith("\r") ? `${fileText}${eol}` : fileText.slice(0, hit.next);
27828
+ return { ok: true, text: `${prefix}${body}${eol}${fileText.slice(sectionEnd)}` };
27829
+ }
27830
+ function ownedBody(fileText, content) {
27831
+ const eol = fileText.includes("\r\n") ? "\r\n" : "\n";
27832
+ let body = content.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
27833
+ if (eol === "\r\n") body = body.replace(/\n/g, "\r\n");
27834
+ if (body.endsWith(eol)) body = body.slice(0, -eol.length);
27835
+ return { body, eol };
27836
+ }
27837
+ function fileLines(fileText) {
27838
+ const rows = [];
27839
+ let start = 0;
27840
+ let number = 1;
27841
+ while (start < fileText.length) {
27842
+ let i = start;
27843
+ while (i < fileText.length && fileText[i] !== "\n" && fileText[i] !== "\r") i++;
27844
+ let next = i;
27845
+ if (fileText[i] === "\r" && fileText[i + 1] === "\n") next = i + 2;
27846
+ else if (fileText[i] === "\n" || fileText[i] === "\r") next = i + 1;
27847
+ else next = fileText.length;
27848
+ rows.push({ line: fileText.slice(start, i), start, next, number });
27849
+ number += 1;
27850
+ start = next;
27851
+ }
27852
+ return rows;
27853
+ }
27854
+ function parseAtxHeading2(line) {
27855
+ let level = 0;
27856
+ while (level < line.length && level < 6 && line[level] === "#") level++;
27857
+ if (level === 0) return null;
27858
+ const after = line[level];
27859
+ if (after !== " " && after !== " ") return null;
27860
+ let start = level + 1;
27861
+ let end = line.length;
27862
+ while (start < end && (line[start] === " " || line[start] === " ")) start++;
27863
+ while (end > start && (line[end - 1] === " " || line[end - 1] === " ")) end--;
27864
+ let hashEnd = end;
27865
+ while (hashEnd > start && line[hashEnd - 1] === "#") hashEnd--;
27866
+ if (hashEnd < end && hashEnd > start && (line[hashEnd - 1] === " " || line[hashEnd - 1] === " ")) {
27867
+ end = hashEnd;
27868
+ while (end > start && (line[end - 1] === " " || line[end - 1] === " ")) end--;
27869
+ }
27870
+ return { level, text: line.slice(start, end) };
27871
+ }
27872
+ function publishVaultRegion(input) {
27873
+ const vault = expandTildePath(input.vaultPath);
27874
+ try {
27875
+ if (!statSync2(vault).isDirectory()) return { ok: false, reason: "not_directory" };
27876
+ } catch {
27877
+ return { ok: false, reason: "not_directory" };
27878
+ }
27879
+ if (input.relativeFile.length === 0 || path35.isAbsolute(input.relativeFile)) {
27880
+ return { ok: false, reason: "missing_file" };
27881
+ }
27882
+ const root = path35.resolve(vault);
27883
+ const dest = path35.resolve(root, input.relativeFile);
27884
+ const rel = path35.relative(root, dest);
27885
+ if (rel.length === 0 || rel.startsWith("..") || path35.isAbsolute(rel)) {
27886
+ return { ok: false, reason: "missing_file" };
27887
+ }
27888
+ let existing;
27889
+ try {
27890
+ if (!statSync2(dest).isFile()) return { ok: false, reason: "missing_file" };
27891
+ existing = readFileSync3(dest, "utf8");
27892
+ } catch (err) {
27893
+ if (err.code === "ENOENT") return { ok: false, reason: "missing_file" };
27894
+ throw err;
27895
+ }
27896
+ const applied = applyManagedRegion(existing, {
27897
+ strategy: "markers",
27898
+ name: input.name,
27899
+ content: input.content
27900
+ });
27901
+ if (!applied.ok) return { ok: false, reason: "no_marker" };
27902
+ const prevHash = createHash10("sha256").update(existing, "utf8").digest("hex");
27903
+ const nextHash = createHash10("sha256").update(applied.text, "utf8").digest("hex");
27904
+ if (prevHash === nextHash) return { ok: true, status: "unchanged" };
27905
+ const tmpPath = path35.join(path35.dirname(dest), `.remnic-vault-${randomBytes4(8).toString("hex")}.tmp`);
27906
+ writeFileSync2(tmpPath, applied.text);
27907
+ try {
27908
+ renameSync2(tmpPath, dest);
27909
+ } catch (renameErr) {
27910
+ try {
27911
+ unlinkSync2(tmpPath);
27912
+ } catch {
27913
+ }
27914
+ throw renameErr;
27915
+ }
27916
+ return { ok: true, status: "updated" };
27917
+ }
27918
+
27919
+ // src/activity/vault-frontmatter.ts
27920
+ function assertNoNewlineKey(key) {
27921
+ if (key.includes("\n") || key.includes("\r")) {
27922
+ throw new RangeError("Vault frontmatter keys must not contain newlines.");
27923
+ }
27924
+ }
27925
+ function applyVaultFrontmatter(existingYaml, updates) {
27926
+ const entries = Object.entries(updates);
27927
+ if (entries.length === 0) return existingYaml;
27928
+ const merged = /* @__PURE__ */ new Map();
27929
+ for (const line of existingYaml.split("\n")) {
27930
+ const idx = line.indexOf(":");
27931
+ if (idx === -1) continue;
27932
+ const key = line.slice(0, idx).trim();
27933
+ if (key.length === 0) continue;
27934
+ assertNoNewlineKey(key);
27935
+ merged.set(key, line.slice(idx + 1).trim());
27936
+ }
27937
+ for (const [key, value] of entries) {
27938
+ assertNoNewlineKey(key);
27939
+ merged.set(key, value);
27940
+ }
27941
+ return [...merged.keys()].sort((a, b) => a < b ? -1 : a > b ? 1 : 0).map((key) => `${key}: ${merged.get(key)}`).join("\n");
27942
+ }
27943
+
27944
+ // src/activity/vault-wikilink.ts
27945
+ import path36 from "path";
27946
+ function formatVaultWikilink(notePath) {
27947
+ if (typeof notePath !== "string" || notePath.trim().length === 0) {
27948
+ throw new RangeError("Vault wikilink path must be a non-empty relative path.");
27949
+ }
27950
+ if (notePath.includes("\n") || notePath.includes("\r")) {
27951
+ throw new RangeError("Vault wikilink path must not contain newlines.");
27952
+ }
27953
+ if (path36.posix.isAbsolute(notePath) || path36.win32.isAbsolute(notePath)) {
27954
+ throw new RangeError("Vault wikilink path must be relative; absolute paths are rejected.");
27955
+ }
27956
+ if (notePath.split(/[\\/]/).some((segment) => segment === "..")) {
27957
+ throw new RangeError("Vault wikilink path must not contain `..` segments.");
27958
+ }
27959
+ const stripped = notePath.endsWith(".md") ? notePath.slice(0, -3) : notePath;
27960
+ if (stripped.length === 0) {
27961
+ throw new RangeError("Vault wikilink path must be a non-empty relative path.");
27962
+ }
27963
+ return `[[${stripped}]]`;
27964
+ }
27965
+
27966
+ // src/activity/vault-region.ts
27967
+ function validateRegionName(name) {
27968
+ if (typeof name !== "string") {
27969
+ return { ok: false, error: "invalid_name" };
27970
+ }
27971
+ if (name.includes("\n") || name.includes("\r") || name.includes("-->")) {
27972
+ return { ok: false, error: "invalid_name" };
27973
+ }
27974
+ const trimmed = name.trim();
27975
+ if (trimmed.length === 0) {
27976
+ return { ok: false, error: "invalid_name" };
27977
+ }
27978
+ return { ok: true, name: trimmed };
27979
+ }
27980
+
27981
+ // src/activity/vault-suffix.ts
27982
+ function stripVaultMdSuffix(notePath) {
27983
+ if (typeof notePath !== "string" || notePath.length === 0) {
27984
+ throw new RangeError("Vault path must be non-empty.");
27985
+ }
27986
+ return notePath.endsWith(".md") ? notePath.slice(0, -3) : notePath;
27987
+ }
27988
+
27989
+ // src/activity/vault-join.ts
27990
+ import path37 from "path";
27991
+ function joinVaultSegments(parts) {
27992
+ if (parts.length === 0) {
27993
+ throw new RangeError("Vault path parts must be a non-empty list.");
27994
+ }
27995
+ for (const part of parts) {
27996
+ if (typeof part !== "string" || part.length === 0) {
27997
+ throw new RangeError("Vault path part must be non-empty.");
27998
+ }
27999
+ if (part.includes("\\")) {
28000
+ throw new RangeError("Vault path part must not contain a backslash.");
28001
+ }
28002
+ if (part.includes("\n") || part.includes("\r")) {
28003
+ throw new RangeError("Vault path part must not contain a newline.");
28004
+ }
28005
+ if (path37.posix.isAbsolute(part) || path37.win32.isAbsolute(part)) {
28006
+ throw new RangeError("Vault path part must be relative.");
28007
+ }
28008
+ if (part.split("/").includes("..")) {
28009
+ throw new RangeError("Vault path part must not contain `..`.");
28010
+ }
28011
+ }
28012
+ return parts.join("/");
28013
+ }
28014
+
26935
28015
  // src/session-summaries/index.ts
26936
- import { createHash as createHash10 } from "crypto";
28016
+ import { createHash as createHash11 } from "crypto";
26937
28017
  import { lstat as lstat3, mkdir as mkdir7, readFile as readFile7, readdir as readdir4, rename, rm, stat as stat4, writeFile as writeFile7 } from "fs/promises";
26938
- import path33 from "path";
28018
+ import path38 from "path";
26939
28019
 
26940
28020
  // src/session-summaries/adapters.ts
26941
28021
  var VALID_ROLES = /* @__PURE__ */ new Set(["user", "assistant", "tool", "system", "other"]);
@@ -27435,12 +28515,12 @@ var DEFAULT_MAX_FILES = 5e3;
27435
28515
  var DEFAULT_MAX_SESSIONS = 500;
27436
28516
  var SUPPORTED_EXTENSIONS = /* @__PURE__ */ new Set([".json", ".jsonl"]);
27437
28517
  function shortHash(value, length = 16) {
27438
- return createHash10("sha256").update(value).digest("hex").slice(0, length);
28518
+ return createHash11("sha256").update(value).digest("hex").slice(0, length);
27439
28519
  }
27440
28520
  async function listTranscriptFiles(root, maxFiles) {
27441
28521
  const out = [];
27442
28522
  let truncated = false;
27443
- const entrySortKey = (entryName, isDirectory) => isDirectory ? `${entryName}${path33.sep}` : entryName;
28523
+ const entrySortKey = (entryName, isDirectory) => isDirectory ? `${entryName}${path38.sep}` : entryName;
27444
28524
  async function visit(dir) {
27445
28525
  if (truncated) return;
27446
28526
  const entries = (await readdir4(dir, { withFileTypes: true })).sort(
@@ -27450,13 +28530,13 @@ async function listTranscriptFiles(root, maxFiles) {
27450
28530
  if (truncated) return;
27451
28531
  if (entry.name.startsWith(".")) continue;
27452
28532
  if (entry.isSymbolicLink()) continue;
27453
- const fullPath = path33.join(dir, entry.name);
28533
+ const fullPath = path38.join(dir, entry.name);
27454
28534
  if (entry.isDirectory()) {
27455
28535
  await visit(fullPath);
27456
28536
  continue;
27457
28537
  }
27458
28538
  if (!entry.isFile()) continue;
27459
- const ext = path33.extname(entry.name).toLowerCase();
28539
+ const ext = path38.extname(entry.name).toLowerCase();
27460
28540
  if (!SUPPORTED_EXTENSIONS.has(ext)) continue;
27461
28541
  out.push(fullPath);
27462
28542
  if (out.length > maxFiles) {
@@ -27483,7 +28563,7 @@ function normalizeInputDir(inputDir) {
27483
28563
  if (typeof inputDir !== "string" || inputDir.trim().length === 0) {
27484
28564
  throw new Error("inputDir must be a non-empty string");
27485
28565
  }
27486
- return path33.resolve(expandTildePath(inputDir.trim()));
28566
+ return path38.resolve(expandTildePath(inputDir.trim()));
27487
28567
  }
27488
28568
  function initRoleCounts() {
27489
28569
  return {
@@ -27640,11 +28720,11 @@ async function collectLocalSessionSummaries(options) {
27640
28720
  continue;
27641
28721
  }
27642
28722
  seenFileHashes.add(fileHash);
27643
- const fileExtension = path33.extname(filePath).toLowerCase();
28723
+ const fileExtension = path38.extname(filePath).toLowerCase();
27644
28724
  const parsed = await adapter.parseFile(
27645
28725
  {
27646
28726
  content,
27647
- fileName: path33.basename(filePath),
28727
+ fileName: path38.basename(filePath),
27648
28728
  fileExtension,
27649
28729
  fileRef: fileHash
27650
28730
  },
@@ -27700,7 +28780,7 @@ async function collectLocalSessionSummaries(options) {
27700
28780
  }
27701
28781
  async function readRedactionConfig(pathLike) {
27702
28782
  if (!pathLike) return void 0;
27703
- const raw = await readFile7(path33.resolve(expandTildePath(pathLike)), "utf-8");
28783
+ const raw = await readFile7(path38.resolve(expandTildePath(pathLike)), "utf-8");
27704
28784
  const parsed = JSON.parse(raw);
27705
28785
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
27706
28786
  throw new Error("redaction config must be a JSON object");
@@ -27713,15 +28793,15 @@ function toJsonl(drafts) {
27713
28793
  }
27714
28794
  function defaultDraftOutputPath(memoryDir, generatedAt) {
27715
28795
  const stamp = generatedAt.replace(/[:.]/g, "-");
27716
- return path33.join(
27717
- path33.resolve(expandTildePath(memoryDir)),
28796
+ return path38.join(
28797
+ path38.resolve(expandTildePath(memoryDir)),
27718
28798
  "state",
27719
28799
  "session-summary-drafts",
27720
28800
  `session-summaries-${stamp}.jsonl`
27721
28801
  );
27722
28802
  }
27723
28803
  async function writeDrafts(filePath, drafts) {
27724
- await mkdir7(path33.dirname(filePath), { recursive: true });
28804
+ await mkdir7(path38.dirname(filePath), { recursive: true });
27725
28805
  const tempPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
27726
28806
  try {
27727
28807
  await writeFile7(tempPath, toJsonl(drafts), "utf-8");
@@ -27739,7 +28819,7 @@ async function runLocalSessionSummaryCliCommand(options) {
27739
28819
  });
27740
28820
  const wroteFiles = [];
27741
28821
  if (options.output) {
27742
- const outputPath = path33.resolve(expandTildePath(options.output));
28822
+ const outputPath = path38.resolve(expandTildePath(options.output));
27743
28823
  await writeDrafts(outputPath, report.drafts);
27744
28824
  wroteFiles.push(outputPath);
27745
28825
  }
@@ -27774,19 +28854,19 @@ async function runLocalSessionSummaryCliCommand(options) {
27774
28854
 
27775
28855
  // src/transfer/capsule-fork.ts
27776
28856
  import { lstat as lstat4, mkdir as mkdir8, readFile as readFile8, realpath as realpath3, writeFile as writeFile8 } from "fs/promises";
27777
- import path34 from "path";
28857
+ import path39 from "path";
27778
28858
  async function forkCapsule(opts) {
27779
28859
  validateForkId(opts.forkId);
27780
- const rootAbs = path34.resolve(opts.targetRoot);
28860
+ const rootAbs = path39.resolve(opts.targetRoot);
27781
28861
  await assertIsDirectoryNotSymlink(rootAbs, "forkCapsule", "targetRoot");
27782
- const forkDirAbs = path34.join(rootAbs, "forks", opts.forkId);
28862
+ const forkDirAbs = path39.join(rootAbs, "forks", opts.forkId);
27783
28863
  const forkEntryExists = await pathEntryExists(forkDirAbs);
27784
28864
  if (forkEntryExists) {
27785
28865
  throw new Error(
27786
28866
  `forkCapsule: fork path already exists \u2014 forkId "${opts.forkId}" is already in use at: ${forkDirAbs}`
27787
28867
  );
27788
28868
  }
27789
- const archiveAbs = path34.resolve(opts.sourceArchive);
28869
+ const archiveAbs = path39.resolve(opts.sourceArchive);
27790
28870
  const importResult = await importCapsule({
27791
28871
  archivePath: archiveAbs,
27792
28872
  root: rootAbs,
@@ -27808,10 +28888,10 @@ async function forkCapsule(opts) {
27808
28888
  importedRecords: importResult.imported.length,
27809
28889
  skippedRecords: importResult.skipped.length
27810
28890
  };
27811
- const lineagePath = path34.join(forkDirAbs, "lineage.json");
28891
+ const lineagePath = path39.join(forkDirAbs, "lineage.json");
27812
28892
  const rootReal = await realpath3(rootAbs);
27813
28893
  await assertRealpathInsideRoot(rootReal, lineagePath, `forks/${opts.forkId}/lineage.json`, "forkCapsule");
27814
- await mkdir8(path34.dirname(lineagePath), { recursive: true });
28894
+ await mkdir8(path39.dirname(lineagePath), { recursive: true });
27815
28895
  await writeFile8(lineagePath, JSON.stringify(lineage, null, 2) + "\n", "utf-8");
27816
28896
  return {
27817
28897
  archivePath: archiveAbs,
@@ -27825,11 +28905,11 @@ async function readForkLineage(targetRoot, forkId) {
27825
28905
  if (typeof forkId !== "string" || forkId.length === 0 || forkId.length > 64 || !CAPSULE_ID_PATTERN.test(forkId)) {
27826
28906
  return null;
27827
28907
  }
27828
- const rootAbs = path34.resolve(targetRoot);
28908
+ const rootAbs = path39.resolve(targetRoot);
27829
28909
  const rootReal = await realpath3(rootAbs).catch(() => rootAbs);
27830
- const lineagePath = path34.join(rootReal, "forks", forkId, "lineage.json");
27831
- const rel = path34.relative(rootReal, lineagePath);
27832
- if (rel.startsWith("..") || path34.isAbsolute(rel)) {
28910
+ const lineagePath = path39.join(rootReal, "forks", forkId, "lineage.json");
28911
+ const rel = path39.relative(rootReal, lineagePath);
28912
+ if (rel.startsWith("..") || path39.isAbsolute(rel)) {
27833
28913
  return null;
27834
28914
  }
27835
28915
  if (!await isLineagePathContained(rootReal, lineagePath)) {
@@ -27870,19 +28950,19 @@ async function pathEntryExists(absPath) {
27870
28950
  async function isLineagePathContained(rootReal, lineagePath) {
27871
28951
  let existing = lineagePath;
27872
28952
  const suffix = [];
27873
- while (existing !== path34.dirname(existing)) {
28953
+ while (existing !== path39.dirname(existing)) {
27874
28954
  const st = await lstat4(existing).catch(() => null);
27875
28955
  if (st !== null) break;
27876
- suffix.unshift(path34.basename(existing));
27877
- existing = path34.dirname(existing);
28956
+ suffix.unshift(path39.basename(existing));
28957
+ existing = path39.dirname(existing);
27878
28958
  }
27879
28959
  const existingReal = await realpath3(existing).catch(() => existing);
27880
- const targetReal = suffix.length > 0 ? path34.join(existingReal, ...suffix) : existingReal;
27881
- const rel = path34.relative(rootReal, targetReal);
28960
+ const targetReal = suffix.length > 0 ? path39.join(existingReal, ...suffix) : existingReal;
28961
+ const rel = path39.relative(rootReal, targetReal);
27882
28962
  if (rel === "") return true;
27883
28963
  if (rel === "..") return false;
27884
- if (rel.startsWith(`..${path34.sep}`)) return false;
27885
- if (path34.isAbsolute(rel)) return false;
28964
+ if (rel.startsWith(`..${path39.sep}`)) return false;
28965
+ if (path39.isAbsolute(rel)) return false;
27886
28966
  return true;
27887
28967
  }
27888
28968
 
@@ -27986,12 +29066,46 @@ export {
27986
29066
  queryTimelineSearch,
27987
29067
  runTimelineCliCommand,
27988
29068
  renderDeterministicJournal,
29069
+ persistDeterministicJournal,
29070
+ WEEKLY_ACTIVITY_FORMAT_VERSION,
29071
+ buildWeeklyActivitySummary,
29072
+ WEEKLY_SNAPSHOT_FORMAT_VERSION,
29073
+ WEEKLY_SNAPSHOT_DIR,
29074
+ weeklySnapshotPath,
29075
+ persistWeeklySnapshot,
29076
+ TIMELINE_ANALYSIS_PROMPT_VERSION,
29077
+ TIMELINE_ANALYSIS_BATCH_SIZE,
29078
+ TIMELINE_ANALYSIS_BATCH_OVERLAP,
29079
+ TIMELINE_ANALYSIS_DEFAULT_TIMEOUT_MS,
29080
+ TimelineAnalysisConfigError,
29081
+ buildTimelineAnalysisPrompt,
29082
+ analyzeTimelineCards,
29083
+ exportDeterministicRecap,
29084
+ renderRecapMarkdown,
29085
+ exportDeterministicWeek,
29086
+ renderWeekSnapshot,
29087
+ batchObservations2 as batchObservations,
29088
+ boundEvidence,
29089
+ buildAnalysisPrompt,
29090
+ parseClaimObservationId,
29091
+ sortObservationIds,
29092
+ readVaultJournal,
29093
+ stripRemnicOwnedRegions,
27989
29094
  isEligibleActivityFact,
27990
29095
  generateActivityMemories,
27991
29096
  MS_PER_DAY2 as MS_PER_DAY,
27992
29097
  parseActivityPrivacy,
27993
29098
  shouldRetain,
27994
29099
  observationsForExport,
29100
+ filterPrivacyWindow,
29101
+ resolveVaultNotePath,
29102
+ applyManagedRegion,
29103
+ publishVaultRegion,
29104
+ applyVaultFrontmatter,
29105
+ formatVaultWikilink,
29106
+ validateRegionName,
29107
+ stripVaultMdSuffix,
29108
+ joinVaultSegments,
27995
29109
  fuseMeeting,
27996
29110
  buildMeetingRecordsForDay,
27997
29111
  MeetingsBuilder,
@@ -28025,4 +29139,4 @@ export {
28025
29139
  blendGraphExpandedRecallScore,
28026
29140
  Orchestrator
28027
29141
  };
28028
- //# sourceMappingURL=chunk-TCF4MU7L.js.map
29142
+ //# sourceMappingURL=chunk-3PO35HUU.js.map