spt-booster-wasm
WebAssembly bindings for spt-booster
Overview
spt-booster-wasm provides JavaScript-compatible WASM bindings for the spt-booster code editing library. It uses the lite parser (no tree-sitter C dependencies) to keep the WASM binary small, and exposes wasm-bindgen interfaces so browser and Node.js consumers can call the booster API directly. This is the runtime used for Tier 1 Agent Booster transforms in browser-based agent environments.
Key Features
- wasm-bindgen interface -- JavaScript-callable API for code editing operations
- Lite parser only -- no tree-sitter C dependencies, keeping the WASM binary compact
- Console error panic hook -- improved error messages in browser dev tools
- Language and strategy enums -- WASM-compatible wrappers for all spt-booster enums
- Zero-copy serialization -- uses serde-wasm-bindgen for efficient JS/Rust data transfer
Dependencies
Key internal dependencies:
spt-booster-- core editing library (withlite-parserfeature)wasm-bindgen-- Rust/JS interop bindingsserde-wasm-bindgen-- serialization bridge between JS values and Rust types
Usage
javascript
import init, { WasmBooster, WasmLanguage } from 'spt-booster-wasm';
await init();
const booster = new WasmBooster();
const result = booster.apply_edit("let x = 1;", "const x = 1;", WasmLanguage.JavaScript);API Reference
Core Types
| Type | Description |
|---|---|
WasmLanguage | JavaScript-compatible language enum (JavaScript, TypeScript, Python, Rust, etc.) |
WasmMergeStrategy | JavaScript-compatible merge strategy enum |
init() | WASM module initializer with panic hook setup |