Skip to content

Commit 7bddb5d

Browse files
Shawclaude
andcommitted
style: biome auto-fix lint nits in PR #7878 merge
- useLiteralKeys on electrobun.config.ts string-keyed copy entries - noPrototypeBuiltins on copy-runtime-node-modules hasOwnProperty calls - organizeImports on release-plugin-policy.test.ts Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c361674 commit 7bddb5d

5 files changed

Lines changed: 172 additions & 174 deletions

File tree

packages/agent/src/runtime/release-plugin-policy.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { describe, expect, it } from "vitest";
33
import {
44
BASELINE_BUNDLED_RUNTIME_PACKAGES,
55
classifyRegistryPluginRelease,
6-
getBundledRuntimePluginIds,
76
getBundledRuntimePackages,
7+
getBundledRuntimePluginIds,
88
} from "./release-plugin-policy.ts";
99

1010
describe("release plugin policy", () => {

packages/app-core/platforms/electrobun/electrobun.config.ts

Lines changed: 159 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ const runtimeBundleNodeModulesPath = path.join(
229229
"node_modules",
230230
);
231231
const useMacIconsetBuild = isTruthyEnv(
232-
process.env.ELIZA_ELECTROBUN_USE_ICONSET,
232+
process.env.ELIZA_ELECTROBUN_USE_ICONSET,
233233
);
234234
const repoPluginsJsonPath = path.relative(
235235
electrobunDir,
@@ -432,164 +432,164 @@ export function createElectrobunConfig(): ElectrobunConfig {
432432
// (eliza/packages/app-core/platforms/electrobun/)
433433
// ../../../../../ goes to eliza repo root where dist/, plugins.json, package.json exist
434434

435-
return {
436-
app: {
437-
name: appName,
438-
identifier: appId,
439-
version: appVersion,
440-
description: "AI agents for the desktop",
441-
urlSchemes: [urlScheme],
442-
},
443-
runtime: {
444-
exitOnLastWindowClosed: false,
445-
},
446-
scripts: {
447-
// Electrobun removes the target build folder without `force: true`;
448-
// seed it first so clean worktrees do not fail with ENOENT.
449-
preBuild: "scripts/ensure-build-folder.ts",
450-
// Sign native code inside the runtime dist node_modules on the inner app bundle
451-
// before Electrobun runs the platform signing/notarization flow.
452-
postBuild: "scripts/postwrap-sign-runtime-macos.ts",
453-
// Capture wrapper-bundle binary metadata after the self-extractor is created.
454-
postWrap: "scripts/postwrap-diagnostics.ts",
455-
},
456-
build: {
457-
bun: {
458-
entrypoint: "src/index.ts",
459-
// The Electrobun bun process is a thin native shell — it creates
460-
// windows, dispatches RPCs to the renderer, and manages the embedded
461-
// API subprocess (or talks to an external API). It must NOT bundle
462-
// the agent runtime, plugins, database, or ML stacks — those belong
463-
// in the API subprocess. Any of these reaching the Electrobun bun
464-
// bundle is a sign of an unintended import edge; either cut the edge
465-
// or extend this list.
466-
external: [
467-
// Agent runtime packages — used only via type imports in the bun
468-
// src, but workspace TS resolution can drag the source graph in.
469-
"@elizaos/core",
470-
"@elizaos/agent",
471-
"@elizaos/app-core",
472-
// Plugins — initialized by the API subprocess, never the bun shell.
473-
"@elizaos/plugin-sql",
474-
"@elizaos/plugin-local-inference",
475-
"@elizaos/plugin-local-inference",
476-
// Database stack pulled in by plugin-sql.
477-
"@electric-sql/pglite",
478-
"drizzle-orm",
479-
"pg",
480-
// Native ML/embedding packages ship platform-specific bindings via
481-
// relative require()s or per-platform sibling packages; bundling
482-
// them breaks those paths.
483-
"node-llama-cpp",
484-
"@node-llama-cpp/*",
485-
"onnxruntime-node",
486-
"onnxruntime-common",
487-
"onnxruntime-web",
488-
// chalk is pulled in transitively via @elizaos/shared/dist/terminal/theme.js.
489-
// The Electrobun bun shell never renders to a TTY, so this branch is dead at
490-
// runtime — externalising it just keeps the bundler from trying to resolve it.
491-
"chalk",
492-
],
493-
},
494-
views: {},
495-
// Watch these extra dirs in dev --watch mode so changes to the Vite
496-
// renderer build or shared types trigger a bun-side rebuild + relaunch.
497-
watch: ["../dist", "src/shared/", "src/bridge/"],
498-
// Ignore test files and build artifacts from watch triggers.
499-
watchIgnore: [
500-
"src/**/*.test.ts",
501-
"src/**/*.spec.ts",
502-
"artifacts/",
503-
"build/",
504-
],
505-
// Desktop intentionally supports both WebGPU paths:
506-
// 1. renderer-webview WebGPU (`three/webgpu` via browser `navigator.gpu`)
507-
// 2. Electrobun-native Dawn for Bun-side GpuWindow / <electrobun-wgpu>
508-
// surfaces and future native compute workloads.
509-
copy: {
510-
...resolveElectrobunCopyMap({
511-
buildVariant,
512-
runtimeDistDir,
513-
embedRuntime,
514-
}),
515-
[brandConfigCopySource]: "brand-config.json",
516-
...(process.platform === "darwin" &&
517-
fs.existsSync(libMacWindowEffectsDylib)
518-
? { "src/libMacWindowEffects.dylib": "libMacWindowEffects.dylib" }
519-
: {}),
520-
},
521-
mac: {
522-
bundleWGPU: true,
523-
codesign: process.env.ELECTROBUN_SKIP_CODESIGN !== "1",
524-
notarize:
525-
process.env.ELECTROBUN_SKIP_CODESIGN !== "1" &&
526-
process.env.ELIZA_ELECTROBUN_NOTARIZE !== "0",
527-
defaultRenderer: "native",
528-
...(useMacIconsetBuild ? { icons: "assets/appIcon.iconset" } : {}),
529-
// Entitlements are selected by the ELIZA_BUILD_VARIANT axis:
530-
// - "store": parsed from entitlements/mas.entitlements; turns on
531-
// com.apple.security.app-sandbox for Mac App Store distribution.
532-
// - "direct" (default): inline hardened-runtime entitlements with
533-
// no sandbox — current behavior for direct downloads.
534-
//
535-
// Child-process entitlements (mas-child.entitlements with
536-
// com.apple.security.inherit) are applied after this packaging
537-
// step by codesign-mas.mjs, which walks the bundle bottom-up.
538-
// See scripts/codesign-mas.mjs. Set ELIZA_MAS_SIGNING_IDENTITY
539-
// in the build env (and optionally ELIZA_MAS_INSTALLER_IDENTITY
540-
// for productbuild).
541-
entitlements:
542-
buildVariant === "store"
543-
? parseEntitlementsPlist(
544-
path.join(electrobunDir, "entitlements/mas.entitlements"),
545-
)
546-
: {
547-
"com.apple.security.cs.allow-jit": true,
548-
"com.apple.security.cs.allow-unsigned-executable-memory": true,
549-
"com.apple.security.cs.disable-library-validation": true,
550-
"com.apple.security.network.client": true,
551-
"com.apple.security.network.server": true,
552-
"com.apple.security.files.user-selected.read-write": true,
553-
"com.apple.security.device.camera": true,
554-
"com.apple.security.device.microphone": true,
555-
"com.apple.security.device.screen-recording": true,
556-
"com.apple.security.personal-information.addressbook": true,
557-
"com.apple.security.personal-information.calendars": true,
558-
"com.apple.security.automation.apple-events": true,
559-
},
560-
},
561-
linux: {
562-
// Linux CEF remains opt-in until its helper processes are stable
563-
// enough for the default desktop shell.
564-
bundleCEF: linuxCefEnabled,
565-
bundleWGPU: true,
566-
defaultRenderer: "native",
567-
icon: "assets/appIcon.png",
568-
chromiumFlags: linuxCefEnabled ? linuxCefChromiumFlags() : {},
569-
},
570-
win: {
571-
bundleCEF: true,
572-
bundleWGPU: true,
573-
defaultRenderer: "cef",
574-
icon: "assets/appIcon.ico",
575-
chromiumFlags: chromiumFlags({
576-
"enable-unsafe-webgpu": true,
577-
"enable-features": "Vulkan",
578-
"in-process-gpu": true,
579-
"disable-gpu-sandbox": true,
580-
"no-sandbox": true,
581-
}),
582-
},
583-
},
584-
...(releaseUrl
585-
? {
586-
release: {
587-
baseUrl: releaseUrl,
588-
generatePatch: true,
589-
},
590-
}
591-
: {}),
592-
} satisfies ElectrobunConfig;
435+
return {
436+
app: {
437+
name: appName,
438+
identifier: appId,
439+
version: appVersion,
440+
description: "AI agents for the desktop",
441+
urlSchemes: [urlScheme],
442+
},
443+
runtime: {
444+
exitOnLastWindowClosed: false,
445+
},
446+
scripts: {
447+
// Electrobun removes the target build folder without `force: true`;
448+
// seed it first so clean worktrees do not fail with ENOENT.
449+
preBuild: "scripts/ensure-build-folder.ts",
450+
// Sign native code inside the runtime dist node_modules on the inner app bundle
451+
// before Electrobun runs the platform signing/notarization flow.
452+
postBuild: "scripts/postwrap-sign-runtime-macos.ts",
453+
// Capture wrapper-bundle binary metadata after the self-extractor is created.
454+
postWrap: "scripts/postwrap-diagnostics.ts",
455+
},
456+
build: {
457+
bun: {
458+
entrypoint: "src/index.ts",
459+
// The Electrobun bun process is a thin native shell — it creates
460+
// windows, dispatches RPCs to the renderer, and manages the embedded
461+
// API subprocess (or talks to an external API). It must NOT bundle
462+
// the agent runtime, plugins, database, or ML stacks — those belong
463+
// in the API subprocess. Any of these reaching the Electrobun bun
464+
// bundle is a sign of an unintended import edge; either cut the edge
465+
// or extend this list.
466+
external: [
467+
// Agent runtime packages — used only via type imports in the bun
468+
// src, but workspace TS resolution can drag the source graph in.
469+
"@elizaos/core",
470+
"@elizaos/agent",
471+
"@elizaos/app-core",
472+
// Plugins — initialized by the API subprocess, never the bun shell.
473+
"@elizaos/plugin-sql",
474+
"@elizaos/plugin-local-inference",
475+
"@elizaos/plugin-local-inference",
476+
// Database stack pulled in by plugin-sql.
477+
"@electric-sql/pglite",
478+
"drizzle-orm",
479+
"pg",
480+
// Native ML/embedding packages ship platform-specific bindings via
481+
// relative require()s or per-platform sibling packages; bundling
482+
// them breaks those paths.
483+
"node-llama-cpp",
484+
"@node-llama-cpp/*",
485+
"onnxruntime-node",
486+
"onnxruntime-common",
487+
"onnxruntime-web",
488+
// chalk is pulled in transitively via @elizaos/shared/dist/terminal/theme.js.
489+
// The Electrobun bun shell never renders to a TTY, so this branch is dead at
490+
// runtime — externalising it just keeps the bundler from trying to resolve it.
491+
"chalk",
492+
],
493+
},
494+
views: {},
495+
// Watch these extra dirs in dev --watch mode so changes to the Vite
496+
// renderer build or shared types trigger a bun-side rebuild + relaunch.
497+
watch: ["../dist", "src/shared/", "src/bridge/"],
498+
// Ignore test files and build artifacts from watch triggers.
499+
watchIgnore: [
500+
"src/**/*.test.ts",
501+
"src/**/*.spec.ts",
502+
"artifacts/",
503+
"build/",
504+
],
505+
// Desktop intentionally supports both WebGPU paths:
506+
// 1. renderer-webview WebGPU (`three/webgpu` via browser `navigator.gpu`)
507+
// 2. Electrobun-native Dawn for Bun-side GpuWindow / <electrobun-wgpu>
508+
// surfaces and future native compute workloads.
509+
copy: {
510+
...resolveElectrobunCopyMap({
511+
buildVariant,
512+
runtimeDistDir,
513+
embedRuntime,
514+
}),
515+
[brandConfigCopySource]: "brand-config.json",
516+
...(process.platform === "darwin" &&
517+
fs.existsSync(libMacWindowEffectsDylib)
518+
? { "src/libMacWindowEffects.dylib": "libMacWindowEffects.dylib" }
519+
: {}),
520+
},
521+
mac: {
522+
bundleWGPU: true,
523+
codesign: process.env.ELECTROBUN_SKIP_CODESIGN !== "1",
524+
notarize:
525+
process.env.ELECTROBUN_SKIP_CODESIGN !== "1" &&
526+
process.env.ELIZA_ELECTROBUN_NOTARIZE !== "0",
527+
defaultRenderer: "native",
528+
...(useMacIconsetBuild ? { icons: "assets/appIcon.iconset" } : {}),
529+
// Entitlements are selected by the ELIZA_BUILD_VARIANT axis:
530+
// - "store": parsed from entitlements/mas.entitlements; turns on
531+
// com.apple.security.app-sandbox for Mac App Store distribution.
532+
// - "direct" (default): inline hardened-runtime entitlements with
533+
// no sandbox — current behavior for direct downloads.
534+
//
535+
// Child-process entitlements (mas-child.entitlements with
536+
// com.apple.security.inherit) are applied after this packaging
537+
// step by codesign-mas.mjs, which walks the bundle bottom-up.
538+
// See scripts/codesign-mas.mjs. Set ELIZA_MAS_SIGNING_IDENTITY
539+
// in the build env (and optionally ELIZA_MAS_INSTALLER_IDENTITY
540+
// for productbuild).
541+
entitlements:
542+
buildVariant === "store"
543+
? parseEntitlementsPlist(
544+
path.join(electrobunDir, "entitlements/mas.entitlements"),
545+
)
546+
: {
547+
"com.apple.security.cs.allow-jit": true,
548+
"com.apple.security.cs.allow-unsigned-executable-memory": true,
549+
"com.apple.security.cs.disable-library-validation": true,
550+
"com.apple.security.network.client": true,
551+
"com.apple.security.network.server": true,
552+
"com.apple.security.files.user-selected.read-write": true,
553+
"com.apple.security.device.camera": true,
554+
"com.apple.security.device.microphone": true,
555+
"com.apple.security.device.screen-recording": true,
556+
"com.apple.security.personal-information.addressbook": true,
557+
"com.apple.security.personal-information.calendars": true,
558+
"com.apple.security.automation.apple-events": true,
559+
},
560+
},
561+
linux: {
562+
// Linux CEF remains opt-in until its helper processes are stable
563+
// enough for the default desktop shell.
564+
bundleCEF: linuxCefEnabled,
565+
bundleWGPU: true,
566+
defaultRenderer: "native",
567+
icon: "assets/appIcon.png",
568+
chromiumFlags: linuxCefEnabled ? linuxCefChromiumFlags() : {},
569+
},
570+
win: {
571+
bundleCEF: true,
572+
bundleWGPU: true,
573+
defaultRenderer: "cef",
574+
icon: "assets/appIcon.ico",
575+
chromiumFlags: chromiumFlags({
576+
"enable-unsafe-webgpu": true,
577+
"enable-features": "Vulkan",
578+
"in-process-gpu": true,
579+
"disable-gpu-sandbox": true,
580+
"no-sandbox": true,
581+
}),
582+
},
583+
},
584+
...(releaseUrl
585+
? {
586+
release: {
587+
baseUrl: releaseUrl,
588+
generatePatch: true,
589+
},
590+
}
591+
: {}),
592+
} satisfies ElectrobunConfig;
593593
}
594594

595595
export default createElectrobunConfig();

packages/app-core/scripts/assert-required-bundled-packages.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,9 @@ describe("assertRequiredBundledPackagesLanded", () => {
329329
),
330330
);
331331

332-
expect(getRuntimeDependencies(path.join(packageRoot, "package.json"))).toEqual([
333-
"lucide-react",
334-
]);
332+
expect(
333+
getRuntimeDependencies(path.join(packageRoot, "package.json")),
334+
).toEqual(["lucide-react"]);
335335
});
336336

337337
it("hoists Solana packages when a compatible top-level copy exists", () => {

packages/app-core/scripts/copy-runtime-node-modules.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,8 +1422,8 @@ function hasRootPackageOverride(name: string): boolean {
14221422
resolutions?: Record<string, unknown>;
14231423
}>(PACKAGE_JSON_PATH);
14241424
return (
1425-
Object.prototype.hasOwnProperty.call(manifest.overrides ?? {}, name) ||
1426-
Object.prototype.hasOwnProperty.call(manifest.resolutions ?? {}, name)
1425+
Object.hasOwn(manifest.overrides ?? {}, name) ||
1426+
Object.hasOwn(manifest.resolutions ?? {}, name)
14271427
);
14281428
} catch {
14291429
return false;
@@ -1740,7 +1740,9 @@ function collectRuntimeExportEntryPaths(value: unknown): string[] {
17401740
([key]) => key === "." || key.startsWith("./"),
17411741
);
17421742
if (hasSubpathKeys) {
1743-
return entries.flatMap(([, entry]) => collectRuntimeExportEntryPaths(entry));
1743+
return entries.flatMap(([, entry]) =>
1744+
collectRuntimeExportEntryPaths(entry),
1745+
);
17441746
}
17451747

17461748
return entries.flatMap(([condition, entry]) => {

0 commit comments

Comments
 (0)