sandbox-agent/research/specs/tui-control-flow.md
2026-02-04 13:45:31 -08:00

32 lines
1.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Spec: TUI Control Flow
**Proposed API Changes**
- Add a TUI control queue and state machine to the core session manager.
- Expose request/response transport for OpenCode TUI controls.
**Summary**
OpenCodes TUI endpoints allow a remote controller to drive the UI. We need a server-side queue for control messages and a way to emit responses.
**OpenCode Endpoints (Reference)**
- `GET /opencode/tui/control/next`
- `POST /opencode/tui/control/response`
- `POST /opencode/tui/append-prompt`
- `POST /opencode/tui/clear-prompt`
- `POST /opencode/tui/execute-command`
- `POST /opencode/tui/open-help`
- `POST /opencode/tui/open-models`
- `POST /opencode/tui/open-sessions`
- `POST /opencode/tui/open-themes`
- `POST /opencode/tui/publish`
- `POST /opencode/tui/select-session`
- `POST /opencode/tui/show-toast`
- `POST /opencode/tui/submit-prompt`
**Core Functionality Required**
- Persistent queue of pending UI control actions.
- Response correlation (request/response IDs).
- Optional integration with session events for UI feedback.
**OpenCode Compat Wiring + Tests**
- Replace stubs for all `/tui/*` endpoints.
- Add E2E tests for control queue ordering and response handling.