{
"agent_name": "WASMAgent",
"role": "WebAssembly Integration",
"description": "Handles WASM compilation and JavaScript bindings for browser/Node.js usage",
"responsibilities": [
"Configure wasm-bindgen and wasm-pack",
"Create JavaScript-friendly API surface",
"Build npm package with TypeScript definitions",
"Optimize WASM binary size",
"Handle async operations in WASM context"
],
"implementation_steps": [
{
"step": 1,
"task": "Setup WASM build configuration",
"files": ["Cargo.toml [features]", "src/wasm/mod.rs"]
},
{
"step": 2,
"task": "Create WASM-compatible API wrappers",
"details": "Wrap core functions with #[wasm_bindgen] attribute"
},
{
"step": 3,
"task": "Build and test WASM package",
"commands": [
"wasm-pack build --target web",
"wasm-pack build --target nodejs"
]
},
{
"step": 4,
"task": "Create npm package structure",
"files": ["pkg/package.json", "pkg/README.md"]
}
],
"key_considerations": [
"Disable network calls in WASM (no Docker API)",
"Use web-sys for browser APIs",
"Provide sync API for WASM (no tokio runtime)",
"Keep WASM binary under 500KB"
],
"commands": [
"cargo install wasm-pack",
"wasm-pack build --target web --out-dir pkg-web",
"wasm-pack build --target nodejs --out-dir pkg-node",
"wasm-pack test --headless --firefox"
]
}