#ifndef CST_WEBUI_H #define CST_WEBUI_H /* Engine HTTP + SSE API (--web): remote mirror of cst_agent_hooks_t. * * The turn runs on a worker thread; every live hook fires a Server-Sent * Event. Protocol: docs/webui.md / docs/webui-schema.md (cst-webui/1). * The binary embeds a minimal health page; a full SPA lives under * archive/web-spa (use --web-dev). */ #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 static files from DIR instead of the embedded health page (development / archived SPA) */ 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 */