3 releases (breaking)
Uses new Rust 2024
| 0.3.0 | Jan 8, 2026 |
|---|---|
| 0.2.0 | Dec 5, 2025 |
| 0.1.0 | Nov 2, 2025 |
#7 in #content-block
Used in 4 crates
99KB
2K
SLoC
Shared protocol types and definitions for TurboClaude REST and Agent SDKs
This crate provides the core type definitions and protocol structures used by both the REST client (turboclaude) and the Agent client (turboclaudeagent). By centralizing these types, we achieve DRY principles and ensure consistency across the ecosystem.
Type Organization
- Content types:
content- Text, images, tool use/results - Message types:
message- Messages, content blocks - Common types:
types- Models, usage, cache info - Agent protocol:
agent- Control requests, hooks, permissions - Error types:
error- Protocol and message errors
Design Principles
- Zero I/O: All types are pure data structures
- Serialization: serde-based for both JSON and future formats
- Idiomatic Rust: Owned types,
Result<T>for errors,Option<T>for optional values - No circular dependencies: turboclaude-protocol depends only on serde/chrono
Usage
use turboclaude_protocol::message::Message;
use turboclaude_protocol::content::ContentBlock;
let msg = Message {
id: "msg_123".to_string(),
content: vec![ContentBlock::Text { text: "Hello".to_string() }],
// ...
};
TurboClaude Protocol
Type definitions and protocol structures for Claude API communication.
Features
- Message types and request/response structures
- Content blocks (text, images, documents, tool use)
- Tool definitions and function calling specs
- Agent types (hooks, permissions, routing)
- Streaming event types
- Type-safe Rust definitions
Testing
cargo test
Documentation
cargo doc --open for full API documentation
Dependencies
~3.5–5.5MB
~101K SLoC