opencode icon indicating copy to clipboard operation
opencode copied to clipboard

How to debug server (worker) code?

Open linchen1987 opened this issue 1 day ago • 1 comments

Question

I can debug TUI code in two ways:

1 bun run --cwd packages/opencode --conditions=browser --inspect src/index.ts

--------------------- Bun Inspector ---------------------
Listening:
  ws://localhost:6499/arzcsfu03h5
Inspect in browser:
  https://debug.bun.sh/#localhost:6499/arzcsfu03h5
--------------------- Bun Inspector ---------------------

2 bun run --cwd packages/opencode --conditions=browser src/index.ts in "JavaScript Debug Terminal" in VsCode

Image

However, I don't know how to debug the code in worker.js (/packages/opencode/src/cli/cmd/tui/worker.ts) because the server runs in a separate thread.

What's the recommended method for debugging the server code?

linchen1987 avatar Jan 16 '26 15:01 linchen1987