@narumitw/pi-sync 0.60.5 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +32 -23
- package/dist/chunks/{chunk-F64YWRXG.ts → chunk-3E3TR3JE.ts} +4 -4
- package/dist/chunks/{chunk-YVH5VJR4.ts → chunk-6PFZUEUG.ts} +138 -61
- package/dist/chunks/chunk-6PFZUEUG.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-KPWZNMKM.ts → chunk-ECYCNZOE.ts} +1 -5
- package/dist/chunks/chunk-ECYCNZOE.ts.map +7 -0
- package/dist/chunks/chunk-GELYN4UC.ts +14 -0
- package/dist/chunks/chunk-GELYN4UC.ts.map +7 -0
- package/dist/chunks/{chunk-V2QIMC3U.ts → chunk-GSCZ4VXV.ts} +13 -8
- package/dist/chunks/chunk-GSCZ4VXV.ts.map +7 -0
- package/dist/chunks/{chunk-6W2SNZ5P.ts → chunk-IBXEM35O.ts} +8 -3
- package/dist/chunks/{chunk-6W2SNZ5P.ts.map → chunk-IBXEM35O.ts.map} +3 -3
- package/dist/chunks/{chunk-6KIWZ4AY.ts → chunk-INECVQNR.ts} +13 -12
- package/dist/chunks/chunk-INECVQNR.ts.map +7 -0
- package/dist/chunks/chunk-JREGWM2B.ts +139 -0
- package/dist/chunks/chunk-JREGWM2B.ts.map +7 -0
- package/dist/chunks/{chunk-277VHM2P.ts → chunk-MNYRU5U5.ts} +5 -2
- package/dist/chunks/{chunk-277VHM2P.ts.map → chunk-MNYRU5U5.ts.map} +2 -2
- package/dist/chunks/chunk-NHFGAZEC.ts +277 -0
- package/dist/chunks/chunk-NHFGAZEC.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-MCUZFUHY.ts → chunk-PWESMTH6.ts} +10 -10
- package/dist/chunks/{chunk-V4AMI3VL.ts → chunk-R3SAMXB6.ts} +10 -2
- package/dist/chunks/chunk-R3SAMXB6.ts.map +7 -0
- package/dist/chunks/{chunk-RNIEVDTR.ts → chunk-T3LABNHF.ts} +2 -2
- package/dist/chunks/{chunk-S3R3W3KF.ts → chunk-UMPA5S7X.ts} +2 -2
- package/dist/chunks/{chunk-WP2M67XZ.ts → chunk-WBIOSK76.ts} +2 -2
- package/dist/chunks/{chunk-LAXTCSX4.ts → chunk-ZB3GNX3P.ts} +124 -139
- package/dist/chunks/chunk-ZB3GNX3P.ts.map +7 -0
- package/dist/chunks/{chunk-HEB6YT64.ts → chunk-ZO52JM4H.ts} +2 -2
- package/dist/chunks/{command-handler-TNPWFIPG.ts → command-handler-6ATREPG7.ts} +44 -40
- package/dist/chunks/command-handler-6ATREPG7.ts.map +7 -0
- package/dist/chunks/{conflict-review-ETCSYJTH.ts → conflict-review-MAOGTIAI.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-DD6X4J2K.ts → file-selection-QR2KZVGD.ts} +28 -15
- package/dist/chunks/file-selection-QR2KZVGD.ts.map +7 -0
- package/dist/chunks/manager-result-dispatcher-MC6EQOQY.ts +19 -0
- package/dist/chunks/{manager-ui-LFONXWQN.ts → manager-ui-AOFUNXAJ.ts} +648 -305
- package/dist/chunks/manager-ui-AOFUNXAJ.ts.map +7 -0
- package/dist/chunks/remote-selection-ui-4BTP2OJR.ts +18 -0
- package/dist/chunks/{setup-switch-SPZE7HIQ.ts → setup-switch-Y6AMFFNK.ts} +7 -7
- package/dist/chunks/{setup-wizard-5JYKAEIT.ts → setup-wizard-5G426MOZ.ts} +18 -16
- package/dist/chunks/setup-wizard-5G426MOZ.ts.map +7 -0
- 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-6VGR2UVZ.ts → sync-inspection-ITZ6Z4DE.ts} +7 -7
- package/dist/chunks/{sync-operations-SAKAZL6Z.ts → sync-operations-NMVKF7SE.ts} +13 -9
- package/dist/chunks/sync-operations-NMVKF7SE.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 +265 -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 +715 -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 +186 -0
- package/dist/daemon/dist/engine/ignore/ignore-migration-prompt.js +139 -0
- package/dist/daemon/dist/engine/ignore/ignore-settings.js +322 -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 +301 -0
- package/dist/daemon/dist/engine/settings/settings-management.js +193 -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 +160 -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 +276 -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 +813 -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 +84 -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 +132 -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 +521 -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-apply.js +529 -0
- package/dist/daemon/dist/engine/sync/merge-journal.js +295 -0
- package/dist/daemon/dist/engine/sync/merge-transfer-error.js +64 -0
- package/dist/daemon/dist/engine/sync/merged-sync.js +674 -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 +104 -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 +33 -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 +733 -0
- package/dist/daemon/dist/engine/sync/sync-operations.js +3 -0
- package/dist/daemon/dist/engine/sync/sync-policy.js +621 -0
- package/dist/daemon/dist/engine/sync/sync-queries.js +212 -0
- package/dist/daemon/dist/engine/sync/sync-state.js +129 -0
- package/dist/daemon/dist/engine/sync/text-merge.js +124 -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 +344 -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 +272 -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 +953 -0
- package/dist/daemon/dist/service-host.js +174 -0
- package/dist/daemon/dist/upgrade-repair.js +55 -0
- package/dist/daemon/package.json +3 -0
- package/dist/index.ts +32 -32
- package/dist/package.json +6 -0
- package/docs/daemon-migration.md +27 -16
- package/package.json +11 -5
- package/skills/configure-pi-sync/SKILL.md +38 -13
- package/skills/configure-pi-sync/references/configuration.md +61 -34
- package/src/commands/command-execution.ts +8 -2
- package/src/daemon/pi-client.ts +1 -0
- package/src/settings/config.ts +1 -0
- package/src/sync/sync-operations.ts +18 -10
- package/src/sync/sync-policy.ts +5 -0
- package/src/ui/agent-mode-setting.ts +9 -1
- package/src/ui/excluded-paths-ui.ts +157 -2
- package/src/ui/file-selection.ts +12 -7
- package/src/ui/ignore-file-ui.ts +271 -0
- package/src/ui/ignore-migration-prompt.ts +65 -0
- package/src/ui/manager-state.ts +39 -20
- package/src/ui/manager-ui.ts +38 -19
- package/src/ui/remote-selection-ui.ts +159 -33
- package/src/ui/settings-frame.ts +2 -8
- package/src/ui/settings-review.ts +26 -0
- package/src/ui/settings-ui.ts +327 -199
- package/src/ui/setup/directory-rules.ts +81 -0
- package/src/ui/setup/git-ui.ts +14 -24
- package/src/ui/setup/s3-ui.ts +13 -26
- package/src/ui/setup/setup-actions.ts +0 -4
- package/src/ui/setup/setup-prompts.ts +99 -17
- package/src/ui/setup/setup-switcher.ts +4 -2
- package/src/ui/setup/setup-wizard.ts +5 -4
- package/src/ui/setup/webdav-ui.ts +13 -27
- package/src/ui/storage-connections-ui.ts +22 -14
- package/src/ui/sync-attention.ts +8 -3
- package/src/ui/sync-format.ts +8 -1
- package/src/ui/sync-setups-ui.ts +47 -27
- package/dist/chunks/chunk-6KIWZ4AY.ts.map +0 -7
- package/dist/chunks/chunk-KPWZNMKM.ts.map +0 -7
- package/dist/chunks/chunk-LAXTCSX4.ts.map +0 -7
- package/dist/chunks/chunk-V2QIMC3U.ts.map +0 -7
- package/dist/chunks/chunk-V4AMI3VL.ts.map +0 -7
- package/dist/chunks/chunk-YVH5VJR4.ts.map +0 -7
- package/dist/chunks/command-handler-TNPWFIPG.ts.map +0 -7
- package/dist/chunks/file-selection-DD6X4J2K.ts.map +0 -7
- package/dist/chunks/manager-result-dispatcher-2GFNWHDM.ts +0 -18
- package/dist/chunks/manager-ui-LFONXWQN.ts.map +0 -7
- package/dist/chunks/remote-selection-ui-GFR6TDTX.ts +0 -17
- package/dist/chunks/setup-wizard-5JYKAEIT.ts.map +0 -7
- package/dist/chunks/sync-operations-SAKAZL6Z.ts.map +0 -7
- /package/dist/chunks/{chunk-F64YWRXG.ts.map → chunk-3E3TR3JE.ts.map} +0 -0
- /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-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-MCUZFUHY.ts.map → chunk-PWESMTH6.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-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-ETCSYJTH.ts.map → conflict-review-MAOGTIAI.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-2GFNWHDM.ts.map → manager-result-dispatcher-MC6EQOQY.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-GFR6TDTX.ts.map → remote-selection-ui-4BTP2OJR.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-SPZE7HIQ.ts.map → setup-switch-Y6AMFFNK.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-6VGR2UVZ.ts.map → sync-inspection-ITZ6Z4DE.ts.map} +0 -0
- /package/dist/chunks/{sync-state-2LMIXJ2C.ts.map → sync-state-QIT64TKV.ts.map} +0 -0
package/src/ui/settings-ui.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { defineMenu, type MenuSettingItem, runMenu } from "@narumitw/pi-tui-kit";
|
|
3
|
-
import { loadConfig } from "../settings/config.js";
|
|
4
|
-
import { localConfigPath } from "../settings/config-file.js";
|
|
3
|
+
import { configFromSettings, loadConfig, loadSettingsConfig } from "../settings/config.js";
|
|
4
|
+
import { localConfigPath, readActiveLocalConfigDocumentForRepair } from "../settings/config-file.js";
|
|
5
5
|
import { updateSyncSetup } from "../settings/settings-management.js";
|
|
6
6
|
import { updateLocalConfig } from "../settings/settings-store.js";
|
|
7
|
+
import { validateSettingsDocument } from "../settings/settings-validation.js";
|
|
7
8
|
import { normalizeLocalFields, sameLocalFields } from "../sync/local-fields.js";
|
|
8
9
|
import {
|
|
9
10
|
SETUP_SWITCH_ACTION_OPTIONS,
|
|
@@ -19,9 +20,11 @@ import {
|
|
|
19
20
|
saveContinuousMode,
|
|
20
21
|
} from "./agent-mode-setting.js";
|
|
21
22
|
import type { RunRoute } from "./cancellable-operation.js";
|
|
22
|
-
import { showExcludedPaths } from "./excluded-paths-ui.js";
|
|
23
|
+
import { directoryScopeSummary, showExcludedPaths } from "./excluded-paths-ui.js";
|
|
24
|
+
import { ignoreFileSettingsAvailable, manualIgnoreFileGuidance, showIgnoreFileAction } from "./ignore-file-ui.js";
|
|
23
25
|
import { dispatchManagerResult } from "./manager-result-dispatcher.js";
|
|
24
26
|
import { boundedSettingsUI } from "./settings-frame.js";
|
|
27
|
+
import { IGNORE_SETUP_MANAGEMENT_LIMIT, ignoreSetupRecovery } from "./settings-review.js";
|
|
25
28
|
import { showEditSyncSetupStorage, showSyncSetupManager } from "./setup/setup-actions.js";
|
|
26
29
|
import { showStorageConnections } from "./storage-connections-ui.js";
|
|
27
30
|
import { AUTOMATIC_SYNC_DESCRIPTION, STARTUP_TRANSFER_DESCRIPTION, startupTransferSummary } from "./sync-behavior.js";
|
|
@@ -41,41 +44,76 @@ export async function showSyncSettings(
|
|
|
41
44
|
disposition = "exit";
|
|
42
45
|
return { kind: "close" as const };
|
|
43
46
|
};
|
|
44
|
-
if (ctx.mode !== "tui")
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
if (!ctx.hasUI || signal?.aborted || (ctx.mode !== "tui" && ctx.mode !== "rpc")) return disposition;
|
|
48
|
+
const validateSettingsOwner = captureMutationOwner(ctx, signal);
|
|
49
|
+
const isCurrent = () => {
|
|
50
|
+
try {
|
|
51
|
+
validateSettingsOwner();
|
|
52
|
+
return true;
|
|
53
|
+
} catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
if (ctx.mode === "rpc") {
|
|
58
|
+
// Preserve RPC catalog management; preference/credential editing stays TUI-only.
|
|
59
|
+
const document = await readActiveLocalConfigDocumentForRepair().catch(() => null);
|
|
60
|
+
if (!isCurrent()) return disposition;
|
|
61
|
+
const settingsPath = document?.path ?? localConfigPath();
|
|
62
|
+
let config: Awaited<ReturnType<typeof loadSettingsConfig>> | undefined;
|
|
63
|
+
try {
|
|
64
|
+
if (document) config = configFromSettings(validateSettingsDocument(document.parsed), reviewedSetup);
|
|
65
|
+
} catch {
|
|
66
|
+
config = undefined;
|
|
67
|
+
}
|
|
68
|
+
ctx.ui.notify(
|
|
69
|
+
[
|
|
70
|
+
document === null
|
|
71
|
+
? "Could not read the active pi-sync settings file. Check file access or repair the JSON before reopening /sync."
|
|
72
|
+
: `Edit pi-sync settings manually: ${safeTerminalText(settingsPath)}`,
|
|
73
|
+
...(config?.reservedIgnoreNames !== undefined
|
|
74
|
+
? [IGNORE_SETUP_MANAGEMENT_LIMIT, ...ignoreSetupRecovery(settingsPath)]
|
|
75
|
+
: []),
|
|
76
|
+
...(config?.pathPolicy === "ignore-file"
|
|
77
|
+
? [manualIgnoreFileGuidance(config.ignoreFile ?? ".syncignore")]
|
|
78
|
+
: config?.scope === "agent-directory"
|
|
79
|
+
? directoryScopeSummary(config)
|
|
80
|
+
: []),
|
|
81
|
+
].join("\n"),
|
|
82
|
+
"info",
|
|
83
|
+
);
|
|
84
|
+
const management = defineMenu<undefined, "management", "setups" | "connections", ExtensionCommandContext>({
|
|
85
|
+
start: "management",
|
|
86
|
+
screens: {
|
|
87
|
+
management: () => ({
|
|
88
|
+
kind: "actions",
|
|
89
|
+
title: "Sync settings management",
|
|
90
|
+
items: [
|
|
91
|
+
{ id: "setups", label: "Manage sync setups", action: "setups" },
|
|
92
|
+
{ id: "connections", label: "Manage storage connections", action: "connections" },
|
|
93
|
+
],
|
|
94
|
+
hint: "back",
|
|
95
|
+
}),
|
|
96
|
+
},
|
|
97
|
+
actions: {
|
|
98
|
+
setups: async ({ signal: actionSignal }) => {
|
|
99
|
+
const result = await showSyncSetupManager(ctx, runRoute, actionSignal);
|
|
100
|
+
return result === "exit" ? exitSettings() : { kind: "stay" };
|
|
60
101
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return result === "exit" ? exitSettings() : { kind: "stay" };
|
|
65
|
-
},
|
|
66
|
-
connections: async ({ signal: actionSignal }) => {
|
|
67
|
-
await showStorageConnections(ctx, actionSignal);
|
|
68
|
-
return { kind: "stay" };
|
|
69
|
-
},
|
|
102
|
+
connections: async ({ signal: actionSignal }) => {
|
|
103
|
+
await showStorageConnections(ctx, actionSignal);
|
|
104
|
+
return { kind: "stay" };
|
|
70
105
|
},
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
}
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
await runMenu(ctx, management, { getState: () => undefined, signal, isCurrent });
|
|
74
109
|
return disposition;
|
|
75
110
|
}
|
|
76
|
-
const initial = await
|
|
77
|
-
if (
|
|
111
|
+
const initial = await loadSettingsConfig(reviewedSetup);
|
|
112
|
+
if (!isCurrent()) return disposition;
|
|
113
|
+
const ignoreAvailable = await ignoreFileSettingsAvailable(ctx, signal);
|
|
114
|
+
if (!isCurrent()) return disposition;
|
|
78
115
|
const setupName = initial.setupName;
|
|
116
|
+
type SettingsState = Awaited<ReturnType<typeof loadSettingsConfig>>;
|
|
79
117
|
type Action =
|
|
80
118
|
| "automatic"
|
|
81
119
|
| "automatic-transfer"
|
|
@@ -90,6 +128,9 @@ export async function showSyncSettings(
|
|
|
90
128
|
| "on-switch"
|
|
91
129
|
| "include"
|
|
92
130
|
| "exclude"
|
|
131
|
+
| "ignore-switch"
|
|
132
|
+
| "ignore-edit"
|
|
133
|
+
| "ignore-migrate"
|
|
93
134
|
| "remote-include"
|
|
94
135
|
| "storage-location"
|
|
95
136
|
| "setups"
|
|
@@ -97,7 +138,7 @@ export async function showSyncSettings(
|
|
|
97
138
|
let saveStatus = "Simple choices save immediately. Back does not undo saved changes.";
|
|
98
139
|
// Keep Kit's existing settings adapter: native SettingsList has no async save/rollback
|
|
99
140
|
// contract or injected keybindings. Kit preserves these safety and accessibility behaviors.
|
|
100
|
-
const menu = defineMenu<
|
|
141
|
+
const menu = defineMenu<SettingsState, "settings", Action, ExtensionCommandContext>({
|
|
101
142
|
start: "settings",
|
|
102
143
|
screens: {
|
|
103
144
|
settings: ({ state }) => ({
|
|
@@ -105,162 +146,231 @@ export async function showSyncSettings(
|
|
|
105
146
|
title: "Pi Sync Settings",
|
|
106
147
|
lines: [
|
|
107
148
|
`Setup: ${safeTerminalText(state.setupName)} · Connection: ${safeTerminalText(state.connectionName)}`,
|
|
108
|
-
|
|
149
|
+
...(state.reservedIgnoreNames !== undefined
|
|
150
|
+
? [
|
|
151
|
+
"Setup preferences are read-only; adding, editing, and switching setups are unavailable.",
|
|
152
|
+
state.pathPolicy === "ignore-file" && !ignoreAvailable
|
|
153
|
+
? manualIgnoreFileGuidance(state.ignoreFile ?? ".syncignore")
|
|
154
|
+
: "Open Manage sync setups for manual recovery.",
|
|
155
|
+
]
|
|
156
|
+
: [saveStatus]),
|
|
109
157
|
],
|
|
110
|
-
items:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
158
|
+
items: (
|
|
159
|
+
[
|
|
160
|
+
...(state.pathPolicy === "ignore-file"
|
|
161
|
+
? ignoreAvailable
|
|
162
|
+
? [
|
|
163
|
+
{
|
|
164
|
+
id: "ignoreFile",
|
|
165
|
+
label: "Ignore file",
|
|
166
|
+
description: "Select another existing file in the Pi agent directory. No transfer starts.",
|
|
167
|
+
currentValue: safeTerminalText(state.ignoreFile ?? ".syncignore"),
|
|
168
|
+
action: "ignore-switch" as const,
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: "ignoreRules",
|
|
172
|
+
label: "Edit ignore rules…",
|
|
173
|
+
description: `Edit the existing local rules, then confirm separately. Sessions: ${state.include.includes("sessions") ? "opted in (ignore rules still apply)" : "off"}.`,
|
|
174
|
+
currentValue: "Edit",
|
|
175
|
+
action: "ignore-edit" as const,
|
|
176
|
+
},
|
|
177
|
+
]
|
|
178
|
+
: []
|
|
179
|
+
: ignoreAvailable
|
|
180
|
+
? [
|
|
181
|
+
{
|
|
182
|
+
id: "migrateIgnoreFile",
|
|
183
|
+
label: "Migrate to ignore file…",
|
|
184
|
+
description:
|
|
185
|
+
"Review the scope change for this legacy setup. Migration does not start a transfer.",
|
|
186
|
+
currentValue: "Review",
|
|
187
|
+
action: "ignore-migrate" as const,
|
|
188
|
+
},
|
|
189
|
+
]
|
|
190
|
+
: state.reservedIgnoreNames !== undefined
|
|
191
|
+
? []
|
|
192
|
+
: state.scope === "agent-directory"
|
|
193
|
+
? [
|
|
194
|
+
{
|
|
195
|
+
id: "include",
|
|
196
|
+
label: "Agent directory scope",
|
|
197
|
+
description:
|
|
198
|
+
"Edit exclusions, re-inclusions, and session opt-in in one reviewed draft. No transfer starts.",
|
|
199
|
+
currentValue: `${state.exclude?.length ?? 0} excluded · ${state.reinclude?.length ?? 0} re-included · Sessions ${state.include.includes("sessions") ? "opted in" : "off"}`,
|
|
200
|
+
action: "include" as const,
|
|
201
|
+
},
|
|
202
|
+
]
|
|
203
|
+
: [
|
|
204
|
+
{
|
|
205
|
+
id: "include",
|
|
206
|
+
label: "Included paths",
|
|
207
|
+
description:
|
|
208
|
+
"This setup: choose paths in a draft, then review and Save or Discard. No transfer is started.",
|
|
209
|
+
currentValue: `${state.include.length} paths · Edit`,
|
|
210
|
+
action: "include" as const,
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
id: "exclude",
|
|
214
|
+
label: "Excluded paths",
|
|
215
|
+
description:
|
|
216
|
+
"This setup: draft relative paths or *, ?, ** patterns, then review Save/Discard. No transfer starts; old history is retained.",
|
|
217
|
+
currentValue: `${state.exclude?.length ?? 0} rules · Edit`,
|
|
218
|
+
action: "exclude" as const,
|
|
219
|
+
},
|
|
220
|
+
]),
|
|
221
|
+
...(state.reservedIgnoreNames !== undefined
|
|
222
|
+
? []
|
|
223
|
+
: [
|
|
224
|
+
{
|
|
225
|
+
id: "remoteInclude",
|
|
226
|
+
label:
|
|
227
|
+
ignoreAvailable || state.scope === "agent-directory"
|
|
228
|
+
? "Compare sync policies"
|
|
229
|
+
: "Compare included paths",
|
|
230
|
+
description:
|
|
231
|
+
"Compare what sync manages on this device and the remote, not file contents. No files transfer unless you explicitly Continue.",
|
|
232
|
+
currentValue: "Review",
|
|
233
|
+
action: "remote-include" as const,
|
|
234
|
+
},
|
|
235
|
+
]),
|
|
236
|
+
{
|
|
237
|
+
id: "localFields",
|
|
238
|
+
label: "Machine-local fields",
|
|
239
|
+
description:
|
|
240
|
+
"This setup: settings.json root fields excluded from future portable snapshots, not project overrides. Policy changes require reviewed directional migration; old history remains.",
|
|
241
|
+
currentValue: `${state.localFields?.length ?? 0} fields · Edit`,
|
|
242
|
+
action: "local-fields",
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
id: "storageLocation",
|
|
246
|
+
label: "Storage location",
|
|
247
|
+
description: "This setup: review and save bucket, branch, or path changes. Remote history is not moved.",
|
|
248
|
+
currentValue:
|
|
249
|
+
state.backend.type === "s3"
|
|
250
|
+
? `${safeTerminalText(state.backend.destination.bucket)} · ${safeTerminalText(state.backend.destination.prefix)}`
|
|
251
|
+
: state.backend.type === "git"
|
|
252
|
+
? `${safeTerminalText(state.backend.destination.branch)} · ${safeTerminalText(state.backend.destination.directory)}`
|
|
253
|
+
: safeTerminalText(state.backend.destination.path),
|
|
254
|
+
action: "storage-location",
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
id: "setups",
|
|
258
|
+
label: "Manage sync setups",
|
|
259
|
+
description:
|
|
260
|
+
state.reservedIgnoreNames !== undefined
|
|
261
|
+
? "Review configured setups and recovery options. Adding, editing, and switching are unavailable."
|
|
262
|
+
: "This device: add, switch, edit, or remove sync setups. Each edit identifies its owner before saving.",
|
|
263
|
+
currentValue: "Open",
|
|
264
|
+
action: "setups",
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
id: "connections",
|
|
268
|
+
label: "Manage storage connections",
|
|
269
|
+
description:
|
|
270
|
+
state.reservedIgnoreNames !== undefined
|
|
271
|
+
? "Review shared connections. Connection changes are unavailable while ignore-file setups are configured."
|
|
272
|
+
: "Shared connections on this device: review affected setups before saving server or credential changes.",
|
|
273
|
+
currentValue: "Open",
|
|
274
|
+
action: "connections",
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
id: "automatic",
|
|
278
|
+
label: "Automatic sync",
|
|
279
|
+
description: AUTOMATIC_SYNC_DESCRIPTION,
|
|
280
|
+
currentValue: state.automatic ? "On" : "Off",
|
|
281
|
+
values: ["On", "Off"],
|
|
282
|
+
action: "automatic",
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: "automaticTransfer",
|
|
286
|
+
label: "Startup transfer",
|
|
287
|
+
description: `${STARTUP_TRANSFER_DESCRIPTION} Saved preference and requirements: ${startupTransferSummary(state)}.`,
|
|
288
|
+
currentValue: state.automaticTransfer ? "On" : "Off",
|
|
289
|
+
values: ["On", "Off"],
|
|
290
|
+
action: "automatic-transfer",
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
id: "agentMode",
|
|
294
|
+
label: "Autonomous sync",
|
|
295
|
+
description: AGENT_MODE_DESCRIPTION,
|
|
296
|
+
currentValue: state.agentMode ? "On" : "Off",
|
|
297
|
+
values: ["On", "Off"],
|
|
298
|
+
action: "agent-mode",
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
id: "continuous",
|
|
302
|
+
label: "Continuous sync",
|
|
303
|
+
description: `${CONTINUOUS_DESCRIPTION}${state.continuous && !state.agentMode ? " Saved On, but paused until Autonomous sync is enabled." : ""}`,
|
|
304
|
+
currentValue: state.continuous ? "On" : "Off",
|
|
305
|
+
values: ["On", "Off"],
|
|
306
|
+
action: "continuous",
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
id: "onSwitch",
|
|
310
|
+
label: "On setup switch",
|
|
311
|
+
description:
|
|
312
|
+
"All setups on this device: ask before a pull review, open it automatically, or switch without pulling. Applies to subsequent switches.",
|
|
313
|
+
currentValue: setupSwitchActionLabel(state.onSwitch),
|
|
314
|
+
values: SETUP_SWITCH_ACTION_OPTIONS.map(({ label }) => label),
|
|
315
|
+
action: "on-switch",
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
id: "mergeSettings",
|
|
319
|
+
label: "Merge settings fields",
|
|
320
|
+
description:
|
|
321
|
+
"This setup, opt-in: merge independent global settings.json root fields with a verified private ancestor. Arrays and nested objects remain atomic. Applies to subsequent sync; no reload.",
|
|
322
|
+
currentValue: state.mergeSettings ? "On" : "Off",
|
|
323
|
+
values: ["On", "Off"],
|
|
324
|
+
action: "merge-settings",
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
id: "contentPolicy",
|
|
328
|
+
label: "Content merge / partial progress",
|
|
329
|
+
description: `This setup, opt-in: ${state.scope === "agent-directory" ? "review format compatibility" : "review the version-5 upgrade"} before saving. Merge bounded text and prefix-only sessions; partial progress keeps withheld versions and baselines. Applies to subsequent sync; disabling does not clear recovery evidence.`,
|
|
330
|
+
currentValue: state.mergeContent
|
|
331
|
+
? state.partialSync
|
|
332
|
+
? "Merge + partial"
|
|
333
|
+
: "Merge only"
|
|
334
|
+
: state.partialSync
|
|
335
|
+
? "Partial only"
|
|
336
|
+
: "Off",
|
|
337
|
+
values: ["Off", "Merge only", "Merge + partial", "Partial only"],
|
|
338
|
+
action: "content-policy",
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
id: "skipSecretScan",
|
|
342
|
+
label: "Skip secret scan",
|
|
343
|
+
description:
|
|
344
|
+
"All setups on this device: skip possible-secret checks on subsequent pushes, including automatic pushes. Other safety checks remain. Diagnostics still scans.",
|
|
345
|
+
currentValue: state.skipSecretScan ? "On" : "Off",
|
|
346
|
+
values: ["On", "Off"],
|
|
347
|
+
action: "skip-secret-scan",
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
id: "showStatus",
|
|
351
|
+
label: "Show sync status",
|
|
352
|
+
description:
|
|
353
|
+
"All setups on this device: saved and applied immediately to Pi status. Review widgets and notifications remain available.",
|
|
354
|
+
currentValue: state.showStatus ? "On" : "Off",
|
|
355
|
+
values: ["On", "Off"],
|
|
356
|
+
action: "show-status",
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
id: "debug",
|
|
360
|
+
label: "Debug startup timings",
|
|
361
|
+
description:
|
|
362
|
+
"All setups on this device: show startup durations in the TUI transcript or RPC notifications, including initial Continuous sync. Applies next session start; no credentials or file contents.",
|
|
363
|
+
currentValue: state.debug ? "On" : "Off",
|
|
364
|
+
values: ["On", "Off"],
|
|
365
|
+
action: "debug",
|
|
366
|
+
},
|
|
367
|
+
] satisfies MenuSettingItem<Action>[]
|
|
368
|
+
).map((item) =>
|
|
369
|
+
state.reservedIgnoreNames !== undefined &&
|
|
370
|
+
!["setups", "connections", "ignoreFile", "ignoreRules", "migrateIgnoreFile"].includes(item.id)
|
|
371
|
+
? { ...item, disabled: true }
|
|
372
|
+
: item,
|
|
373
|
+
),
|
|
264
374
|
}),
|
|
265
375
|
},
|
|
266
376
|
actions: {
|
|
@@ -290,7 +400,7 @@ export async function showSyncSettings(
|
|
|
290
400
|
if (
|
|
291
401
|
!(await ctx.ui.confirm(
|
|
292
402
|
"Save content policy?",
|
|
293
|
-
"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
|
|
403
|
+
`${previous.scope === "agent-directory" ? "Agent directory scope keeps settings version 7 and snapshot version 5; older clients must refuse them." : "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.`,
|
|
294
404
|
{ signal: mutationSignal },
|
|
295
405
|
))
|
|
296
406
|
)
|
|
@@ -302,13 +412,14 @@ export async function showSyncSettings(
|
|
|
302
412
|
const setup = current.syncSetups[setupName];
|
|
303
413
|
if (
|
|
304
414
|
!setup ||
|
|
415
|
+
setup.sync.scope !== previous.scope ||
|
|
305
416
|
Boolean(setup.sync.mergeContent) !== Boolean(previous.mergeContent) ||
|
|
306
417
|
Boolean(setup.sync.partialSync) !== Boolean(previous.partialSync)
|
|
307
418
|
)
|
|
308
419
|
throw new Error("Content policy changed during review.");
|
|
309
420
|
return {
|
|
310
421
|
...current,
|
|
311
|
-
version: current.version
|
|
422
|
+
version: current.version >= 6 ? current.version : 5,
|
|
312
423
|
syncSetups: {
|
|
313
424
|
...current.syncSetups,
|
|
314
425
|
[setupName]: { ...setup, sync: { ...setup.sync, mergeContent, partialSync } },
|
|
@@ -364,7 +475,7 @@ export async function showSyncSettings(
|
|
|
364
475
|
if (sameLocalFields(previous.localFields, fields)) return { kind: "stay" };
|
|
365
476
|
const confirmed = await ctx.ui.confirm(
|
|
366
477
|
"Save portable field policy?",
|
|
367
|
-
"This opts into at least settings/snapshot version 4/2; exclude-enabled setups retain
|
|
478
|
+
`${previous.scope === "agent-directory" ? "Agent directory scope keeps settings version 7 and 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.`,
|
|
368
479
|
{ signal: mutationSignal },
|
|
369
480
|
);
|
|
370
481
|
validate();
|
|
@@ -373,7 +484,11 @@ export async function showSyncSettings(
|
|
|
373
484
|
await updateLocalConfig((current) => {
|
|
374
485
|
validate();
|
|
375
486
|
const setup = current.syncSetups[setupName];
|
|
376
|
-
if (
|
|
487
|
+
if (
|
|
488
|
+
!setup ||
|
|
489
|
+
setup.sync.scope !== previous.scope ||
|
|
490
|
+
!sameLocalFields(setup.sync.localFields, previous.localFields)
|
|
491
|
+
)
|
|
377
492
|
throw new Error("Field policy changed while under review; reopen settings.");
|
|
378
493
|
return {
|
|
379
494
|
...current,
|
|
@@ -560,7 +675,11 @@ export async function showSyncSettings(
|
|
|
560
675
|
await showExcludedPaths(ctx, setupName, editorSignal);
|
|
561
676
|
return resumeSettings(editorSignal);
|
|
562
677
|
},
|
|
563
|
-
"
|
|
678
|
+
"ignore-switch": ignoreAction("switch"),
|
|
679
|
+
"ignore-edit": ignoreAction("edit"),
|
|
680
|
+
"ignore-migrate": ignoreAction("migrate"),
|
|
681
|
+
"remote-include": async ({ state, signal: actionSignal }) => {
|
|
682
|
+
if (state.reservedIgnoreNames !== undefined) return { kind: "rejected" };
|
|
564
683
|
const reviewSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
565
684
|
const { showRemoteSelectionReview } = await import("./remote-selection-ui.js");
|
|
566
685
|
if (reviewSignal.aborted) return { kind: "rejected" };
|
|
@@ -604,11 +723,20 @@ export async function showSyncSettings(
|
|
|
604
723
|
return result;
|
|
605
724
|
};
|
|
606
725
|
}
|
|
726
|
+
function ignoreAction(action: Parameters<typeof showIgnoreFileAction>[2]) {
|
|
727
|
+
return async ({ state, signal: actionSignal }: { state: SettingsState; signal: AbortSignal }) => {
|
|
728
|
+
if (!ignoreAvailable || (state.pathPolicy === "ignore-file") === (action === "migrate"))
|
|
729
|
+
return { kind: "rejected" as const };
|
|
730
|
+
const editorSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
731
|
+
await showIgnoreFileAction(ctx, setupName, action, state.ignoreFile ?? ".syncignore", editorSignal);
|
|
732
|
+
return resumeSettings(editorSignal);
|
|
733
|
+
};
|
|
734
|
+
}
|
|
607
735
|
async function resumeSettings(editorSignal: AbortSignal) {
|
|
608
|
-
if (editorSignal.aborted) return { kind: "close" as const };
|
|
736
|
+
if (editorSignal.aborted || !isCurrent()) return { kind: "close" as const };
|
|
609
737
|
try {
|
|
610
|
-
const active = await
|
|
611
|
-
if (editorSignal.aborted || active.setupName !== setupName) return { kind: "close" as const };
|
|
738
|
+
const active = await loadSettingsConfig();
|
|
739
|
+
if (editorSignal.aborted || !isCurrent() || active.setupName !== setupName) return { kind: "close" as const };
|
|
612
740
|
// Stay reloads authoritative rows without pushing a duplicate screen or clearing search.
|
|
613
741
|
return { kind: "stay" as const };
|
|
614
742
|
} catch {
|
|
@@ -616,9 +744,9 @@ export async function showSyncSettings(
|
|
|
616
744
|
}
|
|
617
745
|
}
|
|
618
746
|
await runMenu({ ...ctx, ui: boundedSettingsUI(ctx) }, menu, {
|
|
619
|
-
getState: () =>
|
|
747
|
+
getState: () => loadSettingsConfig(setupName),
|
|
620
748
|
signal,
|
|
621
|
-
isCurrent
|
|
749
|
+
isCurrent,
|
|
622
750
|
});
|
|
623
751
|
return disposition;
|
|
624
752
|
}
|