Skip to main content

Crate wavekat_flow

Crate wavekat_flow 

Source
Expand description

wavekat-flow — the call-flow (“Receptionist”) document model for the WaveKat voice platform.

The types in this crate are generated at build time from the normative JSON Schema at schema/flow.v1.schema.json — the single source of truth shared with the @wavekat/flow-schema npm package. See build.rs.

Phase 2 (this milestone) adds the semantic validator (validate), the hours/timezone math (hours), and the interpreter (engine + its trace output) alongside the generated model, adapted to the generated types and pinned by the shared conformance corpus. The engine owns the engine::FlowEffects trait definition; the daemon keeps its live impl in its own codebase. Comment-preserving mutation stays TS-only.

Re-exports§

pub use model::*;

Modules§

book
The book component (schema_version 2): its bounds, and the vocabulary that lets a caller be told a time.
engine
The flow interpreter — doc 48’s “the daemon runs the flow”.
hours
Evaluation of the hours node’s schedule — the one v1 component with real branching logic, kept pure so it is directly unit-testable (feed a fixed instant, assert open/closed) without a call or a clock. The TypeScript twin is packages/flow-schema/src/hours.ts; a config is valid on one side iff it is on the other (pinned by the conformance corpus).
model
The generated document model (Flow, Node, Prompt, …), emitted from the schema by typify into OUT_DIR/flow_types.rs.
trace
What a flow run did — the trace (doc 48 “Traces: what the flow did, visible everywhere”). The engine appends one TraceStep per node it executes and ends with a FlowOutcome. The daemon maps this to call events (a flow timeline in Call details) and to the push uploader that syncs it to the platform; the editor later overlays step counts on the flow diagram.
validate
Publish-time / load-time validation — the gate that keeps a bad document from ever becoming a live phone line (doc 48). The platform runs the same checks before publish (packages/flow-schema/src/validate.ts); the daemon re-runs them on load so a corrupted cache or a version mismatch fails safe rather than executing undefined behavior. Every rule here has a TypeScript twin, and both are pinned by the shared conformance corpus.

Constants§

CURRENT_SCHEMA_VERSION
The newest version this build authors. Reading stays broad (SUPPORTED_SCHEMA_VERSIONS); writing is deliberately one number. Twin: model.ts CURRENT_SCHEMA_VERSION.
FLOW_V1_SCHEMA
The normative JSON Schema (draft 2020-12) for format version 1, as a string, bundled so consumers can run structural validation without reaching outside the crate. The crate-local copies are synced from the repo-root schemas by build.rs (and are what ship in the published package).
FLOW_V2_SCHEMA
Format version 2 — version 1 plus the book component. This is also the file the model types are generated from, being the newest.
SUPPORTED_SCHEMA_VERSIONS
Schema versions this crate’s model describes. Twin: packages/flow-schema/src/model.ts SUPPORTED_SCHEMA_VERSIONS.

Functions§

flow_schema
The schema for a declared version, or None if this build has none.
required_assets
Every audio asset the flow needs on the device, sorted and unique: the refs its prompts point at, plus — for a book node — the vocabulary it speaks times with (see crate::book, which explains why that is an asset and not a sentence).

Type Aliases§

NodeId
A node’s key within a flow. Human-meaningful (night_menu, not n7).