@narumitw/pi-sync 0.58.1 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +28 -15
- package/dist/chunks/{chunk-AMJRUXFT.ts → chunk-2JNFEZ3V.ts} +2 -6
- package/dist/chunks/{chunk-AMJRUXFT.ts.map → chunk-2JNFEZ3V.ts.map} +1 -1
- package/dist/chunks/{chunk-MG66XM5U.ts → chunk-4RNCZZY7.ts} +86 -36
- package/dist/chunks/chunk-4RNCZZY7.ts.map +7 -0
- package/dist/chunks/{config-HYG7G5EM.ts → chunk-7AC2RX4M.ts} +6 -12
- package/dist/chunks/chunk-7AC2RX4M.ts.map +7 -0
- package/dist/chunks/{chunk-XEODG2PE.ts → chunk-BGGKHHO4.ts} +18 -14
- package/dist/chunks/{chunk-XEODG2PE.ts.map → chunk-BGGKHHO4.ts.map} +1 -1
- package/dist/chunks/chunk-BWWTOQOW.ts +737 -0
- package/dist/chunks/chunk-BWWTOQOW.ts.map +7 -0
- package/dist/chunks/chunk-CEMFCWIU.ts +20 -0
- package/dist/chunks/chunk-CEMFCWIU.ts.map +7 -0
- package/dist/chunks/chunk-CZNBKIM5.ts +20 -0
- package/dist/chunks/chunk-CZNBKIM5.ts.map +7 -0
- package/dist/chunks/{chunk-YIPK23JW.ts → chunk-ENFHHB5O.ts} +1 -16
- package/dist/chunks/{chunk-YIPK23JW.ts.map → chunk-ENFHHB5O.ts.map} +1 -1
- package/dist/chunks/{chunk-KHBPED6W.ts → chunk-GSQGBVKG.ts} +2 -2
- package/dist/chunks/chunk-HNKLBM3U.ts +18 -0
- package/dist/chunks/chunk-HNKLBM3U.ts.map +7 -0
- package/dist/chunks/{chunk-QPC5HT3A.ts → chunk-J5COV5TY.ts} +21 -2
- package/dist/chunks/chunk-J5COV5TY.ts.map +7 -0
- package/dist/chunks/chunk-JKBUYCPC.ts +52 -0
- package/dist/chunks/chunk-JKBUYCPC.ts.map +7 -0
- package/dist/chunks/chunk-JZKCOM62.ts +26 -0
- package/dist/chunks/chunk-JZKCOM62.ts.map +7 -0
- package/dist/chunks/chunk-M7RHV3H6.ts +33 -0
- package/dist/chunks/chunk-M7RHV3H6.ts.map +7 -0
- package/dist/chunks/{chunk-REMGB255.ts → chunk-MIXZVHFR.ts} +35 -10
- package/dist/chunks/chunk-MIXZVHFR.ts.map +7 -0
- package/dist/chunks/chunk-NPT2G4FU.ts +15 -0
- package/dist/chunks/chunk-NPT2G4FU.ts.map +7 -0
- package/dist/chunks/chunk-PDBTD2K6.ts +11 -0
- package/dist/chunks/chunk-PDBTD2K6.ts.map +7 -0
- package/dist/chunks/chunk-UBE6XWOM.ts +29 -0
- package/dist/chunks/chunk-UBE6XWOM.ts.map +7 -0
- package/dist/chunks/{chunk-JYILGR3K.ts → chunk-UZUUUY7C.ts} +8 -8
- package/dist/chunks/chunk-VZCWYXRS.ts +23 -0
- package/dist/chunks/chunk-VZCWYXRS.ts.map +7 -0
- package/dist/chunks/{chunk-U6GXGY5G.ts → chunk-YWEYRRQI.ts} +45 -37
- package/dist/chunks/chunk-YWEYRRQI.ts.map +7 -0
- package/dist/chunks/{chunk-ECYCNZOE.ts → chunk-ZMNVNECV.ts} +5 -1
- package/dist/chunks/chunk-ZMNVNECV.ts.map +7 -0
- package/dist/chunks/{command-handler-MRXE5AKK.ts → command-handler-3O76V7Q5.ts} +83 -87
- package/dist/chunks/command-handler-3O76V7Q5.ts.map +7 -0
- package/dist/chunks/conflict-review-XBSME2ER.ts +18 -0
- package/dist/chunks/conflict-review-XBSME2ER.ts.map +7 -0
- package/dist/chunks/{continuous-record-EPHGR2DU.ts → continuous-record-ZHUXVO4E.ts} +5 -13
- package/dist/chunks/continuous-record-ZHUXVO4E.ts.map +7 -0
- package/dist/chunks/{file-selection-IELTXSGZ.ts → file-selection-S6CNNNQI.ts} +14 -14
- package/dist/chunks/file-selection-S6CNNNQI.ts.map +7 -0
- package/dist/chunks/manager-result-dispatcher-I2AMCCE7.ts +18 -0
- package/dist/chunks/{manager-ui-AY34N4UY.ts → manager-ui-SJOBTJLY.ts} +221 -147
- package/dist/chunks/manager-ui-SJOBTJLY.ts.map +7 -0
- package/dist/chunks/merge-review-SGDLMVS4.ts +10 -0
- package/dist/chunks/remote-selection-ui-GZHPDQ4L.ts +17 -0
- package/dist/chunks/{setup-switch-KLGESLQX.ts → setup-switch-M3BAFGJM.ts} +9 -12
- package/dist/chunks/{setup-wizard-ZQAK35BP.ts → setup-wizard-NFAWP4KF.ts} +18 -20
- package/dist/chunks/{setup-wizard-ZQAK35BP.ts.map → setup-wizard-NFAWP4KF.ts.map} +1 -1
- package/dist/chunks/{snapshot-RGNDYT6A.ts → snapshot-D4SFDP5J.ts} +8 -12
- package/dist/chunks/snapshot-D4SFDP5J.ts.map +7 -0
- package/dist/chunks/snapshot-transaction-directory-TNKBQ3UQ.ts +13 -0
- package/dist/chunks/snapshot-transaction-directory-TNKBQ3UQ.ts.map +7 -0
- package/dist/chunks/state-directory-JZSZVVPX.ts +17 -0
- package/dist/chunks/sync-inspection-BJ4KPPNO.ts +23 -0
- package/dist/chunks/sync-inspection-BJ4KPPNO.ts.map +7 -0
- package/dist/chunks/sync-operations-TLWER2TT.ts +45 -0
- package/dist/chunks/sync-operations-TLWER2TT.ts.map +7 -0
- package/dist/chunks/{sync-state-7L4NT7W2.ts → sync-state-FVCJJ7MY.ts} +5 -10
- package/dist/chunks/sync-state-FVCJJ7MY.ts.map +7 -0
- package/dist/index.ts +269 -306
- package/dist/index.ts.map +4 -4
- package/docs/daemon-migration.md +93 -0
- package/docs/exclude-policy-audit.md +54 -0
- package/docs/exclude-review-ledger.md +36 -0
- package/docs/tui-contract.md +1 -1
- package/package.json +3 -5
- package/skills/configure-pi-sync/SKILL.md +5 -4
- package/skills/configure-pi-sync/references/configuration.md +91 -19
- package/src/backends/backend-factory.ts +2 -23
- package/src/backends/backend-identity.ts +5 -40
- package/src/backends/backend-types.ts +1 -81
- package/src/backends/git/git-backend.ts +6 -784
- package/src/backends/git/git-config.ts +8 -130
- package/src/backends/git/git-runner.ts +7 -255
- package/src/backends/git/git-storage.ts +14 -292
- package/src/backends/s3/s3-backend.ts +11 -523
- package/src/backends/s3/s3-client.ts +2 -399
- package/src/backends/s3/s3-conditions.ts +2 -67
- package/src/backends/snapshot-pointer.ts +2 -27
- package/src/backends/sync-backend.ts +6 -101
- package/src/backends/webdav/webdav-backend.ts +10 -622
- package/src/backends/webdav/webdav-client.ts +6 -370
- package/src/backends/webdav/webdav-config.ts +8 -82
- package/src/commands/command-execution.ts +42 -38
- package/src/commands/command.ts +23 -1
- package/src/daemon/apply-gate.ts +146 -0
- package/src/daemon/pi-client.ts +591 -0
- package/src/daemon/recovery.ts +103 -0
- package/src/paths.ts +12 -83
- package/src/settings/config-errors.ts +2 -6
- package/src/settings/config-file.ts +19 -693
- package/src/settings/config.ts +16 -257
- package/src/settings/settings-management.ts +11 -253
- package/src/settings/settings-store.ts +10 -48
- package/src/settings/settings-types.ts +1 -154
- package/src/settings/settings-validation.ts +17 -431
- package/src/snapshot/session-paths.ts +11 -110
- package/src/snapshot/snapshot-apply.ts +9 -306
- package/src/snapshot/snapshot-case-replacement.ts +6 -80
- package/src/snapshot/snapshot-codec.ts +2 -50
- package/src/snapshot/snapshot-exclude-safety.ts +2 -0
- package/src/snapshot/snapshot-mutation-queues.ts +6 -142
- package/src/snapshot/snapshot-paths.ts +2 -11
- package/src/snapshot/snapshot-root-transition.ts +6 -154
- package/src/snapshot/snapshot-transaction-directory.ts +5 -16
- package/src/snapshot/snapshot-transaction-plan.ts +2 -72
- package/src/snapshot/snapshot-transaction.ts +6 -934
- package/src/snapshot/snapshot-types.ts +1 -43
- package/src/snapshot/snapshot.ts +18 -405
- package/src/state/json-file.ts +2 -47
- package/src/state/lock-policy.ts +2 -2
- package/src/state/lock.ts +10 -292
- package/src/state/lockfile-fs.ts +2 -25
- package/src/state/merge-baseline-store.ts +8 -200
- package/src/state/mutation-directory-sync.ts +2 -34
- package/src/state/operation-availability.ts +7 -59
- package/src/state/state-directory.ts +8 -243
- package/src/state/state-types.ts +1 -24
- package/src/state/sync-state-store.ts +11 -75
- package/src/sync/agent-candidate.ts +7 -256
- package/src/sync/agent-plan.ts +2 -107
- package/src/sync/agent-policy.ts +10 -13
- package/src/sync/agent-refusal-retry.ts +2 -54
- package/src/sync/agent-request.ts +2 -19
- package/src/sync/agent-runner.ts +2 -191
- package/src/sync/agent-store.ts +7 -182
- package/src/sync/agent-sync.ts +2 -141
- package/src/sync/apply-review.ts +2 -63
- package/src/sync/automatic-sync.ts +55 -106
- package/src/sync/conflict-artifact-ownership.ts +2 -63
- package/src/sync/conflict-artifacts.ts +8 -195
- package/src/sync/conflict-groups.ts +2 -68
- package/src/sync/conflict-preview.ts +2 -56
- package/src/sync/conflict-resolution.ts +2 -93
- package/src/sync/conflict-retention.ts +2 -72
- package/src/sync/conflict-review.ts +3 -92
- package/src/sync/content-conflicts.ts +2 -73
- package/src/sync/continuous-errors.ts +7 -85
- package/src/sync/continuous-lease.ts +2 -216
- package/src/sync/continuous-record.ts +10 -261
- package/src/sync/continuous-storage.ts +12 -64
- package/src/sync/continuous-sync.ts +2 -563
- package/src/sync/continuous-watch.ts +2 -59
- package/src/sync/exclude-policy.ts +6 -0
- package/src/sync/field-migration.ts +2 -39
- package/src/sync/file-merge-planner.ts +2 -143
- package/src/sync/json-document.ts +7 -184
- package/src/sync/local-field-policy.ts +2 -29
- package/src/sync/local-fields.ts +9 -108
- package/src/sync/merge-apply.ts +2 -434
- package/src/sync/merge-journal.ts +10 -219
- package/src/sync/merge-transfer-error.ts +2 -72
- package/src/sync/merged-sync.ts +2 -914
- package/src/sync/mutation-owner.ts +2 -22
- package/src/sync/package-merge.ts +2 -87
- package/src/sync/partial-progress.ts +2 -54
- package/src/sync/remote-snapshot.ts +7 -80
- package/src/sync/session-merge.ts +2 -194
- package/src/sync/settings-conflicts.ts +2 -64
- package/src/sync/settings-merge.ts +6 -121
- package/src/sync/signals.ts +2 -8
- package/src/sync/startup-check.ts +15 -31
- package/src/sync/startup-timings.ts +2 -94
- package/src/sync/sync-decision.ts +3 -101
- package/src/sync/sync-error-guidance.ts +2 -46
- package/src/sync/sync-errors.ts +7 -23
- package/src/sync/sync-inspection.ts +10 -57
- package/src/sync/sync-local.ts +2 -44
- package/src/sync/sync-mutations.ts +10 -781
- package/src/sync/sync-operations.ts +32 -11
- package/src/sync/sync-policy.ts +34 -410
- package/src/sync/sync-queries.ts +2 -237
- package/src/sync/sync-state.ts +18 -151
- package/src/sync/text-merge.ts +10 -133
- package/src/sync-extension.ts +192 -142
- package/src/ui/excluded-paths-ui.ts +106 -0
- package/src/ui/file-selection.ts +6 -3
- package/src/ui/manager-state.ts +11 -5
- package/src/ui/remote-selection-ui.ts +73 -10
- package/src/ui/settings-ui.ts +20 -5
- package/src/ui/setup/setup-actions.ts +1 -1
- package/src/ui/setup/setup-switcher.ts +3 -2
- package/src/ui/storage-connections-ui.ts +2 -2
- package/src/ui/sync-attention.ts +17 -3
- package/src/ui/sync-format.ts +13 -1
- package/dist/chunks/agent-candidate-U2NU3GUX.ts +0 -29
- package/dist/chunks/agent-plan-3YXDIJXO.ts +0 -123
- package/dist/chunks/agent-plan-3YXDIJXO.ts.map +0 -7
- package/dist/chunks/agent-refusal-retry-476YGNU5.ts +0 -72
- package/dist/chunks/agent-refusal-retry-476YGNU5.ts.map +0 -7
- package/dist/chunks/agent-runner-FCRV2Z75.ts +0 -185
- package/dist/chunks/agent-runner-FCRV2Z75.ts.map +0 -7
- package/dist/chunks/agent-store-7GINKTS7.ts +0 -175
- package/dist/chunks/agent-store-7GINKTS7.ts.map +0 -7
- package/dist/chunks/agent-sync-2R4GG2MF.ts +0 -22
- package/dist/chunks/chunk-2JZFHNLM.ts +0 -113
- package/dist/chunks/chunk-2JZFHNLM.ts.map +0 -7
- package/dist/chunks/chunk-3ST7RSYN.ts +0 -21
- package/dist/chunks/chunk-3ST7RSYN.ts.map +0 -7
- package/dist/chunks/chunk-45COPAK7.ts +0 -205
- package/dist/chunks/chunk-45COPAK7.ts.map +0 -7
- package/dist/chunks/chunk-5SFMBY5P.ts +0 -26
- package/dist/chunks/chunk-5SFMBY5P.ts.map +0 -7
- package/dist/chunks/chunk-5TSCBBPP.ts +0 -229
- package/dist/chunks/chunk-5TSCBBPP.ts.map +0 -7
- package/dist/chunks/chunk-6LD5KX55.ts +0 -396
- package/dist/chunks/chunk-6LD5KX55.ts.map +0 -7
- package/dist/chunks/chunk-6O3EDBRL.ts +0 -258
- package/dist/chunks/chunk-6O3EDBRL.ts.map +0 -7
- package/dist/chunks/chunk-7A35ZAVO.ts +0 -1109
- package/dist/chunks/chunk-7A35ZAVO.ts.map +0 -7
- package/dist/chunks/chunk-7D5SF7P3.ts +0 -29
- package/dist/chunks/chunk-7D5SF7P3.ts.map +0 -7
- package/dist/chunks/chunk-7ZIYU5QS.ts +0 -64
- package/dist/chunks/chunk-7ZIYU5QS.ts.map +0 -7
- package/dist/chunks/chunk-AKMV47YC.ts +0 -215
- package/dist/chunks/chunk-AKMV47YC.ts.map +0 -7
- package/dist/chunks/chunk-AR2DGDUI.ts +0 -55
- package/dist/chunks/chunk-AR2DGDUI.ts.map +0 -7
- package/dist/chunks/chunk-BEST45H2.ts +0 -153
- package/dist/chunks/chunk-BEST45H2.ts.map +0 -7
- package/dist/chunks/chunk-CBLTWXAU.ts +0 -114
- package/dist/chunks/chunk-CBLTWXAU.ts.map +0 -7
- package/dist/chunks/chunk-CQD2TJHE.ts +0 -220
- package/dist/chunks/chunk-CQD2TJHE.ts.map +0 -7
- package/dist/chunks/chunk-DN4IA7MR.ts +0 -61
- package/dist/chunks/chunk-DN4IA7MR.ts.map +0 -7
- package/dist/chunks/chunk-DT7M4VQS.ts +0 -69
- package/dist/chunks/chunk-DT7M4VQS.ts.map +0 -7
- package/dist/chunks/chunk-ECYCNZOE.ts.map +0 -7
- package/dist/chunks/chunk-ESKOPQVB.ts +0 -348
- package/dist/chunks/chunk-ESKOPQVB.ts.map +0 -7
- package/dist/chunks/chunk-FHE2DCA2.ts +0 -61
- package/dist/chunks/chunk-FHE2DCA2.ts.map +0 -7
- package/dist/chunks/chunk-FLHCOJCD.ts +0 -57
- package/dist/chunks/chunk-FLHCOJCD.ts.map +0 -7
- package/dist/chunks/chunk-G4RUXRWZ.ts +0 -48
- package/dist/chunks/chunk-G4RUXRWZ.ts.map +0 -7
- package/dist/chunks/chunk-GNYGNHFF.ts +0 -27
- package/dist/chunks/chunk-GNYGNHFF.ts.map +0 -7
- package/dist/chunks/chunk-KYTT7KV4.ts +0 -319
- package/dist/chunks/chunk-KYTT7KV4.ts.map +0 -7
- package/dist/chunks/chunk-M6VQJIOU.ts +0 -54
- package/dist/chunks/chunk-M6VQJIOU.ts.map +0 -7
- package/dist/chunks/chunk-MG66XM5U.ts.map +0 -7
- package/dist/chunks/chunk-MKSMJPVA.ts +0 -107
- package/dist/chunks/chunk-MKSMJPVA.ts.map +0 -7
- package/dist/chunks/chunk-MMQIEDZ6.ts +0 -1994
- package/dist/chunks/chunk-MMQIEDZ6.ts.map +0 -7
- package/dist/chunks/chunk-OJARL2TG.ts +0 -25
- package/dist/chunks/chunk-OJARL2TG.ts.map +0 -7
- package/dist/chunks/chunk-OVBAW7KV.ts +0 -1174
- package/dist/chunks/chunk-OVBAW7KV.ts.map +0 -7
- package/dist/chunks/chunk-PRUEIIK7.ts +0 -24
- package/dist/chunks/chunk-PRUEIIK7.ts.map +0 -7
- package/dist/chunks/chunk-PWMWOJP4.ts +0 -17
- package/dist/chunks/chunk-PWMWOJP4.ts.map +0 -7
- package/dist/chunks/chunk-QPC5HT3A.ts.map +0 -7
- package/dist/chunks/chunk-REMGB255.ts.map +0 -7
- package/dist/chunks/chunk-S5OCYVPS.ts +0 -415
- package/dist/chunks/chunk-S5OCYVPS.ts.map +0 -7
- package/dist/chunks/chunk-SWRVXVFD.ts +0 -248
- package/dist/chunks/chunk-SWRVXVFD.ts.map +0 -7
- package/dist/chunks/chunk-T2SJD3N7.ts +0 -99
- package/dist/chunks/chunk-T2SJD3N7.ts.map +0 -7
- package/dist/chunks/chunk-TIMWN2RH.ts +0 -89
- package/dist/chunks/chunk-TIMWN2RH.ts.map +0 -7
- package/dist/chunks/chunk-TZC7GDJE.ts +0 -58
- package/dist/chunks/chunk-TZC7GDJE.ts.map +0 -7
- package/dist/chunks/chunk-U6GXGY5G.ts.map +0 -7
- package/dist/chunks/chunk-WQMYV4DW.ts +0 -140
- package/dist/chunks/chunk-WQMYV4DW.ts.map +0 -7
- package/dist/chunks/chunk-X7R6DCVF.ts +0 -28
- package/dist/chunks/chunk-X7R6DCVF.ts.map +0 -7
- package/dist/chunks/chunk-XJHQPB3E.ts +0 -107
- package/dist/chunks/chunk-XJHQPB3E.ts.map +0 -7
- package/dist/chunks/chunk-Y4UVXOLQ.ts +0 -123
- package/dist/chunks/chunk-Y4UVXOLQ.ts.map +0 -7
- package/dist/chunks/chunk-YDVQYUHE.ts +0 -34
- package/dist/chunks/chunk-YDVQYUHE.ts.map +0 -7
- package/dist/chunks/chunk-YHT4YTYG.ts +0 -31
- package/dist/chunks/chunk-YHT4YTYG.ts.map +0 -7
- package/dist/chunks/chunk-ZW5ZLGBI.ts +0 -154
- package/dist/chunks/chunk-ZW5ZLGBI.ts.map +0 -7
- package/dist/chunks/command-handler-MRXE5AKK.ts.map +0 -7
- package/dist/chunks/conflict-artifacts-J6WSDCWP.ts +0 -32
- package/dist/chunks/conflict-review-GXA6Y7KY.ts +0 -189
- package/dist/chunks/conflict-review-GXA6Y7KY.ts.map +0 -7
- package/dist/chunks/continuous-sync-FAFNLEUW.ts +0 -585
- package/dist/chunks/continuous-sync-FAFNLEUW.ts.map +0 -7
- package/dist/chunks/file-selection-IELTXSGZ.ts.map +0 -7
- package/dist/chunks/git-backend-KHD36W27.ts +0 -1077
- package/dist/chunks/git-backend-KHD36W27.ts.map +0 -7
- package/dist/chunks/local-fields-JEKAPZKD.ts +0 -26
- package/dist/chunks/local-fields-JEKAPZKD.ts.map +0 -7
- package/dist/chunks/manager-result-dispatcher-XCYPW7RC.ts +0 -32
- package/dist/chunks/manager-result-dispatcher-XCYPW7RC.ts.map +0 -7
- package/dist/chunks/manager-ui-AY34N4UY.ts.map +0 -7
- package/dist/chunks/merge-baseline-store-65GKUMXI.ts +0 -25
- package/dist/chunks/merge-baseline-store-65GKUMXI.ts.map +0 -7
- package/dist/chunks/remote-selection-ui-MYM2YCPF.ts +0 -31
- package/dist/chunks/remote-selection-ui-MYM2YCPF.ts.map +0 -7
- package/dist/chunks/s3-backend-L24UZ6IK.ts +0 -844
- package/dist/chunks/s3-backend-L24UZ6IK.ts.map +0 -7
- package/dist/chunks/setup-switch-KLGESLQX.ts.map +0 -7
- package/dist/chunks/snapshot-RGNDYT6A.ts.map +0 -7
- package/dist/chunks/snapshot-transaction-26BQO36S.ts +0 -24
- package/dist/chunks/snapshot-transaction-26BQO36S.ts.map +0 -7
- package/dist/chunks/sync-inspection-MOMLGUTD.ts +0 -25
- package/dist/chunks/sync-inspection-MOMLGUTD.ts.map +0 -7
- package/dist/chunks/sync-operations-45APGOL3.ts +0 -1021
- package/dist/chunks/sync-operations-45APGOL3.ts.map +0 -7
- package/dist/chunks/sync-state-7L4NT7W2.ts.map +0 -7
- package/dist/chunks/webdav-backend-3ZCACILP.ts +0 -851
- package/dist/chunks/webdav-backend-3ZCACILP.ts.map +0 -7
- /package/dist/chunks/{chunk-KHBPED6W.ts.map → chunk-GSQGBVKG.ts.map} +0 -0
- /package/dist/chunks/{chunk-JYILGR3K.ts.map → chunk-UZUUUY7C.ts.map} +0 -0
- /package/dist/chunks/{agent-candidate-U2NU3GUX.ts.map → manager-result-dispatcher-I2AMCCE7.ts.map} +0 -0
- /package/dist/chunks/{agent-sync-2R4GG2MF.ts.map → merge-review-SGDLMVS4.ts.map} +0 -0
- /package/dist/chunks/{config-HYG7G5EM.ts.map → remote-selection-ui-GZHPDQ4L.ts.map} +0 -0
- /package/dist/chunks/{conflict-artifacts-J6WSDCWP.ts.map → setup-switch-M3BAFGJM.ts.map} +0 -0
- /package/dist/chunks/{continuous-record-EPHGR2DU.ts.map → state-directory-JZSZVVPX.ts.map} +0 -0
|
@@ -1,205 +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
|
-
configFromSettings,
|
|
5
|
-
effectiveSyncSetupRemoteIdentity,
|
|
6
|
-
localConfigPath,
|
|
7
|
-
syncCheckConfigFingerprint,
|
|
8
|
-
syncSetupStorageReview,
|
|
9
|
-
updateLocalConfig,
|
|
10
|
-
validateConfigName
|
|
11
|
-
} from "./chunk-OVBAW7KV.ts";
|
|
12
|
-
import {
|
|
13
|
-
normalizeSyncInclude
|
|
14
|
-
} from "./chunk-KYTT7KV4.ts";
|
|
15
|
-
|
|
16
|
-
// src/settings/settings-management.ts
|
|
17
|
-
import { isDeepStrictEqual } from "node:util";
|
|
18
|
-
var SyncSetupReviewChangedError = class extends Error {
|
|
19
|
-
constructor(message) {
|
|
20
|
-
super(message);
|
|
21
|
-
this.name = "SyncSetupReviewChangedError";
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
async function saveNewV3Settings(input, signal) {
|
|
25
|
-
validateConfigName(input.setupName, "sync setup");
|
|
26
|
-
validateConfigName(input.connectionName, "storage connection");
|
|
27
|
-
const settings = {
|
|
28
|
-
version: 3,
|
|
29
|
-
activeSyncSetup: input.setupName,
|
|
30
|
-
onSwitch: "ask-before-pull",
|
|
31
|
-
skipSecretScan: false,
|
|
32
|
-
storageConnections: { [input.connectionName]: structuredClone(input.connection) },
|
|
33
|
-
syncSetups: {
|
|
34
|
-
[input.setupName]: {
|
|
35
|
-
...structuredClone(input.setup),
|
|
36
|
-
storage: { ...input.setup.storage, connection: input.connectionName }
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
return updateLocalConfig((current) => {
|
|
41
|
-
if (Object.keys(current.storageConnections).length || Object.keys(current.syncSetups).length) {
|
|
42
|
-
throw new Error(`Settings already exist: ${localConfigPath()}`);
|
|
43
|
-
}
|
|
44
|
-
return { ...current, ...settings };
|
|
45
|
-
}, signal);
|
|
46
|
-
}
|
|
47
|
-
async function addStorageConnection(name, connection, signal) {
|
|
48
|
-
validateConfigName(name, "storage connection");
|
|
49
|
-
await updateSettings((settings) => {
|
|
50
|
-
if (Object.hasOwn(settings.storageConnections, name)) {
|
|
51
|
-
throw new Error(`Storage connection already exists: ${name}`);
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
...settings,
|
|
55
|
-
storageConnections: {
|
|
56
|
-
...settings.storageConnections,
|
|
57
|
-
[name]: structuredClone(connection)
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}, signal);
|
|
61
|
-
}
|
|
62
|
-
async function updateStorageConnection(name, update, expectedSetups, signal) {
|
|
63
|
-
validateConfigName(name, "storage connection");
|
|
64
|
-
await updateSettings((settings) => {
|
|
65
|
-
const connection = settings.storageConnections[name];
|
|
66
|
-
if (!connection) throw new Error(`Storage connection not found: ${name}`);
|
|
67
|
-
const currentSetups = referencingSetupNames(settings.syncSetups, name);
|
|
68
|
-
if (expectedSetups && !sameNames(currentSetups, expectedSetups)) {
|
|
69
|
-
throw new Error(
|
|
70
|
-
`Storage connection \u201C${name}\u201D usage changed while it was open; reopen it and review the affected sync setups.`
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
const nextConnection = update(structuredClone(connection));
|
|
74
|
-
const nextConnections = { ...settings.storageConnections, [name]: nextConnection };
|
|
75
|
-
assertUniqueLocations(settings.syncSetups, nextConnections);
|
|
76
|
-
return { ...settings, storageConnections: nextConnections };
|
|
77
|
-
}, signal);
|
|
78
|
-
}
|
|
79
|
-
async function addSyncSetup(name, setup, signal, expectedConnection) {
|
|
80
|
-
validateConfigName(name, "sync setup");
|
|
81
|
-
await updateSettings((settings) => {
|
|
82
|
-
if (Object.hasOwn(settings.syncSetups, name)) throw new Error(`Sync setup already exists: ${name}`);
|
|
83
|
-
if (!Object.hasOwn(settings.storageConnections, setup.storage.connection)) {
|
|
84
|
-
throw new Error(`Storage connection not found: ${setup.storage.connection}`);
|
|
85
|
-
}
|
|
86
|
-
if (expectedConnection && !isDeepStrictEqual(settings.storageConnections[setup.storage.connection], expectedConnection)) {
|
|
87
|
-
throw new SyncSetupReviewChangedError("Storage connection changed while the setup review was open; reopen it.");
|
|
88
|
-
}
|
|
89
|
-
const nextSetups = { ...settings.syncSetups, [name]: structuredClone(setup) };
|
|
90
|
-
assertUniqueLocations(nextSetups, settings.storageConnections);
|
|
91
|
-
return {
|
|
92
|
-
...settings,
|
|
93
|
-
syncSetups: nextSetups,
|
|
94
|
-
...settings.activeSyncSetup ? {} : { activeSyncSetup: name }
|
|
95
|
-
};
|
|
96
|
-
}, signal);
|
|
97
|
-
}
|
|
98
|
-
async function updateSyncSetup(name, update, options = {}) {
|
|
99
|
-
validateConfigName(name, "sync setup");
|
|
100
|
-
await updateSettings((settings) => {
|
|
101
|
-
const setup = settings.syncSetups[name];
|
|
102
|
-
if (!setup) throw new Error(`Sync setup not found: ${name}`);
|
|
103
|
-
if (options.expectedConfigFingerprint !== void 0 && syncCheckConfigFingerprint(configFromSettings(settings, name)) !== options.expectedConfigFingerprint) {
|
|
104
|
-
throw new SyncSetupReviewChangedError(
|
|
105
|
-
`Sync setup \u201C${name}\u201D changed while it was open; reopen it and review the current configuration.`
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
if (options.expectedInclude && !sameNames(normalizeSyncInclude(setup.sync.include), options.expectedInclude)) {
|
|
109
|
-
throw new SyncSetupReviewChangedError(
|
|
110
|
-
`Sync setup \u201C${name}\u201D included content changed while it was open; reopen it and review the current selection.`
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
if (options.expectedStorage) {
|
|
114
|
-
const connectionName = setup.storage.connection;
|
|
115
|
-
const connection = settings.storageConnections[connectionName];
|
|
116
|
-
if (!connection || !sameStorageReview(syncSetupStorageReview(name, setup, connectionName, connection), options.expectedStorage)) {
|
|
117
|
-
throw new SyncSetupReviewChangedError(
|
|
118
|
-
`Sync setup \u201C${name}\u201D storage changed while it was open; reopen it and review the current storage location.`
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (options.expectedConnection && !isDeepStrictEqual(settings.storageConnections[setup.storage.connection], options.expectedConnection)) {
|
|
123
|
-
throw new SyncSetupReviewChangedError("Storage connection changed while the setup review was open; reopen it.");
|
|
124
|
-
}
|
|
125
|
-
const nextSetup = update(structuredClone(setup));
|
|
126
|
-
if (!Object.hasOwn(settings.storageConnections, nextSetup.storage.connection)) {
|
|
127
|
-
throw new Error(`Storage connection not found: ${nextSetup.storage.connection}`);
|
|
128
|
-
}
|
|
129
|
-
const nextSetups = { ...settings.syncSetups, [name]: nextSetup };
|
|
130
|
-
assertUniqueLocations(nextSetups, settings.storageConnections);
|
|
131
|
-
return { ...settings, syncSetups: nextSetups };
|
|
132
|
-
}, options.signal);
|
|
133
|
-
}
|
|
134
|
-
async function removeSyncSetup(name, signal) {
|
|
135
|
-
validateConfigName(name, "sync setup");
|
|
136
|
-
await updateSettings((settings) => {
|
|
137
|
-
if (!Object.hasOwn(settings.syncSetups, name)) throw new Error(`Sync setup not found: ${name}`);
|
|
138
|
-
const isCurrent = settings.activeSyncSetup === name;
|
|
139
|
-
if (isCurrent && Object.keys(settings.syncSetups).length > 1) {
|
|
140
|
-
throw new Error("Switch to another sync setup before removing the current setup.");
|
|
141
|
-
}
|
|
142
|
-
const syncSetups = { ...settings.syncSetups };
|
|
143
|
-
delete syncSetups[name];
|
|
144
|
-
const next = { ...settings, syncSetups };
|
|
145
|
-
if (isCurrent) delete next.activeSyncSetup;
|
|
146
|
-
return next;
|
|
147
|
-
}, signal);
|
|
148
|
-
}
|
|
149
|
-
async function removeStorageConnection(name, signal) {
|
|
150
|
-
validateConfigName(name, "storage connection");
|
|
151
|
-
await updateSettings((settings) => {
|
|
152
|
-
const referenced = referencingSetupNames(settings.syncSetups, name)[0];
|
|
153
|
-
if (referenced) {
|
|
154
|
-
throw new Error(`Storage connection \u201C${name}\u201D is used by sync setup \u201C${referenced}\u201D.`);
|
|
155
|
-
}
|
|
156
|
-
if (!Object.hasOwn(settings.storageConnections, name)) {
|
|
157
|
-
throw new Error(`Storage connection not found: ${name}`);
|
|
158
|
-
}
|
|
159
|
-
const storageConnections = { ...settings.storageConnections };
|
|
160
|
-
delete storageConnections[name];
|
|
161
|
-
return { ...settings, storageConnections };
|
|
162
|
-
}, signal);
|
|
163
|
-
}
|
|
164
|
-
async function updateSettings(update, signal) {
|
|
165
|
-
return updateLocalConfig((settings) => {
|
|
166
|
-
if (settings.version !== 3 && settings.version !== 4 && settings.version !== 5) {
|
|
167
|
-
throw new Error("Storage connections and sync setups require version 3 or 4 or 5 pi-sync settings.");
|
|
168
|
-
}
|
|
169
|
-
return update(settings);
|
|
170
|
-
}, signal);
|
|
171
|
-
}
|
|
172
|
-
function referencingSetupNames(setups, connection) {
|
|
173
|
-
return Object.entries(setups).filter(([, setup]) => setup.storage.connection === connection).map(([name]) => name).sort((left, right) => left.localeCompare(right));
|
|
174
|
-
}
|
|
175
|
-
function assertUniqueLocations(setups, connections) {
|
|
176
|
-
const identities = /* @__PURE__ */ new Map();
|
|
177
|
-
for (const [name, setup] of Object.entries(setups)) {
|
|
178
|
-
const connection = connections[setup.storage.connection];
|
|
179
|
-
if (!connection) throw new Error(`Storage connection not found: ${setup.storage.connection}`);
|
|
180
|
-
const identity = effectiveSyncSetupRemoteIdentity(setup, connection);
|
|
181
|
-
const previous = identities.get(identity);
|
|
182
|
-
if (previous) {
|
|
183
|
-
throw new Error(`Sync setup \u201C${name}\u201D duplicates the storage location of \u201C${previous}\u201D.`);
|
|
184
|
-
}
|
|
185
|
-
identities.set(identity, name);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function sameNames(left, right) {
|
|
189
|
-
return left.length === right.length && left.every((name, index) => name === right[index]);
|
|
190
|
-
}
|
|
191
|
-
function sameStorageReview(left, right) {
|
|
192
|
-
return left.connectionName === right.connectionName && left.storageKind === right.storageKind && left.storagePath === right.storagePath && left.bucket === right.bucket && left.branch === right.branch;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export {
|
|
196
|
-
SyncSetupReviewChangedError,
|
|
197
|
-
saveNewV3Settings,
|
|
198
|
-
addStorageConnection,
|
|
199
|
-
updateStorageConnection,
|
|
200
|
-
addSyncSetup,
|
|
201
|
-
updateSyncSetup,
|
|
202
|
-
removeSyncSetup,
|
|
203
|
-
removeStorageConnection
|
|
204
|
-
};
|
|
205
|
-
//# sourceMappingURL=chunk-45COPAK7.ts.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/settings/settings-management.ts"],
|
|
4
|
-
"sourcesContent": ["import { isDeepStrictEqual } from \"node:util\";\nimport { normalizeSyncInclude } from \"../sync/sync-policy.js\";\nimport {\n configFromSettings,\n type SyncSetupStorageReview,\n syncCheckConfigFingerprint,\n syncSetupStorageReview,\n} from \"./config.js\";\nimport { localConfigPath } from \"./config-file.js\";\nimport { updateLocalConfig } from \"./settings-store.js\";\nimport type { PiSyncSettingsV3, StorageConnectionSettings, SyncSetupSettings } from \"./settings-types.js\";\nimport { effectiveSyncSetupRemoteIdentity, validateConfigName } from \"./settings-validation.js\";\n\nexport class SyncSetupReviewChangedError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"SyncSetupReviewChangedError\";\n }\n}\n\nexport async function saveNewV3Settings(\n input: {\n setupName: string;\n connectionName: string;\n connection: StorageConnectionSettings;\n setup: SyncSetupSettings;\n },\n signal?: AbortSignal,\n) {\n validateConfigName(input.setupName, \"sync setup\");\n validateConfigName(input.connectionName, \"storage connection\");\n const settings: PiSyncSettingsV3 = {\n version: 3,\n activeSyncSetup: input.setupName,\n onSwitch: \"ask-before-pull\",\n skipSecretScan: false,\n storageConnections: { [input.connectionName]: structuredClone(input.connection) },\n syncSetups: {\n [input.setupName]: {\n ...structuredClone(input.setup),\n storage: { ...input.setup.storage, connection: input.connectionName },\n },\n },\n };\n return updateLocalConfig((current) => {\n if (Object.keys(current.storageConnections).length || Object.keys(current.syncSetups).length) {\n throw new Error(`Settings already exist: ${localConfigPath()}`);\n }\n return { ...current, ...settings };\n }, signal);\n}\n\nexport async function addStorageConnection(name: string, connection: StorageConnectionSettings, signal?: AbortSignal) {\n validateConfigName(name, \"storage connection\");\n await updateSettings((settings) => {\n if (Object.hasOwn(settings.storageConnections, name)) {\n throw new Error(`Storage connection already exists: ${name}`);\n }\n return {\n ...settings,\n storageConnections: {\n ...settings.storageConnections,\n [name]: structuredClone(connection),\n },\n };\n }, signal);\n}\n\nexport async function updateStorageConnection(\n name: string,\n update: (connection: StorageConnectionSettings) => StorageConnectionSettings,\n expectedSetups?: readonly string[],\n signal?: AbortSignal,\n) {\n validateConfigName(name, \"storage connection\");\n await updateSettings((settings) => {\n const connection = settings.storageConnections[name];\n if (!connection) throw new Error(`Storage connection not found: ${name}`);\n const currentSetups = referencingSetupNames(settings.syncSetups, name);\n if (expectedSetups && !sameNames(currentSetups, expectedSetups)) {\n throw new Error(\n `Storage connection \u201C${name}\u201D usage changed while it was open; reopen it and review the affected sync setups.`,\n );\n }\n const nextConnection = update(structuredClone(connection));\n const nextConnections = { ...settings.storageConnections, [name]: nextConnection };\n assertUniqueLocations(settings.syncSetups, nextConnections);\n return { ...settings, storageConnections: nextConnections };\n }, signal);\n}\n\nexport async function addSyncSetup(\n name: string,\n setup: SyncSetupSettings,\n signal?: AbortSignal,\n expectedConnection?: StorageConnectionSettings,\n) {\n validateConfigName(name, \"sync setup\");\n await updateSettings((settings) => {\n if (Object.hasOwn(settings.syncSetups, name)) throw new Error(`Sync setup already exists: ${name}`);\n if (!Object.hasOwn(settings.storageConnections, setup.storage.connection)) {\n throw new Error(`Storage connection not found: ${setup.storage.connection}`);\n }\n if (\n expectedConnection &&\n !isDeepStrictEqual(settings.storageConnections[setup.storage.connection], expectedConnection)\n ) {\n throw new SyncSetupReviewChangedError(\"Storage connection changed while the setup review was open; reopen it.\");\n }\n const nextSetups = { ...settings.syncSetups, [name]: structuredClone(setup) };\n assertUniqueLocations(nextSetups, settings.storageConnections);\n return {\n ...settings,\n syncSetups: nextSetups,\n ...(settings.activeSyncSetup ? {} : { activeSyncSetup: name }),\n };\n }, signal);\n}\n\nexport async function updateSyncSetup(\n name: string,\n update: (setup: SyncSetupSettings) => SyncSetupSettings,\n options: {\n expectedStorage?: SyncSetupStorageReview;\n expectedInclude?: readonly string[];\n expectedConnection?: StorageConnectionSettings;\n expectedConfigFingerprint?: string;\n signal?: AbortSignal;\n } = {},\n) {\n validateConfigName(name, \"sync setup\");\n await updateSettings((settings) => {\n const setup = settings.syncSetups[name];\n if (!setup) throw new Error(`Sync setup not found: ${name}`);\n if (\n options.expectedConfigFingerprint !== undefined &&\n syncCheckConfigFingerprint(configFromSettings(settings, name)) !== options.expectedConfigFingerprint\n ) {\n throw new SyncSetupReviewChangedError(\n `Sync setup \u201C${name}\u201D changed while it was open; reopen it and review the current configuration.`,\n );\n }\n if (options.expectedInclude && !sameNames(normalizeSyncInclude(setup.sync.include), options.expectedInclude)) {\n throw new SyncSetupReviewChangedError(\n `Sync setup \u201C${name}\u201D included content changed while it was open; reopen it and review the current selection.`,\n );\n }\n if (options.expectedStorage) {\n const connectionName = setup.storage.connection;\n const connection = settings.storageConnections[connectionName];\n if (\n !connection ||\n !sameStorageReview(syncSetupStorageReview(name, setup, connectionName, connection), options.expectedStorage)\n ) {\n throw new SyncSetupReviewChangedError(\n `Sync setup \u201C${name}\u201D storage changed while it was open; reopen it and review the current storage location.`,\n );\n }\n }\n if (\n options.expectedConnection &&\n !isDeepStrictEqual(settings.storageConnections[setup.storage.connection], options.expectedConnection)\n ) {\n throw new SyncSetupReviewChangedError(\"Storage connection changed while the setup review was open; reopen it.\");\n }\n const nextSetup = update(structuredClone(setup));\n if (!Object.hasOwn(settings.storageConnections, nextSetup.storage.connection)) {\n throw new Error(`Storage connection not found: ${nextSetup.storage.connection}`);\n }\n const nextSetups = { ...settings.syncSetups, [name]: nextSetup };\n assertUniqueLocations(nextSetups, settings.storageConnections);\n return { ...settings, syncSetups: nextSetups };\n }, options.signal);\n}\n\nexport async function removeSyncSetup(name: string, signal?: AbortSignal) {\n validateConfigName(name, \"sync setup\");\n await updateSettings((settings) => {\n if (!Object.hasOwn(settings.syncSetups, name)) throw new Error(`Sync setup not found: ${name}`);\n const isCurrent = settings.activeSyncSetup === name;\n if (isCurrent && Object.keys(settings.syncSetups).length > 1) {\n throw new Error(\"Switch to another sync setup before removing the current setup.\");\n }\n const syncSetups = { ...settings.syncSetups };\n delete syncSetups[name];\n const next = { ...settings, syncSetups };\n if (isCurrent) delete next.activeSyncSetup;\n return next;\n }, signal);\n}\n\nexport async function removeStorageConnection(name: string, signal?: AbortSignal) {\n validateConfigName(name, \"storage connection\");\n await updateSettings((settings) => {\n const referenced = referencingSetupNames(settings.syncSetups, name)[0];\n if (referenced) {\n throw new Error(`Storage connection \u201C${name}\u201D is used by sync setup \u201C${referenced}\u201D.`);\n }\n if (!Object.hasOwn(settings.storageConnections, name)) {\n throw new Error(`Storage connection not found: ${name}`);\n }\n const storageConnections = { ...settings.storageConnections };\n delete storageConnections[name];\n return { ...settings, storageConnections };\n }, signal);\n}\n\nasync function updateSettings(update: (settings: PiSyncSettingsV3) => PiSyncSettingsV3, signal?: AbortSignal) {\n return updateLocalConfig((settings) => {\n if (settings.version !== 3 && settings.version !== 4 && settings.version !== 5) {\n throw new Error(\"Storage connections and sync setups require version 3 or 4 or 5 pi-sync settings.\");\n }\n return update(settings);\n }, signal);\n}\n\nfunction referencingSetupNames(setups: Record<string, SyncSetupSettings>, connection: string) {\n return Object.entries(setups)\n .filter(([, setup]) => setup.storage.connection === connection)\n .map(([name]) => name)\n .sort((left, right) => left.localeCompare(right));\n}\n\nfunction assertUniqueLocations(\n setups: Record<string, SyncSetupSettings>,\n connections: Record<string, StorageConnectionSettings>,\n) {\n const identities = new Map<string, string>();\n for (const [name, setup] of Object.entries(setups)) {\n const connection = connections[setup.storage.connection];\n if (!connection) throw new Error(`Storage connection not found: ${setup.storage.connection}`);\n const identity = effectiveSyncSetupRemoteIdentity(setup, connection);\n const previous = identities.get(identity);\n if (previous) {\n throw new Error(`Sync setup \u201C${name}\u201D duplicates the storage location of \u201C${previous}\u201D.`);\n }\n identities.set(identity, name);\n }\n}\n\nfunction sameNames(left: readonly string[], right: readonly string[]) {\n return left.length === right.length && left.every((name, index) => name === right[index]);\n}\n\nfunction sameStorageReview(left: SyncSetupStorageReview, right: SyncSetupStorageReview) {\n return (\n left.connectionName === right.connectionName &&\n left.storageKind === right.storageKind &&\n left.storagePath === right.storagePath &&\n left.bucket === right.bucket &&\n left.branch === right.branch\n );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AAAA,SAAS,yBAAyB;AAa3B,IAAM,8BAAN,cAA0C,MAAM;AAAA,EACrD,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAEA,eAAsB,kBACpB,OAMA,QACA;AACA,qBAAmB,MAAM,WAAW,YAAY;AAChD,qBAAmB,MAAM,gBAAgB,oBAAoB;AAC7D,QAAM,WAA6B;AAAA,IACjC,SAAS;AAAA,IACT,iBAAiB,MAAM;AAAA,IACvB,UAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,oBAAoB,EAAE,CAAC,MAAM,cAAc,GAAG,gBAAgB,MAAM,UAAU,EAAE;AAAA,IAChF,YAAY;AAAA,MACV,CAAC,MAAM,SAAS,GAAG;AAAA,QACjB,GAAG,gBAAgB,MAAM,KAAK;AAAA,QAC9B,SAAS,EAAE,GAAG,MAAM,MAAM,SAAS,YAAY,MAAM,eAAe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CAAC,WAAY,OAAM,IAAI,MAAM,iCAAiC,MAAM,QAAQ,UAAU,EAAE;AAC5F,UAAM,WAAW,iCAAiC,OAAO,UAAU;AACnE,UAAM,WAAW,WAAW,IAAI,QAAQ;AACxC,QAAI,UAAU;AACZ,YAAM,IAAI,MAAM,oBAAe,IAAI,mDAAyC,QAAQ,SAAI;AAAA,IAC1F;AACA,eAAW,IAAI,UAAU,IAAI;AAAA,EAC/B;AACF;AAEA,SAAS,UAAU,MAAyB,OAA0B;AACpE,SAAO,KAAK,WAAW,MAAM,UAAU,KAAK,MAAM,CAAC,MAAM,UAAU,SAAS,MAAM,KAAK,CAAC;AAC1F;AAEA,SAAS,kBAAkB,MAA8B,OAA+B;AACtF,SACE,KAAK,mBAAmB,MAAM,kBAC9B,KAAK,gBAAgB,MAAM,eAC3B,KAAK,gBAAgB,MAAM,eAC3B,KAAK,WAAW,MAAM,UACtB,KAAK,WAAW,MAAM;AAE1B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,26 +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
|
-
stateDir
|
|
5
|
-
} from "./chunk-SWRVXVFD.ts";
|
|
6
|
-
|
|
7
|
-
// src/snapshot/snapshot-transaction-directory.ts
|
|
8
|
-
import fs from "node:fs/promises";
|
|
9
|
-
import path from "node:path";
|
|
10
|
-
function transactionRoot() {
|
|
11
|
-
return path.join(stateDir(), "transactions");
|
|
12
|
-
}
|
|
13
|
-
async function pendingTransactionEntries() {
|
|
14
|
-
try {
|
|
15
|
-
return await fs.readdir(transactionRoot(), { withFileTypes: true });
|
|
16
|
-
} catch (error) {
|
|
17
|
-
if (error.code === "ENOENT") return [];
|
|
18
|
-
throw error;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
transactionRoot,
|
|
24
|
-
pendingTransactionEntries
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=chunk-5SFMBY5P.ts.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/snapshot/snapshot-transaction-directory.ts"],
|
|
4
|
-
"sourcesContent": ["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { stateDir } from \"../state/state-directory.js\";\n\nexport function transactionRoot() {\n return path.join(stateDir(), \"transactions\");\n}\n\nexport async function pendingTransactionEntries() {\n try {\n return await fs.readdir(transactionRoot(), { withFileTypes: true });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return [];\n throw error;\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAGV,SAAS,kBAAkB;AAChC,SAAO,KAAK,KAAK,SAAS,GAAG,cAAc;AAC7C;AAEA,eAAsB,4BAA4B;AAChD,MAAI;AACF,WAAO,MAAM,GAAG,QAAQ,gBAAgB,GAAG,EAAE,eAAe,KAAK,CAAC;AAAA,EACpE,SAAS,OAAO;AACd,QAAK,MAAgC,SAAS,SAAU,QAAO,CAAC;AAChE,UAAM;AAAA,EACR;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,229 +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
|
-
mergeJournalIdentity
|
|
5
|
-
} from "./chunk-BEST45H2.ts";
|
|
6
|
-
import {
|
|
7
|
-
mergePathIdentity,
|
|
8
|
-
planFileMerge
|
|
9
|
-
} from "./chunk-XJHQPB3E.ts";
|
|
10
|
-
import {
|
|
11
|
-
statePathForConfig,
|
|
12
|
-
syncStateFingerprint
|
|
13
|
-
} from "./chunk-DN4IA7MR.ts";
|
|
14
|
-
import {
|
|
15
|
-
syncDirectory,
|
|
16
|
-
writeJson
|
|
17
|
-
} from "./chunk-AR2DGDUI.ts";
|
|
18
|
-
|
|
19
|
-
// src/sync/conflict-artifacts.ts
|
|
20
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
21
|
-
import fs from "node:fs/promises";
|
|
22
|
-
import path from "node:path";
|
|
23
|
-
|
|
24
|
-
// src/sync/conflict-groups.ts
|
|
25
|
-
function conflictGroups(plan, config) {
|
|
26
|
-
const paths = plan.decisions.map((item) => item.path);
|
|
27
|
-
const parents = paths.map((_, index) => index);
|
|
28
|
-
const ranks = paths.map(() => 0);
|
|
29
|
-
const find = (index) => {
|
|
30
|
-
while (parents[index] !== index) {
|
|
31
|
-
parents[index] = parents[parents[index] ?? index] ?? index;
|
|
32
|
-
index = parents[index] ?? index;
|
|
33
|
-
}
|
|
34
|
-
return index;
|
|
35
|
-
};
|
|
36
|
-
const join = (left, right) => {
|
|
37
|
-
let a = find(left);
|
|
38
|
-
let b = find(right);
|
|
39
|
-
if (a === b) return;
|
|
40
|
-
if ((ranks[a] ?? 0) < (ranks[b] ?? 0)) [a, b] = [b, a];
|
|
41
|
-
parents[b] = a;
|
|
42
|
-
if (ranks[a] === ranks[b]) ranks[a] = (ranks[a] ?? 0) + 1;
|
|
43
|
-
};
|
|
44
|
-
const identities = paths.map(mergePathIdentity);
|
|
45
|
-
const byIdentity = /* @__PURE__ */ new Map();
|
|
46
|
-
const byPath = new Map(paths.map((value, index) => [value, index]));
|
|
47
|
-
identities.forEach((value, index) => {
|
|
48
|
-
const previous = byIdentity.get(value);
|
|
49
|
-
if (previous !== void 0) join(index, previous);
|
|
50
|
-
else byIdentity.set(value, index);
|
|
51
|
-
});
|
|
52
|
-
const includes = new Set(
|
|
53
|
-
config.include.filter((value) => !["settings.json", "AGENTS.md", "sessions"].includes(value)).map(mergePathIdentity)
|
|
54
|
-
);
|
|
55
|
-
const buckets = /* @__PURE__ */ new Map();
|
|
56
|
-
const bucket = (key, index) => {
|
|
57
|
-
const previous = buckets.get(key);
|
|
58
|
-
if (previous === void 0) buckets.set(key, index);
|
|
59
|
-
else join(index, previous);
|
|
60
|
-
};
|
|
61
|
-
paths.forEach((value, index) => {
|
|
62
|
-
const root = value.split("/")[0] ?? "";
|
|
63
|
-
if (["extensions", "themes", "skills", "prompts"].includes(root)) bucket(`resource:${root}`, index);
|
|
64
|
-
const segments = (identities[index] ?? "").split("/");
|
|
65
|
-
let ancestor = "";
|
|
66
|
-
for (let length = 0; length < segments.length - 1; length++) {
|
|
67
|
-
ancestor = ancestor ? `${ancestor}/${segments[length]}` : segments[length] ?? "";
|
|
68
|
-
const parent = byIdentity.get(ancestor);
|
|
69
|
-
if (parent !== void 0) join(index, parent);
|
|
70
|
-
if (includes.has(ancestor)) bucket(`include:${ancestor}`, index);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
const groups = /* @__PURE__ */ new Map();
|
|
74
|
-
for (const conflict of plan.conflicts) {
|
|
75
|
-
const index = byPath.get(conflict.path);
|
|
76
|
-
if (index === void 0) throw new Error("Conflict is missing from managed decisions.");
|
|
77
|
-
const key = find(index);
|
|
78
|
-
const group = groups.get(key) ?? { paths: [], reasons: [] };
|
|
79
|
-
if (!group.reasons.includes(conflict.reason)) group.reasons.push(conflict.reason);
|
|
80
|
-
groups.set(key, group);
|
|
81
|
-
}
|
|
82
|
-
paths.forEach((value, index) => {
|
|
83
|
-
groups.get(find(index))?.paths.push(value);
|
|
84
|
-
});
|
|
85
|
-
return [...groups.values()].map((group) => ({ ...group, paths: group.paths.sort() }));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// src/sync/conflict-artifacts.ts
|
|
89
|
-
var LIMIT = 192 * 1024 * 1024;
|
|
90
|
-
function conflictArtifactFingerprint(artifact) {
|
|
91
|
-
return createHash("sha256").update(JSON.stringify(artifact)).digest("hex");
|
|
92
|
-
}
|
|
93
|
-
function conflictDirectory(config) {
|
|
94
|
-
return `${statePathForConfig(config)}.conflicts`;
|
|
95
|
-
}
|
|
96
|
-
async function directory(config, create = false) {
|
|
97
|
-
const target = conflictDirectory(config);
|
|
98
|
-
if (create) await fs.mkdir(target, { recursive: true, mode: 448 });
|
|
99
|
-
const stat = await fs.lstat(target);
|
|
100
|
-
if (!stat.isDirectory() || stat.isSymbolicLink() || process.platform !== "win32" && (stat.mode & 63) !== 0)
|
|
101
|
-
throw new Error("Unsafe private conflict directory.");
|
|
102
|
-
return target;
|
|
103
|
-
}
|
|
104
|
-
function tokenPath(config, token) {
|
|
105
|
-
if (!/^[a-f0-9-]{36}$/u.test(token)) throw new Error("Invalid conflict token.");
|
|
106
|
-
return path.join(conflictDirectory(config), `${token}.json`);
|
|
107
|
-
}
|
|
108
|
-
async function saveConflictArtifact(config, backend, artifact, validate, onCreated) {
|
|
109
|
-
validate();
|
|
110
|
-
const identity = mergeJournalIdentity(config, backend);
|
|
111
|
-
const local = Object.fromEntries(artifact.local.files.map((file) => [file.path, file.sha256]));
|
|
112
|
-
const remote = Object.fromEntries(artifact.remote.files.map((file) => [file.path, file.sha256]));
|
|
113
|
-
const fingerprint = createHash("sha256").update(
|
|
114
|
-
JSON.stringify([
|
|
115
|
-
identity,
|
|
116
|
-
artifact.groups.map(
|
|
117
|
-
(group) => group.paths.map((filePath) => [
|
|
118
|
-
filePath,
|
|
119
|
-
artifact.state.lastFileHashes[filePath] ?? null,
|
|
120
|
-
local[filePath] ?? null,
|
|
121
|
-
remote[filePath] ?? null
|
|
122
|
-
])
|
|
123
|
-
)
|
|
124
|
-
])
|
|
125
|
-
).digest("hex").slice(0, 32);
|
|
126
|
-
const token = `${fingerprint.slice(0, 8)}-${fingerprint.slice(8, 12)}-${fingerprint.slice(12, 16)}-${fingerprint.slice(16, 20)}-${fingerprint.slice(20)}`;
|
|
127
|
-
await directory(config, true);
|
|
128
|
-
validate();
|
|
129
|
-
const reuse = async () => {
|
|
130
|
-
const existing = await readConflictArtifact(config, backend, token);
|
|
131
|
-
validate();
|
|
132
|
-
const oldLocal = Object.fromEntries(existing.local.files.map((file) => [file.path, file.sha256]));
|
|
133
|
-
const oldRemote = Object.fromEntries(existing.remote.files.map((file) => [file.path, file.sha256]));
|
|
134
|
-
if (JSON.stringify(existing.groups.map((group) => group.paths)) !== JSON.stringify(artifact.groups.map((group) => group.paths)) || artifact.groups.some(
|
|
135
|
-
(group) => group.paths.some(
|
|
136
|
-
(filePath) => existing.state.lastFileHashes[filePath] !== artifact.state.lastFileHashes[filePath] || oldLocal[filePath] !== local[filePath] || oldRemote[filePath] !== remote[filePath]
|
|
137
|
-
)
|
|
138
|
-
))
|
|
139
|
-
throw new Error("Conflict identity does not match retained immutable evidence.");
|
|
140
|
-
return token;
|
|
141
|
-
};
|
|
142
|
-
const target = tokenPath(config, token);
|
|
143
|
-
try {
|
|
144
|
-
await fs.lstat(target);
|
|
145
|
-
validate();
|
|
146
|
-
return await reuse();
|
|
147
|
-
} catch (error) {
|
|
148
|
-
if (error.code !== "ENOENT") throw error;
|
|
149
|
-
}
|
|
150
|
-
const temporary = `${target}.${randomUUID()}.pending`;
|
|
151
|
-
const candidate = { version: 1, identity, ...artifact };
|
|
152
|
-
try {
|
|
153
|
-
await writeJson(temporary, candidate, { maxBytes: LIMIT });
|
|
154
|
-
validate();
|
|
155
|
-
const stat = await fs.lstat(temporary);
|
|
156
|
-
validate();
|
|
157
|
-
try {
|
|
158
|
-
await fs.link(temporary, target);
|
|
159
|
-
} catch (error) {
|
|
160
|
-
if (error.code !== "EEXIST") throw error;
|
|
161
|
-
validate();
|
|
162
|
-
return await reuse();
|
|
163
|
-
}
|
|
164
|
-
onCreated?.({
|
|
165
|
-
token,
|
|
166
|
-
target,
|
|
167
|
-
dev: stat.dev,
|
|
168
|
-
ino: stat.ino,
|
|
169
|
-
size: stat.size,
|
|
170
|
-
fingerprint: conflictArtifactFingerprint(candidate)
|
|
171
|
-
});
|
|
172
|
-
validate();
|
|
173
|
-
await syncDirectory(path.dirname(target));
|
|
174
|
-
validate();
|
|
175
|
-
await syncDirectory(path.dirname(conflictDirectory(config)));
|
|
176
|
-
validate();
|
|
177
|
-
return token;
|
|
178
|
-
} finally {
|
|
179
|
-
await fs.rm(temporary, { force: true });
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
async function readConflictArtifact(config, backend, token) {
|
|
183
|
-
try {
|
|
184
|
-
await directory(config);
|
|
185
|
-
const target = tokenPath(config, token);
|
|
186
|
-
const stat = await fs.lstat(target);
|
|
187
|
-
if (!stat.isFile() || stat.size > LIMIT || process.platform !== "win32" && (stat.mode & 63) !== 0)
|
|
188
|
-
throw new Error("Unsafe conflict artifact.");
|
|
189
|
-
const artifact = JSON.parse(await fs.readFile(target, "utf8"));
|
|
190
|
-
if (artifact.version !== 1 || artifact.identity !== mergeJournalIdentity(config, backend) || !Array.isArray(artifact.groups) || artifact.groups.length > 16384 || artifact.groups.some(
|
|
191
|
-
(group) => !Array.isArray(group.paths) || !group.paths.length || group.paths.length > 16384 || !Array.isArray(group.reasons)
|
|
192
|
-
))
|
|
193
|
-
throw new Error("Invalid conflict artifact.");
|
|
194
|
-
const plan = planFileMerge({
|
|
195
|
-
baseline: artifact.state.lastFileHashes,
|
|
196
|
-
local: artifact.local.files,
|
|
197
|
-
remote: artifact.remote.files,
|
|
198
|
-
selectionCompatible: true
|
|
199
|
-
});
|
|
200
|
-
if (plan.kind !== "planned") throw new Error("Invalid conflict versions.");
|
|
201
|
-
const known = new Set(plan.decisions.map((item) => item.path));
|
|
202
|
-
if (artifact.groups.some((group) => group.paths.some((value) => !known.has(value))))
|
|
203
|
-
throw new Error("Invalid conflict paths.");
|
|
204
|
-
if (artifact.ancestors) {
|
|
205
|
-
if (!Array.isArray(artifact.ancestors) || artifact.ancestors.length > 16384 || artifact.ancestors.some((file) => artifact.state.lastFileHashes[file.path] !== file.sha256))
|
|
206
|
-
throw new Error("Invalid artifact ancestor.");
|
|
207
|
-
const basePlan = planFileMerge({
|
|
208
|
-
baseline: {},
|
|
209
|
-
local: artifact.ancestors,
|
|
210
|
-
remote: [],
|
|
211
|
-
selectionCompatible: true
|
|
212
|
-
});
|
|
213
|
-
if (basePlan.kind !== "planned" || basePlan.conflicts.length) throw new Error("Invalid ancestor bytes.");
|
|
214
|
-
}
|
|
215
|
-
syncStateFingerprint(artifact.state);
|
|
216
|
-
return artifact;
|
|
217
|
-
} catch {
|
|
218
|
-
throw new Error("Cannot verify private conflict artifact; preserve evidence and review a fresh sync.");
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export {
|
|
223
|
-
conflictGroups,
|
|
224
|
-
conflictArtifactFingerprint,
|
|
225
|
-
conflictDirectory,
|
|
226
|
-
saveConflictArtifact,
|
|
227
|
-
readConflictArtifact
|
|
228
|
-
};
|
|
229
|
-
//# sourceMappingURL=chunk-5TSCBBPP.ts.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/sync/conflict-artifacts.ts", "../../src/sync/conflict-groups.ts"],
|
|
4
|
-
"sourcesContent": ["import { createHash, randomUUID } from \"node:crypto\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport type { Snapshot, SnapshotFile } from \"../snapshot/snapshot-types.js\";\nimport { syncDirectory, writeJson } from \"../state/json-file.js\";\nimport type { SyncState } from \"../state/state-types.js\";\nimport { statePathForConfig, syncStateFingerprint } from \"../state/sync-state-store.js\";\nimport { planFileMerge } from \"./file-merge-planner.js\";\n\nexport { conflictGroups } from \"./conflict-groups.js\";\n\nimport { mergeJournalIdentity } from \"./merge-journal.js\";\nexport interface ConflictArtifact {\n version: 1;\n identity: string;\n ancestors?: SnapshotFile[];\n state: SyncState;\n local: Snapshot;\n remote: Snapshot;\n groups: { paths: string[]; reasons: string[] }[];\n observed: { snapshotId: string; revision: string };\n}\nconst LIMIT = 192 * 1024 * 1024;\nexport function conflictArtifactFingerprint(artifact: ConflictArtifact) {\n return createHash(\"sha256\").update(JSON.stringify(artifact)).digest(\"hex\");\n}\nexport function conflictDirectory(config: AnySyncConfig) {\n return `${statePathForConfig(config)}.conflicts`;\n}\nasync function directory(config: AnySyncConfig, create = false) {\n const target = conflictDirectory(config);\n if (create) await fs.mkdir(target, { recursive: true, mode: 0o700 });\n const stat = await fs.lstat(target);\n if (!stat.isDirectory() || stat.isSymbolicLink() || (process.platform !== \"win32\" && (stat.mode & 0o077) !== 0))\n throw new Error(\"Unsafe private conflict directory.\");\n return target;\n}\nfunction tokenPath(config: AnySyncConfig, token: string) {\n if (!/^[a-f0-9-]{36}$/u.test(token)) throw new Error(\"Invalid conflict token.\");\n return path.join(conflictDirectory(config), `${token}.json`);\n}\nexport interface CreatedConflictArtifact {\n token: string;\n target: string;\n dev: number;\n ino: number;\n size: number;\n fingerprint: string;\n}\nexport async function saveConflictArtifact(\n config: AnySyncConfig,\n backend: string,\n artifact: Omit<ConflictArtifact, \"version\" | \"identity\">,\n validate: () => void,\n onCreated?: (created: CreatedConflictArtifact) => void,\n) {\n validate();\n const identity = mergeJournalIdentity(config, backend);\n const local = Object.fromEntries(artifact.local.files.map((file) => [file.path, file.sha256]));\n const remote = Object.fromEntries(artifact.remote.files.map((file) => [file.path, file.sha256]));\n const fingerprint = createHash(\"sha256\")\n .update(\n JSON.stringify([\n identity,\n artifact.groups.map((group) =>\n group.paths.map((filePath) => [\n filePath,\n artifact.state.lastFileHashes[filePath] ?? null,\n local[filePath] ?? null,\n remote[filePath] ?? null,\n ]),\n ),\n ]),\n )\n .digest(\"hex\")\n .slice(0, 32);\n const token = `${fingerprint.slice(0, 8)}-${fingerprint.slice(8, 12)}-${fingerprint.slice(12, 16)}-${fingerprint.slice(16, 20)}-${fingerprint.slice(20)}`;\n await directory(config, true);\n validate();\n const reuse = async () => {\n const existing = await readConflictArtifact(config, backend, token);\n validate();\n const oldLocal = Object.fromEntries(existing.local.files.map((file) => [file.path, file.sha256]));\n const oldRemote = Object.fromEntries(existing.remote.files.map((file) => [file.path, file.sha256]));\n if (\n JSON.stringify(existing.groups.map((group) => group.paths)) !==\n JSON.stringify(artifact.groups.map((group) => group.paths)) ||\n artifact.groups.some((group) =>\n group.paths.some(\n (filePath) =>\n existing.state.lastFileHashes[filePath] !== artifact.state.lastFileHashes[filePath] ||\n oldLocal[filePath] !== local[filePath] ||\n oldRemote[filePath] !== remote[filePath],\n ),\n )\n )\n throw new Error(\"Conflict identity does not match retained immutable evidence.\");\n return token;\n };\n const target = tokenPath(config, token);\n try {\n await fs.lstat(target);\n validate();\n return await reuse();\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n }\n const temporary = `${target}.${randomUUID()}.pending`;\n const candidate: ConflictArtifact = { version: 1, identity, ...artifact };\n try {\n await writeJson(temporary, candidate, { maxBytes: LIMIT });\n validate();\n const stat = await fs.lstat(temporary);\n validate();\n try {\n // Publish immutable evidence without replacing a concurrent/pre-existing owner.\n await fs.link(temporary, target);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"EEXIST\") throw error;\n validate();\n return await reuse();\n }\n // Register ownership before any cancellation or durability await can fail.\n onCreated?.({\n token,\n target,\n dev: stat.dev,\n ino: stat.ino,\n size: stat.size,\n fingerprint: conflictArtifactFingerprint(candidate),\n });\n validate();\n await syncDirectory(path.dirname(target));\n validate();\n await syncDirectory(path.dirname(conflictDirectory(config)));\n validate();\n return token;\n } finally {\n await fs.rm(temporary, { force: true });\n }\n}\nexport async function readConflictArtifact(config: AnySyncConfig, backend: string, token: string) {\n try {\n await directory(config);\n const target = tokenPath(config, token);\n const stat = await fs.lstat(target);\n if (!stat.isFile() || stat.size > LIMIT || (process.platform !== \"win32\" && (stat.mode & 0o077) !== 0))\n throw new Error(\"Unsafe conflict artifact.\");\n const artifact = JSON.parse(await fs.readFile(target, \"utf8\")) as ConflictArtifact;\n if (\n artifact.version !== 1 ||\n artifact.identity !== mergeJournalIdentity(config, backend) ||\n !Array.isArray(artifact.groups) ||\n artifact.groups.length > 16_384 ||\n artifact.groups.some(\n (group) =>\n !Array.isArray(group.paths) ||\n !group.paths.length ||\n group.paths.length > 16_384 ||\n !Array.isArray(group.reasons),\n )\n )\n throw new Error(\"Invalid conflict artifact.\");\n const plan = planFileMerge({\n baseline: artifact.state.lastFileHashes,\n local: artifact.local.files,\n remote: artifact.remote.files,\n selectionCompatible: true,\n });\n if (plan.kind !== \"planned\") throw new Error(\"Invalid conflict versions.\");\n const known = new Set(plan.decisions.map((item) => item.path));\n if (artifact.groups.some((group) => group.paths.some((value) => !known.has(value))))\n throw new Error(\"Invalid conflict paths.\");\n if (artifact.ancestors) {\n if (\n !Array.isArray(artifact.ancestors) ||\n artifact.ancestors.length > 16_384 ||\n artifact.ancestors.some((file) => artifact.state.lastFileHashes[file.path] !== file.sha256)\n )\n throw new Error(\"Invalid artifact ancestor.\");\n const basePlan = planFileMerge({\n baseline: {},\n local: artifact.ancestors,\n remote: [],\n selectionCompatible: true,\n });\n if (basePlan.kind !== \"planned\" || basePlan.conflicts.length) throw new Error(\"Invalid ancestor bytes.\");\n }\n syncStateFingerprint(artifact.state);\n return artifact;\n } catch {\n throw new Error(\"Cannot verify private conflict artifact; preserve evidence and review a fresh sync.\");\n }\n}\n", "import type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { type FileMergePlan, mergePathIdentity } from \"./file-merge-planner.js\";\n\n/** Indexed connected closure; path relationships are identical to the conservative merge policy. */\nexport function conflictGroups(plan: Extract<FileMergePlan, { kind: \"planned\" }>, config: AnySyncConfig) {\n const paths = plan.decisions.map((item) => item.path);\n const parents = paths.map((_, index) => index);\n const ranks = paths.map(() => 0);\n const find = (index: number): number => {\n while (parents[index] !== index) {\n parents[index] = parents[parents[index] ?? index] ?? index;\n index = parents[index] ?? index;\n }\n return index;\n };\n const join = (left: number, right: number) => {\n let a = find(left);\n let b = find(right);\n if (a === b) return;\n if ((ranks[a] ?? 0) < (ranks[b] ?? 0)) [a, b] = [b, a];\n parents[b] = a;\n if (ranks[a] === ranks[b]) ranks[a] = (ranks[a] ?? 0) + 1;\n };\n const identities = paths.map(mergePathIdentity);\n const byIdentity = new Map<string, number>();\n const byPath = new Map(paths.map((value, index) => [value, index]));\n identities.forEach((value, index) => {\n const previous = byIdentity.get(value);\n if (previous !== undefined) join(index, previous);\n else byIdentity.set(value, index);\n });\n const includes = new Set(\n config.include\n .filter((value) => ![\"settings.json\", \"AGENTS.md\", \"sessions\"].includes(value))\n .map(mergePathIdentity),\n );\n const buckets = new Map<string, number>();\n const bucket = (key: string, index: number) => {\n const previous = buckets.get(key);\n if (previous === undefined) buckets.set(key, index);\n else join(index, previous);\n };\n paths.forEach((value, index) => {\n const root = value.split(\"/\")[0] ?? \"\";\n if ([\"extensions\", \"themes\", \"skills\", \"prompts\"].includes(root)) bucket(`resource:${root}`, index);\n const segments = (identities[index] ?? \"\").split(\"/\");\n let ancestor = \"\";\n for (let length = 0; length < segments.length - 1; length++) {\n ancestor = ancestor ? `${ancestor}/${segments[length]}` : (segments[length] ?? \"\");\n const parent = byIdentity.get(ancestor);\n if (parent !== undefined) join(index, parent);\n if (includes.has(ancestor)) bucket(`include:${ancestor}`, index);\n }\n });\n const groups = new Map<number, { paths: string[]; reasons: string[] }>();\n for (const conflict of plan.conflicts) {\n const index = byPath.get(conflict.path);\n if (index === undefined) throw new Error(\"Conflict is missing from managed decisions.\");\n const key = find(index);\n const group = groups.get(key) ?? { paths: [], reasons: [] };\n if (!group.reasons.includes(conflict.reason)) group.reasons.push(conflict.reason);\n groups.set(key, group);\n }\n paths.forEach((value, index) => {\n groups.get(find(index))?.paths.push(value);\n });\n return [...groups.values()].map((group) => ({ ...group, paths: group.paths.sort() }));\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,kBAAkB;AACvC,OAAO,QAAQ;AACf,OAAO,UAAU;;;ACEV,SAAS,eAAe,MAAmD,QAAuB;AACvG,QA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