@narumitw/pi-sync 0.63.1 → 0.65.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 +21 -0
- package/README.md +86 -10
- package/dist/chunks/{chunk-CKUGCBHP.ts → chunk-AYGMIMCV.ts} +2 -2
- package/dist/chunks/chunk-AYGMIMCV.ts.map +7 -0
- package/dist/chunks/{chunk-27F5W7DX.ts → chunk-DAZZ5BEJ.ts} +3 -1
- package/dist/chunks/chunk-DAZZ5BEJ.ts.map +7 -0
- package/dist/chunks/{chunk-VQ47JBLF.ts → chunk-FI2F5JBS.ts} +2 -2
- package/dist/chunks/{chunk-V76KCWHO.ts → chunk-IOM6E5FW.ts} +4 -4
- package/dist/chunks/{chunk-B5F3JLD3.ts → chunk-JQ5BAWW2.ts} +482 -78
- package/dist/chunks/chunk-JQ5BAWW2.ts.map +7 -0
- package/dist/chunks/{chunk-LBNC5AOM.ts → chunk-OBVJTKVY.ts} +12 -12
- package/dist/chunks/{chunk-EXDWEFIJ.ts → chunk-OWEOZZZE.ts} +6 -6
- package/dist/chunks/{chunk-SXCH4Q5O.ts → chunk-SZJOUVCL.ts} +3 -3
- package/dist/chunks/{chunk-HSCAFOT5.ts → chunk-TZMVSTAM.ts} +5 -5
- package/dist/chunks/{chunk-POWOMJ7S.ts → chunk-WJQ4TGN5.ts} +58 -31
- package/dist/chunks/chunk-WJQ4TGN5.ts.map +7 -0
- package/dist/chunks/{chunk-HLCML3OW.ts → chunk-XUZV4OGI.ts} +5 -3
- package/dist/chunks/chunk-XUZV4OGI.ts.map +7 -0
- package/dist/chunks/{command-handler-GMRRFWOL.ts → command-handler-YZ4DXQ7N.ts} +81 -30
- package/dist/chunks/command-handler-YZ4DXQ7N.ts.map +7 -0
- package/dist/chunks/{conflict-review-JWEA7DPQ.ts → conflict-review-J7L7S4AR.ts} +2 -2
- package/dist/chunks/{file-selection-KID23GAD.ts → file-selection-DDQN4LVD.ts} +9 -9
- package/dist/chunks/{manager-result-dispatcher-GDB74IOP.ts → manager-result-dispatcher-XB75YLEG.ts} +5 -5
- package/dist/chunks/{manager-ui-T5J5WG7T.ts → manager-ui-RGA26Z6G.ts} +103 -83
- package/dist/chunks/manager-ui-RGA26Z6G.ts.map +7 -0
- package/dist/chunks/{merge-review-OQDXNTJU.ts → merge-review-AAC674C6.ts} +3 -2
- package/dist/chunks/ownership-recovery-UDDHSDSZ.ts +59 -0
- package/dist/chunks/ownership-recovery-UDDHSDSZ.ts.map +7 -0
- package/dist/chunks/{remote-selection-ui-GPITNEBF.ts → remote-selection-ui-WVMET5RI.ts} +4 -4
- package/dist/chunks/{setup-switch-L54X5U5I.ts → setup-switch-644T6KHG.ts} +4 -4
- package/dist/chunks/{setup-wizard-LL6YMGUR.ts → setup-wizard-YP2KF2WQ.ts} +9 -9
- package/dist/chunks/{sync-inspection-SRU6HGGK.ts → sync-inspection-NBBTSMKR.ts} +5 -5
- package/dist/chunks/{sync-operations-UGSCONZ7.ts → sync-operations-AIEM2KL2.ts} +2 -2
- package/dist/daemon/dist/cli.js +2 -0
- package/dist/daemon/dist/client-transport.js +66 -0
- package/dist/daemon/dist/client.js +222 -354
- package/dist/daemon/dist/consent.js +33 -11
- package/dist/daemon/dist/daemon-debug.js +33 -0
- package/dist/daemon/dist/daemon-recovery.js +158 -0
- package/dist/daemon/dist/daemon-startup.js +257 -0
- package/dist/daemon/dist/engine/backends/git/git-backend.js +49 -13
- package/dist/daemon/dist/engine/backends/git/git-runner.js +6 -1
- package/dist/daemon/dist/engine/backends/git/git-storage.js +5 -9
- package/dist/daemon/dist/engine/backends/publication-encoding.js +19 -0
- package/dist/daemon/dist/engine/backends/s3/s3-backend.js +30 -21
- package/dist/daemon/dist/engine/backends/sync-backend.js +16 -0
- package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +34 -32
- package/dist/daemon/dist/engine/backends/webdav/webdav-client.js +10 -0
- package/dist/daemon/dist/engine/debug-log.js +134 -0
- package/dist/daemon/dist/engine/paths.js +7 -1
- package/dist/daemon/dist/engine/settings/config-file.js +62 -17
- package/dist/daemon/dist/engine/settings/config.js +49 -14
- package/dist/daemon/dist/engine/snapshot/snapshot-apply.js +30 -8
- package/dist/daemon/dist/engine/snapshot/snapshot-codec.js +3 -1
- package/dist/daemon/dist/engine/snapshot/snapshot-payload.js +32 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction-images.js +34 -0
- package/dist/daemon/dist/engine/snapshot/snapshot-transaction.js +50 -7
- package/dist/daemon/dist/engine/snapshot/snapshot.js +64 -25
- package/dist/daemon/dist/engine/state/lock.js +157 -17
- package/dist/daemon/dist/engine/sync/continuous-sync.js +35 -11
- package/dist/daemon/dist/engine/sync/directional-action.js +124 -0
- package/dist/daemon/dist/engine/sync/initialization.js +2 -2
- package/dist/daemon/dist/engine/sync/local-fields.js +42 -19
- package/dist/daemon/dist/engine/sync/merged-sync.js +13 -10
- package/dist/daemon/dist/engine/sync/remote-snapshot.js +21 -4
- package/dist/daemon/dist/engine/sync/session-push.js +13 -4
- package/dist/daemon/dist/engine/sync/startup-bootstrap.js +105 -0
- package/dist/daemon/dist/engine/sync/startup-recovery-evidence.js +37 -0
- package/dist/daemon/dist/engine/sync/startup-timings.js +80 -8
- package/dist/daemon/dist/engine/sync/sync-error-guidance.js +6 -1
- package/dist/daemon/dist/engine/sync/sync-errors.js +20 -0
- package/dist/daemon/dist/engine/sync/sync-inspection.js +4 -7
- package/dist/daemon/dist/engine/sync/sync-local.js +59 -4
- package/dist/daemon/dist/engine/sync/sync-mutations.js +309 -337
- package/dist/daemon/dist/engine/sync/sync-policy.js +9 -1
- package/dist/daemon/dist/engine/sync/sync-queries.js +2 -1
- package/dist/daemon/dist/engine/sync/sync-rollback.js +198 -0
- package/dist/daemon/dist/engine/sync/sync-state.js +12 -4
- package/dist/daemon/dist/engine/sync/transfer-freshness.js +11 -5
- package/dist/daemon/dist/engine-service.js +122 -10
- package/dist/daemon/dist/foreground-queue-outcome.js +9 -0
- package/dist/daemon/dist/identity.js +36 -6
- package/dist/daemon/dist/index.js +2 -1
- package/dist/daemon/dist/monitor.js +21 -1
- package/dist/daemon/dist/paged-review.js +177 -0
- package/dist/daemon/dist/participant-ledger.js +149 -0
- package/dist/daemon/dist/protocol.js +4 -0
- package/dist/daemon/dist/server.js +340 -127
- package/dist/daemon/dist/service-host.js +83 -15
- package/dist/daemon/dist/state-wait-jobs.js +23 -0
- package/dist/daemon/dist/state-wait.js +34 -0
- package/dist/daemon/package.json +1 -1
- package/dist/index.ts +128 -48
- package/dist/index.ts.map +2 -2
- package/docs/continuous-sync-verification.md +2 -0
- package/docs/daemon-migration.md +31 -6
- package/docs/tui-contract.md +7 -1
- package/package.json +2 -2
- package/skills/configure-pi-sync/references/configuration.md +23 -13
- package/src/commands/command-execution.ts +67 -5
- package/src/commands/command-handler.ts +12 -3
- package/src/commands/command.ts +4 -2
- package/src/daemon/client-debug.ts +45 -0
- package/src/daemon/directional-recovery.ts +103 -0
- package/src/daemon/ownership-recovery.ts +50 -0
- package/src/daemon/pi-client.ts +399 -71
- package/src/daemon/startup-bootstrap-client.ts +26 -0
- package/src/settings/config.ts +1 -0
- package/src/sync/automatic-sync.ts +61 -18
- package/src/sync/startup-check.ts +13 -5
- package/src/sync-extension.ts +46 -8
- package/src/ui/cancellable-operation.ts +5 -2
- package/src/ui/manager-state.ts +31 -23
- package/src/ui/manager-ui.ts +45 -25
- package/src/ui/merge-review.ts +53 -18
- package/src/ui/settings-ui.ts +2 -2
- package/src/ui/sync-confirmation.ts +14 -17
- package/src/ui/sync-setups-ui.ts +15 -12
- package/dist/chunks/chunk-27F5W7DX.ts.map +0 -7
- package/dist/chunks/chunk-B5F3JLD3.ts.map +0 -7
- package/dist/chunks/chunk-CKUGCBHP.ts.map +0 -7
- package/dist/chunks/chunk-HLCML3OW.ts.map +0 -7
- package/dist/chunks/chunk-POWOMJ7S.ts.map +0 -7
- package/dist/chunks/command-handler-GMRRFWOL.ts.map +0 -7
- package/dist/chunks/manager-ui-T5J5WG7T.ts.map +0 -7
- /package/dist/chunks/{chunk-VQ47JBLF.ts.map → chunk-FI2F5JBS.ts.map} +0 -0
- /package/dist/chunks/{chunk-V76KCWHO.ts.map → chunk-IOM6E5FW.ts.map} +0 -0
- /package/dist/chunks/{chunk-LBNC5AOM.ts.map → chunk-OBVJTKVY.ts.map} +0 -0
- /package/dist/chunks/{chunk-EXDWEFIJ.ts.map → chunk-OWEOZZZE.ts.map} +0 -0
- /package/dist/chunks/{chunk-SXCH4Q5O.ts.map → chunk-SZJOUVCL.ts.map} +0 -0
- /package/dist/chunks/{chunk-HSCAFOT5.ts.map → chunk-TZMVSTAM.ts.map} +0 -0
- /package/dist/chunks/{conflict-review-JWEA7DPQ.ts.map → conflict-review-J7L7S4AR.ts.map} +0 -0
- /package/dist/chunks/{file-selection-KID23GAD.ts.map → file-selection-DDQN4LVD.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-GDB74IOP.ts.map → manager-result-dispatcher-XB75YLEG.ts.map} +0 -0
- /package/dist/chunks/{merge-review-OQDXNTJU.ts.map → merge-review-AAC674C6.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-GPITNEBF.ts.map → remote-selection-ui-WVMET5RI.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-L54X5U5I.ts.map → setup-switch-644T6KHG.ts.map} +0 -0
- /package/dist/chunks/{setup-wizard-LL6YMGUR.ts.map → setup-wizard-YP2KF2WQ.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-SRU6HGGK.ts.map → sync-inspection-NBBTSMKR.ts.map} +0 -0
- /package/dist/chunks/{sync-operations-UGSCONZ7.ts.map → sync-operations-AIEM2KL2.ts.map} +0 -0
|
@@ -20,17 +20,18 @@ import {
|
|
|
20
20
|
showEditWebDavStorageProfile,
|
|
21
21
|
showEditWebDavTarget,
|
|
22
22
|
showIgnoreFileAction
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-OBVJTKVY.ts";
|
|
24
24
|
import {
|
|
25
25
|
dispatchManagerResult
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-IOM6E5FW.ts";
|
|
27
|
+
import "./chunk-OWEOZZZE.ts";
|
|
27
28
|
import {
|
|
28
29
|
SETUP_SWITCH_ACTION_OPTIONS,
|
|
29
30
|
saveOnSwitch,
|
|
30
31
|
setupSwitchActionFromLabel,
|
|
31
32
|
setupSwitchActionLabel,
|
|
32
33
|
useSyncSetup
|
|
33
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-SZJOUVCL.ts";
|
|
34
35
|
import {
|
|
35
36
|
isCloudflareR2Endpoint,
|
|
36
37
|
normalizeS3Endpoint,
|
|
@@ -55,42 +56,29 @@ import {
|
|
|
55
56
|
readStateForConfig,
|
|
56
57
|
syncAttentionMatchesConfig,
|
|
57
58
|
syncStateFingerprint
|
|
58
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-FI2F5JBS.ts";
|
|
60
|
+
import {
|
|
61
|
+
throwIfAborted
|
|
62
|
+
} from "./chunk-UMPA5S7X.ts";
|
|
59
63
|
import {
|
|
60
64
|
AUTOMATIC_SYNC_DESCRIPTION,
|
|
61
65
|
STARTUP_TRANSFER_DESCRIPTION,
|
|
62
66
|
startupTransferSummary
|
|
63
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-XUZV4OGI.ts";
|
|
64
68
|
import {
|
|
65
69
|
confirmMergeReview
|
|
66
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-WJQ4TGN5.ts";
|
|
71
|
+
import {
|
|
72
|
+
runCancellableOperation
|
|
73
|
+
} from "./chunk-AYGMIMCV.ts";
|
|
67
74
|
import {
|
|
68
75
|
directoryScopeSummary,
|
|
69
76
|
showExcludedPaths
|
|
70
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-TZMVSTAM.ts";
|
|
71
78
|
import {
|
|
72
79
|
directorySessionOptInLine,
|
|
73
80
|
saveReviewedDraft
|
|
74
81
|
} from "./chunk-JREGWM2B.ts";
|
|
75
|
-
import {
|
|
76
|
-
manualIgnoreFileGuidance
|
|
77
|
-
} from "./chunk-EJDDRS6O.ts";
|
|
78
|
-
import {
|
|
79
|
-
activeLocalConfigPath,
|
|
80
|
-
localConfigPath,
|
|
81
|
-
readActiveLocalConfigDocumentForRepair,
|
|
82
|
-
syncErrorGuidance
|
|
83
|
-
} from "./chunk-IBXEM35O.ts";
|
|
84
|
-
import {
|
|
85
|
-
piDaemonClient
|
|
86
|
-
} from "./chunk-B5F3JLD3.ts";
|
|
87
|
-
import "./chunk-EXDWEFIJ.ts";
|
|
88
|
-
import {
|
|
89
|
-
runCancellableOperation
|
|
90
|
-
} from "./chunk-CKUGCBHP.ts";
|
|
91
|
-
import {
|
|
92
|
-
throwIfAborted
|
|
93
|
-
} from "./chunk-UMPA5S7X.ts";
|
|
94
82
|
import {
|
|
95
83
|
addStorageConnection,
|
|
96
84
|
removeStorageConnection,
|
|
@@ -101,18 +89,30 @@ import {
|
|
|
101
89
|
import {
|
|
102
90
|
captureMutationOwner
|
|
103
91
|
} 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";
|
|
104
100
|
import {
|
|
105
101
|
sameSyncExclude
|
|
106
102
|
} from "./chunk-ZO52JM4H.ts";
|
|
107
103
|
import {
|
|
108
104
|
configFromSettings,
|
|
105
|
+
createSettingsConfigView,
|
|
109
106
|
loadConfig,
|
|
110
107
|
loadConfigForCheck,
|
|
111
108
|
loadPartialConfig,
|
|
112
109
|
loadSettingsConfig,
|
|
113
110
|
syncCheckConfigFingerprint,
|
|
114
111
|
syncConfigReviewIdentity
|
|
115
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-DAZZ5BEJ.ts";
|
|
113
|
+
import {
|
|
114
|
+
piDaemonClient
|
|
115
|
+
} from "./chunk-JQ5BAWW2.ts";
|
|
116
116
|
import {
|
|
117
117
|
configureSyncStatus
|
|
118
118
|
} from "./chunk-H7VOTY5N.ts";
|
|
@@ -221,7 +221,7 @@ function blockedSyncMenuItem(label, manager) {
|
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
223
|
async function showManagerAttention(ctx, attention, runRoute, signal, onSelectionResolved) {
|
|
224
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
224
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-WVMET5RI.ts");
|
|
225
225
|
if (signal?.aborted) return "close";
|
|
226
226
|
const review = await showRemoteSelectionReview(ctx, attention.decision.setupName, signal, void 0, {
|
|
227
227
|
decision: attention.decision,
|
|
@@ -309,20 +309,20 @@ function ignoreSetupRecovery(settingsPath) {
|
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
// src/ui/sync-setups-ui.ts
|
|
312
|
-
async function
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
async function hasAnotherSwitchableSetup(view, signal) {
|
|
313
|
+
for (const name of view.setupNames) {
|
|
314
|
+
if (name === view.activeSetupName) continue;
|
|
315
315
|
throwIfAborted(signal);
|
|
316
|
-
let valid = false;
|
|
317
316
|
try {
|
|
318
|
-
await
|
|
319
|
-
valid = true;
|
|
317
|
+
await view.observe(name, signal);
|
|
320
318
|
} catch {
|
|
319
|
+
throwIfAborted(signal);
|
|
320
|
+
continue;
|
|
321
321
|
}
|
|
322
322
|
throwIfAborted(signal);
|
|
323
|
-
|
|
323
|
+
return true;
|
|
324
324
|
}
|
|
325
|
-
return
|
|
325
|
+
return false;
|
|
326
326
|
}
|
|
327
327
|
async function showSyncSetups(ctx, actions, signal) {
|
|
328
328
|
const validateOwner = captureMutationOwner(ctx, signal);
|
|
@@ -540,8 +540,8 @@ function storageLocation(config) {
|
|
|
540
540
|
// src/ui/manager-state.ts
|
|
541
541
|
var MAIN_MENU_ACTIONS = [
|
|
542
542
|
"Sync now",
|
|
543
|
-
"Pull from remote
|
|
544
|
-
"Push to remote
|
|
543
|
+
"Pull from remote",
|
|
544
|
+
"Push to remote",
|
|
545
545
|
"View differences",
|
|
546
546
|
"Check remote status",
|
|
547
547
|
"Settings",
|
|
@@ -549,34 +549,35 @@ var MAIN_MENU_ACTIONS = [
|
|
|
549
549
|
"Diagnostics"
|
|
550
550
|
];
|
|
551
551
|
async function describeManagerState(signal, attention, inspectOperation = inspectOperationAvailability, observation, canUseIgnoreSettings) {
|
|
552
|
-
|
|
552
|
+
signal?.throwIfAborted();
|
|
553
|
+
let document;
|
|
554
|
+
let view;
|
|
553
555
|
try {
|
|
554
|
-
|
|
556
|
+
document = await readActiveLocalConfigDocumentForRepair();
|
|
555
557
|
signal?.throwIfAborted();
|
|
556
|
-
if (document)
|
|
558
|
+
if (document) view = createSettingsConfigView(document);
|
|
557
559
|
} catch (error) {
|
|
558
|
-
|
|
560
|
+
signal?.throwIfAborted();
|
|
559
561
|
return {
|
|
560
562
|
title: [
|
|
561
563
|
"Manage sync",
|
|
562
564
|
"",
|
|
563
565
|
"Settings file needs repair. Automatic sync and settings writes are paused.",
|
|
564
566
|
`Error: ${safeTerminalText(errorMessage(error))}`,
|
|
565
|
-
`File: ${safeTerminalText(
|
|
567
|
+
...document ? [`File: ${safeTerminalText(document.path)}`] : [],
|
|
566
568
|
"",
|
|
567
569
|
"Repair the JSON file, then reopen /sync."
|
|
568
570
|
].join("\n"),
|
|
569
571
|
actions: ["Help"]
|
|
570
572
|
};
|
|
571
573
|
}
|
|
572
|
-
if (!
|
|
574
|
+
if (!view || !document) {
|
|
573
575
|
return {
|
|
574
576
|
title: ["Manage sync", "", "Not set up.", "", "What do you want to do?"].join("\n"),
|
|
575
577
|
actions: ["Set up sync", "Help"]
|
|
576
578
|
};
|
|
577
579
|
}
|
|
578
|
-
|
|
579
|
-
if (Object.keys(configuredTargets).length === 0) {
|
|
580
|
+
if (view.setupNames.length === 0) {
|
|
580
581
|
return {
|
|
581
582
|
title: [
|
|
582
583
|
"Manage sync",
|
|
@@ -591,33 +592,38 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
|
|
|
591
592
|
}
|
|
592
593
|
let settingsConfig;
|
|
593
594
|
try {
|
|
594
|
-
settingsConfig =
|
|
595
|
+
settingsConfig = view.metadata();
|
|
595
596
|
if (settingsConfig.reservedIgnoreNames && canUseIgnoreSettings && !await canUseIgnoreSettings()) {
|
|
596
597
|
throw new Error("the connected daemon does not support ignore-file setups");
|
|
597
598
|
}
|
|
598
599
|
signal?.throwIfAborted();
|
|
599
|
-
const config = await
|
|
600
|
+
const config = await view.observe(void 0, signal);
|
|
600
601
|
signal?.throwIfAborted();
|
|
601
602
|
const operation = await inspectOperation();
|
|
603
|
+
signal?.throwIfAborted();
|
|
602
604
|
const changesBlocked = operationBlocksChanges(operation);
|
|
603
605
|
let currentAttention;
|
|
606
|
+
let alternateUsable = false;
|
|
604
607
|
if (attention) {
|
|
605
608
|
try {
|
|
606
|
-
const attentionConfig = attention.decision.setupName === config.setupName ? config : await
|
|
609
|
+
const attentionConfig = attention.decision.setupName === config.setupName ? config : await view.observe(attention.decision.setupName, signal);
|
|
610
|
+
alternateUsable = attentionConfig.setupName !== config.setupName;
|
|
607
611
|
if (syncAttentionMatchesConfig(attention, attentionConfig)) currentAttention = attention;
|
|
608
612
|
} catch {
|
|
609
613
|
currentAttention = void 0;
|
|
610
614
|
}
|
|
611
|
-
|
|
615
|
+
signal?.throwIfAborted();
|
|
612
616
|
}
|
|
613
617
|
const attentionComparison = currentAttention ? compareSyncInclude(currentAttention.decision.localInclude, currentAttention.decision.remoteInclude) : void 0;
|
|
614
618
|
const attentionExclusionsDiffer = currentAttention ? !sameSyncExclude(currentAttention.decision.localExclude, currentAttention.decision.remoteExclude) : false;
|
|
615
619
|
const attentionDirectoryPolicy = currentAttention?.decision.localDirectory || currentAttention?.decision.remoteDirectory;
|
|
616
620
|
const noSyncedContent = !syncSelectionHasContent(config);
|
|
617
621
|
const syncState = changesBlocked ? void 0 : await readStateForConfig(config).catch(() => void 0);
|
|
622
|
+
signal?.throwIfAborted();
|
|
618
623
|
const currentObservation = observation && observationMatchesConfig(observation, config) && syncState && syncStateFingerprint(syncState) === observation.inspection.stateIdentity ? observation : void 0;
|
|
619
624
|
const lastAppliedSnapshot = changesBlocked ? "Unavailable while operations are locked" : syncState?.lastAppliedSnapshot ? `${truncateToWidth(safeTerminalText(syncState.lastAppliedSnapshot), 12, "\u2026")} \xB7 application time unavailable` : syncState ? "Never synced" : "Unavailable";
|
|
620
|
-
const canSwitch = await
|
|
625
|
+
const canSwitch = !changesBlocked && (alternateUsable || await hasAnotherSwitchableSetup(view, signal));
|
|
626
|
+
signal?.throwIfAborted();
|
|
621
627
|
const mainActions = [...MAIN_MENU_ACTIONS];
|
|
622
628
|
if (config.agentMode && !noSyncedContent) mainActions.splice(1, 0, "Retry refused model result\u2026");
|
|
623
629
|
if (canSwitch) mainActions.push("Switch sync setup");
|
|
@@ -653,7 +659,7 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
|
|
|
653
659
|
} : {}
|
|
654
660
|
};
|
|
655
661
|
} catch (error) {
|
|
656
|
-
|
|
662
|
+
signal?.throwIfAborted();
|
|
657
663
|
if (settingsConfig?.reservedIgnoreNames !== void 0) {
|
|
658
664
|
return {
|
|
659
665
|
title: [
|
|
@@ -673,9 +679,9 @@ async function describeManagerState(signal, attention, inspectOperation = inspec
|
|
|
673
679
|
"Manage sync",
|
|
674
680
|
"",
|
|
675
681
|
"Settings need attention. Automatic sync is paused.",
|
|
676
|
-
`Current sync setup: ${safeTerminalText(
|
|
682
|
+
`Current sync setup: ${safeTerminalText(view.activeSetupName ?? "none")}`,
|
|
677
683
|
`Error: ${safeTerminalText(errorMessage(error))}`,
|
|
678
|
-
`File: ${safeTerminalText(
|
|
684
|
+
`File: ${safeTerminalText(document.path)}`,
|
|
679
685
|
"",
|
|
680
686
|
"What do you want to do?"
|
|
681
687
|
].join("\n"),
|
|
@@ -1715,8 +1721,8 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1715
1721
|
},
|
|
1716
1722
|
{
|
|
1717
1723
|
id: "debug",
|
|
1718
|
-
label: "Debug
|
|
1719
|
-
description: "
|
|
1724
|
+
label: "Debug mode",
|
|
1725
|
+
description: "Write startup timings and sync events to the local pi-sync.log. Pi applies this at the next session start; the daemon applies it at its next settings check.",
|
|
1720
1726
|
currentValue: state.debug ? "On" : "Off",
|
|
1721
1727
|
values: ["On", "Off"],
|
|
1722
1728
|
action: "debug"
|
|
@@ -2042,7 +2048,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
2042
2048
|
"remote-include": async ({ state, signal: actionSignal }) => {
|
|
2043
2049
|
if (state.reservedIgnoreNames !== void 0 && !ignoreAvailable) return { kind: "rejected" };
|
|
2044
2050
|
const reviewSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
2045
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
2051
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-WVMET5RI.ts");
|
|
2046
2052
|
if (reviewSignal.aborted) return { kind: "rejected" };
|
|
2047
2053
|
const review = await showRemoteSelectionReview(ctx, setupName, reviewSignal, void 0, {
|
|
2048
2054
|
origin: "settings",
|
|
@@ -2133,6 +2139,26 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
2133
2139
|
return false;
|
|
2134
2140
|
}
|
|
2135
2141
|
};
|
|
2142
|
+
const directionalAction = async (direction, state, signal) => {
|
|
2143
|
+
const review = state.manager.configReview;
|
|
2144
|
+
if (!review) return { kind: "stay" };
|
|
2145
|
+
const result = await runCancellableOperation(
|
|
2146
|
+
ctx,
|
|
2147
|
+
direction === "push" ? "Pushing to remote\u2026" : "Pulling from remote\u2026",
|
|
2148
|
+
direction,
|
|
2149
|
+
runRoute,
|
|
2150
|
+
{
|
|
2151
|
+
commitAware: true,
|
|
2152
|
+
cancelledMessage: direction === "push" ? "Push cancellation requested." : "Pull cancellation requested.",
|
|
2153
|
+
target: review.setupName,
|
|
2154
|
+
directionalFingerprint: review.fingerprint,
|
|
2155
|
+
signal,
|
|
2156
|
+
isCurrent
|
|
2157
|
+
}
|
|
2158
|
+
);
|
|
2159
|
+
const done = result.kind === "closed" || result.kind === "completed" && result.outcome === "applied" || result.kind === "failed" && options.needsDaemonRecovery?.();
|
|
2160
|
+
return done ? { kind: "close" } : { kind: "stay" };
|
|
2161
|
+
};
|
|
2136
2162
|
const menuItems = (manager) => {
|
|
2137
2163
|
const attentionItems = attentionMainMenuItems(manager);
|
|
2138
2164
|
const managerItems = manager.actions.map((label) => blockedSyncMenuItem(label, manager) ?? syncMainMenuItem(label));
|
|
@@ -2178,7 +2204,7 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
2178
2204
|
if (!attention) {
|
|
2179
2205
|
const observation = state.manager.observation;
|
|
2180
2206
|
if (!observation) return { kind: "stay" };
|
|
2181
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
2207
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-WVMET5RI.ts");
|
|
2182
2208
|
if (sessionSignal?.aborted) return { kind: "close" };
|
|
2183
2209
|
const config = await loadConfig();
|
|
2184
2210
|
if (sessionSignal?.aborted) return { kind: "close" };
|
|
@@ -2254,26 +2280,8 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
2254
2280
|
const result = await showSyncSettings(ctx, runRoute, signal, review?.setupName);
|
|
2255
2281
|
return { kind: result === "exit" ? "close" : "stay" };
|
|
2256
2282
|
},
|
|
2257
|
-
pull:
|
|
2258
|
-
|
|
2259
|
-
commitAware: true,
|
|
2260
|
-
cancelledMessage: "Pull check cancelled; no local files were changed.",
|
|
2261
|
-
target: state.manager.configReview?.setupName,
|
|
2262
|
-
signal: sessionSignal
|
|
2263
|
-
});
|
|
2264
|
-
const disposition = await dispatchManagerResult(ctx, result, "pull", runRoute, sessionSignal);
|
|
2265
|
-
return disposition.kind === "close" ? { kind: "close" } : { kind: "stay" };
|
|
2266
|
-
},
|
|
2267
|
-
push: async ({ state }) => {
|
|
2268
|
-
const result = await runCancellableOperation(ctx, "Preparing push preview\u2026", "push", runRoute, {
|
|
2269
|
-
commitAware: true,
|
|
2270
|
-
cancelledMessage: "Push preparation cancelled; no remote files were changed.",
|
|
2271
|
-
target: state.manager.configReview?.setupName,
|
|
2272
|
-
signal: sessionSignal
|
|
2273
|
-
});
|
|
2274
|
-
const disposition = await dispatchManagerResult(ctx, result, "push", runRoute, sessionSignal);
|
|
2275
|
-
return disposition.kind === "close" ? { kind: "close" } : { kind: "stay" };
|
|
2276
|
-
},
|
|
2283
|
+
pull: ({ state, signal }) => directionalAction("pull", state, signal),
|
|
2284
|
+
push: ({ state, signal }) => directionalAction("push", state, signal),
|
|
2277
2285
|
setups: async () => {
|
|
2278
2286
|
const result = await showSyncSetupManager(ctx, runRoute, sessionSignal);
|
|
2279
2287
|
return result === "exit" ? { kind: "close" } : { kind: "stay" };
|
|
@@ -2357,6 +2365,10 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
|
|
|
2357
2365
|
});
|
|
2358
2366
|
return { kind: result.kind === "closed" ? "close" : "stay" };
|
|
2359
2367
|
},
|
|
2368
|
+
"daemon-recovery": async ({ signal }) => {
|
|
2369
|
+
await runRoute("daemon recover", signal);
|
|
2370
|
+
return { kind: "stay" };
|
|
2371
|
+
},
|
|
2360
2372
|
recover: async ({ state, signal: actionSignal }) => {
|
|
2361
2373
|
const result = await recoverSyncAccess(ctx, state.manager, runRoute, sessionSignal, actionSignal);
|
|
2362
2374
|
return { kind: result === "close" ? "close" : "stay" };
|
|
@@ -2434,7 +2446,12 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
|
|
|
2434
2446
|
}
|
|
2435
2447
|
};
|
|
2436
2448
|
let firstOpen = true;
|
|
2449
|
+
const recovery = {
|
|
2450
|
+
title: "Pi Sync recovery required\nDaemon cleanup could not be confirmed. Stop the daemon before retrying a transfer.",
|
|
2451
|
+
actions: ["Stop daemon for recovery\u2026", "Help"]
|
|
2452
|
+
};
|
|
2437
2453
|
const describe = async (signal) => {
|
|
2454
|
+
if (options.needsDaemonRecovery?.()) return recovery;
|
|
2438
2455
|
const pendingAttention = options.getAttention?.();
|
|
2439
2456
|
const observation = options.getObservation?.();
|
|
2440
2457
|
const manager = await describeManagerState(
|
|
@@ -2445,6 +2462,7 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
|
|
|
2445
2462
|
() => ignoreFileSettingsAvailable(ctx, signal)
|
|
2446
2463
|
);
|
|
2447
2464
|
if (signal.aborted || !isCurrent()) return manager;
|
|
2465
|
+
if (options.needsDaemonRecovery?.()) return recovery;
|
|
2448
2466
|
if (observation && options.getObservation?.() === observation && !manager.observation && !(manager.operation && operationBlocksChanges(manager.operation))) {
|
|
2449
2467
|
options.onObservationInvalidated?.();
|
|
2450
2468
|
}
|
|
@@ -2471,8 +2489,8 @@ function syncMainMenuItem(label) {
|
|
|
2471
2489
|
const actions = {
|
|
2472
2490
|
"Sync now": "sync",
|
|
2473
2491
|
"Retry refused model result\u2026": "retry-refusal",
|
|
2474
|
-
"Pull from remote
|
|
2475
|
-
"Push to remote
|
|
2492
|
+
"Pull from remote": "pull",
|
|
2493
|
+
"Push to remote": "push",
|
|
2476
2494
|
"View differences": "diff",
|
|
2477
2495
|
"Check remote status": "status",
|
|
2478
2496
|
"Switch sync setup": "switch",
|
|
@@ -2481,6 +2499,7 @@ function syncMainMenuItem(label) {
|
|
|
2481
2499
|
Diagnostics: "doctor",
|
|
2482
2500
|
"Review unresolved conflicts": "conflicts",
|
|
2483
2501
|
"Restore sync access\u2026 (recommended)": "recover",
|
|
2502
|
+
"Stop daemon for recovery\u2026": "daemon-recovery",
|
|
2484
2503
|
"Refresh operation status": "refresh",
|
|
2485
2504
|
"Sync setups\u2026": "setups",
|
|
2486
2505
|
"Storage connections\u2026": "connections",
|
|
@@ -2497,8 +2516,8 @@ function syncMainMenuItem(label) {
|
|
|
2497
2516
|
description: {
|
|
2498
2517
|
sync: "Merge changes on both sides.",
|
|
2499
2518
|
"retry-refusal": "Retry model; may incur costs.",
|
|
2500
|
-
pull: "Remote \u2192 this device.",
|
|
2501
|
-
push: "This device \u2192 remote
|
|
2519
|
+
pull: "Remote \u2192 this device; replaces conflicting local files.",
|
|
2520
|
+
push: "This device \u2192 remote; replaces conflicting remote files.",
|
|
2502
2521
|
diff: "Inspect changes; no transfer.",
|
|
2503
2522
|
status: "Check remote; no transfer.",
|
|
2504
2523
|
settings: "Change sync settings.",
|
|
@@ -2507,6 +2526,7 @@ function syncMainMenuItem(label) {
|
|
|
2507
2526
|
switch: "Choose another sync setup.",
|
|
2508
2527
|
conflicts: "Review unresolved file groups.",
|
|
2509
2528
|
recover: "Review local lock recovery.",
|
|
2529
|
+
"daemon-recovery": "Review and stop the current daemon without starting another.",
|
|
2510
2530
|
refresh: "Recheck the operation lock.",
|
|
2511
2531
|
setups: "Manage sync setups.",
|
|
2512
2532
|
connections: "Manage storage connections.",
|
|
@@ -2518,4 +2538,4 @@ function syncMainMenuItem(label) {
|
|
|
2518
2538
|
export {
|
|
2519
2539
|
showSyncManager
|
|
2520
2540
|
};
|
|
2521
|
-
//# sourceMappingURL=manager-ui-
|
|
2541
|
+
//# sourceMappingURL=manager-ui-RGA26Z6G.ts.map
|