@narumitw/pi-sync 0.60.1 → 0.60.4

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 (216) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +9 -5
  3. package/dist/chunks/{chunk-7AC2RX4M.ts → chunk-277VHM2P.ts} +2 -2
  4. package/dist/chunks/chunk-277VHM2P.ts.map +7 -0
  5. package/dist/chunks/{chunk-UBE6XWOM.ts → chunk-6W2SNZ5P.ts} +2 -2
  6. package/dist/chunks/chunk-6W2SNZ5P.ts.map +7 -0
  7. package/dist/chunks/{chunk-JZKCOM62.ts → chunk-EMRFVLZM.ts} +2 -2
  8. package/dist/chunks/chunk-EMRFVLZM.ts.map +7 -0
  9. package/dist/chunks/{chunk-NPT2G4FU.ts → chunk-HEB6YT64.ts} +2 -2
  10. package/dist/chunks/chunk-HEB6YT64.ts.map +7 -0
  11. package/dist/chunks/{chunk-J5COV5TY.ts → chunk-HLCML3OW.ts} +2 -2
  12. package/dist/chunks/{chunk-J5COV5TY.ts.map → chunk-HLCML3OW.ts.map} +1 -1
  13. package/dist/chunks/{chunk-UZUUUY7C.ts → chunk-IGDI5CIH.ts} +4 -4
  14. package/dist/chunks/{chunk-ZMNVNECV.ts → chunk-KPWZNMKM.ts} +2 -2
  15. package/dist/chunks/chunk-KPWZNMKM.ts.map +7 -0
  16. package/dist/chunks/{chunk-YWEYRRQI.ts → chunk-LAXTCSX4.ts} +11 -11
  17. package/dist/chunks/chunk-LAXTCSX4.ts.map +7 -0
  18. package/dist/chunks/{chunk-BGGKHHO4.ts → chunk-MCUZFUHY.ts} +7 -7
  19. package/dist/chunks/{chunk-M7RHV3H6.ts → chunk-OA4NZLSL.ts} +2 -2
  20. package/dist/chunks/chunk-OA4NZLSL.ts.map +7 -0
  21. package/dist/chunks/{chunk-ENFHHB5O.ts → chunk-OVCP2SOB.ts} +42 -6
  22. package/dist/chunks/chunk-OVCP2SOB.ts.map +7 -0
  23. package/dist/chunks/{chunk-6LHIRS5R.ts → chunk-RJZIKZI3.ts} +6 -6
  24. package/dist/chunks/chunk-RJZIKZI3.ts.map +7 -0
  25. package/dist/chunks/{chunk-CEMFCWIU.ts → chunk-RNIEVDTR.ts} +2 -2
  26. package/dist/chunks/chunk-RNIEVDTR.ts.map +7 -0
  27. package/dist/chunks/{chunk-PDBTD2K6.ts → chunk-S3R3W3KF.ts} +2 -2
  28. package/dist/chunks/chunk-S3R3W3KF.ts.map +7 -0
  29. package/dist/chunks/{chunk-4RNCZZY7.ts → chunk-SE7HHBKH.ts} +15 -11
  30. package/dist/chunks/{chunk-4RNCZZY7.ts.map → chunk-SE7HHBKH.ts.map} +2 -2
  31. package/dist/chunks/{chunk-CZNBKIM5.ts → chunk-SMVKMYLK.ts} +2 -2
  32. package/dist/chunks/chunk-SMVKMYLK.ts.map +7 -0
  33. package/dist/chunks/{chunk-JKBUYCPC.ts → chunk-V4AMI3VL.ts} +2 -2
  34. package/dist/chunks/chunk-V4AMI3VL.ts.map +7 -0
  35. package/dist/chunks/{chunk-BWWTOQOW.ts → chunk-VQRDL3SY.ts} +310 -90
  36. package/dist/chunks/chunk-VQRDL3SY.ts.map +7 -0
  37. package/dist/chunks/{chunk-VZCWYXRS.ts → chunk-WP2M67XZ.ts} +2 -2
  38. package/dist/chunks/chunk-WP2M67XZ.ts.map +7 -0
  39. package/dist/chunks/{chunk-HNKLBM3U.ts → chunk-ZIL6PW5L.ts} +2 -2
  40. package/dist/chunks/chunk-ZIL6PW5L.ts.map +7 -0
  41. package/dist/chunks/{command-handler-FO4XBBHF.ts → command-handler-TMH4US44.ts} +23 -21
  42. package/dist/chunks/command-handler-TMH4US44.ts.map +7 -0
  43. package/dist/chunks/{conflict-review-XBSME2ER.ts → conflict-review-QGUCODDH.ts} +5 -5
  44. package/dist/chunks/{continuous-record-ZHUXVO4E.ts → continuous-record-3XDXDOMV.ts} +2 -2
  45. package/dist/chunks/continuous-record-3XDXDOMV.ts.map +7 -0
  46. package/dist/chunks/{continuous-storage-SQBAXACF.ts → continuous-storage-HLKCHF6Z.ts} +2 -2
  47. package/dist/chunks/continuous-storage-HLKCHF6Z.ts.map +7 -0
  48. package/dist/chunks/{file-selection-S6CNNNQI.ts → file-selection-DD6X4J2K.ts} +6 -6
  49. package/dist/chunks/manager-result-dispatcher-YVVD44QD.ts +18 -0
  50. package/dist/chunks/{manager-ui-AY5ZU6B4.ts → manager-ui-Q54OHOPR.ts} +26 -26
  51. package/dist/chunks/manager-ui-Q54OHOPR.ts.map +7 -0
  52. package/dist/chunks/remote-selection-ui-ODSUHX5N.ts +17 -0
  53. package/dist/chunks/{setup-switch-M3BAFGJM.ts → setup-switch-SPZE7HIQ.ts} +8 -8
  54. package/dist/chunks/{setup-wizard-NFAWP4KF.ts → setup-wizard-5JYKAEIT.ts} +11 -11
  55. package/dist/chunks/{snapshot-D4SFDP5J.ts → snapshot-5HY3M2NL.ts} +2 -2
  56. package/dist/chunks/snapshot-5HY3M2NL.ts.map +7 -0
  57. package/dist/chunks/{snapshot-transaction-directory-TNKBQ3UQ.ts → snapshot-transaction-directory-OU2D7R7A.ts} +2 -2
  58. package/dist/chunks/snapshot-transaction-directory-OU2D7R7A.ts.map +7 -0
  59. package/dist/chunks/{state-directory-JZSZVVPX.ts → state-directory-XXHU73Z3.ts} +2 -2
  60. package/dist/chunks/{sync-inspection-BJ4KPPNO.ts → sync-inspection-ECUTWISE.ts} +6 -6
  61. package/dist/chunks/sync-inspection-ECUTWISE.ts.map +7 -0
  62. package/dist/chunks/{sync-operations-TLWER2TT.ts → sync-operations-REXODWZB.ts} +6 -6
  63. package/dist/chunks/{sync-operations-TLWER2TT.ts.map → sync-operations-REXODWZB.ts.map} +2 -2
  64. package/dist/chunks/{sync-state-FVCJJ7MY.ts → sync-state-2LMIXJ2C.ts} +2 -2
  65. package/dist/chunks/sync-state-2LMIXJ2C.ts.map +7 -0
  66. package/dist/index.ts +74 -55
  67. package/dist/index.ts.map +3 -3
  68. package/docs/agent-mode-verification.md +1 -1
  69. package/docs/agent-quality-verification.md +1 -1
  70. package/docs/continuous-sync-verification.md +1 -1
  71. package/docs/daemon-migration.md +90 -10
  72. package/docs/tui-contract.md +7 -1
  73. package/package.json +3 -3
  74. package/skills/configure-pi-sync/references/configuration.md +9 -4
  75. package/src/backends/backend-factory.ts +2 -2
  76. package/src/backends/backend-identity.ts +2 -2
  77. package/src/backends/backend-types.ts +1 -1
  78. package/src/backends/git/git-backend.ts +2 -2
  79. package/src/backends/git/git-config.ts +2 -2
  80. package/src/backends/git/git-runner.ts +2 -2
  81. package/src/backends/git/git-storage.ts +2 -2
  82. package/src/backends/s3/s3-backend.ts +2 -2
  83. package/src/backends/s3/s3-client.ts +6 -2
  84. package/src/backends/s3/s3-conditions.ts +2 -2
  85. package/src/backends/snapshot-pointer.ts +2 -2
  86. package/src/backends/sync-backend.ts +2 -2
  87. package/src/backends/webdav/webdav-backend.ts +2 -2
  88. package/src/backends/webdav/webdav-client.ts +2 -2
  89. package/src/backends/webdav/webdav-config.ts +2 -2
  90. package/src/commands/command-execution.ts +2 -2
  91. package/src/commands/command-handler.ts +2 -0
  92. package/src/commands/command.ts +1 -1
  93. package/src/daemon/apply-gate.ts +1 -1
  94. package/src/daemon/pi-client.ts +335 -95
  95. package/src/daemon/recovery.ts +1 -1
  96. package/src/paths.ts +2 -2
  97. package/src/settings/config-errors.ts +2 -2
  98. package/src/settings/config-file.ts +2 -2
  99. package/src/settings/config.ts +2 -2
  100. package/src/settings/settings-management.ts +2 -2
  101. package/src/settings/settings-store.ts +2 -2
  102. package/src/settings/settings-types.ts +1 -1
  103. package/src/settings/settings-validation.ts +2 -2
  104. package/src/snapshot/session-paths.ts +2 -2
  105. package/src/snapshot/snapshot-apply.ts +2 -2
  106. package/src/snapshot/snapshot-case-replacement.ts +2 -2
  107. package/src/snapshot/snapshot-codec.ts +2 -2
  108. package/src/snapshot/snapshot-exclude-safety.ts +2 -2
  109. package/src/snapshot/snapshot-mutation-queues.ts +2 -2
  110. package/src/snapshot/snapshot-paths.ts +2 -2
  111. package/src/snapshot/snapshot-root-transition.ts +2 -2
  112. package/src/snapshot/snapshot-transaction-directory.ts +2 -2
  113. package/src/snapshot/snapshot-transaction-plan.ts +2 -2
  114. package/src/snapshot/snapshot-transaction.ts +2 -2
  115. package/src/snapshot/snapshot-types.ts +1 -1
  116. package/src/snapshot/snapshot.ts +2 -2
  117. package/src/state/json-file.ts +2 -2
  118. package/src/state/lock-policy.ts +2 -2
  119. package/src/state/lock.ts +2 -2
  120. package/src/state/lockfile-fs.ts +2 -2
  121. package/src/state/merge-baseline-store.ts +2 -2
  122. package/src/state/mutation-directory-sync.ts +2 -2
  123. package/src/state/operation-availability.ts +2 -2
  124. package/src/state/state-directory.ts +2 -2
  125. package/src/state/state-types.ts +1 -1
  126. package/src/state/sync-state-store.ts +2 -2
  127. package/src/sync/agent-candidate.ts +2 -2
  128. package/src/sync/agent-plan.ts +2 -2
  129. package/src/sync/agent-policy.ts +2 -2
  130. package/src/sync/agent-refusal-retry.ts +2 -2
  131. package/src/sync/agent-request.ts +2 -2
  132. package/src/sync/agent-runner.ts +2 -2
  133. package/src/sync/agent-store.ts +2 -2
  134. package/src/sync/agent-sync.ts +2 -2
  135. package/src/sync/apply-review.ts +2 -2
  136. package/src/sync/conflict-artifact-ownership.ts +2 -2
  137. package/src/sync/conflict-artifacts.ts +2 -2
  138. package/src/sync/conflict-groups.ts +2 -2
  139. package/src/sync/conflict-preview.ts +2 -2
  140. package/src/sync/conflict-resolution.ts +2 -2
  141. package/src/sync/conflict-retention.ts +2 -2
  142. package/src/sync/content-conflicts.ts +2 -2
  143. package/src/sync/continuous-errors.ts +2 -2
  144. package/src/sync/continuous-lease.ts +2 -2
  145. package/src/sync/continuous-record.ts +2 -2
  146. package/src/sync/continuous-storage.ts +2 -2
  147. package/src/sync/continuous-sync.ts +2 -2
  148. package/src/sync/continuous-watch.ts +2 -2
  149. package/src/sync/exclude-policy.ts +2 -2
  150. package/src/sync/field-migration.ts +2 -2
  151. package/src/sync/file-merge-planner.ts +6 -2
  152. package/src/sync/json-document.ts +2 -2
  153. package/src/sync/local-field-policy.ts +2 -2
  154. package/src/sync/local-fields.ts +2 -2
  155. package/src/sync/merge-apply.ts +2 -2
  156. package/src/sync/merge-journal.ts +2 -2
  157. package/src/sync/merge-transfer-error.ts +2 -2
  158. package/src/sync/merged-sync.ts +2 -2
  159. package/src/sync/mutation-owner.ts +2 -2
  160. package/src/sync/package-merge.ts +2 -2
  161. package/src/sync/partial-progress.ts +2 -2
  162. package/src/sync/remote-snapshot.ts +2 -2
  163. package/src/sync/session-merge.ts +2 -2
  164. package/src/sync/settings-conflicts.ts +2 -2
  165. package/src/sync/settings-merge.ts +2 -2
  166. package/src/sync/signals.ts +2 -2
  167. package/src/sync/startup-timings.ts +2 -2
  168. package/src/sync/sync-decision.ts +2 -2
  169. package/src/sync/sync-error-guidance.ts +2 -2
  170. package/src/sync/sync-errors.ts +2 -2
  171. package/src/sync/sync-inspection.ts +2 -2
  172. package/src/sync/sync-local.ts +6 -2
  173. package/src/sync/sync-mutations.ts +2 -2
  174. package/src/sync/sync-operations.ts +1 -1
  175. package/src/sync/sync-policy.ts +2 -2
  176. package/src/sync/sync-queries.ts +2 -2
  177. package/src/sync/sync-state.ts +2 -2
  178. package/src/sync/text-merge.ts +2 -2
  179. package/src/sync-extension.ts +62 -41
  180. package/src/ui/sync-status.ts +47 -4
  181. package/dist/chunks/chunk-6LHIRS5R.ts.map +0 -7
  182. package/dist/chunks/chunk-7AC2RX4M.ts.map +0 -7
  183. package/dist/chunks/chunk-BWWTOQOW.ts.map +0 -7
  184. package/dist/chunks/chunk-CEMFCWIU.ts.map +0 -7
  185. package/dist/chunks/chunk-CZNBKIM5.ts.map +0 -7
  186. package/dist/chunks/chunk-ENFHHB5O.ts.map +0 -7
  187. package/dist/chunks/chunk-HNKLBM3U.ts.map +0 -7
  188. package/dist/chunks/chunk-JKBUYCPC.ts.map +0 -7
  189. package/dist/chunks/chunk-JZKCOM62.ts.map +0 -7
  190. package/dist/chunks/chunk-M7RHV3H6.ts.map +0 -7
  191. package/dist/chunks/chunk-NPT2G4FU.ts.map +0 -7
  192. package/dist/chunks/chunk-PDBTD2K6.ts.map +0 -7
  193. package/dist/chunks/chunk-UBE6XWOM.ts.map +0 -7
  194. package/dist/chunks/chunk-VZCWYXRS.ts.map +0 -7
  195. package/dist/chunks/chunk-YWEYRRQI.ts.map +0 -7
  196. package/dist/chunks/chunk-ZMNVNECV.ts.map +0 -7
  197. package/dist/chunks/command-handler-FO4XBBHF.ts.map +0 -7
  198. package/dist/chunks/continuous-record-ZHUXVO4E.ts.map +0 -7
  199. package/dist/chunks/continuous-storage-SQBAXACF.ts.map +0 -7
  200. package/dist/chunks/manager-result-dispatcher-I2AMCCE7.ts +0 -18
  201. package/dist/chunks/manager-ui-AY5ZU6B4.ts.map +0 -7
  202. package/dist/chunks/remote-selection-ui-GZHPDQ4L.ts +0 -17
  203. package/dist/chunks/snapshot-D4SFDP5J.ts.map +0 -7
  204. package/dist/chunks/snapshot-transaction-directory-TNKBQ3UQ.ts.map +0 -7
  205. package/dist/chunks/sync-inspection-BJ4KPPNO.ts.map +0 -7
  206. package/dist/chunks/sync-state-FVCJJ7MY.ts.map +0 -7
  207. package/docs/settings.md +0 -90
  208. /package/dist/chunks/{chunk-UZUUUY7C.ts.map → chunk-IGDI5CIH.ts.map} +0 -0
  209. /package/dist/chunks/{chunk-BGGKHHO4.ts.map → chunk-MCUZFUHY.ts.map} +0 -0
  210. /package/dist/chunks/{conflict-review-XBSME2ER.ts.map → conflict-review-QGUCODDH.ts.map} +0 -0
  211. /package/dist/chunks/{file-selection-S6CNNNQI.ts.map → file-selection-DD6X4J2K.ts.map} +0 -0
  212. /package/dist/chunks/{manager-result-dispatcher-I2AMCCE7.ts.map → manager-result-dispatcher-YVVD44QD.ts.map} +0 -0
  213. /package/dist/chunks/{remote-selection-ui-GZHPDQ4L.ts.map → remote-selection-ui-ODSUHX5N.ts.map} +0 -0
  214. /package/dist/chunks/{setup-switch-M3BAFGJM.ts.map → setup-switch-SPZE7HIQ.ts.map} +0 -0
  215. /package/dist/chunks/{setup-wizard-NFAWP4KF.ts.map → setup-wizard-5JYKAEIT.ts.map} +0 -0
  216. /package/dist/chunks/{state-directory-JZSZVVPX.ts.map → state-directory-XXHU73Z3.ts.map} +0 -0
@@ -4,9 +4,54 @@ This daemon extraction is experimental. Deterministic Linux verification passed,
4
4
 
5
5
  ## Ownership and upgrade
6
6
 
7
- The non-extension npm package is `@narumitw/sync-daemon`; its executable remains `sync-daemon`. The namespace change affects npm identity and imports only, not IPC names or settings/state formats. The existing Pi extension remains `@narumitw/pi-sync`, with `/sync` as its user interface. Pi starts or connects to one detached service per canonical agent directory; ordinary Pi shutdown does not stop it. No OS service or supervisor is installed.
8
-
9
- Stop the service before updating its package or rebuilding a local checkout: a surviving Node process can otherwise combine cached code with newly loaded modules from the replaced directory. A compatible protocol handshake does not upgrade the running implementation; restart explicitly after installation.
7
+ The non-extension npm package is `@narumitw/pi-sync-daemon`; its executable is `pi-sync-daemon`. These replace `@narumitw/sync-daemon` and `sync-daemon`; the new package does not provide the old executable alias. The rename changes the package and executable names, not the IPC names, authorization digests, or
8
+ settings and state formats. The Pi extension remains `@narumitw/pi-sync`. Pi uses one detached service
9
+ per canonical agent directory. It does not install an OS service.
10
+
11
+ After an update, use `/reload` in open Pi sessions. On the next active connection, the new client
12
+ checks the owner's build over compatible, authenticated IPC. For an older or unversioned owner, the
13
+ client checks that no retained unattended permission blocks the upgrade. It then requests a stop
14
+ and starts the replacement only after the owner releases its identity and exits. If any check fails,
15
+ follow manual recovery. The upgrade does not run a transfer, replay an operation, or change sync
16
+ settings. Passive print, JSON, and shutdown paths do not replace an older owner. If an upgrade fails
17
+ while switching sessions, Pi Sync reports the failure and tries to attach the new session to the
18
+ same owner for file protection only. That attachment cannot submit sync work. Use `/reload`
19
+ after recovery.
20
+
21
+ Manual recovery:
22
+
23
+ 1. Revoke all retained unattended grants before updating. `/sync daemon revoke-after-exit` applies
24
+ only to the active setup. For each setup with a retained grant, make it active, run the command,
25
+ and confirm revocation. If the upgraded client blocks on consent before creating a pending
26
+ upgrade record, use an already available compatible Pi client to revoke each grant from the
27
+ still-running owner.
28
+ Without a pending record, `repair-upgrade` returns `repaired: false` and does not revoke permission.
29
+ If no compatible client is available or revocation fails, stop here and preserve the consent,
30
+ identity, and recovery files.
31
+ 2. Run `pi-sync-daemon status --root <agent-directory>`.
32
+ - A verified `pid` identifies the owner that answered the handshake. Record it before stopping
33
+ that owner. Check `pendingUpgradePid` for any pending owner, even if `running` is `false` or `null`.
34
+ - `running: null` means the handshake failed, even if there is no pending upgrade. `recordedPid`
35
+ comes from the validated identity file and is only a lead. Unknown status does not prove exit
36
+ or compatibility. Use diagnostics from an already available compatible version to identify the
37
+ owner. If you cannot identify it, stop here and preserve the records.
38
+
39
+ To stop an identified, running owner, use `pi-sync-daemon stop --root <agent-directory>` if
40
+ compatible. This works even if the old executable was removed. If the old executable is still
41
+ installed and compatible, you can use `sync-daemon stop --root <agent-directory>` instead.
42
+ 3. Check the recorded PID in the operating system. On macOS or Linux, use `ps -p <pid> -o pid,args`.
43
+ On Windows, look up the PID in Task Manager's **Details** tab. A successful `stop` confirms
44
+ identity release, not process exit. Wait for the old process to exit. If exit is uncertain, do
45
+ not force a second owner or delete recovery files.
46
+ 4. If a pending upgrade still blocks restart after exit, close other Pi sessions for that root.
47
+ Run `pi-sync-daemon repair-upgrade --root <agent-directory>`. It verifies exit, revokes all
48
+ retained after-exit grants for that root, and moves the upgrade record and any stale identity
49
+ to the private archive path it reports. It does not start a daemon or transfer data. If repair
50
+ fails, keep the records. Do not edit or delete them to force startup.
51
+ 5. Use `/reload`, then `/sync daemon status`. Review after-exit permission again if you need it.
52
+
53
+ Stop the service before rebuilding a local checkout in place. A source rebuild without a package
54
+ version change does not trigger automatic replacement.
10
55
 
11
56
  Before the first daemon-owned transfer, close or upgrade every older Pi process and review `/sync daemon handover`. The existing operation lock excludes observed transfers, but an idle older client cannot be detected from an absent lock. Older binaries cannot be made to honor a new handover record retroactively. Do not run an old and new engine as interchangeable writers.
12
57
 
@@ -14,9 +59,11 @@ Backend formats, `pi-sync.json`, `pi-sync/`, `.pisync/`, backups, and journals r
14
59
 
15
60
  ## Lifetime is not consent
16
61
 
17
- Old Continuous consent was limited to an open Pi session. Existing Automatic, Autonomous, and Continuous defaults stay unchanged. The service may remain alive with no clients, but this alone does not authorize a transfer or model request.
62
+ Old Continuous consent was limited to an open Pi session. Existing Automatic, Autonomous, and Continuous defaults stay unchanged. When no registered live client PID remains for that canonical root and no valid explicit after-exit grant covers the active setup, a fixed 30-second grace period starts. Explicit CLI start without clients follows the same policy. Live passive, disconnected, publishing, and orderly retired PIDs keep the owner alive; detach, heartbeat loss, and an empty active-participant list do not prove process exit. `/reload`, `/new`, fork, and resume retain protection while their Pi process lives. A client arriving before shutdown becomes final cancels automatic exit. No new setting, environment variable, or keep-alive flag is added.
63
+
64
+ After grace, stop new automatic work, cancel cancellable work, and drain committed writes, monitor work, mutation-queue releases, persistence, and owned callbacks before releasing ownership. Closing adds no final sync or model request and preserves journals, backups, request accounting, and existing transfer permissions. The next eligible interactive client or explicit command can use singleton startup only after the old owner's exit is proven. Print/JSON never launch a replacement.
18
65
 
19
- `/sync daemon allow-after-exit` reviews extra unattended permission for the current setup and selected standalone-capable model. `/sync daemon revoke-after-exit` stops new unattended work. Setup changes invalidate the persisted digest. Interactive model, working-directory, or session-directory changes durably revoke older grants; returning to the old binding or restarting does not restore them. Independent model availability is checked through public Pi SDK APIs; private extension registrations and parent runtime credentials are not transferred.
66
+ `/sync daemon allow-after-exit` reviews extra unattended permission for the current setup and selected standalone-capable model. `/sync daemon revoke-after-exit` stops new unattended work. Setup changes invalidate the persisted digest. Interactive model, working-directory, or session-directory changes durably revoke older grants; returning to the old binding or restarting does not restore them. A valid active-setup grant keeps service lifetime under the existing fingerprint and binding rules, without expanding work permissions. A grant for another setup, a revoked grant, or a stale fingerprint does not. Temporary provider or backend unavailability does not itself revoke a valid grant. Lifetime checks do not call a model, contact a provider or storage, or execute credential commands. Independent model availability for actual work is checked through public Pi SDK APIs; private extension registrations and parent runtime credentials are not transferred.
20
67
 
21
68
  Headless print/JSON startup never launches a persistent service. It passively attaches to an existing one to protect its session and pause automatic work. Orderly closed clients retain live-PID file protection without remaining active participants; ambiguous disconnections and replacement gaps remain pauses. Pending recovery needs a configured observable client and reviewed ownership before managed files can be changed. No event automatically reloads resources or changes the model-visible prompt/tool prefix; reload remains an explicit reviewed client action.
22
69
 
@@ -26,25 +73,43 @@ The service owns synchronization scheduling and execution, not every writer on t
26
73
 
27
74
  Protect the union of all registered live-PID sessions, including ambiguously disconnected and orderly retired clients. Retired clients cannot authorize work or hold back zero-client scheduling, but their protection survives another attach and daemon restart until confirmed PID exit. A contact timeout revokes work; it is not permission to overwrite that session or release an acquired mutation grant. An uncertain grant remains quarantined until explicit release or confirmed daemon exit. Unregistered editors, shell commands, older clients, and extensions remain independent writers; preimages, conditional publication, backups, and journal recovery are still required.
28
75
 
76
+ When a running daemon expires a Pi client's heartbeat (for example, during
77
+ computer sleep), the TUI or RPC client tries to reconnect to that same daemon
78
+ without reloading Pi. The next `/sync` command also checks contact before
79
+ submitting work. `/sync daemon status` reports `connected` only after the daemon
80
+ accepts the current participant's facts. An older daemon can stay reachable
81
+ without supporting this repair; a healthy CLI status alone does not confirm Pi
82
+ participation.
83
+
84
+ Reconnect does not replay a submitted operation or restart startup transfers.
85
+ If a write or file-queue release cannot be confirmed, preserve the journals and
86
+ use the existing recovery path before retrying a transfer. Reconnect does not
87
+ stop or restart the service, and it does not extend transfer or model permission.
88
+
29
89
  ## Diagnostics and rollback
30
90
 
31
- If saving consent fails, that service instance blocks automatic work. Preserve the retained file, repair persistence, and revoke permission before an explicit restart; a failed save does not prove the previous grant changed.
91
+ If saving consent fails, that service instance blocks automatic work. Uncertain consent publication, failed revocation, or cleanup failure keeps the owner paused and retains evidence; automatic exit or implicit restart must not clear the barrier and restore an older persisted grant. Preserve the retained file, repair persistence, and revoke permission through the existing repair/revocation path before an explicit restart; a failed save does not prove the previous grant changed. Cleanup failure is not a successful exit.
32
92
 
33
- Use `sync-daemon status --root <agent-directory>` without starting a missing service. `stop` drains compatible work. `restart` must not replace an incompatible, unavailable live, or uncertain owner silently. The Pi client must report failure rather than fall back to in-process transfers.
93
+ Use `pi-sync-daemon status --root <agent-directory>` without starting a missing service. `stop` drains compatible work. `restart` must not replace an incompatible, unavailable live, or uncertain owner silently. The Pi client must report failure rather than fall back to in-process transfers. If the initial consent check blocked the update before a pending record was created, follow step 1 of [manual recovery](#ownership-and-upgrade); `repair-upgrade` cannot help in that case.
34
94
 
35
- CLI `status` includes an owner-private, bounded lifecycle-log path. Only timestamps and lifecycle phases are retained; no request content, credentials, model output, or exception text is logged. This log is not transaction recovery evidence.
95
+ A successful CLI `status` handshake reports an owner-private, bounded lifecycle-log path. Only timestamps and lifecycle phases are retained; no request content, credentials, model output, or exception text is logged. This log is not transaction recovery evidence.
36
96
 
37
97
  Before rollback:
38
98
 
39
99
  1. Stop the daemon explicitly and verify owner exit.
40
100
  2. Close all upgraded clients and retain settings, state, journals, and backups.
41
101
  3. Reconcile pending or uncertain publication through the supported engine recovery path.
42
- 4. Only then consider a compatible code/package rollback; do not blindly restore old local or remote bytes.
102
+ 4. Check consent compatibility before rolling back. A repair can leave `daemon.json` larger than
103
+ 65,536 bytes because it keeps all other fields when revoking grants. Builds with the old
104
+ 65,536-byte limit cannot read that file. Preserve it and use a build that supports the larger
105
+ file. Do not delete it or restore an older copy to make the rollback work.
43
106
 
44
107
  Operation retries are instance-bound and deduplicated. An expired result or old instance requires journal reconciliation, not blind replay. A full bounded result ledger requires an explicit drained restart.
45
108
 
46
109
  ## Verification status
47
110
 
111
+ The following evidence records the earlier daemon extraction, including its former idle-persistence policy. It does not verify the new automatic-exit policy; that policy requires separate runtime verification. Native and production restrictions below remain unchanged.
112
+
48
113
  Completed on disposable roots and synthetic loopback endpoints:
49
114
 
50
115
  - `npm run format` and `npm run check`: builds, Biome, package boundaries, dependency compatibility, and workspace types.
@@ -62,6 +127,20 @@ The semantic audit used `docs/extension-conventions.md`, `docs/extension-setting
62
127
 
63
128
  Intentional compatibility limits are explicit: there is no legacy in-process fallback; unsupported parent-only providers remain unavailable; print/JSON do not launch a service but protect sessions in an existing one; a cancelled SDK switch/fork stays paused until reload; arbitrary external writers are not covered by a universal filesystem compare-and-swap. Normal closed clients retain live-PID protection without blocking reviewed zero-client work. No package publication, tag, release dispatch, paid provider request, or production-storage action was performed.
64
129
 
130
+ ### Heartbeat recovery verification
131
+
132
+ An isolated daemon clock and real Pi RPC clients reproduced the stuck first
133
+ command before the fix. Regression tests now verify same-owner, same-session
134
+ recovery with and without a command, and no replay or remote write after an
135
+ interrupted loopback WebDAV push. Daemon tests exercise admission, lifecycle
136
+ cancellation, legacy replies, committed work, and uncertain queue release.
137
+ The Jiti tests load the built extension and exercise its lazy command path.
138
+
139
+ Physical suspend and wake timing on target devices remains unverified. See
140
+ [External handoff](#external-handoff) before making a platform claim or
141
+ preparing a release. This change neither publishes a package nor authorizes
142
+ production cutover.
143
+
65
144
  ## Measured process cost
66
145
 
67
146
  These are same-host observations on Linux with Node `v26.11.1`, not limits or statistically controlled performance claims. The baseline was reconstructed from archived commit `a01c1d75` after implementation, rather than measured before editing. Both Pi cases loaded generated Jiti entries through real offline RPC processes with the same installed parent SDK and synthetic loopback WebDAV/model endpoints. No production stores, credentials, or paid model calls were used.
@@ -87,7 +166,8 @@ The archived previous engine also held its real operation lock in a separate pro
87
166
 
88
167
  | Responsible role | Prerequisite and action | Expected result | Unverified behavior and restriction |
89
168
  | --- | --- | --- | --- |
90
- | npm/release account owner | Passing package gates and explicit approval; verify publication rights for `@narumitw/sync-daemon` and dependency-first publication | The daemon resolves before the dependent Pi client is released | Scope permissions and first publication are not verified; no publication, visibility change, tags, or workflow dispatch without approval |
169
+ | npm/release account owner | Passing package gates and explicit approval; verify publication rights for `@narumitw/pi-sync-daemon` and dependency-first publication | The daemon resolves before the dependent Pi client is released | Scope permissions and first publication are not verified; no publication, visibility change, tags, or workflow dispatch without approval |
170
+ | Device operator | Verified builds and an isolated setup; suspend and wake the target device, then run `/sync daemon status` and `/sync status` in the same Pi session | Both commands work without reload; the daemon and session stay the same | Physical wake timing is not verified by clock-controlled tests; do not claim tested platforms without this check |
91
171
  | Deployment operator | Verified cutover/recovery evidence and backups; close older Pi processes and authorize each real root | One recognized owner with unchanged compatible data | Only the explicitly approved checkout-service stop/restart was used for package-identity and runtime maintenance; no production-storage transfer or settings change was made, and no real-data cutover is included |
92
172
  | Native platform maintainer | Prepared transport/process tests; run native Windows/macOS checks | Correct local transport, permissions, independent lifetime, and recovery | Native ACL/named-pipe, logout, and physical power-loss behavior remain unverified; do not advertise new unverified guarantees or silently remove previous support |
93
173
  | Provider/storage account owner | Explicit cost/network authorization and isolated data; optional live smoke | Authorized dispatch/publication without exposed credentials | Entitlements and custom-provider/production behavior remain unverified; deterministic providers and loopback stores are the default |
@@ -70,6 +70,12 @@ Startup transfer summaries report the preference and prerequisites, not a claim
70
70
 
71
71
  TUI Pull and Push reviews reuse the existing scrollable safe-default confirmation and exact Details document; RPC and History rollback retain their observable confirmation protocols. The existing History dialog ownership/cancellation flow is not replaced. All changed counts come from effective snapshot differences rather than raw merge decisions. Protected paths, preserved remote files, merged bytes, and withheld paths must be accounted for before rendering. Cancellation performs no transfer; pre-commit preparation may retain recovery evidence. After the commit boundary, existing completion/recovery rules apply instead of promising undo.
72
72
 
73
+ ## Resource reload after a transfer
74
+
75
+ If the user accepts the reload prompt after a pull or rollback, `/sync` waits for the daemon job and closes its dialogs before asking Pi to reload. Declining leaves the completed transfer in place without reloading. Reload still waits for session shutdown and daemon cleanup.
76
+
77
+ RPC and the TUI harness verify this ordering. The native Fedora/tmux flow from [issue #1935](https://github.com/narumiruna/pi-extensions/issues/1935) was not run. To verify it, repeat the issue's loopback WebDAV steps with a temporary agent directory. After accepting reload, check that the progress display closes and the next editor input or `/sync` command works.
78
+
73
79
  ## Review boundaries
74
80
 
75
81
  This change does not touch model prompts, tool exposure, shared-terminal handoff, settings formats, credentials, or default sync policies. Existing startup/session signals and Kit/custom-interaction disposal own new UI calls. Any awaited review is followed by owner validation, and each mutating operation revalidates its mutable inputs before its existing commit boundary. Status and differences actions use existing routes; manager opening/refresh remains observational and does not contact the remote. Diagnostics discloses its WebDAV write/repair behavior before execution.
@@ -119,7 +125,7 @@ Verification evidence:
119
125
 
120
126
  - Root `npm run check` and `npm test` passed: 935 test files, 20,528 passed tests, 34 existing skips, and no unhandled errors.
121
127
  - The focused Pi Sync suite passed: 185 files, 3,293 passed tests, and 19 existing skips. Cases cover all four Settings descriptions, TUI/RPC consent, cancellation, the RPC Done exit without authorization, durable saves and failure recovery, Continuous sync dependencies, non-default keys, narrow rendering, and current/legacy documentation anchors.
122
- - A fenced-code-aware heading audit passed for all 37 package READMEs. Legacy fragment aliases remain in the README, authoritative settings reference, and compatibility index.
128
+ - A fenced-code-aware heading audit passed for all 37 package READMEs. Legacy fragment aliases were verified in the README and authoritative settings reference.
123
129
  - `npm run package:pack -- sync` and an actual temporary tarball inspection passed: 330 entries include the runtime, source, docs, skill, license, and changelog, without tests or repository plans.
124
130
 
125
131
  The first direct-Vitest run used a symlinked macOS temporary path and triggered existing alias-path safety checks; the successful focused run used the canonical temporary root, as the root runner does. New RPC choice assertions were corrected to include Kit's existing Done exit, and both consent flows now test that exit. No runtime safety check or acceptance criterion was relaxed. Later full-suite command-level rechecks exceeded the harness's 300-second command limit. A background full-suite recheck hit the readiness watchdog in the unchanged `test/packed-publish-native.test.ts`; that file passed separately. The final full-suite recheck uses a managed background runner without changing per-test limits. Biome reports existing schema-version and unrelated lint advisories; its gates pass without changing repository tooling.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narumitw/pi-sync",
3
- "version": "0.60.1",
3
+ "version": "0.60.4",
4
4
  "description": "Pi extension that syncs Pi configuration through Git, WebDAV, Cloudflare R2, or S3-compatible storage.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -46,8 +46,8 @@
46
46
  "typecheck": "tsc --noEmit"
47
47
  },
48
48
  "dependencies": {
49
- "@narumitw/sync-daemon": "^0.2.0",
50
- "@narumitw/pi-tui-kit": "^0.70.0"
49
+ "@narumitw/pi-sync-daemon": "^0.5.0",
50
+ "@narumitw/pi-tui-kit": "^0.70.1"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@earendil-works/pi-coding-agent": "1.5.0",
@@ -251,6 +251,7 @@ UI changes save immediately through the existing ordered, atomic settings writer
251
251
  There is no project or environment override.
252
252
 
253
253
  With `debug: true`, reports show local initialization after recovery and settings resolution, then background work when it ends.
254
+ The report shows one line per stage, followed by a total.
254
255
  TUI reports are stored as custom session entries, so they remain in the transcript after `/reload` and later notifications without entering model context.
255
256
  RPC reports remain notifications.
256
257
  When Continuous sync is enabled, the background report covers its first cycle rather than the separate one-shot startup check; later polls and same-session idle resumes do not publish more timing reports.
@@ -524,15 +525,19 @@ No Pi core changes or other extension are required.
524
525
 
525
526
  ### Daemon lifetime and unattended permission
526
527
 
527
- Pi starts or connects to the `sync-daemon` service from `@narumitw/sync-daemon` only for configured interactive work or an explicit setup/command. The service is a normal dependency, not another Pi extension. Unconfigured reads create no service or settings. Closing Pi releases its tasks, not the daemon; no OS service is installed.
528
+ Pi starts or connects to the `pi-sync-daemon` service from `@narumitw/pi-sync-daemon` only for configured interactive work or an explicit setup/command. The service is a normal dependency, not another Pi extension. Unconfigured reads create no service or settings. The daemon owns the shared lifetime decision; no OS service is installed.
529
+
530
+ When no registered live client PID remains for that canonical agent directory and no valid explicit after-exit grant covers the active setup, a fixed 30-second grace period starts. Explicit CLI start without clients follows the same rule. Live passive, disconnected, publishing, and orderly retired PIDs keep the service alive. Detach, heartbeat loss, and an empty active-participant list are not proof of exit. `/reload`, `/new`, fork, and resume preserve shared ownership while their Pi process remains alive. A client arriving before shutdown becomes final cancels automatic exit. There is no new setting, environment variable, or keep-alive flag.
531
+
532
+ After grace, the service stops new automatic work, cancels cancellable work, and drains committed writes, monitor work, queue-release acknowledgements, persistence, and owned callbacks before safe exit. Closing adds no final sync or model request and preserves journals, backups, request accounting, and existing transfer permissions. The next eligible interactive client or explicit command can restart through singleton startup only after the old owner's exit is proven. Print/JSON never launch a service; they can attach passively to an existing owner to protect their sessions and pause automatic work.
528
533
 
529
534
  Before the first daemon-owned mutation, close or upgrade older Pi processes and review `/sync daemon handover`. An absent lock does not prove that an idle older process is absent. Settings and existing state/snapshot formats remain authoritative in the same locations; Pi proposes settings changes and the daemon serializes their publication.
530
535
 
531
- Existing Automatic, Autonomous, and Continuous consent does not authorize zero-client work. `/sync daemon allow-after-exit` requires Autonomous and Continuous to be enabled, then separately reviews the setup, selected private content, recurring costs, and independently available provider/model. `/sync daemon revoke-after-exit` stops new unattended work. Setup changes invalidate the saved digest. Changing an interactive client’s model, working directory, or session-directory binding revokes older unattended grants; reverting that binding does not restore them. Reopen the review to grant permission again.
536
+ Existing Automatic, Autonomous, and Continuous consent does not authorize zero-client work. `/sync daemon allow-after-exit` requires Autonomous and Continuous to be enabled, then separately reviews the setup, selected private content, recurring costs, and independently available provider/model. `/sync daemon revoke-after-exit` stops new unattended work. Setup changes invalidate the saved digest. Changing an interactive client’s model, working directory, or session-directory binding revokes older unattended grants; reverting that binding does not restore them. Reopen the review to grant permission again. A valid grant for the active setup keeps service lifetime under the existing fingerprint and binding rules without granting new work permissions. A grant for another setup, a revoked grant, or a stale fingerprint does not. Temporary provider or backend unavailability does not itself revoke a valid grant. Lifetime checks do not call a model, contact a provider or storage, or execute credential commands.
532
537
 
533
538
  The standalone model host uses the agent-root `auth.json`/`models.json` through public Pi SDK APIs and the environment captured at service launch. Credential commands run non-interactively from the canonical agent root. Parent-only providers/accounts and runtime keys are not copied; unavailable capabilities retain conflicts rather than selecting a fallback. Restart after changing the service environment. Neither the parent conversation nor its tools are sent to the resolver.
534
539
 
535
- A failed consent write blocks automatic work in that service instance. Repair persistence and revoke permission before an explicit restart; do not assume a failed write changed the retained consent file. `stop` and `restart` drain compatible work and never replace an uncertain or incompatible live owner silently. See [migration, diagnostics, and rollback](https://github.com/narumiruna/pi-extensions/blob/main/packages/pi-sync/docs/daemon-migration.md).
540
+ A failed consent write blocks automatic work in that service instance. Uncertain consent publication, failed revocation, or cleanup failure keeps the owner paused with evidence retained. Automatic exit or implicit restart must not clear that barrier and restore an older persisted grant. Repair persistence and use the existing repair/revocation path before an explicit restart; do not assume a failed write changed the retained consent file. Cleanup failure is not successful exit. `stop` and `restart` drain compatible work and never replace an uncertain or incompatible live owner silently. See [migration, diagnostics, and rollback](https://github.com/narumiruna/pi-extensions/blob/main/packages/pi-sync/docs/daemon-migration.md).
536
541
 
537
542
  ### Continuous sync
538
543
 
@@ -557,7 +562,7 @@ Turning Autonomous sync off also stops monitoring; a saved Continuous sync On va
557
562
  A control-file change during monitoring is detected by a watcher or the five-second local control check.
558
563
  If monitoring is already off, external enablement requires the next session start or a foreground `/sync` command.
559
564
  Print/JSON do not launch a service. If one already exists, they attach passive session facts and pause its automatic work until that client leaves.
560
- The service survives ordinary Pi exit; work with zero clients needs the separate permission below.
565
+ Service lifetime follows the [30-second grace and active-setup after-exit exception](#daemon-lifetime-and-unattended-permission); zero-client work still needs that separate permission.
561
566
 
562
567
  Upgrade all Pi processes sharing an agent directory before enabling Continuous sync.
563
568
  Older releases do not implement its election or automatic accounting.
@@ -1,2 +1,2 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/backend-factory";
2
- export { createSyncBackend } from "@narumitw/sync-daemon/engine/backends/backend-factory";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/backend-factory";
2
+ export { createSyncBackend } from "@narumitw/pi-sync-daemon/engine/backends/backend-factory";
@@ -1,5 +1,5 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/backend-identity";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/backend-identity";
2
2
  export {
3
3
  backendIdentityCoordinates,
4
4
  normalizeEndpointIdentity,
5
- } from "@narumitw/sync-daemon/engine/backends/backend-identity";
5
+ } from "@narumitw/pi-sync-daemon/engine/backends/backend-identity";
@@ -1 +1 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/backend-types";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/backend-types";
@@ -1,6 +1,6 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/git/git-backend";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/git/git-backend";
2
2
  export {
3
3
  GitSyncBackend,
4
4
  gitBackendIdentity,
5
5
  isSupportedGitVersion,
6
- } from "@narumitw/sync-daemon/engine/backends/git/git-backend";
6
+ } from "@narumitw/pi-sync-daemon/engine/backends/git/git-backend";
@@ -1,8 +1,8 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/git/git-config";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/git/git-config";
2
2
  export {
3
3
  normalizeGitBranch,
4
4
  normalizeGitDirectory,
5
5
  normalizeGitRemote,
6
6
  normalizeGitRemoteIdentity,
7
7
  validateGitNamespace,
8
- } from "@narumitw/sync-daemon/engine/backends/git/git-config";
8
+ } from "@narumitw/pi-sync-daemon/engine/backends/git/git-config";
@@ -1,7 +1,7 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/git/git-runner";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/git/git-runner";
2
2
  export {
3
3
  GitCommandError,
4
4
  parseGitBlobBatch,
5
5
  readGitBlobs,
6
6
  runGit,
7
- } from "@narumitw/sync-daemon/engine/backends/git/git-runner";
7
+ } from "@narumitw/pi-sync-daemon/engine/backends/git/git-runner";
@@ -1,4 +1,4 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/git/git-storage";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/git/git-storage";
2
2
  export {
3
3
  GIT_MANIFEST_VERSION,
4
4
  isGitPayloadSizeAllowed,
@@ -11,4 +11,4 @@ export {
11
11
  requireGitManifest,
12
12
  validateGitPublicationTree,
13
13
  validateGitSnapshot,
14
- } from "@narumitw/sync-daemon/engine/backends/git/git-storage";
14
+ } from "@narumitw/pi-sync-daemon/engine/backends/git/git-storage";
@@ -1,4 +1,4 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/s3/s3-backend";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/s3/s3-backend";
2
2
  export {
3
3
  encodeKey,
4
4
  historyKey,
@@ -8,4 +8,4 @@ export {
8
8
  s3BackendIdentity,
9
9
  snapshotKey,
10
10
  storageRoot,
11
- } from "@narumitw/sync-daemon/engine/backends/s3/s3-backend";
11
+ } from "@narumitw/pi-sync-daemon/engine/backends/s3/s3-backend";
@@ -1,2 +1,6 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/s3/s3-client";
2
- export { S3Client, S3HttpError, S3ObjectAlreadyExistsError } from "@narumitw/sync-daemon/engine/backends/s3/s3-client";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/s3/s3-client";
2
+ export {
3
+ S3Client,
4
+ S3HttpError,
5
+ S3ObjectAlreadyExistsError,
6
+ } from "@narumitw/pi-sync-daemon/engine/backends/s3/s3-client";
@@ -1,2 +1,2 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/s3/s3-conditions";
2
- export { requireS3Etag, verifyS3Conditions } from "@narumitw/sync-daemon/engine/backends/s3/s3-conditions";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/s3/s3-conditions";
2
+ export { requireS3Etag, verifyS3Conditions } from "@narumitw/pi-sync-daemon/engine/backends/s3/s3-conditions";
@@ -1,2 +1,2 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/snapshot-pointer";
2
- export { createLatestPointer, remoteHistoryEntry } from "@narumitw/sync-daemon/engine/backends/snapshot-pointer";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/snapshot-pointer";
2
+ export { createLatestPointer, remoteHistoryEntry } from "@narumitw/pi-sync-daemon/engine/backends/snapshot-pointer";
@@ -1,6 +1,6 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/sync-backend";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/sync-backend";
2
2
  export {
3
3
  expectedRemoteHead,
4
4
  SyncBackendConflictError,
5
5
  SyncBackendPublicationOutcomeUnknownError,
6
- } from "@narumitw/sync-daemon/engine/backends/sync-backend";
6
+ } from "@narumitw/pi-sync-daemon/engine/backends/sync-backend";
@@ -1,4 +1,4 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/webdav/webdav-backend";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/webdav/webdav-backend";
2
2
  export {
3
3
  historyPath,
4
4
  latestPath,
@@ -7,4 +7,4 @@ export {
7
7
  snapshotsPath,
8
8
  WebDavSyncBackend,
9
9
  webDavBackendIdentity,
10
- } from "@narumitw/sync-daemon/engine/backends/webdav/webdav-backend";
10
+ } from "@narumitw/pi-sync-daemon/engine/backends/webdav/webdav-backend";
@@ -1,6 +1,6 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/webdav/webdav-client";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/webdav/webdav-client";
2
2
  export {
3
3
  WebDavClient,
4
4
  WebDavHttpError,
5
5
  WebDavPreconditionError,
6
- } from "@narumitw/sync-daemon/engine/backends/webdav/webdav-client";
6
+ } from "@narumitw/pi-sync-daemon/engine/backends/webdav/webdav-client";
@@ -1,8 +1,8 @@
1
- export type * from "@narumitw/sync-daemon/engine/backends/webdav/webdav-config";
1
+ export type * from "@narumitw/pi-sync-daemon/engine/backends/webdav/webdav-config";
2
2
  export {
3
3
  normalizeWebDavIdentityUrl,
4
4
  normalizeWebDavPath,
5
5
  normalizeWebDavUrl,
6
6
  validateWebDavCredentials,
7
7
  validateWebDavNamespace,
8
- } from "@narumitw/sync-daemon/engine/backends/webdav/webdav-config";
8
+ } from "@narumitw/pi-sync-daemon/engine/backends/webdav/webdav-config";
@@ -104,9 +104,9 @@ export async function executeCommand(
104
104
  options.signal,
105
105
  );
106
106
  } else if (action === "status") {
107
- const connection = await client.connect();
107
+ const connection = await client.verifyConnection(options.signal);
108
108
  ctx.ui.notify(
109
- `sync-daemon: connected\nPID: ${connection.identity.pid}\nInstance: ${connection.identity.instance}\nUse sync-daemon status/stop/restart --root <agent-directory> for explicit lifecycle control.`,
109
+ `pi-sync-daemon: connected\nPID: ${connection.identity.pid}\nInstance: ${connection.identity.instance}\nUse pi-sync-daemon status/stop/restart --root <agent-directory> for explicit lifecycle control.`,
110
110
  "info",
111
111
  );
112
112
  } else throw new Error("Use /sync daemon status|handover|allow-after-exit|revoke-after-exit.");
@@ -73,11 +73,13 @@ export async function handleCommand(
73
73
  setSyncStatus(ctx, undefined);
74
74
  ctx.ui.notify(errorMessage(error), "error");
75
75
  }
76
+ if (sessionSignal.aborted) return;
76
77
  await reconcileObservation(attention, sessionSignal);
77
78
  if (!sessionSignal.aborted) await attention.publish(ctx, sessionSignal);
78
79
  return;
79
80
  }
80
81
  const result = await run(rawArgs);
82
+ if (sessionSignal.aborted) return;
81
83
  if (result.kind === "decision-required") {
82
84
  ctx.ui.notify(result.decision.directMessage, "error");
83
85
  } else if (result.kind === "remote-selection-required") {
@@ -258,7 +258,7 @@ export function usage() {
258
258
  `Automatic sync: ${AUTOMATIC_SYNC_DESCRIPTION}`,
259
259
  `Startup transfer: ${STARTUP_TRANSFER_DESCRIPTION}`,
260
260
  "Automatic transfer at startup is a separate opt-in: one conflict-free established-baseline transfer at idle in TUI/RPC, with conditional/lease publication and no resource reload.",
261
- "Continuous sync is a separate default-Off opt-in in Settings. It requires Autonomous sync and can incur recurring network/model costs. The service survives Pi exit, but zero-client work requires separately reviewed /sync daemon allow-after-exit permission. Safety blocks and durable automatic request limits remain.",
261
+ "Continuous sync is a separate default-Off opt-in in Settings. It requires Autonomous sync and can incur recurring network/model costs. After the last Pi exits, the service closes after a 30-second grace period unless a valid /sync daemon allow-after-exit grant applies. Zero-client work still requires that separate review. Safety blocks and durable automatic request limits remain.",
262
262
  "Settings: use /sync init or edit storage connections and sync setups in ~/.pi/agent/pi-sync.json (or the configured Pi agent directory). Version 1 and version 2 settings are unsupported and are never rewritten.",
263
263
  ].join("\n");
264
264
  }
@@ -1,7 +1,7 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import path from "node:path";
3
3
  import { withFileMutationQueue } from "@earendil-works/pi-coding-agent";
4
- import { withTargetQueues } from "@narumitw/sync-daemon/engine/snapshot/snapshot-mutation-queues";
4
+ import { withTargetQueues } from "@narumitw/pi-sync-daemon/engine/snapshot/snapshot-mutation-queues";
5
5
 
6
6
  interface Gate {
7
7
  token: string;