@adea-ai/app-framework 0.39.2 → 0.39.4
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 +158 -52
- package/dist/app/application.d.ts +0 -1
- package/dist/app/application.js +8 -6
- package/dist/app/create-application.js +3 -11
- package/dist/app/service-registry.d.ts +0 -1
- package/dist/app/service-registry.js +3 -3
- package/dist/app/value-guards.d.ts +2 -0
- package/dist/app/value-guards.js +6 -1
- package/dist/appearance/appearance-host.d.ts +1 -1
- package/dist/appearance/appearance-host.js +11 -2
- package/dist/appearance/appearance-preferences.d.ts +0 -1
- package/dist/appearance/custom-theme-import.d.ts +8 -2
- package/dist/appearance/custom-theme-import.js +58 -23
- package/dist/appearance/custom-theme-library.d.ts +3 -3
- package/dist/appearance/custom-theme-library.js +3 -3
- package/dist/appearance/theme-file-importer.d.ts +1 -1
- package/dist/appearance/theme-file-importer.js +2 -1
- package/dist/appearance/theme-library-mutation.d.ts +7 -0
- package/dist/appearance/theme-library-mutation.js +10 -2
- package/dist/appearance/theme-library-store.d.ts +17 -13
- package/dist/appearance/theme-library-store.js +35 -22
- package/dist/appearance/theme-record-adapter.js +1 -2
- package/dist/appearance/theme-registry.js +0 -1
- package/dist/cli/cli-runner.d.ts +3 -2
- package/dist/cli/cli-runner.js +5 -10
- package/dist/cli/release-assets-plan-cli.js +2 -2
- package/dist/cli/release-cut-cli.js +2 -3
- package/dist/cli/release-descriptor-staging-cli.js +2 -2
- package/dist/cli/release-finalize-cli.js +3 -3
- package/dist/cli/release-promote-cli.js +2 -2
- package/dist/cli/release-publish-cli.js +2 -2
- package/dist/cli/release-sign-cli.js +2 -1
- package/dist/cli/release-step-cli.js +2 -2
- package/dist/desktop/channel-proof.js +27 -11
- package/dist/desktop/client-assets.d.ts +6 -1
- package/dist/desktop/client-assets.js +16 -3
- package/dist/desktop/client-dev-proxy.d.ts +0 -2
- package/dist/desktop/client-dev-proxy.js +2 -2
- package/dist/desktop/desktop-client.js +2 -1
- package/dist/desktop/desktop-gateway.js +24 -82
- package/dist/desktop/desktop-host-websocket.d.ts +5 -1
- package/dist/desktop/desktop-host-websocket.js +9 -7
- package/dist/desktop/desktop-host.d.ts +5 -0
- package/dist/desktop/desktop-host.js +3 -0
- package/dist/desktop/desktop-stream.js +5 -10
- package/dist/desktop/typed-array-intrinsics.d.ts +6 -0
- package/dist/desktop/typed-array-intrinsics.js +13 -1
- package/dist/developer-app/developer-app.d.ts +1 -1
- package/dist/developer-app/developer-app.js +26 -13
- package/dist/framework-source.json +1 -1
- package/dist/installer/command-artifact.d.ts +1 -0
- package/dist/installer/command-artifact.js +47 -27
- package/dist/installer/installed-payload.js +3 -1
- package/dist/installer/installer-ci-bootstrap.js +5 -6
- package/dist/installer/installer-ci-preflight.js +3 -3
- package/dist/installer/installer-identity.d.ts +0 -22
- package/dist/installer/installer-identity.js +3 -53
- package/dist/installer/installer-image-mount.d.ts +0 -1
- package/dist/installer/installer-image-mount.js +1 -1
- package/dist/installer/installer-observation.d.ts +5 -5
- package/dist/installer/installer-observation.js +32 -47
- package/dist/installer/installer-process-cleanup.js +2 -2
- package/dist/installer/installer-renderer-evidence.js +7 -28
- package/dist/installer/installer-upgrade-command.js +8 -20
- package/dist/installer/installer-worker-guard.js +3 -3
- package/dist/native/cef-helper.js +4 -4
- package/dist/native/desktop-build.d.ts +0 -3
- package/dist/native/desktop-build.js +2 -2
- package/dist/native/electrobun-source-patch.d.ts +4 -0
- package/dist/native/electrobun-source-patch.js +5 -1
- package/dist/native/native-utilities.js +4 -3
- package/dist/native/pinned-download.d.ts +16 -0
- package/dist/native/pinned-download.js +42 -0
- package/dist/native/posix-launcher-build.js +15 -35
- package/dist/native/posix-tree-removal.js +21 -33
- package/dist/native/sidecar-services.d.ts +0 -2
- package/dist/native/sidecar-services.js +1 -1
- package/dist/native/sidecar.d.ts +3 -0
- package/dist/native/sidecar.js +15 -2
- package/dist/native/window-surface-store.js +3 -3
- package/dist/native/windows-extractor-build.d.ts +6 -16
- package/dist/native/windows-extractor-build.js +11 -14
- package/dist/release/feed-release-cut.d.ts +2 -6
- package/dist/release/feed-release-cut.js +5 -93
- package/dist/release/feed-state.js +1 -5
- package/dist/release/github-release-cut.js +5 -66
- package/dist/release/github-release-provenance.d.ts +2 -0
- package/dist/release/github-release-provenance.js +4 -7
- package/dist/release/github-release-publisher.js +2 -2
- package/dist/release/github-release-qualification.js +3 -3
- package/dist/release/local-release.d.ts +3 -3
- package/dist/release/local-release.js +12 -23
- package/dist/release/qualification-run.js +1 -1
- package/dist/release/release-assets-plan.js +1 -1
- package/dist/release/release-config.d.ts +7 -15
- package/dist/release/release-config.js +25 -29
- package/dist/release/release-cut-command.d.ts +1 -1
- package/dist/release/release-cut-command.js +1 -1
- package/dist/release/release-cut.d.ts +5 -32
- package/dist/release/release-cut.js +9 -55
- package/dist/release/release-descriptor-staging.js +3 -8
- package/dist/release/release-promotion.js +2 -1
- package/dist/release/release-publish-command.js +5 -15
- package/dist/release/release-qualification.js +1 -1
- package/dist/shared/bounded-body.d.ts +33 -0
- package/dist/shared/bounded-body.js +102 -0
- package/dist/shared/file-system.d.ts +12 -0
- package/dist/shared/file-system.js +40 -0
- package/dist/shell/app-shell.js +29 -14
- package/dist/shell/app-utilities.d.ts +2 -1
- package/dist/shell/app-utilities.js +2 -1
- package/dist/shell/application-menu.d.ts +1 -1
- package/dist/shell/application-menu.js +7 -3
- package/dist/shell/poll.d.ts +27 -0
- package/dist/shell/poll.js +88 -0
- package/dist/update-helper.bundle.js +268 -144
- package/dist/updates/channel-update-manager.js +0 -1
- package/dist/updates/desktop-updater.d.ts +9 -0
- package/dist/updates/desktop-updater.js +103 -50
- package/dist/updates/feed/release-feed.d.ts +7 -4
- package/dist/updates/feed/release-feed.js +3 -7
- package/dist/updates/feed/release-location.js +6 -26
- package/dist/updates/feed/release-version.d.ts +7 -2
- package/dist/updates/feed/release-version.js +9 -2
- package/dist/updates/feed/signed-release.d.ts +1 -1
- package/dist/updates/feed/signed-release.js +2 -2
- package/dist/updates/feed/update-discovery.js +2 -6
- package/dist/updates/helper/launch-gate-recovery.js +28 -78
- package/dist/updates/helper/resume-staging.d.ts +14 -3
- package/dist/updates/helper/resume-staging.js +23 -37
- package/dist/updates/helper/update-helper.d.ts +6 -2
- package/dist/updates/helper/update-helper.js +38 -33
- package/dist/updates/helper/update-resume.js +9 -6
- package/dist/updates/install/update-extraction.js +28 -8
- package/dist/updates/install/update-handoff-plan.d.ts +0 -1
- package/dist/updates/install/update-handoff-plan.js +3 -4
- package/dist/updates/install/update-swap-stage.js +1 -6
- package/dist/updates/install/update-swap.d.ts +5 -2
- package/dist/updates/install/update-swap.js +193 -72
- package/dist/updates/launch/helper-exit-wait.d.ts +6 -0
- package/dist/updates/launch/helper-exit-wait.js +18 -0
- package/dist/updates/launch/packaged-update-startup.js +8 -6
- package/dist/updates/launch/update-launch-gate.js +7 -14
- package/dist/updates/locks/stable-file.js +4 -1
- package/dist/updates/locks/update-helper-presence.d.ts +12 -0
- package/dist/updates/locks/update-helper-presence.js +27 -0
- package/dist/updates/retention/retention-cleanup.js +10 -9
- package/dist/updates/retention/retention-maintenance.d.ts +40 -0
- package/dist/updates/retention/retention-maintenance.js +95 -0
- package/dist/updates/retention/retention-prune-progress.js +4 -5
- package/dist/updates/retention/retirement-inventory.d.ts +13 -0
- package/dist/updates/retention/retirement-inventory.js +39 -31
- package/dist/updates/retention/retirement-records.d.ts +1 -4
- package/dist/updates/retention/retirement-records.js +18 -32
- package/dist/updates/retention/update-retention-marker.d.ts +4 -0
- package/dist/updates/retention/update-retention-marker.js +9 -14
- package/dist/updates/retention/update-retirement.d.ts +12 -0
- package/dist/updates/retention/update-retirement.js +59 -31
- package/dist/updates/update-adapter.d.ts +1 -23
- package/dist/updates/update-adapter.js +31 -24
- package/dist/updates/update-channel-store.d.ts +2 -1
- package/dist/updates/update-channel-store.js +6 -4
- package/dist/updates/update-manager.js +2 -2
- package/dist/updates/update-services.d.ts +1 -1
- package/dist/updates/update-services.js +9 -4
- package/dist/updates/update-state-store.d.ts +0 -2
- package/dist/updates/update-state-store.js +5 -12
- package/dist/updates/update-state.d.ts +6 -10
- package/dist/updates/update-state.js +1 -1
- package/dist/views/app-help.d.ts +1 -1
- package/dist/views/app-help.js +1 -3
- package/dist/views/appearance-surface.js +15 -8
- package/dist/views/update-surface.d.ts +1 -3
- package/dist/views/update-surface.js +2 -2
- package/package.json +18 -16
- package/src/app/application.tsx +13 -6
- package/src/appearance/appearance-host.tsx +17 -7
- package/src/appearance/appearance-preferences.ts +0 -1
- package/src/appearance/custom-theme-import.ts +99 -26
- package/src/appearance/custom-theme-library.ts +3 -2
- package/src/appearance/theme-file-importer.ts +3 -2
- package/src/appearance/theme-library-mutation.ts +20 -8
- package/src/appearance/theme-library-schema.ts +7 -0
- package/src/appearance/theme-library-store.ts +41 -26
- package/src/desktop/client-assets.ts +27 -12
- package/src/shell/app-shell.tsx +33 -13
- package/src/shell/app-utilities.tsx +7 -1
- package/src/shell/poll.ts +125 -0
- package/src/updates/feed/release-version.ts +11 -3
- package/src/updates/update-adapter.ts +27 -44
- package/src/updates/update-state.ts +7 -13
- package/src/views/app-help.tsx +1 -1
- package/src/views/appearance-surface.tsx +39 -11
- package/src/views/update-surface.tsx +0 -4
- package/templates/application/.github/workflows/release-assets.yml +2 -2
- package/templates/application/README.md +3 -3
- package/dist/native/cef-helper-download.d.ts +0 -1
- package/dist/native/cef-helper-download.js +0 -35
- package/src/desktop/client-response-lifecycle.ts +0 -305
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type ReleaseTrust } from '../feed/signed-release';
|
|
2
2
|
import { type UpdateStageState } from '../update-state-store';
|
|
3
|
-
import {
|
|
3
|
+
import { type UpdateTreeDigest } from '../install/update-swap';
|
|
4
4
|
import type { UpdateResumeResult } from './update-resume';
|
|
5
|
-
export { exists };
|
|
6
5
|
/** Candidate digests proved by a staged resume result, keyed by that result object. */
|
|
7
6
|
export declare const provenCandidateTreeDigests: WeakMap<object, string>;
|
|
8
7
|
export declare function readTreeDigestForProof(path: string): Promise<string | undefined>;
|
|
@@ -17,7 +16,16 @@ export declare function recoverLegacyHandoff(options: {
|
|
|
17
16
|
}): Promise<UpdateResumeResult>;
|
|
18
17
|
export declare function resetToStaged(staging: string, state: UpdateStageState): Promise<UpdateStageState>;
|
|
19
18
|
export declare function hasUnknownStagingEntries(staging: string, allowed?: readonly string[], generation?: string): Promise<boolean>;
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* A reconciled journal. `provenCandidateTreeDigest` is set when this call
|
|
21
|
+
* already proved the staged candidate tree, so recovery in the same lock hold
|
|
22
|
+
* need not hash it again.
|
|
23
|
+
*/
|
|
24
|
+
type ReconciledSwap = Readonly<{
|
|
25
|
+
state: UpdateStageState;
|
|
26
|
+
provenCandidateTreeDigest?: UpdateTreeDigest;
|
|
27
|
+
}>;
|
|
28
|
+
export declare function reconcileSwap(target: string, staging: string, state: UpdateStageState): Promise<ReconciledSwap | undefined>;
|
|
21
29
|
export declare function recoverStagedCandidate(options: {
|
|
22
30
|
target: string;
|
|
23
31
|
staging: string;
|
|
@@ -25,4 +33,7 @@ export declare function recoverStagedCandidate(options: {
|
|
|
25
33
|
trust: ReleaseTrust;
|
|
26
34
|
currentVersion: string;
|
|
27
35
|
allowDigestlessLegacy?: boolean;
|
|
36
|
+
/** A digest `reconcileSwap` proved for this candidate in the same lock hold. */
|
|
37
|
+
provenCandidateTreeDigest?: UpdateTreeDigest | undefined;
|
|
28
38
|
}): Promise<UpdateResumeResult>;
|
|
39
|
+
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { errorCode } from "../../app/value-guards.js";
|
|
2
2
|
import { verifyReleaseDescriptor } from "../feed/signed-release.js";
|
|
3
3
|
import { renameExclusive } from "../../native/native-rename.js";
|
|
4
|
-
import { parseUpdateHelperRequest } from "./update-helper.js";
|
|
4
|
+
import { KNOWN_STAGING_ENTRIES, parseUpdateHelperRequest, removeUpdateHelperArtifacts, stateTemporaryPattern } from "./update-helper.js";
|
|
5
5
|
import { updateProcessMayBeAlive } from "../locks/update-process-liveness.js";
|
|
6
6
|
import { readUpdateHelperRequestFile, writeUpdateStageState } from "../update-state-store.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { readInstalledUpdateTreeDigest, readUpdateTreeDigest, readUpdateTreeIdentity, readUpdateTreeVersion, sameUpdateTreeDigest, sameUpdateTreeIdentity } from "../install/update-swap.js";
|
|
8
|
+
import { pathExists } from "../../shared/file-system.js";
|
|
9
|
+
import { lstat, readdir } from "node:fs/promises";
|
|
9
10
|
import { join } from "node:path";
|
|
10
11
|
import { randomUUID } from "node:crypto";
|
|
11
12
|
// src/updates/helper/resume-staging.ts
|
|
@@ -69,9 +70,9 @@ async function recoverLegacyHandoff(options) {
|
|
|
69
70
|
const candidate = join(staging, "candidate");
|
|
70
71
|
const old = join(staging, "old");
|
|
71
72
|
const [targetExists, candidateExists, oldExists] = await Promise.all([
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
pathExists(target),
|
|
74
|
+
pathExists(candidate),
|
|
75
|
+
pathExists(old)
|
|
75
76
|
]);
|
|
76
77
|
if (!candidateExists || await readUpdateTreeVersion(candidate) !== request.version) return { status: "recovery-required" };
|
|
77
78
|
const candidateInfo = await lstat(candidate);
|
|
@@ -94,52 +95,34 @@ async function resetToStaged(staging, state) {
|
|
|
94
95
|
...recoverable,
|
|
95
96
|
phase: "staged"
|
|
96
97
|
};
|
|
97
|
-
await
|
|
98
|
+
await removeUpdateHelperArtifacts(staging);
|
|
98
99
|
await writeUpdateStageState(staging, next);
|
|
99
100
|
return next;
|
|
100
101
|
}
|
|
101
|
-
async function clearHelperArtifacts(staging) {
|
|
102
|
-
await rm(join(staging, "request.json"), { force: true });
|
|
103
|
-
await rm(join(staging, "helper-armed"), { force: true });
|
|
104
|
-
await rm(join(staging, "helper-ready"), { force: true });
|
|
105
|
-
await rm(join(staging, "cancel.json"), { force: true });
|
|
106
|
-
await rm(join(staging, "cancel-ack.json"), { force: true });
|
|
107
|
-
await rm(join(staging, "helper"), {
|
|
108
|
-
recursive: true,
|
|
109
|
-
force: true
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
var knownStagingEntries = /* @__PURE__ */ new Set([
|
|
113
|
-
"candidate",
|
|
114
|
-
"helper",
|
|
115
|
-
"helper-armed",
|
|
116
|
-
"helper-ready",
|
|
117
|
-
"cancel.json",
|
|
118
|
-
"cancel-ack.json",
|
|
119
|
-
"request.json",
|
|
120
|
-
"state.json"
|
|
121
|
-
]);
|
|
122
102
|
async function hasUnknownStagingEntries(staging, allowed = [], generation) {
|
|
123
103
|
const entries = await readdir(staging);
|
|
124
|
-
const stateTemporary = generation ?
|
|
125
|
-
return entries.some((entry) => !
|
|
104
|
+
const stateTemporary = generation ? stateTemporaryPattern(generation) : void 0;
|
|
105
|
+
return entries.some((entry) => !KNOWN_STAGING_ENTRIES.has(entry) && !allowed.includes(entry) && !(stateTemporary?.test(entry) ?? false));
|
|
126
106
|
}
|
|
127
107
|
async function reconcileSwap(target, staging, state) {
|
|
128
108
|
const candidate = join(staging, "candidate");
|
|
129
109
|
const old = join(staging, "old");
|
|
130
|
-
if (!await
|
|
110
|
+
if (!await pathExists(target) && await pathExists(old) && await pathExists(candidate)) {
|
|
131
111
|
if (await hasUnknownStagingEntries(staging, ["old"], state.generation)) return void 0;
|
|
132
112
|
try {
|
|
133
113
|
const [oldInfo, candidateInfo] = await Promise.all([lstat(old), lstat(candidate)]);
|
|
134
114
|
const [oldIdentity, candidateIdentity] = await Promise.all([readUpdateTreeIdentity(old), readUpdateTreeIdentity(candidate)]);
|
|
135
115
|
if (!oldInfo.isDirectory() || oldInfo.isSymbolicLink() || !candidateInfo.isDirectory() || candidateInfo.isSymbolicLink() || !oldIdentity || !candidateIdentity || !sameUpdateTreeIdentity(candidateIdentity, state.candidateTreeIdentity) || sameUpdateTreeIdentity(oldIdentity, candidateIdentity) || state.previousTreeIdentity && !sameUpdateTreeIdentity(oldIdentity, state.previousTreeIdentity) || await readUpdateTreeVersion(old) !== state.previousVersion || await readUpdateTreeVersion(candidate) !== state.version || state.candidateTreeDigest !== void 0 && !sameUpdateTreeDigest(await readTreeDigestForProof(candidate), state.candidateTreeDigest)) return void 0;
|
|
136
116
|
renameExclusive(old, target);
|
|
137
|
-
return
|
|
117
|
+
return {
|
|
118
|
+
state: await resetToStaged(staging, state),
|
|
119
|
+
provenCandidateTreeDigest: state.candidateTreeDigest
|
|
120
|
+
};
|
|
138
121
|
} catch {
|
|
139
122
|
return;
|
|
140
123
|
}
|
|
141
124
|
}
|
|
142
|
-
if (await
|
|
125
|
+
if (await pathExists(old) || await hasUnknownStagingEntries(staging, [], state.generation) || !await pathExists(target) || !await pathExists(candidate)) return void 0;
|
|
143
126
|
try {
|
|
144
127
|
const [targetInfo, candidateInfo] = await Promise.all([lstat(target), lstat(candidate)]);
|
|
145
128
|
if (!targetInfo.isDirectory() || targetInfo.isSymbolicLink() || !candidateInfo.isDirectory() || candidateInfo.isSymbolicLink()) return void 0;
|
|
@@ -148,14 +131,17 @@ async function reconcileSwap(target, staging, state) {
|
|
|
148
131
|
}
|
|
149
132
|
const [targetVersion, candidateVersion] = await Promise.all([readUpdateTreeVersion(target), readUpdateTreeVersion(candidate)]);
|
|
150
133
|
const [targetIdentity, candidateIdentity] = await Promise.all([readUpdateTreeIdentity(target), readUpdateTreeIdentity(candidate)]);
|
|
151
|
-
if (targetVersion === state.previousVersion && candidateVersion === state.version && targetIdentity !== void 0 && candidateIdentity !== void 0 && sameUpdateTreeIdentity(candidateIdentity, state.candidateTreeIdentity) && (state.candidateTreeDigest === void 0 || sameUpdateTreeDigest(await readTreeDigestForProof(candidate), state.candidateTreeDigest)) && !sameUpdateTreeIdentity(targetIdentity, candidateIdentity) && (!state.previousTreeIdentity || sameUpdateTreeIdentity(targetIdentity, state.previousTreeIdentity))) return
|
|
134
|
+
if (targetVersion === state.previousVersion && candidateVersion === state.version && targetIdentity !== void 0 && candidateIdentity !== void 0 && sameUpdateTreeIdentity(candidateIdentity, state.candidateTreeIdentity) && (state.candidateTreeDigest === void 0 || sameUpdateTreeDigest(await readTreeDigestForProof(candidate), state.candidateTreeDigest)) && !sameUpdateTreeIdentity(targetIdentity, candidateIdentity) && (!state.previousTreeIdentity || sameUpdateTreeIdentity(targetIdentity, state.previousTreeIdentity))) return {
|
|
135
|
+
state: await resetToStaged(staging, state),
|
|
136
|
+
provenCandidateTreeDigest: state.candidateTreeDigest
|
|
137
|
+
};
|
|
152
138
|
if (targetVersion === state.version && candidateVersion === state.previousVersion && sameUpdateTreeIdentity(targetIdentity, state.candidateTreeIdentity) && (state.candidateTreeDigest === void 0 || sameUpdateTreeDigest(await readInstalledTreeDigestForProof(target), state.candidateTreeDigest)) && sameUpdateTreeIdentity(candidateIdentity, state.previousTreeIdentity)) {
|
|
153
139
|
const completed = {
|
|
154
140
|
...state,
|
|
155
141
|
phase: "completed"
|
|
156
142
|
};
|
|
157
143
|
await writeUpdateStageState(staging, completed);
|
|
158
|
-
return completed;
|
|
144
|
+
return { state: completed };
|
|
159
145
|
}
|
|
160
146
|
}
|
|
161
147
|
async function recoverStagedCandidate(options) {
|
|
@@ -174,7 +160,7 @@ async function recoverStagedCandidate(options) {
|
|
|
174
160
|
throw error;
|
|
175
161
|
}
|
|
176
162
|
if (!info.isDirectory() || info.isSymbolicLink()) return { status: "recovery-required" };
|
|
177
|
-
if (await
|
|
163
|
+
if (await pathExists(join(staging, "old")) || await readUpdateTreeVersion(candidate) !== state.version || !sameUpdateTreeIdentity(await readUpdateTreeIdentity(candidate), state.candidateTreeIdentity) || state.candidateTreeDigest !== void 0 && !sameUpdateTreeDigest(options.provenCandidateTreeDigest, state.candidateTreeDigest) && !sameUpdateTreeDigest(await readTreeDigestForProof(candidate), state.candidateTreeDigest)) return { status: "recovery-required" };
|
|
178
164
|
const result = {
|
|
179
165
|
status: "staged",
|
|
180
166
|
version: state.version,
|
|
@@ -183,4 +169,4 @@ async function recoverStagedCandidate(options) {
|
|
|
183
169
|
if (state.candidateTreeDigest !== void 0) provenCandidateTreeDigests.set(result, state.candidateTreeDigest);
|
|
184
170
|
return result;
|
|
185
171
|
}
|
|
186
|
-
export {
|
|
172
|
+
export { hasUnknownStagingEntries, provenCandidateTreeDigests, readInstalledTreeDigestForProof, readTreeDigestForProof, reconcileSwap, recoverLegacyHandoff, recoverStagedCandidate, resetToStaged };
|
|
@@ -13,12 +13,16 @@ export type UpdateHelperRequest = Readonly<{
|
|
|
13
13
|
generation?: string;
|
|
14
14
|
helperOwner?: string;
|
|
15
15
|
}>;
|
|
16
|
+
/** Every fixed name the updater creates inside its staging directory. */
|
|
17
|
+
export declare const KNOWN_STAGING_ENTRIES: ReadonlySet<string>;
|
|
18
|
+
/** The temporary names `writeUpdateStageState` leaves for one generation's journal. */
|
|
19
|
+
export declare function stateTemporaryPattern(generation: string): RegExp;
|
|
16
20
|
/** Return whether a staging directory contains artifacts from a helper handoff. */
|
|
17
21
|
export declare function hasUpdateHelperArtifacts(staging: string): Promise<boolean>;
|
|
22
|
+
/** Remove every helper handoff artifact, the copied bundle directory last. */
|
|
23
|
+
export declare function removeUpdateHelperArtifacts(staging: string): Promise<void>;
|
|
18
24
|
/** Validate a helper request's shape. */
|
|
19
25
|
export declare function parseUpdateHelperRequest(value: unknown): UpdateHelperRequest;
|
|
20
|
-
/** Return false only when the path is absent; surface permission and path errors. */
|
|
21
|
-
export declare function updatePathExists(path: string): Promise<boolean>;
|
|
22
26
|
/**
|
|
23
27
|
* The post-exit helper: wait for the app's processes to exit, swap in the
|
|
24
28
|
* staged candidate, record the new version and relaunch the app. Run from a
|
|
@@ -1,25 +1,38 @@
|
|
|
1
|
-
import { errorCode, isUuid } from "../../app/value-guards.js";
|
|
1
|
+
import { UUID_SOURCE, errorCode, isUuid } from "../../app/value-guards.js";
|
|
2
2
|
import { publishExclusiveUpdateMarker, publishExclusiveUpdateMarkerSync, readUpdateMarker } from "../install/update-marker.js";
|
|
3
3
|
import { launchInstalledApp } from "../launch/update-launch.js";
|
|
4
4
|
import { UpdateProcessFenceCancelledError, waitForUpdateProcesses } from "../locks/update-process-fence.js";
|
|
5
5
|
import { readInstalledUpdateTreeDigest, 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";
|
|
6
|
+
import { acquireUpdateLock, readUpdateHelperRequestFile, readUpdateStageState, writeUpdateStageState, writeUpdateStageStateDurably } from "../update-state-store.js";
|
|
7
7
|
import { cancelUpdateLaunchGateBeforeTransition, publishUpdateLaunchGate, tryAcquireUpdateHelperLiveness, waitForUpdateLaunchGateWriter } from "../launch/update-launch-gate.js";
|
|
8
8
|
import { isCanonicalPath } from "../../native/canonical-path.js";
|
|
9
|
-
import {
|
|
9
|
+
import { isReleaseVersion } from "../feed/release-version.js";
|
|
10
|
+
import { pathExists } from "../../shared/file-system.js";
|
|
11
|
+
import { lstat, realpath, rm } from "node:fs/promises";
|
|
10
12
|
import { join } from "node:path";
|
|
11
|
-
import { constants as constants$1 } from "node:fs";
|
|
12
13
|
// src/updates/helper/update-helper.ts
|
|
14
|
+
/** Files and the copied bundle directory a helper handoff leaves in staging. */
|
|
15
|
+
var UPDATE_HELPER_ARTIFACTS = [
|
|
16
|
+
"request.json",
|
|
17
|
+
"helper-armed",
|
|
18
|
+
"helper-ready",
|
|
19
|
+
"cancel.json",
|
|
20
|
+
"cancel-ack.json",
|
|
21
|
+
"helper"
|
|
22
|
+
];
|
|
23
|
+
/** Every fixed name the updater creates inside its staging directory. */
|
|
24
|
+
var KNOWN_STAGING_ENTRIES = /* @__PURE__ */ new Set([
|
|
25
|
+
"candidate",
|
|
26
|
+
"state.json",
|
|
27
|
+
...UPDATE_HELPER_ARTIFACTS
|
|
28
|
+
]);
|
|
29
|
+
/** The temporary names `writeUpdateStageState` leaves for one generation's journal. */
|
|
30
|
+
function stateTemporaryPattern(generation) {
|
|
31
|
+
return new RegExp(`^\\.state-${generation}-${UUID_SOURCE}\\.tmp$`, "i");
|
|
32
|
+
}
|
|
13
33
|
/** Return whether a staging directory contains artifacts from a helper handoff. */
|
|
14
34
|
async function hasUpdateHelperArtifacts(staging) {
|
|
15
|
-
for (const name of
|
|
16
|
-
"request.json",
|
|
17
|
-
"helper-armed",
|
|
18
|
-
"helper-ready",
|
|
19
|
-
"cancel.json",
|
|
20
|
-
"cancel-ack.json",
|
|
21
|
-
"helper"
|
|
22
|
-
]) try {
|
|
35
|
+
for (const name of UPDATE_HELPER_ARTIFACTS) try {
|
|
23
36
|
await lstat(join(staging, name));
|
|
24
37
|
return true;
|
|
25
38
|
} catch (error) {
|
|
@@ -27,6 +40,13 @@ async function hasUpdateHelperArtifacts(staging) {
|
|
|
27
40
|
}
|
|
28
41
|
return false;
|
|
29
42
|
}
|
|
43
|
+
/** Remove every helper handoff artifact, the copied bundle directory last. */
|
|
44
|
+
async function removeUpdateHelperArtifacts(staging) {
|
|
45
|
+
for (const name of UPDATE_HELPER_ARTIFACTS) await rm(join(staging, name), {
|
|
46
|
+
recursive: name === "helper",
|
|
47
|
+
force: true
|
|
48
|
+
});
|
|
49
|
+
}
|
|
30
50
|
/** Validate a helper request's shape. */
|
|
31
51
|
function parseUpdateHelperRequest(value) {
|
|
32
52
|
const data = value;
|
|
@@ -35,18 +55,13 @@ function parseUpdateHelperRequest(value) {
|
|
|
35
55
|
"windows-x64",
|
|
36
56
|
"linux-x64",
|
|
37
57
|
"linux-arm64"
|
|
38
|
-
].includes(data.platform) || typeof data.version !== "string" ||
|
|
58
|
+
].includes(data.platform) || typeof data.version !== "string" || !isReleaseVersion(data.version) || !Array.isArray(data.processes) || data.schema === 2 && (typeof data.generation !== "string" || !/^[0-9a-f-]{36}$/i.test(data.generation) || data.helperOwner !== void 0 && (typeof data.helperOwner !== "string" || !/^[0-9a-f-]{36}$/i.test(data.helperOwner))) || data.schema === 3 && (typeof data.generation !== "string" || !isUuid(data.generation) || typeof data.helperOwner !== "string" || !isUuid(data.helperOwner)) || !Number.isSafeInteger(data.processTimeoutMs) || data.processTimeoutMs < 1 || data.processTimeoutMs > 12e4) throw new Error("Invalid update helper request");
|
|
39
59
|
return Object.freeze(data);
|
|
40
60
|
}
|
|
41
61
|
async function readRequest(staging) {
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
return parseUpdateHelperRequest(JSON.parse(await file.readFile("utf8")));
|
|
47
|
-
} finally {
|
|
48
|
-
await file.close();
|
|
49
|
-
}
|
|
62
|
+
const text = await readUpdateHelperRequestFile(staging);
|
|
63
|
+
if (text === void 0) throw new Error("Invalid update helper request");
|
|
64
|
+
return parseUpdateHelperRequest(JSON.parse(text));
|
|
50
65
|
}
|
|
51
66
|
async function cancellationRequested(staging, generation, helperOwner) {
|
|
52
67
|
const value = await readUpdateMarker(staging, "cancel.json");
|
|
@@ -65,16 +80,6 @@ async function acknowledgeUpdateCancellation(staging, request) {
|
|
|
65
80
|
...request.schema === 3 ? { launchGateOwner: current.launchGateOwner } : {}
|
|
66
81
|
});
|
|
67
82
|
}
|
|
68
|
-
/** Return false only when the path is absent; surface permission and path errors. */
|
|
69
|
-
async function updatePathExists(path) {
|
|
70
|
-
try {
|
|
71
|
-
await lstat(path);
|
|
72
|
-
return true;
|
|
73
|
-
} catch (error) {
|
|
74
|
-
if (errorCode(error) === "ENOENT") return false;
|
|
75
|
-
throw error;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
83
|
/**
|
|
79
84
|
* The post-exit helper: wait for the app's processes to exit, swap in the
|
|
80
85
|
* staged candidate, record the new version and relaunch the app. Run from a
|
|
@@ -172,7 +177,7 @@ async function runUpdateHelperWithRequest(options, request, binding, helperLiven
|
|
|
172
177
|
});
|
|
173
178
|
outcome = "updated";
|
|
174
179
|
} catch {
|
|
175
|
-
if ((await readUpdateStageState(options.staging).catch(() => void 0))?.phase === "armed" && request.schema === 2 && request.generation && request.helperOwner && await
|
|
180
|
+
if ((await readUpdateStageState(options.staging).catch(() => void 0))?.phase === "armed" && request.schema === 2 && request.generation && request.helperOwner && await pathExists(join(options.staging, "cancel.json")).catch(() => false)) throw new Error("Update helper could not acknowledge cancellation before the install transition");
|
|
176
181
|
} finally {
|
|
177
182
|
await swapLock.release();
|
|
178
183
|
}
|
|
@@ -365,4 +370,4 @@ async function runSchema3UpdateHelper(options, request, helperLiveness) {
|
|
|
365
370
|
await launchInstalledApp(request.platform, request.target, options.env);
|
|
366
371
|
return "updated";
|
|
367
372
|
}
|
|
368
|
-
export { hasUpdateHelperArtifacts, parseUpdateHelperRequest, runUpdateHelper,
|
|
373
|
+
export { KNOWN_STAGING_ENTRIES, hasUpdateHelperArtifacts, parseUpdateHelperRequest, removeUpdateHelperArtifacts, runUpdateHelper, stateTemporaryPattern };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { renameExclusive } from "../../native/native-rename.js";
|
|
2
2
|
import { hasUpdateHelperArtifacts } from "./update-helper.js";
|
|
3
3
|
import { updateProcessMayBeAlive } from "../locks/update-process-liveness.js";
|
|
4
|
+
import { recordedUpdateHelperMayBeRunning } from "../locks/update-helper-presence.js";
|
|
4
5
|
import { UpdateLockBusyError, acquireUpdateLock, readUpdateStageState } from "../update-state-store.js";
|
|
5
|
-
import {
|
|
6
|
+
import { readUpdateTreeIdentity, readUpdateTreeVersion, sameUpdateTreeDigest, sameUpdateTreeIdentity, updateStagingFor } from "../install/update-swap.js";
|
|
6
7
|
import { acquireRetainedUpdateTrees, acquireRetainedUpdateTreesWhileLocked } from "../retention/retirement-inventory.js";
|
|
7
8
|
import { reconcileRetirementCleanupMarkerWhileLocked, retireCompletedUpdateWhileLocked } from "../retention/update-retirement.js";
|
|
8
9
|
import { matchesOldTree, updateRetirementPaths } from "../retention/retirement-records.js";
|
|
9
10
|
import { readUpdateLaunchGate } from "../launch/update-launch-gate.js";
|
|
10
11
|
import { hasUnknownStagingEntries, provenCandidateTreeDigests, readInstalledTreeDigestForProof, reconcileSwap, recoverLegacyHandoff, recoverStagedCandidate, resetToStaged } from "./resume-staging.js";
|
|
12
|
+
import { pathExists } from "../../shared/file-system.js";
|
|
11
13
|
import { recoverUpdateLaunchGate } from "./launch-gate-recovery.js";
|
|
12
14
|
import { lstat, readFile, readdir, rmdir, unlink } from "node:fs/promises";
|
|
13
15
|
import { join } from "node:path";
|
|
@@ -29,7 +31,7 @@ async function setAsideStaleCompletedStaging(options) {
|
|
|
29
31
|
const installedVersion = await readUpdateTreeVersion(target);
|
|
30
32
|
if (!installedVersion) return { status: "recovery-required" };
|
|
31
33
|
const paths = updateRetirementPaths(target, state.generation);
|
|
32
|
-
if (await
|
|
34
|
+
if (await pathExists(paths.claim) || await pathExists(paths.container)) return { status: "recovery-required" };
|
|
33
35
|
if (await hasUnknownStagingEntries(staging, [], state.generation) || !await matchesOldTree(join(staging, "candidate"), state)) return { status: "recovery-required" };
|
|
34
36
|
const current = await readUpdateStageState(staging);
|
|
35
37
|
if (!current || current.generation !== state.generation || current.phase !== "completed") return { status: "recovery-required" };
|
|
@@ -45,7 +47,7 @@ async function setAsideStaleCompletedStaging(options) {
|
|
|
45
47
|
async function resumeLocked(options) {
|
|
46
48
|
const { target, staging, trust, currentVersion } = options;
|
|
47
49
|
const launchGate = await readUpdateLaunchGate(target);
|
|
48
|
-
if (!await
|
|
50
|
+
if (!await pathExists(staging)) {
|
|
49
51
|
if (launchGate) return { status: "recovery-required" };
|
|
50
52
|
const cleanup = await reconcileRetirementCleanupMarkerWhileLocked({
|
|
51
53
|
target,
|
|
@@ -102,7 +104,7 @@ async function resumeLocked(options) {
|
|
|
102
104
|
return { status: "recovery-required" };
|
|
103
105
|
}
|
|
104
106
|
if (state.launchGateOwner !== void 0 && state.phase !== "completed" && state.phase !== "retiring" && state.phase !== "retired") return { status: "recovery-required" };
|
|
105
|
-
if (
|
|
107
|
+
if (await recordedUpdateHelperMayBeRunning(target, state)) return { status: "in-progress" };
|
|
106
108
|
if (!state.helperPid && await hasUpdateHelperArtifacts(staging)) return { status: "recovery-required" };
|
|
107
109
|
if (state.launchGateOwner && !state.candidateTreeDigest) return { status: "recovery-required" };
|
|
108
110
|
if (state.phase === "staged") {
|
|
@@ -129,7 +131,7 @@ async function resumeLocked(options) {
|
|
|
129
131
|
if (state.phase === "swapping") {
|
|
130
132
|
const reconciled = await reconcileSwap(target, staging, state);
|
|
131
133
|
if (!reconciled) return { status: "recovery-required" };
|
|
132
|
-
state = reconciled;
|
|
134
|
+
state = reconciled.state;
|
|
133
135
|
if (state.phase === "completed") {
|
|
134
136
|
if (await readUpdateTreeVersion(target) !== state.version) return { status: "recovery-required" };
|
|
135
137
|
if (!await retireCompletedUpdateWhileLocked({
|
|
@@ -149,7 +151,8 @@ async function resumeLocked(options) {
|
|
|
149
151
|
state,
|
|
150
152
|
trust,
|
|
151
153
|
currentVersion,
|
|
152
|
-
allowDigestlessLegacy: true
|
|
154
|
+
allowDigestlessLegacy: true,
|
|
155
|
+
provenCandidateTreeDigest: reconciled.provenCandidateTreeDigest
|
|
153
156
|
});
|
|
154
157
|
}
|
|
155
158
|
if (state.phase === "completed") {
|
|
@@ -7,7 +7,6 @@ import { lstat, mkdir, mkdtemp, open, readFile, realpath, rm, symlink } from "no
|
|
|
7
7
|
import { isAbsolute, join } from "node:path";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
9
|
import { constants as constants$1 } from "node:fs";
|
|
10
|
-
import { x } from "tar";
|
|
11
10
|
import { createZstdDecompress } from "node:zlib";
|
|
12
11
|
import { Transform } from "node:stream";
|
|
13
12
|
import { pipeline } from "node:stream/promises";
|
|
@@ -72,8 +71,9 @@ async function extractVerifiedUpdate(options) {
|
|
|
72
71
|
await output.close();
|
|
73
72
|
}
|
|
74
73
|
if (compressedBytes !== descriptor.asset.size || hash.digest("hex") !== descriptor.asset.sha256) throw new Error("Update archive changed during decompression");
|
|
75
|
-
await
|
|
76
|
-
|
|
74
|
+
const { x: extract } = await import("tar");
|
|
75
|
+
const unpack = extract({
|
|
76
|
+
sync: true,
|
|
77
77
|
cwd: payloadRoot,
|
|
78
78
|
strict: true,
|
|
79
79
|
preserveOwner: false,
|
|
@@ -113,6 +113,31 @@ async function extractVerifiedUpdate(options) {
|
|
|
113
113
|
return true;
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
|
+
let failure;
|
|
117
|
+
unpack.on("error", (error) => {
|
|
118
|
+
failure ??= error;
|
|
119
|
+
});
|
|
120
|
+
const tarFile = await open(decompressed, constants$1.O_RDONLY);
|
|
121
|
+
try {
|
|
122
|
+
let slept = performance.now();
|
|
123
|
+
read: for (;;) {
|
|
124
|
+
const chunk = Buffer.allocUnsafe(1048576);
|
|
125
|
+
const { bytesRead } = await tarFile.read(chunk, 0, chunk.length, null);
|
|
126
|
+
if (bytesRead === 0) break;
|
|
127
|
+
for (let offset = 0; offset < bytesRead; offset += 16384) {
|
|
128
|
+
unpack.write(chunk.subarray(offset, Math.min(offset + 16384, bytesRead)));
|
|
129
|
+
if (failure !== void 0) break read;
|
|
130
|
+
if (performance.now() - slept > 8) {
|
|
131
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
132
|
+
slept = performance.now();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
} finally {
|
|
137
|
+
unpack.end();
|
|
138
|
+
await tarFile.close();
|
|
139
|
+
}
|
|
140
|
+
if (failure !== void 0) throw failure;
|
|
116
141
|
if (invalid) throw new Error("Unsafe or unsupported update archive entry");
|
|
117
142
|
if (links.length) {
|
|
118
143
|
const bin = join(payloadRoot, archiveRoot, "bin"), cef = join(bin, "cef");
|
|
@@ -131,11 +156,6 @@ async function extractVerifiedUpdate(options) {
|
|
|
131
156
|
}
|
|
132
157
|
}
|
|
133
158
|
await rm(decompressed);
|
|
134
|
-
const after = await file.stat();
|
|
135
|
-
if (after.dev !== before.dev || after.ino !== before.ino || after.size !== before.size || after.mtimeMs !== before.mtimeMs || !await verifyReleaseStream(file.createReadStream({
|
|
136
|
-
autoClose: false,
|
|
137
|
-
start: 0
|
|
138
|
-
}), descriptor)) throw new Error("Update archive changed during extraction");
|
|
139
159
|
assertPayloadLayout({
|
|
140
160
|
platform,
|
|
141
161
|
renderer,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assertPortableAppName } from "../../installer/installer-layout.js";
|
|
2
2
|
import { isVerifiedReleaseForTrust } from "../feed/signed-release.js";
|
|
3
|
-
import { versionLessThan } from "../feed/release-version.js";
|
|
3
|
+
import { isReleaseVersion, versionLessThan } from "../feed/release-version.js";
|
|
4
4
|
import { isCanonicalPath } from "../../native/canonical-path.js";
|
|
5
5
|
import { basename } from "node:path";
|
|
6
6
|
// src/updates/install/update-handoff-plan.ts
|
|
@@ -14,7 +14,7 @@ function planUpdateHandoff(options) {
|
|
|
14
14
|
"linux-x64": ["linux", "x64"],
|
|
15
15
|
"linux-arm64": ["linux", "arm64"]
|
|
16
16
|
};
|
|
17
|
-
if (!expected[platform] || !["native", "cef"].includes(renderer) || !isVerifiedReleaseForTrust(descriptor, trust) || descriptor.platform !== expected[platform][0] || descriptor.arch !== expected[platform][1] || approved !== true || approvedVersion !== descriptor.version ||
|
|
17
|
+
if (!expected[platform] || !["native", "cef"].includes(renderer) || !isVerifiedReleaseForTrust(descriptor, trust) || descriptor.platform !== expected[platform][0] || descriptor.arch !== expected[platform][1] || approved !== true || approvedVersion !== descriptor.version || !isReleaseVersion(currentVersion) || !versionLessThan(currentVersion, descriptor.version)) throw new Error("Invalid approved update");
|
|
18
18
|
const name = platform === "macos-arm64" ? `${appName}.app` : "app";
|
|
19
19
|
if (!isCanonicalPath(target) || basename(target) !== name) throw new Error("Invalid update target");
|
|
20
20
|
return Object.freeze({
|
|
@@ -23,8 +23,7 @@ function planUpdateHandoff(options) {
|
|
|
23
23
|
platform,
|
|
24
24
|
renderer,
|
|
25
25
|
currentVersion,
|
|
26
|
-
version: descriptor.version
|
|
27
|
-
archiveSha256: descriptor.asset.sha256
|
|
26
|
+
version: descriptor.version
|
|
28
27
|
});
|
|
29
28
|
}
|
|
30
29
|
export { planUpdateHandoff };
|
|
@@ -69,7 +69,7 @@ async function stageUpdateSwap(options) {
|
|
|
69
69
|
signedRelease: exportVerifiedRelease(options.descriptor, options.trust)
|
|
70
70
|
}));
|
|
71
71
|
if (!await readUpdateStageState(preparing)) throw new Error("Update staging state was not written");
|
|
72
|
-
|
|
72
|
+
return await withUpdateLock(plan.target, async () => {
|
|
73
73
|
await assertNoUpdateRetentionPruneArtifactsWhileLocked(plan.target);
|
|
74
74
|
await assertInstalledVersion({
|
|
75
75
|
target: plan.target,
|
|
@@ -117,11 +117,6 @@ async function stageUpdateSwap(options) {
|
|
|
117
117
|
}
|
|
118
118
|
throw new Error("Another update is already staged or in progress");
|
|
119
119
|
});
|
|
120
|
-
if (!published) await rm(preparing, {
|
|
121
|
-
recursive: true,
|
|
122
|
-
force: true
|
|
123
|
-
});
|
|
124
|
-
return result;
|
|
125
120
|
} finally {
|
|
126
121
|
if (!published) await rm(preparing, {
|
|
127
122
|
recursive: true,
|
|
@@ -19,6 +19,8 @@ export declare function updateTreeIdentityFromStat(info: UpdateTreeStatIdentity)
|
|
|
19
19
|
/** Read a directory's device/inode identity without Number precision loss. */
|
|
20
20
|
export declare function readUpdateTreeIdentity(tree: string): Promise<UpdateTreeIdentity | undefined>;
|
|
21
21
|
export declare function sameUpdateTreeIdentity(left: UpdateTreeIdentity | undefined, right: UpdateTreeIdentity | undefined): boolean;
|
|
22
|
+
/** Run at most `limit` tasks at once, handing each freed slot to the oldest waiter. */
|
|
23
|
+
export declare function createTaskLimiter(limit: number): <T>(task: () => Promise<T>) => Promise<T>;
|
|
22
24
|
/**
|
|
23
25
|
* Compute a deterministic integrity digest for a complete extracted app tree.
|
|
24
26
|
* The manifest binds relative names, entry types, permission/special mode bits,
|
|
@@ -30,6 +32,9 @@ export declare function sameUpdateTreeIdentity(left: UpdateTreeIdentity | undefi
|
|
|
30
32
|
* host provides it, and compare lstat/fstat metadata before and after reads.
|
|
31
33
|
* This detects ordinary concurrent changes by cooperating updater processes;
|
|
32
34
|
* it is not an atomic filesystem snapshot against a hostile same-user writer.
|
|
35
|
+
* The walk lists the whole tree first, then reads entries with bounded
|
|
36
|
+
* concurrency while the hash consumes them strictly in manifest order. Each
|
|
37
|
+
* directory is re-checked after every entry has been read.
|
|
33
38
|
*
|
|
34
39
|
* Candidate proofs refuse regular files with more than one hard link, because
|
|
35
40
|
* an alias outside the private staging tree could change bytes after the proof.
|
|
@@ -47,8 +52,6 @@ export declare function sameUpdateTreeDigest(left: UpdateTreeDigest | undefined,
|
|
|
47
52
|
export declare function syncUpdateTree(tree: string): Promise<void>;
|
|
48
53
|
/** Sync parent directory entries after the atomic exchange has completed. */
|
|
49
54
|
export declare function syncUpdateTreeParent(target: string): Promise<void>;
|
|
50
|
-
/** Whether a path exists, without following a final symbolic link. */
|
|
51
|
-
export declare function exists(path: string): Promise<boolean>;
|
|
52
55
|
/**
|
|
53
56
|
* Exchange the staged `candidate` and the install location atomically. The
|
|
54
57
|
* previous install remains at `staging/candidate` for journaled cleanup.
|