Skip to main content

mermaid_cli/providers/
mod.rs

1//! Provider-facing traits: `ModelProvider` + `ToolExecutor`.
2//!
3//! This module is the boundary between "inert data the reducer
4//! produces" and "real I/O the effect runner performs." Concrete
5//! provider adapters (Ollama, Anthropic, Gemini, OpenAI-compat) live
6//! under `model/`; tool implementations live under `tool/`.
7//!
8//! The goal is that adding a provider or tool touches exactly one
9//! file — no observer plumbing, no dispatch wiring, no adapter-
10//! specific retry logic. The traits carry the full surface; the
11//! effect runner just looks up an impl and calls it.
12
13pub mod capabilities;
14pub mod ctx;
15pub mod factory;
16pub mod model;
17pub mod tool;
18
19pub use capabilities::Capabilities;
20pub use ctx::{
21    ExecContext, FinalResponse, ProgressEvent, StreamContext, StreamEvent, SubagentPhase,
22    clone_messages, test_exec_context, test_stream_context,
23};
24pub use factory::ProviderFactory;
25pub use model::{
26    AnthropicProvider, GeminiProvider, ModelProvider, OllamaProvider, OpenAICompatProvider,
27};
28pub use tool::{ToolExecutor, ToolRegistry, TuiMode};
29
30#[cfg(test)]
31mod tests {
32    use super::*;
33
34    #[test]
35    fn trait_is_object_safe() {
36        // Compile-time guard: `dyn ModelProvider` must stay
37        // object-safe so `ProviderFactory` can hand out
38        // `Arc<dyn ModelProvider>`.
39        fn _assert(_: &dyn ModelProvider) {}
40    }
41}