@dudko.dev/agent-web-react 0.0.29 → 0.0.31
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 +360 -19
- package/dist/{chunk-UUB7CE6N.js → chunk-EMF7DTGS.js} +69 -1
- package/dist/chunk-EMF7DTGS.js.map +1 -0
- package/dist/chunk-FXHQXIOU.js +94 -0
- package/dist/chunk-FXHQXIOU.js.map +1 -0
- package/dist/chunk-VMCWL6VH.js +294 -0
- package/dist/chunk-VMCWL6VH.js.map +1 -0
- package/dist/elicitation-DbW6QKxS.d.cts +1537 -0
- package/dist/elicitation-DbW6QKxS.d.ts +1537 -0
- package/dist/index.cjs +4364 -618
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +712 -433
- package/dist/index.d.ts +712 -433
- package/dist/index.js +4033 -628
- package/dist/index.js.map +1 -1
- package/dist/mcp-app-policy-DIUmGPJP.d.cts +55 -0
- package/dist/mcp-app-policy-DIUmGPJP.d.ts +55 -0
- package/dist/mcp-app-sandbox.cjs +313 -0
- package/dist/mcp-app-sandbox.cjs.map +1 -0
- package/dist/mcp-app-sandbox.d.cts +65 -0
- package/dist/mcp-app-sandbox.d.ts +65 -0
- package/dist/mcp-app-sandbox.js +201 -0
- package/dist/mcp-app-sandbox.js.map +1 -0
- package/dist/mcp.cjs +322 -42
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +185 -96
- package/dist/mcp.d.ts +185 -96
- package/dist/mcp.js +240 -46
- package/dist/mcp.js.map +1 -1
- package/dist/pipeline.cjs.map +1 -1
- package/dist/pipeline.js +1 -1
- package/dist/styles.css +1140 -0
- package/package.json +13 -3
- package/dist/chunk-UUB7CE6N.js.map +0 -1
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ app with a single hook and (optionally) a set of pre-styled components:
|
|
|
33
33
|
`forgetSkill`) and the pages it fetched — see
|
|
34
34
|
[docs/chat.md](docs/chat.md#talking-to-the-agent-while-it-works).
|
|
35
35
|
- 🧩 **Building blocks** — `<AgentComposer>`, `<MessageList>`, `<StepList>`,
|
|
36
|
-
`<ToolApprovalPrompt>`, `<ApprovalModeSwitch>`, `<ChatHistoryList>`, `<FilesPanel>`,
|
|
36
|
+
`<ToolApprovalPrompt>`, `<ElicitationPrompt>`, `<ApprovalModeSwitch>`, `<ChatHistoryList>`, `<FilesPanel>`,
|
|
37
37
|
`<LearnedSkills>`, `<ContextMeter>`, `<PlanView>`, `<ModelLoadBar>`, `<UsageBadge>`, `<ApiKeyForm>`; hooks `useChatHistory`,
|
|
38
38
|
`useVirtualFiles`, `useSpeechToText`; MCP hooks `useMcp` / `useMcpServers` live in
|
|
39
39
|
[`@dudko.dev/agent-web-react/mcp`](#mcp-hooks-live-in-their-own-subpath).
|
|
@@ -197,8 +197,9 @@ function Custom() {
|
|
|
197
197
|
| `plan` / `steps` | the live plan and per-step tool calls (with timing) |
|
|
198
198
|
| `finalText` / `finalReasoning` | the streamed answer and its thoughts |
|
|
199
199
|
| `usage` / `totalUsage` | tokens of this run / of the conversation, by kind - plus `mediaCalls` and `decisionCalls` (calls, not tokens) when the run made some |
|
|
200
|
-
| `pendingApprovals`, `approve(id, { remember })`, `deny(id)` | tool consent (a request made by a helper the model started carries `subagent: { id, depth, name?, role? }`) |
|
|
200
|
+
| `pendingApprovals`, `approve(id, { remember })`, `deny(id)` | tool consent (a request made by a helper the model started carries `subagent: { id, depth, name?, role? }`). A request the core stops waiting for - no decision within `toolApproval.timeoutMs` (default five minutes), the run stopped - is settled by the core and leaves the list; a late `approve` does nothing |
|
|
201
201
|
| `approvalMode` / `setApprovalMode(mode)` | the autopilot switch, live |
|
|
202
|
+
| `approveAppToolCall(call, signal)` / `sampleForApp(request, approve, signal)` | for MCP Apps: an app's tool call through the agent's consent gate; an app's `sampling/createMessage` answered by the agent's model (the core's `Agent.sampleForApp`: checked, rate-limited, put to `approve`, no tools, none of the chat; its tokens count in `totalUsage` only, the answer goes to the caller only) - `<AgentChat>` wires both |
|
|
202
203
|
| `compact()` | summarise the stored transcript now |
|
|
203
204
|
| `sessionId` / `loadChat(chat)` | the memory session; switch conversations |
|
|
204
205
|
| `subagents`, `skills`, `discoveredTools`, `compactions`, `budget` | the rest of the run, folded. `subagents` is a **tree**: static subagents and the helpers the model started (`subagents.dynamic`), each node with `parentId` / `depth`, status, model, tokens, tool calls and time; `subagentTree(subagents)` nests it - see [docs/chat.md](docs/chat.md#subagents-and-helpers-the-tree) |
|
|
@@ -211,7 +212,10 @@ function Custom() {
|
|
|
211
212
|
|
|
212
213
|
**Options:** `deps` (rebuild the agent when these change — e.g. on a model
|
|
213
214
|
switch), `onEvent` (tap the raw event stream), `autoStart`, `maxEvents`,
|
|
214
|
-
`approvals` (route consent requests into the hook; default true).
|
|
215
|
+
`approvals` (route consent requests into the hook; default true). The queue behind `approve` /
|
|
216
|
+
`deny` is exported for a host that builds the core's agent itself: `createApprovalQueue()` gives
|
|
217
|
+
`handler` (pass it as `toolApproval.onRequest`; a request whose `signal` aborts leaves the queue),
|
|
218
|
+
`approve(id, { remember })`, `deny(id, reason)`, `settleAll(decision)` and `pending()`.
|
|
215
219
|
|
|
216
220
|
> Keep `tools` and `describeState` referentially stable (`useMemo` /
|
|
217
221
|
> `useCallback`); pass a changed `deps` array to rebuild the agent on a
|
|
@@ -436,10 +440,14 @@ await mcp.connect({ url, oauth: true }) // or { url, headers: { Authorizat
|
|
|
436
440
|
const config = { model, tools: { ...myTools, ...mcp.tools } }
|
|
437
441
|
```
|
|
438
442
|
|
|
439
|
-
`useMcp` returns `{ status, tools, catalog, instructions, error, authorizationUrl,
|
|
440
|
-
oauthSupported, completingAuthorization,
|
|
441
|
-
forgetAuthorization, checkOAuthSupport }`. `status` is
|
|
442
|
-
`idle | connecting | connected | needs-authorization | error`.
|
|
443
|
+
`useMcp` returns `{ status, tools, catalog, instructions, protocol, error, authorizationUrl,
|
|
444
|
+
oauthSupported, completingAuthorization, pendingElicitations, answerElicitation, connect,
|
|
445
|
+
disconnect, authorize, forgetAuthorization, checkOAuthSupport }`. `status` is
|
|
446
|
+
`idle | connecting | connected | needs-authorization | error`. `protocol` is the revision
|
|
447
|
+
negotiated with the connected server (`{ server, version, era }`, e.g. `2025-11-25` / `legacy` or
|
|
448
|
+
`2026-07-28` / `modern`; absent until connected, and on a core that does not report it).
|
|
449
|
+
`pendingElicitations` / `answerElicitation` are the server's questions to the user - see
|
|
450
|
+
[MCP elicitation](#mcp-elicitation--a-server-asks-the-user).
|
|
443
451
|
|
|
444
452
|
`instructions` is what the connected server told the agent in its handshake (MCP `instructions`),
|
|
445
453
|
when it sent any. The core puts that text into the system prompt of an agent that uses the
|
|
@@ -460,8 +468,11 @@ Options:
|
|
|
460
468
|
| `useMcp({ clientName })` | the MCP client name, and the `client_name` of a dynamic registration |
|
|
461
469
|
| `useMcp({ clientMetadataUrl })` | the URL of a **client ID metadata document** (CIMD) your app hosts, for every OAuth server - see below |
|
|
462
470
|
| `useMcp({ onLog })` | connector log lines |
|
|
471
|
+
| `useMcp({ elicitation })` | let a server ask the user something in the middle of a tool call: `true`, or the core's settings `{ url, timeoutMs, maxPerToolCall, maxPerRun, subagents }`. Off by default - see [MCP elicitation](#mcp-elicitation--a-server-asks-the-user) |
|
|
463
472
|
| `connect({ url, name, headers })` | the endpoint, the tool prefix (`"<name>__<tool>"`, default `mcp`), static headers |
|
|
464
|
-
| `connect({ oauth })` | `true`, or `{ redirectUrl, scope, clientName, clientMetadataUrl }` (`McpOAuthOptions`) - each overrides the hook-level value for this server |
|
|
473
|
+
| `connect({ oauth })` | `true`, or `{ redirectUrl, scope, clientName, clientMetadataUrl, registration }` (`McpOAuthOptions`) - each overrides the hook-level value for this server; `registration` is below |
|
|
474
|
+
| `connect({ protocol })` | the MCP protocol revisions this connection may use: `'legacy'` (the 2025 revisions), `'auto'` (2026-07-28 when the server offers it, the 2025 ones otherwise) or `'modern'` (2026-07-28 only). Left out, nothing is passed and the core speaks the 2025 revisions, exactly as before. Kept across the OAuth redirect. See [the protocol revision](#the-protocol-revision) |
|
|
475
|
+
| `connect({ skills })` | **experimental**: load the skills the server serves (the MCP Skills extension) into the agent's skills catalog, as `<server>/<skill>`. They come with `tools` - nothing else to wire. Needs `protocol: 'auto'` or `'modern'`. `true`, or `{ consent: 'once-per-skill' \| 'ask' \| 'never', dynamic?: boolean }` (`consent`: when a person is asked before one of its skills enters the agent's context; `dynamic: true`: its generated skills too, no checksums - see [MCP skills](#mcp-skills-experimental); `McpSkillsSetting`, `mcpSkillsSettingOf`). Off (left out) by default. Kept across the OAuth redirect. See [MCP skills](#mcp-skills-experimental) |
|
|
465
476
|
|
|
466
477
|
**`clientMetadataUrl` (CIMD).** Instead of registering itself with every authorization server, an
|
|
467
478
|
app can publish one JSON document that describes it and use that document's URL as its
|
|
@@ -488,6 +499,30 @@ with the rest of the server's OAuth details across the redirect and reloads. The
|
|
|
488
499
|
[security notes](https://github.com/dudko-dev/agents/blob/main/packages/agent-web/docs/security.md)
|
|
489
500
|
say what the document must contain.
|
|
490
501
|
|
|
502
|
+
**`oauth.registration`: CIMD, DCR, or whichever the server supports.** Per server, `'auto'` (the
|
|
503
|
+
default - the document where the server supports it, dynamic registration elsewhere), `'cimd'` (the
|
|
504
|
+
document only) or `'dcr'` (dynamic registration only, even with a `clientMetadataUrl`), handed to
|
|
505
|
+
the core's provider of the same name:
|
|
506
|
+
|
|
507
|
+
```tsx
|
|
508
|
+
await mcp.connect({ url, oauth: { registration: 'cimd' } }) // with useMcp({ clientMetadataUrl })
|
|
509
|
+
mcp.oauthRegistration // 'cimd' | 'dcr', once connected: which way was taken
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
Under `'cimd'` a server whose authorization server does not support documents ends in
|
|
513
|
+
`status: 'error'` with the core's reason - `… does not support client ID metadata documents (CIMD),
|
|
514
|
+
which this connection requires (registration: 'cimd') - nothing was sent to its registration
|
|
515
|
+
endpoint` - and is never offered for authorization; `'cimd'` with no `clientMetadataUrl` fails the
|
|
516
|
+
same way before any request. A client stored for the server under the other kind is not reused:
|
|
517
|
+
the core forgets it and its tokens, and the user signs in again. The setting is kept across the
|
|
518
|
+
redirect (and, in `useMcpServers`, with the server list); `oauthRegistration` (`useMcp`) /
|
|
519
|
+
`servers[i].oauthRegistration` (`useMcpServers`) is `'cimd'` or `'dcr'` while the server is
|
|
520
|
+
connected with OAuth, read from the core's `registrationKind()`. A core older than the option
|
|
521
|
+
would ignore it and register the old way, so the hooks refuse `'cimd'` / `'dcr'` there
|
|
522
|
+
(`status: 'error'`); `'auto'` and no value work with any core. The helpers the hooks use are
|
|
523
|
+
exported from `./mcp`: `newMcpOAuthProvider`, `mcpOAuthRecordOf` / `mcpOAuthOptionsOfRecord` (what
|
|
524
|
+
the redirect record keeps) and `mcpOAuthRegistrationOf`.
|
|
525
|
+
|
|
491
526
|
Two notes:
|
|
492
527
|
|
|
493
528
|
- The connector lives in the core's optional `@dudko.dev/agent-web/mcp` subpath
|
|
@@ -497,11 +532,13 @@ Two notes:
|
|
|
497
532
|
hooks is what puts it in your build.
|
|
498
533
|
- `oauthSupported` is `false` on cores older than `@dudko.dev/agent-web@0.0.9`,
|
|
499
534
|
which introduced `BrowserOAuthProvider`; header auth still works there. The
|
|
500
|
-
peer floor is `>=0.0.
|
|
501
|
-
|
|
502
|
-
|
|
535
|
+
peer floor is `>=0.0.41` — the first core with MCP Apps (`approveAppToolCall`,
|
|
536
|
+
`sampleForApp`), MCP skills with consent, `file.written`, elicitation and the
|
|
537
|
+
OAuth `registration` choice this package's chat and hooks use, on top of model
|
|
538
|
+
tiers, dynamic subagents, media and decision models, pipelines, the learning
|
|
503
539
|
notebook, the virtual file system, attachments, consent, tool search, subagents,
|
|
504
|
-
steering and context editing
|
|
540
|
+
steering and context editing. `skills: { dynamic: true }` needs a core 0.0.42 or
|
|
541
|
+
later: an older one declines those skills.
|
|
505
542
|
|
|
506
543
|
## Several MCP servers — `useMcpServers`
|
|
507
544
|
|
|
@@ -514,14 +551,24 @@ mcp.servers // [{ name, url, status, catalog, instructions, error, … }]
|
|
|
514
551
|
const config = { model, tools: { ...myTools, ...mcp.tools } } // "<name>__<tool>"
|
|
515
552
|
```
|
|
516
553
|
|
|
517
|
-
`useMcpServers` takes the options of `useMcp` (`clientName`, `clientMetadataUrl`, `onLog
|
|
518
|
-
`persist`, `storageKey`, `autoConnect` and `connectTimeoutMs
|
|
519
|
-
`
|
|
520
|
-
|
|
554
|
+
`useMcpServers` takes the options of `useMcp` (`clientName`, `clientMetadataUrl`, `onLog`,
|
|
555
|
+
`elicitation`) plus `persist`, `storageKey`, `autoConnect` and `connectTimeoutMs`, and returns
|
|
556
|
+
`{ servers, tools, catalog, protocols, connectedCount, pendingElicitations, answerElicitation, … }`.
|
|
557
|
+
A server may be added with its own `protocol` (`add({ name, url, protocol: 'auto' })`),
|
|
558
|
+
`skills: true` or `{ consent, dynamic }` ([MCP skills](#mcp-skills-experimental); `servers[i].skills`) and `apps: false`
|
|
559
|
+
(that server's [MCP Apps](#mcp-apps--a-servers-interface-in-the-chat) off while the others' are
|
|
560
|
+
shown; `servers[i].apps`), all remembered with the list; `servers[i].protocolMode` is what it was added with and
|
|
561
|
+
`servers[i].protocol` (`{ version, era }`) what was negotiated while it is connected - `protocols`
|
|
562
|
+
lists them for every connected server. A server added with
|
|
563
|
+
`auth: 'oauth'` may carry its own `oauth: { redirectUrl, scope, clientName, clientMetadataUrl, registration }`,
|
|
564
|
+
which wins over the hook-level values and is remembered with the list; `servers[i].oauthRegistration`
|
|
565
|
+
says which way its client was registered once it is connected:
|
|
521
566
|
|
|
522
567
|
```tsx
|
|
523
568
|
const mcp = useMcpServers({ clientMetadataUrl: 'https://my-app.example/oauth/client.json' })
|
|
524
569
|
await mcp.add({ name: 'docs', url, auth: 'oauth' }) // CIMD where the server supports it, DCR elsewhere
|
|
570
|
+
await mcp.add({ name: 'crm', url: crmUrl, auth: 'oauth', oauth: { registration: 'cimd' } }) // CIMD or nothing
|
|
571
|
+
mcp.servers[0].oauthRegistration // 'cimd' | 'dcr'
|
|
525
572
|
```
|
|
526
573
|
|
|
527
574
|
Servers connect in parallel, each with its own deadline; paginated tool lists
|
|
@@ -530,6 +577,212 @@ changes" prompt. With hundreds of tools the core switches to **tool search**
|
|
|
530
577
|
(a compact catalogue + `find_tools`) above `toolSearchThreshold` — see the
|
|
531
578
|
core's [capabilities doc](https://github.com/dudko-dev/agents/blob/main/packages/agent-web/docs/capabilities.md).
|
|
532
579
|
|
|
580
|
+
### MCP skills (experimental)
|
|
581
|
+
|
|
582
|
+
```tsx
|
|
583
|
+
await mcp.add({ name: 'docs', url, protocol: 'auto', skills: true })
|
|
584
|
+
// the agent's catalog now has docs/<skill> entries; mcp.servers[0].skills === true
|
|
585
|
+
// a server you vetted: its skills load without asking
|
|
586
|
+
await mcp.add({ name: 'ours', url: ourUrl, protocol: 'auto', skills: { consent: 'never' } })
|
|
587
|
+
// a server you trust with its GENERATED skills (no checksums): each is read whole, and the
|
|
588
|
+
// person approves that copy
|
|
589
|
+
await mcp.add({ name: 'gen', url: genUrl, protocol: 'auto', skills: { dynamic: true } })
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
A server may serve **skills** (the `io.modelcontextprotocol/skills` extension, Beta): instruction
|
|
593
|
+
files the agent can load. With `skills: true` (on `connect`, or per server on `add`, remembered
|
|
594
|
+
with the list) the core declares the extension and puts the server's skills into the agent's
|
|
595
|
+
catalog next to your own skills and the agent's lessons, named `<server>/<skill>` - so a server
|
|
596
|
+
can never take the name of one of yours, nor of another server's skill. Nothing else is wired: the
|
|
597
|
+
skills come with the server's `tools`, like its instructions. The run's skills
|
|
598
|
+
(`message.skills`, the `skill.activated` event, which carries `server` for these) show that
|
|
599
|
+
name, so a UI says whose skill it is. The text is third-party: the core loads it on demand,
|
|
600
|
+
verified against the server's digests, under a preamble that says it is knowledge only - it cannot
|
|
601
|
+
approve a call, change the approval mode, open the web or run code (while the agent acts on one, a
|
|
602
|
+
tool that runs code is always asked). Needs the 2026-07-28 revision. The core's
|
|
603
|
+
[README](https://github.com/dudko-dev/agents/blob/main/packages/agent-web/README.md) ("MCP
|
|
604
|
+
skills") has the rules.
|
|
605
|
+
|
|
606
|
+
**A person sees a server's skill before the agent does.** The first time a skill would enter the
|
|
607
|
+
agent's context, the core asks through the same consent gate as a tool call - `useAgent()`'s
|
|
608
|
+
`pendingApprovals` gets a request whose `skill` (`SkillConsentView`) holds the server, the skill,
|
|
609
|
+
its description, size and files, and the very text the model would read (`skill.body`, while the
|
|
610
|
+
request is open: the reducer drops it once it is decided, so a saved chat does not keep it).
|
|
611
|
+
`<AgentChat>` / `<ToolApprovalPrompt>` render it as its own card - "The server “docs” offers the
|
|
612
|
+
skill “pdf-processing”", the description, a collapsed preview of the text (plain text) and **Allow
|
|
613
|
+
once** / **Always for this server** / **Deny**; `approve(id)` / `approve(id, { remember: true })`
|
|
614
|
+
/ `deny(id)` answer it. Asked whatever the approval mode - autopilot too. `skills: { consent }`
|
|
615
|
+
(per server, remembered) or the agent's `mcpSkills: { consent }` (core config) choose when:
|
|
616
|
+
`'once-per-skill'` (default: once per skill in the agent's life, again when the server changes
|
|
617
|
+
it), `'ask'` (every task that loads it) or `'never'` (a server you vetted: today's behaviour). A
|
|
618
|
+
skill inside another one (nested) is asked about on its own. The agent may also load a skill a
|
|
619
|
+
server names by its address (`skill://…/SKILL.md`, in its instructions or a skill), from that
|
|
620
|
+
server only - the card says so (`skill.byUri`).
|
|
621
|
+
|
|
622
|
+
**Generated skills** (`"resources": "dynamic"`: the server publishes no checksums) are declined
|
|
623
|
+
unless the server was added with `skills: { dynamic: true }` (remembered with the list; there is
|
|
624
|
+
no switch for every server). Then, before the person is asked, the core reads the whole skill -
|
|
625
|
+
its `SKILL.md` and, if the server can list directories, every file in them, within the
|
|
626
|
+
specification's limits (512 files, 16 MiB) - computes the digests itself and keeps that copy in
|
|
627
|
+
memory: the card shows its size and files, says so in one line (`skill.dynamic`;
|
|
628
|
+
`skillConsentDynamic`: "This server publishes no checksums for this skill: you approve the copy
|
|
629
|
+
the agent just read, and only that copy is used."), and the agent is given that copy only, never
|
|
630
|
+
a later read. A server that cannot list its files gives `SKILL.md` alone (`skill.noFileListing`,
|
|
631
|
+
`skillConsentNoFileListing`). Nothing of the copy is stored.
|
|
632
|
+
|
|
633
|
+
### The protocol revision
|
|
634
|
+
|
|
635
|
+
```tsx
|
|
636
|
+
await mcp.add({ name: 'docs', url, protocol: 'auto' })
|
|
637
|
+
mcp.servers[0].protocol // { version: '2026-07-28', era: 'modern' } - or 2025-11-25 / legacy
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
- `'legacy'` (and no `protocol` at all) is the 2025 handshake: the requests and the CORS request
|
|
641
|
+
headers are exactly what they were before the option existed.
|
|
642
|
+
- `'auto'` asks the server first (`server/discover`, one extra request at connect) and speaks
|
|
643
|
+
2026-07-28 to a server that offers it. From a page, that revision sends two more request headers,
|
|
644
|
+
`Mcp-Method` and `Mcp-Name`: a server whose `Access-Control-Allow-Headers` does not list them
|
|
645
|
+
blocks the probe in the browser, and the core falls back to the 2025 revisions with a warning
|
|
646
|
+
(`onLog`) that names the missing headers.
|
|
647
|
+
- `'modern'` is 2026-07-28 only: a server that does not offer it, or whose CORS blocks the headers,
|
|
648
|
+
fails the connect with the reason.
|
|
649
|
+
|
|
650
|
+
The revision is decided once, at connect. The core's
|
|
651
|
+
[README](https://github.com/dudko-dev/agents/blob/main/packages/agent-web/README.md) has the
|
|
652
|
+
details (CORS, tool-list changes on 2026-07-28).
|
|
653
|
+
|
|
654
|
+
## MCP elicitation — a server asks the user
|
|
655
|
+
|
|
656
|
+
A server may ask the **user** for input in the middle of a tool call: a form to fill in (a name, a
|
|
657
|
+
date, a choice), or - with `url: true` - a page to open (a payment, a sign-in on the server's own
|
|
658
|
+
site). Turn it on in the hook and show the questions:
|
|
659
|
+
|
|
660
|
+
```tsx
|
|
661
|
+
import { useMcpServers } from '@dudko.dev/agent-web-react/mcp'
|
|
662
|
+
import { AgentChat, useAgent } from '@dudko.dev/agent-web-react'
|
|
663
|
+
|
|
664
|
+
const mcp = useMcpServers({ elicitation: { url: true } }) // or `true`: forms only
|
|
665
|
+
const agent = useAgent({ model, tools: mcp.tools }, { deps: [mcp.tools] })
|
|
666
|
+
|
|
667
|
+
<AgentChat
|
|
668
|
+
controller={agent}
|
|
669
|
+
elicitations={mcp.pendingElicitations}
|
|
670
|
+
onElicitationAnswer={mcp.answerElicitation}
|
|
671
|
+
/>
|
|
672
|
+
// or anywhere: <ElicitationPrompt elicitations={…} onAnswer={…} outcomes={agent.elicitations} />
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
- **Off by default.** Without `elicitation` the hooks pass nothing to the core: no capability is
|
|
676
|
+
declared in the handshake, a server cannot ask, and the wire is what it was. `true` turns it on
|
|
677
|
+
with the core's defaults; an object is the core's settings - `url` (also offer URL mode; default
|
|
678
|
+
false), `timeoutMs` (how long a question waits; default 300 000), `maxPerToolCall` (5),
|
|
679
|
+
`maxPerRun` (20), `subagents` (let a helper's call ask too; default false). The option is read
|
|
680
|
+
when a server connects: changing it takes a reconnect. A core without elicitation ignores it.
|
|
681
|
+
- **`pendingElicitations`** are the questions waiting, oldest first (`PendingElicitation`: the
|
|
682
|
+
core's `McpElicitationRequest` - `id`, `server`, `tool`, `mode`, `message`, `requestedSchema` or
|
|
683
|
+
`url`, `subagent?` - plus `expiresAt` when the question has a time limit). **`answerElicitation(id,
|
|
684
|
+
result)`** answers one: `{ action: 'accept', content }` (a form's values; nothing for a link),
|
|
685
|
+
`{ action: 'decline' }` or `{ action: 'cancel' }`; it returns false when the question is no longer
|
|
686
|
+
waiting. A question also leaves the list, answered `cancel`, when the core stops waiting (its time
|
|
687
|
+
ran out, the run stopped), when its server is disconnected or removed, and when the component
|
|
688
|
+
that holds the hook unmounts.
|
|
689
|
+
- **Time.** A question waits `timeoutMs` (default 300 000: five minutes; `0` or `Infinity` = until
|
|
690
|
+
the run is stopped). The step it belongs to does not cut it short: the core stops the step's
|
|
691
|
+
clock (`chatTimeoutMs`) while a person is asked, and the step goes on with the time it had left
|
|
692
|
+
once the question is settled. A question nobody answered in time is cancelled by the core and its
|
|
693
|
+
tool call fails; the prompt then says it was answered automatically, and why.
|
|
694
|
+
- **`<ElicitationPrompt>`** (main entry; it imports neither the SDK nor the core's `./mcp`) draws the
|
|
695
|
+
question where the consent cards are, one at a time with a count: the host's own header (which
|
|
696
|
+
server asks, during which tool), the server's message under a caption that says it is the
|
|
697
|
+
server's, then the form - text (plain, email, URL, date, date and time, with length limits),
|
|
698
|
+
numbers and whole numbers (with bounds), a tick box, a select (plain, titled, `enumNames`), a
|
|
699
|
+
multi-select - with required marks, titles, descriptions and defaults, and **Submit / Decline /
|
|
700
|
+
Cancel**. Submit is checked first by the core's own rules (`elicitationFormAnswer`) and a refused
|
|
701
|
+
field says what is wrong with it, by name. A link shows its host large, the whole address as
|
|
702
|
+
text, and an **Open in a new tab** button; "I have finished there" (the accept) appears once the
|
|
703
|
+
user opened it.
|
|
704
|
+
- **On the 2025 revisions** the core sends the calls to a server that may ask one at a time
|
|
705
|
+
(its question does not say which call it belongs to); on 2026-07-28 a question is part of the
|
|
706
|
+
call's own answer. Both work the same from here.
|
|
707
|
+
|
|
708
|
+
A host that calls the core's `connectMcpHttp` itself can use the same queue the hooks use
|
|
709
|
+
(`createElicitationQueue` from `…/mcp`) or pass its own `onElicitation`, and render
|
|
710
|
+
`<ElicitationPrompt>` with what it was given.
|
|
711
|
+
|
|
712
|
+
> **Security.** The question is the SERVER's text, and the prompt treats it so. Its message, the
|
|
713
|
+
> field titles and descriptions and the option names are shown as plain text (never as markup)
|
|
714
|
+
> inside a box captioned "From the server “*server*”"; the header above it is the
|
|
715
|
+
> app's own. A link is never followed by itself: there is no `<a>`, nothing opens it before the
|
|
716
|
+
> user's click on **Open**, which calls `window.open(url, '_blank', 'noopener,noreferrer')`, and
|
|
717
|
+
> there is no Open at all for anything but https (or http on a loopback host) without credentials -
|
|
718
|
+
> checked again here, although the core already refuses such links. What the user types stays in
|
|
719
|
+
> the prompt's own component state until Submit hands it to `answerElicitation`, which passes it
|
|
720
|
+
> to the core and keeps nothing: it is not in the agent's state (`state.elicitations` holds field
|
|
721
|
+
> NAMES only), its events, the transcript, a saved chat or a log. The core sends it to the server
|
|
722
|
+
> that asked and nowhere else - never to the model.
|
|
723
|
+
|
|
724
|
+
## MCP Apps — a server's interface in the chat
|
|
725
|
+
|
|
726
|
+
`apps: true` (on `useMcp` or `useMcpServers`) declares the [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
|
|
727
|
+
extension: a tool whose server ships an HTML app for its result comes with that app, and
|
|
728
|
+
`<AgentChat mcpApps>` draws it under the answer in a sandboxed frame. Whatever the app asks the
|
|
729
|
+
host to do - call a tool of its server, open a link, put a message in the chat - is put to the
|
|
730
|
+
user in the chat's consent area, labelled as the app's.
|
|
731
|
+
|
|
732
|
+
```tsx
|
|
733
|
+
const mcp = useMcpServers({ apps: true })
|
|
734
|
+
const agent = useAgent({ model, tools: mcp.tools }, { deps: [mcp.tools] })
|
|
735
|
+
<AgentChat controller={agent} mcpApps={mcp.apps} appPanel="auto" />
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
Off by default (the hooks declare nothing and every tool is mounted as before). Needs a core with
|
|
739
|
+
MCP Apps. See [docs/chat.md](docs/chat.md#mcp-apps-a-servers-interface-in-the-chat).
|
|
740
|
+
|
|
741
|
+
**One server's apps off.** `useMcpServers({ apps: true })` with `add({ name, url, apps: false })`:
|
|
742
|
+
that server is not told of apps, none of its apps is read or drawn, a tool it marks for its app
|
|
743
|
+
only is mounted for nobody, and its other tools are plain tools.
|
|
744
|
+
|
|
745
|
+
**What an app may ask for besides** - each off by default, each put to the user:
|
|
746
|
+
|
|
747
|
+
```tsx
|
|
748
|
+
<AgentChat
|
|
749
|
+
controller={agent}
|
|
750
|
+
mcpApps={mcp.apps}
|
|
751
|
+
appFullscreen // ui/request-display-mode: full screen over the chat, after a click in the app; Esc / Exit back
|
|
752
|
+
appDownloads // ui/download-file: name, type, size shown; saved by your page; programs, scripts, pages refused
|
|
753
|
+
appSampling // sampling/createMessage: the agent's model answers the app; no tools; the answer never in the chat
|
|
754
|
+
/>
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
`hostCapabilities` names only what is on (`downloadFile`, `sampling` - never `sampling.tools`);
|
|
758
|
+
`hostContext.availableDisplayModes` is `['inline', 'fullscreen']` with `appFullscreen` (no
|
|
759
|
+
picture-in-picture). The rules: [docs/chat.md](docs/chat.md#what-an-app-may-ask-for-besides-a-tool-call).
|
|
760
|
+
|
|
761
|
+
**An origin of its own (opt-in).** By default an app runs in an opaque frame: no storage or
|
|
762
|
+
cookies of its own, requests with `Origin: null`. Serve the sandbox page of
|
|
763
|
+
`@dudko.dev/agent-web-react/mcp-app-sandbox` on ANOTHER origin and pass its URL, and apps run on
|
|
764
|
+
that origin instead - the specification's sandbox proxy:
|
|
765
|
+
|
|
766
|
+
```tsx
|
|
767
|
+
<AgentChat controller={agent} mcpApps={mcp.apps} appSandbox={{ url: 'https://apps.example.com/sandbox/v1' }} />
|
|
768
|
+
// or one origin per server (needs a wildcard certificate): 'https://{server}.apps.example.com/sandbox/v1'
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
```ts
|
|
772
|
+
// A Cloudflare Worker on apps.example.com (or Node / Deno / Bun: Request in, Response out)
|
|
773
|
+
import { mcpAppSandboxResponse } from '@dudko.dev/agent-web-react/mcp-app-sandbox'
|
|
774
|
+
export default {
|
|
775
|
+
fetch: (request: Request) =>
|
|
776
|
+
mcpAppSandboxResponse(request, { path: '/sandbox/v1', hosts: 'https://chat.example.com' }),
|
|
777
|
+
}
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
A URL on your page's own origin, or not `https://` (`http://` only on `localhost` / `127.0.0.1`), is
|
|
781
|
+
refused; a sandbox page that does not answer in `timeoutMs` (5 s) is given up for the page's life.
|
|
782
|
+
Either way the app runs in the opaque frame - the stricter of the two - and its header says
|
|
783
|
+
"sandboxed" instead of "sandboxed on its own origin". The headers, the hosts setting and the
|
|
784
|
+
trade-offs: [docs/chat.md](docs/chat.md#an-app-on-an-origin-of-its-own).
|
|
785
|
+
|
|
533
786
|
## Components
|
|
534
787
|
|
|
535
788
|
All components are optional and styled by `styles.css` (class-prefixed `awr-`,
|
|
@@ -545,7 +798,12 @@ use them standalone. The full guide: [docs/chat.md](docs/chat.md).
|
|
|
545
798
|
| `<StepList>` / `<ToolCallRow>` | Execution steps / one tool call with its cost and images. With model tiers: the tier / model badge, the escalation line, the earlier attempt's calls (`showTiers`); a replanner failure as a warning (`showReplanFailed`); the decision model's note (`showDecisions`); the subagent tree under its step (`showSubagents`); a `web_search` call's results as plain text and safe links (`showSearchResults`). |
|
|
546
799
|
| `<SubagentTree>` / `<SubagentRow>` | The run's subagents - static ones and the helpers the model started - as an indented tree: status, model, tokens, time and a Stop button per node (`onStop`, `showUsage`, `showTools`, `renderSubagent`). |
|
|
547
800
|
| `<GeneratedMedia>` / `<TranscriptBlock>` | A file a media tool wrote, read from the workspace: an image inline or a native audio player (only the types the core generates; never SVG) / a folded "Transcript of …" block. `<MessageList files showMedia renderMedia>` places them in the answer. |
|
|
548
|
-
| `<
|
|
801
|
+
| `<FileChips>` / `<FileChip>` | The files an answer wrote to the workspace (the core's `file.written` / `file.deleted`), as chips: name, kind, size, open, download; an inline preview (text with line numbers, a picture, your own rendering through `renderFileContent`), and an `.html` file in a sandboxed frame with Preview / Source. `<MessageList files showFileChips htmlPreview renderFile renderFileContent>` places them under the answer. |
|
|
802
|
+
| `<SandboxedFrame>` / `<SourceView>` | Untrusted HTML inside chrome the host draws: `<iframe sandbox>` without `allow-same-origin`, by `srcdoc`, no network, fixed height (`html`, `scripts`, `title`, `label`, `actions`, `footer`, `height`) / a file's text with line numbers, never markup. See [the boundary](#the-html-preview-is-a-security-boundary). |
|
|
803
|
+
| `<ToolApprovalPrompt>` | Consent cards (Allow once / Always / Deny); a helper's request says which helper asks (`showHelper`); an MCP App's says the APP asks, with the server's own tool name; an MCP server's skill gets its own card (the server, the skill, a collapsed preview of its text - `showSkillPreview` - and Allow once / Always for this server / Deny). |
|
|
804
|
+
| `<ElicitationPrompt>` | A question an MCP server puts to the user during a tool call: a form (Submit / Decline / Cancel, checked by the core's rules) or a link opened only by a click, one at a time with a count, the time left, and the questions nobody answered (`elicitations`, `onAnswer`, `outcomes`, `showOutcomes`, `showExpiry`, `showHelper`, `renderElicitation`). See [MCP elicitation](#mcp-elicitation--a-server-asks-the-user). |
|
|
805
|
+
| `<McpAppFrame>` / `<McpAppLine>` | An MCP App in host-drawn chrome ("App from server “travel” · sandboxed", panel, menu: reload / open in panel / hide): an opaque-origin frame - or, with `host.sandbox` (`useMcpAppHost({ sandbox })`, `<AgentChat appSandbox>`), an origin of its own behind your sandbox page ("· sandboxed on its own origin") - network only to the origins its resource declared, a bridge with an allow-list; inline, folded, in a panel or - with `allowFullscreen`, asked for by the app after a click in it - full screen over the chat with Exit / Esc (`app`, `host`, `variant`, `theme`, `defaultCollapsed`, `onOpenPanel`, `onClosePanel`, `showCalls`, `allowFullscreen`). `<AgentChat mcpApps>` places them under the answer. See [the boundary](#an-mcp-app-is-a-security-boundary). |
|
|
806
|
+
| `<AppRequestPrompt>` | What an MCP App asks for besides a tool call: a link (its host highlighted, opened only on the user's click), a message (put in the message box as a draft, never sent for the user), a file (its sanitized name, type and size; saved by the page on Save file) or an answer of the agent's model (the app's text as text, the token cap; Allow once / Always for this app / Deny). |
|
|
549
807
|
| `<ApprovalModeSwitch>` | Segmented consent-mode switch. |
|
|
550
808
|
| `<ChatHistoryList>` | Saved chats (from `useChatHistory`). |
|
|
551
809
|
| `<FilesPanel>` | A `VirtualFileSystem`, live: preview, download, delete, upload. |
|
|
@@ -558,6 +816,68 @@ use them standalone. The full guide: [docs/chat.md](docs/chat.md).
|
|
|
558
816
|
| `<Composer>` | The minimal textarea + send/stop (kept for existing apps). |
|
|
559
817
|
| `<PipelineEditor>` and its parts | The pipeline editor - from `@dudko.dev/agent-web-react/pipeline`, styled by `pipeline.css`. See [Pipelines](#pipelines-an-editor-on-a-canvas). |
|
|
560
818
|
|
|
819
|
+
### The HTML preview is a security boundary
|
|
820
|
+
|
|
821
|
+
`<AgentChat files={vfs}>` shows the files an answer wrote as chips, and an `.html` one can be
|
|
822
|
+
previewed. That page is **untrusted**: a model wrote it, possibly on the say-so of a page it read,
|
|
823
|
+
and your origin holds the key vault. The preview therefore never puts the file into your document
|
|
824
|
+
and never opens it by URL - `<SandboxedFrame>` draws it:
|
|
825
|
+
|
|
826
|
+
| Guard | What it stops |
|
|
827
|
+
| --- | --- |
|
|
828
|
+
| `<iframe sandbox>` = `""` or `"allow-scripts"`, never `allow-same-origin` | reading your DOM, `localStorage`, cookies, IndexedDB (an opaque origin); no top navigation, popups, forms, modals, downloads |
|
|
829
|
+
| `srcdoc`, never a `blob:` / `data:` URL | the same document opened outside the sandbox with your origin |
|
|
830
|
+
| CSP with no network source (`default-src 'none'`, inline styles, `data:` / `blob:` images) | `fetch`, XHR, beacon, WebSocket, `<img src=https://…>`, external scripts and styles, forms |
|
|
831
|
+
| the policy first in the document AND inherited from a shell document of ours | a page that brings its own `<meta>` policy, a `<base>`, or content before `<html>` |
|
|
832
|
+
| the shell's `frame-src 'none'` | the frame navigating itself to the network (`location = …`, a link, `<meta http-equiv=refresh>`) |
|
|
833
|
+
| the label, the switch and the footer drawn by the host, outside the frame; a fixed height; no message listened to | content imitating chat controls or resizing itself over them |
|
|
834
|
+
| Source as text nodes | markup injection through the source view |
|
|
835
|
+
|
|
836
|
+
Scripts are **off by default** (`htmlPreview={{ scripts: true }}` runs the page's inline scripts,
|
|
837
|
+
still without an origin or a network; `htmlPreview={false}` shows HTML as source only). Limits of
|
|
838
|
+
this version: files a page links to (`style.css`, `app.js`, images next to it) are not loaded, and
|
|
839
|
+
the frame says so; a DNS prefetch is not a request the policy sees (it can carry only what the
|
|
840
|
+
agent itself wrote into the page); the guards are verified in Chromium. Every guard has a test in
|
|
841
|
+
`tests/files.test.ts` and, in a real browser, in `e2e/files.spec.ts`. Details:
|
|
842
|
+
[docs/chat.md](docs/chat.md#the-html-preview-is-a-security-boundary).
|
|
843
|
+
|
|
844
|
+
### An MCP App is a security boundary
|
|
845
|
+
|
|
846
|
+
An MCP App is third-party HTML **with scripts** that talks to your page. `<McpAppFrame>` keeps the
|
|
847
|
+
HTML preview's boundary and adds a bridge:
|
|
848
|
+
|
|
849
|
+
| Guard | What it stops |
|
|
850
|
+
| --- | --- |
|
|
851
|
+
| `<iframe sandbox="allow-scripts">` (outer and inner), never `allow-same-origin`, no `allow` attribute | your DOM, `localStorage`, cookies, IndexedDB (the key vault); navigating your tab, popups, forms; camera, microphone, location, clipboard |
|
|
852
|
+
| a policy built from the resource's declared origins only (`connectDomains`, `resourceDomains`), re-checked; nothing declared = no network | `fetch` / images / scripts to an origin the server did not declare; a declared entry that is not an origin (`*`, `'unsafe-eval'`, `; script-src *`) |
|
|
853
|
+
| the policy first in the app's document AND inherited from a shell of ours; the shell's `frame-src 'none'` | the app pre-empting the policy; navigating itself to the network |
|
|
854
|
+
| a relay in the shell by window; your page listens to the frame it drew only (`event.source`) | an app (or anything else) posting to your page directly |
|
|
855
|
+
| an allow-list of methods, parameters checked, at most 3 requests in flight, nothing but `ping` before `ui/initialize`; `ui/download-file` / `sampling/createMessage` only when on | resource reads, model-context updates; downloads and sampling the host did not offer; floods |
|
|
856
|
+
| full screen only for an app that declared it, right after a click or a key inside its frame, never while it waits for the user; the host's chrome (who asked, Exit, Esc) on top, the focus kept inside | an app taking over the chat unasked, or hiding a prompt |
|
|
857
|
+
| a file: one per request, its name sanitized, programs / scripts / HTML / SVG / XML refused by name and type, 20 MB, a linked file read through its own server only, saved by your page as `application/octet-stream` on the click | path tricks, a page or a program saved in the user's name, a fetch to an address the app chose |
|
|
858
|
+
| sampling: the core's rules (text, no tools, caps, a rate per app), the user shown exactly what the model gets, the answer to the app only | an app spending the user's model unasked, or reading the conversation through it |
|
|
859
|
+
| tool calls through the agent's consent gate (writes always ask, "always allow" is the app's alone), only tools of its own server that let apps call them; links only on the user's click; messages only as a draft | an app acting with the user's authority, silently |
|
|
860
|
+
| the label, the controls, the menu and every prompt drawn by the host outside the frame; the height clamped to 120 - 800 px | an app imitating or covering a control of the chat |
|
|
861
|
+
|
|
862
|
+
That is the default: an opaque origin (no storage or cookies of its own; its requests carry
|
|
863
|
+
`Origin: null`) - stricter than the specification, which asks a web host for a sandbox proxy on a
|
|
864
|
+
second origin with `allow-same-origin`. With `appSandbox` (above) you give it that second origin,
|
|
865
|
+
and the guards that change are these:
|
|
866
|
+
|
|
867
|
+
| Guard (`appSandbox`) | What it stops |
|
|
868
|
+
| --- | --- |
|
|
869
|
+
| a sandbox URL on your page's origin, or plain `http://` off loopback, is refused (opaque) | `allow-same-origin` handing the app your storage and the key vault |
|
|
870
|
+
| the sandbox page's response carries the app's policy (from its URL's path) and `frame-ancestors` = your hosts; the app's frame inherits it | the app's network beyond what it declared, through its own frame or through the sandbox page (same origin, so it can reach it); other sites framing the page |
|
|
871
|
+
| a shell of ours (your origin, no script) whose `frame-src` is the sandbox page's exact URL | the app navigating the sandbox page away (it can: same origin) - a request to an undeclared origin |
|
|
872
|
+
| messages only from the sandbox page's window AND origin, posted to that origin only; one handshake, a second one stops the app | anything else posting to your page; the app reloading its frame |
|
|
873
|
+
|
|
874
|
+
Its cost: the app is same-origin with every other app on the same sandbox origin (one origin for
|
|
875
|
+
all servers shares storage between them) - `{server}` in the URL gives each server its own.
|
|
876
|
+
WebRTC is not governed by `connect-src` in Chromium. Every guard has a test in
|
|
877
|
+
`tests/apps.test.ts` / `tests/apps-sandbox.test.ts` and, in a real browser against a hostile app,
|
|
878
|
+
in `e2e/apps.spec.ts` / `e2e/apps-sandbox.spec.ts`. Details:
|
|
879
|
+
[docs/chat.md](docs/chat.md#an-app-is-a-security-boundary).
|
|
880
|
+
|
|
561
881
|
### Build your own UI
|
|
562
882
|
|
|
563
883
|
The components are a thin layer over the exported, **pure** reducer. Use it
|
|
@@ -571,13 +891,28 @@ state = agentStateReducer(state, { type: 'event', event }) // fold each AgentEve
|
|
|
571
891
|
```
|
|
572
892
|
|
|
573
893
|
The state is made of plain, exported view types you can render with your own components:
|
|
574
|
-
`StepView` (a step and its `ToolCallView`s; `StepEscalationView` for its escalations), `ApprovalView`, `SubagentView`, `UserNoteView` /
|
|
894
|
+
`StepView` (a step and its `ToolCallView`s; `StepEscalationView` for its escalations), `ApprovalView`, `ElicitationView` (a question an MCP server put to the user in the middle of a tool call - `state.elicitations`, see below), `SubagentView`, `UserNoteView` /
|
|
575
895
|
`QueuedMessageView` (steering), `LessonView` / `FetchView` (the notebook and the pages fetched),
|
|
576
896
|
`BudgetView`, `CompactionView`, `AttachmentView`, `ChatMessage` (a transcript entry that keeps its
|
|
577
897
|
own steps, usage and duration). Outside `<AgentChat>`, `useAgentContext()` returns the controller of
|
|
578
898
|
the enclosing `<AgentProvider>` (it throws outside one; `useOptionalAgentContext()` returns
|
|
579
899
|
`undefined` instead), and `useLabels()` the labels in effect.
|
|
580
900
|
|
|
901
|
+
**MCP elicitation in the state.** The core's `mcp.elicitation-requested` /
|
|
902
|
+
`mcp.elicitation-answered` events fold into `state.elicitations` (absent until the first one): an
|
|
903
|
+
`ElicitationView` per question with `id`, `server`, `tool`, `mode`, `message`, `requestedSchema` or
|
|
904
|
+
`url`, `stepId`, `subagent?`, and a `status` of `pending | accepted | declined | cancelled`
|
|
905
|
+
(`automatic` / `reason` when nobody decided, `fields` - the names an accepted form was answered
|
|
906
|
+
with). The view never holds an answer, and it is a per-run view: it is not copied into the
|
|
907
|
+
transcript, so a saved conversation never contains a server's form. `message`, the schema's titles
|
|
908
|
+
and `url` are the SERVER's text - render them as text, as the server's. The questions to ANSWER come
|
|
909
|
+
from the hooks (`pendingElicitations`, [above](#mcp-elicitation--a-server-asks-the-user)); the
|
|
910
|
+
state is what `<ElicitationPrompt outcomes>` reads to say which ones were answered automatically.
|
|
911
|
+
The prompt's pure half is exported for a UI of your own: `elicitationFields` (a form's fields and
|
|
912
|
+
the control each is drawn as), `elicitationInitialDraft` (the defaults), `elicitationFormAnswer`
|
|
913
|
+
(the answer, or an issue per field), `elicitationLink` (host, address, whether it may be opened)
|
|
914
|
+
and `formatCountdown`.
|
|
915
|
+
|
|
581
916
|
## How it fits together
|
|
582
917
|
|
|
583
918
|
```
|
|
@@ -611,7 +946,7 @@ from one place.
|
|
|
611
946
|
kind in the transcript, a chat saved and restored after a reload, an image
|
|
612
947
|
attached (shown, sent as a file part, saved in the workspace), a file
|
|
613
948
|
dropped anywhere on the page, consent in "Ask" mode, slash commands, the
|
|
614
|
-
chess move that triggers the agent, and
|
|
949
|
+
chess move that triggers the agent, and Spanish and German labels; the agent's
|
|
615
950
|
notebook (a lesson written, kept in the workspace across a reload, seen by the
|
|
616
951
|
planner, forgotten on request) and web access (off by default; an allowed page
|
|
617
952
|
is read, a metadata address is refused). The MCP and authorization servers it
|
|
@@ -626,6 +961,12 @@ challenge header be exposed;
|
|
|
626
961
|
no sideways scroll, the inspector as a bottom sheet, one finger panning and two zooming the
|
|
627
962
|
canvas while the page stays put.
|
|
628
963
|
|
|
964
|
+
- files written in a turn ([`e2e/files.spec.ts`](e2e/files.spec.ts)): the chips under the answer
|
|
965
|
+
(one per file, none for a deleted one), the Markdown / CSV / HTML previews, the download, the
|
|
966
|
+
chips after a reload, a phone; and the sandboxed frame against hostile pages - with scripts on,
|
|
967
|
+
on a test-only page - which cannot read the host's DOM, storage or IndexedDB, reach a counted
|
|
968
|
+
local endpoint by any request or navigation, open a window, or pre-empt the policy.
|
|
969
|
+
|
|
629
970
|
These cover what unit tests structurally cannot: effect ordering across a real
|
|
630
971
|
render, a real navigation away and back, and IndexedDB.
|
|
631
972
|
|
|
@@ -160,6 +160,57 @@ var GlobeIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(s
|
|
|
160
160
|
/* @__PURE__ */ jsx("path", { d: "M3 12h18M12 3c3 3.2 3 14.8 0 18M12 3c-3 3.2-3 14.8 0 18" })
|
|
161
161
|
] });
|
|
162
162
|
var DownloadIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "M12 3v12m-5-5 5 5 5-5M5 21h14" }) });
|
|
163
|
+
var QuestionIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
164
|
+
/* @__PURE__ */ jsx("path", { d: "M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z" }),
|
|
165
|
+
/* @__PURE__ */ jsx("path", { d: "M9.6 8a2.5 2.5 0 0 1 4.8.8c0 1.7-2.4 2-2.4 3.4" }),
|
|
166
|
+
/* @__PURE__ */ jsx("path", { d: "M12 14.6h.01" })
|
|
167
|
+
] });
|
|
168
|
+
var ExternalIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
169
|
+
/* @__PURE__ */ jsx("path", { d: "M15 3h6v6" }),
|
|
170
|
+
/* @__PURE__ */ jsx("path", { d: "M10 14 21 3" }),
|
|
171
|
+
/* @__PURE__ */ jsx("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
|
|
172
|
+
] });
|
|
173
|
+
var CodeIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "m8 7-5 5 5 5M16 7l5 5-5 5" }) });
|
|
174
|
+
var FileTextIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
175
|
+
/* @__PURE__ */ jsx("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9Z" }),
|
|
176
|
+
/* @__PURE__ */ jsx("path", { d: "M14 3v6h6M8 13h8M8 17h6" })
|
|
177
|
+
] });
|
|
178
|
+
var TableIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
179
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
|
|
180
|
+
/* @__PURE__ */ jsx("path", { d: "M3 10h18M3 15h18M9 4v16M15 4v16" })
|
|
181
|
+
] });
|
|
182
|
+
var ImageIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
183
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
|
|
184
|
+
/* @__PURE__ */ jsx("circle", { cx: "9", cy: "10", r: "1.6" }),
|
|
185
|
+
/* @__PURE__ */ jsx("path", { d: "m4 18 5.5-5 4 3.5 2.5-2 4 3.5" })
|
|
186
|
+
] });
|
|
187
|
+
var ChevronUpIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "m6 15 6-6 6 6" }) });
|
|
188
|
+
var LockIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
189
|
+
/* @__PURE__ */ jsx("rect", { x: "5", y: "11", width: "14", height: "9", rx: "2" }),
|
|
190
|
+
/* @__PURE__ */ jsx("path", { d: "M8 11V8a4 4 0 0 1 8 0v3" })
|
|
191
|
+
] });
|
|
192
|
+
var NoNetworkIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
193
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
|
|
194
|
+
/* @__PURE__ */ jsx("path", { d: "M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18M4 4l16 16" })
|
|
195
|
+
] });
|
|
196
|
+
var ExpandIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "M8 3H4v4M16 3h4v4M8 21H4v-4M16 21h4v-4" }) });
|
|
197
|
+
var ShrinkIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "M4 8h4V4M20 8h-4V4M4 16h4v4M20 16h-4v4" }) });
|
|
198
|
+
var AppIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
199
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "3" }),
|
|
200
|
+
/* @__PURE__ */ jsx("path", { d: "M3 9h18M8 6h.01" })
|
|
201
|
+
] });
|
|
202
|
+
var MoreIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
203
|
+
/* @__PURE__ */ jsx("circle", { cx: "5", cy: "12", r: "1" }),
|
|
204
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "1" }),
|
|
205
|
+
/* @__PURE__ */ jsx("circle", { cx: "19", cy: "12", r: "1" })
|
|
206
|
+
] });
|
|
207
|
+
var ReloadIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "M3 12a9 9 0 0 1 15.5-6.2L21 8M21 3v5h-5M21 12a9 9 0 0 1-15.5 6.2L3 16M3 21v-5h5" }) });
|
|
208
|
+
var PanelIcon = ({ size, className }) => /* @__PURE__ */ jsxs("svg", { ...base(size), className, children: [
|
|
209
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
|
|
210
|
+
/* @__PURE__ */ jsx("path", { d: "M14 4v16" })
|
|
211
|
+
] });
|
|
212
|
+
var EyeOffIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "M10.6 5.1A9.8 9.8 0 0 1 12 5c6.4 0 10 7 10 7a17 17 0 0 1-3 3.8M6.5 6.6A16.6 16.6 0 0 0 2 12s3.6 7 10 7a9.7 9.7 0 0 0 5.3-1.6M3 3l18 18" }) });
|
|
213
|
+
var MessageIcon = ({ size, className }) => /* @__PURE__ */ jsx("svg", { ...base(size), className, children: /* @__PURE__ */ jsx("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
|
|
163
214
|
|
|
164
215
|
export {
|
|
165
216
|
errMessage,
|
|
@@ -186,6 +237,23 @@ export {
|
|
|
186
237
|
BookIcon,
|
|
187
238
|
GlobeIcon,
|
|
188
239
|
DownloadIcon,
|
|
240
|
+
QuestionIcon,
|
|
241
|
+
ExternalIcon,
|
|
242
|
+
CodeIcon,
|
|
243
|
+
FileTextIcon,
|
|
244
|
+
TableIcon,
|
|
245
|
+
ImageIcon,
|
|
246
|
+
ChevronUpIcon,
|
|
247
|
+
LockIcon,
|
|
248
|
+
NoNetworkIcon,
|
|
249
|
+
ExpandIcon,
|
|
250
|
+
ShrinkIcon,
|
|
251
|
+
AppIcon,
|
|
252
|
+
MoreIcon,
|
|
253
|
+
ReloadIcon,
|
|
254
|
+
PanelIcon,
|
|
255
|
+
EyeOffIcon,
|
|
256
|
+
MessageIcon,
|
|
189
257
|
previewValue,
|
|
190
258
|
formatTokens,
|
|
191
259
|
formatDuration,
|
|
@@ -193,4 +261,4 @@ export {
|
|
|
193
261
|
webSearchOf,
|
|
194
262
|
formatProbability
|
|
195
263
|
};
|
|
196
|
-
//# sourceMappingURL=chunk-
|
|
264
|
+
//# sourceMappingURL=chunk-EMF7DTGS.js.map
|