@dudko.dev/agent-web 0.0.20 → 0.0.22

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/README.md CHANGED
@@ -134,11 +134,11 @@ const result = await agent.run('Add a centered title and a totals line', {
134
134
  console.log(result.final, `— ${result.applied} changes`)
135
135
  ```
136
136
 
137
- > **Direct browser calls & CORS:** not every provider allows direct BYOK calls
138
- > from a browser origin. Google (Gemini) and openai-compatible/gateway are the
139
- > reliable direct paths; Anthropic works (a required header is injected for you);
140
- > OpenAI/xAI/DeepSeek usually need a proxy. See
141
- > [docs/providers.md](docs/providers.md).
137
+ > **Direct browser calls & CORS:** as of October 2026 Google, OpenAI, xAI and
138
+ > DeepSeek send CORS headers, so a user's own key works straight from the page;
139
+ > Anthropic works too (a required header is injected for you). Kimi, Groq,
140
+ > Mistral and OpenRouter do as well (build their AI SDK models yourself and pass
141
+ > them as `model`). See [docs/providers.md](docs/providers.md).
142
142
 
143
143
  ## Quick start — local WebGPU model (no key, offline)
144
144
 
@@ -149,13 +149,19 @@ if (!isWebGPUAvailable()) throw new Error('WebGPU required for local models')
149
149
 
150
150
  const model = await createWebLLMModel('Llama-3.2-3B-Instruct-q4f16_1-MLC', {
151
151
  initProgressCallback: (r) => console.log('loading', Math.round(r.progress * 100), '%'),
152
+ contextWindowTokens: 8192, // WebLLM loads with 4096 unless told otherwise
152
153
  })
153
154
 
154
- // Local models default to the robust "prompted" tool-mode automatically.
155
+ // Local models default to the robust "prompted" tool-mode automatically, and
156
+ // the agent sizes compaction and tool lists from the model's own window.
155
157
  const agent = await createAgent({ model, tools /* ...same as above */ })
156
158
  await agent.run('Summarize the current page and add a heading')
157
159
  ```
158
160
 
161
+ A local **vision** model (`Phi-3.5-vision-instruct-q4f16_1-MLC`) takes images
162
+ like a cloud one. See [docs/capabilities.md](docs/capabilities.md#the-models-window-is-a-hard-limit)
163
+ for the window: WebLLM's default is 4096 tokens, raised per model at load.
164
+
159
165
  You can also pass a model by spec: `{ providerType: 'web-llm', model: '…' }`.
160
166
 
161
167
  ## Simple generation & tool-calling (no agent loop)
@@ -326,13 +332,13 @@ Web Worker served by `serveSubagentWorker()`. Details, defaults and events:
326
332
  | `tools` | `{}` | host tools (`defineTool`) |
327
333
  | `availableTools` / `excludedTools` | — | whitelist / blacklist of tool names mounted from `tools` |
328
334
  | `toolMode` | `'auto'` | `native` \| `prompted` \| `auto` (cloud→native, local→prompted) |
329
- | `toolSelectionStrategy` | `'auto'` | `all` \| `plan-narrowed` \| `search` \| `auto` (search above `toolSearchThreshold`, 40) |
335
+ | `toolSelectionStrategy` | `'auto'` | `all` \| `plan-narrowed` \| `search` \| `auto` (search above `toolSearchThreshold`, 40, or once the definitions take ¼ of the window) |
330
336
  | `toolApproval` | autopilot | consent policy: `{ mode, rules, onRequest, timeoutMs }`; `agent.setToolApprovalMode()` |
331
337
  | `skills` | — | SKILL.md bundles (`defineSkill` / `parseSkillMarkdown` / `loadSkillFromUrl`) |
332
338
  | `thinking` / `stageThinking` | provider default | `true`, a level (`'low'`…`'xhigh'`, `'none'`), or `{ level, budgetTokens, includeThoughts }` |
333
339
  | `limits` | — | run caps `maxInputTokens` / `maxOutputTokens` / `maxReasoningTokens` / `maxTotalTokens` + `perCall` output caps |
334
340
  | `maxToolCalls` / `maxPlanSteps` | ∞ / 8 | tool calls per run / steps per plan |
335
- | `compaction` | auto, ½ of 128k | `{ auto, contextWindowTokens, thresholdTokens, keepRecentTurns, keepRecentSteps, maxToolOutputChars }` |
341
+ | `compaction` | auto, ½ of 128k (a local model: its own window) | `{ auto, contextWindowTokens, thresholdTokens, keepRecentTurns, keepRecentSteps, maxToolOutputChars }` — never more than the model's window |
336
342
  | `promptCaching` | `true` | stable system prefixes, Anthropic breakpoints, OpenAI cache key |
337
343
  | `vision` / `inputs` | inferred | what the model takes as attachments (`run(goal, { images, files })`); see `agent.capabilities` |
338
344
  | `systemPrompt` | — | prepended to every phase |