pub struct Conversation { /* private fields */ }Expand description
Fluent builder that produces a ConversationSpec; sugar over the spec.
(Not Debug: resolve_slot bindings hold async
closures. The serializable ConversationSpec is Debug via spec.)
Implementations§
Source§impl Conversation
impl Conversation
Sourcepub fn stage(self, id: impl Into<String>) -> Self
pub fn stage(self, id: impl Into<String>) -> Self
Begin authoring a new stage; subsequent setters apply to it. Routes to the
active overlay when between .overlay(..) and .done_overlay().
Sourcepub fn overlay(self, name: impl Into<String>) -> Self
pub fn overlay(self, name: impl Into<String>) -> Self
Begin authoring a digression/overlay; subsequent .stage(..) calls (until
.done_overlay()) populate it. Set its activation guard with .trigger(..)
(an overlay with no trigger never fires — fail-closed).
Sourcepub fn trigger(self, guard: Guard) -> Self
pub fn trigger(self, guard: Guard) -> Self
Set the activation guard of the overlay currently being authored.
Sourcepub fn resume(self, resume: Resume) -> Self
pub fn resume(self, resume: Resume) -> Self
Set the resume policy of the overlay currently being authored.
Sourcepub fn done_overlay(self) -> Self
pub fn done_overlay(self) -> Self
Finish the current overlay; subsequent .stage(..) calls target the main
flow again.
Sourcepub fn add_overlay(self, overlay: OverlaySpec) -> Self
pub fn add_overlay(self, overlay: OverlaySpec) -> Self
Append a pre-built OverlaySpec (e.g. a Motif::faq_digression). Leaves
overlay-authoring mode (the overlay is already complete).
Sourcepub fn collect<I, S>(self, fields: I) -> Self
pub fn collect<I, S>(self, fields: I) -> Self
Collect the given slots in this stage (drives default completion).
Sourcepub fn collect_frame<F: Frame>(self) -> Self
pub fn collect_frame<F: Frame>(self) -> Self
Collect the slots of a typed gemini_adk_rs::frame::Frame in this
stage. The frame’s slot state-keys drive the captured completion; its
metadata (prompts/confirm/pii) is available via F::frame() for
confirmation and repair.
Sourcepub fn commit(self, tool: impl Into<String>, when: Guard) -> Self
pub fn commit(self, tool: impl Into<String>, when: Guard) -> Self
Commit a confirm-before-act tool in this stage, gated by when.
Sourcepub fn next(self, to: impl Into<String>, when: Guard) -> Self
pub fn next(self, to: impl Into<String>, when: Guard) -> Self
Add a forward transition to to when when holds.
Sourcepub fn resolve_slot<I, S, F, Fut>(
self,
name: impl Into<String>,
args: I,
ttl: Option<Duration>,
fetch: F,
) -> Self
pub fn resolve_slot<I, S, F, Fut>( self, name: impl Into<String>, args: I, ttl: Option<Duration>, fetch: F, ) -> Self
Fill a slot in the current stage from an async resolver — a tool call,
HTTP fetch, MCP request, or agent. args names the State keys bound into
the JSON object passed to fetch; the returned value fills name. With a
ttl, results are memoized by (field, canonical args).
The slot is added to the stage’s collect, so its captured completion
waits for the resolution. The closure lives only in the builder; the
serializable spec is unaffected.
Sourcepub fn after(self, dep: impl Into<String>) -> Self
pub fn after(self, dep: impl Into<String>) -> Self
Add an explicit dependency on another stage.
Sourcepub fn repair(self, policy: RepairPolicy) -> Self
pub fn repair(self, policy: RepairPolicy) -> Self
Attach a RepairPolicy to the current stage.
Sourcepub fn require<I, S>(self, steps: I) -> Self
pub fn require<I, S>(self, steps: I) -> Self
Require these stages for completion (lowers to a Flow require). Targets
the active overlay when authoring one, else the main flow.
Sourcepub fn spec(&self) -> &ConversationSpec
pub fn spec(&self) -> &ConversationSpec
The spec built so far.
Sourcepub fn into_spec(self) -> ConversationSpec
pub fn into_spec(self) -> ConversationSpec
Consume into the underlying spec.
Sourcepub fn from_spec(
spec: ConversationSpec,
) -> Result<CompiledConversation, ConversationError>
pub fn from_spec( spec: ConversationSpec, ) -> Result<CompiledConversation, ConversationError>
Compile from a ConversationSpec (e.g. parsed from YAML). Resolver-slot
bindings are builder-only, so a spec loaded this way has none.
Sourcepub fn compile(self) -> Result<CompiledConversation, ConversationError>
pub fn compile(self) -> Result<CompiledConversation, ConversationError>
Lower and validate into a CompiledConversation.
Trait Implementations§
Source§impl Clone for Conversation
impl Clone for Conversation
Source§fn clone(&self) -> Conversation
fn clone(&self) -> Conversation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more