mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 13:03:46 +00:00
2 KiB
2 KiB
OpenCode TUI Test Plan (Tmux)
This plan captures OpenCode TUI output and sends input via tmux so we can validate /opencode end-to-end.
Prereqs
opencodeinstalled and on PATH.tmuxinstalled (e.g.,/home/linuxbrew/.linuxbrew/bin/tmux).- Local sandbox-agent binary built.
Environment
SANDBOX_AGENT_LOG_DIR=/pathto set server log dirSANDBOX_AGENT_LOG_STDOUT=1to keep logs on stdout/stderrSANDBOX_AGENT_LOG_HTTP=0to disable request logsSANDBOX_AGENT_LOG_HTTP_HEADERS=1to include request headers (Authorization redacted)RUST_LOG=...for trace filtering
Steps
- Build and run the server using the local binary:
SANDBOX_AGENT_SKIP_INSPECTOR=1 cargo build -p sandbox-agent SANDBOX_AGENT_LOG_HTTP_HEADERS=1 ./target/debug/sandbox-agent server \ --host 127.0.0.1 --port 2468 --token "$TOKEN" - Create a session via the OpenCode API:
SESSION_JSON=$(curl -sS -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{}' \ http://127.0.0.1:2468/opencode/session) SESSION_ID=$(node -e "const v=JSON.parse(process.env.SESSION_JSON||'{}');process.stdout.write(v.id||'');") - Start the OpenCode TUI in tmux:
tmux new-session -d -s opencode \ "opencode attach http://127.0.0.1:2468/opencode --session $SESSION_ID --password $TOKEN" - Send a prompt:
tmux send-keys -t opencode:0.0 "hello" C-m - Capture output:
tmux capture-pane -pt opencode:0.0 -S -200 > /tmp/opencode-screen.txt - Inspect server logs for requests:
tail -n 200 ~/.local/share/sandbox-agent/logs/log-$(date +%m-%d-%y) - Repeat after adjusting
/opencodestubs until the TUI displays responses.
Notes
- Tmux captures terminal output only. GUI outputs require screenshots or logs.
- If OpenCode connects to another host/port, logs will show no requests.
- If the prompt stays in the input box, use
C-mto submit (plainEntermay not trigger send in tmux).