@narumitw/pi-sync 0.58.0 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +12 -6
- package/dist/chunks/{agent-candidate-U2NU3GUX.ts → agent-candidate-ZHN7FTZT.ts} +9 -8
- package/dist/chunks/{agent-plan-3YXDIJXO.ts → agent-plan-ILFEUJ2E.ts} +12 -11
- package/dist/chunks/{agent-plan-3YXDIJXO.ts.map → agent-plan-ILFEUJ2E.ts.map} +1 -1
- package/dist/chunks/{agent-refusal-retry-476YGNU5.ts → agent-refusal-retry-HRMHCX2A.ts} +9 -8
- package/dist/chunks/{agent-refusal-retry-476YGNU5.ts.map → agent-refusal-retry-HRMHCX2A.ts.map} +1 -1
- package/dist/chunks/{agent-store-7GINKTS7.ts → agent-store-CCKN4DPR.ts} +3 -3
- package/dist/chunks/{agent-sync-2R4GG2MF.ts → agent-sync-EGA2I5W7.ts} +4 -4
- package/dist/chunks/{chunk-CQD2TJHE.ts → chunk-25QCU3LY.ts} +4 -4
- package/dist/chunks/{chunk-OJARL2TG.ts → chunk-2UKUKIBI.ts} +4 -4
- package/dist/chunks/{chunk-MW6KUQYA.ts → chunk-2ZZJXITS.ts} +40 -10
- package/dist/chunks/chunk-2ZZJXITS.ts.map +7 -0
- package/dist/chunks/chunk-3JTZF7Z5.ts +77 -0
- package/dist/chunks/chunk-3JTZF7Z5.ts.map +7 -0
- package/dist/chunks/{chunk-DN4IA7MR.ts → chunk-4NVHHDN2.ts} +2 -2
- package/dist/chunks/{chunk-AKMV47YC.ts → chunk-6OFMB6KK.ts} +2 -2
- package/dist/chunks/{chunk-45COPAK7.ts → chunk-6XU5HZAN.ts} +6 -6
- package/dist/chunks/{chunk-45COPAK7.ts.map → chunk-6XU5HZAN.ts.map} +2 -2
- package/dist/chunks/{chunk-Y4UVXOLQ.ts → chunk-6YGRZSCN.ts} +15 -10
- package/dist/chunks/chunk-6YGRZSCN.ts.map +7 -0
- package/dist/chunks/{chunk-XEODG2PE.ts → chunk-76HID27T.ts} +2 -2
- package/dist/chunks/{chunk-7A35ZAVO.ts → chunk-7WYF2KUO.ts} +174 -122
- package/dist/chunks/chunk-7WYF2KUO.ts.map +7 -0
- package/dist/chunks/{chunk-MMQIEDZ6.ts → chunk-APDNHB2T.ts} +78 -35
- package/dist/chunks/chunk-APDNHB2T.ts.map +7 -0
- package/dist/chunks/{chunk-U6GXGY5G.ts → chunk-DTPELCPW.ts} +4 -4
- package/dist/chunks/{chunk-TZC7GDJE.ts → chunk-ILXMZ2HU.ts} +4 -4
- package/dist/chunks/{chunk-CBLTWXAU.ts → chunk-LA3HQMFG.ts} +2 -1
- package/dist/chunks/{chunk-CBLTWXAU.ts.map → chunk-LA3HQMFG.ts.map} +2 -2
- package/dist/chunks/{chunk-ESKOPQVB.ts → chunk-MKC3PXCN.ts} +53 -32
- package/dist/chunks/chunk-MKC3PXCN.ts.map +7 -0
- package/dist/chunks/{chunk-MG66XM5U.ts → chunk-NGW4JMBF.ts} +63 -19
- package/dist/chunks/chunk-NGW4JMBF.ts.map +7 -0
- package/dist/chunks/{chunk-TIMWN2RH.ts → chunk-OQBE2OMB.ts} +13 -14
- package/dist/chunks/chunk-OQBE2OMB.ts.map +7 -0
- package/dist/chunks/{chunk-MKSMJPVA.ts → chunk-P3YD4ONV.ts} +22 -6
- package/dist/chunks/chunk-P3YD4ONV.ts.map +7 -0
- package/dist/chunks/{chunk-JYILGR3K.ts → chunk-PQ75RPUP.ts} +3 -3
- package/dist/chunks/{chunk-FLHCOJCD.ts → chunk-QQVK2XFC.ts} +13 -6
- package/dist/chunks/chunk-QQVK2XFC.ts.map +7 -0
- package/dist/chunks/{chunk-WQMYV4DW.ts → chunk-RDOX3VH5.ts} +5 -5
- package/dist/chunks/{chunk-6O3EDBRL.ts → chunk-S7D6XWHI.ts} +2 -2
- package/dist/chunks/{chunk-7ZIYU5QS.ts → chunk-SHPNS7FM.ts} +7 -7
- package/dist/chunks/{chunk-7ZIYU5QS.ts.map → chunk-SHPNS7FM.ts.map} +2 -2
- package/dist/chunks/{chunk-GNYGNHFF.ts → chunk-T2TYBLXK.ts} +2 -2
- package/dist/chunks/{chunk-6LD5KX55.ts → chunk-UZSDS4HF.ts} +13 -6
- package/dist/chunks/chunk-UZSDS4HF.ts.map +7 -0
- package/dist/chunks/{chunk-5TSCBBPP.ts → chunk-VPODHKOX.ts} +3 -3
- package/dist/chunks/{chunk-BEST45H2.ts → chunk-WEKGW7HV.ts} +17 -8
- package/dist/chunks/chunk-WEKGW7HV.ts.map +7 -0
- package/dist/chunks/{chunk-KYTT7KV4.ts → chunk-WUHRVSWI.ts} +87 -37
- package/dist/chunks/chunk-WUHRVSWI.ts.map +7 -0
- package/dist/chunks/{chunk-OVBAW7KV.ts → chunk-XZ3ZTHKR.ts} +19 -9
- package/dist/chunks/chunk-XZ3ZTHKR.ts.map +7 -0
- package/dist/chunks/{chunk-S5OCYVPS.ts → chunk-YEULK7MK.ts} +3 -3
- package/dist/chunks/{command-handler-KCB6MCWS.ts → command-handler-SDGKIQH2.ts} +17 -14
- package/dist/chunks/command-handler-SDGKIQH2.ts.map +7 -0
- package/dist/chunks/{config-HYG7G5EM.ts → config-J5VZUY4J.ts} +4 -3
- package/dist/chunks/{conflict-artifacts-J6WSDCWP.ts → conflict-artifacts-MYSH3L2J.ts} +10 -9
- package/dist/chunks/{conflict-review-GXA6Y7KY.ts → conflict-review-J6ZSPNWL.ts} +21 -20
- package/dist/chunks/{conflict-review-GXA6Y7KY.ts.map → conflict-review-J6ZSPNWL.ts.map} +1 -1
- package/dist/chunks/{continuous-record-EPHGR2DU.ts → continuous-record-OM64J27R.ts} +4 -4
- package/dist/chunks/{continuous-sync-FAFNLEUW.ts → continuous-sync-BH5SWIRV.ts} +22 -17
- package/dist/chunks/continuous-sync-BH5SWIRV.ts.map +7 -0
- package/dist/chunks/{file-selection-IELTXSGZ.ts → file-selection-7HEVPO4T.ts} +11 -8
- package/dist/chunks/file-selection-7HEVPO4T.ts.map +7 -0
- package/dist/chunks/{git-backend-KHD36W27.ts → git-backend-6CKI6CUG.ts} +12 -15
- package/dist/chunks/{git-backend-KHD36W27.ts.map → git-backend-6CKI6CUG.ts.map} +2 -2
- package/dist/chunks/{local-fields-JEKAPZKD.ts → local-fields-SR7PH66U.ts} +6 -5
- package/dist/chunks/{manager-result-dispatcher-XCYPW7RC.ts → manager-result-dispatcher-CXUP5WDP.ts} +15 -14
- package/dist/chunks/{manager-ui-FMZXKPX2.ts → manager-ui-65ZETN6F.ts} +168 -51
- package/dist/chunks/manager-ui-65ZETN6F.ts.map +7 -0
- package/dist/chunks/{merge-baseline-store-65GKUMXI.ts → merge-baseline-store-4Y2X7P2D.ts} +4 -3
- package/dist/chunks/{remote-selection-ui-MYM2YCPF.ts → remote-selection-ui-W55BQDJQ.ts} +14 -13
- package/dist/chunks/{s3-backend-L24UZ6IK.ts → s3-backend-FDK7JSDQ.ts} +8 -7
- package/dist/chunks/{s3-backend-L24UZ6IK.ts.map → s3-backend-FDK7JSDQ.ts.map} +1 -1
- package/dist/chunks/{setup-switch-KLGESLQX.ts → setup-switch-AB27ADDI.ts} +5 -4
- package/dist/chunks/{setup-wizard-ZQAK35BP.ts → setup-wizard-5FILKFLQ.ts} +6 -5
- package/dist/chunks/{setup-wizard-ZQAK35BP.ts.map → setup-wizard-5FILKFLQ.ts.map} +1 -1
- package/dist/chunks/{snapshot-RGNDYT6A.ts → snapshot-G3W2GOGB.ts} +5 -4
- package/dist/chunks/{snapshot-transaction-26BQO36S.ts → snapshot-transaction-SGRUWT73.ts} +6 -5
- package/dist/chunks/{sync-inspection-MOMLGUTD.ts → sync-inspection-MDYHZHT7.ts} +10 -9
- package/dist/chunks/{sync-operations-45APGOL3.ts → sync-operations-ZAUP65FH.ts} +40 -29
- package/dist/chunks/sync-operations-ZAUP65FH.ts.map +7 -0
- package/dist/chunks/{sync-state-7L4NT7W2.ts → sync-state-H4TFZZ7S.ts} +7 -6
- package/dist/chunks/{webdav-backend-3ZCACILP.ts → webdav-backend-UNMIAXM5.ts} +7 -6
- package/dist/chunks/{webdav-backend-3ZCACILP.ts.map → webdav-backend-UNMIAXM5.ts.map} +1 -1
- package/dist/index.ts +26 -19
- package/dist/index.ts.map +2 -2
- package/docs/exclude-policy-audit.md +54 -0
- package/docs/exclude-review-ledger.md +36 -0
- package/docs/tui-contract.md +1 -1
- package/package.json +3 -2
- package/skills/configure-pi-sync/SKILL.md +4 -3
- package/skills/configure-pi-sync/references/configuration.md +72 -13
- package/src/backends/git/git-storage.ts +12 -11
- package/src/commands/command-execution.ts +2 -2
- package/src/commands/command-handler.ts +1 -0
- package/src/settings/config.ts +9 -3
- package/src/settings/settings-management.ts +4 -3
- package/src/settings/settings-types.ts +4 -1
- package/src/settings/settings-validation.ts +8 -4
- package/src/snapshot/session-paths.ts +1 -0
- package/src/snapshot/snapshot-apply.ts +23 -7
- package/src/snapshot/snapshot-codec.ts +12 -3
- package/src/snapshot/snapshot-exclude-safety.ts +44 -0
- package/src/snapshot/snapshot-transaction.ts +12 -0
- package/src/snapshot/snapshot-types.ts +4 -4
- package/src/snapshot/snapshot.ts +71 -30
- package/src/state/merge-baseline-store.ts +9 -1
- package/src/state/state-types.ts +1 -0
- package/src/sync/automatic-sync.ts +7 -2
- package/src/sync/continuous-watch.ts +4 -2
- package/src/sync/exclude-policy.ts +84 -0
- package/src/sync/local-fields.ts +15 -4
- package/src/sync/merge-apply.ts +6 -1
- package/src/sync/merge-journal.ts +12 -3
- package/src/sync/merged-sync.ts +17 -12
- package/src/sync/partial-progress.ts +1 -0
- package/src/sync/remote-snapshot.ts +7 -8
- package/src/sync/sync-decision.ts +11 -1
- package/src/sync/sync-inspection.ts +3 -1
- package/src/sync/sync-mutations.ts +11 -4
- package/src/sync/sync-policy.ts +101 -37
- package/src/sync/sync-queries.ts +13 -3
- package/src/sync/sync-state.ts +16 -10
- package/src/ui/excluded-paths-ui.ts +106 -0
- package/src/ui/file-selection.ts +6 -3
- package/src/ui/manager-state.ts +11 -5
- package/src/ui/remote-selection-ui.ts +73 -10
- package/src/ui/settings-ui.ts +20 -5
- package/src/ui/setup/setup-actions.ts +1 -1
- package/src/ui/setup/setup-switcher.ts +3 -2
- package/src/ui/storage-connections-ui.ts +2 -2
- package/src/ui/sync-attention.ts +46 -10
- package/src/ui/sync-format.ts +13 -1
- package/dist/chunks/chunk-6LD5KX55.ts.map +0 -7
- package/dist/chunks/chunk-7A35ZAVO.ts.map +0 -7
- package/dist/chunks/chunk-BEST45H2.ts.map +0 -7
- package/dist/chunks/chunk-ESKOPQVB.ts.map +0 -7
- package/dist/chunks/chunk-FLHCOJCD.ts.map +0 -7
- package/dist/chunks/chunk-KYTT7KV4.ts.map +0 -7
- package/dist/chunks/chunk-MG66XM5U.ts.map +0 -7
- package/dist/chunks/chunk-MKSMJPVA.ts.map +0 -7
- package/dist/chunks/chunk-MMQIEDZ6.ts.map +0 -7
- package/dist/chunks/chunk-MW6KUQYA.ts.map +0 -7
- package/dist/chunks/chunk-OVBAW7KV.ts.map +0 -7
- package/dist/chunks/chunk-TIMWN2RH.ts.map +0 -7
- package/dist/chunks/chunk-Y4UVXOLQ.ts.map +0 -7
- package/dist/chunks/command-handler-KCB6MCWS.ts.map +0 -7
- package/dist/chunks/continuous-sync-FAFNLEUW.ts.map +0 -7
- package/dist/chunks/file-selection-IELTXSGZ.ts.map +0 -7
- package/dist/chunks/manager-ui-FMZXKPX2.ts.map +0 -7
- package/dist/chunks/sync-operations-45APGOL3.ts.map +0 -7
- /package/dist/chunks/{agent-candidate-U2NU3GUX.ts.map → agent-candidate-ZHN7FTZT.ts.map} +0 -0
- /package/dist/chunks/{agent-store-7GINKTS7.ts.map → agent-store-CCKN4DPR.ts.map} +0 -0
- /package/dist/chunks/{agent-sync-2R4GG2MF.ts.map → agent-sync-EGA2I5W7.ts.map} +0 -0
- /package/dist/chunks/{chunk-CQD2TJHE.ts.map → chunk-25QCU3LY.ts.map} +0 -0
- /package/dist/chunks/{chunk-OJARL2TG.ts.map → chunk-2UKUKIBI.ts.map} +0 -0
- /package/dist/chunks/{chunk-DN4IA7MR.ts.map → chunk-4NVHHDN2.ts.map} +0 -0
- /package/dist/chunks/{chunk-AKMV47YC.ts.map → chunk-6OFMB6KK.ts.map} +0 -0
- /package/dist/chunks/{chunk-XEODG2PE.ts.map → chunk-76HID27T.ts.map} +0 -0
- /package/dist/chunks/{chunk-U6GXGY5G.ts.map → chunk-DTPELCPW.ts.map} +0 -0
- /package/dist/chunks/{chunk-TZC7GDJE.ts.map → chunk-ILXMZ2HU.ts.map} +0 -0
- /package/dist/chunks/{chunk-JYILGR3K.ts.map → chunk-PQ75RPUP.ts.map} +0 -0
- /package/dist/chunks/{chunk-WQMYV4DW.ts.map → chunk-RDOX3VH5.ts.map} +0 -0
- /package/dist/chunks/{chunk-6O3EDBRL.ts.map → chunk-S7D6XWHI.ts.map} +0 -0
- /package/dist/chunks/{chunk-GNYGNHFF.ts.map → chunk-T2TYBLXK.ts.map} +0 -0
- /package/dist/chunks/{chunk-5TSCBBPP.ts.map → chunk-VPODHKOX.ts.map} +0 -0
- /package/dist/chunks/{chunk-S5OCYVPS.ts.map → chunk-YEULK7MK.ts.map} +0 -0
- /package/dist/chunks/{config-HYG7G5EM.ts.map → config-J5VZUY4J.ts.map} +0 -0
- /package/dist/chunks/{conflict-artifacts-J6WSDCWP.ts.map → conflict-artifacts-MYSH3L2J.ts.map} +0 -0
- /package/dist/chunks/{continuous-record-EPHGR2DU.ts.map → continuous-record-OM64J27R.ts.map} +0 -0
- /package/dist/chunks/{local-fields-JEKAPZKD.ts.map → local-fields-SR7PH66U.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-XCYPW7RC.ts.map → manager-result-dispatcher-CXUP5WDP.ts.map} +0 -0
- /package/dist/chunks/{merge-baseline-store-65GKUMXI.ts.map → merge-baseline-store-4Y2X7P2D.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-MYM2YCPF.ts.map → remote-selection-ui-W55BQDJQ.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-KLGESLQX.ts.map → setup-switch-AB27ADDI.ts.map} +0 -0
- /package/dist/chunks/{snapshot-RGNDYT6A.ts.map → snapshot-G3W2GOGB.ts.map} +0 -0
- /package/dist/chunks/{snapshot-transaction-26BQO36S.ts.map → snapshot-transaction-SGRUWT73.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-MOMLGUTD.ts.map → sync-inspection-MDYHZHT7.ts.map} +0 -0
- /package/dist/chunks/{sync-state-7L4NT7W2.ts.map → sync-state-H4TFZZ7S.ts.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @narumitw/pi-sync
|
|
2
2
|
|
|
3
|
+
## 0.59.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 58cb3c5: Add per-setup path and glob exclusions with reviewed settings, portable policy comparison, and local-file protection across sync and rollback. Exclusion-enabled setups opt into settings version 6 and snapshot version 4; existing setups keep their previous behavior. Excluded paths are omitted from new publications, not erased from retained history.
|
|
8
|
+
|
|
9
|
+
## 0.58.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- cf7b63d: Put editor widget names and short current count/state summaries in their divider lines. Remove duplicate body titles while retaining safety text, detail rows, privacy modes, and standalone RPC/tool output. In fullscreen Pi, click anywhere in a widget to collapse it to one named line, then click that line to restore the latest content. Preserve independent, session-local disclosure through updates without taking editor focus, changing domain data, or stopping background work. Existing owner controls provide keyboard restoration; regular-mode mouse input remains terminal-owned.
|
|
14
|
+
|
|
15
|
+
The Kit minor release supplies the named widget state and publisher disclosure APIs. Changesets raises all adopting consumers' Kit dependency floors in the same Version PR. Publish and verify the exact Kit artifact before its consumers.
|
|
16
|
+
- Updated dependencies [cf7b63d]
|
|
17
|
+
- @narumitw/pi-tui-kit@0.70.0
|
|
18
|
+
|
|
3
19
|
## 0.58.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Reusable storage connections hold credentials, while named sync setups define ex
|
|
|
9
9
|
|
|
10
10
|
- Manages Git, WebDAV, Cloudflare R2, and general S3-compatible storage through `/sync`.
|
|
11
11
|
- Separates reusable storage connections from named setups with exact reviewed remote paths.
|
|
12
|
-
- Uses one ordered list for Pi roots, safe agent-relative paths, and privacy-sensitive sessions.
|
|
12
|
+
- Uses one ordered include list for Pi roots, safe agent-relative paths, and privacy-sensitive sessions, with optional path/glob exclusions.
|
|
13
13
|
- Protects changes with immutable snapshots, secret scanning, locks, conflict checks, pull backups, transactional apply, and recovery journals.
|
|
14
14
|
- Keeps snapshot selection portable and free of credentials.
|
|
15
15
|
- Writes settings atomically, preserves unknown fields, rejects stale edits, and fails closed on unsafe configuration.
|
|
@@ -82,7 +82,7 @@ The main summary separates current state from actions and uses local state and c
|
|
|
82
82
|
After Pi Sync detects an included-content mismatch, the manager shows **Sync status: Review needed** and puts **Review synced content (recommended)** first.
|
|
83
83
|
**Sync now** remains unavailable until you review the mismatch.
|
|
84
84
|
Opening the manager does not make another remote request.
|
|
85
|
-
**Settings** opens **Pi Sync Settings** directly: one searchable flat list with
|
|
85
|
+
**Settings** opens **Pi Sync Settings** directly: one searchable flat list with 17 rows and no category navigation or headings. **Included paths**, **Excluded paths**, and **Compare included paths** keep content policy together; comparison covers include/exclude rules, not file contents. **Storage location** edits only the current setup's bucket, branch, or path; it does not change the connection or included content. **Manage sync setups** and **Manage storage connections** open the existing catalogs. Connections hold reusable server addresses and sign-in details, and edits show every affected setup. Make another setup current before changing its preferences. Each description identifies the setup, device-wide, or shared-connection scope. Simple preferences report saving and durable save results; Back does not undo saved changes. Complex editors and risky changes retain their reviews. RPC reports the manual settings path and preserves catalog management without opening the TUI preference editor.
|
|
86
86
|
|
|
87
87
|
**Diagnostics** (also `/sync doctor`) reports configuration and backend-specific access checks. S3/R2 performs a read-only request: success does not prove write access or snapshot validity, and an ambiguous 404 does not prove a bucket is missing. Check the indicated credentials, address, bucket, or path before retrying. Git checks remote reads and the local cache, not write access. WebDAV uses an isolated write/cleanup probe and repairs the active snapshot's history entry if missing. **History** opens the snapshot list directly for reviewed rollback. Recorded unresolved groups have a separate **Review unresolved conflicts** action.
|
|
88
88
|
|
|
@@ -127,7 +127,7 @@ Choose **Review all paths (recommended)** first to compare exact remote-only pat
|
|
|
127
127
|
If membership matches but order differs, the review says that only ordering differs.
|
|
128
128
|
Then choose one action:
|
|
129
129
|
|
|
130
|
-
- **Use remote content list** revalidates the remote snapshot and reviewed local setup before saving
|
|
130
|
+
- **Use remote content list** revalidates the remote snapshot and reviewed local setup before saving `sync.include` and the reviewed exclusion rules together.
|
|
131
131
|
**Remote content list saved** confirms that no files were pulled and offers a separate **Continue Sync/Pull/Push now…** action plus **Done**.
|
|
132
132
|
Continue starts a fresh operation and exact preview for the captured setup rather than resuming stale work.
|
|
133
133
|
- **Keep this device's content list and update remote…** opens the existing `push --force` preparation and exact confirmation without `--yes`.
|
|
@@ -150,6 +150,8 @@ Back returns to the sync manager, and Ctrl+C closes the complete flow.
|
|
|
150
150
|
Startup checks never open a dialog. While checking, TUI and RPC status show **sync ...**. With a sync baseline and no content-list mismatch, they use **sync ⇡** for local changes to push and **sync ⇣** for remote changes to pull. Review conditions use **sync ⇕**; in TUI, a persistent widget above the editor also identifies both sides changing, first sync with an existing remote snapshot, a differing content list (including order-only differences), or a missing remote snapshot despite an existing baseline. Both sides changing is a reason to review, not a confirmed file conflict.
|
|
151
151
|
No selected content and first sync with an empty remote stay quiet outside `/sync`, which provides setup or initialization guidance. Legacy remote metadata without an authoritative content list does not independently trigger a widget for observation-only checks. With **Startup transfer** enabled, an established legacy remote instead shows review attention and requires an explicit direction to adopt the content policy; no automatic transfer runs. An included-content mismatch puts **Review synced content (recommended)** in the manager, where a fresh review verifies the remote snapshot before offering changes.
|
|
152
152
|
Check results are advisory observations against the last sync baseline, not proof of a file conflict or current equality. Opening the manager uses local information and shows when the check completed; it does not contact remote storage. Transfer actions recheck current content.
|
|
153
|
+
In fullscreen TUI mode, click anywhere in **Sync** to collapse or expand the widget without moving keyboard focus. Attention updates keep the collapse state. Open and close `/sync` to restore the body with the keyboard; a new session resets the state.
|
|
154
|
+
|
|
153
155
|
The widget has no expiry timer. Attention stays in memory and is invalidated by relevant settings/state changes or a foreground transfer's commit boundary, and cleared on session replacement or shutdown. A newer observation replaces the presentation, clearing the widget when only status or no reminder is needed. Cancelling a review or a failure before commit preserves a still-valid observation and its appropriate presentation.
|
|
154
156
|
|
|
155
157
|
Interactive TUI `/sync sync`, `/sync pull`, and `/sync push` routes without `--yes` open the same review flow when they detect the mismatch.
|
|
@@ -222,7 +224,7 @@ Successful transfers show one summary. They do not reload resources, activate ex
|
|
|
222
224
|
|
|
223
225
|
**Settings → Machine-local fields** edits explicit `sync.localFields` root field names for global `settings.json` (default none). Excluded values and absence stay local; future portable snapshots omit them. Enabling rules opts into settings version 4 / snapshot version 2, which older clients must refuse. All receiving machines must configure compatible rules. Additions/removals require a separately confirmed force-direction migration, even with `--yes`; old remote history is **not erased**. See [settings merge and local fields](./skills/configure-pi-sync/references/configuration.md#settings-field-merge-and-machine-local-fields) for formats, compatibility and recovery.
|
|
224
226
|
|
|
225
|
-
**Settings → Content merge / partial progress** controls independent `sync.mergeContent` and `sync.partialSync` opt-ins, both default **Off**. Saving opts into settings version 5; partial publications use snapshot version 3, rejected by older readers. Supported Markdown/plain-text resources merge bounded independent line edits without Git or conflict markers. Diff grids and hunk comparisons share an eight-million-work-unit budget across the operation and its retries; exhausted paths remain conflicts for review. Same-session reconciliation only accepts validated complete byte-prefix extensions; divergent histories and the loaded session require review. A syntactically clean text merge is **not a semantic correctness guarantee**.
|
|
227
|
+
**Settings → Content merge / partial progress** controls independent `sync.mergeContent` and `sync.partialSync` opt-ins, both default **Off**. Saving opts into at least settings version 5; partial publications use snapshot version 3, or version 4 with exclusions, rejected by older readers. Supported Markdown/plain-text resources merge bounded independent line edits without Git or conflict markers. Diff grids and hunk comparisons share an eight-million-work-unit budget across the operation and its retries; exhausted paths remain conflicts for review. Same-session reconciliation only accepts validated complete byte-prefix extensions; divergent histories and the loaded session require review. A syntactically clean text merge is **not a semantic correctness guarantee**.
|
|
226
228
|
|
|
227
229
|
Partial sync keeps each side's unresolved versions, preserves their previous accepted hashes/ancestors, and advances only independent paths. Resource/collision dependency groups are withheld together, including local-only files, never represented as deletion. The conditional **Review unresolved conflicts** action, or `/sync conflicts`, opens exact private versions on request and resolves one freshly validated whole group. Automatic pushes, non-forced push/pull, and rollback refuse unresolved groups; use group review or an explicit manual push/pull force direction instead. Artifacts remain below the denied state root, with stable conflict identity and at most 32 proven-completed records retained; unresolved or unrecognized evidence is never automatically pruned. Failed attempts release only newly created artifacts whose inode/content ownership and lack of state/journal references are verified. See [content merge and partial recovery](./docs/content-merge-audit.md).
|
|
228
230
|
|
|
@@ -272,7 +274,9 @@ Version 1, version 2, and non-empty unversioned settings require manual recovery
|
|
|
272
274
|
Adding `sessions` can upload prompts, tool output, paths, images, and secrets; interactive flows require a privacy acknowledgement.
|
|
273
275
|
Startup checks report included-content differences without changing anything. Transfers retain their existing included-content policy checks instead of silently expanding local scope.
|
|
274
276
|
|
|
275
|
-
|
|
277
|
+
**Settings → Excluded paths** edits optional per-setup `sync.exclude` rules, for example `["skills/private", "extensions/**/*.test.ts"]`. Rules win over includes and apply to future transfers; excluded local files remain untouched, including on rollback. Saving opts into settings version 6 / snapshot version 4, which older clients must refuse. New publications omit matching remote paths, but old history is **not erased**. Removing rules can expose or replace content. See [Excluded paths](./skills/configure-pi-sync/references/configuration.md#excluded-paths) for syntax, review, and recovery.
|
|
278
|
+
|
|
279
|
+
Read the [settings reference](./skills/configure-pi-sync/references/configuration.md) for complete S3/R2, Git, and WebDAV examples, backend fields, content policy, legacy paths, and recovery steps.
|
|
276
280
|
|
|
277
281
|
## 🧠 Skills
|
|
278
282
|
|
|
@@ -371,7 +375,7 @@ Preserve both roots before manual recovery; with every Pi process closed and no
|
|
|
371
375
|
Pi exposes terminal components rather than a semantic or ARIA tree.
|
|
372
376
|
Release checks cover textual state, keyboard operation, Escape and Back behavior, control escaping, and narrow rendering.
|
|
373
377
|
Critical meaning appears in text such as `(current)`, `Review needed`, `No startup transfer`, `Warning`, `Invalid`, `Saved`, `Cancelled`, and `Applied`.
|
|
374
|
-
Color is supplementary
|
|
378
|
+
Color is supplementary. The attention widget's mouse control changes only its presentation; `/sync` provides keyboard access to review actions.
|
|
375
379
|
|
|
376
380
|
## 🗂️ Package layout
|
|
377
381
|
|
|
@@ -394,6 +398,8 @@ packages/pi-sync/
|
|
|
394
398
|
└── test/ # Behavior and lifecycle coverage
|
|
395
399
|
```
|
|
396
400
|
|
|
401
|
+
The [exclude policy safety audit](./docs/exclude-policy-audit.md) maps implementation boundaries to regression coverage.
|
|
402
|
+
|
|
397
403
|
The generated runtime is built from `src/index.ts` and does not import back into `src`.
|
|
398
404
|
Internal modules use direct imports from their owners; `src/sync.ts` and `src/types.ts` retain compatibility exports.
|
|
399
405
|
Backend transports do not depend on UI, and first-use operation and setup implementations remain lazy.
|
|
@@ -5,19 +5,20 @@ import {
|
|
|
5
5
|
buildAgentEvidence,
|
|
6
6
|
digest,
|
|
7
7
|
parseAgentCandidate
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-25QCU3LY.ts";
|
|
9
|
+
import "./chunk-6OFMB6KK.ts";
|
|
10
|
+
import "./chunk-UZSDS4HF.ts";
|
|
11
11
|
import "./chunk-ZW5ZLGBI.ts";
|
|
12
12
|
import "./chunk-XJHQPB3E.ts";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-4NVHHDN2.ts";
|
|
14
14
|
import "./chunk-AR2DGDUI.ts";
|
|
15
15
|
import "./chunk-SWRVXVFD.ts";
|
|
16
16
|
import "./chunk-2JZFHNLM.ts";
|
|
17
17
|
import "./chunk-T2SJD3N7.ts";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-MKC3PXCN.ts";
|
|
19
|
+
import "./chunk-WUHRVSWI.ts";
|
|
20
|
+
import "./chunk-LA3HQMFG.ts";
|
|
21
|
+
import "./chunk-3JTZF7Z5.ts";
|
|
21
22
|
import "./chunk-FHE2DCA2.ts";
|
|
22
23
|
import "./chunk-PRUEIIK7.ts";
|
|
23
24
|
export {
|
|
@@ -26,4 +27,4 @@ export {
|
|
|
26
27
|
digest,
|
|
27
28
|
parseAgentCandidate
|
|
28
29
|
};
|
|
29
|
-
//# sourceMappingURL=agent-candidate-
|
|
30
|
+
//# sourceMappingURL=agent-candidate-ZHN7FTZT.ts.map
|
|
@@ -3,39 +3,40 @@
|
|
|
3
3
|
import {
|
|
4
4
|
fileHashMap,
|
|
5
5
|
sameHashes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6YGRZSCN.ts";
|
|
7
7
|
import {
|
|
8
8
|
AgentResolutionRequired
|
|
9
9
|
} from "./chunk-3ST7RSYN.ts";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-P3YD4ONV.ts";
|
|
11
11
|
import {
|
|
12
12
|
syncConfigReviewIdentity
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-XZ3ZTHKR.ts";
|
|
14
14
|
import "./chunk-X7R6DCVF.ts";
|
|
15
15
|
import {
|
|
16
16
|
applyAgentCandidate,
|
|
17
17
|
buildAgentEvidence,
|
|
18
18
|
digest
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-25QCU3LY.ts";
|
|
20
|
+
import "./chunk-6OFMB6KK.ts";
|
|
21
21
|
import {
|
|
22
22
|
readMergeAncestors
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-UZSDS4HF.ts";
|
|
24
24
|
import "./chunk-ZW5ZLGBI.ts";
|
|
25
25
|
import "./chunk-XJHQPB3E.ts";
|
|
26
26
|
import {
|
|
27
27
|
readStateForConfig,
|
|
28
28
|
syncStateFingerprint
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-4NVHHDN2.ts";
|
|
30
30
|
import "./chunk-AR2DGDUI.ts";
|
|
31
31
|
import "./chunk-SWRVXVFD.ts";
|
|
32
32
|
import "./chunk-2JZFHNLM.ts";
|
|
33
33
|
import "./chunk-T2SJD3N7.ts";
|
|
34
34
|
import {
|
|
35
35
|
createSnapshot
|
|
36
|
-
} from "./chunk-
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
36
|
+
} from "./chunk-MKC3PXCN.ts";
|
|
37
|
+
import "./chunk-WUHRVSWI.ts";
|
|
38
|
+
import "./chunk-LA3HQMFG.ts";
|
|
39
|
+
import "./chunk-3JTZF7Z5.ts";
|
|
39
40
|
import "./chunk-FHE2DCA2.ts";
|
|
40
41
|
import {
|
|
41
42
|
ContinuousError
|
|
@@ -120,4 +121,4 @@ async function resolveAgentPlan(ctx, options, config, backend, state, local, loc
|
|
|
120
121
|
export {
|
|
121
122
|
resolveAgentPlan
|
|
122
123
|
};
|
|
123
|
-
//# sourceMappingURL=agent-plan-
|
|
124
|
+
//# sourceMappingURL=agent-plan-ILFEUJ2E.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(\"Autonomous sync 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\", \"Autonomous sync paused: unsafe or unsupported conflict evidence.\");\n }\n if (!config.partialSync && evidence.unsupported.length)\n throw new ContinuousError(\n \"unsafe\",\n \"Autonomous sync paused: unsupported conflicts prevent an all-or-nothing transfer.\",\n );\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 \"Autonomous sync 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\", \"Autonomous sync 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\", \"Autonomous sync 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(\"Autonomous sync 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\", \"Autonomous sync paused: conflict evidence changed; retry a fresh sync.\");\n };\n throw new AgentResolutionRequired(key, evidence, validateEvidence);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
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,oEAAo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AI,gBAAgB,UAAU,4EAA4E;AAAA,IAClH;AAAA,EACF;AACA,QAAM,mBAAmB,OAAO,SAAS,QAAQ,WAAW;AAC1D,UAAM,QAAQ,YAAY;AACxB,cAAQ,eAAe;AACvB,YAAM,SAAS;AACf,cAAQ,eAAe;AAAA,IACzB;AACA,UAAM,MAAM;AACZ,QAAI,OAAO,IAAI,KAAK,MAAM,MAAO,OAAM,IAAI,MAAM,iDAAiD;AAClG,UAAM,UAAU,MAAM,eAAe,OAAO,kBAAkB,EAAE,GAAG,iBAAiB,OAAO,CAAC;AAC5F,UAAM,MAAM;AACZ,UAAM,eAAe,MAAM,mBAAmB,MAAM;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,wEAAwE;AAAA,EAC/G;AACA,QAAM,IAAI,wBAAwB,KAAK,UAAU,gBAAgB;AACnE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,26 +3,27 @@
|
|
|
3
3
|
import {
|
|
4
4
|
confirmMergeReview
|
|
5
5
|
} from "./chunk-KHBPED6W.ts";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-ILXMZ2HU.ts";
|
|
7
|
+
import "./chunk-QQVK2XFC.ts";
|
|
8
8
|
import {
|
|
9
9
|
captureMutationOwner
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-T2TYBLXK.ts";
|
|
11
11
|
import {
|
|
12
12
|
safeTerminalText
|
|
13
13
|
} from "./chunk-AMJRUXFT.ts";
|
|
14
14
|
import {
|
|
15
15
|
loadConfig
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-XZ3ZTHKR.ts";
|
|
17
17
|
import "./chunk-X7R6DCVF.ts";
|
|
18
18
|
import "./chunk-PWMWOJP4.ts";
|
|
19
19
|
import "./chunk-AR2DGDUI.ts";
|
|
20
20
|
import "./chunk-SWRVXVFD.ts";
|
|
21
21
|
import "./chunk-2JZFHNLM.ts";
|
|
22
22
|
import "./chunk-T2SJD3N7.ts";
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-MKC3PXCN.ts";
|
|
24
|
+
import "./chunk-WUHRVSWI.ts";
|
|
25
|
+
import "./chunk-LA3HQMFG.ts";
|
|
26
|
+
import "./chunk-3JTZF7Z5.ts";
|
|
26
27
|
import "./chunk-FHE2DCA2.ts";
|
|
27
28
|
|
|
28
29
|
// src/sync/agent-refusal-retry.ts
|
|
@@ -69,4 +70,4 @@ async function confirmAgentRefusalRetry(ctx, setup, evidence, validate, signal)
|
|
|
69
70
|
export {
|
|
70
71
|
confirmAgentRefusalRetry
|
|
71
72
|
};
|
|
72
|
-
//# sourceMappingURL=agent-refusal-retry-
|
|
73
|
+
//# sourceMappingURL=agent-refusal-retry-HRMHCX2A.ts.map
|
package/dist/chunks/{agent-refusal-retry-476YGNU5.ts.map → agent-refusal-retry-HRMHCX2A.ts.map}
RENAMED
|
@@ -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": "
|
|
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,IACA;AAAA,EACF,EAAE,KAAK,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,9 +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-
|
|
5
|
+
} from "./chunk-S7D6XWHI.ts";
|
|
6
6
|
import "./chunk-PWMWOJP4.ts";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-4NVHHDN2.ts";
|
|
8
8
|
import {
|
|
9
9
|
writeJson
|
|
10
10
|
} from "./chunk-AR2DGDUI.ts";
|
|
@@ -172,4 +172,4 @@ export {
|
|
|
172
172
|
saveAgentCandidate,
|
|
173
173
|
withAgentClaim
|
|
174
174
|
};
|
|
175
|
-
//# sourceMappingURL=agent-store-
|
|
175
|
+
//# sourceMappingURL=agent-store-CCKN4DPR.ts.map
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
3
|
import {
|
|
4
4
|
withAgentSyncLock
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RDOX3VH5.ts";
|
|
6
6
|
import "./chunk-3ST7RSYN.ts";
|
|
7
7
|
import "./chunk-YIPK23JW.ts";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-S7D6XWHI.ts";
|
|
9
9
|
import "./chunk-PWMWOJP4.ts";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-4NVHHDN2.ts";
|
|
11
11
|
import "./chunk-AR2DGDUI.ts";
|
|
12
12
|
import "./chunk-SWRVXVFD.ts";
|
|
13
13
|
import "./chunk-2JZFHNLM.ts";
|
|
@@ -19,4 +19,4 @@ import "./chunk-PRUEIIK7.ts";
|
|
|
19
19
|
export {
|
|
20
20
|
withAgentSyncLock
|
|
21
21
|
};
|
|
22
|
-
//# sourceMappingURL=agent-sync-
|
|
22
|
+
//# sourceMappingURL=agent-sync-EGA2I5W7.ts.map
|
|
@@ -4,20 +4,20 @@ import {
|
|
|
4
4
|
COUPLED_FIELDS,
|
|
5
5
|
mergeSettingsJson,
|
|
6
6
|
snapshotFile
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6OFMB6KK.ts";
|
|
8
8
|
import {
|
|
9
9
|
edits,
|
|
10
10
|
isMergeTextPath,
|
|
11
11
|
lines,
|
|
12
12
|
text
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-UZSDS4HF.ts";
|
|
14
14
|
import {
|
|
15
15
|
parseJsonObjectDocument,
|
|
16
16
|
parseSettingsDocument
|
|
17
17
|
} from "./chunk-ZW5ZLGBI.ts";
|
|
18
18
|
import {
|
|
19
19
|
scanSnapshot
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-MKC3PXCN.ts";
|
|
21
21
|
import {
|
|
22
22
|
AGENT_INPUT_BYTES,
|
|
23
23
|
AGENT_MAX_UNITS,
|
|
@@ -217,4 +217,4 @@ export {
|
|
|
217
217
|
parseAgentCandidate,
|
|
218
218
|
applyAgentCandidate
|
|
219
219
|
};
|
|
220
|
-
//# sourceMappingURL=chunk-
|
|
220
|
+
//# sourceMappingURL=chunk-25QCU3LY.ts.map
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
var createSyncBackend = async (config) => {
|
|
6
6
|
switch (config.backend.type) {
|
|
7
7
|
case "s3": {
|
|
8
|
-
const { S3SyncBackend } = await import("./s3-backend-
|
|
8
|
+
const { S3SyncBackend } = await import("./s3-backend-FDK7JSDQ.ts");
|
|
9
9
|
return new S3SyncBackend(config.backend);
|
|
10
10
|
}
|
|
11
11
|
case "webdav": {
|
|
12
|
-
const { WebDavSyncBackend } = await import("./webdav-backend-
|
|
12
|
+
const { WebDavSyncBackend } = await import("./webdav-backend-UNMIAXM5.ts");
|
|
13
13
|
return new WebDavSyncBackend(config.backend);
|
|
14
14
|
}
|
|
15
15
|
case "git": {
|
|
16
|
-
const { GitSyncBackend } = await import("./git-backend-
|
|
16
|
+
const { GitSyncBackend } = await import("./git-backend-6CKI6CUG.ts");
|
|
17
17
|
return new GitSyncBackend(config.backend);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -22,4 +22,4 @@ var createSyncBackend = async (config) => {
|
|
|
22
22
|
export {
|
|
23
23
|
createSyncBackend
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-2UKUKIBI.ts.map
|
|
@@ -9,22 +9,26 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
syncCheckConfigFingerprint,
|
|
11
11
|
syncConfigReviewFingerprint
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XZ3ZTHKR.ts";
|
|
13
13
|
import {
|
|
14
14
|
compareSyncInclude,
|
|
15
15
|
sameSyncInclude
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WUHRVSWI.ts";
|
|
17
|
+
import {
|
|
18
|
+
sameSyncExclude
|
|
19
|
+
} from "./chunk-3JTZF7Z5.ts";
|
|
17
20
|
|
|
18
21
|
// src/ui/sync-attention.ts
|
|
19
22
|
import { truncateToWidth } from "@earendil-works/pi-tui";
|
|
20
23
|
var WIDGET_KEY = "sync:attention";
|
|
21
24
|
function syncAttentionMatchesConfig(attention, config) {
|
|
22
|
-
return attention.decision.setupName === config.setupName && attention.decision.configIdentity === syncConfigReviewFingerprint(config) && sameSyncInclude(attention.decision.localInclude, config.include);
|
|
25
|
+
return attention.decision.setupName === config.setupName && attention.decision.configIdentity === syncConfigReviewFingerprint(config) && sameSyncInclude(attention.decision.localInclude, config.include) && sameSyncExclude(attention.decision.localExclude, config.exclude);
|
|
23
26
|
}
|
|
24
27
|
function createSyncAttentionController() {
|
|
25
28
|
let state;
|
|
26
29
|
let observation;
|
|
27
30
|
let generation = 0;
|
|
31
|
+
let widgetState = { collapsed: false };
|
|
28
32
|
return {
|
|
29
33
|
observe(value) {
|
|
30
34
|
generation++;
|
|
@@ -63,8 +67,12 @@ function createSyncAttentionController() {
|
|
|
63
67
|
generation++;
|
|
64
68
|
state = void 0;
|
|
65
69
|
observation = void 0;
|
|
70
|
+
widgetState = { collapsed: false };
|
|
66
71
|
clearAttentionPresentation(ctx);
|
|
67
72
|
},
|
|
73
|
+
expand() {
|
|
74
|
+
widgetState.collapsed = false;
|
|
75
|
+
},
|
|
68
76
|
async publish(ctx, signal) {
|
|
69
77
|
const currentGeneration = ++generation;
|
|
70
78
|
if (signal?.aborted || !ctx.hasUI) return;
|
|
@@ -80,10 +88,7 @@ function createSyncAttentionController() {
|
|
|
80
88
|
});
|
|
81
89
|
return;
|
|
82
90
|
}
|
|
83
|
-
const presentation = state ? attentionPresentation(state.decision) :
|
|
84
|
-
status: "sync \u21D5",
|
|
85
|
-
lines: observationLines(observation)
|
|
86
|
-
};
|
|
91
|
+
const presentation = state ? attentionPresentation(state.decision) : observationPresentation(observation);
|
|
87
92
|
if (ctx.mode !== "tui") {
|
|
88
93
|
ctx.ui.setWidget(WIDGET_KEY, void 0);
|
|
89
94
|
setSyncStatus(ctx, presentation.status, { activity: "review" });
|
|
@@ -95,10 +100,14 @@ function createSyncAttentionController() {
|
|
|
95
100
|
});
|
|
96
101
|
if (generation !== currentGeneration || signal?.aborted) return;
|
|
97
102
|
setSyncStatus(ctx, presentation.status, { activity: "review" });
|
|
103
|
+
const presentationState = widgetState;
|
|
98
104
|
ctx.ui.setWidget(
|
|
99
105
|
WIDGET_KEY,
|
|
100
106
|
(_tui, theme) => new EditorStatusWidget({
|
|
101
107
|
theme,
|
|
108
|
+
name: "Sync",
|
|
109
|
+
summary: "Needs review",
|
|
110
|
+
state: presentationState,
|
|
102
111
|
renderBody: (width) => presentation.lines.map(
|
|
103
112
|
(line, index) => width === 0 ? "" : truncateToWidth(theme.fg(index === 0 ? "warning" : "muted", line), width, "\u2026")
|
|
104
113
|
)
|
|
@@ -110,10 +119,31 @@ function createSyncAttentionController() {
|
|
|
110
119
|
function attentionPresentation(decision) {
|
|
111
120
|
const setupName = safeTerminalText(decision.setupName);
|
|
112
121
|
const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);
|
|
113
|
-
const difference = comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 ? "Only list order differs" : `Remote ${comparison.remoteOnly.length} \xB7 Device ${comparison.localOnly.length}`;
|
|
114
122
|
return {
|
|
115
123
|
status: "sync \u21D5",
|
|
116
|
-
lines: [
|
|
124
|
+
lines: [
|
|
125
|
+
`Setup: ${setupName}`,
|
|
126
|
+
selectionDifference({
|
|
127
|
+
...comparison,
|
|
128
|
+
excludeChanged: !sameSyncExclude(decision.localExclude, decision.remoteExclude)
|
|
129
|
+
}),
|
|
130
|
+
"No transfer performed \xB7 Run /sync to review"
|
|
131
|
+
]
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function selectionDifference(comparison) {
|
|
135
|
+
if (comparison.excludeChanged) return "Selection: excluded paths differ; review needed";
|
|
136
|
+
return comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0 ? "Selection: only list order differs" : `Selection: ${comparison.remoteOnly.length} remote-only \xB7 ${comparison.localOnly.length} device-only`;
|
|
137
|
+
}
|
|
138
|
+
function observationPresentation(observation) {
|
|
139
|
+
const selection = observation.inspection.selectionState;
|
|
140
|
+
return {
|
|
141
|
+
status: "sync \u21D5",
|
|
142
|
+
lines: [
|
|
143
|
+
`Setup: ${safeTerminalText(observation.setupName)}`,
|
|
144
|
+
selection?.kind === "different" ? selectionDifference(selection) : observationSummary(observation),
|
|
145
|
+
"No transfer performed \xB7 Run /sync to review"
|
|
146
|
+
]
|
|
117
147
|
};
|
|
118
148
|
}
|
|
119
149
|
function observationMatchesConfig(observation, config) {
|
|
@@ -166,4 +196,4 @@ export {
|
|
|
166
196
|
observationMatchesConfig,
|
|
167
197
|
observationSummary
|
|
168
198
|
};
|
|
169
|
-
//# sourceMappingURL=chunk-
|
|
199
|
+
//# sourceMappingURL=chunk-2ZZJXITS.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ui/sync-attention.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { truncateToWidth } from \"@earendil-works/pi-tui\";\nimport type { EditorStatusWidgetState } from \"@narumitw/pi-tui-kit/editor-status-widget\";\nimport { syncCheckConfigFingerprint, syncConfigReviewFingerprint } from \"../settings/config.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { sameSyncExclude } from \"../sync/exclude-policy.js\";\nimport type { StartupObservation } from \"../sync/sync-inspection.js\";\nimport { compareSyncInclude, type RemoteSelectionDecision, sameSyncInclude } from \"../sync/sync-policy.js\";\nimport { setSyncStatus } from \"./sync-status.js\";\nimport { safeTerminalText } from \"./terminal-text.js\";\n\nconst WIDGET_KEY = \"sync:attention\";\n\nexport type SyncAttentionOrigin = \"sync\" | \"pull\" | \"push\";\n\nexport interface SyncAttentionState {\n decision: RemoteSelectionDecision;\n origin: SyncAttentionOrigin;\n offered: boolean;\n}\n\nexport function syncAttentionMatchesConfig(attention: SyncAttentionState, config: AnySyncConfig) {\n return (\n attention.decision.setupName === config.setupName &&\n attention.decision.configIdentity === syncConfigReviewFingerprint(config) &&\n sameSyncInclude(attention.decision.localInclude, config.include) &&\n sameSyncExclude(attention.decision.localExclude, config.exclude)\n );\n}\n\nexport interface SyncAttentionController {\n observe(observation: StartupObservation): void;\n observation(): StartupObservation | undefined;\n clearObservation(): void;\n notifyObservation(ctx: ExtensionContext): void;\n set(decision: RemoteSelectionDecision, origin: SyncAttentionOrigin): void;\n current(): SyncAttentionState | undefined;\n markOffered(): boolean;\n clear(ctx: ExtensionContext): void;\n reset(ctx: ExtensionContext): void;\n expand(): void;\n publish(ctx: ExtensionContext, signal?: AbortSignal): Promise<void>;\n}\n\nexport function createSyncAttentionController(): SyncAttentionController {\n let state: SyncAttentionState | undefined;\n let observation: StartupObservation | undefined;\n let generation = 0;\n let widgetState: EditorStatusWidgetState = { collapsed: false };\n\n return {\n observe(value) {\n generation++;\n observation = value;\n },\n observation() {\n return observation;\n },\n clearObservation() {\n generation++;\n observation = undefined;\n },\n notifyObservation(ctx) {\n if (ctx.hasUI && observation && observationNeedsAttention(observation)) {\n ctx.ui.notify(observationLines(observation).join(\"\\n\"), \"warning\");\n }\n },\n set(decision, origin) {\n generation++;\n state = { decision, origin, offered: false };\n },\n current() {\n return state;\n },\n markOffered() {\n if (!state || state.offered) return false;\n state = { ...state, offered: true };\n return true;\n },\n clear(ctx) {\n generation++;\n state = undefined;\n clearAttentionPresentation(ctx);\n },\n reset(ctx) {\n generation++;\n state = undefined;\n observation = undefined;\n widgetState = { collapsed: false };\n clearAttentionPresentation(ctx);\n },\n expand() {\n widgetState.collapsed = false;\n },\n async publish(ctx, signal) {\n const currentGeneration = ++generation;\n if (signal?.aborted || !ctx.hasUI) return;\n const classification = observation ? classifyObservation(observation) : \"none\";\n if (!state && (classification === \"none\" || classification === \"guidance\")) {\n clearAttentionPresentation(ctx);\n return;\n }\n if (!state && classification === \"status\") {\n ctx.ui.setWidget(WIDGET_KEY, undefined);\n setSyncStatus(ctx, observation?.inspection.remoteChanged ? \"sync \u21E3\" : \"sync \u21E1\", {\n activity: observation?.inspection.remoteChanged ? \"remote-change\" : \"local-change\",\n });\n return;\n }\n const presentation = state\n ? attentionPresentation(state.decision)\n : observationPresentation(observation as StartupObservation);\n if (ctx.mode !== \"tui\") {\n ctx.ui.setWidget(WIDGET_KEY, undefined);\n setSyncStatus(ctx, presentation.status, { activity: \"review\" });\n return;\n }\n // Keep Kit outside the eager startup graph; module loading owns no cancellable resources.\n const { EditorStatusWidget } = await import(\"./attention-widget.js\").catch((error) => {\n if (generation === currentGeneration && !signal?.aborted) clearAttentionPresentation(ctx);\n throw error;\n });\n if (generation !== currentGeneration || signal?.aborted) return;\n setSyncStatus(ctx, presentation.status, { activity: \"review\" });\n const presentationState = widgetState;\n ctx.ui.setWidget(\n WIDGET_KEY,\n (_tui, theme) =>\n new EditorStatusWidget({\n theme,\n name: \"Sync\",\n summary: \"Needs review\",\n state: presentationState,\n renderBody: (width) =>\n presentation.lines.map((line, index) =>\n width === 0 ? \"\" : truncateToWidth(theme.fg(index === 0 ? \"warning\" : \"muted\", line), width, \"\u2026\"),\n ),\n }),\n );\n },\n };\n}\n\nfunction attentionPresentation(decision: RemoteSelectionDecision) {\n const setupName = safeTerminalText(decision.setupName);\n const comparison = compareSyncInclude(decision.localInclude, decision.remoteInclude);\n return {\n status: \"sync \u21D5\",\n lines: [\n `Setup: ${setupName}`,\n selectionDifference({\n ...comparison,\n excludeChanged: !sameSyncExclude(decision.localExclude, decision.remoteExclude),\n }),\n \"No transfer performed \u00B7 Run /sync to review\",\n ],\n };\n}\n\nfunction selectionDifference(comparison: {\n remoteOnly: readonly string[];\n localOnly: readonly string[];\n excludeChanged?: boolean;\n}) {\n if (comparison.excludeChanged) return \"Selection: excluded paths differ; review needed\";\n return comparison.remoteOnly.length === 0 && comparison.localOnly.length === 0\n ? \"Selection: only list order differs\"\n : `Selection: ${comparison.remoteOnly.length} remote-only \u00B7 ${comparison.localOnly.length} device-only`;\n}\n\nfunction observationPresentation(observation: StartupObservation) {\n const selection = observation.inspection.selectionState;\n return {\n status: \"sync \u21D5\",\n lines: [\n `Setup: ${safeTerminalText(observation.setupName)}`,\n selection?.kind === \"different\" ? selectionDifference(selection) : observationSummary(observation),\n \"No transfer performed \u00B7 Run /sync to review\",\n ],\n };\n}\n\nexport function observationMatchesConfig(observation: StartupObservation, config: AnySyncConfig) {\n return observation.configIdentity === syncCheckConfigFingerprint(config);\n}\n\nexport function observationSummary(observation: StartupObservation) {\n const result = observation.inspection;\n if (result.emptyInclude) return \"No included content selected\";\n if (result.selectionState?.kind === \"different\") return \"Synced-content list differs; review needed\";\n if (result.firstSync)\n return result.head ? \"No sync baseline; review remote and local content\" : \"Remote empty; no sync baseline\";\n if (!result.head) return \"Remote snapshot missing; review needed\";\n if (observation.automaticTransfer && result.selectionState?.kind === \"legacy\")\n return \"Legacy remote has no authoritative content list; review /sync and choose an explicit direction to adopt policy\";\n if (result.localChanged && result.remoteChanged) return \"Local and remote changed since last sync; review needed\";\n if (result.remoteChanged) return \"Remote changed since last sync\";\n if (result.localChanged) return \"Local content changed since last sync\";\n if (result.selectionState?.kind === \"legacy\") return \"Legacy remote has no authoritative content list\";\n return \"No changes detected since last sync\";\n}\n\nexport type ObservationClassification = \"none\" | \"guidance\" | \"status\" | \"review\";\n\n/** Presentation only: never discard an observation or authorize a transfer here. */\nexport function classifyObservation(observation: StartupObservation): ObservationClassification {\n const result = observation.inspection;\n // Sync now exits before reading remote content when nothing is selected.\n if (result.emptyInclude) return \"guidance\";\n // Ordering is part of the existing transfer policy, not merely display order.\n if (result.selectionState?.kind === \"different\") return \"review\";\n if (result.firstSync) return result.head ? \"review\" : \"guidance\";\n if (!result.head || (result.localChanged && result.remoteChanged)) return \"review\";\n if (observation.automaticTransfer && result.selectionState?.kind === \"legacy\") return \"review\";\n if (result.localChanged || result.remoteChanged) return \"status\";\n // Legacy metadata alone requires no scope confirmation in transfer operations.\n return \"none\";\n}\n\nexport function observationNeedsAttention(observation: StartupObservation) {\n return classifyObservation(observation) === \"review\";\n}\n\nfunction observationLines(observation: StartupObservation) {\n return [\n `Pi Sync check \u00B7 ${safeTerminalText(observation.setupName)}`,\n observationSummary(observation),\n \"No startup transfer \u00B7 Run /sync to review\",\n ];\n}\n\nfunction clearAttentionPresentation(ctx: ExtensionContext) {\n if (!ctx.hasUI) return;\n setSyncStatus(ctx, undefined);\n ctx.ui.setWidget(WIDGET_KEY, undefined);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AACA,SAAS,uBAAuB;AAUhC,IAAM,aAAa;AAUZ,SAAS,2BAA2B,WAA+B,QAAuB;AAC/F,SACE,UAAU,SAAS,cAAc,OAAO,aACxC,UAAU,SAAS,mBAAmB,4BAA4B,MAAM,KACxE,gBAAgB,UAAU,SAAS,cAAc,OAAO,OAAO,KAC/D,gBAAgB,UAAU,SAAS,cAAc,OAAO,OAAO;AAEnE;AAgBO,SAAS,gCAAyD;AACvE,MAAI;AACJ,MAAI;AACJ,MAAI,aAAa;AACjB,MAAI,cAAuC,EAAE,WAAW,MAAM;AAE9D,SAAO;AAAA,IACL,QAAQ,OAAO;A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AgB,OAAO,cAAe,QAAO;AAExD,SAAO;AACT;AAEO,SAAS,0BAA0B,aAAiC;AACzE,SAAO,oBAAoB,WAAW,MAAM;AAC9C;AAEA,SAAS,iBAAiB,aAAiC;AACzD,SAAO;AAAA,IACL,sBAAmB,iBAAiB,YAAY,SAAS,CAAC;AAAA,IAC1D,mBAAmB,WAAW;AAAA,IAC9B;AAAA,EACF;AACF;AAEA,SAAS,2BAA2B,KAAuB;AACzD,MAAI,CAAC,IAAI,MAAO;AAChB,gBAAc,KAAK,MAAS;AAC5B,MAAI,GAAG,UAAU,YAAY,MAAS;AACxC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
|
|
4
|
+
// src/sync/exclude-policy.ts
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { Minimatch } from "minimatch";
|
|
7
|
+
var MAX_RULES = 1024;
|
|
8
|
+
var MAX_RULE_BYTES = 4096;
|
|
9
|
+
var MAX_TOTAL_BYTES = 256 * 1024;
|
|
10
|
+
function normalizeSyncExclude(value) {
|
|
11
|
+
if (value === void 0) return [];
|
|
12
|
+
if (!Array.isArray(value)) throw new Error("Invalid pi-sync settings: sync.exclude must be an array.");
|
|
13
|
+
if (value.length > MAX_RULES) throw new Error(`sync.exclude exceeds ${MAX_RULES} rules.`);
|
|
14
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15
|
+
let total = 0;
|
|
16
|
+
const rules = value.map((item) => {
|
|
17
|
+
if (typeof item !== "string") throw new Error("sync.exclude rules must be strings.");
|
|
18
|
+
const bytes = Buffer.byteLength(item, "utf8");
|
|
19
|
+
total += bytes;
|
|
20
|
+
if (bytes > MAX_RULE_BYTES || total > MAX_TOTAL_BYTES) throw new Error("sync.exclude exceeds its byte limit.");
|
|
21
|
+
const rule = item.trim();
|
|
22
|
+
const segments = rule.split("/");
|
|
23
|
+
if (!rule || path.posix.isAbsolute(rule) || path.win32.isAbsolute(rule) || /^[a-z]:/iu.test(rule) || rule.includes("\\") || // biome-ignore lint/suspicious/noControlCharactersInRegex: Reject untrusted terminal controls.
|
|
24
|
+
/[\u0000-\u001f\u007f-\u009f]/u.test(item) || /^[!#]/u.test(rule) || /[[\]{}()]/u.test(rule) || segments.some(
|
|
25
|
+
(segment) => !segment || segment === "." || segment === ".." || segment.includes("**") && segment !== "**"
|
|
26
|
+
))
|
|
27
|
+
throw new Error(
|
|
28
|
+
"Invalid sync.exclude rule: use a safe relative path with only *, ?, and whole-segment ** globs."
|
|
29
|
+
);
|
|
30
|
+
const key = rule.toLowerCase();
|
|
31
|
+
if (seen.has(key)) throw new Error("Duplicate sync.exclude rule (case-insensitive).");
|
|
32
|
+
seen.add(key);
|
|
33
|
+
return rule;
|
|
34
|
+
});
|
|
35
|
+
return rules.sort((left, right) => {
|
|
36
|
+
const a = left.toLowerCase();
|
|
37
|
+
const b = right.toLowerCase();
|
|
38
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function sameSyncExclude(left, right) {
|
|
42
|
+
return JSON.stringify(normalizeSyncExclude(left).map((rule) => rule.toLowerCase())) === JSON.stringify(normalizeSyncExclude(right).map((rule) => rule.toLowerCase()));
|
|
43
|
+
}
|
|
44
|
+
function compileSyncExclude(value) {
|
|
45
|
+
const matchers = normalizeSyncExclude(value).map(
|
|
46
|
+
(rule) => (
|
|
47
|
+
// A trailing globstar also matches zero segments; ancestor matching owns its subtree.
|
|
48
|
+
new Minimatch(rule.replace(/(?:\/\*\*)+$/u, ""), {
|
|
49
|
+
dot: true,
|
|
50
|
+
nocase: true,
|
|
51
|
+
nonegate: true,
|
|
52
|
+
nocomment: true,
|
|
53
|
+
nobrace: true,
|
|
54
|
+
noext: true,
|
|
55
|
+
platform: "linux",
|
|
56
|
+
optimizationLevel: 0
|
|
57
|
+
})
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
return (relativePath) => {
|
|
61
|
+
if (matchers.length === 0) return false;
|
|
62
|
+
for (let candidate = relativePath; candidate; ) {
|
|
63
|
+
if (matchers.some((matcher) => matcher.match(candidate))) return true;
|
|
64
|
+
const slash = candidate.lastIndexOf("/");
|
|
65
|
+
if (slash < 0) break;
|
|
66
|
+
candidate = candidate.slice(0, slash);
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
normalizeSyncExclude,
|
|
74
|
+
sameSyncExclude,
|
|
75
|
+
compileSyncExclude
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=chunk-3JTZF7Z5.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/sync/exclude-policy.ts"],
|
|
4
|
+
"sourcesContent": ["import path from \"node:path\";\nimport { Minimatch } from \"minimatch\";\n\nconst MAX_RULES = 1_024;\nconst MAX_RULE_BYTES = 4_096;\nconst MAX_TOTAL_BYTES = 256 * 1_024;\n\n/** Exclusions are a set; keep spelling for exact reviews, not filesystem lookup. */\nexport function normalizeSyncExclude(value: unknown): string[] {\n if (value === undefined) return [];\n if (!Array.isArray(value)) throw new Error(\"Invalid pi-sync settings: sync.exclude must be an array.\");\n if (value.length > MAX_RULES) throw new Error(`sync.exclude exceeds ${MAX_RULES} rules.`);\n const seen = new Set<string>();\n let total = 0;\n const rules = value.map((item) => {\n if (typeof item !== \"string\") throw new Error(\"sync.exclude rules must be strings.\");\n const bytes = Buffer.byteLength(item, \"utf8\");\n total += bytes;\n if (bytes > MAX_RULE_BYTES || total > MAX_TOTAL_BYTES) throw new Error(\"sync.exclude exceeds its byte limit.\");\n const rule = item.trim();\n const segments = rule.split(\"/\");\n if (\n !rule ||\n path.posix.isAbsolute(rule) ||\n path.win32.isAbsolute(rule) ||\n /^[a-z]:/iu.test(rule) ||\n rule.includes(\"\\\\\") ||\n // biome-ignore lint/suspicious/noControlCharactersInRegex: Reject untrusted terminal controls.\n /[\\u0000-\\u001f\\u007f-\\u009f]/u.test(item) ||\n /^[!#]/u.test(rule) ||\n /[[\\]{}()]/u.test(rule) ||\n segments.some(\n (segment) => !segment || segment === \".\" || segment === \"..\" || (segment.includes(\"**\") && segment !== \"**\"),\n )\n )\n throw new Error(\n \"Invalid sync.exclude rule: use a safe relative path with only *, ?, and whole-segment ** globs.\",\n );\n const key = rule.toLowerCase();\n if (seen.has(key)) throw new Error(\"Duplicate sync.exclude rule (case-insensitive).\");\n seen.add(key);\n return rule;\n });\n return rules.sort((left, right) => {\n const a = left.toLowerCase();\n const b = right.toLowerCase();\n return a < b ? -1 : a > b ? 1 : 0;\n });\n}\n\nexport function sameSyncExclude(left: unknown, right: unknown) {\n return (\n JSON.stringify(normalizeSyncExclude(left).map((rule) => rule.toLowerCase())) ===\n JSON.stringify(normalizeSyncExclude(right).map((rule) => rule.toLowerCase()))\n );\n}\n\n/** Compile at the operation boundary and reuse for every file/directory. */\nexport function compileSyncExclude(value: unknown) {\n const matchers = normalizeSyncExclude(value).map(\n (rule) =>\n // A trailing globstar also matches zero segments; ancestor matching owns its subtree.\n new Minimatch(rule.replace(/(?:\\/\\*\\*)+$/u, \"\"), {\n dot: true,\n nocase: true,\n nonegate: true,\n nocomment: true,\n nobrace: true,\n noext: true,\n platform: \"linux\",\n optimizationLevel: 0,\n }),\n );\n return (relativePath: string): boolean => {\n if (matchers.length === 0) return false;\n for (let candidate = relativePath; candidate; ) {\n if (matchers.some((matcher) => matcher.match(candidate))) return true;\n const slash = candidate.lastIndexOf(\"/\");\n if (slash < 0) break;\n candidate = candidate.slice(0, slash);\n }\n return false;\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;AAAA,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAE1B,IAAM,YAAY;AAClB,IAA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