@narumitw/pi-sync 0.68.1 → 0.69.1

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 (94) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +35 -21
  3. package/dist/chunks/{chunk-AYGMIMCV.ts → chunk-4KGDPLQ4.ts} +2 -2
  4. package/dist/chunks/chunk-4KGDPLQ4.ts.map +7 -0
  5. package/dist/chunks/{chunk-FR6A7ASZ.ts → chunk-EG6BUOUQ.ts} +3 -3
  6. package/dist/chunks/{chunk-WQXUZSY5.ts → chunk-EI2J5Z4Q.ts} +13 -6
  7. package/dist/chunks/chunk-EI2J5Z4Q.ts.map +7 -0
  8. package/dist/chunks/{chunk-BCDBT4X3.ts → chunk-GXB74FYB.ts} +4 -4
  9. package/dist/chunks/{chunk-J52GYZO6.ts → chunk-LNZRNXNQ.ts} +2 -4
  10. package/dist/chunks/{chunk-FQKWGVMA.ts → chunk-OWSKD5XG.ts} +10 -7
  11. package/dist/chunks/chunk-OWSKD5XG.ts.map +7 -0
  12. package/dist/chunks/{chunk-WCGLU526.ts → chunk-RXZVLBPU.ts} +3 -3
  13. package/dist/chunks/{chunk-KAIVTJIQ.ts → chunk-RZB2DPVU.ts} +2 -2
  14. package/dist/chunks/{chunk-335XTMMZ.ts → chunk-VQTYTUBU.ts} +24 -26
  15. package/dist/chunks/chunk-VQTYTUBU.ts.map +7 -0
  16. package/dist/chunks/{chunk-TLYT6HVI.ts → chunk-YX6DCQ7P.ts} +2 -2
  17. package/dist/chunks/{command-handler-5LDTCUJE.ts → command-handler-ZR26OSBX.ts} +39 -143
  18. package/dist/chunks/command-handler-ZR26OSBX.ts.map +7 -0
  19. package/dist/chunks/{conflict-review-SZ3AWTX6.ts → conflict-review-W5BCZIZG.ts} +2 -2
  20. package/dist/chunks/{file-selection-4BOQBXS7.ts → file-selection-STCIRKF6.ts} +3 -3
  21. package/dist/chunks/{manager-result-dispatcher-A4IWLS4J.ts → manager-result-dispatcher-MPLPDR2P.ts} +5 -5
  22. package/dist/chunks/{manager-ui-KHMCSLLV.ts → manager-ui-OMZOBGYT.ts} +99 -96
  23. package/dist/chunks/manager-ui-OMZOBGYT.ts.map +7 -0
  24. package/dist/chunks/{merge-review-LWMUE5IW.ts → merge-review-KTIQBRLL.ts} +2 -2
  25. package/dist/chunks/{remote-selection-ui-F6NJBQ3Y.ts → remote-selection-ui-CCHMCAHQ.ts} +4 -4
  26. package/dist/chunks/{setup-switch-7LMIRMZ7.ts → setup-switch-J3YLBB6N.ts} +4 -4
  27. package/dist/chunks/{setup-wizard-2NRPR433.ts → setup-wizard-J3YOR7BR.ts} +3 -4
  28. package/dist/chunks/{setup-wizard-2NRPR433.ts.map → setup-wizard-J3YOR7BR.ts.map} +1 -1
  29. package/dist/chunks/{sync-inspection-OTI4JDQ2.ts → sync-inspection-7OADBR57.ts} +3 -3
  30. package/dist/chunks/{sync-operations-ZUYJLWUN.ts → sync-operations-3K6WLPXY.ts} +2 -10
  31. package/dist/chunks/{sync-operations-ZUYJLWUN.ts.map → sync-operations-3K6WLPXY.ts.map} +2 -2
  32. package/dist/daemon/dist/build-id.json +1 -1
  33. package/dist/daemon/dist/daemon-debug.js +13 -6
  34. package/dist/daemon/dist/engine/backends/git/git-backend.js +1 -1
  35. package/dist/daemon/dist/engine/backends/s3/s3-backend.js +2 -2
  36. package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +67 -6
  37. package/dist/daemon/dist/engine/debug-check.js +59 -0
  38. package/dist/daemon/dist/engine/debug-log.js +100 -1
  39. package/dist/daemon/dist/engine/sync/directional-conflict.js +31 -0
  40. package/dist/daemon/dist/engine/sync/push-review.js +1 -1
  41. package/dist/daemon/dist/engine/sync/sync-error-guidance.js +6 -5
  42. package/dist/daemon/dist/engine/sync/sync-inspection.js +5 -1
  43. package/dist/daemon/dist/engine/sync/sync-mutations.js +40 -7
  44. package/dist/daemon/dist/engine/sync/sync-queries.js +99 -25
  45. package/dist/daemon/dist/engine/sync/sync-state.js +1 -1
  46. package/dist/daemon/dist/engine/ui/transfer-review.js +2 -3
  47. package/dist/daemon/dist/engine-service.js +100 -25
  48. package/dist/daemon/dist/foreground-transfer.js +10 -0
  49. package/dist/daemon/dist/index.js +1 -0
  50. package/dist/daemon/dist/server.js +17 -9
  51. package/dist/daemon/package.json +1 -1
  52. package/dist/index.ts +111 -10
  53. package/dist/index.ts.map +3 -3
  54. package/docs/daemon-migration.md +2 -2
  55. package/docs/tui-contract.md +7 -7
  56. package/package.json +7 -4
  57. package/skills/configure-pi-sync/SKILL.md +4 -7
  58. package/skills/configure-pi-sync/references/configuration.md +20 -19
  59. package/src/commands/command-execution.ts +36 -136
  60. package/src/commands/command-handler.ts +3 -3
  61. package/src/commands/command.ts +28 -26
  62. package/src/daemon/directional-recovery.ts +3 -1
  63. package/src/daemon/pi-client.ts +6 -0
  64. package/src/sync/debug-tool.ts +96 -0
  65. package/src/sync/startup-check.ts +1 -1
  66. package/src/sync/sync-operations.ts +0 -6
  67. package/src/sync-extension.ts +13 -1
  68. package/src/ui/cancellable-operation.ts +11 -4
  69. package/src/ui/manager-state.ts +13 -12
  70. package/src/ui/manager-ui.ts +96 -81
  71. package/src/ui/operation-dialogs.ts +1 -1
  72. package/src/ui/settings-ui.ts +2 -3
  73. package/src/ui/setup/webdav-ui.ts +1 -1
  74. package/dist/chunks/chunk-335XTMMZ.ts.map +0 -7
  75. package/dist/chunks/chunk-AYGMIMCV.ts.map +0 -7
  76. package/dist/chunks/chunk-ECYCNZOE.ts +0 -12
  77. package/dist/chunks/chunk-ECYCNZOE.ts.map +0 -7
  78. package/dist/chunks/chunk-FQKWGVMA.ts.map +0 -7
  79. package/dist/chunks/chunk-WQXUZSY5.ts.map +0 -7
  80. package/dist/chunks/command-handler-5LDTCUJE.ts.map +0 -7
  81. package/dist/chunks/manager-ui-KHMCSLLV.ts.map +0 -7
  82. /package/dist/chunks/{chunk-FR6A7ASZ.ts.map → chunk-EG6BUOUQ.ts.map} +0 -0
  83. /package/dist/chunks/{chunk-BCDBT4X3.ts.map → chunk-GXB74FYB.ts.map} +0 -0
  84. /package/dist/chunks/{chunk-J52GYZO6.ts.map → chunk-LNZRNXNQ.ts.map} +0 -0
  85. /package/dist/chunks/{chunk-WCGLU526.ts.map → chunk-RXZVLBPU.ts.map} +0 -0
  86. /package/dist/chunks/{chunk-KAIVTJIQ.ts.map → chunk-RZB2DPVU.ts.map} +0 -0
  87. /package/dist/chunks/{chunk-TLYT6HVI.ts.map → chunk-YX6DCQ7P.ts.map} +0 -0
  88. /package/dist/chunks/{conflict-review-SZ3AWTX6.ts.map → conflict-review-W5BCZIZG.ts.map} +0 -0
  89. /package/dist/chunks/{file-selection-4BOQBXS7.ts.map → file-selection-STCIRKF6.ts.map} +0 -0
  90. /package/dist/chunks/{manager-result-dispatcher-A4IWLS4J.ts.map → manager-result-dispatcher-MPLPDR2P.ts.map} +0 -0
  91. /package/dist/chunks/{merge-review-LWMUE5IW.ts.map → merge-review-KTIQBRLL.ts.map} +0 -0
  92. /package/dist/chunks/{remote-selection-ui-F6NJBQ3Y.ts.map → remote-selection-ui-CCHMCAHQ.ts.map} +0 -0
  93. /package/dist/chunks/{setup-switch-7LMIRMZ7.ts.map → setup-switch-J3YLBB6N.ts.map} +0 -0
  94. /package/dist/chunks/{sync-inspection-OTI4JDQ2.ts.map → sync-inspection-7OADBR57.ts.map} +0 -0
@@ -2,7 +2,7 @@
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  remoteOperation
5
- } from "./chunk-WQXUZSY5.ts";
5
+ } from "./chunk-EI2J5Z4Q.ts";
6
6
  import "./chunk-H7VOTY5N.ts";
7
7
  import "./chunk-6YKOHBSC.ts";
8
8
  import "./chunk-R3SAMXB6.ts";
@@ -15,4 +15,4 @@ async function showConflicts(ctx, options) {
15
15
  export {
16
16
  showConflicts
17
17
  };
18
- //# sourceMappingURL=conflict-review-SZ3AWTX6.ts.map
18
+ //# sourceMappingURL=conflict-review-W5BCZIZG.ts.map
@@ -2,7 +2,7 @@
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  showDirectoryScope
5
- } from "./chunk-KAIVTJIQ.ts";
5
+ } from "./chunk-RZB2DPVU.ts";
6
6
  import "./chunk-XNUARYLR.ts";
7
7
  import {
8
8
  updateSyncSetup
@@ -20,7 +20,7 @@ import "./chunk-ZO52JM4H.ts";
20
20
  import {
21
21
  loadSettingsConfig,
22
22
  syncCheckConfigFingerprint
23
- } from "./chunk-J52GYZO6.ts";
23
+ } from "./chunk-LNZRNXNQ.ts";
24
24
  import {
25
25
  BUILT_IN_SYNC_ROOTS,
26
26
  isSafeCustomIncludePath,
@@ -293,4 +293,4 @@ function safeTerminalText(value) {
293
293
  export {
294
294
  showFileSelection
295
295
  };
296
- //# sourceMappingURL=file-selection-4BOQBXS7.ts.map
296
+ //# sourceMappingURL=file-selection-STCIRKF6.ts.map
@@ -2,14 +2,14 @@
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  dispatchManagerResult
5
- } from "./chunk-BCDBT4X3.ts";
6
- import "./chunk-WCGLU526.ts";
5
+ } from "./chunk-GXB74FYB.ts";
6
+ import "./chunk-RXZVLBPU.ts";
7
7
  import "./chunk-UMPA5S7X.ts";
8
- import "./chunk-AYGMIMCV.ts";
8
+ import "./chunk-4KGDPLQ4.ts";
9
9
  import "./chunk-NXWHPVXR.ts";
10
10
  import "./chunk-GELYN4UC.ts";
11
11
  import "./chunk-ZO52JM4H.ts";
12
- import "./chunk-J52GYZO6.ts";
12
+ import "./chunk-LNZRNXNQ.ts";
13
13
  import "./chunk-H7VOTY5N.ts";
14
14
  import "./chunk-6YKOHBSC.ts";
15
15
  import "./chunk-R3SAMXB6.ts";
@@ -17,4 +17,4 @@ import "./chunk-2JNFEZ3V.ts";
17
17
  export {
18
18
  dispatchManagerResult
19
19
  };
20
- //# sourceMappingURL=manager-result-dispatcher-A4IWLS4J.ts.map
20
+ //# sourceMappingURL=manager-result-dispatcher-MPLPDR2P.ts.map
@@ -2,6 +2,7 @@
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  applyS3CredentialUpdate,
5
+ automaticSyncSummary,
5
6
  chooseS3CredentialUpdate,
6
7
  chooseS3Credentials,
7
8
  promptResourceName,
@@ -18,27 +19,24 @@ import {
18
19
  showEditS3Target,
19
20
  showEditWebDavStorageProfile,
20
21
  showEditWebDavTarget
21
- } from "./chunk-FQKWGVMA.ts";
22
+ } from "./chunk-OWSKD5XG.ts";
22
23
  import {
23
24
  dispatchManagerResult
24
- } from "./chunk-BCDBT4X3.ts";
25
- import "./chunk-WCGLU526.ts";
25
+ } from "./chunk-GXB74FYB.ts";
26
+ import "./chunk-RXZVLBPU.ts";
26
27
  import {
27
28
  SETUP_SWITCH_ACTION_OPTIONS,
28
29
  saveOnSwitch,
29
30
  setupSwitchActionFromLabel,
30
31
  setupSwitchActionLabel,
31
32
  useSyncSetup
32
- } from "./chunk-FR6A7ASZ.ts";
33
+ } from "./chunk-EG6BUOUQ.ts";
33
34
  import {
34
35
  isCloudflareR2Endpoint,
35
36
  normalizeS3Endpoint,
36
37
  ownRecord,
37
38
  validateSettingsDocument
38
39
  } from "./chunk-APZVJAEW.ts";
39
- import {
40
- automaticSyncSummary
41
- } from "./chunk-ECYCNZOE.ts";
42
40
  import {
43
41
  loadOnSwitch,
44
42
  readLocalConfigObject,
@@ -50,7 +48,7 @@ import {
50
48
  readStateForConfig,
51
49
  syncAttentionMatchesConfig,
52
50
  syncStateFingerprint
53
- } from "./chunk-TLYT6HVI.ts";
51
+ } from "./chunk-YX6DCQ7P.ts";
54
52
  import {
55
53
  throwIfAborted
56
54
  } from "./chunk-UMPA5S7X.ts";
@@ -58,14 +56,14 @@ import {
58
56
  AUTOMATIC_SYNC_DESCRIPTION,
59
57
  STARTUP_TRANSFER_DESCRIPTION,
60
58
  startupTransferSummary
61
- } from "./chunk-335XTMMZ.ts";
59
+ } from "./chunk-VQTYTUBU.ts";
62
60
  import {
63
61
  runCancellableOperation
64
- } from "./chunk-AYGMIMCV.ts";
62
+ } from "./chunk-4KGDPLQ4.ts";
65
63
  import {
66
64
  directoryScopeSummary,
67
65
  showExcludedPaths
68
- } from "./chunk-KAIVTJIQ.ts";
66
+ } from "./chunk-RZB2DPVU.ts";
69
67
  import {
70
68
  saveReviewedDraft
71
69
  } from "./chunk-XNUARYLR.ts";
@@ -96,7 +94,7 @@ import {
96
94
  loadSettingsConfig,
97
95
  syncCheckConfigFingerprint,
98
96
  syncConfigReviewIdentity
99
- } from "./chunk-J52GYZO6.ts";
97
+ } from "./chunk-LNZRNXNQ.ts";
100
98
  import {
101
99
  configureSyncStatus
102
100
  } from "./chunk-H7VOTY5N.ts";
@@ -152,7 +150,7 @@ function blockedSyncMenuItem(label, manager) {
152
150
  };
153
151
  }
154
152
  async function showManagerAttention(ctx, attention, runRoute, signal, onSelectionResolved) {
155
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-F6NJBQ3Y.ts");
153
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-CCHMCAHQ.ts");
156
154
  if (signal?.aborted) return "close";
157
155
  const review = await showRemoteSelectionReview(ctx, attention.decision.setupName, signal, void 0, {
158
156
  decision: attention.decision,
@@ -215,6 +213,7 @@ async function recoverSyncAccess(ctx, manager, runRoute, sessionSignal, actionSi
215
213
  }
216
214
 
217
215
  // src/ui/manager-state.ts
216
+ import { stripVTControlCharacters } from "node:util";
218
217
  import { truncateToWidth } from "@earendil-works/pi-tui";
219
218
 
220
219
  // src/ui/sync-setups-ui.ts
@@ -440,10 +439,8 @@ var MAIN_MENU_ACTIONS = [
440
439
  "Pull from remote",
441
440
  "Push to remote",
442
441
  "View differences",
443
- "Check remote status",
444
442
  "Settings",
445
- "History",
446
- "Diagnostics"
443
+ "History"
447
444
  ];
448
445
  async function describeManagerState(signal, attention, inspectOperation = inspectOperationAvailability, observation) {
449
446
  signal?.throwIfAborted();
@@ -513,7 +510,7 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
513
510
  const syncState = changesBlocked ? void 0 : await readStateForConfig(config).catch(() => void 0);
514
511
  signal?.throwIfAborted();
515
512
  const currentObservation = observation && observationMatchesConfig(observation, config) && syncState && syncStateFingerprint(syncState) === observation.inspection.stateIdentity ? observation : void 0;
516
- const lastAppliedSnapshot = changesBlocked ? "Unavailable while operations are locked" : syncState?.lastAppliedSnapshot ? `${truncateToWidth(safeTerminalText(syncState.lastAppliedSnapshot), 12, "\u2026")} \xB7 application time unavailable` : syncState ? "Never synced" : "Unavailable";
513
+ const lastAppliedSnapshot = syncState?.lastAppliedSnapshot ? truncatePlainText(syncState.lastAppliedSnapshot, 40) : syncState ? "Never synced" : "Unavailable";
517
514
  const canSwitch = !changesBlocked && (alternateUsable || await hasAnotherSwitchableSetup(view, signal));
518
515
  signal?.throwIfAborted();
519
516
  const mainActions = [...MAIN_MENU_ACTIONS];
@@ -529,7 +526,7 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
529
526
  currentAttention.decision.setupName === config.setupName ? "Sync status: Review needed" : `Sync status: Review needed for setup ${safeTerminalText(currentAttention.decision.setupName)}`,
530
527
  attentionDirectoryPolicy ? "Sync scopes or directory rules differ." : attentionComparison?.remoteOnly.length === 0 && attentionComparison.localOnly.length === 0 ? attentionExclusionsDiffer ? "Synced-content exclusion rules differ." : "Only the synced-content order differs." : `Remote-only paths: ${attentionComparison?.remoteOnly.length ?? 0} \xB7 Device-only paths: ${attentionComparison?.localOnly.length ?? 0}${attentionExclusionsDiffer ? " \xB7 Exclusion rules differ." : ""}`
531
528
  ] : currentObservation ? [`Observed ${safeTerminalText(currentObservation.checkedAt)}: ${observationSummary(currentObservation)}`] : ["Remote status: Not checked"],
532
- `Last applied: ${lastAppliedSnapshot}`,
529
+ `Last applied snapshot: ${lastAppliedSnapshot}`,
533
530
  ...config.automaticTransfer || config.automatic && syncSessionsSelected(config) ? ["Automatic transfer permission: On \xB7 see Settings"] : [],
534
531
  ...noSyncedContent ? ["", "No included content is selected. Choose included content in Settings before syncing."] : []
535
532
  ];
@@ -573,8 +570,7 @@ function operationActions(operation, noSyncedContent, canSwitch, mainActions) {
573
570
  ...mainActions.includes("Review unresolved conflicts") ? ["Review unresolved conflicts"] : [],
574
571
  "Settings",
575
572
  ...canSwitch ? ["Switch sync setup"] : [],
576
- "History",
577
- "Diagnostics"
573
+ "History"
578
574
  ] : mainActions;
579
575
  }
580
576
  function operationStatusLines(operation) {
@@ -582,7 +578,7 @@ function operationStatusLines(operation) {
582
578
  case "free":
583
579
  return [];
584
580
  case "live": {
585
- const command = truncateToWidth(safeTerminalText(operation.lock.command), 16, "\u2026");
581
+ const command = truncatePlainText(operation.lock.command, 16);
586
582
  return [
587
583
  `Running: ${command} (pid ${operation.lock.pid}). Wait, then refresh; Transfer actions and Settings return.`
588
584
  ];
@@ -603,6 +599,10 @@ function operationStatusLines(operation) {
603
599
  return ["Lock check failed. Fix path access, then refresh; Transfer actions and Settings remain unavailable."];
604
600
  }
605
601
  }
602
+ function truncatePlainText(value, width) {
603
+ const text = safeTerminalText(stripVTControlCharacters(value));
604
+ return stripVTControlCharacters(truncateToWidth(text, width, "\u2026"));
605
+ }
606
606
  function backendStorageDescription(config) {
607
607
  const connection = safeTerminalText(config.connectionName);
608
608
  switch (config.backend.type) {
@@ -635,7 +635,7 @@ import {
635
635
  } from "#pi-sync-daemon/engine/sync/local-fields";
636
636
 
637
637
  // src/ui/settings-frame.ts
638
- import { stripVTControlCharacters } from "node:util";
638
+ import { stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
639
639
  function boundedSettingsUI(ctx) {
640
640
  return {
641
641
  ...ctx.ui,
@@ -659,8 +659,8 @@ function boundedSettingsUI(ctx) {
659
659
  if (width <= 0) return [];
660
660
  const lines = render(width);
661
661
  if (!compact()) return lines;
662
- const active = lines.findIndex((line) => stripVTControlCharacters(line).startsWith("\u2192"));
663
- const search = lines.findIndex((line) => stripVTControlCharacters(line).startsWith(">"));
662
+ const active = lines.findIndex((line) => stripVTControlCharacters2(line).startsWith("\u2192"));
663
+ const search = lines.findIndex((line) => stripVTControlCharacters2(line).startsWith(">"));
664
664
  sourceRow = active < 0 ? Math.max(0, search) : active;
665
665
  return lines.slice(sourceRow, sourceRow + 1);
666
666
  };
@@ -1449,7 +1449,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1449
1449
  {
1450
1450
  id: "skipSecretScan",
1451
1451
  label: "Skip secret scan",
1452
- description: "All setups on this device: skip possible-secret checks on subsequent pushes, including automatic pushes. Other safety checks remain. Diagnostics still scans.",
1452
+ description: "All setups on this device: skip possible-secret checks on subsequent pushes, including automatic pushes. Other push safety checks remain.",
1453
1453
  currentValue: state.skipSecretScan ? "On" : "Off",
1454
1454
  values: ["On", "Off"],
1455
1455
  action: "skip-secret-scan"
@@ -1465,7 +1465,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1465
1465
  {
1466
1466
  id: "debug",
1467
1467
  label: "Debug mode",
1468
- description: "Write startup timings and sync events to the local pi-sync.log. Pi applies this at the next session start; the daemon applies it at its next settings check.",
1468
+ description: "Next session: log to pi-sync.log and let the model recheck remote storage without asking.",
1469
1469
  currentValue: state.debug ? "On" : "Off",
1470
1470
  values: ["On", "Off"],
1471
1471
  action: "debug"
@@ -1704,7 +1704,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1704
1704
  },
1705
1705
  "remote-include": async ({ signal: actionSignal }) => {
1706
1706
  const reviewSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
1707
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-F6NJBQ3Y.ts");
1707
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-CCHMCAHQ.ts");
1708
1708
  if (reviewSignal.aborted) return { kind: "rejected" };
1709
1709
  const review = await showRemoteSelectionReview(ctx, setupName, reviewSignal, void 0, {
1710
1710
  origin: "settings",
@@ -1882,20 +1882,32 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
1882
1882
  const directionalAction = async (direction, state, signal) => {
1883
1883
  const review = state.manager.configReview;
1884
1884
  if (!review) return { kind: "stay" };
1885
- const result = await runCancellableOperation(
1885
+ const run = (intent) => runCancellableOperation(
1886
1886
  ctx,
1887
- direction === "push" ? "Pushing to remote\u2026" : "Pulling from remote\u2026",
1887
+ intent === "review-force" ? `Preparing Force ${direction} preview\u2026` : direction === "push" ? "Pushing to remote\u2026" : "Pulling from remote\u2026",
1888
1888
  direction,
1889
1889
  runRoute,
1890
1890
  {
1891
1891
  commitAware: true,
1892
+ cancelAcrossDialogs: intent === "review-force",
1892
1893
  cancelledMessage: direction === "push" ? "Push cancellation requested." : "Pull cancellation requested.",
1893
1894
  target: review.setupName,
1894
- directionalFingerprint: review.fingerprint,
1895
+ directional: { fingerprint: review.fingerprint, intent },
1895
1896
  signal,
1896
1897
  isCurrent
1897
1898
  }
1898
1899
  );
1900
+ let result = await run("reject-conflicts");
1901
+ if (signal.aborted || !isCurrent()) return { kind: "close" };
1902
+ if (result.kind === "destination-conflict") {
1903
+ const choice = await showDirectionalConflict(menuContext, direction, review.setupName, signal, isCurrent);
1904
+ if (signal.aborted || !isCurrent() || choice === "close") return { kind: "close" };
1905
+ if (choice === "back") return { kind: "stay" };
1906
+ if (!await matchesManagerReview(review.fingerprint, signal))
1907
+ return { kind: signal.aborted || !isCurrent() ? "close" : "stay" };
1908
+ result = await run("review-force");
1909
+ if (signal.aborted || !isCurrent()) return { kind: "close" };
1910
+ }
1899
1911
  const done = result.kind === "closed" || result.kind === "completed" && result.outcome === "applied" || result.kind === "failed" && options.needsDaemonRecovery?.();
1900
1912
  return done ? { kind: "close" } : { kind: "stay" };
1901
1913
  };
@@ -1921,13 +1933,11 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
1921
1933
  id: item.id,
1922
1934
  label: ctx.mode === "tui" && item.id === "sync" ? "Sync\u2026" : item.label,
1923
1935
  details: [item.description ?? "Review synced content."],
1924
- searchText: `${item.label} ${item.description ?? ""}`,
1925
1936
  disabled: item.disabled,
1926
1937
  disabledReason: item.disabledReason
1927
1938
  })),
1928
1939
  action: "activate",
1929
- enableSearch: true,
1930
- viewportSize: 5,
1940
+ viewportSize: 6,
1931
1941
  hint: "close"
1932
1942
  };
1933
1943
  }
@@ -1944,7 +1954,7 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
1944
1954
  if (!attention) {
1945
1955
  const observation = state.manager.observation;
1946
1956
  if (!observation) return { kind: "stay" };
1947
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-F6NJBQ3Y.ts");
1957
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-CCHMCAHQ.ts");
1948
1958
  if (sessionSignal?.aborted) return { kind: "close" };
1949
1959
  const config = await loadConfig();
1950
1960
  if (sessionSignal?.aborted) return { kind: "close" };
@@ -2015,7 +2025,7 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2015
2025
  commitAware: true,
2016
2026
  cancelAcrossDialogs: true,
2017
2027
  target: state.manager.configReview?.setupName,
2018
- cancelledMessage: "History review cancelled; no files were changed."
2028
+ cancelledMessage: "History review cancelled."
2019
2029
  });
2020
2030
  return { kind: result.kind === "closed" ? "close" : "stay" };
2021
2031
  },
@@ -2026,40 +2036,6 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2026
2036
  });
2027
2037
  return { kind: result.kind === "closed" ? "close" : "stay" };
2028
2038
  },
2029
- status: async ({ state }) => {
2030
- const result = await runCancellableOperation(ctx, "Checking remote status\u2026", "status", runRoute, {
2031
- target: state.manager.configReview?.setupName,
2032
- signal: sessionSignal
2033
- });
2034
- return { kind: result.kind === "closed" ? "close" : "stay" };
2035
- },
2036
- doctor: async ({ state, signal: actionSignal }) => {
2037
- const signal = sessionSignal ? AbortSignal.any([sessionSignal, actionSignal]) : actionSignal;
2038
- const validate = captureMutationOwner(ctx, signal);
2039
- const config = await loadConfig(state.manager.configReview?.setupName);
2040
- validate();
2041
- const confirmed = await ctx.ui.confirm(
2042
- "Run diagnostics?",
2043
- `Setup: ${safeTerminalText(config.setupName)}
2044
- Storage: ${backendStorageDescription(config)}
2045
- S3/R2 reads the latest pointer without writing. Git reads remote snapshots and checks its cache. WebDAV probes conditional writes and cleanup, and can repair a missing history entry. Possible-secret checks still run. This is not the read-only Check remote status action.`,
2046
- { signal }
2047
- );
2048
- if (signal.aborted) return { kind: "close" };
2049
- validate();
2050
- if (!confirmed) return { kind: "stay" };
2051
- const latest = await loadConfig();
2052
- validate();
2053
- if (syncCheckConfigFingerprint(config) !== syncCheckConfigFingerprint(latest)) {
2054
- ctx.ui.notify("Setup changed during diagnostics review; reopen Diagnostics.", "warning");
2055
- return { kind: "stay" };
2056
- }
2057
- const result = await runCancellableOperation(ctx, "Checking setup access\u2026", "doctor", runRoute, {
2058
- signal,
2059
- target: config.setupName
2060
- });
2061
- return { kind: result.kind === "closed" ? "close" : "stay" };
2062
- },
2063
2039
  "daemon-recovery": async ({ signal }) => {
2064
2040
  await runRoute("daemon recover", signal);
2065
2041
  return { kind: "stay" };
@@ -2088,6 +2064,21 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
2088
2064
  }
2089
2065
  }
2090
2066
  });
2067
+ async function matchesManagerReview(fingerprint, signal, settings = false) {
2068
+ try {
2069
+ const config = await (settings ? loadSettingsConfig() : loadConfig());
2070
+ validateOwner();
2071
+ signal.throwIfAborted();
2072
+ if (fingerprint === syncCheckConfigFingerprint(config)) return true;
2073
+ } catch {
2074
+ if (!isCurrent() || signal.aborted) return false;
2075
+ }
2076
+ ctx.ui.notify(
2077
+ "Sync setup changed while the manager was open. Review the refreshed setup before continuing.",
2078
+ "warning"
2079
+ );
2080
+ return false;
2081
+ }
2091
2082
  for (const action of [
2092
2083
  "review-attention",
2093
2084
  "sync",
@@ -2096,31 +2087,15 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
2096
2087
  "push",
2097
2088
  "history",
2098
2089
  "diff",
2099
- "status",
2100
- "doctor",
2101
2090
  "conflicts"
2102
2091
  ]) {
2103
2092
  const activate = menu.actions[action];
2104
2093
  menu.actions[action] = async (invocation) => {
2105
2094
  validateOwner();
2106
2095
  const review = invocation.state.manager.configReview;
2107
- let current = false;
2108
- try {
2109
- const config = await (action === "settings" ? loadSettingsConfig() : loadConfig());
2110
- validateOwner();
2111
- invocation.signal.throwIfAborted();
2112
- current = review?.fingerprint === syncCheckConfigFingerprint(config);
2113
- } catch {
2114
- if (!isCurrent() || invocation.signal.aborted) return { kind: "close" };
2115
- }
2116
- if (!current) {
2117
- ctx.ui.notify(
2118
- "Sync setup changed while the manager was open. Review the refreshed setup before continuing.",
2119
- "warning"
2120
- );
2121
- return { kind: "stay" };
2122
- }
2123
- return activate(invocation);
2096
+ const matches = await matchesManagerReview(review?.fingerprint, invocation.signal, action === "settings");
2097
+ if (invocation.signal.aborted || !isCurrent()) return { kind: "close" };
2098
+ return matches ? activate(invocation) : { kind: "stay" };
2124
2099
  };
2125
2100
  }
2126
2101
  const menuContext = {
@@ -2163,17 +2138,47 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
2163
2138
  isCurrent
2164
2139
  });
2165
2140
  }
2141
+ async function showDirectionalConflict(ctx, direction, setup, signal, isCurrent) {
2142
+ let selected = false;
2143
+ const menu = defineMenu5({
2144
+ start: "conflict",
2145
+ screens: {
2146
+ conflict: () => ({
2147
+ kind: "choice",
2148
+ title: `${direction === "push" ? "Push" : "Pull"} stopped \xB7 ${safeTerminalText(setup)}`,
2149
+ lines: [
2150
+ direction === "push" ? "Push would overwrite remote changes since the last accepted sync." : "Pull would overwrite local changes since the last accepted sync.",
2151
+ "No content was written."
2152
+ ],
2153
+ items: [
2154
+ { id: "back", label: "Back" },
2155
+ { id: "review", label: `Review Force ${direction}\u2026` }
2156
+ ],
2157
+ action: "choose",
2158
+ initialItemId: "back",
2159
+ hint: ctx.mode === "rpc" ? "close" : "back"
2160
+ })
2161
+ },
2162
+ actions: {
2163
+ choose: ({ itemId }) => {
2164
+ selected = itemId === "review";
2165
+ return { kind: "back" };
2166
+ }
2167
+ }
2168
+ });
2169
+ const result = await runMenu5(ctx, menu, { getState: () => void 0, signal, isCurrent });
2170
+ if (signal.aborted || !isCurrent() || result.kind !== "closed" || result.reason === "close") return "close";
2171
+ return selected ? "review" : "back";
2172
+ }
2166
2173
  function syncMainMenuItem(label) {
2167
2174
  const actions = {
2168
2175
  "Sync now": "sync",
2169
2176
  "Pull from remote": "pull",
2170
2177
  "Push to remote": "push",
2171
2178
  "View differences": "diff",
2172
- "Check remote status": "status",
2173
2179
  "Switch sync setup": "switch",
2174
2180
  Settings: "settings",
2175
2181
  History: "history",
2176
- Diagnostics: "doctor",
2177
2182
  "Review unresolved conflicts": "conflicts",
2178
2183
  "Restore sync access\u2026 (recommended)": "recover",
2179
2184
  "Stop daemon for recovery\u2026": "daemon-recovery",
@@ -2192,13 +2197,11 @@ function syncMainMenuItem(label) {
2192
2197
  action,
2193
2198
  description: {
2194
2199
  sync: "Merge changes on both sides.",
2195
- pull: "Remote \u2192 this device; replaces conflicting local files.",
2196
- push: "This device \u2192 remote; replaces conflicting remote files.",
2200
+ pull: "Remote \u2192 this device; stops before overwriting local changes.",
2201
+ push: "This device \u2192 remote; stops before overwriting remote changes.",
2197
2202
  diff: "Inspect changes; no transfer.",
2198
- status: "Check remote; no transfer.",
2199
2203
  settings: "Edit settings, setups, and storage connections.",
2200
- history: "Review snapshots and rollback.",
2201
- doctor: "Review backend diagnostics.",
2204
+ history: "Review snapshots and recovery options.",
2202
2205
  switch: "Choose another sync setup.",
2203
2206
  conflicts: "Review unresolved file groups.",
2204
2207
  recover: "Review local lock recovery.",
@@ -2214,4 +2217,4 @@ function syncMainMenuItem(label) {
2214
2217
  export {
2215
2218
  showSyncManager
2216
2219
  };
2217
- //# sourceMappingURL=manager-ui-KHMCSLLV.ts.map
2220
+ //# sourceMappingURL=manager-ui-OMZOBGYT.ts.map