@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,158 @@
|
|
|
1
|
+
import { assertInstallerContext } from "./installer-layout.js";
|
|
2
|
+
import { realpath } from "node:fs/promises";
|
|
3
|
+
import { execFile } from "node:child_process";
|
|
4
|
+
import { promisify } from "node:util";
|
|
5
|
+
import { FFIType, dlopen, ptr } from "bun:ffi";
|
|
6
|
+
// src/installer/installer-process-cleanup.ts
|
|
7
|
+
var execute = promisify(execFile);
|
|
8
|
+
/** Terminate only the verified app runtime process on a disposable runner. */
|
|
9
|
+
async function terminateGuardedWorker(options) {
|
|
10
|
+
const { pid, runtime, platform } = options;
|
|
11
|
+
assertInstallerContext(options.env, platform, process.platform, process.arch);
|
|
12
|
+
if (!Number.isSafeInteger(pid) || pid < 2 || pid === process.pid) throw new Error("Invalid guarded process identity");
|
|
13
|
+
const env = {};
|
|
14
|
+
for (const name of [
|
|
15
|
+
"PATH",
|
|
16
|
+
"SystemRoot",
|
|
17
|
+
"WINDIR",
|
|
18
|
+
"COMSPEC",
|
|
19
|
+
"PATHEXT",
|
|
20
|
+
"TMP",
|
|
21
|
+
"TEMP",
|
|
22
|
+
"TMPDIR",
|
|
23
|
+
"LANG",
|
|
24
|
+
"LC_ALL"
|
|
25
|
+
]) if (options.env[name]) env[name] = options.env[name];
|
|
26
|
+
const expected = await realpath(runtime);
|
|
27
|
+
const actual = await runningExecutable(pid, platform, env);
|
|
28
|
+
if (actual === void 0) return;
|
|
29
|
+
if (actual !== EXITING) {
|
|
30
|
+
if (platform === "windows-x64" ? actual.toLowerCase() !== expected.toLowerCase() : actual !== expected) throw new Error("Guarded process executable mismatch");
|
|
31
|
+
process.kill(pid, "SIGKILL");
|
|
32
|
+
}
|
|
33
|
+
const deadline = Date.now() + 5e3;
|
|
34
|
+
while (Date.now() < deadline) {
|
|
35
|
+
if (platform === "macos-arm64" ? await macosWorkerExited(() => readMacosState(pid, env)) : await runningExecutable(pid, platform, env) === void 0) return;
|
|
36
|
+
await Bun.sleep(100);
|
|
37
|
+
}
|
|
38
|
+
throw new Error("Guarded process did not exit");
|
|
39
|
+
}
|
|
40
|
+
var EXITING = Symbol("exiting");
|
|
41
|
+
/**
|
|
42
|
+
* Read one `ps -o stat= -o comm=` line. macOS reports the command of a process that is
|
|
43
|
+
* exiting (`E`) or an unreaped zombie (`Z`) as `(bun)` or `<defunct>`, not an executable
|
|
44
|
+
* path. A zombie has already exited and cannot be killed; an exiting process is pending.
|
|
45
|
+
*/
|
|
46
|
+
function macosProcess(line) {
|
|
47
|
+
const match = /^(\S+)\s+(.+)$/.exec(line.trim());
|
|
48
|
+
if (!match) throw new Error("Unable to query guarded process state");
|
|
49
|
+
const [, state, command] = match;
|
|
50
|
+
if (state.startsWith("Z")) return void 0;
|
|
51
|
+
if (state.includes("E") || !command.startsWith("/")) return EXITING;
|
|
52
|
+
return command;
|
|
53
|
+
}
|
|
54
|
+
/** An absent or zombie process has exited; an exiting process is still pending. */
|
|
55
|
+
async function macosWorkerExited(readState) {
|
|
56
|
+
const state = (await readState())?.trim();
|
|
57
|
+
if (state === void 0) return true;
|
|
58
|
+
if (!/^\S+$/.test(state)) throw new Error("Unable to query guarded process state");
|
|
59
|
+
return state.startsWith("Z");
|
|
60
|
+
}
|
|
61
|
+
async function readMacosState(pid, env) {
|
|
62
|
+
return (await execute("/bin/ps", [
|
|
63
|
+
"-p",
|
|
64
|
+
String(pid),
|
|
65
|
+
"-o",
|
|
66
|
+
"stat="
|
|
67
|
+
], {
|
|
68
|
+
env,
|
|
69
|
+
timeout: 5e3,
|
|
70
|
+
maxBuffer: 16384
|
|
71
|
+
}).catch((error) => {
|
|
72
|
+
if (error.code === 1) return void 0;
|
|
73
|
+
throw error;
|
|
74
|
+
}))?.stdout;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The executable of a running process, or undefined once it has exited. On Windows
|
|
78
|
+
* an exited process stays openable while another process holds a handle to it (the
|
|
79
|
+
* Electrobun extractor that launched it), so a signal-0 probe would still report it
|
|
80
|
+
* alive; its exit code tells the truth.
|
|
81
|
+
*/
|
|
82
|
+
async function runningExecutable(pid, platform, env) {
|
|
83
|
+
if (platform === "linux-x64") return realpath(`/proc/${pid}/exe`).catch((error) => {
|
|
84
|
+
if (error.code === "ENOENT") return void 0;
|
|
85
|
+
throw error;
|
|
86
|
+
});
|
|
87
|
+
if (platform === "macos-arm64") {
|
|
88
|
+
const listed = await execute("/bin/ps", [
|
|
89
|
+
"-p",
|
|
90
|
+
String(pid),
|
|
91
|
+
"-o",
|
|
92
|
+
"stat=",
|
|
93
|
+
"-o",
|
|
94
|
+
"comm="
|
|
95
|
+
], {
|
|
96
|
+
env,
|
|
97
|
+
timeout: 5e3,
|
|
98
|
+
maxBuffer: 16384
|
|
99
|
+
}).catch((error) => {
|
|
100
|
+
if (error.code === 1) return void 0;
|
|
101
|
+
throw error;
|
|
102
|
+
});
|
|
103
|
+
if (!listed) return void 0;
|
|
104
|
+
const state = macosProcess(listed.stdout);
|
|
105
|
+
return state === EXITING || state === void 0 ? state : realpath(state);
|
|
106
|
+
}
|
|
107
|
+
return windowsRunningExecutable(pid);
|
|
108
|
+
}
|
|
109
|
+
var PROCESS_QUERY_LIMITED_INFORMATION = 4096;
|
|
110
|
+
var STILL_ACTIVE = 259;
|
|
111
|
+
/** Ask the kernel directly: an exited process keeps no STILL_ACTIVE exit code even while
|
|
112
|
+
* another process holds a handle to it. */
|
|
113
|
+
async function windowsRunningExecutable(pid) {
|
|
114
|
+
const kernel = dlopen("kernel32.dll", {
|
|
115
|
+
OpenProcess: {
|
|
116
|
+
args: [
|
|
117
|
+
FFIType.u32,
|
|
118
|
+
FFIType.i32,
|
|
119
|
+
FFIType.u32
|
|
120
|
+
],
|
|
121
|
+
returns: FFIType.ptr
|
|
122
|
+
},
|
|
123
|
+
GetExitCodeProcess: {
|
|
124
|
+
args: [FFIType.ptr, FFIType.ptr],
|
|
125
|
+
returns: FFIType.i32
|
|
126
|
+
},
|
|
127
|
+
QueryFullProcessImageNameW: {
|
|
128
|
+
args: [
|
|
129
|
+
FFIType.ptr,
|
|
130
|
+
FFIType.u32,
|
|
131
|
+
FFIType.ptr,
|
|
132
|
+
FFIType.ptr
|
|
133
|
+
],
|
|
134
|
+
returns: FFIType.i32
|
|
135
|
+
},
|
|
136
|
+
CloseHandle: {
|
|
137
|
+
args: [FFIType.ptr],
|
|
138
|
+
returns: FFIType.i32
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
try {
|
|
142
|
+
const handle = kernel.symbols.OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, 0, pid);
|
|
143
|
+
if (!handle) return void 0;
|
|
144
|
+
try {
|
|
145
|
+
const code = /* @__PURE__ */ new Uint32Array(1);
|
|
146
|
+
if (!kernel.symbols.GetExitCodeProcess(handle, ptr(code))) throw new Error("Unable to query guarded process state");
|
|
147
|
+
if (code[0] !== STILL_ACTIVE) return void 0;
|
|
148
|
+
const name = /* @__PURE__ */ new Uint16Array(32768), length = new Uint32Array([name.length]);
|
|
149
|
+
if (!kernel.symbols.QueryFullProcessImageNameW(handle, 0, ptr(name), ptr(length))) throw new Error("Unable to query guarded process executable");
|
|
150
|
+
return realpath(Buffer.from(name.buffer, 0, length[0] * 2).toString("utf16le"));
|
|
151
|
+
} finally {
|
|
152
|
+
kernel.symbols.CloseHandle(handle);
|
|
153
|
+
}
|
|
154
|
+
} finally {
|
|
155
|
+
kernel.close();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
export { macosProcess, macosWorkerExited, terminateGuardedWorker };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type InstallerReceipt } from '../release/release-qualification';
|
|
2
|
+
import type { InstallerPlatform, InstallerRenderer } from './installer-layout';
|
|
3
|
+
/** Qualify one platform in the trusted release-assets workflow and stage its receipt. */
|
|
4
|
+
export declare function qualifyInstallerCommand(options: {
|
|
5
|
+
env: Record<string, string | undefined>;
|
|
6
|
+
config: unknown;
|
|
7
|
+
tag: string;
|
|
8
|
+
platform: InstallerPlatform;
|
|
9
|
+
renderer: InstallerRenderer;
|
|
10
|
+
directory: string;
|
|
11
|
+
}): Promise<InstallerReceipt>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { validateInstallerReceipt } from "../release/release-qualification.js";
|
|
2
|
+
import { parseReleaseConfig } from "../release/release-config.js";
|
|
3
|
+
import { planReleaseAssets } from "../release/release-assets-plan.js";
|
|
4
|
+
import { observeInstalledApp } from "./installer-observation.js";
|
|
5
|
+
import { lstat, writeFile } from "node:fs/promises";
|
|
6
|
+
import { join, resolve } from "node:path";
|
|
7
|
+
// src/installer/installer-qualification-command.ts
|
|
8
|
+
/** Qualify one platform in the trusted release-assets workflow and stage its receipt. */
|
|
9
|
+
async function qualifyInstallerCommand(options) {
|
|
10
|
+
const { env, config, tag, platform, renderer } = options;
|
|
11
|
+
if (![
|
|
12
|
+
"macos-arm64",
|
|
13
|
+
"windows-x64",
|
|
14
|
+
"linux-x64"
|
|
15
|
+
].includes(platform) || !["native", "cef"].includes(renderer) || typeof config !== "object" || config === null || Array.isArray(config) || typeof config.appName !== "string" || typeof config.appId !== "string") throw new Error("Invalid installer qualification context");
|
|
16
|
+
if (env.RELEASE_TAG !== tag) throw new Error("Installer release tag mismatch");
|
|
17
|
+
const plan = await planReleaseAssets({
|
|
18
|
+
env,
|
|
19
|
+
config,
|
|
20
|
+
tag
|
|
21
|
+
});
|
|
22
|
+
if (env.SOURCE_SHA !== plan.sourceSha) throw new Error("Installer source identity mismatch");
|
|
23
|
+
const parsed = parseReleaseConfig(config), requirements = parsed.requirements(tag), policy = requirements.offlinePolicy, names = requirements.platforms[platform];
|
|
24
|
+
if (!policy || !names || names.length !== 2) throw new Error("Installer qualification requires an explicit offline policy and payloads");
|
|
25
|
+
const directory = resolve(options.directory), destination = join(directory, `installer-test-${platform}.json`);
|
|
26
|
+
try {
|
|
27
|
+
await lstat(destination);
|
|
28
|
+
throw new Error("Installer receipt already exists");
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (error.code !== "ENOENT") throw error;
|
|
31
|
+
}
|
|
32
|
+
const app = config;
|
|
33
|
+
const result = await observeInstalledApp({
|
|
34
|
+
env,
|
|
35
|
+
platform,
|
|
36
|
+
renderer,
|
|
37
|
+
appName: app.appName,
|
|
38
|
+
appId: app.appId,
|
|
39
|
+
version: plan.version,
|
|
40
|
+
installer: join(directory, names[0]),
|
|
41
|
+
archive: join(directory, names[1]),
|
|
42
|
+
expectedReads: parsed.expectedReads,
|
|
43
|
+
offlinePolicy: policy,
|
|
44
|
+
sidecars: parsed.sidecars
|
|
45
|
+
});
|
|
46
|
+
if (!result.evidence) throw new Error("Missing measured offline evidence");
|
|
47
|
+
const identity = {
|
|
48
|
+
tag,
|
|
49
|
+
sourceSha: plan.sourceSha,
|
|
50
|
+
workflowSha: plan.workflowSha,
|
|
51
|
+
runId: env.GITHUB_RUN_ID,
|
|
52
|
+
runAttempt: Number(env.GITHUB_RUN_ATTEMPT)
|
|
53
|
+
};
|
|
54
|
+
const receipt = {
|
|
55
|
+
schema: 2,
|
|
56
|
+
...identity,
|
|
57
|
+
platform,
|
|
58
|
+
installed: true,
|
|
59
|
+
launched: true,
|
|
60
|
+
rendererReady: true,
|
|
61
|
+
rendererEvidence: result.evidence,
|
|
62
|
+
assets: result.artifacts
|
|
63
|
+
};
|
|
64
|
+
validateInstallerReceipt(identity, receipt, platform, names, result.artifacts, policy);
|
|
65
|
+
await writeFile(destination, JSON.stringify(receipt, null, 2) + "\n", {
|
|
66
|
+
flag: "wx",
|
|
67
|
+
mode: 384
|
|
68
|
+
});
|
|
69
|
+
return receipt;
|
|
70
|
+
}
|
|
71
|
+
export { qualifyInstallerCommand };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type OfflinePolicy } from '../release/release-qualification';
|
|
2
|
+
/** Renderer observations only. Installer identity, startup guard and offline behavior
|
|
3
|
+
* must be independently verified before an installer receipt can be issued. */
|
|
4
|
+
export type InstallerRendererObservation = {
|
|
5
|
+
samples: number;
|
|
6
|
+
elapsedMs: number;
|
|
7
|
+
visible: boolean;
|
|
8
|
+
readyState: string;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
interactiveElements: number;
|
|
12
|
+
textLength: number;
|
|
13
|
+
markerObserved?: boolean;
|
|
14
|
+
foreignBlocked?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function assertInstallerRendererObservation(value: unknown, offline?: boolean): asserts value is InstallerRendererObservation;
|
|
17
|
+
/** Wrap the installed host's handler on the nonce-bound loopback origin. */
|
|
18
|
+
export declare function createInstallerRendererHandler(options: {
|
|
19
|
+
env: Record<string, string | undefined>;
|
|
20
|
+
origin: string;
|
|
21
|
+
nonce: string;
|
|
22
|
+
offlinePolicy?: OfflinePolicy;
|
|
23
|
+
foreignOrigin?: string;
|
|
24
|
+
handle(request: Request): Response | Promise<Response>;
|
|
25
|
+
save(value: InstallerRendererObservation, state: {
|
|
26
|
+
bootstrapDenied: boolean;
|
|
27
|
+
}): void | Promise<void>;
|
|
28
|
+
}): (request: Request) => Promise<Response>;
|
|
29
|
+
/** Intercept the one expected Bun.serve listener before importing the app worker. */
|
|
30
|
+
export declare function installInstallerRendererProbe(options: {
|
|
31
|
+
env: Record<string, string | undefined>;
|
|
32
|
+
origin: string;
|
|
33
|
+
nonce: string;
|
|
34
|
+
allowEphemeral?: boolean;
|
|
35
|
+
offlinePolicy?: OfflinePolicy;
|
|
36
|
+
foreignOrigin?: string;
|
|
37
|
+
runtime: {
|
|
38
|
+
serve: (...args: any[]) => any;
|
|
39
|
+
};
|
|
40
|
+
save(value: InstallerRendererObservation, state: {
|
|
41
|
+
bootstrapDenied: boolean;
|
|
42
|
+
}): void | Promise<void>;
|
|
43
|
+
}): void;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { assertHostedRunner } from "./hosted-runner.js";
|
|
2
|
+
import { parseOfflinePolicy } from "../release/release-qualification.js";
|
|
3
|
+
// src/installer/installer-renderer-evidence.ts
|
|
4
|
+
function safeScriptString(value) {
|
|
5
|
+
return JSON.stringify(value).replaceAll("<", "\\u003c").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029");
|
|
6
|
+
}
|
|
7
|
+
function assertInstallerRendererObservation(value, offline = false) {
|
|
8
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error("Invalid renderer observation");
|
|
9
|
+
const item = value;
|
|
10
|
+
const keys = [
|
|
11
|
+
"samples",
|
|
12
|
+
"elapsedMs",
|
|
13
|
+
"visible",
|
|
14
|
+
"readyState",
|
|
15
|
+
"width",
|
|
16
|
+
"height",
|
|
17
|
+
"interactiveElements",
|
|
18
|
+
"textLength",
|
|
19
|
+
...offline ? ["markerObserved", "foreignBlocked"] : []
|
|
20
|
+
];
|
|
21
|
+
if (offline && (item.markerObserved !== true || item.foreignBlocked !== true) || Object.keys(item).length !== keys.length || keys.some((key) => !Object.hasOwn(item, key)) || item.samples !== 2 || typeof item.elapsedMs !== "number" || !Number.isFinite(item.elapsedMs) || item.elapsedMs < 3e3 || item.elapsedMs > 12e4 || item.visible !== true || !["interactive", "complete"].includes(String(item.readyState)) || typeof item.width !== "number" || !Number.isFinite(item.width) || item.width < 100 || typeof item.height !== "number" || !Number.isFinite(item.height) || item.height < 100 || !Number.isSafeInteger(item.interactiveElements) || Number(item.interactiveElements) < 1 || !Number.isSafeInteger(item.textLength) || Number(item.textLength) < 1) throw new Error("Incomplete renderer observation");
|
|
22
|
+
}
|
|
23
|
+
async function boundedBody(message, maximum) {
|
|
24
|
+
const declared = message.headers.get("content-length");
|
|
25
|
+
if (declared !== null && (!/^\d+$/.test(declared) || Number(declared) > maximum)) throw new Error("Renderer body exceeds bound");
|
|
26
|
+
if (!message.body) throw new Error("Missing renderer body");
|
|
27
|
+
const reader = message.body.getReader(), chunks = [];
|
|
28
|
+
let size = 0;
|
|
29
|
+
try {
|
|
30
|
+
while (true) {
|
|
31
|
+
const next = await reader.read();
|
|
32
|
+
if (next.done) break;
|
|
33
|
+
size += next.value.length;
|
|
34
|
+
if (size > maximum) {
|
|
35
|
+
await reader.cancel();
|
|
36
|
+
throw new Error("Renderer body exceeds bound");
|
|
37
|
+
}
|
|
38
|
+
chunks.push(next.value);
|
|
39
|
+
}
|
|
40
|
+
} finally {
|
|
41
|
+
reader.releaseLock();
|
|
42
|
+
}
|
|
43
|
+
const bytes = new Uint8Array(size);
|
|
44
|
+
let offset = 0;
|
|
45
|
+
for (const chunk of chunks) {
|
|
46
|
+
bytes.set(chunk, offset);
|
|
47
|
+
offset += chunk.length;
|
|
48
|
+
}
|
|
49
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
50
|
+
}
|
|
51
|
+
function probeScript(nonce, policy, foreignOrigin) {
|
|
52
|
+
return `<script>(()=>{const started=performance.now();requestAnimationFrame(()=>{setTimeout(()=>requestAnimationFrame(async()=>{const d=document;const data={samples:2,elapsedMs:performance.now()-started,visible:d.visibilityState==='visible',readyState:d.readyState,width:innerWidth,height:innerHeight,interactiveElements:d.querySelectorAll('button,input,textarea,select,a[href],[role="button"]').length,textLength:(d.body?.innerText||'').trim().length};${policy ? `data.markerObserved=(d.body?.innerText||'').includes(${safeScriptString(policy.marker)});try{await fetch(${safeScriptString(foreignOrigin)}+'/',{mode:'no-cors',cache:'no-store'});data.foreignBlocked=false}catch{data.foreignBlocked=true}` : ""};fetch('/__framework_installer_probe/${nonce}',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(data),redirect:'error'}).catch(()=>{});}),3100);});})();<\/script>`;
|
|
53
|
+
}
|
|
54
|
+
/** Wrap the installed host's handler on the nonce-bound loopback origin. */
|
|
55
|
+
function createInstallerRendererHandler(options) {
|
|
56
|
+
assertHostedRunner(options.env, "Renderer probe");
|
|
57
|
+
const origin = new URL(options.origin);
|
|
58
|
+
if (origin.protocol !== "http:" || origin.hostname !== "127.0.0.1" || !origin.port || origin.origin !== options.origin || !/^[a-f0-9]{48}$/.test(options.nonce)) throw new Error("Invalid renderer probe context");
|
|
59
|
+
const policy = options.offlinePolicy === void 0 ? void 0 : parseOfflinePolicy(options.offlinePolicy);
|
|
60
|
+
if (policy) {
|
|
61
|
+
if (!options.foreignOrigin) throw new Error("Missing foreign network sentinel");
|
|
62
|
+
const foreign = new URL(options.foreignOrigin);
|
|
63
|
+
if (foreign.protocol !== "http:" || foreign.hostname !== "127.0.0.1" || !foreign.port || foreign.origin !== options.foreignOrigin || foreign.origin === origin.origin) throw new Error("Invalid foreign network sentinel");
|
|
64
|
+
} else if (options.foreignOrigin !== void 0) throw new Error("Unexpected foreign network sentinel");
|
|
65
|
+
const path = `/__framework_installer_probe/${options.nonce}`;
|
|
66
|
+
let documentServed = false, received = false, bootstrapDenied = false;
|
|
67
|
+
return async (request) => {
|
|
68
|
+
const url = new URL(request.url);
|
|
69
|
+
if (url.origin !== options.origin || request.headers.get("host") !== origin.host) return new Response(null, { status: 403 });
|
|
70
|
+
if (policy?.kind === "local-bootstrap" && url.pathname === policy.path) {
|
|
71
|
+
if (request.headers.get("origin") === options.origin && [null, "same-origin"].includes(request.headers.get("sec-fetch-site"))) bootstrapDenied = true;
|
|
72
|
+
return new Response(null, { status: 503 });
|
|
73
|
+
}
|
|
74
|
+
if (url.pathname.startsWith("/__framework_installer_probe/")) {
|
|
75
|
+
if (url.pathname !== path || url.search || request.method !== "POST" || request.headers.get("origin") !== options.origin || ![null, "same-origin"].includes(request.headers.get("sec-fetch-site")) || request.headers.get("content-type") !== "application/json" || !documentServed || received) return new Response(null, { status: 403 });
|
|
76
|
+
received = true;
|
|
77
|
+
try {
|
|
78
|
+
const value = JSON.parse(await boundedBody(request, 4096));
|
|
79
|
+
assertInstallerRendererObservation(value, Boolean(policy));
|
|
80
|
+
await options.save(value, { bootstrapDenied });
|
|
81
|
+
return new Response(null, { status: 204 });
|
|
82
|
+
} catch {
|
|
83
|
+
return new Response(null, { status: 400 });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const response = await options.handle(request);
|
|
87
|
+
if (request.method !== "GET" || url.pathname !== "/" || url.search || response.status !== 200 || !/^text\/html\b/i.test(response.headers.get("content-type") ?? "")) return response;
|
|
88
|
+
if (response.headers.has("content-encoding")) throw new Error("Encoded renderer documents are unsupported");
|
|
89
|
+
const html = await boundedBody(response, 2097152);
|
|
90
|
+
if (!html.includes("</body>")) throw new Error("Invalid renderer document");
|
|
91
|
+
documentServed = true;
|
|
92
|
+
const headers = new Headers(response.headers);
|
|
93
|
+
headers.delete("content-length");
|
|
94
|
+
headers.delete("content-encoding");
|
|
95
|
+
headers.delete("etag");
|
|
96
|
+
headers.append("content-security-policy", "default-src 'self' data:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data: blob:; media-src 'self' data: blob:; font-src 'self' data:; frame-src 'none'; object-src 'none'; base-uri 'none'");
|
|
97
|
+
return new Response(html.replace("</body>", probeScript(options.nonce, policy, options.foreignOrigin) + "</body>"), {
|
|
98
|
+
status: response.status,
|
|
99
|
+
statusText: response.statusText,
|
|
100
|
+
headers
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/** Intercept the one expected Bun.serve listener before importing the app worker. */
|
|
105
|
+
function installInstallerRendererProbe(options) {
|
|
106
|
+
const { runtime } = options;
|
|
107
|
+
const original = runtime.serve;
|
|
108
|
+
if (typeof original !== "function") throw new Error("Missing Bun server implementation");
|
|
109
|
+
let used = false;
|
|
110
|
+
const port = Number(new URL(options.origin).port);
|
|
111
|
+
const replace = function(config) {
|
|
112
|
+
if (!config || config.hostname !== "127.0.0.1" || Number(config.port) !== port && !(options.allowEphemeral === true && config.port === 0)) return original.call(runtime, config);
|
|
113
|
+
if (used || typeof config.fetch !== "function") throw new Error("Unexpected renderer probe listener");
|
|
114
|
+
used = true;
|
|
115
|
+
const fetch = config.fetch;
|
|
116
|
+
let activeServer;
|
|
117
|
+
const handler = createInstallerRendererHandler({
|
|
118
|
+
...options,
|
|
119
|
+
handle: (request) => fetch(request, activeServer)
|
|
120
|
+
});
|
|
121
|
+
return original.call(runtime, {
|
|
122
|
+
...config,
|
|
123
|
+
port,
|
|
124
|
+
fetch(request, server) {
|
|
125
|
+
activeServer = server;
|
|
126
|
+
return handler(request);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
createInstallerRendererHandler({
|
|
131
|
+
...options,
|
|
132
|
+
handle: () => new Response()
|
|
133
|
+
});
|
|
134
|
+
if (!Reflect.set(runtime, "serve", replace) || runtime.serve !== replace) throw new Error("Cannot install renderer probe");
|
|
135
|
+
}
|
|
136
|
+
export { assertInstallerRendererObservation, createInstallerRendererHandler, installInstallerRendererProbe };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { InstallerPlatform, InstallerRenderer } from './installer-layout';
|
|
2
|
+
import type { RendererEvidence } from '../release/release-qualification';
|
|
3
|
+
import type { FetchFunction } from '../updates/release-location';
|
|
4
|
+
import { type ReleaseDescriptor } from '../updates/signed-release';
|
|
5
|
+
export type UpgradeReceipt = {
|
|
6
|
+
schema: 1;
|
|
7
|
+
tag: string;
|
|
8
|
+
platform: InstallerPlatform;
|
|
9
|
+
from: {
|
|
10
|
+
tag: string;
|
|
11
|
+
version: string;
|
|
12
|
+
channel: ReleaseDescriptor['channel'];
|
|
13
|
+
};
|
|
14
|
+
to: {
|
|
15
|
+
version: string;
|
|
16
|
+
channel: ReleaseDescriptor['channel'];
|
|
17
|
+
};
|
|
18
|
+
installed: true;
|
|
19
|
+
updated: true;
|
|
20
|
+
rendererEvidence?: RendererEvidence;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Prove in the trusted release-assets workflow that an installation of the newest published
|
|
24
|
+
* release takes this release's signed update: install the previous version with its own
|
|
25
|
+
* installer, stage and swap in this payload as the app's updater does, and observe the new
|
|
26
|
+
* version start. Returns null when no earlier release has been published for this platform.
|
|
27
|
+
*/
|
|
28
|
+
export declare function qualifyUpgradeCommand(options: {
|
|
29
|
+
env: Record<string, string | undefined>;
|
|
30
|
+
config: unknown;
|
|
31
|
+
tag: string;
|
|
32
|
+
platform: InstallerPlatform;
|
|
33
|
+
renderer: InstallerRenderer;
|
|
34
|
+
directory: string;
|
|
35
|
+
onStage?: (stage: string) => void;
|
|
36
|
+
fetch?: FetchFunction;
|
|
37
|
+
}): Promise<UpgradeReceipt | null>;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { verifyReleaseDescriptor } from "../updates/signed-release.js";
|
|
2
|
+
import { feedUrl } from "../updates/release-feed.js";
|
|
3
|
+
import { parseReleaseConfig } from "../release/release-config.js";
|
|
4
|
+
import { planReleaseAssets } from "../release/release-assets-plan.js";
|
|
5
|
+
import { versionLessThan } from "../updates/release-version.js";
|
|
6
|
+
import { observeInstalledApp } from "./installer-observation.js";
|
|
7
|
+
import { downloadAsset } from "./upgrade-asset-download.js";
|
|
8
|
+
import { discoverSignedRelease } from "../updates/update-discovery.js";
|
|
9
|
+
import { downloadVerifiedRelease } from "../updates/update-download.js";
|
|
10
|
+
import { lstat, mkdir, open, rename, writeFile } from "node:fs/promises";
|
|
11
|
+
import { join, resolve } from "node:path";
|
|
12
|
+
// src/installer/installer-upgrade-command.ts
|
|
13
|
+
var MAX_COMPRESSED_BYTES = 1073741824;
|
|
14
|
+
var MAX_EXPANDED_BYTES = 4294967296;
|
|
15
|
+
var targets = {
|
|
16
|
+
"macos-arm64": ["darwin", "arm64"],
|
|
17
|
+
"windows-x64": ["win32", "x64"],
|
|
18
|
+
"linux-x64": ["linux", "x64"]
|
|
19
|
+
};
|
|
20
|
+
var object = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21
|
+
/** The channel descriptor the app discovers for `platform`, as the release config names it. */
|
|
22
|
+
function discoveryName(config, channel, platform) {
|
|
23
|
+
const names = config[`${channel}DiscoveryAssets`], policies = config.descriptors;
|
|
24
|
+
if (!Array.isArray(names) || !object(policies)) throw new Error("Invalid discovery policy");
|
|
25
|
+
const [os, arch] = targets[platform];
|
|
26
|
+
const matches = names.filter((name) => {
|
|
27
|
+
const policy = typeof name === "string" ? policies[name] : void 0;
|
|
28
|
+
return object(policy) && policy.channel === channel && policy.platform === os && policy.arch === arch;
|
|
29
|
+
});
|
|
30
|
+
if (matches.length !== 1 || matches[0].includes("{tag}")) throw new Error("Invalid discovery policy");
|
|
31
|
+
return matches[0];
|
|
32
|
+
}
|
|
33
|
+
async function readBounded(path, maximum) {
|
|
34
|
+
const info = await lstat(path);
|
|
35
|
+
if (!info.isFile() || info.isSymbolicLink() || info.size < 1 || info.size > maximum) throw new Error("Invalid staged descriptor");
|
|
36
|
+
const file = await open(path, "r");
|
|
37
|
+
try {
|
|
38
|
+
return await file.readFile("utf8");
|
|
39
|
+
} finally {
|
|
40
|
+
await file.close();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Prove in the trusted release-assets workflow that an installation of the newest published
|
|
45
|
+
* release takes this release's signed update: install the previous version with its own
|
|
46
|
+
* installer, stage and swap in this payload as the app's updater does, and observe the new
|
|
47
|
+
* version start. Returns null when no earlier release has been published for this platform.
|
|
48
|
+
*/
|
|
49
|
+
async function qualifyUpgradeCommand(options) {
|
|
50
|
+
const { env, config, tag, platform, renderer } = options;
|
|
51
|
+
if (!Object.hasOwn(targets, platform) || !["native", "cef"].includes(renderer) || !object(config) || typeof config.appName !== "string" || typeof config.appId !== "string" || !object(config.releaseSigningKeys) || typeof env.GITHUB_REPOSITORY !== "string") throw new Error("Invalid upgrade qualification context");
|
|
52
|
+
if (env.RELEASE_TAG !== tag) throw new Error("Upgrade release tag mismatch");
|
|
53
|
+
const plan = await planReleaseAssets({
|
|
54
|
+
env,
|
|
55
|
+
config,
|
|
56
|
+
tag
|
|
57
|
+
});
|
|
58
|
+
if (env.SOURCE_SHA !== plan.sourceSha) throw new Error("Upgrade source identity mismatch");
|
|
59
|
+
const parsed = parseReleaseConfig(config), feed = feedUrl(parsed.feed), requirements = parsed.requirements(tag), names = requirements.platforms[platform];
|
|
60
|
+
if (!requirements.offlinePolicy || !names || names.length !== 2) throw new Error("Upgrade qualification requires an explicit offline policy and payloads");
|
|
61
|
+
const directory = resolve(options.directory), destination = join(directory, `upgrade-test-${platform}.json`);
|
|
62
|
+
try {
|
|
63
|
+
await lstat(destination);
|
|
64
|
+
throw new Error("Upgrade receipt already exists");
|
|
65
|
+
} catch (error) {
|
|
66
|
+
if (error.code !== "ENOENT") throw error;
|
|
67
|
+
}
|
|
68
|
+
const keys = /* @__PURE__ */ new Map();
|
|
69
|
+
for (const [id, value] of Object.entries(config.releaseSigningKeys)) if (typeof value === "string") keys.set(id, value);
|
|
70
|
+
const base = {
|
|
71
|
+
appId: config.appId,
|
|
72
|
+
repository: env.GITHUB_REPOSITORY,
|
|
73
|
+
platform: targets[platform][0],
|
|
74
|
+
arch: targets[platform][1],
|
|
75
|
+
feed,
|
|
76
|
+
keys
|
|
77
|
+
};
|
|
78
|
+
const channel = tag.includes("-dev.") ? "dev" : "daily";
|
|
79
|
+
const trust = {
|
|
80
|
+
...base,
|
|
81
|
+
channel
|
|
82
|
+
};
|
|
83
|
+
const signed = JSON.parse(await readBounded(join(directory, discoveryName(config, channel, platform)), 65536));
|
|
84
|
+
const verified = verifyReleaseDescriptor(signed, trust);
|
|
85
|
+
if (!verified.ok || verified.descriptor.tag !== tag || verified.descriptor.asset.name !== names[1]) throw new Error("Untrusted staged descriptor");
|
|
86
|
+
const descriptor = verified.descriptor;
|
|
87
|
+
const fetcher = options.fetch ?? fetch;
|
|
88
|
+
let previous;
|
|
89
|
+
for (const from of channel === "dev" ? ["dev"] : ["daily", "dev"]) try {
|
|
90
|
+
previous = await discoverSignedRelease({
|
|
91
|
+
trust: {
|
|
92
|
+
...base,
|
|
93
|
+
channel: from
|
|
94
|
+
},
|
|
95
|
+
discoveryName: discoveryName(config, from, platform),
|
|
96
|
+
timeoutMs: 3e4,
|
|
97
|
+
fetch: fetcher,
|
|
98
|
+
olderThan: descriptor.version
|
|
99
|
+
});
|
|
100
|
+
break;
|
|
101
|
+
} catch (error) {
|
|
102
|
+
if (error.message !== "No qualified channel descriptor is available") throw error;
|
|
103
|
+
}
|
|
104
|
+
if (!previous) return null;
|
|
105
|
+
if (previous.tag === tag || !versionLessThan(previous.version, descriptor.version)) throw new Error("Previous release is not older than this release");
|
|
106
|
+
const work = join(directory, `upgrade-${platform}`);
|
|
107
|
+
await mkdir(work, { mode: 448 });
|
|
108
|
+
const downloaded = await downloadVerifiedRelease({
|
|
109
|
+
descriptor: previous,
|
|
110
|
+
directory: work,
|
|
111
|
+
maxBytes: MAX_COMPRESSED_BYTES,
|
|
112
|
+
timeoutMs: 6e5,
|
|
113
|
+
fetch: fetcher
|
|
114
|
+
});
|
|
115
|
+
const previousArchive = join(work, previous.asset.name);
|
|
116
|
+
await rename(downloaded.path, previousArchive);
|
|
117
|
+
const installerName = parsed.requirements(previous.tag).platforms[platform]?.[0];
|
|
118
|
+
if (!installerName) throw new Error("Previous release has no installer for this platform");
|
|
119
|
+
const previousInstaller = join(work, installerName);
|
|
120
|
+
await downloadAsset({
|
|
121
|
+
feed,
|
|
122
|
+
tag: previous.tag,
|
|
123
|
+
name: installerName,
|
|
124
|
+
destination: previousInstaller,
|
|
125
|
+
fetch: fetcher
|
|
126
|
+
});
|
|
127
|
+
const result = await observeInstalledApp({
|
|
128
|
+
env,
|
|
129
|
+
platform,
|
|
130
|
+
renderer,
|
|
131
|
+
appName: config.appName,
|
|
132
|
+
appId: config.appId,
|
|
133
|
+
version: previous.version,
|
|
134
|
+
installer: previousInstaller,
|
|
135
|
+
archive: previousArchive,
|
|
136
|
+
expectedReads: parsed.expectedReads,
|
|
137
|
+
offlinePolicy: requirements.offlinePolicy,
|
|
138
|
+
sidecars: parsed.sidecars,
|
|
139
|
+
onStage: options.onStage,
|
|
140
|
+
update: {
|
|
141
|
+
descriptor,
|
|
142
|
+
trust,
|
|
143
|
+
archive: join(directory, names[1]),
|
|
144
|
+
maxCompressedBytes: MAX_COMPRESSED_BYTES,
|
|
145
|
+
maxExpandedBytes: MAX_EXPANDED_BYTES
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
if (!result.updated || result.updated.version !== descriptor.version || !result.updated.evidence) throw new Error("Missing measured evidence for the updated app");
|
|
149
|
+
const receipt = {
|
|
150
|
+
schema: 1,
|
|
151
|
+
tag,
|
|
152
|
+
platform,
|
|
153
|
+
from: {
|
|
154
|
+
tag: previous.tag,
|
|
155
|
+
version: previous.version,
|
|
156
|
+
channel: previous.channel
|
|
157
|
+
},
|
|
158
|
+
to: {
|
|
159
|
+
version: descriptor.version,
|
|
160
|
+
channel
|
|
161
|
+
},
|
|
162
|
+
installed: true,
|
|
163
|
+
updated: true,
|
|
164
|
+
rendererEvidence: result.updated.evidence
|
|
165
|
+
};
|
|
166
|
+
await writeFile(destination, JSON.stringify(receipt, null, 2) + "\n", {
|
|
167
|
+
flag: "wx",
|
|
168
|
+
mode: 384
|
|
169
|
+
});
|
|
170
|
+
return receipt;
|
|
171
|
+
}
|
|
172
|
+
export { qualifyUpgradeCommand };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Install before Electrobun starts its app worker, in a disposable hosted runner only. */
|
|
2
|
+
export declare function interceptInstallerWorker(options: {
|
|
3
|
+
env: Record<string, string | undefined>;
|
|
4
|
+
globals: {
|
|
5
|
+
Worker: typeof Worker;
|
|
6
|
+
};
|
|
7
|
+
entry: string;
|
|
8
|
+
bootstrap: string;
|
|
9
|
+
}): void;
|
|
10
|
+
/** Deny nested workers and hold the installed app until its exact runtime has been verified. */
|
|
11
|
+
export declare function awaitInstallerWorkerPermit(options: {
|
|
12
|
+
env: Record<string, string | undefined>;
|
|
13
|
+
globals: {
|
|
14
|
+
Worker: typeof Worker;
|
|
15
|
+
};
|
|
16
|
+
entry: string;
|
|
17
|
+
nonce: string;
|
|
18
|
+
acknowledgement: string;
|
|
19
|
+
permit: string;
|
|
20
|
+
timeoutMs?: number;
|
|
21
|
+
}): Promise<string>;
|