@adea-ai/app-framework 0.28.5 → 0.29.3

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.
package/README.md CHANGED
@@ -648,6 +648,18 @@ of a commit on the fetched `origin/main`: version state comes from the feed's
648
648
  ledger, read anonymously, and the commit itself stands in for the workflow run.
649
649
  Nothing is uploaded; publishing steps write a tree mirroring the feed's keys and
650
650
  `upload-plan.json`, ordered assets, release.json, index.json, channel pointers.
651
+ When the ledger is missing or empty, bootstrap checks all three channel pointers
652
+ and refuses to proceed if any exists or cannot be read. All three returning 404
653
+ does not prove that the feed has no orphaned artifacts or concurrent writers; a
654
+ nonempty ledger can also be stale. Promotion rechecks the ledger and selected
655
+ release inventory after qualification and refuses to stage when a re-read differs
656
+ or the ledger is unavailable. These point-in-time checks are not transactions.
657
+ Serialize feed writers from the first read through the final upload and restage
658
+ if the feed changes; transport cancellation is not a hard deadline.
659
+ The publisher also refuses to stage when the selected release manifest and its
660
+ ledger entry are unmatched or disagree on channel or publication time. Interrupted
661
+ publication or promotion, and older releases evicted from the bounded ledger,
662
+ require explicit reconciliation; automatic repair is not implemented.
651
663
  These plans are snapshots, not conditional writes or transactions. Serialize all
652
664
  writers for an app's feed from the initial read through the last upload, including
653
665
  promotion and platform additions. If the feed changes before a plan is applied,
@@ -1 +1 @@
1
- {"version":"0.28.5","commit":"a271f1757f9cc7204ed0f6bf147855bdef153858"}
1
+ {"version":"0.29.3","commit":"1e7251b38468351cc9c8b0edf2a068fc3842e9ca"}
@@ -1,6 +1,6 @@
1
1
  /** Installer preflight adapted from adea-ai/adea scripts/test-desktop-release-install.mjs,
2
2
  * commit 6155d18941acbb14d9099bc2a33a50ee9683a068 (Apache-2.0). */
3
- export type InstallerPlatform = 'macos-arm64' | 'windows-x64' | 'linux-x64';
3
+ export type InstallerPlatform = 'macos-arm64' | 'windows-x64' | 'linux-x64' | 'linux-arm64';
4
4
  export type InstallerRenderer = 'native' | 'cef';
5
5
  /** Native installer execution is only allowed on disposable, matching hosted runners. */
6
6
  export declare function assertInstallerContext(env: Record<string, string | undefined>, platform: InstallerPlatform, host: string, arch: string): void;
@@ -12,7 +12,8 @@ function assertInstallerHost(platform, host, arch) {
12
12
  const expected = {
13
13
  "macos-arm64": "darwin/arm64",
14
14
  "windows-x64": "win32/x64",
15
- "linux-x64": "linux/x64"
15
+ "linux-x64": "linux/x64",
16
+ "linux-arm64": "linux/arm64"
16
17
  }[platform];
17
18
  if (!expected || `${host}/${arch}` !== expected) throw new Error("Installer requires matching native OS and architecture");
18
19
  }
@@ -39,7 +40,8 @@ function assertPayloadLayout(options) {
39
40
  if (![
40
41
  "macos-arm64",
41
42
  "windows-x64",
42
- "linux-x64"
43
+ "linux-x64",
44
+ "linux-arm64"
43
45
  ].includes(platform) || !["native", "cef"].includes(renderer)) throw new Error("Invalid installer profile");
44
46
  const fold = platform === "windows-x64";
45
47
  const entries = paths(options.entries, fold);
@@ -63,7 +65,7 @@ function assertPayloadLayout(options) {
63
65
  /** Check expected installer entries before extraction; links and types require separate validation. */
64
66
  function assertInstallerLayout(platform, appName, entries) {
65
67
  assertPortableAppName(appName);
66
- if (platform !== "windows-x64" && platform !== "linux-x64") throw new Error("Unsupported archive installer platform");
68
+ if (platform !== "windows-x64" && platform !== "linux-x64" && platform !== "linux-arm64") throw new Error("Unsupported archive installer platform");
67
69
  const fold = platform === "windows-x64";
68
70
  const names = paths(entries, fold);
69
71
  const expected = fold ? [
@@ -114,7 +114,7 @@ async function observeInstalledApp(options) {
114
114
  };
115
115
  assertInstallerContext(parent, options.platform, process.platform, process.arch);
116
116
  assertPortableAppName(options.appName);
117
- if (!/^[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)+$/.test(options.appId) || options.appId.length > 255 || !/^\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(options.version) || options.version.length > 64 || options.platform === "linux-x64" && !parent.DISPLAY) throw new Error("Invalid installer observation context");
117
+ if (!/^[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)+$/.test(options.appId) || options.appId.length > 255 || !/^\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(options.version) || options.version.length > 64 || (options.platform === "linux-x64" || options.platform === "linux-arm64") && !parent.DISPLAY) throw new Error("Invalid installer observation context");
118
118
  const policy = options.offlinePolicy === void 0 ? void 0 : parseOfflinePolicy(options.offlinePolicy);
119
119
  const expectedReads = options.expectedReads ?? [];
120
120
  if (!Array.isArray(expectedReads) || expectedReads.length > 32 || new Set(expectedReads).size !== expectedReads.length || JSON.stringify(expectedReads).length > 8192) throw new Error("Invalid expected reads");
@@ -80,7 +80,7 @@ async function readMacosState(pid, env) {
80
80
  * alive; its exit code tells the truth.
81
81
  */
82
82
  async function runningExecutable(pid, platform, env) {
83
- if (platform === "linux-x64") return realpath(`/proc/${pid}/exe`).catch((error) => {
83
+ if (platform === "linux-x64" || platform === "linux-arm64") return realpath(`/proc/${pid}/exe`).catch((error) => {
84
84
  if (error.code === "ENOENT") return void 0;
85
85
  throw error;
86
86
  });
@@ -11,7 +11,8 @@ async function qualifyInstallerCommand(options) {
11
11
  if (![
12
12
  "macos-arm64",
13
13
  "windows-x64",
14
- "linux-x64"
14
+ "linux-x64",
15
+ "linux-arm64"
15
16
  ].includes(platform) || !["native", "cef"].includes(renderer) || typeof config !== "object" || config === null || Array.isArray(config) || typeof config.appName !== "string" || typeof config.appId !== "string") throw new Error("Invalid installer qualification context");
16
17
  if (env.RELEASE_TAG !== tag) throw new Error("Installer release tag mismatch");
17
18
  const plan = await planReleaseAssets({
@@ -15,7 +15,8 @@ var MAX_EXPANDED_BYTES = 4294967296;
15
15
  var targets = {
16
16
  "macos-arm64": ["darwin", "arm64"],
17
17
  "windows-x64": ["win32", "x64"],
18
- "linux-x64": ["linux", "x64"]
18
+ "linux-x64": ["linux", "x64"],
19
+ "linux-arm64": ["linux", "arm64"]
19
20
  };
20
21
  var object = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
21
22
  /** The channel descriptor the app discovers for `platform`, as the release config names it. */
@@ -1,5 +1,5 @@
1
1
  import type { FileHandle } from 'node:fs/promises';
2
2
  import type { InstallerPlatform } from './installer-layout';
3
3
  /** Require an open file to be a native executable for the platform: an arm64 Mach-O on
4
- * macOS, an x86-64 ELF on Linux and an x64 PE image on Windows. `what` names it in errors. */
4
+ * macOS, an x86-64 or AArch64 ELF on Linux (by target) and an x64 PE image on Windows. `what` names it in errors. */
5
5
  export declare function assertNativeExecutable(file: FileHandle, size: number, platform: InstallerPlatform, what: string): Promise<void>;
@@ -1,18 +1,18 @@
1
1
  // src/installer/native-executable.ts
2
2
  /** Require an open file to be a native executable for the platform: an arm64 Mach-O on
3
- * macOS, an x86-64 ELF on Linux and an x64 PE image on Windows. `what` names it in errors. */
3
+ * macOS, an x86-64 or AArch64 ELF on Linux (by target) and an x64 PE image on Windows. `what` names it in errors. */
4
4
  async function assertNativeExecutable(file, size, platform, what) {
5
5
  const head = Buffer.alloc(64);
6
6
  if ((await file.read(head, 0, head.length, 0)).bytesRead !== head.length) throw new Error(`Invalid ${what}`);
7
7
  if (platform === "macos-arm64") {
8
8
  if (head.readUInt32LE(0) !== 4277009103 || head.readUInt32LE(4) !== 16777228) throw new Error(`Invalid macOS ${what}`);
9
- } else if (platform === "linux-x64") {
9
+ } else if (platform === "linux-x64" || platform === "linux-arm64") {
10
10
  if (!head.subarray(0, 4).equals(Buffer.from([
11
11
  127,
12
12
  69,
13
13
  76,
14
14
  70
15
- ])) || head[4] !== 2 || head.readUInt16LE(18) !== 62) throw new Error(`Invalid Linux ${what}`);
15
+ ])) || head[4] !== 2 || head.readUInt16LE(18) !== (platform === "linux-x64" ? 62 : 183)) throw new Error(`Invalid Linux ${what}`);
16
16
  } else {
17
17
  const offset = head.readUInt32LE(60), signature = Buffer.alloc(6);
18
18
  if (head.subarray(0, 2).toString() !== "MZ" || offset + signature.length > size || (await file.read(signature, 0, signature.length, offset)).bytesRead !== signature.length || signature.subarray(0, 4).toString() !== "PE\0\0" || signature.readUInt16LE(4) !== 34404) throw new Error(`Invalid Windows ${what}`);
@@ -4,6 +4,10 @@ import { type FetchFunction } from '../updates/release-location';
4
4
  export declare function readFeedLedger(feed: ReleaseFeed, fetcher: FetchFunction): Promise<ReleaseLedger>;
5
5
  /** A tag's published release.json, or null when none is published. */
6
6
  export declare function readFeedRelease(feed: ReleaseFeed, tag: string, fetcher: FetchFunction): Promise<FeedRelease | null>;
7
+ /** A promotion selection no longer matches the ledger used for qualification. */
8
+ export declare class ReleaseFeedSnapshotChanged extends Error {
9
+ constructor();
10
+ }
7
11
  /**
8
12
  * Verify a published release from the feed: its ledger entry and release.json agree, and every
9
13
  * signed descriptor it lists for `channels` (all of its channels by default) has the listed
@@ -20,6 +24,7 @@ export declare function verifyFeedRelease(options: {
20
24
  keys: ReadonlyMap<string, string>;
21
25
  fetch: FetchFunction;
22
26
  channels?: readonly FeedChannel[];
27
+ expectedLedger?: ReleaseLedger;
23
28
  }): Promise<{
24
29
  release: FeedRelease;
25
30
  platforms: string[];
@@ -27,7 +27,14 @@ var json = (bytes) => {
27
27
  /** The published ledger, or an empty one before the app's first release. */
28
28
  async function readFeedLedger(feed, fetcher) {
29
29
  const bytes = await readFeedObject(feed, "index.json", fetcher, MAX_LEDGER_BYTES);
30
- return bytes ? parseReleaseLedger(json(bytes), feed.app) : {
30
+ const ledger = bytes ? parseReleaseLedger(json(bytes), feed.app) : null;
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");
37
+ return ledger ?? {
31
38
  schema: 1,
32
39
  app: feed.app,
33
40
  releases: []
@@ -70,6 +77,12 @@ async function verifyFeedPayload(feed, descriptor, fetcher) {
70
77
  if (signal.aborted) throw new Error("Release payload verification cancelled");
71
78
  if (!valid) throw new Error("Release payload differs from its descriptor");
72
79
  }
80
+ /** A promotion selection no longer matches the ledger used for qualification. */
81
+ var ReleaseFeedSnapshotChanged = class extends Error {
82
+ constructor() {
83
+ super("Release feed changed or is unavailable during promotion");
84
+ }
85
+ };
73
86
  /**
74
87
  * Verify a published release from the feed: its ledger entry and release.json agree, and every
75
88
  * signed descriptor it lists for `channels` (all of its channels by default) has the listed
@@ -80,7 +93,15 @@ async function verifyFeedPayload(feed, descriptor, fetcher) {
80
93
  */
81
94
  async function verifyFeedRelease(options) {
82
95
  const { config, feed, tag, fetch: fetcher } = options;
83
- const [ledger, release] = await Promise.all([readFeedLedger(feed, fetcher), readFeedRelease(feed, tag, fetcher)]);
96
+ let ledger;
97
+ try {
98
+ ledger = await readFeedLedger(feed, fetcher);
99
+ } catch (error) {
100
+ if (options.expectedLedger) throw new ReleaseFeedSnapshotChanged();
101
+ throw error;
102
+ }
103
+ if (options.expectedLedger && JSON.stringify(ledger) !== JSON.stringify(options.expectedLedger)) throw new ReleaseFeedSnapshotChanged();
104
+ const release = await readFeedRelease(feed, tag, fetcher);
84
105
  const entry = ledger.releases.find((item) => item.tag === tag);
85
106
  if (!release || !entry || entry.kind !== release.channel) throw new Error("Release is not published consistently");
86
107
  const policies = discoveryPolicies(config, tag).filter((policy) => !options.channels || options.channels.includes(policy.channel));
@@ -115,4 +136,4 @@ async function verifyFeedRelease(options) {
115
136
  platforms: [...platforms]
116
137
  };
117
138
  }
118
- export { readFeedLedger, readFeedRelease, verifyFeedRelease };
139
+ export { ReleaseFeedSnapshotChanged, readFeedLedger, readFeedRelease, verifyFeedRelease };
@@ -6,7 +6,7 @@ import { cutRelease, nextDevVersion } from "./release-cut.js";
6
6
  import { resolveLocalProvenance } from "./local-provenance.js";
7
7
  import { versionLessThan } from "../updates/release-version.js";
8
8
  import { createFeedReleaseCutProvider } from "./feed-release-cut.js";
9
- import { readFeedLedger, readFeedRelease, verifyFeedRelease } from "./feed-state.js";
9
+ import { ReleaseFeedSnapshotChanged, readFeedLedger, readFeedRelease, verifyFeedRelease } from "./feed-state.js";
10
10
  import { fileIdentity } from "./release-publication.js";
11
11
  import { configuredSigningKey, signDiscoveryDescriptors, writeDescriptors } from "./release-descriptor-staging.js";
12
12
  import { promoteDailyRelease } from "./release-promotion.js";
@@ -287,6 +287,7 @@ async function stageLocalRelease(options) {
287
287
  }
288
288
  const [ledger, remote] = await Promise.all([readFeedLedger(feed, options.fetch), readFeedRelease(feed, tag, options.fetch)]);
289
289
  const entry = ledger.releases.find((item) => item.tag === tag);
290
+ if (Boolean(entry) !== Boolean(remote) || entry && remote && (entry.kind !== remote.channel || Date.parse(entry.publishedAt) !== Date.parse(remote.publishedAt))) throw new Error("Inconsistent feed release; reconcile publication before retrying");
290
291
  if (entry && entry.sourceSha !== sourceSha) throw new Error("The feed publishes this tag from another source commit");
291
292
  const merged = [...remote?.assets ?? []];
292
293
  const uploads = [];
@@ -373,66 +374,85 @@ async function runLocalPromotion(options) {
373
374
  let plan;
374
375
  const qualified = /* @__PURE__ */ new Map();
375
376
  const reasons = [];
376
- return {
377
- ...await promoteDailyRelease({
378
- now: timestamp(options.now),
379
- held: options.held,
380
- soakHours: local.soakHours,
381
- provider: {
382
- async list() {
383
- return ledger.releases.map((entry, index) => ({
384
- id: ledger.releases.length - index,
385
- tag: entry.tag,
386
- 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} -->` : "",
387
- draft: false,
388
- prerelease: entry.kind !== "stable",
389
- publishedAt: entry.publishedAt
390
- }));
391
- },
392
- async qualify(release) {
393
- const { platforms } = await verifyFeedRelease({
377
+ let selectionChanged = false;
378
+ const result = await promoteDailyRelease({
379
+ now: timestamp(options.now),
380
+ held: options.held,
381
+ soakHours: local.soakHours,
382
+ provider: {
383
+ async list() {
384
+ return ledger.releases.map((entry, index) => ({
385
+ id: ledger.releases.length - index,
386
+ tag: entry.tag,
387
+ 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} -->` : "",
388
+ draft: false,
389
+ prerelease: entry.kind !== "stable",
390
+ publishedAt: entry.publishedAt
391
+ }));
392
+ },
393
+ async qualify(release) {
394
+ if (selectionChanged) return false;
395
+ let verified;
396
+ try {
397
+ verified = await verifyFeedRelease({
394
398
  config: local.config,
395
399
  feed,
396
400
  tag: release.tag,
397
401
  repository: options.repository,
398
402
  keys: local.keys,
399
403
  fetch: options.fetch,
400
- channels: ["stable"]
404
+ channels: ["stable"],
405
+ expectedLedger: ledger
401
406
  });
402
- qualified.set(release.tag, platforms);
403
- const missing = required.filter((name) => !platforms.includes(name));
404
- if (missing.length) {
405
- reasons.push(`${release.tag} lacks ${missing.join(", ")}; publish them or relax stablePlatforms in release-config.json`);
407
+ } catch (error) {
408
+ if (error instanceof ReleaseFeedSnapshotChanged) {
409
+ selectionChanged = true;
406
410
  return false;
407
411
  }
408
- return true;
409
- },
410
- async markStable(selected, at) {
411
- const absent = Object.keys(platformTargets).filter((name) => !qualified.get(selected.tag)?.includes(name));
412
- const entry = ledger.releases.find((item) => item.tag === selected.tag);
413
- const remote = await readFeedRelease(feed, selected.tag, options.fetch);
414
- if (!entry || !remote || entry.kind === "dev") throw new Error("Release changed during promotion");
415
- const promoted = {
416
- tag: entry.tag,
417
- kind: "stable",
418
- version: entry.version,
419
- sourceSha: entry.sourceSha,
420
- publishedAt: entry.publishedAt,
421
- promotedAt: entry.promotedAt ?? timestamp(at)
422
- };
423
- const updated = parseReleaseLedger({
424
- schema: 1,
425
- app: feed.app,
426
- releases: ledger.releases.map((item) => item.tag === entry.tag ? promoted : item)
427
- }, feed.app);
428
- plan = await writeStagedTree(options.out, feed, [], releaseDocuments(feed, updated, {
429
- ...remote,
430
- channel: "stable",
431
- ...absent.length ? { missingPlatforms: absent } : {}
432
- }));
412
+ throw error;
413
+ }
414
+ const { release: verifiedRelease, platforms } = verified;
415
+ qualified.set(release.tag, {
416
+ release: verifiedRelease,
417
+ platforms
418
+ });
419
+ const missing = required.filter((name) => !platforms.includes(name));
420
+ if (missing.length) {
421
+ reasons.push(`${release.tag} lacks ${missing.join(", ")}; publish them or relax stablePlatforms in release-config.json`);
422
+ return false;
433
423
  }
424
+ return true;
425
+ },
426
+ async markStable(selected, at) {
427
+ const verification = qualified.get(selected.tag);
428
+ const absent = Object.keys(platformTargets).filter((name) => !verification?.platforms.includes(name));
429
+ const entry = ledger.releases.find((item) => item.tag === selected.tag);
430
+ const [currentLedger, remote] = await Promise.all([readFeedLedger(feed, options.fetch), readFeedRelease(feed, selected.tag, options.fetch)]);
431
+ if (!entry || !remote || !verification || entry.kind === "dev" || JSON.stringify(currentLedger) !== JSON.stringify(ledger) || JSON.stringify(remote) !== JSON.stringify(verification.release)) throw new Error("Release feed changed or is unavailable during promotion");
432
+ const promoted = {
433
+ tag: entry.tag,
434
+ kind: "stable",
435
+ version: entry.version,
436
+ sourceSha: entry.sourceSha,
437
+ publishedAt: entry.publishedAt,
438
+ promotedAt: entry.promotedAt ?? timestamp(at)
439
+ };
440
+ const updated = parseReleaseLedger({
441
+ schema: 1,
442
+ app: feed.app,
443
+ releases: ledger.releases.map((item) => item.tag === entry.tag ? promoted : item)
444
+ }, feed.app);
445
+ plan = await writeStagedTree(options.out, feed, [], releaseDocuments(feed, updated, {
446
+ ...remote,
447
+ channel: "stable",
448
+ ...absent.length ? { missingPlatforms: absent } : {}
449
+ }));
434
450
  }
435
- }),
451
+ }
452
+ });
453
+ if (selectionChanged) throw new Error("Release feed changed or is unavailable during promotion");
454
+ return {
455
+ ...result,
436
456
  ...reasons.length && !plan ? { reasons } : {},
437
457
  ...plan ? { plan } : {}
438
458
  };
@@ -51,7 +51,8 @@ function electrobunArtifacts(appName, platform) {
51
51
  return {
52
52
  "macos-arm64": [`macos-arm64-${bundle}.dmg`, `stable-macos-arm64-${bundle}.app.tar.zst`],
53
53
  "windows-x64": [`win-x64-${bundle}-Setup.zip`, `stable-win-x64-${bundle}.tar.zst`],
54
- "linux-x64": [`linux-x64-${bundle}-Setup.tar.gz`, `stable-linux-x64-${bundle}.tar.zst`]
54
+ "linux-x64": [`linux-x64-${bundle}-Setup.tar.gz`, `stable-linux-x64-${bundle}.tar.zst`],
55
+ "linux-arm64": [`linux-arm64-${bundle}-Setup.tar.gz`, `stable-linux-arm64-${bundle}.tar.zst`]
55
56
  }[platform];
56
57
  }
57
58
  /**
@@ -122,7 +122,7 @@ function ApplicationUtilities(props) {
122
122
  const onKeyDown = (event) => {
123
123
  if (!props.settings || !isSettingsChord(event)) return;
124
124
  event.preventDefault();
125
- openSettings();
125
+ if (!event.repeat) openSettings();
126
126
  };
127
127
  const onHash = () => {
128
128
  const sections = settingsSections();
@@ -80,7 +80,7 @@ function updateLauncherPath(platform, target) {
80
80
  return join2(target, "Contents", "MacOS", "launcher");
81
81
  if (platform === "windows-x64")
82
82
  return join2(target, "bin", "launcher.exe");
83
- if (platform === "linux-x64")
83
+ if (platform === "linux-x64" || platform === "linux-arm64")
84
84
  return join2(target, "bin", "launcher");
85
85
  throw new Error("Unsupported update platform");
86
86
  }
@@ -1284,7 +1284,7 @@ async function waitForUpdateLaunchGateWriter(target, expected, options) {
1284
1284
  // src/updates/update-helper.ts
1285
1285
  function parseUpdateHelperRequest(value) {
1286
1286
  const data = value;
1287
- if (typeof value !== "object" || value === null || Array.isArray(value) || data.schema !== 1 && data.schema !== 2 && data.schema !== 3 || typeof data.target !== "string" || !isAbsolute8(data.target) || resolve7(data.target) !== data.target || !["macos-arm64", "windows-x64", "linux-x64"].includes(data.platform) || typeof data.version !== "string" || !/^\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(data.version) || !Array.isArray(data.processes) || data.schema === 2 && (typeof data.generation !== "string" || !/^[0-9a-f-]{36}$/i.test(data.generation) || data.helperOwner !== undefined && (typeof data.helperOwner !== "string" || !/^[0-9a-f-]{36}$/i.test(data.helperOwner))) || data.schema === 3 && (typeof data.generation !== "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(data.generation) || typeof data.helperOwner !== "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(data.helperOwner)) || !Number.isSafeInteger(data.processTimeoutMs) || data.processTimeoutMs < 1 || data.processTimeoutMs > 120000)
1287
+ if (typeof value !== "object" || value === null || Array.isArray(value) || data.schema !== 1 && data.schema !== 2 && data.schema !== 3 || typeof data.target !== "string" || !isAbsolute8(data.target) || resolve7(data.target) !== data.target || !["macos-arm64", "windows-x64", "linux-x64", "linux-arm64"].includes(data.platform) || typeof data.version !== "string" || !/^\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(data.version) || !Array.isArray(data.processes) || data.schema === 2 && (typeof data.generation !== "string" || !/^[0-9a-f-]{36}$/i.test(data.generation) || data.helperOwner !== undefined && (typeof data.helperOwner !== "string" || !/^[0-9a-f-]{36}$/i.test(data.helperOwner))) || data.schema === 3 && (typeof data.generation !== "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(data.generation) || typeof data.helperOwner !== "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(data.helperOwner)) || !Number.isSafeInteger(data.processTimeoutMs) || data.processTimeoutMs < 1 || data.processTimeoutMs > 120000)
1288
1288
  throw new Error("Invalid update helper request");
1289
1289
  return Object.freeze(data);
1290
1290
  }
@@ -38,6 +38,7 @@ function updatePlatform(platform = process.platform, arch = process.arch) {
38
38
  if (platform === "darwin" && arch === "arm64") return "macos-arm64";
39
39
  if (platform === "win32" && arch === "x64") return "windows-x64";
40
40
  if (platform === "linux" && arch === "x64") return "linux-x64";
41
+ if (platform === "linux" && arch === "arm64") return "linux-arm64";
41
42
  return null;
42
43
  }
43
44
  /**
@@ -188,7 +189,8 @@ function updateTrust(platform, identity) {
188
189
  const [os, arch] = {
189
190
  "macos-arm64": ["darwin", "arm64"],
190
191
  "windows-x64": ["win32", "x64"],
191
- "linux-x64": ["linux", "x64"]
192
+ "linux-x64": ["linux", "x64"],
193
+ "linux-arm64": ["linux", "arm64"]
192
194
  }[platform];
193
195
  return {
194
196
  appId: identity.appId,
@@ -15,7 +15,7 @@ async function acquirePackagedLaunchAdmission(options) {
15
15
  const { installTarget, updatePlatform } = await import("./desktop-updater.js");
16
16
  const { adoptInheritedUpdateLaunchLease } = await import("./update-inherited-launch-lease.js");
17
17
  const platform = updatePlatform();
18
- if (!platform || platform !== "macos-arm64" && platform !== "linux-x64") throw new Error("Inherited launch admission is unavailable on this platform");
18
+ if (!platform || platform !== "macos-arm64" && platform !== "linux-x64" && platform !== "linux-arm64") throw new Error("Inherited launch admission is unavailable on this platform");
19
19
  if (typeof options.entryDirectory !== "string" || !isAbsolute(options.entryDirectory) || resolve(options.entryDirectory) !== options.entryDirectory || typeof options.descriptor !== "string" || !/^[1-9]\d{0,9}$/.test(options.descriptor)) throw new Error("Invalid packaged launch admission");
20
20
  const descriptor = Number(options.descriptor);
21
21
  if (!Number.isSafeInteger(descriptor) || descriptor < 3 || descriptor > 2147483647) throw new Error("Invalid packaged launch admission");
@@ -18,7 +18,8 @@ async function extractVerifiedUpdate(options) {
18
18
  const expected = {
19
19
  "macos-arm64": ["darwin", "arm64"],
20
20
  "windows-x64": ["win32", "x64"],
21
- "linux-x64": ["linux", "x64"]
21
+ "linux-x64": ["linux", "x64"],
22
+ "linux-arm64": ["linux", "arm64"]
22
23
  };
23
24
  if (!isVerifiedRelease(descriptor) || !expected[platform] || descriptor.platform !== expected[platform][0] || descriptor.arch !== expected[platform][1] || !isAbsolute(archive) || !isAbsolute(options.directory) || !Number.isSafeInteger(maxCompressedBytes) || maxCompressedBytes < 1 || descriptor.asset.size > maxCompressedBytes || !Number.isSafeInteger(maxExpandedBytes) || maxExpandedBytes < 1) throw new Error("Invalid update extraction context");
24
25
  assertPortableAppName(appName);
@@ -93,7 +94,7 @@ async function extractVerifiedUpdate(options) {
93
94
  if (key !== rootKey && !key.startsWith(rootKey + "/")) return reject();
94
95
  if (seen.has(key) || seen.size >= 2e5) return reject();
95
96
  const relative = normalized.slice(archiveRoot.length + 1), linkTarget = typeof entry.linkpath === "string" ? entry.linkpath : "";
96
- const cefLink = platform === "linux-x64" && renderer === "cef" && entry.type === "SymbolicLink" && isLinuxCefLibraryLink(relative, linkTarget);
97
+ const cefLink = (platform === "linux-x64" || platform === "linux-arm64") && renderer === "cef" && entry.type === "SymbolicLink" && isLinuxCefLibraryLink(relative, linkTarget);
97
98
  if (entry.type !== "File" && entry.type !== "Directory" && !cefLink) return reject();
98
99
  seen.add(key);
99
100
  entries.push(normalized);
@@ -10,7 +10,8 @@ function planUpdateHandoff(options) {
10
10
  const expected = {
11
11
  "macos-arm64": ["darwin", "arm64"],
12
12
  "windows-x64": ["win32", "x64"],
13
- "linux-x64": ["linux", "x64"]
13
+ "linux-x64": ["linux", "x64"],
14
+ "linux-arm64": ["linux", "arm64"]
14
15
  };
15
16
  if (!expected[platform] || !["native", "cef"].includes(renderer) || !isVerifiedReleaseForTrust(descriptor, trust) || descriptor.platform !== expected[platform][0] || descriptor.arch !== expected[platform][1] || approved !== true || approvedVersion !== descriptor.version || typeof currentVersion !== "string" || currentVersion.length > 64 || !/^\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(currentVersion) || !versionLessThan(currentVersion, descriptor.version)) throw new Error("Invalid approved update");
16
17
  const name = platform === "macos-arm64" ? `${appName}.app` : "app";
@@ -31,7 +31,8 @@ function parseUpdateHelperRequest(value) {
31
31
  if (typeof value !== "object" || value === null || Array.isArray(value) || data.schema !== 1 && data.schema !== 2 && data.schema !== 3 || typeof data.target !== "string" || !isAbsolute(data.target) || resolve(data.target) !== data.target || ![
32
32
  "macos-arm64",
33
33
  "windows-x64",
34
- "linux-x64"
34
+ "linux-x64",
35
+ "linux-arm64"
35
36
  ].includes(data.platform) || typeof data.version !== "string" || !/^\d+\.\d+\.\d+(?:-dev\.\d+)?$/.test(data.version) || !Array.isArray(data.processes) || data.schema === 2 && (typeof data.generation !== "string" || !/^[0-9a-f-]{36}$/i.test(data.generation) || data.helperOwner !== void 0 && (typeof data.helperOwner !== "string" || !/^[0-9a-f-]{36}$/i.test(data.helperOwner))) || data.schema === 3 && (typeof data.generation !== "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(data.generation) || typeof data.helperOwner !== "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(data.helperOwner)) || !Number.isSafeInteger(data.processTimeoutMs) || data.processTimeoutMs < 1 || data.processTimeoutMs > 12e4) throw new Error("Invalid update helper request");
36
37
  return Object.freeze(data);
37
38
  }
@@ -7,7 +7,7 @@ function updateLauncherPath(platform, target) {
7
7
  if (typeof target !== "string" || !isAbsolute(target) || resolve(target) !== target) throw new Error("Invalid update target");
8
8
  if (platform === "macos-arm64") return join(target, "Contents", "MacOS", "launcher");
9
9
  if (platform === "windows-x64") return join(target, "bin", "launcher.exe");
10
- if (platform === "linux-x64") return join(target, "bin", "launcher");
10
+ if (platform === "linux-x64" || platform === "linux-arm64") return join(target, "bin", "launcher");
11
11
  throw new Error("Unsupported update platform");
12
12
  }
13
13
  /** Start the installed app's launcher detached from the helper. */
@@ -50,7 +50,7 @@ async function recoverLegacyHandoff(options) {
50
50
  } catch {
51
51
  return { status: "recovery-required" };
52
52
  }
53
- const nativePlatform = process.platform === "darwin" && process.arch === "arm64" ? "macos-arm64" : process.platform === "win32" && process.arch === "x64" ? "windows-x64" : process.platform === "linux" && process.arch === "x64" ? "linux-x64" : void 0;
53
+ const nativePlatform = process.platform === "darwin" && process.arch === "arm64" ? "macos-arm64" : process.platform === "win32" && process.arch === "x64" ? "windows-x64" : process.platform === "linux" && process.arch === "x64" ? "linux-x64" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64" : void 0;
54
54
  if (request.schema !== 1 || request.target !== target || request.platform !== nativePlatform || request.version === currentVersion) return { status: "recovery-required" };
55
55
  const allowed = /* @__PURE__ */ new Set([
56
56
  "candidate",
@@ -552,7 +552,7 @@ async function schema3RecoveryArtifactsMatch(target, staging, state, gate, reque
552
552
  return helperDirectoryIsKnown(staging, state, gate, requestMayBeAbsent);
553
553
  }
554
554
  function requestPlatformMatchesTrust(platform, trust) {
555
- return platform === "macos-arm64" && trust.platform === "darwin" && trust.arch === "arm64" || platform === "windows-x64" && trust.platform === "win32" && trust.arch === "x64" || platform === "linux-x64" && trust.platform === "linux" && trust.arch === "x64";
555
+ return platform === "macos-arm64" && trust.platform === "darwin" && trust.arch === "arm64" || platform === "windows-x64" && trust.platform === "win32" && trust.arch === "x64" || platform === "linux-x64" && trust.platform === "linux" && trust.arch === "x64" || platform === "linux-arm64" && trust.platform === "linux" && trust.arch === "arm64";
556
556
  }
557
557
  async function schema3TreeLayout(target, staging, state) {
558
558
  if (!state.candidateTreeIdentity || !state.candidateTreeDigest || !state.previousTreeIdentity) return void 0;
@@ -26,7 +26,8 @@ async function stageUpdateSwap(options) {
26
26
  const expectedHost = {
27
27
  "macos-arm64": "darwin/arm64",
28
28
  "windows-x64": "win32/x64",
29
- "linux-x64": "linux/x64"
29
+ "linux-x64": "linux/x64",
30
+ "linux-arm64": "linux/arm64"
30
31
  }[plan.platform];
31
32
  if (`${process.platform}/${process.arch}` !== expectedHost) throw new Error("Update requires the matching native platform");
32
33
  await assertInstalledVersion({
@@ -40,7 +40,13 @@ function AppearanceControl(props) {
40
40
  function AppearanceHost(props) {
41
41
  const appearance = useTheme();
42
42
  const editor = createAppearanceEditor();
43
- onMount(() => void appearance.loadCatalogue?.());
43
+ let catalogueRequested = false;
44
+ createEffect(() => {
45
+ if (!catalogueRequested && (!props.popover || props.popover.open)) {
46
+ catalogueRequested = true;
47
+ appearance.loadCatalogue?.();
48
+ }
49
+ });
44
50
  createEffect(() => {
45
51
  const surface = editor.draft().surface;
46
52
  mirrorWindowSurface(surface === "translucent" ? "theme" : surface);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/app-framework",
3
- "version": "0.28.5",
3
+ "version": "0.29.3",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -360,8 +360,8 @@
360
360
  "registry": "https://registry.npmjs.org/"
361
361
  },
362
362
  "scripts": {
363
- "test": "bun test tests/*/*.test.ts && bun run test:ui",
364
- "test:ui": "bun test --conditions=browser --preload ./scripts/ci-test-timeout.ts --preload @adea-ai/ui/testing/solid-transform tests/*/*.test.tsx",
363
+ "test": "bun test --timeout=${ADEA_TEST_TIMEOUT_MS:-5000} tests/*/*.test.ts && bun run test:ui",
364
+ "test:ui": "bun test --timeout=${ADEA_TEST_TIMEOUT_MS:-5000} --conditions=browser --preload @adea-ai/ui/testing/solid-transform tests/*/*.test.tsx",
365
365
  "test:theme-browser": "bun scripts/test-theme-library-browser.ts",
366
366
  "build": "vp build && tsc -p tsconfig.json --emitDeclarationOnly && bun build src/cli/update-helper-cli.ts --target=bun --outfile dist/update-helper.bundle.js && bun scripts/write-framework-source.ts",
367
367
  "typecheck": "bun check -p tsconfig.test.json",
@@ -302,7 +302,7 @@ export function ApplicationUtilities(props: ApplicationUtilitiesProps) {
302
302
  const onKeyDown = (event: KeyboardEvent) => {
303
303
  if (!props.settings || !isSettingsChord(event)) return
304
304
  event.preventDefault()
305
- openSettings()
305
+ if (!event.repeat) openSettings()
306
306
  }
307
307
  const onHash = () => {
308
308
  const sections = settingsSections()
@@ -76,8 +76,15 @@ function AppearanceHost(props: { popover?: AppearanceControlProps }) {
76
76
  const editor = createAppearanceEditor()
77
77
  // The shell starts without the 34-theme catalogue (ADR 0014). A draft of a
78
78
  // catalogue theme previews once it has loaded, so fetch it when the editor opens
79
- // instead of on the first click. Idempotent; a failure leaves the default pair.
80
- onMount(() => void appearance.loadCatalogue?.())
79
+ // instead of on the first selection. A mounted but closed popover does not
80
+ // need it yet; the embedded panel is already visible when mounted.
81
+ let catalogueRequested = false
82
+ createEffect(() => {
83
+ if (!catalogueRequested && (!props.popover || props.popover.open)) {
84
+ catalogueRequested = true
85
+ void appearance.loadCatalogue?.()
86
+ }
87
+ })
81
88
  // Mirror the glass choice to the native window whenever it changes (the
82
89
  // desktop host registers the transport; everywhere else this is a no-op).
83
90
  // The mirror is idempotent, so firing on the restored draft is harmless.