gestura_core_streaming/lib.rs
1//! Streaming response types, config, and cancellation support for Gestura.
2//!
3//! `gestura-core-streaming` provides the shared building blocks for incremental
4//! LLM response delivery across the workspace. It defines the streaming event
5//! model surfaced to UIs, the decoupled streaming configuration types used at
6//! runtime, and the cancellation registry that coordinates interruption of
7//! in-flight streams.
8//!
9//! ## Responsibilities
10//!
11//! - `streaming`: core streaming events, provider-specific streaming helpers,
12//! token-usage updates, tool-call chunks, shell output chunks, and status
13//! notifications used by CLI/GUI frontends
14//! - `config`: a portable `StreamingConfig` model derived from application
15//! configuration without tying the streaming crate directly to `AppConfig`
16//! - `cancellation`: cooperative cancellation-token registry for active streams
17//!
18//! ## Architecture boundary
19//!
20//! This crate owns the streaming protocol and runtime primitives. Higher-level
21//! orchestration—such as deciding when to start a stream, how to bridge it into
22//! sessions, and how to mix streaming with tool execution—remains in
23//! `gestura-core`.
24//!
25//! ## Stable import paths
26//!
27//! Most consumers should import through the facade re-exports:
28//!
29//! - `gestura_core::streaming::*`
30//! - `gestura_core::stream_cancellation::*`
31//!
32//! ## Why the config is separate
33//!
34//! `StreamingConfig` mirrors only the subset of provider configuration needed
35//! for streaming. This keeps the crate portable, easier to test, and less
36//! tightly coupled to the larger application configuration surface.
37
38pub mod cancellation;
39pub mod config;
40pub mod streaming;
41
42pub use cancellation::{STREAM_CANCELLATIONS, StreamCancellationRegistry};
43pub use config::{
44 AnthropicProviderConfig, GeminiProviderConfig, GrokProviderConfig, OllamaProviderConfig,
45 OpenAiProviderConfig, StreamingConfig,
46};
47pub use streaming::*;