@narumitw/pi-sync 0.68.0 → 0.69.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 (95) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +35 -21
  3. package/dist/chunks/{chunk-AYGMIMCV.ts → chunk-4KGDPLQ4.ts} +2 -2
  4. package/dist/chunks/chunk-4KGDPLQ4.ts.map +7 -0
  5. package/dist/chunks/{chunk-FR6A7ASZ.ts → chunk-EG6BUOUQ.ts} +3 -3
  6. package/dist/chunks/{chunk-YV2R5SJU.ts → chunk-EI2J5Z4Q.ts} +17 -8
  7. package/dist/chunks/chunk-EI2J5Z4Q.ts.map +7 -0
  8. package/dist/chunks/{chunk-BCDBT4X3.ts → chunk-GXB74FYB.ts} +4 -4
  9. package/dist/chunks/{chunk-J52GYZO6.ts → chunk-LNZRNXNQ.ts} +2 -4
  10. package/dist/chunks/{chunk-FQKWGVMA.ts → chunk-OWSKD5XG.ts} +10 -7
  11. package/dist/chunks/chunk-OWSKD5XG.ts.map +7 -0
  12. package/dist/chunks/{chunk-WCGLU526.ts → chunk-RXZVLBPU.ts} +3 -3
  13. package/dist/chunks/{chunk-KAIVTJIQ.ts → chunk-RZB2DPVU.ts} +2 -2
  14. package/dist/chunks/{chunk-335XTMMZ.ts → chunk-VQTYTUBU.ts} +24 -26
  15. package/dist/chunks/chunk-VQTYTUBU.ts.map +7 -0
  16. package/dist/chunks/{chunk-TLYT6HVI.ts → chunk-YX6DCQ7P.ts} +2 -2
  17. package/dist/chunks/{command-handler-S6BRZMPW.ts → command-handler-ZR26OSBX.ts} +39 -143
  18. package/dist/chunks/command-handler-ZR26OSBX.ts.map +7 -0
  19. package/dist/chunks/{conflict-review-3XMYDJIK.ts → conflict-review-W5BCZIZG.ts} +2 -2
  20. package/dist/chunks/{file-selection-4BOQBXS7.ts → file-selection-STCIRKF6.ts} +3 -3
  21. package/dist/chunks/{manager-result-dispatcher-A4IWLS4J.ts → manager-result-dispatcher-MPLPDR2P.ts} +5 -5
  22. package/dist/chunks/{manager-ui-KHMCSLLV.ts → manager-ui-OMZOBGYT.ts} +99 -96
  23. package/dist/chunks/manager-ui-OMZOBGYT.ts.map +7 -0
  24. package/dist/chunks/{merge-review-LWMUE5IW.ts → merge-review-KTIQBRLL.ts} +2 -2
  25. package/dist/chunks/{remote-selection-ui-F6NJBQ3Y.ts → remote-selection-ui-CCHMCAHQ.ts} +4 -4
  26. package/dist/chunks/{setup-switch-7LMIRMZ7.ts → setup-switch-J3YLBB6N.ts} +4 -4
  27. package/dist/chunks/{setup-wizard-2NRPR433.ts → setup-wizard-J3YOR7BR.ts} +3 -4
  28. package/dist/chunks/{setup-wizard-2NRPR433.ts.map → setup-wizard-J3YOR7BR.ts.map} +1 -1
  29. package/dist/chunks/{sync-inspection-QGM54YCM.ts → sync-inspection-7OADBR57.ts} +3 -3
  30. package/dist/chunks/{sync-operations-DTQMKVRQ.ts → sync-operations-3K6WLPXY.ts} +2 -10
  31. package/dist/chunks/{sync-operations-DTQMKVRQ.ts.map → sync-operations-3K6WLPXY.ts.map} +2 -2
  32. package/dist/daemon/dist/build-id.json +1 -1
  33. package/dist/daemon/dist/engine/backends/git/git-backend.js +1 -1
  34. package/dist/daemon/dist/engine/backends/s3/s3-backend.js +2 -2
  35. package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +67 -6
  36. package/dist/daemon/dist/engine/debug-check.js +59 -0
  37. package/dist/daemon/dist/engine/debug-log.js +100 -1
  38. package/dist/daemon/dist/engine/sync/directional-conflict.js +31 -0
  39. package/dist/daemon/dist/engine/sync/push-review.js +1 -1
  40. package/dist/daemon/dist/engine/sync/sync-error-guidance.js +6 -5
  41. package/dist/daemon/dist/engine/sync/sync-inspection.js +5 -1
  42. package/dist/daemon/dist/engine/sync/sync-mutations.js +40 -7
  43. package/dist/daemon/dist/engine/sync/sync-queries.js +179 -82
  44. package/dist/daemon/dist/engine/sync/sync-state.js +1 -1
  45. package/dist/daemon/dist/engine/ui/sync-format.js +1 -1
  46. package/dist/daemon/dist/engine/ui/transfer-review.js +2 -3
  47. package/dist/daemon/dist/engine-service.js +100 -25
  48. package/dist/daemon/dist/foreground-transfer.js +10 -0
  49. package/dist/daemon/dist/index.js +1 -0
  50. package/dist/daemon/dist/server.js +2 -1
  51. package/dist/daemon/dist/service-host.js +1 -1
  52. package/dist/daemon/package.json +1 -1
  53. package/dist/index.ts +111 -10
  54. package/dist/index.ts.map +3 -3
  55. package/docs/daemon-migration.md +2 -2
  56. package/docs/tui-contract.md +7 -7
  57. package/package.json +7 -4
  58. package/skills/configure-pi-sync/SKILL.md +4 -7
  59. package/skills/configure-pi-sync/references/configuration.md +20 -19
  60. package/src/commands/command-execution.ts +36 -136
  61. package/src/commands/command-handler.ts +3 -3
  62. package/src/commands/command.ts +28 -26
  63. package/src/daemon/directional-recovery.ts +3 -1
  64. package/src/daemon/pi-client.ts +14 -2
  65. package/src/sync/debug-tool.ts +96 -0
  66. package/src/sync/startup-check.ts +1 -1
  67. package/src/sync/sync-operations.ts +0 -6
  68. package/src/sync-extension.ts +13 -1
  69. package/src/ui/cancellable-operation.ts +11 -4
  70. package/src/ui/manager-state.ts +13 -12
  71. package/src/ui/manager-ui.ts +96 -81
  72. package/src/ui/operation-dialogs.ts +1 -1
  73. package/src/ui/settings-ui.ts +2 -3
  74. package/src/ui/setup/webdav-ui.ts +1 -1
  75. package/dist/chunks/chunk-335XTMMZ.ts.map +0 -7
  76. package/dist/chunks/chunk-AYGMIMCV.ts.map +0 -7
  77. package/dist/chunks/chunk-ECYCNZOE.ts +0 -12
  78. package/dist/chunks/chunk-ECYCNZOE.ts.map +0 -7
  79. package/dist/chunks/chunk-FQKWGVMA.ts.map +0 -7
  80. package/dist/chunks/chunk-YV2R5SJU.ts.map +0 -7
  81. package/dist/chunks/command-handler-S6BRZMPW.ts.map +0 -7
  82. package/dist/chunks/manager-ui-KHMCSLLV.ts.map +0 -7
  83. /package/dist/chunks/{chunk-FR6A7ASZ.ts.map → chunk-EG6BUOUQ.ts.map} +0 -0
  84. /package/dist/chunks/{chunk-BCDBT4X3.ts.map → chunk-GXB74FYB.ts.map} +0 -0
  85. /package/dist/chunks/{chunk-J52GYZO6.ts.map → chunk-LNZRNXNQ.ts.map} +0 -0
  86. /package/dist/chunks/{chunk-WCGLU526.ts.map → chunk-RXZVLBPU.ts.map} +0 -0
  87. /package/dist/chunks/{chunk-KAIVTJIQ.ts.map → chunk-RZB2DPVU.ts.map} +0 -0
  88. /package/dist/chunks/{chunk-TLYT6HVI.ts.map → chunk-YX6DCQ7P.ts.map} +0 -0
  89. /package/dist/chunks/{conflict-review-3XMYDJIK.ts.map → conflict-review-W5BCZIZG.ts.map} +0 -0
  90. /package/dist/chunks/{file-selection-4BOQBXS7.ts.map → file-selection-STCIRKF6.ts.map} +0 -0
  91. /package/dist/chunks/{manager-result-dispatcher-A4IWLS4J.ts.map → manager-result-dispatcher-MPLPDR2P.ts.map} +0 -0
  92. /package/dist/chunks/{merge-review-LWMUE5IW.ts.map → merge-review-KTIQBRLL.ts.map} +0 -0
  93. /package/dist/chunks/{remote-selection-ui-F6NJBQ3Y.ts.map → remote-selection-ui-CCHMCAHQ.ts.map} +0 -0
  94. /package/dist/chunks/{setup-switch-7LMIRMZ7.ts.map → setup-switch-J3YLBB6N.ts.map} +0 -0
  95. /package/dist/chunks/{sync-inspection-QGM54YCM.ts.map → sync-inspection-7OADBR57.ts.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @narumitw/pi-sync
2
2
 
3
+ ## 0.69.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 267dc10: **Breaking change:** Remove `/sync status`, `/sync doctor`, `/sync config`, and the Check remote status and Diagnostics menu actions. Review sync setups and storage connections in **/sync → Settings** instead of `/sync config`. Use `/sync diff` for an immediate file comparison without Debug mode, or enable Debug mode and reload Pi for the `pi_sync_debug` tool. The model can call the tool directly or through codemode. It reads recent sanitized results from `pi-sync.log` or rechecks the current setup's remote storage without a confirmation prompt. `/sync daemon status` is unchanged.
8
+
9
+ Log structured check outcomes for startup checks and read-only rechecks. Keep WebDAV history repair as a separate, confirmed action under History when the active snapshot is missing. The daemon keeps the existing status and doctor operations for compatible clients. The main menu shows the six standard actions without a search field; Settings remains searchable.
10
+
11
+ ### Patch Changes
12
+
13
+ - e15e231: Fix visible terminal control codes in the `/sync` menu. Show the last applied snapshot as an ID rather than a partial timestamp, and shorten only long IDs.
14
+ - a160ea3: Protect local changes on Pull and remote changes on Push in the Pi Sync menu. Offer an exact Force review only for a content conflict detected before writing. Preserve History for Push and verify a local backup before Pull.
15
+ - Updated dependencies [1d22c5f]
16
+ - @narumitw/pi-tui-kit@0.72.0
17
+
18
+ ## 0.68.1
19
+
20
+ ### Patch Changes
21
+
22
+ - 4148b42: Make Diagnostics and Check remote status easier to scan. Keep report line breaks in TUI and RPC, put comparison results and diagnostic warnings first, and group storage and content details separately.
23
+
3
24
  ## 0.68.0
4
25
 
5
26
  ### Minor Changes
package/README.md CHANGED
@@ -75,27 +75,31 @@ WebDAV and R2/S3 store `latest.json`, `history.json`, and `snapshots/` directly
75
75
 
76
76
  ## 🧭 Manager, conflicts, and recovery
77
77
 
78
- The `/sync` manager opens a searchable action palette in TUI mode, with up to five visible choices and help for only the selected action. The heading identifies the active setup without relying on the summary, which can be hidden in a short terminal. The summary uses local state without contacting remote storage and shows the configured storage path:
78
+ The `/sync` manager opens an action list in TUI mode, with up to six visible choices and help for only the selected action. The heading identifies the active setup without relying on the summary, which can be hidden in a short terminal. The summary uses local state without contacting remote storage and shows the configured storage path:
79
79
 
80
80
  ```text
81
81
  Manage sync · home
82
82
  Storage: Cloudflare R2 · r2 · personal-pi · pi-sync/home
83
83
  Remote status: Not checked
84
- Last applied: Never synced
84
+ Last applied snapshot: 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. 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.
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 daemon handover, choosing either action transfers without another confirmation if it will not discard a destination change since the last accepted sync. This includes protecting local edits when only this device changed. Use **View differences** first if you want to review all changes, including additions and deletions. If the destination has conflicting content but no accepted baseline, use **Sync…** for first-sync review.
88
88
 
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.
89
+ If a transfer stops before writing because it would discard a destination change, choose **Review Force push…** or **Review Force pull…**. Review the exact changes before confirming; cancellation is the default. A stale preview cannot authorize a write, and unrelated errors do not offer Force. Push preserves the previous remote version in **History**; Pull creates a local backup before applying changes. See [Recover excluded files from History](#recover-excluded-files-from-history) for files the current rules no longer select.
90
90
 
91
- 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.
91
+ Selecting a direction does not authorize background transfers or model use. If a file-queue release cannot be confirmed, Pi Sync [recovers the original job when it can](./docs/daemon-migration.md#recover-from-uncertain-daemon-cleanup). It never repeats a known commit, guesses when the write outcome is unknown, or reuses a Force approval for another attempt. For a pending journal from the retired ignore-file policy, follow the [manual recovery guide](./skills/configure-pi-sync/references/configuration.md#retired-ignore-file-policy).
92
+
93
+ Use the navigation keys to select an action or scroll when more actions are available. **Settings** and **History** are directly available. Switching appears only when multiple valid setups exist; review and access-recovery actions appear when needed.
94
+
95
+ 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 **View differences** (`/sync diff`) for a manual read of current file differences, even with Debug mode off. It does not compare changes against the last sync. **Last applied snapshot** shows an ID, not the time it was applied. Long IDs are shortened in the menu; **History** shows the full ID.
92
96
 
93
97
  After Pi Sync detects an included-content mismatch, the manager shows **Sync status: Review needed** and puts **Review synced content (recommended)** first.
94
98
  **Sync now** remains unavailable until you review the mismatch.
95
99
  Opening the manager does not make another remote request.
96
100
  **Settings** opens **Pi Sync Settings** directly as one searchable list. It shows the content-policy controls for the current setup. Compare the remote path policy separately from file contents. **Storage location** edits only the current setup's bucket, branch, or path; it does not change the connection or included content. **Manage sync setups** and **Manage storage connections** open the existing catalogs. Connections hold reusable server addresses and sign-in details, and edits show every affected setup. Make another setup current before changing its preferences. Each description identifies the setup, device-wide, or shared-connection scope. Simple preferences report saving and durable save results; Back does not undo saved changes. Complex editors and risky changes retain their reviews. RPC reports the manual settings path and preserves catalog management without opening the TUI preference editor.
97
101
 
98
- **Diagnostics** asks for confirmation before checking configuration and storage. `/sync doctor` remains the direct route. S3/R2 performs a read-only request: success does not prove write access or snapshot validity, and an ambiguous 404 does not prove a bucket is missing. Check the indicated credentials, address, bucket, or path before retrying. Git checks remote reads and the local cache, not write access. WebDAV uses an isolated write/cleanup probe and repairs the active snapshot's history entry if missing. **History** opens the snapshot list directly for reviewed rollback. Recorded unresolved groups have a separate **Review unresolved conflicts** action.
102
+ **History** shows snapshots for reviewed rollback and offers [WebDAV history repair](#-backend-and-recovery-model) when the active snapshot is missing from the list. Use **Review unresolved conflicts** for recorded unresolved groups.
99
103
 
100
104
  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.
101
105
  Specialized operation and masked-credential prompts show the effective cancellation bindings and keep Ctrl+C as a hard-cancel input when Back is remapped.
@@ -183,9 +187,9 @@ Legacy directory scope selects all eligible files, applies `exclude`, then resto
183
187
 
184
188
  ### Debug mode
185
189
 
186
- Turn on **/sync → Settings → Debug mode**, or set the top-level `"debug": true` in `pi-sync.json`. The default is **Off**. Use `/reload` or start a new Pi session for the client change. The daemon uses the agent directory's setting at its next owner or job boundary without a restart.
190
+ Turn on **/sync → Settings → Debug mode**, or set the top-level `"debug": true` in `pi-sync.json`. The default is **Off**. Use `/reload` or start a new Pi session for the client change. The daemon uses the agent directory's setting at its next owner or job boundary without a restart. In TUI and RPC, Debug mode also lets the model [recheck remote storage without a confirmation prompt](#-tools).
187
191
 
188
- Both processes append startup timings and selected sync outcomes to the private, local-only `<getAgentDir()>/pi-sync.log` (normally `~/.pi/agent/pi-sync.log`). It uses one JSON record per line; filter by `source` (`pi-sync` or `pi-sync-daemon`). Records omit raw errors, credentials, file contents, and model data. Turning Debug mode Off does not remove the file, and nothing rotates it automatically.
192
+ Both processes append startup timings and selected check and transfer outcomes to the private, local-only `<getAgentDir()>/pi-sync.log` (normally `~/.pi/agent/pi-sync.log`). It uses one JSON record per line; filter by `source` (`pi-sync` or `pi-sync-daemon`). Records omit raw errors, credentials, file contents, and model data. Turning Debug mode Off does not remove the file, and nothing rotates it automatically.
189
193
 
190
194
  Timing reports still appear in the TUI transcript or as RPC notifications without entering model context. The Pi client does not write debug records in print or JSON mode. The daemon's separate operational `lifecycle.log` is unchanged. See the [Debug mode reference](./skills/configure-pi-sync/references/configuration.md#debug-mode) for safe cleanup, older snapshots, and timing details.
191
195
 
@@ -193,7 +197,7 @@ Timing reports still appear in the TUI transcript or as RPC notifications withou
193
197
 
194
198
  Startup loads command and transfer implementations only when needed. When no transaction directory is pending, a local directory check skips loading the file-recovery implementation. Pending transactions still complete recovery before Pi accepts user edits; this safety barrier is not deferred.
195
199
 
196
- With **Automatic sync** enabled, session startup schedules a background check instead of waiting for a transfer. Pi remains usable while Git, WebDAV, R2, or S3 checks local hashes and remote metadata. Results follow the [status and review classifications](#resolve-conflicts-in-the-manager); check failures provide `/sync` guidance without opening a dialog. Use **Sync now** to start a reviewed transfer, or `/sync status` to retry a check. Foreground `/sync` cancels and drains the background check before starting.
200
+ With **Automatic sync** enabled, session startup schedules a background check instead of waiting for a transfer. Pi remains usable while Git, WebDAV, R2, or S3 checks local hashes and remote metadata. Results follow the [status and review classifications](#resolve-conflicts-in-the-manager); check failures provide `/sync` guidance without opening a dialog. Use **Sync now** for a reviewed transfer, **View differences** for a manual read, or ask Pi to [recheck in Debug mode](#-tools). Foreground `/sync` cancels and drains the background check before starting.
197
201
 
198
202
  Checks run once per session start, including `/reload`, new, resumed, and forked sessions, in TUI and RPC only. Print/JSON skip startup checks. This one-shot policy has no polling or automatic retry loop. The overall deadline is 30 seconds, followed by underlying cleanup where needed; Git process termination and temporary-ref cleanup can take additional time. Git checks can still fetch objects and update the extension's private bare cache, but never push, apply managed files, update the sync baseline, or reload Pi.
199
203
 
@@ -236,7 +240,7 @@ Partial sync keeps each side's unresolved versions, preserves their previous acc
236
240
  With a footer that supports the [public semantic status protocol](https://github.com/narumiruna/pi-extensions/blob/main/packages/pi-statusline/docs/extension-status-protocol.md), normal standby—including another local monitoring owner—is hidden. Pi Statusline shows short static markers for checking, transfers, model resolution, and review, while retry/blocked states keep short reasons. Configured icons remain effective. Native Pi footers, RPC observers, and older or absent consumers retain the existing readable raw status; Sync needs no other extension to operate. See [Status display](./skills/configure-pi-sync/references/configuration.md#status-display) for reason labels and unchanged recovery behavior.
237
241
 
238
242
  **Settings → Skip secret scan** defaults to **Off**; enable it only after reviewing the destination and selected content because it disables push scanning for every setup.
239
- See [Secret scanning](./skills/configure-pi-sync/references/configuration.md#secret-scanning) for the setting and diagnostic behavior.
243
+ See [Secret scanning](./skills/configure-pi-sync/references/configuration.md#secret-scanning) for the setting and its risks.
240
244
 
241
245
  A minimal Git setup uses an existing private remote and keeps automatic sync off:
242
246
 
@@ -297,7 +301,7 @@ A save applies to subsequent transfer attempts. It neither starts a transfer nor
297
301
 
298
302
  ### Scan limits
299
303
 
300
- If the agent-directory scan exceeds 64 MiB, open **Settings → Agent directory scope** to exclude large files or folders you do not need to sync. Reopen the transfer review. Storage diagnostics do not change the local scan limit.
304
+ If the agent-directory scan exceeds 64 MiB, open **Settings → Agent directory scope** to exclude large files or folders you do not need to sync. Reopen the transfer review. A remote read does not change the local scan limit.
301
305
 
302
306
  Read the [settings reference](./skills/configure-pi-sync/references/configuration.md) for complete S3/R2, Git, and WebDAV examples, backend fields, content policy, legacy paths, and recovery steps.
303
307
 
@@ -307,7 +311,7 @@ Pi can automatically load the [configuration skill](./skills/configure-pi-sync/S
307
311
 
308
312
  The skill applies authorized edits to `pi-sync.json` through the running local daemon for routine preferences. Loading the skill does not authorize edits.
309
313
 
310
- Use `/sync` for initial setup, masked credential entry, and operations that require a separate review. The skill does not run backend diagnostics, check remote connectivity, or start transfers. See the [settings reference](./skills/configure-pi-sync/references/configuration.md) for manual configuration and troubleshooting.
314
+ Use `/sync` for initial setup, masked credential entry, and operations that require a separate review. The skill uses summarized local evidence for troubleshooting. It does not start transfers or run backend commands. See the [settings reference](./skills/configure-pi-sync/references/configuration.md) for manual configuration and troubleshooting.
311
315
 
312
316
  ## 💬 Commands
313
317
 
@@ -319,16 +323,13 @@ Use `/sync` for initial setup, masked credential entry, and operations that requ
319
323
  | `/sync daemon recover` | Diagnostic fallback: review and stop the current daemon in TUI or RPC without starting a replacement or retrying a transfer. |
320
324
  | `/sync use <setup>` | Switch the active local sync setup, following its switch policy. |
321
325
  | `/sync init` | Create a local configuration template. |
322
- | `/sync config` | Show resolved configuration. |
323
326
  | `/sync files` | Open the current setup’s path selection or agent-directory rules in TUI. |
324
- | `/sync status` | Compare local and remote snapshot state. |
325
- | `/sync diff` | Show local and remote differences. |
327
+ | `/sync diff` | Read current local and remote file differences without transferring files. |
326
328
  | `/sync conflicts` | Review private unresolved dependency groups and choose local or remote group versions after fresh validation. |
327
- | `/sync doctor` | Check configuration, connectivity, and backend safety. |
328
329
  | `/sync push` | Publish local content to remote storage. |
329
330
  | `/sync pull` | Back up local content, then apply the remote snapshot. |
330
331
  | `/sync sync` | Review and merge changes without model assistance; initial source and policy changes retain separate reviews. |
331
- | `/sync history` | Browse remote snapshots and review a rollback. |
332
+ | `/sync history` | Browse remote snapshots, review a rollback in TUI, or confirm WebDAV history repair when offered. |
332
333
  | `/sync rollback <snapshot-id>` | Back up local content, apply a historical snapshot, and republish it remotely. |
333
334
  | `/sync migrate-state` | Migrate the legacy local state directory. |
334
335
  | `/sync unlock --stale` | Recover an abandoned local lock after guarded ownership checks. |
@@ -353,7 +354,7 @@ All routes support TUI and RPC; RPC settings and included-content screens are re
353
354
  Print and JSON modes reject `/sync`.
354
355
  Unknown commands or flags, trailing values, and missing setup/snapshot values are rejected, including the former version 2 setup-addressing flag.
355
356
 
356
- - `--setup <name>` targets a setup without switching it on `config`, `files`, `status`, `diff`, `conflicts`, `doctor`, `push`, `pull`, `sync`, `history`, and `rollback`.
357
+ - `--setup <name>` targets a setup without switching it on `files`, `diff`, `conflicts`, `push`, `pull`, `sync`, `history`, and `rollback`.
357
358
  - `--yes` (alias: `-y`) skips confirmation on `push`, `pull`, `sync`, `rollback`, and `migrate-state`; use only after reviewing the affected content.
358
359
  - `--force` lets `push` or `pull` accept content conflicts without disabling backend concurrency protection. It is also accepted by `sync`, which still requires a direction choice for divergent content, and by `rollback` for compatibility. For legacy path policies, explicit forced directions can also resolve an interrupted merge after a fresh review, archiving its old journal instead of restoring old bytes.
359
360
  - `--stale` is accepted only by `unlock` and is required to remove a stale lock.
@@ -361,6 +362,19 @@ Unknown commands or flags, trailing values, and missing setup/snapshot values ar
361
362
  Push and rollback publish data externally; pull and rollback can replace or delete local managed files.
362
363
  Review [Settings](#-settings) for included-content privacy and [Manager, conflicts, and recovery](#-manager-conflicts-and-recovery) before forcing a direction, skipping confirmation, or removing a lock.
363
364
 
365
+ ### Migrating from the retired check commands
366
+
367
+ **Breaking change:** `/sync status`, `/sync doctor`, `/sync config`, and the **Check remote status** and **Diagnostics** menu actions are gone. Entering the old commands shows migration advice without contacting storage. Use **/sync → Settings** to review sync setups and storage connections, **View differences** or `/sync diff` to compare files, and the Debug tool below for baseline-relative checks. A read does not verify write access. For a missing WebDAV history entry, open **History** and review **Repair active snapshot history**. `/sync daemon status` still reports service status. Supported daemon peers retain their existing `status` and `doctor` operations; no settings conversion is required.
368
+
369
+ ## 🛠️ Tools
370
+
371
+ Start Pi or use `/reload` with [Debug mode](#debug-mode) enabled in TUI or RPC to make `pi_sync_debug` available. Pi's tool allowlist still applies. The model can call it directly or use `tools.pi_sync_debug({ action: "latest" })` in `codemode` on Pi versions that support it. In `codemode.mode: "only"`, it is available only through scripts. It is not available in print or JSON.
372
+
373
+ - `latest` reads the most recent matching summary from the last 64 KiB of the private log. The result is historical; no record does not mean sync is clean. This action never starts or contacts the daemon.
374
+ - `recheck` reads the current setup's remote storage and returns a summary to the model **without a confirmation prompt**. A legacy snapshot may need to be read to compare its content selection. Leave Debug mode off if you do not want the model to have this access.
375
+
376
+ The tool returns bounded summaries, not raw log lines, credentials, paths, storage addresses, file contents, or raw errors. It does not publish, apply, probe writes, or repair History. Enabling the tool starts no new background checks.
377
+
364
378
  ## 🔄 Backend and recovery model
365
379
 
366
380
  | Backend | Publication guarantee | Authentication | Remote path |
@@ -376,11 +390,11 @@ The private bare cache under `<agent-dir>/pi-sync/git/` is rebuildable.
376
390
 
377
391
  WebDAV requires HTTPS except loopback tests.
378
392
  URL credentials, query strings, fragments, unsafe redirects, weak/missing ETags, and ignored conditional headers fail closed.
379
- `/sync doctor` verifies collection and conditional-write behavior with an isolated probe, then repairs a missing active-snapshot history entry.
393
+ Pi Sync verifies conditional writes before publication. If a publication activates a snapshot but leaves its History entry missing, open **/sync → History** and choose **Repair active snapshot history** when offered. Confirm the exact setup and snapshot. The repair uses a temporary write/delete probe and adds the missing entry; it does not change the active snapshot or any local files. No repair runs automatically or through the Debug tool.
380
394
 
381
395
  S3/R2 requests reject redirects, including same-origin redirects; configure the canonical endpoint before syncing. Credentials and snapshot bodies are never forwarded to a redirect destination.
382
396
 
383
- S3/R2 publishes `latest.json` and history using ETag `If-Match`, or `If-None-Match: *` for first creation, then verifies the active pointer. Before each publication, an isolated `.pi-sync-probes/<random-id>` object verifies that the server rejects stale ETags and create-only writes to existing objects and rotates strong ETags. Credentials must allow read, write, and delete under the selected storage path; the probe is deleted even after cancellation. Missing/weak ETags, ignored conditions, and probe or cleanup failures stop publication. A failed cleanup reports the probe key for manual removal; bucket versioning may retain probe versions. `/sync doctor` remains read-only for S3/R2 and does not verify write support.
397
+ S3/R2 publishes `latest.json` and history using ETag `If-Match`, or `If-None-Match: *` for first creation, then verifies the active pointer. Before each publication, an isolated `.pi-sync-probes/<random-id>` object verifies that the server rejects stale ETags and create-only writes to existing objects and rotates strong ETags. Credentials must allow read, write, and delete under the selected storage path; the probe is deleted even after cancellation. Missing/weak ETags, ignored conditions, and probe or cleanup failures stop publication. A failed cleanup reports the probe key for manual removal; bucket versioning may retain probe versions.
384
398
 
385
399
  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.
386
400
 
@@ -470,7 +484,7 @@ Preserve both roots before manual recovery; with every Pi process closed and no
470
484
  ## 🔒 Security and privacy
471
485
 
472
486
  - Canonical, legacy, temporary, and recovery settings paths are denied from snapshots; both `pi-sync/` and `.pisync/` state roots are permanently denied.
473
- - Push scans managed local content for common secret patterns unless the user explicitly enables **Skip secret scan**; `/sync doctor` always retains the diagnostic scan.
487
+ - Push scans managed local content for common secret patterns unless the user explicitly enables **Skip secret scan**.
474
488
  - Remote snapshot references, checksums, paths, manifests, response sizes, and publication revisions are validated.
475
489
  - Symlink parents, path escapes, duplicate paths, and unsafe file/directory replacement fail before local mutation.
476
490
  - Live locks block mutation; stale recovery rechecks process and guard ownership.
@@ -9,7 +9,7 @@ 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(route, signal, onCommit, options.target, onDialog, void 0, options.directional),
13
13
  options
14
14
  );
15
15
  return result.kind === "completed" ? result.value ?? { kind: "failed" } : result;
@@ -111,4 +111,4 @@ export {
111
111
  runCancellableOperation,
112
112
  runCancellableTask
113
113
  };
114
- //# sourceMappingURL=chunk-AYGMIMCV.ts.map
114
+ //# sourceMappingURL=chunk-4KGDPLQ4.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 type { ForegroundTransferIntent } from \"@narumitw/pi-sync-daemon\";\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: \"destination-conflict\" }\n | { kind: \"failed\" };\n\nexport interface DirectionalIntent {\n fingerprint: string;\n intent: ForegroundTransferIntent;\n}\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 directional?: DirectionalIntent,\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 directional?: DirectionalIntent;\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(route, signal, onCommit, options.target, onDialog, undefined, options.directional),\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\" | \"directional\"> = {},\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
+ }
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-R7PN3KIY.ts";
10
10
  import {
11
11
  setSyncSetupCompletions
12
- } from "./chunk-335XTMMZ.ts";
12
+ } from "./chunk-VQTYTUBU.ts";
13
13
  import {
14
14
  captureMutationOwner
15
15
  } from "./chunk-GELYN4UC.ts";
@@ -19,7 +19,7 @@ import {
19
19
  loadSettingsConfig,
20
20
  syncCheckConfigFingerprint,
21
21
  syncConfigReviewIdentity
22
- } from "./chunk-J52GYZO6.ts";
22
+ } from "./chunk-LNZRNXNQ.ts";
23
23
  import {
24
24
  SetupPullRequiresUiError
25
25
  } from "./chunk-6YKOHBSC.ts";
@@ -143,4 +143,4 @@ export {
143
143
  saveOnSwitch,
144
144
  useSyncSetup
145
145
  };
146
- //# sourceMappingURL=chunk-FR6A7ASZ.ts.map
146
+ //# sourceMappingURL=chunk-EG6BUOUQ.ts.map
@@ -242,7 +242,7 @@ function cancelledAfterCompletion(result, cause) {
242
242
  error.name = "AbortError";
243
243
  return error;
244
244
  }
245
- async function runDirectionalRecovery(connection, signal, run, recover, markCleanupRequired) {
245
+ async function runDirectionalRecovery(connection, signal, run, recover, markCleanupRequired, allowRetry = true) {
246
246
  signal.throwIfAborted();
247
247
  const attempt2 = new DirectionalCheckpoint(connection);
248
248
  const result = await run(attempt2);
@@ -271,7 +271,8 @@ async function runDirectionalRecovery(connection, signal, run, recover, markClea
271
271
  throw new Error(`No transfer was applied, but file-queue recovery stopped. ${detail}`, { cause: error });
272
272
  }
273
273
  if (primary.phase === "completed") return primary.result;
274
- const retryCheckpoint = primary.phase === "unchanged" ? attempt2.fingerprint : void 0;
274
+ if (!allowRetry) throw new Error("No transfer was applied. Start a new review before forcing the transfer.");
275
+ const retryCheckpoint = attempt2.fingerprint;
275
276
  const retry = new DirectionalCheckpoint(replacement, retryCheckpoint);
276
277
  const retried = await run(retry, retryCheckpoint);
277
278
  const remaining = recoveryOutcome(retried);
@@ -709,6 +710,11 @@ var PiDaemonClient = class {
709
710
  get debugEnabled() {
710
711
  return this.debug;
711
712
  }
713
+ validateDebugTool() {
714
+ this.validate();
715
+ if (!this.debug || !this.ownsContactUI() || this.pendingReload)
716
+ throw new Error("Pi Sync debug is not available in this session.");
717
+ }
712
718
  setDebugPreference(debug) {
713
719
  this.debug = debug && this.ctx.hasUI && (this.ctx.mode === "tui" || this.ctx.mode === "rpc");
714
720
  }
@@ -907,8 +913,10 @@ var PiDaemonClient = class {
907
913
  if (event.kind === "commit") return;
908
914
  if (this.signal.aborted || this.disposed || this.closing || clients.get(this.manager) !== this) return;
909
915
  const payload = event.payload;
910
- if (event.kind === "notify" && typeof payload?.message === "string")
911
- this.uiContext.ui.notify(safeTerminalText(payload.message), payload.level ?? "info");
916
+ if (event.kind === "notify" && typeof payload?.message === "string") {
917
+ const message = payload.layout === "report" ? payload.message.split("\n").map(safeTerminalText).join("\n") : safeTerminalText(payload.message);
918
+ this.uiContext.ui.notify(message, payload.level ?? "info");
919
+ }
912
920
  if (event.kind === "timings" && typeof payload?.report === "string") {
913
921
  this.publish?.(this.ctx, payload.report.split("\n").map(safeTerminalText).join("\n"));
914
922
  }
@@ -1271,7 +1279,8 @@ var PiDaemonClient = class {
1271
1279
  (owner, job, recoverySignal) => this.recoverDirectionalOwner(owner, job, recoverySignal, assertRoot),
1272
1280
  () => {
1273
1281
  this.cleanupRequired = true;
1274
- }
1282
+ },
1283
+ !(intent && typeof intent === "object" && "intent" in intent && intent.intent === "review-force")
1275
1284
  ) : await connection.run(operation, payload, runSignal, onCommit, diagnostics?.onSubmit);
1276
1285
  diagnostics?.returned(result, runSignal.aborted || reload?.signal.aborted);
1277
1286
  if (request?.received && reload && !this.paused && !reload.signal.aborted && !signal?.aborted) {
@@ -1402,7 +1411,7 @@ var PiDaemonClient = class {
1402
1411
  this.validate();
1403
1412
  if (!ctx.hasUI || !["tui", "rpc"].includes(ctx.mode)) throw new Error("This client cannot present safety reviews.");
1404
1413
  const { title, confirmationLabel, summaryLines } = callback.payload;
1405
- const { confirmMergeReview } = await import("./merge-review-LWMUE5IW.ts");
1414
+ const { confirmMergeReview } = await import("./merge-review-KTIQBRLL.ts");
1406
1415
  if (!isCurrent()) return false;
1407
1416
  this.validate();
1408
1417
  const result = await confirmMergeReview(
@@ -1464,7 +1473,7 @@ var PiDaemonClient = class {
1464
1473
  if (!ctx.hasUI || !["tui", "rpc"].includes(ctx.mode)) throw new Error("This client cannot present safety reviews.");
1465
1474
  let result;
1466
1475
  if (callback.kind === "merge-review" && typeof payload.title === "string" && typeof payload.content === "string") {
1467
- const { confirmMergeReview } = await import("./merge-review-LWMUE5IW.ts");
1476
+ const { confirmMergeReview } = await import("./merge-review-KTIQBRLL.ts");
1468
1477
  this.validate();
1469
1478
  combined.throwIfAborted();
1470
1479
  result = await confirmMergeReview(
@@ -1539,4 +1548,4 @@ export {
1539
1548
  withPiDaemonClient,
1540
1549
  remoteOperation
1541
1550
  };
1542
- //# sourceMappingURL=chunk-YV2R5SJU.ts.map
1551
+ //# sourceMappingURL=chunk-EI2J5Z4Q.ts.map