@narumitw/pi-sync 0.59.0 → 0.60.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +25 -17
- package/dist/chunks/{chunk-AMJRUXFT.ts → chunk-2JNFEZ3V.ts} +2 -6
- package/dist/chunks/{chunk-AMJRUXFT.ts.map → chunk-2JNFEZ3V.ts.map} +1 -1
- package/dist/chunks/{chunk-NGW4JMBF.ts → chunk-4RNCZZY7.ts} +33 -27
- package/dist/chunks/{chunk-NGW4JMBF.ts.map → chunk-4RNCZZY7.ts.map} +3 -3
- package/dist/chunks/{chunk-2ZZJXITS.ts → chunk-6LHIRS5R.ts} +30 -47
- package/dist/chunks/chunk-6LHIRS5R.ts.map +7 -0
- package/dist/chunks/{config-J5VZUY4J.ts → chunk-7AC2RX4M.ts} +6 -13
- package/dist/chunks/chunk-7AC2RX4M.ts.map +7 -0
- package/dist/chunks/{chunk-76HID27T.ts → chunk-BGGKHHO4.ts} +18 -14
- package/dist/chunks/{chunk-76HID27T.ts.map → chunk-BGGKHHO4.ts.map} +1 -1
- package/dist/chunks/chunk-BWWTOQOW.ts +737 -0
- package/dist/chunks/chunk-BWWTOQOW.ts.map +7 -0
- package/dist/chunks/chunk-CEMFCWIU.ts +20 -0
- package/dist/chunks/chunk-CEMFCWIU.ts.map +7 -0
- package/dist/chunks/chunk-CZNBKIM5.ts +20 -0
- package/dist/chunks/chunk-CZNBKIM5.ts.map +7 -0
- package/dist/chunks/{chunk-YIPK23JW.ts → chunk-ENFHHB5O.ts} +1 -16
- package/dist/chunks/{chunk-YIPK23JW.ts.map → chunk-ENFHHB5O.ts.map} +1 -1
- package/dist/chunks/{chunk-KHBPED6W.ts → chunk-GSQGBVKG.ts} +2 -2
- package/dist/chunks/chunk-HNKLBM3U.ts +18 -0
- package/dist/chunks/chunk-HNKLBM3U.ts.map +7 -0
- package/dist/chunks/{chunk-QPC5HT3A.ts → chunk-J5COV5TY.ts} +21 -2
- package/dist/chunks/chunk-J5COV5TY.ts.map +7 -0
- package/dist/chunks/chunk-JKBUYCPC.ts +52 -0
- package/dist/chunks/chunk-JKBUYCPC.ts.map +7 -0
- package/dist/chunks/chunk-JZKCOM62.ts +26 -0
- package/dist/chunks/chunk-JZKCOM62.ts.map +7 -0
- package/dist/chunks/chunk-M7RHV3H6.ts +33 -0
- package/dist/chunks/chunk-M7RHV3H6.ts.map +7 -0
- package/dist/chunks/chunk-NPT2G4FU.ts +15 -0
- package/dist/chunks/chunk-NPT2G4FU.ts.map +7 -0
- package/dist/chunks/chunk-PDBTD2K6.ts +11 -0
- package/dist/chunks/chunk-PDBTD2K6.ts.map +7 -0
- package/dist/chunks/chunk-UBE6XWOM.ts +29 -0
- package/dist/chunks/chunk-UBE6XWOM.ts.map +7 -0
- package/dist/chunks/{chunk-PQ75RPUP.ts → chunk-UZUUUY7C.ts} +8 -8
- package/dist/chunks/chunk-VZCWYXRS.ts +23 -0
- package/dist/chunks/chunk-VZCWYXRS.ts.map +7 -0
- package/dist/chunks/{chunk-DTPELCPW.ts → chunk-YWEYRRQI.ts} +45 -37
- package/dist/chunks/chunk-YWEYRRQI.ts.map +7 -0
- package/dist/chunks/{chunk-ECYCNZOE.ts → chunk-ZMNVNECV.ts} +5 -1
- package/dist/chunks/chunk-ZMNVNECV.ts.map +7 -0
- package/dist/chunks/{command-handler-SDGKIQH2.ts → command-handler-FO4XBBHF.ts} +80 -86
- package/dist/chunks/command-handler-FO4XBBHF.ts.map +7 -0
- package/dist/chunks/conflict-review-XBSME2ER.ts +18 -0
- package/dist/chunks/conflict-review-XBSME2ER.ts.map +7 -0
- package/dist/chunks/{continuous-record-OM64J27R.ts → continuous-record-ZHUXVO4E.ts} +5 -13
- package/dist/chunks/continuous-record-ZHUXVO4E.ts.map +7 -0
- package/dist/chunks/continuous-storage-SQBAXACF.ts +27 -0
- package/dist/chunks/continuous-storage-SQBAXACF.ts.map +7 -0
- package/dist/chunks/{file-selection-7HEVPO4T.ts → file-selection-S6CNNNQI.ts} +11 -14
- package/dist/chunks/{file-selection-7HEVPO4T.ts.map → file-selection-S6CNNNQI.ts.map} +1 -1
- package/dist/chunks/manager-result-dispatcher-I2AMCCE7.ts +18 -0
- package/dist/chunks/{manager-ui-65ZETN6F.ts → manager-ui-AY5ZU6B4.ts} +180 -164
- package/dist/chunks/manager-ui-AY5ZU6B4.ts.map +7 -0
- package/dist/chunks/merge-review-SGDLMVS4.ts +10 -0
- package/dist/chunks/remote-selection-ui-GZHPDQ4L.ts +17 -0
- package/dist/chunks/{setup-switch-AB27ADDI.ts → setup-switch-M3BAFGJM.ts} +9 -13
- package/dist/chunks/{setup-wizard-5FILKFLQ.ts → setup-wizard-NFAWP4KF.ts} +18 -21
- package/dist/chunks/{setup-wizard-5FILKFLQ.ts.map → setup-wizard-NFAWP4KF.ts.map} +1 -1
- package/dist/chunks/{snapshot-G3W2GOGB.ts → snapshot-D4SFDP5J.ts} +8 -13
- package/dist/chunks/snapshot-D4SFDP5J.ts.map +7 -0
- package/dist/chunks/snapshot-transaction-directory-TNKBQ3UQ.ts +13 -0
- package/dist/chunks/snapshot-transaction-directory-TNKBQ3UQ.ts.map +7 -0
- package/dist/chunks/state-directory-JZSZVVPX.ts +17 -0
- package/dist/chunks/sync-inspection-BJ4KPPNO.ts +23 -0
- package/dist/chunks/sync-inspection-BJ4KPPNO.ts.map +7 -0
- package/dist/chunks/sync-operations-TLWER2TT.ts +45 -0
- package/dist/chunks/sync-operations-TLWER2TT.ts.map +7 -0
- package/dist/chunks/{sync-state-H4TFZZ7S.ts → sync-state-FVCJJ7MY.ts} +5 -11
- package/dist/chunks/sync-state-FVCJJ7MY.ts.map +7 -0
- package/dist/index.ts +269 -313
- package/dist/index.ts.map +4 -4
- package/docs/daemon-migration.md +93 -0
- package/docs/tui-contract.md +12 -0
- package/package.json +3 -6
- package/skills/configure-pi-sync/SKILL.md +1 -1
- package/skills/configure-pi-sync/references/configuration.md +19 -6
- package/src/backends/backend-factory.ts +2 -23
- package/src/backends/backend-identity.ts +5 -40
- package/src/backends/backend-types.ts +1 -81
- package/src/backends/git/git-backend.ts +6 -784
- package/src/backends/git/git-config.ts +8 -130
- package/src/backends/git/git-runner.ts +7 -255
- package/src/backends/git/git-storage.ts +14 -293
- package/src/backends/s3/s3-backend.ts +11 -523
- package/src/backends/s3/s3-client.ts +2 -399
- package/src/backends/s3/s3-conditions.ts +2 -67
- package/src/backends/snapshot-pointer.ts +2 -27
- package/src/backends/sync-backend.ts +6 -101
- package/src/backends/webdav/webdav-backend.ts +10 -622
- package/src/backends/webdav/webdav-client.ts +6 -370
- package/src/backends/webdav/webdav-config.ts +8 -82
- package/src/commands/command-execution.ts +40 -36
- package/src/commands/command.ts +23 -1
- package/src/daemon/apply-gate.ts +146 -0
- package/src/daemon/pi-client.ts +591 -0
- package/src/daemon/recovery.ts +103 -0
- package/src/paths.ts +12 -83
- package/src/settings/config-errors.ts +2 -6
- package/src/settings/config-file.ts +19 -693
- package/src/settings/config.ts +16 -263
- package/src/settings/settings-management.ts +11 -254
- package/src/settings/settings-store.ts +10 -48
- package/src/settings/settings-types.ts +1 -157
- package/src/settings/settings-validation.ts +17 -435
- package/src/snapshot/session-paths.ts +11 -111
- package/src/snapshot/snapshot-apply.ts +9 -322
- package/src/snapshot/snapshot-case-replacement.ts +6 -80
- package/src/snapshot/snapshot-codec.ts +2 -59
- package/src/snapshot/snapshot-exclude-safety.ts +2 -44
- package/src/snapshot/snapshot-mutation-queues.ts +6 -142
- package/src/snapshot/snapshot-paths.ts +2 -11
- package/src/snapshot/snapshot-root-transition.ts +6 -154
- package/src/snapshot/snapshot-transaction-directory.ts +5 -16
- package/src/snapshot/snapshot-transaction-plan.ts +2 -72
- package/src/snapshot/snapshot-transaction.ts +6 -946
- package/src/snapshot/snapshot-types.ts +1 -43
- package/src/snapshot/snapshot.ts +19 -447
- package/src/state/json-file.ts +2 -47
- package/src/state/lock-policy.ts +2 -2
- package/src/state/lock.ts +10 -292
- package/src/state/lockfile-fs.ts +2 -25
- package/src/state/merge-baseline-store.ts +8 -208
- package/src/state/mutation-directory-sync.ts +2 -34
- package/src/state/operation-availability.ts +7 -59
- package/src/state/state-directory.ts +8 -243
- package/src/state/state-types.ts +1 -25
- package/src/state/sync-state-store.ts +11 -75
- package/src/sync/agent-candidate.ts +7 -256
- package/src/sync/agent-plan.ts +2 -107
- package/src/sync/agent-policy.ts +10 -13
- package/src/sync/agent-refusal-retry.ts +2 -54
- package/src/sync/agent-request.ts +2 -19
- package/src/sync/agent-runner.ts +2 -191
- package/src/sync/agent-store.ts +7 -182
- package/src/sync/agent-sync.ts +2 -141
- package/src/sync/apply-review.ts +2 -63
- package/src/sync/automatic-sync.ts +55 -111
- package/src/sync/conflict-artifact-ownership.ts +2 -63
- package/src/sync/conflict-artifacts.ts +8 -195
- package/src/sync/conflict-groups.ts +2 -68
- package/src/sync/conflict-preview.ts +2 -56
- package/src/sync/conflict-resolution.ts +2 -93
- package/src/sync/conflict-retention.ts +2 -72
- package/src/sync/conflict-review.ts +3 -92
- package/src/sync/content-conflicts.ts +2 -73
- package/src/sync/continuous-errors.ts +7 -85
- package/src/sync/continuous-lease.ts +2 -216
- package/src/sync/continuous-record.ts +10 -261
- package/src/sync/continuous-storage.ts +12 -64
- package/src/sync/continuous-sync.ts +2 -563
- package/src/sync/continuous-watch.ts +2 -61
- package/src/sync/exclude-policy.ts +6 -84
- package/src/sync/field-migration.ts +2 -39
- package/src/sync/file-merge-planner.ts +2 -143
- package/src/sync/json-document.ts +7 -184
- package/src/sync/local-field-policy.ts +2 -29
- package/src/sync/local-fields.ts +9 -119
- package/src/sync/merge-apply.ts +2 -439
- package/src/sync/merge-journal.ts +10 -228
- package/src/sync/merge-transfer-error.ts +2 -72
- package/src/sync/merged-sync.ts +2 -919
- package/src/sync/mutation-owner.ts +2 -22
- package/src/sync/package-merge.ts +2 -87
- package/src/sync/partial-progress.ts +2 -55
- package/src/sync/remote-snapshot.ts +7 -79
- package/src/sync/session-merge.ts +2 -194
- package/src/sync/settings-conflicts.ts +2 -64
- package/src/sync/settings-merge.ts +6 -121
- package/src/sync/signals.ts +2 -8
- package/src/sync/startup-check.ts +15 -31
- package/src/sync/startup-timings.ts +2 -94
- package/src/sync/sync-decision.ts +3 -111
- package/src/sync/sync-error-guidance.ts +2 -46
- package/src/sync/sync-errors.ts +7 -23
- package/src/sync/sync-inspection.ts +10 -59
- package/src/sync/sync-local.ts +2 -44
- package/src/sync/sync-mutations.ts +10 -788
- package/src/sync/sync-operations.ts +32 -11
- package/src/sync/sync-policy.ts +34 -474
- package/src/sync/sync-queries.ts +2 -247
- package/src/sync/sync-state.ts +18 -157
- package/src/sync/text-merge.ts +10 -133
- package/src/sync-extension.ts +192 -142
- package/src/ui/manager-state.ts +35 -23
- package/src/ui/manager-ui.ts +80 -36
- package/src/ui/sync-attention.ts +7 -49
- package/dist/chunks/agent-candidate-ZHN7FTZT.ts +0 -30
- package/dist/chunks/agent-plan-ILFEUJ2E.ts +0 -124
- package/dist/chunks/agent-plan-ILFEUJ2E.ts.map +0 -7
- package/dist/chunks/agent-refusal-retry-HRMHCX2A.ts +0 -73
- package/dist/chunks/agent-refusal-retry-HRMHCX2A.ts.map +0 -7
- package/dist/chunks/agent-runner-FCRV2Z75.ts +0 -185
- package/dist/chunks/agent-runner-FCRV2Z75.ts.map +0 -7
- package/dist/chunks/agent-store-CCKN4DPR.ts +0 -175
- package/dist/chunks/agent-store-CCKN4DPR.ts.map +0 -7
- package/dist/chunks/agent-sync-EGA2I5W7.ts +0 -22
- package/dist/chunks/chunk-25QCU3LY.ts +0 -220
- package/dist/chunks/chunk-25QCU3LY.ts.map +0 -7
- package/dist/chunks/chunk-2JZFHNLM.ts +0 -113
- package/dist/chunks/chunk-2JZFHNLM.ts.map +0 -7
- package/dist/chunks/chunk-2UKUKIBI.ts +0 -25
- package/dist/chunks/chunk-2UKUKIBI.ts.map +0 -7
- package/dist/chunks/chunk-2ZZJXITS.ts.map +0 -7
- package/dist/chunks/chunk-3JTZF7Z5.ts +0 -77
- package/dist/chunks/chunk-3JTZF7Z5.ts.map +0 -7
- package/dist/chunks/chunk-3ST7RSYN.ts +0 -21
- package/dist/chunks/chunk-3ST7RSYN.ts.map +0 -7
- package/dist/chunks/chunk-4NVHHDN2.ts +0 -61
- package/dist/chunks/chunk-4NVHHDN2.ts.map +0 -7
- package/dist/chunks/chunk-5SFMBY5P.ts +0 -26
- package/dist/chunks/chunk-5SFMBY5P.ts.map +0 -7
- package/dist/chunks/chunk-6OFMB6KK.ts +0 -215
- package/dist/chunks/chunk-6OFMB6KK.ts.map +0 -7
- package/dist/chunks/chunk-6XU5HZAN.ts +0 -205
- package/dist/chunks/chunk-6XU5HZAN.ts.map +0 -7
- package/dist/chunks/chunk-6YGRZSCN.ts +0 -128
- package/dist/chunks/chunk-6YGRZSCN.ts.map +0 -7
- package/dist/chunks/chunk-7D5SF7P3.ts +0 -29
- package/dist/chunks/chunk-7D5SF7P3.ts.map +0 -7
- package/dist/chunks/chunk-7WYF2KUO.ts +0 -1161
- package/dist/chunks/chunk-7WYF2KUO.ts.map +0 -7
- package/dist/chunks/chunk-APDNHB2T.ts +0 -2037
- package/dist/chunks/chunk-APDNHB2T.ts.map +0 -7
- package/dist/chunks/chunk-AR2DGDUI.ts +0 -55
- package/dist/chunks/chunk-AR2DGDUI.ts.map +0 -7
- package/dist/chunks/chunk-DT7M4VQS.ts +0 -69
- package/dist/chunks/chunk-DT7M4VQS.ts.map +0 -7
- package/dist/chunks/chunk-DTPELCPW.ts.map +0 -7
- package/dist/chunks/chunk-ECYCNZOE.ts.map +0 -7
- package/dist/chunks/chunk-FHE2DCA2.ts +0 -61
- package/dist/chunks/chunk-FHE2DCA2.ts.map +0 -7
- package/dist/chunks/chunk-G4RUXRWZ.ts +0 -48
- package/dist/chunks/chunk-G4RUXRWZ.ts.map +0 -7
- package/dist/chunks/chunk-ILXMZ2HU.ts +0 -58
- package/dist/chunks/chunk-ILXMZ2HU.ts.map +0 -7
- package/dist/chunks/chunk-LA3HQMFG.ts +0 -115
- package/dist/chunks/chunk-LA3HQMFG.ts.map +0 -7
- package/dist/chunks/chunk-M6VQJIOU.ts +0 -54
- package/dist/chunks/chunk-M6VQJIOU.ts.map +0 -7
- package/dist/chunks/chunk-MKC3PXCN.ts +0 -369
- package/dist/chunks/chunk-MKC3PXCN.ts.map +0 -7
- package/dist/chunks/chunk-OQBE2OMB.ts +0 -88
- package/dist/chunks/chunk-OQBE2OMB.ts.map +0 -7
- package/dist/chunks/chunk-P3YD4ONV.ts +0 -123
- package/dist/chunks/chunk-P3YD4ONV.ts.map +0 -7
- package/dist/chunks/chunk-PRUEIIK7.ts +0 -24
- package/dist/chunks/chunk-PRUEIIK7.ts.map +0 -7
- package/dist/chunks/chunk-PWMWOJP4.ts +0 -17
- package/dist/chunks/chunk-PWMWOJP4.ts.map +0 -7
- package/dist/chunks/chunk-QPC5HT3A.ts.map +0 -7
- package/dist/chunks/chunk-QQVK2XFC.ts +0 -64
- package/dist/chunks/chunk-QQVK2XFC.ts.map +0 -7
- package/dist/chunks/chunk-RDOX3VH5.ts +0 -140
- package/dist/chunks/chunk-RDOX3VH5.ts.map +0 -7
- package/dist/chunks/chunk-S7D6XWHI.ts +0 -258
- package/dist/chunks/chunk-S7D6XWHI.ts.map +0 -7
- package/dist/chunks/chunk-SHPNS7FM.ts +0 -64
- package/dist/chunks/chunk-SHPNS7FM.ts.map +0 -7
- package/dist/chunks/chunk-SWRVXVFD.ts +0 -248
- package/dist/chunks/chunk-SWRVXVFD.ts.map +0 -7
- package/dist/chunks/chunk-T2SJD3N7.ts +0 -99
- package/dist/chunks/chunk-T2SJD3N7.ts.map +0 -7
- package/dist/chunks/chunk-T2TYBLXK.ts +0 -27
- package/dist/chunks/chunk-T2TYBLXK.ts.map +0 -7
- package/dist/chunks/chunk-UZSDS4HF.ts +0 -403
- package/dist/chunks/chunk-UZSDS4HF.ts.map +0 -7
- package/dist/chunks/chunk-VPODHKOX.ts +0 -229
- package/dist/chunks/chunk-VPODHKOX.ts.map +0 -7
- package/dist/chunks/chunk-WEKGW7HV.ts +0 -162
- package/dist/chunks/chunk-WEKGW7HV.ts.map +0 -7
- package/dist/chunks/chunk-WUHRVSWI.ts +0 -369
- package/dist/chunks/chunk-WUHRVSWI.ts.map +0 -7
- package/dist/chunks/chunk-X7R6DCVF.ts +0 -28
- package/dist/chunks/chunk-X7R6DCVF.ts.map +0 -7
- package/dist/chunks/chunk-XJHQPB3E.ts +0 -107
- package/dist/chunks/chunk-XJHQPB3E.ts.map +0 -7
- package/dist/chunks/chunk-XZ3ZTHKR.ts +0 -1184
- package/dist/chunks/chunk-XZ3ZTHKR.ts.map +0 -7
- package/dist/chunks/chunk-YDVQYUHE.ts +0 -34
- package/dist/chunks/chunk-YDVQYUHE.ts.map +0 -7
- package/dist/chunks/chunk-YEULK7MK.ts +0 -415
- package/dist/chunks/chunk-YEULK7MK.ts.map +0 -7
- package/dist/chunks/chunk-YHT4YTYG.ts +0 -31
- package/dist/chunks/chunk-YHT4YTYG.ts.map +0 -7
- package/dist/chunks/chunk-ZW5ZLGBI.ts +0 -154
- package/dist/chunks/chunk-ZW5ZLGBI.ts.map +0 -7
- package/dist/chunks/command-handler-SDGKIQH2.ts.map +0 -7
- package/dist/chunks/conflict-artifacts-MYSH3L2J.ts +0 -33
- package/dist/chunks/conflict-review-J6ZSPNWL.ts +0 -190
- package/dist/chunks/conflict-review-J6ZSPNWL.ts.map +0 -7
- package/dist/chunks/continuous-sync-BH5SWIRV.ts +0 -590
- package/dist/chunks/continuous-sync-BH5SWIRV.ts.map +0 -7
- package/dist/chunks/git-backend-6CKI6CUG.ts +0 -1074
- package/dist/chunks/git-backend-6CKI6CUG.ts.map +0 -7
- package/dist/chunks/local-fields-SR7PH66U.ts +0 -27
- package/dist/chunks/local-fields-SR7PH66U.ts.map +0 -7
- package/dist/chunks/manager-result-dispatcher-CXUP5WDP.ts +0 -33
- package/dist/chunks/manager-result-dispatcher-CXUP5WDP.ts.map +0 -7
- package/dist/chunks/manager-ui-65ZETN6F.ts.map +0 -7
- package/dist/chunks/merge-baseline-store-4Y2X7P2D.ts +0 -26
- package/dist/chunks/merge-baseline-store-4Y2X7P2D.ts.map +0 -7
- package/dist/chunks/remote-selection-ui-W55BQDJQ.ts +0 -32
- package/dist/chunks/remote-selection-ui-W55BQDJQ.ts.map +0 -7
- package/dist/chunks/s3-backend-FDK7JSDQ.ts +0 -845
- package/dist/chunks/s3-backend-FDK7JSDQ.ts.map +0 -7
- package/dist/chunks/setup-switch-AB27ADDI.ts.map +0 -7
- package/dist/chunks/snapshot-G3W2GOGB.ts.map +0 -7
- package/dist/chunks/snapshot-transaction-SGRUWT73.ts +0 -25
- package/dist/chunks/snapshot-transaction-SGRUWT73.ts.map +0 -7
- package/dist/chunks/sync-inspection-MDYHZHT7.ts +0 -26
- package/dist/chunks/sync-inspection-MDYHZHT7.ts.map +0 -7
- package/dist/chunks/sync-operations-ZAUP65FH.ts +0 -1032
- package/dist/chunks/sync-operations-ZAUP65FH.ts.map +0 -7
- package/dist/chunks/sync-state-H4TFZZ7S.ts.map +0 -7
- package/dist/chunks/webdav-backend-UNMIAXM5.ts +0 -852
- package/dist/chunks/webdav-backend-UNMIAXM5.ts.map +0 -7
- /package/dist/chunks/{chunk-KHBPED6W.ts.map → chunk-GSQGBVKG.ts.map} +0 -0
- /package/dist/chunks/{chunk-PQ75RPUP.ts.map → chunk-UZUUUY7C.ts.map} +0 -0
- /package/dist/chunks/{agent-candidate-ZHN7FTZT.ts.map → manager-result-dispatcher-I2AMCCE7.ts.map} +0 -0
- /package/dist/chunks/{agent-sync-EGA2I5W7.ts.map → merge-review-SGDLMVS4.ts.map} +0 -0
- /package/dist/chunks/{config-J5VZUY4J.ts.map → remote-selection-ui-GZHPDQ4L.ts.map} +0 -0
- /package/dist/chunks/{conflict-artifacts-MYSH3L2J.ts.map → setup-switch-M3BAFGJM.ts.map} +0 -0
- /package/dist/chunks/{continuous-record-OM64J27R.ts.map → state-directory-JZSZVVPX.ts.map} +0 -0
package/dist/index.ts.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/settings/config-errors.ts", "../src/sync/automatic-sync.ts", "../src/sync/startup-check.ts", "../src/sync/sync-loaders.ts", "../src/ui/startup-timings-entry.ts", "../src/sync-extension.ts"],
|
|
4
|
-
"sourcesContent": ["export function isMissingConfigError(error: unknown) {\n return (\n error instanceof Error &&\n (error.message.startsWith(\"Missing pi-sync settings.\") || error.message === \"No sync setups are configured.\")\n );\n}\n", "import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { setSyncSetupCompletions } from \"../commands/command.js\";\nimport type { CommandOptions } from \"../commands/command-types.js\";\nimport { loadConfig, loadPartialConfig } from \"../settings/config.js\";\nimport { isMissingConfigError } from \"../settings/config-errors.js\";\nimport { consumeLocalConfigMigrationNotice } from \"../settings/config-file.js\";\nimport { readLocalConfigObject } from \"../settings/settings-store.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { sessionDirFromContext, snapshotOptionsForContext } from \"../snapshot/session-paths.js\";\nimport { pendingTransactionEntries } from \"../snapshot/snapshot-transaction-directory.js\";\nimport { withLock } from \"../state/lock.js\";\nimport { stateDirectoryMigrationNotice } from \"../state/state-directory.js\";\nimport { ensureStateDir, readStateForConfig } from \"../state/sync-state-store.js\";\nimport { configureSyncStatus, setSyncStatus } from \"../ui/sync-status.js\";\nimport { safeTerminalText } from \"../ui/terminal-text.js\";\nimport { captureMutationOwner } from \"./mutation-owner.js\";\nimport { throwIfAborted } from \"./signals.js\";\nimport { createStartupTimings, type StartupTimingPublisher } from \"./startup-timings.js\";\nimport { errorMessage } from \"./sync-errors.js\";\nimport type { SyncLoaders } from \"./sync-loaders.js\";\nimport { syncSessionsSelected } from \"./sync-policy.js\";\n\nconst AUTO_SYNC_OPTIONS: CommandOptions = {\n yes: true,\n force: false,\n stale: false,\n silent: true,\n reload: false,\n auto: true,\n args: [],\n};\n\nexport async function startSession(\n ctx: ExtensionContext,\n signal: AbortSignal,\n publish?: StartupTimingPublisher,\n): Promise<{ debug: boolean; config?: AnySyncConfig } | undefined> {\n const timings = createStartupTimings(publish);\n let debug = false;\n let outcome: \"completed\" | \"stopped\" = \"stopped\";\n try {\n throwIfAborted(signal);\n const stateNotice = stateDirectoryMigrationNotice();\n if (stateNotice && ctx.hasUI) ctx.ui.notify(stateNotice, \"warning\");\n // Recovery can restore managed files: finish it before Pi accepts user edits.\n // Unlike remote inspection, it must never be detached behind startup.\n const validateMutation = captureMutationOwner(ctx, signal);\n const currentFile = ctx.sessionManager.getSessionFile?.();\n await timings.measure(\"transaction recovery\", async () => {\n const pending = await pendingTransactionEntries();\n validateMutation();\n if (!pending.some((entry) => entry.isDirectory())) return;\n // Normal startup needs only the directory probe, not the recovery/snapshot graph.\n const { recoverSnapshotTransactionsOnStartup } = await import(\"../snapshot/snapshot-transaction.js\");\n validateMutation();\n const recoverySettings = await readLocalConfigObject();\n validateMutation();\n const recoverySetup = recoverySettings?.activeSyncSetup;\n await recoverSnapshotTransactionsOnStartup({\n exclude: recoverySetup ? recoverySettings.syncSetups[recoverySetup]?.sync.exclude : undefined,\n signal,\n sessionDir: sessionDirFromContext(ctx),\n protectedTargets: currentFile ? [currentFile] : [],\n validateMutation,\n });\n });\n throwIfAborted(signal);\n try {\n const settings = await timings.measure(\"settings read\", () => readLocalConfigObject());\n throwIfAborted(signal);\n debug = settings?.debug ?? false;\n const names = settings ? Object.keys(settings.syncSetups).sort((left, right) => left.localeCompare(right)) : [];\n setSyncSetupCompletions(names);\n configureSyncStatus(ctx, settings?.showStatus ?? true);\n } catch {\n if (signal.aborted) return;\n setSyncSetupCompletions([]);\n }\n const migrationNotice = consumeLocalConfigMigrationNotice();\n if (migrationNotice && ctx.hasUI) ctx.ui.notify(migrationNotice, \"warning\");\n throwIfAborted(signal);\n if (!ctx.hasUI) return { debug };\n try {\n const config = await timings.measure(\"config resolution\", () => loadConfig());\n throwIfAborted(signal);\n configureSyncStatus(ctx, config.showStatus);\n outcome = \"completed\";\n return { debug, config };\n } catch (error) {\n throwIfAborted(signal);\n if (!isMissingConfigError(error)) {\n ctx.ui.notify(`pi-sync startup check skipped: ${safeTerminalText(errorMessage(error))}`, \"warning\");\n }\n }\n return { debug };\n } finally {\n timings.publish(ctx, debug, signal, \"local initialization\", outcome);\n }\n}\n\nexport async function autoPushSessions(ctx: ExtensionContext, signal: AbortSignal, loaders: SyncLoaders) {\n try {\n const partial = await loadPartialConfig();\n throwIfAborted(signal);\n if (!partial.automatic) return;\n if (!syncSessionsSelected(partial)) return;\n await ensureStateDir();\n throwIfAborted(signal);\n const config = await loadConfig();\n throwIfAborted(signal);\n if (!syncSessionsSelected(config)) return;\n const [operations, snapshotModule, syncStateModule] = await Promise.all([\n loaders.operations(),\n loaders.snapshot(),\n loaders.syncState(),\n ]);\n throwIfAborted(signal);\n await withLock(\"auto-session-push\", async () => {\n throwIfAborted(signal);\n const state = await readStateForConfig(config);\n throwIfAborted(signal);\n const local = await snapshotModule.createSnapshot(config.snapshotIdentity, {\n ...snapshotOptionsForContext(ctx, config),\n signal,\n });\n throwIfAborted(signal);\n if (!syncStateModule.hasLocalChanges(local, state, config)) return;\n await operations.push(ctx, { ...AUTO_SYNC_OPTIONS, signal }, { config, state, local });\n });\n } catch (error) {\n if (signal.aborted || isMissingConfigError(error)) return;\n setSyncStatus(ctx, undefined);\n ctx.ui.notify(`pi-sync session push skipped: ${errorMessage(error)}`, \"warning\");\n }\n}\n", "import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { loadConfigForCheck, syncCheckConfigFingerprint } from \"../settings/config.js\";\nimport { isMissingConfigError } from \"../settings/config-errors.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { snapshotOptionsForContext } from \"../snapshot/session-paths.js\";\nimport { withLock } from \"../state/lock.js\";\nimport { withStateDirectoryAccess } from \"../state/state-directory.js\";\nimport { readStateForConfig, syncStateFingerprint } from \"../state/sync-state-store.js\";\nimport type { SyncAttentionController } from \"../ui/sync-attention.js\";\nimport { setSyncStatus } from \"../ui/sync-status.js\";\nimport { safeTerminalText } from \"../ui/terminal-text.js\";\nimport { startupTransferEnabled } from \"./agent-policy.js\";\nimport { combineSignals, throwIfAborted } from \"./signals.js\";\nimport { createStartupTimings, type StartupTimingPublisher } from \"./startup-timings.js\";\nimport { errorMessage } from \"./sync-errors.js\";\nimport type { SyncLoaders } from \"./sync-loaders.js\";\n\n/** One owned task per extension session, never keyed by the shared headless UI. */\nexport function createStartupCheck(\n loaders: SyncLoaders,\n attention: SyncAttentionController,\n timeoutMs = 30_000,\n publish?: StartupTimingPublisher,\n) {\n let active:\n | {\n controller: AbortController;\n promise: Promise<void>;\n owner: ExtensionContext[\"sessionManager\"];\n transfer: boolean;\n }\n | undefined;\n\n let pending: { ctx: ExtensionContext; signal: AbortSignal; config: AnySyncConfig } | undefined;\n\n const controllerApi = {\n async interrupt(ctx: ExtensionContext) {\n const task = active;\n if (!task?.transfer || task.owner !== ctx.sessionManager) return;\n task.controller.abort(new DOMException(\"Agent became busy\", \"AbortError\"));\n await task.promise;\n },\n settled(ctx: ExtensionContext) {\n const queued = pending;\n if (!queued || queued.ctx.sessionManager !== ctx.sessionManager || queued.signal.aborted || !ctx.isIdle()) return;\n pending = undefined;\n controllerApi.start(ctx, queued.signal, queued.config);\n },\n start(ctx: ExtensionContext, sessionSignal: AbortSignal, initialConfig?: AnySyncConfig) {\n if (!ctx.hasUI || sessionSignal.aborted) return;\n if (initialConfig && startupTransferEnabled(initialConfig) && !ctx.isIdle()) {\n pending = { ctx, signal: sessionSignal, config: initialConfig };\n return;\n }\n if (active) throw new Error(\"Previous startup check has not been drained.\");\n const timings = createStartupTimings(publish);\n const controller = new AbortController();\n const signal = combineSignals(sessionSignal, controller.signal);\n const task = {\n controller,\n owner: ctx.sessionManager,\n promise: Promise.resolve(),\n transfer: Boolean(initialConfig && startupTransferEnabled(initialConfig)),\n };\n active = task;\n const isCurrent = () => !sessionSignal.aborted && active === task && task.owner === ctx.sessionManager;\n const timer = setTimeout(\n () => controller.abort(new DOMException(\"Startup check timed out\", \"TimeoutError\")),\n timeoutMs,\n );\n timer.unref();\n let config: AnySyncConfig | undefined;\n let checking = false;\n let stopped = false;\n // Handle every detached rejection here; Pi's awaited event runner cannot catch it.\n task.promise = Promise.resolve()\n .then(async () => {\n try {\n throwIfAborted(signal);\n config = initialConfig ?? (await loadConfigForCheck());\n task.transfer = startupTransferEnabled(config);\n throwIfAborted(signal);\n if (!config.automatic && !startupTransferEnabled(config)) return;\n const captured = config;\n const identity = syncCheckConfigFingerprint(captured);\n checking = true;\n setSyncStatus(ctx, \"sync ...\", { activity: \"checking\" });\n const { inspectSync } = await timings.measure(\"inspection import\", () => loaders.inspection());\n throwIfAborted(signal);\n const currentConfig = await loadConfigForCheck();\n throwIfAborted(signal);\n if (syncCheckConfigFingerprint(currentConfig) !== identity) return;\n // Lock order: state migration guard \u2192 sync operation \u2192 backend cache.\n // Read heads may write only private cache data. Never call doctor/syncBoth.\n const inspection = await timings.measure(\"inspection and guards\", () =>\n withStateDirectoryAccess(() => {\n throwIfAborted(signal);\n return withLock(\"startup-check\", () => {\n throwIfAborted(signal);\n return inspectSync(captured, snapshotOptionsForContext(ctx, captured), signal, undefined, timings);\n });\n }),\n );\n throwIfAborted(signal);\n const latest = await loadConfigForCheck();\n throwIfAborted(signal);\n if (syncCheckConfigFingerprint(latest) !== identity) return;\n const state = await withStateDirectoryAccess(() => readStateForConfig(latest));\n throwIfAborted(signal);\n if (syncStateFingerprint(state) !== inspection.stateIdentity || !isCurrent()) return;\n attention.observe({\n setupName: captured.setupName,\n configIdentity: identity,\n checkedAt: new Date().toISOString(),\n inspection,\n automaticTransfer: startupTransferEnabled(captured),\n });\n if (\n startupTransferEnabled(captured) &&\n !inspection.firstSync &&\n inspection.head &&\n inspection.selectionState?.kind === \"same\"\n ) {\n const [operations, { withAgentSyncLock }] = await timings.measure(\"operations import\", () =>\n Promise.all([loaders.operations(), import(\"./agent-sync.js\")]),\n );\n throwIfAborted(signal);\n if (!isCurrent()) return;\n if (!ctx.isIdle()) {\n pending = { ctx, signal: sessionSignal, config: captured };\n return;\n }\n await timings.measure(\"automatic transfer\", () =>\n withStateDirectoryAccess(() =>\n withAgentSyncLock(\n ctx,\n {\n args: [],\n yes: true,\n force: false,\n stale: false,\n silent: true,\n reload: false,\n auto: true,\n signal,\n startupTimings: timings,\n onCommit: () => attention.clearObservation(),\n },\n (options) => operations.syncBoth(ctx, options),\n ),\n ),\n );\n throwIfAborted(signal);\n if (!isCurrent()) return;\n attention.clearObservation();\n return;\n }\n attention.observe({\n setupName: captured.setupName,\n configIdentity: identity,\n checkedAt: new Date().toISOString(),\n inspection,\n automaticTransfer: startupTransferEnabled(captured),\n });\n if (ctx.mode === \"rpc\") attention.notifyObservation(ctx);\n } catch (error) {\n stopped = true;\n if (!isCurrent() || sessionSignal.aborted || isMissingConfigError(error)) return;\n if (signal.aborted && controller.signal.reason?.name !== \"TimeoutError\") return;\n // A settings edit invalidates failures as well as successful observations.\n if (config) {\n const latest = await loadConfigForCheck().catch(() => undefined);\n if (!isCurrent() || (signal.aborted && controller.signal.reason?.name !== \"TimeoutError\")) return;\n if (!latest || syncCheckConfigFingerprint(latest) !== syncCheckConfigFingerprint(config)) return;\n }\n ctx.ui.notify(\n config && startupTransferEnabled(config)\n ? `pi-sync automatic transfer stopped: ${safeTerminalText(errorMessage(error))}. Run /sync to review or reconcile retained recovery evidence. No resources were reloaded.`\n : `pi-sync startup check skipped: ${safeTerminalText(errorMessage(error))}. Run /sync status to retry. No startup transfer was performed.`,\n \"warning\",\n );\n } finally {\n clearTimeout(timer);\n if (isCurrent() && checking) {\n if (!signal.aborted || controller.signal.reason?.name === \"TimeoutError\") {\n const latest = await loadConfigForCheck().catch(() => undefined);\n if (isCurrent()) {\n if (signal.aborted && controller.signal.reason?.name !== \"TimeoutError\")\n setSyncStatus(ctx, undefined);\n else if (\n config &&\n latest &&\n syncCheckConfigFingerprint(latest) === syncCheckConfigFingerprint(config)\n )\n await attention.publish(ctx, sessionSignal);\n else attention.reset(ctx);\n }\n } else setSyncStatus(ctx, undefined);\n }\n if (isCurrent()) {\n timings.publish(\n ctx,\n config?.debug ?? false,\n sessionSignal,\n \"background startup\",\n signal.aborted || stopped ? \"stopped\" : \"completed\",\n );\n }\n if (active === task) active = undefined;\n }\n })\n .catch(() => {\n // UI teardown can itself throw. No unhandled rejection or retained timer.\n clearTimeout(timer);\n if (active === task) active = undefined;\n });\n },\n async stop() {\n pending = undefined;\n const task = active;\n if (!task) return;\n task.controller.abort(new DOMException(\"Startup check cancelled\", \"AbortError\"));\n // Drain the actual work, including child/ref cleanup, before foreground guards.\n await task.promise;\n },\n };\n return controllerApi;\n}\n", "type SetupSwitchModule = Pick<typeof import(\"./setup-switch.js\"), \"useSyncSetup\">;\ntype SnapshotModule = Pick<typeof import(\"../snapshot/snapshot.js\"), \"createSnapshot\">;\ntype SyncStateModule = Pick<typeof import(\"./sync-state.js\"), \"hasLocalChanges\">;\ntype SyncOperations = typeof import(\"./sync-operations.js\");\ntype CommandHandlerModule = Pick<typeof import(\"../commands/command-handler.js\"), \"handleCommand\">;\n\ntype SyncInspectionModule = Pick<typeof import(\"./sync-inspection.js\"), \"inspectSync\">;\n\nexport interface SyncDependencies {\n loadCommandHandler(): Promise<CommandHandlerModule>;\n loadSyncInspection(): Promise<SyncInspectionModule>;\n loadSetupSwitch(): Promise<SetupSwitchModule>;\n loadSnapshot(): Promise<SnapshotModule>;\n loadSyncState(): Promise<SyncStateModule>;\n loadSyncOperations(): Promise<SyncOperations>;\n}\n\nexport interface SyncLoaders {\n commands(): Promise<CommandHandlerModule>;\n inspection(): Promise<SyncInspectionModule>;\n setupSwitch(): Promise<SetupSwitchModule>;\n snapshot(): Promise<SnapshotModule>;\n syncState(): Promise<SyncStateModule>;\n operations(): Promise<SyncOperations>;\n}\n\nexport function createSyncLoaders(dependencies: Partial<SyncDependencies>): SyncLoaders {\n const loaders: SyncLoaders = {\n commands: cachedModuleLoader(dependencies.loadCommandHandler ?? (() => import(\"../commands/command-handler.js\"))),\n inspection: cachedModuleLoader(dependencies.loadSyncInspection ?? (() => import(\"./sync-inspection.js\"))),\n setupSwitch: cachedModuleLoader(dependencies.loadSetupSwitch ?? (() => import(\"./setup-switch.js\"))),\n snapshot: cachedModuleLoader(dependencies.loadSnapshot ?? (() => import(\"../snapshot/snapshot.js\"))),\n syncState: cachedModuleLoader(dependencies.loadSyncState ?? (() => import(\"./sync-state.js\"))),\n operations: cachedModuleLoader(dependencies.loadSyncOperations ?? (() => import(\"./sync-operations.js\"))),\n };\n return loaders;\n}\n\nfunction cachedModuleLoader<Module>(load: () => Promise<Module>): () => Promise<Module> {\n let pending: Promise<Module> | undefined;\n return () => {\n if (!pending) {\n pending = load().catch((error) => {\n pending = undefined;\n throw error;\n });\n }\n return pending;\n };\n}\n", "import type { ExtensionAPI } from \"@earendil-works/pi-coding-agent\";\nimport { Text, truncateToWidth } from \"@earendil-works/pi-tui\";\nimport type { StartupTimingPublisher } from \"../sync/startup-timings.js\";\nimport { safeTerminalText } from \"./terminal-text.js\";\n\nexport const STARTUP_TIMING_ENTRY = \"pi-sync-startup-timings\";\n\nexport interface StartupTimingEntry {\n version: 1;\n report: string;\n}\n\nexport function registerStartupTimings(pi: ExtensionAPI): StartupTimingPublisher {\n pi.registerEntryRenderer<StartupTimingEntry>(STARTUP_TIMING_ENTRY, (entry, _options, theme) => {\n const data = entry.data;\n if (data?.version !== 1 || typeof data.report !== \"string\") return undefined;\n const text = new Text(\n data.report\n .split(\"\\n\")\n .map((line, index) => theme.fg(index === 0 ? \"accent\" : \"muted\", safeTerminalText(line)))\n .join(\"\\n\"),\n 0,\n 0,\n );\n return {\n render: (width) => (width > 0 ? text.render(width).map((line) => truncateToWidth(line, width)) : []),\n invalidate: () => text.invalidate(),\n };\n });\n return (ctx, report) => {\n // Pi coalesces consecutive info notifications, including the final /reload notice.\n // Custom entries remain visible without adding messages to model context.\n if (ctx.mode === \"tui\") pi.appendEntry<StartupTimingEntry>(STARTUP_TIMING_ENTRY, { version: 1, report });\n else ctx.ui.notify(report, \"info\");\n };\n}\n", "import type { ExtensionAPI, ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { completeSyncArguments, splitArgs } from \"./commands/command.js\";\nimport type { AnySyncConfig } from \"./settings/settings-types.js\";\nimport { withStateDirectoryAccess } from \"./state/state-directory.js\";\nimport { startupTransferEnabled } from \"./sync/agent-policy.js\";\nimport { autoPushSessions, startSession } from \"./sync/automatic-sync.js\";\nimport { combineSignals } from \"./sync/signals.js\";\nimport { createStartupCheck } from \"./sync/startup-check.js\";\nimport { errorMessage } from \"./sync/sync-errors.js\";\nimport { createSyncLoaders, type SyncDependencies } from \"./sync/sync-loaders.js\";\nimport { registerStartupTimings } from \"./ui/startup-timings-entry.js\";\nimport { createSyncAttentionController } from \"./ui/sync-attention.js\";\nimport { createSyncStatusPublisher, setSyncStatus } from \"./ui/sync-status.js\";\nimport { safeTerminalText } from \"./ui/terminal-text.js\";\n\nexport default function sync(pi: ExtensionAPI, dependencies: Partial<SyncDependencies> = {}) {\n const loaders = createSyncLoaders(dependencies);\n const attention = createSyncAttentionController();\n const status = createSyncStatusPublisher(pi.events);\n const publishTimings = registerStartupTimings(pi);\n const check = createStartupCheck(loaders, attention, 30_000, publishTimings);\n let sessionAbort = new AbortController();\n let shutdownAbort: AbortController | undefined;\n let initialization = Promise.resolve<AnySyncConfig | false | undefined>(undefined);\n let continuous: ReturnType<typeof import(\"./sync/continuous-sync.js\")[\"createContinuousSync\"]> | undefined;\n let owner: ExtensionContext[\"sessionManager\"] | undefined;\n let continuousPossible = false;\n let startupDebug = false;\n const foreground = new Map<ExtensionContext[\"sessionManager\"], number>();\n async function resumeContinuous(ctx: ExtensionContext, signal: AbortSignal, retry?: { setup?: string }) {\n const isCurrent = () => !signal.aborted && !foreground.has(ctx.sessionManager) && owner === ctx.sessionManager;\n if (!isCurrent() || !ctx.hasUI) return;\n try {\n const { loadConfigForCheck } = await import(\"./settings/config.js\");\n if (!isCurrent()) return;\n const config = await loadConfigForCheck();\n if (!isCurrent()) return;\n continuousPossible = Boolean(config.continuous && config.agentMode);\n if (!continuousPossible) {\n await continuous?.stop(ctx.sessionManager);\n return;\n }\n const { createContinuousSync } = await import(\"./sync/continuous-sync.js\");\n if (!isCurrent()) return;\n continuous ??= createContinuousSync(loaders, undefined, publishTimings);\n continuous.start(\n ctx,\n signal,\n Boolean(retry && (retry.setup === undefined || retry.setup === config.setupName)),\n startupDebug,\n );\n } catch {\n /* Existing initialization/command paths report settings errors. */\n }\n }\n\n pi.registerCommand(\"sync\", {\n description: \"Sync Pi settings through Git, WebDAV, R2, or S3-compatible storage\",\n getArgumentCompletions: completeSyncArguments,\n handler: async (args, ctx) => {\n if (!ctx.hasUI) {\n throw new Error(\"/sync requires TUI or RPC mode so results and safety prompts are observable.\");\n }\n status.bind(ctx);\n const signal = sessionAbort.signal;\n const manager = ctx.sessionManager;\n const command = splitArgs(args)[0];\n let retry: { setup?: string } | undefined;\n let mayResume = false;\n foreground.set(manager, (foreground.get(manager) ?? 0) + 1);\n try {\n const ready = await initialization;\n mayResume = ready !== false;\n if (signal.aborted) return;\n await continuous?.stop(manager);\n if (signal.aborted) return;\n await check.stop();\n if (signal.aborted) return;\n if (ready === false && command !== \"help\" && command !== \"unlock\" && command !== \"migrate-state\") {\n ctx.ui.notify(\n \"pi-sync recovery required. Repair the startup error, then /reload before syncing. Use /sync help for recovery guidance.\",\n \"error\",\n );\n return;\n }\n const commands = await loaders.commands().catch((error) => {\n if (!signal.aborted) {\n ctx.ui.notify(`pi-sync command unavailable: ${safeTerminalText(errorMessage(error))}`, \"error\");\n }\n });\n if (signal.aborted || !commands) return;\n const run = () =>\n commands.handleCommand(args, ctx, signal, loaders, attention, (setup) => {\n retry = { setup };\n });\n // Drain background children before foreground guards. Help remains reachable during repair.\n if (command === \"migrate-state\" || command === \"help\") await run();\n else await withStateDirectoryAccess(run);\n } finally {\n const count = (foreground.get(manager) ?? 1) - 1;\n if (count) foreground.set(manager, count);\n else foreground.delete(manager);\n if (mayResume) await resumeContinuous(ctx, signal, retry);\n }\n },\n });\n\n pi.on(\"session_start\", async (_event, ctx) => {\n const releaseStatus = status.start(ctx);\n try {\n shutdownAbort?.abort(new DOMException(\"Session replaced\", \"AbortError\"));\n shutdownAbort = undefined;\n sessionAbort.abort(new DOMException(\"Session replaced\", \"AbortError\"));\n sessionAbort = new AbortController();\n const signal = sessionAbort.signal;\n owner = ctx.sessionManager;\n continuousPossible = false;\n startupDebug = false;\n attention.reset(ctx);\n const previous = initialization;\n initialization = (async () => {\n await previous;\n if (signal.aborted) return false;\n await continuous?.stop();\n if (signal.aborted) return false;\n await check.stop();\n if (signal.aborted) return false;\n try {\n const startup = await withStateDirectoryAccess(() => startSession(ctx, signal, publishTimings));\n if (signal.aborted) return false;\n startupDebug = startup?.debug ?? false;\n return startup?.config;\n } catch (error) {\n if (!signal.aborted && ctx.hasUI) {\n ctx.ui.notify(`pi-sync recovery required: ${safeTerminalText(errorMessage(error))}`, \"error\");\n }\n return false;\n }\n })();\n const ready = await initialization;\n if (ready === false) releaseStatus();\n if (ready && !signal.aborted) {\n if (ready.continuous && ready.agentMode) await resumeContinuous(ctx, signal);\n else if (ready.automatic || startupTransferEnabled(ready)) check.start(ctx, signal, ready);\n }\n } catch (error) {\n releaseStatus();\n throw error;\n }\n });\n\n pi.on(\"agent_start\", async (_event, ctx) => {\n await continuous?.stop(ctx.sessionManager);\n await check.interrupt(ctx);\n });\n\n pi.on(\"agent_settled\", async (_event, ctx) => {\n const signal = sessionAbort.signal;\n if (!signal.aborted) {\n check.settled(ctx);\n if (continuousPossible) await resumeContinuous(ctx, signal);\n }\n });\n\n pi.on(\"session_shutdown\", async (event, ctx) => {\n const releaseStatus = status.cleanupFor(ctx);\n try {\n if (continuous && owner && owner !== ctx.sessionManager) return;\n sessionAbort.abort(new DOMException(\"Session shut down\", \"AbortError\"));\n attention.reset(ctx);\n shutdownAbort?.abort(new DOMException(\"Session shut down again\", \"AbortError\"));\n const controller = new AbortController();\n shutdownAbort = controller;\n const signal = combineSignals(controller.signal, AbortSignal.timeout(30_000));\n const reason = typeof event === \"object\" && event ? (event as { reason?: string }).reason : undefined;\n try {\n const ready = await initialization;\n if (signal.aborted) return;\n await continuous?.stop(ctx.sessionManager);\n if (signal.aborted) return;\n await check.stop();\n if (signal.aborted) return;\n if (ready !== false && reason !== \"reload\") {\n await withStateDirectoryAccess(async () => {\n if (signal.aborted) return;\n await autoPushSessions(ctx, signal, loaders);\n });\n }\n } catch (error) {\n if (!signal.aborted) {\n ctx.ui.notify(`pi-sync session push skipped: ${errorMessage(error)}`, \"warning\");\n }\n } finally {\n if (shutdownAbort === controller) shutdownAbort = undefined;\n }\n if (signal.aborted) return;\n setSyncStatus(ctx, undefined);\n } finally {\n releaseStatus();\n }\n });\n}\n\nexport type { SyncDependencies } from \"./sync/sync-loaders.js\";\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAAS,qBAAqB,OAAgB;AACnD,SACE,iBAAiB,UAChB,MAAM,QAAQ,WAAW,2BAA2B,KAAK,MAAM,YAAY;AAEhF;;;ACiBA,IAAM,oBAAoC;AAAA,EACxC,KAAK;AAAA,EACL,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM,CAAC;AACT;AAEA,eAAsB,aACpB,KACA,QACA,SACiE;AACjE,QAAM,UAAU,qBAAqB,OAAO;AAC5C,MAAI,QAAQ;AACZ,MAAI,UAAmC;AACvC,MAAI;AACF,mBAAe,MAAM;AACrB,UAAM,cAAc,8BAA8B;AAClD,QAAI,eAAe,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BAAgB,OAAO,WAAW,GAAG;AAC3C,QAAI;AACF,UAAI,cAAc,SAAS,UAAU,IAAI,eAAgB;AACzD,mBAAa,MAAM,IAAI,aAAa,qBAAqB,YAAY,CAAC;AACtE,gBAAU,MAAM,GAAG;AACnB,qBAAe,MAAM,IAAI,aAAa,2BAA2B,YAAY,CAAC;AAC9E,YAAM,aAAa,IAAI,gBAAgB;AACvC,sBAAgB;AAChB,YAAM,SAAS,eAAe,WAAW,QAAQ,YAAY,QAAQ,GAAM,CAAC;AAC5E,YAAM,SAAS,OAAO,UAAU,YAAY,QAAS,MAA8B,SAAS;AAC5F,UAAI;AACF,cAAM,QAAQ,MAAM;AACpB,YAAI,OAAO,QAAS;AACpB,cAAM,YAAY,KAAK,IAAI,cAAc;AACzC,YAAI,OAAO,QAAS;AACpB,cAAM,MAAM,KAAK;AACjB,YAAI,OAAO,QAAS;AACpB,YAAI,UAAU,SAAS,WAAW,UAAU;AAC1C,gBAAM,yBAAyB,YAAY;AACzC,gBAAI,OAAO,QAAS;AACpB,kBAAM,iBAAiB,KAAK,QAAQ,OAAO;AAAA,UAC7C,CAAC;AAAA,QACH;AAAA,MACF,SAAS,OAAO;AACd,YAAI,CAAC,OAAO,SAAS;AACnB,cAAI,GAAG,OAAO,iCAAiC,aAAa,KAAK,CAAC,IAAI,SAAS;AAAA,QACjF;AAAA,MACF,UAAE;AACA,YAAI,kBAAkB,WAAY,iBAAgB;AAAA,MACpD;AACA,UAAI,OAAO,QAAS;AACpB,oBAAc,KAAK,MAAS;AAAA,IAC9B,UAAE;AACA,oBAAc;AAAA,IAChB;AAAA,EACF,CAAC;AACH;",
|
|
6
|
-
"names": [
|
|
3
|
+
"sources": ["../src/sync/agent-policy.ts", "../src/settings/config-errors.ts", "../src/sync/startup-timings.ts", "../src/sync/automatic-sync.ts", "../src/sync/startup-check.ts", "../src/sync/sync-loaders.ts", "../src/ui/startup-timings-entry.ts", "../src/sync-extension.ts"],
|
|
4
|
+
"sourcesContent": ["export type * from \"@narumitw/sync-daemon/engine/sync/agent-policy\";\nexport {\n AGENT_INPUT_BYTES,\n AGENT_MAX_ATTEMPTS,\n AGENT_MAX_TOKENS,\n AGENT_MAX_UNITS,\n AGENT_OUTPUT_BYTES,\n AGENT_TIMEOUT_MS,\n startupTransferEnabled,\n} from \"@narumitw/sync-daemon/engine/sync/agent-policy\";\n", "export type * from \"@narumitw/sync-daemon/engine/settings/config-errors\";\nexport { isMissingConfigError } from \"@narumitw/sync-daemon/engine/settings/config-errors\";\n", "export type * from \"@narumitw/sync-daemon/engine/sync/startup-timings\";\nexport { createStartupTimings } from \"@narumitw/sync-daemon/engine/sync/startup-timings\";\n", "import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { setSyncSetupCompletions } from \"../commands/command.js\";\nimport { piDaemonClient } from \"../daemon/pi-client.js\";\nimport { isMissingConfigError } from \"../settings/config-errors.js\";\nimport type { AnySyncConfig, PiSyncSettingsV3 } from \"../settings/settings-types.js\";\nimport { configureSyncStatus } from \"../ui/sync-status.js\";\nimport { safeTerminalText } from \"../ui/terminal-text.js\";\nimport { throwIfAborted } from \"./signals.js\";\nimport { createStartupTimings, type StartupTimingPublisher } from \"./startup-timings.js\";\nimport { errorMessage } from \"./sync-errors.js\";\nimport type { SyncLoaders } from \"./sync-loaders.js\";\n\nexport async function startSession(\n ctx: ExtensionContext,\n signal: AbortSignal,\n publish?: StartupTimingPublisher,\n): Promise<{ debug: boolean; config?: AnySyncConfig } | undefined> {\n throwIfAborted(signal);\n const client = piDaemonClient(ctx);\n // One-off sessions only protect their files in an already existing service.\n // They never launch it or authorize observations, transfers, or model work.\n if (!ctx.hasUI || ![\"tui\", \"rpc\"].includes(ctx.mode)) {\n await client.attachExisting();\n throwIfAborted(signal);\n return { debug: false };\n }\n const timings = createStartupTimings(publish);\n const document = await timings.measure(\"settings read\", () => client.readSettings());\n throwIfAborted(signal);\n configureSyncStatus(ctx, (document?.parsed.showStatus as boolean | undefined) ?? true);\n const { stateDirectoryMigrationNotice } = await import(\"../state/state-directory.js\");\n const notice = stateDirectoryMigrationNotice();\n const { pendingTransactionEntries } = await import(\"../snapshot/snapshot-transaction-directory.js\");\n const recoveryNeeded = (await pendingTransactionEntries()).some((entry) => entry.isDirectory());\n throwIfAborted(signal);\n if (!(await client.configured()) && !recoveryNeeded) {\n if (notice) ctx.ui.notify(notice, \"warning\");\n setSyncSetupCompletions([]);\n const debug = document?.parsed.debug === true;\n await client.markReady(debug);\n timings.publish(ctx, debug, signal, \"local initialization\", \"completed\");\n return { debug };\n }\n throwIfAborted(signal);\n const result = (await client.run(\"initialize\", {}, signal)) as {\n debug: boolean;\n config?: AnySyncConfig;\n settings?: PiSyncSettingsV3;\n handoverRequired: boolean;\n };\n throwIfAborted(signal);\n configureSyncStatus(ctx, result.settings?.showStatus ?? true);\n setSyncSetupCompletions(Object.keys(result.settings?.syncSetups ?? {}).sort((a, b) => a.localeCompare(b)));\n await client.markReady(result.debug);\n throwIfAborted(signal);\n if (result.handoverRequired) {\n ctx.ui.notify(\n \"pi-sync: close or upgrade older Pi processes, then use /sync to review daemon handover. No automatic transfer is authorized yet.\",\n \"warning\",\n );\n return { debug: result.debug };\n }\n return { debug: result.debug, config: result.config };\n}\nexport async function autoPushSessions(ctx: ExtensionContext, signal: AbortSignal, _loaders: SyncLoaders) {\n try {\n const client = piDaemonClient(ctx);\n if (!(await client.configured())) return;\n throwIfAborted(signal);\n await client.run(\n \"shutdown\",\n { args: [], yes: true, force: false, stale: false, silent: true, reload: false },\n signal,\n );\n } catch (error) {\n if (signal.aborted || isMissingConfigError(error)) return;\n ctx.ui.notify(`pi-sync session push skipped: ${safeTerminalText(errorMessage(error))}`, \"warning\");\n }\n}\n", "import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { loadConfigForCheck, syncCheckConfigFingerprint } from \"../settings/config.js\";\nimport { isMissingConfigError } from \"../settings/config-errors.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { snapshotOptionsForContext } from \"../snapshot/session-paths.js\";\nimport { withStateDirectoryAccess } from \"../state/state-directory.js\";\nimport { readStateForConfig, syncStateFingerprint } from \"../state/sync-state-store.js\";\nimport type { SyncAttentionController } from \"../ui/sync-attention.js\";\nimport { setSyncStatus } from \"../ui/sync-status.js\";\nimport { safeTerminalText } from \"../ui/terminal-text.js\";\nimport { startupTransferEnabled } from \"./agent-policy.js\";\nimport { combineSignals, throwIfAborted } from \"./signals.js\";\nimport { createStartupTimings, type StartupTimingPublisher } from \"./startup-timings.js\";\nimport { errorMessage } from \"./sync-errors.js\";\nimport type { SyncLoaders } from \"./sync-loaders.js\";\n\n/** One owned task per extension session, never keyed by the shared headless UI. */\nexport function createStartupCheck(\n loaders: SyncLoaders,\n attention: SyncAttentionController,\n timeoutMs = 30_000,\n publish?: StartupTimingPublisher,\n) {\n let active:\n | {\n controller: AbortController;\n promise: Promise<void>;\n owner: ExtensionContext[\"sessionManager\"];\n transfer: boolean;\n }\n | undefined;\n\n let pending: { ctx: ExtensionContext; signal: AbortSignal; config: AnySyncConfig } | undefined;\n\n const controllerApi = {\n async interrupt(ctx: ExtensionContext) {\n const task = active;\n if (!task?.transfer || task.owner !== ctx.sessionManager) return;\n task.controller.abort(new DOMException(\"Agent became busy\", \"AbortError\"));\n await task.promise;\n },\n settled(ctx: ExtensionContext) {\n const queued = pending;\n if (!queued || queued.ctx.sessionManager !== ctx.sessionManager || queued.signal.aborted || !ctx.isIdle()) return;\n pending = undefined;\n controllerApi.start(ctx, queued.signal, queued.config);\n },\n start(ctx: ExtensionContext, sessionSignal: AbortSignal, initialConfig?: AnySyncConfig) {\n if (!ctx.hasUI || sessionSignal.aborted) return;\n if (initialConfig && startupTransferEnabled(initialConfig) && !ctx.isIdle()) {\n pending = { ctx, signal: sessionSignal, config: initialConfig };\n return;\n }\n if (active) throw new Error(\"Previous startup check has not been drained.\");\n const timings = createStartupTimings(publish);\n const controller = new AbortController();\n const signal = combineSignals(sessionSignal, controller.signal);\n const task = {\n controller,\n owner: ctx.sessionManager,\n promise: Promise.resolve(),\n transfer: Boolean(initialConfig && startupTransferEnabled(initialConfig)),\n };\n active = task;\n const isCurrent = () => !sessionSignal.aborted && active === task && task.owner === ctx.sessionManager;\n const timer = setTimeout(\n () => controller.abort(new DOMException(\"Startup check timed out\", \"TimeoutError\")),\n timeoutMs,\n );\n timer.unref();\n let config: AnySyncConfig | undefined;\n let checking = false;\n let stopped = false;\n // Handle every detached rejection here; Pi's awaited event runner cannot catch it.\n task.promise = Promise.resolve()\n .then(async () => {\n try {\n throwIfAborted(signal);\n config = initialConfig ?? (await loadConfigForCheck());\n task.transfer = startupTransferEnabled(config);\n throwIfAborted(signal);\n if (!config.automatic && !startupTransferEnabled(config)) return;\n const captured = config;\n const identity = syncCheckConfigFingerprint(captured);\n checking = true;\n setSyncStatus(ctx, \"sync ...\", { activity: \"checking\" });\n const { inspectSync } = await timings.measure(\"inspection import\", () => loaders.inspection());\n throwIfAborted(signal);\n const currentConfig = await loadConfigForCheck();\n throwIfAborted(signal);\n if (syncCheckConfigFingerprint(currentConfig) !== identity) return;\n // The daemon owns the operation and cache guards.\n const inspection = await timings.measure(\"inspection and guards\", () =>\n inspectSync(captured, snapshotOptionsForContext(ctx, captured), signal, undefined, timings),\n );\n throwIfAborted(signal);\n const latest = await loadConfigForCheck();\n throwIfAborted(signal);\n if (syncCheckConfigFingerprint(latest) !== identity) return;\n const state = await withStateDirectoryAccess(() => readStateForConfig(latest));\n throwIfAborted(signal);\n if (syncStateFingerprint(state) !== inspection.stateIdentity || !isCurrent()) return;\n attention.observe({\n setupName: captured.setupName,\n configIdentity: identity,\n checkedAt: new Date().toISOString(),\n inspection,\n automaticTransfer: startupTransferEnabled(captured),\n });\n if (\n startupTransferEnabled(captured) &&\n !inspection.firstSync &&\n inspection.head &&\n inspection.selectionState?.kind === \"same\"\n ) {\n const operations = await timings.measure(\"operations import\", () => loaders.operations());\n throwIfAborted(signal);\n if (!isCurrent()) return;\n if (!ctx.isIdle()) {\n pending = { ctx, signal: sessionSignal, config: captured };\n return;\n }\n await timings.measure(\"automatic transfer\", () =>\n operations.syncBoth(ctx, {\n args: [],\n yes: true,\n force: false,\n stale: false,\n silent: true,\n reload: false,\n auto: true,\n signal,\n startupTimings: timings,\n onCommit: () => attention.clearObservation(),\n }),\n );\n throwIfAborted(signal);\n if (!isCurrent()) return;\n attention.clearObservation();\n return;\n }\n attention.observe({\n setupName: captured.setupName,\n configIdentity: identity,\n checkedAt: new Date().toISOString(),\n inspection,\n automaticTransfer: startupTransferEnabled(captured),\n });\n if (ctx.mode === \"rpc\") attention.notifyObservation(ctx);\n } catch (error) {\n stopped = true;\n if (!isCurrent() || sessionSignal.aborted || isMissingConfigError(error)) return;\n if (signal.aborted && controller.signal.reason?.name !== \"TimeoutError\") return;\n // A settings edit invalidates failures as well as successful observations.\n if (config) {\n const latest = await loadConfigForCheck().catch(() => undefined);\n if (!isCurrent() || (signal.aborted && controller.signal.reason?.name !== \"TimeoutError\")) return;\n if (!latest || syncCheckConfigFingerprint(latest) !== syncCheckConfigFingerprint(config)) return;\n }\n ctx.ui.notify(\n config && startupTransferEnabled(config)\n ? `pi-sync automatic transfer stopped: ${safeTerminalText(errorMessage(error))}. Run /sync to review or reconcile retained recovery evidence. No resources were reloaded.`\n : `pi-sync startup check skipped: ${safeTerminalText(errorMessage(error))}. Run /sync status to retry. No startup transfer was performed.`,\n \"warning\",\n );\n } finally {\n clearTimeout(timer);\n if (isCurrent() && checking) {\n if (!signal.aborted || controller.signal.reason?.name === \"TimeoutError\") {\n const latest = await loadConfigForCheck().catch(() => undefined);\n if (isCurrent()) {\n if (signal.aborted && controller.signal.reason?.name !== \"TimeoutError\")\n setSyncStatus(ctx, undefined);\n else if (\n config &&\n latest &&\n syncCheckConfigFingerprint(latest) === syncCheckConfigFingerprint(config)\n )\n await attention.publish(ctx, sessionSignal);\n else attention.reset(ctx);\n }\n } else setSyncStatus(ctx, undefined);\n }\n if (isCurrent()) {\n timings.publish(\n ctx,\n config?.debug ?? false,\n sessionSignal,\n \"background startup\",\n signal.aborted || stopped ? \"stopped\" : \"completed\",\n );\n }\n if (active === task) active = undefined;\n }\n })\n .catch(() => {\n // UI teardown can itself throw. No unhandled rejection or retained timer.\n clearTimeout(timer);\n if (active === task) active = undefined;\n });\n },\n async stop() {\n pending = undefined;\n const task = active;\n if (!task) return;\n task.controller.abort(new DOMException(\"Startup check cancelled\", \"AbortError\"));\n // Drain the actual work, including child/ref cleanup, before foreground guards.\n await task.promise;\n },\n };\n return controllerApi;\n}\n", "type SetupSwitchModule = Pick<typeof import(\"./setup-switch.js\"), \"useSyncSetup\">;\ntype SnapshotModule = Pick<typeof import(\"../snapshot/snapshot.js\"), \"createSnapshot\">;\ntype SyncStateModule = Pick<typeof import(\"./sync-state.js\"), \"hasLocalChanges\">;\ntype SyncOperations = typeof import(\"./sync-operations.js\");\ntype CommandHandlerModule = Pick<typeof import(\"../commands/command-handler.js\"), \"handleCommand\">;\n\ntype SyncInspectionModule = Pick<typeof import(\"./sync-inspection.js\"), \"inspectSync\">;\n\nexport interface SyncDependencies {\n loadCommandHandler(): Promise<CommandHandlerModule>;\n loadSyncInspection(): Promise<SyncInspectionModule>;\n loadSetupSwitch(): Promise<SetupSwitchModule>;\n loadSnapshot(): Promise<SnapshotModule>;\n loadSyncState(): Promise<SyncStateModule>;\n loadSyncOperations(): Promise<SyncOperations>;\n}\n\nexport interface SyncLoaders {\n commands(): Promise<CommandHandlerModule>;\n inspection(): Promise<SyncInspectionModule>;\n setupSwitch(): Promise<SetupSwitchModule>;\n snapshot(): Promise<SnapshotModule>;\n syncState(): Promise<SyncStateModule>;\n operations(): Promise<SyncOperations>;\n}\n\nexport function createSyncLoaders(dependencies: Partial<SyncDependencies>): SyncLoaders {\n const loaders: SyncLoaders = {\n commands: cachedModuleLoader(dependencies.loadCommandHandler ?? (() => import(\"../commands/command-handler.js\"))),\n inspection: cachedModuleLoader(dependencies.loadSyncInspection ?? (() => import(\"./sync-inspection.js\"))),\n setupSwitch: cachedModuleLoader(dependencies.loadSetupSwitch ?? (() => import(\"./setup-switch.js\"))),\n snapshot: cachedModuleLoader(dependencies.loadSnapshot ?? (() => import(\"../snapshot/snapshot.js\"))),\n syncState: cachedModuleLoader(dependencies.loadSyncState ?? (() => import(\"./sync-state.js\"))),\n operations: cachedModuleLoader(dependencies.loadSyncOperations ?? (() => import(\"./sync-operations.js\"))),\n };\n return loaders;\n}\n\nfunction cachedModuleLoader<Module>(load: () => Promise<Module>): () => Promise<Module> {\n let pending: Promise<Module> | undefined;\n return () => {\n if (!pending) {\n pending = load().catch((error) => {\n pending = undefined;\n throw error;\n });\n }\n return pending;\n };\n}\n", "import type { ExtensionAPI } from \"@earendil-works/pi-coding-agent\";\nimport { Text, truncateToWidth } from \"@earendil-works/pi-tui\";\nimport type { StartupTimingPublisher } from \"../sync/startup-timings.js\";\nimport { safeTerminalText } from \"./terminal-text.js\";\n\nexport const STARTUP_TIMING_ENTRY = \"pi-sync-startup-timings\";\n\nexport interface StartupTimingEntry {\n version: 1;\n report: string;\n}\n\nexport function registerStartupTimings(pi: ExtensionAPI): StartupTimingPublisher {\n pi.registerEntryRenderer<StartupTimingEntry>(STARTUP_TIMING_ENTRY, (entry, _options, theme) => {\n const data = entry.data;\n if (data?.version !== 1 || typeof data.report !== \"string\") return undefined;\n const text = new Text(\n data.report\n .split(\"\\n\")\n .map((line, index) => theme.fg(index === 0 ? \"accent\" : \"muted\", safeTerminalText(line)))\n .join(\"\\n\"),\n 0,\n 0,\n );\n return {\n render: (width) => (width > 0 ? text.render(width).map((line) => truncateToWidth(line, width)) : []),\n invalidate: () => text.invalidate(),\n };\n });\n return (ctx, report) => {\n // Pi coalesces consecutive info notifications, including the final /reload notice.\n // Custom entries remain visible without adding messages to model context.\n if (ctx.mode === \"tui\") pi.appendEntry<StartupTimingEntry>(STARTUP_TIMING_ENTRY, { version: 1, report });\n else ctx.ui.notify(report, \"info\");\n };\n}\n", "import type { ExtensionAPI, ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { completeSyncArguments, splitArgs } from \"./commands/command.js\";\nimport {\n bindPiDaemonClient,\n installPiDaemonHost,\n type PiDaemonClient,\n withPiDaemonClient,\n} from \"./daemon/pi-client.js\";\nimport type { AnySyncConfig } from \"./settings/settings-types.js\";\nimport { startupTransferEnabled } from \"./sync/agent-policy.js\";\nimport { autoPushSessions, startSession } from \"./sync/automatic-sync.js\";\nimport { combineSignals } from \"./sync/signals.js\";\nimport { createStartupCheck } from \"./sync/startup-check.js\";\nimport { errorMessage } from \"./sync/sync-errors.js\";\nimport { createSyncLoaders, type SyncDependencies } from \"./sync/sync-loaders.js\";\nimport { registerStartupTimings } from \"./ui/startup-timings-entry.js\";\nimport { createSyncAttentionController } from \"./ui/sync-attention.js\";\nimport { createSyncStatusPublisher } from \"./ui/sync-status.js\";\nimport { safeTerminalText } from \"./ui/terminal-text.js\";\n\nexport default function sync(pi: ExtensionAPI, dependencies: Partial<SyncDependencies> = {}) {\n installPiDaemonHost();\n const loaders = createSyncLoaders(dependencies);\n const attention = createSyncAttentionController();\n const status = createSyncStatusPublisher(pi.events);\n const publishTimings = registerStartupTimings(pi);\n const check = createStartupCheck(loaders, attention, 30_000, publishTimings);\n let sessionAbort = new AbortController();\n let shutdownAbort: AbortController | undefined;\n let initialization = Promise.resolve<AnySyncConfig | false | undefined>(undefined);\n let owner: PiDaemonClient | undefined;\n let ownerManager: ExtensionContext[\"sessionManager\"] | undefined;\n\n pi.registerCommand(\"sync\", {\n description: \"Sync Pi settings through Git, WebDAV, R2, or S3-compatible storage\",\n getArgumentCompletions: completeSyncArguments,\n handler: async (args, ctx) => {\n if (!ctx.hasUI) throw new Error(\"/sync requires TUI or RPC mode so results and safety prompts are observable.\");\n status.bind(ctx);\n const signal = sessionAbort.signal;\n const client = owner;\n if (!client || ownerManager !== ctx.sessionManager) {\n if (splitArgs(args)[0] !== \"help\") throw new Error(\"pi-sync session is not ready.\");\n const commands = await loaders.commands();\n if (signal.aborted || owner) return;\n ctx.isIdle();\n await commands.handleCommand(args, ctx, signal, loaders, attention);\n return;\n }\n await withPiDaemonClient(ctx, async (ownedContext) => {\n ctx = ownedContext;\n const command = splitArgs(args)[0];\n const ready = await initialization;\n if (signal.aborted || owner !== client) return;\n await client.setBusy(\"command\", true);\n try {\n await check.stop();\n if (signal.aborted || owner !== client) return;\n if (\n ready === false &&\n command !== \"help\" &&\n command !== \"unlock\" &&\n command !== \"migrate-state\" &&\n command !== \"daemon\"\n ) {\n ctx.ui.notify(\n \"pi-sync recovery required. Repair the startup error, then /reload before syncing. Use /sync help for recovery guidance.\",\n \"error\",\n );\n return;\n }\n if (command === \"unlock\" || command === \"migrate-state\") {\n const { stateDirectoryMigrationNotice } = await import(\"./state/state-directory.js\");\n if (signal.aborted || owner !== client) return;\n // Recovery cannot guess an authoritative root when roots coexist or are unsafe.\n stateDirectoryMigrationNotice();\n }\n const commands = await loaders.commands();\n if (signal.aborted || owner !== client) return;\n await commands.handleCommand(args, ctx, signal, loaders, attention);\n } catch (error) {\n if (!signal.aborted) {\n ctx.ui.notify(`pi-sync command unavailable: ${safeTerminalText(errorMessage(error))}`, \"error\");\n if (command === \"unlock\" || command === \"migrate-state\") throw error;\n }\n } finally {\n if (!signal.aborted && owner === client) await client.setBusy(\"command\", false);\n }\n });\n },\n });\n pi.on(\"session_start\", async (_event, ctx) => {\n const releaseStatus = status.start(ctx);\n const previousClient = owner;\n shutdownAbort?.abort(new DOMException(\"Session replaced\", \"AbortError\"));\n shutdownAbort = undefined;\n sessionAbort.abort(new DOMException(\"Session replaced\", \"AbortError\"));\n sessionAbort = new AbortController();\n const signal = sessionAbort.signal;\n const client = bindPiDaemonClient(ctx, signal, publishTimings);\n owner = client;\n ownerManager = ctx.sessionManager;\n const replacementFile = ctx.sessionManager.getSessionFile?.();\n attention.reset(ctx);\n const previous = initialization;\n initialization = withPiDaemonClient(ctx, async () => {\n await previous.catch(() => {});\n if (signal.aborted || owner !== client) return false;\n try {\n await check.stop();\n if (previousClient) {\n // Register the replacement before removing old session protection.\n try {\n await client.attachExisting();\n } catch {\n /* Initialization below reports an unavailable owner. */\n }\n try {\n await previousClient.disposeForShutdown(\"resume\", replacementFile);\n } catch {\n /* Plain, detached recovery owns uncertain grants; no closed ctx is retained. */\n }\n await client.finishReattachment();\n }\n if (signal.aborted || owner !== client) return false;\n return (await startSession(ctx, signal, publishTimings))?.config;\n } catch (error) {\n if (!signal.aborted && owner === client) {\n try {\n client.validate();\n if (ctx.hasUI)\n ctx.ui.notify(`pi-sync recovery required: ${safeTerminalText(errorMessage(error))}`, \"error\");\n } catch {\n /* SDK context was replaced. */\n }\n }\n return false;\n }\n });\n try {\n const ready = await initialization;\n if (ready === false) releaseStatus();\n if (\n ready &&\n !signal.aborted &&\n owner === client &&\n !(ready.continuous && ready.agentMode) &&\n (ready.automatic || startupTransferEnabled(ready))\n )\n await withPiDaemonClient(ctx, async () => {\n check.start(ctx, signal, ready);\n });\n } catch (error) {\n releaseStatus();\n throw error;\n }\n });\n pi.on(\"agent_start\", async (_event, ctx) => {\n const client = owner;\n if (!client || ownerManager !== ctx.sessionManager || sessionAbort.signal.aborted) return;\n if (!ctx.hasUI || ![\"tui\", \"rpc\"].includes(ctx.mode)) await client.attachExisting();\n await client.setBusy(\"agent\", true);\n if (owner === client && !sessionAbort.signal.aborted) await check.interrupt(ctx);\n });\n pi.on(\"agent_settled\", async (_event, ctx) => {\n const client = owner;\n if (!client || ownerManager !== ctx.sessionManager || sessionAbort.signal.aborted) return;\n await client.setBusy(\"agent\", false);\n if (owner === client && !sessionAbort.signal.aborted)\n await withPiDaemonClient(ctx, async () => {\n check.settled(ctx);\n });\n });\n pi.on(\"model_select\", async (_event, ctx) => {\n if (owner && ownerManager === ctx.sessionManager && !sessionAbort.signal.aborted) await owner.update();\n });\n const pauseForReplacement = async (_event: unknown, ctx: ExtensionContext) => {\n const client = owner;\n if (!client || ownerManager !== ctx.sessionManager || sessionAbort.signal.aborted) return;\n const results = await Promise.allSettled([client.pauseForSessionChange(), check.stop()]);\n if (results.some((result) => result.status === \"rejected\")) {\n if (owner === client && !sessionAbort.signal.aborted)\n ctx.ui.notify(\n \"pi-sync could not drain its writer. Repair or stop the existing daemon before changing sessions.\",\n \"error\",\n );\n return { cancel: true };\n }\n // Another handler can still cancel the SDK transition. Stay paused until\n // /reload instead of guessing that it is safe to resume while handlers run.\n };\n pi.on(\"session_before_switch\", pauseForReplacement);\n pi.on(\"session_before_fork\", pauseForReplacement);\n pi.on(\"session_shutdown\", async (event, ctx) => {\n const releaseStatus = status.cleanupFor(ctx);\n const client = owner;\n if (!client || ownerManager !== ctx.sessionManager) {\n releaseStatus();\n return;\n }\n const controller = new AbortController();\n shutdownAbort?.abort(new DOMException(\"Session shut down again\", \"AbortError\"));\n shutdownAbort = controller;\n const signal = combineSignals(controller.signal, AbortSignal.timeout(30_000));\n const reason = typeof event === \"object\" && event ? (event as { reason?: string }).reason : undefined;\n const target =\n typeof event === \"object\" && event ? (event as { targetSessionFile?: string }).targetSessionFile : undefined;\n // Cancel old dialogs/settings work now, while the SDK context is still active.\n sessionAbort.abort(new DOMException(\"Session shutting down\", \"AbortError\"));\n let shutdownClient: PiDaemonClient | undefined;\n try {\n await initialization.catch(() => {});\n await check.stop();\n if (signal.aborted || owner !== client) return;\n if (reason !== \"reload\") {\n shutdownClient = bindPiDaemonClient(ctx, signal, publishTimings);\n await shutdownClient.setBusy(\"shutdown\", true);\n const attached = await shutdownClient.attachExisting();\n if (!signal.aborted && owner === client && attached)\n await withPiDaemonClient(ctx, () => autoPushSessions(ctx, signal, loaders));\n }\n } catch (error) {\n if (!signal.aborted && owner === client) {\n try {\n ctx.ui.notify(`pi-sync shutdown skipped: ${safeTerminalText(errorMessage(error))}`, \"warning\");\n } catch {\n /* SDK context was replaced. */\n }\n }\n } finally {\n if (owner === client) {\n owner = undefined;\n ownerManager = undefined;\n try {\n attention.reset(ctx);\n } catch {\n /* Cleanup never depends on an active SDK context. */\n }\n }\n try {\n await client.disposeForShutdown(reason, target);\n } finally {\n try {\n await shutdownClient?.disposeForShutdown(reason, target);\n } finally {\n controller.abort();\n releaseStatus();\n }\n }\n if (shutdownAbort === controller) shutdownAbort = undefined;\n }\n });\n}\nexport type { SyncDependencies } from \"./sync/sync-loaders.js\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACRP,SAAS,4BAA4B;;;ACArC,SAAS,4BAA4B;;;ACWrC,eAAsB,aACpB,KACA,QACA,SACiE;AACjE,iBAAe,MAAM;AACrB,QAAM,SAAS,eAAe,GAAG;AAGjC,MAAI,CAAC,IAAI,SAAS,CAAC,CAAC,OAAO,KAAK,EAAE,SAAS,IAAI,IAAI,GAAG;AACpD,UAAM,OAAO,eAAe;AAC5B,mBAAe,MAAM;AACrB,WAAO,EAAE,OAAO,MAAM;AAAA,EACxB;AACA,QAAM,UAAU,qBAAqB,OAAO;AAC5C,QAAM,WAAW,MAAM,QAAQ,QAAQ,iBAAiB,MAAM,OAAO,aAAa,CAAC;AACnF,iBAAe,MAAM;AACrB,sBAAoB,KAAM,UAAU,OAAO,cAAsC,IAAI;AACrF,QAAM,EAAE,8BAA8B,IAAI,MAAM,OAAO,sCAA6B;AACpF,QAAM,SAAS,8BAA8B;AAC7C,QAAM,EAAE,0BAA0B,IAAI,MAAM,OAAO,qDAA+C;AAClG,QAAM,kBAAkB,MAAM,0BAA0B,GAAG,KAAK,CAAC,UAAU,MAAM,YAAY,CAAC;AAC9F,iBAAe,MAAM;AACrB,MAAI,CAAE,MAAM,OAAO,WAAW,KAAM,CAAC,gBAAgB;AACnD,QAAI,OAAQ,KAAI,GAAG,OAAO,QAAQ,SAAS;AAC3C,4BAAwB,CAAC,CAAC;AAC1B,UAAM,QAAQ,UAAU,OAAO,UA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;AACA,UAAI,kBAAkB,WAAY,iBAAgB;AAAA,IACpD;AAAA,EACF,CAAC;AACH;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Daemon migration and release restrictions
|
|
2
|
+
|
|
3
|
+
This daemon extraction is experimental. Deterministic Linux verification passed, but publication and production cutover remain separate, unauthorized actions. Keep the restrictions below until their owners complete the required checks.
|
|
4
|
+
|
|
5
|
+
## Ownership and upgrade
|
|
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.
|
|
10
|
+
|
|
11
|
+
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
|
+
|
|
13
|
+
Backend formats, `pi-sync.json`, `pi-sync/`, `.pisync/`, backups, and journals remain owned by the extracted engine. Legacy directory migration remains explicit. Coexisting or unsafe state roots must be reconciled without merging or deleting evidence automatically.
|
|
14
|
+
|
|
15
|
+
## Lifetime is not consent
|
|
16
|
+
|
|
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.
|
|
18
|
+
|
|
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.
|
|
20
|
+
|
|
21
|
+
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
|
+
|
|
23
|
+
## Write coordination and disconnection
|
|
24
|
+
|
|
25
|
+
The service owns synchronization scheduling and execution, not every writer on the machine. Participating Pi clients hold their actual public file-mutation queues through apply and acknowledge release. A joining client waits to publish its attachment until the current reservation, including nested writes and release acknowledgements, ends; the next transaction includes its queues. This also applies to passive print/JSON startup. Attach waits remain cancellable without an idle timeout that could otherwise bypass this protection during a long apply; shutdown cancels the partial connection instead of waiting for admission. Pi core settings updates use a separate authoritative file lock, which the daemon must also hold. Creating an absent `settings.json` with a live Pi is refused because the Pi missing-file branch does not reread after acquiring its lock.
|
|
26
|
+
|
|
27
|
+
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
|
+
|
|
29
|
+
## Diagnostics and rollback
|
|
30
|
+
|
|
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.
|
|
32
|
+
|
|
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.
|
|
34
|
+
|
|
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.
|
|
36
|
+
|
|
37
|
+
Before rollback:
|
|
38
|
+
|
|
39
|
+
1. Stop the daemon explicitly and verify owner exit.
|
|
40
|
+
2. Close all upgraded clients and retain settings, state, journals, and backups.
|
|
41
|
+
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.
|
|
43
|
+
|
|
44
|
+
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
|
+
|
|
46
|
+
## Verification status
|
|
47
|
+
|
|
48
|
+
Completed on disposable roots and synthetic loopback endpoints:
|
|
49
|
+
|
|
50
|
+
- `npm run format` and `npm run check`: builds, Biome, package boundaries, dependency compatibility, and workspace types.
|
|
51
|
+
- `npm test`: 1,035 passing files, one skipped file; 23,291 passing tests, 18 skipped, no failures or unhandled errors; the configured five-second case timeout is unchanged.
|
|
52
|
+
- Scoped package workflow and cold build-order regressions; the real Changeset raises the scoped dependency floor and plans a public daemon-first release using a simulated unpublished registry entry.
|
|
53
|
+
- Both package-workflow dry packs; inspected real daemon/client tarballs; a fresh independent install with the local daemon tarball and the public SDK resolved in that install scope.
|
|
54
|
+
- Standalone import, executable symlink/Help, start/API/stop, package-directory native Jiti loading, lazy `/sync help`, and survival after the installed Pi process exited.
|
|
55
|
+
- Production Git preparation without development tools: Kit and daemon runtime JavaScript, exact imports, executable CLI, source-entry Jiti Help, and daemon start/API/stop.
|
|
56
|
+
- Actual-daemon typed sync/selection decisions through both command and recovery routing; RPC resolution-menu cancellation without mutation; live-PID protection through detach/exit/pause/replacement gaps, unrelated attach, restart, and confirmed PID exit; parameterized child programs keep data outside executable source. Targeted old-policy negative controls failed, and both regression suites passed after the fixes were restored.
|
|
57
|
+
- Seventeen admission/cancellation regressions cover print/JSON/RPC joins during queue grant, apply, and release, nested targets, future cohort coverage, cancelled waiters/attachments, transport disconnection, request timeout policy, partial-connection pause/disposal, hook re-entry, and shutdown; releasing admission early makes twelve cases fail.
|
|
58
|
+
- Twenty new regressions cover external-root queue coordination and explicit Continuous retry. Real Pi clients with different session roots can pull into an existing or new external destination. A repaired authentication failure resumes after explicit sync. Authentication/storage/unknown failures retain nonempty calls and attempts; setup mismatch, stale or cancelled origins, busy clients, disabled policy, resolver disposal, and consent-publication failure remain guarded. Negative controls fail, and all 26 focused cases pass after restoration.
|
|
59
|
+
- Two actual Pi RPC clients sharing one owner; new/reload/fork/resume/exit; stable provider-visible prompt/message prefix and ordered tools; real loopback S3/WebDAV cancellation; actual Pi file queues and SettingsManager lock branches; native model resolution through command/startup/Continuous/retry/zero-client paths; stale reviews and durable grant revocation across restart.
|
|
60
|
+
|
|
61
|
+
The semantic audit used `docs/extension-conventions.md`, `docs/extension-settings.md`, `docs/readme-conventions.md`, and both package instruction files. It covered cancellation/disposal/replacement, every owned process/task, callback generations and post-await freshness, settings read/write ordering and failure recovery, unknown/invalid-file preservation, conditional publication/journals, provider capability and post-auth validation, bounded IPC/logs, loading boundaries, and model-prefix stability. The README audit covered 39 active packages and 92 affected local links.
|
|
62
|
+
|
|
63
|
+
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
|
+
|
|
65
|
+
## Measured process cost
|
|
66
|
+
|
|
67
|
+
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.
|
|
68
|
+
|
|
69
|
+
| Observation | Archived in-process engine | Daemon client and service |
|
|
70
|
+
| --- | ---: | ---: |
|
|
71
|
+
| First Pi readiness, excluding explicit service adoption | 472 ms | 538 ms |
|
|
72
|
+
| Detached service launch and immediate fixture ownership review | Not applicable | 108 ms |
|
|
73
|
+
| Second Pi readiness | 485 ms | 533 ms |
|
|
74
|
+
| First push, including deferred imports | 123 ms | 488 ms |
|
|
75
|
+
| Unchanged sync | 49 ms | 84 ms |
|
|
76
|
+
| One synthetic conflict request and apply | 210 ms | 324 ms |
|
|
77
|
+
| Fresh one-Pi RSS | 140.9 MiB | Pi 151.5 + service 77.4 MiB |
|
|
78
|
+
| RSS during a model request | 162.1 MiB | Pi 153.8 + service 181.1 MiB |
|
|
79
|
+
| Two-Pi RSS after transfers | 163.2 + 161.9 MiB | Pi 153.9 + 146.3 + service 182.4 MiB |
|
|
80
|
+
| Aggregate CPU over a one-second idle sample after two seconds of settling | 0% | 3.0% |
|
|
81
|
+
|
|
82
|
+
A separately started unconfigured service reached readiness in 68 ms at 67.7 MiB RSS without importing the full Continuous/model engine graph. Eligible monitoring loads that graph lazily and rechecks every eligibility branch afterward. First transfer/model work loads more of the existing engine and public SDK. The extraction adds process/IPC cost; these samples do **not** show an aggregate memory or latency reduction. RSS sums can double-count shared pages and are not physical-memory measurements. Each conflict case made exactly one synthetic request. Content compatibility checks used SHA-256 `f34848ca92665c342abd5816c9e3eda0e82180671195362bcd0080544a3bc2ac` for `base` plus newline and `c81662749eb30a2c7f6b6b9b1a561a7b0be5cc115759b72442ddb476e7712751` for `remote` plus newline.
|
|
83
|
+
|
|
84
|
+
The archived previous engine also held its real operation lock in a separate process: reviewed new-owner handover refused the active lock, a declined review still refused an idle old process with no lock, and reviewed handover succeeded only after that process exited. Configuration bytes remained unchanged. This proves the observed-lock and explicit-review branches, not automatic discovery of every idle older process.
|
|
85
|
+
|
|
86
|
+
## External handoff
|
|
87
|
+
|
|
88
|
+
| Responsible role | Prerequisite and action | Expected result | Unverified behavior and restriction |
|
|
89
|
+
| --- | --- | --- | --- |
|
|
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 |
|
|
91
|
+
| 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
|
+
| 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
|
+
| 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 |
|
package/docs/tui-contract.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
This reference records the setting and transfer contracts used by the TUI. It does not add a settings format or change transfer authorization.
|
|
4
4
|
|
|
5
|
+
## Action palette
|
|
6
|
+
|
|
7
|
+
The `/sync` TUI manager uses Kit's public searchable `ChoiceScreen` with at most five visible choices. Ordinary rows contain only labels; the selected action's short description appears below the list and is included in search. Search and selection survive a cancelled operation. Navigation, confirmation, cancellation, paste, focus, scrolling and constrained-height framing remain Kit-owned. RPC keeps an unfiltered list with the established **Sync now** label and a **Done** exit; TUI displays **Sync…** for that same action.
|
|
8
|
+
|
|
9
|
+
The homepage shows setup/storage, cached remote observations, last applied state and relevant automatic-transfer permissions. It does not render scheduler owners, leases, request accounting or candidate limits. Recorded background phases and successful background-transfer timestamps are explicitly historical; neither replaces a fresh remote check. Missing records show **not yet observed**, and unreadable or invalid records show **Unknown**. Last applied does not invent a timestamp or direction.
|
|
10
|
+
|
|
11
|
+
When Continuous sync is configured, **Diagnostics** opens a scrollable, read-only local report before offering **Continue to backend checks…**. Back returns to the palette; hard Ctrl+C closes the manager. Continuing still requires the existing backend-probe consent and setup-fingerprint recheck. The direct `/sync doctor` route remains unchanged.
|
|
12
|
+
|
|
13
|
+
The attention widget retains its labeled muted separator and one body row: **Open /sync to review** with the setup name. It remains passive, preserves collapse state and observation classification, and exposes detailed reasons through the manager and existing notifications. Session replacement, shutdown and stale asynchronous publication retain their existing cleanup guards.
|
|
14
|
+
|
|
15
|
+
Verification follows `docs/extension-conventions.md`, `docs/extension-settings.md`, and `docs/readme-conventions.md`. Palette tests cover bounded rendering, stable normal-height navigation, selected-action help, search/paste, non-default bindings, RPC and owner cancellation; existing transfer and stale-setup tests remain applicable. Physical-terminal appearance with the target font and pane sizes requires maintainer inspection. Live provider/backend behavior, Windows and Android were not newly verified by this presentation change. No settings schema, Kit API, transfer authorization or model-visible prefix changes are intended.
|
|
16
|
+
|
|
5
17
|
## Settings
|
|
6
18
|
|
|
7
19
|
All settings are private to this device. There are no project overrides. Defaults and validation are defined in `src/settings/settings-validation.ts` and `src/settings/config.ts`; mutation is owned by `settings-management.ts` and `settings-store.ts`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narumitw/pi-sync",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.1",
|
|
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,11 +46,8 @@
|
|
|
46
46
|
"typecheck": "tsc --noEmit"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@narumitw/
|
|
50
|
-
"
|
|
51
|
-
"minimatch": "^11.0.3",
|
|
52
|
-
"proper-lockfile": "^4.1.2",
|
|
53
|
-
"semver": "^7.8.6"
|
|
49
|
+
"@narumitw/sync-daemon": "^0.2.0",
|
|
50
|
+
"@narumitw/pi-tui-kit": "^0.70.0"
|
|
54
51
|
},
|
|
55
52
|
"devDependencies": {
|
|
56
53
|
"@earendil-works/pi-coding-agent": "1.5.0",
|
|
@@ -15,7 +15,7 @@ This skill provides guidance only, even when the request asks you to apply a cha
|
|
|
15
15
|
Read the relevant headings in the [settings reference](references/configuration.md), not the user's private settings file.
|
|
16
16
|
Use **Settings ownership and required fields**, **Complete version 3 example**, and **Required backend shapes** for schema, backend, and destination questions.
|
|
17
17
|
Use **Included content** and **Excluded paths** for path selection, exclusions, schema compatibility, and session privacy.
|
|
18
|
-
Use **Required backend shapes**, **Automatic startup transfer**, **Autonomous sync**,
|
|
18
|
+
Use **Required backend shapes**, **Automatic startup transfer**, **Autonomous sync**, **Continuous sync**, and **Daemon lifetime and unattended permission** to distinguish automatic controls and separate service lifetime from transfer/model consent.
|
|
19
19
|
Use **Settings field merge and machine-local fields**, **Content merge and partial progress**, and **Excluded paths** for the explicit version boundaries.
|
|
20
20
|
Use **Diagnostics** and **Unsupported old settings and recovery** for diagnostic side effects and recovery boundaries.
|
|
21
21
|
If the reference does not establish an answer, state the missing evidence instead of inventing a field, default, migration, or compatibility guarantee.
|
|
@@ -9,6 +9,7 @@ The configuration skill provides guidance only; the user performs settings chang
|
|
|
9
9
|
- [Secret scanning](#secret-scanning)
|
|
10
10
|
- [Autonomous sync](#autonomous-sync)
|
|
11
11
|
- [Continuous sync](#continuous-sync)
|
|
12
|
+
- [Daemon lifetime and unattended permission](#daemon-lifetime-and-unattended-permission)
|
|
12
13
|
- [Included content](#included-content)
|
|
13
14
|
- [Excluded paths](#excluded-paths)
|
|
14
15
|
- [Unsupported old settings and recovery](#unsupported-old-settings-and-recovery)
|
|
@@ -191,7 +192,7 @@ Automatic sync alone does not perform startup transfers or open dialogs; review
|
|
|
191
192
|
Print/JSON skip startup checks.
|
|
192
193
|
Checks compare local hashes and remote metadata against the last sync baseline, so revision changes and missing baselines require review rather than proving a file conflict.
|
|
193
194
|
|
|
194
|
-
The setting still permits automatic shutdown pushes of selected content when `sessions` is included
|
|
195
|
+
The setting still permits automatic shutdown pushes of selected content when `sessions` is included; this is not limited to uploading session files. Print/JSON require an already running, reviewed service and never launch one for shutdown.
|
|
195
196
|
Reload skips shutdown push.
|
|
196
197
|
Settings changes apply to subsequent operations; changing this setting does not schedule another startup check until the next session start.
|
|
197
198
|
Foreground `/sync` cancels a pending check before opening Settings.
|
|
@@ -521,6 +522,18 @@ No Pi core changes or other extension are required.
|
|
|
521
522
|
|
|
522
523
|
<a id="experimental-continuous-sync"></a>
|
|
523
524
|
|
|
525
|
+
### Daemon lifetime and unattended permission
|
|
526
|
+
|
|
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
|
+
|
|
529
|
+
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
|
+
|
|
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.
|
|
532
|
+
|
|
533
|
+
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
|
+
|
|
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).
|
|
536
|
+
|
|
524
537
|
### Continuous sync
|
|
525
538
|
|
|
526
539
|
`sync.continuous` is an optional per-setup boolean, default `false`, in settings versions 3, 4, 5 and 6.
|
|
@@ -529,7 +542,7 @@ RPC users can set the field explicitly in the private settings file.
|
|
|
529
542
|
Existing Autonomous sync consent does not enable recurring requests.
|
|
530
543
|
|
|
531
544
|
The separate review names the setup, storage connection, destination, included paths, recurring costs and automatic writes.
|
|
532
|
-
|
|
545
|
+
The service uses the participating idle clients’ matching independently reproducible model binding; differing bindings pause automatic work.
|
|
533
546
|
The save uses the existing atomic settings writer.
|
|
534
547
|
Cancellation after the final publication check cannot undo a committed save.
|
|
535
548
|
Reopen Settings to read the saved value.
|
|
@@ -543,13 +556,13 @@ Turning Autonomous sync off also stops monitoring; a saved Continuous sync On va
|
|
|
543
556
|
|
|
544
557
|
A control-file change during monitoring is detected by a watcher or the five-second local control check.
|
|
545
558
|
If monitoring is already off, external enablement requires the next session start or a foreground `/sync` command.
|
|
546
|
-
Print/JSON
|
|
547
|
-
|
|
559
|
+
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.
|
|
548
561
|
|
|
549
562
|
Upgrade all Pi processes sharing an agent directory before enabling Continuous sync.
|
|
550
563
|
Older releases do not implement its election or automatic accounting.
|
|
551
|
-
One
|
|
552
|
-
|
|
564
|
+
One detached service coordinates participating clients sharing the same canonical agent directory and reuses the engine’s scheduler lease, watchers, and request accounting.
|
|
565
|
+
Clients do not run a second transfer scheduler.
|
|
553
566
|
Each computer has a separate scheduler.
|
|
554
567
|
Remote conditional publication and revision checks remain authoritative across computers.
|
|
555
568
|
The lease does not exclude arbitrary editors or writers in other Pi processes.
|
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type SyncBackendFactory = {
|
|
5
|
-
bivarianceHack(config: AnySyncConfig): SyncBackend | Promise<SyncBackend>;
|
|
6
|
-
}["bivarianceHack"];
|
|
7
|
-
|
|
8
|
-
export const createSyncBackend: SyncBackendFactory = async (config) => {
|
|
9
|
-
switch (config.backend.type) {
|
|
10
|
-
case "s3": {
|
|
11
|
-
const { S3SyncBackend } = await import("./s3/s3-backend.js");
|
|
12
|
-
return new S3SyncBackend(config.backend);
|
|
13
|
-
}
|
|
14
|
-
case "webdav": {
|
|
15
|
-
const { WebDavSyncBackend } = await import("./webdav/webdav-backend.js");
|
|
16
|
-
return new WebDavSyncBackend(config.backend);
|
|
17
|
-
}
|
|
18
|
-
case "git": {
|
|
19
|
-
const { GitSyncBackend } = await import("./git/git-backend.js");
|
|
20
|
-
return new GitSyncBackend(config.backend);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
1
|
+
export type * from "@narumitw/sync-daemon/engine/backends/backend-factory";
|
|
2
|
+
export { createSyncBackend } from "@narumitw/sync-daemon/engine/backends/backend-factory";
|
|
@@ -1,40 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
switch (config.backend.type) {
|
|
7
|
-
case "s3":
|
|
8
|
-
return JSON.stringify([
|
|
9
|
-
"s3",
|
|
10
|
-
normalizeEndpointIdentity(config.backend.profile.endpoint),
|
|
11
|
-
config.backend.destination.bucket,
|
|
12
|
-
config.storagePath,
|
|
13
|
-
]);
|
|
14
|
-
case "git":
|
|
15
|
-
return JSON.stringify([
|
|
16
|
-
"git",
|
|
17
|
-
normalizeGitRemoteIdentity(config.backend.profile.remote),
|
|
18
|
-
config.backend.destination.branch,
|
|
19
|
-
config.storagePath,
|
|
20
|
-
]);
|
|
21
|
-
case "webdav":
|
|
22
|
-
return JSON.stringify([
|
|
23
|
-
"webdav",
|
|
24
|
-
normalizeWebDavIdentityUrl(config.backend.profile.url),
|
|
25
|
-
config.backend.profile.username,
|
|
26
|
-
config.storagePath,
|
|
27
|
-
]);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function normalizeEndpointIdentity(endpoint: string) {
|
|
32
|
-
try {
|
|
33
|
-
const url = new URL(endpoint.trim());
|
|
34
|
-
url.hostname = url.hostname.toLowerCase();
|
|
35
|
-
url.pathname = url.pathname.replace(/\/+$/gu, "");
|
|
36
|
-
return url.toString().replace(/\/$/u, "");
|
|
37
|
-
} catch {
|
|
38
|
-
return endpoint.trim();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
export type * from "@narumitw/sync-daemon/engine/backends/backend-identity";
|
|
2
|
+
export {
|
|
3
|
+
backendIdentityCoordinates,
|
|
4
|
+
normalizeEndpointIdentity,
|
|
5
|
+
} from "@narumitw/sync-daemon/engine/backends/backend-identity";
|
|
@@ -1,81 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/** Backend-only resolved S3 connection fields. */
|
|
3
|
-
export interface ResolvedS3StorageProfile {
|
|
4
|
-
kind: "r2" | "s3-compatible";
|
|
5
|
-
endpoint: string;
|
|
6
|
-
region: string;
|
|
7
|
-
accessKeyId: string;
|
|
8
|
-
secretAccessKey: string;
|
|
9
|
-
sessionToken?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/** Backend-only coordinates. `prefix` is the complete reviewed v3 storage path. */
|
|
13
|
-
export interface ResolvedS3Destination {
|
|
14
|
-
bucket: string;
|
|
15
|
-
prefix: string;
|
|
16
|
-
/** Snapshot/wire identity; never derived from the local setup name. */
|
|
17
|
-
namespace: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface ResolvedS3Backend {
|
|
21
|
-
type: "s3";
|
|
22
|
-
profile: ResolvedS3StorageProfile;
|
|
23
|
-
destination: ResolvedS3Destination;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface ResolvedWebDavStorageProfile {
|
|
27
|
-
kind: "webdav";
|
|
28
|
-
url: string;
|
|
29
|
-
username: string;
|
|
30
|
-
password: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** Backend-only coordinates. `path` is the complete reviewed v3 storage path. */
|
|
34
|
-
export interface ResolvedWebDavDestination {
|
|
35
|
-
path: string;
|
|
36
|
-
namespace: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface ResolvedWebDavBackend {
|
|
40
|
-
type: "webdav";
|
|
41
|
-
profile: ResolvedWebDavStorageProfile;
|
|
42
|
-
destination: ResolvedWebDavDestination;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface ResolvedGitStorageProfile {
|
|
46
|
-
kind: "git";
|
|
47
|
-
remote: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** Backend-only coordinates. `directory` is the complete reviewed v3 storage path. */
|
|
51
|
-
export interface ResolvedGitDestination {
|
|
52
|
-
branch: string;
|
|
53
|
-
directory: string;
|
|
54
|
-
namespace: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface ResolvedGitBackend {
|
|
58
|
-
type: "git";
|
|
59
|
-
profile: ResolvedGitStorageProfile;
|
|
60
|
-
destination: ResolvedGitDestination;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export type ResolvedSyncBackend = ResolvedS3Backend | ResolvedWebDavBackend | ResolvedGitBackend;
|
|
64
|
-
|
|
65
|
-
export interface LatestPointer {
|
|
66
|
-
version: number;
|
|
67
|
-
profile: string;
|
|
68
|
-
snapshot: string;
|
|
69
|
-
sha256: string;
|
|
70
|
-
createdAt: string;
|
|
71
|
-
machine: string;
|
|
72
|
-
syncSessions?: boolean;
|
|
73
|
-
/** Lightweight projection; the immutable snapshot remains authoritative. */
|
|
74
|
-
selection?: SnapshotSelection;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface RemoteObject<T> {
|
|
78
|
-
value?: T;
|
|
79
|
-
etag?: string;
|
|
80
|
-
missing: boolean;
|
|
81
|
-
}
|
|
1
|
+
export type * from "@narumitw/sync-daemon/engine/backends/backend-types";
|