@remnic/core 10.0.14 → 10.0.15

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 (355) hide show
  1. package/dist/abstraction-nodes.js +3 -2
  2. package/dist/access-admin-ops-surface.js +33 -31
  3. package/dist/access-authorization-probe.js +34 -32
  4. package/dist/access-boundary.js +33 -31
  5. package/dist/access-cli.js +87 -85
  6. package/dist/access-cli.js.map +1 -1
  7. package/dist/access-extraction-force-flush.js +33 -31
  8. package/dist/access-http-briefing.js +34 -32
  9. package/dist/access-http-query.js +35 -33
  10. package/dist/access-http.js +52 -50
  11. package/dist/access-identity-continuity-surface.js +33 -31
  12. package/dist/access-lcm-surface.js +33 -31
  13. package/dist/access-mcp.js +44 -42
  14. package/dist/access-namespace-preflight.js +33 -31
  15. package/dist/access-observe-write-category.js +4 -3
  16. package/dist/access-observe-write-surface.js +33 -31
  17. package/dist/access-offline-manifest.js +3 -2
  18. package/dist/access-operations-batch.js +36 -34
  19. package/dist/access-operations.js +43 -41
  20. package/dist/access-recall-concurrency.js +33 -31
  21. package/dist/access-recall-response.js +33 -31
  22. package/dist/access-recall-surface.js +33 -31
  23. package/dist/access-schema.js +3 -2
  24. package/dist/access-service.js +33 -31
  25. package/dist/access-surface-catalog.js +35 -33
  26. package/dist/access-surface-catalog.js.map +1 -1
  27. package/dist/active-recall.js +14 -12
  28. package/dist/active-recall.js.map +1 -1
  29. package/dist/briefing.js +10 -8
  30. package/dist/calibration.d.ts.map +1 -1
  31. package/dist/calibration.js +6 -3
  32. package/dist/calibration.js.map +1 -1
  33. package/dist/causal-behavior.js +4 -3
  34. package/dist/causal-behavior.js.map +1 -1
  35. package/dist/causal-chain.js +4 -3
  36. package/dist/causal-consolidation.js +14 -12
  37. package/dist/causal-consolidation.js.map +1 -1
  38. package/dist/causal-retrieval.js +4 -3
  39. package/dist/causal-retrieval.js.map +1 -1
  40. package/dist/causal-trajectory.js +3 -2
  41. package/dist/{chunk-J7JWFZHI.js → chunk-22RM2ZUJ.js} +37 -37
  42. package/dist/{chunk-63B2IZYE.js → chunk-23ZQPP2G.js} +6 -1
  43. package/dist/chunk-23ZQPP2G.js.map +1 -0
  44. package/dist/{chunk-YFMBHQRG.js → chunk-2PTH4PRL.js} +2 -2
  45. package/dist/{chunk-TITG2NBS.js → chunk-2PYHLSXK.js} +2 -2
  46. package/dist/{chunk-B6O2YLUR.js → chunk-2Z5DIDQD.js} +6 -1
  47. package/dist/chunk-2Z5DIDQD.js.map +1 -0
  48. package/dist/{chunk-KH2LKDX7.js → chunk-33G67YZF.js} +2 -2
  49. package/dist/{chunk-LCKVXX5F.js → chunk-3GNIJUUE.js} +2 -2
  50. package/dist/{chunk-SWIKABKI.js → chunk-3Q3XD3NO.js} +2 -2
  51. package/dist/{chunk-4KY5GSMB.js → chunk-4PDTVVSW.js} +2 -2
  52. package/dist/{chunk-HM7RHKS4.js → chunk-4RNBLLZR.js} +2 -2
  53. package/dist/{chunk-PAZ35RJ4.js → chunk-4SCZZ3U7.js} +240 -55
  54. package/dist/chunk-4SCZZ3U7.js.map +1 -0
  55. package/dist/{chunk-Y4NKEXQT.js → chunk-5ATSXCAG.js} +3 -3
  56. package/dist/{chunk-JDZFIR2S.js → chunk-5KGYTX5O.js} +2 -2
  57. package/dist/{chunk-NW2E4CI2.js → chunk-5SMR542T.js} +2 -2
  58. package/dist/{chunk-S7LWX2PQ.js → chunk-655FVTCD.js} +2 -2
  59. package/dist/{chunk-ZSH2NRDV.js → chunk-6WGMZQGG.js} +2 -2
  60. package/dist/{chunk-W47S5TIH.js → chunk-7VQ6AI7H.js} +2 -2
  61. package/dist/{chunk-G7NYVKD6.js → chunk-B2NXOVZN.js} +2 -2
  62. package/dist/{chunk-N7KYEVLK.js → chunk-BK2BVLZW.js} +2 -2
  63. package/dist/{chunk-QJ622LTI.js → chunk-BQOGQULP.js} +30 -8
  64. package/dist/chunk-BQOGQULP.js.map +1 -0
  65. package/dist/{chunk-S2I7DL5Q.js → chunk-C2RW36YR.js} +2 -2
  66. package/dist/{chunk-P5NQN4JE.js → chunk-C6JMGAMO.js} +6 -2
  67. package/dist/chunk-C6JMGAMO.js.map +1 -0
  68. package/dist/{chunk-6LG7BWKW.js → chunk-CFZ4SXXH.js} +2 -2
  69. package/dist/{chunk-BLVHDY2U.js → chunk-DOWACHYO.js} +5 -2
  70. package/dist/chunk-DOWACHYO.js.map +1 -0
  71. package/dist/{chunk-4OSG5Y6M.js → chunk-DPSOFK4D.js} +2 -2
  72. package/dist/{chunk-QOZJCSFO.js → chunk-DQR2LD3V.js} +2 -2
  73. package/dist/{chunk-EBA5DA77.js → chunk-EOU6V4IN.js} +2 -2
  74. package/dist/{chunk-5WCJLQTM.js → chunk-F2772ATT.js} +2 -2
  75. package/dist/{chunk-46EST7JO.js → chunk-F2XNSIPP.js} +2 -2
  76. package/dist/{chunk-PZHQWFR3.js → chunk-G3UUAQOD.js} +2 -2
  77. package/dist/{chunk-YE36AJL7.js → chunk-GCVDFX66.js} +2 -2
  78. package/dist/{chunk-FFOVKNQV.js → chunk-GFAM2LTC.js} +2 -2
  79. package/dist/{chunk-T2YX56QI.js → chunk-GQJKVQJR.js} +2 -2
  80. package/dist/{chunk-L5DAHSEZ.js → chunk-GWVNGDJW.js} +2 -2
  81. package/dist/{chunk-N45NEBOD.js → chunk-GZXXPCWJ.js} +3 -3
  82. package/dist/{chunk-EPJDSQHF.js → chunk-H5IUN433.js} +2 -2
  83. package/dist/{chunk-EUAIYYYR.js → chunk-H6FREOYX.js} +7 -7
  84. package/dist/{chunk-FSIMZNBC.js → chunk-HBAOOSHU.js} +2 -2
  85. package/dist/{chunk-Q4E24IRR.js → chunk-HDN7IVIO.js} +14 -11
  86. package/dist/chunk-HDN7IVIO.js.map +1 -0
  87. package/dist/{chunk-T3FMRLWQ.js → chunk-HFSPY26A.js} +2 -2
  88. package/dist/{chunk-GH7AOMJD.js → chunk-IJMDBYCO.js} +2 -2
  89. package/dist/{chunk-JQ7XU625.js → chunk-IUCPLBDS.js} +6 -6
  90. package/dist/{chunk-WSGPFRBH.js → chunk-IWD33CF4.js} +2 -2
  91. package/dist/{chunk-4IHBN6WU.js → chunk-JKMIGCK6.js} +2 -2
  92. package/dist/{chunk-ROBHL3GL.js → chunk-JWX2Q6HS.js} +2 -2
  93. package/dist/{chunk-4O6WRBGE.js → chunk-KJXP6RUG.js} +5 -1
  94. package/dist/chunk-KJXP6RUG.js.map +1 -0
  95. package/dist/{chunk-JIHMUOOS.js → chunk-KLJVTZ3R.js} +3 -3
  96. package/dist/{chunk-FP4JYE66.js → chunk-KW4AJ7T3.js} +2 -2
  97. package/dist/{chunk-NIRQGDYC.js → chunk-L5VCT7LU.js} +5 -1
  98. package/dist/chunk-L5VCT7LU.js.map +1 -0
  99. package/dist/{chunk-LS2FHUML.js → chunk-LQ5SS4OP.js} +3 -3
  100. package/dist/{chunk-SIIRTDJ4.js → chunk-LWFWZTWX.js} +2 -2
  101. package/dist/{chunk-BMWN7B3Y.js → chunk-LXATZLSC.js} +3 -3
  102. package/dist/{chunk-B665A6BO.js → chunk-MJIOGYKX.js} +2 -2
  103. package/dist/{chunk-RTKV5XHL.js → chunk-MO6N4QYY.js} +2 -2
  104. package/dist/{chunk-N4C7QKOG.js → chunk-MWWAQXZ6.js} +2 -2
  105. package/dist/{chunk-ZJVMUBYF.js → chunk-NHUX6GXA.js} +6 -6
  106. package/dist/{chunk-CB6ANA2I.js → chunk-NZCKG25S.js} +2 -2
  107. package/dist/{chunk-UMTCNEVQ.js → chunk-O2YPCFJT.js} +11 -11
  108. package/dist/{chunk-TZNDKTX5.js → chunk-OQR42XCN.js} +37 -33
  109. package/dist/chunk-OQR42XCN.js.map +1 -0
  110. package/dist/{chunk-JYZSRNR7.js → chunk-PIITB2YZ.js} +2 -2
  111. package/dist/chunk-PPUNC7UX.js +73 -0
  112. package/dist/chunk-PPUNC7UX.js.map +1 -0
  113. package/dist/{chunk-EQWEIIKQ.js → chunk-PQM3B54K.js} +6 -1
  114. package/dist/chunk-PQM3B54K.js.map +1 -0
  115. package/dist/{chunk-UQDG3YLN.js → chunk-PRU7OF3Y.js} +3 -3
  116. package/dist/{chunk-EU534WGS.js → chunk-PVHQSLNN.js} +7 -7
  117. package/dist/{chunk-5VC7J76U.js → chunk-QPH52AZB.js} +2 -2
  118. package/dist/{chunk-XISROV24.js → chunk-QSEUUQUF.js} +2 -2
  119. package/dist/chunk-QUIRIG2P.js +31 -0
  120. package/dist/chunk-QUIRIG2P.js.map +1 -0
  121. package/dist/{chunk-FUFAXVBA.js → chunk-RI2KCQHP.js} +6 -2
  122. package/dist/chunk-RI2KCQHP.js.map +1 -0
  123. package/dist/{chunk-QX6JN3O4.js → chunk-RP7PQWZM.js} +6 -6
  124. package/dist/{chunk-O2IPAX26.js → chunk-RTTPBBAN.js} +4 -4
  125. package/dist/{chunk-W5MCEVUS.js → chunk-RYYVMZBR.js} +2 -2
  126. package/dist/{chunk-WLMZ2L5P.js → chunk-T7ASDYNK.js} +2 -2
  127. package/dist/{chunk-P7TOIOT7.js → chunk-THEPGZBM.js} +2 -2
  128. package/dist/{chunk-QODKDRSP.js → chunk-TMC7HBED.js} +4 -4
  129. package/dist/{chunk-I7S55EOB.js → chunk-TPNCXSXP.js} +2 -2
  130. package/dist/{chunk-SS3IS2JR.js → chunk-UGYUBENJ.js} +2 -2
  131. package/dist/{chunk-GELS5Z5Z.js → chunk-V3TXIXXY.js} +3 -3
  132. package/dist/{chunk-WVADKFWV.js → chunk-VNZMZPAC.js} +2 -2
  133. package/dist/{chunk-JPTPS4OB.js → chunk-VPXIKBPX.js} +2 -2
  134. package/dist/{chunk-OP6N4H6A.js → chunk-W3FVQBGF.js} +2 -2
  135. package/dist/{chunk-DPR2WTN3.js → chunk-WGTR573G.js} +16 -16
  136. package/dist/{chunk-W3K3HITK.js → chunk-WLT6LTQP.js} +2 -2
  137. package/dist/{chunk-GMXWTJNU.js → chunk-XKRXN63M.js} +2 -2
  138. package/dist/{chunk-ZV65I6ME.js → chunk-XLBFX63V.js} +28 -25
  139. package/dist/chunk-XLBFX63V.js.map +1 -0
  140. package/dist/{chunk-KR6ZKECI.js → chunk-XYGQSDTH.js} +3 -3
  141. package/dist/{chunk-6WHJ2EAB.js → chunk-Z64TS5V4.js} +2 -2
  142. package/dist/{chunk-NHLLKEKK.js → chunk-ZAJLJ35W.js} +2 -2
  143. package/dist/{chunk-O4SGYW7H.js → chunk-ZKHSAMTE.js} +2 -2
  144. package/dist/cli.d.ts.map +1 -1
  145. package/dist/cli.js +72 -70
  146. package/dist/coding/export-okf-codegraph.js +9 -7
  147. package/dist/coding/export-okf-codegraph.js.map +1 -1
  148. package/dist/coding/pre-action-gate.js +4 -3
  149. package/dist/commitment-ledger.js +3 -2
  150. package/dist/compounding/engine.js +11 -9
  151. package/dist/config.js +14 -12
  152. package/dist/connectors/codex-materialize-runner.js +10 -8
  153. package/dist/connectors/index.js +10 -8
  154. package/dist/consolidation-provenance-check.d.ts.map +1 -1
  155. package/dist/consolidation-provenance-check.js +2 -1
  156. package/dist/contradiction/index.js +3 -2
  157. package/dist/convergence-refresh.js +12 -10
  158. package/dist/corpus-watermark.js +12 -10
  159. package/dist/correction/correction-planner.d.ts.map +1 -1
  160. package/dist/cue-anchors.js +4 -3
  161. package/dist/deep-recall-http-glue.js +4 -3
  162. package/dist/{dreams-ledger-567VKVOU.js → dreams-ledger-UCHHRQ4R.js} +3 -2
  163. package/dist/entity-retrieval.js +10 -8
  164. package/dist/eval-trajectory-store.js +4 -3
  165. package/dist/eval-trajectory.js +4 -3
  166. package/dist/evals.js +3 -2
  167. package/dist/external-wiki-access.js +34 -32
  168. package/dist/extraction.js +12 -10
  169. package/dist/{first-start-migration-6A5BJPDW.js → first-start-migration-QVD22WWS.js} +6 -5
  170. package/dist/{first-start-migration-6A5BJPDW.js.map → first-start-migration-QVD22WWS.js.map} +1 -1
  171. package/dist/harmonic-construction.js +5 -4
  172. package/dist/harmonic-retrieval.js +14 -12
  173. package/dist/harmonic-source-lookup.js +3 -2
  174. package/dist/index.js +87 -85
  175. package/dist/json-store.d.ts.map +1 -1
  176. package/dist/json-store.js +2 -1
  177. package/dist/location/index.js +12 -10
  178. package/dist/maintenance/dreams-ledger.d.ts.map +1 -1
  179. package/dist/maintenance/memory-governance.d.ts.map +1 -1
  180. package/dist/maintenance/memory-governance.js +10 -8
  181. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +10 -8
  182. package/dist/maintenance/rebuild-memory-projection-runner.js +12 -10
  183. package/dist/maintenance/rebuild-memory-projection.js +11 -9
  184. package/dist/memory-browse-operations.js +34 -32
  185. package/dist/namespaces/migrate.js +11 -9
  186. package/dist/namespaces/search.js +7 -6
  187. package/dist/namespaces/storage.d.ts.map +1 -1
  188. package/dist/namespaces/storage.js +10 -8
  189. package/dist/objective-state-writers.js +4 -3
  190. package/dist/objective-state.js +3 -2
  191. package/dist/offline-sync-snapshot-stream.js +3 -2
  192. package/dist/offline-sync.d.ts.map +1 -1
  193. package/dist/offline-sync.js +2 -1
  194. package/dist/operator-doctor-corpus.js +13 -11
  195. package/dist/operator-toolkit.js +25 -23
  196. package/dist/orchestration/maintenance.js +20 -18
  197. package/dist/orchestrator.js +87 -85
  198. package/dist/profiling.d.ts.map +1 -1
  199. package/dist/profiling.js +2 -1
  200. package/dist/recall-navigation-operations.js +34 -32
  201. package/dist/recall-navigation.js +33 -31
  202. package/dist/{resolution-7AY36LGJ.js → resolution-ZU5BIAJA.js} +4 -3
  203. package/dist/resume-bundles.js +19 -17
  204. package/dist/retrieval-agents.d.ts +1 -1
  205. package/dist/retrieval-agents.d.ts.map +1 -1
  206. package/dist/retrieval-agents.js +7 -1
  207. package/dist/search/document-scanner.d.ts.map +1 -1
  208. package/dist/search/document-scanner.js +2 -1
  209. package/dist/search/factory.js +6 -5
  210. package/dist/search/index.js +6 -5
  211. package/dist/search/lancedb-backend.js +3 -2
  212. package/dist/search/meilisearch-backend.js +3 -2
  213. package/dist/search/orama-backend.js +3 -2
  214. package/dist/semantic-consolidation.js +11 -9
  215. package/dist/semantic-rule-promotion.js +10 -8
  216. package/dist/semantic-rule-verifier.js +10 -8
  217. package/dist/source-agent-qualifier.js +10 -8
  218. package/dist/standup/build.js +10 -8
  219. package/dist/storage/entity-canonical-id-migration.d.ts.map +1 -1
  220. package/dist/storage/entity-store.d.ts +32 -1
  221. package/dist/storage/entity-store.d.ts.map +1 -1
  222. package/dist/storage/memory-read-store.d.ts.map +1 -1
  223. package/dist/storage/supersession-audit.d.ts.map +1 -1
  224. package/dist/storage.d.ts.map +1 -1
  225. package/dist/storage.js +9 -7
  226. package/dist/support-passport/index.js +36 -34
  227. package/dist/{tier-stats-RQM76XYY.js → tier-stats-C3IAMS4X.js} +6 -5
  228. package/dist/{tier-stats-RQM76XYY.js.map → tier-stats-C3IAMS4X.js.map} +1 -1
  229. package/dist/transcript.d.ts.map +1 -1
  230. package/dist/transcript.js +2 -1
  231. package/dist/transfer/export-okf.js +10 -8
  232. package/dist/trust-zones.js +3 -2
  233. package/dist/utility-learner.js +4 -3
  234. package/dist/utility-runtime.js +5 -4
  235. package/dist/utility-telemetry.js +3 -2
  236. package/dist/utils/macos-replication-junk.d.ts +32 -0
  237. package/dist/utils/macos-replication-junk.d.ts.map +1 -0
  238. package/dist/utils/malformed-entity-record.d.ts +24 -0
  239. package/dist/utils/malformed-entity-record.d.ts.map +1 -0
  240. package/dist/verified-recall.js +10 -8
  241. package/dist/who-knows-cli.js +11 -9
  242. package/dist/who-knows.js +10 -8
  243. package/dist/work-product-ledger.js +3 -2
  244. package/package.json +2 -2
  245. package/src/calibration.ts +3 -2
  246. package/src/cli.ts +2 -2
  247. package/src/consolidation-provenance-check.ts +2 -0
  248. package/src/correction/correction-planner.ts +3 -2
  249. package/src/json-store.ts +3 -0
  250. package/src/macos-replication-junk-scanners.test.ts +275 -0
  251. package/src/maintenance/dreams-ledger.ts +2 -0
  252. package/src/maintenance/memory-governance.ts +2 -0
  253. package/src/namespaces/storage.ts +2 -0
  254. package/src/offline-sync-macos-junk.test.ts +169 -0
  255. package/src/offline-sync.ts +7 -0
  256. package/src/profiling.ts +2 -1
  257. package/src/retrieval-agents.ts +29 -12
  258. package/src/search/document-scanner.ts +4 -0
  259. package/src/storage/entity-canonical-id-migration.ts +56 -13
  260. package/src/storage/entity-store.ts +173 -15
  261. package/src/storage/memory-read-store.ts +30 -5
  262. package/src/storage/supersession-audit.ts +2 -0
  263. package/src/storage.ts +3 -2
  264. package/src/transcript.ts +11 -10
  265. package/src/utils/macos-replication-junk.test.ts +46 -0
  266. package/src/utils/macos-replication-junk.ts +65 -0
  267. package/src/utils/malformed-entity-record.ts +101 -0
  268. package/dist/chunk-4O6WRBGE.js.map +0 -1
  269. package/dist/chunk-63B2IZYE.js.map +0 -1
  270. package/dist/chunk-B6O2YLUR.js.map +0 -1
  271. package/dist/chunk-BLVHDY2U.js.map +0 -1
  272. package/dist/chunk-EQWEIIKQ.js.map +0 -1
  273. package/dist/chunk-FUFAXVBA.js.map +0 -1
  274. package/dist/chunk-NIRQGDYC.js.map +0 -1
  275. package/dist/chunk-P5NQN4JE.js.map +0 -1
  276. package/dist/chunk-PAZ35RJ4.js.map +0 -1
  277. package/dist/chunk-Q4E24IRR.js.map +0 -1
  278. package/dist/chunk-QJ622LTI.js.map +0 -1
  279. package/dist/chunk-TZNDKTX5.js.map +0 -1
  280. package/dist/chunk-ZV65I6ME.js.map +0 -1
  281. /package/dist/{chunk-J7JWFZHI.js.map → chunk-22RM2ZUJ.js.map} +0 -0
  282. /package/dist/{chunk-YFMBHQRG.js.map → chunk-2PTH4PRL.js.map} +0 -0
  283. /package/dist/{chunk-TITG2NBS.js.map → chunk-2PYHLSXK.js.map} +0 -0
  284. /package/dist/{chunk-KH2LKDX7.js.map → chunk-33G67YZF.js.map} +0 -0
  285. /package/dist/{chunk-LCKVXX5F.js.map → chunk-3GNIJUUE.js.map} +0 -0
  286. /package/dist/{chunk-SWIKABKI.js.map → chunk-3Q3XD3NO.js.map} +0 -0
  287. /package/dist/{chunk-4KY5GSMB.js.map → chunk-4PDTVVSW.js.map} +0 -0
  288. /package/dist/{chunk-HM7RHKS4.js.map → chunk-4RNBLLZR.js.map} +0 -0
  289. /package/dist/{chunk-Y4NKEXQT.js.map → chunk-5ATSXCAG.js.map} +0 -0
  290. /package/dist/{chunk-JDZFIR2S.js.map → chunk-5KGYTX5O.js.map} +0 -0
  291. /package/dist/{chunk-NW2E4CI2.js.map → chunk-5SMR542T.js.map} +0 -0
  292. /package/dist/{chunk-S7LWX2PQ.js.map → chunk-655FVTCD.js.map} +0 -0
  293. /package/dist/{chunk-ZSH2NRDV.js.map → chunk-6WGMZQGG.js.map} +0 -0
  294. /package/dist/{chunk-W47S5TIH.js.map → chunk-7VQ6AI7H.js.map} +0 -0
  295. /package/dist/{chunk-G7NYVKD6.js.map → chunk-B2NXOVZN.js.map} +0 -0
  296. /package/dist/{chunk-N7KYEVLK.js.map → chunk-BK2BVLZW.js.map} +0 -0
  297. /package/dist/{chunk-S2I7DL5Q.js.map → chunk-C2RW36YR.js.map} +0 -0
  298. /package/dist/{chunk-6LG7BWKW.js.map → chunk-CFZ4SXXH.js.map} +0 -0
  299. /package/dist/{chunk-4OSG5Y6M.js.map → chunk-DPSOFK4D.js.map} +0 -0
  300. /package/dist/{chunk-QOZJCSFO.js.map → chunk-DQR2LD3V.js.map} +0 -0
  301. /package/dist/{chunk-EBA5DA77.js.map → chunk-EOU6V4IN.js.map} +0 -0
  302. /package/dist/{chunk-5WCJLQTM.js.map → chunk-F2772ATT.js.map} +0 -0
  303. /package/dist/{chunk-46EST7JO.js.map → chunk-F2XNSIPP.js.map} +0 -0
  304. /package/dist/{chunk-PZHQWFR3.js.map → chunk-G3UUAQOD.js.map} +0 -0
  305. /package/dist/{chunk-YE36AJL7.js.map → chunk-GCVDFX66.js.map} +0 -0
  306. /package/dist/{chunk-FFOVKNQV.js.map → chunk-GFAM2LTC.js.map} +0 -0
  307. /package/dist/{chunk-T2YX56QI.js.map → chunk-GQJKVQJR.js.map} +0 -0
  308. /package/dist/{chunk-L5DAHSEZ.js.map → chunk-GWVNGDJW.js.map} +0 -0
  309. /package/dist/{chunk-N45NEBOD.js.map → chunk-GZXXPCWJ.js.map} +0 -0
  310. /package/dist/{chunk-EPJDSQHF.js.map → chunk-H5IUN433.js.map} +0 -0
  311. /package/dist/{chunk-EUAIYYYR.js.map → chunk-H6FREOYX.js.map} +0 -0
  312. /package/dist/{chunk-FSIMZNBC.js.map → chunk-HBAOOSHU.js.map} +0 -0
  313. /package/dist/{chunk-T3FMRLWQ.js.map → chunk-HFSPY26A.js.map} +0 -0
  314. /package/dist/{chunk-GH7AOMJD.js.map → chunk-IJMDBYCO.js.map} +0 -0
  315. /package/dist/{chunk-JQ7XU625.js.map → chunk-IUCPLBDS.js.map} +0 -0
  316. /package/dist/{chunk-WSGPFRBH.js.map → chunk-IWD33CF4.js.map} +0 -0
  317. /package/dist/{chunk-4IHBN6WU.js.map → chunk-JKMIGCK6.js.map} +0 -0
  318. /package/dist/{chunk-ROBHL3GL.js.map → chunk-JWX2Q6HS.js.map} +0 -0
  319. /package/dist/{chunk-JIHMUOOS.js.map → chunk-KLJVTZ3R.js.map} +0 -0
  320. /package/dist/{chunk-FP4JYE66.js.map → chunk-KW4AJ7T3.js.map} +0 -0
  321. /package/dist/{chunk-LS2FHUML.js.map → chunk-LQ5SS4OP.js.map} +0 -0
  322. /package/dist/{chunk-SIIRTDJ4.js.map → chunk-LWFWZTWX.js.map} +0 -0
  323. /package/dist/{chunk-BMWN7B3Y.js.map → chunk-LXATZLSC.js.map} +0 -0
  324. /package/dist/{chunk-B665A6BO.js.map → chunk-MJIOGYKX.js.map} +0 -0
  325. /package/dist/{chunk-RTKV5XHL.js.map → chunk-MO6N4QYY.js.map} +0 -0
  326. /package/dist/{chunk-N4C7QKOG.js.map → chunk-MWWAQXZ6.js.map} +0 -0
  327. /package/dist/{chunk-ZJVMUBYF.js.map → chunk-NHUX6GXA.js.map} +0 -0
  328. /package/dist/{chunk-CB6ANA2I.js.map → chunk-NZCKG25S.js.map} +0 -0
  329. /package/dist/{chunk-UMTCNEVQ.js.map → chunk-O2YPCFJT.js.map} +0 -0
  330. /package/dist/{chunk-JYZSRNR7.js.map → chunk-PIITB2YZ.js.map} +0 -0
  331. /package/dist/{chunk-UQDG3YLN.js.map → chunk-PRU7OF3Y.js.map} +0 -0
  332. /package/dist/{chunk-EU534WGS.js.map → chunk-PVHQSLNN.js.map} +0 -0
  333. /package/dist/{chunk-5VC7J76U.js.map → chunk-QPH52AZB.js.map} +0 -0
  334. /package/dist/{chunk-XISROV24.js.map → chunk-QSEUUQUF.js.map} +0 -0
  335. /package/dist/{chunk-QX6JN3O4.js.map → chunk-RP7PQWZM.js.map} +0 -0
  336. /package/dist/{chunk-O2IPAX26.js.map → chunk-RTTPBBAN.js.map} +0 -0
  337. /package/dist/{chunk-W5MCEVUS.js.map → chunk-RYYVMZBR.js.map} +0 -0
  338. /package/dist/{chunk-WLMZ2L5P.js.map → chunk-T7ASDYNK.js.map} +0 -0
  339. /package/dist/{chunk-P7TOIOT7.js.map → chunk-THEPGZBM.js.map} +0 -0
  340. /package/dist/{chunk-QODKDRSP.js.map → chunk-TMC7HBED.js.map} +0 -0
  341. /package/dist/{chunk-I7S55EOB.js.map → chunk-TPNCXSXP.js.map} +0 -0
  342. /package/dist/{chunk-SS3IS2JR.js.map → chunk-UGYUBENJ.js.map} +0 -0
  343. /package/dist/{chunk-GELS5Z5Z.js.map → chunk-V3TXIXXY.js.map} +0 -0
  344. /package/dist/{chunk-WVADKFWV.js.map → chunk-VNZMZPAC.js.map} +0 -0
  345. /package/dist/{chunk-JPTPS4OB.js.map → chunk-VPXIKBPX.js.map} +0 -0
  346. /package/dist/{chunk-OP6N4H6A.js.map → chunk-W3FVQBGF.js.map} +0 -0
  347. /package/dist/{chunk-DPR2WTN3.js.map → chunk-WGTR573G.js.map} +0 -0
  348. /package/dist/{chunk-W3K3HITK.js.map → chunk-WLT6LTQP.js.map} +0 -0
  349. /package/dist/{chunk-GMXWTJNU.js.map → chunk-XKRXN63M.js.map} +0 -0
  350. /package/dist/{chunk-KR6ZKECI.js.map → chunk-XYGQSDTH.js.map} +0 -0
  351. /package/dist/{chunk-6WHJ2EAB.js.map → chunk-Z64TS5V4.js.map} +0 -0
  352. /package/dist/{chunk-NHLLKEKK.js.map → chunk-ZAJLJ35W.js.map} +0 -0
  353. /package/dist/{chunk-O4SGYW7H.js.map → chunk-ZKHSAMTE.js.map} +0 -0
  354. /package/dist/{dreams-ledger-567VKVOU.js.map → dreams-ledger-UCHHRQ4R.js.map} +0 -0
  355. /package/dist/{resolution-7AY36LGJ.js.map → resolution-ZU5BIAJA.js.map} +0 -0
@@ -17,10 +17,14 @@ import {
17
17
  } from "./chunk-TRMJ6BYC.js";
18
18
  import {
19
19
  normalizeQmdResultPath
20
- } from "./chunk-N4C7QKOG.js";
20
+ } from "./chunk-MWWAQXZ6.js";
21
21
  import {
22
22
  withholdToolScopedFromSharedNamespace
23
23
  } from "./chunk-S2V7RUCL.js";
24
+ import {
25
+ isMalformedEntityRecord,
26
+ isPopulatedUnnamedEntityRecord
27
+ } from "./chunk-PPUNC7UX.js";
24
28
  import {
25
29
  parseOfflineSyncDigestCache
26
30
  } from "./chunk-X3724WL4.js";
@@ -241,6 +245,11 @@ import {
241
245
  isAbortError,
242
246
  raceAbort
243
247
  } from "./chunk-BTTPKDIL.js";
248
+ import {
249
+ isMacOsReplicationJunkBasename,
250
+ warnIgnoredMacOsReplicationJunk,
251
+ withoutMacOsReplicationJunk
252
+ } from "./chunk-QUIRIG2P.js";
244
253
  import {
245
254
  isPathInsideStorageRoot,
246
255
  resolveSafeStoragePath
@@ -269,10 +278,10 @@ import {
269
278
 
270
279
  // src/storage.ts
271
280
  import {
272
- lstat as lstat3,
281
+ lstat as lstat4,
273
282
  readdir as readdir6,
274
283
  readFile as readFile2,
275
- realpath as realpath3,
284
+ realpath as realpath4,
276
285
  stat as stat3,
277
286
  writeFile as writeFile2,
278
287
  mkdir,
@@ -438,6 +447,12 @@ function isPropagatableReadError(err) {
438
447
  const code = err.code;
439
448
  return typeof code === "string" && code !== "ENOENT";
440
449
  }
450
+ function isStoreEntityMarkdown(baseDir, filePath) {
451
+ if (!filePath.endsWith(".md")) return false;
452
+ const relative2 = path3.relative(baseDir, filePath);
453
+ if (relative2.length === 0 || relative2.startsWith("..") || path3.isAbsolute(relative2)) return false;
454
+ return relative2.split(path3.sep)[0] === "entities";
455
+ }
441
456
  var MemoryReadStore = class {
442
457
  constructor(deps) {
443
458
  this.deps = deps;
@@ -455,7 +470,7 @@ var MemoryReadStore = class {
455
470
  } else {
456
471
  try {
457
472
  const entries = await readdir(this.deps.wearablesDir, { withFileTypes: true });
458
- sources = entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
473
+ sources = entries.filter((entry) => entry.isDirectory() && !isMacOsReplicationJunkBasename(entry.name)).map((entry) => entry.name);
459
474
  } catch (err) {
460
475
  if (err.code === "ENOENT") return [];
461
476
  throw err;
@@ -471,7 +486,7 @@ var MemoryReadStore = class {
471
486
  throw err;
472
487
  }
473
488
  for (const entry of entries) {
474
- if (!entry.endsWith(".md")) continue;
489
+ if (isMacOsReplicationJunkBasename(entry) || !entry.endsWith(".md")) continue;
475
490
  const date = entry.slice(0, -3);
476
491
  if (!isValidTranscriptDate(date)) continue;
477
492
  days.push({ source, date });
@@ -498,6 +513,7 @@ var MemoryReadStore = class {
498
513
  const entries = await readdir(dir, { withFileTypes: true });
499
514
  for (const entry of entries) {
500
515
  checkCorpusReadAbort(options);
516
+ if (isMacOsReplicationJunkBasename(entry.name)) continue;
501
517
  const fullPath = path3.join(dir, entry.name);
502
518
  if (entry.isDirectory()) {
503
519
  await readDir(fullPath);
@@ -577,6 +593,7 @@ var MemoryReadStore = class {
577
593
  for (const entry of entries) {
578
594
  checkCorpusReadAbort(options);
579
595
  if (entry.isSymbolicLink()) continue;
596
+ if (isMacOsReplicationJunkBasename(entry.name)) continue;
580
597
  const fullPath = path3.join(dir, entry.name);
581
598
  if (entry.isDirectory()) {
582
599
  subdirs.push(fullPath);
@@ -708,6 +725,7 @@ var MemoryReadStore = class {
708
725
  const entries = await readdir(dir, { withFileTypes: true });
709
726
  const subdirs = [];
710
727
  for (const entry of entries) {
728
+ if (isMacOsReplicationJunkBasename(entry.name)) continue;
711
729
  const fullPath = path3.join(dir, entry.name);
712
730
  if (entry.isDirectory()) {
713
731
  subdirs.push(fullPath);
@@ -732,6 +750,9 @@ var MemoryReadStore = class {
732
750
  async readMemoryByPath(filePath) {
733
751
  try {
734
752
  const raw = await readMaybeEncryptedFile(filePath, this.deps._secureStoreKey, this.deps.baseDir);
753
+ if (isStoreEntityMarkdown(this.deps.baseDir, filePath) && isPopulatedUnnamedEntityRecord(raw)) {
754
+ return null;
755
+ }
735
756
  const parsed = parseFrontmatter(raw);
736
757
  if (parsed) {
737
758
  return rememberRawFrontmatter({
@@ -744,8 +765,7 @@ var MemoryReadStore = class {
744
765
  content: parsed.content
745
766
  }, raw);
746
767
  }
747
- const normalizedPath = filePath.split(path3.sep).join("/");
748
- if (normalizedPath.includes("/entities/") && filePath.endsWith(".md")) {
768
+ if (isStoreEntityMarkdown(this.deps.baseDir, filePath)) {
749
769
  const entity = parseEntityFile(raw, this.deps.entitySchemas);
750
770
  if (!entity.name) return null;
751
771
  const nameWithoutExt = path3.basename(filePath, ".md");
@@ -931,7 +951,7 @@ var MemoryReadStore = class {
931
951
  const files = await readdir(this.deps.questionsDir);
932
952
  const questions = [];
933
953
  for (const file of files) {
934
- if (!file.endsWith(".md")) continue;
954
+ if (isMacOsReplicationJunkBasename(file) || !file.endsWith(".md")) continue;
935
955
  const filePath = path3.join(this.deps.questionsDir, file);
936
956
  const raw = await readMaybeEncryptedFile(filePath, this.deps._secureStoreKey, this.deps.baseDir);
937
957
  const parsed = this.deps.parseQuestionFile(raw, filePath);
@@ -1735,13 +1755,15 @@ function selfDeps(self) {
1735
1755
  }
1736
1756
 
1737
1757
  // src/storage/entity-store.ts
1738
- import { readdir as readdir2, unlink } from "fs/promises";
1758
+ import { lstat as lstat2, readdir as readdir2, realpath as realpath2, unlink } from "fs/promises";
1739
1759
  import path5 from "path";
1740
1760
  var EntityStore = class {
1741
1761
  constructor(deps) {
1742
1762
  this.deps = deps;
1743
1763
  }
1744
1764
  deps;
1765
+ /** Filename → file identity of the last indexable check. Unchanged files are not reread. */
1766
+ entityIndexableCache = /* @__PURE__ */ new Map();
1745
1767
  /** Normalize an entity name using this store's alias table. */
1746
1768
  normalizeEntityName(raw, type) {
1747
1769
  return normalizeEntityName(raw, type, this.deps.userAliases);
@@ -1966,12 +1988,121 @@ var EntityStore = class {
1966
1988
  return "";
1967
1989
  }
1968
1990
  }
1969
- /** Return sorted list of entity filenames (without .md extension) */
1991
+ /**
1992
+ * True when `entities/` is a real directory inside this memory root.
1993
+ * `realpath` on a symlinked root would treat the link target as trusted,
1994
+ * so the check uses `lstat` first and refuses the scan when the root
1995
+ * itself is a symlink.
1996
+ */
1997
+ async isTrustedEntitiesRoot() {
1998
+ let rootStat;
1999
+ try {
2000
+ rootStat = await lstat2(this.deps.entitiesDir);
2001
+ } catch (err) {
2002
+ if (isErrnoCode(err, "ENOENT")) return false;
2003
+ throw err;
2004
+ }
2005
+ if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) return false;
2006
+ let memoryRoot;
2007
+ let entitiesReal;
2008
+ try {
2009
+ memoryRoot = await realpath2(this.deps.baseDir);
2010
+ entitiesReal = await realpath2(this.deps.entitiesDir);
2011
+ } catch (err) {
2012
+ if (isErrnoCode(err, "ENOENT")) return false;
2013
+ throw err;
2014
+ }
2015
+ return pathIsInside(memoryRoot, entitiesReal);
2016
+ }
2017
+ /**
2018
+ * Entity directory listing with macOS replication junk removed.
2019
+ * One summary warning per directory and count, shared with migration.
2020
+ * A symlinked entities root yields an empty list and is not read.
2021
+ */
2022
+ async readEntityDirectoryNames() {
2023
+ if (!await this.isTrustedEntitiesRoot()) return [];
2024
+ const entries = await readdir2(this.deps.entitiesDir);
2025
+ const { kept, ignored } = withoutMacOsReplicationJunk(entries, (name) => name);
2026
+ warnIgnoredMacOsReplicationJunk(this.deps.entitiesDir, ignored, (message) => {
2027
+ log.warn(`entity load ${message}`);
2028
+ });
2029
+ return kept;
2030
+ }
2031
+ /**
2032
+ * A directory entry is readable only when it is a regular file.
2033
+ * Symlinks, FIFOs, and devices are skipped before any read. The entities
2034
+ * root is refused separately, before the directory is listed.
2035
+ */
2036
+ async isContainedRegularEntityFile(file) {
2037
+ const filePath = path5.join(this.deps.entitiesDir, file);
2038
+ let entryStat;
2039
+ try {
2040
+ entryStat = await lstat2(filePath);
2041
+ } catch (err) {
2042
+ if (isErrnoCode(err, "ENOENT")) return false;
2043
+ throw err;
2044
+ }
2045
+ return !entryStat.isSymbolicLink() && entryStat.isFile();
2046
+ }
2047
+ /**
2048
+ * Malformed entity files stay on disk (startup must not relocate them)
2049
+ * and stay out of merge, so a fragment merge cannot delete them.
2050
+ * Unchanged files reuse the previous result so a name listing does not
2051
+ * reread the whole directory on every extraction write.
2052
+ */
2053
+ async isIndexableEntityMarkdown(file) {
2054
+ const filePath = path5.join(this.deps.entitiesDir, file);
2055
+ let entryStat;
2056
+ try {
2057
+ entryStat = await lstat2(filePath);
2058
+ } catch (err) {
2059
+ if (isErrnoCode(err, "ENOENT")) return false;
2060
+ throw err;
2061
+ }
2062
+ if (entryStat.isSymbolicLink() || !entryStat.isFile()) return false;
2063
+ const identity = `${entryStat.dev}:${entryStat.ino}:${entryStat.mtimeMs}:${entryStat.size}`;
2064
+ const cached = this.entityIndexableCache.get(file);
2065
+ if (cached?.identity === identity) return cached.ok;
2066
+ try {
2067
+ const content = await this.deps.readStorageSecureFile(filePath);
2068
+ const parsed = parseEntityFile(content, this.deps.entitySchemas);
2069
+ const ok = parsed.name.trim().length > 0 && parsed.type.trim().length > 0;
2070
+ this.entityIndexableCache.set(file, { identity, ok });
2071
+ return ok;
2072
+ } catch (err) {
2073
+ if (err instanceof SecureStoreLockedError) throw err;
2074
+ if (!isErrnoCode(err, "ENOENT")) throw err;
2075
+ return false;
2076
+ }
2077
+ }
2078
+ /**
2079
+ * Sorted entity filenames (without .md). Malformed records stay on disk
2080
+ * and are omitted, so extraction, matching, and entity list cannot reuse them.
2081
+ */
1970
2082
  async listEntityNames() {
1971
2083
  try {
1972
- const entries = await readdir2(this.deps.entitiesDir);
1973
- return entries.filter((e) => e.endsWith(".md")).map((e) => e.replace(".md", "")).sort();
1974
- } catch {
2084
+ const entries = await this.readEntityDirectoryNames();
2085
+ const mdFiles = entries.filter((e) => e.endsWith(".md"));
2086
+ const names = [];
2087
+ const batchSize = 100;
2088
+ for (let i = 0; i < mdFiles.length; i += batchSize) {
2089
+ const resolved = await Promise.all(mdFiles.slice(i, i + batchSize).map(async (file) => {
2090
+ try {
2091
+ if (!await this.isIndexableEntityMarkdown(file)) return null;
2092
+ } catch (err) {
2093
+ if (err instanceof SecureStoreLockedError) throw err;
2094
+ return null;
2095
+ }
2096
+ return file.slice(0, -3);
2097
+ }));
2098
+ for (const name of resolved) {
2099
+ if (name) names.push(name);
2100
+ }
2101
+ }
2102
+ names.sort();
2103
+ return names;
2104
+ } catch (err) {
2105
+ if (err instanceof SecureStoreLockedError) throw err;
1975
2106
  return [];
1976
2107
  }
1977
2108
  }
@@ -1983,8 +2114,10 @@ var EntityStore = class {
1983
2114
  for (const entityName of entityNames) {
1984
2115
  const wrote = await withEntityCanonicalMutationLock(stateDir, async () => {
1985
2116
  const raw = await this.readEntity(entityName);
1986
- if (!raw) return false;
1987
- const serialized = serializeEntityFile(parseEntityFile(raw, this.deps.entitySchemas), this.deps.entitySchemas, this.deps.okfConformanceEnabled());
2117
+ if (!raw || isMalformedEntityRecord(raw)) return false;
2118
+ const parsed = parseEntityFile(raw, this.deps.entitySchemas);
2119
+ if (!parsed.name.trim() || !parsed.type.trim()) return false;
2120
+ const serialized = serializeEntityFile(parsed, this.deps.entitySchemas, this.deps.okfConformanceEnabled());
1988
2121
  if (raw.trimEnd() === serialized.trimEnd()) return false;
1989
2122
  const filePath = this.deps.resolveEntityFilePath(entityName);
1990
2123
  if (filePath === null) return false;
@@ -2057,7 +2190,7 @@ var EntityStore = class {
2057
2190
  const cached = getCachedEntities(this.deps.baseDir, currentVersion, cacheKey);
2058
2191
  if (cached) return cached;
2059
2192
  try {
2060
- const entries = await readdir2(this.deps.entitiesDir);
2193
+ const entries = await this.readEntityDirectoryNames();
2061
2194
  const mdFiles = entries.filter((e) => e.endsWith(".md"));
2062
2195
  if (mdFiles.length === 0) return [];
2063
2196
  const BATCH_SIZE = 100;
@@ -2068,6 +2201,7 @@ var EntityStore = class {
2068
2201
  const results = await Promise.all(
2069
2202
  batch.map(async (entry) => {
2070
2203
  try {
2204
+ if (!await this.isContainedRegularEntityFile(entry)) return null;
2071
2205
  return await this.deps.readStorageSecureFile(path5.join(this.deps.entitiesDir, entry));
2072
2206
  } catch (err) {
2073
2207
  if (err instanceof SecureStoreLockedError) throw err;
@@ -2077,7 +2211,10 @@ var EntityStore = class {
2077
2211
  })
2078
2212
  );
2079
2213
  for (const content of results) {
2080
- if (content !== null) entities.push(parseEntityFile(content, this.deps.entitySchemas));
2214
+ if (content === null) continue;
2215
+ const entity = parseEntityFile(content, this.deps.entitySchemas);
2216
+ if (!entity.name.trim() || !entity.type.trim()) continue;
2217
+ entities.push(entity);
2081
2218
  }
2082
2219
  }
2083
2220
  checkCorpusReadAbort(options);
@@ -2150,8 +2287,13 @@ ${rows.join("\n")}
2150
2287
  async mergeFragmentedEntitiesUnlocked() {
2151
2288
  let merged = 0;
2152
2289
  try {
2153
- const entries = await readdir2(this.deps.entitiesDir);
2154
- const mdFiles = entries.filter((e) => e.endsWith(".md"));
2290
+ const entries = await this.readEntityDirectoryNames();
2291
+ const mdFiles = [];
2292
+ for (const file of entries) {
2293
+ if (!file.endsWith(".md")) continue;
2294
+ if (!await this.isIndexableEntityMarkdown(file)) continue;
2295
+ mdFiles.push(file);
2296
+ }
2155
2297
  const groups = /* @__PURE__ */ new Map();
2156
2298
  for (const file of mdFiles) {
2157
2299
  const baseName = file.replace(".md", "");
@@ -2163,8 +2305,23 @@ ${rows.join("\n")}
2163
2305
  if (!groups.has(canonical)) groups.set(canonical, []);
2164
2306
  groups.get(canonical).push(file);
2165
2307
  }
2308
+ const canonicalDestinationOccupied = async (canonicalName, members) => {
2309
+ if (members.includes(canonicalName)) return false;
2310
+ try {
2311
+ await lstat2(path5.join(this.deps.entitiesDir, canonicalName));
2312
+ return true;
2313
+ } catch (err) {
2314
+ if (isErrnoCode(err, "ENOENT")) return false;
2315
+ throw err;
2316
+ }
2317
+ };
2166
2318
  for (const [canonical, files] of groups) {
2167
2319
  if (files.length <= 1) continue;
2320
+ const canonicalName = `${canonical}.md`;
2321
+ if (await canonicalDestinationOccupied(canonicalName, files)) {
2322
+ log.warn(`skipped entity merge into occupied ${canonicalName}`);
2323
+ continue;
2324
+ }
2168
2325
  const mergedEntity = {
2169
2326
  name: "",
2170
2327
  type: "other",
@@ -2341,7 +2498,11 @@ ${rows.join("\n")}
2341
2498
  }
2342
2499
  mergedEntity.created = mergedEntity.created || mergedEntity.updated || (/* @__PURE__ */ new Date()).toISOString();
2343
2500
  mergedEntity.updated = mergedEntity.updated || (/* @__PURE__ */ new Date()).toISOString();
2344
- const canonicalPath = path5.join(this.deps.entitiesDir, `${canonical}.md`);
2501
+ const canonicalPath = path5.join(this.deps.entitiesDir, canonicalName);
2502
+ if (await canonicalDestinationOccupied(canonicalName, files)) {
2503
+ log.warn(`skipped entity merge into occupied ${canonicalName}`);
2504
+ continue;
2505
+ }
2345
2506
  await this.deps.writeStorageSecureFile(canonicalPath, serializeEntityFile(mergedEntity, this.deps.entitySchemas, this.deps.okfConformanceEnabled()));
2346
2507
  this.deps.bumpEntityMutationVersion();
2347
2508
  for (const file of files) {
@@ -2522,10 +2683,10 @@ var IdentityContinuityStore = class {
2522
2683
  import { createHash, randomUUID } from "crypto";
2523
2684
  import {
2524
2685
  access,
2525
- lstat as lstat2,
2686
+ lstat as lstat3,
2526
2687
  readFile,
2527
2688
  readdir as readdir4,
2528
- realpath as realpath2,
2689
+ realpath as realpath3,
2529
2690
  rename,
2530
2691
  stat as statFile,
2531
2692
  unlink as unlink2,
@@ -2556,7 +2717,7 @@ var EntityCanonicalIdMigrationStateSchema = z.object({
2556
2717
  async function fingerprintPath(filePath) {
2557
2718
  let fileStat;
2558
2719
  try {
2559
- fileStat = await lstat2(filePath);
2720
+ fileStat = await lstat3(filePath);
2560
2721
  } catch (error) {
2561
2722
  if (!isErrnoCode(error, "ENOENT")) throw error;
2562
2723
  }
@@ -2565,7 +2726,7 @@ async function fingerprintPath(filePath) {
2565
2726
  async function fingerprintEntityEntries(entitiesDir) {
2566
2727
  let names;
2567
2728
  try {
2568
- names = (await readdir4(entitiesDir)).filter((name) => path7.extname(name) === ".md").sort();
2729
+ names = (await readdir4(entitiesDir)).filter((name) => path7.extname(name) === ".md" && !isMacOsReplicationJunkBasename(name)).sort();
2569
2730
  } catch (error) {
2570
2731
  if (isErrnoCode(error, "ENOENT")) return "missing";
2571
2732
  throw error;
@@ -2574,7 +2735,7 @@ async function fingerprintEntityEntries(entitiesDir) {
2574
2735
  for (const name of names) {
2575
2736
  hash.update(`${name.length}:${name}:`);
2576
2737
  try {
2577
- const entry = await lstat2(path7.join(entitiesDir, name), { bigint: true });
2738
+ const entry = await lstat3(path7.join(entitiesDir, name), { bigint: true });
2578
2739
  hash.update(`${entry.dev}:${entry.ino}:${entry.size}:${entry.mtimeNs}:${entry.ctimeNs}`);
2579
2740
  } catch (error) {
2580
2741
  if (!isErrnoCode(error, "ENOENT")) throw error;
@@ -2610,7 +2771,7 @@ async function getFingerprint(baseDir, entitiesDir, getEntityMutationVersion) {
2610
2771
  async function validateRoots(baseDir, entitiesDir, stateDir, archiveDir) {
2611
2772
  let baseStat;
2612
2773
  try {
2613
- baseStat = await lstat2(baseDir);
2774
+ baseStat = await lstat3(baseDir);
2614
2775
  } catch (error) {
2615
2776
  if (isErrnoCode(error, "ENOENT")) return;
2616
2777
  throw error;
@@ -2618,7 +2779,7 @@ async function validateRoots(baseDir, entitiesDir, stateDir, archiveDir) {
2618
2779
  if (baseStat.isSymbolicLink() || !baseStat.isDirectory()) {
2619
2780
  throw new Error(`Refusing entity canonical-id migration through unsafe memory root: ${baseDir}.`);
2620
2781
  }
2621
- const memoryRoot = await realpath2(baseDir);
2782
+ const memoryRoot = await realpath3(baseDir);
2622
2783
  const roots = [
2623
2784
  entitiesDir,
2624
2785
  stateDir,
@@ -2629,7 +2790,7 @@ async function validateRoots(baseDir, entitiesDir, stateDir, archiveDir) {
2629
2790
  for (const root of roots) {
2630
2791
  let rootStat;
2631
2792
  try {
2632
- rootStat = await lstat2(root);
2793
+ rootStat = await lstat3(root);
2633
2794
  } catch (error) {
2634
2795
  if (isErrnoCode(error, "ENOENT")) continue;
2635
2796
  throw error;
@@ -2637,7 +2798,7 @@ async function validateRoots(baseDir, entitiesDir, stateDir, archiveDir) {
2637
2798
  if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) {
2638
2799
  throw new Error(`Refusing entity canonical-id migration through unsafe memory root: ${root}.`);
2639
2800
  }
2640
- assertPathInsideRoot(memoryRoot, await realpath2(root), root);
2801
+ assertPathInsideRoot(memoryRoot, await realpath3(root), root);
2641
2802
  }
2642
2803
  }
2643
2804
  function statePath(deps) {
@@ -2647,7 +2808,7 @@ async function assertSafeMigrationStateFile(deps) {
2647
2808
  const migrationStatePath = statePath(deps);
2648
2809
  let fileStat;
2649
2810
  try {
2650
- fileStat = await lstat2(migrationStatePath);
2811
+ fileStat = await lstat3(migrationStatePath);
2651
2812
  } catch (error) {
2652
2813
  if (isErrnoCode(error, "ENOENT")) return;
2653
2814
  throw error;
@@ -2658,15 +2819,15 @@ async function assertSafeMigrationStateFile(deps) {
2658
2819
  );
2659
2820
  }
2660
2821
  const [stateRoot, stateFile] = await Promise.all([
2661
- realpath2(deps.stateDir),
2662
- realpath2(migrationStatePath)
2822
+ realpath3(deps.stateDir),
2823
+ realpath3(migrationStatePath)
2663
2824
  ]);
2664
2825
  assertPathInsideRoot(stateRoot, stateFile, migrationStatePath);
2665
2826
  }
2666
2827
  async function assertSafeTombstoneFile(deps, tombstonePath) {
2667
2828
  let fileStat;
2668
2829
  try {
2669
- fileStat = await lstat2(tombstonePath);
2830
+ fileStat = await lstat3(tombstonePath);
2670
2831
  } catch (error) {
2671
2832
  if (isErrnoCode(error, "ENOENT")) return false;
2672
2833
  throw error;
@@ -2677,8 +2838,8 @@ async function assertSafeTombstoneFile(deps, tombstonePath) {
2677
2838
  );
2678
2839
  }
2679
2840
  const [stateRoot, tombstoneFile] = await Promise.all([
2680
- realpath2(deps.stateDir),
2681
- realpath2(tombstonePath)
2841
+ realpath3(deps.stateDir),
2842
+ realpath3(tombstonePath)
2682
2843
  ]);
2683
2844
  assertPathInsideRoot(stateRoot, tombstoneFile, tombstonePath);
2684
2845
  return true;
@@ -2748,7 +2909,7 @@ async function sameFileIdentity(leftPath, rightPath) {
2748
2909
  async function assertNotSymlink(filePath, label) {
2749
2910
  let stat4;
2750
2911
  try {
2751
- stat4 = await lstat2(filePath);
2912
+ stat4 = await lstat3(filePath);
2752
2913
  } catch (error) {
2753
2914
  if (isErrnoCode(error, "ENOENT")) return;
2754
2915
  throw error;
@@ -2760,7 +2921,7 @@ async function assertNotSymlink(filePath, label) {
2760
2921
  async function assertNotMemorySymlink(filePath) {
2761
2922
  let stat4;
2762
2923
  try {
2763
- stat4 = await lstat2(filePath);
2924
+ stat4 = await lstat3(filePath);
2764
2925
  } catch (error) {
2765
2926
  if (isErrnoCode(error, "ENOENT")) return;
2766
2927
  throw error;
@@ -2776,7 +2937,7 @@ async function assertEntityContentUnchanged(deps, filePath, expectedContent, leg
2776
2937
  }
2777
2938
  }
2778
2939
  async function readSafeEntityEntries(entitiesDir) {
2779
- const rootStat = await lstat2(entitiesDir);
2940
+ const rootStat = await lstat3(entitiesDir);
2780
2941
  if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) {
2781
2942
  throw new Error("Refusing entity canonical-id migration through a symlinked or non-directory entities root.");
2782
2943
  }
@@ -2786,24 +2947,30 @@ async function readSafeEntityEntries(entitiesDir) {
2786
2947
  }
2787
2948
  return entries;
2788
2949
  }
2789
- async function discoverMappings(deps, knownMappings = {}, blocked = /* @__PURE__ */ new Map()) {
2950
+ async function discoverMappings(deps, knownMappings = {}, blocked = /* @__PURE__ */ new Map(), scanNotes) {
2790
2951
  const mappings = {};
2791
2952
  const canonicalOwners = /* @__PURE__ */ new Map();
2792
2953
  blocked.clear();
2793
2954
  const entityEntries = await readSafeEntityEntries(deps.entitiesDir);
2794
2955
  for (const entry of entityEntries) {
2956
+ if (isMacOsReplicationJunkBasename(entry)) {
2957
+ scanNotes?.junk.add(entry);
2958
+ continue;
2959
+ }
2795
2960
  if (!entry.endsWith(".md")) continue;
2796
2961
  const legacyId = entry.slice(0, -".md".length);
2797
2962
  assertSafeEntityId(legacyId);
2798
2963
  const legacyPath = deps.resolveEntityFilePath(legacyId);
2799
2964
  if (legacyPath === null) continue;
2800
2965
  const entityContent = await deps.readStorageSecureFile(legacyPath);
2801
- if (!/^#[ \t]+[^\r\n \t]/m.test(entityContent) || !/^\*\*Type:\*\*[ \t]*[^\r\n \t]/m.test(entityContent)) {
2802
- throw new Error(`Cannot migrate malformed entity file ${entry}: missing name heading or type.`);
2966
+ if (isMalformedEntityRecord(entityContent)) {
2967
+ scanNotes?.malformed.add(entry);
2968
+ continue;
2803
2969
  }
2804
2970
  const entity = deps.parseEntityFile(entityContent);
2805
2971
  if (!entity.name.trim() || !entity.type.trim()) {
2806
- throw new Error(`Cannot migrate malformed entity file ${entry}: missing name or type.`);
2972
+ scanNotes?.malformed.add(entry);
2973
+ continue;
2807
2974
  }
2808
2975
  const canonicalId = deps.normalizeEntityName(entity.name, entity.type);
2809
2976
  assertSafeEntityId(canonicalId);
@@ -2952,12 +3119,14 @@ async function rewriteRelationshipTargets(deps, mappings, refreshLock) {
2952
3119
  let rewritten = false;
2953
3120
  const entries = await readSafeEntityEntries(deps.entitiesDir);
2954
3121
  for (const entry of entries) {
2955
- if (!entry.endsWith(".md")) continue;
3122
+ if (!entry.endsWith(".md") || isMacOsReplicationJunkBasename(entry)) continue;
2956
3123
  const entityPath = deps.resolveEntityFilePath(entry.slice(0, -".md".length));
2957
3124
  if (entityPath === null) continue;
2958
3125
  const observedEntityFingerprint = await fingerprintPath(entityPath);
2959
3126
  if (observedEntityFingerprint === "missing") continue;
2960
- const entity = deps.parseEntityFile(await deps.readStorageSecureFile(entityPath));
3127
+ const entityRaw = await deps.readStorageSecureFile(entityPath);
3128
+ if (isMalformedEntityRecord(entityRaw)) continue;
3129
+ const entity = deps.parseEntityFile(entityRaw);
2961
3130
  const relationships = entity.relationships.map((relationship) => {
2962
3131
  const target = mappings[relationship.target];
2963
3132
  return target ? { ...relationship, target } : relationship;
@@ -2967,7 +3136,9 @@ async function rewriteRelationshipTargets(deps, mappings, refreshLock) {
2967
3136
  deps.stateDir,
2968
3137
  async (refreshEntityLock) => {
2969
3138
  if (!await refreshLock()) throw new Error("Lost entity canonical-id migration lock.");
2970
- const latestEntity = deps.parseEntityFile(await deps.readStorageSecureFile(entityPath));
3139
+ const latestRaw = await deps.readStorageSecureFile(entityPath);
3140
+ if (isMalformedEntityRecord(latestRaw)) return false;
3141
+ const latestEntity = deps.parseEntityFile(latestRaw);
2971
3142
  if (await fingerprintPath(entityPath) !== observedEntityFingerprint) return false;
2972
3143
  const latestRelationships = latestEntity.relationships.map((relationship) => {
2973
3144
  const target = mappings[relationship.target];
@@ -3114,6 +3285,9 @@ async function migrateEntityFilePair(deps, legacyId, canonicalId, refreshMigrati
3114
3285
  const entityContent = await deps.readStorageSecureFile(legacyPath);
3115
3286
  await assertNotSymlink(legacyPath, legacyId);
3116
3287
  await assertEntityContentUnchanged(deps, legacyPath, entityContent, legacyId);
3288
+ if (isMacOsReplicationJunkBasename(path7.basename(legacyPath)) || isMalformedEntityRecord(entityContent)) {
3289
+ return { deferred: false, progressed: false };
3290
+ }
3117
3291
  let canonicalFingerprintAfterWrite = null;
3118
3292
  try {
3119
3293
  await deps.writeStorageSecureFile(canonicalPath, entityContent, entityEncrypted);
@@ -3174,6 +3348,7 @@ async function migrateLegacyEntityCanonicalIds(deps) {
3174
3348
  };
3175
3349
  }
3176
3350
  const blocked = /* @__PURE__ */ new Map();
3351
+ const scanNotes = { junk: /* @__PURE__ */ new Set(), malformed: /* @__PURE__ */ new Set() };
3177
3352
  const staleParked = /* @__PURE__ */ new Map();
3178
3353
  const finish = async () => {
3179
3354
  if (blocked.size > 0) {
@@ -3188,6 +3363,15 @@ async function migrateLegacyEntityCanonicalIds(deps) {
3188
3363
  `entity canonical-id migration dropped ${staleParked.size} mapping(s) whose entity files are gone: ${pairs}. The stale journal entries were removed; references to those legacy ids do not resolve either way.`
3189
3364
  );
3190
3365
  }
3366
+ warnIgnoredMacOsReplicationJunk(deps.entitiesDir, scanNotes.junk.size, (message) => {
3367
+ log.warn(`entity canonical-id migration ${message}`);
3368
+ });
3369
+ if (scanNotes.malformed.size > 0) {
3370
+ const names = [...scanNotes.malformed].sort().join(", ");
3371
+ log.warn(
3372
+ `entity canonical-id migration skipped ${scanNotes.malformed.size} malformed entity file(s): ${names}. Each file was left in place; startup continues. Fix or remove the file to migrate it.`
3373
+ );
3374
+ }
3191
3375
  if (reconcileRequested) {
3192
3376
  await unlink2(consumingMarkerPath).catch((error) => {
3193
3377
  if (!isErrnoCode(error, "ENOENT")) throw error;
@@ -3248,7 +3432,7 @@ async function migrateLegacyEntityCanonicalIds(deps) {
3248
3432
  if (!await lock.refresh()) throw new Error("Lost entity canonical-id migration lock.");
3249
3433
  const discoveredBefore = rejectMappingCycles(
3250
3434
  state.mappings,
3251
- await discoverMappings(deps, state.mappings, blocked)
3435
+ await discoverMappings(deps, state.mappings, blocked, scanNotes)
3252
3436
  );
3253
3437
  const revivedBefore = await pruneBlocked();
3254
3438
  const mergedBefore = collapseMappings(mergeDiscoveredMappings(state.mappings, discoveredBefore));
@@ -3274,7 +3458,7 @@ async function migrateLegacyEntityCanonicalIds(deps) {
3274
3458
  if (!await lock.refresh()) throw new Error("Lost entity canonical-id migration lock.");
3275
3459
  const discoveredAfter2 = rejectMappingCycles(
3276
3460
  state.mappings,
3277
- await discoverMappings(deps, state.mappings, blocked)
3461
+ await discoverMappings(deps, state.mappings, blocked, scanNotes)
3278
3462
  );
3279
3463
  const revivedInRescan = await pruneBlocked();
3280
3464
  if (Object.keys(discoveredAfter2).length === 0 && !revivedInRescan) {
@@ -3327,7 +3511,7 @@ async function migrateLegacyEntityCanonicalIds(deps) {
3327
3511
  if (!await lock.refresh()) throw new Error("Lost entity canonical-id migration lock.");
3328
3512
  const discoveredAfter = rejectMappingCycles(
3329
3513
  state.mappings,
3330
- await discoverMappings(deps, state.mappings, blocked)
3514
+ await discoverMappings(deps, state.mappings, blocked, scanNotes)
3331
3515
  );
3332
3516
  const revivedAfterRewrite = await pruneBlocked();
3333
3517
  if (Object.keys(discoveredAfter).length === 0 && !revivedAfterRewrite) {
@@ -5390,6 +5574,7 @@ async function hasSupersessionAudit(lookup, oldMemoryId, newMemoryId, auditBody,
5390
5574
  throw error;
5391
5575
  }
5392
5576
  for (const entry of entries) {
5577
+ if (isMacOsReplicationJunkBasename(entry.name)) continue;
5393
5578
  if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
5394
5579
  const memory = await lookup.readMemoryByPath(path12.join(lookup.correctionsDir, entry.name));
5395
5580
  if (memory?.frontmatter.category === "correction" && (memory.frontmatter.sourceMemoryId === oldMemoryId || memory.frontmatter.sourceMemoryId === void 0 && memory.frontmatter.lineage?.includes(oldMemoryId)) && memory.frontmatter.lineage?.includes(newMemoryId) && stripAttributesSuffix(memory.content) === auditBody && (structuredAttributes === void 0 || Object.entries(structuredAttributes).every(
@@ -7606,8 +7791,8 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7606
7791
  readFile: (p) => readMaybeEncryptedFile(p, this._secureStoreKey, this.baseDir),
7607
7792
  readDir: (d) => readdir6(d),
7608
7793
  deleteFile: (p) => unlink4(p),
7609
- realpath: (p) => realpath3(p),
7610
- lstat: (p) => lstat3(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7794
+ realpath: (p) => realpath4(p),
7795
+ lstat: (p) => lstat4(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7611
7796
  });
7612
7797
  }
7613
7798
  _meetingRecordStore;
@@ -7624,8 +7809,8 @@ var StorageManager3 = class _StorageManager extends TombstoneBlockedCaptureIndex
7624
7809
  readFile: (p) => readMaybeEncryptedFile(p, this._secureStoreKey, this.baseDir),
7625
7810
  readDir: (d) => readdir6(d),
7626
7811
  deleteFile: (p) => unlink4(p),
7627
- realpath: (p) => realpath3(p),
7628
- lstat: (p) => lstat3(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7812
+ realpath: (p) => realpath4(p),
7813
+ lstat: (p) => lstat4(p).then((st) => ({ isSymbolicLink: st.isSymbolicLink() }))
7629
7814
  });
7630
7815
  }
7631
7816
  /**
@@ -9425,7 +9610,7 @@ ${sanitized.text}
9425
9610
  const root = this.archiveDir;
9426
9611
  const readDir = async (dir) => {
9427
9612
  try {
9428
- const entries = await readdir6(dir, { withFileTypes: true });
9613
+ const entries = (await readdir6(dir, { withFileTypes: true })).filter((e) => !isMacOsReplicationJunkBasename(e.name));
9429
9614
  for (const entry of entries) {
9430
9615
  checkCorpusReadAbort(options);
9431
9616
  const fullPath = path13.join(dir, entry.name);
@@ -11195,7 +11380,7 @@ ${current.content}
11195
11380
  const files = await readdir6(this.summariesDir);
11196
11381
  const summaries = [];
11197
11382
  for (const file of files) {
11198
- if (!file.endsWith(".json")) continue;
11383
+ if (isMacOsReplicationJunkBasename(file) || !file.endsWith(".json")) continue;
11199
11384
  const filePath = path13.join(this.summariesDir, file);
11200
11385
  const raw = await this.readStorageSecureFile(filePath);
11201
11386
  summaries.push(JSON.parse(raw));
@@ -11394,4 +11579,4 @@ export {
11394
11579
  isValidBufferSurpriseEvent,
11395
11580
  StorageManager3 as StorageManager
11396
11581
  };
11397
- //# sourceMappingURL=chunk-PAZ35RJ4.js.map
11582
+ //# sourceMappingURL=chunk-4SCZZ3U7.js.map