@narumitw/pi-sync 0.60.5 → 0.61.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 +13 -0
- package/README.md +8 -6
- package/dist/chunks/chunk-2JHAN3ZO.ts +139 -0
- package/dist/chunks/chunk-2JHAN3ZO.ts.map +7 -0
- package/dist/chunks/chunk-2ZGV5KNC.ts +274 -0
- package/dist/chunks/chunk-2ZGV5KNC.ts.map +7 -0
- package/dist/chunks/{chunk-LAXTCSX4.ts → chunk-4KTJLJSJ.ts} +117 -132
- package/dist/chunks/chunk-4KTJLJSJ.ts.map +7 -0
- package/dist/chunks/chunk-4SR3ZYHA.ts +14 -0
- package/dist/chunks/chunk-4SR3ZYHA.ts.map +7 -0
- package/dist/chunks/{chunk-6KIWZ4AY.ts → chunk-E3YLRLJM.ts} +5 -4
- package/dist/chunks/chunk-E3YLRLJM.ts.map +7 -0
- package/dist/chunks/{chunk-KPWZNMKM.ts → chunk-ECYCNZOE.ts} +1 -5
- package/dist/chunks/chunk-ECYCNZOE.ts.map +7 -0
- package/dist/chunks/{chunk-F64YWRXG.ts → chunk-EMVZL4PH.ts} +2 -2
- package/dist/chunks/{chunk-YVH5VJR4.ts → chunk-JVFCVPPD.ts} +104 -50
- package/dist/chunks/chunk-JVFCVPPD.ts.map +7 -0
- package/dist/chunks/{chunk-MCUZFUHY.ts → chunk-PJMM75W5.ts} +6 -6
- package/dist/chunks/{chunk-V2QIMC3U.ts → chunk-S7F4FOAS.ts} +10 -5
- package/dist/chunks/chunk-S7F4FOAS.ts.map +7 -0
- package/dist/chunks/{chunk-6W2SNZ5P.ts → chunk-YQSFJLJ3.ts} +6 -2
- package/dist/chunks/{chunk-6W2SNZ5P.ts.map → chunk-YQSFJLJ3.ts.map} +3 -3
- package/dist/chunks/{chunk-V4AMI3VL.ts → chunk-ZVGRZD4C.ts} +9 -1
- package/dist/chunks/chunk-ZVGRZD4C.ts.map +7 -0
- package/dist/chunks/{command-handler-TNPWFIPG.ts → command-handler-K4XJOGYC.ts} +41 -37
- package/dist/chunks/{command-handler-TNPWFIPG.ts.map → command-handler-K4XJOGYC.ts.map} +2 -2
- package/dist/chunks/{conflict-review-ETCSYJTH.ts → conflict-review-IGKY2TOJ.ts} +3 -3
- package/dist/chunks/{file-selection-DD6X4J2K.ts → file-selection-MGGVOKM7.ts} +26 -13
- package/dist/chunks/file-selection-MGGVOKM7.ts.map +7 -0
- package/dist/chunks/{manager-result-dispatcher-2GFNWHDM.ts → manager-result-dispatcher-4VJVDEUD.ts} +7 -6
- package/dist/chunks/{manager-ui-LFONXWQN.ts → manager-ui-KYQ5AZJS.ts} +134 -203
- package/dist/chunks/manager-ui-KYQ5AZJS.ts.map +7 -0
- package/dist/chunks/{remote-selection-ui-GFR6TDTX.ts → remote-selection-ui-W3KOZM3W.ts} +6 -5
- package/dist/chunks/{setup-switch-SPZE7HIQ.ts → setup-switch-D6K6PBPC.ts} +3 -3
- package/dist/chunks/{setup-wizard-5JYKAEIT.ts → setup-wizard-4DYUDHJR.ts} +13 -11
- package/dist/chunks/setup-wizard-4DYUDHJR.ts.map +7 -0
- package/dist/chunks/{sync-inspection-6VGR2UVZ.ts → sync-inspection-J3CRBORL.ts} +5 -5
- package/dist/chunks/{sync-operations-SAKAZL6Z.ts → sync-operations-BVWYYKH3.ts} +3 -3
- package/dist/index.ts +21 -21
- package/package.json +4 -4
- package/skills/configure-pi-sync/references/configuration.md +59 -32
- package/src/commands/command-execution.ts +7 -1
- package/src/daemon/pi-client.ts +1 -0
- package/src/sync/sync-policy.ts +5 -0
- package/src/ui/agent-mode-setting.ts +9 -1
- package/src/ui/excluded-paths-ui.ts +154 -2
- package/src/ui/file-selection.ts +12 -7
- package/src/ui/manager-state.ts +13 -8
- package/src/ui/remote-selection-ui.ts +120 -27
- package/src/ui/settings-frame.ts +2 -8
- package/src/ui/settings-ui.ts +51 -26
- package/src/ui/setup/directory-rules.ts +81 -0
- package/src/ui/setup/git-ui.ts +14 -24
- package/src/ui/setup/s3-ui.ts +13 -26
- package/src/ui/setup/setup-actions.ts +0 -4
- package/src/ui/setup/setup-prompts.ts +99 -17
- package/src/ui/setup/setup-switcher.ts +4 -2
- package/src/ui/setup/setup-wizard.ts +5 -4
- package/src/ui/setup/webdav-ui.ts +13 -27
- package/src/ui/storage-connections-ui.ts +2 -2
- package/src/ui/sync-attention.ts +8 -3
- package/src/ui/sync-format.ts +8 -1
- package/src/ui/sync-setups-ui.ts +5 -3
- package/dist/chunks/chunk-6KIWZ4AY.ts.map +0 -7
- package/dist/chunks/chunk-KPWZNMKM.ts.map +0 -7
- package/dist/chunks/chunk-LAXTCSX4.ts.map +0 -7
- package/dist/chunks/chunk-V2QIMC3U.ts.map +0 -7
- package/dist/chunks/chunk-V4AMI3VL.ts.map +0 -7
- package/dist/chunks/chunk-YVH5VJR4.ts.map +0 -7
- package/dist/chunks/file-selection-DD6X4J2K.ts.map +0 -7
- package/dist/chunks/manager-ui-LFONXWQN.ts.map +0 -7
- package/dist/chunks/setup-wizard-5JYKAEIT.ts.map +0 -7
- /package/dist/chunks/{chunk-F64YWRXG.ts.map → chunk-EMVZL4PH.ts.map} +0 -0
- /package/dist/chunks/{chunk-MCUZFUHY.ts.map → chunk-PJMM75W5.ts.map} +0 -0
- /package/dist/chunks/{conflict-review-ETCSYJTH.ts.map → conflict-review-IGKY2TOJ.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-2GFNWHDM.ts.map → manager-result-dispatcher-4VJVDEUD.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-GFR6TDTX.ts.map → remote-selection-ui-W3KOZM3W.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-SPZE7HIQ.ts.map → setup-switch-D6K6PBPC.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-6VGR2UVZ.ts.map → sync-inspection-J3CRBORL.ts.map} +0 -0
- /package/dist/chunks/{sync-operations-SAKAZL6Z.ts.map → sync-operations-BVWYYKH3.ts.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @narumitw/pi-sync
|
|
2
2
|
|
|
3
|
+
## 0.61.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 4d02a81: Default new Pi Sync setups to the Pi agent directory, with editable exclusions for sessions, managed binaries, and npm installations. Directory scope can restore selected exceptions to exclusions, but Pi credentials and project trust stay local. Existing selected-path setups keep their rules.
|
|
8
|
+
|
|
9
|
+
Recheck the directory scan limits before deletions and writes. If a recovery staging attempt stops before ownership is saved, retry in a fresh path and preserve the unverified files.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [4d02a81]
|
|
14
|
+
- @narumitw/pi-sync-daemon@0.7.0
|
|
15
|
+
|
|
3
16
|
## 0.60.5
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -61,8 +61,8 @@ All new setups default to storage path `./`: the Git repository root, the WebDAV
|
|
|
61
61
|
Git also suggests branch `main`.
|
|
62
62
|
Use different folders or prefixes for independent setups sharing a WebDAV collection or bucket; existing settings and paths are unchanged.
|
|
63
63
|
If another configured setup already uses the chosen location, setup asks for a different path before the content selection and review; Git requires a different branch, even when the directory differs.
|
|
64
|
-
|
|
65
|
-
Before saving,
|
|
64
|
+
New setups default to the Pi agent directory. All eligible files are selected except `sessions/`, `bin/`, and `npm/`; you can review and change these rules before starting a transfer. Sessions require explicit opt-in. Automatic sync is off unless you enable it. Choose **Join an existing remote** to save with both options off and then review its policy, without transferring files. Selected-path setups remain available for compatibility.
|
|
65
|
+
Before saving, review the exact destination, scope and rules, automatic-sync choice, and hidden-credential summary. R2/S3 always asks for an existing bucket; an example bucket name is not a default.
|
|
66
66
|
|
|
67
67
|
Invalid fields ask for a correction without restarting setup. A temporary local save failure keeps the review for another Save; changed settings require reopening and reviewing the current values. Saving only changes local settings, not remote data. A connection saved through **Add a new storage connection…** remains saved if you later cancel the setup.
|
|
68
68
|
|
|
@@ -174,6 +174,8 @@ Run `/sync` → **Set up sync** to create the canonical private user file at `<g
|
|
|
174
174
|
Use **Settings** to manage an existing setup.
|
|
175
175
|
Missing settings stay unconfigured without creating files or locks.
|
|
176
176
|
|
|
177
|
+
Directory scope selects all eligible files, applies `exclude`, then restores matches from `reinclude`. Pi login credentials, project trust, and Pi Sync's own state stay local regardless of those rules. Folder-wide sync may include private files that the secret scan cannot identify. Review the content before transferring to a trusted destination. Existing setups keep their selected paths and are not migrated automatically. See [Agent-directory scope](./skills/configure-pi-sync/references/configuration.md#agent-directory-scope) for formats, precedence, and recovery.
|
|
178
|
+
|
|
177
179
|
### Debug startup timings
|
|
178
180
|
|
|
179
181
|
Set the top-level `"debug": true` in `pi-sync.json`, or enable **Settings → Debug startup timings**, then restart Pi or use `/reload`.
|
|
@@ -230,9 +232,9 @@ Successful transfers show one summary. They do not reload resources, activate ex
|
|
|
230
232
|
|
|
231
233
|
**Settings → Merge settings fields** controls the per-setup `sync.mergeSettings` opt-in, default **Off**. It combines independent global `settings.json` fields, not arbitrary JSON or keybindings. Missing/corrupt ancestors, unsupported syntax, and incompatible fields retain whole-transfer review. Sensitive accepted content is cached privately under the denied state root; disabling does not delete evidence.
|
|
232
234
|
|
|
233
|
-
**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.
|
|
235
|
+
**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. An explicit array requires at least settings version 4 and snapshot version 2; directory scope keeps settings version 7 and snapshot version 5. Nonempty rules require `settings.json` in `sync.include` only for selected-path setups. 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.
|
|
234
236
|
|
|
235
|
-
**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,
|
|
237
|
+
**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 for selected paths, version 4 with selected-path exclusions, or version 5 for directory scope. Older readers must refuse unsupported formats. 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**.
|
|
236
238
|
|
|
237
239
|
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).
|
|
238
240
|
|
|
@@ -282,7 +284,7 @@ Version 1, version 2, and non-empty unversioned settings require manual recovery
|
|
|
282
284
|
Adding `sessions` can upload prompts, tool output, paths, images, and secrets; interactive flows require a privacy acknowledgement.
|
|
283
285
|
Startup checks report included-content differences without changing anything. Transfers retain their existing included-content policy checks instead of silently expanding local scope.
|
|
284
286
|
|
|
285
|
-
**Settings → Excluded paths** edits
|
|
287
|
+
For selected-path setups, **Settings → Excluded paths** edits `sync.exclude` rules that win over `include`; saving opts into at least settings version 6 and snapshot version 4. For directory scope, **Settings → Agent directory scope** also edits `reinclude` and session opt-in. Excluded local files remain untouched, including on rollback. 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.
|
|
286
288
|
|
|
287
289
|
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.
|
|
288
290
|
|
|
@@ -361,7 +363,7 @@ S3/R2 publishes `latest.json` and history using ETag `If-Match`, or `If-None-Mat
|
|
|
361
363
|
Snapshot recovery is guarded: new journals record before/after images, older journals are retired only when their unchanged preimages are provable, and unrecognized bytes remain untouched for manual review. Current-session targets are never restored during startup. Preserve a blocked transaction and its backup, close Pi, and review the private evidence before restoring selected paths; malformed/unsupported journals are not disposable. Pi may have loaded resources before lifecycle recovery, so reload or restart explicitly after recovery if loaded resources need to match the restored files.
|
|
362
364
|
|
|
363
365
|
Before pull or rollback, pi-sync writes a backup under `<agent-dir>/pi-sync/backups/`.
|
|
364
|
-
Snapshot apply and recovery require canonical agent and session paths.
|
|
366
|
+
Snapshot apply and recovery require canonical agent and session paths. Preflight refuses parent aliases it detects because Pi's file queue uses different keys for existing and missing aliases. Node's path-based writes and deletes cannot prevent another process from replacing a parent directory after a check. Use directories you control, and pause tools that move or replace their directories during sync. Preserve any pending recovery evidence; an unresolved startup recovery barrier still blocks transfers. Old journals recorded under an alias require manual review because their exact root and target paths remain pinned. Changing the agent path alone does not authorize recovery or rewriting those journals.
|
|
365
367
|
Apply preflights paths and checksums, journals mutations, and restores prior state only when current bytes match verified preimages or planned postimages. Unknown intermediate directory states and newer edits require review rather than a blind rollback. An interruption after replacement is armed can require manual recovery even if installation never ran; a later deletion of installed content is not treated as an unfinished remove.
|
|
366
368
|
The file queue coordinates one Pi runtime, not separate processes or lock-unaware editors. Hash-based journals cannot distinguish a later write of identical recorded bytes; they do not provide a cross-process compare-and-swap.
|
|
367
369
|
Merged transfers instead retain a private publication/apply/baseline journal and roll forward only when the active remote candidate and every changed local preimage/postimage can be verified. A crash or uncertain publication is reconciled through `/sync sync` without blind republishing. If newer local or remote changes prevent reconciliation, preserve the evidence, review `/sync diff`, and explicitly choose `push --force` or `pull --force`; the chosen direction archives the old journal. Disabling automatic transfer does not undo completed transfers. Do not downgrade while a merge or snapshot recovery journal is pending.
|
|
@@ -0,0 +1,139 @@
|
|
|
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
|
+
syncErrorGuidance
|
|
5
|
+
} from "./chunk-YQSFJLJ3.ts";
|
|
6
|
+
import {
|
|
7
|
+
normalizeDirectoryRules
|
|
8
|
+
} from "./chunk-ZVGRZD4C.ts";
|
|
9
|
+
import {
|
|
10
|
+
safeTerminalText
|
|
11
|
+
} from "./chunk-2JNFEZ3V.ts";
|
|
12
|
+
|
|
13
|
+
// src/ui/setup/directory-rules.ts
|
|
14
|
+
var DIRECTORY_SCOPE_ALWAYS_LOCAL = "Always local: Pi credentials (auth.json), project trust (trust.json), their locks, and Pi Sync's settings and service state. Rules cannot override these protections.";
|
|
15
|
+
var SESSION_PRIVACY_WARNING = "Session JSONL can contain prompts, tool output, paths, screenshots, and secrets. Sync sessions only to storage you trust.";
|
|
16
|
+
function starterDirectoryRules() {
|
|
17
|
+
return { exclude: ["sessions", "bin", "npm"], reinclude: [], sessions: false };
|
|
18
|
+
}
|
|
19
|
+
function directorySessionOptInLine(sessions) {
|
|
20
|
+
return `Sessions: ${sessions ? "On \u2014 explicit opt-in; path rules still apply" : "Off \u2014 rules cannot enable sessions"}`;
|
|
21
|
+
}
|
|
22
|
+
async function acknowledgeSessions(ctx, signal) {
|
|
23
|
+
const confirmed = await ctx.ui.confirm("Include session conversations?", SESSION_PRIVACY_WARNING, { signal });
|
|
24
|
+
return !signal?.aborted && confirmed;
|
|
25
|
+
}
|
|
26
|
+
async function promptDirectoryRules(ctx, kind, initial, signal, validate = () => signal?.throwIfAborted()) {
|
|
27
|
+
let draft = JSON.stringify(initial);
|
|
28
|
+
while (!signal?.aborted) {
|
|
29
|
+
const title = kind === "exclude" ? "Excluded paths" : "Re-included paths";
|
|
30
|
+
const input = await ctx.ui.input(
|
|
31
|
+
`${title}
|
|
32
|
+
|
|
33
|
+
Current rules: ${summarizeDirectoryRules(initial)}
|
|
34
|
+
Enter a JSON string array. Blank keeps the draft; [] clears it.`,
|
|
35
|
+
draft,
|
|
36
|
+
{ signal }
|
|
37
|
+
);
|
|
38
|
+
if (signal?.aborted || input === void 0) return void 0;
|
|
39
|
+
validate();
|
|
40
|
+
draft = input || draft;
|
|
41
|
+
try {
|
|
42
|
+
const parsed = JSON.parse(draft);
|
|
43
|
+
if (!Array.isArray(parsed)) throw new Error("Enter a JSON string array.");
|
|
44
|
+
return normalizeDirectoryRules(parsed);
|
|
45
|
+
} catch {
|
|
46
|
+
ctx.ui.notify("Invalid rule array or unsupported pattern. No settings changed.", "error");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return void 0;
|
|
50
|
+
}
|
|
51
|
+
function summarizeDirectoryRules(rules = []) {
|
|
52
|
+
if (!rules.length) return "none";
|
|
53
|
+
const sample = rules.slice(0, 5).map((rule) => {
|
|
54
|
+
const safe = safeTerminalText(rule);
|
|
55
|
+
return safe.length > 80 ? `${safe.slice(0, 80)}\u2026` : safe;
|
|
56
|
+
});
|
|
57
|
+
return `${rules.length} \xB7 ${sample.join(", ")}${rules.length > sample.length ? ", \u2026" : ""}`;
|
|
58
|
+
}
|
|
59
|
+
function formatDirectoryRules(label, rules) {
|
|
60
|
+
return [`${label}:`, ...rules.length ? rules.map((rule) => ` ${safeTerminalText(rule)}`) : [" (none)"]];
|
|
61
|
+
}
|
|
62
|
+
function directoryScopeLines(draft) {
|
|
63
|
+
return [
|
|
64
|
+
"Scope: Pi agent directory \xB7 all eligible files, including custom paths",
|
|
65
|
+
...formatDirectoryRules("Excluded paths", draft.exclude),
|
|
66
|
+
...formatDirectoryRules("Re-included paths (override exclusions)", draft.reinclude),
|
|
67
|
+
directorySessionOptInLine(draft.sessions),
|
|
68
|
+
DIRECTORY_SCOPE_ALWAYS_LOCAL,
|
|
69
|
+
"Synced files can contain sensitive data the secret scanner cannot identify. Review the preview before transferring."
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/ui/setup/setup-review.ts
|
|
74
|
+
import { defineMenu, runMenu } from "@narumitw/pi-tui-kit";
|
|
75
|
+
async function saveReviewedDraft(ctx, title, lines, label, save, signal) {
|
|
76
|
+
let saved = false;
|
|
77
|
+
let failure;
|
|
78
|
+
let failureText;
|
|
79
|
+
const menu = defineMenu({
|
|
80
|
+
start: "review",
|
|
81
|
+
screens: {
|
|
82
|
+
review: () => ({
|
|
83
|
+
kind: "review",
|
|
84
|
+
title,
|
|
85
|
+
content: [...failureText ? [failureText, ""] : [], ...lines].join("\n"),
|
|
86
|
+
lines: ["Review before saving. Back cancels this draft."],
|
|
87
|
+
format: { kind: "text" },
|
|
88
|
+
viewportSize: "adaptive",
|
|
89
|
+
confirm: { id: "save", label, action: "save" },
|
|
90
|
+
hint: "back"
|
|
91
|
+
})
|
|
92
|
+
},
|
|
93
|
+
actions: {
|
|
94
|
+
save: async ({ signal: actionSignal }) => {
|
|
95
|
+
try {
|
|
96
|
+
actionSignal.throwIfAborted();
|
|
97
|
+
await save(actionSignal);
|
|
98
|
+
saved = true;
|
|
99
|
+
return { kind: "close" };
|
|
100
|
+
} catch (error) {
|
|
101
|
+
if (actionSignal.aborted) return { kind: "close" };
|
|
102
|
+
if (!retryableSettingsError(error)) {
|
|
103
|
+
failure = error;
|
|
104
|
+
return { kind: "close" };
|
|
105
|
+
}
|
|
106
|
+
failureText = `Not saved. ${syncErrorGuidance(error)}
|
|
107
|
+
Your draft is retained. Fix the problem, then save again, or cancel.`;
|
|
108
|
+
ctx.ui.notify(failureText, "error");
|
|
109
|
+
return { kind: "stay" };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
const result = await runMenu(ctx, menu, {
|
|
115
|
+
getState: () => void 0,
|
|
116
|
+
signal,
|
|
117
|
+
isCurrent: () => !signal?.aborted
|
|
118
|
+
});
|
|
119
|
+
if (signal?.aborted) return false;
|
|
120
|
+
if (failure) throw failure;
|
|
121
|
+
if (result.kind === "error") throw result.error;
|
|
122
|
+
return saved;
|
|
123
|
+
}
|
|
124
|
+
function retryableSettingsError(error) {
|
|
125
|
+
const code = error?.code;
|
|
126
|
+
return code !== void 0 && ["EACCES", "EPERM", "ENOSPC", "EBUSY", "EIO", "EMFILE", "ENFILE", "EROFS"].includes(code);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export {
|
|
130
|
+
starterDirectoryRules,
|
|
131
|
+
directorySessionOptInLine,
|
|
132
|
+
acknowledgeSessions,
|
|
133
|
+
promptDirectoryRules,
|
|
134
|
+
summarizeDirectoryRules,
|
|
135
|
+
formatDirectoryRules,
|
|
136
|
+
directoryScopeLines,
|
|
137
|
+
saveReviewedDraft
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=chunk-2JHAN3ZO.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ui/setup/directory-rules.ts", "../../src/ui/setup/setup-review.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { normalizeDirectoryRules } from \"../../sync/sync-policy.js\";\nimport { safeTerminalText } from \"../terminal-text.js\";\n\nexport interface DirectoryRulesDraft {\n exclude: string[];\n reinclude: string[];\n sessions: boolean;\n}\n\nexport const DIRECTORY_SCOPE_ALWAYS_LOCAL =\n \"Always local: Pi credentials (auth.json), project trust (trust.json), their locks, and Pi Sync's settings and service state. Rules cannot override these protections.\";\n\nexport const SESSION_PRIVACY_WARNING =\n \"Session JSONL can contain prompts, tool output, paths, screenshots, and secrets. Sync sessions only to storage you trust.\";\n\nexport function starterDirectoryRules(): DirectoryRulesDraft {\n return { exclude: [\"sessions\", \"bin\", \"npm\"], reinclude: [], sessions: false };\n}\n\nexport function directorySessionOptInLine(sessions: boolean | undefined) {\n return `Sessions: ${sessions ? \"On \u2014 explicit opt-in; path rules still apply\" : \"Off \u2014 rules cannot enable sessions\"}`;\n}\n\nexport async function acknowledgeSessions(ctx: ExtensionCommandContext, signal?: AbortSignal) {\n const confirmed = await ctx.ui.confirm(\"Include session conversations?\", SESSION_PRIVACY_WARNING, { signal });\n return !signal?.aborted && confirmed;\n}\n\nexport async function promptDirectoryRules(\n ctx: ExtensionCommandContext,\n kind: \"exclude\" | \"reinclude\",\n initial: readonly string[],\n signal?: AbortSignal,\n validate: () => void = () => signal?.throwIfAborted(),\n) {\n let draft = JSON.stringify(initial);\n while (!signal?.aborted) {\n const title = kind === \"exclude\" ? \"Excluded paths\" : \"Re-included paths\";\n const input = await ctx.ui.input(\n `${title}\\n\\nCurrent rules: ${summarizeDirectoryRules(initial)}\\nEnter a JSON string array. Blank keeps the draft; [] clears it.`,\n draft,\n { signal },\n );\n if (signal?.aborted || input === undefined) return undefined;\n validate();\n draft = input || draft;\n try {\n const parsed: unknown = JSON.parse(draft);\n if (!Array.isArray(parsed)) throw new Error(\"Enter a JSON string array.\");\n return normalizeDirectoryRules(parsed);\n } catch {\n ctx.ui.notify(\"Invalid rule array or unsupported pattern. No settings changed.\", \"error\");\n }\n }\n return undefined;\n}\n\nexport function summarizeDirectoryRules(rules: readonly string[] = []) {\n if (!rules.length) return \"none\";\n const sample = rules.slice(0, 5).map((rule) => {\n const safe = safeTerminalText(rule);\n return safe.length > 80 ? `${safe.slice(0, 80)}\u2026` : safe;\n });\n return `${rules.length} \u00B7 ${sample.join(\", \")}${rules.length > sample.length ? \", \u2026\" : \"\"}`;\n}\n\nexport function formatDirectoryRules(label: string, rules: readonly string[]) {\n return [`${label}:`, ...(rules.length ? rules.map((rule) => ` ${safeTerminalText(rule)}`) : [\" (none)\"])];\n}\n\nexport function directoryScopeLines(draft: DirectoryRulesDraft) {\n return [\n \"Scope: Pi agent directory \u00B7 all eligible files, including custom paths\",\n ...formatDirectoryRules(\"Excluded paths\", draft.exclude),\n ...formatDirectoryRules(\"Re-included paths (override exclusions)\", draft.reinclude),\n directorySessionOptInLine(draft.sessions),\n DIRECTORY_SCOPE_ALWAYS_LOCAL,\n \"Synced files can contain sensitive data the secret scanner cannot identify. Review the preview before transferring.\",\n ];\n}\n", "import type { ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\nimport { syncErrorGuidance } from \"../../sync/sync-error-guidance.js\";\n\n/** A settings draft is committed only after review; retryable I/O failures retain the same draft. */\nexport async function saveReviewedDraft(\n ctx: ExtensionCommandContext,\n title: string,\n lines: readonly string[],\n label: string,\n save: (signal: AbortSignal) => Promise<unknown>,\n signal?: AbortSignal,\n) {\n let saved = false;\n let failure: unknown;\n let failureText: string | undefined;\n const menu = defineMenu<undefined, \"review\", \"save\", ExtensionCommandContext>({\n start: \"review\",\n screens: {\n review: () => ({\n kind: \"review\",\n title,\n content: [...(failureText ? [failureText, \"\"] : []), ...lines].join(\"\\n\"),\n lines: [\"Review before saving. Back cancels this draft.\"],\n format: { kind: \"text\" },\n viewportSize: \"adaptive\",\n confirm: { id: \"save\", label, action: \"save\" },\n hint: \"back\",\n }),\n },\n actions: {\n save: async ({ signal: actionSignal }) => {\n try {\n actionSignal.throwIfAborted();\n await save(actionSignal);\n saved = true;\n return { kind: \"close\" };\n } catch (error) {\n if (actionSignal.aborted) return { kind: \"close\" };\n // Do not silently rebase a stale review or overwrite an invalid settings file.\n // The caller must reopen current settings for those failures.\n if (!retryableSettingsError(error)) {\n failure = error;\n return { kind: \"close\" };\n }\n failureText = `Not saved. ${syncErrorGuidance(error)}\\nYour draft is retained. Fix the problem, then save again, or cancel.`;\n ctx.ui.notify(failureText, \"error\");\n return { kind: \"stay\" };\n }\n },\n },\n });\n const result = await runMenu(ctx, menu, {\n getState: () => undefined,\n signal,\n isCurrent: () => !signal?.aborted,\n });\n if (signal?.aborted) return false;\n if (failure) throw failure;\n if (result.kind === \"error\") throw result.error;\n return saved;\n}\n\nfunction retryableSettingsError(error: unknown) {\n const code = (error as NodeJS.ErrnoException | undefined)?.code;\n return (\n code !== undefined && [\"EACCES\", \"EPERM\", \"ENOSPC\", \"EBUSY\", \"EIO\", \"EMFILE\", \"ENFILE\", \"EROFS\"].includes(code)\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;AAUO,IAAM,+BACX;AAEK,IAAM,0BACX;AAEK,SAAS,wBAA6C;AAC3D,SAAO,EAAE,SAAS,CAAC,YAAY,OAAO,KAAK,GAAG,WAAW,CAAC,GAAG,UAAU,MAAM;AAC/E;AAEO,SAAS,0BAA0B,UAA+B;AACvE,SAAO,aAAa,WAAW,sDAAiD,yCAAoC;AACtH;AAEA,eAAsB,oBAAoB,KAA8B,QAAsB;AAC5F,QAAM,YAAY,MAAM,IAAI,GAAG,QAAQ,kCAAkC,yBAAyB,EAAE,OAAO,CAAC;AAC5G,SAAO,CAAC,QAAQ,WAAW;AAC7B;AAEA,eAAsB,qBACpB,KACA,MACA,SACA,QACA,WAAuB,MAAM,QAAQ,eAAe,GACpD;AACA,MAAI,QAAQ,KAAK,UAAU,OAAO;AAClC,SAAO,CAAC,QAAQ,SAAS;AACvB,UAAM,QAAQ,SAAS,YAAY,mBAAmB;AACtD,UAAM,QAAQ,MAAM,IAAI,GAAG;AAAA,MACzB,GAAG,KAAK;AAAA;AAAA,iBAAsB,wBAAwB,OAAO,CAAC;AAAA;AAAA,MAC9D;AAAA,MACA,EAAE,OAAO;AAAA,IACX;AACA,QAAI,QAAQ,WAAW,UAAU,OAAW,QAAO;AACnD,aAAS;AACT,YAAQ,SAAS;AACjB,QAAI;AACF,YAAM,SAAkB,KAAK,MAAM,KAAK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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
|
+
acknowledgeSessions,
|
|
5
|
+
directoryScopeLines,
|
|
6
|
+
formatDirectoryRules,
|
|
7
|
+
promptDirectoryRules,
|
|
8
|
+
saveReviewedDraft,
|
|
9
|
+
summarizeDirectoryRules
|
|
10
|
+
} from "./chunk-2JHAN3ZO.ts";
|
|
11
|
+
import {
|
|
12
|
+
localConfigPath
|
|
13
|
+
} from "./chunk-YQSFJLJ3.ts";
|
|
14
|
+
import {
|
|
15
|
+
captureMutationOwner
|
|
16
|
+
} from "./chunk-4SR3ZYHA.ts";
|
|
17
|
+
import {
|
|
18
|
+
updateSyncSetup
|
|
19
|
+
} from "./chunk-EMRFVLZM.ts";
|
|
20
|
+
import {
|
|
21
|
+
normalizeSyncExclude,
|
|
22
|
+
sameSyncExclude
|
|
23
|
+
} from "./chunk-HEB6YT64.ts";
|
|
24
|
+
import {
|
|
25
|
+
loadConfig,
|
|
26
|
+
syncCheckConfigFingerprint
|
|
27
|
+
} from "./chunk-277VHM2P.ts";
|
|
28
|
+
import {
|
|
29
|
+
safeTerminalText
|
|
30
|
+
} from "./chunk-2JNFEZ3V.ts";
|
|
31
|
+
|
|
32
|
+
// src/ui/excluded-paths-ui.ts
|
|
33
|
+
import { defineMenu, runMenu } from "@narumitw/pi-tui-kit";
|
|
34
|
+
async function showExcludedPaths(ctx, setupName, signal) {
|
|
35
|
+
const validate = captureMutationOwner(ctx, signal);
|
|
36
|
+
const isCurrent = () => {
|
|
37
|
+
try {
|
|
38
|
+
validate();
|
|
39
|
+
return true;
|
|
40
|
+
} catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
validate();
|
|
45
|
+
const config = await loadConfig(setupName);
|
|
46
|
+
validate();
|
|
47
|
+
if (config.scope === "agent-directory") return showDirectoryScope(ctx, config, signal);
|
|
48
|
+
if (ctx.mode !== "tui") {
|
|
49
|
+
if (ctx.hasUI)
|
|
50
|
+
ctx.ui.notify(
|
|
51
|
+
[
|
|
52
|
+
`Excluded paths: ${(config.exclude ?? []).map(safeTerminalText).join(", ") || "none"}`,
|
|
53
|
+
`Edit sync.exclude in ${safeTerminalText(localConfigPath())}; an explicit array requires settings version 6 or later.`
|
|
54
|
+
].join("\n"),
|
|
55
|
+
"info"
|
|
56
|
+
);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
let draft = JSON.stringify(config.exclude ?? []);
|
|
60
|
+
while (isCurrent()) {
|
|
61
|
+
const entered = await ctx.ui.input("Excluded paths \xB7 JSON array \xB7 empty input keeps draft", draft, { signal });
|
|
62
|
+
if (!isCurrent() || entered === void 0) return;
|
|
63
|
+
const input = entered || draft;
|
|
64
|
+
draft = input;
|
|
65
|
+
let exclude;
|
|
66
|
+
try {
|
|
67
|
+
const parsed = JSON.parse(input);
|
|
68
|
+
if (!Array.isArray(parsed)) throw new Error("Enter a JSON string array.");
|
|
69
|
+
exclude = normalizeSyncExclude(parsed);
|
|
70
|
+
} catch {
|
|
71
|
+
ctx.ui.notify("Invalid exclude array or unsupported pattern. No settings changed.", "error");
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (sameSyncExclude(exclude, config.exclude)) return;
|
|
75
|
+
let choice;
|
|
76
|
+
const menu = defineMenu({
|
|
77
|
+
start: "review",
|
|
78
|
+
screens: {
|
|
79
|
+
review: () => ({
|
|
80
|
+
kind: "actions",
|
|
81
|
+
title: "Review excluded paths",
|
|
82
|
+
lines: [
|
|
83
|
+
`Setup: ${safeTerminalText(config.setupName)}`,
|
|
84
|
+
"Draft only. Save requires at least settings version 6 and uses snapshot version 4 for this allowlist setup.",
|
|
85
|
+
"Excluded local files stay untouched. New snapshots omit matching remote files; old history is NOT erased.",
|
|
86
|
+
"Removing rules can expose local content or allow pull to replace it. Review a force push to publish policy changes.",
|
|
87
|
+
"Previously excluded:",
|
|
88
|
+
...config.exclude?.length ? config.exclude.map((rule) => `- ${safeTerminalText(rule)}`) : ["(none)"],
|
|
89
|
+
"Proposed excluded paths:",
|
|
90
|
+
...exclude.length ? exclude.map((rule) => `+ ${safeTerminalText(rule)}`) : ["(none)"]
|
|
91
|
+
],
|
|
92
|
+
items: [
|
|
93
|
+
{ id: "save", label: "Save changes", action: "choose" },
|
|
94
|
+
{ id: "discard", label: "Discard changes", action: "choose" },
|
|
95
|
+
{ id: "edit", label: "Continue editing", action: "choose" }
|
|
96
|
+
],
|
|
97
|
+
hint: "close"
|
|
98
|
+
})
|
|
99
|
+
},
|
|
100
|
+
actions: {
|
|
101
|
+
choose: async ({ itemId }) => {
|
|
102
|
+
choice = itemId === "save" ? "save" : itemId === "edit" ? "edit" : "discard";
|
|
103
|
+
return { kind: "close" };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
await runMenu(ctx, menu, { getState: () => void 0, signal, isCurrent });
|
|
108
|
+
if (!isCurrent()) return;
|
|
109
|
+
if (choice === "edit") continue;
|
|
110
|
+
if (choice !== "save") return;
|
|
111
|
+
try {
|
|
112
|
+
await updateSyncSetup(
|
|
113
|
+
setupName,
|
|
114
|
+
(setup) => {
|
|
115
|
+
validate();
|
|
116
|
+
return { ...setup, sync: { ...setup.sync, exclude } };
|
|
117
|
+
},
|
|
118
|
+
{ expectedConfigFingerprint: syncCheckConfigFingerprint(config), upgradeExclude: true, signal }
|
|
119
|
+
);
|
|
120
|
+
if (isCurrent()) ctx.ui.notify("Excluded paths saved. Applies to subsequent sync; no transfer started.", "info");
|
|
121
|
+
} catch (error) {
|
|
122
|
+
if (isCurrent())
|
|
123
|
+
ctx.ui.notify(
|
|
124
|
+
`Excluded paths not saved: ${safeTerminalText(error instanceof Error ? error.message : String(error))}`,
|
|
125
|
+
"error"
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function directoryScopeSummary(config) {
|
|
132
|
+
return [
|
|
133
|
+
`Setup: ${safeTerminalText(config.setupName)} \xB7 Scope: Pi agent directory`,
|
|
134
|
+
`Excluded paths: ${summarizeDirectoryRules(config.exclude)}`,
|
|
135
|
+
`Re-included paths: ${summarizeDirectoryRules(config.reinclude)}`,
|
|
136
|
+
`Session opt-in: ${config.include.includes("sessions") ? "On (path rules still apply)" : "Off"}`,
|
|
137
|
+
"Pi credentials and project trust always stay local."
|
|
138
|
+
];
|
|
139
|
+
}
|
|
140
|
+
async function showDirectoryScope(ctx, config, signal) {
|
|
141
|
+
const validate = captureMutationOwner(ctx, signal);
|
|
142
|
+
const isCurrent = () => {
|
|
143
|
+
try {
|
|
144
|
+
validate();
|
|
145
|
+
return true;
|
|
146
|
+
} catch {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
if (!isCurrent()) return;
|
|
151
|
+
if (ctx.mode !== "tui") {
|
|
152
|
+
if (ctx.hasUI)
|
|
153
|
+
ctx.ui.notify(
|
|
154
|
+
[
|
|
155
|
+
...directoryScopeSummary(config),
|
|
156
|
+
`Edit sync.exclude, sync.reinclude, and sync.sessions in ${safeTerminalText(localConfigPath())}.`
|
|
157
|
+
].join("\n"),
|
|
158
|
+
"info"
|
|
159
|
+
);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const original = {
|
|
163
|
+
exclude: config.exclude ?? [],
|
|
164
|
+
reinclude: config.reinclude ?? [],
|
|
165
|
+
sessions: config.include.includes("sessions")
|
|
166
|
+
};
|
|
167
|
+
const draft = { ...original };
|
|
168
|
+
const change = () => ({
|
|
169
|
+
exclude: !sameSyncExclude(draft.exclude, original.exclude),
|
|
170
|
+
reinclude: !sameSyncExclude(draft.reinclude, original.reinclude),
|
|
171
|
+
sessions: draft.sessions !== original.sessions
|
|
172
|
+
});
|
|
173
|
+
const menu = defineMenu(
|
|
174
|
+
{
|
|
175
|
+
start: "draft",
|
|
176
|
+
screens: {
|
|
177
|
+
draft: () => ({
|
|
178
|
+
kind: "actions",
|
|
179
|
+
title: `Agent directory scope \xB7 ${safeTerminalText(config.setupName)}`,
|
|
180
|
+
lines: [
|
|
181
|
+
"Changes stay in this draft until you review and save. Back discards the draft.",
|
|
182
|
+
"Session opt-in does not change path rules. Edit the rules separately to select which sessions can sync."
|
|
183
|
+
],
|
|
184
|
+
items: [
|
|
185
|
+
{ id: "exclude", label: `Edit excluded paths\u2026 (${draft.exclude.length})`, action: "exclude" },
|
|
186
|
+
{ id: "reinclude", label: `Edit re-included paths\u2026 (${draft.reinclude.length})`, action: "reinclude" },
|
|
187
|
+
{
|
|
188
|
+
id: "sessions",
|
|
189
|
+
label: `Session opt-in: ${draft.sessions ? "On \u2192 Off" : "Off \u2192 On"}`,
|
|
190
|
+
action: "sessions"
|
|
191
|
+
},
|
|
192
|
+
{ id: "review", label: "Review changes\u2026", action: "review" }
|
|
193
|
+
],
|
|
194
|
+
hint: "back"
|
|
195
|
+
})
|
|
196
|
+
},
|
|
197
|
+
actions: {
|
|
198
|
+
exclude: async ({ signal: actionSignal }) => editRules("exclude", actionSignal),
|
|
199
|
+
reinclude: async ({ signal: actionSignal }) => editRules("reinclude", actionSignal),
|
|
200
|
+
sessions: async ({ signal: actionSignal }) => {
|
|
201
|
+
if (!draft.sessions && !await acknowledgeSessions(ctx, actionSignal)) return { kind: "stay" };
|
|
202
|
+
if (actionSignal.aborted || !isCurrent()) return { kind: "close" };
|
|
203
|
+
draft.sessions = !draft.sessions;
|
|
204
|
+
return { kind: "stay" };
|
|
205
|
+
},
|
|
206
|
+
review: async ({ signal: actionSignal }) => {
|
|
207
|
+
const changed = change();
|
|
208
|
+
if (!changed.exclude && !changed.reinclude && !changed.sessions) return { kind: "close" };
|
|
209
|
+
try {
|
|
210
|
+
validate();
|
|
211
|
+
const saved = await saveReviewedDraft(
|
|
212
|
+
ctx,
|
|
213
|
+
"Review agent directory scope",
|
|
214
|
+
[
|
|
215
|
+
`Setup: ${safeTerminalText(config.setupName)}`,
|
|
216
|
+
"",
|
|
217
|
+
...directoryScopeLines(draft),
|
|
218
|
+
"",
|
|
219
|
+
...formatDirectoryRules("Previously excluded", original.exclude),
|
|
220
|
+
...formatDirectoryRules("Previously re-included", original.reinclude),
|
|
221
|
+
`Previous session opt-in: ${original.sessions ? "On" : "Off"}`,
|
|
222
|
+
"Changing rules can expose or replace files. Existing remote history is not erased.",
|
|
223
|
+
"A remote policy mismatch blocks transfer until reviewed. Saving does not start a transfer."
|
|
224
|
+
],
|
|
225
|
+
"Save changes",
|
|
226
|
+
(saveSignal) => updateSyncSetup(
|
|
227
|
+
config.setupName,
|
|
228
|
+
(setup) => {
|
|
229
|
+
validate();
|
|
230
|
+
if (setup.sync.scope !== "agent-directory") throw new Error("Sync scope changed during review.");
|
|
231
|
+
return {
|
|
232
|
+
...setup,
|
|
233
|
+
sync: {
|
|
234
|
+
...setup.sync,
|
|
235
|
+
...changed.exclude ? { exclude: draft.exclude } : {},
|
|
236
|
+
...changed.reinclude ? { reinclude: draft.reinclude } : {},
|
|
237
|
+
...changed.sessions ? { sessions: draft.sessions } : {}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
},
|
|
241
|
+
{ expectedConfigFingerprint: syncCheckConfigFingerprint(config), signal: saveSignal }
|
|
242
|
+
),
|
|
243
|
+
actionSignal
|
|
244
|
+
);
|
|
245
|
+
if (saved && !actionSignal.aborted && isCurrent())
|
|
246
|
+
ctx.ui.notify("Agent directory rules saved. Applies to subsequent sync; no transfer started.", "info");
|
|
247
|
+
} catch (error) {
|
|
248
|
+
if (!actionSignal.aborted && isCurrent())
|
|
249
|
+
ctx.ui.notify(
|
|
250
|
+
`Agent directory rules not saved: ${safeTerminalText(error instanceof Error ? error.message : String(error))}`,
|
|
251
|
+
"error"
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
return { kind: "close" };
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
);
|
|
259
|
+
const result = await runMenu(ctx, menu, { getState: () => void 0, signal, isCurrent });
|
|
260
|
+
if (result.kind === "error" && isCurrent()) throw result.error;
|
|
261
|
+
async function editRules(kind, actionSignal) {
|
|
262
|
+
const rules = await promptDirectoryRules(ctx, kind, draft[kind], actionSignal, validate);
|
|
263
|
+
if (actionSignal.aborted || !isCurrent()) return { kind: "close" };
|
|
264
|
+
if (rules) draft[kind] = rules;
|
|
265
|
+
return { kind: "stay" };
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export {
|
|
270
|
+
showExcludedPaths,
|
|
271
|
+
directoryScopeSummary,
|
|
272
|
+
showDirectoryScope
|
|
273
|
+
};
|
|
274
|
+
//# sourceMappingURL=chunk-2ZGV5KNC.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ui/excluded-paths-ui.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ExtensionCommandContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\nimport { loadConfig, syncCheckConfigFingerprint } from \"../settings/config.js\";\nimport { localConfigPath } from \"../settings/config-file.js\";\nimport { updateSyncSetup } from \"../settings/settings-management.js\";\nimport type { AnySyncConfig } from \"../settings/settings-types.js\";\nimport { normalizeSyncExclude, sameSyncExclude } from \"../sync/exclude-policy.js\";\nimport { captureMutationOwner } from \"../sync/sync-local.js\";\nimport {\n acknowledgeSessions,\n type DirectoryRulesDraft,\n directoryScopeLines,\n formatDirectoryRules,\n promptDirectoryRules,\n summarizeDirectoryRules,\n} from \"./setup/directory-rules.js\";\nimport { saveReviewedDraft } from \"./setup/setup-review.js\";\nimport { safeTerminalText } from \"./terminal-text.js\";\n\n/** Transactional draft; Pi owns editor input/paste and Kit owns review/cancellation. */\nexport async function showExcludedPaths(ctx: ExtensionCommandContext, setupName: string, signal?: AbortSignal) {\n const validate = captureMutationOwner(ctx, signal);\n const isCurrent = () => {\n try {\n validate();\n return true;\n } catch {\n return false;\n }\n };\n validate();\n const config = await loadConfig(setupName);\n validate();\n if (config.scope === \"agent-directory\") return showDirectoryScope(ctx, config, signal);\n if (ctx.mode !== \"tui\") {\n if (ctx.hasUI)\n ctx.ui.notify(\n [\n `Excluded paths: ${(config.exclude ?? []).map(safeTerminalText).join(\", \") || \"none\"}`,\n `Edit sync.exclude in ${safeTerminalText(localConfigPath())}; an explicit array requires settings version 6 or later.`,\n ].join(\"\\n\"),\n \"info\",\n );\n return;\n }\n let draft = JSON.stringify(config.exclude ?? []);\n while (isCurrent()) {\n const entered = await ctx.ui.input(\"Excluded paths \u00B7 JSON array \u00B7 empty input keeps draft\", draft, { signal });\n if (!isCurrent() || entered === undefined) return;\n const input = entered || draft;\n draft = input;\n let exclude: string[];\n try {\n const parsed: unknown = JSON.parse(input);\n if (!Array.isArray(parsed)) throw new Error(\"Enter a JSON string array.\");\n exclude = normalizeSyncExclude(parsed);\n } catch {\n ctx.ui.notify(\"Invalid exclude array or unsupported pattern. No settings changed.\", \"error\");\n continue;\n }\n if (sameSyncExclude(exclude, config.exclude)) return;\n let choice: \"save\" | \"discard\" | \"edit\" | undefined;\n const menu = defineMenu<undefined, \"review\", \"choose\", ExtensionCommandContext>({\n start: \"review\",\n screens: {\n review: () => ({\n kind: \"actions\",\n title: \"Review excluded paths\",\n lines: [\n `Setup: ${safeTerminalText(config.setupName)}`,\n \"Draft only. Save requires at least settings version 6 and uses snapshot version 4 for this allowlist setup.\",\n \"Excluded local files stay untouched. New snapshots omit matching remote files; old history is NOT erased.\",\n \"Removing rules can expose local content or allow pull to replace it. Review a force push to publish policy changes.\",\n \"Previously excluded:\",\n ...(config.exclude?.length ? config.exclude.map((rule) => `- ${safeTerminalText(rule)}`) : [\"(none)\"]),\n \"Proposed excluded paths:\",\n ...(exclude.length ? exclude.map((rule) => `+ ${safeTerminalText(rule)}`) : [\"(none)\"]),\n ],\n items: [\n { id: \"save\", label: \"Save changes\", action: \"choose\" },\n { id: \"discard\", label: \"Discard changes\", action: \"choose\" },\n { id: \"edit\", label: \"Continue editing\", action: \"choose\" },\n ],\n hint: \"close\",\n }),\n },\n actions: {\n choose: async ({ itemId }) => {\n choice = itemId === \"save\" ? \"save\" : itemId === \"edit\" ? \"edit\" : \"discard\";\n return { kind: \"close\" };\n },\n },\n });\n await runMenu(ctx, menu, { getState: () => undefined, signal, isCurrent });\n if (!isCurrent()) return;\n if (choice === \"edit\") continue;\n if (choice !== \"save\") return;\n try {\n await updateSyncSetup(\n setupName,\n (setup) => {\n validate();\n return { ...setup, sync: { ...setup.sync, exclude } };\n },\n { expectedConfigFingerprint: syncCheckConfigFingerprint(config), upgradeExclude: true, signal },\n );\n if (isCurrent()) ctx.ui.notify(\"Excluded paths saved. Applies to subsequent sync; no transfer started.\", \"info\");\n } catch (error) {\n if (isCurrent())\n ctx.ui.notify(\n `Excluded paths not saved: ${safeTerminalText(error instanceof Error ? error.message : String(error))}`,\n \"error\",\n );\n }\n return;\n }\n}\n\nexport function directoryScopeSummary(config: AnySyncConfig) {\n return [\n `Setup: ${safeTerminalText(config.setupName)} \u00B7 Scope: Pi agent directory`,\n `Excluded paths: ${summarizeDirectoryRules(config.exclude)}`,\n `Re-included paths: ${summarizeDirectoryRules(config.reinclude)}`,\n `Session opt-in: ${config.include.includes(\"sessions\") ? \"On (path rules still apply)\" : \"Off\"}`,\n \"Pi credentials and project trust always stay local.\",\n ];\n}\n\nexport async function showDirectoryScope(ctx: ExtensionCommandContext, config: AnySyncConfig, signal?: AbortSignal) {\n const validate = captureMutationOwner(ctx, signal);\n const isCurrent = () => {\n try {\n validate();\n return true;\n } catch {\n return false;\n }\n };\n if (!isCurrent()) return;\n if (ctx.mode !== \"tui\") {\n if (ctx.hasUI)\n ctx.ui.notify(\n [\n ...directoryScopeSummary(config),\n `Edit sync.exclude, sync.reinclude, and sync.sessions in ${safeTerminalText(localConfigPath())}.`,\n ].join(\"\\n\"),\n \"info\",\n );\n return;\n }\n const original: DirectoryRulesDraft = {\n exclude: config.exclude ?? [],\n reinclude: config.reinclude ?? [],\n sessions: config.include.includes(\"sessions\"),\n };\n const draft: DirectoryRulesDraft = { ...original };\n const change = () => ({\n exclude: !sameSyncExclude(draft.exclude, original.exclude),\n reinclude: !sameSyncExclude(draft.reinclude, original.reinclude),\n sessions: draft.sessions !== original.sessions,\n });\n const menu = defineMenu<undefined, \"draft\", \"exclude\" | \"reinclude\" | \"sessions\" | \"review\", ExtensionCommandContext>(\n {\n start: \"draft\",\n screens: {\n draft: () => ({\n kind: \"actions\",\n title: `Agent directory scope \u00B7 ${safeTerminalText(config.setupName)}`,\n lines: [\n \"Changes stay in this draft until you review and save. Back discards the draft.\",\n \"Session opt-in does not change path rules. Edit the rules separately to select which sessions can sync.\",\n ],\n items: [\n { id: \"exclude\", label: `Edit excluded paths\u2026 (${draft.exclude.length})`, action: \"exclude\" },\n { id: \"reinclude\", label: `Edit re-included paths\u2026 (${draft.reinclude.length})`, action: \"reinclude\" },\n {\n id: \"sessions\",\n label: `Session opt-in: ${draft.sessions ? \"On \u2192 Off\" : \"Off \u2192 On\"}`,\n action: \"sessions\",\n },\n { id: \"review\", label: \"Review changes\u2026\", action: \"review\" },\n ],\n hint: \"back\",\n }),\n },\n actions: {\n exclude: async ({ signal: actionSignal }) => editRules(\"exclude\", actionSignal),\n reinclude: async ({ signal: actionSignal }) => editRules(\"reinclude\", actionSignal),\n sessions: async ({ signal: actionSignal }) => {\n if (!draft.sessions && !(await acknowledgeSessions(ctx, actionSignal))) return { kind: \"stay\" };\n if (actionSignal.aborted || !isCurrent()) return { kind: \"close\" };\n draft.sessions = !draft.sessions;\n return { kind: \"stay\" };\n },\n review: async ({ signal: actionSignal }) => {\n const changed = change();\n if (!changed.exclude && !changed.reinclude && !changed.sessions) return { kind: \"close\" };\n try {\n validate();\n const saved = await saveReviewedDraft(\n ctx,\n \"Review agent directory scope\",\n [\n `Setup: ${safeTerminalText(config.setupName)}`,\n \"\",\n ...directoryScopeLines(draft),\n \"\",\n ...formatDirectoryRules(\"Previously excluded\", original.exclude),\n ...formatDirectoryRules(\"Previously re-included\", original.reinclude),\n `Previous session opt-in: ${original.sessions ? \"On\" : \"Off\"}`,\n \"Changing rules can expose or replace files. Existing remote history is not erased.\",\n \"A remote policy mismatch blocks transfer until reviewed. Saving does not start a transfer.\",\n ],\n \"Save changes\",\n (saveSignal) =>\n updateSyncSetup(\n config.setupName,\n (setup) => {\n validate();\n if (setup.sync.scope !== \"agent-directory\") throw new Error(\"Sync scope changed during review.\");\n return {\n ...setup,\n sync: {\n ...setup.sync,\n ...(changed.exclude ? { exclude: draft.exclude } : {}),\n ...(changed.reinclude ? { reinclude: draft.reinclude } : {}),\n ...(changed.sessions ? { sessions: draft.sessions } : {}),\n },\n };\n },\n { expectedConfigFingerprint: syncCheckConfigFingerprint(config), signal: saveSignal },\n ),\n actionSignal,\n );\n if (saved && !actionSignal.aborted && isCurrent())\n ctx.ui.notify(\"Agent directory rules saved. Applies to subsequent sync; no transfer started.\", \"info\");\n } catch (error) {\n if (!actionSignal.aborted && isCurrent())\n ctx.ui.notify(\n `Agent directory rules not saved: ${safeTerminalText(error instanceof Error ? error.message : String(error))}`,\n \"error\",\n );\n }\n return { kind: \"close\" };\n },\n },\n },\n );\n const result = await runMenu(ctx, menu, { getState: () => undefined, signal, isCurrent });\n if (result.kind === \"error\" && isCurrent()) throw result.error;\n\n async function editRules(kind: \"exclude\" | \"reinclude\", actionSignal: AbortSignal) {\n const rules = await promptDirectoryRules(ctx, kind, draft[kind], actionSignal, validate);\n if (actionSignal.aborted || !isCurrent()) return { kind: \"close\" as const };\n if (rules) draft[kind] = rules;\n return { kind: \"stay\" as const };\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,YAAY,eAAe;AAmBpC,eAAsB,kBAAkB,KAA8B,WAAmB,QAAsB;AAC7G,QAAM,WAAW,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