@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
package/README.md CHANGED
@@ -4,8 +4,21 @@ Reusable application framework for Adea and Cortana. It provides the shared
4
4
  application shell and appearance surfaces, an Electrobun desktop host and
5
5
  service bridge, application generation, packaging, updater, and release tools.
6
6
  Each consuming app supplies its identity, navigation, views, services, and
7
- application-specific security policy. The [framework contract](docs/framework-contract.md)
8
- defines that ownership split and the acceptance gates.
7
+ application-specific security policy. The [framework docs](https://adea.dev/docs/reference/app-framework/) cover that
8
+ ownership split, the acceptance gates and the update design.
9
+
10
+ ## Contents
11
+
12
+ - [Serving the client](#serving-the-client)
13
+ - [Update state and release versions](#update-state-and-release-versions)
14
+ - [Package entry points](#package-entry-points)
15
+ - [Shared application shell](#shared-application-shell)
16
+ - [Desktop bridge and host](#desktop-bridge-and-host)
17
+ - [Releases](#releases)
18
+ - [Publishing the framework](#publishing-the-framework)
19
+ - [Native modules](#native-modules)
20
+
21
+ ## Serving the client
9
22
 
10
23
  `serveClient(request, { root, deniedPaths, transformHtml, streamAssets })` serves a local SPA,
11
24
  rejects paths that escape its root, and lets the app exclude asset trees and
@@ -14,6 +27,20 @@ start an HTTP server; the host application owns both. HEAD responses contain no
14
27
  body and report the representation's byte length. HTML transforms still run for
15
28
  HEAD requests so their resulting length can be reported.
16
29
 
30
+ A missing path falls back to `index.html` unless it names a built asset: a
31
+ `.js`, `.mjs`, `.css`, `.map`, `.woff2` or `.wasm` file, or any path under `/assets`
32
+ or under a prefix listed in `assetPrefixes` (for example `['/start-assets']`). Those
33
+ answer 404, so a stale chunk after an update fails as a missing module instead of a
34
+ MIME error on HTML.
35
+
36
+ `@adea-ai/app-framework/bounded-body` reads request and response bodies with a byte
37
+ bound: `readBoundedBytes`, `readBoundedText` and `readBoundedJson(source, limit,
38
+ { signal, allowEmpty })`. A Content-Length above the bound is refused before any byte
39
+ is read, the streamed bytes are bounded whatever the claim says, and an abort (a
40
+ request's own signal by default) settles a stalled read at once. A refusal is a
41
+ `BoundedBodyError` whose `reason` (`too-large`, `aborted`, `invalid`, `missing`)
42
+ `boundedBodyStatus` maps to 413, 408 or 400.
43
+
17
44
  Responses are buffered snapshots by default. Set `streamAssets: true` for an
18
45
  immutable asset root, or `streamClientAssets: true` on `startDesktopHost`; streamed
19
46
  bodies are not snapshots and read errors can surface after response headers are sent.
@@ -21,8 +48,9 @@ A streamed body opens its file on the first read, not when the response is creat
21
48
  and closes it at end of file, on cancellation, on a read error, and when the host
22
49
  stops (`server.stop(true)` cancels open bodies; a retained-lease host drains them
23
50
  before releasing its lease). A client that stops reading without closing the
24
- connection is bounded by the server's 10 s idle timeout, which cancels the body and
25
- closes the file, so open asset files never exceed open asset connections. The host
51
+ connection is bounded by the server's idle timeout (`idleTimeoutSeconds`, default
52
+ 10 s), which cancels the body and closes the file, so open asset files never exceed
53
+ open asset connections. The host
26
54
  also admits at most `maxOpenClientAssetFiles` (default 32) open asset files; later
27
55
  readers wait in order without a descriptor, and a waiting reader that is cancelled
28
56
  leaves the queue. Streamed read buffers are therefore bounded by that limit times one 64 KiB
@@ -38,12 +66,15 @@ root while it is served.
38
66
  `adea-ai/adea` at commit `6155d18941acbb14d9099bc2a33a50ee9683a068`,
39
67
  `apps/desktop/shell/src/client-assets.ts` (Apache-2.0).
40
68
 
69
+ ## Update state and release versions
70
+
41
71
  `toUpdateState` maps native update snapshots to the published UI update-dialog
42
72
  contract. Applications retain ownership of updater trust, confirmation, and
43
73
  whether release notes are shown.
44
74
 
45
- `release-version` retains Adea's existing channel validation and orders update
46
- versions by semver on every channel. It was adapted from
75
+ `release-version` validates the `stable` and `pre-release` update channels
76
+ (`readUpdateChannel` also reads a retired `dev` value as `pre-release`) and orders
77
+ update versions by semver on every channel. It was adapted from
47
78
  `apps/desktop/shell/src/updates.ts` in `adea-ai/adea` at commit
48
79
  `6155d18941acbb14d9099bc2a33a50ee9683a068` (Apache-2.0). Shared release,
49
80
  platform packaging, and signed-update modules are documented below; application
@@ -75,18 +106,23 @@ TypeScript source alone, and the rest resolve to `dist`. The package ships only
75
106
  the source those entries reach, plus the Electrobun patches in `src/native`; a
76
107
  test checks the file list against the exports.
77
108
 
78
- | Area | Subpaths (`@adea-ai/app-framework/<subpath>`) |
79
- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
80
- | Application and shell | `application`, `app-shell`, `app-utilities`, `app-settings`, `app-help`, `app-about`, `update-surface` (all _solid_), `service-registry`, `application-menu`, `application-command-client` |
81
- | Appearance | `appearance-host`, `appearance-preferences`, `appearance-surface`, `custom-theme-library`, `window-surface` (all _solid_) |
82
- | Desktop host | `desktop-host`, `desktop-gateway`, `desktop-client`, `desktop-detection`, `desktop-stream`, `channel-handshake`, `channel-proof`, `loopback-policy`, `open-url-channel`, `client-asset-manifest`, `client-assets` (source only), `client-dev-proxy` |
83
- | Native windows and OS | `renderer-profile`, `secure-window`, `partitioned-window`, `window-options` (source only), `native-utilities`, `native-secret-store`, `app-bundle`, `sidecar`, `sidecar-services`, `desktop-build-hook`, `desktop-build`, `windows-runtime-patch`, `electrobun-types` (ambient types only) |
84
- | Native installers | `windows-extractor-build`, `installer-archive`, `window-surface-store` |
85
- | Updates | `desktop-updater`, `update-manager`, `update-inherited-launch-lease`, `packaged-launch-admission`, `packaged-update-startup`, `update-resume`, `channel-update-manager`, `update-channel-store`, `update-discovery`, `update-download`, `update-extraction`, `signed-release`, `release-feed`, `release-location`, `update-process-liveness`, `update-adapter` (_solid_), `release-version` (_solid_), `update-state` (source only), `update-helper.js` (bundled helper) |
86
- | Release tooling | `release-config`, `release-cut`, `release-steps`, `release-staging`, `release-artifact`, `release-assets-plan`, `release-descriptor-staging`, `release-publication`, `release-publish-command`, `release-promotion`, `retained-release-build`, `github-release-publisher`, `github-release-qualification`, `github-release-promotion`, `macos-dmg` |
87
- | Installer qualification | `installer-layout`, `installer-identity`, `installer-extraction`, `installed-payload`, `installer-observation`, `installer-qualification-command`, `installer-renderer-evidence` |
88
- | Developer app | `developer-app` |
89
- | CI | `toolchain-identity` |
109
+ Importing a module only declares things, so the package sets `"sideEffects": false`
110
+ and a bundler drops every module whose exports go unused. In Cortana's web build,
111
+ that takes 4.9 KB off the initial JavaScript and 24 KB off the whole graph. A test
112
+ fails if a library module gains a top-level statement.
113
+
114
+ | Area | Subpaths (`@adea-ai/app-framework/<subpath>`) |
115
+ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
116
+ | Application and shell | `application`, `app-shell`, `app-utilities`, `media-query`, `poll`, `app-settings`, `app-help`, `app-about`, `update-surface` (all _solid_), `service-registry`, `application-menu`, `application-command-client` |
117
+ | Appearance | `appearance-host`, `appearance-preferences`, `appearance-surface`, `custom-theme-library`, `window-surface` (all _solid_) |
118
+ | Desktop host | `desktop-host`, `desktop-gateway`, `desktop-client`, `desktop-detection`, `desktop-stream`, `channel-handshake`, `channel-proof`, `loopback-policy`, `bounded-body`, `open-url-channel`, `client-asset-manifest`, `client-assets` (source only), `client-dev-proxy` |
119
+ | Native windows and OS | `renderer-profile`, `secure-window`, `partitioned-window`, `window-options` (source only), `native-utilities`, `native-secret-store`, `app-bundle`, `sidecar`, `sidecar-services`, `desktop-build-hook`, `desktop-build`, `electrobun-types` (ambient types only) |
120
+ | Native installers | `windows-extractor-build`, `installer-archive`, `window-surface-store` |
121
+ | Updates | `desktop-updater`, `update-manager`, `update-inherited-launch-lease`, `packaged-launch-admission`, `packaged-update-startup`, `update-resume`, `channel-update-manager`, `update-channel-store`, `update-discovery`, `update-download`, `update-extraction`, `signed-release`, `release-feed`, `update-adapter` (_solid_), `release-version` (_solid_), `update-state` (source only), `update-helper.js` (bundled helper) |
122
+ | Release tooling | `release-config`, `release-cut`, `release-steps`, `release-staging`, `release-artifact`, `release-assets-plan`, `release-descriptor-staging`, `release-publication`, `release-publish-command`, `release-promotion`, `retained-release-build`, `github-release-publisher`, `github-release-qualification`, `github-release-promotion`, `macos-dmg` |
123
+ | Installer qualification | `installer-layout`, `installer-identity`, `installer-extraction`, `installed-payload`, `installer-observation`, `installer-qualification-command`, `installer-renderer-evidence` |
124
+ | Developer app | `developer-app` |
125
+ | CI | `toolchain-identity` |
90
126
 
91
127
  Commands (package `bin` entries):
92
128
 
@@ -120,6 +156,9 @@ navigation callback and view content. Optional slots provide workspace and
120
156
  history controls, search, toolbar actions, rail footer and status content.
121
157
  The host controls sidebar state and persisted width; the shell restores focus
122
158
  after the narrow-screen sidebar closes and handles the advertised search chord.
159
+ The sidebar's `content`, `header` and `footer` re-render only when the host passes
160
+ a different function, so define them once rather than inline in the sidebar object:
161
+ then resizing or toggling the sidebar keeps its content and state.
123
162
  The narrow-screen drawer loads the first time the window is narrow, so a wide
124
163
  window never loads its dialog code.
125
164
  Without a host drawer, the contextual sidebar uses its shared mobile sheet at
@@ -164,6 +203,16 @@ its own appearance surface; Adea's existing preview, cancellation, imported
164
203
  theme library and V2 preference behavior are available through the appearance
165
204
  provider and editor described below.
166
205
 
206
+ `app-utilities` and the lean `poll` entry export `createPoll({ intervalMs, run,
207
+ visibleOnly, immediate, enabled, onError })`, a polling loop owned by the current reactive scope. Ticks never
208
+ overlap; the interval runs from one tick settling to the next starting. A hidden
209
+ document holds no timer and runs at once when shown if a tick is due. `enabled` is a
210
+ reactive switch, and disposal clears the timer and aborts the tick in flight through
211
+ the `AbortSignal` passed to `run`. For "latest answer wins" actions use
212
+ `createLatestAction` from `@adea-ai/ui`.
213
+ `createMediaQuery` is also its own `media-query` entry. Code that needs only these
214
+ primitives should import the lean entries, which carry no shell, menu or dialog code.
215
+
167
216
  `ApplicationSettings` is the shared settings dialog: grouped section navigation
168
217
  that becomes a horizontal strip on narrow windows, beside the selected panel.
169
218
  Pass `utilities.settings.sections` (validated by `defineSettingsSections`); the
@@ -178,7 +227,8 @@ surfaces. Apps that already supply `onSettings` or `onHelp` keep their own
178
227
  surfaces.
179
228
 
180
229
  `utilities.accountMenu` adjusts the account menu without replacing it: `label`
181
- (default `Application settings`), `busy` for an in-flight sign-in or sign-out,
230
+ (default `Application settings`), `avatarSrc` (a profile photo drawn on the
231
+ trigger in place of the user glyph), `busy` for an in-flight sign-in or sign-out,
182
232
  `onIntent` (hover or focus, for prefetching), `settingsShortcut` and
183
233
  `settingsKeyshortcuts` for the Settings row, `appearance: false` to hide the
184
234
  Appearance item, and `updates: 'always'` to keep Updates visible and enabled on
@@ -204,9 +254,11 @@ menu, each as its own module to load with `lazy()`: `app-about`
204
254
  `channelLabels` and `channelDescriptions`, and `onUpdateState` to mirror every
205
255
  updater snapshot into a pending-update badge without a second checker.
206
256
  `update-adapter` holds the dependency-free helpers for boot code:
207
- `nativeUpdateAdapter` bridges a snake_case native updater, `mirrorUpdateState`
208
- wraps an adapter, `updateChannelStore` normalizes either channel shape and
209
- `browserUpdateAdapter` describes a build without an installer.
257
+ `desktopUpdateAdapter` bridges the framework's `desktop_update_*` services,
258
+ `mirrorUpdateState` wraps an adapter, `updateChannelStore` normalizes either
259
+ channel shape and `browserUpdateAdapter` describes a build without an installer.
260
+ `update-surface` exports only the surface; import these helpers from
261
+ `update-adapter`.
210
262
 
211
263
  Modules that hold shared state (`window-surface`, `custom-theme-library`,
212
264
  `appearance-preferences`) are exported with the same `solid`
@@ -261,6 +313,8 @@ channel acquisition. Server revocation is not locally observable until a request
261
313
  or transport event reveals it. The generated app and ordinary `reconnect()` do not
262
314
  use this opt-in API and do not automatically recover from expiry or a transient close.
263
315
 
316
+ ### Application definition and loopback policy
317
+
264
318
  `defineApplication` validates an app's identity, storage key, unique view IDs,
265
319
  initial view, labels and render functions. `Application` mounts those views in
266
320
  the shared shell and utilities, with local navigation by default or a supplied
@@ -279,6 +333,8 @@ invoke services. The Electrobun host authenticates its native window channel
279
333
  before dispatching privileged services; service authorization and resource
280
334
  policy remain application-owned.
281
335
 
336
+ ### Appearance
337
+
282
338
  `appearance-preferences` exposes Adea's V2 appearance codec, persistence, and
283
339
  first-paint script. The codec stores the `appearance` document and quarantines
284
340
  unreadable or newer records before replacing them. Pass
@@ -296,13 +352,18 @@ shared origin-wide IndexedDB database while they update the readable version-1
296
352
  library record. They also use Web Locks when available. The IndexedDB transaction
297
353
  coordinates separate WebViews even when their Web Lock managers are not shared;
298
354
  durable operations fail closed when IndexedDB is unavailable. These locks cannot
299
- coordinate older builds or consumers that write the storage key through the
300
- legacy synchronous `setCustomThemes`, `removeCustomTheme`, or
301
- `importCustomTheme` API. The synchronous setter and remover are retained for
302
- in-memory callers, but now fail closed when passed storage; the synchronous import
303
- helper has been removed. Use the asynchronous mutation APIs for durable changes.
304
- Older already-loaded builds can still write the version-1 key without the lock and
305
- are not coordinated by this build.
355
+ coordinate older builds that write the storage key through the removed synchronous
356
+ `setCustomThemes`, `removeCustomTheme` or `importCustomTheme` APIs. Use the
357
+ asynchronous mutation APIs, `mutateCustomThemeLibrary` and
358
+ `removeCustomThemeAtomically`. Older already-loaded builds can still write the
359
+ version-1 key without the lock and are not coordinated by this build.
360
+
361
+ An unreadable library never blocks these operations. Its exact bytes are captured
362
+ in `CUSTOM_THEME_LIBRARY_RECOVERY_KEY` (a different earlier capture moves to the
363
+ one `CUSTOM_THEME_LIBRARY_PREVIOUS_RECOVERY_KEY` slot), the readable themes are
364
+ kept, and the committed result carries `recovered: 'corrupt_json' |
365
+ 'unsupported_record'`; show `CUSTOM_THEME_LIBRARY_RECOVERED` for it. Only storage
366
+ refusing that capture fails the operation, with `recovery_unavailable`.
306
367
 
307
368
  `appearance-host` supplies the V2 appearance provider and context, including
308
369
  imported variants, draft previews, native translucency capability, and a
@@ -318,6 +379,8 @@ appearance slot. Desktop hosts can register a native surface mirror through
318
379
  `window-surface`. The host remains responsible for implementing the native
319
380
  window operation.
320
381
 
382
+ ## Desktop bridge and host
383
+
321
384
  `channel-proof` verifies the existing signed invoke proof over a channel,
322
385
  credential, timestamp, nonce and exact body. It checks the host's current
323
386
  channel lookup on every call and rejects replays and forged proofs. This is
@@ -327,6 +390,10 @@ and recheck authorization and channel lifetime after asynchronous work. The
327
390
  legacy proof does not bind an HTTP method or path: routes sharing that proof
328
391
  context must share one replay verifier and enforce their own request routing.
329
392
  The host must preserve the exact UTF-8 body bytes used to produce the proof.
393
+ A nonce is held only for the 30 s timestamp window in which it could be replayed,
394
+ up to `maxNonces` (default 16,384, about 540 requests a second). A full cache
395
+ refuses with `capacity`, which the gateway answers as 429 so the caller keeps its
396
+ channel.
330
397
 
331
398
  `channel-handshake` creates expiring, single-use bootstrap capabilities and
332
399
  channel credentials and supports revocation. The host must deliver bootstrap
@@ -415,6 +482,8 @@ closed, closing the window, unless the window's single view reports the
415
482
  requested partition. Without a partition it is a plain constructor call, and it
416
483
  can wrap the `construct` callback given to `desktop-host`.
417
484
 
485
+ ## Releases
486
+
418
487
  `adea-desktop-release daily|stable` is the provider-neutral desktop release
419
488
  driver for GitLab release tag pipelines (and any checkout of a tagged main
420
489
  commit). It uses the local release mode, so provenance comes from git (the tag
@@ -430,6 +499,8 @@ qualified daily after the soak. Apps add their own files through the optional
430
499
  releases only this way can leave `releaseWorkflows` out of
431
500
  `release-config.json`; the GitHub-hosted release commands then refuse to run.
432
501
 
502
+ ### Generating an app
503
+
433
504
  The `create-adea-app` command generates a new application
434
505
  from an identity, framework package specifier and renderer choice. The starter
435
506
  provides the shared shell, appearance, one view and one desktop service. The
@@ -461,6 +532,8 @@ Run `bun run test:generated` for an isolated packed-consumer web
461
532
  build and browser check; `bun scripts/test-generated.ts --desktop` additionally
462
533
  builds the native bundle for the current platform.
463
534
 
535
+ ### Signed releases and artifacts
536
+
464
537
  `signed-release` provides a separate version 2 Ed25519 descriptor that binds
465
538
  application, repository, channel, version, source and workflow commits, run,
466
539
  platform, architecture, asset URL, size and digest. The verifier requires a
@@ -480,6 +553,8 @@ and metadata changes while reading but cannot prevent later replacement.
480
553
  Provide the key through the CI secret store and restrict signing to trusted
481
554
  release jobs. The command does not publish the artifact.
482
555
 
556
+ ### Electrobun and CEF hardening
557
+
483
558
  The CEF profile suppresses Electrobun's insecure web-security and remote-debug
484
559
  defaults. The pinned Electrobun 2.0.5 Windows system-webview implementation
485
560
  hardcodes `--disable-web-security`; its `chromiumFlags` configuration does not
@@ -518,6 +593,8 @@ file replacements atomic. If a replacement fails, the build stops before
518
593
  signing; rebuild the output tree before retrying because earlier helpers may
519
594
  already have been replaced.
520
595
 
596
+ ### Publication
597
+
521
598
  `release-publication` validates installer receipts and signed discovery
522
599
  descriptors against the exact staged payloads before publication. It refuses
523
600
  asset replacement, rechecks source and workflow provenance, uploads the
@@ -528,6 +605,8 @@ concurrent changes, configure trusted keys and run the installer and completed
528
605
  workflow qualification checks before promotion. This does not create releases,
529
606
  configure schedules, install artifacts or promote stable releases.
530
607
 
608
+ ### Windows (experimental)
609
+
531
610
  The experimental Windows SDK lane checks out Electrobun 2.0.5 at its exact
532
611
  source commit, verifies the native wrapper source digest, removes the upstream
533
612
  WebView2 arguments that disable browser security, and builds a replacement from
@@ -555,6 +634,8 @@ runs its native shortcut tests. Apps that ship the patched extractor build it
555
634
  from that source and point `HUTCH_ELECTROBUN_DEVKIT_ROOT` at a copy of the
556
635
  pinned devkit that contains it.
557
636
 
637
+ ### Promotion
638
+
558
639
  `release-promotion` implements the daily-to-stable selection policy with a
559
640
  configurable soak (96 hours by default), a hold switch and qualification of
560
641
  every candidate. It delegates release listing, exact-run qualification and
@@ -583,10 +664,9 @@ For example, a promotion configuration can name the app's actual assets:
583
664
  "windows-x64": ["Example-{tag}-windows-x64-Setup.zip"],
584
665
  "linux-x64": ["Example-{tag}-linux-x64-Setup.tar.gz"]
585
666
  },
586
- "releaseAssets": ["daily.json", "stable.json", "dev.json"],
667
+ "releaseAssets": ["daily.json", "stable.json"],
587
668
  "dailyDiscoveryAssets": ["daily.json"],
588
- "stableDiscoveryAssets": ["stable.json"],
589
- "devDiscoveryAssets": ["dev.json"]
669
+ "stableDiscoveryAssets": ["stable.json"]
590
670
  }
591
671
  ```
592
672
 
@@ -601,9 +681,11 @@ security flags. It does not extract or execute an installer; callers must
601
681
  validate archive link targets and entry types, test the installed application,
602
682
  and collect the native renderer evidence before qualifying a release.
603
683
 
604
- `adea-cut-release daily|dev path/to/config.json` selects an immutable source
605
- and creates or repairs a prerelease from a trusted `main` GitHub Actions
606
- workflow. The configuration also supplies `appName` and `releaseWorkflows`,
684
+ ### Cutting a release
685
+
686
+ `adea-cut-release daily path/to/config.json` checks the Release Please daily of
687
+ the source version and repairs or dispatches its build from a trusted `main`
688
+ GitHub Actions workflow. The configuration also supplies `appName` and `releaseWorkflows`,
607
689
  the caller workflow files whose runs carry release provenance:
608
690
 
609
691
  ```json
@@ -628,9 +710,12 @@ and every release carries that version:
628
710
  The framework resolves the tag's exact commit and requires the manifest at
629
711
  that commit to match the tag before building, publishing or qualifying it.
630
712
  - There are no dev releases. Development runs the developer app from the checkout
631
- (see "Developer app"); `adea-cut-release dev` is refused. Existing `-dev.N`
632
- versions still parse and sort below the release they lead to, so an old dev
633
- install can still read the feed.
713
+ (see "Developer app"). Release tooling accepts only `vX.Y.Z` tags. Existing
714
+ `-dev.N` versions still parse and sort below the release they lead to, so an
715
+ old dev install can still read the feed. `dev` is no longer an update channel:
716
+ a saved `dev` channel file and a `dev` argument to `parseUpdateChannel` (sent by
717
+ older channel pickers) read as pre-release, and nothing writes `dev` again.
718
+ Old ledger entries for dev builds are read and ignored.
634
719
 
635
720
  Calendar-tagged releases (`v2026.10.31-dev.1525`) from before
636
721
  Release Please sort above every version and are never chosen as an upgrade
@@ -678,9 +763,11 @@ resolve from the file's folder):
678
763
  }
679
764
  ```
680
765
 
681
- - `adea-developer-app run` runs any `prepare` commands, starts the UI dev server,
682
- waits for it, then runs `electrobun dev` with `ADEA_DEVELOPER_APP=1` and
683
- `ADEA_CLIENT_DEV_URL` set. Shell source edits (`watch`) restart the shell.
766
+ - `adea-developer-app run` runs any `prepare` commands, then starts the UI dev server
767
+ and `electrobun dev` together, with `ADEA_DEVELOPER_APP=1` and `ADEA_CLIENT_DEV_URL`
768
+ set, so the shell build overlaps the dev server's startup and first compile (`warm`
769
+ paths are fetched as soon as it answers). Until it answers, the window shows a page
770
+ that reloads itself every second. Shell source edits (`watch`) restart the shell.
684
771
  - `adea-developer-app install` adds "<Name> (Dev).app" to `/Applications`
685
772
  (`ADEA_DEVELOPER_APP_DIR` overrides): a launcher that runs `run` from the checkout
686
773
  in a login shell and logs to `~/Library/Logs/<Name> (Dev).log`. Pass
@@ -708,7 +795,8 @@ fragment) and the app's key prefix. Keys are relative to `base`:
708
795
  - `<app>/<tag>/release.json`: `{ tag, channel, publishedAt, assets: [{ name, size, sha256 }] }`;
709
796
  - `<app>/index.json`: the ledger `{ schema: 1, app, releases: [{ tag, kind, version, sourceSha, publishedAt }] }`,
710
797
  newest first and at most 500 entries; stable entries add `promotedAt`;
711
- - `<app>/channels/<dev|daily|stable>.json`: a copy of the newest release.json on that channel.
798
+ - `<app>/channels/<daily|stable>.json`: a copy of the newest release.json on that channel
799
+ (feeds from before dev releases were removed may also hold `dev.json`).
712
800
 
713
801
  The updater reads the channel pointer, downloads the listed descriptor from the
714
802
  same release, checks its bytes against release.json, verifies its signature and
@@ -738,7 +826,7 @@ promotion and platform additions. If the feed changes before a plan is applied,
738
826
  discard that plan and stage a fresh one; uploading stale plans can replace a
739
827
  newer release inventory or channel pointer.
740
828
 
741
- - `adea-cut-release --local dev|daily <config> <sha>` prints the tag and
829
+ - `adea-cut-release --local daily <config> <sha>` prints the tag and
742
830
  `dispatched` when this machine's platform still has to be built.
743
831
  - `adea-release-step stage-build <platform> <dir>` (with `RELEASE_TAG`) stages
744
832
  the build; installer qualification needs a hosted runner and is skipped.
@@ -860,7 +948,7 @@ on:
860
948
  schedule: [{ cron: '23 12 * * *' }] # daily cadence; '23 */4 * * *' runs every 4 hours
861
949
  workflow_dispatch:
862
950
  inputs:
863
- operation: { type: choice, options: [dev, daily, stable], required: true }
951
+ operation: { type: choice, options: [daily, stable], required: true }
864
952
  permissions: {}
865
953
  concurrency:
866
954
  group: desktop-release-control-${{ github.repository }}
@@ -893,6 +981,8 @@ app's choice. Generated apps include a Release Please workflow and config.
893
981
  caller's finalize workflow, which the assets run dispatches (see above). The app's `package.json` must define the same
894
982
  `build:release` and `release:*` scripts the generated template provides.
895
983
 
984
+ ### Build hook and packed archives
985
+
896
986
  The `desktop-build-hook` module supplies an Electrobun `postBuild` hook that
897
987
  runs on the just-built bundle before release hashing, packaging and signing.
898
988
  It applies the pinned runtime patch to Windows bundles, failing closed for
@@ -914,7 +1004,7 @@ staging directory without replacing existing files. It rejects source links,
914
1004
  checks that the source remains stable while copying, and returns SHA-256 asset
915
1005
  identities. Installer execution and qualification remain separate requirements.
916
1006
 
917
- `update-download` streams a verified release from GitHub into a new private
1007
+ `update-download` streams a verified release from the release feed into a new private
918
1008
  staging directory, limits redirects and size, and checks the signed digest.
919
1009
  The caller owns cleanup and must reverify bytes immediately before installation;
920
1010
  downloading does not install an update or enforce a version policy.
@@ -931,12 +1021,14 @@ framework archive in an isolated consumer. The check copies and hashes the
931
1021
  archive before installation and verifies that both copies remain unchanged;
932
1022
  without `--archive`, it packs the current checkout first.
933
1023
 
934
- `update-discovery` resolves the app's dev, daily or stable GitHub release
935
- descriptor and authenticates it against the app's configured signing policy.
1024
+ `update-discovery` resolves the app's daily or stable channel descriptor from the
1025
+ release feed and authenticates it against the app's configured signing policy.
936
1026
  It skips releases without a descriptor, checks the signed payload against the
937
1027
  release's asset metadata, bounds responses and restricts redirects. The
938
1028
  caller still applies its version policy and invokes the verified downloader.
939
1029
 
1030
+ ### Hosted CI installer guards
1031
+
940
1032
  The internal `installer-worker-guard` module provides hosted-CI worker interception and a nonce-bound
941
1033
  permit for an installed app. A qualification runner must install and preflight
942
1034
  the guard with the packaged runtime, verify the installed bytes before granting
@@ -979,6 +1071,8 @@ the workflow's `ADEA_APP_RENDERER`. `inspect --local` is the local-release form
979
1071
  (context `local: true`). Apps point their `release:*` scripts at it; one with
980
1072
  extra payload checks calls `inspectStagedStep` and adds them.
981
1073
 
1074
+ ### Command artifacts
1075
+
982
1076
  Command artifacts are portable command-line payloads an app publishes beside its
983
1077
  desktop payloads, through the same staging, qualification, signing and immutable
984
1078
  publication. Each `commandArtifacts` entry names its own update identity, the
@@ -1042,8 +1136,7 @@ existing output. Signing and staging do not publish or qualify a release.
1042
1136
 
1043
1137
  `adea-release-step qualify-upgrade` (an app's `release:qualify-upgrade`) runs after signing
1044
1138
  on each platform and before publication. It selects the highest earlier version in the
1045
- feed ledger (the same channel, or dev before a channel's first
1046
- release), installs it with its own installer, then stages and swaps in this
1139
+ feed ledger on the daily channel, installs it with its own installer, then stages and swaps in this
1047
1140
  release's signed payload and observes the new version start under the same guard
1048
1141
  and offline policy as the installer receipt. With no earlier published release it
1049
1142
  reports that and passes. If the selected release does not advertise this platform's
@@ -1077,6 +1170,8 @@ and does not by itself prove launch, offline behavior or release qualification.
1077
1170
  It can also extract only the candidate Bun runtime for guard preflight before
1078
1171
  installer execution.
1079
1172
 
1173
+ ## Publishing the framework
1174
+
1080
1175
  The framework is published to npm as `@adea-ai/app-framework`. Build and pack
1081
1176
  the exact package (`bun run build`, `bun pm pack --ignore-scripts`, then
1082
1177
  `bun scripts/test-packed.ts --archive <tgz>`), and publish it with
@@ -1089,6 +1184,8 @@ a temporary npmrc that refers to the variable; set `NPM_CONFIG_PROVENANCE=false`
1089
1184
  outside CI. `framework-package.yml` runs the same steps from a version tag with
1090
1185
  npm trusted publishing and provenance.
1091
1186
 
1187
+ ## Native modules
1188
+
1092
1189
  `installer-observation` executes an installer only in a disposable, matching
1093
1190
  hosted runner after preflighting its bundled runtime. It verifies selected
1094
1191
  installed files before permitting startup and records the native renderer
@@ -1128,9 +1225,10 @@ signal to stop work. Providers own the semantics of individual messages and
1128
1225
  must enforce resource grants and any additional protocol limits. This transport
1129
1226
  alone does not implement Adea's Dev Runtime operations or grant model.
1130
1227
 
1131
- `update-channel-store` persists the app's stable, pre-release or dev selection
1132
- in its private state directory. A missing selection defaults to stable; invalid
1133
- or unreadable state fails rather than silently changing channels. Use
1228
+ `update-channel-store` persists the app's stable or pre-release selection
1229
+ in its private state directory (a file still holding the retired `dev` reads as
1230
+ pre-release; `save` accepts only `stable` or `pre-release`). A missing selection
1231
+ defaults to stable; invalid or unreadable state fails rather than silently changing channels. Use
1134
1232
  `releaseChannelForUpdate` to map the UI's pre-release choice to the daily
1135
1233
  release feed. The host must authorize changes and read the selected channel
1136
1234
  again for each update check; persistence alone does not configure an updater.
@@ -1160,6 +1258,8 @@ specific offered version. The stage callback must only prepare the update;
1160
1258
  production installer must independently validate the channel and approval at
1161
1259
  its own commit boundary.
1162
1260
 
1261
+ ### Desktop updater
1262
+
1163
1263
  `desktop-updater` is the whole host side for an app: `createDesktopUpdater`
1164
1264
  wires the channel store, signed discovery, download, staged swap and post-exit
1165
1265
  helper for the app's release identity and renderer, resuming after an earlier
@@ -1423,7 +1523,14 @@ error }` where `reason` is `command_failed`, `timeout`, `aborted`,
1423
1523
  `restart_limit` or `stopped`, and `error` is readable. Recent stderr is kept,
1424
1524
  bounded, in `stderr()` and passed line by line to `log`; keep it on the host.
1425
1525
  Pass a `SidecarCommands` map as the type parameter to type each command's
1426
- arguments and value.
1526
+ arguments and value. With `cancellation: true` the host also sends
1527
+ `{"cancel": id}` when a call times out or its signal aborts (including a
1528
+ cancelled service call), so the sidecar can stop that work; it needs no reply,
1529
+ and a late reply is ignored. Leave it off for a sidecar that does not read it.
1530
+
1531
+ The desktop updater serves the changelog once through `desktop_update_changelog`;
1532
+ each `desktop_update_*` status carries only its `changelog_digest`, and
1533
+ `desktopUpdateAdapter` fetches the text once per digest.
1427
1534
 
1428
1535
  `registerSidecarServices({ services, sidecar, commands, authorize, prefix })`
1429
1536
  exposes each command as a service named `prefix + command`, so the web side
@@ -41,7 +41,6 @@ export type ApplicationProps = {
41
41
  onSearch?: () => void;
42
42
  searchLabel?: string;
43
43
  searchKeys?: readonly string[];
44
- navigationControls?: JSX.Element;
45
44
  workspace?: JSX.Element;
46
45
  search?: JSX.Element;
47
46
  actions?: JSX.Element;
@@ -57,7 +57,9 @@ function Application(props) {
57
57
  return providerProps.children;
58
58
  }
59
59
  })));
60
- return createComponent(Theme, { get children() {
60
+ const Shell = () => {
61
+ const content = createMemo(() => view().render());
62
+ const sidebar = createMemo(() => view().sidebar?.());
61
63
  return createComponent(ApplicationShell, {
62
64
  get name() {
63
65
  return props.definition.identity.name;
@@ -76,10 +78,10 @@ function Application(props) {
76
78
  return view().label;
77
79
  },
78
80
  get content() {
79
- return view().render();
81
+ return content();
80
82
  },
81
83
  get sidebar() {
82
- return view().sidebar?.();
84
+ return sidebar();
83
85
  },
84
86
  get onSearch() {
85
87
  return props.onSearch;
@@ -90,9 +92,6 @@ function Application(props) {
90
92
  get searchKeys() {
91
93
  return props.searchKeys;
92
94
  },
93
- get navigation() {
94
- return props.navigationControls;
95
- },
96
95
  get workspace() {
97
96
  return props.workspace;
98
97
  },
@@ -132,6 +131,9 @@ function Application(props) {
132
131
  }));
133
132
  }
134
133
  });
134
+ };
135
+ return createComponent(Theme, { get children() {
136
+ return createComponent(Shell, {});
135
137
  } });
136
138
  }
137
139
  export { Application, defineApplication };
@@ -4,18 +4,10 @@ import { renameExclusive } from "../native/native-rename.js";
4
4
  import { assertPortableAppName } from "../installer/installer-layout.js";
5
5
  import { containsAsciiControl } from "../desktop/string-policy.js";
6
6
  import { isPrivateGroup, readAccountDatabase } from "./private-group.js";
7
+ import { pathExists } from "../shared/file-system.js";
7
8
  import { cp, lstat, mkdtemp, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
8
9
  import { dirname, join, resolve } from "node:path";
9
10
  // src/app/create-application.ts
10
- async function exists(path) {
11
- try {
12
- await lstat(path);
13
- return true;
14
- } catch (error) {
15
- if (errorCode(error) === "ENOENT") return false;
16
- throw error;
17
- }
18
- }
19
11
  /**
20
12
  * Publication assumes nobody but this user (and root) can rename or remove entries in
21
13
  * the destination's parent. That holds when the parent is owned by this user or root
@@ -89,7 +81,7 @@ async function createApplication(options, dependencies = {}) {
89
81
  const frameworkVersion = frameworkManifest.version;
90
82
  if (typeof frameworkVersion !== "string" || !/^\d+\.\d+\.\d+$/.test(frameworkVersion)) throw new Error("Framework version is unavailable");
91
83
  const directory = resolve(options.directory);
92
- if (await exists(directory)) throw new Error("Application destination already exists");
84
+ if (await pathExists(directory)) throw new Error("Application destination already exists");
93
85
  await assertTrustedParent(dirname(directory), dependencies.readAccounts ?? readAccountDatabase);
94
86
  const staging = await mkdtemp(join(dirname(directory), ".framework-app-"));
95
87
  const created = await lstat(staging);
@@ -250,7 +242,7 @@ async function createApplication(options, dependencies = {}) {
250
242
  try {
251
243
  renameExclusive(staging, directory);
252
244
  } catch (error) {
253
- if (await exists(directory)) throw new Error("Application destination already exists", { cause: error });
245
+ if (await pathExists(directory)) throw new Error("Application destination already exists", { cause: error });
254
246
  throw error;
255
247
  }
256
248
  return { directory };
@@ -20,7 +20,6 @@ export type ServiceResult = {
20
20
  message: string;
21
21
  };
22
22
  };
23
- export declare const DEFAULT_SERVICE_BODY_BYTES: number;
24
23
  export declare const MAX_SERVICE_BODY_BYTES: number;
25
24
  /**
26
25
  * An error a service means its caller to read. Throw it from `run` and the caller
@@ -27,7 +27,7 @@ function createServiceRegistry() {
27
27
  const { parse, authorize, run } = definition;
28
28
  if (entries.has(name)) throw new Error("Service already registered");
29
29
  if (typeof parse !== "function" || typeof authorize !== "function" || typeof run !== "function") throw new Error("Invalid service definition");
30
- const maxBodyBytes = definition.maxBodyBytes ?? 262144;
30
+ const maxBodyBytes = definition.maxBodyBytes ?? DEFAULT_SERVICE_BODY_BYTES;
31
31
  if (entries.has(name)) throw new Error("Service already registered");
32
32
  if (!Number.isSafeInteger(maxBodyBytes) || maxBodyBytes < 1 || maxBodyBytes > 16777216) throw new Error("Invalid service body limit");
33
33
  const entry = {
@@ -134,7 +134,7 @@ function createServiceRegistry() {
134
134
  * name the largest limit any registered service accepts, for reading before the name is known.
135
135
  */
136
136
  maxBodyBytes(name) {
137
- if (name !== void 0) return entries.get(name)?.maxBodyBytes ?? 262144;
137
+ if (name !== void 0) return entries.get(name)?.maxBodyBytes ?? DEFAULT_SERVICE_BODY_BYTES;
138
138
  let largest = DEFAULT_SERVICE_BODY_BYTES;
139
139
  for (const entry of entries.values()) largest = Math.max(largest, entry.maxBodyBytes);
140
140
  return largest;
@@ -154,4 +154,4 @@ function createServiceRegistry() {
154
154
  }
155
155
  };
156
156
  }
157
- export { DEFAULT_SERVICE_BODY_BYTES, MAX_SERVICE_BODY_BYTES, ServiceError, createServiceRegistry };
157
+ export { MAX_SERVICE_BODY_BYTES, ServiceError, createServiceRegistry };
@@ -4,6 +4,8 @@
4
4
  */
5
5
  /** A plain JSON-style object: not null and not an array. */
6
6
  export declare function isRecord(value: unknown): value is Record<string, unknown>;
7
+ /** Whether a record's own keys (symbols included) are exactly `expected`, in any order. */
8
+ export declare function hasExactOwnKeys(value: Readonly<Record<string, unknown>>, expected: readonly string[]): boolean;
7
9
  /** RFC 4122 UUID text (versions 1-8), as `crypto.randomUUID()` produces; case-insensitive. */
8
10
  export declare const UUID_SOURCE: string;
9
11
  export declare function isUuid(value: unknown): boolean;