@narumitw/pi-sync 0.63.0 → 0.64.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 (135) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +28 -18
  3. package/dist/chunks/{chunk-HLCML3OW.ts → chunk-4VKWHVUO.ts} +4 -3
  4. package/dist/chunks/chunk-4VKWHVUO.ts.map +7 -0
  5. package/dist/chunks/{chunk-27F5W7DX.ts → chunk-DAZZ5BEJ.ts} +3 -1
  6. package/dist/chunks/chunk-DAZZ5BEJ.ts.map +7 -0
  7. package/dist/chunks/{chunk-V76KCWHO.ts → chunk-F3VODLVQ.ts} +3 -3
  8. package/dist/chunks/{chunk-VQ47JBLF.ts → chunk-FI2F5JBS.ts} +2 -2
  9. package/dist/chunks/{chunk-S6FUUWV5.ts → chunk-NDEZ52SS.ts} +13 -13
  10. package/dist/chunks/{chunk-S6FUUWV5.ts.map → chunk-NDEZ52SS.ts.map} +1 -1
  11. package/dist/chunks/{chunk-UGS6RYDZ.ts → chunk-RW44KNFD.ts} +304 -70
  12. package/dist/chunks/chunk-RW44KNFD.ts.map +7 -0
  13. package/dist/chunks/{chunk-EXDWEFIJ.ts → chunk-TJ7YNITN.ts} +5 -5
  14. package/dist/chunks/{chunk-HSCAFOT5.ts → chunk-TZMVSTAM.ts} +5 -5
  15. package/dist/chunks/{chunk-SXCH4Q5O.ts → chunk-VPSC7BXM.ts} +3 -3
  16. package/dist/chunks/chunk-YT6PDRMM.ts +282 -0
  17. package/dist/chunks/chunk-YT6PDRMM.ts.map +7 -0
  18. package/dist/chunks/{command-handler-VINMQ7ZM.ts → command-handler-N45GY7AV.ts} +39 -27
  19. package/dist/chunks/command-handler-N45GY7AV.ts.map +7 -0
  20. package/dist/chunks/{conflict-review-PCDFRIVB.ts → conflict-review-5E4M44BA.ts} +2 -2
  21. package/dist/chunks/{file-selection-KID23GAD.ts → file-selection-DDQN4LVD.ts} +9 -9
  22. package/dist/chunks/{manager-result-dispatcher-GDB74IOP.ts → manager-result-dispatcher-FKW55L7I.ts} +5 -5
  23. package/dist/chunks/{manager-ui-YHDECYKI.ts → manager-ui-EV23DPZQ.ts} +104 -77
  24. package/dist/chunks/manager-ui-EV23DPZQ.ts.map +7 -0
  25. package/dist/chunks/{merge-review-SGDLMVS4.ts → merge-review-6YSLSMGS.ts} +3 -2
  26. package/dist/chunks/ownership-recovery-UDDHSDSZ.ts +59 -0
  27. package/dist/chunks/ownership-recovery-UDDHSDSZ.ts.map +7 -0
  28. package/dist/chunks/{remote-selection-ui-GPITNEBF.ts → remote-selection-ui-N4NMWFT2.ts} +4 -4
  29. package/dist/chunks/{setup-switch-L54X5U5I.ts → setup-switch-HY7K3442.ts} +4 -4
  30. package/dist/chunks/{setup-wizard-YO4MCPUF.ts → setup-wizard-LEKDQ3HK.ts} +9 -9
  31. package/dist/chunks/{sync-inspection-H2WX5SUT.ts → sync-inspection-OS2LVOLV.ts} +5 -5
  32. package/dist/chunks/{sync-operations-2MZAYHL2.ts → sync-operations-D3MDJUQQ.ts} +2 -2
  33. package/dist/daemon/dist/cli.js +2 -0
  34. package/dist/daemon/dist/client-transport.js +66 -0
  35. package/dist/daemon/dist/client.js +116 -86
  36. package/dist/daemon/dist/consent.js +33 -11
  37. package/dist/daemon/dist/daemon-debug.js +33 -0
  38. package/dist/daemon/dist/daemon-recovery.js +75 -0
  39. package/dist/daemon/dist/engine/backends/git/git-backend.js +39 -12
  40. package/dist/daemon/dist/engine/backends/git/git-runner.js +6 -1
  41. package/dist/daemon/dist/engine/backends/git/git-storage.js +5 -9
  42. package/dist/daemon/dist/engine/backends/publication-encoding.js +19 -0
  43. package/dist/daemon/dist/engine/backends/s3/s3-backend.js +10 -12
  44. package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +15 -26
  45. package/dist/daemon/dist/engine/backends/webdav/webdav-client.js +10 -0
  46. package/dist/daemon/dist/engine/debug-log.js +134 -0
  47. package/dist/daemon/dist/engine/ignore/ignore-initialization.js +50 -14
  48. package/dist/daemon/dist/engine/ignore/ignore-settings.js +11 -14
  49. package/dist/daemon/dist/engine/ignore/ignore-source.js +1 -1
  50. package/dist/daemon/dist/engine/paths.js +7 -1
  51. package/dist/daemon/dist/engine/settings/config-file.js +62 -17
  52. package/dist/daemon/dist/engine/settings/config.js +49 -14
  53. package/dist/daemon/dist/engine/snapshot/snapshot-apply.js +30 -8
  54. package/dist/daemon/dist/engine/snapshot/snapshot-codec.js +3 -1
  55. package/dist/daemon/dist/engine/snapshot/snapshot-payload.js +32 -0
  56. package/dist/daemon/dist/engine/snapshot/snapshot-transaction-images.js +34 -0
  57. package/dist/daemon/dist/engine/snapshot/snapshot-transaction.js +50 -7
  58. package/dist/daemon/dist/engine/snapshot/snapshot.js +64 -25
  59. package/dist/daemon/dist/engine/state/lock.js +157 -17
  60. package/dist/daemon/dist/engine/sync/continuous-sync.js +35 -11
  61. package/dist/daemon/dist/engine/sync/initialization.js +2 -2
  62. package/dist/daemon/dist/engine/sync/local-fields.js +42 -19
  63. package/dist/daemon/dist/engine/sync/merged-sync.js +13 -10
  64. package/dist/daemon/dist/engine/sync/remote-snapshot.js +18 -3
  65. package/dist/daemon/dist/engine/sync/session-push.js +13 -4
  66. package/dist/daemon/dist/engine/sync/startup-bootstrap.js +105 -0
  67. package/dist/daemon/dist/engine/sync/startup-recovery-evidence.js +37 -0
  68. package/dist/daemon/dist/engine/sync/startup-timings.js +80 -8
  69. package/dist/daemon/dist/engine/sync/sync-error-guidance.js +22 -4
  70. package/dist/daemon/dist/engine/sync/sync-inspection.js +4 -7
  71. package/dist/daemon/dist/engine/sync/sync-local.js +3 -1
  72. package/dist/daemon/dist/engine/sync/sync-mutations.js +13 -7
  73. package/dist/daemon/dist/engine/sync/sync-policy.js +9 -1
  74. package/dist/daemon/dist/engine/sync/sync-state.js +12 -4
  75. package/dist/daemon/dist/engine/ui/sync-format.js +23 -55
  76. package/dist/daemon/dist/engine/ui/transfer-review.js +3 -3
  77. package/dist/daemon/dist/engine-service.js +54 -10
  78. package/dist/daemon/dist/identity.js +36 -6
  79. package/dist/daemon/dist/index.js +2 -1
  80. package/dist/daemon/dist/monitor.js +20 -1
  81. package/dist/daemon/dist/paged-review.js +177 -0
  82. package/dist/daemon/dist/participant-ledger.js +149 -0
  83. package/dist/daemon/dist/protocol.js +4 -0
  84. package/dist/daemon/dist/server.js +268 -120
  85. package/dist/daemon/dist/service-host.js +29 -9
  86. package/dist/daemon/dist/state-wait-jobs.js +23 -0
  87. package/dist/daemon/dist/state-wait.js +34 -0
  88. package/dist/daemon/package.json +1 -1
  89. package/dist/index.ts +128 -48
  90. package/dist/index.ts.map +2 -2
  91. package/docs/continuous-sync-verification.md +2 -0
  92. package/docs/daemon-migration.md +30 -2
  93. package/docs/tui-contract.md +8 -2
  94. package/package.json +2 -2
  95. package/skills/configure-pi-sync/SKILL.md +119 -18
  96. package/skills/configure-pi-sync/references/configuration.md +88 -48
  97. package/src/commands/command-execution.ts +11 -3
  98. package/src/commands/command-handler.ts +10 -3
  99. package/src/commands/command.ts +3 -2
  100. package/src/daemon/client-debug.ts +45 -0
  101. package/src/daemon/ownership-recovery.ts +50 -0
  102. package/src/daemon/pi-client.ts +288 -63
  103. package/src/daemon/startup-bootstrap-client.ts +26 -0
  104. package/src/settings/config.ts +1 -0
  105. package/src/sync/automatic-sync.ts +61 -18
  106. package/src/sync/startup-check.ts +13 -5
  107. package/src/sync-extension.ts +46 -8
  108. package/src/ui/manager-state.ts +35 -24
  109. package/src/ui/manager-ui.ts +39 -18
  110. package/src/ui/merge-review.ts +75 -12
  111. package/src/ui/settings-ui.ts +2 -2
  112. package/src/ui/setup/webdav-ui.ts +1 -1
  113. package/src/ui/sync-confirmation.ts +81 -65
  114. package/src/ui/sync-setups-ui.ts +15 -12
  115. package/dist/chunks/chunk-27F5W7DX.ts.map +0 -7
  116. package/dist/chunks/chunk-GSQGBVKG.ts +0 -218
  117. package/dist/chunks/chunk-GSQGBVKG.ts.map +0 -7
  118. package/dist/chunks/chunk-HLCML3OW.ts.map +0 -7
  119. package/dist/chunks/chunk-UGS6RYDZ.ts.map +0 -7
  120. package/dist/chunks/command-handler-VINMQ7ZM.ts.map +0 -7
  121. package/dist/chunks/manager-ui-YHDECYKI.ts.map +0 -7
  122. /package/dist/chunks/{chunk-V76KCWHO.ts.map → chunk-F3VODLVQ.ts.map} +0 -0
  123. /package/dist/chunks/{chunk-VQ47JBLF.ts.map → chunk-FI2F5JBS.ts.map} +0 -0
  124. /package/dist/chunks/{chunk-EXDWEFIJ.ts.map → chunk-TJ7YNITN.ts.map} +0 -0
  125. /package/dist/chunks/{chunk-HSCAFOT5.ts.map → chunk-TZMVSTAM.ts.map} +0 -0
  126. /package/dist/chunks/{chunk-SXCH4Q5O.ts.map → chunk-VPSC7BXM.ts.map} +0 -0
  127. /package/dist/chunks/{conflict-review-PCDFRIVB.ts.map → conflict-review-5E4M44BA.ts.map} +0 -0
  128. /package/dist/chunks/{file-selection-KID23GAD.ts.map → file-selection-DDQN4LVD.ts.map} +0 -0
  129. /package/dist/chunks/{manager-result-dispatcher-GDB74IOP.ts.map → manager-result-dispatcher-FKW55L7I.ts.map} +0 -0
  130. /package/dist/chunks/{merge-review-SGDLMVS4.ts.map → merge-review-6YSLSMGS.ts.map} +0 -0
  131. /package/dist/chunks/{remote-selection-ui-GPITNEBF.ts.map → remote-selection-ui-N4NMWFT2.ts.map} +0 -0
  132. /package/dist/chunks/{setup-switch-L54X5U5I.ts.map → setup-switch-HY7K3442.ts.map} +0 -0
  133. /package/dist/chunks/{setup-wizard-YO4MCPUF.ts.map → setup-wizard-LEKDQ3HK.ts.map} +0 -0
  134. /package/dist/chunks/{sync-inspection-H2WX5SUT.ts.map → sync-inspection-OS2LVOLV.ts.map} +0 -0
  135. /package/dist/chunks/{sync-operations-2MZAYHL2.ts.map → sync-operations-D3MDJUQQ.ts.map} +0 -0
@@ -20,17 +20,18 @@ import {
20
20
  showEditWebDavStorageProfile,
21
21
  showEditWebDavTarget,
22
22
  showIgnoreFileAction
23
- } from "./chunk-S6FUUWV5.ts";
23
+ } from "./chunk-NDEZ52SS.ts";
24
24
  import {
25
25
  dispatchManagerResult
26
- } from "./chunk-V76KCWHO.ts";
26
+ } from "./chunk-F3VODLVQ.ts";
27
+ import "./chunk-TJ7YNITN.ts";
27
28
  import {
28
29
  SETUP_SWITCH_ACTION_OPTIONS,
29
30
  saveOnSwitch,
30
31
  setupSwitchActionFromLabel,
31
32
  setupSwitchActionLabel,
32
33
  useSyncSetup
33
- } from "./chunk-SXCH4Q5O.ts";
34
+ } from "./chunk-VPSC7BXM.ts";
34
35
  import {
35
36
  isCloudflareR2Endpoint,
36
37
  normalizeS3Endpoint,
@@ -55,42 +56,29 @@ import {
55
56
  readStateForConfig,
56
57
  syncAttentionMatchesConfig,
57
58
  syncStateFingerprint
58
- } from "./chunk-VQ47JBLF.ts";
59
+ } from "./chunk-FI2F5JBS.ts";
60
+ import {
61
+ throwIfAborted
62
+ } from "./chunk-UMPA5S7X.ts";
59
63
  import {
60
64
  AUTOMATIC_SYNC_DESCRIPTION,
61
65
  STARTUP_TRANSFER_DESCRIPTION,
62
66
  startupTransferSummary
63
- } from "./chunk-HLCML3OW.ts";
67
+ } from "./chunk-4VKWHVUO.ts";
64
68
  import {
65
69
  confirmMergeReview
66
- } from "./chunk-GSQGBVKG.ts";
70
+ } from "./chunk-YT6PDRMM.ts";
71
+ import {
72
+ runCancellableOperation
73
+ } from "./chunk-CKUGCBHP.ts";
67
74
  import {
68
75
  directoryScopeSummary,
69
76
  showExcludedPaths
70
- } from "./chunk-HSCAFOT5.ts";
77
+ } from "./chunk-TZMVSTAM.ts";
71
78
  import {
72
79
  directorySessionOptInLine,
73
80
  saveReviewedDraft
74
81
  } from "./chunk-JREGWM2B.ts";
75
- import {
76
- manualIgnoreFileGuidance
77
- } from "./chunk-EJDDRS6O.ts";
78
- import {
79
- activeLocalConfigPath,
80
- localConfigPath,
81
- readActiveLocalConfigDocumentForRepair,
82
- syncErrorGuidance
83
- } from "./chunk-IBXEM35O.ts";
84
- import {
85
- piDaemonClient
86
- } from "./chunk-UGS6RYDZ.ts";
87
- import "./chunk-EXDWEFIJ.ts";
88
- import {
89
- runCancellableOperation
90
- } from "./chunk-CKUGCBHP.ts";
91
- import {
92
- throwIfAborted
93
- } from "./chunk-UMPA5S7X.ts";
94
82
  import {
95
83
  addStorageConnection,
96
84
  removeStorageConnection,
@@ -101,18 +89,30 @@ import {
101
89
  import {
102
90
  captureMutationOwner
103
91
  } from "./chunk-GELYN4UC.ts";
92
+ import {
93
+ manualIgnoreFileGuidance
94
+ } from "./chunk-EJDDRS6O.ts";
95
+ import {
96
+ localConfigPath,
97
+ readActiveLocalConfigDocumentForRepair,
98
+ syncErrorGuidance
99
+ } from "./chunk-IBXEM35O.ts";
104
100
  import {
105
101
  sameSyncExclude
106
102
  } from "./chunk-ZO52JM4H.ts";
107
103
  import {
108
104
  configFromSettings,
105
+ createSettingsConfigView,
109
106
  loadConfig,
110
107
  loadConfigForCheck,
111
108
  loadPartialConfig,
112
109
  loadSettingsConfig,
113
110
  syncCheckConfigFingerprint,
114
111
  syncConfigReviewIdentity
115
- } from "./chunk-27F5W7DX.ts";
112
+ } from "./chunk-DAZZ5BEJ.ts";
113
+ import {
114
+ piDaemonClient
115
+ } from "./chunk-RW44KNFD.ts";
116
116
  import {
117
117
  configureSyncStatus
118
118
  } from "./chunk-H7VOTY5N.ts";
@@ -221,7 +221,7 @@ function blockedSyncMenuItem(label, manager) {
221
221
  };
222
222
  }
223
223
  async function showManagerAttention(ctx, attention, runRoute, signal, onSelectionResolved) {
224
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-GPITNEBF.ts");
224
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-N4NMWFT2.ts");
225
225
  if (signal?.aborted) return "close";
226
226
  const review = await showRemoteSelectionReview(ctx, attention.decision.setupName, signal, void 0, {
227
227
  decision: attention.decision,
@@ -309,20 +309,20 @@ function ignoreSetupRecovery(settingsPath) {
309
309
  }
310
310
 
311
311
  // src/ui/sync-setups-ui.ts
312
- async function countValidSyncSetups(setups, signal) {
313
- let count = 0;
314
- for (const name of Object.keys(setups ?? {})) {
312
+ async function hasAnotherSwitchableSetup(view, signal) {
313
+ for (const name of view.setupNames) {
314
+ if (name === view.activeSetupName) continue;
315
315
  throwIfAborted(signal);
316
- let valid = false;
317
316
  try {
318
- await loadConfig(name);
319
- valid = true;
317
+ await view.observe(name, signal);
320
318
  } catch {
319
+ throwIfAborted(signal);
320
+ continue;
321
321
  }
322
322
  throwIfAborted(signal);
323
- if (valid) count += 1;
323
+ return true;
324
324
  }
325
- return count;
325
+ return false;
326
326
  }
327
327
  async function showSyncSetups(ctx, actions, signal) {
328
328
  const validateOwner = captureMutationOwner(ctx, signal);
@@ -549,34 +549,35 @@ var MAIN_MENU_ACTIONS = [
549
549
  "Diagnostics"
550
550
  ];
551
551
  async function describeManagerState(signal, attention, inspectOperation = inspectOperationAvailability, observation, canUseIgnoreSettings) {
552
- let raw;
552
+ signal?.throwIfAborted();
553
+ let document;
554
+ let view;
553
555
  try {
554
- const document = await readActiveLocalConfigDocumentForRepair();
556
+ document = await readActiveLocalConfigDocumentForRepair();
555
557
  signal?.throwIfAborted();
556
- if (document) raw = validateSettingsDocument(document.parsed);
558
+ if (document) view = createSettingsConfigView(document);
557
559
  } catch (error) {
558
- if (signal?.aborted) throw error;
560
+ signal?.throwIfAborted();
559
561
  return {
560
562
  title: [
561
563
  "Manage sync",
562
564
  "",
563
565
  "Settings file needs repair. Automatic sync and settings writes are paused.",
564
566
  `Error: ${safeTerminalText(errorMessage(error))}`,
565
- `File: ${safeTerminalText(await activeLocalConfigPath())}`,
567
+ ...document ? [`File: ${safeTerminalText(document.path)}`] : [],
566
568
  "",
567
569
  "Repair the JSON file, then reopen /sync."
568
570
  ].join("\n"),
569
571
  actions: ["Help"]
570
572
  };
571
573
  }
572
- if (!raw) {
574
+ if (!view || !document) {
573
575
  return {
574
576
  title: ["Manage sync", "", "Not set up.", "", "What do you want to do?"].join("\n"),
575
577
  actions: ["Set up sync", "Help"]
576
578
  };
577
579
  }
578
- const configuredTargets = raw.syncSetups;
579
- if (Object.keys(configuredTargets).length === 0) {
580
+ if (view.setupNames.length === 0) {
580
581
  return {
581
582
  title: [
582
583
  "Manage sync",
@@ -591,33 +592,38 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
591
592
  }
592
593
  let settingsConfig;
593
594
  try {
594
- settingsConfig = configFromSettings(raw);
595
+ settingsConfig = view.metadata();
595
596
  if (settingsConfig.reservedIgnoreNames && canUseIgnoreSettings && !await canUseIgnoreSettings()) {
596
597
  throw new Error("the connected daemon does not support ignore-file setups");
597
598
  }
598
599
  signal?.throwIfAborted();
599
- const config = await loadConfig();
600
+ const config = await view.observe(void 0, signal);
600
601
  signal?.throwIfAborted();
601
602
  const operation = await inspectOperation();
603
+ signal?.throwIfAborted();
602
604
  const changesBlocked = operationBlocksChanges(operation);
603
605
  let currentAttention;
606
+ let alternateUsable = false;
604
607
  if (attention) {
605
608
  try {
606
- const attentionConfig = attention.decision.setupName === config.setupName ? config : await loadConfig(attention.decision.setupName);
609
+ const attentionConfig = attention.decision.setupName === config.setupName ? config : await view.observe(attention.decision.setupName, signal);
610
+ alternateUsable = attentionConfig.setupName !== config.setupName;
607
611
  if (syncAttentionMatchesConfig(attention, attentionConfig)) currentAttention = attention;
608
612
  } catch {
609
613
  currentAttention = void 0;
610
614
  }
611
- if (signal?.aborted) throw signal.reason;
615
+ signal?.throwIfAborted();
612
616
  }
613
617
  const attentionComparison = currentAttention ? compareSyncInclude(currentAttention.decision.localInclude, currentAttention.decision.remoteInclude) : void 0;
614
618
  const attentionExclusionsDiffer = currentAttention ? !sameSyncExclude(currentAttention.decision.localExclude, currentAttention.decision.remoteExclude) : false;
615
619
  const attentionDirectoryPolicy = currentAttention?.decision.localDirectory || currentAttention?.decision.remoteDirectory;
616
620
  const noSyncedContent = !syncSelectionHasContent(config);
617
621
  const syncState = changesBlocked ? void 0 : await readStateForConfig(config).catch(() => void 0);
622
+ signal?.throwIfAborted();
618
623
  const currentObservation = observation && observationMatchesConfig(observation, config) && syncState && syncStateFingerprint(syncState) === observation.inspection.stateIdentity ? observation : void 0;
619
624
  const lastAppliedSnapshot = changesBlocked ? "Unavailable while operations are locked" : syncState?.lastAppliedSnapshot ? `${truncateToWidth(safeTerminalText(syncState.lastAppliedSnapshot), 12, "\u2026")} \xB7 application time unavailable` : syncState ? "Never synced" : "Unavailable";
620
- const canSwitch = await countValidSyncSetups(configuredTargets, signal) > 1;
625
+ const canSwitch = !changesBlocked && (alternateUsable || await hasAnotherSwitchableSetup(view, signal));
626
+ signal?.throwIfAborted();
621
627
  const mainActions = [...MAIN_MENU_ACTIONS];
622
628
  if (config.agentMode && !noSyncedContent) mainActions.splice(1, 0, "Retry refused model result\u2026");
623
629
  if (canSwitch) mainActions.push("Switch sync setup");
@@ -653,7 +659,7 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
653
659
  } : {}
654
660
  };
655
661
  } catch (error) {
656
- if (signal?.aborted) throw error;
662
+ signal?.throwIfAborted();
657
663
  if (settingsConfig?.reservedIgnoreNames !== void 0) {
658
664
  return {
659
665
  title: [
@@ -673,9 +679,9 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
673
679
  "Manage sync",
674
680
  "",
675
681
  "Settings need attention. Automatic sync is paused.",
676
- `Current sync setup: ${safeTerminalText(typeof raw.activeSyncSetup === "string" ? raw.activeSyncSetup : "none")}`,
682
+ `Current sync setup: ${safeTerminalText(view.activeSetupName ?? "none")}`,
677
683
  `Error: ${safeTerminalText(errorMessage(error))}`,
678
- `File: ${safeTerminalText(await activeLocalConfigPath())}`,
684
+ `File: ${safeTerminalText(document.path)}`,
679
685
  "",
680
686
  "What do you want to do?"
681
687
  ].join("\n"),
@@ -749,12 +755,15 @@ function backendStorageDescription(config) {
749
755
  switch (config.backend.type) {
750
756
  case "s3": {
751
757
  const type = config.backend.profile.kind === "r2" || isCloudflareR2Endpoint(config.backend.profile.endpoint) ? "Cloudflare R2" : "S3-compatible";
752
- return `${type} \xB7 ${connection} \xB7 ${safeTerminalText(config.backend.destination.bucket)}`;
758
+ const { bucket, prefix } = config.backend.destination;
759
+ return `${type} \xB7 ${connection} \xB7 ${safeTerminalText(bucket)} \xB7 ${safeTerminalText(prefix)}`;
753
760
  }
754
761
  case "webdav":
755
762
  return `WebDAV \xB7 ${connection} \xB7 ${safeTerminalText(config.backend.destination.path)}`;
756
- case "git":
757
- return `Git \xB7 ${connection} \xB7 ${safeTerminalText(config.backend.destination.branch)}`;
763
+ case "git": {
764
+ const { branch, directory } = config.backend.destination;
765
+ return `Git \xB7 ${connection} \xB7 ${safeTerminalText(branch)} \xB7 ${safeTerminalText(directory)}`;
766
+ }
758
767
  }
759
768
  }
760
769
 
@@ -1712,8 +1721,8 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1712
1721
  },
1713
1722
  {
1714
1723
  id: "debug",
1715
- label: "Debug startup timings",
1716
- description: "All setups on this device: show startup durations in the TUI transcript or RPC notifications, including initial Continuous sync. Applies next session start; no credentials or file contents.",
1724
+ label: "Debug mode",
1725
+ 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.",
1717
1726
  currentValue: state.debug ? "On" : "Off",
1718
1727
  values: ["On", "Off"],
1719
1728
  action: "debug"
@@ -2039,7 +2048,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
2039
2048
  "remote-include": async ({ state, signal: actionSignal }) => {
2040
2049
  if (state.reservedIgnoreNames !== void 0 && !ignoreAvailable) return { kind: "rejected" };
2041
2050
  const reviewSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
2042
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-GPITNEBF.ts");
2051
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-N4NMWFT2.ts");
2043
2052
  if (reviewSignal.aborted) return { kind: "rejected" };
2044
2053
  const review = await showRemoteSelectionReview(ctx, setupName, reviewSignal, void 0, {
2045
2054
  origin: "settings",
@@ -2139,23 +2148,29 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2139
2148
  const menu = defineMenu5({
2140
2149
  start: "main",
2141
2150
  screens: {
2142
- main: ({ state }) => ({
2143
- kind: "choice",
2144
- title: "Manage sync",
2145
- lines: state.manager.title.split("\n").slice(1),
2146
- items: menuItems(state.manager).map((item) => ({
2147
- id: item.id,
2148
- label: ctx.mode === "tui" && item.id === "sync" ? "Sync\u2026" : item.label,
2149
- details: [item.description ?? "Review synced content."],
2150
- searchText: `${item.label} ${item.description ?? ""}`,
2151
- disabled: item.disabled,
2152
- disabledReason: item.disabledReason
2153
- })),
2154
- action: "activate",
2155
- enableSearch: true,
2156
- viewportSize: 5,
2157
- hint: "close"
2158
- })
2151
+ main: ({ state: { manager } }) => {
2152
+ const [title = "Manage sync", ...lines] = manager.title.split("\n");
2153
+ const setupName = ctx.mode === "tui" ? manager.configReview?.setupName : void 0;
2154
+ const setup = setupName === void 0 ? void 0 : safeTerminalText(setupName);
2155
+ const setupInHeading = setup !== void 0 && lines[0] === `Current sync setup: ${setup}`;
2156
+ return {
2157
+ kind: "choice",
2158
+ title: setupInHeading ? `${title} \xB7 ${setup}` : title,
2159
+ lines: setupInHeading ? lines.slice(1) : lines,
2160
+ items: menuItems(manager).map((item) => ({
2161
+ id: item.id,
2162
+ label: ctx.mode === "tui" && item.id === "sync" ? "Sync\u2026" : item.label,
2163
+ details: [item.description ?? "Review synced content."],
2164
+ searchText: `${item.label} ${item.description ?? ""}`,
2165
+ disabled: item.disabled,
2166
+ disabledReason: item.disabledReason
2167
+ })),
2168
+ action: "activate",
2169
+ enableSearch: true,
2170
+ viewportSize: 5,
2171
+ hint: "close"
2172
+ };
2173
+ }
2159
2174
  },
2160
2175
  actions: {
2161
2176
  activate: async (invocation) => {
@@ -2169,7 +2184,7 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2169
2184
  if (!attention) {
2170
2185
  const observation = state.manager.observation;
2171
2186
  if (!observation) return { kind: "stay" };
2172
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-GPITNEBF.ts");
2187
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-N4NMWFT2.ts");
2173
2188
  if (sessionSignal?.aborted) return { kind: "close" };
2174
2189
  const config = await loadConfig();
2175
2190
  if (sessionSignal?.aborted) return { kind: "close" };
@@ -2348,6 +2363,10 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
2348
2363
  });
2349
2364
  return { kind: result.kind === "closed" ? "close" : "stay" };
2350
2365
  },
2366
+ "daemon-recovery": async ({ signal }) => {
2367
+ await runRoute("daemon recover", signal);
2368
+ return { kind: "stay" };
2369
+ },
2351
2370
  recover: async ({ state, signal: actionSignal }) => {
2352
2371
  const result = await recoverSyncAccess(ctx, state.manager, runRoute, sessionSignal, actionSignal);
2353
2372
  return { kind: result === "close" ? "close" : "stay" };
@@ -2425,7 +2444,12 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
2425
2444
  }
2426
2445
  };
2427
2446
  let firstOpen = true;
2447
+ const recovery = {
2448
+ title: "Pi Sync recovery required\nDaemon cleanup could not be confirmed. Stop the daemon before retrying a transfer.",
2449
+ actions: ["Stop daemon for recovery\u2026", "Help"]
2450
+ };
2428
2451
  const describe = async (signal) => {
2452
+ if (options.needsDaemonRecovery?.()) return recovery;
2429
2453
  const pendingAttention = options.getAttention?.();
2430
2454
  const observation = options.getObservation?.();
2431
2455
  const manager = await describeManagerState(
@@ -2436,6 +2460,7 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
2436
2460
  () => ignoreFileSettingsAvailable(ctx, signal)
2437
2461
  );
2438
2462
  if (signal.aborted || !isCurrent()) return manager;
2463
+ if (options.needsDaemonRecovery?.()) return recovery;
2439
2464
  if (observation && options.getObservation?.() === observation && !manager.observation && !(manager.operation && operationBlocksChanges(manager.operation))) {
2440
2465
  options.onObservationInvalidated?.();
2441
2466
  }
@@ -2472,6 +2497,7 @@ function syncMainMenuItem(label) {
2472
2497
  Diagnostics: "doctor",
2473
2498
  "Review unresolved conflicts": "conflicts",
2474
2499
  "Restore sync access\u2026 (recommended)": "recover",
2500
+ "Stop daemon for recovery\u2026": "daemon-recovery",
2475
2501
  "Refresh operation status": "refresh",
2476
2502
  "Sync setups\u2026": "setups",
2477
2503
  "Storage connections\u2026": "connections",
@@ -2498,6 +2524,7 @@ function syncMainMenuItem(label) {
2498
2524
  switch: "Choose another sync setup.",
2499
2525
  conflicts: "Review unresolved file groups.",
2500
2526
  recover: "Review local lock recovery.",
2527
+ "daemon-recovery": "Review and stop the current daemon without starting another.",
2501
2528
  refresh: "Recheck the operation lock.",
2502
2529
  setups: "Manage sync setups.",
2503
2530
  connections: "Manage storage connections.",
@@ -2509,4 +2536,4 @@ function syncMainMenuItem(label) {
2509
2536
  export {
2510
2537
  showSyncManager
2511
2538
  };
2512
- //# sourceMappingURL=manager-ui-YHDECYKI.ts.map
2539
+ //# sourceMappingURL=manager-ui-EV23DPZQ.ts.map