@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,110 @@
|
|
|
1
|
+
import type { FeedRelease, ReleaseLedger } from '../updates/release-feed'
|
|
2
|
+
import { gitIsAncestor, type GitRun } from './local-provenance'
|
|
3
|
+
import type { CutRelease, ReleaseCutProvider } from './release-cut'
|
|
4
|
+
|
|
5
|
+
function checkTag(tag: string) {
|
|
6
|
+
if (!/^v\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(tag) || tag.length > 65)
|
|
7
|
+
throw new Error('Invalid release tag')
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Release feed adapter for local release cuts. The feed's ledger replaces the GitHub release
|
|
12
|
+
* listing and the local checkout's fetched `origin/main` replaces GitHub's compare API. A dev
|
|
13
|
+
* cut lives in memory until its build is published; a daily not yet in the ledger stands for
|
|
14
|
+
* the Release Please release of the source manifest's version, as a stageable draft. A release
|
|
15
|
+
* is qualified once its published release.json carries every payload this host builds, so a
|
|
16
|
+
* second host adds its platform to an existing release. Nothing is built remotely, so a cut
|
|
17
|
+
* is never pending and dispatch only hands the tag back to the caller to build.
|
|
18
|
+
*/
|
|
19
|
+
export function createFeedReleaseCutProvider(options: {
|
|
20
|
+
ledger: ReleaseLedger
|
|
21
|
+
/** The published release.json of a tag, or null. */
|
|
22
|
+
release(tag: string): Promise<FeedRelease | null>
|
|
23
|
+
git: GitRun
|
|
24
|
+
/** The source commit and the version its manifest names. */
|
|
25
|
+
sourceSha: string
|
|
26
|
+
releasedVersion: string
|
|
27
|
+
/** The payload names this host builds for a tag. */
|
|
28
|
+
payloads(tag: string): readonly string[]
|
|
29
|
+
}): ReleaseCutProvider {
|
|
30
|
+
const { ledger, git } = options
|
|
31
|
+
const created = new Map<string, string>()
|
|
32
|
+
return {
|
|
33
|
+
async find(tag): Promise<CutRelease | null> {
|
|
34
|
+
checkTag(tag)
|
|
35
|
+
const kind = tag.includes('-dev.') ? 'dev' : 'daily'
|
|
36
|
+
const entry = ledger.releases.find((item) => item.tag === tag)
|
|
37
|
+
if (entry)
|
|
38
|
+
return {
|
|
39
|
+
tag,
|
|
40
|
+
sourceSha: entry.sourceSha,
|
|
41
|
+
kind,
|
|
42
|
+
draft: false,
|
|
43
|
+
prerelease: entry.kind !== 'stable',
|
|
44
|
+
}
|
|
45
|
+
const sourceSha = created.get(tag)
|
|
46
|
+
if (sourceSha) return { tag, sourceSha, kind, draft: false, prerelease: true }
|
|
47
|
+
if (kind === 'daily' && tag === `v${options.releasedVersion}`)
|
|
48
|
+
return {
|
|
49
|
+
tag,
|
|
50
|
+
sourceSha: options.sourceSha,
|
|
51
|
+
kind,
|
|
52
|
+
draft: true,
|
|
53
|
+
prerelease: false,
|
|
54
|
+
stageableDraft: true,
|
|
55
|
+
}
|
|
56
|
+
return null
|
|
57
|
+
},
|
|
58
|
+
isMainAncestor: (sha) => gitIsAncestor(git, sha, 'refs/remotes/origin/main'),
|
|
59
|
+
async isAncestor(older, newer) {
|
|
60
|
+
return older !== newer && (await gitIsAncestor(git, older, newer))
|
|
61
|
+
},
|
|
62
|
+
async create(identity) {
|
|
63
|
+
checkTag(identity.tag)
|
|
64
|
+
if (!identity.tag.includes('-dev.') || created.has(identity.tag))
|
|
65
|
+
throw new Error('Only a new dev release is cut locally')
|
|
66
|
+
created.set(identity.tag, identity.sourceSha)
|
|
67
|
+
},
|
|
68
|
+
async qualification(release) {
|
|
69
|
+
if (!ledger.releases.some((item) => item.tag === release.tag)) return 'not-qualified'
|
|
70
|
+
try {
|
|
71
|
+
const published = await options.release(release.tag)
|
|
72
|
+
const names = new Set(published?.assets.map((asset) => asset.name))
|
|
73
|
+
return options.payloads(release.tag).every((name) => names.has(name))
|
|
74
|
+
? 'qualified'
|
|
75
|
+
: 'not-qualified'
|
|
76
|
+
} catch {
|
|
77
|
+
return 'unknown'
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
pendingBuild: async () => 'idle',
|
|
81
|
+
async highestDevCounter(version) {
|
|
82
|
+
if (
|
|
83
|
+
typeof version !== 'string' ||
|
|
84
|
+
version.length > 64 ||
|
|
85
|
+
!/^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(version)
|
|
86
|
+
)
|
|
87
|
+
throw new Error('Invalid source version')
|
|
88
|
+
const prefix = `v${version}-dev.`
|
|
89
|
+
let highest = 0
|
|
90
|
+
for (const tag of [...ledger.releases.map((item) => item.tag), ...created.keys()]) {
|
|
91
|
+
if (!tag.startsWith(prefix)) continue
|
|
92
|
+
const suffix = tag.slice(prefix.length)
|
|
93
|
+
if (!/^[1-9]\d{0,15}$/.test(suffix) || !Number.isSafeInteger(Number(suffix)))
|
|
94
|
+
throw new Error('Invalid dev release counter')
|
|
95
|
+
highest = Math.max(highest, Number(suffix))
|
|
96
|
+
}
|
|
97
|
+
return highest
|
|
98
|
+
},
|
|
99
|
+
async tagExists(tag) {
|
|
100
|
+
checkTag(tag)
|
|
101
|
+
return (
|
|
102
|
+
ledger.releases.some((item) => item.tag === tag) ||
|
|
103
|
+
(await git(['tag', '--list', tag])) !== ''
|
|
104
|
+
)
|
|
105
|
+
},
|
|
106
|
+
async dispatch(tag) {
|
|
107
|
+
checkTag(tag)
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto'
|
|
2
|
+
import {
|
|
3
|
+
feedUrl,
|
|
4
|
+
parseFeedRelease,
|
|
5
|
+
parseReleaseLedger,
|
|
6
|
+
type FeedChannel,
|
|
7
|
+
type FeedRelease,
|
|
8
|
+
type ReleaseFeed,
|
|
9
|
+
type ReleaseLedger,
|
|
10
|
+
} from '../updates/release-feed'
|
|
11
|
+
import {
|
|
12
|
+
fetchReleaseLocation,
|
|
13
|
+
readReleaseBytes,
|
|
14
|
+
type FetchFunction,
|
|
15
|
+
} from '../updates/release-location'
|
|
16
|
+
import { verifyReleaseDescriptor } from '../updates/signed-release'
|
|
17
|
+
import { discoveryPolicies } from './release-config'
|
|
18
|
+
|
|
19
|
+
const MAX_LEDGER_BYTES = 1024 * 1024,
|
|
20
|
+
MAX_RELEASE_BYTES = 262_144
|
|
21
|
+
|
|
22
|
+
/** Read one feed object anonymously over HTTPS; null when the feed answers 404. */
|
|
23
|
+
async function readFeedObject(
|
|
24
|
+
feed: ReleaseFeed,
|
|
25
|
+
path: string,
|
|
26
|
+
fetcher: FetchFunction,
|
|
27
|
+
maximum: number
|
|
28
|
+
): Promise<Uint8Array | null> {
|
|
29
|
+
const response = await fetchReleaseLocation(
|
|
30
|
+
`${feedUrl(feed)}${path}`,
|
|
31
|
+
feedUrl(feed),
|
|
32
|
+
fetcher,
|
|
33
|
+
AbortSignal.timeout(60_000)
|
|
34
|
+
)
|
|
35
|
+
if (response.status === 404) {
|
|
36
|
+
await response.body?.cancel()
|
|
37
|
+
return null
|
|
38
|
+
}
|
|
39
|
+
return readReleaseBytes(response, maximum)
|
|
40
|
+
}
|
|
41
|
+
const json = (bytes: Uint8Array) => {
|
|
42
|
+
try {
|
|
43
|
+
return JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes)) as unknown
|
|
44
|
+
} catch {
|
|
45
|
+
throw new Error('Invalid release feed response')
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The published ledger, or an empty one before the app's first release. */
|
|
50
|
+
export async function readFeedLedger(
|
|
51
|
+
feed: ReleaseFeed,
|
|
52
|
+
fetcher: FetchFunction
|
|
53
|
+
): Promise<ReleaseLedger> {
|
|
54
|
+
const bytes = await readFeedObject(feed, 'index.json', fetcher, MAX_LEDGER_BYTES)
|
|
55
|
+
return bytes
|
|
56
|
+
? parseReleaseLedger(json(bytes), feed.app)
|
|
57
|
+
: { schema: 1, app: feed.app, releases: [] }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** A tag's published release.json, or null when none is published. */
|
|
61
|
+
export async function readFeedRelease(
|
|
62
|
+
feed: ReleaseFeed,
|
|
63
|
+
tag: string,
|
|
64
|
+
fetcher: FetchFunction
|
|
65
|
+
): Promise<FeedRelease | null> {
|
|
66
|
+
const bytes = await readFeedObject(feed, `${tag}/release.json`, fetcher, MAX_RELEASE_BYTES)
|
|
67
|
+
if (!bytes) return null
|
|
68
|
+
const release = parseFeedRelease(json(bytes))
|
|
69
|
+
if (release.tag !== tag) throw new Error('Feed release names another tag')
|
|
70
|
+
return release
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Verify a published release from the feed: its ledger entry and release.json agree, and every
|
|
75
|
+
* signed descriptor it lists for `channels` (all of its channels by default) has the listed
|
|
76
|
+
* bytes, authenticates against the app's trust and names a listed payload with the same size
|
|
77
|
+
* and digest. Returns the release platforms whose descriptors all verified; a platform whose
|
|
78
|
+
* payload is listed but whose descriptors are missing fails.
|
|
79
|
+
*/
|
|
80
|
+
export async function verifyFeedRelease(options: {
|
|
81
|
+
config: unknown
|
|
82
|
+
feed: ReleaseFeed
|
|
83
|
+
tag: string
|
|
84
|
+
repository: string
|
|
85
|
+
keys: ReadonlyMap<string, string>
|
|
86
|
+
fetch: FetchFunction
|
|
87
|
+
channels?: readonly FeedChannel[]
|
|
88
|
+
}): Promise<{ release: FeedRelease; platforms: string[] }> {
|
|
89
|
+
const { config, feed, tag, fetch: fetcher } = options
|
|
90
|
+
const [ledger, release] = await Promise.all([
|
|
91
|
+
readFeedLedger(feed, fetcher),
|
|
92
|
+
readFeedRelease(feed, tag, fetcher),
|
|
93
|
+
])
|
|
94
|
+
const entry = ledger.releases.find((item) => item.tag === tag)
|
|
95
|
+
if (!release || !entry || entry.kind !== release.channel)
|
|
96
|
+
throw new Error('Release is not published consistently')
|
|
97
|
+
const policies = discoveryPolicies(config, tag).filter(
|
|
98
|
+
(policy) => !options.channels || options.channels.includes(policy.channel)
|
|
99
|
+
)
|
|
100
|
+
const platforms = new Set<string>()
|
|
101
|
+
for (const policy of policies) {
|
|
102
|
+
const payload = release.assets.find((asset) => asset.name === policy.payload)
|
|
103
|
+
if (!payload) continue
|
|
104
|
+
const listed = release.assets.find((asset) => asset.name === policy.name)
|
|
105
|
+
if (!listed) throw new Error(`Missing signed descriptor: ${policy.name}`)
|
|
106
|
+
const bytes = await readFeedObject(feed, `${tag}/${policy.name}`, fetcher, 65_536)
|
|
107
|
+
if (
|
|
108
|
+
!bytes ||
|
|
109
|
+
bytes.length !== listed.size ||
|
|
110
|
+
createHash('sha256').update(bytes).digest('hex') !== listed.sha256
|
|
111
|
+
)
|
|
112
|
+
throw new Error(`Signed descriptor differs from its release: ${policy.name}`)
|
|
113
|
+
const verified = verifyReleaseDescriptor(json(bytes), {
|
|
114
|
+
appId: policy.appId,
|
|
115
|
+
repository: options.repository,
|
|
116
|
+
channel: policy.channel,
|
|
117
|
+
platform: policy.os,
|
|
118
|
+
arch: policy.arch,
|
|
119
|
+
feed: feedUrl(feed),
|
|
120
|
+
keys: options.keys,
|
|
121
|
+
})
|
|
122
|
+
if (
|
|
123
|
+
!verified.ok ||
|
|
124
|
+
verified.descriptor.tag !== tag ||
|
|
125
|
+
verified.descriptor.sourceSha !== entry.sourceSha ||
|
|
126
|
+
verified.descriptor.asset.name !== payload.name ||
|
|
127
|
+
verified.descriptor.asset.size !== payload.size ||
|
|
128
|
+
verified.descriptor.asset.sha256 !== payload.sha256
|
|
129
|
+
)
|
|
130
|
+
throw new Error(`Untrusted signed descriptor: ${policy.name}`)
|
|
131
|
+
platforms.add(policy.platform)
|
|
132
|
+
}
|
|
133
|
+
if (!platforms.size) throw new Error('Release has no verified platform')
|
|
134
|
+
return { release, platforms: [...platforms] }
|
|
135
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process'
|
|
2
|
+
import { createHash } from 'node:crypto'
|
|
3
|
+
import { lstat, mkdtemp, open, readFile, rm, writeFile } from 'node:fs/promises'
|
|
4
|
+
import { tmpdir } from 'node:os'
|
|
5
|
+
import { basename, join, resolve } from 'node:path'
|
|
6
|
+
import { readPackageFile } from './framework-update'
|
|
7
|
+
import { gitCli, resolveLocalProvenance, type GitRun } from './local-provenance'
|
|
8
|
+
|
|
9
|
+
const packageName = '@adea-ai/app-framework'
|
|
10
|
+
const registryUrl = 'https://registry.npmjs.org/'
|
|
11
|
+
|
|
12
|
+
/** Runs `npm` with arguments in the current directory and the caller's environment. */
|
|
13
|
+
function npmCli(args: string[]): Promise<number> {
|
|
14
|
+
return new Promise((resolveRun) =>
|
|
15
|
+
execFile('npm', args, { maxBuffer: 8 * 1024 * 1024 }, (error, stdout, stderr) => {
|
|
16
|
+
process.stdout.write(stdout)
|
|
17
|
+
process.stderr.write(stderr)
|
|
18
|
+
resolveRun(error ? Number(error.code ?? 1) || 1 : 0)
|
|
19
|
+
})
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The registry's version document, or null when npm answers 404. */
|
|
24
|
+
async function registryVersion(version: string): Promise<unknown> {
|
|
25
|
+
const response = await fetch(`${registryUrl}@adea-ai%2fapp-framework/${version}`, {
|
|
26
|
+
headers: { accept: 'application/json' },
|
|
27
|
+
})
|
|
28
|
+
if (response.status === 404) return null
|
|
29
|
+
if (!response.ok) throw new Error(`npm answered ${response.status}`)
|
|
30
|
+
return response.json()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function archiveIntegrity(
|
|
34
|
+
archive: string
|
|
35
|
+
): Promise<{ bytes: Uint8Array<ArrayBuffer>; integrity: string }> {
|
|
36
|
+
const info = await lstat(archive)
|
|
37
|
+
if (!info.isFile() || info.isSymbolicLink() || info.size < 1 || info.size > 512 * 1024 * 1024)
|
|
38
|
+
throw new Error('Invalid framework package')
|
|
39
|
+
const file = await open(archive, 'r')
|
|
40
|
+
try {
|
|
41
|
+
const bytes = new Uint8Array(await file.readFile())
|
|
42
|
+
const after = await file.stat()
|
|
43
|
+
if (bytes.length !== info.size || after.size !== info.size || after.ino !== info.ino)
|
|
44
|
+
throw new Error('Framework package changed')
|
|
45
|
+
return { bytes, integrity: `sha512-${createHash('sha512').update(bytes).digest('base64')}` }
|
|
46
|
+
} finally {
|
|
47
|
+
await file.close()
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const publishedIntegrity = (document: unknown) =>
|
|
52
|
+
typeof document === 'object' && document !== null
|
|
53
|
+
? (document as { dist?: { integrity?: unknown } }).dist?.integrity
|
|
54
|
+
: undefined
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Publish one tested framework tarball to npm from a clean checkout of a commit on origin/main.
|
|
58
|
+
* The tarball must be this checkout's version and record this commit as its source. A version
|
|
59
|
+
* npm already has is left alone when its integrity matches the tarball and refused otherwise.
|
|
60
|
+
* `NODE_AUTH_TOKEN` authenticates through a temporary npmrc that names the variable, never its
|
|
61
|
+
* value; without it npm uses its own configuration (trusted publishing in CI).
|
|
62
|
+
*/
|
|
63
|
+
export async function publishFrameworkPackage(options: {
|
|
64
|
+
env: Record<string, string | undefined>
|
|
65
|
+
archive: string
|
|
66
|
+
dryRun?: boolean
|
|
67
|
+
git?: GitRun
|
|
68
|
+
npm?: (args: string[]) => Promise<number>
|
|
69
|
+
registry?: (version: string) => Promise<unknown>
|
|
70
|
+
sleep?: (milliseconds: number) => Promise<unknown>
|
|
71
|
+
}): Promise<{
|
|
72
|
+
version: string
|
|
73
|
+
integrity: string
|
|
74
|
+
status: 'published' | 'already-published' | 'dry-run'
|
|
75
|
+
}> {
|
|
76
|
+
const git = options.git ?? gitCli()
|
|
77
|
+
const registry = options.registry ?? registryVersion
|
|
78
|
+
const npm = options.npm ?? npmCli
|
|
79
|
+
const sleep = options.sleep ?? ((milliseconds: number) => Bun.sleep(milliseconds))
|
|
80
|
+
const sha = await git(['rev-parse', '--verify', 'HEAD^{commit}'])
|
|
81
|
+
const provenance = await resolveLocalProvenance({
|
|
82
|
+
git,
|
|
83
|
+
sourceSha: sha,
|
|
84
|
+
versionSourcePath: 'package.json',
|
|
85
|
+
})
|
|
86
|
+
const manifest = JSON.parse(await readFile('package.json', 'utf8')) as {
|
|
87
|
+
name?: unknown
|
|
88
|
+
version?: unknown
|
|
89
|
+
}
|
|
90
|
+
const version = provenance.releasedVersion
|
|
91
|
+
const archive = resolve(options.archive)
|
|
92
|
+
if (
|
|
93
|
+
provenance.repository !== 'adea-ai/app-framework' ||
|
|
94
|
+
manifest.name !== packageName ||
|
|
95
|
+
manifest.version !== version ||
|
|
96
|
+
basename(archive) !== `adea-ai-app-framework-${version}.tgz`
|
|
97
|
+
)
|
|
98
|
+
throw new Error('Framework package source mismatch')
|
|
99
|
+
const { bytes, integrity } = await archiveIntegrity(archive)
|
|
100
|
+
const packed = readPackageFile(bytes, 'package/package.json') as {
|
|
101
|
+
name?: unknown
|
|
102
|
+
version?: unknown
|
|
103
|
+
}
|
|
104
|
+
const source = readPackageFile(bytes, 'package/dist/framework-source.json') as {
|
|
105
|
+
version?: unknown
|
|
106
|
+
commit?: unknown
|
|
107
|
+
}
|
|
108
|
+
if (
|
|
109
|
+
packed.name !== packageName ||
|
|
110
|
+
packed.version !== version ||
|
|
111
|
+
source.version !== version ||
|
|
112
|
+
source.commit !== sha
|
|
113
|
+
)
|
|
114
|
+
throw new Error('Framework package was not built from this checkout')
|
|
115
|
+
|
|
116
|
+
const existing = await registry(version)
|
|
117
|
+
if (existing !== null) {
|
|
118
|
+
if (publishedIntegrity(existing) !== integrity)
|
|
119
|
+
throw new Error('npm already has this version with other bytes')
|
|
120
|
+
return { version, integrity, status: 'already-published' }
|
|
121
|
+
}
|
|
122
|
+
const args = [
|
|
123
|
+
'publish',
|
|
124
|
+
archive,
|
|
125
|
+
'--access',
|
|
126
|
+
'public',
|
|
127
|
+
'--tag',
|
|
128
|
+
'latest',
|
|
129
|
+
'--registry',
|
|
130
|
+
registryUrl,
|
|
131
|
+
]
|
|
132
|
+
if (options.dryRun) args.push('--dry-run')
|
|
133
|
+
const config = options.env.NODE_AUTH_TOKEN
|
|
134
|
+
? await mkdtemp(join(tmpdir(), 'framework-npmrc-'))
|
|
135
|
+
: undefined
|
|
136
|
+
try {
|
|
137
|
+
if (config) {
|
|
138
|
+
// npm expands the variable when it reads the file; the token itself is never written.
|
|
139
|
+
await writeFile(
|
|
140
|
+
join(config, 'npmrc'),
|
|
141
|
+
'//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}\n',
|
|
142
|
+
{
|
|
143
|
+
mode: 0o600,
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
args.push('--userconfig', join(config, 'npmrc'))
|
|
147
|
+
}
|
|
148
|
+
if ((await npm(args)) !== 0) throw new Error('npm publish failed')
|
|
149
|
+
} finally {
|
|
150
|
+
if (config) await rm(config, { recursive: true, force: true })
|
|
151
|
+
}
|
|
152
|
+
if (options.dryRun) return { version, integrity, status: 'dry-run' }
|
|
153
|
+
for (let attempt = 0; attempt < 10; attempt++) {
|
|
154
|
+
const published = await registry(version)
|
|
155
|
+
if (published !== null) {
|
|
156
|
+
if (publishedIntegrity(published) !== integrity)
|
|
157
|
+
throw new Error('npm published other bytes than the tested package')
|
|
158
|
+
return { version, integrity, status: 'published' }
|
|
159
|
+
}
|
|
160
|
+
await sleep(3000)
|
|
161
|
+
}
|
|
162
|
+
throw new Error('npm does not list the published version yet')
|
|
163
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto'
|
|
2
|
+
import { readFile, writeFile } from 'node:fs/promises'
|
|
3
|
+
import { join } from 'node:path'
|
|
4
|
+
|
|
5
|
+
/** Moves a consumer's app-framework pin to one published npm version in a single step: the
|
|
6
|
+
* exact version in every package.json, the bun.lock entry and the reusable-workflow pins
|
|
7
|
+
* all name the same release, or nothing is written. */
|
|
8
|
+
|
|
9
|
+
const packageName = '@adea-ai/app-framework'
|
|
10
|
+
const registry = 'https://registry.npmjs.org'
|
|
11
|
+
const workflowPin =
|
|
12
|
+
/(adea-ai\/app-framework\/\.github\/workflows\/[\w.-]+\.ya?ml)@(?:[0-9a-f]{40}(?: # v[\w.-]+)?|v\d+\.\d+\.\d+)/g
|
|
13
|
+
const version = /^\d+\.\d+\.\d+$/
|
|
14
|
+
const manifestPin = /("@adea-ai\/app-framework"\s*:\s*")\d+\.\d+\.\d+"/g
|
|
15
|
+
|
|
16
|
+
export type FrameworkRelease = {
|
|
17
|
+
version: string
|
|
18
|
+
/** The commit the package was built from, which the reusable-workflow pins name. */
|
|
19
|
+
commit: string
|
|
20
|
+
integrity: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type FrameworkUpdateIo = {
|
|
24
|
+
/** npm registry JSON for a path under registry.npmjs.org. */
|
|
25
|
+
registry(path: string): Promise<unknown>
|
|
26
|
+
/** The bytes behind a registry tarball URL. */
|
|
27
|
+
download(url: string): Promise<Uint8Array<ArrayBuffer>>
|
|
28
|
+
/** Run a command in the consumer's root; resolves with its exit code. */
|
|
29
|
+
run(command: string[], cwd: string): Promise<number>
|
|
30
|
+
/** Repository-relative paths of tracked files. */
|
|
31
|
+
files(root: string): Promise<string[]>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type Packument = {
|
|
35
|
+
name?: unknown
|
|
36
|
+
'dist-tags'?: { latest?: unknown }
|
|
37
|
+
versions?: Record<
|
|
38
|
+
string,
|
|
39
|
+
{ name?: unknown; version?: unknown; dist?: { tarball?: unknown; integrity?: unknown } }
|
|
40
|
+
>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The npm version to pin: `requested`, or the `latest` dist-tag. The tarball must be the
|
|
44
|
+
* registry's own, match its sha512 integrity, contain the version it claims and record the
|
|
45
|
+
* commit it was built from. */
|
|
46
|
+
export async function resolveFrameworkRelease(
|
|
47
|
+
io: Pick<FrameworkUpdateIo, 'registry' | 'download'>,
|
|
48
|
+
requested?: string
|
|
49
|
+
): Promise<FrameworkRelease> {
|
|
50
|
+
if (requested !== undefined && !version.test(requested))
|
|
51
|
+
throw new Error(`Not a release version: ${requested}`)
|
|
52
|
+
const packument = (await io.registry('@adea-ai%2fapp-framework')) as Packument
|
|
53
|
+
if (packument.name !== packageName) throw new Error(`The registry does not list ${packageName}`)
|
|
54
|
+
const resolved = requested ?? packument['dist-tags']?.latest
|
|
55
|
+
if (typeof resolved !== 'string' || !version.test(resolved))
|
|
56
|
+
throw new Error(`The latest ${packageName} is not a release version`)
|
|
57
|
+
const entry = packument.versions?.[resolved]
|
|
58
|
+
const tarball = `${registry}/${packageName}/-/app-framework-${resolved}.tgz`
|
|
59
|
+
if (!entry || entry.name !== packageName || entry.version !== resolved)
|
|
60
|
+
throw new Error(`${packageName}@${resolved} is not published`)
|
|
61
|
+
if (entry.dist?.tarball !== tarball)
|
|
62
|
+
throw new Error(`${packageName}@${resolved} is not served from ${registry}`)
|
|
63
|
+
const integrity = typeof entry.dist.integrity === 'string' ? entry.dist.integrity : ''
|
|
64
|
+
if (!/^sha512-[A-Za-z0-9+/]{86}==$/.test(integrity))
|
|
65
|
+
throw new Error(`${packageName}@${resolved} has no sha512 integrity`)
|
|
66
|
+
const bytes = await io.download(tarball)
|
|
67
|
+
if (`sha512-${createHash('sha512').update(bytes).digest('base64')}` !== integrity)
|
|
68
|
+
throw new Error(`${packageName}@${resolved} does not match its published integrity`)
|
|
69
|
+
const manifest = readPackageFile(bytes, 'package/package.json') as {
|
|
70
|
+
name?: unknown
|
|
71
|
+
version?: unknown
|
|
72
|
+
}
|
|
73
|
+
if (manifest.name !== packageName || manifest.version !== resolved)
|
|
74
|
+
throw new Error(`The tarball contains ${String(manifest.name)}@${String(manifest.version)}`)
|
|
75
|
+
const source = readPackageFile(bytes, 'package/dist/framework-source.json') as {
|
|
76
|
+
version?: unknown
|
|
77
|
+
commit?: unknown
|
|
78
|
+
}
|
|
79
|
+
if (
|
|
80
|
+
source.version !== resolved ||
|
|
81
|
+
typeof source.commit !== 'string' ||
|
|
82
|
+
!/^[0-9a-f]{40}$/.test(source.commit)
|
|
83
|
+
)
|
|
84
|
+
throw new Error(`${packageName}@${resolved} does not record its source commit`)
|
|
85
|
+
return { version: resolved, commit: source.commit, integrity }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** One JSON file from a gzipped npm tarball. */
|
|
89
|
+
export function readPackageFile(bytes: Uint8Array<ArrayBuffer>, path: string): unknown {
|
|
90
|
+
const tar = Bun.gunzipSync(bytes)
|
|
91
|
+
const text = new TextDecoder()
|
|
92
|
+
for (let offset = 0; offset + 512 <= tar.length;) {
|
|
93
|
+
const header = tar.subarray(offset, offset + 512)
|
|
94
|
+
const name = text.decode(header.subarray(0, 100)).replace(/\0.*$/s, '')
|
|
95
|
+
if (!name) break
|
|
96
|
+
const size = Number.parseInt(text.decode(header.subarray(124, 136)).replace(/\0.*$/s, ''), 8)
|
|
97
|
+
if (name === path)
|
|
98
|
+
return JSON.parse(text.decode(tar.subarray(offset + 512, offset + 512 + size)))
|
|
99
|
+
offset += 512 + Math.ceil(size / 512) * 512
|
|
100
|
+
}
|
|
101
|
+
throw new Error(`The tarball has no ${path}`)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Comments bun drops when it rewrites bun.lock, such as release-please's version marker,
|
|
105
|
+
* keyed by the workspace block and the line they trail. */
|
|
106
|
+
function lockComments(lock: string): { block: string; line: string; comment: string }[] {
|
|
107
|
+
let block = ''
|
|
108
|
+
const comments = []
|
|
109
|
+
for (const line of lock.split('\n')) {
|
|
110
|
+
if (/^ {4}"[^"]*": \{/.test(line)) block = line
|
|
111
|
+
const match = /^(.*?,)\s*(\/\/.*)$/.exec(line)
|
|
112
|
+
if (match) comments.push({ block, line: match[1]!, comment: match[2]! })
|
|
113
|
+
}
|
|
114
|
+
return comments
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function restoreLockComments(lock: string, comments: ReturnType<typeof lockComments>): string {
|
|
118
|
+
const lines = lock.split('\n')
|
|
119
|
+
for (const { block, line, comment } of comments) {
|
|
120
|
+
const start = lines.indexOf(block)
|
|
121
|
+
const index = lines.findIndex((candidate, at) => at > start && candidate === line)
|
|
122
|
+
if (start < 0 || index < 0) throw new Error(`bun.lock lost the line for "${comment}"`)
|
|
123
|
+
lines[index] = `${line} ${comment}`
|
|
124
|
+
}
|
|
125
|
+
return lines.join('\n')
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
type FrameworkUpdate = { release: FrameworkRelease; changed: string[] }
|
|
129
|
+
|
|
130
|
+
/** Pin every app-framework reference in `root` to `release`, regenerate bun.lock and prove
|
|
131
|
+
* it with a frozen install. Any failure restores every file it touched. */
|
|
132
|
+
export async function applyFrameworkUpdate(
|
|
133
|
+
root: string,
|
|
134
|
+
release: FrameworkRelease,
|
|
135
|
+
io: Pick<FrameworkUpdateIo, 'run' | 'files'>
|
|
136
|
+
): Promise<FrameworkUpdate> {
|
|
137
|
+
const tracked = await io.files(root)
|
|
138
|
+
const manifests = tracked.filter((path) => /(^|\/)package\.json$/.test(path))
|
|
139
|
+
const workflows = tracked.filter((path) => /^\.github\/workflows\/[^/]+\.ya?ml$/.test(path))
|
|
140
|
+
const original = new Map<string, string>()
|
|
141
|
+
for (const path of [...manifests, ...workflows, 'bun.lock'])
|
|
142
|
+
original.set(path, await readFile(join(root, path), 'utf8'))
|
|
143
|
+
|
|
144
|
+
const next = new Map<string, string>()
|
|
145
|
+
for (const path of manifests) {
|
|
146
|
+
const text = original.get(path)!
|
|
147
|
+
const dependency = JSON.parse(text) as Record<string, Record<string, string> | undefined>
|
|
148
|
+
const declared = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']
|
|
149
|
+
.map((field) => dependency[field]?.[packageName])
|
|
150
|
+
.filter((value) => value !== undefined)
|
|
151
|
+
if (!declared.length) continue
|
|
152
|
+
for (const value of declared)
|
|
153
|
+
if (!version.test(value)) throw new Error(`${path} pins ${packageName} to ${value}`)
|
|
154
|
+
next.set(path, text.replace(manifestPin, `$1${release.version}"`))
|
|
155
|
+
}
|
|
156
|
+
for (const path of workflows) {
|
|
157
|
+
const text = original.get(path)!
|
|
158
|
+
const updated = text.replace(workflowPin, `$1@${release.commit} # v${release.version}`)
|
|
159
|
+
if (updated !== text) next.set(path, updated)
|
|
160
|
+
}
|
|
161
|
+
if (![...next.keys()].some((path) => manifests.includes(path)))
|
|
162
|
+
throw new Error(`No package.json depends on ${packageName}`)
|
|
163
|
+
|
|
164
|
+
const written: string[] = []
|
|
165
|
+
try {
|
|
166
|
+
for (const [path, text] of next) {
|
|
167
|
+
if (text === original.get(path)) continue
|
|
168
|
+
await writeFile(join(root, path), text)
|
|
169
|
+
written.push(path)
|
|
170
|
+
}
|
|
171
|
+
written.push('bun.lock')
|
|
172
|
+
if ((await io.run(['bun', 'install'], root)) !== 0) throw new Error('bun install failed')
|
|
173
|
+
const lock = restoreLockComments(
|
|
174
|
+
await readFile(join(root, 'bun.lock'), 'utf8'),
|
|
175
|
+
lockComments(original.get('bun.lock')!)
|
|
176
|
+
)
|
|
177
|
+
await writeFile(join(root, 'bun.lock'), lock)
|
|
178
|
+
const entries = lock
|
|
179
|
+
.split('\n')
|
|
180
|
+
.filter((line) => line.trimStart().startsWith(`"${packageName}": [`))
|
|
181
|
+
if (
|
|
182
|
+
entries.length !== 1 ||
|
|
183
|
+
!entries[0]!
|
|
184
|
+
.trimStart()
|
|
185
|
+
.startsWith(`"${packageName}": ["${packageName}@${release.version}", "",`) ||
|
|
186
|
+
!entries[0]!.trimEnd().endsWith(`"${release.integrity}"],`)
|
|
187
|
+
)
|
|
188
|
+
throw new Error('bun.lock does not pin the verified npm package')
|
|
189
|
+
if ((await io.run(['bun', 'install', '--frozen-lockfile'], root)) !== 0)
|
|
190
|
+
throw new Error('The regenerated bun.lock does not pass a frozen install')
|
|
191
|
+
} catch (error) {
|
|
192
|
+
for (const path of written) await writeFile(join(root, path), original.get(path)!)
|
|
193
|
+
throw error
|
|
194
|
+
}
|
|
195
|
+
return { release, changed: written }
|
|
196
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process'
|
|
2
|
+
|
|
3
|
+
/** Runs `gh` with arguments and optional stdin, resolving its stdout. */
|
|
4
|
+
type GitHubRun = (args: string[], input?: string) => Promise<string>
|
|
5
|
+
|
|
6
|
+
/** The `gh` CLI runner every release command shares. A failure rejects with
|
|
7
|
+
* 'GitHub request failed', carrying stderr and whether GitHub answered 404. */
|
|
8
|
+
export function githubCli(env?: NodeJS.ProcessEnv): GitHubRun {
|
|
9
|
+
return (args, input) =>
|
|
10
|
+
new Promise<string>((resolve, reject) => {
|
|
11
|
+
const child = execFile(
|
|
12
|
+
'gh',
|
|
13
|
+
args,
|
|
14
|
+
{ maxBuffer: 8 * 1024 * 1024, ...(env ? { env } : {}) },
|
|
15
|
+
(error, stdout, stderr) =>
|
|
16
|
+
error
|
|
17
|
+
? reject(
|
|
18
|
+
Object.assign(new Error('GitHub request failed'), {
|
|
19
|
+
stderr,
|
|
20
|
+
notFound: /\bHTTP 404\b/.test(stderr),
|
|
21
|
+
})
|
|
22
|
+
)
|
|
23
|
+
: resolve(stdout)
|
|
24
|
+
)
|
|
25
|
+
child.stdin?.end(input)
|
|
26
|
+
})
|
|
27
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Artifact } from './release-qualification'
|
|
2
|
+
|
|
3
|
+
/** Read the complete bounded asset inventory; embedded release metadata may be incomplete. */
|
|
4
|
+
export async function listGitHubReleaseAssets(
|
|
5
|
+
read: (path: string) => Promise<unknown>,
|
|
6
|
+
base: string,
|
|
7
|
+
releaseId: unknown
|
|
8
|
+
): Promise<Artifact[]> {
|
|
9
|
+
if (typeof releaseId !== 'number' || !Number.isSafeInteger(releaseId) || releaseId < 1)
|
|
10
|
+
throw new Error('Invalid release identity')
|
|
11
|
+
const result: Artifact[] = [],
|
|
12
|
+
names = new Set<string>()
|
|
13
|
+
for (let page = 1; page <= 10; page++) {
|
|
14
|
+
const values = await read(`${base}/releases/${releaseId}/assets?per_page=100&page=${page}`)
|
|
15
|
+
if (!Array.isArray(values) || values.length > 100)
|
|
16
|
+
throw new Error('Invalid GitHub release assets')
|
|
17
|
+
for (const value of values) {
|
|
18
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
19
|
+
throw new Error('Invalid GitHub release asset')
|
|
20
|
+
const asset = value as Record<string, unknown>
|
|
21
|
+
if (
|
|
22
|
+
typeof asset.name !== 'string' ||
|
|
23
|
+
!asset.name ||
|
|
24
|
+
!Number.isSafeInteger(asset.size) ||
|
|
25
|
+
Number(asset.size) < 0 ||
|
|
26
|
+
typeof asset.digest !== 'string' ||
|
|
27
|
+
names.has(asset.name)
|
|
28
|
+
)
|
|
29
|
+
throw new Error('Invalid GitHub release asset')
|
|
30
|
+
names.add(asset.name)
|
|
31
|
+
result.push({ name: asset.name, size: Number(asset.size), digest: asset.digest })
|
|
32
|
+
}
|
|
33
|
+
if (values.length < 100) return result
|
|
34
|
+
}
|
|
35
|
+
throw new Error('Too many release assets')
|
|
36
|
+
}
|