@narumitw/pi-sync 0.59.0 → 0.60.1

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 (327) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +25 -17
  3. package/dist/chunks/{chunk-AMJRUXFT.ts → chunk-2JNFEZ3V.ts} +2 -6
  4. package/dist/chunks/{chunk-AMJRUXFT.ts.map → chunk-2JNFEZ3V.ts.map} +1 -1
  5. package/dist/chunks/{chunk-NGW4JMBF.ts → chunk-4RNCZZY7.ts} +33 -27
  6. package/dist/chunks/{chunk-NGW4JMBF.ts.map → chunk-4RNCZZY7.ts.map} +3 -3
  7. package/dist/chunks/{chunk-2ZZJXITS.ts → chunk-6LHIRS5R.ts} +30 -47
  8. package/dist/chunks/chunk-6LHIRS5R.ts.map +7 -0
  9. package/dist/chunks/{config-J5VZUY4J.ts → chunk-7AC2RX4M.ts} +6 -13
  10. package/dist/chunks/chunk-7AC2RX4M.ts.map +7 -0
  11. package/dist/chunks/{chunk-76HID27T.ts → chunk-BGGKHHO4.ts} +18 -14
  12. package/dist/chunks/{chunk-76HID27T.ts.map → chunk-BGGKHHO4.ts.map} +1 -1
  13. package/dist/chunks/chunk-BWWTOQOW.ts +737 -0
  14. package/dist/chunks/chunk-BWWTOQOW.ts.map +7 -0
  15. package/dist/chunks/chunk-CEMFCWIU.ts +20 -0
  16. package/dist/chunks/chunk-CEMFCWIU.ts.map +7 -0
  17. package/dist/chunks/chunk-CZNBKIM5.ts +20 -0
  18. package/dist/chunks/chunk-CZNBKIM5.ts.map +7 -0
  19. package/dist/chunks/{chunk-YIPK23JW.ts → chunk-ENFHHB5O.ts} +1 -16
  20. package/dist/chunks/{chunk-YIPK23JW.ts.map → chunk-ENFHHB5O.ts.map} +1 -1
  21. package/dist/chunks/{chunk-KHBPED6W.ts → chunk-GSQGBVKG.ts} +2 -2
  22. package/dist/chunks/chunk-HNKLBM3U.ts +18 -0
  23. package/dist/chunks/chunk-HNKLBM3U.ts.map +7 -0
  24. package/dist/chunks/{chunk-QPC5HT3A.ts → chunk-J5COV5TY.ts} +21 -2
  25. package/dist/chunks/chunk-J5COV5TY.ts.map +7 -0
  26. package/dist/chunks/chunk-JKBUYCPC.ts +52 -0
  27. package/dist/chunks/chunk-JKBUYCPC.ts.map +7 -0
  28. package/dist/chunks/chunk-JZKCOM62.ts +26 -0
  29. package/dist/chunks/chunk-JZKCOM62.ts.map +7 -0
  30. package/dist/chunks/chunk-M7RHV3H6.ts +33 -0
  31. package/dist/chunks/chunk-M7RHV3H6.ts.map +7 -0
  32. package/dist/chunks/chunk-NPT2G4FU.ts +15 -0
  33. package/dist/chunks/chunk-NPT2G4FU.ts.map +7 -0
  34. package/dist/chunks/chunk-PDBTD2K6.ts +11 -0
  35. package/dist/chunks/chunk-PDBTD2K6.ts.map +7 -0
  36. package/dist/chunks/chunk-UBE6XWOM.ts +29 -0
  37. package/dist/chunks/chunk-UBE6XWOM.ts.map +7 -0
  38. package/dist/chunks/{chunk-PQ75RPUP.ts → chunk-UZUUUY7C.ts} +8 -8
  39. package/dist/chunks/chunk-VZCWYXRS.ts +23 -0
  40. package/dist/chunks/chunk-VZCWYXRS.ts.map +7 -0
  41. package/dist/chunks/{chunk-DTPELCPW.ts → chunk-YWEYRRQI.ts} +45 -37
  42. package/dist/chunks/chunk-YWEYRRQI.ts.map +7 -0
  43. package/dist/chunks/{chunk-ECYCNZOE.ts → chunk-ZMNVNECV.ts} +5 -1
  44. package/dist/chunks/chunk-ZMNVNECV.ts.map +7 -0
  45. package/dist/chunks/{command-handler-SDGKIQH2.ts → command-handler-FO4XBBHF.ts} +80 -86
  46. package/dist/chunks/command-handler-FO4XBBHF.ts.map +7 -0
  47. package/dist/chunks/conflict-review-XBSME2ER.ts +18 -0
  48. package/dist/chunks/conflict-review-XBSME2ER.ts.map +7 -0
  49. package/dist/chunks/{continuous-record-OM64J27R.ts → continuous-record-ZHUXVO4E.ts} +5 -13
  50. package/dist/chunks/continuous-record-ZHUXVO4E.ts.map +7 -0
  51. package/dist/chunks/continuous-storage-SQBAXACF.ts +27 -0
  52. package/dist/chunks/continuous-storage-SQBAXACF.ts.map +7 -0
  53. package/dist/chunks/{file-selection-7HEVPO4T.ts → file-selection-S6CNNNQI.ts} +11 -14
  54. package/dist/chunks/{file-selection-7HEVPO4T.ts.map → file-selection-S6CNNNQI.ts.map} +1 -1
  55. package/dist/chunks/manager-result-dispatcher-I2AMCCE7.ts +18 -0
  56. package/dist/chunks/{manager-ui-65ZETN6F.ts → manager-ui-AY5ZU6B4.ts} +180 -164
  57. package/dist/chunks/manager-ui-AY5ZU6B4.ts.map +7 -0
  58. package/dist/chunks/merge-review-SGDLMVS4.ts +10 -0
  59. package/dist/chunks/remote-selection-ui-GZHPDQ4L.ts +17 -0
  60. package/dist/chunks/{setup-switch-AB27ADDI.ts → setup-switch-M3BAFGJM.ts} +9 -13
  61. package/dist/chunks/{setup-wizard-5FILKFLQ.ts → setup-wizard-NFAWP4KF.ts} +18 -21
  62. package/dist/chunks/{setup-wizard-5FILKFLQ.ts.map → setup-wizard-NFAWP4KF.ts.map} +1 -1
  63. package/dist/chunks/{snapshot-G3W2GOGB.ts → snapshot-D4SFDP5J.ts} +8 -13
  64. package/dist/chunks/snapshot-D4SFDP5J.ts.map +7 -0
  65. package/dist/chunks/snapshot-transaction-directory-TNKBQ3UQ.ts +13 -0
  66. package/dist/chunks/snapshot-transaction-directory-TNKBQ3UQ.ts.map +7 -0
  67. package/dist/chunks/state-directory-JZSZVVPX.ts +17 -0
  68. package/dist/chunks/sync-inspection-BJ4KPPNO.ts +23 -0
  69. package/dist/chunks/sync-inspection-BJ4KPPNO.ts.map +7 -0
  70. package/dist/chunks/sync-operations-TLWER2TT.ts +45 -0
  71. package/dist/chunks/sync-operations-TLWER2TT.ts.map +7 -0
  72. package/dist/chunks/{sync-state-H4TFZZ7S.ts → sync-state-FVCJJ7MY.ts} +5 -11
  73. package/dist/chunks/sync-state-FVCJJ7MY.ts.map +7 -0
  74. package/dist/index.ts +269 -313
  75. package/dist/index.ts.map +4 -4
  76. package/docs/daemon-migration.md +93 -0
  77. package/docs/tui-contract.md +12 -0
  78. package/package.json +3 -6
  79. package/skills/configure-pi-sync/SKILL.md +1 -1
  80. package/skills/configure-pi-sync/references/configuration.md +19 -6
  81. package/src/backends/backend-factory.ts +2 -23
  82. package/src/backends/backend-identity.ts +5 -40
  83. package/src/backends/backend-types.ts +1 -81
  84. package/src/backends/git/git-backend.ts +6 -784
  85. package/src/backends/git/git-config.ts +8 -130
  86. package/src/backends/git/git-runner.ts +7 -255
  87. package/src/backends/git/git-storage.ts +14 -293
  88. package/src/backends/s3/s3-backend.ts +11 -523
  89. package/src/backends/s3/s3-client.ts +2 -399
  90. package/src/backends/s3/s3-conditions.ts +2 -67
  91. package/src/backends/snapshot-pointer.ts +2 -27
  92. package/src/backends/sync-backend.ts +6 -101
  93. package/src/backends/webdav/webdav-backend.ts +10 -622
  94. package/src/backends/webdav/webdav-client.ts +6 -370
  95. package/src/backends/webdav/webdav-config.ts +8 -82
  96. package/src/commands/command-execution.ts +40 -36
  97. package/src/commands/command.ts +23 -1
  98. package/src/daemon/apply-gate.ts +146 -0
  99. package/src/daemon/pi-client.ts +591 -0
  100. package/src/daemon/recovery.ts +103 -0
  101. package/src/paths.ts +12 -83
  102. package/src/settings/config-errors.ts +2 -6
  103. package/src/settings/config-file.ts +19 -693
  104. package/src/settings/config.ts +16 -263
  105. package/src/settings/settings-management.ts +11 -254
  106. package/src/settings/settings-store.ts +10 -48
  107. package/src/settings/settings-types.ts +1 -157
  108. package/src/settings/settings-validation.ts +17 -435
  109. package/src/snapshot/session-paths.ts +11 -111
  110. package/src/snapshot/snapshot-apply.ts +9 -322
  111. package/src/snapshot/snapshot-case-replacement.ts +6 -80
  112. package/src/snapshot/snapshot-codec.ts +2 -59
  113. package/src/snapshot/snapshot-exclude-safety.ts +2 -44
  114. package/src/snapshot/snapshot-mutation-queues.ts +6 -142
  115. package/src/snapshot/snapshot-paths.ts +2 -11
  116. package/src/snapshot/snapshot-root-transition.ts +6 -154
  117. package/src/snapshot/snapshot-transaction-directory.ts +5 -16
  118. package/src/snapshot/snapshot-transaction-plan.ts +2 -72
  119. package/src/snapshot/snapshot-transaction.ts +6 -946
  120. package/src/snapshot/snapshot-types.ts +1 -43
  121. package/src/snapshot/snapshot.ts +19 -447
  122. package/src/state/json-file.ts +2 -47
  123. package/src/state/lock-policy.ts +2 -2
  124. package/src/state/lock.ts +10 -292
  125. package/src/state/lockfile-fs.ts +2 -25
  126. package/src/state/merge-baseline-store.ts +8 -208
  127. package/src/state/mutation-directory-sync.ts +2 -34
  128. package/src/state/operation-availability.ts +7 -59
  129. package/src/state/state-directory.ts +8 -243
  130. package/src/state/state-types.ts +1 -25
  131. package/src/state/sync-state-store.ts +11 -75
  132. package/src/sync/agent-candidate.ts +7 -256
  133. package/src/sync/agent-plan.ts +2 -107
  134. package/src/sync/agent-policy.ts +10 -13
  135. package/src/sync/agent-refusal-retry.ts +2 -54
  136. package/src/sync/agent-request.ts +2 -19
  137. package/src/sync/agent-runner.ts +2 -191
  138. package/src/sync/agent-store.ts +7 -182
  139. package/src/sync/agent-sync.ts +2 -141
  140. package/src/sync/apply-review.ts +2 -63
  141. package/src/sync/automatic-sync.ts +55 -111
  142. package/src/sync/conflict-artifact-ownership.ts +2 -63
  143. package/src/sync/conflict-artifacts.ts +8 -195
  144. package/src/sync/conflict-groups.ts +2 -68
  145. package/src/sync/conflict-preview.ts +2 -56
  146. package/src/sync/conflict-resolution.ts +2 -93
  147. package/src/sync/conflict-retention.ts +2 -72
  148. package/src/sync/conflict-review.ts +3 -92
  149. package/src/sync/content-conflicts.ts +2 -73
  150. package/src/sync/continuous-errors.ts +7 -85
  151. package/src/sync/continuous-lease.ts +2 -216
  152. package/src/sync/continuous-record.ts +10 -261
  153. package/src/sync/continuous-storage.ts +12 -64
  154. package/src/sync/continuous-sync.ts +2 -563
  155. package/src/sync/continuous-watch.ts +2 -61
  156. package/src/sync/exclude-policy.ts +6 -84
  157. package/src/sync/field-migration.ts +2 -39
  158. package/src/sync/file-merge-planner.ts +2 -143
  159. package/src/sync/json-document.ts +7 -184
  160. package/src/sync/local-field-policy.ts +2 -29
  161. package/src/sync/local-fields.ts +9 -119
  162. package/src/sync/merge-apply.ts +2 -439
  163. package/src/sync/merge-journal.ts +10 -228
  164. package/src/sync/merge-transfer-error.ts +2 -72
  165. package/src/sync/merged-sync.ts +2 -919
  166. package/src/sync/mutation-owner.ts +2 -22
  167. package/src/sync/package-merge.ts +2 -87
  168. package/src/sync/partial-progress.ts +2 -55
  169. package/src/sync/remote-snapshot.ts +7 -79
  170. package/src/sync/session-merge.ts +2 -194
  171. package/src/sync/settings-conflicts.ts +2 -64
  172. package/src/sync/settings-merge.ts +6 -121
  173. package/src/sync/signals.ts +2 -8
  174. package/src/sync/startup-check.ts +15 -31
  175. package/src/sync/startup-timings.ts +2 -94
  176. package/src/sync/sync-decision.ts +3 -111
  177. package/src/sync/sync-error-guidance.ts +2 -46
  178. package/src/sync/sync-errors.ts +7 -23
  179. package/src/sync/sync-inspection.ts +10 -59
  180. package/src/sync/sync-local.ts +2 -44
  181. package/src/sync/sync-mutations.ts +10 -788
  182. package/src/sync/sync-operations.ts +32 -11
  183. package/src/sync/sync-policy.ts +34 -474
  184. package/src/sync/sync-queries.ts +2 -247
  185. package/src/sync/sync-state.ts +18 -157
  186. package/src/sync/text-merge.ts +10 -133
  187. package/src/sync-extension.ts +192 -142
  188. package/src/ui/manager-state.ts +35 -23
  189. package/src/ui/manager-ui.ts +80 -36
  190. package/src/ui/sync-attention.ts +7 -49
  191. package/dist/chunks/agent-candidate-ZHN7FTZT.ts +0 -30
  192. package/dist/chunks/agent-plan-ILFEUJ2E.ts +0 -124
  193. package/dist/chunks/agent-plan-ILFEUJ2E.ts.map +0 -7
  194. package/dist/chunks/agent-refusal-retry-HRMHCX2A.ts +0 -73
  195. package/dist/chunks/agent-refusal-retry-HRMHCX2A.ts.map +0 -7
  196. package/dist/chunks/agent-runner-FCRV2Z75.ts +0 -185
  197. package/dist/chunks/agent-runner-FCRV2Z75.ts.map +0 -7
  198. package/dist/chunks/agent-store-CCKN4DPR.ts +0 -175
  199. package/dist/chunks/agent-store-CCKN4DPR.ts.map +0 -7
  200. package/dist/chunks/agent-sync-EGA2I5W7.ts +0 -22
  201. package/dist/chunks/chunk-25QCU3LY.ts +0 -220
  202. package/dist/chunks/chunk-25QCU3LY.ts.map +0 -7
  203. package/dist/chunks/chunk-2JZFHNLM.ts +0 -113
  204. package/dist/chunks/chunk-2JZFHNLM.ts.map +0 -7
  205. package/dist/chunks/chunk-2UKUKIBI.ts +0 -25
  206. package/dist/chunks/chunk-2UKUKIBI.ts.map +0 -7
  207. package/dist/chunks/chunk-2ZZJXITS.ts.map +0 -7
  208. package/dist/chunks/chunk-3JTZF7Z5.ts +0 -77
  209. package/dist/chunks/chunk-3JTZF7Z5.ts.map +0 -7
  210. package/dist/chunks/chunk-3ST7RSYN.ts +0 -21
  211. package/dist/chunks/chunk-3ST7RSYN.ts.map +0 -7
  212. package/dist/chunks/chunk-4NVHHDN2.ts +0 -61
  213. package/dist/chunks/chunk-4NVHHDN2.ts.map +0 -7
  214. package/dist/chunks/chunk-5SFMBY5P.ts +0 -26
  215. package/dist/chunks/chunk-5SFMBY5P.ts.map +0 -7
  216. package/dist/chunks/chunk-6OFMB6KK.ts +0 -215
  217. package/dist/chunks/chunk-6OFMB6KK.ts.map +0 -7
  218. package/dist/chunks/chunk-6XU5HZAN.ts +0 -205
  219. package/dist/chunks/chunk-6XU5HZAN.ts.map +0 -7
  220. package/dist/chunks/chunk-6YGRZSCN.ts +0 -128
  221. package/dist/chunks/chunk-6YGRZSCN.ts.map +0 -7
  222. package/dist/chunks/chunk-7D5SF7P3.ts +0 -29
  223. package/dist/chunks/chunk-7D5SF7P3.ts.map +0 -7
  224. package/dist/chunks/chunk-7WYF2KUO.ts +0 -1161
  225. package/dist/chunks/chunk-7WYF2KUO.ts.map +0 -7
  226. package/dist/chunks/chunk-APDNHB2T.ts +0 -2037
  227. package/dist/chunks/chunk-APDNHB2T.ts.map +0 -7
  228. package/dist/chunks/chunk-AR2DGDUI.ts +0 -55
  229. package/dist/chunks/chunk-AR2DGDUI.ts.map +0 -7
  230. package/dist/chunks/chunk-DT7M4VQS.ts +0 -69
  231. package/dist/chunks/chunk-DT7M4VQS.ts.map +0 -7
  232. package/dist/chunks/chunk-DTPELCPW.ts.map +0 -7
  233. package/dist/chunks/chunk-ECYCNZOE.ts.map +0 -7
  234. package/dist/chunks/chunk-FHE2DCA2.ts +0 -61
  235. package/dist/chunks/chunk-FHE2DCA2.ts.map +0 -7
  236. package/dist/chunks/chunk-G4RUXRWZ.ts +0 -48
  237. package/dist/chunks/chunk-G4RUXRWZ.ts.map +0 -7
  238. package/dist/chunks/chunk-ILXMZ2HU.ts +0 -58
  239. package/dist/chunks/chunk-ILXMZ2HU.ts.map +0 -7
  240. package/dist/chunks/chunk-LA3HQMFG.ts +0 -115
  241. package/dist/chunks/chunk-LA3HQMFG.ts.map +0 -7
  242. package/dist/chunks/chunk-M6VQJIOU.ts +0 -54
  243. package/dist/chunks/chunk-M6VQJIOU.ts.map +0 -7
  244. package/dist/chunks/chunk-MKC3PXCN.ts +0 -369
  245. package/dist/chunks/chunk-MKC3PXCN.ts.map +0 -7
  246. package/dist/chunks/chunk-OQBE2OMB.ts +0 -88
  247. package/dist/chunks/chunk-OQBE2OMB.ts.map +0 -7
  248. package/dist/chunks/chunk-P3YD4ONV.ts +0 -123
  249. package/dist/chunks/chunk-P3YD4ONV.ts.map +0 -7
  250. package/dist/chunks/chunk-PRUEIIK7.ts +0 -24
  251. package/dist/chunks/chunk-PRUEIIK7.ts.map +0 -7
  252. package/dist/chunks/chunk-PWMWOJP4.ts +0 -17
  253. package/dist/chunks/chunk-PWMWOJP4.ts.map +0 -7
  254. package/dist/chunks/chunk-QPC5HT3A.ts.map +0 -7
  255. package/dist/chunks/chunk-QQVK2XFC.ts +0 -64
  256. package/dist/chunks/chunk-QQVK2XFC.ts.map +0 -7
  257. package/dist/chunks/chunk-RDOX3VH5.ts +0 -140
  258. package/dist/chunks/chunk-RDOX3VH5.ts.map +0 -7
  259. package/dist/chunks/chunk-S7D6XWHI.ts +0 -258
  260. package/dist/chunks/chunk-S7D6XWHI.ts.map +0 -7
  261. package/dist/chunks/chunk-SHPNS7FM.ts +0 -64
  262. package/dist/chunks/chunk-SHPNS7FM.ts.map +0 -7
  263. package/dist/chunks/chunk-SWRVXVFD.ts +0 -248
  264. package/dist/chunks/chunk-SWRVXVFD.ts.map +0 -7
  265. package/dist/chunks/chunk-T2SJD3N7.ts +0 -99
  266. package/dist/chunks/chunk-T2SJD3N7.ts.map +0 -7
  267. package/dist/chunks/chunk-T2TYBLXK.ts +0 -27
  268. package/dist/chunks/chunk-T2TYBLXK.ts.map +0 -7
  269. package/dist/chunks/chunk-UZSDS4HF.ts +0 -403
  270. package/dist/chunks/chunk-UZSDS4HF.ts.map +0 -7
  271. package/dist/chunks/chunk-VPODHKOX.ts +0 -229
  272. package/dist/chunks/chunk-VPODHKOX.ts.map +0 -7
  273. package/dist/chunks/chunk-WEKGW7HV.ts +0 -162
  274. package/dist/chunks/chunk-WEKGW7HV.ts.map +0 -7
  275. package/dist/chunks/chunk-WUHRVSWI.ts +0 -369
  276. package/dist/chunks/chunk-WUHRVSWI.ts.map +0 -7
  277. package/dist/chunks/chunk-X7R6DCVF.ts +0 -28
  278. package/dist/chunks/chunk-X7R6DCVF.ts.map +0 -7
  279. package/dist/chunks/chunk-XJHQPB3E.ts +0 -107
  280. package/dist/chunks/chunk-XJHQPB3E.ts.map +0 -7
  281. package/dist/chunks/chunk-XZ3ZTHKR.ts +0 -1184
  282. package/dist/chunks/chunk-XZ3ZTHKR.ts.map +0 -7
  283. package/dist/chunks/chunk-YDVQYUHE.ts +0 -34
  284. package/dist/chunks/chunk-YDVQYUHE.ts.map +0 -7
  285. package/dist/chunks/chunk-YEULK7MK.ts +0 -415
  286. package/dist/chunks/chunk-YEULK7MK.ts.map +0 -7
  287. package/dist/chunks/chunk-YHT4YTYG.ts +0 -31
  288. package/dist/chunks/chunk-YHT4YTYG.ts.map +0 -7
  289. package/dist/chunks/chunk-ZW5ZLGBI.ts +0 -154
  290. package/dist/chunks/chunk-ZW5ZLGBI.ts.map +0 -7
  291. package/dist/chunks/command-handler-SDGKIQH2.ts.map +0 -7
  292. package/dist/chunks/conflict-artifacts-MYSH3L2J.ts +0 -33
  293. package/dist/chunks/conflict-review-J6ZSPNWL.ts +0 -190
  294. package/dist/chunks/conflict-review-J6ZSPNWL.ts.map +0 -7
  295. package/dist/chunks/continuous-sync-BH5SWIRV.ts +0 -590
  296. package/dist/chunks/continuous-sync-BH5SWIRV.ts.map +0 -7
  297. package/dist/chunks/git-backend-6CKI6CUG.ts +0 -1074
  298. package/dist/chunks/git-backend-6CKI6CUG.ts.map +0 -7
  299. package/dist/chunks/local-fields-SR7PH66U.ts +0 -27
  300. package/dist/chunks/local-fields-SR7PH66U.ts.map +0 -7
  301. package/dist/chunks/manager-result-dispatcher-CXUP5WDP.ts +0 -33
  302. package/dist/chunks/manager-result-dispatcher-CXUP5WDP.ts.map +0 -7
  303. package/dist/chunks/manager-ui-65ZETN6F.ts.map +0 -7
  304. package/dist/chunks/merge-baseline-store-4Y2X7P2D.ts +0 -26
  305. package/dist/chunks/merge-baseline-store-4Y2X7P2D.ts.map +0 -7
  306. package/dist/chunks/remote-selection-ui-W55BQDJQ.ts +0 -32
  307. package/dist/chunks/remote-selection-ui-W55BQDJQ.ts.map +0 -7
  308. package/dist/chunks/s3-backend-FDK7JSDQ.ts +0 -845
  309. package/dist/chunks/s3-backend-FDK7JSDQ.ts.map +0 -7
  310. package/dist/chunks/setup-switch-AB27ADDI.ts.map +0 -7
  311. package/dist/chunks/snapshot-G3W2GOGB.ts.map +0 -7
  312. package/dist/chunks/snapshot-transaction-SGRUWT73.ts +0 -25
  313. package/dist/chunks/snapshot-transaction-SGRUWT73.ts.map +0 -7
  314. package/dist/chunks/sync-inspection-MDYHZHT7.ts +0 -26
  315. package/dist/chunks/sync-inspection-MDYHZHT7.ts.map +0 -7
  316. package/dist/chunks/sync-operations-ZAUP65FH.ts +0 -1032
  317. package/dist/chunks/sync-operations-ZAUP65FH.ts.map +0 -7
  318. package/dist/chunks/sync-state-H4TFZZ7S.ts.map +0 -7
  319. package/dist/chunks/webdav-backend-UNMIAXM5.ts +0 -852
  320. package/dist/chunks/webdav-backend-UNMIAXM5.ts.map +0 -7
  321. /package/dist/chunks/{chunk-KHBPED6W.ts.map → chunk-GSQGBVKG.ts.map} +0 -0
  322. /package/dist/chunks/{chunk-PQ75RPUP.ts.map → chunk-UZUUUY7C.ts.map} +0 -0
  323. /package/dist/chunks/{agent-candidate-ZHN7FTZT.ts.map → manager-result-dispatcher-I2AMCCE7.ts.map} +0 -0
  324. /package/dist/chunks/{agent-sync-EGA2I5W7.ts.map → merge-review-SGDLMVS4.ts.map} +0 -0
  325. /package/dist/chunks/{config-J5VZUY4J.ts.map → remote-selection-ui-GZHPDQ4L.ts.map} +0 -0
  326. /package/dist/chunks/{conflict-artifacts-MYSH3L2J.ts.map → setup-switch-M3BAFGJM.ts.map} +0 -0
  327. /package/dist/chunks/{continuous-record-OM64J27R.ts.map → state-directory-JZSZVVPX.ts.map} +0 -0
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/sync/startup-timings.ts"],
4
- "sourcesContent": ["import { performance } from \"node:perf_hooks\";\nimport type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\n\ntype StartupStage =\n | \"transaction recovery\"\n | \"settings read\"\n | \"config resolution\"\n | \"inspection import\"\n | \"inspection and guards\"\n | \"backend initialization\"\n | \"local snapshot\"\n | \"sync state read\"\n | \"remote head\"\n | \"operations import\"\n | \"automatic transfer\"\n | \"transfer authorization\"\n | \"transfer backend initialization\"\n | \"transfer journal read\"\n | \"transfer journal recovery\"\n | \"transfer state read\"\n | \"transfer local snapshot\"\n | \"transfer remote head\"\n | \"transfer snapshot download\"\n | \"transfer unchanged verification\"\n | \"transfer merge planning\"\n | \"transfer settings merge\"\n | \"transfer content merge\"\n | \"transfer preflight\"\n | \"transfer backup\"\n | \"transfer journal write\"\n | \"transfer remote publication\"\n | \"transfer local apply\"\n | \"transfer baseline write\"\n | \"transfer cleanup\";\n\nexport type StartupTimingPublisher = (ctx: ExtensionContext, report: string) => void;\n\n/** Fixed labels and durations only: never retain errors, paths, settings, or payloads. */\nexport function createStartupTimings(\n publishReport: StartupTimingPublisher = (ctx, report) => ctx.ui.notify(report, \"info\"),\n) {\n const started = performance.now();\n const stages = new Map<StartupStage, { ms: number; calls: number; interrupted: boolean }>();\n let unchanged = false;\n return {\n markUnchanged() {\n unchanged = true;\n },\n async measure<T>(stage: StartupStage, run: () => T | Promise<T>): Promise<T> {\n const start = performance.now();\n let completed = false;\n try {\n const result = await run();\n completed = true;\n return result;\n } finally {\n const previous = stages.get(stage);\n stages.set(stage, {\n ms: (previous?.ms ?? 0) + performance.now() - start,\n calls: (previous?.calls ?? 0) + 1,\n interrupted: Boolean(previous?.interrupted || !completed),\n });\n }\n },\n publish(\n ctx: ExtensionContext,\n enabled: boolean,\n sessionSignal: AbortSignal,\n scope: \"local initialization\" | \"background startup\" | \"continuous startup\",\n outcome: \"completed\" | \"stopped\" = \"completed\",\n ) {\n if (!enabled || !ctx.hasUI || sessionSignal.aborted) return;\n try {\n publishReport(\n ctx,\n [\n `pi-sync debug: ${scope} (${outcome})`,\n ...Array.from(\n stages,\n ([stage, value]) =>\n `${stage}: ${value.ms.toFixed(1)} ms${value.calls > 1 ? ` (${value.calls} calls)` : \"\"}${value.interrupted ? \" (interrupted)\" : \"\"}`,\n ),\n ...(unchanged ? [\"transfer result: unchanged (fast path)\"] : []),\n `total: ${(performance.now() - started).toFixed(1)} ms`,\n ].join(\"\\n\"),\n );\n } catch {\n // Diagnostics must not change sync behavior if the UI is unavailable during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,CAAC,CAAC;AAAA,UACpD,EAAE,KAAK,IAAI;AAAA,QACb;AAAA,MACF,QAAQ;AAAA,MAER;AAAA,IACF;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1,369 +0,0 @@
1
- // @generated by scripts/build-runtime.mjs; do not edit.
2
- // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
- import {
4
- DEFAULT_SYNC_INCLUDE,
5
- canonicalSnapshotPathForConfig,
6
- configuredSnapshotPathMatcher,
7
- customIncludePathsByLower,
8
- includeFromSelectionConfig,
9
- isPreservableUnmanagedSnapshotPath,
10
- normalizeExtraFiles,
11
- normalizeSyncFiles,
12
- sameSnapshotSelection,
13
- selectionForSnapshot,
14
- snapshotSelectionExclude,
15
- snapshotSelectionInclude,
16
- syncIncludeSelection
17
- } from "./chunk-WUHRVSWI.ts";
18
- import {
19
- agentDir,
20
- configuredSessionDir,
21
- sessionStorageRoot
22
- } from "./chunk-LA3HQMFG.ts";
23
- import {
24
- compileSyncExclude
25
- } from "./chunk-3JTZF7Z5.ts";
26
- import {
27
- isDeniedPath,
28
- posixJoin,
29
- safeJoin,
30
- toPosix
31
- } from "./chunk-FHE2DCA2.ts";
32
-
33
- // src/snapshot/snapshot.ts
34
- import { createHash, randomUUID } from "node:crypto";
35
- import fs from "node:fs/promises";
36
- import os from "node:os";
37
- import path from "node:path";
38
- var VERSION = 1;
39
- var TOP_LEVEL_FILES = DEFAULT_SYNC_INCLUDE.filter((name) => name.includes("."));
40
- var TOP_LEVEL_DIRS = new Set(DEFAULT_SYNC_INCLUDE.filter((name) => !name.includes(".")));
41
- var SECRET_PATTERNS = [
42
- /AWS_SECRET_ACCESS_KEY\s*[=:]\s*['"]?[A-Za-z0-9/+]{35,}/i,
43
- /(ANTHROPIC|OPENAI|GEMINI|GOOGLE|FIRECRAWL|GITHUB|CLOUDFLARE|R2|S3)_[A-Z0-9_]*(KEY|TOKEN|SECRET)\s*[=:]\s*['"]?[^\s'"]{12,}/i,
44
- /sk-ant-[A-Za-z0-9_-]{20,}/,
45
- /sk-[A-Za-z0-9]{20,}/,
46
- /gh[pousr]_[A-Za-z0-9_]{20,}/
47
- ];
48
- function selectTopLevelFileEntry(entries, fileName) {
49
- const exact = entries.find((entry) => entry.isFile() && entry.name === fileName);
50
- if (exact) return exact;
51
- const lower = fileName.toLowerCase();
52
- return entries.filter((entry) => entry.isFile() && entry.name.toLowerCase() === lower).sort((left, right) => left.name.localeCompare(right.name))[0];
53
- }
54
- function sha256(value) {
55
- return createHash("sha256").update(value).digest("hex");
56
- }
57
- function isSafeSnapshotPath(relativePath) {
58
- if (relativePath.includes("\\")) return false;
59
- const normalized = toPosix(relativePath);
60
- return Boolean(normalized) && normalized !== "." && normalized !== ".." && !normalized.startsWith("../") && !path.posix.isAbsolute(normalized) && path.posix.normalize(normalized) === normalized && !isDeniedPath(normalized);
61
- }
62
- function snapshotsMatch(left, right) {
63
- const leftHashes = new Map(left.files.map((file) => [file.path, file.sha256]));
64
- const rightHashes = new Map(right.files.map((file) => [file.path, file.sha256]));
65
- return left.syncSessions === right.syncSessions && sameSnapshotSelection(left.selection, right.selection) && leftHashes.size === rightHashes.size && [...leftHashes].every(([filePath, hash]) => rightHashes.get(filePath) === hash);
66
- }
67
- function snapshotId() {
68
- return `${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}-${randomUUID().slice(0, 8)}`;
69
- }
70
- function regenerateSnapshotIdentity(snapshot) {
71
- return {
72
- ...snapshot,
73
- id: snapshotId(),
74
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
75
- machine: os.hostname()
76
- };
77
- }
78
- async function createSnapshot(profile, options = {}) {
79
- options.signal?.throwIfAborted();
80
- const include = effectiveInclude(options);
81
- const excluded = compileSyncExclude(options.exclude);
82
- const syncSessions = include.includes("sessions") && !excluded("sessions");
83
- const needsSessionConfig = syncSessions || !excluded("settings.json");
84
- const sessionDir = options.sessionDir ?? (needsSessionConfig ? await configuredSessionDir() : void 0);
85
- options.signal?.throwIfAborted();
86
- const files = await collectFiles(
87
- agentDir(),
88
- {
89
- include,
90
- exclude: options.exclude,
91
- sessionDir,
92
- signal: options.signal
93
- },
94
- excluded
95
- );
96
- options.signal?.throwIfAborted();
97
- return {
98
- version: options.exclude === void 0 ? VERSION : 4,
99
- id: snapshotId(),
100
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
101
- machine: os.hostname(),
102
- profile,
103
- syncSessions,
104
- selection: selectionForSnapshot(include, options.exclude),
105
- files
106
- };
107
- }
108
- function effectiveInclude(options) {
109
- if (options.include) return options.include;
110
- return [
111
- ...normalizeSyncFiles(options.syncFiles),
112
- ...normalizeExtraFiles(options.extraFiles),
113
- ...options.syncSessions ? ["sessions"] : []
114
- ];
115
- }
116
- async function collectFiles(root, options = {}, excluded = compileSyncExclude(options.exclude)) {
117
- const signal = options.signal;
118
- signal?.throwIfAborted();
119
- const results = [];
120
- const entries = await fs.readdir(root, { withFileTypes: true });
121
- signal?.throwIfAborted();
122
- const selection = syncIncludeSelection(effectiveInclude(options));
123
- const selectedFiles = new Set(selection.builtIns);
124
- for (const entry of entries) {
125
- if (entry.isDirectory() && TOP_LEVEL_DIRS.has(entry.name) && selectedFiles.has(entry.name) && !excluded(entry.name)) {
126
- await collectDirectory(results, root, entry.name, { signal, excluded });
127
- }
128
- }
129
- for (const fileName of TOP_LEVEL_FILES) {
130
- if (!selectedFiles.has(fileName) || excluded(fileName)) continue;
131
- const entry = selectTopLevelFileEntry(entries, fileName);
132
- if (entry) await addFile(results, root, entry.name, fileName, signal);
133
- }
134
- for (const relativePath of selection.custom) {
135
- if (!excluded(relativePath)) await collectIncludedPath(results, root, relativePath, signal, excluded);
136
- }
137
- if (selection.sessions && !excluded("sessions")) {
138
- try {
139
- await collectDirectory(results, sessionStorageRoot(root, options.sessionDir), "", {
140
- sessionsOnly: true,
141
- excluded,
142
- virtualPrefix: "sessions",
143
- signal
144
- });
145
- } catch (error) {
146
- if (error.code !== "ENOENT") throw error;
147
- }
148
- }
149
- signal?.throwIfAborted();
150
- return results.sort((left, right) => left.path.localeCompare(right.path));
151
- }
152
- async function collectIncludedPath(results, root, relativePath, signal, excluded) {
153
- signal?.throwIfAborted();
154
- const absolutePath = safeJoin(root, relativePath);
155
- try {
156
- const stat = await fs.lstat(absolutePath);
157
- signal?.throwIfAborted();
158
- if (stat.isFile()) await addFile(results, root, relativePath, relativePath, signal);
159
- else if (stat.isDirectory()) await collectDirectory(results, root, relativePath, { signal, excluded });
160
- } catch (error) {
161
- if (error.code !== "ENOENT") throw error;
162
- if (!relativePath.includes("/")) {
163
- const entries = await fs.readdir(root, { withFileTypes: true });
164
- signal?.throwIfAborted();
165
- const entry = selectTopLevelFileEntry(entries, relativePath);
166
- if (entry) await addFile(results, root, entry.name, relativePath, signal);
167
- }
168
- }
169
- }
170
- async function collectDirectory(results, root, relativeDirectory, options = {}) {
171
- options.signal?.throwIfAborted();
172
- const absoluteDirectory = path.join(root, relativeDirectory);
173
- for (const entry of await fs.readdir(absoluteDirectory, { withFileTypes: true })) {
174
- options.signal?.throwIfAborted();
175
- const relativePath = relativeDirectory ? posixJoin(relativeDirectory, entry.name) : entry.name;
176
- const snapshotPath = options.virtualPrefix ? posixJoin(options.virtualPrefix, relativePath) : relativePath;
177
- if (isDeniedPath(snapshotPath) || options.excluded?.(snapshotPath)) continue;
178
- if (entry.isDirectory()) {
179
- await collectDirectory(results, root, relativePath, options);
180
- } else if (entry.isFile() && (!options.sessionsOnly || isSessionFilePath(snapshotPath))) {
181
- await addFile(results, root, relativePath, snapshotPath, options.signal);
182
- }
183
- }
184
- }
185
- async function addFile(results, root, relativePath, snapshotPath = relativePath, signal) {
186
- signal?.throwIfAborted();
187
- if (!isSafeSnapshotPath(snapshotPath)) return;
188
- const absolutePath = safeJoin(root, relativePath);
189
- const content = await fs.readFile(absolutePath, { signal });
190
- signal?.throwIfAborted();
191
- results.push({
192
- path: snapshotPath,
193
- contentBase64: content.toString("base64"),
194
- sha256: sha256(content)
195
- });
196
- }
197
- function isSessionPath(relativePath) {
198
- return toPosix(relativePath).startsWith("sessions/");
199
- }
200
- function isSessionFilePath(relativePath) {
201
- const normalized = toPosix(relativePath);
202
- return isSessionPath(normalized) && normalized.endsWith(".jsonl");
203
- }
204
- function sessionSnapshotPathFromAbsolute(sessionFile, configuredSessionDir2) {
205
- const relativePath = toPosix(path.relative(sessionStorageRoot(agentDir(), configuredSessionDir2), sessionFile));
206
- if (!relativePath || relativePath.startsWith("../") || path.posix.isAbsolute(relativePath)) {
207
- return void 0;
208
- }
209
- const snapshotPath = posixJoin("sessions", relativePath);
210
- return isSessionFilePath(snapshotPath) ? snapshotPath : void 0;
211
- }
212
- function snapshotTarget(root, relativePath, configuredSessionDir2) {
213
- if (isSessionPath(relativePath)) {
214
- return safeJoin(sessionStorageRoot(root, configuredSessionDir2), relativePath.slice("sessions/".length));
215
- }
216
- return safeJoin(root, relativePath);
217
- }
218
- function snapshotIncludesSessions(snapshot) {
219
- return snapshot.syncSessions === true || snapshotSelectionInclude(snapshot)?.includes("sessions") === true && !compileSyncExclude(snapshotSelectionExclude(snapshot))("sessions") || snapshot.files.some((file) => isSessionPath(file.path));
220
- }
221
- function filterSnapshotForConfigPolicy(snapshot, config, options = {}) {
222
- const include = includeFromSelectionConfig(config);
223
- const includePaths = customIncludePathsByLower(include);
224
- const exclude = config.exclude ?? (snapshot.version === 4 ? [] : void 0);
225
- const filtered = {
226
- ...snapshot,
227
- version: exclude === void 0 ? snapshot.version : 4,
228
- syncSessions: include.includes("sessions") && !compileSyncExclude(exclude)("sessions") ? snapshot.syncSessions : false,
229
- selection: selectionForSnapshot(include, exclude),
230
- files: canonicalizeSnapshotFilesForConfig(snapshot.files, config, includePaths)
231
- };
232
- if (!options.regenerateId || snapshotsMatch(snapshot, filtered)) return filtered;
233
- return {
234
- ...filtered,
235
- id: snapshotId(),
236
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
237
- machine: os.hostname()
238
- };
239
- }
240
- function canonicalizeSnapshotFilesForConfig(files, config, includePaths) {
241
- const configuredFiles = [];
242
- const extraCandidates = /* @__PURE__ */ new Map();
243
- const configured = configuredSnapshotPathMatcher(config);
244
- for (const file of files) {
245
- const normalized = toPosix(file.path);
246
- if (!isSafeSnapshotPath(file.path) || !configured(normalized)) {
247
- continue;
248
- }
249
- if (normalized.includes("/")) {
250
- configuredFiles.push(normalized === file.path ? file : { ...file, path: normalized });
251
- continue;
252
- }
253
- const topLevelPath = canonicalSnapshotPathForConfig(normalized, includePaths);
254
- const candidate = {
255
- exact: normalized === topLevelPath,
256
- file: { ...file, path: topLevelPath },
257
- originalPath: normalized
258
- };
259
- const current = extraCandidates.get(topLevelPath.toLowerCase());
260
- if (!current || isPreferredExtraCandidate(candidate, current)) {
261
- extraCandidates.set(topLevelPath.toLowerCase(), candidate);
262
- }
263
- }
264
- return [...configuredFiles, ...[...extraCandidates.values()].map((candidate) => candidate.file)].sort(
265
- (left, right) => left.path.localeCompare(right.path)
266
- );
267
- }
268
- function isPreferredExtraCandidate(left, right) {
269
- if (left.exact !== right.exact) return left.exact;
270
- return left.originalPath.localeCompare(right.originalPath) < 0;
271
- }
272
- function snapshotWithoutSessions(snapshot) {
273
- const files = snapshot.files.filter((file) => !isSessionPath(file.path));
274
- const include = snapshotSelectionInclude(snapshot)?.filter((item) => item !== "sessions");
275
- if (files.length === snapshot.files.length && snapshot.syncSessions !== true && include?.length === snapshot.selection?.include.length) {
276
- return snapshot;
277
- }
278
- return {
279
- ...snapshot,
280
- id: snapshotId(),
281
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
282
- machine: os.hostname(),
283
- syncSessions: false,
284
- ...include ? { selection: selectionForSnapshot(include, snapshotSelectionExclude(snapshot)) } : {},
285
- files
286
- };
287
- }
288
- function scanSnapshot(snapshot) {
289
- const findings = [];
290
- for (const file of snapshot.files) {
291
- const content = Buffer.from(file.contentBase64, "base64");
292
- if (content.includes(0)) continue;
293
- const text = content.toString("utf8");
294
- for (const pattern of SECRET_PATTERNS) {
295
- if (pattern.test(text)) {
296
- findings.push(file.path);
297
- break;
298
- }
299
- }
300
- }
301
- return findings;
302
- }
303
- function mergeRemotePreservedFiles(local, remote, config) {
304
- const localPathNames = new Set(local.files.map((file) => file.path.toLowerCase()));
305
- const preservedPathNames = /* @__PURE__ */ new Set();
306
- const configured = configuredSnapshotPathMatcher(config);
307
- const excluded = compileSyncExclude(config.exclude);
308
- const preserved = remote.files.filter((file) => {
309
- const normalized = toPosix(file.path);
310
- const lower = normalized.toLowerCase();
311
- if (localPathNames.has(lower) || preservedPathNames.has(lower) || !isSafeSnapshotPath(file.path) || configured(normalized) || excluded(normalized) || !isPreservableUnmanagedSnapshotPath(normalized)) {
312
- return false;
313
- }
314
- preservedPathNames.add(lower);
315
- return true;
316
- });
317
- if (preserved.length === 0) return local;
318
- return {
319
- ...local,
320
- id: snapshotId(),
321
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
322
- machine: os.hostname(),
323
- syncSessions: !excluded("sessions") && (snapshotIncludesSessions(local) || snapshotIncludesSessions(remote)),
324
- files: [...local.files, ...preserved].sort((left, right) => left.path.localeCompare(right.path))
325
- };
326
- }
327
- function mergeRemoteSessionFiles(local, remote) {
328
- const excluded = compileSyncExclude(snapshotSelectionExclude(local));
329
- if (excluded("sessions")) return local;
330
- const remoteSessions = remote.files.filter((file) => {
331
- const normalized = toPosix(file.path);
332
- return isSessionFilePath(normalized) && isSafeSnapshotPath(file.path) && !excluded(normalized);
333
- });
334
- if (remoteSessions.length === 0 && !snapshotIncludesSessions(remote)) return local;
335
- const localInclude = snapshotSelectionInclude(local);
336
- return {
337
- ...local,
338
- id: snapshotId(),
339
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
340
- machine: os.hostname(),
341
- syncSessions: true,
342
- ...localInclude ? {
343
- selection: selectionForSnapshot(
344
- localInclude.includes("sessions") ? localInclude : [...localInclude, "sessions"],
345
- snapshotSelectionExclude(local)
346
- )
347
- } : {},
348
- files: [...local.files.filter((file) => !isSessionPath(file.path)), ...remoteSessions].sort(
349
- (left, right) => left.path.localeCompare(right.path)
350
- )
351
- };
352
- }
353
-
354
- export {
355
- regenerateSnapshotIdentity,
356
- createSnapshot,
357
- collectFiles,
358
- isSessionPath,
359
- isSessionFilePath,
360
- sessionSnapshotPathFromAbsolute,
361
- snapshotTarget,
362
- snapshotIncludesSessions,
363
- filterSnapshotForConfigPolicy,
364
- snapshotWithoutSessions,
365
- scanSnapshot,
366
- mergeRemotePreservedFiles,
367
- mergeRemoteSessionFiles
368
- };
369
- //# sourceMappingURL=chunk-MKC3PXCN.ts.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/snapshot/snapshot.ts"],
4
- "sourcesContent": ["import { createHash, randomUUID } from \"node:crypto\";\nimport type { Dirent } from \"node:fs\";\nimport fs from \"node:fs/promises\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { isDeniedPath, posixJoin, safeJoin, toPosix } from \"../paths.js\";\nimport { agentDir, configuredSessionDir } from \"./session-paths.js\";\nimport { sessionStorageRoot } from \"./snapshot-paths.js\";\n\nexport { isDeniedPath } from \"../paths.js\";\nexport { sessionStorageRoot } from \"./snapshot-paths.js\";\n\nimport { compileSyncExclude } from \"../sync/exclude-policy.js\";\nimport {\n canonicalSnapshotPathForConfig,\n configuredSnapshotPathMatcher,\n customIncludePathsByLower,\n DEFAULT_SYNC_INCLUDE,\n includeFromSelectionConfig,\n isPreservableUnmanagedSnapshotPath,\n normalizeExtraFiles,\n normalizeSyncFiles,\n type SyncSelectionConfig,\n sameSnapshotSelection,\n selectionForSnapshot,\n snapshotSelectionExclude,\n snapshotSelectionInclude,\n syncIncludeSelection,\n} from \"../sync/sync-policy.js\";\nimport type { Snapshot, SnapshotFile, SnapshotOptions } from \"./snapshot-types.js\";\n\nexport { canonicalSnapshotPathForConfig, isConfiguredSnapshotPath } from \"../sync/sync-policy.js\";\n\nconst VERSION = 1;\nconst TOP_LEVEL_FILES: readonly string[] = DEFAULT_SYNC_INCLUDE.filter((name) => name.includes(\".\"));\nconst TOP_LEVEL_DIRS = new Set<string>(DEFAULT_SYNC_INCLUDE.filter((name) => !name.includes(\".\")));\nconst SECRET_PATTERNS = [\n /AWS_SECRET_ACCESS_KEY\\s*[=:]\\s*['\"]?[A-Za-z0-9/+]{35,}/i,\n /(ANTHROPIC|OPENAI|GEMINI|GOOGLE|FIRECRAWL|GITHUB|CLOUDFLARE|R2|S3)_[A-Z0-9_]*(KEY|TOKEN|SECRET)\\s*[=:]\\s*['\"]?[^\\s'\"]{12,}/i,\n /sk-ant-[A-Za-z0-9_-]{20,}/,\n /sk-[A-Za-z0-9]{20,}/,\n /gh[pousr]_[A-Za-z0-9_]{20,}/,\n];\n\nfunction selectTopLevelFileEntry(entries: Dirent[], fileName: string) {\n const exact = entries.find((entry) => entry.isFile() && entry.name === fileName);\n if (exact) return exact;\n const lower = fileName.toLowerCase();\n return entries\n .filter((entry) => entry.isFile() && entry.name.toLowerCase() === lower)\n .sort((left, right) => left.name.localeCompare(right.name))[0];\n}\n\nfunction sha256(value: Buffer) {\n return createHash(\"sha256\").update(value).digest(\"hex\");\n}\n\nfunction isSafeSnapshotPath(relativePath: string) {\n if (relativePath.includes(\"\\\\\")) return false;\n const normalized = toPosix(relativePath);\n return (\n Boolean(normalized) &&\n normalized !== \".\" &&\n normalized !== \"..\" &&\n !normalized.startsWith(\"../\") &&\n !path.posix.isAbsolute(normalized) &&\n path.posix.normalize(normalized) === normalized &&\n !isDeniedPath(normalized)\n );\n}\n\nfunction snapshotsMatch(left: Snapshot, right: Snapshot) {\n const leftHashes = new Map(left.files.map((file) => [file.path, file.sha256]));\n const rightHashes = new Map(right.files.map((file) => [file.path, file.sha256]));\n return (\n left.syncSessions === right.syncSessions &&\n sameSnapshotSelection(left.selection, right.selection) &&\n leftHashes.size === rightHashes.size &&\n [...leftHashes].every(([filePath, hash]) => rightHashes.get(filePath) === hash)\n );\n}\n\nfunction snapshotId() {\n return `${new Date().toISOString().replace(/[:.]/g, \"-\")}-${randomUUID().slice(0, 8)}`;\n}\n\nexport function regenerateSnapshotIdentity(snapshot: Snapshot): Snapshot {\n return {\n ...snapshot,\n id: snapshotId(),\n createdAt: new Date().toISOString(),\n machine: os.hostname(),\n };\n}\n\nexport async function createSnapshot(profile: string, options: SnapshotOptions = {}): Promise<Snapshot> {\n options.signal?.throwIfAborted();\n const include = effectiveInclude(options);\n const excluded = compileSyncExclude(options.exclude);\n const syncSessions = include.includes(\"sessions\") && !excluded(\"sessions\");\n const needsSessionConfig = syncSessions || !excluded(\"settings.json\");\n const sessionDir = options.sessionDir ?? (needsSessionConfig ? await configuredSessionDir() : undefined);\n options.signal?.throwIfAborted();\n const files = await collectFiles(\n agentDir(),\n {\n include,\n exclude: options.exclude,\n sessionDir,\n signal: options.signal,\n },\n excluded,\n );\n options.signal?.throwIfAborted();\n return {\n version: options.exclude === undefined ? VERSION : 4,\n id: snapshotId(),\n createdAt: new Date().toISOString(),\n machine: os.hostname(),\n profile,\n syncSessions,\n selection: selectionForSnapshot(include, options.exclude),\n files,\n };\n}\n\nfunction effectiveInclude(options: SnapshotOptions) {\n if (options.include) return options.include;\n return [\n ...normalizeSyncFiles(options.syncFiles),\n ...normalizeExtraFiles(options.extraFiles),\n ...(options.syncSessions ? [\"sessions\"] : []),\n ];\n}\n\nexport async function collectFiles(\n root: string,\n options: SnapshotOptions = {},\n excluded = compileSyncExclude(options.exclude),\n): Promise<SnapshotFile[]> {\n const signal = options.signal;\n signal?.throwIfAborted();\n const results: SnapshotFile[] = [];\n const entries = await fs.readdir(root, { withFileTypes: true });\n signal?.throwIfAborted();\n const selection = syncIncludeSelection(effectiveInclude(options));\n const selectedFiles = new Set<string>(selection.builtIns);\n for (const entry of entries) {\n if (\n entry.isDirectory() &&\n TOP_LEVEL_DIRS.has(entry.name) &&\n selectedFiles.has(entry.name) &&\n !excluded(entry.name)\n ) {\n await collectDirectory(results, root, entry.name, { signal, excluded });\n }\n }\n for (const fileName of TOP_LEVEL_FILES) {\n if (!selectedFiles.has(fileName) || excluded(fileName)) continue;\n const entry = selectTopLevelFileEntry(entries, fileName);\n if (entry) await addFile(results, root, entry.name, fileName, signal);\n }\n for (const relativePath of selection.custom) {\n if (!excluded(relativePath)) await collectIncludedPath(results, root, relativePath, signal, excluded);\n }\n if (selection.sessions && !excluded(\"sessions\")) {\n try {\n await collectDirectory(results, sessionStorageRoot(root, options.sessionDir), \"\", {\n sessionsOnly: true,\n excluded,\n virtualPrefix: \"sessions\",\n signal,\n });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n }\n }\n signal?.throwIfAborted();\n return results.sort((left, right) => left.path.localeCompare(right.path));\n}\n\nasync function collectIncludedPath(\n results: SnapshotFile[],\n root: string,\n relativePath: string,\n signal?: AbortSignal,\n excluded?: (relativePath: string) => boolean,\n) {\n signal?.throwIfAborted();\n const absolutePath = safeJoin(root, relativePath);\n try {\n const stat = await fs.lstat(absolutePath);\n signal?.throwIfAborted();\n if (stat.isFile()) await addFile(results, root, relativePath, relativePath, signal);\n else if (stat.isDirectory()) await collectDirectory(results, root, relativePath, { signal, excluded });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n if (!relativePath.includes(\"/\")) {\n const entries = await fs.readdir(root, { withFileTypes: true });\n signal?.throwIfAborted();\n const entry = selectTopLevelFileEntry(entries, relativePath);\n if (entry) await addFile(results, root, entry.name, relativePath, signal);\n }\n }\n}\n\nasync function collectDirectory(\n results: SnapshotFile[],\n root: string,\n relativeDirectory: string,\n options: {\n sessionsOnly?: boolean;\n virtualPrefix?: string;\n signal?: AbortSignal;\n excluded?: (relativePath: string) => boolean;\n } = {},\n) {\n options.signal?.throwIfAborted();\n const absoluteDirectory = path.join(root, relativeDirectory);\n for (const entry of await fs.readdir(absoluteDirectory, { withFileTypes: true })) {\n options.signal?.throwIfAborted();\n const relativePath = relativeDirectory ? posixJoin(relativeDirectory, entry.name) : entry.name;\n const snapshotPath = options.virtualPrefix ? posixJoin(options.virtualPrefix, relativePath) : relativePath;\n if (isDeniedPath(snapshotPath) || options.excluded?.(snapshotPath)) continue;\n if (entry.isDirectory()) {\n await collectDirectory(results, root, relativePath, options);\n } else if (entry.isFile() && (!options.sessionsOnly || isSessionFilePath(snapshotPath))) {\n await addFile(results, root, relativePath, snapshotPath, options.signal);\n }\n }\n}\n\nasync function addFile(\n results: SnapshotFile[],\n root: string,\n relativePath: string,\n snapshotPath = relativePath,\n signal?: AbortSignal,\n) {\n signal?.throwIfAborted();\n if (!isSafeSnapshotPath(snapshotPath)) return;\n const absolutePath = safeJoin(root, relativePath);\n const content = await fs.readFile(absolutePath, { signal });\n signal?.throwIfAborted();\n results.push({\n path: snapshotPath,\n contentBase64: content.toString(\"base64\"),\n sha256: sha256(content),\n });\n}\n\nexport function isSessionPath(relativePath: string) {\n return toPosix(relativePath).startsWith(\"sessions/\");\n}\n\nexport function isSessionFilePath(relativePath: string) {\n const normalized = toPosix(relativePath);\n return isSessionPath(normalized) && normalized.endsWith(\".jsonl\");\n}\n\nexport function sessionSnapshotPathFromAbsolute(sessionFile: string, configuredSessionDir?: string) {\n const relativePath = toPosix(path.relative(sessionStorageRoot(agentDir(), configuredSessionDir), sessionFile));\n if (!relativePath || relativePath.startsWith(\"../\") || path.posix.isAbsolute(relativePath)) {\n return undefined;\n }\n const snapshotPath = posixJoin(\"sessions\", relativePath);\n return isSessionFilePath(snapshotPath) ? snapshotPath : undefined;\n}\n\nexport function snapshotTarget(root: string, relativePath: string, configuredSessionDir?: string) {\n if (isSessionPath(relativePath)) {\n return safeJoin(sessionStorageRoot(root, configuredSessionDir), relativePath.slice(\"sessions/\".length));\n }\n return safeJoin(root, relativePath);\n}\n\nexport function snapshotIncludesSessions(snapshot: Snapshot) {\n return (\n snapshot.syncSessions === true ||\n (snapshotSelectionInclude(snapshot)?.includes(\"sessions\") === true &&\n !compileSyncExclude(snapshotSelectionExclude(snapshot))(\"sessions\")) ||\n snapshot.files.some((file) => isSessionPath(file.path))\n );\n}\n\nexport function filterSnapshotForConfigPolicy(\n snapshot: Snapshot,\n config: SyncSelectionConfig,\n options: { regenerateId?: boolean } = {},\n) {\n const include = includeFromSelectionConfig(config);\n const includePaths = customIncludePathsByLower(include);\n const exclude = config.exclude ?? (snapshot.version === 4 ? [] : undefined);\n const filtered = {\n ...snapshot,\n version: exclude === undefined ? snapshot.version : 4,\n syncSessions:\n include.includes(\"sessions\") && !compileSyncExclude(exclude)(\"sessions\") ? snapshot.syncSessions : false,\n selection: selectionForSnapshot(include, exclude),\n files: canonicalizeSnapshotFilesForConfig(snapshot.files, config, includePaths),\n };\n if (!options.regenerateId || snapshotsMatch(snapshot, filtered)) return filtered;\n return {\n ...filtered,\n id: snapshotId(),\n createdAt: new Date().toISOString(),\n machine: os.hostname(),\n };\n}\n\nfunction canonicalizeSnapshotFilesForConfig(\n files: SnapshotFile[],\n config: SyncSelectionConfig,\n includePaths: Map<string, string>,\n) {\n const configuredFiles: SnapshotFile[] = [];\n const extraCandidates = new Map<string, { exact: boolean; file: SnapshotFile; originalPath: string }>();\n const configured = configuredSnapshotPathMatcher(config);\n for (const file of files) {\n const normalized = toPosix(file.path);\n if (!isSafeSnapshotPath(file.path) || !configured(normalized)) {\n continue;\n }\n if (normalized.includes(\"/\")) {\n configuredFiles.push(normalized === file.path ? file : { ...file, path: normalized });\n continue;\n }\n const topLevelPath = canonicalSnapshotPathForConfig(normalized, includePaths);\n const candidate = {\n exact: normalized === topLevelPath,\n file: { ...file, path: topLevelPath },\n originalPath: normalized,\n };\n const current = extraCandidates.get(topLevelPath.toLowerCase());\n if (!current || isPreferredExtraCandidate(candidate, current)) {\n extraCandidates.set(topLevelPath.toLowerCase(), candidate);\n }\n }\n return [...configuredFiles, ...[...extraCandidates.values()].map((candidate) => candidate.file)].sort((left, right) =>\n left.path.localeCompare(right.path),\n );\n}\n\nfunction isPreferredExtraCandidate(\n left: { exact: boolean; originalPath: string },\n right: { exact: boolean; originalPath: string },\n) {\n if (left.exact !== right.exact) return left.exact;\n return left.originalPath.localeCompare(right.originalPath) < 0;\n}\n\nexport function snapshotWithoutSessions(snapshot: Snapshot) {\n const files = snapshot.files.filter((file) => !isSessionPath(file.path));\n const include = snapshotSelectionInclude(snapshot)?.filter((item) => item !== \"sessions\");\n if (\n files.length === snapshot.files.length &&\n snapshot.syncSessions !== true &&\n include?.length === snapshot.selection?.include.length\n ) {\n return snapshot;\n }\n return {\n ...snapshot,\n id: snapshotId(),\n createdAt: new Date().toISOString(),\n machine: os.hostname(),\n syncSessions: false,\n ...(include ? { selection: selectionForSnapshot(include, snapshotSelectionExclude(snapshot)) } : {}),\n files,\n };\n}\n\nexport function scanSnapshot(snapshot: Snapshot) {\n const findings: string[] = [];\n for (const file of snapshot.files) {\n const content = Buffer.from(file.contentBase64, \"base64\");\n if (content.includes(0)) continue;\n const text = content.toString(\"utf8\");\n for (const pattern of SECRET_PATTERNS) {\n if (pattern.test(text)) {\n findings.push(file.path);\n break;\n }\n }\n }\n return findings;\n}\n\nexport function mergeRemotePreservedFiles(local: Snapshot, remote: Snapshot, config: SyncSelectionConfig) {\n const localPathNames = new Set(local.files.map((file) => file.path.toLowerCase()));\n const preservedPathNames = new Set<string>();\n const configured = configuredSnapshotPathMatcher(config);\n const excluded = compileSyncExclude(config.exclude);\n const preserved = remote.files.filter((file) => {\n const normalized = toPosix(file.path);\n const lower = normalized.toLowerCase();\n if (\n localPathNames.has(lower) ||\n preservedPathNames.has(lower) ||\n !isSafeSnapshotPath(file.path) ||\n configured(normalized) ||\n excluded(normalized) ||\n !isPreservableUnmanagedSnapshotPath(normalized)\n ) {\n return false;\n }\n preservedPathNames.add(lower);\n return true;\n });\n if (preserved.length === 0) return local;\n return {\n ...local,\n id: snapshotId(),\n createdAt: new Date().toISOString(),\n machine: os.hostname(),\n syncSessions: !excluded(\"sessions\") && (snapshotIncludesSessions(local) || snapshotIncludesSessions(remote)),\n files: [...local.files, ...preserved].sort((left, right) => left.path.localeCompare(right.path)),\n };\n}\n\nexport function mergeRemoteSessionFiles(local: Snapshot, remote: Snapshot) {\n const excluded = compileSyncExclude(snapshotSelectionExclude(local));\n if (excluded(\"sessions\")) return local;\n const remoteSessions = remote.files.filter((file) => {\n const normalized = toPosix(file.path);\n return isSessionFilePath(normalized) && isSafeSnapshotPath(file.path) && !excluded(normalized);\n });\n if (remoteSessions.length === 0 && !snapshotIncludesSessions(remote)) return local;\n const localInclude = snapshotSelectionInclude(local);\n return {\n ...local,\n id: snapshotId(),\n createdAt: new Date().toISOString(),\n machine: os.hostname(),\n syncSessions: true,\n ...(localInclude\n ? {\n selection: selectionForSnapshot(\n localInclude.includes(\"sessions\") ? localInclude : [...localInclude, \"sessions\"],\n snapshotSelectionExclude(local),\n ),\n }\n : {}),\n files: [...local.files.filter((file) => !isSessionPath(file.path)), ...remoteSessions].sort((left, right) =>\n left.path.localeCompare(right.path),\n ),\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,kBAAkB;AAEvC,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AA6BjB,IAAM,UAAU;AAChB,IAAM,kBAAqC,qBAAqB,OAAO,CAAC,SAAS,KAAK,SAAS,GAAG,CAAC;AACnG,IAAM,iBAAiB,IAAI,IAAY,qBAAqB,OAAO,CAAC,SAAS,CAAC,KAAK,SAAS,GAAG,CAAC,CAAC;AACjG,IAAM,kBAAkB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,wBAAwB,SAAmB,UAAkB;AACpE,QAAM,QAAQ,QAAQ,KAAK,CAAC,UAAU,MAAM,OAAO,KAAK,MAAM,SAAS,QAAQ;AAC/E,MAAI,MAAO,QAAO;AAClB,QAAM,QAAQ,SAAS,YAAY;AACnC,SAAO,QACJ,OAAO,CAAC,UAAU,MAAM,OAAO,KAAK,MAAM,KAAK,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SAAS;AACnD,UAAM,aAAa,QAAQ,KAAK,IAAI;AACpC,WAAO,kBAAkB,UAAU,KAAK,mBAAmB,KAAK,IAAI,KAAK,CAAC,SAAS,UAAU;AAAA,EAC/F,CAAC;AACD,MAAI,eAAe,WAAW,KAAK,CAAC,yBAAyB,MAAM,EAAG,QAAO;AAC7E,QAAM,eAAe,yBAAyB,KAAK;AACnD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,IAAI,WAAW;AAAA,IACf,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,IAClC,SAAS,GAAG,SAAS;AAAA,IACrB,cAAc;AAAA,IACd,GAAI,eACA;AAAA,MACE,WAAW;AAAA,QACT,aAAa,SAAS,UAAU,IAAI,eAAe,CAAC,GAAG,cAAc,UAAU;AAAA,QAC/E,yBAAyB,KAAK;AAAA,MAChC;AAAA,IACF,IACA,CAAC;AAAA,IACL,OAAO,CAAC,GAAG,MAAM,MAAM,OAAO,CAAC,SAAS,CAAC,cAAc,KAAK,IAAI,CAAC,GAAG,GAAG,cAAc,EAAE;AAAA,MAAK,CAAC,MAAM,UACjG,KAAK,KAAK,cAAc,MAAM,IAAI;AAAA,IACpC;AAAA,EACF;AACF;",
6
- "names": ["configuredSessionDir"]
7
- }
@@ -1,88 +0,0 @@
1
- // @generated by scripts/build-runtime.mjs; do not edit.
2
- // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
- import {
4
- sameLocalFields,
5
- validatePortableSnapshot
6
- } from "./chunk-P3YD4ONV.ts";
7
- import {
8
- safeTerminalText
9
- } from "./chunk-AMJRUXFT.ts";
10
- import {
11
- syncConfigReviewFingerprint
12
- } from "./chunk-XZ3ZTHKR.ts";
13
- import {
14
- throwIfAborted
15
- } from "./chunk-PWMWOJP4.ts";
16
- import {
17
- filterSnapshotForConfigPolicy
18
- } from "./chunk-MKC3PXCN.ts";
19
- import {
20
- inspectRemoteSelection,
21
- remoteSelectionMismatch,
22
- sameSnapshotSelection
23
- } from "./chunk-WUHRVSWI.ts";
24
-
25
- // src/sync/remote-snapshot.ts
26
- async function readSnapshotForHead(backend, head, signal) {
27
- const snapshot = await backend.readSnapshot(head.snapshotRef, signal);
28
- throwIfAborted(signal);
29
- validatePortableSnapshot(snapshot);
30
- if (snapshot.id !== head.snapshotId) {
31
- throw new Error(`Remote head ${head.snapshotId} resolved to unexpected snapshot ${snapshot.id}.`);
32
- }
33
- if (head.selection) {
34
- if (!sameSnapshotSelection(head.selection, snapshot.selection)) {
35
- throw new Error("Remote head selection does not match its immutable snapshot.");
36
- }
37
- }
38
- return snapshot;
39
- }
40
- function requireCompatibleRemoteSelection(config, snapshot) {
41
- if (!sameLocalFields(config.localFields, snapshot.localFields))
42
- throw new Error(
43
- "Remote local-field policy differs; confirm a reviewed directional migration. Old history is not erased."
44
- );
45
- const state = inspectRemoteSelection(config.include, snapshot, config.exclude);
46
- if (state.kind === "different") {
47
- throw remoteSelectionMismatch(config, state.include, syncConfigReviewFingerprint(config), state.exclude);
48
- }
49
- }
50
- function formatRemoteSelectionStatus(state) {
51
- if (!state) return "remote included content: unavailable (remote is empty)";
52
- if (state.kind === "same") return "remote included content: matches this setup";
53
- if (state.kind === "legacy") {
54
- return `remote included content: unavailable in legacy snapshot (${state.discovered.length} path${state.discovered.length === 1 ? "" : "s"} discovered, partial)`;
55
- }
56
- return [
57
- "remote included content: differs from this setup",
58
- `remote-only selection: ${safeList(state.remoteOnly)}`,
59
- `local-only selection: ${safeList(state.localOnly)}`,
60
- `remote excluded paths: ${safeList(state.exclude ?? [])}`
61
- ].join("\n");
62
- }
63
- function safeList(values) {
64
- return values.length > 0 ? values.map(safeTerminalText).join(", ") : "none";
65
- }
66
- async function readRemoteSnapshot(backend, config, signal, options = {}) {
67
- const head = await backend.readHead(signal);
68
- if (!head) return { head: void 0, snapshot: void 0, selectionState: void 0 };
69
- const snapshot = await readSnapshotForHead(backend, head, signal);
70
- const selectionState = inspectRemoteSelection(config.include, snapshot, config.exclude);
71
- if (!options.allowSelectionDifference && selectionState.kind === "different") {
72
- const configIdentity = syncConfigReviewFingerprint(config);
73
- throw remoteSelectionMismatch(config, selectionState.include, configIdentity, selectionState.exclude);
74
- }
75
- return {
76
- head,
77
- snapshot: filterSnapshotForConfigPolicy(snapshot, config),
78
- selectionState
79
- };
80
- }
81
-
82
- export {
83
- readSnapshotForHead,
84
- requireCompatibleRemoteSelection,
85
- formatRemoteSelectionStatus,
86
- readRemoteSnapshot
87
- };
88
- //# sourceMappingURL=chunk-OQBE2OMB.ts.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/sync/remote-snapshot.ts"],
4
- "sourcesContent": ["import type { RemoteHead, SyncBackend } from \"../backends/sync-backend.js\";\nimport { syncConfigReviewFingerprint } from \"../settings/config.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { filterSnapshotForConfigPolicy } from \"../snapshot/snapshot.js\";\nimport type { Snapshot } from \"../snapshot/snapshot-types.js\";\nimport { safeTerminalText } from \"../ui/terminal-text.js\";\nimport { sameLocalFields, validatePortableSnapshot } from \"./local-fields.js\";\nimport { throwIfAborted } from \"./signals.js\";\nimport {\n inspectRemoteSelection,\n type RemoteSelectionState,\n remoteSelectionMismatch,\n sameSnapshotSelection,\n} from \"./sync-policy.js\";\n\nexport async function readSnapshotForHead(backend: SyncBackend, head: RemoteHead, signal?: AbortSignal) {\n const snapshot = await backend.readSnapshot(head.snapshotRef, signal);\n throwIfAborted(signal);\n validatePortableSnapshot(snapshot);\n if (snapshot.id !== head.snapshotId) {\n throw new Error(`Remote head ${head.snapshotId} resolved to unexpected snapshot ${snapshot.id}.`);\n }\n if (head.selection) {\n if (!sameSnapshotSelection(head.selection, snapshot.selection)) {\n throw new Error(\"Remote head selection does not match its immutable snapshot.\");\n }\n }\n return snapshot;\n}\n\nexport function requireCompatibleRemoteSelection(config: AnySyncConfig, snapshot: Snapshot) {\n if (!sameLocalFields(config.localFields, snapshot.localFields))\n throw new Error(\n \"Remote local-field policy differs; confirm a reviewed directional migration. Old history is not erased.\",\n );\n const state = inspectRemoteSelection(config.include, snapshot, config.exclude);\n if (state.kind === \"different\") {\n throw remoteSelectionMismatch(config, state.include, syncConfigReviewFingerprint(config), state.exclude);\n }\n}\n\nexport function formatRemoteSelectionStatus(state: RemoteSelectionState | undefined) {\n if (!state) return \"remote included content: unavailable (remote is empty)\";\n if (state.kind === \"same\") return \"remote included content: matches this setup\";\n if (state.kind === \"legacy\") {\n return `remote included content: unavailable in legacy snapshot (${state.discovered.length} path${state.discovered.length === 1 ? \"\" : \"s\"} discovered, partial)`;\n }\n return [\n \"remote included content: differs from this setup\",\n `remote-only selection: ${safeList(state.remoteOnly)}`,\n `local-only selection: ${safeList(state.localOnly)}`,\n `remote excluded paths: ${safeList(state.exclude ?? [])}`,\n ].join(\"\\n\");\n}\n\nfunction safeList(values: readonly string[]) {\n return values.length > 0 ? values.map(safeTerminalText).join(\", \") : \"none\";\n}\n\nexport async function readRemoteSnapshot(\n backend: SyncBackend,\n config: AnySyncConfig,\n signal?: AbortSignal,\n options: { allowSelectionDifference?: boolean } = {},\n) {\n const head = await backend.readHead(signal);\n if (!head) return { head: undefined, snapshot: undefined, selectionState: undefined };\n const snapshot = await readSnapshotForHead(backend, head, signal);\n const selectionState = inspectRemoteSelection(config.include, snapshot, config.exclude);\n if (!options.allowSelectionDifference && selectionState.kind === \"different\") {\n const configIdentity = syncConfigReviewFingerprint(config);\n throw remoteSelectionMismatch(config, selectionState.include, configIdentity, selectionState.exclude);\n }\n return {\n head,\n snapshot: filterSnapshotForConfigPolicy(snapshot, config),\n selectionState,\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAeA,eAAsB,oBAAoB,SAAsB,MAAkB,QAAsB;AACtG,QAAM,WAAW,MAAM,QAAQ,aAAa,KAAK,aAAa,MAAM;AACpE,iBAAe,MAAM;AACrB,2BAAyB,QAAQ;AACjC,MAAI,SAAS,OAAO,KAAK,YAAY;AAC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