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
//! Streaming - Event delivery and persistence
//!
//! This module handles **delivery** of events to consumers. It subscribes to
//! kernel events and delivers them via SSE, persistence, etc.
//!
//! ## Important: Source of Truth
//!
//! IDs and Events are DEFINED in `kernel/` (source of truth).
//! This module RE-EXPORTS them for convenience and provides:
//! - **event_logger.rs**: Append-only event log (EventStore, EventLog)
//! - **event_stream.rs**: Wire format for SSE (StreamEvent, data-* protocol)
//!
//! ## Architecture
//!
//! ```text
//! ExecutionKernel (owns IDs and Events)
//! │
//! │ emit events
//! ▼
//! ┌─────────────────────────────────────────────────────────┐
//! │ streaming/ │
//! │ ┌────────────┐ ┌────────────────────┐ │
//! │ │event_logger│ │ event_stream.rs │ │
//! │ │ (persist) │ │ (wire format) │ │
//! │ └────────────┘ └─────────┬──────────┘ │
//! └────────────────────────────┼────────────────────────────┘
//! │
//! ┌─────────────┼─────────────────┐
//! ▼ ▼ ▼
//! ┌──────────┐ ┌───────────┐ ┌───────────┐
//! │ TUI │ │ GUI (SSE) │ │ telemetry │
//! │(ratatui) │ │ (web) │ │ (OTel) │
//! └──────────┘ └───────────┘ └───────────┘
//! ```
//!
//! ## Event Protocol
//! All events use `data-*` prefix for SSE compatibility:
//! - Standard: `data-text-start`, `data-text-delta`, `data-finish`, etc.
//! - Custom: `data-execution-start`, `data-step-start`, etc.
//!
//! @see docs/TECHNICAL/01-EXECUTION-TELEMETRY.md
//! @see https://ai-sdk.dev/docs/ai-sdk-ui/stream-protocol
// =============================================================================
// Stream Events (wire format for SSE)
// =============================================================================
pub use ;
// =============================================================================
// Event Log (persistence)
// =============================================================================
pub use ;
pub use JsonlEventStore;
pub use JsonlStateStore;
// =============================================================================
// Re-exports from kernel (source of truth)
// =============================================================================
// IDs and Events are DEFINED in kernel/. We re-export for convenience.
pub use crate;
// =============================================================================
// Protection Layer (feat-09: Guardrails)
// =============================================================================
// Output processors that run BEFORE storage/streaming.
// @see docs/TECHNICAL/17-GUARDRAILS-PROTECTION.md
// @see docs/TECHNICAL/25-STREAM-PROCESSORS.md
pub use ProtectedEventEmitter;
pub use ;