@remnic/core 9.65.5 → 9.65.7

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 (500) hide show
  1. package/dist/access-admin-ops-surface.d.ts +11 -11
  2. package/dist/access-admin-ops-surface.js +26 -26
  3. package/dist/access-authorization-probe.d.ts +11 -11
  4. package/dist/access-authorization-probe.js +27 -27
  5. package/dist/access-boundary.d.ts +11 -11
  6. package/dist/access-boundary.js +26 -26
  7. package/dist/access-cli.js +110 -104
  8. package/dist/access-cli.js.map +1 -1
  9. package/dist/access-coding-context-resolution.d.ts +1 -1
  10. package/dist/access-extraction-force-flush.d.ts +11 -11
  11. package/dist/access-extraction-force-flush.js +26 -26
  12. package/dist/access-health-types.d.ts +1 -1
  13. package/dist/access-http-lcm-compaction.d.ts +11 -11
  14. package/dist/access-http-lifecycle-flush.d.ts +11 -11
  15. package/dist/access-http-offline-stream.d.ts +11 -11
  16. package/dist/access-http-query.d.ts +2 -2
  17. package/dist/access-http-query.js +28 -28
  18. package/dist/access-http.d.ts +13 -18
  19. package/dist/access-http.js +46 -44
  20. package/dist/access-identity-continuity-surface.d.ts +9 -9
  21. package/dist/access-identity-continuity-surface.js +26 -26
  22. package/dist/access-lcm-surface.d.ts +11 -11
  23. package/dist/access-lcm-surface.js +26 -26
  24. package/dist/access-mcp-output-schemas.js +1 -1
  25. package/dist/access-mcp.d.ts +11 -11
  26. package/dist/access-mcp.js +37 -35
  27. package/dist/access-memory-search-fanout.d.ts +2 -2
  28. package/dist/{access-namespace-preflight-D_6mo8ms.d.ts → access-namespace-preflight-8VYKmRX0.d.ts} +1 -1
  29. package/dist/access-namespace-preflight.d.ts +3 -3
  30. package/dist/access-namespace-preflight.js +26 -26
  31. package/dist/access-observe-write-surface.d.ts +11 -11
  32. package/dist/access-observe-write-surface.js +26 -26
  33. package/dist/access-offline-manifest.d.ts +9 -9
  34. package/dist/access-operations-batch.js +29 -29
  35. package/dist/access-operations.d.ts +12 -12
  36. package/dist/access-operations.js +34 -32
  37. package/dist/access-recall-concurrency.d.ts +11 -11
  38. package/dist/access-recall-concurrency.js +26 -26
  39. package/dist/access-recall-response.d.ts +11 -11
  40. package/dist/access-recall-response.js +26 -26
  41. package/dist/access-recall-surface.d.ts +11 -11
  42. package/dist/access-recall-surface.js +26 -26
  43. package/dist/access-schema.js +3 -3
  44. package/dist/{access-service-sbiNS5UB.d.ts → access-service-Crk__Git.d.ts} +8 -8
  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 +26 -26
  48. package/dist/access-surface-catalog.d.ts +11 -11
  49. package/dist/access-surface-catalog.js +38 -28
  50. package/dist/access-surface-catalog.js.map +1 -1
  51. package/dist/access-wearables-meetings-surface.d.ts +3 -3
  52. package/dist/action-confidence.d.ts +1 -1
  53. package/dist/active-memory-bridge.d.ts +1 -1
  54. package/dist/active-recall.d.ts +1 -1
  55. package/dist/active-recall.js +4 -4
  56. package/dist/adapters/index.js +4 -4
  57. package/dist/adapters/registry.js +2 -2
  58. package/dist/ambient-provenance.d.ts +1 -1
  59. package/dist/artifact-search.d.ts +1 -1
  60. package/dist/behavior-learner.d.ts +1 -1
  61. package/dist/behavior-signals.d.ts +1 -1
  62. package/dist/bootstrap.d.ts +9 -9
  63. package/dist/briefing-window.d.ts +2 -2
  64. package/dist/briefing.d.ts +2 -2
  65. package/dist/briefing.js +8 -8
  66. package/dist/buffer-surprise-report.d.ts +1 -1
  67. package/dist/buffer-turn-helpers.d.ts +1 -1
  68. package/dist/buffer.d.ts +2 -2
  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/{capsule-crypto-YO5QJ6L3.js → capsule-crypto-7FJQINUR.js} +2 -2
  73. package/dist/{catalog-DO_7zfkv.d.ts → catalog-DybwVNW3.d.ts} +1 -1
  74. package/dist/causal-behavior.d.ts +1 -1
  75. package/dist/causal-behavior.js +2 -2
  76. package/dist/causal-chain.js +2 -2
  77. package/dist/causal-consolidation.d.ts +1 -1
  78. package/dist/causal-consolidation.js +11 -11
  79. package/dist/causal-retrieval.js +2 -2
  80. package/dist/causal-trajectory-graph.d.ts +1 -1
  81. package/dist/causal-trajectory-graph.js +2 -2
  82. package/dist/causal-trajectory.js +1 -1
  83. package/dist/{chunk-BXLOS5AJ.js → chunk-2NLLXCJG.js} +2 -2
  84. package/dist/{chunk-NZPFCP5A.js → chunk-2PSX5BJU.js} +2 -2
  85. package/dist/chunk-3BCULS4U.js +1093 -0
  86. package/dist/chunk-3BCULS4U.js.map +1 -0
  87. package/dist/{chunk-IIRCHGWD.js → chunk-3RI5Y7KU.js} +2 -2
  88. package/dist/{chunk-H7BZBSP6.js → chunk-52II7PB6.js} +4 -4
  89. package/dist/{chunk-J3ATBB7M.js → chunk-5DH6PG4B.js} +2 -2
  90. package/dist/{chunk-M4AHBM72.js → chunk-5HERQ5FX.js} +10 -10
  91. package/dist/{chunk-W675UJCZ.js → chunk-5HK3CJAR.js} +2 -2
  92. package/dist/{chunk-2MVTAIL3.js → chunk-5S4LQOPE.js} +2 -2
  93. package/dist/{chunk-OZDFB22S.js → chunk-5VPQSRQO.js} +3 -3
  94. package/dist/{chunk-YZJM6CLF.js → chunk-6CPUQ5D6.js} +10 -10
  95. package/dist/{chunk-2IXQSGCU.js → chunk-7F27PCSN.js} +2 -2
  96. package/dist/{chunk-OWQNJJY2.js → chunk-7TCGNUVP.js} +2 -2
  97. package/dist/{chunk-3NH3VP3U.js → chunk-7WR462EM.js} +2 -2
  98. package/dist/{chunk-NH6LC57D.js → chunk-A32YEQAM.js} +2 -2
  99. package/dist/{chunk-HF5BUTI6.js → chunk-ACOC27BB.js} +2 -2
  100. package/dist/{chunk-N56GVOWR.js → chunk-AFR6AIM4.js} +144 -78
  101. package/dist/chunk-AFR6AIM4.js.map +1 -0
  102. package/dist/{chunk-LYBIHM4N.js → chunk-ANJXPFRS.js} +47 -26
  103. package/dist/chunk-ANJXPFRS.js.map +1 -0
  104. package/dist/{chunk-FC7TIRFS.js → chunk-AX7UXCHJ.js} +6 -1
  105. package/dist/chunk-AX7UXCHJ.js.map +1 -0
  106. package/dist/{chunk-THVI4Y7X.js → chunk-BJTHRFFC.js} +6 -6
  107. package/dist/chunk-BWGCOLEL.js +61 -0
  108. package/dist/chunk-BWGCOLEL.js.map +1 -0
  109. package/dist/{chunk-BW4GAF57.js → chunk-CFGU52XJ.js} +2 -2
  110. package/dist/{chunk-DPNXADEI.js → chunk-D4QVPP3G.js} +2 -2
  111. package/dist/{chunk-BK5G2MHO.js → chunk-EOHKUWXW.js} +2 -2
  112. package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
  113. package/dist/{chunk-ZK4BFABK.js → chunk-F635GAL7.js} +4 -4
  114. package/dist/{chunk-IURMJBGP.js → chunk-F6QHHRWP.js} +2 -2
  115. package/dist/{chunk-BA2GLSIP.js → chunk-FMQ4MOQO.js} +91 -28
  116. package/dist/chunk-FMQ4MOQO.js.map +1 -0
  117. package/dist/{chunk-LDBFXD4F.js → chunk-FP7YTTVO.js} +3 -1
  118. package/dist/chunk-FP7YTTVO.js.map +1 -0
  119. package/dist/{chunk-TJFI3K2O.js → chunk-GEPACVWN.js} +2 -2
  120. package/dist/{chunk-PP7R754B.js → chunk-GPFZFCRN.js} +1 -1
  121. package/dist/{chunk-UCKG36HO.js → chunk-GTSVEEP3.js} +2 -2
  122. package/dist/{chunk-KTPXXVDQ.js → chunk-I4343FIA.js} +79 -6
  123. package/dist/chunk-I4343FIA.js.map +1 -0
  124. package/dist/{chunk-DPGH6LHQ.js → chunk-I7EX6KSH.js} +57 -57
  125. package/dist/{chunk-JPAKBNTM.js → chunk-IP4ZNT4U.js} +2 -2
  126. package/dist/{chunk-AXGFOFNY.js → chunk-IY7UXD3J.js} +2 -2
  127. package/dist/{chunk-YHCBJULX.js → chunk-JAQXUGLN.js} +2 -2
  128. package/dist/{chunk-RKNJBZ55.js → chunk-JBPKEARU.js} +4 -4
  129. package/dist/chunk-JCCWJHOP.js +240 -0
  130. package/dist/chunk-JCCWJHOP.js.map +1 -0
  131. package/dist/{chunk-VDX2J7OX.js → chunk-KQAFEZQX.js} +2 -2
  132. package/dist/{chunk-D2YNNDML.js → chunk-KWIGDKM2.js} +2 -2
  133. package/dist/{chunk-YB4GBWBU.js → chunk-LLQCM2U2.js} +81 -81
  134. package/dist/{chunk-OLBZ2WGG.js → chunk-LTBKKSCX.js} +2 -2
  135. package/dist/{chunk-DORFF5N5.js → chunk-NG3MBQV4.js} +2 -2
  136. package/dist/{chunk-DUEDOYZD.js → chunk-OPGL46PX.js} +2 -2
  137. package/dist/{chunk-OUKBMQ2O.js → chunk-PD66CVSD.js} +2 -2
  138. package/dist/{chunk-CQBIN77D.js → chunk-PDDSFELN.js} +2 -2
  139. package/dist/{chunk-6433HV72.js → chunk-PMVPCZJZ.js} +2 -2
  140. package/dist/{chunk-DJZWNKFO.js → chunk-RGCF4XNH.js} +7 -7
  141. package/dist/{chunk-CV3GNPOE.js → chunk-RQE4TITU.js} +29 -24
  142. package/dist/chunk-RQE4TITU.js.map +1 -0
  143. package/dist/{chunk-4JSF7UUP.js → chunk-S3K2CIK5.js} +2 -2
  144. package/dist/chunk-SDEPLF7V.js +325 -0
  145. package/dist/chunk-SDEPLF7V.js.map +1 -0
  146. package/dist/{chunk-OCCHUEZB.js → chunk-SEA6M7SS.js} +2 -2
  147. package/dist/{chunk-KOO37E4Y.js → chunk-SVVIASVX.js} +2 -2
  148. package/dist/{chunk-4K7IW3F7.js → chunk-UD7UNYRD.js} +34 -3
  149. package/dist/chunk-UD7UNYRD.js.map +1 -0
  150. package/dist/chunk-ULM7JCDH.js +154 -0
  151. package/dist/chunk-ULM7JCDH.js.map +1 -0
  152. package/dist/{chunk-FBR7PIL4.js → chunk-VKCAHCBI.js} +2 -2
  153. package/dist/{chunk-WDXD6ITO.js → chunk-VXVZ2GM3.js} +2 -2
  154. package/dist/chunk-W2UOAATB.js +521 -0
  155. package/dist/chunk-W2UOAATB.js.map +1 -0
  156. package/dist/{chunk-DUZARALI.js → chunk-WTOZBZNN.js} +3 -3
  157. package/dist/{chunk-DQEMWVMT.js → chunk-X7Y7WX73.js} +1 -1
  158. package/dist/{chunk-2EPOGPKO.js → chunk-YKWFK7XA.js} +5 -5
  159. package/dist/{chunk-BIJAWZYW.js → chunk-YMOPYG3K.js} +6 -6
  160. package/dist/{chunk-UFR6HX7A.js → chunk-YRVAKONL.js} +1 -1
  161. package/dist/{chunk-ECLJ4LA2.js → chunk-YWSQD2IB.js} +2 -2
  162. package/dist/{chunk-NLEH4RTB.js → chunk-Z4U3UN56.js} +2 -2
  163. package/dist/{chunk-YDKF4MSJ.js → chunk-ZAOHJDKH.js} +3 -3
  164. package/dist/{chunk-KFIOPZ25.js → chunk-ZIJDI4CP.js} +2 -2
  165. package/dist/{cli-BqdqPdG_.d.ts → cli-B322UMvB.d.ts} +6 -6
  166. package/dist/cli.d.ts +14 -14
  167. package/dist/cli.js +73 -72
  168. package/dist/coding/pre-action-gate.d.ts +1 -1
  169. package/dist/coding/pre-action-gate.js +2 -2
  170. package/dist/compounding/engine.d.ts +2 -2
  171. package/dist/compounding/engine.js +8 -8
  172. package/dist/compounding/preference-consolidator.d.ts +1 -1
  173. package/dist/compression-optimizer.d.ts +1 -1
  174. package/dist/config.d.ts +1 -1
  175. package/dist/config.js +4 -4
  176. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  177. package/dist/connectors/codex-materialize-runner.js +8 -8
  178. package/dist/connectors/codex-materialize.d.ts +1 -1
  179. package/dist/connectors/index.d.ts +1 -1
  180. package/dist/connectors/index.js +8 -8
  181. package/dist/consolidation-provenance-check.d.ts +2 -2
  182. package/dist/consolidation-undo.d.ts +2 -2
  183. package/dist/contradiction/index.d.ts +3 -3
  184. package/dist/converge-config.d.ts +1 -1
  185. package/dist/convergence-refresh.d.ts +2 -2
  186. package/dist/convergence-refresh.js +10 -10
  187. package/dist/conversation-index/backend.d.ts +1 -1
  188. package/dist/conversation-index/chunker.d.ts +1 -1
  189. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  190. package/dist/conversation-index/indexer.d.ts +1 -1
  191. package/dist/conversation-index/search.d.ts +1 -1
  192. package/dist/corpus-watermark.d.ts +1 -1
  193. package/dist/corpus-watermark.js +10 -10
  194. package/dist/cross-lingual-recall.d.ts +1 -1
  195. package/dist/dashboard-runtime.js +2 -2
  196. package/dist/day-summary.d.ts +1 -1
  197. package/dist/delinearize.d.ts +1 -1
  198. package/dist/dependency-propagation-config.d.ts +1 -1
  199. package/dist/{dependency-propagation-delivery-D23_x-s5.d.ts → dependency-propagation-delivery-BGcNairQ.d.ts} +1 -1
  200. package/dist/direct-answer-wiring.d.ts +1 -1
  201. package/dist/direct-answer.d.ts +1 -1
  202. package/dist/embedding-fallback.d.ts +1 -1
  203. package/dist/enrichment/index.d.ts +1 -1
  204. package/dist/entity-origin-fields.d.ts +1 -1
  205. package/dist/entity-retrieval.d.ts +2 -2
  206. package/dist/entity-retrieval.js +8 -8
  207. package/dist/entity-schema.d.ts +1 -1
  208. package/dist/episodic-context.d.ts +1 -1
  209. package/dist/eval-trajectory-contracts.d.ts +256 -0
  210. package/dist/eval-trajectory-contracts.js +56 -0
  211. package/dist/eval-trajectory-store.d.ts +39 -0
  212. package/dist/eval-trajectory-store.js +19 -0
  213. package/dist/eval-trajectory-store.js.map +1 -0
  214. package/dist/eval-trajectory.d.ts +67 -0
  215. package/dist/eval-trajectory.js +46 -0
  216. package/dist/eval-trajectory.js.map +1 -0
  217. package/dist/event-order-recall.js +2 -2
  218. package/dist/explicit-capture.d.ts +9 -9
  219. package/dist/external-wiki-access.d.ts +11 -11
  220. package/dist/external-wiki-access.js +27 -27
  221. package/dist/external-wiki-collection-registration.d.ts +1 -1
  222. package/dist/external-wiki-collection.d.ts +1 -1
  223. package/dist/external-wiki-mcp-tools.d.ts +11 -11
  224. package/dist/extraction-error-classification.d.ts +1 -1
  225. package/dist/extraction-faithfulness.d.ts +1 -1
  226. package/dist/extraction-judge-telemetry.d.ts +1 -1
  227. package/dist/extraction-judge-training.d.ts +1 -1
  228. package/dist/extraction-judge.d.ts +1 -1
  229. package/dist/extraction-liveness.d.ts +1 -1
  230. package/dist/extraction-normalization.d.ts +1 -1
  231. package/dist/extraction-prompt.d.ts +1 -1
  232. package/dist/extraction-source-grounding-rules.d.ts +1 -1
  233. package/dist/extraction-source-grounding.d.ts +1 -1
  234. package/dist/extraction.d.ts +1 -1
  235. package/dist/extraction.js +10 -10
  236. package/dist/fallback-llm.d.ts +1 -1
  237. package/dist/graph-dashboard-diff.d.ts +1 -1
  238. package/dist/graph-dashboard-key.d.ts +1 -1
  239. package/dist/graph-dashboard-parser.d.ts +1 -1
  240. package/dist/{graph-edge-decay-FXGELBFA.js → graph-edge-decay-A4SDFMMS.js} +4 -4
  241. package/dist/graph-edge-decay-A4SDFMMS.js.map +1 -0
  242. package/dist/graph-edge-reinforcement.d.ts +1 -1
  243. package/dist/graph-path-reconstruction.d.ts +1 -1
  244. package/dist/graph-path-scoring.d.ts +1 -1
  245. package/dist/graph-snapshot.d.ts +1 -1
  246. package/dist/graph-snapshot.js +3 -3
  247. package/dist/graph.d.ts +1 -1
  248. package/dist/graph.js +3 -3
  249. package/dist/harmonic-retrieval.js +1 -1
  250. package/dist/importance.d.ts +1 -1
  251. package/dist/importers/index.d.ts +1 -1
  252. package/dist/in-flight-reads.d.ts +1 -1
  253. package/dist/{index--QhGIXF2.d.ts → index-By2QUAMh.d.ts} +2 -2
  254. package/dist/index.d.ts +27 -23
  255. package/dist/index.js +199 -141
  256. package/dist/intent.d.ts +1 -1
  257. package/dist/lcm/engine.d.ts +1 -1
  258. package/dist/lcm/engine.js +4 -4
  259. package/dist/lcm/index.d.ts +1 -1
  260. package/dist/lcm/index.js +10 -10
  261. package/dist/lcm/tools.d.ts +1 -1
  262. package/dist/lifecycle.d.ts +1 -1
  263. package/dist/live-connectors-runner.d.ts +1 -1
  264. package/dist/local-llm.d.ts +1 -1
  265. package/dist/local-model-endpoint.d.ts +1 -1
  266. package/dist/location/index.d.ts +128 -1
  267. package/dist/location/index.js +60 -750
  268. package/dist/location/index.js.map +1 -1
  269. package/dist/maintenance/memory-governance.d.ts +1 -1
  270. package/dist/maintenance/memory-governance.js +8 -8
  271. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  272. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +8 -8
  273. package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
  274. package/dist/maintenance/rebuild-memory-projection.js +9 -9
  275. package/dist/{maintenance-PFvY1Pw_.d.ts → maintenance-Dm2McrIx.d.ts} +4 -3
  276. package/dist/mcp-memory-inspector-app.d.ts +11 -11
  277. package/dist/mcp-read-only-tools.js +1 -1
  278. package/dist/memory-action-policy.d.ts +1 -1
  279. package/dist/memory-cache.d.ts +1 -1
  280. package/dist/memory-controller.d.ts +203 -0
  281. package/dist/memory-controller.js +23 -0
  282. package/dist/memory-controller.js.map +1 -0
  283. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  284. package/dist/memory-projection-store.d.ts +1 -1
  285. package/dist/memory-provenance.d.ts +1 -1
  286. package/dist/memory-snapshot.d.ts +1 -1
  287. package/dist/memory-subject-cli.d.ts +11 -11
  288. package/dist/memory-subject.d.ts +11 -11
  289. package/dist/memory-worth-outcomes.d.ts +47 -3
  290. package/dist/memory-worth-outcomes.js +5 -3
  291. package/dist/models-json.d.ts +1 -1
  292. package/dist/namespaces/migrate.d.ts +3 -3
  293. package/dist/namespaces/migrate.js +9 -9
  294. package/dist/namespaces/principal.d.ts +1 -1
  295. package/dist/namespaces/search.d.ts +1 -1
  296. package/dist/namespaces/search.js +5 -5
  297. package/dist/namespaces/storage.d.ts +3 -3
  298. package/dist/namespaces/storage.js +8 -8
  299. package/dist/native-knowledge.d.ts +1 -1
  300. package/dist/offline-sync-impression-drain.d.ts +1 -1
  301. package/dist/operator-doctor-corpus.d.ts +1 -1
  302. package/dist/operator-doctor-corpus.js +11 -11
  303. package/dist/operator-doctor-replica.d.ts +1 -1
  304. package/dist/operator-toolkit.d.ts +3 -3
  305. package/dist/operator-toolkit.js +22 -22
  306. package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
  307. package/dist/orchestration/maintenance.d.ts +4 -4
  308. package/dist/orchestration/maintenance.js +16 -14
  309. package/dist/{orchestrator-4wzJrPVm.d.ts → orchestrator-Co1DyfuP.d.ts} +8 -8
  310. package/dist/orchestrator.d.ts +9 -9
  311. package/dist/orchestrator.js +110 -104
  312. package/dist/patterns-cli.d.ts +1 -1
  313. package/dist/{pipeline-CgXgdIrF.d.ts → pipeline-DotMnb6y.d.ts} +1 -1
  314. package/dist/policy-runtime.d.ts +1 -1
  315. package/dist/proactive-contention.d.ts +1 -1
  316. package/dist/provenance.d.ts +1 -1
  317. package/dist/{public-http-BP3VQDl5.d.ts → public-http-PJRtnSi-.d.ts} +1 -1
  318. package/dist/{qmd-BppGGxsi.d.ts → qmd-BP0n11fR.d.ts} +1 -1
  319. package/dist/qmd-preflight.d.ts +2 -2
  320. package/dist/qmd-recall-cache.d.ts +1 -1
  321. package/dist/qmd.d.ts +2 -2
  322. package/dist/recall-concurrency-config.d.ts +1 -1
  323. package/dist/recall-disclosure-escalation.d.ts +1 -1
  324. package/dist/recall-explain-renderer.d.ts +1 -1
  325. package/dist/recall-memory-map.d.ts +1 -1
  326. package/dist/recall-planner-llm.d.ts +1 -1
  327. package/dist/recall-state.d.ts +1 -1
  328. package/dist/recall-tag-filter.d.ts +1 -1
  329. package/dist/recall-timings.d.ts +1 -1
  330. package/dist/recall-xray-cli.d.ts +1 -1
  331. package/dist/recall-xray-renderer.d.ts +1 -1
  332. package/dist/recall-xray.d.ts +1 -1
  333. package/dist/reconcile/cursor.d.ts +1 -1
  334. package/dist/reconcile/manifest.d.ts +1 -1
  335. package/dist/reconcile/plan.d.ts +1 -1
  336. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  337. package/dist/replay/normalizers/claude.d.ts +1 -1
  338. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  339. package/dist/replay/normalizers/shared.d.ts +1 -1
  340. package/dist/replay/runner.d.ts +1 -1
  341. package/dist/replay/types.d.ts +1 -1
  342. package/dist/replica-divergence.d.ts +1 -1
  343. package/dist/replica-peers-config.d.ts +1 -1
  344. package/dist/resolve-auth-token.d.ts +1 -1
  345. package/dist/resume-bundles.js +5 -5
  346. package/dist/retrieval-agents.d.ts +2 -2
  347. package/dist/retrieval-tiers.d.ts +1 -1
  348. package/dist/routing/engine.d.ts +1 -1
  349. package/dist/routing/store.d.ts +1 -1
  350. package/dist/salvage-envelope.d.ts +1 -1
  351. package/dist/{scope-profiles-ChZUtxDU.d.ts → scope-profiles-6ChZKTy-.d.ts} +1 -1
  352. package/dist/search/embed-helper.d.ts +1 -1
  353. package/dist/search/factory.d.ts +1 -1
  354. package/dist/search/factory.js +4 -4
  355. package/dist/search/index.d.ts +1 -1
  356. package/dist/search/index.js +10 -10
  357. package/dist/search/lancedb-backend.d.ts +1 -1
  358. package/dist/search/meilisearch-backend.d.ts +1 -1
  359. package/dist/search/noop-backend.d.ts +1 -1
  360. package/dist/search/orama-backend.d.ts +1 -1
  361. package/dist/search/port.d.ts +1 -1
  362. package/dist/search/remote-backend.d.ts +1 -1
  363. package/dist/{semantic-consolidation-mSPwQSmF.d.ts → semantic-consolidation-DziYcW5J.d.ts} +1 -1
  364. package/dist/semantic-consolidation.d.ts +2 -2
  365. package/dist/semantic-consolidation.js +9 -9
  366. package/dist/semantic-rule-promotion.js +8 -8
  367. package/dist/semantic-rule-verifier.d.ts +1 -1
  368. package/dist/semantic-rule-verifier.js +8 -8
  369. package/dist/{service-BICWLwSP.d.ts → service-C7rIBuK_.d.ts} +2 -2
  370. package/dist/session-observer-bands.d.ts +1 -1
  371. package/dist/session-observer-state.d.ts +1 -1
  372. package/dist/shared-context/manager.d.ts +1 -1
  373. package/dist/signal.d.ts +1 -1
  374. package/dist/source-agent-qualifier.d.ts +1 -1
  375. package/dist/source-agent-qualifier.js +8 -8
  376. package/dist/{storage-B7urx1K3.d.ts → storage-B1hEx8Xg.d.ts} +1 -1
  377. package/dist/storage.d.ts +2 -2
  378. package/dist/storage.js +7 -7
  379. package/dist/subject-config.d.ts +1 -1
  380. package/dist/summarizer.d.ts +1 -1
  381. package/dist/summary-snapshot.d.ts +1 -1
  382. package/dist/support-passport/index.d.ts +14 -14
  383. package/dist/support-passport/index.js +29 -29
  384. package/dist/temporal-supersession.d.ts +2 -2
  385. package/dist/temporal-timeline-recall.d.ts +1 -1
  386. package/dist/temporal-validity.d.ts +1 -1
  387. package/dist/threading.d.ts +1 -1
  388. package/dist/tier-migration.d.ts +2 -2
  389. package/dist/tier-routing.d.ts +1 -1
  390. package/dist/topics.d.ts +1 -1
  391. package/dist/transcript.d.ts +1 -1
  392. package/dist/transfer/backup.js +2 -2
  393. package/dist/transfer/capsule-export.js +2 -2
  394. package/dist/transfer/capsule-import.js +2 -2
  395. package/dist/trust-score-stage.d.ts +1 -1
  396. package/dist/trust-score.d.ts +1 -1
  397. package/dist/{types-ETU5N6nB.d.ts → types-BHDNxGTT.d.ts} +1 -1
  398. package/dist/types.d.ts +1 -1
  399. package/dist/utility-runtime.d.ts +1 -1
  400. package/dist/verified-recall.js +8 -8
  401. package/dist/who-knows-cli.d.ts +11 -11
  402. package/dist/who-knows-cli.js +9 -9
  403. package/dist/who-knows.d.ts +11 -11
  404. package/dist/who-knows.js +8 -8
  405. package/dist/write-envelope.d.ts +1 -1
  406. package/package.json +2 -2
  407. package/src/access-boundary.ts +5 -0
  408. package/src/access-http.ts +15 -16
  409. package/src/access-mcp-output-schemas.ts +5 -0
  410. package/src/access-mcp.ts +6 -6
  411. package/src/access-operations.ts +2 -0
  412. package/src/access-surface-catalog.ts +10 -0
  413. package/src/eval-trajectory-contracts.ts +411 -0
  414. package/src/eval-trajectory-store.ts +306 -0
  415. package/src/eval-trajectory.test.ts +534 -0
  416. package/src/eval-trajectory.ts +773 -0
  417. package/src/index.ts +5 -0
  418. package/src/location/access-operations.ts +84 -0
  419. package/src/location/http-glue.test.ts +100 -0
  420. package/src/location/http-glue.ts +85 -0
  421. package/src/location/index.ts +3 -0
  422. package/src/location/mcp-tools.ts +82 -0
  423. package/src/location/provider-setup.test.ts +106 -0
  424. package/src/location/provider-setup.ts +103 -0
  425. package/src/location/scheduler.test.ts +113 -0
  426. package/src/location/scheduler.ts +98 -0
  427. package/src/location/surfaces.test.ts +241 -0
  428. package/src/location/surfaces.ts +329 -0
  429. package/src/maintenance/day-summary-cron.ts +45 -0
  430. package/src/mcp-read-only-tools.ts +2 -0
  431. package/src/memory-controller.test.ts +347 -0
  432. package/src/memory-controller.ts +547 -0
  433. package/src/memory-worth-outcomes.test.ts +53 -18
  434. package/src/memory-worth-outcomes.ts +91 -9
  435. package/src/orchestration/maintenance.ts +22 -30
  436. package/src/wearables/http-glue.ts +28 -0
  437. package/dist/chunk-4K7IW3F7.js.map +0 -1
  438. package/dist/chunk-BA2GLSIP.js.map +0 -1
  439. package/dist/chunk-CV3GNPOE.js.map +0 -1
  440. package/dist/chunk-FC7TIRFS.js.map +0 -1
  441. package/dist/chunk-KTPXXVDQ.js.map +0 -1
  442. package/dist/chunk-LDBFXD4F.js.map +0 -1
  443. package/dist/chunk-LYBIHM4N.js.map +0 -1
  444. package/dist/chunk-N56GVOWR.js.map +0 -1
  445. /package/dist/{capsule-crypto-YO5QJ6L3.js.map → capsule-crypto-7FJQINUR.js.map} +0 -0
  446. /package/dist/{chunk-BXLOS5AJ.js.map → chunk-2NLLXCJG.js.map} +0 -0
  447. /package/dist/{chunk-NZPFCP5A.js.map → chunk-2PSX5BJU.js.map} +0 -0
  448. /package/dist/{chunk-IIRCHGWD.js.map → chunk-3RI5Y7KU.js.map} +0 -0
  449. /package/dist/{chunk-H7BZBSP6.js.map → chunk-52II7PB6.js.map} +0 -0
  450. /package/dist/{chunk-J3ATBB7M.js.map → chunk-5DH6PG4B.js.map} +0 -0
  451. /package/dist/{chunk-M4AHBM72.js.map → chunk-5HERQ5FX.js.map} +0 -0
  452. /package/dist/{chunk-W675UJCZ.js.map → chunk-5HK3CJAR.js.map} +0 -0
  453. /package/dist/{chunk-2MVTAIL3.js.map → chunk-5S4LQOPE.js.map} +0 -0
  454. /package/dist/{chunk-OZDFB22S.js.map → chunk-5VPQSRQO.js.map} +0 -0
  455. /package/dist/{chunk-YZJM6CLF.js.map → chunk-6CPUQ5D6.js.map} +0 -0
  456. /package/dist/{chunk-2IXQSGCU.js.map → chunk-7F27PCSN.js.map} +0 -0
  457. /package/dist/{chunk-OWQNJJY2.js.map → chunk-7TCGNUVP.js.map} +0 -0
  458. /package/dist/{chunk-3NH3VP3U.js.map → chunk-7WR462EM.js.map} +0 -0
  459. /package/dist/{chunk-NH6LC57D.js.map → chunk-A32YEQAM.js.map} +0 -0
  460. /package/dist/{chunk-HF5BUTI6.js.map → chunk-ACOC27BB.js.map} +0 -0
  461. /package/dist/{chunk-THVI4Y7X.js.map → chunk-BJTHRFFC.js.map} +0 -0
  462. /package/dist/{chunk-BW4GAF57.js.map → chunk-CFGU52XJ.js.map} +0 -0
  463. /package/dist/{chunk-DPNXADEI.js.map → chunk-D4QVPP3G.js.map} +0 -0
  464. /package/dist/{chunk-BK5G2MHO.js.map → chunk-EOHKUWXW.js.map} +0 -0
  465. /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
  466. /package/dist/{chunk-ZK4BFABK.js.map → chunk-F635GAL7.js.map} +0 -0
  467. /package/dist/{chunk-IURMJBGP.js.map → chunk-F6QHHRWP.js.map} +0 -0
  468. /package/dist/{chunk-TJFI3K2O.js.map → chunk-GEPACVWN.js.map} +0 -0
  469. /package/dist/{chunk-PP7R754B.js.map → chunk-GPFZFCRN.js.map} +0 -0
  470. /package/dist/{chunk-UCKG36HO.js.map → chunk-GTSVEEP3.js.map} +0 -0
  471. /package/dist/{chunk-DPGH6LHQ.js.map → chunk-I7EX6KSH.js.map} +0 -0
  472. /package/dist/{chunk-JPAKBNTM.js.map → chunk-IP4ZNT4U.js.map} +0 -0
  473. /package/dist/{chunk-AXGFOFNY.js.map → chunk-IY7UXD3J.js.map} +0 -0
  474. /package/dist/{chunk-YHCBJULX.js.map → chunk-JAQXUGLN.js.map} +0 -0
  475. /package/dist/{chunk-RKNJBZ55.js.map → chunk-JBPKEARU.js.map} +0 -0
  476. /package/dist/{chunk-VDX2J7OX.js.map → chunk-KQAFEZQX.js.map} +0 -0
  477. /package/dist/{chunk-D2YNNDML.js.map → chunk-KWIGDKM2.js.map} +0 -0
  478. /package/dist/{chunk-YB4GBWBU.js.map → chunk-LLQCM2U2.js.map} +0 -0
  479. /package/dist/{chunk-OLBZ2WGG.js.map → chunk-LTBKKSCX.js.map} +0 -0
  480. /package/dist/{chunk-DORFF5N5.js.map → chunk-NG3MBQV4.js.map} +0 -0
  481. /package/dist/{chunk-DUEDOYZD.js.map → chunk-OPGL46PX.js.map} +0 -0
  482. /package/dist/{chunk-OUKBMQ2O.js.map → chunk-PD66CVSD.js.map} +0 -0
  483. /package/dist/{chunk-CQBIN77D.js.map → chunk-PDDSFELN.js.map} +0 -0
  484. /package/dist/{chunk-6433HV72.js.map → chunk-PMVPCZJZ.js.map} +0 -0
  485. /package/dist/{chunk-DJZWNKFO.js.map → chunk-RGCF4XNH.js.map} +0 -0
  486. /package/dist/{chunk-4JSF7UUP.js.map → chunk-S3K2CIK5.js.map} +0 -0
  487. /package/dist/{chunk-OCCHUEZB.js.map → chunk-SEA6M7SS.js.map} +0 -0
  488. /package/dist/{chunk-KOO37E4Y.js.map → chunk-SVVIASVX.js.map} +0 -0
  489. /package/dist/{chunk-FBR7PIL4.js.map → chunk-VKCAHCBI.js.map} +0 -0
  490. /package/dist/{chunk-WDXD6ITO.js.map → chunk-VXVZ2GM3.js.map} +0 -0
  491. /package/dist/{chunk-DUZARALI.js.map → chunk-WTOZBZNN.js.map} +0 -0
  492. /package/dist/{chunk-DQEMWVMT.js.map → chunk-X7Y7WX73.js.map} +0 -0
  493. /package/dist/{chunk-2EPOGPKO.js.map → chunk-YKWFK7XA.js.map} +0 -0
  494. /package/dist/{chunk-BIJAWZYW.js.map → chunk-YMOPYG3K.js.map} +0 -0
  495. /package/dist/{chunk-UFR6HX7A.js.map → chunk-YRVAKONL.js.map} +0 -0
  496. /package/dist/{chunk-ECLJ4LA2.js.map → chunk-YWSQD2IB.js.map} +0 -0
  497. /package/dist/{chunk-NLEH4RTB.js.map → chunk-Z4U3UN56.js.map} +0 -0
  498. /package/dist/{chunk-YDKF4MSJ.js.map → chunk-ZAOHJDKH.js.map} +0 -0
  499. /package/dist/{chunk-KFIOPZ25.js.map → chunk-ZIJDI4CP.js.map} +0 -0
  500. /package/dist/{graph-edge-decay-FXGELBFA.js.map → eval-trajectory-contracts.js.map} +0 -0
@@ -1,766 +1,68 @@
1
+ import {
2
+ LOCATION_SYNC_DEFAULT_INTERVAL_MS,
3
+ startLocationAutoSync
4
+ } from "../chunk-BWGCOLEL.js";
1
5
  import {
2
6
  defaultLocationConfig,
3
7
  parseLocationConfig
4
8
  } from "../chunk-7PHI6GUI.js";
5
9
  import {
6
- activityDayWindow,
7
- isValidActivityDate
8
- } from "../chunk-M6L7HI7R.js";
10
+ LOCATIONS_DIR_NAME,
11
+ LOCATION_DAY_FORMAT_VERSION,
12
+ LOCATION_DAY_KIND,
13
+ bucketObservationsByDay,
14
+ checkLocationSources,
15
+ clearLocationProviders,
16
+ composeLocationDayBody,
17
+ composeLocationDayMeta,
18
+ dominantPlace,
19
+ emptyLocationSyncState,
20
+ ensureConfiguredLocationProviders,
21
+ getLocationProvider,
22
+ hashLocationBody,
23
+ intervalOverlapMs,
24
+ isValidLocationDate,
25
+ listLocationDayDates,
26
+ listLocationProviders,
27
+ loadLocationSyncState,
28
+ localDayKey,
29
+ locationDayFilePath,
30
+ locationDayWindow,
31
+ locationStatus,
32
+ locationSyncStateFilePath,
33
+ observationSegments,
34
+ parseLocationBackfillRange,
35
+ parseLocationDaySummary,
36
+ placeDurations,
37
+ readLocationDay,
38
+ registerLocationProvider,
39
+ runLocationCheck,
40
+ runLocationCliCommand,
41
+ runLocationDay,
42
+ runLocationStatus,
43
+ runLocationSync,
44
+ sanitizeProviderError,
45
+ saveLocationSyncState,
46
+ serializeLocationDay,
47
+ syncLocation,
48
+ syncLocationDay,
49
+ updateLocationSourceDay,
50
+ writeLocationDay
51
+ } from "../chunk-3BCULS4U.js";
52
+ import "../chunk-M6L7HI7R.js";
9
53
  import "../chunk-PQVCH2AE.js";
10
- import {
11
- writeFileAtomically
12
- } from "../chunk-AW4QUFQF.js";
13
- import {
14
- pathIsInside
15
- } from "../chunk-GCASGYIO.js";
54
+ import "../chunk-AW4QUFQF.js";
55
+ import "../chunk-GCASGYIO.js";
56
+ import "../chunk-JUC24CTX.js";
57
+ import "../chunk-2Z24E5W2.js";
16
58
  import "../chunk-5UZXUTVO.js";
17
59
  import "../chunk-3WCASNQZ.js";
18
60
  import "../chunk-PZ5AY32C.js";
19
-
20
- // src/location/registry.ts
21
- var PROVIDER_ID_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
22
- var providers = /* @__PURE__ */ new Map();
23
- function assertValidProvider(provider) {
24
- if (typeof provider !== "object" || provider === null) {
25
- throw new TypeError("location provider must be an object");
26
- }
27
- if (typeof provider.id !== "string" || !PROVIDER_ID_PATTERN.test(provider.id)) {
28
- throw new RangeError(
29
- "location provider id must be a non-empty lowercase kebab string (a-z, 0-9, hyphens)"
30
- );
31
- }
32
- if (typeof provider.displayName !== "string" || provider.displayName.trim().length === 0) {
33
- throw new TypeError(`location provider '${provider.id}' must declare a non-empty displayName`);
34
- }
35
- if (typeof provider.verify !== "function" || typeof provider.fetchObservations !== "function") {
36
- throw new TypeError(
37
- `location provider '${provider.id}' must implement verify() and fetchObservations()`
38
- );
39
- }
40
- }
41
- function registerLocationProvider(provider) {
42
- assertValidProvider(provider);
43
- if (providers.has(provider.id)) {
44
- throw new Error(`location provider '${provider.id}' is already registered`);
45
- }
46
- providers.set(provider.id, provider);
47
- }
48
- function getLocationProvider(id) {
49
- return typeof id === "string" ? providers.get(id) : void 0;
50
- }
51
- function listLocationProviders() {
52
- return [...providers.keys()].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
53
- }
54
- function clearLocationProviders() {
55
- providers.clear();
56
- }
57
-
58
- // src/location/intervals.ts
59
- function isValidLocationDate(date) {
60
- return isValidActivityDate(date);
61
- }
62
- function locationDayWindow(date, timezone) {
63
- if (!isValidActivityDate(date)) {
64
- throw new RangeError(`Invalid location date "${date}"; expected a real YYYY-MM-DD day.`);
65
- }
66
- return activityDayWindow(date, timezone);
67
- }
68
- function assertFiniteInstant(iso, what) {
69
- const ms = Date.parse(iso);
70
- if (typeof iso !== "string" || !Number.isFinite(ms)) {
71
- throw new RangeError(`${what} must be a UTC ISO-8601 instant; got "${String(iso)}"`);
72
- }
73
- return ms;
74
- }
75
- function localDayKey(instantUtc, timezone) {
76
- assertFiniteInstant(instantUtc, "instantUtc");
77
- return new Intl.DateTimeFormat("en-CA", {
78
- timeZone: timezone,
79
- year: "numeric",
80
- month: "2-digit",
81
- day: "2-digit"
82
- }).format(new Date(instantUtc));
83
- }
84
- function compareObservations(a, b) {
85
- if (a.observedAtUtc !== b.observedAtUtc) {
86
- return a.observedAtUtc < b.observedAtUtc ? -1 : 1;
87
- }
88
- if (a.place.id !== b.place.id) {
89
- return a.place.id < b.place.id ? -1 : 1;
90
- }
91
- return 0;
92
- }
93
- function bucketObservationsByDay(observations, timezone) {
94
- const buckets = /* @__PURE__ */ new Map();
95
- for (const observation of observations) {
96
- assertFiniteInstant(observation.observedAtUtc, "observation observedAtUtc");
97
- const key = localDayKey(observation.observedAtUtc, timezone);
98
- const bucket = buckets.get(key);
99
- if (bucket === void 0) buckets.set(key, [observation]);
100
- else bucket.push(observation);
101
- }
102
- for (const bucket of buckets.values()) bucket.sort(compareObservations);
103
- return buckets;
104
- }
105
- function intervalOverlapMs(a, b) {
106
- const overlap = Math.min(Date.parse(a.endUtc), Date.parse(b.endUtc)) - Math.max(Date.parse(a.startUtc), Date.parse(b.startUtc));
107
- return Math.max(0, overlap);
108
- }
109
- function placeForSegment(place, retainCoordinates) {
110
- if (retainCoordinates || place.latitude === void 0 || place.longitude === void 0) {
111
- return place;
112
- }
113
- return {
114
- id: place.id,
115
- label: place.label,
116
- ...place.kind === void 0 ? {} : { kind: place.kind }
117
- };
118
- }
119
- function observationSegments(observations, window, options) {
120
- const startMs = assertFiniteInstant(window.startUtc, "window startUtc");
121
- const endMs = assertFiniteInstant(window.endUtc, "window endUtc");
122
- if (startMs >= endMs) {
123
- throw new RangeError("location window must satisfy startUtc < endUtc");
124
- }
125
- const ordered = [...observations].sort(compareObservations);
126
- const segments = [];
127
- for (let index = 0; index < ordered.length; index += 1) {
128
- const current = ordered[index];
129
- const currentMs = Date.parse(current.observedAtUtc);
130
- if (currentMs < startMs || currentMs >= endMs) {
131
- throw new RangeError(
132
- `location observation at "${current.observedAtUtc}" falls outside the requested [${window.startUtc}, ${window.endUtc}) window`
133
- );
134
- }
135
- const nextMs = index + 1 < ordered.length ? Date.parse(ordered[index + 1].observedAtUtc) : endMs;
136
- const segmentEndMs = Math.min(nextMs, endMs);
137
- if (currentMs >= segmentEndMs) continue;
138
- segments.push({
139
- startUtc: new Date(currentMs).toISOString(),
140
- endUtc: new Date(segmentEndMs).toISOString(),
141
- place: placeForSegment(current.place, options.retainCoordinates)
142
- });
143
- }
144
- return segments;
145
- }
146
- function unionIntervalMs(segments) {
147
- const bounds = segments.map((segment) => ({ start: Date.parse(segment.startUtc), end: Date.parse(segment.endUtc) })).sort((a, b) => a.start !== b.start ? a.start - b.start : a.end - b.end);
148
- let total = 0;
149
- let sweepStart = null;
150
- let sweepEnd = 0;
151
- for (const bound of bounds) {
152
- if (sweepStart === null || bound.start > sweepEnd) {
153
- if (sweepStart !== null) total += sweepEnd - sweepStart;
154
- sweepStart = bound.start;
155
- sweepEnd = bound.end;
156
- } else if (bound.end > sweepEnd) {
157
- sweepEnd = bound.end;
158
- }
159
- }
160
- if (sweepStart !== null) total += sweepEnd - sweepStart;
161
- return total;
162
- }
163
- function placeDurations(segments) {
164
- const byPlace = /* @__PURE__ */ new Map();
165
- for (const segment of segments) {
166
- const existing = byPlace.get(segment.place.id);
167
- if (existing === void 0) {
168
- byPlace.set(segment.place.id, { place: segment.place, segments: [segment], firstStartUtc: segment.startUtc });
169
- continue;
170
- }
171
- existing.segments.push(segment);
172
- if (segment.startUtc < existing.firstStartUtc) existing.firstStartUtc = segment.startUtc;
173
- if (segment.place.label < existing.place.label) existing.place = segment.place;
174
- }
175
- const durations = [...byPlace.values()].map((entry) => ({
176
- place: entry.place,
177
- totalMs: unionIntervalMs(entry.segments),
178
- firstStartUtc: entry.firstStartUtc
179
- }));
180
- durations.sort((a, b) => {
181
- if (a.place.id !== b.place.id) return a.place.id < b.place.id ? -1 : 1;
182
- return 0;
183
- });
184
- return durations;
185
- }
186
- function dominantPlace(segments) {
187
- const durations = placeDurations(segments);
188
- let best = null;
189
- for (const duration of durations) {
190
- if (best === null) {
191
- best = duration;
192
- continue;
193
- }
194
- if (duration.totalMs !== best.totalMs) {
195
- if (duration.totalMs > best.totalMs) best = duration;
196
- continue;
197
- }
198
- if (duration.firstStartUtc !== best.firstStartUtc) {
199
- if (duration.firstStartUtc < best.firstStartUtc) best = duration;
200
- continue;
201
- }
202
- if (duration.place.id < best.place.id) best = duration;
203
- }
204
- return best === null ? null : { place: best.place, totalMs: best.totalMs };
205
- }
206
-
207
- // src/location/store.ts
208
- import { createHash } from "crypto";
209
- import { lstat, mkdir, readFile, readdir, realpath } from "fs/promises";
210
- import path from "path";
211
- var LOCATIONS_DIR_NAME = "locations";
212
- var LOCATION_DAY_KIND = "location-day";
213
- var LOCATION_DAY_FORMAT_VERSION = 1;
214
- var MAX_TRACKED_LOCATION_DAYS = 90;
215
- var DAY_FILE_NAME_PATTERN = /^\d{4}-\d{2}-\d{2}\.md$/;
216
- var stateLocks = /* @__PURE__ */ new Map();
217
- function withStateLock(key, fn) {
218
- const prior = stateLocks.get(key) ?? Promise.resolve();
219
- const next = prior.then(fn, fn);
220
- const tail = next.then(
221
- () => void 0,
222
- () => void 0
223
- );
224
- stateLocks.set(key, tail);
225
- void tail.then(() => {
226
- if (stateLocks.get(key) === tail) stateLocks.delete(key);
227
- });
228
- return next;
229
- }
230
- function locationDayFilePath(memoryDir, date) {
231
- if (!isValidLocationDate(date)) {
232
- throw new RangeError(`Invalid location date "${date}"; expected a real YYYY-MM-DD day.`);
233
- }
234
- return path.join(memoryDir, LOCATIONS_DIR_NAME, `${date}.md`);
235
- }
236
- function locationSyncStateFilePath(memoryDir) {
237
- return path.join(memoryDir, "state", "locations", "sync.json");
238
- }
239
- function emptyLocationSyncState() {
240
- return { version: 1, sources: {} };
241
- }
242
- async function loadLocationSyncState(memoryDir) {
243
- let raw;
244
- try {
245
- raw = await readFile(locationSyncStateFilePath(memoryDir), "utf-8");
246
- } catch (err) {
247
- if (err.code === "ENOENT") return emptyLocationSyncState();
248
- throw err;
249
- }
250
- let parsed;
251
- try {
252
- parsed = JSON.parse(raw);
253
- } catch {
254
- return emptyLocationSyncState();
255
- }
256
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed) || typeof parsed.sources !== "object" || parsed.sources === null) {
257
- return emptyLocationSyncState();
258
- }
259
- return { version: 1, sources: parsed.sources };
260
- }
261
- async function saveLocationSyncState(memoryDir, state) {
262
- await mkdir(path.dirname(locationSyncStateFilePath(memoryDir)), { recursive: true, mode: 448 });
263
- await writeFileAtomically(
264
- locationSyncStateFilePath(memoryDir),
265
- `${JSON.stringify(state, null, 2)}
266
- `
267
- );
268
- }
269
- function pruneSourceDays(source) {
270
- const days = source.days;
271
- if (days === void 0) return;
272
- const keys = Object.keys(days).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
273
- for (const key of keys.slice(0, Math.max(0, keys.length - MAX_TRACKED_LOCATION_DAYS))) {
274
- delete days[key];
275
- }
276
- }
277
- async function updateLocationSourceDay(memoryDir, sourceId, date, payload, completedAtUtc) {
278
- if (!isValidLocationDate(date)) {
279
- throw new RangeError(`Invalid location date "${date}"; expected a real YYYY-MM-DD day.`);
280
- }
281
- return withStateLock(locationSyncStateFilePath(memoryDir), async () => {
282
- const state = await loadLocationSyncState(memoryDir);
283
- const source = state.sources[sourceId] ?? {};
284
- const days = source.days ?? {};
285
- days[date] = payload;
286
- source.days = days;
287
- source.lastSyncedAtUtc = completedAtUtc;
288
- state.sources[sourceId] = source;
289
- for (const candidate of Object.values(state.sources)) pruneSourceDays(candidate);
290
- await saveLocationSyncState(memoryDir, state);
291
- return state;
292
- });
293
- }
294
- function hashLocationBody(body) {
295
- return createHash("sha256").update(body, "utf8").digest("hex");
296
- }
297
- function clockHhMm(iso, timezone) {
298
- return new Intl.DateTimeFormat("en-GB", {
299
- timeZone: timezone,
300
- hour: "2-digit",
301
- minute: "2-digit",
302
- hour12: false
303
- }).format(new Date(iso));
304
- }
305
- function formatDuration(ms) {
306
- const totalMinutes = Math.round(ms / 6e4);
307
- const hours = Math.floor(totalMinutes / 60);
308
- const minutes = totalMinutes % 60;
309
- if (hours <= 0) return `${minutes}m`;
310
- return `${hours}h ${String(minutes).padStart(2, "0")}m`;
311
- }
312
- function safeLabel(label) {
313
- return label.replace(/\s+/g, " ").replace(/[`*_]/g, "").trim();
314
- }
315
- function formatPlaceLabel(segment) {
316
- const label = safeLabel(segment.place.label);
317
- return segment.place.kind === void 0 ? label : `${label} (${segment.place.kind})`;
318
- }
319
- function formatCoordinates(segment) {
320
- if (segment.place.latitude === void 0 || segment.place.longitude === void 0) return "";
321
- return ` @ ${segment.place.latitude.toFixed(4)},${segment.place.longitude.toFixed(4)}`;
322
- }
323
- function composeLocationDayBody(date, timezone, sources) {
324
- const lines = [`# Location day \u2014 ${date} (${timezone})`, ""];
325
- const allSegments = [];
326
- let observationCount = 0;
327
- for (const entry of Object.values(sources)) {
328
- allSegments.push(...entry.segments);
329
- observationCount += entry.observationCount;
330
- }
331
- lines.push("## Summary", "");
332
- if (observationCount === 0) {
333
- lines.push("No location observations recorded.", "");
334
- } else {
335
- const durations = placeDurations(allSegments).sort((a, b) => b.totalMs - a.totalMs);
336
- lines.push(
337
- `- Places visited: ${durations.length}`,
338
- ...durations.map(
339
- (duration) => `- ${safeLabel(duration.place.label)}: ${formatDuration(duration.totalMs)}`
340
- ),
341
- ""
342
- );
343
- }
344
- const sourceIds = Object.keys(sources).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
345
- for (const sourceId of sourceIds) {
346
- const entry = sources[sourceId];
347
- lines.push(`## Timeline \u2014 ${safeLabel(entry.providerDisplayName ?? sourceId)}`, "");
348
- if (entry.segments.length === 0) {
349
- lines.push("No observations.", "");
350
- continue;
351
- }
352
- for (const segment of entry.segments) {
353
- lines.push(
354
- `- ${clockHhMm(segment.startUtc, timezone)}\u2013${clockHhMm(segment.endUtc, timezone)} \u2014 ${formatPlaceLabel(segment)}${formatCoordinates(segment)}`
355
- );
356
- }
357
- lines.push("");
358
- }
359
- return `${lines.join("\n").trimEnd()}
360
- `;
361
- }
362
- function composeLocationDayMeta(date, timezone, sources, body) {
363
- let observationCount = 0;
364
- for (const entry of Object.values(sources)) observationCount += entry.observationCount;
365
- return {
366
- kind: LOCATION_DAY_KIND,
367
- date,
368
- timezone,
369
- formatVersion: LOCATION_DAY_FORMAT_VERSION,
370
- sources: Object.keys(sources).sort((a, b) => a < b ? -1 : a > b ? 1 : 0),
371
- observationCount,
372
- contentHash: hashLocationBody(body)
373
- };
374
- }
375
- function frontmatterScalar(key, value) {
376
- return `${key}: ${typeof value === "number" ? value : JSON.stringify(value)}`;
377
- }
378
- function frontmatterList(key, values) {
379
- if (values.length === 0) return [`${key}: []`];
380
- const lines = [`${key}:`];
381
- for (const value of values) lines.push(` - ${JSON.stringify(value)}`);
382
- return lines;
383
- }
384
- function serializeLocationDay(meta, body) {
385
- const lines = ["---"];
386
- lines.push(frontmatterScalar("kind", meta.kind));
387
- lines.push(frontmatterScalar("date", meta.date));
388
- lines.push(frontmatterScalar("timezone", meta.timezone));
389
- lines.push(frontmatterScalar("formatVersion", meta.formatVersion));
390
- lines.push(...frontmatterList("sources", meta.sources));
391
- lines.push(frontmatterScalar("observationCount", meta.observationCount));
392
- lines.push(frontmatterScalar("contentHash", meta.contentHash));
393
- lines.push("---", "", body);
394
- return lines.join("\n");
395
- }
396
- function parseScalar(raw) {
397
- try {
398
- const parsed = JSON.parse(raw);
399
- return typeof parsed === "string" ? parsed : raw;
400
- } catch {
401
- return raw;
402
- }
403
- }
404
- function parseLocationDaySummary(raw) {
405
- if (!raw.startsWith("---\n")) return null;
406
- const closeIndex = raw.indexOf("\n---\n", 4);
407
- if (closeIndex === -1) return null;
408
- const scalars = {};
409
- const lists = {};
410
- let currentList = null;
411
- for (const line of raw.slice(4, closeIndex).split("\n")) {
412
- const listItem = /^ {2}- (.*)$/.exec(line);
413
- if (listItem !== null && currentList !== null) {
414
- lists[currentList].push(parseScalar(listItem[1]));
415
- continue;
416
- }
417
- currentList = null;
418
- const separator = line.indexOf(":");
419
- if (separator === -1) continue;
420
- const key = line.slice(0, separator);
421
- const value = line.slice(separator + 1).trim();
422
- if (value === "" || value === "[]") {
423
- lists[key] = [];
424
- currentList = key;
425
- continue;
426
- }
427
- if (value.startsWith("[")) {
428
- lists[key] = [parseScalar(value)];
429
- currentList = key;
430
- continue;
431
- }
432
- scalars[key] = value;
433
- }
434
- if (scalars.kind === void 0 || parseScalar(scalars.kind) !== LOCATION_DAY_KIND) return null;
435
- if (scalars.date === void 0 || scalars.contentHash === void 0) return null;
436
- return {
437
- date: parseScalar(scalars.date),
438
- timezone: scalars.timezone === void 0 ? "UTC" : parseScalar(scalars.timezone),
439
- sources: lists.sources ?? [],
440
- observationCount: scalars.observationCount === void 0 ? 0 : Number(scalars.observationCount) || 0,
441
- contentHash: parseScalar(scalars.contentHash)
442
- };
443
- }
444
- function isErrnoCode(err, code) {
445
- return err instanceof Error && err.code === code;
446
- }
447
- async function assertNotSymlink(target, kind) {
448
- let stat;
449
- try {
450
- stat = await lstat(target);
451
- } catch (err) {
452
- if (isErrnoCode(err, "ENOENT")) return;
453
- throw err;
454
- }
455
- if (stat.isSymbolicLink()) {
456
- throw new Error(
457
- `locations ${kind} '${path.basename(target)}' is a symbolic link \u2014 refusing to follow it even when it resolves inside the memory dir (AGENTS.md pattern #3)`
458
- );
459
- }
460
- }
461
- async function assertNoEscape(rootReal, candidate) {
462
- let candidateReal;
463
- try {
464
- candidateReal = await realpath(candidate);
465
- } catch {
466
- return;
467
- }
468
- if (!pathIsInside(rootReal, candidateReal)) {
469
- throw new Error(
470
- "location day path resolves outside the memory dir \u2014 refusing to follow a symlink/traversal (AGENTS.md pattern #3)"
471
- );
472
- }
473
- }
474
- async function assertDayPathContained(memoryDir, targetPath) {
475
- let rootReal;
476
- try {
477
- rootReal = await realpath(memoryDir);
478
- } catch {
479
- rootReal = path.resolve(memoryDir);
480
- }
481
- const locationsDir = path.join(memoryDir, LOCATIONS_DIR_NAME);
482
- await assertNoEscape(rootReal, locationsDir);
483
- await assertNoEscape(rootReal, targetPath);
484
- await assertNotSymlink(locationsDir, "directory");
485
- await assertNotSymlink(targetPath, "day file");
486
- }
487
- async function writeLocationDay(memoryDir, date, serialized) {
488
- const target = locationDayFilePath(memoryDir, date);
489
- await assertDayPathContained(memoryDir, target);
490
- try {
491
- if (await readFile(target, "utf-8") === serialized) return false;
492
- } catch (err) {
493
- if (!isErrnoCode(err, "ENOENT")) throw err;
494
- }
495
- await mkdir(path.dirname(target), { recursive: true, mode: 448 });
496
- await writeFileAtomically(target, serialized);
497
- return true;
498
- }
499
- async function readLocationDay(memoryDir, date) {
500
- const target = locationDayFilePath(memoryDir, date);
501
- await assertDayPathContained(memoryDir, target);
502
- try {
503
- return await readFile(target, "utf-8");
504
- } catch (err) {
505
- if (isErrnoCode(err, "ENOENT")) return null;
506
- throw err;
507
- }
508
- }
509
- async function listLocationDayDates(memoryDir) {
510
- const locationsDir = path.join(memoryDir, LOCATIONS_DIR_NAME);
511
- await assertDayPathContained(memoryDir, locationsDir);
512
- let entries;
513
- try {
514
- entries = await readdir(locationsDir);
515
- } catch (err) {
516
- if (isErrnoCode(err, "ENOENT")) return [];
517
- throw err;
518
- }
519
- const dates = entries.filter((entry) => DAY_FILE_NAME_PATTERN.test(entry)).map((entry) => entry.slice(0, -3));
520
- dates.sort((a, b) => a > b ? -1 : a < b ? 1 : 0);
521
- return dates;
522
- }
523
-
524
- // src/location/pipeline.ts
525
- var MAX_SYNC_PAGES = 1e4;
526
- function sanitizeProviderError(error) {
527
- const raw = error instanceof Error ? error.message : String(error);
528
- return raw.replace(/Bearer\s+[A-Za-z0-9._~+/=-]+/gi, "Bearer [redacted]").replace(/[?#][^ \t"']*/g, "[redacted]").replace(/[+-]?\d+\.\d{3,},\s?[+-]?\d+\.\d{3,}/g, "[coordinates]").slice(0, 300);
529
- }
530
- function assertValidObservation(observation) {
531
- if (typeof observation !== "object" || observation === null) {
532
- throw new TypeError("location provider returned a non-object observation");
533
- }
534
- if (typeof observation.observedAtUtc !== "string" || !Number.isFinite(Date.parse(observation.observedAtUtc))) {
535
- throw new TypeError("location provider returned an observation with an invalid observedAtUtc");
536
- }
537
- const place = observation.place;
538
- if (typeof place !== "object" || place === null || typeof place.id !== "string" || place.id.length === 0) {
539
- throw new TypeError("location provider returned an observation without a valid place");
540
- }
541
- if (typeof place.label !== "string" || place.label.trim().length === 0) {
542
- throw new TypeError(`location provider returned place '${place.id}' without a label`);
543
- }
544
- }
545
- async function fetchWindow(provider, window, options) {
546
- const maxPages = options.maxPages ?? MAX_SYNC_PAGES;
547
- if (!Number.isInteger(maxPages) || maxPages < 1) {
548
- throw new RangeError("location sync maxPages must be a positive integer");
549
- }
550
- const observations = [];
551
- const seenCursors = /* @__PURE__ */ new Set();
552
- let cursor = null;
553
- let pages = 0;
554
- let completed = false;
555
- while (pages < maxPages) {
556
- options.signal?.throwIfAborted();
557
- const page = await provider.fetchObservations({
558
- startUtc: window.startUtc,
559
- endUtc: window.endUtc,
560
- cursor,
561
- signal: options.signal
562
- });
563
- pages += 1;
564
- for (const observation of page.observations) assertValidObservation(observation);
565
- observations.push(...page.observations);
566
- if (page.nextCursor === null) {
567
- completed = true;
568
- break;
569
- }
570
- if (typeof page.nextCursor !== "string" || page.nextCursor.length === 0) {
571
- throw new TypeError("location provider returned an invalid cursor");
572
- }
573
- if (seenCursors.has(page.nextCursor)) {
574
- throw new Error("location provider returned a repeated cursor");
575
- }
576
- seenCursors.add(page.nextCursor);
577
- cursor = page.nextCursor;
578
- }
579
- if (!completed) {
580
- throw new Error(`location provider exceeded ${maxPages} pages`);
581
- }
582
- return observations;
583
- }
584
- async function syncLocationDay(options) {
585
- if (!options.config.enabled) return [];
586
- const window = locationDayWindow(options.date, options.config.timezone);
587
- const now = options.now ?? (() => /* @__PURE__ */ new Date());
588
- const resolveProvider = options.getProvider ?? getLocationProvider;
589
- const results = [];
590
- for (const source of options.config.sources) {
591
- if (!source.enabled) {
592
- results.push({
593
- sourceId: source.id,
594
- status: "skipped",
595
- skipReason: "source-disabled",
596
- fetched: 0,
597
- dayWritten: false,
598
- stateSaved: false
599
- });
600
- continue;
601
- }
602
- const provider = resolveProvider(source.id);
603
- if (provider === void 0) {
604
- results.push({
605
- sourceId: source.id,
606
- status: "skipped",
607
- skipReason: "provider-not-registered",
608
- fetched: 0,
609
- dayWritten: false,
610
- stateSaved: false
611
- });
612
- continue;
613
- }
614
- let observations;
615
- try {
616
- observations = await fetchWindow(provider, window, options);
617
- } catch (error) {
618
- results.push({
619
- sourceId: source.id,
620
- status: "failed",
621
- fetched: 0,
622
- dayWritten: false,
623
- stateSaved: false,
624
- ...error instanceof Error && error.name === "AbortError" ? { error: "aborted" } : { error: sanitizeProviderError(error) }
625
- });
626
- continue;
627
- }
628
- try {
629
- options.signal?.throwIfAborted();
630
- const segments = observationSegments(observations, window, {
631
- retainCoordinates: options.config.retainCoordinates
632
- });
633
- const payload = { observationCount: observations.length, segments, providerDisplayName: provider.displayName };
634
- const merged = await mergeDaySources(options.memoryDir, source.id, options.date, payload);
635
- let dayWritten = false;
636
- if (Object.values(merged).some((entry) => entry.observationCount > 0)) {
637
- const body = composeLocationDayBody(options.date, options.config.timezone, merged);
638
- const meta = composeLocationDayMeta(options.date, options.config.timezone, merged, body);
639
- dayWritten = await writeLocationDay(options.memoryDir, options.date, serializeLocationDay(meta, body));
640
- }
641
- await updateLocationSourceDay(
642
- options.memoryDir,
643
- source.id,
644
- options.date,
645
- payload,
646
- now().toISOString()
647
- );
648
- results.push({
649
- sourceId: source.id,
650
- status: "synced",
651
- fetched: observations.length,
652
- dayWritten,
653
- stateSaved: true
654
- });
655
- } catch (error) {
656
- results.push({
657
- sourceId: source.id,
658
- status: "failed",
659
- fetched: observations.length,
660
- dayWritten: false,
661
- stateSaved: false,
662
- ...error instanceof Error && error.name === "AbortError" ? { error: "aborted" } : { error: sanitizeProviderError(error) }
663
- });
664
- }
665
- }
666
- return results;
667
- }
668
- async function mergeDaySources(memoryDir, sourceId, date, payload) {
669
- const state = await loadLocationSyncState(memoryDir);
670
- const merged = {};
671
- for (const [otherId, otherState] of Object.entries(state.sources)) {
672
- if (otherId === sourceId) continue;
673
- const day = otherState.days?.[date];
674
- if (day === void 0) continue;
675
- merged[otherId] = { ...day, segments: [...day.segments] };
676
- }
677
- merged[sourceId] = payload;
678
- return merged;
679
- }
680
-
681
- // src/location/cli.ts
682
- async function locationStatus(config, memoryDir, options = {}) {
683
- const resolveProvider = options.getProvider ?? getLocationProvider;
684
- const state = await loadLocationSyncState(memoryDir);
685
- const sources = config.sources.map((source) => {
686
- const sourceState = state.sources[source.id];
687
- return {
688
- id: source.id,
689
- enabled: source.enabled,
690
- providerRegistered: resolveProvider(source.id) !== void 0,
691
- ...sourceState?.lastSyncedAtUtc === void 0 ? {} : { lastSyncedAtUtc: sourceState.lastSyncedAtUtc },
692
- trackedDays: Object.keys(sourceState?.days ?? {}).length
693
- };
694
- });
695
- const maxDays = options.maxDays ?? 7;
696
- const recentDays = [];
697
- for (const date of (await listLocationDayDates(memoryDir)).slice(0, Math.max(0, maxDays))) {
698
- const raw = await readLocationDay(memoryDir, date);
699
- const summary = raw === null ? null : parseLocationDaySummary(raw);
700
- recentDays.push({
701
- date,
702
- sources: summary?.sources ?? [],
703
- observationCount: summary?.observationCount ?? 0
704
- });
705
- }
706
- return { enabled: config.enabled, timezone: config.timezone, sources, recentDays };
707
- }
708
- async function checkLocationSources(config, options = {}) {
709
- if (!config.enabled) {
710
- return config.sources.map((source) => ({ id: source.id, ok: false, skipped: "location-disabled" }));
711
- }
712
- const resolveProvider = options.getProvider ?? getLocationProvider;
713
- const results = [];
714
- for (const source of config.sources) {
715
- if (!source.enabled) {
716
- results.push({ id: source.id, ok: false, skipped: "source-disabled" });
717
- continue;
718
- }
719
- const provider = resolveProvider(source.id);
720
- if (provider === void 0) {
721
- results.push({ id: source.id, ok: false, skipped: "provider-not-registered" });
722
- continue;
723
- }
724
- try {
725
- const check = await provider.verify(options.signal);
726
- results.push({
727
- id: source.id,
728
- ok: check.ok,
729
- ...check.detail === void 0 || check.detail.length === 0 ? {} : { detail: check.detail }
730
- });
731
- } catch (error) {
732
- results.push({ id: source.id, ok: false, detail: error instanceof Error ? error.name : "provider error" });
733
- }
734
- }
735
- return results;
736
- }
737
- function shiftIsoDate(date, days) {
738
- const parsed = /* @__PURE__ */ new Date(`${date}T00:00:00Z`);
739
- parsed.setUTCDate(parsed.getUTCDate() + days);
740
- return parsed.toISOString().slice(0, 10);
741
- }
742
- async function syncLocation(options) {
743
- const { config, memoryDir, endDate, days, ...rest } = options;
744
- if (endDate !== void 0 && !isValidLocationDate(endDate)) {
745
- throw new RangeError(`Invalid location endDate "${endDate}"; expected a real YYYY-MM-DD day.`);
746
- }
747
- const now = rest.now ?? (() => /* @__PURE__ */ new Date());
748
- const end = endDate ?? shiftIsoDate(localDayKey(now().toISOString(), config.timezone), -1);
749
- const count = days ?? config.syncDays;
750
- if (!Number.isInteger(count) || count < 1 || count > 90) {
751
- throw new RangeError("location sync days must be an integer from 1 to 90");
752
- }
753
- const runs = [];
754
- for (let offset = count; offset >= 1; offset -= 1) {
755
- const date = shiftIsoDate(end, -(offset - 1));
756
- runs.push({ date, results: await syncLocationDay({ ...rest, config, memoryDir, date, now }) });
757
- }
758
- return runs;
759
- }
760
61
  export {
761
62
  LOCATIONS_DIR_NAME,
762
63
  LOCATION_DAY_FORMAT_VERSION,
763
64
  LOCATION_DAY_KIND,
65
+ LOCATION_SYNC_DEFAULT_INTERVAL_MS,
764
66
  bucketObservationsByDay,
765
67
  checkLocationSources,
766
68
  clearLocationProviders,
@@ -769,6 +71,7 @@ export {
769
71
  defaultLocationConfig,
770
72
  dominantPlace,
771
73
  emptyLocationSyncState,
74
+ ensureConfiguredLocationProviders,
772
75
  getLocationProvider,
773
76
  hashLocationBody,
774
77
  intervalOverlapMs,
@@ -782,14 +85,21 @@ export {
782
85
  locationStatus,
783
86
  locationSyncStateFilePath,
784
87
  observationSegments,
88
+ parseLocationBackfillRange,
785
89
  parseLocationConfig,
786
90
  parseLocationDaySummary,
787
91
  placeDurations,
788
92
  readLocationDay,
789
93
  registerLocationProvider,
94
+ runLocationCheck,
95
+ runLocationCliCommand,
96
+ runLocationDay,
97
+ runLocationStatus,
98
+ runLocationSync,
790
99
  sanitizeProviderError,
791
100
  saveLocationSyncState,
792
101
  serializeLocationDay,
102
+ startLocationAutoSync,
793
103
  syncLocation,
794
104
  syncLocationDay,
795
105
  updateLocationSourceDay,