@narumitw/pi-sync 0.60.5 → 0.62.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 (273) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +32 -23
  3. package/dist/chunks/{chunk-F64YWRXG.ts → chunk-3E3TR3JE.ts} +4 -4
  4. package/dist/chunks/{chunk-YVH5VJR4.ts → chunk-6PFZUEUG.ts} +138 -61
  5. package/dist/chunks/chunk-6PFZUEUG.ts.map +7 -0
  6. package/dist/chunks/{chunk-ZIL6PW5L.ts → chunk-6YKOHBSC.ts} +2 -2
  7. package/dist/chunks/{chunk-OA4NZLSL.ts → chunk-APZVJAEW.ts} +4 -3
  8. package/dist/chunks/{chunk-KPWZNMKM.ts → chunk-ECYCNZOE.ts} +1 -5
  9. package/dist/chunks/chunk-ECYCNZOE.ts.map +7 -0
  10. package/dist/chunks/chunk-GELYN4UC.ts +14 -0
  11. package/dist/chunks/chunk-GELYN4UC.ts.map +7 -0
  12. package/dist/chunks/{chunk-V2QIMC3U.ts → chunk-GSCZ4VXV.ts} +13 -8
  13. package/dist/chunks/chunk-GSCZ4VXV.ts.map +7 -0
  14. package/dist/chunks/{chunk-6W2SNZ5P.ts → chunk-IBXEM35O.ts} +8 -3
  15. package/dist/chunks/{chunk-6W2SNZ5P.ts.map → chunk-IBXEM35O.ts.map} +3 -3
  16. package/dist/chunks/{chunk-6KIWZ4AY.ts → chunk-INECVQNR.ts} +13 -12
  17. package/dist/chunks/chunk-INECVQNR.ts.map +7 -0
  18. package/dist/chunks/chunk-JREGWM2B.ts +139 -0
  19. package/dist/chunks/chunk-JREGWM2B.ts.map +7 -0
  20. package/dist/chunks/{chunk-277VHM2P.ts → chunk-MNYRU5U5.ts} +5 -2
  21. package/dist/chunks/{chunk-277VHM2P.ts.map → chunk-MNYRU5U5.ts.map} +2 -2
  22. package/dist/chunks/chunk-NHFGAZEC.ts +277 -0
  23. package/dist/chunks/chunk-NHFGAZEC.ts.map +7 -0
  24. package/dist/chunks/{chunk-EMRFVLZM.ts → chunk-NXWHPVXR.ts} +2 -2
  25. package/dist/chunks/{chunk-SMVKMYLK.ts → chunk-P4GI7LTT.ts} +2 -2
  26. package/dist/chunks/{chunk-MCUZFUHY.ts → chunk-PWESMTH6.ts} +10 -10
  27. package/dist/chunks/{chunk-V4AMI3VL.ts → chunk-R3SAMXB6.ts} +10 -2
  28. package/dist/chunks/chunk-R3SAMXB6.ts.map +7 -0
  29. package/dist/chunks/{chunk-RNIEVDTR.ts → chunk-T3LABNHF.ts} +2 -2
  30. package/dist/chunks/{chunk-S3R3W3KF.ts → chunk-UMPA5S7X.ts} +2 -2
  31. package/dist/chunks/{chunk-WP2M67XZ.ts → chunk-WBIOSK76.ts} +2 -2
  32. package/dist/chunks/{chunk-LAXTCSX4.ts → chunk-ZB3GNX3P.ts} +124 -139
  33. package/dist/chunks/chunk-ZB3GNX3P.ts.map +7 -0
  34. package/dist/chunks/{chunk-HEB6YT64.ts → chunk-ZO52JM4H.ts} +2 -2
  35. package/dist/chunks/{command-handler-TNPWFIPG.ts → command-handler-6ATREPG7.ts} +44 -40
  36. package/dist/chunks/command-handler-6ATREPG7.ts.map +7 -0
  37. package/dist/chunks/{conflict-review-ETCSYJTH.ts → conflict-review-MAOGTIAI.ts} +4 -4
  38. package/dist/chunks/{continuous-record-3XDXDOMV.ts → continuous-record-3SKJ6I3V.ts} +2 -2
  39. package/dist/chunks/{continuous-storage-HLKCHF6Z.ts → continuous-storage-3EU6I7Z3.ts} +2 -2
  40. package/dist/chunks/{file-selection-DD6X4J2K.ts → file-selection-QR2KZVGD.ts} +28 -15
  41. package/dist/chunks/file-selection-QR2KZVGD.ts.map +7 -0
  42. package/dist/chunks/manager-result-dispatcher-MC6EQOQY.ts +19 -0
  43. package/dist/chunks/{manager-ui-LFONXWQN.ts → manager-ui-AOFUNXAJ.ts} +648 -305
  44. package/dist/chunks/manager-ui-AOFUNXAJ.ts.map +7 -0
  45. package/dist/chunks/remote-selection-ui-4BTP2OJR.ts +18 -0
  46. package/dist/chunks/{setup-switch-SPZE7HIQ.ts → setup-switch-Y6AMFFNK.ts} +7 -7
  47. package/dist/chunks/{setup-wizard-5JYKAEIT.ts → setup-wizard-5G426MOZ.ts} +18 -16
  48. package/dist/chunks/setup-wizard-5G426MOZ.ts.map +7 -0
  49. package/dist/chunks/{snapshot-5HY3M2NL.ts → snapshot-ZUJJZCFW.ts} +2 -2
  50. package/dist/chunks/{snapshot-transaction-directory-OU2D7R7A.ts → snapshot-transaction-directory-F46JWRAU.ts} +2 -2
  51. package/dist/chunks/{state-directory-XXHU73Z3.ts → state-directory-CMAIF34J.ts} +2 -2
  52. package/dist/chunks/{sync-inspection-6VGR2UVZ.ts → sync-inspection-ITZ6Z4DE.ts} +7 -7
  53. package/dist/chunks/{sync-operations-SAKAZL6Z.ts → sync-operations-NMVKF7SE.ts} +13 -9
  54. package/dist/chunks/sync-operations-NMVKF7SE.ts.map +7 -0
  55. package/dist/chunks/{sync-state-2LMIXJ2C.ts → sync-state-QIT64TKV.ts} +2 -2
  56. package/dist/daemon/LICENSE +21 -0
  57. package/dist/daemon/dist/build-version.js +8 -0
  58. package/dist/daemon/dist/child-sdk.mjs +17 -0
  59. package/dist/daemon/dist/cli.js +169 -0
  60. package/dist/daemon/dist/client.js +909 -0
  61. package/dist/daemon/dist/consent.js +265 -0
  62. package/dist/daemon/dist/document.js +6 -0
  63. package/dist/daemon/dist/endpoint.js +91 -0
  64. package/dist/daemon/dist/engine/backends/backend-factory.js +16 -0
  65. package/dist/daemon/dist/engine/backends/backend-identity.js +38 -0
  66. package/dist/daemon/dist/engine/backends/backend-types.js +1 -0
  67. package/dist/daemon/dist/engine/backends/git/git-backend.js +715 -0
  68. package/dist/daemon/dist/engine/backends/git/git-config.js +118 -0
  69. package/dist/daemon/dist/engine/backends/git/git-runner.js +232 -0
  70. package/dist/daemon/dist/engine/backends/git/git-storage.js +252 -0
  71. package/dist/daemon/dist/engine/backends/s3/s3-backend.js +444 -0
  72. package/dist/daemon/dist/engine/backends/s3/s3-client.js +352 -0
  73. package/dist/daemon/dist/engine/backends/s3/s3-conditions.js +66 -0
  74. package/dist/daemon/dist/engine/backends/snapshot-pointer.js +22 -0
  75. package/dist/daemon/dist/engine/backends/sync-backend.js +23 -0
  76. package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +542 -0
  77. package/dist/daemon/dist/engine/backends/webdav/webdav-client.js +326 -0
  78. package/dist/daemon/dist/engine/backends/webdav/webdav-config.js +73 -0
  79. package/dist/daemon/dist/engine/commands/command-types.js +1 -0
  80. package/dist/daemon/dist/engine/host.js +16 -0
  81. package/dist/daemon/dist/engine/ignore/effective-ignore-policy.js +33 -0
  82. package/dist/daemon/dist/engine/ignore/ignore-edit.js +102 -0
  83. package/dist/daemon/dist/engine/ignore/ignore-initialization.js +186 -0
  84. package/dist/daemon/dist/engine/ignore/ignore-migration-prompt.js +139 -0
  85. package/dist/daemon/dist/engine/ignore/ignore-settings.js +322 -0
  86. package/dist/daemon/dist/engine/ignore/ignore-source.js +250 -0
  87. package/dist/daemon/dist/engine/paths.js +71 -0
  88. package/dist/daemon/dist/engine/settings/config-errors.js +4 -0
  89. package/dist/daemon/dist/engine/settings/config-file.js +736 -0
  90. package/dist/daemon/dist/engine/settings/config.js +301 -0
  91. package/dist/daemon/dist/engine/settings/settings-management.js +193 -0
  92. package/dist/daemon/dist/engine/settings/settings-store.js +41 -0
  93. package/dist/daemon/dist/engine/settings/settings-types.js +1 -0
  94. package/dist/daemon/dist/engine/settings/settings-validation.js +384 -0
  95. package/dist/daemon/dist/engine/snapshot/session-paths.js +160 -0
  96. package/dist/daemon/dist/engine/snapshot/snapshot-apply.js +348 -0
  97. package/dist/daemon/dist/engine/snapshot/snapshot-bounds.js +20 -0
  98. package/dist/daemon/dist/engine/snapshot/snapshot-case-replacement.js +82 -0
  99. package/dist/daemon/dist/engine/snapshot/snapshot-codec.js +61 -0
  100. package/dist/daemon/dist/engine/snapshot/snapshot-entry-projection.js +78 -0
  101. package/dist/daemon/dist/engine/snapshot/snapshot-exclude-safety.js +262 -0
  102. package/dist/daemon/dist/engine/snapshot/snapshot-mutation-queues.js +133 -0
  103. package/dist/daemon/dist/engine/snapshot/snapshot-paths.js +11 -0
  104. package/dist/daemon/dist/engine/snapshot/snapshot-payload.js +10 -0
  105. package/dist/daemon/dist/engine/snapshot/snapshot-reviewed-preimages.js +60 -0
  106. package/dist/daemon/dist/engine/snapshot/snapshot-root-transition.js +138 -0
  107. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-directory.js +16 -0
  108. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-images.js +387 -0
  109. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-plan.js +68 -0
  110. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-policy.js +276 -0
  111. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-stage.js +303 -0
  112. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-verification.js +78 -0
  113. package/dist/daemon/dist/engine/snapshot/snapshot-transaction.js +813 -0
  114. package/dist/daemon/dist/engine/snapshot/snapshot-types.js +9 -0
  115. package/dist/daemon/dist/engine/snapshot/snapshot.js +678 -0
  116. package/dist/daemon/dist/engine/state/json-file.js +49 -0
  117. package/dist/daemon/dist/engine/state/lock-policy.js +2 -0
  118. package/dist/daemon/dist/engine/state/lock.js +259 -0
  119. package/dist/daemon/dist/engine/state/lockfile-fs.js +13 -0
  120. package/dist/daemon/dist/engine/state/merge-baseline-store.js +198 -0
  121. package/dist/daemon/dist/engine/state/mutation-directory-sync.js +34 -0
  122. package/dist/daemon/dist/engine/state/operation-availability.js +40 -0
  123. package/dist/daemon/dist/engine/state/state-directory.js +227 -0
  124. package/dist/daemon/dist/engine/state/state-types.js +1 -0
  125. package/dist/daemon/dist/engine/state/sync-state-store.js +54 -0
  126. package/dist/daemon/dist/engine/sync/agent-candidate.js +207 -0
  127. package/dist/daemon/dist/engine/sync/agent-plan.js +84 -0
  128. package/dist/daemon/dist/engine/sync/agent-policy.js +10 -0
  129. package/dist/daemon/dist/engine/sync/agent-refusal-retry.js +39 -0
  130. package/dist/daemon/dist/engine/sync/agent-request.js +13 -0
  131. package/dist/daemon/dist/engine/sync/agent-runner.js +183 -0
  132. package/dist/daemon/dist/engine/sync/agent-store.js +177 -0
  133. package/dist/daemon/dist/engine/sync/agent-sync.js +132 -0
  134. package/dist/daemon/dist/engine/sync/apply-review.js +52 -0
  135. package/dist/daemon/dist/engine/sync/conflict-artifact-ownership.js +53 -0
  136. package/dist/daemon/dist/engine/sync/conflict-artifacts.js +158 -0
  137. package/dist/daemon/dist/engine/sync/conflict-groups.js +76 -0
  138. package/dist/daemon/dist/engine/sync/conflict-preview.js +53 -0
  139. package/dist/daemon/dist/engine/sync/conflict-resolution.js +53 -0
  140. package/dist/daemon/dist/engine/sync/conflict-retention.js +61 -0
  141. package/dist/daemon/dist/engine/sync/conflict-review.js +73 -0
  142. package/dist/daemon/dist/engine/sync/content-conflicts.js +70 -0
  143. package/dist/daemon/dist/engine/sync/continuous-errors.js +66 -0
  144. package/dist/daemon/dist/engine/sync/continuous-lease.js +206 -0
  145. package/dist/daemon/dist/engine/sync/continuous-record.js +199 -0
  146. package/dist/daemon/dist/engine/sync/continuous-storage.js +59 -0
  147. package/dist/daemon/dist/engine/sync/continuous-sync.js +521 -0
  148. package/dist/daemon/dist/engine/sync/continuous-watch.js +140 -0
  149. package/dist/daemon/dist/engine/sync/exclude-policy.js +86 -0
  150. package/dist/daemon/dist/engine/sync/field-migration.js +20 -0
  151. package/dist/daemon/dist/engine/sync/file-merge-planner.js +123 -0
  152. package/dist/daemon/dist/engine/sync/initialization.js +80 -0
  153. package/dist/daemon/dist/engine/sync/json-document.js +172 -0
  154. package/dist/daemon/dist/engine/sync/local-field-policy.js +26 -0
  155. package/dist/daemon/dist/engine/sync/local-fields.js +196 -0
  156. package/dist/daemon/dist/engine/sync/merge-apply.js +529 -0
  157. package/dist/daemon/dist/engine/sync/merge-journal.js +295 -0
  158. package/dist/daemon/dist/engine/sync/merge-transfer-error.js +64 -0
  159. package/dist/daemon/dist/engine/sync/merged-sync.js +674 -0
  160. package/dist/daemon/dist/engine/sync/mutation-owner.js +18 -0
  161. package/dist/daemon/dist/engine/sync/package-merge.js +82 -0
  162. package/dist/daemon/dist/engine/sync/partial-progress.js +41 -0
  163. package/dist/daemon/dist/engine/sync/remote-snapshot.js +104 -0
  164. package/dist/daemon/dist/engine/sync/resolver-stream.js +34 -0
  165. package/dist/daemon/dist/engine/sync/session-merge.js +178 -0
  166. package/dist/daemon/dist/engine/sync/session-push.js +33 -0
  167. package/dist/daemon/dist/engine/sync/settings-conflicts.js +56 -0
  168. package/dist/daemon/dist/engine/sync/settings-merge.js +93 -0
  169. package/dist/daemon/dist/engine/sync/signals.js +8 -0
  170. package/dist/daemon/dist/engine/sync/startup-timings.js +44 -0
  171. package/dist/daemon/dist/engine/sync/sync-decision.js +81 -0
  172. package/dist/daemon/dist/engine/sync/sync-error-guidance.js +55 -0
  173. package/dist/daemon/dist/engine/sync/sync-errors.js +18 -0
  174. package/dist/daemon/dist/engine/sync/sync-inspection.js +42 -0
  175. package/dist/daemon/dist/engine/sync/sync-loaders.js +8 -0
  176. package/dist/daemon/dist/engine/sync/sync-local.js +40 -0
  177. package/dist/daemon/dist/engine/sync/sync-mutations.js +733 -0
  178. package/dist/daemon/dist/engine/sync/sync-operations.js +3 -0
  179. package/dist/daemon/dist/engine/sync/sync-policy.js +621 -0
  180. package/dist/daemon/dist/engine/sync/sync-queries.js +212 -0
  181. package/dist/daemon/dist/engine/sync/sync-state.js +129 -0
  182. package/dist/daemon/dist/engine/sync/text-merge.js +124 -0
  183. package/dist/daemon/dist/engine/types.js +2 -0
  184. package/dist/daemon/dist/engine/ui/merge-review.js +7 -0
  185. package/dist/daemon/dist/engine/ui/merged-sync-summary.js +86 -0
  186. package/dist/daemon/dist/engine/ui/sync-format.js +165 -0
  187. package/dist/daemon/dist/engine/ui/sync-status.js +30 -0
  188. package/dist/daemon/dist/engine/ui/terminal-text.js +9 -0
  189. package/dist/daemon/dist/engine/ui/transfer-changes.js +24 -0
  190. package/dist/daemon/dist/engine/ui/transfer-review.js +19 -0
  191. package/dist/daemon/dist/engine-service.js +344 -0
  192. package/dist/daemon/dist/identity.js +241 -0
  193. package/dist/daemon/dist/idle-exit.js +77 -0
  194. package/dist/daemon/dist/index.js +4 -0
  195. package/dist/daemon/dist/lifecycle-log.js +53 -0
  196. package/dist/daemon/dist/lifecycle.js +21 -0
  197. package/dist/daemon/dist/model-signature.js +7 -0
  198. package/dist/daemon/dist/monitor.js +272 -0
  199. package/dist/daemon/dist/participant-admission.js +30 -0
  200. package/dist/daemon/dist/protocol.js +104 -0
  201. package/dist/daemon/dist/resolver-host.js +78 -0
  202. package/dist/daemon/dist/server.js +953 -0
  203. package/dist/daemon/dist/service-host.js +174 -0
  204. package/dist/daemon/dist/upgrade-repair.js +55 -0
  205. package/dist/daemon/package.json +3 -0
  206. package/dist/index.ts +32 -32
  207. package/dist/package.json +6 -0
  208. package/docs/daemon-migration.md +27 -16
  209. package/package.json +11 -5
  210. package/skills/configure-pi-sync/SKILL.md +38 -13
  211. package/skills/configure-pi-sync/references/configuration.md +61 -34
  212. package/src/commands/command-execution.ts +8 -2
  213. package/src/daemon/pi-client.ts +1 -0
  214. package/src/settings/config.ts +1 -0
  215. package/src/sync/sync-operations.ts +18 -10
  216. package/src/sync/sync-policy.ts +5 -0
  217. package/src/ui/agent-mode-setting.ts +9 -1
  218. package/src/ui/excluded-paths-ui.ts +157 -2
  219. package/src/ui/file-selection.ts +12 -7
  220. package/src/ui/ignore-file-ui.ts +271 -0
  221. package/src/ui/ignore-migration-prompt.ts +65 -0
  222. package/src/ui/manager-state.ts +39 -20
  223. package/src/ui/manager-ui.ts +38 -19
  224. package/src/ui/remote-selection-ui.ts +159 -33
  225. package/src/ui/settings-frame.ts +2 -8
  226. package/src/ui/settings-review.ts +26 -0
  227. package/src/ui/settings-ui.ts +327 -199
  228. package/src/ui/setup/directory-rules.ts +81 -0
  229. package/src/ui/setup/git-ui.ts +14 -24
  230. package/src/ui/setup/s3-ui.ts +13 -26
  231. package/src/ui/setup/setup-actions.ts +0 -4
  232. package/src/ui/setup/setup-prompts.ts +99 -17
  233. package/src/ui/setup/setup-switcher.ts +4 -2
  234. package/src/ui/setup/setup-wizard.ts +5 -4
  235. package/src/ui/setup/webdav-ui.ts +13 -27
  236. package/src/ui/storage-connections-ui.ts +22 -14
  237. package/src/ui/sync-attention.ts +8 -3
  238. package/src/ui/sync-format.ts +8 -1
  239. package/src/ui/sync-setups-ui.ts +47 -27
  240. package/dist/chunks/chunk-6KIWZ4AY.ts.map +0 -7
  241. package/dist/chunks/chunk-KPWZNMKM.ts.map +0 -7
  242. package/dist/chunks/chunk-LAXTCSX4.ts.map +0 -7
  243. package/dist/chunks/chunk-V2QIMC3U.ts.map +0 -7
  244. package/dist/chunks/chunk-V4AMI3VL.ts.map +0 -7
  245. package/dist/chunks/chunk-YVH5VJR4.ts.map +0 -7
  246. package/dist/chunks/command-handler-TNPWFIPG.ts.map +0 -7
  247. package/dist/chunks/file-selection-DD6X4J2K.ts.map +0 -7
  248. package/dist/chunks/manager-result-dispatcher-2GFNWHDM.ts +0 -18
  249. package/dist/chunks/manager-ui-LFONXWQN.ts.map +0 -7
  250. package/dist/chunks/remote-selection-ui-GFR6TDTX.ts +0 -17
  251. package/dist/chunks/setup-wizard-5JYKAEIT.ts.map +0 -7
  252. package/dist/chunks/sync-operations-SAKAZL6Z.ts.map +0 -7
  253. /package/dist/chunks/{chunk-F64YWRXG.ts.map → chunk-3E3TR3JE.ts.map} +0 -0
  254. /package/dist/chunks/{chunk-ZIL6PW5L.ts.map → chunk-6YKOHBSC.ts.map} +0 -0
  255. /package/dist/chunks/{chunk-OA4NZLSL.ts.map → chunk-APZVJAEW.ts.map} +0 -0
  256. /package/dist/chunks/{chunk-EMRFVLZM.ts.map → chunk-NXWHPVXR.ts.map} +0 -0
  257. /package/dist/chunks/{chunk-SMVKMYLK.ts.map → chunk-P4GI7LTT.ts.map} +0 -0
  258. /package/dist/chunks/{chunk-MCUZFUHY.ts.map → chunk-PWESMTH6.ts.map} +0 -0
  259. /package/dist/chunks/{chunk-RNIEVDTR.ts.map → chunk-T3LABNHF.ts.map} +0 -0
  260. /package/dist/chunks/{chunk-S3R3W3KF.ts.map → chunk-UMPA5S7X.ts.map} +0 -0
  261. /package/dist/chunks/{chunk-WP2M67XZ.ts.map → chunk-WBIOSK76.ts.map} +0 -0
  262. /package/dist/chunks/{chunk-HEB6YT64.ts.map → chunk-ZO52JM4H.ts.map} +0 -0
  263. /package/dist/chunks/{conflict-review-ETCSYJTH.ts.map → conflict-review-MAOGTIAI.ts.map} +0 -0
  264. /package/dist/chunks/{continuous-record-3XDXDOMV.ts.map → continuous-record-3SKJ6I3V.ts.map} +0 -0
  265. /package/dist/chunks/{continuous-storage-HLKCHF6Z.ts.map → continuous-storage-3EU6I7Z3.ts.map} +0 -0
  266. /package/dist/chunks/{manager-result-dispatcher-2GFNWHDM.ts.map → manager-result-dispatcher-MC6EQOQY.ts.map} +0 -0
  267. /package/dist/chunks/{remote-selection-ui-GFR6TDTX.ts.map → remote-selection-ui-4BTP2OJR.ts.map} +0 -0
  268. /package/dist/chunks/{setup-switch-SPZE7HIQ.ts.map → setup-switch-Y6AMFFNK.ts.map} +0 -0
  269. /package/dist/chunks/{snapshot-5HY3M2NL.ts.map → snapshot-ZUJJZCFW.ts.map} +0 -0
  270. /package/dist/chunks/{snapshot-transaction-directory-OU2D7R7A.ts.map → snapshot-transaction-directory-F46JWRAU.ts.map} +0 -0
  271. /package/dist/chunks/{state-directory-XXHU73Z3.ts.map → state-directory-CMAIF34J.ts.map} +0 -0
  272. /package/dist/chunks/{sync-inspection-6VGR2UVZ.ts.map → sync-inspection-ITZ6Z4DE.ts.map} +0 -0
  273. /package/dist/chunks/{sync-state-2LMIXJ2C.ts.map → sync-state-QIT64TKV.ts.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @narumitw/pi-sync
2
2
 
3
+ ## 0.62.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d27317a: Prepare Pi Sync's local ignore-file policy, including recoverable default-file creation, settings review, and versioned snapshot compatibility checks. Existing setups are not migrated automatically. The new setup flow and first-open migration prompt remain disabled. Settings can show an existing rule file for manual editing; the daemon does not replace it. Settings shows the active settings path in RPC and explains which setup actions are unavailable while ignore-file transfers are disabled.
8
+ - 5b9146b: Let the `configure-pi-sync` skill apply and verify requested local settings edits, such as adding exclusions, through the running Pi Sync daemon without starting a transfer.
9
+
10
+ ### Patch Changes
11
+
12
+ - 5262897: Ship the daemon with Pi Sync so npm installs no longer require the standalone daemon package. The daemon still runs in a separate Node.js process with the same ownership and upgrade rules. If you only install Pi Sync, run `node <pi-sync-package>/dist/daemon/dist/cli.js` to use the daemon CLI. Standalone daemon releases do not update the bundled copy; update Pi Sync to get a newer bundled build.
13
+ - 4073de5: Fix Windows recovery when NTFS changes a restored file's creation time during rename. Keep exact content, file ID, spelling, and pre-rename ownership checks, and preserve existing recovery journal formats. Make the daemon build use the Node compiler entrypoint instead of spawning a Windows command script.
14
+
15
+ ## 0.61.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 4d02a81: Default new Pi Sync setups to the Pi agent directory, with editable exclusions for sessions, managed binaries, and npm installations. Directory scope can restore selected exceptions to exclusions, but Pi credentials and project trust stay local. Existing selected-path setups keep their rules.
20
+
21
+ Recheck the directory scan limits before deletions and writes. If a recovery staging attempt stops before ownership is saved, retry in a fresh path and preserve the unverified files.
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [4d02a81]
26
+ - @narumitw/pi-sync-daemon@0.7.0
27
+
3
28
  ## 0.60.5
4
29
 
5
30
  ### Patch Changes
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  Pi Sync synchronizes selected Pi settings and content across machines through Git, WebDAV, Cloudflare R2, or another S3-compatible store.
6
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/pi-sync-daemon service](https://github.com/narumiruna/pi-extensions/tree/main/packages/pi-sync-daemon) owns execution.
7
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).
8
+ > **Experimental daemon migration:** close or upgrade older Pi processes and review ownership before real-data use. See [migration and release restrictions](./docs/daemon-migration.md).
9
9
 
10
10
  ## ✨ Features
11
11
 
@@ -17,10 +17,12 @@ Reusable storage connections hold credentials, while named sync setups define ex
17
17
  - Writes settings atomically, preserves unknown fields, rejects stale edits, and fails closed on unsafe configuration.
18
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.
19
19
  - Shares one detached synchronization service across Pi clients, with a generated split UI client runtime.
20
- - Bundles a manual-only skill for configuration questions and safe setup guidance.
20
+ - Bundles an on-demand skill for agent-assisted settings edits and configuration questions.
21
21
 
22
22
  ## 📦 Install
23
23
 
24
+ Use Node.js 22.19.0 or later for the daemon, the same minimum as the standalone package. The Pi Sync npm package includes the daemon code; no separate daemon installation is needed. The daemon still runs as a separate process.
25
+
24
26
  ```bash
25
27
  pi install npm:@narumitw/pi-sync
26
28
  ```
@@ -31,7 +33,7 @@ Try without installing permanently:
31
33
  pi -e npm:@narumitw/pi-sync
32
34
  ```
33
35
 
34
- Build the generated runtime and try a local checkout:
36
+ Build and try a local checkout from the repository root:
35
37
 
36
38
  ```bash
37
39
  npm install
@@ -41,13 +43,11 @@ npm --workspace @narumitw/pi-sync run build
41
43
  pi -e ./packages/pi-sync
42
44
  ```
43
45
 
44
- The package declares `dist/index.ts`, so an unbuilt checkout must run the build before Pi loads the package directory.
46
+ Pi loads `dist/index.ts` from the package directory, so build Kit and complete the local daemon build before building Pi Sync. The runtime-only daemon output from Git installation preparation is not enough for this build.
45
47
 
46
48
  Extensions run with Pi's permissions, so install only packages from sources you trust.
47
49
 
48
- Revoke retained unattended permission before updating. After updating, use `/reload` in open Pi
49
- sessions. If the upgrade is blocked or the old owner's exit is uncertain, follow the
50
- [daemon upgrade guide](./docs/daemon-migration.md#ownership-and-upgrade).
50
+ Update Pi Sync to get a newer bundled daemon. Updating the standalone package does not change the copy in Pi Sync. Revoke retained unattended permission before updating, then use `/reload` in open Pi sessions. If the upgrade is blocked or the old owner's exit is uncertain, follow the [daemon upgrade guide](./docs/daemon-migration.md#ownership-and-upgrade).
51
51
 
52
52
  Use a Pi runtime that satisfies this package’s declared peer floor. Installing an extension dependency does not upgrade a separately installed Pi runtime. The declared Kit floor supplies exact scrolling/paginated review and configured-keybinding support.
53
53
 
@@ -61,8 +61,8 @@ All new setups default to storage path `./`: the Git repository root, the WebDAV
61
61
  Git also suggests branch `main`.
62
62
  Use different folders or prefixes for independent setups sharing a WebDAV collection or bucket; existing settings and paths are unchanged.
63
63
  If another configured setup already uses the chosen location, setup asks for a different path before the content selection and review; Git requires a different branch, even when the directory differs.
64
- Every new setup asks for included content and automatic sync; automatic sync is off unless you enable it. Recommended includes nine Pi roots; Minimal includes `settings.json` and `AGENTS.md`. Sessions stay off unless explicitly included with a privacy acknowledgement.
65
- Before saving, scroll through the exact destination, every included path, automatic-sync choice, and hidden-credential summary. R2/S3 always asks for an existing bucket; an example bucket name is not a default.
64
+ New setups default to the Pi agent directory. All eligible files are selected except `sessions/`, `bin/`, and `npm/`; you can review and change these rules before starting a transfer. Sessions require explicit opt-in. Automatic sync is off unless you enable it. Choose **Join an existing remote** to save with both options off and then review its policy, without transferring files. Selected-path setups remain available for compatibility.
65
+ Before saving, review the exact destination, scope and rules, automatic-sync choice, and hidden-credential summary. R2/S3 always asks for an existing bucket; an example bucket name is not a default.
66
66
 
67
67
  Invalid fields ask for a correction without restarting setup. A temporary local save failure keeps the review for another Save; changed settings require reopening and reviewing the current values. Saving only changes local settings, not remote data. A connection saved through **Add a new storage connection…** remains saved if you later cancel the setup.
68
68
 
@@ -172,7 +172,11 @@ Print and JSON modes do not support `/sync` because UI output is not observable
172
172
 
173
173
  Run `/sync` → **Set up sync** to create the canonical private user file at `<getAgentDir()>/pi-sync.json` (normally `~/.pi/agent/pi-sync.json`).
174
174
  Use **Settings** to manage an existing setup.
175
- Missing settings stay unconfigured without creating files or locks.
175
+ Missing settings stay unconfigured without creating files or locks. Ignore-file transfers and daemon rule-file saves are not enabled. If a setup already references an ignore file, **Settings** shows the rule-file path for manual editing. In RPC mode, it also shows the active settings file, including `pi-sync.local.json` if it supplied the settings, without renaming it.
176
+
177
+ If any setup references an ignore file, transfers and policy comparison are unavailable for all setups in that document. You can still inspect the setup catalog, but switching or removal can be unavailable. To return to legacy transfers, close Pi and back up the active settings file and any pending recovery journal and backup. Remove the unsupported setup entries or restore a known-good legacy-only settings document. If you remove the current setup, update `activeSyncSetup` to a remaining setup, or omit it if none remain. Do not delete pending recovery files.
178
+
179
+ Directory scope selects all eligible files, applies `exclude`, then restores matches from `reinclude`. Pi login credentials, project trust, and Pi Sync's own state stay local regardless of those rules. Folder-wide sync may include private files that the secret scan cannot identify. Review the content before transferring to a trusted destination. Existing setups keep their selected paths and are not migrated automatically. See [Agent-directory scope](./skills/configure-pi-sync/references/configuration.md#agent-directory-scope) for formats, precedence, and recovery.
176
180
 
177
181
  ### Debug startup timings
178
182
 
@@ -230,9 +234,9 @@ Successful transfers show one summary. They do not reload resources, activate ex
230
234
 
231
235
  **Settings → Merge settings fields** controls the per-setup `sync.mergeSettings` opt-in, default **Off**. It combines independent global `settings.json` fields, not arbitrary JSON or keybindings. Missing/corrupt ancestors, unsupported syntax, and incompatible fields retain whole-transfer review. Sensitive accepted content is cached privately under the denied state root; disabling does not delete evidence.
232
236
 
233
- **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.
237
+ **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. An explicit array requires at least settings version 4 and snapshot version 2; directory scope keeps settings version 7 and snapshot version 5. Nonempty rules require `settings.json` in `sync.include` only for selected-path setups. 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.
234
238
 
235
- **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**.
239
+ **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 for selected paths, version 4 with selected-path exclusions, or version 5 for directory scope. Older readers must refuse unsupported formats. 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**.
236
240
 
237
241
  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).
238
242
 
@@ -282,15 +286,14 @@ Version 1, version 2, and non-empty unversioned settings require manual recovery
282
286
  Adding `sessions` can upload prompts, tool output, paths, images, and secrets; interactive flows require a privacy acknowledgement.
283
287
  Startup checks report included-content differences without changing anything. Transfers retain their existing included-content policy checks instead of silently expanding local scope.
284
288
 
285
- **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.
289
+ For selected-path setups, **Settings → Excluded paths** edits `sync.exclude` rules that win over `include`; saving opts into at least settings version 6 and snapshot version 4. For directory scope, **Settings → Agent directory scope** also edits `reinclude` and session opt-in. Excluded local files remain untouched, including on rollback. 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.
286
290
 
287
291
  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.
288
292
 
289
293
  ## 🧠 Skills
290
294
 
291
- Run `/skill:configure-pi-sync` before asking Pi about storage choices, included content, automatic controls, or settings recovery.
292
- The [configuration skill](./skills/configure-pi-sync/SKILL.md) is manual-only and provides guidance only: it does not inspect private settings, collect credentials, edit files, execute diagnostics, or sync content.
293
- Enter credentials in the existing masked TUI and perform settings changes and reviewed transfers through `/sync` yourself.
295
+ Run `/skill:configure-pi-sync Exclude npm/` to have the agent add an exclusion to the active setup and verify the saved change. The [configuration skill](./skills/configure-pi-sync/SKILL.md) is loaded only on request and uses the running local daemon for authorized settings edits. It can also answer configuration questions.
296
+ Use `/sync` for initial setup, masked credential entry, and changes or transfers that require a separate review. The skill does not run diagnostics, check remote connectivity, or start a transfer.
294
297
  The skill's instructions are not a permission sandbox for the agent's other tools.
295
298
  Read the [settings reference](./skills/configure-pi-sync/references/configuration.md) directly when no agent assistance is needed.
296
299
 
@@ -323,7 +326,13 @@ show `sync recovering`. If cleanup remains uncertain, review
323
326
  [daemon recovery](./docs/daemon-migration.md#write-coordination-and-disconnection)
324
327
  before retrying.
325
328
 
326
- Use the installed CLI, `pi-sync-daemon stop --root <agent-directory>` or `pi-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. Explicit CLI start without clients also follows the 30-second grace policy. The next eligible interactive client or explicit command can restart only after the old owner's exit is proven; print/JSON never launch a service. Uncertain consent, failed revocation, or cleanup failure remains paused for the existing repair/revocation path, not silently cleared by automatic restart. No new setting, environment variable, or keep-alive flag is added. See [lifetime and recovery](./docs/daemon-migration.md).
329
+ Use the [daemon CLI](./docs/daemon-migration.md#daemon-cli) for explicit `stop` or `restart`; these are not `/sync daemon` actions. For example, with only Pi Sync installed:
330
+
331
+ ```bash
332
+ node "/path/to/installed/pi-sync/dist/daemon/dist/cli.js" status --root "/path/to/agent-directory"
333
+ ```
334
+
335
+ Use the directory containing the installed Pi Sync `package.json` and the agent directory of the owner you want to inspect. `status` does not start a service. `stop` drains the service; reload Pi to reattach afterward. CLI `start` without clients follows the same 30-second grace policy. If ownership, consent, or cleanup is uncertain, follow the [recovery guide](./docs/daemon-migration.md#diagnostics-and-rollback) instead of forcing a restart. Print/JSON never launch a service.
327
336
 
328
337
  All routes support TUI and RPC; RPC settings and included-content screens are read-only.
329
338
  Print and JSON modes reject `/sync`.
@@ -331,7 +340,7 @@ Unknown commands or flags, trailing values, and missing setup/snapshot values ar
331
340
 
332
341
  - `--setup <name>` targets a setup without switching it on `config`, `files`, `status`, `diff`, `conflicts`, `doctor`, `push`, `pull`, `sync`, `history`, and `rollback`.
333
342
  - `--yes` (alias: `-y`) skips confirmation on `push`, `pull`, `sync`, `rollback`, and `migrate-state`; use only after reviewing the affected content.
334
- - `--force` lets `push` or `pull` accept content conflicts without disabling backend concurrency protection. It is also accepted by `sync`, which still requires a direction choice for divergent content, and by `rollback` for compatibility. Explicit forced directions can also resolve an interrupted merge after a fresh review, archiving its old journal instead of restoring old bytes.
343
+ - `--force` lets `push` or `pull` accept content conflicts without disabling backend concurrency protection. It is also accepted by `sync`, which still requires a direction choice for divergent content, and by `rollback` for compatibility. For legacy path policies, explicit forced directions can also resolve an interrupted merge after a fresh review, archiving its old journal instead of restoring old bytes.
335
344
  - `--stale` is accepted only by `unlock` and is required to remove a stale lock.
336
345
 
337
346
  Push and rollback publish data externally; pull and rollback can replace or delete local managed files.
@@ -361,10 +370,10 @@ S3/R2 publishes `latest.json` and history using ETag `If-Match`, or `If-None-Mat
361
370
  Snapshot recovery is guarded: new journals record before/after images, older journals are retired only when their unchanged preimages are provable, and unrecognized bytes remain untouched for manual review. Current-session targets are never restored during startup. Preserve a blocked transaction and its backup, close Pi, and review the private evidence before restoring selected paths; malformed/unsupported journals are not disposable. Pi may have loaded resources before lifecycle recovery, so reload or restart explicitly after recovery if loaded resources need to match the restored files.
362
371
 
363
372
  Before pull or rollback, pi-sync writes a backup under `<agent-dir>/pi-sync/backups/`.
364
- Snapshot apply and recovery require canonical agent and session paths. Symlinked or otherwise aliased parent paths are refused before changing managed local files because Pi's file queue uses different keys for existing and missing aliases. Use canonical paths for local mutations and preserve any pending recovery evidence; an unresolved startup recovery barrier still blocks transfers. Old journals recorded under an alias require manual review because their exact root and target paths remain pinned. Changing the agent path alone does not authorize recovery or rewriting those journals.
373
+ Snapshot apply and recovery require canonical agent and session paths. Preflight refuses parent aliases it detects because Pi's file queue uses different keys for existing and missing aliases. Node's path-based writes and deletes cannot prevent another process from replacing a parent directory after a check. Use directories you control, and pause tools that move or replace their directories during sync. Preserve any pending recovery evidence; an unresolved startup recovery barrier still blocks transfers. Old journals recorded under an alias require manual review because their exact root and target paths remain pinned. Changing the agent path alone does not authorize recovery or rewriting those journals.
365
374
  Apply preflights paths and checksums, journals mutations, and restores prior state only when current bytes match verified preimages or planned postimages. Unknown intermediate directory states and newer edits require review rather than a blind rollback. An interruption after replacement is armed can require manual recovery even if installation never ran; a later deletion of installed content is not treated as an unfinished remove.
366
375
  The file queue coordinates one Pi runtime, not separate processes or lock-unaware editors. Hash-based journals cannot distinguish a later write of identical recorded bytes; they do not provide a cross-process compare-and-swap.
367
- Merged transfers instead retain a private publication/apply/baseline journal and roll forward only when the active remote candidate and every changed local preimage/postimage can be verified. A crash or uncertain publication is reconciled through `/sync sync` without blind republishing. If newer local or remote changes prevent reconciliation, preserve the evidence, review `/sync diff`, and explicitly choose `push --force` or `pull --force`; the chosen direction archives the old journal. Disabling automatic transfer does not undo completed transfers. Do not downgrade while a merge or snapshot recovery journal is pending.
376
+ Merged transfers instead retain a private publication/apply/baseline journal and roll forward only when the active remote candidate and every changed local preimage/postimage can be verified. A crash or uncertain publication is reconciled through `/sync sync` without blind republishing. If newer local or remote changes prevent reconciliation, preserve the evidence, review `/sync diff`, and explicitly choose `push --force` or `pull --force`; the chosen direction archives the old journal. These commands require a settings document with no ignore-file setups, even if the affected setup uses a legacy policy. If mixed settings block recovery, preserve the journal and its backup before changing settings. Disabling automatic transfer does not undo completed transfers. Do not downgrade while a merge or snapshot recovery journal is pending.
368
377
 
369
378
  Removing a local setup or connection never deletes remote data.
370
379
 
@@ -409,10 +418,10 @@ packages/pi-sync/
409
418
  │ ├── backends/ # Public backend contract forwarders
410
419
  │ ├── state/ # Public state contract forwarders
411
420
  │ └── ui/ # Manager, settings, reviews, and setup flows
412
- ├── dist/ # Generated Jiti runtime
421
+ ├── dist/ # Published Jiti runtime and separate daemon files
413
422
  ├── scripts/build-runtime.mjs # Runtime builder
414
423
  ├── docs/ # Operational audits and settings link compatibility
415
- ├── skills/configure-pi-sync/ # Manual-only guidance and authoritative settings reference
424
+ ├── skills/configure-pi-sync/ # Agent settings edits and authoritative settings reference
416
425
  └── test/ # Behavior and lifecycle coverage
417
426
  ```
418
427
 
@@ -420,7 +429,7 @@ The [exclude policy safety audit](./docs/exclude-policy-audit.md) maps implement
420
429
 
421
430
  The generated runtime is built from `src/index.ts` and does not import back into `src`.
422
431
  Internal modules use direct imports from their owners; `src/sync.ts` and `src/types.ts` retain compatibility exports.
423
- Engine implementation lives in the non-extension `@narumitw/pi-sync-daemon` dependency; Pi uses its documented exports, without an in-process transfer fallback. First-use UI and setup implementations remain lazy.
432
+ Repository and Git source installs use the daemon workspace's documented exports; the npm runtime maps the same exports to `dist/daemon/`. Transfers still run in the daemon, with no in-process fallback. First-use UI and setup implementations remain lazy.
424
433
 
425
434
  ## 🔎 Keywords
426
435
 
@@ -3,14 +3,14 @@
3
3
  import {
4
4
  runCancellableOperation,
5
5
  showRemoteSelectionReview
6
- } from "./chunk-YVH5VJR4.ts";
6
+ } from "./chunk-6PFZUEUG.ts";
7
7
  import {
8
8
  loadConfig,
9
9
  syncConfigReviewIdentity
10
- } from "./chunk-277VHM2P.ts";
10
+ } from "./chunk-MNYRU5U5.ts";
11
11
  import {
12
12
  errorMessage
13
- } from "./chunk-ZIL6PW5L.ts";
13
+ } from "./chunk-6YKOHBSC.ts";
14
14
  import {
15
15
  safeTerminalText
16
16
  } from "./chunk-2JNFEZ3V.ts";
@@ -206,4 +206,4 @@ async function dispatchManagerResult(ctx, initialResult, origin, runRoute, signa
206
206
  export {
207
207
  dispatchManagerResult
208
208
  };
209
- //# sourceMappingURL=chunk-F64YWRXG.ts.map
209
+ //# sourceMappingURL=chunk-3E3TR3JE.ts.map
@@ -1,40 +1,44 @@
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
+ import {
4
+ throwIfAborted
5
+ } from "./chunk-UMPA5S7X.ts";
6
+ import {
7
+ captureMutationOwner
8
+ } from "./chunk-GELYN4UC.ts";
9
+ import {
10
+ SyncSetupReviewChangedError,
11
+ updateSyncSetup
12
+ } from "./chunk-NXWHPVXR.ts";
3
13
  import {
4
14
  sameSyncExclude
5
- } from "./chunk-HEB6YT64.ts";
15
+ } from "./chunk-ZO52JM4H.ts";
6
16
  import {
7
17
  loadConfig,
8
18
  syncCheckConfigFingerprint,
9
19
  syncConfigReviewFingerprint
10
- } from "./chunk-277VHM2P.ts";
20
+ } from "./chunk-MNYRU5U5.ts";
11
21
  import {
12
22
  setSyncStatus
13
23
  } from "./chunk-H7VOTY5N.ts";
14
- import {
15
- throwIfAborted
16
- } from "./chunk-S3R3W3KF.ts";
17
- import {
18
- SyncSetupReviewChangedError,
19
- updateSyncSetup
20
- } from "./chunk-EMRFVLZM.ts";
21
24
  import {
22
25
  errorMessage
23
- } from "./chunk-ZIL6PW5L.ts";
24
- import {
25
- safeTerminalText
26
- } from "./chunk-2JNFEZ3V.ts";
26
+ } from "./chunk-6YKOHBSC.ts";
27
27
  import {
28
28
  compareSyncInclude,
29
29
  inspectRemoteSelection,
30
- sameSyncInclude
31
- } from "./chunk-V4AMI3VL.ts";
30
+ sameSyncInclude,
31
+ syncDirectoryPolicyKey
32
+ } from "./chunk-R3SAMXB6.ts";
33
+ import {
34
+ safeTerminalText
35
+ } from "./chunk-2JNFEZ3V.ts";
32
36
 
33
37
  // src/ui/remote-selection-ui.ts
34
38
  import { defineMenu, runMenu } from "@narumitw/pi-tui-kit";
35
39
 
36
40
  // src/backends/backend-factory.ts
37
- import { createSyncBackend } from "@narumitw/pi-sync-daemon/engine/backends/backend-factory";
41
+ import { createSyncBackend } from "#pi-sync-daemon/engine/backends/backend-factory";
38
42
 
39
43
  // src/sync/remote-snapshot.ts
40
44
  import {
@@ -42,14 +46,7 @@ import {
42
46
  readRemoteSnapshot,
43
47
  readSnapshotForHead,
44
48
  requireCompatibleRemoteSelection
45
- } from "@narumitw/pi-sync-daemon/engine/sync/remote-snapshot";
46
-
47
- // src/sync/sync-local.ts
48
- import {
49
- backupLocal,
50
- captureMutationOwner,
51
- protectedSessionPaths
52
- } from "@narumitw/pi-sync-daemon/engine/sync/sync-local";
49
+ } from "#pi-sync-daemon/engine/sync/remote-snapshot";
53
50
 
54
51
  // src/ui/cancellable-operation.ts
55
52
  import { BorderedLoader } from "@earendil-works/pi-coding-agent";
@@ -269,22 +266,26 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
269
266
  items: [
270
267
  {
271
268
  id: "review",
272
- label: "Review all paths (recommended)",
273
- description: "Compare exact remote-only, device-only, and ordered lists.",
269
+ label: state.decision.ignorePolicyComparison ? "Review policy difference" : "Review all paths (recommended)",
270
+ description: state.decision.ignorePolicyComparison ? "Compare published policy information without adopting rules." : "Compare exact remote-only, device-only, and ordered lists.",
274
271
  to: "review"
275
272
  },
276
- {
277
- id: "adopt",
278
- label: "Use remote content list",
279
- description: "Save the reviewed list on this device without pulling files.",
280
- action: "adopt"
281
- },
282
- {
283
- id: "keep",
284
- label: "Keep this device's content list and update remote\u2026",
285
- description: "Open the existing exact force-push preview without skipping confirmation.",
286
- action: "keep"
287
- },
273
+ ...adoptionUnavailable(state.decision) ? [] : [
274
+ {
275
+ id: "adopt",
276
+ label: "Use remote content list",
277
+ description: "Save the reviewed rules on this device without pulling files.",
278
+ action: "adopt"
279
+ }
280
+ ],
281
+ ...!canPublishLocalPolicy(state.decision) ? [] : [
282
+ {
283
+ id: "keep",
284
+ label: state.decision.ignorePolicyComparison ? "Review publishing this device's policy\u2026" : "Keep this device's content list and update remote\u2026",
285
+ description: "Open the existing exact force-push preview without skipping confirmation.",
286
+ action: "keep"
287
+ }
288
+ ],
288
289
  { id: "cancel", label: options.cancelLabel ?? "Cancel", action: "cancel" }
289
290
  ],
290
291
  hint: "back"
@@ -332,6 +333,8 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
332
333
  ownedSignal.throwIfAborted();
333
334
  validateOwner();
334
335
  assertLocalSelectionCurrent(currentConfig, state.decision);
336
+ const refusal = adoptionUnavailable(state.decision);
337
+ if (refusal) throw new Error(refusal);
335
338
  if (!currentConfig.include.includes("sessions") && state.decision.remoteInclude.includes("sessions")) {
336
339
  onDialog?.(true);
337
340
  let acknowledged;
@@ -348,7 +351,7 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
348
351
  validateOwner();
349
352
  if (!acknowledged) return void 0;
350
353
  }
351
- if (state.decision.remoteExclude !== void 0 && currentConfig.exclude === void 0) {
354
+ if (!currentConfig.scope && state.decision.remoteExclude !== void 0 && currentConfig.exclude === void 0) {
352
355
  onDialog?.(true);
353
356
  let confirmed;
354
357
  try {
@@ -386,7 +389,8 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
386
389
  continuationFingerprint = syncCheckConfigFingerprint({
387
390
  ...adoption.value.config,
388
391
  include: [...state.decision.remoteInclude],
389
- exclude: adoptedExclude(state.decision)
392
+ exclude: adoptedExclude(state.decision),
393
+ ...adoption.value.config.scope ? { reinclude: [...state.decision.remoteDirectory?.reinclude ?? []] } : {}
390
394
  });
391
395
  flowState = { decision: state.decision, saved: true };
392
396
  return { kind: "to", screen: "saved" };
@@ -402,16 +406,19 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
402
406
  }
403
407
  },
404
408
  keep: async ({ state, signal: actionSignal }) => {
409
+ if (!canPublishLocalPolicy(state.decision)) return { kind: "stay" };
405
410
  if (!runRoute) {
406
411
  ctx.ui.notify("The reviewed update-remote route is unavailable.", "error");
407
412
  return { kind: "stay" };
408
413
  }
409
414
  const signal = combineSignals(sessionSignal, actionSignal);
410
415
  try {
411
- const latest = await loadConfig(state.decision.setupName);
412
- if (signal.aborted) return { kind: "close" };
413
- validateOwner();
414
- assertLocalSelectionCurrent(latest, state.decision);
416
+ if (!state.decision.ignorePolicyComparison) {
417
+ const latest = await loadConfig(state.decision.setupName);
418
+ if (signal.aborted) return { kind: "close" };
419
+ validateOwner();
420
+ assertLocalSelectionCurrent(latest, state.decision);
421
+ }
415
422
  const result = await runCancellableOperation(
416
423
  ctx,
417
424
  "Preparing this device's push preview\u2026",
@@ -513,8 +520,8 @@ async function loadAdoptionReview(decision, signal, factory, validateOwner) {
513
520
  const snapshot = await readSnapshotForHead(backend, reviewedHead, signal);
514
521
  throwIfAborted(signal);
515
522
  validateOwner();
516
- const state = inspectRemoteSelection(config.include, snapshot, config.exclude);
517
- if (state.kind !== "different" || !sameSyncInclude(state.include, decision.remoteInclude) || !sameSyncExclude(state.exclude, decision.remoteExclude)) {
523
+ const state = inspectRemoteSelection(config.include, snapshot, config.exclude, config);
524
+ if (state.kind !== "different" || !sameSyncInclude(state.include, decision.remoteInclude) || !sameSyncExclude(state.exclude, decision.remoteExclude) || !matchesRemoteDirectory(state, decision)) {
518
525
  throw new StaleRemoteSelectionReviewError("Remote synced content changed while the comparison was open.");
519
526
  }
520
527
  return { config, backend, reviewedHead };
@@ -529,21 +536,37 @@ async function revalidateAndAdopt(review, decision, signal, validateOwner) {
529
536
  const currentSnapshot = await readSnapshotForHead(review.backend, currentHead, signal);
530
537
  throwIfAborted(signal);
531
538
  validateOwner();
532
- const currentState = inspectRemoteSelection(review.config.include, currentSnapshot, review.config.exclude);
533
- if (currentState.kind !== "different" || !sameSyncInclude(currentState.include, decision.remoteInclude) || !sameSyncExclude(currentState.exclude, decision.remoteExclude)) {
539
+ const currentState = inspectRemoteSelection(
540
+ review.config.include,
541
+ currentSnapshot,
542
+ review.config.exclude,
543
+ review.config
544
+ );
545
+ if (currentState.kind !== "different" || !sameSyncInclude(currentState.include, decision.remoteInclude) || !sameSyncExclude(currentState.exclude, decision.remoteExclude) || !matchesRemoteDirectory(currentState, decision)) {
534
546
  throw new StaleRemoteSelectionReviewError("Remote synced content changed while the comparison was open.");
535
547
  }
536
548
  await updateSyncSetup(
537
549
  decision.setupName,
538
550
  (setup) => {
539
551
  validateOwner();
552
+ const refusal = adoptionUnavailable(decision);
553
+ if (refusal) throw new Error(refusal);
554
+ const exclude = adoptedExclude(decision);
555
+ if (setup.sync.pathPolicy === "ignore-file") throw new Error("An ignore-file setup cannot adopt remote rules.");
556
+ if (setup.sync.scope === "agent-directory") {
557
+ return {
558
+ ...setup,
559
+ sync: {
560
+ ...setup.sync,
561
+ exclude,
562
+ reinclude: [...decision.remoteDirectory?.reinclude ?? []],
563
+ sessions: decision.remoteInclude.includes("sessions")
564
+ }
565
+ };
566
+ }
540
567
  return {
541
568
  ...setup,
542
- sync: {
543
- ...setup.sync,
544
- include: [...decision.remoteInclude],
545
- ...adoptedExclude(decision) === void 0 ? {} : { exclude: adoptedExclude(decision) }
546
- }
569
+ sync: { ...setup.sync, include: [...decision.remoteInclude], ...exclude === void 0 ? {} : { exclude } }
547
570
  };
548
571
  },
549
572
  {
@@ -572,7 +595,7 @@ async function inspectConfiguredRemoteSelection(ctx, setupName, signal, factory,
572
595
  return {
573
596
  kind: "selection",
574
597
  config,
575
- state: inspectRemoteSelection(config.include, snapshot, config.exclude)
598
+ state: inspectRemoteSelection(config.include, snapshot, config.exclude, config)
576
599
  };
577
600
  }
578
601
  async function showLegacyDiscovery(ctx, config, discovered, signal) {
@@ -618,19 +641,64 @@ async function showLegacyDiscovery(ctx, config, discovered, signal) {
618
641
  function adoptedExclude(decision) {
619
642
  return decision.remoteExclude === void 0 ? decision.localExclude === void 0 ? void 0 : [] : [...decision.remoteExclude];
620
643
  }
644
+ function scopesDiffer(decision) {
645
+ return decision.localDirectory?.scope !== decision.remoteDirectory?.scope;
646
+ }
647
+ function canPublishLocalPolicy(decision) {
648
+ if (decision.ignorePolicyComparison) {
649
+ return decision.ignorePolicyComparison !== "match" && decision.ignorePolicyComparison !== "local-legacy-remote-ignore";
650
+ }
651
+ return !scopesDiffer(decision);
652
+ }
653
+ function adoptionUnavailable(decision) {
654
+ if (decision.ignorePolicyComparison)
655
+ return "Ignore files are local. Published metadata cannot reconstruct remote rules.";
656
+ if (scopesDiffer(decision))
657
+ return "Scope differs. Configure a setup with the remote scope to join it; this location is not migrated in place.";
658
+ if (decision.remoteDirectory?.scope && decision.remoteInclude.includes("sessions") && !decision.localInclude.includes("sessions"))
659
+ return "Enable session sync explicitly in Settings before adopting these rules.";
660
+ }
661
+ function matchesRemoteDirectory(state, decision) {
662
+ return syncDirectoryPolicyKey(state) === syncDirectoryPolicyKey({
663
+ include: decision.remoteInclude,
664
+ exclude: decision.remoteExclude,
665
+ ...decision.remoteDirectory
666
+ });
667
+ }
668
+ function directoryReviewLines(decision) {
669
+ if (!decision.localDirectory?.scope && !decision.remoteDirectory?.scope) return [];
670
+ const unavailable = adoptionUnavailable(decision);
671
+ return [
672
+ `Remote scope: ${decision.remoteDirectory?.scope ? "Pi agent directory" : "selected paths or legacy"}`,
673
+ `This device scope: ${decision.localDirectory?.scope ? "Pi agent directory" : "selected paths"}`,
674
+ `Remote re-included paths: ${safeList(decision.remoteDirectory?.reinclude ?? [])}`,
675
+ `This device re-included paths: ${safeList(decision.localDirectory?.reinclude ?? [])}`,
676
+ ...unavailable ? [unavailable] : []
677
+ ];
678
+ }
621
679
  function selectionSummaryLines(decision) {
680
+ if (decision.ignorePolicyComparison) {
681
+ return [
682
+ `Sync setup: ${safeTerminalText(decision.setupName)}`,
683
+ adoptionUnavailable(decision) ?? "Nothing changed.",
684
+ decision.ignorePolicyComparison === "local-legacy-remote-ignore" ? "The remote uses an ignore policy. Migrate and review your local setup before transferring." : "Review a fresh push before publishing this device's policy. No files or settings have changed."
685
+ ];
686
+ }
622
687
  const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);
623
688
  return [
624
689
  `Sync setup: ${safeTerminalText(decision.setupName)}`,
625
690
  "Nothing changed. Review both lists before choosing what happens next.",
691
+ ...directoryReviewLines(decision),
626
692
  ...excludeReviewLines(decision),
627
- ...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}`]
693
+ ...!decision.localDirectory?.scope && !decision.remoteDirectory?.scope && 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}`]
628
694
  ];
629
695
  }
630
696
  function formatSelectionDifference(decision) {
697
+ if (decision.ignorePolicyComparison) return selectionSummaryLines(decision).join("\n");
631
698
  const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);
632
699
  return [
633
- ...comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 && sameSyncExclude(decision.localExclude, decision.remoteExclude) ? ["Only ordering differs; both lists contain the same paths.", ""] : [],
700
+ ...directoryReviewLines(decision),
701
+ ...!decision.localDirectory?.scope && !decision.remoteDirectory?.scope && comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 && sameSyncExclude(decision.localExclude, decision.remoteExclude) ? ["Only ordering differs; both lists contain the same paths.", ""] : [],
634
702
  "Remote-only paths:",
635
703
  ...comparison.remoteOnly.length > 0 ? comparison.remoteOnly.map((item) => `+ ${safeTerminalText(item)}`) : ["(none)"],
636
704
  "",
@@ -648,12 +716,14 @@ function formatSelectionDifference(decision) {
648
716
  ].join("\n");
649
717
  }
650
718
  function formatRemoteSelectionSummary(decision) {
719
+ if (decision.ignorePolicyComparison) return selectionSummaryLines(decision).join("\n");
651
720
  const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);
652
721
  return [
653
722
  `Synced content for \u201C${safeTerminalText(decision.setupName)}\u201D differs from this device.`,
654
723
  `Remote-only: ${safeList(comparison.remoteOnly)}`,
655
724
  `Device-only: ${safeList(comparison.localOnly)}`,
656
- ...comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 && sameSyncExclude(decision.localExclude, decision.remoteExclude) ? [
725
+ ...directoryReviewLines(decision),
726
+ ...!decision.localDirectory?.scope && !decision.remoteDirectory?.scope && comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 && sameSyncExclude(decision.localExclude, decision.remoteExclude) ? [
657
727
  "Only ordering differs.",
658
728
  `Remote order: ${safeList(decision.remoteInclude)}`,
659
729
  `Device order: ${safeList(decision.localInclude)}`
@@ -677,14 +747,21 @@ function decisionFromState(config, state) {
677
747
  return {
678
748
  setupName: config.setupName,
679
749
  configIdentity: syncConfigReviewFingerprint(config),
750
+ ignorePolicyComparison: state.ignorePolicyComparison,
680
751
  localInclude: [...config.include],
681
752
  remoteInclude: [...state.include],
682
753
  ...config.exclude === void 0 ? {} : { localExclude: [...config.exclude] },
683
- ...state.exclude === void 0 ? {} : { remoteExclude: [...state.exclude] }
754
+ ...state.exclude === void 0 ? {} : { remoteExclude: [...state.exclude] },
755
+ ...config.scope ? { localDirectory: { scope: config.scope, reinclude: config.reinclude } } : {},
756
+ ...state.scope ? { remoteDirectory: { scope: state.scope, reinclude: state.reinclude } } : {}
684
757
  };
685
758
  }
686
759
  function assertLocalSelectionCurrent(config, decision) {
687
- if (syncConfigReviewFingerprint(config) === decision.configIdentity && sameSyncInclude(config.include, decision.localInclude) && sameSyncExclude(config.exclude, decision.localExclude)) {
760
+ if (syncConfigReviewFingerprint(config) === decision.configIdentity && sameSyncInclude(config.include, decision.localInclude) && sameSyncExclude(config.exclude, decision.localExclude) && syncDirectoryPolicyKey(config) === syncDirectoryPolicyKey({
761
+ include: decision.localInclude,
762
+ exclude: decision.localExclude,
763
+ ...decision.localDirectory
764
+ })) {
688
765
  return;
689
766
  }
690
767
  throw new StaleRemoteSelectionReviewError(
@@ -734,8 +811,8 @@ function combineSignals(sessionSignal, actionSignal) {
734
811
  }
735
812
 
736
813
  export {
737
- captureMutationOwner,
738
814
  runCancellableOperation,
815
+ runCancellableTask,
739
816
  showRemoteSelectionReview
740
817
  };
741
- //# sourceMappingURL=chunk-YVH5VJR4.ts.map
818
+ //# sourceMappingURL=chunk-6PFZUEUG.ts.map