@adea-ai/app-framework 0.33.1 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +30 -12
  2. package/ci/desktop-release.sh +203 -0
  3. package/dist/app/create-application.d.ts +2 -0
  4. package/dist/app/create-application.js +19 -5
  5. package/dist/cli/create-application-cli.js +6 -4
  6. package/dist/desktop/desktop-client.d.ts +5 -0
  7. package/dist/desktop/desktop-client.js +12 -3
  8. package/dist/framework-source.json +1 -1
  9. package/dist/installer/installer-upgrade-command.js +1 -1
  10. package/dist/native/app-bundle.d.ts +14 -2
  11. package/dist/native/app-bundle.js +18 -5
  12. package/dist/native/desktop-build.d.ts +63 -0
  13. package/dist/native/desktop-build.js +119 -0
  14. package/dist/native/native-utilities.d.ts +18 -0
  15. package/dist/native/native-utilities.js +22 -1
  16. package/dist/native/sidecar-services.d.ts +5 -0
  17. package/dist/native/sidecar-services.js +10 -4
  18. package/dist/release/local-release.js +1 -1
  19. package/dist/release/release-assets-plan.js +4 -2
  20. package/dist/release/release-config.d.ts +7 -1
  21. package/dist/release/release-config.js +17 -6
  22. package/dist/release/release-cut-command.js +4 -2
  23. package/dist/release/release-finalize.js +3 -3
  24. package/dist/release/release-promotion-command.js +2 -2
  25. package/dist/release/release-publish-command.js +2 -2
  26. package/dist/release/retained-release-build.js +2 -2
  27. package/dist/shell/app-utilities.d.ts +1 -0
  28. package/dist/shell/app-utilities.js +2 -1
  29. package/dist/shell/media-query.d.ts +8 -0
  30. package/dist/shell/media-query.js +51 -0
  31. package/dist/updates/desktop-updater.js +1 -1
  32. package/dist/updates/release-version.d.ts +11 -0
  33. package/dist/updates/release-version.js +23 -1
  34. package/dist/updates/update-adapter.d.ts +38 -1
  35. package/dist/updates/update-adapter.js +121 -1
  36. package/dist/updates/update-channel-store.js +1 -1
  37. package/dist/updates/update-discovery.js +1 -1
  38. package/dist/updates/update-handoff-plan.js +1 -1
  39. package/dist/updates/update-manager.js +1 -1
  40. package/dist/views/update-surface.js +2 -2
  41. package/package.json +29 -2
  42. package/src/native/electrobun-types.d.ts +87 -0
  43. package/src/shell/app-utilities.tsx +1 -0
  44. package/src/shell/media-query.ts +59 -0
  45. package/src/updates/release-version.ts +33 -0
  46. package/src/updates/update-adapter.ts +168 -1
  47. package/templates/application/.gitlab/desktop-release.yml +42 -0
  48. package/templates/application/.gitlab-ci.yml +9 -0
  49. package/templates/application/README.md +14 -3
  50. package/templates/application/electrobun.config.ts +6 -2
  51. package/templates/application/scripts/app-version.ts +2 -8
  52. package/templates/application/scripts/build-desktop.ts +9 -36
  53. package/templates/application/src/bun/index.ts +5 -16
  54. package/templates/application/tsconfig.json +1 -1
  55. package/templates/application/src/electrobun.d.ts +0 -27
@@ -2,14 +2,23 @@ image:
2
2
  name: oven/bun:1.4.4
3
3
  entrypoint: ['']
4
4
 
5
+ include:
6
+ - local: .gitlab/desktop-release.yml
7
+
5
8
  workflow:
6
9
  rules:
7
10
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
8
11
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
12
+ # Release tags run only the desktop release jobs (.gitlab/desktop-release.yml).
13
+ - if: $CI_COMMIT_TAG
9
14
 
10
15
  validate:
11
16
  timeout: 20m
12
17
  # {{GITLAB_RUNNER_TAGS}}
18
+ rules:
19
+ - if: $CI_COMMIT_TAG
20
+ when: never
21
+ - when: on_success
13
22
  script:
14
23
  - bun install --frozen-lockfile
15
24
  - bun run format:check
@@ -9,9 +9,20 @@ with the same checks as the GitHub validation workflow. Commit `bun.lock`
9
9
  before running it. It uses an untagged Docker runner by default; if your GitLab
10
10
  runner requires tags, supply `--gitlab-runner-tags tag1,tag2` when generating
11
11
  the app or add the tags to the job afterward. The runner must have access to
12
- the package registry. This is validation only: the generated release workflows
13
- and release tooling below still require GitHub Actions and have not been migrated
14
- to GitLab.
12
+ the package registry.
13
+
14
+ `.gitlab/desktop-release.yml` publishes desktop releases from GitLab: a
15
+ `v<version>` tag on main (from Release Please) runs `adea-desktop-release`,
16
+ which builds the release runner's platform, signs the channel descriptors,
17
+ uploads the release to `releaseFeed` and links its files on the GitLab release,
18
+ then promotes the newest qualified daily to stable after `soakHours`. The release
19
+ runner needs bun, git and the aws CLI; pass its tags with
20
+ `--gitlab-release-runner-tags` (a macOS arm64 shell runner builds `macos-arm64`).
21
+ It stays off until the project sets the protected variable
22
+ `DESKTOP_RELEASE_ENABLED=true`, protects `v*` tags and adds the protected,
23
+ masked `DESKTOP_UPDATE_SIGNING_KEY_B64` (base64 of the private key PEM) and
24
+ bucket credentials listed in that file. A GitLab-only app may remove the
25
+ `.github` workflows and `releaseWorkflows` from `release-config.json`.
15
26
 
16
27
  The generated release control workflow uses `release-config.json` for daily,
17
28
  dev and stable channels. Run `bun install` and commit `bun.lock` before
@@ -1,3 +1,4 @@
1
+ import { signsMacosBuild } from '@adea-ai/app-framework/desktop-build'
1
2
  import { createRendererProfile } from '@adea-ai/app-framework/renderer-profile'
2
3
  import { appConfig } from './src/app-config'
3
4
  import { applicationVersion } from './scripts/app-version'
@@ -17,10 +18,13 @@ export default {
17
18
  views: {},
18
19
  copy: {
19
20
  'build/client': 'client',
20
- 'node_modules/@adea-ai/app-framework/dist/update-helper.bundle.js': 'update-helper.js',
21
+ // scripts/build-desktop.ts stages the framework's post-exit update helper here.
22
+ 'build/update-helper.js': 'update-helper.js',
21
23
  'release-config.json': 'release-config.json',
22
24
  },
23
25
  ...profile.build,
24
- mac: { ...profile.build.mac, createDmg: false },
26
+ // Electrobun signs the stable payload only when an identity is configured; a stable macOS
27
+ // build without a Developer ID gets an ad-hoc one (scripts/build-desktop.ts).
28
+ mac: { ...profile.build.mac, codesign: signsMacosBuild(process.env), createDmg: false },
25
29
  },
26
30
  }
@@ -1,13 +1,7 @@
1
+ import { applicationVersion as releaseVersion } from '@adea-ai/app-framework/release-version'
1
2
  import appPackage from '../package.json' with { type: 'json' }
2
3
 
3
4
  /** Keep the shell and its client on the same validated release version. */
4
5
  export function applicationVersion(env: Record<string, string | undefined> = process.env): string {
5
- const version = env.ADEA_APP_RELEASE_VERSION ?? appPackage.version
6
- if (
7
- typeof version !== 'string' ||
8
- version.length > 64 ||
9
- !/^\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(version)
10
- )
11
- throw new Error('Invalid application release version')
12
- return version
6
+ return releaseVersion(env, appPackage.version)
13
7
  }
@@ -1,38 +1,11 @@
1
- import { join } from 'node:path'
2
- import { createMacosDmg } from '@adea-ai/app-framework/macos-dmg'
1
+ import {
2
+ parseDesktopBuildEnvironment,
3
+ runElectrobunBuild,
4
+ stageUpdateHelper,
5
+ } from '@adea-ai/app-framework/desktop-build'
3
6
  import { appConfig } from '../src/app-config'
4
7
 
5
- const [environment, ...extra] = process.argv.slice(2)
6
- if (!environment || !['dev', 'stable'].includes(environment) || extra.length)
7
- throw new Error('Expected dev or stable build environment')
8
- const env = { ...process.env }
9
- if (env.ADEA_ENABLE_POSIX_LAUNCH_LEASE === '1') {
10
- if (environment !== 'stable' || process.platform !== 'darwin' || process.arch !== 'arm64')
11
- throw new Error('POSIX launch lease integration supports stable macOS arm64 builds only')
12
- }
13
- if (process.platform === 'win32') {
14
- const tar = Bun.spawnSync({ cmd: ['tar', '--version'], stdout: 'pipe', stderr: 'pipe', env })
15
- if (tar.exitCode !== 0) throw new Error('A working tar executable is required')
16
- if (/GNU tar/i.test(tar.stdout.toString())) env.TAR_OPTIONS = '--force-local'
17
- }
18
- const child = Bun.spawn({
19
- cmd: [
20
- 'node',
21
- join('node_modules', 'electrobun', 'bin', 'electrobun.cjs'),
22
- 'build',
23
- `--env=${environment}`,
24
- ],
25
- env,
26
- stdin: 'inherit',
27
- stdout: 'inherit',
28
- stderr: 'inherit',
29
- })
30
- if ((await child.exited) !== 0) throw new Error('Desktop build failed')
31
- if (environment === 'stable' && process.platform === 'darwin') {
32
- const bundle = appConfig.name.replaceAll(' ', '')
33
- createMacosDmg({
34
- appName: appConfig.name,
35
- appPath: join('build', `stable-macos-${process.arch}`, `${appConfig.name}.app`),
36
- outputPath: join('artifacts', `macos-${process.arch}-${bundle}.dmg`),
37
- })
38
- }
8
+ const environment = parseDesktopBuildEnvironment(process.argv.slice(2))
9
+ // electrobun.config.ts copies the staged helper into the bundle.
10
+ stageUpdateHelper('build')
11
+ await runElectrobunBuild({ environment, appName: appConfig.name })
@@ -29,7 +29,10 @@ import {
29
29
  startDesktopHostWithRetry,
30
30
  } from '@adea-ai/app-framework/desktop-host'
31
31
  import { createServiceRegistry } from '@adea-ai/app-framework/service-registry'
32
- import { registerNativeUtilities } from '@adea-ai/app-framework/native-utilities'
32
+ import {
33
+ electrobunFileDialogs,
34
+ registerNativeUtilities,
35
+ } from '@adea-ai/app-framework/native-utilities'
33
36
  import { appConfig } from '../app-config'
34
37
 
35
38
  const HOST_DRAIN_TIMEOUT_MS = 5000
@@ -85,21 +88,7 @@ registerNativeUtilities({
85
88
  info: { name: appConfig.name, version, platform: process.platform },
86
89
  authorize: (principal) => principal === 'app-window',
87
90
  openExternal: (url) => Utils.openExternal(url),
88
- pickFolder: (startingFolder) =>
89
- Utils.openFileDialog({
90
- ...(startingFolder === undefined ? {} : { startingFolder }),
91
- canChooseFiles: false,
92
- canChooseDirectory: true,
93
- allowsMultipleSelection: false,
94
- }),
95
- pickFiles: ({ startingFolder, extensions, multiple }) =>
96
- Utils.openFileDialog({
97
- ...(startingFolder === undefined ? {} : { startingFolder }),
98
- allowedFileTypes: extensions === undefined ? '*' : extensions.join(','),
99
- canChooseFiles: true,
100
- canChooseDirectory: false,
101
- allowsMultipleSelection: multiple,
102
- }),
91
+ ...electrobunFileDialogs(Utils),
103
92
  })
104
93
  services.register('app.hello', {
105
94
  parse: (value) => value,
@@ -5,7 +5,7 @@
5
5
  "moduleResolution": "Bundler",
6
6
  "jsx": "preserve",
7
7
  "jsxImportSource": "solid-js",
8
- "types": ["bun", "vite/client"],
8
+ "types": ["bun", "vite/client", "@adea-ai/app-framework/electrobun-types"],
9
9
  "strict": true,
10
10
  "skipLibCheck": true,
11
11
  "noEmit": true,
@@ -1,27 +0,0 @@
1
- /** Narrow declarations for the Electrobun 2.0.5 APIs used by the generated host. */
2
- declare module 'electrobun/bun' {
3
- import type { NativeWindow, SecureWindowOptions } from '@adea-ai/app-framework/secure-window'
4
- export class BrowserWindow implements NativeWindow {
5
- constructor(options: SecureWindowOptions)
6
- webview: NativeWindow['webview']
7
- on(event: 'close', handler: () => void): unknown
8
- close(): unknown
9
- }
10
- export const ApplicationMenu: {
11
- setApplicationMenu(
12
- menu: import('@adea-ai/app-framework/application-menu').ApplicationMenuItem[]
13
- ): void
14
- on(name: 'application-menu-clicked', handler: (event: unknown) => void): void
15
- }
16
- export const Utils: {
17
- paths: { userData: string }
18
- openExternal(url: string): boolean
19
- openFileDialog(options?: {
20
- startingFolder?: string
21
- allowedFileTypes?: string
22
- canChooseFiles?: boolean
23
- canChooseDirectory?: boolean
24
- allowsMultipleSelection?: boolean
25
- }): Promise<string[]>
26
- }
27
- }