@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.
Files changed (474) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +30 -0
  3. package/README.md +967 -2
  4. package/dist/app/application.d.ts +47 -0
  5. package/dist/app/application.js +115 -0
  6. package/dist/app/create-application.d.ts +13 -0
  7. package/dist/app/create-application.js +178 -0
  8. package/dist/app/service-registry.d.ts +44 -0
  9. package/dist/app/service-registry.js +116 -0
  10. package/dist/appearance/appearance-host.d.ts +62 -0
  11. package/dist/appearance/appearance-host.js +115 -0
  12. package/dist/appearance/appearance-preferences.d.ts +106 -0
  13. package/dist/appearance/appearance-preferences.js +175 -0
  14. package/dist/appearance/composition.d.ts +11 -0
  15. package/dist/appearance/composition.js +16 -0
  16. package/dist/appearance/custom-theme-import.d.ts +14 -0
  17. package/dist/appearance/custom-theme-import.js +315 -0
  18. package/dist/appearance/custom-theme-library.d.ts +146 -0
  19. package/dist/appearance/custom-theme-library.js +378 -0
  20. package/dist/appearance/editor.d.ts +20 -0
  21. package/dist/appearance/editor.js +47 -0
  22. package/dist/appearance/theme-file-importer.d.ts +23 -0
  23. package/dist/appearance/theme-file-importer.js +66 -0
  24. package/dist/appearance/theme-record-adapter.d.ts +26 -0
  25. package/dist/appearance/theme-record-adapter.js +64 -0
  26. package/dist/appearance/theme-registry.d.ts +10 -0
  27. package/dist/appearance/theme-registry.js +16 -0
  28. package/dist/appearance/window-surface.d.ts +5 -0
  29. package/dist/appearance/window-surface.js +9 -0
  30. package/dist/ci/toolchain-identity.d.ts +39 -0
  31. package/dist/ci/toolchain-identity.js +196 -0
  32. package/dist/cli/cef-helper-cli.d.ts +2 -0
  33. package/dist/cli/cef-helper-cli.js +18 -0
  34. package/dist/cli/cli-runner.d.ts +8 -0
  35. package/dist/cli/cli-runner.js +23 -0
  36. package/dist/cli/create-application-cli.d.ts +2 -0
  37. package/dist/cli/create-application-cli.js +40 -0
  38. package/dist/cli/electrobun-shortcut-patch-cli.d.ts +2 -0
  39. package/dist/cli/electrobun-shortcut-patch-cli.js +17 -0
  40. package/dist/cli/framework-update-cli.d.ts +2 -0
  41. package/dist/cli/framework-update-cli.js +40 -0
  42. package/dist/cli/release-assets-plan-cli.d.ts +2 -0
  43. package/dist/cli/release-assets-plan-cli.js +14 -0
  44. package/dist/cli/release-cut-cli.d.ts +2 -0
  45. package/dist/cli/release-cut-cli.js +27 -0
  46. package/dist/cli/release-descriptor-staging-cli.d.ts +2 -0
  47. package/dist/cli/release-descriptor-staging-cli.js +45 -0
  48. package/dist/cli/release-finalize-cli.d.ts +1 -0
  49. package/dist/cli/release-finalize-cli.js +30 -0
  50. package/dist/cli/release-promote-cli.d.ts +2 -0
  51. package/dist/cli/release-promote-cli.js +32 -0
  52. package/dist/cli/release-publish-cli.d.ts +2 -0
  53. package/dist/cli/release-publish-cli.js +48 -0
  54. package/dist/cli/release-sign-cli.d.ts +2 -0
  55. package/dist/cli/release-sign-cli.js +13 -0
  56. package/dist/cli/release-step-cli.d.ts +2 -0
  57. package/dist/cli/release-step-cli.js +44 -0
  58. package/dist/cli/toolchain-identity-cli.d.ts +2 -0
  59. package/dist/cli/toolchain-identity-cli.js +10 -0
  60. package/dist/cli/update-helper-cli.d.ts +1 -0
  61. package/dist/cli/update-helper-cli.js +10 -0
  62. package/dist/cli/windows-runtime-patch-cli.d.ts +2 -0
  63. package/dist/cli/windows-runtime-patch-cli.js +17 -0
  64. package/dist/desktop/application-command-client.d.ts +15 -0
  65. package/dist/desktop/application-command-client.js +21 -0
  66. package/dist/desktop/channel-handshake.d.ts +32 -0
  67. package/dist/desktop/channel-handshake.js +111 -0
  68. package/dist/desktop/channel-proof.d.ts +43 -0
  69. package/dist/desktop/channel-proof.js +85 -0
  70. package/dist/desktop/client-assets.d.ts +7 -0
  71. package/dist/desktop/client-assets.js +59 -0
  72. package/dist/desktop/desktop-client.d.ts +23 -0
  73. package/dist/desktop/desktop-client.js +231 -0
  74. package/dist/desktop/desktop-gateway.d.ts +18 -0
  75. package/dist/desktop/desktop-gateway.js +146 -0
  76. package/dist/desktop/desktop-host.d.ts +48 -0
  77. package/dist/desktop/desktop-host.js +208 -0
  78. package/dist/desktop/desktop-stream.d.ts +36 -0
  79. package/dist/desktop/desktop-stream.js +231 -0
  80. package/dist/desktop/loopback-policy.d.ts +19 -0
  81. package/dist/desktop/loopback-policy.js +23 -0
  82. package/dist/desktop/open-url-channel.d.ts +15 -0
  83. package/dist/desktop/open-url-channel.js +55 -0
  84. package/dist/desktop/string-policy.d.ts +2 -0
  85. package/dist/desktop/string-policy.js +11 -0
  86. package/dist/framework-source.json +1 -0
  87. package/dist/installer/archive-entry.d.ts +6 -0
  88. package/dist/installer/archive-entry.js +14 -0
  89. package/dist/installer/command-artifact.d.ts +47 -0
  90. package/dist/installer/command-artifact.js +261 -0
  91. package/dist/installer/command-qualification-command.d.ts +12 -0
  92. package/dist/installer/command-qualification-command.js +71 -0
  93. package/dist/installer/hosted-runner.d.ts +4 -0
  94. package/dist/installer/hosted-runner.js +10 -0
  95. package/dist/installer/installed-payload.d.ts +29 -0
  96. package/dist/installer/installed-payload.js +312 -0
  97. package/dist/installer/installer-ci-bootstrap.d.ts +26 -0
  98. package/dist/installer/installer-ci-bootstrap.js +160 -0
  99. package/dist/installer/installer-ci-preflight.d.ts +1 -0
  100. package/dist/installer/installer-ci-preflight.js +49 -0
  101. package/dist/installer/installer-ci-worker.d.ts +1 -0
  102. package/dist/installer/installer-ci-worker.js +105 -0
  103. package/dist/installer/installer-extraction.d.ts +14 -0
  104. package/dist/installer/installer-extraction.js +289 -0
  105. package/dist/installer/installer-fetch-guard.d.ts +15 -0
  106. package/dist/installer/installer-fetch-guard.js +50 -0
  107. package/dist/installer/installer-identity.d.ts +23 -0
  108. package/dist/installer/installer-identity.js +286 -0
  109. package/dist/installer/installer-layout.d.ts +21 -0
  110. package/dist/installer/installer-layout.js +89 -0
  111. package/dist/installer/installer-observation.d.ts +64 -0
  112. package/dist/installer/installer-observation.js +473 -0
  113. package/dist/installer/installer-process-cleanup.d.ts +18 -0
  114. package/dist/installer/installer-process-cleanup.js +158 -0
  115. package/dist/installer/installer-qualification-command.d.ts +11 -0
  116. package/dist/installer/installer-qualification-command.js +71 -0
  117. package/dist/installer/installer-renderer-evidence.d.ts +43 -0
  118. package/dist/installer/installer-renderer-evidence.js +136 -0
  119. package/dist/installer/installer-upgrade-command.d.ts +37 -0
  120. package/dist/installer/installer-upgrade-command.js +172 -0
  121. package/dist/installer/installer-worker-guard.d.ts +21 -0
  122. package/dist/installer/installer-worker-guard.js +72 -0
  123. package/dist/installer/native-executable.d.ts +5 -0
  124. package/dist/installer/native-executable.js +21 -0
  125. package/dist/installer/upgrade-asset-download.d.ts +13 -0
  126. package/dist/installer/upgrade-asset-download.js +41 -0
  127. package/dist/installer/write-all.d.ts +6 -0
  128. package/dist/installer/write-all.js +11 -0
  129. package/dist/native/app-bundle.d.ts +28 -0
  130. package/dist/native/app-bundle.js +60 -0
  131. package/dist/native/cef-helper.d.ts +28 -0
  132. package/dist/native/cef-helper.js +402 -0
  133. package/dist/native/desktop-build-hook.d.ts +7 -0
  134. package/dist/native/desktop-build-hook.js +20 -0
  135. package/dist/native/electrobun-source-patch.d.ts +25 -0
  136. package/dist/native/electrobun-source-patch.js +93 -0
  137. package/dist/native/linux-cef-links.d.ts +2 -0
  138. package/dist/native/linux-cef-links.js +15 -0
  139. package/dist/native/native-secret-store.d.ts +27 -0
  140. package/dist/native/native-secret-store.js +70 -0
  141. package/dist/native/native-utilities.d.ts +24 -0
  142. package/dist/native/native-utilities.js +85 -0
  143. package/dist/native/partitioned-window.d.ts +34 -0
  144. package/dist/native/partitioned-window.js +44 -0
  145. package/dist/native/renderer-profile.d.ts +53 -0
  146. package/dist/native/renderer-profile.js +30 -0
  147. package/dist/native/secure-window.d.ts +38 -0
  148. package/dist/native/secure-window.js +77 -0
  149. package/dist/native/sidecar-services.d.ts +23 -0
  150. package/dist/native/sidecar-services.js +46 -0
  151. package/dist/native/sidecar.d.ts +81 -0
  152. package/dist/native/sidecar.js +250 -0
  153. package/dist/native/window-bootstrap.d.ts +24 -0
  154. package/dist/native/window-bootstrap.js +63 -0
  155. package/dist/native/window-options.d.ts +32 -0
  156. package/dist/native/window-options.js +23 -0
  157. package/dist/native/windows-build-hook-internal.d.ts +2 -0
  158. package/dist/native/windows-build-hook-internal.js +32 -0
  159. package/dist/native/windows-build-hook.d.ts +2 -0
  160. package/dist/native/windows-build-hook.js +12 -0
  161. package/dist/native/windows-runtime-patch-internal.d.ts +3 -0
  162. package/dist/native/windows-runtime-patch-internal.js +20 -0
  163. package/dist/native/windows-runtime-patch.d.ts +4 -0
  164. package/dist/native/windows-runtime-patch.js +12 -0
  165. package/dist/release/feed-release-cut.d.ts +23 -0
  166. package/dist/release/feed-release-cut.js +93 -0
  167. package/dist/release/feed-state.d.ts +25 -0
  168. package/dist/release/feed-state.js +81 -0
  169. package/dist/release/framework-package-publish.d.ts +21 -0
  170. package/dist/release/framework-package-publish.js +125 -0
  171. package/dist/release/framework-update.d.ts +30 -0
  172. package/dist/release/framework-update.js +139 -0
  173. package/dist/release/github-cli.d.ts +6 -0
  174. package/dist/release/github-cli.js +16 -0
  175. package/dist/release/github-release-assets.d.ts +3 -0
  176. package/dist/release/github-release-assets.js +24 -0
  177. package/dist/release/github-release-cut.d.ts +14 -0
  178. package/dist/release/github-release-cut.js +174 -0
  179. package/dist/release/github-release-lookup.d.ts +7 -0
  180. package/dist/release/github-release-lookup.js +29 -0
  181. package/dist/release/github-release-promotion.d.ts +10 -0
  182. package/dist/release/github-release-promotion.js +78 -0
  183. package/dist/release/github-release-provenance.d.ts +9 -0
  184. package/dist/release/github-release-provenance.js +27 -0
  185. package/dist/release/github-release-publisher.d.ts +9 -0
  186. package/dist/release/github-release-publisher.js +63 -0
  187. package/dist/release/github-release-qualification.d.ts +12 -0
  188. package/dist/release/github-release-qualification.js +80 -0
  189. package/dist/release/local-provenance.d.ts +24 -0
  190. package/dist/release/local-provenance.js +72 -0
  191. package/dist/release/local-release.d.ts +133 -0
  192. package/dist/release/local-release.js +387 -0
  193. package/dist/release/macos-dmg.d.ts +22 -0
  194. package/dist/release/macos-dmg.js +91 -0
  195. package/dist/release/release-artifact.d.ts +6 -0
  196. package/dist/release/release-artifact.js +38 -0
  197. package/dist/release/release-assets-plan.d.ts +14 -0
  198. package/dist/release/release-assets-plan.js +65 -0
  199. package/dist/release/release-config.d.ts +76 -0
  200. package/dist/release/release-config.js +180 -0
  201. package/dist/release/release-cut-command.d.ts +13 -0
  202. package/dist/release/release-cut-command.js +39 -0
  203. package/dist/release/release-cut.d.ts +54 -0
  204. package/dist/release/release-cut.js +76 -0
  205. package/dist/release/release-descriptor-staging.d.ts +34 -0
  206. package/dist/release/release-descriptor-staging.js +147 -0
  207. package/dist/release/release-finalize.d.ts +16 -0
  208. package/dist/release/release-finalize.js +104 -0
  209. package/dist/release/release-promotion-command.d.ts +12 -0
  210. package/dist/release/release-promotion-command.js +28 -0
  211. package/dist/release/release-promotion.d.ts +29 -0
  212. package/dist/release/release-promotion.js +57 -0
  213. package/dist/release/release-publication.d.ts +33 -0
  214. package/dist/release/release-publication.js +138 -0
  215. package/dist/release/release-publish-command.d.ts +7 -0
  216. package/dist/release/release-publish-command.js +91 -0
  217. package/dist/release/release-qualification.d.ts +106 -0
  218. package/dist/release/release-qualification.js +135 -0
  219. package/dist/release/release-staging.d.ts +9 -0
  220. package/dist/release/release-staging.js +61 -0
  221. package/dist/release/release-steps.d.ts +38 -0
  222. package/dist/release/release-steps.js +147 -0
  223. package/dist/release/retained-release-build.d.ts +19 -0
  224. package/dist/release/retained-release-build.js +122 -0
  225. package/dist/shell/app-shell.d.ts +61 -0
  226. package/dist/shell/app-shell.js +318 -0
  227. package/dist/shell/app-utilities.d.ts +122 -0
  228. package/dist/shell/app-utilities.js +334 -0
  229. package/dist/shell/application-menu-commands.d.ts +5 -0
  230. package/dist/shell/application-menu-commands.js +11 -0
  231. package/dist/shell/application-menu.d.ts +61 -0
  232. package/dist/shell/application-menu.js +208 -0
  233. package/dist/shell/help-shortcuts.d.ts +12 -0
  234. package/dist/shell/help-shortcuts.js +22 -0
  235. package/dist/shell/settings-sections.d.ts +31 -0
  236. package/dist/shell/settings-sections.js +50 -0
  237. package/dist/shell/shortcut-platform.d.ts +17 -0
  238. package/dist/shell/shortcut-platform.js +25 -0
  239. package/dist/update-helper.bundle.js +260 -0
  240. package/dist/updates/channel-update-manager.d.ts +46 -0
  241. package/dist/updates/channel-update-manager.js +114 -0
  242. package/dist/updates/desktop-updater.d.ts +104 -0
  243. package/dist/updates/desktop-updater.js +345 -0
  244. package/dist/updates/release-feed.d.ts +61 -0
  245. package/dist/updates/release-feed.js +111 -0
  246. package/dist/updates/release-location.d.ts +9 -0
  247. package/dist/updates/release-location.js +80 -0
  248. package/dist/updates/release-version.d.ts +12 -0
  249. package/dist/updates/release-version.js +43 -0
  250. package/dist/updates/signed-release.d.ts +63 -0
  251. package/dist/updates/signed-release.js +162 -0
  252. package/dist/updates/stable-file.d.ts +10 -0
  253. package/dist/updates/stable-file.js +22 -0
  254. package/dist/updates/update-adapter.d.ts +57 -0
  255. package/dist/updates/update-adapter.js +72 -0
  256. package/dist/updates/update-arm.d.ts +24 -0
  257. package/dist/updates/update-arm.js +95 -0
  258. package/dist/updates/update-channel-store.d.ts +8 -0
  259. package/dist/updates/update-channel-store.js +72 -0
  260. package/dist/updates/update-discovery.d.ts +13 -0
  261. package/dist/updates/update-discovery.js +56 -0
  262. package/dist/updates/update-download.d.ts +14 -0
  263. package/dist/updates/update-download.js +67 -0
  264. package/dist/updates/update-exclusive-rename.d.ts +2 -0
  265. package/dist/updates/update-exclusive-rename.js +52 -0
  266. package/dist/updates/update-extraction.d.ts +18 -0
  267. package/dist/updates/update-extraction.js +183 -0
  268. package/dist/updates/update-handoff-plan.d.ts +22 -0
  269. package/dist/updates/update-handoff-plan.js +28 -0
  270. package/dist/updates/update-helper.d.ts +24 -0
  271. package/dist/updates/update-helper.js +56 -0
  272. package/dist/updates/update-launch.d.ts +5 -0
  273. package/dist/updates/update-launch.js +27 -0
  274. package/dist/updates/update-manager.d.ts +40 -0
  275. package/dist/updates/update-manager.js +83 -0
  276. package/dist/updates/update-process-fence.d.ts +10 -0
  277. package/dist/updates/update-process-fence.js +114 -0
  278. package/dist/updates/update-resume.d.ts +13 -0
  279. package/dist/updates/update-resume.js +34 -0
  280. package/dist/updates/update-shutdown.d.ts +15 -0
  281. package/dist/updates/update-shutdown.js +29 -0
  282. package/dist/updates/update-state.d.ts +30 -0
  283. package/dist/updates/update-state.js +18 -0
  284. package/dist/updates/update-swap-stage.d.ts +27 -0
  285. package/dist/updates/update-swap-stage.js +58 -0
  286. package/dist/updates/update-swap.d.ts +10 -0
  287. package/dist/updates/update-swap.js +30 -0
  288. package/dist/views/app-about.d.ts +22 -0
  289. package/dist/views/app-about.js +43 -0
  290. package/dist/views/app-appearance.d.ts +11 -0
  291. package/dist/views/app-appearance.js +42 -0
  292. package/dist/views/app-help.d.ts +17 -0
  293. package/dist/views/app-help.js +42 -0
  294. package/dist/views/app-settings.d.ts +26 -0
  295. package/dist/views/app-settings.js +97 -0
  296. package/dist/views/appearance-surface.d.ts +9 -0
  297. package/dist/views/appearance-surface.js +334 -0
  298. package/dist/views/update-surface.d.ts +34 -0
  299. package/dist/views/update-surface.js +64 -0
  300. package/package.json +363 -4
  301. package/src/app/application.tsx +138 -0
  302. package/src/app/create-application.ts +245 -0
  303. package/src/app/service-registry.ts +124 -0
  304. package/src/appearance/appearance-host.tsx +205 -0
  305. package/src/appearance/appearance-preferences.ts +287 -0
  306. package/src/appearance/composition.ts +29 -0
  307. package/src/appearance/custom-theme-import.ts +424 -0
  308. package/src/appearance/custom-theme-library.ts +600 -0
  309. package/src/appearance/editor.ts +94 -0
  310. package/src/appearance/theme-file-importer.ts +103 -0
  311. package/src/appearance/theme-record-adapter.ts +106 -0
  312. package/src/appearance/theme-registry.ts +20 -0
  313. package/src/appearance/window-surface.ts +18 -0
  314. package/src/ci/toolchain-identity.ts +244 -0
  315. package/src/cli/cef-helper-cli.ts +21 -0
  316. package/src/cli/cli-runner.ts +29 -0
  317. package/src/cli/create-application-cli.ts +62 -0
  318. package/src/cli/electrobun-shortcut-patch-cli.ts +24 -0
  319. package/src/cli/framework-update-cli.ts +41 -0
  320. package/src/cli/release-assets-plan-cli.ts +14 -0
  321. package/src/cli/release-cut-cli.ts +41 -0
  322. package/src/cli/release-descriptor-staging-cli.ts +57 -0
  323. package/src/cli/release-finalize-cli.ts +34 -0
  324. package/src/cli/release-promote-cli.ts +31 -0
  325. package/src/cli/release-publish-cli.ts +46 -0
  326. package/src/cli/release-sign-cli.ts +24 -0
  327. package/src/cli/release-step-cli.ts +71 -0
  328. package/src/cli/toolchain-identity-cli.ts +12 -0
  329. package/src/cli/update-helper-cli.ts +12 -0
  330. package/src/cli/windows-runtime-patch-cli.ts +17 -0
  331. package/src/desktop/application-command-client.ts +43 -0
  332. package/src/desktop/channel-handshake.ts +136 -0
  333. package/src/desktop/channel-proof.ts +122 -0
  334. package/src/desktop/client-assets.ts +75 -0
  335. package/src/desktop/desktop-client.ts +303 -0
  336. package/src/desktop/desktop-gateway.ts +189 -0
  337. package/src/desktop/desktop-host.ts +335 -0
  338. package/src/desktop/desktop-stream.ts +324 -0
  339. package/src/desktop/loopback-policy.ts +41 -0
  340. package/src/desktop/open-url-channel.ts +79 -0
  341. package/src/desktop/string-policy.ts +9 -0
  342. package/src/installer/archive-entry.ts +32 -0
  343. package/src/installer/command-artifact.ts +307 -0
  344. package/src/installer/command-qualification-command.ts +75 -0
  345. package/src/installer/hosted-runner.ts +11 -0
  346. package/src/installer/installed-payload.ts +408 -0
  347. package/src/installer/installer-ci-bootstrap.ts +199 -0
  348. package/src/installer/installer-ci-preflight.ts +61 -0
  349. package/src/installer/installer-ci-worker.ts +105 -0
  350. package/src/installer/installer-extraction.ts +367 -0
  351. package/src/installer/installer-fetch-guard.ts +75 -0
  352. package/src/installer/installer-identity.ts +331 -0
  353. package/src/installer/installer-layout.ts +167 -0
  354. package/src/installer/installer-observation.ts +671 -0
  355. package/src/installer/installer-process-cleanup.ts +167 -0
  356. package/src/installer/installer-qualification-command.ts +81 -0
  357. package/src/installer/installer-renderer-evidence.ts +268 -0
  358. package/src/installer/installer-upgrade-command.ts +226 -0
  359. package/src/installer/installer-worker-guard.ts +112 -0
  360. package/src/installer/native-executable.ts +37 -0
  361. package/src/installer/upgrade-asset-download.ts +72 -0
  362. package/src/installer/write-all.ts +19 -0
  363. package/src/native/app-bundle.ts +86 -0
  364. package/src/native/cef-helper.ts +471 -0
  365. package/src/native/desktop-build-hook.ts +21 -0
  366. package/src/native/electrobun-cef-main-frame-bridges.patch +63 -0
  367. package/src/native/electrobun-source-patch.ts +107 -0
  368. package/src/native/electrobun-windows-shortcut-com.patch +923 -0
  369. package/src/native/linux-cef-links.ts +14 -0
  370. package/src/native/native-secret-store.ts +99 -0
  371. package/src/native/native-utilities.ts +166 -0
  372. package/src/native/partitioned-window.ts +62 -0
  373. package/src/native/renderer-profile.ts +27 -0
  374. package/src/native/secure-window.ts +115 -0
  375. package/src/native/sidecar-services.ts +71 -0
  376. package/src/native/sidecar.ts +387 -0
  377. package/src/native/window-bootstrap.ts +77 -0
  378. package/src/native/window-options.ts +24 -0
  379. package/src/native/windows-build-hook-internal.ts +49 -0
  380. package/src/native/windows-build-hook.ts +12 -0
  381. package/src/native/windows-runtime-patch-internal.ts +48 -0
  382. package/src/native/windows-runtime-patch.ts +15 -0
  383. package/src/release/feed-release-cut.ts +110 -0
  384. package/src/release/feed-state.ts +135 -0
  385. package/src/release/framework-package-publish.ts +163 -0
  386. package/src/release/framework-update.ts +196 -0
  387. package/src/release/github-cli.ts +27 -0
  388. package/src/release/github-release-assets.ts +36 -0
  389. package/src/release/github-release-cut.ts +237 -0
  390. package/src/release/github-release-lookup.ts +39 -0
  391. package/src/release/github-release-promotion.ts +112 -0
  392. package/src/release/github-release-provenance.ts +65 -0
  393. package/src/release/github-release-publisher.ts +90 -0
  394. package/src/release/github-release-qualification.ts +144 -0
  395. package/src/release/local-provenance.ts +92 -0
  396. package/src/release/local-release.ts +525 -0
  397. package/src/release/macos-dmg.ts +113 -0
  398. package/src/release/release-artifact.ts +53 -0
  399. package/src/release/release-assets-plan.ts +118 -0
  400. package/src/release/release-config.ts +420 -0
  401. package/src/release/release-cut-command.ts +80 -0
  402. package/src/release/release-cut.ts +133 -0
  403. package/src/release/release-descriptor-staging.ts +242 -0
  404. package/src/release/release-finalize.ts +191 -0
  405. package/src/release/release-promotion-command.ts +36 -0
  406. package/src/release/release-promotion.ts +132 -0
  407. package/src/release/release-publication.ts +213 -0
  408. package/src/release/release-publish-command.ts +163 -0
  409. package/src/release/release-qualification.ts +397 -0
  410. package/src/release/release-staging.ts +87 -0
  411. package/src/release/release-steps.ts +173 -0
  412. package/src/release/retained-release-build.ts +217 -0
  413. package/src/shell/app-shell.tsx +285 -0
  414. package/src/shell/app-utilities.tsx +437 -0
  415. package/src/shell/application-menu-commands.ts +6 -0
  416. package/src/shell/application-menu.ts +250 -0
  417. package/src/shell/help-shortcuts.ts +24 -0
  418. package/src/shell/settings-sections.ts +74 -0
  419. package/src/shell/shortcut-platform.ts +35 -0
  420. package/src/updates/channel-update-manager.ts +127 -0
  421. package/src/updates/desktop-updater.ts +440 -0
  422. package/src/updates/release-feed.ts +187 -0
  423. package/src/updates/release-location.ts +101 -0
  424. package/src/updates/release-version.ts +57 -0
  425. package/src/updates/signed-release.ts +311 -0
  426. package/src/updates/stable-file.ts +32 -0
  427. package/src/updates/update-adapter.ts +129 -0
  428. package/src/updates/update-arm.ts +107 -0
  429. package/src/updates/update-channel-store.ts +86 -0
  430. package/src/updates/update-discovery.ts +113 -0
  431. package/src/updates/update-download.ts +82 -0
  432. package/src/updates/update-exclusive-rename.ts +58 -0
  433. package/src/updates/update-extraction.ts +261 -0
  434. package/src/updates/update-handoff-plan.ts +75 -0
  435. package/src/updates/update-helper.ts +87 -0
  436. package/src/updates/update-launch.ts +33 -0
  437. package/src/updates/update-manager.ts +130 -0
  438. package/src/updates/update-process-fence.ts +125 -0
  439. package/src/updates/update-resume.ts +34 -0
  440. package/src/updates/update-shutdown.ts +37 -0
  441. package/src/updates/update-state.ts +34 -0
  442. package/src/updates/update-swap-stage.ts +75 -0
  443. package/src/updates/update-swap.ts +30 -0
  444. package/src/views/app-about.tsx +44 -0
  445. package/src/views/app-appearance.tsx +32 -0
  446. package/src/views/app-help.tsx +43 -0
  447. package/src/views/app-settings.tsx +88 -0
  448. package/src/views/appearance-surface.tsx +427 -0
  449. package/src/views/update-surface.tsx +85 -0
  450. package/templates/application/.gitattributes +1 -0
  451. package/templates/application/.github/workflows/release-assets.yml +29 -0
  452. package/templates/application/.github/workflows/release-finalize.yml +29 -0
  453. package/templates/application/.github/workflows/release-please.yml +19 -0
  454. package/templates/application/.github/workflows/release.yml +29 -0
  455. package/templates/application/.github/workflows/validation.yml +28 -0
  456. package/templates/application/.oxfmtrc.json +6 -0
  457. package/templates/application/.oxlintrc.json +48 -0
  458. package/templates/application/.release-please-manifest.json +3 -0
  459. package/templates/application/README.md +47 -0
  460. package/templates/application/electrobun.config.ts +22 -0
  461. package/templates/application/release-please-config.json +12 -0
  462. package/templates/application/scripts/app-version.ts +9 -0
  463. package/templates/application/scripts/build-desktop.ts +34 -0
  464. package/templates/application/scripts/secure-build.ts +1 -0
  465. package/templates/application/scripts/stage-release.ts +21 -0
  466. package/templates/application/src/bun/index.ts +80 -0
  467. package/templates/application/src/electrobun.d.ts +27 -0
  468. package/templates/application/src/web/index.html +12 -0
  469. package/templates/application/src/web/main.tsx +97 -0
  470. package/templates/application/src/web/public/icon.svg +1 -0
  471. package/templates/application/src/web/style.css +3 -0
  472. package/templates/application/tests/app-config.test.ts +9 -0
  473. package/templates/application/tsconfig.json +15 -0
  474. package/templates/application/vite.config.ts +10 -0
@@ -0,0 +1,81 @@
1
+ import { verifyReleaseDescriptor } from "../updates/signed-release.js";
2
+ import { feedUrl, parseFeedRelease, parseReleaseLedger } from "../updates/release-feed.js";
3
+ import { discoveryPolicies } from "./release-config.js";
4
+ import { fetchReleaseLocation, readReleaseBytes } from "../updates/release-location.js";
5
+ import { createHash } from "node:crypto";
6
+ // src/release/feed-state.ts
7
+ var MAX_LEDGER_BYTES = 1048576;
8
+ var MAX_RELEASE_BYTES = 262144;
9
+ /** Read one feed object anonymously over HTTPS; null when the feed answers 404. */
10
+ async function readFeedObject(feed, path, fetcher, maximum) {
11
+ const response = await fetchReleaseLocation(`${feedUrl(feed)}${path}`, feedUrl(feed), fetcher, AbortSignal.timeout(6e4));
12
+ if (response.status === 404) {
13
+ await response.body?.cancel();
14
+ return null;
15
+ }
16
+ return readReleaseBytes(response, maximum);
17
+ }
18
+ var json = (bytes) => {
19
+ try {
20
+ return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
21
+ } catch {
22
+ throw new Error("Invalid release feed response");
23
+ }
24
+ };
25
+ /** The published ledger, or an empty one before the app's first release. */
26
+ async function readFeedLedger(feed, fetcher) {
27
+ const bytes = await readFeedObject(feed, "index.json", fetcher, MAX_LEDGER_BYTES);
28
+ return bytes ? parseReleaseLedger(json(bytes), feed.app) : {
29
+ schema: 1,
30
+ app: feed.app,
31
+ releases: []
32
+ };
33
+ }
34
+ /** A tag's published release.json, or null when none is published. */
35
+ async function readFeedRelease(feed, tag, fetcher) {
36
+ const bytes = await readFeedObject(feed, `${tag}/release.json`, fetcher, MAX_RELEASE_BYTES);
37
+ if (!bytes) return null;
38
+ const release = parseFeedRelease(json(bytes));
39
+ if (release.tag !== tag) throw new Error("Feed release names another tag");
40
+ return release;
41
+ }
42
+ /**
43
+ * Verify a published release from the feed: its ledger entry and release.json agree, and every
44
+ * signed descriptor it lists for `channels` (all of its channels by default) has the listed
45
+ * bytes, authenticates against the app's trust and names a listed payload with the same size
46
+ * and digest. Returns the release platforms whose descriptors all verified; a platform whose
47
+ * payload is listed but whose descriptors are missing fails.
48
+ */
49
+ async function verifyFeedRelease(options) {
50
+ const { config, feed, tag, fetch: fetcher } = options;
51
+ const [ledger, release] = await Promise.all([readFeedLedger(feed, fetcher), readFeedRelease(feed, tag, fetcher)]);
52
+ const entry = ledger.releases.find((item) => item.tag === tag);
53
+ if (!release || !entry || entry.kind !== release.channel) throw new Error("Release is not published consistently");
54
+ const policies = discoveryPolicies(config, tag).filter((policy) => !options.channels || options.channels.includes(policy.channel));
55
+ const platforms = /* @__PURE__ */ new Set();
56
+ for (const policy of policies) {
57
+ const payload = release.assets.find((asset) => asset.name === policy.payload);
58
+ if (!payload) continue;
59
+ const listed = release.assets.find((asset) => asset.name === policy.name);
60
+ if (!listed) throw new Error(`Missing signed descriptor: ${policy.name}`);
61
+ const bytes = await readFeedObject(feed, `${tag}/${policy.name}`, fetcher, 65536);
62
+ if (!bytes || bytes.length !== listed.size || createHash("sha256").update(bytes).digest("hex") !== listed.sha256) throw new Error(`Signed descriptor differs from its release: ${policy.name}`);
63
+ const verified = verifyReleaseDescriptor(json(bytes), {
64
+ appId: policy.appId,
65
+ repository: options.repository,
66
+ channel: policy.channel,
67
+ platform: policy.os,
68
+ arch: policy.arch,
69
+ feed: feedUrl(feed),
70
+ keys: options.keys
71
+ });
72
+ if (!verified.ok || verified.descriptor.tag !== tag || verified.descriptor.sourceSha !== entry.sourceSha || verified.descriptor.asset.name !== payload.name || verified.descriptor.asset.size !== payload.size || verified.descriptor.asset.sha256 !== payload.sha256) throw new Error(`Untrusted signed descriptor: ${policy.name}`);
73
+ platforms.add(policy.platform);
74
+ }
75
+ if (!platforms.size) throw new Error("Release has no verified platform");
76
+ return {
77
+ release,
78
+ platforms: [...platforms]
79
+ };
80
+ }
81
+ export { readFeedLedger, readFeedRelease, verifyFeedRelease };
@@ -0,0 +1,21 @@
1
+ import { type GitRun } from './local-provenance';
2
+ /**
3
+ * Publish one tested framework tarball to npm from a clean checkout of a commit on origin/main.
4
+ * The tarball must be this checkout's version and record this commit as its source. A version
5
+ * npm already has is left alone when its integrity matches the tarball and refused otherwise.
6
+ * `NODE_AUTH_TOKEN` authenticates through a temporary npmrc that names the variable, never its
7
+ * value; without it npm uses its own configuration (trusted publishing in CI).
8
+ */
9
+ export declare function publishFrameworkPackage(options: {
10
+ env: Record<string, string | undefined>;
11
+ archive: string;
12
+ dryRun?: boolean;
13
+ git?: GitRun;
14
+ npm?: (args: string[]) => Promise<number>;
15
+ registry?: (version: string) => Promise<unknown>;
16
+ sleep?: (milliseconds: number) => Promise<unknown>;
17
+ }): Promise<{
18
+ version: string;
19
+ integrity: string;
20
+ status: 'published' | 'already-published' | 'dry-run';
21
+ }>;
@@ -0,0 +1,125 @@
1
+ import { readPackageFile } from "./framework-update.js";
2
+ import { gitCli, resolveLocalProvenance } from "./local-provenance.js";
3
+ import { lstat, mkdtemp, open, readFile, rm, writeFile } from "node:fs/promises";
4
+ import { basename, join, resolve } from "node:path";
5
+ import { execFile } from "node:child_process";
6
+ import { createHash } from "node:crypto";
7
+ import { tmpdir } from "node:os";
8
+ // src/release/framework-package-publish.ts
9
+ var packageName = "@adea-ai/app-framework";
10
+ var registryUrl = "https://registry.npmjs.org/";
11
+ /** Runs `npm` with arguments in the current directory and the caller's environment. */
12
+ function npmCli(args) {
13
+ return new Promise((resolveRun) => execFile("npm", args, { maxBuffer: 8388608 }, (error, stdout, stderr) => {
14
+ process.stdout.write(stdout);
15
+ process.stderr.write(stderr);
16
+ resolveRun(error ? Number(error.code ?? 1) || 1 : 0);
17
+ }));
18
+ }
19
+ /** The registry's version document, or null when npm answers 404. */
20
+ async function registryVersion(version) {
21
+ const response = await fetch(`${registryUrl}@adea-ai%2fapp-framework/${version}`, { headers: { accept: "application/json" } });
22
+ if (response.status === 404) return null;
23
+ if (!response.ok) throw new Error(`npm answered ${response.status}`);
24
+ return response.json();
25
+ }
26
+ async function archiveIntegrity(archive) {
27
+ const info = await lstat(archive);
28
+ if (!info.isFile() || info.isSymbolicLink() || info.size < 1 || info.size > 536870912) throw new Error("Invalid framework package");
29
+ const file = await open(archive, "r");
30
+ try {
31
+ const bytes = new Uint8Array(await file.readFile());
32
+ const after = await file.stat();
33
+ if (bytes.length !== info.size || after.size !== info.size || after.ino !== info.ino) throw new Error("Framework package changed");
34
+ return {
35
+ bytes,
36
+ integrity: `sha512-${createHash("sha512").update(bytes).digest("base64")}`
37
+ };
38
+ } finally {
39
+ await file.close();
40
+ }
41
+ }
42
+ var publishedIntegrity = (document) => typeof document === "object" && document !== null ? document.dist?.integrity : void 0;
43
+ /**
44
+ * Publish one tested framework tarball to npm from a clean checkout of a commit on origin/main.
45
+ * The tarball must be this checkout's version and record this commit as its source. A version
46
+ * npm already has is left alone when its integrity matches the tarball and refused otherwise.
47
+ * `NODE_AUTH_TOKEN` authenticates through a temporary npmrc that names the variable, never its
48
+ * value; without it npm uses its own configuration (trusted publishing in CI).
49
+ */
50
+ async function publishFrameworkPackage(options) {
51
+ const git = options.git ?? gitCli();
52
+ const registry = options.registry ?? registryVersion;
53
+ const npm = options.npm ?? npmCli;
54
+ const sleep = options.sleep ?? ((milliseconds) => Bun.sleep(milliseconds));
55
+ const sha = await git([
56
+ "rev-parse",
57
+ "--verify",
58
+ "HEAD^{commit}"
59
+ ]);
60
+ const provenance = await resolveLocalProvenance({
61
+ git,
62
+ sourceSha: sha,
63
+ versionSourcePath: "package.json"
64
+ });
65
+ const manifest = JSON.parse(await readFile("package.json", "utf8"));
66
+ const version = provenance.releasedVersion;
67
+ const archive = resolve(options.archive);
68
+ if (provenance.repository !== "adea-ai/app-framework" || manifest.name !== packageName || manifest.version !== version || basename(archive) !== `adea-ai-app-framework-${version}.tgz`) throw new Error("Framework package source mismatch");
69
+ const { bytes, integrity } = await archiveIntegrity(archive);
70
+ const packed = readPackageFile(bytes, "package/package.json");
71
+ const source = readPackageFile(bytes, "package/dist/framework-source.json");
72
+ if (packed.name !== packageName || packed.version !== version || source.version !== version || source.commit !== sha) throw new Error("Framework package was not built from this checkout");
73
+ const existing = await registry(version);
74
+ if (existing !== null) {
75
+ if (publishedIntegrity(existing) !== integrity) throw new Error("npm already has this version with other bytes");
76
+ return {
77
+ version,
78
+ integrity,
79
+ status: "already-published"
80
+ };
81
+ }
82
+ const args = [
83
+ "publish",
84
+ archive,
85
+ "--access",
86
+ "public",
87
+ "--tag",
88
+ "latest",
89
+ "--registry",
90
+ registryUrl
91
+ ];
92
+ if (options.dryRun) args.push("--dry-run");
93
+ const config = options.env.NODE_AUTH_TOKEN ? await mkdtemp(join(tmpdir(), "framework-npmrc-")) : void 0;
94
+ try {
95
+ if (config) {
96
+ await writeFile(join(config, "npmrc"), "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}\n", { mode: 384 });
97
+ args.push("--userconfig", join(config, "npmrc"));
98
+ }
99
+ if (await npm(args) !== 0) throw new Error("npm publish failed");
100
+ } finally {
101
+ if (config) await rm(config, {
102
+ recursive: true,
103
+ force: true
104
+ });
105
+ }
106
+ if (options.dryRun) return {
107
+ version,
108
+ integrity,
109
+ status: "dry-run"
110
+ };
111
+ for (let attempt = 0; attempt < 10; attempt++) {
112
+ const published = await registry(version);
113
+ if (published !== null) {
114
+ if (publishedIntegrity(published) !== integrity) throw new Error("npm published other bytes than the tested package");
115
+ return {
116
+ version,
117
+ integrity,
118
+ status: "published"
119
+ };
120
+ }
121
+ await sleep(3e3);
122
+ }
123
+ throw new Error("npm does not list the published version yet");
124
+ }
125
+ export { publishFrameworkPackage };
@@ -0,0 +1,30 @@
1
+ export type FrameworkRelease = {
2
+ version: string;
3
+ /** The commit the package was built from, which the reusable-workflow pins name. */
4
+ commit: string;
5
+ integrity: string;
6
+ };
7
+ type FrameworkUpdateIo = {
8
+ /** npm registry JSON for a path under registry.npmjs.org. */
9
+ registry(path: string): Promise<unknown>;
10
+ /** The bytes behind a registry tarball URL. */
11
+ download(url: string): Promise<Uint8Array<ArrayBuffer>>;
12
+ /** Run a command in the consumer's root; resolves with its exit code. */
13
+ run(command: string[], cwd: string): Promise<number>;
14
+ /** Repository-relative paths of tracked files. */
15
+ files(root: string): Promise<string[]>;
16
+ };
17
+ /** The npm version to pin: `requested`, or the `latest` dist-tag. The tarball must be the
18
+ * registry's own, match its sha512 integrity, contain the version it claims and record the
19
+ * commit it was built from. */
20
+ export declare function resolveFrameworkRelease(io: Pick<FrameworkUpdateIo, 'registry' | 'download'>, requested?: string): Promise<FrameworkRelease>;
21
+ /** One JSON file from a gzipped npm tarball. */
22
+ export declare function readPackageFile(bytes: Uint8Array<ArrayBuffer>, path: string): unknown;
23
+ type FrameworkUpdate = {
24
+ release: FrameworkRelease;
25
+ changed: string[];
26
+ };
27
+ /** Pin every app-framework reference in `root` to `release`, regenerate bun.lock and prove
28
+ * it with a frozen install. Any failure restores every file it touched. */
29
+ export declare function applyFrameworkUpdate(root: string, release: FrameworkRelease, io: Pick<FrameworkUpdateIo, 'run' | 'files'>): Promise<FrameworkUpdate>;
30
+ export {};
@@ -0,0 +1,139 @@
1
+ import { readFile, writeFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { createHash } from "node:crypto";
4
+ // src/release/framework-update.ts
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
+ var packageName = "@adea-ai/app-framework";
9
+ var registry = "https://registry.npmjs.org";
10
+ var workflowPin = /(adea-ai\/app-framework\/\.github\/workflows\/[\w.-]+\.ya?ml)@(?:[0-9a-f]{40}(?: # v[\w.-]+)?|v\d+\.\d+\.\d+)/g;
11
+ var version = /^\d+\.\d+\.\d+$/;
12
+ var manifestPin = /("@adea-ai\/app-framework"\s*:\s*")\d+\.\d+\.\d+"/g;
13
+ /** The npm version to pin: `requested`, or the `latest` dist-tag. The tarball must be the
14
+ * registry's own, match its sha512 integrity, contain the version it claims and record the
15
+ * commit it was built from. */
16
+ async function resolveFrameworkRelease(io, requested) {
17
+ if (requested !== void 0 && !version.test(requested)) throw new Error(`Not a release version: ${requested}`);
18
+ const packument = await io.registry("@adea-ai%2fapp-framework");
19
+ if (packument.name !== packageName) throw new Error(`The registry does not list ${packageName}`);
20
+ const resolved = requested ?? packument["dist-tags"]?.latest;
21
+ if (typeof resolved !== "string" || !version.test(resolved)) throw new Error(`The latest ${packageName} is not a release version`);
22
+ const entry = packument.versions?.[resolved];
23
+ const tarball = `${registry}/${packageName}/-/app-framework-${resolved}.tgz`;
24
+ if (!entry || entry.name !== packageName || entry.version !== resolved) throw new Error(`${packageName}@${resolved} is not published`);
25
+ if (entry.dist?.tarball !== tarball) throw new Error(`${packageName}@${resolved} is not served from ${registry}`);
26
+ const integrity = typeof entry.dist.integrity === "string" ? entry.dist.integrity : "";
27
+ if (!/^sha512-[A-Za-z0-9+/]{86}==$/.test(integrity)) throw new Error(`${packageName}@${resolved} has no sha512 integrity`);
28
+ const bytes = await io.download(tarball);
29
+ if (`sha512-${createHash("sha512").update(bytes).digest("base64")}` !== integrity) throw new Error(`${packageName}@${resolved} does not match its published integrity`);
30
+ const manifest = readPackageFile(bytes, "package/package.json");
31
+ if (manifest.name !== packageName || manifest.version !== resolved) throw new Error(`The tarball contains ${String(manifest.name)}@${String(manifest.version)}`);
32
+ const source = readPackageFile(bytes, "package/dist/framework-source.json");
33
+ if (source.version !== resolved || typeof source.commit !== "string" || !/^[0-9a-f]{40}$/.test(source.commit)) throw new Error(`${packageName}@${resolved} does not record its source commit`);
34
+ return {
35
+ version: resolved,
36
+ commit: source.commit,
37
+ integrity
38
+ };
39
+ }
40
+ /** One JSON file from a gzipped npm tarball. */
41
+ function readPackageFile(bytes, path) {
42
+ const tar = Bun.gunzipSync(bytes);
43
+ const text = new TextDecoder();
44
+ for (let offset = 0; offset + 512 <= tar.length;) {
45
+ const header = tar.subarray(offset, offset + 512);
46
+ const name = text.decode(header.subarray(0, 100)).replace(/\0.*$/s, "");
47
+ if (!name) break;
48
+ const size = Number.parseInt(text.decode(header.subarray(124, 136)).replace(/\0.*$/s, ""), 8);
49
+ if (name === path) return JSON.parse(text.decode(tar.subarray(offset + 512, offset + 512 + size)));
50
+ offset += 512 + Math.ceil(size / 512) * 512;
51
+ }
52
+ throw new Error(`The tarball has no ${path}`);
53
+ }
54
+ /** Comments bun drops when it rewrites bun.lock, such as release-please's version marker,
55
+ * keyed by the workspace block and the line they trail. */
56
+ function lockComments(lock) {
57
+ let block = "";
58
+ const comments = [];
59
+ for (const line of lock.split("\n")) {
60
+ if (/^ {4}"[^"]*": \{/.test(line)) block = line;
61
+ const match = /^(.*?,)\s*(\/\/.*)$/.exec(line);
62
+ if (match) comments.push({
63
+ block,
64
+ line: match[1],
65
+ comment: match[2]
66
+ });
67
+ }
68
+ return comments;
69
+ }
70
+ function restoreLockComments(lock, comments) {
71
+ const lines = lock.split("\n");
72
+ for (const { block, line, comment } of comments) {
73
+ const start = lines.indexOf(block);
74
+ const index = lines.findIndex((candidate, at) => at > start && candidate === line);
75
+ if (start < 0 || index < 0) throw new Error(`bun.lock lost the line for "${comment}"`);
76
+ lines[index] = `${line} ${comment}`;
77
+ }
78
+ return lines.join("\n");
79
+ }
80
+ /** Pin every app-framework reference in `root` to `release`, regenerate bun.lock and prove
81
+ * it with a frozen install. Any failure restores every file it touched. */
82
+ async function applyFrameworkUpdate(root, release, io) {
83
+ const tracked = await io.files(root);
84
+ const manifests = tracked.filter((path) => /(^|\/)package\.json$/.test(path));
85
+ const workflows = tracked.filter((path) => /^\.github\/workflows\/[^/]+\.ya?ml$/.test(path));
86
+ const original = /* @__PURE__ */ new Map();
87
+ for (const path of [
88
+ ...manifests,
89
+ ...workflows,
90
+ "bun.lock"
91
+ ]) original.set(path, await readFile(join(root, path), "utf8"));
92
+ const next = /* @__PURE__ */ new Map();
93
+ for (const path of manifests) {
94
+ const text = original.get(path);
95
+ const dependency = JSON.parse(text);
96
+ const declared = [
97
+ "dependencies",
98
+ "devDependencies",
99
+ "peerDependencies",
100
+ "optionalDependencies"
101
+ ].map((field) => dependency[field]?.[packageName]).filter((value) => value !== void 0);
102
+ if (!declared.length) continue;
103
+ for (const value of declared) if (!version.test(value)) throw new Error(`${path} pins ${packageName} to ${value}`);
104
+ next.set(path, text.replace(manifestPin, `$1${release.version}"`));
105
+ }
106
+ for (const path of workflows) {
107
+ const text = original.get(path);
108
+ const updated = text.replace(workflowPin, `$1@${release.commit} # v${release.version}`);
109
+ if (updated !== text) next.set(path, updated);
110
+ }
111
+ if (![...next.keys()].some((path) => manifests.includes(path))) throw new Error(`No package.json depends on ${packageName}`);
112
+ const written = [];
113
+ try {
114
+ for (const [path, text] of next) {
115
+ if (text === original.get(path)) continue;
116
+ await writeFile(join(root, path), text);
117
+ written.push(path);
118
+ }
119
+ written.push("bun.lock");
120
+ if (await io.run(["bun", "install"], root) !== 0) throw new Error("bun install failed");
121
+ const lock = restoreLockComments(await readFile(join(root, "bun.lock"), "utf8"), lockComments(original.get("bun.lock")));
122
+ await writeFile(join(root, "bun.lock"), lock);
123
+ const entries = lock.split("\n").filter((line) => line.trimStart().startsWith(`"${packageName}": [`));
124
+ if (entries.length !== 1 || !entries[0].trimStart().startsWith(`"${packageName}": ["${packageName}@${release.version}", "",`) || !entries[0].trimEnd().endsWith(`"${release.integrity}"],`)) throw new Error("bun.lock does not pin the verified npm package");
125
+ if (await io.run([
126
+ "bun",
127
+ "install",
128
+ "--frozen-lockfile"
129
+ ], root) !== 0) throw new Error("The regenerated bun.lock does not pass a frozen install");
130
+ } catch (error) {
131
+ for (const path of written) await writeFile(join(root, path), original.get(path));
132
+ throw error;
133
+ }
134
+ return {
135
+ release,
136
+ changed: written
137
+ };
138
+ }
139
+ export { applyFrameworkUpdate, readPackageFile, resolveFrameworkRelease };
@@ -0,0 +1,6 @@
1
+ /** Runs `gh` with arguments and optional stdin, resolving its stdout. */
2
+ type GitHubRun = (args: string[], input?: string) => Promise<string>;
3
+ /** The `gh` CLI runner every release command shares. A failure rejects with
4
+ * 'GitHub request failed', carrying stderr and whether GitHub answered 404. */
5
+ export declare function githubCli(env?: NodeJS.ProcessEnv): GitHubRun;
6
+ export {};
@@ -0,0 +1,16 @@
1
+ import { execFile } from "node:child_process";
2
+ // src/release/github-cli.ts
3
+ /** The `gh` CLI runner every release command shares. A failure rejects with
4
+ * 'GitHub request failed', carrying stderr and whether GitHub answered 404. */
5
+ function githubCli(env) {
6
+ return (args, input) => new Promise((resolve, reject) => {
7
+ execFile("gh", args, {
8
+ maxBuffer: 8388608,
9
+ ...env ? { env } : {}
10
+ }, (error, stdout, stderr) => error ? reject(Object.assign(/* @__PURE__ */ new Error("GitHub request failed"), {
11
+ stderr,
12
+ notFound: /\bHTTP 404\b/.test(stderr)
13
+ })) : resolve(stdout)).stdin?.end(input);
14
+ });
15
+ }
16
+ export { githubCli };
@@ -0,0 +1,3 @@
1
+ import type { Artifact } from './release-qualification';
2
+ /** Read the complete bounded asset inventory; embedded release metadata may be incomplete. */
3
+ export declare function listGitHubReleaseAssets(read: (path: string) => Promise<unknown>, base: string, releaseId: unknown): Promise<Artifact[]>;
@@ -0,0 +1,24 @@
1
+ // src/release/github-release-assets.ts
2
+ /** Read the complete bounded asset inventory; embedded release metadata may be incomplete. */
3
+ async function listGitHubReleaseAssets(read, base, releaseId) {
4
+ if (typeof releaseId !== "number" || !Number.isSafeInteger(releaseId) || releaseId < 1) throw new Error("Invalid release identity");
5
+ const result = [], names = /* @__PURE__ */ new Set();
6
+ for (let page = 1; page <= 10; page++) {
7
+ const values = await read(`${base}/releases/${releaseId}/assets?per_page=100&page=${page}`);
8
+ if (!Array.isArray(values) || values.length > 100) throw new Error("Invalid GitHub release assets");
9
+ for (const value of values) {
10
+ if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error("Invalid GitHub release asset");
11
+ const asset = value;
12
+ if (typeof asset.name !== "string" || !asset.name || !Number.isSafeInteger(asset.size) || Number(asset.size) < 0 || typeof asset.digest !== "string" || names.has(asset.name)) throw new Error("Invalid GitHub release asset");
13
+ names.add(asset.name);
14
+ result.push({
15
+ name: asset.name,
16
+ size: Number(asset.size),
17
+ digest: asset.digest
18
+ });
19
+ }
20
+ if (values.length < 100) return result;
21
+ }
22
+ throw new Error("Too many release assets");
23
+ }
24
+ export { listGitHubReleaseAssets };
@@ -0,0 +1,14 @@
1
+ import type { ReleaseCutProvider } from './release-cut';
2
+ import type { Requirements } from './release-qualification';
3
+ /** GitHub adapter for immutable release cuts from a trusted main workflow. */
4
+ export declare function createGitHubReleaseCutProvider(options: {
5
+ repository: string;
6
+ appName: string;
7
+ requirements(tag: string): Requirements;
8
+ /** Caller release-assets workflow path, validated by parseReleaseConfig. */
9
+ assetsWorkflow: string;
10
+ releasePleaseManifestPath: string;
11
+ /** The caller's token cannot list draft releases (no push access). */
12
+ hiddenDrafts?: boolean;
13
+ run?: (args: string[], input?: string) => Promise<string>;
14
+ }): ReleaseCutProvider;
@@ -0,0 +1,174 @@
1
+ import { containsAsciiControl } from "../desktop/string-policy.js";
2
+ import { githubCli } from "./github-cli.js";
3
+ import { verifyReleaseProvenance } from "./github-release-provenance.js";
4
+ import { lookupRelease } from "./github-release-lookup.js";
5
+ import { isRepositorySlug } from "../updates/signed-release.js";
6
+ import { qualifyGitHubRelease } from "./github-release-qualification.js";
7
+ import { workflowFile } from "./release-config.js";
8
+ // src/release/github-release-cut.ts
9
+ /** GitHub adapter for immutable release cuts from a trusted main workflow. */
10
+ function createGitHubReleaseCutProvider(options) {
11
+ const { repository, appName } = options;
12
+ if (!isRepositorySlug(repository) || !appName.trim() || appName.length > 80 || containsAsciiControl(appName)) throw new Error("Invalid release configuration");
13
+ const run = options.run ?? githubCli();
14
+ const base = `repos/${repository}`, assetsFile = workflowFile(options.assetsWorkflow);
15
+ const read = async (path) => JSON.parse(await run(["api", path]));
16
+ const releaseData = (tag) => lookupRelease({
17
+ tag,
18
+ base,
19
+ read,
20
+ includeDraft: true
21
+ });
22
+ const isMainAncestor = async (sha) => {
23
+ if (!/^[a-f0-9]{40}$/.test(sha)) return false;
24
+ const result = await read(`${base}/compare/${sha}...main`);
25
+ return ["ahead", "identical"].includes(String(result?.status));
26
+ };
27
+ const isAncestor = async (older, newer) => {
28
+ if (!/^[a-f0-9]{40}$/.test(older) || !/^[a-f0-9]{40}$/.test(newer)) return false;
29
+ return (await read(`${base}/compare/${older}...${newer}`))?.status === "ahead";
30
+ };
31
+ async function tagExists(tag) {
32
+ if (!/^v\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(tag) || tag.length > 65) throw new Error("Invalid release tag");
33
+ try {
34
+ const value = await read(`${base}/git/ref/tags/${encodeURIComponent(tag)}`);
35
+ if (typeof value !== "object" || value === null || Array.isArray(value) || value.ref !== `refs/tags/${tag}`) throw new Error("Invalid tag response");
36
+ return true;
37
+ } catch (error) {
38
+ const detail = error;
39
+ if (/\bHTTP 404\b/.test(String(detail?.stderr ?? detail?.message ?? ""))) return false;
40
+ throw error;
41
+ }
42
+ }
43
+ return {
44
+ tagExists,
45
+ isAncestor,
46
+ async highestDevCounter(version) {
47
+ if (typeof version !== "string" || version.length > 64 || !/^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(version)) throw new Error("Invalid source version");
48
+ const prefix = `v${version}-dev.`;
49
+ let highest = 0;
50
+ for (let page = 1; page <= 100; page++) {
51
+ const result = await read(`${base}/releases?per_page=100&page=${page}`);
52
+ if (!Array.isArray(result) || result.length > 100) throw new Error("Invalid release history");
53
+ for (const value of result) {
54
+ if (typeof value !== "object" || value === null || Array.isArray(value) || typeof value.tag_name !== "string") throw new Error("Invalid release history");
55
+ const tag = value.tag_name;
56
+ if (!tag.startsWith(prefix)) continue;
57
+ const suffix = tag.slice(prefix.length);
58
+ if (!/^\d+$/.test(suffix) || suffix.length > 16 || !Number.isSafeInteger(Number(suffix))) throw new Error("Invalid dev release counter");
59
+ highest = Math.max(highest, Number(suffix));
60
+ }
61
+ if (result.length < 100) return highest;
62
+ }
63
+ throw new Error("Release history exceeds inspection limit");
64
+ },
65
+ async find(tag) {
66
+ if (!/^v\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(tag) || tag.length > 65) throw new Error("Invalid release tag");
67
+ const kind = tag.includes("-dev.") ? "dev" : "daily";
68
+ const found = await releaseData(tag);
69
+ if (!found && (!options.hiddenDrafts || kind !== "daily" || !await tagExists(tag))) return null;
70
+ const release = found ?? {
71
+ tag_name: tag,
72
+ draft: true,
73
+ prerelease: false,
74
+ body: ""
75
+ };
76
+ if (release.tag_name !== tag || typeof release.draft !== "boolean" || typeof release.prerelease !== "boolean" || typeof release.body !== "string") throw new Error("Invalid release response");
77
+ const target = await read(`${base}/commits/${encodeURIComponent(tag)}`);
78
+ if (typeof target?.sha !== "string" || !await verifyReleaseProvenance({
79
+ tag,
80
+ sourceSha: target.sha,
81
+ body: release.body,
82
+ releasePleaseManifestPath: options.releasePleaseManifestPath,
83
+ read,
84
+ base
85
+ })) throw new Error("Release provenance mismatch");
86
+ const stageableDraft = release.draft && kind === "daily" && !release.body.split(/\r?\n/).some((line) => line.startsWith("adea-channel:") || line.startsWith("Source: "));
87
+ return {
88
+ tag,
89
+ sourceSha: target.sha,
90
+ kind,
91
+ draft: release.draft,
92
+ prerelease: release.prerelease,
93
+ ...stageableDraft ? { stageableDraft: true } : {}
94
+ };
95
+ },
96
+ isMainAncestor,
97
+ async create(identity) {
98
+ const body = {
99
+ tag_name: identity.tag,
100
+ target_commitish: identity.sourceSha,
101
+ name: `${appName} ${identity.tag}`,
102
+ prerelease: true,
103
+ make_latest: "false",
104
+ body: `adea-channel:dev\n\nSource: ${identity.sourceSha}`
105
+ };
106
+ await run([
107
+ "api",
108
+ `${base}/releases`,
109
+ "--method",
110
+ "POST",
111
+ "--input",
112
+ "-"
113
+ ], JSON.stringify(body));
114
+ },
115
+ async qualification(release) {
116
+ try {
117
+ const current = await releaseData(release.tag);
118
+ if (!current || !Array.isArray(current.assets)) return "unknown";
119
+ if (!current.assets.filter((value) => typeof value === "object" && value !== null && /^qualification-[1-9]\d*-[1-9]\d*\.json$/.test(String(value.name))).length) return "not-qualified";
120
+ await qualifyGitHubRelease({
121
+ repository,
122
+ tag: release.tag,
123
+ requirements: options.requirements(release.tag),
124
+ assetsWorkflow: options.assetsWorkflow,
125
+ releasePleaseManifestPath: options.releasePleaseManifestPath,
126
+ run
127
+ });
128
+ return "qualified";
129
+ } catch {
130
+ return "unknown";
131
+ }
132
+ },
133
+ async pendingBuild(release) {
134
+ try {
135
+ for (let page = 1; page <= 100; page++) {
136
+ const response = await read(`${base}/actions/workflows/${assetsFile}/runs?event=workflow_dispatch&per_page=100&page=${page}`);
137
+ if (!Array.isArray(response?.workflow_runs)) return "unknown";
138
+ for (const value of response.workflow_runs) {
139
+ if (typeof value !== "object" || value === null) return "unknown";
140
+ const item = value;
141
+ if (item.display_title !== `framework-release-assets:${release.tag}`) continue;
142
+ if (item.event !== "workflow_dispatch" || item.head_branch !== "main" || typeof item.head_sha !== "string" || !await isMainAncestor(item.head_sha) || typeof item.status !== "string") return "unknown";
143
+ if ([
144
+ "queued",
145
+ "in_progress",
146
+ "waiting",
147
+ "pending",
148
+ "requested"
149
+ ].includes(item.status)) return "pending";
150
+ if (item.status !== "completed") return "unknown";
151
+ }
152
+ if (response.workflow_runs.length < 100) return "idle";
153
+ }
154
+ return "unknown";
155
+ } catch {
156
+ return "unknown";
157
+ }
158
+ },
159
+ async dispatch(tag) {
160
+ await run([
161
+ "workflow",
162
+ "run",
163
+ assetsFile,
164
+ "--repo",
165
+ repository,
166
+ "--ref",
167
+ "main",
168
+ "-f",
169
+ `tag=${tag}`
170
+ ]);
171
+ }
172
+ };
173
+ }
174
+ export { createGitHubReleaseCutProvider };
@@ -0,0 +1,7 @@
1
+ /** GitHub's release-by-tag endpoint omits drafts, so inspect bounded listings when opted in. */
2
+ export declare function lookupRelease(options: {
3
+ tag: string;
4
+ base: string;
5
+ read(path: string): Promise<unknown>;
6
+ includeDraft: boolean;
7
+ }): Promise<Record<string, unknown> | null>;