@silviomollov/ai-isolate-quickjs-wasm-location
v0.1.46-fork.1
Published
Temporary fork of @tanstack/ai-isolate-quickjs with configurable QuickJS WASM URL/path loading and promise-bridged host functions.
Maintainers
Readme
@silviomollov/ai-isolate-quickjs-wasm-location
Temporary fork of
@tanstack/ai-isolate-quickjs0.1.46(MIT, © TanStack). This fork addswasmLocation, allowing the synchronous QuickJS WASM binary to be served from a public directory or CDN. It also includes promise-bridged host functions instead of asyncify suspensions, fixing refcount corruption on repeated tool awaits (quickjs-emscripten#258).Drop-in usage via npm alias:
"@tanstack/ai-isolate-quickjs": "npm:@silviomollov/[email protected]"
QuickJS WASM driver for TanStack AI Code Mode. Runs in Node.js, browsers, and edge runtimes with zero native dependencies.
Installation
Install directly:
pnpm add @silviomollov/ai-isolate-quickjs-wasm-locationOr install it as a drop-in replacement for the TanStack package:
pnpm add @tanstack/ai-isolate-quickjs@npm:@silviomollov/[email protected]Usage
When installed through the alias:
import { createQuickJSIsolateDriver } from '@tanstack/ai-isolate-quickjs'
import { createCodeModeTool } from '@tanstack/ai-code-mode'
const driver = createQuickJSIsolateDriver({
timeout: 30_000,
memoryLimit: 128,
maxStackSize: 512 * 1024,
wasmLocation: '/assets/quickjs/emscripten-module.wasm',
})
const executeTypescript = createCodeModeTool({
driver,
tools: [myTool],
})When installed directly, import from @silviomollov/ai-isolate-quickjs-wasm-location instead.
Config Options
timeout— Default execution timeout in milliseconds (default: 30000)memoryLimit— Default QuickJS runtime memory limit in MB (default: 128)maxStackSize— Default QuickJS runtime max stack size in bytes (default: 524288)wasmLocation— Optional URL or path from which Emscripten loads the QuickJS WASM binary. When omitted,quickjs-emscriptenresolves its bundled binary.
Serving the WASM Binary
The configured file must be the synchronous release binary exported by @jitl/quickjs-wasmfile-release-sync/wasm. Ensure cross-origin requests are allowed when serving it from another origin.
const driver = createQuickJSIsolateDriver({
wasmLocation: 'https://cdn.example.com/quickjs/emscripten-module.wasm',
})Refreshing the Fork
From Git Bash, refresh the staged source and compiled output from the sibling ../ai repository and set the next package version:
./refresh.sh 0.1.46-fork.2Set REPO_DIR if the source repository is elsewhere. The script builds and packs the package from the currently checked-out source branch.
Publishing
npm publish --access publicLicense
MIT
