{"_id":"@agorapete/wllama-compat","name":"@agorapete/wllama-compat","dist-tags":{"next":"3.5.1-q2.0","latest":"3.5.1-q2.0"},"versions":{"3.5.1-q2.0":{"name":"@agorapete/wllama-compat","version":"3.5.1-q2.0","description":"Optional package providing compatibility with older browsers for @wllama/wllama","main":"index.js","type":"module","scripts":{"upload":"npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/ngxson/wllama.git"},"keywords":["wasm","webassembly","llama","llm","ai","rag","embeddings","generation"],"author":{"name":"Xuan Son NGUYEN","email":"contact@ngxson.com"},"license":"MIT","bugs":{"url":"https://github.com/ngxson/wllama/issues"},"homepage":"https://github.com/ngxson/wllama#readme","gitHead":"948e6ae407775ef6c829a1a7e47fb22bbd3dec38","_id":"@agorapete/wllama-compat@3.5.1-q2.0","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-Jw4ZwxSowGoySfdTmqU8uc05m3YBlFD95REAUdwasV1PZhITWq+25+Kl15G6k5K9+S4sLz8gXGyEeOfeULrAwA==","shasum":"c1da37a903d221a93ee4ce827cb547bf4c582436","tarball":"https://registry.npmjs.org/@agorapete/wllama-compat/-/wllama-compat-3.5.1-q2.0.tgz","fileCount":5,"unpackedSize":14360125,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFlC+xWcFKzNCROVP2zapalZY94ratMgeuicBH2/fbsiAiAVPciM/4B3+6uDMZGImjB1abUj1FH/qJDw/72epYF13Q=="}]},"_npmUser":{"name":"agorapete","email":"peter.haughie@agora-thinktanks.org"},"directories":{},"maintainers":[{"name":"agorapete","email":"peter.haughie@agora-thinktanks.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wllama-compat_3.5.1-q2.0_1782374680845_0.4867154628939476"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-25T08:04:40.595Z","3.5.1-q2.0":"2026-06-25T08:04:41.075Z","modified":"2026-06-25T08:04:41.335Z"},"maintainers":[{"name":"agorapete","email":"peter.haughie@agora-thinktanks.org"}],"description":"Optional package providing compatibility with older browsers for @wllama/wllama","homepage":"https://github.com/ngxson/wllama#readme","keywords":["wasm","webassembly","llama","llm","ai","rag","embeddings","generation"],"repository":{"type":"git","url":"git+https://github.com/ngxson/wllama.git"},"author":{"name":"Xuan Son NGUYEN","email":"contact@ngxson.com"},"bugs":{"url":"https://github.com/ngxson/wllama/issues"},"license":"MIT","readme":"# @wllama/wllama-compat\n\nOptional package that provides compatibility WASM assets for `@wllama/wllama` on browsers that lack [JSPI](https://github.com/WebAssembly/js-promise-integration) or [MEMORY64](https://github.com/WebAssembly/memory64) support - most notably Safari and older browsers.\n\n## Why this package exists\n\nThe default `@wllama/wllama` build relies on two modern WebAssembly features: [JSPI](https://github.com/WebAssembly/js-promise-integration) and [MEMORY64](https://github.com/WebAssembly/memory64)\n\nWhen either feature is absent, wllama automatically falls back to **compat mode**: a separate WASM build that uses [Asyncify](https://emscripten.org/docs/porting/asyncify.html) instead of JSPI, and drops MEMORY64.\n\n> **Note:** Compat mode has significantly lower performance than the default build. Use it only as a fallback.\n\n## Browser compatibility\n\n| | Chromium | Firefox | Safari |\n|---|---|---|---|\n| Auto-compat (default, recommended) | ✅ | 🟡 (no WebGPU) | 🟡 (supports WebGPU) |\n| Force-compat | ✅ | 🔴 (supports WebGPU) | 🟡 (supports WebGPU) |\n| Non-compat mode | ✅ | 🟡 (no WebGPU) | ❌ |\n\n- ✅: Good speed\n- 🟡: Acceptable speed\n- 🔴: Runs but slow, not usable\n- ❌: Does not run at all\n\n### Default behaviour\n\nOut of the box, wllama fetches the compat assets from jsDelivr CDN when compat mode is needed. If you want to self-host the assets (no external CDN dependency), install this package (see new section.)\n\n### Recommended preset\n\nBy default (`mode = 'safari'`), compat is disabled on Firefox because WebGPU via compat mode is extremely slow there. This is the recommended behaviour:\n\n```js\nwllama.setCompat('default');\n```\n\nIf you also want compat on Firefox (e.g. to reach users without JSPI enabled), pass `'firefox_safari'`:\n\n```js\nwllama.setCompat('default', 'firefox_safari');\n```\n\n## Disabling compat mode\n\nTo opt out of compat mode completely (e.g. you don't target Safari):\n\n```ts\nwllama.setCompat(null);\n```\n\n## Using this package\n\n**You only need to install package if you want to store compat assets locally**. By default, assets are pulled from CDN.\n\n```bash\nnpm install @wllama/wllama-compat\n```\n\nThen copy the assets from `node_modules/@wllama/wllama-compat/wasm/` to your public directory and call `setCompat()` with the URLs pointing to those files:\n\n```ts\nimport { Wllama } from '@wllama/wllama';\n\nconst wllama = new Wllama({ default: '/wasm/wllama.wasm' });\n\nwllama.setCompat({\n  wasm: '/wllama-compat/wasm/wllama.wasm',\n  worker: '/wllama-compat/wasm/wllama.js',\n});\n```\n\n**IMPORTANT**: for Vite, you will need to import the JS as `?raw`\n\n```ts\nimport compatWasm from '@wllama/wllama-compat/wasm/wllama.wasm?url';\nimport compatWorker from '@wllama/wllama-compat/wasm/wllama.js?raw'; // IMPORTANT: ?raw, NOT ?url\n\nexport const WLLAMA_COMPAT_CONFIG = {\n  wasm: compatWasm,\n  worker: {\n    code: compatWorker,\n  },\n};\n\nconst instance = new Wllama(WLLAMA_CONFIG_PATHS, { logger: DebugLogger });\ninstance.setCompat(WLLAMA_COMPAT_CONFIG);\n```\n","readmeFilename":"README.md","_rev":"1-3b8da9e0917f496bd25a4b5b3eabb6b7"}