@remnic/core 9.69.23 → 9.69.25

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 (438) hide show
  1. package/dist/abstraction-nodes.js +3 -2
  2. package/dist/access-admin-ops-surface.d.ts +1 -1
  3. package/dist/access-admin-ops-surface.js +53 -53
  4. package/dist/access-authorization-probe.d.ts +1 -1
  5. package/dist/access-authorization-probe.js +54 -54
  6. package/dist/access-boundary.d.ts +1 -1
  7. package/dist/access-boundary.js +53 -53
  8. package/dist/access-citation-namespace.js +3 -3
  9. package/dist/access-cli.js +112 -112
  10. package/dist/access-extraction-force-flush.d.ts +1 -1
  11. package/dist/access-extraction-force-flush.js +53 -53
  12. package/dist/access-http-briefing.d.ts +1 -1
  13. package/dist/access-http-briefing.js +54 -54
  14. package/dist/access-http-lcm-compaction.d.ts +1 -1
  15. package/dist/access-http-lifecycle-flush.d.ts +1 -1
  16. package/dist/access-http-offline-stream.d.ts +1 -1
  17. package/dist/access-http-query.js +55 -55
  18. package/dist/access-http.d.ts +2 -2
  19. package/dist/access-http.js +72 -72
  20. package/dist/access-identity-continuity-surface.js +53 -53
  21. package/dist/access-lcm-surface.d.ts +1 -1
  22. package/dist/access-lcm-surface.js +53 -53
  23. package/dist/access-mcp.d.ts +1 -1
  24. package/dist/access-mcp.js +64 -64
  25. package/dist/access-namespace-preflight.js +53 -53
  26. package/dist/access-observe-write-surface.d.ts +1 -1
  27. package/dist/access-observe-write-surface.js +53 -53
  28. package/dist/access-offline-manifest.js +10 -10
  29. package/dist/access-operations-batch.js +58 -58
  30. package/dist/access-operations.d.ts +1 -1
  31. package/dist/access-operations.js +63 -63
  32. package/dist/access-recall-concurrency.d.ts +1 -1
  33. package/dist/access-recall-concurrency.js +53 -53
  34. package/dist/access-recall-response.d.ts +1 -1
  35. package/dist/access-recall-response.js +53 -53
  36. package/dist/access-recall-surface.d.ts +1 -1
  37. package/dist/access-recall-surface.js +53 -53
  38. package/dist/access-schema.js +6 -5
  39. package/dist/access-service-helpers.d.ts +1 -1
  40. package/dist/access-service.d.ts +1 -1
  41. package/dist/access-service.js +53 -53
  42. package/dist/access-surface-catalog.d.ts +1 -1
  43. package/dist/access-surface-catalog.js +55 -55
  44. package/dist/active-recall.js +12 -11
  45. package/dist/active-recall.js.map +1 -1
  46. package/dist/{auto-sync-TTIEWJ5X.js → auto-sync-WNGG2GC2.js} +7 -7
  47. package/dist/briefing.js +20 -20
  48. package/dist/buffer.js +9 -9
  49. package/dist/calibration.js +2 -1
  50. package/dist/calibration.js.map +1 -1
  51. package/dist/{capsule-merge-CU6QJBSV.js → capsule-merge-IPG4IOFP.js} +4 -4
  52. package/dist/causal-behavior.js +4 -3
  53. package/dist/causal-behavior.js.map +1 -1
  54. package/dist/causal-chain.js +4 -3
  55. package/dist/causal-consolidation.js +25 -25
  56. package/dist/causal-retrieval.js +4 -3
  57. package/dist/causal-retrieval.js.map +1 -1
  58. package/dist/causal-trajectory-graph.js +2 -1
  59. package/dist/causal-trajectory-graph.js.map +1 -1
  60. package/dist/causal-trajectory.js +3 -2
  61. package/dist/{chunk-5RWHODVF.js → chunk-27QVNSQ3.js} +2 -2
  62. package/dist/{chunk-2MX7RU7B.js → chunk-2EKJDQZB.js} +2 -2
  63. package/dist/{chunk-XLRM6PPI.js → chunk-2IOHTUP3.js} +4 -4
  64. package/dist/{chunk-ZGQDTD5T.js → chunk-2ITE4C2Z.js} +2 -2
  65. package/dist/{chunk-O5ZR7SXV.js → chunk-2SGLMP2E.js} +2 -2
  66. package/dist/{chunk-FYWLSFFS.js → chunk-2Z4GS5E6.js} +2 -2
  67. package/dist/{chunk-WELP4CG6.js → chunk-37KUQPX4.js} +6 -6
  68. package/dist/{chunk-DDQQY2E3.js → chunk-3BTFBQLO.js} +7 -7
  69. package/dist/chunk-3BTFBQLO.js.map +1 -0
  70. package/dist/{chunk-UR6PBX2J.js → chunk-3K7V3HE6.js} +35 -60
  71. package/dist/chunk-3K7V3HE6.js.map +1 -0
  72. package/dist/{chunk-MRSLR6TB.js → chunk-3QQTXYZ6.js} +2 -2
  73. package/dist/{chunk-DJUKBGAD.js → chunk-46EST7JO.js} +5 -5
  74. package/dist/chunk-46EST7JO.js.map +1 -0
  75. package/dist/{chunk-CI6C33EO.js → chunk-46ZPIGWI.js} +3 -3
  76. package/dist/{chunk-HTIIXNJQ.js → chunk-4FIH6MPS.js} +6 -3
  77. package/dist/chunk-4FIH6MPS.js.map +1 -0
  78. package/dist/{chunk-MCA2X4WH.js → chunk-4IHBN6WU.js} +2 -2
  79. package/dist/{chunk-W7IGLX4G.js → chunk-4O6WRBGE.js} +7 -7
  80. package/dist/chunk-4O6WRBGE.js.map +1 -0
  81. package/dist/{chunk-TOZCM7WN.js → chunk-4TKJGOCJ.js} +2 -2
  82. package/dist/{chunk-3ADRFFRO.js → chunk-54WHLA65.js} +4 -4
  83. package/dist/{chunk-Z2N2AHEM.js → chunk-56Y6EKZN.js} +2 -2
  84. package/dist/{chunk-2H2N5UQW.js → chunk-5ATKSPEQ.js} +2 -2
  85. package/dist/{chunk-MSOXFXCA.js → chunk-5FAGCOZD.js} +5 -5
  86. package/dist/chunk-5FAGCOZD.js.map +1 -0
  87. package/dist/{chunk-ZVZHG7AI.js → chunk-5UBH37SL.js} +3 -3
  88. package/dist/{chunk-YZYZ2BEU.js → chunk-66OJSCI6.js} +2 -2
  89. package/dist/{chunk-HNPE66LB.js → chunk-6CVNSDCZ.js} +4 -4
  90. package/dist/{chunk-ERVJFFTR.js → chunk-6NXSYYGP.js} +2 -2
  91. package/dist/{chunk-2HIJHXB3.js → chunk-6WHJ2EAB.js} +2 -2
  92. package/dist/{chunk-34VTBPNE.js → chunk-6XL73HQ4.js} +4 -4
  93. package/dist/{chunk-YK3UIF7X.js → chunk-AQ7SYDVO.js} +2 -2
  94. package/dist/{chunk-DSCCM66R.js → chunk-B3O3IRZN.js} +2 -2
  95. package/dist/{chunk-P77QX3ID.js → chunk-B6O2YLUR.js} +21 -20
  96. package/dist/chunk-B6O2YLUR.js.map +1 -0
  97. package/dist/{chunk-N37X5RU7.js → chunk-BD7JTBYP.js} +2 -2
  98. package/dist/{chunk-VO43BJ2F.js → chunk-BLJWYCNO.js} +5 -5
  99. package/dist/{chunk-ACPCA4NO.js → chunk-BMWN7B3Y.js} +6 -6
  100. package/dist/chunk-BMWN7B3Y.js.map +1 -0
  101. package/dist/{chunk-HSKSVY3Q.js → chunk-C553ZTLF.js} +15 -15
  102. package/dist/{chunk-GCASGYIO.js → chunk-C7HJ3NEI.js} +2 -2
  103. package/dist/{chunk-WVGXCBOC.js → chunk-D5F7TKMH.js} +2 -2
  104. package/dist/{chunk-UFT2XNBW.js → chunk-DGS34QSY.js} +2 -2
  105. package/dist/{chunk-VAOL3SOT.js → chunk-DZD3WGCD.js} +4 -4
  106. package/dist/{chunk-KHMS2FQS.js → chunk-E2P7TZTF.js} +2 -2
  107. package/dist/{chunk-6FC3IZ26.js → chunk-EBA5DA77.js} +2 -2
  108. package/dist/{chunk-E6EANYLD.js → chunk-EOQ6FSQP.js} +2 -2
  109. package/dist/{chunk-7RPPCA26.js → chunk-FVOP3NT7.js} +2 -2
  110. package/dist/{chunk-NRLELHAY.js → chunk-G7NYVKD6.js} +2 -2
  111. package/dist/{chunk-QY34X2QJ.js → chunk-GHTSNGBZ.js} +2 -2
  112. package/dist/{chunk-SLIOMMPF.js → chunk-H272ZPQ3.js} +5 -5
  113. package/dist/{chunk-ZZBQNQS6.js → chunk-H3TKENU4.js} +2 -2
  114. package/dist/{chunk-5OPNUUBX.js → chunk-H4SEGIZY.js} +2 -2
  115. package/dist/{chunk-F2HMDGLC.js → chunk-H54VWRPS.js} +13 -13
  116. package/dist/{chunk-HTP6XRUI.js → chunk-HM7RHKS4.js} +2 -2
  117. package/dist/{chunk-O7H3P2SJ.js → chunk-HWLIMQE2.js} +2 -2
  118. package/dist/{chunk-62WZDHTW.js → chunk-ICKJ52PE.js} +33 -33
  119. package/dist/chunk-ICKJ52PE.js.map +1 -0
  120. package/dist/{chunk-I3FDDCY3.js → chunk-JEC4DVM3.js} +8 -8
  121. package/dist/chunk-JEC4DVM3.js.map +1 -0
  122. package/dist/{chunk-ET2CNMLD.js → chunk-JN72EPOE.js} +2 -2
  123. package/dist/{chunk-E7UQOS4C.js → chunk-JPKK466T.js} +2 -2
  124. package/dist/{chunk-JCCWJHOP.js → chunk-JYZSRNR7.js} +2 -2
  125. package/dist/{chunk-7IUESBLV.js → chunk-K7724CH2.js} +2 -2
  126. package/dist/{chunk-UK7HXNNJ.js → chunk-KAXCYM66.js} +3 -3
  127. package/dist/{chunk-7XVP4P4O.js → chunk-KB2G2I6Q.js} +3 -3
  128. package/dist/{chunk-K7LTRJZU.js → chunk-KEF46KL2.js} +2 -2
  129. package/dist/{chunk-5UZXUTVO.js → chunk-KNA3BXXL.js} +6 -2
  130. package/dist/chunk-KNA3BXXL.js.map +1 -0
  131. package/dist/{chunk-JYYTWCPU.js → chunk-KTWG7CNY.js} +6 -6
  132. package/dist/{chunk-XTYDEO7M.js → chunk-L7Z57SID.js} +2 -2
  133. package/dist/{chunk-EYMPUXAN.js → chunk-LO4UKPKX.js} +3 -3
  134. package/dist/{chunk-LDWIPYJ6.js → chunk-LS2FHUML.js} +3 -3
  135. package/dist/{chunk-GDB4J2H3.js → chunk-MPC7TYTZ.js} +2 -2
  136. package/dist/{chunk-2GF27PGH.js → chunk-MRPOZBJC.js} +3 -3
  137. package/dist/{chunk-7OLKAQMG.js → chunk-MWN6QEI2.js} +2 -2
  138. package/dist/{chunk-J62HG52Z.js → chunk-MY5EDR46.js} +4 -4
  139. package/dist/{chunk-IZRMWPGS.js → chunk-N3ZOP7KC.js} +2 -2
  140. package/dist/{chunk-N6A2RP5S.js → chunk-NB3LRY4T.js} +3 -3
  141. package/dist/{chunk-4N5BIR2U.js → chunk-ND6IQGSZ.js} +2 -2
  142. package/dist/{chunk-NOB2T2FC.js → chunk-NHLLKEKK.js} +2 -2
  143. package/dist/{chunk-WW6B7NQJ.js → chunk-NLYVH66G.js} +6 -6
  144. package/dist/chunk-NLYVH66G.js.map +1 -0
  145. package/dist/{chunk-M5CQNOQN.js → chunk-O6ZNNVSP.js} +2 -2
  146. package/dist/{chunk-NNBZS3DY.js → chunk-OB3XMWX5.js} +2 -2
  147. package/dist/{chunk-TXJNRGMI.js → chunk-OEYZXDQI.js} +6 -6
  148. package/dist/chunk-OEYZXDQI.js.map +1 -0
  149. package/dist/{chunk-SIBVIP2Y.js → chunk-PAZY2ZKP.js} +2 -2
  150. package/dist/{chunk-LXESHEBP.js → chunk-PX4UMA5Z.js} +2 -2
  151. package/dist/{chunk-4KNRKJXQ.js → chunk-QOOBICJF.js} +5 -5
  152. package/dist/chunk-QOOBICJF.js.map +1 -0
  153. package/dist/{chunk-NNZFPYYX.js → chunk-R7QY5ZVB.js} +2 -2
  154. package/dist/{chunk-WTRTFIIN.js → chunk-R7RTXEYG.js} +2 -2
  155. package/dist/{chunk-XRBJ5R3P.js → chunk-RBCQVOVJ.js} +3 -3
  156. package/dist/{chunk-WFZNT4KB.js → chunk-RC5DXXWC.js} +2 -2
  157. package/dist/{chunk-OH7LZHGJ.js → chunk-RJYJ7KR7.js} +52 -52
  158. package/dist/{chunk-OH7LZHGJ.js.map → chunk-RJYJ7KR7.js.map} +1 -1
  159. package/dist/{chunk-5QZR2RA3.js → chunk-ROBHL3GL.js} +2 -2
  160. package/dist/{chunk-6PST2SFW.js → chunk-SCXURCVT.js} +3 -3
  161. package/dist/{chunk-AYG7ML7O.js → chunk-SJDQ5RSN.js} +3 -3
  162. package/dist/{chunk-3ZBLKIHJ.js → chunk-SMWTZLHE.js} +51 -41
  163. package/dist/{chunk-3ZBLKIHJ.js.map → chunk-SMWTZLHE.js.map} +1 -1
  164. package/dist/{chunk-IQXDSKTL.js → chunk-SVXJLDDC.js} +6 -6
  165. package/dist/{chunk-SEF4IOFE.js → chunk-SWIKABKI.js} +2 -2
  166. package/dist/{chunk-ZJABRLCZ.js → chunk-TBXAY2SS.js} +4 -4
  167. package/dist/{chunk-GIC6BASP.js → chunk-TNSCIPBQ.js} +2 -2
  168. package/dist/{chunk-ZMDMHSV2.js → chunk-TVEONGBU.js} +2 -2
  169. package/dist/{chunk-4FSEZRGK.js → chunk-TWF35IC6.js} +2 -2
  170. package/dist/{chunk-LS2SGMQE.js → chunk-U6N5IBVY.js} +2 -2
  171. package/dist/{chunk-62YW6OYI.js → chunk-UCKYTA2T.js} +3 -3
  172. package/dist/{chunk-YFCHNOGJ.js → chunk-UNNPNBR2.js} +9 -9
  173. package/dist/{chunk-Z2M7F4QM.js → chunk-VVX5PZFS.js} +3 -3
  174. package/dist/{chunk-NTYLZXDX.js → chunk-VYCOJKSX.js} +2 -2
  175. package/dist/{chunk-UICSQESY.js → chunk-W24T5YMW.js} +2 -2
  176. package/dist/{chunk-HDQUQBPW.js → chunk-W3K3HITK.js} +2 -2
  177. package/dist/{chunk-GDASG7NC.js → chunk-W4F3C7N7.js} +2 -2
  178. package/dist/{chunk-YBLZFNIQ.js → chunk-WJHGDE7X.js} +2 -2
  179. package/dist/{chunk-ZBPXG5PJ.js → chunk-WMLEPWMO.js} +9 -9
  180. package/dist/chunk-WMLEPWMO.js.map +1 -0
  181. package/dist/{chunk-4F24PHNX.js → chunk-WQZZDN5M.js} +2 -2
  182. package/dist/{chunk-CDZEUCV7.js → chunk-X5K5TAQZ.js} +4 -4
  183. package/dist/{chunk-5AUODSOQ.js → chunk-XM24CDZX.js} +3 -3
  184. package/dist/{chunk-6VML2LII.js → chunk-XOVKXJEP.js} +3 -3
  185. package/dist/{chunk-OU5TIWDQ.js → chunk-XSGUMQQQ.js} +12 -12
  186. package/dist/{chunk-7CFVBWDC.js → chunk-XUE46UYW.js} +3 -3
  187. package/dist/{chunk-DJORULH3.js → chunk-YRLHEEQT.js} +2 -2
  188. package/dist/{chunk-YRWDPE32.js → chunk-Z3O53WZR.js} +2 -2
  189. package/dist/{chunk-CSY5DA7O.js → chunk-Z6COGHHN.js} +2 -2
  190. package/dist/{chunk-OYR3IPHD.js → chunk-ZIW5JVRM.js} +2 -2
  191. package/dist/{cli-B_YwqoIr.d.ts → cli-BqMNkQn5.d.ts} +1 -1
  192. package/dist/cli.d.ts +2 -2
  193. package/dist/cli.js +94 -94
  194. package/dist/coding/export-okf-codegraph.js +21 -21
  195. package/dist/coding/pre-action-gate.js +4 -3
  196. package/dist/commitment-ledger.js +3 -2
  197. package/dist/compounding/engine.js +21 -21
  198. package/dist/config.js +12 -11
  199. package/dist/connectors/codex-materialize-runner.js +21 -21
  200. package/dist/connectors/codex-materialize.js +3 -3
  201. package/dist/connectors/index.js +21 -21
  202. package/dist/consolidation-provenance-check.js +4 -4
  203. package/dist/consolidation-undo.js +3 -3
  204. package/dist/contradiction/index.js +7 -7
  205. package/dist/convergence-refresh.js +22 -22
  206. package/dist/corpus-watermark.js +22 -22
  207. package/dist/cue-anchors.js +4 -3
  208. package/dist/deep-recall-http-glue.d.ts +1 -1
  209. package/dist/deep-recall-http-glue.js +7 -6
  210. package/dist/deep-recall-mcp-tools.d.ts +1 -1
  211. package/dist/entity-retrieval.js +20 -20
  212. package/dist/eval-trajectory-store.js +4 -3
  213. package/dist/eval-trajectory.js +4 -3
  214. package/dist/evals.js +3 -2
  215. package/dist/explicit-capture.js +8 -8
  216. package/dist/external-wiki-access.d.ts +1 -1
  217. package/dist/external-wiki-access.js +54 -54
  218. package/dist/external-wiki-mcp-tools.d.ts +1 -1
  219. package/dist/extraction.js +25 -25
  220. package/dist/{first-start-migration-KHIMCBIC.js → first-start-migration-RC345GPL.js} +6 -5
  221. package/dist/{first-start-migration-KHIMCBIC.js.map → first-start-migration-RC345GPL.js.map} +1 -1
  222. package/dist/{graph-edge-decay-CJW4OT2X.js → graph-edge-decay-MKIRZ762.js} +5 -4
  223. package/dist/graph-jsonl.js +3 -2
  224. package/dist/graph-snapshot.js +3 -2
  225. package/dist/graph.js +2 -1
  226. package/dist/harmonic-construction.js +5 -4
  227. package/dist/harmonic-retrieval.js +5 -4
  228. package/dist/index.d.ts +19 -7
  229. package/dist/index.js +114 -112
  230. package/dist/json-store.js +2 -1
  231. package/dist/live-connectors-runner.js +3 -2
  232. package/dist/location/index.js +23 -23
  233. package/dist/maintenance/memory-governance.js +20 -20
  234. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +20 -20
  235. package/dist/maintenance/rebuild-memory-projection.js +21 -21
  236. package/dist/mcp-memory-inspector-app.d.ts +1 -1
  237. package/dist/memory-projection-mutations.js +3 -3
  238. package/dist/memory-subject-cli.d.ts +1 -1
  239. package/dist/memory-subject.d.ts +1 -1
  240. package/dist/memory-subject.js +4 -4
  241. package/dist/namespaces/migrate.js +21 -21
  242. package/dist/namespaces/search.js +8 -8
  243. package/dist/namespaces/storage.js +20 -20
  244. package/dist/objective-state-writers.js +4 -3
  245. package/dist/objective-state.js +3 -2
  246. package/dist/offline-sync-file-io.js +4 -3
  247. package/dist/offline-sync-impression-drain.js +5 -5
  248. package/dist/offline-sync.js +5 -4
  249. package/dist/operator-doctor-corpus.js +23 -23
  250. package/dist/operator-toolkit.js +38 -38
  251. package/dist/orchestration/maintenance.js +29 -29
  252. package/dist/orchestrator.js +112 -112
  253. package/dist/page-versioning.js +3 -3
  254. package/dist/{public-http-D6d4W8x-.d.ts → public-http-ByX2eTla.d.ts} +1 -1
  255. package/dist/{purge-OP6BEDFY.js → purge-TZKRE6ZQ.js} +5 -5
  256. package/dist/purge-TZKRE6ZQ.js.map +1 -0
  257. package/dist/recall-state.js +3 -3
  258. package/dist/reconcile/manifest.js +4 -4
  259. package/dist/{resolution-U5O4QANY.js → resolution-VKATP2HT.js} +8 -8
  260. package/dist/resume-bundles.js +16 -15
  261. package/dist/salvage-envelope.js +6 -6
  262. package/dist/schemas.d.ts +42 -42
  263. package/dist/search/document-scanner.js +3 -3
  264. package/dist/search/factory.js +7 -7
  265. package/dist/search/index.js +7 -7
  266. package/dist/search/lancedb-backend.js +4 -4
  267. package/dist/search/meilisearch-backend.js +4 -4
  268. package/dist/search/orama-backend.js +4 -4
  269. package/dist/secure-store/index.js +3 -3
  270. package/dist/semantic-consolidation.js +22 -22
  271. package/dist/semantic-rule-promotion.js +20 -20
  272. package/dist/semantic-rule-verifier.js +20 -20
  273. package/dist/source-agent-qualifier.js +24 -24
  274. package/dist/standup/build.js +20 -20
  275. package/dist/storage.js +19 -19
  276. package/dist/subject-config.js +5 -5
  277. package/dist/support-passport/index.d.ts +4 -4
  278. package/dist/support-passport/index.js +56 -56
  279. package/dist/{tier-stats-2TOW3QNL.js → tier-stats-KA6OZX2C.js} +6 -5
  280. package/dist/{tier-stats-2TOW3QNL.js.map → tier-stats-KA6OZX2C.js.map} +1 -1
  281. package/dist/transfer/capsule-import.js +4 -4
  282. package/dist/transfer/export-okf.js +21 -21
  283. package/dist/transfer/types.d.ts +12 -12
  284. package/dist/trust-zones.js +3 -2
  285. package/dist/utility-learner.js +4 -3
  286. package/dist/utility-runtime.js +5 -4
  287. package/dist/utility-telemetry.js +3 -2
  288. package/dist/verified-recall.js +20 -20
  289. package/dist/who-knows-cli.d.ts +1 -1
  290. package/dist/who-knows-cli.js +21 -21
  291. package/dist/who-knows.d.ts +1 -1
  292. package/dist/who-knows.js +20 -20
  293. package/dist/work/board.js +3 -3
  294. package/dist/work/storage.js +2 -2
  295. package/dist/work-product-ledger.js +3 -2
  296. package/dist/write-envelope.js +5 -5
  297. package/package.json +2 -2
  298. package/src/abstraction-nodes.ts +1 -4
  299. package/src/binary-lifecycle/backend.ts +2 -1
  300. package/src/connectors/live/github.ts +10 -17
  301. package/src/connectors/live/gmail.ts +8 -19
  302. package/src/connectors/live/google-drive.ts +6 -13
  303. package/src/connectors/live/notion.ts +11 -21
  304. package/src/cue-anchors.ts +1 -6
  305. package/src/graph.ts +2 -4
  306. package/src/json-store.ts +17 -20
  307. package/src/live-connectors-runner.ts +2 -1
  308. package/src/location/store.ts +1 -4
  309. package/src/maintenance/purge.ts +2 -5
  310. package/src/maintenance/rebuild-memory-lifecycle-ledger.ts +3 -6
  311. package/src/maintenance/rebuild-memory-projection.ts +2 -5
  312. package/src/namespaces/catalog.ts +1 -9
  313. package/src/offline-sync-file-io.test.ts +39 -0
  314. package/src/offline-sync-file-io.ts +3 -7
  315. package/src/procedural/procedure-miner.ts +1 -9
  316. package/src/search/document-scanner.ts +3 -6
  317. package/src/semantic-rule-promotion.ts +1 -4
  318. package/src/utils/errno.test.ts +31 -0
  319. package/src/utils/errno.ts +5 -0
  320. package/src/wearables/index.ts +1 -0
  321. package/src/wearables/registry.ts +23 -0
  322. package/dist/chunk-4KNRKJXQ.js.map +0 -1
  323. package/dist/chunk-5UZXUTVO.js.map +0 -1
  324. package/dist/chunk-62WZDHTW.js.map +0 -1
  325. package/dist/chunk-ACPCA4NO.js.map +0 -1
  326. package/dist/chunk-DDQQY2E3.js.map +0 -1
  327. package/dist/chunk-DJUKBGAD.js.map +0 -1
  328. package/dist/chunk-HTIIXNJQ.js.map +0 -1
  329. package/dist/chunk-I3FDDCY3.js.map +0 -1
  330. package/dist/chunk-MSOXFXCA.js.map +0 -1
  331. package/dist/chunk-P77QX3ID.js.map +0 -1
  332. package/dist/chunk-TXJNRGMI.js.map +0 -1
  333. package/dist/chunk-UR6PBX2J.js.map +0 -1
  334. package/dist/chunk-W7IGLX4G.js.map +0 -1
  335. package/dist/chunk-WW6B7NQJ.js.map +0 -1
  336. package/dist/chunk-ZBPXG5PJ.js.map +0 -1
  337. package/dist/purge-OP6BEDFY.js.map +0 -1
  338. package/dist/{access-service-Cv8Rizo0.d.ts → access-service-GrdVg_-Z.d.ts} +6 -6
  339. /package/dist/{auto-sync-TTIEWJ5X.js.map → auto-sync-WNGG2GC2.js.map} +0 -0
  340. /package/dist/{capsule-merge-CU6QJBSV.js.map → capsule-merge-IPG4IOFP.js.map} +0 -0
  341. /package/dist/{chunk-5RWHODVF.js.map → chunk-27QVNSQ3.js.map} +0 -0
  342. /package/dist/{chunk-2MX7RU7B.js.map → chunk-2EKJDQZB.js.map} +0 -0
  343. /package/dist/{chunk-XLRM6PPI.js.map → chunk-2IOHTUP3.js.map} +0 -0
  344. /package/dist/{chunk-ZGQDTD5T.js.map → chunk-2ITE4C2Z.js.map} +0 -0
  345. /package/dist/{chunk-O5ZR7SXV.js.map → chunk-2SGLMP2E.js.map} +0 -0
  346. /package/dist/{chunk-FYWLSFFS.js.map → chunk-2Z4GS5E6.js.map} +0 -0
  347. /package/dist/{chunk-WELP4CG6.js.map → chunk-37KUQPX4.js.map} +0 -0
  348. /package/dist/{chunk-MRSLR6TB.js.map → chunk-3QQTXYZ6.js.map} +0 -0
  349. /package/dist/{chunk-CI6C33EO.js.map → chunk-46ZPIGWI.js.map} +0 -0
  350. /package/dist/{chunk-MCA2X4WH.js.map → chunk-4IHBN6WU.js.map} +0 -0
  351. /package/dist/{chunk-TOZCM7WN.js.map → chunk-4TKJGOCJ.js.map} +0 -0
  352. /package/dist/{chunk-3ADRFFRO.js.map → chunk-54WHLA65.js.map} +0 -0
  353. /package/dist/{chunk-Z2N2AHEM.js.map → chunk-56Y6EKZN.js.map} +0 -0
  354. /package/dist/{chunk-2H2N5UQW.js.map → chunk-5ATKSPEQ.js.map} +0 -0
  355. /package/dist/{chunk-ZVZHG7AI.js.map → chunk-5UBH37SL.js.map} +0 -0
  356. /package/dist/{chunk-YZYZ2BEU.js.map → chunk-66OJSCI6.js.map} +0 -0
  357. /package/dist/{chunk-HNPE66LB.js.map → chunk-6CVNSDCZ.js.map} +0 -0
  358. /package/dist/{chunk-ERVJFFTR.js.map → chunk-6NXSYYGP.js.map} +0 -0
  359. /package/dist/{chunk-2HIJHXB3.js.map → chunk-6WHJ2EAB.js.map} +0 -0
  360. /package/dist/{chunk-34VTBPNE.js.map → chunk-6XL73HQ4.js.map} +0 -0
  361. /package/dist/{chunk-YK3UIF7X.js.map → chunk-AQ7SYDVO.js.map} +0 -0
  362. /package/dist/{chunk-DSCCM66R.js.map → chunk-B3O3IRZN.js.map} +0 -0
  363. /package/dist/{chunk-N37X5RU7.js.map → chunk-BD7JTBYP.js.map} +0 -0
  364. /package/dist/{chunk-VO43BJ2F.js.map → chunk-BLJWYCNO.js.map} +0 -0
  365. /package/dist/{chunk-HSKSVY3Q.js.map → chunk-C553ZTLF.js.map} +0 -0
  366. /package/dist/{chunk-GCASGYIO.js.map → chunk-C7HJ3NEI.js.map} +0 -0
  367. /package/dist/{chunk-WVGXCBOC.js.map → chunk-D5F7TKMH.js.map} +0 -0
  368. /package/dist/{chunk-UFT2XNBW.js.map → chunk-DGS34QSY.js.map} +0 -0
  369. /package/dist/{chunk-VAOL3SOT.js.map → chunk-DZD3WGCD.js.map} +0 -0
  370. /package/dist/{chunk-KHMS2FQS.js.map → chunk-E2P7TZTF.js.map} +0 -0
  371. /package/dist/{chunk-6FC3IZ26.js.map → chunk-EBA5DA77.js.map} +0 -0
  372. /package/dist/{chunk-E6EANYLD.js.map → chunk-EOQ6FSQP.js.map} +0 -0
  373. /package/dist/{chunk-7RPPCA26.js.map → chunk-FVOP3NT7.js.map} +0 -0
  374. /package/dist/{chunk-NRLELHAY.js.map → chunk-G7NYVKD6.js.map} +0 -0
  375. /package/dist/{chunk-QY34X2QJ.js.map → chunk-GHTSNGBZ.js.map} +0 -0
  376. /package/dist/{chunk-SLIOMMPF.js.map → chunk-H272ZPQ3.js.map} +0 -0
  377. /package/dist/{chunk-ZZBQNQS6.js.map → chunk-H3TKENU4.js.map} +0 -0
  378. /package/dist/{chunk-5OPNUUBX.js.map → chunk-H4SEGIZY.js.map} +0 -0
  379. /package/dist/{chunk-F2HMDGLC.js.map → chunk-H54VWRPS.js.map} +0 -0
  380. /package/dist/{chunk-HTP6XRUI.js.map → chunk-HM7RHKS4.js.map} +0 -0
  381. /package/dist/{chunk-O7H3P2SJ.js.map → chunk-HWLIMQE2.js.map} +0 -0
  382. /package/dist/{chunk-ET2CNMLD.js.map → chunk-JN72EPOE.js.map} +0 -0
  383. /package/dist/{chunk-E7UQOS4C.js.map → chunk-JPKK466T.js.map} +0 -0
  384. /package/dist/{chunk-JCCWJHOP.js.map → chunk-JYZSRNR7.js.map} +0 -0
  385. /package/dist/{chunk-7IUESBLV.js.map → chunk-K7724CH2.js.map} +0 -0
  386. /package/dist/{chunk-UK7HXNNJ.js.map → chunk-KAXCYM66.js.map} +0 -0
  387. /package/dist/{chunk-7XVP4P4O.js.map → chunk-KB2G2I6Q.js.map} +0 -0
  388. /package/dist/{chunk-K7LTRJZU.js.map → chunk-KEF46KL2.js.map} +0 -0
  389. /package/dist/{chunk-JYYTWCPU.js.map → chunk-KTWG7CNY.js.map} +0 -0
  390. /package/dist/{chunk-XTYDEO7M.js.map → chunk-L7Z57SID.js.map} +0 -0
  391. /package/dist/{chunk-EYMPUXAN.js.map → chunk-LO4UKPKX.js.map} +0 -0
  392. /package/dist/{chunk-LDWIPYJ6.js.map → chunk-LS2FHUML.js.map} +0 -0
  393. /package/dist/{chunk-GDB4J2H3.js.map → chunk-MPC7TYTZ.js.map} +0 -0
  394. /package/dist/{chunk-2GF27PGH.js.map → chunk-MRPOZBJC.js.map} +0 -0
  395. /package/dist/{chunk-7OLKAQMG.js.map → chunk-MWN6QEI2.js.map} +0 -0
  396. /package/dist/{chunk-J62HG52Z.js.map → chunk-MY5EDR46.js.map} +0 -0
  397. /package/dist/{chunk-IZRMWPGS.js.map → chunk-N3ZOP7KC.js.map} +0 -0
  398. /package/dist/{chunk-N6A2RP5S.js.map → chunk-NB3LRY4T.js.map} +0 -0
  399. /package/dist/{chunk-4N5BIR2U.js.map → chunk-ND6IQGSZ.js.map} +0 -0
  400. /package/dist/{chunk-NOB2T2FC.js.map → chunk-NHLLKEKK.js.map} +0 -0
  401. /package/dist/{chunk-M5CQNOQN.js.map → chunk-O6ZNNVSP.js.map} +0 -0
  402. /package/dist/{chunk-NNBZS3DY.js.map → chunk-OB3XMWX5.js.map} +0 -0
  403. /package/dist/{chunk-SIBVIP2Y.js.map → chunk-PAZY2ZKP.js.map} +0 -0
  404. /package/dist/{chunk-LXESHEBP.js.map → chunk-PX4UMA5Z.js.map} +0 -0
  405. /package/dist/{chunk-NNZFPYYX.js.map → chunk-R7QY5ZVB.js.map} +0 -0
  406. /package/dist/{chunk-WTRTFIIN.js.map → chunk-R7RTXEYG.js.map} +0 -0
  407. /package/dist/{chunk-XRBJ5R3P.js.map → chunk-RBCQVOVJ.js.map} +0 -0
  408. /package/dist/{chunk-WFZNT4KB.js.map → chunk-RC5DXXWC.js.map} +0 -0
  409. /package/dist/{chunk-5QZR2RA3.js.map → chunk-ROBHL3GL.js.map} +0 -0
  410. /package/dist/{chunk-6PST2SFW.js.map → chunk-SCXURCVT.js.map} +0 -0
  411. /package/dist/{chunk-AYG7ML7O.js.map → chunk-SJDQ5RSN.js.map} +0 -0
  412. /package/dist/{chunk-IQXDSKTL.js.map → chunk-SVXJLDDC.js.map} +0 -0
  413. /package/dist/{chunk-SEF4IOFE.js.map → chunk-SWIKABKI.js.map} +0 -0
  414. /package/dist/{chunk-ZJABRLCZ.js.map → chunk-TBXAY2SS.js.map} +0 -0
  415. /package/dist/{chunk-GIC6BASP.js.map → chunk-TNSCIPBQ.js.map} +0 -0
  416. /package/dist/{chunk-ZMDMHSV2.js.map → chunk-TVEONGBU.js.map} +0 -0
  417. /package/dist/{chunk-4FSEZRGK.js.map → chunk-TWF35IC6.js.map} +0 -0
  418. /package/dist/{chunk-LS2SGMQE.js.map → chunk-U6N5IBVY.js.map} +0 -0
  419. /package/dist/{chunk-62YW6OYI.js.map → chunk-UCKYTA2T.js.map} +0 -0
  420. /package/dist/{chunk-YFCHNOGJ.js.map → chunk-UNNPNBR2.js.map} +0 -0
  421. /package/dist/{chunk-Z2M7F4QM.js.map → chunk-VVX5PZFS.js.map} +0 -0
  422. /package/dist/{chunk-NTYLZXDX.js.map → chunk-VYCOJKSX.js.map} +0 -0
  423. /package/dist/{chunk-UICSQESY.js.map → chunk-W24T5YMW.js.map} +0 -0
  424. /package/dist/{chunk-HDQUQBPW.js.map → chunk-W3K3HITK.js.map} +0 -0
  425. /package/dist/{chunk-GDASG7NC.js.map → chunk-W4F3C7N7.js.map} +0 -0
  426. /package/dist/{chunk-YBLZFNIQ.js.map → chunk-WJHGDE7X.js.map} +0 -0
  427. /package/dist/{chunk-4F24PHNX.js.map → chunk-WQZZDN5M.js.map} +0 -0
  428. /package/dist/{chunk-CDZEUCV7.js.map → chunk-X5K5TAQZ.js.map} +0 -0
  429. /package/dist/{chunk-5AUODSOQ.js.map → chunk-XM24CDZX.js.map} +0 -0
  430. /package/dist/{chunk-6VML2LII.js.map → chunk-XOVKXJEP.js.map} +0 -0
  431. /package/dist/{chunk-OU5TIWDQ.js.map → chunk-XSGUMQQQ.js.map} +0 -0
  432. /package/dist/{chunk-7CFVBWDC.js.map → chunk-XUE46UYW.js.map} +0 -0
  433. /package/dist/{chunk-DJORULH3.js.map → chunk-YRLHEEQT.js.map} +0 -0
  434. /package/dist/{chunk-YRWDPE32.js.map → chunk-Z3O53WZR.js.map} +0 -0
  435. /package/dist/{chunk-CSY5DA7O.js.map → chunk-Z6COGHHN.js.map} +0 -0
  436. /package/dist/{chunk-OYR3IPHD.js.map → chunk-ZIW5JVRM.js.map} +0 -0
  437. /package/dist/{graph-edge-decay-CJW4OT2X.js.map → graph-edge-decay-MKIRZ762.js.map} +0 -0
  438. /package/dist/{resolution-U5O4QANY.js.map → resolution-VKATP2HT.js.map} +0 -0
@@ -2,6 +2,7 @@ import { mkdir, unlink, writeFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { listJsonFilesStrict, readJsonFile, withJsonStoreMutationLock, writeJsonFileAtomic } from "./json-store.js";
4
4
  import { compareDeterministicStrings, mergeSortedUniqueStrings } from "./deterministic-order.js";
5
+ import { isNotFoundError } from "./utils/errno.js";
5
6
  import {
6
7
  assertIsoRecordedAt,
7
8
  assertSafePathSegment,
@@ -12,10 +13,6 @@ import {
12
13
  validateStringRecord,
13
14
  } from "./store-contract.js";
14
15
 
15
- function isNotFoundError(error: unknown): boolean {
16
- return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
17
- }
18
-
19
16
  export type AbstractionNodeKind = "episode" | "topic" | "project" | "workflow" | "constraint";
20
17
  export type AbstractionLevel = "micro" | "meso" | "macro";
21
18
 
@@ -10,6 +10,7 @@ import type { Stats } from "node:fs";
10
10
  import fsp from "node:fs/promises";
11
11
  import path from "node:path";
12
12
  import type { BinaryStorageBackendConfig } from "./types.js";
13
+ import { isErrnoCode } from "../utils/errno.js";
13
14
 
14
15
  // ---------------------------------------------------------------------------
15
16
  // Interface
@@ -154,7 +155,7 @@ export class FilesystemBackend implements BinaryStorageBackend {
154
155
  }
155
156
 
156
157
  const realParent = await fsp.realpath(destDir).catch((err: NodeJS.ErrnoException) => {
157
- if (err.code === "ENOENT") return null;
158
+ if (isErrnoCode(err, "ENOENT")) return null;
158
159
  throw err;
159
160
  });
160
161
  if (realParent === null) {
@@ -63,6 +63,7 @@ import type {
63
63
  SyncIncrementalArgs,
64
64
  SyncIncrementalResult,
65
65
  } from "./framework.js";
66
+ import { throwIfAborted } from "../../abort-error.js";
66
67
 
67
68
  // ---------------------------------------------------------------------------
68
69
  // Public constants
@@ -425,14 +426,6 @@ function pickNumericGitHubStatus(e: {
425
426
 
426
427
  const GITHUB_API_BASE = "https://api.github.com";
427
428
 
428
- function throwIfAborted(signal: AbortSignal | undefined): void {
429
- if (signal?.aborted) {
430
- const err = new Error("github: sync aborted");
431
- err.name = "AbortError";
432
- throw err;
433
- }
434
- }
435
-
436
429
  function makeGitHubApiError(status: number, message: string): Error & { githubStatus: number } {
437
430
  const err = new Error(`github: HTTP ${status}: ${message}`) as Error & {
438
431
  githubStatus: number;
@@ -526,7 +519,7 @@ export function createGitHubConnector(
526
519
 
527
520
  async syncIncremental(args: SyncIncrementalArgs): Promise<SyncIncrementalResult> {
528
521
  const config = validateGitHubConfig(args.config);
529
- throwIfAborted(args.abortSignal);
522
+ throwIfAborted(args.abortSignal, "github: sync aborted");
530
523
 
531
524
  // Short-circuit: nothing to do if no repos are configured.
532
525
  if (config.repos.length === 0) {
@@ -582,7 +575,7 @@ async function seedWatermarks(
582
575
  // seenIds starts empty for first-sync; nothing has been processed yet.
583
576
 
584
577
  for (const repo of config.repos) {
585
- throwIfAborted(signal);
578
+ throwIfAborted(signal, "github: sync aborted");
586
579
 
587
580
  // Issue comments
588
581
  try {
@@ -599,7 +592,7 @@ async function seedWatermarks(
599
592
  // 404/403 → repo inaccessible, skip silently.
600
593
  }
601
594
 
602
- throwIfAborted(signal);
595
+ throwIfAborted(signal, "github: sync aborted");
603
596
 
604
597
  // PR review comments
605
598
  try {
@@ -617,7 +610,7 @@ async function seedWatermarks(
617
610
 
618
611
  // Discussions (GraphQL not used; we use the REST search endpoint for simplicity)
619
612
  if (config.includeDiscussions) {
620
- throwIfAborted(signal);
613
+ throwIfAborted(signal, "github: sync aborted");
621
614
  try {
622
615
  const latest = await fetchLatestTimestamp(
623
616
  fetchFn,
@@ -683,7 +676,7 @@ async function incrementalSync(
683
676
 
684
677
  for (const repo of config.repos) {
685
678
  if (totalConsumed >= MAX_ITEMS_PER_PASS) break;
686
- throwIfAborted(signal);
679
+ throwIfAborted(signal, "github: sync aborted");
687
680
 
688
681
  // --- Issue comments ---
689
682
  {
@@ -730,7 +723,7 @@ async function incrementalSync(
730
723
  }
731
724
 
732
725
  if (totalConsumed >= MAX_ITEMS_PER_PASS) break;
733
- throwIfAborted(signal);
726
+ throwIfAborted(signal, "github: sync aborted");
734
727
 
735
728
  // --- PR review comments ---
736
729
  {
@@ -775,7 +768,7 @@ async function incrementalSync(
775
768
 
776
769
  // --- Discussion comments (optional) ---
777
770
  if (config.includeDiscussions && totalConsumed < MAX_ITEMS_PER_PASS) {
778
- throwIfAborted(signal);
771
+ throwIfAborted(signal, "github: sync aborted");
779
772
  const wmKey = watermarkKey(repo, "discussion");
780
773
  const since = payload.watermarks[wmKey];
781
774
  try {
@@ -922,14 +915,14 @@ async function fetchAndFilterComments(
922
915
  let nextUrl: string | undefined = firstPageUrl;
923
916
 
924
917
  while (nextUrl && consumed < remainingBudget) {
925
- throwIfAborted(signal);
918
+ throwIfAborted(signal, "github: sync aborted");
926
919
 
927
920
  const data = await githubGet(fetchFn, token, nextUrl, signal);
928
921
  if (!Array.isArray(data)) break;
929
922
 
930
923
  for (const item of data) {
931
924
  if (consumed >= remainingBudget) break;
932
- throwIfAborted(signal);
925
+ throwIfAborted(signal, "github: sync aborted");
933
926
 
934
927
  const comment = normalizeGitHubComment(item, kind);
935
928
  if (!comment) {
@@ -72,6 +72,7 @@ import type {
72
72
  SyncIncrementalResult,
73
73
  } from "./framework.js";
74
74
  import { isTransientHttpError } from "./transient-errors.js";
75
+ import { throwIfAborted } from "../../abort-error.js";
75
76
 
76
77
  // ---------------------------------------------------------------------------
77
78
  // Public constants
@@ -585,18 +586,6 @@ export function pruneSkippedIds(
585
586
  return pruned;
586
587
  }
587
588
 
588
- // ---------------------------------------------------------------------------
589
- // Cooperative cancellation
590
- // ---------------------------------------------------------------------------
591
-
592
- function throwIfAborted(signal: AbortSignal | undefined): void {
593
- if (signal?.aborted) {
594
- const err = new Error("gmail: sync aborted");
595
- err.name = "AbortError";
596
- throw err;
597
- }
598
- }
599
-
600
589
  // ---------------------------------------------------------------------------
601
590
  // Gmail API client helpers
602
591
  // ---------------------------------------------------------------------------
@@ -671,7 +660,7 @@ async function exchangeRefreshToken(
671
660
  config: GmailConnectorConfig,
672
661
  signal: AbortSignal | undefined,
673
662
  ): Promise<string> {
674
- throwIfAborted(signal);
663
+ throwIfAborted(signal, "gmail: sync aborted");
675
664
  const body = new URLSearchParams({
676
665
  client_id: config.clientId,
677
666
  client_secret: config[CLIENT_SECRET_FIELD],
@@ -860,11 +849,11 @@ export function createGmailConnector(
860
849
 
861
850
  async syncIncremental(args: SyncIncrementalArgs): Promise<SyncIncrementalResult> {
862
851
  const config = validateGmailConfig(args.config);
863
- throwIfAborted(args.abortSignal);
852
+ throwIfAborted(args.abortSignal, "gmail: sync aborted");
864
853
 
865
854
  // Exchange credentials for a short-lived access token.
866
855
  const accessToken = await exchangeRefreshToken(fetchFn, config, args.abortSignal);
867
- throwIfAborted(args.abortSignal);
856
+ throwIfAborted(args.abortSignal, "gmail: sync aborted");
868
857
 
869
858
  // First-sync bootstrap: record "now" as the watermark and return
870
859
  // without importing anything. Mirrors Drive's getStartPageToken pattern.
@@ -981,7 +970,7 @@ async function incrementalSync(
981
970
 
982
971
  // Page through messages.list until exhausted, aborted, or per-pass cap hit.
983
972
  while (true) {
984
- throwIfAborted(signal);
973
+ throwIfAborted(signal, "gmail: sync aborted");
985
974
 
986
975
  // Build the list URL.
987
976
  let listPath = `/users/${encodeURIComponent(config.userId)}/messages?maxResults=${LIST_PAGE_SIZE}&q=${encodeURIComponent(listQuery)}`;
@@ -1013,7 +1002,7 @@ async function incrementalSync(
1013
1002
  throw listErr;
1014
1003
  }
1015
1004
  }
1016
- throwIfAborted(signal);
1005
+ throwIfAborted(signal, "gmail: sync aborted");
1017
1006
 
1018
1007
  const listPage = listData as {
1019
1008
  messages?: GmailMessageRef[];
@@ -1026,7 +1015,7 @@ async function incrementalSync(
1026
1015
  let capHitMidPage = false;
1027
1016
 
1028
1017
  for (const ref of messages) {
1029
- throwIfAborted(signal);
1018
+ throwIfAborted(signal, "gmail: sync aborted");
1030
1019
 
1031
1020
  // Thread 2: if this id was permanently skipped in a prior pass, skip
1032
1021
  // it again without consuming the per-pass cap. The message is immutable
@@ -1232,7 +1221,7 @@ async function fetchMessageDocument(
1232
1221
  fetchedAt: string,
1233
1222
  signal: AbortSignal | undefined,
1234
1223
  ): Promise<ConnectorDocument | SkippedWithDate | "inaccessible" | null> {
1235
- throwIfAborted(signal);
1224
+ throwIfAborted(signal, "gmail: sync aborted");
1236
1225
 
1237
1226
  let message: GmailMessage;
1238
1227
  try {
@@ -64,6 +64,7 @@ import type {
64
64
  SyncIncrementalResult,
65
65
  } from "./framework.js";
66
66
  import { isTransientHttpError } from "./transient-errors.js";
67
+ import { throwIfAborted } from "../../abort-error.js";
67
68
 
68
69
  /**
69
70
  * Stable connector id. Lives in the registry under this exact string.
@@ -414,10 +415,10 @@ export function createGoogleDriveConnector(
414
415
  async syncIncremental(args: SyncIncrementalArgs): Promise<SyncIncrementalResult> {
415
416
  // Re-validate on every pass: a JS caller could mutate it between passes.
416
417
  const config = validateGoogleDriveConfig(args.config);
417
- throwIfAborted(args.abortSignal);
418
+ throwIfAborted(args.abortSignal, "googleDrive: sync aborted");
418
419
 
419
420
  const client = await clientFactory(config);
420
- throwIfAborted(args.abortSignal);
421
+ throwIfAborted(args.abortSignal, "googleDrive: sync aborted");
421
422
 
422
423
  // Cursor bootstrap. On the very first pass (cursor=null) we ask Drive
423
424
  // for a page token but DO NOT consume any changes — this aligns with
@@ -455,7 +456,7 @@ export function createGoogleDriveConnector(
455
456
  // Page through `changes.list` until we run out, hit the per-pass cap,
456
457
  // or get aborted.
457
458
  while (true) {
458
- throwIfAborted(args.abortSignal);
459
+ throwIfAborted(args.abortSignal, "googleDrive: sync aborted");
459
460
  const remaining = MAX_CHANGES_PER_PASS - consumed;
460
461
  if (remaining <= 0) {
461
462
  // Hit the cap — persist whatever we have. The next pass resumes
@@ -467,7 +468,7 @@ export function createGoogleDriveConnector(
467
468
  const page = await client.listChanges({ pageToken, pageSize });
468
469
 
469
470
  for (const change of page.changes) {
470
- throwIfAborted(args.abortSignal);
471
+ throwIfAborted(args.abortSignal, "googleDrive: sync aborted");
471
472
  consumed++;
472
473
  const decision = decideChange(change, folderScope);
473
474
  switch (decision.kind) {
@@ -538,7 +539,7 @@ async function fetchDocument(
538
539
  fetchedAt: string,
539
540
  abortSignal: AbortSignal | undefined,
540
541
  ): Promise<ConnectorDocument | null> {
541
- throwIfAborted(abortSignal);
542
+ throwIfAborted(abortSignal, "googleDrive: sync aborted");
542
543
  const file = decision.file;
543
544
  let body: string;
544
545
  try {
@@ -581,14 +582,6 @@ async function fetchDocument(
581
582
  };
582
583
  }
583
584
 
584
- function throwIfAborted(signal: AbortSignal | undefined): void {
585
- if (signal?.aborted) {
586
- const err = new Error("googleDrive: sync aborted");
587
- err.name = "AbortError";
588
- throw err;
589
- }
590
- }
591
-
592
585
  /**
593
586
  * Classify a per-file fetch error as "transient" (re-throw to caller so
594
587
  * the sync stops without advancing the cursor and the next poll retries)
@@ -60,6 +60,7 @@ import type {
60
60
  SyncIncrementalResult,
61
61
  } from "./framework.js";
62
62
  import { isTransientHttpError } from "./transient-errors.js";
63
+ import { throwIfAborted } from "../../abort-error.js";
63
64
 
64
65
  // ---------------------------------------------------------------------------
65
66
  // Public constants
@@ -362,17 +363,6 @@ export function isTransientNotionError(err: unknown): boolean {
362
363
  const NOTION_BASE_URL = "https://api.notion.com/v1";
363
364
  const NOTION_API_VERSION = "2022-06-28";
364
365
 
365
- /**
366
- * Throw if aborted (cooperative cancellation).
367
- */
368
- function throwIfAborted(signal: AbortSignal | undefined): void {
369
- if (signal?.aborted) {
370
- const err = new Error("notion: sync aborted");
371
- err.name = "AbortError";
372
- throw err;
373
- }
374
- }
375
-
376
366
  /**
377
367
  * Build a Notion API error with the HTTP status attached for classification.
378
368
  */
@@ -531,14 +521,14 @@ async function fetchPageText(
531
521
  signal: AbortSignal | undefined,
532
522
  ): Promise<string> {
533
523
  if (depth > MAX_BLOCK_DEPTH) return "";
534
- throwIfAborted(signal);
524
+ throwIfAborted(signal, "notion: sync aborted");
535
525
 
536
526
  const lines: string[] = [];
537
527
  let cursor: string | undefined = undefined;
538
528
 
539
529
  // Page through block children.
540
530
  while (true) {
541
- throwIfAborted(signal);
531
+ throwIfAborted(signal, "notion: sync aborted");
542
532
  const pathQuery = cursor
543
533
  ? `/blocks/${blockId}/children?page_size=100&start_cursor=${encodeURIComponent(cursor)}`
544
534
  : `/blocks/${blockId}/children?page_size=100`;
@@ -552,7 +542,7 @@ async function fetchPageText(
552
542
  };
553
543
 
554
544
  for (const block of page.results ?? []) {
555
- throwIfAborted(signal);
545
+ throwIfAborted(signal, "notion: sync aborted");
556
546
  const text = extractBlockText(block);
557
547
  if (text.length > 0) lines.push(text);
558
548
 
@@ -653,7 +643,7 @@ export function createNotionConnector(
653
643
 
654
644
  async syncIncremental(args: SyncIncrementalArgs): Promise<SyncIncrementalResult> {
655
645
  const config = validateNotionConfig(args.config);
656
- throwIfAborted(args.abortSignal);
646
+ throwIfAborted(args.abortSignal, "notion: sync aborted");
657
647
 
658
648
  // Short-circuit: if no databases are configured, there is nothing to do.
659
649
  // We still return a valid cursor so the framework has something to
@@ -719,12 +709,12 @@ async function seedWatermark(
719
709
  const databases = { ...payload.databases };
720
710
 
721
711
  for (const dbId of config.databaseIds) {
722
- throwIfAborted(signal);
712
+ throwIfAborted(signal, "notion: sync aborted");
723
713
  let notionCursor: string | undefined = undefined;
724
714
  let latestInDb = "";
725
715
 
726
716
  while (true) {
727
- throwIfAborted(signal);
717
+ throwIfAborted(signal, "notion: sync aborted");
728
718
  const body: Record<string, unknown> = { page_size: 100, sorts: [] };
729
719
  if (notionCursor) body.start_cursor = notionCursor;
730
720
 
@@ -784,7 +774,7 @@ async function incrementalSync(
784
774
  let totalConsumed = 0;
785
775
 
786
776
  for (const dbId of config.databaseIds) {
787
- throwIfAborted(signal);
777
+ throwIfAborted(signal, "notion: sync aborted");
788
778
  if (totalConsumed >= MAX_PAGES_PER_PASS) break;
789
779
 
790
780
  const dbWatermark = payload.databases[dbId];
@@ -807,7 +797,7 @@ async function incrementalSync(
807
797
  let databaseFullyDrained = false;
808
798
 
809
799
  while (true) {
810
- throwIfAborted(signal);
800
+ throwIfAborted(signal, "notion: sync aborted");
811
801
  if (totalConsumed >= MAX_PAGES_PER_PASS) break;
812
802
 
813
803
  const body: Record<string, unknown> = {
@@ -845,7 +835,7 @@ async function incrementalSync(
845
835
 
846
836
  let cutoffMidPage = false;
847
837
  for (const notionPage of pageResp.results ?? []) {
848
- throwIfAborted(signal);
838
+ throwIfAborted(signal, "notion: sync aborted");
849
839
 
850
840
  const pageId = notionPage.id;
851
841
  const lastEdited = notionPage.last_edited_time;
@@ -970,7 +960,7 @@ async function fetchPageDocument(
970
960
  fetchedAt: string,
971
961
  signal: AbortSignal | undefined,
972
962
  ): Promise<ConnectorDocument | "too-large" | "empty" | null> {
973
- throwIfAborted(signal);
963
+ throwIfAborted(signal, "notion: sync aborted");
974
964
 
975
965
  let text: string;
976
966
  try {
@@ -3,6 +3,7 @@ import path from "node:path";
3
3
  import { resolveAbstractionNodeStoreDir, validateAbstractionNode, type AbstractionNode } from "./abstraction-nodes.js";
4
4
  import { listJsonFilesStrict, readJsonFile, withJsonStoreMutationLock, writeJsonFileAtomic } from "./json-store.js";
5
5
  import { compareDeterministicStrings, mergeSortedUniqueStrings } from "./deterministic-order.js";
6
+ import { isNotFoundError } from "./utils/errno.js";
6
7
  import {
7
8
  assertIsoRecordedAt,
8
9
  assertSafePathSegment,
@@ -170,12 +171,6 @@ function mergeSortedValues(existing: string[] | undefined, incoming: string[] |
170
171
  return mergeSortedUniqueStrings(existing, incoming);
171
172
  }
172
173
 
173
- function isNotFoundError(error: unknown): boolean {
174
- return (
175
- typeof error === "object" && error !== null && "code" in error && (error as { code?: unknown }).code === "ENOENT"
176
- );
177
- }
178
-
179
174
  function boundNodeRefs(nodeRefs: string[], liveNodes?: Map<string, AbstractionNode>): string[] {
180
175
  const uniqueRefs = mergeSortedUniqueStrings(nodeRefs);
181
176
  if (!liveNodes) return uniqueRefs.slice(0, 50);
package/src/graph.ts CHANGED
@@ -30,6 +30,7 @@ import {
30
30
  withGraphWriteLock,
31
31
  yieldForLockHeartbeat,
32
32
  } from "./graph-write-lock.js";
33
+ import { isErrnoCode } from "./utils/errno.js";
33
34
 
34
35
  export type GraphType = "entity" | "time" | "causal";
35
36
 
@@ -143,9 +144,6 @@ export async function appendEdge(memoryDir: string, edge: GraphEdge): Promise<vo
143
144
  confidence: typeof edge.confidence === "number" ? edge.confidence : 1.0,
144
145
  });
145
146
  }
146
- function isNodeError(err: unknown): err is NodeJS.ErrnoException {
147
- return typeof err === "object" && err !== null && "code" in err;
148
- }
149
147
 
150
148
  function parseEdgesJsonl(raw: string, expectedType: GraphType): GraphEdge[] {
151
149
  const edges: GraphEdge[] = [];
@@ -213,7 +211,7 @@ export async function readEdgesStrict(memoryDir: string, type: GraphType): Promi
213
211
  const raw = await readFile(filePath, "utf8");
214
212
  return await parseEdgesJsonlYielding(raw, type);
215
213
  } catch (err) {
216
- if (isNodeError(err) && err.code === "ENOENT") {
214
+ if (isErrnoCode(err, "ENOENT")) {
217
215
  return [];
218
216
  }
219
217
  throw err;
package/src/json-store.ts CHANGED
@@ -13,17 +13,14 @@ import {
13
13
  type FileHandle,
14
14
  } from "node:fs/promises";
15
15
  import path from "node:path";
16
-
17
- function hasErrorCode(error: unknown, code: string): boolean {
18
- return typeof error === "object" && error !== null && "code" in error && (error as { code?: unknown }).code === code;
19
- }
16
+ import { isErrnoCode } from "./utils/errno.js";
20
17
 
21
18
  async function listJsonFilesStrictInner(dir: string, allowMissingDirectory: boolean): Promise<string[]> {
22
19
  let entries: Dirent[];
23
20
  try {
24
21
  entries = await readdir(dir, { withFileTypes: true });
25
22
  } catch (error) {
26
- if (allowMissingDirectory && hasErrorCode(error, "ENOENT")) return [];
23
+ if (allowMissingDirectory && isErrnoCode(error, "ENOENT")) return [];
27
24
  throw error;
28
25
  }
29
26
  const out: string[] = [];
@@ -107,7 +104,7 @@ function jsonStoreLockTimeoutMs(): number {
107
104
  async function closeAndRemoveJsonStoreReclaimGuard(reclaimPath: string, reclaimHandle: FileHandle): Promise<void> {
108
105
  await reclaimHandle.close().catch(() => undefined);
109
106
  await unlink(reclaimPath).catch((error) => {
110
- if (!hasErrorCode(error, "ENOENT")) throw error;
107
+ if (!isErrnoCode(error, "ENOENT")) throw error;
111
108
  });
112
109
  }
113
110
 
@@ -116,7 +113,7 @@ async function removeStaleJsonStoreReclaimGuard(reclaimPath: string): Promise<vo
116
113
  try {
117
114
  initial = await readJsonStoreLockState(reclaimPath);
118
115
  } catch (error) {
119
- if (hasErrorCode(error, "ENOENT")) return;
116
+ if (isErrnoCode(error, "ENOENT")) return;
120
117
  throw error;
121
118
  }
122
119
  if (Date.now() - initial.mtimeMs <= jsonStoreLockStaleMs()) return;
@@ -134,12 +131,12 @@ async function removeStaleJsonStoreReclaimGuard(reclaimPath: string): Promise<vo
134
131
  try {
135
132
  confirmed = await readJsonStoreLockState(reclaimPath);
136
133
  } catch (error) {
137
- if (hasErrorCode(error, "ENOENT")) return;
134
+ if (isErrnoCode(error, "ENOENT")) return;
138
135
  throw error;
139
136
  }
140
137
  if (!sameJsonStoreLockState(initial, confirmed)) return;
141
138
  await unlink(reclaimPath).catch((error) => {
142
- if (!hasErrorCode(error, "ENOENT")) throw error;
139
+ if (!isErrnoCode(error, "ENOENT")) throw error;
143
140
  });
144
141
  }
145
142
 
@@ -147,12 +144,12 @@ async function acquireJsonStoreReclaimGuard(reclaimPath: string): Promise<FileHa
147
144
  try {
148
145
  return await open(reclaimPath, "wx", 0o600);
149
146
  } catch (error) {
150
- if (!hasErrorCode(error, "EEXIST")) throw error;
147
+ if (!isErrnoCode(error, "EEXIST")) throw error;
151
148
  await removeStaleJsonStoreReclaimGuard(reclaimPath);
152
149
  try {
153
150
  return await open(reclaimPath, "wx", 0o600);
154
151
  } catch (retryError) {
155
- if (hasErrorCode(retryError, "EEXIST")) return undefined;
152
+ if (isErrnoCode(retryError, "EEXIST")) return undefined;
156
153
  throw retryError;
157
154
  }
158
155
  }
@@ -169,7 +166,7 @@ function processIsRunning(pid: number): boolean {
169
166
  process.kill(pid, 0);
170
167
  return true;
171
168
  } catch (error) {
172
- return !hasErrorCode(error, "ESRCH");
169
+ return !isErrnoCode(error, "ESRCH");
173
170
  }
174
171
  }
175
172
 
@@ -208,7 +205,7 @@ async function removeJsonStoreMutationLockIfOwned(lockPath: string, token: strin
208
205
  const metadata = JSON.parse(state.content) as { token?: unknown };
209
206
  if (metadata.token === token) await unlink(lockPath);
210
207
  } catch (error) {
211
- if (!hasErrorCode(error, "ENOENT") && !(error instanceof SyntaxError)) throw error;
208
+ if (!isErrnoCode(error, "ENOENT") && !(error instanceof SyntaxError)) throw error;
212
209
  }
213
210
  }
214
211
 
@@ -224,7 +221,7 @@ async function removeStaleJsonStoreLock(lockPath: string): Promise<void> {
224
221
  try {
225
222
  initial = await readJsonStoreLockState(lockPath);
226
223
  } catch (error) {
227
- if (hasErrorCode(error, "ENOENT")) return;
224
+ if (isErrnoCode(error, "ENOENT")) return;
228
225
  throw error;
229
226
  }
230
227
  if (Date.now() - initial.mtimeMs <= jsonStoreLockStaleMs()) return;
@@ -241,12 +238,12 @@ async function removeStaleJsonStoreLock(lockPath: string): Promise<void> {
241
238
  try {
242
239
  confirmed = await readJsonStoreLockState(lockPath);
243
240
  } catch (error) {
244
- if (hasErrorCode(error, "ENOENT")) return;
241
+ if (isErrnoCode(error, "ENOENT")) return;
245
242
  throw error;
246
243
  }
247
244
  if (!sameJsonStoreLockState(initial, confirmed)) return;
248
245
  await unlink(lockPath).catch((error) => {
249
- if (!hasErrorCode(error, "ENOENT")) throw error;
246
+ if (!isErrnoCode(error, "ENOENT")) throw error;
250
247
  });
251
248
  } finally {
252
249
  await closeAndRemoveJsonStoreReclaimGuard(reclaimPath, reclaimHandle);
@@ -272,7 +269,7 @@ async function confirmJsonStoreMutationLockOwnership(
272
269
  const metadata = JSON.parse(state.content) as { token?: unknown };
273
270
  return metadata.token === token;
274
271
  } catch (error) {
275
- if (hasErrorCode(error, "ENOENT") || error instanceof SyntaxError) return false;
272
+ if (isErrnoCode(error, "ENOENT") || error instanceof SyntaxError) return false;
276
273
  throw error;
277
274
  }
278
275
  } finally {
@@ -291,9 +288,9 @@ async function acquireJsonStoreMutationFileLock(key: string): Promise<() => Prom
291
288
  try {
292
289
  handle = await open(lockPath, "wx", 0o600);
293
290
  } catch (error) {
294
- if (!hasErrorCode(error, "EEXIST")) throw error;
291
+ if (!isErrnoCode(error, "EEXIST")) throw error;
295
292
  await removeStaleJsonStoreLock(lockPath).catch((staleError) => {
296
- if (!hasErrorCode(staleError, "ENOENT")) throw staleError;
293
+ if (!isErrnoCode(staleError, "ENOENT")) throw staleError;
297
294
  });
298
295
  if (Date.now() >= deadline) {
299
296
  throw new Error(`Timed out acquiring JSON store mutation lock: ${lockPath}`);
@@ -338,7 +335,7 @@ async function acquireJsonStoreMutationFileLock(key: string): Promise<() => Prom
338
335
  const metadata = JSON.parse(await readFile(lockPath, "utf8")) as { token?: unknown };
339
336
  if (metadata.token === token) await unlink(lockPath);
340
337
  } catch (error) {
341
- if (!hasErrorCode(error, "ENOENT")) throw error;
338
+ if (!isErrnoCode(error, "ENOENT")) throw error;
342
339
  }
343
340
  };
344
341
  }
@@ -29,6 +29,7 @@ import {
29
29
  type ConnectorState,
30
30
  type LiveConnector,
31
31
  } from "./connectors/live/index.js";
32
+ import { abortError } from "./abort-error.js";
32
33
  import type { LiveConnectorsConfig } from "./types.js";
33
34
 
34
35
  export type LiveConnectorSkipReason =
@@ -428,7 +429,7 @@ function throwIfAborted(signal: AbortSignal | undefined): void {
428
429
  if (reason instanceof Error) {
429
430
  throw reason;
430
431
  }
431
- throw new Error(reason === undefined ? "operation aborted" : String(reason));
432
+ throw abortError(reason === undefined ? "operation aborted" : String(reason));
432
433
  }
433
434
 
434
435
  async function writeConnectorErrorState(options: {
@@ -21,6 +21,7 @@ import path from "node:path";
21
21
 
22
22
  import { writeFileAtomically } from "../maintenance/atomic-file.js";
23
23
  import { pathIsInside } from "../utils/path-containment.js";
24
+ import { isErrnoCode } from "../utils/errno.js";
24
25
  import { isValidLocationDate, placeDurations } from "./intervals.js";
25
26
  import type { LocationSegment } from "./types.js";
26
27
 
@@ -376,10 +377,6 @@ export function parseLocationDaySummary(raw: string): LocationDaySummary | null
376
377
 
377
378
  // ── Containment-checked day-file IO ─────────────────────────────────────────
378
379
 
379
- function isErrnoCode(err: unknown, code: string): boolean {
380
- return err instanceof Error && (err as NodeJS.ErrnoException).code === code;
381
- }
382
-
383
380
  async function assertNotSymlink(target: string, kind: "directory" | "day file"): Promise<void> {
384
381
  let stat: { isSymbolicLink(): boolean };
385
382
  try {
@@ -25,6 +25,7 @@ import type { StorageManager } from "../storage.js";
25
25
  import type { MemoryFile } from "../types.js";
26
26
  import { markProjectedMemoryPathInvalid } from "../memory-projection-store.js";
27
27
  import type { SearchBackend } from "../search/port.js";
28
+ import { isErrnoCode } from "../utils/errno.js";
28
29
 
29
30
  export type PurgeTierFilter = "cold" | "all";
30
31
 
@@ -87,10 +88,6 @@ export interface PurgeMemoriesResult {
87
88
  errors: Array<{ id: string; path: string; error: string }>;
88
89
  }
89
90
 
90
- function hasErrorCode(err: unknown, code: string): boolean {
91
- return typeof err === "object" && err !== null && "code" in err && (err as { code?: unknown }).code === code;
92
- }
93
-
94
91
  function resolveTimestamp(memory: MemoryFile): string {
95
92
  const fm = memory.frontmatter as unknown as Record<string, unknown>;
96
93
  const updated = typeof fm.updated === "string" ? (fm.updated as string) : "";
@@ -247,7 +244,7 @@ export async function purgeMemories(
247
244
  }
248
245
  } catch (err) {
249
246
  const message = err instanceof Error ? err.message : String(err);
250
- if (hasErrorCode(err, "ENOENT")) {
247
+ if (isErrnoCode(err, "ENOENT")) {
251
248
  alreadyAbsent.push(candidate);
252
249
  addCollectionForCandidate(candidate);
253
250
  markProjectedMemoryPathInvalid(storage.dir, candidate.id);