@narumitw/pi-sync 0.59.0 → 0.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +19 -10
  3. package/dist/chunks/{chunk-AMJRUXFT.ts → chunk-2JNFEZ3V.ts} +2 -6
  4. package/dist/chunks/{chunk-AMJRUXFT.ts.map → chunk-2JNFEZ3V.ts.map} +1 -1
  5. package/dist/chunks/{chunk-NGW4JMBF.ts → chunk-4RNCZZY7.ts} +33 -27
  6. package/dist/chunks/{chunk-NGW4JMBF.ts.map → chunk-4RNCZZY7.ts.map} +3 -3
  7. package/dist/chunks/{config-J5VZUY4J.ts → chunk-7AC2RX4M.ts} +6 -13
  8. package/dist/chunks/chunk-7AC2RX4M.ts.map +7 -0
  9. package/dist/chunks/{chunk-76HID27T.ts → chunk-BGGKHHO4.ts} +18 -14
  10. package/dist/chunks/{chunk-76HID27T.ts.map → chunk-BGGKHHO4.ts.map} +1 -1
  11. package/dist/chunks/chunk-BWWTOQOW.ts +737 -0
  12. package/dist/chunks/chunk-BWWTOQOW.ts.map +7 -0
  13. package/dist/chunks/chunk-CEMFCWIU.ts +20 -0
  14. package/dist/chunks/chunk-CEMFCWIU.ts.map +7 -0
  15. package/dist/chunks/chunk-CZNBKIM5.ts +20 -0
  16. package/dist/chunks/chunk-CZNBKIM5.ts.map +7 -0
  17. package/dist/chunks/{chunk-YIPK23JW.ts → chunk-ENFHHB5O.ts} +1 -16
  18. package/dist/chunks/{chunk-YIPK23JW.ts.map → chunk-ENFHHB5O.ts.map} +1 -1
  19. package/dist/chunks/{chunk-KHBPED6W.ts → chunk-GSQGBVKG.ts} +2 -2
  20. package/dist/chunks/chunk-HNKLBM3U.ts +18 -0
  21. package/dist/chunks/chunk-HNKLBM3U.ts.map +7 -0
  22. package/dist/chunks/{chunk-QPC5HT3A.ts → chunk-J5COV5TY.ts} +21 -2
  23. package/dist/chunks/chunk-J5COV5TY.ts.map +7 -0
  24. package/dist/chunks/chunk-JKBUYCPC.ts +52 -0
  25. package/dist/chunks/chunk-JKBUYCPC.ts.map +7 -0
  26. package/dist/chunks/chunk-JZKCOM62.ts +26 -0
  27. package/dist/chunks/chunk-JZKCOM62.ts.map +7 -0
  28. package/dist/chunks/chunk-M7RHV3H6.ts +33 -0
  29. package/dist/chunks/chunk-M7RHV3H6.ts.map +7 -0
  30. package/dist/chunks/{chunk-2ZZJXITS.ts → chunk-MIXZVHFR.ts} +24 -10
  31. package/dist/chunks/chunk-MIXZVHFR.ts.map +7 -0
  32. package/dist/chunks/chunk-NPT2G4FU.ts +15 -0
  33. package/dist/chunks/chunk-NPT2G4FU.ts.map +7 -0
  34. package/dist/chunks/chunk-PDBTD2K6.ts +11 -0
  35. package/dist/chunks/chunk-PDBTD2K6.ts.map +7 -0
  36. package/dist/chunks/chunk-UBE6XWOM.ts +29 -0
  37. package/dist/chunks/chunk-UBE6XWOM.ts.map +7 -0
  38. package/dist/chunks/{chunk-PQ75RPUP.ts → chunk-UZUUUY7C.ts} +8 -8
  39. package/dist/chunks/chunk-VZCWYXRS.ts +23 -0
  40. package/dist/chunks/chunk-VZCWYXRS.ts.map +7 -0
  41. package/dist/chunks/{chunk-DTPELCPW.ts → chunk-YWEYRRQI.ts} +45 -37
  42. package/dist/chunks/chunk-YWEYRRQI.ts.map +7 -0
  43. package/dist/chunks/{chunk-ECYCNZOE.ts → chunk-ZMNVNECV.ts} +5 -1
  44. package/dist/chunks/chunk-ZMNVNECV.ts.map +7 -0
  45. package/dist/chunks/{command-handler-SDGKIQH2.ts → command-handler-3O76V7Q5.ts} +80 -86
  46. package/dist/chunks/command-handler-3O76V7Q5.ts.map +7 -0
  47. package/dist/chunks/conflict-review-XBSME2ER.ts +18 -0
  48. package/dist/chunks/conflict-review-XBSME2ER.ts.map +7 -0
  49. package/dist/chunks/{continuous-record-OM64J27R.ts → continuous-record-ZHUXVO4E.ts} +5 -13
  50. package/dist/chunks/continuous-record-ZHUXVO4E.ts.map +7 -0
  51. package/dist/chunks/{file-selection-7HEVPO4T.ts → file-selection-S6CNNNQI.ts} +11 -14
  52. package/dist/chunks/{file-selection-7HEVPO4T.ts.map → file-selection-S6CNNNQI.ts.map} +1 -1
  53. package/dist/chunks/manager-result-dispatcher-I2AMCCE7.ts +18 -0
  54. package/dist/chunks/{manager-ui-65ZETN6F.ts → manager-ui-SJOBTJLY.ts} +80 -123
  55. package/dist/chunks/manager-ui-SJOBTJLY.ts.map +7 -0
  56. package/dist/chunks/merge-review-SGDLMVS4.ts +10 -0
  57. package/dist/chunks/remote-selection-ui-GZHPDQ4L.ts +17 -0
  58. package/dist/chunks/{setup-switch-AB27ADDI.ts → setup-switch-M3BAFGJM.ts} +9 -13
  59. package/dist/chunks/{setup-wizard-5FILKFLQ.ts → setup-wizard-NFAWP4KF.ts} +18 -21
  60. package/dist/chunks/{setup-wizard-5FILKFLQ.ts.map → setup-wizard-NFAWP4KF.ts.map} +1 -1
  61. package/dist/chunks/{snapshot-G3W2GOGB.ts → snapshot-D4SFDP5J.ts} +8 -13
  62. package/dist/chunks/snapshot-D4SFDP5J.ts.map +7 -0
  63. package/dist/chunks/snapshot-transaction-directory-TNKBQ3UQ.ts +13 -0
  64. package/dist/chunks/snapshot-transaction-directory-TNKBQ3UQ.ts.map +7 -0
  65. package/dist/chunks/state-directory-JZSZVVPX.ts +17 -0
  66. package/dist/chunks/sync-inspection-BJ4KPPNO.ts +23 -0
  67. package/dist/chunks/sync-inspection-BJ4KPPNO.ts.map +7 -0
  68. package/dist/chunks/sync-operations-TLWER2TT.ts +45 -0
  69. package/dist/chunks/sync-operations-TLWER2TT.ts.map +7 -0
  70. package/dist/chunks/{sync-state-H4TFZZ7S.ts → sync-state-FVCJJ7MY.ts} +5 -11
  71. package/dist/chunks/sync-state-FVCJJ7MY.ts.map +7 -0
  72. package/dist/index.ts +269 -313
  73. package/dist/index.ts.map +4 -4
  74. package/docs/daemon-migration.md +93 -0
  75. package/package.json +3 -6
  76. package/skills/configure-pi-sync/SKILL.md +1 -1
  77. package/skills/configure-pi-sync/references/configuration.md +19 -6
  78. package/src/backends/backend-factory.ts +2 -23
  79. package/src/backends/backend-identity.ts +5 -40
  80. package/src/backends/backend-types.ts +1 -81
  81. package/src/backends/git/git-backend.ts +6 -784
  82. package/src/backends/git/git-config.ts +8 -130
  83. package/src/backends/git/git-runner.ts +7 -255
  84. package/src/backends/git/git-storage.ts +14 -293
  85. package/src/backends/s3/s3-backend.ts +11 -523
  86. package/src/backends/s3/s3-client.ts +2 -399
  87. package/src/backends/s3/s3-conditions.ts +2 -67
  88. package/src/backends/snapshot-pointer.ts +2 -27
  89. package/src/backends/sync-backend.ts +6 -101
  90. package/src/backends/webdav/webdav-backend.ts +10 -622
  91. package/src/backends/webdav/webdav-client.ts +6 -370
  92. package/src/backends/webdav/webdav-config.ts +8 -82
  93. package/src/commands/command-execution.ts +40 -36
  94. package/src/commands/command.ts +23 -1
  95. package/src/daemon/apply-gate.ts +146 -0
  96. package/src/daemon/pi-client.ts +591 -0
  97. package/src/daemon/recovery.ts +103 -0
  98. package/src/paths.ts +12 -83
  99. package/src/settings/config-errors.ts +2 -6
  100. package/src/settings/config-file.ts +19 -693
  101. package/src/settings/config.ts +16 -263
  102. package/src/settings/settings-management.ts +11 -254
  103. package/src/settings/settings-store.ts +10 -48
  104. package/src/settings/settings-types.ts +1 -157
  105. package/src/settings/settings-validation.ts +17 -435
  106. package/src/snapshot/session-paths.ts +11 -111
  107. package/src/snapshot/snapshot-apply.ts +9 -322
  108. package/src/snapshot/snapshot-case-replacement.ts +6 -80
  109. package/src/snapshot/snapshot-codec.ts +2 -59
  110. package/src/snapshot/snapshot-exclude-safety.ts +2 -44
  111. package/src/snapshot/snapshot-mutation-queues.ts +6 -142
  112. package/src/snapshot/snapshot-paths.ts +2 -11
  113. package/src/snapshot/snapshot-root-transition.ts +6 -154
  114. package/src/snapshot/snapshot-transaction-directory.ts +5 -16
  115. package/src/snapshot/snapshot-transaction-plan.ts +2 -72
  116. package/src/snapshot/snapshot-transaction.ts +6 -946
  117. package/src/snapshot/snapshot-types.ts +1 -43
  118. package/src/snapshot/snapshot.ts +19 -447
  119. package/src/state/json-file.ts +2 -47
  120. package/src/state/lock-policy.ts +2 -2
  121. package/src/state/lock.ts +10 -292
  122. package/src/state/lockfile-fs.ts +2 -25
  123. package/src/state/merge-baseline-store.ts +8 -208
  124. package/src/state/mutation-directory-sync.ts +2 -34
  125. package/src/state/operation-availability.ts +7 -59
  126. package/src/state/state-directory.ts +8 -243
  127. package/src/state/state-types.ts +1 -25
  128. package/src/state/sync-state-store.ts +11 -75
  129. package/src/sync/agent-candidate.ts +7 -256
  130. package/src/sync/agent-plan.ts +2 -107
  131. package/src/sync/agent-policy.ts +10 -13
  132. package/src/sync/agent-refusal-retry.ts +2 -54
  133. package/src/sync/agent-request.ts +2 -19
  134. package/src/sync/agent-runner.ts +2 -191
  135. package/src/sync/agent-store.ts +7 -182
  136. package/src/sync/agent-sync.ts +2 -141
  137. package/src/sync/apply-review.ts +2 -63
  138. package/src/sync/automatic-sync.ts +55 -111
  139. package/src/sync/conflict-artifact-ownership.ts +2 -63
  140. package/src/sync/conflict-artifacts.ts +8 -195
  141. package/src/sync/conflict-groups.ts +2 -68
  142. package/src/sync/conflict-preview.ts +2 -56
  143. package/src/sync/conflict-resolution.ts +2 -93
  144. package/src/sync/conflict-retention.ts +2 -72
  145. package/src/sync/conflict-review.ts +3 -92
  146. package/src/sync/content-conflicts.ts +2 -73
  147. package/src/sync/continuous-errors.ts +7 -85
  148. package/src/sync/continuous-lease.ts +2 -216
  149. package/src/sync/continuous-record.ts +10 -261
  150. package/src/sync/continuous-storage.ts +12 -64
  151. package/src/sync/continuous-sync.ts +2 -563
  152. package/src/sync/continuous-watch.ts +2 -61
  153. package/src/sync/exclude-policy.ts +6 -84
  154. package/src/sync/field-migration.ts +2 -39
  155. package/src/sync/file-merge-planner.ts +2 -143
  156. package/src/sync/json-document.ts +7 -184
  157. package/src/sync/local-field-policy.ts +2 -29
  158. package/src/sync/local-fields.ts +9 -119
  159. package/src/sync/merge-apply.ts +2 -439
  160. package/src/sync/merge-journal.ts +10 -228
  161. package/src/sync/merge-transfer-error.ts +2 -72
  162. package/src/sync/merged-sync.ts +2 -919
  163. package/src/sync/mutation-owner.ts +2 -22
  164. package/src/sync/package-merge.ts +2 -87
  165. package/src/sync/partial-progress.ts +2 -55
  166. package/src/sync/remote-snapshot.ts +7 -79
  167. package/src/sync/session-merge.ts +2 -194
  168. package/src/sync/settings-conflicts.ts +2 -64
  169. package/src/sync/settings-merge.ts +6 -121
  170. package/src/sync/signals.ts +2 -8
  171. package/src/sync/startup-check.ts +15 -31
  172. package/src/sync/startup-timings.ts +2 -94
  173. package/src/sync/sync-decision.ts +3 -111
  174. package/src/sync/sync-error-guidance.ts +2 -46
  175. package/src/sync/sync-errors.ts +7 -23
  176. package/src/sync/sync-inspection.ts +10 -59
  177. package/src/sync/sync-local.ts +2 -44
  178. package/src/sync/sync-mutations.ts +10 -788
  179. package/src/sync/sync-operations.ts +32 -11
  180. package/src/sync/sync-policy.ts +34 -474
  181. package/src/sync/sync-queries.ts +2 -247
  182. package/src/sync/sync-state.ts +18 -157
  183. package/src/sync/text-merge.ts +10 -133
  184. package/src/sync-extension.ts +192 -142
  185. package/dist/chunks/agent-candidate-ZHN7FTZT.ts +0 -30
  186. package/dist/chunks/agent-plan-ILFEUJ2E.ts +0 -124
  187. package/dist/chunks/agent-plan-ILFEUJ2E.ts.map +0 -7
  188. package/dist/chunks/agent-refusal-retry-HRMHCX2A.ts +0 -73
  189. package/dist/chunks/agent-refusal-retry-HRMHCX2A.ts.map +0 -7
  190. package/dist/chunks/agent-runner-FCRV2Z75.ts +0 -185
  191. package/dist/chunks/agent-runner-FCRV2Z75.ts.map +0 -7
  192. package/dist/chunks/agent-store-CCKN4DPR.ts +0 -175
  193. package/dist/chunks/agent-store-CCKN4DPR.ts.map +0 -7
  194. package/dist/chunks/agent-sync-EGA2I5W7.ts +0 -22
  195. package/dist/chunks/chunk-25QCU3LY.ts +0 -220
  196. package/dist/chunks/chunk-25QCU3LY.ts.map +0 -7
  197. package/dist/chunks/chunk-2JZFHNLM.ts +0 -113
  198. package/dist/chunks/chunk-2JZFHNLM.ts.map +0 -7
  199. package/dist/chunks/chunk-2UKUKIBI.ts +0 -25
  200. package/dist/chunks/chunk-2UKUKIBI.ts.map +0 -7
  201. package/dist/chunks/chunk-2ZZJXITS.ts.map +0 -7
  202. package/dist/chunks/chunk-3JTZF7Z5.ts +0 -77
  203. package/dist/chunks/chunk-3JTZF7Z5.ts.map +0 -7
  204. package/dist/chunks/chunk-3ST7RSYN.ts +0 -21
  205. package/dist/chunks/chunk-3ST7RSYN.ts.map +0 -7
  206. package/dist/chunks/chunk-4NVHHDN2.ts +0 -61
  207. package/dist/chunks/chunk-4NVHHDN2.ts.map +0 -7
  208. package/dist/chunks/chunk-5SFMBY5P.ts +0 -26
  209. package/dist/chunks/chunk-5SFMBY5P.ts.map +0 -7
  210. package/dist/chunks/chunk-6OFMB6KK.ts +0 -215
  211. package/dist/chunks/chunk-6OFMB6KK.ts.map +0 -7
  212. package/dist/chunks/chunk-6XU5HZAN.ts +0 -205
  213. package/dist/chunks/chunk-6XU5HZAN.ts.map +0 -7
  214. package/dist/chunks/chunk-6YGRZSCN.ts +0 -128
  215. package/dist/chunks/chunk-6YGRZSCN.ts.map +0 -7
  216. package/dist/chunks/chunk-7D5SF7P3.ts +0 -29
  217. package/dist/chunks/chunk-7D5SF7P3.ts.map +0 -7
  218. package/dist/chunks/chunk-7WYF2KUO.ts +0 -1161
  219. package/dist/chunks/chunk-7WYF2KUO.ts.map +0 -7
  220. package/dist/chunks/chunk-APDNHB2T.ts +0 -2037
  221. package/dist/chunks/chunk-APDNHB2T.ts.map +0 -7
  222. package/dist/chunks/chunk-AR2DGDUI.ts +0 -55
  223. package/dist/chunks/chunk-AR2DGDUI.ts.map +0 -7
  224. package/dist/chunks/chunk-DT7M4VQS.ts +0 -69
  225. package/dist/chunks/chunk-DT7M4VQS.ts.map +0 -7
  226. package/dist/chunks/chunk-DTPELCPW.ts.map +0 -7
  227. package/dist/chunks/chunk-ECYCNZOE.ts.map +0 -7
  228. package/dist/chunks/chunk-FHE2DCA2.ts +0 -61
  229. package/dist/chunks/chunk-FHE2DCA2.ts.map +0 -7
  230. package/dist/chunks/chunk-G4RUXRWZ.ts +0 -48
  231. package/dist/chunks/chunk-G4RUXRWZ.ts.map +0 -7
  232. package/dist/chunks/chunk-ILXMZ2HU.ts +0 -58
  233. package/dist/chunks/chunk-ILXMZ2HU.ts.map +0 -7
  234. package/dist/chunks/chunk-LA3HQMFG.ts +0 -115
  235. package/dist/chunks/chunk-LA3HQMFG.ts.map +0 -7
  236. package/dist/chunks/chunk-M6VQJIOU.ts +0 -54
  237. package/dist/chunks/chunk-M6VQJIOU.ts.map +0 -7
  238. package/dist/chunks/chunk-MKC3PXCN.ts +0 -369
  239. package/dist/chunks/chunk-MKC3PXCN.ts.map +0 -7
  240. package/dist/chunks/chunk-OQBE2OMB.ts +0 -88
  241. package/dist/chunks/chunk-OQBE2OMB.ts.map +0 -7
  242. package/dist/chunks/chunk-P3YD4ONV.ts +0 -123
  243. package/dist/chunks/chunk-P3YD4ONV.ts.map +0 -7
  244. package/dist/chunks/chunk-PRUEIIK7.ts +0 -24
  245. package/dist/chunks/chunk-PRUEIIK7.ts.map +0 -7
  246. package/dist/chunks/chunk-PWMWOJP4.ts +0 -17
  247. package/dist/chunks/chunk-PWMWOJP4.ts.map +0 -7
  248. package/dist/chunks/chunk-QPC5HT3A.ts.map +0 -7
  249. package/dist/chunks/chunk-QQVK2XFC.ts +0 -64
  250. package/dist/chunks/chunk-QQVK2XFC.ts.map +0 -7
  251. package/dist/chunks/chunk-RDOX3VH5.ts +0 -140
  252. package/dist/chunks/chunk-RDOX3VH5.ts.map +0 -7
  253. package/dist/chunks/chunk-S7D6XWHI.ts +0 -258
  254. package/dist/chunks/chunk-S7D6XWHI.ts.map +0 -7
  255. package/dist/chunks/chunk-SHPNS7FM.ts +0 -64
  256. package/dist/chunks/chunk-SHPNS7FM.ts.map +0 -7
  257. package/dist/chunks/chunk-SWRVXVFD.ts +0 -248
  258. package/dist/chunks/chunk-SWRVXVFD.ts.map +0 -7
  259. package/dist/chunks/chunk-T2SJD3N7.ts +0 -99
  260. package/dist/chunks/chunk-T2SJD3N7.ts.map +0 -7
  261. package/dist/chunks/chunk-T2TYBLXK.ts +0 -27
  262. package/dist/chunks/chunk-T2TYBLXK.ts.map +0 -7
  263. package/dist/chunks/chunk-UZSDS4HF.ts +0 -403
  264. package/dist/chunks/chunk-UZSDS4HF.ts.map +0 -7
  265. package/dist/chunks/chunk-VPODHKOX.ts +0 -229
  266. package/dist/chunks/chunk-VPODHKOX.ts.map +0 -7
  267. package/dist/chunks/chunk-WEKGW7HV.ts +0 -162
  268. package/dist/chunks/chunk-WEKGW7HV.ts.map +0 -7
  269. package/dist/chunks/chunk-WUHRVSWI.ts +0 -369
  270. package/dist/chunks/chunk-WUHRVSWI.ts.map +0 -7
  271. package/dist/chunks/chunk-X7R6DCVF.ts +0 -28
  272. package/dist/chunks/chunk-X7R6DCVF.ts.map +0 -7
  273. package/dist/chunks/chunk-XJHQPB3E.ts +0 -107
  274. package/dist/chunks/chunk-XJHQPB3E.ts.map +0 -7
  275. package/dist/chunks/chunk-XZ3ZTHKR.ts +0 -1184
  276. package/dist/chunks/chunk-XZ3ZTHKR.ts.map +0 -7
  277. package/dist/chunks/chunk-YDVQYUHE.ts +0 -34
  278. package/dist/chunks/chunk-YDVQYUHE.ts.map +0 -7
  279. package/dist/chunks/chunk-YEULK7MK.ts +0 -415
  280. package/dist/chunks/chunk-YEULK7MK.ts.map +0 -7
  281. package/dist/chunks/chunk-YHT4YTYG.ts +0 -31
  282. package/dist/chunks/chunk-YHT4YTYG.ts.map +0 -7
  283. package/dist/chunks/chunk-ZW5ZLGBI.ts +0 -154
  284. package/dist/chunks/chunk-ZW5ZLGBI.ts.map +0 -7
  285. package/dist/chunks/command-handler-SDGKIQH2.ts.map +0 -7
  286. package/dist/chunks/conflict-artifacts-MYSH3L2J.ts +0 -33
  287. package/dist/chunks/conflict-review-J6ZSPNWL.ts +0 -190
  288. package/dist/chunks/conflict-review-J6ZSPNWL.ts.map +0 -7
  289. package/dist/chunks/continuous-sync-BH5SWIRV.ts +0 -590
  290. package/dist/chunks/continuous-sync-BH5SWIRV.ts.map +0 -7
  291. package/dist/chunks/git-backend-6CKI6CUG.ts +0 -1074
  292. package/dist/chunks/git-backend-6CKI6CUG.ts.map +0 -7
  293. package/dist/chunks/local-fields-SR7PH66U.ts +0 -27
  294. package/dist/chunks/local-fields-SR7PH66U.ts.map +0 -7
  295. package/dist/chunks/manager-result-dispatcher-CXUP5WDP.ts +0 -33
  296. package/dist/chunks/manager-result-dispatcher-CXUP5WDP.ts.map +0 -7
  297. package/dist/chunks/manager-ui-65ZETN6F.ts.map +0 -7
  298. package/dist/chunks/merge-baseline-store-4Y2X7P2D.ts +0 -26
  299. package/dist/chunks/merge-baseline-store-4Y2X7P2D.ts.map +0 -7
  300. package/dist/chunks/remote-selection-ui-W55BQDJQ.ts +0 -32
  301. package/dist/chunks/remote-selection-ui-W55BQDJQ.ts.map +0 -7
  302. package/dist/chunks/s3-backend-FDK7JSDQ.ts +0 -845
  303. package/dist/chunks/s3-backend-FDK7JSDQ.ts.map +0 -7
  304. package/dist/chunks/setup-switch-AB27ADDI.ts.map +0 -7
  305. package/dist/chunks/snapshot-G3W2GOGB.ts.map +0 -7
  306. package/dist/chunks/snapshot-transaction-SGRUWT73.ts +0 -25
  307. package/dist/chunks/snapshot-transaction-SGRUWT73.ts.map +0 -7
  308. package/dist/chunks/sync-inspection-MDYHZHT7.ts +0 -26
  309. package/dist/chunks/sync-inspection-MDYHZHT7.ts.map +0 -7
  310. package/dist/chunks/sync-operations-ZAUP65FH.ts +0 -1032
  311. package/dist/chunks/sync-operations-ZAUP65FH.ts.map +0 -7
  312. package/dist/chunks/sync-state-H4TFZZ7S.ts.map +0 -7
  313. package/dist/chunks/webdav-backend-UNMIAXM5.ts +0 -852
  314. package/dist/chunks/webdav-backend-UNMIAXM5.ts.map +0 -7
  315. /package/dist/chunks/{chunk-KHBPED6W.ts.map → chunk-GSQGBVKG.ts.map} +0 -0
  316. /package/dist/chunks/{chunk-PQ75RPUP.ts.map → chunk-UZUUUY7C.ts.map} +0 -0
  317. /package/dist/chunks/{agent-candidate-ZHN7FTZT.ts.map → manager-result-dispatcher-I2AMCCE7.ts.map} +0 -0
  318. /package/dist/chunks/{agent-sync-EGA2I5W7.ts.map → merge-review-SGDLMVS4.ts.map} +0 -0
  319. /package/dist/chunks/{config-J5VZUY4J.ts.map → remote-selection-ui-GZHPDQ4L.ts.map} +0 -0
  320. /package/dist/chunks/{conflict-artifacts-MYSH3L2J.ts.map → setup-switch-M3BAFGJM.ts.map} +0 -0
  321. /package/dist/chunks/{continuous-record-OM64J27R.ts.map → state-directory-JZSZVVPX.ts.map} +0 -0
@@ -1,220 +0,0 @@
1
- // @generated by scripts/build-runtime.mjs; do not edit.
2
- // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
- import {
4
- COUPLED_FIELDS,
5
- mergeSettingsJson,
6
- snapshotFile
7
- } from "./chunk-6OFMB6KK.ts";
8
- import {
9
- edits,
10
- isMergeTextPath,
11
- lines,
12
- text
13
- } from "./chunk-UZSDS4HF.ts";
14
- import {
15
- parseJsonObjectDocument,
16
- parseSettingsDocument
17
- } from "./chunk-ZW5ZLGBI.ts";
18
- import {
19
- scanSnapshot
20
- } from "./chunk-MKC3PXCN.ts";
21
- import {
22
- AGENT_INPUT_BYTES,
23
- AGENT_MAX_UNITS,
24
- AGENT_OUTPUT_BYTES
25
- } from "./chunk-PRUEIIK7.ts";
26
-
27
- // src/sync/agent-candidate.ts
28
- import { createHash } from "node:crypto";
29
- var digest = (value) => createHash("sha256").update(JSON.stringify(value)).digest("hex");
30
- function overlaps(a, b) {
31
- return a.start === a.end || b.start === b.end ? a.start <= b.end && b.start <= a.end : a.start < b.end && b.start < a.end;
32
- }
33
- function textParts(filePath, baseText, localText, remoteText) {
34
- const base = lines(baseText);
35
- const changes = [
36
- ...edits(base, lines(localText)).map((hunk) => ({ ...hunk, side: "local" })),
37
- ...edits(base, lines(remoteText)).map((hunk) => ({ ...hunk, side: "remote" }))
38
- ].sort((a, b) => a.start - b.start || a.end - b.end);
39
- const clusters = [];
40
- for (const change of changes) {
41
- const last = clusters.at(-1);
42
- if (last?.some((item) => overlaps(item, change))) last.push(change);
43
- else clusters.push([change]);
44
- }
45
- const result = [];
46
- let cursor = 0;
47
- for (const cluster of clusters) {
48
- const start = Math.min(...cluster.map((item) => item.start));
49
- const end = Math.max(...cluster.map((item) => item.end));
50
- result.push(base.slice(cursor, start).join(""));
51
- const image = (side) => {
52
- let position = start;
53
- const output = [];
54
- for (const hunk of cluster.filter((item) => item.side === side)) {
55
- output.push(...base.slice(position, hunk.start), ...hunk.lines);
56
- position = hunk.end;
57
- }
58
- return [...output, ...base.slice(position, end)].join("");
59
- };
60
- const local = image("local");
61
- const remote = image("remote");
62
- const original = base.slice(start, end).join("");
63
- if (local === remote || local === original || remote === original) result.push(local === original ? remote : local);
64
- else result.push({ id: "", path: filePath, kind: "text", base: original, local, remote });
65
- cursor = end;
66
- }
67
- result.push(base.slice(cursor).join(""));
68
- return result;
69
- }
70
- function buildAgentEvidence(plan, local, remote, ancestors) {
71
- const evidence = { units: [], files: [], unsupported: [] };
72
- if (plan.kind !== "planned") return evidence;
73
- if (plan.conflicts.length > AGENT_MAX_UNITS)
74
- throw new Error("Autonomous sync paused: too many conflict paths for bounded analysis.");
75
- for (const conflict of plan.conflicts) {
76
- try {
77
- if (conflict.reason !== "both-changed") throw new Error("unsupported conflict");
78
- const versions = [ancestors, local.files, remote.files].map((files) => {
79
- const file2 = files.find((item) => item.path === conflict.path);
80
- if (!file2) throw new Error("missing ancestor/version");
81
- const bytes = Buffer.from(file2.contentBase64, "base64");
82
- if (bytes.length > 8192) throw new Error("file bound");
83
- return text(bytes);
84
- });
85
- const [base, left, right] = versions;
86
- const file = { path: conflict.path, base, local: left, remote: right };
87
- let units;
88
- if (conflict.path === "settings.json") {
89
- const documents = versions.map((value) => parseSettingsDocument(Buffer.from(value)));
90
- const merge = mergeSettingsJson(
91
- ...versions.map((value) => Buffer.from(value)),
92
- void 0,
93
- true
94
- );
95
- if (merge.kind === "review" && merge.reason !== "field-conflict") throw new Error("unsupported settings");
96
- const fields = new Set(merge.kind === "review" ? merge.fields : []);
97
- const groups = COUPLED_FIELDS.map((group) => [...group]);
98
- const coupled = new Set(groups.flat());
99
- groups.push(...[...fields].filter((key) => !coupled.has(key)).map((key) => [key]));
100
- file.fields = [];
101
- units = groups.filter((group) => group.some((key) => fields.has(key))).map((group) => {
102
- const values = documents.map(
103
- (document) => JSON.stringify(
104
- Object.fromEntries(
105
- group.flatMap((key) => {
106
- const node = document.root.members.get(key)?.node;
107
- return node ? [[key, node.value]] : [];
108
- })
109
- )
110
- )
111
- );
112
- const unit = {
113
- id: "",
114
- path: file.path,
115
- kind: "settings",
116
- base: values[0] ?? "{}",
117
- local: values[1] ?? "{}",
118
- remote: values[2] ?? "{}"
119
- };
120
- file.fields?.push({ id: String(evidence.units.length + file.fields.length), key: group[0] ?? "" });
121
- return unit;
122
- });
123
- } else {
124
- if (!isMergeTextPath(conflict.path)) throw new Error("unsupported path");
125
- file.parts = textParts(file.path, base, left, right);
126
- units = file.parts.filter((part) => typeof part !== "string");
127
- }
128
- for (const unit of units) {
129
- unit.id = String(evidence.units.length);
130
- evidence.units.push(unit);
131
- }
132
- evidence.files.push(file);
133
- } catch {
134
- evidence.unsupported.push(conflict.path);
135
- }
136
- }
137
- if (evidence.units.length > AGENT_MAX_UNITS || Buffer.byteLength(JSON.stringify(evidence.units)) > AGENT_INPUT_BYTES)
138
- throw new Error("Autonomous sync paused: conflict evidence exceeds its input bound.");
139
- if (scanSnapshot({
140
- ...local,
141
- files: evidence.units.flatMap(
142
- (unit) => [unit.path, unit.base, unit.local, unit.remote].map((value) => snapshotFile(unit.path, Buffer.from(value)))
143
- )
144
- }).length)
145
- throw new Error("Autonomous sync paused: possible secrets in model evidence; nothing was disclosed.");
146
- return evidence;
147
- }
148
- function parseAgentCandidate(raw, evidence) {
149
- if (Buffer.byteLength(raw) > AGENT_OUTPUT_BYTES) throw new Error("Agent output exceeds its bound.");
150
- const parsed = parseJsonObjectDocument(Buffer.from(raw)).root.value;
151
- if (Object.keys(parsed).sort().join(",") !== "results,version" || parsed.version !== 1 || !Array.isArray(parsed.results) || parsed.results.length !== evidence.units.length)
152
- throw new Error("Invalid agent candidate contract.");
153
- const seen = /* @__PURE__ */ new Set();
154
- for (const result of parsed.results) {
155
- if (!result || typeof result !== "object" || Array.isArray(result)) throw new Error("Invalid agent result.");
156
- const row = result;
157
- const unit = evidence.units.find((unit2) => unit2.id === row.id);
158
- if (!unit || seen.has(unit.id)) throw new Error("Unowned or duplicate agent unit.");
159
- seen.add(unit.id);
160
- const keys = Object.keys(row).sort().join(",");
161
- if (keys === "id,refuse" && row.refuse === true) continue;
162
- if (unit.kind === "settings" && keys === "id,source" && (row.source === "local" || row.source === "remote"))
163
- continue;
164
- if (unit.kind === "text" && keys === "content,id" && typeof row.content === "string" && row.content.length > 0) {
165
- text(Buffer.from(row.content));
166
- if (/^(?:<{7}|={7}|>{7}|\|{7})/mu.test(row.content)) throw new Error("Unresolved conflict markers.");
167
- continue;
168
- }
169
- throw new Error("Unsupported agent action.");
170
- }
171
- return parsed;
172
- }
173
- function applyAgentCandidate(plan, evidence, candidate) {
174
- parseAgentCandidate(JSON.stringify(candidate), evidence);
175
- if (plan.kind !== "planned") throw new Error("Unverified merge plan.");
176
- const results = new Map(candidate.results.map((row) => [row.id, row]));
177
- const replacements = /* @__PURE__ */ new Map();
178
- for (const file of evidence.files) {
179
- const units = evidence.units.filter((unit) => unit.path === file.path);
180
- if (units.some((unit) => results.get(unit.id) && "refuse" in (results.get(unit.id) ?? {}))) continue;
181
- let bytes;
182
- if (file.parts) {
183
- bytes = Buffer.from(
184
- file.parts.map((part) => typeof part === "string" ? part : results.get(part.id).content).join("")
185
- );
186
- } else {
187
- const selections = new Map(
188
- (file.fields ?? []).map(({ id, key }) => [key, results.get(id).source])
189
- );
190
- const merged = mergeSettingsJson(
191
- Buffer.from(file.base),
192
- Buffer.from(file.local),
193
- Buffer.from(file.remote),
194
- selections,
195
- true
196
- );
197
- if (merged.kind !== "merged") throw new Error("Agent settings units remain unresolved.");
198
- parseSettingsDocument(merged.content);
199
- for (const { key } of file.fields ?? []) {
200
- if (!selections.has(key)) throw new Error("Missing atomic settings selection.");
201
- }
202
- bytes = merged.content;
203
- }
204
- if (bytes.length > AGENT_OUTPUT_BYTES) throw new Error("Agent file exceeds output bound.");
205
- replacements.set(file.path, snapshotFile(file.path, bytes));
206
- }
207
- const decisions = plan.decisions.map((decision) => {
208
- const file = replacements.get(decision.path);
209
- return file && decision.kind === "conflict" ? { kind: "accepted", path: file.path, source: "merged", file } : decision;
210
- });
211
- return { kind: "planned", decisions, conflicts: decisions.filter((item) => item.kind === "conflict") };
212
- }
213
-
214
- export {
215
- digest,
216
- buildAgentEvidence,
217
- parseAgentCandidate,
218
- applyAgentCandidate
219
- };
220
- //# sourceMappingURL=chunk-25QCU3LY.ts.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/sync/agent-candidate.ts"],
4
- "sourcesContent": ["import { createHash } from \"node:crypto\";\nimport { scanSnapshot } from \"../snapshot/snapshot.js\";\nimport type { Snapshot, SnapshotFile } from \"../snapshot/snapshot-types.js\";\nimport { AGENT_INPUT_BYTES, AGENT_MAX_UNITS, AGENT_OUTPUT_BYTES } from \"./agent-policy.js\";\nimport { snapshotFile } from \"./content-conflicts.js\";\nimport type { FileMergePlan } from \"./file-merge-planner.js\";\nimport { parseJsonObjectDocument, parseSettingsDocument } from \"./json-document.js\";\nimport { COUPLED_FIELDS, mergeSettingsJson } from \"./settings-merge.js\";\nimport { edits, type Hunk, isMergeTextPath, lines, text } from \"./text-merge.js\";\n\nexport interface AgentUnit {\n id: string;\n path: string;\n kind: \"text\" | \"settings\";\n base: string;\n local: string;\n remote: string;\n}\ninterface CandidateFile {\n path: string;\n base: string;\n local: string;\n remote: string;\n parts?: (string | AgentUnit)[];\n fields?: { id: string; key: string }[];\n}\nexport interface AgentEvidence {\n units: AgentUnit[];\n files: CandidateFile[];\n unsupported: string[];\n}\nexport interface AgentCandidate {\n version: 1;\n results: (\n | { id: string; content: string }\n | { id: string; source: \"local\" | \"remote\" }\n | { id: string; refuse: true }\n )[];\n}\nexport const digest = (value: unknown) => createHash(\"sha256\").update(JSON.stringify(value)).digest(\"hex\");\n\nfunction overlaps(a: Hunk, b: Hunk) {\n return a.start === a.end || b.start === b.end\n ? a.start <= b.end && b.start <= a.end\n : a.start < b.end && b.start < a.end;\n}\n\n/** Only overlapping edit regions are model-writable; all other bytes are assembled by code. */\nfunction textParts(filePath: string, baseText: string, localText: string, remoteText: string): (string | AgentUnit)[] {\n const base = lines(baseText);\n const changes = [\n ...edits(base, lines(localText)).map((hunk) => ({ ...hunk, side: \"local\" as const })),\n ...edits(base, lines(remoteText)).map((hunk) => ({ ...hunk, side: \"remote\" as const })),\n ].sort((a, b) => a.start - b.start || a.end - b.end);\n const clusters: (typeof changes)[] = [];\n for (const change of changes) {\n const last = clusters.at(-1);\n if (last?.some((item) => overlaps(item, change))) last.push(change);\n else clusters.push([change]);\n }\n const result: (string | AgentUnit)[] = [];\n let cursor = 0;\n for (const cluster of clusters) {\n const start = Math.min(...cluster.map((item) => item.start));\n const end = Math.max(...cluster.map((item) => item.end));\n result.push(base.slice(cursor, start).join(\"\"));\n const image = (side: \"local\" | \"remote\") => {\n let position = start;\n const output: string[] = [];\n for (const hunk of cluster.filter((item) => item.side === side)) {\n output.push(...base.slice(position, hunk.start), ...hunk.lines);\n position = hunk.end;\n }\n return [...output, ...base.slice(position, end)].join(\"\");\n };\n const local = image(\"local\");\n const remote = image(\"remote\");\n const original = base.slice(start, end).join(\"\");\n if (local === remote || local === original || remote === original) result.push(local === original ? remote : local);\n else result.push({ id: \"\", path: filePath, kind: \"text\", base: original, local, remote });\n cursor = end;\n }\n result.push(base.slice(cursor).join(\"\"));\n return result;\n}\n\nexport function buildAgentEvidence(\n plan: FileMergePlan,\n local: Snapshot,\n remote: Snapshot,\n ancestors: SnapshotFile[],\n): AgentEvidence {\n const evidence: AgentEvidence = { units: [], files: [], unsupported: [] };\n if (plan.kind !== \"planned\") return evidence;\n if (plan.conflicts.length > AGENT_MAX_UNITS)\n throw new Error(\"Autonomous sync paused: too many conflict paths for bounded analysis.\");\n for (const conflict of plan.conflicts) {\n try {\n if (conflict.reason !== \"both-changed\") throw new Error(\"unsupported conflict\");\n const versions = [ancestors, local.files, remote.files].map((files) => {\n const file = files.find((item) => item.path === conflict.path);\n if (!file) throw new Error(\"missing ancestor/version\");\n const bytes = Buffer.from(file.contentBase64, \"base64\");\n if (bytes.length > 8192) throw new Error(\"file bound\");\n return text(bytes);\n }) as [string, string, string];\n const [base, left, right] = versions;\n const file: CandidateFile = { path: conflict.path, base, local: left, remote: right };\n let units: AgentUnit[];\n if (conflict.path === \"settings.json\") {\n const documents = versions.map((value) => parseSettingsDocument(Buffer.from(value)));\n const merge = mergeSettingsJson(\n ...(versions.map((value) => Buffer.from(value)) as [Buffer, Buffer, Buffer]),\n undefined,\n true,\n );\n if (merge.kind === \"review\" && merge.reason !== \"field-conflict\") throw new Error(\"unsupported settings\");\n const fields = new Set(merge.kind === \"review\" ? merge.fields : []);\n const groups = COUPLED_FIELDS.map((group) => [...group] as string[]);\n const coupled = new Set(groups.flat());\n groups.push(...[...fields].filter((key) => !coupled.has(key)).map((key) => [key]));\n file.fields = [];\n units = groups\n .filter((group) => group.some((key) => fields.has(key)))\n .map((group) => {\n const values = documents.map((document) =>\n JSON.stringify(\n Object.fromEntries(\n group.flatMap((key) => {\n const node = document.root.members.get(key)?.node;\n return node ? [[key, node.value]] : [];\n }),\n ),\n ),\n );\n const unit: AgentUnit = {\n id: \"\",\n path: file.path,\n kind: \"settings\",\n base: values[0] ?? \"{}\",\n local: values[1] ?? \"{}\",\n remote: values[2] ?? \"{}\",\n };\n file.fields?.push({ id: String(evidence.units.length + file.fields.length), key: group[0] ?? \"\" });\n return unit;\n });\n } else {\n if (!isMergeTextPath(conflict.path)) throw new Error(\"unsupported path\");\n file.parts = textParts(file.path, base, left, right);\n units = file.parts.filter((part): part is AgentUnit => typeof part !== \"string\");\n }\n for (const unit of units) {\n unit.id = String(evidence.units.length);\n evidence.units.push(unit);\n }\n evidence.files.push(file);\n } catch {\n evidence.unsupported.push(conflict.path);\n }\n }\n if (evidence.units.length > AGENT_MAX_UNITS || Buffer.byteLength(JSON.stringify(evidence.units)) > AGENT_INPUT_BYTES)\n throw new Error(\"Autonomous sync paused: conflict evidence exceeds its input bound.\");\n // Scan only the actual disclosure image; skipSecretScan never authorizes model disclosure.\n if (\n scanSnapshot({\n ...local,\n files: evidence.units.flatMap((unit) =>\n [unit.path, unit.base, unit.local, unit.remote].map((value) => snapshotFile(unit.path, Buffer.from(value))),\n ),\n }).length\n )\n throw new Error(\"Autonomous sync paused: possible secrets in model evidence; nothing was disclosed.\");\n return evidence;\n}\n\nexport function parseAgentCandidate(raw: string, evidence: AgentEvidence): AgentCandidate {\n if (Buffer.byteLength(raw) > AGENT_OUTPUT_BYTES) throw new Error(\"Agent output exceeds its bound.\");\n const parsed = parseJsonObjectDocument(Buffer.from(raw)).root.value as Record<string, unknown>;\n if (\n Object.keys(parsed).sort().join(\",\") !== \"results,version\" ||\n parsed.version !== 1 ||\n !Array.isArray(parsed.results) ||\n parsed.results.length !== evidence.units.length\n )\n throw new Error(\"Invalid agent candidate contract.\");\n const seen = new Set<string>();\n for (const result of parsed.results) {\n if (!result || typeof result !== \"object\" || Array.isArray(result)) throw new Error(\"Invalid agent result.\");\n const row = result as Record<string, unknown>;\n const unit = evidence.units.find((unit) => unit.id === row.id);\n if (!unit || seen.has(unit.id)) throw new Error(\"Unowned or duplicate agent unit.\");\n seen.add(unit.id);\n const keys = Object.keys(row).sort().join(\",\");\n if (keys === \"id,refuse\" && row.refuse === true) continue;\n if (unit.kind === \"settings\" && keys === \"id,source\" && (row.source === \"local\" || row.source === \"remote\"))\n continue;\n if (unit.kind === \"text\" && keys === \"content,id\" && typeof row.content === \"string\" && row.content.length > 0) {\n text(Buffer.from(row.content));\n if (/^(?:<{7}|={7}|>{7}|\\|{7})/mu.test(row.content)) throw new Error(\"Unresolved conflict markers.\");\n continue;\n }\n throw new Error(\"Unsupported agent action.\");\n }\n return parsed as unknown as AgentCandidate;\n}\n\nexport function applyAgentCandidate(\n plan: FileMergePlan,\n evidence: AgentEvidence,\n candidate: AgentCandidate,\n): FileMergePlan {\n // Persisted candidates cross a trust boundary too.\n parseAgentCandidate(JSON.stringify(candidate), evidence);\n if (plan.kind !== \"planned\") throw new Error(\"Unverified merge plan.\");\n const results = new Map(candidate.results.map((row) => [row.id, row]));\n const replacements = new Map<string, SnapshotFile>();\n for (const file of evidence.files) {\n const units = evidence.units.filter((unit) => unit.path === file.path);\n if (units.some((unit) => results.get(unit.id) && \"refuse\" in (results.get(unit.id) ?? {}))) continue;\n let bytes: Buffer;\n if (file.parts) {\n bytes = Buffer.from(\n file.parts\n .map((part) => (typeof part === \"string\" ? part : (results.get(part.id) as { content: string }).content))\n .join(\"\"),\n );\n } else {\n const selections = new Map(\n (file.fields ?? []).map(({ id, key }) => [key, (results.get(id) as { source: \"local\" | \"remote\" }).source]),\n );\n const merged = mergeSettingsJson(\n Buffer.from(file.base),\n Buffer.from(file.local),\n Buffer.from(file.remote),\n selections,\n true,\n );\n if (merged.kind !== \"merged\") throw new Error(\"Agent settings units remain unresolved.\");\n // The existing renderer/parser retains atomic values, unknown members and exact numeric policy.\n parseSettingsDocument(merged.content);\n for (const { key } of file.fields ?? []) {\n if (!selections.has(key)) throw new Error(\"Missing atomic settings selection.\");\n }\n bytes = merged.content;\n }\n if (bytes.length > AGENT_OUTPUT_BYTES) throw new Error(\"Agent file exceeds output bound.\");\n replacements.set(file.path, snapshotFile(file.path, bytes));\n }\n const decisions = plan.decisions.map((decision) => {\n const file = replacements.get(decision.path);\n return file && decision.kind === \"conflict\"\n ? { kind: \"accepted\" as const, path: file.path, source: \"merged\" as const, file }\n : decision;\n });\n return { kind: \"planned\", decisions, conflicts: decisions.filter((item) => item.kind === \"conflict\") };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAuCpB,IAAM,SAAS,CAAC,UAAmB,WAAW,QAAQ,EAAE,OAAO,KAAK,UAAU,KAAK,CAAC,EAAE,OAAO,KAAK;AAEzG,SAAS,SAAS,GAAS,GAAS;AAClC,SAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MACtC,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MACjC,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE;AACrC;AAGA,SAAS,UAAU,UAAkB,UAAkB,WAAmB,YAA4C;AACpH,QAAM,OAAO,MAAM,QAAQ;AAC3B,QAAM,UAAU;AAAA,IACd,GAAG,MAAM,MAAM,MAAM,SAAS,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,MAAM,MAAM,QAAiB,EAAE;AAAA,IACpF,GAAG,MAAM,MAAM,MAAM,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,MAAM,MAAM,SAAkB,EAAE;AAAA,EACxF,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG;AACnD,QAAM,WAA+B,CAAC;AACtC,aAAW,UAAU,SAAS;AAC5B,UAAM,OAAO,SAAS,GAAG,EAAE;AAC3B,QAAI,MAAM,KAAK,CAAC,SAAS,SAAS,MAAM,MA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,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,IAAI,MAAM,CAAC,KAAM,QAAQ,IAAI,EAAE,EAAqC,MAAM,CAAC;AAAA,MAC5G;AACA,YAAM,SAAS;AAAA,QACb,OAAO,KAAK,KAAK,IAAI;AAAA,QACrB,OAAO,KAAK,KAAK,KAAK;AAAA,QACtB,OAAO,KAAK,KAAK,MAAM;AAAA,QACvB;AAAA,QACA;AAAA,MACF;AACA,UAAI,OAAO,SAAS,SAAU,OAAM,IAAI,MAAM,yCAAyC;AAEvF,4BAAsB,OAAO,OAAO;AACpC,iBAAW,EAAE,IAAI,KAAK,KAAK,UAAU,CAAC,GAAG;AACvC,YAAI,CAAC,WAAW,IAAI,GAAG,EAAG,OAAM,IAAI,MAAM,oCAAoC;AAAA,MAChF;AACA,cAAQ,OAAO;AAAA,IACjB;AACA,QAAI,MAAM,SAAS,mBAAoB,OAAM,IAAI,MAAM,kCAAkC;AACzF,iBAAa,IAAI,KAAK,MAAM,aAAa,KAAK,MAAM,KAAK,CAAC;AAAA,EAC5D;AACA,QAAM,YAAY,KAAK,UAAU,IAAI,CAAC,aAAa;AACjD,UAAM,OAAO,aAAa,IAAI,SAAS,IAAI;AAC3C,WAAO,QAAQ,SAAS,SAAS,aAC7B,EAAE,MAAM,YAAqB,MAAM,KAAK,MAAM,QAAQ,UAAmB,KAAK,IAC9E;AAAA,EACN,CAAC;AACD,SAAO,EAAE,MAAM,WAAW,WAAW,WAAW,UAAU,OAAO,CAAC,SAAS,KAAK,SAAS,UAAU,EAAE;AACvG;",
6
- "names": ["file", "unit"]
7
- }
@@ -1,113 +0,0 @@
1
- // @generated by scripts/build-runtime.mjs; do not edit.
2
- // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
- import {
4
- normalizeGitRemoteIdentity
5
- } from "./chunk-T2SJD3N7.ts";
6
-
7
- // src/backends/webdav/webdav-config.ts
8
- var DEFAULT_PATH = "pi-sync";
9
- function normalizeWebDavIdentityUrl(value) {
10
- try {
11
- const url = new URL(value.trim());
12
- url.username = "";
13
- url.password = "";
14
- url.search = "";
15
- url.hash = "";
16
- url.pathname = `${url.pathname.replace(/\/+$/u, "")}/`;
17
- return url.toString();
18
- } catch {
19
- return value.trim();
20
- }
21
- }
22
- function normalizeWebDavUrl(value) {
23
- const normalized = normalizeOptionalString(value);
24
- if (!normalized) return void 0;
25
- let url;
26
- try {
27
- url = new URL(normalized);
28
- } catch {
29
- throw new Error("Invalid pi-sync WebDAV URL.");
30
- }
31
- if (url.username || url.password || url.search || url.hash) {
32
- throw new Error("Invalid pi-sync WebDAV URL: credentials, query, and fragment are not allowed.");
33
- }
34
- const loopback = url.hostname === "127.0.0.1" || url.hostname === "localhost" || url.hostname === "[::1]" || url.hostname === "::1";
35
- if (url.protocol !== "https:" && !(url.protocol === "http:" && loopback)) {
36
- throw new Error("Invalid pi-sync WebDAV URL: HTTPS is required except for loopback.");
37
- }
38
- url.pathname = `${url.pathname.replace(/\/+$/u, "")}/`;
39
- return url.toString();
40
- }
41
- function normalizeWebDavPath(value) {
42
- if (value?.trim() === "." || value?.trim() === "./") return "./";
43
- const normalized = trimSlashes(normalizeOptionalString(value) ?? DEFAULT_PATH);
44
- if (!normalized || normalized.includes("\\") || hasControlCharacter(normalized) || normalized.split("/").some((segment) => !segment || segment === "." || segment === "..")) {
45
- throw new Error("Invalid pi-sync WebDAV path.");
46
- }
47
- return normalized;
48
- }
49
- function validateWebDavCredentials(username, password) {
50
- if (username.includes(":") || hasControlCharacter(username) || password !== void 0 && hasControlCharacter(password)) {
51
- throw new Error("Invalid pi-sync WebDAV credentials.");
52
- }
53
- }
54
- function normalizeOptionalString(value) {
55
- const normalized = value?.trim();
56
- return normalized || void 0;
57
- }
58
- function trimSlashes(value) {
59
- return value.replace(/^\/+|\/+$/gu, "");
60
- }
61
- function hasControlCharacter(value) {
62
- return [...value].some((character) => {
63
- const code = character.codePointAt(0) ?? 0;
64
- return code < 32 || code >= 127 && code <= 159;
65
- });
66
- }
67
-
68
- // src/backends/backend-identity.ts
69
- function backendIdentityCoordinates(config) {
70
- switch (config.backend.type) {
71
- case "s3":
72
- return JSON.stringify([
73
- "s3",
74
- normalizeEndpointIdentity(config.backend.profile.endpoint),
75
- config.backend.destination.bucket,
76
- config.storagePath
77
- ]);
78
- case "git":
79
- return JSON.stringify([
80
- "git",
81
- normalizeGitRemoteIdentity(config.backend.profile.remote),
82
- config.backend.destination.branch,
83
- config.storagePath
84
- ]);
85
- case "webdav":
86
- return JSON.stringify([
87
- "webdav",
88
- normalizeWebDavIdentityUrl(config.backend.profile.url),
89
- config.backend.profile.username,
90
- config.storagePath
91
- ]);
92
- }
93
- }
94
- function normalizeEndpointIdentity(endpoint) {
95
- try {
96
- const url = new URL(endpoint.trim());
97
- url.hostname = url.hostname.toLowerCase();
98
- url.pathname = url.pathname.replace(/\/+$/gu, "");
99
- return url.toString().replace(/\/$/u, "");
100
- } catch {
101
- return endpoint.trim();
102
- }
103
- }
104
-
105
- export {
106
- normalizeWebDavIdentityUrl,
107
- normalizeWebDavUrl,
108
- normalizeWebDavPath,
109
- validateWebDavCredentials,
110
- backendIdentityCoordinates,
111
- normalizeEndpointIdentity
112
- };
113
- //# sourceMappingURL=chunk-2JZFHNLM.ts.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/backends/webdav/webdav-config.ts", "../../src/backends/backend-identity.ts"],
4
- "sourcesContent": ["const DEFAULT_PATH = \"pi-sync\";\n\nexport function normalizeWebDavIdentityUrl(value: string) {\n try {\n const url = new URL(value.trim());\n url.username = \"\";\n url.password = \"\";\n url.search = \"\";\n url.hash = \"\";\n url.pathname = `${url.pathname.replace(/\\/+$/u, \"\")}/`;\n return url.toString();\n } catch {\n return value.trim();\n }\n}\n\nexport function normalizeWebDavUrl(value: string | undefined) {\n const normalized = normalizeOptionalString(value);\n if (!normalized) return undefined;\n let url: URL;\n try {\n url = new URL(normalized);\n } catch {\n throw new Error(\"Invalid pi-sync WebDAV URL.\");\n }\n if (url.username || url.password || url.search || url.hash) {\n throw new Error(\"Invalid pi-sync WebDAV URL: credentials, query, and fragment are not allowed.\");\n }\n const loopback =\n url.hostname === \"127.0.0.1\" || url.hostname === \"localhost\" || url.hostname === \"[::1]\" || url.hostname === \"::1\";\n if (url.protocol !== \"https:\" && !(url.protocol === \"http:\" && loopback)) {\n throw new Error(\"Invalid pi-sync WebDAV URL: HTTPS is required except for loopback.\");\n }\n url.pathname = `${url.pathname.replace(/\\/+$/u, \"\")}/`;\n return url.toString();\n}\n\nexport function normalizeWebDavPath(value: string | undefined) {\n if (value?.trim() === \".\" || value?.trim() === \"./\") return \"./\";\n const normalized = trimSlashes(normalizeOptionalString(value) ?? DEFAULT_PATH);\n if (\n !normalized ||\n normalized.includes(\"\\\\\") ||\n hasControlCharacter(normalized) ||\n normalized.split(\"/\").some((segment) => !segment || segment === \".\" || segment === \"..\")\n ) {\n throw new Error(\"Invalid pi-sync WebDAV path.\");\n }\n return normalized;\n}\n\nexport function validateWebDavNamespace(value: string) {\n if (value === \".\" || value === \"..\" || value.includes(\"/\") || value.includes(\"\\\\\") || hasControlCharacter(value)) {\n throw new Error(\"Invalid pi-sync WebDAV namespace.\");\n }\n}\n\nexport function validateWebDavCredentials(username: string, password?: string) {\n if (\n username.includes(\":\") ||\n hasControlCharacter(username) ||\n (password !== undefined && hasControlCharacter(password))\n ) {\n throw new Error(\"Invalid pi-sync WebDAV credentials.\");\n }\n}\n\nfunction normalizeOptionalString(value: string | undefined) {\n const normalized = value?.trim();\n return normalized || undefined;\n}\n\nfunction trimSlashes(value: string) {\n return value.replace(/^\\/+|\\/+$/gu, \"\");\n}\n\nfunction hasControlCharacter(value: string) {\n return [...value].some((character) => {\n const code = character.codePointAt(0) ?? 0;\n return code < 0x20 || (code >= 0x7f && code <= 0x9f);\n });\n}\n", "import type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { normalizeGitRemoteIdentity } from \"./git/git-config.js\";\nimport { normalizeWebDavIdentityUrl } from \"./webdav/webdav-config.js\";\n\nexport function backendIdentityCoordinates(config: AnySyncConfig) {\n switch (config.backend.type) {\n case \"s3\":\n return JSON.stringify([\n \"s3\",\n normalizeEndpointIdentity(config.backend.profile.endpoint),\n config.backend.destination.bucket,\n config.storagePath,\n ]);\n case \"git\":\n return JSON.stringify([\n \"git\",\n normalizeGitRemoteIdentity(config.backend.profile.remote),\n config.backend.destination.branch,\n config.storagePath,\n ]);\n case \"webdav\":\n return JSON.stringify([\n \"webdav\",\n normalizeWebDavIdentityUrl(config.backend.profile.url),\n config.backend.profile.username,\n config.storagePath,\n ]);\n }\n}\n\nexport function normalizeEndpointIdentity(endpoint: string) {\n try {\n const url = new URL(endpoint.trim());\n url.hostname = url.hostname.toLowerCase();\n url.pathname = url.pathname.replace(/\\/+$/gu, \"\");\n return url.toString().replace(/\\/$/u, \"\");\n } catch {\n return endpoint.trim();\n }\n}\n"],
5
- "mappings": ";;;;;;;AAAA,IAAM,eAAe;AAEd,SAAS,2BAA2B,OAAe;AACxD,MAAI;AACF,UAAM,MAAM,IAAI,IAAI,MAAM,KAAK,CAAC;AAChC,QAAI,WAAW;AACf,QAAI,WAAW;AACf,QAAI,SAAS;AACb,QAAI,OAAO;AACX,QAAI,WAAW,GAAG,IAAI,SAAS,QAAQ,SAAS,EAAE,CAAC;AACnD,WAAO,IAAI,SAAS;AAAA,EACtB,QAAQ;AACN,WAAO,MAAM,KAAK;AAAA,EACpB;AACF;AAEO,SAAS,mBAAmB,OAA2B;AAC5D,QAAM,aAAa,wBAAwB,KAAK;AAChD,MAAI,CAAC,WAAY,QAAO;AACxB,MAAI;AACJ,MAAI;AACF,UAAM,IAAI,IAAI,UAAU;AAAA,EAC1B,QAAQ;AACN,UAAM,IAAI,MAAM,6BAA6B;AAAA,EAC/C;AACA,MAAI,IAAI,YAAY,IAAI,YAAY,IAAI,UAAU,IAAI,MAAM;AAC1D,UAAM,IAAI,MAAM,+EAA+E;AAAA,EACjG;AACA,QAAM,WACJ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AAO,KAAK,UAAU;AAAA,QACpB;AAAA,QACA,0BAA0B,OAAO,QAAQ,QAAQ,QAAQ;AAAA,QACzD,OAAO,QAAQ,YAAY;AAAA,QAC3B,OAAO;AAAA,MACT,CAAC;AAAA,IACH,KAAK;AACH,aAAO,KAAK,UAAU;AAAA,QACpB;AAAA,QACA,2BAA2B,OAAO,QAAQ,QAAQ,MAAM;AAAA,QACxD,OAAO,QAAQ,YAAY;AAAA,QAC3B,OAAO;AAAA,MACT,CAAC;AAAA,IACH,KAAK;AACH,aAAO,KAAK,UAAU;AAAA,QACpB;AAAA,QACA,2BAA2B,OAAO,QAAQ,QAAQ,GAAG;AAAA,QACrD,OAAO,QAAQ,QAAQ;AAAA,QACvB,OAAO;AAAA,MACT,CAAC;AAAA,EACL;AACF;AAEO,SAAS,0BAA0B,UAAkB;AAC1D,MAAI;AACF,UAAM,MAAM,IAAI,IAAI,SAAS,KAAK,CAAC;AACnC,QAAI,WAAW,IAAI,SAAS,YAAY;AACxC,QAAI,WAAW,IAAI,SAAS,QAAQ,UAAU,EAAE;AAChD,WAAO,IAAI,SAAS,EAAE,QAAQ,QAAQ,EAAE;AAAA,EAC1C,QAAQ;AACN,WAAO,SAAS,KAAK;AAAA,EACvB;AACF;",
6
- "names": []
7
- }
@@ -1,25 +0,0 @@
1
- // @generated by scripts/build-runtime.mjs; do not edit.
2
- // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
-
4
- // src/backends/backend-factory.ts
5
- var createSyncBackend = async (config) => {
6
- switch (config.backend.type) {
7
- case "s3": {
8
- const { S3SyncBackend } = await import("./s3-backend-FDK7JSDQ.ts");
9
- return new S3SyncBackend(config.backend);
10
- }
11
- case "webdav": {
12
- const { WebDavSyncBackend } = await import("./webdav-backend-UNMIAXM5.ts");
13
- return new WebDavSyncBackend(config.backend);
14
- }
15
- case "git": {
16
- const { GitSyncBackend } = await import("./git-backend-6CKI6CUG.ts");
17
- return new GitSyncBackend(config.backend);
18
- }
19
- }
20
- };
21
-
22
- export {
23
- createSyncBackend
24
- };
25
- //# sourceMappingURL=chunk-2UKUKIBI.ts.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/backends/backend-factory.ts"],
4
- "sourcesContent": ["import type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport type { SyncBackend } from \"./sync-backend.js\";\n\nexport type SyncBackendFactory = {\n bivarianceHack(config: AnySyncConfig): SyncBackend | Promise<SyncBackend>;\n}[\"bivarianceHack\"];\n\nexport const createSyncBackend: SyncBackendFactory = async (config) => {\n switch (config.backend.type) {\n case \"s3\": {\n const { S3SyncBackend } = await import(\"./s3/s3-backend.js\");\n return new S3SyncBackend(config.backend);\n }\n case \"webdav\": {\n const { WebDavSyncBackend } = await import(\"./webdav/webdav-backend.js\");\n return new WebDavSyncBackend(config.backend);\n }\n case \"git\": {\n const { GitSyncBackend } = await import(\"./git/git-backend.js\");\n return new GitSyncBackend(config.backend);\n }\n }\n};\n"],
5
- "mappings": ";;;;AAOO,IAAM,oBAAwC,OAAO,WAAW;AACrE,UAAQ,OAAO,QAAQ,MAAM;AAAA,IAC3B,KAAK,MAAM;AACT,YAAM,EAAE,cAAc,IAAI,MAAM,OAAO,0BAAoB;AAC3D,aAAO,IAAI,cAAc,OAAO,OAAO;AAAA,IACzC;AAAA,IACA,KAAK,UAAU;AACb,YAAM,EAAE,kBAAkB,IAAI,MAAM,OAAO,8BAA4B;AACvE,aAAO,IAAI,kBAAkB,OAAO,OAAO;AAAA,IAC7C;AAAA,IACA,KAAK,OAAO;AACV,YAAM,EAAE,eAAe,IAAI,MAAM,OAAO,2BAAsB;AAC9D,aAAO,IAAI,eAAe,OAAO,OAAO;AAAA,IAC1C;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/ui/sync-attention.ts"],
4
- "sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { truncateToWidth } from \"@earendil-works/pi-tui\";\nimport type { EditorStatusWidgetState } from \"@narumitw/pi-tui-kit/editor-status-widget\";\nimport { syncCheckConfigFingerprint, syncConfigReviewFingerprint } from \"../settings/config.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { sameSyncExclude } from \"../sync/exclude-policy.js\";\nimport type { StartupObservation } from \"../sync/sync-inspection.js\";\nimport { compareSyncInclude, type RemoteSelectionDecision, sameSyncInclude } from \"../sync/sync-policy.js\";\nimport { setSyncStatus } from \"./sync-status.js\";\nimport { safeTerminalText } from \"./terminal-text.js\";\n\nconst WIDGET_KEY = \"sync:attention\";\n\nexport type SyncAttentionOrigin = \"sync\" | \"pull\" | \"push\";\n\nexport interface SyncAttentionState {\n decision: RemoteSelectionDecision;\n origin: SyncAttentionOrigin;\n offered: boolean;\n}\n\nexport function syncAttentionMatchesConfig(attention: SyncAttentionState, config: AnySyncConfig) {\n return (\n attention.decision.setupName === config.setupName &&\n attention.decision.configIdentity === syncConfigReviewFingerprint(config) &&\n sameSyncInclude(attention.decision.localInclude, config.include) &&\n sameSyncExclude(attention.decision.localExclude, config.exclude)\n );\n}\n\nexport interface SyncAttentionController {\n observe(observation: StartupObservation): void;\n observation(): StartupObservation | undefined;\n clearObservation(): void;\n notifyObservation(ctx: ExtensionContext): void;\n set(decision: RemoteSelectionDecision, origin: SyncAttentionOrigin): void;\n current(): SyncAttentionState | undefined;\n markOffered(): boolean;\n clear(ctx: ExtensionContext): void;\n reset(ctx: ExtensionContext): void;\n expand(): void;\n publish(ctx: ExtensionContext, signal?: AbortSignal): Promise<void>;\n}\n\nexport function createSyncAttentionController(): SyncAttentionController {\n let state: SyncAttentionState | undefined;\n let observation: StartupObservation | undefined;\n let generation = 0;\n let widgetState: EditorStatusWidgetState = { collapsed: false };\n\n return {\n observe(value) {\n generation++;\n observation = value;\n },\n observation() {\n return observation;\n },\n clearObservation() {\n generation++;\n observation = undefined;\n },\n notifyObservation(ctx) {\n if (ctx.hasUI && observation && observationNeedsAttention(observation)) {\n ctx.ui.notify(observationLines(observation).join(\"\\n\"), \"warning\");\n }\n },\n set(decision, origin) {\n generation++;\n state = { decision, origin, offered: false };\n },\n current() {\n return state;\n },\n markOffered() {\n if (!state || state.offered) return false;\n state = { ...state, offered: true };\n return true;\n },\n clear(ctx) {\n generation++;\n state = undefined;\n clearAttentionPresentation(ctx);\n },\n reset(ctx) {\n generation++;\n state = undefined;\n observation = undefined;\n widgetState = { collapsed: false };\n clearAttentionPresentation(ctx);\n },\n expand() {\n widgetState.collapsed = false;\n },\n async publish(ctx, signal) {\n const currentGeneration = ++generation;\n if (signal?.aborted || !ctx.hasUI) return;\n const classification = observation ? classifyObservation(observation) : \"none\";\n if (!state && (classification === \"none\" || classification === \"guidance\")) {\n clearAttentionPresentation(ctx);\n return;\n }\n if (!state && classification === \"status\") {\n ctx.ui.setWidget(WIDGET_KEY, undefined);\n setSyncStatus(ctx, observation?.inspection.remoteChanged ? \"sync \u21E3\" : \"sync \u21E1\", {\n activity: observation?.inspection.remoteChanged ? \"remote-change\" : \"local-change\",\n });\n return;\n }\n const presentation = state\n ? attentionPresentation(state.decision)\n : observationPresentation(observation as StartupObservation);\n if (ctx.mode !== \"tui\") {\n ctx.ui.setWidget(WIDGET_KEY, undefined);\n setSyncStatus(ctx, presentation.status, { activity: \"review\" });\n return;\n }\n // Keep Kit outside the eager startup graph; module loading owns no cancellable resources.\n const { EditorStatusWidget } = await import(\"./attention-widget.js\").catch((error) => {\n if (generation === currentGeneration && !signal?.aborted) clearAttentionPresentation(ctx);\n throw error;\n });\n if (generation !== currentGeneration || signal?.aborted) return;\n setSyncStatus(ctx, presentation.status, { activity: \"review\" });\n const presentationState = widgetState;\n ctx.ui.setWidget(\n WIDGET_KEY,\n (_tui, theme) =>\n new EditorStatusWidget({\n theme,\n name: \"Sync\",\n summary: \"Needs review\",\n state: presentationState,\n renderBody: (width) =>\n presentation.lines.map((line, index) =>\n width === 0 ? \"\" : truncateToWidth(theme.fg(index === 0 ? \"warning\" : \"muted\", line), width, \"\u2026\"),\n ),\n }),\n );\n },\n };\n}\n\nfunction attentionPresentation(decision: RemoteSelectionDecision) {\n const setupName = safeTerminalText(decision.setupName);\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return {\n status: \"sync \u21D5\",\n lines: [\n `Setup: ${setupName}`,\n selectionDifference({\n ...comparison,\n excludeChanged: !sameSyncExclude(decision.localExclude, decision.remoteExclude),\n }),\n \"No transfer performed \u00B7 Run /sync to review\",\n ],\n };\n}\n\nfunction selectionDifference(comparison: {\n remoteOnly: readonly string[];\n localOnly: readonly string[];\n excludeChanged?: boolean;\n}) {\n if (comparison.excludeChanged) return \"Selection: excluded paths differ; review needed\";\n return comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0\n ? \"Selection: only list order differs\"\n : `Selection: ${comparison.remoteOnly.length} remote-only \u00B7 ${comparison.localOnly.length} device-only`;\n}\n\nfunction observationPresentation(observation: StartupObservation) {\n const selection = observation.inspection.selectionState;\n return {\n status: \"sync \u21D5\",\n lines: [\n `Setup: ${safeTerminalText(observation.setupName)}`,\n selection?.kind === \"different\" ? selectionDifference(selection) : observationSummary(observation),\n \"No transfer performed \u00B7 Run /sync to review\",\n ],\n };\n}\n\nexport function observationMatchesConfig(observation: StartupObservation, config: AnySyncConfig) {\n return observation.configIdentity === syncCheckConfigFingerprint(config);\n}\n\nexport function observationSummary(observation: StartupObservation) {\n const result = observation.inspection;\n if (result.emptyInclude) return \"No included content selected\";\n if (result.selectionState?.kind === \"different\") return \"Synced-content list differs; review needed\";\n if (result.firstSync)\n return result.head ? \"No sync baseline; review remote and local content\" : \"Remote empty; no sync baseline\";\n if (!result.head) return \"Remote snapshot missing; review needed\";\n if (observation.automaticTransfer && result.selectionState?.kind === \"legacy\")\n return \"Legacy remote has no authoritative content list; review /sync and choose an explicit direction to adopt policy\";\n if (result.localChanged && result.remoteChanged) return \"Local and remote changed since last sync; review needed\";\n if (result.remoteChanged) return \"Remote changed since last sync\";\n if (result.localChanged) return \"Local content changed since last sync\";\n if (result.selectionState?.kind === \"legacy\") return \"Legacy remote has no authoritative content list\";\n return \"No changes detected since last sync\";\n}\n\nexport type ObservationClassification = \"none\" | \"guidance\" | \"status\" | \"review\";\n\n/** Presentation only: never discard an observation or authorize a transfer here. */\nexport function classifyObservation(observation: StartupObservation): ObservationClassification {\n const result = observation.inspection;\n // Sync now exits before reading remote content when nothing is selected.\n if (result.emptyInclude) return \"guidance\";\n // Ordering is part of the existing transfer policy, not merely display order.\n if (result.selectionState?.kind === \"different\") return \"review\";\n if (result.firstSync) return result.head ? \"review\" : \"guidance\";\n if (!result.head || (result.localChanged && result.remoteChanged)) return \"review\";\n if (observation.automaticTransfer && result.selectionState?.kind === \"legacy\") return \"review\";\n if (result.localChanged || result.remoteChanged) return \"status\";\n // Legacy metadata alone requires no scope confirmation in transfer operations.\n return \"none\";\n}\n\nexport function observationNeedsAttention(observation: StartupObservation) {\n return classifyObservation(observation) === \"review\";\n}\n\nfunction observationLines(observation: StartupObservation) {\n return [\n `Pi Sync check \u00B7 ${safeTerminalText(observation.setupName)}`,\n observationSummary(observation),\n \"No startup transfer \u00B7 Run /sync to review\",\n ];\n}\n\nfunction clearAttentionPresentation(ctx: ExtensionContext) {\n if (!ctx.hasUI) return;\n setSyncStatus(ctx, undefined);\n ctx.ui.setWidget(WIDGET_KEY, undefined);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AACA,SAAS,uBAAuB;AAUhC,IAAM,aAAa;AAUZ,SAAS,2BAA2B,WAA+B,QAAuB;AAC/F,SACE,UAAU,SAAS,cAAc,OAAO,aACxC,UAAU,SAAS,mBAAmB,4BAA4B,MAAM,KACxE,gBAAgB,UAAU,SAAS,cAAc,OAAO,OAAO,KAC/D,gBAAgB,UAAU,SAAS,cAAc,OAAO,OAAO;AAEnE;AAgBO,SAAS,gCAAyD;AACvE,MAAI;AACJ,MAAI;AACJ,MAAI,aAAa;AACjB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I,YAAY,qBAAqB,OAAO,gBAAgB,SAAS,SAAU,QAAO;AACtF,MAAI,OAAO,gBAAgB,OAAO,cAAe,QAAO;AAExD,SAAO;AACT;AAEO,SAAS,0BAA0B,aAAiC;AACzE,SAAO,oBAAoB,WAAW,MAAM;AAC9C;AAEA,SAAS,iBAAiB,aAAiC;AACzD,SAAO;AAAA,IACL,sBAAmB,iBAAiB,YAAY,SAAS,CAAC;AAAA,IAC1D,mBAAmB,WAAW;AAAA,IAC9B;AAAA,EACF;AACF;AAEA,SAAS,2BAA2B,KAAuB;AACzD,MAAI,CAAC,IAAI,MAAO;AAChB,gBAAc,KAAK,MAAS;AAC5B,MAAI,GAAG,UAAU,YAAY,MAAS;AACxC;",
6
- "names": []
7
- }
@@ -1,77 +0,0 @@
1
- // @generated by scripts/build-runtime.mjs; do not edit.
2
- // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
-
4
- // src/sync/exclude-policy.ts
5
- import path from "node:path";
6
- import { Minimatch } from "minimatch";
7
- var MAX_RULES = 1024;
8
- var MAX_RULE_BYTES = 4096;
9
- var MAX_TOTAL_BYTES = 256 * 1024;
10
- function normalizeSyncExclude(value) {
11
- if (value === void 0) return [];
12
- if (!Array.isArray(value)) throw new Error("Invalid pi-sync settings: sync.exclude must be an array.");
13
- if (value.length > MAX_RULES) throw new Error(`sync.exclude exceeds ${MAX_RULES} rules.`);
14
- const seen = /* @__PURE__ */ new Set();
15
- let total = 0;
16
- const rules = value.map((item) => {
17
- if (typeof item !== "string") throw new Error("sync.exclude rules must be strings.");
18
- const bytes = Buffer.byteLength(item, "utf8");
19
- total += bytes;
20
- if (bytes > MAX_RULE_BYTES || total > MAX_TOTAL_BYTES) throw new Error("sync.exclude exceeds its byte limit.");
21
- const rule = item.trim();
22
- const segments = rule.split("/");
23
- if (!rule || path.posix.isAbsolute(rule) || path.win32.isAbsolute(rule) || /^[a-z]:/iu.test(rule) || rule.includes("\\") || // biome-ignore lint/suspicious/noControlCharactersInRegex: Reject untrusted terminal controls.
24
- /[\u0000-\u001f\u007f-\u009f]/u.test(item) || /^[!#]/u.test(rule) || /[[\]{}()]/u.test(rule) || segments.some(
25
- (segment) => !segment || segment === "." || segment === ".." || segment.includes("**") && segment !== "**"
26
- ))
27
- throw new Error(
28
- "Invalid sync.exclude rule: use a safe relative path with only *, ?, and whole-segment ** globs."
29
- );
30
- const key = rule.toLowerCase();
31
- if (seen.has(key)) throw new Error("Duplicate sync.exclude rule (case-insensitive).");
32
- seen.add(key);
33
- return rule;
34
- });
35
- return rules.sort((left, right) => {
36
- const a = left.toLowerCase();
37
- const b = right.toLowerCase();
38
- return a < b ? -1 : a > b ? 1 : 0;
39
- });
40
- }
41
- function sameSyncExclude(left, right) {
42
- return JSON.stringify(normalizeSyncExclude(left).map((rule) => rule.toLowerCase())) === JSON.stringify(normalizeSyncExclude(right).map((rule) => rule.toLowerCase()));
43
- }
44
- function compileSyncExclude(value) {
45
- const matchers = normalizeSyncExclude(value).map(
46
- (rule) => (
47
- // A trailing globstar also matches zero segments; ancestor matching owns its subtree.
48
- new Minimatch(rule.replace(/(?:\/\*\*)+$/u, ""), {
49
- dot: true,
50
- nocase: true,
51
- nonegate: true,
52
- nocomment: true,
53
- nobrace: true,
54
- noext: true,
55
- platform: "linux",
56
- optimizationLevel: 0
57
- })
58
- )
59
- );
60
- return (relativePath) => {
61
- if (matchers.length === 0) return false;
62
- for (let candidate = relativePath; candidate; ) {
63
- if (matchers.some((matcher) => matcher.match(candidate))) return true;
64
- const slash = candidate.lastIndexOf("/");
65
- if (slash < 0) break;
66
- candidate = candidate.slice(0, slash);
67
- }
68
- return false;
69
- };
70
- }
71
-
72
- export {
73
- normalizeSyncExclude,
74
- sameSyncExclude,
75
- compileSyncExclude
76
- };
77
- //# sourceMappingURL=chunk-3JTZF7Z5.ts.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/sync/exclude-policy.ts"],
4
- "sourcesContent": ["import path from \"node:path\";\nimport { Minimatch } from \"minimatch\";\n\nconst MAX_RULES = 1_024;\nconst MAX_RULE_BYTES = 4_096;\nconst MAX_TOTAL_BYTES = 256 * 1_024;\n\n/** Exclusions are a set; keep spelling for exact reviews, not filesystem lookup. */\nexport function normalizeSyncExclude(value: unknown): string[] {\n if (value === undefined) return [];\n if (!Array.isArray(value)) throw new Error(\"Invalid pi-sync settings: sync.exclude must be an array.\");\n if (value.length > MAX_RULES) throw new Error(`sync.exclude exceeds ${MAX_RULES} rules.`);\n const seen = new Set<string>();\n let total = 0;\n const rules = value.map((item) => {\n if (typeof item !== \"string\") throw new Error(\"sync.exclude rules must be strings.\");\n const bytes = Buffer.byteLength(item, \"utf8\");\n total += bytes;\n if (bytes > MAX_RULE_BYTES || total > MAX_TOTAL_BYTES) throw new Error(\"sync.exclude exceeds its byte limit.\");\n const rule = item.trim();\n const segments = rule.split(\"/\");\n if (\n !rule ||\n path.posix.isAbsolute(rule) ||\n path.win32.isAbsolute(rule) ||\n /^[a-z]:/iu.test(rule) ||\n rule.includes(\"\\\\\") ||\n // biome-ignore lint/suspicious/noControlCharactersInRegex: Reject untrusted terminal controls.\n /[\\u0000-\\u001f\\u007f-\\u009f]/u.test(item) ||\n /^[!#]/u.test(rule) ||\n /[[\\]{}()]/u.test(rule) ||\n segments.some(\n (segment) => !segment || segment === \".\" || segment === \"..\" || (segment.includes(\"**\") && segment !== \"**\"),\n )\n )\n throw new Error(\n \"Invalid sync.exclude rule: use a safe relative path with only *, ?, and whole-segment ** globs.\",\n );\n const key = rule.toLowerCase();\n if (seen.has(key)) throw new Error(\"Duplicate sync.exclude rule (case-insensitive).\");\n seen.add(key);\n return rule;\n });\n return rules.sort((left, right) => {\n const a = left.toLowerCase();\n const b = right.toLowerCase();\n return a < b ? -1 : a > b ? 1 : 0;\n });\n}\n\nexport function sameSyncExclude(left: unknown, right: unknown) {\n return (\n JSON.stringify(normalizeSyncExclude(left).map((rule) => rule.toLowerCase())) ===\n JSON.stringify(normalizeSyncExclude(right).map((rule) => rule.toLowerCase()))\n );\n}\n\n/** Compile at the operation boundary and reuse for every file/directory. */\nexport function compileSyncExclude(value: unknown) {\n const matchers = normalizeSyncExclude(value).map(\n (rule) =>\n // A trailing globstar also matches zero segments; ancestor matching owns its subtree.\n new Minimatch(rule.replace(/(?:\\/\\*\\*)+$/u, \"\"), {\n dot: true,\n nocase: true,\n nonegate: true,\n nocomment: true,\n nobrace: true,\n noext: true,\n platform: \"linux\",\n optimizationLevel: 0,\n }),\n );\n return (relativePath: string): boolean => {\n if (matchers.length === 0) return false;\n for (let candidate = relativePath; candidate; ) {\n if (matchers.some((matcher) => matcher.match(candidate))) return true;\n const slash = candidate.lastIndexOf(\"/\");\n if (slash < 0) break;\n candidate = candidate.slice(0, slash);\n }\n return false;\n };\n}\n"],
5
- "mappings": ";;;;AAAA,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAE1B,IAAM,YAAY;AAClB,IAAM,iBAAiB;AACvB,IAAM,kBAAkB,MAAM;AAGvB,SAAS,qBAAqB,OAA0B;AAC7D,MAAI,UAAU,OAAW,QAAO,CAAC;AACjC,MAAI,CAAC,MAAM,QAAQ,KAAK,EAAG,OAAM,IAAI,MAAM,0DAA0D;AACrG,MAAI,MAAM,SAAS,UAAW,OAAM,IAAI,MAAM,wBAAwB,SAAS,SAAS;AACxF,QAAM,OAAO,oBAAI,IAAY;AAC7B,MAAI,QAAQ;AACZ,QAAM,QAAQ,MAAM,IAAI,CAAC,SAAS;AAChC,QAAI,OAAO,SAAS,SAAU,OAAM,IAAI,MAAM,qCAAqC;AACnF,UAAM,QAAQ,OAAO,WAAW,MAAM,MAAM;AAC5C,aAAS;AACT,QAAI,QAAQ,kBAAkB,QAAQ,gBAAiB,OAAM,IAAI,MAAM,sCAAsC;AAC7G,UAAM,OAAO,KAAK,KAAK;AACvB,UAAM,WAAW,KAAK,MAAM,GAAG;AAC/B,QACE,CAAC,QACD,KAAK,MAAM,WAAW,IAAI,KAC1B,KAAK,M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Y,cAAc,aAAa;AAC9C,UAAI,SAAS,KAAK,CAAC,YAAY,QAAQ,MAAM,SAAS,CAAC,EAAG,QAAO;AACjE,YAAM,QAAQ,UAAU,YAAY,GAAG;AACvC,UAAI,QAAQ,EAAG;AACf,kBAAY,UAAU,MAAM,GAAG,KAAK;AAAA,IACtC;AACA,WAAO;AAAA,EACT;AACF;",
6
- "names": []
7
- }
@@ -1,21 +0,0 @@
1
- // @generated by scripts/build-runtime.mjs; do not edit.
2
- // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
-
4
- // src/sync/agent-request.ts
5
- var AgentResolutionRequired = class extends Error {
6
- constructor(key, evidence, validate) {
7
- super("Agent resolution requires an unlocked inference phase.");
8
- this.key = key;
9
- this.evidence = evidence;
10
- this.validate = validate;
11
- this.name = "AgentResolutionRequired";
12
- }
13
- key;
14
- evidence;
15
- validate;
16
- };
17
-
18
- export {
19
- AgentResolutionRequired
20
- };
21
- //# sourceMappingURL=chunk-3ST7RSYN.ts.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/sync/agent-request.ts"],
4
- "sourcesContent": ["import type { AgentCandidate, AgentEvidence } from \"./agent-candidate.js\";\n\nexport interface AgentAcceptance {\n key: string;\n candidate: AgentCandidate;\n /** Retry-only cache publication after the full merge/application preflight passes. */\n commitCandidate?: () => Promise<void>;\n}\n/** Internal control flow: the operation lock must unwind before any provider call. */\nexport class AgentResolutionRequired extends Error {\n constructor(\n readonly key: string,\n readonly evidence: AgentEvidence,\n readonly validate: (signal?: AbortSignal) => Promise<void>,\n ) {\n super(\"Agent resolution requires an unlocked inference phase.\");\n this.name = \"AgentResolutionRequired\";\n }\n}\n"],
5
- "mappings": ";;;;AASO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EACjD,YACW,KACA,UACA,UACT;AACA,UAAM,wDAAwD;AAJrD;AACA;AACA;AAGT,SAAK,OAAO;AAAA,EACd;AAAA,EANW;AAAA,EACA;AAAA,EACA;AAKb;",
6
- "names": []
7
- }