#ifndef CST_WEBUI_H #define CST_WEBUI_H /* The built-in WebUI: an HTTP + SSE front end for one agent process. * * It is a second implementation of the same interface the TUI uses * (cst_agent_hooks_t), which is why the engine needs no changes: the turn * runs on a worker thread and every live event goes out as a Server-Sent * Event. The protocol is documented in docs/webui.md and is meant to be * the contract a dedicated client speaks later. */ #include "cst_agent.h" #include #ifdef __cplusplus extern "C" { #endif /* What --web listens on when --web-port/CST_WEB_PORT says nothing (the * README and --help quote this number, so keep them in sync). */ #define CST_WEBUI_DEFAULT_PORT 8787 typedef struct { const char *host; /* NULL = 127.0.0.1; "0.0.0.0" = every interface */ int port; /* 0 = pick a free port */ const char *token; /* NULL = generate one when needed */ const char *root; /* serve the UI from this directory instead of the copy embedded in the binary (development) */ int open_browser; /* best-effort xdg-open / open / start */ /* Prompt to run once at startup (--web -p ...); NULL = wait for the UI. */ const char *prompt; int perm_timeout_s; /* how long a permission question waits (0 = 600) */ } cst_webui_opts_t; /* Serve until interrupted (Ctrl+C) or the event stream asks to quit. * Returns the process exit code. */ int cst_webui_run(cst_agent_t *agent, const cst_webui_opts_t *opts); #ifdef __cplusplus } #endif #endif /* CST_WEBUI_H */