#ifndef LLSH_PROVIDER_H #define LLSH_PROVIDER_H #include #include "llm.h" #include "mcp.h" #include "session.h" /* The session-bound provider layer: implements the `llsh_model` vtable on * top of llm.h's protocol layer, wiring in the session (config, preamble, * allowed tools, .agents), the built-in + MCP tool registry, and the * session's emit callback. */ /* Which one-shot role this model serves. `complete` uses the matching * preamble; `stream` (the agent turn) always uses the session preamble. */ typedef enum { PROV_ROLE_MAIN = 0, PROV_ROLE_SUMMARIZER, PROV_ROLE_EVALUATOR, PROV_ROLE_RUBRIC, } provider_role; /* Create a session-bound model. `sess` may be NULL until * provider_model_attach; `mcp` may be NULL (no MCP tools). */ llsh_model *provider_model_new(session *sess, mcp_registry *mcp, provider_role role); void provider_model_attach(llsh_model *m, session *sess); /* Test hook: build the request body (without sending) for the session's * current config, preamble, and tool set, for a single one-shot prompt. * Caller frees the returned string. */ char *provider_preview_request(session *sess, const char *prompt, bool with_tools); /* On stop, an assistant message can carry more tool calls than the * tool-result messages that follow it (we stopped mid-loop). Trim the * surplus calls so the committed history stays a valid request. */ void provider_trim_dangling_calls(message *msgs, size_t n); #endif /* LLSH_PROVIDER_H */