@narumitw/pi-sync 0.57.8 → 0.57.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/CHANGELOG.md +306 -0
  2. package/README.md +2 -0
  3. package/dist/chunks/{agent-candidate-GNEYR225.ts → agent-candidate-EYB35AGL.ts} +12 -9
  4. package/dist/chunks/{agent-plan-3L7CRFDM.ts → agent-plan-KO43GTOR.ts} +22 -18
  5. package/dist/chunks/{agent-plan-3L7CRFDM.ts.map → agent-plan-KO43GTOR.ts.map} +1 -1
  6. package/dist/chunks/{agent-refusal-retry-AH7TXOQT.ts → agent-refusal-retry-C2HQROTP.ts} +12 -9
  7. package/dist/chunks/{agent-refusal-retry-AH7TXOQT.ts.map → agent-refusal-retry-C2HQROTP.ts.map} +1 -1
  8. package/dist/chunks/{agent-store-55CZOCPX.ts → agent-store-UT52DS7B.ts} +12 -11
  9. package/dist/chunks/{agent-store-55CZOCPX.ts.map → agent-store-UT52DS7B.ts.map} +1 -1
  10. package/dist/chunks/agent-sync-VM3TXWA3.ts +22 -0
  11. package/dist/chunks/{chunk-N5TFMPB5.ts → chunk-2VSN3MFX.ts} +71 -63
  12. package/dist/chunks/{chunk-N5TFMPB5.ts.map → chunk-2VSN3MFX.ts.map} +1 -1
  13. package/dist/chunks/{chunk-PG7NMFP2.ts → chunk-4RLATUP4.ts} +7 -7
  14. package/dist/chunks/chunk-5SFMBY5P.ts +26 -0
  15. package/dist/chunks/chunk-5SFMBY5P.ts.map +7 -0
  16. package/dist/chunks/chunk-5WJQ6XOW.ts +27 -0
  17. package/dist/chunks/chunk-5WJQ6XOW.ts.map +7 -0
  18. package/dist/chunks/{chunk-GNH73BJ5.ts → chunk-66GAUVDL.ts} +7 -7
  19. package/dist/chunks/{chunk-UPNVIUBN.ts → chunk-73MDIVYJ.ts} +3 -3
  20. package/dist/chunks/{chunk-CRKTAPSL.ts → chunk-AAPAHANE.ts} +24 -29
  21. package/dist/chunks/chunk-AAPAHANE.ts.map +7 -0
  22. package/dist/chunks/{chunk-S7QS4AWK.ts → chunk-AO6EDUA6.ts} +5 -5
  23. package/dist/chunks/chunk-AR2DGDUI.ts +55 -0
  24. package/dist/chunks/chunk-AR2DGDUI.ts.map +7 -0
  25. package/dist/chunks/{chunk-JCH3VXIO.ts → chunk-BJXSCGQK.ts} +9 -9
  26. package/dist/chunks/{chunk-IWZH5KYS.ts → chunk-CDQGSZL3.ts} +7 -7
  27. package/dist/chunks/chunk-DFJGTVPX.ts +319 -0
  28. package/dist/chunks/chunk-DFJGTVPX.ts.map +7 -0
  29. package/dist/chunks/chunk-DO55XUNU.ts +104 -0
  30. package/dist/chunks/chunk-DO55XUNU.ts.map +7 -0
  31. package/dist/chunks/{chunk-ED3TYIVW.ts → chunk-DOJRPBQU.ts} +5 -5
  32. package/dist/chunks/{chunk-5QAE3G3K.ts → chunk-IMMMZUFC.ts} +6 -6
  33. package/dist/chunks/{chunk-B4QZBDBT.ts → chunk-JXWTEJS5.ts} +3 -3
  34. package/dist/chunks/{chunk-BDB4IDM3.ts → chunk-JY2RVOUL.ts} +8 -6
  35. package/dist/chunks/{chunk-BDB4IDM3.ts.map → chunk-JY2RVOUL.ts.map} +1 -1
  36. package/dist/chunks/{chunk-5XZOC7FD.ts → chunk-KHBPED6W.ts} +4 -1
  37. package/dist/chunks/chunk-KHBPED6W.ts.map +7 -0
  38. package/dist/chunks/{chunk-P7DD5PWZ.ts → chunk-M5IV3KL2.ts} +3 -3
  39. package/dist/chunks/{chunk-AAEEHR7H.ts → chunk-MDUORMCK.ts} +2 -2
  40. package/dist/chunks/{chunk-UBV24CG4.ts → chunk-MRIPZGPR.ts} +3 -3
  41. package/dist/chunks/{chunk-WD6FJHCK.ts → chunk-ODF2M4RF.ts} +5 -5
  42. package/dist/chunks/chunk-PHANBTVM.ts +348 -0
  43. package/dist/chunks/chunk-PHANBTVM.ts.map +7 -0
  44. package/dist/chunks/{chunk-GP5DU62N.ts → chunk-PWA3YN5Z.ts} +2 -2
  45. package/dist/chunks/{chunk-YK52VDXG.ts → chunk-QWV3XKNJ.ts} +10 -8
  46. package/dist/chunks/{chunk-YK52VDXG.ts.map → chunk-QWV3XKNJ.ts.map} +1 -1
  47. package/dist/chunks/{chunk-ORGBI36T.ts → chunk-RAMHGOX2.ts} +4 -4
  48. package/dist/chunks/{chunk-QO333NM4.ts → chunk-RX3WGWVL.ts} +5 -5
  49. package/dist/chunks/chunk-RX3WGWVL.ts.map +7 -0
  50. package/dist/chunks/{chunk-PQW6GS4J.ts → chunk-STVQQ5KG.ts} +12 -10
  51. package/dist/chunks/{chunk-PQW6GS4J.ts.map → chunk-STVQQ5KG.ts.map} +1 -1
  52. package/dist/chunks/{chunk-76NB4R7U.ts → chunk-TO2GMX3K.ts} +2 -2
  53. package/dist/chunks/{chunk-GSNPASKB.ts → chunk-U77DWNRH.ts} +6 -6
  54. package/dist/chunks/{chunk-U3XRI2HF.ts → chunk-UCD7TQDT.ts} +11 -11
  55. package/dist/chunks/{chunk-A6HU4ERM.ts → chunk-UGSSZWQ6.ts} +6 -23
  56. package/dist/chunks/chunk-UGSSZWQ6.ts.map +7 -0
  57. package/dist/chunks/chunk-X7R6DCVF.ts +28 -0
  58. package/dist/chunks/chunk-X7R6DCVF.ts.map +7 -0
  59. package/dist/chunks/{chunk-HUZ5CR4W.ts → chunk-YZ5BQNRZ.ts} +2 -51
  60. package/dist/chunks/{chunk-HUZ5CR4W.ts.map → chunk-YZ5BQNRZ.ts.map} +4 -4
  61. package/dist/chunks/{chunk-UOHR7LRO.ts → chunk-Z5O2TLNF.ts} +9 -21
  62. package/dist/chunks/chunk-Z5O2TLNF.ts.map +7 -0
  63. package/dist/chunks/command-handler-FO6F2APH.ts +543 -0
  64. package/dist/chunks/command-handler-FO6F2APH.ts.map +7 -0
  65. package/dist/chunks/{config-KGIYTTXQ.ts → config-B37W7FXW.ts} +5 -6
  66. package/dist/chunks/{conflict-artifacts-FXFIIBCB.ts → conflict-artifacts-6XGSSU5S.ts} +13 -9
  67. package/dist/chunks/{conflict-review-UC5AGVER.ts → conflict-review-BQSHSJB3.ts} +32 -26
  68. package/dist/chunks/{conflict-review-UC5AGVER.ts.map → conflict-review-BQSHSJB3.ts.map} +1 -1
  69. package/dist/chunks/{continuous-record-SQJ47CXN.ts → continuous-record-4DQ2EAZS.ts} +8 -7
  70. package/dist/chunks/{continuous-sync-POEQXR25.ts → continuous-sync-ZT3UEQLK.ts} +33 -28
  71. package/dist/chunks/{continuous-sync-POEQXR25.ts.map → continuous-sync-ZT3UEQLK.ts.map} +1 -1
  72. package/dist/chunks/{file-selection-3JJYOVNR.ts → file-selection-FBLKM25V.ts} +12 -10
  73. package/dist/chunks/{file-selection-3JJYOVNR.ts.map → file-selection-FBLKM25V.ts.map} +1 -1
  74. package/dist/chunks/{git-backend-NYKSG5X6.ts → git-backend-7PCWECRN.ts} +16 -12
  75. package/dist/chunks/{git-backend-NYKSG5X6.ts.map → git-backend-7PCWECRN.ts.map} +1 -1
  76. package/dist/chunks/{local-fields-6DGYOOIK.ts → local-fields-B6JWLPAE.ts} +10 -5
  77. package/dist/chunks/manager-result-dispatcher-NODX3KKH.ts +28 -0
  78. package/dist/chunks/{manager-ui-26LEINEX.ts → manager-ui-DGRTG76I.ts} +47 -41
  79. package/dist/chunks/{manager-ui-26LEINEX.ts.map → manager-ui-DGRTG76I.ts.map} +1 -1
  80. package/dist/chunks/{merge-baseline-store-RFCAH7KL.ts → merge-baseline-store-HL3VLMAM.ts} +6 -5
  81. package/dist/chunks/{remote-selection-ui-YFPGYGNE.ts → remote-selection-ui-OHMIQ32X.ts} +14 -10
  82. package/dist/chunks/{s3-backend-F7PR5FB3.ts → s3-backend-CJXBEWWU.ts} +21 -17
  83. package/dist/chunks/{s3-backend-F7PR5FB3.ts.map → s3-backend-CJXBEWWU.ts.map} +1 -1
  84. package/dist/chunks/{setup-switch-E7PHKI6J.ts → setup-switch-66GWMBNH.ts} +6 -7
  85. package/dist/chunks/{setup-wizard-OVHZYXNW.ts → setup-wizard-OHZXJVQZ.ts} +8 -9
  86. package/dist/chunks/{setup-wizard-OVHZYXNW.ts.map → setup-wizard-OHZXJVQZ.ts.map} +1 -1
  87. package/dist/chunks/{snapshot-THS5EY2L.ts → snapshot-VRHNAUUH.ts} +11 -6
  88. package/dist/chunks/snapshot-transaction-EUGA4VX6.ts +24 -0
  89. package/dist/chunks/sync-inspection-4WFQEJOE.ts +25 -0
  90. package/dist/chunks/sync-inspection-4WFQEJOE.ts.map +7 -0
  91. package/dist/chunks/{sync-operations-ZHA6HQDB.ts → sync-operations-X4AOXMBT.ts} +66 -57
  92. package/dist/chunks/{sync-operations-ZHA6HQDB.ts.map → sync-operations-X4AOXMBT.ts.map} +1 -1
  93. package/dist/chunks/{sync-state-CFL4RRRB.ts → sync-state-SWLSMK4G.ts} +9 -5
  94. package/dist/chunks/sync-state-SWLSMK4G.ts.map +7 -0
  95. package/dist/chunks/{webdav-backend-TGFUH3SF.ts → webdav-backend-2Q5ZEBST.ts} +16 -12
  96. package/dist/chunks/{webdav-backend-TGFUH3SF.ts.map → webdav-backend-2Q5ZEBST.ts.map} +1 -1
  97. package/dist/index.ts +54 -537
  98. package/dist/index.ts.map +3 -3
  99. package/package.json +5 -4
  100. package/src/settings/config.ts +1 -1
  101. package/src/settings/settings-validation.ts +1 -1
  102. package/src/snapshot/snapshot-transaction-directory.ts +16 -0
  103. package/src/snapshot/snapshot-transaction.ts +1 -12
  104. package/src/sync/automatic-sync.ts +12 -6
  105. package/src/sync/local-field-policy.ts +29 -0
  106. package/src/sync/local-fields.ts +3 -29
  107. package/src/sync/mutation-owner.ts +22 -0
  108. package/src/sync/startup-check.ts +3 -2
  109. package/src/sync/sync-loaders.ts +4 -0
  110. package/src/sync/sync-local.ts +2 -19
  111. package/src/sync-extension.ts +7 -2
  112. package/src/ui/sync-confirmation.ts +3 -0
  113. package/dist/chunks/chunk-5XZOC7FD.ts.map +0 -7
  114. package/dist/chunks/chunk-A6HU4ERM.ts.map +0 -7
  115. package/dist/chunks/chunk-CRKTAPSL.ts.map +0 -7
  116. package/dist/chunks/chunk-QO333NM4.ts.map +0 -7
  117. package/dist/chunks/chunk-QOFMXPM5.ts +0 -735
  118. package/dist/chunks/chunk-QOFMXPM5.ts.map +0 -7
  119. package/dist/chunks/chunk-UOHR7LRO.ts.map +0 -7
  120. package/dist/chunks/manager-result-dispatcher-HOCM2GDA.ts +0 -24
  121. package/dist/chunks/sync-inspection-J25EEKZK.ts +0 -21
  122. /package/dist/chunks/{agent-candidate-GNEYR225.ts.map → agent-candidate-EYB35AGL.ts.map} +0 -0
  123. /package/dist/chunks/{config-KGIYTTXQ.ts.map → agent-sync-VM3TXWA3.ts.map} +0 -0
  124. /package/dist/chunks/{chunk-PG7NMFP2.ts.map → chunk-4RLATUP4.ts.map} +0 -0
  125. /package/dist/chunks/{chunk-GNH73BJ5.ts.map → chunk-66GAUVDL.ts.map} +0 -0
  126. /package/dist/chunks/{chunk-UPNVIUBN.ts.map → chunk-73MDIVYJ.ts.map} +0 -0
  127. /package/dist/chunks/{chunk-S7QS4AWK.ts.map → chunk-AO6EDUA6.ts.map} +0 -0
  128. /package/dist/chunks/{chunk-JCH3VXIO.ts.map → chunk-BJXSCGQK.ts.map} +0 -0
  129. /package/dist/chunks/{chunk-IWZH5KYS.ts.map → chunk-CDQGSZL3.ts.map} +0 -0
  130. /package/dist/chunks/{chunk-ED3TYIVW.ts.map → chunk-DOJRPBQU.ts.map} +0 -0
  131. /package/dist/chunks/{chunk-5QAE3G3K.ts.map → chunk-IMMMZUFC.ts.map} +0 -0
  132. /package/dist/chunks/{chunk-B4QZBDBT.ts.map → chunk-JXWTEJS5.ts.map} +0 -0
  133. /package/dist/chunks/{chunk-P7DD5PWZ.ts.map → chunk-M5IV3KL2.ts.map} +0 -0
  134. /package/dist/chunks/{chunk-AAEEHR7H.ts.map → chunk-MDUORMCK.ts.map} +0 -0
  135. /package/dist/chunks/{chunk-UBV24CG4.ts.map → chunk-MRIPZGPR.ts.map} +0 -0
  136. /package/dist/chunks/{chunk-WD6FJHCK.ts.map → chunk-ODF2M4RF.ts.map} +0 -0
  137. /package/dist/chunks/{chunk-GP5DU62N.ts.map → chunk-PWA3YN5Z.ts.map} +0 -0
  138. /package/dist/chunks/{chunk-ORGBI36T.ts.map → chunk-RAMHGOX2.ts.map} +0 -0
  139. /package/dist/chunks/{chunk-76NB4R7U.ts.map → chunk-TO2GMX3K.ts.map} +0 -0
  140. /package/dist/chunks/{chunk-GSNPASKB.ts.map → chunk-U77DWNRH.ts.map} +0 -0
  141. /package/dist/chunks/{chunk-U3XRI2HF.ts.map → chunk-UCD7TQDT.ts.map} +0 -0
  142. /package/dist/chunks/{conflict-artifacts-FXFIIBCB.ts.map → config-B37W7FXW.ts.map} +0 -0
  143. /package/dist/chunks/{continuous-record-SQJ47CXN.ts.map → conflict-artifacts-6XGSSU5S.ts.map} +0 -0
  144. /package/dist/chunks/{local-fields-6DGYOOIK.ts.map → continuous-record-4DQ2EAZS.ts.map} +0 -0
  145. /package/dist/chunks/{manager-result-dispatcher-HOCM2GDA.ts.map → local-fields-B6JWLPAE.ts.map} +0 -0
  146. /package/dist/chunks/{merge-baseline-store-RFCAH7KL.ts.map → manager-result-dispatcher-NODX3KKH.ts.map} +0 -0
  147. /package/dist/chunks/{remote-selection-ui-YFPGYGNE.ts.map → merge-baseline-store-HL3VLMAM.ts.map} +0 -0
  148. /package/dist/chunks/{setup-switch-E7PHKI6J.ts.map → remote-selection-ui-OHMIQ32X.ts.map} +0 -0
  149. /package/dist/chunks/{snapshot-THS5EY2L.ts.map → setup-switch-66GWMBNH.ts.map} +0 -0
  150. /package/dist/chunks/{sync-inspection-J25EEKZK.ts.map → snapshot-VRHNAUUH.ts.map} +0 -0
  151. /package/dist/chunks/{sync-state-CFL4RRRB.ts.map → snapshot-transaction-EUGA4VX6.ts.map} +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,306 @@
1
+ # @narumitw/pi-sync
2
+
3
+ ## 0.57.10
4
+
5
+ ### Patch Changes
6
+
7
+ - a6582dc: Reduce Pi startup loading by deferring command, transfer, and recovery implementations until needed. Preserve awaited recovery for pending file transactions and all existing sync settings.
8
+ - Updated dependencies [4f79c28]
9
+ - @narumitw/pi-tui-kit@0.69.1
10
+
11
+ ## 0.57.9
12
+
13
+ ### Patch Changes
14
+
15
+ - 54f2700: Preserve fullscreen viewport capture through custom list wrappers so default and configured paging keys reach the focused list. Keep native transcript search, unrelated overlays, free-text modes, paste, and hard cancellation unchanged. Filter Kit key hints according to each screen's capture policy.
16
+
17
+ Update Recall and File Context to the current Kit dependency range. The selected consumer releases require the fixed Kit patch through Changesets dependency-floor updates.
18
+ - e484010: Include the existing package-root CHANGELOG.md in extension tarballs so Pi can show native update notices. Keep Changesets version headings and Pi's first-observation and collapseChangelog behavior unchanged.
19
+ - Updated dependencies [54f2700]
20
+ - Updated dependencies [6c76ef1]
21
+ - @narumitw/pi-tui-kit@0.69.0
22
+
23
+ ## 0.57.8
24
+
25
+ ### Patch Changes
26
+
27
+ - 9d3e0d7: Unreference passive refresh, debounce, expiry, and background startup timers so they do not keep the host process alive when other work has stopped. Keep normal cancellation and resource cleanup unchanged.
28
+ - Updated dependencies [9d3e0d7]
29
+ - @narumitw/pi-tui-kit@0.68.1
30
+
31
+ ## 0.57.7
32
+
33
+ ### Patch Changes
34
+
35
+ - 3bf3525: Keep startup timing reports in the TUI transcript without adding model context, and report the initial Continuous sync cycle when debug is enabled. Preserve RPC notifications and suppress repeated or stale cycle reports.
36
+
37
+ ## 0.57.6
38
+
39
+ ### Patch Changes
40
+
41
+ - Updated dependencies [a21d39b]
42
+ - Updated dependencies [f68aa54]
43
+ - Updated dependencies [b062d21]
44
+ - @narumitw/pi-tui-kit@0.68.0
45
+
46
+ ## 0.57.5
47
+
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies [57eeae7]
51
+ - @narumitw/pi-tui-kit@0.67.0
52
+
53
+ ## 0.57.4
54
+
55
+ ### Patch Changes
56
+
57
+ - 168248c: Reuse published TUI Kit frame metadata, masked input, configured-key syntax, and interaction ownership while retaining extension-owned settings and cancellation policy. Keep malformed Ticker key strings from suppressing valid reorder shortcuts, and drain Usage settings saves after cancellation.
58
+
59
+ ## 0.57.3
60
+
61
+ ### Patch Changes
62
+
63
+ - 11da747: Recover Continuous sync after proven pre-publication edit races and repaired content safety blocks. Avoid model requests when unsupported conflicts prevent an all-or-nothing transfer, and propagate resolver deadlines through validation and reservation work.
64
+
65
+ Add a separately confirmed manager action to retry a current cached model refusal without resetting automatic accounting. Preserve ordinary Sync now cache behavior and retain the previous refusal privately. Show read-only request allowance, accounting capacity, and category-specific recovery guidance.
66
+
67
+ ## 0.57.2
68
+
69
+ ### Patch Changes
70
+
71
+ - 9f80b89: Use native fake-cursor markers for masked credential input and normalize unusable render widths without changing secret editing, validation, cancellation, or storage policy.
72
+ - Updated dependencies [077137a]
73
+ - Updated dependencies [9f80b89]
74
+ - Updated dependencies [efc474c]
75
+ - @narumitw/pi-tui-kit@0.66.0
76
+
77
+ ## 0.57.1
78
+
79
+ ### Patch Changes
80
+
81
+ - a87a2ba: Keep the higher local or remote explicit npm package version when Agent mode merges settings, without a registry lookup. Preserve matching resource filters and one-sided package order or membership changes. Keep changed non-npm sources and conflicting package lists under atomic conflict handling. Preserve existing package-array bytes and use ancestor rules when SemVer precedence is equal. Keep accepted settings documents unchanged unless a package override is required.
82
+
83
+ ## 0.57.0
84
+
85
+ ### Minor Changes
86
+
87
+ - fa985f7: Add the manual-only `configure-pi-sync` skill for configuration questions and safe setup guidance without private settings reads, edits, or sync execution.
88
+ Bundle the authoritative settings reference with the skill and preserve existing settings documentation anchors.
89
+
90
+ ## 0.56.0
91
+
92
+ ### Minor Changes
93
+
94
+ - 713eed4: Add default-off experimental Continuous sync with separate consent, local scheduler ownership, automatic detection and recovery, durable request limits, and safe blocked-state reporting. Bind each background cycle to its inspected settings and selected model before transfer, disclosure, publication, and local apply. Show the saved On or Off state in Continuous sync notifications.
95
+
96
+ ## 0.55.0
97
+
98
+ ### Minor Changes
99
+
100
+ - 1e86ba9: Add default-off experimental Agent mode for autonomous text and atomic settings conflict resolution through an isolated, tool-free Pi SDK session. Revalidate candidates before conditional publication, retain journal recovery, and coordinate local resolver ownership across Pi processes. Require a Pi runtime that supplies the tested public SDK boundary.
101
+
102
+ ### Patch Changes
103
+
104
+ - e0028ea: Simplify internal settings saves, initial-sync routing, cancellation checkpoints, and object-store snapshot metadata without changing sync behavior.
105
+
106
+ ## 0.54.3
107
+
108
+ ### Patch Changes
109
+
110
+ - 2a9ad3a: Add opt-in startup timing notifications with the global `debug` boolean setting, including local initialization, background inspection, and automatic transfer stages.
111
+ - d02ca5f: Skip remote snapshot downloads and baseline rewrites for verified unchanged automatic transfers while retaining recovery and conservative fallbacks. Add aggregated transfer-stage durations and call counts to startup debug reports.
112
+ - 8ae9e62: Group Settings by task, retain cross-category search, and clarify setting scope, save results, and independent startup policies. Add manager status/difference actions and directional transfer counts with safe-default scrollable TUI Pull/Push reviews. Recheck reviewed local content and baselines, preserve protected sessions in preview counts, and clarify that remote removals do not erase retained history.
113
+
114
+ ## 0.54.2
115
+
116
+ ### Patch Changes
117
+
118
+ - 491fc28: Fix Windows EPERM errors when syncing snapshot backups and staged recovery files by opening regular files with write access for flushing.
119
+
120
+ ## 0.54.1
121
+
122
+ ### Patch Changes
123
+
124
+ - 2191720: Show clear local and remote change summaries with one explicit safe-default confirmation and optional read-only details. Keep remote snapshot publication separate from file changes and preserve cancellation and stale-state guards. On compact terminals, scroll the main summary before approval; resizing resets the review and the safe default.
125
+
126
+ ## 0.54.0
127
+
128
+ ### Minor Changes
129
+
130
+ - 80eef72: Flatten the sync manager: expose reviewed Pull, Push, History, and Diagnostics directly, move destination and catalog management into searchable Settings, and show conflict/access recovery only when applicable. Preserve existing commands, automation policies, and safety confirmations.
131
+
132
+ Require the TUI Kit patch that preserves Settings search and cursor across refreshes, including queries that match printable keybindings.
133
+
134
+ Preserve Settings search and cursor across successful refreshes in TUI Kit, and restore Settings and Choice queries as sanitized pasted content without dispatching printable keybindings.
135
+
136
+ ### Patch Changes
137
+
138
+ - e32bf5b: Keep History rollback cancellation reachable after snapshot selection and confirmation restore the normal editor. Release the temporary terminal listener when the operation settles or its owner closes, and preserve the existing non-cancellable commit boundary. Ignore Kitty key-release events before matching cancellation so releasing a key does not abort History. Preserve focused dialogs' key priorities, and distinguish aborted or stale rollback confirmations from explicit rejection before notifying.
139
+ - Updated dependencies [6a2f900]
140
+ - Updated dependencies [80eef72]
141
+ - @narumitw/pi-tui-kit@0.65.5
142
+
143
+ ## 0.53.1
144
+
145
+ ### Patch Changes
146
+
147
+ - fbb7757: Request identity representations for S3 reads so transfer compression does not weaken R2 JSON ETags and block safe conditional publication. Weak or missing ETags still fail closed. Reconcile inactive journals recorded with compression-weakened revisions only when the current strong ETag and exact pointer reproduce the recorded revision and local content and baseline are unchanged; this equivalence never authorizes publication or apply.
148
+
149
+ Show bounded, terminal-safe, credential-redacted failure details for interrupted merged transfers while preserving journals, backups, and existing recovery behavior.
150
+
151
+ ## 0.53.0
152
+
153
+ ### Minor Changes
154
+
155
+ - d22b0b1: Support automatic transfer for R2/S3 using verified ETag conditional publication. Verify conditional-write behavior with an isolated temporary object before publication, protect active-pointer and history writes against concurrent writers, and preserve unknown-outcome recovery for transport failures. Credentials now require delete access for probe cleanup; unsupported conditional writes fail closed.
156
+
157
+ ## 0.52.1
158
+
159
+ ### Patch Changes
160
+
161
+ - 1e2df4b: Prevent reviewed case-only renames from deadlocking on case-insensitive filesystems while retaining file mutation queue protection for both spellings.
162
+
163
+ ## 0.52.0
164
+
165
+ ### Minor Changes
166
+
167
+ - 69fafc0: Add opt-in conservative settings field merging with verified private ancestors and explicit machine-local field projection. Portable policies use settings version 4 and snapshot version 2 so older clients refuse them; policy changes require directional migration confirmation and do not erase remote history. Support portable snapshots across S3, WebDAV and Git, retain version-4 setup management, capture initial accepted ancestors, prune completed cache history, and preview effective local images. Preserve per-setup policy absence, require explicit empty-policy migration, recheck force-push policies after remote refresh, clear cancelled migration status, and allow validated settings deletion when no excluded field is present. Bind recovery journals to policy presence, refuse pull policy rewrites until the authoritative remote matches, and preserve unsafe ancestor records during pruning. Surface policy-only changes in inspection, reject portable snapshots that retain excluded root fields, and guard empty first-sync acceptance. Finish rollback publication and prune accepted ancestors after post-commit cancellation while retaining session ownership checks. Require managed settings for nonempty exclusions, authorize rollback against current-head policy, refuse mismatched historical rules, and validate recovery images with their recorded policy so reviewed force recovery remains available. Normalize accepted portable projections without rejecting valid noncanonical journal JSON, refuse lossy numeric field merges and projections, and bind directional local-field writes to reviewed preimages through transaction backup preparation.
168
+ - a2b1e22: Add all-or-nothing, file-level three-way merging for **Sync now** with an established baseline. Independent changes merge automatically; initial-source choices, true conflicts, legacy selection policies, and session-root changes still require review. Explicit push/pull remain directional, and existing automatic defaults are unchanged.
169
+
170
+ Add an opt-in automatic startup transfer at idle in TUI/RPC for conditional or lease-protected backends. Transfers protect the current session, revalidate local content and settings, and never reload resources automatically. Cancellation clears owned progress without publishing stale attention or affecting a replacement session.
171
+
172
+ Harden interrupted-transfer recovery with durable private backups and journals, guarded file installation, case-only replacement handling, and verified settings/root-transition evidence, including settings deletion and canonical tilde expansion. Reject unsafe target aliases and newer or ambiguous filesystem states; preserve evidence for manual review rather than blindly restoring older content. Completed journals resume cleanup without rolling back accepted files. Do not downgrade while recovery evidence is pending.
173
+
174
+ Preserve supported native POSIX filenames, escape path controls in review output, and index transaction planning and recovery checks to avoid repeated full scans.
175
+ - 07f98a4: Add opt-in bounded text merging, conservative validated same-session prefix reconciliation, and durable partial progress with private conflict artifacts and deferred whole-group review. Withheld local/remote versions and old accepted ancestors survive publication and restart; older readers refuse version-5 settings/version-3 partial snapshots. Preserve unmanaged collision barriers and loaded-session protection, stop automatic transfers at unresolved conflicts, defer conflict artifacts for transfer plans until after approved fresh review, and complete setup arguments for conflict review. Accept Pi's public session ID grammar, recover withheld equal deletions, index conflict grouping and bounded previews, and dispatch manager conflict-review decisions. Preserve main's portability and recovery safety contracts, authorize explicit manager roots, move large reviewed settings postimages into hash-pinned private sidecars, track crash-owned recovery staging, index whole-group resolution, and omit colliding paths from accepted ancestor caches. Finish reviewed multi-child/nested directory replacements in one pass with guarded retry, prevent automatic or unreviewed whole-direction acceptance from clearing unresolved conflicts, and index withheld snapshot assembly and carried ancestor membership. Bound cumulative text diff and hunk work across retries, revalidate no-transfer acceptance before evidence publication, and release only newly owned, unreferenced artifacts after failed attempts.
176
+
177
+ ## 0.51.1
178
+
179
+ ### Patch Changes
180
+
181
+ - 68c4b95: Update runtime dependencies and preserve Pi tool-context types through the LSP session lifecycle guard for compatibility with current Pi releases.
182
+
183
+ ## 0.51.0
184
+
185
+ ### Minor Changes
186
+
187
+ - bef29cf: Add a global Show status setting that can suppress pi-sync status text while preserving widgets and notifications.
188
+
189
+ ### Patch Changes
190
+
191
+ - ae48402: Replace verbose status messages with compact `sync ...`, `sync ⇡`, `sync ⇣`, and `sync ⇕` indicators.
192
+
193
+ ## 0.50.3
194
+
195
+ ### Patch Changes
196
+
197
+ - 7ec32e4: Reuse published Kit interaction hints for secret input and cancellable operations. Deduplicate cancel aliases and omit the submit hint when no submit key is configured.
198
+ - Updated dependencies [317f7bd]
199
+ - @narumitw/pi-tui-kit@0.61.0
200
+
201
+ ## 0.50.2
202
+
203
+ ### Patch Changes
204
+
205
+ - f6f26ff: Reserve persistent sync widgets and RPC warnings for review conditions. Show ordinary one-sided changes through status, keep setup and empty-remote initialization guidance in the manager, and preserve observations and transfer safety checks.
206
+
207
+ ## 0.50.1
208
+
209
+ ### Patch Changes
210
+
211
+ - 0f319d2: Add a themed horizontal separator above the sync attention widget to match other widgets above the editor.
212
+
213
+ ## 0.50.0
214
+
215
+ ### Minor Changes
216
+
217
+ - f566ede: Replace automatic startup transfers with a cancellable background check in TUI and RPC. Pi no longer waits for remote storage or opens startup conflict dialogs; review differences through `/sync` before transferring. The existing `sync.automatic` setting now checks only at startup, while its sessions-enabled automatic shutdown push remains unchanged. Print and JSON modes skip startup checks.
218
+
219
+ Keep local recovery ahead of user operations, give foreground commands priority, and drain Git cache cleanup before releasing sync locks. Startup observations are advisory and revalidated before manual operations. Cancelled or pre-commit failed reviews retain valid hints; successful fresh reviews clear superseded content-list mismatch hints. Setup summaries disclose conditional shutdown pushes, and recovery help remains available when state roots need repair.
220
+
221
+ ### Patch Changes
222
+
223
+ - 64b207b: Replace the initial setup purpose menu with direct name input, examples, and a brief explanation of suggested storage paths and separate sync choices. Blank names use `default`. Validate names and suggested backend locations before collecting connection details, and allow invalid names to be corrected immediately.
224
+ - 41eaa76: Simplify initial setup to one name across storage backends. Show input examples, explanations, and blank-to-accept defaults directly in Pi's dialogs without treating example endpoints or credentials as defaults. Default all new storage paths to the repository, WebDAV collection, or bucket root, without literal dot prefixes or changes to existing settings. New Git destinations use main, with existing branch safety checks preserved. Require a different path or Git branch before reviewing an additional setup when its chosen location is already configured. Preserve valid literal angle brackets in WebDAV input and edit defaults.
225
+ - 7af24f8: Keep initial R2/S3 storage paths identical in the setup review, saved settings, and resolved backend configuration. Setup names are independent of the default root path, including names with trailing slashes.
226
+ - f212568: Resolve the Git cache root to an absolute path so snapshot publication works when the cache path is relative and payload hashing changes the subprocess working directory.
227
+ - 12998a9: Simplify the setup-name prompt and distinguish its guidance with the theme's muted color.
228
+ - fdca695: Make setup choices explicit, retry invalid inputs, and show complete scrollable destination reviews. Clarify connection/setup menus and local save boundaries, retain drafts after recoverable save failures, and add actionable errors with bounded read-only S3 diagnostics.
229
+
230
+ ## 0.49.15
231
+
232
+ ### Patch Changes
233
+
234
+ - ec874c3: Add a global Settings option to skip push secret scanning while keeping the safe default and doctor diagnostics.
235
+
236
+ ## 0.49.14
237
+
238
+ ### Patch Changes
239
+
240
+ - Updated dependencies [40182e5]
241
+ - @narumitw/pi-tui-kit@0.59.0
242
+
243
+ ## 0.49.13
244
+
245
+ ### Patch Changes
246
+
247
+ - dc9802e: Keep Ctrl+C available as a hard-cancel input when configurable cancellation bindings are remapped.
248
+ - Updated dependencies [78276b0]
249
+ - Updated dependencies [dc9802e]
250
+ - @narumitw/pi-tui-kit@0.58.1
251
+
252
+ ## 0.49.12
253
+
254
+ ### Patch Changes
255
+
256
+ - 806eada: Reduce extension startup time by letting generated TypeScript chunks reference their emitted `.ts` files directly.
257
+
258
+ ## 0.49.11
259
+
260
+ ### Patch Changes
261
+
262
+ - 9224800: Load the extension from a generated split TypeScript runtime to reduce Jiti startup work while preserving existing first-use boundaries.
263
+
264
+ ## 0.49.10
265
+
266
+ ### Patch Changes
267
+
268
+ - e3375f0: Avoid migration-lock contention during normal state access and safely share legacy migration protection across overlapping work in one Pi process.
269
+
270
+ ## 0.49.9
271
+
272
+ ### Patch Changes
273
+
274
+ - 38a36bb: Make interrupted-operation recovery immediately actionable in the sync manager, distinguish live and guarded operations from recoverable locks, confirm local-lock removal, and return directly to normal sync actions after recovery.
275
+
276
+ ## 0.49.8
277
+
278
+ ### Patch Changes
279
+
280
+ - f75f7e9: Open reviewed synced-content recovery when automatic or interactive TUI sync detects a content-list mismatch, preserve deferred attention in the manager and editor, and keep deterministic and non-TUI routes non-blocking.
281
+
282
+ ## 0.49.7
283
+
284
+ ### Patch Changes
285
+
286
+ - 549e626: Resolve differing local and remote synced-content lists inline with reviewed adoption, explicit continuation, and the existing safe force-push path.
287
+
288
+ ## 0.49.6
289
+
290
+ ### Patch Changes
291
+
292
+ - fa9c938: Reduce idle startup imports by loading Goal presentation, Chat networking and UI, and Sync operation-specific modules only when their routes require them.
293
+
294
+ ## 0.49.5
295
+
296
+ ### Patch Changes
297
+
298
+ - 8289ba9: Move operational state from `.pisync` to `pi-sync` with an explicit guarded migration and fail-closed path handling.
299
+ - Updated dependencies [736ca9e]
300
+ - @narumitw/pi-tui-kit@0.52.0
301
+
302
+ ## 0.49.4
303
+
304
+ ### Patch Changes
305
+
306
+ - 6432b4d: Make included-content intent portable across snapshots, add reviewed remote-policy adoption, pause sync on explicit policy divergence, and allow safe custom paths that exist only remotely.
package/README.md CHANGED
@@ -172,6 +172,8 @@ See [Debug startup timings](./skills/configure-pi-sync/references/configuration.
172
172
 
173
173
  ### Background startup checks
174
174
 
175
+ Startup loads command and transfer implementations only when needed. When no transaction directory is pending, a local directory check skips loading the file-recovery implementation. Pending transactions still complete recovery before Pi accepts user edits; this safety barrier is not deferred.
176
+
175
177
  With **Automatic sync** enabled, session startup schedules a background check instead of waiting for a transfer. Pi remains usable while Git, WebDAV, R2, or S3 checks local hashes and remote metadata. Results follow the [status and review classifications](#resolve-conflicts-in-the-manager); check failures provide `/sync` guidance without opening a dialog. Use **Sync now** to start a reviewed transfer, or `/sync status` to retry a check. Foreground `/sync` cancels and drains the background check before starting.
176
178
 
177
179
  Checks run once per session start, including `/reload`, new, resumed, and forked sessions, in TUI and RPC only. Print/JSON skip startup checks. This one-shot policy has no polling or automatic retry loop; separately enabled Continuous sync owns recurring work. The overall deadline is 30 seconds, followed by underlying cleanup where needed; Git process termination and temporary-ref cleanup can take additional time. Git checks can still fetch objects and update the extension's private bare cache, but never push, apply managed files, update the sync baseline, or reload Pi.
@@ -5,22 +5,25 @@ import {
5
5
  buildAgentEvidence,
6
6
  digest,
7
7
  parseAgentCandidate
8
- } from "./chunk-5QAE3G3K.ts";
9
- import "./chunk-S7QS4AWK.ts";
10
- import "./chunk-QOFMXPM5.ts";
11
- import "./chunk-IWZH5KYS.ts";
12
- import "./chunk-76NB4R7U.ts";
8
+ } from "./chunk-IMMMZUFC.ts";
9
+ import "./chunk-AO6EDUA6.ts";
10
+ import "./chunk-CDQGSZL3.ts";
13
11
  import "./chunk-ZW5ZLGBI.ts";
14
- import "./chunk-PRUEIIK7.ts";
15
- import "./chunk-UPNVIUBN.ts";
12
+ import "./chunk-TO2GMX3K.ts";
13
+ import "./chunk-73MDIVYJ.ts";
16
14
  import "./chunk-SWRVXVFD.ts";
17
15
  import "./chunk-2JZFHNLM.ts";
18
16
  import "./chunk-T2SJD3N7.ts";
19
- import "./chunk-HUZ5CR4W.ts";
17
+ import "./chunk-PHANBTVM.ts";
18
+ import "./chunk-DFJGTVPX.ts";
19
+ import "./chunk-DO55XUNU.ts";
20
+ import "./chunk-AR2DGDUI.ts";
21
+ import "./chunk-YZ5BQNRZ.ts";
22
+ import "./chunk-PRUEIIK7.ts";
20
23
  export {
21
24
  applyAgentCandidate,
22
25
  buildAgentEvidence,
23
26
  digest,
24
27
  parseAgentCandidate
25
28
  };
26
- //# sourceMappingURL=agent-candidate-GNEYR225.ts.map
29
+ //# sourceMappingURL=agent-candidate-EYB35AGL.ts.map
@@ -3,41 +3,45 @@
3
3
  import {
4
4
  fileHashMap,
5
5
  sameHashes
6
- } from "./chunk-BDB4IDM3.ts";
6
+ } from "./chunk-JY2RVOUL.ts";
7
7
  import {
8
8
  AgentResolutionRequired
9
9
  } from "./chunk-3ST7RSYN.ts";
10
+ import "./chunk-UGSSZWQ6.ts";
10
11
  import {
11
12
  syncConfigReviewIdentity
12
- } from "./chunk-QO333NM4.ts";
13
- import "./chunk-A6HU4ERM.ts";
14
- import {
15
- ContinuousError
16
- } from "./chunk-DT7M4VQS.ts";
17
- import "./chunk-YDVQYUHE.ts";
13
+ } from "./chunk-RX3WGWVL.ts";
14
+ import "./chunk-X7R6DCVF.ts";
18
15
  import {
19
16
  applyAgentCandidate,
20
17
  buildAgentEvidence,
21
18
  digest
22
- } from "./chunk-5QAE3G3K.ts";
23
- import "./chunk-S7QS4AWK.ts";
24
- import {
25
- createSnapshot
26
- } from "./chunk-QOFMXPM5.ts";
19
+ } from "./chunk-IMMMZUFC.ts";
20
+ import "./chunk-AO6EDUA6.ts";
27
21
  import {
28
22
  readMergeAncestors
29
- } from "./chunk-IWZH5KYS.ts";
30
- import "./chunk-76NB4R7U.ts";
23
+ } from "./chunk-CDQGSZL3.ts";
31
24
  import "./chunk-ZW5ZLGBI.ts";
32
- import "./chunk-PRUEIIK7.ts";
25
+ import "./chunk-TO2GMX3K.ts";
33
26
  import {
34
27
  readStateForConfig,
35
28
  syncStateFingerprint
36
- } from "./chunk-UPNVIUBN.ts";
29
+ } from "./chunk-73MDIVYJ.ts";
37
30
  import "./chunk-SWRVXVFD.ts";
38
31
  import "./chunk-2JZFHNLM.ts";
39
32
  import "./chunk-T2SJD3N7.ts";
40
- import "./chunk-HUZ5CR4W.ts";
33
+ import {
34
+ createSnapshot
35
+ } from "./chunk-PHANBTVM.ts";
36
+ import "./chunk-DFJGTVPX.ts";
37
+ import "./chunk-DO55XUNU.ts";
38
+ import "./chunk-AR2DGDUI.ts";
39
+ import "./chunk-YZ5BQNRZ.ts";
40
+ import {
41
+ ContinuousError
42
+ } from "./chunk-DT7M4VQS.ts";
43
+ import "./chunk-YDVQYUHE.ts";
44
+ import "./chunk-PRUEIIK7.ts";
41
45
 
42
46
  // src/sync/agent-plan.ts
43
47
  async function resolveAgentPlan(ctx, options, config, backend, state, local, localRaw, remote, head, plan, snapshotOptions, validate) {
@@ -113,4 +117,4 @@ async function resolveAgentPlan(ctx, options, config, backend, state, local, loc
113
117
  export {
114
118
  resolveAgentPlan
115
119
  };
116
- //# sourceMappingURL=agent-plan-3L7CRFDM.ts.map
120
+ //# sourceMappingURL=agent-plan-KO43GTOR.ts.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/sync/agent-plan.ts"],
4
4
  "sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport type { RemoteHead, SyncBackend } from \"../backends/sync-backend.js\";\nimport type { CommandOptions } from \"../commands/command-types.js\";\nimport { syncConfigReviewIdentity } from \"../settings/config.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { createSnapshot } from \"../snapshot/snapshot.js\";\nimport type { Snapshot, SnapshotOptions } from \"../snapshot/snapshot-types.js\";\nimport { readMergeAncestors } from \"../state/merge-baseline-store.js\";\nimport type { SyncState } from \"../state/state-types.js\";\nimport { readStateForConfig, syncStateFingerprint } from \"../state/sync-state-store.js\";\nimport { applyAgentCandidate, buildAgentEvidence, digest } from \"./agent-candidate.js\";\nimport { AgentResolutionRequired } from \"./agent-request.js\";\nimport { ContinuousError } from \"./continuous-errors.js\";\nimport type { FileMergePlan } from \"./file-merge-planner.js\";\nimport { fileHashMap, sameHashes } from \"./sync-state.js\";\n\nexport async function resolveAgentPlan(\n ctx: ExtensionContext,\n options: CommandOptions,\n config: AnySyncConfig,\n backend: SyncBackend,\n state: SyncState,\n local: Snapshot,\n localRaw: Snapshot,\n remote: Snapshot,\n head: RemoteHead,\n plan: FileMergePlan,\n snapshotOptions: SnapshotOptions,\n validate: () => Promise<void>,\n): Promise<FileMergePlan> {\n if (plan.kind !== \"planned\" || !plan.conflicts.length) {\n if (options.agentRetryRefusal)\n throw new ContinuousError(\"unsafe\", \"No eligible cached refusal for the current evidence. Use Sync now.\");\n return plan;\n }\n if (!ctx.hasUI || (ctx.mode !== \"tui\" && ctx.mode !== \"rpc\"))\n throw new Error(\"Agent mode paused: TUI/RPC is required.\");\n const ancestors = (await readMergeAncestors(config, state)) ?? [];\n await validate();\n let evidence: ReturnType<typeof buildAgentEvidence>;\n try {\n evidence = buildAgentEvidence(plan, local, remote, ancestors);\n } catch {\n throw new ContinuousError(\"unsafe\", \"Agent mode paused: unsafe or unsupported conflict evidence.\");\n }\n if (!config.partialSync && evidence.unsupported.length)\n throw new ContinuousError(\"unsafe\", \"Agent mode paused: unsupported conflicts prevent an all-or-nothing transfer.\");\n if (!evidence.files.length) {\n if (options.agentRetryRefusal)\n throw new ContinuousError(\"unsafe\", \"No eligible cached refusal for the current evidence. Use Sync now.\");\n if (config.partialSync) return plan;\n throw new ContinuousError(\n \"unsafe\",\n \"Agent mode paused: unsupported conflict or missing verified ancestor; evidence is unchanged.\",\n );\n }\n if (!evidence.units.length) {\n if (options.agentRetryRefusal)\n throw new ContinuousError(\"unsafe\", \"No eligible cached refusal for the current evidence. Use Sync now.\");\n return applyAgentCandidate(plan, evidence, { version: 1, results: [] });\n }\n if (!ctx.model) throw new ContinuousError(\"model\", \"Agent mode paused: select an available model first.\");\n const model = digest(ctx.model);\n const key = digest([\n 1,\n backend.identity,\n syncConfigReviewIdentity(config),\n syncStateFingerprint(state),\n head.revision,\n fileHashMap(localRaw),\n evidence,\n model,\n ]);\n if (options.agentAcceptance?.key === key) {\n try {\n return applyAgentCandidate(plan, evidence, options.agentAcceptance.candidate);\n } catch {\n throw new ContinuousError(\"unsafe\", \"Agent mode paused: candidate refused or unsupported conflict remains.\");\n }\n }\n const validateEvidence = async (signal = options.signal) => {\n const check = async () => {\n signal?.throwIfAborted();\n await validate();\n signal?.throwIfAborted();\n };\n await check();\n if (digest(ctx.model) !== model) throw new Error(\"Agent mode paused: selected model changed.\");\n const current = await createSnapshot(config.snapshotIdentity, { ...snapshotOptions, signal });\n await check();\n const currentState = await readStateForConfig(config);\n await check();\n const currentHead = await backend.readHead(signal);\n await check();\n if (\n !sameHashes(fileHashMap(current), fileHashMap(localRaw)) ||\n syncStateFingerprint(currentState) !== syncStateFingerprint(state) ||\n !currentHead ||\n !backend.sameRevision(head.revision, currentHead.revision)\n )\n throw new ContinuousError(\"stale\", \"Agent mode paused: conflict evidence changed; retry a fresh sync.\");\n };\n throw new AgentResolutionRequired(key, evidence, validateEvidence);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,eAAsB,iBACpB,KACA,SACA,QACA,SACA,OACA,OACA,UACA,QACA,MACA,MACA,iBACA,UACwB;AACxB,MAAI,KAAK,SAAS,aAAa,CAAC,KAAK,UAAU,QAAQ;AACrD,QAAI,QAAQ;AACV,YAAM,IAAI,gBAAgB,UAAU,oEAAoE;AAC1G,WAAO;AAAA,EACT;AACA,MAAI,CAAC,IAAI,SAAU,IAAI,SAAS,SAAS,IAAI,SAAS;AACpD,UAAM,IAAI,MAAM,yCAAyC;AAC3D,QAAM,YAAa,MAAM,mBAAmB,QAAQ,KAAK,KAAM,CAAC;AAChE,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;AACpD,UAAM,MAAM;AACZ,UAAM,cAAc,MAAM,QAAQ,SAAS,MAAM;AACjD,UAAM,MAAM;AACZ,QACE,CAAC,WAAW,YAAY,OAAO,GAAG,YAAY,QAAQ,CAAC,KACvD,qBAAqB,YAAY,MAAM,qBAAqB,KAAK,KACjE,CAAC,eACD,CAAC,QAAQ,aAAa,KAAK,UAAU,YAAY,QAAQ;AAEzD,YAAM,IAAI,gBAAgB,SAAS,mEAAmE;AAAA,EAC1G;AACA,QAAM,IAAI,wBAAwB,KAAK,UAAU,gBAAgB;AACnE;",
6
6
  "names": []
7
7
  }
@@ -2,25 +2,28 @@
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  confirmMergeReview
5
- } from "./chunk-5XZOC7FD.ts";
5
+ } from "./chunk-KHBPED6W.ts";
6
+ import "./chunk-Z5O2TLNF.ts";
7
+ import "./chunk-MRIPZGPR.ts";
6
8
  import {
7
9
  captureMutationOwner
8
- } from "./chunk-UOHR7LRO.ts";
10
+ } from "./chunk-5WJQ6XOW.ts";
9
11
  import {
10
12
  safeTerminalText
11
13
  } from "./chunk-AMJRUXFT.ts";
12
- import "./chunk-UBV24CG4.ts";
13
14
  import {
14
15
  loadConfig
15
- } from "./chunk-QO333NM4.ts";
16
- import "./chunk-A6HU4ERM.ts";
16
+ } from "./chunk-RX3WGWVL.ts";
17
+ import "./chunk-X7R6DCVF.ts";
17
18
  import "./chunk-PWMWOJP4.ts";
18
- import "./chunk-QOFMXPM5.ts";
19
- import "./chunk-ZW5ZLGBI.ts";
20
19
  import "./chunk-SWRVXVFD.ts";
21
20
  import "./chunk-2JZFHNLM.ts";
22
21
  import "./chunk-T2SJD3N7.ts";
23
- import "./chunk-HUZ5CR4W.ts";
22
+ import "./chunk-PHANBTVM.ts";
23
+ import "./chunk-DFJGTVPX.ts";
24
+ import "./chunk-DO55XUNU.ts";
25
+ import "./chunk-AR2DGDUI.ts";
26
+ import "./chunk-YZ5BQNRZ.ts";
24
27
 
25
28
  // src/sync/agent-refusal-retry.ts
26
29
  async function confirmAgentRefusalRetry(ctx, setup, evidence, validate, signal) {
@@ -66,4 +69,4 @@ async function confirmAgentRefusalRetry(ctx, setup, evidence, validate, signal)
66
69
  export {
67
70
  confirmAgentRefusalRetry
68
71
  };
69
- //# sourceMappingURL=agent-refusal-retry-AH7TXOQT.ts.map
72
+ //# sourceMappingURL=agent-refusal-retry-C2HQROTP.ts.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/sync/agent-refusal-retry.ts"],
4
4
  "sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { loadConfig } from \"../settings/config.js\";\nimport { confirmMergeReview } from \"../ui/merge-review.js\";\nimport { safeTerminalText } from \"../ui/terminal-text.js\";\nimport type { AgentEvidence } from \"./agent-candidate.js\";\nimport { captureMutationOwner } from \"./sync-local.js\";\n\n/** Review uses fresh request validation; no private text or provider error enters the summary. */\nexport async function confirmAgentRefusalRetry(\n ctx: ExtensionContext,\n setup: string | undefined,\n evidence: AgentEvidence,\n validate: () => Promise<void>,\n signal?: AbortSignal,\n) {\n const owner = captureMutationOwner(ctx, signal);\n owner();\n const config = await loadConfig(setup);\n owner();\n await validate();\n owner();\n const summary = [\n `Setup: ${safeTerminalText(config.setupName)}`,\n `Storage connection: ${safeTerminalText(config.connectionName)}`,\n `Storage path: ${safeTerminalText(config.storagePath)}`,\n ...(config.backend.type === \"s3\" ? [`Bucket: ${safeTerminalText(config.backend.destination.bucket)}`] : []),\n ...(config.backend.type === \"git\" ? [`Branch: ${safeTerminalText(config.backend.destination.branch)}`] : []),\n `Selected model: ${safeTerminalText(ctx.model?.provider ?? \"unknown\")}/${safeTerminalText(ctx.model?.id ?? \"unknown\")}`,\n `Conflict paths: ${[...new Set(evidence.units.map((unit) => unit.path))].map(safeTerminalText).join(\", \")}`,\n \"Send this conflict evidence again despite the cached refusal? This permits one fresh provider request for the reviewed candidate, may incur costs, and can replace selected local and remote content if the result passes validation. Semantic correctness is not guaranteed.\",\n \"Ordinary Sync now continues to reuse cached results. Automatic request accounting is not cleared or reset. The previous refusal is retained privately. No resources reload automatically. Cancellation cannot recall submitted content, provider charges, or committed writes.\",\n ].join(\"\\n\\n\");\n const confirmed = await confirmMergeReview(\n ctx,\n \"Retry refused model result?\",\n summary,\n signal,\n () => {\n try {\n owner();\n return true;\n } catch {\n return false;\n }\n },\n \"Send one fresh request\",\n summary.split(\"\\n\"),\n );\n owner();\n if (!confirmed) return false;\n await validate();\n owner();\n return true;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAQA,eAAsB,yBACpB,KACA,OACA,UACA,UACA,QACA;AACA,QAAM,QAAQ,qBAAqB,KAAK,MAAM;AAC9C,QAAM;AACN,QAAM,SAAS,MAAM,WAAW,KAAK;AACrC,QAAM;AACN,QAAM,SAAS;AACf,QAAM;AACN,QAAM,UAAU;AAAA,IACd,UAAU,iBAAiB,OAAO,SAAS,CAAC;AAAA,IAC5C,uBAAuB,iBAAiB,OAAO,cAAc,CAAC;AAAA,IAC9D,iBAAiB,iBAAiB,OAAO,WAAW,CAAC;AAAA,IACrD,GAAI,OAAO,QAAQ,SAAS,OAAO,CAAC,WAAW,iBAAiB,OAAO,QAAQ,YAAY,MAAM,CAAC,EAAE,IAAI,CAAC;AAAA,IACzG,GAAI,OAAO,QAAQ,SAAS,QAAQ,CAAC,WAAW,iBAAiB,OAAO,QAAQ,YAAY,MAAM,CAAC,EAAE,IAAI,CAAC;AAAA,IAC1G,mBAAmB,iBAAiB,IAAI,OAAO,YAAY,SAAS,CAAC,IAAI,iBAAiB,IAAI,OAAO,MAAM,SAAS,CAAC;AAAA,IACrH,mBAAmB,CAAC,GAAG,IAAI,IAAI,SAAS,MAAM,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,EAAE,IAAI,gBAAgB,EAAE,KAAK,IAAI,CAAC;AAAA,IACzG;AAAA,IAC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,MAAM;AACb,QAAM,YAAY,MAAM;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AACJ,UAAI;AACF,cAAM;AACN,eAAO;AAAA,MACT,QAAQ;AACN,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA;AAAA,IACA,QAAQ,MAAM,IAAI;AAAA,EACpB;AACA,QAAM;AACN,MAAI,CAAC,UAAW,QAAO;AACvB,QAAM,SAAS;AACf,QAAM;AACN,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -2,16 +2,9 @@
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  withLock
5
- } from "./chunk-AAEEHR7H.ts";
6
- import {
7
- ContinuousError
8
- } from "./chunk-DT7M4VQS.ts";
9
- import "./chunk-YDVQYUHE.ts";
5
+ } from "./chunk-MDUORMCK.ts";
10
6
  import "./chunk-PWMWOJP4.ts";
11
- import {
12
- AGENT_OUTPUT_BYTES
13
- } from "./chunk-PRUEIIK7.ts";
14
- import "./chunk-UPNVIUBN.ts";
7
+ import "./chunk-73MDIVYJ.ts";
15
8
  import {
16
9
  LOCKFILE_FS_ADAPTER,
17
10
  LOCK_GUARD_STALE_MS,
@@ -22,7 +15,15 @@ import "./chunk-2JZFHNLM.ts";
22
15
  import "./chunk-T2SJD3N7.ts";
23
16
  import {
24
17
  writeJson
25
- } from "./chunk-HUZ5CR4W.ts";
18
+ } from "./chunk-AR2DGDUI.ts";
19
+ import "./chunk-YZ5BQNRZ.ts";
20
+ import {
21
+ ContinuousError
22
+ } from "./chunk-DT7M4VQS.ts";
23
+ import "./chunk-YDVQYUHE.ts";
24
+ import {
25
+ AGENT_OUTPUT_BYTES
26
+ } from "./chunk-PRUEIIK7.ts";
26
27
 
27
28
  // src/sync/agent-store.ts
28
29
  import { createHash, randomUUID } from "node:crypto";
@@ -171,4 +172,4 @@ export {
171
172
  saveAgentCandidate,
172
173
  withAgentClaim
173
174
  };
174
- //# sourceMappingURL=agent-store-55CZOCPX.ts.map
175
+ //# sourceMappingURL=agent-store-UT52DS7B.ts.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/sync/agent-store.ts"],
4
4
  "sourcesContent": ["import { createHash, randomUUID } from \"node:crypto\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport lockfile from \"proper-lockfile\";\nimport { writeJson } from \"../state/json-file.js\";\nimport { withLock } from \"../state/lock.js\";\nimport { LOCK_GUARD_STALE_MS, LOCK_GUARD_UPDATE_MS } from \"../state/lock-policy.js\";\nimport { LOCKFILE_FS_ADAPTER } from \"../state/lockfile-fs.js\";\nimport { stateDir } from \"../state/state-directory.js\";\nimport type { AgentCandidate } from \"./agent-candidate.js\";\nimport { AGENT_OUTPUT_BYTES } from \"./agent-policy.js\";\nimport { ContinuousError } from \"./continuous-errors.js\";\n\ninterface Claim {\n version: 1;\n id: string;\n pid: number;\n}\nfunction paths() {\n const root = path.join(stateDir(), \"agent-resolver\");\n return { root, claim: path.join(root, \"claim.json\") };\n}\nasync function directory() {\n const { root } = paths();\n await fs.mkdir(root, { mode: 0o700 });\n}\nasync function checkDirectory() {\n const stat = await fs.lstat(paths().root);\n if (!stat.isDirectory() || stat.isSymbolicLink() || (process.platform !== \"win32\" && stat.mode & 0o077))\n throw new Error(\"Unsafe agent resolver directory; evidence retained.\");\n}\nasync function readPrivate(file: string): Promise<unknown> {\n try {\n await checkDirectory();\n const stat = await fs.lstat(file);\n if (\n !stat.isFile() ||\n stat.isSymbolicLink() ||\n stat.nlink !== 1 ||\n stat.size > AGENT_OUTPUT_BYTES * 2 ||\n (process.platform !== \"win32\" && stat.mode & 0o077)\n )\n throw new Error(\"Unsafe agent resolver record; evidence retained.\");\n return JSON.parse(await fs.readFile(file, \"utf8\"));\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") return undefined;\n throw new Error(\"Unreadable agent resolver record; evidence retained.\");\n }\n}\nasync function readClaim(): Promise<Claim | undefined> {\n const value = await readPrivate(paths().claim);\n if (value === undefined) return;\n const claim = value as Claim;\n if (\n claim?.version !== 1 ||\n typeof claim.id !== \"string\" ||\n !/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/u.test(claim.id) ||\n Object.keys(claim).sort().join(\",\") !== \"id,pid,version\" ||\n !Number.isSafeInteger(claim.pid) ||\n claim.pid < 1 ||\n claim.pid > 2_147_483_647\n )\n throw new Error(\"Invalid agent resolver claim; evidence retained.\");\n return claim;\n}\nfunction alive(pid: number) {\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n return (error as NodeJS.ErrnoException).code !== \"ESRCH\";\n }\n}\n\n/** Caller retains the state-directory migration guard; claim changes use a separate short-lived guard. */\nexport async function withAgentClaim<T>(fn: (assertOwner: () => Promise<void>) => Promise<T>): Promise<T> {\n const claim: Claim = { version: 1, id: randomUUID(), pid: process.pid };\n let armed = false;\n const assertOwner = async () => {\n const current = await readClaim();\n if (current?.id !== claim.id || current.pid !== process.pid)\n throw new Error(\"Agent resolver ownership changed; candidate not applied.\");\n };\n try {\n await withLock(\"agent-claim\", async () => {\n try {\n await directory();\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"EEXIST\") throw error;\n }\n await checkDirectory();\n await withClaimGuard(async () => {\n const existing = await readClaim();\n if (existing && alive(existing.pid))\n throw new ContinuousError(\"contention\", \"Agent mode deferred: another local resolver is running.\");\n // A durability failure can occur after rename: cleanup must own partial initialization too.\n armed = true;\n await writeJson(paths().claim, claim);\n });\n });\n return await fn(assertOwner);\n } finally {\n if (armed) await releaseClaim(claim);\n }\n}\nasync function releaseClaim(claim: Claim) {\n // Ordinary transfers may hold the operation lock for an arbitrary time.\n // Cleanup needs only the claim guard; it never waits for that operation lock.\n await withClaimGuard(async () => {\n const current = await readClaim();\n if (current?.id === claim.id && current.pid === claim.pid) await fs.rm(paths().claim);\n });\n}\nasync function withClaimGuard<T>(run: () => Promise<T>): Promise<T> {\n await checkDirectory();\n let compromisedError: Error | undefined;\n const release = await lockfile.lock(paths().claim, {\n fs: LOCKFILE_FS_ADAPTER,\n realpath: false,\n stale: LOCK_GUARD_STALE_MS,\n update: LOCK_GUARD_UPDATE_MS,\n retries: { retries: 100, factor: 1.2, minTimeout: 10, maxTimeout: 100 },\n onCompromised: (error) => {\n compromisedError = error;\n },\n });\n try {\n const result = await run();\n if (compromisedError) throw compromisedError;\n return result;\n } finally {\n await release();\n }\n}\nfunction candidatePath(key: string) {\n if (!/^[a-f0-9]{64}$/u.test(key)) throw new Error(\"Invalid agent candidate key.\");\n return path.join(paths().root, `${key}.json`);\n}\nexport async function readAgentCandidate(key: string): Promise<unknown> {\n return readPrivate(candidatePath(key));\n}\nexport async function saveAgentCandidate(key: string, candidate: unknown) {\n await checkDirectory();\n const target = candidatePath(key);\n const existing = await readPrivate(target);\n if (existing !== undefined) {\n if (JSON.stringify(existing) !== JSON.stringify(candidate))\n throw new Error(\"Agent candidate changed before save; existing evidence retained.\");\n return;\n }\n await writeJson(target, candidate, { maxBytes: AGENT_OUTPUT_BYTES * 2 });\n}\n\n/** Caller holds the resolver claim and operation lock and has validated both candidates. */\nexport async function replaceRefusedAgentCandidate(\n key: string,\n previous: AgentCandidate,\n candidate: AgentCandidate,\n validate: () => Promise<void>,\n) {\n const original = JSON.stringify(previous);\n if (!previous.results.some((row) => \"refuse\" in row) || candidate.results.some((row) => \"refuse\" in row))\n throw new Error(\"Only a validated refusal can be replaced by a complete retry result.\");\n const target = candidatePath(key);\n const assertPrevious = async () => {\n if (JSON.stringify(await readPrivate(target)) !== original)\n throw new Error(\"Cached refusal changed during review; previous evidence retained.\");\n await validate();\n };\n await assertPrevious();\n const digest = createHash(\"sha256\").update(original).digest(\"hex\");\n const archive = path.join(paths().root, `${key}.refusal-${digest}.json`);\n const retained = await readPrivate(archive);\n await validate();\n if (retained !== undefined && JSON.stringify(retained) !== original)\n throw new Error(\"Retained refusal changed; evidence retained.\");\n if (retained === undefined) await writeJson(archive, previous, { maxBytes: AGENT_OUTPUT_BYTES * 2 });\n await assertPrevious();\n // Archive first: even a durability error after replacement retains the original refusal.\n // Once rename commits, later cancellation cannot undo the valid new candidate.\n await writeJson(target, candidate, { maxBytes: AGENT_OUTPUT_BYTES * 2 });\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,kBAAkB;AACvC,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,cAAc;AAerB,SAAS,QAAQ;AACf,QAAM,OAAO,KAAK,KAAK,SAAS,GAAG,gBAAgB;AACnD,SAAO,EAAE,MAAM,OAAO,KAAK,KAAK,MAAM,YAAY,EAAE;AACtD;AACA,eAAe,YAAY;AACzB,QAAM,EAAE,KAAK,IAAI,MAAM;AACvB,QAAM,GAAG,MAAM,MAAM,EAAE,MAAM,IAAM,CAAC;AACtC;AACA,eAAe,iBAAiB;AAC9B,QAAM,OAAO,MAAM,GAAG,MAAM,MAAM,EAAE,IAAI;AACxC,MAAI,CAAC,KAAK,YAAY,KAAK,KAAK,eAAe,KAAM,QAAQ,aAAa,WAAW,KAAK,OAAO;AAC/F,UAAM,IAAI,MAAM,qDAAqD;AACzE;AACA,eAAe,YAAY,MAAgC;AACzD,MAAI;AACF,UAAM,eAAe;AACrB,UAAM,OAAO,MAAM,GAAG,MAAM,IAAI;AAChC,QACE,CAAC,KAAK,OAAO,KACb,KAAK,eAAe,KACpB,KAAK,UAAU,KACf,KAAK,OAAO,qBAAqB,KAChC,QAAQ,aAAa,WAAW,KAAK,OAAO;AAE7C,YAAM,IAAI,MAAM,kDAAkD;AACpE,WAAO,KAAK,MAAM,MAAM,GAAG,SAAS,MAAM,MAAM,CAAC;AAAA,EACnD,SAAS,OAAO;AACd,QAAK,MAAgC,SAAS,SAAU,QAAO;AAC/D,UAAM,IAAI,MAAM,sDAAsD;AAAA,EACxE;AACF;AACA,eAAe,YAAwC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ACvE,QAAM,WAAW,MAAM,YAAY,OAAO;AAC1C,QAAM,SAAS;AACf,MAAI,aAAa,UAAa,KAAK,UAAU,QAAQ,MAAM;AACzD,UAAM,IAAI,MAAM,8CAA8C;AAChE,MAAI,aAAa,OAAW,OAAM,UAAU,SAAS,UAAU,EAAE,UAAU,qBAAqB,EAAE,CAAC;AACnG,QAAM,eAAe;AAGrB,QAAM,UAAU,QAAQ,WAAW,EAAE,UAAU,qBAAqB,EAAE,CAAC;AACzE;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,22 @@
1
+ // @generated by scripts/build-runtime.mjs; do not edit.
2
+ // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
+ import {
4
+ withAgentSyncLock
5
+ } from "./chunk-ODF2M4RF.ts";
6
+ import "./chunk-3ST7RSYN.ts";
7
+ import "./chunk-K3RIEL6J.ts";
8
+ import "./chunk-MDUORMCK.ts";
9
+ import "./chunk-PWMWOJP4.ts";
10
+ import "./chunk-73MDIVYJ.ts";
11
+ import "./chunk-SWRVXVFD.ts";
12
+ import "./chunk-2JZFHNLM.ts";
13
+ import "./chunk-T2SJD3N7.ts";
14
+ import "./chunk-AR2DGDUI.ts";
15
+ import "./chunk-YZ5BQNRZ.ts";
16
+ import "./chunk-DT7M4VQS.ts";
17
+ import "./chunk-YDVQYUHE.ts";
18
+ import "./chunk-PRUEIIK7.ts";
19
+ export {
20
+ withAgentSyncLock
21
+ };
22
+ //# sourceMappingURL=agent-sync-VM3TXWA3.ts.map