@narumitw/pi-sync 0.57.10 → 0.57.12

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 (173) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +32 -22
  3. package/dist/chunks/{agent-candidate-EYB35AGL.ts → agent-candidate-U2NU3GUX.ts} +11 -11
  4. package/dist/chunks/{agent-plan-KO43GTOR.ts → agent-plan-3YXDIJXO.ts} +25 -22
  5. package/dist/chunks/agent-plan-3YXDIJXO.ts.map +7 -0
  6. package/dist/chunks/{agent-refusal-retry-C2HQROTP.ts → agent-refusal-retry-476YGNU5.ts} +10 -10
  7. package/dist/chunks/{agent-runner-WMSCKSCB.ts → agent-runner-FCRV2Z75.ts} +11 -10
  8. package/dist/chunks/agent-runner-FCRV2Z75.ts.map +7 -0
  9. package/dist/chunks/{agent-store-UT52DS7B.ts → agent-store-7GINKTS7.ts} +8 -8
  10. package/dist/chunks/{agent-store-UT52DS7B.ts.map → agent-store-7GINKTS7.ts.map} +2 -2
  11. package/dist/chunks/{agent-sync-VM3TXWA3.ts → agent-sync-P6AWQXGK.ts} +6 -6
  12. package/dist/chunks/{chunk-JXWTEJS5.ts → chunk-45COPAK7.ts} +10 -3
  13. package/dist/chunks/chunk-45COPAK7.ts.map +7 -0
  14. package/dist/chunks/{chunk-DOJRPBQU.ts → chunk-5TSCBBPP.ts} +4 -4
  15. package/dist/chunks/{chunk-CDQGSZL3.ts → chunk-6LD5KX55.ts} +6 -6
  16. package/dist/chunks/{chunk-MDUORMCK.ts → chunk-6O3EDBRL.ts} +2 -2
  17. package/dist/chunks/{chunk-AAPAHANE.ts → chunk-7A35ZAVO.ts} +320 -219
  18. package/dist/chunks/chunk-7A35ZAVO.ts.map +7 -0
  19. package/dist/chunks/{chunk-STVQQ5KG.ts → chunk-7ZIYU5QS.ts} +6 -6
  20. package/dist/chunks/{chunk-AO6EDUA6.ts → chunk-AKMV47YC.ts} +3 -3
  21. package/dist/chunks/{chunk-66GAUVDL.ts → chunk-BEST45H2.ts} +6 -6
  22. package/dist/chunks/{chunk-DO55XUNU.ts → chunk-CBLTWXAU.ts} +15 -5
  23. package/dist/chunks/chunk-CBLTWXAU.ts.map +7 -0
  24. package/dist/chunks/{chunk-IMMMZUFC.ts → chunk-CQD2TJHE.ts} +7 -7
  25. package/dist/chunks/{chunk-IMMMZUFC.ts.map → chunk-CQD2TJHE.ts.map} +2 -2
  26. package/dist/chunks/{chunk-73MDIVYJ.ts → chunk-DN4IA7MR.ts} +6 -6
  27. package/dist/chunks/{chunk-PHANBTVM.ts → chunk-ESKOPQVB.ts} +4 -4
  28. package/dist/chunks/{chunk-YZ5BQNRZ.ts → chunk-FHE2DCA2.ts} +2 -2
  29. package/dist/chunks/{chunk-YZ5BQNRZ.ts.map → chunk-FHE2DCA2.ts.map} +2 -2
  30. package/dist/chunks/{chunk-MRIPZGPR.ts → chunk-FLHCOJCD.ts} +3 -3
  31. package/dist/chunks/{chunk-5WJQ6XOW.ts → chunk-GNYGNHFF.ts} +2 -2
  32. package/dist/chunks/{chunk-DFJGTVPX.ts → chunk-KYTT7KV4.ts} +2 -2
  33. package/dist/chunks/{chunk-UGSSZWQ6.ts → chunk-MKSMJPVA.ts} +2 -2
  34. package/dist/chunks/{chunk-2VSN3MFX.ts → chunk-MMQIEDZ6.ts} +33 -27
  35. package/dist/chunks/chunk-MMQIEDZ6.ts.map +7 -0
  36. package/dist/chunks/{chunk-RAMHGOX2.ts → chunk-OJARL2TG.ts} +4 -4
  37. package/dist/chunks/{chunk-BJXSCGQK.ts → chunk-OKPPZA4D.ts} +148 -89
  38. package/dist/chunks/chunk-OKPPZA4D.ts.map +7 -0
  39. package/dist/chunks/{chunk-RX3WGWVL.ts → chunk-OVBAW7KV.ts} +177 -130
  40. package/dist/chunks/chunk-OVBAW7KV.ts.map +7 -0
  41. package/dist/chunks/{chunk-U77DWNRH.ts → chunk-Q23JJW7E.ts} +3 -3
  42. package/dist/chunks/{chunk-NLWS55B6.ts → chunk-QPC5HT3A.ts} +2 -2
  43. package/dist/chunks/{chunk-NLWS55B6.ts.map → chunk-QPC5HT3A.ts.map} +1 -1
  44. package/dist/chunks/{chunk-4RLATUP4.ts → chunk-S5OCYVPS.ts} +7 -7
  45. package/dist/chunks/{chunk-4RLATUP4.ts.map → chunk-S5OCYVPS.ts.map} +2 -2
  46. package/dist/chunks/{chunk-QWV3XKNJ.ts → chunk-TIMWN2RH.ts} +5 -5
  47. package/dist/chunks/{chunk-Z5O2TLNF.ts → chunk-TZC7GDJE.ts} +7 -7
  48. package/dist/chunks/{chunk-UCD7TQDT.ts → chunk-U6GXGY5G.ts} +5 -5
  49. package/dist/chunks/{chunk-PWA3YN5Z.ts → chunk-XEODG2PE.ts} +3 -3
  50. package/dist/chunks/{chunk-TO2GMX3K.ts → chunk-XJHQPB3E.ts} +2 -2
  51. package/dist/chunks/{chunk-JY2RVOUL.ts → chunk-Y4UVXOLQ.ts} +5 -5
  52. package/dist/chunks/{chunk-ODF2M4RF.ts → chunk-ZC3IHFNM.ts} +8 -8
  53. package/dist/chunks/{chunk-ODF2M4RF.ts.map → chunk-ZC3IHFNM.ts.map} +2 -2
  54. package/dist/chunks/{chunk-M5IV3KL2.ts → chunk-ZDDBZH72.ts} +3 -3
  55. package/dist/chunks/{command-handler-FO6F2APH.ts → command-handler-VKLZBRLO.ts} +26 -21
  56. package/dist/chunks/command-handler-VKLZBRLO.ts.map +7 -0
  57. package/dist/chunks/{config-B37W7FXW.ts → config-HYG7G5EM.ts} +6 -4
  58. package/dist/chunks/{conflict-artifacts-6XGSSU5S.ts → conflict-artifacts-J6WSDCWP.ts} +12 -12
  59. package/dist/chunks/{conflict-review-BQSHSJB3.ts → conflict-review-GXA6Y7KY.ts} +23 -23
  60. package/dist/chunks/{continuous-record-4DQ2EAZS.ts → continuous-record-EPHGR2DU.ts} +6 -6
  61. package/dist/chunks/{continuous-sync-ZT3UEQLK.ts → continuous-sync-TTOSJCQU.ts} +18 -18
  62. package/dist/chunks/{file-selection-FBLKM25V.ts → file-selection-IELTXSGZ.ts} +6 -7
  63. package/dist/chunks/{file-selection-FBLKM25V.ts.map → file-selection-IELTXSGZ.ts.map} +1 -1
  64. package/dist/chunks/{git-backend-7PCWECRN.ts → git-backend-KHD36W27.ts} +6 -7
  65. package/dist/chunks/{git-backend-7PCWECRN.ts.map → git-backend-KHD36W27.ts.map} +1 -1
  66. package/dist/chunks/{local-fields-B6JWLPAE.ts → local-fields-JEKAPZKD.ts} +6 -7
  67. package/dist/chunks/manager-result-dispatcher-6W52NM7F.ts +32 -0
  68. package/dist/chunks/{manager-ui-DGRTG76I.ts → manager-ui-INVMAFEN.ts} +245 -224
  69. package/dist/chunks/manager-ui-INVMAFEN.ts.map +7 -0
  70. package/dist/chunks/{merge-baseline-store-HL3VLMAM.ts → merge-baseline-store-65GKUMXI.ts} +6 -6
  71. package/dist/chunks/{remote-selection-ui-OHMIQ32X.ts → remote-selection-ui-TD4C4W3J.ts} +16 -12
  72. package/dist/chunks/{s3-backend-CJXBEWWU.ts → s3-backend-L24UZ6IK.ts} +12 -10
  73. package/dist/chunks/s3-backend-L24UZ6IK.ts.map +7 -0
  74. package/dist/chunks/{setup-switch-66GWMBNH.ts → setup-switch-KLGESLQX.ts} +6 -6
  75. package/dist/chunks/{setup-wizard-OHZXJVQZ.ts → setup-wizard-ZQAK35BP.ts} +7 -7
  76. package/dist/chunks/{snapshot-VRHNAUUH.ts → snapshot-RGNDYT6A.ts} +5 -6
  77. package/dist/chunks/{snapshot-transaction-EUGA4VX6.ts → snapshot-transaction-26BQO36S.ts} +8 -8
  78. package/dist/chunks/{sync-inspection-4WFQEJOE.ts → sync-inspection-MOMLGUTD.ts} +11 -11
  79. package/dist/chunks/{sync-operations-X4AOXMBT.ts → sync-operations-TMGQHBF5.ts} +26 -26
  80. package/dist/chunks/{sync-operations-X4AOXMBT.ts.map → sync-operations-TMGQHBF5.ts.map} +2 -2
  81. package/dist/chunks/{sync-state-SWLSMK4G.ts → sync-state-7L4NT7W2.ts} +7 -8
  82. package/dist/chunks/{webdav-backend-2Q5ZEBST.ts → webdav-backend-3ZCACILP.ts} +7 -8
  83. package/dist/chunks/{webdav-backend-2Q5ZEBST.ts.map → webdav-backend-3ZCACILP.ts.map} +1 -1
  84. package/dist/index.ts +20 -20
  85. package/docs/agent-continuous-hardening.md +5 -5
  86. package/docs/agent-mode-verification.md +3 -3
  87. package/docs/agent-quality-verification.md +3 -3
  88. package/docs/continuous-sync-verification.md +2 -2
  89. package/docs/settings.md +9 -5
  90. package/docs/tui-contract.md +20 -3
  91. package/package.json +3 -3
  92. package/skills/configure-pi-sync/SKILL.md +3 -1
  93. package/skills/configure-pi-sync/references/configuration.md +56 -38
  94. package/src/backends/s3/s3-client.ts +8 -1
  95. package/src/commands/command-execution.ts +11 -6
  96. package/src/commands/command.ts +1 -1
  97. package/src/paths.ts +6 -1
  98. package/src/settings/config-file.ts +205 -118
  99. package/src/settings/config.ts +1 -1
  100. package/src/settings/settings-management.ts +15 -1
  101. package/src/settings/settings-store.ts +0 -14
  102. package/src/settings/settings-types.ts +1 -1
  103. package/src/snapshot/session-paths.ts +15 -2
  104. package/src/snapshot/snapshot-mutation-queues.ts +142 -0
  105. package/src/snapshot/snapshot-transaction.ts +122 -125
  106. package/src/sync/agent-candidate.ts +3 -3
  107. package/src/sync/agent-plan.ts +11 -8
  108. package/src/sync/agent-runner.ts +10 -9
  109. package/src/sync/agent-store.ts +1 -1
  110. package/src/sync/agent-sync.ts +2 -2
  111. package/src/sync/continuous-record.ts +1 -1
  112. package/src/sync/merge-apply.ts +6 -0
  113. package/src/sync/merged-sync.ts +4 -4
  114. package/src/sync/sync-mutations.ts +1 -1
  115. package/src/ui/agent-mode-setting.ts +6 -6
  116. package/src/ui/cancellable-operation.ts +36 -13
  117. package/src/ui/manager-state.ts +4 -2
  118. package/src/ui/manager-ui.ts +76 -24
  119. package/src/ui/remote-selection-ui.ts +131 -82
  120. package/src/ui/settings-ui.ts +21 -56
  121. package/src/ui/setup/setup-switcher.ts +2 -2
  122. package/src/ui/sync-setups-ui.ts +2 -2
  123. package/dist/chunks/agent-plan-KO43GTOR.ts.map +0 -7
  124. package/dist/chunks/agent-runner-WMSCKSCB.ts.map +0 -7
  125. package/dist/chunks/chunk-2VSN3MFX.ts.map +0 -7
  126. package/dist/chunks/chunk-AAPAHANE.ts.map +0 -7
  127. package/dist/chunks/chunk-BJXSCGQK.ts.map +0 -7
  128. package/dist/chunks/chunk-DO55XUNU.ts.map +0 -7
  129. package/dist/chunks/chunk-JXWTEJS5.ts.map +0 -7
  130. package/dist/chunks/chunk-RX3WGWVL.ts.map +0 -7
  131. package/dist/chunks/command-handler-FO6F2APH.ts.map +0 -7
  132. package/dist/chunks/manager-result-dispatcher-NODX3KKH.ts +0 -28
  133. package/dist/chunks/manager-ui-DGRTG76I.ts.map +0 -7
  134. package/dist/chunks/s3-backend-CJXBEWWU.ts.map +0 -7
  135. /package/dist/chunks/{agent-candidate-EYB35AGL.ts.map → agent-candidate-U2NU3GUX.ts.map} +0 -0
  136. /package/dist/chunks/{agent-refusal-retry-C2HQROTP.ts.map → agent-refusal-retry-476YGNU5.ts.map} +0 -0
  137. /package/dist/chunks/{agent-sync-VM3TXWA3.ts.map → agent-sync-P6AWQXGK.ts.map} +0 -0
  138. /package/dist/chunks/{chunk-DOJRPBQU.ts.map → chunk-5TSCBBPP.ts.map} +0 -0
  139. /package/dist/chunks/{chunk-CDQGSZL3.ts.map → chunk-6LD5KX55.ts.map} +0 -0
  140. /package/dist/chunks/{chunk-MDUORMCK.ts.map → chunk-6O3EDBRL.ts.map} +0 -0
  141. /package/dist/chunks/{chunk-STVQQ5KG.ts.map → chunk-7ZIYU5QS.ts.map} +0 -0
  142. /package/dist/chunks/{chunk-AO6EDUA6.ts.map → chunk-AKMV47YC.ts.map} +0 -0
  143. /package/dist/chunks/{chunk-66GAUVDL.ts.map → chunk-BEST45H2.ts.map} +0 -0
  144. /package/dist/chunks/{chunk-73MDIVYJ.ts.map → chunk-DN4IA7MR.ts.map} +0 -0
  145. /package/dist/chunks/{chunk-PHANBTVM.ts.map → chunk-ESKOPQVB.ts.map} +0 -0
  146. /package/dist/chunks/{chunk-MRIPZGPR.ts.map → chunk-FLHCOJCD.ts.map} +0 -0
  147. /package/dist/chunks/{chunk-5WJQ6XOW.ts.map → chunk-GNYGNHFF.ts.map} +0 -0
  148. /package/dist/chunks/{chunk-DFJGTVPX.ts.map → chunk-KYTT7KV4.ts.map} +0 -0
  149. /package/dist/chunks/{chunk-UGSSZWQ6.ts.map → chunk-MKSMJPVA.ts.map} +0 -0
  150. /package/dist/chunks/{chunk-RAMHGOX2.ts.map → chunk-OJARL2TG.ts.map} +0 -0
  151. /package/dist/chunks/{chunk-U77DWNRH.ts.map → chunk-Q23JJW7E.ts.map} +0 -0
  152. /package/dist/chunks/{chunk-QWV3XKNJ.ts.map → chunk-TIMWN2RH.ts.map} +0 -0
  153. /package/dist/chunks/{chunk-Z5O2TLNF.ts.map → chunk-TZC7GDJE.ts.map} +0 -0
  154. /package/dist/chunks/{chunk-UCD7TQDT.ts.map → chunk-U6GXGY5G.ts.map} +0 -0
  155. /package/dist/chunks/{chunk-PWA3YN5Z.ts.map → chunk-XEODG2PE.ts.map} +0 -0
  156. /package/dist/chunks/{chunk-TO2GMX3K.ts.map → chunk-XJHQPB3E.ts.map} +0 -0
  157. /package/dist/chunks/{chunk-JY2RVOUL.ts.map → chunk-Y4UVXOLQ.ts.map} +0 -0
  158. /package/dist/chunks/{chunk-M5IV3KL2.ts.map → chunk-ZDDBZH72.ts.map} +0 -0
  159. /package/dist/chunks/{config-B37W7FXW.ts.map → config-HYG7G5EM.ts.map} +0 -0
  160. /package/dist/chunks/{conflict-artifacts-6XGSSU5S.ts.map → conflict-artifacts-J6WSDCWP.ts.map} +0 -0
  161. /package/dist/chunks/{conflict-review-BQSHSJB3.ts.map → conflict-review-GXA6Y7KY.ts.map} +0 -0
  162. /package/dist/chunks/{continuous-record-4DQ2EAZS.ts.map → continuous-record-EPHGR2DU.ts.map} +0 -0
  163. /package/dist/chunks/{continuous-sync-ZT3UEQLK.ts.map → continuous-sync-TTOSJCQU.ts.map} +0 -0
  164. /package/dist/chunks/{local-fields-B6JWLPAE.ts.map → local-fields-JEKAPZKD.ts.map} +0 -0
  165. /package/dist/chunks/{manager-result-dispatcher-NODX3KKH.ts.map → manager-result-dispatcher-6W52NM7F.ts.map} +0 -0
  166. /package/dist/chunks/{merge-baseline-store-HL3VLMAM.ts.map → merge-baseline-store-65GKUMXI.ts.map} +0 -0
  167. /package/dist/chunks/{remote-selection-ui-OHMIQ32X.ts.map → remote-selection-ui-TD4C4W3J.ts.map} +0 -0
  168. /package/dist/chunks/{setup-switch-66GWMBNH.ts.map → setup-switch-KLGESLQX.ts.map} +0 -0
  169. /package/dist/chunks/{setup-wizard-OHZXJVQZ.ts.map → setup-wizard-ZQAK35BP.ts.map} +0 -0
  170. /package/dist/chunks/{snapshot-VRHNAUUH.ts.map → snapshot-RGNDYT6A.ts.map} +0 -0
  171. /package/dist/chunks/{snapshot-transaction-EUGA4VX6.ts.map → snapshot-transaction-26BQO36S.ts.map} +0 -0
  172. /package/dist/chunks/{sync-inspection-4WFQEJOE.ts.map → sync-inspection-MOMLGUTD.ts.map} +0 -0
  173. /package/dist/chunks/{sync-state-SWLSMK4G.ts.map → sync-state-7L4NT7W2.ts.map} +0 -0
@@ -27,7 +27,7 @@ function assertWithinRoot(root, target, label = target) {
27
27
  }
28
28
  }
29
29
  function encodeKey(key) {
30
- return key.split("/").map(encodeURIComponent).join("/");
30
+ return key.split("/").map(encodeURIComponent).join("/").replace(/[!'()*]/gu, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);
31
31
  }
32
32
  function posixJoin(...parts) {
33
33
  return parts.map((part) => trimSlashes(part)).filter(Boolean).join("/");
@@ -58,4 +58,4 @@ export {
58
58
  parentPaths,
59
59
  toPosix
60
60
  };
61
- //# sourceMappingURL=chunk-YZ5BQNRZ.ts.map
61
+ //# sourceMappingURL=chunk-FHE2DCA2.ts.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/paths.ts"],
4
- "sourcesContent": ["import path from \"node:path\";\n\nexport function isDeniedPath(relativePath: string) {\n const normalized = toPosix(relativePath);\n const lower = normalized.toLowerCase();\n const segments = lower.split(\"/\");\n const base = path.posix.basename(lower);\n return (\n segments.includes(\"node_modules\") ||\n segments.includes(\".git\") ||\n segments.includes(\".pisync\") ||\n segments.includes(\"pi-sync\") ||\n segments.includes(\".pi-sync-state-migration.lock\") ||\n base === \".env\" ||\n base.startsWith(\".env.\") ||\n base.endsWith(\".env\") ||\n base.includes(\"secret\") ||\n base.includes(\"token\") ||\n base === \"pi-sync.json\" ||\n base.startsWith(\"pi-sync.json.\") ||\n base.startsWith(\".pi-sync.json.\") ||\n base === \"pi-sync.local.json\" ||\n base.startsWith(\"pi-sync.local.json.\") ||\n base.startsWith(\".pi-sync.local.json.\")\n );\n}\n\nexport function isPathInside(parent: string, child: string) {\n const relative = path.relative(path.resolve(parent), path.resolve(child));\n return relative === \"\" || (!relative.startsWith(\"..\") && !path.isAbsolute(relative));\n}\n\nexport function safeJoin(root: string, relativePath: string) {\n const target = path.resolve(root, relativePath);\n assertWithinRoot(root, target, relativePath);\n return target;\n}\n\nexport function assertWithinRoot(root: string, target: string, label = target) {\n const resolvedRoot = path.resolve(root);\n const resolvedTarget = path.resolve(target);\n if (resolvedTarget !== resolvedRoot && !resolvedTarget.startsWith(`${resolvedRoot}${path.sep}`)) {\n throw new Error(`Unsafe path in snapshot: ${label}`);\n }\n}\n\nexport function encodeKey(key: string) {\n return key.split(\"/\").map(encodeURIComponent).join(\"/\");\n}\n\nexport function posixJoin(...parts: string[]) {\n return parts\n .map((part) => trimSlashes(part))\n .filter(Boolean)\n .join(\"/\");\n}\n\nexport function parentPaths(relativePath: string) {\n const results: string[] = [];\n let index = relativePath.lastIndexOf(\"/\");\n while (index > 0) {\n results.push(relativePath.slice(0, index));\n index = relativePath.lastIndexOf(\"/\", index - 1);\n }\n return results;\n}\n\nexport function toPosix(value: string) {\n return value.split(path.sep).join(\"/\");\n}\n\nfunction trimSlashes(value: string) {\n return value.replace(/^\\/+|\\/+$/g, \"\");\n}\n\nexport function safeName(value: string) {\n return value.replace(/[^A-Za-z0-9._-]/g, \"_\");\n}\n"],
5
- "mappings": ";;;;AAAA,OAAO,UAAU;AAEV,SAAS,aAAa,cAAsB;AACjD,QAAM,aAAa,QAAQ,YAAY;AACvC,QAAM,QAAQ,WAAW,YAAY;AACrC,QAAM,WAAW,MAAM,MAAM,GAAG;AAChC,QAAM,OAAO,KAAK,MAAM,SAAS,KAAK;AACtC,SACE,SAAS,SAAS,cAAc,KAChC,SAAS,SAAS,MAAM,KACxB,SAAS,SAAS,SAAS,KAC3B,SAAS,SAAS,SAAS,KAC3B,SAAS,SAAS,+BAA+B,KACjD,SAAS,UACT,KAAK,WAAW,OAAO,KACvB,KAAK,SAAS,MAAM,KACpB,KAAK,SAAS,QAAQ,KACtB,KAAK,SAAS,OAAO,KACrB,SAAS,kBACT,KAAK,WAAW,eAAe,KAC/B,KAAK,WAAW,gBAAgB,KAChC,SAAS,wBACT,KAAK,WAAW,qBAAqB,KACrC,KAAK,WAAW,sBAAsB;AAE1C;AAEO,SAAS,aAAa,QAAgB,OAAe;AAC1D,QAAM,WAAW,KAAK,SAAS,KAAK,QAAQ,MAAM,GAAG,KAAK,QAAQ,KAAK,CAAC;AACxE,SAAO,aAAa,MAAO,CAAC,SAAS,WAAW,IAAI,KAAK,CAAC,KAAK,WAAW,QAAQ;AACpF;AAEO,SAAS,SAAS,MAAc,cAAsB;AAC3D,QAAM,SAAS,KAAK,QAAQ,MAAM,YAAY;AAC9C,mBAAiB,MAAM,QAAQ,YAAY;AAC3C,SAAO;AACT;AAEO,SAAS,iBAAiB,MAAc,QAAgB,QAAQ,QAAQ;AAC7E,QAAM,eAAe,KAAK,QAAQ,IAAI;AACtC,QAAM,iBAAiB,KAAK,QAAQ,MAAM;AAC1C,MAAI,mBAAmB,gBAAgB,CAAC,eAAe,WAAW,GAAG,YAAY,GAAG,KAAK,GAAG,EAAE,GAAG;AAC/F,UAAM,IAAI,MAAM,4BAA4B,KAAK,EAAE;AAAA,EACrD;AACF;AAEO,SAAS,UAAU,KAAa;AACrC,SAAO,IAAI,MAAM,GAAG,EAAE,IAAI,kBAAkB,EAAE,KAAK,GAAG;AACxD;AAEO,SAAS,aAAa,OAAiB;AAC5C,SAAO,MACJ,IAAI,CAAC,SAAS,YAAY,IAAI,CAAC,EAC/B,OAAO,OAAO,EACd,KAAK,GAAG;AACb;AAEO,SAAS,YAAY,cAAsB;AAChD,QAAM,UAAoB,CAAC;AAC3B,MAAI,QAAQ,aAAa,YAAY,GAAG;AACxC,SAAO,QAAQ,GAAG;AAChB,YAAQ,KAAK,aAAa,MAAM,GAAG,KAAK,CAAC;AACzC,YAAQ,aAAa,YAAY,KAAK,QAAQ,CAAC;AAAA,EACjD;AACA,SAAO;AACT;AAEO,SAAS,QAAQ,OAAe;AACrC,SAAO,MAAM,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG;AACvC;AAEA,SAAS,YAAY,OAAe;AAClC,SAAO,MAAM,QAAQ,cAAc,EAAE;AACvC;",
4
+ "sourcesContent": ["import path from \"node:path\";\n\nexport function isDeniedPath(relativePath: string) {\n const normalized = toPosix(relativePath);\n const lower = normalized.toLowerCase();\n const segments = lower.split(\"/\");\n const base = path.posix.basename(lower);\n return (\n segments.includes(\"node_modules\") ||\n segments.includes(\".git\") ||\n segments.includes(\".pisync\") ||\n segments.includes(\"pi-sync\") ||\n segments.includes(\".pi-sync-state-migration.lock\") ||\n base === \".env\" ||\n base.startsWith(\".env.\") ||\n base.endsWith(\".env\") ||\n base.includes(\"secret\") ||\n base.includes(\"token\") ||\n base === \"pi-sync.json\" ||\n base.startsWith(\"pi-sync.json.\") ||\n base.startsWith(\".pi-sync.json.\") ||\n base === \"pi-sync.local.json\" ||\n base.startsWith(\"pi-sync.local.json.\") ||\n base.startsWith(\".pi-sync.local.json.\")\n );\n}\n\nexport function isPathInside(parent: string, child: string) {\n const relative = path.relative(path.resolve(parent), path.resolve(child));\n return relative === \"\" || (!relative.startsWith(\"..\") && !path.isAbsolute(relative));\n}\n\nexport function safeJoin(root: string, relativePath: string) {\n const target = path.resolve(root, relativePath);\n assertWithinRoot(root, target, relativePath);\n return target;\n}\n\nexport function assertWithinRoot(root: string, target: string, label = target) {\n const resolvedRoot = path.resolve(root);\n const resolvedTarget = path.resolve(target);\n if (resolvedTarget !== resolvedRoot && !resolvedTarget.startsWith(`${resolvedRoot}${path.sep}`)) {\n throw new Error(`Unsafe path in snapshot: ${label}`);\n }\n}\n\nexport function encodeKey(key: string) {\n // SigV4 permits only RFC 3986 unreserved characters and key separators.\n return key\n .split(\"/\")\n .map(encodeURIComponent)\n .join(\"/\")\n .replace(/[!'()*]/gu, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);\n}\n\nexport function posixJoin(...parts: string[]) {\n return parts\n .map((part) => trimSlashes(part))\n .filter(Boolean)\n .join(\"/\");\n}\n\nexport function parentPaths(relativePath: string) {\n const results: string[] = [];\n let index = relativePath.lastIndexOf(\"/\");\n while (index > 0) {\n results.push(relativePath.slice(0, index));\n index = relativePath.lastIndexOf(\"/\", index - 1);\n }\n return results;\n}\n\nexport function toPosix(value: string) {\n return value.split(path.sep).join(\"/\");\n}\n\nfunction trimSlashes(value: string) {\n return value.replace(/^\\/+|\\/+$/g, \"\");\n}\n\nexport function safeName(value: string) {\n return value.replace(/[^A-Za-z0-9._-]/g, \"_\");\n}\n"],
5
+ "mappings": ";;;;AAAA,OAAO,UAAU;AAEV,SAAS,aAAa,cAAsB;AACjD,QAAM,aAAa,QAAQ,YAAY;AACvC,QAAM,QAAQ,WAAW,YAAY;AACrC,QAAM,WAAW,MAAM,MAAM,GAAG;AAChC,QAAM,OAAO,KAAK,MAAM,SAAS,KAAK;AACtC,SACE,SAAS,SAAS,cAAc,KAChC,SAAS,SAAS,MAAM,KACxB,SAAS,SAAS,SAAS,KAC3B,SAAS,SAAS,SAAS,KAC3B,SAAS,SAAS,+BAA+B,KACjD,SAAS,UACT,KAAK,WAAW,OAAO,KACvB,KAAK,SAAS,MAAM,KACpB,KAAK,SAAS,QAAQ,KACtB,KAAK,SAAS,OAAO,KACrB,SAAS,kBACT,KAAK,WAAW,eAAe,KAC/B,KAAK,WAAW,gBAAgB,KAChC,SAAS,wBACT,KAAK,WAAW,qBAAqB,KACrC,KAAK,WAAW,sBAAsB;AAE1C;AAEO,SAAS,aAAa,QAAgB,OAAe;AAC1D,QAAM,WAAW,KAAK,SAAS,KAAK,QAAQ,MAAM,GAAG,KAAK,QAAQ,KAAK,CAAC;AACxE,SAAO,aAAa,MAAO,CAAC,SAAS,WAAW,IAAI,KAAK,CAAC,KAAK,WAAW,QAAQ;AACpF;AAEO,SAAS,SAAS,MAAc,cAAsB;AAC3D,QAAM,SAAS,KAAK,QAAQ,MAAM,YAAY;AAC9C,mBAAiB,MAAM,QAAQ,YAAY;AAC3C,SAAO;AACT;AAEO,SAAS,iBAAiB,MAAc,QAAgB,QAAQ,QAAQ;AAC7E,QAAM,eAAe,KAAK,QAAQ,IAAI;AACtC,QAAM,iBAAiB,KAAK,QAAQ,MAAM;AAC1C,MAAI,mBAAmB,gBAAgB,CAAC,eAAe,WAAW,GAAG,YAAY,GAAG,KAAK,GAAG,EAAE,GAAG;AAC/F,UAAM,IAAI,MAAM,4BAA4B,KAAK,EAAE;AAAA,EACrD;AACF;AAEO,SAAS,UAAU,KAAa;AAErC,SAAO,IACJ,MAAM,GAAG,EACT,IAAI,kBAAkB,EACtB,KAAK,GAAG,EACR,QAAQ,aAAa,CAAC,cAAc,IAAI,UAAU,WAAW,CAAC,EAAE,SAAS,EAAE,EAAE,YAAY,CAAC,EAAE;AACjG;AAEO,SAAS,aAAa,OAAiB;AAC5C,SAAO,MACJ,IAAI,CAAC,SAAS,YAAY,IAAI,CAAC,EAC/B,OAAO,OAAO,EACd,KAAK,GAAG;AACb;AAEO,SAAS,YAAY,cAAsB;AAChD,QAAM,UAAoB,CAAC;AAC3B,MAAI,QAAQ,aAAa,YAAY,GAAG;AACxC,SAAO,QAAQ,GAAG;AAChB,YAAQ,KAAK,aAAa,MAAM,GAAG,KAAK,CAAC;AACzC,YAAQ,aAAa,YAAY,KAAK,QAAQ,CAAC;AAAA,EACjD;AACA,SAAO;AACT;AAEO,SAAS,QAAQ,OAAe;AACrC,SAAO,MAAM,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG;AACvC;AAEA,SAAS,YAAY,OAAe;AAClC,SAAO,MAAM,QAAQ,cAAc,EAAE;AACvC;",
6
6
  "names": []
7
7
  }
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-PWMWOJP4.ts";
6
6
  import {
7
7
  snapshotSelectionInclude
8
- } from "./chunk-DFJGTVPX.ts";
8
+ } from "./chunk-KYTT7KV4.ts";
9
9
 
10
10
  // src/snapshot/snapshot-codec.ts
11
11
  import { Readable, Writable } from "node:stream";
@@ -42,7 +42,7 @@ async function decodeSnapshot(buffer, options = {}) {
42
42
  throw new Error("Unsupported snapshot format.");
43
43
  }
44
44
  if (parsed.version === 2 || parsed.version === 3) {
45
- const { normalizeLocalFields, validatePortableSnapshot } = await import("./local-fields-B6JWLPAE.ts");
45
+ const { normalizeLocalFields, validatePortableSnapshot } = await import("./local-fields-JEKAPZKD.ts");
46
46
  validatePortableSnapshot(parsed);
47
47
  if (parsed.localFields !== void 0) parsed.localFields = normalizeLocalFields(parsed.localFields);
48
48
  } else if (parsed.localFields !== void 0) throw new Error("Portable field policy requires snapshot version 2.");
@@ -54,4 +54,4 @@ export {
54
54
  encodeSnapshot,
55
55
  decodeSnapshot
56
56
  };
57
- //# sourceMappingURL=chunk-MRIPZGPR.ts.map
57
+ //# sourceMappingURL=chunk-FLHCOJCD.ts.map
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-PWMWOJP4.ts";
6
6
  import {
7
7
  agentDir
8
- } from "./chunk-DO55XUNU.ts";
8
+ } from "./chunk-CBLTWXAU.ts";
9
9
 
10
10
  // src/sync/mutation-owner.ts
11
11
  function captureMutationOwner(ctx, signal) {
@@ -24,4 +24,4 @@ function captureMutationOwner(ctx, signal) {
24
24
  export {
25
25
  captureMutationOwner
26
26
  };
27
- //# sourceMappingURL=chunk-5WJQ6XOW.ts.map
27
+ //# sourceMappingURL=chunk-GNYGNHFF.ts.map
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  isDeniedPath,
5
5
  toPosix
6
- } from "./chunk-YZ5BQNRZ.ts";
6
+ } from "./chunk-FHE2DCA2.ts";
7
7
 
8
8
  // src/sync/sync-policy.ts
9
9
  import path from "node:path";
@@ -316,4 +316,4 @@ export {
316
316
  normalizeSyncFiles,
317
317
  normalizeExtraFiles
318
318
  };
319
- //# sourceMappingURL=chunk-DFJGTVPX.ts.map
319
+ //# sourceMappingURL=chunk-KYTT7KV4.ts.map
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-ZW5ZLGBI.ts";
11
11
  import {
12
12
  regenerateSnapshotIdentity
13
- } from "./chunk-PHANBTVM.ts";
13
+ } from "./chunk-ESKOPQVB.ts";
14
14
 
15
15
  // src/sync/local-fields.ts
16
16
  import { createHash } from "node:crypto";
@@ -104,4 +104,4 @@ export {
104
104
  portableSnapshot,
105
105
  overlayLocalFields
106
106
  };
107
- //# sourceMappingURL=chunk-UGSSZWQ6.ts.map
107
+ //# sourceMappingURL=chunk-MKSMJPVA.ts.map
@@ -6,46 +6,46 @@ import {
6
6
  conflictGroups,
7
7
  readConflictArtifact,
8
8
  saveConflictArtifact
9
- } from "./chunk-DOJRPBQU.ts";
9
+ } from "./chunk-5TSCBBPP.ts";
10
10
  import {
11
11
  clearMergeJournal,
12
12
  mergeJournalIdentity,
13
13
  readMergeJournal,
14
14
  writeMergeJournal
15
- } from "./chunk-66GAUVDL.ts";
15
+ } from "./chunk-BEST45H2.ts";
16
16
  import {
17
17
  fileHashMap,
18
18
  hasLocalChanges,
19
19
  hasRemoteChanges,
20
20
  sameHashes,
21
21
  syncPolicyChanged
22
- } from "./chunk-JY2RVOUL.ts";
22
+ } from "./chunk-Y4UVXOLQ.ts";
23
23
  import {
24
24
  formatRemoteSelectionStatus,
25
25
  readSnapshotForHead,
26
26
  requireCompatibleRemoteSelection
27
- } from "./chunk-QWV3XKNJ.ts";
27
+ } from "./chunk-TIMWN2RH.ts";
28
28
  import {
29
29
  createSyncBackend
30
- } from "./chunk-RAMHGOX2.ts";
30
+ } from "./chunk-OJARL2TG.ts";
31
31
  import {
32
32
  confirmMergeReview
33
33
  } from "./chunk-KHBPED6W.ts";
34
34
  import {
35
35
  backupLocal,
36
36
  protectedSessionPaths
37
- } from "./chunk-Z5O2TLNF.ts";
37
+ } from "./chunk-TZC7GDJE.ts";
38
38
  import {
39
39
  overlayLocalFields,
40
40
  portableSnapshot,
41
41
  sameLocalFields
42
- } from "./chunk-UGSSZWQ6.ts";
42
+ } from "./chunk-MKSMJPVA.ts";
43
43
  import {
44
44
  createStartupTimings
45
45
  } from "./chunk-M6VQJIOU.ts";
46
46
  import {
47
47
  captureMutationOwner
48
- } from "./chunk-5WJQ6XOW.ts";
48
+ } from "./chunk-GNYGNHFF.ts";
49
49
  import {
50
50
  safeTerminalText,
51
51
  snapshotPathLabel
@@ -57,17 +57,18 @@ import {
57
57
  loadConfig,
58
58
  syncCheckConfigFingerprint,
59
59
  syncConfigReviewIdentity
60
- } from "./chunk-RX3WGWVL.ts";
60
+ } from "./chunk-OVBAW7KV.ts";
61
61
  import {
62
62
  applySnapshotTransaction,
63
+ assertCanonicalMutationTargets,
63
64
  recoverPendingSnapshotTransactions,
64
65
  syncMutationParents
65
- } from "./chunk-AAPAHANE.ts";
66
+ } from "./chunk-7A35ZAVO.ts";
66
67
  import {
67
68
  mergeAcceptedSettingsPackages,
68
69
  mergeSettingsJson,
69
70
  resolveContentConflicts
70
- } from "./chunk-AO6EDUA6.ts";
71
+ } from "./chunk-AKMV47YC.ts";
71
72
  import {
72
73
  TEXT_MERGE_WORK_LIMIT,
73
74
  hasCurrentMergeBaseline,
@@ -75,17 +76,20 @@ import {
75
76
  readMergeAncestor,
76
77
  readMergeAncestors,
77
78
  stageMergeBaseline
78
- } from "./chunk-CDQGSZL3.ts";
79
+ } from "./chunk-6LD5KX55.ts";
79
80
  import {
80
81
  mergePathIdentity,
81
82
  planFileMerge
82
- } from "./chunk-TO2GMX3K.ts";
83
+ } from "./chunk-XJHQPB3E.ts";
83
84
  import {
84
85
  readStateForConfig,
85
86
  statePathForConfig,
86
87
  syncStateFingerprint,
87
88
  writeStateForConfig
88
- } from "./chunk-73MDIVYJ.ts";
89
+ } from "./chunk-DN4IA7MR.ts";
90
+ import {
91
+ syncDirectory
92
+ } from "./chunk-AR2DGDUI.ts";
89
93
  import {
90
94
  createSnapshot,
91
95
  filterSnapshotForConfigPolicy,
@@ -96,21 +100,18 @@ import {
96
100
  scanSnapshot,
97
101
  snapshotIncludesSessions,
98
102
  snapshotTarget
99
- } from "./chunk-PHANBTVM.ts";
103
+ } from "./chunk-ESKOPQVB.ts";
100
104
  import {
101
105
  includeFromSelectionConfig,
102
106
  inspectRemoteSelection
103
- } from "./chunk-DFJGTVPX.ts";
107
+ } from "./chunk-KYTT7KV4.ts";
104
108
  import {
105
109
  agentDir,
106
110
  effectiveSessionRoot,
107
111
  requireStableMergeSessionRoot,
108
112
  sessionStorageRoot,
109
113
  snapshotOptionsForContext
110
- } from "./chunk-DO55XUNU.ts";
111
- import {
112
- syncDirectory
113
- } from "./chunk-AR2DGDUI.ts";
114
+ } from "./chunk-CBLTWXAU.ts";
114
115
  import {
115
116
  assertWithinRoot,
116
117
  isDeniedPath,
@@ -118,7 +119,7 @@ import {
118
119
  parentPaths,
119
120
  safeJoin,
120
121
  toPosix
121
- } from "./chunk-YZ5BQNRZ.ts";
122
+ } from "./chunk-FHE2DCA2.ts";
122
123
  import {
123
124
  ContinuousError
124
125
  } from "./chunk-DT7M4VQS.ts";
@@ -614,6 +615,10 @@ async function preflightMergedTargets(before, after, options, protectedTarget) {
614
615
  for (const relative of paths) {
615
616
  if (changed.has(relative)) await assertFilesystemTarget(root, relative, options, removedTargets, beforeHashes);
616
617
  }
618
+ await assertCanonicalMutationTargets(
619
+ [...changed].map((relative) => snapshotTarget(root, relative, options.sessionDir)),
620
+ options
621
+ );
617
622
  }
618
623
  function replacementPaths(removed, afterHashes) {
619
624
  for (const relative of [...removed]) {
@@ -764,6 +769,7 @@ async function applyMergedSnapshot(before, after, protectedPaths, options, valid
764
769
  protectedTarget,
765
770
  new Set(Object.keys(afterHashes))
766
771
  );
772
+ await assertCanonicalMutationTargets(targets, options);
767
773
  const targetsByQueue = /* @__PURE__ */ new Map();
768
774
  const queueTargets = [];
769
775
  const deferredTargets = [];
@@ -1270,7 +1276,7 @@ async function mergeSync(ctx, options, factory = createSyncBackend, resolution)
1270
1276
  };
1271
1277
  const validateRetryAuthorization = (config2) => {
1272
1278
  if (options.agentRetryRefusal && (!config2.agentMode || options.auto || options.background || !ctx.hasUI || !["tui", "rpc"].includes(ctx.mode)))
1273
- throw new Error("Refused-candidate retry requires foreground Agent mode in TUI or RPC.");
1279
+ throw new Error("Refused-candidate retry requires foreground Autonomous sync in TUI or RPC.");
1274
1280
  };
1275
1281
  const config = await loadConfig(options.setup);
1276
1282
  validateOwner(config);
@@ -1298,7 +1304,7 @@ async function mergeSync(ctx, options, factory = createSyncBackend, resolution)
1298
1304
  throw new Error("Session storage root changed during transfer; evidence retained for review.");
1299
1305
  }
1300
1306
  if (config.agentMode && JSON.stringify(ctx.model) !== modelToken)
1301
- throw new Error("Agent mode paused: selected model changed during transfer.");
1307
+ throw new Error("Autonomous sync paused: selected model changed during transfer.");
1302
1308
  if (options.auto && (!startupTransferEnabled(latest) || !ctx.isIdle()))
1303
1309
  throw new Error("Automatic transfer is no longer authorized at this idle boundary.");
1304
1310
  });
@@ -1338,7 +1344,7 @@ async function mergeSync(ctx, options, factory = createSyncBackend, resolution)
1338
1344
  }
1339
1345
  if ((options.auto || config.agentMode) && backend.capability === "read-check-write-verify") {
1340
1346
  throw new Error(
1341
- "Automatic transfer requires conditional publication or a lease; this backend supports only read/check/write/verify. Disable Agent mode and use manual sync."
1347
+ "Automatic transfer requires conditional publication or a lease; this backend supports only read/check/write/verify. Disable Autonomous sync and use manual sync."
1342
1348
  );
1343
1349
  }
1344
1350
  const textBudget = { remaining: TEXT_MERGE_WORK_LIMIT };
@@ -1475,7 +1481,7 @@ async function mergeSync(ctx, options, factory = createSyncBackend, resolution)
1475
1481
  await validate();
1476
1482
  }
1477
1483
  if (config.agentMode && !resolution) {
1478
- const { resolveAgentPlan } = await import("./agent-plan-KO43GTOR.ts");
1484
+ const { resolveAgentPlan } = await import("./agent-plan-3YXDIJXO.ts");
1479
1485
  await validate();
1480
1486
  plan = await resolveAgentPlan(
1481
1487
  ctx,
@@ -1495,7 +1501,7 @@ async function mergeSync(ctx, options, factory = createSyncBackend, resolution)
1495
1501
  if (plan.kind !== "planned" || plan.conflicts.length && !config.partialSync)
1496
1502
  throw new ContinuousError(
1497
1503
  "unsafe",
1498
- "Agent mode paused: unsupported or refused conflict groups remain; no transfer was performed."
1504
+ "Autonomous sync paused: unsupported or refused conflict groups remain; no transfer was performed."
1499
1505
  );
1500
1506
  }
1501
1507
  if (plan.kind !== "planned" || plan.conflicts.length && (!config.partialSync || options.auto && !config.agentMode)) {
@@ -1985,4 +1991,4 @@ export {
1985
1991
  createSyncDecision,
1986
1992
  mergeSync
1987
1993
  };
1988
- //# sourceMappingURL=chunk-2VSN3MFX.ts.map
1994
+ //# sourceMappingURL=chunk-MMQIEDZ6.ts.map