@narumitw/pi-sync 0.61.0 → 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 +12 -0
- package/README.md +24 -17
- package/dist/chunks/{chunk-EMVZL4PH.ts → chunk-3E3TR3JE.ts} +4 -4
- package/dist/chunks/{chunk-JVFCVPPD.ts → chunk-6PFZUEUG.ts} +41 -18
- 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-4SR3ZYHA.ts → chunk-GELYN4UC.ts} +2 -2
- package/dist/chunks/{chunk-S7F4FOAS.ts → chunk-GSCZ4VXV.ts} +5 -5
- package/dist/chunks/{chunk-YQSFJLJ3.ts → chunk-IBXEM35O.ts} +4 -3
- package/dist/chunks/{chunk-E3YLRLJM.ts → chunk-INECVQNR.ts} +10 -10
- package/dist/chunks/{chunk-2JHAN3ZO.ts → chunk-JREGWM2B.ts} +3 -3
- 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-2ZGV5KNC.ts → chunk-NHFGAZEC.ts} +11 -8
- 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-PJMM75W5.ts → chunk-PWESMTH6.ts} +6 -6
- package/dist/chunks/{chunk-ZVGRZD4C.ts → chunk-R3SAMXB6.ts} +2 -2
- 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-4KTJLJSJ.ts → chunk-ZB3GNX3P.ts} +11 -11
- package/dist/chunks/{chunk-HEB6YT64.ts → chunk-ZO52JM4H.ts} +2 -2
- package/dist/chunks/{command-handler-K4XJOGYC.ts → command-handler-6ATREPG7.ts} +16 -16
- package/dist/chunks/command-handler-6ATREPG7.ts.map +7 -0
- package/dist/chunks/{conflict-review-IGKY2TOJ.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-MGGVOKM7.ts → file-selection-QR2KZVGD.ts} +10 -10
- package/dist/chunks/manager-result-dispatcher-MC6EQOQY.ts +19 -0
- package/dist/chunks/{manager-ui-KYQ5AZJS.ts → manager-ui-AOFUNXAJ.ts} +547 -135
- 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-D6K6PBPC.ts → setup-switch-Y6AMFFNK.ts} +7 -7
- package/dist/chunks/{setup-wizard-4DYUDHJR.ts → setup-wizard-5G426MOZ.ts} +10 -10
- 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-ITZ6Z4DE.ts} +5 -5
- package/dist/chunks/{sync-operations-BVWYYKH3.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 +21 -21
- 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 +38 -13
- package/skills/configure-pi-sync/references/configuration.md +2 -2
- package/src/commands/command-execution.ts +1 -1
- package/src/settings/config.ts +1 -0
- package/src/sync/sync-operations.ts +18 -10
- package/src/ui/excluded-paths-ui.ts +4 -1
- package/src/ui/ignore-file-ui.ts +271 -0
- package/src/ui/ignore-migration-prompt.ts +65 -0
- package/src/ui/manager-state.ts +27 -13
- package/src/ui/manager-ui.ts +38 -19
- package/src/ui/remote-selection-ui.ts +41 -8
- package/src/ui/settings-review.ts +26 -0
- package/src/ui/settings-ui.ts +316 -213
- package/src/ui/storage-connections-ui.ts +20 -12
- package/src/ui/sync-setups-ui.ts +45 -27
- package/dist/chunks/chunk-2ZGV5KNC.ts.map +0 -7
- package/dist/chunks/chunk-JVFCVPPD.ts.map +0 -7
- package/dist/chunks/command-handler-K4XJOGYC.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-EMVZL4PH.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-4SR3ZYHA.ts.map → chunk-GELYN4UC.ts.map} +0 -0
- /package/dist/chunks/{chunk-S7F4FOAS.ts.map → chunk-GSCZ4VXV.ts.map} +0 -0
- /package/dist/chunks/{chunk-YQSFJLJ3.ts.map → chunk-IBXEM35O.ts.map} +0 -0
- /package/dist/chunks/{chunk-E3YLRLJM.ts.map → chunk-INECVQNR.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-PJMM75W5.ts.map → chunk-PWESMTH6.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-WP2M67XZ.ts.map → chunk-WBIOSK76.ts.map} +0 -0
- /package/dist/chunks/{chunk-4KTJLJSJ.ts.map → chunk-ZB3GNX3P.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-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/{file-selection-MGGVOKM7.ts.map → file-selection-QR2KZVGD.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-4VJVDEUD.ts.map → manager-result-dispatcher-MC6EQOQY.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-W3KOZM3W.ts.map → remote-selection-ui-4BTP2OJR.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-D6K6PBPC.ts.map → setup-switch-Y6AMFFNK.ts.map} +0 -0
- /package/dist/chunks/{setup-wizard-4DYUDHJR.ts.map → setup-wizard-5G426MOZ.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-ITZ6Z4DE.ts.map} +0 -0
- /package/dist/chunks/{sync-state-2LMIXJ2C.ts.map → sync-state-QIT64TKV.ts.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @narumitw/pi-sync
|
|
2
2
|
|
|
3
|
+
## 0.62.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d27317a: Prepare Pi Sync's local ignore-file policy, including recoverable default-file creation, settings review, and versioned snapshot compatibility checks. Existing setups are not migrated automatically. The new setup flow and first-open migration prompt remain disabled. Settings can show an existing rule file for manual editing; the daemon does not replace it. Settings shows the active settings path in RPC and explains which setup actions are unavailable while ignore-file transfers are disabled.
|
|
8
|
+
- 5b9146b: Let the `configure-pi-sync` skill apply and verify requested local settings edits, such as adding exclusions, through the running Pi Sync daemon without starting a transfer.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 5262897: Ship the daemon with Pi Sync so npm installs no longer require the standalone daemon package. The daemon still runs in a separate Node.js process with the same ownership and upgrade rules. If you only install Pi Sync, run `node <pi-sync-package>/dist/daemon/dist/cli.js` to use the daemon CLI. Standalone daemon releases do not update the bundled copy; update Pi Sync to get a newer bundled build.
|
|
13
|
+
- 4073de5: Fix Windows recovery when NTFS changes a restored file's creation time during rename. Keep exact content, file ID, spelling, and pre-rename ownership checks, and preserve existing recovery journal formats. Make the daemon build use the Node compiler entrypoint instead of spawning a Windows command script.
|
|
14
|
+
|
|
3
15
|
## 0.61.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Pi Sync synchronizes selected Pi settings and content across machines through Git, WebDAV, Cloudflare R2, or another S3-compatible store.
|
|
6
6
|
Reusable storage connections hold credentials, while named sync setups define exactly what to sync, where to store it, and whether to sync automatically. Pi owns the interface; the separate [@narumitw/pi-sync-daemon service](https://github.com/narumiruna/pi-extensions/tree/main/packages/pi-sync-daemon) owns execution.
|
|
7
7
|
|
|
8
|
-
> **Experimental daemon migration:**
|
|
8
|
+
> **Experimental daemon migration:** close or upgrade older Pi processes and review ownership before real-data use. See [migration and release restrictions](./docs/daemon-migration.md).
|
|
9
9
|
|
|
10
10
|
## ✨ Features
|
|
11
11
|
|
|
@@ -17,10 +17,12 @@ Reusable storage connections hold credentials, while named sync setups define ex
|
|
|
17
17
|
- Writes settings atomically, preserves unknown fields, rejects stale edits, and fails closed on unsafe configuration.
|
|
18
18
|
- Offers default-off Autonomous sync for eligible startup and Sync now transfers without another transfer confirmation, with model-assisted conflict resolution and a separate Continuous sync opt-in.
|
|
19
19
|
- Shares one detached synchronization service across Pi clients, with a generated split UI client runtime.
|
|
20
|
-
- Bundles
|
|
20
|
+
- Bundles an on-demand skill for agent-assisted settings edits and configuration questions.
|
|
21
21
|
|
|
22
22
|
## 📦 Install
|
|
23
23
|
|
|
24
|
+
Use Node.js 22.19.0 or later for the daemon, the same minimum as the standalone package. The Pi Sync npm package includes the daemon code; no separate daemon installation is needed. The daemon still runs as a separate process.
|
|
25
|
+
|
|
24
26
|
```bash
|
|
25
27
|
pi install npm:@narumitw/pi-sync
|
|
26
28
|
```
|
|
@@ -31,7 +33,7 @@ Try without installing permanently:
|
|
|
31
33
|
pi -e npm:@narumitw/pi-sync
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
Build
|
|
36
|
+
Build and try a local checkout from the repository root:
|
|
35
37
|
|
|
36
38
|
```bash
|
|
37
39
|
npm install
|
|
@@ -41,13 +43,11 @@ npm --workspace @narumitw/pi-sync run build
|
|
|
41
43
|
pi -e ./packages/pi-sync
|
|
42
44
|
```
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
Pi loads `dist/index.ts` from the package directory, so build Kit and complete the local daemon build before building Pi Sync. The runtime-only daemon output from Git installation preparation is not enough for this build.
|
|
45
47
|
|
|
46
48
|
Extensions run with Pi's permissions, so install only packages from sources you trust.
|
|
47
49
|
|
|
48
|
-
Revoke retained unattended permission before updating
|
|
49
|
-
sessions. If the upgrade is blocked or the old owner's exit is uncertain, follow the
|
|
50
|
-
[daemon upgrade guide](./docs/daemon-migration.md#ownership-and-upgrade).
|
|
50
|
+
Update Pi Sync to get a newer bundled daemon. Updating the standalone package does not change the copy in Pi Sync. Revoke retained unattended permission before updating, then use `/reload` in open Pi sessions. If the upgrade is blocked or the old owner's exit is uncertain, follow the [daemon upgrade guide](./docs/daemon-migration.md#ownership-and-upgrade).
|
|
51
51
|
|
|
52
52
|
Use a Pi runtime that satisfies this package’s declared peer floor. Installing an extension dependency does not upgrade a separately installed Pi runtime. The declared Kit floor supplies exact scrolling/paginated review and configured-keybinding support.
|
|
53
53
|
|
|
@@ -172,7 +172,9 @@ Print and JSON modes do not support `/sync` because UI output is not observable
|
|
|
172
172
|
|
|
173
173
|
Run `/sync` → **Set up sync** to create the canonical private user file at `<getAgentDir()>/pi-sync.json` (normally `~/.pi/agent/pi-sync.json`).
|
|
174
174
|
Use **Settings** to manage an existing setup.
|
|
175
|
-
Missing settings stay unconfigured without creating files or locks.
|
|
175
|
+
Missing settings stay unconfigured without creating files or locks. Ignore-file transfers and daemon rule-file saves are not enabled. If a setup already references an ignore file, **Settings** shows the rule-file path for manual editing. In RPC mode, it also shows the active settings file, including `pi-sync.local.json` if it supplied the settings, without renaming it.
|
|
176
|
+
|
|
177
|
+
If any setup references an ignore file, transfers and policy comparison are unavailable for all setups in that document. You can still inspect the setup catalog, but switching or removal can be unavailable. To return to legacy transfers, close Pi and back up the active settings file and any pending recovery journal and backup. Remove the unsupported setup entries or restore a known-good legacy-only settings document. If you remove the current setup, update `activeSyncSetup` to a remaining setup, or omit it if none remain. Do not delete pending recovery files.
|
|
176
178
|
|
|
177
179
|
Directory scope selects all eligible files, applies `exclude`, then restores matches from `reinclude`. Pi login credentials, project trust, and Pi Sync's own state stay local regardless of those rules. Folder-wide sync may include private files that the secret scan cannot identify. Review the content before transferring to a trusted destination. Existing setups keep their selected paths and are not migrated automatically. See [Agent-directory scope](./skills/configure-pi-sync/references/configuration.md#agent-directory-scope) for formats, precedence, and recovery.
|
|
178
180
|
|
|
@@ -290,9 +292,8 @@ Read the [settings reference](./skills/configure-pi-sync/references/configuratio
|
|
|
290
292
|
|
|
291
293
|
## 🧠 Skills
|
|
292
294
|
|
|
293
|
-
Run `/skill:configure-pi-sync
|
|
294
|
-
|
|
295
|
-
Enter credentials in the existing masked TUI and perform settings changes and reviewed transfers through `/sync` yourself.
|
|
295
|
+
Run `/skill:configure-pi-sync Exclude npm/` to have the agent add an exclusion to the active setup and verify the saved change. The [configuration skill](./skills/configure-pi-sync/SKILL.md) is loaded only on request and uses the running local daemon for authorized settings edits. It can also answer configuration questions.
|
|
296
|
+
Use `/sync` for initial setup, masked credential entry, and changes or transfers that require a separate review. The skill does not run diagnostics, check remote connectivity, or start a transfer.
|
|
296
297
|
The skill's instructions are not a permission sandbox for the agent's other tools.
|
|
297
298
|
Read the [settings reference](./skills/configure-pi-sync/references/configuration.md) directly when no agent assistance is needed.
|
|
298
299
|
|
|
@@ -325,7 +326,13 @@ show `sync recovering`. If cleanup remains uncertain, review
|
|
|
325
326
|
[daemon recovery](./docs/daemon-migration.md#write-coordination-and-disconnection)
|
|
326
327
|
before retrying.
|
|
327
328
|
|
|
328
|
-
Use the
|
|
329
|
+
Use the [daemon CLI](./docs/daemon-migration.md#daemon-cli) for explicit `stop` or `restart`; these are not `/sync daemon` actions. For example, with only Pi Sync installed:
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
node "/path/to/installed/pi-sync/dist/daemon/dist/cli.js" status --root "/path/to/agent-directory"
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Use the directory containing the installed Pi Sync `package.json` and the agent directory of the owner you want to inspect. `status` does not start a service. `stop` drains the service; reload Pi to reattach afterward. CLI `start` without clients follows the same 30-second grace policy. If ownership, consent, or cleanup is uncertain, follow the [recovery guide](./docs/daemon-migration.md#diagnostics-and-rollback) instead of forcing a restart. Print/JSON never launch a service.
|
|
329
336
|
|
|
330
337
|
All routes support TUI and RPC; RPC settings and included-content screens are read-only.
|
|
331
338
|
Print and JSON modes reject `/sync`.
|
|
@@ -333,7 +340,7 @@ Unknown commands or flags, trailing values, and missing setup/snapshot values ar
|
|
|
333
340
|
|
|
334
341
|
- `--setup <name>` targets a setup without switching it on `config`, `files`, `status`, `diff`, `conflicts`, `doctor`, `push`, `pull`, `sync`, `history`, and `rollback`.
|
|
335
342
|
- `--yes` (alias: `-y`) skips confirmation on `push`, `pull`, `sync`, `rollback`, and `migrate-state`; use only after reviewing the affected content.
|
|
336
|
-
- `--force` lets `push` or `pull` accept content conflicts without disabling backend concurrency protection. It is also accepted by `sync`, which still requires a direction choice for divergent content, and by `rollback` for compatibility.
|
|
343
|
+
- `--force` lets `push` or `pull` accept content conflicts without disabling backend concurrency protection. It is also accepted by `sync`, which still requires a direction choice for divergent content, and by `rollback` for compatibility. For legacy path policies, explicit forced directions can also resolve an interrupted merge after a fresh review, archiving its old journal instead of restoring old bytes.
|
|
337
344
|
- `--stale` is accepted only by `unlock` and is required to remove a stale lock.
|
|
338
345
|
|
|
339
346
|
Push and rollback publish data externally; pull and rollback can replace or delete local managed files.
|
|
@@ -366,7 +373,7 @@ Before pull or rollback, pi-sync writes a backup under `<agent-dir>/pi-sync/back
|
|
|
366
373
|
Snapshot apply and recovery require canonical agent and session paths. Preflight refuses parent aliases it detects because Pi's file queue uses different keys for existing and missing aliases. Node's path-based writes and deletes cannot prevent another process from replacing a parent directory after a check. Use directories you control, and pause tools that move or replace their directories during sync. Preserve any pending recovery evidence; an unresolved startup recovery barrier still blocks transfers. Old journals recorded under an alias require manual review because their exact root and target paths remain pinned. Changing the agent path alone does not authorize recovery or rewriting those journals.
|
|
367
374
|
Apply preflights paths and checksums, journals mutations, and restores prior state only when current bytes match verified preimages or planned postimages. Unknown intermediate directory states and newer edits require review rather than a blind rollback. An interruption after replacement is armed can require manual recovery even if installation never ran; a later deletion of installed content is not treated as an unfinished remove.
|
|
368
375
|
The file queue coordinates one Pi runtime, not separate processes or lock-unaware editors. Hash-based journals cannot distinguish a later write of identical recorded bytes; they do not provide a cross-process compare-and-swap.
|
|
369
|
-
Merged transfers instead retain a private publication/apply/baseline journal and roll forward only when the active remote candidate and every changed local preimage/postimage can be verified. A crash or uncertain publication is reconciled through `/sync sync` without blind republishing. If newer local or remote changes prevent reconciliation, preserve the evidence, review `/sync diff`, and explicitly choose `push --force` or `pull --force`; the chosen direction archives the old journal. Disabling automatic transfer does not undo completed transfers. Do not downgrade while a merge or snapshot recovery journal is pending.
|
|
376
|
+
Merged transfers instead retain a private publication/apply/baseline journal and roll forward only when the active remote candidate and every changed local preimage/postimage can be verified. A crash or uncertain publication is reconciled through `/sync sync` without blind republishing. If newer local or remote changes prevent reconciliation, preserve the evidence, review `/sync diff`, and explicitly choose `push --force` or `pull --force`; the chosen direction archives the old journal. These commands require a settings document with no ignore-file setups, even if the affected setup uses a legacy policy. If mixed settings block recovery, preserve the journal and its backup before changing settings. Disabling automatic transfer does not undo completed transfers. Do not downgrade while a merge or snapshot recovery journal is pending.
|
|
370
377
|
|
|
371
378
|
Removing a local setup or connection never deletes remote data.
|
|
372
379
|
|
|
@@ -411,10 +418,10 @@ packages/pi-sync/
|
|
|
411
418
|
│ ├── backends/ # Public backend contract forwarders
|
|
412
419
|
│ ├── state/ # Public state contract forwarders
|
|
413
420
|
│ └── ui/ # Manager, settings, reviews, and setup flows
|
|
414
|
-
├── dist/ #
|
|
421
|
+
├── dist/ # Published Jiti runtime and separate daemon files
|
|
415
422
|
├── scripts/build-runtime.mjs # Runtime builder
|
|
416
423
|
├── docs/ # Operational audits and settings link compatibility
|
|
417
|
-
├── skills/configure-pi-sync/ #
|
|
424
|
+
├── skills/configure-pi-sync/ # Agent settings edits and authoritative settings reference
|
|
418
425
|
└── test/ # Behavior and lifecycle coverage
|
|
419
426
|
```
|
|
420
427
|
|
|
@@ -422,7 +429,7 @@ The [exclude policy safety audit](./docs/exclude-policy-audit.md) maps implement
|
|
|
422
429
|
|
|
423
430
|
The generated runtime is built from `src/index.ts` and does not import back into `src`.
|
|
424
431
|
Internal modules use direct imports from their owners; `src/sync.ts` and `src/types.ts` retain compatibility exports.
|
|
425
|
-
|
|
432
|
+
Repository and Git source installs use the daemon workspace's documented exports; the npm runtime maps the same exports to `dist/daemon/`. Transfers still run in the daemon, with no in-process fallback. First-use UI and setup implementations remain lazy.
|
|
426
433
|
|
|
427
434
|
## 🔎 Keywords
|
|
428
435
|
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
import {
|
|
4
4
|
runCancellableOperation,
|
|
5
5
|
showRemoteSelectionReview
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6PFZUEUG.ts";
|
|
7
7
|
import {
|
|
8
8
|
loadConfig,
|
|
9
9
|
syncConfigReviewIdentity
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MNYRU5U5.ts";
|
|
11
11
|
import {
|
|
12
12
|
errorMessage
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-6YKOHBSC.ts";
|
|
14
14
|
import {
|
|
15
15
|
safeTerminalText
|
|
16
16
|
} from "./chunk-2JNFEZ3V.ts";
|
|
@@ -206,4 +206,4 @@ async function dispatchManagerResult(ctx, initialResult, origin, runRoute, signa
|
|
|
206
206
|
export {
|
|
207
207
|
dispatchManagerResult
|
|
208
208
|
};
|
|
209
|
-
//# sourceMappingURL=chunk-
|
|
209
|
+
//# sourceMappingURL=chunk-3E3TR3JE.ts.map
|
|
@@ -2,34 +2,34 @@
|
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
3
|
import {
|
|
4
4
|
throwIfAborted
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UMPA5S7X.ts";
|
|
6
6
|
import {
|
|
7
7
|
captureMutationOwner
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GELYN4UC.ts";
|
|
9
9
|
import {
|
|
10
10
|
SyncSetupReviewChangedError,
|
|
11
11
|
updateSyncSetup
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-NXWHPVXR.ts";
|
|
13
13
|
import {
|
|
14
14
|
sameSyncExclude
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZO52JM4H.ts";
|
|
16
16
|
import {
|
|
17
17
|
loadConfig,
|
|
18
18
|
syncCheckConfigFingerprint,
|
|
19
19
|
syncConfigReviewFingerprint
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-MNYRU5U5.ts";
|
|
21
21
|
import {
|
|
22
22
|
setSyncStatus
|
|
23
23
|
} from "./chunk-H7VOTY5N.ts";
|
|
24
24
|
import {
|
|
25
25
|
errorMessage
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-6YKOHBSC.ts";
|
|
27
27
|
import {
|
|
28
28
|
compareSyncInclude,
|
|
29
29
|
inspectRemoteSelection,
|
|
30
30
|
sameSyncInclude,
|
|
31
31
|
syncDirectoryPolicyKey
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-R3SAMXB6.ts";
|
|
33
33
|
import {
|
|
34
34
|
safeTerminalText
|
|
35
35
|
} from "./chunk-2JNFEZ3V.ts";
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
import { defineMenu, runMenu } from "@narumitw/pi-tui-kit";
|
|
39
39
|
|
|
40
40
|
// src/backends/backend-factory.ts
|
|
41
|
-
import { createSyncBackend } from "
|
|
41
|
+
import { createSyncBackend } from "#pi-sync-daemon/engine/backends/backend-factory";
|
|
42
42
|
|
|
43
43
|
// src/sync/remote-snapshot.ts
|
|
44
44
|
import {
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
readRemoteSnapshot,
|
|
47
47
|
readSnapshotForHead,
|
|
48
48
|
requireCompatibleRemoteSelection
|
|
49
|
-
} from "
|
|
49
|
+
} from "#pi-sync-daemon/engine/sync/remote-snapshot";
|
|
50
50
|
|
|
51
51
|
// src/ui/cancellable-operation.ts
|
|
52
52
|
import { BorderedLoader } from "@earendil-works/pi-coding-agent";
|
|
@@ -266,8 +266,8 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
|
|
|
266
266
|
items: [
|
|
267
267
|
{
|
|
268
268
|
id: "review",
|
|
269
|
-
label: "Review all paths (recommended)",
|
|
270
|
-
description: "Compare exact remote-only, device-only, and ordered lists.",
|
|
269
|
+
label: state.decision.ignorePolicyComparison ? "Review policy difference" : "Review all paths (recommended)",
|
|
270
|
+
description: state.decision.ignorePolicyComparison ? "Compare published policy information without adopting rules." : "Compare exact remote-only, device-only, and ordered lists.",
|
|
271
271
|
to: "review"
|
|
272
272
|
},
|
|
273
273
|
...adoptionUnavailable(state.decision) ? [] : [
|
|
@@ -278,10 +278,10 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
|
|
|
278
278
|
action: "adopt"
|
|
279
279
|
}
|
|
280
280
|
],
|
|
281
|
-
|
|
281
|
+
...!canPublishLocalPolicy(state.decision) ? [] : [
|
|
282
282
|
{
|
|
283
283
|
id: "keep",
|
|
284
|
-
label: "Keep this device's content list and update remote\u2026",
|
|
284
|
+
label: state.decision.ignorePolicyComparison ? "Review publishing this device's policy\u2026" : "Keep this device's content list and update remote\u2026",
|
|
285
285
|
description: "Open the existing exact force-push preview without skipping confirmation.",
|
|
286
286
|
action: "keep"
|
|
287
287
|
}
|
|
@@ -406,16 +406,19 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
|
|
|
406
406
|
}
|
|
407
407
|
},
|
|
408
408
|
keep: async ({ state, signal: actionSignal }) => {
|
|
409
|
+
if (!canPublishLocalPolicy(state.decision)) return { kind: "stay" };
|
|
409
410
|
if (!runRoute) {
|
|
410
411
|
ctx.ui.notify("The reviewed update-remote route is unavailable.", "error");
|
|
411
412
|
return { kind: "stay" };
|
|
412
413
|
}
|
|
413
414
|
const signal = combineSignals(sessionSignal, actionSignal);
|
|
414
415
|
try {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
416
|
+
if (!state.decision.ignorePolicyComparison) {
|
|
417
|
+
const latest = await loadConfig(state.decision.setupName);
|
|
418
|
+
if (signal.aborted) return { kind: "close" };
|
|
419
|
+
validateOwner();
|
|
420
|
+
assertLocalSelectionCurrent(latest, state.decision);
|
|
421
|
+
}
|
|
419
422
|
const result = await runCancellableOperation(
|
|
420
423
|
ctx,
|
|
421
424
|
"Preparing this device's push preview\u2026",
|
|
@@ -549,6 +552,7 @@ async function revalidateAndAdopt(review, decision, signal, validateOwner) {
|
|
|
549
552
|
const refusal = adoptionUnavailable(decision);
|
|
550
553
|
if (refusal) throw new Error(refusal);
|
|
551
554
|
const exclude = adoptedExclude(decision);
|
|
555
|
+
if (setup.sync.pathPolicy === "ignore-file") throw new Error("An ignore-file setup cannot adopt remote rules.");
|
|
552
556
|
if (setup.sync.scope === "agent-directory") {
|
|
553
557
|
return {
|
|
554
558
|
...setup,
|
|
@@ -640,7 +644,15 @@ function adoptedExclude(decision) {
|
|
|
640
644
|
function scopesDiffer(decision) {
|
|
641
645
|
return decision.localDirectory?.scope !== decision.remoteDirectory?.scope;
|
|
642
646
|
}
|
|
647
|
+
function canPublishLocalPolicy(decision) {
|
|
648
|
+
if (decision.ignorePolicyComparison) {
|
|
649
|
+
return decision.ignorePolicyComparison !== "match" && decision.ignorePolicyComparison !== "local-legacy-remote-ignore";
|
|
650
|
+
}
|
|
651
|
+
return !scopesDiffer(decision);
|
|
652
|
+
}
|
|
643
653
|
function adoptionUnavailable(decision) {
|
|
654
|
+
if (decision.ignorePolicyComparison)
|
|
655
|
+
return "Ignore files are local. Published metadata cannot reconstruct remote rules.";
|
|
644
656
|
if (scopesDiffer(decision))
|
|
645
657
|
return "Scope differs. Configure a setup with the remote scope to join it; this location is not migrated in place.";
|
|
646
658
|
if (decision.remoteDirectory?.scope && decision.remoteInclude.includes("sessions") && !decision.localInclude.includes("sessions"))
|
|
@@ -665,6 +677,13 @@ function directoryReviewLines(decision) {
|
|
|
665
677
|
];
|
|
666
678
|
}
|
|
667
679
|
function selectionSummaryLines(decision) {
|
|
680
|
+
if (decision.ignorePolicyComparison) {
|
|
681
|
+
return [
|
|
682
|
+
`Sync setup: ${safeTerminalText(decision.setupName)}`,
|
|
683
|
+
adoptionUnavailable(decision) ?? "Nothing changed.",
|
|
684
|
+
decision.ignorePolicyComparison === "local-legacy-remote-ignore" ? "The remote uses an ignore policy. Migrate and review your local setup before transferring." : "Review a fresh push before publishing this device's policy. No files or settings have changed."
|
|
685
|
+
];
|
|
686
|
+
}
|
|
668
687
|
const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);
|
|
669
688
|
return [
|
|
670
689
|
`Sync setup: ${safeTerminalText(decision.setupName)}`,
|
|
@@ -675,6 +694,7 @@ function selectionSummaryLines(decision) {
|
|
|
675
694
|
];
|
|
676
695
|
}
|
|
677
696
|
function formatSelectionDifference(decision) {
|
|
697
|
+
if (decision.ignorePolicyComparison) return selectionSummaryLines(decision).join("\n");
|
|
678
698
|
const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);
|
|
679
699
|
return [
|
|
680
700
|
...directoryReviewLines(decision),
|
|
@@ -696,6 +716,7 @@ function formatSelectionDifference(decision) {
|
|
|
696
716
|
].join("\n");
|
|
697
717
|
}
|
|
698
718
|
function formatRemoteSelectionSummary(decision) {
|
|
719
|
+
if (decision.ignorePolicyComparison) return selectionSummaryLines(decision).join("\n");
|
|
699
720
|
const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);
|
|
700
721
|
return [
|
|
701
722
|
`Synced content for \u201C${safeTerminalText(decision.setupName)}\u201D differs from this device.`,
|
|
@@ -726,6 +747,7 @@ function decisionFromState(config, state) {
|
|
|
726
747
|
return {
|
|
727
748
|
setupName: config.setupName,
|
|
728
749
|
configIdentity: syncConfigReviewFingerprint(config),
|
|
750
|
+
ignorePolicyComparison: state.ignorePolicyComparison,
|
|
729
751
|
localInclude: [...config.include],
|
|
730
752
|
remoteInclude: [...state.include],
|
|
731
753
|
...config.exclude === void 0 ? {} : { localExclude: [...config.exclude] },
|
|
@@ -790,6 +812,7 @@ function combineSignals(sessionSignal, actionSignal) {
|
|
|
790
812
|
|
|
791
813
|
export {
|
|
792
814
|
runCancellableOperation,
|
|
815
|
+
runCancellableTask,
|
|
793
816
|
showRemoteSelectionReview
|
|
794
817
|
};
|
|
795
|
-
//# sourceMappingURL=chunk-
|
|
818
|
+
//# sourceMappingURL=chunk-6PFZUEUG.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ui/remote-selection-ui.ts", "../../src/backends/backend-factory.ts", "../../src/sync/remote-snapshot.ts", "../../src/ui/cancellable-operation.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\nimport { createSyncBackend, type SyncBackendFactory } from \"../backends/backend-factory.js\";\nimport type { RemoteHead, SyncBackend } from \"../backends/sync-backend.js\";\nimport { loadConfig, syncCheckConfigFingerprint, syncConfigReviewFingerprint } from \"../settings/config.js\";\nimport { SyncSetupReviewChangedError, updateSyncSetup } from \"../settings/settings-management.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { sameSyncExclude } from \"../sync/exclude-policy.js\";\nimport { readSnapshotForHead } from \"../sync/remote-snapshot.js\";\nimport { throwIfAborted } from \"../sync/signals.js\";\nimport { errorMessage } from \"../sync/sync-errors.js\";\nimport { captureMutationOwner } from \"../sync/sync-local.js\";\nimport {\n compareSyncInclude,\n inspectRemoteSelection,\n type RemoteSelectionDecision,\n type RemoteSelectionState,\n sameSyncInclude,\n syncDirectoryPolicyKey,\n} from \"../sync/sync-policy.js\";\nimport {\n type RunRoute,\n type RunRouteResult,\n runCancellableOperation,\n runCancellableTask,\n} from \"./cancellable-operation.js\";\nimport { setSyncStatus } from \"./sync-status.js\";\nimport { safeTerminalText } from \"./terminal-text.js\";\n\nexport type RemoteSelectionOrigin = \"settings\" | \"sync\" | \"pull\" | \"push\";\n\nexport interface RemoteSelectionReviewOptions {\n decision?: RemoteSelectionDecision;\n origin?: RemoteSelectionOrigin;\n runRoute?: RunRoute;\n cancelLabel?: string;\n /** The explicit mismatch is resolved or superseded; this does not imply file equality. */\n onSelectionResolved?: () => void;\n withStateAccess?: <T>(task: () => Promise<T>) => Promise<T>;\n}\n\nexport type RemoteSelectionReviewResult =\n | { kind: \"back\" }\n | { kind: \"closed\" }\n | { kind: \"done\" }\n | { kind: \"stale\" }\n | { kind: \"route-result\"; result: RunRouteResult; route: \"sync\" | \"pull\" | \"push\" };\n\nexport async function showRemoteSelectionReview(\n ctx: ExtensionContext,\n setupName?: string,\n signal?: AbortSignal,\n factory: SyncBackendFactory = createSyncBackend,\n options: RemoteSelectionReviewOptions = {},\n): Promise<RemoteSelectionReviewResult> {\n const validateOwner = captureMutationOwner(ctx, signal);\n const isCurrent = () => isReviewOwnerCurrent(validateOwner);\n try {\n validateOwner();\n let decision = options.decision;\n if (!decision) {\n const inspection = await runCancellableTask(\n ctx,\n \"Checking remote content list\u2026\",\n (workSignal) => inspectConfiguredRemoteSelection(ctx, setupName, workSignal, factory, validateOwner),\n { signal, isCurrent, cancelledMessage: null },\n );\n if (!isCurrent()) return { kind: \"stale\" };\n if (inspection.kind !== \"completed\") return { kind: inspection.kind === \"cancelled\" ? \"back\" : \"closed\" };\n validateOwner();\n const inspected = inspection.value;\n if (!inspected) return { kind: \"stale\" };\n // A successful fresh read can supersede an old explicit mismatch without\n // changing local settings. This is not user cancellation or proof of file equality.\n if (inspected.kind === \"empty\" || inspected.state.kind !== \"different\") {\n options.onSelectionResolved?.();\n }\n if (inspected.kind === \"empty\") {\n ctx.ui.notify(\"Remote storage has no snapshot or synced-content list yet.\", \"info\");\n return { kind: \"back\" };\n }\n if (inspected.state.kind === \"same\") {\n ctx.ui.notify(\"Remote synced content already matches this sync setup.\", \"info\");\n return { kind: \"back\" };\n }\n if (inspected.state.kind === \"legacy\") {\n if (ctx.mode !== \"tui\") {\n ctx.ui.notify(formatLegacySummary(inspected.config, inspected.state.discovered), \"info\");\n return { kind: \"back\" };\n }\n await showLegacyDiscovery(ctx, inspected.config, inspected.state.discovered, signal);\n return signal?.aborted ? { kind: \"stale\" } : { kind: \"back\" };\n }\n decision = decisionFromState(inspected.config, inspected.state);\n }\n\n if (ctx.mode !== \"tui\") {\n ctx.ui.notify(formatRemoteSelectionSummary(decision), \"warning\");\n return { kind: \"back\" };\n }\n\n let currentDecision = decision;\n for (;;) {\n if (signal?.aborted) return { kind: \"stale\" };\n const result = await showSelectionDifference(\n ctx,\n currentDecision,\n options.origin ?? \"settings\",\n options.runRoute,\n signal,\n factory,\n options,\n validateOwner,\n );\n if (result.kind !== \"refresh\") return result;\n const refresh = await runCancellableTask(\n ctx,\n \"Refreshing remote content list\u2026\",\n (workSignal) =>\n runWithOptionalStateAccess(options, () =>\n inspectConfiguredRemoteSelection(ctx, currentDecision.setupName, workSignal, factory, validateOwner),\n ),\n { signal, isCurrent, cancelledMessage: null },\n );\n if (!isCurrent()) return { kind: \"stale\" };\n if (refresh.kind !== \"completed\") return { kind: refresh.kind === \"cancelled\" ? \"back\" : \"closed\" };\n validateOwner();\n const refreshed = refresh.value;\n if (!refreshed) return { kind: \"stale\" };\n if (refreshed.kind === \"empty\") {\n options.onSelectionResolved?.();\n ctx.ui.notify(\"Remote storage no longer has a snapshot or synced-content list.\", \"warning\");\n return { kind: \"back\" };\n }\n if (refreshed.state.kind !== \"different\") {\n ctx.ui.notify(\n refreshed.state.kind === \"same\"\n ? \"Remote synced content now matches this sync setup.\"\n : \"The refreshed legacy snapshot has no authoritative synced-content list.\",\n \"info\",\n );\n options.onSelectionResolved?.();\n return { kind: \"done\" };\n }\n currentDecision = decisionFromState(refreshed.config, refreshed.state);\n }\n } catch (error) {\n if (!isCurrent()) return { kind: \"stale\" };\n ctx.ui.notify(`Could not review synced content: ${errorMessage(error)}`, \"error\");\n return { kind: \"back\" };\n } finally {\n if (isCurrent()) setSyncStatus(ctx, undefined);\n }\n}\n\ntype DifferenceFlowResult = RemoteSelectionReviewResult | { kind: \"refresh\" };\n\nasync function showSelectionDifference(\n ctx: ExtensionContext,\n initialDecision: RemoteSelectionDecision,\n origin: RemoteSelectionOrigin,\n runRoute: RunRoute | undefined,\n sessionSignal: AbortSignal | undefined,\n factory: SyncBackendFactory,\n options: Pick<RemoteSelectionReviewOptions, \"cancelLabel\" | \"onSelectionResolved\" | \"withStateAccess\">,\n validateOwner: () => void,\n): Promise<DifferenceFlowResult> {\n type Screen = \"choice\" | \"review\" | \"saved\";\n type Action = \"adopt\" | \"keep\" | \"cancel\" | \"continue\" | \"done\";\n interface FlowState {\n decision: RemoteSelectionDecision;\n saved: boolean;\n }\n const isCurrent = () => isReviewOwnerCurrent(validateOwner);\n let flowState: FlowState = { decision: initialDecision, saved: false };\n let continuationFingerprint: string | undefined;\n let nextResult: RemoteSelectionReviewResult | undefined;\n let refreshRequested = false;\n const route = origin === \"settings\" ? \"sync\" : origin;\n const menu = defineMenu<FlowState, Screen, Action, ExtensionContext>({\n start: \"choice\",\n screens: {\n choice: ({ state }) => ({\n kind: \"actions\",\n title: \"Synced content differs\",\n lines: selectionSummaryLines(state.decision),\n items: [\n {\n id: \"review\",\n label: state.decision.ignorePolicyComparison\n ? \"Review policy difference\"\n : \"Review all paths (recommended)\",\n description: state.decision.ignorePolicyComparison\n ? \"Compare published policy information without adopting rules.\"\n : \"Compare exact remote-only, device-only, and ordered lists.\",\n to: \"review\",\n },\n ...(adoptionUnavailable(state.decision)\n ? []\n : [\n {\n id: \"adopt\",\n label: \"Use remote content list\",\n description: \"Save the reviewed rules on this device without pulling files.\",\n action: \"adopt\" as const,\n },\n ]),\n ...(!canPublishLocalPolicy(state.decision)\n ? []\n : [\n {\n id: \"keep\",\n label: state.decision.ignorePolicyComparison\n ? \"Review publishing this device's policy\u2026\"\n : \"Keep this device's content list and update remote\u2026\",\n description: \"Open the existing exact force-push preview without skipping confirmation.\",\n action: \"keep\" as const,\n },\n ]),\n { id: \"cancel\", label: options.cancelLabel ?? \"Cancel\", action: \"cancel\" },\n ],\n hint: \"back\",\n }),\n review: ({ state }) => ({\n kind: \"review\",\n title: `Review synced content \u00B7 ${safeTerminalText(state.decision.setupName)}`,\n content: formatSelectionDifference(state.decision),\n format: { kind: \"text\" },\n viewportSize: \"adaptive\",\n hint: \"back\",\n }),\n saved: ({ state }) => ({\n kind: \"actions\",\n title: \"Remote content list saved\",\n lines: [\n `Sync setup: ${safeTerminalText(state.decision.setupName)}`,\n \"Only the included-content setting was saved.\",\n \"No files were pulled and sync state was not changed.\",\n ],\n items: [\n ...(runRoute\n ? [\n {\n id: \"continue\",\n label: continueLabel(origin),\n description: \"Start a fresh check and exact preview for this sync setup.\",\n action: \"continue\" as const,\n },\n ]\n : []),\n { id: \"done\", label: \"Done\", action: \"done\" },\n ],\n hint: \"close\",\n }),\n },\n actions: {\n adopt: async ({ state, signal: actionSignal }) => {\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n const adoption = await runCancellableTask(\n ctx,\n \"Checking and saving remote content list\u2026\",\n async (workSignal, _onCommit, onDialog) => {\n const ownedSignal = workSignal ?? signal;\n const currentConfig = await loadConfig(state.decision.setupName);\n ownedSignal.throwIfAborted();\n validateOwner();\n assertLocalSelectionCurrent(currentConfig, state.decision);\n const refusal = adoptionUnavailable(state.decision);\n if (refusal) throw new Error(refusal);\n if (!currentConfig.include.includes(\"sessions\") && state.decision.remoteInclude.includes(\"sessions\")) {\n onDialog?.(true);\n let acknowledged: boolean;\n try {\n acknowledged = await ctx.ui.confirm(\n \"Use a content list that includes session conversations?\",\n \"Session JSONL may contain prompts, tool output, file paths, images, and secrets. This saves the list only; it does not pull files.\",\n { signal: ownedSignal },\n );\n } finally {\n onDialog?.(false);\n }\n ownedSignal.throwIfAborted();\n validateOwner();\n if (!acknowledged) return undefined;\n }\n if (\n !currentConfig.scope &&\n state.decision.remoteExclude !== undefined &&\n currentConfig.exclude === undefined\n ) {\n onDialog?.(true);\n let confirmed: boolean;\n try {\n confirmed = await ctx.ui.confirm(\n \"Adopt excluded paths?\",\n \"This upgrades settings to version 6 / snapshots to version 4. Older clients must refuse them. Both content lists are saved; no files transfer and old history is not erased.\",\n { signal: ownedSignal },\n );\n } finally {\n onDialog?.(false);\n }\n ownedSignal.throwIfAborted();\n validateOwner();\n if (!confirmed) return undefined;\n }\n return runWithOptionalStateAccess(options, async () => {\n const loaded = await loadAdoptionReview(state.decision, ownedSignal, factory, validateOwner);\n ownedSignal.throwIfAborted();\n validateOwner();\n await revalidateAndAdopt(loaded, state.decision, ownedSignal, validateOwner);\n return loaded;\n });\n },\n {\n signal,\n isCurrent,\n cancelAcrossDialogs: true,\n cancelledMessage: \"Remote content-list adoption cancelled.\",\n },\n );\n if (signal.aborted || adoption.kind === \"closed\") return { kind: \"close\" as const };\n if (adoption.kind === \"cancelled\" || !adoption.value) return { kind: \"stay\" as const };\n validateOwner();\n options.onSelectionResolved?.();\n continuationFingerprint = syncCheckConfigFingerprint({\n ...adoption.value.config,\n include: [...state.decision.remoteInclude],\n exclude: adoptedExclude(state.decision),\n ...(adoption.value.config.scope\n ? { reinclude: [...(state.decision.remoteDirectory?.reinclude ?? [])] }\n : {}),\n });\n flowState = { decision: state.decision, saved: true };\n return { kind: \"to\" as const, screen: \"saved\" as const };\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n if (isStaleReviewError(error)) {\n ctx.ui.notify(`${errorMessage(error)} Refreshing the comparison.`, \"warning\");\n refreshRequested = true;\n return { kind: \"close\" as const };\n }\n ctx.ui.notify(`Could not save the remote content list: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n keep: async ({ state, signal: actionSignal }) => {\n if (!canPublishLocalPolicy(state.decision)) return { kind: \"stay\" as const };\n if (!runRoute) {\n ctx.ui.notify(\"The reviewed update-remote route is unavailable.\", \"error\");\n return { kind: \"stay\" as const };\n }\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n if (!state.decision.ignorePolicyComparison) {\n const latest = await loadConfig(state.decision.setupName);\n if (signal.aborted) return { kind: \"close\" as const };\n validateOwner();\n assertLocalSelectionCurrent(latest, state.decision);\n }\n const result = await runCancellableOperation(\n ctx,\n \"Preparing this device's push preview\u2026\",\n \"push --force\",\n runRoute,\n {\n commitAware: true,\n cancelledMessage: \"Push preparation cancelled; no remote files were changed.\",\n target: state.decision.setupName,\n signal,\n },\n );\n return handleNestedRouteResult(result, \"push\");\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n if (isStaleReviewError(error)) {\n ctx.ui.notify(`${errorMessage(error)} Refreshing the comparison.`, \"warning\");\n refreshRequested = true;\n return { kind: \"close\" as const };\n }\n ctx.ui.notify(`Could not prepare the remote update: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n continue: async ({ state, signal: actionSignal }) => {\n if (!runRoute || !continuationFingerprint) return { kind: \"stay\" as const };\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n const latest = await loadConfig(state.decision.setupName);\n if (signal.aborted) return { kind: \"close\" as const };\n validateOwner();\n if (syncCheckConfigFingerprint(latest) !== continuationFingerprint) {\n throw new StaleRemoteSelectionReviewError(\n `Sync setup \u201C${safeTerminalText(state.decision.setupName)}\u201D changed after the remote content list was saved.`,\n );\n }\n const result = await runCancellableOperation(ctx, continueBusyLabel(origin), route, runRoute, {\n commitAware: true,\n cancelledMessage: continuationCancelledMessage(route),\n target: state.decision.setupName,\n signal,\n });\n return handleNestedRouteResult(result, route);\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n ctx.ui.notify(`Could not continue: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n cancel: async () => ({ kind: \"back\" }),\n done: async () => {\n nextResult = { kind: \"done\" };\n return { kind: \"close\" };\n },\n },\n });\n\n function handleNestedRouteResult(\n result: Awaited<ReturnType<typeof runCancellableOperation>>,\n nestedRoute: \"sync\" | \"pull\" | \"push\",\n ) {\n if (result.kind === \"completed\" && result.outcome === \"applied\") {\n options.onSelectionResolved?.();\n }\n if (result.kind === \"closed\") {\n nextResult = { kind: \"closed\" };\n return { kind: \"close\" as const };\n }\n if (\n result.kind === \"cancelled\" ||\n (result.kind === \"completed\" && result.outcome === \"cancelled\") ||\n result.kind === \"failed\"\n ) {\n return { kind: \"stay\" as const };\n }\n nextResult = { kind: \"route-result\", result, route: nestedRoute };\n return { kind: \"close\" as const };\n }\n\n const menuResult = await runMenu(ctx, menu, {\n getState: () => flowState,\n signal: sessionSignal,\n isCurrent,\n onError: (_menuCtx, error) => ctx.ui.notify(errorMessage(error), \"error\"),\n });\n if (!isCurrent() || menuResult.kind === \"stale\") return { kind: \"stale\" };\n if (refreshRequested) return { kind: \"refresh\" };\n if (nextResult) return nextResult;\n if (menuResult.kind === \"closed\") {\n return menuResult.reason === \"back\" ? { kind: \"back\" } : { kind: \"closed\" };\n }\n return { kind: \"closed\" };\n}\n\ninterface AdoptionReview {\n config: AnySyncConfig;\n backend: SyncBackend;\n reviewedHead: RemoteHead;\n}\n\nasync function loadAdoptionReview(\n decision: RemoteSelectionDecision,\n signal: AbortSignal,\n factory: SyncBackendFactory,\n validateOwner: () => void,\n): Promise<AdoptionReview> {\n const config = await loadConfig(decision.setupName);\n throwIfAborted(signal);\n validateOwner();\n assertLocalSelectionCurrent(config, decision);\n const backend = await factory(config);\n throwIfAborted(signal);\n validateOwner();\n const reviewedHead = await backend.readHead(signal);\n throwIfAborted(signal);\n validateOwner();\n if (!reviewedHead) {\n throw new StaleRemoteSelectionReviewError(\"Remote storage changed while the comparison was open.\");\n }\n const snapshot = await readSnapshotForHead(backend, reviewedHead, signal);\n throwIfAborted(signal);\n validateOwner();\n const state = inspectRemoteSelection(config.include, snapshot, config.exclude, config);\n if (\n state.kind !== \"different\" ||\n !sameSyncInclude(state.include, decision.remoteInclude) ||\n !sameSyncExclude(state.exclude, decision.remoteExclude) ||\n !matchesRemoteDirectory(state, decision)\n ) {\n throw new StaleRemoteSelectionReviewError(\"Remote synced content changed while the comparison was open.\");\n }\n return { config, backend, reviewedHead };\n}\n\nasync function revalidateAndAdopt(\n review: AdoptionReview,\n decision: RemoteSelectionDecision,\n signal: AbortSignal,\n validateOwner: () => void,\n) {\n const currentHead = await review.backend.readHead(signal);\n throwIfAborted(signal);\n validateOwner();\n if (!currentHead || !review.backend.sameRevision(review.reviewedHead.revision, currentHead.revision)) {\n throw new StaleRemoteSelectionReviewError(\"Remote storage changed while the comparison was open.\");\n }\n const currentSnapshot = await readSnapshotForHead(review.backend, currentHead, signal);\n throwIfAborted(signal);\n validateOwner();\n const currentState = inspectRemoteSelection(\n review.config.include,\n currentSnapshot,\n review.config.exclude,\n review.config,\n );\n if (\n currentState.kind !== \"different\" ||\n !sameSyncInclude(currentState.include, decision.remoteInclude) ||\n !sameSyncExclude(currentState.exclude, decision.remoteExclude) ||\n !matchesRemoteDirectory(currentState, decision)\n ) {\n throw new StaleRemoteSelectionReviewError(\"Remote synced content changed while the comparison was open.\");\n }\n await updateSyncSetup(\n decision.setupName,\n (setup) => {\n validateOwner();\n const refusal = adoptionUnavailable(decision);\n if (refusal) throw new Error(refusal);\n const exclude = adoptedExclude(decision);\n if (setup.sync.pathPolicy === \"ignore-file\") throw new Error(\"An ignore-file setup cannot adopt remote rules.\");\n if (setup.sync.scope === \"agent-directory\") {\n return {\n ...setup,\n sync: {\n ...setup.sync,\n exclude,\n reinclude: [...(decision.remoteDirectory?.reinclude ?? [])],\n sessions: decision.remoteInclude.includes(\"sessions\"),\n },\n };\n }\n return {\n ...setup,\n sync: { ...setup.sync, include: [...decision.remoteInclude], ...(exclude === undefined ? {} : { exclude }) },\n };\n },\n {\n expectedConfigFingerprint: syncCheckConfigFingerprint(review.config),\n expectedInclude: decision.localInclude,\n upgradeExclude: adoptedExclude(decision) !== undefined,\n signal,\n },\n );\n}\n\nasync function inspectConfiguredRemoteSelection(\n ctx: ExtensionContext,\n setupName: string | undefined,\n signal: AbortSignal | undefined,\n factory: SyncBackendFactory,\n validateOwner: () => void,\n): Promise<\n | { kind: \"empty\"; config: AnySyncConfig }\n | { kind: \"selection\"; config: AnySyncConfig; state: RemoteSelectionState }\n | undefined\n> {\n const config = await loadConfig(setupName);\n if (signal?.aborted) return undefined;\n validateOwner();\n setSyncStatus(ctx, `checking synced content for ${safeTerminalText(config.setupName)}`, { activity: \"checking\" });\n const backend = await factory(config);\n if (signal?.aborted) return undefined;\n validateOwner();\n const head = await backend.readHead(signal);\n if (signal?.aborted) return undefined;\n validateOwner();\n if (!head) return { kind: \"empty\", config };\n const snapshot = await readSnapshotForHead(backend, head, signal);\n if (signal?.aborted) return undefined;\n validateOwner();\n return {\n kind: \"selection\",\n config,\n state: inspectRemoteSelection(config.include, snapshot, config.exclude, config),\n };\n}\n\nasync function showLegacyDiscovery(\n ctx: ExtensionContext,\n config: AnySyncConfig,\n discovered: string[],\n signal?: AbortSignal,\n) {\n const menu = defineMenu<undefined, \"choice\" | \"review\", \"back\", ExtensionContext>({\n start: \"choice\",\n screens: {\n choice: () => ({\n kind: \"actions\",\n title: `Compare synced content \u00B7 ${safeTerminalText(config.setupName)}`,\n lines: [\n \"This legacy snapshot has no portable synced-content list.\",\n \"Discovered paths are partial and read-only; preserved files may not have been selected.\",\n ],\n items: [\n { id: \"review\", label: \"Review discovered paths\", to: \"review\" },\n { id: \"back\", label: \"Back\", action: \"back\" },\n ],\n hint: \"close\",\n }),\n review: () => ({\n kind: \"review\",\n title: \"Partial discovery from legacy snapshot\",\n content: [\n \"Partial discovery only \u2014 not an authoritative selection.\",\n \"\",\n ...(discovered.length > 0\n ? discovered.map((item) => `Discovered: ${safeTerminalText(item)}`)\n : [\"No safe paths were discovered.\"]),\n \"\",\n \"Use Add custom path\u2026 in the local Included Content editor if needed.\",\n ].join(\"\\n\"),\n format: { kind: \"text\" },\n viewportSize: \"adaptive\",\n hint: \"back\",\n }),\n },\n actions: { back: async () => ({ kind: \"close\" }) },\n });\n await runMenu(ctx, menu, {\n getState: () => undefined,\n signal,\n isCurrent: () => !signal?.aborted,\n });\n}\n\nfunction adoptedExclude(decision: RemoteSelectionDecision) {\n return decision.remoteExclude === undefined\n ? decision.localExclude === undefined\n ? undefined\n : []\n : [...decision.remoteExclude];\n}\n\nfunction scopesDiffer(decision: RemoteSelectionDecision) {\n return decision.localDirectory?.scope !== decision.remoteDirectory?.scope;\n}\n\nfunction canPublishLocalPolicy(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison) {\n return (\n decision.ignorePolicyComparison !== \"match\" && decision.ignorePolicyComparison !== \"local-legacy-remote-ignore\"\n );\n }\n return !scopesDiffer(decision);\n}\n\nfunction adoptionUnavailable(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison)\n return \"Ignore files are local. Published metadata cannot reconstruct remote rules.\";\n if (scopesDiffer(decision))\n return \"Scope differs. Configure a setup with the remote scope to join it; this location is not migrated in place.\";\n if (\n decision.remoteDirectory?.scope &&\n decision.remoteInclude.includes(\"sessions\") &&\n !decision.localInclude.includes(\"sessions\")\n )\n return \"Enable session sync explicitly in Settings before adopting these rules.\";\n}\n\nfunction matchesRemoteDirectory(\n state: Extract<RemoteSelectionState, { kind: \"different\" }>,\n decision: RemoteSelectionDecision,\n) {\n return (\n syncDirectoryPolicyKey(state) ===\n syncDirectoryPolicyKey({\n include: decision.remoteInclude,\n exclude: decision.remoteExclude,\n ...decision.remoteDirectory,\n })\n );\n}\n\nfunction directoryReviewLines(decision: RemoteSelectionDecision) {\n if (!decision.localDirectory?.scope && !decision.remoteDirectory?.scope) return [];\n const unavailable = adoptionUnavailable(decision);\n return [\n `Remote scope: ${decision.remoteDirectory?.scope ? \"Pi agent directory\" : \"selected paths or legacy\"}`,\n `This device scope: ${decision.localDirectory?.scope ? \"Pi agent directory\" : \"selected paths\"}`,\n `Remote re-included paths: ${safeList(decision.remoteDirectory?.reinclude ?? [])}`,\n `This device re-included paths: ${safeList(decision.localDirectory?.reinclude ?? [])}`,\n ...(unavailable ? [unavailable] : []),\n ];\n}\n\nfunction selectionSummaryLines(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison) {\n return [\n `Sync setup: ${safeTerminalText(decision.setupName)}`,\n adoptionUnavailable(decision) ?? \"Nothing changed.\",\n decision.ignorePolicyComparison === \"local-legacy-remote-ignore\"\n ? \"The remote uses an ignore policy. Migrate and review your local setup before transferring.\"\n : \"Review a fresh push before publishing this device's policy. No files or settings have changed.\",\n ];\n }\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n `Sync setup: ${safeTerminalText(decision.setupName)}`,\n \"Nothing changed. Review both lists before choosing what happens next.\",\n ...directoryReviewLines(decision),\n ...excludeReviewLines(decision),\n ...(!decision.localDirectory?.scope &&\n !decision.remoteDirectory?.scope &&\n comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\"Only the ordering differs; membership is the same.\"]\n : [`Remote-only paths: ${comparison.remoteOnly.length} \u00B7 Device-only paths: ${comparison.localOnly.length}`]),\n ];\n}\n\nfunction formatSelectionDifference(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison) return selectionSummaryLines(decision).join(\"\\n\");\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n ...directoryReviewLines(decision),\n ...(!decision.localDirectory?.scope &&\n !decision.remoteDirectory?.scope &&\n comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\"Only ordering differs; both lists contain the same paths.\", \"\"]\n : []),\n \"Remote-only paths:\",\n ...(comparison.remoteOnly.length > 0\n ? comparison.remoteOnly.map((item) => `+ ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"Device-only paths:\",\n ...(comparison.localOnly.length > 0\n ? comparison.localOnly.map((item) => `- ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"Remote ordered list:\",\n ...(decision.remoteInclude.length > 0\n ? decision.remoteInclude.map((item, index) => `${index + 1}. ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"This device's ordered list:\",\n ...(decision.localInclude.length > 0\n ? decision.localInclude.map((item, index) => `${index + 1}. ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n ...excludeReviewLines(decision),\n \"Using the remote list saves settings only and does not pull files.\",\n ].join(\"\\n\");\n}\n\nfunction formatRemoteSelectionSummary(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison) return selectionSummaryLines(decision).join(\"\\n\");\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n `Synced content for \u201C${safeTerminalText(decision.setupName)}\u201D differs from this device.`,\n `Remote-only: ${safeList(comparison.remoteOnly)}`,\n `Device-only: ${safeList(comparison.localOnly)}`,\n ...directoryReviewLines(decision),\n ...(!decision.localDirectory?.scope &&\n !decision.remoteDirectory?.scope &&\n comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\n \"Only ordering differs.\",\n `Remote order: ${safeList(decision.remoteInclude)}`,\n `Device order: ${safeList(decision.localInclude)}`,\n ]\n : []),\n ...excludeReviewLines(decision),\n \"Run /sync in TUI to choose a content list; RPC review is read-only.\",\n ].join(\"\\n\");\n}\n\nfunction excludeReviewLines(decision: RemoteSelectionDecision) {\n if (decision.localExclude === undefined && decision.remoteExclude === undefined) return [];\n return [\n `Remote excluded paths: ${safeList(decision.remoteExclude ?? [])}`,\n `This device excluded paths: ${safeList(decision.localExclude ?? [])}`,\n \"Removed exclusions can expose or replace content; old history is not erased.\",\n ];\n}\n\nfunction formatLegacySummary(config: AnySyncConfig, discovered: readonly string[]) {\n return `Remote snapshot for \u201C${safeTerminalText(config.setupName)}\u201D has no portable synced-content list; ${discovered.length} safe path${discovered.length === 1 ? \" was\" : \"s were\"} discovered, but the result is partial and read-only.`;\n}\n\nfunction decisionFromState(\n config: AnySyncConfig,\n state: Extract<RemoteSelectionState, { kind: \"different\" }>,\n): RemoteSelectionDecision {\n return {\n setupName: config.setupName,\n configIdentity: syncConfigReviewFingerprint(config),\n ignorePolicyComparison: state.ignorePolicyComparison,\n localInclude: [...config.include],\n remoteInclude: [...state.include],\n ...(config.exclude === undefined ? {} : { localExclude: [...config.exclude] }),\n ...(state.exclude === undefined ? {} : { remoteExclude: [...state.exclude] }),\n ...(config.scope ? { localDirectory: { scope: config.scope, reinclude: config.reinclude } } : {}),\n ...(state.scope ? { remoteDirectory: { scope: state.scope, reinclude: state.reinclude } } : {}),\n };\n}\n\nfunction assertLocalSelectionCurrent(config: AnySyncConfig, decision: RemoteSelectionDecision) {\n if (\n syncConfigReviewFingerprint(config) === decision.configIdentity &&\n sameSyncInclude(config.include, decision.localInclude) &&\n sameSyncExclude(config.exclude, decision.localExclude) &&\n syncDirectoryPolicyKey(config) ===\n syncDirectoryPolicyKey({\n include: decision.localInclude,\n exclude: decision.localExclude,\n ...decision.localDirectory,\n })\n ) {\n return;\n }\n throw new StaleRemoteSelectionReviewError(\n `Sync setup \u201C${safeTerminalText(config.setupName)}\u201D changed while the comparison was open.`,\n );\n}\n\nfunction continueLabel(origin: RemoteSelectionOrigin) {\n if (origin === \"pull\") return \"Continue Pull now\u2026\";\n if (origin === \"push\") return \"Continue Push now\u2026\";\n return \"Continue Sync now\u2026\";\n}\n\nfunction continueBusyLabel(origin: RemoteSelectionOrigin) {\n if (origin === \"pull\") return \"Checking remote changes\u2026\";\n if (origin === \"push\") return \"Preparing push preview\u2026\";\n return \"Checking current sync setup\u2026\";\n}\n\nfunction continuationCancelledMessage(route: \"sync\" | \"pull\" | \"push\") {\n if (route === \"pull\") return \"Pull check cancelled; no local files were changed.\";\n if (route === \"push\") return \"Push preparation cancelled; no remote files were changed.\";\n return \"Sync check cancelled; no settings or files were changed.\";\n}\n\nfunction safeList(values: readonly string[]) {\n return values.length > 0 ? values.map(safeTerminalText).join(\", \") : \"none\";\n}\n\nclass StaleRemoteSelectionReviewError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"StaleRemoteSelectionReviewError\";\n }\n}\n\nfunction isStaleReviewError(error: unknown) {\n return error instanceof StaleRemoteSelectionReviewError || error instanceof SyncSetupReviewChangedError;\n}\n\nfunction runWithOptionalStateAccess<T>(\n options: Pick<RemoteSelectionReviewOptions, \"withStateAccess\">,\n task: () => Promise<T>,\n) {\n return options.withStateAccess ? options.withStateAccess(task) : task();\n}\n\nfunction isReviewOwnerCurrent(validateOwner: () => void) {\n try {\n validateOwner();\n return true;\n } catch {\n return false;\n }\n}\n\nfunction combineSignals(sessionSignal: AbortSignal | undefined, actionSignal: AbortSignal) {\n return sessionSignal ? AbortSignal.any([sessionSignal, actionSignal]) : actionSignal;\n}\n", "export type * from \"@narumitw/pi-sync-daemon/engine/backends/backend-factory\";\nexport { createSyncBackend } from \"@narumitw/pi-sync-daemon/engine/backends/backend-factory\";\n", "export type * from \"@narumitw/pi-sync-daemon/engine/sync/remote-snapshot\";\nexport {\n formatRemoteSelectionStatus,\n readRemoteSnapshot,\n readSnapshotForHead,\n requireCompatibleRemoteSelection,\n} from \"@narumitw/pi-sync-daemon/engine/sync/remote-snapshot\";\n", "import { BorderedLoader, type ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { isKeyRelease, Key, matchesKey, truncateToWidth } from \"@earendil-works/pi-tui\";\nimport { formatInteractionHints, runCustomInteraction } from \"@narumitw/pi-tui-kit\";\nimport type { SetupPullOutcome } from \"../sync/setup-switch.js\";\nimport type { SyncDecision } from \"../sync/sync-decision.js\";\nimport type { RemoteSelectionDecision } from \"../sync/sync-policy.js\";\n\nexport type RunRouteResult =\n | { kind: \"completed\"; outcome?: SetupPullOutcome }\n | { kind: \"decision-required\"; decision: SyncDecision }\n | { kind: \"remote-selection-required\"; decision: RemoteSelectionDecision }\n | { kind: \"failed\" };\n\nexport type RunRoute = (\n route: string,\n signal?: AbortSignal,\n onCommit?: () => void,\n target?: string,\n onDialog?: (active: boolean) => void,\n retryRefusal?: boolean,\n) => Promise<RunRouteResult | undefined>;\n\nexport type CancellableOperationResult = RunRouteResult | { kind: \"closed\" } | { kind: \"cancelled\" };\n\ninterface CancellableOperationOptions {\n commitAware?: boolean;\n cancelAcrossDialogs?: boolean;\n cancelledMessage?: string | null;\n target?: string;\n signal?: AbortSignal;\n isCurrent?: () => boolean;\n}\n\nexport async function runCancellableOperation(\n ctx: ExtensionContext,\n message: string,\n route: string,\n runRoute: RunRoute,\n options: CancellableOperationOptions = {},\n): Promise<CancellableOperationResult> {\n const result = await runCancellableTask(\n ctx,\n message,\n (signal, onCommit, onDialog) => runRoute(route, signal, onCommit, options.target, onDialog),\n options,\n );\n return result.kind === \"completed\" ? (result.value ?? { kind: \"failed\" }) : result;\n}\n\nexport type CancellableTaskResult<Value> =\n | { kind: \"completed\"; value: Value }\n | { kind: \"closed\" }\n | { kind: \"cancelled\" };\n\n/** Keep non-route work under the same cancellation and drain owner as transfers. */\nexport async function runCancellableTask<Value>(\n ctx: ExtensionContext,\n message: string,\n task: (\n signal: AbortSignal | undefined,\n onCommit?: () => void,\n onDialog?: (active: boolean) => void,\n ) => Promise<Value>,\n options: Omit<CancellableOperationOptions, \"target\"> = {},\n): Promise<CancellableTaskResult<Value>> {\n const {\n commitAware = false,\n cancelAcrossDialogs = false,\n cancelledMessage = \"Check cancelled; no settings or files were changed.\",\n signal,\n isCurrent = () => true,\n } = options;\n if (signal?.aborted || !isCurrent()) return { kind: \"closed\" };\n if (ctx.mode !== \"tui\") return { kind: \"completed\", value: await task(signal) };\n let commitStarted = false;\n let taskResult!: Value;\n const interaction = await runCustomInteraction<{ cancelled?: boolean; error?: unknown }, ExtensionContext>(ctx, {\n signal,\n isCurrent: () => !signal?.aborted && isCurrent(),\n create: ({ tui, theme, keybindings, signal: interactionSignal, complete }) => {\n const loader = new BorderedLoader(tui, theme, message, { cancellable: false });\n const cancelHint = formatInteractionHints(keybindings, [\n {\n keys: [...keybindings.getKeys(\"tui.select.cancel\").filter((key) => !hasControlCharacter(key)), \"ctrl+c\"],\n label: \"cancel\",\n },\n ]);\n const cancel = (data: string) => {\n // Raw terminal listeners run before Pi filters Kitty key releases.\n if (isKeyRelease(data)) return false;\n if (!matchesKey(data, Key.ctrl(\"c\")) && !keybindings.matches(data, \"tui.select.cancel\")) return false;\n if (commitStarted) {\n ctx.ui.notify(\"Applying or publishing has started and cannot be cancelled safely.\", \"warning\");\n } else complete({ cancelled: true });\n return true;\n };\n // Pi dialogs replace this loader and restore the normal editor. Defer\n // ordinary keys while they are open; retain raw cancellation afterward.\n // Ctrl+C remains the root flow's hard-cancel path regardless of focus.\n let activeDialogs = 0;\n const unsubscribe = cancelAcrossDialogs\n ? ctx.ui.onTerminalInput((data) => {\n if (isKeyRelease(data)) return;\n if (activeDialogs > 0 && !matchesKey(data, Key.ctrl(\"c\"))) return;\n return cancel(data) ? { consume: true } : undefined;\n })\n : undefined;\n let pendingTask: Promise<Value>;\n try {\n pendingTask = task(\n interactionSignal,\n commitAware ? () => (commitStarted = true) : undefined,\n cancelAcrossDialogs\n ? (active) => {\n activeDialogs += active ? 1 : -1;\n }\n : undefined,\n );\n } catch (error) {\n unsubscribe?.();\n loader.dispose();\n throw error;\n }\n const operation = pendingTask.then(\n (result) => {\n taskResult = result;\n complete({});\n },\n (error: unknown) => complete({ error }),\n );\n return {\n render(width: number) {\n if (width <= 0) return [];\n const safeWidth = Math.max(1, width);\n const lines = loader.render(safeWidth);\n const bottomBorder = lines.at(-1);\n return [\n ...lines.slice(0, -1),\n truncateToWidth(theme.fg(\"dim\", cancelHint), safeWidth, \"\"),\n ...(bottomBorder === undefined ? [] : [bottomBorder]),\n ];\n },\n invalidate: () => loader.invalidate(),\n handleInput: cancel,\n dispose() {\n unsubscribe?.();\n loader.dispose();\n },\n waitForPending: () => operation,\n };\n },\n });\n if (interaction.kind === \"error\") throw interaction.error;\n if (interaction.kind !== \"completed\") return { kind: \"closed\" };\n if (interaction.value.cancelled) {\n if (cancelledMessage) ctx.ui.notify(cancelledMessage, \"info\");\n return { kind: \"cancelled\" };\n }\n if (interaction.value.error) throw interaction.value.error;\n return { kind: \"completed\", value: taskResult };\n}\n\nfunction hasControlCharacter(value: string) {\n // biome-ignore lint/suspicious/noControlCharactersInRegex: Unsafe key labels must be omitted.\n return /[\\u0000-\\u001f\\u007f-\\u009f]/u.test(value);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,YAAY,eAAe;;;ACApC,SAAS,yBAAyB;;;ACAlC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACNP,SAAS,sBAA6C;AACtD,SAAS,cAAc,KAAK,YAAY,uBAAuB;AAC/D,SAAS,wBAAwB,4BAA4B;AA+B7D,eAAsB,wBACpB,KACA,SACA,OACA,UACA,UAAuC,CAAC,GACH;AACrC,QAAM,SAAS,MAAM;AAAA,IACnB;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,UAAU,aAAa,SAAS,OAAO,QAAQ,UAAU,QAAQ,QAAQ,QAAQ;AAAA,IAC1F;AAAA,EACF;AACA,SAAO,OAAO,SAAS,cAAe,OAAO,SAAS,EAAE,MAAM,SAAS,IAAK;AAC9E;AAQA,eAAsB,mBACpB,KACA,SACA,MAKA,UAAuD,CAAC,GACjB;AACvC,QAAM;AAAA,IACJ,cAAc;AAAA,IACd,sBAAsB;AAAA,IACtB,mBAAmB;AAAA,IACnB;AAAA,IACA,YAAY,MAAM;AAAA,EACpB,IAAI;AACJ,MAAI,QAAQ,WAAW,CAAC,UAAU,EAAG,QAAO,EAAE,MAAM,SAAS;A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ionRequiredError,
|
|
8
8
|
SetupPullRequiresUiError,
|
|
9
9
|
SyncDecisionRequiredError
|
|
10
|
-
} from "
|
|
10
|
+
} from "#pi-sync-daemon/engine/sync/sync-errors";
|
|
11
11
|
|
|
12
12
|
export {
|
|
13
13
|
errorMessage,
|
|
@@ -15,4 +15,4 @@ export {
|
|
|
15
15
|
SetupPullRequiresUiError,
|
|
16
16
|
SyncDecisionRequiredError
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-6YKOHBSC.ts.map
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
validateConfigName,
|
|
18
18
|
validateSettingsDocument,
|
|
19
19
|
validateUniqueRemoteSyncSetups
|
|
20
|
-
} from "
|
|
20
|
+
} from "#pi-sync-daemon/engine/settings/settings-validation";
|
|
21
21
|
|
|
22
22
|
export {
|
|
23
23
|
effectiveSyncSetupRemoteIdentity,
|
|
@@ -28,6 +28,7 @@ export {
|
|
|
28
28
|
normalizeStoragePath,
|
|
29
29
|
ownRecord,
|
|
30
30
|
requiredString,
|
|
31
|
-
validateConfigName
|
|
31
|
+
validateConfigName,
|
|
32
|
+
validateSettingsDocument
|
|
32
33
|
};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-APZVJAEW.ts.map
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
backupLocal,
|
|
7
7
|
captureMutationOwner,
|
|
8
8
|
protectedSessionPaths
|
|
9
|
-
} from "
|
|
9
|
+
} from "#pi-sync-daemon/engine/sync/sync-local";
|
|
10
10
|
|
|
11
11
|
export {
|
|
12
12
|
captureMutationOwner
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=chunk-
|
|
14
|
+
//# sourceMappingURL=chunk-GELYN4UC.ts.map
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
3
|
import {
|
|
4
4
|
sameSyncExclude
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZO52JM4H.ts";
|
|
6
6
|
import {
|
|
7
7
|
syncCheckConfigFingerprint,
|
|
8
8
|
syncConfigReviewFingerprint
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MNYRU5U5.ts";
|
|
10
10
|
import {
|
|
11
11
|
setSyncStatus
|
|
12
12
|
} from "./chunk-H7VOTY5N.ts";
|
|
13
13
|
import {
|
|
14
14
|
sameSyncInclude,
|
|
15
15
|
syncDirectoryPolicyKey
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-R3SAMXB6.ts";
|
|
17
17
|
import {
|
|
18
18
|
safeTerminalText
|
|
19
19
|
} from "./chunk-2JNFEZ3V.ts";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
syncStateFingerprint,
|
|
29
29
|
writeState,
|
|
30
30
|
writeStateForConfig
|
|
31
|
-
} from "
|
|
31
|
+
} from "#pi-sync-daemon/engine/state/sync-state-store";
|
|
32
32
|
|
|
33
33
|
// src/ui/sync-attention.ts
|
|
34
34
|
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
@@ -184,4 +184,4 @@ export {
|
|
|
184
184
|
observationMatchesConfig,
|
|
185
185
|
observationSummary
|
|
186
186
|
};
|
|
187
|
-
//# sourceMappingURL=chunk-
|
|
187
|
+
//# sourceMappingURL=chunk-GSCZ4VXV.ts.map
|
|
@@ -19,15 +19,16 @@ import {
|
|
|
19
19
|
withConfigReplacementInstalledHookForTest,
|
|
20
20
|
withLocalConfigFileLock,
|
|
21
21
|
withMissingConfigReadProbeHookForTest
|
|
22
|
-
} from "
|
|
22
|
+
} from "#pi-sync-daemon/engine/settings/config-file";
|
|
23
23
|
|
|
24
24
|
// src/sync/sync-error-guidance.ts
|
|
25
|
-
import { syncErrorGuidance } from "
|
|
25
|
+
import { syncErrorGuidance } from "#pi-sync-daemon/engine/sync/sync-error-guidance";
|
|
26
26
|
|
|
27
27
|
export {
|
|
28
28
|
activeLocalConfigPath,
|
|
29
29
|
createLocalConfigDocument,
|
|
30
30
|
localConfigPath,
|
|
31
|
+
readActiveLocalConfigDocumentForRepair,
|
|
31
32
|
syncErrorGuidance
|
|
32
33
|
};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-IBXEM35O.ts.map
|