@narumitw/pi-sync 0.64.0 → 0.66.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 (116) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +80 -11
  3. package/dist/chunks/{chunk-TJ7YNITN.ts → chunk-5YOLQKNZ.ts} +39 -3
  4. package/dist/chunks/chunk-5YOLQKNZ.ts.map +7 -0
  5. package/dist/chunks/{chunk-NDEZ52SS.ts → chunk-ASU3GZPW.ts} +11 -93
  6. package/dist/chunks/chunk-ASU3GZPW.ts.map +7 -0
  7. package/dist/chunks/{chunk-CKUGCBHP.ts → chunk-AYGMIMCV.ts} +2 -2
  8. package/dist/chunks/chunk-AYGMIMCV.ts.map +7 -0
  9. package/dist/chunks/{chunk-F3VODLVQ.ts → chunk-BESRBKVO.ts} +3 -3
  10. package/dist/chunks/{chunk-TZMVSTAM.ts → chunk-BYVHABNR.ts} +4 -4
  11. package/dist/chunks/chunk-ECYCNZOE.ts +12 -0
  12. package/dist/chunks/chunk-ECYCNZOE.ts.map +7 -0
  13. package/dist/chunks/{chunk-RW44KNFD.ts → chunk-JQ5BAWW2.ts} +182 -12
  14. package/dist/chunks/chunk-JQ5BAWW2.ts.map +7 -0
  15. package/dist/chunks/{chunk-MANNB4WZ.ts → chunk-KNEUL4XN.ts} +1 -7
  16. package/dist/chunks/chunk-KNEUL4XN.ts.map +7 -0
  17. package/dist/chunks/{chunk-VPSC7BXM.ts → chunk-SZJOUVCL.ts} +2 -2
  18. package/dist/chunks/{chunk-YT6PDRMM.ts → chunk-WJQ4TGN5.ts} +17 -17
  19. package/dist/chunks/chunk-WJQ4TGN5.ts.map +7 -0
  20. package/dist/chunks/{chunk-4VKWHVUO.ts → chunk-XUZV4OGI.ts} +3 -2
  21. package/dist/chunks/{chunk-4VKWHVUO.ts.map → chunk-XUZV4OGI.ts.map} +2 -2
  22. package/dist/chunks/chunk-Z5JMOXJM.ts +106 -0
  23. package/dist/chunks/chunk-Z5JMOXJM.ts.map +7 -0
  24. package/dist/chunks/{command-handler-N45GY7AV.ts → command-handler-44EFGPWH.ts} +54 -13
  25. package/dist/chunks/command-handler-44EFGPWH.ts.map +7 -0
  26. package/dist/chunks/{conflict-review-5E4M44BA.ts → conflict-review-J7L7S4AR.ts} +2 -2
  27. package/dist/chunks/{file-selection-DDQN4LVD.ts → file-selection-XWACUTAH.ts} +8 -8
  28. package/dist/chunks/ignore-file-ui-OHFISFVC.ts +21 -0
  29. package/dist/chunks/{manager-result-dispatcher-FKW55L7I.ts → manager-result-dispatcher-WXE2BAQO.ts} +4 -4
  30. package/dist/chunks/{manager-ui-EV23DPZQ.ts → manager-ui-CVZLMXJ5.ts} +90 -76
  31. package/dist/chunks/manager-ui-CVZLMXJ5.ts.map +7 -0
  32. package/dist/chunks/{merge-review-6YSLSMGS.ts → merge-review-AAC674C6.ts} +3 -3
  33. package/dist/chunks/{remote-selection-ui-N4NMWFT2.ts → remote-selection-ui-E4XZCQ7A.ts} +3 -3
  34. package/dist/chunks/{setup-switch-HY7K3442.ts → setup-switch-644T6KHG.ts} +3 -3
  35. package/dist/chunks/setup-switch-644T6KHG.ts.map +7 -0
  36. package/dist/chunks/{setup-wizard-LEKDQ3HK.ts → setup-wizard-IEW56AZE.ts} +10 -8
  37. package/dist/chunks/{setup-wizard-LEKDQ3HK.ts.map → setup-wizard-IEW56AZE.ts.map} +1 -1
  38. package/dist/chunks/{sync-inspection-OS2LVOLV.ts → sync-inspection-NBBTSMKR.ts} +2 -2
  39. package/dist/chunks/{sync-operations-D3MDJUQQ.ts → sync-operations-AIEM2KL2.ts} +2 -2
  40. package/dist/daemon/dist/client.js +125 -287
  41. package/dist/daemon/dist/consent.js +14 -2
  42. package/dist/daemon/dist/daemon-recovery.js +85 -2
  43. package/dist/daemon/dist/daemon-startup.js +257 -0
  44. package/dist/daemon/dist/engine/backends/git/git-backend.js +15 -4
  45. package/dist/daemon/dist/engine/backends/git/git-storage.js +15 -3
  46. package/dist/daemon/dist/engine/backends/s3/s3-backend.js +20 -9
  47. package/dist/daemon/dist/engine/backends/sync-backend.js +16 -0
  48. package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +19 -6
  49. package/dist/daemon/dist/engine/ignore/adoption-journal.js +143 -0
  50. package/dist/daemon/dist/engine/ignore/snapshot-ignore-rules.js +39 -0
  51. package/dist/daemon/dist/engine/snapshot/snapshot-apply.js +2 -2
  52. package/dist/daemon/dist/engine/snapshot/snapshot-codec.js +6 -6
  53. package/dist/daemon/dist/engine/snapshot/snapshot-types.js +5 -1
  54. package/dist/daemon/dist/engine/snapshot/snapshot.js +5 -2
  55. package/dist/daemon/dist/engine/sync/conflict-review.js +2 -0
  56. package/dist/daemon/dist/engine/sync/continuous-watch.js +3 -2
  57. package/dist/daemon/dist/engine/sync/directional-action.js +119 -0
  58. package/dist/daemon/dist/engine/sync/ignore-adoption-recovery.js +50 -0
  59. package/dist/daemon/dist/engine/sync/ignore-adoption.js +401 -0
  60. package/dist/daemon/dist/engine/sync/ignore-publication.js +23 -0
  61. package/dist/daemon/dist/engine/sync/initialization.js +12 -0
  62. package/dist/daemon/dist/engine/sync/local-fields.js +6 -3
  63. package/dist/daemon/dist/engine/sync/merge-journal.js +2 -2
  64. package/dist/daemon/dist/engine/sync/merged-sync.js +14 -3
  65. package/dist/daemon/dist/engine/sync/remote-snapshot.js +3 -1
  66. package/dist/daemon/dist/engine/sync/sync-errors.js +20 -0
  67. package/dist/daemon/dist/engine/sync/sync-local.js +57 -3
  68. package/dist/daemon/dist/engine/sync/sync-mutations.js +375 -346
  69. package/dist/daemon/dist/engine/sync/sync-policy.js +5 -5
  70. package/dist/daemon/dist/engine/sync/sync-queries.js +3 -2
  71. package/dist/daemon/dist/engine/sync/sync-rollback.js +204 -0
  72. package/dist/daemon/dist/engine/sync/transfer-freshness.js +11 -5
  73. package/dist/daemon/dist/engine/ui/ignore-rule-preview.js +18 -0
  74. package/dist/daemon/dist/engine-service.js +69 -1
  75. package/dist/daemon/dist/foreground-queue-outcome.js +9 -0
  76. package/dist/daemon/dist/monitor.js +1 -0
  77. package/dist/daemon/dist/server.js +76 -11
  78. package/dist/daemon/dist/service-host.js +56 -8
  79. package/dist/daemon/package.json +1 -1
  80. package/dist/index.ts +6 -6
  81. package/docs/daemon-migration.md +3 -6
  82. package/docs/tui-contract.md +3 -3
  83. package/package.json +2 -2
  84. package/skills/configure-pi-sync/references/configuration.md +10 -8
  85. package/src/commands/command-execution.ts +56 -2
  86. package/src/commands/command-handler.ts +2 -0
  87. package/src/commands/command.ts +2 -1
  88. package/src/daemon/directional-recovery.ts +103 -0
  89. package/src/daemon/pi-client.ts +112 -9
  90. package/src/ui/cancellable-operation.ts +5 -2
  91. package/src/ui/ignore-file-ui.ts +13 -5
  92. package/src/ui/manager-state.ts +17 -10
  93. package/src/ui/manager-ui.ts +30 -25
  94. package/src/ui/merge-review.ts +8 -9
  95. package/src/ui/remote-selection-ui.ts +43 -2
  96. package/src/ui/settings-ui.ts +30 -30
  97. package/src/ui/sync-confirmation.ts +7 -7
  98. package/dist/chunks/chunk-CKUGCBHP.ts.map +0 -7
  99. package/dist/chunks/chunk-MANNB4WZ.ts.map +0 -7
  100. package/dist/chunks/chunk-NDEZ52SS.ts.map +0 -7
  101. package/dist/chunks/chunk-RW44KNFD.ts.map +0 -7
  102. package/dist/chunks/chunk-TJ7YNITN.ts.map +0 -7
  103. package/dist/chunks/chunk-YT6PDRMM.ts.map +0 -7
  104. package/dist/chunks/command-handler-N45GY7AV.ts.map +0 -7
  105. package/dist/chunks/manager-ui-EV23DPZQ.ts.map +0 -7
  106. /package/dist/chunks/{chunk-F3VODLVQ.ts.map → chunk-BESRBKVO.ts.map} +0 -0
  107. /package/dist/chunks/{chunk-TZMVSTAM.ts.map → chunk-BYVHABNR.ts.map} +0 -0
  108. /package/dist/chunks/{chunk-VPSC7BXM.ts.map → chunk-SZJOUVCL.ts.map} +0 -0
  109. /package/dist/chunks/{conflict-review-5E4M44BA.ts.map → conflict-review-J7L7S4AR.ts.map} +0 -0
  110. /package/dist/chunks/{file-selection-DDQN4LVD.ts.map → file-selection-XWACUTAH.ts.map} +0 -0
  111. /package/dist/chunks/{manager-result-dispatcher-FKW55L7I.ts.map → ignore-file-ui-OHFISFVC.ts.map} +0 -0
  112. /package/dist/chunks/{merge-review-6YSLSMGS.ts.map → manager-result-dispatcher-WXE2BAQO.ts.map} +0 -0
  113. /package/dist/chunks/{remote-selection-ui-N4NMWFT2.ts.map → merge-review-AAC674C6.ts.map} +0 -0
  114. /package/dist/chunks/{setup-switch-HY7K3442.ts.map → remote-selection-ui-E4XZCQ7A.ts.map} +0 -0
  115. /package/dist/chunks/{sync-inspection-OS2LVOLV.ts.map → sync-inspection-NBBTSMKR.ts.map} +0 -0
  116. /package/dist/chunks/{sync-operations-D3MDJUQQ.ts.map → sync-operations-AIEM2KL2.ts.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @narumitw/pi-sync
2
2
 
3
+ ## 0.66.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 94d781f: Include the active ignore file in new snapshots unless it ignores itself. Require a reviewed overwrite for either direction of a policy conflict, and let Pull adopt verified remote rules without changing the remote. Upgrade all peers before publishing the new snapshot format and review automatic transfers again.
8
+
9
+ ### Patch Changes
10
+
11
+ - 39e05a9: Find Settings by searching for storage connections in the sync menu. Show setting-specific save confirmations instead of generic transfer advice.
12
+
13
+ ## 0.65.0
14
+
15
+ ### Minor Changes
16
+
17
+ - c31f9c4: Make the `/sync` manager's Push and Pull actions apply the selected direction without another confirmation. Preserve a restore point before an overwrite, and recover eligible daemon file-queue failures within the same action without repeating a committed write. Direct slash commands retain their existing behavior.
18
+
19
+ ### Patch Changes
20
+
21
+ - 25d766a: Show Yes in the first terminal transfer confirmation, even for large reviews. Open View details only when you want to see individual paths. The summary still defaults to No, and Pi Sync verifies the transfer before applying it.
22
+
3
23
  ## 0.64.0
4
24
 
5
25
  ### Minor Changes
package/README.md CHANGED
@@ -83,7 +83,9 @@ Remote status: Not checked
83
83
  Last applied: Never synced
84
84
  ```
85
85
 
86
- Use **Sync…** (**Sync now** in RPC) for bidirectional merging, or **Pull from remote…** and **Push to remote…** for reviewed directional transfers. 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. Pull and Push do not implicitly force overwrites. The palette does not change transfer authorization: Autonomous sync can still apply eligible transfers without another confirmation.
86
+ 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
+
88
+ 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.
87
89
 
88
90
  The summary distinguishes cached observations, recorded background state, and the last successful background transfer; none proves current remote equality. Missing or invalid background evidence is not shown as Waiting. Automatic-transfer permissions and possible AI costs remain visible when enabled; detailed preferences stay in Settings. Setup-specific actions stay bound to the displayed setup; if its configuration changes while the menu is open, review the refreshed setup before continuing. Choose **Check remote status** for a fresh check or **View differences** for file differences; `/sync status`, `/sync diff`, and `/sync help` remain available. Last applied shows a compact snapshot ID and states when application time is unavailable; History retains full IDs.
89
91
 
@@ -96,15 +98,15 @@ With Continuous sync configured, **Diagnostics** first opens a scrollable local
96
98
 
97
99
  On secondary menus, **Back** and Escape return to the previous screen. In setup inputs and save reviews, cancellation (including Ctrl+C) discards the current unsaved draft and returns to its owning menu. Session replacement or shutdown closes the owning flow.
98
100
  Specialized operation and masked-credential prompts show the effective cancellation bindings and keep Ctrl+C as a hard-cancel input when Back is remapped.
99
- Destructive, credential-bearing, and externally visible operations show exact previews and confirmations, except transfers explicitly authorized by automatic-transfer policy or Autonomous sync.
101
+ Other destructive, credential-bearing, and externally visible actions show previews and confirmations where applicable. Autonomous and automatic transfers require their own authorization.
100
102
 
101
103
  ### Review transfer changes
102
104
 
103
105
  Unless Autonomous sync or another explicit transfer authorization applies, a merged **Sync now** transfer shows one confirmation with separate local and remote file changes, remote snapshot publication, session inclusion, and unresolved groups. **No, cancel** is initially selected in TUI mode. Up and Down select actions without scrolling the summary. If the summary does not fit, use Page Up and Page Down (or their configured selection-page bindings) to review it before confirming **Yes**. A terminal resize resets the review and selects **No**. Cancellation remains available throughout. This scrollable summary intentionally replaces Kit's clipped choice context, and the safe default differs from Pi's native Yes-first confirmation.
104
106
 
105
- **View details** is optional. It shows the complete add/update/delete lists and unresolved paths in an exact scrolling review, or bounded pages in RPC. The review cannot apply changes. Back or Escape returns to confirmation with **No** selected; Ctrl+C cancels the whole TUI flow. RPC offers No first but the client controls visual selection, and protocol cancellation from details returns to confirmation. Session replacement or shutdown closes the flow; local files and remote state are rechecked before transfer.
107
+ In TUI, select **Yes** from the first confirmation to proceed. **View details** is optional and shows the complete add/update/delete lists and unresolved paths. It cannot apply changes. Escape returns to confirmation with **No** selected; Ctrl+C cancels the whole TUI flow. RPC can show details in bounded pages and can require opening them first. RPC offers No first but the client controls visual selection, and protocol cancellation from details returns to confirmation. Session replacement or shutdown closes the flow; local files and remote state are rechecked before transfer.
106
108
 
107
- Unresolved paths stay unchanged on each side. A backup and recovery journal protect the transfer; resources do not reload automatically. Remote snapshot publication is shown separately because it can occur without file-content changes. File lists on the main screen are shortened when needed; details retain every path. `--yes` does not bypass a required policy-transition review. Automatic transfers require their own authorization and a compatible policy. Interactive TUI Push and Pull show directional add/update/remove counts and safety notes in the summary. Individual file paths are in **View details**, so a large file list does not delay confirmation. Loaded sessions are excluded from local change counts. Pull and rollback also list case-variant path cleanup; changed aliases invalidate approval. Push describes changes to the active immutable snapshot, not physical deletion of retained history. RPC and History rollback keep their existing confirmation protocols, with the complete directional summary. Local bytes, settings, baseline, and remote head are rechecked before applying a reviewed transfer.
109
+ Unresolved paths stay unchanged on each side. A backup and recovery journal protect the transfer; resources do not reload automatically. Remote snapshot publication is shown separately because it can occur without file-content changes. File lists on the main screen are shortened when needed; details retain every path. `--yes` does not bypass a required policy-transition review. Automatic transfers require their own authorization and a compatible policy. The direct `/sync push` and `/sync pull` routes retain their reviewed behavior and existing flags. Their TUI previews show directional add/update/remove counts and safety notes. Individual file paths are in **View details**, so a large file list does not delay confirmation. Loaded sessions are excluded from local change counts. Pull and rollback also list case-variant path cleanup; changed aliases invalidate approval. Push describes changes to the active immutable snapshot, not physical deletion of retained history. RPC and History rollback keep their existing confirmation protocols, with the complete directional summary. Local bytes, settings, baseline, and remote head are rechecked before applying a reviewed transfer.
108
110
 
109
111
  ### Restore sync access
110
112
 
@@ -126,7 +128,7 @@ After the same no-other-sync verification, `/sync unlock --stale` provides a det
126
128
 
127
129
  **Sync now** merges independent file additions, edits, and deletions against an established baseline. Equal concurrent edits are accepted. With the settings field merge opt-in enabled, supported `settings.json` fields can also merge using a verified accepted ancestor; arrays, nested objects and coupled fields remain atomic. Other divergent file edits, delete/modify conflicts, protected-session changes, selection changes, and case/file-directory collisions still require review; one unresolved path stops the entire merged transfer unless partial sync is explicitly enabled. Explicit push and pull remain directional.
128
130
 
129
- When **Sync now**, **Pull from remote…**, or **Push to remote…** requires a direction choice, the manager opens **Resolve sync conflict**.
131
+ When **Sync now** requires a direction choice, the manager opens **Resolve sync conflict**.
130
132
  The flow names the current setup and explains whether local content, remote content, or the included-content policy changed.
131
133
 
132
134
  An explicit remote content-list mismatch opens **Synced content differs** in the same manager flow.
@@ -240,9 +242,9 @@ Successful transfers show one summary. They do not reload resources, activate ex
240
242
 
241
243
  **Settings → Merge settings fields** controls the per-setup `sync.mergeSettings` opt-in, default **Off**. It combines independent global `settings.json` fields, not arbitrary JSON or keybindings. Missing/corrupt ancestors, unsupported syntax, and incompatible fields retain whole-transfer review. Sensitive accepted content is cached privately under the denied state root; disabling does not delete evidence.
242
244
 
243
- **Settings → Machine-local fields** edits explicit `sync.localFields` root field names for global `settings.json` (default none). Excluded values and absence stay local; future portable snapshots omit them. An explicit array requires at least settings version 4 and snapshot version 2; legacy directory scope keeps settings version 7 or later and snapshot version 5; ignore-file setups use settings version 8 and snapshot version 6. Nonempty rules require `settings.json` in `sync.include` only for selected-path setups. All receiving machines must configure compatible rules. Additions/removals require a separately confirmed force-direction migration, even with `--yes`; old remote history is **not erased**. See [settings merge and local fields](./skills/configure-pi-sync/references/configuration.md#settings-field-merge-and-machine-local-fields) for formats, compatibility and recovery.
245
+ **Settings → Machine-local fields** edits explicit `sync.localFields` root field names for global `settings.json` (default none). Excluded values and absence stay local; future portable snapshots omit them. An explicit array requires at least settings version 4 and snapshot version 2; legacy directory scope keeps settings version 7 or later and snapshot version 5; ignore-file setups use settings version 8 and publish snapshot version 7. Nonempty rules require `settings.json` in `sync.include` only for selected-path setups. All receiving machines must configure compatible rules. Additions/removals require a separately confirmed force-direction migration, even with `--yes`; old remote history is **not erased**. See [settings merge and local fields](./skills/configure-pi-sync/references/configuration.md#settings-field-merge-and-machine-local-fields) for formats, compatibility and recovery.
244
246
 
245
- **Settings → Content merge / partial progress** controls independent `sync.mergeContent` and `sync.partialSync` opt-ins, both default **Off**. Saving opts into at least settings version 5; partial publications use snapshot version 3 for selected paths, version 4 with selected-path exclusions, version 5 for legacy directory scope, or version 6 for ignore-file policy. Older readers must refuse unsupported formats. Supported Markdown/plain-text resources merge bounded independent line edits without Git or conflict markers. Diff grids and hunk comparisons share an eight-million-work-unit budget across the operation and its retries; exhausted paths remain conflicts for review. Same-session reconciliation only accepts validated complete byte-prefix extensions; divergent histories and the loaded session require review. A syntactically clean text merge is **not a semantic correctness guarantee**.
247
+ **Settings → Content merge / partial progress** controls independent `sync.mergeContent` and `sync.partialSync` opt-ins, both default **Off**. Saving opts into at least settings version 5; partial publications use snapshot version 3 for selected paths, version 4 with selected-path exclusions, version 5 for legacy directory scope, or version 7 for ignore-file policy. Older readers must refuse unsupported formats. Supported Markdown/plain-text resources merge bounded independent line edits without Git or conflict markers. Diff grids and hunk comparisons share an eight-million-work-unit budget across the operation and its retries; exhausted paths remain conflicts for review. Same-session reconciliation only accepts validated complete byte-prefix extensions; divergent histories and the loaded session require review. A syntactically clean text merge is **not a semantic correctness guarantee**.
246
248
 
247
249
  Partial sync keeps each side's unresolved versions, preserves their previous accepted hashes/ancestors, and advances only independent paths. Resource/collision dependency groups are withheld together, including local-only files, never represented as deletion. The conditional **Review unresolved conflicts** action, or `/sync conflicts`, opens exact private versions on request and resolves one freshly validated whole group. Automatic pushes, non-forced push/pull, and rollback refuse unresolved groups; use group review or an explicit manual push/pull force direction instead. Artifacts remain below the denied state root, with stable conflict identity and at most 32 proven-completed records retained; unresolved or unrecognized evidence is never automatically pruned. Failed attempts release only newly created artifacts whose inode/content ownership and lack of state/journal references are verified. See [content merge and partial recovery](./docs/content-merge-audit.md).
248
250
 
@@ -298,9 +300,9 @@ These routes require ignore-file support in the running daemon. In TUI, eligible
298
300
 
299
301
  An existing valid rule file is reused as-is. After confirmation, the daemon can create a missing default `.syncignore` on Linux, macOS, and Windows without overwriting an existing file. If automatic creation is unavailable on your filesystem, follow the displayed path and starter rules: create a regular UTF-8 file there without replacing an existing file, then reopen the setup or migration review. **Settings → Ignore file** shows the current path and lets you review a switch to another existing file. Edit the file manually; there is no in-app rule save. Edits affect every setup that uses that file. Setup, migration, switching the file, and editing rules do not authorize or trigger a transfer.
300
302
 
301
- The [starter rules](./skills/configure-pi-sync/references/configuration.md#ignore-file-policy) exclude top-level `git/` package checkouts and `/sessions/`, even if you opt into session sync. To sync sessions, both opt in and adjust the rule. Pi credentials, trust, Pi Sync settings and state, and rule files stay local regardless of the rules. Excluded files stay untouched locally, including on rollback. New publications omit excluded paths; retained snapshots and backups are **not erased**.
303
+ The [starter rules](./skills/configure-pi-sync/references/configuration.md#ignore-file-policy) exclude top-level `git/` package checkouts and `/sessions/`, even if you opt into session sync. To sync sessions, both opt in and adjust the rule. Pi credentials, trust, Pi Sync settings and state, and other setups' rule files stay local. New snapshots include the active rule file unless it excludes itself (for example, `/.syncignore`). Included rules and comments become visible to readers of remote history. Exclusion does **not** erase retained snapshots or backups.
302
304
 
303
- Upgrade all peers to compatible Pi Sync clients and daemons before the first version 6 snapshot publication. The remote stores a policy fingerprint, not the filename or rules. Configure matching rules and session opt-in on each device before pulling. For an existing remote with a different policy, review an explicit direction; background sync cannot make that transition. See [Ignore-file policy and recovery](./skills/configure-pi-sync/references/configuration.md#ignore-file-policy) for starter rules, matching, and safe recovery.
305
+ Upgrade all peers before publishing a version 7 snapshot. When policies differ, Push and Pull both require a directional preview and explicit confirmation. Push replaces the remote policy; Pull can replace the local rules only if the snapshot contains rule text. A fingerprint-only or self-excluding snapshot cannot replace or delete the local rule file. Background sync, `--yes`, and `--force` cannot approve a policy overwrite. See [Ignore-file policy and recovery](./skills/configure-pi-sync/references/configuration.md#ignore-file-policy) before adopting or recovering rules.
304
306
 
305
307
  ### Legacy path rules
306
308
 
@@ -325,7 +327,7 @@ Use `/sync` for initial setup, masked credential entry, and operations that requ
325
327
  | `/sync` | Set up storage, manage synced content, and review sync operations or recovery. |
326
328
  | `/sync help` | Show command usage. |
327
329
  | `/sync daemon [status\|handover\|allow-after-exit\|revoke-after-exit]` | Connect to the service or review ownership and unattended permission; no argument connects and shows status. |
328
- | `/sync daemon recover` | Review and stop the current daemon in TUI or RPC without starting a replacement or retrying a transfer. |
330
+ | `/sync daemon recover` | Diagnostic fallback: review and stop the current daemon in TUI or RPC without starting a replacement or retrying a transfer. |
329
331
  | `/sync use <setup>` | Switch the active local sync setup, following its switch policy. |
330
332
  | `/sync init` | Create a local configuration template. |
331
333
  | `/sync config` | Show resolved configuration. |
@@ -393,7 +395,7 @@ S3/R2 publishes `latest.json` and history using ETag `If-Match`, or `If-None-Mat
393
395
 
394
396
  Snapshot recovery is guarded: new journals record before/after images, older journals are retired only when their unchanged preimages are provable, and unrecognized bytes remain untouched for manual review. Current-session targets are never restored during startup. Preserve a blocked transaction and its backup, close Pi, and review the private evidence before restoring selected paths; malformed/unsupported journals are not disposable. Pi may have loaded resources before lifecycle recovery, so reload or restart explicitly after recovery if loaded resources need to match the restored files.
395
397
 
396
- Before pull or rollback, Pi Sync writes a backup under `<agent-dir>/pi-sync/backups/`. It leaves byte-identical regular files in place when their exact paths already match and no structural change is needed. It checks those files again before accepting the transfer.
398
+ Before pull or rollback, Pi Sync writes a backup under `<agent-dir>/pi-sync/backups/`. It leaves byte-identical regular files in place when their exact paths already match and no structural change is needed. It checks those files again before accepting the transfer. See [Restore a local backup](#restore-a-local-backup) for local edits that were never published.
397
399
  Snapshot apply and recovery require canonical agent and session paths. Preflight refuses parent aliases it detects because Pi's file queue uses different keys for existing and missing aliases. Node's path-based writes and deletes cannot prevent another process from replacing a parent directory after a check. Use directories you control, and pause tools that move or replace their directories during sync. Preserve any pending recovery evidence; an unresolved startup recovery barrier still blocks transfers. Old journals recorded under an alias require manual review because their exact root and target paths remain pinned. Changing the agent path alone does not authorize recovery or rewriting those journals.
398
400
  Apply preflights paths and checksums, journals mutations, and restores prior state only when current bytes match verified preimages or planned postimages. Unknown intermediate directory states and newer edits require review rather than a blind rollback. An interruption after replacement is armed can require manual recovery even if installation never ran; a later deletion of installed content is not treated as an unfinished remove.
399
401
  The file queue coordinates one Pi runtime, not separate processes or lock-unaware editors. Hash-based journals cannot distinguish a later write of identical recorded bytes; they do not provide a cross-process compare-and-swap.
@@ -401,6 +403,73 @@ Merged transfers instead retain a private publication/apply/baseline journal and
401
403
 
402
404
  Removing a local setup or connection never deletes remote data.
403
405
 
406
+ ### Recover excluded files from History
407
+
408
+ Use the snapshot reference reported by Push (use its snapshot ID if no separate reference is shown). History rollback follows the current sync rules and does not restore excluded files. To recover one excluded file without changing the sync rules or remote data, run this example with Node.js 22.19.0 or later from a directory where the installed `@narumitw/pi-sync-daemon` package resolves. Use the same sync setup and storage location as the original Push. The example writes only the selected file to a new private temporary directory; Git may also update its private local cache.
409
+
410
+ ```sh
411
+ node --input-type=module - "$HOME/.pi/agent" 'home' 'snapshot-reference' 'sessions/example.jsonl' <<'JS'
412
+ import { createHash } from 'node:crypto';
413
+ import { mkdtemp, realpath, writeFile } from 'node:fs/promises';
414
+ import { tmpdir } from 'node:os';
415
+ import { join } from 'node:path';
416
+ import { configureEngineHost } from '@narumitw/pi-sync-daemon/engine/host';
417
+ import { loadSettingsConfig } from '@narumitw/pi-sync-daemon/engine/settings/config';
418
+ import { withStateDirectoryAccess } from '@narumitw/pi-sync-daemon/engine/state/state-directory';
419
+ import { createSyncBackend } from '@narumitw/pi-sync-daemon/engine/backends/backend-factory';
420
+
421
+ const [agentDir, setup, reference, relative] = process.argv.slice(2);
422
+ const root = await realpath(agentDir);
423
+ configureEngineHost({
424
+ root: () => root,
425
+ mutate: () => { throw new Error('This example only reads the remote snapshot.'); },
426
+ review: async () => false,
427
+ });
428
+ const file = await withStateDirectoryAccess(async () => {
429
+ const backend = await createSyncBackend(await loadSettingsConfig(setup));
430
+ const signal = AbortSignal.timeout(60_000);
431
+ const entry = (await backend.listHistory(signal)).find((item) => item.snapshotRef === reference);
432
+ if (!entry) throw new Error('Snapshot reference not found in History.');
433
+ const snapshot = await backend.readSnapshot(reference, signal);
434
+ const files = snapshot.files.filter((item) => item.path === relative);
435
+ if (snapshot.id !== entry.snapshotId || files.length !== 1) throw new Error('Snapshot or path did not match.');
436
+ return files[0];
437
+ });
438
+ const bytes = Buffer.from(file.contentBase64, 'base64');
439
+ if (createHash('sha256').update(bytes).digest('hex') !== file.sha256) throw new Error('Snapshot checksum mismatch.');
440
+ const output = join(await mkdtemp(join(tmpdir(), 'pi-sync-history-')), 'restored');
441
+ await writeFile(output, bytes, { flag: 'wx', mode: 0o600 });
442
+ console.log(output);
443
+ JS
444
+ ```
445
+
446
+ Compare the recovered file with any current copy. If you need to put it back, close Pi first and copy it to the intended local path. For a logical `sessions/` path, use the original session directory. Do not overwrite a symlink or publish the temporary file. Remove the temporary copy when finished.
447
+
448
+ ### Restore a local backup
449
+
450
+ Use the exact backup path reported by Pull. Close all Pi processes using the affected agent directory. The backup is private and can contain unpushed settings and sessions. Extract the file you want to restore into a private temporary directory before replacing any local file. This example verifies the file's stored checksum and does not contact remote storage:
451
+
452
+ ```sh
453
+ backup='/path/reported/by/pull.json.gz'
454
+ relative='settings.json'
455
+ scratch=$(mktemp -d)
456
+ node --input-type=commonjs - "$backup" "$relative" "$scratch/restored" <<'JS'
457
+ const { createHash } = require('node:crypto');
458
+ const { readFileSync, writeFileSync } = require('node:fs');
459
+ const { gunzipSync } = require('node:zlib');
460
+ const [archive, relative, output] = process.argv.slice(2);
461
+ const snapshot = JSON.parse(gunzipSync(readFileSync(archive), { maxOutputLength: 512 * 1024 * 1024 }));
462
+ const entries = snapshot.files.filter((file) => file.path === relative);
463
+ if (entries.length !== 1) throw new Error('Expected exactly one matching backup path.');
464
+ const bytes = Buffer.from(entries[0].contentBase64, 'base64');
465
+ if (createHash('sha256').update(bytes).digest('hex') !== entries[0].sha256) throw new Error('Backup checksum mismatch.');
466
+ writeFileSync(output, bytes, { flag: 'wx', mode: 0o600 });
467
+ JS
468
+ printf '%s\n' "$scratch/restored"
469
+ ```
470
+
471
+ Compare the extracted file with the current version. Keep any newer changes you need, then copy the verified file back to its original path. For a logical `sessions/` path, use the session directory from before Pull, not necessarily `<agent-dir>/sessions/`. Do not copy over a symlink, publish a local backup, or extract it wholesale over the agent directory. Remove the temporary copy after verifying your restored file.
472
+
404
473
  The operational state root is `<agent-dir>/pi-sync/`.
405
474
  An existing installation continues using `<agent-dir>/.pisync/` and shows migration guidance on startup; it is never moved merely because no sync is active.
406
475
  Close every other Pi process, then run `/sync migrate-state` and confirm the review (or pass `--yes` for an already reviewed RPC workflow).
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  runCancellableOperation,
8
8
  runCancellableTask
9
- } from "./chunk-CKUGCBHP.ts";
9
+ } from "./chunk-AYGMIMCV.ts";
10
10
  import {
11
11
  SyncSetupReviewChangedError,
12
12
  updateSyncSetup
@@ -159,6 +159,10 @@ async function showRemoteSelectionReview(ctx, setupName, signal, factory = creat
159
159
  }
160
160
  async function showSelectionDifference(ctx, initialDecision, origin, runRoute, sessionSignal, factory, options, validateOwner) {
161
161
  const isCurrent = () => isReviewOwnerCurrent(validateOwner);
162
+ const canReviewPull = Boolean(
163
+ runRoute && !options.readOnly && initialDecision.ignorePolicyComparison === "mismatch" && await (await import("./ignore-file-ui-OHFISFVC.ts")).portableIgnoreRulesAvailable(ctx, sessionSignal)
164
+ );
165
+ if (!isCurrent()) return { kind: "stale" };
162
166
  let flowState = { decision: initialDecision, saved: false };
163
167
  let continuationFingerprint;
164
168
  let nextResult;
@@ -186,6 +190,14 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
186
190
  action: "adopt"
187
191
  }
188
192
  ],
193
+ ...canReviewPull ? [
194
+ {
195
+ id: "pull-rules",
196
+ label: "Review pulling the remote rules\u2026",
197
+ description: "Preview overwriting this device's rules and files if the snapshot includes rules.",
198
+ action: "pull-rules"
199
+ }
200
+ ] : [],
189
201
  ...options.readOnly || !canPublishLocalPolicy(state.decision) ? [] : [
190
202
  {
191
203
  id: "keep",
@@ -314,6 +326,30 @@ async function showSelectionDifference(ctx, initialDecision, origin, runRoute, s
314
326
  return { kind: "stay" };
315
327
  }
316
328
  },
329
+ "pull-rules": async ({ state, signal: actionSignal }) => {
330
+ if (!canReviewPull || !runRoute) return { kind: "rejected" };
331
+ const signal = combineSignals(sessionSignal, actionSignal);
332
+ try {
333
+ const latest = await loadConfig(state.decision.setupName);
334
+ if (signal.aborted) return { kind: "close" };
335
+ validateOwner();
336
+ if (syncConfigReviewFingerprint(latest) !== state.decision.configIdentity) {
337
+ refreshRequested = true;
338
+ return { kind: "close" };
339
+ }
340
+ const result = await runCancellableOperation(ctx, "Preparing remote policy preview\u2026", "pull", runRoute, {
341
+ commitAware: true,
342
+ cancelAcrossDialogs: true,
343
+ target: state.decision.setupName,
344
+ signal
345
+ });
346
+ return handleNestedRouteResult(result, "pull");
347
+ } catch (error) {
348
+ if (signal.aborted || !isCurrent()) return { kind: "close" };
349
+ ctx.ui.notify(`Could not prepare the local update: ${errorMessage(error)}`, "error");
350
+ return { kind: "stay" };
351
+ }
352
+ },
317
353
  keep: async ({ state, signal: actionSignal }) => {
318
354
  if (options.readOnly) return { kind: "rejected" };
319
355
  if (!canPublishLocalPolicy(state.decision)) return { kind: "stay" };
@@ -570,7 +606,7 @@ function canPublishLocalPolicy(decision) {
570
606
  }
571
607
  function adoptionUnavailable(decision) {
572
608
  if (decision.ignorePolicyComparison)
573
- return "Ignore files are local. Published metadata cannot reconstruct remote rules.";
609
+ return "A policy comparison does not apply rules. A reviewed Pull can use a snapshot that contains rule text.";
574
610
  if (scopesDiffer(decision))
575
611
  return "Scope differs. Configure a setup with the remote scope to join it; this location is not migrated in place.";
576
612
  if (decision.remoteDirectory?.scope && decision.remoteInclude.includes("sessions") && !decision.localInclude.includes("sessions"))
@@ -732,4 +768,4 @@ function combineSignals(sessionSignal, actionSignal) {
732
768
  export {
733
769
  showRemoteSelectionReview
734
770
  };
735
- //# sourceMappingURL=chunk-TJ7YNITN.ts.map
771
+ //# sourceMappingURL=chunk-5YOLQKNZ.ts.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ui/remote-selection-ui.ts", "../../src/backends/backend-factory.ts", "../../src/sync/remote-snapshot.ts"],
4
+ "sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\nimport { createSyncBackend, type SyncBackendFactory } from \"../backends/backend-factory.js\";\nimport type { RemoteHead, SyncBackend } from \"../backends/sync-backend.js\";\nimport { loadConfig, syncConfigReviewFingerprint, syncSettingsConfigFingerprint } from \"../settings/config.js\";\nimport { SyncSetupReviewChangedError, updateSyncSetup } from \"../settings/settings-management.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { sameSyncExclude } from \"../sync/exclude-policy.js\";\nimport { readSnapshotForHead } from \"../sync/remote-snapshot.js\";\nimport { throwIfAborted } from \"../sync/signals.js\";\nimport { errorMessage } from \"../sync/sync-errors.js\";\nimport { captureMutationOwner } from \"../sync/sync-local.js\";\nimport {\n compareSyncInclude,\n inspectRemoteSelection,\n type RemoteSelectionDecision,\n RemoteSelectionMismatchError,\n type RemoteSelectionState,\n sameSyncInclude,\n syncDirectoryPolicyKey,\n} from \"../sync/sync-policy.js\";\nimport {\n type RunRoute,\n type RunRouteResult,\n runCancellableOperation,\n runCancellableTask,\n} from \"./cancellable-operation.js\";\nimport { setSyncStatus } from \"./sync-status.js\";\nimport { safeTerminalText } from \"./terminal-text.js\";\n\nexport type RemoteSelectionOrigin = \"settings\" | \"sync\" | \"pull\" | \"push\";\n\nexport interface RemoteSelectionReviewOptions {\n decision?: RemoteSelectionDecision;\n origin?: RemoteSelectionOrigin;\n runRoute?: RunRoute;\n readOnly?: boolean;\n cancelLabel?: string;\n /** The explicit mismatch is resolved or superseded; this does not imply file equality. */\n onSelectionResolved?: () => void;\n withStateAccess?: <T>(task: () => Promise<T>) => Promise<T>;\n}\n\nexport type RemoteSelectionReviewResult =\n | { kind: \"back\" }\n | { kind: \"closed\" }\n | { kind: \"done\" }\n | { kind: \"stale\" }\n | { kind: \"route-result\"; result: RunRouteResult; route: \"sync\" | \"pull\" | \"push\" };\n\nexport async function showRemoteSelectionReview(\n ctx: ExtensionContext,\n setupName?: string,\n signal?: AbortSignal,\n factory: SyncBackendFactory = createSyncBackend,\n options: RemoteSelectionReviewOptions = {},\n): Promise<RemoteSelectionReviewResult> {\n const validateOwner = captureMutationOwner(ctx, signal);\n const isCurrent = () => isReviewOwnerCurrent(validateOwner);\n try {\n validateOwner();\n let decision = options.decision;\n if (!decision) {\n const inspection = await runCancellableTask(\n ctx,\n \"Checking remote content list\u2026\",\n (workSignal) => inspectConfiguredRemoteSelection(ctx, setupName, workSignal, factory, validateOwner),\n { signal, isCurrent, cancelledMessage: null },\n );\n if (!isCurrent()) return { kind: \"stale\" };\n if (inspection.kind !== \"completed\") return { kind: inspection.kind === \"cancelled\" ? \"back\" : \"closed\" };\n validateOwner();\n const inspected = inspection.value;\n if (!inspected) return { kind: \"stale\" };\n // A successful fresh read can supersede an old explicit mismatch without\n // changing local settings. This is not user cancellation or proof of file equality.\n if (inspected.kind === \"empty\" || (inspected.kind === \"selection\" && inspected.state.kind !== \"different\")) {\n options.onSelectionResolved?.();\n }\n if (inspected.kind === \"empty\") {\n ctx.ui.notify(\"Remote storage has no snapshot or synced-content list yet.\", \"info\");\n return { kind: \"back\" };\n }\n if (inspected.kind === \"decision\") {\n decision = inspected.decision;\n } else if (inspected.state.kind === \"same\") {\n ctx.ui.notify(\n inspected.state.ignorePolicyComparison === \"match\"\n ? \"Remote ignore-file policy matches this device.\"\n : \"Remote synced content already matches this sync setup.\",\n \"info\",\n );\n return { kind: \"back\" };\n } else if (inspected.state.kind === \"legacy\") {\n if (ctx.mode !== \"tui\") {\n ctx.ui.notify(formatLegacySummary(inspected.config, inspected.state.discovered), \"info\");\n return { kind: \"back\" };\n }\n await showLegacyDiscovery(ctx, inspected.config, inspected.state.discovered, signal);\n return signal?.aborted ? { kind: \"stale\" } : { kind: \"back\" };\n } else {\n decision = decisionFromState(inspected.config, inspected.state);\n }\n }\n\n if (ctx.mode !== \"tui\") {\n ctx.ui.notify(formatRemoteSelectionSummary(decision), \"warning\");\n return { kind: \"back\" };\n }\n\n let currentDecision = decision;\n for (;;) {\n if (signal?.aborted) return { kind: \"stale\" };\n const result = await showSelectionDifference(\n ctx,\n currentDecision,\n options.origin ?? \"settings\",\n options.runRoute,\n signal,\n factory,\n options,\n validateOwner,\n );\n if (result.kind !== \"refresh\") return result;\n const refresh = await runCancellableTask(\n ctx,\n \"Refreshing remote content list\u2026\",\n (workSignal) =>\n runWithOptionalStateAccess(options, () =>\n inspectConfiguredRemoteSelection(ctx, currentDecision.setupName, workSignal, factory, validateOwner),\n ),\n { signal, isCurrent, cancelledMessage: null },\n );\n if (!isCurrent()) return { kind: \"stale\" };\n if (refresh.kind !== \"completed\") return { kind: refresh.kind === \"cancelled\" ? \"back\" : \"closed\" };\n validateOwner();\n const refreshed = refresh.value;\n if (!refreshed) return { kind: \"stale\" };\n if (refreshed.kind === \"empty\") {\n options.onSelectionResolved?.();\n ctx.ui.notify(\"Remote storage no longer has a snapshot or synced-content list.\", \"warning\");\n return { kind: \"back\" };\n }\n if (refreshed.kind === \"decision\") {\n currentDecision = refreshed.decision;\n continue;\n }\n if (refreshed.state.kind !== \"different\") {\n ctx.ui.notify(\n refreshed.state.kind === \"same\"\n ? \"Remote synced content now matches this sync setup.\"\n : \"The refreshed legacy snapshot has no authoritative synced-content list.\",\n \"info\",\n );\n options.onSelectionResolved?.();\n return { kind: \"done\" };\n }\n currentDecision = decisionFromState(refreshed.config, refreshed.state);\n }\n } catch (error) {\n if (!isCurrent()) return { kind: \"stale\" };\n ctx.ui.notify(`Could not review synced content: ${errorMessage(error)}`, \"error\");\n return { kind: \"back\" };\n } finally {\n if (isCurrent()) setSyncStatus(ctx, undefined);\n }\n}\n\ntype DifferenceFlowResult = RemoteSelectionReviewResult | { kind: \"refresh\" };\n\nasync function showSelectionDifference(\n ctx: ExtensionContext,\n initialDecision: RemoteSelectionDecision,\n origin: RemoteSelectionOrigin,\n runRoute: RunRoute | undefined,\n sessionSignal: AbortSignal | undefined,\n factory: SyncBackendFactory,\n options: Pick<RemoteSelectionReviewOptions, \"readOnly\" | \"cancelLabel\" | \"onSelectionResolved\" | \"withStateAccess\">,\n validateOwner: () => void,\n): Promise<DifferenceFlowResult> {\n type Screen = \"choice\" | \"review\" | \"saved\";\n type Action = \"adopt\" | \"keep\" | \"pull-rules\" | \"cancel\" | \"continue\" | \"done\";\n interface FlowState {\n decision: RemoteSelectionDecision;\n saved: boolean;\n }\n const isCurrent = () => isReviewOwnerCurrent(validateOwner);\n const canReviewPull = Boolean(\n runRoute &&\n !options.readOnly &&\n initialDecision.ignorePolicyComparison === \"mismatch\" &&\n (await (await import(\"./ignore-file-ui.js\")).portableIgnoreRulesAvailable(ctx, sessionSignal)),\n );\n if (!isCurrent()) return { kind: \"stale\" };\n let flowState: FlowState = { decision: initialDecision, saved: false };\n let continuationFingerprint: string | undefined;\n let nextResult: RemoteSelectionReviewResult | undefined;\n let refreshRequested = false;\n const route = origin === \"settings\" ? \"sync\" : origin;\n const menu = defineMenu<FlowState, Screen, Action, ExtensionContext>({\n start: \"choice\",\n screens: {\n choice: ({ state }) => ({\n kind: \"actions\",\n title: \"Synced content differs\",\n lines: selectionSummaryLines(state.decision),\n items: [\n {\n id: \"review\",\n label: state.decision.ignorePolicyComparison\n ? \"Review policy difference\"\n : \"Review all paths (recommended)\",\n description: state.decision.ignorePolicyComparison\n ? \"Compare published policy information without adopting rules.\"\n : \"Compare exact remote-only, device-only, and ordered lists.\",\n to: \"review\",\n },\n ...(options.readOnly || adoptionUnavailable(state.decision)\n ? []\n : [\n {\n id: \"adopt\",\n label: \"Use remote content list\",\n description: \"Save the reviewed rules on this device without pulling files.\",\n action: \"adopt\" as const,\n },\n ]),\n ...(canReviewPull\n ? [\n {\n id: \"pull-rules\",\n label: \"Review pulling the remote rules\u2026\",\n description: \"Preview overwriting this device's rules and files if the snapshot includes rules.\",\n action: \"pull-rules\" as const,\n },\n ]\n : []),\n ...(options.readOnly || !canPublishLocalPolicy(state.decision)\n ? []\n : [\n {\n id: \"keep\",\n label: state.decision.ignorePolicyComparison\n ? \"Review publishing this device's policy\u2026\"\n : \"Keep this device's content list and update remote\u2026\",\n description: \"Open the existing exact force-push preview without skipping confirmation.\",\n action: \"keep\" as const,\n },\n ]),\n { id: \"cancel\", label: options.cancelLabel ?? \"Cancel\", action: \"cancel\" },\n ],\n hint: \"back\",\n }),\n review: ({ state }) => ({\n kind: \"review\",\n title: `Review synced content \u00B7 ${safeTerminalText(state.decision.setupName)}`,\n content: formatSelectionDifference(state.decision),\n format: { kind: \"text\" },\n viewportSize: \"adaptive\",\n hint: \"back\",\n }),\n saved: ({ state }) => ({\n kind: \"actions\",\n title: \"Remote content list saved\",\n lines: [\n `Sync setup: ${safeTerminalText(state.decision.setupName)}`,\n \"Only the included-content setting was saved.\",\n \"No files were pulled and sync state was not changed.\",\n ],\n items: [\n ...(runRoute\n ? [\n {\n id: \"continue\",\n label: continueLabel(origin),\n description: \"Start a fresh check and exact preview for this sync setup.\",\n action: \"continue\" as const,\n },\n ]\n : []),\n { id: \"done\", label: \"Done\", action: \"done\" },\n ],\n hint: \"close\",\n }),\n },\n actions: {\n adopt: async ({ state, signal: actionSignal }) => {\n if (options.readOnly) return { kind: \"rejected\" };\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n const adoption = await runCancellableTask(\n ctx,\n \"Checking and saving remote content list\u2026\",\n async (workSignal, _onCommit, onDialog) => {\n const ownedSignal = workSignal ?? signal;\n const currentConfig = await loadConfig(state.decision.setupName);\n ownedSignal.throwIfAborted();\n validateOwner();\n assertLocalSelectionCurrent(currentConfig, state.decision);\n const refusal = adoptionUnavailable(state.decision);\n if (refusal) throw new Error(refusal);\n if (!currentConfig.include.includes(\"sessions\") && state.decision.remoteInclude.includes(\"sessions\")) {\n onDialog?.(true);\n let acknowledged: boolean;\n try {\n acknowledged = await ctx.ui.confirm(\n \"Use a content list that includes session conversations?\",\n \"Session JSONL may contain prompts, tool output, file paths, images, and secrets. This saves the list only; it does not pull files.\",\n { signal: ownedSignal },\n );\n } finally {\n onDialog?.(false);\n }\n ownedSignal.throwIfAborted();\n validateOwner();\n if (!acknowledged) return undefined;\n }\n if (\n !currentConfig.scope &&\n state.decision.remoteExclude !== undefined &&\n currentConfig.exclude === undefined\n ) {\n onDialog?.(true);\n let confirmed: boolean;\n try {\n confirmed = await ctx.ui.confirm(\n \"Adopt excluded paths?\",\n \"This upgrades settings to version 6 / snapshots to version 4. Older clients must refuse them. Both content lists are saved; no files transfer and old history is not erased.\",\n { signal: ownedSignal },\n );\n } finally {\n onDialog?.(false);\n }\n ownedSignal.throwIfAborted();\n validateOwner();\n if (!confirmed) return undefined;\n }\n return runWithOptionalStateAccess(options, async () => {\n const loaded = await loadAdoptionReview(state.decision, ownedSignal, factory, validateOwner);\n ownedSignal.throwIfAborted();\n validateOwner();\n await revalidateAndAdopt(loaded, state.decision, ownedSignal, validateOwner);\n return loaded;\n });\n },\n {\n signal,\n isCurrent,\n cancelAcrossDialogs: true,\n cancelledMessage: \"Remote content-list adoption cancelled.\",\n },\n );\n if (signal.aborted || adoption.kind === \"closed\") return { kind: \"close\" as const };\n if (adoption.kind === \"cancelled\" || !adoption.value) return { kind: \"stay\" as const };\n validateOwner();\n options.onSelectionResolved?.();\n continuationFingerprint = syncSettingsConfigFingerprint({\n ...adoption.value.config,\n include: [...state.decision.remoteInclude],\n exclude: adoptedExclude(state.decision),\n ...(adoption.value.config.scope\n ? { reinclude: [...(state.decision.remoteDirectory?.reinclude ?? [])] }\n : {}),\n });\n flowState = { decision: state.decision, saved: true };\n return { kind: \"to\" as const, screen: \"saved\" as const };\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n if (isStaleReviewError(error)) {\n ctx.ui.notify(`${errorMessage(error)} Refreshing the comparison.`, \"warning\");\n refreshRequested = true;\n return { kind: \"close\" as const };\n }\n ctx.ui.notify(`Could not save the remote content list: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n \"pull-rules\": async ({ state, signal: actionSignal }) => {\n if (!canReviewPull || !runRoute) return { kind: \"rejected\" };\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n const latest = await loadConfig(state.decision.setupName);\n if (signal.aborted) return { kind: \"close\" };\n validateOwner();\n if (syncConfigReviewFingerprint(latest) !== state.decision.configIdentity) {\n refreshRequested = true;\n return { kind: \"close\" };\n }\n const result = await runCancellableOperation(ctx, \"Preparing remote policy preview\u2026\", \"pull\", runRoute, {\n commitAware: true,\n cancelAcrossDialogs: true,\n target: state.decision.setupName,\n signal,\n });\n return handleNestedRouteResult(result, \"pull\");\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" };\n ctx.ui.notify(`Could not prepare the local update: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" };\n }\n },\n keep: async ({ state, signal: actionSignal }) => {\n if (options.readOnly) return { kind: \"rejected\" };\n if (!canPublishLocalPolicy(state.decision)) return { kind: \"stay\" as const };\n if (!runRoute) {\n ctx.ui.notify(\"The reviewed update-remote route is unavailable.\", \"error\");\n return { kind: \"stay\" as const };\n }\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n if (!state.decision.ignorePolicyComparison) {\n const latest = await loadConfig(state.decision.setupName);\n if (signal.aborted) return { kind: \"close\" as const };\n validateOwner();\n assertLocalSelectionCurrent(latest, state.decision);\n }\n const result = await runCancellableOperation(\n ctx,\n \"Preparing this device's push preview\u2026\",\n \"push --force\",\n runRoute,\n {\n commitAware: true,\n cancelledMessage: \"Push preparation cancelled; no remote files were changed.\",\n target: state.decision.setupName,\n signal,\n },\n );\n return handleNestedRouteResult(result, \"push\");\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n if (isStaleReviewError(error)) {\n ctx.ui.notify(`${errorMessage(error)} Refreshing the comparison.`, \"warning\");\n refreshRequested = true;\n return { kind: \"close\" as const };\n }\n ctx.ui.notify(`Could not prepare the remote update: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n continue: async ({ state, signal: actionSignal }) => {\n if (options.readOnly) return { kind: \"rejected\" };\n if (!runRoute || !continuationFingerprint) return { kind: \"stay\" as const };\n const signal = combineSignals(sessionSignal, actionSignal);\n try {\n const latest = await loadConfig(state.decision.setupName);\n if (signal.aborted) return { kind: \"close\" as const };\n validateOwner();\n if (syncSettingsConfigFingerprint(latest) !== continuationFingerprint) {\n throw new StaleRemoteSelectionReviewError(\n `Sync setup \u201C${safeTerminalText(state.decision.setupName)}\u201D changed after the remote content list was saved.`,\n );\n }\n const result = await runCancellableOperation(ctx, continueBusyLabel(origin), route, runRoute, {\n commitAware: true,\n cancelledMessage: continuationCancelledMessage(route),\n target: state.decision.setupName,\n signal,\n });\n return handleNestedRouteResult(result, route);\n } catch (error) {\n if (signal.aborted || !isCurrent()) return { kind: \"close\" as const };\n ctx.ui.notify(`Could not continue: ${errorMessage(error)}`, \"error\");\n return { kind: \"stay\" as const };\n }\n },\n cancel: async () => ({ kind: \"back\" }),\n done: async () => {\n nextResult = { kind: \"done\" };\n return { kind: \"close\" };\n },\n },\n });\n\n function handleNestedRouteResult(\n result: Awaited<ReturnType<typeof runCancellableOperation>>,\n nestedRoute: \"sync\" | \"pull\" | \"push\",\n ) {\n if (result.kind === \"completed\" && result.outcome === \"applied\") {\n options.onSelectionResolved?.();\n }\n if (result.kind === \"closed\") {\n nextResult = { kind: \"closed\" };\n return { kind: \"close\" as const };\n }\n if (\n result.kind === \"cancelled\" ||\n (result.kind === \"completed\" && result.outcome === \"cancelled\") ||\n result.kind === \"failed\"\n ) {\n return { kind: \"stay\" as const };\n }\n nextResult = { kind: \"route-result\", result, route: nestedRoute };\n return { kind: \"close\" as const };\n }\n\n const menuResult = await runMenu(ctx, menu, {\n getState: () => flowState,\n signal: sessionSignal,\n isCurrent,\n onError: (_menuCtx, error) => ctx.ui.notify(errorMessage(error), \"error\"),\n });\n if (!isCurrent() || menuResult.kind === \"stale\") return { kind: \"stale\" };\n if (refreshRequested) return { kind: \"refresh\" };\n if (nextResult) return nextResult;\n if (menuResult.kind === \"closed\") {\n return menuResult.reason === \"back\" ? { kind: \"back\" } : { kind: \"closed\" };\n }\n return { kind: \"closed\" };\n}\n\ninterface AdoptionReview {\n config: AnySyncConfig;\n backend: SyncBackend;\n reviewedHead: RemoteHead;\n}\n\nasync function loadAdoptionReview(\n decision: RemoteSelectionDecision,\n signal: AbortSignal,\n factory: SyncBackendFactory,\n validateOwner: () => void,\n): Promise<AdoptionReview> {\n const config = await loadConfig(decision.setupName);\n throwIfAborted(signal);\n validateOwner();\n assertLocalSelectionCurrent(config, decision);\n const backend = await factory(config);\n throwIfAborted(signal);\n validateOwner();\n const reviewedHead = await backend.readHead(signal);\n throwIfAborted(signal);\n validateOwner();\n if (!reviewedHead) {\n throw new StaleRemoteSelectionReviewError(\"Remote storage changed while the comparison was open.\");\n }\n const snapshot = await readSnapshotForHead(backend, reviewedHead, signal);\n throwIfAborted(signal);\n validateOwner();\n const state = inspectRemoteSelection(config.include, snapshot, config.exclude, config);\n if (\n state.kind !== \"different\" ||\n !sameSyncInclude(state.include, decision.remoteInclude) ||\n !sameSyncExclude(state.exclude, decision.remoteExclude) ||\n !matchesRemoteDirectory(state, decision)\n ) {\n throw new StaleRemoteSelectionReviewError(\"Remote synced content changed while the comparison was open.\");\n }\n return { config, backend, reviewedHead };\n}\n\nasync function revalidateAndAdopt(\n review: AdoptionReview,\n decision: RemoteSelectionDecision,\n signal: AbortSignal,\n validateOwner: () => void,\n) {\n const currentHead = await review.backend.readHead(signal);\n throwIfAborted(signal);\n validateOwner();\n if (!currentHead || !review.backend.sameRevision(review.reviewedHead.revision, currentHead.revision)) {\n throw new StaleRemoteSelectionReviewError(\"Remote storage changed while the comparison was open.\");\n }\n const currentSnapshot = await readSnapshotForHead(review.backend, currentHead, signal);\n throwIfAborted(signal);\n validateOwner();\n const currentState = inspectRemoteSelection(\n review.config.include,\n currentSnapshot,\n review.config.exclude,\n review.config,\n );\n if (\n currentState.kind !== \"different\" ||\n !sameSyncInclude(currentState.include, decision.remoteInclude) ||\n !sameSyncExclude(currentState.exclude, decision.remoteExclude) ||\n !matchesRemoteDirectory(currentState, decision)\n ) {\n throw new StaleRemoteSelectionReviewError(\"Remote synced content changed while the comparison was open.\");\n }\n await updateSyncSetup(\n decision.setupName,\n (setup) => {\n validateOwner();\n const refusal = adoptionUnavailable(decision);\n if (refusal) throw new Error(refusal);\n const exclude = adoptedExclude(decision);\n if (setup.sync.pathPolicy === \"ignore-file\") throw new Error(\"An ignore-file setup cannot adopt remote rules.\");\n if (setup.sync.scope === \"agent-directory\") {\n return {\n ...setup,\n sync: {\n ...setup.sync,\n exclude,\n reinclude: [...(decision.remoteDirectory?.reinclude ?? [])],\n sessions: decision.remoteInclude.includes(\"sessions\"),\n },\n };\n }\n return {\n ...setup,\n sync: { ...setup.sync, include: [...decision.remoteInclude], ...(exclude === undefined ? {} : { exclude }) },\n };\n },\n {\n expectedConfigFingerprint: syncSettingsConfigFingerprint(review.config),\n expectedInclude: decision.localInclude,\n upgradeExclude: adoptedExclude(decision) !== undefined,\n signal,\n },\n );\n}\n\nasync function inspectConfiguredRemoteSelection(\n ctx: ExtensionContext,\n setupName: string | undefined,\n signal: AbortSignal | undefined,\n factory: SyncBackendFactory,\n validateOwner: () => void,\n): Promise<\n | { kind: \"empty\"; config: AnySyncConfig }\n | { kind: \"selection\"; config: AnySyncConfig; state: RemoteSelectionState }\n | { kind: \"decision\"; decision: RemoteSelectionDecision }\n | undefined\n> {\n const config = await loadConfig(setupName);\n if (signal?.aborted) return undefined;\n validateOwner();\n setSyncStatus(ctx, `checking synced content for ${safeTerminalText(config.setupName)}`, { activity: \"checking\" });\n const backend = await factory(config);\n if (signal?.aborted) return undefined;\n validateOwner();\n const head = await backend.readHead(signal);\n if (signal?.aborted) return undefined;\n validateOwner();\n if (!head) return { kind: \"empty\", config };\n try {\n const snapshot = await readSnapshotForHead(backend, head, signal, config);\n if (signal?.aborted) return undefined;\n validateOwner();\n return {\n kind: \"selection\",\n config,\n state: inspectRemoteSelection(config.include, snapshot, config.exclude, config),\n };\n } catch (error) {\n if (signal?.aborted) return undefined;\n validateOwner();\n if (error instanceof RemoteSelectionMismatchError) return { kind: \"decision\", decision: error.decision };\n throw error;\n }\n}\n\nasync function showLegacyDiscovery(\n ctx: ExtensionContext,\n config: AnySyncConfig,\n discovered: string[],\n signal?: AbortSignal,\n) {\n const menu = defineMenu<undefined, \"choice\" | \"review\", \"back\", ExtensionContext>({\n start: \"choice\",\n screens: {\n choice: () => ({\n kind: \"actions\",\n title: `Compare synced content \u00B7 ${safeTerminalText(config.setupName)}`,\n lines: [\n \"This legacy snapshot has no portable synced-content list.\",\n \"Discovered paths are partial and read-only; preserved files may not have been selected.\",\n ],\n items: [\n { id: \"review\", label: \"Review discovered paths\", to: \"review\" },\n { id: \"back\", label: \"Back\", action: \"back\" },\n ],\n hint: \"close\",\n }),\n review: () => ({\n kind: \"review\",\n title: \"Partial discovery from legacy snapshot\",\n content: [\n \"Partial discovery only \u2014 not an authoritative selection.\",\n \"\",\n ...(discovered.length > 0\n ? discovered.map((item) => `Discovered: ${safeTerminalText(item)}`)\n : [\"No safe paths were discovered.\"]),\n \"\",\n \"Use Add custom path\u2026 in the local Included Content editor if needed.\",\n ].join(\"\\n\"),\n format: { kind: \"text\" },\n viewportSize: \"adaptive\",\n hint: \"back\",\n }),\n },\n actions: { back: async () => ({ kind: \"close\" }) },\n });\n await runMenu(ctx, menu, {\n getState: () => undefined,\n signal,\n isCurrent: () => !signal?.aborted,\n });\n}\n\nfunction adoptedExclude(decision: RemoteSelectionDecision) {\n return decision.remoteExclude === undefined\n ? decision.localExclude === undefined\n ? undefined\n : []\n : [...decision.remoteExclude];\n}\n\nfunction scopesDiffer(decision: RemoteSelectionDecision) {\n return decision.localDirectory?.scope !== decision.remoteDirectory?.scope;\n}\n\nfunction canPublishLocalPolicy(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison) {\n return (\n decision.ignorePolicyComparison !== \"match\" && decision.ignorePolicyComparison !== \"local-legacy-remote-ignore\"\n );\n }\n return !scopesDiffer(decision);\n}\n\nfunction adoptionUnavailable(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison)\n return \"A policy comparison does not apply rules. A reviewed Pull can use a snapshot that contains rule text.\";\n if (scopesDiffer(decision))\n return \"Scope differs. Configure a setup with the remote scope to join it; this location is not migrated in place.\";\n if (\n decision.remoteDirectory?.scope &&\n decision.remoteInclude.includes(\"sessions\") &&\n !decision.localInclude.includes(\"sessions\")\n )\n return \"Enable session sync explicitly in Settings before adopting these rules.\";\n}\n\nfunction matchesRemoteDirectory(\n state: Extract<RemoteSelectionState, { kind: \"different\" }>,\n decision: RemoteSelectionDecision,\n) {\n return (\n syncDirectoryPolicyKey(state) ===\n syncDirectoryPolicyKey({\n include: decision.remoteInclude,\n exclude: decision.remoteExclude,\n ...decision.remoteDirectory,\n })\n );\n}\n\nfunction directoryReviewLines(decision: RemoteSelectionDecision) {\n if (!decision.localDirectory?.scope && !decision.remoteDirectory?.scope) return [];\n const unavailable = adoptionUnavailable(decision);\n return [\n `Remote scope: ${decision.remoteDirectory?.scope ? \"Pi agent directory\" : \"selected paths or legacy\"}`,\n `This device scope: ${decision.localDirectory?.scope ? \"Pi agent directory\" : \"selected paths\"}`,\n `Remote re-included paths: ${safeList(decision.remoteDirectory?.reinclude ?? [])}`,\n `This device re-included paths: ${safeList(decision.localDirectory?.reinclude ?? [])}`,\n ...(unavailable ? [unavailable] : []),\n ];\n}\n\nfunction selectionSummaryLines(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison) {\n return [\n `Sync setup: ${safeTerminalText(decision.setupName)}`,\n adoptionUnavailable(decision) ?? \"Nothing changed.\",\n ...(decision.ignorePolicyComparison === \"local-legacy-remote-ignore\"\n ? [\"The remote uses an ignore-file policy; this device uses a legacy policy.\"]\n : decision.ignorePolicyComparison === \"local-ignore-remote-legacy\"\n ? [\"This device uses an ignore-file policy; the remote uses a legacy policy.\"]\n : [\"The ordered rules or session opt-in differ.\"]),\n \"No files or settings have changed.\",\n ];\n }\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n `Sync setup: ${safeTerminalText(decision.setupName)}`,\n \"Nothing changed. Review both lists before choosing what happens next.\",\n ...directoryReviewLines(decision),\n ...excludeReviewLines(decision),\n ...(!decision.localDirectory?.scope &&\n !decision.remoteDirectory?.scope &&\n comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\"Only the ordering differs; membership is the same.\"]\n : [`Remote-only paths: ${comparison.remoteOnly.length} \u00B7 Device-only paths: ${comparison.localOnly.length}`]),\n ];\n}\n\nfunction formatSelectionDifference(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison) return selectionSummaryLines(decision).join(\"\\n\");\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n ...directoryReviewLines(decision),\n ...(!decision.localDirectory?.scope &&\n !decision.remoteDirectory?.scope &&\n comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\"Only ordering differs; both lists contain the same paths.\", \"\"]\n : []),\n \"Remote-only paths:\",\n ...(comparison.remoteOnly.length > 0\n ? comparison.remoteOnly.map((item) => `+ ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"Device-only paths:\",\n ...(comparison.localOnly.length > 0\n ? comparison.localOnly.map((item) => `- ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"Remote ordered list:\",\n ...(decision.remoteInclude.length > 0\n ? decision.remoteInclude.map((item, index) => `${index + 1}. ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n \"This device's ordered list:\",\n ...(decision.localInclude.length > 0\n ? decision.localInclude.map((item, index) => `${index + 1}. ${safeTerminalText(item)}`)\n : [\"(none)\"]),\n \"\",\n ...excludeReviewLines(decision),\n \"Using the remote list saves settings only and does not pull files.\",\n ].join(\"\\n\");\n}\n\nfunction formatRemoteSelectionSummary(decision: RemoteSelectionDecision) {\n if (decision.ignorePolicyComparison) return selectionSummaryLines(decision).join(\"\\n\");\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return [\n `Synced content for \u201C${safeTerminalText(decision.setupName)}\u201D differs from this device.`,\n `Remote-only: ${safeList(comparison.remoteOnly)}`,\n `Device-only: ${safeList(comparison.localOnly)}`,\n ...directoryReviewLines(decision),\n ...(!decision.localDirectory?.scope &&\n !decision.remoteDirectory?.scope &&\n comparison.remoteOnly.length === 0 &&\n comparison.localOnly.length === 0 &&\n sameSyncExclude(decision.localExclude, decision.remoteExclude)\n ? [\n \"Only ordering differs.\",\n `Remote order: ${safeList(decision.remoteInclude)}`,\n `Device order: ${safeList(decision.localInclude)}`,\n ]\n : []),\n ...excludeReviewLines(decision),\n \"Run /sync in TUI to choose a content list; RPC review is read-only.\",\n ].join(\"\\n\");\n}\n\nfunction excludeReviewLines(decision: RemoteSelectionDecision) {\n if (decision.localExclude === undefined && decision.remoteExclude === undefined) return [];\n return [\n `Remote excluded paths: ${safeList(decision.remoteExclude ?? [])}`,\n `This device excluded paths: ${safeList(decision.localExclude ?? [])}`,\n \"Removed exclusions can expose or replace content; old history is not erased.\",\n ];\n}\n\nfunction formatLegacySummary(config: AnySyncConfig, discovered: readonly string[]) {\n return `Remote snapshot for \u201C${safeTerminalText(config.setupName)}\u201D has no portable synced-content list; ${discovered.length} safe path${discovered.length === 1 ? \" was\" : \"s were\"} discovered, but the result is partial and read-only.`;\n}\n\nfunction decisionFromState(\n config: AnySyncConfig,\n state: Extract<RemoteSelectionState, { kind: \"different\" }>,\n): RemoteSelectionDecision {\n return {\n setupName: config.setupName,\n configIdentity: syncConfigReviewFingerprint(config),\n ignorePolicyComparison: state.ignorePolicyComparison,\n localInclude: [...config.include],\n remoteInclude: [...state.include],\n ...(config.exclude === undefined ? {} : { localExclude: [...config.exclude] }),\n ...(state.exclude === undefined ? {} : { remoteExclude: [...state.exclude] }),\n ...(config.scope ? { localDirectory: { scope: config.scope, reinclude: config.reinclude } } : {}),\n ...(state.scope ? { remoteDirectory: { scope: state.scope, reinclude: state.reinclude } } : {}),\n };\n}\n\nfunction assertLocalSelectionCurrent(config: AnySyncConfig, decision: RemoteSelectionDecision) {\n if (\n syncConfigReviewFingerprint(config) === decision.configIdentity &&\n sameSyncInclude(config.include, decision.localInclude) &&\n sameSyncExclude(config.exclude, decision.localExclude) &&\n syncDirectoryPolicyKey(config) ===\n syncDirectoryPolicyKey({\n include: decision.localInclude,\n exclude: decision.localExclude,\n ...decision.localDirectory,\n })\n ) {\n return;\n }\n throw new StaleRemoteSelectionReviewError(\n `Sync setup \u201C${safeTerminalText(config.setupName)}\u201D changed while the comparison was open.`,\n );\n}\n\nfunction continueLabel(origin: RemoteSelectionOrigin) {\n if (origin === \"pull\") return \"Continue Pull now\u2026\";\n if (origin === \"push\") return \"Continue Push now\u2026\";\n return \"Continue Sync now\u2026\";\n}\n\nfunction continueBusyLabel(origin: RemoteSelectionOrigin) {\n if (origin === \"pull\") return \"Checking remote changes\u2026\";\n if (origin === \"push\") return \"Preparing push preview\u2026\";\n return \"Checking current sync setup\u2026\";\n}\n\nfunction continuationCancelledMessage(route: \"sync\" | \"pull\" | \"push\") {\n if (route === \"pull\") return \"Pull check cancelled; no local files were changed.\";\n if (route === \"push\") return \"Push preparation cancelled; no remote files were changed.\";\n return \"Sync check cancelled; no settings or files were changed.\";\n}\n\nfunction safeList(values: readonly string[]) {\n return values.length > 0 ? values.map(safeTerminalText).join(\", \") : \"none\";\n}\n\nclass StaleRemoteSelectionReviewError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"StaleRemoteSelectionReviewError\";\n }\n}\n\nfunction isStaleReviewError(error: unknown) {\n return error instanceof StaleRemoteSelectionReviewError || error instanceof SyncSetupReviewChangedError;\n}\n\nfunction runWithOptionalStateAccess<T>(\n options: Pick<RemoteSelectionReviewOptions, \"withStateAccess\">,\n task: () => Promise<T>,\n) {\n return options.withStateAccess ? options.withStateAccess(task) : task();\n}\n\nfunction isReviewOwnerCurrent(validateOwner: () => void) {\n try {\n validateOwner();\n return true;\n } catch {\n return false;\n }\n}\n\nfunction combineSignals(sessionSignal: AbortSignal | undefined, actionSignal: AbortSignal) {\n return sessionSignal ? AbortSignal.any([sessionSignal, actionSignal]) : actionSignal;\n}\n", "export type * from \"@narumitw/pi-sync-daemon/engine/backends/backend-factory\";\nexport { createSyncBackend } from \"@narumitw/pi-sync-daemon/engine/backends/backend-factory\";\n", "export type * from \"@narumitw/pi-sync-daemon/engine/sync/remote-snapshot\";\nexport {\n formatRemoteSelectionStatus,\n readRemoteSnapshot,\n readSnapshotForHead,\n requireCompatibleRemoteSelection,\n} from \"@narumitw/pi-sync-daemon/engine/sync/remote-snapshot\";\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,YAAY,eAAe;;;ACApC,SAAS,yBAAyB;;;ACAlC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;AF4CP,eAAsB,0BACpB,KACA,WACA,QACA,UAA8B,mBAC9B,UAAwC,CAAC,GACH;AACtC,QAAM,gBAAgB,qBAAqB,KAAK,MAAM;AACtD,QAAM,YAAY,MAAM,qBAAqB,aAAa;AAC1D,MAAI;AACF,kBAAc;AACd,QAAI,WAAW,QAAQ;AACvB,QAAI,CAAC,UAAU;AACb,YAAM,aAAa,MAAM;AAAA,QACvB;AAAA,QACA;AAAA,QACA,CAAC,eAAe,iCAAiC,KAAK,WAAW,YAAY,SAAS,aAAa;AAAA,QACnG,EAAE,QAAQ,WAAW,kBAAkB,KAAK;AAAA,MAC9C;AACA,UAAI,CAAC,UAAU,EAAG,QAAO,EAAE,MAAM,QAAQ;AACzC,UAAI,WAAW,SAAS,YAAa,QAAO,EAAE,MAAM,WAAW,SAAS,cAAc,SAAS,SAAS;AACxG,oBAAc;AACd,YAAM,YAAY,WAAW;AAC7B,UAAI,CAAC,UAAW,QAAO,EAAE,MAAM,QAAQ;AAGvC,UAAI,UAAU,SAAS,WAAY,UAAU,SAAS,eAAe,UAAU,MAAM,SAAS,aAAc;AAC1G,gBAAQ,sBA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,SAAS,CAAC;AAAA,EACnD;AACF;AAEA,SAAS,cAAc,QAA+B;AACpD,MAAI,WAAW,OAAQ,QAAO;AAC9B,MAAI,WAAW,OAAQ,QAAO;AAC9B,SAAO;AACT;AAEA,SAAS,kBAAkB,QAA+B;AACxD,MAAI,WAAW,OAAQ,QAAO;AAC9B,MAAI,WAAW,OAAQ,QAAO;AAC9B,SAAO;AACT;AAEA,SAAS,6BAA6B,OAAiC;AACrE,MAAI,UAAU,OAAQ,QAAO;AAC7B,MAAI,UAAU,OAAQ,QAAO;AAC7B,SAAO;AACT;AAEA,SAAS,SAAS,QAA2B;AAC3C,SAAO,OAAO,SAAS,IAAI,OAAO,IAAI,gBAAgB,EAAE,KAAK,IAAI,IAAI;AACvE;AAEA,IAAM,kCAAN,cAA8C,MAAM;AAAA,EAClD,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAEA,SAAS,mBAAmB,OAAgB;AAC1C,SAAO,iBAAiB,mCAAmC,iBAAiB;AAC9E;AAEA,SAAS,2BACP,SACA,MACA;AACA,SAAO,QAAQ,kBAAkB,QAAQ,gBAAgB,IAAI,IAAI,KAAK;AACxE;AAEA,SAAS,qBAAqB,eAA2B;AACvD,MAAI;AACF,kBAAc;AACd,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,eAAe,eAAwC,cAA2B;AACzF,SAAO,gBAAgB,YAAY,IAAI,CAAC,eAAe,YAAY,CAAC,IAAI;AAC1E;",
6
+ "names": []
7
+ }
@@ -1,5 +1,11 @@
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
+ automaticSyncSummary
5
+ } from "./chunk-ECYCNZOE.ts";
6
+ import {
7
+ ignoreFileSettingsAvailable
8
+ } from "./chunk-Z5JMOXJM.ts";
3
9
  import {
4
10
  effectiveSyncSetupRemoteIdentity,
5
11
  normalizeS3Bucket,
@@ -9,10 +15,6 @@ import {
9
15
  requiredString,
10
16
  validateConfigName
11
17
  } from "./chunk-APZVJAEW.ts";
12
- import {
13
- automaticSyncSummary,
14
- trackOperationDialogs
15
- } from "./chunk-MANNB4WZ.ts";
16
18
  import {
17
19
  configuredSyncSetupNames,
18
20
  readLocalConfigObject
@@ -23,10 +25,7 @@ import {
23
25
  import {
24
26
  AUTOMATIC_SYNC_DESCRIPTION,
25
27
  setSyncSetupCompletions
26
- } from "./chunk-4VKWHVUO.ts";
27
- import {
28
- runCancellableTask
29
- } from "./chunk-CKUGCBHP.ts";
28
+ } from "./chunk-XUZV4OGI.ts";
30
29
  import {
31
30
  acknowledgeSessions,
32
31
  directoryScopeLines,
@@ -44,9 +43,6 @@ import {
44
43
  import {
45
44
  captureMutationOwner
46
45
  } from "./chunk-GELYN4UC.ts";
47
- import {
48
- piDaemonClient
49
- } from "./chunk-RW44KNFD.ts";
50
46
  import {
51
47
  errorMessage
52
48
  } from "./chunk-6YKOHBSC.ts";
@@ -62,82 +58,6 @@ async function refreshTargetCompletions() {
62
58
  setSyncSetupCompletions(await configuredSyncSetupNames());
63
59
  }
64
60
 
65
- // src/ui/ignore-file-ui.ts
66
- import { isKeyRelease, Key, matchesKey } from "@earendil-works/pi-tui";
67
- async function ignoreFileSettingsAvailable(ctx, signal) {
68
- if (signal?.aborted) return false;
69
- try {
70
- const client = piDaemonClient(ctx);
71
- const result = await client.run("ignore.capabilities", {}, signal, ctx);
72
- client.validate();
73
- return !signal?.aborted && result?.available === true;
74
- } catch {
75
- return false;
76
- }
77
- }
78
- async function showIgnoreFileAction(ctx, setup, action, filename, signal, offerToken) {
79
- if (signal.aborted || !ctx.hasUI || ctx.mode !== "tui") return;
80
- const validateOwner = captureMutationOwner(ctx, signal);
81
- const client = piDaemonClient(ctx);
82
- const isCurrent = () => {
83
- try {
84
- validateOwner();
85
- client.validate();
86
- return true;
87
- } catch {
88
- return false;
89
- }
90
- };
91
- try {
92
- let payload = offerToken ? { offerToken } : {};
93
- if (action === "switch") {
94
- const entered = await askIgnoreFilename(ctx, filename, signal);
95
- if (!isCurrent() || !entered || entered === filename) return;
96
- payload = { filename: entered, expectedFilename: filename };
97
- }
98
- if (!isCurrent()) return;
99
- const result = await runCancellableTask(
100
- ctx,
101
- action === "migrate" ? "Preparing ignore-file migration review\u2026" : "Checking the selected ignore file for review\u2026",
102
- (workSignal, onCommit, onDialog) => client.run(
103
- `ignore.${action}`,
104
- { setup, ...payload },
105
- workSignal,
106
- trackOperationDialogs(ctx, onDialog),
107
- onCommit
108
- ),
109
- { signal, isCurrent, cancelledMessage: null, commitAware: true, cancelAcrossDialogs: true }
110
- );
111
- if (isCurrent() && result.kind === "completed" && result.value === "saved") {
112
- ctx.ui.notify(
113
- action === "migrate" ? "Ignore-file policy saved locally. No transfer started." : "Ignore file selected. No transfer started.",
114
- "info"
115
- );
116
- }
117
- } catch (error) {
118
- if (isCurrent())
119
- ctx.ui.notify(`Pi Sync: ${safeTerminalText(error instanceof Error ? error.message : String(error))}`, "error");
120
- }
121
- }
122
- async function askIgnoreFilename(ctx, filename, signal) {
123
- const cancel = new AbortController();
124
- const stop = ctx.ui.onTerminalInput((data) => {
125
- if (!isKeyRelease(data) && matchesKey(data, Key.ctrl("c"))) {
126
- cancel.abort();
127
- return { consume: true };
128
- }
129
- });
130
- const inputSignal = AbortSignal.any([signal, cancel.signal]);
131
- try {
132
- const entered = await ctx.ui.input(`Existing ignore filename (current: ${safeTerminalText(filename)})`, void 0, {
133
- signal: inputSignal
134
- });
135
- return inputSignal.aborted ? void 0 : entered;
136
- } finally {
137
- stop();
138
- }
139
- }
140
-
141
61
  // src/backends/git/git-config.ts
142
62
  import {
143
63
  normalizeGitBranch,
@@ -398,7 +318,7 @@ async function finishSetup(ctx, name, message, join, signal) {
398
318
  if (signal?.aborted) return;
399
319
  ctx.ui.notify(message, "info");
400
320
  if (!join) return;
401
- const { showRemoteSelectionReview } = await import("./remote-selection-ui-N4NMWFT2.ts");
321
+ const { showRemoteSelectionReview } = await import("./remote-selection-ui-E4XZCQ7A.ts");
402
322
  if (signal?.aborted) return;
403
323
  await showRemoteSelectionReview(ctx, name, signal, void 0, {
404
324
  origin: "settings",
@@ -672,7 +592,7 @@ async function promptGitDestination(ctx, signal, current = {}) {
672
592
  }
673
593
 
674
594
  // src/ui/secret-input.ts
675
- import { isKeyRelease as isKeyRelease2, Key as Key2, matchesKey as matchesKey2 } from "@earendil-works/pi-tui";
595
+ import { isKeyRelease, Key, matchesKey } from "@earendil-works/pi-tui";
676
596
  import { runSecretInput } from "@narumitw/pi-tui-kit";
677
597
  async function promptSecret(ctx, title, options = { required: true }) {
678
598
  if (ctx.mode !== "tui" || options.signal?.aborted) return void 0;
@@ -682,7 +602,7 @@ async function promptSecret(ctx, title, options = { required: true }) {
682
602
  const component = await factory(...args);
683
603
  const handleInput = component.handleInput?.bind(component);
684
604
  component.handleInput = (data) => {
685
- if (!isKeyRelease2(data) && matchesKey2(data, Key2.ctrl("c"))) cancel.abort();
605
+ if (!isKeyRelease(data) && matchesKey(data, Key.ctrl("c"))) cancel.abort();
686
606
  else handleInput?.(data);
687
607
  };
688
608
  return component;
@@ -1131,8 +1051,6 @@ export {
1131
1051
  refreshTargetCompletions,
1132
1052
  requiredInput,
1133
1053
  requiredValueInput,
1134
- ignoreFileSettingsAvailable,
1135
- showIgnoreFileAction,
1136
1054
  promptResourceName,
1137
1055
  showGitSetup,
1138
1056
  showAddGitStorageProfile,
@@ -1151,4 +1069,4 @@ export {
1151
1069
  showAddWebDavStorageProfile,
1152
1070
  showEditWebDavStorageProfile
1153
1071
  };
1154
- //# sourceMappingURL=chunk-NDEZ52SS.ts.map
1072
+ //# sourceMappingURL=chunk-ASU3GZPW.ts.map