@degreesign/chat 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +20 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -230,6 +230,26 @@ The CPU engine derives a raw thread count from the device, then caps it at
230
230
  `limits.maxThreads`, default 2. The cap is applied after the raw maximum, so the
231
231
  engine never exceeds the device or the caller budget.
232
232
 
233
+ Threads only take effect when the host page is cross-origin isolated. Serve it
234
+ with both headers:
235
+
236
+ ```
237
+ Cross-Origin-Opener-Policy: same-origin
238
+ Cross-Origin-Embedder-Policy: require-corp
239
+ ```
240
+
241
+ Then assert `crossOriginIsolated === true` in the page. Without isolation the
242
+ engine falls back to one thread and image encoding becomes much slower, since
243
+ the projector runs on the CPU.
244
+
245
+ Under `require-corp` every cross-origin subresource must be CORS enabled or
246
+ carry `Cross-Origin-Resource-Policy`. Hugging Face downloads already qualify;
247
+ third party images, fonts and embeds need `crossorigin="anonymous"` or must be
248
+ self hosted. Chromium also accepts
249
+ `Cross-Origin-Embedder-Policy: credentialless` when those assets cannot be
250
+ changed. A page inside an iframe is isolated only when every ancestor sets the
251
+ same headers.
252
+
233
253
  Only one model stays on device. Loading a new model unloads the previous runtime
234
254
  and deletes other model caches. A quota failure purges every model cache before
235
255
  retrying, so a half written download never blocks the next attempt.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@degreesign/chat",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Headless on-device AI chat for browsers, workers and Node with a wllama CPU engine",
5
5
  "main": "dist/node/chat.node.min.js",
6
6
  "module": "dist/browser/chat.min.mjs",