@narumitw/pi-sync 0.54.1 → 0.54.3
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/README.md +19 -11
- package/dist/chunks/{chunk-ORQRHEEO.ts → chunk-26PMXY7E.ts} +3 -3
- package/dist/chunks/{chunk-SDZCTCYQ.ts → chunk-2FETCGGT.ts} +2 -2
- package/dist/chunks/{chunk-HUTYAPFP.ts → chunk-35GM6XKM.ts} +275 -151
- package/dist/chunks/chunk-35GM6XKM.ts.map +7 -0
- package/dist/chunks/{chunk-V6VZ5TLG.ts → chunk-A3TFXY4O.ts} +2 -2
- package/dist/chunks/{chunk-5RZPINUQ.ts → chunk-AAZDBIBJ.ts} +2 -2
- package/dist/chunks/{chunk-5ZWQ33XL.ts → chunk-CAGJOKB7.ts} +5 -5
- package/dist/chunks/{chunk-QE7NZZWT.ts → chunk-E6ONFG57.ts} +15 -2
- package/dist/chunks/{chunk-QE7NZZWT.ts.map → chunk-E6ONFG57.ts.map} +2 -2
- package/dist/chunks/{chunk-IJ6VV6FN.ts → chunk-GC3QOL6J.ts} +2 -2
- package/dist/chunks/{chunk-VHXBCEVF.ts → chunk-HMXUKU43.ts} +3 -3
- package/dist/chunks/{chunk-4SBTAVFL.ts → chunk-I4JYVFUS.ts} +5 -6
- package/dist/chunks/chunk-I4JYVFUS.ts.map +7 -0
- package/dist/chunks/{chunk-2DI6PDZV.ts → chunk-ITFR6NNQ.ts} +14 -2
- package/dist/chunks/chunk-ITFR6NNQ.ts.map +7 -0
- package/dist/chunks/{chunk-3B4Z2SKV.ts → chunk-KATKRR3D.ts} +18 -11
- package/dist/chunks/chunk-KATKRR3D.ts.map +7 -0
- package/dist/chunks/{chunk-ANWNQIR7.ts → chunk-KGE47GCZ.ts} +4 -4
- package/dist/chunks/chunk-KGE47GCZ.ts.map +7 -0
- package/dist/chunks/{chunk-CHSIAC4N.ts → chunk-R35N4CL3.ts} +2 -2
- package/dist/chunks/chunk-UZPMDLTL.ts +54 -0
- package/dist/chunks/chunk-UZPMDLTL.ts.map +7 -0
- package/dist/chunks/{chunk-4QVPTIZB.ts → chunk-VCL7TZYW.ts} +2 -2
- package/dist/chunks/{chunk-WFKUKVCP.ts → chunk-XU2VXGQV.ts} +14 -8
- package/dist/chunks/chunk-XU2VXGQV.ts.map +7 -0
- package/dist/chunks/{chunk-UQ3ALBIB.ts → chunk-YTHQEW35.ts} +3 -3
- package/dist/chunks/{conflict-artifacts-BB2FZMIE.ts → conflict-artifacts-4CZFB7WI.ts} +3 -3
- package/dist/chunks/{conflict-review-JRFJIBEN.ts → conflict-review-ZOTOHL2E.ts} +11 -10
- package/dist/chunks/{conflict-review-JRFJIBEN.ts.map → conflict-review-ZOTOHL2E.ts.map} +1 -1
- package/dist/chunks/{file-selection-WZX7HAY2.ts → file-selection-UNHBVVON.ts} +3 -3
- package/dist/chunks/{manager-result-dispatcher-6MQKFCWB.ts → manager-result-dispatcher-HVRTPEVK.ts} +7 -7
- package/dist/chunks/{manager-ui-IURS4WXY.ts → manager-ui-ZIN4BUSF.ts} +297 -136
- package/dist/chunks/manager-ui-ZIN4BUSF.ts.map +7 -0
- package/dist/chunks/{merge-baseline-store-EVQAAML6.ts → merge-baseline-store-ICXVTCML.ts} +5 -3
- package/dist/chunks/{remote-selection-ui-6LJJ4IMQ.ts → remote-selection-ui-H6AEVA3Q.ts} +6 -6
- package/dist/chunks/{s3-backend-AQGV6LFT.ts → s3-backend-Y4P3O5B5.ts} +2 -2
- package/dist/chunks/{setup-switch-KTUWL6DE.ts → setup-switch-ZMW5C4M7.ts} +4 -4
- package/dist/chunks/{setup-wizard-GSDPDFC4.ts → setup-wizard-VW7F3JN4.ts} +5 -5
- package/dist/chunks/{sync-inspection-K45QVLHB.ts → sync-inspection-3EMS2J5B.ts} +5 -4
- package/dist/chunks/{sync-operations-QQ2GXKVC.ts → sync-operations-2CWST333.ts} +140 -24
- package/dist/chunks/sync-operations-2CWST333.ts.map +7 -0
- package/dist/index.ts +103 -68
- package/dist/index.ts.map +2 -2
- package/docs/settings.md +47 -10
- package/docs/tui-contract.md +61 -0
- package/package.json +1 -1
- package/src/commands/command-execution.ts +2 -1
- package/src/commands/command-types.ts +4 -0
- package/src/commands/command.ts +3 -1
- package/src/settings/config.ts +13 -10
- package/src/settings/settings-store.ts +1 -0
- package/src/settings/settings-types.ts +2 -0
- package/src/settings/settings-validation.ts +3 -0
- package/src/snapshot/snapshot-transaction.ts +4 -2
- package/src/state/merge-baseline-store.ts +18 -0
- package/src/sync/apply-review.ts +63 -0
- package/src/sync/automatic-sync.ts +45 -33
- package/src/sync/merged-sync.ts +202 -104
- package/src/sync/startup-check.ts +39 -21
- package/src/sync/startup-timings.ts +90 -0
- package/src/sync/sync-inspection.ts +8 -4
- package/src/sync/sync-mutations.ts +49 -11
- package/src/sync/sync-queries.ts +14 -3
- package/src/ui/manager-state.ts +10 -6
- package/src/ui/manager-ui.ts +57 -7
- package/src/ui/merge-review.ts +3 -3
- package/src/ui/merged-sync-summary.ts +2 -18
- package/src/ui/settings-frame.ts +55 -0
- package/src/ui/settings-ui.ts +141 -43
- package/src/ui/setup/setup-prompts.ts +4 -3
- package/src/ui/sync-behavior.ts +15 -0
- package/src/ui/sync-format.ts +69 -38
- package/src/ui/transfer-changes.ts +33 -0
- package/src/ui/transfer-review.ts +27 -0
- package/dist/chunks/chunk-2DI6PDZV.ts.map +0 -7
- package/dist/chunks/chunk-3B4Z2SKV.ts.map +0 -7
- package/dist/chunks/chunk-4SBTAVFL.ts.map +0 -7
- package/dist/chunks/chunk-ANWNQIR7.ts.map +0 -7
- package/dist/chunks/chunk-HUTYAPFP.ts.map +0 -7
- package/dist/chunks/chunk-WFKUKVCP.ts.map +0 -7
- package/dist/chunks/manager-ui-IURS4WXY.ts.map +0 -7
- package/dist/chunks/sync-operations-QQ2GXKVC.ts.map +0 -7
- /package/dist/chunks/{chunk-ORQRHEEO.ts.map → chunk-26PMXY7E.ts.map} +0 -0
- /package/dist/chunks/{chunk-SDZCTCYQ.ts.map → chunk-2FETCGGT.ts.map} +0 -0
- /package/dist/chunks/{chunk-V6VZ5TLG.ts.map → chunk-A3TFXY4O.ts.map} +0 -0
- /package/dist/chunks/{chunk-5RZPINUQ.ts.map → chunk-AAZDBIBJ.ts.map} +0 -0
- /package/dist/chunks/{chunk-5ZWQ33XL.ts.map → chunk-CAGJOKB7.ts.map} +0 -0
- /package/dist/chunks/{chunk-IJ6VV6FN.ts.map → chunk-GC3QOL6J.ts.map} +0 -0
- /package/dist/chunks/{chunk-VHXBCEVF.ts.map → chunk-HMXUKU43.ts.map} +0 -0
- /package/dist/chunks/{chunk-CHSIAC4N.ts.map → chunk-R35N4CL3.ts.map} +0 -0
- /package/dist/chunks/{chunk-4QVPTIZB.ts.map → chunk-VCL7TZYW.ts.map} +0 -0
- /package/dist/chunks/{chunk-UQ3ALBIB.ts.map → chunk-YTHQEW35.ts.map} +0 -0
- /package/dist/chunks/{conflict-artifacts-BB2FZMIE.ts.map → conflict-artifacts-4CZFB7WI.ts.map} +0 -0
- /package/dist/chunks/{file-selection-WZX7HAY2.ts.map → file-selection-UNHBVVON.ts.map} +0 -0
- /package/dist/chunks/{manager-result-dispatcher-6MQKFCWB.ts.map → manager-result-dispatcher-HVRTPEVK.ts.map} +0 -0
- /package/dist/chunks/{merge-baseline-store-EVQAAML6.ts.map → merge-baseline-store-ICXVTCML.ts.map} +0 -0
- /package/dist/chunks/{remote-selection-ui-6LJJ4IMQ.ts.map → remote-selection-ui-H6AEVA3Q.ts.map} +0 -0
- /package/dist/chunks/{s3-backend-AQGV6LFT.ts.map → s3-backend-Y4P3O5B5.ts.map} +0 -0
- /package/dist/chunks/{setup-switch-KTUWL6DE.ts.map → setup-switch-ZMW5C4M7.ts.map} +0 -0
- /package/dist/chunks/{setup-wizard-GSDPDFC4.ts.map → setup-wizard-VW7F3JN4.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-K45QVLHB.ts.map → sync-inspection-3EMS2J5B.ts.map} +0 -0
package/dist/index.ts
CHANGED
|
@@ -4,15 +4,18 @@ import {
|
|
|
4
4
|
createSyncAttentionController,
|
|
5
5
|
observationMatchesConfig,
|
|
6
6
|
syncAttentionMatchesConfig
|
|
7
|
-
} from "./chunks/chunk-
|
|
7
|
+
} from "./chunks/chunk-AAZDBIBJ.ts";
|
|
8
8
|
import {
|
|
9
9
|
recoverSnapshotTransactionsOnStartup
|
|
10
|
-
} from "./chunks/chunk-
|
|
10
|
+
} from "./chunks/chunk-KGE47GCZ.ts";
|
|
11
11
|
import {
|
|
12
12
|
captureMutationOwner,
|
|
13
13
|
unlock,
|
|
14
14
|
withLock
|
|
15
|
-
} from "./chunks/chunk-
|
|
15
|
+
} from "./chunks/chunk-GC3QOL6J.ts";
|
|
16
|
+
import {
|
|
17
|
+
createStartupTimings
|
|
18
|
+
} from "./chunks/chunk-UZPMDLTL.ts";
|
|
16
19
|
import {
|
|
17
20
|
combineSignals,
|
|
18
21
|
throwIfAborted
|
|
@@ -30,9 +33,10 @@ import {
|
|
|
30
33
|
resolveSyncCommand,
|
|
31
34
|
setSyncSetupCompletions,
|
|
32
35
|
splitArgs,
|
|
36
|
+
startupTransferSummary,
|
|
33
37
|
usage,
|
|
34
38
|
validateCommandOptions
|
|
35
|
-
} from "./chunks/chunk-
|
|
39
|
+
} from "./chunks/chunk-ITFR6NNQ.ts";
|
|
36
40
|
import {
|
|
37
41
|
safeTerminalText
|
|
38
42
|
} from "./chunks/chunk-AMJRUXFT.ts";
|
|
@@ -41,7 +45,7 @@ import {
|
|
|
41
45
|
ensureStateDir,
|
|
42
46
|
readStateForConfig,
|
|
43
47
|
syncStateFingerprint
|
|
44
|
-
} from "./chunks/chunk-
|
|
48
|
+
} from "./chunks/chunk-VCL7TZYW.ts";
|
|
45
49
|
import {
|
|
46
50
|
migrateLegacyStateDirectory,
|
|
47
51
|
stateDirectoryMigrationNotice,
|
|
@@ -60,7 +64,7 @@ import {
|
|
|
60
64
|
sessionTokenWarnings,
|
|
61
65
|
syncCheckConfigFingerprint,
|
|
62
66
|
syncSessionsWarnings
|
|
63
|
-
} from "./chunks/chunk-
|
|
67
|
+
} from "./chunks/chunk-KATKRR3D.ts";
|
|
64
68
|
import "./chunks/chunk-2JZFHNLM.ts";
|
|
65
69
|
import "./chunks/chunk-T2SJD3N7.ts";
|
|
66
70
|
import "./chunks/chunk-ZX2Q6THB.ts";
|
|
@@ -182,7 +186,7 @@ async function executeCommand(rawArgs, ctx, signal, loaders, onCommit, setup, on
|
|
|
182
186
|
await showConfig(ctx, options);
|
|
183
187
|
return { kind: "completed" };
|
|
184
188
|
case "files": {
|
|
185
|
-
const { showFileSelection } = await import("./chunks/file-selection-
|
|
189
|
+
const { showFileSelection } = await import("./chunks/file-selection-UNHBVVON.ts");
|
|
186
190
|
throwIfAborted(options.signal);
|
|
187
191
|
await showFileSelection(ctx, options.setup, options.signal);
|
|
188
192
|
return { kind: "completed" };
|
|
@@ -200,7 +204,7 @@ async function executeCommand(rawArgs, ctx, signal, loaders, onCommit, setup, on
|
|
|
200
204
|
return { kind: "completed" };
|
|
201
205
|
}
|
|
202
206
|
case "conflicts": {
|
|
203
|
-
const { showConflicts } = await import("./chunks/conflict-review-
|
|
207
|
+
const { showConflicts } = await import("./chunks/conflict-review-ZOTOHL2E.ts");
|
|
204
208
|
throwIfAborted(options.signal);
|
|
205
209
|
await withLock("sync", () => showConflicts(ctx, options));
|
|
206
210
|
return { kind: "completed" };
|
|
@@ -297,7 +301,7 @@ async function initConfig(ctx, signal) {
|
|
|
297
301
|
return;
|
|
298
302
|
}
|
|
299
303
|
if (ctx.mode === "tui") {
|
|
300
|
-
const { showSetupWizard } = await import("./chunks/setup-wizard-
|
|
304
|
+
const { showSetupWizard } = await import("./chunks/setup-wizard-VW7F3JN4.ts");
|
|
301
305
|
throwIfAborted(signal);
|
|
302
306
|
await showSetupWizard(ctx, signal);
|
|
303
307
|
return;
|
|
@@ -322,7 +326,7 @@ async function showConfig(ctx, options) {
|
|
|
322
326
|
`automatic sync: ${automaticSyncSummary(config.automatic)}`,
|
|
323
327
|
`settings field merge: ${config.mergeSettings ? "On (experimental)" : "Off"}`,
|
|
324
328
|
`machine-local settings.json fields: ${(config.localFields ?? []).map(safeTerminalText).join(", ") || "none"}`,
|
|
325
|
-
`
|
|
329
|
+
`startup transfer: ${startupTransferSummary(config)}`,
|
|
326
330
|
`included content: ${config.include.join(", ") || "none"}`,
|
|
327
331
|
`sessions: ${config.include.includes("sessions") ? "included" : "not included"}`,
|
|
328
332
|
`settings file: ${localConfigPath()}`,
|
|
@@ -401,7 +405,7 @@ async function handleCommand(rawArgs, ctx, sessionSignal, loaders, attention) {
|
|
|
401
405
|
);
|
|
402
406
|
if (!rawArgs.trim()) {
|
|
403
407
|
try {
|
|
404
|
-
const { showSyncManager } = await import("./chunks/manager-ui-
|
|
408
|
+
const { showSyncManager } = await import("./chunks/manager-ui-ZIN4BUSF.ts");
|
|
405
409
|
if (sessionSignal.aborted) return;
|
|
406
410
|
await showSyncManager(ctx, run, sessionSignal, {
|
|
407
411
|
getAttention: () => attention.current(),
|
|
@@ -501,7 +505,7 @@ function directSelectionOrigin(rawArgs) {
|
|
|
501
505
|
async function resolveSelectionAttention(ctx, attention, signal, loaders, options = {}) {
|
|
502
506
|
const current = attention.current();
|
|
503
507
|
if (!current || signal.aborted) return;
|
|
504
|
-
const { dispatchManagerResult } = await import("./chunks/manager-result-dispatcher-
|
|
508
|
+
const { dispatchManagerResult } = await import("./chunks/manager-result-dispatcher-HVRTPEVK.ts");
|
|
505
509
|
if (signal.aborted || attention.current() !== current) return;
|
|
506
510
|
await dispatchManagerResult(
|
|
507
511
|
ctx,
|
|
@@ -545,42 +549,54 @@ var AUTO_SYNC_OPTIONS = {
|
|
|
545
549
|
args: []
|
|
546
550
|
};
|
|
547
551
|
async function startSession(ctx, signal) {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
const validateMutation = captureMutationOwner(ctx, signal);
|
|
552
|
-
const currentFile = ctx.sessionManager.getSessionFile?.();
|
|
553
|
-
await recoverSnapshotTransactionsOnStartup({
|
|
554
|
-
signal,
|
|
555
|
-
sessionDir: sessionDirFromContext(ctx),
|
|
556
|
-
protectedTargets: currentFile ? [currentFile] : [],
|
|
557
|
-
validateMutation
|
|
558
|
-
});
|
|
559
|
-
throwIfAborted(signal);
|
|
552
|
+
const timings = createStartupTimings();
|
|
553
|
+
let debug = false;
|
|
554
|
+
let outcome = "stopped";
|
|
560
555
|
try {
|
|
561
|
-
const settings = await readLocalConfigObject();
|
|
562
556
|
throwIfAborted(signal);
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
557
|
+
const stateNotice = stateDirectoryMigrationNotice();
|
|
558
|
+
if (stateNotice && ctx.hasUI) ctx.ui.notify(stateNotice, "warning");
|
|
559
|
+
const validateMutation = captureMutationOwner(ctx, signal);
|
|
560
|
+
const currentFile = ctx.sessionManager.getSessionFile?.();
|
|
561
|
+
await timings.measure(
|
|
562
|
+
"transaction recovery",
|
|
563
|
+
() => recoverSnapshotTransactionsOnStartup({
|
|
564
|
+
signal,
|
|
565
|
+
sessionDir: sessionDirFromContext(ctx),
|
|
566
|
+
protectedTargets: currentFile ? [currentFile] : [],
|
|
567
|
+
validateMutation
|
|
568
|
+
})
|
|
569
|
+
);
|
|
576
570
|
throwIfAborted(signal);
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
571
|
+
try {
|
|
572
|
+
const settings = await timings.measure("settings read", () => readLocalConfigObject());
|
|
573
|
+
throwIfAborted(signal);
|
|
574
|
+
debug = settings?.debug ?? false;
|
|
575
|
+
const names = settings ? Object.keys(settings.syncSetups).sort((left, right) => left.localeCompare(right)) : [];
|
|
576
|
+
setSyncSetupCompletions(names);
|
|
577
|
+
configureSyncStatus(ctx, settings?.showStatus ?? true);
|
|
578
|
+
} catch {
|
|
579
|
+
if (signal.aborted) return;
|
|
580
|
+
setSyncSetupCompletions([]);
|
|
581
|
+
}
|
|
582
|
+
const migrationNotice = consumeLocalConfigMigrationNotice();
|
|
583
|
+
if (migrationNotice && ctx.hasUI) ctx.ui.notify(migrationNotice, "warning");
|
|
580
584
|
throwIfAborted(signal);
|
|
581
|
-
if (!
|
|
582
|
-
|
|
585
|
+
if (!ctx.hasUI) return;
|
|
586
|
+
try {
|
|
587
|
+
const config = await timings.measure("config resolution", () => loadConfig());
|
|
588
|
+
throwIfAborted(signal);
|
|
589
|
+
configureSyncStatus(ctx, config.showStatus);
|
|
590
|
+
outcome = "completed";
|
|
591
|
+
return config.automatic || config.automaticTransfer ? config : void 0;
|
|
592
|
+
} catch (error) {
|
|
593
|
+
throwIfAborted(signal);
|
|
594
|
+
if (!isMissingConfigError(error)) {
|
|
595
|
+
ctx.ui.notify(`pi-sync startup check skipped: ${safeTerminalText(errorMessage(error))}`, "warning");
|
|
596
|
+
}
|
|
583
597
|
}
|
|
598
|
+
} finally {
|
|
599
|
+
timings.publish(ctx, debug, signal, "local initialization", outcome);
|
|
584
600
|
}
|
|
585
601
|
}
|
|
586
602
|
async function autoPushSessions(ctx, signal, loaders) {
|
|
@@ -643,6 +659,7 @@ function createStartupCheck(loaders, attention, timeoutMs = 3e4) {
|
|
|
643
659
|
return;
|
|
644
660
|
}
|
|
645
661
|
if (active) throw new Error("Previous startup check has not been drained.");
|
|
662
|
+
const timings = createStartupTimings();
|
|
646
663
|
const controller = new AbortController();
|
|
647
664
|
const signal = combineSignals(sessionSignal, controller.signal);
|
|
648
665
|
const task = {
|
|
@@ -659,6 +676,7 @@ function createStartupCheck(loaders, attention, timeoutMs = 3e4) {
|
|
|
659
676
|
);
|
|
660
677
|
let config;
|
|
661
678
|
let checking = false;
|
|
679
|
+
let stopped = false;
|
|
662
680
|
task.promise = Promise.resolve().then(async () => {
|
|
663
681
|
try {
|
|
664
682
|
throwIfAborted(signal);
|
|
@@ -670,18 +688,21 @@ function createStartupCheck(loaders, attention, timeoutMs = 3e4) {
|
|
|
670
688
|
const identity = syncCheckConfigFingerprint(captured);
|
|
671
689
|
checking = true;
|
|
672
690
|
setSyncStatus(ctx, "sync ...");
|
|
673
|
-
const { inspectSync } = await loaders.inspection();
|
|
691
|
+
const { inspectSync } = await timings.measure("inspection import", () => loaders.inspection());
|
|
674
692
|
throwIfAborted(signal);
|
|
675
693
|
const currentConfig = await loadConfigForCheck();
|
|
676
694
|
throwIfAborted(signal);
|
|
677
695
|
if (syncCheckConfigFingerprint(currentConfig) !== identity) return;
|
|
678
|
-
const inspection = await
|
|
679
|
-
|
|
680
|
-
|
|
696
|
+
const inspection = await timings.measure(
|
|
697
|
+
"inspection and guards",
|
|
698
|
+
() => withStateDirectoryAccess(() => {
|
|
681
699
|
throwIfAborted(signal);
|
|
682
|
-
return
|
|
683
|
-
|
|
684
|
-
|
|
700
|
+
return withLock("startup-check", () => {
|
|
701
|
+
throwIfAborted(signal);
|
|
702
|
+
return inspectSync(captured, snapshotOptionsForContext(ctx, captured), signal, void 0, timings);
|
|
703
|
+
});
|
|
704
|
+
})
|
|
705
|
+
);
|
|
685
706
|
throwIfAborted(signal);
|
|
686
707
|
const latest = await loadConfigForCheck();
|
|
687
708
|
throwIfAborted(signal);
|
|
@@ -697,27 +718,31 @@ function createStartupCheck(loaders, attention, timeoutMs = 3e4) {
|
|
|
697
718
|
automaticTransfer: captured.automaticTransfer
|
|
698
719
|
});
|
|
699
720
|
if (captured.automaticTransfer && !inspection.firstSync && inspection.head && inspection.selectionState?.kind === "same") {
|
|
700
|
-
const operations = await loaders.operations();
|
|
721
|
+
const operations = await timings.measure("operations import", () => loaders.operations());
|
|
701
722
|
throwIfAborted(signal);
|
|
702
723
|
if (!isCurrent()) return;
|
|
703
724
|
if (!ctx.isIdle()) {
|
|
704
725
|
pending = { ctx, signal: sessionSignal, config: captured };
|
|
705
726
|
return;
|
|
706
727
|
}
|
|
707
|
-
await
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
() =>
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
728
|
+
await timings.measure(
|
|
729
|
+
"automatic transfer",
|
|
730
|
+
() => withStateDirectoryAccess(
|
|
731
|
+
() => withLock(
|
|
732
|
+
"startup-transfer",
|
|
733
|
+
() => operations.syncBoth(ctx, {
|
|
734
|
+
args: [],
|
|
735
|
+
yes: true,
|
|
736
|
+
force: false,
|
|
737
|
+
stale: false,
|
|
738
|
+
silent: true,
|
|
739
|
+
reload: false,
|
|
740
|
+
auto: true,
|
|
741
|
+
signal,
|
|
742
|
+
startupTimings: timings,
|
|
743
|
+
onCommit: () => attention.clearObservation()
|
|
744
|
+
})
|
|
745
|
+
)
|
|
721
746
|
)
|
|
722
747
|
);
|
|
723
748
|
throwIfAborted(signal);
|
|
@@ -734,6 +759,7 @@ function createStartupCheck(loaders, attention, timeoutMs = 3e4) {
|
|
|
734
759
|
});
|
|
735
760
|
if (ctx.mode === "rpc") attention.notifyObservation(ctx);
|
|
736
761
|
} catch (error) {
|
|
762
|
+
stopped = true;
|
|
737
763
|
if (!isCurrent() || sessionSignal.aborted || isMissingConfigError(error)) return;
|
|
738
764
|
if (signal.aborted && controller.signal.reason?.name !== "TimeoutError") return;
|
|
739
765
|
if (config) {
|
|
@@ -759,6 +785,15 @@ function createStartupCheck(loaders, attention, timeoutMs = 3e4) {
|
|
|
759
785
|
}
|
|
760
786
|
} else setSyncStatus(ctx, void 0);
|
|
761
787
|
}
|
|
788
|
+
if (isCurrent()) {
|
|
789
|
+
timings.publish(
|
|
790
|
+
ctx,
|
|
791
|
+
config?.debug ?? false,
|
|
792
|
+
sessionSignal,
|
|
793
|
+
"background startup",
|
|
794
|
+
signal.aborted || stopped ? "stopped" : "completed"
|
|
795
|
+
);
|
|
796
|
+
}
|
|
762
797
|
if (active === task) active = void 0;
|
|
763
798
|
}
|
|
764
799
|
}).catch(() => {
|
|
@@ -780,11 +815,11 @@ function createStartupCheck(loaders, attention, timeoutMs = 3e4) {
|
|
|
780
815
|
// src/sync/sync-loaders.ts
|
|
781
816
|
function createSyncLoaders(dependencies) {
|
|
782
817
|
const loaders = {
|
|
783
|
-
inspection: cachedModuleLoader(dependencies.loadSyncInspection ?? (() => import("./chunks/sync-inspection-
|
|
784
|
-
setupSwitch: cachedModuleLoader(dependencies.loadSetupSwitch ?? (() => import("./chunks/setup-switch-
|
|
818
|
+
inspection: cachedModuleLoader(dependencies.loadSyncInspection ?? (() => import("./chunks/sync-inspection-3EMS2J5B.ts"))),
|
|
819
|
+
setupSwitch: cachedModuleLoader(dependencies.loadSetupSwitch ?? (() => import("./chunks/setup-switch-ZMW5C4M7.ts"))),
|
|
785
820
|
snapshot: cachedModuleLoader(dependencies.loadSnapshot ?? (() => import("./chunks/snapshot-THS5EY2L.ts"))),
|
|
786
821
|
syncState: cachedModuleLoader(dependencies.loadSyncState ?? (() => import("./chunks/sync-state-CFL4RRRB.ts"))),
|
|
787
|
-
operations: cachedModuleLoader(dependencies.loadSyncOperations ?? (() => import("./chunks/sync-operations-
|
|
822
|
+
operations: cachedModuleLoader(dependencies.loadSyncOperations ?? (() => import("./chunks/sync-operations-2CWST333.ts")))
|
|
788
823
|
};
|
|
789
824
|
return loaders;
|
|
790
825
|
}
|