@remnic/core 9.29.0 → 9.30.0

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 (359) hide show
  1. package/dist/access-admin-ops-surface.d.ts +11 -11
  2. package/dist/access-admin-ops-surface.js +19 -18
  3. package/dist/access-authorization-probe.d.ts +11 -11
  4. package/dist/access-authorization-probe.js +20 -19
  5. package/dist/access-boundary.d.ts +11 -11
  6. package/dist/access-boundary.js +19 -18
  7. package/dist/access-citation-namespace.js +2 -2
  8. package/dist/access-cli.js +45 -44
  9. package/dist/access-cli.js.map +1 -1
  10. package/dist/access-health-types.d.ts +1 -1
  11. package/dist/access-http-lcm-compaction.d.ts +11 -11
  12. package/dist/access-http.d.ts +11 -11
  13. package/dist/access-http.js +25 -24
  14. package/dist/access-identity-continuity-surface.d.ts +8 -8
  15. package/dist/access-identity-continuity-surface.js +19 -18
  16. package/dist/access-lcm-surface.d.ts +10 -10
  17. package/dist/access-lcm-surface.js +19 -18
  18. package/dist/access-mcp.d.ts +11 -11
  19. package/dist/access-mcp.js +23 -22
  20. package/dist/access-memory-search-fanout.d.ts +2 -2
  21. package/dist/{access-namespace-preflight-DCXBkDp0.d.ts → access-namespace-preflight-VfXssvoI.d.ts} +1 -1
  22. package/dist/access-namespace-preflight.d.ts +3 -3
  23. package/dist/access-namespace-preflight.js +19 -18
  24. package/dist/access-observe-write-surface.d.ts +10 -10
  25. package/dist/access-observe-write-surface.js +19 -18
  26. package/dist/access-operations-batch.js +20 -19
  27. package/dist/access-operations.d.ts +11 -11
  28. package/dist/access-operations.js +22 -21
  29. package/dist/access-recall-concurrency.d.ts +11 -11
  30. package/dist/access-recall-concurrency.js +19 -18
  31. package/dist/access-recall-response.d.ts +10 -10
  32. package/dist/access-recall-response.js +19 -18
  33. package/dist/access-recall-surface.d.ts +10 -10
  34. package/dist/access-recall-surface.js +19 -18
  35. package/dist/access-schema.d.ts +7 -7
  36. package/dist/access-schema.js +3 -3
  37. package/dist/{access-service-DvPW_M5j.d.ts → access-service-B5RwVsTV.d.ts} +7 -7
  38. package/dist/access-service.d.ts +11 -11
  39. package/dist/access-service.js +19 -18
  40. package/dist/access-surface-catalog.d.ts +11 -11
  41. package/dist/access-wearables-meetings-surface.d.ts +4 -3
  42. package/dist/action-confidence.d.ts +1 -1
  43. package/dist/active-memory-bridge.d.ts +1 -1
  44. package/dist/active-recall.d.ts +1 -1
  45. package/dist/active-recall.js +3 -3
  46. package/dist/behavior-learner.d.ts +1 -1
  47. package/dist/behavior-signals.d.ts +1 -1
  48. package/dist/bootstrap.d.ts +8 -8
  49. package/dist/briefing.d.ts +3 -2
  50. package/dist/briefing.js +10 -9
  51. package/dist/buffer-surprise-report.d.ts +1 -1
  52. package/dist/buffer.d.ts +3 -2
  53. package/dist/bulk-import/index.d.ts +3 -3
  54. package/dist/calibration.d.ts +1 -1
  55. package/dist/capabilities.d.ts +1 -1
  56. package/dist/{catalog-BIVgftWu.d.ts → catalog-V7inUQdp.d.ts} +1 -1
  57. package/dist/causal-behavior.d.ts +1 -1
  58. package/dist/causal-consolidation.d.ts +1 -1
  59. package/dist/causal-consolidation.js +11 -10
  60. package/dist/causal-consolidation.js.map +1 -1
  61. package/dist/causal-trajectory-graph.d.ts +1 -1
  62. package/dist/{chunk-KUJQHXPH.js → chunk-2EUVEDF5.js} +2 -2
  63. package/dist/{chunk-2XC73SHY.js → chunk-4WKA6I65.js} +20 -20
  64. package/dist/{chunk-2XC73SHY.js.map → chunk-4WKA6I65.js.map} +1 -1
  65. package/dist/{chunk-AIK5W3IW.js → chunk-5TFP4CUL.js} +68 -2
  66. package/dist/chunk-5TFP4CUL.js.map +1 -0
  67. package/dist/{chunk-EVX44I7C.js → chunk-5W4ZLBEZ.js} +9 -9
  68. package/dist/{chunk-P3MH72CI.js → chunk-62U4J2GN.js} +2 -2
  69. package/dist/{chunk-YGHMSDLK.js → chunk-66772WBP.js} +2 -2
  70. package/dist/{chunk-EP5BVCRI.js → chunk-6BNE62PM.js} +2 -2
  71. package/dist/{chunk-AAP5T6QG.js → chunk-6DNMUYEE.js} +2 -2
  72. package/dist/{chunk-SG265CVF.js → chunk-6FUPCJUL.js} +7 -7
  73. package/dist/{chunk-WZ7UB7XQ.js → chunk-6U7F52DE.js} +19 -19
  74. package/dist/{chunk-E4OCKU67.js → chunk-7XC2HX75.js} +2 -2
  75. package/dist/{chunk-OVRQLAYR.js → chunk-AZ5BTEKX.js} +2 -2
  76. package/dist/{chunk-2HNUMF5V.js → chunk-CZRYLSSW.js} +3 -3
  77. package/dist/chunk-FBUE6PD3.js +1769 -0
  78. package/dist/chunk-FBUE6PD3.js.map +1 -0
  79. package/dist/{chunk-WONS4RZ2.js → chunk-FDAMS4PK.js} +2 -2
  80. package/dist/{chunk-WL5EBRDH.js → chunk-FFAZ2XFU.js} +9 -8
  81. package/dist/chunk-FFAZ2XFU.js.map +1 -0
  82. package/dist/{chunk-Q6VFVAKZ.js → chunk-GIBMDSJ2.js} +2 -2
  83. package/dist/{chunk-ZXAGJFHJ.js → chunk-H5CPS5JP.js} +3 -3
  84. package/dist/{chunk-NBDCZWP4.js → chunk-I5NLEENJ.js} +2 -2
  85. package/dist/{chunk-DRBXHRXE.js → chunk-IB26HVAJ.js} +2 -2
  86. package/dist/{chunk-XEQ7OT7U.js → chunk-IC6CBHCA.js} +3 -3
  87. package/dist/{chunk-CMRQ34J5.js → chunk-JCBWCYEJ.js} +2 -2
  88. package/dist/{chunk-3PDOVUHC.js → chunk-KXB4VXHY.js} +2 -2
  89. package/dist/{chunk-G6LBWZRF.js → chunk-LBOD4U5B.js} +7 -7
  90. package/dist/{chunk-ZGOQTOYA.js → chunk-LGHKJABJ.js} +3 -3
  91. package/dist/{chunk-T3GCXULH.js → chunk-M3C2V3PV.js} +10 -10
  92. package/dist/{chunk-OFHFH655.js → chunk-MJCGLM25.js} +8 -8
  93. package/dist/{chunk-JDZRYH2N.js → chunk-NHWB6HG2.js} +2 -2
  94. package/dist/{chunk-TC3VNKGX.js → chunk-NM2WP3B7.js} +4 -4
  95. package/dist/{chunk-IMA2EWLV.js → chunk-P5PXWTW7.js} +2 -2
  96. package/dist/chunk-PH3ZWL3W.js +786 -0
  97. package/dist/chunk-PH3ZWL3W.js.map +1 -0
  98. package/dist/{chunk-QMBNMPQM.js → chunk-PUS63Q3G.js} +24 -22
  99. package/dist/{chunk-QMBNMPQM.js.map → chunk-PUS63Q3G.js.map} +1 -1
  100. package/dist/{chunk-2QMKMVHH.js → chunk-QNWXCJ76.js} +2 -2
  101. package/dist/{chunk-FCDWWCLX.js → chunk-RGIWINDN.js} +427 -795
  102. package/dist/chunk-RGIWINDN.js.map +1 -0
  103. package/dist/{chunk-CSMCNOPH.js → chunk-SPJXKAVF.js} +3 -3
  104. package/dist/{chunk-4PBVXX7L.js → chunk-TH2LSRMG.js} +2 -2
  105. package/dist/{chunk-ESBQWC3U.js → chunk-VI2JQPNQ.js} +2 -2
  106. package/dist/{chunk-GGUBDXRR.js → chunk-W5EG6LE3.js} +2 -2
  107. package/dist/{chunk-DEBHXHJR.js → chunk-WIPEXG6R.js} +2 -2
  108. package/dist/{chunk-SH6YO3LT.js → chunk-WVO4G37W.js} +2 -2
  109. package/dist/{chunk-VVIW3PTA.js → chunk-YTQNQ4KB.js} +14 -14
  110. package/dist/{chunk-PKRIQL3V.js → chunk-YTSNAUXN.js} +2 -2
  111. package/dist/{chunk-QAOGGNE3.js → chunk-ZPSVBSOF.js} +4 -4
  112. package/dist/{cli-CxoSOiG0.d.ts → cli-C4GbETPC.d.ts} +5 -5
  113. package/dist/cli.d.ts +13 -13
  114. package/dist/cli.js +36 -35
  115. package/dist/compounding/engine.d.ts +3 -2
  116. package/dist/compounding/engine.js +10 -9
  117. package/dist/compounding/preference-consolidator.d.ts +1 -1
  118. package/dist/compression-optimizer.d.ts +1 -1
  119. package/dist/config.d.ts +1 -1
  120. package/dist/config.js +3 -3
  121. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  122. package/dist/connectors/codex-materialize-runner.js +10 -9
  123. package/dist/connectors/codex-materialize.d.ts +1 -1
  124. package/dist/connectors/index.d.ts +1 -1
  125. package/dist/connectors/index.js +10 -9
  126. package/dist/consolidation-provenance-check.d.ts +3 -2
  127. package/dist/consolidation-undo.d.ts +3 -2
  128. package/dist/contradiction/index.d.ts +3 -2
  129. package/dist/conversation-index/backend.d.ts +1 -1
  130. package/dist/conversation-index/chunker.d.ts +1 -1
  131. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  132. package/dist/conversation-index/indexer.d.ts +1 -1
  133. package/dist/conversation-index/search.d.ts +1 -1
  134. package/dist/corpus-watermark.d.ts +1 -1
  135. package/dist/corpus-watermark.js +12 -11
  136. package/dist/day-summary.d.ts +1 -1
  137. package/dist/delinearize.d.ts +1 -1
  138. package/dist/direct-answer-wiring.d.ts +1 -1
  139. package/dist/direct-answer.d.ts +1 -1
  140. package/dist/embedding-fallback.d.ts +1 -1
  141. package/dist/enrichment/index.d.ts +1 -1
  142. package/dist/entity-retrieval.d.ts +3 -2
  143. package/dist/entity-retrieval.js +10 -9
  144. package/dist/entity-schema.d.ts +1 -1
  145. package/dist/explicit-capture.d.ts +52 -10
  146. package/dist/explicit-capture.js +13 -1
  147. package/dist/extraction-error-classification.d.ts +1 -1
  148. package/dist/extraction-faithfulness.d.ts +1 -1
  149. package/dist/extraction-judge-telemetry.d.ts +1 -1
  150. package/dist/extraction-judge-training.d.ts +1 -1
  151. package/dist/extraction-judge.d.ts +1 -1
  152. package/dist/extraction-liveness.d.ts +1 -1
  153. package/dist/extraction-source-grounding-rules.d.ts +1 -1
  154. package/dist/extraction-source-grounding.d.ts +1 -1
  155. package/dist/extraction.d.ts +1 -1
  156. package/dist/fallback-llm.d.ts +1 -1
  157. package/dist/{forget-HRPLVB3W.js → forget-4UY2EOKH.js} +3 -3
  158. package/dist/graph-dashboard-diff.d.ts +1 -1
  159. package/dist/graph-dashboard-key.d.ts +1 -1
  160. package/dist/graph-dashboard-parser.d.ts +1 -1
  161. package/dist/graph-edge-reinforcement.d.ts +1 -1
  162. package/dist/graph-snapshot.d.ts +1 -1
  163. package/dist/graph.d.ts +1 -1
  164. package/dist/importance.d.ts +1 -1
  165. package/dist/importers/index.d.ts +1 -1
  166. package/dist/in-flight-reads.d.ts +1 -1
  167. package/dist/index.d.ts +21 -21
  168. package/dist/index.js +47 -45
  169. package/dist/intent.d.ts +1 -1
  170. package/dist/lcm/engine.d.ts +1 -1
  171. package/dist/lcm/index.d.ts +1 -1
  172. package/dist/lcm/tools.d.ts +1 -1
  173. package/dist/lifecycle.d.ts +1 -1
  174. package/dist/live-connectors-runner.d.ts +1 -1
  175. package/dist/local-llm.d.ts +1 -1
  176. package/dist/local-model-endpoint.d.ts +1 -1
  177. package/dist/maintenance/memory-governance.d.ts +1 -1
  178. package/dist/maintenance/memory-governance.js +10 -9
  179. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
  180. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +10 -9
  181. package/dist/maintenance/rebuild-memory-projection.d.ts +3 -2
  182. package/dist/maintenance/rebuild-memory-projection.js +11 -10
  183. package/dist/{maintenance-Cb-PjxQd.d.ts → maintenance-CL30NWtc.d.ts} +3 -3
  184. package/dist/mcp-memory-inspector-app.d.ts +11 -11
  185. package/dist/memory-action-policy.d.ts +1 -1
  186. package/dist/memory-cache.d.ts +1 -1
  187. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  188. package/dist/memory-projection-store.d.ts +1 -1
  189. package/dist/memory-provenance.d.ts +1 -1
  190. package/dist/memory-worth-outcomes.d.ts +3 -2
  191. package/dist/models-json.d.ts +1 -1
  192. package/dist/namespaces/migrate.d.ts +4 -3
  193. package/dist/namespaces/migrate.js +11 -10
  194. package/dist/namespaces/principal.d.ts +1 -1
  195. package/dist/namespaces/search.d.ts +1 -1
  196. package/dist/namespaces/storage.d.ts +4 -3
  197. package/dist/namespaces/storage.js +10 -9
  198. package/dist/native-knowledge.d.ts +1 -1
  199. package/dist/offline-sync-impression-drain.d.ts +1 -1
  200. package/dist/offline-sync-impression-drain.js +5 -5
  201. package/dist/offline-sync.js +2 -2
  202. package/dist/operator-doctor-corpus.d.ts +1 -1
  203. package/dist/operator-doctor-corpus.js +13 -12
  204. package/dist/operator-doctor-replica.d.ts +1 -1
  205. package/dist/operator-toolkit.d.ts +4 -3
  206. package/dist/operator-toolkit.js +18 -17
  207. package/dist/orchestration/compression-guideline-coordinator.d.ts +3 -2
  208. package/dist/orchestration/maintenance.d.ts +5 -4
  209. package/dist/orchestration/maintenance.js +15 -14
  210. package/dist/{orchestrator-5GKqb_HL.d.ts → orchestrator-CKTCRwWV.d.ts} +7 -7
  211. package/dist/orchestrator.d.ts +8 -8
  212. package/dist/orchestrator.js +45 -44
  213. package/dist/patterns-cli.d.ts +1 -1
  214. package/dist/{pipeline-3Qi1TpRo.d.ts → pipeline-B7wj4rRZ.d.ts} +1 -1
  215. package/dist/policy-runtime.d.ts +1 -1
  216. package/dist/proactive-contention.d.ts +1 -1
  217. package/dist/provenance.d.ts +1 -1
  218. package/dist/{purge-YSGX5BOG.js → purge-533FZLS4.js} +16 -9
  219. package/dist/purge-533FZLS4.js.map +1 -0
  220. package/dist/qmd-preflight.d.ts +2 -2
  221. package/dist/{qmd-D9JqzzRX.d.ts → qmd-q9tg4dHp.d.ts} +1 -1
  222. package/dist/qmd-recall-cache.d.ts +1 -1
  223. package/dist/qmd.d.ts +2 -2
  224. package/dist/recall-concurrency-config.d.ts +1 -1
  225. package/dist/recall-disclosure-escalation.d.ts +1 -1
  226. package/dist/recall-explain-renderer.d.ts +1 -1
  227. package/dist/recall-memory-map.d.ts +1 -1
  228. package/dist/recall-planner-llm.d.ts +1 -1
  229. package/dist/recall-state.d.ts +1 -1
  230. package/dist/recall-state.js +2 -2
  231. package/dist/recall-tag-filter.d.ts +1 -1
  232. package/dist/recall-timings.d.ts +1 -1
  233. package/dist/recall-xray-cli.d.ts +1 -1
  234. package/dist/recall-xray-renderer.d.ts +1 -1
  235. package/dist/recall-xray.d.ts +1 -1
  236. package/dist/replay/normalizers/chatgpt.d.ts +1 -1
  237. package/dist/replay/normalizers/claude.d.ts +1 -1
  238. package/dist/replay/normalizers/openclaw.d.ts +1 -1
  239. package/dist/replay/normalizers/shared.d.ts +1 -1
  240. package/dist/replay/runner.d.ts +1 -1
  241. package/dist/replay/types.d.ts +1 -1
  242. package/dist/replica-divergence.d.ts +1 -1
  243. package/dist/replica-peers-config.d.ts +1 -1
  244. package/dist/resolve-auth-token.d.ts +1 -1
  245. package/dist/resume-bundles.js +4 -4
  246. package/dist/retrieval-agents.d.ts +2 -2
  247. package/dist/retrieval-tiers.d.ts +1 -1
  248. package/dist/routing/engine.d.ts +1 -1
  249. package/dist/routing/store.d.ts +1 -1
  250. package/dist/salvage-envelope.d.ts +1 -1
  251. package/dist/schemas.d.ts +22 -22
  252. package/dist/{scope-profiles-C4g6_UdP.d.ts → scope-profiles-CWDyglPM.d.ts} +1 -1
  253. package/dist/search/embed-helper.d.ts +1 -1
  254. package/dist/search/factory.d.ts +1 -1
  255. package/dist/search/index.d.ts +1 -1
  256. package/dist/search/lancedb-backend.d.ts +1 -1
  257. package/dist/search/meilisearch-backend.d.ts +1 -1
  258. package/dist/search/noop-backend.d.ts +1 -1
  259. package/dist/search/orama-backend.d.ts +1 -1
  260. package/dist/search/port.d.ts +1 -1
  261. package/dist/search/remote-backend.d.ts +1 -1
  262. package/dist/secure-store/index.js +2 -2
  263. package/dist/{semantic-consolidation-BrxqnzTW.d.ts → semantic-consolidation-BUE3deLn.d.ts} +1 -1
  264. package/dist/semantic-consolidation.d.ts +2 -2
  265. package/dist/semantic-consolidation.js +11 -10
  266. package/dist/semantic-rule-promotion.js +10 -9
  267. package/dist/semantic-rule-verifier.d.ts +1 -1
  268. package/dist/semantic-rule-verifier.js +10 -9
  269. package/dist/{service-Bi1JgxdP.d.ts → service-CXgM0bQG.d.ts} +2 -2
  270. package/dist/session-observer-bands.d.ts +1 -1
  271. package/dist/session-observer-state.d.ts +1 -1
  272. package/dist/shared-context/manager.d.ts +1 -1
  273. package/dist/signal.d.ts +1 -1
  274. package/dist/{storage-CcH6yPk2.d.ts → storage-DysJq-XH.d.ts} +163 -27
  275. package/dist/storage.d.ts +3 -2
  276. package/dist/storage.js +12 -10
  277. package/dist/summarizer.d.ts +1 -1
  278. package/dist/summarizer.js +3 -3
  279. package/dist/summary-snapshot.d.ts +1 -1
  280. package/dist/summary-snapshot.js +2 -2
  281. package/dist/temporal-supersession.d.ts +3 -2
  282. package/dist/temporal-timeline-recall.d.ts +1 -1
  283. package/dist/temporal-validity.d.ts +1 -1
  284. package/dist/threading.d.ts +1 -1
  285. package/dist/tier-migration.d.ts +3 -2
  286. package/dist/tier-routing.d.ts +1 -1
  287. package/dist/topics.d.ts +1 -1
  288. package/dist/transcript.d.ts +1 -1
  289. package/dist/transfer/types.d.ts +12 -12
  290. package/dist/trust-score-stage.d.ts +1 -1
  291. package/dist/trust-score.d.ts +1 -1
  292. package/dist/{types-Dg0w9ADr.d.ts → types-aPPzhnjT.d.ts} +1 -1
  293. package/dist/types.d.ts +1 -1
  294. package/dist/utility-runtime.d.ts +1 -1
  295. package/dist/utils/serialize-mutations.d.ts +11 -7
  296. package/dist/utils/serialize-mutations.js +1 -1
  297. package/dist/verified-recall.js +10 -9
  298. package/dist/write-envelope.d.ts +1 -1
  299. package/package.json +2 -2
  300. package/src/access-observe-write-surface.ts +1 -1
  301. package/src/access-service-coding-write.test.ts +40 -0
  302. package/src/explicit-capture.test.ts +1110 -1
  303. package/src/explicit-capture.ts +534 -135
  304. package/src/maintenance/purge.test.ts +157 -1
  305. package/src/maintenance/purge.ts +15 -9
  306. package/src/secure-store/secure-fs.ts +78 -1
  307. package/src/storage/content-hash-index.ts +43 -17
  308. package/src/storage/entity-canonical-id-migration.ts +151 -23
  309. package/src/storage/tombstone-blocked-capture-index.ts +562 -0
  310. package/src/storage/tombstone-blocked-capture-mutation.ts +284 -0
  311. package/src/storage/tombstone-blocked-capture-sync.ts +872 -0
  312. package/src/storage-fact-hash-index-defer.test.ts +2900 -57
  313. package/src/storage.ts +266 -265
  314. package/src/testing/subjects/tombstone-blocked-capture.test.ts +181 -0
  315. package/src/utils/serialize-mutations.test.ts +4 -1
  316. package/src/utils/serialize-mutations.ts +26 -27
  317. package/dist/chunk-55MDBZLC.js +0 -490
  318. package/dist/chunk-55MDBZLC.js.map +0 -1
  319. package/dist/chunk-AIK5W3IW.js.map +0 -1
  320. package/dist/chunk-FCDWWCLX.js.map +0 -1
  321. package/dist/chunk-WL5EBRDH.js.map +0 -1
  322. package/dist/purge-YSGX5BOG.js.map +0 -1
  323. /package/dist/{chunk-KUJQHXPH.js.map → chunk-2EUVEDF5.js.map} +0 -0
  324. /package/dist/{chunk-EVX44I7C.js.map → chunk-5W4ZLBEZ.js.map} +0 -0
  325. /package/dist/{chunk-P3MH72CI.js.map → chunk-62U4J2GN.js.map} +0 -0
  326. /package/dist/{chunk-YGHMSDLK.js.map → chunk-66772WBP.js.map} +0 -0
  327. /package/dist/{chunk-EP5BVCRI.js.map → chunk-6BNE62PM.js.map} +0 -0
  328. /package/dist/{chunk-AAP5T6QG.js.map → chunk-6DNMUYEE.js.map} +0 -0
  329. /package/dist/{chunk-SG265CVF.js.map → chunk-6FUPCJUL.js.map} +0 -0
  330. /package/dist/{chunk-WZ7UB7XQ.js.map → chunk-6U7F52DE.js.map} +0 -0
  331. /package/dist/{chunk-E4OCKU67.js.map → chunk-7XC2HX75.js.map} +0 -0
  332. /package/dist/{chunk-OVRQLAYR.js.map → chunk-AZ5BTEKX.js.map} +0 -0
  333. /package/dist/{chunk-2HNUMF5V.js.map → chunk-CZRYLSSW.js.map} +0 -0
  334. /package/dist/{chunk-WONS4RZ2.js.map → chunk-FDAMS4PK.js.map} +0 -0
  335. /package/dist/{chunk-Q6VFVAKZ.js.map → chunk-GIBMDSJ2.js.map} +0 -0
  336. /package/dist/{chunk-ZXAGJFHJ.js.map → chunk-H5CPS5JP.js.map} +0 -0
  337. /package/dist/{chunk-NBDCZWP4.js.map → chunk-I5NLEENJ.js.map} +0 -0
  338. /package/dist/{chunk-DRBXHRXE.js.map → chunk-IB26HVAJ.js.map} +0 -0
  339. /package/dist/{chunk-XEQ7OT7U.js.map → chunk-IC6CBHCA.js.map} +0 -0
  340. /package/dist/{chunk-CMRQ34J5.js.map → chunk-JCBWCYEJ.js.map} +0 -0
  341. /package/dist/{chunk-3PDOVUHC.js.map → chunk-KXB4VXHY.js.map} +0 -0
  342. /package/dist/{chunk-G6LBWZRF.js.map → chunk-LBOD4U5B.js.map} +0 -0
  343. /package/dist/{chunk-ZGOQTOYA.js.map → chunk-LGHKJABJ.js.map} +0 -0
  344. /package/dist/{chunk-T3GCXULH.js.map → chunk-M3C2V3PV.js.map} +0 -0
  345. /package/dist/{chunk-OFHFH655.js.map → chunk-MJCGLM25.js.map} +0 -0
  346. /package/dist/{chunk-JDZRYH2N.js.map → chunk-NHWB6HG2.js.map} +0 -0
  347. /package/dist/{chunk-TC3VNKGX.js.map → chunk-NM2WP3B7.js.map} +0 -0
  348. /package/dist/{chunk-IMA2EWLV.js.map → chunk-P5PXWTW7.js.map} +0 -0
  349. /package/dist/{chunk-2QMKMVHH.js.map → chunk-QNWXCJ76.js.map} +0 -0
  350. /package/dist/{chunk-CSMCNOPH.js.map → chunk-SPJXKAVF.js.map} +0 -0
  351. /package/dist/{chunk-4PBVXX7L.js.map → chunk-TH2LSRMG.js.map} +0 -0
  352. /package/dist/{chunk-ESBQWC3U.js.map → chunk-VI2JQPNQ.js.map} +0 -0
  353. /package/dist/{chunk-GGUBDXRR.js.map → chunk-W5EG6LE3.js.map} +0 -0
  354. /package/dist/{chunk-DEBHXHJR.js.map → chunk-WIPEXG6R.js.map} +0 -0
  355. /package/dist/{chunk-SH6YO3LT.js.map → chunk-WVO4G37W.js.map} +0 -0
  356. /package/dist/{chunk-VVIW3PTA.js.map → chunk-YTQNQ4KB.js.map} +0 -0
  357. /package/dist/{chunk-PKRIQL3V.js.map → chunk-YTSNAUXN.js.map} +0 -0
  358. /package/dist/{chunk-QAOGGNE3.js.map → chunk-ZPSVBSOF.js.map} +0 -0
  359. /package/dist/{forget-HRPLVB3W.js.map → forget-4UY2EOKH.js.map} +0 -0
@@ -18,7 +18,7 @@ import {
18
18
  } from "./chunk-VS2IYZRU.js";
19
19
 
20
20
  // src/secure-store/secure-fs.ts
21
- import { createCipheriv, randomBytes, randomUUID } from "crypto";
21
+ import { createCipheriv, createDecipheriv, randomBytes, randomUUID } from "crypto";
22
22
  import { lstat, mkdir, open as openFile, readFile, readdir, rename, unlink, writeFile } from "fs/promises";
23
23
  import path from "path";
24
24
  var SecureStoreLockedError = class extends Error {
@@ -203,6 +203,71 @@ async function writeMaybeEncryptedFileFromChunks(filePath, chunks, key, options
203
203
  }
204
204
  }
205
205
  }
206
+ async function* readMaybeEncryptedFileFromChunks(filePath, key, memoryDir, chunkSize = 64 * 1024) {
207
+ const handle = await openFile(filePath, "r");
208
+ const headerSize = MAGIC_HEADER_SIZE + ENVELOPE_HEADER_SIZE;
209
+ try {
210
+ const prefix = Buffer.alloc(headerSize);
211
+ const { bytesRead: prefixBytes } = await handle.read(prefix, 0, prefix.length, 0);
212
+ const prefixView = prefix.subarray(0, prefixBytes);
213
+ if (!isEncryptedFile(prefixView)) {
214
+ if (prefixBytes > 0) yield Buffer.from(prefixView);
215
+ let position2 = prefixBytes;
216
+ const buffer2 = Buffer.alloc(chunkSize);
217
+ for (; ; ) {
218
+ const { bytesRead } = await handle.read(buffer2, 0, buffer2.length, position2);
219
+ if (bytesRead === 0) break;
220
+ position2 += bytesRead;
221
+ yield Buffer.from(buffer2.subarray(0, bytesRead));
222
+ }
223
+ return;
224
+ }
225
+ if (prefixBytes < headerSize) {
226
+ throw new Error(`encrypted file header is truncated: ${filePath}`);
227
+ }
228
+ if (key === null) {
229
+ throw new SecureStoreLockedError(
230
+ `secure-store is locked \u2014 cannot read encrypted file at ${filePath}. Run \`remnic secure-store unlock\` to decrypt.`
231
+ );
232
+ }
233
+ const envelope = prefix.subarray(MAGIC_HEADER_SIZE);
234
+ const version = envelope.readUInt8(ENVELOPE_LAYOUT.version);
235
+ if (version !== ENVELOPE_VERSION) {
236
+ throw new Error(`secure-store: unsupported envelope version ${version}`);
237
+ }
238
+ const salt = envelope.subarray(
239
+ ENVELOPE_LAYOUT.salt,
240
+ ENVELOPE_LAYOUT.salt + ENVELOPE_SALT_LENGTH
241
+ );
242
+ const iv = envelope.subarray(ENVELOPE_LAYOUT.iv, ENVELOPE_LAYOUT.iv + IV_LENGTH);
243
+ const authTag = envelope.subarray(
244
+ ENVELOPE_LAYOUT.authTag,
245
+ ENVELOPE_LAYOUT.authTag + AUTH_TAG_LENGTH
246
+ );
247
+ const decipher = createDecipheriv("aes-256-gcm", key, iv, { authTagLength: AUTH_TAG_LENGTH });
248
+ decipher.setAAD(Buffer.concat([buildHeaderAad(salt), filePathAad(filePath, memoryDir)]));
249
+ decipher.setAuthTag(authTag);
250
+ let position = headerSize;
251
+ const buffer = Buffer.alloc(chunkSize);
252
+ try {
253
+ for (; ; ) {
254
+ const { bytesRead } = await handle.read(buffer, 0, buffer.length, position);
255
+ if (bytesRead === 0) break;
256
+ position += bytesRead;
257
+ const plain = decipher.update(buffer.subarray(0, bytesRead));
258
+ if (plain.length > 0) yield plain;
259
+ }
260
+ const final = decipher.final();
261
+ if (final.length > 0) yield final;
262
+ } catch (err) {
263
+ if (err instanceof SecureStoreDecryptError) throw err;
264
+ const message = err instanceof Error ? err.message : String(err);
265
+ throw new SecureStoreDecryptError(`secure-store decryption failed: ${message}`);
266
+ }
267
+ } finally {
268
+ await handle.close();
269
+ }
270
+ }
206
271
  async function migrateMemoryDirToEncrypted(dir, key, onBeforeEncrypt) {
207
272
  const result = { encrypted: 0, skipped: 0, errors: [] };
208
273
  const files = await collectEncryptableStorageFiles(dir);
@@ -478,7 +543,8 @@ export {
478
543
  readMaybeEncryptedFile,
479
544
  writeMaybeEncryptedFile,
480
545
  writeMaybeEncryptedFileFromChunks,
546
+ readMaybeEncryptedFileFromChunks,
481
547
  migrateMemoryDirToEncrypted,
482
548
  decryptMemoryDirToPlaintext
483
549
  };
484
- //# sourceMappingURL=chunk-AIK5W3IW.js.map
550
+ //# sourceMappingURL=chunk-5TFP4CUL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/secure-store/secure-fs.ts"],"sourcesContent":["/**\n * Transparent file-level encryption for the secure-store module.\n *\n * Issue #690 (PR 3/4) — storage.ts integration layer.\n *\n * This module sits between the raw filesystem and StorageManager.\n * Every memory file is either:\n * - a plain UTF-8 text file (legacy, back-compat), or\n * - a REMNIC-ENC sealed file (AES-256-GCM, see format below).\n *\n * On-disk format\n * --------------\n * Encrypted files begin with a 9-byte magic header:\n *\n * REMNIC-ENC (7 ASCII bytes)\n * VER (1 byte, currently 0x01)\n * FLAGS (1 byte, reserved, must be 0x00)\n *\n * Followed immediately by a `seal()` envelope from `cipher.ts`:\n *\n * [VERSION:1][SALT:16][IV:12][AUTHTAG:16][CIPHERTEXT:...]\n *\n * The magic header makes encrypted files sniffable without attempting\n * a full `open()` call and gives operators a clear signal that the\n * file cannot be read by opening it in an editor.\n *\n * AAD\n * ---\n * The file path relative to the memory root is bound as Associated\n * Authenticated Data (AAD) on both encrypt and decrypt. This means\n * moving or renaming an encrypted file without re-encrypting it will\n * cause auth-tag failure on the next read — the file is tied to its\n * path. Callers that move files must re-encrypt them.\n *\n * Back-compat\n * -----------\n * `readMaybeEncryptedFile` transparently handles both formats: if the\n * file does NOT start with the magic bytes, it is returned as-is (plain\n * text). This lets an operator migrate incrementally: newly-written\n * files are encrypted while existing files continue to be read in plain\n * form until `migrateMemoryDirToEncrypted` is run.\n *\n * Naming: `secure-fs.ts` (not `vault-fs.ts`) — see `kdf.ts` naming note.\n */\n\nimport { createCipheriv, createDecipheriv, randomBytes, randomUUID } from \"node:crypto\";\nimport { lstat, mkdir, open as openFile, readFile, readdir, rename, unlink, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport {\n AUTH_TAG_LENGTH,\n ENVELOPE_HEADER_SIZE,\n ENVELOPE_LAYOUT,\n ENVELOPE_SALT_LENGTH,\n ENVELOPE_VERSION,\n IV_LENGTH,\n generateSalt,\n open as openEnvelope,\n parseEnvelope,\n seal,\n} from \"./cipher.js\";\nimport { RECALL_FALLBACK_DIRS } from \"../utils/category-dir.js\";\nimport { isErrnoCode } from \"../utils/errno.js\";\n\n// ---------------------------------------------------------------------------\n// Error classes\n// ---------------------------------------------------------------------------\n\n/**\n * Thrown when a read is attempted but the keyring entry for this\n * store is absent (i.e. `secure-store unlock` has not been run\n * since the last daemon start).\n */\nexport class SecureStoreLockedError extends Error {\n constructor(message = \"secure-store is locked — run `remnic secure-store unlock` to decrypt\") {\n super(message);\n this.name = \"SecureStoreLockedError\";\n }\n}\n\n/**\n * Thrown when `open()` fails because the auth tag does not validate.\n * This covers both wrong-key and tampered-ciphertext scenarios —\n * intentionally indistinguishable from the caller's perspective.\n */\nexport class SecureStoreDecryptError extends Error {\n constructor(message = \"secure-store decryption failed — wrong key or tampered ciphertext\") {\n super(message);\n this.name = \"SecureStoreDecryptError\";\n }\n}\n\n// ---------------------------------------------------------------------------\n// Magic header\n// ---------------------------------------------------------------------------\n\n/** Magic bytes: the ASCII string \"REMNIC-ENC\" (10 bytes). */\nexport const MAGIC_BYTES = Buffer.from(\"REMNIC-ENC\", \"ascii\");\n\n/** Current on-disk version byte. */\nexport const FILE_FORMAT_VERSION = 0x01;\n\n/** Reserved flags byte — must be 0x00. */\nexport const FILE_FORMAT_FLAGS = 0x00;\n\n/** Total size of the magic header prefix (magic + version + flags). */\nexport const MAGIC_HEADER_SIZE = MAGIC_BYTES.length + 2; // 12 bytes\n\n/**\n * Exact, deterministic bytes `writeMaybeEncryptedFile` adds to an encrypted\n * file beyond its plaintext body: the magic header prefix plus the fixed\n * envelope header (version + salt + IV + auth tag). AES-256-GCM ciphertext\n * matches the plaintext length and the state-file write path applies no\n * compression, so an encrypted state file is exactly `plaintext +\n * SECURE_STORE_ENVELOPE_OVERHEAD_BYTES` on disk. Compaction reserves this so an\n * encrypted ledger lands strictly below the reader's whole-file decrypt cap\n * (issue #2033).\n */\nexport const SECURE_STORE_ENVELOPE_OVERHEAD_BYTES = MAGIC_HEADER_SIZE + ENVELOPE_HEADER_SIZE;\n\n// ---------------------------------------------------------------------------\n// Detection\n// ---------------------------------------------------------------------------\n\n/**\n * Return true iff `buf` begins with the REMNIC-ENC magic header.\n * Does not validate the envelope; just identifies the format.\n */\nexport function isEncryptedFile(buf: Uint8Array): boolean {\n if (buf.length < MAGIC_HEADER_SIZE) return false;\n const b = Buffer.isBuffer(buf) ? buf : Buffer.from(buf);\n return b.subarray(0, MAGIC_BYTES.length).equals(MAGIC_BYTES);\n}\n\n/**\n * True when the REGULAR file at `probePath` is encrypted at rest (its first\n * bytes are the REMNIC-ENC magic header). ENOENT resolves to false — an absent\n * file has nothing to probe. A symlink, FIFO, device, or any other non-regular\n * path is REFUSED with a throw rather than opened: opening a FIFO blocks until a\n * writer appears and a symlink would redirect the probe outside our tree. The\n * ledgers and per-event spills we manage are always regular files, so a\n * non-regular path is an anomaly the caller must treat as unsafe, never follow\n * (#2033). Shared by the CLI ledger recovery probe and the auto-compaction probe\n * so both enforce identical open safety.\n */\nexport async function probeEncryptedRegularFileHeader(probePath: string): Promise<boolean> {\n let entryStat;\n try {\n entryStat = await lstat(probePath);\n } catch (err) {\n if (isErrnoCode(err, \"ENOENT\")) return false;\n throw err;\n }\n if (!entryStat.isFile()) {\n throw new Error(\n `refusing to probe non-regular state path ${probePath} `\n + `(symlink/FIFO/device); opening it could block or escape containment (#2033)`,\n );\n }\n const handle = await openFile(probePath, \"r\");\n try {\n const header = Buffer.alloc(MAGIC_HEADER_SIZE);\n const { bytesRead } = await handle.read(header, 0, header.length, 0);\n return isEncryptedFile(header.subarray(0, bytesRead));\n } finally {\n await handle.close();\n }\n}\n\n// ---------------------------------------------------------------------------\n// Encrypt / decrypt file body\n// ---------------------------------------------------------------------------\n\n/**\n * Encrypt `plain` (UTF-8 content of a memory file) and return a\n * Buffer ready to write to disk.\n *\n * @param plain Plain-text file content (UTF-8 string or Buffer).\n * @param key 32-byte AES-256 key from the keyring.\n * @param aad Optional associated data — defaults to empty if omitted.\n * Callers should pass the file path relative to memoryDir\n * so the ciphertext is bound to its location.\n */\nexport function encryptFileBody(plain: string | Buffer, key: Buffer, aad?: Buffer): Buffer {\n const plainBuf = typeof plain === \"string\" ? Buffer.from(plain, \"utf8\") : plain;\n const salt = generateSalt();\n const envelope = seal(key, salt, plainBuf, aad ? { aad } : {});\n\n const header = Buffer.alloc(MAGIC_HEADER_SIZE);\n MAGIC_BYTES.copy(header, 0);\n header.writeUInt8(FILE_FORMAT_VERSION, MAGIC_BYTES.length);\n header.writeUInt8(FILE_FORMAT_FLAGS, MAGIC_BYTES.length + 1);\n\n return Buffer.concat([header, envelope]);\n}\n\n/**\n * Decrypt a buffer produced by `encryptFileBody` and return the\n * original UTF-8 content.\n *\n * Throws `SecureStoreDecryptError` on auth failure (wrong key or\n * tampered ciphertext). Throws a plain `Error` for structural problems\n * (truncated buffer, wrong magic, unsupported version).\n */\nexport function decryptFileBody(buf: Buffer, key: Buffer, aad?: Buffer): Buffer {\n if (!isEncryptedFile(buf)) {\n throw new Error(\"decryptFileBody: buffer does not start with REMNIC-ENC magic header\");\n }\n const version = buf.readUInt8(MAGIC_BYTES.length);\n if (version !== FILE_FORMAT_VERSION) {\n throw new Error(\n `decryptFileBody: unsupported file format version ${version} (this build supports ${FILE_FORMAT_VERSION})`\n );\n }\n const flags = buf.readUInt8(MAGIC_BYTES.length + 1);\n if (flags !== FILE_FORMAT_FLAGS) {\n throw new Error(`decryptFileBody: unknown flags byte 0x${flags.toString(16).padStart(2, \"0\")}`);\n }\n const envelope = buf.subarray(MAGIC_HEADER_SIZE);\n parseEnvelope(envelope);\n try {\n return openEnvelope(key, envelope, aad ? { aad } : {});\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n throw new SecureStoreDecryptError(`secure-store decryption failed: ${msg}`);\n }\n}\n\nfunction buildHeaderAad(salt: Uint8Array): Buffer {\n const out = Buffer.alloc(1 + ENVELOPE_SALT_LENGTH);\n out.writeUInt8(ENVELOPE_VERSION, 0);\n Buffer.from(salt).copy(out, 1);\n return out;\n}\n\n// ---------------------------------------------------------------------------\n// Path → AAD helper\n// ---------------------------------------------------------------------------\n\n/**\n * Build the AAD buffer for a file at `filePath` relative to\n * `memoryDir`. The AAD binds the ciphertext to its path so a\n * file cannot be silently relocated without re-encryption.\n *\n * When `memoryDir` is supplied and `filePath` is absolute, the\n * relative sub-path is used. Otherwise `filePath` is used verbatim.\n */\nexport function filePathAad(filePath: string, memoryDir?: string): Buffer {\n let rel = filePath;\n if (memoryDir && path.isAbsolute(filePath)) {\n rel = path.relative(memoryDir, filePath);\n }\n return Buffer.from(rel, \"utf8\");\n}\n\n// ---------------------------------------------------------------------------\n// High-level read / write helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Read a file from `filePath`.\n *\n * - If the file is plaintext (no magic header), return its content\n * as-is — back-compat with unencrypted stores.\n * - If the file is encrypted AND `key` is provided, decrypt and return\n * the plaintext content.\n * - If the file is encrypted AND `key` is null, throw\n * `SecureStoreLockedError`.\n *\n * @param filePath Absolute path to the file.\n * @param key 32-byte AES-256 key, or null when the store is locked.\n * @param memoryDir Memory root for path-bound AAD. Should be absolute.\n */\nexport async function readMaybeEncryptedFileBuffer(\n filePath: string,\n key: Buffer | null,\n memoryDir?: string\n): Promise<Buffer> {\n const buf = await readFile(filePath);\n if (!isEncryptedFile(buf)) {\n // Plain file — legacy or unencrypted store.\n return buf;\n }\n // Encrypted — key required.\n if (key === null) {\n throw new SecureStoreLockedError(\n `secure-store is locked — cannot read encrypted file at ${filePath}. Run \\`remnic secure-store unlock\\` to decrypt.`\n );\n }\n return decryptFileBodyForPath(buf, key, filePath, memoryDir);\n}\n\nexport async function readMaybeEncryptedFile(\n filePath: string,\n key: Buffer | null,\n memoryDir?: string\n): Promise<string> {\n return (await readMaybeEncryptedFileBuffer(filePath, key, memoryDir)).toString(\"utf8\");\n}\n\nexport interface WriteMaybeEncryptedFileOptions {\n /**\n * File mode bits. Default 0o600 (owner read/write only).\n * Applied only on create; existing files inherit their existing mode.\n */\n mode?: number;\n /**\n * If true, write atomically via a temp file + rename (CLAUDE.md gotcha #54).\n * Default true.\n */\n atomic?: boolean;\n}\n\n/**\n * Write `content` to `filePath`.\n *\n * - If `key` is provided and non-null, encrypt the content first.\n * - If `key` is null, write the content as plain UTF-8 (unencrypted store).\n *\n * Writes atomically: content is written to a unique temp file\n * first, then renamed into place (CLAUDE.md gotcha #54 — never delete\n * before write).\n */\nexport async function writeMaybeEncryptedFile(\n filePath: string,\n content: string | Buffer,\n key: Buffer | null,\n options: WriteMaybeEncryptedFileOptions = {},\n memoryDir?: string\n): Promise<void> {\n const { mode = 0o600, atomic = true } = options;\n await mkdir(path.dirname(filePath), { recursive: true });\n\n let data: Buffer | string;\n if (key !== null) {\n const aad = filePathAad(filePath, memoryDir);\n data = encryptFileBody(content, key, aad);\n } else {\n data = content;\n }\n\n if (atomic) {\n const tempPath = uniqueAtomicTempPath(filePath, \"tmp\");\n try {\n await writeFile(tempPath, data, { mode });\n await rename(tempPath, filePath);\n } catch (err) {\n // Best-effort cleanup of the temp file.\n try {\n await unlink(tempPath);\n } catch {\n // ignore\n }\n throw err;\n }\n } else {\n await writeFile(filePath, data, { mode });\n }\n}\n\nexport async function writeMaybeEncryptedFileFromChunks(\n filePath: string,\n chunks: AsyncIterable<Buffer>,\n key: Buffer | null,\n options: WriteMaybeEncryptedFileOptions = {},\n memoryDir?: string\n): Promise<void> {\n const { mode = 0o600, atomic = true } = options;\n await mkdir(path.dirname(filePath), { recursive: true });\n const writePath = atomic ? `${filePath}.tmp-${process.pid}-${Date.now()}` : filePath;\n let completed = false;\n try {\n const handle = await openFile(writePath, \"w\", mode);\n try {\n if (key !== null) {\n const salt = generateSalt();\n const iv = randomBytes(IV_LENGTH);\n const header = Buffer.alloc(MAGIC_HEADER_SIZE + ENVELOPE_HEADER_SIZE);\n MAGIC_BYTES.copy(header, 0);\n header.writeUInt8(FILE_FORMAT_VERSION, MAGIC_BYTES.length);\n header.writeUInt8(FILE_FORMAT_FLAGS, MAGIC_BYTES.length + 1);\n const envelopeOffset = MAGIC_HEADER_SIZE;\n header.writeUInt8(ENVELOPE_VERSION, envelopeOffset + ENVELOPE_LAYOUT.version);\n salt.copy(header, envelopeOffset + ENVELOPE_LAYOUT.salt);\n iv.copy(header, envelopeOffset + ENVELOPE_LAYOUT.iv);\n await handle.write(header);\n\n const cipher = createCipheriv(\"aes-256-gcm\", key, iv, { authTagLength: AUTH_TAG_LENGTH });\n const aad = filePathAad(filePath, memoryDir);\n cipher.setAAD(Buffer.concat([buildHeaderAad(salt), aad]));\n for await (const chunk of chunks) {\n if (chunk.length === 0) continue;\n const encrypted = cipher.update(chunk);\n if (encrypted.length > 0) await handle.write(encrypted);\n }\n const final = cipher.final();\n if (final.length > 0) await handle.write(final);\n const authTag = cipher.getAuthTag();\n await handle.write(authTag, 0, authTag.length, MAGIC_HEADER_SIZE + ENVELOPE_LAYOUT.authTag);\n } else {\n for await (const chunk of chunks) {\n if (chunk.length > 0) await handle.write(chunk);\n }\n }\n } finally {\n await handle.close();\n }\n if (atomic) {\n await rename(writePath, filePath);\n }\n completed = true;\n } finally {\n if (!completed && atomic) {\n await unlink(writePath).catch(() => {});\n }\n }\n}\n\n/**\n * Stream a file through the secure-store reader without buffering the whole\n * payload. Plaintext files are passed through unchanged; encrypted files are\n * authenticated and decrypted incrementally.\n */\nexport async function* readMaybeEncryptedFileFromChunks(\n filePath: string,\n key: Buffer | null,\n memoryDir?: string,\n chunkSize = 64 * 1024\n): AsyncIterable<Buffer> {\n const handle = await openFile(filePath, \"r\");\n const headerSize = MAGIC_HEADER_SIZE + ENVELOPE_HEADER_SIZE;\n try {\n const prefix = Buffer.alloc(headerSize);\n const { bytesRead: prefixBytes } = await handle.read(prefix, 0, prefix.length, 0);\n const prefixView = prefix.subarray(0, prefixBytes);\n if (!isEncryptedFile(prefixView)) {\n if (prefixBytes > 0) yield Buffer.from(prefixView);\n let position = prefixBytes;\n const buffer = Buffer.alloc(chunkSize);\n for (;;) {\n const { bytesRead } = await handle.read(buffer, 0, buffer.length, position);\n if (bytesRead === 0) break;\n position += bytesRead;\n yield Buffer.from(buffer.subarray(0, bytesRead));\n }\n return;\n }\n if (prefixBytes < headerSize) {\n throw new Error(`encrypted file header is truncated: ${filePath}`);\n }\n if (key === null) {\n throw new SecureStoreLockedError(\n `secure-store is locked — cannot read encrypted file at ${filePath}. ` +\n \"Run `remnic secure-store unlock` to decrypt.\"\n );\n }\n const envelope = prefix.subarray(MAGIC_HEADER_SIZE);\n const version = envelope.readUInt8(ENVELOPE_LAYOUT.version);\n if (version !== ENVELOPE_VERSION) {\n throw new Error(`secure-store: unsupported envelope version ${version}`);\n }\n const salt = envelope.subarray(\n ENVELOPE_LAYOUT.salt,\n ENVELOPE_LAYOUT.salt + ENVELOPE_SALT_LENGTH\n );\n const iv = envelope.subarray(ENVELOPE_LAYOUT.iv, ENVELOPE_LAYOUT.iv + IV_LENGTH);\n const authTag = envelope.subarray(\n ENVELOPE_LAYOUT.authTag,\n ENVELOPE_LAYOUT.authTag + AUTH_TAG_LENGTH\n );\n const decipher = createDecipheriv(\"aes-256-gcm\", key, iv, { authTagLength: AUTH_TAG_LENGTH });\n decipher.setAAD(Buffer.concat([buildHeaderAad(salt), filePathAad(filePath, memoryDir)]));\n decipher.setAuthTag(authTag);\n let position = headerSize;\n const buffer = Buffer.alloc(chunkSize);\n try {\n for (;;) {\n const { bytesRead } = await handle.read(buffer, 0, buffer.length, position);\n if (bytesRead === 0) break;\n position += bytesRead;\n const plain = decipher.update(buffer.subarray(0, bytesRead));\n if (plain.length > 0) yield plain;\n }\n const final = decipher.final();\n if (final.length > 0) yield final;\n } catch (err) {\n if (err instanceof SecureStoreDecryptError) throw err;\n const message = err instanceof Error ? err.message : String(err);\n throw new SecureStoreDecryptError(`secure-store decryption failed: ${message}`);\n }\n } finally {\n await handle.close();\n }\n}\n\n// ---------------------------------------------------------------------------\n// Migration\n// ---------------------------------------------------------------------------\n\nexport interface MigrateResult {\n /** Number of files successfully encrypted. */\n encrypted: number;\n /** Number of files already encrypted (skipped). */\n skipped: number;\n /** Files that failed to encrypt (path → error message). */\n errors: Array<{ filePath: string; error: string }>;\n}\n\nexport interface DecryptResult {\n /** Number of files successfully decrypted back to plaintext. */\n decrypted: number;\n /** Number of files already plaintext (skipped). */\n skipped: number;\n /** Files that failed to decrypt (path → error message). */\n errors: Array<{ filePath: string; error: string }>;\n}\n\n/**\n * Walk `dir` recursively, find encryptable storage-managed files that are not\n * yet encrypted, and re-write them as encrypted files under `key`.\n *\n * Safety rules per CLAUDE.md gotchas #54 and #25:\n * 1. A page-version snapshot is taken (via `createVersion`) BEFORE\n * each overwrite so the plaintext version is preserved in history.\n * Since this module has no direct access to `page-versioning.ts`\n * internals, callers who have page-versioning configured should\n * pass `onBeforeEncrypt` to take the snapshot.\n * 2. The new encrypted content is written to a temp file first,\n * then renamed atomically — never deleted before written.\n * 3. If encryption of any file fails, the error is recorded and the\n * original file is left intact (partial migration is safe).\n *\n * @param dir Absolute path to the memory directory.\n * @param key 32-byte AES-256 key.\n * @param onBeforeEncrypt Optional callback invoked before encrypting\n * each file. Can be used to take page-version\n * snapshots. Errors here are non-fatal.\n */\nexport async function migrateMemoryDirToEncrypted(\n dir: string,\n key: Buffer,\n onBeforeEncrypt?: (filePath: string) => Promise<void>\n): Promise<MigrateResult> {\n const result: MigrateResult = { encrypted: 0, skipped: 0, errors: [] };\n\n const files = await collectEncryptableStorageFiles(dir);\n for (const filePath of files) {\n try {\n const buf = await readFile(filePath);\n if (isEncryptedFile(buf)) {\n result.skipped++;\n continue;\n }\n // Call optional pre-encryption hook (e.g. page-version snapshot).\n if (onBeforeEncrypt) {\n try {\n await onBeforeEncrypt(filePath);\n } catch {\n // Non-fatal — continue with encryption even if snapshot fails.\n }\n }\n const content = buf.toString(\"utf8\");\n const aad = filePathAad(filePath, dir);\n const encrypted = encryptFileBody(content, key, aad);\n\n // Atomic write: temp → rename (gotcha #54).\n const tempPath = uniqueAtomicTempPath(filePath, \"enc-tmp\");\n try {\n await writeFile(tempPath, encrypted, { mode: 0o600 });\n await rename(tempPath, filePath);\n result.encrypted++;\n } catch (writeErr) {\n // Clean up temp file, leave original intact.\n try {\n const { unlink } = await import(\"node:fs/promises\");\n await unlink(tempPath);\n } catch {\n // ignore\n }\n throw writeErr;\n }\n } catch (err) {\n result.errors.push({\n filePath,\n error: err instanceof Error ? err.message : String(err),\n });\n }\n }\n\n return result;\n}\n\n/**\n * Walk `dir` recursively, find storage-managed encrypted files, and\n * re-write them as plaintext under the same paths.\n *\n * This is the reversible counterpart to {@link migrateMemoryDirToEncrypted}.\n * It only touches files under the same storage-managed roots, skips\n * plaintext files, skips symlinks, excludes `.secure-store/`, and writes\n * each plaintext replacement via temp-file + rename so a per-file failure\n * leaves the ciphertext intact.\n */\nexport async function decryptMemoryDirToPlaintext(dir: string, key: Buffer): Promise<DecryptResult> {\n const result: DecryptResult = { decrypted: 0, skipped: 0, errors: [] };\n\n const files = await collectStorageManagedFiles(dir, isDecryptableStoragePath);\n for (const filePath of files) {\n try {\n const buf = await readFile(filePath);\n if (!isEncryptedFile(buf)) {\n result.skipped++;\n continue;\n }\n\n const plaintext = decryptFileBodyForPath(buf, key, filePath, dir);\n const tempPath = uniqueAtomicTempPath(filePath, \"dec-tmp\");\n try {\n await writeFile(tempPath, plaintext, { mode: 0o600 });\n await rename(tempPath, filePath);\n result.decrypted++;\n } catch (writeErr) {\n try {\n await unlink(tempPath);\n } catch {\n // ignore cleanup errors; original ciphertext is still intact.\n }\n throw writeErr;\n }\n } catch (err) {\n result.errors.push({\n filePath,\n error: err instanceof Error ? err.message : String(err),\n });\n }\n }\n\n return result;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\nfunction uniqueAtomicTempPath(filePath: string, label: string): string {\n return `${filePath}.${label}-${process.pid}-${Date.now()}-${randomUUID()}`;\n}\n\nfunction decryptFileBodyForPath(buf: Buffer, key: Buffer, filePath: string, memoryDir?: string): Buffer {\n const aad = filePathAad(filePath, memoryDir);\n try {\n return decryptFileBody(buf, key, aad);\n } catch (err) {\n if (!(err instanceof SecureStoreDecryptError)) {\n throw err;\n }\n const legacyRoot = legacyNamespaceAadRootForFile(filePath, memoryDir);\n if (legacyRoot) {\n try {\n return decryptFileBody(buf, key, filePathAad(filePath, legacyRoot));\n } catch {\n // Fall through to the namespace-reader fallback below.\n }\n }\n\n const topLevelRoot = topLevelAadRootForNamespaceReader(filePath, memoryDir);\n if (topLevelRoot) {\n try {\n return decryptFileBody(buf, key, filePathAad(filePath, topLevelRoot));\n } catch {\n // Preserve the caller-facing error from the canonical decrypt attempt.\n }\n }\n\n throw err;\n }\n}\n\nfunction topLevelAadRootForNamespaceReader(filePath: string, memoryDir?: string): string | null {\n if (!memoryDir || !path.isAbsolute(filePath)) return null;\n const resolvedMemoryDir = path.resolve(memoryDir);\n const rel = path.relative(resolvedMemoryDir, filePath);\n if (rel === \"\" || rel.startsWith(\"..\") || path.isAbsolute(rel)) return null;\n const parts = resolvedMemoryDir.split(path.sep);\n if (parts.length < 3 || parts.at(-2) !== \"namespaces\" || !parts.at(-1)) return null;\n const topLevelRoot = parts.slice(0, -2).join(path.sep) || path.sep;\n const topRel = path.relative(topLevelRoot, filePath);\n if (topRel === \"\" || topRel.startsWith(\"..\") || path.isAbsolute(topRel)) {\n return null;\n }\n const topParts = topRel.split(path.sep);\n if (topParts[0] !== \"namespaces\" || topParts[1] !== parts.at(-1)) {\n return null;\n }\n return topLevelRoot;\n}\n\nfunction legacyNamespaceAadRootForFile(filePath: string, memoryDir?: string): string | null {\n if (!memoryDir || !path.isAbsolute(filePath)) return null;\n const rel = path.relative(memoryDir, filePath);\n if (rel === \"\" || rel.startsWith(\"..\") || path.isAbsolute(rel)) return null;\n const parts = rel.split(path.sep);\n if (parts[0] === \"namespaces\" && parts.length >= 3 && parts[1]) {\n return path.join(memoryDir, \"namespaces\", parts[1]);\n }\n return null;\n}\n\n/**\n * Recursively collect files under `dir` that are read through the\n * storage-layer secure-store helpers, excluding symlinked entries and\n * `.secure-store/` metadata.\n */\nasync function collectEncryptableStorageFiles(dir: string, rootDir = dir): Promise<string[]> {\n return collectStorageManagedFiles(dir, isEncryptableStoragePath, rootDir);\n}\n\n/**\n * Recursively collect regular files under storage-managed roots, excluding\n * symlinked entries and `.secure-store/` metadata. This broader collector is\n * used by the decrypt/disable path so future encrypted sidecars can be\n * restored without requiring extension-specific logic.\n */\nasync function collectStorageManagedFiles(\n dir: string,\n includeFile: (filePath: string, rootDir: string) => boolean,\n rootDir = dir\n): Promise<string[]> {\n const results: string[] = [];\n let scanDir = dir;\n let scanRootDir = rootDir;\n if (path.resolve(dir) === path.resolve(rootDir)) {\n const normalizedRoot = await resolveStorageManagedRootForScan(dir);\n if (!normalizedRoot) return results;\n scanDir = normalizedRoot;\n scanRootDir = normalizedRoot;\n }\n let names: string[];\n try {\n names = await readdir(scanDir, { encoding: \"utf8\" });\n } catch {\n return results;\n }\n for (const name of names) {\n if (name.startsWith(\".secure-store\")) continue;\n const full = path.join(scanDir, name);\n let isDir = false;\n let isFile = false;\n try {\n const s = await lstat(full);\n if (s.isSymbolicLink()) continue;\n isDir = s.isDirectory();\n isFile = s.isFile();\n } catch {\n continue;\n }\n if (isDir) {\n const sub = await collectStorageManagedFiles(full, includeFile, scanRootDir);\n results.push(...sub);\n } else if (isFile && includeFile(full, scanRootDir)) {\n results.push(full);\n }\n }\n return results;\n}\n\nasync function resolveStorageManagedRootForScan(dir: string): Promise<string | null> {\n const lstatPath = normalizePathForLstat(dir);\n let stat: Awaited<ReturnType<typeof lstat>>;\n try {\n stat = await lstat(lstatPath);\n } catch (error) {\n if (isFsErrorWithCode(error, \"ENOENT\")) return null;\n throw error;\n }\n if (stat.isSymbolicLink()) {\n throw new Error(`secure-store migration root must not be a symlink: ${dir}`);\n }\n if (!stat.isDirectory()) {\n throw new Error(`secure-store migration root must be a directory: ${dir}`);\n }\n return lstatPath;\n}\n\nfunction normalizePathForLstat(filePath: string): string {\n return stripTrailingPathSeparators(path.normalize(filePath));\n}\n\nfunction isFsErrorWithCode(error: unknown, code: string): boolean {\n return typeof error === \"object\" && error !== null && (error as { code?: unknown }).code === code;\n}\n\nfunction stripTrailingPathSeparators(filePath: string): string {\n const root = path.parse(filePath).root;\n let end = filePath.length;\n while (\n end > root.length &&\n (filePath[end - 1] === path.sep || filePath[end - 1] === path.posix.sep || filePath[end - 1] === path.win32.sep)\n ) {\n end -= 1;\n }\n return end === filePath.length ? filePath : filePath.slice(0, end);\n}\n\nfunction isEncryptableStoragePath(filePath: string, rootDir: string): boolean {\n const rel = path.relative(rootDir, filePath);\n if (rel === \"\" || rel.startsWith(\"..\") || path.isAbsolute(rel)) return false;\n const normalized = normalizeStorageRelativePath(rel);\n if (normalized === \"profile.md\") return true;\n if (isEncryptableStateSidecar(normalized)) return true;\n if (isEncryptableSummarySidecar(normalized)) return true;\n const firstSegment = normalized.split(\"/\", 1)[0];\n return ENCRYPTABLE_MARKDOWN_STORAGE_ROOTS.has(firstSegment) && normalized.endsWith(\".md\");\n}\n\nfunction isDecryptableStoragePath(filePath: string, rootDir: string): boolean {\n if (isEncryptableStoragePath(filePath, rootDir)) return true;\n const rel = path.relative(rootDir, filePath);\n if (rel === \"\" || rel.startsWith(\"..\") || path.isAbsolute(rel)) return false;\n const normalized = normalizeStorageRelativePath(rel);\n const firstSegment = normalized.split(\"/\", 1)[0];\n return DECRYPTABLE_SIDECAR_ROOTS.has(firstSegment);\n}\n\nfunction normalizeStorageRelativePath(rel: string): string {\n const normalized = rel.split(path.sep).join(\"/\");\n const parts = normalized.split(\"/\");\n if (parts[0] === \"namespaces\" && parts.length >= 3) {\n return parts.slice(2).join(\"/\");\n }\n return normalized;\n}\n\n// Every recall MEMORY category directory (facts/ + the CATEGORY_DIR_MAP memory\n// dirs) must be encryptable at rest — #1546 routes decision/preference/moment/...\n// memories into their own dirs, so hardcoding only facts/corrections/procedures/\n// reasoning-traces would silently write those categories in plaintext on\n// encrypted stores. RECALL_FALLBACK_DIRS is the single source of truth for that\n// set; the extra non-category markdown roots (artifacts/archive/entities/\n// identity) are appended.\n//\n// questions/ is deliberately EXCLUDED (RECALL_FALLBACK_DIRS omits the non-memory\n// queue dirs): the question queue is written/resolved through plain readFile/\n// writeFile (StorageManager.writeQuestion/resolveQuestion), NOT the secure-file\n// helpers. Encrypting questions/ here would make migration seal those files,\n// after which resolveQuestion() would read ciphertext as UTF-8, fail to update\n// the frontmatter, and overwrite/corrupt the file while returning success\n// (codex #1563 review). Keeping questions/ plaintext preserves the queue's\n// existing behavior; #1546 does not change question encryption.\nconst ENCRYPTABLE_MARKDOWN_STORAGE_ROOTS = new Set<string>([\n ...RECALL_FALLBACK_DIRS,\n \"artifacts\",\n \"archive\",\n \"entities\",\n \"identity\",\n]);\n\nconst ENCRYPTABLE_STATE_SIDECARS = new Set([\n \"state/behavior-signals.jsonl\",\n \"state/buffer-surprise-ledger.jsonl\",\n \"state/buffer.json\",\n \"state/compression-guideline-draft-state.json\",\n \"state/compression-guideline-state.json\",\n \"state/compression-guidelines.draft.md\",\n \"state/compression-guidelines.md\",\n \"state/entity-synthesis-queue.json\",\n \"state/fact-hashes.txt\",\n \"state/memory-actions.jsonl\",\n \"state/memory-lifecycle-ledger.jsonl\",\n \"state/meta.json\",\n \"state/reextract-jobs.jsonl\",\n \"state/topics.json\",\n]);\n\nfunction isEncryptableStateSidecar(normalized: string): boolean {\n return ENCRYPTABLE_STATE_SIDECARS.has(normalized);\n}\n\nfunction isEncryptableSummarySidecar(normalized: string): boolean {\n return normalized.startsWith(\"summaries/\") && normalized.endsWith(\".json\");\n}\n\nconst DECRYPT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S,YAAY,CAAC;","names":["position","buffer","unlink"]}
@@ -8,13 +8,7 @@ import {
8
8
  import {
9
9
  StorageManager,
10
10
  assertInjectedStorageRooted
11
- } from "./chunk-FCDWWCLX.js";
12
- import {
13
- withHeldFileLock
14
- } from "./chunk-WL5EBRDH.js";
15
- import {
16
- displayErrorDetail
17
- } from "./chunk-RL6NEVXT.js";
11
+ } from "./chunk-RGIWINDN.js";
18
12
  import {
19
13
  MEMORY_LIFECYCLE_LEDGER_LOCK_STALE_MS,
20
14
  buildLifecycleEventsForMemory,
@@ -22,9 +16,15 @@ import {
22
16
  memoryLifecycleLedgerLockPath,
23
17
  sortMemoryLifecycleEvents
24
18
  } from "./chunk-ILGC6JH6.js";
19
+ import {
20
+ withHeldFileLock
21
+ } from "./chunk-FFAZ2XFU.js";
22
+ import {
23
+ displayErrorDetail
24
+ } from "./chunk-RL6NEVXT.js";
25
25
  import {
26
26
  probeEncryptedRegularFileHeader
27
- } from "./chunk-AIK5W3IW.js";
27
+ } from "./chunk-5TFP4CUL.js";
28
28
  import {
29
29
  log
30
30
  } from "./chunk-3WCASNQZ.js";
@@ -263,4 +263,4 @@ export {
263
263
  backupExistingLedger,
264
264
  rebuildMemoryLifecycleLedger
265
265
  };
266
- //# sourceMappingURL=chunk-EVX44I7C.js.map
266
+ //# sourceMappingURL=chunk-5W4ZLBEZ.js.map
@@ -2,7 +2,7 @@ import {
2
2
  OPERATION_NAMES,
3
3
  getOperation,
4
4
  operationRequiresAuthorizedNamespace
5
- } from "./chunk-2XC73SHY.js";
5
+ } from "./chunk-4WKA6I65.js";
6
6
  import {
7
7
  assertOperationAuthorizationAllowed
8
8
  } from "./chunk-MZWSOLMT.js";
@@ -49,4 +49,4 @@ export {
49
49
  probeOperationAuthorization,
50
50
  authorizationProbeNamespaces
51
51
  };
52
- //# sourceMappingURL=chunk-P3MH72CI.js.map
52
+ //# sourceMappingURL=chunk-62U4J2GN.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-2DQ2XREU.js";
7
7
  import {
8
8
  compareEntityTimestamps
9
- } from "./chunk-FCDWWCLX.js";
9
+ } from "./chunk-RGIWINDN.js";
10
10
  import {
11
11
  normalizeEntityName
12
12
  } from "./chunk-YXZG5TVN.js";
@@ -843,4 +843,4 @@ export {
843
843
  entityIndexVersion,
844
844
  entityRecentTranscriptLookbackHours
845
845
  };
846
- //# sourceMappingURL=chunk-YGHMSDLK.js.map
846
+ //# sourceMappingURL=chunk-66772WBP.js.map
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-LMDRGRJ2.js";
12
12
  import {
13
13
  parseConfig
14
- } from "./chunk-DRBXHRXE.js";
14
+ } from "./chunk-IB26HVAJ.js";
15
15
  import {
16
16
  resolveObjectiveStateStoreDir,
17
17
  validateObjectiveStateSnapshot
@@ -268,4 +268,4 @@ export {
268
268
  recordResumeBundle,
269
269
  getResumeBundleStatus
270
270
  };
271
- //# sourceMappingURL=chunk-EP5BVCRI.js.map
271
+ //# sourceMappingURL=chunk-6BNE62PM.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  serializeMutations,
3
3
  withHeldFileLock
4
- } from "./chunk-WL5EBRDH.js";
4
+ } from "./chunk-FFAZ2XFU.js";
5
5
  import {
6
6
  encodeStoragePathSegment,
7
7
  resolvePathInsideStorageRoot
@@ -147,4 +147,4 @@ export {
147
147
  writeSummarySnapshot,
148
148
  upsertSummarySnapshot
149
149
  };
150
- //# sourceMappingURL=chunk-AAP5T6QG.js.map
150
+ //# sourceMappingURL=chunk-6DNMUYEE.js.map
@@ -16,13 +16,13 @@ import {
16
16
  processChatMessage,
17
17
  sessionBelongsToPrincipal,
18
18
  subscribeChatTranscript
19
- } from "./chunk-ZGOQTOYA.js";
19
+ } from "./chunk-LGHKJABJ.js";
20
20
  import {
21
21
  RelayMissionStoreError
22
- } from "./chunk-QAOGGNE3.js";
22
+ } from "./chunk-ZPSVBSOF.js";
23
23
  import {
24
24
  validateRequest
25
- } from "./chunk-PKRIQL3V.js";
25
+ } from "./chunk-YTSNAUXN.js";
26
26
  import {
27
27
  executeResolution,
28
28
  isValidResolutionVerb
@@ -39,12 +39,12 @@ import {
39
39
  import {
40
40
  authorizationProbeNamespaces,
41
41
  probeOperationAuthorization
42
- } from "./chunk-P3MH72CI.js";
42
+ } from "./chunk-62U4J2GN.js";
43
43
  import {
44
44
  CorrectionContractError,
45
45
  getOperation,
46
46
  resolveQueryNamespaceWritablePreflight
47
- } from "./chunk-2XC73SHY.js";
47
+ } from "./chunk-4WKA6I65.js";
48
48
  import {
49
49
  isTrustZoneName
50
50
  } from "./chunk-JGSKJHF7.js";
@@ -64,7 +64,7 @@ import {
64
64
  OFFLINE_SYNC_APPLY_MAX_BODY_BYTES,
65
65
  OFFLINE_SYNC_FILE_CONTENT_MAX_CHUNK_BYTES,
66
66
  OFFLINE_SYNC_SNAPSHOT_BASE_MAX_BODY_BYTES
67
- } from "./chunk-E4OCKU67.js";
67
+ } from "./chunk-7XC2HX75.js";
68
68
  import {
69
69
  assertOperationAllowed,
70
70
  enforceNamespaceAllowList,
@@ -3218,4 +3218,4 @@ export {
3218
3218
  MeetingsInputError,
3219
3219
  EngramAccessHttpServer
3220
3220
  };
3221
- //# sourceMappingURL=chunk-SG265CVF.js.map
3221
+ //# sourceMappingURL=chunk-6FUPCJUL.js.map
@@ -54,12 +54,12 @@ import {
54
54
  } from "./chunk-MNB5RMAY.js";
55
55
  import {
56
56
  rebuildMemoryLifecycleLedger
57
- } from "./chunk-EVX44I7C.js";
57
+ } from "./chunk-5W4ZLBEZ.js";
58
58
  import {
59
59
  rebuildMemoryProjection,
60
60
  repairMemoryProjection,
61
61
  verifyMemoryProjection
62
- } from "./chunk-VVIW3PTA.js";
62
+ } from "./chunk-YTQNQ4KB.js";
63
63
  import {
64
64
  rebuildObservations
65
65
  } from "./chunk-DX3XRGLH.js";
@@ -77,7 +77,7 @@ import {
77
77
  } from "./chunk-HSSERO3E.js";
78
78
  import {
79
79
  searchVerifiedEpisodes
80
- } from "./chunk-KUJQHXPH.js";
80
+ } from "./chunk-2EUVEDF5.js";
81
81
  import {
82
82
  getUtilityLearningStatus,
83
83
  learnUtilityPromotionWeights
@@ -91,15 +91,15 @@ import {
91
91
  } from "./chunk-OJP3N7UK.js";
92
92
  import {
93
93
  promoteSemanticRuleFromMemory
94
- } from "./chunk-CMRQ34J5.js";
94
+ } from "./chunk-JCBWCYEJ.js";
95
95
  import {
96
96
  searchVerifiedSemanticRules
97
- } from "./chunk-4PBVXX7L.js";
97
+ } from "./chunk-TH2LSRMG.js";
98
98
  import {
99
99
  buildResumeBundleFromState,
100
100
  getResumeBundleStatus,
101
101
  recordResumeBundle
102
- } from "./chunk-EP5BVCRI.js";
102
+ } from "./chunk-6BNE62PM.js";
103
103
  import {
104
104
  getWorkProductLedgerStatus,
105
105
  recordWorkProductLedgerEntry,
@@ -132,7 +132,7 @@ import {
132
132
  runOperatorInventory,
133
133
  runOperatorRepair,
134
134
  runOperatorSetup
135
- } from "./chunk-T3GCXULH.js";
135
+ } from "./chunk-M3C2V3PV.js";
136
136
  import {
137
137
  analyzeSessionIntegrity,
138
138
  applySessionRepair,
@@ -199,11 +199,11 @@ import {
199
199
  } from "./chunk-UQ7RN5HK.js";
200
200
  import {
201
201
  parseConfig
202
- } from "./chunk-DRBXHRXE.js";
202
+ } from "./chunk-IB26HVAJ.js";
203
203
  import {
204
204
  EngramAccessHttpServer,
205
205
  MeetingsInputError
206
- } from "./chunk-SG265CVF.js";
206
+ } from "./chunk-6FUPCJUL.js";
207
207
  import {
208
208
  WearablesInputError
209
209
  } from "./chunk-V7IZKJI3.js";
@@ -216,13 +216,13 @@ import {
216
216
  createProductionChatLlmAdapter,
217
217
  loadChatSession,
218
218
  sessionBelongsToPrincipal
219
- } from "./chunk-ZGOQTOYA.js";
219
+ } from "./chunk-LGHKJABJ.js";
220
220
  import {
221
221
  getAbstractionNodeStoreStatus
222
222
  } from "./chunk-OADWQ5CR.js";
223
223
  import {
224
224
  EngramAccessService
225
- } from "./chunk-2XC73SHY.js";
225
+ } from "./chunk-4WKA6I65.js";
226
226
  import {
227
227
  WorkStorage
228
228
  } from "./chunk-GDB4J2H3.js";
@@ -245,7 +245,7 @@ import {
245
245
  readMemoryGovernanceRunArtifact,
246
246
  restoreMemoryGovernanceRun,
247
247
  runMemoryGovernance
248
- } from "./chunk-GGUBDXRR.js";
248
+ } from "./chunk-W5EG6LE3.js";
249
249
  import {
250
250
  getObjectiveStateStoreStatus
251
251
  } from "./chunk-6HMYUWXR.js";
@@ -253,7 +253,7 @@ import {
253
253
  listNamespaces,
254
254
  runNamespaceMigration,
255
255
  verifyNamespaces
256
- } from "./chunk-NBDCZWP4.js";
256
+ } from "./chunk-I5NLEENJ.js";
257
257
  import {
258
258
  renderQmdBacklogStatus
259
259
  } from "./chunk-IUM3VSHI.js";
@@ -262,7 +262,7 @@ import {
262
262
  } from "./chunk-L2DPF4DF.js";
263
263
  import {
264
264
  meetingIdDate
265
- } from "./chunk-FCDWWCLX.js";
265
+ } from "./chunk-RGIWINDN.js";
266
266
  import {
267
267
  isValidTranscriptDate
268
268
  } from "./chunk-UHVXE24Y.js";
@@ -272,7 +272,7 @@ import {
272
272
  } from "./chunk-HUHX2OCX.js";
273
273
  import {
274
274
  STATE_FILE_MAX_DECRYPT_BYTES
275
- } from "./chunk-OFHFH655.js";
275
+ } from "./chunk-MJCGLM25.js";
276
276
  import {
277
277
  assertPathInsideRoot
278
278
  } from "./chunk-GCASGYIO.js";
@@ -325,7 +325,7 @@ import {
325
325
  import {
326
326
  SECURE_STORE_ENVELOPE_OVERHEAD_BYTES,
327
327
  probeEncryptedRegularFileHeader
328
- } from "./chunk-AIK5W3IW.js";
328
+ } from "./chunk-5TFP4CUL.js";
329
329
  import {
330
330
  RECALL_FALLBACK_DIRS
331
331
  } from "./chunk-VS2IYZRU.js";
@@ -4017,7 +4017,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
4017
4017
  const idArg = typeof args[0] === "string" ? args[0] : "";
4018
4018
  const options = args[1] ?? {};
4019
4019
  const reason = typeof options.reason === "string" && options.reason.trim().length > 0 ? options.reason.trim() : void 0;
4020
- const { forgetMemory } = await import("./forget-HRPLVB3W.js");
4020
+ const { forgetMemory } = await import("./forget-4UY2EOKH.js");
4021
4021
  try {
4022
4022
  const result = await forgetMemory(orchestrator.storage, {
4023
4023
  id: idArg,
@@ -4110,7 +4110,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
4110
4110
  }
4111
4111
  const confirmed = confirmValue === "yes";
4112
4112
  const dryRun = hasDryRunFlag || !confirmed;
4113
- const { purgeMemories } = await import("./purge-YSGX5BOG.js");
4113
+ const { purgeMemories } = await import("./purge-533FZLS4.js");
4114
4114
  try {
4115
4115
  const result = await purgeMemories({
4116
4116
  storage: orchestrator.storage,
@@ -7981,4 +7981,4 @@ export {
7981
7981
  listMemoryMarkdownFilePaths,
7982
7982
  registerCli
7983
7983
  };
7984
- //# sourceMappingURL=chunk-WZ7UB7XQ.js.map
7984
+ //# sourceMappingURL=chunk-6U7F52DE.js.map
@@ -16,7 +16,7 @@ import {
16
16
  import {
17
17
  MAGIC_HEADER_SIZE,
18
18
  isEncryptedFile
19
- } from "./chunk-AIK5W3IW.js";
19
+ } from "./chunk-5TFP4CUL.js";
20
20
 
21
21
  // src/offline-sync.ts
22
22
  import { createHash, randomUUID } from "crypto";
@@ -1760,4 +1760,4 @@ export {
1760
1760
  normalizeOfflineSyncState,
1761
1761
  fileStatesFromSnapshot
1762
1762
  };
1763
- //# sourceMappingURL=chunk-E4OCKU67.js.map
1763
+ //# sourceMappingURL=chunk-7XC2HX75.js.map
@@ -2,7 +2,7 @@ import {
2
2
  readSummarySnapshot,
3
3
  upsertSummarySnapshot,
4
4
  writeSummarySnapshot
5
- } from "./chunk-AAP5T6QG.js";
5
+ } from "./chunk-6DNMUYEE.js";
6
6
  import {
7
7
  ModelRegistry
8
8
  } from "./chunk-WLZYGLJ4.js";
@@ -690,4 +690,4 @@ ${truncatedConversation}`;
690
690
  export {
691
691
  HourlySummarizer
692
692
  };
693
- //# sourceMappingURL=chunk-OVRQLAYR.js.map
693
+ //# sourceMappingURL=chunk-AZ5BTEKX.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  StorageManager
3
- } from "./chunk-FCDWWCLX.js";
3
+ } from "./chunk-RGIWINDN.js";
4
4
  import {
5
5
  serializeMutations
6
- } from "./chunk-WL5EBRDH.js";
6
+ } from "./chunk-FFAZ2XFU.js";
7
7
  import {
8
8
  normalizeEntityName
9
9
  } from "./chunk-YXZG5TVN.js";
@@ -958,4 +958,4 @@ export {
958
958
  resolveBriefingSaveDir,
959
959
  briefingFilename
960
960
  };
961
- //# sourceMappingURL=chunk-2HNUMF5V.js.map
961
+ //# sourceMappingURL=chunk-CZRYLSSW.js.map