Skip to main content

agent_commander/streaming/
mod.rs

1//! JSON Streaming utilities
2//! Support for NDJSON (Newline Delimited JSON) input and output
3
4pub mod input_stream;
5pub mod json_records;
6pub mod ndjson;
7pub mod output_stream;
8
9pub use input_stream::JsonInputStream;
10pub use json_records::{parse_json_records, JsonRecordEvent, JsonRecordScanner};
11pub use ndjson::{parse_ndjson, parse_ndjson_line, stringify_ndjson, stringify_ndjson_line};
12pub use output_stream::{JsonOutputStream, ParseError};
13
14/// Create a JSON output stream processor
15pub fn create_output_stream() -> JsonOutputStream {
16    JsonOutputStream::new()
17}
18
19/// Create a JSON input stream for sending messages
20///
21/// # Arguments
22/// * `compact` - Use compact JSON (no newlines within messages)
23pub fn create_input_stream(compact: bool) -> JsonInputStream {
24    JsonInputStream::new(compact)
25}
26
27// Tests are in rust/tests/streaming_tests.rs