@dudko.dev/agent-web 0.0.51 → 0.0.53

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
@@ -297,8 +297,15 @@ SDK added — read `error.code` for the number. A paginated `tools/list` is
297
297
  followed for up to 100 pages (a repeated cursor ends the walk; past the cap a
298
298
  `warn` line says the rest is not mounted).
299
299
 
300
- `connectMcpHttp` returns `{ tools, catalog, results, instructions, protocols, refreshServer, close }`.
301
- `tools` and `catalog` are mutated **in place** by `refreshServer(name)`, so an
300
+ `connectMcpHttp` returns `{ tools, catalog, listed, results, instructions, protocols, refreshServer, close }`.
301
+ `listed` is EVERY tool each server listed, for a host's settings: the ones offered to the model
302
+ and the ones that are not (for its app only, or skipped), each with the key the consent rules
303
+ match (`server__tool`; one not mounted gets a key of its own after the mounted ones - `…_2` when
304
+ its name sanitizes to a mounted tool's -, so no two tools of a connection share one), `mounted`,
305
+ `title`, `readOnly`, `destructive` (MCP's reading of `destructiveHint`, which means something only
306
+ for a tool that is not read-only: there, true unless the server says false; never for a read-only
307
+ tool), the app it declares in `_meta.ui` whatever the apps mode (described only), and
308
+ `appCallable`. It changes nothing of what is mounted or sent. `tools`, `catalog` and `listed` are mutated **in place** by `refreshServer(name)`, so an
302
309
  agent built from them picks up a server's new tool list (react to it via the
303
310
  `onToolsChanged` option) without being rebuilt. Filtering is plain object work:
304
311
  delete the keys you don't want before merging.
@@ -451,11 +458,19 @@ const result = await mcp.apps!.callAppTool('travel', 'flights.book', args)
451
458
  - **Who may call what** (`_meta.ui.visibility`): a tool for its app only (`['app']`) is not
452
459
  mounted for the model; `appTool` / `callAppTool` refuse a tool whose visibility leaves out
453
460
  `'app'`, or that the server does not list - before anything is sent.
454
- - **Consent for an app's calls** - `agent.approveAppToolCall` - is the agent's own gate
455
- (`toolApproval`: its rules, handler and timeout) with two differences: under `'autopilot'` a
456
- write still asks (read-only tools run, as in `'ask-writes'`), and "always allow" given to an app
457
- is remembered for apps only. The request carries `app: { server, tool, resourceUri }`.
458
- `callAppTool` itself does not ask: call it after the consent.
461
+ - **Consent for an app's calls** - `agent.approveAppToolCall(call, onEvent?, signal?, options?)`
462
+ - is the agent's own gate (`toolApproval`: its mode, rules, handler and timeout), the same as
463
+ for the model's calls: `'autopilot'` asks nothing - writes and destructive tools included -,
464
+ an explicit rule still wins (`'ask'` asks, `'deny'` refuses), `'ask-writes'` asks before a write.
465
+ "Always allow" given to an app is remembered for apps only and for THAT app: `appGrantKey` - the
466
+ server's identity on its connection (`call.serverId`, from `McpAppTool.serverId`: opaque, new
467
+ for every connection, so a server removed and another added under the same name inherits
468
+ nothing), the tool and the app's resource - in `options.remembered` when the host passes a set
469
+ (it then outlives the agent: the React package keeps one for the page's life), else in the
470
+ agent's own. It never answers a rule nor outranks a refusal: a `'deny'` rule, `'read-only'` and
471
+ an `'ask'` rule are decided before it (the gate's one order, as for the model's calls - an
472
+ `'ask'` rule asks every time, and its request carries `rule`). The request carries `app: { server, tool, resourceUri }`. `callAppTool` itself does not
473
+ ask: call it after the consent.
459
474
 
460
475
  - **One server's apps off**: `McpHttpServerConfig.apps: false` (over the connection's `apps`) -
461
476
  that server is not told of apps, none of its apps is read, no `mcp.app` is told for it, and a
@@ -1088,7 +1103,7 @@ Details: [Several tabs](docs/capabilities.md#several-tabs) ·
1088
1103
  | `mcpSkills` | `{ consent: 'once-per-skill' }` | experimental: when a person is asked (`toolApproval.onRequest`, a request with `skill`) before an MCP server's skill enters the model's context, for servers whose `skills: { consent }` does not say - `'once-per-skill'`, `'ask'` (every run) or `'never'` - see [MCP skills](#mcp-skills-experimental-a-servers-instructions-as-skills) |
1089
1104
  | `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) |
1090
1105
  | `search` | off | the model may **search the web** (`web_search`: a short list of title / url / snippet): `{ engine: fn }` - a search engine of yours, any API (it may answer `{ results, usage }`: a search through a model is charged as phase `'search'`) - or `{ provider: 'google', credentialRef, model, baseURL, maxResults, allowPrivateNetwork, readOnly, fetch }` - Google Search through Gemini grounding: one extra `generateContent` call per search on a Gemini key (default model `gemini-2.5-flash-lite`), which **spends model tokens** (`usage` phase `'search'`) and returns **Google redirect links**, not the pages' URLs. No key ships with the library and none is written in the config (`credentialRef` names it in `credentials`); the request reaches only that API; with `egress`, results the model could not fetch are left out. Recipes for Tavily / Brave / SearXNG as an `engine`, the free-tier models and what the redirect links mean — see [Search](docs/capabilities.md#search-finding-the-page-to-fetch) |
1091
- | `media` | off | image generation, speech and transcription as tools, each mounted only when its model is set: `{ imageModel, imageInputs, fitReference, fitTimeoutMs, 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; `generate_image({ prompt, images? })` sends up to 4 reference pictures of the workspace (the person's photo, "like this") to an image model that takes them (`imageInputs`, else the model's own `supportsFileInputs`) - checked by their bytes and capped (4096 px, 8 MiB each, 12 MiB together); one that takes none makes the picture from the text and the result says so; a picture over those bounds is refused - or, with `fitReference`, sent as a smaller copy (the workspace file stays the original): `fitReferenceInWorker(() => new Worker(new URL('@dudko.dev/agent-web/fit-reference-worker', import.meta.url), { type: 'module' }))` runs the ready `fitReferenceImage` (the browser's `createImageBitmap` + `OffscreenCanvas`; JPEG for photos, PNG kept when it fits) in a Web Worker, so the page never waits on an encode; only an original within 50 MiB / 200 MP (read from its header) is ever handed over, the copy is checked again, the result lists it in `references.fitted`, and `fitTimeoutMs` (30 000) bounds each call; 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) |
1106
+ | `media` | off | image generation, speech and transcription as tools, each mounted only when its model is set: `{ imageModel, imageInputs, fitReference, fitTimeoutMs, viewGenerated, 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 - and, with `viewGenerated` (on by default where the executor's model reads pictures and its adapter carries a picture in a tool result: Gemini, Claude, OpenAI's Responses API, xAI, DeepSeek - never Chat Completions or an OpenAI-compatible endpoint), the picture `generate_image` made ONCE, in the next request only, at most 1568 px / 3.75 MiB (a larger one as `fitReference`'s copy or not at all; ~1 100-1 600 tokens), never in an event, the result, a checkpoint or memory; `generate_image({ prompt, images? })` sends up to 4 reference pictures of the workspace (the person's photo, "like this") to an image model that takes them (`imageInputs`, else the model's own `supportsFileInputs`) - checked by their bytes and capped (4096 px, 8 MiB each, 12 MiB together); one that takes none makes the picture from the text and the result says so; a picture over those bounds is refused - or, with `fitReference`, sent as a smaller copy (the workspace file stays the original): `fitReferenceInWorker(() => new Worker(new URL('@dudko.dev/agent-web/fit-reference-worker', import.meta.url), { type: 'module' }))` runs the ready `fitReferenceImage` (the browser's `createImageBitmap` + `OffscreenCanvas`; JPEG for photos, PNG kept when it fits) in a Web Worker, so the page never waits on an encode; only an original within 50 MiB / 200 MP (read from its header) is ever handed over, the copy is checked again, the result lists it in `references.fitted`, and `fitTimeoutMs` (30 000) bounds each call; 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) |
1092
1107
  | `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) |
1093
1108
  | `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 |
1094
1109
  | `askUser` | off | the **model** may ask the person ONE closed question with buttons instead of guessing (the built-in `ask_user`: a question, 2-6 options, optionally `multiple` or `allowOther`): `{ onQuestion(req, { signal }), timeoutMs, maxPerRun }`. `onQuestion` answers `{ choice: [label] }`, `{ other: text }` or `{ declined: true }`; without it there is no tool (`true` / `{}` = the handler comes later, e.g. from `useAgent`). At most `maxPerRun` (3) per run, helpers and subagents included; each waits `timeoutMs` (300000; the step's limit stops meanwhile), a stop ends the wait. Events `user.question-asked` / `user.question-answered` (the labels picked, never the person's own words). The question and options are the model's text, cleaned: render them as plain text. See [Asking the user](docs/capabilities.md#asking-the-user-a-question-with-choices) |