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§
- Compiled
Cell - 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_jsonis a JSON array of edit objects. - ast_
schema_ json - Get the JSON schema for the AST.
- capability_
invoke - Capability invoke — routes through
LocalHostso 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 + optionalmain), 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.