[PR #2719] wip: add /client to expose the TUI via HTTP #10422

Closed
opened 2026-02-16 18:15:04 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/2719

State: closed
Merged: No


This PR adds a /client and /ws endpoints to expose the TUI via HTTP, making it accessible from the browser and remotely using [Xterm](https://xtermjs.org/). The endpoint spawns a new TUI for each request via a PTY.

The implementation relies on bun-pty, but there was a small issue with environment variables, so I am using a slightly modified fork (https://github.com/CefBoud/bun-pty#feat-use-env) for now.

# Very much temporary workaround
cd path/to/opencode
cd ./node_modules/bun-pty/rust-pty && cargo build --release && cd -
# bun-pty might need an architecture-specific binary name; in my case, I am running:
cp ./node_modules/bun-pty/rust-pty/target/release/librust_pty.dylib ./node_modules/bun-pty/rust-pty/target/release/librust_pty_arm64.dylib

Then, run:

bun run dev --port 8080 --hostname 0.0.0.0

Head over to your browser at localhost:8080 or <IP>:8080, and the TUI will now be accessible remotely.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/2719 **State:** closed **Merged:** No --- This PR adds a `/client` and `/ws` endpoints to expose the TUI via HTTP, making it accessible from the browser and remotely using [[Xterm](https://xtermjs.org/)](https://xtermjs.org/). The endpoint spawns a new TUI for each request via a PTY. The implementation relies on `bun-pty`, but there was a small issue with environment variables, so I am using a slightly modified fork ([https://github.com/CefBoud/bun-pty#feat-use-env](https://github.com/CefBoud/bun-pty#feat-use-env)) for now. ``` # Very much temporary workaround cd path/to/opencode cd ./node_modules/bun-pty/rust-pty && cargo build --release && cd - # bun-pty might need an architecture-specific binary name; in my case, I am running: cp ./node_modules/bun-pty/rust-pty/target/release/librust_pty.dylib ./node_modules/bun-pty/rust-pty/target/release/librust_pty_arm64.dylib ``` Then, run: ``` bun run dev --port 8080 --hostname 0.0.0.0 ``` Head over to your browser at `localhost:8080` or `<IP>:8080`, and the TUI will now be accessible remotely. <img src="https://github.com/user-attachments/assets/ca18d34c-2657-47e1-af3e-c0ae2dafc013" width="300" height="175" style="display:inline-block; margin-right:10px;"> <img src="https://github.com/user-attachments/assets/119318d5-6b9d-47ca-94f3-63c6e9d1cacd" width="250" height="450" style="display:inline-block;">
yindo added the pull-request label 2026-02-16 18:15:04 -05:00
yindo closed this issue 2026-02-16 18:15:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10422