zeroclaw_api/lib.rs
1//! ZeroClaw API layer — trait definitions and shared types.
2//!
3//! This crate defines the fundamental abstractions that all ZeroClaw subsystems
4//! depend on. No implementations, no heavy dependencies. Every other crate in
5//! the workspace depends on this. The compiler enforces that no implementation
6//! crate can import another without going through these interfaces.
7//!
8//! ## Traits
9//! - [`model_provider::ModelProvider`] — LLM inference backends
10//! - [`channel::Channel`] — messaging platform integrations
11//! - [`tool::Tool`] — agent-callable capabilities
12//! - [`memory_traits::Memory`] — conversation memory backends
13//! - [`observability_traits::Observer`] — metrics and tracing
14//! - [`runtime_traits::RuntimeAdapter`] — execution environment adapters
15//! - [`peripherals_traits::Peripheral`] — hardware board integrations
16
17pub mod agent;
18pub mod attribution;
19pub mod channel;
20pub mod media;
21pub mod memory_traits;
22pub mod model_provider;
23pub mod observability_traits;
24pub mod peripherals_traits;
25pub mod runtime_traits;
26pub mod schema;
27pub mod session_keys;
28pub mod tool;
29pub mod vad;
30
31tokio::task_local! {
32 /// Current thread/sender ID for per-sender rate limiting.
33 /// Set by the agent loop, read by SecurityPolicy.
34 pub static TOOL_LOOP_THREAD_ID: Option<String>;
35
36 /// Override for tool choice mode, set by the agent loop.
37 /// Read by model_providers that support native tool calling.
38 pub static TOOL_CHOICE_OVERRIDE: Option<String>;
39
40 /// Session key for the currently active session.
41 /// Scoped by gateway and channel turns, read by SessionsCurrentTool.
42 pub static TOOL_LOOP_SESSION_KEY: Option<String>;
43
44 /// Native extended thinking parameters, set by the outer orchestration
45 /// functions and read by `run_tool_call_loop` when building `ChatRequest`.
46 pub static NATIVE_THINKING_OVERRIDE: Option<crate::model_provider::NativeThinkingParams>;
47}