Skip to main content

Crate zeroclaw_api

Crate zeroclaw_api 

Source
Expand description

ZeroClaw API layer — trait definitions and shared types.

This crate defines the fundamental abstractions that all ZeroClaw subsystems depend on. No implementations, no heavy dependencies. Every other crate in the workspace depends on this. The compiler enforces that no implementation crate can import another without going through these interfaces.

§Traits

Modules§

agent
attribution
Alias-bound attribution surface used by every emission in the workspace. Each “thing” that participates in an event (channel, agent, tool, cron job, model provider, memory backend, peer group, skill bundle, MCP bundle, session) implements Attributable. Entry points open attribution_span!(thing) once at the start of their work; the LogCaptureLayer in zeroclaw-log walks the span scope and fills the typed attribution slots automatically.
channel
media
memory_traits
model_provider
observability_traits
peripherals_traits
Peripheral trait — hardware boards (STM32, RPi GPIO) that expose tools.
runtime_traits
schema
JSON Schema cleaning and validation for LLM tool-calling compatibility.
session_keys
Session key normalization shared across infra and memory backends.
tool
vad
Voice Activity Detection trait and event types.

Macros§

mock_tool_attribution
Bulk-impl Attributable for one or more Tool mock types in a test module. Every type gets Role::Tool(ToolKind::Plugin) and uses the mock’s own name() as the alias — sufficient for test scaffolding where individual kinds don’t matter.
tool_attribution
Boilerplate-collapsing macro: pair a concrete Tool impl with a matching Attributable impl that surfaces the supplied ToolKind and uses the tool’s name() as its alias.

Statics§

NATIVE_THINKING_OVERRIDE
Native extended thinking parameters, set by the outer orchestration functions and read by run_tool_call_loop when building ChatRequest.
TOOL_CHOICE_OVERRIDE
Override for tool choice mode, set by the agent loop. Read by model_providers that support native tool calling.
TOOL_LOOP_SESSION_KEY
Session key for the currently active session. Scoped by gateway and channel turns, read by SessionsCurrentTool.
TOOL_LOOP_THREAD_ID
Current thread/sender ID for per-sender rate limiting. Set by the agent loop, read by SecurityPolicy.