diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 30fc7c72b..b38f337ee 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -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 diff --git a/packages/coding-agent/scripts/build-binary.ts b/packages/coding-agent/scripts/build-binary.ts index 221ade91c..1fb51fcfa 100644 --- a/packages/coding-agent/scripts/build-binary.ts +++ b/packages/coding-agent/scripts/build-binary.ts @@ -99,7 +99,6 @@ async function main(): Promise { outfile: outputPath, transformersVersion, target: crossBuild?.target, - external: ["fastembed", "onnxruntime-node"], skipBuiltinCodesign: shouldAdhocSignDarwinBinary(crossBuild), }); diff --git a/packages/coding-agent/scripts/compile-binary.ts b/packages/coding-agent/scripts/compile-binary.ts index 5e7d27710..495612041 100644 --- a/packages/coding-agent/scripts/compile-binary.ts +++ b/packages/coding-agent/scripts/compile-binary.ts @@ -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), diff --git a/scripts/ci-release-build-binaries.test.ts b/scripts/ci-release-build-binaries.test.ts index 19cb6583b..7c65f5f17 100644 --- a/scripts/ci-release-build-binaries.test.ts +++ b/scripts/ci-release-build-binaries.test.ts @@ -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"); }); diff --git a/scripts/ci-release-build-binaries.ts b/scripts/ci-release-build-binaries.ts index bcae77ebb..e2dc67071 100644 --- a/scripts/ci-release-build-binaries.ts +++ b/scripts/ci-release-build-binaries.ts @@ -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 { 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; }