@narumitw/pi-sync 0.67.0 → 0.67.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 (76) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/chunks/{chunk-BYVHABNR.ts → chunk-2MUAR5GH.ts} +2 -2
  4. package/dist/chunks/{chunk-5YOLQKNZ.ts → chunk-3CO7QIYB.ts} +14 -14
  5. package/dist/chunks/{chunk-DAZZ5BEJ.ts → chunk-3NS4PMCI.ts} +6 -2
  6. package/dist/chunks/{chunk-FI2F5JBS.ts → chunk-3Q3DMMID.ts} +8 -8
  7. package/dist/chunks/{chunk-BESRBKVO.ts → chunk-CQXGMESM.ts} +7 -7
  8. package/dist/chunks/{chunk-SZJOUVCL.ts → chunk-DGVZYS7T.ts} +5 -5
  9. package/dist/chunks/{chunk-WJQ4TGN5.ts → chunk-ECUCXF5Y.ts} +2 -2
  10. package/dist/chunks/{chunk-Z5JMOXJM.ts → chunk-JNTDIVP6.ts} +5 -5
  11. package/dist/chunks/{chunk-AYGMIMCV.ts → chunk-PUSMSKIM.ts} +11 -2
  12. package/dist/chunks/chunk-PUSMSKIM.ts.map +7 -0
  13. package/dist/chunks/{chunk-ASU3GZPW.ts → chunk-W7DSN33J.ts} +6 -6
  14. package/dist/chunks/{chunk-JQ5BAWW2.ts → chunk-XPKHWTGT.ts} +77 -16
  15. package/dist/chunks/chunk-XPKHWTGT.ts.map +7 -0
  16. package/dist/chunks/{command-handler-SQC2L2FJ.ts → command-handler-H5X3BX5D.ts} +40 -32
  17. package/dist/chunks/command-handler-H5X3BX5D.ts.map +7 -0
  18. package/dist/chunks/config-P54GGMXY.ts +39 -0
  19. package/dist/chunks/{conflict-review-J7L7S4AR.ts → conflict-review-SSY37F4P.ts} +2 -2
  20. package/dist/chunks/{file-selection-XWACUTAH.ts → file-selection-GASCVN45.ts} +6 -6
  21. package/dist/chunks/{ignore-file-ui-OHFISFVC.ts → ignore-file-ui-UY2TEK4C.ts} +5 -5
  22. package/dist/chunks/{manager-result-dispatcher-WXE2BAQO.ts → manager-result-dispatcher-PEVIGLOS.ts} +7 -7
  23. package/dist/chunks/{manager-ui-DWOMAJKE.ts → manager-ui-R5XHYRXK.ts} +50 -32
  24. package/dist/chunks/manager-ui-R5XHYRXK.ts.map +7 -0
  25. package/dist/chunks/{merge-review-AAC674C6.ts → merge-review-C2KETZKY.ts} +3 -3
  26. package/dist/chunks/{remote-selection-ui-E4XZCQ7A.ts → remote-selection-ui-WFLX6MAJ.ts} +6 -6
  27. package/dist/chunks/{setup-switch-644T6KHG.ts → setup-switch-JZDFQPVW.ts} +4 -4
  28. package/dist/chunks/setup-switch-JZDFQPVW.ts.map +7 -0
  29. package/dist/chunks/{setup-wizard-IEW56AZE.ts → setup-wizard-5OMFSFPJ.ts} +9 -9
  30. package/dist/chunks/{sync-inspection-NBBTSMKR.ts → sync-inspection-S2GHDBAD.ts} +5 -5
  31. package/dist/chunks/{sync-operations-AIEM2KL2.ts → sync-operations-LQ63CU2T.ts} +2 -2
  32. package/dist/daemon/dist/client.js +32 -18
  33. package/dist/daemon/dist/daemon-recovery.js +5 -3
  34. package/dist/daemon/dist/engine/ignore/adoption-journal.js +6 -3
  35. package/dist/daemon/dist/engine/sync/ignore-adoption.js +8 -2
  36. package/dist/daemon/dist/engine/sync/sync-mutations.js +4 -1
  37. package/dist/daemon/dist/engine-service.js +22 -6
  38. package/dist/daemon/dist/foreground-queue-outcome.js +4 -0
  39. package/dist/daemon/dist/server.js +2 -1
  40. package/dist/daemon/dist/service-host.js +7 -2
  41. package/dist/daemon/package.json +1 -1
  42. package/dist/index.ts +41 -32
  43. package/dist/index.ts.map +2 -2
  44. package/docs/daemon-migration.md +2 -0
  45. package/package.json +2 -2
  46. package/src/commands/command-execution.ts +10 -1
  47. package/src/commands/command-handler.ts +4 -0
  48. package/src/daemon/directional-recovery.ts +35 -5
  49. package/src/daemon/pi-client.ts +82 -12
  50. package/src/sync-extension.ts +17 -9
  51. package/src/ui/cancellable-operation.ts +13 -2
  52. package/src/ui/manager-state.ts +1 -0
  53. package/src/ui/manager-ui.ts +25 -4
  54. package/dist/chunks/chunk-AYGMIMCV.ts.map +0 -7
  55. package/dist/chunks/chunk-JQ5BAWW2.ts.map +0 -7
  56. package/dist/chunks/command-handler-SQC2L2FJ.ts.map +0 -7
  57. package/dist/chunks/manager-ui-DWOMAJKE.ts.map +0 -7
  58. /package/dist/chunks/{chunk-BYVHABNR.ts.map → chunk-2MUAR5GH.ts.map} +0 -0
  59. /package/dist/chunks/{chunk-5YOLQKNZ.ts.map → chunk-3CO7QIYB.ts.map} +0 -0
  60. /package/dist/chunks/{chunk-DAZZ5BEJ.ts.map → chunk-3NS4PMCI.ts.map} +0 -0
  61. /package/dist/chunks/{chunk-FI2F5JBS.ts.map → chunk-3Q3DMMID.ts.map} +0 -0
  62. /package/dist/chunks/{chunk-BESRBKVO.ts.map → chunk-CQXGMESM.ts.map} +0 -0
  63. /package/dist/chunks/{chunk-SZJOUVCL.ts.map → chunk-DGVZYS7T.ts.map} +0 -0
  64. /package/dist/chunks/{chunk-WJQ4TGN5.ts.map → chunk-ECUCXF5Y.ts.map} +0 -0
  65. /package/dist/chunks/{chunk-Z5JMOXJM.ts.map → chunk-JNTDIVP6.ts.map} +0 -0
  66. /package/dist/chunks/{chunk-ASU3GZPW.ts.map → chunk-W7DSN33J.ts.map} +0 -0
  67. /package/dist/chunks/{ignore-file-ui-OHFISFVC.ts.map → config-P54GGMXY.ts.map} +0 -0
  68. /package/dist/chunks/{conflict-review-J7L7S4AR.ts.map → conflict-review-SSY37F4P.ts.map} +0 -0
  69. /package/dist/chunks/{file-selection-XWACUTAH.ts.map → file-selection-GASCVN45.ts.map} +0 -0
  70. /package/dist/chunks/{manager-result-dispatcher-WXE2BAQO.ts.map → ignore-file-ui-UY2TEK4C.ts.map} +0 -0
  71. /package/dist/chunks/{merge-review-AAC674C6.ts.map → manager-result-dispatcher-PEVIGLOS.ts.map} +0 -0
  72. /package/dist/chunks/{remote-selection-ui-E4XZCQ7A.ts.map → merge-review-C2KETZKY.ts.map} +0 -0
  73. /package/dist/chunks/{setup-switch-644T6KHG.ts.map → remote-selection-ui-WFLX6MAJ.ts.map} +0 -0
  74. /package/dist/chunks/{setup-wizard-IEW56AZE.ts.map → setup-wizard-5OMFSFPJ.ts.map} +0 -0
  75. /package/dist/chunks/{sync-inspection-NBBTSMKR.ts.map → sync-inspection-S2GHDBAD.ts.map} +0 -0
  76. /package/dist/chunks/{sync-operations-AIEM2KL2.ts.map → sync-operations-LQ63CU2T.ts.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @narumitw/pi-sync
2
2
 
3
+ ## 0.67.1
4
+
5
+ ### Patch Changes
6
+
7
+ - df24888: Resume an interrupted ignore-rule adoption from Pull when the original session can verify file-queue recovery. Use the recorded snapshot and ask before continuing.
8
+
3
9
  ## 0.67.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -84,7 +84,7 @@ Remote status: Not checked
84
84
  Last applied: Never synced
85
85
  ```
86
86
 
87
- Use **Sync…** (**Sync now** in RPC) to merge both ways. **Push to remote** uses this device's version for managed files; **Pull from remote** uses the remote version. After initial daemon handover, each choice can replace or remove managed files at the destination without a second transfer confirmation. Push preserves the previous remote version in **History**; Pull creates a local backup before applying changes. History rollback still follows the current sync rules; see [Recover excluded files from History](#recover-excluded-files-from-history) for files those rules no longer select. Use **View differences** first if you want a preview. Selecting a direction does not authorize background transfers or model use. If a file-queue release cannot be confirmed, Pi Sync attempts recovery within the same action. It does not repeat a known commit or guess when the write outcome is unknown.
87
+ Use **Sync…** (**Sync now** in RPC) to merge both ways. **Push to remote** uses this device's version for managed files; **Pull from remote** uses the remote version. After initial daemon handover, each choice can replace or remove managed files at the destination without a second transfer confirmation. Push preserves the previous remote version in **History**; Pull creates a local backup before applying changes. History rollback still follows the current sync rules; see [Recover excluded files from History](#recover-excluded-files-from-history) for files those rules no longer select. Use **View differences** first if you want a preview. Selecting a direction does not authorize background transfers or model use. If a file-queue release cannot be confirmed, Pi Sync attempts recovery within the same action. It does not repeat a known commit or guess when the write outcome is unknown. Use the same **Pull from remote** action to review and continue a pending ignore-rule Pull. It uses the recorded snapshot, not the latest remote snapshot. See [daemon recovery](./docs/daemon-migration.md#recover-from-uncertain-daemon-cleanup) if it cannot recover the owner.
88
88
 
89
89
  Type to filter actions; navigation scrolls the list. **Settings**, **History**, and **Diagnostics** remain directly available. Switching appears only when multiple valid setups exist; review and access-recovery actions appear when needed.
90
90
 
@@ -24,7 +24,7 @@ import {
24
24
  import {
25
25
  loadSettingsConfig,
26
26
  syncCheckConfigFingerprint
27
- } from "./chunk-DAZZ5BEJ.ts";
27
+ } from "./chunk-3NS4PMCI.ts";
28
28
  import {
29
29
  safeTerminalText
30
30
  } from "./chunk-2JNFEZ3V.ts";
@@ -274,4 +274,4 @@ export {
274
274
  directoryScopeSummary,
275
275
  showDirectoryScope
276
276
  };
277
- //# sourceMappingURL=chunk-BYVHABNR.ts.map
277
+ //# sourceMappingURL=chunk-2MUAR5GH.ts.map
@@ -3,10 +3,16 @@
3
3
  import {
4
4
  throwIfAborted
5
5
  } from "./chunk-UMPA5S7X.ts";
6
+ import {
7
+ setSyncStatus
8
+ } from "./chunk-H7VOTY5N.ts";
6
9
  import {
7
10
  runCancellableOperation,
8
11
  runCancellableTask
9
- } from "./chunk-AYGMIMCV.ts";
12
+ } from "./chunk-PUSMSKIM.ts";
13
+ import {
14
+ errorMessage
15
+ } from "./chunk-6YKOHBSC.ts";
10
16
  import {
11
17
  SyncSetupReviewChangedError,
12
18
  updateSyncSetup
@@ -17,17 +23,6 @@ import {
17
23
  import {
18
24
  sameSyncExclude
19
25
  } from "./chunk-ZO52JM4H.ts";
20
- import {
21
- loadConfig,
22
- syncConfigReviewFingerprint,
23
- syncSettingsConfigFingerprint
24
- } from "./chunk-DAZZ5BEJ.ts";
25
- import {
26
- setSyncStatus
27
- } from "./chunk-H7VOTY5N.ts";
28
- import {
29
- errorMessage
30
- } from "./chunk-6YKOHBSC.ts";
31
26
  import {
32
27
  RemoteSelectionMismatchError,
33
28
  compareSyncInclude,
@@ -35,6 +30,11 @@ import {
35
30
  sameSyncInclude,
36
31
  syncDirectoryPolicyKey
37
32
  } from "./chunk-R3SAMXB6.ts";
33
+ import {
34
+ loadConfig,
35
+ syncConfigReviewFingerprint,
36
+ syncSettingsConfigFingerprint
37
+ } from "./chunk-3NS4PMCI.ts";
38
38
  import {
39
39
  safeTerminalText
40
40
  } from "./chunk-2JNFEZ3V.ts";
@@ -160,7 +160,7 @@ async function showRemoteSelectionReview(ctx, setupName, signal, factory = creat
160
160
  async function showSelectionDifference(ctx, initialDecision, origin, runRoute, sessionSignal, factory, options, validateOwner) {
161
161
  const isCurrent = () => isReviewOwnerCurrent(validateOwner);
162
162
  const canReviewPull = Boolean(
163
- runRoute && !options.readOnly && initialDecision.ignorePolicyComparison === "mismatch" && await (await import("./ignore-file-ui-OHFISFVC.ts")).portableIgnoreRulesAvailable(ctx, sessionSignal)
163
+ runRoute && !options.readOnly && initialDecision.ignorePolicyComparison === "mismatch" && await (await import("./ignore-file-ui-UY2TEK4C.ts")).portableIgnoreRulesAvailable(ctx, sessionSignal)
164
164
  );
165
165
  if (!isCurrent()) return { kind: "stale" };
166
166
  let flowState = { decision: initialDecision, saved: false };
@@ -768,4 +768,4 @@ function combineSignals(sessionSignal, actionSignal) {
768
768
  export {
769
769
  showRemoteSelectionReview
770
770
  };
771
- //# sourceMappingURL=chunk-5YOLQKNZ.ts.map
771
+ //# sourceMappingURL=chunk-3CO7QIYB.ts.map
@@ -24,6 +24,8 @@ import {
24
24
  export {
25
25
  configFromSettings,
26
26
  createSettingsConfigView,
27
+ isEnabled,
28
+ isExplicitlyEnabled,
27
29
  loadConfig,
28
30
  loadConfigForCheck,
29
31
  loadPartialConfig,
@@ -33,6 +35,8 @@ export {
33
35
  syncConfigReviewFingerprint,
34
36
  syncConfigReviewIdentity,
35
37
  syncSessionsWarnings,
36
- syncSettingsConfigFingerprint
38
+ syncSettingsConfigFingerprint,
39
+ syncSetupReviewIdentity,
40
+ syncSetupStorageReview
37
41
  };
38
- //# sourceMappingURL=chunk-DAZZ5BEJ.ts.map
42
+ //# sourceMappingURL=chunk-3NS4PMCI.ts.map
@@ -1,19 +1,19 @@
1
1
  // @generated by scripts/build-runtime.mjs; do not edit.
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
- import {
4
- sameSyncExclude
5
- } from "./chunk-ZO52JM4H.ts";
6
- import {
7
- syncCheckConfigFingerprint,
8
- syncConfigReviewFingerprint
9
- } from "./chunk-DAZZ5BEJ.ts";
10
3
  import {
11
4
  setSyncStatus
12
5
  } from "./chunk-H7VOTY5N.ts";
6
+ import {
7
+ sameSyncExclude
8
+ } from "./chunk-ZO52JM4H.ts";
13
9
  import {
14
10
  sameSyncInclude,
15
11
  syncDirectoryPolicyKey
16
12
  } from "./chunk-R3SAMXB6.ts";
13
+ import {
14
+ syncCheckConfigFingerprint,
15
+ syncConfigReviewFingerprint
16
+ } from "./chunk-3NS4PMCI.ts";
17
17
  import {
18
18
  safeTerminalText
19
19
  } from "./chunk-2JNFEZ3V.ts";
@@ -184,4 +184,4 @@ export {
184
184
  observationMatchesConfig,
185
185
  observationSummary
186
186
  };
187
- //# sourceMappingURL=chunk-FI2F5JBS.ts.map
187
+ //# sourceMappingURL=chunk-3Q3DMMID.ts.map
@@ -2,17 +2,17 @@
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  showRemoteSelectionReview
5
- } from "./chunk-5YOLQKNZ.ts";
5
+ } from "./chunk-3CO7QIYB.ts";
6
6
  import {
7
7
  runCancellableOperation
8
- } from "./chunk-AYGMIMCV.ts";
9
- import {
10
- loadConfig,
11
- syncConfigReviewIdentity
12
- } from "./chunk-DAZZ5BEJ.ts";
8
+ } from "./chunk-PUSMSKIM.ts";
13
9
  import {
14
10
  errorMessage
15
11
  } from "./chunk-6YKOHBSC.ts";
12
+ import {
13
+ loadConfig,
14
+ syncConfigReviewIdentity
15
+ } from "./chunk-3NS4PMCI.ts";
16
16
  import {
17
17
  safeTerminalText
18
18
  } from "./chunk-2JNFEZ3V.ts";
@@ -208,4 +208,4 @@ async function dispatchManagerResult(ctx, initialResult, origin, runRoute, signa
208
208
  export {
209
209
  dispatchManagerResult
210
210
  };
211
- //# sourceMappingURL=chunk-BESRBKVO.ts.map
211
+ //# sourceMappingURL=chunk-CQXGMESM.ts.map
@@ -10,6 +10,9 @@ import {
10
10
  import {
11
11
  setSyncSetupCompletions
12
12
  } from "./chunk-XUZV4OGI.ts";
13
+ import {
14
+ SetupPullRequiresUiError
15
+ } from "./chunk-6YKOHBSC.ts";
13
16
  import {
14
17
  captureMutationOwner
15
18
  } from "./chunk-GELYN4UC.ts";
@@ -19,10 +22,7 @@ import {
19
22
  loadSettingsConfig,
20
23
  syncCheckConfigFingerprint,
21
24
  syncConfigReviewIdentity
22
- } from "./chunk-DAZZ5BEJ.ts";
23
- import {
24
- SetupPullRequiresUiError
25
- } from "./chunk-6YKOHBSC.ts";
25
+ } from "./chunk-3NS4PMCI.ts";
26
26
  import {
27
27
  safeTerminalText
28
28
  } from "./chunk-2JNFEZ3V.ts";
@@ -146,4 +146,4 @@ export {
146
146
  saveOnSwitch,
147
147
  useSyncSetup
148
148
  };
149
- //# sourceMappingURL=chunk-SZJOUVCL.ts.map
149
+ //# sourceMappingURL=chunk-DGVZYS7T.ts.map
@@ -2,7 +2,7 @@
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  runCancellableTask
5
- } from "./chunk-AYGMIMCV.ts";
5
+ } from "./chunk-PUSMSKIM.ts";
6
6
  import {
7
7
  safeTerminalText
8
8
  } from "./chunk-2JNFEZ3V.ts";
@@ -279,4 +279,4 @@ function compactLegacyTransferSummary(lines) {
279
279
  export {
280
280
  confirmMergeReview
281
281
  };
282
- //# sourceMappingURL=chunk-WJQ4TGN5.ts.map
282
+ //# sourceMappingURL=chunk-ECUCXF5Y.ts.map
@@ -3,15 +3,15 @@
3
3
  import {
4
4
  trackOperationDialogs
5
5
  } from "./chunk-KNEUL4XN.ts";
6
+ import {
7
+ piDaemonClient
8
+ } from "./chunk-XPKHWTGT.ts";
6
9
  import {
7
10
  runCancellableTask
8
- } from "./chunk-AYGMIMCV.ts";
11
+ } from "./chunk-PUSMSKIM.ts";
9
12
  import {
10
13
  captureMutationOwner
11
14
  } from "./chunk-GELYN4UC.ts";
12
- import {
13
- piDaemonClient
14
- } from "./chunk-JQ5BAWW2.ts";
15
15
  import {
16
16
  safeTerminalText
17
17
  } from "./chunk-2JNFEZ3V.ts";
@@ -103,4 +103,4 @@ export {
103
103
  portableIgnoreRulesAvailable,
104
104
  showIgnoreFileAction
105
105
  };
106
- //# sourceMappingURL=chunk-Z5JMOXJM.ts.map
106
+ //# sourceMappingURL=chunk-JNTDIVP6.ts.map
@@ -9,7 +9,16 @@ async function runCancellableOperation(ctx, message, route, runRoute, options =
9
9
  const result = await runCancellableTask(
10
10
  ctx,
11
11
  message,
12
- (signal, onCommit, onDialog) => runRoute(route, signal, onCommit, options.target, onDialog, void 0, options.directionalFingerprint),
12
+ (signal, onCommit, onDialog) => runRoute(
13
+ route,
14
+ signal,
15
+ onCommit,
16
+ options.target,
17
+ onDialog,
18
+ void 0,
19
+ options.directionalFingerprint,
20
+ options.requirePendingAdoption
21
+ ),
13
22
  options
14
23
  );
15
24
  return result.kind === "completed" ? result.value ?? { kind: "failed" } : result;
@@ -111,4 +120,4 @@ export {
111
120
  runCancellableOperation,
112
121
  runCancellableTask
113
122
  };
114
- //# sourceMappingURL=chunk-AYGMIMCV.ts.map
123
+ //# sourceMappingURL=chunk-PUSMSKIM.ts.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ui/cancellable-operation.ts"],
4
+ "sourcesContent": ["import { BorderedLoader, type ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { isKeyRelease, Key, matchesKey, truncateToWidth } from \"@earendil-works/pi-tui\";\nimport { formatInteractionHints, runCustomInteraction } from \"@narumitw/pi-tui-kit\";\nimport type { SetupPullOutcome } from \"../sync/setup-switch.js\";\nimport type { SyncDecision } from \"../sync/sync-decision.js\";\nimport type { RemoteSelectionDecision } from \"../sync/sync-policy.js\";\n\nexport type RunRouteResult =\n | { kind: \"completed\"; outcome?: SetupPullOutcome }\n | { kind: \"decision-required\"; decision: SyncDecision }\n | { kind: \"remote-selection-required\"; decision: RemoteSelectionDecision }\n | { kind: \"failed\" };\n\nexport type RunRoute = (\n route: string,\n signal?: AbortSignal,\n onCommit?: () => void,\n target?: string,\n onDialog?: (active: boolean) => void,\n retryRefusal?: boolean,\n directionalFingerprint?: string,\n requirePendingAdoption?: boolean,\n) => Promise<RunRouteResult | undefined>;\n\nexport type CancellableOperationResult = RunRouteResult | { kind: \"closed\" } | { kind: \"cancelled\" };\n\ninterface CancellableOperationOptions {\n commitAware?: boolean;\n cancelAcrossDialogs?: boolean;\n cancelledMessage?: string | null;\n target?: string;\n directionalFingerprint?: string;\n requirePendingAdoption?: boolean;\n signal?: AbortSignal;\n isCurrent?: () => boolean;\n}\n\nexport async function runCancellableOperation(\n ctx: ExtensionContext,\n message: string,\n route: string,\n runRoute: RunRoute,\n options: CancellableOperationOptions = {},\n): Promise<CancellableOperationResult> {\n const result = await runCancellableTask(\n ctx,\n message,\n (signal, onCommit, onDialog) =>\n runRoute(\n route,\n signal,\n onCommit,\n options.target,\n onDialog,\n undefined,\n options.directionalFingerprint,\n options.requirePendingAdoption,\n ),\n options,\n );\n return result.kind === \"completed\" ? (result.value ?? { kind: \"failed\" }) : result;\n}\n\nexport type CancellableTaskResult<Value> =\n | { kind: \"completed\"; value: Value }\n | { kind: \"closed\" }\n | { kind: \"cancelled\" };\n\n/** Keep non-route work under the same cancellation and drain owner as transfers. */\nexport async function runCancellableTask<Value>(\n ctx: ExtensionContext,\n message: string,\n task: (\n signal: AbortSignal | undefined,\n onCommit?: () => void,\n onDialog?: (active: boolean) => void,\n ) => Promise<Value>,\n options: Omit<CancellableOperationOptions, \"target\" | \"directionalFingerprint\" | \"requirePendingAdoption\"> = {},\n): Promise<CancellableTaskResult<Value>> {\n const {\n commitAware = false,\n cancelAcrossDialogs = false,\n cancelledMessage = \"Check cancelled; no settings or files were changed.\",\n signal,\n isCurrent = () => true,\n } = options;\n if (signal?.aborted || !isCurrent()) return { kind: \"closed\" };\n if (ctx.mode !== \"tui\") return { kind: \"completed\", value: await task(signal) };\n let commitStarted = false;\n let taskResult!: Value;\n const interaction = await runCustomInteraction<{ cancelled?: boolean; error?: unknown }, ExtensionContext>(ctx, {\n signal,\n isCurrent: () => !signal?.aborted && isCurrent(),\n create: ({ tui, theme, keybindings, signal: interactionSignal, complete }) => {\n const loader = new BorderedLoader(tui, theme, message, { cancellable: false });\n const cancelHint = formatInteractionHints(keybindings, [\n {\n keys: [...keybindings.getKeys(\"tui.select.cancel\").filter((key) => !hasControlCharacter(key)), \"ctrl+c\"],\n label: \"cancel\",\n },\n ]);\n const cancel = (data: string) => {\n // Raw terminal listeners run before Pi filters Kitty key releases.\n if (isKeyRelease(data)) return false;\n if (!matchesKey(data, Key.ctrl(\"c\")) && !keybindings.matches(data, \"tui.select.cancel\")) return false;\n if (commitStarted) {\n ctx.ui.notify(\"Applying or publishing has started and cannot be cancelled safely.\", \"warning\");\n } else complete({ cancelled: true });\n return true;\n };\n // Pi dialogs replace this loader and restore the normal editor. Defer\n // ordinary keys while they are open; retain raw cancellation afterward.\n // Ctrl+C remains the root flow's hard-cancel path regardless of focus.\n let activeDialogs = 0;\n const unsubscribe = cancelAcrossDialogs\n ? ctx.ui.onTerminalInput((data) => {\n if (isKeyRelease(data)) return;\n if (activeDialogs > 0 && !matchesKey(data, Key.ctrl(\"c\"))) return;\n return cancel(data) ? { consume: true } : undefined;\n })\n : undefined;\n let pendingTask: Promise<Value>;\n try {\n pendingTask = task(\n interactionSignal,\n commitAware ? () => (commitStarted = true) : undefined,\n cancelAcrossDialogs\n ? (active) => {\n activeDialogs += active ? 1 : -1;\n }\n : undefined,\n );\n } catch (error) {\n unsubscribe?.();\n loader.dispose();\n throw error;\n }\n const operation = pendingTask.then(\n (result) => {\n taskResult = result;\n complete({});\n },\n (error: unknown) => complete({ error }),\n );\n return {\n render(width: number) {\n if (width <= 0) return [];\n const safeWidth = Math.max(1, width);\n const lines = loader.render(safeWidth);\n const bottomBorder = lines.at(-1);\n return [\n ...lines.slice(0, -1),\n truncateToWidth(theme.fg(\"dim\", cancelHint), safeWidth, \"\"),\n ...(bottomBorder === undefined ? [] : [bottomBorder]),\n ];\n },\n invalidate: () => loader.invalidate(),\n handleInput: cancel,\n dispose() {\n unsubscribe?.();\n loader.dispose();\n },\n waitForPending: () => operation,\n };\n },\n });\n if (interaction.kind === \"error\") throw interaction.error;\n if (interaction.kind !== \"completed\") return { kind: \"closed\" };\n if (interaction.value.cancelled) {\n if (cancelledMessage) ctx.ui.notify(cancelledMessage, \"info\");\n return { kind: \"cancelled\" };\n }\n if (interaction.value.error) throw interaction.value.error;\n return { kind: \"completed\", value: taskResult };\n}\n\nfunction hasControlCharacter(value: string) {\n // biome-ignore lint/suspicious/noControlCharactersInRegex: Unsafe key labels must be omitted.\n return /[\\u0000-\\u001f\\u007f-\\u009f]/u.test(value);\n}\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-ECYCNZOE.ts";
6
6
  import {
7
7
  ignoreFileSettingsAvailable
8
- } from "./chunk-Z5JMOXJM.ts";
8
+ } from "./chunk-JNTDIVP6.ts";
9
9
  import {
10
10
  effectiveSyncSetupRemoteIdentity,
11
11
  normalizeS3Bucket,
@@ -26,6 +26,9 @@ import {
26
26
  AUTOMATIC_SYNC_DESCRIPTION,
27
27
  setSyncSetupCompletions
28
28
  } from "./chunk-XUZV4OGI.ts";
29
+ import {
30
+ errorMessage
31
+ } from "./chunk-6YKOHBSC.ts";
29
32
  import {
30
33
  acknowledgeSessions,
31
34
  directoryScopeLines,
@@ -43,9 +46,6 @@ import {
43
46
  import {
44
47
  captureMutationOwner
45
48
  } from "./chunk-GELYN4UC.ts";
46
- import {
47
- errorMessage
48
- } from "./chunk-6YKOHBSC.ts";
49
49
  import {
50
50
  DEFAULT_SYNC_INCLUDE
51
51
  } from "./chunk-R3SAMXB6.ts";
@@ -318,7 +318,7 @@ async function finishSetup(ctx, name, message, join, signal) {
318
318
  if (signal?.aborted) return;
319
319
  ctx.ui.notify(message, "info");
320
320
  if (!join) return;
321
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-E4XZCQ7A.ts");
321
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-WFLX6MAJ.ts");
322
322
  if (signal?.aborted) return;
323
323
  await showRemoteSelectionReview(ctx, name, signal, void 0, {
324
324
  origin: "settings",
@@ -1069,4 +1069,4 @@ export {
1069
1069
  showAddWebDavStorageProfile,
1070
1070
  showEditWebDavStorageProfile
1071
1071
  };
1072
- //# sourceMappingURL=chunk-ASU3GZPW.ts.map
1072
+ //# sourceMappingURL=chunk-W7DSN33J.ts.map
@@ -221,6 +221,11 @@ var DirectionalCheckpoint = class {
221
221
  function recoveryOutcome(value) {
222
222
  if (!value || typeof value !== "object" || !("foregroundQueueCleanup" in value)) return;
223
223
  if (value.foregroundQueueCleanup === "before-mutation") return { phase: "unchanged" };
224
+ if (value.foregroundQueueCleanup === "resume-adoption") {
225
+ if (!("journal" in value) || typeof value.journal !== "string" || !/^[a-f0-9]{64}$/u.test(value.journal))
226
+ throw new Error("The recorded Pull could not be verified. Use /sync daemon recover.");
227
+ return { phase: "adoption", journal: value.journal };
228
+ }
224
229
  if (value.foregroundQueueCleanup === "verified-result" && "result" in value)
225
230
  return { phase: "completed", result: value.result };
226
231
  }
@@ -237,10 +242,13 @@ function cancelledAfterCompletion(result, cause) {
237
242
  error.name = "AbortError";
238
243
  return error;
239
244
  }
240
- async function runDirectionalRecovery(connection, signal, run, recover, markCleanupRequired) {
245
+ async function runDirectionalRecovery(connection, signal, run, recover, markCleanupRequired, adoption) {
241
246
  signal.throwIfAborted();
247
+ const pending = adoption?.pending;
248
+ if (pending && pending.owner !== connection) throw new Error("The daemon changed before Pull recovery.");
242
249
  const attempt2 = new DirectionalCheckpoint(connection);
243
- const result = await run(attempt2);
250
+ attempt2.job = pending?.job;
251
+ const result = pending ? { foregroundQueueCleanup: "resume-adoption", journal: pending.journal } : await run(attempt2);
244
252
  const primary = recoveryOutcome(result);
245
253
  if (!primary) return result;
246
254
  markCleanupRequired();
@@ -248,9 +256,12 @@ async function runDirectionalRecovery(connection, signal, run, recover, markClea
248
256
  const bounded = AbortSignal.any([signal, AbortSignal.timeout(45e3)]);
249
257
  try {
250
258
  bounded.throwIfAborted();
251
- if (!attempt2.job || primary.phase === "unchanged" && !attempt2.fingerprint)
259
+ if (!attempt2.job || primary.phase === "unchanged" && !attempt2.fingerprint || primary.phase === "adoption" && (!adoption || !pending && !attempt2.fingerprint))
252
260
  throw new Error("The original transfer scope could not be verified.");
261
+ if (primary.phase === "adoption")
262
+ adoption?.retain({ owner: connection, job: attempt2.job, journal: primary.journal });
253
263
  replacement = await recover(connection, attempt2.job, bounded);
264
+ if (primary.phase === "adoption") adoption?.retain(void 0);
254
265
  bounded.throwIfAborted();
255
266
  } catch (error) {
256
267
  if (signal.aborted) {
@@ -263,11 +274,14 @@ async function runDirectionalRecovery(connection, signal, run, recover, markClea
263
274
  `The transfer finished, but file-queue recovery stopped. ${detail}${restoreMessage(primary.result)}`,
264
275
  { cause: error }
265
276
  );
277
+ if (primary.phase === "adoption")
278
+ throw new Error(`Pull recovery stopped. The adoption journal was kept. ${detail}`, { cause: error });
266
279
  throw new Error(`No transfer was applied, but file-queue recovery stopped. ${detail}`, { cause: error });
267
280
  }
268
281
  if (primary.phase === "completed") return primary.result;
269
- const retry = new DirectionalCheckpoint(replacement, attempt2.fingerprint);
270
- const retried = await run(retry, attempt2.fingerprint);
282
+ const retryCheckpoint = primary.phase === "unchanged" ? attempt2.fingerprint : void 0;
283
+ const retry = new DirectionalCheckpoint(replacement, retryCheckpoint);
284
+ const retried = await run(retry, retryCheckpoint, primary.phase === "adoption" ? primary.journal : void 0);
271
285
  const remaining = recoveryOutcome(retried);
272
286
  if (!remaining) return retried;
273
287
  markCleanupRequired();
@@ -277,6 +291,11 @@ async function runDirectionalRecovery(connection, signal, run, recover, markClea
277
291
  `Transfer finished, but file-queue cleanup is still uncertain after one recovery attempt.${restoreMessage(remaining.result)}`
278
292
  );
279
293
  }
294
+ if (remaining.phase === "adoption") {
295
+ if (retry.job && retry.fingerprint)
296
+ adoption?.retain({ owner: replacement, job: retry.job, journal: remaining.journal });
297
+ throw new Error("File-queue cleanup is still uncertain after one recovery attempt. The adoption journal was kept.");
298
+ }
280
299
  throw new Error("File-queue release could not be verified after one recovery attempt. No transfer was applied.");
281
300
  }
282
301
 
@@ -672,6 +691,7 @@ var PiDaemonClient = class {
672
691
  reloadRequest;
673
692
  pendingReload;
674
693
  directionalCheckpoint;
694
+ adoptionRecovery;
675
695
  recoveringDirectionalOwner = false;
676
696
  busy = /* @__PURE__ */ new Set();
677
697
  initialized = false;
@@ -1110,7 +1130,14 @@ var PiDaemonClient = class {
1110
1130
  get ownershipCleanupRequired() {
1111
1131
  return this.cleanupRequired;
1112
1132
  }
1133
+ get pendingPullReview() {
1134
+ const recovery = this.adoptionRecovery;
1135
+ if (!this.cleanupRequired || !recovery || this.paused || recovery.pending.owner !== this.connection || !recovery.pending.owner.canRecoverForeground(recovery.pending.job))
1136
+ return void 0;
1137
+ return recovery.review;
1138
+ }
1113
1139
  confirmRecoveryExit(owner) {
1140
+ this.adoptionRecovery = void 0;
1114
1141
  this.cleanupRequired = true;
1115
1142
  this.recoveredOwner = owner;
1116
1143
  }
@@ -1118,9 +1145,14 @@ var PiDaemonClient = class {
1118
1145
  if (error instanceof DaemonError2 && error.remote.properties?.code === OWNERSHIP_CLEANUP_REQUIRED || error instanceof Error && ("code" in error && error.code === OWNERSHIP_CLEANUP_REQUIRED || error.message === "Daemon ownership cleanup is uncertain; stop and reconcile before restarting." || error.message === "Daemon ownership cleanup is uncertain; stop and reconcile before retrying." || error.message === "File-queue release is uncertain; stop the daemon and keep grants quarantined until owner exit."))
1119
1146
  this.cleanupRequired = true;
1120
1147
  }
1121
- run(operation, payload, signal, ctx = this.ctx, onCommit, reload) {
1148
+ run(operation, payload, signal, ctx = this.ctx, onCommit, reload, requirePendingAdoption = false) {
1122
1149
  const diagnostics = this.debug ? observeDebugJob(operation, (event) => this.recordDebug(event)) : void 0;
1123
- const result = this.work.then(() => this.runCurrent(operation, payload, signal, ctx, onCommit, reload, diagnostics)).catch((error) => {
1150
+ const adoptionRecovery = operation === "pull.foreground" && this.pendingPullReview ? this.adoptionRecovery : void 0;
1151
+ const result = this.work.then(() => {
1152
+ if (requirePendingAdoption && !adoptionRecovery)
1153
+ throw new Error("The original Pull is no longer available for automatic recovery.");
1154
+ return this.runCurrent(operation, payload, signal, ctx, onCommit, reload, diagnostics, adoptionRecovery);
1155
+ }).catch((error) => {
1124
1156
  diagnostics?.rejected(error, Boolean(signal?.aborted || reload?.signal.aborted));
1125
1157
  this.recordOwnershipFailure(error);
1126
1158
  throw error;
@@ -1160,8 +1192,10 @@ var PiDaemonClient = class {
1160
1192
  this.recoveringDirectionalOwner = false;
1161
1193
  }
1162
1194
  }
1163
- async runCurrent(operation, payload, signal, ctx = this.ctx, onCommit, reload, diagnostics) {
1195
+ async runCurrent(operation, payload, signal, ctx = this.ctx, onCommit, reload, diagnostics, adoptionRecovery) {
1164
1196
  this.validate();
1197
+ if (adoptionRecovery && (this.adoptionRecovery !== adoptionRecovery || !this.pendingPullReview))
1198
+ throw new Error("The original Pull is no longer available for automatic recovery.");
1165
1199
  signal?.throwIfAborted();
1166
1200
  reload?.signal.throwIfAborted();
1167
1201
  if (this.pendingReload) throw new Error("Pi resources are about to reload.");
@@ -1189,16 +1223,31 @@ var PiDaemonClient = class {
1189
1223
  runSignal.addEventListener("abort", clearForeground, { once: true });
1190
1224
  try {
1191
1225
  const root = isForegroundDirection(operation) ? lstatSync(this.root) : void 0;
1192
- const assertRoot = () => {
1226
+ const assertRoot = adoptionRecovery?.assertRoot ?? (() => {
1193
1227
  const current2 = lstatSync(this.root);
1194
1228
  if (!root || !current2.isDirectory() || current2.dev !== root.dev || current2.ino !== root.ino)
1195
1229
  throw new Error("The agent directory changed during the transfer.");
1196
- };
1230
+ });
1197
1231
  const intent = root ? structuredClone(payload) : payload;
1232
+ const pull = operation === "pull.foreground" ? intent : void 0;
1233
+ if (adoptionRecovery && (!pull || pull.setup !== adoptionRecovery.review.setupName || pull.fingerprint !== adoptionRecovery.review.fingerprint))
1234
+ throw new Error("The sync setup changed before Pull recovery.");
1235
+ if (adoptionRecovery) {
1236
+ assertRoot();
1237
+ const { createSettingsConfigView, syncCheckConfigFingerprint } = await import("./config-P54GGMXY.ts");
1238
+ this.validateFactsScope(connection, runSignal);
1239
+ const document = await peekLocalConfigDocument();
1240
+ this.validateFactsScope(connection, runSignal);
1241
+ const config = document && await createSettingsConfigView(document).observe(void 0, runSignal);
1242
+ this.validateFactsScope(connection, runSignal);
1243
+ assertRoot();
1244
+ if (!config || syncCheckConfigFingerprint(config) !== adoptionRecovery.review.fingerprint)
1245
+ throw new Error("The sync setup changed before Pull recovery.");
1246
+ }
1198
1247
  const result = root ? await runDirectionalRecovery(
1199
1248
  connection,
1200
1249
  runSignal,
1201
- async (checkpoint, retryCheckpoint) => {
1250
+ async (checkpoint, retryCheckpoint, retryAdoptionJournal) => {
1202
1251
  const current2 = checkpoint.connection;
1203
1252
  this.validateFactsScope(current2, runSignal);
1204
1253
  assertRoot();
@@ -1206,7 +1255,7 @@ var PiDaemonClient = class {
1206
1255
  try {
1207
1256
  return await current2.run(
1208
1257
  operation,
1209
- retryCheckpoint === void 0 ? intent : { ...intent, retryCheckpoint },
1258
+ retryAdoptionJournal !== void 0 ? { ...pull, retryAdoptionJournal } : retryCheckpoint === void 0 ? intent : { ...intent, retryCheckpoint },
1210
1259
  runSignal,
1211
1260
  onCommit,
1212
1261
  (id) => {
@@ -1221,6 +1270,16 @@ var PiDaemonClient = class {
1221
1270
  (owner, job, recoverySignal) => this.recoverDirectionalOwner(owner, job, recoverySignal, assertRoot),
1222
1271
  () => {
1223
1272
  this.cleanupRequired = true;
1273
+ },
1274
+ pull && {
1275
+ pending: adoptionRecovery?.pending,
1276
+ retain: (pending) => {
1277
+ this.adoptionRecovery = pending && {
1278
+ pending,
1279
+ review: { setupName: pull.setup, fingerprint: pull.fingerprint },
1280
+ assertRoot
1281
+ };
1282
+ }
1224
1283
  }
1225
1284
  ) : await connection.run(operation, payload, runSignal, onCommit, diagnostics?.onSubmit);
1226
1285
  if (runSignal.aborted || reload?.signal.aborted) diagnostics?.rejected(void 0, true);
@@ -1353,7 +1412,7 @@ var PiDaemonClient = class {
1353
1412
  this.validate();
1354
1413
  if (!ctx.hasUI || !["tui", "rpc"].includes(ctx.mode)) throw new Error("This client cannot present safety reviews.");
1355
1414
  const { title, confirmationLabel, summaryLines } = callback.payload;
1356
- const { confirmMergeReview } = await import("./merge-review-AAC674C6.ts");
1415
+ const { confirmMergeReview } = await import("./merge-review-C2KETZKY.ts");
1357
1416
  if (!isCurrent()) return false;
1358
1417
  this.validate();
1359
1418
  const result = await confirmMergeReview(
@@ -1381,7 +1440,9 @@ var PiDaemonClient = class {
1381
1440
  if (this.paused) throw new Error("Pi session is changing; no new work is authorized.");
1382
1441
  if (callback.kind === "directional-checkpoint") {
1383
1442
  this.validateFactsScope(connection, this.runSignal);
1384
- return !protectionOnly && this.directionalCheckpoint?.accept(connection, callback.job, payload?.fingerprint) === true;
1443
+ if (protectionOnly || this.directionalCheckpoint?.accept(connection, callback.job, payload?.fingerprint) !== true)
1444
+ return false;
1445
+ return payload.adoptionRecovery === 1 ? { adoptionRecovery: 1 } : true;
1385
1446
  }
1386
1447
  if (callback.kind === "queue-acquire") {
1387
1448
  if (this.pendingReload) throw new Error("Pi resources are about to reload.");
@@ -1413,7 +1474,7 @@ var PiDaemonClient = class {
1413
1474
  if (!ctx.hasUI || !["tui", "rpc"].includes(ctx.mode)) throw new Error("This client cannot present safety reviews.");
1414
1475
  let result;
1415
1476
  if (callback.kind === "merge-review" && typeof payload.title === "string" && typeof payload.content === "string") {
1416
- const { confirmMergeReview } = await import("./merge-review-AAC674C6.ts");
1477
+ const { confirmMergeReview } = await import("./merge-review-C2KETZKY.ts");
1417
1478
  this.validate();
1418
1479
  combined.throwIfAborted();
1419
1480
  result = await confirmMergeReview(
@@ -1488,4 +1549,4 @@ export {
1488
1549
  withPiDaemonClient,
1489
1550
  remoteOperation
1490
1551
  };
1491
- //# sourceMappingURL=chunk-JQ5BAWW2.ts.map
1552
+ //# sourceMappingURL=chunk-XPKHWTGT.ts.map