@dudko.dev/agent-web 0.0.38 → 0.0.39
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 +24 -4
- package/dist/agent-web.js +172 -142
- package/dist/agent-web.js.map +1 -1
- package/dist/{chunk-Y7OGKYE5.js → chunk-3V27UZT6.js} +35 -9
- package/dist/chunk-3V27UZT6.js.map +1 -0
- package/dist/chunk-A6ZJALLU.js +254 -0
- package/dist/chunk-A6ZJALLU.js.map +1 -0
- package/dist/{chunk-AY2BZYZY.js → chunk-TZITKUFW.js} +238 -11
- package/dist/chunk-TZITKUFW.js.map +1 -0
- package/dist/index.cjs +3188 -447
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1372 -342
- package/dist/index.d.ts +1372 -342
- package/dist/index.js +2568 -198
- package/dist/index.js.map +1 -1
- package/dist/mcp.cjs +152 -11
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +39 -2
- package/dist/mcp.d.ts +39 -2
- package/dist/mcp.js +63 -13
- package/dist/mcp.js.map +1 -1
- package/dist/{sandbox-AMO2SA4X.js → sandbox-KG6OUG24.js} +2 -2
- package/dist/{webllm-PCPDLDQA.js → webllm-BEL5A4OF.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-AY2BZYZY.js.map +0 -1
- package/dist/chunk-T6LZW7ML.js +0 -124
- package/dist/chunk-T6LZW7ML.js.map +0 -1
- package/dist/chunk-Y7OGKYE5.js.map +0 -1
- /package/dist/{sandbox-AMO2SA4X.js.map → sandbox-KG6OUG24.js.map} +0 -0
- /package/dist/{webllm-PCPDLDQA.js.map → webllm-BEL5A4OF.js.map} +0 -0
package/README.md
CHANGED
|
@@ -219,7 +219,16 @@ read-only by the consent gate. A failing server is reported in `results`; the
|
|
|
219
219
|
others still mount. With hundreds of tools the agent switches to tool search
|
|
220
220
|
automatically (see [docs/capabilities.md](docs/capabilities.md#large-tool-catalogues-several-mcp-servers)).
|
|
221
221
|
|
|
222
|
-
`
|
|
222
|
+
A server's `instructions` (from its `initialize` result) reach the planner's and
|
|
223
|
+
the executor's system prompts, marked as third-party text and capped; a tool's
|
|
224
|
+
`structuredContent` reaches the model once, as JSON, and a result that breaks
|
|
225
|
+
its `outputSchema` is passed on with a note instead of failing the call. See
|
|
226
|
+
[docs/capabilities.md](docs/capabilities.md#mcp-server-instructions-and-structured-results);
|
|
227
|
+
the instructions are a prompt-injection surface
|
|
228
|
+
([docs/security.md](docs/security.md#mcp-server-instructions-third-party-text-in-a-system-prompt)) —
|
|
229
|
+
`mcpInstructions: false` switches them off.
|
|
230
|
+
|
|
231
|
+
`connectMcpHttp` returns `{ tools, catalog, results, instructions, refreshServer, close }`.
|
|
223
232
|
`tools` and `catalog` are mutated **in place** by `refreshServer(name)`, so an
|
|
224
233
|
agent built from them picks up a server's new tool list (react to it via the
|
|
225
234
|
`onToolsChanged` option) without being rebuilt. Filtering is plain object work:
|
|
@@ -452,12 +461,15 @@ needs. Subagents are tools too — `createSubagentTool({ config })` runs a child
|
|
|
452
461
|
agent in-process, `createSubagentTool({ worker, workerConfig })` isolates it in a
|
|
453
462
|
Web Worker served by `serveSubagentWorker()`. Add `profiles` and the parent model
|
|
454
463
|
chooses, per call, between named variants of the same subagent — another model,
|
|
455
|
-
thinking level, limits or system prompt.
|
|
464
|
+
thinking level, limits or system prompt. With `subagents: { dynamic: true }` the model
|
|
465
|
+
starts helpers itself (`spawn_subagent`): a sub-task, an optional role and a subset of its own
|
|
466
|
+
tools — a helper can only have less than the run that starts it, and its spend counts against
|
|
467
|
+
that run's limits. Give `persistence` a store
|
|
456
468
|
(`new IndexedDBRunStore()`) and a run interrupted by a reload or a crash resumes from its
|
|
457
469
|
last checkpoint with `run('', { resumeFromRunId })` — the planner does not run again and
|
|
458
470
|
no finished step is repeated. `createRunControl()` steers a run that is going: `send()`
|
|
459
471
|
puts a message in front of the model at the next boundary (the replanner re-checks the plan
|
|
460
|
-
against it), `stopSubagent(id)` stops one subagent. `egress` (off by default) gives the model one safe `web_fetch` tool with allow / deny lists. `sandbox` (off by default) gives the model `run_js`: the code it wrote runs in QuickJS-in-WebAssembly inside a Web Worker that is killed at the deadline, so "I ran it" is a tool call you can see. `learning` (off by default) lets the agent write down what it figured out as skills of its own — in memory, or in the file system across sessions. Details, defaults and events:
|
|
472
|
+
against it), `stopSubagent(id)` stops one subagent. `egress` (off by default) gives the model one safe `web_fetch` tool with allow / deny lists. `search` (off by default) adds `web_search` over a search API you name (Tavily, Brave through a gateway, your SearXNG) or a function of yours — the key stays in the credential store. `sandbox` (off by default) gives the model `run_js`: the code it wrote runs in QuickJS-in-WebAssembly inside a Web Worker that is killed at the deadline, so "I ran it" is a tool call you can see. `media` (off by default) mounts `generate_image`, `generate_speech` and `transcribe_audio` — each only when you configure its model — writes what they make into the virtual file system instead of the context, and turns attached audio into text for a model that cannot listen. `learning` (off by default) lets the agent write down what it figured out as skills of its own — in memory, or in the file system across sessions. Details, defaults and events:
|
|
461
473
|
**[docs/capabilities.md](docs/capabilities.md)**.
|
|
462
474
|
|
|
463
475
|
## Pipelines: a graph of agents
|
|
@@ -522,6 +534,8 @@ Loading a definition someone else wrote: [docs/security.md](docs/security.md#pip
|
|
|
522
534
|
| --- | --- | --- |
|
|
523
535
|
| `model` | — | a `LanguageModel` or `ProviderModelSpec` (the executor/default) |
|
|
524
536
|
| `planner` / `synthesizer` | = `model` | per-stage model overrides (inherit base provider/creds if partial) |
|
|
537
|
+
| `executorTiers` | off | `{ light?, standard?, strong? }`, each a model like `planner`: the planner rates every step low / medium / high and the executor runs it on that tier's model; a tier that is not configured falls back to the nearest one; the smallest window among them governs the run ([model tiers](docs/capabilities.md#model-tiers-and-escalation)) |
|
|
538
|
+
| `escalation` | on with tiers | `false`, or `{ maxPerStep?, maxPerRun? }` (1 / 3): a step that fails in a way a stronger model could fix is retried on the next stronger tier before the replanner is asked - continuing the step, never writing twice. Nothing without tiers |
|
|
525
539
|
| `credentials` | — | a `CredentialStore` for `credentialRef` keys |
|
|
526
540
|
| `tools` | `{}` | host tools (`defineTool`) |
|
|
527
541
|
| `availableTools` / `excludedTools` | — | whitelist / blacklist of tool names mounted from `tools` |
|
|
@@ -530,6 +544,11 @@ Loading a definition someone else wrote: [docs/security.md](docs/security.md#pip
|
|
|
530
544
|
| `toolApproval` | autopilot | consent policy: `{ mode, rules, onRequest, timeoutMs }`; `agent.setToolApprovalMode()` |
|
|
531
545
|
| `skills` | — | SKILL.md bundles (`defineSkill` / `parseSkillMarkdown` / `loadSkillFromUrl`) |
|
|
532
546
|
| `egress` | off | what the **model** may fetch (`web_fetch`): `true` = any public host over https, or `{ allow, deny, protocols, allowPrivateNetwork, fetch, ... }`; a browser can't pin DNS, so prefer an `allow` list — see [Egress](docs/capabilities.md#egress-what-the-model-may-fetch) |
|
|
547
|
+
| `search` | off | the model may **search the web** (`web_search`: a short list of title / url / snippet): `{ provider: 'tavily' \| 'brave' \| 'searxng', credentialRef, baseURL, maxResults, allowPrivateNetwork, readOnly, fetch }` or `{ engine: fn }`. No key ships with the library and none is written in the config (`credentialRef` names it in `credentials`); the request reaches only the search API; with `egress`, results the model could not fetch are left out. Brave needs a gateway from a page (no CORS) — see [Search](docs/capabilities.md#search-finding-the-page-to-fetch) |
|
|
548
|
+
| `media` | off | image generation, speech and transcription as tools, each mounted only when its model is set: `{ imageModel, speechModel, transcriptionModel, maxCalls, timeoutMs, files, folder, voice, speechFormat, transcribeAttachments }`. A model is an AI SDK image / speech / transcription model object or a `ProviderModelSpec` (key by `credentialRef`). Generated files go to the virtual file system and the model gets a path, never the bytes; attached audio is transcribed to text; calls are counted in `usage.mediaCalls` (and the other media fields) and capped per run — see [Media](docs/capabilities.md#media-images-speech-and-transcription) |
|
|
549
|
+
| `decisionModel` | off | a **decision model** - answers a closed question with one option and a probability instead of writing text: `{ providerType: 'google', model: 'gemini-decision-1', credentialRef }` (the key stays in `credentials`; the request reaches only that API) or an object with `decide(question, { abortSignal })`. Where it is confident it replaces the replanner's continue / finish call and a pipeline node's route call; never consulted for tool approval or egress — see [Decision models](docs/capabilities.md#decision-models) |
|
|
550
|
+
| `decision` | `{}` | `{ confidenceThreshold, timeoutMs, replan, route }` (defaults 0.8, 5000 ms, on, on): below the threshold, on an error, a timeout or an answer that is not an option, the ordinary model call runs unchanged |
|
|
551
|
+
| `subagents` | off | the **model** may start helper agents itself (`spawn_subagent`): `{ dynamic: true }`, or `{ dynamic: { maxDepth, maxChildren, maxConcurrent, budgetShare, minTokens, timeoutMs, defaultTools } }`. A helper gets a subset of the caller's tools by name (read-only ones by default), a share of what is left of its budgets, the same models and the same consent gate — it can only have less than the run that starts it. See [docs/capabilities.md](docs/capabilities.md#dynamic-subagents-helpers-the-model-starts-itself) |
|
|
533
552
|
| `sandbox` | off | the model may **run JavaScript it wrote** (`run_js`) and read the real output: `true`, or `{ worker, timeoutMs, memoryLimitBytes, maxOutputChars, maxCodeChars, files, engine }`. QuickJS in WebAssembly (optional peer `quickjs-emscripten`), in a Web Worker you supply (`@dudko.dev/agent-web/sandbox-worker`) that is killed at the deadline; with `createFileTools` the guest can import / require workspace files and use `fs` — see [Running code](docs/capabilities.md#running-code-the-sandbox) |
|
|
534
553
|
| `learning` | off | the agent writes down lessons as skills (`save_skill` / `forget_skill`): `true` = this session, `{ store: new VfsSkillStore(vfs) }` = across sessions — see [Learning](docs/capabilities.md#learning-lessons-that-outlive-the-task) |
|
|
535
554
|
| `thinking` / `stageThinking` | provider default | `true`, a level (`'low'`…`'xhigh'`, `'none'`), or `{ level, budgetTokens, includeThoughts }` |
|
|
@@ -539,6 +558,7 @@ Loading a definition someone else wrote: [docs/security.md](docs/security.md#pip
|
|
|
539
558
|
| `promptCaching` | `true` | stable system prefixes, Anthropic breakpoints, OpenAI cache key |
|
|
540
559
|
| `vision` / `inputs` | inferred | what the model takes as attachments (`run(goal, { images, files })`); see `agent.capabilities` |
|
|
541
560
|
| `systemPrompt` / `prompts` | — | prepended to every phase / override any phase's prompt builder |
|
|
561
|
+
| `mcpInstructions` | `true` | show the model the `instructions` MCP servers send on connect (planner + executor, marked third-party, capped); `false` keeps them out |
|
|
542
562
|
| `describeState` | — | serialize world state into prompt context |
|
|
543
563
|
| `memory` | — | `ContextStore` (`IndexedDBStore` / `MemoryStore`); recent turns are read back into the planner prompt |
|
|
544
564
|
| `sessionId` | — | names the stored conversation in `memory`, and the bucket `agent.sessionUsage()` counts into |
|
|
@@ -546,7 +566,7 @@ Loading a definition someone else wrote: [docs/security.md](docs/security.md#pip
|
|
|
546
566
|
| `maxIterations` / `maxStepsPerTask` / `maxRevisions` | 8 / 4 / 2 | loop caps |
|
|
547
567
|
| `chatTimeoutMs` | 120000 | per-call watchdog |
|
|
548
568
|
| `temperature` | provider default | sampling temperature for every stage |
|
|
549
|
-
| `budgets` | — | legacy per-phase output caps; `limits.perCall` wins, and the defaults are shares of the model's window |
|
|
569
|
+
| `budgets` | — | legacy per-phase output caps; `limits.perCall` wins, `0` = no cap, and the defaults are shares of the model's window (none for a phase that thinks) |
|
|
550
570
|
| `clientName` | — | sent as the openai-compatible provider name and the MCP client name |
|
|
551
571
|
| `logLevel` / `logger` | `'warn'` / `console` | verbosity (`'silent' \| 'error' \| 'warn' \| 'info' \| 'debug'`) and the console-like sink the logs go to |
|
|
552
572
|
| `replan` / `synthesize` | `true` | toggle phases |
|