Repository navigation
feat: add a runtime Towerfile field and a bun runtime - #380
Open
migueltheduck wants to merge 3 commits into
Open
migueltheduck wants to merge 3 commits into
migueltheduck wants to merge 3 commits into
Conversation
Pre-merge checks:
|
Contributor
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
bradhe
approved these changes
Nov 11, 2026
Comment on lines
198
to
221
| @@ -206,6 +219,38 @@ async fn inner_execute_local_app( | |||
| return Err(Error::Cancelled); | |||
| } | |||
| Ok(code) | |||
Contributor
There was a problem hiding this comment.
We probably want to remove this.
Author
There was a problem hiding this comment.
Agreed, but leaving it out of this PR.
`[app] runtime` declares what starts the script: python (uv) or bun. It is copied into the MANIFEST only when set, so existing bundles are unchanged, and apps without it run exactly as before. The manifest keeps the value as a string, so a runtime this version doesn't know still parses and fails the run with UnsupportedRuntime instead. Bun apps run `bun install` (frozen when there's a lockfile) when they have a package.json, on the setup channel, then `bun run` on the script. Like uv, bun runs in its own process group and with a cleared environment in protected mode, and installs into the runtime's cache dir when it has one. Bun scripts must be JavaScript or TypeScript, and import_paths aren't supported with bun yet. The packager now leaves node_modules out of bundles, and the MCP tower_file_update tool and the agent skill cover the new key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The runtime puts a bun app's import paths on NODE_PATH, as it puts a Python app's on PYTHONPATH, so `import_paths = ["../shared"]` makes `../shared/helpers.ts` importable as "helpers". Shared code is packaged under modules/, outside the app directory, so it never walks up into the app's node_modules. Bun would then quietly auto-install the latest version of whatever the shared code imports. The app's node_modules goes on NODE_PATH after the import paths, so shared code gets the versions the app pinned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tower_file_generate still reads pyproject.toml when there is one. Without it, it reads package.json and writes a bun Towerfile: the name without its npm scope, and the script from `module` (what `bun init` writes), `main` or the `start` script, then common entry points. A `main` that names a build output that doesn't exist yet is skipped. The workflow help and the skill gain a `bun init -y` step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
migueltheduck
force-pushed
the
feat/bun-runtime
branch
from
November 11, 2026 17:56
ab44d5b to
f0c5330
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The runtime starts every app with uv, so there's no way to run a JavaScript or TypeScript app. The bundle also doesn't say which runtime an app needs, so the server can't send its runs to a runner that has it.
What
[app] runtime:pythonorbun. Other values are rejected,bashincluded, and bun needs a JavaScript or TypeScript script. Without the field, apps run as before.UnsupportedRuntimeinstead of failing to parse.package.json,bun installruns first, frozen when there's a lockfile. Thenbun run <script>runs in its own process group, with a cleared environment in protected mode, like uv. If bun isn't installed, the run fails withMissingBun.import_pathsgo onNODE_PATH, as Python's go onPYTHONPATH, so../shared/helpers.tsis imported as"helpers". The app'snode_modulesgoes on it too, so shared code gets the versions the app pinned; otherwise bun would quietly auto-install the latest.node_modulesout of bundles, as it does.venv.tower_file_updatetakesruntime.pyproject.toml,tower_file_generatewrites a bun Towerfile frompackage.json. It takes the script frommodule,mainor thestartscript, then falls back to common entry points.bun init.Compatibility
Apps that don't set
runtimeare unaffected: no new key in the MANIFEST, still version 3, and the same runtime choice as before. Servers and runners that don't know the key ignore it.tower_file_generatestill preferspyproject.toml; with nopyproject.tomland nopackage.json, the error now names both files.