Load PTY adapter at runtime#1311
Merged
juliusmarminge merged 7 commits intopingdotgg:mainfrom Mar 23, 2026
Merged
Conversation
- Switch terminal PTY layer selection to dynamic imports - Avoid bundling the Bun adapter in Node-only runtimes
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Detect Bun at startup and select the matching Effect runtime layer - Keep the server entrypoint working in both Bun and Node environments
- Remove Bun runtime branching from `apps/server/src/index.ts` - Run the server with the Node platform layer and runtime
juliusmarminge
approved these changes
Mar 23, 2026
gabrielMalonso
pushed a commit
to gabrielMalonso/t3code
that referenced
this pull request
Mar 23, 2026
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Chrono-byte
pushed a commit
to Chrono-byte/t3code
that referenced
this pull request
Mar 24, 2026
Co-authored-by: Julius Marminge <julius0216@outlook.com>
aaditagrawal
added a commit
to aaditagrawal/t3code
that referenced
this pull request
Mar 24, 2026
4 tasks
ranvier2d2
added a commit
to ranvier2d2/t3code-OTP
that referenced
this pull request
Mar 24, 2026
Cherry-picked from pingdotgg/t3code@754cded2. Changes PTY adapter selection from static typeof-Bun check to runtime dynamic import. Renames exports to `layer` convention. Original authors: shivam, Julius Marminge
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.
What Changed
Updated the server PTY adapter wiring in
apps/server/src/serverLayers.tsto lazy-load the runtime-specific adapter instead of eagerly importing bothBunPTYandNodePTY.The server now:
process.versions.bun./terminal/Layers/BunPTYonly for Bun on non-Windows platforms./terminal/Layers/NodePTYfor Node and other fallback casesCloses #204
Closes ecatuogno1#23
Why
bunx t3should use the Bun terminal API path, whilenpx t3should use the Node PTY path. The previous implementation imported both adapters up front and only selected between them later, which made runtime-specific loading less explicit.This change makes PTY adapter resolution match the actual runtime in use and keeps Bun-only code out of the Node path and Node-only code out of the Bun path. It also aligns the PTY loading pattern with the existing runtime-specific lazy loading already used in the SQLite layer.
UI Changes
Not applicable.
Checklist
Note
Load PTY adapter via dynamic import at runtime instead of compile-time conditional
Bun/Node platform check inserverLayers.tswith amakeRuntimePtyAdapterLayerfunction that dynamically imports the correct PTY layer at runtime.LayerinBunPTY.tsandNodePTY.tsfromBunPtyAdapterLive/NodePtyAdapterLivetolayerto support the dynamic import pattern.npx t3) as an alternative.Macroscope summarized 73623d2.