@narumitw/pi-sync 0.57.9 → 0.57.11
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 +14 -0
- package/README.md +7 -1
- package/dist/chunks/{agent-candidate-GNEYR225.ts → agent-candidate-OCDPRI5G.ts} +12 -9
- package/dist/chunks/{agent-plan-3L7CRFDM.ts → agent-plan-P5B5RGZ7.ts} +22 -18
- package/dist/chunks/{agent-plan-3L7CRFDM.ts.map → agent-plan-P5B5RGZ7.ts.map} +1 -1
- package/dist/chunks/{agent-refusal-retry-RPTMUQXK.ts → agent-refusal-retry-476YGNU5.ts} +11 -8
- package/dist/chunks/{agent-refusal-retry-RPTMUQXK.ts.map → agent-refusal-retry-476YGNU5.ts.map} +1 -1
- package/dist/chunks/{agent-store-55CZOCPX.ts → agent-store-RJSMNOYP.ts} +12 -11
- package/dist/chunks/{agent-store-55CZOCPX.ts.map → agent-store-RJSMNOYP.ts.map} +1 -1
- package/dist/chunks/agent-sync-EUK2CPSS.ts +22 -0
- package/dist/chunks/{chunk-U3XRI2HF.ts → chunk-3IYAPMST.ts} +11 -11
- package/dist/chunks/{chunk-B4QZBDBT.ts → chunk-45COPAK7.ts} +10 -3
- package/dist/chunks/chunk-45COPAK7.ts.map +7 -0
- package/dist/chunks/chunk-5SFMBY5P.ts +26 -0
- package/dist/chunks/chunk-5SFMBY5P.ts.map +7 -0
- package/dist/chunks/{chunk-ED3TYIVW.ts → chunk-5TSCBBPP.ts} +5 -5
- package/dist/chunks/{chunk-5QAE3G3K.ts → chunk-67INJPKR.ts} +6 -6
- package/dist/chunks/{chunk-IWZH5KYS.ts → chunk-6LD5KX55.ts} +10 -10
- package/dist/chunks/{chunk-AAEEHR7H.ts → chunk-6O3EDBRL.ts} +2 -2
- package/dist/chunks/{chunk-CRKTAPSL.ts → chunk-7A35ZAVO.ts} +333 -237
- package/dist/chunks/chunk-7A35ZAVO.ts.map +7 -0
- package/dist/chunks/{chunk-6FVVRTL5.ts → chunk-7OLLPPLU.ts} +77 -63
- package/dist/chunks/chunk-7OLLPPLU.ts.map +7 -0
- package/dist/chunks/{chunk-PQW6GS4J.ts → chunk-7ZIYU5QS.ts} +12 -10
- package/dist/chunks/{chunk-PQW6GS4J.ts.map → chunk-7ZIYU5QS.ts.map} +1 -1
- package/dist/chunks/{chunk-S7QS4AWK.ts → chunk-AKMV47YC.ts} +5 -5
- package/dist/chunks/chunk-AR2DGDUI.ts +55 -0
- package/dist/chunks/chunk-AR2DGDUI.ts.map +7 -0
- package/dist/chunks/{chunk-GNH73BJ5.ts → chunk-BEST45H2.ts} +7 -7
- package/dist/chunks/chunk-CBLTWXAU.ts +114 -0
- package/dist/chunks/chunk-CBLTWXAU.ts.map +7 -0
- package/dist/chunks/{chunk-GP5DU62N.ts → chunk-CPT2BN6N.ts} +2 -2
- package/dist/chunks/{chunk-UPNVIUBN.ts → chunk-DN4IA7MR.ts} +6 -6
- package/dist/chunks/{chunk-PG7NMFP2.ts → chunk-DRTC4PKM.ts} +8 -8
- package/dist/chunks/chunk-ESKOPQVB.ts +348 -0
- package/dist/chunks/chunk-ESKOPQVB.ts.map +7 -0
- package/dist/chunks/{chunk-MKKF4IMY.ts → chunk-F7E3VFXU.ts} +5 -5
- package/dist/chunks/{chunk-HUZ5CR4W.ts → chunk-FHE2DCA2.ts} +3 -52
- package/dist/chunks/chunk-FHE2DCA2.ts.map +7 -0
- package/dist/chunks/{chunk-UBV24CG4.ts → chunk-FLHCOJCD.ts} +3 -3
- package/dist/chunks/chunk-GNYGNHFF.ts +27 -0
- package/dist/chunks/chunk-GNYGNHFF.ts.map +7 -0
- package/dist/chunks/chunk-KYTT7KV4.ts +319 -0
- package/dist/chunks/chunk-KYTT7KV4.ts.map +7 -0
- package/dist/chunks/{chunk-A6HU4ERM.ts → chunk-MKSMJPVA.ts} +6 -23
- package/dist/chunks/chunk-MKSMJPVA.ts.map +7 -0
- package/dist/chunks/{chunk-ORGBI36T.ts → chunk-OJARL2TG.ts} +4 -4
- package/dist/chunks/{chunk-JCH3VXIO.ts → chunk-OKPPZA4D.ts} +150 -91
- package/dist/chunks/chunk-OKPPZA4D.ts.map +7 -0
- package/dist/chunks/{chunk-QO333NM4.ts → chunk-OVBAW7KV.ts} +180 -133
- package/dist/chunks/chunk-OVBAW7KV.ts.map +7 -0
- package/dist/chunks/{chunk-GSNPASKB.ts → chunk-Q23JJW7E.ts} +6 -6
- package/dist/chunks/{chunk-YK52VDXG.ts → chunk-TIMWN2RH.ts} +10 -8
- package/dist/chunks/{chunk-YK52VDXG.ts.map → chunk-TIMWN2RH.ts.map} +1 -1
- package/dist/chunks/{chunk-UOHR7LRO.ts → chunk-TZC7GDJE.ts} +10 -22
- package/dist/chunks/chunk-TZC7GDJE.ts.map +7 -0
- package/dist/chunks/chunk-X7R6DCVF.ts +28 -0
- package/dist/chunks/chunk-X7R6DCVF.ts.map +7 -0
- package/dist/chunks/{chunk-76NB4R7U.ts → chunk-XJHQPB3E.ts} +2 -2
- package/dist/chunks/{chunk-BDB4IDM3.ts → chunk-Y4UVXOLQ.ts} +8 -6
- package/dist/chunks/{chunk-BDB4IDM3.ts.map → chunk-Y4UVXOLQ.ts.map} +1 -1
- package/dist/chunks/{chunk-P7DD5PWZ.ts → chunk-ZDDBZH72.ts} +3 -3
- package/dist/chunks/command-handler-F2E7A5T5.ts +548 -0
- package/dist/chunks/command-handler-F2E7A5T5.ts.map +7 -0
- package/dist/chunks/{config-KGIYTTXQ.ts → config-HYG7G5EM.ts} +7 -6
- package/dist/chunks/{conflict-artifacts-FXFIIBCB.ts → conflict-artifacts-J6WSDCWP.ts} +13 -9
- package/dist/chunks/{conflict-review-3X37QEIT.ts → conflict-review-2QMO2K6Q.ts} +31 -25
- package/dist/chunks/{conflict-review-3X37QEIT.ts.map → conflict-review-2QMO2K6Q.ts.map} +1 -1
- package/dist/chunks/{continuous-record-SQJ47CXN.ts → continuous-record-AH7JGYKM.ts} +8 -7
- package/dist/chunks/{continuous-sync-Q6QUD6TY.ts → continuous-sync-VRMXCA5X.ts} +33 -28
- package/dist/chunks/{continuous-sync-Q6QUD6TY.ts.map → continuous-sync-VRMXCA5X.ts.map} +1 -1
- package/dist/chunks/{file-selection-3JJYOVNR.ts → file-selection-IELTXSGZ.ts} +11 -10
- package/dist/chunks/{file-selection-3JJYOVNR.ts.map → file-selection-IELTXSGZ.ts.map} +1 -1
- package/dist/chunks/{git-backend-NYKSG5X6.ts → git-backend-KHD36W27.ts} +15 -12
- package/dist/chunks/{git-backend-NYKSG5X6.ts.map → git-backend-KHD36W27.ts.map} +1 -1
- package/dist/chunks/{local-fields-6DGYOOIK.ts → local-fields-JEKAPZKD.ts} +9 -5
- package/dist/chunks/manager-result-dispatcher-6W52NM7F.ts +32 -0
- package/dist/chunks/{manager-ui-ZH6DEC2G.ts → manager-ui-LM7DSJ2Y.ts} +124 -67
- package/dist/chunks/manager-ui-LM7DSJ2Y.ts.map +7 -0
- package/dist/chunks/{merge-baseline-store-RFCAH7KL.ts → merge-baseline-store-65GKUMXI.ts} +6 -5
- package/dist/chunks/remote-selection-ui-TD4C4W3J.ts +31 -0
- package/dist/chunks/{s3-backend-F7PR5FB3.ts → s3-backend-L24UZ6IK.ts} +24 -18
- package/dist/chunks/s3-backend-L24UZ6IK.ts.map +7 -0
- package/dist/chunks/{setup-switch-E7PHKI6J.ts → setup-switch-PIPXYPCW.ts} +6 -7
- package/dist/chunks/{setup-wizard-OVHZYXNW.ts → setup-wizard-RR5U3SUB.ts} +8 -9
- package/dist/chunks/{setup-wizard-OVHZYXNW.ts.map → setup-wizard-RR5U3SUB.ts.map} +1 -1
- package/dist/chunks/{snapshot-THS5EY2L.ts → snapshot-RGNDYT6A.ts} +10 -6
- package/dist/chunks/snapshot-transaction-26BQO36S.ts +24 -0
- package/dist/chunks/sync-inspection-MOMLGUTD.ts +25 -0
- package/dist/chunks/sync-inspection-MOMLGUTD.ts.map +7 -0
- package/dist/chunks/{sync-operations-Y72GNIQ2.ts → sync-operations-CV3TULLD.ts} +66 -57
- package/dist/chunks/{sync-operations-Y72GNIQ2.ts.map → sync-operations-CV3TULLD.ts.map} +1 -1
- package/dist/chunks/{sync-state-CFL4RRRB.ts → sync-state-7L4NT7W2.ts} +8 -5
- package/dist/chunks/sync-state-7L4NT7W2.ts.map +7 -0
- package/dist/chunks/{webdav-backend-TGFUH3SF.ts → webdav-backend-3ZCACILP.ts} +15 -12
- package/dist/chunks/{webdav-backend-TGFUH3SF.ts.map → webdav-backend-3ZCACILP.ts.map} +1 -1
- package/dist/index.ts +54 -537
- package/dist/index.ts.map +3 -3
- package/package.json +2 -2
- package/skills/configure-pi-sync/references/configuration.md +8 -1
- package/src/backends/s3/s3-client.ts +8 -1
- package/src/commands/command-execution.ts +8 -3
- package/src/paths.ts +6 -1
- package/src/settings/config-file.ts +205 -118
- package/src/settings/config.ts +2 -2
- package/src/settings/settings-management.ts +15 -1
- package/src/settings/settings-store.ts +0 -14
- package/src/settings/settings-validation.ts +1 -1
- package/src/snapshot/session-paths.ts +15 -2
- package/src/snapshot/snapshot-mutation-queues.ts +142 -0
- package/src/snapshot/snapshot-transaction-directory.ts +16 -0
- package/src/snapshot/snapshot-transaction.ts +123 -137
- package/src/sync/automatic-sync.ts +12 -6
- package/src/sync/local-field-policy.ts +29 -0
- package/src/sync/local-fields.ts +3 -29
- package/src/sync/merge-apply.ts +6 -0
- package/src/sync/mutation-owner.ts +22 -0
- package/src/sync/startup-check.ts +3 -2
- package/src/sync/sync-loaders.ts +4 -0
- package/src/sync/sync-local.ts +2 -19
- package/src/sync-extension.ts +7 -2
- package/src/ui/cancellable-operation.ts +36 -13
- package/src/ui/manager-state.ts +3 -1
- package/src/ui/manager-ui.ts +76 -24
- package/src/ui/remote-selection-ui.ts +131 -82
- package/src/ui/settings-ui.ts +2 -1
- package/dist/chunks/chunk-6FVVRTL5.ts.map +0 -7
- package/dist/chunks/chunk-A6HU4ERM.ts.map +0 -7
- package/dist/chunks/chunk-B4QZBDBT.ts.map +0 -7
- package/dist/chunks/chunk-CRKTAPSL.ts.map +0 -7
- package/dist/chunks/chunk-HUZ5CR4W.ts.map +0 -7
- package/dist/chunks/chunk-JCH3VXIO.ts.map +0 -7
- package/dist/chunks/chunk-QO333NM4.ts.map +0 -7
- package/dist/chunks/chunk-QOFMXPM5.ts +0 -735
- package/dist/chunks/chunk-QOFMXPM5.ts.map +0 -7
- package/dist/chunks/chunk-UOHR7LRO.ts.map +0 -7
- package/dist/chunks/manager-result-dispatcher-HOCM2GDA.ts +0 -24
- package/dist/chunks/manager-ui-ZH6DEC2G.ts.map +0 -7
- package/dist/chunks/remote-selection-ui-YFPGYGNE.ts +0 -23
- package/dist/chunks/s3-backend-F7PR5FB3.ts.map +0 -7
- package/dist/chunks/sync-inspection-J25EEKZK.ts +0 -21
- /package/dist/chunks/{agent-candidate-GNEYR225.ts.map → agent-candidate-OCDPRI5G.ts.map} +0 -0
- /package/dist/chunks/{config-KGIYTTXQ.ts.map → agent-sync-EUK2CPSS.ts.map} +0 -0
- /package/dist/chunks/{chunk-U3XRI2HF.ts.map → chunk-3IYAPMST.ts.map} +0 -0
- /package/dist/chunks/{chunk-ED3TYIVW.ts.map → chunk-5TSCBBPP.ts.map} +0 -0
- /package/dist/chunks/{chunk-5QAE3G3K.ts.map → chunk-67INJPKR.ts.map} +0 -0
- /package/dist/chunks/{chunk-IWZH5KYS.ts.map → chunk-6LD5KX55.ts.map} +0 -0
- /package/dist/chunks/{chunk-AAEEHR7H.ts.map → chunk-6O3EDBRL.ts.map} +0 -0
- /package/dist/chunks/{chunk-S7QS4AWK.ts.map → chunk-AKMV47YC.ts.map} +0 -0
- /package/dist/chunks/{chunk-GNH73BJ5.ts.map → chunk-BEST45H2.ts.map} +0 -0
- /package/dist/chunks/{chunk-GP5DU62N.ts.map → chunk-CPT2BN6N.ts.map} +0 -0
- /package/dist/chunks/{chunk-UPNVIUBN.ts.map → chunk-DN4IA7MR.ts.map} +0 -0
- /package/dist/chunks/{chunk-PG7NMFP2.ts.map → chunk-DRTC4PKM.ts.map} +0 -0
- /package/dist/chunks/{chunk-MKKF4IMY.ts.map → chunk-F7E3VFXU.ts.map} +0 -0
- /package/dist/chunks/{chunk-UBV24CG4.ts.map → chunk-FLHCOJCD.ts.map} +0 -0
- /package/dist/chunks/{chunk-ORGBI36T.ts.map → chunk-OJARL2TG.ts.map} +0 -0
- /package/dist/chunks/{chunk-GSNPASKB.ts.map → chunk-Q23JJW7E.ts.map} +0 -0
- /package/dist/chunks/{chunk-76NB4R7U.ts.map → chunk-XJHQPB3E.ts.map} +0 -0
- /package/dist/chunks/{chunk-P7DD5PWZ.ts.map → chunk-ZDDBZH72.ts.map} +0 -0
- /package/dist/chunks/{conflict-artifacts-FXFIIBCB.ts.map → config-HYG7G5EM.ts.map} +0 -0
- /package/dist/chunks/{continuous-record-SQJ47CXN.ts.map → conflict-artifacts-J6WSDCWP.ts.map} +0 -0
- /package/dist/chunks/{local-fields-6DGYOOIK.ts.map → continuous-record-AH7JGYKM.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-HOCM2GDA.ts.map → local-fields-JEKAPZKD.ts.map} +0 -0
- /package/dist/chunks/{merge-baseline-store-RFCAH7KL.ts.map → manager-result-dispatcher-6W52NM7F.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-YFPGYGNE.ts.map → merge-baseline-store-65GKUMXI.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-E7PHKI6J.ts.map → remote-selection-ui-TD4C4W3J.ts.map} +0 -0
- /package/dist/chunks/{snapshot-THS5EY2L.ts.map → setup-switch-PIPXYPCW.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-J25EEKZK.ts.map → snapshot-RGNDYT6A.ts.map} +0 -0
- /package/dist/chunks/{sync-state-CFL4RRRB.ts.map → snapshot-transaction-26BQO36S.ts.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @narumitw/pi-sync
|
|
2
2
|
|
|
3
|
+
## 0.57.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 41c32db: Fix settings and transfer safety findings. Keep canonical settings available during replacement, order reads behind pending writes, and stop cancelled initialization. Bind manager actions and remote content-list adoption to the reviewed setup and connection, with cancellable network checks. Reject S3 redirects and correct SigV4 URI encoding. Preserve BOM-prefixed Pi settings and refuse unsafe aliased snapshot mutation paths while retaining recovery evidence.
|
|
8
|
+
|
|
9
|
+
## 0.57.10
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- a6582dc: Reduce Pi startup loading by deferring command, transfer, and recovery implementations until needed. Preserve awaited recovery for pending file transactions and all existing sync settings.
|
|
14
|
+
- Updated dependencies [4f79c28]
|
|
15
|
+
- @narumitw/pi-tui-kit@0.69.1
|
|
16
|
+
|
|
3
17
|
## 0.57.9
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ Remote status: Not checked
|
|
|
77
77
|
|
|
78
78
|
Use **Sync now** for bidirectional merging, or **Pull from remote…** and **Push to remote…** for reviewed directional transfers. **Settings**, **History**, and **Diagnostics** are also directly available. Switching appears only when multiple valid setups exist; review and access-recovery actions appear when needed. Pull and Push do not implicitly force overwrites.
|
|
79
79
|
|
|
80
|
-
The main summary separates current state from actions and uses local state and cached check-time observations, not a fresh remote comparison. Choose **Check remote status** for a fresh read/check or **View differences** for file differences; `/sync status`, `/sync diff`, and `/sync help` remain available. Last applied shows a compact snapshot ID and states when application time is unavailable; History retains full IDs.
|
|
80
|
+
The main summary separates current state from actions and uses local state and cached check-time observations, not a fresh remote comparison. Setup-specific actions stay bound to the displayed setup; if its configuration changes while the menu is open, review the refreshed setup before continuing. Choose **Check remote status** for a fresh read/check or **View differences** for file differences; `/sync status`, `/sync diff`, and `/sync help` remain available. Last applied shows a compact snapshot ID and states when application time is unavailable; History retains full IDs.
|
|
81
81
|
|
|
82
82
|
After Pi Sync detects an included-content mismatch, the manager shows **Sync status: Review needed** and puts **Review synced content (recommended)** first.
|
|
83
83
|
**Sync now** remains unavailable until you review the mismatch.
|
|
@@ -172,6 +172,8 @@ See [Debug startup timings](./skills/configure-pi-sync/references/configuration.
|
|
|
172
172
|
|
|
173
173
|
### Background startup checks
|
|
174
174
|
|
|
175
|
+
Startup loads command and transfer implementations only when needed. When no transaction directory is pending, a local directory check skips loading the file-recovery implementation. Pending transactions still complete recovery before Pi accepts user edits; this safety barrier is not deferred.
|
|
176
|
+
|
|
175
177
|
With **Automatic sync** enabled, session startup schedules a background check instead of waiting for a transfer. Pi remains usable while Git, WebDAV, R2, or S3 checks local hashes and remote metadata. Results follow the [status and review classifications](#resolve-conflicts-in-the-manager); check failures provide `/sync` guidance without opening a dialog. Use **Sync now** to start a reviewed transfer, or `/sync status` to retry a check. Foreground `/sync` cancels and drains the background check before starting.
|
|
176
178
|
|
|
177
179
|
Checks run once per session start, including `/reload`, new, resumed, and forked sessions, in TUI and RPC only. Print/JSON skip startup checks. This one-shot policy has no polling or automatic retry loop; separately enabled Continuous sync owns recurring work. The overall deadline is 30 seconds, followed by underlying cleanup where needed; Git process termination and temporary-ref cleanup can take additional time. Git checks can still fetch objects and update the extension's private bare cache, but never push, apply managed files, update the sync baseline, or reload Pi.
|
|
@@ -323,12 +325,16 @@ WebDAV requires HTTPS except loopback tests.
|
|
|
323
325
|
URL credentials, query strings, fragments, unsafe redirects, weak/missing ETags, and ignored conditional headers fail closed.
|
|
324
326
|
`/sync doctor` verifies collection and conditional-write behavior with an isolated probe, then repairs a missing active-snapshot history entry.
|
|
325
327
|
|
|
328
|
+
S3/R2 requests reject redirects, including same-origin redirects; configure the canonical endpoint before syncing. Credentials and snapshot bodies are never forwarded to a redirect destination.
|
|
329
|
+
|
|
326
330
|
S3/R2 publishes `latest.json` and history using ETag `If-Match`, or `If-None-Match: *` for first creation, then verifies the active pointer. Before each publication, an isolated `.pi-sync-probes/<random-id>` object verifies that the server rejects stale ETags and create-only writes to existing objects and rotates strong ETags. Credentials must allow read, write, and delete under the selected storage path; the probe is deleted even after cancellation. Missing/weak ETags, ignored conditions, and probe or cleanup failures stop publication. A failed cleanup reports the probe key for manual removal; bucket versioning may retain probe versions. `/sync doctor` remains read-only for S3/R2 and does not verify write support.
|
|
327
331
|
|
|
328
332
|
Snapshot recovery is guarded: new journals record before/after images, older journals are retired only when their unchanged preimages are provable, and unrecognized bytes remain untouched for manual review. Current-session targets are never restored during startup. Preserve a blocked transaction and its backup, close Pi, and review the private evidence before restoring selected paths; malformed/unsupported journals are not disposable. Pi may have loaded resources before lifecycle recovery, so reload or restart explicitly after recovery if loaded resources need to match the restored files.
|
|
329
333
|
|
|
330
334
|
Before pull or rollback, pi-sync writes a backup under `<agent-dir>/pi-sync/backups/`.
|
|
335
|
+
Snapshot apply and recovery require canonical agent and session paths. Symlinked or otherwise aliased parent paths are refused before changing managed local files because Pi's file queue uses different keys for existing and missing aliases. Use canonical paths for local mutations and 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.
|
|
331
336
|
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.
|
|
337
|
+
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.
|
|
332
338
|
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.
|
|
333
339
|
|
|
334
340
|
Removing a local setup or connection never deletes remote data.
|
|
@@ -5,22 +5,25 @@ import {
|
|
|
5
5
|
buildAgentEvidence,
|
|
6
6
|
digest,
|
|
7
7
|
parseAgentCandidate
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-IWZH5KYS.ts";
|
|
12
|
-
import "./chunk-76NB4R7U.ts";
|
|
8
|
+
} from "./chunk-67INJPKR.ts";
|
|
9
|
+
import "./chunk-AKMV47YC.ts";
|
|
10
|
+
import "./chunk-6LD5KX55.ts";
|
|
13
11
|
import "./chunk-ZW5ZLGBI.ts";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-XJHQPB3E.ts";
|
|
13
|
+
import "./chunk-DN4IA7MR.ts";
|
|
14
|
+
import "./chunk-AR2DGDUI.ts";
|
|
16
15
|
import "./chunk-SWRVXVFD.ts";
|
|
17
16
|
import "./chunk-2JZFHNLM.ts";
|
|
18
17
|
import "./chunk-T2SJD3N7.ts";
|
|
19
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-ESKOPQVB.ts";
|
|
19
|
+
import "./chunk-KYTT7KV4.ts";
|
|
20
|
+
import "./chunk-CBLTWXAU.ts";
|
|
21
|
+
import "./chunk-FHE2DCA2.ts";
|
|
22
|
+
import "./chunk-PRUEIIK7.ts";
|
|
20
23
|
export {
|
|
21
24
|
applyAgentCandidate,
|
|
22
25
|
buildAgentEvidence,
|
|
23
26
|
digest,
|
|
24
27
|
parseAgentCandidate
|
|
25
28
|
};
|
|
26
|
-
//# sourceMappingURL=agent-candidate-
|
|
29
|
+
//# sourceMappingURL=agent-candidate-OCDPRI5G.ts.map
|
|
@@ -3,41 +3,45 @@
|
|
|
3
3
|
import {
|
|
4
4
|
fileHashMap,
|
|
5
5
|
sameHashes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Y4UVXOLQ.ts";
|
|
7
7
|
import {
|
|
8
8
|
AgentResolutionRequired
|
|
9
9
|
} from "./chunk-3ST7RSYN.ts";
|
|
10
|
+
import "./chunk-MKSMJPVA.ts";
|
|
10
11
|
import {
|
|
11
12
|
syncConfigReviewIdentity
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
ContinuousError
|
|
16
|
-
} from "./chunk-DT7M4VQS.ts";
|
|
17
|
-
import "./chunk-YDVQYUHE.ts";
|
|
13
|
+
} from "./chunk-OVBAW7KV.ts";
|
|
14
|
+
import "./chunk-X7R6DCVF.ts";
|
|
18
15
|
import {
|
|
19
16
|
applyAgentCandidate,
|
|
20
17
|
buildAgentEvidence,
|
|
21
18
|
digest
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import {
|
|
25
|
-
createSnapshot
|
|
26
|
-
} from "./chunk-QOFMXPM5.ts";
|
|
19
|
+
} from "./chunk-67INJPKR.ts";
|
|
20
|
+
import "./chunk-AKMV47YC.ts";
|
|
27
21
|
import {
|
|
28
22
|
readMergeAncestors
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-76NB4R7U.ts";
|
|
23
|
+
} from "./chunk-6LD5KX55.ts";
|
|
31
24
|
import "./chunk-ZW5ZLGBI.ts";
|
|
32
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-XJHQPB3E.ts";
|
|
33
26
|
import {
|
|
34
27
|
readStateForConfig,
|
|
35
28
|
syncStateFingerprint
|
|
36
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-DN4IA7MR.ts";
|
|
30
|
+
import "./chunk-AR2DGDUI.ts";
|
|
37
31
|
import "./chunk-SWRVXVFD.ts";
|
|
38
32
|
import "./chunk-2JZFHNLM.ts";
|
|
39
33
|
import "./chunk-T2SJD3N7.ts";
|
|
40
|
-
import
|
|
34
|
+
import {
|
|
35
|
+
createSnapshot
|
|
36
|
+
} from "./chunk-ESKOPQVB.ts";
|
|
37
|
+
import "./chunk-KYTT7KV4.ts";
|
|
38
|
+
import "./chunk-CBLTWXAU.ts";
|
|
39
|
+
import "./chunk-FHE2DCA2.ts";
|
|
40
|
+
import {
|
|
41
|
+
ContinuousError
|
|
42
|
+
} from "./chunk-DT7M4VQS.ts";
|
|
43
|
+
import "./chunk-YDVQYUHE.ts";
|
|
44
|
+
import "./chunk-PRUEIIK7.ts";
|
|
41
45
|
|
|
42
46
|
// src/sync/agent-plan.ts
|
|
43
47
|
async function resolveAgentPlan(ctx, options, config, backend, state, local, localRaw, remote, head, plan, snapshotOptions, validate) {
|
|
@@ -113,4 +117,4 @@ async function resolveAgentPlan(ctx, options, config, backend, state, local, loc
|
|
|
113
117
|
export {
|
|
114
118
|
resolveAgentPlan
|
|
115
119
|
};
|
|
116
|
-
//# sourceMappingURL=agent-plan-
|
|
120
|
+
//# sourceMappingURL=agent-plan-P5B5RGZ7.ts.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/sync/agent-plan.ts"],
|
|
4
4
|
"sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport type { RemoteHead, SyncBackend } from \"../backends/sync-backend.js\";\nimport type { CommandOptions } from \"../commands/command-types.js\";\nimport { syncConfigReviewIdentity } from \"../settings/config.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { createSnapshot } from \"../snapshot/snapshot.js\";\nimport type { Snapshot, SnapshotOptions } from \"../snapshot/snapshot-types.js\";\nimport { readMergeAncestors } from \"../state/merge-baseline-store.js\";\nimport type { SyncState } from \"../state/state-types.js\";\nimport { readStateForConfig, syncStateFingerprint } from \"../state/sync-state-store.js\";\nimport { applyAgentCandidate, buildAgentEvidence, digest } from \"./agent-candidate.js\";\nimport { AgentResolutionRequired } from \"./agent-request.js\";\nimport { ContinuousError } from \"./continuous-errors.js\";\nimport type { FileMergePlan } from \"./file-merge-planner.js\";\nimport { fileHashMap, sameHashes } from \"./sync-state.js\";\n\nexport async function resolveAgentPlan(\n ctx: ExtensionContext,\n options: CommandOptions,\n config: AnySyncConfig,\n backend: SyncBackend,\n state: SyncState,\n local: Snapshot,\n localRaw: Snapshot,\n remote: Snapshot,\n head: RemoteHead,\n plan: FileMergePlan,\n snapshotOptions: SnapshotOptions,\n validate: () => Promise<void>,\n): Promise<FileMergePlan> {\n if (plan.kind !== \"planned\" || !plan.conflicts.length) {\n if (options.agentRetryRefusal)\n throw new ContinuousError(\"unsafe\", \"No eligible cached refusal for the current evidence. Use Sync now.\");\n return plan;\n }\n if (!ctx.hasUI || (ctx.mode !== \"tui\" && ctx.mode !== \"rpc\"))\n throw new Error(\"Agent mode paused: TUI/RPC is required.\");\n const ancestors = (await readMergeAncestors(config, state)) ?? [];\n await validate();\n let evidence: ReturnType<typeof buildAgentEvidence>;\n try {\n evidence = buildAgentEvidence(plan, local, remote, ancestors);\n } catch {\n throw new ContinuousError(\"unsafe\", \"Agent mode paused: unsafe or unsupported conflict evidence.\");\n }\n if (!config.partialSync && evidence.unsupported.length)\n throw new ContinuousError(\"unsafe\", \"Agent mode paused: unsupported conflicts prevent an all-or-nothing transfer.\");\n if (!evidence.files.length) {\n if (options.agentRetryRefusal)\n throw new ContinuousError(\"unsafe\", \"No eligible cached refusal for the current evidence. Use Sync now.\");\n if (config.partialSync) return plan;\n throw new ContinuousError(\n \"unsafe\",\n \"Agent mode paused: unsupported conflict or missing verified ancestor; evidence is unchanged.\",\n );\n }\n if (!evidence.units.length) {\n if (options.agentRetryRefusal)\n throw new ContinuousError(\"unsafe\", \"No eligible cached refusal for the current evidence. Use Sync now.\");\n return applyAgentCandidate(plan, evidence, { version: 1, results: [] });\n }\n if (!ctx.model) throw new ContinuousError(\"model\", \"Agent mode paused: select an available model first.\");\n const model = digest(ctx.model);\n const key = digest([\n 1,\n backend.identity,\n syncConfigReviewIdentity(config),\n syncStateFingerprint(state),\n head.revision,\n fileHashMap(localRaw),\n evidence,\n model,\n ]);\n if (options.agentAcceptance?.key === key) {\n try {\n return applyAgentCandidate(plan, evidence, options.agentAcceptance.candidate);\n } catch {\n throw new ContinuousError(\"unsafe\", \"Agent mode paused: candidate refused or unsupported conflict remains.\");\n }\n }\n const validateEvidence = async (signal = options.signal) => {\n const check = async () => {\n signal?.throwIfAborted();\n await validate();\n signal?.throwIfAborted();\n };\n await check();\n if (digest(ctx.model) !== model) throw new Error(\"Agent mode paused: selected model changed.\");\n const current = await createSnapshot(config.snapshotIdentity, { ...snapshotOptions, signal });\n await check();\n const currentState = await readStateForConfig(config);\n await check();\n const currentHead = await backend.readHead(signal);\n await check();\n if (\n !sameHashes(fileHashMap(current), fileHashMap(localRaw)) ||\n syncStateFingerprint(currentState) !== syncStateFingerprint(state) ||\n !currentHead ||\n !backend.sameRevision(head.revision, currentHead.revision)\n )\n throw new ContinuousError(\"stale\", \"Agent mode paused: conflict evidence changed; retry a fresh sync.\");\n };\n throw new AgentResolutionRequired(key, evidence, validateEvidence);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,eAAsB,iBACpB,KACA,SACA,QACA,SACA,OACA,OACA,UACA,QACA,MACA,MACA,iBACA,UACwB;AACxB,MAAI,KAAK,SAAS,aAAa,CAAC,KAAK,UAAU,QAAQ;AACrD,QAAI,QAAQ;AACV,YAAM,IAAI,gBAAgB,UAAU,oEAAoE;AAC1G,WAAO;AAAA,EACT;AACA,MAAI,CAAC,IAAI,SAAU,IAAI,SAAS,SAAS,IAAI,SAAS;AACpD,UAAM,IAAI,MAAM,yCAAyC;AAC3D,QAAM,YAAa,MAAM,mBAAmB,QAAQ,KAAK,KAAM,CAAC;AAChE,QAAM,SAAS;AACf,MAAI;AACJ,MAAI;AACF,eAAW,mBAAmB,MAAM,OAAO,QAAQ,SAAS;AAAA,EAC9D,QAAQ;AACN,UAAM,IA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,OAAO,kBAAkB,EAAE,GAAG,iBAAiB,OAAO,CAAC;AAC5F,UAAM,MAAM;AACZ,UAAM,eAAe,MAAM,mBAAmB,MAAM;AACpD,UAAM,MAAM;AACZ,UAAM,cAAc,MAAM,QAAQ,SAAS,MAAM;AACjD,UAAM,MAAM;AACZ,QACE,CAAC,WAAW,YAAY,OAAO,GAAG,YAAY,QAAQ,CAAC,KACvD,qBAAqB,YAAY,MAAM,qBAAqB,KAAK,KACjE,CAAC,eACD,CAAC,QAAQ,aAAa,KAAK,UAAU,YAAY,QAAQ;AAEzD,YAAM,IAAI,gBAAgB,SAAS,mEAAmE;AAAA,EAC1G;AACA,QAAM,IAAI,wBAAwB,KAAK,UAAU,gBAAgB;AACnE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,24 +3,27 @@
|
|
|
3
3
|
import {
|
|
4
4
|
confirmMergeReview
|
|
5
5
|
} from "./chunk-KHBPED6W.ts";
|
|
6
|
+
import "./chunk-TZC7GDJE.ts";
|
|
7
|
+
import "./chunk-FLHCOJCD.ts";
|
|
6
8
|
import {
|
|
7
9
|
captureMutationOwner
|
|
8
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-GNYGNHFF.ts";
|
|
9
11
|
import {
|
|
10
12
|
safeTerminalText
|
|
11
13
|
} from "./chunk-AMJRUXFT.ts";
|
|
12
|
-
import "./chunk-UBV24CG4.ts";
|
|
13
14
|
import {
|
|
14
15
|
loadConfig
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-OVBAW7KV.ts";
|
|
17
|
+
import "./chunk-X7R6DCVF.ts";
|
|
17
18
|
import "./chunk-PWMWOJP4.ts";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-ZW5ZLGBI.ts";
|
|
19
|
+
import "./chunk-AR2DGDUI.ts";
|
|
20
20
|
import "./chunk-SWRVXVFD.ts";
|
|
21
21
|
import "./chunk-2JZFHNLM.ts";
|
|
22
22
|
import "./chunk-T2SJD3N7.ts";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-ESKOPQVB.ts";
|
|
24
|
+
import "./chunk-KYTT7KV4.ts";
|
|
25
|
+
import "./chunk-CBLTWXAU.ts";
|
|
26
|
+
import "./chunk-FHE2DCA2.ts";
|
|
24
27
|
|
|
25
28
|
// src/sync/agent-refusal-retry.ts
|
|
26
29
|
async function confirmAgentRefusalRetry(ctx, setup, evidence, validate, signal) {
|
|
@@ -66,4 +69,4 @@ async function confirmAgentRefusalRetry(ctx, setup, evidence, validate, signal)
|
|
|
66
69
|
export {
|
|
67
70
|
confirmAgentRefusalRetry
|
|
68
71
|
};
|
|
69
|
-
//# sourceMappingURL=agent-refusal-retry-
|
|
72
|
+
//# sourceMappingURL=agent-refusal-retry-476YGNU5.ts.map
|
package/dist/chunks/{agent-refusal-retry-RPTMUQXK.ts.map → agent-refusal-retry-476YGNU5.ts.map}
RENAMED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/sync/agent-refusal-retry.ts"],
|
|
4
4
|
"sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { loadConfig } from \"../settings/config.js\";\nimport { confirmMergeReview } from \"../ui/merge-review.js\";\nimport { safeTerminalText } from \"../ui/terminal-text.js\";\nimport type { AgentEvidence } from \"./agent-candidate.js\";\nimport { captureMutationOwner } from \"./sync-local.js\";\n\n/** Review uses fresh request validation; no private text or provider error enters the summary. */\nexport async function confirmAgentRefusalRetry(\n ctx: ExtensionContext,\n setup: string | undefined,\n evidence: AgentEvidence,\n validate: () => Promise<void>,\n signal?: AbortSignal,\n) {\n const owner = captureMutationOwner(ctx, signal);\n owner();\n const config = await loadConfig(setup);\n owner();\n await validate();\n owner();\n const summary = [\n `Setup: ${safeTerminalText(config.setupName)}`,\n `Storage connection: ${safeTerminalText(config.connectionName)}`,\n `Storage path: ${safeTerminalText(config.storagePath)}`,\n ...(config.backend.type === \"s3\" ? [`Bucket: ${safeTerminalText(config.backend.destination.bucket)}`] : []),\n ...(config.backend.type === \"git\" ? [`Branch: ${safeTerminalText(config.backend.destination.branch)}`] : []),\n `Selected model: ${safeTerminalText(ctx.model?.provider ?? \"unknown\")}/${safeTerminalText(ctx.model?.id ?? \"unknown\")}`,\n `Conflict paths: ${[...new Set(evidence.units.map((unit) => unit.path))].map(safeTerminalText).join(\", \")}`,\n \"Send this conflict evidence again despite the cached refusal? This permits one fresh provider request for the reviewed candidate, may incur costs, and can replace selected local and remote content if the result passes validation. Semantic correctness is not guaranteed.\",\n \"Ordinary Sync now continues to reuse cached results. Automatic request accounting is not cleared or reset. The previous refusal is retained privately. No resources reload automatically. Cancellation cannot recall submitted content, provider charges, or committed writes.\",\n ].join(\"\\n\\n\");\n const confirmed = await confirmMergeReview(\n ctx,\n \"Retry refused model result?\",\n summary,\n signal,\n () => {\n try {\n owner();\n return true;\n } catch {\n return false;\n }\n },\n \"Send one fresh request\",\n summary.split(\"\\n\"),\n );\n owner();\n if (!confirmed) return false;\n await validate();\n owner();\n return true;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,eAAsB,yBACpB,KACA,OACA,UACA,UACA,QACA;AACA,QAAM,QAAQ,qBAAqB,KAAK,MAAM;AAC9C,QAAM;AACN,QAAM,SAAS,MAAM,WAAW,KAAK;AACrC,QAAM;AACN,QAAM,SAAS;AACf,QAAM;AACN,QAAM,UAAU;AAAA,IACd,UAAU,iBAAiB,OAAO,SAAS,CAAC;AAAA,IAC5C,uBAAuB,iBAAiB,OAAO,cAAc,CAAC;AAAA,IAC9D,iBAAiB,iBAAiB,OAAO,WAAW,CAAC;AAAA,IACrD,GAAI,OAAO,QAAQ,SAAS,OAAO,CAAC,WAAW,iBAAiB,OAAO,QAAQ,YAAY,MAAM,CAAC,EAAE,IAAI,CAAC;AAAA,IACzG,GAAI,OAAO,QAAQ,SAAS,QAAQ,CAAC,WAAW,iBAAiB,OAAO,QAAQ,YAAY,MAAM,CAAC,EAAE,IAAI,CAAC;AAAA,IAC1G,mBAAmB,iBAAiB,IAAI,OAAO,YAAY,SAAS,CAAC,IAAI,iBAAiB,IAAI,OAAO,MAAM,SAAS,CAAC;AAAA,IACrH,mBAAmB,CAAC,GAAG,IAAI,IAAI,SAAS,MAAM,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,EAAE,IAAI,gBAAgB,EAAE,KAAK,IAAI,CAAC;AAAA,IACzG;AAAA,IACA;AAAA,EACF,EAAE,KAAK,MAAM;AACb,QAAM,YAAY,MAAM;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AACJ,UAAI;AACF,cAAM;AACN,eAAO;AAAA,MACT,QAAQ;AACN,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA;AAAA,IACA,QAAQ,MAAM,IAAI;AAAA,EACpB;AACA,QAAM;AACN,MAAI,CAAC,UAAW,QAAO;AACvB,QAAM,SAAS;AACf,QAAM;AACN,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,16 +2,12 @@
|
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
3
|
import {
|
|
4
4
|
withLock
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import {
|
|
7
|
-
ContinuousError
|
|
8
|
-
} from "./chunk-DT7M4VQS.ts";
|
|
9
|
-
import "./chunk-YDVQYUHE.ts";
|
|
5
|
+
} from "./chunk-6O3EDBRL.ts";
|
|
10
6
|
import "./chunk-PWMWOJP4.ts";
|
|
7
|
+
import "./chunk-DN4IA7MR.ts";
|
|
11
8
|
import {
|
|
12
|
-
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-UPNVIUBN.ts";
|
|
9
|
+
writeJson
|
|
10
|
+
} from "./chunk-AR2DGDUI.ts";
|
|
15
11
|
import {
|
|
16
12
|
LOCKFILE_FS_ADAPTER,
|
|
17
13
|
LOCK_GUARD_STALE_MS,
|
|
@@ -20,9 +16,14 @@ import {
|
|
|
20
16
|
} from "./chunk-SWRVXVFD.ts";
|
|
21
17
|
import "./chunk-2JZFHNLM.ts";
|
|
22
18
|
import "./chunk-T2SJD3N7.ts";
|
|
19
|
+
import "./chunk-FHE2DCA2.ts";
|
|
23
20
|
import {
|
|
24
|
-
|
|
25
|
-
} from "./chunk-
|
|
21
|
+
ContinuousError
|
|
22
|
+
} from "./chunk-DT7M4VQS.ts";
|
|
23
|
+
import "./chunk-YDVQYUHE.ts";
|
|
24
|
+
import {
|
|
25
|
+
AGENT_OUTPUT_BYTES
|
|
26
|
+
} from "./chunk-PRUEIIK7.ts";
|
|
26
27
|
|
|
27
28
|
// src/sync/agent-store.ts
|
|
28
29
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -171,4 +172,4 @@ export {
|
|
|
171
172
|
saveAgentCandidate,
|
|
172
173
|
withAgentClaim
|
|
173
174
|
};
|
|
174
|
-
//# sourceMappingURL=agent-store-
|
|
175
|
+
//# sourceMappingURL=agent-store-RJSMNOYP.ts.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/sync/agent-store.ts"],
|
|
4
4
|
"sourcesContent": ["import { createHash, randomUUID } from \"node:crypto\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport lockfile from \"proper-lockfile\";\nimport { writeJson } from \"../state/json-file.js\";\nimport { withLock } from \"../state/lock.js\";\nimport { LOCK_GUARD_STALE_MS, LOCK_GUARD_UPDATE_MS } from \"../state/lock-policy.js\";\nimport { LOCKFILE_FS_ADAPTER } from \"../state/lockfile-fs.js\";\nimport { stateDir } from \"../state/state-directory.js\";\nimport type { AgentCandidate } from \"./agent-candidate.js\";\nimport { AGENT_OUTPUT_BYTES } from \"./agent-policy.js\";\nimport { ContinuousError } from \"./continuous-errors.js\";\n\ninterface Claim {\n version: 1;\n id: string;\n pid: number;\n}\nfunction paths() {\n const root = path.join(stateDir(), \"agent-resolver\");\n return { root, claim: path.join(root, \"claim.json\") };\n}\nasync function directory() {\n const { root } = paths();\n await fs.mkdir(root, { mode: 0o700 });\n}\nasync function checkDirectory() {\n const stat = await fs.lstat(paths().root);\n if (!stat.isDirectory() || stat.isSymbolicLink() || (process.platform !== \"win32\" && stat.mode & 0o077))\n throw new Error(\"Unsafe agent resolver directory; evidence retained.\");\n}\nasync function readPrivate(file: string): Promise<unknown> {\n try {\n await checkDirectory();\n const stat = await fs.lstat(file);\n if (\n !stat.isFile() ||\n stat.isSymbolicLink() ||\n stat.nlink !== 1 ||\n stat.size > AGENT_OUTPUT_BYTES * 2 ||\n (process.platform !== \"win32\" && stat.mode & 0o077)\n )\n throw new Error(\"Unsafe agent resolver record; evidence retained.\");\n return JSON.parse(await fs.readFile(file, \"utf8\"));\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return undefined;\n throw new Error(\"Unreadable agent resolver record; evidence retained.\");\n }\n}\nasync function readClaim(): Promise<Claim | undefined> {\n const value = await readPrivate(paths().claim);\n if (value === undefined) return;\n const claim = value as Claim;\n if (\n claim?.version !== 1 ||\n typeof claim.id !== \"string\" ||\n !/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/u.test(claim.id) ||\n Object.keys(claim).sort().join(\",\") !== \"id,pid,version\" ||\n !Number.isSafeInteger(claim.pid) ||\n claim.pid < 1 ||\n claim.pid > 2_147_483_647\n )\n throw new Error(\"Invalid agent resolver claim; evidence retained.\");\n return claim;\n}\nfunction alive(pid: number) {\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n return (error as NodeJS.ErrnoException).code !== \"ESRCH\";\n }\n}\n\n/** Caller retains the state-directory migration guard; claim changes use a separate short-lived guard. */\nexport async function withAgentClaim<T>(fn: (assertOwner: () => Promise<void>) => Promise<T>): Promise<T> {\n const claim: Claim = { version: 1, id: randomUUID(), pid: process.pid };\n let armed = false;\n const assertOwner = async () => {\n const current = await readClaim();\n if (current?.id !== claim.id || current.pid !== process.pid)\n throw new Error(\"Agent resolver ownership changed; candidate not applied.\");\n };\n try {\n await withLock(\"agent-claim\", async () => {\n try {\n await directory();\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"EEXIST\") throw error;\n }\n await checkDirectory();\n await withClaimGuard(async () => {\n const existing = await readClaim();\n if (existing && alive(existing.pid))\n throw new ContinuousError(\"contention\", \"Agent mode deferred: another local resolver is running.\");\n // A durability failure can occur after rename: cleanup must own partial initialization too.\n armed = true;\n await writeJson(paths().claim, claim);\n });\n });\n return await fn(assertOwner);\n } finally {\n if (armed) await releaseClaim(claim);\n }\n}\nasync function releaseClaim(claim: Claim) {\n // Ordinary transfers may hold the operation lock for an arbitrary time.\n // Cleanup needs only the claim guard; it never waits for that operation lock.\n await withClaimGuard(async () => {\n const current = await readClaim();\n if (current?.id === claim.id && current.pid === claim.pid) await fs.rm(paths().claim);\n });\n}\nasync function withClaimGuard<T>(run: () => Promise<T>): Promise<T> {\n await checkDirectory();\n let compromisedError: Error | undefined;\n const release = await lockfile.lock(paths().claim, {\n fs: LOCKFILE_FS_ADAPTER,\n realpath: false,\n stale: LOCK_GUARD_STALE_MS,\n update: LOCK_GUARD_UPDATE_MS,\n retries: { retries: 100, factor: 1.2, minTimeout: 10, maxTimeout: 100 },\n onCompromised: (error) => {\n compromisedError = error;\n },\n });\n try {\n const result = await run();\n if (compromisedError) throw compromisedError;\n return result;\n } finally {\n await release();\n }\n}\nfunction candidatePath(key: string) {\n if (!/^[a-f0-9]{64}$/u.test(key)) throw new Error(\"Invalid agent candidate key.\");\n return path.join(paths().root, `${key}.json`);\n}\nexport async function readAgentCandidate(key: string): Promise<unknown> {\n return readPrivate(candidatePath(key));\n}\nexport async function saveAgentCandidate(key: string, candidate: unknown) {\n await checkDirectory();\n const target = candidatePath(key);\n const existing = await readPrivate(target);\n if (existing !== undefined) {\n if (JSON.stringify(existing) !== JSON.stringify(candidate))\n throw new Error(\"Agent candidate changed before save; existing evidence retained.\");\n return;\n }\n await writeJson(target, candidate, { maxBytes: AGENT_OUTPUT_BYTES * 2 });\n}\n\n/** Caller holds the resolver claim and operation lock and has validated both candidates. */\nexport async function replaceRefusedAgentCandidate(\n key: string,\n previous: AgentCandidate,\n candidate: AgentCandidate,\n validate: () => Promise<void>,\n) {\n const original = JSON.stringify(previous);\n if (!previous.results.some((row) => \"refuse\" in row) || candidate.results.some((row) => \"refuse\" in row))\n throw new Error(\"Only a validated refusal can be replaced by a complete retry result.\");\n const target = candidatePath(key);\n const assertPrevious = async () => {\n if (JSON.stringify(await readPrivate(target)) !== original)\n throw new Error(\"Cached refusal changed during review; previous evidence retained.\");\n await validate();\n };\n await assertPrevious();\n const digest = createHash(\"sha256\").update(original).digest(\"hex\");\n const archive = path.join(paths().root, `${key}.refusal-${digest}.json`);\n const retained = await readPrivate(archive);\n await validate();\n if (retained !== undefined && JSON.stringify(retained) !== original)\n throw new Error(\"Retained refusal changed; evidence retained.\");\n if (retained === undefined) await writeJson(archive, previous, { maxBytes: AGENT_OUTPUT_BYTES * 2 });\n await assertPrevious();\n // Archive first: even a durability error after replacement retains the original refusal.\n // Once rename commits, later cancellation cannot undo the valid new candidate.\n await writeJson(target, candidate, { maxBytes: AGENT_OUTPUT_BYTES * 2 });\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,kBAAkB;AACvC,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,cAAc;AAerB,SAAS,QAAQ;AACf,QAAM,OAAO,KAAK,KAAK,SAAS,GAAG,gBAAgB;AACnD,SAAO,EAAE,MAAM,OAAO,KAAK,KAAK,MAAM,YAAY,EAAE;AACtD;AACA,eAAe,YAAY;AACzB,QAAM,EAAE,KAA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KAAK,MAAM,EAAE,MAAM,GAAG,GAAG,YAAY,MAAM,OAAO;AACvE,QAAM,WAAW,MAAM,YAAY,OAAO;AAC1C,QAAM,SAAS;AACf,MAAI,aAAa,UAAa,KAAK,UAAU,QAAQ,MAAM;AACzD,UAAM,IAAI,MAAM,8CAA8C;AAChE,MAAI,aAAa,OAAW,OAAM,UAAU,SAAS,UAAU,EAAE,UAAU,qBAAqB,EAAE,CAAC;AACnG,QAAM,eAAe;AAGrB,QAAM,UAAU,QAAQ,WAAW,EAAE,UAAU,qBAAqB,EAAE,CAAC;AACzE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @generated by scripts/build-runtime.mjs; do not edit.
|
|
2
|
+
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
|
+
import {
|
|
4
|
+
withAgentSyncLock
|
|
5
|
+
} from "./chunk-F7E3VFXU.ts";
|
|
6
|
+
import "./chunk-3ST7RSYN.ts";
|
|
7
|
+
import "./chunk-K3RIEL6J.ts";
|
|
8
|
+
import "./chunk-6O3EDBRL.ts";
|
|
9
|
+
import "./chunk-PWMWOJP4.ts";
|
|
10
|
+
import "./chunk-DN4IA7MR.ts";
|
|
11
|
+
import "./chunk-AR2DGDUI.ts";
|
|
12
|
+
import "./chunk-SWRVXVFD.ts";
|
|
13
|
+
import "./chunk-2JZFHNLM.ts";
|
|
14
|
+
import "./chunk-T2SJD3N7.ts";
|
|
15
|
+
import "./chunk-FHE2DCA2.ts";
|
|
16
|
+
import "./chunk-DT7M4VQS.ts";
|
|
17
|
+
import "./chunk-YDVQYUHE.ts";
|
|
18
|
+
import "./chunk-PRUEIIK7.ts";
|
|
19
|
+
export {
|
|
20
|
+
withAgentSyncLock
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=agent-sync-EUK2CPSS.ts.map
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
// @generated by scripts/build-runtime.mjs; do not edit.
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
|
+
import {
|
|
4
|
+
automaticSyncSummary
|
|
5
|
+
} from "./chunk-ECYCNZOE.ts";
|
|
3
6
|
import {
|
|
4
7
|
addStorageConnection,
|
|
5
8
|
addSyncSetup,
|
|
6
9
|
saveNewV3Settings,
|
|
7
10
|
updateStorageConnection,
|
|
8
11
|
updateSyncSetup
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-45COPAK7.ts";
|
|
10
13
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
14
|
+
syncErrorGuidance
|
|
15
|
+
} from "./chunk-G4RUXRWZ.ts";
|
|
13
16
|
import {
|
|
14
17
|
AUTOMATIC_SYNC_DESCRIPTION,
|
|
15
18
|
setSyncSetupCompletions
|
|
@@ -17,9 +20,6 @@ import {
|
|
|
17
20
|
import {
|
|
18
21
|
safeTerminalText
|
|
19
22
|
} from "./chunk-AMJRUXFT.ts";
|
|
20
|
-
import {
|
|
21
|
-
syncErrorGuidance
|
|
22
|
-
} from "./chunk-G4RUXRWZ.ts";
|
|
23
23
|
import {
|
|
24
24
|
errorMessage
|
|
25
25
|
} from "./chunk-7D5SF7P3.ts";
|
|
@@ -33,13 +33,10 @@ import {
|
|
|
33
33
|
readLocalConfigObject,
|
|
34
34
|
requiredString,
|
|
35
35
|
validateConfigName
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-OVBAW7KV.ts";
|
|
37
37
|
import {
|
|
38
38
|
throwIfAborted
|
|
39
39
|
} from "./chunk-PWMWOJP4.ts";
|
|
40
|
-
import {
|
|
41
|
-
DEFAULT_SYNC_INCLUDE
|
|
42
|
-
} from "./chunk-QOFMXPM5.ts";
|
|
43
40
|
import {
|
|
44
41
|
normalizeWebDavPath,
|
|
45
42
|
normalizeWebDavUrl,
|
|
@@ -50,6 +47,9 @@ import {
|
|
|
50
47
|
normalizeGitDirectory,
|
|
51
48
|
normalizeGitRemote
|
|
52
49
|
} from "./chunk-T2SJD3N7.ts";
|
|
50
|
+
import {
|
|
51
|
+
DEFAULT_SYNC_INCLUDE
|
|
52
|
+
} from "./chunk-KYTT7KV4.ts";
|
|
53
53
|
|
|
54
54
|
// src/commands/setup-completions.ts
|
|
55
55
|
async function refreshTargetCompletions() {
|
|
@@ -1031,4 +1031,4 @@ export {
|
|
|
1031
1031
|
showAddWebDavStorageProfile,
|
|
1032
1032
|
showEditWebDavStorageProfile
|
|
1033
1033
|
};
|
|
1034
|
-
//# sourceMappingURL=chunk-
|
|
1034
|
+
//# sourceMappingURL=chunk-3IYAPMST.ts.map
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
// @generated by scripts/build-runtime.mjs; do not edit.
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
3
|
import {
|
|
4
|
+
configFromSettings,
|
|
4
5
|
effectiveSyncSetupRemoteIdentity,
|
|
5
6
|
localConfigPath,
|
|
7
|
+
syncCheckConfigFingerprint,
|
|
6
8
|
syncSetupStorageReview,
|
|
7
9
|
updateLocalConfig,
|
|
8
10
|
validateConfigName
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-OVBAW7KV.ts";
|
|
10
12
|
import {
|
|
11
13
|
normalizeSyncInclude
|
|
12
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-KYTT7KV4.ts";
|
|
13
15
|
|
|
14
16
|
// src/settings/settings-management.ts
|
|
15
17
|
import { isDeepStrictEqual } from "node:util";
|
|
@@ -98,6 +100,11 @@ async function updateSyncSetup(name, update, options = {}) {
|
|
|
98
100
|
await updateSettings((settings) => {
|
|
99
101
|
const setup = settings.syncSetups[name];
|
|
100
102
|
if (!setup) throw new Error(`Sync setup not found: ${name}`);
|
|
103
|
+
if (options.expectedConfigFingerprint !== void 0 && syncCheckConfigFingerprint(configFromSettings(settings, name)) !== options.expectedConfigFingerprint) {
|
|
104
|
+
throw new SyncSetupReviewChangedError(
|
|
105
|
+
`Sync setup \u201C${name}\u201D changed while it was open; reopen it and review the current configuration.`
|
|
106
|
+
);
|
|
107
|
+
}
|
|
101
108
|
if (options.expectedInclude && !sameNames(normalizeSyncInclude(setup.sync.include), options.expectedInclude)) {
|
|
102
109
|
throw new SyncSetupReviewChangedError(
|
|
103
110
|
`Sync setup \u201C${name}\u201D included content changed while it was open; reopen it and review the current selection.`
|
|
@@ -195,4 +202,4 @@ export {
|
|
|
195
202
|
removeSyncSetup,
|
|
196
203
|
removeStorageConnection
|
|
197
204
|
};
|
|
198
|
-
//# sourceMappingURL=chunk-
|
|
205
|
+
//# sourceMappingURL=chunk-45COPAK7.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/settings/settings-management.ts"],
|
|
4
|
+
"sourcesContent": ["import { isDeepStrictEqual } from \"node:util\";\nimport { normalizeSyncInclude } from \"../sync/sync-policy.js\";\nimport {\n configFromSettings,\n type SyncSetupStorageReview,\n syncCheckConfigFingerprint,\n syncSetupStorageReview,\n} from \"./config.js\";\nimport { localConfigPath } from \"./config-file.js\";\nimport { updateLocalConfig } from \"./settings-store.js\";\nimport type { PiSyncSettingsV3, StorageConnectionSettings, SyncSetupSettings } from \"./settings-types.js\";\nimport { effectiveSyncSetupRemoteIdentity, validateConfigName } from \"./settings-validation.js\";\n\nexport class SyncSetupReviewChangedError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"SyncSetupReviewChangedError\";\n }\n}\n\nexport async function saveNewV3Settings(\n input: {\n setupName: string;\n connectionName: string;\n connection: StorageConnectionSettings;\n setup: SyncSetupSettings;\n },\n signal?: AbortSignal,\n) {\n validateConfigName(input.setupName, \"sync setup\");\n validateConfigName(input.connectionName, \"storage connection\");\n const settings: PiSyncSettingsV3 = {\n version: 3,\n activeSyncSetup: input.setupName,\n onSwitch: \"ask-before-pull\",\n skipSecretScan: false,\n storageConnections: { [input.connectionName]: structuredClone(input.connection) },\n syncSetups: {\n [input.setupName]: {\n ...structuredClone(input.setup),\n storage: { ...input.setup.storage, connection: input.connectionName },\n },\n },\n };\n return updateLocalConfig((current) => {\n if (Object.keys(current.storageConnections).length || Object.keys(current.syncSetups).length) {\n throw new Error(`Settings already exist: ${localConfigPath()}`);\n }\n return { ...current, ...settings };\n }, signal);\n}\n\nexport async function addStorageConnection(name: string, connection: StorageConnectionSettings, signal?: AbortSignal) {\n validateConfigName(name, \"storage connection\");\n await updateSettings((settings) => {\n if (Object.hasOwn(settings.storageConnections, name)) {\n throw new Error(`Storage connection already exists: ${name}`);\n }\n return {\n ...settings,\n storageConnections: {\n ...settings.storageConnections,\n [name]: structuredClone(connection),\n },\n };\n }, signal);\n}\n\nexport async function updateStorageConnection(\n name: string,\n update: (connection: StorageConnectionSettings) => StorageConnectionSettings,\n expectedSetups?: readonly string[],\n signal?: AbortSignal,\n) {\n validateConfigName(name, \"storage connection\");\n await updateSettings((settings) => {\n const connection = settings.storageConnections[name];\n if (!connection) throw new Error(`Storage connection not found: ${name}`);\n const currentSetups = referencingSetupNames(settings.syncSetups, name);\n if (expectedSetups && !sameNames(currentSetups, expectedSetups)) {\n throw new Error(\n `Storage connection \u201C${name}\u201D usage changed while it was open; reopen it and review the affected sync setups.`,\n );\n }\n const nextConnection = update(structuredClone(connection));\n const nextConnections = { ...settings.storageConnections, [name]: nextConnection };\n assertUniqueLocations(settings.syncSetups, nextConnections);\n return { ...settings, storageConnections: nextConnections };\n }, signal);\n}\n\nexport async function addSyncSetup(\n name: string,\n setup: SyncSetupSettings,\n signal?: AbortSignal,\n expectedConnection?: StorageConnectionSettings,\n) {\n validateConfigName(name, \"sync setup\");\n await updateSettings((settings) => {\n if (Object.hasOwn(settings.syncSetups, name)) throw new Error(`Sync setup already exists: ${name}`);\n if (!Object.hasOwn(settings.storageConnections, setup.storage.connection)) {\n throw new Error(`Storage connection not found: ${setup.storage.connection}`);\n }\n if (\n expectedConnection &&\n !isDeepStrictEqual(settings.storageConnections[setup.storage.connection], expectedConnection)\n ) {\n throw new SyncSetupReviewChangedError(\"Storage connection changed while the setup review was open; reopen it.\");\n }\n const nextSetups = { ...settings.syncSetups, [name]: structuredClone(setup) };\n assertUniqueLocations(nextSetups, settings.storageConnections);\n return {\n ...settings,\n syncSetups: nextSetups,\n ...(settings.activeSyncSetup ? {} : { activeSyncSetup: name }),\n };\n }, signal);\n}\n\nexport async function updateSyncSetup(\n name: string,\n update: (setup: SyncSetupSettings) => SyncSetupSettings,\n options: {\n expectedStorage?: SyncSetupStorageReview;\n expectedInclude?: readonly string[];\n expectedConnection?: StorageConnectionSettings;\n expectedConfigFingerprint?: string;\n signal?: AbortSignal;\n } = {},\n) {\n validateConfigName(name, \"sync setup\");\n await updateSettings((settings) => {\n const setup = settings.syncSetups[name];\n if (!setup) throw new Error(`Sync setup not found: ${name}`);\n if (\n options.expectedConfigFingerprint !== undefined &&\n syncCheckConfigFingerprint(configFromSettings(settings, name)) !== options.expectedConfigFingerprint\n ) {\n throw new SyncSetupReviewChangedError(\n `Sync setup \u201C${name}\u201D changed while it was open; reopen it and review the current configuration.`,\n );\n }\n if (options.expectedInclude && !sameNames(normalizeSyncInclude(setup.sync.include), options.expectedInclude)) {\n throw new SyncSetupReviewChangedError(\n `Sync setup \u201C${name}\u201D included content changed while it was open; reopen it and review the current selection.`,\n );\n }\n if (options.expectedStorage) {\n const connectionName = setup.storage.connection;\n const connection = settings.storageConnections[connectionName];\n if (\n !connection ||\n !sameStorageReview(syncSetupStorageReview(name, setup, connectionName, connection), options.expectedStorage)\n ) {\n throw new SyncSetupReviewChangedError(\n `Sync setup \u201C${name}\u201D storage changed while it was open; reopen it and review the current storage location.`,\n );\n }\n }\n if (\n options.expectedConnection &&\n !isDeepStrictEqual(settings.storageConnections[setup.storage.connection], options.expectedConnection)\n ) {\n throw new SyncSetupReviewChangedError(\"Storage connection changed while the setup review was open; reopen it.\");\n }\n const nextSetup = update(structuredClone(setup));\n if (!Object.hasOwn(settings.storageConnections, nextSetup.storage.connection)) {\n throw new Error(`Storage connection not found: ${nextSetup.storage.connection}`);\n }\n const nextSetups = { ...settings.syncSetups, [name]: nextSetup };\n assertUniqueLocations(nextSetups, settings.storageConnections);\n return { ...settings, syncSetups: nextSetups };\n }, options.signal);\n}\n\nexport async function removeSyncSetup(name: string, signal?: AbortSignal) {\n validateConfigName(name, \"sync setup\");\n await updateSettings((settings) => {\n if (!Object.hasOwn(settings.syncSetups, name)) throw new Error(`Sync setup not found: ${name}`);\n const isCurrent = settings.activeSyncSetup === name;\n if (isCurrent && Object.keys(settings.syncSetups).length > 1) {\n throw new Error(\"Switch to another sync setup before removing the current setup.\");\n }\n const syncSetups = { ...settings.syncSetups };\n delete syncSetups[name];\n const next = { ...settings, syncSetups };\n if (isCurrent) delete next.activeSyncSetup;\n return next;\n }, signal);\n}\n\nexport async function removeStorageConnection(name: string, signal?: AbortSignal) {\n validateConfigName(name, \"storage connection\");\n await updateSettings((settings) => {\n const referenced = referencingSetupNames(settings.syncSetups, name)[0];\n if (referenced) {\n throw new Error(`Storage connection \u201C${name}\u201D is used by sync setup \u201C${referenced}\u201D.`);\n }\n if (!Object.hasOwn(settings.storageConnections, name)) {\n throw new Error(`Storage connection not found: ${name}`);\n }\n const storageConnections = { ...settings.storageConnections };\n delete storageConnections[name];\n return { ...settings, storageConnections };\n }, signal);\n}\n\nasync function updateSettings(update: (settings: PiSyncSettingsV3) => PiSyncSettingsV3, signal?: AbortSignal) {\n return updateLocalConfig((settings) => {\n if (settings.version !== 3 && settings.version !== 4 && settings.version !== 5) {\n throw new Error(\"Storage connections and sync setups require version 3 or 4 or 5 pi-sync settings.\");\n }\n return update(settings);\n }, signal);\n}\n\nfunction referencingSetupNames(setups: Record<string, SyncSetupSettings>, connection: string) {\n return Object.entries(setups)\n .filter(([, setup]) => setup.storage.connection === connection)\n .map(([name]) => name)\n .sort((left, right) => left.localeCompare(right));\n}\n\nfunction assertUniqueLocations(\n setups: Record<string, SyncSetupSettings>,\n connections: Record<string, StorageConnectionSettings>,\n) {\n const identities = new Map<string, string>();\n for (const [name, setup] of Object.entries(setups)) {\n const connection = connections[setup.storage.connection];\n if (!connection) throw new Error(`Storage connection not found: ${setup.storage.connection}`);\n const identity = effectiveSyncSetupRemoteIdentity(setup, connection);\n const previous = identities.get(identity);\n if (previous) {\n throw new Error(`Sync setup \u201C${name}\u201D duplicates the storage location of \u201C${previous}\u201D.`);\n }\n identities.set(identity, name);\n }\n}\n\nfunction sameNames(left: readonly string[], right: readonly string[]) {\n return left.length === right.length && left.every((name, index) => name === right[index]);\n}\n\nfunction sameStorageReview(left: SyncSetupStorageReview, right: SyncSetupStorageReview) {\n return (\n left.connectionName === right.connectionName &&\n left.storageKind === right.storageKind &&\n left.storagePath === right.storagePath &&\n left.bucket === right.bucket &&\n left.branch === right.branch\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA,SAAS,yBAAyB;AAa3B,IAAM,8BAAN,cAA0C,MAAM;AAAA,EACrD,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAEA,eAAsB,kBACpB,OAMA,QACA;AACA,qBAAmB,MAAM,WAAW,YAAY;AAChD,qBAAmB,MAAM,gBAAgB,oBAAoB;AAC7D,QAAM,WAA6B;AAAA,IACjC,SAAS;AAAA,IACT,iBAAiB,MAAM;AAAA,IACvB,UAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,oBAAoB,EAAE,CAAC,MAAM,cAAc,GAAG,gBAAgB,MAAM,UAAU,EAAE;AAAA,IAChF,YAAY;AAAA,MACV,CAAC,MAAM,SAAS,GAAG;AAAA,QACjB,GAAG,gBAAgB,MAAM,KAAK;AAAA,QAC9B,SAAS,EAAE,GAAG,MAAM,MAAM,SAAS,YAAY,MAAM,eAAe;AAAA,MACtE;AAAA,IACF;AAAA,EACF;AACA,SAAO,kBAAkB,CAAC,YAAY;AACpC,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AAM,WAAW,iCAAiC,OAAO,UAAU;AACnE,UAAM,WAAW,WAAW,IAAI,QAAQ;AACxC,QAAI,UAAU;AACZ,YAAM,IAAI,MAAM,oBAAe,IAAI,mDAAyC,QAAQ,SAAI;AAAA,IAC1F;AACA,eAAW,IAAI,UAAU,IAAI;AAAA,EAC/B;AACF;AAEA,SAAS,UAAU,MAAyB,OAA0B;AACpE,SAAO,KAAK,WAAW,MAAM,UAAU,KAAK,MAAM,CAAC,MAAM,UAAU,SAAS,MAAM,KAAK,CAAC;AAC1F;AAEA,SAAS,kBAAkB,MAA8B,OAA+B;AACtF,SACE,KAAK,mBAAmB,MAAM,kBAC9B,KAAK,gBAAgB,MAAM,eAC3B,KAAK,gBAAgB,MAAM,eAC3B,KAAK,WAAW,MAAM,UACtB,KAAK,WAAW,MAAM;AAE1B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// @generated by scripts/build-runtime.mjs; do not edit.
|
|
2
|
+
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
|
+
import {
|
|
4
|
+
stateDir
|
|
5
|
+
} from "./chunk-SWRVXVFD.ts";
|
|
6
|
+
|
|
7
|
+
// src/snapshot/snapshot-transaction-directory.ts
|
|
8
|
+
import fs from "node:fs/promises";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
function transactionRoot() {
|
|
11
|
+
return path.join(stateDir(), "transactions");
|
|
12
|
+
}
|
|
13
|
+
async function pendingTransactionEntries() {
|
|
14
|
+
try {
|
|
15
|
+
return await fs.readdir(transactionRoot(), { withFileTypes: true });
|
|
16
|
+
} catch (error) {
|
|
17
|
+
if (error.code === "ENOENT") return [];
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
transactionRoot,
|
|
24
|
+
pendingTransactionEntries
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=chunk-5SFMBY5P.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/snapshot/snapshot-transaction-directory.ts"],
|
|
4
|
+
"sourcesContent": ["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { stateDir } from \"../state/state-directory.js\";\n\nexport function transactionRoot() {\n return path.join(stateDir(), \"transactions\");\n}\n\nexport async function pendingTransactionEntries() {\n try {\n return await fs.readdir(transactionRoot(), { withFileTypes: true });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return [];\n throw error;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAGV,SAAS,kBAAkB;AAChC,SAAO,KAAK,KAAK,SAAS,GAAG,cAAc;AAC7C;AAEA,eAAsB,4BAA4B;AAChD,MAAI;AACF,WAAO,MAAM,GAAG,QAAQ,gBAAgB,GAAG,EAAE,eAAe,KAAK,CAAC;AAAA,EACpE,SAAS,OAAO;AACd,QAAK,MAAgC,SAAS,SAAU,QAAO,CAAC;AAChE,UAAM;AAAA,EACR;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
3
|
import {
|
|
4
4
|
mergeJournalIdentity
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BEST45H2.ts";
|
|
6
6
|
import {
|
|
7
7
|
mergePathIdentity,
|
|
8
8
|
planFileMerge
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XJHQPB3E.ts";
|
|
10
10
|
import {
|
|
11
11
|
statePathForConfig,
|
|
12
12
|
syncStateFingerprint
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DN4IA7MR.ts";
|
|
14
14
|
import {
|
|
15
15
|
syncDirectory,
|
|
16
16
|
writeJson
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-AR2DGDUI.ts";
|
|
18
18
|
|
|
19
19
|
// src/sync/conflict-artifacts.ts
|
|
20
20
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -226,4 +226,4 @@ export {
|
|
|
226
226
|
saveConflictArtifact,
|
|
227
227
|
readConflictArtifact
|
|
228
228
|
};
|
|
229
|
-
//# sourceMappingURL=chunk-
|
|
229
|
+
//# sourceMappingURL=chunk-5TSCBBPP.ts.map
|
|
@@ -4,20 +4,20 @@ import {
|
|
|
4
4
|
COUPLED_FIELDS,
|
|
5
5
|
mergeSettingsJson,
|
|
6
6
|
snapshotFile
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
scanSnapshot
|
|
10
|
-
} from "./chunk-QOFMXPM5.ts";
|
|
7
|
+
} from "./chunk-AKMV47YC.ts";
|
|
11
8
|
import {
|
|
12
9
|
edits,
|
|
13
10
|
isMergeTextPath,
|
|
14
11
|
lines,
|
|
15
12
|
text
|
|
16
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-6LD5KX55.ts";
|
|
17
14
|
import {
|
|
18
15
|
parseJsonObjectDocument,
|
|
19
16
|
parseSettingsDocument
|
|
20
17
|
} from "./chunk-ZW5ZLGBI.ts";
|
|
18
|
+
import {
|
|
19
|
+
scanSnapshot
|
|
20
|
+
} from "./chunk-ESKOPQVB.ts";
|
|
21
21
|
import {
|
|
22
22
|
AGENT_INPUT_BYTES,
|
|
23
23
|
AGENT_MAX_UNITS,
|
|
@@ -217,4 +217,4 @@ export {
|
|
|
217
217
|
parseAgentCandidate,
|
|
218
218
|
applyAgentCandidate
|
|
219
219
|
};
|
|
220
|
-
//# sourceMappingURL=chunk-
|
|
220
|
+
//# sourceMappingURL=chunk-67INJPKR.ts.map
|