@narumitw/pi-sync 0.67.2 → 0.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +29 -49
- package/dist/chunks/{chunk-XUZV4OGI.ts → chunk-335XTMMZ.ts} +3 -2
- package/dist/chunks/{chunk-XUZV4OGI.ts.map → chunk-335XTMMZ.ts.map} +2 -2
- package/dist/chunks/{chunk-PUSMSKIM.ts → chunk-AYGMIMCV.ts} +2 -11
- package/dist/chunks/chunk-AYGMIMCV.ts.map +7 -0
- package/dist/chunks/{chunk-2MSJDLSM.ts → chunk-BCDBT4X3.ts} +7 -7
- package/dist/chunks/{chunk-GRXNUC6O.ts → chunk-FQKWGVMA.ts} +20 -54
- package/dist/chunks/chunk-FQKWGVMA.ts.map +7 -0
- package/dist/chunks/{chunk-DGVZYS7T.ts → chunk-FR6A7ASZ.ts} +8 -11
- package/dist/chunks/chunk-FR6A7ASZ.ts.map +7 -0
- package/dist/chunks/{chunk-3NS4PMCI.ts → chunk-J52GYZO6.ts} +2 -8
- package/dist/chunks/{chunk-3NS4PMCI.ts.map → chunk-J52GYZO6.ts.map} +2 -2
- package/dist/chunks/{chunk-2MUAR5GH.ts → chunk-KAIVTJIQ.ts} +7 -10
- package/dist/chunks/chunk-KAIVTJIQ.ts.map +7 -0
- package/dist/chunks/{chunk-WBIOSK76.ts → chunk-R7PN3KIY.ts} +1 -2
- package/dist/chunks/{chunk-3Q3DMMID.ts → chunk-TLYT6HVI.ts} +8 -8
- package/dist/chunks/{chunk-UF2HU2NM.ts → chunk-WCGLU526.ts} +39 -118
- package/dist/chunks/chunk-WCGLU526.ts.map +7 -0
- package/dist/chunks/{chunk-JREGWM2B.ts → chunk-XNUARYLR.ts} +1 -2
- package/dist/chunks/{chunk-C3E75DXW.ts → chunk-YV2R5SJU.ts} +73 -85
- package/dist/chunks/chunk-YV2R5SJU.ts.map +7 -0
- package/dist/chunks/{command-handler-HWRPH3K3.ts → command-handler-S6BRZMPW.ts} +117 -69
- package/dist/chunks/command-handler-S6BRZMPW.ts.map +7 -0
- package/dist/chunks/{conflict-review-OBBBSVQD.ts → conflict-review-3XMYDJIK.ts} +2 -2
- package/dist/chunks/{file-selection-GASCVN45.ts → file-selection-4BOQBXS7.ts} +10 -17
- package/dist/chunks/file-selection-4BOQBXS7.ts.map +7 -0
- package/dist/chunks/{manager-result-dispatcher-MJ6G2CEI.ts → manager-result-dispatcher-A4IWLS4J.ts} +7 -7
- package/dist/chunks/{manager-ui-Z3B5ZTA6.ts → manager-ui-KHMCSLLV.ts} +114 -581
- package/dist/chunks/manager-ui-KHMCSLLV.ts.map +7 -0
- package/dist/chunks/{chunk-ECUCXF5Y.ts → merge-review-LWMUE5IW.ts} +2 -3
- package/dist/chunks/{remote-selection-ui-34WC7OFE.ts → remote-selection-ui-F6NJBQ3Y.ts} +6 -6
- package/dist/chunks/{setup-switch-JZDFQPVW.ts → setup-switch-7LMIRMZ7.ts} +6 -6
- package/dist/chunks/{setup-wizard-YOXLXLBY.ts → setup-wizard-2NRPR433.ts} +11 -16
- package/dist/chunks/{setup-wizard-YOXLXLBY.ts.map → setup-wizard-2NRPR433.ts.map} +1 -1
- package/dist/chunks/{sync-inspection-NIITROKS.ts → sync-inspection-QGM54YCM.ts} +5 -5
- package/dist/chunks/{sync-operations-FFI4ZZQL.ts → sync-operations-DTQMKVRQ.ts} +2 -2
- package/dist/daemon/dist/build-id.json +1 -0
- package/dist/daemon/dist/build-version.js +24 -4
- package/dist/daemon/dist/cli.js +51 -67
- package/dist/daemon/dist/client-transport.js +15 -5
- package/dist/daemon/dist/client.js +2 -10
- package/dist/daemon/dist/consent.js +13 -126
- package/dist/daemon/dist/daemon-startup.js +135 -30
- package/dist/daemon/dist/daemon-status.js +56 -0
- package/dist/daemon/dist/engine/backends/git/git-backend.js +4 -17
- package/dist/daemon/dist/engine/backends/git/git-storage.js +11 -44
- package/dist/daemon/dist/engine/backends/s3/s3-backend.js +6 -6
- package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +6 -6
- package/dist/daemon/dist/engine/settings/config.js +16 -149
- package/dist/daemon/dist/engine/settings/retired-ignore-policy.js +16 -0
- package/dist/daemon/dist/engine/settings/retired-ignore-recovery.js +14 -0
- package/dist/daemon/dist/engine/settings/settings-management.js +2 -10
- package/dist/daemon/dist/engine/settings/settings-validation.js +8 -21
- package/dist/daemon/dist/engine/snapshot/session-paths.js +13 -41
- package/dist/daemon/dist/engine/snapshot/snapshot-apply.js +8 -24
- package/dist/daemon/dist/engine/snapshot/snapshot-codec.js +7 -11
- package/dist/daemon/dist/engine/snapshot/snapshot-exclude-safety.js +19 -76
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction-images.js +1 -7
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction-policy.js +8 -102
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction.js +20 -100
- package/dist/daemon/dist/engine/snapshot/snapshot-types.js +1 -11
- package/dist/daemon/dist/engine/snapshot/snapshot.js +26 -78
- package/dist/daemon/dist/engine/state/sync-state-store.js +5 -1
- package/dist/daemon/dist/engine/sync/agent-plan.js +0 -1
- package/dist/daemon/dist/engine/sync/agent-policy.js +1 -1
- package/dist/daemon/dist/engine/sync/conflict-review.js +0 -2
- package/dist/daemon/dist/engine/sync/continuous-sync.js +2 -17
- package/dist/daemon/dist/engine/sync/continuous-watch.js +3 -7
- package/dist/daemon/dist/engine/sync/directional-action.js +3 -21
- package/dist/daemon/dist/engine/sync/initialization.js +4 -15
- package/dist/daemon/dist/engine/sync/local-fields.js +4 -65
- package/dist/daemon/dist/engine/sync/merge-apply.js +8 -31
- package/dist/daemon/dist/engine/sync/merge-journal.js +8 -118
- package/dist/daemon/dist/engine/sync/merged-sync.js +13 -70
- package/dist/daemon/dist/engine/sync/push-review.js +1 -16
- package/dist/daemon/dist/engine/sync/remote-snapshot.js +48 -65
- package/dist/daemon/dist/engine/sync/startup-bootstrap.js +3 -3
- package/dist/daemon/dist/engine/sync/sync-error-guidance.js +1 -1
- package/dist/daemon/dist/engine/sync/sync-inspection.js +1 -2
- package/dist/daemon/dist/engine/sync/sync-mutations.js +26 -118
- package/dist/daemon/dist/engine/sync/sync-policy.js +26 -150
- package/dist/daemon/dist/engine/sync/sync-queries.js +1 -8
- package/dist/daemon/dist/engine/sync/sync-rollback.js +12 -50
- package/dist/daemon/dist/engine/sync/sync-state.js +2 -15
- package/dist/daemon/dist/engine/sync/transfer-freshness.js +7 -17
- package/dist/daemon/dist/engine/sync/transfer-size-limits.js +3 -7
- package/dist/daemon/dist/engine-service.js +62 -205
- package/dist/daemon/dist/foreground-queue-outcome.js +0 -4
- package/dist/daemon/dist/index.js +2 -0
- package/dist/daemon/dist/legacy-consent-guard.js +34 -0
- package/dist/daemon/dist/server.js +99 -11
- package/dist/daemon/dist/service-host.js +3 -9
- package/dist/daemon/package.json +1 -1
- package/dist/index.ts +49 -49
- package/dist/index.ts.map +3 -3
- package/docs/agent-continuous-hardening.md +2 -0
- package/docs/continuous-sync-verification.md +1 -1
- package/docs/daemon-migration.md +17 -15
- package/docs/tui-contract.md +4 -6
- package/package.json +2 -3
- package/skills/configure-pi-sync/SKILL.md +23 -78
- package/skills/configure-pi-sync/references/configuration.md +59 -76
- package/src/commands/command-execution.ts +15 -38
- package/src/commands/command-handler.ts +0 -4
- package/src/commands/command.ts +2 -1
- package/src/daemon/daemon-status-ui.ts +64 -0
- package/src/daemon/directional-recovery.ts +4 -33
- package/src/daemon/pi-client.ts +87 -94
- package/src/settings/config.ts +0 -1
- package/src/sync/setup-switch.ts +1 -4
- package/src/sync-extension.ts +14 -27
- package/src/ui/cancellable-operation.ts +2 -13
- package/src/ui/excluded-paths-ui.ts +1 -4
- package/src/ui/file-selection.ts +0 -5
- package/src/ui/manager-state.ts +12 -75
- package/src/ui/manager-ui.ts +7 -96
- package/src/ui/remote-selection-ui.ts +29 -130
- package/src/ui/settings-ui.ts +169 -388
- package/src/ui/setup/setup-actions.ts +4 -16
- package/src/ui/setup/setup-prompts.ts +12 -49
- package/src/ui/setup/setup-switcher.ts +8 -14
- package/src/ui/storage-connections-ui.ts +21 -32
- package/src/ui/sync-setups-ui.ts +27 -53
- package/dist/chunks/chunk-2MUAR5GH.ts.map +0 -7
- package/dist/chunks/chunk-C3E75DXW.ts.map +0 -7
- package/dist/chunks/chunk-DGVZYS7T.ts.map +0 -7
- package/dist/chunks/chunk-EJDDRS6O.ts +0 -17
- package/dist/chunks/chunk-EJDDRS6O.ts.map +0 -7
- package/dist/chunks/chunk-GRXNUC6O.ts.map +0 -7
- package/dist/chunks/chunk-I72HGZJJ.ts +0 -106
- package/dist/chunks/chunk-I72HGZJJ.ts.map +0 -7
- package/dist/chunks/chunk-KNEUL4XN.ts +0 -30
- package/dist/chunks/chunk-KNEUL4XN.ts.map +0 -7
- package/dist/chunks/chunk-PUSMSKIM.ts.map +0 -7
- package/dist/chunks/chunk-UF2HU2NM.ts.map +0 -7
- package/dist/chunks/chunk-WFBHWYI6.ts +0 -18
- package/dist/chunks/chunk-WFBHWYI6.ts.map +0 -7
- package/dist/chunks/command-handler-HWRPH3K3.ts.map +0 -7
- package/dist/chunks/config-P54GGMXY.ts +0 -39
- package/dist/chunks/continuous-record-3SKJ6I3V.ts +0 -23
- package/dist/chunks/continuous-record-3SKJ6I3V.ts.map +0 -7
- package/dist/chunks/continuous-storage-3EU6I7Z3.ts +0 -27
- package/dist/chunks/continuous-storage-3EU6I7Z3.ts.map +0 -7
- package/dist/chunks/file-selection-GASCVN45.ts.map +0 -7
- package/dist/chunks/ignore-file-ui-5BWA6LBC.ts +0 -21
- package/dist/chunks/manager-ui-Z3B5ZTA6.ts.map +0 -7
- package/dist/chunks/merge-review-C2KETZKY.ts +0 -11
- package/dist/chunks/merge-review-C2KETZKY.ts.map +0 -7
- package/dist/chunks/remote-selection-ui-34WC7OFE.ts.map +0 -7
- package/dist/chunks/setup-switch-JZDFQPVW.ts.map +0 -7
- package/dist/daemon/dist/engine/ignore/adoption-journal.js +0 -146
- package/dist/daemon/dist/engine/ignore/effective-ignore-policy.js +0 -33
- package/dist/daemon/dist/engine/ignore/ignore-edit.js +0 -102
- package/dist/daemon/dist/engine/ignore/ignore-initialization.js +0 -288
- package/dist/daemon/dist/engine/ignore/ignore-migration-prompt.js +0 -139
- package/dist/daemon/dist/engine/ignore/ignore-settings.js +0 -391
- package/dist/daemon/dist/engine/ignore/ignore-source.js +0 -250
- package/dist/daemon/dist/engine/ignore/snapshot-ignore-rules.js +0 -39
- package/dist/daemon/dist/engine/sync/ignore-adoption-recovery.js +0 -50
- package/dist/daemon/dist/engine/sync/ignore-adoption.js +0 -416
- package/dist/daemon/dist/engine/sync/ignore-publication.js +0 -23
- package/dist/daemon/dist/engine/ui/ignore-rule-preview.js +0 -18
- package/dist/daemon/dist/monitor.js +0 -344
- package/src/ui/agent-mode-setting.ts +0 -99
- package/src/ui/ignore-file-guidance.ts +0 -7
- package/src/ui/ignore-file-ui.ts +0 -105
- package/src/ui/ignore-migration-prompt.ts +0 -65
- package/src/ui/settings-review.ts +0 -26
- /package/dist/chunks/{chunk-2MSJDLSM.ts.map → chunk-BCDBT4X3.ts.map} +0 -0
- /package/dist/chunks/{chunk-WBIOSK76.ts.map → chunk-R7PN3KIY.ts.map} +0 -0
- /package/dist/chunks/{chunk-3Q3DMMID.ts.map → chunk-TLYT6HVI.ts.map} +0 -0
- /package/dist/chunks/{chunk-JREGWM2B.ts.map → chunk-XNUARYLR.ts.map} +0 -0
- /package/dist/chunks/{conflict-review-OBBBSVQD.ts.map → conflict-review-3XMYDJIK.ts.map} +0 -0
- /package/dist/chunks/{config-P54GGMXY.ts.map → manager-result-dispatcher-A4IWLS4J.ts.map} +0 -0
- /package/dist/chunks/{chunk-ECUCXF5Y.ts.map → merge-review-LWMUE5IW.ts.map} +0 -0
- /package/dist/chunks/{ignore-file-ui-5BWA6LBC.ts.map → remote-selection-ui-F6NJBQ3Y.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-MJ6G2CEI.ts.map → setup-switch-7LMIRMZ7.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-NIITROKS.ts.map → sync-inspection-QGM54YCM.ts.map} +0 -0
- /package/dist/chunks/{sync-operations-FFI4ZZQL.ts.map → sync-operations-DTQMKVRQ.ts.map} +0 -0
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { createSyncBackend } from "../backends/backend-factory.js";
|
|
2
2
|
import { expectedRemoteHead, SyncBackendConflictError } from "../backends/sync-backend.js";
|
|
3
|
-
import { requireNoPendingAdoption } from "../ignore/adoption-journal.js";
|
|
4
3
|
import { loadConfig, syncCheckConfigFingerprint } from "../settings/config.js";
|
|
5
4
|
import { effectiveSessionRoot, requireStableMergeSessionRoot, snapshotOptionsForContext, } from "../snapshot/session-paths.js";
|
|
6
5
|
import { createSnapshot, filterSnapshotForConfigPolicy, mergeRemotePreservedFiles, observeSnapshot, regenerateSnapshotIdentity, scanSnapshot, snapshotWithObservedInventory, } from "../snapshot/snapshot.js";
|
|
7
|
-
import { ignorePolicyValidator } from "../snapshot/snapshot-transaction-policy.js";
|
|
8
6
|
import { hasCurrentMergeBaseline, pruneMergeBaselines, readMergeAncestors } from "../state/merge-baseline-store.js";
|
|
9
7
|
import { readStateForConfig, statePathForConfig, syncStateFingerprint } from "../state/sync-state-store.js";
|
|
10
8
|
import { confirmMergeReview } from "../ui/merge-review.js";
|
|
@@ -18,11 +16,10 @@ import { pruneCompletedConflicts } from "./conflict-retention.js";
|
|
|
18
16
|
import { resolveContentConflicts } from "./content-conflicts.js";
|
|
19
17
|
import { ContinuousError, TransferSizeError } from "./continuous-errors.js";
|
|
20
18
|
import { planFileMerge } from "./file-merge-planner.js";
|
|
21
|
-
import { ignorePublicationNotice, withPublishedIgnoreRules } from "./ignore-publication.js";
|
|
22
19
|
import { overlayLocalFields, portableSnapshot, sameLocalFields } from "./local-fields.js";
|
|
23
20
|
import { acceptedState, matchesAcceptedState, writeAcceptedState } from "./merge-acceptance.js";
|
|
24
21
|
import { applyMergedSnapshot, preflightMergedTargets } from "./merge-apply.js";
|
|
25
|
-
import {
|
|
22
|
+
import { clearMergeJournal, mergeJournalIdentity, readMergeJournal, sameMergeRecoveryHead, writeMergeJournal, } from "./merge-journal.js";
|
|
26
23
|
import { mergeTransferError } from "./merge-transfer-error.js";
|
|
27
24
|
import { acceptedMergeFiles } from "./partial-progress.js";
|
|
28
25
|
import { formatRemoteSelectionStatus, readSnapshotForHead, requireCompatibleRemoteSelection, } from "./remote-snapshot.js";
|
|
@@ -33,12 +30,10 @@ import { backupSnapshot, captureMutationOwner, protectedSessionPaths } from "./s
|
|
|
33
30
|
import { configuredSnapshotPathMatcher, inspectRemoteSelection, syncSessionsSelected } from "./sync-policy.js";
|
|
34
31
|
import { fileHashMap, hasLocalChanges, hasRemoteChanges, sameHashes, syncPolicyChanged } from "./sync-state.js";
|
|
35
32
|
import { TEXT_MERGE_WORK_LIMIT } from "./text-merge.js";
|
|
36
|
-
import { checkLiveProtection, validateMergeApplyReview, validateMergedPublication } from "./transfer-freshness.js";
|
|
37
33
|
import { requireTransferSize, selectedPublicationImage, transferSizeDetails, transferSizeLimitsEnabled, } from "./transfer-size-limits.js";
|
|
38
34
|
const MAX_ATTEMPTS = 3;
|
|
39
35
|
/** Established-baseline sync only. First-source selection remains in the existing command flow. */
|
|
40
36
|
export async function mergeSync(ctx, options, factory = createSyncBackend, resolution) {
|
|
41
|
-
requireNoPendingAdoption();
|
|
42
37
|
const timings = options.startupTimings ?? createStartupTimings();
|
|
43
38
|
const sessionOwner = captureMutationOwner(ctx, options.signal);
|
|
44
39
|
const validateOwner = (config) => {
|
|
@@ -55,14 +50,13 @@ export async function mergeSync(ctx, options, factory = createSyncBackend, resol
|
|
|
55
50
|
}
|
|
56
51
|
};
|
|
57
52
|
const validateRetryAuthorization = (config) => {
|
|
53
|
+
options.validateAgentRetryPolicy?.(config);
|
|
58
54
|
if (options.agentRetryRefusal &&
|
|
59
55
|
(!config.agentMode || options.auto || options.background || !ctx.hasUI || !["tui", "rpc"].includes(ctx.mode)))
|
|
60
56
|
throw new Error("Refused-candidate retry requires foreground Autonomous sync in TUI or RPC.");
|
|
61
57
|
};
|
|
62
58
|
const config = await loadConfig(options.setup);
|
|
63
59
|
validateOwner(config);
|
|
64
|
-
if (config.pathPolicy === "ignore-file" && !config.ignorePolicy)
|
|
65
|
-
throw new Error("Merged sync requires the resolved local ignore-file policy.");
|
|
66
60
|
validateRetryAuthorization(config);
|
|
67
61
|
const configToken = syncCheckConfigFingerprint(config);
|
|
68
62
|
const modelToken = JSON.stringify(ctx.model);
|
|
@@ -93,34 +87,16 @@ export async function mergeSync(ctx, options, factory = createSyncBackend, resol
|
|
|
93
87
|
if (options.auto && (!startupTransferEnabled(latest) || !ctx.isIdle()))
|
|
94
88
|
throw new Error("Automatic transfer is no longer authorized at this idle boundary.");
|
|
95
89
|
});
|
|
96
|
-
const
|
|
97
|
-
...config,
|
|
98
|
-
signal: options.signal,
|
|
99
|
-
validateMutation: () => {
|
|
100
|
-
validateOwner();
|
|
101
|
-
if (options.auto && !ctx.isIdle())
|
|
102
|
-
throw new Error("Automatic transfer is no longer authorized at this idle boundary.");
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
const validateFresh = validateIgnore
|
|
106
|
-
? async () => {
|
|
107
|
-
await validate();
|
|
108
|
-
await validateIgnore();
|
|
109
|
-
}
|
|
110
|
-
: validate;
|
|
90
|
+
const validateFresh = validate;
|
|
111
91
|
await validateFresh();
|
|
112
92
|
const pending = await timings.measure("transfer journal read", () => readMergeJournal(config));
|
|
113
93
|
await validate();
|
|
114
94
|
if (pending && options.agentRetryRefusal)
|
|
115
95
|
throw new Error("A pending merge journal requires ordinary Sync now before retrying a refused candidate.");
|
|
116
|
-
if (pending)
|
|
117
|
-
assertMergeJournalPolicy(pending, config);
|
|
118
96
|
const backend = await timings.measure("transfer backend initialization", () => factory(config));
|
|
119
97
|
await validate();
|
|
120
98
|
if (pending) {
|
|
121
99
|
const recovered = await timings.measure("transfer journal recovery", () => completeJournal(ctx, config, backend, pending, { validate, validateFresh, validateOwner }, timings, options, resolution ? undefined : isCurrent));
|
|
122
|
-
if (recovered === "archived" || recovered === "cancelled")
|
|
123
|
-
return recovered;
|
|
124
100
|
if (!recovered) {
|
|
125
101
|
if ((options.auto || !options.silent) && !options.signal?.aborted)
|
|
126
102
|
ctx.ui.notify("Interrupted candidate is not active; local content and baseline were unchanged. Evidence was reconciled without retrying publication. Run sync again for a fresh plan.", "warning");
|
|
@@ -132,7 +108,7 @@ export async function mergeSync(ctx, options, factory = createSyncBackend, resol
|
|
|
132
108
|
}
|
|
133
109
|
// Recovery above never publishes. This gate applies only to new autonomous transfers.
|
|
134
110
|
if ((options.auto || config.agentMode) && backend.capability === "read-check-write-verify") {
|
|
135
|
-
throw new Error("Automatic transfer requires conditional publication or a lease; this backend supports only read/check/write/verify.
|
|
111
|
+
throw new Error("Automatic transfer requires conditional publication or a lease; this backend supports only read/check/write/verify. Use reviewed manual sync.");
|
|
136
112
|
}
|
|
137
113
|
const textBudget = { remaining: TEXT_MERGE_WORK_LIMIT };
|
|
138
114
|
const createdArtifacts = [];
|
|
@@ -181,7 +157,7 @@ export async function mergeSync(ctx, options, factory = createSyncBackend, resol
|
|
|
181
157
|
}
|
|
182
158
|
}
|
|
183
159
|
const rawRemote = head
|
|
184
|
-
? await timings.measure("transfer snapshot download", () => readSnapshotForHead(backend, head, options.signal
|
|
160
|
+
? await timings.measure("transfer snapshot download", () => readSnapshotForHead(backend, head, options.signal))
|
|
185
161
|
: undefined;
|
|
186
162
|
await validate();
|
|
187
163
|
if (rawRemote) {
|
|
@@ -374,9 +350,7 @@ export async function mergeSync(ctx, options, factory = createSyncBackend, resol
|
|
|
374
350
|
const publish = !sameHashes(fileHashMap(publication), fileHashMap(remote)) ||
|
|
375
351
|
Boolean(config.partialSync && rawRemote.version < 3);
|
|
376
352
|
const candidate = mergeRemotePreservedFiles(publication, rawRemote, config, { sessionDir: sessionRoot });
|
|
377
|
-
const upload =
|
|
378
|
-
if (config.ignorePolicy && publish)
|
|
379
|
-
await validate();
|
|
353
|
+
const upload = candidate;
|
|
380
354
|
const apply = !sameHashes(fileHashMap(localRaw), fileHashMap(after));
|
|
381
355
|
if (!publish && !apply) {
|
|
382
356
|
const beforeEvidence = await timings.measure("transfer remote head", () => backend.readHead(options.signal));
|
|
@@ -432,8 +406,7 @@ export async function mergeSync(ctx, options, factory = createSyncBackend, resol
|
|
|
432
406
|
decisions: plan.decisions,
|
|
433
407
|
capability: backend.capability,
|
|
434
408
|
});
|
|
435
|
-
|
|
436
|
-
if (!(await confirmMergeReview(ctx, summary.title, notice ? `${notice}\n\n${summary.content}` : summary.content, options.signal, isCurrent, summary.confirmationLabel, notice ? [notice, "", ...summary.lines] : summary.lines)))
|
|
409
|
+
if (!(await confirmMergeReview(ctx, summary.title, summary.content, options.signal, isCurrent, summary.confirmationLabel, summary.lines)))
|
|
437
410
|
return "cancelled";
|
|
438
411
|
}
|
|
439
412
|
await validate();
|
|
@@ -457,7 +430,7 @@ export async function mergeSync(ctx, options, factory = createSyncBackend, resol
|
|
|
457
430
|
const backup = await timings.measure("transfer backup", () => backupSnapshot(regenerateSnapshotIdentity(refreshed), options.signal));
|
|
458
431
|
await validateFresh();
|
|
459
432
|
const journal = {
|
|
460
|
-
|
|
433
|
+
version: 1,
|
|
461
434
|
identity: mergeJournalIdentity(config, backend.identity),
|
|
462
435
|
before: localRaw,
|
|
463
436
|
after,
|
|
@@ -500,11 +473,7 @@ export async function mergeSync(ctx, options, factory = createSyncBackend, resol
|
|
|
500
473
|
const result = await timings.measure("transfer remote publication", () => backend.publishSnapshot(upload, expectedRemoteHead(head), {
|
|
501
474
|
signal: options.signal,
|
|
502
475
|
onCommit: options.onCommit,
|
|
503
|
-
|
|
504
|
-
? {
|
|
505
|
-
validateIgnorePolicy: () => validateMergedPublication(ctx, config, snapshotOptions, localRaw, after, journal.stateIdentity, validateFresh),
|
|
506
|
-
}
|
|
507
|
-
: { validateIgnorePolicy: validateFresh }),
|
|
476
|
+
validatePublication: validateFresh,
|
|
508
477
|
}));
|
|
509
478
|
journal.committedHead = result.head;
|
|
510
479
|
journal.warnings = result.warnings;
|
|
@@ -550,7 +519,7 @@ export async function mergeSync(ctx, options, factory = createSyncBackend, resol
|
|
|
550
519
|
await timings.measure("transfer cleanup", () => releaseConflictArtifacts(config, ownedStatePath, createdArtifacts));
|
|
551
520
|
}
|
|
552
521
|
}
|
|
553
|
-
async function completeJournal(ctx, config, backend, journal, { validate, validateFresh, validateOwner, }, timings, options,
|
|
522
|
+
async function completeJournal(ctx, config, backend, journal, { validate, validateFresh, validateOwner, }, timings, options, _isCurrent) {
|
|
554
523
|
const { auto, signal } = options;
|
|
555
524
|
const validateMutation = () => {
|
|
556
525
|
validateOwner();
|
|
@@ -560,7 +529,6 @@ async function completeJournal(ctx, config, backend, journal, { validate, valida
|
|
|
560
529
|
if (journal.identity !== mergeJournalIdentity(config, backend.identity) ||
|
|
561
530
|
!sameLocalFields(journal.upload.localFields, config.localFields))
|
|
562
531
|
throw new Error("Merge journal belongs to a different setup, selection or local-field policy; preserve it for reviewed recovery.");
|
|
563
|
-
assertMergeJournalPolicy(journal, config);
|
|
564
532
|
await validateFresh();
|
|
565
533
|
const sessionRoot = config.scope === "agent-directory" || syncSessionsSelected(config)
|
|
566
534
|
? await effectiveSessionRoot(ctx, config, signal)
|
|
@@ -596,8 +564,6 @@ async function completeJournal(ctx, config, backend, journal, { validate, valida
|
|
|
596
564
|
const state = await timings.measure("transfer state read", () => readStateForConfig(config));
|
|
597
565
|
await validate();
|
|
598
566
|
if (matchesAcceptedState(state, config, journal.committedHead, journal.accepted ?? journal.after, journal.progress)) {
|
|
599
|
-
if (journal.localPolicyKey)
|
|
600
|
-
await validateFresh();
|
|
601
567
|
await clearMergeJournal(config);
|
|
602
568
|
await validate();
|
|
603
569
|
await pruneMergeBaselines(config, state, captureMutationOwner(ctx, signal));
|
|
@@ -605,28 +571,13 @@ async function completeJournal(ctx, config, backend, journal, { validate, valida
|
|
|
605
571
|
return true;
|
|
606
572
|
}
|
|
607
573
|
}
|
|
608
|
-
if (head &&
|
|
609
|
-
(journal.ignoreSource || head.selection?.version === 4) &&
|
|
610
|
-
inspectRemoteSelection(config.include, { selection: head.selection, files: [] }, config.exclude, config).kind !==
|
|
611
|
-
"same")
|
|
612
|
-
throw new Error("Remote ignore-file policy differs or is unavailable; preserve the pending merge for review.");
|
|
613
574
|
if (!journal.committedHead &&
|
|
614
575
|
head &&
|
|
615
576
|
(backend.sameRevision(head.revision, journal.expectedHead.revision) ||
|
|
616
577
|
backend.matchesUncommittedRecoveryHead?.(head, journal.expectedHead))) {
|
|
617
|
-
if (journal.ignoreSource &&
|
|
618
|
-
(head.snapshotId !== journal.expectedHead.snapshotId ||
|
|
619
|
-
head.snapshotRef !== journal.expectedHead.snapshotRef ||
|
|
620
|
-
head.snapshotId === journal.upload.id))
|
|
621
|
-
throw new Error("Cannot verify that the ignore-file candidate is inactive; preserve the journal and backup.");
|
|
622
578
|
const { sameBaseline, sameLocal } = await readRetirementEvidence();
|
|
623
579
|
validateMutation();
|
|
624
580
|
if (!sameBaseline || !sameLocal) {
|
|
625
|
-
if (journal.ignoreSource) {
|
|
626
|
-
if (!sameBaseline)
|
|
627
|
-
throw new Error("Sync baseline changed after uncertain publication; preserve the journal and backup for review.");
|
|
628
|
-
return reviewInactiveIgnoreMerge(ctx, config, backend, journal, head, options, validateFresh, isCurrent);
|
|
629
|
-
}
|
|
630
581
|
throw new Error("Uncertain publication is not active, but local content or baseline changed; keep the journal for reviewed recovery.");
|
|
631
582
|
}
|
|
632
583
|
await clearMergeJournal(config);
|
|
@@ -646,14 +597,11 @@ async function completeJournal(ctx, config, backend, journal, { validate, valida
|
|
|
646
597
|
(journal.committedHead && !backend.sameRevision(head.revision, journal.committedHead.revision))) {
|
|
647
598
|
throw new Error("Publication outcome cannot be reconciled with the current remote head. Journal and backup retained; do not retry publication or restore old bytes blindly.");
|
|
648
599
|
}
|
|
649
|
-
const observed = await timings.measure("transfer snapshot download", () => readSnapshotForHead(backend, head, signal
|
|
600
|
+
const observed = await timings.measure("transfer snapshot download", () => readSnapshotForHead(backend, head, signal));
|
|
650
601
|
requireCompatibleRemoteSelection(config, observed);
|
|
651
602
|
if (!sameHashes(fileHashMap(observed), fileHashMap(journal.upload)) ||
|
|
652
603
|
JSON.stringify(observed.selection) !== JSON.stringify(journal.upload.selection) ||
|
|
653
|
-
observed.version !== journal.upload.version
|
|
654
|
-
(observed.ignoreRules === null) !== (journal.upload.ignoreRules === null) ||
|
|
655
|
-
observed.ignoreRules?.filename !== journal.upload.ignoreRules?.filename ||
|
|
656
|
-
observed.ignoreRules?.text !== journal.upload.ignoreRules?.text)
|
|
604
|
+
observed.version !== journal.upload.version)
|
|
657
605
|
throw new Error("Remote snapshot does not match the recorded merge publication.");
|
|
658
606
|
const state = await timings.measure("transfer state read", () => readStateForConfig(config));
|
|
659
607
|
if (matchesAcceptedState(state, config, head, journal.accepted ?? journal.after, journal.progress)) {
|
|
@@ -688,13 +636,8 @@ async function completeJournal(ctx, config, backend, journal, { validate, valida
|
|
|
688
636
|
const protectedPaths = protectedSessionPaths(ctx, sessionRoot);
|
|
689
637
|
const validateApply = () => {
|
|
690
638
|
validateMutation();
|
|
691
|
-
if (journal.localPolicyKey)
|
|
692
|
-
checkLiveProtection(ctx, sessionRoot, protectedPaths);
|
|
693
639
|
};
|
|
694
|
-
|
|
695
|
-
? () => validateMergeApplyReview(backend, config, head, journal.stateIdentity, validateFresh, signal)
|
|
696
|
-
: undefined;
|
|
697
|
-
await timings.measure("transfer local apply", () => applyMergedSnapshot(journal.before, journal.after, protectedPaths, { ...snapshotOptions, validateMutation: validateApply, validateApplyReview, requireReviewedApplyImage }, validate, ctx.sessionManager.getSessionFile?.()));
|
|
640
|
+
await timings.measure("transfer local apply", () => applyMergedSnapshot(journal.before, journal.after, protectedPaths, { ...snapshotOptions, validateMutation: validateApply, requireReviewedApplyImage }, validate, ctx.sessionManager.getSessionFile?.()));
|
|
698
641
|
await validate();
|
|
699
642
|
const headAtAcceptance = await timings.measure("transfer remote head", () => backend.readHead(signal));
|
|
700
643
|
await validate();
|
|
@@ -1,29 +1,14 @@
|
|
|
1
1
|
import { snapshotIncludesSessions } from "../snapshot/snapshot.js";
|
|
2
|
-
import { formatRuleChanges } from "../ui/ignore-rule-preview.js";
|
|
3
2
|
import { countPreservedRemoteFiles, formatPushSummary, formatTransferReview } from "../ui/sync-format.js";
|
|
4
3
|
import { setSyncStatus } from "../ui/sync-status.js";
|
|
5
4
|
import { confirmTransferReview } from "../ui/transfer-review.js";
|
|
6
|
-
import { ignorePublicationNotice } from "./ignore-publication.js";
|
|
7
5
|
import { throwIfAborted } from "./signals.js";
|
|
8
|
-
import { formatIgnorePolicyComparison, inspectRemoteSelection } from "./sync-policy.js";
|
|
9
6
|
export async function confirmPush(ctx, options, config, backend, local, upload, head, remote, validateMutation, title = snapshotIncludesSessions(upload) ? "Push pi settings and sessions?" : "Push pi settings?") {
|
|
10
7
|
validateMutation();
|
|
11
8
|
if (options.yes)
|
|
12
9
|
return true;
|
|
13
10
|
const summary = formatPushSummary(config, backend.destination, upload, head, countPreservedRemoteFiles(local, upload), remote);
|
|
14
|
-
const
|
|
15
|
-
? inspectRemoteSelection(config.include, remote, config.exclude, config).ignorePolicyComparison
|
|
16
|
-
: undefined;
|
|
17
|
-
const notice = ignorePublicationNotice(upload);
|
|
18
|
-
const overwrite = comparison !== undefined && comparison !== "match";
|
|
19
|
-
const confirmed = await confirmTransferReview(ctx, overwrite ? "Overwrite remote policy and push?" : title, formatTransferReview(...(overwrite
|
|
20
|
-
? [
|
|
21
|
-
formatIgnorePolicyComparison(comparison),
|
|
22
|
-
"This replaces the remote policy with this device's rules. Remote rules are not adopted on this device.",
|
|
23
|
-
`Sessions opt-in: ${remote?.selection?.version === 4 ? (remote.selection.sessions ? "on" : "off") : "legacy"} → ${config.ignorePolicy?.sessions ? "on" : "off"}.`,
|
|
24
|
-
formatRuleChanges(remote?.ignoreRules?.text, upload.ignoreRules?.text),
|
|
25
|
-
]
|
|
26
|
-
: []), ...(notice ? [notice, ""] : []), summary), options.signal, validateMutation);
|
|
11
|
+
const confirmed = await confirmTransferReview(ctx, title, formatTransferReview(summary), options.signal, validateMutation);
|
|
27
12
|
throwIfAborted(options.signal);
|
|
28
13
|
if (confirmed)
|
|
29
14
|
return true;
|
|
@@ -3,7 +3,7 @@ import { filterSnapshotForConfigPolicy, mergeRemotePreservedFiles } from "../sna
|
|
|
3
3
|
import { safeTerminalText } from "../ui/terminal-text.js";
|
|
4
4
|
import { sameLocalFields, validatePortableSnapshot } from "./local-fields.js";
|
|
5
5
|
import { throwIfAborted } from "./signals.js";
|
|
6
|
-
import {
|
|
6
|
+
import { inspectRemoteSelection, remoteSelectionMismatch, requireLegacyTransferPolicy, sameSnapshotSelection, } from "./sync-policy.js";
|
|
7
7
|
import { syncPolicyChanged } from "./sync-state.js";
|
|
8
8
|
async function readValidatedSnapshotForHead(backend, head, signal) {
|
|
9
9
|
const snapshot = await backend.readSnapshot(head.snapshotRef, signal);
|
|
@@ -22,73 +22,17 @@ function validateSnapshotForHead(snapshot, head) {
|
|
|
22
22
|
}
|
|
23
23
|
return snapshot;
|
|
24
24
|
}
|
|
25
|
-
export async function readSnapshotForHead(backend, head, signal, config) {
|
|
26
|
-
const snapshot = await readValidatedSnapshotForHead(backend, head, signal);
|
|
27
|
-
if (!config)
|
|
28
|
-
requireLegacyTransferPolicy(snapshot);
|
|
29
|
-
else if (!config.ignorePolicy && snapshot.selection?.version === 4)
|
|
30
|
-
requireCompatibleRemoteSelection(config, snapshot);
|
|
31
|
-
return snapshot;
|
|
32
|
-
}
|
|
33
|
-
export async function readRemoteSnapshotForUpload(backend, config, head, state, options) {
|
|
34
|
-
if (!head)
|
|
35
|
-
return undefined;
|
|
36
|
-
if (config.ignorePolicy ||
|
|
37
|
-
head.selection?.version === 4 ||
|
|
38
|
-
head.snapshotId !== state.lastAppliedSnapshot ||
|
|
39
|
-
syncPolicyChanged(state, config) ||
|
|
40
|
-
(state.lastRemoteRevision && !backend.sameRevision(head.revision, state.lastRemoteRevision)) ||
|
|
41
|
-
(!options.force &&
|
|
42
|
-
(config.scope === "agent-directory" ||
|
|
43
|
-
(head.selection &&
|
|
44
|
-
inspectRemoteSelection(config.include, { selection: head.selection, files: [] }, config.exclude, config)
|
|
45
|
-
.kind === "different"))))
|
|
46
|
-
return readSnapshotForHead(backend, head, options.signal, config);
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
export async function snapshotForUpload(backend, config, local, head, remote, options) {
|
|
50
|
-
if (config.ignorePolicy)
|
|
51
|
-
return filterSnapshotForConfigPolicy(local, config, { ...options, regenerateId: true });
|
|
52
|
-
if (!head)
|
|
53
|
-
return config.reservedIgnoreNames === undefined ? local : filterSnapshotForConfigPolicy(local, config, options);
|
|
54
|
-
const snapshot = remote ?? (await readSnapshotForHead(backend, head, options.signal, config));
|
|
55
|
-
const remoteScoped = snapshot.selection?.version === 3;
|
|
56
|
-
if (remoteScoped !== (config.scope === "agent-directory")) {
|
|
57
|
-
throw new Error("Converting an existing remote between included paths and agent-directory scope is not supported. Use a separate storage location.");
|
|
58
|
-
}
|
|
59
|
-
return mergeRemotePreservedFiles(local, snapshot, config, options);
|
|
60
|
-
}
|
|
61
|
-
export function sameRemoteHead(backend, left, right) {
|
|
62
|
-
if (!left || !right)
|
|
63
|
-
return left === right;
|
|
64
|
-
return (left.snapshotId === right.snapshotId &&
|
|
65
|
-
left.snapshotRef === right.snapshotRef &&
|
|
66
|
-
backend.sameRevision(left.revision, right.revision) &&
|
|
67
|
-
sameSnapshotSelection(left.selection, right.selection));
|
|
68
|
-
}
|
|
69
25
|
export function requireCompatibleRemoteSelection(config, snapshot) {
|
|
70
|
-
const state = inspectRemoteSelection(config.include, snapshot, config.exclude, config);
|
|
71
|
-
if (state.kind === "different" && state.ignorePolicyComparison)
|
|
72
|
-
throw selectionMismatch(config, state);
|
|
73
26
|
if (!sameLocalFields(config.localFields, snapshot.localFields))
|
|
74
27
|
throw new Error("Remote local-field policy differs; confirm a reviewed directional migration. Old history is not erased.");
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const remote = !head.selection && config.ignorePolicy
|
|
80
|
-
? await readValidatedSnapshotForHead(backend, head, signal)
|
|
81
|
-
: { selection: head.selection, files: [] };
|
|
82
|
-
return inspectRemoteSelection(config.include, remote, config.exclude, config);
|
|
83
|
-
}
|
|
84
|
-
function selectionMismatch(config, state) {
|
|
85
|
-
return remoteSelectionMismatch(config, state.include, syncConfigReviewFingerprint(config), state.exclude, state);
|
|
28
|
+
const state = inspectRemoteSelection(config.include, snapshot, config.exclude, config);
|
|
29
|
+
if (state.kind === "different") {
|
|
30
|
+
throw remoteSelectionMismatch(config, state.include, syncConfigReviewFingerprint(config), state.exclude, state);
|
|
31
|
+
}
|
|
86
32
|
}
|
|
87
33
|
export function formatRemoteSelectionStatus(state) {
|
|
88
34
|
if (!state)
|
|
89
35
|
return "remote included content: unavailable (remote is empty)";
|
|
90
|
-
if (state.ignorePolicyComparison)
|
|
91
|
-
return formatIgnorePolicyComparison(state.ignorePolicyComparison);
|
|
92
36
|
if (state.kind === "same")
|
|
93
37
|
return "remote included content: matches this setup";
|
|
94
38
|
if (state.kind === "legacy") {
|
|
@@ -116,10 +60,8 @@ export async function readRemoteSnapshot(backend, config, signal, options = {})
|
|
|
116
60
|
if (options.validateSelection)
|
|
117
61
|
options.validateSelection(rawSnapshot);
|
|
118
62
|
else if (!options.allowSelectionDifference && selectionState.kind === "different")
|
|
119
|
-
throw
|
|
120
|
-
const snapshot =
|
|
121
|
-
? undefined
|
|
122
|
-
: filterSnapshotForConfigPolicy(rawSnapshot, config, { sessionDir: options.sessionDir });
|
|
63
|
+
throw remoteSelectionMismatch(config, selectionState.include, syncConfigReviewFingerprint(config), selectionState.exclude, selectionState);
|
|
64
|
+
const snapshot = filterSnapshotForConfigPolicy(rawSnapshot, config, { sessionDir: options.sessionDir });
|
|
123
65
|
return { head, snapshot, selectionState };
|
|
124
66
|
}
|
|
125
67
|
async function readCurrentSnapshot(backend, singleObservation, signal) {
|
|
@@ -134,3 +76,44 @@ async function readCurrentSnapshot(backend, singleObservation, signal) {
|
|
|
134
76
|
throwIfAborted(signal);
|
|
135
77
|
return head && { head, snapshot: await readValidatedSnapshotForHead(backend, head, signal) };
|
|
136
78
|
}
|
|
79
|
+
export async function readSnapshotForHead(backend, head, signal) {
|
|
80
|
+
const snapshot = await readValidatedSnapshotForHead(backend, head, signal);
|
|
81
|
+
requireLegacyTransferPolicy(snapshot);
|
|
82
|
+
return snapshot;
|
|
83
|
+
}
|
|
84
|
+
export async function readRemoteSnapshotForUpload(backend, config, head, state, options) {
|
|
85
|
+
if (!head)
|
|
86
|
+
return undefined;
|
|
87
|
+
if (!head.selection ||
|
|
88
|
+
head.snapshotId !== state.lastAppliedSnapshot ||
|
|
89
|
+
syncPolicyChanged(state, config) ||
|
|
90
|
+
(state.lastRemoteRevision && !backend.sameRevision(head.revision, state.lastRemoteRevision)) ||
|
|
91
|
+
(!options.force &&
|
|
92
|
+
(config.scope === "agent-directory" ||
|
|
93
|
+
inspectRemoteSelection(config.include, { selection: head.selection, files: [] }, config.exclude, config)
|
|
94
|
+
.kind === "different")))
|
|
95
|
+
return readSnapshotForHead(backend, head, options.signal);
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
export async function snapshotForUpload(backend, config, local, head, remote, options) {
|
|
99
|
+
if (!head)
|
|
100
|
+
return local;
|
|
101
|
+
const snapshot = remote ?? (await readSnapshotForHead(backend, head, options.signal));
|
|
102
|
+
if ((snapshot.selection?.version === 3) !== (config.scope === "agent-directory"))
|
|
103
|
+
throw new Error("Converting an existing remote between included paths and agent-directory scope is not supported. Use a separate storage location.");
|
|
104
|
+
return mergeRemotePreservedFiles(local, snapshot, config, options);
|
|
105
|
+
}
|
|
106
|
+
export function sameRemoteHead(backend, left, right) {
|
|
107
|
+
if (!left || !right)
|
|
108
|
+
return left === right;
|
|
109
|
+
return (left.snapshotId === right.snapshotId &&
|
|
110
|
+
left.snapshotRef === right.snapshotRef &&
|
|
111
|
+
backend.sameRevision(left.revision, right.revision) &&
|
|
112
|
+
sameSnapshotSelection(left.selection, right.selection));
|
|
113
|
+
}
|
|
114
|
+
export async function inspectHeadSelection(backend, config, head, signal) {
|
|
115
|
+
const remote = head.selection
|
|
116
|
+
? { selection: head.selection, files: [] }
|
|
117
|
+
: await readSnapshotForHead(backend, head, signal);
|
|
118
|
+
return inspectRemoteSelection(config.include, remote, config.exclude, config);
|
|
119
|
+
}
|
|
@@ -5,6 +5,7 @@ import { documentFingerprint } from "../../document.js";
|
|
|
5
5
|
import { MAX_SETTINGS_BYTES } from "../../protocol.js";
|
|
6
6
|
import { configFromSettings } from "../settings/config.js";
|
|
7
7
|
import { legacyLocalConfigPath, localConfigPath } from "../settings/config-file.js";
|
|
8
|
+
import { hasRetiredRuleJournal } from "../settings/retired-ignore-recovery.js";
|
|
8
9
|
import { validateSettingsDocument } from "../settings/settings-validation.js";
|
|
9
10
|
import { stateDirectoryMigrationNotice } from "../state/state-directory.js";
|
|
10
11
|
import { statePathForConfig } from "../state/sync-state-store.js";
|
|
@@ -63,7 +64,7 @@ function readCanonicalSettings() {
|
|
|
63
64
|
}
|
|
64
65
|
export function captureStartupBootstrap(root, expected, signal, reviewOwnsLock) {
|
|
65
66
|
signal.throwIfAborted();
|
|
66
|
-
if (stateDirectoryMigrationNotice())
|
|
67
|
+
if (stateDirectoryMigrationNotice() || hasRetiredRuleJournal(root))
|
|
67
68
|
return;
|
|
68
69
|
const recovery = startupRecoveryEvidence(root, reviewOwnsLock);
|
|
69
70
|
if (recovery === undefined)
|
|
@@ -85,8 +86,6 @@ export function captureStartupBootstrap(root, expected, signal, reviewOwnsLock)
|
|
|
85
86
|
if (!settings.activeSyncSetup)
|
|
86
87
|
return;
|
|
87
88
|
const config = configFromSettings(settings);
|
|
88
|
-
if (config.reservedIgnoreNames)
|
|
89
|
-
return;
|
|
90
89
|
const stateFile = statePathForConfig(config);
|
|
91
90
|
const noMergeJournal = () => {
|
|
92
91
|
const setupDirectory = inspect(path.dirname(stateFile));
|
|
@@ -97,6 +96,7 @@ export function captureStartupBootstrap(root, expected, signal, reviewOwnsLock)
|
|
|
97
96
|
signal.throwIfAborted();
|
|
98
97
|
return (readCanonicalSettings()?.fingerprint === expected &&
|
|
99
98
|
!stateDirectoryMigrationNotice() &&
|
|
99
|
+
!hasRetiredRuleJournal(root) &&
|
|
100
100
|
JSON.stringify(readConsent(root)) === consentToken &&
|
|
101
101
|
noMergeJournal() &&
|
|
102
102
|
startupRecoveryEvidence(root, reviewOwnsLock) === recovery);
|
|
@@ -30,7 +30,7 @@ export function syncErrorGuidance(error) {
|
|
|
30
30
|
}
|
|
31
31
|
else if (/\bagent directory exceeds the (64 MiB scan byte|scan file) bound\b/iu.test(message)) {
|
|
32
32
|
next =
|
|
33
|
-
"Reduce the files managed by this setup before retrying.
|
|
33
|
+
"Reduce the files managed by this setup before retrying. Edit Agent directory scope in /sync → Settings to exclude paths you do not need.";
|
|
34
34
|
}
|
|
35
35
|
else if (/changed while|type changed|reopen/iu.test(message)) {
|
|
36
36
|
next = "Reopen the item in /sync and review its current settings before saving again.";
|
|
@@ -28,8 +28,7 @@ export async function inspectSync(config, options, signal, factory = createSyncB
|
|
|
28
28
|
selectionState,
|
|
29
29
|
localFiles: local.files.length,
|
|
30
30
|
localChanged: hasLocalChanges(local, state, config),
|
|
31
|
-
remoteChanged: (
|
|
32
|
-
remoteChangedSinceState(head, state, config, (left, right) => backend.sameRevision(left, right)),
|
|
31
|
+
remoteChanged: remoteChangedSinceState(head, state, config, (left, right) => backend.sameRevision(left, right)),
|
|
33
32
|
firstSync: !state.lastAppliedSnapshot,
|
|
34
33
|
emptyInclude: !syncSelectionHasContent(config),
|
|
35
34
|
stateIdentity: syncStateFingerprint(state),
|