@narumitw/pi-sync 0.67.3 → 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.
Files changed (174) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +26 -48
  3. package/dist/chunks/{chunk-XUZV4OGI.ts → chunk-335XTMMZ.ts} +3 -2
  4. package/dist/chunks/{chunk-XUZV4OGI.ts.map → chunk-335XTMMZ.ts.map} +2 -2
  5. package/dist/chunks/{chunk-PUSMSKIM.ts → chunk-AYGMIMCV.ts} +2 -11
  6. package/dist/chunks/chunk-AYGMIMCV.ts.map +7 -0
  7. package/dist/chunks/{chunk-HLJIRWFL.ts → chunk-BCDBT4X3.ts} +7 -7
  8. package/dist/chunks/{chunk-AVTW6WNP.ts → chunk-FQKWGVMA.ts} +20 -54
  9. package/dist/chunks/chunk-FQKWGVMA.ts.map +7 -0
  10. package/dist/chunks/{chunk-DGVZYS7T.ts → chunk-FR6A7ASZ.ts} +8 -11
  11. package/dist/chunks/chunk-FR6A7ASZ.ts.map +7 -0
  12. package/dist/chunks/{chunk-3NS4PMCI.ts → chunk-J52GYZO6.ts} +2 -8
  13. package/dist/chunks/{chunk-3NS4PMCI.ts.map → chunk-J52GYZO6.ts.map} +2 -2
  14. package/dist/chunks/{chunk-2MUAR5GH.ts → chunk-KAIVTJIQ.ts} +7 -10
  15. package/dist/chunks/chunk-KAIVTJIQ.ts.map +7 -0
  16. package/dist/chunks/{chunk-WBIOSK76.ts → chunk-R7PN3KIY.ts} +1 -2
  17. package/dist/chunks/{chunk-3Q3DMMID.ts → chunk-TLYT6HVI.ts} +8 -8
  18. package/dist/chunks/{chunk-X344HTVV.ts → chunk-WCGLU526.ts} +39 -118
  19. package/dist/chunks/chunk-WCGLU526.ts.map +7 -0
  20. package/dist/chunks/{chunk-JREGWM2B.ts → chunk-XNUARYLR.ts} +1 -2
  21. package/dist/chunks/{chunk-CQ4DMLH3.ts → chunk-YV2R5SJU.ts} +21 -81
  22. package/dist/chunks/chunk-YV2R5SJU.ts.map +7 -0
  23. package/dist/chunks/{command-handler-WF2TDDRZ.ts → command-handler-S6BRZMPW.ts} +64 -59
  24. package/dist/chunks/command-handler-S6BRZMPW.ts.map +7 -0
  25. package/dist/chunks/{conflict-review-GWEL4S6C.ts → conflict-review-3XMYDJIK.ts} +2 -2
  26. package/dist/chunks/{file-selection-GASCVN45.ts → file-selection-4BOQBXS7.ts} +10 -17
  27. package/dist/chunks/file-selection-4BOQBXS7.ts.map +7 -0
  28. package/dist/chunks/{manager-result-dispatcher-BXN46NRC.ts → manager-result-dispatcher-A4IWLS4J.ts} +7 -7
  29. package/dist/chunks/{manager-ui-FS4QIKRA.ts → manager-ui-KHMCSLLV.ts} +114 -581
  30. package/dist/chunks/manager-ui-KHMCSLLV.ts.map +7 -0
  31. package/dist/chunks/{chunk-ECUCXF5Y.ts → merge-review-LWMUE5IW.ts} +2 -3
  32. package/dist/chunks/{remote-selection-ui-DOYKUMER.ts → remote-selection-ui-F6NJBQ3Y.ts} +6 -6
  33. package/dist/chunks/{setup-switch-JZDFQPVW.ts → setup-switch-7LMIRMZ7.ts} +6 -6
  34. package/dist/chunks/{setup-wizard-PI45SF2C.ts → setup-wizard-2NRPR433.ts} +11 -16
  35. package/dist/chunks/{setup-wizard-PI45SF2C.ts.map → setup-wizard-2NRPR433.ts.map} +1 -1
  36. package/dist/chunks/{sync-inspection-DI5J6EUH.ts → sync-inspection-QGM54YCM.ts} +5 -5
  37. package/dist/chunks/{sync-operations-AGNL7QXA.ts → sync-operations-DTQMKVRQ.ts} +2 -2
  38. package/dist/daemon/dist/build-id.json +1 -1
  39. package/dist/daemon/dist/cli.js +22 -3
  40. package/dist/daemon/dist/client-transport.js +2 -0
  41. package/dist/daemon/dist/client.js +2 -10
  42. package/dist/daemon/dist/consent.js +13 -135
  43. package/dist/daemon/dist/engine/backends/git/git-backend.js +4 -17
  44. package/dist/daemon/dist/engine/backends/git/git-storage.js +11 -44
  45. package/dist/daemon/dist/engine/backends/s3/s3-backend.js +6 -6
  46. package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +6 -6
  47. package/dist/daemon/dist/engine/settings/config.js +16 -149
  48. package/dist/daemon/dist/engine/settings/retired-ignore-policy.js +16 -0
  49. package/dist/daemon/dist/engine/settings/retired-ignore-recovery.js +14 -0
  50. package/dist/daemon/dist/engine/settings/settings-management.js +2 -10
  51. package/dist/daemon/dist/engine/settings/settings-validation.js +8 -21
  52. package/dist/daemon/dist/engine/snapshot/session-paths.js +13 -41
  53. package/dist/daemon/dist/engine/snapshot/snapshot-apply.js +8 -24
  54. package/dist/daemon/dist/engine/snapshot/snapshot-codec.js +7 -11
  55. package/dist/daemon/dist/engine/snapshot/snapshot-exclude-safety.js +19 -76
  56. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-images.js +1 -7
  57. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-policy.js +8 -102
  58. package/dist/daemon/dist/engine/snapshot/snapshot-transaction.js +20 -100
  59. package/dist/daemon/dist/engine/snapshot/snapshot-types.js +1 -11
  60. package/dist/daemon/dist/engine/snapshot/snapshot.js +26 -78
  61. package/dist/daemon/dist/engine/state/sync-state-store.js +5 -1
  62. package/dist/daemon/dist/engine/sync/agent-plan.js +0 -1
  63. package/dist/daemon/dist/engine/sync/agent-policy.js +1 -1
  64. package/dist/daemon/dist/engine/sync/conflict-review.js +0 -2
  65. package/dist/daemon/dist/engine/sync/continuous-sync.js +2 -17
  66. package/dist/daemon/dist/engine/sync/continuous-watch.js +3 -7
  67. package/dist/daemon/dist/engine/sync/directional-action.js +3 -21
  68. package/dist/daemon/dist/engine/sync/initialization.js +4 -15
  69. package/dist/daemon/dist/engine/sync/local-fields.js +4 -65
  70. package/dist/daemon/dist/engine/sync/merge-apply.js +8 -31
  71. package/dist/daemon/dist/engine/sync/merge-journal.js +8 -118
  72. package/dist/daemon/dist/engine/sync/merged-sync.js +12 -70
  73. package/dist/daemon/dist/engine/sync/push-review.js +1 -16
  74. package/dist/daemon/dist/engine/sync/remote-snapshot.js +48 -65
  75. package/dist/daemon/dist/engine/sync/startup-bootstrap.js +3 -3
  76. package/dist/daemon/dist/engine/sync/sync-error-guidance.js +1 -1
  77. package/dist/daemon/dist/engine/sync/sync-inspection.js +1 -2
  78. package/dist/daemon/dist/engine/sync/sync-mutations.js +25 -118
  79. package/dist/daemon/dist/engine/sync/sync-policy.js +26 -150
  80. package/dist/daemon/dist/engine/sync/sync-queries.js +1 -8
  81. package/dist/daemon/dist/engine/sync/sync-rollback.js +12 -50
  82. package/dist/daemon/dist/engine/sync/sync-state.js +2 -15
  83. package/dist/daemon/dist/engine/sync/transfer-freshness.js +7 -17
  84. package/dist/daemon/dist/engine/sync/transfer-size-limits.js +3 -7
  85. package/dist/daemon/dist/engine-service.js +60 -219
  86. package/dist/daemon/dist/foreground-queue-outcome.js +0 -4
  87. package/dist/daemon/dist/legacy-consent-guard.js +34 -0
  88. package/dist/daemon/dist/server.js +4 -8
  89. package/dist/daemon/dist/service-host.js +3 -9
  90. package/dist/daemon/package.json +1 -1
  91. package/dist/index.ts +45 -46
  92. package/dist/index.ts.map +3 -3
  93. package/docs/continuous-sync-verification.md +1 -1
  94. package/docs/daemon-migration.md +7 -5
  95. package/docs/tui-contract.md +4 -6
  96. package/package.json +2 -3
  97. package/skills/configure-pi-sync/SKILL.md +18 -77
  98. package/skills/configure-pi-sync/references/configuration.md +58 -75
  99. package/src/commands/command-execution.ts +13 -29
  100. package/src/commands/command-handler.ts +0 -4
  101. package/src/commands/command.ts +2 -1
  102. package/src/daemon/directional-recovery.ts +4 -33
  103. package/src/daemon/pi-client.ts +20 -88
  104. package/src/settings/config.ts +0 -1
  105. package/src/sync/setup-switch.ts +1 -4
  106. package/src/sync-extension.ts +10 -24
  107. package/src/ui/cancellable-operation.ts +2 -13
  108. package/src/ui/excluded-paths-ui.ts +1 -4
  109. package/src/ui/file-selection.ts +0 -5
  110. package/src/ui/manager-state.ts +12 -75
  111. package/src/ui/manager-ui.ts +7 -96
  112. package/src/ui/remote-selection-ui.ts +29 -130
  113. package/src/ui/settings-ui.ts +169 -388
  114. package/src/ui/setup/setup-actions.ts +4 -16
  115. package/src/ui/setup/setup-prompts.ts +12 -49
  116. package/src/ui/setup/setup-switcher.ts +8 -14
  117. package/src/ui/storage-connections-ui.ts +21 -32
  118. package/src/ui/sync-setups-ui.ts +27 -53
  119. package/dist/chunks/chunk-2MUAR5GH.ts.map +0 -7
  120. package/dist/chunks/chunk-33EDXDLC.ts +0 -106
  121. package/dist/chunks/chunk-33EDXDLC.ts.map +0 -7
  122. package/dist/chunks/chunk-AVTW6WNP.ts.map +0 -7
  123. package/dist/chunks/chunk-CQ4DMLH3.ts.map +0 -7
  124. package/dist/chunks/chunk-DGVZYS7T.ts.map +0 -7
  125. package/dist/chunks/chunk-EJDDRS6O.ts +0 -17
  126. package/dist/chunks/chunk-EJDDRS6O.ts.map +0 -7
  127. package/dist/chunks/chunk-KNEUL4XN.ts +0 -30
  128. package/dist/chunks/chunk-KNEUL4XN.ts.map +0 -7
  129. package/dist/chunks/chunk-PUSMSKIM.ts.map +0 -7
  130. package/dist/chunks/chunk-WFBHWYI6.ts +0 -18
  131. package/dist/chunks/chunk-WFBHWYI6.ts.map +0 -7
  132. package/dist/chunks/chunk-X344HTVV.ts.map +0 -7
  133. package/dist/chunks/command-handler-WF2TDDRZ.ts.map +0 -7
  134. package/dist/chunks/config-P54GGMXY.ts +0 -39
  135. package/dist/chunks/continuous-record-3SKJ6I3V.ts +0 -23
  136. package/dist/chunks/continuous-record-3SKJ6I3V.ts.map +0 -7
  137. package/dist/chunks/continuous-storage-3EU6I7Z3.ts +0 -27
  138. package/dist/chunks/continuous-storage-3EU6I7Z3.ts.map +0 -7
  139. package/dist/chunks/file-selection-GASCVN45.ts.map +0 -7
  140. package/dist/chunks/ignore-file-ui-BEZZZIEE.ts +0 -21
  141. package/dist/chunks/manager-ui-FS4QIKRA.ts.map +0 -7
  142. package/dist/chunks/merge-review-C2KETZKY.ts +0 -11
  143. package/dist/chunks/merge-review-C2KETZKY.ts.map +0 -7
  144. package/dist/chunks/remote-selection-ui-DOYKUMER.ts.map +0 -7
  145. package/dist/chunks/setup-switch-JZDFQPVW.ts.map +0 -7
  146. package/dist/daemon/dist/engine/ignore/adoption-journal.js +0 -146
  147. package/dist/daemon/dist/engine/ignore/effective-ignore-policy.js +0 -33
  148. package/dist/daemon/dist/engine/ignore/ignore-edit.js +0 -102
  149. package/dist/daemon/dist/engine/ignore/ignore-initialization.js +0 -288
  150. package/dist/daemon/dist/engine/ignore/ignore-migration-prompt.js +0 -139
  151. package/dist/daemon/dist/engine/ignore/ignore-settings.js +0 -391
  152. package/dist/daemon/dist/engine/ignore/ignore-source.js +0 -250
  153. package/dist/daemon/dist/engine/ignore/snapshot-ignore-rules.js +0 -39
  154. package/dist/daemon/dist/engine/sync/ignore-adoption-recovery.js +0 -50
  155. package/dist/daemon/dist/engine/sync/ignore-adoption.js +0 -416
  156. package/dist/daemon/dist/engine/sync/ignore-publication.js +0 -23
  157. package/dist/daemon/dist/engine/ui/ignore-rule-preview.js +0 -18
  158. package/dist/daemon/dist/monitor.js +0 -344
  159. package/src/ui/agent-mode-setting.ts +0 -99
  160. package/src/ui/ignore-file-guidance.ts +0 -7
  161. package/src/ui/ignore-file-ui.ts +0 -105
  162. package/src/ui/ignore-migration-prompt.ts +0 -65
  163. package/src/ui/settings-review.ts +0 -26
  164. /package/dist/chunks/{chunk-HLJIRWFL.ts.map → chunk-BCDBT4X3.ts.map} +0 -0
  165. /package/dist/chunks/{chunk-WBIOSK76.ts.map → chunk-R7PN3KIY.ts.map} +0 -0
  166. /package/dist/chunks/{chunk-3Q3DMMID.ts.map → chunk-TLYT6HVI.ts.map} +0 -0
  167. /package/dist/chunks/{chunk-JREGWM2B.ts.map → chunk-XNUARYLR.ts.map} +0 -0
  168. /package/dist/chunks/{conflict-review-GWEL4S6C.ts.map → conflict-review-3XMYDJIK.ts.map} +0 -0
  169. /package/dist/chunks/{config-P54GGMXY.ts.map → manager-result-dispatcher-A4IWLS4J.ts.map} +0 -0
  170. /package/dist/chunks/{chunk-ECUCXF5Y.ts.map → merge-review-LWMUE5IW.ts.map} +0 -0
  171. /package/dist/chunks/{ignore-file-ui-BEZZZIEE.ts.map → remote-selection-ui-F6NJBQ3Y.ts.map} +0 -0
  172. /package/dist/chunks/{manager-result-dispatcher-BXN46NRC.ts.map → setup-switch-7LMIRMZ7.ts.map} +0 -0
  173. /package/dist/chunks/{sync-inspection-DI5J6EUH.ts.map → sync-inspection-QGM54YCM.ts.map} +0 -0
  174. /package/dist/chunks/{sync-operations-AGNL7QXA.ts.map → sync-operations-DTQMKVRQ.ts.map} +0 -0
@@ -1,6 +1,5 @@
1
1
  import { loadConfigForCheck, syncCheckConfigFingerprint } from "../settings/config.js";
2
2
  import { resolvedSnapshotOptionsForContext } from "../snapshot/session-paths.js";
3
- import { ignorePolicyValidator } from "../snapshot/snapshot-transaction-policy.js";
4
3
  import { withLock } from "../state/lock.js";
5
4
  import { withStateDirectoryAccess } from "../state/state-directory.js";
6
5
  import { readStateForConfig } from "../state/sync-state-store.js";
@@ -11,7 +10,7 @@ import { acquireContinuousLease } from "./continuous-lease.js";
11
10
  import { normalizeContinuousClock, readContinuousRecord, reserveContinuousRequest, updateContinuousRecord, } from "./continuous-record.js";
12
11
  import { continuousBinding, hashContinuous } from "./continuous-storage.js";
13
12
  import { watchContinuous } from "./continuous-watch.js";
14
- import { assertMergeJournalPolicy, readMergeJournal } from "./merge-journal.js";
13
+ import { readMergeJournal } from "./merge-journal.js";
15
14
  import { createStartupTimings } from "./startup-timings.js";
16
15
  import { captureMutationOwner } from "./sync-local.js";
17
16
  import { rawSnapshotHashIdentity } from "./sync-state.js";
@@ -231,8 +230,6 @@ export function createContinuousSync(loaders, clock = systemClock, publish, diag
231
230
  return;
232
231
  validate();
233
232
  if (syncCheckConfigFingerprint(latest) !== syncCheckConfigFingerprint(config)) {
234
- if (config.reservedIgnoreNames !== undefined || latest.reservedIgnoreNames !== undefined)
235
- return;
236
233
  explicitRetry = false;
237
234
  closeWatch();
238
235
  config = latest;
@@ -249,12 +246,7 @@ export function createContinuousSync(loaders, clock = systemClock, publish, diag
249
246
  await updateContinuousRecord(binding, lease, (current) => normalizeContinuousClock(current, now));
250
247
  validate();
251
248
  }
252
- const configuration = hashContinuous([
253
- config.ignorePolicy
254
- ? syncCheckConfigFingerprint(config)
255
- : { ...config, showStatus: undefined, debug: undefined },
256
- ctx.model,
257
- ]);
249
+ const configuration = hashContinuous([{ ...config, showStatus: undefined, debug: undefined }, ctx.model]);
258
250
  const controlChanged = record.configuration !== configuration;
259
251
  if (controlChanged || explicitRetry) {
260
252
  record.next = 0;
@@ -401,8 +393,6 @@ export function createContinuousSync(loaders, clock = systemClock, publish, diag
401
393
  // A newly pending journal may prove an uncertain commit. It is never authority to republish.
402
394
  const pending = await guardedLock("continuous-journal", () => readMergeJournal(config));
403
395
  validate();
404
- if (pending)
405
- assertMergeJournalPolicy(pending, config);
406
396
  if (!force &&
407
397
  !pending &&
408
398
  current.phase === "blocked" &&
@@ -415,9 +405,6 @@ export function createContinuousSync(loaders, clock = systemClock, publish, diag
415
405
  validate();
416
406
  const snapshotOptions = await resolvedSnapshotOptionsForContext(ctx, config, signal);
417
407
  validate();
418
- const validateIgnore = ignorePolicyValidator({ ...snapshotOptions, validateMutation: validate });
419
- if (validateIgnore)
420
- await validateIgnore();
421
408
  await refresh();
422
409
  const inspection = await inspectionModule.inspectSync(config, snapshotOptions, signal, undefined, timings);
423
410
  await refresh();
@@ -431,8 +418,6 @@ export function createContinuousSync(loaders, clock = systemClock, publish, diag
431
418
  }
432
419
  const journal = await readMergeJournal(config);
433
420
  validate();
434
- if (journal)
435
- assertMergeJournalPolicy(journal, config);
436
421
  return { inspection, journal, localIdentity };
437
422
  }));
438
423
  validate();
@@ -1,4 +1,4 @@
1
- import { existsSync, watch } from "node:fs";
1
+ import { watch } from "node:fs";
2
2
  import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { getEngineRoot as getAgentDir } from "../host.js";
@@ -38,13 +38,9 @@ export async function watchContinuous(config, changed, options = {}) {
38
38
  if (!file || closed || options.signal?.aborted)
39
39
  return;
40
40
  const target = path.resolve(directory, String(file));
41
- const directoryOnlyHint = event === "change" && file === path.basename(directory) && !existsSync(target);
42
- if (!relativeWithin(directory, target) || directoryOnlyHint)
41
+ if (!relativeWithin(directory, target))
43
42
  return;
44
- if (target === path.join(root, "pi-sync.json") ||
45
- (config.ignorePolicy &&
46
- path.dirname(target) === root &&
47
- path.basename(target).toLowerCase() === config.ignorePolicy.filename.toLowerCase()))
43
+ if (target === path.join(root, "pi-sync.json"))
48
44
  changed(true);
49
45
  else if (scoped) {
50
46
  const relative = scopedPath(target);
@@ -49,27 +49,12 @@ export async function checkpointDirectionalAction(options, evidence) {
49
49
  .digest("hex");
50
50
  await options.directionalAction?.checkpoint?.(hash);
51
51
  }
52
- export function requireDirectionalSelection(config, state, local, remote, sessionDir) {
52
+ export function requireDirectionalSelection(config, state, _local, remote, _sessionDir) {
53
53
  if (!syncSelectionHasContent(config))
54
54
  throw new Error("This setup has no managed content for the transfer.");
55
- const current = config.ignorePolicy;
56
- const remoteProjected = current && remote && filterSnapshotForConfigPolicy(remote, config, { sessionDir });
57
- const managed = new Set([...local.files, ...(remoteProjected?.files ?? [])].map((file) => file.path));
58
- const provesNarrowing = (priorPaths, priorSessions) => {
59
- if (!current || (!priorSessions && current.sessions))
60
- return false;
61
- const prior = new Set(priorPaths);
62
- return ([...managed].every((item) => prior.has(item)) &&
63
- ((priorSessions && !current.sessions) ||
64
- priorPaths.some((item) => !managed.has(item) && current.matches(item, false))));
65
- };
66
55
  if (remote)
67
56
  requireCompatibleRemoteSelection(config, remote);
68
- if (state.lastAppliedSnapshot &&
69
- syncPolicyChanged(state, config) &&
70
- !(state.scope === config.scope &&
71
- state.ignorePolicyKey &&
72
- provesNarrowing(Object.keys(state.lastFileHashes), state.include?.includes("sessions") === true)))
57
+ if (state.lastAppliedSnapshot && syncPolicyChanged(state, config))
73
58
  throw new Error("Managed content policy changed and this transfer cannot prove that it only narrows the accepted selection. Review the new policy before transferring.");
74
59
  }
75
60
  export function keepProtectedRemoteSessions(config, upload, remote, sessionDir, protectedPaths) {
@@ -84,9 +69,6 @@ export function keepProtectedRemoteSessions(config, upload, remote, sessionDir,
84
69
  const files = [...upload.files.filter((file) => !protectedPaths.has(file.path)), ...retained];
85
70
  return {
86
71
  ...upload,
87
- ...(upload.selection?.version === 4
88
- ? { syncSessions: files.some((file) => file.path.startsWith("sessions/")) }
89
- : {}),
90
72
  files: files.sort((a, b) => a.path.localeCompare(b.path)),
91
73
  };
92
74
  }
@@ -108,7 +90,7 @@ export function notifyDirectionalSuccess(ctx, options, message, warning = false)
108
90
  export function remoteRestoreGuidance(head, previous, config, sessionDir) {
109
91
  const ref = head.snapshotRef === head.snapshotId ? "" : ` (reference ${safeTerminalText(head.snapshotRef)})`;
110
92
  const version = `${safeTerminalText(head.snapshotId)}${ref}`;
111
- const eligible = config.ignorePolicy || syncSessionsSelected(config) ? previous : snapshotWithoutSessions(previous);
93
+ const eligible = syncSessionsSelected(config) ? previous : snapshotWithoutSessions(previous);
112
94
  const selected = filterSnapshotForConfigPolicy(eligible, config, { sessionDir });
113
95
  return selected.files.length === previous.files.length
114
96
  ? `Restore the previous remote version ${version} from /sync → History.`
@@ -1,7 +1,7 @@
1
- import { hasPendingAdoption } from "../ignore/adoption-journal.js";
2
- import { loadConfig } from "../settings/config.js";
1
+ import { configFromSettings, loadConfig } from "../settings/config.js";
3
2
  import { isMissingConfigError } from "../settings/config-errors.js";
4
3
  import { consumeLocalConfigMigrationNotice } from "../settings/config-file.js";
4
+ import { assertNoRetiredRuleJournal } from "../settings/retired-ignore-recovery.js";
5
5
  import { readLocalConfigObject } from "../settings/settings-store.js";
6
6
  import { effectiveSessionRoot, sessionDirFromContext, snapshotOptionsForContext } from "../snapshot/session-paths.js";
7
7
  import { pendingTransactionEntries } from "../snapshot/snapshot-transaction-directory.js";
@@ -22,27 +22,16 @@ export async function initializeSync(ctx, signal, publish, observe) {
22
22
  if (stateNotice && ctx.hasUI)
23
23
  ctx.ui.notify(stateNotice, "warning");
24
24
  await timings.measure("transaction recovery", async () => {
25
+ assertNoRetiredRuleJournal();
25
26
  const pending = await pendingTransactionEntries();
26
27
  validate();
27
- if (hasPendingAdoption()) {
28
- if (pending.length) {
29
- const { recoverAdoptionFilesOnStartup } = await import("./ignore-adoption-recovery.js");
30
- validate();
31
- await recoverAdoptionFilesOnStartup(ctx, signal, validate);
32
- validate();
33
- }
34
- if (ctx.hasUI)
35
- ctx.ui.notify("Ignore-rule adoption is pending. Resume from the originating setup with /sync pull.", "warning");
36
- return;
37
- }
38
28
  if (!pending.some((entry) => entry.isDirectory()))
39
29
  return;
40
30
  const { recoverSnapshotTransactionsOnStartup } = await import("../snapshot/snapshot-transaction.js");
41
31
  validate();
42
32
  const settings = await readLocalConfigObject();
43
33
  validate();
44
- const config = settings?.activeSyncSetup ? await loadConfig() : undefined;
45
- validate();
34
+ const config = settings?.activeSyncSetup ? configFromSettings(settings) : undefined;
46
35
  const sessionDir = config?.scope === "agent-directory"
47
36
  ? await effectiveSessionRoot(ctx, config, signal)
48
37
  : sessionDirFromContext(ctx);
@@ -1,15 +1,14 @@
1
1
  import { createHash } from "node:crypto";
2
- import { validateSnapshotIgnoreRules } from "../ignore/snapshot-ignore-rules.js";
3
2
  import { regenerateSnapshotIdentity } from "../snapshot/snapshot.js";
4
3
  import { assertAgentDirectorySnapshotBound } from "../snapshot/snapshot-bounds.js";
5
- import { assertSnapshotFilePayload } from "../snapshot/snapshot-payload.js";
6
- import { isIgnoreSnapshotVersion, isSupportedSnapshotVersion, } from "../snapshot/snapshot-types.js";
4
+ import { isSupportedSnapshotVersion, } from "../snapshot/snapshot-types.js";
7
5
  import { jsonEqual, parseSettingsDocument, renderSettingsMembers, } from "./json-document.js";
8
6
  import { normalizeLocalFields } from "./local-field-policy.js";
9
- import { compileSyncPolicyExclude, configuredSnapshotPathMatcher, validateSnapshotSelection } from "./sync-policy.js";
7
+ import { compileSyncPolicyExclude, configuredSnapshotPathMatcher, requireLegacyTransferPolicy, validateSnapshotSelection, } from "./sync-policy.js";
10
8
  export { normalizeLocalFields } from "./local-field-policy.js";
11
9
  /** Shared transport contract: older snapshots cannot carry portable policy metadata. */
12
10
  export function validateSnapshotFieldPolicy(snapshot) {
11
+ requireLegacyTransferPolicy(snapshot);
13
12
  if (!isSupportedSnapshotVersion(snapshot.version))
14
13
  throw new Error("Unsupported snapshot format.");
15
14
  if (snapshot.version === 1 && snapshot.localFields !== undefined)
@@ -20,75 +19,15 @@ export function validateSnapshotFieldPolicy(snapshot) {
20
19
  normalizeLocalFields(snapshot.localFields);
21
20
  }
22
21
  }
23
- export function validateIgnoreSnapshotSessionFlag(selection, syncSessions) {
24
- if ((syncSessions !== undefined && typeof syncSessions !== "boolean") ||
25
- (syncSessions === true && !selection.sessions))
26
- throw new Error("Invalid ignore snapshot session metadata.");
27
- }
28
- export function validateIgnoreSnapshotIdentity({ id, createdAt, machine, profile, }) {
29
- if (typeof id !== "string" ||
30
- id.length > 512 ||
31
- id === "." ||
32
- id === ".." ||
33
- !/^[A-Za-z0-9._-]+(?![\s\S])/u.test(id) ||
34
- typeof createdAt !== "string" ||
35
- createdAt.length > 64 ||
36
- /[\p{Cc}\p{Cs}]/u.test(createdAt) ||
37
- Number.isNaN(Date.parse(createdAt)) ||
38
- typeof machine !== "string" ||
39
- machine.length > 256 ||
40
- /[\p{Cc}\p{Cs}]/u.test(machine) ||
41
- typeof profile !== "string" ||
42
- !profile ||
43
- profile.length > 256 ||
44
- /[\p{Cc}\p{Cs}]/u.test(profile))
45
- throw new Error("Invalid ignore snapshot identity.");
46
- }
47
- function validateIgnoreSnapshotEnvelope(snapshot, selection) {
48
- validateIgnoreSnapshotIdentity(snapshot);
49
- validateIgnoreSnapshotSessionFlag(selection, snapshot.syncSessions);
50
- if (!Array.isArray(snapshot.files) ||
51
- Object.keys(snapshot).some((key) => ![
52
- "version",
53
- "id",
54
- "createdAt",
55
- "machine",
56
- "profile",
57
- "syncSessions",
58
- "selection",
59
- "ignoreRules",
60
- "localFields",
61
- "files",
62
- ].includes(key)))
63
- throw new Error("Invalid ignore snapshot payload.");
64
- }
65
- function validateIgnoreSnapshotFiles(files) {
66
- for (const file of files) {
67
- if (Object.keys(file).length !== 3 ||
68
- !Object.hasOwn(file, "path") ||
69
- !Object.hasOwn(file, "contentBase64") ||
70
- !Object.hasOwn(file, "sha256") ||
71
- typeof file.sha256 !== "string" ||
72
- file.sha256.length !== 64)
73
- throw new Error("Invalid ignore snapshot file.");
74
- assertSnapshotFilePayload(file, "Ignore snapshot file checksum or encoding mismatch.");
75
- }
76
- }
77
- /** Portable transport images must not carry values declared machine-local. Physical journal images are different. */
78
22
  export function validatePortableSnapshot(snapshot) {
79
23
  validateSnapshotFieldPolicy(snapshot);
80
24
  validateSnapshotSelection(snapshot);
81
25
  const selection = snapshot.selection;
82
- const policy = validateSnapshotIgnoreRules(snapshot);
83
- if (selection?.version === 4)
84
- validateIgnoreSnapshotEnvelope(snapshot, selection);
85
26
  if (selection?.scope) {
86
- const selected = configuredSnapshotPathMatcher(policy ? { ...selection, ignorePolicy: policy } : selection);
27
+ const selected = configuredSnapshotPathMatcher(selection);
87
28
  if (snapshot.files.some((file) => typeof file?.path !== "string" || !selected(file.path)))
88
29
  throw new Error("Portable snapshot retains excluded or unsafe agent-directory paths.");
89
30
  assertAgentDirectorySnapshotBound(snapshot.files);
90
- if (isIgnoreSnapshotVersion(snapshot.version))
91
- validateIgnoreSnapshotFiles(snapshot.files);
92
31
  }
93
32
  else {
94
33
  const excludedPath = compileSyncPolicyExclude(selection ?? {});
@@ -12,8 +12,6 @@ import { assertUnexcludedTargets } from "../snapshot/snapshot-exclude-safety.js"
12
12
  import { assertCanonicalMutationTargets } from "../snapshot/snapshot-mutation-queues.js";
13
13
  import { sessionStorageRoot } from "../snapshot/snapshot-paths.js";
14
14
  import { snapshotBase64Size } from "../snapshot/snapshot-payload.js";
15
- import { recheckScopedImage, scopedTransactionImage } from "../snapshot/snapshot-transaction-images.js";
16
- import { ignorePolicyValidator } from "../snapshot/snapshot-transaction-policy.js";
17
15
  import { syncDirectory } from "../state/json-file.js";
18
16
  import { syncMutationParents } from "../state/mutation-directory-sync.js";
19
17
  import { ContinuousError } from "./continuous-errors.js";
@@ -254,12 +252,11 @@ async function assertFilesystemTarget(root, relative, options, removedTargets =
254
252
  }
255
253
  /** Roll forward only while each target is still its reviewed preimage or committed postimage. */
256
254
  export async function applyMergedSnapshot(before, after, protectedPaths, options, validate, protectedTarget) {
257
- const validateIgnore = ignorePolicyValidator(options);
258
255
  const root = agentDir();
259
256
  if (options.scope === "agent-directory" && options.sessionDir === undefined) {
260
257
  options = {
261
258
  ...options,
262
- sessionDir: sessionStorageRoot(root, await agentDirectoryConfiguredSessionDir(options.signal, root, options)),
259
+ sessionDir: sessionStorageRoot(root, await agentDirectoryConfiguredSessionDir(options.signal, root)),
263
260
  };
264
261
  options.validateMutation?.();
265
262
  options.signal?.throwIfAborted();
@@ -283,7 +280,8 @@ export async function applyMergedSnapshot(before, after, protectedPaths, options
283
280
  const targetSet = new Set(targets);
284
281
  await assertDistinctMergedTargets(root, paths, new Set(changed), options, protectedTarget, new Set(Object.keys(afterHashes)));
285
282
  await assertCanonicalMutationTargets(targets, options);
286
- await assertUnexcludedTargets(root, targets, options);
283
+ if (options.scope === "agent-directory")
284
+ await assertUnexcludedTargets(root, targets, options);
287
285
  // Existing case aliases share Pi's non-reentrant realpath queue. Reserve the
288
286
  // missing destination separately only after deleting its reviewed preimage.
289
287
  const targetsByQueue = new Map();
@@ -315,8 +313,6 @@ export async function applyMergedSnapshot(before, after, protectedPaths, options
315
313
  if (target)
316
314
  return withFileMutationQueue(target, () => acquire(index + 1));
317
315
  await validate();
318
- if (validateIgnore)
319
- await validateIgnore();
320
316
  await assertCanonicalMergedTargets(root, changed, options);
321
317
  await validate();
322
318
  const current = await createSnapshot(before.profile, options);
@@ -383,8 +379,6 @@ export async function applyMergedSnapshot(before, after, protectedPaths, options
383
379
  const removedTargets = new Set([...removed].map((item) => snapshotTarget(root, item, options.sessionDir)));
384
380
  await assertCanonicalMergedTargets(root, changed, options);
385
381
  await validate();
386
- if (options.validateApplyReview)
387
- await options.validateApplyReview();
388
382
  const requireReviewedHash = (relative, hash) => {
389
383
  if (hash !== beforeHashes[relative] && hash !== afterHashes[relative])
390
384
  throw new Error("Local content changed at the apply boundary; journal retained, newer bytes untouched.");
@@ -394,20 +388,11 @@ export async function applyMergedSnapshot(before, after, protectedPaths, options
394
388
  const relative = relativeByTarget.get(target);
395
389
  if (!relative)
396
390
  throw new Error("Unowned merge target.");
397
- if (validateIgnore || options.scope === "agent-directory") {
391
+ if (options.scope === "agent-directory") {
398
392
  await assertCanonicalMutationTargets([target], options);
399
393
  await assertUnexcludedTargets(root, [target], options);
400
394
  }
401
395
  await assertFilesystemTarget(root, relative, options, removedTargets, currentHashes);
402
- if (validateIgnore) {
403
- const image = await scopedTransactionImage(target, options);
404
- if (image.kind === "directory" && (!removed.has(relative) || image.children.length))
405
- throw new Error("Reviewed directory has remaining contents; journal retained for review.");
406
- requireReviewedHash(relative, image.kind === "file" ? image.value.slice("file:".length) : undefined);
407
- await validateIgnore();
408
- await recheckScopedImage(target, image, options);
409
- return image.kind;
410
- }
411
396
  await validate();
412
397
  let kind = "missing";
413
398
  let hash;
@@ -451,12 +436,10 @@ export async function applyMergedSnapshot(before, after, protectedPaths, options
451
436
  for (const target of plan.deletes) {
452
437
  let kind = await revalidateTarget(target);
453
438
  try {
454
- if (!validateIgnore) {
455
- const stat = await fs.lstat(target);
456
- await validate();
457
- kind = stat.isDirectory() ? "directory" : "file";
458
- }
459
- if (kind !== "missing" && checkApplyImage)
439
+ const stat = await fs.lstat(target);
440
+ await validate();
441
+ kind = stat.isDirectory() ? "directory" : "file";
442
+ if (checkApplyImage)
460
443
  await requireReviewedApplyImage();
461
444
  if (kind === "directory")
462
445
  await fs.rmdir(target); // Only an empty, reviewed directory may be replaced.
@@ -491,10 +474,6 @@ export async function applyMergedSnapshot(before, after, protectedPaths, options
491
474
  // Writers registered after deletion must finish first; never accept their
492
475
  // bytes as our own, even if they match a recognizable pre/postimage.
493
476
  await requireAbsentDestinations();
494
- if (deferredTargets.length && options.validateApplyReview)
495
- await options.validateApplyReview();
496
- if (validateIgnore)
497
- await validateIgnore();
498
477
  await writeTargets();
499
478
  }
500
479
  await requireAbsentDestinations();
@@ -509,8 +488,6 @@ export async function applyMergedSnapshot(before, after, protectedPaths, options
509
488
  const relative = relativeByTarget.get(item.target);
510
489
  if (!relative)
511
490
  throw new Error("Unowned merge write target.");
512
- if (validateIgnore)
513
- await validateIgnore();
514
491
  await assertFilesystemTarget(root, relative, options, new Set());
515
492
  if (checkApplyImage)
516
493
  await requireReviewedApplyImage();
@@ -1,65 +1,15 @@
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, BOUND_DIRECTORY_JOURNAL_VERSION, IGNORE_POLICY_JOURNAL_VERSION, ignorePolicyValidator, ignoreSourceBinding, recoveryPolicyKey, validateJournalPolicy, } from "../snapshot/snapshot-transaction-policy.js";
5
- import { isIgnoreSnapshotVersion } from "../snapshot/snapshot-types.js";
4
+ import { retiredIgnorePolicy } from "../settings/retired-ignore-policy.js";
6
5
  import { readJsonIfExists, syncDirectory, writeJson } from "../state/json-file.js";
7
- import { readStateForConfig, statePathForConfig, syncStateFingerprint } from "../state/sync-state-store.js";
8
- import { confirmMergeReview } from "../ui/merge-review.js";
9
- import { safeTerminalText } from "../ui/terminal-text.js";
6
+ import { statePathForConfig, syncStateFingerprint } from "../state/sync-state-store.js";
10
7
  import { normalizeSyncExclude } from "./exclude-policy.js";
11
8
  import { planFileMerge } from "./file-merge-planner.js";
12
9
  import { portableSnapshot, sameLocalFields, validatePortableSnapshot, validateSnapshotFieldPolicy, } from "./local-fields.js";
13
- import { compileSyncPolicyExclude, configuredSnapshotPathMatcher, sameSnapshotSelection, syncDirectoryPolicyKey, validateSnapshotSelection, } from "./sync-policy.js";
10
+ import { configuredSnapshotPathMatcher, sameSnapshotSelection, syncDirectoryPolicyKey, validateSnapshotSelection, } from "./sync-policy.js";
14
11
  import { fileHashMap, sameHashes } from "./sync-state.js";
15
- export function mergeJournalPolicy(config) {
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 };
21
- }
22
- function ignoreRecoveryPolicy(journal) {
23
- return {
24
- version: journal.version === 3 ? BOUND_DIRECTORY_JOURNAL_VERSION : IGNORE_POLICY_JOURNAL_VERSION,
25
- ignoreSource: journal.ignoreSource,
26
- localPolicyKey: journal.localPolicyKey,
27
- selection: journal.upload.selection,
28
- };
29
- }
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.");
33
- if (journal.version === 1 && !config.ignorePolicy && config.pathPolicy !== "ignore-file")
34
- return;
35
- if (journal.ignoreSource || config.ignorePolicy || config.pathPolicy === "ignore-file")
36
- assertRecoveryPolicy(ignoreRecoveryPolicy(journal), config);
37
- try {
38
- const identity = JSON.parse(journal.identity);
39
- if (!Array.isArray(identity) ||
40
- typeof identity[1] !== "string" ||
41
- journal.identity !== mergeJournalIdentity(config, identity[1]))
42
- throw new Error("Inconsistent merge identity.");
43
- }
44
- catch {
45
- throw new Error("Pending merge belongs to a different setup or local policy; preserve its journal.");
46
- }
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.");
51
- for (const snapshot of [
52
- journal.before,
53
- journal.after,
54
- journal.accepted,
55
- journal.ignoreSource && !journal.applyOnly ? journal.upload : undefined,
56
- ]) {
57
- if (snapshot?.files.some((file) => !configured(file.path)))
58
- throw new Error("Pending merge contains paths outside the current ignore-file policy; preserve its journal.");
59
- }
60
- }
61
12
  export function mergeJournalIdentity(config, backendIdentity) {
62
- const localPolicyKey = recoveryPolicyKey(config);
63
13
  return JSON.stringify([
64
14
  config.setupName,
65
15
  backendIdentity,
@@ -70,7 +20,6 @@ export function mergeJournalIdentity(config, backendIdentity) {
70
20
  : config.exclude === undefined
71
21
  ? []
72
22
  : ["exclude", normalizeSyncExclude(config.exclude).map((rule) => rule.toLowerCase())]),
73
- ...(localPolicyKey ? [localPolicyKey] : []),
74
23
  ]);
75
24
  }
76
25
  export function mergeJournalPath(config) {
@@ -92,13 +41,10 @@ export async function readMergeJournal(config) {
92
41
  }
93
42
  if (journal === undefined)
94
43
  return;
95
- if (!journal ||
96
- ![1, 2, 3].includes(journal.version) ||
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) ||
44
+ const version = journal?.version;
45
+ if (journal && (version === 2 || version === 3 || Object.hasOwn(journal, "ignoreSource")))
46
+ throw retiredIgnorePolicy("recovery");
47
+ if (journal?.version !== 1 ||
102
48
  typeof journal.identity !== "string" ||
103
49
  typeof journal.backup !== "string" ||
104
50
  typeof journal.stateIdentity !== "string" ||
@@ -127,11 +73,6 @@ export async function readMergeJournal(config) {
127
73
  throw new Error("Unsupported or damaged merge journal; preserve it and review recovery before syncing.");
128
74
  // Verify every path and byte, including the unmanaged remote files retained for publication.
129
75
  try {
130
- if (journal.ignoreSource !== undefined) {
131
- validateJournalPolicy(ignoreRecoveryPolicy(journal));
132
- if ([journal.expectedHead.selection, journal.committedHead?.selection].some((selection) => selection !== undefined && !sameSnapshotSelection(selection, journal.upload.selection)))
133
- throw new Error("Inconsistent merge head policy.");
134
- }
135
76
  const pinnedPaths = new Set(journal.progress?.groups.flatMap((group) => group.paths) ?? []);
136
77
  for (const snapshot of [
137
78
  journal.before,
@@ -141,10 +82,7 @@ export async function readMergeJournal(config) {
141
82
  ]) {
142
83
  validateSnapshotFieldPolicy(snapshot);
143
84
  validateSnapshotSelection(snapshot);
144
- if ((journal.ignoreSource !== undefined
145
- ? !isIgnoreSnapshotVersion(snapshot.version) ||
146
- !sameSnapshotSelection(snapshot.selection, journal.upload.selection)
147
- : ![1, 2, 3, 4, 5].includes(snapshot.version)) ||
85
+ if (![1, 2, 3, 4, 5].includes(snapshot.version) ||
148
86
  typeof snapshot.id !== "string" ||
149
87
  typeof snapshot.profile !== "string" ||
150
88
  snapshot.files.length > 16_384 ||
@@ -241,12 +179,6 @@ export async function retireMergeJournal(config) {
241
179
  const journal = await readMergeJournal(config);
242
180
  if (!journal)
243
181
  return;
244
- assertMergeJournalPolicy(journal, config);
245
- const validateIgnore = ignorePolicyValidator(config);
246
- if (validateIgnore)
247
- await validateIgnore();
248
- if (journal.ignoreSource)
249
- throw new Error(ignoreMergeRecoveryGuidance);
250
182
  await archiveMergeJournal(config);
251
183
  }
252
184
  async function archiveMergeJournal(config) {
@@ -254,41 +186,6 @@ async function archiveMergeJournal(config) {
254
186
  await fs.rename(file, `${file}.${randomUUID()}.resolved`);
255
187
  await syncDirectory(path.dirname(file));
256
188
  }
257
- export async function reviewInactiveIgnoreMerge(ctx, config, backend, journal, head, options, validateFresh, isCurrent) {
258
- if (!isCurrent ||
259
- options.auto ||
260
- options.background ||
261
- options.agentAcceptance ||
262
- options.yes ||
263
- !ctx.hasUI ||
264
- (ctx.mode !== "tui" && ctx.mode !== "rpc")) {
265
- throw new Error(ignoreMergeRecoveryGuidance);
266
- }
267
- await validateFresh();
268
- if (!(await confirmMergeReview(ctx, "Archive the inactive merge journal?", [
269
- `Setup: ${safeTerminalText(config.setupName)}`,
270
- "The original remote head and accepted baseline still match the journal, but local files changed.",
271
- "Archive only the journal. Keep its backup and all current local and remote files. Do not change the baseline.",
272
- "Run Sync now again to review a fresh plan.",
273
- ].join("\n"), options.signal, isCurrent, "archive journal only")))
274
- return "cancelled";
275
- const state = await readStateForConfig(config);
276
- await validateFresh();
277
- const latest = await backend.readHead(options.signal);
278
- if (!isCurrent())
279
- return "cancelled";
280
- await validateFresh();
281
- if (!sameMergeRecoveryHead(backend, head, latest) ||
282
- syncStateFingerprint(state) !== journal.stateIdentity ||
283
- syncStateFingerprint(await readStateForConfig(config)) !== journal.stateIdentity) {
284
- throw new Error("Remote head or sync baseline changed during recovery review; journal and backup retained.");
285
- }
286
- await validateFresh();
287
- await archiveMergeJournal(config);
288
- if (!options.silent && isCurrent())
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");
290
- return "archived";
291
- }
292
189
  export function sameMergeRecoveryHead(backend, left, right) {
293
190
  if (!left || !right)
294
191
  return left === right;
@@ -297,17 +194,10 @@ export function sameMergeRecoveryHead(backend, left, right) {
297
194
  left.snapshotRef === right.snapshotRef &&
298
195
  sameSnapshotSelection(left.selection, right.selection));
299
196
  }
300
- const ignoreMergeRecoveryGuidance = "An ignore-file merged transfer needs recovery; directional --force cannot bypass it. Inactive journal archiving requires foreground review where supported; --yes does not approve it. Preserve the journal, backup and current files if recovery is unavailable. Do not downgrade or restore old bytes blindly.";
301
197
  export async function requireNoMergeJournal(config, options = {}) {
302
198
  const journal = await readMergeJournal(config);
303
199
  if (!journal)
304
200
  return;
305
- assertMergeJournalPolicy(journal, config);
306
- const validateIgnore = ignorePolicyValidator(config);
307
- if (validateIgnore)
308
- await validateIgnore();
309
- if (journal.ignoreSource)
310
- throw new Error(ignoreMergeRecoveryGuidance);
311
201
  if (!options.force) {
312
202
  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.");
313
203
  }