@narumitw/pi-sync 0.65.0 → 0.67.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 +13 -4
- package/dist/chunks/{chunk-OWEOZZZE.ts → chunk-5YOLQKNZ.ts} +38 -2
- package/dist/chunks/chunk-5YOLQKNZ.ts.map +7 -0
- package/dist/chunks/{chunk-OBVJTKVY.ts → chunk-ASU3GZPW.ts} +10 -92
- package/dist/chunks/chunk-ASU3GZPW.ts.map +7 -0
- package/dist/chunks/{chunk-IOM6E5FW.ts → chunk-BESRBKVO.ts} +2 -2
- package/dist/chunks/{chunk-TZMVSTAM.ts → chunk-BYVHABNR.ts} +4 -4
- package/dist/chunks/chunk-ECYCNZOE.ts +12 -0
- package/dist/chunks/chunk-ECYCNZOE.ts.map +7 -0
- package/dist/chunks/{chunk-MANNB4WZ.ts → chunk-KNEUL4XN.ts} +1 -7
- package/dist/chunks/chunk-KNEUL4XN.ts.map +7 -0
- package/dist/chunks/chunk-Z5JMOXJM.ts +106 -0
- package/dist/chunks/chunk-Z5JMOXJM.ts.map +7 -0
- package/dist/chunks/{command-handler-YZ4DXQ7N.ts → command-handler-SQC2L2FJ.ts} +9 -7
- package/dist/chunks/{command-handler-YZ4DXQ7N.ts.map → command-handler-SQC2L2FJ.ts.map} +1 -1
- package/dist/chunks/{file-selection-DDQN4LVD.ts → file-selection-XWACUTAH.ts} +8 -8
- package/dist/chunks/ignore-file-ui-OHFISFVC.ts +21 -0
- package/dist/chunks/{manager-result-dispatcher-XB75YLEG.ts → manager-result-dispatcher-WXE2BAQO.ts} +3 -3
- package/dist/chunks/{manager-ui-RGA26Z6G.ts → manager-ui-DWOMAJKE.ts} +170 -45
- package/dist/chunks/manager-ui-DWOMAJKE.ts.map +7 -0
- package/dist/chunks/{remote-selection-ui-WVMET5RI.ts → remote-selection-ui-E4XZCQ7A.ts} +2 -2
- package/dist/chunks/remote-selection-ui-E4XZCQ7A.ts.map +7 -0
- package/dist/chunks/{setup-wizard-YP2KF2WQ.ts → setup-wizard-IEW56AZE.ts} +7 -5
- package/dist/chunks/{setup-wizard-YP2KF2WQ.ts.map → setup-wizard-IEW56AZE.ts.map} +1 -1
- package/dist/daemon/dist/consent.js +14 -2
- package/dist/daemon/dist/engine/backends/git/git-backend.js +5 -3
- package/dist/daemon/dist/engine/backends/git/git-storage.js +15 -3
- package/dist/daemon/dist/engine/ignore/adoption-journal.js +143 -0
- package/dist/daemon/dist/engine/ignore/ignore-edit.js +2 -2
- package/dist/daemon/dist/engine/ignore/ignore-settings.js +2 -1
- package/dist/daemon/dist/engine/ignore/snapshot-ignore-rules.js +39 -0
- package/dist/daemon/dist/engine/settings/config-file.js +3 -0
- package/dist/daemon/dist/engine/settings/config.js +5 -5
- package/dist/daemon/dist/engine/settings/settings-management.js +6 -1
- package/dist/daemon/dist/engine/settings/settings-validation.js +21 -2
- package/dist/daemon/dist/engine/snapshot/snapshot-apply.js +2 -2
- package/dist/daemon/dist/engine/snapshot/snapshot-codec.js +6 -6
- package/dist/daemon/dist/engine/snapshot/snapshot-types.js +5 -1
- package/dist/daemon/dist/engine/snapshot/snapshot.js +5 -2
- package/dist/daemon/dist/engine/sync/conflict-review.js +2 -0
- package/dist/daemon/dist/engine/sync/continuous-errors.js +6 -0
- package/dist/daemon/dist/engine/sync/continuous-sync.js +4 -2
- package/dist/daemon/dist/engine/sync/continuous-watch.js +3 -2
- package/dist/daemon/dist/engine/sync/directional-action.js +3 -8
- package/dist/daemon/dist/engine/sync/ignore-adoption-recovery.js +50 -0
- package/dist/daemon/dist/engine/sync/ignore-adoption.js +410 -0
- package/dist/daemon/dist/engine/sync/ignore-publication.js +23 -0
- package/dist/daemon/dist/engine/sync/initialization.js +12 -0
- package/dist/daemon/dist/engine/sync/local-fields.js +6 -3
- package/dist/daemon/dist/engine/sync/merge-apply.js +18 -1
- package/dist/daemon/dist/engine/sync/merge-journal.js +2 -2
- package/dist/daemon/dist/engine/sync/merged-sync.js +50 -7
- package/dist/daemon/dist/engine/sync/push-review.js +33 -0
- package/dist/daemon/dist/engine/sync/sync-local.js +2 -1
- package/dist/daemon/dist/engine/sync/sync-mutations.js +108 -55
- package/dist/daemon/dist/engine/sync/sync-policy.js +5 -5
- package/dist/daemon/dist/engine/sync/sync-queries.js +1 -1
- package/dist/daemon/dist/engine/sync/sync-rollback.js +25 -5
- package/dist/daemon/dist/engine/sync/transfer-freshness.js +3 -2
- package/dist/daemon/dist/engine/sync/transfer-size-limits.js +92 -0
- package/dist/daemon/dist/engine/ui/ignore-rule-preview.js +18 -0
- package/dist/daemon/dist/engine-service.js +1 -1
- package/dist/daemon/package.json +1 -1
- package/dist/index.ts +1 -1
- package/docs/daemon-migration.md +6 -0
- package/docs/tui-contract.md +6 -5
- package/package.json +2 -2
- package/skills/configure-pi-sync/SKILL.md +1 -1
- package/skills/configure-pi-sync/references/configuration.md +43 -14
- package/src/ui/ignore-file-ui.ts +13 -5
- package/src/ui/manager-state.ts +15 -8
- package/src/ui/manager-ui.ts +1 -1
- package/src/ui/remote-selection-ui.ts +43 -2
- package/src/ui/settings-ui.ts +156 -32
- package/dist/chunks/chunk-MANNB4WZ.ts.map +0 -7
- package/dist/chunks/chunk-OBVJTKVY.ts.map +0 -7
- package/dist/chunks/chunk-OWEOZZZE.ts.map +0 -7
- package/dist/chunks/manager-ui-RGA26Z6G.ts.map +0 -7
- /package/dist/chunks/{chunk-IOM6E5FW.ts.map → chunk-BESRBKVO.ts.map} +0 -0
- /package/dist/chunks/{chunk-TZMVSTAM.ts.map → chunk-BYVHABNR.ts.map} +0 -0
- /package/dist/chunks/{file-selection-DDQN4LVD.ts.map → file-selection-XWACUTAH.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-XB75YLEG.ts.map → ignore-file-ui-OHFISFVC.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-WVMET5RI.ts.map → manager-result-dispatcher-WXE2BAQO.ts.map} +0 -0
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
3
|
import {
|
|
4
4
|
showDirectoryScope
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BYVHABNR.ts";
|
|
6
|
+
import {
|
|
7
|
+
manualIgnoreFileGuidance
|
|
8
|
+
} from "./chunk-EJDDRS6O.ts";
|
|
6
9
|
import "./chunk-JREGWM2B.ts";
|
|
10
|
+
import {
|
|
11
|
+
localConfigPath
|
|
12
|
+
} from "./chunk-IBXEM35O.ts";
|
|
7
13
|
import {
|
|
8
14
|
updateSyncSetup
|
|
9
15
|
} from "./chunk-NXWHPVXR.ts";
|
|
10
16
|
import {
|
|
11
17
|
captureMutationOwner
|
|
12
18
|
} from "./chunk-GELYN4UC.ts";
|
|
13
|
-
import {
|
|
14
|
-
manualIgnoreFileGuidance
|
|
15
|
-
} from "./chunk-EJDDRS6O.ts";
|
|
16
|
-
import {
|
|
17
|
-
localConfigPath
|
|
18
|
-
} from "./chunk-IBXEM35O.ts";
|
|
19
19
|
import {
|
|
20
20
|
agentDir
|
|
21
21
|
} from "./chunk-P4GI7LTT.ts";
|
|
@@ -300,4 +300,4 @@ function safeTerminalText(value) {
|
|
|
300
300
|
export {
|
|
301
301
|
showFileSelection
|
|
302
302
|
};
|
|
303
|
-
//# sourceMappingURL=file-selection-
|
|
303
|
+
//# sourceMappingURL=file-selection-XWACUTAH.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
ignoreFileSettingsAvailable,
|
|
5
|
+
portableIgnoreRulesAvailable,
|
|
6
|
+
showIgnoreFileAction
|
|
7
|
+
} from "./chunk-Z5JMOXJM.ts";
|
|
8
|
+
import "./chunk-KNEUL4XN.ts";
|
|
9
|
+
import "./chunk-AYGMIMCV.ts";
|
|
10
|
+
import "./chunk-GELYN4UC.ts";
|
|
11
|
+
import "./chunk-JQ5BAWW2.ts";
|
|
12
|
+
import "./chunk-H7VOTY5N.ts";
|
|
13
|
+
import "./chunk-6YKOHBSC.ts";
|
|
14
|
+
import "./chunk-R3SAMXB6.ts";
|
|
15
|
+
import "./chunk-2JNFEZ3V.ts";
|
|
16
|
+
export {
|
|
17
|
+
ignoreFileSettingsAvailable,
|
|
18
|
+
portableIgnoreRulesAvailable,
|
|
19
|
+
showIgnoreFileAction
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=ignore-file-ui-OHFISFVC.ts.map
|
package/dist/chunks/{manager-result-dispatcher-XB75YLEG.ts → manager-result-dispatcher-WXE2BAQO.ts}
RENAMED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
|
|
3
3
|
import {
|
|
4
4
|
dispatchManagerResult
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-BESRBKVO.ts";
|
|
6
|
+
import "./chunk-5YOLQKNZ.ts";
|
|
7
7
|
import "./chunk-UMPA5S7X.ts";
|
|
8
8
|
import "./chunk-AYGMIMCV.ts";
|
|
9
9
|
import "./chunk-NXWHPVXR.ts";
|
|
@@ -17,4 +17,4 @@ import "./chunk-2JNFEZ3V.ts";
|
|
|
17
17
|
export {
|
|
18
18
|
dispatchManagerResult
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=manager-result-dispatcher-
|
|
20
|
+
//# sourceMappingURL=manager-result-dispatcher-WXE2BAQO.ts.map
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
applyS3CredentialUpdate,
|
|
5
5
|
chooseS3CredentialUpdate,
|
|
6
6
|
chooseS3Credentials,
|
|
7
|
-
ignoreFileSettingsAvailable,
|
|
8
7
|
promptResourceName,
|
|
9
8
|
refreshTargetCompletions,
|
|
10
9
|
requiredInput,
|
|
@@ -18,13 +17,20 @@ import {
|
|
|
18
17
|
showEditGitTarget,
|
|
19
18
|
showEditS3Target,
|
|
20
19
|
showEditWebDavStorageProfile,
|
|
21
|
-
showEditWebDavTarget
|
|
20
|
+
showEditWebDavTarget
|
|
21
|
+
} from "./chunk-ASU3GZPW.ts";
|
|
22
|
+
import {
|
|
23
|
+
automaticSyncSummary
|
|
24
|
+
} from "./chunk-ECYCNZOE.ts";
|
|
25
|
+
import {
|
|
26
|
+
ignoreFileSettingsAvailable,
|
|
22
27
|
showIgnoreFileAction
|
|
23
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-Z5JMOXJM.ts";
|
|
29
|
+
import "./chunk-KNEUL4XN.ts";
|
|
24
30
|
import {
|
|
25
31
|
dispatchManagerResult
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import "./chunk-
|
|
32
|
+
} from "./chunk-BESRBKVO.ts";
|
|
33
|
+
import "./chunk-5YOLQKNZ.ts";
|
|
28
34
|
import {
|
|
29
35
|
SETUP_SWITCH_ACTION_OPTIONS,
|
|
30
36
|
saveOnSwitch,
|
|
@@ -38,9 +44,6 @@ import {
|
|
|
38
44
|
ownRecord,
|
|
39
45
|
validateSettingsDocument
|
|
40
46
|
} from "./chunk-APZVJAEW.ts";
|
|
41
|
-
import {
|
|
42
|
-
automaticSyncSummary
|
|
43
|
-
} from "./chunk-MANNB4WZ.ts";
|
|
44
47
|
import {
|
|
45
48
|
loadOnSwitch,
|
|
46
49
|
readLocalConfigObject,
|
|
@@ -74,11 +77,19 @@ import {
|
|
|
74
77
|
import {
|
|
75
78
|
directoryScopeSummary,
|
|
76
79
|
showExcludedPaths
|
|
77
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-BYVHABNR.ts";
|
|
81
|
+
import {
|
|
82
|
+
manualIgnoreFileGuidance
|
|
83
|
+
} from "./chunk-EJDDRS6O.ts";
|
|
78
84
|
import {
|
|
79
85
|
directorySessionOptInLine,
|
|
80
86
|
saveReviewedDraft
|
|
81
87
|
} from "./chunk-JREGWM2B.ts";
|
|
88
|
+
import {
|
|
89
|
+
localConfigPath,
|
|
90
|
+
readActiveLocalConfigDocumentForRepair,
|
|
91
|
+
syncErrorGuidance
|
|
92
|
+
} from "./chunk-IBXEM35O.ts";
|
|
82
93
|
import {
|
|
83
94
|
addStorageConnection,
|
|
84
95
|
removeStorageConnection,
|
|
@@ -89,14 +100,6 @@ import {
|
|
|
89
100
|
import {
|
|
90
101
|
captureMutationOwner
|
|
91
102
|
} from "./chunk-GELYN4UC.ts";
|
|
92
|
-
import {
|
|
93
|
-
manualIgnoreFileGuidance
|
|
94
|
-
} from "./chunk-EJDDRS6O.ts";
|
|
95
|
-
import {
|
|
96
|
-
localConfigPath,
|
|
97
|
-
readActiveLocalConfigDocumentForRepair,
|
|
98
|
-
syncErrorGuidance
|
|
99
|
-
} from "./chunk-IBXEM35O.ts";
|
|
100
103
|
import {
|
|
101
104
|
sameSyncExclude
|
|
102
105
|
} from "./chunk-ZO52JM4H.ts";
|
|
@@ -221,7 +224,7 @@ function blockedSyncMenuItem(label, manager) {
|
|
|
221
224
|
};
|
|
222
225
|
}
|
|
223
226
|
async function showManagerAttention(ctx, attention, runRoute, signal, onSelectionResolved) {
|
|
224
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
227
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-E4XZCQ7A.ts");
|
|
225
228
|
if (signal?.aborted) return "close";
|
|
226
229
|
const review = await showRemoteSelectionReview(ctx, attention.decision.setupName, signal, void 0, {
|
|
227
230
|
decision: attention.decision,
|
|
@@ -634,11 +637,14 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
|
|
|
634
637
|
"Manage sync",
|
|
635
638
|
`Current sync setup: ${safeTerminalText(config.setupName)}`,
|
|
636
639
|
`Storage: ${backendStorageDescription(config)}`,
|
|
637
|
-
...config.pathPolicy === "ignore-file" ? [
|
|
640
|
+
...config.pathPolicy === "ignore-file" ? [
|
|
641
|
+
`Sync scope: Pi agent directory \xB7 ignore file: ${safeTerminalText(config.ignoreFile ?? ".syncignore")}`,
|
|
642
|
+
...config.ignorePolicy?.matches(config.ignorePolicy.filename) === false ? ["New snapshots include this rule file and its comments in remote history."] : []
|
|
643
|
+
] : config.scope ? ["Sync scope: Pi agent directory, with exclusions"] : [],
|
|
638
644
|
...syncState?.unresolved?.length ? [`Unresolved: ${syncState.unresolved.length} dependency groups \xB7 review needed`] : [],
|
|
639
645
|
...currentAttention ? [
|
|
640
646
|
currentAttention.decision.setupName === config.setupName ? "Sync status: Review needed" : `Sync status: Review needed for setup ${safeTerminalText(currentAttention.decision.setupName)}`,
|
|
641
|
-
attentionDirectoryPolicy ? "Sync scopes or directory rules differ." : attentionComparison?.remoteOnly.length === 0 && attentionComparison.localOnly.length === 0 ? attentionExclusionsDiffer ? "Synced-content exclusion rules differ." : "Only the synced-content order differs." : `Remote-only paths: ${attentionComparison?.remoteOnly.length ?? 0} \xB7 Device-only paths: ${attentionComparison?.localOnly.length ?? 0}${attentionExclusionsDiffer ? " \xB7 Exclusion rules differ." : ""}`
|
|
647
|
+
currentAttention.decision.ignorePolicyComparison ? "Ignore-file policies differ." : attentionDirectoryPolicy ? "Sync scopes or directory rules differ." : attentionComparison?.remoteOnly.length === 0 && attentionComparison.localOnly.length === 0 ? attentionExclusionsDiffer ? "Synced-content exclusion rules differ." : "Only the synced-content order differs." : `Remote-only paths: ${attentionComparison?.remoteOnly.length ?? 0} \xB7 Device-only paths: ${attentionComparison?.localOnly.length ?? 0}${attentionExclusionsDiffer ? " \xB7 Exclusion rules differ." : ""}`
|
|
642
648
|
] : currentObservation ? [`Observed ${safeTerminalText(currentObservation.checkedAt)}: ${observationSummary(currentObservation)}`] : ["Remote status: Not checked"],
|
|
643
649
|
`Last applied: ${lastAppliedSnapshot}`,
|
|
644
650
|
...config.agentMode ? ["Auto-apply: On \xB7 AI requests may incur costs"] : config.automaticTransfer || config.automatic && syncSessionsSelected(config) ? ["Automatic transfer permission: On \xB7 see Settings"] : [],
|
|
@@ -768,6 +774,7 @@ function backendStorageDescription(config) {
|
|
|
768
774
|
}
|
|
769
775
|
|
|
770
776
|
// src/ui/settings-ui.ts
|
|
777
|
+
import { isKeyRelease, Key, matchesKey } from "@earendil-works/pi-tui";
|
|
771
778
|
import { defineMenu as defineMenu4, runMenu as runMenu4 } from "@narumitw/pi-tui-kit";
|
|
772
779
|
|
|
773
780
|
// src/sync/local-fields.ts
|
|
@@ -1478,6 +1485,18 @@ async function showRemoveTarget(ctx, name, signal) {
|
|
|
1478
1485
|
}
|
|
1479
1486
|
|
|
1480
1487
|
// src/ui/settings-ui.ts
|
|
1488
|
+
var transferSizeLimits = [
|
|
1489
|
+
{
|
|
1490
|
+
field: "maxFileSizeMiB",
|
|
1491
|
+
label: "Max file size",
|
|
1492
|
+
description: "Block a transfer when an included file exceeds this uncompressed size."
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
field: "maxDirectorySizeMiB",
|
|
1496
|
+
label: "Max directory size",
|
|
1497
|
+
description: "Block a transfer when a directory below the sync root exceeds this total uncompressed size, counting included files in its subdirectories too."
|
|
1498
|
+
}
|
|
1499
|
+
];
|
|
1481
1500
|
async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
1482
1501
|
let disposition = "back";
|
|
1483
1502
|
const exitSettings = () => {
|
|
@@ -1510,6 +1529,10 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1510
1529
|
[
|
|
1511
1530
|
document === null ? "Could not read the active pi-sync settings file. Check file access or repair the JSON before reopening /sync." : `Edit pi-sync settings manually: ${safeTerminalText(settingsPath)}`,
|
|
1512
1531
|
...limited ? [IGNORE_SETUP_MANAGEMENT_LIMIT, ...ignoreSetupRecovery(settingsPath)] : [],
|
|
1532
|
+
...!limited && config ? [
|
|
1533
|
+
"In the active entry in syncSetups, set sync.maxFileSizeMiB or sync.maxDirectorySizeMiB to a positive whole number of MiB with a safe byte count. Remove a field to turn that limit Off.",
|
|
1534
|
+
"A limit requires settings version 9. Upgrade all Pi Sync clients and daemons that share this agent directory before enabling a limit. Keep version 9 even if both limits are later Off."
|
|
1535
|
+
] : [],
|
|
1513
1536
|
...!limited && config?.reservedIgnoreNames !== void 0 ? ["Use TUI Settings \u2192 Review automatic transfers to approve the current setup separately."] : [],
|
|
1514
1537
|
...config?.pathPolicy === "ignore-file" ? [manualIgnoreFileGuidance(config.ignoreFile ?? ".syncignore")] : config?.scope === "agent-directory" ? directoryScopeSummary(config) : []
|
|
1515
1538
|
].join("\n"),
|
|
@@ -1547,7 +1570,6 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1547
1570
|
const ignoreAvailable = await ignoreFileSettingsAvailable(ctx, signal);
|
|
1548
1571
|
if (!isCurrent()) return disposition;
|
|
1549
1572
|
const setupName = initial.setupName;
|
|
1550
|
-
let saveStatus = "Simple choices save immediately. Back does not undo saved changes.";
|
|
1551
1573
|
const menu = defineMenu4({
|
|
1552
1574
|
start: "settings",
|
|
1553
1575
|
screens: {
|
|
@@ -1556,7 +1578,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1556
1578
|
title: "Pi Sync Settings",
|
|
1557
1579
|
lines: [
|
|
1558
1580
|
`Setup: ${safeTerminalText(state.setupName)} \xB7 Connection: ${safeTerminalText(state.connectionName)}`,
|
|
1559
|
-
...state.reservedIgnoreNames !== void 0 && !ignoreAvailable ? ["Setup preferences are read-only; adding, editing, and switching setups are unavailable."] : [
|
|
1581
|
+
...state.reservedIgnoreNames !== void 0 && !ignoreAvailable ? ["Setup preferences are read-only; adding, editing, and switching setups are unavailable."] : ["Back does not undo saved changes."],
|
|
1560
1582
|
...state.pathPolicy === "ignore-file" ? [manualIgnoreFileGuidance(state.ignoreFile ?? ".syncignore")] : []
|
|
1561
1583
|
],
|
|
1562
1584
|
items: [
|
|
@@ -1617,6 +1639,13 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1617
1639
|
currentValue: `${state.localFields?.length ?? 0} fields \xB7 Edit`,
|
|
1618
1640
|
action: "local-fields"
|
|
1619
1641
|
},
|
|
1642
|
+
...transferSizeLimits.map(({ field, label, description }) => ({
|
|
1643
|
+
id: field,
|
|
1644
|
+
label,
|
|
1645
|
+
description: `This setup: ${description} Also applies to automatic transfers. Saving starts no transfer.`,
|
|
1646
|
+
currentValue: transferSizeLimitLabel(state[field]),
|
|
1647
|
+
action: field
|
|
1648
|
+
})),
|
|
1620
1649
|
{
|
|
1621
1650
|
id: "storageLocation",
|
|
1622
1651
|
label: "Storage location",
|
|
@@ -1733,6 +1762,8 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1733
1762
|
})
|
|
1734
1763
|
},
|
|
1735
1764
|
actions: {
|
|
1765
|
+
maxFileSizeMiB: transferSizeLimitAction(transferSizeLimits[0]),
|
|
1766
|
+
maxDirectorySizeMiB: transferSizeLimitAction(transferSizeLimits[1]),
|
|
1736
1767
|
"storage-location": async ({ signal: actionSignal }) => {
|
|
1737
1768
|
const editorSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
1738
1769
|
await showEditSyncSetupStorage(ctx, setupName, editorSignal);
|
|
@@ -1758,7 +1789,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1758
1789
|
const partialSync = value === "Partial only" || value === "Merge + partial";
|
|
1759
1790
|
if (!await ctx.ui.confirm(
|
|
1760
1791
|
"Save content policy?",
|
|
1761
|
-
`${previous.pathPolicy === "ignore-file" ?
|
|
1792
|
+
`${previous.pathPolicy === "ignore-file" ? `Ignore-file policy keeps settings version ${previous.settingsVersion} and publishes snapshot version 7; upgrade older clients first.` : previous.scope === "agent-directory" ? "Agent directory scope uses snapshot version 5; older clients must refuse it." : "This explicitly upgrades settings to at least version 5; partial snapshots use version 3, or version 4 with exclusions, and older clients must refuse them."} Text/session merge is conservative. Partial sync preserves withheld versions and old baselines. Disabling does not clear unresolved groups or recovery evidence. Review a directional migration first if portable policy changes.`,
|
|
1762
1793
|
{ signal: mutationSignal }
|
|
1763
1794
|
))
|
|
1764
1795
|
return { kind: "rejected" };
|
|
@@ -1779,8 +1810,10 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1779
1810
|
};
|
|
1780
1811
|
}, mutationSignal);
|
|
1781
1812
|
validate();
|
|
1782
|
-
|
|
1783
|
-
|
|
1813
|
+
ctx.ui.notify(
|
|
1814
|
+
"Saved reviewed policy for this setup. Applies to subsequent sync operations; recovery evidence is retained.",
|
|
1815
|
+
"info"
|
|
1816
|
+
);
|
|
1784
1817
|
return { kind: "stay" };
|
|
1785
1818
|
} catch (error) {
|
|
1786
1819
|
if (!mutationSignal.aborted) notifySaveFailure(ctx, error);
|
|
@@ -1826,7 +1859,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1826
1859
|
if (sameLocalFields(previous.localFields, fields)) return { kind: "stay" };
|
|
1827
1860
|
const confirmed = await ctx.ui.confirm(
|
|
1828
1861
|
"Save portable field policy?",
|
|
1829
|
-
`${previous.pathPolicy === "ignore-file" ?
|
|
1862
|
+
`${previous.pathPolicy === "ignore-file" ? `Ignore-file policy keeps settings version ${previous.settingsVersion} and publishes snapshot version 7.` : previous.scope === "agent-directory" ? "Agent directory scope uses snapshot version 5." : "This opts into at least settings/snapshot version 4/2; exclude-enabled setups retain snapshot version 4."} Older clients must refuse unsupported formats. Future snapshots omit these fields, but old remote history is NOT erased. Review an explicit force push/pull migration before further sync. Removed rules can expose or replace local-only values.`,
|
|
1830
1863
|
{ signal: mutationSignal }
|
|
1831
1864
|
);
|
|
1832
1865
|
validate();
|
|
@@ -1847,8 +1880,10 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1847
1880
|
};
|
|
1848
1881
|
}, mutationSignal);
|
|
1849
1882
|
validate();
|
|
1850
|
-
|
|
1851
|
-
|
|
1883
|
+
ctx.ui.notify(
|
|
1884
|
+
"Saved reviewed policy for this setup. Applies to subsequent sync operations; recovery evidence is retained.",
|
|
1885
|
+
"info"
|
|
1886
|
+
);
|
|
1852
1887
|
return { kind: "stay" };
|
|
1853
1888
|
} catch (error) {
|
|
1854
1889
|
if (!mutationSignal.aborted) notifySaveFailure(ctx, error);
|
|
@@ -1866,10 +1901,6 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1866
1901
|
signal: mutationSignal
|
|
1867
1902
|
});
|
|
1868
1903
|
if (mutationSignal.aborted) return { kind: "rejected" };
|
|
1869
|
-
ctx.ui.notify(
|
|
1870
|
-
`Automatic sync ${automatic ? "enabled" : "disabled"} for \u201C${safeTerminalText(setupName)}\u201D.`,
|
|
1871
|
-
"info"
|
|
1872
|
-
);
|
|
1873
1904
|
return { kind: "stay" };
|
|
1874
1905
|
} catch (error) {
|
|
1875
1906
|
if (!mutationSignal.aborted) notifySaveFailure(ctx, error);
|
|
@@ -1934,10 +1965,6 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1934
1965
|
signal: mutationSignal
|
|
1935
1966
|
});
|
|
1936
1967
|
if (mutationSignal.aborted) return { kind: "rejected" };
|
|
1937
|
-
ctx.ui.notify(
|
|
1938
|
-
`Automatic startup transfer ${automaticTransfer ? "enabled for the next session start" : "disabled"}. Completed transfers are not undone.`,
|
|
1939
|
-
"info"
|
|
1940
|
-
);
|
|
1941
1968
|
return { kind: "stay" };
|
|
1942
1969
|
} catch (error) {
|
|
1943
1970
|
if (!mutationSignal.aborted) notifySaveFailure(ctx, error);
|
|
@@ -1953,7 +1980,6 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1953
1980
|
if (latest.skipSecretScan === skipSecretScan) return { kind: "stay" };
|
|
1954
1981
|
await updateLocalConfig((settings) => ({ ...settings, skipSecretScan }), mutationSignal);
|
|
1955
1982
|
if (mutationSignal.aborted) return { kind: "rejected" };
|
|
1956
|
-
ctx.ui.notify(`Secret scan ${skipSecretScan ? "disabled" : "enabled"} for pushes in all setups.`, "info");
|
|
1957
1983
|
return { kind: "stay" };
|
|
1958
1984
|
} catch (error) {
|
|
1959
1985
|
if (!mutationSignal.aborted) notifySaveFailure(ctx, error);
|
|
@@ -1970,7 +1996,6 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1970
1996
|
await updateLocalConfig((settings) => ({ ...settings, showStatus }), mutationSignal);
|
|
1971
1997
|
if (mutationSignal.aborted) return { kind: "rejected" };
|
|
1972
1998
|
configureSyncStatus(ctx, showStatus);
|
|
1973
|
-
ctx.ui.notify(`Pi Sync status ${showStatus ? "enabled" : "disabled"} for all setups.`, "info");
|
|
1974
1999
|
return { kind: "stay" };
|
|
1975
2000
|
} catch (error) {
|
|
1976
2001
|
if (!mutationSignal.aborted) notifySaveFailure(ctx, error);
|
|
@@ -1999,7 +2024,6 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1999
2024
|
if (latest.onSwitch === action) return { kind: "stay" };
|
|
2000
2025
|
await saveOnSwitch(action, mutationSignal);
|
|
2001
2026
|
if (mutationSignal.aborted) return { kind: "rejected" };
|
|
2002
|
-
ctx.ui.notify(`After switching setup: ${value}.`, "info");
|
|
2003
2027
|
return { kind: "stay" };
|
|
2004
2028
|
} catch (error) {
|
|
2005
2029
|
if (!mutationSignal.aborted) notifySaveFailure(ctx, error);
|
|
@@ -2048,7 +2072,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
2048
2072
|
"remote-include": async ({ state, signal: actionSignal }) => {
|
|
2049
2073
|
if (state.reservedIgnoreNames !== void 0 && !ignoreAvailable) return { kind: "rejected" };
|
|
2050
2074
|
const reviewSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
2051
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
2075
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-E4XZCQ7A.ts");
|
|
2052
2076
|
if (reviewSignal.aborted) return { kind: "rejected" };
|
|
2053
2077
|
const review = await showRemoteSelectionReview(ctx, setupName, reviewSignal, void 0, {
|
|
2054
2078
|
origin: "settings",
|
|
@@ -2080,11 +2104,100 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
2080
2104
|
const result = await save(action);
|
|
2081
2105
|
if (action.signal.aborted || signal?.aborted) return { kind: "rejected" };
|
|
2082
2106
|
validate();
|
|
2083
|
-
|
|
2084
|
-
|
|
2107
|
+
if (result?.kind === "stay") {
|
|
2108
|
+
const { value, state } = action;
|
|
2109
|
+
const enabled = value === "On";
|
|
2110
|
+
const setup = safeTerminalText(setupName);
|
|
2111
|
+
const approval = enabled && state.reservedIgnoreNames !== void 0 ? " Use Review automatic transfers to approve this policy separately." : "";
|
|
2112
|
+
const message = {
|
|
2113
|
+
automatic: `Automatic sync for \u201C${setup}\u201D: ${value}.${enabled ? " New startup checks begin next session." : ""}${approval}`,
|
|
2114
|
+
"automatic-transfer": `Startup transfer for \u201C${setup}\u201D: ${value}.${enabled ? " Applies at the next session start." : ""}${approval}`,
|
|
2115
|
+
"merge-settings": `Merge settings fields for \u201C${setup}\u201D: ${value}. Applies to subsequent sync operations.`,
|
|
2116
|
+
"skip-secret-scan": `Secret scan ${enabled ? "disabled" : "enabled"} for subsequent pushes in all setups.`,
|
|
2117
|
+
"show-status": `Show sync status: ${value}. Applies immediately to all setups.`,
|
|
2118
|
+
debug: `Debug mode: ${value}. Pi applies it at the next session start.`,
|
|
2119
|
+
"on-switch": `On setup switch: ${value}.${state.reservedIgnoreNames !== void 0 ? " Switching still won't pull while any setup uses an ignore file." : ""}`
|
|
2120
|
+
}[id];
|
|
2121
|
+
ctx.ui.notify(`Saved. ${message}`, "info");
|
|
2122
|
+
}
|
|
2085
2123
|
return result;
|
|
2086
2124
|
};
|
|
2087
2125
|
}
|
|
2126
|
+
function transferSizeLimitAction({ field, label }) {
|
|
2127
|
+
return async ({ state, signal: actionSignal }) => {
|
|
2128
|
+
const cancel = new AbortController();
|
|
2129
|
+
const mutationSignal = AbortSignal.any([actionSignal, cancel.signal, ...signal ? [signal] : []]);
|
|
2130
|
+
const validate = captureMutationOwner(ctx, mutationSignal);
|
|
2131
|
+
const rejected = { kind: "rejected" };
|
|
2132
|
+
const stay = { kind: "stay" };
|
|
2133
|
+
const setupLabel = safeTerminalText(setupName);
|
|
2134
|
+
let limit;
|
|
2135
|
+
try {
|
|
2136
|
+
const expectedConfigFingerprint = syncCheckConfigFingerprint(state);
|
|
2137
|
+
const active = await loadSettingsConfig();
|
|
2138
|
+
validate();
|
|
2139
|
+
if (active.setupName !== setupName || syncCheckConfigFingerprint(active) !== expectedConfigFingerprint) {
|
|
2140
|
+
throw new Error("Current sync setup changed while Settings was open; reopen Settings.");
|
|
2141
|
+
}
|
|
2142
|
+
const stop = ctx.ui.onTerminalInput((data) => {
|
|
2143
|
+
if (!isKeyRelease(data) && matchesKey(data, Key.ctrl("c"))) {
|
|
2144
|
+
cancel.abort();
|
|
2145
|
+
return { consume: true };
|
|
2146
|
+
}
|
|
2147
|
+
});
|
|
2148
|
+
try {
|
|
2149
|
+
const input = await ctx.ui.input(
|
|
2150
|
+
`${label} for \u201C${setupLabel}\u201D (current: ${transferSizeLimitLabel(state[field])})
|
|
2151
|
+
Enter Off or a positive whole number of MiB.`,
|
|
2152
|
+
void 0,
|
|
2153
|
+
{ signal: mutationSignal }
|
|
2154
|
+
);
|
|
2155
|
+
validate();
|
|
2156
|
+
if (input === void 0) return rejected;
|
|
2157
|
+
limit = parseTransferSizeLimit(input);
|
|
2158
|
+
if (limit === state[field]) return stay;
|
|
2159
|
+
if (limit !== void 0 && active.settingsVersion < 9) {
|
|
2160
|
+
const confirmed = await ctx.ui.confirm(
|
|
2161
|
+
"Upgrade Pi Sync settings to version 9?",
|
|
2162
|
+
`${label} for \u201C${setupLabel}\u201D: ${transferSizeLimitLabel(limit)}. Older Pi Sync clients and daemons cannot read this settings file for any setup. Upgrade all processes that share this agent directory before continuing. Turning both limits Off later does not downgrade the file. Remote snapshots are unchanged.`,
|
|
2163
|
+
{ signal: mutationSignal }
|
|
2164
|
+
);
|
|
2165
|
+
validate();
|
|
2166
|
+
if (!confirmed) return rejected;
|
|
2167
|
+
}
|
|
2168
|
+
} finally {
|
|
2169
|
+
stop();
|
|
2170
|
+
}
|
|
2171
|
+
validate();
|
|
2172
|
+
ctx.ui.notify("Saving Pi Sync setting\u2026", "info");
|
|
2173
|
+
await updateSyncSetup(
|
|
2174
|
+
setupName,
|
|
2175
|
+
(setup) => {
|
|
2176
|
+
validate();
|
|
2177
|
+
if (limit === void 0) delete setup.sync[field];
|
|
2178
|
+
else setup.sync[field] = limit;
|
|
2179
|
+
return setup;
|
|
2180
|
+
},
|
|
2181
|
+
{ expectedActiveSetup: true, expectedConfigFingerprint, signal: mutationSignal }
|
|
2182
|
+
);
|
|
2183
|
+
} catch (error) {
|
|
2184
|
+
if (cancel.signal.aborted) return exitSettings();
|
|
2185
|
+
if (!mutationSignal.aborted && isCurrent()) notifySaveFailure(ctx, error);
|
|
2186
|
+
return rejected;
|
|
2187
|
+
}
|
|
2188
|
+
try {
|
|
2189
|
+
validate();
|
|
2190
|
+
const approval = state.reservedIgnoreNames !== void 0 && (startupTransferEnabled(state) || state.automatic && syncSessionsSelected(state)) ? " Use Review automatic transfers to approve this policy separately." : "";
|
|
2191
|
+
ctx.ui.notify(
|
|
2192
|
+
`Saved. ${label} for \u201C${setupLabel}\u201D: ${transferSizeLimitLabel(limit)}. Applies to subsequent transfers; no transfer started.${approval}`,
|
|
2193
|
+
"info"
|
|
2194
|
+
);
|
|
2195
|
+
} catch {
|
|
2196
|
+
return stay;
|
|
2197
|
+
}
|
|
2198
|
+
return stay;
|
|
2199
|
+
};
|
|
2200
|
+
}
|
|
2088
2201
|
function ignoreAction(action) {
|
|
2089
2202
|
return async ({ state, signal: actionSignal }) => {
|
|
2090
2203
|
if (!ignoreAvailable || state.pathPolicy === "ignore-file" === (action === "migrate"))
|
|
@@ -2117,6 +2230,18 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
2117
2230
|
});
|
|
2118
2231
|
return disposition;
|
|
2119
2232
|
}
|
|
2233
|
+
function transferSizeLimitLabel(limit) {
|
|
2234
|
+
return limit === void 0 ? "Off" : `${limit} MiB`;
|
|
2235
|
+
}
|
|
2236
|
+
function parseTransferSizeLimit(input) {
|
|
2237
|
+
const value = input.trim();
|
|
2238
|
+
if (value.toLowerCase() === "off") return void 0;
|
|
2239
|
+
const limit = Number(value);
|
|
2240
|
+
if (!/^[0-9]+$/u.test(value) || limit <= 0 || !Number.isSafeInteger(limit * 1048576)) {
|
|
2241
|
+
throw new Error("Enter Off or a positive whole number of MiB that fits in a safe byte count.");
|
|
2242
|
+
}
|
|
2243
|
+
return limit;
|
|
2244
|
+
}
|
|
2120
2245
|
function notifySaveFailure(ctx, error) {
|
|
2121
2246
|
ctx.ui.notify(
|
|
2122
2247
|
`Pi Sync settings save failed: ${safeTerminalText(error instanceof Error ? error.message : String(error))}`,
|
|
@@ -2204,7 +2329,7 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
2204
2329
|
if (!attention) {
|
|
2205
2330
|
const observation = state.manager.observation;
|
|
2206
2331
|
if (!observation) return { kind: "stay" };
|
|
2207
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
2332
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-E4XZCQ7A.ts");
|
|
2208
2333
|
if (sessionSignal?.aborted) return { kind: "close" };
|
|
2209
2334
|
const config = await loadConfig();
|
|
2210
2335
|
if (sessionSignal?.aborted) return { kind: "close" };
|
|
@@ -2520,7 +2645,7 @@ function syncMainMenuItem(label) {
|
|
|
2520
2645
|
push: "This device \u2192 remote; replaces conflicting remote files.",
|
|
2521
2646
|
diff: "Inspect changes; no transfer.",
|
|
2522
2647
|
status: "Check remote; no transfer.",
|
|
2523
|
-
settings: "
|
|
2648
|
+
settings: "Edit settings, setups, and storage connections.",
|
|
2524
2649
|
history: "Review snapshots and rollback.",
|
|
2525
2650
|
doctor: "Review backend diagnostics.",
|
|
2526
2651
|
switch: "Choose another sync setup.",
|
|
@@ -2538,4 +2663,4 @@ function syncMainMenuItem(label) {
|
|
|
2538
2663
|
export {
|
|
2539
2664
|
showSyncManager
|
|
2540
2665
|
};
|
|
2541
|
-
//# sourceMappingURL=manager-ui-
|
|
2666
|
+
//# sourceMappingURL=manager-ui-DWOMAJKE.ts.map
|