@narumitw/pi-sync 0.64.0 → 0.66.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 +20 -0
- package/README.md +80 -11
- package/dist/chunks/{chunk-TJ7YNITN.ts → chunk-5YOLQKNZ.ts} +39 -3
- package/dist/chunks/chunk-5YOLQKNZ.ts.map +7 -0
- package/dist/chunks/{chunk-NDEZ52SS.ts → chunk-ASU3GZPW.ts} +11 -93
- package/dist/chunks/chunk-ASU3GZPW.ts.map +7 -0
- package/dist/chunks/{chunk-CKUGCBHP.ts → chunk-AYGMIMCV.ts} +2 -2
- package/dist/chunks/chunk-AYGMIMCV.ts.map +7 -0
- package/dist/chunks/{chunk-F3VODLVQ.ts → chunk-BESRBKVO.ts} +3 -3
- 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-RW44KNFD.ts → chunk-JQ5BAWW2.ts} +182 -12
- package/dist/chunks/chunk-JQ5BAWW2.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-VPSC7BXM.ts → chunk-SZJOUVCL.ts} +2 -2
- package/dist/chunks/{chunk-YT6PDRMM.ts → chunk-WJQ4TGN5.ts} +17 -17
- package/dist/chunks/chunk-WJQ4TGN5.ts.map +7 -0
- package/dist/chunks/{chunk-4VKWHVUO.ts → chunk-XUZV4OGI.ts} +3 -2
- package/dist/chunks/{chunk-4VKWHVUO.ts.map → chunk-XUZV4OGI.ts.map} +2 -2
- package/dist/chunks/chunk-Z5JMOXJM.ts +106 -0
- package/dist/chunks/chunk-Z5JMOXJM.ts.map +7 -0
- package/dist/chunks/{command-handler-N45GY7AV.ts → command-handler-44EFGPWH.ts} +54 -13
- package/dist/chunks/command-handler-44EFGPWH.ts.map +7 -0
- package/dist/chunks/{conflict-review-5E4M44BA.ts → conflict-review-J7L7S4AR.ts} +2 -2
- 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-FKW55L7I.ts → manager-result-dispatcher-WXE2BAQO.ts} +4 -4
- package/dist/chunks/{manager-ui-EV23DPZQ.ts → manager-ui-CVZLMXJ5.ts} +90 -76
- package/dist/chunks/manager-ui-CVZLMXJ5.ts.map +7 -0
- package/dist/chunks/{merge-review-6YSLSMGS.ts → merge-review-AAC674C6.ts} +3 -3
- package/dist/chunks/{remote-selection-ui-N4NMWFT2.ts → remote-selection-ui-E4XZCQ7A.ts} +3 -3
- package/dist/chunks/{setup-switch-HY7K3442.ts → setup-switch-644T6KHG.ts} +3 -3
- package/dist/chunks/setup-switch-644T6KHG.ts.map +7 -0
- package/dist/chunks/{setup-wizard-LEKDQ3HK.ts → setup-wizard-IEW56AZE.ts} +10 -8
- package/dist/chunks/{setup-wizard-LEKDQ3HK.ts.map → setup-wizard-IEW56AZE.ts.map} +1 -1
- package/dist/chunks/{sync-inspection-OS2LVOLV.ts → sync-inspection-NBBTSMKR.ts} +2 -2
- package/dist/chunks/{sync-operations-D3MDJUQQ.ts → sync-operations-AIEM2KL2.ts} +2 -2
- package/dist/daemon/dist/client.js +125 -287
- package/dist/daemon/dist/consent.js +14 -2
- package/dist/daemon/dist/daemon-recovery.js +85 -2
- package/dist/daemon/dist/daemon-startup.js +257 -0
- package/dist/daemon/dist/engine/backends/git/git-backend.js +15 -4
- package/dist/daemon/dist/engine/backends/git/git-storage.js +15 -3
- package/dist/daemon/dist/engine/backends/s3/s3-backend.js +20 -9
- package/dist/daemon/dist/engine/backends/sync-backend.js +16 -0
- package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +19 -6
- package/dist/daemon/dist/engine/ignore/adoption-journal.js +143 -0
- package/dist/daemon/dist/engine/ignore/snapshot-ignore-rules.js +39 -0
- 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-watch.js +3 -2
- package/dist/daemon/dist/engine/sync/directional-action.js +119 -0
- package/dist/daemon/dist/engine/sync/ignore-adoption-recovery.js +50 -0
- package/dist/daemon/dist/engine/sync/ignore-adoption.js +401 -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-journal.js +2 -2
- package/dist/daemon/dist/engine/sync/merged-sync.js +14 -3
- package/dist/daemon/dist/engine/sync/remote-snapshot.js +3 -1
- package/dist/daemon/dist/engine/sync/sync-errors.js +20 -0
- package/dist/daemon/dist/engine/sync/sync-local.js +57 -3
- package/dist/daemon/dist/engine/sync/sync-mutations.js +375 -346
- package/dist/daemon/dist/engine/sync/sync-policy.js +5 -5
- package/dist/daemon/dist/engine/sync/sync-queries.js +3 -2
- package/dist/daemon/dist/engine/sync/sync-rollback.js +204 -0
- package/dist/daemon/dist/engine/sync/transfer-freshness.js +11 -5
- package/dist/daemon/dist/engine/ui/ignore-rule-preview.js +18 -0
- package/dist/daemon/dist/engine-service.js +69 -1
- package/dist/daemon/dist/foreground-queue-outcome.js +9 -0
- package/dist/daemon/dist/monitor.js +1 -0
- package/dist/daemon/dist/server.js +76 -11
- package/dist/daemon/dist/service-host.js +56 -8
- package/dist/daemon/package.json +1 -1
- package/dist/index.ts +6 -6
- package/docs/daemon-migration.md +3 -6
- package/docs/tui-contract.md +3 -3
- package/package.json +2 -2
- package/skills/configure-pi-sync/references/configuration.md +10 -8
- package/src/commands/command-execution.ts +56 -2
- package/src/commands/command-handler.ts +2 -0
- package/src/commands/command.ts +2 -1
- package/src/daemon/directional-recovery.ts +103 -0
- package/src/daemon/pi-client.ts +112 -9
- package/src/ui/cancellable-operation.ts +5 -2
- package/src/ui/ignore-file-ui.ts +13 -5
- package/src/ui/manager-state.ts +17 -10
- package/src/ui/manager-ui.ts +30 -25
- package/src/ui/merge-review.ts +8 -9
- package/src/ui/remote-selection-ui.ts +43 -2
- package/src/ui/settings-ui.ts +30 -30
- package/src/ui/sync-confirmation.ts +7 -7
- package/dist/chunks/chunk-CKUGCBHP.ts.map +0 -7
- package/dist/chunks/chunk-MANNB4WZ.ts.map +0 -7
- package/dist/chunks/chunk-NDEZ52SS.ts.map +0 -7
- package/dist/chunks/chunk-RW44KNFD.ts.map +0 -7
- package/dist/chunks/chunk-TJ7YNITN.ts.map +0 -7
- package/dist/chunks/chunk-YT6PDRMM.ts.map +0 -7
- package/dist/chunks/command-handler-N45GY7AV.ts.map +0 -7
- package/dist/chunks/manager-ui-EV23DPZQ.ts.map +0 -7
- /package/dist/chunks/{chunk-F3VODLVQ.ts.map → chunk-BESRBKVO.ts.map} +0 -0
- /package/dist/chunks/{chunk-TZMVSTAM.ts.map → chunk-BYVHABNR.ts.map} +0 -0
- /package/dist/chunks/{chunk-VPSC7BXM.ts.map → chunk-SZJOUVCL.ts.map} +0 -0
- /package/dist/chunks/{conflict-review-5E4M44BA.ts.map → conflict-review-J7L7S4AR.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-FKW55L7I.ts.map → ignore-file-ui-OHFISFVC.ts.map} +0 -0
- /package/dist/chunks/{merge-review-6YSLSMGS.ts.map → manager-result-dispatcher-WXE2BAQO.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-N4NMWFT2.ts.map → merge-review-AAC674C6.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-HY7K3442.ts.map → remote-selection-ui-E4XZCQ7A.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-OS2LVOLV.ts.map → sync-inspection-NBBTSMKR.ts.map} +0 -0
- /package/dist/chunks/{sync-operations-D3MDJUQQ.ts.map → sync-operations-AIEM2KL2.ts.map} +0 -0
|
@@ -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,29 +17,33 @@ 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,
|
|
31
37
|
setupSwitchActionFromLabel,
|
|
32
38
|
setupSwitchActionLabel,
|
|
33
39
|
useSyncSetup
|
|
34
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-SZJOUVCL.ts";
|
|
35
41
|
import {
|
|
36
42
|
isCloudflareR2Endpoint,
|
|
37
43
|
normalizeS3Endpoint,
|
|
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,
|
|
@@ -64,21 +67,29 @@ import {
|
|
|
64
67
|
AUTOMATIC_SYNC_DESCRIPTION,
|
|
65
68
|
STARTUP_TRANSFER_DESCRIPTION,
|
|
66
69
|
startupTransferSummary
|
|
67
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-XUZV4OGI.ts";
|
|
68
71
|
import {
|
|
69
72
|
confirmMergeReview
|
|
70
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-WJQ4TGN5.ts";
|
|
71
74
|
import {
|
|
72
75
|
runCancellableOperation
|
|
73
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-AYGMIMCV.ts";
|
|
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";
|
|
@@ -112,7 +115,7 @@ import {
|
|
|
112
115
|
} from "./chunk-DAZZ5BEJ.ts";
|
|
113
116
|
import {
|
|
114
117
|
piDaemonClient
|
|
115
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-JQ5BAWW2.ts";
|
|
116
119
|
import {
|
|
117
120
|
configureSyncStatus
|
|
118
121
|
} from "./chunk-H7VOTY5N.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,
|
|
@@ -540,8 +543,8 @@ function storageLocation(config) {
|
|
|
540
543
|
// src/ui/manager-state.ts
|
|
541
544
|
var MAIN_MENU_ACTIONS = [
|
|
542
545
|
"Sync now",
|
|
543
|
-
"Pull from remote
|
|
544
|
-
"Push to remote
|
|
546
|
+
"Pull from remote",
|
|
547
|
+
"Push to remote",
|
|
545
548
|
"View differences",
|
|
546
549
|
"Check remote status",
|
|
547
550
|
"Settings",
|
|
@@ -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"] : [],
|
|
@@ -1547,7 +1553,6 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1547
1553
|
const ignoreAvailable = await ignoreFileSettingsAvailable(ctx, signal);
|
|
1548
1554
|
if (!isCurrent()) return disposition;
|
|
1549
1555
|
const setupName = initial.setupName;
|
|
1550
|
-
let saveStatus = "Simple choices save immediately. Back does not undo saved changes.";
|
|
1551
1556
|
const menu = defineMenu4({
|
|
1552
1557
|
start: "settings",
|
|
1553
1558
|
screens: {
|
|
@@ -1556,7 +1561,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1556
1561
|
title: "Pi Sync Settings",
|
|
1557
1562
|
lines: [
|
|
1558
1563
|
`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."] : [
|
|
1564
|
+
...state.reservedIgnoreNames !== void 0 && !ignoreAvailable ? ["Setup preferences are read-only; adding, editing, and switching setups are unavailable."] : ["Back does not undo saved changes."],
|
|
1560
1565
|
...state.pathPolicy === "ignore-file" ? [manualIgnoreFileGuidance(state.ignoreFile ?? ".syncignore")] : []
|
|
1561
1566
|
],
|
|
1562
1567
|
items: [
|
|
@@ -1758,7 +1763,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1758
1763
|
const partialSync = value === "Partial only" || value === "Merge + partial";
|
|
1759
1764
|
if (!await ctx.ui.confirm(
|
|
1760
1765
|
"Save content policy?",
|
|
1761
|
-
`${previous.pathPolicy === "ignore-file" ? "Ignore-file policy keeps settings version 8 and snapshot version
|
|
1766
|
+
`${previous.pathPolicy === "ignore-file" ? "Ignore-file policy keeps settings version 8 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
1767
|
{ signal: mutationSignal }
|
|
1763
1768
|
))
|
|
1764
1769
|
return { kind: "rejected" };
|
|
@@ -1779,8 +1784,10 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1779
1784
|
};
|
|
1780
1785
|
}, mutationSignal);
|
|
1781
1786
|
validate();
|
|
1782
|
-
|
|
1783
|
-
|
|
1787
|
+
ctx.ui.notify(
|
|
1788
|
+
"Saved reviewed policy for this setup. Applies to subsequent sync operations; recovery evidence is retained.",
|
|
1789
|
+
"info"
|
|
1790
|
+
);
|
|
1784
1791
|
return { kind: "stay" };
|
|
1785
1792
|
} catch (error) {
|
|
1786
1793
|
if (!mutationSignal.aborted) notifySaveFailure(ctx, error);
|
|
@@ -1826,7 +1833,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1826
1833
|
if (sameLocalFields(previous.localFields, fields)) return { kind: "stay" };
|
|
1827
1834
|
const confirmed = await ctx.ui.confirm(
|
|
1828
1835
|
"Save portable field policy?",
|
|
1829
|
-
`${previous.pathPolicy === "ignore-file" ? "Ignore-file policy keeps settings version 8 and snapshot version
|
|
1836
|
+
`${previous.pathPolicy === "ignore-file" ? "Ignore-file policy keeps settings version 8 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
1837
|
{ signal: mutationSignal }
|
|
1831
1838
|
);
|
|
1832
1839
|
validate();
|
|
@@ -1847,8 +1854,10 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1847
1854
|
};
|
|
1848
1855
|
}, mutationSignal);
|
|
1849
1856
|
validate();
|
|
1850
|
-
|
|
1851
|
-
|
|
1857
|
+
ctx.ui.notify(
|
|
1858
|
+
"Saved reviewed policy for this setup. Applies to subsequent sync operations; recovery evidence is retained.",
|
|
1859
|
+
"info"
|
|
1860
|
+
);
|
|
1852
1861
|
return { kind: "stay" };
|
|
1853
1862
|
} catch (error) {
|
|
1854
1863
|
if (!mutationSignal.aborted) notifySaveFailure(ctx, error);
|
|
@@ -1866,10 +1875,6 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1866
1875
|
signal: mutationSignal
|
|
1867
1876
|
});
|
|
1868
1877
|
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
1878
|
return { kind: "stay" };
|
|
1874
1879
|
} catch (error) {
|
|
1875
1880
|
if (!mutationSignal.aborted) notifySaveFailure(ctx, error);
|
|
@@ -1934,10 +1939,6 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1934
1939
|
signal: mutationSignal
|
|
1935
1940
|
});
|
|
1936
1941
|
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
1942
|
return { kind: "stay" };
|
|
1942
1943
|
} catch (error) {
|
|
1943
1944
|
if (!mutationSignal.aborted) notifySaveFailure(ctx, error);
|
|
@@ -1953,7 +1954,6 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1953
1954
|
if (latest.skipSecretScan === skipSecretScan) return { kind: "stay" };
|
|
1954
1955
|
await updateLocalConfig((settings) => ({ ...settings, skipSecretScan }), mutationSignal);
|
|
1955
1956
|
if (mutationSignal.aborted) return { kind: "rejected" };
|
|
1956
|
-
ctx.ui.notify(`Secret scan ${skipSecretScan ? "disabled" : "enabled"} for pushes in all setups.`, "info");
|
|
1957
1957
|
return { kind: "stay" };
|
|
1958
1958
|
} catch (error) {
|
|
1959
1959
|
if (!mutationSignal.aborted) notifySaveFailure(ctx, error);
|
|
@@ -1970,7 +1970,6 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1970
1970
|
await updateLocalConfig((settings) => ({ ...settings, showStatus }), mutationSignal);
|
|
1971
1971
|
if (mutationSignal.aborted) return { kind: "rejected" };
|
|
1972
1972
|
configureSyncStatus(ctx, showStatus);
|
|
1973
|
-
ctx.ui.notify(`Pi Sync status ${showStatus ? "enabled" : "disabled"} for all setups.`, "info");
|
|
1974
1973
|
return { kind: "stay" };
|
|
1975
1974
|
} catch (error) {
|
|
1976
1975
|
if (!mutationSignal.aborted) notifySaveFailure(ctx, error);
|
|
@@ -1999,7 +1998,6 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1999
1998
|
if (latest.onSwitch === action) return { kind: "stay" };
|
|
2000
1999
|
await saveOnSwitch(action, mutationSignal);
|
|
2001
2000
|
if (mutationSignal.aborted) return { kind: "rejected" };
|
|
2002
|
-
ctx.ui.notify(`After switching setup: ${value}.`, "info");
|
|
2003
2001
|
return { kind: "stay" };
|
|
2004
2002
|
} catch (error) {
|
|
2005
2003
|
if (!mutationSignal.aborted) notifySaveFailure(ctx, error);
|
|
@@ -2048,7 +2046,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
2048
2046
|
"remote-include": async ({ state, signal: actionSignal }) => {
|
|
2049
2047
|
if (state.reservedIgnoreNames !== void 0 && !ignoreAvailable) return { kind: "rejected" };
|
|
2050
2048
|
const reviewSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
2051
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
2049
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-E4XZCQ7A.ts");
|
|
2052
2050
|
if (reviewSignal.aborted) return { kind: "rejected" };
|
|
2053
2051
|
const review = await showRemoteSelectionReview(ctx, setupName, reviewSignal, void 0, {
|
|
2054
2052
|
origin: "settings",
|
|
@@ -2080,8 +2078,22 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
2080
2078
|
const result = await save(action);
|
|
2081
2079
|
if (action.signal.aborted || signal?.aborted) return { kind: "rejected" };
|
|
2082
2080
|
validate();
|
|
2083
|
-
|
|
2084
|
-
|
|
2081
|
+
if (result?.kind === "stay") {
|
|
2082
|
+
const { value, state } = action;
|
|
2083
|
+
const enabled = value === "On";
|
|
2084
|
+
const setup = safeTerminalText(setupName);
|
|
2085
|
+
const approval = enabled && state.reservedIgnoreNames !== void 0 ? " Use Review automatic transfers to approve this policy separately." : "";
|
|
2086
|
+
const message = {
|
|
2087
|
+
automatic: `Automatic sync for \u201C${setup}\u201D: ${value}.${enabled ? " New startup checks begin next session." : ""}${approval}`,
|
|
2088
|
+
"automatic-transfer": `Startup transfer for \u201C${setup}\u201D: ${value}.${enabled ? " Applies at the next session start." : ""}${approval}`,
|
|
2089
|
+
"merge-settings": `Merge settings fields for \u201C${setup}\u201D: ${value}. Applies to subsequent sync operations.`,
|
|
2090
|
+
"skip-secret-scan": `Secret scan ${enabled ? "disabled" : "enabled"} for subsequent pushes in all setups.`,
|
|
2091
|
+
"show-status": `Show sync status: ${value}. Applies immediately to all setups.`,
|
|
2092
|
+
debug: `Debug mode: ${value}. Pi applies it at the next session start.`,
|
|
2093
|
+
"on-switch": `On setup switch: ${value}.${state.reservedIgnoreNames !== void 0 ? " Switching still won't pull while any setup uses an ignore file." : ""}`
|
|
2094
|
+
}[id];
|
|
2095
|
+
ctx.ui.notify(`Saved. ${message}`, "info");
|
|
2096
|
+
}
|
|
2085
2097
|
return result;
|
|
2086
2098
|
};
|
|
2087
2099
|
}
|
|
@@ -2139,6 +2151,26 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
2139
2151
|
return false;
|
|
2140
2152
|
}
|
|
2141
2153
|
};
|
|
2154
|
+
const directionalAction = async (direction, state, signal) => {
|
|
2155
|
+
const review = state.manager.configReview;
|
|
2156
|
+
if (!review) return { kind: "stay" };
|
|
2157
|
+
const result = await runCancellableOperation(
|
|
2158
|
+
ctx,
|
|
2159
|
+
direction === "push" ? "Pushing to remote\u2026" : "Pulling from remote\u2026",
|
|
2160
|
+
direction,
|
|
2161
|
+
runRoute,
|
|
2162
|
+
{
|
|
2163
|
+
commitAware: true,
|
|
2164
|
+
cancelledMessage: direction === "push" ? "Push cancellation requested." : "Pull cancellation requested.",
|
|
2165
|
+
target: review.setupName,
|
|
2166
|
+
directionalFingerprint: review.fingerprint,
|
|
2167
|
+
signal,
|
|
2168
|
+
isCurrent
|
|
2169
|
+
}
|
|
2170
|
+
);
|
|
2171
|
+
const done = result.kind === "closed" || result.kind === "completed" && result.outcome === "applied" || result.kind === "failed" && options.needsDaemonRecovery?.();
|
|
2172
|
+
return done ? { kind: "close" } : { kind: "stay" };
|
|
2173
|
+
};
|
|
2142
2174
|
const menuItems = (manager) => {
|
|
2143
2175
|
const attentionItems = attentionMainMenuItems(manager);
|
|
2144
2176
|
const managerItems = manager.actions.map((label) => blockedSyncMenuItem(label, manager) ?? syncMainMenuItem(label));
|
|
@@ -2184,7 +2216,7 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
2184
2216
|
if (!attention) {
|
|
2185
2217
|
const observation = state.manager.observation;
|
|
2186
2218
|
if (!observation) return { kind: "stay" };
|
|
2187
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
2219
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-E4XZCQ7A.ts");
|
|
2188
2220
|
if (sessionSignal?.aborted) return { kind: "close" };
|
|
2189
2221
|
const config = await loadConfig();
|
|
2190
2222
|
if (sessionSignal?.aborted) return { kind: "close" };
|
|
@@ -2260,26 +2292,8 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
2260
2292
|
const result = await showSyncSettings(ctx, runRoute, signal, review?.setupName);
|
|
2261
2293
|
return { kind: result === "exit" ? "close" : "stay" };
|
|
2262
2294
|
},
|
|
2263
|
-
pull:
|
|
2264
|
-
|
|
2265
|
-
commitAware: true,
|
|
2266
|
-
cancelledMessage: "Pull check cancelled; no local files were changed.",
|
|
2267
|
-
target: state.manager.configReview?.setupName,
|
|
2268
|
-
signal: sessionSignal
|
|
2269
|
-
});
|
|
2270
|
-
const disposition = await dispatchManagerResult(ctx, result, "pull", runRoute, sessionSignal);
|
|
2271
|
-
return disposition.kind === "close" ? { kind: "close" } : { kind: "stay" };
|
|
2272
|
-
},
|
|
2273
|
-
push: async ({ state }) => {
|
|
2274
|
-
const result = await runCancellableOperation(ctx, "Preparing push preview\u2026", "push", runRoute, {
|
|
2275
|
-
commitAware: true,
|
|
2276
|
-
cancelledMessage: "Push preparation cancelled; no remote files were changed.",
|
|
2277
|
-
target: state.manager.configReview?.setupName,
|
|
2278
|
-
signal: sessionSignal
|
|
2279
|
-
});
|
|
2280
|
-
const disposition = await dispatchManagerResult(ctx, result, "push", runRoute, sessionSignal);
|
|
2281
|
-
return disposition.kind === "close" ? { kind: "close" } : { kind: "stay" };
|
|
2282
|
-
},
|
|
2295
|
+
pull: ({ state, signal }) => directionalAction("pull", state, signal),
|
|
2296
|
+
push: ({ state, signal }) => directionalAction("push", state, signal),
|
|
2283
2297
|
setups: async () => {
|
|
2284
2298
|
const result = await showSyncSetupManager(ctx, runRoute, sessionSignal);
|
|
2285
2299
|
return result === "exit" ? { kind: "close" } : { kind: "stay" };
|
|
@@ -2487,8 +2501,8 @@ function syncMainMenuItem(label) {
|
|
|
2487
2501
|
const actions = {
|
|
2488
2502
|
"Sync now": "sync",
|
|
2489
2503
|
"Retry refused model result\u2026": "retry-refusal",
|
|
2490
|
-
"Pull from remote
|
|
2491
|
-
"Push to remote
|
|
2504
|
+
"Pull from remote": "pull",
|
|
2505
|
+
"Push to remote": "push",
|
|
2492
2506
|
"View differences": "diff",
|
|
2493
2507
|
"Check remote status": "status",
|
|
2494
2508
|
"Switch sync setup": "switch",
|
|
@@ -2514,11 +2528,11 @@ function syncMainMenuItem(label) {
|
|
|
2514
2528
|
description: {
|
|
2515
2529
|
sync: "Merge changes on both sides.",
|
|
2516
2530
|
"retry-refusal": "Retry model; may incur costs.",
|
|
2517
|
-
pull: "Remote \u2192 this device.",
|
|
2518
|
-
push: "This device \u2192 remote
|
|
2531
|
+
pull: "Remote \u2192 this device; replaces conflicting local files.",
|
|
2532
|
+
push: "This device \u2192 remote; replaces conflicting remote files.",
|
|
2519
2533
|
diff: "Inspect changes; no transfer.",
|
|
2520
2534
|
status: "Check remote; no transfer.",
|
|
2521
|
-
settings: "
|
|
2535
|
+
settings: "Edit settings, setups, and storage connections.",
|
|
2522
2536
|
history: "Review snapshots and rollback.",
|
|
2523
2537
|
doctor: "Review backend diagnostics.",
|
|
2524
2538
|
switch: "Choose another sync setup.",
|
|
@@ -2536,4 +2550,4 @@ function syncMainMenuItem(label) {
|
|
|
2536
2550
|
export {
|
|
2537
2551
|
showSyncManager
|
|
2538
2552
|
};
|
|
2539
|
-
//# sourceMappingURL=manager-ui-
|
|
2553
|
+
//# sourceMappingURL=manager-ui-CVZLMXJ5.ts.map
|