@narumitw/pi-sync 0.61.0 → 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 (250) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +24 -17
  3. package/dist/chunks/{chunk-EMVZL4PH.ts → chunk-3E3TR3JE.ts} +4 -4
  4. package/dist/chunks/{chunk-JVFCVPPD.ts → chunk-6PFZUEUG.ts} +41 -18
  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-4SR3ZYHA.ts → chunk-GELYN4UC.ts} +2 -2
  9. package/dist/chunks/{chunk-S7F4FOAS.ts → chunk-GSCZ4VXV.ts} +5 -5
  10. package/dist/chunks/{chunk-YQSFJLJ3.ts → chunk-IBXEM35O.ts} +4 -3
  11. package/dist/chunks/{chunk-E3YLRLJM.ts → chunk-INECVQNR.ts} +10 -10
  12. package/dist/chunks/{chunk-2JHAN3ZO.ts → chunk-JREGWM2B.ts} +3 -3
  13. package/dist/chunks/{chunk-277VHM2P.ts → chunk-MNYRU5U5.ts} +5 -2
  14. package/dist/chunks/{chunk-277VHM2P.ts.map → chunk-MNYRU5U5.ts.map} +2 -2
  15. package/dist/chunks/{chunk-2ZGV5KNC.ts → chunk-NHFGAZEC.ts} +11 -8
  16. package/dist/chunks/chunk-NHFGAZEC.ts.map +7 -0
  17. package/dist/chunks/{chunk-EMRFVLZM.ts → chunk-NXWHPVXR.ts} +2 -2
  18. package/dist/chunks/{chunk-SMVKMYLK.ts → chunk-P4GI7LTT.ts} +2 -2
  19. package/dist/chunks/{chunk-PJMM75W5.ts → chunk-PWESMTH6.ts} +6 -6
  20. package/dist/chunks/{chunk-ZVGRZD4C.ts → chunk-R3SAMXB6.ts} +2 -2
  21. package/dist/chunks/{chunk-RNIEVDTR.ts → chunk-T3LABNHF.ts} +2 -2
  22. package/dist/chunks/{chunk-S3R3W3KF.ts → chunk-UMPA5S7X.ts} +2 -2
  23. package/dist/chunks/{chunk-WP2M67XZ.ts → chunk-WBIOSK76.ts} +2 -2
  24. package/dist/chunks/{chunk-4KTJLJSJ.ts → chunk-ZB3GNX3P.ts} +11 -11
  25. package/dist/chunks/{chunk-HEB6YT64.ts → chunk-ZO52JM4H.ts} +2 -2
  26. package/dist/chunks/{command-handler-K4XJOGYC.ts → command-handler-6ATREPG7.ts} +16 -16
  27. package/dist/chunks/command-handler-6ATREPG7.ts.map +7 -0
  28. package/dist/chunks/{conflict-review-IGKY2TOJ.ts → conflict-review-MAOGTIAI.ts} +4 -4
  29. package/dist/chunks/{continuous-record-3XDXDOMV.ts → continuous-record-3SKJ6I3V.ts} +2 -2
  30. package/dist/chunks/{continuous-storage-HLKCHF6Z.ts → continuous-storage-3EU6I7Z3.ts} +2 -2
  31. package/dist/chunks/{file-selection-MGGVOKM7.ts → file-selection-QR2KZVGD.ts} +10 -10
  32. package/dist/chunks/manager-result-dispatcher-MC6EQOQY.ts +19 -0
  33. package/dist/chunks/{manager-ui-KYQ5AZJS.ts → manager-ui-AOFUNXAJ.ts} +547 -135
  34. package/dist/chunks/manager-ui-AOFUNXAJ.ts.map +7 -0
  35. package/dist/chunks/remote-selection-ui-4BTP2OJR.ts +18 -0
  36. package/dist/chunks/{setup-switch-D6K6PBPC.ts → setup-switch-Y6AMFFNK.ts} +7 -7
  37. package/dist/chunks/{setup-wizard-4DYUDHJR.ts → setup-wizard-5G426MOZ.ts} +10 -10
  38. package/dist/chunks/{snapshot-5HY3M2NL.ts → snapshot-ZUJJZCFW.ts} +2 -2
  39. package/dist/chunks/{snapshot-transaction-directory-OU2D7R7A.ts → snapshot-transaction-directory-F46JWRAU.ts} +2 -2
  40. package/dist/chunks/{state-directory-XXHU73Z3.ts → state-directory-CMAIF34J.ts} +2 -2
  41. package/dist/chunks/{sync-inspection-J3CRBORL.ts → sync-inspection-ITZ6Z4DE.ts} +5 -5
  42. package/dist/chunks/{sync-operations-BVWYYKH3.ts → sync-operations-NMVKF7SE.ts} +13 -9
  43. package/dist/chunks/sync-operations-NMVKF7SE.ts.map +7 -0
  44. package/dist/chunks/{sync-state-2LMIXJ2C.ts → sync-state-QIT64TKV.ts} +2 -2
  45. package/dist/daemon/LICENSE +21 -0
  46. package/dist/daemon/dist/build-version.js +8 -0
  47. package/dist/daemon/dist/child-sdk.mjs +17 -0
  48. package/dist/daemon/dist/cli.js +169 -0
  49. package/dist/daemon/dist/client.js +909 -0
  50. package/dist/daemon/dist/consent.js +265 -0
  51. package/dist/daemon/dist/document.js +6 -0
  52. package/dist/daemon/dist/endpoint.js +91 -0
  53. package/dist/daemon/dist/engine/backends/backend-factory.js +16 -0
  54. package/dist/daemon/dist/engine/backends/backend-identity.js +38 -0
  55. package/dist/daemon/dist/engine/backends/backend-types.js +1 -0
  56. package/dist/daemon/dist/engine/backends/git/git-backend.js +715 -0
  57. package/dist/daemon/dist/engine/backends/git/git-config.js +118 -0
  58. package/dist/daemon/dist/engine/backends/git/git-runner.js +232 -0
  59. package/dist/daemon/dist/engine/backends/git/git-storage.js +252 -0
  60. package/dist/daemon/dist/engine/backends/s3/s3-backend.js +444 -0
  61. package/dist/daemon/dist/engine/backends/s3/s3-client.js +352 -0
  62. package/dist/daemon/dist/engine/backends/s3/s3-conditions.js +66 -0
  63. package/dist/daemon/dist/engine/backends/snapshot-pointer.js +22 -0
  64. package/dist/daemon/dist/engine/backends/sync-backend.js +23 -0
  65. package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +542 -0
  66. package/dist/daemon/dist/engine/backends/webdav/webdav-client.js +326 -0
  67. package/dist/daemon/dist/engine/backends/webdav/webdav-config.js +73 -0
  68. package/dist/daemon/dist/engine/commands/command-types.js +1 -0
  69. package/dist/daemon/dist/engine/host.js +16 -0
  70. package/dist/daemon/dist/engine/ignore/effective-ignore-policy.js +33 -0
  71. package/dist/daemon/dist/engine/ignore/ignore-edit.js +102 -0
  72. package/dist/daemon/dist/engine/ignore/ignore-initialization.js +186 -0
  73. package/dist/daemon/dist/engine/ignore/ignore-migration-prompt.js +139 -0
  74. package/dist/daemon/dist/engine/ignore/ignore-settings.js +322 -0
  75. package/dist/daemon/dist/engine/ignore/ignore-source.js +250 -0
  76. package/dist/daemon/dist/engine/paths.js +71 -0
  77. package/dist/daemon/dist/engine/settings/config-errors.js +4 -0
  78. package/dist/daemon/dist/engine/settings/config-file.js +736 -0
  79. package/dist/daemon/dist/engine/settings/config.js +301 -0
  80. package/dist/daemon/dist/engine/settings/settings-management.js +193 -0
  81. package/dist/daemon/dist/engine/settings/settings-store.js +41 -0
  82. package/dist/daemon/dist/engine/settings/settings-types.js +1 -0
  83. package/dist/daemon/dist/engine/settings/settings-validation.js +384 -0
  84. package/dist/daemon/dist/engine/snapshot/session-paths.js +160 -0
  85. package/dist/daemon/dist/engine/snapshot/snapshot-apply.js +348 -0
  86. package/dist/daemon/dist/engine/snapshot/snapshot-bounds.js +20 -0
  87. package/dist/daemon/dist/engine/snapshot/snapshot-case-replacement.js +82 -0
  88. package/dist/daemon/dist/engine/snapshot/snapshot-codec.js +61 -0
  89. package/dist/daemon/dist/engine/snapshot/snapshot-entry-projection.js +78 -0
  90. package/dist/daemon/dist/engine/snapshot/snapshot-exclude-safety.js +262 -0
  91. package/dist/daemon/dist/engine/snapshot/snapshot-mutation-queues.js +133 -0
  92. package/dist/daemon/dist/engine/snapshot/snapshot-paths.js +11 -0
  93. package/dist/daemon/dist/engine/snapshot/snapshot-payload.js +10 -0
  94. package/dist/daemon/dist/engine/snapshot/snapshot-reviewed-preimages.js +60 -0
  95. package/dist/daemon/dist/engine/snapshot/snapshot-root-transition.js +138 -0
  96. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-directory.js +16 -0
  97. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-images.js +387 -0
  98. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-plan.js +68 -0
  99. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-policy.js +276 -0
  100. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-stage.js +303 -0
  101. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-verification.js +78 -0
  102. package/dist/daemon/dist/engine/snapshot/snapshot-transaction.js +813 -0
  103. package/dist/daemon/dist/engine/snapshot/snapshot-types.js +9 -0
  104. package/dist/daemon/dist/engine/snapshot/snapshot.js +678 -0
  105. package/dist/daemon/dist/engine/state/json-file.js +49 -0
  106. package/dist/daemon/dist/engine/state/lock-policy.js +2 -0
  107. package/dist/daemon/dist/engine/state/lock.js +259 -0
  108. package/dist/daemon/dist/engine/state/lockfile-fs.js +13 -0
  109. package/dist/daemon/dist/engine/state/merge-baseline-store.js +198 -0
  110. package/dist/daemon/dist/engine/state/mutation-directory-sync.js +34 -0
  111. package/dist/daemon/dist/engine/state/operation-availability.js +40 -0
  112. package/dist/daemon/dist/engine/state/state-directory.js +227 -0
  113. package/dist/daemon/dist/engine/state/state-types.js +1 -0
  114. package/dist/daemon/dist/engine/state/sync-state-store.js +54 -0
  115. package/dist/daemon/dist/engine/sync/agent-candidate.js +207 -0
  116. package/dist/daemon/dist/engine/sync/agent-plan.js +84 -0
  117. package/dist/daemon/dist/engine/sync/agent-policy.js +10 -0
  118. package/dist/daemon/dist/engine/sync/agent-refusal-retry.js +39 -0
  119. package/dist/daemon/dist/engine/sync/agent-request.js +13 -0
  120. package/dist/daemon/dist/engine/sync/agent-runner.js +183 -0
  121. package/dist/daemon/dist/engine/sync/agent-store.js +177 -0
  122. package/dist/daemon/dist/engine/sync/agent-sync.js +132 -0
  123. package/dist/daemon/dist/engine/sync/apply-review.js +52 -0
  124. package/dist/daemon/dist/engine/sync/conflict-artifact-ownership.js +53 -0
  125. package/dist/daemon/dist/engine/sync/conflict-artifacts.js +158 -0
  126. package/dist/daemon/dist/engine/sync/conflict-groups.js +76 -0
  127. package/dist/daemon/dist/engine/sync/conflict-preview.js +53 -0
  128. package/dist/daemon/dist/engine/sync/conflict-resolution.js +53 -0
  129. package/dist/daemon/dist/engine/sync/conflict-retention.js +61 -0
  130. package/dist/daemon/dist/engine/sync/conflict-review.js +73 -0
  131. package/dist/daemon/dist/engine/sync/content-conflicts.js +70 -0
  132. package/dist/daemon/dist/engine/sync/continuous-errors.js +66 -0
  133. package/dist/daemon/dist/engine/sync/continuous-lease.js +206 -0
  134. package/dist/daemon/dist/engine/sync/continuous-record.js +199 -0
  135. package/dist/daemon/dist/engine/sync/continuous-storage.js +59 -0
  136. package/dist/daemon/dist/engine/sync/continuous-sync.js +521 -0
  137. package/dist/daemon/dist/engine/sync/continuous-watch.js +140 -0
  138. package/dist/daemon/dist/engine/sync/exclude-policy.js +86 -0
  139. package/dist/daemon/dist/engine/sync/field-migration.js +20 -0
  140. package/dist/daemon/dist/engine/sync/file-merge-planner.js +123 -0
  141. package/dist/daemon/dist/engine/sync/initialization.js +80 -0
  142. package/dist/daemon/dist/engine/sync/json-document.js +172 -0
  143. package/dist/daemon/dist/engine/sync/local-field-policy.js +26 -0
  144. package/dist/daemon/dist/engine/sync/local-fields.js +196 -0
  145. package/dist/daemon/dist/engine/sync/merge-apply.js +529 -0
  146. package/dist/daemon/dist/engine/sync/merge-journal.js +295 -0
  147. package/dist/daemon/dist/engine/sync/merge-transfer-error.js +64 -0
  148. package/dist/daemon/dist/engine/sync/merged-sync.js +674 -0
  149. package/dist/daemon/dist/engine/sync/mutation-owner.js +18 -0
  150. package/dist/daemon/dist/engine/sync/package-merge.js +82 -0
  151. package/dist/daemon/dist/engine/sync/partial-progress.js +41 -0
  152. package/dist/daemon/dist/engine/sync/remote-snapshot.js +104 -0
  153. package/dist/daemon/dist/engine/sync/resolver-stream.js +34 -0
  154. package/dist/daemon/dist/engine/sync/session-merge.js +178 -0
  155. package/dist/daemon/dist/engine/sync/session-push.js +33 -0
  156. package/dist/daemon/dist/engine/sync/settings-conflicts.js +56 -0
  157. package/dist/daemon/dist/engine/sync/settings-merge.js +93 -0
  158. package/dist/daemon/dist/engine/sync/signals.js +8 -0
  159. package/dist/daemon/dist/engine/sync/startup-timings.js +44 -0
  160. package/dist/daemon/dist/engine/sync/sync-decision.js +81 -0
  161. package/dist/daemon/dist/engine/sync/sync-error-guidance.js +55 -0
  162. package/dist/daemon/dist/engine/sync/sync-errors.js +18 -0
  163. package/dist/daemon/dist/engine/sync/sync-inspection.js +42 -0
  164. package/dist/daemon/dist/engine/sync/sync-loaders.js +8 -0
  165. package/dist/daemon/dist/engine/sync/sync-local.js +40 -0
  166. package/dist/daemon/dist/engine/sync/sync-mutations.js +733 -0
  167. package/dist/daemon/dist/engine/sync/sync-operations.js +3 -0
  168. package/dist/daemon/dist/engine/sync/sync-policy.js +621 -0
  169. package/dist/daemon/dist/engine/sync/sync-queries.js +212 -0
  170. package/dist/daemon/dist/engine/sync/sync-state.js +129 -0
  171. package/dist/daemon/dist/engine/sync/text-merge.js +124 -0
  172. package/dist/daemon/dist/engine/types.js +2 -0
  173. package/dist/daemon/dist/engine/ui/merge-review.js +7 -0
  174. package/dist/daemon/dist/engine/ui/merged-sync-summary.js +86 -0
  175. package/dist/daemon/dist/engine/ui/sync-format.js +165 -0
  176. package/dist/daemon/dist/engine/ui/sync-status.js +30 -0
  177. package/dist/daemon/dist/engine/ui/terminal-text.js +9 -0
  178. package/dist/daemon/dist/engine/ui/transfer-changes.js +24 -0
  179. package/dist/daemon/dist/engine/ui/transfer-review.js +19 -0
  180. package/dist/daemon/dist/engine-service.js +344 -0
  181. package/dist/daemon/dist/identity.js +241 -0
  182. package/dist/daemon/dist/idle-exit.js +77 -0
  183. package/dist/daemon/dist/index.js +4 -0
  184. package/dist/daemon/dist/lifecycle-log.js +53 -0
  185. package/dist/daemon/dist/lifecycle.js +21 -0
  186. package/dist/daemon/dist/model-signature.js +7 -0
  187. package/dist/daemon/dist/monitor.js +272 -0
  188. package/dist/daemon/dist/participant-admission.js +30 -0
  189. package/dist/daemon/dist/protocol.js +104 -0
  190. package/dist/daemon/dist/resolver-host.js +78 -0
  191. package/dist/daemon/dist/server.js +953 -0
  192. package/dist/daemon/dist/service-host.js +174 -0
  193. package/dist/daemon/dist/upgrade-repair.js +55 -0
  194. package/dist/daemon/package.json +3 -0
  195. package/dist/index.ts +21 -21
  196. package/dist/package.json +6 -0
  197. package/docs/daemon-migration.md +27 -16
  198. package/package.json +9 -3
  199. package/skills/configure-pi-sync/SKILL.md +38 -13
  200. package/skills/configure-pi-sync/references/configuration.md +2 -2
  201. package/src/commands/command-execution.ts +1 -1
  202. package/src/settings/config.ts +1 -0
  203. package/src/sync/sync-operations.ts +18 -10
  204. package/src/ui/excluded-paths-ui.ts +4 -1
  205. package/src/ui/ignore-file-ui.ts +271 -0
  206. package/src/ui/ignore-migration-prompt.ts +65 -0
  207. package/src/ui/manager-state.ts +27 -13
  208. package/src/ui/manager-ui.ts +38 -19
  209. package/src/ui/remote-selection-ui.ts +41 -8
  210. package/src/ui/settings-review.ts +26 -0
  211. package/src/ui/settings-ui.ts +316 -213
  212. package/src/ui/storage-connections-ui.ts +20 -12
  213. package/src/ui/sync-setups-ui.ts +45 -27
  214. package/dist/chunks/chunk-2ZGV5KNC.ts.map +0 -7
  215. package/dist/chunks/chunk-JVFCVPPD.ts.map +0 -7
  216. package/dist/chunks/command-handler-K4XJOGYC.ts.map +0 -7
  217. package/dist/chunks/manager-result-dispatcher-4VJVDEUD.ts +0 -19
  218. package/dist/chunks/manager-ui-KYQ5AZJS.ts.map +0 -7
  219. package/dist/chunks/remote-selection-ui-W3KOZM3W.ts +0 -18
  220. package/dist/chunks/sync-operations-BVWYYKH3.ts.map +0 -7
  221. /package/dist/chunks/{chunk-EMVZL4PH.ts.map → chunk-3E3TR3JE.ts.map} +0 -0
  222. /package/dist/chunks/{chunk-ZIL6PW5L.ts.map → chunk-6YKOHBSC.ts.map} +0 -0
  223. /package/dist/chunks/{chunk-OA4NZLSL.ts.map → chunk-APZVJAEW.ts.map} +0 -0
  224. /package/dist/chunks/{chunk-4SR3ZYHA.ts.map → chunk-GELYN4UC.ts.map} +0 -0
  225. /package/dist/chunks/{chunk-S7F4FOAS.ts.map → chunk-GSCZ4VXV.ts.map} +0 -0
  226. /package/dist/chunks/{chunk-YQSFJLJ3.ts.map → chunk-IBXEM35O.ts.map} +0 -0
  227. /package/dist/chunks/{chunk-E3YLRLJM.ts.map → chunk-INECVQNR.ts.map} +0 -0
  228. /package/dist/chunks/{chunk-2JHAN3ZO.ts.map → chunk-JREGWM2B.ts.map} +0 -0
  229. /package/dist/chunks/{chunk-EMRFVLZM.ts.map → chunk-NXWHPVXR.ts.map} +0 -0
  230. /package/dist/chunks/{chunk-SMVKMYLK.ts.map → chunk-P4GI7LTT.ts.map} +0 -0
  231. /package/dist/chunks/{chunk-PJMM75W5.ts.map → chunk-PWESMTH6.ts.map} +0 -0
  232. /package/dist/chunks/{chunk-ZVGRZD4C.ts.map → chunk-R3SAMXB6.ts.map} +0 -0
  233. /package/dist/chunks/{chunk-RNIEVDTR.ts.map → chunk-T3LABNHF.ts.map} +0 -0
  234. /package/dist/chunks/{chunk-S3R3W3KF.ts.map → chunk-UMPA5S7X.ts.map} +0 -0
  235. /package/dist/chunks/{chunk-WP2M67XZ.ts.map → chunk-WBIOSK76.ts.map} +0 -0
  236. /package/dist/chunks/{chunk-4KTJLJSJ.ts.map → chunk-ZB3GNX3P.ts.map} +0 -0
  237. /package/dist/chunks/{chunk-HEB6YT64.ts.map → chunk-ZO52JM4H.ts.map} +0 -0
  238. /package/dist/chunks/{conflict-review-IGKY2TOJ.ts.map → conflict-review-MAOGTIAI.ts.map} +0 -0
  239. /package/dist/chunks/{continuous-record-3XDXDOMV.ts.map → continuous-record-3SKJ6I3V.ts.map} +0 -0
  240. /package/dist/chunks/{continuous-storage-HLKCHF6Z.ts.map → continuous-storage-3EU6I7Z3.ts.map} +0 -0
  241. /package/dist/chunks/{file-selection-MGGVOKM7.ts.map → file-selection-QR2KZVGD.ts.map} +0 -0
  242. /package/dist/chunks/{manager-result-dispatcher-4VJVDEUD.ts.map → manager-result-dispatcher-MC6EQOQY.ts.map} +0 -0
  243. /package/dist/chunks/{remote-selection-ui-W3KOZM3W.ts.map → remote-selection-ui-4BTP2OJR.ts.map} +0 -0
  244. /package/dist/chunks/{setup-switch-D6K6PBPC.ts.map → setup-switch-Y6AMFFNK.ts.map} +0 -0
  245. /package/dist/chunks/{setup-wizard-4DYUDHJR.ts.map → setup-wizard-5G426MOZ.ts.map} +0 -0
  246. /package/dist/chunks/{snapshot-5HY3M2NL.ts.map → snapshot-ZUJJZCFW.ts.map} +0 -0
  247. /package/dist/chunks/{snapshot-transaction-directory-OU2D7R7A.ts.map → snapshot-transaction-directory-F46JWRAU.ts.map} +0 -0
  248. /package/dist/chunks/{state-directory-XXHU73Z3.ts.map → state-directory-CMAIF34J.ts.map} +0 -0
  249. /package/dist/chunks/{sync-inspection-J3CRBORL.ts.map → sync-inspection-ITZ6Z4DE.ts.map} +0 -0
  250. /package/dist/chunks/{sync-state-2LMIXJ2C.ts.map → sync-state-QIT64TKV.ts.map} +0 -0
@@ -5,25 +5,25 @@ import {
5
5
  showGitSetup,
6
6
  showS3Setup,
7
7
  showWebDavSetup
8
- } from "./chunk-4KTJLJSJ.ts";
8
+ } from "./chunk-ZB3GNX3P.ts";
9
9
  import {
10
10
  validateConfigName
11
- } from "./chunk-OA4NZLSL.ts";
11
+ } from "./chunk-APZVJAEW.ts";
12
12
  import "./chunk-ECYCNZOE.ts";
13
- import "./chunk-WP2M67XZ.ts";
13
+ import "./chunk-WBIOSK76.ts";
14
14
  import "./chunk-HLCML3OW.ts";
15
- import "./chunk-2JHAN3ZO.ts";
15
+ import "./chunk-JREGWM2B.ts";
16
16
  import {
17
17
  localConfigPath
18
- } from "./chunk-YQSFJLJ3.ts";
18
+ } from "./chunk-IBXEM35O.ts";
19
19
  import {
20
20
  throwIfAborted
21
- } from "./chunk-S3R3W3KF.ts";
22
- import "./chunk-EMRFVLZM.ts";
21
+ } from "./chunk-UMPA5S7X.ts";
22
+ import "./chunk-NXWHPVXR.ts";
23
23
  import {
24
24
  errorMessage
25
- } from "./chunk-ZIL6PW5L.ts";
26
- import "./chunk-ZVGRZD4C.ts";
25
+ } from "./chunk-6YKOHBSC.ts";
26
+ import "./chunk-R3SAMXB6.ts";
27
27
  import {
28
28
  safeTerminalText
29
29
  } from "./chunk-2JNFEZ3V.ts";
@@ -89,4 +89,4 @@ async function showSetupWizard(ctx, signal) {
89
89
  export {
90
90
  showSetupWizard
91
91
  };
92
- //# sourceMappingURL=setup-wizard-4DYUDHJR.ts.map
92
+ //# sourceMappingURL=setup-wizard-5G426MOZ.ts.map
@@ -20,7 +20,7 @@ import {
20
20
  snapshotIncludesSessions,
21
21
  snapshotTarget,
22
22
  snapshotWithoutSessions
23
- } from "@narumitw/pi-sync-daemon/engine/snapshot/snapshot";
23
+ } from "#pi-sync-daemon/engine/snapshot/snapshot";
24
24
  export {
25
25
  canonicalSnapshotPathForConfig,
26
26
  collectFiles,
@@ -40,4 +40,4 @@ export {
40
40
  snapshotTarget,
41
41
  snapshotWithoutSessions
42
42
  };
43
- //# sourceMappingURL=snapshot-5HY3M2NL.ts.map
43
+ //# sourceMappingURL=snapshot-ZUJJZCFW.ts.map
@@ -5,9 +5,9 @@
5
5
  import {
6
6
  pendingTransactionEntries,
7
7
  transactionRoot
8
- } from "@narumitw/pi-sync-daemon/engine/snapshot/snapshot-transaction-directory";
8
+ } from "#pi-sync-daemon/engine/snapshot/snapshot-transaction-directory";
9
9
  export {
10
10
  pendingTransactionEntries,
11
11
  transactionRoot
12
12
  };
13
- //# sourceMappingURL=snapshot-transaction-directory-OU2D7R7A.ts.map
13
+ //# sourceMappingURL=snapshot-transaction-directory-F46JWRAU.ts.map
@@ -6,7 +6,7 @@ import {
6
6
  stateDir,
7
7
  stateDirectoryMigrationNotice,
8
8
  withStateDirectoryAccess
9
- } from "./chunk-RNIEVDTR.ts";
9
+ } from "./chunk-T3LABNHF.ts";
10
10
  export {
11
11
  legacyStateDir,
12
12
  migrateLegacyStateDirectory,
@@ -14,4 +14,4 @@ export {
14
14
  stateDirectoryMigrationNotice,
15
15
  withStateDirectoryAccess
16
16
  };
17
- //# sourceMappingURL=state-directory-XXHU73Z3.ts.map
17
+ //# sourceMappingURL=state-directory-CMAIF34J.ts.map
@@ -2,13 +2,13 @@
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  currentPiDaemonClient
5
- } from "./chunk-E3YLRLJM.ts";
5
+ } from "./chunk-INECVQNR.ts";
6
6
  import {
7
7
  syncCheckConfigFingerprint
8
- } from "./chunk-277VHM2P.ts";
8
+ } from "./chunk-MNYRU5U5.ts";
9
9
  import "./chunk-H7VOTY5N.ts";
10
- import "./chunk-ZIL6PW5L.ts";
11
- import "./chunk-ZVGRZD4C.ts";
10
+ import "./chunk-6YKOHBSC.ts";
11
+ import "./chunk-R3SAMXB6.ts";
12
12
  import "./chunk-2JNFEZ3V.ts";
13
13
 
14
14
  // src/sync/sync-inspection.ts
@@ -20,4 +20,4 @@ var inspectSync = async (config, _options, signal) => await currentPiDaemonClien
20
20
  export {
21
21
  inspectSync
22
22
  };
23
- //# sourceMappingURL=sync-inspection-J3CRBORL.ts.map
23
+ //# sourceMappingURL=sync-inspection-ITZ6Z4DE.ts.map
@@ -2,21 +2,25 @@
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  remoteOperation
5
- } from "./chunk-E3YLRLJM.ts";
5
+ } from "./chunk-INECVQNR.ts";
6
6
  import "./chunk-H7VOTY5N.ts";
7
- import "./chunk-ZIL6PW5L.ts";
8
- import "./chunk-ZVGRZD4C.ts";
7
+ import "./chunk-6YKOHBSC.ts";
8
+ import "./chunk-R3SAMXB6.ts";
9
9
  import "./chunk-2JNFEZ3V.ts";
10
10
 
11
11
  // src/sync/sync-operations.ts
12
- async function transfer(ctx, operation, options) {
13
- const result = await remoteOperation(ctx, operation, options);
12
+ function transferResult(result) {
14
13
  if (result === void 0 || result === "applied" || result === "cancelled") return result;
15
14
  throw new Error("Invalid transfer result from pi-sync-daemon.");
16
15
  }
17
- var push = (ctx, options) => transfer(ctx, "push", options);
18
- var pull = (ctx, options) => transfer(ctx, "pull", options);
19
- var syncBoth = (ctx, options) => transfer(ctx, options.auto ? "startup-transfer" : "sync", options);
16
+ var push = async (ctx, options) => transferResult(await remoteOperation(ctx, "push", options));
17
+ var pull = async (ctx, options) => transferResult(await remoteOperation(ctx, "pull", options));
18
+ async function syncBoth(ctx, options) {
19
+ const result = await remoteOperation(ctx, options.auto ? "startup-transfer" : "sync", options);
20
+ if (result === "archived" && !options.auto && !options.agentRetryRefusal && !options.yes && ctx.hasUI && (ctx.mode === "tui" || ctx.mode === "rpc"))
21
+ return result;
22
+ return transferResult(result);
23
+ }
20
24
  async function rollback(ctx, options) {
21
25
  await remoteOperation(ctx, "rollback", options);
22
26
  }
@@ -42,4 +46,4 @@ export {
42
46
  status,
43
47
  syncBoth
44
48
  };
45
- //# sourceMappingURL=sync-operations-BVWYYKH3.ts.map
49
+ //# sourceMappingURL=sync-operations-NMVKF7SE.ts.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/sync/sync-operations.ts"],
4
+ "sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport type { CommandOptions } from \"../commands/command-types.js\";\nimport { remoteOperation } from \"../daemon/pi-client.js\";\nimport type { SetupPullOutcome } from \"./setup-switch.js\";\n\nfunction transferResult(result: unknown): SetupPullOutcome | undefined {\n if (result === undefined || result === \"applied\" || result === \"cancelled\") return result;\n throw new Error(\"Invalid transfer result from pi-sync-daemon.\");\n}\nexport const push = async (ctx: ExtensionContext, options: CommandOptions) =>\n transferResult(await remoteOperation(ctx, \"push\", options));\nexport const pull = async (ctx: ExtensionContext, options: CommandOptions) =>\n transferResult(await remoteOperation(ctx, \"pull\", options));\nexport async function syncBoth(ctx: ExtensionContext, options: CommandOptions) {\n const result = await remoteOperation(ctx, options.auto ? \"startup-transfer\" : \"sync\", options);\n if (\n result === \"archived\" &&\n !options.auto &&\n !options.agentRetryRefusal &&\n !options.yes &&\n ctx.hasUI &&\n (ctx.mode === \"tui\" || ctx.mode === \"rpc\")\n )\n return result;\n return transferResult(result);\n}\nexport async function rollback(ctx: ExtensionContext, options: CommandOptions) {\n await remoteOperation(ctx, \"rollback\", options);\n}\nexport async function status(ctx: ExtensionContext, options: CommandOptions) {\n await remoteOperation(ctx, \"status\", options);\n}\nexport async function diff(ctx: ExtensionContext, options: CommandOptions) {\n await remoteOperation(ctx, \"diff\", options);\n}\nexport async function doctor(ctx: ExtensionContext, options: CommandOptions) {\n await remoteOperation(ctx, \"doctor\", options);\n}\nexport async function history(ctx: ExtensionContext, options: CommandOptions) {\n await remoteOperation(ctx, \"history\", options);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;AAKA,SAAS,eAAe,QAA+C;AACrE,MAAI,WAAW,UAAa,WAAW,aAAa,WAAW,YAAa,QAAO;AACnF,QAAM,IAAI,MAAM,8CAA8C;AAChE;AACO,IAAM,OAAO,OAAO,KAAuB,YAChD,eAAe,MAAM,gBAAgB,KAAK,QAAQ,OAAO,CAAC;AACrD,IAAM,OAAO,OAAO,KAAuB,YAChD,eAAe,MAAM,gBAAgB,KAAK,QAAQ,OAAO,CAAC;AAC5D,eAAsB,SAAS,KAAuB,SAAyB;AAC7E,QAAM,SAAS,MAAM,gBAAgB,KAAK,QAAQ,OAAO,qBAAqB,QAAQ,OAAO;AAC7F,MACE,WAAW,cACX,CAAC,QAAQ,QACT,CAAC,QAAQ,qBACT,CAAC,QAAQ,OACT,IAAI,UACH,IAAI,SAAS,SAAS,IAAI,SAAS;AAEpC,WAAO;AACT,SAAO,eAAe,MAAM;AAC9B;AACA,eAAsB,SAAS,KAAuB,SAAyB;AAC7E,QAAM,gBAAgB,KAAK,YAAY,OAAO;AAChD;AACA,eAAsB,OAAO,KAAuB,SAAyB;AAC3E,QAAM,gBAAgB,KAAK,UAAU,OAAO;AAC9C;AACA,eAAsB,KAAK,KAAuB,SAAyB;AACzE,QAAM,gBAAgB,KAAK,QAAQ,OAAO;AAC5C;AACA,eAAsB,OAAO,KAAuB,SAAyB;AAC3E,QAAM,gBAAgB,KAAK,UAAU,OAAO;AAC9C;AACA,eAAsB,QAAQ,KAAuB,SAAyB;AAC5E,QAAM,gBAAgB,KAAK,WAAW,OAAO;AAC/C;",
6
+ "names": []
7
+ }
@@ -18,7 +18,7 @@ import {
18
18
  snapshotHashesMatchState,
19
19
  snapshotsMatch,
20
20
  syncPolicyChanged
21
- } from "@narumitw/pi-sync-daemon/engine/sync/sync-state";
21
+ } from "#pi-sync-daemon/engine/sync/sync-state";
22
22
  export {
23
23
  canPullRemoteSessionsOnFirstSync,
24
24
  canPullRemoteSettingsOnFirstSync,
@@ -36,4 +36,4 @@ export {
36
36
  snapshotsMatch,
37
37
  syncPolicyChanged
38
38
  };
39
- //# sourceMappingURL=sync-state-2LMIXJ2C.ts.map
39
+ //# sourceMappingURL=sync-state-QIT64TKV.ts.map
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 narumiruna
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,8 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { valid } from "semver";
3
+ // Capture the installed build at module load. A later package update must not
4
+ // change the version advertised by an already running process.
5
+ const { version } = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
6
+ if (typeof version !== "string" || valid(version) !== version)
7
+ throw new Error("Invalid Pi Sync daemon build version.");
8
+ export const DAEMON_BUILD_VERSION = version;
@@ -0,0 +1,17 @@
1
+ import { registerHooks } from "node:module";
2
+
3
+ const scope = new URL("./", import.meta.url).href;
4
+ let sdk;
5
+ registerHooks({
6
+ resolve(specifier, context, nextResolve) {
7
+ if (context.parentURL?.startsWith(scope)) {
8
+ const codingAgent = specifier === "@earendil-works/pi-coding-agent";
9
+ if (codingAgent || specifier === "@earendil-works/pi-ai" || specifier === "@earendil-works/pi-tui") {
10
+ sdk ??= import.meta.resolve("@narumitw/sync-node-sdk");
11
+ if (codingAgent) return nextResolve(sdk, context);
12
+ return nextResolve(specifier, { ...context, parentURL: sdk });
13
+ }
14
+ }
15
+ return nextResolve(specifier, context);
16
+ },
17
+ });
@@ -0,0 +1,169 @@
1
+ #!/usr/bin/env node
2
+ import "./child-sdk.mjs";
3
+ import path from "node:path";
4
+ import { setTimeout as delay } from "node:timers/promises";
5
+ import { valid } from "semver";
6
+ import { ensureDaemon, requestDaemon } from "./client.js";
7
+ import { privateDirectory, processExists, processExited, readIdentity, readUpgradeOwner, runtimePaths, } from "./identity.js";
8
+ import { openLifecycleLog } from "./lifecycle-log.js";
9
+ import { record } from "./protocol.js";
10
+ export async function main(args) {
11
+ const [command = "help", flag, root, ...extra] = args;
12
+ if (["help", "--help", "-h"].includes(command)) {
13
+ console.log("pi-sync-daemon <start|status|stop|restart|repair-upgrade|serve> --root <canonical-agent-directory>\nLocal synchronization owner; no OS service registration. status/stop/repair-upgrade never start a service.\nrepair-upgrade revokes all retained unattended grants after verified exit and archives the pending upgrade records.");
14
+ return;
15
+ }
16
+ if (!["start", "status", "stop", "restart", "repair-upgrade", "serve"].includes(command) ||
17
+ flag !== "--root" ||
18
+ !root ||
19
+ extra.length)
20
+ throw new Error("Use pi-sync-daemon --help for the supported commands.");
21
+ if (command === "repair-upgrade") {
22
+ const { repairUpgrade } = await import("./upgrade-repair.js");
23
+ console.log(JSON.stringify(await repairUpgrade(root)));
24
+ return;
25
+ }
26
+ if (command === "serve") {
27
+ process.send?.({ type: "booting" });
28
+ const { createEngineService } = await import("./engine-service.js");
29
+ const { startServer } = await import("./server.js");
30
+ const paths = await runtimePaths(root);
31
+ // Credential commands have one documented working directory, never a closed Pi context.
32
+ process.chdir(paths.root);
33
+ await privateDirectory(paths.directory);
34
+ let log;
35
+ const note = (phase) => {
36
+ try {
37
+ log?.write(phase);
38
+ }
39
+ catch {
40
+ log?.close(); /* Never follow a replaced diagnostic path. */
41
+ }
42
+ };
43
+ const service = createEngineService(paths.root);
44
+ let server;
45
+ try {
46
+ server = await startServer(paths.root, service.execute, {
47
+ ...service.hooks,
48
+ stopped: () => {
49
+ note("drained");
50
+ log?.close();
51
+ },
52
+ failure: () => {
53
+ service.hooks.failure();
54
+ note("failed");
55
+ },
56
+ });
57
+ // Only the published owner may open or modify its shared diagnostic file.
58
+ try {
59
+ log = openLifecycleLog(paths.directory);
60
+ }
61
+ catch (error) {
62
+ await server.close();
63
+ throw error;
64
+ }
65
+ note("starting");
66
+ service.bind(server);
67
+ }
68
+ catch (error) {
69
+ note("failed");
70
+ log?.close();
71
+ throw error;
72
+ }
73
+ note("ready");
74
+ let stopping;
75
+ const stop = () => {
76
+ stopping ??= server.close().catch(() => {
77
+ process.exitCode = 1;
78
+ });
79
+ return stopping;
80
+ };
81
+ process.on("SIGTERM", stop);
82
+ process.on("SIGINT", stop);
83
+ // Parent disconnect means readiness IPC ended, not service shutdown.
84
+ process.send?.({ type: "ready", identity: server.identity });
85
+ process.channel?.unref();
86
+ return;
87
+ }
88
+ if (command === "start") {
89
+ const { identity } = await ensureDaemon(root);
90
+ console.log(JSON.stringify({ running: true, root: identity.root, instance: identity.instance, pid: identity.pid }));
91
+ return;
92
+ }
93
+ const paths = await runtimePaths(root);
94
+ const identity = await readIdentity(paths);
95
+ if (command === "status") {
96
+ const pending = await readUpgradeOwner(paths);
97
+ const summary = {
98
+ root: paths.root,
99
+ ...(identity && { recordedPid: identity.pid }),
100
+ ...(pending && { pendingUpgradePid: pending.pid }),
101
+ };
102
+ if (!identity ||
103
+ (pending?.instance === identity.instance && pending.pid === identity.pid && (await processExited(pending)))) {
104
+ console.log(JSON.stringify({ running: false, ...summary }));
105
+ return;
106
+ }
107
+ try {
108
+ const status = await requestDaemon(paths, identity, "hello", {});
109
+ if (!record(status) ||
110
+ status.version !== 1 ||
111
+ status.root !== paths.root ||
112
+ status.instance !== identity.instance ||
113
+ status.pid !== identity.pid)
114
+ throw new Error("Daemon identity mismatch; no replacement was attempted.");
115
+ const build = typeof status.buildVersion === "string" ? valid(status.buildVersion) : null;
116
+ console.log(JSON.stringify({
117
+ running: true,
118
+ ...summary,
119
+ version: status.version,
120
+ instance: identity.instance,
121
+ pid: identity.pid,
122
+ ...(build && { buildVersion: build }),
123
+ lifecycleLog: path.join(paths.directory, "lifecycle.log"),
124
+ }));
125
+ }
126
+ catch {
127
+ // A failed hello does not prove the recorded owner exited.
128
+ console.log(JSON.stringify({ running: null, ...summary }));
129
+ }
130
+ return;
131
+ }
132
+ if (!identity) {
133
+ if (command === "restart") {
134
+ await main(["start", "--root", root]);
135
+ return;
136
+ }
137
+ console.log(JSON.stringify({ running: false, root: paths.root }));
138
+ return;
139
+ }
140
+ await requestDaemon(paths, identity, "stop", {});
141
+ const deadline = Date.now() + 30_000;
142
+ while (await readIdentity(paths)) {
143
+ if (Date.now() >= deadline)
144
+ throw new Error("Daemon did not drain; state retained. Do not force a second owner.");
145
+ await delay(25);
146
+ }
147
+ if (command === "restart") {
148
+ while (processExists(identity.pid)) {
149
+ if (Date.now() >= deadline)
150
+ throw new Error("Previous daemon is still exiting; restart was not attempted.");
151
+ await delay(25);
152
+ }
153
+ await main(["start", "--root", root]);
154
+ }
155
+ else
156
+ console.log(JSON.stringify({ stopped: true, root: paths.root }));
157
+ }
158
+ if (import.meta.main) {
159
+ void main(process.argv.slice(2)).catch(() => {
160
+ process.send?.({
161
+ type: "error",
162
+ message: "Daemon initialization failed; private state retained. Check endpoint ownership and compatible versions.",
163
+ });
164
+ console.error(process.argv[2] === "repair-upgrade"
165
+ ? "Pi Sync upgrade repair failed. Check the pending PID, wait for confirmed exit, and check consent storage. Do not delete recovery files."
166
+ : "pi-sync-daemon failed; private state retained. Check root, endpoint ownership, and version compatibility.");
167
+ process.exitCode = 1;
168
+ });
169
+ }