@adea-ai/app-framework 0.41.1 → 0.43.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.
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
  # adea-desktop-release: publish a desktop release from a release tag pipeline (GitLab CI, CircleCI or
3
- # GitHub Actions) with the framework's local release mode. It builds this machine's platform (macOS arm64 or Linux x64),
3
+ # GitHub Actions) with the framework's local release mode. It builds this machine's platform
4
+ # (macOS arm64, Linux x64, or Windows x64 using Git Bash),
4
5
  # signs the channel descriptors, uploads the staged tree to the app's release feed (an
5
6
  # S3-compatible bucket such as Cloudflare R2), verifies the release from the feed, then uploads the
6
7
  # channel pointers clients follow, and links every published file on the GitLab release.
@@ -75,6 +76,7 @@ has_script() { bun -e 'process.exit(require("./package.json").scripts?.[process.
75
76
  case "$(uname -s)/$(uname -m)" in
76
77
  Darwin/arm64) platform=macos-arm64 ;;
77
78
  Linux/x86_64) platform=linux-x64 ;;
79
+ MINGW64_NT-*/x86_64|MSYS_NT-*/x86_64) platform=windows-x64 ;;
78
80
  *) say "refusing: no release platform for $(uname -s)/$(uname -m)"; exit 1 ;;
79
81
  esac
80
82
 
@@ -173,7 +175,7 @@ if [ "$status" != dispatched ]; then
173
175
  link_release "$tag"
174
176
  exit 0
175
177
  fi
176
- say "desktop $repo $tag at $sha: building $platform; windows-x64 SKIPPED (no Windows runner)"
178
+ say "desktop $repo $tag at $sha: building $platform"
177
179
 
178
180
  if has_script release:preflight; then bun run release:preflight "$tag" "$platform"
179
181
  else rc=$?; [ "$rc" = 3 ] || exit "$rc"; fi
@@ -1,9 +1,10 @@
1
1
  import { mutateCustomThemeLibrary } from "./theme-library-mutation.js";
2
2
  import { flatVariantTokens, validateThemeRegistry } from "./theme-library-schema.js";
3
3
  import { LEGACY_IMPORTED_THEME_TOKEN_PROJECTION } from "./legacy-imported-theme-token-projection.js";
4
+ import { canonicalFromVsCode, isVsCodeTheme } from "./vscode-theme-import.js";
4
5
  import { projectThemeTokens } from "@adea-ai/ui/components/theme/token-projection";
5
6
  import { colorToHex, contrastRatio, ensureContrast, parseColor } from "@adea-ai/ui/lib/accent-roles";
6
- import { defaultThemeRecord, editorRolesHex, oklchToHex, parseOklchColor, shadcnDestructiveProjection, shadcnVariables, syntaxRolesHex, toXtermTheme } from "@adea-ai/ui/lib/theme-projection";
7
+ import { defaultThemeRecord, editorRolesHex, oklchToHex, parseOklchColor, parseVsCodeTheme, shadcnDestructiveProjection, shadcnVariables, syntaxRolesHex, toXtermTheme } from "@adea-ai/ui/lib/theme-projection";
7
8
  // src/appearance/custom-theme-import.ts
8
9
  var CANONICAL_COLOR_KEYS = [
9
10
  "background",
@@ -184,7 +185,7 @@ function projectCanonical(theme) {
184
185
  ].map((value) => hexOf(value));
185
186
  let editor;
186
187
  try {
187
- editor = { ...editorRolesHex(theme) };
188
+ editor = theme.syntax ? Object.fromEntries(Object.entries(syntaxRolesHex(theme)).map(([role, value]) => [role, hexOf(value)])) : { ...editorRolesHex(theme) };
188
189
  } catch {
189
190
  const raw = syntaxRolesHex(theme);
190
191
  editor = Object.fromEntries(Object.entries(raw).filter(([role]) => role in SYNTAX_SOURCES).map(([role, value]) => [role, hexOf(value)]));
@@ -226,17 +227,28 @@ function prepareCustomTheme(text) {
226
227
  try {
227
228
  source = JSON.parse(text);
228
229
  } catch {
229
- return {
230
+ try {
231
+ source = parseVsCodeTheme(text);
232
+ } catch {
233
+ return {
234
+ ok: false,
235
+ error: "That file is not valid JSON."
236
+ };
237
+ }
238
+ if (!isVsCodeTheme(source)) return {
230
239
  ok: false,
231
240
  error: "That file is not valid JSON."
232
241
  };
233
242
  }
234
- const record = typeof source === "object" && source !== null && "theme" in source ? source.theme : source;
235
- if (typeof record !== "object" || record === null) return {
243
+ const unwrapped = typeof source === "object" && source !== null && "theme" in source ? source.theme : source;
244
+ if (typeof unwrapped !== "object" || unwrapped === null) return {
236
245
  ok: false,
237
246
  error: "That file does not describe a theme."
238
247
  };
239
248
  const notes = [];
249
+ const fromVsCode = isVsCodeTheme(unwrapped);
250
+ const record = fromVsCode ? canonicalFromVsCode(unwrapped) : unwrapped;
251
+ if (fromVsCode) notes.push("Read as a VS Code colour theme; code keeps its colours.");
240
252
  const rawColors = record.colors ?? {};
241
253
  const appearance = record.appearance === "light" || record.appearance === "dark" ? record.appearance : isHex(rawColors.background) ? contrastRatio(rawColors.background, "#ffffff") > contrastRatio(rawColors.background, "#000000") ? "dark" : "light" : rawColors.background === void 0 ? "dark" : "light";
242
254
  const base = defaultThemeRecord(appearance);
@@ -272,7 +284,8 @@ function prepareCustomTheme(text) {
272
284
  colors,
273
285
  ansi: Object.fromEntries(ANSI_KEYS.map((key, index) => [key, ansi[index]])),
274
286
  cursor: isHex(record.cursor) ? normalizeHex(record.cursor) : base.cursor,
275
- selection: isHex(record.selection) ? normalizeHex(record.selection) : base.selection
287
+ selection: isHex(record.selection) ? normalizeHex(record.selection) : base.selection,
288
+ ...syntaxOf(record.syntax)
276
289
  };
277
290
  let variant;
278
291
  try {
@@ -309,6 +322,12 @@ function prepareCustomTheme(text) {
309
322
  }
310
323
  };
311
324
  }
325
+ /** The syntax colours a file names, as hex, or nothing when it names none. */
326
+ function syntaxOf(value) {
327
+ if (typeof value !== "object" || value === null) return {};
328
+ const roles = Object.fromEntries(Object.entries(value).flatMap(([role, color]) => isHex(color) ? [[role, normalizeHex(color)]] : []));
329
+ return Object.keys(roles).length > 0 ? { syntax: roles } : {};
330
+ }
312
331
  /** Name the prepared theme against the latest library snapshot. */
313
332
  function storedTheme(prepared, existing) {
314
333
  const id = uniqueThemeId(prepared.name, existing);
@@ -26,6 +26,14 @@ export type StoredThemeEditorRoles = Readonly<{
26
26
  diffDelete: string;
27
27
  diffHunk: string;
28
28
  searchMatch: string;
29
+ /** Roles a file with its own syntax colours carries; absent, they derive from the above. */
30
+ storage?: string;
31
+ parameter?: string;
32
+ property?: string;
33
+ field?: string;
34
+ member?: string;
35
+ constant?: string;
36
+ punctuation?: string;
29
37
  }>;
30
38
  export type StoredThemeChartRoles = Readonly<{
31
39
  chart1: string;
@@ -0,0 +1,9 @@
1
+ import { type VsCodeTheme } from '@adea-ai/ui/lib/theme-projection';
2
+ /** True for a file shaped like a VS Code colour theme rather than a canonical one. */
3
+ export declare function isVsCodeTheme(source: unknown): source is VsCodeTheme;
4
+ /**
5
+ * The canonical theme file a VS Code theme describes: name, appearance, the
6
+ * surface and ANSI roles it sets, and its syntax roles. Roles it does not set are
7
+ * left out, for the importer to fill as it fills any partial file.
8
+ */
9
+ export declare function canonicalFromVsCode(theme: VsCodeTheme): Record<string, unknown>;
@@ -0,0 +1,115 @@
1
+ import { opaqueHex, vsCodeSyntax } from "@adea-ai/ui/lib/theme-projection";
2
+ // src/appearance/vscode-theme-import.ts
3
+ var HEX = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
4
+ /** Canonical role → the workbench colours that supply it, first present wins. */
5
+ var COLOR_SOURCES = {
6
+ background: ["editor.background"],
7
+ foreground: ["editor.foreground", "foreground"],
8
+ text: ["editor.foreground", "foreground"],
9
+ surface: ["sideBar.background", "editor.background"],
10
+ surfaceElevated: [
11
+ "editorWidget.background",
12
+ "dropdown.background",
13
+ "sideBar.background"
14
+ ],
15
+ surfaceHover: ["list.hoverBackground", "toolbar.hoverBackground"],
16
+ surfaceActive: ["list.activeSelectionBackground", "list.inactiveSelectionBackground"],
17
+ border: [
18
+ "panel.border",
19
+ "editorGroup.border",
20
+ "sideBar.border",
21
+ "focusBorder"
22
+ ],
23
+ borderMuted: [
24
+ "editorIndentGuide.background1",
25
+ "editorIndentGuide.background",
26
+ "panel.border"
27
+ ],
28
+ textMuted: [
29
+ "descriptionForeground",
30
+ "sideBar.foreground",
31
+ "editorLineNumber.foreground"
32
+ ],
33
+ textSubtle: ["editorLineNumber.foreground", "descriptionForeground"],
34
+ accent: [
35
+ "button.background",
36
+ "focusBorder",
37
+ "textLink.foreground"
38
+ ],
39
+ accentForeground: ["button.foreground"],
40
+ success: ["gitDecoration.addedResourceForeground", "terminal.ansiGreen"],
41
+ warning: ["editorWarning.foreground", "terminal.ansiYellow"],
42
+ error: [
43
+ "editorError.foreground",
44
+ "errorForeground",
45
+ "terminal.ansiRed"
46
+ ],
47
+ info: ["editorInfo.foreground", "terminal.ansiBlue"]
48
+ };
49
+ var ANSI_SOURCES = {
50
+ black: "terminal.ansiBlack",
51
+ red: "terminal.ansiRed",
52
+ green: "terminal.ansiGreen",
53
+ yellow: "terminal.ansiYellow",
54
+ blue: "terminal.ansiBlue",
55
+ magenta: "terminal.ansiMagenta",
56
+ cyan: "terminal.ansiCyan",
57
+ white: "terminal.ansiWhite",
58
+ brightBlack: "terminal.ansiBrightBlack",
59
+ brightRed: "terminal.ansiBrightRed",
60
+ brightGreen: "terminal.ansiBrightGreen",
61
+ brightYellow: "terminal.ansiBrightYellow",
62
+ brightBlue: "terminal.ansiBrightBlue",
63
+ brightMagenta: "terminal.ansiBrightMagenta",
64
+ brightCyan: "terminal.ansiBrightCyan",
65
+ brightWhite: "terminal.ansiBrightWhite"
66
+ };
67
+ /** True for a file shaped like a VS Code colour theme rather than a canonical one. */
68
+ function isVsCodeTheme(source) {
69
+ if (typeof source !== "object" || source === null) return false;
70
+ const record = source;
71
+ if (Array.isArray(record.tokenColors)) return true;
72
+ const colors = record.colors;
73
+ return typeof colors === "object" && colors !== null && typeof colors["editor.background"] === "string";
74
+ }
75
+ /**
76
+ * The canonical theme file a VS Code theme describes: name, appearance, the
77
+ * surface and ANSI roles it sets, and its syntax roles. Roles it does not set are
78
+ * left out, for the importer to fill as it fills any partial file.
79
+ */
80
+ function canonicalFromVsCode(theme) {
81
+ const workbench = theme.colors ?? {};
82
+ const background = color(workbench["editor.background"], void 0);
83
+ const pick = (keys) => {
84
+ for (const key of keys) {
85
+ const value = color(workbench[key], background);
86
+ if (value) return value;
87
+ }
88
+ };
89
+ const colors = Object.fromEntries(Object.entries(COLOR_SOURCES).flatMap(([role, keys]) => {
90
+ const value = pick(keys);
91
+ return value ? [[role, value]] : [];
92
+ }));
93
+ const ansi = Object.fromEntries(Object.entries(ANSI_SOURCES).flatMap(([role, key]) => {
94
+ const value = color(workbench[key], background);
95
+ return value ? [[role, value]] : [];
96
+ }));
97
+ const type = theme.type?.toLowerCase();
98
+ const appearance = type === "light" || type === "hc-light" ? "light" : type === "dark" || type === "hc" || type === "hc-black" ? "dark" : void 0;
99
+ return {
100
+ ...theme.name ? { name: theme.name } : {},
101
+ ...appearance ? { appearance } : {},
102
+ colors,
103
+ ansi,
104
+ ...optional("cursor", pick(["editorCursor.foreground", "terminalCursor.foreground"])),
105
+ ...optional("selection", pick(["editor.selectionBackground", "terminal.selectionBackground"])),
106
+ syntax: vsCodeSyntax(theme)
107
+ };
108
+ }
109
+ function color(value, background) {
110
+ return typeof value === "string" && HEX.test(value) ? opaqueHex(value, background) : void 0;
111
+ }
112
+ function optional(key, value) {
113
+ return value ? { [key]: value } : {};
114
+ }
115
+ export { canonicalFromVsCode, isVsCodeTheme };
@@ -11,7 +11,7 @@ await runCli((error) => `Unable to apply the pinned Electrobun shortcut patch: $
11
11
  if (execFileSync("git", ["rev-parse", "HEAD"], {
12
12
  cwd: root,
13
13
  encoding: "utf8"
14
- }).trim() !== "d06abc9edf0b4e55116129cabbfe17bf89e11791") throw new Error("Unexpected Electrobun commit");
14
+ }).trim() !== "c9e637c4e8acc8d53fc4a1703346196b004a00d8") throw new Error("Unexpected Electrobun commit");
15
15
  applyElectrobunPatch(root, SHORTCUT_PATCH_PATH, PINNED_SHORTCUT_PATCH);
16
16
  process.stdout.write("Prepared pinned Electrobun extractor with bounded Shell Link shortcuts\n");
17
17
  });
@@ -1 +1 @@
1
- {"version":"0.41.1","commit":"b8b065ec637941693c8e7ddaf9058ea5f68b2f7b"}
1
+ {"version":"0.43.0","commit":"cdc9302751506a068d49f0beb7f20e8c1bce9eb2"}
@@ -6,7 +6,7 @@ type CefHelperTarget = Readonly<{
6
6
  sdk: string;
7
7
  sdkBytes: number;
8
8
  sdkSha256: string;
9
- /** The helper Electrobun 2.0.5 ships in its core archive for this target. */
9
+ /** The helper Electrobun 2.0.6 ships in its core archive for this target. */
10
10
  stockHelperSha256: string;
11
11
  }>;
12
12
  /** A failure message safe to print: this module's own bounded messages, never paths or tool output. */
@@ -7,10 +7,10 @@ import { createHash, randomUUID } from "node:crypto";
7
7
  import { spawnSync } from "node:child_process";
8
8
  import { availableParallelism, homedir } from "node:os";
9
9
  // src/native/cef-helper.ts
10
- /** The CEF build Electrobun 2.0.5 pins (its src/shared/cef-version.ts). */
10
+ /** The CEF build Electrobun 2.0.6 pins (its src/shared/cef-version.ts). */
11
11
  var CEF_VERSION = "156.0.7+g47dbc1d";
12
12
  var CHROMIUM_VERSION = "156.0.8078.17";
13
- /** Electrobun 2.0.5's macOS deployment target (its scripts/macos-release.js). */
13
+ /** Electrobun 2.0.6's macOS deployment target (its scripts/macos-release.js). */
14
14
  var MACOS_DEPLOYMENT_TARGET = "14.0";
15
15
  /** Bump when the build recipe below changes, so cached helpers are rebuilt. */
16
16
  var RECIPE = 1;
@@ -37,7 +37,7 @@ var TARGETS = {
37
37
  sdk: "windows64",
38
38
  sdkBytes: 174668703,
39
39
  sdkSha256: "81ed0be65efe89013c354ce60f3d694958a613891a46efee2f3a25d5af8fdca0",
40
- stockHelperSha256: "327e27822d813926bd03dba3caf1e12416981d4c6b973ba9f7cfd90b573e5a1b"
40
+ stockHelperSha256: "32e58abf3a83fb09f2d784a69a8aa49907ca19291d204b4cafeb0a01fb61552a"
41
41
  }
42
42
  };
43
43
  /** A failure message safe to print: this module's own bounded messages, never paths or tool output. */
@@ -220,7 +220,7 @@ function visualStudioRoot() {
220
220
  }
221
221
  /**
222
222
  * Fetch the three pinned helper sources, apply the digest-pinned main-frame
223
- * patch, and build this target's helper exactly as Electrobun 2.0.5's
223
+ * patch, and build this target's helper exactly as Electrobun 2.0.6's
224
224
  * build.ts does, against the pinned CEF minimal distribution.
225
225
  */
226
226
  async function buildPatchedCefHelper(pin, work, output) {
@@ -1,8 +1,8 @@
1
- /** Electrobun 2.0.5 (MIT), tag v2.0.5: the only source these patches target. */
2
- export declare const ELECTROBUN_COMMIT = "d06abc9edf0b4e55116129cabbfe17bf89e11791";
1
+ /** Electrobun 2.0.6 (MIT), tag v2.0.6: the only source these patches target. */
2
+ export declare const ELECTROBUN_COMMIT = "c9e637c4e8acc8d53fc4a1703346196b004a00d8";
3
3
  /** The Electrobun release that commit is tagged as. */
4
- export declare const ELECTROBUN_VERSION = "2.0.5";
5
- /** The Zig release Electrobun 2.0.5 builds with (its src/shared/build-dependencies.ts). */
4
+ export declare const ELECTROBUN_VERSION = "2.0.6";
5
+ /** The Zig release Electrobun 2.0.6 builds with (its src/shared/build-dependencies.ts). */
6
6
  export declare const ZIG_VERSION = "0.17.0";
7
7
  export declare const SHORTCUT_PATCH_PATH: string;
8
8
  export declare const CEF_BRIDGE_PATCH_PATH: string;
@@ -5,11 +5,11 @@ import { lstatSync, readFileSync } from "node:fs";
5
5
  import { execFileSync } from "node:child_process";
6
6
  import { fileURLToPath } from "node:url";
7
7
  // src/native/electrobun-source-patch.ts
8
- /** Electrobun 2.0.5 (MIT), tag v2.0.5: the only source these patches target. */
9
- var ELECTROBUN_COMMIT = "d06abc9edf0b4e55116129cabbfe17bf89e11791";
8
+ /** Electrobun 2.0.6 (MIT), tag v2.0.6: the only source these patches target. */
9
+ var ELECTROBUN_COMMIT = "c9e637c4e8acc8d53fc4a1703346196b004a00d8";
10
10
  /** The Electrobun release that commit is tagged as. */
11
- var ELECTROBUN_VERSION = "2.0.5";
12
- /** The Zig release Electrobun 2.0.5 builds with (its src/shared/build-dependencies.ts). */
11
+ var ELECTROBUN_VERSION = "2.0.6";
12
+ /** The Zig release Electrobun 2.0.6 builds with (its src/shared/build-dependencies.ts). */
13
13
  var ZIG_VERSION = "0.17.0";
14
14
  /** Patches ship in `src/native/` so packaged consumers apply the reviewed bytes from `dist/` or `src/`. */
15
15
  var shippedPatch = (name) => join(dirname(fileURLToPath(import.meta.url)), "..", "..", "src", "native", name);
@@ -18,21 +18,21 @@ var CEF_BRIDGE_PATCH_PATH = shippedPatch("electrobun-cef-main-frame-bridges.patc
18
18
  var POSIX_LAUNCH_LEASE_PATCH_PATH = shippedPatch("electrobun-posix-launch-lease.patch");
19
19
  var extractor = "package/src/extractor/";
20
20
  var PINNED_SHORTCUT_PATCH = {
21
- patchSha256: "72a4b75bf3a7fe2e27b2bc322e6447bcfa4169e55eda2f536dcf8189b0a94ad5",
21
+ patchSha256: "8295388222d6961ab73bba38783f707c78cf75a351f4675edb4ed5288d7b3c0c",
22
22
  before: {
23
23
  [`${extractor}build.zig`]: "b749c261250850a8e7d9d2d59fea1023b11a49d1b6d7311808c0ff1ca72b4400",
24
- [`${extractor}main.zig`]: "20cc6e888ae99160079eb5c0d52974c2ba8838a6a0e3a80d3b24d828fbd26044"
24
+ [`${extractor}main.zig`]: "67b32f50a771fb60f6479ab93d244e8b05acc522036388aa66063796eb474e73"
25
25
  },
26
26
  after: {
27
27
  [`${extractor}build.zig`]: "2b2c20a3ca4dbd7630205df547049389ca74628b8c1201b37aa867b96a8dd8a3",
28
- [`${extractor}main.zig`]: "9e393d1b8161aad915b3ce16aff4fabebc9c145707a4bdf9a2cb8ae5233dd0e2",
28
+ [`${extractor}main.zig`]: "82529c17c05d64f35a8c5195773a7ad1950bd0c5476385e8c01b18101979d19d",
29
29
  [`${extractor}windows_shortcut.c`]: "1265bbbe87720784d9386b124ffe3bec4ae218389560eeebe85004531cb11698",
30
30
  [`${extractor}windows_shortcut_test_helper.c`]: "1edccd2789efecfdea43911b89195c86fc95c0dda6ac76c0d1182a4d6fbee904"
31
31
  }
32
32
  };
33
33
  /** Opt-in launcher lease: macOS arm64 runtime-qualified; Linux x86_64 compile-only. */
34
34
  var PINNED_POSIX_LAUNCH_LEASE_PATCH = {
35
- patchSha256: "8b22fef44311a2c7151b80701afa1f1822a5b05ec5035d9bf9901b96fc668db6",
35
+ patchSha256: "d75dffd649e1cc7cd643bc2a3119ca6a4de4d1664a4b3b32d9f43ab65fb4f1da",
36
36
  unidiffZero: true,
37
37
  before: {
38
38
  "package/src/launcher/build.zig": "d56006fddea42684850aa67d7031198b2ded3eabb931b22bf2c25f30627975ba",
@@ -51,7 +51,7 @@ var CEF_HELPER_SOURCES = {
51
51
  win: "package/src/native/win/cef_process_helper_win.cpp"
52
52
  };
53
53
  var PINNED_CEF_BRIDGE_PATCH = {
54
- patchSha256: "318429449d0051eadbb5e5b06df3825c19029a9eaec74793ddada520b4a41cf6",
54
+ patchSha256: "cb969c31201c61cbf937ecd93b464252a9166c690462d8e7cc03d823ad6eea1a",
55
55
  before: {
56
56
  [CEF_HELPER_SOURCES.macos]: "b7e7704e41fab57f09c111b42815c70fb4620c5064aa2ef3c58d90642717c2ba",
57
57
  [CEF_HELPER_SOURCES.linux]: "f71d78b51da00a5236b922c5d60708ba077857e2d3e4f6230afaae10cf21ccea",
@@ -74,7 +74,7 @@ async function preparePinnedLauncher(work) {
74
74
  "--detach",
75
75
  ELECTROBUN_COMMIT
76
76
  ], source);
77
- if (sourceHead(source) !== "d06abc9edf0b4e55116129cabbfe17bf89e11791") throw new Error("Unexpected pinned Electrobun source revision");
77
+ if (sourceHead(source) !== "c9e637c4e8acc8d53fc4a1703346196b004a00d8") throw new Error("Unexpected pinned Electrobun source revision");
78
78
  try {
79
79
  applyElectrobunPatch(source, POSIX_LAUNCH_LEASE_PATCH_PATH, PINNED_POSIX_LAUNCH_LEASE_PATCH);
80
80
  } catch (error) {
@@ -173,9 +173,9 @@ async function verifyElectrobunPackage(cwd) {
173
173
  try {
174
174
  manifest = JSON.parse(await readFile(join(cwd, "node_modules", "electrobun", "package.json"), "utf8"));
175
175
  } catch (error) {
176
- throw new Error("Missing pinned Electrobun 2.0.5 package", { cause: error });
176
+ throw new Error(`Missing pinned Electrobun ${ELECTROBUN_VERSION} package`, { cause: error });
177
177
  }
178
- if (manifest.version !== "2.0.5") throw new Error("Unexpected pinned Electrobun package version");
178
+ if (manifest.version !== "2.0.6") throw new Error("Unexpected pinned Electrobun package version");
179
179
  }
180
180
  /**
181
181
  * Replace the stable macOS arm64 package launcher only when explicitly enabled.
@@ -5,7 +5,7 @@ import { createHash } from "node:crypto";
5
5
  /** Electrobun postBuild hook; runs before release hashing, packaging and signing. */
6
6
  async function secureWindowsBuild() {
7
7
  await patchWindowsBuildForTest(process.env, (input) => {
8
- if (createHash("sha256").update(input).digest("hex") === "4806357dc333785ae22cdf3526d623cd56283d9c374ceafbf847c3ba6d5d59c3") return input;
8
+ if (createHash("sha256").update(input).digest("hex") === "aa0ff9576a70cdc4f0a4c5df7c89daa888a492c3b47bc7671b5e2bbe5ee517fa") return input;
9
9
  return patchPinnedWindowsRuntime(input);
10
10
  });
11
11
  }
@@ -2,7 +2,7 @@ import { ELECTROBUN_VERSION, ZIG_VERSION } from './electrobun-source-patch';
2
2
  import { type PinnedFetch } from './pinned-download';
3
3
  export { ELECTROBUN_VERSION, ZIG_VERSION };
4
4
  /**
5
- * Electrobun 2.0.5's Windows installer runs `extractor.exe`, whose shortcut code this
5
+ * Electrobun 2.0.6's Windows installer runs `extractor.exe`, whose shortcut code this
6
6
  * framework patches (electrobun-windows-shortcut-com.patch). A stable Windows build
7
7
  * rebuilds that extractor from the pinned source with the pinned Zig toolchain and points
8
8
  * Electrobun at a copy of its devkit holding the rebuilt binary.
@@ -14,7 +14,7 @@ export { ELECTROBUN_VERSION, ZIG_VERSION };
14
14
  */
15
15
  export declare const ZIG_WINDOWS_TARGET: readonly ['-Dtarget=x86_64-windows-gnu', '-Dcpu=x86_64_v2'];
16
16
  type Env = Readonly<Record<string, string | undefined>>;
17
- /** The extractor's name in a pinned Electrobun 2.0.5 Windows x64 devkit manifest. */
17
+ /** The extractor's name in a pinned Electrobun 2.0.6 Windows x64 devkit manifest. */
18
18
  export declare function validateWindowsDevkitManifest(manifest: unknown): string;
19
19
  /** A PE32+ x64 executable that keeps the Windows GUI subsystem (no console window). */
20
20
  export declare function assertWindowsX64GuiExecutable(bytes: Uint8Array): void;
@@ -9,7 +9,7 @@ import { tmpdir } from "node:os";
9
9
  import { performance } from "node:perf_hooks";
10
10
  // src/native/windows-extractor-build.ts
11
11
  /**
12
- * Electrobun 2.0.5's Windows installer runs `extractor.exe`, whose shortcut code this
12
+ * Electrobun 2.0.6's Windows installer runs `extractor.exe`, whose shortcut code this
13
13
  * framework patches (electrobun-windows-shortcut-com.patch). A stable Windows build
14
14
  * rebuilds that extractor from the pinned source with the pinned Zig toolchain and points
15
15
  * Electrobun at a copy of its devkit holding the rebuilt binary.
@@ -25,10 +25,10 @@ var ZIG_WINDOWS_X64_URL = `https://ziglang.org/download/${ZIG_VERSION}/zig-x86_6
25
25
  var ZIG_WINDOWS_X64_SHA256 = "b5663f69581dcf391293fbf16c06cb80d81d806545ce618b4d0bab7f0eb8c428";
26
26
  var ZIG_WINDOWS_X64_SIZE = 100268137;
27
27
  var ELECTROBUN_SOURCE_URL = "https://github.com/blackboardsh/electrobun.git";
28
- /** The extractor's name in a pinned Electrobun 2.0.5 Windows x64 devkit manifest. */
28
+ /** The extractor's name in a pinned Electrobun 2.0.6 Windows x64 devkit manifest. */
29
29
  function validateWindowsDevkitManifest(manifest) {
30
30
  const value = manifest;
31
- if (value?.schemaVersion !== 1 || value.product?.name !== "electrobun" || value.product?.version !== "2.0.5" || value.target?.os !== "win" || value.target?.arch !== "x64" || value.layout?.runtime?.extractor !== "extractor.exe") throw new Error("Hutch core does not match the pinned Electrobun 2.0.5 Windows x64 devkit");
31
+ if (value?.schemaVersion !== 1 || value.product?.name !== "electrobun" || value.product?.version !== "2.0.6" || value.target?.os !== "win" || value.target?.arch !== "x64" || value.layout?.runtime?.extractor !== "extractor.exe") throw new Error("Hutch core does not match the pinned Electrobun 2.0.6 Windows x64 devkit");
32
32
  return "extractor.exe";
33
33
  }
34
34
  /** A PE32+ x64 executable that keeps the Windows GUI subsystem (no console window). */
@@ -210,7 +210,7 @@ async function buildPatchedWindowsInstaller(options) {
210
210
  sourceRoot,
211
211
  "rev-parse",
212
212
  "HEAD"
213
- ], { capture: true }) !== "d06abc9edf0b4e55116129cabbfe17bf89e11791") throw new Error("Fetched Electrobun source does not match the pinned upstream commit");
213
+ ], { capture: true }) !== "c9e637c4e8acc8d53fc4a1703346196b004a00d8") throw new Error("Fetched Electrobun source does not match the pinned upstream commit");
214
214
  (options.applyPatch ?? ((root) => applyElectrobunPatch(root, SHORTCUT_PATCH_PATH, PINNED_SHORTCUT_PATCH)))(sourceRoot);
215
215
  startStage("zig-download-and-verification");
216
216
  const archivePath = join(scratch, "zig-windows-x64.zip");
@@ -1,4 +1,4 @@
1
- export declare const ELECTROBUN_WINDOWS_WRAPPER_SHA256 = "e162c21696c1676bd4522e0c94d934aa32a6394aea852687d111ab86ed97fe1b";
2
- export declare const SECURE_WINDOWS_WRAPPER_SHA256 = "4806357dc333785ae22cdf3526d623cd56283d9c374ceafbf847c3ba6d5d59c3";
1
+ export declare const ELECTROBUN_WINDOWS_WRAPPER_SHA256 = "c0fb7e9e429ea6c2d6ebe66faf419f48deb41bff90bd9d86f7f1b3b99545c52c";
2
+ export declare const SECURE_WINDOWS_WRAPPER_SHA256 = "aa0ff9576a70cdc4f0a4c5df7c89daa888a492c3b47bc7671b5e2bbe5ee517fa";
3
3
  /** Patch only the exact pinned unsigned SDK. Sign the application after applying it. */
4
4
  export declare function patchPinnedWindowsRuntime(input: Buffer): Buffer;
@@ -1,12 +1,12 @@
1
1
  import { patchWindowsBinaryForDigest } from "./windows-runtime-patch-internal.js";
2
2
  import { createHash } from "node:crypto";
3
3
  // src/native/windows-runtime-patch.ts
4
- var ELECTROBUN_WINDOWS_WRAPPER_SHA256 = "e162c21696c1676bd4522e0c94d934aa32a6394aea852687d111ab86ed97fe1b";
5
- var SECURE_WINDOWS_WRAPPER_SHA256 = "4806357dc333785ae22cdf3526d623cd56283d9c374ceafbf847c3ba6d5d59c3";
4
+ var ELECTROBUN_WINDOWS_WRAPPER_SHA256 = "c0fb7e9e429ea6c2d6ebe66faf419f48deb41bff90bd9d86f7f1b3b99545c52c";
5
+ var SECURE_WINDOWS_WRAPPER_SHA256 = "aa0ff9576a70cdc4f0a4c5df7c89daa888a492c3b47bc7671b5e2bbe5ee517fa";
6
6
  /** Patch only the exact pinned unsigned SDK. Sign the application after applying it. */
7
7
  function patchPinnedWindowsRuntime(input) {
8
8
  const output = patchWindowsBinaryForDigest(input, ELECTROBUN_WINDOWS_WRAPPER_SHA256);
9
- if (createHash("sha256").update(output).digest("hex") !== "4806357dc333785ae22cdf3526d623cd56283d9c374ceafbf847c3ba6d5d59c3") throw new Error("Unexpected patched runtime digest");
9
+ if (createHash("sha256").update(output).digest("hex") !== "aa0ff9576a70cdc4f0a4c5df7c89daa888a492c3b47bc7671b5e2bbe5ee517fa") throw new Error("Unexpected patched runtime digest");
10
10
  return output;
11
11
  }
12
12
  export { ELECTROBUN_WINDOWS_WRAPPER_SHA256, SECURE_WINDOWS_WRAPPER_SHA256, patchPinnedWindowsRuntime };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/app-framework",
3
- "version": "0.41.1",
3
+ "version": "0.43.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -426,7 +426,7 @@
426
426
  "tar": "^7.5.22"
427
427
  },
428
428
  "devDependencies": {
429
- "@adea-ai/ui": "0.154.0",
429
+ "@adea-ai/ui": "0.157.0",
430
430
  "@babel/core": "8.1.0",
431
431
  "@babel/preset-typescript": "^8.0.7",
432
432
  "@happy-dom/global-registrator": "^21.0.4",
@@ -448,7 +448,7 @@
448
448
  "vite-plus": "1.5.1"
449
449
  },
450
450
  "peerDependencies": {
451
- "@adea-ai/ui": "^0.154.0",
451
+ "@adea-ai/ui": "^0.157.0",
452
452
  "lucide-solid": "^1.51.0",
453
453
  "solid-js": "^1.9.15"
454
454
  },
@@ -21,6 +21,7 @@ import {
21
21
  editorRolesHex,
22
22
  oklchToHex,
23
23
  parseOklchColor,
24
+ parseVsCodeTheme,
24
25
  shadcnDestructiveProjection,
25
26
  shadcnVariables,
26
27
  syntaxRolesHex,
@@ -40,6 +41,7 @@ import {
40
41
  type StoredThemeVariant as ThemeVariant,
41
42
  } from './custom-theme-library'
42
43
  import { LEGACY_IMPORTED_THEME_TOKEN_PROJECTION } from './legacy-imported-theme-token-projection'
44
+ import { canonicalFromVsCode, isVsCodeTheme } from './vscode-theme-import'
43
45
 
44
46
  const CANONICAL_COLOR_KEYS = [
45
47
  'background',
@@ -300,7 +302,13 @@ function projectCanonical(theme: AdeaTheme): ThemeVariant {
300
302
  ].map((value) => hexOf(value))
301
303
  let editor: Record<string, string>
302
304
  try {
303
- editor = { ...editorRolesHex(theme) }
305
+ // A file that names its syntax colours (a VS Code theme does) keeps them exactly,
306
+ // as the catalogue keeps its editor themes'; the rest are held to the floor.
307
+ editor = theme.syntax
308
+ ? Object.fromEntries(
309
+ Object.entries(syntaxRolesHex(theme)).map(([role, value]) => [role, hexOf(value)])
310
+ )
311
+ : { ...editorRolesHex(theme) }
304
312
  } catch {
305
313
  // Some palettes cannot reach the 4.5:1 syntax floor from their own ramp;
306
314
  // fall back to the raw roles repaired toward the floor.
@@ -351,18 +359,27 @@ function prepareCustomTheme(
351
359
  try {
352
360
  source = JSON.parse(text)
353
361
  } catch {
354
- return { ok: false, error: 'That file is not valid JSON.' }
362
+ // VS Code theme files are JSON with comments and trailing commas.
363
+ try {
364
+ source = parseVsCodeTheme(text)
365
+ } catch {
366
+ return { ok: false, error: 'That file is not valid JSON.' }
367
+ }
368
+ if (!isVsCodeTheme(source)) return { ok: false, error: 'That file is not valid JSON.' }
355
369
  }
356
- const record = (
370
+ const unwrapped = (
357
371
  typeof source === 'object' && source !== null && 'theme' in (source as Record<string, unknown>)
358
372
  ? (source as { theme: unknown }).theme
359
373
  : source
360
374
  ) as Record<string, unknown>
361
- if (typeof record !== 'object' || record === null) {
375
+ if (typeof unwrapped !== 'object' || unwrapped === null) {
362
376
  return { ok: false, error: 'That file does not describe a theme.' }
363
377
  }
364
378
 
365
379
  const notes: string[] = []
380
+ const fromVsCode = isVsCodeTheme(unwrapped)
381
+ const record = fromVsCode ? canonicalFromVsCode(unwrapped) : unwrapped
382
+ if (fromVsCode) notes.push('Read as a VS Code colour theme; code keeps its colours.')
366
383
  const rawColors = (record.colors ?? {}) as Record<string, unknown>
367
384
  // A file that names no appearance is read from its background, so a dark palette
368
385
  // lands in the Dark menu instead of replacing the light theme.
@@ -438,6 +455,7 @@ function prepareCustomTheme(
438
455
  ) as unknown as AdeaTheme['ansi'],
439
456
  cursor: isHex(record.cursor) ? normalizeHex(record.cursor) : base.cursor,
440
457
  selection: isHex(record.selection) ? normalizeHex(record.selection) : base.selection,
458
+ ...syntaxOf(record.syntax),
441
459
  }
442
460
 
443
461
  let variant: ThemeVariant
@@ -490,6 +508,17 @@ function prepareCustomTheme(
490
508
  }
491
509
  }
492
510
 
511
+ /** The syntax colours a file names, as hex, or nothing when it names none. */
512
+ function syntaxOf(value: unknown): Pick<AdeaTheme, 'syntax'> {
513
+ if (typeof value !== 'object' || value === null) return {}
514
+ const roles = Object.fromEntries(
515
+ Object.entries(value as Record<string, unknown>).flatMap(([role, color]) =>
516
+ isHex(color) ? [[role, normalizeHex(color)]] : []
517
+ )
518
+ )
519
+ return Object.keys(roles).length > 0 ? { syntax: roles } : {}
520
+ }
521
+
493
522
  /** Name the prepared theme against the latest library snapshot. */
494
523
  function storedTheme(
495
524
  prepared: PreparedTheme,
@@ -43,6 +43,14 @@ export type StoredThemeEditorRoles = Readonly<{
43
43
  diffDelete: string
44
44
  diffHunk: string
45
45
  searchMatch: string
46
+ /** Roles a file with its own syntax colours carries; absent, they derive from the above. */
47
+ storage?: string
48
+ parameter?: string
49
+ property?: string
50
+ field?: string
51
+ member?: string
52
+ constant?: string
53
+ punctuation?: string
46
54
  }>
47
55
 
48
56
  export type StoredThemeChartRoles = Readonly<{
@@ -0,0 +1,120 @@
1
+ /*
2
+ * VS Code colour theme files, read as a canonical theme file.
3
+ *
4
+ * A VS Code theme carries workbench colours (`colors`, keyed `editor.background`,
5
+ * `terminal.ansiRed` and so on) and syntax rules (`tokenColors`, TextMate scope
6
+ * selectors, plus semantic token colours). The workbench colours map onto the
7
+ * canonical surface, text, status and ANSI roles; the syntax roles are resolved
8
+ * the way VS Code resolves them (`vsCodeSyntax`), so code reads as it does there.
9
+ * Translucent colours are composited over the editor background, as VS Code
10
+ * paints them.
11
+ */
12
+ import { opaqueHex, vsCodeSyntax, type VsCodeTheme } from '@adea-ai/ui/lib/theme-projection'
13
+
14
+ const HEX = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i
15
+
16
+ /** Canonical role → the workbench colours that supply it, first present wins. */
17
+ const COLOR_SOURCES = {
18
+ background: ['editor.background'],
19
+ foreground: ['editor.foreground', 'foreground'],
20
+ text: ['editor.foreground', 'foreground'],
21
+ surface: ['sideBar.background', 'editor.background'],
22
+ surfaceElevated: ['editorWidget.background', 'dropdown.background', 'sideBar.background'],
23
+ surfaceHover: ['list.hoverBackground', 'toolbar.hoverBackground'],
24
+ surfaceActive: ['list.activeSelectionBackground', 'list.inactiveSelectionBackground'],
25
+ border: ['panel.border', 'editorGroup.border', 'sideBar.border', 'focusBorder'],
26
+ borderMuted: ['editorIndentGuide.background1', 'editorIndentGuide.background', 'panel.border'],
27
+ textMuted: ['descriptionForeground', 'sideBar.foreground', 'editorLineNumber.foreground'],
28
+ textSubtle: ['editorLineNumber.foreground', 'descriptionForeground'],
29
+ accent: ['button.background', 'focusBorder', 'textLink.foreground'],
30
+ accentForeground: ['button.foreground'],
31
+ success: ['gitDecoration.addedResourceForeground', 'terminal.ansiGreen'],
32
+ warning: ['editorWarning.foreground', 'terminal.ansiYellow'],
33
+ error: ['editorError.foreground', 'errorForeground', 'terminal.ansiRed'],
34
+ info: ['editorInfo.foreground', 'terminal.ansiBlue'],
35
+ } as const
36
+
37
+ const ANSI_SOURCES = {
38
+ black: 'terminal.ansiBlack',
39
+ red: 'terminal.ansiRed',
40
+ green: 'terminal.ansiGreen',
41
+ yellow: 'terminal.ansiYellow',
42
+ blue: 'terminal.ansiBlue',
43
+ magenta: 'terminal.ansiMagenta',
44
+ cyan: 'terminal.ansiCyan',
45
+ white: 'terminal.ansiWhite',
46
+ brightBlack: 'terminal.ansiBrightBlack',
47
+ brightRed: 'terminal.ansiBrightRed',
48
+ brightGreen: 'terminal.ansiBrightGreen',
49
+ brightYellow: 'terminal.ansiBrightYellow',
50
+ brightBlue: 'terminal.ansiBrightBlue',
51
+ brightMagenta: 'terminal.ansiBrightMagenta',
52
+ brightCyan: 'terminal.ansiBrightCyan',
53
+ brightWhite: 'terminal.ansiBrightWhite',
54
+ } as const
55
+
56
+ /** True for a file shaped like a VS Code colour theme rather than a canonical one. */
57
+ export function isVsCodeTheme(source: unknown): source is VsCodeTheme {
58
+ if (typeof source !== 'object' || source === null) return false
59
+ const record = source as Record<string, unknown>
60
+ if (Array.isArray(record.tokenColors)) return true
61
+ const colors = record.colors
62
+ return (
63
+ typeof colors === 'object' &&
64
+ colors !== null &&
65
+ typeof (colors as Record<string, unknown>)['editor.background'] === 'string'
66
+ )
67
+ }
68
+
69
+ /**
70
+ * The canonical theme file a VS Code theme describes: name, appearance, the
71
+ * surface and ANSI roles it sets, and its syntax roles. Roles it does not set are
72
+ * left out, for the importer to fill as it fills any partial file.
73
+ */
74
+ export function canonicalFromVsCode(theme: VsCodeTheme): Record<string, unknown> {
75
+ const workbench = theme.colors ?? {}
76
+ const background = color(workbench['editor.background'], undefined)
77
+ const pick = (keys: readonly string[]): string | undefined => {
78
+ for (const key of keys) {
79
+ const value = color(workbench[key], background)
80
+ if (value) return value
81
+ }
82
+ return undefined
83
+ }
84
+ const colors = Object.fromEntries(
85
+ Object.entries(COLOR_SOURCES).flatMap(([role, keys]) => {
86
+ const value = pick(keys)
87
+ return value ? [[role, value]] : []
88
+ })
89
+ )
90
+ const ansi = Object.fromEntries(
91
+ Object.entries(ANSI_SOURCES).flatMap(([role, key]) => {
92
+ const value = color(workbench[key], background)
93
+ return value ? [[role, value]] : []
94
+ })
95
+ )
96
+ const type = theme.type?.toLowerCase()
97
+ const appearance =
98
+ type === 'light' || type === 'hc-light'
99
+ ? 'light'
100
+ : type === 'dark' || type === 'hc' || type === 'hc-black'
101
+ ? 'dark'
102
+ : undefined
103
+ return {
104
+ ...(theme.name ? { name: theme.name } : {}),
105
+ ...(appearance ? { appearance } : {}),
106
+ colors,
107
+ ansi,
108
+ ...optional('cursor', pick(['editorCursor.foreground', 'terminalCursor.foreground'])),
109
+ ...optional('selection', pick(['editor.selectionBackground', 'terminal.selectionBackground'])),
110
+ syntax: vsCodeSyntax(theme),
111
+ }
112
+ }
113
+
114
+ function color(value: string | null | undefined, background: string | undefined) {
115
+ return typeof value === 'string' && HEX.test(value) ? opaqueHex(value, background) : undefined
116
+ }
117
+
118
+ function optional(key: string, value: string | undefined): Record<string, string> {
119
+ return value ? { [key]: value } : {}
120
+ }
@@ -1,4 +1,4 @@
1
- Electrobun 2.0.5 (MIT), commit d06abc9edf0b4e55116129cabbfe17bf89e11791.
1
+ Electrobun 2.0.6 (MIT), commit c9e637c4e8acc8d53fc4a1703346196b004a00d8.
2
2
 
3
3
  Install the CEF renderer bridges (__electrobunEventBridge,
4
4
  __electrobunHostBridge, __electrobunBunBridge and __electrobunInternalBridge)
@@ -1,4 +1,4 @@
1
- Electrobun 2.0.5 (MIT), commit d06abc9edf0b4e55116129cabbfe17bf89e11791.
1
+ Electrobun 2.0.6 (MIT), commit c9e637c4e8acc8d53fc4a1703346196b004a00d8.
2
2
 
3
3
  Add an opt-in native inherited shared lease for packaged POSIX launchers. The
4
4
  option defaults off and is not wired into framework packaging. Default/off
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Ambient declarations for the Electrobun 2.0.5 main-process APIs framework applications use.
2
+ * Ambient declarations for the Electrobun 2.0.6 main-process APIs framework applications use.
3
3
  * Electrobun ships its runtime without type definitions, so a host declares the surface it
4
4
  * calls. Reference this file instead of keeping a copy: add
5
5
  * `"@adea-ai/app-framework/electrobun-types"` to `compilerOptions.types`, or
6
6
  * `/// <reference types="@adea-ai/app-framework/electrobun-types" />` to a declaration file.
7
- * Every member was checked against the pinned 2.0.5 API.
7
+ * Every member was checked against the pinned 2.0.6 API.
8
8
  */
9
9
  declare module 'electrobun/bun' {
10
10
  import type { NativeWindow, SecureWindowOptions } from '@adea-ai/app-framework/secure-window'
@@ -1,11 +1,11 @@
1
- Electrobun 2.0.5 (MIT), commit d06abc9edf0b4e55116129cabbfe17bf89e11791.
1
+ Electrobun 2.0.6 (MIT), commit c9e637c4e8acc8d53fc4a1703346196b004a00d8.
2
2
 
3
3
  Create the installer's Desktop and Start Menu shortcuts through Windows Shell
4
4
  Link COM in an isolated extractor helper process instead of an unbounded
5
5
  PowerShell child. Each shortcut waits at most 30 seconds; on timeout only the
6
6
  helper is terminated and the installation fails. COM and file-write failures
7
7
  fail the installation. Neither shortcut is skipped. Ported from the Adea
8
- Electrobun 2.0.1 patch onto the 2.0.5 extractor (Zig 0.17).
8
+ Electrobun 2.0.1 patch onto the 2.0.6 extractor (Zig 0.17).
9
9
 
10
10
  diff --git a/package/src/extractor/build.zig b/package/src/extractor/build.zig
11
11
  index 9f1297e7e62ea12ed59cea8702987f48b2d8c6f3..b9c4aa9fc87a3ac38ed33930b050074f59611e83 100644