🤖 English → Chatbot

Compile natural language conversational flows into a high-performance, sandboxed Rust/WebAssembly finite state machine.

State Machine Architecture

The generated chatbot is a Rust enum representing conversation states, and a struct holding the current state. Transitions are implemented as pattern-matched arms on user input, ensuring exhaustive handling of all states at compile time.

WASM Compilation

The generated Rust crate targets wasm32-unknown-unknown and uses wasm-bindgen to expose the chatbot's public API to JavaScript. The final .wasm binary is typically under 100KB after optimization with wasm-opt.

Context / Memory

Multi-step conversations that capture user data (name, email, order ID) use a Context struct to store values across state transitions. The code generator creates this struct automatically based on the captured fields in the English description.

API Integration

Nodes can trigger async HTTP calls using gloo-net. The IR uses an apiCall property to specify the method, URL, and response mapping. The code generator produces an async Rust function that returns a Promise to JavaScript.

Examples
English Input
"Start with "Hello! How can I help?". If the user says "billing", ask "What is your billing question?". If they say "support", ask "What is your support issue?"."
Data Columns
FieldTypeValue / DefaultModifier
stateenum ChatStateWelcome | Billing | SupportFSM root
greet()fn → String"Hello! How can I help?"initial message
process(input)fn → Stringmatch self.statetransition handler
Generated OutputRust/WASM
use wasm_bindgen::prelude::*;

#[derive(Debug, Clone, PartialEq)]
pub enum ChatState {
    Welcome,
    Billing,
    Support,
}

#[wasm_bindgen]
pub struct Chatbot {
    state: ChatState,
}

#[wasm_bindgen]
impl Chatbot {
    #[wasm_bindgen(constructor)]
    pub fn new() -> Self {
        Self { state: ChatState::Welcome }
    }

    pub fn greet(&self) -> String {
        "Hello! How can I help?".to_string()
    }

    pub fn process(&mut self, input: &str) -> String {
        let lower = input.to_lowercase();
        match self.state {
            ChatState::Welcome => {
                if lower.contains("billing") {
                    self.state = ChatState::Billing;
                    "What is your billing question?".to_string()
                } else if lower.contains("support") {
                    self.state = ChatState::Support;
                    "What is your support issue?".to_string()
                } else {
                    "I didn't catch that. Say 'billing' or 'support'.".to_string()
                }
            }
            ChatState::Billing => "Connecting you to billing...".to_string(),
            ChatState::Support => "Connecting you to support...".to_string(),
        }
    }
}