@narumitw/pi-sync 0.67.3 → 0.68.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/CHANGELOG.md +13 -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-CQ4DMLH3.ts → chunk-WQXUZSY5.ts} +25 -83
  21. package/dist/chunks/chunk-WQXUZSY5.ts.map +7 -0
  22. package/dist/chunks/{chunk-JREGWM2B.ts → chunk-XNUARYLR.ts} +1 -2
  23. package/dist/chunks/{command-handler-WF2TDDRZ.ts → command-handler-5LDTCUJE.ts} +64 -59
  24. package/dist/chunks/command-handler-5LDTCUJE.ts.map +7 -0
  25. package/dist/chunks/{conflict-review-GWEL4S6C.ts → conflict-review-SZ3AWTX6.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-OTI4JDQ2.ts} +5 -5
  37. package/dist/chunks/{sync-operations-AGNL7QXA.ts → sync-operations-ZUYJLWUN.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 +81 -65
  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/ui/sync-format.js +1 -1
  86. package/dist/daemon/dist/engine-service.js +60 -219
  87. package/dist/daemon/dist/foreground-queue-outcome.js +0 -4
  88. package/dist/daemon/dist/legacy-consent-guard.js +34 -0
  89. package/dist/daemon/dist/server.js +4 -8
  90. package/dist/daemon/dist/service-host.js +4 -10
  91. package/dist/daemon/package.json +1 -1
  92. package/dist/index.ts +45 -46
  93. package/dist/index.ts.map +3 -3
  94. package/docs/continuous-sync-verification.md +1 -1
  95. package/docs/daemon-migration.md +7 -5
  96. package/docs/tui-contract.md +4 -6
  97. package/package.json +2 -3
  98. package/skills/configure-pi-sync/SKILL.md +18 -77
  99. package/skills/configure-pi-sync/references/configuration.md +60 -77
  100. package/src/commands/command-execution.ts +13 -29
  101. package/src/commands/command-handler.ts +0 -4
  102. package/src/commands/command.ts +2 -1
  103. package/src/daemon/directional-recovery.ts +4 -33
  104. package/src/daemon/pi-client.ts +28 -90
  105. package/src/settings/config.ts +0 -1
  106. package/src/sync/setup-switch.ts +1 -4
  107. package/src/sync-extension.ts +10 -24
  108. package/src/ui/cancellable-operation.ts +2 -13
  109. package/src/ui/excluded-paths-ui.ts +1 -4
  110. package/src/ui/file-selection.ts +0 -5
  111. package/src/ui/manager-state.ts +12 -75
  112. package/src/ui/manager-ui.ts +7 -96
  113. package/src/ui/remote-selection-ui.ts +29 -130
  114. package/src/ui/settings-ui.ts +169 -388
  115. package/src/ui/setup/setup-actions.ts +4 -16
  116. package/src/ui/setup/setup-prompts.ts +12 -49
  117. package/src/ui/setup/setup-switcher.ts +8 -14
  118. package/src/ui/storage-connections-ui.ts +21 -32
  119. package/src/ui/sync-setups-ui.ts +27 -53
  120. package/dist/chunks/chunk-2MUAR5GH.ts.map +0 -7
  121. package/dist/chunks/chunk-33EDXDLC.ts +0 -106
  122. package/dist/chunks/chunk-33EDXDLC.ts.map +0 -7
  123. package/dist/chunks/chunk-AVTW6WNP.ts.map +0 -7
  124. package/dist/chunks/chunk-CQ4DMLH3.ts.map +0 -7
  125. package/dist/chunks/chunk-DGVZYS7T.ts.map +0 -7
  126. package/dist/chunks/chunk-EJDDRS6O.ts +0 -17
  127. package/dist/chunks/chunk-EJDDRS6O.ts.map +0 -7
  128. package/dist/chunks/chunk-KNEUL4XN.ts +0 -30
  129. package/dist/chunks/chunk-KNEUL4XN.ts.map +0 -7
  130. package/dist/chunks/chunk-PUSMSKIM.ts.map +0 -7
  131. package/dist/chunks/chunk-WFBHWYI6.ts +0 -18
  132. package/dist/chunks/chunk-WFBHWYI6.ts.map +0 -7
  133. package/dist/chunks/chunk-X344HTVV.ts.map +0 -7
  134. package/dist/chunks/command-handler-WF2TDDRZ.ts.map +0 -7
  135. package/dist/chunks/config-P54GGMXY.ts +0 -39
  136. package/dist/chunks/continuous-record-3SKJ6I3V.ts +0 -23
  137. package/dist/chunks/continuous-record-3SKJ6I3V.ts.map +0 -7
  138. package/dist/chunks/continuous-storage-3EU6I7Z3.ts +0 -27
  139. package/dist/chunks/continuous-storage-3EU6I7Z3.ts.map +0 -7
  140. package/dist/chunks/file-selection-GASCVN45.ts.map +0 -7
  141. package/dist/chunks/ignore-file-ui-BEZZZIEE.ts +0 -21
  142. package/dist/chunks/manager-ui-FS4QIKRA.ts.map +0 -7
  143. package/dist/chunks/merge-review-C2KETZKY.ts +0 -11
  144. package/dist/chunks/merge-review-C2KETZKY.ts.map +0 -7
  145. package/dist/chunks/remote-selection-ui-DOYKUMER.ts.map +0 -7
  146. package/dist/chunks/setup-switch-JZDFQPVW.ts.map +0 -7
  147. package/dist/daemon/dist/engine/ignore/adoption-journal.js +0 -146
  148. package/dist/daemon/dist/engine/ignore/effective-ignore-policy.js +0 -33
  149. package/dist/daemon/dist/engine/ignore/ignore-edit.js +0 -102
  150. package/dist/daemon/dist/engine/ignore/ignore-initialization.js +0 -288
  151. package/dist/daemon/dist/engine/ignore/ignore-migration-prompt.js +0 -139
  152. package/dist/daemon/dist/engine/ignore/ignore-settings.js +0 -391
  153. package/dist/daemon/dist/engine/ignore/ignore-source.js +0 -250
  154. package/dist/daemon/dist/engine/ignore/snapshot-ignore-rules.js +0 -39
  155. package/dist/daemon/dist/engine/sync/ignore-adoption-recovery.js +0 -50
  156. package/dist/daemon/dist/engine/sync/ignore-adoption.js +0 -416
  157. package/dist/daemon/dist/engine/sync/ignore-publication.js +0 -23
  158. package/dist/daemon/dist/engine/ui/ignore-rule-preview.js +0 -18
  159. package/dist/daemon/dist/monitor.js +0 -344
  160. package/src/ui/agent-mode-setting.ts +0 -99
  161. package/src/ui/ignore-file-guidance.ts +0 -7
  162. package/src/ui/ignore-file-ui.ts +0 -105
  163. package/src/ui/ignore-migration-prompt.ts +0 -65
  164. package/src/ui/settings-review.ts +0 -26
  165. /package/dist/chunks/{chunk-HLJIRWFL.ts.map → chunk-BCDBT4X3.ts.map} +0 -0
  166. /package/dist/chunks/{chunk-WBIOSK76.ts.map → chunk-R7PN3KIY.ts.map} +0 -0
  167. /package/dist/chunks/{chunk-3Q3DMMID.ts.map → chunk-TLYT6HVI.ts.map} +0 -0
  168. /package/dist/chunks/{chunk-JREGWM2B.ts.map → chunk-XNUARYLR.ts.map} +0 -0
  169. /package/dist/chunks/{conflict-review-GWEL4S6C.ts.map → conflict-review-SZ3AWTX6.ts.map} +0 -0
  170. /package/dist/chunks/{config-P54GGMXY.ts.map → manager-result-dispatcher-A4IWLS4J.ts.map} +0 -0
  171. /package/dist/chunks/{chunk-ECUCXF5Y.ts.map → merge-review-LWMUE5IW.ts.map} +0 -0
  172. /package/dist/chunks/{ignore-file-ui-BEZZZIEE.ts.map → remote-selection-ui-F6NJBQ3Y.ts.map} +0 -0
  173. /package/dist/chunks/{manager-result-dispatcher-BXN46NRC.ts.map → setup-switch-7LMIRMZ7.ts.map} +0 -0
  174. /package/dist/chunks/{sync-inspection-DI5J6EUH.ts.map → sync-inspection-OTI4JDQ2.ts.map} +0 -0
  175. /package/dist/chunks/{sync-operations-AGNL7QXA.ts.map → sync-operations-ZUYJLWUN.ts.map} +0 -0
@@ -38,8 +38,6 @@ export interface ManagerDescription {
38
38
  title: string;
39
39
  actions: string[];
40
40
  configReview?: { setupName: string; fingerprint: string };
41
- recoveryPull?: true;
42
- settingsReview?: { setupName: string; fingerprint: string };
43
41
  operation?: OperationAvailability;
44
42
  attention?: SyncAttentionState;
45
43
  observation?: StartupObservation;
@@ -52,7 +50,6 @@ export async function describeManagerState(
52
50
  attention?: SyncAttentionState,
53
51
  inspectOperation: () => Promise<OperationAvailability> = inspectOperationAvailability,
54
52
  observation?: StartupObservation,
55
- canUseIgnoreSettings?: () => Promise<boolean>,
56
53
  ): Promise<ManagerDescription> {
57
54
  signal?.throwIfAborted();
58
55
  let document: LocalConfigDocument | undefined;
@@ -71,7 +68,7 @@ export async function describeManagerState(
71
68
  `Error: ${safeTerminalText(errorMessage(error))}`,
72
69
  ...(document ? [`File: ${safeTerminalText(document.path)}`] : []),
73
70
  "",
74
- "Repair the JSON file, then reopen /sync.",
71
+ "Resolve the settings error, then reopen /sync.",
75
72
  ].join("\n"),
76
73
  actions: ["Help"],
77
74
  };
@@ -95,12 +92,7 @@ export async function describeManagerState(
95
92
  actions: ["Sync setups…", "Storage connections…", "Help"],
96
93
  };
97
94
  }
98
- let settingsConfig: AnySyncConfig | undefined;
99
95
  try {
100
- settingsConfig = view.metadata();
101
- if (settingsConfig.reservedIgnoreNames && canUseIgnoreSettings && !(await canUseIgnoreSettings())) {
102
- throw new Error("the connected daemon does not support ignore-file setups");
103
- }
104
96
  signal?.throwIfAborted();
105
97
  const config = await view.observe(undefined, signal);
106
98
  signal?.throwIfAborted();
@@ -150,25 +142,13 @@ export async function describeManagerState(
150
142
  const canSwitch = !changesBlocked && (alternateUsable || (await hasAnotherSwitchableSetup(view, signal)));
151
143
  signal?.throwIfAborted();
152
144
  const mainActions: string[] = [...MAIN_MENU_ACTIONS];
153
- if (config.agentMode && !noSyncedContent) mainActions.splice(1, 0, "Retry refused model result…");
154
145
  if (canSwitch) mainActions.push("Switch sync setup");
155
146
  if (syncState?.unresolved?.length) mainActions.unshift("Review unresolved conflicts");
156
- const background = changesBlocked ? [] : await backgroundSummary(config);
157
- signal?.throwIfAborted();
158
147
  const ordinaryTitle = [
159
148
  "Manage sync",
160
149
  `Current sync setup: ${safeTerminalText(config.setupName)}`,
161
150
  `Storage: ${backendStorageDescription(config)}`,
162
- ...(config.pathPolicy === "ignore-file"
163
- ? [
164
- `Sync scope: Pi agent directory · ignore file: ${safeTerminalText(config.ignoreFile ?? ".syncignore")}`,
165
- ...(config.ignorePolicy?.matches(config.ignorePolicy.filename) === false
166
- ? ["New snapshots include this rule file and its comments in remote history."]
167
- : []),
168
- ]
169
- : config.scope
170
- ? ["Sync scope: Pi agent directory, with exclusions"]
171
- : []),
151
+ ...(config.scope ? ["Sync scope: Pi agent directory, with exclusions"] : []),
172
152
  ...(syncState?.unresolved?.length
173
153
  ? [`Unresolved: ${syncState.unresolved.length} dependency groups · review needed`]
174
154
  : []),
@@ -177,26 +157,21 @@ export async function describeManagerState(
177
157
  currentAttention.decision.setupName === config.setupName
178
158
  ? "Sync status: Review needed"
179
159
  : `Sync status: Review needed for setup ${safeTerminalText(currentAttention.decision.setupName)}`,
180
- currentAttention.decision.ignorePolicyComparison
181
- ? "Ignore-file policies differ."
182
- : attentionDirectoryPolicy
183
- ? "Sync scopes or directory rules differ."
184
- : attentionComparison?.remoteOnly.length === 0 && attentionComparison.localOnly.length === 0
185
- ? attentionExclusionsDiffer
186
- ? "Synced-content exclusion rules differ."
187
- : "Only the synced-content order differs."
188
- : `Remote-only paths: ${attentionComparison?.remoteOnly.length ?? 0} · Device-only paths: ${attentionComparison?.localOnly.length ?? 0}${attentionExclusionsDiffer ? " · Exclusion rules differ." : ""}`,
160
+ attentionDirectoryPolicy
161
+ ? "Sync scopes or directory rules differ."
162
+ : attentionComparison?.remoteOnly.length === 0 && attentionComparison.localOnly.length === 0
163
+ ? attentionExclusionsDiffer
164
+ ? "Synced-content exclusion rules differ."
165
+ : "Only the synced-content order differs."
166
+ : `Remote-only paths: ${attentionComparison?.remoteOnly.length ?? 0} · Device-only paths: ${attentionComparison?.localOnly.length ?? 0}${attentionExclusionsDiffer ? " · Exclusion rules differ." : ""}`,
189
167
  ]
190
168
  : currentObservation
191
169
  ? [`Observed ${safeTerminalText(currentObservation.checkedAt)}: ${observationSummary(currentObservation)}`]
192
170
  : ["Remote status: Not checked"]),
193
171
  `Last applied: ${lastAppliedSnapshot}`,
194
- ...(config.agentMode
195
- ? ["Auto-apply: On · AI requests may incur costs"]
196
- : config.automaticTransfer || (config.automatic && syncSessionsSelected(config))
197
- ? ["Automatic transfer permission: On · see Settings"]
198
- : []),
199
- ...background,
172
+ ...(config.automaticTransfer || (config.automatic && syncSessionsSelected(config))
173
+ ? ["Automatic transfer permission: On · see Settings"]
174
+ : []),
200
175
  ...(noSyncedContent
201
176
  ? ["", "No included content is selected. Choose included content in Settings before syncing."]
202
177
  : []),
@@ -205,7 +180,6 @@ export async function describeManagerState(
205
180
  title: (changesBlocked ? ["Manage sync", ...operationStatusLines(operation)] : ordinaryTitle).join("\n"),
206
181
  actions: operationActions(operation, noSyncedContent, canSwitch, mainActions),
207
182
  configReview: { setupName: config.setupName, fingerprint: syncCheckConfigFingerprint(config) },
208
- settingsReview: { setupName: settingsConfig.setupName, fingerprint: syncCheckConfigFingerprint(settingsConfig) },
209
183
  operation,
210
184
  ...(currentObservation ? { observation: currentObservation } : {}),
211
185
  ...(currentAttention
@@ -218,20 +192,6 @@ export async function describeManagerState(
218
192
  };
219
193
  } catch (error) {
220
194
  signal?.throwIfAborted();
221
- if (settingsConfig?.reservedIgnoreNames !== undefined) {
222
- return {
223
- title: [
224
- "Manage sync",
225
- `Current sync setup: ${safeTerminalText(settingsConfig.setupName)}`,
226
- `Transfers are unavailable: ${safeTerminalText(errorMessage(error))}`,
227
- ].join("\n"),
228
- actions: ["Settings", "Sync setups…", "Storage connections…", "Help"],
229
- settingsReview: {
230
- setupName: settingsConfig.setupName,
231
- fingerprint: syncCheckConfigFingerprint(settingsConfig),
232
- },
233
- };
234
- }
235
195
  return {
236
196
  title: [
237
197
  "Manage sync",
@@ -248,29 +208,6 @@ export async function describeManagerState(
248
208
  }
249
209
  }
250
210
 
251
- async function backgroundSummary(config: AnySyncConfig): Promise<string[]> {
252
- if (!config.continuous) return [];
253
- if (!config.agentMode) return ["Background sync: Paused · enable Autonomous sync"];
254
- try {
255
- const { continuousBinding, readContinuousPrivateDocument } = await import("../sync/continuous-storage.js");
256
- const recordApi: typeof import("../sync/continuous-record.js") = await import("../sync/continuous-record.js");
257
- const binding = await continuousBinding(config);
258
- const document = await readContinuousPrivateDocument(`${binding}.json`);
259
- if (!document) return ["Background sync: Enabled · not yet observed"];
260
- recordApi.validateContinuousRecord(document.value, binding);
261
- const record = document.value;
262
- const phases = { waiting: "Waiting", syncing: "Syncing", retry: "Retry", blocked: "Blocked" };
263
- return [
264
- `Background sync (recorded): ${phases[record.phase]}${record.error ? ` · ${record.error}` : ""}`,
265
- ...(record.transferred === undefined
266
- ? []
267
- : [`Last background transfer: Success · ${new Date(record.transferred).toISOString()}`]),
268
- ];
269
- } catch {
270
- return ["Background sync: Unknown · open Diagnostics"];
271
- }
272
- }
273
-
274
211
  function operationActions(
275
212
  operation: OperationAvailability,
276
213
  noSyncedContent: boolean,
@@ -1,12 +1,10 @@
1
1
  import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
2
2
  import type { Component } from "@earendil-works/pi-tui";
3
- import { type ActionMenuItem, defineMenu, type MenuDefinition, runDocumentReview, runMenu } from "@narumitw/pi-tui-kit";
3
+ import { type ActionMenuItem, defineMenu, type MenuDefinition, runMenu } from "@narumitw/pi-tui-kit";
4
4
  import { loadConfig, loadSettingsConfig, syncCheckConfigFingerprint } from "../settings/config.js";
5
5
  import { operationBlocksChanges } from "../state/operation-availability.js";
6
6
  import { captureMutationOwner } from "../sync/sync-local.js";
7
7
  import { type RunRoute, runCancellableOperation } from "./cancellable-operation.js";
8
- import { ignoreFileSettingsAvailable } from "./ignore-file-ui.js";
9
- import { showIgnoreMigrationPrompt } from "./ignore-migration-prompt.js";
10
8
  import {
11
9
  attentionMainMenuItems,
12
10
  blockedSyncMenuItem,
@@ -29,7 +27,6 @@ export async function showSyncManager(
29
27
  sessionSignal?: AbortSignal,
30
28
  options: SyncManagerAttentionOptions & {
31
29
  needsDaemonRecovery?: () => boolean;
32
- getPendingPullReview?: () => { setupName: string; fingerprint: string } | undefined;
33
30
  } = {},
34
31
  ): Promise<void> {
35
32
  if (!ctx.hasUI) {
@@ -49,7 +46,6 @@ export async function showSyncManager(
49
46
  type Action =
50
47
  | "activate"
51
48
  | "review-attention"
52
- | "retry-refusal"
53
49
  | "sync"
54
50
  | "switch"
55
51
  | "settings"
@@ -83,7 +79,6 @@ export async function showSyncManager(
83
79
  cancelledMessage: direction === "push" ? "Push cancellation requested." : "Pull cancellation requested.",
84
80
  target: review.setupName,
85
81
  directionalFingerprint: review.fingerprint,
86
- requirePendingAdoption: state.manager.recoveryPull,
87
82
  signal,
88
83
  isCurrent,
89
84
  },
@@ -190,35 +185,13 @@ export async function showSyncManager(
190
185
  const disposition = await dispatchManagerResult(ctx, result, "sync", runRoute, sessionSignal);
191
186
  return disposition.kind === "close" ? { kind: "close" } : { kind: "stay" };
192
187
  },
193
- "retry-refusal": async ({ state, signal: actionSignal }) => {
194
- const signal = sessionSignal ? AbortSignal.any([sessionSignal, actionSignal]) : actionSignal;
195
- const validate = captureMutationOwner(ctx, signal);
196
- validate();
197
- const retryRoute: RunRoute = (route, operationSignal, onCommit, target, onDialog) =>
198
- runRoute(route, operationSignal, onCommit, target, onDialog, true);
199
- const result = await runCancellableOperation(ctx, "Checking cached refusal…", "sync", retryRoute, {
200
- commitAware: true,
201
- cancelAcrossDialogs: true,
202
- signal,
203
- target: state.manager.configReview?.setupName,
204
- cancelledMessage: "Model retry cancelled. Submitted requests and committed writes cannot be undone.",
205
- });
206
- if (signal.aborted) return { kind: "close" };
207
- validate();
208
- if (result.kind === "decision-required" || result.kind === "remote-selection-required")
209
- ctx.ui.notify(
210
- "Model retry needs an established source and matching synced content. Use Sync now to review changed selection or recovery before retrying.",
211
- "warning",
212
- );
213
- return { kind: result.kind === "closed" ? "close" : "stay" };
214
- },
215
188
  switch: async () => {
216
189
  const result = await showSetupSwitcher(ctx, runRoute, undefined, sessionSignal);
217
190
  return result === "pull-attempted" || result === "closed" ? { kind: "close" } : { kind: "stay" };
218
191
  },
219
192
  settings: async ({ state, signal: actionSignal }) => {
220
193
  const signal = sessionSignal ? AbortSignal.any([sessionSignal, actionSignal]) : actionSignal;
221
- const review = state.manager.settingsReview ?? state.manager.configReview;
194
+ const review = state.manager.configReview;
222
195
  const result = await showSyncSettings(ctx, runRoute, signal, review?.setupName);
223
196
  return { kind: result === "exit" ? "close" : "stay" };
224
197
  },
@@ -261,30 +234,6 @@ export async function showSyncManager(
261
234
  const validate = captureMutationOwner(ctx, signal);
262
235
  const config = await loadConfig(state.manager.configReview?.setupName);
263
236
  validate();
264
- if (config.continuous) {
265
- const { continuousStatusLines } = await import("../sync/continuous-record.js");
266
- validate();
267
- const lines = await continuousStatusLines(config);
268
- validate();
269
- const review = await runDocumentReview(ctx, {
270
- title: "Sync diagnostics",
271
- lines: [`Setup: ${safeTerminalText(config.setupName)} · local observations only`],
272
- content: lines.join("\n"),
273
- confirmation: { label: "Continue to backend checks…" },
274
- hint: "back",
275
- signal,
276
- isCurrent,
277
- });
278
- validate();
279
- if (review.kind === "cancelled") return { kind: review.reason === "close" ? "close" : "stay" };
280
- if (review.kind !== "confirmed") return { kind: "stay" };
281
- const current = await loadConfig();
282
- validate();
283
- if (syncCheckConfigFingerprint(config) !== syncCheckConfigFingerprint(current)) {
284
- ctx.ui.notify("Setup changed during diagnostics review; reopen Diagnostics.", "warning");
285
- return { kind: "stay" };
286
- }
287
- }
288
237
  const confirmed = await ctx.ui.confirm(
289
238
  "Run diagnostics?",
290
239
  `Setup: ${safeTerminalText(config.setupName)}\nStorage: ${backendStorageDescription(config)}\nS3/R2 reads the latest pointer without writing. Git reads remote snapshots and checks its cache. WebDAV probes conditional writes and cleanup, and can repair a missing history entry. Possible-secret checks still run. This is not the read-only Check remote status action.`,
@@ -338,7 +287,6 @@ export async function showSyncManager(
338
287
  for (const action of [
339
288
  "review-attention",
340
289
  "sync",
341
- "retry-refusal",
342
290
  "settings",
343
291
  "pull",
344
292
  "push",
@@ -351,15 +299,7 @@ export async function showSyncManager(
351
299
  const activate = menu.actions[action];
352
300
  menu.actions[action] = async (invocation) => {
353
301
  validateOwner();
354
- const { configReview, settingsReview, recoveryPull } = invocation.state.manager;
355
- if (action === "pull" && recoveryPull) {
356
- if (options.getPendingPullReview?.() !== configReview) {
357
- ctx.ui.notify("The original Pull is no longer available for automatic recovery.", "warning");
358
- return { kind: "stay" };
359
- }
360
- return activate(invocation);
361
- }
362
- const review = action === "settings" ? (settingsReview ?? configReview) : configReview;
302
+ const review = invocation.state.manager.configReview;
363
303
  let current = false;
364
304
  try {
365
305
  const config = await (action === "settings" ? loadSettingsConfig() : loadConfig());
@@ -397,31 +337,18 @@ export async function showSyncManager(
397
337
  }, customOptions),
398
338
  },
399
339
  };
400
- let firstOpen = true;
401
340
  const recovery: State["manager"] = {
402
341
  title:
403
342
  "Pi Sync recovery required\nDaemon cleanup could not be confirmed. Stop the daemon before retrying a transfer.",
404
343
  actions: ["Stop daemon for recovery…", "Help"],
405
344
  };
406
- const describeRecovery = (): State["manager"] => {
407
- const configReview = options.getPendingPullReview?.();
408
- if (!configReview) return recovery;
409
- return {
410
- title: "Pi Sync recovery required\nPull can try to recover the daemon and review the pending transfer.",
411
- actions: ["Pull from remote", ...recovery.actions],
412
- configReview,
413
- recoveryPull: true,
414
- };
415
- };
416
345
  const describe = async (signal: AbortSignal) => {
417
- if (options.needsDaemonRecovery?.()) return describeRecovery();
346
+ if (options.needsDaemonRecovery?.()) return recovery;
418
347
  const pendingAttention = options.getAttention?.();
419
348
  const observation = options.getObservation?.();
420
- const manager = await describeManagerState(signal, pendingAttention, undefined, observation, () =>
421
- ignoreFileSettingsAvailable(ctx, signal),
422
- );
349
+ const manager = await describeManagerState(signal, pendingAttention, undefined, observation);
423
350
  if (signal.aborted || !isCurrent()) return manager;
424
- if (options.needsDaemonRecovery?.()) return describeRecovery();
351
+ if (options.needsDaemonRecovery?.()) return recovery;
425
352
  // A busy operation suppresses baseline reads, not the stored check-time hint.
426
353
  if (
427
354
  observation &&
@@ -437,20 +364,7 @@ export async function showSyncManager(
437
364
  return manager;
438
365
  };
439
366
  await runMenu(menuContext, menu, {
440
- getState: async ({ signal }) => {
441
- const offerOnOpen = firstOpen;
442
- firstOpen = false;
443
- let manager = await describe(signal);
444
- if (
445
- offerOnOpen &&
446
- manager.operation?.kind === "free" &&
447
- manager.configReview &&
448
- (await showIgnoreMigrationPrompt(ctx, manager.configReview.setupName, signal, isCurrent))
449
- ) {
450
- if (!signal.aborted && isCurrent()) manager = await describe(signal);
451
- }
452
- return { manager };
453
- },
367
+ getState: async ({ signal }) => ({ manager: await describe(signal) }),
454
368
  signal: sessionSignal,
455
369
  isCurrent,
456
370
  });
@@ -461,7 +375,6 @@ function syncMainMenuItem(
461
375
  ): ActionMenuItem<
462
376
  "main",
463
377
  | "sync"
464
- | "retry-refusal"
465
378
  | "pull"
466
379
  | "push"
467
380
  | "diff"
@@ -481,7 +394,6 @@ function syncMainMenuItem(
481
394
  > {
482
395
  const actions = {
483
396
  "Sync now": "sync",
484
- "Retry refused model result…": "retry-refusal",
485
397
  "Pull from remote": "pull",
486
398
  "Push to remote": "push",
487
399
  "View differences": "diff",
@@ -508,7 +420,6 @@ function syncMainMenuItem(
508
420
  action,
509
421
  description: {
510
422
  sync: "Merge changes on both sides.",
511
- "retry-refusal": "Retry model; may incur costs.",
512
423
  pull: "Remote → this device; replaces conflicting local files.",
513
424
  push: "This device → remote; replaces conflicting remote files.",
514
425
  diff: "Inspect changes; no transfer.",