@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @narumitw/pi-sync
2
2
 
3
+ ## 0.60.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8bba72d: Extract the existing synchronization engine into the standalone TypeScript `@narumitw/sync-daemon` package and keep Pi Sync as its reviewed local API client. Share a detached root-bound owner across Pi sessions, retain existing formats and recovery safeguards, and separate service lifetime from unattended transfer and resolver permission.
8
+
9
+ Preserve reviewed external-session destinations across all participating Pi queues and setup-scoped explicit Continuous retry without resetting request accounting.
10
+
11
+ The daemon must be available before the dependent Pi client is released. Publication and real-data cutover require separate approval and the migration verification gates.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [8bba72d]
16
+ - @narumitw/sync-daemon@0.2.0
17
+
18
+ ## 0.59.0
19
+
20
+ ### Minor Changes
21
+
22
+ - 58cb3c5: Add per-setup path and glob exclusions with reviewed settings, portable policy comparison, and local-file protection across sync and rollback. Exclusion-enabled setups opt into settings version 6 and snapshot version 4; existing setups keep their previous behavior. Excluded paths are omitted from new publications, not erased from retained history.
23
+
3
24
  ## 0.58.1
4
25
 
5
26
  ### Patch Changes
package/README.md CHANGED
@@ -3,18 +3,20 @@
3
3
  [![npm](https://img.shields.io/npm/v/@narumitw/pi-sync)](https://www.npmjs.com/package/@narumitw/pi-sync) [![Pi extension](https://img.shields.io/badge/Pi-extension-blue)](https://pi.dev) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)
4
4
 
5
5
  Pi Sync synchronizes selected Pi settings and content across machines through Git, WebDAV, Cloudflare R2, or another S3-compatible store.
6
- Reusable storage connections hold credentials, while named sync setups define exactly what to sync, where to store it, and whether to sync automatically.
6
+ Reusable storage connections hold credentials, while named sync setups define exactly what to sync, where to store it, and whether to sync automatically. Pi owns the interface; the separate [@narumitw/sync-daemon service](https://github.com/narumiruna/pi-extensions/tree/main/packages/sync-daemon) owns execution.
7
+
8
+ > **Experimental daemon migration:** this checkout requires the new, independently published dependency. Close or upgrade older Pi processes and review ownership before real-data use. See [migration and release restrictions](./docs/daemon-migration.md).
7
9
 
8
10
  ## ✨ Features
9
11
 
10
12
  - Manages Git, WebDAV, Cloudflare R2, and general S3-compatible storage through `/sync`.
11
13
  - Separates reusable storage connections from named setups with exact reviewed remote paths.
12
- - Uses one ordered list for Pi roots, safe agent-relative paths, and privacy-sensitive sessions.
14
+ - Uses one ordered include list for Pi roots, safe agent-relative paths, and privacy-sensitive sessions, with optional path/glob exclusions.
13
15
  - Protects changes with immutable snapshots, secret scanning, locks, conflict checks, pull backups, transactional apply, and recovery journals.
14
16
  - Keeps snapshot selection portable and free of credentials.
15
17
  - Writes settings atomically, preserves unknown fields, rejects stale edits, and fails closed on unsafe configuration.
16
18
  - Offers default-off Autonomous sync for eligible startup and Sync now transfers without another transfer confirmation, with model-assisted conflict resolution and a separate Continuous sync opt-in.
17
- - Loads a generated split runtime with lazy UI and backend chunks.
19
+ - Shares one detached synchronization service across Pi clients, with a generated split UI client runtime.
18
20
  - Bundles a manual-only skill for configuration questions and safe setup guidance.
19
21
 
20
22
  ## 📦 Install
@@ -32,6 +34,9 @@ pi -e npm:@narumitw/pi-sync
32
34
  Build the generated runtime and try a local checkout:
33
35
 
34
36
  ```bash
37
+ npm install
38
+ npm --workspace @narumitw/pi-tui-kit run build
39
+ npm --workspace @narumitw/sync-daemon run build
35
40
  npm --workspace @narumitw/pi-sync run build
36
41
  pi -e ./packages/pi-sync
37
42
  ```
@@ -82,7 +87,7 @@ The main summary separates current state from actions and uses local state and c
82
87
  After Pi Sync detects an included-content mismatch, the manager shows **Sync status: Review needed** and puts **Review synced content (recommended)** first.
83
88
  **Sync now** remains unavailable until you review the mismatch.
84
89
  Opening the manager does not make another remote request.
85
- **Settings** opens **Pi Sync Settings** directly: one searchable flat list with all 16 rows in their existing order and no category navigation or headings. **Compare included paths** sits beside **Included paths** and compares path policies, not file contents. **Storage location** edits only the current setup's bucket, branch, or path; it does not change the connection or included content. **Manage sync setups** and **Manage storage connections** open the existing catalogs. Connections hold reusable server addresses and sign-in details, and edits show every affected setup. Make another setup current before changing its preferences. Each description identifies the setup, device-wide, or shared-connection scope. Simple preferences report saving and durable save results; Back does not undo saved changes. Complex editors and risky changes retain their reviews. RPC reports the manual settings path and preserves catalog management without opening the TUI preference editor.
90
+ **Settings** opens **Pi Sync Settings** directly: one searchable flat list with 17 rows and no category navigation or headings. **Included paths**, **Excluded paths**, and **Compare included paths** keep content policy together; comparison covers include/exclude rules, not file contents. **Storage location** edits only the current setup's bucket, branch, or path; it does not change the connection or included content. **Manage sync setups** and **Manage storage connections** open the existing catalogs. Connections hold reusable server addresses and sign-in details, and edits show every affected setup. Make another setup current before changing its preferences. Each description identifies the setup, device-wide, or shared-connection scope. Simple preferences report saving and durable save results; Back does not undo saved changes. Complex editors and risky changes retain their reviews. RPC reports the manual settings path and preserves catalog management without opening the TUI preference editor.
86
91
 
87
92
  **Diagnostics** (also `/sync doctor`) reports configuration and backend-specific access checks. S3/R2 performs a read-only request: success does not prove write access or snapshot validity, and an ambiguous 404 does not prove a bucket is missing. Check the indicated credentials, address, bucket, or path before retrying. Git checks remote reads and the local cache, not write access. WebDAV uses an isolated write/cleanup probe and repairs the active snapshot's history entry if missing. **History** opens the snapshot list directly for reviewed rollback. Recorded unresolved groups have a separate **Review unresolved conflicts** action.
88
93
 
@@ -127,7 +132,7 @@ Choose **Review all paths (recommended)** first to compare exact remote-only pat
127
132
  If membership matches but order differs, the review says that only ordering differs.
128
133
  Then choose one action:
129
134
 
130
- - **Use remote content list** revalidates the remote snapshot and reviewed local setup before saving only `sync.include`.
135
+ - **Use remote content list** revalidates the remote snapshot and reviewed local setup before saving `sync.include` and the reviewed exclusion rules together.
131
136
  **Remote content list saved** confirms that no files were pulled and offers a separate **Continue Sync/Pull/Push now…** action plus **Done**.
132
137
  Continue starts a fresh operation and exact preview for the captured setup rather than resuming stale work.
133
138
  - **Keep this device's content list and update remote…** opens the existing `push --force` preparation and exact confirmation without `--yes`.
@@ -204,7 +209,7 @@ Ordinary **Sync now** reuses a cached refusal. Use **Retry refused model result
204
209
 
205
210
  **Settings → Continuous sync** controls separate per-setup `sync.continuous`, default **Off**. Autonomous sync must also be enabled. A separate review authorizes recurring network access, model costs and automatic transfers while Pi is open. Upgrade all Pi processes sharing the agent directory before enabling it. Monitoring starts after the `/sync` command or manager closes, and replaces the duplicate one-shot startup transfer.
206
211
 
207
- Selected-file hints are coalesced after one quiet second. A 60–66 second remote/local check covers missed events. Temporary failures and proven pre-publication edit races use bounded backoff. Removing flagged secret content or repairing unsupported conflicts permits a fresh inspection; unchanged blocks do not repeatedly call the model. One local session owns monitoring for each shared agent directory; each computer remains a separate replica. Busy sessions and foreground commands release ownership after draining work. Nothing runs after Pi exits, and resources never reload automatically.
212
+ Selected-file hints are coalesced after one quiet second. A 60–66 second remote/local check covers missed events. Temporary failures and proven pre-publication edit races use bounded backoff. Removing flagged secret content or repairing unsupported conflicts permits a fresh inspection; unchanged blocks do not repeatedly call the model. One daemon owns monitoring for each shared canonical agent directory; each computer remains a separate replica. Busy sessions and foreground commands release ownership after draining work. The service survives Pi exit, but unattended transfers and model requests require separate setup-bound permission; see [Daemon lifetime and unattended permission](./skills/configure-pi-sync/references/configuration.md#daemon-lifetime-and-unattended-permission). Resources never reload automatically.
208
213
 
209
214
  **Check remote status** shows rolling-window allowance, exhausted candidates, accounting capacity and safe recovery actions. These are read-only observations, not permission to dispatch. The observing session's model does not identify another scheduler owner's model. Retained private candidates and accounting are not automatically pruned.
210
215
 
@@ -224,7 +229,7 @@ Successful transfers show one summary. They do not reload resources, activate ex
224
229
 
225
230
  **Settings → Machine-local fields** edits explicit `sync.localFields` root field names for global `settings.json` (default none). Excluded values and absence stay local; future portable snapshots omit them. Enabling rules opts into settings version 4 / snapshot version 2, which older clients must refuse. All receiving machines must configure compatible rules. Additions/removals require a separately confirmed force-direction migration, even with `--yes`; old remote history is **not erased**. See [settings merge and local fields](./skills/configure-pi-sync/references/configuration.md#settings-field-merge-and-machine-local-fields) for formats, compatibility and recovery.
226
231
 
227
- **Settings → Content merge / partial progress** controls independent `sync.mergeContent` and `sync.partialSync` opt-ins, both default **Off**. Saving opts into settings version 5; partial publications use snapshot version 3, rejected by older readers. Supported Markdown/plain-text resources merge bounded independent line edits without Git or conflict markers. Diff grids and hunk comparisons share an eight-million-work-unit budget across the operation and its retries; exhausted paths remain conflicts for review. Same-session reconciliation only accepts validated complete byte-prefix extensions; divergent histories and the loaded session require review. A syntactically clean text merge is **not a semantic correctness guarantee**.
232
+ **Settings → Content merge / partial progress** controls independent `sync.mergeContent` and `sync.partialSync` opt-ins, both default **Off**. Saving opts into at least settings version 5; partial publications use snapshot version 3, or version 4 with exclusions, rejected by older readers. Supported Markdown/plain-text resources merge bounded independent line edits without Git or conflict markers. Diff grids and hunk comparisons share an eight-million-work-unit budget across the operation and its retries; exhausted paths remain conflicts for review. Same-session reconciliation only accepts validated complete byte-prefix extensions; divergent histories and the loaded session require review. A syntactically clean text merge is **not a semantic correctness guarantee**.
228
233
 
229
234
  Partial sync keeps each side's unresolved versions, preserves their previous accepted hashes/ancestors, and advances only independent paths. Resource/collision dependency groups are withheld together, including local-only files, never represented as deletion. The conditional **Review unresolved conflicts** action, or `/sync conflicts`, opens exact private versions on request and resolves one freshly validated whole group. Automatic pushes, non-forced push/pull, and rollback refuse unresolved groups; use group review or an explicit manual push/pull force direction instead. Artifacts remain below the denied state root, with stable conflict identity and at most 32 proven-completed records retained; unresolved or unrecognized evidence is never automatically pruned. Failed attempts release only newly created artifacts whose inode/content ownership and lack of state/journal references are verified. See [content merge and partial recovery](./docs/content-merge-audit.md).
230
235
 
@@ -274,7 +279,9 @@ Version 1, version 2, and non-empty unversioned settings require manual recovery
274
279
  Adding `sessions` can upload prompts, tool output, paths, images, and secrets; interactive flows require a privacy acknowledgement.
275
280
  Startup checks report included-content differences without changing anything. Transfers retain their existing included-content policy checks instead of silently expanding local scope.
276
281
 
277
- Read the [settings reference](./skills/configure-pi-sync/references/configuration.md) for complete S3/R2, Git, and WebDAV examples, backend fields, included-content rules, legacy paths, and recovery steps.
282
+ **Settings → Excluded paths** edits optional per-setup `sync.exclude` rules, for example `["skills/private", "extensions/**/*.test.ts"]`. Rules win over includes and apply to future transfers; excluded local files remain untouched, including on rollback. Saving opts into settings version 6 / snapshot version 4, which older clients must refuse. New publications omit matching remote paths, but old history is **not erased**. Removing rules can expose or replace content. See [Excluded paths](./skills/configure-pi-sync/references/configuration.md#excluded-paths) for syntax, review, and recovery.
283
+
284
+ Read the [settings reference](./skills/configure-pi-sync/references/configuration.md) for complete S3/R2, Git, and WebDAV examples, backend fields, content policy, legacy paths, and recovery steps.
278
285
 
279
286
  ## 🧠 Skills
280
287
 
@@ -290,6 +297,7 @@ Read the [settings reference](./skills/configure-pi-sync/references/configuratio
290
297
  | --- | --- |
291
298
  | `/sync` | Set up storage, manage synced content, and review sync operations or recovery. |
292
299
  | `/sync help` | Show command usage. |
300
+ | `/sync daemon [status\|handover\|allow-after-exit\|revoke-after-exit]` | Connect to the service or review ownership and unattended permission; no argument connects and shows status. |
293
301
  | `/sync use <setup>` | Switch the active local sync setup, following its switch policy. |
294
302
  | `/sync init` | Create a local configuration template. |
295
303
  | `/sync config` | Show resolved configuration. |
@@ -306,6 +314,8 @@ Read the [settings reference](./skills/configure-pi-sync/references/configuratio
306
314
  | `/sync migrate-state` | Migrate the legacy local state directory. |
307
315
  | `/sync unlock --stale` | Recover an abandoned local lock after guarded ownership checks. |
308
316
 
317
+ Use the installed CLI, `sync-daemon stop --root <agent-directory>` or `sync-daemon restart --root <agent-directory>`, for explicit service lifecycle control; these are not `/sync daemon` actions. Stop drains the service; reload Pi to reattach its session afterward. See [lifetime and recovery](./docs/daemon-migration.md).
318
+
309
319
  All routes support TUI and RPC; RPC settings and included-content screens are read-only.
310
320
  Print and JSON modes reject `/sync`.
311
321
  Unknown commands or flags, trailing values, and missing setup/snapshot values are rejected, including the former version 2 setup-addressing flag.
@@ -382,12 +392,13 @@ packages/pi-sync/
382
392
  ├── src/
383
393
  │ ├── index.ts # Thin Pi entrypoint
384
394
  │ ├── sync-extension.ts # Registration and session lifecycle ownership
385
- │ ├── commands/ # Parsing, execution, and attention dispatch
386
- │ ├── settings/ # Schema, validation, resolution, and persistence
387
- │ ├── sync/ # Queries, mutations, policy, and lazy loaders
388
- │ ├── snapshot/ # Collection, session paths, apply, and recovery
389
- │ ├── backends/ # Contract and Git, S3, and WebDAV transports
390
- │ ├── state/ # Sync-state persistence, locks, and migration
395
+ │ ├── daemon/ # Public IPC adapter and live Pi queue integration
396
+ │ ├── commands/ # Parsing, dispatch, and attention
397
+ │ ├── settings/ # Settings proposals and public engine contracts
398
+ │ ├── sync/ # Client lifecycle, dispatch, and public contracts
399
+ │ ├── snapshot/ # Public snapshot/session contracts
400
+ │ ├── backends/ # Public backend contract forwarders
401
+ │ ├── state/ # Public state contract forwarders
391
402
  │ └── ui/ # Manager, settings, reviews, and setup flows
392
403
  ├── dist/ # Generated Jiti runtime
393
404
  ├── scripts/build-runtime.mjs # Runtime builder
@@ -396,9 +407,11 @@ packages/pi-sync/
396
407
  └── test/ # Behavior and lifecycle coverage
397
408
  ```
398
409
 
410
+ The [exclude policy safety audit](./docs/exclude-policy-audit.md) maps implementation boundaries to regression coverage.
411
+
399
412
  The generated runtime is built from `src/index.ts` and does not import back into `src`.
400
413
  Internal modules use direct imports from their owners; `src/sync.ts` and `src/types.ts` retain compatibility exports.
401
- Backend transports do not depend on UI, and first-use operation and setup implementations remain lazy.
414
+ Engine implementation lives in the non-extension `@narumitw/sync-daemon` dependency; Pi uses its documented exports, without an in-process transfer fallback. First-use UI and setup implementations remain lazy.
402
415
 
403
416
  ## 🔎 Keywords
404
417
 
@@ -6,12 +6,8 @@ var TERMINAL_CONTROLS = /[\u0000-\u001f\u007f-\u009f\u061c\u200b-\u200f\u202a-\u
6
6
  function safeTerminalText(value) {
7
7
  return value.replace(TERMINAL_CONTROLS, "?");
8
8
  }
9
- function snapshotPathLabel(value) {
10
- return value.replace(TERMINAL_CONTROLS, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`);
11
- }
12
9
 
13
10
  export {
14
- safeTerminalText,
15
- snapshotPathLabel
11
+ safeTerminalText
16
12
  };
17
- //# sourceMappingURL=chunk-AMJRUXFT.ts.map
13
+ //# sourceMappingURL=chunk-2JNFEZ3V.ts.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/ui/terminal-text.ts"],
4
4
  "sourcesContent": ["// biome-ignore lint/suspicious/noControlCharactersInRegex: Terminal and display-direction controls.\nconst TERMINAL_CONTROLS = /[\\u0000-\\u001f\\u007f-\\u009f\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060-\\u2069\\ufeff]/gu;\n\nexport function safeTerminalText(value: string) {\n return value.replace(TERMINAL_CONTROLS, \"?\");\n}\n\n/** Escape before joining a multiline review; raw filesystem paths remain unchanged. */\nexport function snapshotPathLabel(value: string) {\n return value.replace(TERMINAL_CONTROLS, (character) => `\\\\u${character.charCodeAt(0).toString(16).padStart(4, \"0\")}`);\n}\n"],
5
- "mappings": ";;;;AACA,IAAM,oBAAoB;AAEnB,SAAS,iBAAiB,OAAe;AAC9C,SAAO,MAAM,QAAQ,mBAAmB,GAAG;AAC7C;AAGO,SAAS,kBAAkB,OAAe;AAC/C,SAAO,MAAM,QAAQ,mBAAmB,CAAC,cAAc,MAAM,UAAU,WAAW,CAAC,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,EAAE;AACtH;",
5
+ "mappings": ";;;;AACA,IAAM,oBAAoB;AAEnB,SAAS,iBAAiB,OAAe;AAC9C,SAAO,MAAM,QAAQ,mBAAmB,GAAG;AAC7C;",
6
6
  "names": []
7
7
  }
@@ -1,44 +1,52 @@
1
1
  // @generated by scripts/build-runtime.mjs; do not edit.
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
- readSnapshotForHead
5
- } from "./chunk-TIMWN2RH.ts";
4
+ sameSyncExclude
5
+ } from "./chunk-NPT2G4FU.ts";
6
6
  import {
7
- createSyncBackend
8
- } from "./chunk-OJARL2TG.ts";
9
- import {
10
- SyncSetupReviewChangedError,
11
- updateSyncSetup
12
- } from "./chunk-45COPAK7.ts";
7
+ loadConfig,
8
+ syncCheckConfigFingerprint,
9
+ syncConfigReviewFingerprint
10
+ } from "./chunk-7AC2RX4M.ts";
13
11
  import {
14
- captureMutationOwner
15
- } from "./chunk-GNYGNHFF.ts";
12
+ setSyncStatus
13
+ } from "./chunk-ENFHHB5O.ts";
16
14
  import {
17
- safeTerminalText
18
- } from "./chunk-AMJRUXFT.ts";
15
+ throwIfAborted
16
+ } from "./chunk-PDBTD2K6.ts";
19
17
  import {
20
- setSyncStatus
21
- } from "./chunk-YIPK23JW.ts";
18
+ SyncSetupReviewChangedError,
19
+ updateSyncSetup
20
+ } from "./chunk-JZKCOM62.ts";
22
21
  import {
23
22
  errorMessage
24
- } from "./chunk-7D5SF7P3.ts";
25
- import {
26
- loadConfig,
27
- syncCheckConfigFingerprint,
28
- syncConfigReviewFingerprint
29
- } from "./chunk-OVBAW7KV.ts";
23
+ } from "./chunk-HNKLBM3U.ts";
30
24
  import {
31
- throwIfAborted
32
- } from "./chunk-PWMWOJP4.ts";
25
+ safeTerminalText
26
+ } from "./chunk-2JNFEZ3V.ts";
33
27
  import {
34
28
  compareSyncInclude,
35
29
  inspectRemoteSelection,
36
30
  sameSyncInclude
37
- } from "./chunk-KYTT7KV4.ts";
31
+ } from "./chunk-JKBUYCPC.ts";
38
32
 
39
33
  // src/ui/remote-selection-ui.ts
40
34
  import { defineMenu, runMenu } from "@narumitw/pi-tui-kit";
41
35
 
36
+ // src/backends/backend-factory.ts
37
+ import { createSyncBackend } from "@narumitw/sync-daemon/engine/backends/backend-factory";
38
+
39
+ // src/sync/remote-snapshot.ts
40
+ import {
41
+ formatRemoteSelectionStatus,
42
+ readRemoteSnapshot,
43
+ readSnapshotForHead,
44
+ requireCompatibleRemoteSelection
45
+ } from "@narumitw/sync-daemon/engine/sync/remote-snapshot";
46
+
47
+ // src/sync/sync-local.ts
48
+ import { backupLocal, captureMutationOwner, protectedSessionPaths } from "@narumitw/sync-daemon/engine/sync/sync-local";
49
+
42
50
  // src/ui/cancellable-operation.ts
43
51
  import { BorderedLoader } from "@earendil-works/pi-coding-agent";
44
52
  import { isKeyRelease, Key, matchesKey, truncateToWidth } from "@earendil-works/pi-tui";
@@ -336,6 +344,22 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
336
344
  validateOwner();
337
345
  if (!acknowledged) return void 0;
338
346
  }
347
+ if (state.decision.remoteExclude !== void 0 && currentConfig.exclude === void 0) {
348
+ onDialog?.(true);
349
+ let confirmed;
350
+ try {
351
+ confirmed = await ctx.ui.confirm(
352
+ "Adopt excluded paths?",
353
+ "This upgrades settings to version 6 / snapshots to version 4. Older clients must refuse them. Both content lists are saved; no files transfer and old history is not erased.",
354
+ { signal: ownedSignal }
355
+ );
356
+ } finally {
357
+ onDialog?.(false);
358
+ }
359
+ ownedSignal.throwIfAborted();
360
+ validateOwner();
361
+ if (!confirmed) return void 0;
362
+ }
339
363
  return runWithOptionalStateAccess(options, async () => {
340
364
  const loaded = await loadAdoptionReview(state.decision, ownedSignal, factory, validateOwner);
341
365
  ownedSignal.throwIfAborted();
@@ -357,7 +381,8 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
357
381
  options.onSelectionResolved?.();
358
382
  continuationFingerprint = syncCheckConfigFingerprint({
359
383
  ...adoption.value.config,
360
- include: [...state.decision.remoteInclude]
384
+ include: [...state.decision.remoteInclude],
385
+ exclude: adoptedExclude(state.decision)
361
386
  });
362
387
  flowState = { decision: state.decision, saved: true };
363
388
  return { kind: "to", screen: "saved" };
@@ -484,8 +509,8 @@ async function loadAdoptionReview(decision, signal, factory, validateOwner) {
484
509
  const snapshot = await readSnapshotForHead(backend, reviewedHead, signal);
485
510
  throwIfAborted(signal);
486
511
  validateOwner();
487
- const state = inspectRemoteSelection(config.include, snapshot);
488
- if (state.kind !== "different" || !sameSyncInclude(state.include, decision.remoteInclude)) {
512
+ const state = inspectRemoteSelection(config.include, snapshot, config.exclude);
513
+ if (state.kind !== "different" || !sameSyncInclude(state.include, decision.remoteInclude) || !sameSyncExclude(state.exclude, decision.remoteExclude)) {
489
514
  throw new StaleRemoteSelectionReviewError("Remote synced content changed while the comparison was open.");
490
515
  }
491
516
  return { config, backend, reviewedHead };
@@ -500,19 +525,27 @@ async function revalidateAndAdopt(review, decision, signal, validateOwner) {
500
525
  const currentSnapshot = await readSnapshotForHead(review.backend, currentHead, signal);
501
526
  throwIfAborted(signal);
502
527
  validateOwner();
503
- const currentState = inspectRemoteSelection(review.config.include, currentSnapshot);
504
- if (currentState.kind !== "different" || !sameSyncInclude(currentState.include, decision.remoteInclude)) {
528
+ const currentState = inspectRemoteSelection(review.config.include, currentSnapshot, review.config.exclude);
529
+ if (currentState.kind !== "different" || !sameSyncInclude(currentState.include, decision.remoteInclude) || !sameSyncExclude(currentState.exclude, decision.remoteExclude)) {
505
530
  throw new StaleRemoteSelectionReviewError("Remote synced content changed while the comparison was open.");
506
531
  }
507
532
  await updateSyncSetup(
508
533
  decision.setupName,
509
534
  (setup) => {
510
535
  validateOwner();
511
- return { ...setup, sync: { ...setup.sync, include: [...decision.remoteInclude] } };
536
+ return {
537
+ ...setup,
538
+ sync: {
539
+ ...setup.sync,
540
+ include: [...decision.remoteInclude],
541
+ ...adoptedExclude(decision) === void 0 ? {} : { exclude: adoptedExclude(decision) }
542
+ }
543
+ };
512
544
  },
513
545
  {
514
546
  expectedConfigFingerprint: syncCheckConfigFingerprint(review.config),
515
547
  expectedInclude: decision.localInclude,
548
+ upgradeExclude: adoptedExclude(decision) !== void 0,
516
549
  signal
517
550
  }
518
551
  );
@@ -535,7 +568,7 @@ async function inspectConfiguredRemoteSelection(ctx, setupName, signal, factory,
535
568
  return {
536
569
  kind: "selection",
537
570
  config,
538
- state: inspectRemoteSelection(config.include, snapshot)
571
+ state: inspectRemoteSelection(config.include, snapshot, config.exclude)
539
572
  };
540
573
  }
541
574
  async function showLegacyDiscovery(ctx, config, discovered, signal) {
@@ -578,18 +611,22 @@ async function showLegacyDiscovery(ctx, config, discovered, signal) {
578
611
  isCurrent: () => !signal?.aborted
579
612
  });
580
613
  }
614
+ function adoptedExclude(decision) {
615
+ return decision.remoteExclude === void 0 ? decision.localExclude === void 0 ? void 0 : [] : [...decision.remoteExclude];
616
+ }
581
617
  function selectionSummaryLines(decision) {
582
618
  const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);
583
619
  return [
584
620
  `Sync setup: ${safeTerminalText(decision.setupName)}`,
585
621
  "Nothing changed. Review both lists before choosing what happens next.",
586
- ...comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 ? ["Only the ordering differs; membership is the same."] : [`Remote-only paths: ${comparison.remoteOnly.length} \xB7 Device-only paths: ${comparison.localOnly.length}`]
622
+ ...excludeReviewLines(decision),
623
+ ...comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 && sameSyncExclude(decision.localExclude, decision.remoteExclude) ? ["Only the ordering differs; membership is the same."] : [`Remote-only paths: ${comparison.remoteOnly.length} \xB7 Device-only paths: ${comparison.localOnly.length}`]
587
624
  ];
588
625
  }
589
626
  function formatSelectionDifference(decision) {
590
627
  const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);
591
628
  return [
592
- ...comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 ? ["Only ordering differs; both lists contain the same paths.", ""] : [],
629
+ ...comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 && sameSyncExclude(decision.localExclude, decision.remoteExclude) ? ["Only ordering differs; both lists contain the same paths.", ""] : [],
593
630
  "Remote-only paths:",
594
631
  ...comparison.remoteOnly.length > 0 ? comparison.remoteOnly.map((item) => `+ ${safeTerminalText(item)}`) : ["(none)"],
595
632
  "",
@@ -602,6 +639,7 @@ function formatSelectionDifference(decision) {
602
639
  "This device's ordered list:",
603
640
  ...decision.localInclude.length > 0 ? decision.localInclude.map((item, index) => `${index + 1}. ${safeTerminalText(item)}`) : ["(none)"],
604
641
  "",
642
+ ...excludeReviewLines(decision),
605
643
  "Using the remote list saves settings only and does not pull files."
606
644
  ].join("\n");
607
645
  }
@@ -611,14 +649,23 @@ function formatRemoteSelectionSummary(decision) {
611
649
  `Synced content for \u201C${safeTerminalText(decision.setupName)}\u201D differs from this device.`,
612
650
  `Remote-only: ${safeList(comparison.remoteOnly)}`,
613
651
  `Device-only: ${safeList(comparison.localOnly)}`,
614
- ...comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 ? [
652
+ ...comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 && sameSyncExclude(decision.localExclude, decision.remoteExclude) ? [
615
653
  "Only ordering differs.",
616
654
  `Remote order: ${safeList(decision.remoteInclude)}`,
617
655
  `Device order: ${safeList(decision.localInclude)}`
618
656
  ] : [],
657
+ ...excludeReviewLines(decision),
619
658
  "Run /sync in TUI to choose a content list; RPC review is read-only."
620
659
  ].join("\n");
621
660
  }
661
+ function excludeReviewLines(decision) {
662
+ if (decision.localExclude === void 0 && decision.remoteExclude === void 0) return [];
663
+ return [
664
+ `Remote excluded paths: ${safeList(decision.remoteExclude ?? [])}`,
665
+ `This device excluded paths: ${safeList(decision.localExclude ?? [])}`,
666
+ "Removed exclusions can expose or replace content; old history is not erased."
667
+ ];
668
+ }
622
669
  function formatLegacySummary(config, discovered) {
623
670
  return `Remote snapshot for \u201C${safeTerminalText(config.setupName)}\u201D has no portable synced-content list; ${discovered.length} safe path${discovered.length === 1 ? " was" : "s were"} discovered, but the result is partial and read-only.`;
624
671
  }
@@ -627,11 +674,13 @@ function decisionFromState(config, state) {
627
674
  setupName: config.setupName,
628
675
  configIdentity: syncConfigReviewFingerprint(config),
629
676
  localInclude: [...config.include],
630
- remoteInclude: [...state.include]
677
+ remoteInclude: [...state.include],
678
+ ...config.exclude === void 0 ? {} : { localExclude: [...config.exclude] },
679
+ ...state.exclude === void 0 ? {} : { remoteExclude: [...state.exclude] }
631
680
  };
632
681
  }
633
682
  function assertLocalSelectionCurrent(config, decision) {
634
- if (syncConfigReviewFingerprint(config) === decision.configIdentity && sameSyncInclude(config.include, decision.localInclude)) {
683
+ if (syncConfigReviewFingerprint(config) === decision.configIdentity && sameSyncInclude(config.include, decision.localInclude) && sameSyncExclude(config.exclude, decision.localExclude)) {
635
684
  return;
636
685
  }
637
686
  throw new StaleRemoteSelectionReviewError(
@@ -681,7 +730,8 @@ function combineSignals(sessionSignal, actionSignal) {
681
730
  }
682
731
 
683
732
  export {
733
+ captureMutationOwner,
684
734
  runCancellableOperation,
685
735
  showRemoteSelectionReview
686
736
  };
687
- //# sourceMappingURL=chunk-MG66XM5U.ts.map
737
+ //# sourceMappingURL=chunk-4RNCZZY7.ts.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ui/remote-selection-ui.ts", "../../src/backends/backend-factory.ts", "../../src/sync/remote-snapshot.ts", "../../src/sync/sync-local.ts", "../../src/ui/cancellable-operation.ts"],
4
+ "sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\nimport { createSyncBackend, type SyncBackendFactory } from \"../backends/backend-factory.js\";\nimport type { RemoteHead, SyncBackend } from \"../backends/sync-backend.js\";\nimport { loadConfig, syncCheckConfigFingerprint, syncConfigReviewFingerprint } from \"../settings/config.js\";\nimport { SyncSetupReviewChangedError, updateSyncSetup } from \"../settings/settings-management.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { sameSyncExclude } from \"../sync/exclude-policy.js\";\nimport { readSnapshotForHead } from \"../sync/remote-snapshot.js\";\nimport { throwIfAborted } from \"../sync/signals.js\";\nimport { errorMessage } from \"../sync/sync-errors.js\";\nimport { captureMutationOwner } from \"../sync/sync-local.js\";\nimport {\n compareSyncInclude,\n inspectRemoteSelection,\n type RemoteSelectionDecision,\n type RemoteSelectionState,\n sameSyncInclude,\n} from \"../sync/sync-policy.js\";\nimport {\n type RunRoute,\n type RunRouteResult,\n runCancellableOperation,\n runCancellableTask,\n} from \"./cancellable-operation.js\";\nimport { setSyncStatus } from \"./sync-status.js\";\nimport { safeTerminalText } from \"./terminal-text.js\";\n\nexport type RemoteSelectionOrigin = \"settings\" | \"sync\" | \"pull\" | \"push\";\n\nexport interface RemoteSelectionReviewOptions {\n decision?: RemoteSelectionDecision;\n origin?: RemoteSelectionOrigin;\n runRoute?: RunRoute;\n cancelLabel?: string;\n /** The explicit mismatch is resolved or superseded; this does not imply file equality. */\n onSelectionResolved?: () => void;\n withStateAccess?: <T>(task: () => Promise<T>) => Promise<T>;\n}\n\nexport type RemoteSelectionReviewResult =\n | { kind: \"back\" }\n | { kind: \"closed\" }\n | { kind: \"done\" }\n | { kind: \"stale\" }\n | { kind: \"route-result\"; result: RunRouteResult; route: \"sync\" | \"pull\" | \"push\" };\n\nexport async function showRemoteSelectionReview(\n ctx: ExtensionContext,\n setupName?: string,\n signal?: AbortSignal,\n factory: SyncBackendFactory = createSyncBackend,\n options: RemoteSelectionReviewOptions = {},\n): Promise<RemoteSelectionReviewResult> {\n const validateOwner = captureMutationOwner(ctx, signal);\n const isCurrent = () => isReviewOwnerCurrent(validateOwner);\n try {\n validateOwner();\n let decision = options.decision;\n if (!decision) {\n const inspection = await runCancellableTask(\n ctx,\n \"Checking remote content list\u2026\",\n (workSignal) => inspectConfiguredRemoteSelection(ctx, setupName, workSignal, factory, validateOwner),\n { signal, isCurrent, cancelledMessage: null },\n );\n if (!isCurrent()) return { kind: \"stale\" };\n if (inspection.kind !== \"completed\") return { kind: inspection.kind === \"cancelled\" ? \"back\" : \"closed\" };\n validateOwner();\n const inspected = inspection.value;\n if (!inspected) return { kind: \"stale\" };\n // A successful fresh read can supersede an old explicit mismatch without\n // changing local settings. This is not user cancellation or proof of file equality.\n if (inspected.kind === \"empty\" || inspected.state.kind !== \"different\") {\n options.onSelectionResolved?.();\n }\n if (inspected.kind === \"empty\") {\n ctx.ui.notify(\"Remote storage has no snapshot or synced-content list yet.\", \"info\");\n return { kind: \"back\" };\n }\n if (inspected.state.kind === \"same\") {\n ctx.ui.notify(\"Remote synced content already matches this sync setup.\", \"info\");\n return { kind: \"back\" };\n }\n if (inspected.state.kind === \"legacy\") {\n if (ctx.mode !== \"tui\") {\n ctx.ui.notify(formatLegacySummary(inspected.config, inspected.state.discovered), \"info\");\n return { kind: \"back\" };\n }\n await showLegacyDiscovery(ctx, inspected.config, inspected.state.discovered, signal);\n return signal?.aborted ? { kind: \"stale\" } : { kind: \"back\" };\n }\n decision = decisionFromState(inspected.config, inspected.state);\n }\n\n if (ctx.mode !== \"tui\") {\n ctx.ui.notify(formatRemoteSelectionSummary(decision), \"warning\");\n return { kind: \"back\" };\n }\n\n let currentDecision = decision;\n for (;;) {\n if (signal?.aborted) return { kind: \"stale\" };\n const result = await showSelectionDifference(\n ctx,\n currentDecision,\n options.origin ?? \"settings\",\n options.runRoute,\n signal,\n factory,\n options,\n validateOwner,\n );\n if (result.kind !== \"refresh\") return result;\n const refresh = await runCancellableTask(\n ctx,\n \"Refreshing remote content list\u2026\",\n (workSignal) =>\n runWithOptionalStateAccess(options, () =>\n inspectConfiguredRemoteSelection(ctx, currentDecision.setupName, workSignal, factory, validateOwner),\n ),\n { signal, isCurrent, cancelledMessage: null },\n );\n if (!isCurrent()) return { kind: \"stale\" };\n if (refresh.kind !== \"completed\") return { kind: refresh.kind === \"cancelled\" ? \"back\" : \"closed\" };\n validateOwner();\n const refreshed = refresh.value;\n if (!refreshed) return { kind: \"stale\" };\n if (refreshed.kind === \"empty\") {\n options.onSelectionResolved?.();\n ctx.ui.notify(\"Remote storage no longer has a snapshot or synced-content list.\", \"warning\");\n return { kind: \"back\" };\n }\n if (refreshed.state.kind !== \"different\") {\n ctx.ui.notify(\n refreshed.state.kind === \"same\"\n ? \"Remote synced content now matches this sync setup.\"\n : \"The refreshed legacy snapshot has no authoritative synced-content list.\",\n \"info\",\n );\n options.onSelectionResolved?.();\n return { kind: \"done\" };\n }\n currentDecision = decisionFromState(refreshed.config, refreshed.state);\n }\n } catch (error) {\n if (!isCurrent()) return { kind: \"stale\" };\n ctx.ui.notify(`Could not review synced content: ${errorMessage(error)}`, \"error\");\n return { kind: \"back\" };\n } finally {\n if (isCurrent()) setSyncStatus(ctx, undefined);\n }\n}\n\ntype DifferenceFlowResult = RemoteSelectionReviewResult | { kind: \"refresh\" };\n\nasync function showSelectionDifference(\n ctx: ExtensionContext,\n initialDecision: RemoteSelectionDecision,\n origin: RemoteSelectionOrigin,\n runRoute: RunRoute | undefined,\n sessionSignal: AbortSignal | undefined,\n factory: SyncBackendFactory,\n options: Pick<RemoteSelectionReviewOptions, \"cancelLabel\" | \"onSelectionResolved\" | \"withStateAccess\">,\n validateOwner: () => void,\n): Promise<DifferenceFlowResult> {\n type Screen = \"choice\" | \"review\" | \"saved\";\n type Action = \"adopt\" | \"keep\" | \"cancel\" | \"continue\" | \"done\";\n interface FlowState {\n decision: RemoteSelectionDecision;\n saved: boolean;\n }\n const isCurrent = () => isReviewOwnerCurrent(validateOwner);\n let flowState: FlowState = { decision: initialDecision, saved: false };\n let continuationFingerprint: string | undefined;\n let nextResult: RemoteSelectionReviewResult | undefined;\n let refreshRequested = false;\n const route = origin === \"settings\" ? \"sync\" : origin;\n const menu = defineMenu<FlowState, Screen, Action, ExtensionContext>({\n start: \"choice\",\n screens: {\n choice: ({ state }) => ({\n kind: \"actions\",\n title: \"Synced content differs\",\n lines: selectionSummaryLines(state.decision),\n items: [\n {\n id: \"review\",\n label: \"Review all paths (recommended)\",\n description: \"Compare exact remote-only, device-only, and ordered lists.\",\n to: \"review\",\n },\n {\n id: \"adopt\",\n label: \"Use remote content list\",\n description: \"Save the reviewed list on this device without pulling files.\",\n action: \"adopt\",\n },\n {\n id: \"keep\",\n label: \"Keep this device's content list and update remote\u2026\",\n description: \"Open the existing exact force-push preview without skipping confirmation.\",\n action: \"keep\",\n },\n { id: \"cancel\", label: options.cancelLabel ?? \"Cancel\", action: \"cancel\" },\n ],\n hint: \"back\",\n }),\n review: ({ state }) => ({\n kind: \"review\",\n title: `Review synced content \u00B7 ${safeTerminalText(state.decision.setupName)}`,\n content: formatSelectionDifference(state.decision),\n format: { kind: \"text\" },\n viewportSize: \"adaptive\",\n hint: \"back\",\n }),\n saved: ({ state }) => ({\n kind: \"actions\",\n title: \"Remote content list saved\",\n lines: [\n `Sync setup: ${safeTerminalText(state.decision.setupName)}`,\n \"Only the included-content setting was saved.\",\n \"No files were pulled and sync state was not changed.\",\n ],\n items: [\n ...(runRoute\n ? [\n {\n id: \"continue\",\n label: continueLabel(origin),\n description: \"Start a fresh check and exact preview for this sync setup.\",\n action: \"continue\" as const,\n },\n ]\n : []),\n { id: \"done\", label: \"Done\", action: \"done\" },\n ],\n hint: \"close\",\n }),\n },\n actions: {\n adopt: async ({ state, signal: actionSignal }) => {\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n const adoption = await runCancellableTask(\n ctx,\n \"Checking and saving remote content list\u2026\",\n async (workSignal, _onCommit, onDialog) => {\n const ownedSignal = workSignal ?? signal;\n const currentConfig = await loadConfig(state.decision.setupName);\n ownedSignal.throwIfAborted();\n validateOwner();\n assertLocalSelectionCurrent(currentConfig, state.decision);\n if (!currentConfig.include.includes(\"sessions\") && state.decision.remoteInclude.includes(\"sessions\")) {\n onDialog?.(true);\n let acknowledged: boolean;\n try {\n acknowledged = await ctx.ui.confirm(\n \"Use a content list that includes session conversations?\",\n \"Session JSONL may contain prompts, tool output, file paths, images, and secrets. This saves the list only; it does not pull files.\",\n { signal: ownedSignal },\n );\n } finally {\n onDialog?.(false);\n }\n ownedSignal.throwIfAborted();\n validateOwner();\n if (!acknowledged) return undefined;\n }\n if (state.decision.remoteExclude !== undefined && currentConfig.exclude === undefined) {\n onDialog?.(true);\n let confirmed: boolean;\n try {\n confirmed = await ctx.ui.confirm(\n \"Adopt excluded paths?\",\n \"This upgrades settings to version 6 / snapshots to version 4. Older clients must refuse them. Both content lists are saved; no files transfer and old history is not erased.\",\n { signal: ownedSignal },\n );\n } finally {\n onDialog?.(false);\n }\n ownedSignal.throwIfAborted();\n validateOwner();\n if (!confirmed) return undefined;\n }\n return runWithOptionalStateAccess(options, async () => {\n const loaded = await loadAdoptionReview(state.decision, ownedSignal, factory, validateOwner);\n ownedSignal.throwIfAborted();\n validateOwner();\n await revalidateAndAdopt(loaded, state.decision, ownedSignal, validateOwner);\n return loaded;\n });\n },\n {\n signal,\n isCurrent,\n cancelAcrossDialogs: true,\n cancelledMessage: \"Remote content-list adoption cancelled.\",\n },\n );\n if (signal.aborted || adoption.kind === \"closed\") return { kind: \"close\" as const };\n if (adoption.kind === \"cancelled\" || !adoption.value) return { kind: \"stay\" as const };\n validateOwner();\n options.onSelectionResolved?.();\n continuationFingerprint = syncCheckConfigFingerprint({\n ...adoption.value.config,\n include: [...state.decision.remoteInclude],\n exclude: adoptedExclude(state.decision),\n });\n flowState = { decision: state.decision, saved: true };\n return { kind: \"to\" as const, screen: \"saved\" as const };\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n if (isStaleReviewError(error)) {\n ctx.ui.notify(`${errorMessage(error)} Refreshing the comparison.`, \"warning\");\n refreshRequested = true;\n return { kind: \"close\" as const };\n }\n ctx.ui.notify(`Could not save the remote content list: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n keep: async ({ state, signal: actionSignal }) => {\n if (!runRoute) {\n ctx.ui.notify(\"The reviewed update-remote route is unavailable.\", \"error\");\n return { kind: \"stay\" as const };\n }\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n const latest = await loadConfig(state.decision.setupName);\n if (signal.aborted) return { kind: \"close\" as const };\n validateOwner();\n assertLocalSelectionCurrent(latest, state.decision);\n const result = await runCancellableOperation(\n ctx,\n \"Preparing this device's push preview\u2026\",\n \"push --force\",\n runRoute,\n {\n commitAware: true,\n cancelledMessage: \"Push preparation cancelled; no remote files were changed.\",\n target: state.decision.setupName,\n signal,\n },\n );\n return handleNestedRouteResult(result, \"push\");\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n if (isStaleReviewError(error)) {\n ctx.ui.notify(`${errorMessage(error)} Refreshing the comparison.`, \"warning\");\n refreshRequested = true;\n return { kind: \"close\" as const };\n }\n ctx.ui.notify(`Could not prepare the remote update: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n continue: async ({ state, signal: actionSignal }) => {\n if (!runRoute || !continuationFingerprint) return { kind: \"stay\" as const };\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n const latest = await loadConfig(state.decision.setupName);\n if (signal.aborted) return { kind: \"close\" as const };\n validateOwner();\n if (syncCheckConfigFingerprint(latest) !== continuationFingerprint) {\n throw new StaleRemoteSelectionReviewError(\n `Sync setup \u201C${safeTerminalText(state.decision.setupName)}\u201D changed after the remote content list was saved.`,\n );\n }\n const result = await runCancellableOperation(ctx, continueBusyLabel(origin), route, runRoute, {\n commitAware: true,\n cancelledMessage: continuationCancelledMessage(route),\n target: state.decision.setupName,\n signal,\n });\n return handleNestedRouteResult(result, route);\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n ctx.ui.notify(`Could not continue: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n cancel: async () => ({ kind: \"back\" }),\n done: async () => {\n nextResult = { kind: \"done\" };\n return { kind: \"close\" };\n },\n },\n });\n\n function handleNestedRouteResult(\n result: Awaited<ReturnType<typeof runCancellableOperation>>,\n nestedRoute: \"sync\" | \"pull\" | \"push\",\n ) {\n if (result.kind === \"completed\" && result.outcome === \"applied\") {\n options.onSelectionResolved?.();\n }\n if (result.kind === \"closed\") {\n nextResult = { kind: \"closed\" };\n return { kind: \"close\" as const };\n }\n if (\n result.kind === \"cancelled\" ||\n (result.kind === \"completed\" && result.outcome === \"cancelled\") ||\n result.kind === \"failed\"\n ) {\n return { kind: \"stay\" as const };\n }\n nextResult = { kind: \"route-result\", result, route: nestedRoute };\n return { kind: \"close\" as const };\n }\n\n const menuResult = await runMenu(ctx, menu, {\n getState: () => flowState,\n signal: sessionSignal,\n isCurrent,\n onError: (_menuCtx, error) => ctx.ui.notify(errorMessage(error), \"error\"),\n });\n if (!isCurrent() || menuResult.kind === \"stale\") return { kind: \"stale\" };\n if (refreshRequested) return { kind: \"refresh\" };\n if (nextResult) return nextResult;\n if (menuResult.kind === \"closed\") {\n return menuResult.reason === \"back\" ? { kind: \"back\" } : { kind: \"closed\" };\n }\n return { kind: \"closed\" };\n}\n\ninterface AdoptionReview {\n config: AnySyncConfig;\n backend: SyncBackend;\n reviewedHead: RemoteHead;\n}\n\nasync function loadAdoptionReview(\n decision: RemoteSelectionDecision,\n signal: AbortSignal,\n factory: SyncBackendFactory,\n validateOwner: () => void,\n): Promise<AdoptionReview> {\n const config = await loadConfig(decision.setupName);\n throwIfAborted(signal);\n validateOwner();\n assertLocalSelectionCurrent(config, decision);\n const backend = await factory(config);\n throwIfAborted(signal);\n validateOwner();\n const reviewedHead = await backend.readHead(signal);\n throwIfAborted(signal);\n validateOwner();\n if (!reviewedHead) {\n throw new StaleRemoteSelectionReviewError(\"Remote storage changed while the comparison was open.\");\n }\n const snapshot = await readSnapshotForHead(backend, reviewedHead, signal);\n throwIfAborted(signal);\n validateOwner();\n const state = inspectRemoteSelection(config.include, snapshot, config.exclude);\n if (\n state.kind !== \"different\" ||\n !sameSyncInclude(state.include, decision.remoteInclude) ||\n !sameSyncExclude(state.exclude, decision.remoteExclude)\n ) {\n throw new StaleRemoteSelectionReviewError(\"Remote synced content changed while the comparison was open.\");\n }\n return { config, backend, reviewedHead };\n}\n\nasync function revalidateAndAdopt(\n review: AdoptionReview,\n decision: RemoteSelectionDecision,\n signal: AbortSignal,\n validateOwner: () => void,\n) {\n const currentHead = await review.backend.readHead(signal);\n throwIfAborted(signal);\n validateOwner();\n if (!currentHead || !review.backend.sameRevision(review.reviewedHead.revision, currentHead.revision)) {\n throw new StaleRemoteSelectionReviewError(\"Remote storage changed while the comparison was open.\");\n }\n const currentSnapshot = await readSnapshotForHead(review.backend, currentHead, signal);\n throwIfAborted(signal);\n validateOwner();\n const currentState = inspectRemoteSelection(review.config.include, currentSnapshot, review.config.exclude);\n if (\n currentState.kind !== \"different\" ||\n !sameSyncInclude(currentState.include, decision.remoteInclude) ||\n !sameSyncExclude(currentState.exclude, decision.remoteExclude)\n ) {\n throw new StaleRemoteSelectionReviewError(\"Remote synced content changed while the comparison was open.\");\n }\n await updateSyncSetup(\n decision.setupName,\n (setup) => {\n validateOwner();\n return {\n ...setup,\n sync: {\n ...setup.sync,\n include: [...decision.remoteInclude],\n ...(adoptedExclude(decision) === undefined ? {} : { exclude: adoptedExclude(decision) }),\n },\n };\n },\n {\n expectedConfigFingerprint: syncCheckConfigFingerprint(review.config),\n expectedInclude: decision.localInclude,\n upgradeExclude: adoptedExclude(decision) !== undefined,\n signal,\n },\n );\n}\n\nasync function inspectConfiguredRemoteSelection(\n ctx: ExtensionContext,\n setupName: string | undefined,\n signal: AbortSignal | undefined,\n factory: SyncBackendFactory,\n validateOwner: () => void,\n): Promise<\n | { kind: \"empty\"; config: AnySyncConfig }\n | { kind: \"selection\"; config: AnySyncConfig; state: RemoteSelectionState }\n | undefined\n> {\n const config = await loadConfig(setupName);\n if (signal?.aborted) return undefined;\n validateOwner();\n setSyncStatus(ctx, `checking synced content for ${safeTerminalText(config.setupName)}`, { activity: \"checking\" });\n const backend = await factory(config);\n if (signal?.aborted) return undefined;\n validateOwner();\n const head = await backend.readHead(signal);\n if (signal?.aborted) return undefined;\n validateOwner();\n if (!head) return { kind: \"empty\", config };\n const snapshot = await readSnapshotForHead(backend, head, signal);\n if (signal?.aborted) return undefined;\n validateOwner();\n return {\n kind: \"selection\",\n config,\n state: inspectRemoteSelection(config.include, snapshot, config.exclude),\n };\n}\n\nasync function showLegacyDiscovery(\n ctx: ExtensionContext,\n config: AnySyncConfig,\n discovered: string[],\n signal?: AbortSignal,\n) {\n const menu = defineMenu<undefined, \"choice\" | \"review\", \"back\", ExtensionContext>({\n start: \"choice\",\n screens: {\n choice: () => ({\n kind: \"actions\",\n title: `Compare synced content \u00B7 ${safeTerminalText(config.setupName)}`,\n lines: [\n \"This legacy snapshot has no portable synced-content list.\",\n \"Discovered paths are partial and read-only; preserved files may not have been selected.\",\n ],\n items: [\n { id: \"review\", label: \"Review discovered paths\", to: \"review\" },\n { id: \"back\", label: \"Back\", action: \"back\" },\n ],\n hint: \"close\",\n }),\n review: () => ({\n kind: \"review\",\n title: \"Partial discovery from legacy snapshot\",\n content: [\n \"Partial discovery only \u2014 not an authoritative selection.\",\n \"\",\n ...(discovered.length > 0\n ? discovered.map((item) => `Discovered: ${safeTerminalText(item)}`)\n : [\"No safe paths were discovered.\"]),\n \"\",\n \"Use Add custom path\u2026 in the local Included Content editor if needed.\",\n ].join(\"\\n\"),\n format: { kind: \"text\" },\n viewportSize: \"adaptive\",\n hint: \"back\",\n }),\n },\n actions: { back: async () => ({ kind: \"close\" }) },\n });\n await runMenu(ctx, menu, {\n getState: () => undefined,\n signal,\n isCurrent: () => !signal?.aborted,\n });\n}\n\nfunction adoptedExclude(decision: RemoteSelectionDecision) {\n return decision.remoteExclude === undefined\n ? decision.localExclude === undefined\n ? undefined\n : []\n : [...decision.remoteExclude];\n}\n\nfunction selectionSummaryLines(decision: RemoteSelectionDecision) {\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n `Sync setup: ${safeTerminalText(decision.setupName)}`,\n \"Nothing changed. Review both lists before choosing what happens next.\",\n ...excludeReviewLines(decision),\n ...(comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\"Only the ordering differs; membership is the same.\"]\n : [`Remote-only paths: ${comparison.remoteOnly.length} \u00B7 Device-only paths: ${comparison.localOnly.length}`]),\n ];\n}\n\nfunction formatSelectionDifference(decision: RemoteSelectionDecision) {\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n ...(comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\"Only ordering differs; both lists contain the same paths.\", \"\"]\n : []),\n \"Remote-only paths:\",\n ...(comparison.remoteOnly.length > 0\n ? comparison.remoteOnly.map((item) => `+ ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"Device-only paths:\",\n ...(comparison.localOnly.length > 0\n ? comparison.localOnly.map((item) => `- ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"Remote ordered list:\",\n ...(decision.remoteInclude.length > 0\n ? decision.remoteInclude.map((item, index) => `${index + 1}. ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"This device's ordered list:\",\n ...(decision.localInclude.length > 0\n ? decision.localInclude.map((item, index) => `${index + 1}. ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n ...excludeReviewLines(decision),\n \"Using the remote list saves settings only and does not pull files.\",\n ].join(\"\\n\");\n}\n\nfunction formatRemoteSelectionSummary(decision: RemoteSelectionDecision) {\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n `Synced content for \u201C${safeTerminalText(decision.setupName)}\u201D differs from this device.`,\n `Remote-only: ${safeList(comparison.remoteOnly)}`,\n `Device-only: ${safeList(comparison.localOnly)}`,\n ...(comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\n \"Only ordering differs.\",\n `Remote order: ${safeList(decision.remoteInclude)}`,\n `Device order: ${safeList(decision.localInclude)}`,\n ]\n : []),\n ...excludeReviewLines(decision),\n \"Run /sync in TUI to choose a content list; RPC review is read-only.\",\n ].join(\"\\n\");\n}\n\nfunction excludeReviewLines(decision: RemoteSelectionDecision) {\n if (decision.localExclude === undefined && decision.remoteExclude === undefined) return [];\n return [\n `Remote excluded paths: ${safeList(decision.remoteExclude ?? [])}`,\n `This device excluded paths: ${safeList(decision.localExclude ?? [])}`,\n \"Removed exclusions can expose or replace content; old history is not erased.\",\n ];\n}\n\nfunction formatLegacySummary(config: AnySyncConfig, discovered: readonly string[]) {\n return `Remote snapshot for \u201C${safeTerminalText(config.setupName)}\u201D has no portable synced-content list; ${discovered.length} safe path${discovered.length === 1 ? \" was\" : \"s were\"} discovered, but the result is partial and read-only.`;\n}\n\nfunction decisionFromState(\n config: AnySyncConfig,\n state: Extract<RemoteSelectionState, { kind: \"different\" }>,\n): RemoteSelectionDecision {\n return {\n setupName: config.setupName,\n configIdentity: syncConfigReviewFingerprint(config),\n localInclude: [...config.include],\n remoteInclude: [...state.include],\n ...(config.exclude === undefined ? {} : { localExclude: [...config.exclude] }),\n ...(state.exclude === undefined ? {} : { remoteExclude: [...state.exclude] }),\n };\n}\n\nfunction assertLocalSelectionCurrent(config: AnySyncConfig, decision: RemoteSelectionDecision) {\n if (\n syncConfigReviewFingerprint(config) === decision.configIdentity &&\n sameSyncInclude(config.include, decision.localInclude) &&\n sameSyncExclude(config.exclude, decision.localExclude)\n ) {\n return;\n }\n throw new StaleRemoteSelectionReviewError(\n `Sync setup \u201C${safeTerminalText(config.setupName)}\u201D changed while the comparison was open.`,\n );\n}\n\nfunction continueLabel(origin: RemoteSelectionOrigin) {\n if (origin === \"pull\") return \"Continue Pull now\u2026\";\n if (origin === \"push\") return \"Continue Push now\u2026\";\n return \"Continue Sync now\u2026\";\n}\n\nfunction continueBusyLabel(origin: RemoteSelectionOrigin) {\n if (origin === \"pull\") return \"Checking remote changes\u2026\";\n if (origin === \"push\") return \"Preparing push preview\u2026\";\n return \"Checking current sync setup\u2026\";\n}\n\nfunction continuationCancelledMessage(route: \"sync\" | \"pull\" | \"push\") {\n if (route === \"pull\") return \"Pull check cancelled; no local files were changed.\";\n if (route === \"push\") return \"Push preparation cancelled; no remote files were changed.\";\n return \"Sync check cancelled; no settings or files were changed.\";\n}\n\nfunction safeList(values: readonly string[]) {\n return values.length > 0 ? values.map(safeTerminalText).join(\", \") : \"none\";\n}\n\nclass StaleRemoteSelectionReviewError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"StaleRemoteSelectionReviewError\";\n }\n}\n\nfunction isStaleReviewError(error: unknown) {\n return error instanceof StaleRemoteSelectionReviewError || error instanceof SyncSetupReviewChangedError;\n}\n\nfunction runWithOptionalStateAccess<T>(\n options: Pick<RemoteSelectionReviewOptions, \"withStateAccess\">,\n task: () => Promise<T>,\n) {\n return options.withStateAccess ? options.withStateAccess(task) : task();\n}\n\nfunction isReviewOwnerCurrent(validateOwner: () => void) {\n try {\n validateOwner();\n return true;\n } catch {\n return false;\n }\n}\n\nfunction combineSignals(sessionSignal: AbortSignal | undefined, actionSignal: AbortSignal) {\n return sessionSignal ? AbortSignal.any([sessionSignal, actionSignal]) : actionSignal;\n}\n", "export type * from \"@narumitw/sync-daemon/engine/backends/backend-factory\";\nexport { createSyncBackend } from \"@narumitw/sync-daemon/engine/backends/backend-factory\";\n", "export type * from \"@narumitw/sync-daemon/engine/sync/remote-snapshot\";\nexport {\n formatRemoteSelectionStatus,\n readRemoteSnapshot,\n readSnapshotForHead,\n requireCompatibleRemoteSelection,\n} from \"@narumitw/sync-daemon/engine/sync/remote-snapshot\";\n", "export type * from \"@narumitw/sync-daemon/engine/sync/sync-local\";\nexport { backupLocal, captureMutationOwner, protectedSessionPaths } from \"@narumitw/sync-daemon/engine/sync/sync-local\";\n", "import { BorderedLoader, type ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { isKeyRelease, Key, matchesKey, truncateToWidth } from \"@earendil-works/pi-tui\";\nimport { formatInteractionHints, runCustomInteraction } from \"@narumitw/pi-tui-kit\";\nimport type { SetupPullOutcome } from \"../sync/setup-switch.js\";\nimport type { SyncDecision } from \"../sync/sync-decision.js\";\nimport type { RemoteSelectionDecision } from \"../sync/sync-policy.js\";\n\nexport type RunRouteResult =\n | { kind: \"completed\"; outcome?: SetupPullOutcome }\n | { kind: \"decision-required\"; decision: SyncDecision }\n | { kind: \"remote-selection-required\"; decision: RemoteSelectionDecision }\n | { kind: \"failed\" };\n\nexport type RunRoute = (\n route: string,\n signal?: AbortSignal,\n onCommit?: () => void,\n target?: string,\n onDialog?: (active: boolean) => void,\n retryRefusal?: boolean,\n) => Promise<RunRouteResult | undefined>;\n\nexport type CancellableOperationResult = RunRouteResult | { kind: \"closed\" } | { kind: \"cancelled\" };\n\ninterface CancellableOperationOptions {\n commitAware?: boolean;\n cancelAcrossDialogs?: boolean;\n cancelledMessage?: string | null;\n target?: string;\n signal?: AbortSignal;\n isCurrent?: () => boolean;\n}\n\nexport async function runCancellableOperation(\n ctx: ExtensionContext,\n message: string,\n route: string,\n runRoute: RunRoute,\n options: CancellableOperationOptions = {},\n): Promise<CancellableOperationResult> {\n const result = await runCancellableTask(\n ctx,\n message,\n (signal, onCommit, onDialog) => runRoute(route, signal, onCommit, options.target, onDialog),\n options,\n );\n return result.kind === \"completed\" ? (result.value ?? { kind: \"failed\" }) : result;\n}\n\nexport type CancellableTaskResult<Value> =\n | { kind: \"completed\"; value: Value }\n | { kind: \"closed\" }\n | { kind: \"cancelled\" };\n\n/** Keep non-route work under the same cancellation and drain owner as transfers. */\nexport async function runCancellableTask<Value>(\n ctx: ExtensionContext,\n message: string,\n task: (\n signal: AbortSignal | undefined,\n onCommit?: () => void,\n onDialog?: (active: boolean) => void,\n ) => Promise<Value>,\n options: Omit<CancellableOperationOptions, \"target\"> = {},\n): Promise<CancellableTaskResult<Value>> {\n const {\n commitAware = false,\n cancelAcrossDialogs = false,\n cancelledMessage = \"Check cancelled; no settings or files were changed.\",\n signal,\n isCurrent = () => true,\n } = options;\n if (signal?.aborted || !isCurrent()) return { kind: \"closed\" };\n if (ctx.mode !== \"tui\") return { kind: \"completed\", value: await task(signal) };\n let commitStarted = false;\n let taskResult!: Value;\n const interaction = await runCustomInteraction<{ cancelled?: boolean; error?: unknown }, ExtensionContext>(ctx, {\n signal,\n isCurrent: () => !signal?.aborted && isCurrent(),\n create: ({ tui, theme, keybindings, signal: interactionSignal, complete }) => {\n const loader = new BorderedLoader(tui, theme, message, { cancellable: false });\n const cancelHint = formatInteractionHints(keybindings, [\n {\n keys: [...keybindings.getKeys(\"tui.select.cancel\").filter((key) => !hasControlCharacter(key)), \"ctrl+c\"],\n label: \"cancel\",\n },\n ]);\n const cancel = (data: string) => {\n // Raw terminal listeners run before Pi filters Kitty key releases.\n if (isKeyRelease(data)) return false;\n if (!matchesKey(data, Key.ctrl(\"c\")) && !keybindings.matches(data, \"tui.select.cancel\")) return false;\n if (commitStarted) {\n ctx.ui.notify(\"Applying or publishing has started and cannot be cancelled safely.\", \"warning\");\n } else complete({ cancelled: true });\n return true;\n };\n // Pi dialogs replace this loader and restore the normal editor. Defer\n // ordinary keys while they are open; retain raw cancellation afterward.\n // Ctrl+C remains the root flow's hard-cancel path regardless of focus.\n let activeDialogs = 0;\n const unsubscribe = cancelAcrossDialogs\n ? ctx.ui.onTerminalInput((data) => {\n if (isKeyRelease(data)) return;\n if (activeDialogs > 0 && !matchesKey(data, Key.ctrl(\"c\"))) return;\n return cancel(data) ? { consume: true } : undefined;\n })\n : undefined;\n let pendingTask: Promise<Value>;\n try {\n pendingTask = task(\n interactionSignal,\n commitAware ? () => (commitStarted = true) : undefined,\n cancelAcrossDialogs\n ? (active) => {\n activeDialogs += active ? 1 : -1;\n }\n : undefined,\n );\n } catch (error) {\n unsubscribe?.();\n loader.dispose();\n throw error;\n }\n const operation = pendingTask.then(\n (result) => {\n taskResult = result;\n complete({});\n },\n (error: unknown) => complete({ error }),\n );\n return {\n render(width: number) {\n if (width <= 0) return [];\n const safeWidth = Math.max(1, width);\n const lines = loader.render(safeWidth);\n const bottomBorder = lines.at(-1);\n return [\n ...lines.slice(0, -1),\n truncateToWidth(theme.fg(\"dim\", cancelHint), safeWidth, \"\"),\n ...(bottomBorder === undefined ? [] : [bottomBorder]),\n ];\n },\n invalidate: () => loader.invalidate(),\n handleInput: cancel,\n dispose() {\n unsubscribe?.();\n loader.dispose();\n },\n waitForPending: () => operation,\n };\n },\n });\n if (interaction.kind === \"error\") throw interaction.error;\n if (interaction.kind !== \"completed\") return { kind: \"closed\" };\n if (interaction.value.cancelled) {\n if (cancelledMessage) ctx.ui.notify(cancelledMessage, \"info\");\n return { kind: \"cancelled\" };\n }\n if (interaction.value.error) throw interaction.value.error;\n return { kind: \"completed\", value: taskResult };\n}\n\nfunction hasControlCharacter(value: string) {\n // biome-ignore lint/suspicious/noControlCharactersInRegex: Unsafe key labels must be omitted.\n return /[\\u0000-\\u001f\\u007f-\\u009f]/u.test(value);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,YAAY,eAAe;;;ACApC,SAAS,yBAAyB;;;ACAlC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACLP,SAAS,aAAa,sBAAsB,6BAA6B;;;ACDzE,SAAS,sBAA6C;AACtD,SAAS,cAAc,KAAK,YAAY,uBAAuB;AAC/D,SAAS,wBAAwB,4BAA4B;AA+B7D,eAAsB,wBACpB,KACA,SACA,OACA,UACA,UAAuC,CAAC,GACH;AACrC,QAAM,SAAS,MAAM;AAAA,IACnB;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,UAAU,aAAa,SAAS,OAAO,QAAQ,UAAU,QAAQ,QAAQ,QAAQ;AAAA,IAC1F;AAAA,EACF;AACA,SAAO,OAAO,SAAS,cAAe,OAAO,SAAS,EAAE,MAAM,SAAS,IAAK;AAC9E;AAQA,eAAsB,mBACpB,KACA,SACA,MAKA,UAAuD,CAAC,GACjB;AACvC,QAAM;AAAA,IACJ,cAAc;AAAA,IACd,sBAAsB;AAAA,IACtB,mBAAmB;AAAA,IACnB;AAAA,IACA,YAAY,MAAM;AAAA,EACpB,IAAI;AACJ,MAAI,QAAQ,WAAW,CAAC,UAAU,EAAG,QAAO,EAAE,MAAM,SAAS;AAC7D,MAAI,IAAI,SAAS,MAAO,QAAO,EAAE,MAAM,aAAa,OAAO,MAAM,KAAK,MAAM,EAAE;AAC9E,MAAI,gBAAgB;AACpB,MAAI;AACJ,QAAM,cAAc,MAAM,qBAAiF,KAAK;AAAA,IAC9G;AAAA,IACA,WAAW,MAAM,CA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AmB,OAAgB;AAC1C,SAAO,iBAAiB,mCAAmC,iBAAiB;AAC9E;AAEA,SAAS,2BACP,SACA,MACA;AACA,SAAO,QAAQ,kBAAkB,QAAQ,gBAAgB,IAAI,IAAI,KAAK;AACxE;AAEA,SAAS,qBAAqB,eAA2B;AACvD,MAAI;AACF,kBAAc;AACd,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,eAAe,eAAwC,cAA2B;AACzF,SAAO,gBAAgB,YAAY,IAAI,CAAC,eAAe,YAAY,CAAC,IAAI;AAC1E;",
6
+ "names": []
7
+ }
@@ -1,5 +1,7 @@
1
1
  // @generated by scripts/build-runtime.mjs; do not edit.
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
+
4
+ // src/settings/config.ts
3
5
  import {
4
6
  configFromSettings,
5
7
  isEnabled,
@@ -14,16 +16,9 @@ import {
14
16
  syncSessionsWarnings,
15
17
  syncSetupReviewIdentity,
16
18
  syncSetupStorageReview
17
- } from "./chunk-OVBAW7KV.ts";
18
- import "./chunk-X7R6DCVF.ts";
19
- import "./chunk-2JZFHNLM.ts";
20
- import "./chunk-T2SJD3N7.ts";
21
- import "./chunk-KYTT7KV4.ts";
22
- import "./chunk-FHE2DCA2.ts";
19
+ } from "@narumitw/sync-daemon/engine/settings/config";
20
+
23
21
  export {
24
- configFromSettings,
25
- isEnabled,
26
- isExplicitlyEnabled,
27
22
  loadConfig,
28
23
  loadConfigForCheck,
29
24
  loadPartialConfig,
@@ -32,7 +27,6 @@ export {
32
27
  syncConfigReviewFingerprint,
33
28
  syncConfigReviewIdentity,
34
29
  syncSessionsWarnings,
35
- syncSetupReviewIdentity,
36
- syncSetupStorageReview
30
+ syncSetupReviewIdentity
37
31
  };
38
- //# sourceMappingURL=config-HYG7G5EM.ts.map
32
+ //# sourceMappingURL=chunk-7AC2RX4M.ts.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/settings/config.ts"],
4
+ "sourcesContent": ["export type * from \"@narumitw/sync-daemon/engine/settings/config\";\nexport {\n configFromSettings,\n isEnabled,\n isExplicitlyEnabled,\n loadConfig,\n loadConfigForCheck,\n loadPartialConfig,\n sessionTokenWarnings,\n syncCheckConfigFingerprint,\n syncConfigReviewFingerprint,\n syncConfigReviewIdentity,\n syncSessionsWarnings,\n syncSetupReviewIdentity,\n syncSetupStorageReview,\n} from \"@narumitw/sync-daemon/engine/settings/config\";\n"],
5
+ "mappings": ";;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
6
+ "names": []
7
+ }