Skip to main content

Crate vibe_wasm

Crate vibe_wasm 

Source
Expand description

WASM bindings for VibeScript 0.1.

Exposes parse, check, evaluate, and bytecode operations to JavaScript via wasm-bindgen. The wrapper serialises results as plain JS objects (through serde-wasm-bindgen) so the playground can consume them without a custom ABI.

Structs§

CompiledCell
Persistent compiled cell for the browser binding.

Constants§

VIBE_CBOR_LD_PROFILE
Tagged CBOR-LD profile identifier for VibeScript programs.

Functions§

apply_structural_edit
Apply a structural edit to a VibeScript program and project the result.
apply_structural_edits
Apply multiple structural edits in sequence. edits_json is a JSON array of edit objects.
ast_schema_json
Get the JSON schema for the AST.
capability_invoke
Capability invoke — routes through LocalHost so Civics/stdlib kernels (Econ.*, Statistics.ols, PhysicalUnits.convert, …) work under WASM. Ungranted / unknown ids still fail closed with E300 / E100.
check_cell_src
Check a cell expression.
check_program_src
Check a full program.
compile_cell_bytecode
Compile a cell expression to bytecode and return chunk metadata.
decode_and_run
Decode a binary bytecode chunk and run it once.
decode_program_cborld_wasm
Decodes tagged CBOR-LD AST bytes (Tag 4200) into a canonical representation, returning the reconstructed source code, AST hash, and provenance metadata.
diagnose_src
Parse + check a module; collect up to eight diagnostics.
diagnostic_schema_json
Get the JSON schema for diagnostics.
ebnf_grammar
Get the EBNF grammar string.
encode_cell_bytecode
Encode a cell’s bytecode to a binary Uint8Array.
encode_program_cborld_wasm
Encodes a VibeScript source program into tagged CBOR-LD AST bytes (Tag 4200). Validates syntax and type consistency before serializing.
eval_cell_json
Evaluate a cell and return the result as a JSON-compatible JS value. Playground Run uses eval_program_src (module + optional main), not this.
eval_cell_src
Evaluate a cell expression (= expr) with the in-process local host.
eval_program_src
Evaluate a full program on LocalHost (workshop dialect).
eval_program_with_receipt_wasm
Evaluates a Vibe program and returns the evaluated value together with a signed, reproducible execution receipt (containing source hash, AST hash, and engine metadata).
gbnf_grammar
Get the GBNF grammar (for LLM constrained decoding).
host_version
Frozen host ABI stamp (vibe-host-0.1).
language_version
Get the VibeScript language version string.
parse_cell_src
Parse a cell expression (= expr). Returns { ok: true, ast: ... } or { ok: false, error: ... }.
parse_program_src
Parse a full VibeScript program (module).
project_source
Project a VibeScript program source to canonical form. Parses the source, then re-projects it from the AST. This is the core of projectional authoring: structure → text.
run_cell_bytecode
Compile a cell to bytecode, run it on the VM, and return the result.
run_program_bytecode
Compile a program to bytecode, encode it to binary, decode it, and run a named function. Demonstrates the full bytecode round-trip.