Tier 0 of Bun-app support (driver: opencode, the Bun-platform TUI target). Exhaustive first-party usage across opencode's product packages (opencode/core/tui/ui/server/client/sdk/plugin/protocol/schema/llm/codemode/session-ui, src, non-test):
| API |
sites |
notes |
Bun.stringWidth(str) |
25 (opencode 20, tui 5) |
terminal cell width; east-asian-width + ANSI handling. Perry-native impl is also reusable for pi-tui (pi/kimi both bundle get-east-asian-width) |
Bun.stdin.text() |
2 (cli/cmd/tui.ts:60, cli/cmd/run.ts:416) |
read-all of piped stdin |
Bun.file(path) |
2 (tui) |
lazy file handle; only .text()/.arrayBuffer()/.exists()-class usage |
Bun.write(dest, data) |
2 (tui) |
file/stdout write |
Bun.hash(str) |
1 (core/src/skill/discovery.ts:113) |
cache-dir key via .toString(16); algorithm is wyhash — matching the algo keeps cache dirs compatible with bun-run installs, any stable hash is otherwise fine |
import { pathToFileURL, fileURLToPath } from "bun" |
3 (tui, opencode) |
identical semantics to node:url — module-level alias |
import type { SystemError } from "bun" |
1 |
type-only, erased at build |
Also worth registering while in here: Bun.Glob (used in opencode build scripts, common in the ecosystem) — optional.
Notable absences in opencode's product code (verified): no Bun.serve (HTTP is effect HttpRouter.serve over @effect/platform-node → node:http), no Bun.spawn (cross-spawn/child_process), no Bun.env, no $ shell at runtime, no Workers in the TUI path. The bun:sqlite / bun:ffi / pty surfaces are tracked separately — this issue is only the cheap global shim pack.
Acceptance: a compiled app using the table above resolves every call with node-identical observable behavior; bun-suite gains coverage for each shim.
Tier 0 of Bun-app support (driver: opencode, the Bun-platform TUI target). Exhaustive first-party usage across opencode's product packages (opencode/core/tui/ui/server/client/sdk/plugin/protocol/schema/llm/codemode/session-ui, src, non-test):
Bun.stringWidth(str)get-east-asian-width)Bun.stdin.text()cli/cmd/tui.ts:60,cli/cmd/run.ts:416)Bun.file(path).text()/.arrayBuffer()/.exists()-class usageBun.write(dest, data)Bun.hash(str)core/src/skill/discovery.ts:113).toString(16); algorithm is wyhash — matching the algo keeps cache dirs compatible with bun-run installs, any stable hash is otherwise fineimport { pathToFileURL, fileURLToPath } from "bun"node:url— module-level aliasimport type { SystemError } from "bun"Also worth registering while in here:
Bun.Glob(used in opencode build scripts, common in the ecosystem) — optional.Notable absences in opencode's product code (verified): no
Bun.serve(HTTP is effectHttpRouter.serveover@effect/platform-node→node:http), noBun.spawn(cross-spawn/child_process), noBun.env, no$shell at runtime, no Workers in the TUI path. Thebun:sqlite/bun:ffi/ pty surfaces are tracked separately — this issue is only the cheap global shim pack.Acceptance: a compiled app using the table above resolves every call with node-identical observable behavior;
bun-suitegains coverage for each shim.