build(coding-agent): prevented embedding native runtime dependencies

- Standardized `fastembed` and `onnxruntime-node` as external dependencies for all compiled binaries.
- Removed manual exclusion logic from individual build scripts in favor of a centralized configuration.
- Updated release build dry-run output to reflect consistent external dependency handling.

Fixes #5195
This commit is contained in:
can1357
2026-07-11 20:35:02 +02:00
parent 3d1f9a4a3c
commit 4181ef18b5
5 changed files with 13 additions and 6 deletions
+4
View File
@@ -2,6 +2,10 @@
## [Unreleased]
### Fixed
- Fixed compiled release binaries bundling `fastembed` and baking the build-machine `@anush008/tokenizers` path; native runtime dependencies now stay external for every compiled build path so Mnemopi resolves its on-demand install instead. ([#5195](https://github.com/can1357/oh-my-pi/issues/5195))
## [16.4.5] - 2026-07-11
### Breaking Changes
@@ -99,7 +99,6 @@ async function main(): Promise<void> {
outfile: outputPath,
transformersVersion,
target: crossBuild?.target,
external: ["fastembed", "onnxruntime-node"],
skipBuiltinCodesign: shouldAdhocSignDarwinBinary(crossBuild),
});
@@ -1,6 +1,9 @@
import { buildDocsIndexPayload } from "./generate-docs-index";
import { createLegacyPiVirtualModulePlugin } from "./legacy-pi-virtual-module";
/** Native runtime dependencies always resolved from the on-demand install instead of embedded into compiled binaries. */
export const COMPILED_EXTERNAL_DEPENDENCIES: readonly string[] = Object.freeze(["fastembed", "onnxruntime-node"]);
/** Inputs shared by local and release coding-agent binary builds. */
export interface CodingAgentCompileOptions {
/** Absolute repository root used for package resolution. */
@@ -13,8 +16,6 @@ export interface CodingAgentCompileOptions {
readonly transformersVersion: string;
/** Optional cross-compilation runtime target. */
readonly target?: Bun.Build.CompileTarget;
/** Dependencies intentionally resolved from the runtime filesystem. */
readonly external?: readonly string[];
/** Match release builds that minify identifiers while retaining names. */
readonly minifyIdentifiers?: boolean;
/** Disable Bun's built-in Darwin signing before the caller re-signs. */
@@ -34,7 +35,7 @@ export async function compileCodingAgent(options: CodingAgentCompileOptions): Pr
const output = await Bun.build({
entrypoints: [options.entrypoint],
root: options.repoRoot,
external: options.external ? [...options.external] : undefined,
external: [...COMPILED_EXTERNAL_DEPENDENCIES],
define: {
"process.env.PI_COMPILED": JSON.stringify("true"),
"process.env.PI_TINY_TRANSFORMERS_VERSION": JSON.stringify(options.transformersVersion),
@@ -18,6 +18,7 @@ describe("Windows release binary target", () => {
expect(output).toContain(
"DRY RUN Bun.build target=bun-windows-x64-baseline outfile=packages/coding-agent/binaries/omp-windows-x64.exe",
);
expect(output).toContain("external=fastembed,onnxruntime-node");
expect(output).not.toContain("bun-windows-x64-modern");
});
+4 -2
View File
@@ -3,7 +3,7 @@
import * as fs from "node:fs/promises";
import { createRequire } from "node:module";
import * as path from "node:path";
import { compileCodingAgent } from "../packages/coding-agent/scripts/compile-binary";
import { COMPILED_EXTERNAL_DEPENDENCIES, compileCodingAgent } from "../packages/coding-agent/scripts/compile-binary";
interface BinaryTarget {
id: string;
@@ -121,7 +121,9 @@ async function buildBinary(target: BinaryTarget): Promise<void> {
console.log(`Building ${target.outfile}...`);
await embedNative(target);
if (isDryRun) {
console.log(`DRY RUN Bun.build target=${target.target} outfile=${target.outfile}`);
console.log(
`DRY RUN Bun.build target=${target.target} outfile=${target.outfile} external=${COMPILED_EXTERNAL_DEPENDENCIES.join(",")}`,
);
return;
}