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
bookcomponent (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
hoursnode’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 ispackages/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 bytypifyintoOUT_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
TraceStepper node it executes and ends with aFlowOutcome. 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.tsCURRENT_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
bookcomponent. 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.tsSUPPORTED_SCHEMA_VERSIONS.
Functions§
- flow_
schema - The schema for a declared version, or
Noneif 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
booknode — the vocabulary it speaks times with (seecrate::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, notn7).