@narumitw/pi-sync 0.63.0 → 0.64.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 +24 -0
- package/README.md +28 -18
- package/dist/chunks/{chunk-HLCML3OW.ts → chunk-4VKWHVUO.ts} +4 -3
- package/dist/chunks/chunk-4VKWHVUO.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-V76KCWHO.ts → chunk-F3VODLVQ.ts} +3 -3
- package/dist/chunks/{chunk-VQ47JBLF.ts → chunk-FI2F5JBS.ts} +2 -2
- package/dist/chunks/{chunk-S6FUUWV5.ts → chunk-NDEZ52SS.ts} +13 -13
- package/dist/chunks/{chunk-S6FUUWV5.ts.map → chunk-NDEZ52SS.ts.map} +1 -1
- package/dist/chunks/{chunk-UGS6RYDZ.ts → chunk-RW44KNFD.ts} +304 -70
- package/dist/chunks/chunk-RW44KNFD.ts.map +7 -0
- package/dist/chunks/{chunk-EXDWEFIJ.ts → chunk-TJ7YNITN.ts} +5 -5
- package/dist/chunks/{chunk-HSCAFOT5.ts → chunk-TZMVSTAM.ts} +5 -5
- package/dist/chunks/{chunk-SXCH4Q5O.ts → chunk-VPSC7BXM.ts} +3 -3
- package/dist/chunks/chunk-YT6PDRMM.ts +282 -0
- package/dist/chunks/chunk-YT6PDRMM.ts.map +7 -0
- package/dist/chunks/{command-handler-VINMQ7ZM.ts → command-handler-N45GY7AV.ts} +39 -27
- package/dist/chunks/command-handler-N45GY7AV.ts.map +7 -0
- package/dist/chunks/{conflict-review-PCDFRIVB.ts → conflict-review-5E4M44BA.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-FKW55L7I.ts} +5 -5
- package/dist/chunks/{manager-ui-YHDECYKI.ts → manager-ui-EV23DPZQ.ts} +104 -77
- package/dist/chunks/manager-ui-EV23DPZQ.ts.map +7 -0
- package/dist/chunks/{merge-review-SGDLMVS4.ts → merge-review-6YSLSMGS.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-N4NMWFT2.ts} +4 -4
- package/dist/chunks/{setup-switch-L54X5U5I.ts → setup-switch-HY7K3442.ts} +4 -4
- package/dist/chunks/{setup-wizard-YO4MCPUF.ts → setup-wizard-LEKDQ3HK.ts} +9 -9
- package/dist/chunks/{sync-inspection-H2WX5SUT.ts → sync-inspection-OS2LVOLV.ts} +5 -5
- package/dist/chunks/{sync-operations-2MZAYHL2.ts → sync-operations-D3MDJUQQ.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 +116 -86
- package/dist/daemon/dist/consent.js +33 -11
- package/dist/daemon/dist/daemon-debug.js +33 -0
- package/dist/daemon/dist/daemon-recovery.js +75 -0
- package/dist/daemon/dist/engine/backends/git/git-backend.js +39 -12
- 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 +10 -12
- package/dist/daemon/dist/engine/backends/webdav/webdav-backend.js +15 -26
- 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/ignore/ignore-initialization.js +50 -14
- package/dist/daemon/dist/engine/ignore/ignore-settings.js +11 -14
- package/dist/daemon/dist/engine/ignore/ignore-source.js +1 -1
- 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/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 +18 -3
- 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 +22 -4
- package/dist/daemon/dist/engine/sync/sync-inspection.js +4 -7
- package/dist/daemon/dist/engine/sync/sync-local.js +3 -1
- package/dist/daemon/dist/engine/sync/sync-mutations.js +13 -7
- package/dist/daemon/dist/engine/sync/sync-policy.js +9 -1
- package/dist/daemon/dist/engine/sync/sync-state.js +12 -4
- package/dist/daemon/dist/engine/ui/sync-format.js +23 -55
- package/dist/daemon/dist/engine/ui/transfer-review.js +3 -3
- package/dist/daemon/dist/engine-service.js +54 -10
- package/dist/daemon/dist/identity.js +36 -6
- package/dist/daemon/dist/index.js +2 -1
- package/dist/daemon/dist/monitor.js +20 -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 +268 -120
- package/dist/daemon/dist/service-host.js +29 -9
- 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 +30 -2
- package/docs/tui-contract.md +8 -2
- package/package.json +2 -2
- package/skills/configure-pi-sync/SKILL.md +119 -18
- package/skills/configure-pi-sync/references/configuration.md +88 -48
- package/src/commands/command-execution.ts +11 -3
- package/src/commands/command-handler.ts +10 -3
- package/src/commands/command.ts +3 -2
- package/src/daemon/client-debug.ts +45 -0
- package/src/daemon/ownership-recovery.ts +50 -0
- package/src/daemon/pi-client.ts +288 -63
- 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/manager-state.ts +35 -24
- package/src/ui/manager-ui.ts +39 -18
- package/src/ui/merge-review.ts +75 -12
- package/src/ui/settings-ui.ts +2 -2
- package/src/ui/setup/webdav-ui.ts +1 -1
- package/src/ui/sync-confirmation.ts +81 -65
- package/src/ui/sync-setups-ui.ts +15 -12
- package/dist/chunks/chunk-27F5W7DX.ts.map +0 -7
- package/dist/chunks/chunk-GSQGBVKG.ts +0 -218
- package/dist/chunks/chunk-GSQGBVKG.ts.map +0 -7
- package/dist/chunks/chunk-HLCML3OW.ts.map +0 -7
- package/dist/chunks/chunk-UGS6RYDZ.ts.map +0 -7
- package/dist/chunks/command-handler-VINMQ7ZM.ts.map +0 -7
- package/dist/chunks/manager-ui-YHDECYKI.ts.map +0 -7
- /package/dist/chunks/{chunk-V76KCWHO.ts.map → chunk-F3VODLVQ.ts.map} +0 -0
- /package/dist/chunks/{chunk-VQ47JBLF.ts.map → chunk-FI2F5JBS.ts.map} +0 -0
- /package/dist/chunks/{chunk-EXDWEFIJ.ts.map → chunk-TJ7YNITN.ts.map} +0 -0
- /package/dist/chunks/{chunk-HSCAFOT5.ts.map → chunk-TZMVSTAM.ts.map} +0 -0
- /package/dist/chunks/{chunk-SXCH4Q5O.ts.map → chunk-VPSC7BXM.ts.map} +0 -0
- /package/dist/chunks/{conflict-review-PCDFRIVB.ts.map → conflict-review-5E4M44BA.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-FKW55L7I.ts.map} +0 -0
- /package/dist/chunks/{merge-review-SGDLMVS4.ts.map → merge-review-6YSLSMGS.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-GPITNEBF.ts.map → remote-selection-ui-N4NMWFT2.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-L54X5U5I.ts.map → setup-switch-HY7K3442.ts.map} +0 -0
- /package/dist/chunks/{setup-wizard-YO4MCPUF.ts.map → setup-wizard-LEKDQ3HK.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-H2WX5SUT.ts.map → sync-inspection-OS2LVOLV.ts.map} +0 -0
- /package/dist/chunks/{sync-operations-2MZAYHL2.ts.map → sync-operations-D3MDJUQQ.ts.map} +0 -0
|
@@ -20,17 +20,18 @@ import {
|
|
|
20
20
|
showEditWebDavStorageProfile,
|
|
21
21
|
showEditWebDavTarget,
|
|
22
22
|
showIgnoreFileAction
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-NDEZ52SS.ts";
|
|
24
24
|
import {
|
|
25
25
|
dispatchManagerResult
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-F3VODLVQ.ts";
|
|
27
|
+
import "./chunk-TJ7YNITN.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-VPSC7BXM.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-4VKWHVUO.ts";
|
|
64
68
|
import {
|
|
65
69
|
confirmMergeReview
|
|
66
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-YT6PDRMM.ts";
|
|
71
|
+
import {
|
|
72
|
+
runCancellableOperation
|
|
73
|
+
} from "./chunk-CKUGCBHP.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-UGS6RYDZ.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-RW44KNFD.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-N4NMWFT2.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);
|
|
@@ -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"),
|
|
@@ -749,12 +755,15 @@ function backendStorageDescription(config) {
|
|
|
749
755
|
switch (config.backend.type) {
|
|
750
756
|
case "s3": {
|
|
751
757
|
const type = config.backend.profile.kind === "r2" || isCloudflareR2Endpoint(config.backend.profile.endpoint) ? "Cloudflare R2" : "S3-compatible";
|
|
752
|
-
|
|
758
|
+
const { bucket, prefix } = config.backend.destination;
|
|
759
|
+
return `${type} \xB7 ${connection} \xB7 ${safeTerminalText(bucket)} \xB7 ${safeTerminalText(prefix)}`;
|
|
753
760
|
}
|
|
754
761
|
case "webdav":
|
|
755
762
|
return `WebDAV \xB7 ${connection} \xB7 ${safeTerminalText(config.backend.destination.path)}`;
|
|
756
|
-
case "git":
|
|
757
|
-
|
|
763
|
+
case "git": {
|
|
764
|
+
const { branch, directory } = config.backend.destination;
|
|
765
|
+
return `Git \xB7 ${connection} \xB7 ${safeTerminalText(branch)} \xB7 ${safeTerminalText(directory)}`;
|
|
766
|
+
}
|
|
758
767
|
}
|
|
759
768
|
}
|
|
760
769
|
|
|
@@ -1712,8 +1721,8 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
1712
1721
|
},
|
|
1713
1722
|
{
|
|
1714
1723
|
id: "debug",
|
|
1715
|
-
label: "Debug
|
|
1716
|
-
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.",
|
|
1717
1726
|
currentValue: state.debug ? "On" : "Off",
|
|
1718
1727
|
values: ["On", "Off"],
|
|
1719
1728
|
action: "debug"
|
|
@@ -2039,7 +2048,7 @@ async function showSyncSettings(ctx, runRoute, signal, reviewedSetup) {
|
|
|
2039
2048
|
"remote-include": async ({ state, signal: actionSignal }) => {
|
|
2040
2049
|
if (state.reservedIgnoreNames !== void 0 && !ignoreAvailable) return { kind: "rejected" };
|
|
2041
2050
|
const reviewSignal = signal ? AbortSignal.any([signal, actionSignal]) : actionSignal;
|
|
2042
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
2051
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-N4NMWFT2.ts");
|
|
2043
2052
|
if (reviewSignal.aborted) return { kind: "rejected" };
|
|
2044
2053
|
const review = await showRemoteSelectionReview(ctx, setupName, reviewSignal, void 0, {
|
|
2045
2054
|
origin: "settings",
|
|
@@ -2139,23 +2148,29 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
2139
2148
|
const menu = defineMenu5({
|
|
2140
2149
|
start: "main",
|
|
2141
2150
|
screens: {
|
|
2142
|
-
main: ({ state }) =>
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2151
|
+
main: ({ state: { manager } }) => {
|
|
2152
|
+
const [title = "Manage sync", ...lines] = manager.title.split("\n");
|
|
2153
|
+
const setupName = ctx.mode === "tui" ? manager.configReview?.setupName : void 0;
|
|
2154
|
+
const setup = setupName === void 0 ? void 0 : safeTerminalText(setupName);
|
|
2155
|
+
const setupInHeading = setup !== void 0 && lines[0] === `Current sync setup: ${setup}`;
|
|
2156
|
+
return {
|
|
2157
|
+
kind: "choice",
|
|
2158
|
+
title: setupInHeading ? `${title} \xB7 ${setup}` : title,
|
|
2159
|
+
lines: setupInHeading ? lines.slice(1) : lines,
|
|
2160
|
+
items: menuItems(manager).map((item) => ({
|
|
2161
|
+
id: item.id,
|
|
2162
|
+
label: ctx.mode === "tui" && item.id === "sync" ? "Sync\u2026" : item.label,
|
|
2163
|
+
details: [item.description ?? "Review synced content."],
|
|
2164
|
+
searchText: `${item.label} ${item.description ?? ""}`,
|
|
2165
|
+
disabled: item.disabled,
|
|
2166
|
+
disabledReason: item.disabledReason
|
|
2167
|
+
})),
|
|
2168
|
+
action: "activate",
|
|
2169
|
+
enableSearch: true,
|
|
2170
|
+
viewportSize: 5,
|
|
2171
|
+
hint: "close"
|
|
2172
|
+
};
|
|
2173
|
+
}
|
|
2159
2174
|
},
|
|
2160
2175
|
actions: {
|
|
2161
2176
|
activate: async (invocation) => {
|
|
@@ -2169,7 +2184,7 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
|
|
|
2169
2184
|
if (!attention) {
|
|
2170
2185
|
const observation = state.manager.observation;
|
|
2171
2186
|
if (!observation) return { kind: "stay" };
|
|
2172
|
-
const { showRemoteSelectionReview } = await import("./remote-selection-ui-
|
|
2187
|
+
const { showRemoteSelectionReview } = await import("./remote-selection-ui-N4NMWFT2.ts");
|
|
2173
2188
|
if (sessionSignal?.aborted) return { kind: "close" };
|
|
2174
2189
|
const config = await loadConfig();
|
|
2175
2190
|
if (sessionSignal?.aborted) return { kind: "close" };
|
|
@@ -2348,6 +2363,10 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
|
|
|
2348
2363
|
});
|
|
2349
2364
|
return { kind: result.kind === "closed" ? "close" : "stay" };
|
|
2350
2365
|
},
|
|
2366
|
+
"daemon-recovery": async ({ signal }) => {
|
|
2367
|
+
await runRoute("daemon recover", signal);
|
|
2368
|
+
return { kind: "stay" };
|
|
2369
|
+
},
|
|
2351
2370
|
recover: async ({ state, signal: actionSignal }) => {
|
|
2352
2371
|
const result = await recoverSyncAccess(ctx, state.manager, runRoute, sessionSignal, actionSignal);
|
|
2353
2372
|
return { kind: result === "close" ? "close" : "stay" };
|
|
@@ -2425,7 +2444,12 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
|
|
|
2425
2444
|
}
|
|
2426
2445
|
};
|
|
2427
2446
|
let firstOpen = true;
|
|
2447
|
+
const recovery = {
|
|
2448
|
+
title: "Pi Sync recovery required\nDaemon cleanup could not be confirmed. Stop the daemon before retrying a transfer.",
|
|
2449
|
+
actions: ["Stop daemon for recovery\u2026", "Help"]
|
|
2450
|
+
};
|
|
2428
2451
|
const describe = async (signal) => {
|
|
2452
|
+
if (options.needsDaemonRecovery?.()) return recovery;
|
|
2429
2453
|
const pendingAttention = options.getAttention?.();
|
|
2430
2454
|
const observation = options.getObservation?.();
|
|
2431
2455
|
const manager = await describeManagerState(
|
|
@@ -2436,6 +2460,7 @@ S3/R2 reads the latest pointer without writing. Git reads remote snapshots and c
|
|
|
2436
2460
|
() => ignoreFileSettingsAvailable(ctx, signal)
|
|
2437
2461
|
);
|
|
2438
2462
|
if (signal.aborted || !isCurrent()) return manager;
|
|
2463
|
+
if (options.needsDaemonRecovery?.()) return recovery;
|
|
2439
2464
|
if (observation && options.getObservation?.() === observation && !manager.observation && !(manager.operation && operationBlocksChanges(manager.operation))) {
|
|
2440
2465
|
options.onObservationInvalidated?.();
|
|
2441
2466
|
}
|
|
@@ -2472,6 +2497,7 @@ function syncMainMenuItem(label) {
|
|
|
2472
2497
|
Diagnostics: "doctor",
|
|
2473
2498
|
"Review unresolved conflicts": "conflicts",
|
|
2474
2499
|
"Restore sync access\u2026 (recommended)": "recover",
|
|
2500
|
+
"Stop daemon for recovery\u2026": "daemon-recovery",
|
|
2475
2501
|
"Refresh operation status": "refresh",
|
|
2476
2502
|
"Sync setups\u2026": "setups",
|
|
2477
2503
|
"Storage connections\u2026": "connections",
|
|
@@ -2498,6 +2524,7 @@ function syncMainMenuItem(label) {
|
|
|
2498
2524
|
switch: "Choose another sync setup.",
|
|
2499
2525
|
conflicts: "Review unresolved file groups.",
|
|
2500
2526
|
recover: "Review local lock recovery.",
|
|
2527
|
+
"daemon-recovery": "Review and stop the current daemon without starting another.",
|
|
2501
2528
|
refresh: "Recheck the operation lock.",
|
|
2502
2529
|
setups: "Manage sync setups.",
|
|
2503
2530
|
connections: "Manage storage connections.",
|
|
@@ -2509,4 +2536,4 @@ function syncMainMenuItem(label) {
|
|
|
2509
2536
|
export {
|
|
2510
2537
|
showSyncManager
|
|
2511
2538
|
};
|
|
2512
|
-
//# sourceMappingURL=manager-ui-
|
|
2539
|
+
//# sourceMappingURL=manager-ui-EV23DPZQ.ts.map
|