pub struct SessionSpec {Show 22 fields
pub name: String,
pub version: String,
pub description: String,
pub instruction: String,
pub greeting: Option<String>,
pub modality: SpecModality,
pub voice: Option<String>,
pub tools: Vec<ToolSpec>,
pub mcp: Vec<String>,
pub extract: Vec<ExtractSpec>,
pub state: BTreeMap<String, StateFieldSpec>,
pub computed: Vec<ComputedSpec>,
pub memory: Option<MemorySpec>,
pub runtime: Option<RuntimeSpec>,
pub phases: Vec<PhaseSpec>,
pub initial_phase: Option<String>,
pub watch: Vec<WatchSpec>,
pub patterns: Vec<PatternSpec>,
pub fragments: BTreeMap<String, Flow>,
pub use_fragments: Vec<UseFragment>,
pub flow: Option<Flow>,
pub tests: Vec<SpecTest>,
}Expand description
A complete Live session as one JSON document. See the module docs.
Fields§
§name: StringApp name (display and registry identity).
version: StringSpec version tag (freeform, e.g. “1” or “2025-08-24”).
description: StringHuman-readable description.
instruction: StringBase system instruction.
greeting: Option<String>Optional greeting prompt — the model speaks first on connect.
modality: SpecModalityOutput modality. Defaults to text.
voice: Option<String>Voice name for audio sessions (e.g. “Puck”).
tools: Vec<ToolSpec>Declared tools (mock or HTTP-bound).
mcp: Vec<String>MCP toolset connection strings — the whole MCP ecosystem as this app’s tool library. Resolved at connect time.
extract: Vec<ExtractSpec>Out-of-band extraction pipelines.
state: BTreeMap<String, StateFieldSpec>Declared state keys — the session’s data dictionary.
computed: Vec<ComputedSpec>Computed (derived) state variables.
memory: Option<MemorySpec>Durable memory: slots projected into state, remember effects, and
the ambient recall/manage tools. Requires a MemoryBinding in
SpecResources at apply time.
runtime: Option<RuntimeSpec>Control-plane and voice tuning.
phases: Vec<PhaseSpec>Conversation phases.
initial_phase: Option<String>Initial phase name (required when phases is non-empty).
watch: Vec<WatchSpec>State watchers.
patterns: Vec<PatternSpec>Temporal patterns (sustained / consecutive-turn conditions).
fragments: BTreeMap<String, Flow>Reusable flow fragments, spliced via use_fragments.
use_fragments: Vec<UseFragment>Fragment splice directives.
flow: Option<Flow>The governed flow DAG (optional — a spec may be phases-only).
tests: Vec<SpecTest>Embedded conformance tests, replayed offline by
SessionSpec::run_tests.
Implementations§
Source§impl SessionSpec
impl SessionSpec
Source§impl SessionSpec
impl SessionSpec
Sourcepub fn from_value(value: Value) -> Result<Self, String>
pub fn from_value(value: Value) -> Result<Self, String>
Parse a spec from a JSON value. Accepts a full document or a bare
flow ({"steps": [...]}), which is wrapped in a default spec.
Sourcepub fn json_schema() -> Value
pub fn json_schema() -> Value
The JSON Schema of the spec document itself — for editor autocomplete and for validating machine-authored specs at generation time.
Sourcepub fn tool_names(&self) -> Vec<String>
pub fn tool_names(&self) -> Vec<String>
Declared tool names (mock/HTTP; MCP names resolve at connect).
Sourcepub fn effective_flow(&self) -> Result<Flow, Vec<String>>
pub fn effective_flow(&self) -> Result<Flow, Vec<String>>
The flow with every use_fragments directive spliced in.
Sourcepub fn state_keys_written(&self) -> BTreeSet<String>
pub fn state_keys_written(&self) -> BTreeSet<String>
Every state key the session declares a writer for: tool set_state
and save_response_as, extraction names and promotion targets, phase
and watcher set effects.
Sourcepub fn validate(&self) -> SpecValidation
pub fn validate(&self) -> SpecValidation
Validate the whole document: flow compilation (with the declared tool registry), fragment splicing, phase-guard restrictions, HTTP-binding support, and the read/write state-key diff.
Sourcepub fn build_dispatcher(&self, state: &State) -> ToolDispatcher
pub fn build_dispatcher(&self, state: &State) -> ToolDispatcher
Build the dispatcher of declared tools bound to state.
Sourcepub fn run_tests(&self) -> Vec<TestReport>
pub fn run_tests(&self) -> Vec<TestReport>
Run the embedded test suite offline (no model, no network) — scripted
events replayed through the real FlowMonitor.
Sourcepub fn apply(
&self,
live: Live,
state: &State,
resources: &SpecResources,
) -> Result<Live, String>
pub fn apply( &self, live: Live, state: &State, resources: &SpecResources, ) -> Result<Live, String>
Configure a Live builder from this spec.
state is the session state the declared tools bind to — pass the
same one via .state (this method does). Returns an error when
the spec fails validation or requires a resource resources lacks.
Everything code-only (callbacks, custom guards, middleware) is added on
the returned builder afterwards.
Trait Implementations§
Source§impl Clone for SessionSpec
impl Clone for SessionSpec
Source§fn clone(&self) -> SessionSpec
fn clone(&self) -> SessionSpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SessionSpec
impl Debug for SessionSpec
Source§impl Default for SessionSpec
impl Default for SessionSpec
Source§fn default() -> SessionSpec
fn default() -> SessionSpec
Source§impl<'de> Deserialize<'de> for SessionSpec
impl<'de> Deserialize<'de> for SessionSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for SessionSpec
impl JsonSchema for SessionSpec
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for SessionSpec
impl !RefUnwindSafe for SessionSpec
impl Send for SessionSpec
impl Sync for SessionSpec
impl Unpin for SessionSpec
impl !UnwindSafe for SessionSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].