1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//! # Claude Code Integration Layer
//!
//! Handles direct integration with Claude Code including rate limiting,
//! error recovery, context management, and usage tracking for efficient
//! and reliable LLM interactions.
//!
//! ## Core Components
//!
//! - **[`ClaudeCodeInterface`]**: Main interface for Claude Code interactions
//! - **`RateLimiter`**: Token bucket rate limiting with adaptive backoff
//! - **`ContextManager`**: Conversation context optimization and compression
//! - **`ErrorRecoveryManager`**: Circuit breaker and retry mechanisms
//! - **`UsageTracker`**: Cost tracking and performance analytics
//!
//! ## Key Features
//!
//! ### 🚦 Rate Limiting
//! - Token bucket algorithm for request and token rate limiting
//! - Adaptive exponential backoff with jitter
//! - Configurable burst allowance and backoff multipliers
//! - Automatic rate limit detection and handling
//!
//! ### 🧠 Context Management
//! - Intelligent conversation context optimization
//! - Automatic context compression when limits approached
//! - Relevance-based message filtering and summarization
//! - Configurable context window and history management
//!
//! ### 🛡️ Error Recovery
//! - Circuit breaker pattern for service protection
//! - Automatic retry with exponential backoff
//! - Graceful degradation on persistent failures
//! - Error classification and recovery strategies
//!
//! ### 📊 Usage Tracking
//! - Real-time token consumption monitoring
//! - Cost estimation and budget tracking
//! - Performance metrics and response time analytics
//! - Session-based usage aggregation
//!
//! ### 🔄 Session Management
//! - Connection pooling for efficient resource usage
//! - Session lifecycle management and cleanup
//! - Health monitoring and status reporting
//!
//! ## Example Usage
//!
//! ```rust,no_run
//! use aca::claude::{ClaudeCodeInterface, ClaudeConfig, TaskRequest, TaskPriority};
//! use std::collections::HashMap;
//!
//! #[tokio::main]
//! async fn main() -> anyhow::Result<()> {
//! // Configure Claude interface
//! let config = ClaudeConfig::default();
//! let claude = ClaudeCodeInterface::new(config).await?;
//!
//! // Create a task request
//! let request = TaskRequest {
//! id: uuid::Uuid::new_v4(),
//! task_type: "code_generation".to_string(),
//! description: "Create a REST API endpoint".to_string(),
//! context: HashMap::new(),
//! priority: TaskPriority::Medium,
//! estimated_tokens: Some(1000),
//! };
//!
//! // Execute the task
//! let response = claude.execute_task_request(request).await?;
//! println!("Response: {}", response.response_text);
//!
//! Ok(())
//! }
//! ```
/// Conversation context optimization and management.
///
/// Handles intelligent context compression, relevance filtering,
/// and conversation history optimization for efficient LLM interactions.
/// Error recovery and circuit breaker implementation.
///
/// Provides robust error handling with circuit breaker patterns,
/// automatic retries, and graceful degradation strategies.
/// Main Claude Code interface and session management.
///
/// The primary interface for interacting with Claude Code, including
/// session pooling, request handling, and response processing.
/// Token bucket rate limiting with adaptive backoff.
///
/// Implements sophisticated rate limiting to stay within API quotas
/// while maximizing throughput and minimizing latency.
/// Core types and configuration structures.
///
/// Defines all data types, configuration structures, and enums
/// used throughout the Claude integration layer.
/// Usage tracking and cost analytics.
///
/// Monitors token consumption, estimates costs, and provides
/// detailed analytics on Claude API usage patterns.
pub use ContextManager;
pub use ErrorRecoveryManager;
pub use ClaudeCodeInterface;
pub use RateLimiter;
pub use *;
pub use UsageTracker;