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
//! Parser health monitoring and graceful degradation.
//!
//! This module provides utilities for monitoring parser health,
//! tracking parsed vs ignored events, and providing warnings when
//! parsers are not working correctly with specific agents.
//!
//! # Event Classification
//!
//! Events are classified into the following categories:
//!
//! - **Parsed events**: Successfully processed and displayed, including:
//! - Complete content events
//! - Successfully handled event types
//!
//! - **Partial events**: Streaming delta events (text deltas, thinking deltas,
//! tool input deltas) that are displayed incrementally. These are NOT errors
//! and are tracked separately to show real-time streaming activity without
//! inflating "ignored" percentages.
//!
//! - **Control events**: State management events that don't produce user-facing
//! output. These are NOT errors and are tracked separately to avoid inflating
//! "ignored" percentages. Examples: `MessageStart`, `ContentBlockStart`, `Ping`,
//! `TurnStarted`, `StepStarted`.
//!
//! - **Unknown events**: Valid JSON that the parser deserializes successfully
//! but doesn't have specific handling for. These are NOT considered errors
//! and won't trigger health warnings. They represent future/new event types.
//!
//! - **Parse errors**: Malformed JSON that cannot be deserialized. These DO
//! trigger health warnings when they exceed 50% of events.
//!
//! - **Ignored events**: General category for events not displayed (includes
//! both unknown events and parse errors)
//!
//! # Streaming Quality Metrics
//!
//! The [`StreamingQualityMetrics`] struct provides insights into streaming behavior:
//!
//! - **Delta sizes**: Average, min, max delta sizes to understand streaming granularity
//! - **Total deltas**: Count of deltas per content block
//! - **Streaming pattern**: Classification as smooth, bursty, or chunked based on size variance
pub use ;
pub use HealthMonitor;
pub use ParserHealth;