@adea-ai/app-framework 0.39.2 → 0.39.4

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 (199) hide show
  1. package/README.md +158 -52
  2. package/dist/app/application.d.ts +0 -1
  3. package/dist/app/application.js +8 -6
  4. package/dist/app/create-application.js +3 -11
  5. package/dist/app/service-registry.d.ts +0 -1
  6. package/dist/app/service-registry.js +3 -3
  7. package/dist/app/value-guards.d.ts +2 -0
  8. package/dist/app/value-guards.js +6 -1
  9. package/dist/appearance/appearance-host.d.ts +1 -1
  10. package/dist/appearance/appearance-host.js +11 -2
  11. package/dist/appearance/appearance-preferences.d.ts +0 -1
  12. package/dist/appearance/custom-theme-import.d.ts +8 -2
  13. package/dist/appearance/custom-theme-import.js +58 -23
  14. package/dist/appearance/custom-theme-library.d.ts +3 -3
  15. package/dist/appearance/custom-theme-library.js +3 -3
  16. package/dist/appearance/theme-file-importer.d.ts +1 -1
  17. package/dist/appearance/theme-file-importer.js +2 -1
  18. package/dist/appearance/theme-library-mutation.d.ts +7 -0
  19. package/dist/appearance/theme-library-mutation.js +10 -2
  20. package/dist/appearance/theme-library-store.d.ts +17 -13
  21. package/dist/appearance/theme-library-store.js +35 -22
  22. package/dist/appearance/theme-record-adapter.js +1 -2
  23. package/dist/appearance/theme-registry.js +0 -1
  24. package/dist/cli/cli-runner.d.ts +3 -2
  25. package/dist/cli/cli-runner.js +5 -10
  26. package/dist/cli/release-assets-plan-cli.js +2 -2
  27. package/dist/cli/release-cut-cli.js +2 -3
  28. package/dist/cli/release-descriptor-staging-cli.js +2 -2
  29. package/dist/cli/release-finalize-cli.js +3 -3
  30. package/dist/cli/release-promote-cli.js +2 -2
  31. package/dist/cli/release-publish-cli.js +2 -2
  32. package/dist/cli/release-sign-cli.js +2 -1
  33. package/dist/cli/release-step-cli.js +2 -2
  34. package/dist/desktop/channel-proof.js +27 -11
  35. package/dist/desktop/client-assets.d.ts +6 -1
  36. package/dist/desktop/client-assets.js +16 -3
  37. package/dist/desktop/client-dev-proxy.d.ts +0 -2
  38. package/dist/desktop/client-dev-proxy.js +2 -2
  39. package/dist/desktop/desktop-client.js +2 -1
  40. package/dist/desktop/desktop-gateway.js +24 -82
  41. package/dist/desktop/desktop-host-websocket.d.ts +5 -1
  42. package/dist/desktop/desktop-host-websocket.js +9 -7
  43. package/dist/desktop/desktop-host.d.ts +5 -0
  44. package/dist/desktop/desktop-host.js +3 -0
  45. package/dist/desktop/desktop-stream.js +5 -10
  46. package/dist/desktop/typed-array-intrinsics.d.ts +6 -0
  47. package/dist/desktop/typed-array-intrinsics.js +13 -1
  48. package/dist/developer-app/developer-app.d.ts +1 -1
  49. package/dist/developer-app/developer-app.js +26 -13
  50. package/dist/framework-source.json +1 -1
  51. package/dist/installer/command-artifact.d.ts +1 -0
  52. package/dist/installer/command-artifact.js +47 -27
  53. package/dist/installer/installed-payload.js +3 -1
  54. package/dist/installer/installer-ci-bootstrap.js +5 -6
  55. package/dist/installer/installer-ci-preflight.js +3 -3
  56. package/dist/installer/installer-identity.d.ts +0 -22
  57. package/dist/installer/installer-identity.js +3 -53
  58. package/dist/installer/installer-image-mount.d.ts +0 -1
  59. package/dist/installer/installer-image-mount.js +1 -1
  60. package/dist/installer/installer-observation.d.ts +5 -5
  61. package/dist/installer/installer-observation.js +32 -47
  62. package/dist/installer/installer-process-cleanup.js +2 -2
  63. package/dist/installer/installer-renderer-evidence.js +7 -28
  64. package/dist/installer/installer-upgrade-command.js +8 -20
  65. package/dist/installer/installer-worker-guard.js +3 -3
  66. package/dist/native/cef-helper.js +4 -4
  67. package/dist/native/desktop-build.d.ts +0 -3
  68. package/dist/native/desktop-build.js +2 -2
  69. package/dist/native/electrobun-source-patch.d.ts +4 -0
  70. package/dist/native/electrobun-source-patch.js +5 -1
  71. package/dist/native/native-utilities.js +4 -3
  72. package/dist/native/pinned-download.d.ts +16 -0
  73. package/dist/native/pinned-download.js +42 -0
  74. package/dist/native/posix-launcher-build.js +15 -35
  75. package/dist/native/posix-tree-removal.js +21 -33
  76. package/dist/native/sidecar-services.d.ts +0 -2
  77. package/dist/native/sidecar-services.js +1 -1
  78. package/dist/native/sidecar.d.ts +3 -0
  79. package/dist/native/sidecar.js +15 -2
  80. package/dist/native/window-surface-store.js +3 -3
  81. package/dist/native/windows-extractor-build.d.ts +6 -16
  82. package/dist/native/windows-extractor-build.js +11 -14
  83. package/dist/release/feed-release-cut.d.ts +2 -6
  84. package/dist/release/feed-release-cut.js +5 -93
  85. package/dist/release/feed-state.js +1 -5
  86. package/dist/release/github-release-cut.js +5 -66
  87. package/dist/release/github-release-provenance.d.ts +2 -0
  88. package/dist/release/github-release-provenance.js +4 -7
  89. package/dist/release/github-release-publisher.js +2 -2
  90. package/dist/release/github-release-qualification.js +3 -3
  91. package/dist/release/local-release.d.ts +3 -3
  92. package/dist/release/local-release.js +12 -23
  93. package/dist/release/qualification-run.js +1 -1
  94. package/dist/release/release-assets-plan.js +1 -1
  95. package/dist/release/release-config.d.ts +7 -15
  96. package/dist/release/release-config.js +25 -29
  97. package/dist/release/release-cut-command.d.ts +1 -1
  98. package/dist/release/release-cut-command.js +1 -1
  99. package/dist/release/release-cut.d.ts +5 -32
  100. package/dist/release/release-cut.js +9 -55
  101. package/dist/release/release-descriptor-staging.js +3 -8
  102. package/dist/release/release-promotion.js +2 -1
  103. package/dist/release/release-publish-command.js +5 -15
  104. package/dist/release/release-qualification.js +1 -1
  105. package/dist/shared/bounded-body.d.ts +33 -0
  106. package/dist/shared/bounded-body.js +102 -0
  107. package/dist/shared/file-system.d.ts +12 -0
  108. package/dist/shared/file-system.js +40 -0
  109. package/dist/shell/app-shell.js +29 -14
  110. package/dist/shell/app-utilities.d.ts +2 -1
  111. package/dist/shell/app-utilities.js +2 -1
  112. package/dist/shell/application-menu.d.ts +1 -1
  113. package/dist/shell/application-menu.js +7 -3
  114. package/dist/shell/poll.d.ts +27 -0
  115. package/dist/shell/poll.js +88 -0
  116. package/dist/update-helper.bundle.js +268 -144
  117. package/dist/updates/channel-update-manager.js +0 -1
  118. package/dist/updates/desktop-updater.d.ts +9 -0
  119. package/dist/updates/desktop-updater.js +103 -50
  120. package/dist/updates/feed/release-feed.d.ts +7 -4
  121. package/dist/updates/feed/release-feed.js +3 -7
  122. package/dist/updates/feed/release-location.js +6 -26
  123. package/dist/updates/feed/release-version.d.ts +7 -2
  124. package/dist/updates/feed/release-version.js +9 -2
  125. package/dist/updates/feed/signed-release.d.ts +1 -1
  126. package/dist/updates/feed/signed-release.js +2 -2
  127. package/dist/updates/feed/update-discovery.js +2 -6
  128. package/dist/updates/helper/launch-gate-recovery.js +28 -78
  129. package/dist/updates/helper/resume-staging.d.ts +14 -3
  130. package/dist/updates/helper/resume-staging.js +23 -37
  131. package/dist/updates/helper/update-helper.d.ts +6 -2
  132. package/dist/updates/helper/update-helper.js +38 -33
  133. package/dist/updates/helper/update-resume.js +9 -6
  134. package/dist/updates/install/update-extraction.js +28 -8
  135. package/dist/updates/install/update-handoff-plan.d.ts +0 -1
  136. package/dist/updates/install/update-handoff-plan.js +3 -4
  137. package/dist/updates/install/update-swap-stage.js +1 -6
  138. package/dist/updates/install/update-swap.d.ts +5 -2
  139. package/dist/updates/install/update-swap.js +193 -72
  140. package/dist/updates/launch/helper-exit-wait.d.ts +6 -0
  141. package/dist/updates/launch/helper-exit-wait.js +18 -0
  142. package/dist/updates/launch/packaged-update-startup.js +8 -6
  143. package/dist/updates/launch/update-launch-gate.js +7 -14
  144. package/dist/updates/locks/stable-file.js +4 -1
  145. package/dist/updates/locks/update-helper-presence.d.ts +12 -0
  146. package/dist/updates/locks/update-helper-presence.js +27 -0
  147. package/dist/updates/retention/retention-cleanup.js +10 -9
  148. package/dist/updates/retention/retention-maintenance.d.ts +40 -0
  149. package/dist/updates/retention/retention-maintenance.js +95 -0
  150. package/dist/updates/retention/retention-prune-progress.js +4 -5
  151. package/dist/updates/retention/retirement-inventory.d.ts +13 -0
  152. package/dist/updates/retention/retirement-inventory.js +39 -31
  153. package/dist/updates/retention/retirement-records.d.ts +1 -4
  154. package/dist/updates/retention/retirement-records.js +18 -32
  155. package/dist/updates/retention/update-retention-marker.d.ts +4 -0
  156. package/dist/updates/retention/update-retention-marker.js +9 -14
  157. package/dist/updates/retention/update-retirement.d.ts +12 -0
  158. package/dist/updates/retention/update-retirement.js +59 -31
  159. package/dist/updates/update-adapter.d.ts +1 -23
  160. package/dist/updates/update-adapter.js +31 -24
  161. package/dist/updates/update-channel-store.d.ts +2 -1
  162. package/dist/updates/update-channel-store.js +6 -4
  163. package/dist/updates/update-manager.js +2 -2
  164. package/dist/updates/update-services.d.ts +1 -1
  165. package/dist/updates/update-services.js +9 -4
  166. package/dist/updates/update-state-store.d.ts +0 -2
  167. package/dist/updates/update-state-store.js +5 -12
  168. package/dist/updates/update-state.d.ts +6 -10
  169. package/dist/updates/update-state.js +1 -1
  170. package/dist/views/app-help.d.ts +1 -1
  171. package/dist/views/app-help.js +1 -3
  172. package/dist/views/appearance-surface.js +15 -8
  173. package/dist/views/update-surface.d.ts +1 -3
  174. package/dist/views/update-surface.js +2 -2
  175. package/package.json +18 -16
  176. package/src/app/application.tsx +13 -6
  177. package/src/appearance/appearance-host.tsx +17 -7
  178. package/src/appearance/appearance-preferences.ts +0 -1
  179. package/src/appearance/custom-theme-import.ts +99 -26
  180. package/src/appearance/custom-theme-library.ts +3 -2
  181. package/src/appearance/theme-file-importer.ts +3 -2
  182. package/src/appearance/theme-library-mutation.ts +20 -8
  183. package/src/appearance/theme-library-schema.ts +7 -0
  184. package/src/appearance/theme-library-store.ts +41 -26
  185. package/src/desktop/client-assets.ts +27 -12
  186. package/src/shell/app-shell.tsx +33 -13
  187. package/src/shell/app-utilities.tsx +7 -1
  188. package/src/shell/poll.ts +125 -0
  189. package/src/updates/feed/release-version.ts +11 -3
  190. package/src/updates/update-adapter.ts +27 -44
  191. package/src/updates/update-state.ts +7 -13
  192. package/src/views/app-help.tsx +1 -1
  193. package/src/views/appearance-surface.tsx +39 -11
  194. package/src/views/update-surface.tsx +0 -4
  195. package/templates/application/.github/workflows/release-assets.yml +2 -2
  196. package/templates/application/README.md +3 -3
  197. package/dist/native/cef-helper-download.d.ts +0 -1
  198. package/dist/native/cef-helper-download.js +0 -35
  199. package/src/desktop/client-response-lifecycle.ts +0 -305
@@ -1,12 +1,10 @@
1
1
  import type { FeedRelease, ReleaseLedger } from '../updates/feed/release-feed';
2
2
  import { type GitRun } from './local-provenance';
3
3
  import type { ReleaseCutProvider } from './release-cut';
4
- import type { HistoryRewrite } from './release-config';
5
4
  /**
6
5
  * Release feed adapter for local release cuts. The feed's ledger replaces the GitHub release
7
- * listing and the local checkout's fetched `origin/main` replaces GitHub's compare API. A dev
8
- * cut lives in memory until its build is published; a daily not yet in the ledger stands for
9
- * the Release Please release of the source manifest's version, as a stageable draft. A release
6
+ * listing and the local checkout's fetched `origin/main` replaces GitHub's compare API. A
7
+ * daily not yet in the ledger stands for the Release Please release of the source manifest's version, as a stageable draft. A release
10
8
  * is qualified once its published release.json carries every payload this host builds, so a
11
9
  * second host adds its platform to an existing release. Nothing is built remotely, so a cut
12
10
  * is never pending and dispatch only hands the tag back to the caller to build.
@@ -21,6 +19,4 @@ export declare function createFeedReleaseCutProvider(options: {
21
19
  releasedVersion: string;
22
20
  /** The payload names this host builds for a tag. */
23
21
  payloads(tag: string): readonly string[];
24
- /** Reviewed source commits a history rewrite replaced (release config `historyRewrite`). */
25
- historyRewrite?: readonly HistoryRewrite[];
26
22
  }): ReleaseCutProvider;
@@ -1,67 +1,22 @@
1
- import { isGitSha } from "../app/value-guards.js";
2
1
  import { gitIsAncestor } from "./local-provenance.js";
3
2
  // src/release/feed-release-cut.ts
4
- function checkVersion(version) {
5
- 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");
6
- }
7
- /** The highest `N` among `tags` of the form `v<version>-dev.N`; 0 when none. A malformed
8
- * counter fails closed, except among bare tags (`tagsOnly`), where a name that is not a
9
- * canonical dev tag can never collide with a cut and is skipped. */
10
- function highestCounter(tags, version, tagsOnly = false) {
11
- const prefix = `v${version}-dev.`;
12
- let highest = 0;
13
- for (const tag of tags) {
14
- if (!tag.startsWith(prefix)) continue;
15
- const suffix = tag.slice(prefix.length);
16
- if (!/^[1-9]\d{0,15}$/.test(suffix) || !Number.isSafeInteger(Number(suffix))) {
17
- if (tagsOnly) continue;
18
- throw new Error("Invalid dev release counter");
19
- }
20
- highest = Math.max(highest, Number(suffix));
21
- }
22
- return highest;
23
- }
24
- async function commitTree(git, sha) {
25
- const tree = await git([
26
- "rev-parse",
27
- "--verify",
28
- `${sha}^{tree}`
29
- ]);
30
- if (!isGitSha(tree)) throw new Error("Invalid commit tree");
31
- return tree;
32
- }
33
- async function hasCommit(git, sha) {
34
- try {
35
- await git([
36
- "cat-file",
37
- "-e",
38
- `${sha}^{commit}`
39
- ]);
40
- return true;
41
- } catch {
42
- return false;
43
- }
44
- }
45
3
  function checkTag(tag) {
46
- if (!/^v\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(tag) || tag.length > 65) throw new Error("Invalid release tag");
4
+ if (!/^v\d+\.\d+\.\d+$/.test(tag) || tag.length > 65) throw new Error("Invalid release tag");
47
5
  }
48
6
  /**
49
7
  * Release feed adapter for local release cuts. The feed's ledger replaces the GitHub release
50
- * listing and the local checkout's fetched `origin/main` replaces GitHub's compare API. A dev
51
- * cut lives in memory until its build is published; a daily not yet in the ledger stands for
52
- * the Release Please release of the source manifest's version, as a stageable draft. A release
8
+ * listing and the local checkout's fetched `origin/main` replaces GitHub's compare API. A
9
+ * daily not yet in the ledger stands for the Release Please release of the source manifest's version, as a stageable draft. A release
53
10
  * is qualified once its published release.json carries every payload this host builds, so a
54
11
  * second host adds its platform to an existing release. Nothing is built remotely, so a cut
55
12
  * is never pending and dispatch only hands the tag back to the caller to build.
56
13
  */
57
14
  function createFeedReleaseCutProvider(options) {
58
15
  const { ledger, git } = options;
59
- const rewrites = options.historyRewrite ?? [];
60
- const created = /* @__PURE__ */ new Map();
61
16
  return {
62
17
  async find(tag) {
63
18
  checkTag(tag);
64
- const kind = tag.includes("-dev.") ? "dev" : "daily";
19
+ const kind = "daily";
65
20
  const entry = ledger.releases.find((item) => item.tag === tag);
66
21
  if (entry) return {
67
22
  tag,
@@ -70,15 +25,7 @@ function createFeedReleaseCutProvider(options) {
70
25
  draft: false,
71
26
  prerelease: entry.kind !== "stable"
72
27
  };
73
- const sourceSha = created.get(tag);
74
- if (sourceSha) return {
75
- tag,
76
- sourceSha,
77
- kind,
78
- draft: false,
79
- prerelease: true
80
- };
81
- if (kind === "daily" && tag === `v${options.releasedVersion}`) return {
28
+ if (tag === `v${options.releasedVersion}`) return {
82
29
  tag,
83
30
  sourceSha: options.sourceSha,
84
31
  kind,
@@ -89,21 +36,6 @@ function createFeedReleaseCutProvider(options) {
89
36
  return null;
90
37
  },
91
38
  isMainAncestor: (sha) => gitIsAncestor(git, sha, "refs/remotes/origin/main"),
92
- async isAncestor(older, newer) {
93
- if (older === newer) return false;
94
- const rewrite = rewrites.find((entry) => entry.from === older);
95
- if (!rewrite) return gitIsAncestor(git, older, newer);
96
- if (!await gitIsAncestor(git, rewrite.to, "refs/remotes/origin/main")) throw new Error("History rewrite target is not on main");
97
- if (await commitTree(git, rewrite.to) !== rewrite.tree) throw new Error("History rewrite tree does not match");
98
- const oldTree = await hasCommit(git, rewrite.from) ? await commitTree(git, rewrite.from) : null;
99
- if (oldTree !== null && oldTree !== rewrite.tree) throw new Error("History rewrite tree does not match");
100
- return rewrite.to !== newer && await gitIsAncestor(git, rewrite.to, newer);
101
- },
102
- async create(identity) {
103
- checkTag(identity.tag);
104
- if (!identity.tag.includes("-dev.") || created.has(identity.tag)) throw new Error("Only a new dev release is cut locally");
105
- created.set(identity.tag, identity.sourceSha);
106
- },
107
39
  async qualification(release) {
108
40
  if (!ledger.releases.some((item) => item.tag === release.tag)) return "not-qualified";
109
41
  try {
@@ -115,26 +47,6 @@ function createFeedReleaseCutProvider(options) {
115
47
  }
116
48
  },
117
49
  pendingBuild: async () => "idle",
118
- async highestDevCounter(version) {
119
- checkVersion(version);
120
- return highestCounter([...ledger.releases.map((item) => item.tag), ...created.keys()], version);
121
- },
122
- async highestDevTag(version) {
123
- checkVersion(version);
124
- return highestCounter((await git([
125
- "tag",
126
- "--list",
127
- `v${version}-dev.*`
128
- ])).split("\n").map((line) => line.trim()).filter(Boolean), version, true);
129
- },
130
- async tagExists(tag) {
131
- checkTag(tag);
132
- return ledger.releases.some((item) => item.tag === tag) || await git([
133
- "tag",
134
- "--list",
135
- tag
136
- ]) !== "";
137
- },
138
50
  async dispatch(tag) {
139
51
  checkTag(tag);
140
52
  }
@@ -29,11 +29,7 @@ async function readFeedLedger(feed, fetcher) {
29
29
  const bytes = await readFeedObject(feed, "index.json", fetcher, MAX_LEDGER_BYTES);
30
30
  const ledger = bytes ? parseReleaseLedger(json(bytes), feed.app) : null;
31
31
  if (ledger && ledger.releases.length > 0) return ledger;
32
- for (const channel of [
33
- "dev",
34
- "daily",
35
- "stable"
36
- ]) if (await readFeedObject(feed, `channels/${channel}.json`, fetcher, MAX_RELEASE_BYTES) !== null) throw new Error("Release ledger is missing or empty while a channel exists");
32
+ for (const channel of ["daily", "stable"]) if (await readFeedObject(feed, `channels/${channel}.json`, fetcher, MAX_RELEASE_BYTES) !== null) throw new Error("Release ledger is missing or empty while a channel exists");
37
33
  return ledger ?? {
38
34
  schema: 1,
39
35
  app: feed.app,
@@ -25,12 +25,8 @@ function createGitHubReleaseCutProvider(options) {
25
25
  const result = await read(`${base}/compare/${sha}...main`);
26
26
  return ["ahead", "identical"].includes(String(result?.status));
27
27
  };
28
- const isAncestor = async (older, newer) => {
29
- if (!isGitSha(older) || !isGitSha(newer)) return false;
30
- return (await read(`${base}/compare/${older}...${newer}`))?.status === "ahead";
31
- };
32
28
  async function tagExists(tag) {
33
- if (!/^v\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(tag) || tag.length > 65) throw new Error("Invalid release tag");
29
+ if (!/^v\d+\.\d+\.\d+$/.test(tag) || tag.length > 65) throw new Error("Invalid release tag");
34
30
  try {
35
31
  const value = await read(`${base}/git/ref/tags/${encodeURIComponent(tag)}`);
36
32
  if (typeof value !== "object" || value === null || Array.isArray(value) || value.ref !== `refs/tags/${tag}`) throw new Error("Invalid tag response");
@@ -42,48 +38,10 @@ function createGitHubReleaseCutProvider(options) {
42
38
  }
43
39
  }
44
40
  return {
45
- tagExists,
46
- isAncestor,
47
- async highestDevCounter(version) {
48
- 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");
49
- const prefix = `v${version}-dev.`;
50
- let highest = 0;
51
- for (let page = 1; page <= 100; page++) {
52
- const result = await read(`${base}/releases?per_page=100&page=${page}`);
53
- if (!Array.isArray(result) || result.length > 100) throw new Error("Invalid release history");
54
- for (const value of result) {
55
- if (typeof value !== "object" || value === null || Array.isArray(value) || typeof value.tag_name !== "string") throw new Error("Invalid release history");
56
- const tag = value.tag_name;
57
- if (!tag.startsWith(prefix)) continue;
58
- const suffix = tag.slice(prefix.length);
59
- if (!/^\d+$/.test(suffix) || suffix.length > 16 || !Number.isSafeInteger(Number(suffix))) throw new Error("Invalid dev release counter");
60
- highest = Math.max(highest, Number(suffix));
61
- }
62
- if (result.length < 100) return highest;
63
- }
64
- throw new Error("Release history exceeds inspection limit");
65
- },
66
- async highestDevTag(version) {
67
- 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");
68
- const prefix = `refs/tags/v${version}-dev.`;
69
- const result = await read(`${base}/git/matching-refs/tags/${encodeURIComponent(`v${version}-dev.`)}`);
70
- if (!Array.isArray(result) || result.length > 1e5) throw new Error("Invalid tag history");
71
- let highest = 0;
72
- for (const value of result) {
73
- const ref = value?.ref;
74
- if (typeof ref !== "string") throw new Error("Invalid tag history");
75
- if (!ref.startsWith(prefix)) continue;
76
- const suffix = ref.slice(prefix.length);
77
- if (!/^[1-9]\d{0,15}$/.test(suffix) || !Number.isSafeInteger(Number(suffix))) continue;
78
- highest = Math.max(highest, Number(suffix));
79
- }
80
- return highest;
81
- },
82
41
  async find(tag) {
83
- if (!/^v\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(tag) || tag.length > 65) throw new Error("Invalid release tag");
84
- const kind = tag.includes("-dev.") ? "dev" : "daily";
42
+ if (!/^v\d+\.\d+\.\d+$/.test(tag) || tag.length > 65) throw new Error("Invalid release tag");
85
43
  const found = await releaseData(tag);
86
- if (!found && (!options.hiddenDrafts || kind !== "daily" || !await tagExists(tag))) return null;
44
+ if (!found && (!options.hiddenDrafts || !await tagExists(tag))) return null;
87
45
  const release = found ?? {
88
46
  tag_name: tag,
89
47
  draft: true,
@@ -100,35 +58,16 @@ function createGitHubReleaseCutProvider(options) {
100
58
  read,
101
59
  base
102
60
  })) throw new Error("Release provenance mismatch");
103
- const stageableDraft = release.draft && kind === "daily" && !release.body.split(/\r?\n/).some((line) => line.startsWith("adea-channel:") || line.startsWith("Source: "));
104
61
  return {
105
62
  tag,
106
63
  sourceSha: target.sha,
107
- kind,
64
+ kind: "daily",
108
65
  draft: release.draft,
109
66
  prerelease: release.prerelease,
110
- ...stageableDraft ? { stageableDraft: true } : {}
67
+ ...release.draft ? { stageableDraft: true } : {}
111
68
  };
112
69
  },
113
70
  isMainAncestor,
114
- async create(identity) {
115
- const body = {
116
- tag_name: identity.tag,
117
- target_commitish: identity.sourceSha,
118
- name: `${appName} ${identity.tag}`,
119
- prerelease: true,
120
- make_latest: "false",
121
- body: `adea-channel:dev\n\nSource: ${identity.sourceSha}`
122
- };
123
- await run([
124
- "api",
125
- `${base}/releases`,
126
- "--method",
127
- "POST",
128
- "--input",
129
- "-"
130
- ], JSON.stringify(body));
131
- },
132
71
  async qualification(release) {
133
72
  try {
134
73
  const current = await releaseData(release.tag);
@@ -1,3 +1,5 @@
1
+ /** Whether a release note carries a cutter's channel or source marker, which no daily does. */
2
+ export declare const hasCutterMarker: (body: string) => boolean;
1
3
  /** Check the tag and source independently; legacy release notes are never rewritten. */
2
4
  export declare function verifyReleaseProvenance(options: {
3
5
  tag: string;
@@ -1,15 +1,12 @@
1
1
  import { isGitSha } from "../app/value-guards.js";
2
2
  // src/release/github-release-provenance.ts
3
+ /** Whether a release note carries a cutter's channel or source marker, which no daily does. */
4
+ var hasCutterMarker = (body) => body.split(/\r?\n/).some((line) => line.startsWith("adea-channel:") || line.startsWith("Source: "));
3
5
  /** Check the tag and source independently; legacy release notes are never rewritten. */
4
6
  async function verifyReleaseProvenance(options) {
5
7
  const { tag, sourceSha, body, releasePleaseManifestPath, read, base } = options;
6
8
  if (!isGitSha(sourceSha)) return false;
7
- const lines = body.split(/\r?\n/);
8
- const markers = lines.filter((line) => line.startsWith("adea-channel:"));
9
- const sources = lines.filter((line) => line.startsWith("Source: "));
10
- const kind = tag.includes("-dev.") ? "dev" : "daily";
11
- if (kind === "dev" && markers.length === 1 && markers[0] === "adea-channel:dev" && sources.length === 1 && sources[0] === `Source: ${sourceSha}`) return true;
12
- if (kind !== "daily" || markers.length || sources.length || !/^v(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(tag) || !/^[A-Za-z0-9._/-]+\.json$/.test(releasePleaseManifestPath) || releasePleaseManifestPath.split("/").some((part) => !part || part === "." || part === "..")) return false;
9
+ if (hasCutterMarker(body) || !/^v(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(tag) || !/^[A-Za-z0-9._/-]+\.json$/.test(releasePleaseManifestPath) || releasePleaseManifestPath.split("/").some((part) => !part || part === "." || part === "..")) return false;
13
10
  const result = await read(`${base}/contents/${releasePleaseManifestPath.split("/").map(encodeURIComponent).join("/")}?ref=${sourceSha}`);
14
11
  if (typeof result !== "object" || result === null || Array.isArray(result)) return false;
15
12
  const data = result;
@@ -25,4 +22,4 @@ async function verifyReleaseProvenance(options) {
25
22
  return false;
26
23
  }
27
24
  }
28
- export { verifyReleaseProvenance };
25
+ export { hasCutterMarker, verifyReleaseProvenance };
@@ -8,7 +8,7 @@ import { isRepositorySlug } from "../updates/feed/signed-release.js";
8
8
  /** GitHub adapter; callers must run it in a trusted release job with GH_TOKEN. */
9
9
  function createGitHubReleasePublisher(options) {
10
10
  const { repository, identity } = options;
11
- if (!isRepositorySlug(repository) || identity.tag.length > 65 || !/^v[0-9]+\.[0-9]+\.[0-9]+(?:-dev\.[0-9]+)?$/.test(identity.tag) || !isGitSha(identity.sourceSha) || !isGitSha(identity.workflowSha)) throw new Error("Invalid GitHub release identity");
11
+ if (!isRepositorySlug(repository) || identity.tag.length > 65 || !/^v[0-9]+\.[0-9]+\.[0-9]+$/.test(identity.tag) || !isGitSha(identity.sourceSha) || !isGitSha(identity.workflowSha)) throw new Error("Invalid GitHub release identity");
12
12
  const run = options.run ?? githubCli();
13
13
  const base = `repos/${repository}`;
14
14
  const read = async (path) => JSON.parse(await run(["api", path]));
@@ -32,7 +32,7 @@ function createGitHubReleasePublisher(options) {
32
32
  const workflow = workflowComparison;
33
33
  if (!release || typeof release.tag_name !== "string" || typeof release.draft !== "boolean" || typeof release.body !== "string") throw new Error("Invalid GitHub release response");
34
34
  const assets = await listGitHubReleaseAssets(read, base, release.id);
35
- const provenance = (!release.draft || !release.body.split(/\r?\n/).some((line) => line.startsWith("adea-channel:") || line.startsWith("Source: "))) && await verifyReleaseProvenance({
35
+ const provenance = await verifyReleaseProvenance({
36
36
  tag: identity.tag,
37
37
  sourceSha: identity.sourceSha,
38
38
  body: release.body,
@@ -9,7 +9,7 @@ import { createHash } from "node:crypto";
9
9
  /** Verify immutable GitHub release assets and the exact successful workflow attempt. */
10
10
  async function qualifyGitHubRelease(options) {
11
11
  const { repository, tag, requirements } = options;
12
- if (!isRepositorySlug(repository) || tag.length > 65 || !/^v\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(tag)) throw new Error("Invalid release identity");
12
+ if (!isRepositorySlug(repository) || tag.length > 65 || !/^v\d+\.\d+\.\d+$/.test(tag)) throw new Error("Invalid release identity");
13
13
  const run = options.run ?? githubCli();
14
14
  const base = `repos/${repository}`;
15
15
  const read = async (path) => JSON.parse(await run(["api", path]));
@@ -21,7 +21,7 @@ async function qualifyGitHubRelease(options) {
21
21
  }), read(`${base}/commits/${encodeURIComponent(tag)}`)]);
22
22
  const release = releaseData;
23
23
  const sourceSha = commitData?.sha;
24
- if (!release || release.tag_name !== tag || release.draft !== false && !(release.draft === true && options.allowDraft === true) || typeof release.body !== "string" || release.draft === true && release.body.split(/\r?\n/).some((line) => line.startsWith("adea-channel:") || line.startsWith("Source: ")) || typeof sourceSha !== "string" || !await verifyReleaseProvenance({
24
+ if (!release || release.tag_name !== tag || release.draft !== false && !(release.draft === true && options.allowDraft === true) || typeof release.body !== "string" || typeof sourceSha !== "string" || !await verifyReleaseProvenance({
25
25
  tag,
26
26
  sourceSha,
27
27
  body: release.body,
@@ -37,7 +37,7 @@ async function qualifyGitHubRelease(options) {
37
37
  return runOrder < 0n ? -1 : runOrder > 0n ? 1 : Number(second[2]) - Number(first[2]);
38
38
  });
39
39
  for (const asset of candidates) try {
40
- if (assets.filter((item) => item.name === asset.name).length !== 1 || !Number.isSafeInteger(asset.size) || asset.size < 1 || asset.size > 262144) throw new Error("Invalid qualification asset");
40
+ if (!Number.isSafeInteger(asset.size) || asset.size < 1 || asset.size > 262144) throw new Error("Invalid qualification asset");
41
41
  const text = await run([
42
42
  "release",
43
43
  "download",
@@ -26,10 +26,10 @@ export type UploadPlan = Readonly<{
26
26
  }>;
27
27
  /** The release platform of this machine. */
28
28
  export declare function hostReleasePlatform(platform?: string, arch?: string): ReleasePlatform;
29
- /** Cut or resume a dev or daily release from a clean local checkout of `sourceSha`, with
29
+ /** Cut or resume the daily release from a clean local checkout of `sourceSha`, with
30
30
  * version state from the feed's ledger. `dispatched` means: build and publish this tag. */
31
31
  export declare function runLocalReleaseCut(options: {
32
- kind: 'dev' | 'daily';
32
+ kind: 'daily';
33
33
  config: unknown;
34
34
  sourceSha: string;
35
35
  platform: ReleasePlatform;
@@ -43,7 +43,7 @@ export declare function runLocalReleaseCut(options: {
43
43
  platform: "linux-x64" | "macos-arm64" | "windows-x64";
44
44
  }>;
45
45
  /** Local provenance for an already cut tag: a clean checkout of `sourceSha` on origin/main whose
46
- * manifest version the tag belongs to (the daily itself, or a dev build of the next minor). */
46
+ * manifest names the tag's version. */
47
47
  export declare function localTagProvenance(options: {
48
48
  config: unknown;
49
49
  tag: string;
@@ -6,8 +6,8 @@ import { verifyReleaseDescriptor } from "../updates/feed/signed-release.js";
6
6
  import { createFeedReleaseCutProvider } from "./feed-release-cut.js";
7
7
  import { ReleaseFeedSnapshotChanged, readFeedLedger, readFeedRelease, verifyFeedRelease } from "./feed-state.js";
8
8
  import { resolveLocalProvenance } from "./local-provenance.js";
9
- import { discoveryPolicies, parseReleaseConfig, platformPayloads, platformTargets } from "./release-config.js";
10
- import { cutRelease, nextDevVersion } from "./release-cut.js";
9
+ import { discoveryPolicies, parseReleaseConfig, platformPayloads, platformTargets, releaseVerificationKeys } from "./release-config.js";
10
+ import { cutRelease } from "./release-cut.js";
11
11
  import { configuredSigningKey, signDiscoveryDescriptors, writeDescriptors } from "./release-descriptor-staging.js";
12
12
  import { fileIdentity } from "./release-publication.js";
13
13
  import { promoteDailyRelease } from "./release-promotion.js";
@@ -22,7 +22,6 @@ import { createHash } from "node:crypto";
22
22
  * object keys and an ordered upload plan; the caller uploads it with its own credentials.
23
23
  */
24
24
  var UPLOAD_PLAN = "upload-plan.json";
25
- var channelOf = (tag) => tag.includes("-dev.") ? "dev" : "daily";
26
25
  var IMMUTABLE = "public, max-age=31536000, immutable";
27
26
  var MUTABLE = "no-cache";
28
27
  /** The release platform of this machine. */
@@ -33,14 +32,7 @@ function hostReleasePlatform(platform = process.platform, arch = process.arch) {
33
32
  }
34
33
  function localConfig(config) {
35
34
  const parsed = parseReleaseConfig(config);
36
- if (!isRecord(config) || typeof config.appId !== "string" || !isRecord(config.releaseSigningKeys) || !isRecord(config.descriptors)) throw new Error("Invalid release signing configuration");
37
- const entries = Object.entries(config.releaseSigningKeys);
38
- if (!entries.length || entries.length > 16) throw new Error("Missing release verification keys");
39
- const keys = /* @__PURE__ */ new Map();
40
- for (const [id, encoded] of entries) {
41
- if (!/^[a-z0-9][a-z0-9._-]{0,63}$/.test(id) || typeof encoded !== "string" || Buffer.from(encoded, "base64").length !== 32 || Buffer.from(encoded, "base64").toString("base64") !== encoded) throw new Error("Invalid release verification key");
42
- keys.set(id, encoded);
43
- }
35
+ const keys = releaseVerificationKeys(config);
44
36
  return {
45
37
  ...parsed,
46
38
  config,
@@ -56,7 +48,7 @@ async function exactFiles(directory, names) {
56
48
  const entries = await readdir(directory, { withFileTypes: true });
57
49
  if (entries.length !== names.length || entries.some((entry) => !entry.isFile() || !names.includes(entry.name))) throw new Error("Staged directory does not hold exactly the platform release files");
58
50
  }
59
- /** Cut or resume a dev or daily release from a clean local checkout of `sourceSha`, with
51
+ /** Cut or resume the daily release from a clean local checkout of `sourceSha`, with
60
52
  * version state from the feed's ledger. `dispatched` means: build and publish this tag. */
61
53
  async function runLocalReleaseCut(options) {
62
54
  const { kind, git, platform } = options;
@@ -73,8 +65,7 @@ async function runLocalReleaseCut(options) {
73
65
  git,
74
66
  sourceSha: provenance.sourceSha,
75
67
  releasedVersion: provenance.releasedVersion,
76
- payloads: (tag) => platformPayloads(parsed.requirements(tag), platform),
77
- historyRewrite: parsed.historyRewrite
68
+ payloads: (tag) => platformPayloads(parsed.requirements(tag), platform)
78
69
  });
79
70
  const result = await cutRelease({
80
71
  kind,
@@ -89,7 +80,7 @@ async function runLocalReleaseCut(options) {
89
80
  };
90
81
  }
91
82
  /** Local provenance for an already cut tag: a clean checkout of `sourceSha` on origin/main whose
92
- * manifest version the tag belongs to (the daily itself, or a dev build of the next minor). */
83
+ * manifest names the tag's version. */
93
84
  async function localTagProvenance(options) {
94
85
  const parsed = parseReleaseConfig(options.config);
95
86
  parsed.requirements(options.tag);
@@ -98,8 +89,7 @@ async function localTagProvenance(options) {
98
89
  sourceSha: options.sourceSha,
99
90
  versionSourcePath: parsed.versionSource.path
100
91
  });
101
- const expected = channelOf(options.tag) === "dev" ? `v${nextDevVersion(provenance.releasedVersion)}-dev.` : `v${provenance.releasedVersion}`;
102
- if (channelOf(options.tag) === "dev" ? !options.tag.startsWith(expected) : options.tag !== expected) throw new Error("Release tag does not belong to the source version");
92
+ if (options.tag !== `v${provenance.releasedVersion}`) throw new Error("Release tag does not belong to the source version");
103
93
  return { repository: provenance.repository };
104
94
  }
105
95
  /**
@@ -142,7 +132,6 @@ function pointerChannels(ledger, tag) {
142
132
  const entry = ledger.releases.find((item) => item.tag === tag);
143
133
  if (!entry) return [];
144
134
  const newest = (kinds) => ledger.releases.filter((item) => kinds.includes(item.kind)).reduce((best, item) => !best || versionLessThan(best.tag, item.tag) ? item : best, void 0)?.tag === tag;
145
- if (entry.kind === "dev") return newest(["dev"]) ? ["dev"] : [];
146
135
  return [...newest(["daily", "stable"]) ? ["daily"] : [], ...entry.kind === "stable" && newest(["stable"]) ? ["stable"] : []];
147
136
  }
148
137
  var jsonBytes = (value) => Buffer.from(JSON.stringify(value, null, 2) + "\n");
@@ -315,7 +304,7 @@ async function stageLocalRelease(options) {
315
304
  app: feed.app,
316
305
  releases: entry ? ledger.releases : [{
317
306
  tag,
318
- kind: channelOf(tag),
307
+ kind: "daily",
319
308
  version: tag.slice(1),
320
309
  sourceSha,
321
310
  publishedAt: now
@@ -324,7 +313,7 @@ async function stageLocalRelease(options) {
324
313
  const remaining = remote?.missingPlatforms?.filter((name) => name !== platform);
325
314
  const release = {
326
315
  tag,
327
- channel: entry?.kind ?? channelOf(tag),
316
+ channel: remote?.channel ?? "daily",
328
317
  publishedAt: remote?.publishedAt ?? now,
329
318
  assets: merged,
330
319
  ...entry?.kind === "stable" && remaining?.length ? { missingPlatforms: remaining } : {}
@@ -377,14 +366,14 @@ async function runLocalPromotion(options) {
377
366
  let selectionChanged = false;
378
367
  const provider = {
379
368
  async list() {
380
- return ledger.releases.map((entry, index) => ({
369
+ return ledger.releases.flatMap((entry, index) => entry.kind === "dev" ? [] : [{
381
370
  id: ledger.releases.length - index,
382
371
  tag: entry.tag,
383
- body: entry.kind === "dev" ? `adea-channel:dev\n\nSource: ${entry.sourceSha}` : entry.kind === "stable" ? `<!-- adea-stable:v1 ${entry.tag} -->\n<!-- adea-stable-time:${entry.promotedAt} -->` : "",
372
+ body: entry.kind === "stable" ? `<!-- adea-stable:v1 ${entry.tag} -->\n<!-- adea-stable-time:${entry.promotedAt} -->` : "",
384
373
  draft: false,
385
374
  prerelease: entry.kind !== "stable",
386
375
  publishedAt: entry.publishedAt
387
- }));
376
+ }]);
388
377
  },
389
378
  async qualify(release) {
390
379
  if (selectionChanged) return false;
@@ -23,7 +23,7 @@ async function planQualificationRun(options) {
23
23
  runId: env.GITHUB_RUN_ID,
24
24
  runAttempt: Number(env.GITHUB_RUN_ATTEMPT)
25
25
  };
26
- if (env.GITLAB_CI !== "true" || env.CI_COMMIT_TAG !== tag || !isGitSha(env.CI_COMMIT_SHA) || !/^[1-9]\d{0,19}$/.test(env.CI_PIPELINE_ID ?? "") || !/^v\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(tag) || tag.length > 65) throw new Error("Qualification requires a GitHub release-assets run or a GitLab tag pipeline");
26
+ if (env.GITLAB_CI !== "true" || env.CI_COMMIT_TAG !== tag || !isGitSha(env.CI_COMMIT_SHA) || !/^[1-9]\d{0,19}$/.test(env.CI_PIPELINE_ID ?? "") || !/^v\d+\.\d+\.\d+$/.test(tag) || tag.length > 65) throw new Error("Qualification requires a GitHub release-assets run or a GitLab tag pipeline");
27
27
  const sourceSha = env.CI_COMMIT_SHA;
28
28
  await localTagProvenance({
29
29
  config,
@@ -35,7 +35,7 @@ function releasePlanGitHubEnvironment(env) {
35
35
  /** Resolve the immutable release source before building anything in a trusted assets workflow. */
36
36
  async function planReleaseAssets(options) {
37
37
  const { env, config, tag } = options;
38
- if (env.GITHUB_ACTIONS !== "true" || env.GITHUB_REF !== "refs/heads/main" || env.GITHUB_EVENT_NAME !== "workflow_dispatch" || !isRepositorySlug(env.GITHUB_REPOSITORY ?? "") || !isGitSha(env.GITHUB_SHA) || !/^[1-9]\d{0,19}$/.test(env.GITHUB_RUN_ID ?? "") || !/^[1-9]\d{0,8}$/.test(env.GITHUB_RUN_ATTEMPT ?? "") || !/^v\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(tag) || tag.length > 65) throw new Error("Asset planning requires a trusted main workflow and valid tag");
38
+ if (env.GITHUB_ACTIONS !== "true" || env.GITHUB_REF !== "refs/heads/main" || env.GITHUB_EVENT_NAME !== "workflow_dispatch" || !isRepositorySlug(env.GITHUB_REPOSITORY ?? "") || !isGitSha(env.GITHUB_SHA) || !/^[1-9]\d{0,19}$/.test(env.GITHUB_RUN_ID ?? "") || !/^[1-9]\d{0,8}$/.test(env.GITHUB_RUN_ATTEMPT ?? "") || !/^v\d+\.\d+\.\d+$/.test(tag) || tag.length > 65) throw new Error("Asset planning requires a trusted main workflow and valid tag");
39
39
  if (typeof config !== "object" || config === null || Array.isArray(config) || typeof config.appName !== "string") throw new Error("Invalid release configuration");
40
40
  const parsed = parseReleaseConfig(config);
41
41
  const { requirements, releasePleaseManifestPath } = parsed;
@@ -41,7 +41,7 @@ export type ReleaseWorkflows = {
41
41
  export declare function hostedReleaseWorkflows(workflows: ReleaseWorkflows | undefined): ReleaseWorkflows;
42
42
  /** The file name GitHub's workflow APIs and `gh workflow run` address a workflow by. */
43
43
  export declare const workflowFile: (path: string) => string;
44
- /** Validate shared daily, dev and stable asset requirements. */
44
+ /** Validate shared daily and stable asset requirements. */
45
45
  export declare function parseReleaseConfig(config: unknown): {
46
46
  soakHours: number;
47
47
  expectedReads: readonly string[];
@@ -57,29 +57,21 @@ export declare function parseReleaseConfig(config: unknown): {
57
57
  /** The HTTPS feed releases are published to and discovered from. */
58
58
  feed: ReleaseFeed;
59
59
  commandArtifacts: readonly CommandArtifactPolicy[];
60
- /** Reviewed source commits that a history rewrite replaced; see `parseHistoryRewrite`. */
61
- historyRewrite: readonly HistoryRewrite[];
62
60
  requirements(tag: string): Requirements;
63
61
  };
64
- /** A source commit that a history rewrite (such as a repository move) replaced with `to`,
65
- * a commit with the same tree on the new main. `tree` is that tree, recorded so the entry can
66
- * be checked when the old commit is no longer in the checkout. */
67
- export type HistoryRewrite = {
68
- from: string;
69
- to: string;
70
- tree: string;
71
- };
72
- /** Parse the optional `historyRewrite` list: at most 256 entries of exactly `from`, `to` and
73
- * `tree`, each a full lowercase SHA-1, with `from` distinct from `to` and never listed twice. */
74
- export declare function parseHistoryRewrite(value: unknown): readonly HistoryRewrite[];
75
62
  /** Every payload and release asset a release's requirements name, desktop payloads first. */
76
63
  export declare function releaseAssetNames(requirements: Requirements): string[];
77
64
  /** The payloads one platform's build stages: its installer and archive, then its command artifacts. */
78
65
  export declare function platformPayloads(requirements: Requirements, platform: string): string[];
66
+ /**
67
+ * The configured release verification keys by id. A packaged app refuses a release-config.json
68
+ * with more than eight keys (packaged-release-config), so publishing refuses one as well.
69
+ */
70
+ export declare function releaseVerificationKeys(config: unknown): Map<string, string>;
79
71
  export type DiscoveryPolicy = Readonly<{
80
72
  /** Discovery asset name for this tag. */
81
73
  name: string;
82
- channel: 'dev' | 'daily' | 'stable';
74
+ channel: 'daily' | 'stable';
83
75
  platform: ReleasePlatform;
84
76
  os: (typeof platformTargets)[ReleasePlatform][0];
85
77
  arch: (typeof platformTargets)[ReleasePlatform][1];