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§

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§

FLOW_V1_SCHEMA
The normative JSON Schema (draft 2020-12) as a string, bundled so consumers can run structural validation without reaching outside the crate. The crate-local copy is synced from the repo-root schema by build.rs (and is what ships in the published package).
SUPPORTED_SCHEMA_VERSIONS
Schema versions this crate’s model describes. Twin: packages/flow-schema/src/model.ts SUPPORTED_SCHEMA_VERSIONS.

Type Aliases§

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