@narumitw/pi-sync 0.57.9 → 0.57.10
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 +8 -0
- package/README.md +2 -0
- package/dist/chunks/{agent-candidate-GNEYR225.ts → agent-candidate-EYB35AGL.ts} +12 -9
- package/dist/chunks/{agent-plan-3L7CRFDM.ts → agent-plan-KO43GTOR.ts} +22 -18
- package/dist/chunks/{agent-plan-3L7CRFDM.ts.map → agent-plan-KO43GTOR.ts.map} +1 -1
- package/dist/chunks/{agent-refusal-retry-RPTMUQXK.ts → agent-refusal-retry-C2HQROTP.ts} +11 -8
- package/dist/chunks/{agent-refusal-retry-RPTMUQXK.ts.map → agent-refusal-retry-C2HQROTP.ts.map} +1 -1
- package/dist/chunks/{agent-store-55CZOCPX.ts → agent-store-UT52DS7B.ts} +12 -11
- package/dist/chunks/{agent-store-55CZOCPX.ts.map → agent-store-UT52DS7B.ts.map} +1 -1
- package/dist/chunks/agent-sync-VM3TXWA3.ts +22 -0
- package/dist/chunks/{chunk-6FVVRTL5.ts → chunk-2VSN3MFX.ts} +71 -63
- package/dist/chunks/{chunk-6FVVRTL5.ts.map → chunk-2VSN3MFX.ts.map} +1 -1
- package/dist/chunks/{chunk-PG7NMFP2.ts → chunk-4RLATUP4.ts} +7 -7
- package/dist/chunks/chunk-5SFMBY5P.ts +26 -0
- package/dist/chunks/chunk-5SFMBY5P.ts.map +7 -0
- package/dist/chunks/chunk-5WJQ6XOW.ts +27 -0
- package/dist/chunks/chunk-5WJQ6XOW.ts.map +7 -0
- package/dist/chunks/{chunk-GNH73BJ5.ts → chunk-66GAUVDL.ts} +7 -7
- package/dist/chunks/{chunk-UPNVIUBN.ts → chunk-73MDIVYJ.ts} +3 -3
- package/dist/chunks/{chunk-CRKTAPSL.ts → chunk-AAPAHANE.ts} +24 -29
- package/dist/chunks/chunk-AAPAHANE.ts.map +7 -0
- package/dist/chunks/{chunk-S7QS4AWK.ts → chunk-AO6EDUA6.ts} +5 -5
- package/dist/chunks/chunk-AR2DGDUI.ts +55 -0
- package/dist/chunks/chunk-AR2DGDUI.ts.map +7 -0
- package/dist/chunks/{chunk-JCH3VXIO.ts → chunk-BJXSCGQK.ts} +9 -9
- package/dist/chunks/{chunk-IWZH5KYS.ts → chunk-CDQGSZL3.ts} +7 -7
- package/dist/chunks/chunk-DFJGTVPX.ts +319 -0
- package/dist/chunks/chunk-DFJGTVPX.ts.map +7 -0
- package/dist/chunks/chunk-DO55XUNU.ts +104 -0
- package/dist/chunks/chunk-DO55XUNU.ts.map +7 -0
- package/dist/chunks/{chunk-ED3TYIVW.ts → chunk-DOJRPBQU.ts} +5 -5
- package/dist/chunks/{chunk-5QAE3G3K.ts → chunk-IMMMZUFC.ts} +6 -6
- package/dist/chunks/{chunk-B4QZBDBT.ts → chunk-JXWTEJS5.ts} +3 -3
- package/dist/chunks/{chunk-BDB4IDM3.ts → chunk-JY2RVOUL.ts} +8 -6
- package/dist/chunks/{chunk-BDB4IDM3.ts.map → chunk-JY2RVOUL.ts.map} +1 -1
- package/dist/chunks/{chunk-P7DD5PWZ.ts → chunk-M5IV3KL2.ts} +3 -3
- package/dist/chunks/{chunk-AAEEHR7H.ts → chunk-MDUORMCK.ts} +2 -2
- package/dist/chunks/{chunk-UBV24CG4.ts → chunk-MRIPZGPR.ts} +3 -3
- package/dist/chunks/{chunk-MKKF4IMY.ts → chunk-ODF2M4RF.ts} +5 -5
- package/dist/chunks/chunk-PHANBTVM.ts +348 -0
- package/dist/chunks/chunk-PHANBTVM.ts.map +7 -0
- package/dist/chunks/{chunk-GP5DU62N.ts → chunk-PWA3YN5Z.ts} +2 -2
- package/dist/chunks/{chunk-YK52VDXG.ts → chunk-QWV3XKNJ.ts} +10 -8
- package/dist/chunks/{chunk-YK52VDXG.ts.map → chunk-QWV3XKNJ.ts.map} +1 -1
- package/dist/chunks/{chunk-ORGBI36T.ts → chunk-RAMHGOX2.ts} +4 -4
- package/dist/chunks/{chunk-QO333NM4.ts → chunk-RX3WGWVL.ts} +5 -5
- package/dist/chunks/chunk-RX3WGWVL.ts.map +7 -0
- package/dist/chunks/{chunk-PQW6GS4J.ts → chunk-STVQQ5KG.ts} +12 -10
- package/dist/chunks/{chunk-PQW6GS4J.ts.map → chunk-STVQQ5KG.ts.map} +1 -1
- package/dist/chunks/{chunk-76NB4R7U.ts → chunk-TO2GMX3K.ts} +2 -2
- package/dist/chunks/{chunk-GSNPASKB.ts → chunk-U77DWNRH.ts} +6 -6
- package/dist/chunks/{chunk-U3XRI2HF.ts → chunk-UCD7TQDT.ts} +11 -11
- package/dist/chunks/{chunk-A6HU4ERM.ts → chunk-UGSSZWQ6.ts} +6 -23
- package/dist/chunks/chunk-UGSSZWQ6.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-HUZ5CR4W.ts → chunk-YZ5BQNRZ.ts} +2 -51
- package/dist/chunks/{chunk-HUZ5CR4W.ts.map → chunk-YZ5BQNRZ.ts.map} +4 -4
- package/dist/chunks/{chunk-UOHR7LRO.ts → chunk-Z5O2TLNF.ts} +9 -21
- package/dist/chunks/chunk-Z5O2TLNF.ts.map +7 -0
- package/dist/chunks/command-handler-FO6F2APH.ts +543 -0
- package/dist/chunks/command-handler-FO6F2APH.ts.map +7 -0
- package/dist/chunks/{config-KGIYTTXQ.ts → config-B37W7FXW.ts} +5 -6
- package/dist/chunks/{conflict-artifacts-FXFIIBCB.ts → conflict-artifacts-6XGSSU5S.ts} +13 -9
- package/dist/chunks/{conflict-review-3X37QEIT.ts → conflict-review-BQSHSJB3.ts} +31 -25
- package/dist/chunks/{conflict-review-3X37QEIT.ts.map → conflict-review-BQSHSJB3.ts.map} +1 -1
- package/dist/chunks/{continuous-record-SQJ47CXN.ts → continuous-record-4DQ2EAZS.ts} +8 -7
- package/dist/chunks/{continuous-sync-Q6QUD6TY.ts → continuous-sync-ZT3UEQLK.ts} +33 -28
- package/dist/chunks/{continuous-sync-Q6QUD6TY.ts.map → continuous-sync-ZT3UEQLK.ts.map} +1 -1
- package/dist/chunks/{file-selection-3JJYOVNR.ts → file-selection-FBLKM25V.ts} +12 -10
- package/dist/chunks/{file-selection-3JJYOVNR.ts.map → file-selection-FBLKM25V.ts.map} +1 -1
- package/dist/chunks/{git-backend-NYKSG5X6.ts → git-backend-7PCWECRN.ts} +16 -12
- package/dist/chunks/{git-backend-NYKSG5X6.ts.map → git-backend-7PCWECRN.ts.map} +1 -1
- package/dist/chunks/{local-fields-6DGYOOIK.ts → local-fields-B6JWLPAE.ts} +10 -5
- package/dist/chunks/manager-result-dispatcher-NODX3KKH.ts +28 -0
- package/dist/chunks/{manager-ui-ZH6DEC2G.ts → manager-ui-DGRTG76I.ts} +46 -40
- package/dist/chunks/{manager-ui-ZH6DEC2G.ts.map → manager-ui-DGRTG76I.ts.map} +1 -1
- package/dist/chunks/{merge-baseline-store-RFCAH7KL.ts → merge-baseline-store-HL3VLMAM.ts} +6 -5
- package/dist/chunks/{remote-selection-ui-YFPGYGNE.ts → remote-selection-ui-OHMIQ32X.ts} +14 -10
- package/dist/chunks/{s3-backend-F7PR5FB3.ts → s3-backend-CJXBEWWU.ts} +21 -17
- package/dist/chunks/{s3-backend-F7PR5FB3.ts.map → s3-backend-CJXBEWWU.ts.map} +1 -1
- package/dist/chunks/{setup-switch-E7PHKI6J.ts → setup-switch-66GWMBNH.ts} +6 -7
- package/dist/chunks/{setup-wizard-OVHZYXNW.ts → setup-wizard-OHZXJVQZ.ts} +8 -9
- package/dist/chunks/{setup-wizard-OVHZYXNW.ts.map → setup-wizard-OHZXJVQZ.ts.map} +1 -1
- package/dist/chunks/{snapshot-THS5EY2L.ts → snapshot-VRHNAUUH.ts} +11 -6
- package/dist/chunks/snapshot-transaction-EUGA4VX6.ts +24 -0
- package/dist/chunks/sync-inspection-4WFQEJOE.ts +25 -0
- package/dist/chunks/sync-inspection-4WFQEJOE.ts.map +7 -0
- package/dist/chunks/{sync-operations-Y72GNIQ2.ts → sync-operations-X4AOXMBT.ts} +66 -57
- package/dist/chunks/{sync-operations-Y72GNIQ2.ts.map → sync-operations-X4AOXMBT.ts.map} +1 -1
- package/dist/chunks/{sync-state-CFL4RRRB.ts → sync-state-SWLSMK4G.ts} +9 -5
- package/dist/chunks/sync-state-SWLSMK4G.ts.map +7 -0
- package/dist/chunks/{webdav-backend-TGFUH3SF.ts → webdav-backend-2Q5ZEBST.ts} +16 -12
- package/dist/chunks/{webdav-backend-TGFUH3SF.ts.map → webdav-backend-2Q5ZEBST.ts.map} +1 -1
- package/dist/index.ts +54 -537
- package/dist/index.ts.map +3 -3
- package/package.json +2 -2
- package/src/settings/config.ts +1 -1
- package/src/settings/settings-validation.ts +1 -1
- package/src/snapshot/snapshot-transaction-directory.ts +16 -0
- package/src/snapshot/snapshot-transaction.ts +1 -12
- 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/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/dist/chunks/chunk-A6HU4ERM.ts.map +0 -7
- package/dist/chunks/chunk-CRKTAPSL.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/sync-inspection-J25EEKZK.ts +0 -21
- /package/dist/chunks/{agent-candidate-GNEYR225.ts.map → agent-candidate-EYB35AGL.ts.map} +0 -0
- /package/dist/chunks/{config-KGIYTTXQ.ts.map → agent-sync-VM3TXWA3.ts.map} +0 -0
- /package/dist/chunks/{chunk-PG7NMFP2.ts.map → chunk-4RLATUP4.ts.map} +0 -0
- /package/dist/chunks/{chunk-GNH73BJ5.ts.map → chunk-66GAUVDL.ts.map} +0 -0
- /package/dist/chunks/{chunk-UPNVIUBN.ts.map → chunk-73MDIVYJ.ts.map} +0 -0
- /package/dist/chunks/{chunk-S7QS4AWK.ts.map → chunk-AO6EDUA6.ts.map} +0 -0
- /package/dist/chunks/{chunk-JCH3VXIO.ts.map → chunk-BJXSCGQK.ts.map} +0 -0
- /package/dist/chunks/{chunk-IWZH5KYS.ts.map → chunk-CDQGSZL3.ts.map} +0 -0
- /package/dist/chunks/{chunk-ED3TYIVW.ts.map → chunk-DOJRPBQU.ts.map} +0 -0
- /package/dist/chunks/{chunk-5QAE3G3K.ts.map → chunk-IMMMZUFC.ts.map} +0 -0
- /package/dist/chunks/{chunk-B4QZBDBT.ts.map → chunk-JXWTEJS5.ts.map} +0 -0
- /package/dist/chunks/{chunk-P7DD5PWZ.ts.map → chunk-M5IV3KL2.ts.map} +0 -0
- /package/dist/chunks/{chunk-AAEEHR7H.ts.map → chunk-MDUORMCK.ts.map} +0 -0
- /package/dist/chunks/{chunk-UBV24CG4.ts.map → chunk-MRIPZGPR.ts.map} +0 -0
- /package/dist/chunks/{chunk-MKKF4IMY.ts.map → chunk-ODF2M4RF.ts.map} +0 -0
- /package/dist/chunks/{chunk-GP5DU62N.ts.map → chunk-PWA3YN5Z.ts.map} +0 -0
- /package/dist/chunks/{chunk-ORGBI36T.ts.map → chunk-RAMHGOX2.ts.map} +0 -0
- /package/dist/chunks/{chunk-76NB4R7U.ts.map → chunk-TO2GMX3K.ts.map} +0 -0
- /package/dist/chunks/{chunk-GSNPASKB.ts.map → chunk-U77DWNRH.ts.map} +0 -0
- /package/dist/chunks/{chunk-U3XRI2HF.ts.map → chunk-UCD7TQDT.ts.map} +0 -0
- /package/dist/chunks/{conflict-artifacts-FXFIIBCB.ts.map → config-B37W7FXW.ts.map} +0 -0
- /package/dist/chunks/{continuous-record-SQJ47CXN.ts.map → conflict-artifacts-6XGSSU5S.ts.map} +0 -0
- /package/dist/chunks/{local-fields-6DGYOOIK.ts.map → continuous-record-4DQ2EAZS.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-HOCM2GDA.ts.map → local-fields-B6JWLPAE.ts.map} +0 -0
- /package/dist/chunks/{merge-baseline-store-RFCAH7KL.ts.map → manager-result-dispatcher-NODX3KKH.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-YFPGYGNE.ts.map → merge-baseline-store-HL3VLMAM.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-E7PHKI6J.ts.map → remote-selection-ui-OHMIQ32X.ts.map} +0 -0
- /package/dist/chunks/{snapshot-THS5EY2L.ts.map → setup-switch-66GWMBNH.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-J25EEKZK.ts.map → snapshot-VRHNAUUH.ts.map} +0 -0
- /package/dist/chunks/{sync-state-CFL4RRRB.ts.map → snapshot-transaction-EUGA4VX6.ts.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @narumitw/pi-sync
|
|
2
2
|
|
|
3
|
+
## 0.57.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
- Updated dependencies [4f79c28]
|
|
9
|
+
- @narumitw/pi-tui-kit@0.69.1
|
|
10
|
+
|
|
3
11
|
## 0.57.9
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -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.
|
|
@@ -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-IMMMZUFC.ts";
|
|
9
|
+
import "./chunk-AO6EDUA6.ts";
|
|
10
|
+
import "./chunk-CDQGSZL3.ts";
|
|
13
11
|
import "./chunk-ZW5ZLGBI.ts";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-TO2GMX3K.ts";
|
|
13
|
+
import "./chunk-73MDIVYJ.ts";
|
|
16
14
|
import "./chunk-SWRVXVFD.ts";
|
|
17
15
|
import "./chunk-2JZFHNLM.ts";
|
|
18
16
|
import "./chunk-T2SJD3N7.ts";
|
|
19
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-PHANBTVM.ts";
|
|
18
|
+
import "./chunk-DFJGTVPX.ts";
|
|
19
|
+
import "./chunk-DO55XUNU.ts";
|
|
20
|
+
import "./chunk-AR2DGDUI.ts";
|
|
21
|
+
import "./chunk-YZ5BQNRZ.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-EYB35AGL.ts.map
|
|
@@ -3,41 +3,45 @@
|
|
|
3
3
|
import {
|
|
4
4
|
fileHashMap,
|
|
5
5
|
sameHashes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JY2RVOUL.ts";
|
|
7
7
|
import {
|
|
8
8
|
AgentResolutionRequired
|
|
9
9
|
} from "./chunk-3ST7RSYN.ts";
|
|
10
|
+
import "./chunk-UGSSZWQ6.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-RX3WGWVL.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-IMMMZUFC.ts";
|
|
20
|
+
import "./chunk-AO6EDUA6.ts";
|
|
27
21
|
import {
|
|
28
22
|
readMergeAncestors
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-76NB4R7U.ts";
|
|
23
|
+
} from "./chunk-CDQGSZL3.ts";
|
|
31
24
|
import "./chunk-ZW5ZLGBI.ts";
|
|
32
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-TO2GMX3K.ts";
|
|
33
26
|
import {
|
|
34
27
|
readStateForConfig,
|
|
35
28
|
syncStateFingerprint
|
|
36
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-73MDIVYJ.ts";
|
|
37
30
|
import "./chunk-SWRVXVFD.ts";
|
|
38
31
|
import "./chunk-2JZFHNLM.ts";
|
|
39
32
|
import "./chunk-T2SJD3N7.ts";
|
|
40
|
-
import
|
|
33
|
+
import {
|
|
34
|
+
createSnapshot
|
|
35
|
+
} from "./chunk-PHANBTVM.ts";
|
|
36
|
+
import "./chunk-DFJGTVPX.ts";
|
|
37
|
+
import "./chunk-DO55XUNU.ts";
|
|
38
|
+
import "./chunk-AR2DGDUI.ts";
|
|
39
|
+
import "./chunk-YZ5BQNRZ.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-KO43GTOR.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,iB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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-RX3WGWVL.ts";
|
|
17
|
+
import "./chunk-X7R6DCVF.ts";
|
|
17
18
|
import "./chunk-PWMWOJP4.ts";
|
|
18
|
-
import "./chunk-QOFMXPM5.ts";
|
|
19
|
-
import "./chunk-ZW5ZLGBI.ts";
|
|
20
19
|
import "./chunk-SWRVXVFD.ts";
|
|
21
20
|
import "./chunk-2JZFHNLM.ts";
|
|
22
21
|
import "./chunk-T2SJD3N7.ts";
|
|
23
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-PHANBTVM.ts";
|
|
23
|
+
import "./chunk-DFJGTVPX.ts";
|
|
24
|
+
import "./chunk-DO55XUNU.ts";
|
|
25
|
+
import "./chunk-AR2DGDUI.ts";
|
|
26
|
+
import "./chunk-YZ5BQNRZ.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-C2HQROTP.ts.map
|
package/dist/chunks/{agent-refusal-retry-RPTMUQXK.ts.map → agent-refusal-retry-C2HQROTP.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": ";;;;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-2,16 +2,9 @@
|
|
|
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-MDUORMCK.ts";
|
|
10
6
|
import "./chunk-PWMWOJP4.ts";
|
|
11
|
-
import
|
|
12
|
-
AGENT_OUTPUT_BYTES
|
|
13
|
-
} from "./chunk-PRUEIIK7.ts";
|
|
14
|
-
import "./chunk-UPNVIUBN.ts";
|
|
7
|
+
import "./chunk-73MDIVYJ.ts";
|
|
15
8
|
import {
|
|
16
9
|
LOCKFILE_FS_ADAPTER,
|
|
17
10
|
LOCK_GUARD_STALE_MS,
|
|
@@ -22,7 +15,15 @@ import "./chunk-2JZFHNLM.ts";
|
|
|
22
15
|
import "./chunk-T2SJD3N7.ts";
|
|
23
16
|
import {
|
|
24
17
|
writeJson
|
|
25
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-AR2DGDUI.ts";
|
|
19
|
+
import "./chunk-YZ5BQNRZ.ts";
|
|
20
|
+
import {
|
|
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-UT52DS7B.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,KAAK,IAAI,MAAM;AACvB,QAAM,GAAG,MAAM,MAAM,EAAE,MAAM,IAAM,CAAC;AACtC;AACA,eAAe,iBAAiB;AAC9B,QAAM,OAAO,MAAM,GAAG,MAAM,MAAM,EAAE,IAAI;AACxC,MAAI,CAAC,KAAK,YAAY,KAAK,KAAK,eAAe,KAAM,QAAQ,aAAa,WAAW,KAAK,OAAO;AAC/F,UAAM,IAAI,MAAM,qDAAqD;AACzE;AACA,eAAe,YAAY,MAAgC;AACzD,MAAI;AACF,UAAM,eAAe;AACrB,UAAM,OAAO,MAAM,GAAG,MAAM,IAAI;AAChC,QACE,CAAC,KAAK,OAAO,KACb,KAAK,eAAe,KACpB,KAAK,UAAU,KACf,KAAK,OAAO,qBAAqB,KAChC,QAAQ,aAAa,WAAW,KAAK,OAAO;AAE7C,YAAM,IAAI,MAAM,kDAAkD;AACpE,WAAO,KAAK,MAAM,MAAM,GAAG,SAAS,MAAM,MAAM,CAAC;AAAA,EACnD,SAAS,OAAO;AACd,QAAK,MAAgC,SAAS,SAAU,QAAO;AAC/D,UAAM,IAAI,MAAM,sDAAsD;AAAA,EACxE;AACF;AACA,eAAe,YAAwC;AACrD,QAAM,QAAQ,MAAM,YAAY,MAAM,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A,WACA,UACA;AACA,QAAM,WAAW,KAAK,UAAU,QAAQ;AACxC,MAAI,CAAC,SAAS,QAAQ,KAAK,CAAC,QAAQ,YAAY,GAAG,KAAK,UAAU,QAAQ,KAAK,CAAC,QAAQ,YAAY,GAAG;AACrG,UAAM,IAAI,MAAM,sEAAsE;AACxF,QAAM,SAAS,cAAc,GAAG;AAChC,QAAM,iBAAiB,YAAY;AACjC,QAAI,KAAK,UAAU,MAAM,YAAY,MAAM,CAAC,MAAM;AAChD,YAAM,IAAI,MAAM,mEAAmE;AACrF,UAAM,SAAS;AAAA,EACjB;AACA,QAAM,eAAe;AACrB,QAAM,SAAS,WAAW,QAAQ,EAAE,OAAO,QAAQ,EAAE,OAAO,KAAK;AACjE,QAAM,UAAU,KAAK,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-ODF2M4RF.ts";
|
|
6
|
+
import "./chunk-3ST7RSYN.ts";
|
|
7
|
+
import "./chunk-K3RIEL6J.ts";
|
|
8
|
+
import "./chunk-MDUORMCK.ts";
|
|
9
|
+
import "./chunk-PWMWOJP4.ts";
|
|
10
|
+
import "./chunk-73MDIVYJ.ts";
|
|
11
|
+
import "./chunk-SWRVXVFD.ts";
|
|
12
|
+
import "./chunk-2JZFHNLM.ts";
|
|
13
|
+
import "./chunk-T2SJD3N7.ts";
|
|
14
|
+
import "./chunk-AR2DGDUI.ts";
|
|
15
|
+
import "./chunk-YZ5BQNRZ.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-VM3TXWA3.ts.map
|
|
@@ -1,49 +1,51 @@
|
|
|
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
|
-
formatRemoteSelectionStatus,
|
|
5
|
-
readSnapshotForHead,
|
|
6
|
-
requireCompatibleRemoteSelection
|
|
7
|
-
} from "./chunk-YK52VDXG.ts";
|
|
8
|
-
import {
|
|
9
|
-
createSyncBackend
|
|
10
|
-
} from "./chunk-ORGBI36T.ts";
|
|
11
|
-
import {
|
|
12
|
-
confirmMergeReview
|
|
13
|
-
} from "./chunk-KHBPED6W.ts";
|
|
14
3
|
import {
|
|
15
4
|
conflictArtifactFingerprint,
|
|
16
5
|
conflictDirectory,
|
|
17
6
|
conflictGroups,
|
|
18
7
|
readConflictArtifact,
|
|
19
8
|
saveConflictArtifact
|
|
20
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DOJRPBQU.ts";
|
|
21
10
|
import {
|
|
22
11
|
clearMergeJournal,
|
|
23
12
|
mergeJournalIdentity,
|
|
24
13
|
readMergeJournal,
|
|
25
14
|
writeMergeJournal
|
|
26
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-66GAUVDL.ts";
|
|
27
16
|
import {
|
|
28
17
|
fileHashMap,
|
|
29
18
|
hasLocalChanges,
|
|
30
19
|
hasRemoteChanges,
|
|
31
20
|
sameHashes,
|
|
32
21
|
syncPolicyChanged
|
|
33
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-JY2RVOUL.ts";
|
|
34
23
|
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} from "./chunk-
|
|
24
|
+
formatRemoteSelectionStatus,
|
|
25
|
+
readSnapshotForHead,
|
|
26
|
+
requireCompatibleRemoteSelection
|
|
27
|
+
} from "./chunk-QWV3XKNJ.ts";
|
|
39
28
|
import {
|
|
40
|
-
|
|
41
|
-
} from "./chunk-
|
|
29
|
+
createSyncBackend
|
|
30
|
+
} from "./chunk-RAMHGOX2.ts";
|
|
31
|
+
import {
|
|
32
|
+
confirmMergeReview
|
|
33
|
+
} from "./chunk-KHBPED6W.ts";
|
|
42
34
|
import {
|
|
43
35
|
backupLocal,
|
|
44
|
-
captureMutationOwner,
|
|
45
36
|
protectedSessionPaths
|
|
46
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-Z5O2TLNF.ts";
|
|
38
|
+
import {
|
|
39
|
+
overlayLocalFields,
|
|
40
|
+
portableSnapshot,
|
|
41
|
+
sameLocalFields
|
|
42
|
+
} from "./chunk-UGSSZWQ6.ts";
|
|
43
|
+
import {
|
|
44
|
+
createStartupTimings
|
|
45
|
+
} from "./chunk-M6VQJIOU.ts";
|
|
46
|
+
import {
|
|
47
|
+
captureMutationOwner
|
|
48
|
+
} from "./chunk-5WJQ6XOW.ts";
|
|
47
49
|
import {
|
|
48
50
|
safeTerminalText,
|
|
49
51
|
snapshotPathLabel
|
|
@@ -55,42 +57,17 @@ import {
|
|
|
55
57
|
loadConfig,
|
|
56
58
|
syncCheckConfigFingerprint,
|
|
57
59
|
syncConfigReviewIdentity
|
|
58
|
-
} from "./chunk-
|
|
59
|
-
import {
|
|
60
|
-
overlayLocalFields,
|
|
61
|
-
portableSnapshot,
|
|
62
|
-
sameLocalFields
|
|
63
|
-
} from "./chunk-A6HU4ERM.ts";
|
|
60
|
+
} from "./chunk-RX3WGWVL.ts";
|
|
64
61
|
import {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
expectedRemoteHead
|
|
70
|
-
} from "./chunk-YDVQYUHE.ts";
|
|
62
|
+
applySnapshotTransaction,
|
|
63
|
+
recoverPendingSnapshotTransactions,
|
|
64
|
+
syncMutationParents
|
|
65
|
+
} from "./chunk-AAPAHANE.ts";
|
|
71
66
|
import {
|
|
72
67
|
mergeAcceptedSettingsPackages,
|
|
73
68
|
mergeSettingsJson,
|
|
74
69
|
resolveContentConflicts
|
|
75
|
-
} from "./chunk-
|
|
76
|
-
import {
|
|
77
|
-
agentDir,
|
|
78
|
-
createSnapshot,
|
|
79
|
-
effectiveSessionRoot,
|
|
80
|
-
filterSnapshotForConfigPolicy,
|
|
81
|
-
includeFromSelectionConfig,
|
|
82
|
-
inspectRemoteSelection,
|
|
83
|
-
isSessionFilePath,
|
|
84
|
-
isSessionPath,
|
|
85
|
-
mergeRemotePreservedFiles,
|
|
86
|
-
regenerateSnapshotIdentity,
|
|
87
|
-
requireStableMergeSessionRoot,
|
|
88
|
-
scanSnapshot,
|
|
89
|
-
sessionStorageRoot,
|
|
90
|
-
snapshotIncludesSessions,
|
|
91
|
-
snapshotOptionsForContext,
|
|
92
|
-
snapshotTarget
|
|
93
|
-
} from "./chunk-QOFMXPM5.ts";
|
|
70
|
+
} from "./chunk-AO6EDUA6.ts";
|
|
94
71
|
import {
|
|
95
72
|
TEXT_MERGE_WORK_LIMIT,
|
|
96
73
|
hasCurrentMergeBaseline,
|
|
@@ -98,29 +75,60 @@ import {
|
|
|
98
75
|
readMergeAncestor,
|
|
99
76
|
readMergeAncestors,
|
|
100
77
|
stageMergeBaseline
|
|
101
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-CDQGSZL3.ts";
|
|
102
79
|
import {
|
|
103
80
|
mergePathIdentity,
|
|
104
81
|
planFileMerge
|
|
105
|
-
} from "./chunk-
|
|
106
|
-
import {
|
|
107
|
-
startupTransferEnabled
|
|
108
|
-
} from "./chunk-PRUEIIK7.ts";
|
|
82
|
+
} from "./chunk-TO2GMX3K.ts";
|
|
109
83
|
import {
|
|
110
84
|
readStateForConfig,
|
|
111
85
|
statePathForConfig,
|
|
112
86
|
syncStateFingerprint,
|
|
113
87
|
writeStateForConfig
|
|
114
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-73MDIVYJ.ts";
|
|
89
|
+
import {
|
|
90
|
+
createSnapshot,
|
|
91
|
+
filterSnapshotForConfigPolicy,
|
|
92
|
+
isSessionFilePath,
|
|
93
|
+
isSessionPath,
|
|
94
|
+
mergeRemotePreservedFiles,
|
|
95
|
+
regenerateSnapshotIdentity,
|
|
96
|
+
scanSnapshot,
|
|
97
|
+
snapshotIncludesSessions,
|
|
98
|
+
snapshotTarget
|
|
99
|
+
} from "./chunk-PHANBTVM.ts";
|
|
100
|
+
import {
|
|
101
|
+
includeFromSelectionConfig,
|
|
102
|
+
inspectRemoteSelection
|
|
103
|
+
} from "./chunk-DFJGTVPX.ts";
|
|
104
|
+
import {
|
|
105
|
+
agentDir,
|
|
106
|
+
effectiveSessionRoot,
|
|
107
|
+
requireStableMergeSessionRoot,
|
|
108
|
+
sessionStorageRoot,
|
|
109
|
+
snapshotOptionsForContext
|
|
110
|
+
} from "./chunk-DO55XUNU.ts";
|
|
111
|
+
import {
|
|
112
|
+
syncDirectory
|
|
113
|
+
} from "./chunk-AR2DGDUI.ts";
|
|
115
114
|
import {
|
|
116
115
|
assertWithinRoot,
|
|
117
116
|
isDeniedPath,
|
|
118
117
|
isPathInside,
|
|
119
118
|
parentPaths,
|
|
120
119
|
safeJoin,
|
|
121
|
-
syncDirectory,
|
|
122
120
|
toPosix
|
|
123
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-YZ5BQNRZ.ts";
|
|
122
|
+
import {
|
|
123
|
+
ContinuousError
|
|
124
|
+
} from "./chunk-DT7M4VQS.ts";
|
|
125
|
+
import {
|
|
126
|
+
SyncBackendConflictError,
|
|
127
|
+
expectedRemoteHead
|
|
128
|
+
} from "./chunk-YDVQYUHE.ts";
|
|
129
|
+
import {
|
|
130
|
+
startupTransferEnabled
|
|
131
|
+
} from "./chunk-PRUEIIK7.ts";
|
|
124
132
|
|
|
125
133
|
// src/ui/merged-sync-summary.ts
|
|
126
134
|
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
@@ -1467,7 +1475,7 @@ async function mergeSync(ctx, options, factory = createSyncBackend, resolution)
|
|
|
1467
1475
|
await validate();
|
|
1468
1476
|
}
|
|
1469
1477
|
if (config.agentMode && !resolution) {
|
|
1470
|
-
const { resolveAgentPlan } = await import("./agent-plan-
|
|
1478
|
+
const { resolveAgentPlan } = await import("./agent-plan-KO43GTOR.ts");
|
|
1471
1479
|
await validate();
|
|
1472
1480
|
plan = await resolveAgentPlan(
|
|
1473
1481
|
ctx,
|
|
@@ -1977,4 +1985,4 @@ export {
|
|
|
1977
1985
|
createSyncDecision,
|
|
1978
1986
|
mergeSync
|
|
1979
1987
|
};
|
|
1980
|
-
//# sourceMappingURL=chunk-
|
|
1988
|
+
//# sourceMappingURL=chunk-2VSN3MFX.ts.map
|