Skip to content

fix(build): package bun runtime with cache-first strategy#1371

Merged
kaizhou-lab merged 20 commits intomainfrom
feat/package-bundled-bunx
Mar 18, 2026
Merged

fix(build): package bun runtime with cache-first strategy#1371
kaizhou-lab merged 20 commits intomainfrom
feat/package-bundled-bunx

Conversation

@loonghao
Copy link
Copy Markdown
Collaborator

@loonghao loonghao commented Mar 17, 2026

Summary

  • add a cache-first strategy for bundled bun runtime assets during build/packaging
  • enforce strict packaging policy: bundled bun files are copied only from the fixed cache directory
  • support cross-platform cache locations and platform-specific runtime artifacts

Behavior

  1. Check fixed cache directory for current <platform>-<arch> runtime
  2. If cache exists, copy directly from cache into resources/bundled-bun/...
  3. If cache is missing, download Bun runtime from official GitHub release assets into cache
  4. Copy from cache into packaging resources (packaging never copies from system bun paths)

Cross-platform cache location

  • Windows: %LOCALAPPDATA%/AionUi/cache/bundled-bun
  • macOS: ~/Library/Caches/AionUi/bundled-bun
  • Linux: ${XDG_CACHE_HOME:-~/.cache}/AionUi/bundled-bun
  • Optional override: AIONUI_BUN_CACHE_DIR

Version control

  • default runtime version: latest
  • optional pin: AIONUI_BUN_VERSION (e.g. 1.2.20 or v1.2.20)

What changed

  • update scripts/prepareBundledBun.js:
    • implement cache path resolution and validation
    • implement cache -> download fallback chain
    • remove direct system-path copy step from packaging flow
    • keep deterministic packaging by always copying from cache to resources
    • write manifest metadata: version, sourceType, cacheDir
  • update integration test tests/integration/bundled-bun-packaged.test.ts:
    • validate sourceType is only cache or download
    • validate runtime files and manifest integrity

Verification

  • packaging command:
    • node scripts/build-with-builder.js auto --win --x64 --dir
  • validated packaged output includes:
    • out/win-unpacked/resources/bundled-bun/win32-x64/bun.exe
    • out/win-unpacked/resources/bundled-bun/win32-x64/bunx.exe
    • out/win-unpacked/resources/bundled-bun/win32-x64/manifest.json
  • verified manifest contains strict cache metadata (sourceType=cache when cache is warm)
  • checks:
    • bunx tsc --noEmit
    • bun run test:integration -- tests/integration/bundled-bun-packaged.test.ts

Notes

  • this PR is focused on packaging/cache reliability only
  • runtime usage/management of ACP agents through bundled bunx remains in a follow-up PR

@loonghao loonghao force-pushed the feat/package-bundled-bunx branch from 00c0e72 to f4ac15b Compare March 17, 2026 12:12
@loonghao loonghao changed the title fix(build): ensure bun runtime is packaged and verified fix(build): package bun runtime with cache-first strategy Mar 17, 2026
@loonghao loonghao force-pushed the feat/package-bundled-bunx branch from e5334ea to daac111 Compare March 17, 2026 13:29
@kaizhou-lab kaizhou-lab merged commit 12a8fbc into main Mar 18, 2026
4 checks passed
@piorpua piorpua deleted the feat/package-bundled-bunx branch March 18, 2026 05:56
piorpua pushed a commit that referenced this pull request Mar 18, 2026
actions/checkout@v6 does not exist; the non-existent version caused the
entire pr-checks workflow to fail at load time (0s duration, no jobs
started), leaving the required Code Quality check permanently pending.

Regression introduced in ffcca5c (chore(ci): optimize pr checks and
add bun packaging coverage, merged via PR #1371).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants