Skip to main content

sqlite_graphrag/output/
mod.rs

1//! Single point of terminal I/O for the CLI (stdout JSON, stderr human).
2//!
3//! All user-visible output must go through this module; direct `println!` in
4//! other modules is forbidden.
5//!
6//! Split by responsibility (GAP-SG-146), roughly in order of how structured
7//! the output is:
8//!
9//! * [`envelope`] — complete JSON payloads, and the single point where the
10//!   agent-native reshaping surface is applied
11//! * [`error_envelope`] — failure payloads, with a serializer-free fallback
12//! * [`stream`] — NDJSON, one record per line, deliberately unshaped
13//! * [`passthrough`] — plain text and verbatim bytes, no JSON at all
14//! * [`human`] — stderr diagnostics via `tracing`
15//! * [`sink`] — the one place bytes actually reach stdout
16//! * [`format`] — `--format` value enums
17//! * [`responses`] — the serializable payload types themselves
18//!
19//! Every public item is re-exported here, so `crate::output::emit_json` and
20//! friends keep working unchanged; callers never name a submodule.
21
22mod envelope;
23mod error_envelope;
24mod format;
25mod human;
26mod passthrough;
27mod responses;
28mod sink;
29mod stream;
30
31#[cfg(test)]
32mod tests;
33
34pub use envelope::{emit_json, emit_json_compact};
35pub use error_envelope::{emit_error_json, emit_error_json_with_suggestion};
36pub use format::{JsonOutputFormat, OutputFormat};
37pub use human::{emit_error, emit_error_i18n, emit_progress, emit_progress_i18n};
38pub use passthrough::{emit_raw, emit_text};
39pub use responses::{RecallItem, RecallResponse, RememberResponse};
40pub use stream::emit_json_line;