@narumitw/pi-sync 0.62.0 → 0.63.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 +13 -0
- package/README.md +29 -15
- package/dist/chunks/{chunk-MNYRU5U5.ts → chunk-27F5W7DX.ts} +3 -2
- package/dist/chunks/{chunk-MNYRU5U5.ts.map → chunk-27F5W7DX.ts.map} +2 -2
- package/dist/chunks/chunk-CKUGCBHP.ts +114 -0
- package/dist/chunks/chunk-CKUGCBHP.ts.map +7 -0
- package/dist/chunks/chunk-EJDDRS6O.ts +17 -0
- package/dist/chunks/chunk-EJDDRS6O.ts.map +7 -0
- package/dist/chunks/{chunk-6PFZUEUG.ts → chunk-EXDWEFIJ.ts} +52 -135
- package/dist/chunks/chunk-EXDWEFIJ.ts.map +7 -0
- package/dist/chunks/{chunk-NHFGAZEC.ts → chunk-HSCAFOT5.ts} +7 -7
- package/dist/chunks/chunk-HSCAFOT5.ts.map +7 -0
- package/dist/chunks/chunk-MANNB4WZ.ts +36 -0
- package/dist/chunks/chunk-MANNB4WZ.ts.map +7 -0
- package/dist/chunks/{chunk-ZB3GNX3P.ts → chunk-S6FUUWV5.ts} +139 -12
- package/dist/chunks/chunk-S6FUUWV5.ts.map +7 -0
- package/dist/chunks/{chunk-PWESMTH6.ts → chunk-SXCH4Q5O.ts} +38 -20
- package/dist/chunks/chunk-SXCH4Q5O.ts.map +7 -0
- package/dist/chunks/{chunk-INECVQNR.ts → chunk-UGS6RYDZ.ts} +5 -3
- package/dist/chunks/chunk-UGS6RYDZ.ts.map +7 -0
- package/dist/chunks/{chunk-3E3TR3JE.ts → chunk-V76KCWHO.ts} +6 -4
- package/dist/chunks/{chunk-3E3TR3JE.ts.map → chunk-V76KCWHO.ts.map} +1 -1
- package/dist/chunks/{chunk-GSCZ4VXV.ts → chunk-VQ47JBLF.ts} +2 -2
- package/dist/chunks/chunk-WFBHWYI6.ts +18 -0
- package/dist/chunks/chunk-WFBHWYI6.ts.map +7 -0
- package/dist/chunks/{command-handler-6ATREPG7.ts → command-handler-VINMQ7ZM.ts} +19 -36
- package/dist/chunks/command-handler-VINMQ7ZM.ts.map +7 -0
- package/dist/chunks/{conflict-review-MAOGTIAI.ts → conflict-review-PCDFRIVB.ts} +2 -2
- package/dist/chunks/{file-selection-QR2KZVGD.ts → file-selection-KID23GAD.ts} +15 -8
- package/dist/chunks/file-selection-KID23GAD.ts.map +7 -0
- package/dist/chunks/{manager-result-dispatcher-MC6EQOQY.ts → manager-result-dispatcher-GDB74IOP.ts} +6 -5
- package/dist/chunks/{manager-ui-AOFUNXAJ.ts → manager-ui-YHDECYKI.ts} +197 -322
- package/dist/chunks/manager-ui-YHDECYKI.ts.map +7 -0
- package/dist/chunks/{remote-selection-ui-4BTP2OJR.ts → remote-selection-ui-GPITNEBF.ts} +5 -4
- package/dist/chunks/{setup-switch-Y6AMFFNK.ts → setup-switch-L54X5U5I.ts} +4 -4
- package/dist/chunks/{setup-wizard-5G426MOZ.ts → setup-wizard-YO4MCPUF.ts} +7 -3
- package/dist/chunks/{setup-wizard-5G426MOZ.ts.map → setup-wizard-YO4MCPUF.ts.map} +1 -1
- package/dist/chunks/{sync-inspection-ITZ6Z4DE.ts → sync-inspection-H2WX5SUT.ts} +3 -3
- package/dist/chunks/{sync-operations-NMVKF7SE.ts → sync-operations-2MZAYHL2.ts} +2 -2
- package/dist/daemon/dist/cli.js +1 -1
- package/dist/daemon/dist/consent.js +134 -16
- package/dist/daemon/dist/engine/backends/git/git-backend.js +61 -30
- package/dist/daemon/dist/engine/ignore/ignore-initialization.js +93 -27
- package/dist/daemon/dist/engine/ignore/ignore-settings.js +85 -14
- package/dist/daemon/dist/engine/settings/config-file.js +1 -1
- package/dist/daemon/dist/engine/settings/config.js +71 -28
- package/dist/daemon/dist/engine/settings/settings-management.js +8 -2
- package/dist/daemon/dist/engine/snapshot/session-paths.js +7 -2
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction-policy.js +37 -17
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction.js +55 -13
- package/dist/daemon/dist/engine/sync/agent-plan.js +1 -0
- package/dist/daemon/dist/engine/sync/agent-sync.js +8 -1
- package/dist/daemon/dist/engine/sync/continuous-sync.js +32 -15
- package/dist/daemon/dist/engine/sync/merge-acceptance.js +29 -0
- package/dist/daemon/dist/engine/sync/merge-apply.js +7 -4
- package/dist/daemon/dist/engine/sync/merge-journal.js +33 -14
- package/dist/daemon/dist/engine/sync/merged-sync.js +31 -39
- package/dist/daemon/dist/engine/sync/remote-snapshot.js +17 -2
- package/dist/daemon/dist/engine/sync/session-push.js +20 -6
- package/dist/daemon/dist/engine/sync/sync-mutations.js +71 -50
- package/dist/daemon/dist/engine/sync/sync-policy.js +28 -3
- package/dist/daemon/dist/engine/sync/sync-state.js +3 -8
- package/dist/daemon/dist/engine/sync/transfer-freshness.js +82 -0
- package/dist/daemon/dist/engine-service.js +124 -27
- package/dist/daemon/dist/monitor.js +84 -32
- package/dist/daemon/dist/server.js +46 -5
- package/dist/daemon/dist/service-host.js +2 -1
- package/dist/daemon/package.json +1 -1
- package/dist/index.ts +28 -25
- package/dist/index.ts.map +4 -4
- package/package.json +3 -3
- package/skills/configure-pi-sync/SKILL.md +17 -64
- package/skills/configure-pi-sync/references/configuration.md +60 -20
- package/src/commands/command-execution.ts +12 -8
- package/src/commands/command-types.ts +1 -0
- package/src/daemon/pi-client.ts +4 -2
- package/src/settings/config.ts +1 -0
- package/src/sync/automatic-sync.ts +9 -2
- package/src/sync/setup-switch.ts +38 -15
- package/src/sync/startup-check.ts +7 -4
- package/src/ui/excluded-paths-ui.ts +2 -2
- package/src/ui/file-selection.ts +7 -2
- package/src/ui/ignore-file-guidance.ts +7 -0
- package/src/ui/ignore-file-ui.ts +28 -202
- package/src/ui/manager-state.ts +27 -15
- package/src/ui/manager-ui.ts +4 -1
- package/src/ui/remote-selection-ui.ts +51 -24
- package/src/ui/settings-ui.ts +132 -81
- package/src/ui/setup/setup-actions.ts +16 -4
- package/src/ui/setup/setup-prompts.ts +55 -9
- package/src/ui/setup/setup-switcher.ts +24 -11
- package/src/ui/storage-connections-ui.ts +33 -11
- package/src/ui/sync-setups-ui.ts +24 -7
- package/dist/chunks/chunk-6PFZUEUG.ts.map +0 -7
- package/dist/chunks/chunk-ECYCNZOE.ts +0 -12
- package/dist/chunks/chunk-ECYCNZOE.ts.map +0 -7
- package/dist/chunks/chunk-INECVQNR.ts.map +0 -7
- package/dist/chunks/chunk-NHFGAZEC.ts.map +0 -7
- package/dist/chunks/chunk-PWESMTH6.ts.map +0 -7
- package/dist/chunks/chunk-ZB3GNX3P.ts.map +0 -7
- package/dist/chunks/command-handler-6ATREPG7.ts.map +0 -7
- package/dist/chunks/file-selection-QR2KZVGD.ts.map +0 -7
- package/dist/chunks/manager-ui-AOFUNXAJ.ts.map +0 -7
- /package/dist/chunks/{chunk-GSCZ4VXV.ts.map → chunk-VQ47JBLF.ts.map} +0 -0
- /package/dist/chunks/{conflict-review-MAOGTIAI.ts.map → conflict-review-PCDFRIVB.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-MC6EQOQY.ts.map → manager-result-dispatcher-GDB74IOP.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-4BTP2OJR.ts.map → remote-selection-ui-GPITNEBF.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-Y6AMFFNK.ts.map → setup-switch-L54X5U5I.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-ITZ6Z4DE.ts.map → sync-inspection-H2WX5SUT.ts.map} +0 -0
- /package/dist/chunks/{sync-operations-NMVKF7SE.ts.map → sync-operations-2MZAYHL2.ts.map} +0 -0
|
@@ -19,7 +19,7 @@ import { prepareSessionRootTransition, resolveTransitionSessionRoot, stableAgent
|
|
|
19
19
|
import { pendingTransactionEntries, transactionRoot } from "./snapshot-transaction-directory.js";
|
|
20
20
|
import { legacyImage, MAX_TRANSACTION_JOURNAL_BYTES, ownedScopedPostTree, readTransactionJournal, recheckScopedImage, removeScopedImage, scopedDescendant, scopedIdentity, scopedPathIdentity, scopedTransactionImage, stableScopedIdentity, } from "./snapshot-transaction-images.js";
|
|
21
21
|
import { indexTransactionPlan } from "./snapshot-transaction-plan.js";
|
|
22
|
-
import { AGENT_DIRECTORY_JOURNAL_VERSION, assertAllowedTarget, assertRecoveryPolicy, assertSafeParents, IGNORE_POLICY_JOURNAL_VERSION, ignorePolicyValidator, ignoreSourceBinding, isScopedJournal, isStrictlyInside, StaleIgnorePolicyError, touchesProtectedTarget, transactionHasSessionTargets, validateJournal, validateJournalPolicy, } from "./snapshot-transaction-policy.js";
|
|
22
|
+
import { AGENT_DIRECTORY_JOURNAL_VERSION, assertAllowedTarget, assertRecoveryPolicy, assertSafeParents, BOUND_DIRECTORY_JOURNAL_VERSION, BOUND_INCLUDED_PATHS_JOURNAL_VERSION, IGNORE_POLICY_JOURNAL_VERSION, ignorePolicyValidator, ignoreSourceBinding, isScopedJournal, isStrictlyInside, recoveryPolicyKey, StaleIgnorePolicyError, touchesProtectedTarget, transactionHasSessionTargets, validateJournal, validateJournalPolicy, } from "./snapshot-transaction-policy.js";
|
|
23
23
|
import { assertNoUnclaimedLegacyStage, buildScopedRecoveryStage, cleanScopedLegacyStage, cleanScopedWorkspace, inspectScopedRecoveryStage, prepareLegacyRecoveryStage, recoveryStagePath, } from "./snapshot-transaction-stage.js";
|
|
24
24
|
import { verifyTarget } from "./snapshot-transaction-verification.js";
|
|
25
25
|
const JOURNAL_VERSION = 4;
|
|
@@ -109,6 +109,8 @@ export async function applySnapshotTransaction(plan, options = {}) {
|
|
|
109
109
|
// A released additional key cannot authorize rollback, even for recognized raced bytes.
|
|
110
110
|
const changesQueueKey = transaction.journal.entries.some((entry) => !heldKeys.has(entry.target) || (entry.afterTarget && !heldKeys.has(entry.afterTarget)));
|
|
111
111
|
try {
|
|
112
|
+
if (options.validateApplyReview)
|
|
113
|
+
await options.validateApplyReview();
|
|
112
114
|
if (scoped && transaction.deletes.length)
|
|
113
115
|
await recheckAgentDirectoryBudget(root, plan, options, stateDir(root));
|
|
114
116
|
for (const target of transaction.deletes.sort((a, b) => a.length - b.length)) {
|
|
@@ -122,6 +124,8 @@ export async function applySnapshotTransaction(plan, options = {}) {
|
|
|
122
124
|
await withMissingTargetQueues(transaction.journal.entries
|
|
123
125
|
.filter((entry) => entry.removalPending)
|
|
124
126
|
.flatMap((entry) => [entry.target, ...(entry.afterTarget ? [entry.afterTarget] : [])]), heldKeys, options, async () => {
|
|
127
|
+
if (options.validateApplyReview && transaction.journal.entries.some((entry) => entry.removalPending))
|
|
128
|
+
await options.validateApplyReview();
|
|
125
129
|
if (validateIgnorePolicy)
|
|
126
130
|
await validateIgnorePolicy();
|
|
127
131
|
if (scoped && plan.writes.length)
|
|
@@ -170,10 +174,17 @@ export async function applySnapshotTransaction(plan, options = {}) {
|
|
|
170
174
|
const verified = await verifyTarget(transaction.directory, entry, transaction.journal, options, deletedByThisCall);
|
|
171
175
|
options.signal?.throwIfAborted();
|
|
172
176
|
options.validateMutation?.();
|
|
173
|
-
if (validateIgnorePolicy
|
|
177
|
+
if (validateIgnorePolicy) {
|
|
174
178
|
await validateIgnorePolicy();
|
|
175
|
-
|
|
179
|
+
if (verified.scoped)
|
|
180
|
+
await recheckScopedImage(item.target, verified.scoped, options);
|
|
181
|
+
else {
|
|
182
|
+
await assertUnexcludedTargets(root, [item.target], options);
|
|
183
|
+
await verifyTarget(transaction.directory, entry, transaction.journal, options, deletedByThisCall);
|
|
184
|
+
}
|
|
176
185
|
}
|
|
186
|
+
options.validateMutation?.();
|
|
187
|
+
options.signal?.throwIfAborted();
|
|
177
188
|
await fs.rename(temp, item.target);
|
|
178
189
|
await syncDirectory(path.dirname(item.target));
|
|
179
190
|
}
|
|
@@ -278,6 +289,7 @@ async function prepareTransaction(plan, targets, options, replacements = new Map
|
|
|
278
289
|
const root = path.resolve(agentDir());
|
|
279
290
|
const wholeDirectory = options.scope === "agent-directory";
|
|
280
291
|
const ignoreSource = options.ignorePolicy ? ignoreSourceBinding(options.ignorePolicy) : undefined;
|
|
292
|
+
const localPolicyKey = recoveryPolicyKey(options);
|
|
281
293
|
const sessionRoot = sessionDir || wholeDirectory ? path.resolve(sessionStorageRoot(root, sessionDir)) : undefined;
|
|
282
294
|
const indexed = indexTransactionPlan(plan, targets);
|
|
283
295
|
const directory = path.join(transactionRoot(), randomUUID());
|
|
@@ -327,17 +339,22 @@ async function prepareTransaction(plan, targets, options, replacements = new Map
|
|
|
327
339
|
? undefined
|
|
328
340
|
: await prepareSessionRootTransition(directory, root, effectiveRoot, entries, plan, options);
|
|
329
341
|
const journal = {
|
|
330
|
-
version:
|
|
331
|
-
?
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
342
|
+
version: localPolicyKey
|
|
343
|
+
? wholeDirectory
|
|
344
|
+
? BOUND_DIRECTORY_JOURNAL_VERSION
|
|
345
|
+
: BOUND_INCLUDED_PATHS_JOURNAL_VERSION
|
|
346
|
+
: ignoreSource
|
|
347
|
+
? IGNORE_POLICY_JOURNAL_VERSION
|
|
348
|
+
: wholeDirectory
|
|
349
|
+
? AGENT_DIRECTORY_JOURNAL_VERSION
|
|
350
|
+
: sessionRootTransition
|
|
351
|
+
? 7
|
|
352
|
+
: replacements.size
|
|
353
|
+
? 5
|
|
354
|
+
: JOURNAL_VERSION,
|
|
339
355
|
root,
|
|
340
356
|
ignoreSource,
|
|
357
|
+
localPolicyKey,
|
|
341
358
|
...(wholeDirectory
|
|
342
359
|
? { selection: selectionForSnapshot(includeFromSelectionConfig(options), options.exclude, options) }
|
|
343
360
|
: options.exclude === undefined
|
|
@@ -492,6 +509,8 @@ async function restoreQueuedTransaction(directory, journal, options, heldKeys) {
|
|
|
492
509
|
const temporary = await prepareLegacyRecoveryStage(directory, entry, options, () => persistJournal(directory, journal));
|
|
493
510
|
if (entry.kind === "file") {
|
|
494
511
|
try {
|
|
512
|
+
options.validateMutation?.();
|
|
513
|
+
options.signal?.throwIfAborted();
|
|
495
514
|
await fs.mkdir(path.dirname(entry.target), { recursive: true });
|
|
496
515
|
await fs.copyFile(path.join(directory, "before", entry.backupName), temporary);
|
|
497
516
|
// Windows requires write access to flush an existing regular file.
|
|
@@ -532,6 +551,13 @@ async function restoreQueuedTransaction(directory, journal, options, heldKeys) {
|
|
|
532
551
|
options.signal?.throwIfAborted();
|
|
533
552
|
if (atInstall === before && (await spellingMatches()))
|
|
534
553
|
return;
|
|
554
|
+
if (validateIgnorePolicy) {
|
|
555
|
+
await validateIgnorePolicy();
|
|
556
|
+
await assertUnexcludedTargets(journal.root, [entry.target], options);
|
|
557
|
+
await verifyTarget(directory, entry, journal, options, atRename === "missing");
|
|
558
|
+
}
|
|
559
|
+
options.validateMutation?.();
|
|
560
|
+
options.signal?.throwIfAborted();
|
|
535
561
|
await fs.rename(temporary, entry.target);
|
|
536
562
|
await syncDirectory(path.dirname(entry.target));
|
|
537
563
|
});
|
|
@@ -542,6 +568,8 @@ async function restoreQueuedTransaction(directory, journal, options, heldKeys) {
|
|
|
542
568
|
continue;
|
|
543
569
|
}
|
|
544
570
|
try {
|
|
571
|
+
options.validateMutation?.();
|
|
572
|
+
options.signal?.throwIfAborted();
|
|
545
573
|
await fs.mkdir(path.dirname(entry.target), { recursive: true });
|
|
546
574
|
await assertSafeParents(journal.root, journal.sessionRoot, entry.target);
|
|
547
575
|
if (entry.kind === "directory") {
|
|
@@ -577,6 +605,13 @@ async function restoreQueuedTransaction(directory, journal, options, heldKeys) {
|
|
|
577
605
|
options.signal?.throwIfAborted();
|
|
578
606
|
if (atInstall === before)
|
|
579
607
|
return;
|
|
608
|
+
if (validateIgnorePolicy) {
|
|
609
|
+
await validateIgnorePolicy();
|
|
610
|
+
await assertUnexcludedTargets(journal.root, [entry.target], options);
|
|
611
|
+
await verifyTarget(directory, entry, journal, options, atRename === "missing");
|
|
612
|
+
}
|
|
613
|
+
options.validateMutation?.();
|
|
614
|
+
options.signal?.throwIfAborted();
|
|
580
615
|
await fs.rename(temporary, entry.target);
|
|
581
616
|
await syncDirectory(path.dirname(entry.target));
|
|
582
617
|
});
|
|
@@ -743,6 +778,13 @@ async function removeOwnedTarget(directory, entry, journal, options, { apply, re
|
|
|
743
778
|
await removeScopedImage(entry.target, current.scoped, options, validateIgnorePolicy);
|
|
744
779
|
}
|
|
745
780
|
else {
|
|
781
|
+
if (validateIgnorePolicy) {
|
|
782
|
+
await validateIgnorePolicy();
|
|
783
|
+
await assertUnexcludedTargets(journal.root, [entry.target], options);
|
|
784
|
+
await verifyTarget(directory, entry, journal, options);
|
|
785
|
+
}
|
|
786
|
+
options.validateMutation?.();
|
|
787
|
+
options.signal?.throwIfAborted();
|
|
746
788
|
await fs.rm(entry.target, { recursive: true, force: true });
|
|
747
789
|
}
|
|
748
790
|
await syncDirectory(path.dirname(entry.target));
|
|
@@ -797,7 +839,7 @@ async function completeTransaction(directory, journal) {
|
|
|
797
839
|
// may only retry cleanup, never roll back already accepted files.
|
|
798
840
|
await writeJson(path.join(directory, "journal.json"), {
|
|
799
841
|
...journal,
|
|
800
|
-
version: isScopedJournal(journal) ? journal.version : journal.sessionRootTransition ? 7 : 6,
|
|
842
|
+
version: isScopedJournal(journal) || journal.localPolicyKey ? journal.version : journal.sessionRootTransition ? 7 : 6,
|
|
801
843
|
completed: true,
|
|
802
844
|
}, {
|
|
803
845
|
maxBytes: MAX_TRANSACTION_JOURNAL_BYTES,
|
|
@@ -45,6 +45,7 @@ export async function resolveAgentPlan(ctx, options, config, backend, state, loc
|
|
|
45
45
|
1,
|
|
46
46
|
backend.identity,
|
|
47
47
|
syncConfigReviewIdentity(config),
|
|
48
|
+
...(config.configDocumentFingerprint ? [config.configDocumentFingerprint] : []),
|
|
48
49
|
syncStateFingerprint(state),
|
|
49
50
|
head.revision,
|
|
50
51
|
fileHashMap(localRaw),
|
|
@@ -66,8 +66,9 @@ export async function withAgentSyncLock(ctx, options, run) {
|
|
|
66
66
|
if (!(await confirmAgentRefusalRetry(ctx, options.setup, request.evidence, validate, options.signal)))
|
|
67
67
|
return "cancelled";
|
|
68
68
|
}
|
|
69
|
+
const reserve = background?.reserve;
|
|
69
70
|
const raw = cached === undefined || retry
|
|
70
|
-
? await runAgentResolver(ctx, request.evidence, validate, options.signal,
|
|
71
|
+
? await runAgentResolver(ctx, request.evidence, validate, options.signal, reserve ? (signal) => reserve(request.key, signal) : undefined)
|
|
71
72
|
: JSON.stringify(cached);
|
|
72
73
|
let candidate;
|
|
73
74
|
try {
|
|
@@ -84,6 +85,12 @@ export async function withAgentSyncLock(ctx, options, run) {
|
|
|
84
85
|
await withLock("agent-cache-save", async () => {
|
|
85
86
|
await assertOwner();
|
|
86
87
|
options.signal?.throwIfAborted();
|
|
88
|
+
if (background) {
|
|
89
|
+
background.validate();
|
|
90
|
+
await request.validate(options.signal);
|
|
91
|
+
options.signal?.throwIfAborted();
|
|
92
|
+
background.validate();
|
|
93
|
+
}
|
|
87
94
|
await saveAgentCandidate(request.key, candidate);
|
|
88
95
|
});
|
|
89
96
|
let retryCacheCommitted = false;
|
|
@@ -37,7 +37,7 @@ export function createContinuousSync(loaders, clock = systemClock, publish) {
|
|
|
37
37
|
let task;
|
|
38
38
|
return {
|
|
39
39
|
// A setup name binds retry to the configuration loaded after asynchronous eligibility checks.
|
|
40
|
-
start(ctx, sessionSignal, explicitRetry = false, debug = false) {
|
|
40
|
+
start(ctx, sessionSignal, explicitRetry = false, debug = false, transfer) {
|
|
41
41
|
if ((!ctx.backgroundAuthorized?.() && (!ctx.hasUI || (ctx.mode !== "tui" && ctx.mode !== "rpc"))) ||
|
|
42
42
|
sessionSignal.aborted ||
|
|
43
43
|
task)
|
|
@@ -68,7 +68,7 @@ export function createContinuousSync(loaders, clock = systemClock, publish) {
|
|
|
68
68
|
let explicit = explicitRetry;
|
|
69
69
|
while (!signal.aborted) {
|
|
70
70
|
try {
|
|
71
|
-
await run(ctx, signal, explicit, startup);
|
|
71
|
+
await run(ctx, signal, explicit, startup, transfer);
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
catch {
|
|
@@ -112,12 +112,12 @@ export function createContinuousSync(loaders, clock = systemClock, publish) {
|
|
|
112
112
|
await current.promise;
|
|
113
113
|
},
|
|
114
114
|
};
|
|
115
|
-
async function run(ctx, signal, explicitRetry, startup) {
|
|
115
|
+
async function run(ctx, signal, explicitRetry, startup, transfer) {
|
|
116
116
|
const validateOwner = captureMutationOwner(ctx, signal);
|
|
117
117
|
try {
|
|
118
118
|
while (!signal.aborted) {
|
|
119
119
|
validateOwner();
|
|
120
|
-
const config = await loadConfigForCheck();
|
|
120
|
+
const config = await loadConfigForCheck(undefined, signal);
|
|
121
121
|
validateOwner();
|
|
122
122
|
if (!continuousEnabled(config) || (ctx.backgroundAuthorized && !ctx.backgroundAuthorized(config)))
|
|
123
123
|
return;
|
|
@@ -135,7 +135,7 @@ export function createContinuousSync(loaders, clock = systemClock, publish) {
|
|
|
135
135
|
});
|
|
136
136
|
if (lease) {
|
|
137
137
|
const retry = typeof explicitRetry === "string" ? explicitRetry === config.setupName : explicitRetry;
|
|
138
|
-
await monitor(ctx, config, binding, lease, signal, retry, startup);
|
|
138
|
+
await monitor(ctx, config, binding, lease, signal, retry, startup, transfer);
|
|
139
139
|
explicitRetry = false;
|
|
140
140
|
}
|
|
141
141
|
else
|
|
@@ -158,7 +158,7 @@ export function createContinuousSync(loaders, clock = systemClock, publish) {
|
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
validateOwner();
|
|
161
|
-
const current = await loadConfigForCheck();
|
|
161
|
+
const current = await loadConfigForCheck(undefined, signal);
|
|
162
162
|
if (!continuousEnabled(current) || (ctx.backgroundAuthorized && !ctx.backgroundAuthorized(current)))
|
|
163
163
|
return;
|
|
164
164
|
validateOwner();
|
|
@@ -178,7 +178,7 @@ export function createContinuousSync(loaders, clock = systemClock, publish) {
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
async function monitor(ctx, initial, binding, lease, parent, explicitRetry, startup) {
|
|
181
|
+
async function monitor(ctx, initial, binding, lease, parent, explicitRetry, startup, transfer) {
|
|
182
182
|
const signal = AbortSignal.any([parent, lease.signal]);
|
|
183
183
|
const validateOwner = captureMutationOwner(ctx, signal);
|
|
184
184
|
let config = initial;
|
|
@@ -220,7 +220,7 @@ export function createContinuousSync(loaders, clock = systemClock, publish) {
|
|
|
220
220
|
validate();
|
|
221
221
|
while (!signal.aborted && ctx.isIdle()) {
|
|
222
222
|
validate();
|
|
223
|
-
const latest = await loadConfigForCheck();
|
|
223
|
+
const latest = await loadConfigForCheck(undefined, signal);
|
|
224
224
|
validate();
|
|
225
225
|
if (!continuousEnabled(latest) ||
|
|
226
226
|
(ctx.backgroundAuthorized && !ctx.backgroundAuthorized(latest)) ||
|
|
@@ -228,6 +228,9 @@ export function createContinuousSync(loaders, clock = systemClock, publish) {
|
|
|
228
228
|
return;
|
|
229
229
|
validate();
|
|
230
230
|
if (syncCheckConfigFingerprint(latest) !== syncCheckConfigFingerprint(config)) {
|
|
231
|
+
if (config.reservedIgnoreNames !== undefined || latest.reservedIgnoreNames !== undefined)
|
|
232
|
+
return;
|
|
233
|
+
explicitRetry = false;
|
|
231
234
|
closeWatch();
|
|
232
235
|
config = latest;
|
|
233
236
|
closeWatch = await openWatch();
|
|
@@ -289,7 +292,7 @@ export function createContinuousSync(loaders, clock = systemClock, publish) {
|
|
|
289
292
|
return;
|
|
290
293
|
try {
|
|
291
294
|
validate();
|
|
292
|
-
const latest = await loadConfigForCheck();
|
|
295
|
+
const latest = await loadConfigForCheck(undefined, guardSignal);
|
|
293
296
|
if (guardSignal.aborted)
|
|
294
297
|
return;
|
|
295
298
|
validateCycle(latest);
|
|
@@ -300,7 +303,7 @@ export function createContinuousSync(loaders, clock = systemClock, publish) {
|
|
|
300
303
|
}
|
|
301
304
|
})().catch(() => { });
|
|
302
305
|
try {
|
|
303
|
-
await performCycle(ctx, config, binding, lease, AbortSignal.any([signal, cycle.signal]), validateCycle, configuration, force, timings);
|
|
306
|
+
await performCycle(ctx, config, binding, lease, AbortSignal.any([signal, cycle.signal]), validateCycle, configuration, force, timings, transfer);
|
|
304
307
|
outcome = "completed";
|
|
305
308
|
}
|
|
306
309
|
catch (error) {
|
|
@@ -370,11 +373,15 @@ export function createContinuousSync(loaders, clock = systemClock, publish) {
|
|
|
370
373
|
cycle?.abort();
|
|
371
374
|
}
|
|
372
375
|
}
|
|
373
|
-
async function performCycle(ctx, config, binding, lease, signal, validateOwner, configuration, force, timings) {
|
|
376
|
+
async function performCycle(ctx, config, binding, lease, signal, validateOwner, configuration, force, timings, transfer) {
|
|
374
377
|
const validate = (latest) => {
|
|
375
378
|
signal.throwIfAborted();
|
|
376
379
|
validateOwner(latest);
|
|
377
380
|
};
|
|
381
|
+
const refresh = async () => {
|
|
382
|
+
validate();
|
|
383
|
+
validate(await loadConfigForCheck(undefined, signal));
|
|
384
|
+
};
|
|
378
385
|
validate();
|
|
379
386
|
const current = await readContinuousRecord(binding);
|
|
380
387
|
validate();
|
|
@@ -398,8 +405,9 @@ export function createContinuousSync(loaders, clock = systemClock, publish) {
|
|
|
398
405
|
const validateIgnore = ignorePolicyValidator({ ...snapshotOptions, validateMutation: validate });
|
|
399
406
|
if (validateIgnore)
|
|
400
407
|
await validateIgnore();
|
|
408
|
+
await refresh();
|
|
401
409
|
const inspection = await inspectionModule.inspectSync(config, snapshotOptions, signal, undefined, timings);
|
|
402
|
-
|
|
410
|
+
await refresh();
|
|
403
411
|
let localIdentity = inspection.localIdentity;
|
|
404
412
|
if (!localIdentity) {
|
|
405
413
|
const snapshotModule = await loaders.snapshot();
|
|
@@ -455,7 +463,7 @@ export function createContinuousSync(loaders, clock = systemClock, publish) {
|
|
|
455
463
|
const operations = await timings.measure("operations import", () => loaders.operations());
|
|
456
464
|
validate();
|
|
457
465
|
setSyncStatus(ctx, "sync syncing", { activity: "working" });
|
|
458
|
-
const
|
|
466
|
+
const runTransfer = (onCommit) => withStateDirectoryAccess(() => withAgentSyncLock(ctx, {
|
|
459
467
|
args: [],
|
|
460
468
|
yes: true,
|
|
461
469
|
force: false,
|
|
@@ -465,11 +473,20 @@ export function createContinuousSync(loaders, clock = systemClock, publish) {
|
|
|
465
473
|
auto: true,
|
|
466
474
|
signal,
|
|
467
475
|
startupTimings: timings,
|
|
476
|
+
onCommit,
|
|
468
477
|
background: {
|
|
469
478
|
validate,
|
|
470
|
-
reserve: (key, requestSignal) =>
|
|
479
|
+
reserve: async (key, requestSignal) => {
|
|
480
|
+
await refresh();
|
|
481
|
+
await reserveContinuousRequest(binding, lease, key, () => clock.now(), requestSignal);
|
|
482
|
+
await refresh();
|
|
483
|
+
},
|
|
471
484
|
},
|
|
472
|
-
}, (options) =>
|
|
485
|
+
}, async (options) => {
|
|
486
|
+
await refresh();
|
|
487
|
+
return operations.syncBoth(ctx, options);
|
|
488
|
+
}));
|
|
489
|
+
const result = await timings.measure("automatic transfer", () => transfer ? transfer(runTransfer) : runTransfer());
|
|
473
490
|
validate();
|
|
474
491
|
transferred = result === "applied";
|
|
475
492
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { stageMergeBaseline } from "../state/merge-baseline-store.js";
|
|
2
|
+
import { syncStateFingerprint, writeStateForConfig } from "../state/sync-state-store.js";
|
|
3
|
+
import { portableSnapshot } from "./local-fields.js";
|
|
4
|
+
import { progressState } from "./partial-progress.js";
|
|
5
|
+
import { acceptedSelection, fileHashMap } from "./sync-state.js";
|
|
6
|
+
export function matchesAcceptedState(state, config, head, snapshot, progress) {
|
|
7
|
+
return [true, false].some((canonical) => syncStateFingerprint(state) === syncStateFingerprint(acceptedState(config, head, snapshot, progress, canonical)));
|
|
8
|
+
}
|
|
9
|
+
export function acceptedState(config, head, snapshot, progress, canonical = true) {
|
|
10
|
+
if (progress)
|
|
11
|
+
return progressState(config, head, snapshot, progress);
|
|
12
|
+
return {
|
|
13
|
+
version: 1,
|
|
14
|
+
profile: config.snapshotIdentity,
|
|
15
|
+
lastAppliedSnapshot: head.snapshotId,
|
|
16
|
+
lastRemoteRevision: head.revision,
|
|
17
|
+
lastFileHashes: fileHashMap(canonical ? portableSnapshot(snapshot, config.localFields) : snapshot),
|
|
18
|
+
...acceptedSelection(config),
|
|
19
|
+
...(config.localFields !== undefined ? { localFields: config.localFields } : {}),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export async function writeAcceptedState(config, head, snapshot, validate, progress) {
|
|
23
|
+
const accepted = portableSnapshot(snapshot, config.localFields);
|
|
24
|
+
const state = acceptedState(config, head, accepted, progress);
|
|
25
|
+
await stageMergeBaseline(config, accepted, state, progress?.previous);
|
|
26
|
+
await validate();
|
|
27
|
+
await writeStateForConfig(config, state);
|
|
28
|
+
await validate();
|
|
29
|
+
}
|
|
@@ -258,7 +258,7 @@ export async function applyMergedSnapshot(before, after, protectedPaths, options
|
|
|
258
258
|
if (options.scope === "agent-directory" && options.sessionDir === undefined) {
|
|
259
259
|
options = {
|
|
260
260
|
...options,
|
|
261
|
-
sessionDir: sessionStorageRoot(root, await agentDirectoryConfiguredSessionDir(options.signal, root)),
|
|
261
|
+
sessionDir: sessionStorageRoot(root, await agentDirectoryConfiguredSessionDir(options.signal, root, options)),
|
|
262
262
|
};
|
|
263
263
|
options.validateMutation?.();
|
|
264
264
|
options.signal?.throwIfAborted();
|
|
@@ -282,8 +282,7 @@ export async function applyMergedSnapshot(before, after, protectedPaths, options
|
|
|
282
282
|
const targetSet = new Set(targets);
|
|
283
283
|
await assertDistinctMergedTargets(root, paths, new Set(changed), options, protectedTarget, new Set(Object.keys(afterHashes)));
|
|
284
284
|
await assertCanonicalMutationTargets(targets, options);
|
|
285
|
-
|
|
286
|
-
await assertUnexcludedTargets(root, targets, options);
|
|
285
|
+
await assertUnexcludedTargets(root, targets, options);
|
|
287
286
|
// Existing case aliases share Pi's non-reentrant realpath queue. Reserve the
|
|
288
287
|
// missing destination separately only after deleting its reviewed preimage.
|
|
289
288
|
const targetsByQueue = new Map();
|
|
@@ -383,6 +382,8 @@ export async function applyMergedSnapshot(before, after, protectedPaths, options
|
|
|
383
382
|
const removedTargets = new Set([...removed].map((item) => snapshotTarget(root, item, options.sessionDir)));
|
|
384
383
|
await assertCanonicalMergedTargets(root, changed, options);
|
|
385
384
|
await validate();
|
|
385
|
+
if (options.validateApplyReview)
|
|
386
|
+
await options.validateApplyReview();
|
|
386
387
|
const requireReviewedHash = (relative, hash) => {
|
|
387
388
|
if (hash !== beforeHashes[relative] && hash !== afterHashes[relative])
|
|
388
389
|
throw new Error("Local content changed at the apply boundary; journal retained, newer bytes untouched.");
|
|
@@ -392,7 +393,7 @@ export async function applyMergedSnapshot(before, after, protectedPaths, options
|
|
|
392
393
|
const relative = relativeByTarget.get(target);
|
|
393
394
|
if (!relative)
|
|
394
395
|
throw new Error("Unowned merge target.");
|
|
395
|
-
if (options.scope === "agent-directory") {
|
|
396
|
+
if (validateIgnore || options.scope === "agent-directory") {
|
|
396
397
|
await assertCanonicalMutationTargets([target], options);
|
|
397
398
|
await assertUnexcludedTargets(root, [target], options);
|
|
398
399
|
}
|
|
@@ -475,6 +476,8 @@ export async function applyMergedSnapshot(before, after, protectedPaths, options
|
|
|
475
476
|
// Writers registered after deletion must finish first; never accept their
|
|
476
477
|
// bytes as our own, even if they match a recognizable pre/postimage.
|
|
477
478
|
await requireAbsentDestinations();
|
|
479
|
+
if (deferredTargets.length && options.validateApplyReview)
|
|
480
|
+
await options.validateApplyReview();
|
|
478
481
|
if (validateIgnore)
|
|
479
482
|
await validateIgnore();
|
|
480
483
|
await writeTargets();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { assertRecoveryPolicy, IGNORE_POLICY_JOURNAL_VERSION, ignorePolicyValidator, ignoreSourceBinding, validateJournalPolicy, } from "../snapshot/snapshot-transaction-policy.js";
|
|
4
|
+
import { assertRecoveryPolicy, BOUND_DIRECTORY_JOURNAL_VERSION, IGNORE_POLICY_JOURNAL_VERSION, ignorePolicyValidator, ignoreSourceBinding, recoveryPolicyKey, validateJournalPolicy, } from "../snapshot/snapshot-transaction-policy.js";
|
|
5
5
|
import { IGNORE_SNAPSHOT_VERSION } from "../snapshot/snapshot-types.js";
|
|
6
6
|
import { readJsonIfExists, syncDirectory, writeJson } from "../state/json-file.js";
|
|
7
7
|
import { readStateForConfig, statePathForConfig, syncStateFingerprint } from "../state/sync-state-store.js";
|
|
@@ -10,24 +10,30 @@ import { safeTerminalText } from "../ui/terminal-text.js";
|
|
|
10
10
|
import { normalizeSyncExclude } from "./exclude-policy.js";
|
|
11
11
|
import { planFileMerge } from "./file-merge-planner.js";
|
|
12
12
|
import { portableSnapshot, sameLocalFields, validatePortableSnapshot, validateSnapshotFieldPolicy, } from "./local-fields.js";
|
|
13
|
-
import { configuredSnapshotPathMatcher, sameSnapshotSelection, syncDirectoryPolicyKey, validateSnapshotSelection, } from "./sync-policy.js";
|
|
13
|
+
import { compileSyncPolicyExclude, configuredSnapshotPathMatcher, sameSnapshotSelection, syncDirectoryPolicyKey, validateSnapshotSelection, } from "./sync-policy.js";
|
|
14
14
|
import { fileHashMap, sameHashes } from "./sync-state.js";
|
|
15
15
|
export function mergeJournalPolicy(config) {
|
|
16
|
-
|
|
16
|
+
const localPolicyKey = recoveryPolicyKey(config);
|
|
17
|
+
const ignoreSource = config.ignorePolicy ? ignoreSourceBinding(config.ignorePolicy) : undefined;
|
|
18
|
+
if (localPolicyKey)
|
|
19
|
+
return { version: 3, localPolicyKey, ...(ignoreSource ? { ignoreSource } : {}) };
|
|
20
|
+
return ignoreSource ? { version: 2, ignoreSource } : { version: 1 };
|
|
17
21
|
}
|
|
18
22
|
function ignoreRecoveryPolicy(journal) {
|
|
19
23
|
return {
|
|
20
|
-
version: IGNORE_POLICY_JOURNAL_VERSION,
|
|
24
|
+
version: journal.version === 3 ? BOUND_DIRECTORY_JOURNAL_VERSION : IGNORE_POLICY_JOURNAL_VERSION,
|
|
21
25
|
ignoreSource: journal.ignoreSource,
|
|
26
|
+
localPolicyKey: journal.localPolicyKey,
|
|
22
27
|
selection: journal.upload.selection,
|
|
23
28
|
};
|
|
24
29
|
}
|
|
25
30
|
export function assertMergeJournalPolicy(journal, config) {
|
|
31
|
+
if (journal.localPolicyKey !== recoveryPolicyKey(config))
|
|
32
|
+
throw new Error("Pending merge lacks matching setup or ignore-file policy evidence; preserve its journal for reviewed recovery.");
|
|
26
33
|
if (journal.version === 1 && !config.ignorePolicy && config.pathPolicy !== "ignore-file")
|
|
27
34
|
return;
|
|
28
|
-
if (journal.
|
|
29
|
-
|
|
30
|
-
assertRecoveryPolicy(ignoreRecoveryPolicy(journal), config);
|
|
35
|
+
if (journal.ignoreSource || config.ignorePolicy || config.pathPolicy === "ignore-file")
|
|
36
|
+
assertRecoveryPolicy(ignoreRecoveryPolicy(journal), config);
|
|
31
37
|
try {
|
|
32
38
|
const identity = JSON.parse(journal.identity);
|
|
33
39
|
if (!Array.isArray(identity) ||
|
|
@@ -39,17 +45,21 @@ export function assertMergeJournalPolicy(journal, config) {
|
|
|
39
45
|
throw new Error("Pending merge belongs to a different setup or local policy; preserve its journal.");
|
|
40
46
|
}
|
|
41
47
|
const configured = configuredSnapshotPathMatcher(config);
|
|
48
|
+
const excluded = compileSyncPolicyExclude(config);
|
|
49
|
+
if (!journal.applyOnly && journal.upload.files.some((file) => excluded(file.path)))
|
|
50
|
+
throw new Error("Pending publication contains protected paths; preserve its journal.");
|
|
42
51
|
for (const snapshot of [
|
|
43
52
|
journal.before,
|
|
44
53
|
journal.after,
|
|
45
54
|
journal.accepted,
|
|
46
|
-
journal.applyOnly ?
|
|
55
|
+
journal.ignoreSource && !journal.applyOnly ? journal.upload : undefined,
|
|
47
56
|
]) {
|
|
48
57
|
if (snapshot?.files.some((file) => !configured(file.path)))
|
|
49
58
|
throw new Error("Pending merge contains paths outside the current ignore-file policy; preserve its journal.");
|
|
50
59
|
}
|
|
51
60
|
}
|
|
52
61
|
export function mergeJournalIdentity(config, backendIdentity) {
|
|
62
|
+
const localPolicyKey = recoveryPolicyKey(config);
|
|
53
63
|
return JSON.stringify([
|
|
54
64
|
config.setupName,
|
|
55
65
|
backendIdentity,
|
|
@@ -60,6 +70,7 @@ export function mergeJournalIdentity(config, backendIdentity) {
|
|
|
60
70
|
: config.exclude === undefined
|
|
61
71
|
? []
|
|
62
72
|
: ["exclude", normalizeSyncExclude(config.exclude).map((rule) => rule.toLowerCase())]),
|
|
73
|
+
...(localPolicyKey ? [localPolicyKey] : []),
|
|
63
74
|
]);
|
|
64
75
|
}
|
|
65
76
|
export function mergeJournalPath(config) {
|
|
@@ -82,8 +93,12 @@ export async function readMergeJournal(config) {
|
|
|
82
93
|
if (journal === undefined)
|
|
83
94
|
return;
|
|
84
95
|
if (!journal ||
|
|
85
|
-
|
|
96
|
+
![1, 2, 3].includes(journal.version) ||
|
|
86
97
|
(journal.version === 1 && journal.ignoreSource !== undefined) ||
|
|
98
|
+
(journal.version === 2 && !journal.ignoreSource) ||
|
|
99
|
+
(journal.version === 3
|
|
100
|
+
? typeof journal.localPolicyKey !== "string" || !/^[0-9a-f]{64}$/u.test(journal.localPolicyKey)
|
|
101
|
+
: journal.localPolicyKey !== undefined) ||
|
|
87
102
|
typeof journal.identity !== "string" ||
|
|
88
103
|
typeof journal.backup !== "string" ||
|
|
89
104
|
typeof journal.stateIdentity !== "string" ||
|
|
@@ -112,7 +127,7 @@ export async function readMergeJournal(config) {
|
|
|
112
127
|
throw new Error("Unsupported or damaged merge journal; preserve it and review recovery before syncing.");
|
|
113
128
|
// Verify every path and byte, including the unmanaged remote files retained for publication.
|
|
114
129
|
try {
|
|
115
|
-
if (journal.
|
|
130
|
+
if (journal.ignoreSource !== undefined) {
|
|
116
131
|
validateJournalPolicy(ignoreRecoveryPolicy(journal));
|
|
117
132
|
if ([journal.expectedHead.selection, journal.committedHead?.selection].some((selection) => selection !== undefined && !sameSnapshotSelection(selection, journal.upload.selection)))
|
|
118
133
|
throw new Error("Inconsistent merge head policy.");
|
|
@@ -126,7 +141,7 @@ export async function readMergeJournal(config) {
|
|
|
126
141
|
]) {
|
|
127
142
|
validateSnapshotFieldPolicy(snapshot);
|
|
128
143
|
validateSnapshotSelection(snapshot);
|
|
129
|
-
if ((journal.
|
|
144
|
+
if ((journal.ignoreSource !== undefined
|
|
130
145
|
? snapshot.version !== IGNORE_SNAPSHOT_VERSION ||
|
|
131
146
|
!sameSnapshotSelection(snapshot.selection, journal.upload.selection)
|
|
132
147
|
: ![1, 2, 3, 4, 5].includes(snapshot.version)) ||
|
|
@@ -230,7 +245,7 @@ export async function retireMergeJournal(config) {
|
|
|
230
245
|
const validateIgnore = ignorePolicyValidator(config);
|
|
231
246
|
if (validateIgnore)
|
|
232
247
|
await validateIgnore();
|
|
233
|
-
if (journal.
|
|
248
|
+
if (journal.ignoreSource)
|
|
234
249
|
throw new Error(ignoreMergeRecoveryGuidance);
|
|
235
250
|
await archiveMergeJournal(config);
|
|
236
251
|
}
|
|
@@ -262,9 +277,13 @@ export async function reviewInactiveIgnoreMerge(ctx, config, backend, journal, h
|
|
|
262
277
|
const latest = await backend.readHead(options.signal);
|
|
263
278
|
if (!isCurrent())
|
|
264
279
|
return "cancelled";
|
|
265
|
-
|
|
280
|
+
await validateFresh();
|
|
281
|
+
if (!sameMergeRecoveryHead(backend, head, latest) ||
|
|
282
|
+
syncStateFingerprint(state) !== journal.stateIdentity ||
|
|
283
|
+
syncStateFingerprint(await readStateForConfig(config)) !== journal.stateIdentity) {
|
|
266
284
|
throw new Error("Remote head or sync baseline changed during recovery review; journal and backup retained.");
|
|
267
285
|
}
|
|
286
|
+
await validateFresh();
|
|
268
287
|
await archiveMergeJournal(config);
|
|
269
288
|
if (!options.silent && isCurrent())
|
|
270
289
|
ctx.ui.notify("Archived the inactive merge journal. Local files, remote files, baseline and backup were kept. Run Sync now again for a fresh plan.", "info");
|
|
@@ -287,7 +306,7 @@ export async function requireNoMergeJournal(config, options = {}) {
|
|
|
287
306
|
const validateIgnore = ignorePolicyValidator(config);
|
|
288
307
|
if (validateIgnore)
|
|
289
308
|
await validateIgnore();
|
|
290
|
-
if (journal.
|
|
309
|
+
if (journal.ignoreSource)
|
|
291
310
|
throw new Error(ignoreMergeRecoveryGuidance);
|
|
292
311
|
if (!options.force) {
|
|
293
312
|
throw new Error("A merged transfer needs recovery. Run /sync sync to reconcile it. If newer local edits or remote revisions prevent recovery, review /sync diff and explicitly choose push --force or pull --force; the selected directional result will archive the old journal, not restore old bytes. Keep its backup; do not downgrade while recovery is pending.");
|