@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
|
@@ -2,17 +2,29 @@ import { isUuid } from "../../app/value-guards.js";
|
|
|
2
2
|
import { renameExclusive } from "../../native/native-rename.js";
|
|
3
3
|
import { readUpdateStageState, withUpdateLock, writeUpdateStageState } from "../update-state-store.js";
|
|
4
4
|
import { readUpdateTreeIdentity, readUpdateTreeVersion, sameUpdateTreeIdentity, updateStagingFor } from "../install/update-swap.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { KNOWN_STAGING_ENTRIES, removeUpdateHelperArtifacts, stateTemporaryPattern } from "../helper/update-helper.js";
|
|
6
|
+
import { readValidatedRetirementInventoryWhileLocked } from "./retirement-inventory.js";
|
|
7
|
+
import { retentionIdentityKey } from "./update-retention-plan.js";
|
|
8
|
+
import { cleanupMarkerMatches, ensureClaim, ensureCleanupMarker, healthReceiptFor, healthReceiptMatches, isMatchingHealthTemporary, matchesInstalledTree, matchesOldTree, matchesOwnedTree, ownerFor, ownerMatches, pathInfo, readCleanupMarker, readHealthReceipt, readOwner, updateRetirementPaths, validRetirementContainer } from "./retirement-records.js";
|
|
9
|
+
import { isReleaseVersion } from "../feed/release-version.js";
|
|
10
|
+
import { lstat, mkdir, readdir, rmdir, unlink, writeFile } from "node:fs/promises";
|
|
7
11
|
import { basename, dirname, join } from "node:path";
|
|
8
12
|
import { randomUUID } from "node:crypto";
|
|
9
13
|
// src/updates/retention/update-retirement.ts
|
|
10
14
|
async function acknowledgeUpdateHealthWhileLocked(target, token) {
|
|
11
|
-
if (typeof token !== "object" || token === null || !isUuid(token.generation) || typeof token.version !== "string" || !
|
|
15
|
+
if (typeof token !== "object" || token === null || !isUuid(token.generation) || typeof token.version !== "string" || !isReleaseVersion(token.version)) return false;
|
|
12
16
|
const paths = updateRetirementPaths(target, token.generation);
|
|
13
17
|
const claimInfo = await pathInfo(paths.claim);
|
|
14
18
|
const owner = await readOwner(paths.claim);
|
|
15
19
|
if (!claimInfo?.isFile() || claimInfo.isSymbolicLink() || !owner || owner.target !== target || owner.generation !== token.generation || owner.newVersion !== token.version || !await matchesInstalledTree(target, owner) || !await validRetirementContainer(owner, paths)) return false;
|
|
20
|
+
return writeHealthReceiptWhileLocked(owner, paths, async () => await matchesInstalledTree(target, owner) && await matchesOwnedTree(paths.tree, owner));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Publish a generation's health receipt (no-replace), finishing an interrupted temporary if
|
|
24
|
+
* one matches. `stillValid` re-proves the generation after publication. Call while holding
|
|
25
|
+
* the install update lock.
|
|
26
|
+
*/
|
|
27
|
+
async function writeHealthReceiptWhileLocked(owner, paths, stillValid) {
|
|
16
28
|
const expected = healthReceiptFor(owner);
|
|
17
29
|
if (await pathInfo(paths.healthReceipt)) return healthReceiptMatches(await readHealthReceipt(paths.healthReceipt), expected);
|
|
18
30
|
const entries = await readdir(paths.container);
|
|
@@ -26,7 +38,7 @@ async function acknowledgeUpdateHealthWhileLocked(target, token) {
|
|
|
26
38
|
} catch {
|
|
27
39
|
return healthReceiptMatches(await readHealthReceipt(paths.healthReceipt), expected);
|
|
28
40
|
}
|
|
29
|
-
return healthReceiptMatches(await readHealthReceipt(paths.healthReceipt), expected) && await
|
|
41
|
+
return healthReceiptMatches(await readHealthReceipt(paths.healthReceipt), expected) && await stillValid();
|
|
30
42
|
}
|
|
31
43
|
const temporary = join(paths.container, `${paths.healthTemporaryPrefix}${randomUUID()}.tmp`);
|
|
32
44
|
try {
|
|
@@ -39,7 +51,42 @@ async function acknowledgeUpdateHealthWhileLocked(target, token) {
|
|
|
39
51
|
} catch {
|
|
40
52
|
return healthReceiptMatches(await readHealthReceipt(paths.healthReceipt), expected);
|
|
41
53
|
}
|
|
42
|
-
return healthReceiptMatches(await readHealthReceipt(paths.healthReceipt), expected) &&
|
|
54
|
+
return healthReceiptMatches(await readHealthReceipt(paths.healthReceipt), expected) && stillValid();
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Record health for the generations behind an acknowledged installed generation. Each of
|
|
58
|
+
* them installed a tree that went on to run and apply the next update, so it was healthy;
|
|
59
|
+
* apps that acknowledged health only for the latest generation, or not at all before
|
|
60
|
+
* automatic acknowledgement, otherwise leave their older trees unprunable forever. Writes
|
|
61
|
+
* nothing unless the installed generation is acknowledged and its lineage validates.
|
|
62
|
+
* Returns how many receipts it wrote.
|
|
63
|
+
*/
|
|
64
|
+
async function acknowledgeRetiredUpdateLineage(options) {
|
|
65
|
+
const { target, currentVersion } = options;
|
|
66
|
+
return withUpdateLock(target, async () => {
|
|
67
|
+
const inventory = await readValidatedRetirementInventoryWhileLocked(target, currentVersion);
|
|
68
|
+
const byInstalled = /* @__PURE__ */ new Map();
|
|
69
|
+
for (const record of inventory.records) {
|
|
70
|
+
const key = retentionIdentityKey(record.owner.newTreeIdentity);
|
|
71
|
+
if (!key || byInstalled.has(key)) return 0;
|
|
72
|
+
byInstalled.set(key, record);
|
|
73
|
+
}
|
|
74
|
+
const chain = [];
|
|
75
|
+
let cursor = retentionIdentityKey(inventory.actualIdentity);
|
|
76
|
+
while (cursor && byInstalled.has(cursor) && chain.length <= inventory.records.length) {
|
|
77
|
+
const record = byInstalled.get(cursor);
|
|
78
|
+
chain.push(record);
|
|
79
|
+
cursor = retentionIdentityKey(record.owner.previousTreeIdentity);
|
|
80
|
+
}
|
|
81
|
+
if (!chain[0]?.healthy || chain.length !== inventory.records.length) return 0;
|
|
82
|
+
let written = 0;
|
|
83
|
+
for (const { owner, paths, healthy } of chain.slice(1)) {
|
|
84
|
+
if (healthy) continue;
|
|
85
|
+
if (!await validRetirementContainer(owner, paths) || !await matchesOwnedTree(paths.tree, owner) || !await writeHealthReceiptWhileLocked(owner, paths, () => matchesOwnedTree(paths.tree, owner))) break;
|
|
86
|
+
written++;
|
|
87
|
+
}
|
|
88
|
+
return written;
|
|
89
|
+
});
|
|
43
90
|
}
|
|
44
91
|
/** Explicitly acknowledge an exact installed generation after app-owned readiness checks. */
|
|
45
92
|
async function acknowledgeRetiredUpdateHealthy(options) {
|
|
@@ -73,21 +120,11 @@ async function reconcileRetirementCleanupMarkerWhileLocked(options) {
|
|
|
73
120
|
return "updated";
|
|
74
121
|
}
|
|
75
122
|
async function knownStagingEntriesOnly(staging, generation) {
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
"helper",
|
|
79
|
-
"helper-armed",
|
|
80
|
-
"helper-ready",
|
|
81
|
-
"cancel.json",
|
|
82
|
-
"cancel-ack.json",
|
|
83
|
-
"request.json",
|
|
84
|
-
"state.json"
|
|
85
|
-
]);
|
|
86
|
-
const stateTemporary = new RegExp(`^\\.state-${generation}-[0-9a-f-]{36}\\.tmp$`, "i");
|
|
87
|
-
return (await readdir(staging)).every((name) => known.has(name) || stateTemporary.test(name));
|
|
123
|
+
const stateTemporary = stateTemporaryPattern(generation);
|
|
124
|
+
return (await readdir(staging)).every((name) => KNOWN_STAGING_ENTRIES.has(name) || stateTemporary.test(name));
|
|
88
125
|
}
|
|
89
126
|
async function removeKnownStateTemporaries(staging, generation) {
|
|
90
|
-
const stateTemporary =
|
|
127
|
+
const stateTemporary = stateTemporaryPattern(generation);
|
|
91
128
|
for (const name of await readdir(staging)) {
|
|
92
129
|
if (!stateTemporary.test(name)) continue;
|
|
93
130
|
const path = join(staging, name);
|
|
@@ -100,15 +137,7 @@ async function removeKnownStateTemporaries(staging, generation) {
|
|
|
100
137
|
async function cleanupRetiredStaging(target, staging, state) {
|
|
101
138
|
if (!await knownStagingEntriesOnly(staging, state.generation)) return false;
|
|
102
139
|
if (await pathInfo(join(staging, "candidate"))) return false;
|
|
103
|
-
await
|
|
104
|
-
await rm(join(staging, "helper-armed"), { force: true });
|
|
105
|
-
await rm(join(staging, "helper-ready"), { force: true });
|
|
106
|
-
await rm(join(staging, "cancel.json"), { force: true });
|
|
107
|
-
await rm(join(staging, "cancel-ack.json"), { force: true });
|
|
108
|
-
await rm(join(staging, "helper"), {
|
|
109
|
-
recursive: true,
|
|
110
|
-
force: true
|
|
111
|
-
});
|
|
140
|
+
await removeUpdateHelperArtifacts(staging);
|
|
112
141
|
if (!await removeKnownStateTemporaries(staging, state.generation)) return false;
|
|
113
142
|
const current = await readUpdateStageState(staging);
|
|
114
143
|
if (!current || current.generation !== state.generation || current.phase !== "retired") return false;
|
|
@@ -168,8 +197,7 @@ async function retireCompletedUpdateWhileLocked(options) {
|
|
|
168
197
|
if (containerInfo && !claimInfo) return false;
|
|
169
198
|
if (!containerInfo && candidateInfo && !claimInfo && !await ensureClaim(target, state)) return false;
|
|
170
199
|
const expectedOwner = ownerFor(target, state);
|
|
171
|
-
if (
|
|
172
|
-
if (!claimInfo && (!expectedOwner || !await ownerMatches(await readOwner(paths.claim), expectedOwner))) return false;
|
|
200
|
+
if (!expectedOwner || !ownerMatches(await readOwner(paths.claim), expectedOwner)) return false;
|
|
173
201
|
if (!containerInfo) try {
|
|
174
202
|
await mkdir(paths.container, { mode: 448 });
|
|
175
203
|
} catch {
|
|
@@ -195,11 +223,11 @@ async function retireCompletedUpdateWhileLocked(options) {
|
|
|
195
223
|
}
|
|
196
224
|
if (state.phase !== "retired") return false;
|
|
197
225
|
const owner = ownerFor(target, state);
|
|
198
|
-
if (!owner || !
|
|
226
|
+
if (!owner || !ownerMatches(await readOwner(paths.claim), owner) || !await matchesInstalledTree(target, owner) || await pathInfo(join(staging, "candidate")) || !await matchesOldTree(paths.tree, state)) return false;
|
|
199
227
|
const finalContainer = await pathInfo(paths.container);
|
|
200
228
|
if (!finalContainer?.isDirectory() || finalContainer.isSymbolicLink()) return false;
|
|
201
229
|
const finalEntries = await readdir(paths.container);
|
|
202
230
|
if (finalEntries.length !== 1 || finalEntries[0] !== "tree") return false;
|
|
203
231
|
return cleanupRetiredStaging(target, staging, state);
|
|
204
232
|
}
|
|
205
|
-
export { acknowledgeRetiredUpdateHealthy, reconcileRetirementCleanupMarkerWhileLocked, retireCompletedUpdateWhileLocked };
|
|
233
|
+
export { acknowledgeRetiredUpdateHealthy, acknowledgeRetiredUpdateLineage, reconcileRetirementCleanupMarkerWhileLocked, retireCompletedUpdateWhileLocked };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UpdateAdapter, UpdateChannel, UpdateState } from '@adea-ai/ui/components/composites/update-dialog';
|
|
2
|
-
import { type
|
|
2
|
+
import { type NativeUpdateState } from './update-state';
|
|
3
3
|
export type { UpdateAdapter, UpdateChannel, UpdateState };
|
|
4
4
|
/** Channel persistence as a `read`/`persist` pair. */
|
|
5
5
|
export type UpdateChannelStore = Readonly<{
|
|
@@ -22,28 +22,6 @@ export declare function updateChannelStore(source: UpdateChannelSource): UpdateC
|
|
|
22
22
|
* The wrapped adapter otherwise behaves identically.
|
|
23
23
|
*/
|
|
24
24
|
export declare function mirrorUpdateState(adapter: UpdateAdapter, onState: (state: UpdateState) => void): UpdateAdapter;
|
|
25
|
-
/** A native updater snapshot in snake_case, as Rust and older desktop hosts report it. */
|
|
26
|
-
export type NativeUpdateSnapshot = NativeUpdateSnapshotOf<UpdateState['phase'], string | null>;
|
|
27
|
-
/** A native updater that answers with snake_case snapshots. */
|
|
28
|
-
export type NativeUpdateAdapter = Readonly<{
|
|
29
|
-
check(): Promise<NativeUpdateSnapshot>;
|
|
30
|
-
getStatus(): Promise<NativeUpdateSnapshot>;
|
|
31
|
-
install(expectedVersion: string): Promise<NativeUpdateSnapshot>;
|
|
32
|
-
isDesktopRuntime(): boolean;
|
|
33
|
-
pollIntervalMs?: number;
|
|
34
|
-
}>;
|
|
35
|
-
/** Map a snake_case native snapshot to the shared update state. */
|
|
36
|
-
export declare function updateStateFromNative(update: NativeUpdateSnapshot, options?: {
|
|
37
|
-
releaseNotes?: boolean;
|
|
38
|
-
}): UpdateState;
|
|
39
|
-
/**
|
|
40
|
-
* Bridge a snake_case native updater to the shared adapter. Release notes are dropped
|
|
41
|
-
* unless requested, which keeps the dialog's per-release notes section hidden. An accessor is
|
|
42
|
-
* read when an operation or polling interval is requested, so it can provide a replacement.
|
|
43
|
-
*/
|
|
44
|
-
export declare function nativeUpdateAdapter(native: NativeUpdateAdapter | (() => NativeUpdateAdapter), options?: {
|
|
45
|
-
releaseNotes?: boolean;
|
|
46
|
-
}): UpdateAdapter;
|
|
47
25
|
/** The adapter for a build with no installer: the dialog explains updates are desktop-only. */
|
|
48
26
|
export declare function browserUpdateAdapter(currentVersion?: string): UpdateAdapter;
|
|
49
27
|
/** Every phase the shared update dialog understands, in state-machine order. */
|
|
@@ -55,27 +55,6 @@ function mirrorUpdateState(adapter, onState) {
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
/** Map a snake_case native snapshot to the shared update state. */
|
|
59
|
-
function updateStateFromNative(update, options = {}) {
|
|
60
|
-
return toUpdateState(update, { includeReleaseNotes: Boolean(options.releaseNotes) });
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Bridge a snake_case native updater to the shared adapter. Release notes are dropped
|
|
64
|
-
* unless requested, which keeps the dialog's per-release notes section hidden. An accessor is
|
|
65
|
-
* read when an operation or polling interval is requested, so it can provide a replacement.
|
|
66
|
-
*/
|
|
67
|
-
function nativeUpdateAdapter(native, options = {}) {
|
|
68
|
-
const current = typeof native === "function" ? native : () => native;
|
|
69
|
-
return {
|
|
70
|
-
check: async () => updateStateFromNative(await current().check(), options),
|
|
71
|
-
getStatus: async () => updateStateFromNative(await current().getStatus(), options),
|
|
72
|
-
install: async (expectedVersion) => updateStateFromNative(await current().install(expectedVersion), options),
|
|
73
|
-
isDesktopRuntime: () => current().isDesktopRuntime(),
|
|
74
|
-
get pollIntervalMs() {
|
|
75
|
-
return current().pollIntervalMs;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
58
|
/** The adapter for a build with no installer: the dialog explains updates are desktop-only. */
|
|
80
59
|
function browserUpdateAdapter(currentVersion = "") {
|
|
81
60
|
const state = {
|
|
@@ -128,12 +107,14 @@ function parseDesktopUpdateStatus(value) {
|
|
|
128
107
|
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error("Invalid desktop update status");
|
|
129
108
|
const record = value;
|
|
130
109
|
const releaseNotes = record.release_notes ?? null;
|
|
131
|
-
|
|
110
|
+
const changelogDigest = record.changelog_digest;
|
|
111
|
+
if (changelogDigest !== void 0 && (!isText(changelogDigest) || changelogDigest.length > 128) || !isText(record.current_version) || !isNullableText(record.available_version) || !isUpdatePhase(record.phase) || !isText(record.changelog) || !isNullableText(releaseNotes) || !isNullableText(record.release_date) || !isByteCount(record.downloaded_bytes) || record.total_bytes !== null && !isByteCount(record.total_bytes) || !isNullableText(record.error) || !isText(record.github_url) || typeof record.restart_required !== "boolean") throw new Error("Invalid desktop update status");
|
|
132
112
|
return {
|
|
133
113
|
phase: record.phase,
|
|
134
114
|
current_version: record.current_version,
|
|
135
115
|
available_version: record.available_version,
|
|
136
116
|
changelog: record.changelog,
|
|
117
|
+
...changelogDigest === void 0 ? {} : { changelog_digest: changelogDigest },
|
|
137
118
|
release_notes: releaseNotes,
|
|
138
119
|
release_date: record.release_date,
|
|
139
120
|
downloaded_bytes: record.downloaded_bytes,
|
|
@@ -160,9 +141,35 @@ var INSTALLABLE_PHASES = [
|
|
|
160
141
|
*/
|
|
161
142
|
function desktopUpdateAdapter(invoke, options = {}) {
|
|
162
143
|
let latest;
|
|
144
|
+
let changelog;
|
|
145
|
+
const withChangelog = async (status) => {
|
|
146
|
+
const digest = status.changelog_digest;
|
|
147
|
+
if (digest === void 0 || status.changelog) return status;
|
|
148
|
+
if (changelog?.digest !== digest) {
|
|
149
|
+
const text = invoke("desktop_update_changelog").then((value) => {
|
|
150
|
+
if (!isText(value)) throw new Error("Invalid desktop update changelog");
|
|
151
|
+
return value;
|
|
152
|
+
});
|
|
153
|
+
changelog = {
|
|
154
|
+
digest,
|
|
155
|
+
text
|
|
156
|
+
};
|
|
157
|
+
text.catch(() => {
|
|
158
|
+
if (changelog?.text === text) changelog = void 0;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
return {
|
|
163
|
+
...status,
|
|
164
|
+
changelog: await changelog.text
|
|
165
|
+
};
|
|
166
|
+
} catch {
|
|
167
|
+
return status;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
163
170
|
const view = (status) => toUpdateState(status, { includeReleaseNotes: options.releaseNotes !== false });
|
|
164
171
|
const call = async (command, args) => {
|
|
165
|
-
const status = parseDesktopUpdateStatus(await invoke(command, args));
|
|
172
|
+
const status = await withChangelog(parseDesktopUpdateStatus(await invoke(command, args)));
|
|
166
173
|
latest = status;
|
|
167
174
|
try {
|
|
168
175
|
options.onStatus?.(status);
|
|
@@ -208,4 +215,4 @@ function desktopUpdateChannelService(invoke) {
|
|
|
208
215
|
}
|
|
209
216
|
};
|
|
210
217
|
}
|
|
211
|
-
export { UPDATE_PENDING_PHASES, UPDATE_PHASES, browserUpdateAdapter, desktopUpdateAdapter, desktopUpdateChannelService, isUpdatePending, isUpdatePhase, mirrorUpdateState,
|
|
218
|
+
export { UPDATE_PENDING_PHASES, UPDATE_PHASES, browserUpdateAdapter, desktopUpdateAdapter, desktopUpdateChannelService, isUpdatePending, isUpdatePhase, mirrorUpdateState, parseDesktopUpdateStatus, updateChannelStore };
|
|
@@ -2,7 +2,8 @@ import { type UpdateChannel } from './feed/release-version';
|
|
|
2
2
|
/** Persist one app-owned update channel; the caller must supply a private state directory. */
|
|
3
3
|
export declare function createUpdateChannelStore(directory: string): {
|
|
4
4
|
read: () => Promise<UpdateChannel>;
|
|
5
|
+
/** Saves the channel the installation will follow, and resolves with it. */
|
|
5
6
|
save: (channel: UpdateChannel) => Promise<UpdateChannel>;
|
|
6
7
|
};
|
|
7
8
|
/** Shared UI uses pre-release; release descriptors use daily. */
|
|
8
|
-
export declare function releaseChannelForUpdate(channel: UpdateChannel): 'stable' | 'daily'
|
|
9
|
+
export declare function releaseChannelForUpdate(channel: UpdateChannel): 'stable' | 'daily';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { errorCode } from "../app/value-guards.js";
|
|
2
2
|
import { createSerialQueue } from "../app/serial-queue.js";
|
|
3
3
|
import { openUnchangedFile, sameFile } from "./locks/stable-file.js";
|
|
4
|
-
import { isUpdateChannel } from "./feed/release-version.js";
|
|
4
|
+
import { isUpdateChannel, readUpdateChannel } from "./feed/release-version.js";
|
|
5
5
|
import { isCanonicalPath } from "../native/canonical-path.js";
|
|
6
6
|
import { lstat, open, realpath, rename, unlink } from "node:fs/promises";
|
|
7
7
|
import { join } from "node:path";
|
|
@@ -33,14 +33,16 @@ function createUpdateChannelStore(directory) {
|
|
|
33
33
|
if (fileRead.bytesRead !== before.size) throw new Error("Invalid update channel file");
|
|
34
34
|
const value = JSON.parse(bytes.subarray(0, fileRead.bytesRead).toString("utf8"));
|
|
35
35
|
const after = await file.stat();
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const channel = readUpdateChannel(value?.channel);
|
|
37
|
+
if (!sameFile(before, after) || typeof value !== "object" || value === null || Array.isArray(value) || Object.keys(value).length !== 1 || channel === null) throw new Error("Invalid update channel file");
|
|
38
|
+
return channel;
|
|
38
39
|
} finally {
|
|
39
40
|
await file.close();
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
return {
|
|
43
44
|
read: () => ordered(read),
|
|
45
|
+
/** Saves the channel the installation will follow, and resolves with it. */
|
|
44
46
|
save: (channel) => ordered(async () => {
|
|
45
47
|
if (!isUpdateChannel(channel)) throw new Error("Invalid update channel");
|
|
46
48
|
await assertDirectory();
|
|
@@ -65,6 +67,6 @@ function createUpdateChannelStore(directory) {
|
|
|
65
67
|
/** Shared UI uses pre-release; release descriptors use daily. */
|
|
66
68
|
function releaseChannelForUpdate(channel) {
|
|
67
69
|
if (!isUpdateChannel(channel)) throw new Error("Invalid update channel");
|
|
68
|
-
return channel === "
|
|
70
|
+
return channel === "stable" ? "stable" : "daily";
|
|
69
71
|
}
|
|
70
72
|
export { createUpdateChannelStore, releaseChannelForUpdate };
|
|
@@ -2,7 +2,7 @@ import { discoverSignedRelease } from "./feed/update-discovery.js";
|
|
|
2
2
|
import { downloadVerifiedRelease } from "./install/update-download.js";
|
|
3
3
|
import { selectUpdateDownloadDiscard } from "./install/update-download-cleanup.js";
|
|
4
4
|
import { isVerifiedReleaseForTrust } from "./feed/signed-release.js";
|
|
5
|
-
import { versionLessThan } from "./feed/release-version.js";
|
|
5
|
+
import { isReleaseVersion, versionLessThan } from "./feed/release-version.js";
|
|
6
6
|
import { UpdatePreflightError } from "./update-preflight-error.js";
|
|
7
7
|
// src/updates/update-manager.ts
|
|
8
8
|
var UPDATE_PREFLIGHT_MESSAGES = {
|
|
@@ -19,7 +19,7 @@ function createUpdateManager(options) {
|
|
|
19
19
|
const directory = options.directory;
|
|
20
20
|
const download = options.download;
|
|
21
21
|
const discardDownload = selectUpdateDownloadDiscard(directory, download !== void 0, options.discardDownload);
|
|
22
|
-
if (
|
|
22
|
+
if (!isReleaseVersion(options.currentVersion) || !Number.isSafeInteger(options.maxBytes) || options.maxBytes < 1 || typeof options.stage !== "function") throw new Error("Invalid update manager configuration");
|
|
23
23
|
let state = Object.freeze({
|
|
24
24
|
phase: "idle",
|
|
25
25
|
currentVersion: options.currentVersion,
|
|
@@ -2,7 +2,7 @@ import { type createServiceRegistry } from '../app/service-registry';
|
|
|
2
2
|
import { type UpdateChannel } from './feed/release-version';
|
|
3
3
|
import type { DesktopUpdater, UpdateInstallRequest } from './desktop-updater';
|
|
4
4
|
type Services<Principal> = ReturnType<typeof createServiceRegistry<Principal>>;
|
|
5
|
-
/** The `desktop_update_channel_save` argument
|
|
5
|
+
/** The `desktop_update_channel_save` argument; older pickers still send retired `dev`. */
|
|
6
6
|
export declare function parseUpdateChannel(value: unknown): UpdateChannel;
|
|
7
7
|
/** The `desktop_update_install` argument. */
|
|
8
8
|
export declare function parseUpdateInstall(value: unknown): UpdateInstallRequest;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ServiceError } from "../app/service-registry.js";
|
|
2
|
-
import {
|
|
2
|
+
import { readUpdateChannel } from "./feed/release-version.js";
|
|
3
3
|
// src/updates/update-services.ts
|
|
4
4
|
function record(value, keys) {
|
|
5
5
|
if (typeof value !== "object" || value === null || Array.isArray(value) || Object.keys(value).some((key) => !keys.includes(key))) throw new Error("Invalid input");
|
|
@@ -9,10 +9,10 @@ function parseNone(value) {
|
|
|
9
9
|
if (value !== void 0 && value !== null) record(value, []);
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
|
-
/** The `desktop_update_channel_save` argument
|
|
12
|
+
/** The `desktop_update_channel_save` argument; older pickers still send retired `dev`. */
|
|
13
13
|
function parseUpdateChannel(value) {
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
14
|
+
const channel = readUpdateChannel(record(value, ["channel"]).channel);
|
|
15
|
+
if (channel === null) throw new Error("Invalid input");
|
|
16
16
|
return channel;
|
|
17
17
|
}
|
|
18
18
|
/** The `desktop_update_install` argument. */
|
|
@@ -44,6 +44,11 @@ function registerUpdateServices(options) {
|
|
|
44
44
|
authorize,
|
|
45
45
|
run: () => updater.status().catch(failure)
|
|
46
46
|
}),
|
|
47
|
+
services.register("desktop_update_changelog", {
|
|
48
|
+
parse: parseNone,
|
|
49
|
+
authorize,
|
|
50
|
+
run: () => updater.changelog().catch(failure)
|
|
51
|
+
}),
|
|
47
52
|
services.register("desktop_update_channel", {
|
|
48
53
|
parse: parseNone,
|
|
49
54
|
authorize,
|
|
@@ -45,8 +45,6 @@ export declare function newUpdateStageState(input: {
|
|
|
45
45
|
signedRelease: SignedRelease;
|
|
46
46
|
}): UpdateStageState;
|
|
47
47
|
export declare function readUpdateStageState(staging: string): Promise<UpdateStageState | undefined>;
|
|
48
|
-
/** Sync a journal directory after a state rename or owned-entry cleanup. */
|
|
49
|
-
export declare function syncUpdateStageDirectory(staging: string): Promise<void>;
|
|
50
48
|
export declare function writeUpdateStageState(staging: string, state: UpdateStageState): Promise<void>;
|
|
51
49
|
/**
|
|
52
50
|
* Atomically replace and sync a journal record before a schema-3 gate decision.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { errorCode, isSha256Hex, isUuid } from "../app/value-guards.js";
|
|
2
2
|
import { tryAcquireUpdateLock } from "./locks/update-lock.js";
|
|
3
|
+
import { isReleaseVersion } from "./feed/release-version.js";
|
|
3
4
|
import { readSmallStateFile } from "./locks/stable-file.js";
|
|
5
|
+
import { syncDirectory } from "../shared/file-system.js";
|
|
4
6
|
import { open, rename, unlink, writeFile } from "node:fs/promises";
|
|
5
7
|
import { join } from "node:path";
|
|
6
8
|
import { randomUUID } from "node:crypto";
|
|
@@ -52,7 +54,7 @@ function parseState(value) {
|
|
|
52
54
|
"retiring",
|
|
53
55
|
"retired",
|
|
54
56
|
"failed"
|
|
55
|
-
].includes(String(record.phase)) ||
|
|
57
|
+
].includes(String(record.phase)) || !isReleaseVersion(record.version) || !isReleaseVersion(record.previousVersion) || candidateTreeDigest !== void 0 && (typeof candidateTreeDigest !== "string" || !isSha256Hex(candidateTreeDigest)) || candidateTreeIdentity !== void 0 && (typeof candidateTreeIdentity !== "object" || candidateTreeIdentity === null || Array.isArray(candidateTreeIdentity) || Object.keys(candidateTreeIdentity).length !== 2 || typeof candidateTreeIdentity.device !== "string" || !/^[1-9]\d{0,19}$/.test(candidateTreeIdentity.device) || typeof candidateTreeIdentity.inode !== "string" || !/^[1-9]\d{0,19}$/.test(candidateTreeIdentity.inode)) || previousTreeIdentity !== void 0 && (typeof previousTreeIdentity !== "object" || previousTreeIdentity === null || Array.isArray(previousTreeIdentity) || Object.keys(previousTreeIdentity).length !== 2 || typeof previousTreeIdentity.device !== "string" || !/^[1-9]\d{0,19}$/.test(previousTreeIdentity.device) || typeof previousTreeIdentity.inode !== "string" || !/^[1-9]\d{0,19}$/.test(previousTreeIdentity.inode)) || record.signedRelease !== void 0 && (typeof record.signedRelease !== "object" || record.signedRelease === null || Array.isArray(record.signedRelease) || Object.keys(record.signedRelease).length !== 2 || !Object.hasOwn(record.signedRelease, "descriptor") || typeof record.signedRelease.signature !== "string") || record.helperPid !== void 0 && (!Number.isSafeInteger(record.helperPid) || record.helperPid < 2) || record.helperOwner !== void 0 && (typeof record.helperOwner !== "string" || !isUuid(record.helperOwner)) || record.launchGateOwner !== void 0 && (typeof record.launchGateOwner !== "string" || !isUuid(record.launchGateOwner)) || Object.keys(record).some((key) => ![
|
|
56
58
|
"schema",
|
|
57
59
|
"generation",
|
|
58
60
|
"phase",
|
|
@@ -74,15 +76,6 @@ async function readUpdateStageState(staging) {
|
|
|
74
76
|
const text = await readSmallStateFile(join(staging, "state.json"), 4096, "Invalid update staging state");
|
|
75
77
|
return text === void 0 ? void 0 : parseState(JSON.parse(text));
|
|
76
78
|
}
|
|
77
|
-
/** Sync a journal directory after a state rename or owned-entry cleanup. */
|
|
78
|
-
async function syncUpdateStageDirectory(staging) {
|
|
79
|
-
const directory = await open(staging, constants$1.O_RDONLY);
|
|
80
|
-
try {
|
|
81
|
-
await directory.sync();
|
|
82
|
-
} finally {
|
|
83
|
-
await directory.close();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
79
|
async function writeUpdateStageState(staging, state) {
|
|
87
80
|
await replaceUpdateStageState(staging, state, false);
|
|
88
81
|
}
|
|
@@ -117,7 +110,7 @@ async function replaceUpdateStageState(staging, state, durable) {
|
|
|
117
110
|
});
|
|
118
111
|
await rename(temporary, path);
|
|
119
112
|
renamed = true;
|
|
120
|
-
if (durable) await
|
|
113
|
+
if (durable) await syncDirectory(staging);
|
|
121
114
|
} catch (error) {
|
|
122
115
|
if (!renamed && errorCode(error) !== "EEXIST") await unlink(temporary).catch(() => {});
|
|
123
116
|
throw error;
|
|
@@ -132,4 +125,4 @@ async function withUpdateLock(target, operation) {
|
|
|
132
125
|
await lock.release();
|
|
133
126
|
}
|
|
134
127
|
}
|
|
135
|
-
export { UpdateLockBusyError, acquireUpdateLock, newUpdateStageState, readUpdateHelperRequestFile, readUpdateStageState,
|
|
128
|
+
export { UpdateLockBusyError, acquireUpdateLock, newUpdateStageState, readUpdateHelperRequestFile, readUpdateStageState, withUpdateLock, writeUpdateStageState, writeUpdateStageStateDurably };
|
|
@@ -3,7 +3,11 @@ export type NativeUpdateState<Phase extends string = string> = Readonly<{
|
|
|
3
3
|
phase: Phase;
|
|
4
4
|
current_version: string;
|
|
5
5
|
available_version: string | null;
|
|
6
|
+
/** Empty when the host serves the changelog separately; see `changelog_digest`. */
|
|
6
7
|
changelog: string;
|
|
8
|
+
/** Identifies the changelog `desktop_update_changelog` returns, so a client fetches it once
|
|
9
|
+
* instead of receiving it in every polled status. Absent when `changelog` carries it. */
|
|
10
|
+
changelog_digest?: string;
|
|
7
11
|
release_notes: string | null;
|
|
8
12
|
release_date: string | null;
|
|
9
13
|
downloaded_bytes: number;
|
|
@@ -12,16 +16,8 @@ export type NativeUpdateState<Phase extends string = string> = Readonly<{
|
|
|
12
16
|
github_url: string;
|
|
13
17
|
restart_required: boolean;
|
|
14
18
|
}>;
|
|
15
|
-
/**
|
|
16
|
-
* A native updater snapshot: the service fields, with a release URL that may be
|
|
17
|
-
* absent (`Url`) and release notes that older hosts omit.
|
|
18
|
-
*/
|
|
19
|
-
export type NativeUpdateSnapshotOf<Phase extends string = string, Url extends string | null = string> = Omit<NativeUpdateState<Phase>, 'github_url' | 'release_notes'> & Readonly<{
|
|
20
|
-
github_url: Url;
|
|
21
|
-
release_notes?: string | null;
|
|
22
|
-
}>;
|
|
23
19
|
/** Project a native snapshot into the shared UI update dialog contract. */
|
|
24
|
-
export declare function toUpdateState<Phase extends string
|
|
20
|
+
export declare function toUpdateState<Phase extends string>(update: NativeUpdateState<Phase>, options?: {
|
|
25
21
|
includeReleaseNotes?: boolean;
|
|
26
22
|
}): {
|
|
27
23
|
phase: Phase;
|
|
@@ -33,6 +29,6 @@ export declare function toUpdateState<Phase extends string, Url extends string |
|
|
|
33
29
|
downloadedBytes: number;
|
|
34
30
|
totalBytes: number | null;
|
|
35
31
|
error: string | null;
|
|
36
|
-
releaseUrl:
|
|
32
|
+
releaseUrl: string;
|
|
37
33
|
restartRequired: boolean;
|
|
38
34
|
};
|
|
@@ -6,7 +6,7 @@ function toUpdateState(update, options = {}) {
|
|
|
6
6
|
currentVersion: update.current_version,
|
|
7
7
|
availableVersion: update.available_version,
|
|
8
8
|
changelog: update.changelog,
|
|
9
|
-
releaseNotes: options.includeReleaseNotes === false ? null : update.release_notes
|
|
9
|
+
releaseNotes: options.includeReleaseNotes === false ? null : update.release_notes,
|
|
10
10
|
releaseDate: update.release_date,
|
|
11
11
|
downloadedBytes: update.downloaded_bytes,
|
|
12
12
|
totalBytes: update.total_bytes,
|
package/dist/views/app-help.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Accessor } from 'solid-js';
|
|
2
2
|
import { standardShortcuts, type HelpLink, type HelpShortcut } from '../shell/help-shortcuts';
|
|
3
|
-
export
|
|
3
|
+
export type { HelpLink, HelpShortcut };
|
|
4
4
|
export type ApplicationHelpProps = {
|
|
5
5
|
open: boolean;
|
|
6
6
|
onClose(): void;
|
package/dist/views/app-help.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { detectShortcutPlatform, resolveShortcutPlatform, settingsShortcutLabel, shortcutModifierKey } from "../shell/shortcut-platform.js";
|
|
2
|
-
import { DEFAULT_SETTINGS_KEYSHORTCUTS } from "../shell/settings-shortcuts.js";
|
|
3
1
|
import { standardShortcuts } from "../shell/help-shortcuts.js";
|
|
4
2
|
import { createComponent } from "solid-js/web";
|
|
5
3
|
import { ModalDialog } from "@adea-ai/ui/components/ui/modal-dialog";
|
|
@@ -40,4 +38,4 @@ function ApplicationHelp(props) {
|
|
|
40
38
|
}
|
|
41
39
|
});
|
|
42
40
|
}
|
|
43
|
-
export { ApplicationHelp
|
|
41
|
+
export { ApplicationHelp };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { preferencesFromSelection } from "../appearance/appearance-preferences.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "../appearance/custom-theme-library.js";
|
|
2
|
+
import { CUSTOM_THEME_LIBRARY_RECOVERED, removeCustomThemeAtomically } from "../appearance/theme-library-mutation.js";
|
|
3
|
+
import { customThemes, readCustomThemeLibrary, subscribeCustomThemes } from "../appearance/theme-library-store.js";
|
|
5
4
|
import { useTheme } from "../appearance/appearance-host.js";
|
|
6
5
|
import { mirrorWindowSurface } from "../appearance/window-surface.js";
|
|
7
6
|
import { draftVariants } from "../appearance/composition.js";
|
|
@@ -49,8 +48,9 @@ function AppearanceHost(props) {
|
|
|
49
48
|
appearance.loadCatalogue?.();
|
|
50
49
|
}
|
|
51
50
|
});
|
|
51
|
+
const draftSurface = createMemo(() => editor.draft().surface);
|
|
52
52
|
createEffect(() => {
|
|
53
|
-
const surface =
|
|
53
|
+
const surface = draftSurface();
|
|
54
54
|
mirrorWindowSurface(surface === "translucent" ? "theme" : surface);
|
|
55
55
|
});
|
|
56
56
|
const [customAccent, setCustomAccent] = createSignal("");
|
|
@@ -60,7 +60,7 @@ function AppearanceHost(props) {
|
|
|
60
60
|
const [library, setLibrary] = createSignal(readCustomThemeLibrary(defaultPreferenceStorage()));
|
|
61
61
|
onMount(() => {
|
|
62
62
|
setLibrary(readCustomThemeLibrary(defaultPreferenceStorage()));
|
|
63
|
-
onCleanup(subscribeCustomThemes(() => setLibrary(
|
|
63
|
+
onCleanup(subscribeCustomThemes(() => setLibrary(customThemes())));
|
|
64
64
|
});
|
|
65
65
|
const themes = createMemo(() => {
|
|
66
66
|
library();
|
|
@@ -75,6 +75,13 @@ function AppearanceHost(props) {
|
|
|
75
75
|
darkThemeId: darkThemeId()
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
|
+
const draftAccent = createMemo(() => editor.draft().accent);
|
|
79
|
+
const previewPair = createMemo(() => ({
|
|
80
|
+
lightThemeId: lightThemeId(),
|
|
81
|
+
darkThemeId: darkThemeId()
|
|
82
|
+
}), void 0, { equals: (left, right) => left.lightThemeId === right.lightThemeId && left.darkThemeId === right.darkThemeId });
|
|
83
|
+
const lightPreview = createMemo(() => appearanceThemeForPreview(miniatures().light, draftAccent(), previewPair()));
|
|
84
|
+
const darkPreview = createMemo(() => appearanceThemeForPreview(miniatures().dark, draftAccent(), previewPair()));
|
|
78
85
|
const [importStatus, setImportStatus] = createSignal("");
|
|
79
86
|
const [importPending, setImportPending] = createSignal(false);
|
|
80
87
|
const themeActionFence = createThemeLibraryActionFence(setImportStatus);
|
|
@@ -220,10 +227,10 @@ function AppearanceHost(props) {
|
|
|
220
227
|
return publishedDraft();
|
|
221
228
|
},
|
|
222
229
|
get lightTheme() {
|
|
223
|
-
return
|
|
230
|
+
return lightPreview();
|
|
224
231
|
},
|
|
225
232
|
get darkTheme() {
|
|
226
|
-
return
|
|
233
|
+
return darkPreview();
|
|
227
234
|
},
|
|
228
235
|
get resolvedAppearance() {
|
|
229
236
|
const shownAppearance = appearance.shownAppearance;
|
|
@@ -365,7 +372,7 @@ function AppearanceHost(props) {
|
|
|
365
372
|
return;
|
|
366
373
|
}
|
|
367
374
|
const result = await removeCustomThemeAtomically(theme.id, storage);
|
|
368
|
-
themeActionFence.report(action, result.ok ? "" : result.error);
|
|
375
|
+
themeActionFence.report(action, result.ok ? result.recovered ? CUSTOM_THEME_LIBRARY_RECOVERED : "" : result.error);
|
|
369
376
|
},
|
|
370
377
|
children: "Remove"
|
|
371
378
|
}), null);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type UpdateAdapter, type UpdateChannel, type UpdateState } from '@adea-ai/ui/components/composites/update-dialog';
|
|
2
2
|
import { type Accessor } from 'solid-js';
|
|
3
3
|
import { type UpdateChannelSource } from '../updates/update-adapter';
|
|
4
|
-
export * from '../updates/update-adapter';
|
|
5
|
-
export type { ChannelControlActions };
|
|
6
4
|
export type ApplicationUpdateSurfaceProps = {
|
|
7
5
|
adapter: UpdateAdapter;
|
|
8
6
|
/** The application's name, icon and build version shown by the dialog. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mirrorUpdateState, updateChannelStore } from "../updates/update-adapter.js";
|
|
2
2
|
import { createComponent } from "solid-js/web";
|
|
3
3
|
import { createMemo } from "solid-js";
|
|
4
4
|
import { UpdateChannelControl, UpdateDialog } from "@adea-ai/ui/components/composites/update-dialog";
|
|
@@ -61,4 +61,4 @@ function ApplicationUpdateSurface(props) {
|
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
export { ApplicationUpdateSurface
|
|
64
|
+
export { ApplicationUpdateSurface };
|