@adea-ai/app-framework 0.37.0 → 0.37.2
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/dist/app/create-application.js +1 -1
- package/dist/appearance/appearance-host.js +3 -2
- package/dist/appearance/custom-theme-import.js +3 -1
- package/dist/appearance/custom-theme-library.d.ts +6 -185
- package/dist/appearance/custom-theme-library.js +3 -621
- package/dist/appearance/theme-library-mutation.d.ts +42 -0
- package/dist/appearance/theme-library-mutation.js +172 -0
- package/dist/appearance/theme-library-schema.d.ts +108 -0
- package/dist/appearance/theme-library-schema.js +189 -0
- package/dist/appearance/theme-library-store.d.ts +61 -0
- package/dist/appearance/theme-library-store.js +268 -0
- package/dist/appearance/theme-record-adapter.js +3 -1
- package/dist/appearance/theme-registry.js +2 -1
- package/dist/cli/framework-update-cli.js +1 -1
- package/dist/cli/macos-signing-cli.js +1 -1
- package/dist/cli/release-assets-plan-cli.js +1 -1
- package/dist/cli/release-cut-cli.js +2 -2
- package/dist/cli/release-descriptor-staging-cli.js +2 -2
- package/dist/cli/release-promote-cli.js +1 -1
- package/dist/cli/release-publish-cli.js +1 -1
- package/dist/cli/release-sign-cli.js +1 -1
- package/dist/cli/release-step-cli.js +1 -1
- package/dist/cli/update-helper-cli.js +1 -1
- package/dist/cli/windows-installer-build-cli.js +1 -1
- package/dist/cli/windows-runtime-patch-cli.js +1 -1
- package/dist/desktop/client-assets.js +1 -1
- package/dist/desktop/desktop-client.d.ts +1 -1
- package/dist/desktop/desktop-gateway.js +2 -2
- package/dist/desktop/desktop-host.js +6 -6
- package/dist/desktop/desktop-stream.js +1 -1
- package/dist/framework-source.json +1 -1
- package/dist/installer/command-qualification-command.js +2 -2
- package/dist/installer/installed-payload.js +4 -4
- package/dist/installer/{installer-archive.js → installer-archive-members.js} +2 -2
- package/dist/installer/installer-ci-worker.js +2 -2
- package/dist/installer/installer-extraction.js +3 -3
- package/dist/installer/installer-fetch-guard.d.ts +1 -1
- package/dist/installer/installer-identity.js +2 -2
- package/dist/installer/installer-observation.d.ts +1 -1
- package/dist/installer/installer-observation.js +5 -5
- package/dist/installer/installer-process-cleanup.js +1 -1
- package/dist/installer/installer-qualification-command.js +3 -3
- package/dist/installer/installer-renderer-evidence.js +1 -1
- package/dist/installer/installer-upgrade-command.d.ts +2 -2
- package/dist/installer/installer-upgrade-command.js +7 -7
- package/dist/installer/linux-process-group.js +1 -1
- package/dist/installer/upgrade-asset-download.d.ts +1 -1
- package/dist/installer/upgrade-asset-download.js +2 -2
- package/dist/native/desktop-build.js +1 -1
- package/dist/native/posix-tree-removal.d.ts +1 -1
- package/dist/native/secure-window.js +1 -1
- package/dist/native/windows-build-hook.js +1 -1
- package/dist/native/windows-extractor-build.js +1 -1
- package/dist/release/feed-release-cut.d.ts +1 -1
- package/dist/release/feed-state.d.ts +2 -2
- package/dist/release/feed-state.js +4 -4
- package/dist/release/github-release-cut.js +3 -3
- package/dist/release/github-release-promotion.js +2 -2
- package/dist/release/github-release-publisher.js +1 -1
- package/dist/release/github-release-qualification.js +1 -1
- package/dist/release/local-release.d.ts +2 -2
- package/dist/release/local-release.js +7 -7
- package/dist/release/qualification-run.js +1 -1
- package/dist/release/release-artifact.d.ts +1 -1
- package/dist/release/release-artifact.js +2 -2
- package/dist/release/release-assets-plan.js +2 -2
- package/dist/release/release-config.d.ts +1 -1
- package/dist/release/release-config.js +3 -3
- package/dist/release/release-cut-command.js +1 -1
- package/dist/release/release-descriptor-staging.js +5 -5
- package/dist/release/release-finalize.js +3 -3
- package/dist/release/release-promotion-command.js +2 -2
- package/dist/release/release-promotion.js +1 -1
- package/dist/release/release-publication.d.ts +1 -1
- package/dist/release/release-publication.js +3 -3
- package/dist/release/release-publish-command.js +4 -4
- package/dist/release/release-steps.js +2 -2
- package/dist/release/retained-release-build.js +2 -2
- package/dist/shell/app-utilities.js +2 -2
- package/dist/update-helper.bundle.js +18 -18
- package/dist/updates/channel-update-manager.d.ts +3 -3
- package/dist/updates/channel-update-manager.js +2 -2
- package/dist/updates/desktop-updater.d.ts +10 -83
- package/dist/updates/desktop-updater.js +16 -219
- package/dist/updates/{packaged-release-config.js → feed/packaged-release-config.js} +5 -5
- package/dist/updates/{release-feed.js → feed/release-feed.js} +2 -2
- package/dist/updates/{release-location.js → feed/release-location.js} +2 -2
- package/dist/updates/{release-version.js → feed/release-version.js} +1 -1
- package/dist/updates/{signed-release.js → feed/signed-release.js} +2 -2
- package/dist/updates/{update-discovery.js → feed/update-discovery.js} +3 -3
- package/dist/updates/helper/launch-gate-recovery.d.ts +8 -0
- package/dist/updates/{update-resume.js → helper/launch-gate-recovery.js} +13 -423
- package/dist/updates/helper/resume-staging.d.ts +22 -0
- package/dist/updates/helper/resume-staging.js +180 -0
- package/dist/updates/{update-helper.d.ts → helper/update-helper.d.ts} +1 -1
- package/dist/updates/{update-helper.js → helper/update-helper.js} +9 -9
- package/dist/updates/{update-resume.d.ts → helper/update-resume.d.ts} +4 -10
- package/dist/updates/helper/update-resume.js +252 -0
- package/dist/updates/{update-shutdown.js → helper/update-shutdown.js} +2 -2
- package/dist/updates/{update-arm.d.ts → install/update-arm.d.ts} +2 -2
- package/dist/updates/{update-arm.js → install/update-arm.js} +10 -10
- package/dist/updates/{update-download-cleanup.d.ts → install/update-download-cleanup.d.ts} +1 -1
- package/dist/updates/{update-download-cleanup.js → install/update-download-cleanup.js} +3 -3
- package/dist/updates/{update-download.d.ts → install/update-download.d.ts} +2 -2
- package/dist/updates/{update-download.js → install/update-download.js} +3 -3
- package/dist/updates/{update-extraction.d.ts → install/update-extraction.d.ts} +2 -2
- package/dist/updates/{update-extraction.js → install/update-extraction.js} +6 -6
- package/dist/updates/{update-handoff-plan.d.ts → install/update-handoff-plan.d.ts} +2 -2
- package/dist/updates/{update-handoff-plan.js → install/update-handoff-plan.js} +5 -5
- package/dist/updates/{update-marker.js → install/update-marker.js} +2 -2
- package/dist/updates/{update-swap-stage.d.ts → install/update-swap-stage.d.ts} +2 -2
- package/dist/updates/{update-swap-stage.js → install/update-swap-stage.js} +7 -6
- package/dist/updates/{update-swap.d.ts → install/update-swap.d.ts} +1 -1
- package/dist/updates/{update-swap.js → install/update-swap.js} +5 -5
- package/dist/updates/install-target.d.ts +8 -0
- package/dist/updates/install-target.js +27 -0
- package/dist/updates/{launch-environment.js → launch/launch-environment.js} +1 -1
- package/dist/updates/{packaged-launch-admission.js → launch/packaged-launch-admission.js} +4 -4
- package/dist/updates/{packaged-update-startup.d.ts → launch/packaged-update-startup.d.ts} +3 -3
- package/dist/updates/{packaged-update-startup.js → launch/packaged-update-startup.js} +10 -7
- package/dist/updates/{update-launch-gate.d.ts → launch/update-launch-gate.d.ts} +1 -1
- package/dist/updates/{update-launch-gate.js → launch/update-launch-gate.js} +9 -9
- package/dist/updates/{update-launch.d.ts → launch/update-launch.d.ts} +1 -1
- package/dist/updates/{update-launch.js → launch/update-launch.js} +2 -2
- package/dist/updates/{linux-process-state.js → locks/linux-process-state.js} +1 -1
- package/dist/updates/{native-file-lock.js → locks/native-file-lock.js} +1 -1
- package/dist/updates/{stable-file.js → locks/stable-file.js} +2 -2
- package/dist/updates/{update-download-lock.js → locks/update-download-lock.js} +1 -1
- package/dist/updates/{update-generation-lease.js → locks/update-generation-lease.js} +3 -3
- package/dist/updates/{update-inherited-launch-lease.d.ts → locks/update-inherited-launch-lease.d.ts} +1 -1
- package/dist/updates/{update-inherited-launch-lease.js → locks/update-inherited-launch-lease.js} +2 -2
- package/dist/updates/{update-instance-lease.js → locks/update-instance-lease.js} +2 -2
- package/dist/updates/{update-lock.js → locks/update-lock.js} +2 -2
- package/dist/updates/{update-process-fence.js → locks/update-process-fence.js} +3 -3
- package/dist/updates/{update-process-liveness.js → locks/update-process-liveness.js} +2 -2
- package/dist/updates/retained-client-assets.d.ts +60 -0
- package/dist/updates/retained-client-assets.js +116 -0
- package/dist/updates/retention/retention-cleanup.d.ts +103 -0
- package/dist/updates/retention/retention-cleanup.js +439 -0
- package/dist/updates/retention/retention-prune-progress.d.ts +27 -0
- package/dist/updates/retention/retention-prune-progress.js +203 -0
- package/dist/updates/retention/retirement-inventory.d.ts +93 -0
- package/dist/updates/retention/retirement-inventory.js +373 -0
- package/dist/updates/retention/retirement-records.d.ts +75 -0
- package/dist/updates/retention/retirement-records.js +309 -0
- package/dist/updates/{update-retention-marker.d.ts → retention/update-retention-marker.d.ts} +1 -1
- package/dist/updates/{update-retention-marker.js → retention/update-retention-marker.js} +3 -3
- package/dist/updates/{update-retention-plan.d.ts → retention/update-retention-plan.d.ts} +1 -1
- package/dist/updates/{update-retention-plan.js → retention/update-retention-plan.js} +2 -2
- package/dist/updates/{update-retention-sync.d.ts → retention/update-retention-sync.d.ts} +1 -1
- package/dist/updates/{update-retention-sync.js → retention/update-retention-sync.js} +2 -2
- package/dist/updates/retention/update-retirement.d.ts +26 -0
- package/dist/updates/retention/update-retirement.js +205 -0
- package/dist/updates/update-adapter.js +1 -1
- package/dist/updates/update-channel-store.d.ts +1 -1
- package/dist/updates/update-channel-store.js +3 -3
- package/dist/updates/update-manager.d.ts +4 -4
- package/dist/updates/update-manager.js +5 -5
- package/dist/updates/update-services.d.ts +15 -0
- package/dist/updates/update-services.js +77 -0
- package/dist/updates/update-state-store.d.ts +2 -2
- package/dist/updates/update-state-store.js +2 -2
- package/dist/views/appearance-surface.js +4 -2
- package/package.json +47 -47
- package/src/appearance/custom-theme-library.ts +42 -956
- package/src/appearance/theme-library-mutation.ts +288 -0
- package/src/appearance/theme-library-schema.ts +347 -0
- package/src/appearance/theme-library-store.ts +379 -0
- package/src/updates/update-adapter.ts +1 -1
- package/dist/updates/update-retirement.d.ts +0 -205
- package/dist/updates/update-retirement.js +0 -1485
- /package/dist/installer/{installer-archive.d.ts → installer-archive-members.d.ts} +0 -0
- /package/dist/updates/{packaged-release-config.d.ts → feed/packaged-release-config.d.ts} +0 -0
- /package/dist/updates/{release-feed.d.ts → feed/release-feed.d.ts} +0 -0
- /package/dist/updates/{release-location.d.ts → feed/release-location.d.ts} +0 -0
- /package/dist/updates/{release-version.d.ts → feed/release-version.d.ts} +0 -0
- /package/dist/updates/{signed-release.d.ts → feed/signed-release.d.ts} +0 -0
- /package/dist/updates/{update-discovery.d.ts → feed/update-discovery.d.ts} +0 -0
- /package/dist/updates/{update-shutdown.d.ts → helper/update-shutdown.d.ts} +0 -0
- /package/dist/updates/{update-marker.d.ts → install/update-marker.d.ts} +0 -0
- /package/dist/updates/{launch-environment.d.ts → launch/launch-environment.d.ts} +0 -0
- /package/dist/updates/{packaged-launch-admission.d.ts → launch/packaged-launch-admission.d.ts} +0 -0
- /package/dist/updates/{linux-process-state.d.ts → locks/linux-process-state.d.ts} +0 -0
- /package/dist/updates/{native-file-lock.d.ts → locks/native-file-lock.d.ts} +0 -0
- /package/dist/updates/{stable-file.d.ts → locks/stable-file.d.ts} +0 -0
- /package/dist/updates/{update-download-lock.d.ts → locks/update-download-lock.d.ts} +0 -0
- /package/dist/updates/{update-generation-lease.d.ts → locks/update-generation-lease.d.ts} +0 -0
- /package/dist/updates/{update-instance-lease.d.ts → locks/update-instance-lease.d.ts} +0 -0
- /package/dist/updates/{update-lock.d.ts → locks/update-lock.d.ts} +0 -0
- /package/dist/updates/{update-process-fence.d.ts → locks/update-process-fence.d.ts} +0 -0
- /package/dist/updates/{update-process-liveness.d.ts → locks/update-process-liveness.d.ts} +0 -0
- /package/src/updates/{release-version.ts → feed/release-version.ts} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { errorCode, isUuid } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { errorCode, isUuid } from "../../app/value-guards.js";
|
|
2
|
+
import { publishExclusiveUpdateMarker, publishExclusiveUpdateMarkerSync, readUpdateMarker } from "../install/update-marker.js";
|
|
3
|
+
import { launchInstalledApp } from "../launch/update-launch.js";
|
|
4
|
+
import { UpdateProcessFenceCancelledError, waitForUpdateProcesses } from "../locks/update-process-fence.js";
|
|
5
|
+
import { readUpdateTreeDigest, readUpdateTreeIdentity, readUpdateTreeVersion, sameUpdateTreeDigest, sameUpdateTreeIdentity, swapUpdateTreeWhileLocked, syncUpdateTree, syncUpdateTreeParent, updateStagingFor } from "../install/update-swap.js";
|
|
6
|
+
import { acquireUpdateLock, readUpdateStageState, writeUpdateStageState, writeUpdateStageStateDurably } from "../update-state-store.js";
|
|
7
|
+
import { cancelUpdateLaunchGateBeforeTransition, publishUpdateLaunchGate, tryAcquireUpdateHelperLiveness, waitForUpdateLaunchGateWriter } from "../launch/update-launch-gate.js";
|
|
8
|
+
import { isCanonicalPath } from "../../native/canonical-path.js";
|
|
9
9
|
import { lstat, open, realpath } from "node:fs/promises";
|
|
10
10
|
import { join } from "node:path";
|
|
11
11
|
import { constants as constants$1 } from "node:fs";
|
|
12
|
-
// src/updates/update-helper.ts
|
|
12
|
+
// src/updates/helper/update-helper.ts
|
|
13
13
|
/** Return whether a staging directory contains artifacts from a helper handoff. */
|
|
14
14
|
async function hasUpdateHelperArtifacts(staging) {
|
|
15
15
|
for (const name of [
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { type
|
|
3
|
-
import { type RetainedUpdateTrees } from './update-retirement';
|
|
4
|
-
import { type UpdateLaunchGateRecoveryResult } from './update-launch-gate';
|
|
1
|
+
import type { ReleaseTrust } from '../feed/signed-release';
|
|
2
|
+
import { type RetainedUpdateTrees } from '../retention/retirement-inventory';
|
|
5
3
|
export type UpdateResumeResult = Readonly<{
|
|
6
4
|
status: 'none' | 'in-progress' | 'not-applied' | 'recovery-required';
|
|
7
5
|
} | {
|
|
@@ -19,12 +17,6 @@ export type UpdateResumeWithRetainedTreesResult = Readonly<{
|
|
|
19
17
|
} | {
|
|
20
18
|
status: 'busy' | 'in-progress' | 'recovery-required';
|
|
21
19
|
}>;
|
|
22
|
-
/**
|
|
23
|
-
* Reconcile only the schema-3 journal bound to the exact persisted gate. The
|
|
24
|
-
* caller deliberately opts into this operation; generated unmanaged startup
|
|
25
|
-
* reaches it through `recoverPackagedUpdateLaunchGate` before launch admission.
|
|
26
|
-
*/
|
|
27
|
-
export declare function recoverUpdateLaunchGate(target: string, trust: ReleaseTrust): Promise<UpdateLaunchGateRecoveryResult>;
|
|
28
20
|
/**
|
|
29
21
|
* Call on app start. Reconcile only while holding the same per-install lock
|
|
30
22
|
* used by stage, helper handoff, and the swap. A valid staged candidate is
|
|
@@ -45,3 +37,5 @@ export declare function resumeUpdateWithRetainedTrees(options: {
|
|
|
45
37
|
trust: ReleaseTrust;
|
|
46
38
|
currentVersion: string;
|
|
47
39
|
}): Promise<UpdateResumeWithRetainedTreesResult>;
|
|
40
|
+
export { acquireRetainedUpdateTrees, type RetainedUpdateTree, type RetainedUpdateTrees, } from '../retention/retirement-inventory';
|
|
41
|
+
export { recoverUpdateLaunchGate } from './launch-gate-recovery';
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { hasUpdateHelperArtifacts } from "./update-helper.js";
|
|
2
|
+
import { updateProcessMayBeAlive } from "../locks/update-process-liveness.js";
|
|
3
|
+
import { UpdateLockBusyError, acquireUpdateLock, readUpdateStageState } from "../update-state-store.js";
|
|
4
|
+
import { readUpdateTreeIdentity, readUpdateTreeVersion, sameUpdateTreeDigest, sameUpdateTreeIdentity, updateStagingFor } from "../install/update-swap.js";
|
|
5
|
+
import { acquireRetainedUpdateTrees, acquireRetainedUpdateTreesWhileLocked } from "../retention/retirement-inventory.js";
|
|
6
|
+
import { reconcileRetirementCleanupMarkerWhileLocked, retireCompletedUpdateWhileLocked } from "../retention/update-retirement.js";
|
|
7
|
+
import { readUpdateLaunchGate } from "../launch/update-launch-gate.js";
|
|
8
|
+
import { exists, readTreeDigestForProof, reconcileSwap, recoverLegacyHandoff, recoverStagedCandidate, resetToStaged } from "./resume-staging.js";
|
|
9
|
+
import { recoverUpdateLaunchGate } from "./launch-gate-recovery.js";
|
|
10
|
+
import { lstat, readFile, readdir, rmdir, unlink } from "node:fs/promises";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
// src/updates/helper/update-resume.ts
|
|
13
|
+
async function resumeLocked(options) {
|
|
14
|
+
const { target, staging, trust, currentVersion } = options;
|
|
15
|
+
const launchGate = await readUpdateLaunchGate(target);
|
|
16
|
+
if (!await exists(staging)) {
|
|
17
|
+
if (launchGate) return { status: "recovery-required" };
|
|
18
|
+
const cleanup = await reconcileRetirementCleanupMarkerWhileLocked({
|
|
19
|
+
target,
|
|
20
|
+
staging,
|
|
21
|
+
currentVersion
|
|
22
|
+
});
|
|
23
|
+
return cleanup === "none" ? { status: "none" } : cleanup === "updated" ? {
|
|
24
|
+
status: "updated",
|
|
25
|
+
version: currentVersion
|
|
26
|
+
} : { status: "recovery-required" };
|
|
27
|
+
}
|
|
28
|
+
const info = await lstat(staging);
|
|
29
|
+
if (!info.isDirectory() || info.isSymbolicLink()) throw new Error("Unexpected update staging entry");
|
|
30
|
+
let state = await readUpdateStageState(staging);
|
|
31
|
+
if (!state) {
|
|
32
|
+
if (launchGate) return { status: "recovery-required" };
|
|
33
|
+
const cleanup = await reconcileRetirementCleanupMarkerWhileLocked({
|
|
34
|
+
target,
|
|
35
|
+
staging,
|
|
36
|
+
currentVersion
|
|
37
|
+
});
|
|
38
|
+
if (cleanup !== "none") return cleanup === "updated" ? {
|
|
39
|
+
status: "updated",
|
|
40
|
+
version: currentVersion
|
|
41
|
+
} : { status: "recovery-required" };
|
|
42
|
+
const helper = Number(await readFile(join(staging, "helper-armed"), "utf8").catch(() => 0));
|
|
43
|
+
if (Number.isSafeInteger(helper) && helper > 1 && updateProcessMayBeAlive(helper)) return { status: "in-progress" };
|
|
44
|
+
const legacyVersion = await readFile(join(staging, "updated"), "utf8").catch(() => void 0);
|
|
45
|
+
if (legacyVersion && await readUpdateTreeVersion(target) === legacyVersion) {
|
|
46
|
+
const entries = await readdir(staging);
|
|
47
|
+
if (entries.length !== 1 || entries[0] !== "updated") return { status: "recovery-required" };
|
|
48
|
+
await unlink(join(staging, "updated"));
|
|
49
|
+
await rmdir(staging);
|
|
50
|
+
return {
|
|
51
|
+
status: "updated",
|
|
52
|
+
version: legacyVersion
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (Number.isSafeInteger(helper) && helper > 1) return recoverLegacyHandoff({
|
|
56
|
+
target,
|
|
57
|
+
staging,
|
|
58
|
+
currentVersion,
|
|
59
|
+
helperPid: helper
|
|
60
|
+
});
|
|
61
|
+
if ((await readdir(staging)).length === 0) {
|
|
62
|
+
await rmdir(staging);
|
|
63
|
+
return { status: "not-applied" };
|
|
64
|
+
}
|
|
65
|
+
return { status: "recovery-required" };
|
|
66
|
+
}
|
|
67
|
+
if (launchGate) {
|
|
68
|
+
if (state.launchGateOwner !== launchGate.owner || state.generation !== launchGate.generation || state.version !== launchGate.version) return { status: "recovery-required" };
|
|
69
|
+
if (state.helperPid && updateProcessMayBeAlive(state.helperPid)) return { status: "in-progress" };
|
|
70
|
+
return { status: "recovery-required" };
|
|
71
|
+
}
|
|
72
|
+
if (state.launchGateOwner !== void 0 && state.phase !== "completed" && state.phase !== "retiring" && state.phase !== "retired") return { status: "recovery-required" };
|
|
73
|
+
if (state.helperPid && updateProcessMayBeAlive(state.helperPid)) return { status: "in-progress" };
|
|
74
|
+
if (!state.helperPid && await hasUpdateHelperArtifacts(staging)) return { status: "recovery-required" };
|
|
75
|
+
if (state.launchGateOwner && !state.candidateTreeDigest) return { status: "recovery-required" };
|
|
76
|
+
if (state.phase === "staged") {
|
|
77
|
+
if (state.helperPid) state = await resetToStaged(staging, state);
|
|
78
|
+
return recoverStagedCandidate({
|
|
79
|
+
target,
|
|
80
|
+
staging,
|
|
81
|
+
state,
|
|
82
|
+
trust,
|
|
83
|
+
currentVersion
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
if (state.phase === "armed") {
|
|
87
|
+
state = await resetToStaged(staging, state);
|
|
88
|
+
return recoverStagedCandidate({
|
|
89
|
+
target,
|
|
90
|
+
staging,
|
|
91
|
+
state,
|
|
92
|
+
trust,
|
|
93
|
+
currentVersion,
|
|
94
|
+
allowDigestlessLegacy: true
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (state.phase === "swapping") {
|
|
98
|
+
const reconciled = await reconcileSwap(target, staging, state);
|
|
99
|
+
if (!reconciled) return { status: "recovery-required" };
|
|
100
|
+
state = reconciled;
|
|
101
|
+
if (state.phase === "completed") {
|
|
102
|
+
if (await readUpdateTreeVersion(target) !== state.version) return { status: "recovery-required" };
|
|
103
|
+
if (!await retireCompletedUpdateWhileLocked({
|
|
104
|
+
target,
|
|
105
|
+
staging,
|
|
106
|
+
state
|
|
107
|
+
})) return { status: "recovery-required" };
|
|
108
|
+
return {
|
|
109
|
+
status: "updated",
|
|
110
|
+
version: state.version
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
if (state.helperPid) state = await resetToStaged(staging, state);
|
|
114
|
+
return recoverStagedCandidate({
|
|
115
|
+
target,
|
|
116
|
+
staging,
|
|
117
|
+
state,
|
|
118
|
+
trust,
|
|
119
|
+
currentVersion,
|
|
120
|
+
allowDigestlessLegacy: true
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (state.phase === "completed") {
|
|
124
|
+
if (await readUpdateTreeVersion(target) !== state.version || !sameUpdateTreeIdentity(await readUpdateTreeIdentity(target), state.candidateTreeIdentity) || state.candidateTreeDigest !== void 0 && !sameUpdateTreeDigest(await readTreeDigestForProof(target), state.candidateTreeDigest)) return { status: "recovery-required" };
|
|
125
|
+
if (!await retireCompletedUpdateWhileLocked({
|
|
126
|
+
target,
|
|
127
|
+
staging,
|
|
128
|
+
state
|
|
129
|
+
})) return { status: "recovery-required" };
|
|
130
|
+
return {
|
|
131
|
+
status: "updated",
|
|
132
|
+
version: state.version
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
if (state.phase === "retiring" || state.phase === "retired") {
|
|
136
|
+
if (await readUpdateTreeVersion(target) !== state.version || !sameUpdateTreeIdentity(await readUpdateTreeIdentity(target), state.candidateTreeIdentity) || state.candidateTreeDigest !== void 0 && !sameUpdateTreeDigest(await readTreeDigestForProof(target), state.candidateTreeDigest)) return { status: "recovery-required" };
|
|
137
|
+
if (!await retireCompletedUpdateWhileLocked({
|
|
138
|
+
target,
|
|
139
|
+
staging,
|
|
140
|
+
state
|
|
141
|
+
})) return { status: "recovery-required" };
|
|
142
|
+
return {
|
|
143
|
+
status: "updated",
|
|
144
|
+
version: state.version
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
if (state.phase === "failed") {
|
|
148
|
+
state = await resetToStaged(staging, state);
|
|
149
|
+
return recoverStagedCandidate({
|
|
150
|
+
target,
|
|
151
|
+
staging,
|
|
152
|
+
state,
|
|
153
|
+
trust,
|
|
154
|
+
currentVersion,
|
|
155
|
+
allowDigestlessLegacy: true
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
throw new Error("Invalid update staging phase");
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Call on app start. Reconcile only while holding the same per-install lock
|
|
162
|
+
* used by stage, helper handoff, and the swap. A valid staged candidate is
|
|
163
|
+
* retained until a helper completes or an explicit caller handles it.
|
|
164
|
+
*/
|
|
165
|
+
async function resumeUpdate(options) {
|
|
166
|
+
const staging = updateStagingFor(options.target);
|
|
167
|
+
let lock;
|
|
168
|
+
try {
|
|
169
|
+
lock = await acquireUpdateLock(options.target, 100);
|
|
170
|
+
} catch (error) {
|
|
171
|
+
if (error instanceof UpdateLockBusyError) return { status: "in-progress" };
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
try {
|
|
175
|
+
return await resumeLocked({
|
|
176
|
+
target: options.target,
|
|
177
|
+
staging,
|
|
178
|
+
trust: options.trust,
|
|
179
|
+
currentVersion: options.currentVersion
|
|
180
|
+
});
|
|
181
|
+
} finally {
|
|
182
|
+
await lock.release();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Resume and acquire retained-generation leases under one install lock. This
|
|
187
|
+
* lets callers with explicit release trust serve old lazy assets alongside a
|
|
188
|
+
* validated pending staged candidate without opening a swap race.
|
|
189
|
+
*/
|
|
190
|
+
async function resumeUpdateWithRetainedTrees(options) {
|
|
191
|
+
const staging = updateStagingFor(options.target);
|
|
192
|
+
let lock;
|
|
193
|
+
try {
|
|
194
|
+
lock = await acquireUpdateLock(options.target, 100);
|
|
195
|
+
} catch (error) {
|
|
196
|
+
if (error instanceof UpdateLockBusyError) return { status: "in-progress" };
|
|
197
|
+
throw error;
|
|
198
|
+
}
|
|
199
|
+
let retained;
|
|
200
|
+
try {
|
|
201
|
+
if ((await readUpdateStageState(staging))?.phase === "armed") return { status: "recovery-required" };
|
|
202
|
+
const resumed = await resumeLocked({
|
|
203
|
+
target: options.target,
|
|
204
|
+
staging,
|
|
205
|
+
trust: options.trust,
|
|
206
|
+
currentVersion: options.currentVersion
|
|
207
|
+
});
|
|
208
|
+
if (resumed.status === "in-progress" || resumed.status === "recovery-required") return { status: resumed.status };
|
|
209
|
+
retained = await acquireRetainedUpdateTreesWhileLocked({
|
|
210
|
+
target: options.target,
|
|
211
|
+
currentVersion: resumed.status === "updated" ? resumed.version : options.currentVersion,
|
|
212
|
+
...resumed.status === "staged" ? {
|
|
213
|
+
validatedStagedVersion: resumed.version,
|
|
214
|
+
stagedTrust: options.trust
|
|
215
|
+
} : {}
|
|
216
|
+
});
|
|
217
|
+
if (retained.status === "busy") return { status: "busy" };
|
|
218
|
+
const result = {
|
|
219
|
+
status: "ready",
|
|
220
|
+
resume: resumed,
|
|
221
|
+
retained
|
|
222
|
+
};
|
|
223
|
+
const heldLock = lock;
|
|
224
|
+
lock = void 0;
|
|
225
|
+
try {
|
|
226
|
+
await heldLock.release();
|
|
227
|
+
} catch (error) {
|
|
228
|
+
if (retained.status === "acquired") {
|
|
229
|
+
const acquired = retained;
|
|
230
|
+
retained = void 0;
|
|
231
|
+
try {
|
|
232
|
+
await acquired.release();
|
|
233
|
+
} catch (releaseError) {
|
|
234
|
+
throw new AggregateError([error, releaseError], "Update lock and retained tree leases failed to release", { cause: releaseError });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
throw error;
|
|
238
|
+
}
|
|
239
|
+
retained = void 0;
|
|
240
|
+
return result;
|
|
241
|
+
} catch (error) {
|
|
242
|
+
if (retained?.status === "acquired") try {
|
|
243
|
+
await retained.release();
|
|
244
|
+
} catch (releaseError) {
|
|
245
|
+
throw new AggregateError([error, releaseError], "Resume failure and retained tree leases failed to release", { cause: releaseError });
|
|
246
|
+
}
|
|
247
|
+
throw error;
|
|
248
|
+
} finally {
|
|
249
|
+
await lock?.release();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
export { acquireRetainedUpdateTrees, recoverUpdateLaunchGate, resumeUpdate, resumeUpdateWithRetainedTrees };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UpdateCleanupPendingError, UpdateCleanupTerminalError, findUpdateCleanupTerminalError } from "
|
|
2
|
-
// src/updates/update-shutdown.ts
|
|
1
|
+
import { UpdateCleanupPendingError, UpdateCleanupTerminalError, findUpdateCleanupTerminalError } from "../update-cleanup-error.js";
|
|
2
|
+
// src/updates/helper/update-shutdown.ts
|
|
3
3
|
/** Helper process-fence time left reserved for cancellation and gate cleanup. */
|
|
4
4
|
var UPDATE_HELPER_CANCEL_MARGIN_MS = 11e3;
|
|
5
5
|
async function settleCleanupStep(operation, recordTerminal) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ReleaseTrust } from '
|
|
2
|
-
import { type UpdateHelperRequest } from '
|
|
1
|
+
import { type ReleaseTrust } from '../feed/signed-release';
|
|
2
|
+
import { type UpdateHelperRequest } from '../helper/update-helper';
|
|
3
3
|
/**
|
|
4
4
|
* Start the post-exit update helper for a staged update, then resolve once the
|
|
5
5
|
* helper has verified the requested processes and published readiness for
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { isUuid } from "
|
|
2
|
-
import { isCanonicalPath } from "../native/canonical-path.js";
|
|
3
|
-
import { verifyReleaseDescriptor } from "./signed-release.js";
|
|
4
|
-
import { acquireUpdateLock, readUpdateHelperRequestFile, readUpdateStageState, writeUpdateStageState } from "./update-state-store.js";
|
|
5
|
-
import { readUpdateTreeDigest, readUpdateTreeIdentity, sameUpdateTreeDigest, sameUpdateTreeIdentity, updateStagingFor } from "./update-swap.js";
|
|
1
|
+
import { isUuid } from "../../app/value-guards.js";
|
|
6
2
|
import { isUpdateHelperReadyMarker, readUpdateMarker } from "./update-marker.js";
|
|
7
|
-
import { updateLauncherPath } from "
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
3
|
+
import { updateLauncherPath } from "../launch/update-launch.js";
|
|
4
|
+
import { readUpdateTreeDigest, readUpdateTreeIdentity, sameUpdateTreeDigest, sameUpdateTreeIdentity, updateStagingFor } from "./update-swap.js";
|
|
5
|
+
import { verifyReleaseDescriptor } from "../feed/signed-release.js";
|
|
6
|
+
import { acquireUpdateLock, readUpdateHelperRequestFile, readUpdateStageState, writeUpdateStageState } from "../update-state-store.js";
|
|
7
|
+
import { hasUpdateHelperArtifacts, parseUpdateHelperRequest } from "../helper/update-helper.js";
|
|
8
|
+
import { publishUpdateLaunchGateCancellationRequest, readUpdateLaunchGate } from "../launch/update-launch-gate.js";
|
|
9
|
+
import { UpdateCleanupPendingError, UpdateCleanupTerminalError } from "../update-cleanup-error.js";
|
|
10
|
+
import { isCanonicalPath } from "../../native/canonical-path.js";
|
|
11
11
|
import { copyFile, lstat, mkdir, realpath, rm, writeFile } from "node:fs/promises";
|
|
12
12
|
import { basename, dirname, join } from "node:path";
|
|
13
13
|
import { randomUUID } from "node:crypto";
|
|
14
14
|
import { spawn } from "node:child_process";
|
|
15
|
-
// src/updates/update-arm.ts
|
|
15
|
+
// src/updates/install/update-arm.ts
|
|
16
16
|
function exited(child) {
|
|
17
17
|
return child.pid === void 0 || child.exitCode !== null || child.signalCode !== null;
|
|
18
18
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type UpdateDownloadLease } from '
|
|
1
|
+
import { type UpdateDownloadLease } from '../locks/update-download-lock';
|
|
2
2
|
export type { UpdateDownloadLease };
|
|
3
3
|
/** Create the versioned root and reclaim only directories without a live lease. */
|
|
4
4
|
export declare function initializeOwnedUpdateDownloadRoot(root: string): Promise<string>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { errorCode } from "
|
|
2
|
-
import { acquireUpdateDownloadLease, withUpdateDownloadRootLock } from "
|
|
1
|
+
import { errorCode } from "../../app/value-guards.js";
|
|
2
|
+
import { acquireUpdateDownloadLease, withUpdateDownloadRootLock } from "../locks/update-download-lock.js";
|
|
3
3
|
import { lstat, mkdir, mkdtemp, readdir, realpath, rm } from "node:fs/promises";
|
|
4
4
|
import { basename, dirname, join, resolve } from "node:path";
|
|
5
|
-
// src/updates/update-download-cleanup.ts
|
|
5
|
+
// src/updates/install/update-download-cleanup.ts
|
|
6
6
|
/** Create the versioned root and reclaim only directories without a live lease. */
|
|
7
7
|
async function initializeOwnedUpdateDownloadRoot(root) {
|
|
8
8
|
const requestedRoot = resolve(root);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type VerifiedRelease } from '
|
|
2
|
-
import { type FetchFunction } from '
|
|
1
|
+
import { type VerifiedRelease } from '../feed/signed-release';
|
|
2
|
+
import { type FetchFunction } from '../feed/release-location';
|
|
3
3
|
/** Download an authenticated release to a new private directory; caller owns cleanup and installation. */
|
|
4
4
|
export declare function downloadVerifiedRelease(options: {
|
|
5
5
|
descriptor: VerifiedRelease;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isVerifiedRelease, verifyReleaseStream } from "
|
|
2
|
-
import { fetchReleaseLocation } from "
|
|
1
|
+
import { isVerifiedRelease, verifyReleaseStream } from "../feed/signed-release.js";
|
|
2
|
+
import { fetchReleaseLocation } from "../feed/release-location.js";
|
|
3
3
|
import { mkdtemp, open, realpath, rm } from "node:fs/promises";
|
|
4
4
|
import { basename, dirname, join, resolve } from "node:path";
|
|
5
|
-
// src/updates/update-download.ts
|
|
5
|
+
// src/updates/install/update-download.ts
|
|
6
6
|
/** Download an authenticated release to a new private directory; caller owns cleanup and installation. */
|
|
7
7
|
async function downloadVerifiedRelease(options) {
|
|
8
8
|
const { descriptor, maxBytes } = options;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type InstallerPlatform, type InstallerRenderer } from '
|
|
2
|
-
import { type VerifiedRelease } from '
|
|
1
|
+
import { type InstallerPlatform, type InstallerRenderer } from '../../installer/installer-layout';
|
|
2
|
+
import { type VerifiedRelease } from '../feed/signed-release';
|
|
3
3
|
/** Extract a verified full update into a new private directory. Does not replace an installed app. */
|
|
4
4
|
export declare function extractVerifiedUpdate(options: {
|
|
5
5
|
descriptor: VerifiedRelease;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { safeArchivePath } from "
|
|
5
|
-
import {
|
|
1
|
+
import { assertBuildMetadata, assertPayloadLayout, assertPortableAppName } from "../../installer/installer-layout.js";
|
|
2
|
+
import { isVerifiedRelease, verifyReleaseStream } from "../feed/signed-release.js";
|
|
3
|
+
import { isLinuxCefLibraryLink } from "../../native/linux-cef-links.js";
|
|
4
|
+
import { safeArchivePath } from "../../installer/archive-entry.js";
|
|
5
|
+
import { assertSidecarNames, sidecarBundlePath } from "../../native/app-bundle.js";
|
|
6
6
|
import { lstat, mkdir, mkdtemp, open, readFile, realpath, rm, symlink } from "node:fs/promises";
|
|
7
7
|
import { isAbsolute, join } from "node:path";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
@@ -11,7 +11,7 @@ import { x } from "tar";
|
|
|
11
11
|
import { createZstdDecompress } from "node:zlib";
|
|
12
12
|
import { Transform } from "node:stream";
|
|
13
13
|
import { pipeline } from "node:stream/promises";
|
|
14
|
-
// src/updates/update-extraction.ts
|
|
14
|
+
// src/updates/install/update-extraction.ts
|
|
15
15
|
/** Extract a verified full update into a new private directory. Does not replace an installed app. */
|
|
16
16
|
async function extractVerifiedUpdate(options) {
|
|
17
17
|
const { descriptor, archive, platform, renderer, appName, maxCompressedBytes, maxExpandedBytes } = options;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type InstallerPlatform, type InstallerRenderer } from '
|
|
2
|
-
import { type ReleaseTrust, type VerifiedRelease } from '
|
|
1
|
+
import { type InstallerPlatform, type InstallerRenderer } from '../../installer/installer-layout';
|
|
2
|
+
import { type ReleaseTrust, type VerifiedRelease } from '../feed/signed-release';
|
|
3
3
|
/** Validate an explicitly approved update and its intended installation. This plan does not move files or launch a helper. */
|
|
4
4
|
export declare function planUpdateHandoff(options: {
|
|
5
5
|
descriptor: VerifiedRelease;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { assertPortableAppName } from "../../installer/installer-layout.js";
|
|
2
|
+
import { isVerifiedReleaseForTrust } from "../feed/signed-release.js";
|
|
3
|
+
import { versionLessThan } from "../feed/release-version.js";
|
|
4
|
+
import { isCanonicalPath } from "../../native/canonical-path.js";
|
|
5
5
|
import { basename } from "node:path";
|
|
6
|
-
// src/updates/update-handoff-plan.ts
|
|
6
|
+
// src/updates/install/update-handoff-plan.ts
|
|
7
7
|
/** Validate an explicitly approved update and its intended installation. This plan does not move files or launch a helper. */
|
|
8
8
|
function planUpdateHandoff(options) {
|
|
9
9
|
const { descriptor, trust, currentVersion, approved, approvedVersion, target, appName, platform, renderer } = options;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { errorCode } from "
|
|
1
|
+
import { errorCode } from "../../app/value-guards.js";
|
|
2
2
|
import { link, open, unlink, writeFile } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { closeSync, constants as constants$1, linkSync, openSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
|
-
// src/updates/update-marker.ts
|
|
6
|
+
// src/updates/install/update-marker.ts
|
|
7
7
|
function isUpdateHelperReadyMarker(value, generation, helperOwner) {
|
|
8
8
|
return value?.schema === 1 && value.generation === generation && value.helperOwner === helperOwner;
|
|
9
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { InstallerPlatform, InstallerRenderer } from '
|
|
2
|
-
import { type ReleaseTrust, type VerifiedRelease } from '
|
|
1
|
+
import type { InstallerPlatform, InstallerRenderer } from '../../installer/installer-layout';
|
|
2
|
+
import { type ReleaseTrust, type VerifiedRelease } from '../feed/signed-release';
|
|
3
3
|
/**
|
|
4
4
|
* Extract an approved, signature-verified update into `candidate` inside a new
|
|
5
5
|
* private staging directory beside the install. Does not stop, replace or
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { errorCode } from "
|
|
2
|
-
import { renameExclusive } from "../native/native-rename.js";
|
|
3
|
-
import { exportVerifiedRelease } from "./signed-release.js";
|
|
1
|
+
import { errorCode } from "../../app/value-guards.js";
|
|
4
2
|
import { planUpdateHandoff } from "./update-handoff-plan.js";
|
|
5
3
|
import { extractVerifiedUpdate } from "./update-extraction.js";
|
|
6
|
-
import {
|
|
4
|
+
import { renameExclusive } from "../../native/native-rename.js";
|
|
7
5
|
import { readUpdateTreeDigest, readUpdateTreeIdentity, updateStagingFor } from "./update-swap.js";
|
|
8
|
-
import { assertNoUpdateRetentionPruneArtifactsWhileLocked
|
|
6
|
+
import { assertNoUpdateRetentionPruneArtifactsWhileLocked } from "../retention/retirement-inventory.js";
|
|
7
|
+
import { reconcileRetirementCleanupMarkerWhileLocked } from "../retention/update-retirement.js";
|
|
8
|
+
import { newUpdateStageState, readUpdateStageState, withUpdateLock, writeUpdateStageState } from "../update-state-store.js";
|
|
9
|
+
import { exportVerifiedRelease } from "../feed/signed-release.js";
|
|
9
10
|
import { lstat, mkdtemp, readFile, realpath, rm } from "node:fs/promises";
|
|
10
11
|
import { join } from "node:path";
|
|
11
|
-
// src/updates/update-swap-stage.ts
|
|
12
|
+
// src/updates/install/update-swap-stage.ts
|
|
12
13
|
async function assertInstalledVersion(options) {
|
|
13
14
|
const info = await lstat(options.target);
|
|
14
15
|
if (!info.isDirectory() || info.isSymbolicLink() || await realpath(options.target) !== options.target) throw new Error("Invalid update install target");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { errorCode, isSha256Hex } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { errorCode, isSha256Hex } from "../../app/value-guards.js";
|
|
2
|
+
import { exchangeDirectories, probeDirectoryExchange } from "../../native/native-rename.js";
|
|
3
|
+
import { withUpdateLock } from "../update-state-store.js";
|
|
4
|
+
import { isCanonicalPath } from "../../native/canonical-path.js";
|
|
5
5
|
import { lstat, open, readFile, readdir, readlink } from "node:fs/promises";
|
|
6
6
|
import { basename, dirname, join } from "node:path";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
import { constants as constants$1 } from "node:fs";
|
|
9
|
-
// src/updates/update-swap.ts
|
|
9
|
+
// src/updates/install/update-swap.ts
|
|
10
10
|
/** The private staging directory the framework keeps beside an install. */
|
|
11
11
|
function updateStagingFor(target) {
|
|
12
12
|
if (!isCanonicalPath(target)) throw new Error("Invalid update target");
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { InstallerPlatform } from '../installer/installer-layout';
|
|
2
|
+
/** The release platform this host runs on, or null where framework apps ship no build. */
|
|
3
|
+
export declare function updatePlatform(platform?: string, arch?: string): InstallerPlatform | null;
|
|
4
|
+
/**
|
|
5
|
+
* The installed app tree the swap replaces: the `.app` bundle on macOS, the
|
|
6
|
+
* app directory elsewhere. The host entry runs from `Resources/app/bun`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function installTarget(entryDirectory: string, platform: InstallerPlatform): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
// src/updates/install-target.ts
|
|
3
|
+
/** The release platform this host runs on, or null where framework apps ship no build. */
|
|
4
|
+
function updatePlatform(platform = process.platform, arch = process.arch) {
|
|
5
|
+
if (platform === "darwin" && arch === "arm64") return "macos-arm64";
|
|
6
|
+
if (platform === "win32" && arch === "x64") return "windows-x64";
|
|
7
|
+
if (platform === "linux" && arch === "x64") return "linux-x64";
|
|
8
|
+
if (platform === "linux" && arch === "arm64") return "linux-arm64";
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The installed app tree the swap replaces: the `.app` bundle on macOS, the
|
|
13
|
+
* app directory elsewhere. The host entry runs from `Resources/app/bun`.
|
|
14
|
+
*/
|
|
15
|
+
function installTarget(entryDirectory, platform) {
|
|
16
|
+
return resolve(entryDirectory, ...platform === "macos-arm64" ? [
|
|
17
|
+
"..",
|
|
18
|
+
"..",
|
|
19
|
+
"..",
|
|
20
|
+
".."
|
|
21
|
+
] : [
|
|
22
|
+
"..",
|
|
23
|
+
"..",
|
|
24
|
+
".."
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
export { installTarget, updatePlatform };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/updates/launch-environment.ts
|
|
1
|
+
// src/updates/launch/launch-environment.ts
|
|
2
2
|
/** Set only by a launcher that passes its locked POSIX descriptor to the app. */
|
|
3
3
|
var INHERITED_LAUNCH_LEASE_ENV = "ADEA_INHERITED_LAUNCH_LEASE_FD";
|
|
4
4
|
export { INHERITED_LAUNCH_LEASE_ENV };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isCanonicalPath } from "
|
|
1
|
+
import { isCanonicalPath } from "../../native/canonical-path.js";
|
|
2
2
|
import { INHERITED_LAUNCH_LEASE_ENV } from "./launch-environment.js";
|
|
3
3
|
import { realpath } from "node:fs/promises";
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
|
-
// src/updates/packaged-launch-admission.ts
|
|
5
|
+
// src/updates/launch/packaged-launch-admission.ts
|
|
6
6
|
var processLeases = /* @__PURE__ */ new Set();
|
|
7
7
|
var admissionStarted = false;
|
|
8
8
|
/**
|
|
@@ -13,8 +13,8 @@ var admissionStarted = false;
|
|
|
13
13
|
*/
|
|
14
14
|
async function acquirePackagedLaunchAdmission(options) {
|
|
15
15
|
if (options.descriptor === void 0) return "unmanaged";
|
|
16
|
-
const { installTarget, updatePlatform } = await import("
|
|
17
|
-
const { adoptInheritedUpdateLaunchLease } = await import("
|
|
16
|
+
const { installTarget, updatePlatform } = await import("../desktop-updater.js");
|
|
17
|
+
const { adoptInheritedUpdateLaunchLease } = await import("../locks/update-inherited-launch-lease.js");
|
|
18
18
|
const platform = updatePlatform();
|
|
19
19
|
if (!platform || platform !== "macos-arm64" && platform !== "linux-x64" && platform !== "linux-arm64") throw new Error("Inherited launch admission is unavailable on this platform");
|
|
20
20
|
if (!isCanonicalPath(options.entryDirectory) || typeof options.descriptor !== "string" || !/^[1-9]\d{0,9}$/.test(options.descriptor)) throw new Error("Invalid packaged launch admission");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type UpdateLaunchGateRecoveryResult } from './update-launch-gate';
|
|
2
|
-
import type { UpdateChannel } from '
|
|
3
|
-
import type { UpdateResumeResult } from '
|
|
4
|
-
import { type PackagedDesktopRelease, type PackagedReleaseIdentity } from '
|
|
2
|
+
import type { UpdateChannel } from '../feed/release-version';
|
|
3
|
+
import type { UpdateResumeResult } from '../helper/update-resume';
|
|
4
|
+
import { type PackagedDesktopRelease, type PackagedReleaseIdentity } from '../feed/packaged-release-config';
|
|
5
5
|
export type PreparedPackagedUpdateStartup = Readonly<{
|
|
6
6
|
status: 'ready';
|
|
7
7
|
release: PackagedDesktopRelease;
|