Expand description
§Briefcase AI WebAssembly Bindings
High-performance AI observability and decision tracking for JavaScript and TypeScript applications running in browsers or Node.js environments.
§Features
- AI Decision Tracking: Capture inputs, outputs, and context for every AI decision
- High Performance: Rust-powered WebAssembly for maximum speed
- Browser Compatible: Works in all modern browsers and Node.js
- Sync APIs: Simplified synchronous APIs optimized for WebAssembly
- TypeScript Support: Full type definitions included
- Zero Dependencies: No external JavaScript dependencies required
§Installation
npm install briefcase-wasm§Usage
import { init, DecisionSnapshot, Input, Output } from 'briefcase-wasm';
// Initialize the WASM module
await init();
// Create a decision snapshot
const decision = new DecisionSnapshot("ai_function");
const input = new Input("query", "Hello world", "string");
const output = new Output("response", "Hello back!", "string");
decision.addInput(input);
decision.addOutput(output);§Browser Usage
For browser environments, you may need to configure your bundler to handle WASM files. Most modern bundlers like Vite, Webpack 5, and Parcel support WebAssembly out of the box.
§Node.js Usage
The package works seamlessly in Node.js environments with ES modules or CommonJS.
Structs§
- JsDecision
Snapshot - JavaScript-friendly wrapper for DecisionSnapshot
- JsMemory
Storage - Simple in-memory storage for demo purposes
Functions§
- init
- Initialize the Briefcase AI WASM module
- main
- test_
functionality - Utility function for testing WASM functionality
- version
- Utility function to get the version of the WASM module