@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,103 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The Manage themes dialog's import flow, with the parsing and projection code
|
|
3
|
+
* behind a dynamic import. Selecting a file is what loads it, so opening
|
|
4
|
+
* Appearance never downloads the importer.
|
|
5
|
+
*
|
|
6
|
+
* A newer selection, a closed dialog and a disposed panel each supersede an
|
|
7
|
+
* import still in flight: the result of a superseded run is dropped before
|
|
8
|
+
* anything is stored, selected or reported.
|
|
9
|
+
*/
|
|
10
|
+
import type { CustomThemeStored } from './custom-theme-library'
|
|
11
|
+
|
|
12
|
+
import type { CustomThemeImportResult } from './custom-theme-import'
|
|
13
|
+
|
|
14
|
+
export type ThemeFileImporterHost = Readonly<{
|
|
15
|
+
/**
|
|
16
|
+
* Loads the importer and returns the function that imports one file's text.
|
|
17
|
+
* It runs after every await so the library it merges into is read fresh.
|
|
18
|
+
*/
|
|
19
|
+
load: () => Promise<(text: string) => CustomThemeImportResult>
|
|
20
|
+
onPending: (pending: boolean) => void
|
|
21
|
+
onStatus: (message: string) => void
|
|
22
|
+
onImported: (theme: CustomThemeStored) => void
|
|
23
|
+
}>
|
|
24
|
+
|
|
25
|
+
type ThemeFileImporter = Readonly<{
|
|
26
|
+
importFile: (file: Pick<File, 'text'>) => Promise<void>
|
|
27
|
+
/** Drops the run in flight, if any, and clears its pending status. */
|
|
28
|
+
cancel: () => void
|
|
29
|
+
}>
|
|
30
|
+
|
|
31
|
+
export const THEME_IMPORT_PENDING = 'Importing theme…'
|
|
32
|
+
export const THEME_IMPORT_UNREADABLE = 'That file could not be read.'
|
|
33
|
+
export const THEME_IMPORT_UNAVAILABLE =
|
|
34
|
+
'The theme importer could not be loaded. Reload the app and try again.'
|
|
35
|
+
export const THEME_IMPORT_FAILED = 'That theme could not be imported.'
|
|
36
|
+
|
|
37
|
+
export function createThemeFileImporter(host: ThemeFileImporterHost): ThemeFileImporter {
|
|
38
|
+
let latest = 0
|
|
39
|
+
let pending = false
|
|
40
|
+
const settle = () => {
|
|
41
|
+
if (!pending) return
|
|
42
|
+
pending = false
|
|
43
|
+
host.onPending(false)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
cancel() {
|
|
48
|
+
latest += 1
|
|
49
|
+
if (!pending) return
|
|
50
|
+
settle()
|
|
51
|
+
host.onStatus('')
|
|
52
|
+
},
|
|
53
|
+
async importFile(file) {
|
|
54
|
+
latest += 1
|
|
55
|
+
const run = latest
|
|
56
|
+
const current = () => run === latest
|
|
57
|
+
pending = true
|
|
58
|
+
host.onPending(true)
|
|
59
|
+
host.onStatus(THEME_IMPORT_PENDING)
|
|
60
|
+
|
|
61
|
+
let text: string
|
|
62
|
+
try {
|
|
63
|
+
text = await file.text()
|
|
64
|
+
} catch {
|
|
65
|
+
if (!current()) return
|
|
66
|
+
settle()
|
|
67
|
+
host.onStatus(THEME_IMPORT_UNREADABLE)
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
if (!current()) return
|
|
71
|
+
|
|
72
|
+
let importText: (text: string) => CustomThemeImportResult
|
|
73
|
+
try {
|
|
74
|
+
importText = await host.load()
|
|
75
|
+
} catch {
|
|
76
|
+
if (!current()) return
|
|
77
|
+
settle()
|
|
78
|
+
host.onStatus(THEME_IMPORT_UNAVAILABLE)
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
if (!current()) return
|
|
82
|
+
|
|
83
|
+
let result: CustomThemeImportResult
|
|
84
|
+
try {
|
|
85
|
+
result = importText(text)
|
|
86
|
+
} catch {
|
|
87
|
+
settle()
|
|
88
|
+
host.onStatus(THEME_IMPORT_FAILED)
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
settle()
|
|
92
|
+
if (!result.ok) {
|
|
93
|
+
host.onStatus(result.error)
|
|
94
|
+
return
|
|
95
|
+
}
|
|
96
|
+
host.onStatus(
|
|
97
|
+
`Imported “${result.theme.name}”.` +
|
|
98
|
+
(result.theme.notes.length > 0 ? ` ${result.theme.notes.join(' ')}` : '')
|
|
99
|
+
)
|
|
100
|
+
host.onImported(result.theme)
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Published AppearanceEditor bridge.
|
|
3
|
+
*
|
|
4
|
+
* @adea-ai/ui owns the presentation, the catalogue values and the theme API
|
|
5
|
+
* Adea consumes. Adea keeps its V2 preference model; this adapter hands the
|
|
6
|
+
* published editor the catalogue's own theme records (the shared ThemeProvider
|
|
7
|
+
* paints from the same catalogue), plus a record per imported theme.
|
|
8
|
+
*/
|
|
9
|
+
import { colorToHex, normalizeAccentValue, parseColor } from '@adea-ai/ui/lib/accent-roles'
|
|
10
|
+
import { getAccent } from '@adea-ai/ui/lib/accent-presets'
|
|
11
|
+
import { defaultThemeRecord } from '@adea-ai/ui/lib/theme-projection'
|
|
12
|
+
import type { AdeaTheme, AdeaThemeRecord } from '@adea-ai/ui/lib/theme-records'
|
|
13
|
+
import {
|
|
14
|
+
accentRolesForSelection,
|
|
15
|
+
themeRecordById,
|
|
16
|
+
themeRecords,
|
|
17
|
+
type ThemeVariant,
|
|
18
|
+
} from '@adea-ai/ui/lib/themes'
|
|
19
|
+
|
|
20
|
+
import { APPEARANCE_ACCENT_CONTRAST_FLOOR } from './appearance-preferences'
|
|
21
|
+
import { customThemeVariants, storedVariantRecord } from './custom-theme-library'
|
|
22
|
+
import { themeRegistry } from './theme-registry'
|
|
23
|
+
|
|
24
|
+
const adeaLight = defaultThemeRecord('light')
|
|
25
|
+
const adeaDark = defaultThemeRecord('dark')
|
|
26
|
+
|
|
27
|
+
/** The published blue preset is the host's default custom accent. */
|
|
28
|
+
export const DEFAULT_CUSTOM_ACCENT = getAccent('blue')?.light ?? adeaLight.colors.accent
|
|
29
|
+
|
|
30
|
+
/** Imported themes, re-projected on every registry change. */
|
|
31
|
+
export function customThemeRecords(): readonly AdeaThemeRecord[] {
|
|
32
|
+
return customThemeVariants().map(storedVariantRecord)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The built-in catalogue led by the published pair; import lives separately. */
|
|
36
|
+
export const appearanceThemeRecords: readonly AdeaThemeRecord[] = Object.freeze([
|
|
37
|
+
adeaLight,
|
|
38
|
+
adeaDark,
|
|
39
|
+
...themeRecords.filter((record) => record.id !== adeaLight.id && record.id !== adeaDark.id),
|
|
40
|
+
])
|
|
41
|
+
|
|
42
|
+
/** Every selectable record: built-ins first, then imported themes. */
|
|
43
|
+
export function allThemeRecords(): readonly AdeaThemeRecord[] {
|
|
44
|
+
return [...appearanceThemeRecords, ...customThemeRecords()]
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function withAccent(
|
|
48
|
+
theme: AdeaTheme,
|
|
49
|
+
accent: string,
|
|
50
|
+
pair: { lightThemeId: string; darkThemeId: string } | undefined
|
|
51
|
+
): AdeaTheme {
|
|
52
|
+
if (accent === 'theme') return theme
|
|
53
|
+
const variant = themeRegistry().find((candidate) => candidate.id === theme.id)
|
|
54
|
+
// The 3:1 floor needs the variant's background. A record whose variant has
|
|
55
|
+
// vanished previews its own accent rather than throwing mid-interaction.
|
|
56
|
+
if (!variant) return theme
|
|
57
|
+
const roles = accentRolesForSelection(accent, theme.appearance, pair, {
|
|
58
|
+
background: variant.colors.background,
|
|
59
|
+
floor: APPEARANCE_ACCENT_CONTRAST_FLOOR,
|
|
60
|
+
variantId: variant.id,
|
|
61
|
+
})
|
|
62
|
+
if (!roles) return theme
|
|
63
|
+
return {
|
|
64
|
+
...theme,
|
|
65
|
+
colors: {
|
|
66
|
+
...theme.colors,
|
|
67
|
+
accent: roles.primary,
|
|
68
|
+
accentForeground: roles.primaryForeground,
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Resolve a selected local ID to the external editor's raw preview contract.
|
|
75
|
+
* `pair` is the draft's light/dark theme ids, which a theme-derived (`ansi-*`)
|
|
76
|
+
* accent is read from.
|
|
77
|
+
*/
|
|
78
|
+
export function appearanceThemeForPreview(
|
|
79
|
+
variant: ThemeVariant,
|
|
80
|
+
accent: string,
|
|
81
|
+
pair?: { lightThemeId: string; darkThemeId: string }
|
|
82
|
+
): AdeaTheme {
|
|
83
|
+
// Imported themes have no catalogue record; their stored variant projects to
|
|
84
|
+
// one on the spot, so every record takes the same accent overlay path.
|
|
85
|
+
const record =
|
|
86
|
+
themeRecordById(variant.id) ??
|
|
87
|
+
customThemeRecords().find((candidate) => candidate.id === variant.id) ??
|
|
88
|
+
(variant.appearance === 'dark' ? adeaDark : adeaLight)
|
|
89
|
+
return withAccent(record, accent, pair)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
type AccentDraftValidation = Readonly<{
|
|
93
|
+
value?: string
|
|
94
|
+
error?: string
|
|
95
|
+
}>
|
|
96
|
+
|
|
97
|
+
/** Preserve the host's invalid-input behavior while feeding the pure editor. */
|
|
98
|
+
export function normalizeCustomAccent(value: string, background: string): AccentDraftValidation {
|
|
99
|
+
const normalized = normalizeAccentValue(value, background)
|
|
100
|
+
if (normalized === undefined) {
|
|
101
|
+
return { error: `“${value}” is not a hex color such as ${DEFAULT_CUSTOM_ACCENT}.` }
|
|
102
|
+
}
|
|
103
|
+
// Stored accents are opaque #rrggbb; an alpha channel is dropped.
|
|
104
|
+
const parsed = parseColor(normalized)
|
|
105
|
+
return { value: parsed ? colorToHex({ ...parsed, a: 255 }) : normalized }
|
|
106
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026 Wing
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { builtinThemes, type ThemeVariant } from '@adea-ai/ui/lib/themes'
|
|
6
|
+
|
|
7
|
+
import { customUiVariants } from './custom-theme-library'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Every selectable theme: the catalogue first, then imported themes.
|
|
11
|
+
*
|
|
12
|
+
* This is the one place the app reads the whole catalogue (`builtinThemes`), and it
|
|
13
|
+
* is a module of its own on purpose: the appearance editor imports it from its lazy
|
|
14
|
+
* chunk. Left in `custom-theme-library.ts`, which the shell's provider imports at
|
|
15
|
+
* start-up, it would keep the 34-theme catalogue in the start-up closure (ADR 0014).
|
|
16
|
+
*/
|
|
17
|
+
export function themeRegistry(): readonly ThemeVariant[] {
|
|
18
|
+
const custom = customUiVariants()
|
|
19
|
+
return custom.length > 0 ? [...builtinThemes, ...custom] : builtinThemes
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// The desktop mirror for the glass appearance setting. The appearance editor
|
|
2
|
+
// persists its surface to localStorage (device-local), but the native window
|
|
3
|
+
// is the shell's: it reads the mirrored value from the persisted workspace
|
|
4
|
+
// preferences at boot. The host (apps/web, desktop only) registers the
|
|
5
|
+
// transport — dev-view stays platform-agnostic and calls the seam.
|
|
6
|
+
export type WindowSurface = 'theme' | 'frosted' | 'opaque'
|
|
7
|
+
|
|
8
|
+
type WindowSurfaceMirror = (surface: WindowSurface) => void
|
|
9
|
+
|
|
10
|
+
let mirror: WindowSurfaceMirror | undefined
|
|
11
|
+
|
|
12
|
+
export function registerWindowSurfaceMirror(next: WindowSurfaceMirror): void {
|
|
13
|
+
mirror = next
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function mirrorWindowSurface(surface: WindowSurface): void {
|
|
17
|
+
mirror?.(surface)
|
|
18
|
+
}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identifies the toolchain cached `vp` tasks run on, so every cache key covers
|
|
3
|
+
* it without anyone setting a label.
|
|
4
|
+
*
|
|
5
|
+
* Vite Task fingerprints a task's command text, declared environment variables
|
|
6
|
+
* and the files it reads, but not the `node` or `bun` binary or the platform.
|
|
7
|
+
* An app's `vite.config.ts` calls `expectedId()` every time `vp` loads it and
|
|
8
|
+
* writes the result into the text of each cached command, so a different Node,
|
|
9
|
+
* Bun or platform is a different key. The id lives in the invocation's own task
|
|
10
|
+
* graph, not in a file, so two `vp` invocations in one checkout with different
|
|
11
|
+
* toolchains cannot see each other's.
|
|
12
|
+
*
|
|
13
|
+
* The config process cannot be trusted to see what the tasks will, so every
|
|
14
|
+
* invocation also runs an uncached task first
|
|
15
|
+
* (`adea-toolchain-identity --expect <id>`) with the PATH the tasks really get.
|
|
16
|
+
* It recomputes the id and exits non-zero unless it equals the one written into
|
|
17
|
+
* the commands; the dependent tasks then do not run and nothing is read from or
|
|
18
|
+
* stored in the cache.
|
|
19
|
+
*
|
|
20
|
+
* The id holds each binary's version and a hash of its bytes, the platform and
|
|
21
|
+
* the libc, never a path: the same bytes at another path (another checkout, a CI
|
|
22
|
+
* runner) keep their entries.
|
|
23
|
+
*/
|
|
24
|
+
import { execFileSync } from 'node:child_process'
|
|
25
|
+
import { createHash } from 'node:crypto'
|
|
26
|
+
import {
|
|
27
|
+
accessSync,
|
|
28
|
+
closeSync,
|
|
29
|
+
constants,
|
|
30
|
+
mkdirSync,
|
|
31
|
+
openSync,
|
|
32
|
+
readFileSync,
|
|
33
|
+
readSync,
|
|
34
|
+
realpathSync,
|
|
35
|
+
renameSync,
|
|
36
|
+
statSync,
|
|
37
|
+
writeFileSync,
|
|
38
|
+
} from 'node:fs'
|
|
39
|
+
import { delimiter, join } from 'node:path'
|
|
40
|
+
|
|
41
|
+
/** The marker written into commands when the toolchain could not be identified. It never matches. */
|
|
42
|
+
export const UNIDENTIFIED = 'unidentified'
|
|
43
|
+
|
|
44
|
+
type Memo = Record<string, string>
|
|
45
|
+
type Binary = { version: string; sha256: string }
|
|
46
|
+
export type ToolchainIdentity = { platform: string; libc: string; node: Binary; bun: Binary }
|
|
47
|
+
|
|
48
|
+
const errorCode = (error: unknown) => (error as NodeJS.ErrnoException | null)?.code
|
|
49
|
+
const message = (error: unknown) => (error instanceof Error ? error.message : String(error))
|
|
50
|
+
|
|
51
|
+
/** The executable `name` resolves to on `searchPath`, never a CWD lookup. */
|
|
52
|
+
export function onPath(
|
|
53
|
+
name: string,
|
|
54
|
+
searchPath: string,
|
|
55
|
+
platform: NodeJS.Platform = process.platform
|
|
56
|
+
): string | undefined {
|
|
57
|
+
for (const dir of searchPath.split(delimiter)) {
|
|
58
|
+
if (!dir) continue
|
|
59
|
+
// Windows' native Node and Bun distributions use .exe; keep checking an
|
|
60
|
+
// extensionless launcher first so an ambiguous wrapper cannot be skipped.
|
|
61
|
+
const executable = (filename: string) => {
|
|
62
|
+
const candidate = join(dir, filename)
|
|
63
|
+
try {
|
|
64
|
+
accessSync(candidate, constants.X_OK)
|
|
65
|
+
if (statSync(candidate).isFile()) return realpathSync(candidate)
|
|
66
|
+
} catch {
|
|
67
|
+
// not in this directory
|
|
68
|
+
}
|
|
69
|
+
return undefined
|
|
70
|
+
}
|
|
71
|
+
const exact = executable(name)
|
|
72
|
+
if (exact) return exact
|
|
73
|
+
// Batch and COM launchers may be selected by a Windows shell but cannot
|
|
74
|
+
// be fingerprinted safely with execFileSync. Refuse rather than skip one
|
|
75
|
+
// and accidentally hash a different binary later in PATH.
|
|
76
|
+
if (platform === 'win32') {
|
|
77
|
+
for (const ext of ['.cmd', '.bat', '.com']) {
|
|
78
|
+
try {
|
|
79
|
+
if (statSync(join(dir, name + ext)).isFile())
|
|
80
|
+
throw new Error(`Cannot identify Windows launcher for ${name}`)
|
|
81
|
+
} catch (error) {
|
|
82
|
+
if (errorCode(error) !== 'ENOENT' && errorCode(error) !== 'ENOTDIR') throw error
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const native = executable(`${name}.exe`)
|
|
86
|
+
if (native) return native
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return undefined
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const memoFile = (root: string) => join(root, 'node_modules', '.cache', 'orch-toolchain-memo.json')
|
|
93
|
+
|
|
94
|
+
function readMemo(root: string): Memo {
|
|
95
|
+
try {
|
|
96
|
+
return JSON.parse(readFileSync(memoFile(root), 'utf8')) as Memo
|
|
97
|
+
} catch {
|
|
98
|
+
return {}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** sha256 of a file, remembered by path, size and modification time (a hash cache, not an identity). */
|
|
103
|
+
function sha256(file: string, memo: Memo, root: string): string {
|
|
104
|
+
const before = statSync(file)
|
|
105
|
+
const key = `${file}:${before.size}:${before.mtimeMs}`
|
|
106
|
+
if (memo[key]) return memo[key]
|
|
107
|
+
const hash = createHash('sha256')
|
|
108
|
+
const buffer = Buffer.allocUnsafe(1 << 20)
|
|
109
|
+
const fd = openSync(file, 'r')
|
|
110
|
+
try {
|
|
111
|
+
for (;;) {
|
|
112
|
+
const read = readSync(fd, buffer, 0, buffer.length, null)
|
|
113
|
+
if (read === 0) break
|
|
114
|
+
hash.update(buffer.subarray(0, read))
|
|
115
|
+
}
|
|
116
|
+
} finally {
|
|
117
|
+
closeSync(fd)
|
|
118
|
+
}
|
|
119
|
+
const digest = hash.digest('hex')
|
|
120
|
+
const after = statSync(file)
|
|
121
|
+
// A file replaced while it was read is not remembered.
|
|
122
|
+
if (after.size === before.size && after.mtimeMs === before.mtimeMs) {
|
|
123
|
+
for (const old of Object.keys(memo)) if (old.startsWith(`${file}:`)) delete memo[old]
|
|
124
|
+
memo[key] = digest
|
|
125
|
+
try {
|
|
126
|
+
mkdirSync(join(root, 'node_modules', '.cache'), { recursive: true })
|
|
127
|
+
// Atomic, so a concurrent invocation never reads a torn memo. Last writer
|
|
128
|
+
// wins; a lost entry only costs a rehash.
|
|
129
|
+
const staged = `${memoFile(root)}.${process.pid}`
|
|
130
|
+
writeFileSync(staged, JSON.stringify(memo))
|
|
131
|
+
renameSync(staged, memoFile(root))
|
|
132
|
+
} catch {
|
|
133
|
+
// the memo is an optimisation
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return digest
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The real executable behind `name` on `searchPath`. A launcher (Vite+ may
|
|
141
|
+
* prepend one only when a task starts) is followed to the binary it runs.
|
|
142
|
+
*/
|
|
143
|
+
export function runtimeExecutable(
|
|
144
|
+
name: string,
|
|
145
|
+
searchPath: string = process.env.PATH ?? ''
|
|
146
|
+
): string {
|
|
147
|
+
const file = onPath(name, searchPath)
|
|
148
|
+
if (!file) throw new Error(`\`${name}\` is not on PATH, so the toolchain cannot be identified`)
|
|
149
|
+
try {
|
|
150
|
+
const executable = execFileSync(file, ['-p', 'process.execPath'], {
|
|
151
|
+
encoding: 'utf8',
|
|
152
|
+
// Cached launchers inherit PATH; avoid enumerating unrelated variables.
|
|
153
|
+
...(searchPath === process.env.PATH ? {} : { env: { ...process.env, PATH: searchPath } }),
|
|
154
|
+
}).trim()
|
|
155
|
+
if (!executable || !statSync(executable).isFile()) throw new Error('invalid executable path')
|
|
156
|
+
return realpathSync(executable)
|
|
157
|
+
} catch (error) {
|
|
158
|
+
throw new Error(`\`${name}\` executable probe failed: ${message(error)}`, { cause: error })
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function describe(name: string, searchPath: string, memo: Memo, root: string): Binary {
|
|
163
|
+
const file = onPath(name, searchPath)
|
|
164
|
+
if (!file) throw new Error(`\`${name}\` is not on PATH, so the toolchain cannot be identified`)
|
|
165
|
+
let version: string
|
|
166
|
+
try {
|
|
167
|
+
version = execFileSync(file, ['--version'], { encoding: 'utf8' }).trim()
|
|
168
|
+
} catch (error) {
|
|
169
|
+
throw new Error(`\`${name} --version\` failed: ${message(error)}`, { cause: error })
|
|
170
|
+
}
|
|
171
|
+
if (!version) throw new Error(`\`${name} --version\` printed nothing`)
|
|
172
|
+
return { version, sha256: sha256(runtimeExecutable(name, searchPath), memo, root) }
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* The identity of the `node` and `bun` found on `searchPath`, and of the
|
|
177
|
+
* platform. Throws when it cannot be established.
|
|
178
|
+
*/
|
|
179
|
+
export function identity({
|
|
180
|
+
root = process.cwd(),
|
|
181
|
+
searchPath = process.env.PATH ?? '',
|
|
182
|
+
}: { root?: string; searchPath?: string } = {}): ToolchainIdentity {
|
|
183
|
+
const memo = readMemo(root)
|
|
184
|
+
const report = process.report?.getReport?.() as { header?: { glibcVersionRuntime?: string } }
|
|
185
|
+
const libc = report?.header?.glibcVersionRuntime
|
|
186
|
+
return {
|
|
187
|
+
platform: `${process.platform}-${process.arch}`,
|
|
188
|
+
libc: libc ? `glibc${libc}` : process.platform === 'linux' ? 'non-glibc' : 'na',
|
|
189
|
+
node: describe('node', searchPath, memo, root),
|
|
190
|
+
bun: describe('bun', searchPath, memo, root),
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const clean = (text: string) => text.replace(/^v/, '').replace(/[^A-Za-z0-9.]+/g, '_')
|
|
195
|
+
|
|
196
|
+
/** A short, shell-safe id that goes into command text. */
|
|
197
|
+
export function idOf(found: ToolchainIdentity): string {
|
|
198
|
+
return [
|
|
199
|
+
found.platform,
|
|
200
|
+
found.libc,
|
|
201
|
+
`node${clean(found.node.version)}-${found.node.sha256.slice(0, 12)}`,
|
|
202
|
+
`bun${clean(found.bun.version)}-${found.bun.sha256.slice(0, 12)}`,
|
|
203
|
+
].join('.')
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* The id the tasks of the invocation that is loading `vite.config.ts` are
|
|
208
|
+
* expected to run on. `vp` runs tasks with `node_modules/.bin` first and the
|
|
209
|
+
* package-manager `bun` ahead of the shell's, and gives the config process the
|
|
210
|
+
* latter already, so the workspace `.bin` is the one directory added here.
|
|
211
|
+
*/
|
|
212
|
+
export function expectedId(root: string = process.cwd()): string {
|
|
213
|
+
try {
|
|
214
|
+
const searchPath = [join(root, 'node_modules', '.bin'), process.env.PATH ?? ''].join(delimiter)
|
|
215
|
+
return idOf(identity({ root, searchPath }))
|
|
216
|
+
} catch {
|
|
217
|
+
return UNIDENTIFIED
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** Exit status for `--expect <id>`: 0 only when the tasks run on the toolchain their keys name. */
|
|
222
|
+
export function verifyToolchain(expected: string, root: string = process.cwd()): number {
|
|
223
|
+
let actual: string
|
|
224
|
+
try {
|
|
225
|
+
actual = idOf(identity({ root }))
|
|
226
|
+
} catch (error) {
|
|
227
|
+
console.error(`toolchain-identity: ${message(error)}`)
|
|
228
|
+
return 1
|
|
229
|
+
}
|
|
230
|
+
if (expected === UNIDENTIFIED) {
|
|
231
|
+
console.error(
|
|
232
|
+
'toolchain-identity: the toolchain could not be identified when the tasks were loaded'
|
|
233
|
+
)
|
|
234
|
+
return 1
|
|
235
|
+
}
|
|
236
|
+
if (actual !== expected) {
|
|
237
|
+
console.error(
|
|
238
|
+
`toolchain-identity: the tasks run on ${actual}, but their cache keys were written for ${expected}`
|
|
239
|
+
)
|
|
240
|
+
return 1
|
|
241
|
+
}
|
|
242
|
+
console.log(`toolchain ${actual}`)
|
|
243
|
+
return 0
|
|
244
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { cefHelperCacheKey, cefHelperFailure, ensurePatchedCefHelper } from '../native/cef-helper'
|
|
3
|
+
import { runCli } from './cli-runner'
|
|
4
|
+
|
|
5
|
+
// `key` prints this platform's patched CEF helper cache key, for CI caches of
|
|
6
|
+
// ADEA_CEF_HELPER_CACHE; it changes with the pinned source, patch and CEF SDK.
|
|
7
|
+
// `build` fills that cache ahead of an Electrobun build.
|
|
8
|
+
await runCli(
|
|
9
|
+
(error) => `Unable to prepare the patched CEF helper: ${cefHelperFailure(error)}`,
|
|
10
|
+
async () => {
|
|
11
|
+
const [command, ...extra] = process.argv.slice(2)
|
|
12
|
+
if (extra.length || (command !== 'key' && command !== 'build'))
|
|
13
|
+
throw new Error('Unexpected arguments')
|
|
14
|
+
const os = { darwin: 'macos', linux: 'linux', win32: 'win' }[process.platform as string] ?? ''
|
|
15
|
+
if (command === 'key') process.stdout.write(`${cefHelperCacheKey(os, process.arch)}\n`)
|
|
16
|
+
else {
|
|
17
|
+
await ensurePatchedCefHelper(process.env, os, process.arch)
|
|
18
|
+
process.stdout.write('Patched CEF helper is cached\n')
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { lstat, readFile } from 'node:fs/promises'
|
|
2
|
+
|
|
3
|
+
/** Run a command-line entry point. Any failure prints `failure` and sets exit code 1. A
|
|
4
|
+
* string never shows the error itself, which may carry paths or key material; pass a
|
|
5
|
+
* function only for commands whose errors are safe to print. */
|
|
6
|
+
export async function runCli(
|
|
7
|
+
failure: string | ((error: unknown) => string),
|
|
8
|
+
main: () => unknown,
|
|
9
|
+
options: { requireGitHubActions?: boolean } = {}
|
|
10
|
+
): Promise<void> {
|
|
11
|
+
try {
|
|
12
|
+
if (options.requireGitHubActions && process.env.GITHUB_ACTIONS !== 'true')
|
|
13
|
+
throw new Error('Invalid workflow invocation')
|
|
14
|
+
await main()
|
|
15
|
+
} catch (error) {
|
|
16
|
+
process.stderr.write(`${typeof failure === 'string' ? failure : failure(error)}\n`)
|
|
17
|
+
process.exitCode = 1
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Parse a JSON file that is a regular file, not a link, of 1 to `maxBytes` bytes. */
|
|
22
|
+
export async function readJsonFile(path: string, maxBytes: number): Promise<unknown> {
|
|
23
|
+
const info = await lstat(path)
|
|
24
|
+
if (!info.isFile() || info.isSymbolicLink() || info.size < 1 || info.size > maxBytes)
|
|
25
|
+
throw new Error('Invalid configuration file')
|
|
26
|
+
const bytes = await readFile(path)
|
|
27
|
+
if (bytes.length !== info.size) throw new Error('Configuration file changed')
|
|
28
|
+
return JSON.parse(bytes.toString('utf8'))
|
|
29
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { createApplication } from '../app/create-application'
|
|
3
|
+
import { runCli } from './cli-runner'
|
|
4
|
+
|
|
5
|
+
const usage =
|
|
6
|
+
'Usage: create-adea-app --directory PATH --slug SLUG --name NAME --identifier REVERSE_DNS --source-url HTTPS_URL --framework SPECIFIER [--renderer native|cef]'
|
|
7
|
+
const allowed = new Set([
|
|
8
|
+
'directory',
|
|
9
|
+
'slug',
|
|
10
|
+
'name',
|
|
11
|
+
'identifier',
|
|
12
|
+
'source-url',
|
|
13
|
+
'framework',
|
|
14
|
+
'renderer',
|
|
15
|
+
])
|
|
16
|
+
await runCli(
|
|
17
|
+
(error) => (error instanceof Error ? error.message : 'Could not create application'),
|
|
18
|
+
async () => {
|
|
19
|
+
const args = process.argv.slice(2)
|
|
20
|
+
if (args.length === 1 && args[0] === '--help') {
|
|
21
|
+
console.log(usage)
|
|
22
|
+
process.exit(0)
|
|
23
|
+
}
|
|
24
|
+
const values: Record<string, string> = {}
|
|
25
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
26
|
+
const key = args[i]?.startsWith('--') ? args[i]!.slice(2) : ''
|
|
27
|
+
const value = args[i + 1]
|
|
28
|
+
if (!allowed.has(key) || values[key] !== undefined || !value || value.startsWith('--'))
|
|
29
|
+
throw new Error(usage)
|
|
30
|
+
values[key] = value
|
|
31
|
+
}
|
|
32
|
+
const {
|
|
33
|
+
directory,
|
|
34
|
+
slug,
|
|
35
|
+
name,
|
|
36
|
+
identifier,
|
|
37
|
+
'source-url': sourceUrl,
|
|
38
|
+
framework,
|
|
39
|
+
renderer,
|
|
40
|
+
} = values
|
|
41
|
+
if (
|
|
42
|
+
!directory ||
|
|
43
|
+
!slug ||
|
|
44
|
+
!name ||
|
|
45
|
+
!identifier ||
|
|
46
|
+
!sourceUrl ||
|
|
47
|
+
!framework ||
|
|
48
|
+
(renderer && renderer !== 'native' && renderer !== 'cef')
|
|
49
|
+
)
|
|
50
|
+
throw new Error(usage)
|
|
51
|
+
const result = await createApplication({
|
|
52
|
+
directory,
|
|
53
|
+
slug,
|
|
54
|
+
name,
|
|
55
|
+
identifier,
|
|
56
|
+
sourceUrl,
|
|
57
|
+
frameworkSpecifier: framework,
|
|
58
|
+
renderer: renderer as 'native' | 'cef' | undefined,
|
|
59
|
+
})
|
|
60
|
+
console.log(`Created application at ${result.directory}`)
|
|
61
|
+
}
|
|
62
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { execFileSync } from 'node:child_process'
|
|
3
|
+
import { resolve } from 'node:path'
|
|
4
|
+
import {
|
|
5
|
+
applyElectrobunPatch,
|
|
6
|
+
ELECTROBUN_COMMIT,
|
|
7
|
+
PINNED_SHORTCUT_PATCH,
|
|
8
|
+
SHORTCUT_PATCH_PATH,
|
|
9
|
+
} from '../native/electrobun-source-patch'
|
|
10
|
+
import { runCli } from './cli-runner'
|
|
11
|
+
|
|
12
|
+
await runCli(
|
|
13
|
+
(error) =>
|
|
14
|
+
`Unable to apply the pinned Electrobun shortcut patch: ${error instanceof Error ? error.message : 'unknown error'}`,
|
|
15
|
+
() => {
|
|
16
|
+
const [checkout, ...extra] = process.argv.slice(2)
|
|
17
|
+
if (!checkout || extra.length) throw new Error('Expected an Electrobun checkout')
|
|
18
|
+
const root = resolve(checkout)
|
|
19
|
+
const head = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: root, encoding: 'utf8' }).trim()
|
|
20
|
+
if (head !== ELECTROBUN_COMMIT) throw new Error('Unexpected Electrobun commit')
|
|
21
|
+
applyElectrobunPatch(root, SHORTCUT_PATCH_PATH, PINNED_SHORTCUT_PATCH)
|
|
22
|
+
process.stdout.write('Prepared pinned Electrobun extractor with bounded Shell Link shortcuts\n')
|
|
23
|
+
}
|
|
24
|
+
)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { applyFrameworkUpdate, resolveFrameworkRelease } from '../release/framework-update'
|
|
3
|
+
import { runCli } from './cli-runner'
|
|
4
|
+
|
|
5
|
+
// Usage: adea-update-app-framework [version]. Run from the consumer's repository root.
|
|
6
|
+
await runCli(
|
|
7
|
+
(error) => `App-framework update failed; nothing was changed. ${(error as Error).message}`,
|
|
8
|
+
async () => {
|
|
9
|
+
const [requested, ...extra] = process.argv.slice(2)
|
|
10
|
+
if (extra.length) throw new Error('Usage: adea-update-app-framework [version]')
|
|
11
|
+
const release = await resolveFrameworkRelease(
|
|
12
|
+
{
|
|
13
|
+
async registry(path) {
|
|
14
|
+
const response = await fetch(`https://registry.npmjs.org/${path}`, {
|
|
15
|
+
headers: { accept: 'application/json' },
|
|
16
|
+
})
|
|
17
|
+
if (!response.ok) throw new Error(`npm answered ${response.status} for ${path}`)
|
|
18
|
+
return response.json()
|
|
19
|
+
},
|
|
20
|
+
async download(url) {
|
|
21
|
+
const response = await fetch(url)
|
|
22
|
+
if (!response.ok) throw new Error(`Download answered ${response.status}`)
|
|
23
|
+
return new Uint8Array(await response.arrayBuffer())
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
requested
|
|
27
|
+
)
|
|
28
|
+
const root = process.cwd()
|
|
29
|
+
const result = await applyFrameworkUpdate(root, release, {
|
|
30
|
+
async run(command, cwd) {
|
|
31
|
+
return Bun.spawn(command, { cwd, stdout: 'inherit', stderr: 'inherit' }).exited
|
|
32
|
+
},
|
|
33
|
+
async files(cwd) {
|
|
34
|
+
const listing = Bun.spawnSync(['git', 'ls-files', '-z'], { cwd })
|
|
35
|
+
if (listing.exitCode !== 0) throw new Error('git ls-files failed')
|
|
36
|
+
return listing.stdout.toString().split('\0').filter(Boolean)
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
process.stdout.write(JSON.stringify(result) + '\n')
|
|
40
|
+
}
|
|
41
|
+
)
|