@degreesign/chat 1.0.1 → 1.1.0

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.
package/dist/types.d.ts CHANGED
@@ -359,6 +359,8 @@ interface RuntimeDeps {
359
359
  litert?: LlmEngine;
360
360
  };
361
361
  backend?: LlmBackend;
362
+ /** Device class override, tests only */
363
+ mobile?: () => boolean;
362
364
  }
363
365
  /** One model load request */
364
366
  interface RuntimeLoadParams {
@@ -435,6 +437,8 @@ interface ModelStore {
435
437
  }
436
438
  /** One generation request */
437
439
  interface RuntimeChatParams {
440
+ /** Model that answers, resolved by the runtime */
441
+ model?: ChatModelId;
438
442
  messages: ChatMessage[];
439
443
  limits: LlmLimits;
440
444
  reasoning: boolean;
@@ -451,16 +455,21 @@ interface Runtime {
451
455
  /** Load a model, or join a load of the same model already in flight */
452
456
  load: (params: RuntimeLoadParams) => Promise<boolean>;
453
457
  chat: (params: RuntimeChatParams) => Promise<string | undefined>;
454
- unload: () => Promise<void>;
458
+ /** Release one loaded model, or every model */
459
+ unload: (model?: ChatModelId) => Promise<void>;
455
460
  /** Release the model and delete every cached model file */
456
461
  clear: () => Promise<void>;
457
- ready: () => boolean;
458
- loading: () => boolean;
459
- status: () => LlmStatus;
460
- backend: () => LlmBackend;
461
- /** Last model load error, cleared when a load starts */
462
- error: () => string | undefined;
463
- /** Model currently loaded on this runtime */
462
+ /** Whether one model, or the active model, is loaded */
463
+ ready: (model?: ChatModelId) => boolean;
464
+ /** Whether one model, or any model, is loading */
465
+ loading: (model?: ChatModelId) => boolean;
466
+ /** Status of one model, or of the last load */
467
+ status: (model?: ChatModelId) => LlmStatus;
468
+ /** Backend of one model, or of the active model */
469
+ backend: (model?: ChatModelId) => LlmBackend;
470
+ /** Last model load error, of one model or of the latest load */
471
+ error: (model?: ChatModelId) => string | undefined;
472
+ /** Model that loaded or answered last */
464
473
  model: () => ChatModel | undefined;
465
474
  }
466
475
  /** Params for a single on-device chat generation */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@degreesign/chat",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Headless on-device AI chat for browsers and Node with wllama CPU and LiteRT WebGPU engines",
5
5
  "main": "dist/node/chat.node.min.js",
6
6
  "module": "dist/browser/chat.min.mjs",
@@ -21,6 +21,7 @@
21
21
  },
22
22
  "sideEffects": false,
23
23
  "scripts": {
24
+ "prebuild": "node scripts/patch-wllama.cjs",
24
25
  "build": "tsc --emitDeclarationOnly && webpack && node scripts/banner-wllama.cjs && node scripts/patch-litert.cjs",
25
26
  "typecheck": "tsc --noEmit",
26
27
  "verify:node": "node test/node.cjs"