@adea-ai/app-framework 0.39.3 → 0.40.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.
Files changed (199) hide show
  1. package/README.md +160 -53
  2. package/dist/app/application.d.ts +0 -1
  3. package/dist/app/application.js +8 -6
  4. package/dist/app/create-application.js +3 -11
  5. package/dist/app/service-registry.d.ts +0 -1
  6. package/dist/app/service-registry.js +3 -3
  7. package/dist/app/value-guards.d.ts +2 -0
  8. package/dist/app/value-guards.js +6 -1
  9. package/dist/appearance/appearance-host.d.ts +1 -1
  10. package/dist/appearance/appearance-host.js +11 -2
  11. package/dist/appearance/appearance-preferences.d.ts +0 -1
  12. package/dist/appearance/custom-theme-import.d.ts +8 -2
  13. package/dist/appearance/custom-theme-import.js +58 -23
  14. package/dist/appearance/custom-theme-library.d.ts +3 -3
  15. package/dist/appearance/custom-theme-library.js +3 -3
  16. package/dist/appearance/theme-file-importer.d.ts +1 -1
  17. package/dist/appearance/theme-file-importer.js +2 -1
  18. package/dist/appearance/theme-library-mutation.d.ts +7 -0
  19. package/dist/appearance/theme-library-mutation.js +10 -2
  20. package/dist/appearance/theme-library-store.d.ts +17 -13
  21. package/dist/appearance/theme-library-store.js +35 -22
  22. package/dist/appearance/theme-record-adapter.js +1 -2
  23. package/dist/appearance/theme-registry.js +0 -1
  24. package/dist/cli/cli-runner.d.ts +3 -2
  25. package/dist/cli/cli-runner.js +5 -10
  26. package/dist/cli/release-assets-plan-cli.js +2 -2
  27. package/dist/cli/release-cut-cli.js +2 -3
  28. package/dist/cli/release-descriptor-staging-cli.js +2 -2
  29. package/dist/cli/release-finalize-cli.js +3 -3
  30. package/dist/cli/release-promote-cli.js +2 -2
  31. package/dist/cli/release-publish-cli.js +2 -2
  32. package/dist/cli/release-sign-cli.js +2 -1
  33. package/dist/cli/release-step-cli.js +2 -2
  34. package/dist/desktop/channel-proof.js +27 -11
  35. package/dist/desktop/client-assets.d.ts +6 -1
  36. package/dist/desktop/client-assets.js +16 -3
  37. package/dist/desktop/client-dev-proxy.d.ts +0 -2
  38. package/dist/desktop/client-dev-proxy.js +2 -2
  39. package/dist/desktop/desktop-client.js +2 -1
  40. package/dist/desktop/desktop-gateway.js +24 -82
  41. package/dist/desktop/desktop-host-websocket.d.ts +5 -1
  42. package/dist/desktop/desktop-host-websocket.js +9 -7
  43. package/dist/desktop/desktop-host.d.ts +5 -0
  44. package/dist/desktop/desktop-host.js +3 -0
  45. package/dist/desktop/desktop-stream.js +5 -10
  46. package/dist/desktop/typed-array-intrinsics.d.ts +6 -0
  47. package/dist/desktop/typed-array-intrinsics.js +13 -1
  48. package/dist/developer-app/developer-app.d.ts +1 -1
  49. package/dist/developer-app/developer-app.js +26 -13
  50. package/dist/framework-source.json +1 -1
  51. package/dist/installer/command-artifact.d.ts +1 -0
  52. package/dist/installer/command-artifact.js +47 -27
  53. package/dist/installer/installed-payload.js +3 -1
  54. package/dist/installer/installer-ci-bootstrap.js +5 -6
  55. package/dist/installer/installer-ci-preflight.js +3 -3
  56. package/dist/installer/installer-identity.d.ts +0 -22
  57. package/dist/installer/installer-identity.js +3 -53
  58. package/dist/installer/installer-image-mount.d.ts +0 -1
  59. package/dist/installer/installer-image-mount.js +1 -1
  60. package/dist/installer/installer-observation.d.ts +5 -5
  61. package/dist/installer/installer-observation.js +32 -47
  62. package/dist/installer/installer-process-cleanup.js +2 -2
  63. package/dist/installer/installer-renderer-evidence.js +7 -28
  64. package/dist/installer/installer-upgrade-command.js +8 -20
  65. package/dist/installer/installer-worker-guard.js +3 -3
  66. package/dist/native/cef-helper.js +4 -4
  67. package/dist/native/desktop-build.d.ts +0 -3
  68. package/dist/native/desktop-build.js +2 -2
  69. package/dist/native/electrobun-source-patch.d.ts +4 -0
  70. package/dist/native/electrobun-source-patch.js +5 -1
  71. package/dist/native/native-utilities.js +4 -3
  72. package/dist/native/pinned-download.d.ts +16 -0
  73. package/dist/native/pinned-download.js +42 -0
  74. package/dist/native/posix-launcher-build.js +15 -35
  75. package/dist/native/posix-tree-removal.js +21 -33
  76. package/dist/native/sidecar-services.d.ts +0 -2
  77. package/dist/native/sidecar-services.js +1 -1
  78. package/dist/native/sidecar.d.ts +3 -0
  79. package/dist/native/sidecar.js +15 -2
  80. package/dist/native/window-surface-store.js +3 -3
  81. package/dist/native/windows-extractor-build.d.ts +6 -16
  82. package/dist/native/windows-extractor-build.js +11 -14
  83. package/dist/release/feed-release-cut.d.ts +2 -6
  84. package/dist/release/feed-release-cut.js +5 -93
  85. package/dist/release/feed-state.js +1 -5
  86. package/dist/release/github-release-cut.js +5 -66
  87. package/dist/release/github-release-provenance.d.ts +2 -0
  88. package/dist/release/github-release-provenance.js +4 -7
  89. package/dist/release/github-release-publisher.js +2 -2
  90. package/dist/release/github-release-qualification.js +3 -3
  91. package/dist/release/local-release.d.ts +3 -3
  92. package/dist/release/local-release.js +12 -23
  93. package/dist/release/qualification-run.js +1 -1
  94. package/dist/release/release-assets-plan.js +1 -1
  95. package/dist/release/release-config.d.ts +7 -15
  96. package/dist/release/release-config.js +25 -29
  97. package/dist/release/release-cut-command.d.ts +1 -1
  98. package/dist/release/release-cut-command.js +1 -1
  99. package/dist/release/release-cut.d.ts +5 -32
  100. package/dist/release/release-cut.js +9 -55
  101. package/dist/release/release-descriptor-staging.js +3 -8
  102. package/dist/release/release-promotion.js +2 -1
  103. package/dist/release/release-publish-command.js +5 -15
  104. package/dist/release/release-qualification.js +1 -1
  105. package/dist/shared/bounded-body.d.ts +33 -0
  106. package/dist/shared/bounded-body.js +102 -0
  107. package/dist/shared/file-system.d.ts +12 -0
  108. package/dist/shared/file-system.js +40 -0
  109. package/dist/shell/app-shell.js +29 -14
  110. package/dist/shell/app-utilities.d.ts +4 -1
  111. package/dist/shell/app-utilities.js +5 -1
  112. package/dist/shell/application-menu.d.ts +1 -1
  113. package/dist/shell/application-menu.js +7 -3
  114. package/dist/shell/poll.d.ts +27 -0
  115. package/dist/shell/poll.js +88 -0
  116. package/dist/update-helper.bundle.js +268 -144
  117. package/dist/updates/channel-update-manager.js +0 -1
  118. package/dist/updates/desktop-updater.d.ts +9 -0
  119. package/dist/updates/desktop-updater.js +103 -50
  120. package/dist/updates/feed/release-feed.d.ts +7 -4
  121. package/dist/updates/feed/release-feed.js +3 -7
  122. package/dist/updates/feed/release-location.js +6 -26
  123. package/dist/updates/feed/release-version.d.ts +7 -2
  124. package/dist/updates/feed/release-version.js +9 -2
  125. package/dist/updates/feed/signed-release.d.ts +1 -1
  126. package/dist/updates/feed/signed-release.js +2 -2
  127. package/dist/updates/feed/update-discovery.js +2 -6
  128. package/dist/updates/helper/launch-gate-recovery.js +28 -78
  129. package/dist/updates/helper/resume-staging.d.ts +14 -3
  130. package/dist/updates/helper/resume-staging.js +23 -37
  131. package/dist/updates/helper/update-helper.d.ts +6 -2
  132. package/dist/updates/helper/update-helper.js +38 -33
  133. package/dist/updates/helper/update-resume.js +9 -6
  134. package/dist/updates/install/update-extraction.js +28 -8
  135. package/dist/updates/install/update-handoff-plan.d.ts +0 -1
  136. package/dist/updates/install/update-handoff-plan.js +3 -4
  137. package/dist/updates/install/update-swap-stage.js +1 -6
  138. package/dist/updates/install/update-swap.d.ts +5 -2
  139. package/dist/updates/install/update-swap.js +193 -72
  140. package/dist/updates/launch/helper-exit-wait.d.ts +6 -0
  141. package/dist/updates/launch/helper-exit-wait.js +18 -0
  142. package/dist/updates/launch/packaged-update-startup.js +8 -6
  143. package/dist/updates/launch/update-launch-gate.js +7 -14
  144. package/dist/updates/locks/stable-file.js +4 -1
  145. package/dist/updates/locks/update-helper-presence.d.ts +12 -0
  146. package/dist/updates/locks/update-helper-presence.js +27 -0
  147. package/dist/updates/retention/retention-cleanup.js +10 -9
  148. package/dist/updates/retention/retention-maintenance.d.ts +40 -0
  149. package/dist/updates/retention/retention-maintenance.js +95 -0
  150. package/dist/updates/retention/retention-prune-progress.js +4 -5
  151. package/dist/updates/retention/retirement-inventory.d.ts +13 -0
  152. package/dist/updates/retention/retirement-inventory.js +39 -31
  153. package/dist/updates/retention/retirement-records.d.ts +1 -4
  154. package/dist/updates/retention/retirement-records.js +18 -32
  155. package/dist/updates/retention/update-retention-marker.d.ts +4 -0
  156. package/dist/updates/retention/update-retention-marker.js +9 -14
  157. package/dist/updates/retention/update-retirement.d.ts +12 -0
  158. package/dist/updates/retention/update-retirement.js +59 -31
  159. package/dist/updates/update-adapter.d.ts +1 -23
  160. package/dist/updates/update-adapter.js +31 -24
  161. package/dist/updates/update-channel-store.d.ts +2 -1
  162. package/dist/updates/update-channel-store.js +6 -4
  163. package/dist/updates/update-manager.js +2 -2
  164. package/dist/updates/update-services.d.ts +1 -1
  165. package/dist/updates/update-services.js +9 -4
  166. package/dist/updates/update-state-store.d.ts +0 -2
  167. package/dist/updates/update-state-store.js +5 -12
  168. package/dist/updates/update-state.d.ts +6 -10
  169. package/dist/updates/update-state.js +1 -1
  170. package/dist/views/app-help.d.ts +1 -1
  171. package/dist/views/app-help.js +1 -3
  172. package/dist/views/appearance-surface.js +15 -8
  173. package/dist/views/update-surface.d.ts +1 -3
  174. package/dist/views/update-surface.js +2 -2
  175. package/package.json +20 -18
  176. package/src/app/application.tsx +13 -6
  177. package/src/appearance/appearance-host.tsx +17 -7
  178. package/src/appearance/appearance-preferences.ts +0 -1
  179. package/src/appearance/custom-theme-import.ts +99 -26
  180. package/src/appearance/custom-theme-library.ts +3 -2
  181. package/src/appearance/theme-file-importer.ts +3 -2
  182. package/src/appearance/theme-library-mutation.ts +20 -8
  183. package/src/appearance/theme-library-schema.ts +7 -0
  184. package/src/appearance/theme-library-store.ts +41 -26
  185. package/src/desktop/client-assets.ts +27 -12
  186. package/src/shell/app-shell.tsx +33 -13
  187. package/src/shell/app-utilities.tsx +10 -1
  188. package/src/shell/poll.ts +125 -0
  189. package/src/updates/feed/release-version.ts +11 -3
  190. package/src/updates/update-adapter.ts +27 -44
  191. package/src/updates/update-state.ts +7 -13
  192. package/src/views/app-help.tsx +1 -1
  193. package/src/views/appearance-surface.tsx +36 -8
  194. package/src/views/update-surface.tsx +0 -4
  195. package/templates/application/.github/workflows/release-assets.yml +2 -2
  196. package/templates/application/README.md +3 -3
  197. package/dist/native/cef-helper-download.d.ts +0 -1
  198. package/dist/native/cef-helper-download.js +0 -35
  199. 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 { VERSION, cleanupMarkerMatches, ensureClaim, ensureCleanupMarker, healthReceiptFor, healthReceiptMatches, isMatchingHealthTemporary, matchesInstalledTree, matchesOldTree, matchesOwnedTree, ownerFor, ownerMatches, pathInfo, readCleanupMarker, readHealthReceipt, readOwner, updateRetirementPaths, validRetirementContainer } from "./retirement-records.js";
6
- import { lstat, mkdir, readdir, rm, rmdir, unlink, writeFile } from "node:fs/promises";
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" || !VERSION.test(token.version)) return false;
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 matchesInstalledTree(target, owner);
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) && await matchesInstalledTree(target, owner) && await matchesOwnedTree(paths.tree, owner);
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 known = /* @__PURE__ */ new Set([
77
- "candidate",
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 = new RegExp(`^\\.state-${generation}-[0-9a-f-]{36}\\.tmp$`, "i");
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 rm(join(staging, "request.json"), { force: true });
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 (claimInfo && (!expectedOwner || !await ownerMatches(await readOwner(paths.claim), expectedOwner))) return false;
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 || !await ownerMatches(await readOwner(paths.claim), owner) || !await matchesInstalledTree(target, owner) || await pathInfo(join(staging, "candidate")) || !await matchesOldTree(paths.tree, state)) return false;
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 NativeUpdateSnapshotOf, type NativeUpdateState } from './update-state';
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
- if (!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");
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, nativeUpdateAdapter, parseDesktopUpdateStatus, updateChannelStore, updateStateFromNative };
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' | 'dev';
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
- if (!sameFile(before, after) || typeof value !== "object" || value === null || Array.isArray(value) || Object.keys(value).length !== 1 || !isUpdateChannel(value.channel)) throw new Error("Invalid update channel file");
37
- return value.channel;
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 === "pre-release" ? "daily" : 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 (!/^\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(options.currentVersion) || options.currentVersion.length > 64 || !Number.isSafeInteger(options.maxBytes) || options.maxBytes < 1 || typeof options.stage !== "function") throw new Error("Invalid update manager configuration");
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 { isUpdateChannel } from "./feed/release-version.js";
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 { channel } = record(value, ["channel"]);
15
- if (!isUpdateChannel(channel)) throw new Error("Invalid input");
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)) || typeof record.version !== "string" || !/^\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(record.version) || typeof record.previousVersion !== "string" || !/^\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(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) => ![
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 syncUpdateStageDirectory(staging);
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, syncUpdateStageDirectory, withUpdateLock, writeUpdateStageState, writeUpdateStageStateDurably };
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, Url extends string | null = string>(update: NativeUpdateSnapshotOf<Phase, Url>, options?: {
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: Url;
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 ?? null,
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,
@@ -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 * from '../shell/help-shortcuts';
3
+ export type { HelpLink, HelpShortcut };
4
4
  export type ApplicationHelpProps = {
5
5
  open: boolean;
6
6
  onClose(): void;
@@ -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, DEFAULT_SETTINGS_KEYSHORTCUTS, detectShortcutPlatform, resolveShortcutPlatform, settingsShortcutLabel, shortcutModifierKey, standardShortcuts };
41
+ export { ApplicationHelp };
@@ -1,7 +1,6 @@
1
1
  import { preferencesFromSelection } from "../appearance/appearance-preferences.js";
2
- import { readCustomThemeLibrary, subscribeCustomThemes } from "../appearance/theme-library-store.js";
3
- import { removeCustomThemeAtomically } from "../appearance/theme-library-mutation.js";
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 = editor.draft().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(readCustomThemeLibrary(defaultPreferenceStorage()))));
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 appearanceThemeForPreview(miniatures().light, editor.draft().accent, editor.draft());
230
+ return lightPreview();
224
231
  },
225
232
  get darkTheme() {
226
- return appearanceThemeForPreview(miniatures().dark, editor.draft().accent, editor.draft());
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 ChannelControlActions, type UpdateAdapter, type UpdateChannel, type UpdateState } from '@adea-ai/ui/components/composites/update-dialog';
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 { UPDATE_PENDING_PHASES, UPDATE_PHASES, browserUpdateAdapter, desktopUpdateAdapter, desktopUpdateChannelService, isUpdatePending, isUpdatePhase, mirrorUpdateState, nativeUpdateAdapter, parseDesktopUpdateStatus, updateChannelStore, updateStateFromNative } from "../updates/update-adapter.js";
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, UPDATE_PENDING_PHASES, UPDATE_PHASES, browserUpdateAdapter, desktopUpdateAdapter, desktopUpdateChannelService, isUpdatePending, isUpdatePhase, mirrorUpdateState, nativeUpdateAdapter, parseDesktopUpdateStatus, updateChannelStore, updateStateFromNative };
64
+ export { ApplicationUpdateSurface };