Casial WASM
WASM bindings for universal consciousness-aware context coordination, bringing Casial's context management capabilities to web browsers and Node.js environments.
Overview
Casial WASM provides WebAssembly bindings for casial-core, enabling browser-based and Node.js applications to participate in consciousness-aware context coordination. This allows web applications to intelligently manage and coordinate context across different environments.
Features
- Browser & Node.js Compatible: Runs in any modern JavaScript environment
- Context Coordination: Full access to Casial's context management capabilities
- Memory Efficient: Optimized WASM binary with
wee_alloc - JavaScript Integration: Seamless interop with JavaScript objects and APIs
- Real-time Processing: Async-capable context processing
- TypeScript Support: Generated TypeScript definitions for better DX
Installation
npm/yarn
# or
Cargo (for Rust projects)
[]
= "0.1.0"
Usage
Browser
Node.js
const = require;
// Initialize the coordinator
const coordinator = ;
// Use with async/await
// Use with promises
coordinator.
.
.;
TypeScript
import init, { ContextCoordinator, ContextEntry } from 'casial-wasm';
interface UserAction {
type: string;
data: any;
timestamp: number;
}
class ContextManager {
private coordinator: ContextCoordinator;
async initialize() {
await init();
this.coordinator = new ContextCoordinator();
}
async processAction(action: UserAction): Promise<ContextEntry[]> {
return this.coordinator.process_context({
content: JSON.stringify(action.data),
source: `user-${action.type}`,
timestamp: action.timestamp
});
}
}
Building from Source
Prerequisites
Build
# Clone the repository
# Build for web
# Build for Node.js
# Build for bundler (webpack, etc.)
API Reference
The WASM bindings expose the following key classes and methods:
ContextCoordinator: Main coordination engineContextEntry: Individual context itemsContextQuery: Query interface for retrieving contextContextSource: Context source registration and management
See the TypeScript definitions for complete API documentation.
Performance
The WASM module is optimized for size and performance:
- Compiled with
-Osoptimizations - Uses
wee_allocfor minimal memory footprint - Async-capable for non-blocking operations
- Efficient serialization with
serde-wasm-bindgen
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Links
- Repository
- Homepage
- Documentation
- casial-core - Core coordination engine
- WebAssembly - Learn more about WASM