@dudko.dev/agent-web 0.0.3 → 0.0.5

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.
@@ -0,0 +1,13 @@
1
+ import {
2
+ createWebLLMModel,
3
+ isWebGPUAvailable,
4
+ preloadWebLLMModel,
5
+ unloadWebLLMModel
6
+ } from "./chunk-IT65EW77.js";
7
+ export {
8
+ createWebLLMModel,
9
+ isWebGPUAvailable,
10
+ preloadWebLLMModel,
11
+ unloadWebLLMModel
12
+ };
13
+ //# sourceMappingURL=webllm-XUBUNKFN.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudko.dev/agent-web",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Headless, configurable in-browser LLM agent on the Vercel AI SDK: multi-provider bring-your-own-key (OpenAI, Anthropic, Google, xAI, DeepSeek, gateway, openai-compatible) AND local WebGPU/WebLLM, native + prompted tool-calling, structured output, an encrypted IndexedDB token vault, and a plan → execute → replan → synthesize loop. UI-agnostic.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,22 +0,0 @@
1
- // src/providers/webllm.ts
2
- var isWebGPUAvailable = () => typeof navigator !== "undefined" && "gpu" in navigator;
3
- var createWebLLMModel = async (model, options) => {
4
- let mod;
5
- try {
6
- mod = await import("@browser-ai/web-llm");
7
- } catch {
8
- throw new Error(
9
- 'Local models require "@browser-ai/web-llm" and its peer "@mlc-ai/web-llm". Install: npm install @browser-ai/web-llm @mlc-ai/web-llm'
10
- );
11
- }
12
- return mod.webLLM(
13
- model,
14
- options
15
- );
16
- };
17
-
18
- export {
19
- isWebGPUAvailable,
20
- createWebLLMModel
21
- };
22
- //# sourceMappingURL=chunk-R7H4HSYT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/providers/webllm.ts"],"sourcesContent":["import type { LanguageModel } from 'ai'\n\n/** WebGPU feature-detect — WebLLM requires it. Call before offering local models. */\nexport const isWebGPUAvailable = (): boolean =>\n typeof navigator !== 'undefined' && 'gpu' in navigator\n\nexport interface WebLLMModelOptions {\n /**\n * Progress callback for weight download / engine init. `report.progress` is\n * 0..1. Forwarded to WebLLM's `initProgressCallback`.\n */\n initProgressCallback?: (report: { progress: number; text: string }) => void\n /** Any other @browser-ai/web-llm setting (temperature, worker handler, …). */\n [k: string]: unknown\n}\n\n/**\n * Build an AI SDK `LanguageModel` backed by WebLLM (WebGPU) via the community\n * provider `@browser-ai/web-llm` (an optional peer, dynamically imported so it\n * is code-split and never loads until a local model is actually used). Accepts\n * any WebLLM prebuilt model id, e.g. \"Llama-3.2-3B-Instruct-q4f16_1-MLC\".\n */\nexport const createWebLLMModel = async (\n model: string,\n options?: WebLLMModelOptions,\n): Promise<LanguageModel> => {\n let mod: typeof import('@browser-ai/web-llm')\n try {\n mod = await import('@browser-ai/web-llm')\n } catch {\n throw new Error(\n 'Local models require \"@browser-ai/web-llm\" and its peer \"@mlc-ai/web-llm\". Install: npm install @browser-ai/web-llm @mlc-ai/web-llm',\n )\n }\n // webLLM(modelId, settings) returns a LanguageModel. The model id is a strict\n // union in the provider's types; we accept any string and cast at the seam.\n return mod.webLLM(\n model as Parameters<typeof mod.webLLM>[0],\n options as Parameters<typeof mod.webLLM>[1],\n )\n}\n"],"mappings":";AAGO,IAAM,oBAAoB,MAC/B,OAAO,cAAc,eAAe,SAAS;AAkBxC,IAAM,oBAAoB,OAC/B,OACA,YAC2B;AAC3B,MAAI;AACJ,MAAI;AACF,UAAM,MAAM,OAAO,qBAAqB;AAAA,EAC1C,QAAQ;AACN,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAGA,SAAO,IAAI;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -1,9 +0,0 @@
1
- import {
2
- createWebLLMModel,
3
- isWebGPUAvailable
4
- } from "./chunk-R7H4HSYT.js";
5
- export {
6
- createWebLLMModel,
7
- isWebGPUAvailable
8
- };
9
- //# sourceMappingURL=webllm-IM3UD6YI.js.map