gemini_adk_fluent_rs/compose/
ctx.rs

1//! Ctx — Declarative state-to-narrative context composition.
2//!
3//! Builds a [`ContextBuilder`] that renders session state into a
4//! natural-language summary appended to the phase instruction.
5//!
6//! # Example
7//!
8//! ```ignore
9//! use gemini_adk_fluent_rs::prelude::*;
10//!
11//! let ctx = Ctx::builder()
12//!     .section("Caller")
13//!         .field("caller_name", "Name")
14//!         .flag("is_known_contact", "Known contact")
15//!     .section("Call")
16//!         .field("call_purpose", "Purpose")
17//!         .sentiment("caller_sentiment")
18//!     .build();
19//!
20//! // Use with phase_defaults:
21//! Live::builder()
22//!     .phase_defaults(|d| d.context(ctx))
23//! ```
24
25pub use gemini_adk_rs::live::context_builder::{ContextBuilder, SectionBuilder};
26
27/// The `Ctx` namespace — factory methods for declarative context builders.
28pub struct Ctx;
29
30impl Ctx {
31    /// Start building a new context with the first section.
32    ///
33    /// Returns a [`SectionBuilder`] — add fields, flags, sentiments,
34    /// then call `.build()` to get a [`ContextBuilder`].
35    ///
36    /// # Example
37    ///
38    /// ```ignore
39    /// let ctx = Ctx::builder()
40    ///     .section("Caller")
41    ///         .field("caller_name", "Name")
42    ///         .field("caller_organization", "Organization")
43    ///         .flag("is_known_contact", "Known contact")
44    ///     .section("Call")
45    ///         .field("call_purpose", "Purpose")
46    ///         .sentiment("caller_sentiment")
47    ///     .build();
48    /// ```
49    pub fn builder() -> SectionBuilder {
50        ContextBuilder::new()
51    }
52}