@narumitw/pi-sync 0.58.1 → 0.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +28 -15
  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-MG66XM5U.ts → chunk-4RNCZZY7.ts} +86 -36
  6. package/dist/chunks/chunk-4RNCZZY7.ts.map +7 -0
  7. package/dist/chunks/{config-HYG7G5EM.ts → chunk-7AC2RX4M.ts} +6 -12
  8. package/dist/chunks/chunk-7AC2RX4M.ts.map +7 -0
  9. package/dist/chunks/{chunk-XEODG2PE.ts → chunk-BGGKHHO4.ts} +18 -14
  10. package/dist/chunks/{chunk-XEODG2PE.ts.map → chunk-BGGKHHO4.ts.map} +1 -1
  11. package/dist/chunks/chunk-BWWTOQOW.ts +737 -0
  12. package/dist/chunks/chunk-BWWTOQOW.ts.map +7 -0
  13. package/dist/chunks/chunk-CEMFCWIU.ts +20 -0
  14. package/dist/chunks/chunk-CEMFCWIU.ts.map +7 -0
  15. package/dist/chunks/chunk-CZNBKIM5.ts +20 -0
  16. package/dist/chunks/chunk-CZNBKIM5.ts.map +7 -0
  17. package/dist/chunks/{chunk-YIPK23JW.ts → chunk-ENFHHB5O.ts} +1 -16
  18. package/dist/chunks/{chunk-YIPK23JW.ts.map → chunk-ENFHHB5O.ts.map} +1 -1
  19. package/dist/chunks/{chunk-KHBPED6W.ts → chunk-GSQGBVKG.ts} +2 -2
  20. package/dist/chunks/chunk-HNKLBM3U.ts +18 -0
  21. package/dist/chunks/chunk-HNKLBM3U.ts.map +7 -0
  22. package/dist/chunks/{chunk-QPC5HT3A.ts → chunk-J5COV5TY.ts} +21 -2
  23. package/dist/chunks/chunk-J5COV5TY.ts.map +7 -0
  24. package/dist/chunks/chunk-JKBUYCPC.ts +52 -0
  25. package/dist/chunks/chunk-JKBUYCPC.ts.map +7 -0
  26. package/dist/chunks/chunk-JZKCOM62.ts +26 -0
  27. package/dist/chunks/chunk-JZKCOM62.ts.map +7 -0
  28. package/dist/chunks/chunk-M7RHV3H6.ts +33 -0
  29. package/dist/chunks/chunk-M7RHV3H6.ts.map +7 -0
  30. package/dist/chunks/{chunk-REMGB255.ts → chunk-MIXZVHFR.ts} +35 -10
  31. package/dist/chunks/chunk-MIXZVHFR.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-JYILGR3K.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-U6GXGY5G.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-MRXE5AKK.ts → command-handler-3O76V7Q5.ts} +83 -87
  46. package/dist/chunks/command-handler-3O76V7Q5.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-EPHGR2DU.ts → continuous-record-ZHUXVO4E.ts} +5 -13
  50. package/dist/chunks/continuous-record-ZHUXVO4E.ts.map +7 -0
  51. package/dist/chunks/{file-selection-IELTXSGZ.ts → file-selection-S6CNNNQI.ts} +14 -14
  52. package/dist/chunks/file-selection-S6CNNNQI.ts.map +7 -0
  53. package/dist/chunks/manager-result-dispatcher-I2AMCCE7.ts +18 -0
  54. package/dist/chunks/{manager-ui-AY34N4UY.ts → manager-ui-SJOBTJLY.ts} +221 -147
  55. package/dist/chunks/manager-ui-SJOBTJLY.ts.map +7 -0
  56. package/dist/chunks/merge-review-SGDLMVS4.ts +10 -0
  57. package/dist/chunks/remote-selection-ui-GZHPDQ4L.ts +17 -0
  58. package/dist/chunks/{setup-switch-KLGESLQX.ts → setup-switch-M3BAFGJM.ts} +9 -12
  59. package/dist/chunks/{setup-wizard-ZQAK35BP.ts → setup-wizard-NFAWP4KF.ts} +18 -20
  60. package/dist/chunks/{setup-wizard-ZQAK35BP.ts.map → setup-wizard-NFAWP4KF.ts.map} +1 -1
  61. package/dist/chunks/{snapshot-RGNDYT6A.ts → snapshot-D4SFDP5J.ts} +8 -12
  62. package/dist/chunks/snapshot-D4SFDP5J.ts.map +7 -0
  63. package/dist/chunks/snapshot-transaction-directory-TNKBQ3UQ.ts +13 -0
  64. package/dist/chunks/snapshot-transaction-directory-TNKBQ3UQ.ts.map +7 -0
  65. package/dist/chunks/state-directory-JZSZVVPX.ts +17 -0
  66. package/dist/chunks/sync-inspection-BJ4KPPNO.ts +23 -0
  67. package/dist/chunks/sync-inspection-BJ4KPPNO.ts.map +7 -0
  68. package/dist/chunks/sync-operations-TLWER2TT.ts +45 -0
  69. package/dist/chunks/sync-operations-TLWER2TT.ts.map +7 -0
  70. package/dist/chunks/{sync-state-7L4NT7W2.ts → sync-state-FVCJJ7MY.ts} +5 -10
  71. package/dist/chunks/sync-state-FVCJJ7MY.ts.map +7 -0
  72. package/dist/index.ts +269 -306
  73. package/dist/index.ts.map +4 -4
  74. package/docs/daemon-migration.md +93 -0
  75. package/docs/exclude-policy-audit.md +54 -0
  76. package/docs/exclude-review-ledger.md +36 -0
  77. package/docs/tui-contract.md +1 -1
  78. package/package.json +3 -5
  79. package/skills/configure-pi-sync/SKILL.md +5 -4
  80. package/skills/configure-pi-sync/references/configuration.md +91 -19
  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 -292
  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 +42 -38
  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 -257
  105. package/src/settings/settings-management.ts +11 -253
  106. package/src/settings/settings-store.ts +10 -48
  107. package/src/settings/settings-types.ts +1 -154
  108. package/src/settings/settings-validation.ts +17 -431
  109. package/src/snapshot/session-paths.ts +11 -110
  110. package/src/snapshot/snapshot-apply.ts +9 -306
  111. package/src/snapshot/snapshot-case-replacement.ts +6 -80
  112. package/src/snapshot/snapshot-codec.ts +2 -50
  113. package/src/snapshot/snapshot-exclude-safety.ts +2 -0
  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 -934
  120. package/src/snapshot/snapshot-types.ts +1 -43
  121. package/src/snapshot/snapshot.ts +18 -405
  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 -200
  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 -24
  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 -106
  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 -59
  156. package/src/sync/exclude-policy.ts +6 -0
  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 -108
  162. package/src/sync/merge-apply.ts +2 -434
  163. package/src/sync/merge-journal.ts +10 -219
  164. package/src/sync/merge-transfer-error.ts +2 -72
  165. package/src/sync/merged-sync.ts +2 -914
  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 -54
  169. package/src/sync/remote-snapshot.ts +7 -80
  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 -101
  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 -57
  180. package/src/sync/sync-local.ts +2 -44
  181. package/src/sync/sync-mutations.ts +10 -781
  182. package/src/sync/sync-operations.ts +32 -11
  183. package/src/sync/sync-policy.ts +34 -410
  184. package/src/sync/sync-queries.ts +2 -237
  185. package/src/sync/sync-state.ts +18 -151
  186. package/src/sync/text-merge.ts +10 -133
  187. package/src/sync-extension.ts +192 -142
  188. package/src/ui/excluded-paths-ui.ts +106 -0
  189. package/src/ui/file-selection.ts +6 -3
  190. package/src/ui/manager-state.ts +11 -5
  191. package/src/ui/remote-selection-ui.ts +73 -10
  192. package/src/ui/settings-ui.ts +20 -5
  193. package/src/ui/setup/setup-actions.ts +1 -1
  194. package/src/ui/setup/setup-switcher.ts +3 -2
  195. package/src/ui/storage-connections-ui.ts +2 -2
  196. package/src/ui/sync-attention.ts +17 -3
  197. package/src/ui/sync-format.ts +13 -1
  198. package/dist/chunks/agent-candidate-U2NU3GUX.ts +0 -29
  199. package/dist/chunks/agent-plan-3YXDIJXO.ts +0 -123
  200. package/dist/chunks/agent-plan-3YXDIJXO.ts.map +0 -7
  201. package/dist/chunks/agent-refusal-retry-476YGNU5.ts +0 -72
  202. package/dist/chunks/agent-refusal-retry-476YGNU5.ts.map +0 -7
  203. package/dist/chunks/agent-runner-FCRV2Z75.ts +0 -185
  204. package/dist/chunks/agent-runner-FCRV2Z75.ts.map +0 -7
  205. package/dist/chunks/agent-store-7GINKTS7.ts +0 -175
  206. package/dist/chunks/agent-store-7GINKTS7.ts.map +0 -7
  207. package/dist/chunks/agent-sync-2R4GG2MF.ts +0 -22
  208. package/dist/chunks/chunk-2JZFHNLM.ts +0 -113
  209. package/dist/chunks/chunk-2JZFHNLM.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-45COPAK7.ts +0 -205
  213. package/dist/chunks/chunk-45COPAK7.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-5TSCBBPP.ts +0 -229
  217. package/dist/chunks/chunk-5TSCBBPP.ts.map +0 -7
  218. package/dist/chunks/chunk-6LD5KX55.ts +0 -396
  219. package/dist/chunks/chunk-6LD5KX55.ts.map +0 -7
  220. package/dist/chunks/chunk-6O3EDBRL.ts +0 -258
  221. package/dist/chunks/chunk-6O3EDBRL.ts.map +0 -7
  222. package/dist/chunks/chunk-7A35ZAVO.ts +0 -1109
  223. package/dist/chunks/chunk-7A35ZAVO.ts.map +0 -7
  224. package/dist/chunks/chunk-7D5SF7P3.ts +0 -29
  225. package/dist/chunks/chunk-7D5SF7P3.ts.map +0 -7
  226. package/dist/chunks/chunk-7ZIYU5QS.ts +0 -64
  227. package/dist/chunks/chunk-7ZIYU5QS.ts.map +0 -7
  228. package/dist/chunks/chunk-AKMV47YC.ts +0 -215
  229. package/dist/chunks/chunk-AKMV47YC.ts.map +0 -7
  230. package/dist/chunks/chunk-AR2DGDUI.ts +0 -55
  231. package/dist/chunks/chunk-AR2DGDUI.ts.map +0 -7
  232. package/dist/chunks/chunk-BEST45H2.ts +0 -153
  233. package/dist/chunks/chunk-BEST45H2.ts.map +0 -7
  234. package/dist/chunks/chunk-CBLTWXAU.ts +0 -114
  235. package/dist/chunks/chunk-CBLTWXAU.ts.map +0 -7
  236. package/dist/chunks/chunk-CQD2TJHE.ts +0 -220
  237. package/dist/chunks/chunk-CQD2TJHE.ts.map +0 -7
  238. package/dist/chunks/chunk-DN4IA7MR.ts +0 -61
  239. package/dist/chunks/chunk-DN4IA7MR.ts.map +0 -7
  240. package/dist/chunks/chunk-DT7M4VQS.ts +0 -69
  241. package/dist/chunks/chunk-DT7M4VQS.ts.map +0 -7
  242. package/dist/chunks/chunk-ECYCNZOE.ts.map +0 -7
  243. package/dist/chunks/chunk-ESKOPQVB.ts +0 -348
  244. package/dist/chunks/chunk-ESKOPQVB.ts.map +0 -7
  245. package/dist/chunks/chunk-FHE2DCA2.ts +0 -61
  246. package/dist/chunks/chunk-FHE2DCA2.ts.map +0 -7
  247. package/dist/chunks/chunk-FLHCOJCD.ts +0 -57
  248. package/dist/chunks/chunk-FLHCOJCD.ts.map +0 -7
  249. package/dist/chunks/chunk-G4RUXRWZ.ts +0 -48
  250. package/dist/chunks/chunk-G4RUXRWZ.ts.map +0 -7
  251. package/dist/chunks/chunk-GNYGNHFF.ts +0 -27
  252. package/dist/chunks/chunk-GNYGNHFF.ts.map +0 -7
  253. package/dist/chunks/chunk-KYTT7KV4.ts +0 -319
  254. package/dist/chunks/chunk-KYTT7KV4.ts.map +0 -7
  255. package/dist/chunks/chunk-M6VQJIOU.ts +0 -54
  256. package/dist/chunks/chunk-M6VQJIOU.ts.map +0 -7
  257. package/dist/chunks/chunk-MG66XM5U.ts.map +0 -7
  258. package/dist/chunks/chunk-MKSMJPVA.ts +0 -107
  259. package/dist/chunks/chunk-MKSMJPVA.ts.map +0 -7
  260. package/dist/chunks/chunk-MMQIEDZ6.ts +0 -1994
  261. package/dist/chunks/chunk-MMQIEDZ6.ts.map +0 -7
  262. package/dist/chunks/chunk-OJARL2TG.ts +0 -25
  263. package/dist/chunks/chunk-OJARL2TG.ts.map +0 -7
  264. package/dist/chunks/chunk-OVBAW7KV.ts +0 -1174
  265. package/dist/chunks/chunk-OVBAW7KV.ts.map +0 -7
  266. package/dist/chunks/chunk-PRUEIIK7.ts +0 -24
  267. package/dist/chunks/chunk-PRUEIIK7.ts.map +0 -7
  268. package/dist/chunks/chunk-PWMWOJP4.ts +0 -17
  269. package/dist/chunks/chunk-PWMWOJP4.ts.map +0 -7
  270. package/dist/chunks/chunk-QPC5HT3A.ts.map +0 -7
  271. package/dist/chunks/chunk-REMGB255.ts.map +0 -7
  272. package/dist/chunks/chunk-S5OCYVPS.ts +0 -415
  273. package/dist/chunks/chunk-S5OCYVPS.ts.map +0 -7
  274. package/dist/chunks/chunk-SWRVXVFD.ts +0 -248
  275. package/dist/chunks/chunk-SWRVXVFD.ts.map +0 -7
  276. package/dist/chunks/chunk-T2SJD3N7.ts +0 -99
  277. package/dist/chunks/chunk-T2SJD3N7.ts.map +0 -7
  278. package/dist/chunks/chunk-TIMWN2RH.ts +0 -89
  279. package/dist/chunks/chunk-TIMWN2RH.ts.map +0 -7
  280. package/dist/chunks/chunk-TZC7GDJE.ts +0 -58
  281. package/dist/chunks/chunk-TZC7GDJE.ts.map +0 -7
  282. package/dist/chunks/chunk-U6GXGY5G.ts.map +0 -7
  283. package/dist/chunks/chunk-WQMYV4DW.ts +0 -140
  284. package/dist/chunks/chunk-WQMYV4DW.ts.map +0 -7
  285. package/dist/chunks/chunk-X7R6DCVF.ts +0 -28
  286. package/dist/chunks/chunk-X7R6DCVF.ts.map +0 -7
  287. package/dist/chunks/chunk-XJHQPB3E.ts +0 -107
  288. package/dist/chunks/chunk-XJHQPB3E.ts.map +0 -7
  289. package/dist/chunks/chunk-Y4UVXOLQ.ts +0 -123
  290. package/dist/chunks/chunk-Y4UVXOLQ.ts.map +0 -7
  291. package/dist/chunks/chunk-YDVQYUHE.ts +0 -34
  292. package/dist/chunks/chunk-YDVQYUHE.ts.map +0 -7
  293. package/dist/chunks/chunk-YHT4YTYG.ts +0 -31
  294. package/dist/chunks/chunk-YHT4YTYG.ts.map +0 -7
  295. package/dist/chunks/chunk-ZW5ZLGBI.ts +0 -154
  296. package/dist/chunks/chunk-ZW5ZLGBI.ts.map +0 -7
  297. package/dist/chunks/command-handler-MRXE5AKK.ts.map +0 -7
  298. package/dist/chunks/conflict-artifacts-J6WSDCWP.ts +0 -32
  299. package/dist/chunks/conflict-review-GXA6Y7KY.ts +0 -189
  300. package/dist/chunks/conflict-review-GXA6Y7KY.ts.map +0 -7
  301. package/dist/chunks/continuous-sync-FAFNLEUW.ts +0 -585
  302. package/dist/chunks/continuous-sync-FAFNLEUW.ts.map +0 -7
  303. package/dist/chunks/file-selection-IELTXSGZ.ts.map +0 -7
  304. package/dist/chunks/git-backend-KHD36W27.ts +0 -1077
  305. package/dist/chunks/git-backend-KHD36W27.ts.map +0 -7
  306. package/dist/chunks/local-fields-JEKAPZKD.ts +0 -26
  307. package/dist/chunks/local-fields-JEKAPZKD.ts.map +0 -7
  308. package/dist/chunks/manager-result-dispatcher-XCYPW7RC.ts +0 -32
  309. package/dist/chunks/manager-result-dispatcher-XCYPW7RC.ts.map +0 -7
  310. package/dist/chunks/manager-ui-AY34N4UY.ts.map +0 -7
  311. package/dist/chunks/merge-baseline-store-65GKUMXI.ts +0 -25
  312. package/dist/chunks/merge-baseline-store-65GKUMXI.ts.map +0 -7
  313. package/dist/chunks/remote-selection-ui-MYM2YCPF.ts +0 -31
  314. package/dist/chunks/remote-selection-ui-MYM2YCPF.ts.map +0 -7
  315. package/dist/chunks/s3-backend-L24UZ6IK.ts +0 -844
  316. package/dist/chunks/s3-backend-L24UZ6IK.ts.map +0 -7
  317. package/dist/chunks/setup-switch-KLGESLQX.ts.map +0 -7
  318. package/dist/chunks/snapshot-RGNDYT6A.ts.map +0 -7
  319. package/dist/chunks/snapshot-transaction-26BQO36S.ts +0 -24
  320. package/dist/chunks/snapshot-transaction-26BQO36S.ts.map +0 -7
  321. package/dist/chunks/sync-inspection-MOMLGUTD.ts +0 -25
  322. package/dist/chunks/sync-inspection-MOMLGUTD.ts.map +0 -7
  323. package/dist/chunks/sync-operations-45APGOL3.ts +0 -1021
  324. package/dist/chunks/sync-operations-45APGOL3.ts.map +0 -7
  325. package/dist/chunks/sync-state-7L4NT7W2.ts.map +0 -7
  326. package/dist/chunks/webdav-backend-3ZCACILP.ts +0 -851
  327. package/dist/chunks/webdav-backend-3ZCACILP.ts.map +0 -7
  328. /package/dist/chunks/{chunk-KHBPED6W.ts.map → chunk-GSQGBVKG.ts.map} +0 -0
  329. /package/dist/chunks/{chunk-JYILGR3K.ts.map → chunk-UZUUUY7C.ts.map} +0 -0
  330. /package/dist/chunks/{agent-candidate-U2NU3GUX.ts.map → manager-result-dispatcher-I2AMCCE7.ts.map} +0 -0
  331. /package/dist/chunks/{agent-sync-2R4GG2MF.ts.map → merge-review-SGDLMVS4.ts.map} +0 -0
  332. /package/dist/chunks/{config-HYG7G5EM.ts.map → remote-selection-ui-GZHPDQ4L.ts.map} +0 -0
  333. /package/dist/chunks/{conflict-artifacts-J6WSDCWP.ts.map → setup-switch-M3BAFGJM.ts.map} +0 -0
  334. /package/dist/chunks/{continuous-record-EPHGR2DU.ts.map → state-directory-JZSZVVPX.ts.map} +0 -0
@@ -1,61 +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
-
4
- // src/paths.ts
5
- import path from "node:path";
6
- function isDeniedPath(relativePath) {
7
- const normalized = toPosix(relativePath);
8
- const lower = normalized.toLowerCase();
9
- const segments = lower.split("/");
10
- const base = path.posix.basename(lower);
11
- return segments.includes("node_modules") || segments.includes(".git") || segments.includes(".pisync") || segments.includes("pi-sync") || segments.includes(".pi-sync-state-migration.lock") || base === ".env" || base.startsWith(".env.") || base.endsWith(".env") || base.includes("secret") || base.includes("token") || base === "pi-sync.json" || base.startsWith("pi-sync.json.") || base.startsWith(".pi-sync.json.") || base === "pi-sync.local.json" || base.startsWith("pi-sync.local.json.") || base.startsWith(".pi-sync.local.json.");
12
- }
13
- function isPathInside(parent, child) {
14
- const relative = path.relative(path.resolve(parent), path.resolve(child));
15
- return relative === "" || !relative.startsWith("..") && !path.isAbsolute(relative);
16
- }
17
- function safeJoin(root, relativePath) {
18
- const target = path.resolve(root, relativePath);
19
- assertWithinRoot(root, target, relativePath);
20
- return target;
21
- }
22
- function assertWithinRoot(root, target, label = target) {
23
- const resolvedRoot = path.resolve(root);
24
- const resolvedTarget = path.resolve(target);
25
- if (resolvedTarget !== resolvedRoot && !resolvedTarget.startsWith(`${resolvedRoot}${path.sep}`)) {
26
- throw new Error(`Unsafe path in snapshot: ${label}`);
27
- }
28
- }
29
- function encodeKey(key) {
30
- return key.split("/").map(encodeURIComponent).join("/").replace(/[!'()*]/gu, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);
31
- }
32
- function posixJoin(...parts) {
33
- return parts.map((part) => trimSlashes(part)).filter(Boolean).join("/");
34
- }
35
- function parentPaths(relativePath) {
36
- const results = [];
37
- let index = relativePath.lastIndexOf("/");
38
- while (index > 0) {
39
- results.push(relativePath.slice(0, index));
40
- index = relativePath.lastIndexOf("/", index - 1);
41
- }
42
- return results;
43
- }
44
- function toPosix(value) {
45
- return value.split(path.sep).join("/");
46
- }
47
- function trimSlashes(value) {
48
- return value.replace(/^\/+|\/+$/g, "");
49
- }
50
-
51
- export {
52
- isDeniedPath,
53
- isPathInside,
54
- safeJoin,
55
- assertWithinRoot,
56
- encodeKey,
57
- posixJoin,
58
- parentPaths,
59
- toPosix
60
- };
61
- //# sourceMappingURL=chunk-FHE2DCA2.ts.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/paths.ts"],
4
- "sourcesContent": ["import path from \"node:path\";\n\nexport function isDeniedPath(relativePath: string) {\n const normalized = toPosix(relativePath);\n const lower = normalized.toLowerCase();\n const segments = lower.split(\"/\");\n const base = path.posix.basename(lower);\n return (\n segments.includes(\"node_modules\") ||\n segments.includes(\".git\") ||\n segments.includes(\".pisync\") ||\n segments.includes(\"pi-sync\") ||\n segments.includes(\".pi-sync-state-migration.lock\") ||\n base === \".env\" ||\n base.startsWith(\".env.\") ||\n base.endsWith(\".env\") ||\n base.includes(\"secret\") ||\n base.includes(\"token\") ||\n base === \"pi-sync.json\" ||\n base.startsWith(\"pi-sync.json.\") ||\n base.startsWith(\".pi-sync.json.\") ||\n base === \"pi-sync.local.json\" ||\n base.startsWith(\"pi-sync.local.json.\") ||\n base.startsWith(\".pi-sync.local.json.\")\n );\n}\n\nexport function isPathInside(parent: string, child: string) {\n const relative = path.relative(path.resolve(parent), path.resolve(child));\n return relative === \"\" || (!relative.startsWith(\"..\") && !path.isAbsolute(relative));\n}\n\nexport function safeJoin(root: string, relativePath: string) {\n const target = path.resolve(root, relativePath);\n assertWithinRoot(root, target, relativePath);\n return target;\n}\n\nexport function assertWithinRoot(root: string, target: string, label = target) {\n const resolvedRoot = path.resolve(root);\n const resolvedTarget = path.resolve(target);\n if (resolvedTarget !== resolvedRoot && !resolvedTarget.startsWith(`${resolvedRoot}${path.sep}`)) {\n throw new Error(`Unsafe path in snapshot: ${label}`);\n }\n}\n\nexport function encodeKey(key: string) {\n // SigV4 permits only RFC 3986 unreserved characters and key separators.\n return key\n .split(\"/\")\n .map(encodeURIComponent)\n .join(\"/\")\n .replace(/[!'()*]/gu, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);\n}\n\nexport function posixJoin(...parts: string[]) {\n return parts\n .map((part) => trimSlashes(part))\n .filter(Boolean)\n .join(\"/\");\n}\n\nexport function parentPaths(relativePath: string) {\n const results: string[] = [];\n let index = relativePath.lastIndexOf(\"/\");\n while (index > 0) {\n results.push(relativePath.slice(0, index));\n index = relativePath.lastIndexOf(\"/\", index - 1);\n }\n return results;\n}\n\nexport function toPosix(value: string) {\n return value.split(path.sep).join(\"/\");\n}\n\nfunction trimSlashes(value: string) {\n return value.replace(/^\\/+|\\/+$/g, \"\");\n}\n\nexport function safeName(value: string) {\n return value.replace(/[^A-Za-z0-9._-]/g, \"_\");\n}\n"],
5
- "mappings": ";;;;AAAA,OAAO,UAAU;AAEV,SAAS,aAAa,cAAsB;AACjD,QAAM,aAAa,QAAQ,YAAY;AACvC,QAAM,QAAQ,WAAW,YAAY;AACrC,QAAM,WAAW,MAAM,MAAM,GAAG;AAChC,QAAM,OAAO,KAAK,MAAM,SAAS,KAAK;AACtC,SACE,SAAS,SAAS,cAAc,KAChC,SAAS,SAAS,MAAM,KACxB,SAAS,SAAS,SAAS,KAC3B,SAAS,SAAS,SAAS,KAC3B,SAAS,SAAS,+BAA+B,KACjD,SAAS,UACT,KAAK,WAAW,OAAO,KACvB,KAAK,SAAS,MAAM,KACpB,KAAK,SAAS,QAAQ,KACtB,KAAK,SAAS,OAAO,KACrB,SAAS,kBACT,KAAK,WAAW,eAAe,KAC/B,KAAK,WAAW,gBAAgB,KAChC,SAAS,wBACT,KAAK,WAAW,qBAAqB,KACrC,KAAK,WAAW,sBAAsB;AAE1C;AAEO,SAAS,aAAa,QAAgB,OAAe;AAC1D,QAAM,WAAW,KAAK,SAAS,KAAK,QAAQ,MAAM,GAAG,KAAK,QAAQ,KAAK,CAAC;AACxE,SAAO,aAAa,MAAO,CAAC,SAAS,WAAW,IAAI,KAAK,CAAC,KAAK,WAAW,QAAQ;AACpF;AAEO,SAAS,SAAS,MAAc,cAAsB;AAC3D,QAAM,SAAS,KAAK,QAAQ,MAAM,YAAY;AAC9C,mBAAiB,MAAM,QAAQ,YAAY;AAC3C,SAAO;AACT;AAEO,SAAS,iBAAiB,MAAc,QAAgB,QAAQ,QAAQ;AAC7E,QAAM,eAAe,KAAK,QAAQ,IAAI;AACtC,QAAM,iBAAiB,KAAK,QAAQ,MAAM;AAC1C,MAAI,mBAAmB,gBAAgB,CAAC,eAAe,WAAW,GAAG,YAAY,GAAG,KAAK,GAAG,EAAE,GAAG;AAC/F,UAAM,IAAI,MAAM,4BAA4B,KAAK,EAAE;AAAA,EACrD;AACF;AAEO,SAAS,UAAU,KAAa;AAErC,SAAO,IACJ,MAAM,GAAG,EACT,IAAI,kBAAkB,EACtB,KAAK,GAAG,EACR,QAAQ,aAAa,CAAC,cAAc,IAAI,UAAU,WAAW,CAAC,EAAE,SAAS,EAAE,EAAE,YAAY,CAAC,EAAE;AACjG;AAEO,SAAS,aAAa,OAAiB;AAC5C,SAAO,MACJ,IAAI,CAAC,SAAS,YAAY,IAAI,CAAC,EAC/B,OAAO,OAAO,EACd,KAAK,GAAG;AACb;AAEO,SAAS,YAAY,cAAsB;AAChD,QAAM,UAAoB,CAAC;AAC3B,MAAI,QAAQ,aAAa,YAAY,GAAG;AACxC,SAAO,QAAQ,GAAG;AAChB,YAAQ,KAAK,aAAa,MAAM,GAAG,KAAK,CAAC;AACzC,YAAQ,aAAa,YAAY,KAAK,QAAQ,CAAC;AAAA,EACjD;AACA,SAAO;AACT;AAEO,SAAS,QAAQ,OAAe;AACrC,SAAO,MAAM,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG;AACvC;AAEA,SAAS,YAAY,OAAe;AAClC,SAAO,MAAM,QAAQ,cAAc,EAAE;AACvC;",
6
- "names": []
7
- }
@@ -1,57 +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
- throwIfAborted
5
- } from "./chunk-PWMWOJP4.ts";
6
- import {
7
- snapshotSelectionInclude
8
- } from "./chunk-KYTT7KV4.ts";
9
-
10
- // src/snapshot/snapshot-codec.ts
11
- import { Readable, Writable } from "node:stream";
12
- import { pipeline } from "node:stream/promises";
13
- import { promisify } from "node:util";
14
- import { createGunzip, gzip } from "node:zlib";
15
- var VERSION = 1;
16
- var MAX_DECOMPRESSED_SNAPSHOT_BYTES = 512 * 1024 * 1024;
17
- var gzipAsync = promisify(gzip);
18
- async function encodeSnapshot(snapshot) {
19
- snapshotSelectionInclude(snapshot);
20
- return gzipAsync(Buffer.from(JSON.stringify(snapshot), "utf8"));
21
- }
22
- async function decodeSnapshot(buffer, options = {}) {
23
- throwIfAborted(options.signal);
24
- const limit = options.maxOutputLength ?? MAX_DECOMPRESSED_SNAPSHOT_BYTES;
25
- const chunks = [];
26
- let total = 0;
27
- const sink = new Writable({
28
- write(chunk, _encoding, callback) {
29
- total += chunk.byteLength;
30
- if (total > limit) {
31
- callback(new Error(`Decompressed snapshot exceeds the ${limit}-byte limit.`));
32
- return;
33
- }
34
- chunks.push(Buffer.from(chunk));
35
- callback();
36
- }
37
- });
38
- await pipeline(Readable.from([buffer]), createGunzip(), sink, { signal: options.signal });
39
- throwIfAborted(options.signal);
40
- const parsed = JSON.parse(Buffer.concat(chunks, total).toString("utf8"));
41
- if (parsed.version !== VERSION && parsed.version !== 2 && parsed.version !== 3 || !Array.isArray(parsed.files)) {
42
- throw new Error("Unsupported snapshot format.");
43
- }
44
- if (parsed.version === 2 || parsed.version === 3) {
45
- const { normalizeLocalFields, validatePortableSnapshot } = await import("./local-fields-JEKAPZKD.ts");
46
- validatePortableSnapshot(parsed);
47
- if (parsed.localFields !== void 0) parsed.localFields = normalizeLocalFields(parsed.localFields);
48
- } else if (parsed.localFields !== void 0) throw new Error("Portable field policy requires snapshot version 2.");
49
- snapshotSelectionInclude(parsed);
50
- return parsed;
51
- }
52
-
53
- export {
54
- encodeSnapshot,
55
- decodeSnapshot
56
- };
57
- //# sourceMappingURL=chunk-FLHCOJCD.ts.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/snapshot/snapshot-codec.ts"],
4
- "sourcesContent": ["import { Readable, Writable } from \"node:stream\";\nimport { pipeline } from \"node:stream/promises\";\nimport { promisify } from \"node:util\";\nimport { createGunzip, gzip } from \"node:zlib\";\nimport { throwIfAborted } from \"../sync/signals.js\";\nimport { snapshotSelectionInclude } from \"../sync/sync-policy.js\";\nimport type { Snapshot } from \"./snapshot-types.js\";\n\nconst VERSION = 1;\nconst MAX_DECOMPRESSED_SNAPSHOT_BYTES = 512 * 1024 * 1024;\nconst gzipAsync = promisify(gzip);\n\nexport async function encodeSnapshot(snapshot: Snapshot) {\n snapshotSelectionInclude(snapshot);\n return gzipAsync(Buffer.from(JSON.stringify(snapshot), \"utf8\"));\n}\n\nexport async function decodeSnapshot(\n buffer: Buffer,\n options: { signal?: AbortSignal; maxOutputLength?: number } = {},\n): Promise<Snapshot> {\n throwIfAborted(options.signal);\n const limit = options.maxOutputLength ?? MAX_DECOMPRESSED_SNAPSHOT_BYTES;\n const chunks: Buffer[] = [];\n let total = 0;\n const sink = new Writable({\n write(chunk: Buffer, _encoding, callback) {\n total += chunk.byteLength;\n if (total > limit) {\n callback(new Error(`Decompressed snapshot exceeds the ${limit}-byte limit.`));\n return;\n }\n chunks.push(Buffer.from(chunk));\n callback();\n },\n });\n await pipeline(Readable.from([buffer]), createGunzip(), sink, { signal: options.signal });\n throwIfAborted(options.signal);\n const parsed = JSON.parse(Buffer.concat(chunks, total).toString(\"utf8\")) as Snapshot;\n if ((parsed.version !== VERSION && parsed.version !== 2 && parsed.version !== 3) || !Array.isArray(parsed.files)) {\n throw new Error(\"Unsupported snapshot format.\");\n }\n if (parsed.version === 2 || parsed.version === 3) {\n const { normalizeLocalFields, validatePortableSnapshot } = await import(\"../sync/local-fields.js\");\n validatePortableSnapshot(parsed);\n if (parsed.localFields !== undefined) parsed.localFields = normalizeLocalFields(parsed.localFields);\n } else if (parsed.localFields !== undefined) throw new Error(\"Portable field policy requires snapshot version 2.\");\n snapshotSelectionInclude(parsed);\n return parsed;\n}\n"],
5
- "mappings": ";;;;;;;;;;AAAA,SAAS,UAAU,gBAAgB;AACnC,S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AA,EACpG,WAAW,OAAO,gBAAgB,OAAW,OAAM,IAAI,MAAM,oDAAoD;AACjH,2BAAyB,MAAM;AAC/B,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,48 +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
- errorMessage
5
- } from "./chunk-7D5SF7P3.ts";
6
-
7
- // src/sync/sync-error-guidance.ts
8
- function syncErrorGuidance(error) {
9
- const detail = errorMessage(error);
10
- const message = detail.length > 1200 ? `${detail.slice(0, 1200)}\u2026 (details truncated)` : detail;
11
- const code = error?.code;
12
- const status = error?.status;
13
- let next;
14
- if (code === "ENOSPC") {
15
- next = "Free disk space for the private pi-sync settings/state directory, then retry.";
16
- } else if (code && ["EACCES", "EPERM", "EROFS"].includes(code)) {
17
- next = "Check write access to the private pi-sync settings/state directory, then retry.";
18
- } else if (code && ["EBUSY", "EIO", "EMFILE", "ENFILE"].includes(code)) {
19
- next = "Check local disk availability and other processes using the private settings file, then retry.";
20
- } else if (/changed while|type changed|reopen/iu.test(message)) {
21
- next = "Reopen the item in /sync and review its current settings before saving again.";
22
- } else if (status === 401 || status === 403 || /Permission denied|Authentication failed|HTTP (401|403)|failed \((401|403)\)/iu.test(message)) {
23
- next = "Check the storage connection's credentials and remote permissions in /sync \u2192 More \u2192 Storage connections.";
24
- } else if (status === 404 || /HTTP 404|failed \(404\)/iu.test(message)) {
25
- next = "Verify the connection address and setup's bucket, branch, or path with your provider; this response alone does not prove which resource is missing.";
26
- } else if (status !== void 0 && status >= 500) {
27
- next = "Check your storage provider's service status, then retry Check setup before syncing.";
28
- } else if (/timed out|timeout|request failed|resolve host|Could not resolve|ENOTFOUND|ECONNREFUSED/iu.test(message)) {
29
- next = "Check the server address and network connection, then run /sync doctor for the affected setup.";
30
- } else if (/strong ETag|If-Match|If-None-Match|precondition|conditional header/iu.test(message)) {
31
- next = "Ask your provider to check strong ETags and conditional writes, including proxy behavior, or choose compatible storage. Do not bypass these safety checks.";
32
- } else if (/spawn git ENOENT/iu.test(message)) {
33
- next = "Install Git 2.30 or newer and make sure Pi can find git on PATH, then retry.";
34
- } else if (/response exceeds.*byte limit/iu.test(message)) {
35
- next = "Verify the storage endpoint; the server returned an unexpectedly large response. Check your provider's logs before retrying.";
36
- } else if (/settings|config|already exists|duplicates|same normalized/iu.test(message)) {
37
- next = "Correct the named field or item in /sync. If the settings file is invalid, repair it before retrying; do not replace it with defaults.";
38
- } else {
39
- next = "Open /sync \u2192 More \u2192 Check setup and review the reported checks before retrying.";
40
- }
41
- return `${message}
42
- ${next}`;
43
- }
44
-
45
- export {
46
- syncErrorGuidance
47
- };
48
- //# sourceMappingURL=chunk-G4RUXRWZ.ts.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/sync/sync-error-guidance.ts"],
4
- "sourcesContent": ["import { errorMessage } from \"./sync-errors.js\";\n\n/** Add recovery advice without changing backend outcome semantics or printing error causes. */\nexport function syncErrorGuidance(error: unknown): string {\n const detail = errorMessage(error);\n const message = detail.length > 1200 ? `${detail.slice(0, 1200)}\u2026 (details truncated)` : detail;\n const code = (error as NodeJS.ErrnoException | undefined)?.code;\n const status = (error as { status?: number } | undefined)?.status;\n let next: string;\n if (code === \"ENOSPC\") {\n next = \"Free disk space for the private pi-sync settings/state directory, then retry.\";\n } else if (code && [\"EACCES\", \"EPERM\", \"EROFS\"].includes(code)) {\n next = \"Check write access to the private pi-sync settings/state directory, then retry.\";\n } else if (code && [\"EBUSY\", \"EIO\", \"EMFILE\", \"ENFILE\"].includes(code)) {\n next = \"Check local disk availability and other processes using the private settings file, then retry.\";\n } else if (/changed while|type changed|reopen/iu.test(message)) {\n next = \"Reopen the item in /sync and review its current settings before saving again.\";\n } else if (\n status === 401 ||\n status === 403 ||\n /Permission denied|Authentication failed|HTTP (401|403)|failed \\((401|403)\\)/iu.test(message)\n ) {\n next = \"Check the storage connection's credentials and remote permissions in /sync \u2192 More \u2192 Storage connections.\";\n } else if (status === 404 || /HTTP 404|failed \\(404\\)/iu.test(message)) {\n next =\n \"Verify the connection address and setup's bucket, branch, or path with your provider; this response alone does not prove which resource is missing.\";\n } else if (status !== undefined && status >= 500) {\n next = \"Check your storage provider's service status, then retry Check setup before syncing.\";\n } else if (/timed out|timeout|request failed|resolve host|Could not resolve|ENOTFOUND|ECONNREFUSED/iu.test(message)) {\n next = \"Check the server address and network connection, then run /sync doctor for the affected setup.\";\n } else if (/strong ETag|If-Match|If-None-Match|precondition|conditional header/iu.test(message)) {\n next =\n \"Ask your provider to check strong ETags and conditional writes, including proxy behavior, or choose compatible storage. Do not bypass these safety checks.\";\n } else if (/spawn git ENOENT/iu.test(message)) {\n next = \"Install Git 2.30 or newer and make sure Pi can find git on PATH, then retry.\";\n } else if (/response exceeds.*byte limit/iu.test(message)) {\n next =\n \"Verify the storage endpoint; the server returned an unexpectedly large response. Check your provider's logs before retrying.\";\n } else if (/settings|config|already exists|duplicates|same normalized/iu.test(message)) {\n next =\n \"Correct the named field or item in /sync. If the settings file is invalid, repair it before retrying; do not replace it with defaults.\";\n } else {\n next = \"Open /sync \u2192 More \u2192 Check setup and review the reported checks before retrying.\";\n }\n return `${message}\\n${next}`;\n}\n"],
5
- "mappings": ";;;;;;;AAGO,SAAS,kBAAkB,OAAwB;AACxD,QAAM,SAAS,aAAa,KAAK;AACjC,QAAM,UAAU,OAAO,SAAS,OAAO,GAAG,OAAO,MAAM,GAAG,IAAI,CAAC,+BAA0B;AACzF,QAAM,OAAQ,OAA6C;AAC3D,QAAM,SAAU,OAA2C;AAC3D,MAAI;AACJ,MAAI,SAAS,UAAU;AACrB,WAAO;AAAA,EACT,WAAW,QAAQ,CAAC,UAAU,SAAS,OAAO,EAAE,SAAS,IAAI,GAAG;AAC9D,WAAO;AAAA,EACT,WAAW,QAAQ,CAAC,SAAS,OAAO,UAAU,QAAQ,EAAE,SAAS,IAAI,GAAG;AACtE,WAAO;AAAA,EACT,WAAW,sCAAsC,KAAK,OAAO,GAAG;AAC9D,WAAO;AAAA,EACT,WACE,WAAW,OACX,WAAW,OACX,gFAAgF,KAAK,OAAO,GAC5F;AACA,WAAO;AAAA,EACT,WAAW,WAAW,OAAO,4BAA4B,KAAK,OAAO,GAAG;AACtE,WACE;AAAA,EACJ,WAAW,WAAW,UAAa,UAAU,KAAK;AAChD,WAAO;AAAA,EACT,WAAW,2FAA2F,KAAK,OAAO,GAAG;AACnH,WAAO;AAAA,EACT,WAAW,uEAAuE,KAAK,OAAO,GAAG;AAC/F,WACE;AAAA,EACJ,WAAW,qBAAqB,KAAK,OAAO,GAAG;AAC7C,WAAO;AAAA,EACT,WAAW,iCAAiC,KAAK,OAAO,GAAG;AACzD,WACE;AAAA,EACJ,WAAW,8DAA8D,KAAK,OAAO,GAAG;AACtF,WACE;AAAA,EACJ,OAAO;AACL,WAAO;AAAA,EACT;AACA,SAAO,GAAG,OAAO;AAAA,EAAK,IAAI;AAC5B;",
6
- "names": []
7
- }
@@ -1,27 +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
- throwIfAborted
5
- } from "./chunk-PWMWOJP4.ts";
6
- import {
7
- agentDir
8
- } from "./chunk-CBLTWXAU.ts";
9
-
10
- // src/sync/mutation-owner.ts
11
- function captureMutationOwner(ctx, signal) {
12
- const manager = ctx.sessionManager;
13
- const file = manager.getSessionFile?.();
14
- const id = manager.getSessionId?.();
15
- const cwd = manager.getCwd?.();
16
- const root = agentDir();
17
- return () => {
18
- throwIfAborted(signal);
19
- if (ctx.sessionManager !== manager || manager.getSessionFile?.() !== file || manager.getSessionId?.() !== id || manager.getCwd?.() !== cwd || agentDir() !== root)
20
- throw new Error("Session changed during file mutation; evidence retained for review.");
21
- };
22
- }
23
-
24
- export {
25
- captureMutationOwner
26
- };
27
- //# sourceMappingURL=chunk-GNYGNHFF.ts.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/sync/mutation-owner.ts"],
4
- "sourcesContent": ["import type { ExtensionCommandContext, ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { agentDir } from \"../snapshot/session-paths.js\";\nimport { throwIfAborted } from \"./signals.js\";\n\nexport function captureMutationOwner(ctx: ExtensionContext | ExtensionCommandContext, signal?: AbortSignal) {\n const manager = ctx.sessionManager;\n const file = manager.getSessionFile?.();\n const id = manager.getSessionId?.();\n const cwd = manager.getCwd?.();\n const root = agentDir();\n return () => {\n throwIfAborted(signal);\n if (\n ctx.sessionManager !== manager ||\n manager.getSessionFile?.() !== file ||\n manager.getSessionId?.() !== id ||\n manager.getCwd?.() !== cwd ||\n agentDir() !== root\n )\n throw new Error(\"Session changed during file mutation; evidence retained for review.\");\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;AAIO,SAAS,qBAAqB,KAAiD,QAAsB;AAC1G,QAAM,UAAU,IAAI;AACpB,QAAM,OAAO,QAAQ,iBAAiB;AACtC,QAAM,KAAK,QAAQ,eAAe;AAClC,QAAM,MAAM,QAAQ,SAAS;AAC7B,QAAM,OAAO,SAAS;AACtB,SAAO,MAAM;AACX,mBAAe,MAAM;AACrB,QACE,IAAI,mBAAmB,WACvB,QAAQ,iBAAiB,MAAM,QAC/B,QAAQ,eAAe,MAAM,MAC7B,QAAQ,SAAS,MAAM,OACvB,SAAS,MAAM;AAEf,YAAM,IAAI,MAAM,qEAAqE;AAAA,EACzF;AACF;",
6
- "names": []
7
- }
@@ -1,319 +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
- isDeniedPath,
5
- toPosix
6
- } from "./chunk-FHE2DCA2.ts";
7
-
8
- // src/sync/sync-policy.ts
9
- import path from "node:path";
10
- var BUILT_IN_SYNC_ROOTS = [
11
- "settings.json",
12
- "keybindings.json",
13
- "models.json",
14
- "AGENTS.md",
15
- "APPEND_SYSTEM.md",
16
- "skills",
17
- "prompts",
18
- "themes",
19
- "extensions"
20
- ];
21
- var DEFAULT_SYNC_INCLUDE = [...BUILT_IN_SYNC_ROOTS];
22
- var SNAPSHOT_SELECTION_VERSION = 1;
23
- var MAX_SYNC_INCLUDE_ITEMS = 1024;
24
- var MAX_SYNC_INCLUDE_PATH_BYTES = 4096;
25
- var MAX_SYNC_INCLUDE_TOTAL_BYTES = 256 * 1024;
26
- var BUILT_IN_BY_LOWER = new Map(
27
- BUILT_IN_SYNC_ROOTS.map((fileName) => [fileName.toLowerCase(), fileName])
28
- );
29
- var TOP_LEVEL_FILE_PATHS = new Map(
30
- BUILT_IN_SYNC_ROOTS.filter((fileName) => fileName.includes(".")).map((fileName) => [
31
- fileName.toLowerCase(),
32
- fileName
33
- ])
34
- );
35
- var TOP_LEVEL_DIRS = new Set(BUILT_IN_SYNC_ROOTS.filter((fileName) => !fileName.includes(".")));
36
- var RESERVED_TOP_LEVEL_NAMES = /* @__PURE__ */ new Set([...BUILT_IN_BY_LOWER.keys(), "sessions"]);
37
- function normalizeSyncInclude(value) {
38
- if (!Array.isArray(value)) {
39
- throw new Error("Invalid pi-sync settings: sync.include must be an array.");
40
- }
41
- if (value.length > MAX_SYNC_INCLUDE_ITEMS) {
42
- throw new Error(`Invalid pi-sync settings: sync.include has too many items; limit: ${MAX_SYNC_INCLUDE_ITEMS}.`);
43
- }
44
- const result = [];
45
- const seen = /* @__PURE__ */ new Set();
46
- const pathRoot = { children: /* @__PURE__ */ new Map() };
47
- let totalBytes = 0;
48
- for (const item of value) {
49
- if (typeof item !== "string") {
50
- throw new Error("Invalid pi-sync settings: sync.include items must be strings.");
51
- }
52
- const itemBytes = Buffer.byteLength(item, "utf8");
53
- if (itemBytes > MAX_SYNC_INCLUDE_PATH_BYTES) {
54
- throw new Error(
55
- `Invalid pi-sync settings: sync.include item is too long; limit: ${MAX_SYNC_INCLUDE_PATH_BYTES} bytes.`
56
- );
57
- }
58
- totalBytes += itemBytes;
59
- if (totalBytes > MAX_SYNC_INCLUDE_TOTAL_BYTES) {
60
- throw new Error(
61
- `Invalid pi-sync settings: sync.include is too large; limit: ${MAX_SYNC_INCLUDE_TOTAL_BYTES} bytes.`
62
- );
63
- }
64
- const trimmed = item.trim();
65
- const builtIn = BUILT_IN_BY_LOWER.get(trimmed.toLowerCase());
66
- const normalized = builtIn ?? (trimmed.toLowerCase() === "sessions" ? "sessions" : trimmed);
67
- if (!builtIn && normalized !== "sessions") validateAgentRelativeInclude(normalized);
68
- const identity = normalized.toLowerCase();
69
- if (seen.has(identity)) {
70
- throw new Error(`Invalid pi-sync settings: duplicate sync.include item: ${item}`);
71
- }
72
- addIncludePath(pathRoot, identity, item);
73
- seen.add(identity);
74
- result.push(normalized);
75
- }
76
- return result;
77
- }
78
- function addIncludePath(root, identity, source) {
79
- let node = root;
80
- for (const segment of identity.split("/")) {
81
- if (node.selected !== void 0) throwOverlappingInclude(source);
82
- let child = node.children.get(segment);
83
- if (!child) {
84
- child = { children: /* @__PURE__ */ new Map() };
85
- node.children.set(segment, child);
86
- }
87
- node = child;
88
- }
89
- if (node.children.size > 0) throwOverlappingInclude(source);
90
- node.selected = identity;
91
- }
92
- function throwOverlappingInclude(item) {
93
- throw new Error(`Invalid pi-sync settings: overlapping sync.include items are ambiguous: ${item}`);
94
- }
95
- function validateAgentRelativeInclude(value) {
96
- const normalized = toPosix(value);
97
- const topLevel = normalized.split("/")[0]?.toLowerCase();
98
- if (!normalized || normalized === "." || normalized === ".." || normalized.startsWith("../") || path.posix.isAbsolute(normalized) || normalized.includes("\\") || path.posix.normalize(normalized) !== normalized || // biome-ignore lint/suspicious/noControlCharactersInRegex: Include paths cannot contain controls.
99
- /[\u0000-\u001f\u007f-\u009f]/u.test(normalized)) {
100
- throw new Error(`Invalid pi-sync settings: sync.include item must be a safe agent-relative path: ${value}`);
101
- }
102
- if (isDeniedPath(normalized)) {
103
- throw new Error(`Invalid pi-sync settings: ${value} cannot be synced.`);
104
- }
105
- if (topLevel && RESERVED_TOP_LEVEL_NAMES.has(topLevel)) {
106
- throw new Error(
107
- `Invalid pi-sync settings: use the canonical ${topLevel} root instead of a nested sync.include path.`
108
- );
109
- }
110
- }
111
- function portableSnapshotSelection(value) {
112
- const selection = value;
113
- if (!selection || typeof selection !== "object" || Array.isArray(selection) || selection.version !== SNAPSHOT_SELECTION_VERSION || !Object.hasOwn(selection, "include") || Object.keys(selection).some((key) => key !== "version" && key !== "include")) {
114
- throw new Error("Invalid snapshot selection policy.");
115
- }
116
- return {
117
- version: SNAPSHOT_SELECTION_VERSION,
118
- include: normalizeSyncInclude(selection.include)
119
- };
120
- }
121
- function snapshotSelectionInclude(snapshot) {
122
- return snapshot.selection === void 0 ? void 0 : portableSnapshotSelection(snapshot.selection).include;
123
- }
124
- function selectionForSnapshot(include) {
125
- return { version: SNAPSHOT_SELECTION_VERSION, include: normalizeSyncInclude(include) };
126
- }
127
- function sameSyncInclude(left, right) {
128
- const normalizedLeft = normalizeSyncInclude(left);
129
- const normalizedRight = normalizeSyncInclude(right);
130
- return normalizedLeft.length === normalizedRight.length && normalizedLeft.every((item, index) => item === normalizedRight[index]);
131
- }
132
- function compareSyncInclude(local, remote) {
133
- const localInclude = normalizeSyncInclude(local);
134
- const remoteInclude = normalizeSyncInclude(remote);
135
- const localSet = new Set(localInclude);
136
- const remoteSet = new Set(remoteInclude);
137
- return {
138
- same: sameSyncInclude(localInclude, remoteInclude),
139
- remoteOnly: remoteInclude.filter((item) => !localSet.has(item)),
140
- localOnly: localInclude.filter((item) => !remoteSet.has(item))
141
- };
142
- }
143
- function inspectRemoteSelection(localInclude, snapshot) {
144
- const remoteInclude = snapshotSelectionInclude(snapshot);
145
- if (!remoteInclude) {
146
- return { kind: "legacy", discovered: discoverLegacySnapshotInclude(snapshot) };
147
- }
148
- const comparison = compareSyncInclude(localInclude, remoteInclude);
149
- return comparison.same ? { kind: "same", include: remoteInclude } : { kind: "different", include: remoteInclude, ...comparison };
150
- }
151
- var RemoteSelectionMismatchError = class extends Error {
152
- decision;
153
- setupName;
154
- localInclude;
155
- remoteInclude;
156
- constructor(setupName, localInclude, remoteInclude, configIdentity = JSON.stringify([setupName, normalizeSyncInclude(localInclude)])) {
157
- const local = normalizeSyncInclude(localInclude);
158
- const remote = normalizeSyncInclude(remoteInclude);
159
- super(formatRemoteSelectionMismatch(setupName, local, remote));
160
- this.name = "RemoteSelectionMismatchError";
161
- this.setupName = setupName;
162
- this.localInclude = local;
163
- this.remoteInclude = remote;
164
- this.decision = {
165
- setupName,
166
- configIdentity,
167
- localInclude: [...local],
168
- remoteInclude: [...remote]
169
- };
170
- }
171
- };
172
- function remoteSelectionMismatch(config, remoteInclude, configIdentity) {
173
- return new RemoteSelectionMismatchError(config.setupName, config.include, remoteInclude, configIdentity);
174
- }
175
- function formatRemoteSelectionMismatch(setupName, localInclude, remoteInclude) {
176
- const comparison = compareSyncInclude(localInclude, remoteInclude);
177
- const lines = [
178
- `Synced content differs for sync setup \u201C${stripTerminalControls(setupName)}\u201D.`,
179
- `Remote-only: ${comparison.remoteOnly.join(", ") || "none"}`,
180
- `This-device-only: ${comparison.localOnly.join(", ") || "none"}`
181
- ];
182
- if (comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0) {
183
- lines.push(
184
- "Only ordering differs.",
185
- `Remote order: ${remoteInclude.join(", ") || "none"}`,
186
- `This device order: ${localInclude.join(", ") || "none"}`
187
- );
188
- }
189
- lines.push("Run /sync in TUI to review both content lists and choose what happens next.");
190
- return lines.join("\n");
191
- }
192
- function stripTerminalControls(value) {
193
- return value.replace(/[\u0000-\u001f\u007f-\u009f]/gu, "?");
194
- }
195
- function discoverLegacySnapshotInclude(snapshot) {
196
- const builtIns = /* @__PURE__ */ new Set();
197
- const custom = /* @__PURE__ */ new Set();
198
- let sessions = false;
199
- for (const file of snapshot.files) {
200
- const normalized = toPosix(file.path);
201
- if (!normalized || file.path.includes("\\") || normalized.length > 4096 || normalized.startsWith("../") || path.posix.isAbsolute(normalized) || path.posix.normalize(normalized) !== normalized || // biome-ignore lint/suspicious/noControlCharactersInRegex: Ignore unsafe legacy paths.
202
- /[\u0000-\u001f\u007f-\u009f]/u.test(normalized) || isDeniedPath(normalized)) {
203
- continue;
204
- }
205
- const [topLevel, ...rest] = normalized.split("/");
206
- if (!topLevel) continue;
207
- if (topLevel === "sessions" && rest.length > 0) {
208
- sessions = true;
209
- continue;
210
- }
211
- const builtIn = BUILT_IN_BY_LOWER.get(topLevel.toLowerCase());
212
- if (builtIn && (TOP_LEVEL_DIRS.has(builtIn) && rest.length > 0 || !TOP_LEVEL_DIRS.has(builtIn) && rest.length === 0)) {
213
- builtIns.add(builtIn);
214
- continue;
215
- }
216
- if (isSafeCustomIncludePath(topLevel)) custom.add(topLevel);
217
- }
218
- return [
219
- ...BUILT_IN_SYNC_ROOTS.filter((item) => builtIns.has(item)),
220
- ...[...custom].sort((left, right) => left.localeCompare(right)),
221
- ...sessions ? ["sessions"] : []
222
- ];
223
- }
224
- function syncIncludeSelection(value) {
225
- const include = normalizeSyncInclude(value);
226
- const builtIns = include.filter((item) => BUILT_IN_BY_LOWER.has(item.toLowerCase()));
227
- const custom = include.filter((item) => item !== "sessions" && !BUILT_IN_BY_LOWER.has(item.toLowerCase()));
228
- return { include, builtIns, custom, sessions: include.includes("sessions") };
229
- }
230
- function customIncludePathsByLower(value) {
231
- return new Map(syncIncludeSelection(value).custom.map((relativePath) => [relativePath.toLowerCase(), relativePath]));
232
- }
233
- function includeFromSelectionConfig(config) {
234
- if (config.include !== void 0) return normalizeSyncInclude(config.include);
235
- return [
236
- ...normalizeSyncFiles(config.syncFiles),
237
- ...normalizeExtraFiles(config.extraFiles),
238
- ...config.syncSessions ? ["sessions"] : []
239
- ];
240
- }
241
- function isConfiguredSnapshotPath(relativePath, config, _legacyExtraFiles) {
242
- const normalized = toPosix(relativePath);
243
- const selection = syncIncludeSelection(includeFromSelectionConfig(config));
244
- if (normalized.startsWith("sessions/")) return selection.sessions;
245
- const lower = normalized.toLowerCase();
246
- if (!normalized.includes("/")) {
247
- const builtIn = BUILT_IN_BY_LOWER.get(lower);
248
- if (builtIn) return selection.builtIns.includes(builtIn) && !TOP_LEVEL_DIRS.has(builtIn);
249
- }
250
- const topLevel = normalized.slice(0, normalized.indexOf("/"));
251
- if (selection.builtIns.includes(topLevel) && TOP_LEVEL_DIRS.has(topLevel)) {
252
- return true;
253
- }
254
- return selection.custom.some((candidate) => {
255
- const candidateLower = candidate.toLowerCase();
256
- return lower === candidateLower || lower.startsWith(`${candidateLower}/`);
257
- });
258
- }
259
- function canonicalSnapshotPathForConfig(relativePath, includePaths) {
260
- const normalized = toPosix(relativePath);
261
- const lower = normalized.toLowerCase();
262
- return TOP_LEVEL_FILE_PATHS.get(lower) ?? includePaths.get(lower) ?? normalized;
263
- }
264
- function isPreservableUnmanagedSnapshotPath(relativePath) {
265
- const normalized = toPosix(relativePath);
266
- if (!normalized || isDeniedPath(normalized)) return false;
267
- if (normalized.startsWith("sessions/")) return normalized.endsWith(".jsonl");
268
- if (!normalized.includes("/")) {
269
- const lower = normalized.toLowerCase();
270
- return TOP_LEVEL_FILE_PATHS.has(lower) || !RESERVED_TOP_LEVEL_NAMES.has(lower);
271
- }
272
- return true;
273
- }
274
- function isSafeCustomIncludePath(relativePath) {
275
- try {
276
- validateAgentRelativeInclude(relativePath);
277
- return true;
278
- } catch {
279
- return false;
280
- }
281
- }
282
- function normalizeSyncFiles(value) {
283
- if (value === void 0) return [...DEFAULT_SYNC_INCLUDE];
284
- if (Array.isArray(value)) {
285
- return normalizeSyncInclude(value).filter(
286
- (item) => BUILT_IN_BY_LOWER.has(item.toLowerCase())
287
- );
288
- }
289
- throw new Error("Invalid pi-sync settings: expected an include array.");
290
- }
291
- function normalizeExtraFiles(value) {
292
- if (!Array.isArray(value)) return [];
293
- return value.filter((item) => typeof item === "string" && isSafeCustomIncludePath(item));
294
- }
295
-
296
- export {
297
- BUILT_IN_SYNC_ROOTS,
298
- DEFAULT_SYNC_INCLUDE,
299
- normalizeSyncInclude,
300
- portableSnapshotSelection,
301
- snapshotSelectionInclude,
302
- selectionForSnapshot,
303
- sameSyncInclude,
304
- compareSyncInclude,
305
- inspectRemoteSelection,
306
- RemoteSelectionMismatchError,
307
- remoteSelectionMismatch,
308
- formatRemoteSelectionMismatch,
309
- syncIncludeSelection,
310
- customIncludePathsByLower,
311
- includeFromSelectionConfig,
312
- isConfiguredSnapshotPath,
313
- canonicalSnapshotPathForConfig,
314
- isPreservableUnmanagedSnapshotPath,
315
- isSafeCustomIncludePath,
316
- normalizeSyncFiles,
317
- normalizeExtraFiles
318
- };
319
- //# sourceMappingURL=chunk-KYTT7KV4.ts.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/sync/sync-policy.ts"],
4
- "sourcesContent": ["import path from \"node:path\";\nimport { isDeniedPath, toPosix } from \"../paths.js\";\nimport type { Snapshot, SnapshotSelection } from \"../snapshot/snapshot-types.js\";\n\nexport const BUILT_IN_SYNC_ROOTS = [\n \"settings.json\",\n \"keybindings.json\",\n \"models.json\",\n \"AGENTS.md\",\n \"APPEND_SYSTEM.md\",\n \"skills\",\n \"prompts\",\n \"themes\",\n \"extensions\",\n] as const;\n\nexport const DEFAULT_SYNC_INCLUDE = [...BUILT_IN_SYNC_ROOTS] as const;\nexport type BuiltInSyncFile = (typeof BUILT_IN_SYNC_ROOTS)[number];\nconst SNAPSHOT_SELECTION_VERSION = 1;\nconst MAX_SYNC_INCLUDE_ITEMS = 1_024;\nconst MAX_SYNC_INCLUDE_PATH_BYTES = 4_096;\nconst MAX_SYNC_INCLUDE_TOTAL_BYTES = 256 * 1_024;\n\ninterface IncludePathNode {\n selected?: string;\n children: Map<string, IncludePathNode>;\n}\n\nconst BUILT_IN_BY_LOWER = new Map<string, BuiltInSyncFile>(\n BUILT_IN_SYNC_ROOTS.map((fileName) => [fileName.toLowerCase(), fileName]),\n);\nconst TOP_LEVEL_FILE_PATHS = new Map<string, string>(\n BUILT_IN_SYNC_ROOTS.filter((fileName) => fileName.includes(\".\")).map((fileName) => [\n fileName.toLowerCase(),\n fileName,\n ]),\n);\nconst TOP_LEVEL_DIRS = new Set<string>(BUILT_IN_SYNC_ROOTS.filter((fileName) => !fileName.includes(\".\")));\nconst RESERVED_TOP_LEVEL_NAMES = new Set<string>([...BUILT_IN_BY_LOWER.keys(), \"sessions\"]);\n\nexport function normalizeSyncInclude(value: unknown): string[] {\n if (!Array.isArray(value)) {\n throw new Error(\"Invalid pi-sync settings: sync.include must be an array.\");\n }\n if (value.length > MAX_SYNC_INCLUDE_ITEMS) {\n throw new Error(`Invalid pi-sync settings: sync.include has too many items; limit: ${MAX_SYNC_INCLUDE_ITEMS}.`);\n }\n const result: string[] = [];\n const seen = new Set<string>();\n const pathRoot: IncludePathNode = { children: new Map() };\n let totalBytes = 0;\n for (const item of value) {\n if (typeof item !== \"string\") {\n throw new Error(\"Invalid pi-sync settings: sync.include items must be strings.\");\n }\n const itemBytes = Buffer.byteLength(item, \"utf8\");\n if (itemBytes > MAX_SYNC_INCLUDE_PATH_BYTES) {\n throw new Error(\n `Invalid pi-sync settings: sync.include item is too long; limit: ${MAX_SYNC_INCLUDE_PATH_BYTES} bytes.`,\n );\n }\n totalBytes += itemBytes;\n if (totalBytes > MAX_SYNC_INCLUDE_TOTAL_BYTES) {\n throw new Error(\n `Invalid pi-sync settings: sync.include is too large; limit: ${MAX_SYNC_INCLUDE_TOTAL_BYTES} bytes.`,\n );\n }\n const trimmed = item.trim();\n const builtIn = BUILT_IN_BY_LOWER.get(trimmed.toLowerCase());\n const normalized = builtIn ?? (trimmed.toLowerCase() === \"sessions\" ? \"sessions\" : trimmed);\n if (!builtIn && normalized !== \"sessions\") validateAgentRelativeInclude(normalized);\n const identity = normalized.toLowerCase();\n if (seen.has(identity)) {\n throw new Error(`Invalid pi-sync settings: duplicate sync.include item: ${item}`);\n }\n addIncludePath(pathRoot, identity, item);\n seen.add(identity);\n result.push(normalized);\n }\n return result;\n}\n\nfunction addIncludePath(root: IncludePathNode, identity: string, source: string) {\n let node = root;\n for (const segment of identity.split(\"/\")) {\n if (node.selected !== undefined) throwOverlappingInclude(source);\n let child = node.children.get(segment);\n if (!child) {\n child = { children: new Map() };\n node.children.set(segment, child);\n }\n node = child;\n }\n if (node.children.size > 0) throwOverlappingInclude(source);\n node.selected = identity;\n}\n\nfunction throwOverlappingInclude(item: string): never {\n throw new Error(`Invalid pi-sync settings: overlapping sync.include items are ambiguous: ${item}`);\n}\n\nfunction validateAgentRelativeInclude(value: string) {\n const normalized = toPosix(value);\n const topLevel = normalized.split(\"/\")[0]?.toLowerCase();\n if (\n !normalized ||\n normalized === \".\" ||\n normalized === \"..\" ||\n normalized.startsWith(\"../\") ||\n path.posix.isAbsolute(normalized) ||\n normalized.includes(\"\\\\\") ||\n path.posix.normalize(normalized) !== normalized ||\n // biome-ignore lint/suspicious/noControlCharactersInRegex: Include paths cannot contain controls.\n /[\\u0000-\\u001f\\u007f-\\u009f]/u.test(normalized)\n ) {\n throw new Error(`Invalid pi-sync settings: sync.include item must be a safe agent-relative path: ${value}`);\n }\n if (isDeniedPath(normalized)) {\n throw new Error(`Invalid pi-sync settings: ${value} cannot be synced.`);\n }\n if (topLevel && RESERVED_TOP_LEVEL_NAMES.has(topLevel)) {\n throw new Error(\n `Invalid pi-sync settings: use the canonical ${topLevel} root instead of a nested sync.include path.`,\n );\n }\n}\n\nexport function portableSnapshotSelection(value: unknown): SnapshotSelection {\n const selection = value as Partial<SnapshotSelection> | null;\n if (\n !selection ||\n typeof selection !== \"object\" ||\n Array.isArray(selection) ||\n selection.version !== SNAPSHOT_SELECTION_VERSION ||\n !Object.hasOwn(selection, \"include\") ||\n Object.keys(selection).some((key) => key !== \"version\" && key !== \"include\")\n ) {\n throw new Error(\"Invalid snapshot selection policy.\");\n }\n return {\n version: SNAPSHOT_SELECTION_VERSION,\n include: normalizeSyncInclude(selection.include),\n };\n}\n\nexport function snapshotSelectionInclude(snapshot: Pick<Snapshot, \"selection\">) {\n return snapshot.selection === undefined ? undefined : portableSnapshotSelection(snapshot.selection).include;\n}\n\nexport function selectionForSnapshot(include: unknown): SnapshotSelection {\n return { version: SNAPSHOT_SELECTION_VERSION, include: normalizeSyncInclude(include) };\n}\n\nexport function sameSyncInclude(left: unknown, right: unknown) {\n const normalizedLeft = normalizeSyncInclude(left);\n const normalizedRight = normalizeSyncInclude(right);\n return (\n normalizedLeft.length === normalizedRight.length &&\n normalizedLeft.every((item, index) => item === normalizedRight[index])\n );\n}\n\nexport function compareSyncInclude(local: unknown, remote: unknown) {\n const localInclude = normalizeSyncInclude(local);\n const remoteInclude = normalizeSyncInclude(remote);\n const localSet = new Set(localInclude);\n const remoteSet = new Set(remoteInclude);\n return {\n same: sameSyncInclude(localInclude, remoteInclude),\n remoteOnly: remoteInclude.filter((item) => !localSet.has(item)),\n localOnly: localInclude.filter((item) => !remoteSet.has(item)),\n };\n}\n\nexport type RemoteSelectionState =\n | { kind: \"legacy\"; discovered: string[] }\n | { kind: \"same\"; include: string[] }\n | {\n kind: \"different\";\n include: string[];\n remoteOnly: string[];\n localOnly: string[];\n };\n\nexport function inspectRemoteSelection(\n localInclude: unknown,\n snapshot: Pick<Snapshot, \"selection\" | \"files\">,\n): RemoteSelectionState {\n const remoteInclude = snapshotSelectionInclude(snapshot);\n if (!remoteInclude) {\n return { kind: \"legacy\", discovered: discoverLegacySnapshotInclude(snapshot) };\n }\n const comparison = compareSyncInclude(localInclude, remoteInclude);\n return comparison.same\n ? { kind: \"same\", include: remoteInclude }\n : { kind: \"different\", include: remoteInclude, ...comparison };\n}\n\nexport interface RemoteSelectionDecision {\n setupName: string;\n configIdentity: string;\n localInclude: readonly string[];\n remoteInclude: readonly string[];\n}\n\nexport class RemoteSelectionMismatchError extends Error {\n readonly decision: RemoteSelectionDecision;\n readonly setupName: string;\n readonly localInclude: string[];\n readonly remoteInclude: string[];\n\n constructor(\n setupName: string,\n localInclude: unknown,\n remoteInclude: unknown,\n configIdentity = JSON.stringify([setupName, normalizeSyncInclude(localInclude)]),\n ) {\n const local = normalizeSyncInclude(localInclude);\n const remote = normalizeSyncInclude(remoteInclude);\n super(formatRemoteSelectionMismatch(setupName, local, remote));\n this.name = \"RemoteSelectionMismatchError\";\n this.setupName = setupName;\n this.localInclude = local;\n this.remoteInclude = remote;\n this.decision = {\n setupName,\n configIdentity,\n localInclude: [...local],\n remoteInclude: [...remote],\n };\n }\n}\n\nexport function remoteSelectionMismatch(\n config: { setupName: string; include: unknown },\n remoteInclude: unknown,\n configIdentity?: string,\n) {\n return new RemoteSelectionMismatchError(config.setupName, config.include, remoteInclude, configIdentity);\n}\n\nexport function formatRemoteSelectionMismatch(\n setupName: string,\n localInclude: readonly string[],\n remoteInclude: readonly string[],\n) {\n const comparison = compareSyncInclude(localInclude, remoteInclude);\n const lines = [\n `Synced content differs for sync setup \u201C${stripTerminalControls(setupName)}\u201D.`,\n `Remote-only: ${comparison.remoteOnly.join(\", \") || \"none\"}`,\n `This-device-only: ${comparison.localOnly.join(\", \") || \"none\"}`,\n ];\n if (comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0) {\n lines.push(\n \"Only ordering differs.\",\n `Remote order: ${remoteInclude.join(\", \") || \"none\"}`,\n `This device order: ${localInclude.join(\", \") || \"none\"}`,\n );\n }\n lines.push(\"Run /sync in TUI to review both content lists and choose what happens next.\");\n return lines.join(\"\\n\");\n}\n\nfunction stripTerminalControls(value: string) {\n // biome-ignore lint/suspicious/noControlCharactersInRegex: Escape untrusted terminal controls.\n return value.replace(/[\\u0000-\\u001f\\u007f-\\u009f]/gu, \"?\");\n}\n\nexport function discoverLegacySnapshotInclude(snapshot: Pick<Snapshot, \"files\">) {\n const builtIns = new Set<BuiltInSyncFile>();\n const custom = new Set<string>();\n let sessions = false;\n for (const file of snapshot.files) {\n const normalized = toPosix(file.path);\n if (\n !normalized ||\n file.path.includes(\"\\\\\") ||\n normalized.length > 4096 ||\n normalized.startsWith(\"../\") ||\n path.posix.isAbsolute(normalized) ||\n path.posix.normalize(normalized) !== normalized ||\n // biome-ignore lint/suspicious/noControlCharactersInRegex: Ignore unsafe legacy paths.\n /[\\u0000-\\u001f\\u007f-\\u009f]/u.test(normalized) ||\n isDeniedPath(normalized)\n ) {\n continue;\n }\n const [topLevel, ...rest] = normalized.split(\"/\");\n if (!topLevel) continue;\n if (topLevel === \"sessions\" && rest.length > 0) {\n sessions = true;\n continue;\n }\n const builtIn = BUILT_IN_BY_LOWER.get(topLevel.toLowerCase());\n if (\n builtIn &&\n ((TOP_LEVEL_DIRS.has(builtIn) && rest.length > 0) || (!TOP_LEVEL_DIRS.has(builtIn) && rest.length === 0))\n ) {\n builtIns.add(builtIn);\n continue;\n }\n if (isSafeCustomIncludePath(topLevel)) custom.add(topLevel);\n }\n return [\n ...BUILT_IN_SYNC_ROOTS.filter((item) => builtIns.has(item)),\n ...[...custom].sort((left, right) => left.localeCompare(right)),\n ...(sessions ? [\"sessions\"] : []),\n ];\n}\n\nexport function syncIncludeSelection(value: unknown) {\n const include = normalizeSyncInclude(value);\n const builtIns = include.filter((item): item is BuiltInSyncFile => BUILT_IN_BY_LOWER.has(item.toLowerCase()));\n const custom = include.filter((item) => item !== \"sessions\" && !BUILT_IN_BY_LOWER.has(item.toLowerCase()));\n return { include, builtIns, custom, sessions: include.includes(\"sessions\") };\n}\n\nexport function customIncludePathsByLower(value: unknown) {\n return new Map(syncIncludeSelection(value).custom.map((relativePath) => [relativePath.toLowerCase(), relativePath]));\n}\n\nexport interface SyncSelectionConfig {\n include?: unknown;\n syncFiles?: unknown;\n syncSessions?: boolean;\n extraFiles?: unknown;\n}\n\nexport function includeFromSelectionConfig(config: SyncSelectionConfig) {\n if (config.include !== undefined) return normalizeSyncInclude(config.include);\n return [\n ...normalizeSyncFiles(config.syncFiles),\n ...normalizeExtraFiles(config.extraFiles),\n ...(config.syncSessions ? [\"sessions\"] : []),\n ];\n}\n\nexport function isConfiguredSnapshotPath(\n relativePath: string,\n config: SyncSelectionConfig,\n _legacyExtraFiles?: Set<string>,\n) {\n const normalized = toPosix(relativePath);\n const selection = syncIncludeSelection(includeFromSelectionConfig(config));\n if (normalized.startsWith(\"sessions/\")) return selection.sessions;\n const lower = normalized.toLowerCase();\n if (!normalized.includes(\"/\")) {\n const builtIn = BUILT_IN_BY_LOWER.get(lower);\n if (builtIn) return selection.builtIns.includes(builtIn) && !TOP_LEVEL_DIRS.has(builtIn);\n }\n const topLevel = normalized.slice(0, normalized.indexOf(\"/\"));\n if (selection.builtIns.includes(topLevel as BuiltInSyncFile) && TOP_LEVEL_DIRS.has(topLevel)) {\n return true;\n }\n return selection.custom.some((candidate) => {\n const candidateLower = candidate.toLowerCase();\n return lower === candidateLower || lower.startsWith(`${candidateLower}/`);\n });\n}\n\nexport function canonicalSnapshotPathForConfig(relativePath: string, includePaths: Map<string, string>) {\n const normalized = toPosix(relativePath);\n const lower = normalized.toLowerCase();\n return TOP_LEVEL_FILE_PATHS.get(lower) ?? includePaths.get(lower) ?? normalized;\n}\n\nexport function isPreservableUnmanagedSnapshotPath(relativePath: string) {\n const normalized = toPosix(relativePath);\n if (!normalized || isDeniedPath(normalized)) return false;\n if (normalized.startsWith(\"sessions/\")) return normalized.endsWith(\".jsonl\");\n if (!normalized.includes(\"/\")) {\n const lower = normalized.toLowerCase();\n return TOP_LEVEL_FILE_PATHS.has(lower) || !RESERVED_TOP_LEVEL_NAMES.has(lower);\n }\n return true;\n}\n\nexport function isSafeCustomIncludePath(relativePath: string) {\n try {\n validateAgentRelativeInclude(relativePath);\n return true;\n } catch {\n return false;\n }\n}\n\nexport function isBuiltInTopLevelFile(fileName: string) {\n return TOP_LEVEL_FILE_PATHS.has(path.posix.basename(fileName).toLowerCase());\n}\n\n/** Compatibility projection for backend-neutral output while callers move to sync.include. */\nexport function normalizeSyncFiles(value: unknown): BuiltInSyncFile[] {\n if (value === undefined) return [...DEFAULT_SYNC_INCLUDE];\n if (Array.isArray(value)) {\n return normalizeSyncInclude(value).filter((item): item is BuiltInSyncFile =>\n BUILT_IN_BY_LOWER.has(item.toLowerCase()),\n );\n }\n throw new Error(\"Invalid pi-sync settings: expected an include array.\");\n}\n\n/** Compatibility projection for old rendering helpers; v3 persistence never writes this split field. */\nexport function normalizeExtraFiles(value: unknown) {\n if (!Array.isArray(value)) return [];\n return value.filter((item): item is string => typeof item === \"string\" && isSafeCustomIncludePath(item));\n}\n\nexport const extraFilePathsByLower = customIncludePathsByLower;\nexport const isSafeExtraFileName = isSafeCustomIncludePath;\nexport const selectedSyncFileSet = (value: unknown) => new Set(normalizeSyncFiles(value));\n"],
5
- "mappings": ";;;;;;;;AAAA,OAAO,UAAU;AAIV,IAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,uBAAuB,CAAC,GAAG,mBAAmB;AAE3D,IAAM,6BAA6B;AACnC,IAAM,yBAAyB;AAC/B,IAAM,8BAA8B;AACpC,IAAM,+BAA+B,MAAM;AAO3C,IAAM,oBAAoB,IAAI;AAAA,EAC5B,oBAAoB,IAAI,CAAC,aAAa,CAAC,SAAS,YAAY,GAAG,QAAQ,CAAC;AAC1E;AACA,IAAM,uBAAuB,IAAI;AAAA,EAC/B,oBAAoB,OAAO,CAAC,aAAa,SAAS,SAAS,GAAG,CAAC,EAAE,IAAI,CAAC,aAAa;AAAA,IACjF,SAAS,YAAY;AAAA,IACrB;AAAA,EACF,CAAC;AACH;AACA,IAAM,iBAAiB,IAAI,IAAY,oBAAoB,OAAO,CAAC,aAAa,CAAC,SAAS,SAAS,GAAG,CAAC,CAAC;AACxG,IAAM,2BAA2B,oBAAI,IAAY,CAAC,GAAG,kBAAkB,KAAK,GAAG,UAAU,CAAC;AAEnF,SAAS,qBAAqB,OAA0B;AAC7D,MAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AACzB,UAAM,IAAI,MAA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