@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
@@ -18,87 +18,57 @@ import {
18
18
  showEditS3Target,
19
19
  showEditWebDavStorageProfile,
20
20
  showEditWebDavTarget
21
- } from "./chunk-AVTW6WNP.ts";
22
- import {
23
- automaticSyncSummary
24
- } from "./chunk-ECYCNZOE.ts";
25
- import {
26
- ignoreFileSettingsAvailable,
27
- showIgnoreFileAction
28
- } from "./chunk-33EDXDLC.ts";
29
- import "./chunk-KNEUL4XN.ts";
21
+ } from "./chunk-FQKWGVMA.ts";
30
22
  import {
31
23
  dispatchManagerResult
32
- } from "./chunk-HLJIRWFL.ts";
33
- import "./chunk-X344HTVV.ts";
24
+ } from "./chunk-BCDBT4X3.ts";
25
+ import "./chunk-WCGLU526.ts";
34
26
  import {
35
27
  SETUP_SWITCH_ACTION_OPTIONS,
36
28
  saveOnSwitch,
37
29
  setupSwitchActionFromLabel,
38
30
  setupSwitchActionLabel,
39
31
  useSyncSetup
40
- } from "./chunk-DGVZYS7T.ts";
32
+ } from "./chunk-FR6A7ASZ.ts";
41
33
  import {
42
34
  isCloudflareR2Endpoint,
43
35
  normalizeS3Endpoint,
44
36
  ownRecord,
45
37
  validateSettingsDocument
46
38
  } from "./chunk-APZVJAEW.ts";
39
+ import {
40
+ automaticSyncSummary
41
+ } from "./chunk-ECYCNZOE.ts";
47
42
  import {
48
43
  loadOnSwitch,
49
44
  readLocalConfigObject,
50
- requireSettings,
51
45
  updateLocalConfig
52
- } from "./chunk-WBIOSK76.ts";
53
- import {
54
- startupTransferEnabled
55
- } from "./chunk-WFBHWYI6.ts";
46
+ } from "./chunk-R7PN3KIY.ts";
56
47
  import {
57
48
  observationMatchesConfig,
58
49
  observationSummary,
59
50
  readStateForConfig,
60
51
  syncAttentionMatchesConfig,
61
52
  syncStateFingerprint
62
- } from "./chunk-3Q3DMMID.ts";
63
- import {
64
- piDaemonClient
65
- } from "./chunk-CQ4DMLH3.ts";
53
+ } from "./chunk-TLYT6HVI.ts";
66
54
  import {
67
55
  throwIfAborted
68
56
  } from "./chunk-UMPA5S7X.ts";
69
- import {
70
- configureSyncStatus
71
- } from "./chunk-H7VOTY5N.ts";
72
57
  import {
73
58
  AUTOMATIC_SYNC_DESCRIPTION,
74
59
  STARTUP_TRANSFER_DESCRIPTION,
75
60
  startupTransferSummary
76
- } from "./chunk-XUZV4OGI.ts";
77
- import {
78
- confirmMergeReview
79
- } from "./chunk-ECUCXF5Y.ts";
61
+ } from "./chunk-335XTMMZ.ts";
80
62
  import {
81
63
  runCancellableOperation
82
- } from "./chunk-PUSMSKIM.ts";
83
- import {
84
- errorMessage
85
- } from "./chunk-6YKOHBSC.ts";
64
+ } from "./chunk-AYGMIMCV.ts";
86
65
  import {
87
66
  directoryScopeSummary,
88
67
  showExcludedPaths
89
- } from "./chunk-2MUAR5GH.ts";
90
- import {
91
- manualIgnoreFileGuidance
92
- } from "./chunk-EJDDRS6O.ts";
68
+ } from "./chunk-KAIVTJIQ.ts";
93
69
  import {
94
- directorySessionOptInLine,
95
70
  saveReviewedDraft
96
- } from "./chunk-JREGWM2B.ts";
97
- import {
98
- localConfigPath,
99
- readActiveLocalConfigDocumentForRepair,
100
- syncErrorGuidance
101
- } from "./chunk-IBXEM35O.ts";
71
+ } from "./chunk-XNUARYLR.ts";
102
72
  import {
103
73
  addStorageConnection,
104
74
  removeStorageConnection,
@@ -109,15 +79,14 @@ import {
109
79
  import {
110
80
  captureMutationOwner
111
81
  } from "./chunk-GELYN4UC.ts";
82
+ import {
83
+ localConfigPath,
84
+ readActiveLocalConfigDocumentForRepair,
85
+ syncErrorGuidance
86
+ } from "./chunk-IBXEM35O.ts";
112
87
  import {
113
88
  sameSyncExclude
114
89
  } from "./chunk-ZO52JM4H.ts";
115
- import {
116
- compareSyncInclude,
117
- syncIncludeSelection,
118
- syncSelectionHasContent,
119
- syncSessionsSelected
120
- } from "./chunk-R3SAMXB6.ts";
121
90
  import {
122
91
  configFromSettings,
123
92
  createSettingsConfigView,
@@ -127,13 +96,25 @@ import {
127
96
  loadSettingsConfig,
128
97
  syncCheckConfigFingerprint,
129
98
  syncConfigReviewIdentity
130
- } from "./chunk-3NS4PMCI.ts";
99
+ } from "./chunk-J52GYZO6.ts";
100
+ import {
101
+ configureSyncStatus
102
+ } from "./chunk-H7VOTY5N.ts";
103
+ import {
104
+ errorMessage
105
+ } from "./chunk-6YKOHBSC.ts";
106
+ import {
107
+ compareSyncInclude,
108
+ syncIncludeSelection,
109
+ syncSelectionHasContent,
110
+ syncSessionsSelected
111
+ } from "./chunk-R3SAMXB6.ts";
131
112
  import {
132
113
  safeTerminalText
133
114
  } from "./chunk-2JNFEZ3V.ts";
134
115
 
135
116
  // src/ui/manager-ui.ts
136
- import { defineMenu as defineMenu5, runDocumentReview, runMenu as runMenu5 } from "@narumitw/pi-tui-kit";
117
+ import { defineMenu as defineMenu5, runMenu as runMenu5 } from "@narumitw/pi-tui-kit";
137
118
 
138
119
  // src/state/operation-availability.ts
139
120
  import {
@@ -143,59 +124,6 @@ import {
143
124
  operationCanRecover
144
125
  } from "#pi-sync-daemon/engine/state/operation-availability";
145
126
 
146
- // src/ui/ignore-migration-prompt.ts
147
- var reviewNow = "Review migration now";
148
- var notNow = "Not now";
149
- async function showIgnoreMigrationPrompt(ctx, setup, signal, isCurrent) {
150
- if (ctx.mode !== "tui" || !ctx.hasUI || signal.aborted || !isCurrent()) return false;
151
- if (!await ignoreFileSettingsAvailable(ctx, signal) || signal.aborted || !isCurrent()) return false;
152
- let shown = false;
153
- try {
154
- const client = piDaemonClient(ctx);
155
- const valid = () => {
156
- if (signal.aborted || !isCurrent()) return false;
157
- client.validate();
158
- return true;
159
- };
160
- const offer = await client.run("ignore.migration-offer", { setup }, signal, ctx);
161
- if (!valid()) return false;
162
- const token = readOfferToken(offer);
163
- if (!token) return false;
164
- shown = true;
165
- const choice = await ctx.ui.select(
166
- [
167
- `Review migration for sync setup \u201C${safeTerminalText(setup)}\u201D?`,
168
- "Your current rules still apply. Review the paths that would change before deciding.",
169
- "Migration does not start a transfer. You can review it later in Pi Sync Settings."
170
- ].join("\n\n"),
171
- [reviewNow, notNow],
172
- { signal }
173
- );
174
- if (!valid()) return true;
175
- if (choice === notNow) {
176
- await client.run("ignore.migration-defer", { setup, token }, signal, ctx);
177
- } else if (choice === reviewNow) {
178
- await showIgnoreFileAction(ctx, setup, "migrate", ".syncignore", signal, token);
179
- }
180
- } catch (error) {
181
- if (!signal.aborted && isCurrent()) {
182
- ctx.ui.notify(
183
- `Pi Sync migration prompt: ${safeTerminalText(error instanceof Error ? error.message : String(error))}`,
184
- "warning"
185
- );
186
- }
187
- }
188
- return shown;
189
- }
190
- function readOfferToken(value) {
191
- if (value === null) return void 0;
192
- const token = value?.token;
193
- if (typeof token !== "string" || !/^[0-9a-f]{64}$/u.test(token)) {
194
- throw new Error("Invalid migration offer from the daemon.");
195
- }
196
- return token;
197
- }
198
-
199
127
  // src/ui/manager-attention.ts
200
128
  function attentionMainMenuItems(manager) {
201
129
  if (!manager.attention && manager.observation?.inspection.selectionState?.kind !== "different") return [];
@@ -224,7 +152,7 @@ function blockedSyncMenuItem(label, manager) {
224
152
  };
225
153
  }
226
154
  async function showManagerAttention(ctx, attention, runRoute, signal, onSelectionResolved) {
227
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-DOYKUMER.ts");
155
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-F6NJBQ3Y.ts");
228
156
  if (signal?.aborted) return "close";
229
157
  const review = await showRemoteSelectionReview(ctx, attention.decision.setupName, signal, void 0, {
230
158
  decision: attention.decision,
@@ -291,27 +219,6 @@ import { truncateToWidth } from "@earendil-works/pi-tui";
291
219
 
292
220
  // src/ui/sync-setups-ui.ts
293
221
  import { defineMenu, runMenu } from "@narumitw/pi-tui-kit";
294
-
295
- // src/ui/settings-review.ts
296
- async function loadSettingsCatalog() {
297
- const document = await readActiveLocalConfigDocumentForRepair();
298
- if (!document) return void 0;
299
- const settings = validateSettingsDocument(document.parsed);
300
- const ignoreSetups = Object.entries(settings.syncSetups).filter(([, setup]) => setup.sync.pathPolicy === "ignore-file").map(([name]) => name);
301
- return { settings, path: document.path, ignoreSetups };
302
- }
303
- var IGNORE_SETUP_MANAGEMENT_LIMIT = "Adding, editing, and switching setups are unavailable while any setup uses an ignore file.";
304
- function ignoreSetupRecovery(settingsPath) {
305
- return [
306
- `For manual recovery, close Pi and back up: ${safeTerminalText(settingsPath)}`,
307
- "Remove the ignore-file entries from syncSetups.",
308
- "Set activeSyncSetup to a remaining setup, or remove it if none remain.",
309
- "Keep the settings version, ignore files, and remote data unchanged.",
310
- "Preserve any pending journal and backup. Review automatic sync before restarting Pi."
311
- ];
312
- }
313
-
314
- // src/ui/sync-setups-ui.ts
315
222
  async function hasAnotherSwitchableSetup(view, signal) {
316
223
  for (const name of view.setupNames) {
317
224
  if (name === view.activeSetupName) continue;
@@ -349,9 +256,9 @@ async function showSyncSetups(ctx, actions, signal) {
349
256
  return {
350
257
  kind: "actions",
351
258
  title: "Sync setups",
352
- lines: state.recovery ?? ["What to sync, where to store it, and when to sync."],
259
+ lines: ["What to sync, where to store it, and when to sync."],
353
260
  items: [
354
- ...state.recovery ? [] : [{ id: "add", label: "Add sync setup", action: "add" }],
261
+ { id: "add", label: "Add sync setup", action: "add" },
355
262
  ...names.map((name, index) => {
356
263
  const id = `setup:${index}`;
357
264
  nameById.set(id, name);
@@ -371,14 +278,14 @@ async function showSyncSetups(ctx, actions, signal) {
371
278
  title: state.selected ? `Sync setup \u201C${safeTerminalText(state.selected.name)}\u201D` : "Sync setup",
372
279
  lines: state.selected?.detail ?? ["This sync setup no longer exists."],
373
280
  items: state.selected ? [
374
- ...state.recovery || state.selected.name === state.active || !state.selected.valid ? [] : [
281
+ ...state.selected.name === state.active || !state.selected.valid ? [] : [
375
282
  {
376
283
  id: "make-current",
377
284
  label: "Make current\u2026",
378
285
  action: "make-current"
379
286
  }
380
287
  ],
381
- ...state.recovery ? [] : [{ id: "edit", label: "Edit storage location\u2026", action: "edit" }],
288
+ { id: "edit", label: "Edit storage location\u2026", action: "edit" },
382
289
  ...state.selected.removeUnavailable ? [] : [
383
290
  {
384
291
  id: "remove",
@@ -392,8 +299,7 @@ async function showSyncSetups(ctx, actions, signal) {
392
299
  })
393
300
  },
394
301
  actions: {
395
- add: async ({ state }) => {
396
- if (state.recovery) return { kind: "rejected" };
302
+ add: async () => {
397
303
  try {
398
304
  await actions.add(signal);
399
305
  } catch (error) {
@@ -408,7 +314,7 @@ async function showSyncSetups(ctx, actions, signal) {
408
314
  return selectedName ? { kind: "to", screen: "detail" } : { kind: "rejected" };
409
315
  },
410
316
  "make-current": async ({ state }) => {
411
- if (!selectedName || state.recovery || !state.selected?.valid) return { kind: "rejected" };
317
+ if (!selectedName || !state.selected?.valid) return { kind: "rejected" };
412
318
  try {
413
319
  exit = await actions.makeCurrent(selectedName, signal) === "exit";
414
320
  return exit ? { kind: "close" } : { kind: "stay" };
@@ -417,8 +323,8 @@ async function showSyncSetups(ctx, actions, signal) {
417
323
  return { kind: "stay" };
418
324
  }
419
325
  },
420
- edit: async ({ state }) => {
421
- if (!selectedName || state.recovery) return { kind: "rejected" };
326
+ edit: async () => {
327
+ if (!selectedName) return { kind: "rejected" };
422
328
  try {
423
329
  await actions.edit(selectedName, signal);
424
330
  } catch (error) {
@@ -445,41 +351,37 @@ async function showSyncSetups(ctx, actions, signal) {
445
351
  }
446
352
  });
447
353
  await runMenu(ctx, menu, {
448
- getState: async ({ signal: loadSignal }) => loadSetupMenuState(ctx, selectedName, loadSignal),
354
+ getState: ({ signal: loadSignal }) => loadSetupMenuState(selectedName, loadSignal),
449
355
  signal,
450
356
  isCurrent
451
357
  });
452
358
  return exit ? "exit" : void 0;
453
359
  }
454
- async function loadSetupMenuState(ctx, selectedName, signal) {
455
- const catalog = await loadSettingsCatalog();
456
- throwIfAborted(signal);
457
- if (!catalog) return { setups: {} };
458
- const { syncSetups: setups, activeSyncSetup: active } = catalog.settings;
459
- const recovery = catalog.ignoreSetups.length && !await ignoreFileSettingsAvailable(ctx, signal) ? [IGNORE_SETUP_MANAGEMENT_LIMIT, ...ignoreSetupRecovery(catalog.path)] : void 0;
360
+ async function loadSetupMenuState(selectedName, signal) {
361
+ const document = await readActiveLocalConfigDocumentForRepair();
460
362
  throwIfAborted(signal);
461
- if (!selectedName || !Object.hasOwn(setups, selectedName)) return { setups, active, recovery };
363
+ if (!document) return { setups: {} };
364
+ const raw = validateSettingsDocument(document.parsed);
365
+ const { syncSetups: setups, activeSyncSetup: active } = raw;
366
+ if (!selectedName || !Object.hasOwn(setups, selectedName)) return { setups, active };
462
367
  const setupCount = Object.keys(setups).length;
463
368
  const isCurrent = selectedName === active;
464
369
  let detail;
465
370
  let valid = true;
466
371
  try {
467
- const config = configFromSettings(catalog.settings, selectedName);
372
+ const config = configFromSettings(raw, selectedName);
373
+ throwIfAborted(signal);
468
374
  const selection = syncIncludeSelection(config.include);
469
375
  detail = [
470
376
  `Status: ${isCurrent ? "Current" : "Not current"}`,
471
377
  `Storage connection: ${safeTerminalText(config.connectionName)}`,
472
378
  `Endpoint: ${storageEndpoint(config)}`,
473
379
  `Storage location: ${storageLocation(config)}`,
474
- config.pathPolicy === "ignore-file" ? `Sync scope: Pi agent directory \xB7 ignore file: ${safeTerminalText(config.ignoreFile ?? ".syncignore")}` : config.scope ? `Sync scope: Pi agent directory \xB7 ${config.exclude?.length ?? 0} exclusions \xB7 ${config.reinclude?.length ?? 0} exceptions` : `Included content: ${selection.builtIns.length} built-in groups \xB7 ${selection.custom.length} extra paths`,
380
+ config.scope ? `Sync scope: Pi agent directory \xB7 ${config.exclude?.length ?? 0} exclusions \xB7 ${config.reinclude?.length ?? 0} exceptions` : `Included content: ${selection.builtIns.length} built-in groups \xB7 ${selection.custom.length} extra paths`,
475
381
  `Sessions: ${syncSessionsSelected(config) ? "On \u2014 privacy-sensitive" : "Off"}`,
476
382
  `Automatic sync: ${config.automatic ? "On" : "Off"}`,
477
383
  `Automatic transfer at startup: ${config.automaticTransfer ? "On \u2014 may upload, replace, or delete selected files; no reload" : "Off"}`,
478
- `Autonomous sync: ${config.agentMode ? "On (autonomous merged sync)" : "Off"}`,
479
- `Continuous sync: ${config.continuous ? config.agentMode ? "On (recurring requests and transfers)" : "Saved On; paused until Autonomous sync is enabled" : "Off"}`,
480
- ...recovery ? [] : [
481
- isCurrent ? "Edit included content and automatic sync in /sync \u2192 Settings." : "To edit included content or automatic sync, make this setup current, then open /sync \u2192 Settings."
482
- ]
384
+ isCurrent ? "Edit included content and automatic sync in /sync \u2192 Settings." : "To edit included content or automatic sync, make this setup current, then open /sync \u2192 Settings."
483
385
  ];
484
386
  } catch (error) {
485
387
  valid = false;
@@ -489,19 +391,11 @@ async function loadSetupMenuState(ctx, selectedName, signal) {
489
391
  "Make current and sync are unavailable until this setup is repaired."
490
392
  ];
491
393
  }
492
- const removeNeedsSwitch = isCurrent && setupCount > 1;
493
- const ignoreSetupsRemain = catalog.ignoreSetups.some((name) => name !== selectedName);
494
- const removeUnavailable = removeNeedsSwitch || Boolean(recovery && ignoreSetupsRemain);
495
- if (recovery) {
496
- if (removeUnavailable) detail.unshift("Remove unavailable here; use manual recovery.");
497
- detail.unshift(...recovery);
498
- } else if (removeNeedsSwitch) {
499
- detail.push("Remove unavailable: switch to another setup first.");
500
- }
394
+ const removeUnavailable = isCurrent && setupCount > 1;
395
+ if (removeUnavailable) detail.push("Remove unavailable: switch to another setup first.");
501
396
  return {
502
397
  setups,
503
398
  active,
504
- recovery,
505
399
  selected: { name: selectedName, detail, valid, removeUnavailable }
506
400
  };
507
401
  }
@@ -551,7 +445,7 @@ var MAIN_MENU_ACTIONS = [
551
445
  "History",
552
446
  "Diagnostics"
553
447
  ];
554
- async function describeManagerState(signal, attention, inspectOperation = inspectOperationAvailability, observation, canUseIgnoreSettings) {
448
+ async function describeManagerState(signal, attention, inspectOperation = inspectOperationAvailability, observation) {
555
449
  signal?.throwIfAborted();
556
450
  let document;
557
451
  let view;
@@ -569,7 +463,7 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
569
463
  `Error: ${safeTerminalText(errorMessage(error))}`,
570
464
  ...document ? [`File: ${safeTerminalText(document.path)}`] : [],
571
465
  "",
572
- "Repair the JSON file, then reopen /sync."
466
+ "Resolve the settings error, then reopen /sync."
573
467
  ].join("\n"),
574
468
  actions: ["Help"]
575
469
  };
@@ -593,12 +487,7 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
593
487
  actions: ["Sync setups\u2026", "Storage connections\u2026", "Help"]
594
488
  };
595
489
  }
596
- let settingsConfig;
597
490
  try {
598
- settingsConfig = view.metadata();
599
- if (settingsConfig.reservedIgnoreNames && canUseIgnoreSettings && !await canUseIgnoreSettings()) {
600
- throw new Error("the connected daemon does not support ignore-file setups");
601
- }
602
491
  signal?.throwIfAborted();
603
492
  const config = await view.observe(void 0, signal);
604
493
  signal?.throwIfAborted();
@@ -628,34 +517,26 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
628
517
  const canSwitch = !changesBlocked && (alternateUsable || await hasAnotherSwitchableSetup(view, signal));
629
518
  signal?.throwIfAborted();
630
519
  const mainActions = [...MAIN_MENU_ACTIONS];
631
- if (config.agentMode && !noSyncedContent) mainActions.splice(1, 0, "Retry refused model result\u2026");
632
520
  if (canSwitch) mainActions.push("Switch sync setup");
633
521
  if (syncState?.unresolved?.length) mainActions.unshift("Review unresolved conflicts");
634
- const background = changesBlocked ? [] : await backgroundSummary(config);
635
- signal?.throwIfAborted();
636
522
  const ordinaryTitle = [
637
523
  "Manage sync",
638
524
  `Current sync setup: ${safeTerminalText(config.setupName)}`,
639
525
  `Storage: ${backendStorageDescription(config)}`,
640
- ...config.pathPolicy === "ignore-file" ? [
641
- `Sync scope: Pi agent directory \xB7 ignore file: ${safeTerminalText(config.ignoreFile ?? ".syncignore")}`,
642
- ...config.ignorePolicy?.matches(config.ignorePolicy.filename) === false ? ["New snapshots include this rule file and its comments in remote history."] : []
643
- ] : config.scope ? ["Sync scope: Pi agent directory, with exclusions"] : [],
526
+ ...config.scope ? ["Sync scope: Pi agent directory, with exclusions"] : [],
644
527
  ...syncState?.unresolved?.length ? [`Unresolved: ${syncState.unresolved.length} dependency groups \xB7 review needed`] : [],
645
528
  ...currentAttention ? [
646
529
  currentAttention.decision.setupName === config.setupName ? "Sync status: Review needed" : `Sync status: Review needed for setup ${safeTerminalText(currentAttention.decision.setupName)}`,
647
- currentAttention.decision.ignorePolicyComparison ? "Ignore-file policies differ." : 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." : ""}`
530
+ 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." : ""}`
648
531
  ] : currentObservation ? [`Observed ${safeTerminalText(currentObservation.checkedAt)}: ${observationSummary(currentObservation)}`] : ["Remote status: Not checked"],
649
532
  `Last applied: ${lastAppliedSnapshot}`,
650
- ...config.agentMode ? ["Auto-apply: On \xB7 AI requests may incur costs"] : config.automaticTransfer || config.automatic && syncSessionsSelected(config) ? ["Automatic transfer permission: On \xB7 see Settings"] : [],
651
- ...background,
533
+ ...config.automaticTransfer || config.automatic && syncSessionsSelected(config) ? ["Automatic transfer permission: On \xB7 see Settings"] : [],
652
534
  ...noSyncedContent ? ["", "No included content is selected. Choose included content in Settings before syncing."] : []
653
535
  ];
654
536
  return {
655
537
  title: (changesBlocked ? ["Manage sync", ...operationStatusLines(operation)] : ordinaryTitle).join("\n"),
656
538
  actions: operationActions(operation, noSyncedContent, canSwitch, mainActions),
657
539
  configReview: { setupName: config.setupName, fingerprint: syncCheckConfigFingerprint(config) },
658
- settingsReview: { setupName: settingsConfig.setupName, fingerprint: syncCheckConfigFingerprint(settingsConfig) },
659
540
  operation,
660
541
  ...currentObservation ? { observation: currentObservation } : {},
661
542
  ...currentAttention ? {
@@ -666,20 +547,6 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
666
547
  };
667
548
  } catch (error) {
668
549
  signal?.throwIfAborted();
669
- if (settingsConfig?.reservedIgnoreNames !== void 0) {
670
- return {
671
- title: [
672
- "Manage sync",
673
- `Current sync setup: ${safeTerminalText(settingsConfig.setupName)}`,
674
- `Transfers are unavailable: ${safeTerminalText(errorMessage(error))}`
675
- ].join("\n"),
676
- actions: ["Settings", "Sync setups\u2026", "Storage connections\u2026", "Help"],
677
- settingsReview: {
678
- setupName: settingsConfig.setupName,
679
- fingerprint: syncCheckConfigFingerprint(settingsConfig)
680
- }
681
- };
682
- }
683
550
  return {
684
551
  title: [
685
552
  "Manage sync",
@@ -695,26 +562,6 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
695
562
  };
696
563
  }
697
564
  }
698
- async function backgroundSummary(config) {
699
- if (!config.continuous) return [];
700
- if (!config.agentMode) return ["Background sync: Paused \xB7 enable Autonomous sync"];
701
- try {
702
- const { continuousBinding, readContinuousPrivateDocument } = await import("./continuous-storage-3EU6I7Z3.ts");
703
- const recordApi = await import("./continuous-record-3SKJ6I3V.ts");
704
- const binding = await continuousBinding(config);
705
- const document = await readContinuousPrivateDocument(`${binding}.json`);
706
- if (!document) return ["Background sync: Enabled \xB7 not yet observed"];
707
- recordApi.validateContinuousRecord(document.value, binding);
708
- const record = document.value;
709
- const phases = { waiting: "Waiting", syncing: "Syncing", retry: "Retry", blocked: "Blocked" };
710
- return [
711
- `Background sync (recorded): ${phases[record.phase]}${record.error ? ` \xB7 ${record.error}` : ""}`,
712
- ...record.transferred === void 0 ? [] : [`Last background transfer: Success \xB7 ${new Date(record.transferred).toISOString()}`]
713
- ];
714
- } catch {
715
- return ["Background sync: Unknown \xB7 open Diagnostics"];
716
- }
717
- }
718
565
  function operationActions(operation, noSyncedContent, canSwitch, mainActions) {
719
566
  if (operationCanRecover(operation)) {
720
567
  return ["Restore sync access\u2026 (recommended)", "History", "Help"];
@@ -787,71 +634,6 @@ import {
787
634
  validateSnapshotFieldPolicy
788
635
  } from "#pi-sync-daemon/engine/sync/local-fields";
789
636
 
790
- // src/ui/agent-mode-setting.ts
791
- import { isDeepStrictEqual } from "node:util";
792
- var AGENT_MODE_DESCRIPTION = "This setup: sync eligible changes at session startup and on Sync now without transfer confirmation. Use the selected Pi model to resolve supported text and settings conflicts. Eligible conflict content may be sent to its provider and incur costs. Selected local and remote content can be replaced or deleted. Unresolved conflicts pause unless partial sync permits independent progress. Continuous sync is a separate opt-in. No automatic reload.";
793
- var CONTINUOUS_DESCRIPTION = "This setup: recurring sync while Pi is open. Requires Autonomous sync. Watches selected files, checks the remote every 60\u201366 seconds, and retries temporary failures. Local changes and retries can cause extra requests between polls. May disclose conflict text and incur model/storage costs. No automatic reload.";
794
- function saveContinuousMode(ctx, setupName, enabled, signal) {
795
- return saveAgentMode(ctx, setupName, enabled, signal, "continuous");
796
- }
797
- async function saveAgentMode(ctx, setupName, enabled, signal, preference = "agentMode") {
798
- const validate = captureMutationOwner(ctx, signal);
799
- const settings = await requireSettings();
800
- validate();
801
- const setup = settings.syncSetups[setupName];
802
- if (!setup || settings.activeSyncSetup !== setupName) throw new Error("Current sync setup changed; reopen Settings.");
803
- const continuous = preference === "continuous";
804
- const label = continuous ? "Continuous sync" : "Autonomous sync";
805
- if (enabled && continuous && !setup.sync.agentMode) throw new Error("Enable Autonomous sync before Continuous sync.");
806
- if (Boolean(setup.sync[preference]) === enabled) return true;
807
- if (enabled) {
808
- const summary = [
809
- `Setup: ${safeTerminalText(setupName)}`,
810
- `Storage connection: ${safeTerminalText(setup.storage.connection)}`,
811
- `Storage path: ${safeTerminalText(setup.storage.path)}`,
812
- ...setup.storage.bucket ? [`Bucket: ${safeTerminalText(String(setup.storage.bucket))}`] : [],
813
- ...setup.storage.branch ? [`Branch: ${safeTerminalText(String(setup.storage.branch))}`] : [],
814
- ...setup.sync.scope ? [
815
- "Sync scope: all eligible files in the Pi agent directory.",
816
- directorySessionOptInLine(setup.sync.sessions),
817
- `Excluded paths: ${setup.sync.exclude?.map(safeTerminalText).join(", ") || "none"}`,
818
- `Re-included paths: ${setup.sync.reinclude?.map(safeTerminalText).join(", ") || "none"}`
819
- ] : [`Included paths: ${setup.sync.include.map(safeTerminalText).join(", ")}`],
820
- continuous ? CONTINUOUS_DESCRIPTION : AGENT_MODE_DESCRIPTION,
821
- ...continuous ? [
822
- "Upgrade all Pi processes sharing this agent directory before enabling Continuous sync. Monitoring starts after the /sync command or manager closes. An elected idle local session uses its selected Pi model; another session can use a different provider/model. Each computer is a separate replica.",
823
- "Automatic requests are limited to two per candidate and two per replica binding in a rolling 15-minute window, across restarts. Network/storage checks and requests may incur costs. Retries start at five seconds and grow to five minutes. These are request bounds, not a currency cap."
824
- ] : setup.sync.continuous ? ["The saved Continuous sync preference will resume monitoring after the /sync command or manager closes."] : [],
825
- "Only bounded Markdown/plain-text conflicts and atomic global settings choices are eligible. Model errors can change intended behavior. Session histories, code, deletion conflicts and path collisions are not model-resolved.",
826
- "The existing baseline, selection, secret-scan and publication checks remain. Pi Sync cannot exclude arbitrary concurrent local writers. Disabling does not undo completed transfers or provider charges. No transfer starts from Settings."
827
- ].join("\n\n");
828
- if (!await confirmMergeReview(
829
- ctx,
830
- `Enable ${label}?`,
831
- summary,
832
- signal,
833
- () => !signal?.aborted,
834
- `Enable ${label}`,
835
- summary.split("\n")
836
- ))
837
- return false;
838
- validate();
839
- }
840
- await updateLocalConfig((current) => {
841
- validate();
842
- if (current.activeSyncSetup !== setupName || !isDeepStrictEqual(current.syncSetups[setupName], setup) || !isDeepStrictEqual(
843
- current.storageConnections[setup.storage.connection],
844
- settings.storageConnections[setup.storage.connection]
845
- ))
846
- throw new Error("Sync setup or connection changed during Autonomous sync review; reopen Settings.");
847
- return {
848
- ...current,
849
- syncSetups: { ...current.syncSetups, [setupName]: { ...setup, sync: { ...setup.sync, [preference]: enabled } } }
850
- };
851
- }, signal);
852
- return true;
853
- }
854
-
855
637
  // src/ui/settings-frame.ts
856
638
  import { stripVTControlCharacters } from "node:util";
857
639
  function boundedSettingsUI(ctx) {
@@ -897,7 +679,7 @@ function boundedSettingsUI(ctx) {
897
679
  }
898
680
 
899
681
  // src/ui/storage-connections-ui.ts
900
- import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
682
+ import { isDeepStrictEqual } from "node:util";
901
683
  import { defineMenu as defineMenu2, runMenu as runMenu2 } from "@narumitw/pi-tui-kit";
902
684
  async function showStorageConnections(ctx, signal) {
903
685
  const validateOwner = captureMutationOwner(ctx, signal);
@@ -920,9 +702,9 @@ async function showStorageConnections(ctx, signal) {
920
702
  return {
921
703
  kind: "actions",
922
704
  title: "Storage connections",
923
- lines: state.supportedVersion ? state.recovery ?? ["Server addresses and sign-in details, reusable across sync setups."] : ["Create supported pi-sync settings before managing storage connections."],
705
+ lines: state.supportedVersion ? ["Server addresses and sign-in details, reusable across sync setups."] : ["Create supported pi-sync settings before managing storage connections."],
924
706
  items: state.supportedVersion ? [
925
- ...state.recovery ? [] : [{ id: "add", label: "Add storage connection", action: "add" }],
707
+ { id: "add", label: "Add storage connection", action: "add" },
926
708
  ...names.map((name, index) => {
927
709
  const id = `connection:${index}`;
928
710
  nameById.set(id, name);
@@ -942,8 +724,8 @@ async function showStorageConnections(ctx, signal) {
942
724
  title: state.selected ? `Storage connection \u201C${safeTerminalText(state.selected.name)}\u201D` : "Storage connection",
943
725
  lines: state.selected?.lines ?? ["This storage connection no longer exists."],
944
726
  items: state.selected ? [
945
- ...state.recovery ? [] : [{ id: "edit", label: "Edit storage connection\u2026", action: "edit" }],
946
- ...!state.recovery && state.selected.usedBy.length === 0 ? [
727
+ { id: "edit", label: "Edit storage connection\u2026", action: "edit" },
728
+ ...state.selected.usedBy.length === 0 ? [
947
729
  {
948
730
  id: "remove",
949
731
  label: "Remove storage connection\u2026",
@@ -956,8 +738,7 @@ async function showStorageConnections(ctx, signal) {
956
738
  })
957
739
  },
958
740
  actions: {
959
- add: async ({ state }) => {
960
- if (state.recovery) return { kind: "rejected" };
741
+ add: async () => {
961
742
  try {
962
743
  await showAddStorageConnection(ctx, signal);
963
744
  } catch (error) {
@@ -972,7 +753,7 @@ async function showStorageConnections(ctx, signal) {
972
753
  return selectedName ? { kind: "to", screen: "detail" } : { kind: "rejected" };
973
754
  },
974
755
  edit: async ({ state }) => {
975
- if (state.recovery || !state.selected || state.selected.name !== selectedName) return { kind: "rejected" };
756
+ if (!state.selected || state.selected.name !== selectedName) return { kind: "rejected" };
976
757
  try {
977
758
  await editStorageConnection(ctx, state.selected.name, state.selected.profile, state.selected.usedBy, signal);
978
759
  } catch (error) {
@@ -981,7 +762,7 @@ async function showStorageConnections(ctx, signal) {
981
762
  return { kind: "stay" };
982
763
  },
983
764
  remove: async ({ state, signal: actionSignal }) => {
984
- if (state.recovery || !state.selected || state.selected.name !== selectedName) return { kind: "rejected" };
765
+ if (!state.selected || state.selected.name !== selectedName) return { kind: "rejected" };
985
766
  const name = state.selected.name;
986
767
  const confirmed = await ctx.ui.confirm(
987
768
  "Remove storage connection?",
@@ -1008,27 +789,22 @@ async function showStorageConnections(ctx, signal) {
1008
789
  }
1009
790
  });
1010
791
  await runMenu2(ctx, menu, {
1011
- getState: ({ signal: loadSignal }) => loadStorageMenuState(ctx, selectedName, loadSignal),
792
+ getState: ({ signal: loadSignal }) => loadStorageMenuState(selectedName, loadSignal),
1012
793
  signal,
1013
794
  isCurrent
1014
795
  });
1015
796
  }
1016
- async function loadStorageMenuState(ctx, selectedName, signal) {
1017
- const catalog = await loadSettingsCatalog();
797
+ async function loadStorageMenuState(selectedName, signal) {
798
+ const document = await readActiveLocalConfigDocumentForRepair();
1018
799
  signal?.throwIfAborted();
1019
- const raw = catalog?.settings;
1020
- const profiles = raw?.storageConnections ?? {};
1021
- const recovery = catalog?.ignoreSetups.length && !await ignoreFileSettingsAvailable(ctx, signal) ? [
1022
- "Connection changes are unavailable while any setup uses an ignore file.",
1023
- ...ignoreSetupRecovery(catalog.path)
1024
- ] : void 0;
1025
- signal.throwIfAborted();
800
+ const raw = document && validateSettingsDocument(document.parsed);
801
+ if (signal?.aborted) throw signal.reason;
802
+ const profiles = ownRecord(raw?.storageConnections) ?? {};
1026
803
  const profile = selectedName ? ownRecord(profiles[selectedName]) : void 0;
1027
804
  if (!selectedName || !profile) {
1028
805
  return {
1029
806
  supportedVersion: raw !== void 0,
1030
807
  profiles,
1031
- recovery,
1032
808
  selected: void 0
1033
809
  };
1034
810
  }
@@ -1036,18 +812,16 @@ async function loadStorageMenuState(ctx, selectedName, signal) {
1036
812
  return {
1037
813
  supportedVersion: raw !== void 0,
1038
814
  profiles,
1039
- recovery,
1040
815
  selected: {
1041
816
  name: selectedName,
1042
817
  profile,
1043
818
  usedBy,
1044
819
  lines: [
1045
- ...recovery ?? [],
1046
820
  `Type: ${connectionType(profile)}`,
1047
821
  `Endpoint: ${connectionEndpoint(profile)}`,
1048
822
  `Credentials: ${credentialSource(profile)}`,
1049
823
  `Used by: ${usedBy.length > 0 ? usedBy.map(safeTerminalText).join(", ") : "No sync setups"}`,
1050
- ...!recovery && usedBy.length > 0 ? [
824
+ ...usedBy.length > 0 ? [
1051
825
  "Remove unavailable: remove the listed sync setups first. Switch away from a current setup before removing it if other setups remain."
1052
826
  ] : []
1053
827
  ]
@@ -1113,7 +887,7 @@ async function editStorageConnection(ctx, name, profile, usedBy, signal) {
1113
887
  (saveSignal) => updateStorageConnection(
1114
888
  name,
1115
889
  (current) => {
1116
- if (current.type !== "s3" || !isDeepStrictEqual2(current, profile)) {
890
+ if (current.type !== "s3" || !isDeepStrictEqual(current, profile)) {
1117
891
  throw new Error("Storage connection changed while it was open; reopen it.");
1118
892
  }
1119
893
  return {
@@ -1318,18 +1092,16 @@ async function showSetupSwitcher(ctx, runRoute, selectedName, signal) {
1318
1092
  }
1319
1093
  const onSwitch = await loadOnSwitch();
1320
1094
  if (signal?.aborted) return false;
1321
- const switchEffect = config.reservedIgnoreNames !== void 0 ? "This switch only saves the active setup. To transfer, use a reviewed /sync command." : onSwitch === "ask-before-pull" ? "After switching, pi-sync will ask whether to review a pull for this setup." : onSwitch === "pull-after-switch" ? "After switching, pi-sync will check this setup and show exact changes before applying them." : "After switching, pi-sync will not pull or modify synced files.";
1095
+ const switchEffect = onSwitch === "ask-before-pull" ? "After switching, pi-sync will ask whether to review a pull for this setup." : onSwitch === "pull-after-switch" ? "After switching, pi-sync will check this setup and show exact changes before applying them." : "After switching, pi-sync will not pull or modify synced files.";
1322
1096
  const confirmed = await ctx.ui.confirm(
1323
1097
  "Switch sync setup?",
1324
1098
  [
1325
1099
  `From: ${safeTerminalText(active ?? "none")}`,
1326
1100
  `To: ${safeTerminalText(name)}`,
1327
1101
  `Storage: ${backendStorageDescription(config)}`,
1328
- config.pathPolicy === "ignore-file" ? `Scope: Pi agent directory \xB7 ignore file: ${safeTerminalText(config.ignoreFile ?? ".syncignore")}` : config.scope === "agent-directory" ? `Scope: Pi agent directory \xB7 ${config.exclude?.length ?? 0} excluded and ${config.reinclude?.length ?? 0} re-included rules` : `Included content: ${config.include.length} paths`,
1102
+ config.scope === "agent-directory" ? `Scope: Pi agent directory \xB7 ${config.exclude?.length ?? 0} excluded and ${config.reinclude?.length ?? 0} re-included rules` : `Included content: ${config.include.length} paths`,
1329
1103
  `Automatic sync: ${automaticSyncSummary(config.automatic)} \xB7 Sessions: ${syncSessionsSelected(config) ? "On" : "Off"}`,
1330
1104
  `Automatic transfer at startup: ${config.automaticTransfer ? "On \u2014 may upload, replace, or delete selected files; no reload" : "Off"}`,
1331
- `Autonomous sync: ${config.agentMode ? "On (autonomous merged sync)" : "Off"}`,
1332
- `Continuous sync: ${config.continuous ? config.agentMode ? "On (recurring requests and transfers)" : "Saved On; paused until Autonomous sync is enabled" : "Off"}`,
1333
1105
  "",
1334
1106
  switchEffect
1335
1107
  ].join("\n"),
@@ -1462,26 +1234,17 @@ async function showEditSyncSetupStorage(ctx, name, signal) {
1462
1234
  await showEditS3Target(ctx, partial, signal);
1463
1235
  }
1464
1236
  async function showRemoveTarget(ctx, name, signal) {
1465
- const validate = captureMutationOwner(ctx, signal);
1466
1237
  const confirmed = await ctx.ui.confirm(
1467
1238
  "Remove sync setup?",
1468
1239
  `Remove local sync setup \u201C${safeTerminalText(name)}\u201D? Remote data and history are not deleted.`,
1469
1240
  { signal }
1470
1241
  );
1471
1242
  if (signal?.aborted || !confirmed) return;
1472
- validate();
1473
- const { revertedToLegacyOnly } = await removeSyncSetup(name, signal);
1474
- try {
1475
- validate();
1476
- } catch {
1477
- return;
1478
- }
1479
- const message = `Removed sync setup \u201C${safeTerminalText(name)}\u201D; remote data was not deleted.`;
1480
- ctx.ui.notify(
1481
- revertedToLegacyOnly ? `${message} To resume Continuous sync if enabled, close /sync and run /reload in an attached TUI session, or reopen one Pi client.` : message,
1482
- "info"
1483
- );
1243
+ await removeSyncSetup(name, signal);
1244
+ if (signal?.aborted) return;
1484
1245
  await refreshTargetCompletions();
1246
+ if (signal?.aborted) return;
1247
+ ctx.ui.notify(`Removed sync setup \u201C${safeTerminalText(name)}\u201D; remote data was not deleted.`, "info");
1485
1248
  }
1486
1249
 
1487
1250
  // src/ui/settings-ui.ts
@@ -1523,18 +1286,15 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1523
1286
  } catch {
1524
1287
  config = void 0;
1525
1288
  }
1526
- const limited = config?.reservedIgnoreNames !== void 0 && !await ignoreFileSettingsAvailable(ctx, signal);
1527
1289
  if (!isCurrent()) return disposition;
1528
1290
  ctx.ui.notify(
1529
1291
  [
1530
1292
  document === null ? "Could not read the active pi-sync settings file. Check file access or repair the JSON before reopening /sync." : `Edit pi-sync settings manually: ${safeTerminalText(settingsPath)}`,
1531
- ...limited ? [IGNORE_SETUP_MANAGEMENT_LIMIT, ...ignoreSetupRecovery(settingsPath)] : [],
1532
- ...!limited && config ? [
1293
+ ...config ? [
1533
1294
  "In the active entry in syncSetups, set sync.maxFileSizeMiB or sync.maxDirectorySizeMiB to a positive whole number of MiB with a safe byte count. Remove a field to turn that limit Off.",
1534
1295
  "A limit requires settings version 9. Upgrade all Pi Sync clients and daemons that share this agent directory before enabling a limit. Keep version 9 even if both limits are later Off."
1535
1296
  ] : [],
1536
- ...!limited && config?.reservedIgnoreNames !== void 0 ? ["Use TUI Settings \u2192 Review automatic transfers to approve the current setup separately."] : [],
1537
- ...config?.pathPolicy === "ignore-file" ? [manualIgnoreFileGuidance(config.ignoreFile ?? ".syncignore")] : config?.scope === "agent-directory" ? directoryScopeSummary(config) : []
1297
+ ...config?.scope === "agent-directory" ? directoryScopeSummary(config) : []
1538
1298
  ].join("\n"),
1539
1299
  "info"
1540
1300
  );
@@ -1567,7 +1327,6 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1567
1327
  }
1568
1328
  const initial = await loadSettingsConfig(reviewedSetup);
1569
1329
  if (!isCurrent()) return disposition;
1570
- const ignoreAvailable = await ignoreFileSettingsAvailable(ctx, signal);
1571
1330
  if (!isCurrent()) return disposition;
1572
1331
  const setupName = initial.setupName;
1573
1332
  const menu = defineMenu4({
@@ -1578,19 +1337,10 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1578
1337
  title: "Pi Sync Settings",
1579
1338
  lines: [
1580
1339
  `Setup: ${safeTerminalText(state.setupName)} \xB7 Connection: ${safeTerminalText(state.connectionName)}`,
1581
- ...state.reservedIgnoreNames !== void 0 && !ignoreAvailable ? ["Setup preferences are read-only; adding, editing, and switching setups are unavailable."] : ["Back does not undo saved changes."],
1582
- ...state.pathPolicy === "ignore-file" ? [manualIgnoreFileGuidance(state.ignoreFile ?? ".syncignore")] : []
1340
+ "Back does not undo saved changes."
1583
1341
  ],
1584
1342
  items: [
1585
- ...state.pathPolicy === "ignore-file" ? ignoreAvailable ? [
1586
- {
1587
- id: "ignoreFile",
1588
- label: "Ignore file",
1589
- description: `Select another existing local file. Sessions: ${state.include.includes("sessions") ? "opted in (rules still apply)" : "off"}. No transfer starts.`,
1590
- currentValue: safeTerminalText(state.ignoreFile ?? ".syncignore"),
1591
- action: "ignore-switch"
1592
- }
1593
- ] : [] : state.reservedIgnoreNames !== void 0 && !ignoreAvailable ? [] : state.scope === "agent-directory" ? [
1343
+ ...state.scope === "agent-directory" ? [
1594
1344
  {
1595
1345
  id: "include",
1596
1346
  label: "Agent directory scope",
@@ -1614,24 +1364,13 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1614
1364
  action: "exclude"
1615
1365
  }
1616
1366
  ],
1617
- ...ignoreAvailable && state.pathPolicy !== "ignore-file" ? [
1618
- {
1619
- id: "migrateIgnoreFile",
1620
- label: "Migrate to ignore file\u2026",
1621
- description: "Review the scope change for this legacy setup. Migration does not start a transfer.",
1622
- currentValue: "Review",
1623
- action: "ignore-migrate"
1624
- }
1625
- ] : [],
1626
- ...state.reservedIgnoreNames !== void 0 && !ignoreAvailable ? [] : [
1627
- {
1628
- id: "remoteInclude",
1629
- label: ignoreAvailable || state.scope === "agent-directory" ? "Compare sync policies" : "Compare included paths",
1630
- description: state.pathPolicy === "ignore-file" ? "Read-only comparison of local and remote policy, not file contents." : "Compare what sync manages on this device and the remote, not file contents. No files transfer unless you explicitly Continue.",
1631
- currentValue: "Review",
1632
- action: "remote-include"
1633
- }
1634
- ],
1367
+ {
1368
+ id: "remoteInclude",
1369
+ label: state.scope === "agent-directory" ? "Compare sync policies" : "Compare included paths",
1370
+ description: "Compare what sync manages on this device and the remote, not file contents. No files transfer unless you explicitly Continue.",
1371
+ currentValue: "Review",
1372
+ action: "remote-include"
1373
+ },
1635
1374
  {
1636
1375
  id: "localFields",
1637
1376
  label: "Machine-local fields",
@@ -1656,14 +1395,14 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1656
1395
  {
1657
1396
  id: "setups",
1658
1397
  label: "Manage sync setups",
1659
- description: state.reservedIgnoreNames !== void 0 && !ignoreAvailable ? "Review configured setups and recovery options. Adding, editing, and switching are unavailable." : "This device: add, switch, edit, or remove sync setups. Each edit identifies its owner before saving.",
1398
+ description: "This device: add, switch, edit, or remove sync setups. Each edit identifies its owner before saving.",
1660
1399
  currentValue: "Open",
1661
1400
  action: "setups"
1662
1401
  },
1663
1402
  {
1664
1403
  id: "connections",
1665
1404
  label: "Manage storage connections",
1666
- description: state.reservedIgnoreNames !== void 0 && !ignoreAvailable ? "Review shared connections. Connection changes are unavailable while ignore-file setups are configured." : "Shared connections on this device: review affected setups before saving server or credential changes.",
1405
+ description: "Shared connections on this device: review affected setups before saving server or credential changes.",
1667
1406
  currentValue: "Open",
1668
1407
  action: "connections"
1669
1408
  },
@@ -1683,35 +1422,10 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1683
1422
  values: ["On", "Off"],
1684
1423
  action: "automatic-transfer"
1685
1424
  },
1686
- {
1687
- id: "agentMode",
1688
- label: "Autonomous sync",
1689
- description: AGENT_MODE_DESCRIPTION,
1690
- currentValue: state.agentMode ? "On" : "Off",
1691
- values: ["On", "Off"],
1692
- action: "agent-mode"
1693
- },
1694
- {
1695
- id: "continuous",
1696
- label: "Continuous sync",
1697
- description: `${CONTINUOUS_DESCRIPTION}${state.continuous && !state.agentMode ? " Saved On, but paused until Autonomous sync is enabled." : ""}`,
1698
- currentValue: state.continuous ? "On" : "Off",
1699
- values: ["On", "Off"],
1700
- action: "continuous"
1701
- },
1702
- ...ignoreAvailable && state.reservedIgnoreNames !== void 0 && (startupTransferEnabled(state) || state.automatic && syncSessionsSelected(state)) ? [
1703
- {
1704
- id: "authorizeAutomatic",
1705
- label: "Review automatic transfers",
1706
- description: "Separate approval for the enabled modes and exact current policy. Saving settings alone does not grant permission.",
1707
- currentValue: "Review",
1708
- action: "authorize-automatic"
1709
- }
1710
- ] : [],
1711
1425
  {
1712
1426
  id: "onSwitch",
1713
1427
  label: "On setup switch",
1714
- description: state.reservedIgnoreNames === void 0 ? "All setups on this device: ask before a pull review, open it automatically, or switch without pulling. Applies to subsequent switches." : "While ignore-file setups exist, switching saves only the active setup. Run a reviewed pull separately.",
1428
+ description: "All setups on this device: ask before a pull review, open it automatically, or switch without pulling. Applies to subsequent switches.",
1715
1429
  currentValue: setupSwitchActionLabel(state.onSwitch),
1716
1430
  values: SETUP_SWITCH_ACTION_OPTIONS.map(({ label }) => label),
1717
1431
  action: "on-switch"
@@ -1756,9 +1470,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1756
1470
  values: ["On", "Off"],
1757
1471
  action: "debug"
1758
1472
  }
1759
- ].map(
1760
- (item) => state.reservedIgnoreNames !== void 0 && !ignoreAvailable && !["setups", "connections"].includes(item.id) ? { ...item, disabled: true } : item
1761
- )
1473
+ ]
1762
1474
  })
1763
1475
  },
1764
1476
  actions: {
@@ -1789,7 +1501,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1789
1501
  const partialSync = value === "Partial only" || value === "Merge + partial";
1790
1502
  if (!await ctx.ui.confirm(
1791
1503
  "Save content policy?",
1792
- `${previous.pathPolicy === "ignore-file" ? `Ignore-file policy keeps settings version ${previous.settingsVersion} and publishes snapshot version 7; upgrade older clients first.` : previous.scope === "agent-directory" ? "Agent directory scope uses snapshot version 5; older clients must refuse it." : "This explicitly upgrades settings to at least version 5; partial snapshots use version 3, or version 4 with exclusions, and older clients must refuse them."} Text/session merge is conservative. Partial sync preserves withheld versions and old baselines. Disabling does not clear unresolved groups or recovery evidence. Review a directional migration first if portable policy changes.`,
1504
+ `${previous.scope === "agent-directory" ? "Agent directory scope uses snapshot version 5; older clients must refuse it." : "This explicitly upgrades settings to at least version 5; partial snapshots use version 3, or version 4 with exclusions, and older clients must refuse them."} Text/session merge is conservative. Partial sync preserves withheld versions and old baselines. Disabling does not clear unresolved groups or recovery evidence. Review a directional migration first if portable policy changes.`,
1793
1505
  { signal: mutationSignal }
1794
1506
  ))
1795
1507
  return { kind: "rejected" };
@@ -1859,7 +1571,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1859
1571
  if (sameLocalFields(previous.localFields, fields)) return { kind: "stay" };
1860
1572
  const confirmed = await ctx.ui.confirm(
1861
1573
  "Save portable field policy?",
1862
- `${previous.pathPolicy === "ignore-file" ? `Ignore-file policy keeps settings version ${previous.settingsVersion} and publishes snapshot version 7.` : previous.scope === "agent-directory" ? "Agent directory scope uses snapshot version 5." : "This opts into at least settings/snapshot version 4/2; exclude-enabled setups retain snapshot version 4."} Older clients must refuse unsupported formats. Future snapshots omit these fields, but old remote history is NOT erased. Review an explicit force push/pull migration before further sync. Removed rules can expose or replace local-only values.`,
1574
+ `${previous.scope === "agent-directory" ? "Agent directory scope uses snapshot version 5." : "This opts into at least settings/snapshot version 4/2; exclude-enabled setups retain snapshot version 4."} Older clients must refuse unsupported formats. Future snapshots omit these fields, but old remote history is NOT erased. Review an explicit force push/pull migration before further sync. Removed rules can expose or replace local-only values.`,
1863
1575
  { signal: mutationSignal }
1864
1576
  );
1865
1577
  validate();
@@ -1907,56 +1619,6 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
1907
1619
  return { kind: "rejected" };
1908
1620
  }
1909
1621
  },
1910
- "agent-mode": async ({ value, signal: actionSignal }) => {
1911
- const mutationSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
1912
- const validate = captureMutationOwner(ctx, mutationSignal);
1913
- try {
1914
- const saved = await saveAgentMode(ctx, setupName, value === "On", mutationSignal);
1915
- if (!saved) return { kind: "rejected" };
1916
- try {
1917
- validate();
1918
- ctx.ui.notify(
1919
- "Autonomous sync saved. Applies to subsequent sync and the next session start; no transfer started.",
1920
- "info"
1921
- );
1922
- } catch {
1923
- }
1924
- return { kind: "stay" };
1925
- } catch (error) {
1926
- try {
1927
- validate();
1928
- } catch {
1929
- return { kind: "rejected" };
1930
- }
1931
- notifySaveFailure(ctx, error);
1932
- return { kind: "rejected" };
1933
- }
1934
- },
1935
- continuous: async ({ value, signal: actionSignal }) => {
1936
- const mutationSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
1937
- const validate = captureMutationOwner(ctx, mutationSignal);
1938
- try {
1939
- const saved = await saveContinuousMode(ctx, setupName, value === "On", mutationSignal);
1940
- if (!saved) return { kind: "rejected" };
1941
- try {
1942
- validate();
1943
- ctx.ui.notify(
1944
- value === "On" ? "Continuous sync enabled. Monitoring starts after the /sync command or manager closes; completed work is not undone." : "Continuous sync disabled. Completed work is not undone.",
1945
- "info"
1946
- );
1947
- } catch {
1948
- }
1949
- return { kind: "stay" };
1950
- } catch (error) {
1951
- try {
1952
- validate();
1953
- } catch {
1954
- return { kind: "rejected" };
1955
- }
1956
- notifySaveFailure(ctx, error);
1957
- return { kind: "rejected" };
1958
- }
1959
- },
1960
1622
  "automatic-transfer": async ({ value, signal: actionSignal }) => {
1961
1623
  const automaticTransfer = value === "On";
1962
1624
  const mutationSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
@@ -2040,43 +1702,13 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
2040
1702
  await showExcludedPaths(ctx, setupName, editorSignal);
2041
1703
  return resumeSettings(editorSignal);
2042
1704
  },
2043
- "authorize-automatic": async ({ state, signal: actionSignal }) => {
2044
- const reviewSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
2045
- const validate = captureMutationOwner(ctx, reviewSignal);
2046
- const client = piDaemonClient(ctx);
2047
- try {
2048
- validate();
2049
- const policy = await client.run("daemon.policy", {}, reviewSignal);
2050
- validate();
2051
- if (policy.setup !== state.setupName) return exitSettings();
2052
- if (policy.automatic) {
2053
- ctx.ui.notify("Automatic work is already approved for this setup and policy.", "info");
2054
- return { kind: "stay" };
2055
- }
2056
- const accepted = await client.run(
2057
- "daemon.authorize-connected",
2058
- { fingerprint: policy.fingerprint },
2059
- reviewSignal
2060
- );
2061
- validate();
2062
- if (accepted === true) ctx.ui.notify("Automatic work approved for this setup and policy.", "info");
2063
- return { kind: "stay" };
2064
- } catch (error) {
2065
- if (reviewSignal.aborted || !isCurrent()) return exitSettings();
2066
- notifySaveFailure(ctx, error);
2067
- return { kind: "rejected" };
2068
- }
2069
- },
2070
- "ignore-switch": ignoreAction("switch"),
2071
- "ignore-migrate": ignoreAction("migrate"),
2072
- "remote-include": async ({ state, signal: actionSignal }) => {
2073
- if (state.reservedIgnoreNames !== void 0 && !ignoreAvailable) return { kind: "rejected" };
1705
+ "remote-include": async ({ signal: actionSignal }) => {
2074
1706
  const reviewSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
2075
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-DOYKUMER.ts");
1707
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-F6NJBQ3Y.ts");
2076
1708
  if (reviewSignal.aborted) return { kind: "rejected" };
2077
1709
  const review = await showRemoteSelectionReview(ctx, setupName, reviewSignal, void 0, {
2078
1710
  origin: "settings",
2079
- ...state.pathPolicy === "ignore-file" ? { readOnly: true } : { runRoute }
1711
+ runRoute
2080
1712
  });
2081
1713
  if (reviewSignal.aborted) return { kind: "rejected" };
2082
1714
  if (review.kind === "route-result") {
@@ -2105,18 +1737,17 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
2105
1737
  if (action.signal.aborted || signal?.aborted) return { kind: "rejected" };
2106
1738
  validate();
2107
1739
  if (result?.kind === "stay") {
2108
- const { value, state } = action;
1740
+ const { value } = action;
2109
1741
  const enabled = value === "On";
2110
1742
  const setup = safeTerminalText(setupName);
2111
- const approval = enabled && state.reservedIgnoreNames !== void 0 ? " Use Review automatic transfers to approve this policy separately." : "";
2112
1743
  const message = {
2113
- automatic: `Automatic sync for \u201C${setup}\u201D: ${value}.${enabled ? " New startup checks begin next session." : ""}${approval}`,
2114
- "automatic-transfer": `Startup transfer for \u201C${setup}\u201D: ${value}.${enabled ? " Applies at the next session start." : ""}${approval}`,
1744
+ automatic: `Automatic sync for \u201C${setup}\u201D: ${value}.${enabled ? " New startup checks begin next session." : ""}`,
1745
+ "automatic-transfer": `Startup transfer for \u201C${setup}\u201D: ${value}.${enabled ? " Applies at the next session start." : ""}`,
2115
1746
  "merge-settings": `Merge settings fields for \u201C${setup}\u201D: ${value}. Applies to subsequent sync operations.`,
2116
1747
  "skip-secret-scan": `Secret scan ${enabled ? "disabled" : "enabled"} for subsequent pushes in all setups.`,
2117
1748
  "show-status": `Show sync status: ${value}. Applies immediately to all setups.`,
2118
1749
  debug: `Debug mode: ${value}. Pi applies it at the next session start.`,
2119
- "on-switch": `On setup switch: ${value}.${state.reservedIgnoreNames !== void 0 ? " Switching still won't pull while any setup uses an ignore file." : ""}`
1750
+ "on-switch": `On setup switch: ${value}.`
2120
1751
  }[id];
2121
1752
  ctx.ui.notify(`Saved. ${message}`, "info");
2122
1753
  }
@@ -2187,9 +1818,8 @@ Enter Off or a positive whole number of MiB.`,
2187
1818
  }
2188
1819
  try {
2189
1820
  validate();
2190
- const approval = state.reservedIgnoreNames !== void 0 && (startupTransferEnabled(state) || state.automatic && syncSessionsSelected(state)) ? " Use Review automatic transfers to approve this policy separately." : "";
2191
1821
  ctx.ui.notify(
2192
- `Saved. ${label} for \u201C${setupLabel}\u201D: ${transferSizeLimitLabel(limit)}. Applies to subsequent transfers; no transfer started.${approval}`,
1822
+ `Saved. ${label} for \u201C${setupLabel}\u201D: ${transferSizeLimitLabel(limit)}. Applies to subsequent transfers; no transfer started.`,
2193
1823
  "info"
2194
1824
  );
2195
1825
  } catch {
@@ -2198,21 +1828,6 @@ Enter Off or a positive whole number of MiB.`,
2198
1828
  return stay;
2199
1829
  };
2200
1830
  }
2201
- function ignoreAction(action) {
2202
- return async ({ state, signal: actionSignal }) => {
2203
- if (!ignoreAvailable || state.pathPolicy === "ignore-file" === (action === "migrate"))
2204
- return { kind: "rejected" };
2205
- const editorSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
2206
- const latest = await loadSettingsConfig();
2207
- if (editorSignal.aborted || !isCurrent()) return { kind: "close" };
2208
- if (syncCheckConfigFingerprint(latest) !== syncCheckConfigFingerprint(state)) {
2209
- ctx.ui.notify("Sync setup changed while Settings was open; reopen it before changing the policy.", "warning");
2210
- return { kind: "close" };
2211
- }
2212
- await showIgnoreFileAction(ctx, setupName, action, state.ignoreFile ?? ".syncignore", editorSignal);
2213
- return resumeSettings(editorSignal);
2214
- };
2215
- }
2216
1831
  async function resumeSettings(editorSignal) {
2217
1832
  if (editorSignal.aborted || !isCurrent()) return { kind: "close" };
2218
1833
  try {
@@ -2277,7 +1892,6 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2277
1892
  cancelledMessage: direction === "push" ? "Push cancellation requested." : "Pull cancellation requested.",
2278
1893
  target: review.setupName,
2279
1894
  directionalFingerprint: review.fingerprint,
2280
- requirePendingAdoption: state.manager.recoveryPull,
2281
1895
  signal,
2282
1896
  isCurrent
2283
1897
  }
@@ -2330,7 +1944,7 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2330
1944
  if (!attention) {
2331
1945
  const observation = state.manager.observation;
2332
1946
  if (!observation) return { kind: "stay" };
2333
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-DOYKUMER.ts");
1947
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-F6NJBQ3Y.ts");
2334
1948
  if (sessionSignal?.aborted) return { kind: "close" };
2335
1949
  const config = await loadConfig();
2336
1950
  if (sessionSignal?.aborted) return { kind: "close" };
@@ -2375,34 +1989,13 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2375
1989
  const disposition = await dispatchManagerResult(ctx, result, "sync", runRoute, sessionSignal);
2376
1990
  return disposition.kind === "close" ? { kind: "close" } : { kind: "stay" };
2377
1991
  },
2378
- "retry-refusal": async ({ state, signal: actionSignal }) => {
2379
- const signal = sessionSignal ? AbortSignal.any([sessionSignal, actionSignal]) : actionSignal;
2380
- const validate = captureMutationOwner(ctx, signal);
2381
- validate();
2382
- const retryRoute = (route, operationSignal, onCommit, target, onDialog) => runRoute(route, operationSignal, onCommit, target, onDialog, true);
2383
- const result = await runCancellableOperation(ctx, "Checking cached refusal\u2026", "sync", retryRoute, {
2384
- commitAware: true,
2385
- cancelAcrossDialogs: true,
2386
- signal,
2387
- target: state.manager.configReview?.setupName,
2388
- cancelledMessage: "Model retry cancelled. Submitted requests and committed writes cannot be undone."
2389
- });
2390
- if (signal.aborted) return { kind: "close" };
2391
- validate();
2392
- if (result.kind === "decision-required" || result.kind === "remote-selection-required")
2393
- ctx.ui.notify(
2394
- "Model retry needs an established source and matching synced content. Use Sync now to review changed selection or recovery before retrying.",
2395
- "warning"
2396
- );
2397
- return { kind: result.kind === "closed" ? "close" : "stay" };
2398
- },
2399
1992
  switch: async () => {
2400
1993
  const result = await showSetupSwitcher(ctx, runRoute, void 0, sessionSignal);
2401
1994
  return result === "pull-attempted" || result === "closed" ? { kind: "close" } : { kind: "stay" };
2402
1995
  },
2403
1996
  settings: async ({ state, signal: actionSignal }) => {
2404
1997
  const signal = sessionSignal ? AbortSignal.any([sessionSignal, actionSignal]) : actionSignal;
2405
- const review = state.manager.settingsReview ?? state.manager.configReview;
1998
+ const review = state.manager.configReview;
2406
1999
  const result = await showSyncSettings(ctx, runRoute, signal, review?.setupName);
2407
2000
  return { kind: result === "exit" ? "close" : "stay" };
2408
2001
  },
@@ -2445,30 +2038,6 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2445
2038
  const validate = captureMutationOwner(ctx, signal);
2446
2039
  const config = await loadConfig(state.manager.configReview?.setupName);
2447
2040
  validate();
2448
- if (config.continuous) {
2449
- const { continuousStatusLines } = await import("./continuous-record-3SKJ6I3V.ts");
2450
- validate();
2451
- const lines = await continuousStatusLines(config);
2452
- validate();
2453
- const review = await runDocumentReview(ctx, {
2454
- title: "Sync diagnostics",
2455
- lines: [`Setup: ${safeTerminalText(config.setupName)} \xB7 local observations only`],
2456
- content: lines.join("\n"),
2457
- confirmation: { label: "Continue to backend checks\u2026" },
2458
- hint: "back",
2459
- signal,
2460
- isCurrent
2461
- });
2462
- validate();
2463
- if (review.kind === "cancelled") return { kind: review.reason === "close" ? "close" : "stay" };
2464
- if (review.kind !== "confirmed") return { kind: "stay" };
2465
- const current = await loadConfig();
2466
- validate();
2467
- if (syncCheckConfigFingerprint(config) !== syncCheckConfigFingerprint(current)) {
2468
- ctx.ui.notify("Setup changed during diagnostics review; reopen Diagnostics.", "warning");
2469
- return { kind: "stay" };
2470
- }
2471
- }
2472
2041
  const confirmed = await ctx.ui.confirm(
2473
2042
  "Run diagnostics?",
2474
2043
  `Setup: ${safeTerminalText(config.setupName)}
@@ -2522,7 +2091,6 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
2522
2091
  for (const action of [
2523
2092
  "review-attention",
2524
2093
  "sync",
2525
- "retry-refusal",
2526
2094
  "settings",
2527
2095
  "pull",
2528
2096
  "push",
@@ -2535,15 +2103,7 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
2535
2103
  const activate = menu.actions[action];
2536
2104
  menu.actions[action] = async (invocation) => {
2537
2105
  validateOwner();
2538
- const { configReview, settingsReview, recoveryPull } = invocation.state.manager;
2539
- if (action === "pull" && recoveryPull) {
2540
- if (options.getPendingPullReview?.() !== configReview) {
2541
- ctx.ui.notify("The original Pull is no longer available for automatic recovery.", "warning");
2542
- return { kind: "stay" };
2543
- }
2544
- return activate(invocation);
2545
- }
2546
- const review = action === "settings" ? settingsReview ?? configReview : configReview;
2106
+ const review = invocation.state.manager.configReview;
2547
2107
  let current = false;
2548
2108
  try {
2549
2109
  const config = await (action === "settings" ? loadSettingsConfig() : loadConfig());
@@ -2578,34 +2138,17 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
2578
2138
  }, customOptions)
2579
2139
  }
2580
2140
  };
2581
- let firstOpen = true;
2582
2141
  const recovery = {
2583
2142
  title: "Pi Sync recovery required\nDaemon cleanup could not be confirmed. Stop the daemon before retrying a transfer.",
2584
2143
  actions: ["Stop daemon for recovery\u2026", "Help"]
2585
2144
  };
2586
- const describeRecovery = () => {
2587
- const configReview = options.getPendingPullReview?.();
2588
- if (!configReview) return recovery;
2589
- return {
2590
- title: "Pi Sync recovery required\nPull can try to recover the daemon and review the pending transfer.",
2591
- actions: ["Pull from remote", ...recovery.actions],
2592
- configReview,
2593
- recoveryPull: true
2594
- };
2595
- };
2596
2145
  const describe = async (signal) => {
2597
- if (options.needsDaemonRecovery?.()) return describeRecovery();
2146
+ if (options.needsDaemonRecovery?.()) return recovery;
2598
2147
  const pendingAttention = options.getAttention?.();
2599
2148
  const observation = options.getObservation?.();
2600
- const manager = await describeManagerState(
2601
- signal,
2602
- pendingAttention,
2603
- void 0,
2604
- observation,
2605
- () => ignoreFileSettingsAvailable(ctx, signal)
2606
- );
2149
+ const manager = await describeManagerState(signal, pendingAttention, void 0, observation);
2607
2150
  if (signal.aborted || !isCurrent()) return manager;
2608
- if (options.needsDaemonRecovery?.()) return describeRecovery();
2151
+ if (options.needsDaemonRecovery?.()) return recovery;
2609
2152
  if (observation && options.getObservation?.() === observation && !manager.observation && !(manager.operation && operationBlocksChanges(manager.operation))) {
2610
2153
  options.onObservationInvalidated?.();
2611
2154
  }
@@ -2615,15 +2158,7 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
2615
2158
  return manager;
2616
2159
  };
2617
2160
  await runMenu5(menuContext, menu, {
2618
- getState: async ({ signal }) => {
2619
- const offerOnOpen = firstOpen;
2620
- firstOpen = false;
2621
- let manager = await describe(signal);
2622
- if (offerOnOpen && manager.operation?.kind === "free" && manager.configReview && await showIgnoreMigrationPrompt(ctx, manager.configReview.setupName, signal, isCurrent)) {
2623
- if (!signal.aborted && isCurrent()) manager = await describe(signal);
2624
- }
2625
- return { manager };
2626
- },
2161
+ getState: async ({ signal }) => ({ manager: await describe(signal) }),
2627
2162
  signal: sessionSignal,
2628
2163
  isCurrent
2629
2164
  });
@@ -2631,7 +2166,6 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
2631
2166
  function syncMainMenuItem(label) {
2632
2167
  const actions = {
2633
2168
  "Sync now": "sync",
2634
- "Retry refused model result\u2026": "retry-refusal",
2635
2169
  "Pull from remote": "pull",
2636
2170
  "Push to remote": "push",
2637
2171
  "View differences": "diff",
@@ -2658,7 +2192,6 @@ function syncMainMenuItem(label) {
2658
2192
  action,
2659
2193
  description: {
2660
2194
  sync: "Merge changes on both sides.",
2661
- "retry-refusal": "Retry model; may incur costs.",
2662
2195
  pull: "Remote \u2192 this device; replaces conflicting local files.",
2663
2196
  push: "This device \u2192 remote; replaces conflicting remote files.",
2664
2197
  diff: "Inspect changes; no transfer.",
@@ -2681,4 +2214,4 @@ function syncMainMenuItem(label) {
2681
2214
  export {
2682
2215
  showSyncManager
2683
2216
  };
2684
- //# sourceMappingURL=manager-ui-FS4QIKRA.ts.map
2217
+ //# sourceMappingURL=manager-ui-KHMCSLLV.ts.map