From a9ca887e437e9217d295319e6dc0f878c2cffbdc Mon Sep 17 00:00:00 2001 From: Nathan Flurry Date: Fri, 3 Jul 2026 22:40:08 -0700 Subject: [PATCH] fix(toolchain,ci): pack agent bin at real entry file; fix crates.io base-filesystem path --- .github/workflows/publish.yaml | 7 +++++-- packages/agentos-toolchain/src/pack.ts | 19 +++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index f4e4eb071..3399c8aad 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -431,8 +431,11 @@ jobs: done git add -f crates/execution/assets/generated crates/v8-runtime/assets/generated mkdir -p crates/kernel/assets crates/sidecar/assets - cp packages/core/fixtures/base-filesystem.json crates/kernel/assets/base-filesystem.json - cp packages/core/fixtures/base-filesystem.json crates/sidecar/assets/base-filesystem.json + # The single committed base filesystem lives in the vfs crate (the vfs + # crate embeds it via include_str!); the old packages/core/fixtures/ + # path no longer exists, which broke this crates.io publish job. + cp crates/vfs/assets/base-filesystem.json crates/kernel/assets/base-filesystem.json + cp crates/vfs/assets/base-filesystem.json crates/sidecar/assets/base-filesystem.json - name: Dry-run crate publish if: ${{ needs.context.outputs.trigger != 'release' }} run: | diff --git a/packages/agentos-toolchain/src/pack.ts b/packages/agentos-toolchain/src/pack.ts index 2086170b8..e73df20ec 100644 --- a/packages/agentos-toolchain/src/pack.ts +++ b/packages/agentos-toolchain/src/pack.ts @@ -284,11 +284,18 @@ export function pack(options: PackOptions): PackResult { cpSync(join(tmp, "node_modules"), join(packageDir, "node_modules"), { recursive: true, }); - // bin/ → ../node_modules// (relative symlink; node resolves - // deps from the realpath's node_modules). + // The sidecar resolves each command from the root package.json "bin" map to + // its REAL entry file in the packed closure (see package_projection + // binEntries) — it must NOT rely on `bin/` symlinks: npm/pnpm publish + // DROP symlinks, so a `bin/` symlink vanishes from the published tarball + // and the sidecar can't project the entrypoint (the adapter then resolves to + // `/unknown/`). So point `bin` at the real relative entry path; also keep + // a `bin/` symlink for local `$PATH`/dev use (harmless if published away). const closureModules = join(packageDir, "node_modules"); + const binMap: Record = {}; for (const [cmd, entryRel] of Object.entries(bins)) { const targetAbs = resolveBinTarget(closureModules, name, entryRel); + binMap[cmd] = relative(packageDir, targetAbs).split(/[\\/]/).join("/"); symlinkSync(relative(binDir, targetAbs), join(binDir, cmd)); } if (pruneNative) { @@ -306,12 +313,8 @@ export function pack(options: PackOptions): PackResult { } // Write a normal root package.json {name, version, bin}. The sidecar reads - // `version` and commands from here; JSON package metadata lives in - // agentos-package.json next to it. - const binMap: Record = {}; - for (const cmd of commands) { - binMap[cmd] = `bin/${cmd}`; - } + // `version` and commands from here (bin map → real entry file, built above); + // JSON package metadata lives in agentos-package.json next to it. writeFileSync( join(packageDir, "package.json"), `${JSON.stringify({ name, version, bin: binMap }, null, 2)}\n`,