@adea-ai/app-framework 0.27.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +177 -15
- package/dist/app/create-application.d.ts +2 -0
- package/dist/app/create-application.js +6 -0
- package/dist/app/service-registry.js +4 -0
- package/dist/appearance/custom-theme-import.js +43 -7
- package/dist/appearance/custom-theme-library.d.ts +2 -0
- package/dist/appearance/custom-theme-library.js +5 -1
- package/dist/appearance/theme-record-adapter.js +4 -2
- package/dist/appearance/theme-registry.js +7 -1
- package/dist/cli/create-application-cli.js +4 -2
- package/dist/cli/update-helper-cli.js +28 -6
- package/dist/desktop/client-asset-manifest.d.ts +47 -0
- package/dist/desktop/client-asset-manifest.js +114 -0
- package/dist/desktop/client-asset-stream.d.ts +10 -0
- package/dist/desktop/client-asset-stream.js +138 -33
- package/dist/desktop/client-assets.d.ts +20 -0
- package/dist/desktop/client-assets.js +132 -22
- package/dist/desktop/client-response-lifecycle.d.ts +22 -0
- package/dist/desktop/client-response-lifecycle.js +233 -0
- package/dist/desktop/desktop-host.d.ts +40 -2
- package/dist/desktop/desktop-host.js +159 -9
- package/dist/framework-source.json +1 -1
- package/dist/installer/command-artifact.d.ts +4 -2
- package/dist/installer/command-artifact.js +119 -19
- package/dist/installer/linux-process-group.d.ts +13 -0
- package/dist/installer/linux-process-group.js +58 -0
- package/dist/native/darwin-sync.d.ts +7 -0
- package/dist/native/darwin-sync.js +43 -0
- package/dist/native/desktop-build-hook.js +7 -0
- package/dist/native/directory-exchange.d.ts +10 -0
- package/dist/native/directory-exchange.js +90 -0
- package/dist/native/electrobun-source-patch.d.ts +5 -0
- package/dist/native/electrobun-source-patch.js +19 -1
- package/dist/native/posix-launcher-build.d.ts +24 -0
- package/dist/native/posix-launcher-build.js +232 -0
- package/dist/native/posix-tree-removal.d.ts +36 -0
- package/dist/native/posix-tree-removal.js +425 -0
- package/dist/update-helper.bundle.js +1483 -105
- package/dist/updates/channel-update-manager.d.ts +5 -0
- package/dist/updates/channel-update-manager.js +13 -1
- package/dist/updates/desktop-updater.d.ts +78 -2
- package/dist/updates/desktop-updater.js +320 -37
- package/dist/updates/launch-environment.d.ts +2 -0
- package/dist/updates/launch-environment.js +4 -0
- package/dist/updates/native-file-lock.d.ts +15 -0
- package/dist/updates/native-file-lock.js +189 -0
- package/dist/updates/packaged-launch-admission.d.ts +13 -0
- package/dist/updates/packaged-launch-admission.js +45 -0
- package/dist/updates/packaged-release-config.d.ts +18 -0
- package/dist/updates/packaged-release-config.js +60 -0
- package/dist/updates/packaged-update-startup.d.ts +44 -0
- package/dist/updates/packaged-update-startup.js +81 -0
- package/dist/updates/update-arm.d.ts +9 -8
- package/dist/updates/update-arm.js +227 -62
- package/dist/updates/update-cleanup-error.d.ts +23 -0
- package/dist/updates/update-cleanup-error.js +65 -0
- package/dist/updates/update-download-cleanup.d.ts +11 -0
- package/dist/updates/update-download-cleanup.js +112 -2
- package/dist/updates/update-download-lock.d.ts +20 -0
- package/dist/updates/update-download-lock.js +73 -0
- package/dist/updates/update-download.d.ts +2 -0
- package/dist/updates/update-download.js +7 -3
- package/dist/updates/update-generation-lease.d.ts +6 -0
- package/dist/updates/update-generation-lease.js +14 -0
- package/dist/updates/update-helper.d.ts +11 -2
- package/dist/updates/update-helper.js +322 -13
- package/dist/updates/update-inherited-launch-lease.d.ts +22 -0
- package/dist/updates/update-inherited-launch-lease.js +58 -0
- package/dist/updates/update-instance-lease.d.ts +15 -0
- package/dist/updates/update-instance-lease.js +25 -0
- package/dist/updates/update-launch-gate.d.ts +137 -0
- package/dist/updates/update-launch-gate.js +617 -0
- package/dist/updates/update-launch.js +3 -1
- package/dist/updates/update-lock.d.ts +12 -0
- package/dist/updates/update-lock.js +18 -0
- package/dist/updates/update-manager.d.ts +2 -0
- package/dist/updates/update-manager.js +9 -2
- package/dist/updates/update-marker.d.ts +7 -0
- package/dist/updates/update-marker.js +62 -0
- package/dist/updates/update-preflight-error.d.ts +7 -0
- package/dist/updates/update-preflight-error.js +11 -0
- package/dist/updates/update-process-fence.d.ts +4 -0
- package/dist/updates/update-process-fence.js +85 -73
- package/dist/updates/update-process-liveness.d.ts +2 -0
- package/dist/updates/update-process-liveness.js +11 -0
- package/dist/updates/update-resume.d.ts +37 -3
- package/dist/updates/update-resume.js +839 -23
- package/dist/updates/update-retention-marker.d.ts +67 -0
- package/dist/updates/update-retention-marker.js +165 -0
- package/dist/updates/update-retention-plan.d.ts +25 -0
- package/dist/updates/update-retention-plan.js +54 -0
- package/dist/updates/update-retention-sync.d.ts +34 -0
- package/dist/updates/update-retention-sync.js +83 -0
- package/dist/updates/update-retirement.d.ts +205 -0
- package/dist/updates/update-retirement.js +1485 -0
- package/dist/updates/update-shutdown.d.ts +16 -4
- package/dist/updates/update-shutdown.js +133 -8
- package/dist/updates/update-state-store.d.ts +58 -0
- package/dist/updates/update-state-store.js +139 -0
- package/dist/updates/update-swap-stage.d.ts +1 -1
- package/dist/updates/update-swap-stage.js +85 -14
- package/dist/updates/update-swap.d.ts +45 -2
- package/dist/updates/update-swap.js +207 -17
- package/package.json +31 -1
- package/src/appearance/custom-theme-import.ts +96 -14
- package/src/appearance/custom-theme-library.ts +5 -0
- package/src/appearance/theme-record-adapter.ts +15 -6
- package/src/appearance/theme-registry.ts +8 -1
- package/src/desktop/client-asset-manifest.ts +207 -0
- package/src/desktop/client-asset-stream.ts +193 -32
- package/src/desktop/client-assets.ts +210 -19
- package/src/desktop/client-response-lifecycle.ts +305 -0
- package/src/native/electrobun-posix-launch-lease.patch +398 -0
- package/templates/application/README.md +50 -0
- package/templates/application/electrobun.config.ts +5 -1
- package/templates/application/scripts/build-desktop.ts +4 -0
- package/templates/application/src/bun/index.ts +173 -16
- package/templates/application/vite.config.ts +112 -6
|
@@ -0,0 +1,617 @@
|
|
|
1
|
+
import { tryAcquireNativeFileLock } from "./native-file-lock.js";
|
|
2
|
+
import { tryAcquireUpdateLock } from "./update-lock.js";
|
|
3
|
+
import { acquireUpdateLock } from "./update-state-store.js";
|
|
4
|
+
import { publishExclusiveUpdateMarker, readUpdateMarker } from "./update-marker.js";
|
|
5
|
+
import { tryAcquireUpdateInstanceLease } from "./update-instance-lease.js";
|
|
6
|
+
import { lstat, open, rename, unlink } from "node:fs/promises";
|
|
7
|
+
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
8
|
+
import { constants as constants$1 } from "node:fs";
|
|
9
|
+
import { randomUUID } from "node:crypto";
|
|
10
|
+
// src/updates/update-launch-gate.ts
|
|
11
|
+
/**
|
|
12
|
+
* Publish the schema-3 helper's cancellation request under the same
|
|
13
|
+
* coordinator used for the final writer grant. This defines the cutoff:
|
|
14
|
+
* whichever operation acquires the coordinator first wins.
|
|
15
|
+
*/
|
|
16
|
+
async function publishUpdateLaunchGateCancellationRequest(target, staging, generation, helperOwner) {
|
|
17
|
+
validateTarget(target);
|
|
18
|
+
if (staging !== join(dirname(target), `.${basename(target)}.framework-update`) || !UUID.test(generation) || !UUID.test(helperOwner)) throw new Error("Invalid update launch gate cancellation owner");
|
|
19
|
+
const coordinator = await acquireUpdateLock(target);
|
|
20
|
+
try {
|
|
21
|
+
try {
|
|
22
|
+
await publishExclusiveUpdateMarker(staging, "cancel.json", {
|
|
23
|
+
schema: 1,
|
|
24
|
+
generation,
|
|
25
|
+
helperOwner
|
|
26
|
+
});
|
|
27
|
+
return true;
|
|
28
|
+
} catch (error) {
|
|
29
|
+
if (error.code !== "EEXIST") throw error;
|
|
30
|
+
const existing = await readUpdateMarker(staging, "cancel.json").catch(() => void 0);
|
|
31
|
+
return existing?.schema === 1 && existing.generation === generation && existing.helperOwner === helperOwner;
|
|
32
|
+
}
|
|
33
|
+
} finally {
|
|
34
|
+
await coordinator.release();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Returned when a failed bootstrap handoff could not confirm child termination.
|
|
39
|
+
* Keep the bootstrap lease until `releaseAfterSupervisorReaped` waits for the
|
|
40
|
+
* startup callback to settle and the reap callback confirms cleanup.
|
|
41
|
+
*/
|
|
42
|
+
var UpdateLaunchHandoffCleanupError = class extends Error {
|
|
43
|
+
lease;
|
|
44
|
+
callbackSettled;
|
|
45
|
+
terminateAndReap;
|
|
46
|
+
priorCleanupSettled;
|
|
47
|
+
released = false;
|
|
48
|
+
releaseInFlight;
|
|
49
|
+
constructor(cause, lease, callbackSettled, terminateAndReap, priorCleanupSettled = Promise.resolve()) {
|
|
50
|
+
super("Unacknowledged update supervisor could not be confirmed stopped", { cause });
|
|
51
|
+
this.lease = lease;
|
|
52
|
+
this.callbackSettled = callbackSettled;
|
|
53
|
+
this.terminateAndReap = terminateAndReap;
|
|
54
|
+
this.priorCleanupSettled = priorCleanupSettled;
|
|
55
|
+
this.name = "UpdateLaunchHandoffCleanupError";
|
|
56
|
+
}
|
|
57
|
+
releaseAfterSupervisorReaped() {
|
|
58
|
+
if (this.released) return Promise.resolve();
|
|
59
|
+
if (this.releaseInFlight) return this.releaseInFlight;
|
|
60
|
+
const operation = this.confirmReapedAndRelease();
|
|
61
|
+
this.releaseInFlight = operation;
|
|
62
|
+
operation.finally(() => {
|
|
63
|
+
if (this.releaseInFlight === operation) this.releaseInFlight = void 0;
|
|
64
|
+
}).catch(() => {});
|
|
65
|
+
return operation;
|
|
66
|
+
}
|
|
67
|
+
async confirmReapedAndRelease() {
|
|
68
|
+
await this.callbackSettled;
|
|
69
|
+
await this.priorCleanupSettled;
|
|
70
|
+
await this.terminateAndReap();
|
|
71
|
+
await this.lease.release();
|
|
72
|
+
retainedBootstrapLeases.delete(this.lease);
|
|
73
|
+
this.released = true;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
77
|
+
var VERSION = /^\d+\.\d+\.\d+(?:-dev\.\d+)?$/;
|
|
78
|
+
var MAX_GATE_BYTES = 1024;
|
|
79
|
+
function validateTarget(target) {
|
|
80
|
+
if (typeof target !== "string" || !isAbsolute(target) || resolve(target) !== target || target.includes("\0")) throw new Error("Invalid update launch gate target");
|
|
81
|
+
}
|
|
82
|
+
async function syncDirectory(directoryPath) {
|
|
83
|
+
const directory = await open(directoryPath, constants$1.O_RDONLY);
|
|
84
|
+
try {
|
|
85
|
+
await directory.sync();
|
|
86
|
+
} finally {
|
|
87
|
+
await directory.close();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/** Stable gate metadata path, adjacent to the install and distinct from both lock files. */
|
|
91
|
+
function updateLaunchGatePath(target) {
|
|
92
|
+
validateTarget(target);
|
|
93
|
+
return join(dirname(target), `.${basename(target)}.framework-update-launch-gate.json`);
|
|
94
|
+
}
|
|
95
|
+
/** Stable, per-install helper-process liveness lock, separate from both install locks. */
|
|
96
|
+
function updateHelperLivenessPath(target) {
|
|
97
|
+
validateTarget(target);
|
|
98
|
+
return join(dirname(target), `.${basename(target)}.framework-update-helper-liveness.lock`);
|
|
99
|
+
}
|
|
100
|
+
var helperLeaseStates = /* @__PURE__ */ new WeakMap();
|
|
101
|
+
/**
|
|
102
|
+
* Acquire the one stable per-install helper liveness EX lock. Helpers must do
|
|
103
|
+
* this before publication; the helper publishes the gate with this branded
|
|
104
|
+
* claim, then acknowledges the bootstrap. A held lease proves a live process,
|
|
105
|
+
* while a dead process releases the OS lock automatically.
|
|
106
|
+
*/
|
|
107
|
+
async function tryAcquireUpdateHelperLiveness(target) {
|
|
108
|
+
validateTarget(target);
|
|
109
|
+
const lock = await tryAcquireNativeFileLock(updateHelperLivenessPath(target), "exclusive");
|
|
110
|
+
if (!lock) return void 0;
|
|
111
|
+
const owner = randomUUID();
|
|
112
|
+
const state = {
|
|
113
|
+
target,
|
|
114
|
+
owner,
|
|
115
|
+
lock,
|
|
116
|
+
state: "available",
|
|
117
|
+
writerGranted: false
|
|
118
|
+
};
|
|
119
|
+
const lease = Object.freeze({
|
|
120
|
+
owner,
|
|
121
|
+
async release() {
|
|
122
|
+
if (state.state === "released") return;
|
|
123
|
+
if (state.state !== "available" && state.state !== "cancelled") throw new Error("Update helper liveness is owned by an active gate wait or writer");
|
|
124
|
+
state.state = "released";
|
|
125
|
+
helperLeaseStates.delete(lease);
|
|
126
|
+
await lock.release();
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
helperLeaseStates.set(lease, state);
|
|
130
|
+
return lease;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Cancel a published gate before the helper receives an exclusive writer
|
|
134
|
+
* lease. The helper's branded liveness claim proves this is the live owner;
|
|
135
|
+
* changing its local state first stops and drains any pending wait, so that
|
|
136
|
+
* wait cannot hand out a writer while cancellation is being checked. The
|
|
137
|
+
* caller must validate the exact journal generation/version/owner and the
|
|
138
|
+
* unchanged install/candidate tree under the transition lock. False, errors,
|
|
139
|
+
* malformed state, or a changed gate preserve the gate. This is suitable for
|
|
140
|
+
* cancellation while application processes still hold shared instance leases;
|
|
141
|
+
* it deliberately cannot cancel once a writer handle has been returned.
|
|
142
|
+
*/
|
|
143
|
+
async function cancelUpdateLaunchGateBeforeTransition(target, helperLiveness, expected, validateJournalAndTree) {
|
|
144
|
+
validateTarget(target);
|
|
145
|
+
const gate = validateGateInput(expected);
|
|
146
|
+
if (typeof validateJournalAndTree !== "function") throw new Error("Update launch gate cancellation requires journal and tree validation");
|
|
147
|
+
const state = helperLeaseState(helperLiveness, target, gate.owner);
|
|
148
|
+
if (state.writerGranted || state.state === "writer") return "writer-active";
|
|
149
|
+
if (state.state !== "available" && state.state !== "waiting") throw new Error("Update helper liveness claim is already in use");
|
|
150
|
+
const cancelWait = state.cancelWait;
|
|
151
|
+
const waitSettled = state.waitSettled;
|
|
152
|
+
state.state = "cancelling";
|
|
153
|
+
cancelWait?.();
|
|
154
|
+
try {
|
|
155
|
+
await waitSettled;
|
|
156
|
+
const transition = await acquireUpdateLock(target);
|
|
157
|
+
try {
|
|
158
|
+
const current = await readUpdateLaunchGate(target);
|
|
159
|
+
if (!current) return "absent";
|
|
160
|
+
if (!sameGate(current, gate)) return "owner-mismatch";
|
|
161
|
+
if (await validateJournalAndTree(gate) !== true) return "unproven";
|
|
162
|
+
const validated = await readUpdateLaunchGate(target);
|
|
163
|
+
if (!validated) return "absent";
|
|
164
|
+
if (!sameGate(validated, gate)) return "owner-mismatch";
|
|
165
|
+
await unlink(updateLaunchGatePath(target));
|
|
166
|
+
await syncDirectory(dirname(updateLaunchGatePath(target)));
|
|
167
|
+
return "cleared";
|
|
168
|
+
} finally {
|
|
169
|
+
await transition.release();
|
|
170
|
+
}
|
|
171
|
+
} finally {
|
|
172
|
+
if (state.state === "cancelling") state.state = "cancelled";
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function helperLeaseState(lease, target, owner) {
|
|
176
|
+
const state = helperLeaseStates.get(lease);
|
|
177
|
+
if (!state || state.target !== target || state.owner !== owner || state.state === "released") throw new Error("Update helper liveness claim does not match the launch gate");
|
|
178
|
+
return state;
|
|
179
|
+
}
|
|
180
|
+
function validateGateInput(gate) {
|
|
181
|
+
if (typeof gate !== "object" || gate === null || Object.keys(gate).length !== 4 || gate.schema !== 1 || typeof gate.generation !== "string" || !UUID.test(gate.generation) || typeof gate.version !== "string" || !VERSION.test(gate.version) || typeof gate.owner !== "string" || !UUID.test(gate.owner)) throw new Error("Invalid update launch gate");
|
|
182
|
+
return Object.freeze({
|
|
183
|
+
schema: 1,
|
|
184
|
+
generation: gate.generation,
|
|
185
|
+
version: gate.version,
|
|
186
|
+
owner: gate.owner
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function parseGate(value) {
|
|
190
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error("Invalid update launch gate");
|
|
191
|
+
const record = value;
|
|
192
|
+
if (Object.keys(record).length !== 4 || Object.keys(record).some((key) => ![
|
|
193
|
+
"schema",
|
|
194
|
+
"generation",
|
|
195
|
+
"version",
|
|
196
|
+
"owner"
|
|
197
|
+
].includes(key))) throw new Error("Invalid update launch gate");
|
|
198
|
+
return validateGateInput(record);
|
|
199
|
+
}
|
|
200
|
+
/** Read the atomic gate record. Missing means open; malformed or non-file state fails closed. */
|
|
201
|
+
async function readUpdateLaunchGate(target) {
|
|
202
|
+
const path = updateLaunchGatePath(target);
|
|
203
|
+
let info;
|
|
204
|
+
try {
|
|
205
|
+
info = await lstat(path);
|
|
206
|
+
} catch (error) {
|
|
207
|
+
if (error.code === "ENOENT") return void 0;
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
210
|
+
if (!info.isFile() || info.isSymbolicLink() || info.size < 1 || info.size > MAX_GATE_BYTES) throw new Error("Invalid update launch gate");
|
|
211
|
+
const file = await open(path, constants$1.O_RDONLY | (constants$1.O_NOFOLLOW ?? 0));
|
|
212
|
+
try {
|
|
213
|
+
const opened = await file.stat();
|
|
214
|
+
if (!opened.isFile() || opened.size < 1 || opened.size > MAX_GATE_BYTES) throw new Error("Invalid update launch gate");
|
|
215
|
+
return parseGate(JSON.parse(await file.readFile("utf8")));
|
|
216
|
+
} finally {
|
|
217
|
+
await file.close();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function sameGate(left, right) {
|
|
221
|
+
return left?.schema === right.schema && left.generation === right.generation && left.version === right.version && left.owner === right.owner;
|
|
222
|
+
}
|
|
223
|
+
function createAsyncMutex() {
|
|
224
|
+
let tail = Promise.resolve();
|
|
225
|
+
return function serialize(operation) {
|
|
226
|
+
const result = tail.then(operation);
|
|
227
|
+
tail = result.then(() => void 0, () => void 0);
|
|
228
|
+
return result;
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Atomically publish a generation-bound launch gate under the short transition lock.
|
|
233
|
+
* This must run in the helper process that acquired the branded liveness lease;
|
|
234
|
+
* the owner is derived from that lease, so a string/PID cannot impersonate it.
|
|
235
|
+
*/
|
|
236
|
+
async function publishUpdateLaunchGate(target, helperLiveness, input, persistOwner) {
|
|
237
|
+
validateTarget(target);
|
|
238
|
+
const helperState = helperLeaseState(helperLiveness, target, helperLiveness?.owner);
|
|
239
|
+
if (helperState.state !== "available") throw new Error("Update helper liveness claim is already in use");
|
|
240
|
+
const gate = validateGateInput({
|
|
241
|
+
schema: 1,
|
|
242
|
+
...input,
|
|
243
|
+
owner: helperState.owner
|
|
244
|
+
});
|
|
245
|
+
helperState.state = "publishing";
|
|
246
|
+
let pin;
|
|
247
|
+
let lock;
|
|
248
|
+
try {
|
|
249
|
+
pin = await tryAcquireUpdateInstanceLease(target, "shared");
|
|
250
|
+
if (!pin) throw new Error("Cannot publish an update launch gate during an install transition");
|
|
251
|
+
lock = await acquireUpdateLock(target);
|
|
252
|
+
if (await readUpdateLaunchGate(target)) throw new Error("Another update helper owns the launch gate");
|
|
253
|
+
const path = updateLaunchGatePath(target);
|
|
254
|
+
const temporary = join(dirname(path), `.${basename(path)}.${gate.generation}.${randomUUID()}.tmp`);
|
|
255
|
+
let renamed = false;
|
|
256
|
+
try {
|
|
257
|
+
const file = await open(temporary, constants$1.O_WRONLY | constants$1.O_CREAT | constants$1.O_EXCL, 384);
|
|
258
|
+
try {
|
|
259
|
+
await file.writeFile(JSON.stringify(gate) + "\n");
|
|
260
|
+
await file.sync();
|
|
261
|
+
} finally {
|
|
262
|
+
await file.close();
|
|
263
|
+
}
|
|
264
|
+
await rename(temporary, path);
|
|
265
|
+
renamed = true;
|
|
266
|
+
await syncDirectory(dirname(path));
|
|
267
|
+
} catch (error) {
|
|
268
|
+
if (!renamed) await unlink(temporary).catch(() => {});
|
|
269
|
+
throw error;
|
|
270
|
+
}
|
|
271
|
+
await persistOwner?.(gate);
|
|
272
|
+
const published = await readUpdateLaunchGate(target);
|
|
273
|
+
if (!published || !sameGate(published, gate)) throw new Error("Update launch gate publication could not be verified");
|
|
274
|
+
return published;
|
|
275
|
+
} finally {
|
|
276
|
+
try {
|
|
277
|
+
await lock?.release();
|
|
278
|
+
} finally {
|
|
279
|
+
try {
|
|
280
|
+
await pin?.release();
|
|
281
|
+
} finally {
|
|
282
|
+
if (helperState.state === "publishing") helperState.state = "available";
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Reclaim a crashed helper's exact gate only after the caller reconciles its
|
|
289
|
+
* durable journal and install tree. Lock order is lifetime EX -> coordinator
|
|
290
|
+
* EX -> nonblocking helper-liveness EX; a live helper causes a fast fail-closed
|
|
291
|
+
* return. No PID or process-table inference participates in this decision.
|
|
292
|
+
* The callback must verify journal generation/version and a recovery-safe phase,
|
|
293
|
+
* reconcile the actual tree for that exact gate, and return true only after the
|
|
294
|
+
* reconciliation is durable. False or a thrown error leaves the gate in place.
|
|
295
|
+
* This WIP API has no production caller; existing resume paths are not safe
|
|
296
|
+
* substitutes unless they also enforce these ownership and validation steps.
|
|
297
|
+
*/
|
|
298
|
+
async function tryRecoverUpdateLaunchGate(target, reconcileJournalAndTree) {
|
|
299
|
+
validateTarget(target);
|
|
300
|
+
if (typeof reconcileJournalAndTree !== "function") throw new Error("Update launch gate recovery requires journal and tree reconciliation");
|
|
301
|
+
const instance = await tryAcquireUpdateInstanceLease(target, "exclusive");
|
|
302
|
+
if (!instance) return "busy";
|
|
303
|
+
let coordinator;
|
|
304
|
+
let helper;
|
|
305
|
+
try {
|
|
306
|
+
coordinator = await tryAcquireUpdateLock(target);
|
|
307
|
+
if (!coordinator) return "busy";
|
|
308
|
+
const gate = await readUpdateLaunchGate(target);
|
|
309
|
+
if (!gate) return "absent";
|
|
310
|
+
helper = await tryAcquireNativeFileLock(updateHelperLivenessPath(target), "exclusive");
|
|
311
|
+
if (!helper) return "helper-live";
|
|
312
|
+
if (!sameGate(await readUpdateLaunchGate(target), gate)) throw new Error("Update launch gate changed during recovery");
|
|
313
|
+
if (!await reconcileJournalAndTree(gate)) return "unreconciled";
|
|
314
|
+
if (!sameGate(await readUpdateLaunchGate(target), gate)) throw new Error("Update launch gate changed after journal and tree reconciliation");
|
|
315
|
+
await unlink(updateLaunchGatePath(target));
|
|
316
|
+
await syncDirectory(dirname(updateLaunchGatePath(target)));
|
|
317
|
+
return "recovered";
|
|
318
|
+
} finally {
|
|
319
|
+
try {
|
|
320
|
+
await helper?.release();
|
|
321
|
+
} finally {
|
|
322
|
+
try {
|
|
323
|
+
await coordinator?.release();
|
|
324
|
+
} finally {
|
|
325
|
+
await instance.release();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Clear only while the current writer still owns its exclusive instance lease
|
|
332
|
+
* and the exact gate record matches. The owner UUID alone is not authority to clear.
|
|
333
|
+
*/
|
|
334
|
+
async function clearOwnedUpdateLaunchGate(target, expected, transitionCompleted, verifyPersistedTransition) {
|
|
335
|
+
validateTarget(target);
|
|
336
|
+
const gate = validateGateInput(expected);
|
|
337
|
+
const lock = await acquireUpdateLock(target);
|
|
338
|
+
try {
|
|
339
|
+
if (!transitionCompleted()) throw new Error("Update launch gate cannot clear before a successful transition");
|
|
340
|
+
const current = await readUpdateLaunchGate(target);
|
|
341
|
+
if (!current) return "absent";
|
|
342
|
+
if (!sameGate(current, gate)) return "ownership-mismatch";
|
|
343
|
+
if (await verifyPersistedTransition(gate) !== true) return "unproven";
|
|
344
|
+
const verified = await readUpdateLaunchGate(target);
|
|
345
|
+
if (!verified) return "absent";
|
|
346
|
+
if (!sameGate(verified, gate)) return "ownership-mismatch";
|
|
347
|
+
await unlink(updateLaunchGatePath(target));
|
|
348
|
+
await syncDirectory(dirname(updateLaunchGatePath(target)));
|
|
349
|
+
return "cleared";
|
|
350
|
+
} finally {
|
|
351
|
+
await lock.release();
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Bootstrap and the long-lived supervisor use this same short transaction:
|
|
356
|
+
* coordinator EX -> inspect gate -> nonblocking instance SH -> coordinator release.
|
|
357
|
+
* Busy and gated states are reported without waiting while holding the coordinator.
|
|
358
|
+
*/
|
|
359
|
+
async function tryAcquireUpdateLaunchLease(target) {
|
|
360
|
+
validateTarget(target);
|
|
361
|
+
const coordinator = await tryAcquireUpdateLock(target);
|
|
362
|
+
if (!coordinator) return { status: "busy" };
|
|
363
|
+
let gate;
|
|
364
|
+
let lease;
|
|
365
|
+
let operationFailed = false;
|
|
366
|
+
let operationError;
|
|
367
|
+
try {
|
|
368
|
+
gate = await readUpdateLaunchGate(target);
|
|
369
|
+
if (!gate) lease = await tryAcquireUpdateInstanceLease(target, "shared");
|
|
370
|
+
} catch (error) {
|
|
371
|
+
operationFailed = true;
|
|
372
|
+
operationError = error;
|
|
373
|
+
}
|
|
374
|
+
let releaseFailed = false;
|
|
375
|
+
let releaseError;
|
|
376
|
+
try {
|
|
377
|
+
await coordinator.release();
|
|
378
|
+
} catch (error) {
|
|
379
|
+
releaseFailed = true;
|
|
380
|
+
releaseError = error;
|
|
381
|
+
}
|
|
382
|
+
if (operationFailed || releaseFailed) {
|
|
383
|
+
await lease?.release().catch(() => {});
|
|
384
|
+
if (operationFailed && releaseFailed) throw new AggregateError([operationError, releaseError], "Launch coordination and release failed");
|
|
385
|
+
throw operationFailed ? operationError : releaseError;
|
|
386
|
+
}
|
|
387
|
+
if (gate) return { status: "gated" };
|
|
388
|
+
return lease ? {
|
|
389
|
+
status: "acquired",
|
|
390
|
+
lease
|
|
391
|
+
} : { status: "busy" };
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Keep a bootstrap's shared lease until the started child acknowledges the
|
|
395
|
+
* independent ownership required by its role. An update helper must acquire
|
|
396
|
+
* liveness, publish its gate with that claim, and acknowledge publication
|
|
397
|
+
* before this callback resolves. On abort, stop future spawns and settle only
|
|
398
|
+
* after cancellation or child reaping is guaranteed.
|
|
399
|
+
*/
|
|
400
|
+
async function withUpdateLaunchLeaseHandoff(options) {
|
|
401
|
+
const acknowledgementTimeoutMs = options.acknowledgementTimeoutMs ?? 15e3;
|
|
402
|
+
const cleanupTimeoutMs = options.cleanupTimeoutMs ?? 5e3;
|
|
403
|
+
for (const [duration, name] of [[acknowledgementTimeoutMs, "acknowledgement"], [cleanupTimeoutMs, "cleanup"]]) if (!Number.isSafeInteger(duration) || duration < 1 || duration > 12e4) throw new Error("Invalid update launch handoff " + name + " timeout");
|
|
404
|
+
const attempt = await tryAcquireUpdateLaunchLease(options.target);
|
|
405
|
+
if (attempt.status !== "acquired") return attempt;
|
|
406
|
+
const retainedLeases = retainedBootstrapLeases;
|
|
407
|
+
const controller = new AbortController();
|
|
408
|
+
const operation = Promise.resolve().then(() => options.startAndWaitForSupervisorAcknowledgement(controller.signal));
|
|
409
|
+
const callbackSettled = operation.then(() => void 0, () => void 0);
|
|
410
|
+
try {
|
|
411
|
+
return {
|
|
412
|
+
status: "started",
|
|
413
|
+
value: await withTimeout(operation, acknowledgementTimeoutMs, "Update supervisor lease acknowledgement")
|
|
414
|
+
};
|
|
415
|
+
} catch (error) {
|
|
416
|
+
controller.abort(error);
|
|
417
|
+
let callbackError;
|
|
418
|
+
try {
|
|
419
|
+
await withTimeout(callbackSettled, cleanupTimeoutMs, "Supervisor handoff cancellation");
|
|
420
|
+
} catch (failedSettlement) {
|
|
421
|
+
callbackError = failedSettlement;
|
|
422
|
+
}
|
|
423
|
+
let cleanupError;
|
|
424
|
+
let cleanupFailed = false;
|
|
425
|
+
const cleanupOperation = Promise.resolve().then(() => options.terminateAndReapUnacknowledgedSupervisor());
|
|
426
|
+
const cleanupSettled = cleanupOperation.then(() => void 0, () => void 0);
|
|
427
|
+
try {
|
|
428
|
+
await withTimeout(cleanupOperation, cleanupTimeoutMs, "Unacknowledged update supervisor cleanup");
|
|
429
|
+
} catch (failedCleanup) {
|
|
430
|
+
cleanupFailed = true;
|
|
431
|
+
cleanupError = failedCleanup;
|
|
432
|
+
}
|
|
433
|
+
if (cleanupFailed || callbackError !== void 0) {
|
|
434
|
+
retainedLeases.add(attempt.lease);
|
|
435
|
+
throw new UpdateLaunchHandoffCleanupError(new AggregateError([
|
|
436
|
+
error,
|
|
437
|
+
...cleanupFailed ? [cleanupError] : [],
|
|
438
|
+
...callbackError === void 0 ? [] : [callbackError]
|
|
439
|
+
], "Supervisor handoff and cleanup failed"), attempt.lease, callbackSettled, options.terminateAndReapUnacknowledgedSupervisor, cleanupSettled);
|
|
440
|
+
}
|
|
441
|
+
throw error;
|
|
442
|
+
} finally {
|
|
443
|
+
if (!retainedLeases.has(attempt.lease)) await attempt.lease.release();
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
function throwIfAborted(signal) {
|
|
447
|
+
if (!signal?.aborted) return;
|
|
448
|
+
throw signal.reason ?? new DOMException("The operation was aborted", "AbortError");
|
|
449
|
+
}
|
|
450
|
+
var retainedBootstrapLeases = /* @__PURE__ */ new Set();
|
|
451
|
+
async function withTimeout(promise, timeoutMs, description) {
|
|
452
|
+
let timer;
|
|
453
|
+
try {
|
|
454
|
+
return await Promise.race([promise, new Promise((_resolve, reject) => {
|
|
455
|
+
timer = setTimeout(() => reject(/* @__PURE__ */ new Error(description + " timed out")), timeoutMs);
|
|
456
|
+
})]);
|
|
457
|
+
} finally {
|
|
458
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function sleep(ms, ...signals) {
|
|
462
|
+
const activeSignals = signals.filter((signal) => signal !== void 0);
|
|
463
|
+
if (activeSignals.length === 0) return Bun.sleep(ms);
|
|
464
|
+
for (const signal of activeSignals) throwIfAborted(signal);
|
|
465
|
+
return new Promise((resolveSleep, reject) => {
|
|
466
|
+
let settled = false;
|
|
467
|
+
const cleanup = () => {
|
|
468
|
+
clearTimeout(timer);
|
|
469
|
+
for (const [signal, onAbort] of listeners) signal.removeEventListener("abort", onAbort);
|
|
470
|
+
};
|
|
471
|
+
const listeners = activeSignals.map((signal) => {
|
|
472
|
+
const onAbort = () => {
|
|
473
|
+
if (settled) return;
|
|
474
|
+
settled = true;
|
|
475
|
+
cleanup();
|
|
476
|
+
reject(signal.reason ?? new DOMException("The operation was aborted", "AbortError"));
|
|
477
|
+
};
|
|
478
|
+
return [signal, onAbort];
|
|
479
|
+
});
|
|
480
|
+
const timer = setTimeout(() => {
|
|
481
|
+
if (settled) return;
|
|
482
|
+
settled = true;
|
|
483
|
+
cleanup();
|
|
484
|
+
resolveSleep();
|
|
485
|
+
}, ms);
|
|
486
|
+
for (const [signal, onAbort] of listeners) signal.addEventListener("abort", onAbort, { once: true });
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Wait cancellably for every app reader to leave. This loop never holds the
|
|
491
|
+
* transition lock while waiting; it takes the coordinator only to verify the
|
|
492
|
+
* exact committed gate on each poll and again after an exclusive-lease attempt
|
|
493
|
+
* succeeds. An abort signal leaves the gate in place. The live owner may use
|
|
494
|
+
* cancelUpdateLaunchGateBeforeTransition to stop and drain this wait and clear
|
|
495
|
+
* only after its caller validates the durable pre-transition state.
|
|
496
|
+
*/
|
|
497
|
+
async function waitForUpdateLaunchGateWriter(target, expected, options) {
|
|
498
|
+
validateTarget(target);
|
|
499
|
+
const gate = validateGateInput(expected);
|
|
500
|
+
const pollIntervalMs = options.pollIntervalMs ?? 25;
|
|
501
|
+
if (!Number.isSafeInteger(pollIntervalMs) || pollIntervalMs < 1 || pollIntervalMs > 1e3) throw new Error("Invalid update launch gate polling interval");
|
|
502
|
+
throwIfAborted(options.signal);
|
|
503
|
+
const helperState = helperLeaseState(options.helperLiveness, target, gate.owner);
|
|
504
|
+
if (helperState.state !== "available") throw new Error("Update helper liveness claim is already in use");
|
|
505
|
+
helperState.state = "waiting";
|
|
506
|
+
const waitController = new AbortController();
|
|
507
|
+
let settleWait;
|
|
508
|
+
const waitSettled = new Promise((resolveWait) => {
|
|
509
|
+
settleWait = resolveWait;
|
|
510
|
+
});
|
|
511
|
+
helperState.cancelWait = () => waitController.abort(/* @__PURE__ */ new Error("Update launch gate wait was cancelled"));
|
|
512
|
+
helperState.waitSettled = waitSettled;
|
|
513
|
+
const assertWaiting = () => {
|
|
514
|
+
throwIfAborted(options.signal);
|
|
515
|
+
throwIfAborted(waitController.signal);
|
|
516
|
+
if (helperState.state !== "waiting") throw new Error("Update launch gate wait no longer owns the helper claim");
|
|
517
|
+
};
|
|
518
|
+
try {
|
|
519
|
+
while (true) {
|
|
520
|
+
assertWaiting();
|
|
521
|
+
const preflightCoordinator = await tryAcquireUpdateLock(target);
|
|
522
|
+
if (!preflightCoordinator) {
|
|
523
|
+
assertWaiting();
|
|
524
|
+
await sleep(pollIntervalMs, options.signal, waitController.signal);
|
|
525
|
+
continue;
|
|
526
|
+
}
|
|
527
|
+
try {
|
|
528
|
+
assertWaiting();
|
|
529
|
+
if (!sameGate(await readUpdateLaunchGate(target), gate)) throw new Error("Update writer no longer owns the launch gate");
|
|
530
|
+
assertWaiting();
|
|
531
|
+
} finally {
|
|
532
|
+
await preflightCoordinator.release();
|
|
533
|
+
}
|
|
534
|
+
assertWaiting();
|
|
535
|
+
const instance = await tryAcquireUpdateInstanceLease(target, "exclusive");
|
|
536
|
+
if (!instance) {
|
|
537
|
+
assertWaiting();
|
|
538
|
+
await sleep(pollIntervalMs, options.signal, waitController.signal);
|
|
539
|
+
continue;
|
|
540
|
+
}
|
|
541
|
+
let coordinator;
|
|
542
|
+
let keepInstance = false;
|
|
543
|
+
try {
|
|
544
|
+
assertWaiting();
|
|
545
|
+
coordinator = await tryAcquireUpdateLock(target);
|
|
546
|
+
assertWaiting();
|
|
547
|
+
if (!coordinator) {
|
|
548
|
+
await instance.release();
|
|
549
|
+
await sleep(pollIntervalMs, options.signal, waitController.signal);
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
552
|
+
if (!sameGate(await readUpdateLaunchGate(target), gate)) throw new Error("Update writer no longer owns the launch gate");
|
|
553
|
+
if (await options.beforeWriterGrant?.()) throw new Error("Update cancellation request precedes the writer grant");
|
|
554
|
+
assertWaiting();
|
|
555
|
+
helperState.writerGranted = true;
|
|
556
|
+
helperState.state = "writer";
|
|
557
|
+
keepInstance = true;
|
|
558
|
+
await coordinator.release();
|
|
559
|
+
coordinator = void 0;
|
|
560
|
+
let released = false;
|
|
561
|
+
let instanceReleased = false;
|
|
562
|
+
let transitionCompleted = false;
|
|
563
|
+
const serialize = createAsyncMutex();
|
|
564
|
+
return {
|
|
565
|
+
gate,
|
|
566
|
+
withTransition(operation) {
|
|
567
|
+
return serialize(async () => {
|
|
568
|
+
if (released) throw new Error("Update writer lease has been released");
|
|
569
|
+
transitionCompleted = false;
|
|
570
|
+
const transition = await acquireUpdateLock(target);
|
|
571
|
+
let result;
|
|
572
|
+
try {
|
|
573
|
+
if (!sameGate(await readUpdateLaunchGate(target), gate)) throw new Error("Update writer no longer owns the launch gate");
|
|
574
|
+
result = await operation(gate);
|
|
575
|
+
} finally {
|
|
576
|
+
await transition.release();
|
|
577
|
+
}
|
|
578
|
+
transitionCompleted = true;
|
|
579
|
+
return result;
|
|
580
|
+
});
|
|
581
|
+
},
|
|
582
|
+
clearGate: (verifyPersistedTransition) => serialize(async () => {
|
|
583
|
+
if (released) throw new Error("Update writer lease has been released");
|
|
584
|
+
if (typeof verifyPersistedTransition !== "function") throw new Error("Update launch gate clearing requires persisted transition proof");
|
|
585
|
+
return clearOwnedUpdateLaunchGate(target, gate, () => transitionCompleted, verifyPersistedTransition).then((result) => {
|
|
586
|
+
if (result === "ownership-mismatch") throw new Error("Update writer no longer owns the launch gate");
|
|
587
|
+
return result;
|
|
588
|
+
});
|
|
589
|
+
}),
|
|
590
|
+
release: () => serialize(async () => {
|
|
591
|
+
if (released) return;
|
|
592
|
+
if (!instanceReleased) {
|
|
593
|
+
await instance.release();
|
|
594
|
+
instanceReleased = true;
|
|
595
|
+
}
|
|
596
|
+
helperState.state = "available";
|
|
597
|
+
released = true;
|
|
598
|
+
})
|
|
599
|
+
};
|
|
600
|
+
} finally {
|
|
601
|
+
try {
|
|
602
|
+
await coordinator?.release();
|
|
603
|
+
} finally {
|
|
604
|
+
if (!keepInstance) await instance.release();
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
} finally {
|
|
609
|
+
if (helperState.state === "waiting") helperState.state = "available";
|
|
610
|
+
if (helperState.waitSettled === waitSettled) {
|
|
611
|
+
helperState.waitSettled = void 0;
|
|
612
|
+
helperState.cancelWait = void 0;
|
|
613
|
+
}
|
|
614
|
+
settleWait();
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
export { UpdateLaunchHandoffCleanupError, cancelUpdateLaunchGateBeforeTransition, publishUpdateLaunchGate, publishUpdateLaunchGateCancellationRequest, readUpdateLaunchGate, tryAcquireUpdateHelperLiveness, tryAcquireUpdateLaunchLease, tryRecoverUpdateLaunchGate, updateHelperLivenessPath, updateLaunchGatePath, waitForUpdateLaunchGateWriter, withUpdateLaunchLeaseHandoff };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { INHERITED_LAUNCH_LEASE_ENV } from "./launch-environment.js";
|
|
1
2
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
2
3
|
import { spawn } from "node:child_process";
|
|
3
4
|
// src/updates/update-launch.ts
|
|
@@ -12,11 +13,12 @@ function updateLauncherPath(platform, target) {
|
|
|
12
13
|
/** Start the installed app's launcher detached from the helper. */
|
|
13
14
|
async function launchInstalledApp(platform, target, env = process.env) {
|
|
14
15
|
const executable = updateLauncherPath(platform, target);
|
|
16
|
+
const childEnv = Object.fromEntries(Object.entries(env).filter(([key]) => key.toUpperCase() !== INHERITED_LAUNCH_LEASE_ENV));
|
|
15
17
|
const child = spawn(executable, [], {
|
|
16
18
|
cwd: dirname(executable),
|
|
17
19
|
detached: true,
|
|
18
20
|
stdio: "ignore",
|
|
19
|
-
env
|
|
21
|
+
env: childEnv
|
|
20
22
|
});
|
|
21
23
|
await new Promise((done, reject) => {
|
|
22
24
|
child.once("spawn", done);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type UpdateLock = Readonly<{
|
|
2
|
+
release(): Promise<void>;
|
|
3
|
+
}>;
|
|
4
|
+
/** Stable transition lock path. The file must never be removed or replaced. */
|
|
5
|
+
export declare function updateLockPath(target: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Try to hold the per-install transition lock without waiting. A process crash
|
|
8
|
+
* releases the OS lock; the zero-byte lock file is intentionally persistent.
|
|
9
|
+
* undefined means another process currently owns the lock. Other failures
|
|
10
|
+
* reject so callers cannot mistake an unsupported or broken lock for success.
|
|
11
|
+
*/
|
|
12
|
+
export declare function tryAcquireUpdateLock(target: string): Promise<UpdateLock | undefined>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { tryAcquireNativeFileLock } from "./native-file-lock.js";
|
|
2
|
+
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
3
|
+
// src/updates/update-lock.ts
|
|
4
|
+
/** Stable transition lock path. The file must never be removed or replaced. */
|
|
5
|
+
function updateLockPath(target) {
|
|
6
|
+
if (typeof target !== "string" || !isAbsolute(target) || resolve(target) !== target || target.includes("\0")) throw new Error("Invalid update lock target");
|
|
7
|
+
return join(dirname(target), `.${basename(target)}.framework-update.lock`);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Try to hold the per-install transition lock without waiting. A process crash
|
|
11
|
+
* releases the OS lock; the zero-byte lock file is intentionally persistent.
|
|
12
|
+
* undefined means another process currently owns the lock. Other failures
|
|
13
|
+
* reject so callers cannot mistake an unsupported or broken lock for success.
|
|
14
|
+
*/
|
|
15
|
+
async function tryAcquireUpdateLock(target) {
|
|
16
|
+
return tryAcquireNativeFileLock(updateLockPath(target), "exclusive");
|
|
17
|
+
}
|
|
18
|
+
export { tryAcquireUpdateLock, updateLockPath };
|
|
@@ -25,6 +25,8 @@ export declare function createUpdateManager(options: {
|
|
|
25
25
|
path: string;
|
|
26
26
|
directory: string;
|
|
27
27
|
}) => Promise<void>;
|
|
28
|
+
/** Recover any interrupted app-owned staging before starting a new download. */
|
|
29
|
+
beforeDownload?: () => Promise<void>;
|
|
28
30
|
/**
|
|
29
31
|
* Dispose of a downloaded result rejected before stage takes ownership.
|
|
30
32
|
* Without a callback, built-in downloads are discarded automatically and
|