@adea-ai/app-framework 0.24.0 → 0.25.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 (137) hide show
  1. package/README.md +49 -1
  2. package/dist/cli/macos-signing-cli.d.ts +2 -0
  3. package/dist/cli/macos-signing-cli.js +14 -0
  4. package/dist/desktop/channel-proof.js +7 -1
  5. package/dist/framework-source.json +1 -1
  6. package/dist/release/framework-package-publish.js +4 -2
  7. package/dist/release/local-release.d.ts +2 -0
  8. package/dist/release/local-release.js +25 -2
  9. package/dist/release/macos-signing.d.ts +27 -0
  10. package/dist/release/macos-signing.js +101 -0
  11. package/dist/shell/app-shell.js +21 -33
  12. package/dist/shell/navigation-drawer.d.ts +12 -0
  13. package/dist/shell/navigation-drawer.js +42 -0
  14. package/dist/updates/release-feed.d.ts +2 -0
  15. package/dist/updates/release-feed.js +11 -2
  16. package/package.json +16 -4
  17. package/src/shell/app-shell.tsx +29 -20
  18. package/src/shell/navigation-drawer.tsx +36 -0
  19. package/src/app/create-application.ts +0 -245
  20. package/src/app/service-registry.ts +0 -124
  21. package/src/ci/toolchain-identity.ts +0 -244
  22. package/src/cli/cef-helper-cli.ts +0 -21
  23. package/src/cli/cli-runner.ts +0 -29
  24. package/src/cli/create-application-cli.ts +0 -62
  25. package/src/cli/electrobun-shortcut-patch-cli.ts +0 -24
  26. package/src/cli/framework-update-cli.ts +0 -41
  27. package/src/cli/release-assets-plan-cli.ts +0 -14
  28. package/src/cli/release-cut-cli.ts +0 -41
  29. package/src/cli/release-descriptor-staging-cli.ts +0 -57
  30. package/src/cli/release-finalize-cli.ts +0 -34
  31. package/src/cli/release-promote-cli.ts +0 -31
  32. package/src/cli/release-publish-cli.ts +0 -46
  33. package/src/cli/release-sign-cli.ts +0 -24
  34. package/src/cli/release-step-cli.ts +0 -71
  35. package/src/cli/toolchain-identity-cli.ts +0 -12
  36. package/src/cli/update-helper-cli.ts +0 -12
  37. package/src/cli/windows-runtime-patch-cli.ts +0 -17
  38. package/src/desktop/application-command-client.ts +0 -43
  39. package/src/desktop/channel-handshake.ts +0 -136
  40. package/src/desktop/channel-proof.ts +0 -122
  41. package/src/desktop/desktop-client.ts +0 -303
  42. package/src/desktop/desktop-gateway.ts +0 -189
  43. package/src/desktop/desktop-host.ts +0 -335
  44. package/src/desktop/desktop-stream.ts +0 -324
  45. package/src/desktop/loopback-policy.ts +0 -41
  46. package/src/desktop/open-url-channel.ts +0 -79
  47. package/src/desktop/string-policy.ts +0 -9
  48. package/src/installer/archive-entry.ts +0 -32
  49. package/src/installer/command-artifact.ts +0 -307
  50. package/src/installer/command-qualification-command.ts +0 -75
  51. package/src/installer/hosted-runner.ts +0 -11
  52. package/src/installer/installed-payload.ts +0 -408
  53. package/src/installer/installer-ci-bootstrap.ts +0 -199
  54. package/src/installer/installer-ci-preflight.ts +0 -61
  55. package/src/installer/installer-ci-worker.ts +0 -105
  56. package/src/installer/installer-extraction.ts +0 -367
  57. package/src/installer/installer-fetch-guard.ts +0 -75
  58. package/src/installer/installer-identity.ts +0 -331
  59. package/src/installer/installer-layout.ts +0 -167
  60. package/src/installer/installer-observation.ts +0 -671
  61. package/src/installer/installer-process-cleanup.ts +0 -167
  62. package/src/installer/installer-qualification-command.ts +0 -81
  63. package/src/installer/installer-renderer-evidence.ts +0 -268
  64. package/src/installer/installer-upgrade-command.ts +0 -226
  65. package/src/installer/installer-worker-guard.ts +0 -112
  66. package/src/installer/native-executable.ts +0 -37
  67. package/src/installer/upgrade-asset-download.ts +0 -72
  68. package/src/installer/write-all.ts +0 -19
  69. package/src/native/app-bundle.ts +0 -86
  70. package/src/native/cef-helper.ts +0 -471
  71. package/src/native/desktop-build-hook.ts +0 -21
  72. package/src/native/electrobun-source-patch.ts +0 -107
  73. package/src/native/linux-cef-links.ts +0 -14
  74. package/src/native/native-secret-store.ts +0 -99
  75. package/src/native/native-utilities.ts +0 -166
  76. package/src/native/partitioned-window.ts +0 -62
  77. package/src/native/secure-window.ts +0 -115
  78. package/src/native/sidecar-services.ts +0 -71
  79. package/src/native/sidecar.ts +0 -387
  80. package/src/native/window-bootstrap.ts +0 -77
  81. package/src/native/windows-build-hook-internal.ts +0 -49
  82. package/src/native/windows-build-hook.ts +0 -12
  83. package/src/native/windows-runtime-patch-internal.ts +0 -48
  84. package/src/native/windows-runtime-patch.ts +0 -15
  85. package/src/release/feed-release-cut.ts +0 -110
  86. package/src/release/feed-state.ts +0 -135
  87. package/src/release/framework-package-publish.ts +0 -163
  88. package/src/release/framework-update.ts +0 -196
  89. package/src/release/github-cli.ts +0 -27
  90. package/src/release/github-release-assets.ts +0 -36
  91. package/src/release/github-release-cut.ts +0 -237
  92. package/src/release/github-release-lookup.ts +0 -39
  93. package/src/release/github-release-promotion.ts +0 -112
  94. package/src/release/github-release-provenance.ts +0 -65
  95. package/src/release/github-release-publisher.ts +0 -90
  96. package/src/release/github-release-qualification.ts +0 -144
  97. package/src/release/local-provenance.ts +0 -92
  98. package/src/release/local-release.ts +0 -525
  99. package/src/release/macos-dmg.ts +0 -113
  100. package/src/release/release-artifact.ts +0 -53
  101. package/src/release/release-assets-plan.ts +0 -118
  102. package/src/release/release-config.ts +0 -420
  103. package/src/release/release-cut-command.ts +0 -80
  104. package/src/release/release-cut.ts +0 -133
  105. package/src/release/release-descriptor-staging.ts +0 -242
  106. package/src/release/release-finalize.ts +0 -191
  107. package/src/release/release-promotion-command.ts +0 -36
  108. package/src/release/release-promotion.ts +0 -132
  109. package/src/release/release-publication.ts +0 -213
  110. package/src/release/release-publish-command.ts +0 -163
  111. package/src/release/release-qualification.ts +0 -397
  112. package/src/release/release-staging.ts +0 -87
  113. package/src/release/release-steps.ts +0 -173
  114. package/src/release/retained-release-build.ts +0 -217
  115. package/src/shell/application-menu-commands.ts +0 -6
  116. package/src/shell/application-menu.ts +0 -250
  117. package/src/updates/channel-update-manager.ts +0 -127
  118. package/src/updates/desktop-updater.ts +0 -440
  119. package/src/updates/release-feed.ts +0 -187
  120. package/src/updates/release-location.ts +0 -101
  121. package/src/updates/signed-release.ts +0 -311
  122. package/src/updates/stable-file.ts +0 -32
  123. package/src/updates/update-arm.ts +0 -107
  124. package/src/updates/update-channel-store.ts +0 -86
  125. package/src/updates/update-discovery.ts +0 -113
  126. package/src/updates/update-download.ts +0 -82
  127. package/src/updates/update-exclusive-rename.ts +0 -58
  128. package/src/updates/update-extraction.ts +0 -261
  129. package/src/updates/update-handoff-plan.ts +0 -75
  130. package/src/updates/update-helper.ts +0 -87
  131. package/src/updates/update-launch.ts +0 -33
  132. package/src/updates/update-manager.ts +0 -130
  133. package/src/updates/update-process-fence.ts +0 -125
  134. package/src/updates/update-resume.ts +0 -34
  135. package/src/updates/update-shutdown.ts +0 -37
  136. package/src/updates/update-swap-stage.ts +0 -75
  137. package/src/updates/update-swap.ts +0 -30
@@ -1,113 +0,0 @@
1
- /** Sizing strategy adapted from adea-ai/adea scripts/create-desktop-dmg.mjs,
2
- * commit 6155d18941acbb14d9099bc2a33a50ee9683a068 (Apache-2.0). */
3
- import { execFileSync } from 'node:child_process'
4
- import {
5
- linkSync,
6
- lstatSync,
7
- mkdirSync,
8
- mkdtempSync,
9
- readdirSync,
10
- rmSync,
11
- symlinkSync,
12
- } from 'node:fs'
13
- import { basename, dirname, join, resolve } from 'node:path'
14
- import { assertPortableAppName } from '../installer/installer-layout'
15
-
16
- const MIB = 1024 * 1024
17
- export function dmgCapacityMiB(input: { logicalBytes: number; entries: number }): number {
18
- if (
19
- !Number.isSafeInteger(input.logicalBytes) ||
20
- input.logicalBytes < 0 ||
21
- !Number.isSafeInteger(input.entries) ||
22
- input.entries < 1
23
- )
24
- throw new Error('Invalid disk image size')
25
- const bytes = Math.ceil(input.logicalBytes * 1.25) + input.entries * 4096 + 32 * MIB
26
- if (!Number.isSafeInteger(bytes)) throw new Error('Disk image size exceeds bound')
27
- return Math.max(64, Math.ceil(bytes / MIB))
28
- }
29
- function treeSize(root: string): { logicalBytes: number; entries: number } {
30
- let logicalBytes = 0,
31
- entries = 0
32
- const pending = [root]
33
- while (pending.length) {
34
- const path = pending.pop()!,
35
- info = lstatSync(path)
36
- if (++entries > 1_000_000) throw new Error('Disk image contains too many entries')
37
- if (info.isFile()) logicalBytes += info.size
38
- else if (info.isDirectory())
39
- for (const name of readdirSync(path)) pending.push(join(path, name))
40
- else if (!info.isSymbolicLink()) throw new Error('Unsupported disk image entry')
41
- if (!Number.isSafeInteger(logicalBytes)) throw new Error('Disk image size exceeds bound')
42
- }
43
- return { logicalBytes, entries }
44
- }
45
- function run(command: string, args: string[]): void {
46
- execFileSync(command, args, { stdio: 'inherit', timeout: 600_000 })
47
- }
48
- /**
49
- * Hosted macOS runners intermittently answer `hdiutil verify` with "Resource temporarily
50
- * unavailable" while the `diskimages-helper` from the image `create` still holds the file.
51
- * Three attempts five seconds apart were not always enough, so back off from 5 to 80 seconds
52
- * over six attempts (about 2.5 minutes) before failing.
53
- */
54
- export function verifyImage(
55
- image: string,
56
- io: { run(command: string, args: string[]): void; wait(ms: number): void } = {
57
- run,
58
- wait: Bun.sleepSync,
59
- }
60
- ): void {
61
- for (let attempt = 1; ; attempt++) {
62
- try {
63
- io.run('/usr/bin/hdiutil', ['verify', image])
64
- return
65
- } catch (error) {
66
- if (attempt === 6) throw error
67
- io.wait(5000 * 2 ** (attempt - 1))
68
- }
69
- }
70
- }
71
- /** Build a correctly sized macOS DMG without replacing an existing artifact. */
72
- export function createMacosDmg(options: { appName: string; appPath: string; outputPath: string }): {
73
- capacityMiB: number
74
- } {
75
- if (process.platform !== 'darwin') throw new Error('Disk image creation requires macOS')
76
- assertPortableAppName(options.appName)
77
- const app = resolve(options.appPath),
78
- output = resolve(options.outputPath)
79
- const info = lstatSync(app)
80
- if (
81
- !app.endsWith('.app') ||
82
- !info.isDirectory() ||
83
- info.isSymbolicLink() ||
84
- !output.endsWith('.dmg')
85
- )
86
- throw new Error('Invalid disk image paths')
87
- const staging = mkdtempSync(join(dirname(output), '.framework-dmg-'))
88
- try {
89
- const payload = join(staging, 'payload'),
90
- image = join(staging, 'result.dmg')
91
- mkdirSync(payload)
92
- run('/usr/bin/ditto', [app, join(payload, basename(app))])
93
- symlinkSync('/Applications', join(payload, 'Applications'))
94
- const capacityMiB = dmgCapacityMiB(treeSize(payload))
95
- run('/usr/bin/hdiutil', [
96
- 'create',
97
- '-volname',
98
- options.appName,
99
- '-srcfolder',
100
- payload,
101
- '-size',
102
- `${capacityMiB}m`,
103
- '-format',
104
- 'ULFO',
105
- image,
106
- ])
107
- verifyImage(image)
108
- linkSync(image, output) // Atomic and exclusive; the staging directory is on the same filesystem.
109
- return { capacityMiB }
110
- } finally {
111
- rmSync(staging, { recursive: true, force: true })
112
- }
113
- }
@@ -1,53 +0,0 @@
1
- import { createHash, type KeyObject } from 'node:crypto'
2
- import { open } from 'node:fs/promises'
3
- import { basename } from 'node:path'
4
- import {
5
- signReleaseDescriptor,
6
- type ReleaseDescriptor,
7
- type SignedRelease,
8
- } from '../updates/signed-release'
9
-
10
- export type ReleaseArtifactIdentity = Omit<ReleaseDescriptor, 'schema' | 'asset'>
11
-
12
- /** Hash the actual staged archive without buffering it, then sign its provenance and its
13
- * URL in the app's release feed (`feed` ends in `/`). */
14
- export async function signReleaseArtifact(
15
- path: string,
16
- identity: ReleaseArtifactIdentity,
17
- key: KeyObject,
18
- feed: string
19
- ): Promise<SignedRelease> {
20
- const file = await open(path, 'r')
21
- try {
22
- const before = await file.stat()
23
- if (!before.isFile() || !Number.isSafeInteger(before.size) || before.size < 1)
24
- throw new Error('Invalid release artifact')
25
- const hash = createHash('sha256')
26
- let size = 0
27
- for await (const chunk of file.createReadStream({ autoClose: false })) {
28
- size += chunk.length
29
- if (!Number.isSafeInteger(size) || size > before.size)
30
- throw new Error('Release artifact changed during hashing')
31
- hash.update(chunk)
32
- }
33
- const after = await file.stat()
34
- if (
35
- size !== before.size ||
36
- after.size !== before.size ||
37
- after.mtimeMs !== before.mtimeMs ||
38
- after.ino !== before.ino ||
39
- after.dev !== before.dev
40
- )
41
- throw new Error('Release artifact changed during hashing')
42
- const name = basename(path)
43
- const asset = {
44
- name,
45
- url: `${feed}${identity.tag}/${name}`,
46
- size,
47
- sha256: hash.digest('hex'),
48
- }
49
- return signReleaseDescriptor({ ...identity, schema: 2, asset }, key)
50
- } finally {
51
- await file.close()
52
- }
53
- }
@@ -1,118 +0,0 @@
1
- import { githubCli } from './github-cli'
2
- import { createGitHubReleaseCutProvider } from './github-release-cut'
3
- import { parseReleaseConfig } from './release-config'
4
- import { isRepositorySlug } from '../updates/signed-release'
5
-
6
- /** GitHub reads need credentials but must not inherit release signing keys. */
7
- export function releasePlanGitHubEnvironment(
8
- env: Record<string, string | undefined>
9
- ): Record<string, string> {
10
- const clean: Record<string, string> = {}
11
- for (const name of [
12
- 'PATH',
13
- 'HOME',
14
- 'USERPROFILE',
15
- 'SystemRoot',
16
- 'WINDIR',
17
- 'TMP',
18
- 'TEMP',
19
- 'TMPDIR',
20
- 'GH_TOKEN',
21
- 'GITHUB_TOKEN',
22
- 'GH_HOST',
23
- 'GH_CONFIG_DIR',
24
- 'XDG_CONFIG_HOME',
25
- 'HTTP_PROXY',
26
- 'HTTPS_PROXY',
27
- 'NO_PROXY',
28
- 'http_proxy',
29
- 'https_proxy',
30
- 'no_proxy',
31
- 'SSL_CERT_FILE',
32
- 'SSL_CERT_DIR',
33
- ])
34
- if (env[name]) clean[name] = env[name]!
35
- return clean
36
- }
37
-
38
- /** Resolve the immutable release source before building anything in a trusted assets workflow. */
39
- export async function planReleaseAssets(options: {
40
- env: Record<string, string | undefined>
41
- config: unknown
42
- tag: string
43
- run?: (args: string[], input?: string) => Promise<string>
44
- }): Promise<{ tag: string; sourceSha: string; workflowSha: string; version: string }> {
45
- const { env, config, tag } = options
46
- if (
47
- env.GITHUB_ACTIONS !== 'true' ||
48
- env.GITHUB_REF !== 'refs/heads/main' ||
49
- env.GITHUB_EVENT_NAME !== 'workflow_dispatch' ||
50
- !isRepositorySlug(env.GITHUB_REPOSITORY ?? '') ||
51
- !/^[a-f0-9]{40}$/.test(env.GITHUB_SHA ?? '') ||
52
- !/^[1-9]\d{0,19}$/.test(env.GITHUB_RUN_ID ?? '') ||
53
- !/^[1-9]\d{0,8}$/.test(env.GITHUB_RUN_ATTEMPT ?? '') ||
54
- !/^v\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(tag) ||
55
- tag.length > 65
56
- )
57
- throw new Error('Asset planning requires a trusted main workflow and valid tag')
58
- if (
59
- typeof config !== 'object' ||
60
- config === null ||
61
- Array.isArray(config) ||
62
- typeof (config as { appName?: unknown }).appName !== 'string'
63
- )
64
- throw new Error('Invalid release configuration')
65
- const { requirements, releasePleaseManifestPath, releaseWorkflows } = parseReleaseConfig(config)
66
- requirements(tag)
67
- const run = options.run ?? githubCli(releasePlanGitHubEnvironment(env))
68
- const repository = env.GITHUB_REPOSITORY!,
69
- workflowSha = env.GITHUB_SHA!
70
- const provider = createGitHubReleaseCutProvider({
71
- repository,
72
- appName: (config as { appName: string }).appName,
73
- requirements,
74
- assetsWorkflow: releaseWorkflows.assets,
75
- releasePleaseManifestPath,
76
- // Asset jobs read with a contents:read job token, which cannot list drafts.
77
- hiddenDrafts: true,
78
- run,
79
- })
80
- const response: unknown = JSON.parse(
81
- await run([
82
- 'api',
83
- `repos/${repository}/actions/runs/${env.GITHUB_RUN_ID}/attempts/${env.GITHUB_RUN_ATTEMPT}`,
84
- ])
85
- )
86
- if (typeof response !== 'object' || response === null || Array.isArray(response))
87
- throw new Error('Invalid asset workflow response')
88
- const workflow = response as {
89
- id?: unknown
90
- run_attempt?: unknown
91
- head_sha?: unknown
92
- head_branch?: unknown
93
- event?: unknown
94
- path?: unknown
95
- display_title?: unknown
96
- repository?: { full_name?: unknown }
97
- }
98
- if (
99
- String(workflow.id) !== env.GITHUB_RUN_ID ||
100
- String(workflow.run_attempt) !== env.GITHUB_RUN_ATTEMPT ||
101
- workflow.head_sha !== workflowSha ||
102
- workflow.head_branch !== 'main' ||
103
- workflow.event !== 'workflow_dispatch' ||
104
- workflow.path !== releaseWorkflows.assets ||
105
- workflow.display_title !== `framework-release-assets:${tag}` ||
106
- workflow.repository?.full_name !== repository
107
- )
108
- throw new Error('Release-assets workflow provenance mismatch')
109
- const release = await provider.find(tag)
110
- if (
111
- !release ||
112
- (release.draft ? release.stageableDraft !== true : !release.prerelease) ||
113
- !(await provider.isMainAncestor(release.sourceSha)) ||
114
- !(await provider.isMainAncestor(workflowSha))
115
- )
116
- throw new Error('Release source or workflow is not an eligible main ancestor')
117
- return { tag, sourceSha: release.sourceSha, workflowSha, version: tag.slice(1) }
118
- }