@adea-ai/app-framework 0.0.0-stage → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +30 -0
- package/README.md +967 -2
- package/dist/app/application.d.ts +47 -0
- package/dist/app/application.js +115 -0
- package/dist/app/create-application.d.ts +13 -0
- package/dist/app/create-application.js +178 -0
- package/dist/app/service-registry.d.ts +44 -0
- package/dist/app/service-registry.js +116 -0
- package/dist/appearance/appearance-host.d.ts +62 -0
- package/dist/appearance/appearance-host.js +115 -0
- package/dist/appearance/appearance-preferences.d.ts +106 -0
- package/dist/appearance/appearance-preferences.js +175 -0
- package/dist/appearance/composition.d.ts +11 -0
- package/dist/appearance/composition.js +16 -0
- package/dist/appearance/custom-theme-import.d.ts +14 -0
- package/dist/appearance/custom-theme-import.js +315 -0
- package/dist/appearance/custom-theme-library.d.ts +146 -0
- package/dist/appearance/custom-theme-library.js +378 -0
- package/dist/appearance/editor.d.ts +20 -0
- package/dist/appearance/editor.js +47 -0
- package/dist/appearance/theme-file-importer.d.ts +23 -0
- package/dist/appearance/theme-file-importer.js +66 -0
- package/dist/appearance/theme-record-adapter.d.ts +26 -0
- package/dist/appearance/theme-record-adapter.js +64 -0
- package/dist/appearance/theme-registry.d.ts +10 -0
- package/dist/appearance/theme-registry.js +16 -0
- package/dist/appearance/window-surface.d.ts +5 -0
- package/dist/appearance/window-surface.js +9 -0
- package/dist/ci/toolchain-identity.d.ts +39 -0
- package/dist/ci/toolchain-identity.js +196 -0
- package/dist/cli/cef-helper-cli.d.ts +2 -0
- package/dist/cli/cef-helper-cli.js +18 -0
- package/dist/cli/cli-runner.d.ts +8 -0
- package/dist/cli/cli-runner.js +23 -0
- package/dist/cli/create-application-cli.d.ts +2 -0
- package/dist/cli/create-application-cli.js +40 -0
- package/dist/cli/electrobun-shortcut-patch-cli.d.ts +2 -0
- package/dist/cli/electrobun-shortcut-patch-cli.js +17 -0
- package/dist/cli/framework-update-cli.d.ts +2 -0
- package/dist/cli/framework-update-cli.js +40 -0
- package/dist/cli/release-assets-plan-cli.d.ts +2 -0
- package/dist/cli/release-assets-plan-cli.js +14 -0
- package/dist/cli/release-cut-cli.d.ts +2 -0
- package/dist/cli/release-cut-cli.js +27 -0
- package/dist/cli/release-descriptor-staging-cli.d.ts +2 -0
- package/dist/cli/release-descriptor-staging-cli.js +45 -0
- package/dist/cli/release-finalize-cli.d.ts +1 -0
- package/dist/cli/release-finalize-cli.js +30 -0
- package/dist/cli/release-promote-cli.d.ts +2 -0
- package/dist/cli/release-promote-cli.js +32 -0
- package/dist/cli/release-publish-cli.d.ts +2 -0
- package/dist/cli/release-publish-cli.js +48 -0
- package/dist/cli/release-sign-cli.d.ts +2 -0
- package/dist/cli/release-sign-cli.js +13 -0
- package/dist/cli/release-step-cli.d.ts +2 -0
- package/dist/cli/release-step-cli.js +44 -0
- package/dist/cli/toolchain-identity-cli.d.ts +2 -0
- package/dist/cli/toolchain-identity-cli.js +10 -0
- package/dist/cli/update-helper-cli.d.ts +1 -0
- package/dist/cli/update-helper-cli.js +10 -0
- package/dist/cli/windows-runtime-patch-cli.d.ts +2 -0
- package/dist/cli/windows-runtime-patch-cli.js +17 -0
- package/dist/desktop/application-command-client.d.ts +15 -0
- package/dist/desktop/application-command-client.js +21 -0
- package/dist/desktop/channel-handshake.d.ts +32 -0
- package/dist/desktop/channel-handshake.js +111 -0
- package/dist/desktop/channel-proof.d.ts +43 -0
- package/dist/desktop/channel-proof.js +85 -0
- package/dist/desktop/client-assets.d.ts +7 -0
- package/dist/desktop/client-assets.js +59 -0
- package/dist/desktop/desktop-client.d.ts +23 -0
- package/dist/desktop/desktop-client.js +231 -0
- package/dist/desktop/desktop-gateway.d.ts +18 -0
- package/dist/desktop/desktop-gateway.js +146 -0
- package/dist/desktop/desktop-host.d.ts +48 -0
- package/dist/desktop/desktop-host.js +208 -0
- package/dist/desktop/desktop-stream.d.ts +36 -0
- package/dist/desktop/desktop-stream.js +231 -0
- package/dist/desktop/loopback-policy.d.ts +19 -0
- package/dist/desktop/loopback-policy.js +23 -0
- package/dist/desktop/open-url-channel.d.ts +15 -0
- package/dist/desktop/open-url-channel.js +55 -0
- package/dist/desktop/string-policy.d.ts +2 -0
- package/dist/desktop/string-policy.js +11 -0
- package/dist/framework-source.json +1 -0
- package/dist/installer/archive-entry.d.ts +6 -0
- package/dist/installer/archive-entry.js +14 -0
- package/dist/installer/command-artifact.d.ts +47 -0
- package/dist/installer/command-artifact.js +261 -0
- package/dist/installer/command-qualification-command.d.ts +12 -0
- package/dist/installer/command-qualification-command.js +71 -0
- package/dist/installer/hosted-runner.d.ts +4 -0
- package/dist/installer/hosted-runner.js +10 -0
- package/dist/installer/installed-payload.d.ts +29 -0
- package/dist/installer/installed-payload.js +312 -0
- package/dist/installer/installer-ci-bootstrap.d.ts +26 -0
- package/dist/installer/installer-ci-bootstrap.js +160 -0
- package/dist/installer/installer-ci-preflight.d.ts +1 -0
- package/dist/installer/installer-ci-preflight.js +49 -0
- package/dist/installer/installer-ci-worker.d.ts +1 -0
- package/dist/installer/installer-ci-worker.js +105 -0
- package/dist/installer/installer-extraction.d.ts +14 -0
- package/dist/installer/installer-extraction.js +289 -0
- package/dist/installer/installer-fetch-guard.d.ts +15 -0
- package/dist/installer/installer-fetch-guard.js +50 -0
- package/dist/installer/installer-identity.d.ts +23 -0
- package/dist/installer/installer-identity.js +286 -0
- package/dist/installer/installer-layout.d.ts +21 -0
- package/dist/installer/installer-layout.js +89 -0
- package/dist/installer/installer-observation.d.ts +64 -0
- package/dist/installer/installer-observation.js +473 -0
- package/dist/installer/installer-process-cleanup.d.ts +18 -0
- package/dist/installer/installer-process-cleanup.js +158 -0
- package/dist/installer/installer-qualification-command.d.ts +11 -0
- package/dist/installer/installer-qualification-command.js +71 -0
- package/dist/installer/installer-renderer-evidence.d.ts +43 -0
- package/dist/installer/installer-renderer-evidence.js +136 -0
- package/dist/installer/installer-upgrade-command.d.ts +37 -0
- package/dist/installer/installer-upgrade-command.js +172 -0
- package/dist/installer/installer-worker-guard.d.ts +21 -0
- package/dist/installer/installer-worker-guard.js +72 -0
- package/dist/installer/native-executable.d.ts +5 -0
- package/dist/installer/native-executable.js +21 -0
- package/dist/installer/upgrade-asset-download.d.ts +13 -0
- package/dist/installer/upgrade-asset-download.js +41 -0
- package/dist/installer/write-all.d.ts +6 -0
- package/dist/installer/write-all.js +11 -0
- package/dist/native/app-bundle.d.ts +28 -0
- package/dist/native/app-bundle.js +60 -0
- package/dist/native/cef-helper.d.ts +28 -0
- package/dist/native/cef-helper.js +402 -0
- package/dist/native/desktop-build-hook.d.ts +7 -0
- package/dist/native/desktop-build-hook.js +20 -0
- package/dist/native/electrobun-source-patch.d.ts +25 -0
- package/dist/native/electrobun-source-patch.js +93 -0
- package/dist/native/linux-cef-links.d.ts +2 -0
- package/dist/native/linux-cef-links.js +15 -0
- package/dist/native/native-secret-store.d.ts +27 -0
- package/dist/native/native-secret-store.js +70 -0
- package/dist/native/native-utilities.d.ts +24 -0
- package/dist/native/native-utilities.js +85 -0
- package/dist/native/partitioned-window.d.ts +34 -0
- package/dist/native/partitioned-window.js +44 -0
- package/dist/native/renderer-profile.d.ts +53 -0
- package/dist/native/renderer-profile.js +30 -0
- package/dist/native/secure-window.d.ts +38 -0
- package/dist/native/secure-window.js +77 -0
- package/dist/native/sidecar-services.d.ts +23 -0
- package/dist/native/sidecar-services.js +46 -0
- package/dist/native/sidecar.d.ts +81 -0
- package/dist/native/sidecar.js +250 -0
- package/dist/native/window-bootstrap.d.ts +24 -0
- package/dist/native/window-bootstrap.js +63 -0
- package/dist/native/window-options.d.ts +32 -0
- package/dist/native/window-options.js +23 -0
- package/dist/native/windows-build-hook-internal.d.ts +2 -0
- package/dist/native/windows-build-hook-internal.js +32 -0
- package/dist/native/windows-build-hook.d.ts +2 -0
- package/dist/native/windows-build-hook.js +12 -0
- package/dist/native/windows-runtime-patch-internal.d.ts +3 -0
- package/dist/native/windows-runtime-patch-internal.js +20 -0
- package/dist/native/windows-runtime-patch.d.ts +4 -0
- package/dist/native/windows-runtime-patch.js +12 -0
- package/dist/release/feed-release-cut.d.ts +23 -0
- package/dist/release/feed-release-cut.js +93 -0
- package/dist/release/feed-state.d.ts +25 -0
- package/dist/release/feed-state.js +81 -0
- package/dist/release/framework-package-publish.d.ts +21 -0
- package/dist/release/framework-package-publish.js +125 -0
- package/dist/release/framework-update.d.ts +30 -0
- package/dist/release/framework-update.js +139 -0
- package/dist/release/github-cli.d.ts +6 -0
- package/dist/release/github-cli.js +16 -0
- package/dist/release/github-release-assets.d.ts +3 -0
- package/dist/release/github-release-assets.js +24 -0
- package/dist/release/github-release-cut.d.ts +14 -0
- package/dist/release/github-release-cut.js +174 -0
- package/dist/release/github-release-lookup.d.ts +7 -0
- package/dist/release/github-release-lookup.js +29 -0
- package/dist/release/github-release-promotion.d.ts +10 -0
- package/dist/release/github-release-promotion.js +78 -0
- package/dist/release/github-release-provenance.d.ts +9 -0
- package/dist/release/github-release-provenance.js +27 -0
- package/dist/release/github-release-publisher.d.ts +9 -0
- package/dist/release/github-release-publisher.js +63 -0
- package/dist/release/github-release-qualification.d.ts +12 -0
- package/dist/release/github-release-qualification.js +80 -0
- package/dist/release/local-provenance.d.ts +24 -0
- package/dist/release/local-provenance.js +72 -0
- package/dist/release/local-release.d.ts +133 -0
- package/dist/release/local-release.js +387 -0
- package/dist/release/macos-dmg.d.ts +22 -0
- package/dist/release/macos-dmg.js +91 -0
- package/dist/release/release-artifact.d.ts +6 -0
- package/dist/release/release-artifact.js +38 -0
- package/dist/release/release-assets-plan.d.ts +14 -0
- package/dist/release/release-assets-plan.js +65 -0
- package/dist/release/release-config.d.ts +76 -0
- package/dist/release/release-config.js +180 -0
- package/dist/release/release-cut-command.d.ts +13 -0
- package/dist/release/release-cut-command.js +39 -0
- package/dist/release/release-cut.d.ts +54 -0
- package/dist/release/release-cut.js +76 -0
- package/dist/release/release-descriptor-staging.d.ts +34 -0
- package/dist/release/release-descriptor-staging.js +147 -0
- package/dist/release/release-finalize.d.ts +16 -0
- package/dist/release/release-finalize.js +104 -0
- package/dist/release/release-promotion-command.d.ts +12 -0
- package/dist/release/release-promotion-command.js +28 -0
- package/dist/release/release-promotion.d.ts +29 -0
- package/dist/release/release-promotion.js +57 -0
- package/dist/release/release-publication.d.ts +33 -0
- package/dist/release/release-publication.js +138 -0
- package/dist/release/release-publish-command.d.ts +7 -0
- package/dist/release/release-publish-command.js +91 -0
- package/dist/release/release-qualification.d.ts +106 -0
- package/dist/release/release-qualification.js +135 -0
- package/dist/release/release-staging.d.ts +9 -0
- package/dist/release/release-staging.js +61 -0
- package/dist/release/release-steps.d.ts +38 -0
- package/dist/release/release-steps.js +147 -0
- package/dist/release/retained-release-build.d.ts +19 -0
- package/dist/release/retained-release-build.js +122 -0
- package/dist/shell/app-shell.d.ts +61 -0
- package/dist/shell/app-shell.js +318 -0
- package/dist/shell/app-utilities.d.ts +122 -0
- package/dist/shell/app-utilities.js +334 -0
- package/dist/shell/application-menu-commands.d.ts +5 -0
- package/dist/shell/application-menu-commands.js +11 -0
- package/dist/shell/application-menu.d.ts +61 -0
- package/dist/shell/application-menu.js +208 -0
- package/dist/shell/help-shortcuts.d.ts +12 -0
- package/dist/shell/help-shortcuts.js +22 -0
- package/dist/shell/settings-sections.d.ts +31 -0
- package/dist/shell/settings-sections.js +50 -0
- package/dist/shell/shortcut-platform.d.ts +17 -0
- package/dist/shell/shortcut-platform.js +25 -0
- package/dist/update-helper.bundle.js +260 -0
- package/dist/updates/channel-update-manager.d.ts +46 -0
- package/dist/updates/channel-update-manager.js +114 -0
- package/dist/updates/desktop-updater.d.ts +104 -0
- package/dist/updates/desktop-updater.js +345 -0
- package/dist/updates/release-feed.d.ts +61 -0
- package/dist/updates/release-feed.js +111 -0
- package/dist/updates/release-location.d.ts +9 -0
- package/dist/updates/release-location.js +80 -0
- package/dist/updates/release-version.d.ts +12 -0
- package/dist/updates/release-version.js +43 -0
- package/dist/updates/signed-release.d.ts +63 -0
- package/dist/updates/signed-release.js +162 -0
- package/dist/updates/stable-file.d.ts +10 -0
- package/dist/updates/stable-file.js +22 -0
- package/dist/updates/update-adapter.d.ts +57 -0
- package/dist/updates/update-adapter.js +72 -0
- package/dist/updates/update-arm.d.ts +24 -0
- package/dist/updates/update-arm.js +95 -0
- package/dist/updates/update-channel-store.d.ts +8 -0
- package/dist/updates/update-channel-store.js +72 -0
- package/dist/updates/update-discovery.d.ts +13 -0
- package/dist/updates/update-discovery.js +56 -0
- package/dist/updates/update-download.d.ts +14 -0
- package/dist/updates/update-download.js +67 -0
- package/dist/updates/update-exclusive-rename.d.ts +2 -0
- package/dist/updates/update-exclusive-rename.js +52 -0
- package/dist/updates/update-extraction.d.ts +18 -0
- package/dist/updates/update-extraction.js +183 -0
- package/dist/updates/update-handoff-plan.d.ts +22 -0
- package/dist/updates/update-handoff-plan.js +28 -0
- package/dist/updates/update-helper.d.ts +24 -0
- package/dist/updates/update-helper.js +56 -0
- package/dist/updates/update-launch.d.ts +5 -0
- package/dist/updates/update-launch.js +27 -0
- package/dist/updates/update-manager.d.ts +40 -0
- package/dist/updates/update-manager.js +83 -0
- package/dist/updates/update-process-fence.d.ts +10 -0
- package/dist/updates/update-process-fence.js +114 -0
- package/dist/updates/update-resume.d.ts +13 -0
- package/dist/updates/update-resume.js +34 -0
- package/dist/updates/update-shutdown.d.ts +15 -0
- package/dist/updates/update-shutdown.js +29 -0
- package/dist/updates/update-state.d.ts +30 -0
- package/dist/updates/update-state.js +18 -0
- package/dist/updates/update-swap-stage.d.ts +27 -0
- package/dist/updates/update-swap-stage.js +58 -0
- package/dist/updates/update-swap.d.ts +10 -0
- package/dist/updates/update-swap.js +30 -0
- package/dist/views/app-about.d.ts +22 -0
- package/dist/views/app-about.js +43 -0
- package/dist/views/app-appearance.d.ts +11 -0
- package/dist/views/app-appearance.js +42 -0
- package/dist/views/app-help.d.ts +17 -0
- package/dist/views/app-help.js +42 -0
- package/dist/views/app-settings.d.ts +26 -0
- package/dist/views/app-settings.js +97 -0
- package/dist/views/appearance-surface.d.ts +9 -0
- package/dist/views/appearance-surface.js +334 -0
- package/dist/views/update-surface.d.ts +34 -0
- package/dist/views/update-surface.js +64 -0
- package/package.json +363 -4
- package/src/app/application.tsx +138 -0
- package/src/app/create-application.ts +245 -0
- package/src/app/service-registry.ts +124 -0
- package/src/appearance/appearance-host.tsx +205 -0
- package/src/appearance/appearance-preferences.ts +287 -0
- package/src/appearance/composition.ts +29 -0
- package/src/appearance/custom-theme-import.ts +424 -0
- package/src/appearance/custom-theme-library.ts +600 -0
- package/src/appearance/editor.ts +94 -0
- package/src/appearance/theme-file-importer.ts +103 -0
- package/src/appearance/theme-record-adapter.ts +106 -0
- package/src/appearance/theme-registry.ts +20 -0
- package/src/appearance/window-surface.ts +18 -0
- package/src/ci/toolchain-identity.ts +244 -0
- package/src/cli/cef-helper-cli.ts +21 -0
- package/src/cli/cli-runner.ts +29 -0
- package/src/cli/create-application-cli.ts +62 -0
- package/src/cli/electrobun-shortcut-patch-cli.ts +24 -0
- package/src/cli/framework-update-cli.ts +41 -0
- package/src/cli/release-assets-plan-cli.ts +14 -0
- package/src/cli/release-cut-cli.ts +41 -0
- package/src/cli/release-descriptor-staging-cli.ts +57 -0
- package/src/cli/release-finalize-cli.ts +34 -0
- package/src/cli/release-promote-cli.ts +31 -0
- package/src/cli/release-publish-cli.ts +46 -0
- package/src/cli/release-sign-cli.ts +24 -0
- package/src/cli/release-step-cli.ts +71 -0
- package/src/cli/toolchain-identity-cli.ts +12 -0
- package/src/cli/update-helper-cli.ts +12 -0
- package/src/cli/windows-runtime-patch-cli.ts +17 -0
- package/src/desktop/application-command-client.ts +43 -0
- package/src/desktop/channel-handshake.ts +136 -0
- package/src/desktop/channel-proof.ts +122 -0
- package/src/desktop/client-assets.ts +75 -0
- package/src/desktop/desktop-client.ts +303 -0
- package/src/desktop/desktop-gateway.ts +189 -0
- package/src/desktop/desktop-host.ts +335 -0
- package/src/desktop/desktop-stream.ts +324 -0
- package/src/desktop/loopback-policy.ts +41 -0
- package/src/desktop/open-url-channel.ts +79 -0
- package/src/desktop/string-policy.ts +9 -0
- package/src/installer/archive-entry.ts +32 -0
- package/src/installer/command-artifact.ts +307 -0
- package/src/installer/command-qualification-command.ts +75 -0
- package/src/installer/hosted-runner.ts +11 -0
- package/src/installer/installed-payload.ts +408 -0
- package/src/installer/installer-ci-bootstrap.ts +199 -0
- package/src/installer/installer-ci-preflight.ts +61 -0
- package/src/installer/installer-ci-worker.ts +105 -0
- package/src/installer/installer-extraction.ts +367 -0
- package/src/installer/installer-fetch-guard.ts +75 -0
- package/src/installer/installer-identity.ts +331 -0
- package/src/installer/installer-layout.ts +167 -0
- package/src/installer/installer-observation.ts +671 -0
- package/src/installer/installer-process-cleanup.ts +167 -0
- package/src/installer/installer-qualification-command.ts +81 -0
- package/src/installer/installer-renderer-evidence.ts +268 -0
- package/src/installer/installer-upgrade-command.ts +226 -0
- package/src/installer/installer-worker-guard.ts +112 -0
- package/src/installer/native-executable.ts +37 -0
- package/src/installer/upgrade-asset-download.ts +72 -0
- package/src/installer/write-all.ts +19 -0
- package/src/native/app-bundle.ts +86 -0
- package/src/native/cef-helper.ts +471 -0
- package/src/native/desktop-build-hook.ts +21 -0
- package/src/native/electrobun-cef-main-frame-bridges.patch +63 -0
- package/src/native/electrobun-source-patch.ts +107 -0
- package/src/native/electrobun-windows-shortcut-com.patch +923 -0
- package/src/native/linux-cef-links.ts +14 -0
- package/src/native/native-secret-store.ts +99 -0
- package/src/native/native-utilities.ts +166 -0
- package/src/native/partitioned-window.ts +62 -0
- package/src/native/renderer-profile.ts +27 -0
- package/src/native/secure-window.ts +115 -0
- package/src/native/sidecar-services.ts +71 -0
- package/src/native/sidecar.ts +387 -0
- package/src/native/window-bootstrap.ts +77 -0
- package/src/native/window-options.ts +24 -0
- package/src/native/windows-build-hook-internal.ts +49 -0
- package/src/native/windows-build-hook.ts +12 -0
- package/src/native/windows-runtime-patch-internal.ts +48 -0
- package/src/native/windows-runtime-patch.ts +15 -0
- package/src/release/feed-release-cut.ts +110 -0
- package/src/release/feed-state.ts +135 -0
- package/src/release/framework-package-publish.ts +163 -0
- package/src/release/framework-update.ts +196 -0
- package/src/release/github-cli.ts +27 -0
- package/src/release/github-release-assets.ts +36 -0
- package/src/release/github-release-cut.ts +237 -0
- package/src/release/github-release-lookup.ts +39 -0
- package/src/release/github-release-promotion.ts +112 -0
- package/src/release/github-release-provenance.ts +65 -0
- package/src/release/github-release-publisher.ts +90 -0
- package/src/release/github-release-qualification.ts +144 -0
- package/src/release/local-provenance.ts +92 -0
- package/src/release/local-release.ts +525 -0
- package/src/release/macos-dmg.ts +113 -0
- package/src/release/release-artifact.ts +53 -0
- package/src/release/release-assets-plan.ts +118 -0
- package/src/release/release-config.ts +420 -0
- package/src/release/release-cut-command.ts +80 -0
- package/src/release/release-cut.ts +133 -0
- package/src/release/release-descriptor-staging.ts +242 -0
- package/src/release/release-finalize.ts +191 -0
- package/src/release/release-promotion-command.ts +36 -0
- package/src/release/release-promotion.ts +132 -0
- package/src/release/release-publication.ts +213 -0
- package/src/release/release-publish-command.ts +163 -0
- package/src/release/release-qualification.ts +397 -0
- package/src/release/release-staging.ts +87 -0
- package/src/release/release-steps.ts +173 -0
- package/src/release/retained-release-build.ts +217 -0
- package/src/shell/app-shell.tsx +285 -0
- package/src/shell/app-utilities.tsx +437 -0
- package/src/shell/application-menu-commands.ts +6 -0
- package/src/shell/application-menu.ts +250 -0
- package/src/shell/help-shortcuts.ts +24 -0
- package/src/shell/settings-sections.ts +74 -0
- package/src/shell/shortcut-platform.ts +35 -0
- package/src/updates/channel-update-manager.ts +127 -0
- package/src/updates/desktop-updater.ts +440 -0
- package/src/updates/release-feed.ts +187 -0
- package/src/updates/release-location.ts +101 -0
- package/src/updates/release-version.ts +57 -0
- package/src/updates/signed-release.ts +311 -0
- package/src/updates/stable-file.ts +32 -0
- package/src/updates/update-adapter.ts +129 -0
- package/src/updates/update-arm.ts +107 -0
- package/src/updates/update-channel-store.ts +86 -0
- package/src/updates/update-discovery.ts +113 -0
- package/src/updates/update-download.ts +82 -0
- package/src/updates/update-exclusive-rename.ts +58 -0
- package/src/updates/update-extraction.ts +261 -0
- package/src/updates/update-handoff-plan.ts +75 -0
- package/src/updates/update-helper.ts +87 -0
- package/src/updates/update-launch.ts +33 -0
- package/src/updates/update-manager.ts +130 -0
- package/src/updates/update-process-fence.ts +125 -0
- package/src/updates/update-resume.ts +34 -0
- package/src/updates/update-shutdown.ts +37 -0
- package/src/updates/update-state.ts +34 -0
- package/src/updates/update-swap-stage.ts +75 -0
- package/src/updates/update-swap.ts +30 -0
- package/src/views/app-about.tsx +44 -0
- package/src/views/app-appearance.tsx +32 -0
- package/src/views/app-help.tsx +43 -0
- package/src/views/app-settings.tsx +88 -0
- package/src/views/appearance-surface.tsx +427 -0
- package/src/views/update-surface.tsx +85 -0
- package/templates/application/.gitattributes +1 -0
- package/templates/application/.github/workflows/release-assets.yml +29 -0
- package/templates/application/.github/workflows/release-finalize.yml +29 -0
- package/templates/application/.github/workflows/release-please.yml +19 -0
- package/templates/application/.github/workflows/release.yml +29 -0
- package/templates/application/.github/workflows/validation.yml +28 -0
- package/templates/application/.oxfmtrc.json +6 -0
- package/templates/application/.oxlintrc.json +48 -0
- package/templates/application/.release-please-manifest.json +3 -0
- package/templates/application/README.md +47 -0
- package/templates/application/electrobun.config.ts +22 -0
- package/templates/application/release-please-config.json +12 -0
- package/templates/application/scripts/app-version.ts +9 -0
- package/templates/application/scripts/build-desktop.ts +34 -0
- package/templates/application/scripts/secure-build.ts +1 -0
- package/templates/application/scripts/stage-release.ts +21 -0
- package/templates/application/src/bun/index.ts +80 -0
- package/templates/application/src/electrobun.d.ts +27 -0
- package/templates/application/src/web/index.html +12 -0
- package/templates/application/src/web/main.tsx +97 -0
- package/templates/application/src/web/public/icon.svg +1 -0
- package/templates/application/src/web/style.css +3 -0
- package/templates/application/tests/app-config.test.ts +9 -0
- package/templates/application/tsconfig.json +15 -0
- package/templates/application/vite.config.ts +10 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { cp, mkdir, readFile, readdir, writeFile } from 'node:fs/promises'
|
|
2
|
+
import { resolve } from 'node:path'
|
|
3
|
+
import { createRendererProfile, type DesktopRenderer } from '../native/renderer-profile'
|
|
4
|
+
import { assertPortableAppName } from '../installer/installer-layout'
|
|
5
|
+
import { containsAsciiControl } from '../desktop/string-policy'
|
|
6
|
+
|
|
7
|
+
/** Generate a new app without replacing an existing directory. */
|
|
8
|
+
export async function createApplication(options: {
|
|
9
|
+
directory: string
|
|
10
|
+
slug: string
|
|
11
|
+
name: string
|
|
12
|
+
identifier: string
|
|
13
|
+
sourceUrl: string
|
|
14
|
+
frameworkSpecifier: string
|
|
15
|
+
renderer?: DesktopRenderer
|
|
16
|
+
}) {
|
|
17
|
+
if (
|
|
18
|
+
typeof options.directory !== 'string' ||
|
|
19
|
+
!options.directory.trim() ||
|
|
20
|
+
!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(options.slug) ||
|
|
21
|
+
options.slug.length > 64 ||
|
|
22
|
+
typeof options.name !== 'string' ||
|
|
23
|
+
!options.name.trim() ||
|
|
24
|
+
options.name.length > 80 ||
|
|
25
|
+
containsAsciiControl(options.name) ||
|
|
26
|
+
!/^[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*){1,}$/.test(options.identifier) ||
|
|
27
|
+
typeof options.frameworkSpecifier !== 'string' ||
|
|
28
|
+
!options.frameworkSpecifier.trim()
|
|
29
|
+
)
|
|
30
|
+
throw new Error('Invalid application identity or framework dependency')
|
|
31
|
+
assertPortableAppName(options.name)
|
|
32
|
+
let source: URL
|
|
33
|
+
try {
|
|
34
|
+
source = new URL(options.sourceUrl)
|
|
35
|
+
} catch {
|
|
36
|
+
throw new Error('Invalid application source URL')
|
|
37
|
+
}
|
|
38
|
+
if (source.protocol !== 'https:' || source.username || source.password)
|
|
39
|
+
throw new Error('Invalid application source URL')
|
|
40
|
+
if (
|
|
41
|
+
containsAsciiControl(options.frameworkSpecifier, true) ||
|
|
42
|
+
options.frameworkSpecifier.length > 512
|
|
43
|
+
)
|
|
44
|
+
throw new Error('Invalid framework dependency')
|
|
45
|
+
if (/^(?:git\+)?https?:/i.test(options.frameworkSpecifier)) {
|
|
46
|
+
let dependency: URL
|
|
47
|
+
try {
|
|
48
|
+
dependency = new URL(options.frameworkSpecifier.replace(/^git\+/, ''))
|
|
49
|
+
} catch {
|
|
50
|
+
throw new Error('Invalid framework dependency')
|
|
51
|
+
}
|
|
52
|
+
if (
|
|
53
|
+
dependency.protocol !== 'https:' ||
|
|
54
|
+
dependency.username ||
|
|
55
|
+
dependency.password ||
|
|
56
|
+
dependency.search
|
|
57
|
+
)
|
|
58
|
+
throw new Error('Invalid framework dependency')
|
|
59
|
+
}
|
|
60
|
+
const renderer = createRendererProfile(options.renderer).renderer
|
|
61
|
+
const frameworkManifest = JSON.parse(
|
|
62
|
+
await readFile(resolve(import.meta.dir, '../../package.json'), 'utf8')
|
|
63
|
+
) as { version?: unknown; devDependencies?: Record<string, unknown> }
|
|
64
|
+
const uiVersion = frameworkManifest.devDependencies?.['@adea-ai/ui']
|
|
65
|
+
if (typeof uiVersion !== 'string' || !/^\d+\.\d+\.\d+$/.test(uiVersion))
|
|
66
|
+
throw new Error('Framework UI version is unavailable')
|
|
67
|
+
const frameworkVersion = frameworkManifest.version
|
|
68
|
+
if (typeof frameworkVersion !== 'string' || !/^\d+\.\d+\.\d+$/.test(frameworkVersion))
|
|
69
|
+
throw new Error('Framework version is unavailable')
|
|
70
|
+
const directory = resolve(options.directory)
|
|
71
|
+
await mkdir(directory)
|
|
72
|
+
const template = resolve(import.meta.dir, '../../templates/application')
|
|
73
|
+
for (const entry of await readdir(template))
|
|
74
|
+
await cp(resolve(template, entry), resolve(directory, entry), {
|
|
75
|
+
recursive: true,
|
|
76
|
+
errorOnExist: true,
|
|
77
|
+
force: false,
|
|
78
|
+
})
|
|
79
|
+
// The release workflows call this framework release's reusable workflows. The tag
|
|
80
|
+
// pin is replaced with its commit by `adea-update-app-framework`.
|
|
81
|
+
for (const name of ['release.yml', 'release-assets.yml', 'release-finalize.yml']) {
|
|
82
|
+
const path = resolve(directory, '.github/workflows', name)
|
|
83
|
+
const workflow = await readFile(path, 'utf8')
|
|
84
|
+
await writeFile(
|
|
85
|
+
path,
|
|
86
|
+
workflow
|
|
87
|
+
.replaceAll('{{FRAMEWORK_REF}}', `v${frameworkVersion}`)
|
|
88
|
+
.replaceAll('{{RENDERER}}', renderer)
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
const config = {
|
|
92
|
+
slug: options.slug,
|
|
93
|
+
name: options.name,
|
|
94
|
+
identifier: options.identifier,
|
|
95
|
+
sourceUrl: source.href,
|
|
96
|
+
version: '0.1.0',
|
|
97
|
+
renderer,
|
|
98
|
+
initialPort: null,
|
|
99
|
+
urlSchemes: [],
|
|
100
|
+
}
|
|
101
|
+
const configEntries = Object.entries(config)
|
|
102
|
+
.map(([key, value]) => {
|
|
103
|
+
const json = JSON.stringify(value)
|
|
104
|
+
const literal =
|
|
105
|
+
typeof value !== 'string' || value.includes("'")
|
|
106
|
+
? json
|
|
107
|
+
: `'${json.slice(1, -1).replace(/\\"/g, '"')}'`
|
|
108
|
+
return ` ${key}: ${literal},`
|
|
109
|
+
})
|
|
110
|
+
.join('\n')
|
|
111
|
+
await writeFile(
|
|
112
|
+
resolve(directory, 'src/app-config.ts'),
|
|
113
|
+
`export const appConfig = {\n${configEntries}\n} as const\n`
|
|
114
|
+
)
|
|
115
|
+
const manifest = {
|
|
116
|
+
name: options.slug,
|
|
117
|
+
version: '0.1.0',
|
|
118
|
+
private: true,
|
|
119
|
+
type: 'module',
|
|
120
|
+
packageManager: 'bun@1.4.4',
|
|
121
|
+
scripts: {
|
|
122
|
+
format: 'oxfmt src scripts tests vite.config.ts electrobun.config.ts',
|
|
123
|
+
'format:check': 'oxfmt --check src scripts tests vite.config.ts electrobun.config.ts',
|
|
124
|
+
'format:write': 'oxfmt --write src scripts tests vite.config.ts electrobun.config.ts',
|
|
125
|
+
lint: 'oxlint src scripts tests vite.config.ts electrobun.config.ts',
|
|
126
|
+
typecheck: 'bun check -p tsconfig.json',
|
|
127
|
+
test: 'bun test tests',
|
|
128
|
+
'dev:web': 'vp dev --host 127.0.0.1',
|
|
129
|
+
'build:web': 'vp build',
|
|
130
|
+
'build:desktop': 'bun run build:web && bun scripts/build-desktop.ts dev',
|
|
131
|
+
'build:release': 'bun run build:web && bun scripts/build-desktop.ts stable',
|
|
132
|
+
'release:cut': 'bun node_modules/@adea-ai/app-framework/dist/cli/release-cut-cli.js',
|
|
133
|
+
'release:promote': 'bun node_modules/@adea-ai/app-framework/dist/cli/release-promote-cli.js',
|
|
134
|
+
'release:finalize':
|
|
135
|
+
'bun node_modules/@adea-ai/app-framework/dist/cli/release-finalize-cli.js',
|
|
136
|
+
'release:publish': 'bun node_modules/@adea-ai/app-framework/dist/cli/release-publish-cli.js',
|
|
137
|
+
'release:stage': 'bun scripts/stage-release.ts',
|
|
138
|
+
'release:stage-build':
|
|
139
|
+
'bun node_modules/@adea-ai/app-framework/dist/cli/release-step-cli.js stage-build',
|
|
140
|
+
'release:inspect':
|
|
141
|
+
'bun node_modules/@adea-ai/app-framework/dist/cli/release-step-cli.js inspect',
|
|
142
|
+
'release:plan': 'bun node_modules/@adea-ai/app-framework/dist/cli/release-assets-plan-cli.js',
|
|
143
|
+
'release:sign-descriptors':
|
|
144
|
+
'bun node_modules/@adea-ai/app-framework/dist/cli/release-descriptor-staging-cli.js',
|
|
145
|
+
'release:qualify':
|
|
146
|
+
'bun node_modules/@adea-ai/app-framework/dist/cli/release-step-cli.js qualify',
|
|
147
|
+
'release:qualify-upgrade':
|
|
148
|
+
'bun node_modules/@adea-ai/app-framework/dist/cli/release-step-cli.js qualify-upgrade',
|
|
149
|
+
'release:select-retained':
|
|
150
|
+
'bun node_modules/@adea-ai/app-framework/dist/cli/release-step-cli.js select-retained',
|
|
151
|
+
},
|
|
152
|
+
dependencies: {
|
|
153
|
+
'@adea-ai/app-framework': options.frameworkSpecifier,
|
|
154
|
+
'@adea-ai/ui': uiVersion,
|
|
155
|
+
'lucide-solid': '^1.51.0',
|
|
156
|
+
'solid-js': '1.9.15',
|
|
157
|
+
},
|
|
158
|
+
devDependencies: {
|
|
159
|
+
'@shadcn/lint': '^0.2.0',
|
|
160
|
+
oxlint: '^1.86.0',
|
|
161
|
+
oxfmt: '^0.71.0',
|
|
162
|
+
'@tailwindcss/vite': '^4.3.3',
|
|
163
|
+
tailwindcss: '^4.3.3',
|
|
164
|
+
vite: 'npm:@voidzero-dev/vite-plus-core@1.4.0',
|
|
165
|
+
'vite-plus': '1.4.0',
|
|
166
|
+
'vite-plugin-solid': '2.11.14',
|
|
167
|
+
electrobun: '2.0.5',
|
|
168
|
+
typescript: '^7.0.2',
|
|
169
|
+
'@types/bun': '^1.4.4',
|
|
170
|
+
},
|
|
171
|
+
overrides: {
|
|
172
|
+
vite: 'npm:@voidzero-dev/vite-plus-core@1.4.0',
|
|
173
|
+
},
|
|
174
|
+
}
|
|
175
|
+
await writeFile(resolve(directory, 'package.json'), JSON.stringify(manifest, null, 2) + '\n')
|
|
176
|
+
const platforms = {
|
|
177
|
+
'macos-arm64': [
|
|
178
|
+
`${options.slug}-{tag}-macos-arm64.dmg`,
|
|
179
|
+
`${options.slug}-{tag}-macos-arm64.tar.zst`,
|
|
180
|
+
],
|
|
181
|
+
'windows-x64': [
|
|
182
|
+
`${options.slug}-{tag}-windows-x64-Setup.zip`,
|
|
183
|
+
`${options.slug}-{tag}-windows-x64.tar.zst`,
|
|
184
|
+
],
|
|
185
|
+
'linux-x64': [
|
|
186
|
+
`${options.slug}-{tag}-linux-x64-Setup.tar.gz`,
|
|
187
|
+
`${options.slug}-{tag}-linux-x64.tar.zst`,
|
|
188
|
+
],
|
|
189
|
+
}
|
|
190
|
+
const devDiscoveryAssets = Object.keys(platforms).map((platform) => `dev-${platform}.json`)
|
|
191
|
+
const dailyDiscoveryAssets = Object.keys(platforms).map((platform) => `daily-${platform}.json`)
|
|
192
|
+
const stableDiscoveryAssets = Object.keys(platforms).map((platform) => `stable-${platform}.json`)
|
|
193
|
+
const releaseAssets = [...dailyDiscoveryAssets, ...stableDiscoveryAssets, ...devDiscoveryAssets]
|
|
194
|
+
const targets = {
|
|
195
|
+
'macos-arm64': ['darwin', 'arm64'],
|
|
196
|
+
'windows-x64': ['win32', 'x64'],
|
|
197
|
+
'linux-x64': ['linux', 'x64'],
|
|
198
|
+
} as const
|
|
199
|
+
const descriptors = Object.fromEntries(
|
|
200
|
+
(['dev', 'daily', 'stable'] as const).flatMap((channel) =>
|
|
201
|
+
Object.entries(targets).map(([platform, [os, arch]]) => [
|
|
202
|
+
`${channel}-${platform}.json`,
|
|
203
|
+
{
|
|
204
|
+
channel,
|
|
205
|
+
platform: os,
|
|
206
|
+
arch,
|
|
207
|
+
allowedPayloads: [platforms[platform as keyof typeof platforms][1]],
|
|
208
|
+
},
|
|
209
|
+
])
|
|
210
|
+
)
|
|
211
|
+
)
|
|
212
|
+
await writeFile(
|
|
213
|
+
resolve(directory, 'release-config.json'),
|
|
214
|
+
JSON.stringify(
|
|
215
|
+
{
|
|
216
|
+
appName: options.name,
|
|
217
|
+
appId: options.identifier,
|
|
218
|
+
soakHours: 96,
|
|
219
|
+
versionSource: { kind: 'source-manifest', path: 'package.json' },
|
|
220
|
+
releaseWorkflows: {
|
|
221
|
+
control: '.github/workflows/release.yml',
|
|
222
|
+
assets: '.github/workflows/release-assets.yml',
|
|
223
|
+
},
|
|
224
|
+
releaseFeed: { base: 'https://adea.dev/releases/', app: options.slug },
|
|
225
|
+
offlinePolicy: { kind: 'standalone', marker: `Welcome to ${options.name}.` },
|
|
226
|
+
offlineExpectedReads: [],
|
|
227
|
+
platforms,
|
|
228
|
+
releaseAssets,
|
|
229
|
+
dailyDiscoveryAssets,
|
|
230
|
+
stableDiscoveryAssets,
|
|
231
|
+
devDiscoveryAssets,
|
|
232
|
+
releaseSigningKeys: {},
|
|
233
|
+
descriptors,
|
|
234
|
+
},
|
|
235
|
+
null,
|
|
236
|
+
2
|
|
237
|
+
) + '\n'
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
await writeFile(
|
|
241
|
+
resolve(directory, '.gitignore'),
|
|
242
|
+
'node_modules/\nbuild/\nartifacts/\n.hutch/\n.cottontail-tmp/\n.env\n.env.*\n!.env.example\n'
|
|
243
|
+
)
|
|
244
|
+
return { directory }
|
|
245
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/** The transport supplies a verified principal; this registry does not authenticate it. */
|
|
2
|
+
export type ServiceDefinition<Principal, Input, Output> = Readonly<{
|
|
3
|
+
parse(value: unknown): Input
|
|
4
|
+
authorize(principal: Principal, input: Input): boolean | Promise<boolean>
|
|
5
|
+
run(principal: Principal, input: Input): Output | Promise<Output>
|
|
6
|
+
/** Largest invoke body the transport accepts for this service. Default 256 KiB, at most 16 MiB. */
|
|
7
|
+
maxBodyBytes?: number
|
|
8
|
+
}>
|
|
9
|
+
export type ServiceResult =
|
|
10
|
+
| { ok: true; value: unknown }
|
|
11
|
+
| { ok: false; code: 'unknown_service' | 'invalid_input' | 'unauthorized' | 'service_failed' }
|
|
12
|
+
| { ok: false; code: 'service_error'; error: { code: string; message: string } }
|
|
13
|
+
|
|
14
|
+
const MAX_ERROR_MESSAGE = 2048
|
|
15
|
+
export const DEFAULT_SERVICE_BODY_BYTES = 256 * 1024
|
|
16
|
+
export const MAX_SERVICE_BODY_BYTES = 16 * 1024 * 1024
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* An error a service means its caller to read. Throw it from `run` and the caller
|
|
20
|
+
* receives `{ok: false, code: 'service_error', error: {code, message}}`; any other
|
|
21
|
+
* thrown value stays a bare `service_failed` so implementation detail never leaks.
|
|
22
|
+
*/
|
|
23
|
+
export class ServiceError extends Error {
|
|
24
|
+
readonly code: string
|
|
25
|
+
constructor(code: string, message: string) {
|
|
26
|
+
if (typeof code !== 'string' || !/^[a-z][a-z0-9_]*$/.test(code) || code.length > 64)
|
|
27
|
+
throw new Error('Invalid service error code')
|
|
28
|
+
if (typeof message !== 'string') throw new Error('Invalid service error message')
|
|
29
|
+
super(message.length > MAX_ERROR_MESSAGE ? message.slice(0, MAX_ERROR_MESSAGE) : message)
|
|
30
|
+
this.name = 'ServiceError'
|
|
31
|
+
this.code = code
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** In-process dispatch boundary for app services. Never expose it without an authenticated transport. */
|
|
36
|
+
export function createServiceRegistry<Principal>() {
|
|
37
|
+
type Entry = {
|
|
38
|
+
maxBodyBytes: number
|
|
39
|
+
invoke(value: unknown, principal: Principal, current?: () => boolean): Promise<ServiceResult>
|
|
40
|
+
}
|
|
41
|
+
const entries = new Map<string, Entry>()
|
|
42
|
+
return {
|
|
43
|
+
register<Input, Output>(
|
|
44
|
+
name: string,
|
|
45
|
+
definition: ServiceDefinition<Principal, Input, Output>
|
|
46
|
+
): () => void {
|
|
47
|
+
if (!/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/.test(name) || name.length > 128)
|
|
48
|
+
throw new Error('Invalid service name')
|
|
49
|
+
if (entries.has(name)) throw new Error('Service already registered')
|
|
50
|
+
const { parse, authorize, run } = definition
|
|
51
|
+
if (
|
|
52
|
+
typeof parse !== 'function' ||
|
|
53
|
+
typeof authorize !== 'function' ||
|
|
54
|
+
typeof run !== 'function'
|
|
55
|
+
)
|
|
56
|
+
throw new Error('Invalid service definition')
|
|
57
|
+
const maxBodyBytes = definition.maxBodyBytes ?? DEFAULT_SERVICE_BODY_BYTES
|
|
58
|
+
if (
|
|
59
|
+
!Number.isSafeInteger(maxBodyBytes) ||
|
|
60
|
+
maxBodyBytes < 1 ||
|
|
61
|
+
maxBodyBytes > MAX_SERVICE_BODY_BYTES
|
|
62
|
+
)
|
|
63
|
+
throw new Error('Invalid service body limit')
|
|
64
|
+
const entry: Entry = {
|
|
65
|
+
maxBodyBytes,
|
|
66
|
+
async invoke(value, principal, current) {
|
|
67
|
+
let input: Input
|
|
68
|
+
try {
|
|
69
|
+
input = parse(value)
|
|
70
|
+
} catch {
|
|
71
|
+
return { ok: false, code: 'invalid_input' }
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
if ((await authorize(principal, input)) !== true)
|
|
75
|
+
return { ok: false, code: 'unauthorized' }
|
|
76
|
+
} catch {
|
|
77
|
+
return { ok: false, code: 'unauthorized' }
|
|
78
|
+
}
|
|
79
|
+
if (entries.get(name) !== entry) return { ok: false, code: 'unknown_service' }
|
|
80
|
+
try {
|
|
81
|
+
if (current && current() !== true) return { ok: false, code: 'unauthorized' }
|
|
82
|
+
} catch {
|
|
83
|
+
return { ok: false, code: 'unauthorized' }
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
return { ok: true, value: await run(principal, input) }
|
|
87
|
+
} catch (error) {
|
|
88
|
+
if (!(error instanceof ServiceError)) return { ok: false, code: 'service_failed' }
|
|
89
|
+
return {
|
|
90
|
+
ok: false,
|
|
91
|
+
code: 'service_error',
|
|
92
|
+
error: { code: error.code, message: error.message },
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
entries.set(name, entry)
|
|
98
|
+
return () => {
|
|
99
|
+
if (entries.get(name) === entry) entries.delete(name)
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* The invoke body limit for `name` (the default for an unknown service), or with no
|
|
104
|
+
* name the largest limit any registered service accepts, for reading before the name is known.
|
|
105
|
+
*/
|
|
106
|
+
maxBodyBytes(name?: string): number {
|
|
107
|
+
if (name !== undefined) return entries.get(name)?.maxBodyBytes ?? DEFAULT_SERVICE_BODY_BYTES
|
|
108
|
+
let largest = DEFAULT_SERVICE_BODY_BYTES
|
|
109
|
+
for (const entry of entries.values()) largest = Math.max(largest, entry.maxBodyBytes)
|
|
110
|
+
return largest
|
|
111
|
+
},
|
|
112
|
+
/** `current` must synchronously recheck channel and scope immediately before the handler starts. */
|
|
113
|
+
async dispatch(
|
|
114
|
+
name: string,
|
|
115
|
+
value: unknown,
|
|
116
|
+
principal: Principal,
|
|
117
|
+
current?: () => boolean
|
|
118
|
+
): Promise<ServiceResult> {
|
|
119
|
+
const entry = entries.get(name)
|
|
120
|
+
if (!entry) return { ok: false, code: 'unknown_service' }
|
|
121
|
+
return entry.invoke(value, principal, current)
|
|
122
|
+
},
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026 Wing
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* Adea's host adapter over the shared ThemeProvider. The shared provider owns what
|
|
6
|
+
* a selection resolves to and paints (Zeron's appearance semantics, ported there);
|
|
7
|
+
* Adea owns the stored V2 document (`appearance-codec.ts`), the imported-theme
|
|
8
|
+
* library (`custom-theme-library.ts`), the native translucency capability, and the
|
|
9
|
+
* V2 view of the context that the appearance editor and the shell consume. See
|
|
10
|
+
* NOTICE for source and license provenance.
|
|
11
|
+
*/
|
|
12
|
+
import {
|
|
13
|
+
createContext,
|
|
14
|
+
createEffect,
|
|
15
|
+
createSignal,
|
|
16
|
+
useContext,
|
|
17
|
+
type Context,
|
|
18
|
+
type JSX,
|
|
19
|
+
type ParentProps,
|
|
20
|
+
} from 'solid-js'
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
ThemeProvider as UiThemeProvider,
|
|
24
|
+
useOptionalTheme as useOptionalUiTheme,
|
|
25
|
+
type ThemeContextValue as UiThemeContextValue,
|
|
26
|
+
type ThemeProviderProps as UiThemeProviderProps,
|
|
27
|
+
} from '@adea-ai/ui/components/theme/lazy'
|
|
28
|
+
import { defaultPreferenceStorage } from '@adea-ai/ui/lib/preference-store'
|
|
29
|
+
import { tokensAsHex } from '@adea-ai/ui/lib/themes'
|
|
30
|
+
|
|
31
|
+
import {
|
|
32
|
+
APPEARANCE_ACCENT_CONTRAST_FLOOR,
|
|
33
|
+
appearanceThemeScript,
|
|
34
|
+
createAppearancePersistence,
|
|
35
|
+
selectionFromPreferences,
|
|
36
|
+
type AppearancePreferencesV2,
|
|
37
|
+
} from './appearance-preferences'
|
|
38
|
+
import {
|
|
39
|
+
customUiVariants,
|
|
40
|
+
readCustomThemeLibrary,
|
|
41
|
+
subscribeCustomThemes,
|
|
42
|
+
} from './custom-theme-library'
|
|
43
|
+
|
|
44
|
+
export type {
|
|
45
|
+
AppearanceMode,
|
|
46
|
+
AppearancePreferencesV2,
|
|
47
|
+
ResolvedAppearance,
|
|
48
|
+
} from './appearance-preferences'
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The shared theme context plus the V2 document seam the appearance editor works
|
|
52
|
+
* in. Everything the shell reads (the selection, the resolved appearance, the
|
|
53
|
+
* variant, `accentRolesFor`) is the shared context itself; only a V2-shaped write
|
|
54
|
+
* and a V2-shaped draft preview are Adea's.
|
|
55
|
+
*/
|
|
56
|
+
export type AppearanceContextValue = Omit<UiThemeContextValue, 'preview'> & {
|
|
57
|
+
/** Persist a field update immediately (Zeron's `SavePolicy::Immediate`). */
|
|
58
|
+
update: (patch: Partial<AppearancePreferencesV2>) => void
|
|
59
|
+
/**
|
|
60
|
+
* Apply a draft against the visible app without persisting it. A committed change
|
|
61
|
+
* while a draft is open (a zoom chord, the mode toggle) leaves the draft showing.
|
|
62
|
+
*/
|
|
63
|
+
preview: (preferences: AppearancePreferencesV2 | undefined) => void
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
* The imported themes as a reactive source for the provider's `themes` prop. The
|
|
68
|
+
* library lives on the host object; this signal is how a change to it reaches the
|
|
69
|
+
* provider's registry.
|
|
70
|
+
*/
|
|
71
|
+
const [libraryRevision, setLibraryRevision] = createSignal(0)
|
|
72
|
+
let subscribedToLibrary = false
|
|
73
|
+
|
|
74
|
+
function libraryThemes() {
|
|
75
|
+
if (!subscribedToLibrary) {
|
|
76
|
+
subscribedToLibrary = true
|
|
77
|
+
subscribeCustomThemes(() => setLibraryRevision((revision) => revision + 1))
|
|
78
|
+
}
|
|
79
|
+
libraryRevision()
|
|
80
|
+
return customUiVariants()
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Everything the shared provider is told about Adea: where the preference lives, the
|
|
85
|
+
* imported themes, and the policies that make Adea's document what it has always
|
|
86
|
+
* been. A function so a test and the component build the same provider.
|
|
87
|
+
*/
|
|
88
|
+
export function appearanceProviderProps(
|
|
89
|
+
options: { nativeTranslucency?: () => boolean } = {}
|
|
90
|
+
): Omit<UiThemeProviderProps, 'children'> {
|
|
91
|
+
return {
|
|
92
|
+
persistence: createAppearancePersistence(),
|
|
93
|
+
themes: libraryThemes,
|
|
94
|
+
// The web lane has no OS vibrancy and renders tokenized frosted surfaces instead
|
|
95
|
+
// of pretending to it; a desktop host passes its capability.
|
|
96
|
+
surface: { nativeTranslucency: options.nativeTranslucency ?? false },
|
|
97
|
+
// The catalogue palette is `theme-variants.css`; the provider writes only the
|
|
98
|
+
// accent, the terminal pin, the surface alpha, the fonts and imported themes.
|
|
99
|
+
palette: 'stylesheet',
|
|
100
|
+
accentContrastFloor: APPEARANCE_ACCENT_CONTRAST_FLOOR,
|
|
101
|
+
editorRoles: 'floor',
|
|
102
|
+
transformTokens: tokensAsHex,
|
|
103
|
+
disableTransitionOnChange: true,
|
|
104
|
+
fontZoom: true,
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The V2 view of a shared theme context. Reads derive from the provider's selection;
|
|
110
|
+
* writes go through its `setSelection`, so the shared provider remains the only
|
|
111
|
+
* writer of the document and of storage.
|
|
112
|
+
*/
|
|
113
|
+
export function createAppearanceContext(ui: UiThemeContextValue): AppearanceContextValue {
|
|
114
|
+
let draft: AppearancePreferencesV2 | undefined
|
|
115
|
+
|
|
116
|
+
const preview = (next: AppearancePreferencesV2 | undefined) => {
|
|
117
|
+
draft = next
|
|
118
|
+
ui.preview(next ? selectionFromPreferences(next) : undefined)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// The shared provider ends a preview when the selection is committed. The editor's
|
|
122
|
+
// draft is still open, though, so it keeps showing until the editor ends it.
|
|
123
|
+
createEffect(() => {
|
|
124
|
+
ui.selection()
|
|
125
|
+
if (draft !== undefined && !ui.previewing()) ui.preview(selectionFromPreferences(draft))
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
...ui,
|
|
130
|
+
update: (patch) => ui.setSelection(selectionFromPreferences(patch)),
|
|
131
|
+
preview,
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/*
|
|
136
|
+
* The context lives on the global under a registered symbol, like the shared one:
|
|
137
|
+
* a bundle that loads this module twice would otherwise give a provider from one
|
|
138
|
+
* copy and a reader from the other two different context objects.
|
|
139
|
+
*/
|
|
140
|
+
const CONTEXT_KEY = Symbol.for('adea.app.theme')
|
|
141
|
+
type ContextHost = { [CONTEXT_KEY]?: Context<AppearanceContextValue | undefined> }
|
|
142
|
+
|
|
143
|
+
function appearanceContext(): Context<AppearanceContextValue | undefined> {
|
|
144
|
+
const host = globalThis as ContextHost
|
|
145
|
+
return (host[CONTEXT_KEY] ??= createContext<AppearanceContextValue>())
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function AppearanceBridge(props: ParentProps) {
|
|
149
|
+
const ui = useOptionalUiTheme()
|
|
150
|
+
if (!ui) throw new Error('The appearance bridge must render inside the shared ThemeProvider.')
|
|
151
|
+
const Context = appearanceContext()
|
|
152
|
+
return <Context.Provider value={createAppearanceContext(ui)}>{props.children}</Context.Provider>
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
type ThemeProviderProps = ParentProps<{
|
|
156
|
+
/**
|
|
157
|
+
* Whether the host window can render OS translucency. The web lane keeps
|
|
158
|
+
* the default `false` and renders tokenized frosted surfaces instead of
|
|
159
|
+
* pretending to OS vibrancy.
|
|
160
|
+
*/
|
|
161
|
+
nativeTranslucency?: boolean
|
|
162
|
+
}>
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Adea's appearance provider: the shared ThemeProvider configured for Adea's V2
|
|
166
|
+
* document, with the V2 context on top. It owns the versioned appearance preference
|
|
167
|
+
* (mode, independent light/dark themes, accent, surface) and applies it to the
|
|
168
|
+
* document.
|
|
169
|
+
*/
|
|
170
|
+
export function ThemeProvider(props: ThemeProviderProps) {
|
|
171
|
+
// Imported themes must be in the registry before the first resolution, or a
|
|
172
|
+
// stored custom selection falls back to the default on mount.
|
|
173
|
+
readCustomThemeLibrary(defaultPreferenceStorage())
|
|
174
|
+
return (
|
|
175
|
+
<UiThemeProvider
|
|
176
|
+
{...appearanceProviderProps({ nativeTranslucency: () => props.nativeTranslucency ?? false })}
|
|
177
|
+
>
|
|
178
|
+
<AppearanceBridge>{props.children}</AppearanceBridge>
|
|
179
|
+
</UiThemeProvider>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The appearance editor's view of the context: the shared context with the V2
|
|
185
|
+
* `update` and `preview` seam. Shell code that only reads the theme (the selection,
|
|
186
|
+
* the variant, `accentRolesFor`) uses the shared `useOptionalTheme` of
|
|
187
|
+
* `@adea-ai/ui/components/theme` instead.
|
|
188
|
+
*/
|
|
189
|
+
export function useTheme(): AppearanceContextValue {
|
|
190
|
+
const context = useContext(appearanceContext())
|
|
191
|
+
if (!context) {
|
|
192
|
+
throw new Error('useTheme must be used within a ThemeProvider.')
|
|
193
|
+
}
|
|
194
|
+
return context
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Pre-paint appearance restore for server-rendered documents. Rendered in the
|
|
199
|
+
* document head, it resolves the stored preference against the OS
|
|
200
|
+
* and applies the document state before first paint so hydration never shows the
|
|
201
|
+
* wrong theme.
|
|
202
|
+
*/
|
|
203
|
+
export function ThemeScript(): JSX.Element {
|
|
204
|
+
return <script innerHTML={appearanceThemeScript()} />
|
|
205
|
+
}
|