TUI communication routes. Architecture note: In the TypeScript version the TUI (Ink/React) runs as a separate process and communicates with the backend exclusively over HTTP. The Rust TUI (`opencode-tui`) uses ratatui/crossterm and runs in its own binary, but still talks to the server through an HTTP `ApiClient`. These endpoints therefore remain necessary -- they bridge external TUI requests int
()
| 3683 | /// The `/set-prompt` endpoint is a Rust-only addition (not present in the TS |
| 3684 | /// codebase) that allows overwriting the prompt text rather than appending. |
| 3685 | fn tui_routes() -> Router<Arc<ServerState>> { |
| 3686 | Router::new() |
| 3687 | .route("/append-prompt", post(append_prompt)) |
| 3688 | .route("/set-prompt", post(set_prompt)) |
| 3689 | .route("/submit-prompt", post(submit_prompt)) |
| 3690 | .route("/clear-prompt", post(clear_prompt)) |
| 3691 | .route("/open-help", post(open_help)) |
| 3692 | .route("/open-sessions", post(open_sessions)) |
| 3693 | .route("/open-themes", post(open_themes)) |
| 3694 | .route("/open-models", post(open_models)) |
| 3695 | .route("/execute-command", post(execute_tui_command)) |
| 3696 | .route("/show-toast", post(show_toast)) |
| 3697 | .route("/publish", post(publish_tui_event)) |
| 3698 | .route("/select-session", post(select_session)) |
| 3699 | .route("/control/next", get(get_next_tui_request)) |
| 3700 | .route("/control/response", post(submit_tui_response)) |
| 3701 | } |
| 3702 | |
| 3703 | #[derive(Debug, Deserialize)] |
| 3704 | pub struct PromptRequest { |