@narumitw/pi-sync 0.61.0 → 0.63.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 +25 -0
- package/README.md +46 -25
- package/dist/chunks/{chunk-277VHM2P.ts → chunk-27F5W7DX.ts} +7 -3
- package/dist/chunks/chunk-27F5W7DX.ts.map +7 -0
- package/dist/chunks/{chunk-ZIL6PW5L.ts → chunk-6YKOHBSC.ts} +2 -2
- package/dist/chunks/{chunk-OA4NZLSL.ts → chunk-APZVJAEW.ts} +4 -3
- package/dist/chunks/chunk-CKUGCBHP.ts +114 -0
- package/dist/chunks/chunk-CKUGCBHP.ts.map +7 -0
- package/dist/chunks/chunk-EJDDRS6O.ts +17 -0
- package/dist/chunks/chunk-EJDDRS6O.ts.map +7 -0
- package/dist/chunks/{chunk-JVFCVPPD.ts → chunk-EXDWEFIJ.ts} +87 -147
- package/dist/chunks/chunk-EXDWEFIJ.ts.map +7 -0
- package/dist/chunks/{chunk-4SR3ZYHA.ts → chunk-GELYN4UC.ts} +2 -2
- package/dist/chunks/{chunk-2ZGV5KNC.ts → chunk-HSCAFOT5.ts} +15 -12
- package/dist/chunks/chunk-HSCAFOT5.ts.map +7 -0
- package/dist/chunks/{chunk-YQSFJLJ3.ts → chunk-IBXEM35O.ts} +4 -3
- package/dist/chunks/{chunk-2JHAN3ZO.ts → chunk-JREGWM2B.ts} +3 -3
- package/dist/chunks/chunk-MANNB4WZ.ts +36 -0
- package/dist/chunks/chunk-MANNB4WZ.ts.map +7 -0
- package/dist/chunks/{chunk-EMRFVLZM.ts → chunk-NXWHPVXR.ts} +2 -2
- package/dist/chunks/{chunk-SMVKMYLK.ts → chunk-P4GI7LTT.ts} +2 -2
- package/dist/chunks/{chunk-ZVGRZD4C.ts → chunk-R3SAMXB6.ts} +2 -2
- package/dist/chunks/{chunk-4KTJLJSJ.ts → chunk-S6FUUWV5.ts} +148 -21
- package/dist/chunks/chunk-S6FUUWV5.ts.map +7 -0
- package/dist/chunks/{chunk-PJMM75W5.ts → chunk-SXCH4Q5O.ts} +41 -23
- package/dist/chunks/chunk-SXCH4Q5O.ts.map +7 -0
- package/dist/chunks/{chunk-RNIEVDTR.ts → chunk-T3LABNHF.ts} +2 -2
- package/dist/chunks/{chunk-E3YLRLJM.ts → chunk-UGS6RYDZ.ts} +14 -12
- package/dist/chunks/chunk-UGS6RYDZ.ts.map +7 -0
- package/dist/chunks/{chunk-S3R3W3KF.ts → chunk-UMPA5S7X.ts} +2 -2
- package/dist/chunks/{chunk-EMVZL4PH.ts → chunk-V76KCWHO.ts} +7 -5
- package/dist/chunks/{chunk-EMVZL4PH.ts.map → chunk-V76KCWHO.ts.map} +1 -1
- package/dist/chunks/{chunk-S7F4FOAS.ts → chunk-VQ47JBLF.ts} +5 -5
- package/dist/chunks/{chunk-WP2M67XZ.ts → chunk-WBIOSK76.ts} +2 -2
- package/dist/chunks/chunk-WFBHWYI6.ts +18 -0
- package/dist/chunks/chunk-WFBHWYI6.ts.map +7 -0
- package/dist/chunks/{chunk-HEB6YT64.ts → chunk-ZO52JM4H.ts} +2 -2
- package/dist/chunks/{command-handler-K4XJOGYC.ts → command-handler-VINMQ7ZM.ts} +26 -43
- package/dist/chunks/command-handler-VINMQ7ZM.ts.map +7 -0
- package/dist/chunks/{conflict-review-IGKY2TOJ.ts → conflict-review-PCDFRIVB.ts} +4 -4
- package/dist/chunks/{continuous-record-3XDXDOMV.ts → continuous-record-3SKJ6I3V.ts} +2 -2
- package/dist/chunks/{continuous-storage-HLKCHF6Z.ts → continuous-storage-3EU6I7Z3.ts} +2 -2
- package/dist/chunks/{file-selection-MGGVOKM7.ts → file-selection-KID23GAD.ts} +21 -14
- package/dist/chunks/file-selection-KID23GAD.ts.map +7 -0
- package/dist/chunks/manager-result-dispatcher-GDB74IOP.ts +20 -0
- package/dist/chunks/{manager-ui-KYQ5AZJS.ts → manager-ui-YHDECYKI.ts} +454 -167
- package/dist/chunks/manager-ui-YHDECYKI.ts.map +7 -0
- package/dist/chunks/remote-selection-ui-GPITNEBF.ts +19 -0
- package/dist/chunks/{setup-switch-D6K6PBPC.ts → setup-switch-L54X5U5I.ts} +7 -7
- package/dist/chunks/{setup-wizard-4DYUDHJR.ts → setup-wizard-YO4MCPUF.ts} +15 -11
- package/dist/chunks/{setup-wizard-4DYUDHJR.ts.map → setup-wizard-YO4MCPUF.ts.map} +1 -1
- package/dist/chunks/{snapshot-5HY3M2NL.ts → snapshot-ZUJJZCFW.ts} +2 -2
- package/dist/chunks/{snapshot-transaction-directory-OU2D7R7A.ts → snapshot-transaction-directory-F46JWRAU.ts} +2 -2
- package/dist/chunks/{state-directory-XXHU73Z3.ts → state-directory-CMAIF34J.ts} +2 -2
- package/dist/chunks/{sync-inspection-J3CRBORL.ts → sync-inspection-H2WX5SUT.ts} +5 -5
- package/dist/chunks/{sync-operations-BVWYYKH3.ts → sync-operations-2MZAYHL2.ts} +13 -9
- package/dist/chunks/sync-operations-2MZAYHL2.ts.map +7 -0
- package/dist/chunks/{sync-state-2LMIXJ2C.ts → sync-state-QIT64TKV.ts} +2 -2
- package/dist/daemon/LICENSE +21 -0
- package/dist/daemon/dist/build-version.js +8 -0
- package/dist/daemon/dist/child-sdk.mjs +17 -0
- package/dist/daemon/dist/cli.js +169 -0
- package/dist/daemon/dist/client.js +909 -0
- package/dist/daemon/dist/consent.js +383 -0
- package/dist/daemon/dist/document.js +6 -0
- package/dist/daemon/dist/endpoint.js +91 -0
- package/dist/daemon/dist/engine/backends/backend-factory.js +16 -0
- package/dist/daemon/dist/engine/backends/backend-identity.js +38 -0
- package/dist/daemon/dist/engine/backends/backend-types.js +1 -0
- package/dist/daemon/dist/engine/backends/git/git-backend.js +746 -0
- package/dist/daemon/dist/engine/backends/git/git-config.js +118 -0
- package/dist/daemon/dist/engine/backends/git/git-runner.js +232 -0
- package/dist/daemon/dist/engine/backends/git/git-storage.js +252 -0
- package/dist/daemon/dist/engine/backends/s3/s3-backend.js +444 -0
- package/dist/daemon/dist/engine/backends/s3/s3-client.js +352 -0
- package/dist/daemon/dist/engine/backends/s3/s3-conditions.js +66 -0
- package/dist/daemon/dist/engine/backends/snapshot-pointer.js +22 -0
- package/dist/daemon/dist/engine/backends/sync-backend.js +23 -0
- package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +542 -0
- package/dist/daemon/dist/engine/backends/webdav/webdav-client.js +326 -0
- package/dist/daemon/dist/engine/backends/webdav/webdav-config.js +73 -0
- package/dist/daemon/dist/engine/commands/command-types.js +1 -0
- package/dist/daemon/dist/engine/host.js +16 -0
- package/dist/daemon/dist/engine/ignore/effective-ignore-policy.js +33 -0
- package/dist/daemon/dist/engine/ignore/ignore-edit.js +102 -0
- package/dist/daemon/dist/engine/ignore/ignore-initialization.js +252 -0
- package/dist/daemon/dist/engine/ignore/ignore-migration-prompt.js +139 -0
- package/dist/daemon/dist/engine/ignore/ignore-settings.js +393 -0
- package/dist/daemon/dist/engine/ignore/ignore-source.js +250 -0
- package/dist/daemon/dist/engine/paths.js +71 -0
- package/dist/daemon/dist/engine/settings/config-errors.js +4 -0
- package/dist/daemon/dist/engine/settings/config-file.js +736 -0
- package/dist/daemon/dist/engine/settings/config.js +344 -0
- package/dist/daemon/dist/engine/settings/settings-management.js +199 -0
- package/dist/daemon/dist/engine/settings/settings-store.js +41 -0
- package/dist/daemon/dist/engine/settings/settings-types.js +1 -0
- package/dist/daemon/dist/engine/settings/settings-validation.js +384 -0
- package/dist/daemon/dist/engine/snapshot/session-paths.js +165 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-apply.js +348 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-bounds.js +20 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-case-replacement.js +82 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-codec.js +61 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-entry-projection.js +78 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-exclude-safety.js +262 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-mutation-queues.js +133 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-paths.js +11 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-payload.js +10 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-reviewed-preimages.js +60 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-root-transition.js +138 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction-directory.js +16 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction-images.js +387 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction-plan.js +68 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction-policy.js +296 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction-stage.js +303 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction-verification.js +78 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction.js +855 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-types.js +9 -0
- package/dist/daemon/dist/engine/snapshot/snapshot.js +678 -0
- package/dist/daemon/dist/engine/state/json-file.js +49 -0
- package/dist/daemon/dist/engine/state/lock-policy.js +2 -0
- package/dist/daemon/dist/engine/state/lock.js +259 -0
- package/dist/daemon/dist/engine/state/lockfile-fs.js +13 -0
- package/dist/daemon/dist/engine/state/merge-baseline-store.js +198 -0
- package/dist/daemon/dist/engine/state/mutation-directory-sync.js +34 -0
- package/dist/daemon/dist/engine/state/operation-availability.js +40 -0
- package/dist/daemon/dist/engine/state/state-directory.js +227 -0
- package/dist/daemon/dist/engine/state/state-types.js +1 -0
- package/dist/daemon/dist/engine/state/sync-state-store.js +54 -0
- package/dist/daemon/dist/engine/sync/agent-candidate.js +207 -0
- package/dist/daemon/dist/engine/sync/agent-plan.js +85 -0
- package/dist/daemon/dist/engine/sync/agent-policy.js +10 -0
- package/dist/daemon/dist/engine/sync/agent-refusal-retry.js +39 -0
- package/dist/daemon/dist/engine/sync/agent-request.js +13 -0
- package/dist/daemon/dist/engine/sync/agent-runner.js +183 -0
- package/dist/daemon/dist/engine/sync/agent-store.js +177 -0
- package/dist/daemon/dist/engine/sync/agent-sync.js +139 -0
- package/dist/daemon/dist/engine/sync/apply-review.js +52 -0
- package/dist/daemon/dist/engine/sync/conflict-artifact-ownership.js +53 -0
- package/dist/daemon/dist/engine/sync/conflict-artifacts.js +158 -0
- package/dist/daemon/dist/engine/sync/conflict-groups.js +76 -0
- package/dist/daemon/dist/engine/sync/conflict-preview.js +53 -0
- package/dist/daemon/dist/engine/sync/conflict-resolution.js +53 -0
- package/dist/daemon/dist/engine/sync/conflict-retention.js +61 -0
- package/dist/daemon/dist/engine/sync/conflict-review.js +73 -0
- package/dist/daemon/dist/engine/sync/content-conflicts.js +70 -0
- package/dist/daemon/dist/engine/sync/continuous-errors.js +66 -0
- package/dist/daemon/dist/engine/sync/continuous-lease.js +206 -0
- package/dist/daemon/dist/engine/sync/continuous-record.js +199 -0
- package/dist/daemon/dist/engine/sync/continuous-storage.js +59 -0
- package/dist/daemon/dist/engine/sync/continuous-sync.js +538 -0
- package/dist/daemon/dist/engine/sync/continuous-watch.js +140 -0
- package/dist/daemon/dist/engine/sync/exclude-policy.js +86 -0
- package/dist/daemon/dist/engine/sync/field-migration.js +20 -0
- package/dist/daemon/dist/engine/sync/file-merge-planner.js +123 -0
- package/dist/daemon/dist/engine/sync/initialization.js +80 -0
- package/dist/daemon/dist/engine/sync/json-document.js +172 -0
- package/dist/daemon/dist/engine/sync/local-field-policy.js +26 -0
- package/dist/daemon/dist/engine/sync/local-fields.js +196 -0
- package/dist/daemon/dist/engine/sync/merge-acceptance.js +29 -0
- package/dist/daemon/dist/engine/sync/merge-apply.js +532 -0
- package/dist/daemon/dist/engine/sync/merge-journal.js +314 -0
- package/dist/daemon/dist/engine/sync/merge-transfer-error.js +64 -0
- package/dist/daemon/dist/engine/sync/merged-sync.js +666 -0
- package/dist/daemon/dist/engine/sync/mutation-owner.js +18 -0
- package/dist/daemon/dist/engine/sync/package-merge.js +82 -0
- package/dist/daemon/dist/engine/sync/partial-progress.js +41 -0
- package/dist/daemon/dist/engine/sync/remote-snapshot.js +119 -0
- package/dist/daemon/dist/engine/sync/resolver-stream.js +34 -0
- package/dist/daemon/dist/engine/sync/session-merge.js +178 -0
- package/dist/daemon/dist/engine/sync/session-push.js +47 -0
- package/dist/daemon/dist/engine/sync/settings-conflicts.js +56 -0
- package/dist/daemon/dist/engine/sync/settings-merge.js +93 -0
- package/dist/daemon/dist/engine/sync/signals.js +8 -0
- package/dist/daemon/dist/engine/sync/startup-timings.js +44 -0
- package/dist/daemon/dist/engine/sync/sync-decision.js +81 -0
- package/dist/daemon/dist/engine/sync/sync-error-guidance.js +55 -0
- package/dist/daemon/dist/engine/sync/sync-errors.js +18 -0
- package/dist/daemon/dist/engine/sync/sync-inspection.js +42 -0
- package/dist/daemon/dist/engine/sync/sync-loaders.js +8 -0
- package/dist/daemon/dist/engine/sync/sync-local.js +40 -0
- package/dist/daemon/dist/engine/sync/sync-mutations.js +754 -0
- package/dist/daemon/dist/engine/sync/sync-operations.js +3 -0
- package/dist/daemon/dist/engine/sync/sync-policy.js +646 -0
- package/dist/daemon/dist/engine/sync/sync-queries.js +212 -0
- package/dist/daemon/dist/engine/sync/sync-state.js +124 -0
- package/dist/daemon/dist/engine/sync/text-merge.js +124 -0
- package/dist/daemon/dist/engine/sync/transfer-freshness.js +82 -0
- package/dist/daemon/dist/engine/types.js +2 -0
- package/dist/daemon/dist/engine/ui/merge-review.js +7 -0
- package/dist/daemon/dist/engine/ui/merged-sync-summary.js +86 -0
- package/dist/daemon/dist/engine/ui/sync-format.js +165 -0
- package/dist/daemon/dist/engine/ui/sync-status.js +30 -0
- package/dist/daemon/dist/engine/ui/terminal-text.js +9 -0
- package/dist/daemon/dist/engine/ui/transfer-changes.js +24 -0
- package/dist/daemon/dist/engine/ui/transfer-review.js +19 -0
- package/dist/daemon/dist/engine-service.js +441 -0
- package/dist/daemon/dist/identity.js +241 -0
- package/dist/daemon/dist/idle-exit.js +77 -0
- package/dist/daemon/dist/index.js +4 -0
- package/dist/daemon/dist/lifecycle-log.js +53 -0
- package/dist/daemon/dist/lifecycle.js +21 -0
- package/dist/daemon/dist/model-signature.js +7 -0
- package/dist/daemon/dist/monitor.js +324 -0
- package/dist/daemon/dist/participant-admission.js +30 -0
- package/dist/daemon/dist/protocol.js +104 -0
- package/dist/daemon/dist/resolver-host.js +78 -0
- package/dist/daemon/dist/server.js +994 -0
- package/dist/daemon/dist/service-host.js +175 -0
- package/dist/daemon/dist/upgrade-repair.js +55 -0
- package/dist/daemon/package.json +3 -0
- package/dist/index.ts +40 -37
- package/dist/index.ts.map +4 -4
- package/dist/package.json +6 -0
- package/docs/daemon-migration.md +27 -16
- package/package.json +9 -3
- package/skills/configure-pi-sync/SKILL.md +24 -46
- package/skills/configure-pi-sync/references/configuration.md +62 -22
- package/src/commands/command-execution.ts +13 -9
- package/src/commands/command-types.ts +1 -0
- package/src/daemon/pi-client.ts +4 -2
- package/src/settings/config.ts +2 -0
- package/src/sync/automatic-sync.ts +9 -2
- package/src/sync/setup-switch.ts +38 -15
- package/src/sync/startup-check.ts +7 -4
- package/src/sync/sync-operations.ts +18 -10
- package/src/ui/excluded-paths-ui.ts +6 -3
- package/src/ui/file-selection.ts +7 -2
- package/src/ui/ignore-file-guidance.ts +7 -0
- package/src/ui/ignore-file-ui.ts +97 -0
- package/src/ui/ignore-migration-prompt.ts +65 -0
- package/src/ui/manager-state.ts +40 -14
- package/src/ui/manager-ui.ts +41 -19
- package/src/ui/remote-selection-ui.ts +88 -28
- package/src/ui/settings-review.ts +26 -0
- package/src/ui/settings-ui.ts +378 -224
- package/src/ui/setup/setup-actions.ts +16 -4
- package/src/ui/setup/setup-prompts.ts +55 -9
- package/src/ui/setup/setup-switcher.ts +24 -11
- package/src/ui/storage-connections-ui.ts +50 -20
- package/src/ui/sync-setups-ui.ts +65 -30
- package/dist/chunks/chunk-277VHM2P.ts.map +0 -7
- package/dist/chunks/chunk-2ZGV5KNC.ts.map +0 -7
- package/dist/chunks/chunk-4KTJLJSJ.ts.map +0 -7
- package/dist/chunks/chunk-E3YLRLJM.ts.map +0 -7
- package/dist/chunks/chunk-ECYCNZOE.ts +0 -12
- package/dist/chunks/chunk-ECYCNZOE.ts.map +0 -7
- package/dist/chunks/chunk-JVFCVPPD.ts.map +0 -7
- package/dist/chunks/chunk-PJMM75W5.ts.map +0 -7
- package/dist/chunks/command-handler-K4XJOGYC.ts.map +0 -7
- package/dist/chunks/file-selection-MGGVOKM7.ts.map +0 -7
- package/dist/chunks/manager-result-dispatcher-4VJVDEUD.ts +0 -19
- package/dist/chunks/manager-ui-KYQ5AZJS.ts.map +0 -7
- package/dist/chunks/remote-selection-ui-W3KOZM3W.ts +0 -18
- package/dist/chunks/sync-operations-BVWYYKH3.ts.map +0 -7
- /package/dist/chunks/{chunk-ZIL6PW5L.ts.map → chunk-6YKOHBSC.ts.map} +0 -0
- /package/dist/chunks/{chunk-OA4NZLSL.ts.map → chunk-APZVJAEW.ts.map} +0 -0
- /package/dist/chunks/{chunk-4SR3ZYHA.ts.map → chunk-GELYN4UC.ts.map} +0 -0
- /package/dist/chunks/{chunk-YQSFJLJ3.ts.map → chunk-IBXEM35O.ts.map} +0 -0
- /package/dist/chunks/{chunk-2JHAN3ZO.ts.map → chunk-JREGWM2B.ts.map} +0 -0
- /package/dist/chunks/{chunk-EMRFVLZM.ts.map → chunk-NXWHPVXR.ts.map} +0 -0
- /package/dist/chunks/{chunk-SMVKMYLK.ts.map → chunk-P4GI7LTT.ts.map} +0 -0
- /package/dist/chunks/{chunk-ZVGRZD4C.ts.map → chunk-R3SAMXB6.ts.map} +0 -0
- /package/dist/chunks/{chunk-RNIEVDTR.ts.map → chunk-T3LABNHF.ts.map} +0 -0
- /package/dist/chunks/{chunk-S3R3W3KF.ts.map → chunk-UMPA5S7X.ts.map} +0 -0
- /package/dist/chunks/{chunk-S7F4FOAS.ts.map → chunk-VQ47JBLF.ts.map} +0 -0
- /package/dist/chunks/{chunk-WP2M67XZ.ts.map → chunk-WBIOSK76.ts.map} +0 -0
- /package/dist/chunks/{chunk-HEB6YT64.ts.map → chunk-ZO52JM4H.ts.map} +0 -0
- /package/dist/chunks/{conflict-review-IGKY2TOJ.ts.map → conflict-review-PCDFRIVB.ts.map} +0 -0
- /package/dist/chunks/{continuous-record-3XDXDOMV.ts.map → continuous-record-3SKJ6I3V.ts.map} +0 -0
- /package/dist/chunks/{continuous-storage-HLKCHF6Z.ts.map → continuous-storage-3EU6I7Z3.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-4VJVDEUD.ts.map → manager-result-dispatcher-GDB74IOP.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-W3KOZM3W.ts.map → remote-selection-ui-GPITNEBF.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-D6K6PBPC.ts.map → setup-switch-L54X5U5I.ts.map} +0 -0
- /package/dist/chunks/{snapshot-5HY3M2NL.ts.map → snapshot-ZUJJZCFW.ts.map} +0 -0
- /package/dist/chunks/{snapshot-transaction-directory-OU2D7R7A.ts.map → snapshot-transaction-directory-F46JWRAU.ts.map} +0 -0
- /package/dist/chunks/{state-directory-XXHU73Z3.ts.map → state-directory-CMAIF34J.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-J3CRBORL.ts.map → sync-inspection-H2WX5SUT.ts.map} +0 -0
- /package/dist/chunks/{sync-state-2LMIXJ2C.ts.map → sync-state-QIT64TKV.ts.map} +0 -0
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
applyS3CredentialUpdate,
|
|
5
5
|
chooseS3CredentialUpdate,
|
|
6
6
|
chooseS3Credentials,
|
|
7
|
+
ignoreFileSettingsAvailable,
|
|
7
8
|
promptResourceName,
|
|
8
9
|
refreshTargetCompletions,
|
|
9
10
|
requiredInput,
|
|
@@ -17,39 +18,44 @@ import {
|
|
|
17
18
|
showEditGitTarget,
|
|
18
19
|
showEditS3Target,
|
|
19
20
|
showEditWebDavStorageProfile,
|
|
20
|
-
showEditWebDavTarget
|
|
21
|
-
|
|
21
|
+
showEditWebDavTarget,
|
|
22
|
+
showIgnoreFileAction
|
|
23
|
+
} from "./chunk-S6FUUWV5.ts";
|
|
22
24
|
import {
|
|
23
25
|
dispatchManagerResult
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-V76KCWHO.ts";
|
|
25
27
|
import {
|
|
26
28
|
SETUP_SWITCH_ACTION_OPTIONS,
|
|
27
29
|
saveOnSwitch,
|
|
28
30
|
setupSwitchActionFromLabel,
|
|
29
31
|
setupSwitchActionLabel,
|
|
30
32
|
useSyncSetup
|
|
31
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-SXCH4Q5O.ts";
|
|
32
34
|
import {
|
|
33
35
|
isCloudflareR2Endpoint,
|
|
34
36
|
normalizeS3Endpoint,
|
|
35
|
-
ownRecord
|
|
36
|
-
|
|
37
|
+
ownRecord,
|
|
38
|
+
validateSettingsDocument
|
|
39
|
+
} from "./chunk-APZVJAEW.ts";
|
|
37
40
|
import {
|
|
38
41
|
automaticSyncSummary
|
|
39
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-MANNB4WZ.ts";
|
|
40
43
|
import {
|
|
41
44
|
loadOnSwitch,
|
|
42
45
|
readLocalConfigObject,
|
|
43
46
|
requireSettings,
|
|
44
47
|
updateLocalConfig
|
|
45
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-WBIOSK76.ts";
|
|
49
|
+
import {
|
|
50
|
+
startupTransferEnabled
|
|
51
|
+
} from "./chunk-WFBHWYI6.ts";
|
|
46
52
|
import {
|
|
47
53
|
observationMatchesConfig,
|
|
48
54
|
observationSummary,
|
|
49
55
|
readStateForConfig,
|
|
50
56
|
syncAttentionMatchesConfig,
|
|
51
57
|
syncStateFingerprint
|
|
52
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-VQ47JBLF.ts";
|
|
53
59
|
import {
|
|
54
60
|
AUTOMATIC_SYNC_DESCRIPTION,
|
|
55
61
|
STARTUP_TRANSFER_DESCRIPTION,
|
|
@@ -61,53 +67,64 @@ import {
|
|
|
61
67
|
import {
|
|
62
68
|
directoryScopeSummary,
|
|
63
69
|
showExcludedPaths
|
|
64
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-HSCAFOT5.ts";
|
|
65
71
|
import {
|
|
66
72
|
directorySessionOptInLine,
|
|
67
73
|
saveReviewedDraft
|
|
68
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-JREGWM2B.ts";
|
|
75
|
+
import {
|
|
76
|
+
manualIgnoreFileGuidance
|
|
77
|
+
} from "./chunk-EJDDRS6O.ts";
|
|
69
78
|
import {
|
|
70
79
|
activeLocalConfigPath,
|
|
71
80
|
localConfigPath,
|
|
81
|
+
readActiveLocalConfigDocumentForRepair,
|
|
72
82
|
syncErrorGuidance
|
|
73
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-IBXEM35O.ts";
|
|
84
|
+
import {
|
|
85
|
+
piDaemonClient
|
|
86
|
+
} from "./chunk-UGS6RYDZ.ts";
|
|
87
|
+
import "./chunk-EXDWEFIJ.ts";
|
|
74
88
|
import {
|
|
75
89
|
runCancellableOperation
|
|
76
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-CKUGCBHP.ts";
|
|
77
91
|
import {
|
|
78
92
|
throwIfAborted
|
|
79
|
-
} from "./chunk-
|
|
80
|
-
import {
|
|
81
|
-
captureMutationOwner
|
|
82
|
-
} from "./chunk-4SR3ZYHA.ts";
|
|
93
|
+
} from "./chunk-UMPA5S7X.ts";
|
|
83
94
|
import {
|
|
84
95
|
addStorageConnection,
|
|
85
96
|
removeStorageConnection,
|
|
86
97
|
removeSyncSetup,
|
|
87
98
|
updateStorageConnection,
|
|
88
99
|
updateSyncSetup
|
|
89
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-NXWHPVXR.ts";
|
|
101
|
+
import {
|
|
102
|
+
captureMutationOwner
|
|
103
|
+
} from "./chunk-GELYN4UC.ts";
|
|
90
104
|
import {
|
|
91
105
|
sameSyncExclude
|
|
92
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-ZO52JM4H.ts";
|
|
93
107
|
import {
|
|
108
|
+
configFromSettings,
|
|
94
109
|
loadConfig,
|
|
110
|
+
loadConfigForCheck,
|
|
95
111
|
loadPartialConfig,
|
|
112
|
+
loadSettingsConfig,
|
|
96
113
|
syncCheckConfigFingerprint,
|
|
97
114
|
syncConfigReviewIdentity
|
|
98
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-27F5W7DX.ts";
|
|
99
116
|
import {
|
|
100
117
|
configureSyncStatus
|
|
101
118
|
} from "./chunk-H7VOTY5N.ts";
|
|
102
119
|
import {
|
|
103
120
|
errorMessage
|
|
104
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-6YKOHBSC.ts";
|
|
105
122
|
import {
|
|
106
123
|
compareSyncInclude,
|
|
107
124
|
syncIncludeSelection,
|
|
108
125
|
syncSelectionHasContent,
|
|
109
126
|
syncSessionsSelected
|
|
110
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-R3SAMXB6.ts";
|
|
111
128
|
import {
|
|
112
129
|
safeTerminalText
|
|
113
130
|
} from "./chunk-2JNFEZ3V.ts";
|
|
@@ -121,7 +138,60 @@ import {
|
|
|
121
138
|
inspectOperationAvailability,
|
|
122
139
|
operationBlocksChanges,
|
|
123
140
|
operationCanRecover
|
|
124
|
-
} from "
|
|
141
|
+
} from "#pi-sync-daemon/engine/state/operation-availability";
|
|
142
|
+
|
|
143
|
+
// src/ui/ignore-migration-prompt.ts
|
|
144
|
+
var reviewNow = "Review migration now";
|
|
145
|
+
var notNow = "Not now";
|
|
146
|
+
async function showIgnoreMigrationPrompt(ctx, setup, signal, isCurrent) {
|
|
147
|
+
if (ctx.mode !== "tui" || !ctx.hasUI || signal.aborted || !isCurrent()) return false;
|
|
148
|
+
if (!await ignoreFileSettingsAvailable(ctx, signal) || signal.aborted || !isCurrent()) return false;
|
|
149
|
+
let shown = false;
|
|
150
|
+
try {
|
|
151
|
+
const client = piDaemonClient(ctx);
|
|
152
|
+
const valid = () => {
|
|
153
|
+
if (signal.aborted || !isCurrent()) return false;
|
|
154
|
+
client.validate();
|
|
155
|
+
return true;
|
|
156
|
+
};
|
|
157
|
+
const offer = await client.run("ignore.migration-offer", { setup }, signal, ctx);
|
|
158
|
+
if (!valid()) return false;
|
|
159
|
+
const token = readOfferToken(offer);
|
|
160
|
+
if (!token) return false;
|
|
161
|
+
shown = true;
|
|
162
|
+
const choice = await ctx.ui.select(
|
|
163
|
+
[
|
|
164
|
+
`Review migration for sync setup \u201C${safeTerminalText(setup)}\u201D?`,
|
|
165
|
+
"Your current rules still apply. Review the paths that would change before deciding.",
|
|
166
|
+
"Migration does not start a transfer. You can review it later in Pi Sync Settings."
|
|
167
|
+
].join("\n\n"),
|
|
168
|
+
[reviewNow, notNow],
|
|
169
|
+
{ signal }
|
|
170
|
+
);
|
|
171
|
+
if (!valid()) return true;
|
|
172
|
+
if (choice === notNow) {
|
|
173
|
+
await client.run("ignore.migration-defer", { setup, token }, signal, ctx);
|
|
174
|
+
} else if (choice === reviewNow) {
|
|
175
|
+
await showIgnoreFileAction(ctx, setup, "migrate", ".syncignore", signal, token);
|
|
176
|
+
}
|
|
177
|
+
} catch (error) {
|
|
178
|
+
if (!signal.aborted && isCurrent()) {
|
|
179
|
+
ctx.ui.notify(
|
|
180
|
+
`Pi Sync migration prompt: ${safeTerminalText(error instanceof Error ? error.message : String(error))}`,
|
|
181
|
+
"warning"
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return shown;
|
|
186
|
+
}
|
|
187
|
+
function readOfferToken(value) {
|
|
188
|
+
if (value === null) return void 0;
|
|
189
|
+
const token = value?.token;
|
|
190
|
+
if (typeof token !== "string" || !/^[0-9a-f]{64}$/u.test(token)) {
|
|
191
|
+
throw new Error("Invalid migration offer from the daemon.");
|
|
192
|
+
}
|
|
193
|
+
return token;
|
|
194
|
+
}
|
|
125
195
|
|
|
126
196
|
// src/ui/manager-attention.ts
|
|
127
197
|
function attentionMainMenuItems(manager) {
|
|
@@ -151,7 +221,7 @@ function blockedSyncMenuItem(label, manager) {
|
|
|
151
221
|
};
|
|
152
222
|
}
|
|
153
223
|
async function showManagerAttention(ctx, attention, runRoute, signal, onSelectionResolved) {
|
|
154
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
224
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-GPITNEBF.ts");
|
|
155
225
|
if (signal?.aborted) return "close";
|
|
156
226
|
const review = await showRemoteSelectionReview(ctx, attention.decision.setupName, signal, void 0, {
|
|
157
227
|
decision: attention.decision,
|
|
@@ -218,6 +288,27 @@ import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
|
218
288
|
|
|
219
289
|
// src/ui/sync-setups-ui.ts
|
|
220
290
|
import { defineMenu, runMenu } from "@narumitw/pi-tui-kit";
|
|
291
|
+
|
|
292
|
+
// src/ui/settings-review.ts
|
|
293
|
+
async function loadSettingsCatalog() {
|
|
294
|
+
const document = await readActiveLocalConfigDocumentForRepair();
|
|
295
|
+
if (!document) return void 0;
|
|
296
|
+
const settings = validateSettingsDocument(document.parsed);
|
|
297
|
+
const ignoreSetups = Object.entries(settings.syncSetups).filter(([, setup]) => setup.sync.pathPolicy === "ignore-file").map(([name]) => name);
|
|
298
|
+
return { settings, path: document.path, ignoreSetups };
|
|
299
|
+
}
|
|
300
|
+
var IGNORE_SETUP_MANAGEMENT_LIMIT = "Adding, editing, and switching setups are unavailable while any setup uses an ignore file.";
|
|
301
|
+
function ignoreSetupRecovery(settingsPath) {
|
|
302
|
+
return [
|
|
303
|
+
`For manual recovery, close Pi and back up: ${safeTerminalText(settingsPath)}`,
|
|
304
|
+
"Remove the ignore-file entries from syncSetups.",
|
|
305
|
+
"Set activeSyncSetup to a remaining setup, or remove it if none remain.",
|
|
306
|
+
"Keep the settings version, ignore files, and remote data unchanged.",
|
|
307
|
+
"Preserve any pending journal and backup. Review automatic sync before restarting Pi."
|
|
308
|
+
];
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// src/ui/sync-setups-ui.ts
|
|
221
312
|
async function countValidSyncSetups(setups, signal) {
|
|
222
313
|
let count = 0;
|
|
223
314
|
for (const name of Object.keys(setups ?? {})) {
|
|
@@ -234,6 +325,15 @@ async function countValidSyncSetups(setups, signal) {
|
|
|
234
325
|
return count;
|
|
235
326
|
}
|
|
236
327
|
async function showSyncSetups(ctx, actions, signal) {
|
|
328
|
+
const validateOwner = captureMutationOwner(ctx, signal);
|
|
329
|
+
const isCurrent = () => {
|
|
330
|
+
try {
|
|
331
|
+
validateOwner();
|
|
332
|
+
return true;
|
|
333
|
+
} catch {
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
};
|
|
237
337
|
let selectedName;
|
|
238
338
|
let exit = false;
|
|
239
339
|
const nameById = /* @__PURE__ */ new Map();
|
|
@@ -246,9 +346,9 @@ async function showSyncSetups(ctx, actions, signal) {
|
|
|
246
346
|
return {
|
|
247
347
|
kind: "actions",
|
|
248
348
|
title: "Sync setups",
|
|
249
|
-
lines: ["What to sync, where to store it, and when to sync."],
|
|
349
|
+
lines: state.recovery ?? ["What to sync, where to store it, and when to sync."],
|
|
250
350
|
items: [
|
|
251
|
-
{ id: "add", label: "Add sync setup", action: "add" },
|
|
351
|
+
...state.recovery ? [] : [{ id: "add", label: "Add sync setup", action: "add" }],
|
|
252
352
|
...names.map((name, index) => {
|
|
253
353
|
const id = `setup:${index}`;
|
|
254
354
|
nameById.set(id, name);
|
|
@@ -268,14 +368,14 @@ async function showSyncSetups(ctx, actions, signal) {
|
|
|
268
368
|
title: state.selected ? `Sync setup \u201C${safeTerminalText(state.selected.name)}\u201D` : "Sync setup",
|
|
269
369
|
lines: state.selected?.detail ?? ["This sync setup no longer exists."],
|
|
270
370
|
items: state.selected ? [
|
|
271
|
-
|
|
371
|
+
...state.recovery || state.selected.name === state.active || !state.selected.valid ? [] : [
|
|
272
372
|
{
|
|
273
373
|
id: "make-current",
|
|
274
374
|
label: "Make current\u2026",
|
|
275
375
|
action: "make-current"
|
|
276
376
|
}
|
|
277
377
|
],
|
|
278
|
-
{ id: "edit", label: "Edit storage location\u2026", action: "edit" },
|
|
378
|
+
...state.recovery ? [] : [{ id: "edit", label: "Edit storage location\u2026", action: "edit" }],
|
|
279
379
|
...state.selected.removeUnavailable ? [] : [
|
|
280
380
|
{
|
|
281
381
|
id: "remove",
|
|
@@ -289,7 +389,8 @@ async function showSyncSetups(ctx, actions, signal) {
|
|
|
289
389
|
})
|
|
290
390
|
},
|
|
291
391
|
actions: {
|
|
292
|
-
add: async () => {
|
|
392
|
+
add: async ({ state }) => {
|
|
393
|
+
if (state.recovery) return { kind: "rejected" };
|
|
293
394
|
try {
|
|
294
395
|
await actions.add(signal);
|
|
295
396
|
} catch (error) {
|
|
@@ -303,8 +404,8 @@ async function showSyncSetups(ctx, actions, signal) {
|
|
|
303
404
|
selectedName = nameById.get(itemId);
|
|
304
405
|
return selectedName ? { kind: "to", screen: "detail" } : { kind: "rejected" };
|
|
305
406
|
},
|
|
306
|
-
"make-current": async () => {
|
|
307
|
-
if (!selectedName) return { kind: "rejected" };
|
|
407
|
+
"make-current": async ({ state }) => {
|
|
408
|
+
if (!selectedName || state.recovery || !state.selected?.valid) return { kind: "rejected" };
|
|
308
409
|
try {
|
|
309
410
|
exit = await actions.makeCurrent(selectedName, signal) === "exit";
|
|
310
411
|
return exit ? { kind: "close" } : { kind: "stay" };
|
|
@@ -313,8 +414,8 @@ async function showSyncSetups(ctx, actions, signal) {
|
|
|
313
414
|
return { kind: "stay" };
|
|
314
415
|
}
|
|
315
416
|
},
|
|
316
|
-
edit: async () => {
|
|
317
|
-
if (!selectedName) return { kind: "rejected" };
|
|
417
|
+
edit: async ({ state }) => {
|
|
418
|
+
if (!selectedName || state.recovery) return { kind: "rejected" };
|
|
318
419
|
try {
|
|
319
420
|
await actions.edit(selectedName, signal);
|
|
320
421
|
} catch (error) {
|
|
@@ -322,8 +423,8 @@ async function showSyncSetups(ctx, actions, signal) {
|
|
|
322
423
|
}
|
|
323
424
|
return { kind: "stay" };
|
|
324
425
|
},
|
|
325
|
-
remove: async () => {
|
|
326
|
-
if (!selectedName) return { kind: "rejected" };
|
|
426
|
+
remove: async ({ state }) => {
|
|
427
|
+
if (!selectedName || !state.selected || state.selected.removeUnavailable) return { kind: "rejected" };
|
|
327
428
|
const name = selectedName;
|
|
328
429
|
try {
|
|
329
430
|
await actions.remove(name, signal);
|
|
@@ -341,38 +442,41 @@ async function showSyncSetups(ctx, actions, signal) {
|
|
|
341
442
|
}
|
|
342
443
|
});
|
|
343
444
|
await runMenu(ctx, menu, {
|
|
344
|
-
getState: async () => loadSetupMenuState(selectedName,
|
|
445
|
+
getState: async ({ signal: loadSignal }) => loadSetupMenuState(ctx, selectedName, loadSignal),
|
|
345
446
|
signal,
|
|
346
|
-
isCurrent
|
|
447
|
+
isCurrent
|
|
347
448
|
});
|
|
348
449
|
return exit ? "exit" : void 0;
|
|
349
450
|
}
|
|
350
|
-
async function loadSetupMenuState(selectedName, signal) {
|
|
351
|
-
const
|
|
451
|
+
async function loadSetupMenuState(ctx, selectedName, signal) {
|
|
452
|
+
const catalog = await loadSettingsCatalog();
|
|
352
453
|
throwIfAborted(signal);
|
|
353
|
-
|
|
354
|
-
const
|
|
355
|
-
|
|
454
|
+
if (!catalog) return { setups: {} };
|
|
455
|
+
const { syncSetups: setups, activeSyncSetup: active } = catalog.settings;
|
|
456
|
+
const recovery = catalog.ignoreSetups.length && !await ignoreFileSettingsAvailable(ctx, signal) ? [IGNORE_SETUP_MANAGEMENT_LIMIT, ...ignoreSetupRecovery(catalog.path)] : void 0;
|
|
457
|
+
throwIfAborted(signal);
|
|
458
|
+
if (!selectedName || !Object.hasOwn(setups, selectedName)) return { setups, active, recovery };
|
|
356
459
|
const setupCount = Object.keys(setups).length;
|
|
357
460
|
const isCurrent = selectedName === active;
|
|
358
461
|
let detail;
|
|
359
462
|
let valid = true;
|
|
360
463
|
try {
|
|
361
|
-
const config =
|
|
362
|
-
throwIfAborted(signal);
|
|
464
|
+
const config = configFromSettings(catalog.settings, selectedName);
|
|
363
465
|
const selection = syncIncludeSelection(config.include);
|
|
364
466
|
detail = [
|
|
365
467
|
`Status: ${isCurrent ? "Current" : "Not current"}`,
|
|
366
468
|
`Storage connection: ${safeTerminalText(config.connectionName)}`,
|
|
367
469
|
`Endpoint: ${storageEndpoint(config)}`,
|
|
368
470
|
`Storage location: ${storageLocation(config)}`,
|
|
369
|
-
config.scope ? `Sync scope: Pi agent directory \xB7 ${config.exclude?.length ?? 0} exclusions \xB7 ${config.reinclude?.length ?? 0} exceptions` : `Included content: ${selection.builtIns.length} built-in groups \xB7 ${selection.custom.length} extra paths`,
|
|
471
|
+
config.pathPolicy === "ignore-file" ? `Sync scope: Pi agent directory \xB7 ignore file: ${safeTerminalText(config.ignoreFile ?? ".syncignore")}` : config.scope ? `Sync scope: Pi agent directory \xB7 ${config.exclude?.length ?? 0} exclusions \xB7 ${config.reinclude?.length ?? 0} exceptions` : `Included content: ${selection.builtIns.length} built-in groups \xB7 ${selection.custom.length} extra paths`,
|
|
370
472
|
`Sessions: ${syncSessionsSelected(config) ? "On \u2014 privacy-sensitive" : "Off"}`,
|
|
371
473
|
`Automatic sync: ${config.automatic ? "On" : "Off"}`,
|
|
372
474
|
`Automatic transfer at startup: ${config.automaticTransfer ? "On \u2014 may upload, replace, or delete selected files; no reload" : "Off"}`,
|
|
373
475
|
`Autonomous sync: ${config.agentMode ? "On (autonomous merged sync)" : "Off"}`,
|
|
374
476
|
`Continuous sync: ${config.continuous ? config.agentMode ? "On (recurring requests and transfers)" : "Saved On; paused until Autonomous sync is enabled" : "Off"}`,
|
|
375
|
-
|
|
477
|
+
...recovery ? [] : [
|
|
478
|
+
isCurrent ? "Edit included content and automatic sync in /sync \u2192 Settings." : "To edit included content or automatic sync, make this setup current, then open /sync \u2192 Settings."
|
|
479
|
+
]
|
|
376
480
|
];
|
|
377
481
|
} catch (error) {
|
|
378
482
|
valid = false;
|
|
@@ -382,11 +486,19 @@ async function loadSetupMenuState(selectedName, signal) {
|
|
|
382
486
|
"Make current and sync are unavailable until this setup is repaired."
|
|
383
487
|
];
|
|
384
488
|
}
|
|
385
|
-
const
|
|
386
|
-
|
|
489
|
+
const removeNeedsSwitch = isCurrent && setupCount > 1;
|
|
490
|
+
const ignoreSetupsRemain = catalog.ignoreSetups.some((name) => name !== selectedName);
|
|
491
|
+
const removeUnavailable = removeNeedsSwitch || Boolean(recovery && ignoreSetupsRemain);
|
|
492
|
+
if (recovery) {
|
|
493
|
+
if (removeUnavailable) detail.unshift("Remove unavailable here; use manual recovery.");
|
|
494
|
+
detail.unshift(...recovery);
|
|
495
|
+
} else if (removeNeedsSwitch) {
|
|
496
|
+
detail.push("Remove unavailable: switch to another setup first.");
|
|
497
|
+
}
|
|
387
498
|
return {
|
|
388
499
|
setups,
|
|
389
500
|
active,
|
|
501
|
+
recovery,
|
|
390
502
|
selected: { name: selectedName, detail, valid, removeUnavailable }
|
|
391
503
|
};
|
|
392
504
|
}
|
|
@@ -436,11 +548,14 @@ var MAIN_MENU_ACTIONS = [
|
|
|
436
548
|
"History",
|
|
437
549
|
"Diagnostics"
|
|
438
550
|
];
|
|
439
|
-
async function describeManagerState(signal, attention, inspectOperation = inspectOperationAvailability, observation) {
|
|
551
|
+
async function describeManagerState(signal, attention, inspectOperation = inspectOperationAvailability, observation, canUseIgnoreSettings) {
|
|
440
552
|
let raw;
|
|
441
553
|
try {
|
|
442
|
-
|
|
554
|
+
const document = await readActiveLocalConfigDocumentForRepair();
|
|
555
|
+
signal?.throwIfAborted();
|
|
556
|
+
if (document) raw = validateSettingsDocument(document.parsed);
|
|
443
557
|
} catch (error) {
|
|
558
|
+
if (signal?.aborted) throw error;
|
|
444
559
|
return {
|
|
445
560
|
title: [
|
|
446
561
|
"Manage sync",
|
|
@@ -460,8 +575,8 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
|
|
|
460
575
|
actions: ["Set up sync", "Help"]
|
|
461
576
|
};
|
|
462
577
|
}
|
|
463
|
-
const configuredTargets =
|
|
464
|
-
if (
|
|
578
|
+
const configuredTargets = raw.syncSetups;
|
|
579
|
+
if (Object.keys(configuredTargets).length === 0) {
|
|
465
580
|
return {
|
|
466
581
|
title: [
|
|
467
582
|
"Manage sync",
|
|
@@ -474,8 +589,15 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
|
|
|
474
589
|
actions: ["Sync setups\u2026", "Storage connections\u2026", "Help"]
|
|
475
590
|
};
|
|
476
591
|
}
|
|
592
|
+
let settingsConfig;
|
|
477
593
|
try {
|
|
594
|
+
settingsConfig = configFromSettings(raw);
|
|
595
|
+
if (settingsConfig.reservedIgnoreNames && canUseIgnoreSettings && !await canUseIgnoreSettings()) {
|
|
596
|
+
throw new Error("the connected daemon does not support ignore-file setups");
|
|
597
|
+
}
|
|
598
|
+
signal?.throwIfAborted();
|
|
478
599
|
const config = await loadConfig();
|
|
600
|
+
signal?.throwIfAborted();
|
|
479
601
|
const operation = await inspectOperation();
|
|
480
602
|
const changesBlocked = operationBlocksChanges(operation);
|
|
481
603
|
let currentAttention;
|
|
@@ -506,7 +628,7 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
|
|
|
506
628
|
"Manage sync",
|
|
507
629
|
`Current sync setup: ${safeTerminalText(config.setupName)}`,
|
|
508
630
|
`Storage: ${backendStorageDescription(config)}`,
|
|
509
|
-
...config.scope ? ["Sync scope: Pi agent directory, with exclusions"] : [],
|
|
631
|
+
...config.pathPolicy === "ignore-file" ? [`Sync scope: Pi agent directory \xB7 ignore file: ${safeTerminalText(config.ignoreFile ?? ".syncignore")}`] : config.scope ? ["Sync scope: Pi agent directory, with exclusions"] : [],
|
|
510
632
|
...syncState?.unresolved?.length ? [`Unresolved: ${syncState.unresolved.length} dependency groups \xB7 review needed`] : [],
|
|
511
633
|
...currentAttention ? [
|
|
512
634
|
currentAttention.decision.setupName === config.setupName ? "Sync status: Review needed" : `Sync status: Review needed for setup ${safeTerminalText(currentAttention.decision.setupName)}`,
|
|
@@ -521,6 +643,7 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
|
|
|
521
643
|
title: (changesBlocked ? ["Manage sync", ...operationStatusLines(operation)] : ordinaryTitle).join("\n"),
|
|
522
644
|
actions: operationActions(operation, noSyncedContent, canSwitch, mainActions),
|
|
523
645
|
configReview: { setupName: config.setupName, fingerprint: syncCheckConfigFingerprint(config) },
|
|
646
|
+
settingsReview: { setupName: settingsConfig.setupName, fingerprint: syncCheckConfigFingerprint(settingsConfig) },
|
|
524
647
|
operation,
|
|
525
648
|
...currentObservation ? { observation: currentObservation } : {},
|
|
526
649
|
...currentAttention ? {
|
|
@@ -531,6 +654,20 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
|
|
|
531
654
|
};
|
|
532
655
|
} catch (error) {
|
|
533
656
|
if (signal?.aborted) throw error;
|
|
657
|
+
if (settingsConfig?.reservedIgnoreNames !== void 0) {
|
|
658
|
+
return {
|
|
659
|
+
title: [
|
|
660
|
+
"Manage sync",
|
|
661
|
+
`Current sync setup: ${safeTerminalText(settingsConfig.setupName)}`,
|
|
662
|
+
`Transfers are unavailable: ${safeTerminalText(errorMessage(error))}`
|
|
663
|
+
].join("\n"),
|
|
664
|
+
actions: ["Settings", "Sync setups\u2026", "Storage connections\u2026", "Help"],
|
|
665
|
+
settingsReview: {
|
|
666
|
+
setupName: settingsConfig.setupName,
|
|
667
|
+
fingerprint: syncCheckConfigFingerprint(settingsConfig)
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
}
|
|
534
671
|
return {
|
|
535
672
|
title: [
|
|
536
673
|
"Manage sync",
|
|
@@ -550,8 +687,8 @@ async function backgroundSummary(config) {
|
|
|
550
687
|
if (!config.continuous) return [];
|
|
551
688
|
if (!config.agentMode) return ["Background sync: Paused \xB7 enable Autonomous sync"];
|
|
552
689
|
try {
|
|
553
|
-
const { continuousBinding, readContinuousPrivateDocument } = await import("./continuous-storage-
|
|
554
|
-
const recordApi = await import("./continuous-record-
|
|
690
|
+
const { continuousBinding, readContinuousPrivateDocument } = await import("./continuous-storage-3EU6I7Z3.ts");
|
|
691
|
+
const recordApi = await import("./continuous-record-3SKJ6I3V.ts");
|
|
555
692
|
const binding = await continuousBinding(config);
|
|
556
693
|
const document = await readContinuousPrivateDocument(`${binding}.json`);
|
|
557
694
|
if (!document) return ["Background sync: Enabled \xB7 not yet observed"];
|
|
@@ -632,7 +769,7 @@ import {
|
|
|
632
769
|
sameLocalFields,
|
|
633
770
|
validatePortableSnapshot,
|
|
634
771
|
validateSnapshotFieldPolicy
|
|
635
|
-
} from "
|
|
772
|
+
} from "#pi-sync-daemon/engine/sync/local-fields";
|
|
636
773
|
|
|
637
774
|
// src/ui/agent-mode-setting.ts
|
|
638
775
|
import { isDeepStrictEqual } from "node:util";
|
|
@@ -747,6 +884,15 @@ function boundedSettingsUI(ctx) {
|
|
|
747
884
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
748
885
|
import { defineMenu as defineMenu2, runMenu as runMenu2 } from "@narumitw/pi-tui-kit";
|
|
749
886
|
async function showStorageConnections(ctx, signal) {
|
|
887
|
+
const validateOwner = captureMutationOwner(ctx, signal);
|
|
888
|
+
const isCurrent = () => {
|
|
889
|
+
try {
|
|
890
|
+
validateOwner();
|
|
891
|
+
return true;
|
|
892
|
+
} catch {
|
|
893
|
+
return false;
|
|
894
|
+
}
|
|
895
|
+
};
|
|
750
896
|
let selectedName;
|
|
751
897
|
const nameById = /* @__PURE__ */ new Map();
|
|
752
898
|
const menu = defineMenu2({
|
|
@@ -758,9 +904,9 @@ async function showStorageConnections(ctx, signal) {
|
|
|
758
904
|
return {
|
|
759
905
|
kind: "actions",
|
|
760
906
|
title: "Storage connections",
|
|
761
|
-
lines: state.supportedVersion ? ["Server addresses and sign-in details, reusable across sync setups."] : ["Create supported pi-sync settings before managing storage connections."],
|
|
907
|
+
lines: state.supportedVersion ? state.recovery ?? ["Server addresses and sign-in details, reusable across sync setups."] : ["Create supported pi-sync settings before managing storage connections."],
|
|
762
908
|
items: state.supportedVersion ? [
|
|
763
|
-
{ id: "add", label: "Add storage connection", action: "add" },
|
|
909
|
+
...state.recovery ? [] : [{ id: "add", label: "Add storage connection", action: "add" }],
|
|
764
910
|
...names.map((name, index) => {
|
|
765
911
|
const id = `connection:${index}`;
|
|
766
912
|
nameById.set(id, name);
|
|
@@ -780,8 +926,8 @@ async function showStorageConnections(ctx, signal) {
|
|
|
780
926
|
title: state.selected ? `Storage connection \u201C${safeTerminalText(state.selected.name)}\u201D` : "Storage connection",
|
|
781
927
|
lines: state.selected?.lines ?? ["This storage connection no longer exists."],
|
|
782
928
|
items: state.selected ? [
|
|
783
|
-
{ id: "edit", label: "Edit storage connection\u2026", action: "edit" },
|
|
784
|
-
|
|
929
|
+
...state.recovery ? [] : [{ id: "edit", label: "Edit storage connection\u2026", action: "edit" }],
|
|
930
|
+
...!state.recovery && state.selected.usedBy.length === 0 ? [
|
|
785
931
|
{
|
|
786
932
|
id: "remove",
|
|
787
933
|
label: "Remove storage connection\u2026",
|
|
@@ -794,7 +940,8 @@ async function showStorageConnections(ctx, signal) {
|
|
|
794
940
|
})
|
|
795
941
|
},
|
|
796
942
|
actions: {
|
|
797
|
-
add: async () => {
|
|
943
|
+
add: async ({ state }) => {
|
|
944
|
+
if (state.recovery) return { kind: "rejected" };
|
|
798
945
|
try {
|
|
799
946
|
await showAddStorageConnection(ctx, signal);
|
|
800
947
|
} catch (error) {
|
|
@@ -809,7 +956,7 @@ async function showStorageConnections(ctx, signal) {
|
|
|
809
956
|
return selectedName ? { kind: "to", screen: "detail" } : { kind: "rejected" };
|
|
810
957
|
},
|
|
811
958
|
edit: async ({ state }) => {
|
|
812
|
-
if (!state.selected || state.selected.name !== selectedName) return { kind: "rejected" };
|
|
959
|
+
if (state.recovery || !state.selected || state.selected.name !== selectedName) return { kind: "rejected" };
|
|
813
960
|
try {
|
|
814
961
|
await editStorageConnection(ctx, state.selected.name, state.selected.profile, state.selected.usedBy, signal);
|
|
815
962
|
} catch (error) {
|
|
@@ -817,22 +964,24 @@ async function showStorageConnections(ctx, signal) {
|
|
|
817
964
|
}
|
|
818
965
|
return { kind: "stay" };
|
|
819
966
|
},
|
|
820
|
-
remove: async ({ state }) => {
|
|
821
|
-
if (!state.selected || state.selected.name !== selectedName) return { kind: "rejected" };
|
|
967
|
+
remove: async ({ state, signal: actionSignal }) => {
|
|
968
|
+
if (state.recovery || !state.selected || state.selected.name !== selectedName) return { kind: "rejected" };
|
|
822
969
|
const name = state.selected.name;
|
|
823
970
|
const confirmed = await ctx.ui.confirm(
|
|
824
971
|
"Remove storage connection?",
|
|
825
972
|
`Remove local storage connection \u201C${safeTerminalText(name)}\u201D? Remote data and history are not deleted.`,
|
|
826
|
-
{ signal }
|
|
973
|
+
{ signal: actionSignal }
|
|
827
974
|
);
|
|
828
|
-
if (!confirmed ||
|
|
975
|
+
if (!confirmed || actionSignal.aborted || !isCurrent()) return { kind: "rejected" };
|
|
829
976
|
try {
|
|
830
|
-
await removeStorageConnection(name,
|
|
977
|
+
await removeStorageConnection(name, actionSignal);
|
|
978
|
+
if (actionSignal.aborted || !isCurrent()) return { kind: "close" };
|
|
831
979
|
ctx.ui.notify(`Removed storage connection \u201C${safeTerminalText(name)}\u201D.`, "info");
|
|
832
980
|
selectedName = void 0;
|
|
833
981
|
return { kind: "back" };
|
|
834
982
|
} catch (error) {
|
|
835
|
-
|
|
983
|
+
if (actionSignal.aborted || !isCurrent()) return { kind: "close" };
|
|
984
|
+
notifyConnectionError(ctx, name, error, actionSignal);
|
|
836
985
|
return { kind: "stay" };
|
|
837
986
|
}
|
|
838
987
|
},
|
|
@@ -843,20 +992,27 @@ async function showStorageConnections(ctx, signal) {
|
|
|
843
992
|
}
|
|
844
993
|
});
|
|
845
994
|
await runMenu2(ctx, menu, {
|
|
846
|
-
getState: () => loadStorageMenuState(selectedName,
|
|
995
|
+
getState: ({ signal: loadSignal }) => loadStorageMenuState(ctx, selectedName, loadSignal),
|
|
847
996
|
signal,
|
|
848
|
-
isCurrent
|
|
997
|
+
isCurrent
|
|
849
998
|
});
|
|
850
999
|
}
|
|
851
|
-
async function loadStorageMenuState(selectedName, signal) {
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
const
|
|
1000
|
+
async function loadStorageMenuState(ctx, selectedName, signal) {
|
|
1001
|
+
const catalog = await loadSettingsCatalog();
|
|
1002
|
+
signal?.throwIfAborted();
|
|
1003
|
+
const raw = catalog?.settings;
|
|
1004
|
+
const profiles = raw?.storageConnections ?? {};
|
|
1005
|
+
const recovery = catalog?.ignoreSetups.length && !await ignoreFileSettingsAvailable(ctx, signal) ? [
|
|
1006
|
+
"Connection changes are unavailable while any setup uses an ignore file.",
|
|
1007
|
+
...ignoreSetupRecovery(catalog.path)
|
|
1008
|
+
] : void 0;
|
|
1009
|
+
signal.throwIfAborted();
|
|
855
1010
|
const profile = selectedName ? ownRecord(profiles[selectedName]) : void 0;
|
|
856
1011
|
if (!selectedName || !profile) {
|
|
857
1012
|
return {
|
|
858
1013
|
supportedVersion: raw !== void 0,
|
|
859
1014
|
profiles,
|
|
1015
|
+
recovery,
|
|
860
1016
|
selected: void 0
|
|
861
1017
|
};
|
|
862
1018
|
}
|
|
@@ -864,16 +1020,18 @@ async function loadStorageMenuState(selectedName, signal) {
|
|
|
864
1020
|
return {
|
|
865
1021
|
supportedVersion: raw !== void 0,
|
|
866
1022
|
profiles,
|
|
1023
|
+
recovery,
|
|
867
1024
|
selected: {
|
|
868
1025
|
name: selectedName,
|
|
869
1026
|
profile,
|
|
870
1027
|
usedBy,
|
|
871
1028
|
lines: [
|
|
1029
|
+
...recovery ?? [],
|
|
872
1030
|
`Type: ${connectionType(profile)}`,
|
|
873
1031
|
`Endpoint: ${connectionEndpoint(profile)}`,
|
|
874
1032
|
`Credentials: ${credentialSource(profile)}`,
|
|
875
1033
|
`Used by: ${usedBy.length > 0 ? usedBy.map(safeTerminalText).join(", ") : "No sync setups"}`,
|
|
876
|
-
|
|
1034
|
+
...!recovery && usedBy.length > 0 ? [
|
|
877
1035
|
"Remove unavailable: remove the listed sync setups first. Switch away from a current setup before removing it if other setups remain."
|
|
878
1036
|
] : []
|
|
879
1037
|
]
|
|
@@ -1129,8 +1287,11 @@ async function showSetupSwitcher(ctx, runRoute, selectedName, signal) {
|
|
|
1129
1287
|
return false;
|
|
1130
1288
|
}
|
|
1131
1289
|
let config;
|
|
1290
|
+
let metadata;
|
|
1132
1291
|
try {
|
|
1133
|
-
|
|
1292
|
+
metadata = await loadSettingsConfig(name);
|
|
1293
|
+
if (signal?.aborted) return false;
|
|
1294
|
+
config = await loadConfigForCheck(name, signal);
|
|
1134
1295
|
if (signal?.aborted) return false;
|
|
1135
1296
|
} catch (error) {
|
|
1136
1297
|
ctx.ui.notify(
|
|
@@ -1141,14 +1302,14 @@ async function showSetupSwitcher(ctx, runRoute, selectedName, signal) {
|
|
|
1141
1302
|
}
|
|
1142
1303
|
const onSwitch = await loadOnSwitch();
|
|
1143
1304
|
if (signal?.aborted) return false;
|
|
1144
|
-
const switchEffect = onSwitch === "ask-before-pull" ? "After switching, pi-sync will ask whether to review a pull for this setup." : onSwitch === "pull-after-switch" ? "After switching, pi-sync will check this setup and show exact changes before applying them." : "After switching, pi-sync will not pull or modify synced files.";
|
|
1305
|
+
const switchEffect = config.reservedIgnoreNames !== void 0 ? "This switch only saves the active setup. To transfer, use a reviewed /sync command." : onSwitch === "ask-before-pull" ? "After switching, pi-sync will ask whether to review a pull for this setup." : onSwitch === "pull-after-switch" ? "After switching, pi-sync will check this setup and show exact changes before applying them." : "After switching, pi-sync will not pull or modify synced files.";
|
|
1145
1306
|
const confirmed = await ctx.ui.confirm(
|
|
1146
1307
|
"Switch sync setup?",
|
|
1147
1308
|
[
|
|
1148
1309
|
`From: ${safeTerminalText(active ?? "none")}`,
|
|
1149
1310
|
`To: ${safeTerminalText(name)}`,
|
|
1150
1311
|
`Storage: ${backendStorageDescription(config)}`,
|
|
1151
|
-
config.scope === "agent-directory" ? `Scope: Pi agent directory \xB7 ${config.exclude?.length ?? 0} excluded and ${config.reinclude?.length ?? 0} re-included rules` : `Included content: ${config.include.length} paths`,
|
|
1312
|
+
config.pathPolicy === "ignore-file" ? `Scope: Pi agent directory \xB7 ignore file: ${safeTerminalText(config.ignoreFile ?? ".syncignore")}` : config.scope === "agent-directory" ? `Scope: Pi agent directory \xB7 ${config.exclude?.length ?? 0} excluded and ${config.reinclude?.length ?? 0} re-included rules` : `Included content: ${config.include.length} paths`,
|
|
1152
1313
|
`Automatic sync: ${automaticSyncSummary(config.automatic)} \xB7 Sessions: ${syncSessionsSelected(config) ? "On" : "Off"}`,
|
|
1153
1314
|
`Automatic transfer at startup: ${config.automaticTransfer ? "On \u2014 may upload, replace, or delete selected files; no reload" : "Off"}`,
|
|
1154
1315
|
`Autonomous sync: ${config.agentMode ? "On (autonomous merged sync)" : "Off"}`,
|
|
@@ -1187,7 +1348,8 @@ async function showSetupSwitcher(ctx, runRoute, selectedName, signal) {
|
|
|
1187
1348
|
},
|
|
1188
1349
|
onSwitch,
|
|
1189
1350
|
signal,
|
|
1190
|
-
syncConfigReviewIdentity(
|
|
1351
|
+
syncConfigReviewIdentity(metadata),
|
|
1352
|
+
syncCheckConfigFingerprint(config)
|
|
1191
1353
|
);
|
|
1192
1354
|
if (pullClosed) return "closed";
|
|
1193
1355
|
return result.pullApplied ? "pull-attempted" : "switched";
|
|
@@ -1284,17 +1446,26 @@ async function showEditSyncSetupStorage(ctx, name, signal) {
|
|
|
1284
1446
|
await showEditS3Target(ctx, partial, signal);
|
|
1285
1447
|
}
|
|
1286
1448
|
async function showRemoveTarget(ctx, name, signal) {
|
|
1449
|
+
const validate = captureMutationOwner(ctx, signal);
|
|
1287
1450
|
const confirmed = await ctx.ui.confirm(
|
|
1288
1451
|
"Remove sync setup?",
|
|
1289
1452
|
`Remove local sync setup \u201C${safeTerminalText(name)}\u201D? Remote data and history are not deleted.`,
|
|
1290
1453
|
{ signal }
|
|
1291
1454
|
);
|
|
1292
1455
|
if (signal?.aborted || !confirmed) return;
|
|
1293
|
-
|
|
1294
|
-
|
|
1456
|
+
validate();
|
|
1457
|
+
const { revertedToLegacyOnly } = await removeSyncSetup(name, signal);
|
|
1458
|
+
try {
|
|
1459
|
+
validate();
|
|
1460
|
+
} catch {
|
|
1461
|
+
return;
|
|
1462
|
+
}
|
|
1463
|
+
const message = `Removed sync setup \u201C${safeTerminalText(name)}\u201D; remote data was not deleted.`;
|
|
1464
|
+
ctx.ui.notify(
|
|
1465
|
+
revertedToLegacyOnly ? `${message} To resume Continuous sync if enabled, close /sync and run /reload in an attached TUI session, or reopen one Pi client.` : message,
|
|
1466
|
+
"info"
|
|
1467
|
+
);
|
|
1295
1468
|
await refreshTargetCompletions();
|
|
1296
|
-
if (signal?.aborted) return;
|
|
1297
|
-
ctx.ui.notify(`Removed sync setup \u201C${safeTerminalText(name)}\u201D; remote data was not deleted.`, "info");
|
|
1298
1469
|
}
|
|
1299
1470
|
|
|
1300
1471
|
// src/ui/settings-ui.ts
|
|
@@ -1304,47 +1475,68 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1304
1475
|
disposition = "exit";
|
|
1305
1476
|
return { kind: "close" };
|
|
1306
1477
|
};
|
|
1307
|
-
if (ctx.mode !== "tui")
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1478
|
+
if (!ctx.hasUI || signal?.aborted || ctx.mode !== "tui" && ctx.mode !== "rpc") return disposition;
|
|
1479
|
+
const validateSettingsOwner = captureMutationOwner(ctx, signal);
|
|
1480
|
+
const isCurrent = () => {
|
|
1481
|
+
try {
|
|
1482
|
+
validateSettingsOwner();
|
|
1483
|
+
return true;
|
|
1484
|
+
} catch {
|
|
1485
|
+
return false;
|
|
1486
|
+
}
|
|
1487
|
+
};
|
|
1488
|
+
if (ctx.mode === "rpc") {
|
|
1489
|
+
const document = await readActiveLocalConfigDocumentForRepair().catch(() => null);
|
|
1490
|
+
if (!isCurrent()) return disposition;
|
|
1491
|
+
const settingsPath = document?.path ?? localConfigPath();
|
|
1492
|
+
let config;
|
|
1493
|
+
try {
|
|
1494
|
+
if (document) config = configFromSettings(validateSettingsDocument(document.parsed), reviewedSetup);
|
|
1495
|
+
} catch {
|
|
1496
|
+
config = void 0;
|
|
1497
|
+
}
|
|
1498
|
+
const limited = config?.reservedIgnoreNames !== void 0 && !await ignoreFileSettingsAvailable(ctx, signal);
|
|
1499
|
+
if (!isCurrent()) return disposition;
|
|
1500
|
+
ctx.ui.notify(
|
|
1501
|
+
[
|
|
1502
|
+
document === null ? "Could not read the active pi-sync settings file. Check file access or repair the JSON before reopening /sync." : `Edit pi-sync settings manually: ${safeTerminalText(settingsPath)}`,
|
|
1503
|
+
...limited ? [IGNORE_SETUP_MANAGEMENT_LIMIT, ...ignoreSetupRecovery(settingsPath)] : [],
|
|
1504
|
+
...!limited && config?.reservedIgnoreNames !== void 0 ? ["Use TUI Settings \u2192 Review automatic transfers to approve the current setup separately."] : [],
|
|
1505
|
+
...config?.pathPolicy === "ignore-file" ? [manualIgnoreFileGuidance(config.ignoreFile ?? ".syncignore")] : config?.scope === "agent-directory" ? directoryScopeSummary(config) : []
|
|
1506
|
+
].join("\n"),
|
|
1507
|
+
"info"
|
|
1508
|
+
);
|
|
1509
|
+
const management = defineMenu4({
|
|
1510
|
+
start: "management",
|
|
1511
|
+
screens: {
|
|
1512
|
+
management: () => ({
|
|
1513
|
+
kind: "actions",
|
|
1514
|
+
title: "Sync settings management",
|
|
1515
|
+
items: [
|
|
1516
|
+
{ id: "setups", label: "Manage sync setups", action: "setups" },
|
|
1517
|
+
{ id: "connections", label: "Manage storage connections", action: "connections" }
|
|
1518
|
+
],
|
|
1519
|
+
hint: "back"
|
|
1520
|
+
})
|
|
1521
|
+
},
|
|
1522
|
+
actions: {
|
|
1523
|
+
setups: async ({ signal: actionSignal }) => {
|
|
1524
|
+
const result = await showSyncSetupManager(ctx, runRoute, actionSignal);
|
|
1525
|
+
return result === "exit" ? exitSettings() : { kind: "stay" };
|
|
1330
1526
|
},
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
return result === "exit" ? exitSettings() : { kind: "stay" };
|
|
1335
|
-
},
|
|
1336
|
-
connections: async ({ signal: actionSignal }) => {
|
|
1337
|
-
await showStorageConnections(ctx, actionSignal);
|
|
1338
|
-
return { kind: "stay" };
|
|
1339
|
-
}
|
|
1527
|
+
connections: async ({ signal: actionSignal }) => {
|
|
1528
|
+
await showStorageConnections(ctx, actionSignal);
|
|
1529
|
+
return { kind: "stay" };
|
|
1340
1530
|
}
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
}
|
|
1531
|
+
}
|
|
1532
|
+
});
|
|
1533
|
+
await runMenu4(ctx, management, { getState: () => void 0, signal, isCurrent });
|
|
1344
1534
|
return disposition;
|
|
1345
1535
|
}
|
|
1346
|
-
const initial = await
|
|
1347
|
-
if (
|
|
1536
|
+
const initial = await loadSettingsConfig(reviewedSetup);
|
|
1537
|
+
if (!isCurrent()) return disposition;
|
|
1538
|
+
const ignoreAvailable = await ignoreFileSettingsAvailable(ctx, signal);
|
|
1539
|
+
if (!isCurrent()) return disposition;
|
|
1348
1540
|
const setupName = initial.setupName;
|
|
1349
1541
|
let saveStatus = "Simple choices save immediately. Back does not undo saved changes.";
|
|
1350
1542
|
const menu = defineMenu4({
|
|
@@ -1355,10 +1547,19 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1355
1547
|
title: "Pi Sync Settings",
|
|
1356
1548
|
lines: [
|
|
1357
1549
|
`Setup: ${safeTerminalText(state.setupName)} \xB7 Connection: ${safeTerminalText(state.connectionName)}`,
|
|
1358
|
-
saveStatus
|
|
1550
|
+
...state.reservedIgnoreNames !== void 0 && !ignoreAvailable ? ["Setup preferences are read-only; adding, editing, and switching setups are unavailable."] : [saveStatus],
|
|
1551
|
+
...state.pathPolicy === "ignore-file" ? [manualIgnoreFileGuidance(state.ignoreFile ?? ".syncignore")] : []
|
|
1359
1552
|
],
|
|
1360
1553
|
items: [
|
|
1361
|
-
...state.
|
|
1554
|
+
...state.pathPolicy === "ignore-file" ? ignoreAvailable ? [
|
|
1555
|
+
{
|
|
1556
|
+
id: "ignoreFile",
|
|
1557
|
+
label: "Ignore file",
|
|
1558
|
+
description: `Select another existing local file. Sessions: ${state.include.includes("sessions") ? "opted in (rules still apply)" : "off"}. No transfer starts.`,
|
|
1559
|
+
currentValue: safeTerminalText(state.ignoreFile ?? ".syncignore"),
|
|
1560
|
+
action: "ignore-switch"
|
|
1561
|
+
}
|
|
1562
|
+
] : [] : state.reservedIgnoreNames !== void 0 && !ignoreAvailable ? [] : state.scope === "agent-directory" ? [
|
|
1362
1563
|
{
|
|
1363
1564
|
id: "include",
|
|
1364
1565
|
label: "Agent directory scope",
|
|
@@ -1382,13 +1583,24 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1382
1583
|
action: "exclude"
|
|
1383
1584
|
}
|
|
1384
1585
|
],
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1586
|
+
...ignoreAvailable && state.pathPolicy !== "ignore-file" ? [
|
|
1587
|
+
{
|
|
1588
|
+
id: "migrateIgnoreFile",
|
|
1589
|
+
label: "Migrate to ignore file\u2026",
|
|
1590
|
+
description: "Review the scope change for this legacy setup. Migration does not start a transfer.",
|
|
1591
|
+
currentValue: "Review",
|
|
1592
|
+
action: "ignore-migrate"
|
|
1593
|
+
}
|
|
1594
|
+
] : [],
|
|
1595
|
+
...state.reservedIgnoreNames !== void 0 && !ignoreAvailable ? [] : [
|
|
1596
|
+
{
|
|
1597
|
+
id: "remoteInclude",
|
|
1598
|
+
label: ignoreAvailable || state.scope === "agent-directory" ? "Compare sync policies" : "Compare included paths",
|
|
1599
|
+
description: state.pathPolicy === "ignore-file" ? "Read-only comparison of local and remote policy, not file contents." : "Compare what sync manages on this device and the remote, not file contents. No files transfer unless you explicitly Continue.",
|
|
1600
|
+
currentValue: "Review",
|
|
1601
|
+
action: "remote-include"
|
|
1602
|
+
}
|
|
1603
|
+
],
|
|
1392
1604
|
{
|
|
1393
1605
|
id: "localFields",
|
|
1394
1606
|
label: "Machine-local fields",
|
|
@@ -1406,14 +1618,14 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1406
1618
|
{
|
|
1407
1619
|
id: "setups",
|
|
1408
1620
|
label: "Manage sync setups",
|
|
1409
|
-
description: "This device: add, switch, edit, or remove sync setups. Each edit identifies its owner before saving.",
|
|
1621
|
+
description: state.reservedIgnoreNames !== void 0 && !ignoreAvailable ? "Review configured setups and recovery options. Adding, editing, and switching are unavailable." : "This device: add, switch, edit, or remove sync setups. Each edit identifies its owner before saving.",
|
|
1410
1622
|
currentValue: "Open",
|
|
1411
1623
|
action: "setups"
|
|
1412
1624
|
},
|
|
1413
1625
|
{
|
|
1414
1626
|
id: "connections",
|
|
1415
1627
|
label: "Manage storage connections",
|
|
1416
|
-
description: "Shared connections on this device: review affected setups before saving server or credential changes.",
|
|
1628
|
+
description: state.reservedIgnoreNames !== void 0 && !ignoreAvailable ? "Review shared connections. Connection changes are unavailable while ignore-file setups are configured." : "Shared connections on this device: review affected setups before saving server or credential changes.",
|
|
1417
1629
|
currentValue: "Open",
|
|
1418
1630
|
action: "connections"
|
|
1419
1631
|
},
|
|
@@ -1449,10 +1661,19 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1449
1661
|
values: ["On", "Off"],
|
|
1450
1662
|
action: "continuous"
|
|
1451
1663
|
},
|
|
1664
|
+
...ignoreAvailable && state.reservedIgnoreNames !== void 0 && (startupTransferEnabled(state) || state.automatic && syncSessionsSelected(state)) ? [
|
|
1665
|
+
{
|
|
1666
|
+
id: "authorizeAutomatic",
|
|
1667
|
+
label: "Review automatic transfers",
|
|
1668
|
+
description: "Separate approval for the enabled modes and exact current policy. Saving settings alone does not grant permission.",
|
|
1669
|
+
currentValue: "Review",
|
|
1670
|
+
action: "authorize-automatic"
|
|
1671
|
+
}
|
|
1672
|
+
] : [],
|
|
1452
1673
|
{
|
|
1453
1674
|
id: "onSwitch",
|
|
1454
1675
|
label: "On setup switch",
|
|
1455
|
-
description: "All setups on this device: ask before a pull review, open it automatically, or switch without pulling. Applies to subsequent switches.",
|
|
1676
|
+
description: state.reservedIgnoreNames === void 0 ? "All setups on this device: ask before a pull review, open it automatically, or switch without pulling. Applies to subsequent switches." : "While ignore-file setups exist, switching saves only the active setup. Run a reviewed pull separately.",
|
|
1456
1677
|
currentValue: setupSwitchActionLabel(state.onSwitch),
|
|
1457
1678
|
values: SETUP_SWITCH_ACTION_OPTIONS.map(({ label }) => label),
|
|
1458
1679
|
action: "on-switch"
|
|
@@ -1497,7 +1718,9 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1497
1718
|
values: ["On", "Off"],
|
|
1498
1719
|
action: "debug"
|
|
1499
1720
|
}
|
|
1500
|
-
]
|
|
1721
|
+
].map(
|
|
1722
|
+
(item) => state.reservedIgnoreNames !== void 0 && !ignoreAvailable && !["setups", "connections"].includes(item.id) ? { ...item, disabled: true } : item
|
|
1723
|
+
)
|
|
1501
1724
|
})
|
|
1502
1725
|
},
|
|
1503
1726
|
actions: {
|
|
@@ -1520,13 +1743,13 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1520
1743
|
const mutationSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
1521
1744
|
const validate = captureMutationOwner(ctx, mutationSignal);
|
|
1522
1745
|
try {
|
|
1523
|
-
const previous = await
|
|
1746
|
+
const previous = await loadSettingsConfig(setupName);
|
|
1524
1747
|
validate();
|
|
1525
1748
|
const mergeContent = value === "Merge only" || value === "Merge + partial";
|
|
1526
1749
|
const partialSync = value === "Partial only" || value === "Merge + partial";
|
|
1527
1750
|
if (!await ctx.ui.confirm(
|
|
1528
1751
|
"Save content policy?",
|
|
1529
|
-
`${previous.
|
|
1752
|
+
`${previous.pathPolicy === "ignore-file" ? "Ignore-file policy keeps settings version 8 and snapshot version 6; older clients must refuse them." : previous.scope === "agent-directory" ? "Agent directory scope uses snapshot version 5; older clients must refuse it." : "This explicitly upgrades settings to at least version 5; partial snapshots use version 3, or version 4 with exclusions, and older clients must refuse them."} Text/session merge is conservative. Partial sync preserves withheld versions and old baselines. Disabling does not clear unresolved groups or recovery evidence. Review a directional migration first if portable policy changes.`,
|
|
1530
1753
|
{ signal: mutationSignal }
|
|
1531
1754
|
))
|
|
1532
1755
|
return { kind: "rejected" };
|
|
@@ -1576,7 +1799,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1576
1799
|
const mutationSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
1577
1800
|
const validate = captureMutationOwner(ctx, mutationSignal);
|
|
1578
1801
|
try {
|
|
1579
|
-
const previous = await
|
|
1802
|
+
const previous = await loadSettingsConfig(setupName);
|
|
1580
1803
|
validate();
|
|
1581
1804
|
const input = await ctx.ui.input(
|
|
1582
1805
|
"Machine-local settings.json root fields (JSON string array)",
|
|
@@ -1594,7 +1817,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1594
1817
|
if (sameLocalFields(previous.localFields, fields)) return { kind: "stay" };
|
|
1595
1818
|
const confirmed = await ctx.ui.confirm(
|
|
1596
1819
|
"Save portable field policy?",
|
|
1597
|
-
`${previous.
|
|
1820
|
+
`${previous.pathPolicy === "ignore-file" ? "Ignore-file policy keeps settings version 8 and snapshot version 6." : previous.scope === "agent-directory" ? "Agent directory scope uses snapshot version 5." : "This opts into at least settings/snapshot version 4/2; exclude-enabled setups retain snapshot version 4."} Older clients must refuse unsupported formats. Future snapshots omit these fields, but old remote history is NOT erased. Review an explicit force push/pull migration before further sync. Removed rules can expose or replace local-only values.`,
|
|
1598
1821
|
{ signal: mutationSignal }
|
|
1599
1822
|
);
|
|
1600
1823
|
validate();
|
|
@@ -1627,7 +1850,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1627
1850
|
const automatic = value === "On";
|
|
1628
1851
|
const mutationSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
1629
1852
|
try {
|
|
1630
|
-
const latest = await
|
|
1853
|
+
const latest = await loadSettingsConfig(setupName);
|
|
1631
1854
|
if (mutationSignal.aborted) return { kind: "rejected" };
|
|
1632
1855
|
if (latest.automatic === automatic) return { kind: "stay" };
|
|
1633
1856
|
await updateSyncSetup(setupName, (setup) => ({ ...setup, sync: { ...setup.sync, automatic } }), {
|
|
@@ -1716,7 +1939,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1716
1939
|
const skipSecretScan = value === "On";
|
|
1717
1940
|
const mutationSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
1718
1941
|
try {
|
|
1719
|
-
const latest = await
|
|
1942
|
+
const latest = await loadSettingsConfig(setupName);
|
|
1720
1943
|
if (mutationSignal.aborted) return { kind: "rejected" };
|
|
1721
1944
|
if (latest.skipSecretScan === skipSecretScan) return { kind: "stay" };
|
|
1722
1945
|
await updateLocalConfig((settings) => ({ ...settings, skipSecretScan }), mutationSignal);
|
|
@@ -1732,7 +1955,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1732
1955
|
const showStatus = value === "On";
|
|
1733
1956
|
const mutationSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
1734
1957
|
try {
|
|
1735
|
-
const latest = await
|
|
1958
|
+
const latest = await loadSettingsConfig(setupName);
|
|
1736
1959
|
if (mutationSignal.aborted) return { kind: "rejected" };
|
|
1737
1960
|
if (latest.showStatus === showStatus) return { kind: "stay" };
|
|
1738
1961
|
await updateLocalConfig((settings) => ({ ...settings, showStatus }), mutationSignal);
|
|
@@ -1762,7 +1985,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1762
1985
|
if (!action) return { kind: "rejected" };
|
|
1763
1986
|
const mutationSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
1764
1987
|
try {
|
|
1765
|
-
const latest = await
|
|
1988
|
+
const latest = await loadSettingsConfig(setupName);
|
|
1766
1989
|
if (mutationSignal.aborted) return { kind: "rejected" };
|
|
1767
1990
|
if (latest.onSwitch === action) return { kind: "stay" };
|
|
1768
1991
|
await saveOnSwitch(action, mutationSignal);
|
|
@@ -1784,13 +2007,43 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1784
2007
|
await showExcludedPaths(ctx, setupName, editorSignal);
|
|
1785
2008
|
return resumeSettings(editorSignal);
|
|
1786
2009
|
},
|
|
1787
|
-
"
|
|
2010
|
+
"authorize-automatic": async ({ state, signal: actionSignal }) => {
|
|
1788
2011
|
const reviewSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
1789
|
-
const
|
|
2012
|
+
const validate = captureMutationOwner(ctx, reviewSignal);
|
|
2013
|
+
const client = piDaemonClient(ctx);
|
|
2014
|
+
try {
|
|
2015
|
+
validate();
|
|
2016
|
+
const policy = await client.run("daemon.policy", {}, reviewSignal);
|
|
2017
|
+
validate();
|
|
2018
|
+
if (policy.setup !== state.setupName) return exitSettings();
|
|
2019
|
+
if (policy.automatic) {
|
|
2020
|
+
ctx.ui.notify("Automatic work is already approved for this setup and policy.", "info");
|
|
2021
|
+
return { kind: "stay" };
|
|
2022
|
+
}
|
|
2023
|
+
const accepted = await client.run(
|
|
2024
|
+
"daemon.authorize-connected",
|
|
2025
|
+
{ fingerprint: policy.fingerprint },
|
|
2026
|
+
reviewSignal
|
|
2027
|
+
);
|
|
2028
|
+
validate();
|
|
2029
|
+
if (accepted === true) ctx.ui.notify("Automatic work approved for this setup and policy.", "info");
|
|
2030
|
+
return { kind: "stay" };
|
|
2031
|
+
} catch (error) {
|
|
2032
|
+
if (reviewSignal.aborted || !isCurrent()) return exitSettings();
|
|
2033
|
+
notifySaveFailure(ctx, error);
|
|
2034
|
+
return { kind: "rejected" };
|
|
2035
|
+
}
|
|
2036
|
+
},
|
|
2037
|
+
"ignore-switch": ignoreAction("switch"),
|
|
2038
|
+
"ignore-migrate": ignoreAction("migrate"),
|
|
2039
|
+
"remote-include": async ({ state, signal: actionSignal }) => {
|
|
2040
|
+
if (state.reservedIgnoreNames !== void 0 && !ignoreAvailable) return { kind: "rejected" };
|
|
2041
|
+
const reviewSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
2042
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-GPITNEBF.ts");
|
|
1790
2043
|
if (reviewSignal.aborted) return { kind: "rejected" };
|
|
1791
2044
|
const review = await showRemoteSelectionReview(ctx, setupName, reviewSignal, void 0, {
|
|
1792
2045
|
origin: "settings",
|
|
1793
|
-
runRoute
|
|
2046
|
+
...state.pathPolicy === "ignore-file" ? { readOnly: true } : { runRoute }
|
|
1794
2047
|
});
|
|
1795
2048
|
if (reviewSignal.aborted) return { kind: "rejected" };
|
|
1796
2049
|
if (review.kind === "route-result") {
|
|
@@ -1818,25 +2071,40 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1818
2071
|
const result = await save(action);
|
|
1819
2072
|
if (action.signal.aborted || signal?.aborted) return { kind: "rejected" };
|
|
1820
2073
|
validate();
|
|
1821
|
-
saveStatus = result?.kind === "rejected" ? "Save failed or rejected. Previous value retained; retry is available." : id === "automatic-transfer" || id === "automatic" || id === "debug" ? "Saved. Enabling startup work applies next session start; completed transfers are not undone." : "Saved. Applies to subsequent operations; status visibility applies immediately.";
|
|
2074
|
+
saveStatus = result?.kind === "rejected" ? "Save failed or rejected. Previous value retained; retry is available." : id === "automatic-transfer" || id === "automatic" || id === "debug" ? action.state.reservedIgnoreNames !== void 0 ? "Saved. Review automatic transfers separately before enabling automatic work for this policy." : "Saved. Enabling startup work applies next session start; completed transfers are not undone." : "Saved. Applies to subsequent operations; status visibility applies immediately.";
|
|
1822
2075
|
ctx.ui.notify(saveStatus, result?.kind === "rejected" ? "warning" : "info");
|
|
1823
2076
|
return result;
|
|
1824
2077
|
};
|
|
1825
2078
|
}
|
|
2079
|
+
function ignoreAction(action) {
|
|
2080
|
+
return async ({ state, signal: actionSignal }) => {
|
|
2081
|
+
if (!ignoreAvailable || state.pathPolicy === "ignore-file" === (action === "migrate"))
|
|
2082
|
+
return { kind: "rejected" };
|
|
2083
|
+
const editorSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
2084
|
+
const latest = await loadSettingsConfig();
|
|
2085
|
+
if (editorSignal.aborted || !isCurrent()) return { kind: "close" };
|
|
2086
|
+
if (syncCheckConfigFingerprint(latest) !== syncCheckConfigFingerprint(state)) {
|
|
2087
|
+
ctx.ui.notify("Sync setup changed while Settings was open; reopen it before changing the policy.", "warning");
|
|
2088
|
+
return { kind: "close" };
|
|
2089
|
+
}
|
|
2090
|
+
await showIgnoreFileAction(ctx, setupName, action, state.ignoreFile ?? ".syncignore", editorSignal);
|
|
2091
|
+
return resumeSettings(editorSignal);
|
|
2092
|
+
};
|
|
2093
|
+
}
|
|
1826
2094
|
async function resumeSettings(editorSignal) {
|
|
1827
|
-
if (editorSignal.aborted) return { kind: "close" };
|
|
2095
|
+
if (editorSignal.aborted || !isCurrent()) return { kind: "close" };
|
|
1828
2096
|
try {
|
|
1829
|
-
const active = await
|
|
1830
|
-
if (editorSignal.aborted || active.setupName !== setupName) return { kind: "close" };
|
|
2097
|
+
const active = await loadSettingsConfig();
|
|
2098
|
+
if (editorSignal.aborted || !isCurrent() || active.setupName !== setupName) return { kind: "close" };
|
|
1831
2099
|
return { kind: "stay" };
|
|
1832
2100
|
} catch {
|
|
1833
2101
|
return { kind: "close" };
|
|
1834
2102
|
}
|
|
1835
2103
|
}
|
|
1836
2104
|
await runMenu4({ ...ctx, ui: boundedSettingsUI(ctx) }, menu, {
|
|
1837
|
-
getState: () =>
|
|
2105
|
+
getState: () => loadSettingsConfig(setupName),
|
|
1838
2106
|
signal,
|
|
1839
|
-
isCurrent
|
|
2107
|
+
isCurrent
|
|
1840
2108
|
});
|
|
1841
2109
|
return disposition;
|
|
1842
2110
|
}
|
|
@@ -1901,7 +2169,7 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
1901
2169
|
if (!attention) {
|
|
1902
2170
|
const observation = state.manager.observation;
|
|
1903
2171
|
if (!observation) return { kind: "stay" };
|
|
1904
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
2172
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-GPITNEBF.ts");
|
|
1905
2173
|
if (sessionSignal?.aborted) return { kind: "close" };
|
|
1906
2174
|
const config = await loadConfig();
|
|
1907
2175
|
if (sessionSignal?.aborted) return { kind: "close" };
|
|
@@ -1971,8 +2239,10 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
1971
2239
|
const result = await showSetupSwitcher(ctx, runRoute, void 0, sessionSignal);
|
|
1972
2240
|
return result === "pull-attempted" || result === "closed" ? { kind: "close" } : { kind: "stay" };
|
|
1973
2241
|
},
|
|
1974
|
-
settings: async ({ state }) => {
|
|
1975
|
-
const
|
|
2242
|
+
settings: async ({ state, signal: actionSignal }) => {
|
|
2243
|
+
const signal = sessionSignal ? AbortSignal.any([sessionSignal, actionSignal]) : actionSignal;
|
|
2244
|
+
const review = state.manager.settingsReview ?? state.manager.configReview;
|
|
2245
|
+
const result = await showSyncSettings(ctx, runRoute, signal, review?.setupName);
|
|
1976
2246
|
return { kind: result === "exit" ? "close" : "stay" };
|
|
1977
2247
|
},
|
|
1978
2248
|
pull: async ({ state }) => {
|
|
@@ -2033,7 +2303,7 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
2033
2303
|
const config = await loadConfig(state.manager.configReview?.setupName);
|
|
2034
2304
|
validate();
|
|
2035
2305
|
if (config.continuous) {
|
|
2036
|
-
const { continuousStatusLines } = await import("./continuous-record-
|
|
2306
|
+
const { continuousStatusLines } = await import("./continuous-record-3SKJ6I3V.ts");
|
|
2037
2307
|
validate();
|
|
2038
2308
|
const lines = await continuousStatusLines(config);
|
|
2039
2309
|
validate();
|
|
@@ -2118,10 +2388,11 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
|
|
|
2118
2388
|
const activate = menu.actions[action];
|
|
2119
2389
|
menu.actions[action] = async (invocation) => {
|
|
2120
2390
|
validateOwner();
|
|
2121
|
-
const
|
|
2391
|
+
const { configReview, settingsReview } = invocation.state.manager;
|
|
2392
|
+
const review = action === "settings" ? settingsReview ?? configReview : configReview;
|
|
2122
2393
|
let current = false;
|
|
2123
2394
|
try {
|
|
2124
|
-
const config = await loadConfig();
|
|
2395
|
+
const config = await (action === "settings" ? loadSettingsConfig() : loadConfig());
|
|
2125
2396
|
validateOwner();
|
|
2126
2397
|
invocation.signal.throwIfAborted();
|
|
2127
2398
|
current = review?.fingerprint === syncCheckConfigFingerprint(config);
|
|
@@ -2153,17 +2424,33 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
|
|
|
2153
2424
|
}, customOptions)
|
|
2154
2425
|
}
|
|
2155
2426
|
};
|
|
2427
|
+
let firstOpen = true;
|
|
2428
|
+
const describe = async (signal) => {
|
|
2429
|
+
const pendingAttention = options.getAttention?.();
|
|
2430
|
+
const observation = options.getObservation?.();
|
|
2431
|
+
const manager = await describeManagerState(
|
|
2432
|
+
signal,
|
|
2433
|
+
pendingAttention,
|
|
2434
|
+
void 0,
|
|
2435
|
+
observation,
|
|
2436
|
+
() => ignoreFileSettingsAvailable(ctx, signal)
|
|
2437
|
+
);
|
|
2438
|
+
if (signal.aborted || !isCurrent()) return manager;
|
|
2439
|
+
if (observation && options.getObservation?.() === observation && !manager.observation && !(manager.operation && operationBlocksChanges(manager.operation))) {
|
|
2440
|
+
options.onObservationInvalidated?.();
|
|
2441
|
+
}
|
|
2442
|
+
if (pendingAttention && options.getAttention?.() === pendingAttention && !manager.attention) {
|
|
2443
|
+
options.onSelectionResolved?.(pendingAttention);
|
|
2444
|
+
}
|
|
2445
|
+
return manager;
|
|
2446
|
+
};
|
|
2156
2447
|
await runMenu5(menuContext, menu, {
|
|
2157
|
-
getState: async () => {
|
|
2158
|
-
const
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
if (
|
|
2162
|
-
|
|
2163
|
-
options.onObservationInvalidated?.();
|
|
2164
|
-
}
|
|
2165
|
-
if (pendingAttention && options.getAttention?.() === pendingAttention && !manager.attention) {
|
|
2166
|
-
options.onSelectionResolved?.(pendingAttention);
|
|
2448
|
+
getState: async ({ signal }) => {
|
|
2449
|
+
const offerOnOpen = firstOpen;
|
|
2450
|
+
firstOpen = false;
|
|
2451
|
+
let manager = await describe(signal);
|
|
2452
|
+
if (offerOnOpen && manager.operation?.kind === "free" && manager.configReview && await showIgnoreMigrationPrompt(ctx, manager.configReview.setupName, signal, isCurrent)) {
|
|
2453
|
+
if (!signal.aborted && isCurrent()) manager = await describe(signal);
|
|
2167
2454
|
}
|
|
2168
2455
|
return { manager };
|
|
2169
2456
|
},
|
|
@@ -2222,4 +2509,4 @@ function syncMainMenuItem(label) {
|
|
|
2222
2509
|
export {
|
|
2223
2510
|
showSyncManager
|
|
2224
2511
|
};
|
|
2225
|
-
//# sourceMappingURL=manager-ui-
|
|
2512
|
+
//# sourceMappingURL=manager-ui-YHDECYKI.ts.map
|