@adea-ai/app-framework 0.34.0 → 0.35.1

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 (40) hide show
  1. package/README.md +10 -10
  2. package/dist/desktop/desktop-client.d.ts +5 -0
  3. package/dist/desktop/desktop-client.js +12 -3
  4. package/dist/framework-source.json +1 -1
  5. package/dist/installer/installer-upgrade-command.js +1 -1
  6. package/dist/native/app-bundle.d.ts +14 -2
  7. package/dist/native/app-bundle.js +18 -5
  8. package/dist/native/desktop-build.d.ts +63 -0
  9. package/dist/native/desktop-build.js +119 -0
  10. package/dist/native/native-utilities.d.ts +18 -0
  11. package/dist/native/native-utilities.js +22 -1
  12. package/dist/native/sidecar-services.d.ts +5 -0
  13. package/dist/native/sidecar-services.js +10 -4
  14. package/dist/release/local-release.js +1 -1
  15. package/dist/shell/app-utilities.d.ts +1 -0
  16. package/dist/shell/app-utilities.js +2 -1
  17. package/dist/shell/media-query.d.ts +8 -0
  18. package/dist/shell/media-query.js +51 -0
  19. package/dist/updates/desktop-updater.js +1 -1
  20. package/dist/updates/release-version.d.ts +11 -0
  21. package/dist/updates/release-version.js +23 -1
  22. package/dist/updates/update-adapter.d.ts +38 -1
  23. package/dist/updates/update-adapter.js +121 -1
  24. package/dist/updates/update-channel-store.js +1 -1
  25. package/dist/updates/update-discovery.js +1 -1
  26. package/dist/updates/update-handoff-plan.js +1 -1
  27. package/dist/updates/update-manager.js +1 -1
  28. package/dist/views/update-surface.js +2 -2
  29. package/package.json +27 -2
  30. package/src/native/electrobun-types.d.ts +87 -0
  31. package/src/shell/app-utilities.tsx +1 -0
  32. package/src/shell/media-query.ts +59 -0
  33. package/src/updates/release-version.ts +33 -0
  34. package/src/updates/update-adapter.ts +168 -1
  35. package/templates/application/electrobun.config.ts +6 -2
  36. package/templates/application/scripts/app-version.ts +2 -8
  37. package/templates/application/scripts/build-desktop.ts +9 -36
  38. package/templates/application/src/bun/index.ts +5 -16
  39. package/templates/application/tsconfig.json +1 -1
  40. package/templates/application/src/electrobun.d.ts +0 -27
@@ -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
- }