@remnic/core 9.66.0 → 9.66.2

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 (575) hide show
  1. package/dist/access-admin-ops-surface.d.ts +11 -11
  2. package/dist/access-admin-ops-surface.js +31 -31
  3. package/dist/access-audit.js +2 -2
  4. package/dist/access-authorization-probe.d.ts +11 -11
  5. package/dist/access-authorization-probe.js +32 -32
  6. package/dist/access-boundary.d.ts +11 -11
  7. package/dist/access-boundary.js +31 -31
  8. package/dist/access-cli.js +105 -101
  9. package/dist/access-cli.js.map +1 -1
  10. package/dist/access-coding-context-resolution.d.ts +1 -1
  11. package/dist/access-extraction-force-flush.d.ts +11 -11
  12. package/dist/access-extraction-force-flush.js +31 -31
  13. package/dist/access-health-types.d.ts +1 -1
  14. package/dist/access-http-lcm-compaction.d.ts +11 -11
  15. package/dist/access-http-lifecycle-flush.d.ts +11 -11
  16. package/dist/access-http-offline-stream.d.ts +11 -11
  17. package/dist/access-http-query.d.ts +2 -2
  18. package/dist/access-http-query.js +33 -33
  19. package/dist/access-http.d.ts +12 -12
  20. package/dist/access-http.js +48 -48
  21. package/dist/access-identity-continuity-surface.d.ts +9 -9
  22. package/dist/access-identity-continuity-surface.js +31 -31
  23. package/dist/access-lcm-surface.d.ts +11 -11
  24. package/dist/access-lcm-surface.js +31 -31
  25. package/dist/access-mcp.d.ts +11 -11
  26. package/dist/access-mcp.js +39 -39
  27. package/dist/access-memory-search-fanout.d.ts +2 -2
  28. package/dist/{access-namespace-preflight-CLWUoMyW.d.ts → access-namespace-preflight-50VIkPhB.d.ts} +1 -1
  29. package/dist/access-namespace-preflight.d.ts +3 -3
  30. package/dist/access-namespace-preflight.js +31 -31
  31. package/dist/access-observe-write-surface.d.ts +11 -11
  32. package/dist/access-observe-write-surface.js +31 -31
  33. package/dist/access-offline-manifest.d.ts +9 -9
  34. package/dist/access-operations-batch.js +34 -34
  35. package/dist/access-operations.d.ts +11 -11
  36. package/dist/access-operations.js +38 -38
  37. package/dist/access-recall-concurrency.d.ts +11 -11
  38. package/dist/access-recall-concurrency.js +31 -31
  39. package/dist/access-recall-response.d.ts +11 -11
  40. package/dist/access-recall-response.js +31 -31
  41. package/dist/access-recall-surface.d.ts +11 -11
  42. package/dist/access-recall-surface.js +31 -31
  43. package/dist/access-schema.js +3 -3
  44. package/dist/{access-service-CEUE1Isj.d.ts → access-service-Dz6I9AZ-.d.ts} +13 -13
  45. package/dist/access-service-helpers.d.ts +11 -11
  46. package/dist/access-service.d.ts +11 -11
  47. package/dist/access-service.js +31 -31
  48. package/dist/access-surface-catalog.d.ts +11 -11
  49. package/dist/access-surface-catalog.js +33 -33
  50. package/dist/access-wearables-meetings-surface.d.ts +3 -3
  51. package/dist/action-confidence.d.ts +1 -1
  52. package/dist/active-memory-bridge.d.ts +1 -1
  53. package/dist/active-recall.d.ts +1 -1
  54. package/dist/active-recall.js +4 -4
  55. package/dist/adapters/index.js +4 -4
  56. package/dist/adapters/registry.js +2 -2
  57. package/dist/ambient-provenance.d.ts +1 -1
  58. package/dist/artifact-search.d.ts +1 -1
  59. package/dist/behavior-learner.d.ts +1 -1
  60. package/dist/behavior-signals.d.ts +1 -1
  61. package/dist/bootstrap.d.ts +9 -9
  62. package/dist/briefing-window.d.ts +2 -2
  63. package/dist/briefing.d.ts +2 -2
  64. package/dist/briefing.js +10 -10
  65. package/dist/buffer-surprise-report.d.ts +1 -1
  66. package/dist/buffer-turn-helpers.d.ts +1 -1
  67. package/dist/buffer.d.ts +2 -2
  68. package/dist/buffer.js +4 -4
  69. package/dist/bulk-import/index.d.ts +3 -3
  70. package/dist/calibration.d.ts +1 -1
  71. package/dist/capabilities.d.ts +1 -1
  72. package/dist/{catalog-D1HgugTA.d.ts → catalog-C2jA-gLm.d.ts} +1 -1
  73. package/dist/causal-behavior.d.ts +1 -1
  74. package/dist/causal-behavior.js +2 -2
  75. package/dist/causal-chain.js +2 -2
  76. package/dist/causal-consolidation.d.ts +1 -1
  77. package/dist/causal-consolidation.js +13 -13
  78. package/dist/causal-retrieval.js +2 -2
  79. package/dist/causal-trajectory-graph.d.ts +1 -1
  80. package/dist/causal-trajectory-graph.js +2 -2
  81. package/dist/causal-trajectory.js +1 -1
  82. package/dist/{chunk-EZSCW4EM.js → chunk-25OLNWYG.js} +2 -2
  83. package/dist/{chunk-2LBAFHOQ.js → chunk-2QSGJTDG.js} +10 -10
  84. package/dist/{chunk-7UTDHQZ5.js → chunk-2VZHB5US.js} +2 -2
  85. package/dist/{chunk-VQNRICAQ.js → chunk-36HJ36FK.js} +3 -3
  86. package/dist/{chunk-XKNHFDTT.js → chunk-3A2Z4OOS.js} +2 -2
  87. package/dist/{chunk-KODXCHXJ.js → chunk-46XR5FNZ.js} +39 -3
  88. package/dist/chunk-46XR5FNZ.js.map +1 -0
  89. package/dist/{chunk-56IV4J5W.js → chunk-47WWTCJY.js} +1384 -99
  90. package/dist/chunk-47WWTCJY.js.map +1 -0
  91. package/dist/{chunk-RDGKVH6T.js → chunk-4NKIGSJM.js} +2 -2
  92. package/dist/{chunk-EFQCDJZ2.js → chunk-4PG2CKI6.js} +2 -2
  93. package/dist/{chunk-HJXA6ZM7.js → chunk-6545JDIM.js} +2 -2
  94. package/dist/{chunk-J3OND5QT.js → chunk-65HXVEVG.js} +2 -2
  95. package/dist/{chunk-HNPE66LB.js → chunk-6BYJQ3L2.js} +8 -8
  96. package/dist/{chunk-ZW4VXELZ.js → chunk-6PUF7LUO.js} +2 -2
  97. package/dist/{chunk-TVVEYCNW.js → chunk-7K5Q6COX.js} +4 -4
  98. package/dist/{chunk-MN5NOOI7.js → chunk-AI5M4FVQ.js} +2 -2
  99. package/dist/{chunk-IHGMRDEE.js → chunk-B4B3QDV3.js} +235 -151
  100. package/dist/chunk-B4B3QDV3.js.map +1 -0
  101. package/dist/{chunk-YMOPYG3K.js → chunk-BIJAWZYW.js} +6 -6
  102. package/dist/{chunk-I5VB44ZK.js → chunk-BLHKR4GJ.js} +2 -2
  103. package/dist/chunk-BLUYQFRH.js +36 -0
  104. package/dist/chunk-BLUYQFRH.js.map +1 -0
  105. package/dist/{chunk-CEH2AFXG.js → chunk-C24UZSFW.js} +6 -6
  106. package/dist/{chunk-MJRGVXPQ.js → chunk-C3ZYZKDJ.js} +2 -2
  107. package/dist/{chunk-QCRJMU5V.js → chunk-CDLPF3PX.js} +2 -2
  108. package/dist/{chunk-23CVL7HS.js → chunk-CQ6IWZDI.js} +2 -2
  109. package/dist/{chunk-KWIGDKM2.js → chunk-D2YNNDML.js} +2 -2
  110. package/dist/{chunk-FTTJRVB7.js → chunk-D3DUA64S.js} +2 -2
  111. package/dist/{chunk-7XOG75AU.js → chunk-D6Q5EPOV.js} +2 -2
  112. package/dist/{chunk-GEJKYA7D.js → chunk-DSEHPUID.js} +6 -6
  113. package/dist/chunk-E4X2YX2F.js +22 -0
  114. package/dist/chunk-E4X2YX2F.js.map +1 -0
  115. package/dist/{chunk-PEBH5DCK.js → chunk-EH7BNIUN.js} +101 -19
  116. package/dist/chunk-EH7BNIUN.js.map +1 -0
  117. package/dist/{chunk-OAJMQKQR.js → chunk-EQRD4NMH.js} +2 -2
  118. package/dist/{chunk-H7VDIF2V.js → chunk-ER2UPUMG.js} +2 -2
  119. package/dist/{chunk-4FHRZD5T.js → chunk-F2JXJABQ.js} +2 -2
  120. package/dist/{chunk-FKKGCGYL.js → chunk-F4W5HTED.js} +2 -2
  121. package/dist/{chunk-DMEHOEC7.js → chunk-FFWONAAW.js} +3 -3
  122. package/dist/chunk-FYDW33ZB.js +13 -0
  123. package/dist/chunk-FYDW33ZB.js.map +1 -0
  124. package/dist/{chunk-TNGH4ZYI.js → chunk-GNWLTCKC.js} +2 -2
  125. package/dist/{chunk-CFVTRUR3.js → chunk-H6RSANGQ.js} +2 -2
  126. package/dist/chunk-HVAEXYPL.js +98 -0
  127. package/dist/chunk-HVAEXYPL.js.map +1 -0
  128. package/dist/{chunk-CTCGHNWN.js → chunk-J2R275FN.js} +4 -4
  129. package/dist/{chunk-IVIAHQBR.js → chunk-JJ6ZEFXC.js} +2 -2
  130. package/dist/{chunk-KXIXO76C.js → chunk-JMXHVJ2V.js} +14 -14
  131. package/dist/{chunk-7LCGFUMB.js → chunk-KQAFEZQX.js} +4 -4
  132. package/dist/{chunk-NACLNNFQ.js → chunk-KSZKQTZS.js} +2 -2
  133. package/dist/{chunk-NPIBN2VL.js → chunk-LK4TOYPU.js} +2 -2
  134. package/dist/{chunk-K66OY4EI.js → chunk-LSR5LQXN.js} +2 -2
  135. package/dist/chunk-MAG6M3B6.js +51 -0
  136. package/dist/chunk-MAG6M3B6.js.map +1 -0
  137. package/dist/{chunk-6CEGSTBD.js → chunk-NTFXBILO.js} +5 -5
  138. package/dist/{chunk-2PSX5BJU.js → chunk-NZPFCP5A.js} +2 -2
  139. package/dist/{chunk-FYWLSFFS.js → chunk-OERZXNSK.js} +2 -2
  140. package/dist/{chunk-ZJPM7GZ3.js → chunk-OIDICRH7.js} +2 -2
  141. package/dist/{chunk-LTBKKSCX.js → chunk-OLBZ2WGG.js} +2 -2
  142. package/dist/{chunk-PD66CVSD.js → chunk-OUKBMQ2O.js} +2 -2
  143. package/dist/{chunk-GPFZFCRN.js → chunk-PP7R754B.js} +1 -1
  144. package/dist/{chunk-GX6FTSYH.js → chunk-PRRUK2ZH.js} +2 -2
  145. package/dist/{chunk-MAH64N55.js → chunk-PW3GKWH3.js} +4 -4
  146. package/dist/chunk-Q3SHEAXR.js +80 -0
  147. package/dist/chunk-Q3SHEAXR.js.map +1 -0
  148. package/dist/{chunk-33MFRY25.js → chunk-R2Q6FTOX.js} +2 -2
  149. package/dist/{chunk-VCKWULAK.js → chunk-RCPKBW7K.js} +5 -5
  150. package/dist/{chunk-CN4VKV3S.js → chunk-RH3XLQG4.js} +2 -2
  151. package/dist/{chunk-2QSZNTDO.js → chunk-RKNJBZ55.js} +4 -4
  152. package/dist/{chunk-YXFCALVT.js → chunk-U4HZEW2B.js} +8 -8
  153. package/dist/{chunk-RZ3IZIJG.js → chunk-UHQE37NI.js} +2 -2
  154. package/dist/{chunk-Z3YEGSR4.js → chunk-UMZUKOJU.js} +4 -4
  155. package/dist/{chunk-72OIT7KS.js → chunk-UVYL5G7A.js} +3 -3
  156. package/dist/{chunk-4STAANV7.js → chunk-VKDBDJIX.js} +3 -3
  157. package/dist/{chunk-WKJFIMVN.js → chunk-VSMSYDIH.js} +2 -2
  158. package/dist/{chunk-GSKINLAK.js → chunk-W5IYHQA5.js} +3 -3
  159. package/dist/{chunk-FESUGFIL.js → chunk-WKWY7YF3.js} +2 -2
  160. package/dist/{chunk-UNUMFURP.js → chunk-X5PIDJ3L.js} +3 -3
  161. package/dist/{chunk-MINHJ55X.js → chunk-XXW32OL7.js} +1 -1
  162. package/dist/{chunk-MINHJ55X.js.map → chunk-XXW32OL7.js.map} +1 -1
  163. package/dist/{chunk-6RUHELWR.js → chunk-Y2YM4C75.js} +2 -2
  164. package/dist/{chunk-L4X4PJYK.js → chunk-YZ5VC2JJ.js} +2 -2
  165. package/dist/{chunk-VQ4AMTGZ.js → chunk-ZBIEX4XN.js} +1 -1
  166. package/dist/{chunk-O57GM3FR.js → chunk-ZMVW2HJJ.js} +2 -2
  167. package/dist/{chunk-6QDXA26G.js → chunk-ZXROBS53.js} +68 -68
  168. package/dist/{cli-BEkm2MEf.d.ts → cli-BOuEb4Ia.d.ts} +5 -5
  169. package/dist/cli.d.ts +13 -13
  170. package/dist/cli.js +76 -76
  171. package/dist/coding/export-okf-codegraph.d.ts +1 -1
  172. package/dist/coding/export-okf-codegraph.js +10 -10
  173. package/dist/coding/pre-action-gate.d.ts +1 -1
  174. package/dist/coding/pre-action-gate.js +2 -2
  175. package/dist/compounding/engine.d.ts +2 -2
  176. package/dist/compounding/engine.js +10 -10
  177. package/dist/compounding/preference-consolidator.d.ts +1 -1
  178. package/dist/compression-optimizer.d.ts +1 -1
  179. package/dist/config.d.ts +1 -1
  180. package/dist/config.js +4 -4
  181. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  182. package/dist/connectors/codex-materialize-runner.js +10 -10
  183. package/dist/connectors/codex-materialize.d.ts +1 -1
  184. package/dist/connectors/index.d.ts +1 -1
  185. package/dist/connectors/index.js +10 -10
  186. package/dist/consolidation-provenance-check.d.ts +2 -2
  187. package/dist/consolidation-undo.d.ts +2 -2
  188. package/dist/contradiction/index.d.ts +3 -3
  189. package/dist/converge-config.d.ts +1 -1
  190. package/dist/convergence-refresh.d.ts +2 -2
  191. package/dist/convergence-refresh.js +12 -12
  192. package/dist/conversation-index/backend.d.ts +1 -1
  193. package/dist/conversation-index/chunker.d.ts +1 -1
  194. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  195. package/dist/conversation-index/indexer.d.ts +1 -1
  196. package/dist/conversation-index/search.d.ts +1 -1
  197. package/dist/corpus-watermark.d.ts +1 -1
  198. package/dist/corpus-watermark.js +12 -12
  199. package/dist/cross-lingual-recall.d.ts +1 -1
  200. package/dist/day-summary.d.ts +1 -1
  201. package/dist/delinearize.d.ts +1 -1
  202. package/dist/dependency-propagation-config.d.ts +1 -1
  203. package/dist/{dependency-propagation-delivery-BCpeo14F.d.ts → dependency-propagation-delivery-D4WMbOwA.d.ts} +1 -1
  204. package/dist/direct-answer-wiring.d.ts +1 -1
  205. package/dist/direct-answer.d.ts +1 -1
  206. package/dist/embedding-fallback.d.ts +1 -1
  207. package/dist/enrichment/index.d.ts +1 -1
  208. package/dist/entity-origin-fields.d.ts +1 -1
  209. package/dist/entity-retrieval.d.ts +2 -2
  210. package/dist/entity-retrieval.js +10 -10
  211. package/dist/entity-schema.d.ts +1 -1
  212. package/dist/episodic-context.d.ts +1 -1
  213. package/dist/eval-trajectory-contracts.d.ts +1 -1
  214. package/dist/eval-trajectory-store.d.ts +1 -1
  215. package/dist/eval-trajectory.d.ts +1 -1
  216. package/dist/explicit-capture.d.ts +9 -9
  217. package/dist/external-wiki-access.d.ts +11 -11
  218. package/dist/external-wiki-access.js +32 -32
  219. package/dist/external-wiki-collection-registration.d.ts +1 -1
  220. package/dist/external-wiki-collection.d.ts +1 -1
  221. package/dist/external-wiki-mcp-tools.d.ts +11 -11
  222. package/dist/extraction-error-classification.d.ts +1 -1
  223. package/dist/extraction-faithfulness.d.ts +1 -1
  224. package/dist/extraction-judge-telemetry.d.ts +1 -1
  225. package/dist/extraction-judge-training.d.ts +1 -1
  226. package/dist/extraction-judge.d.ts +1 -1
  227. package/dist/extraction-liveness.d.ts +1 -1
  228. package/dist/extraction-normalization.d.ts +1 -1
  229. package/dist/extraction-prompt.d.ts +1 -1
  230. package/dist/extraction-source-grounding-rules.d.ts +1 -1
  231. package/dist/extraction-source-grounding.d.ts +1 -1
  232. package/dist/extraction-span-wire.d.ts +17 -0
  233. package/dist/extraction-span-wire.js +13 -0
  234. package/dist/extraction-span-wire.js.map +1 -0
  235. package/dist/extraction-span.d.ts +17 -0
  236. package/dist/extraction-span.js +8 -0
  237. package/dist/extraction.d.ts +1 -1
  238. package/dist/extraction.js +13 -13
  239. package/dist/fallback-llm.d.ts +1 -1
  240. package/dist/graph-dashboard-diff.d.ts +1 -1
  241. package/dist/graph-dashboard-key.d.ts +1 -1
  242. package/dist/graph-dashboard-parser.d.ts +1 -1
  243. package/dist/{graph-edge-decay-A4SDFMMS.js → graph-edge-decay-FXGELBFA.js} +4 -4
  244. package/dist/graph-edge-decay-FXGELBFA.js.map +1 -0
  245. package/dist/graph-edge-reinforcement.d.ts +1 -1
  246. package/dist/graph-path-reconstruction.d.ts +1 -1
  247. package/dist/graph-path-scoring.d.ts +1 -1
  248. package/dist/graph-snapshot.d.ts +1 -1
  249. package/dist/graph-snapshot.js +3 -3
  250. package/dist/graph.d.ts +1 -1
  251. package/dist/graph.js +3 -3
  252. package/dist/harmonic-retrieval.js +1 -1
  253. package/dist/importance.d.ts +1 -1
  254. package/dist/importers/index.d.ts +1 -1
  255. package/dist/in-flight-reads.d.ts +1 -1
  256. package/dist/{index-D_pyMUaP.d.ts → index-DuJnzwHv.d.ts} +2 -2
  257. package/dist/index.d.ts +341 -26
  258. package/dist/index.js +195 -114
  259. package/dist/intent.d.ts +1 -1
  260. package/dist/lcm/engine.d.ts +1 -1
  261. package/dist/lcm/engine.js +2 -2
  262. package/dist/lcm/index.d.ts +1 -1
  263. package/dist/lcm/index.js +7 -7
  264. package/dist/lcm/tools.d.ts +1 -1
  265. package/dist/lifecycle.d.ts +1 -1
  266. package/dist/live-connectors-runner.d.ts +1 -1
  267. package/dist/local-llm.d.ts +1 -1
  268. package/dist/local-model-endpoint.d.ts +1 -1
  269. package/dist/location/index.d.ts +3 -3
  270. package/dist/location/index.js +12 -12
  271. package/dist/maintenance/memory-governance.d.ts +1 -1
  272. package/dist/maintenance/memory-governance.js +10 -10
  273. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  274. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +10 -10
  275. package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
  276. package/dist/maintenance/rebuild-memory-projection.js +11 -11
  277. package/dist/{maintenance-DDUX9d6D.d.ts → maintenance-BBeaeYRR.d.ts} +3 -3
  278. package/dist/mcp-memory-inspector-app.d.ts +11 -11
  279. package/dist/memory-action-policy.d.ts +1 -1
  280. package/dist/memory-cache.d.ts +1 -1
  281. package/dist/memory-controller.d.ts +1 -1
  282. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  283. package/dist/memory-projection-store.d.ts +1 -1
  284. package/dist/memory-provenance.d.ts +1 -1
  285. package/dist/memory-snapshot.d.ts +1 -1
  286. package/dist/memory-subject-cli.d.ts +11 -11
  287. package/dist/memory-subject.d.ts +11 -11
  288. package/dist/memory-worth-outcomes.d.ts +2 -2
  289. package/dist/models-json.d.ts +1 -1
  290. package/dist/namespaces/migrate.d.ts +3 -3
  291. package/dist/namespaces/migrate.js +11 -11
  292. package/dist/namespaces/principal.d.ts +1 -1
  293. package/dist/namespaces/search.d.ts +1 -1
  294. package/dist/namespaces/search.js +6 -6
  295. package/dist/namespaces/storage.d.ts +3 -3
  296. package/dist/namespaces/storage.js +10 -10
  297. package/dist/native-knowledge.d.ts +1 -1
  298. package/dist/offline-sync-impression-drain.d.ts +1 -1
  299. package/dist/operator-doctor-corpus.d.ts +1 -1
  300. package/dist/operator-doctor-corpus.js +13 -13
  301. package/dist/operator-doctor-replica.d.ts +1 -1
  302. package/dist/operator-toolkit.d.ts +3 -3
  303. package/dist/operator-toolkit.js +24 -24
  304. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  305. package/dist/orchestration/maintenance.d.ts +4 -4
  306. package/dist/orchestration/maintenance.js +19 -19
  307. package/dist/{orchestrator-3F4jihCo.d.ts → orchestrator-CaqnwNwM.d.ts} +8 -8
  308. package/dist/orchestrator.d.ts +9 -9
  309. package/dist/orchestrator.js +105 -101
  310. package/dist/patterns-cli.d.ts +1 -1
  311. package/dist/{pipeline-CB1dj6Uh.d.ts → pipeline-CrxVjlJr.d.ts} +1 -1
  312. package/dist/policy-runtime.d.ts +1 -1
  313. package/dist/proactive-contention.d.ts +1 -1
  314. package/dist/provenance.d.ts +1 -1
  315. package/dist/{public-http-34-JIAGQ.d.ts → public-http-CmQRjQCD.d.ts} +1 -1
  316. package/dist/{qmd-edLLZXc5.d.ts → qmd-BZgbJm0g.d.ts} +1 -1
  317. package/dist/qmd-preflight.d.ts +2 -2
  318. package/dist/qmd-recall-cache.d.ts +1 -1
  319. package/dist/qmd.d.ts +2 -2
  320. package/dist/qmd.js +4 -4
  321. package/dist/recall-concurrency-config.d.ts +1 -1
  322. package/dist/recall-deep-access.d.ts +30 -0
  323. package/dist/recall-deep-access.js +50 -0
  324. package/dist/recall-deep-access.js.map +1 -0
  325. package/dist/recall-deep-render.d.ts +11 -0
  326. package/dist/recall-deep-render.js +28 -0
  327. package/dist/recall-deep-render.js.map +1 -0
  328. package/dist/recall-deep.d.ts +37 -0
  329. package/dist/recall-deep.js +14 -0
  330. package/dist/recall-deep.js.map +1 -0
  331. package/dist/recall-disclosure-escalation.d.ts +1 -1
  332. package/dist/recall-explain-renderer.d.ts +1 -1
  333. package/dist/recall-explain-renderer.js +3 -3
  334. package/dist/recall-memory-map.d.ts +1 -1
  335. package/dist/recall-navigate.d.ts +70 -0
  336. package/dist/recall-navigate.js +15 -0
  337. package/dist/recall-navigate.js.map +1 -0
  338. package/dist/recall-planner-llm.d.ts +1 -1
  339. package/dist/recall-state-view-render.d.ts +18 -0
  340. package/dist/recall-state-view-render.js +22 -0
  341. package/dist/recall-state-view-render.js.map +1 -0
  342. package/dist/recall-state-view-widen.d.ts +13 -0
  343. package/dist/recall-state-view-widen.js +11 -0
  344. package/dist/recall-state-view-widen.js.map +1 -0
  345. package/dist/recall-state-view-wire.d.ts +13 -0
  346. package/dist/recall-state-view-wire.js +12 -0
  347. package/dist/recall-state-view-wire.js.map +1 -0
  348. package/dist/recall-state-view.d.ts +25 -0
  349. package/dist/recall-state-view.js +22 -0
  350. package/dist/recall-state-view.js.map +1 -0
  351. package/dist/recall-state.d.ts +1 -1
  352. package/dist/recall-tag-filter.d.ts +1 -1
  353. package/dist/recall-timings.d.ts +1 -1
  354. package/dist/recall-xray-cli.d.ts +1 -1
  355. package/dist/recall-xray-cli.js +4 -4
  356. package/dist/recall-xray-renderer.d.ts +1 -1
  357. package/dist/recall-xray-renderer.js +3 -3
  358. package/dist/recall-xray.d.ts +1 -1
  359. package/dist/recall-xray.js +2 -2
  360. package/dist/reconcile/cursor.d.ts +1 -1
  361. package/dist/reconcile/manifest.d.ts +1 -1
  362. package/dist/reconcile/plan.d.ts +1 -1
  363. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  364. package/dist/replay/normalizers/claude.d.ts +1 -1
  365. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  366. package/dist/replay/normalizers/shared.d.ts +1 -1
  367. package/dist/replay/runner.d.ts +1 -1
  368. package/dist/replay/types.d.ts +1 -1
  369. package/dist/replica-divergence.d.ts +1 -1
  370. package/dist/replica-peers-config.d.ts +1 -1
  371. package/dist/resolve-auth-token.d.ts +1 -1
  372. package/dist/resume-bundles.js +5 -5
  373. package/dist/retrieval-agents.d.ts +2 -2
  374. package/dist/retrieval-tiers.d.ts +1 -1
  375. package/dist/routing/engine.d.ts +1 -1
  376. package/dist/routing/store.d.ts +1 -1
  377. package/dist/salvage-envelope.d.ts +1 -1
  378. package/dist/schemas.d.ts +42 -42
  379. package/dist/{scope-profiles-BF2lu81V.d.ts → scope-profiles-DFaojvoP.d.ts} +1 -1
  380. package/dist/search/embed-helper.d.ts +1 -1
  381. package/dist/search/factory.d.ts +1 -1
  382. package/dist/search/factory.js +5 -5
  383. package/dist/search/index.d.ts +1 -1
  384. package/dist/search/index.js +9 -9
  385. package/dist/search/lancedb-backend.d.ts +1 -1
  386. package/dist/search/meilisearch-backend.d.ts +1 -1
  387. package/dist/search/noop-backend.d.ts +1 -1
  388. package/dist/search/orama-backend.d.ts +1 -1
  389. package/dist/search/port.d.ts +1 -1
  390. package/dist/search/remote-backend.d.ts +1 -1
  391. package/dist/{semantic-consolidation-5OuWXBRt.d.ts → semantic-consolidation-BiX68wZA.d.ts} +1 -1
  392. package/dist/semantic-consolidation.d.ts +2 -2
  393. package/dist/semantic-consolidation.js +11 -11
  394. package/dist/semantic-rule-promotion.js +10 -10
  395. package/dist/semantic-rule-verifier.d.ts +1 -1
  396. package/dist/semantic-rule-verifier.js +10 -10
  397. package/dist/{service-CrqEhLXD.d.ts → service-D5h2zZ0M.d.ts} +2 -2
  398. package/dist/session-observer-bands.d.ts +1 -1
  399. package/dist/session-observer-state.d.ts +1 -1
  400. package/dist/shared-context/manager.d.ts +1 -1
  401. package/dist/signal.d.ts +1 -1
  402. package/dist/source-agent-qualifier.d.ts +1 -1
  403. package/dist/source-agent-qualifier.js +12 -12
  404. package/dist/{storage-BQn-xnxm.d.ts → storage-CtsaojWD.d.ts} +1 -1
  405. package/dist/storage.d.ts +2 -2
  406. package/dist/storage.js +9 -9
  407. package/dist/subject-config.d.ts +1 -1
  408. package/dist/summarizer.d.ts +1 -1
  409. package/dist/summary-snapshot.d.ts +1 -1
  410. package/dist/support-passport/index.d.ts +14 -14
  411. package/dist/support-passport/index.js +34 -34
  412. package/dist/temporal-supersession.d.ts +2 -2
  413. package/dist/temporal-timeline-recall.d.ts +1 -1
  414. package/dist/temporal-validity.d.ts +1 -1
  415. package/dist/threading.d.ts +1 -1
  416. package/dist/tier-migration.d.ts +2 -2
  417. package/dist/tier-routing.d.ts +1 -1
  418. package/dist/topics.d.ts +1 -1
  419. package/dist/transcript.d.ts +1 -1
  420. package/dist/transfer/capsule-export.js +2 -2
  421. package/dist/transfer/capsule-import.js +2 -2
  422. package/dist/transfer/export-okf.d.ts +1 -1
  423. package/dist/transfer/export-okf.js +11 -11
  424. package/dist/transfer/types.d.ts +12 -12
  425. package/dist/trust-score-stage.d.ts +1 -1
  426. package/dist/trust-score.d.ts +1 -1
  427. package/dist/{types-BRpcNjHZ.d.ts → types-CIpfYz1I.d.ts} +16 -11
  428. package/dist/types.d.ts +1 -1
  429. package/dist/types.js +1 -1
  430. package/dist/utility-runtime.d.ts +1 -1
  431. package/dist/verified-recall.js +10 -10
  432. package/dist/who-knows-cli.d.ts +11 -11
  433. package/dist/who-knows-cli.js +11 -11
  434. package/dist/who-knows.d.ts +11 -11
  435. package/dist/who-knows.js +10 -10
  436. package/dist/write-envelope.d.ts +1 -1
  437. package/package.json +2 -2
  438. package/src/activity/config.test.ts +1 -1
  439. package/src/activity/config.ts +48 -3
  440. package/src/activity/index.ts +5 -0
  441. package/src/activity/journal-vault-read.test.ts +153 -0
  442. package/src/activity/journal-vault-read.ts +214 -0
  443. package/src/activity/journal.test.ts +97 -0
  444. package/src/activity/journal.ts +113 -0
  445. package/src/activity/privacy.test.ts +53 -0
  446. package/src/activity/privacy.ts +80 -0
  447. package/src/activity/timeline/analysis-batch.test.ts +56 -0
  448. package/src/activity/timeline/analysis-batch.ts +45 -0
  449. package/src/activity/timeline/analysis.test.ts +413 -0
  450. package/src/activity/timeline/analysis.ts +362 -0
  451. package/src/activity/timeline/index.ts +7 -0
  452. package/src/activity/timeline/journal-recap-persist.test.ts +148 -0
  453. package/src/activity/timeline/journal-recap-persist.ts +37 -0
  454. package/src/activity/timeline/journal-recap.test.ts +113 -0
  455. package/src/activity/timeline/journal-recap.ts +130 -0
  456. package/src/activity/timeline/query.test.ts +198 -0
  457. package/src/activity/timeline/query.ts +313 -0
  458. package/src/activity/timeline/weekly-persist.test.ts +121 -0
  459. package/src/activity/timeline/weekly-persist.ts +103 -0
  460. package/src/activity/timeline/weekly.test.ts +215 -0
  461. package/src/activity/timeline/weekly.ts +234 -0
  462. package/src/activity/types.ts +14 -0
  463. package/src/activity/vault-path.test.ts +38 -0
  464. package/src/activity/vault-path.ts +59 -0
  465. package/src/activity/vault-publish.test.ts +268 -0
  466. package/src/activity/vault-publish.ts +180 -0
  467. package/src/config.test.ts +1 -1
  468. package/src/config.ts +2 -22
  469. package/src/dedup/merge-on-write-wire.test.ts +101 -0
  470. package/src/dedup/merge-on-write-wire.ts +34 -0
  471. package/src/dedup/merge-on-write.test.ts +91 -0
  472. package/src/dedup/merge-on-write.ts +75 -0
  473. package/src/dedup/novelty-gate.test.ts +143 -0
  474. package/src/dedup/novelty-gate.ts +163 -0
  475. package/src/extraction-span-wire.test.ts +20 -0
  476. package/src/extraction-span-wire.ts +17 -0
  477. package/src/extraction-span.test.ts +59 -0
  478. package/src/extraction-span.ts +39 -0
  479. package/src/index.ts +1 -0
  480. package/src/location/recall-exclusion.test.ts +1 -0
  481. package/src/orchestration/extraction-persist.ts +22 -23
  482. package/src/orchestration/generic-recall-paths.ts +11 -0
  483. package/src/orchestration/recall-entry.ts +8 -3
  484. package/src/recall-deep-access.test.ts +58 -0
  485. package/src/recall-deep-access.ts +71 -0
  486. package/src/recall-deep-render.test.ts +68 -0
  487. package/src/recall-deep-render.ts +32 -0
  488. package/src/recall-deep.test.ts +72 -0
  489. package/src/recall-deep.ts +113 -0
  490. package/src/recall-navigate.test.ts +84 -0
  491. package/src/recall-navigate.ts +100 -0
  492. package/src/recall-state-view-render.test.ts +94 -0
  493. package/src/recall-state-view-render.ts +24 -0
  494. package/src/recall-state-view-widen.test.ts +66 -0
  495. package/src/recall-state-view-widen.ts +49 -0
  496. package/src/recall-state-view-wire.test.ts +35 -0
  497. package/src/recall-state-view-wire.ts +18 -0
  498. package/src/recall-state-view.test.ts +131 -0
  499. package/src/recall-state-view.ts +138 -0
  500. package/src/shared-context/governance.test.ts +53 -0
  501. package/src/shared-context/governance.ts +86 -0
  502. package/src/shared-context/staleness.test.ts +36 -0
  503. package/src/shared-context/staleness.ts +38 -0
  504. package/src/shared-context/trajectories.test.ts +77 -0
  505. package/src/shared-context/trajectories.ts +49 -0
  506. package/src/types.ts +3 -10
  507. package/dist/chunk-56IV4J5W.js.map +0 -1
  508. package/dist/chunk-IHGMRDEE.js.map +0 -1
  509. package/dist/chunk-KODXCHXJ.js.map +0 -1
  510. package/dist/chunk-PEBH5DCK.js.map +0 -1
  511. /package/dist/{chunk-EZSCW4EM.js.map → chunk-25OLNWYG.js.map} +0 -0
  512. /package/dist/{chunk-2LBAFHOQ.js.map → chunk-2QSGJTDG.js.map} +0 -0
  513. /package/dist/{chunk-7UTDHQZ5.js.map → chunk-2VZHB5US.js.map} +0 -0
  514. /package/dist/{chunk-VQNRICAQ.js.map → chunk-36HJ36FK.js.map} +0 -0
  515. /package/dist/{chunk-XKNHFDTT.js.map → chunk-3A2Z4OOS.js.map} +0 -0
  516. /package/dist/{chunk-RDGKVH6T.js.map → chunk-4NKIGSJM.js.map} +0 -0
  517. /package/dist/{chunk-EFQCDJZ2.js.map → chunk-4PG2CKI6.js.map} +0 -0
  518. /package/dist/{chunk-HJXA6ZM7.js.map → chunk-6545JDIM.js.map} +0 -0
  519. /package/dist/{chunk-J3OND5QT.js.map → chunk-65HXVEVG.js.map} +0 -0
  520. /package/dist/{chunk-HNPE66LB.js.map → chunk-6BYJQ3L2.js.map} +0 -0
  521. /package/dist/{chunk-ZW4VXELZ.js.map → chunk-6PUF7LUO.js.map} +0 -0
  522. /package/dist/{chunk-TVVEYCNW.js.map → chunk-7K5Q6COX.js.map} +0 -0
  523. /package/dist/{chunk-MN5NOOI7.js.map → chunk-AI5M4FVQ.js.map} +0 -0
  524. /package/dist/{chunk-YMOPYG3K.js.map → chunk-BIJAWZYW.js.map} +0 -0
  525. /package/dist/{chunk-I5VB44ZK.js.map → chunk-BLHKR4GJ.js.map} +0 -0
  526. /package/dist/{chunk-CEH2AFXG.js.map → chunk-C24UZSFW.js.map} +0 -0
  527. /package/dist/{chunk-MJRGVXPQ.js.map → chunk-C3ZYZKDJ.js.map} +0 -0
  528. /package/dist/{chunk-QCRJMU5V.js.map → chunk-CDLPF3PX.js.map} +0 -0
  529. /package/dist/{chunk-23CVL7HS.js.map → chunk-CQ6IWZDI.js.map} +0 -0
  530. /package/dist/{chunk-KWIGDKM2.js.map → chunk-D2YNNDML.js.map} +0 -0
  531. /package/dist/{chunk-FTTJRVB7.js.map → chunk-D3DUA64S.js.map} +0 -0
  532. /package/dist/{chunk-7XOG75AU.js.map → chunk-D6Q5EPOV.js.map} +0 -0
  533. /package/dist/{chunk-GEJKYA7D.js.map → chunk-DSEHPUID.js.map} +0 -0
  534. /package/dist/{chunk-OAJMQKQR.js.map → chunk-EQRD4NMH.js.map} +0 -0
  535. /package/dist/{chunk-H7VDIF2V.js.map → chunk-ER2UPUMG.js.map} +0 -0
  536. /package/dist/{chunk-4FHRZD5T.js.map → chunk-F2JXJABQ.js.map} +0 -0
  537. /package/dist/{chunk-FKKGCGYL.js.map → chunk-F4W5HTED.js.map} +0 -0
  538. /package/dist/{chunk-DMEHOEC7.js.map → chunk-FFWONAAW.js.map} +0 -0
  539. /package/dist/{chunk-TNGH4ZYI.js.map → chunk-GNWLTCKC.js.map} +0 -0
  540. /package/dist/{chunk-CFVTRUR3.js.map → chunk-H6RSANGQ.js.map} +0 -0
  541. /package/dist/{chunk-CTCGHNWN.js.map → chunk-J2R275FN.js.map} +0 -0
  542. /package/dist/{chunk-IVIAHQBR.js.map → chunk-JJ6ZEFXC.js.map} +0 -0
  543. /package/dist/{chunk-KXIXO76C.js.map → chunk-JMXHVJ2V.js.map} +0 -0
  544. /package/dist/{chunk-7LCGFUMB.js.map → chunk-KQAFEZQX.js.map} +0 -0
  545. /package/dist/{chunk-NACLNNFQ.js.map → chunk-KSZKQTZS.js.map} +0 -0
  546. /package/dist/{chunk-NPIBN2VL.js.map → chunk-LK4TOYPU.js.map} +0 -0
  547. /package/dist/{chunk-K66OY4EI.js.map → chunk-LSR5LQXN.js.map} +0 -0
  548. /package/dist/{chunk-6CEGSTBD.js.map → chunk-NTFXBILO.js.map} +0 -0
  549. /package/dist/{chunk-2PSX5BJU.js.map → chunk-NZPFCP5A.js.map} +0 -0
  550. /package/dist/{chunk-FYWLSFFS.js.map → chunk-OERZXNSK.js.map} +0 -0
  551. /package/dist/{chunk-ZJPM7GZ3.js.map → chunk-OIDICRH7.js.map} +0 -0
  552. /package/dist/{chunk-LTBKKSCX.js.map → chunk-OLBZ2WGG.js.map} +0 -0
  553. /package/dist/{chunk-PD66CVSD.js.map → chunk-OUKBMQ2O.js.map} +0 -0
  554. /package/dist/{chunk-GPFZFCRN.js.map → chunk-PP7R754B.js.map} +0 -0
  555. /package/dist/{chunk-GX6FTSYH.js.map → chunk-PRRUK2ZH.js.map} +0 -0
  556. /package/dist/{chunk-MAH64N55.js.map → chunk-PW3GKWH3.js.map} +0 -0
  557. /package/dist/{chunk-33MFRY25.js.map → chunk-R2Q6FTOX.js.map} +0 -0
  558. /package/dist/{chunk-VCKWULAK.js.map → chunk-RCPKBW7K.js.map} +0 -0
  559. /package/dist/{chunk-CN4VKV3S.js.map → chunk-RH3XLQG4.js.map} +0 -0
  560. /package/dist/{chunk-2QSZNTDO.js.map → chunk-RKNJBZ55.js.map} +0 -0
  561. /package/dist/{chunk-YXFCALVT.js.map → chunk-U4HZEW2B.js.map} +0 -0
  562. /package/dist/{chunk-RZ3IZIJG.js.map → chunk-UHQE37NI.js.map} +0 -0
  563. /package/dist/{chunk-Z3YEGSR4.js.map → chunk-UMZUKOJU.js.map} +0 -0
  564. /package/dist/{chunk-72OIT7KS.js.map → chunk-UVYL5G7A.js.map} +0 -0
  565. /package/dist/{chunk-4STAANV7.js.map → chunk-VKDBDJIX.js.map} +0 -0
  566. /package/dist/{chunk-WKJFIMVN.js.map → chunk-VSMSYDIH.js.map} +0 -0
  567. /package/dist/{chunk-GSKINLAK.js.map → chunk-W5IYHQA5.js.map} +0 -0
  568. /package/dist/{chunk-FESUGFIL.js.map → chunk-WKWY7YF3.js.map} +0 -0
  569. /package/dist/{chunk-UNUMFURP.js.map → chunk-X5PIDJ3L.js.map} +0 -0
  570. /package/dist/{chunk-6RUHELWR.js.map → chunk-Y2YM4C75.js.map} +0 -0
  571. /package/dist/{chunk-L4X4PJYK.js.map → chunk-YZ5VC2JJ.js.map} +0 -0
  572. /package/dist/{chunk-VQ4AMTGZ.js.map → chunk-ZBIEX4XN.js.map} +0 -0
  573. /package/dist/{chunk-O57GM3FR.js.map → chunk-ZMVW2HJJ.js.map} +0 -0
  574. /package/dist/{chunk-6QDXA26G.js.map → chunk-ZXROBS53.js.map} +0 -0
  575. /package/dist/{graph-edge-decay-A4SDFMMS.js.map → extraction-span.js.map} +0 -0
@@ -0,0 +1,362 @@
1
+ /**
2
+ * Optional AI analysis over deterministic timeline cards (issue #2050 first slice).
3
+ *
4
+ * Injected provider only. parseConfig, registries, and surfaces wait.
5
+ * Failures leave cards unchanged. Disabled makes zero provider calls.
6
+ */
7
+ import { extractJsonCandidates } from "../../json-extract.js";
8
+ import { log } from "../../logger.js";
9
+ import { DEFAULT_TIMELINE_CATEGORIES } from "./categories.js";
10
+ import type { TimelineCard, TimelineCategory, TimelineCorrection, TimelineEvidenceRange, TimelineObservation } from "./types.js";
11
+
12
+ export const TIMELINE_ANALYSIS_PROMPT_VERSION = 1;
13
+ export const TIMELINE_ANALYSIS_BATCH_SIZE = 40;
14
+ export const TIMELINE_ANALYSIS_BATCH_OVERLAP = 2;
15
+ export const TIMELINE_ANALYSIS_DEFAULT_TIMEOUT_MS = 15_000;
16
+
17
+ export class TimelineAnalysisConfigError extends Error {
18
+ override readonly name = "TimelineAnalysisConfigError";
19
+ readonly code = "invalid_config" as const;
20
+ constructor(message: string) {
21
+ super(message);
22
+ }
23
+ }
24
+
25
+ export type TimelineAnalysisStatus = "ok" | "disabled" | "provider_failed" | "invalid_output";
26
+
27
+ export interface TimelineAnalysisCompleteInput {
28
+ prompt: string;
29
+ provider: string;
30
+ model: string;
31
+ signal: AbortSignal;
32
+ }
33
+
34
+ export type TimelineAnalysisComplete = (input: TimelineAnalysisCompleteInput) => Promise<string>;
35
+
36
+ export interface TimelineAnalysisInput {
37
+ enabled: boolean;
38
+ cards: readonly TimelineCard[];
39
+ observations: readonly TimelineObservation[];
40
+ provider?: string;
41
+ model?: string;
42
+ complete?: TimelineAnalysisComplete;
43
+ timeoutMs?: number;
44
+ date?: string;
45
+ timezone?: string;
46
+ categories?: readonly TimelineCategory[];
47
+ preferences?: readonly string[];
48
+ priorEdits?: readonly TimelineCorrection[];
49
+ signal?: AbortSignal;
50
+ }
51
+
52
+ export interface TimelineAnalysisResult {
53
+ status: TimelineAnalysisStatus;
54
+ cards: TimelineCard[];
55
+ provider?: string;
56
+ model?: string;
57
+ promptVersion?: number;
58
+ }
59
+
60
+ interface AnalysisOp {
61
+ cardId: string;
62
+ title?: string;
63
+ summary?: string;
64
+ categoryId?: string;
65
+ confidence?: number;
66
+ uncertainty?: string;
67
+ evidenceRange: TimelineEvidenceRange;
68
+ }
69
+
70
+ const INSTRUCTIONS = [
71
+ "Use only supplied evidence.",
72
+ "Preserve chronology.",
73
+ "Do not invent people, places, or tasks.",
74
+ "Avoid productivity or emotional claims.",
75
+ "Merge adjacent activity only when the evidence justifies it.",
76
+ "Return strict JSON: {\"ops\":[...]} with evidenceRange, title, summary, categoryId, confidence, uncertainty.",
77
+ "Cite evidence ranges for every op. Empty ops is a valid no-op.",
78
+ ].join(" ");
79
+
80
+ function fail(
81
+ status: Exclude<TimelineAnalysisStatus, "ok" | "disabled">,
82
+ cards: readonly TimelineCard[],
83
+ provider: string,
84
+ model: string,
85
+ ): TimelineAnalysisResult {
86
+ log.info(`timeline analysis status=${status} provider=${provider} model=${model} promptVersion=${TIMELINE_ANALYSIS_PROMPT_VERSION}`);
87
+ return {
88
+ status,
89
+ cards: cards as TimelineCard[],
90
+ provider,
91
+ model,
92
+ promptVersion: TIMELINE_ANALYSIS_PROMPT_VERSION,
93
+ };
94
+ }
95
+
96
+ function requiredToken(value: string | undefined, name: string): string {
97
+ if (typeof value !== "string" || value.trim().length === 0) {
98
+ throw new TimelineAnalysisConfigError(`${name} is required`);
99
+ }
100
+ return value.trim();
101
+ }
102
+
103
+ function evidenceKeyOf(observation: TimelineObservation): string {
104
+ const parsed = Date.parse(observation.capturedAtUtc);
105
+ const instant = Number.isFinite(parsed) ? new Date(parsed).toISOString() : observation.capturedAtUtc;
106
+ return `${observation.machine}|${instant}|${observation.contentHash}`;
107
+ }
108
+
109
+ function sortObservations(observations: readonly TimelineObservation[]): TimelineObservation[] {
110
+ return [...observations].sort((a, b) => {
111
+ const time = Date.parse(a.capturedAtUtc) - Date.parse(b.capturedAtUtc);
112
+ if (time !== 0) return time;
113
+ if (a.contentHash !== b.contentHash) return a.contentHash < b.contentHash ? -1 : 1;
114
+ return a.id - b.id;
115
+ });
116
+ }
117
+
118
+ function batchObservations(observations: readonly TimelineObservation[]): TimelineObservation[][] {
119
+ if (observations.length === 0) return [[]];
120
+ const size = TIMELINE_ANALYSIS_BATCH_SIZE;
121
+ const overlap = TIMELINE_ANALYSIS_BATCH_OVERLAP;
122
+ const step = size - overlap;
123
+ const batches: TimelineObservation[][] = [];
124
+ for (let start = 0; start < observations.length; start += step) {
125
+ batches.push(observations.slice(start, start + size));
126
+ if (start + size >= observations.length) break;
127
+ }
128
+ return batches;
129
+ }
130
+
131
+ function safeObservation(observation: TimelineObservation) {
132
+ return {
133
+ id: observation.id,
134
+ machine: observation.machine,
135
+ capturedAtUtc: observation.capturedAtUtc,
136
+ app: observation.app,
137
+ windowTitle: observation.windowTitle,
138
+ ...(observation.browserUrl ? { browserUrl: observation.browserUrl } : {}),
139
+ contentHash: observation.contentHash,
140
+ };
141
+ }
142
+
143
+ function safeCard(card: TimelineCard) {
144
+ return {
145
+ id: card.id,
146
+ kind: card.kind,
147
+ title: card.title,
148
+ summary: card.summary,
149
+ categoryId: card.categoryId,
150
+ confidence: card.confidence,
151
+ startUtc: card.startUtc,
152
+ endUtc: card.endUtc,
153
+ machine: card.machine,
154
+ evidenceIds: card.evidenceIds,
155
+ evidenceRange: card.evidenceRange,
156
+ ...(card.manualEdit ? { manualEdit: card.manualEdit } : {}),
157
+ };
158
+ }
159
+
160
+ export function buildTimelineAnalysisPrompt(input: {
161
+ date?: string;
162
+ timezone?: string;
163
+ cards: readonly TimelineCard[];
164
+ observations: readonly TimelineObservation[];
165
+ categories: readonly TimelineCategory[];
166
+ preferences?: readonly string[];
167
+ priorEdits?: readonly TimelineCorrection[];
168
+ }): string {
169
+ const payload = {
170
+ date: input.date ?? null,
171
+ timezone: input.timezone ?? null,
172
+ categories: input.categories.map((category) => ({ id: category.id, name: category.name })),
173
+ preferences: input.preferences ?? [],
174
+ priorEdits: input.priorEdits ?? [],
175
+ cards: input.cards.map(safeCard),
176
+ observations: input.observations.map(safeObservation),
177
+ };
178
+ return `${INSTRUCTIONS}\n${JSON.stringify(payload)}`;
179
+ }
180
+
181
+ async function callComplete(
182
+ complete: TimelineAnalysisComplete,
183
+ prompt: string,
184
+ provider: string,
185
+ model: string,
186
+ timeoutMs: number,
187
+ parent?: AbortSignal,
188
+ ): Promise<string> {
189
+ const { promise: timeoutPromise, reject } = Promise.withResolvers<string>();
190
+ const failOnce = (message: string, name: string) => {
191
+ reject(Object.assign(new Error(message), { name }));
192
+ };
193
+ const timer = setTimeout(() => failOnce("timeline analysis timed out", "TimeoutError"), timeoutMs);
194
+ if (parent?.aborted) {
195
+ clearTimeout(timer);
196
+ throw Object.assign(new Error("timeline analysis aborted"), { name: "AbortError" });
197
+ }
198
+ const onAbort = () => failOnce("timeline analysis aborted", "AbortError");
199
+ parent?.addEventListener("abort", onAbort, { once: true });
200
+ const signal = parent ? AbortSignal.any([parent, AbortSignal.timeout(timeoutMs)]) : AbortSignal.timeout(timeoutMs);
201
+ try {
202
+ return await Promise.race([complete({ prompt, provider, model, signal }), timeoutPromise]);
203
+ } finally {
204
+ clearTimeout(timer);
205
+ parent?.removeEventListener("abort", onAbort);
206
+ }
207
+ }
208
+
209
+ function parseOps(raw: string): AnalysisOp[] | null {
210
+ if (typeof raw !== "string" || raw.trim().length === 0) return null;
211
+ for (const candidate of extractJsonCandidates(raw)) {
212
+ try {
213
+ const parsed: unknown = JSON.parse(candidate);
214
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed) || !("ops" in parsed)) continue;
215
+ const ops = parsed.ops;
216
+ if (!Array.isArray(ops)) continue;
217
+ const out: AnalysisOp[] = [];
218
+ let valid = true;
219
+ for (const item of ops) {
220
+ const op = asOp(item);
221
+ if (!op) {
222
+ valid = false;
223
+ break;
224
+ }
225
+ out.push(op);
226
+ }
227
+ if (valid) return out;
228
+ } catch {
229
+ continue;
230
+ }
231
+ }
232
+ return null;
233
+ }
234
+
235
+ function asOp(value: unknown): AnalysisOp | null {
236
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
237
+ if (!("cardId" in value) || typeof value.cardId !== "string" || value.cardId.length === 0) return null;
238
+ if (!("evidenceRange" in value)) return null;
239
+ const range = value.evidenceRange;
240
+ if (!range || typeof range !== "object" || Array.isArray(range)) return null;
241
+ if (!("firstKey" in range) || typeof range.firstKey !== "string" || range.firstKey.length === 0) return null;
242
+ if (!("lastKey" in range) || typeof range.lastKey !== "string" || range.lastKey.length === 0) return null;
243
+ if ("title" in value && value.title !== undefined && typeof value.title !== "string") return null;
244
+ if ("summary" in value && value.summary !== undefined && typeof value.summary !== "string") return null;
245
+ if ("categoryId" in value && value.categoryId !== undefined && typeof value.categoryId !== "string") return null;
246
+ if ("uncertainty" in value && value.uncertainty !== undefined && typeof value.uncertainty !== "string") return null;
247
+ if (
248
+ "confidence" in value &&
249
+ value.confidence !== undefined &&
250
+ (typeof value.confidence !== "number" || value.confidence < 0 || value.confidence > 1)
251
+ ) {
252
+ return null;
253
+ }
254
+ return {
255
+ cardId: value.cardId,
256
+ title: "title" in value && typeof value.title === "string" ? value.title : undefined,
257
+ summary: "summary" in value && typeof value.summary === "string" ? value.summary : undefined,
258
+ categoryId: "categoryId" in value && typeof value.categoryId === "string" ? value.categoryId : undefined,
259
+ confidence: "confidence" in value && typeof value.confidence === "number" ? value.confidence : undefined,
260
+ uncertainty: "uncertainty" in value && typeof value.uncertainty === "string" ? value.uncertainty : undefined,
261
+ evidenceRange: { firstKey: range.firstKey, lastKey: range.lastKey },
262
+ };
263
+ }
264
+
265
+ function knownEvidenceKeys(cards: readonly TimelineCard[], observations: readonly TimelineObservation[]): Set<string> {
266
+ const keys = new Set<string>();
267
+ for (const observation of observations) keys.add(evidenceKeyOf(observation));
268
+ for (const card of cards) {
269
+ if (card.evidenceRange) {
270
+ keys.add(card.evidenceRange.firstKey);
271
+ keys.add(card.evidenceRange.lastKey);
272
+ }
273
+ }
274
+ return keys;
275
+ }
276
+
277
+ function applyOps(
278
+ cards: readonly TimelineCard[],
279
+ ops: readonly AnalysisOp[],
280
+ categories: readonly TimelineCategory[],
281
+ evidenceKeys: ReadonlySet<string>,
282
+ ): TimelineCard[] | null {
283
+ if (ops.length === 0) return cards as TimelineCard[];
284
+ const byId = new Map(cards.map((card) => [card.id, card]));
285
+ const allowedCategories = new Set(categories.map((category) => category.id));
286
+ const next = new Map<string, TimelineCard>();
287
+ for (const op of ops) {
288
+ const card = byId.get(op.cardId);
289
+ if (!card) return null;
290
+ if (!evidenceKeys.has(op.evidenceRange.firstKey) || !evidenceKeys.has(op.evidenceRange.lastKey)) return null;
291
+ if (op.categoryId !== undefined && !allowedCategories.has(op.categoryId)) return null;
292
+ if (card.manualEdit) continue;
293
+ next.set(card.id, {
294
+ ...card,
295
+ ...(op.title !== undefined ? { title: op.title } : {}),
296
+ ...(op.summary !== undefined ? { summary: op.summary } : {}),
297
+ ...(op.categoryId !== undefined ? { categoryId: op.categoryId } : {}),
298
+ ...(op.confidence !== undefined ? { confidence: op.confidence } : {}),
299
+ });
300
+ }
301
+ if (next.size === 0) return cards as TimelineCard[];
302
+ return cards.map((card) => next.get(card.id) ?? card);
303
+ }
304
+
305
+ /** Analyze one day of cards. Failures return the input cards unchanged. */
306
+ export async function analyzeTimelineCards(input: TimelineAnalysisInput): Promise<TimelineAnalysisResult> {
307
+ const cards = input.cards as TimelineCard[];
308
+ if (!input.enabled) {
309
+ return { status: "disabled", cards };
310
+ }
311
+
312
+ const provider = requiredToken(input.provider, "provider");
313
+ const model = requiredToken(input.model, "model");
314
+ const complete = input.complete;
315
+ if (typeof complete !== "function") {
316
+ throw new TimelineAnalysisConfigError("complete is required");
317
+ }
318
+ const timeoutMs = input.timeoutMs ?? TIMELINE_ANALYSIS_DEFAULT_TIMEOUT_MS;
319
+ if (!Number.isInteger(timeoutMs) || timeoutMs <= 0) {
320
+ throw new TimelineAnalysisConfigError("timeoutMs must be a positive integer");
321
+ }
322
+ if (input.cards.length === 0 && input.observations.length === 0) {
323
+ return fail("invalid_output", cards, provider, model);
324
+ }
325
+
326
+ const categories = input.categories ?? DEFAULT_TIMELINE_CATEGORIES;
327
+ const ordered = sortObservations(input.observations);
328
+ const batches = batchObservations(ordered);
329
+ const merged = new Map<string, AnalysisOp>();
330
+
331
+ try {
332
+ for (const batch of batches) {
333
+ const prompt = buildTimelineAnalysisPrompt({
334
+ date: input.date,
335
+ timezone: input.timezone,
336
+ cards: input.cards,
337
+ observations: batch,
338
+ categories,
339
+ preferences: input.preferences,
340
+ priorEdits: input.priorEdits,
341
+ });
342
+ const raw = await callComplete(complete, prompt, provider, model, timeoutMs, input.signal);
343
+ const ops = parseOps(raw);
344
+ if (!ops) return fail("invalid_output", cards, provider, model);
345
+ for (const op of ops) merged.set(op.cardId, op);
346
+ }
347
+ } catch {
348
+ return fail("provider_failed", cards, provider, model);
349
+ }
350
+
351
+ const applied = applyOps(cards, [...merged.values()], categories, knownEvidenceKeys(cards, ordered));
352
+ if (!applied) return fail("invalid_output", cards, provider, model);
353
+
354
+ log.info(`timeline analysis status=ok provider=${provider} model=${model} promptVersion=${TIMELINE_ANALYSIS_PROMPT_VERSION}`);
355
+ return {
356
+ status: "ok",
357
+ cards: applied,
358
+ provider,
359
+ model,
360
+ promptVersion: TIMELINE_ANALYSIS_PROMPT_VERSION,
361
+ };
362
+ }
@@ -4,3 +4,10 @@ export * from "./categories.js";
4
4
  export * from "./classify.js";
5
5
  export * from "./build.js";
6
6
  export * from "./corrections.js";
7
+ export * from "./query.js";
8
+ export * from "./journal-recap.js";
9
+ export * from "./journal-recap-persist.js";
10
+ export * from "./weekly.js";
11
+ export * from "./weekly-persist.js";
12
+ export * from "./analysis.js";
13
+ export * from "./analysis-batch.js";
@@ -0,0 +1,148 @@
1
+ import assert from "node:assert/strict";
2
+ import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import path from "node:path";
5
+ import test from "node:test";
6
+
7
+ import { journalPath } from "../journal.js";
8
+ import { persistDeterministicJournal } from "./journal-recap-persist.js";
9
+ import { renderDeterministicJournal } from "./journal-recap.js";
10
+ import type { TimelineCard } from "./types.js";
11
+
12
+ const DATE = "2026-08-17";
13
+ const TZ = "UTC";
14
+
15
+ function card(
16
+ overrides: Partial<TimelineCard> & Pick<TimelineCard, "id" | "startUtc" | "endUtc">,
17
+ ): TimelineCard {
18
+ return {
19
+ kind: "activity",
20
+ title: "Untitled",
21
+ summary: "none",
22
+ categoryId: "development",
23
+ confidence: 1,
24
+ dayKey: DATE,
25
+ timezone: TZ,
26
+ machine: "ws-a",
27
+ evidenceIds: [],
28
+ evidenceRange: null,
29
+ ...overrides,
30
+ };
31
+ }
32
+
33
+ function activityCards(): TimelineCard[] {
34
+ return [
35
+ card({
36
+ id: "act-1",
37
+ title: "Terminal",
38
+ startUtc: "2026-08-17T14:00:00.000Z",
39
+ endUtc: "2026-08-17T15:30:00.000Z",
40
+ }),
41
+ ];
42
+ }
43
+
44
+ function otherCards(): TimelineCard[] {
45
+ return [
46
+ card({
47
+ id: "act-2",
48
+ title: "Browser",
49
+ startUtc: "2026-08-17T16:00:00.000Z",
50
+ endUtc: "2026-08-17T17:00:00.000Z",
51
+ }),
52
+ ];
53
+ }
54
+
55
+ function withMemoryDir(fn: (memoryDir: string) => void): void {
56
+ const memoryDir = mkdtempSync(path.join(tmpdir(), "remnic-journal-recap-persist-"));
57
+ try {
58
+ fn(memoryDir);
59
+ } finally {
60
+ rmSync(memoryDir, { recursive: true, force: true });
61
+ }
62
+ }
63
+
64
+ test("persist is a hard no-op without force", () => {
65
+ withMemoryDir((memoryDir) => {
66
+ const first = persistDeterministicJournal({
67
+ memoryDir,
68
+ date: DATE,
69
+ cards: activityCards(),
70
+ timezone: TZ,
71
+ });
72
+ assert.equal(first.wrote, true);
73
+ assert.equal(first.path, journalPath(memoryDir, DATE));
74
+ const original = readFileSync(first.path);
75
+ assert.equal(
76
+ original.toString("utf8"),
77
+ renderDeterministicJournal(activityCards(), { date: DATE, timezone: TZ }),
78
+ );
79
+
80
+ const second = persistDeterministicJournal({
81
+ memoryDir,
82
+ date: DATE,
83
+ cards: otherCards(),
84
+ timezone: TZ,
85
+ });
86
+ assert.equal(second.wrote, false);
87
+ assert.equal(second.path, first.path);
88
+ assert.deepEqual(readFileSync(second.path), original);
89
+ });
90
+ });
91
+
92
+ test("persist with force overwrites the existing file", () => {
93
+ withMemoryDir((memoryDir) => {
94
+ persistDeterministicJournal({
95
+ memoryDir,
96
+ date: DATE,
97
+ cards: activityCards(),
98
+ timezone: TZ,
99
+ });
100
+ const original = readFileSync(journalPath(memoryDir, DATE), "utf8");
101
+ const forced = persistDeterministicJournal({
102
+ memoryDir,
103
+ date: DATE,
104
+ cards: otherCards(),
105
+ timezone: TZ,
106
+ force: true,
107
+ });
108
+ assert.equal(forced.wrote, true);
109
+ const next = readFileSync(forced.path, "utf8");
110
+ assert.notEqual(next, original);
111
+ assert.equal(next, renderDeterministicJournal(otherCards(), { date: DATE, timezone: TZ }));
112
+ });
113
+ });
114
+
115
+ test("empty day still writes a valid journal file", () => {
116
+ withMemoryDir((memoryDir) => {
117
+ const result = persistDeterministicJournal({
118
+ memoryDir,
119
+ date: DATE,
120
+ cards: [],
121
+ timezone: TZ,
122
+ });
123
+ assert.equal(result.wrote, true);
124
+ const relative = path.relative(memoryDir, result.path).replace(/\\/g, "/");
125
+ assert.equal(relative, "journal/2026-08-17.md");
126
+ assert.equal(
127
+ readFileSync(result.path, "utf8"),
128
+ renderDeterministicJournal([], { date: DATE, timezone: TZ }),
129
+ );
130
+ });
131
+ });
132
+
133
+ test("existing foreign file without force stays byte-identical", () => {
134
+ withMemoryDir((memoryDir) => {
135
+ const filePath = journalPath(memoryDir, DATE);
136
+ mkdirSync(path.dirname(filePath), { recursive: true });
137
+ writeFileSync(filePath, "user notes\n");
138
+ const original = readFileSync(filePath);
139
+ const result = persistDeterministicJournal({
140
+ memoryDir,
141
+ date: DATE,
142
+ cards: activityCards(),
143
+ timezone: TZ,
144
+ });
145
+ assert.equal(result.wrote, false);
146
+ assert.deepEqual(readFileSync(filePath), original);
147
+ });
148
+ });
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Persist a deterministic daily journal recap (issue #2051).
3
+ *
4
+ * Writes journal/<YYYY-MM-DD>.md through writeJournalFile. Existing files
5
+ * stay byte-identical unless force is set. Body is renderDeterministicJournal.
6
+ */
7
+ import { journalPath, writeJournalFile } from "../journal.js";
8
+ import { renderDeterministicJournal } from "./journal-recap.js";
9
+ import type { TimelineCard } from "./types.js";
10
+
11
+ export interface PersistDeterministicJournalInput {
12
+ memoryDir: string;
13
+ date: string;
14
+ cards: readonly TimelineCard[];
15
+ timezone: string;
16
+ force?: boolean;
17
+ }
18
+
19
+ export interface PersistDeterministicJournalResult {
20
+ path: string;
21
+ wrote: boolean;
22
+ }
23
+
24
+ export function persistDeterministicJournal(
25
+ input: PersistDeterministicJournalInput,
26
+ ): PersistDeterministicJournalResult {
27
+ const filePath = journalPath(input.memoryDir, input.date);
28
+ const wrote = writeJournalFile(
29
+ filePath,
30
+ renderDeterministicJournal(input.cards, {
31
+ date: input.date,
32
+ timezone: input.timezone,
33
+ }),
34
+ input.force === true,
35
+ );
36
+ return { path: filePath, wrote };
37
+ }
@@ -0,0 +1,113 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+
4
+ import type { TimelineCard } from "./types.js";
5
+ import { renderDeterministicJournal } from "./journal-recap.js";
6
+
7
+ const DATE = "2026-08-17";
8
+ const TZ = "UTC";
9
+
10
+ function card(
11
+ overrides: Partial<TimelineCard> & Pick<TimelineCard, "id" | "startUtc" | "endUtc">,
12
+ ): TimelineCard {
13
+ return {
14
+ kind: "activity",
15
+ title: "Untitled",
16
+ summary: "none",
17
+ categoryId: "development",
18
+ confidence: 1,
19
+ dayKey: DATE,
20
+ timezone: TZ,
21
+ machine: "ws-a",
22
+ evidenceIds: [],
23
+ evidenceRange: null,
24
+ ...overrides,
25
+ };
26
+ }
27
+
28
+ const EMPTY_DAY = [
29
+ `# Journal — ${DATE} (${TZ})`,
30
+ "",
31
+ "## Categories",
32
+ "",
33
+ "_No categories._",
34
+ "",
35
+ "## Cards",
36
+ "",
37
+ "_No cards._",
38
+ "",
39
+ "## Gaps / idle / pause",
40
+ "",
41
+ "- Gaps: 1",
42
+ "- Idle: 0",
43
+ "- Pause: 0",
44
+ "",
45
+ ].join("\n");
46
+
47
+ const ONE_ACTIVITY_PLUS_IDLE = [
48
+ `# Journal — ${DATE} (${TZ})`,
49
+ "",
50
+ "## Categories",
51
+ "",
52
+ "- 90m development",
53
+ "- 15m system.idle",
54
+ "",
55
+ "## Cards",
56
+ "",
57
+ "- 90m Terminal",
58
+ "- 15m Idle",
59
+ "",
60
+ "## Gaps / idle / pause",
61
+ "",
62
+ "- Gaps: 2",
63
+ "- Idle: 1",
64
+ "- Pause: 0",
65
+ "",
66
+ ].join("\n");
67
+
68
+ function activityPlusIdle(): TimelineCard[] {
69
+ return [
70
+ card({
71
+ id: "idle-1",
72
+ kind: "idle",
73
+ title: "Idle",
74
+ categoryId: "system.idle",
75
+ startUtc: "2026-08-17T15:30:00.000Z",
76
+ endUtc: "2026-08-17T15:45:00.000Z",
77
+ }),
78
+ card({
79
+ id: "act-1",
80
+ title: "Terminal",
81
+ startUtc: "2026-08-17T14:00:00.000Z",
82
+ endUtc: "2026-08-17T15:30:00.000Z",
83
+ }),
84
+ ];
85
+ }
86
+
87
+ test("empty day still produces a valid journal body", () => {
88
+ const body = renderDeterministicJournal([], { date: DATE, timezone: TZ });
89
+ assert.equal(body, EMPTY_DAY);
90
+ assert.match(body, /^# Journal — /);
91
+ assert.equal(body.endsWith("\n"), true);
92
+ });
93
+
94
+ test("one activity plus idle lists durations, titles, and gap counts", () => {
95
+ const body = renderDeterministicJournal(activityPlusIdle(), { date: DATE, timezone: TZ });
96
+ assert.equal(body, ONE_ACTIVITY_PLUS_IDLE);
97
+ });
98
+
99
+ test("same cards render byte-stable on rerun", () => {
100
+ const cards = activityPlusIdle();
101
+ const first = renderDeterministicJournal(cards, { date: DATE, timezone: TZ });
102
+ const second = renderDeterministicJournal(cards, { date: DATE, timezone: TZ });
103
+ assert.equal(first, second);
104
+ assert.equal(Buffer.byteLength(first), Buffer.byteLength(second));
105
+ });
106
+
107
+ test("recap does not invent people or mood claims", () => {
108
+ const body = renderDeterministicJournal(activityPlusIdle(), { date: DATE, timezone: TZ });
109
+ assert.equal(/Alice|Bob|Charlie|meeting with/i.test(body), false);
110
+ assert.equal(/productivity|mood|intent|score/i.test(body), false);
111
+ assert.match(body, /Terminal/);
112
+ assert.match(body, /Idle/);
113
+ });