@dudko.dev/agent-web-react 0.0.42 → 0.0.44

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
@@ -37,6 +37,13 @@ app with a single hook and (optionally) a set of pre-styled components:
37
37
  `<LearnedSkills>`, `<MemoryCard>`, `<ContextMeter>`, `<PlanView>`, `<ModelLoadBar>`, `<UsageBadge>`, `<ApiKeyForm>`; hooks `useChatHistory`,
38
38
  `useVirtualFiles`, `useSpeechToText`, `useFollowScroll` (a transcript that follows the answer and leaves a reader where they are); MCP hooks `useMcp` / `useMcpServers` live in
39
39
  [`@dudko.dev/agent-web-react/mcp`](#mcp-hooks-live-in-their-own-subpath).
40
+ - 📏 **A limit on the message box** — `longText: { maxInputChars: 4000 }` (composer; off by
41
+ default): typing stops at it with a quiet counter near it; any longer text that would go over it
42
+ (a paste, a drop, a keyboard's clipboard chip, an IME's commit, a dictation) becomes the whole
43
+ text as a `pasted-<date-time>.txt` attachment - never cut, and no `maxLength`, which cuts.
44
+ Opt-in `excerptChars` (for an agent with `createFileTools` over the same `files`): a long text
45
+ attachment reaches the model as its beginning and its workspace path - see
46
+ [docs/chat.md](docs/chat.md#a-limit-on-the-message-box-long-pastes-as-files).
40
47
  - 🎙️ **Voice** — dictation through your own model (`speech.createRecognizer` +
41
48
  `createRecordingRecognizer`: record, then transcribe; the words land in the box), voice
42
49
  messages (`voiceMessage`: record and attach the audio, for a core that transcribes it) and a
@@ -210,7 +217,7 @@ function Custom() {
210
217
  | `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 |
211
218
  | `pendingQuestions`, `answerQuestion(id, answer)` | the model's questions to the person (the core's `ask_user`, with `askUser` on in the config - see [Questions from the agent](#questions-from-the-agent--ask_user)): the ones waiting in THIS tab, oldest first (`PendingQuestion`: the core's request - `id`, `question`, `options`, `multiple`, `allowOther`, `step?`, `subagent?` - plus `expiresAt`). `answerQuestion` takes `{ choice: [label] }`, `{ other: text }` or `{ declined: true }` and returns false when the question is no longer waiting. How each ended is `questions` (`QuestionView[]`; never what was typed) |
212
219
  | `approvalMode` / `setApprovalMode(mode)` | the autopilot switch, live |
213
- | `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 |
220
+ | `approveAppToolCall(call, signal)` / `sampleForApp(request, approve, signal)` | for MCP Apps: an app's tool call (`AppToolCall`: the core's request plus `frame`, the asking frame's id, put on the request's `app`) through the agent's consent gate (its mode and rules, as for the model - autopilot asks nothing; a `'deny'` rule and Read-only decided before "Always allow", which is kept per app and connection for the page's life, `appToolGrants`); 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 |
214
221
  | `compact()` | summarise the stored transcript now |
215
222
  | `sessionId` / `loadChat(chat)` | the memory session; switch conversations |
216
223
  | `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) |
@@ -225,7 +232,11 @@ function Custom() {
225
232
  switch), `onEvent` (tap the raw event stream), `autoStart`, `maxEvents`,
226
233
  `approvals` (route consent requests into the hook; default true), `questions` (answer the
227
234
  model's `ask_user` questions in the hook when `askUser` is on without an `onQuestion` of the
228
- host's; default true), `watch` (follow the
235
+ host's; default true), `appToolGrants` (where "Always allow" given to an MCP App's tool is kept:
236
+ default one set for the page's life, so a rebuilt agent or a remounted chat keeps it and a
237
+ reload forgets it; kept per app and per connection of its server, so a server added again or
238
+ another one under the same name starts with none, and a `'deny'` rule or Read-only still
239
+ refuses), `watch` (follow the
229
240
  conversation's run in another tab of the site - default true; needs a `memory` the tabs share,
230
241
  `IndexedDBStore`). The queue behind `approve` /
231
242
  `deny` is exported for a host that builds the core's agent itself: `createApprovalQueue()` gives
@@ -853,22 +864,25 @@ use them standalone. The full guide: [docs/chat.md](docs/chat.md).
853
864
  | Component | Purpose |
854
865
  | --- | --- |
855
866
  | `<AgentChat>` | Full panel: transcript with per-answer activity + composer + optional history and files panels. Reads a `controller` prop or the `<AgentProvider>` context. Says when the conversation runs in another tab of the site, waits for an answer there, or waits for it (`showOtherTabs`). |
856
- | `<AgentComposer>` | The input and its toolbar: attachments, commands, timer, agents, model/thinking, consent, mic, send/stop. The model menu takes `section` per option (a heading over each run of options, e.g. one per provider); both chip menus work from the keyboard (arrows, Home / End, Escape) - see [docs/chat.md](docs/chat.md#the-model-menu-sections-and-keys). `attachments` takes `{ accept, maxBytes, imageMaxDimension, imageMaxPixels, maxSourceBytes, imageMaxSourcePixels, maxImages, maxTotalBytes }`: `maxBytes` (20 MB) is checked on what is sent, so a photo over it is downscaled (1568 px / 1.15 MP) and sent with the note "downscaled from …", and a file `convertFile` turns into text is judged by its text - neither is refused for its original; that original may be up to `maxSourceBytes` (50 MB, never below `maxBytes`), and a picture's up to `imageMaxSourcePixels` (200 MP, read from the header before decoding); one message holds at most `maxImages` pictures (20) and `maxTotalBytes` (20 MB) of attachments as they go - a file past either is left out in words, the rest kept. `convertFile` may return a chip `note` and `images` (`ConvertedImage`: `{ name, blob }`, e.g. a scanned PDF's pages) that go as pictures under the same bounds - see [docs/chat.md](docs/chat.md#attachments-images-pdfs-files-urls). |
867
+ | `<AgentComposer>` | The input and its toolbar: attachments, commands, timer, agents, model/thinking, consent, mic, send/stop. The model menu takes `section` per option (a heading over each run of options, e.g. one per provider); both chip menus work from the keyboard (arrows, Home / End, Escape) - see [docs/chat.md](docs/chat.md#the-model-menu-sections-and-keys). `attachments` takes `{ accept, maxBytes, imageMaxDimension, imageMaxPixels, maxSourceBytes, imageMaxSourcePixels, maxImages, maxTotalBytes }`: `maxBytes` (20 MB) is checked on what is sent, so a photo over it is downscaled (1568 px / 1.15 MP) and sent with the note "downscaled from …", and a file `convertFile` turns into text is judged by its text - neither is refused for its original; that original may be up to `maxSourceBytes` (50 MB, never below `maxBytes`), and a picture's up to `imageMaxSourcePixels` (200 MP, read from the header before decoding); one message holds at most `maxImages` pictures (20) and `maxTotalBytes` (20 MB) of attachments as they go - a file past either is left out in words, the rest kept. `convertFile` may return a chip `note` and `images` (`ConvertedImage`: `{ name, blob }`, e.g. a scanned PDF's pages) that go as pictures under the same bounds - see [docs/chat.md](docs/chat.md#attachments-images-pdfs-files-urls). `longText: { maxInputChars, excerptChars?, readTool? }` (off by default) limits the box: one character typed into a full box stops, a counter from 90% (`showInputCounter`), any longer text over it (paste, drop, keyboard chip, IME commit, dictation, draft) becomes the whole text as a `pasted-<date-time>.txt` attachment; with `excerptChars` (off unless given; the agent needs `createFileTools` over `files`, `readTool` names its read tool, default `fs_read`) a text attachment longer than it saved in `files` reaches the model as its beginning, a note and its path - see [docs/chat.md](docs/chat.md#a-limit-on-the-message-box-long-pastes-as-files). `files`: each attachment is written as a NEW file (`-2`, `-3`…; or named by the workspace's own `saveAttachment`, when it has one) before the message goes; a failed write sends nothing and keeps the text and the chips (`attachmentSaveFailed`). |
857
868
  | `<MessageList>` | The transcript; each answer with its steps, tool calls, thoughts, usage. |
858
869
  | `<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`). |
859
870
  | `<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`). |
860
871
  | `<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 picture made with reference pictures names them under it ("Reference: me.jpg", or that the image model took none: labels `mediaReferences` / `mediaReferencesUnused`) / a folded "Transcript of …" block. `<MessageList files showMedia renderMedia>` places them in the answer. |
861
872
  | `<ImageViewer>` / `<ImageThumb>` | A picture opened over the chat, in the page (never in a new window): fitted to the screen, previous / next within its message (arrows, swipe), zoom, Download as a file; a modal dialog with a focus trap, Esc / backdrop / close. Every picture `<MessageList>` draws is an `<ImageThumb>`; `<AgentChat imageViewer={false}>` keeps the old link in a new tab, `renderImageViewer` draws your own. See [docs/chat.md](docs/chat.md#pictures-open-in-the-page-the-image-viewer). |
862
873
  | `<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. |
874
+ | `<NamedFileChips>` | The workspace files a finished answer NAMES without having written them - an absolute path as a whole inline code span or as a Markdown link / image destination, not in a fenced code block (`pathsNamedIn`) - as chips under it ("2 files in this answer"): only a path that is a file of the workspace's listing (nothing read or fetched to find out; `namedFilesOf`), in the order named, at most 12 (`NAMED_FILES_MAX`); a picture opens in the image viewer, the rest as `<FileChips>` previews them; one deleted later shows as gone. `<MessageList files showNamedFiles>` / `<AgentChat showNamedFiles>` (default: the value of `showFileChips`; label `filesNamed`); the transcript lists the workspace once for all its chips; the scan is linear and reads an answer's first 100,000 characters (`NAMED_FILES_TEXT_MAX`). See [docs/chat.md](docs/chat.md#files-an-answer-names). |
875
+ | `<WorkspaceFileLink>` | A link in an answer to a workspace file, for a host's Markdown renderer: `<WorkspaceFileLink path text>{words}</WorkspaceFileLink>` - the words, link-styled, as a `<span role="button">` that wraps like the text around it (click, Enter, Space; never an `<a href>`, nothing navigated or fetched) and opens the file in the page: a picture in the image viewer, any other kind in the chips' preview (SVG as source or as your `renderFileContent` draws it, HTML only in the sandboxed frame) in a dialog over the chat that keeps the file it opened (deleted meanwhile: said there). Only a file of the transcript's one listing (`<MessageList files>`, kept while `showFileChips` or `showNamedFiles` is on); a path the workspace does not have is the words as plain text. Label `fileLinkOpen`. See [docs/chat.md](docs/chat.md#files-an-answer-names). |
863
876
  | `<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). |
864
- | `<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). |
877
+ | `<ToolApprovalPrompt>` | Consent cards (Allow once / Always / Deny; no "Always" on a request an `'ask'` rule asked - `approval.rule`: the core asks it every time; `allowRemember` - a boolean, or a function per request - leaves "Always" out, or offers it there too); 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). |
865
878
  | `<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). |
866
879
  | `<QuestionPrompt>` | A question the agent's model puts to the person (`ask_user`): its options as buttons (a description under each), toggles and Send when several may be picked, Other… for an answer in the person's own words, Skip, keys 1-6, the time left, and the questions the agent went on without; another tab's question without buttons (`questions`, `onAnswer`, `outcomes`, `showOutcomes`, `showExpiry`, `showHelper`, `showRemote`, `numberKeys`, `renderQuestion`). See [Questions from the agent](#questions-from-the-agent--ask_user). |
867
- | `<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). |
868
- | `<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). |
880
+ | `<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` - what the app is told, and the colour scheme every layer of its frame declares -, `defaultCollapsed`, `onOpenPanel`, `onClosePanel`, `showCalls`, `allowFullscreen`, `renderPrompts` - the app's prompts drawn in its panel / sheet / full-screen chrome, above the frame, the focus moved to their region -, `onDisplayChange`, `onFocusPrompt`). Inline, its height is its whole wish up to a cap of three chat heights (`appHeightCap`, of the smaller of the transcript and the window, and only ever up while the frame is shown - `nextAppHeightCap`; size reports applied once a frame): the transcript is the one scroller, and the frame's head sticks to its top while a tall app scrolls by. Taller than the cap, the app scrolls inside and the chrome offers Open in panel and - when allowed and declared - Full screen. `<AgentChat mcpApps>` places them under the answer. See [the boundary](#an-mcp-app-is-a-security-boundary). |
881
+ | `<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). Every "yes" is an `<ArmedButton>`. |
882
+ | `<ArmedButton>` | A button that says yes to an MCP App (`onActivate`, `armMs` - default `PROMPT_ARM_MS`, 500): it takes a press only once it has been on screen, uncovered and still for `armMs`, `aria-disabled` until then; a move disarms it; a press that began before the arming or a key repeat never counts. The pure rules: `createPromptArming`. `<ToolApprovalPrompt>` uses it for an app's request, `<AppRequestPrompt>` for every one. |
869
883
  | `<ApprovalModeSwitch>` | Segmented consent-mode switch. |
870
- | `<ChatHistoryList>` | Saved chats (from `useChatHistory`; the list follows what other tabs of the site save). |
871
- | `<FilesPanel>` | A `VirtualFileSystem`, live: preview, download, delete, upload. |
884
+ | `<ChatHistoryList>` | Saved chats (from `useChatHistory`; the list follows what other tabs of the site save). `headerEnd`: a node at the end of its header row (`<AgentChat>` puts the panel's × there on a narrow chat). |
885
+ | `<FilesPanel>` | A `VirtualFileSystem`, live: preview, download, delete, upload. `headerEnd`: a node at the end of its header row (as above). |
872
886
  | `<LearnedSkills>` | The agent's notebook (`learning`): its lessons, where each came from, forget. |
873
887
  | `<MemoryCard>` | A fact your app remembered, changed or forgot about the user, as a card in the answer: what happened, the fact as text, Undo (`kind`, `text`, `onUndo`, `undone`, `problem`). Placed by `<AgentChat renderToolCard>` (a tool call drawn in the answer, outside the folded activity). See [docs/chat.md](docs/chat.md#tool-cards-a-call-drawn-in-the-answer). |
874
888
  | `<ContextMeter>` | Tokens by kind, budget bar, last compaction, Compact. |
@@ -916,11 +930,12 @@ HTML preview's boundary and adds a bridge:
916
930
  | 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 |
917
931
  | 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 |
918
932
  | 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 |
919
- | 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 |
933
+ | full screen only for an app that declared it, right after a click or a key inside its frame; the host's chrome (who asked, Exit, Esc) on top, the focus kept inside; what it waits for drawn in that chrome, above the frame, outside its box (in the panel and the sheet too) | an app taking over the chat unasked, or hiding a prompt |
920
934
  | 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 |
921
935
  | 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 |
922
- | 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 |
923
- | 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 |
936
+ | tool calls through the agent's consent gate - its mode as the person chose it (Auto asks nothing, Ask asks before a write, Read-only refuses it), a per-tool rule over every mode; "always allow" is that app's alone (the tool, the app, that connection of its server), for the page's life, and never outranks a `'deny'` rule or Read-only - 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 without the person's choice |
937
+ | every "yes" to an app (Allow once / Always allow, Open, Save file, sampling's Allow) armed: it takes a press only after 500 ms on screen, uncovered and still (`PROMPT_ARM_MS`), disarmed when it moves; a press that began before the arming, a key repeat, a key typed elsewhere never count; the focus goes to the prompt's region, never to a button, and never from the message box | a request timed to a keystroke, a held key or a double-click on the app approving itself |
938
+ | the label, the controls, the menu and every prompt drawn by the host outside the frame; inline, the height the app's whole wish (one scroller: the transcript) up to a cap of three heights of the chat, at least 800 px, at most 6000 | an app imitating or covering a control of the chat |
924
939
 
925
940
  That is the default: an opaque origin (no storage or cookies of its own; its requests carry
926
941
  `Origin: null`) - stricter than the specification, which asks a web host for a sandbox proxy on a
@@ -936,7 +951,8 @@ and the guards that change are these:
936
951
 
937
952
  Its cost: the app is same-origin with every other app on the same sandbox origin (one origin for
938
953
  all servers shares storage between them) - `{server}` in the URL gives each server its own.
939
- WebRTC is not governed by `connect-src` in Chromium. Every guard has a test in
954
+ The app's policy lets WebAssembly compile (`'wasm-unsafe-eval'`) and never code from strings
955
+ (`'unsafe-eval'`). WebRTC is not governed by `connect-src` in Chromium. Every guard has a test in
940
956
  `tests/apps.test.ts` / `tests/apps-sandbox.test.ts` and, in a real browser against a hostile app,
941
957
  in `e2e/apps.spec.ts` / `e2e/apps-sandbox.spec.ts`. Details:
942
958
  [docs/chat.md](docs/chat.md#an-app-is-a-security-boundary).
@@ -2,11 +2,13 @@
2
2
  var MCP_APP_SANDBOX_PROXY_READY = "ui/notifications/sandbox-proxy-ready";
3
3
  var MCP_APP_SANDBOX_RESOURCE_READY = "ui/notifications/sandbox-resource-ready";
4
4
  var isMcpAppSandboxMessage = (data) => typeof data === "object" && data !== null && typeof data.method === "string" && data.method.startsWith("ui/notifications/sandbox-");
5
+ var MCP_APP_SCHEME_PARAM = "scheme";
6
+ var mcpAppColorScheme = (value) => value === "light" || value === "dark" ? value : void 0;
5
7
  var mcpAppPolicy = ({ connect, resources }) => {
6
8
  const from = resources.length > 0 ? ` ${resources.join(" ")}` : "";
7
9
  return [
8
10
  "default-src 'none'",
9
- `script-src 'unsafe-inline'${from}`,
11
+ `script-src 'unsafe-inline' 'wasm-unsafe-eval'${from}`,
10
12
  `style-src 'unsafe-inline'${from}`,
11
13
  `img-src data: blob:${from}`,
12
14
  `font-src data:${from}`,
@@ -84,6 +86,8 @@ export {
84
86
  MCP_APP_SANDBOX_PROXY_READY,
85
87
  MCP_APP_SANDBOX_RESOURCE_READY,
86
88
  isMcpAppSandboxMessage,
89
+ MCP_APP_SCHEME_PARAM,
90
+ mcpAppColorScheme,
87
91
  mcpAppPolicy,
88
92
  mcpAppPolicyOrigin,
89
93
  MCP_APP_POLICY_MAX_ORIGINS,
@@ -91,4 +95,4 @@ export {
91
95
  mcpAppPolicyToken,
92
96
  mcpAppPolicyOfToken
93
97
  };
94
- //# sourceMappingURL=chunk-FXHQXIOU.js.map
98
+ //# sourceMappingURL=chunk-AWZ2OZSG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/mcp-app-policy.ts"],"sourcesContent":["/**\n * MCP Apps: what the host (the page, `mcp-app.ts`) and the sandbox proxy (a page on ANOTHER\n * origin, `mcp-app-sandbox.ts`) must agree on - the app's Content-Security-Policy, the policy as a\n * path segment of the proxy's URL, and the names of the sandbox messages. Pure code with NO\n * imports at all: the proxy's server bundles it without React or the core (a Worker), so the\n * origin rule below is a copy of the core's `mcpAppOrigin`, and `tests/apps-sandbox.test.ts`\n * holds the two to the same answers.\n */\n\n/** The proxy tells the host it can take the app (Sandbox → Host; content-free). */\nexport const MCP_APP_SANDBOX_PROXY_READY = 'ui/notifications/sandbox-proxy-ready'\n/** The host hands the proxy the app's HTML (Host → Sandbox), once. */\nexport const MCP_APP_SANDBOX_RESOURCE_READY = 'ui/notifications/sandbox-resource-ready'\n\n/** The specification reserves these between a host and its proxy: never relayed to or from an app. */\nexport const isMcpAppSandboxMessage = (data: unknown): boolean =>\n typeof data === 'object' &&\n data !== null &&\n typeof (data as { method?: unknown }).method === 'string' &&\n (data as { method: string }).method.startsWith('ui/notifications/sandbox-')\n\n/**\n * The colour scheme of an app's frame: the theme the app is told when its frame is drawn. Every\n * document between the page and the app declares it (the frame element, the shell, the sandbox\n * page and its frame), because a browser paints an OPAQUE canvas - the canvas colour of the\n * embedded document's own scheme - behind a document whose scheme differs from its frame\n * element's: an app that is dark with a transparent body was drawn on white.\n */\nexport type McpAppColorScheme = 'light' | 'dark'\n\n/** The query parameter of the sandbox page that carries the scheme (`?scheme=dark`). */\nexport const MCP_APP_SCHEME_PARAM = 'scheme'\n\n/** `light` or `dark` exactly; anything else is no scheme (nothing is declared). */\nexport const mcpAppColorScheme = (value: unknown): McpAppColorScheme | undefined =>\n value === 'light' || value === 'dark' ? value : undefined\n\n/** The origins an app's policy grants, each already an origin (`mcpAppPolicyOrigin`). */\nexport interface McpAppPolicyOrigins {\n /** `fetch` / XHR / WebSocket (`connect-src`). */\n connect: string[]\n /** Scripts, styles, images, fonts, media. */\n resources: string[]\n}\n\n/**\n * The policy of an app's document: scripts and styles inline, `data:` / `blob:` media, and the\n * network ONLY where the resource declared it. Nested frames, workers, plugins, forms and `<base>`\n * are refused whatever was declared (a frame the app may embed would also be a place it may\n * navigate itself to). The lists must already be checked origins: nothing here re-checks them.\n *\n * `'wasm-unsafe-eval'` lets the app compile WebAssembly (a tracer, a codec, a parser), which the\n * specification's default policy leaves out and a server cannot ask for (it declares origins, not\n * keywords). It adds no reach: a module only calls what the app's own script hands it, and the\n * network stays `connect-src`. `eval`, `new Function` and string timers stay refused - that is\n * `'unsafe-eval'`, which is never granted.\n */\nexport const mcpAppPolicy = ({ connect, resources }: McpAppPolicyOrigins): string => {\n const from = resources.length > 0 ? ` ${resources.join(' ')}` : ''\n return [\n \"default-src 'none'\",\n `script-src 'unsafe-inline' 'wasm-unsafe-eval'${from}`,\n `style-src 'unsafe-inline'${from}`,\n `img-src data: blob:${from}`,\n `font-src data:${from}`,\n `media-src data: blob:${from}`,\n connect.length > 0 ? `connect-src ${connect.join(' ')}` : \"connect-src 'none'\",\n \"frame-src 'none'\",\n \"child-src 'none'\",\n \"worker-src 'none'\",\n \"object-src 'none'\",\n \"form-action 'none'\",\n \"base-uri 'none'\",\n \"webrtc 'block'\",\n ].join('; ')\n}\n\n// ── The origin rule: a COPY of the core's `mcpAppOrigin` (src/mcp/apps.ts) ──────────────────\n\nconst LABEL = '[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?'\nconst HOST = `(?:\\\\*\\\\.)?${LABEL}(?:\\\\.${LABEL})*`\nconst PORT = '(?::\\\\d{1,5})?'\nconst SECURE_ORIGIN = new RegExp(`^(?:https|wss)://${HOST}${PORT}$`)\nconst LOOPBACK_ORIGIN = new RegExp(`^(?:http|ws)://(?:localhost|127\\\\.0\\\\.0\\\\.1|\\\\[::1\\\\])${PORT}$`)\n\n/**\n * One declared CSP entry as a source expression a policy may carry, or `undefined`: only an\n * origin (`https://` / `wss://`, a `*.` wildcard over at least two labels, or `http://` /\n * `ws://` on loopback). The same answers as the core's `mcpAppOrigin`, for the proxy's server.\n */\nexport const mcpAppPolicyOrigin = (entry: unknown): string | undefined => {\n if (typeof entry !== 'string' || entry.length > 300) return undefined\n const value = entry.trim().toLowerCase().replace(/\\/$/, '')\n if (SECURE_ORIGIN.test(value)) {\n const host = value.replace(/^[a-z]+:\\/\\//, '').replace(/:\\d+$/, '')\n if (host.startsWith('*.') && !host.slice(2).includes('.')) return undefined\n return value\n }\n return LOOPBACK_ORIGIN.test(value) ? value : undefined\n}\n\n// ── The policy in the proxy's URL ────────────────────────────────────────────────────────────\n\n/** At most this many origins per list (the core's `MCP_APP_MAX_DOMAINS`). */\nexport const MCP_APP_POLICY_MAX_ORIGINS = 32\n/** A policy token longer than this is not put in a URL: the app runs without its own origin. */\nexport const MCP_APP_POLICY_TOKEN_MAX_CHARS = 4096\n\nconst B64URL = /^[A-Za-z0-9_-]+$/\n\n/**\n * The policy as one path segment (base64url of `{\"c\":[…],\"r\":[…]}`), or `undefined` when it does\n * not fit. It is in the PATH, not the query, because a `frame-src` source expression matches a\n * path exactly and ignores the query: the host pins the proxy's frame to this one URL, so nothing\n * inside the frame can load the proxy page with a policy of its choosing.\n */\nexport const mcpAppPolicyToken = ({\n connect,\n resources,\n}: McpAppPolicyOrigins): string | undefined => {\n const json = JSON.stringify({ c: connect, r: resources })\n // Origins are ASCII; anything else is not a list of checked origins.\n if (/[^\\x20-\\x7e]/.test(json)) return undefined\n const token = btoa(json).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '')\n return token.length <= MCP_APP_POLICY_TOKEN_MAX_CHARS ? token : undefined\n}\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\n\nconst originList = (value: unknown): string[] | undefined => {\n if (!Array.isArray(value) || value.length > MCP_APP_POLICY_MAX_ORIGINS) return undefined\n const out: string[] = []\n for (const entry of value) {\n // Exactly an origin as the host writes it: checked, canonical, once.\n if (typeof entry !== 'string' || mcpAppPolicyOrigin(entry) !== entry || out.includes(entry)) {\n return undefined\n }\n out.push(entry)\n }\n return out\n}\n\n/**\n * The policy a token stands for, or `undefined` for anything that is not exactly what\n * `mcpAppPolicyToken` writes: base64url of an object with the two lists and nothing else, every\n * entry an origin by the rule above, no more than `MCP_APP_POLICY_MAX_ORIGINS` each, the\n * canonical encoding (one URL per policy).\n */\nexport const mcpAppPolicyOfToken = (token: unknown): McpAppPolicyOrigins | undefined => {\n if (\n typeof token !== 'string' ||\n token.length === 0 ||\n token.length > MCP_APP_POLICY_TOKEN_MAX_CHARS ||\n !B64URL.test(token)\n ) {\n return undefined\n }\n let parsed: unknown\n try {\n parsed = JSON.parse(atob(token.replace(/-/g, '+').replace(/_/g, '/')))\n } catch {\n return undefined\n }\n if (!isObject(parsed)) return undefined\n const keys = Object.keys(parsed)\n if (keys.length !== 2 || !keys.includes('c') || !keys.includes('r')) return undefined\n const connect = originList(parsed.c)\n const resources = originList(parsed.r)\n if (!connect || !resources) return undefined\n const policy = { connect, resources }\n return mcpAppPolicyToken(policy) === token ? policy : undefined\n}\n"],"mappings":";AAUO,IAAM,8BAA8B;AAEpC,IAAM,iCAAiC;AAGvC,IAAM,yBAAyB,CAAC,SACrC,OAAO,SAAS,YAChB,SAAS,QACT,OAAQ,KAA8B,WAAW,YAChD,KAA4B,OAAO,WAAW,2BAA2B;AAYrE,IAAM,uBAAuB;AAG7B,IAAM,oBAAoB,CAAC,UAChC,UAAU,WAAW,UAAU,SAAS,QAAQ;AAsB3C,IAAM,eAAe,CAAC,EAAE,SAAS,UAAU,MAAmC;AACnF,QAAM,OAAO,UAAU,SAAS,IAAI,IAAI,UAAU,KAAK,GAAG,CAAC,KAAK;AAChE,SAAO;AAAA,IACL;AAAA,IACA,gDAAgD,IAAI;AAAA,IACpD,4BAA4B,IAAI;AAAA,IAChC,sBAAsB,IAAI;AAAA,IAC1B,iBAAiB,IAAI;AAAA,IACrB,wBAAwB,IAAI;AAAA,IAC5B,QAAQ,SAAS,IAAI,eAAe,QAAQ,KAAK,GAAG,CAAC,KAAK;AAAA,IAC1D;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AACb;AAIA,IAAM,QAAQ;AACd,IAAM,OAAO,cAAc,KAAK,SAAS,KAAK;AAC9C,IAAM,OAAO;AACb,IAAM,gBAAgB,IAAI,OAAO,oBAAoB,IAAI,GAAG,IAAI,GAAG;AACnE,IAAM,kBAAkB,IAAI,OAAO,yDAAyD,IAAI,GAAG;AAO5F,IAAM,qBAAqB,CAAC,UAAuC;AACxE,MAAI,OAAO,UAAU,YAAY,MAAM,SAAS,IAAK,QAAO;AAC5D,QAAM,QAAQ,MAAM,KAAK,EAAE,YAAY,EAAE,QAAQ,OAAO,EAAE;AAC1D,MAAI,cAAc,KAAK,KAAK,GAAG;AAC7B,UAAM,OAAO,MAAM,QAAQ,gBAAgB,EAAE,EAAE,QAAQ,SAAS,EAAE;AAClE,QAAI,KAAK,WAAW,IAAI,KAAK,CAAC,KAAK,MAAM,CAAC,EAAE,SAAS,GAAG,EAAG,QAAO;AAClE,WAAO;AAAA,EACT;AACA,SAAO,gBAAgB,KAAK,KAAK,IAAI,QAAQ;AAC/C;AAKO,IAAM,6BAA6B;AAEnC,IAAM,iCAAiC;AAE9C,IAAM,SAAS;AAQR,IAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AACF,MAA+C;AAC7C,QAAM,OAAO,KAAK,UAAU,EAAE,GAAG,SAAS,GAAG,UAAU,CAAC;AAExD,MAAI,eAAe,KAAK,IAAI,EAAG,QAAO;AACtC,QAAM,QAAQ,KAAK,IAAI,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,EAAE;AAClF,SAAO,MAAM,UAAU,iCAAiC,QAAQ;AAClE;AAEA,IAAM,WAAW,CAAC,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,IAAM,aAAa,CAAC,UAAyC;AAC3D,MAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,SAAS,2BAA4B,QAAO;AAC/E,QAAM,MAAgB,CAAC;AACvB,aAAW,SAAS,OAAO;AAEzB,QAAI,OAAO,UAAU,YAAY,mBAAmB,KAAK,MAAM,SAAS,IAAI,SAAS,KAAK,GAAG;AAC3F,aAAO;AAAA,IACT;AACA,QAAI,KAAK,KAAK;AAAA,EAChB;AACA,SAAO;AACT;AAQO,IAAM,sBAAsB,CAAC,UAAoD;AACtF,MACE,OAAO,UAAU,YACjB,MAAM,WAAW,KACjB,MAAM,SAAS,kCACf,CAAC,OAAO,KAAK,KAAK,GAClB;AACA,WAAO;AAAA,EACT;AACA,MAAI;AACJ,MAAI;AACF,aAAS,KAAK,MAAM,KAAK,MAAM,QAAQ,MAAM,GAAG,EAAE,QAAQ,MAAM,GAAG,CAAC,CAAC;AAAA,EACvE,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI,CAAC,SAAS,MAAM,EAAG,QAAO;AAC9B,QAAM,OAAO,OAAO,KAAK,MAAM;AAC/B,MAAI,KAAK,WAAW,KAAK,CAAC,KAAK,SAAS,GAAG,KAAK,CAAC,KAAK,SAAS,GAAG,EAAG,QAAO;AAC5E,QAAM,UAAU,WAAW,OAAO,CAAC;AACnC,QAAM,YAAY,WAAW,OAAO,CAAC;AACrC,MAAI,CAAC,WAAW,CAAC,UAAW,QAAO;AACnC,QAAM,SAAS,EAAE,SAAS,UAAU;AACpC,SAAO,kBAAkB,MAAM,MAAM,QAAQ,SAAS;AACxD;","names":[]}
@@ -1,4 +1,5 @@
1
1
  import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCallRequest, AppSamplingRequest, AppSamplingResult, AgentToolSet, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, AskUserOption, AskUserAction, SessionHolder, ReplanMode, AgentEvent } from '@dudko.dev/agent-web';
2
+ import { d as McpAppColorScheme } from './mcp-app-policy-BhBIsbBy.cjs';
2
3
 
3
4
  /**
4
5
  * MCP Apps, the host's side: the security core of `<McpAppFrame>`, as pure code - no React, no
@@ -34,9 +35,34 @@ import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCa
34
35
  declare const MCP_APP_PROTOCOL_VERSION = "2026-01-26";
35
36
  /** An app's frame height, before it says how tall it is. */
36
37
  declare const APP_DEFAULT_HEIGHT = 360;
37
- /** The frame's height is the host's: the app's wish, clamped to these. */
38
+ /**
39
+ * The frame's height is the host's: the app's wish, clamped to `APP_MIN_HEIGHT` .. the cap. The
40
+ * cap is `appHeightCap` of the chat's visible height - a few screens, never less than
41
+ * `APP_MAX_HEIGHT` - so an app as tall as its content has no scroller of its own inside the
42
+ * transcript (one scroller: the chat's), and an app that grows forever stops there.
43
+ */
38
44
  declare const APP_MIN_HEIGHT = 120;
45
+ /** The least the cap is (and the cap where nothing says how tall the chat is). */
39
46
  declare const APP_MAX_HEIGHT = 800;
47
+ /** The cap is this many of the chat's visible heights. */
48
+ declare const APP_HEIGHT_SCREENS = 3;
49
+ /** ... and never more than this, whatever the screen. */
50
+ declare const APP_HEIGHT_CEILING = 6000;
51
+ /**
52
+ * The tallest an inline app's frame is drawn, for a chat body (or viewport) `viewHeight` px tall:
53
+ * `APP_HEIGHT_SCREENS` of it, rounded down to 100 px (the app is told it in
54
+ * `containerDimensions.maxHeight`, and a resize of a few pixels must not tell it again), at least
55
+ * `APP_MAX_HEIGHT`, at most `APP_HEIGHT_CEILING`.
56
+ */
57
+ declare const appHeightCap: (viewHeight: number | undefined) => number;
58
+ /**
59
+ * The cap of a frame that is already drawn, when the chat's height changes: `appHeightCap` of the
60
+ * new height, but never less than the cap the frame had (`current`) - a rotation, a keyboard
61
+ * resizing the page or a relayout for a touch screen must not give an app that was drawn whole a
62
+ * scroller of its own. The cap only grows while the frame is shown (at most
63
+ * `APP_HEIGHT_CEILING`); a new frame starts from the cap of its moment.
64
+ */
65
+ declare const nextAppHeightCap: (current: number, viewHeight: number | undefined) => number;
40
66
  /** At most this many requests of one app wait at once (tool calls, links, messages). */
41
67
  declare const MCP_APP_MAX_IN_FLIGHT = 3;
42
68
  /** A message an app puts in the chat: at most this many characters. */
@@ -45,7 +71,8 @@ declare const MCP_APP_MAX_MESSAGE_CHARS = 4000;
45
71
  declare const MCP_APP_MAX_URL_CHARS = 2048;
46
72
  /** The arguments of a tool call an app makes: at most this many characters as JSON. */
47
73
  declare const MCP_APP_MAX_ARGS_CHARS = 64000;
48
- declare const clampAppHeight: (height: number) => number;
74
+ /** An app's wish for a height, as the frame draws it: within `APP_MIN_HEIGHT` .. `max` (the cap). */
75
+ declare const clampAppHeight: (height: number, max?: number) => number;
49
76
  /**
50
77
  * The policy of an app's document: scripts and styles inline, `data:` / `blob:` media, and the
51
78
  * network ONLY where the resource declared it - `connectDomains` for `fetch` / XHR / WebSocket,
@@ -70,8 +97,10 @@ declare const MCP_APP_RELAY: string;
70
97
  * What goes into the OUTER frame's `srcdoc`: the shell (the app's policy first, one inner frame
71
98
  * that fills it, the relay) carrying the app, escaped, as the inner frame's `srcdoc` - with the
72
99
  * same policy first in it. Give the outer `<iframe>` `sandbox="allow-scripts"` and nothing else.
100
+ * `scheme` (the theme the app is told) is declared by the shell and its inner frame; give the
101
+ * outer `<iframe>` the same `color-scheme`. Only `light` / `dark` are declared.
73
102
  */
74
- declare const buildMcpAppDocument: (html: string, csp?: Partial<McpAppCsp>) => string;
103
+ declare const buildMcpAppDocument: (html: string, csp?: Partial<McpAppCsp>, scheme?: McpAppColorScheme) => string;
75
104
  /** A link an app asks to open, taken apart for the prompt: the host is what the user checks. */
76
105
  interface AppLink {
77
106
  /** The normalised URL (what is opened). */
@@ -215,6 +244,8 @@ declare class McpAppBridge {
215
244
  close(): void;
216
245
  /** Tell the app it is being torn down (not waited for: the frame goes anyway). */
217
246
  teardown(reason: string): void;
247
+ /** The display modes the app declared at `ui/initialize` (undefined: none, or not yet). */
248
+ get appDisplayModes(): readonly McpAppDisplayMode[] | undefined;
218
249
  /** How the app is shown now (`hostContext.displayMode`). */
219
250
  get displayMode(): McpAppDisplayMode;
220
251
  /** Tell an initialized app that part of the host context changed (the theme). */
@@ -400,9 +431,12 @@ declare const mcpAppSandboxShellCsp: (proxyUrl: string) => string;
400
431
  * What goes into the OUTER frame's `srcdoc` in sandbox mode: the shell - its policy first, one
401
432
  * frame of the proxy page, no script, nothing of the app. Give the outer `<iframe>`
402
433
  * `sandbox={MCP_APP_SANDBOX_FRAME_TOKENS}` and nothing else. Throws on a URL that is not a proxy
403
- * URL this package builds (`mcpAppSandboxProxyUrl`).
434
+ * URL this package builds (`mcpAppSandboxProxyUrl`). `scheme` is declared by the shell and its
435
+ * frame, and handed to the proxy page as `?scheme=` on its frame's `src` ONLY: the shell's
436
+ * `frame-src` stays the path (a source expression carries no query, and a path source ignores
437
+ * one), so the pin is the same with or without it.
404
438
  */
405
- declare const buildMcpAppSandboxShell: (proxyUrl: string) => string;
439
+ declare const buildMcpAppSandboxShell: (proxyUrl: string, scheme?: McpAppColorScheme) => string;
406
440
  /** What one message from the proxy's frame is, for the page (`McpAppSandboxLink.receive`). */
407
441
  type McpAppSandboxInput = 'drop' | 'ready' | 'broken' | 'app';
408
442
  interface McpAppSandboxLinkOptions {
@@ -461,6 +495,8 @@ interface McpAppsConnectionLike {
461
495
  readOnly: boolean;
462
496
  description?: string;
463
497
  inputSchema?: unknown;
498
+ /** The server's identity on its connection (newer cores): what a grant is kept under. */
499
+ serverId?: string;
464
500
  } | undefined;
465
501
  callAppTool: (server: string, name: string, args: Record<string, unknown>, options?: {
466
502
  signal?: AbortSignal;
@@ -554,6 +590,15 @@ interface McpAppHost {
554
590
  };
555
591
  /** Whether the app has something waiting for the user (a link, a message, a tool call). */
556
592
  isWaiting: (app: AppView) => boolean;
593
+ /**
594
+ * What this app waits for: its tool calls' consent requests (of `approvals`: its server and
595
+ * resource, while one of its calls is at the gate) and its other requests. A host draws them
596
+ * where the app is (`<McpAppFrame renderPrompts>`); answered there, they are answered.
597
+ */
598
+ pendingFor: (app: AppView) => {
599
+ approvals: ApprovalView[];
600
+ requests: AppRequestView[];
601
+ };
557
602
  /**
558
603
  * Where apps run: on an origin of their own, through the sandbox page at this URL - or, when
559
604
  * absent (the default), in an opaque frame. See `McpAppSandboxOptions`.
@@ -563,8 +608,13 @@ interface McpAppHost {
563
608
  interface UseMcpAppHostOptions {
564
609
  /** The connection(s) the apps came from; without one, frames say their server is not connected. */
565
610
  connection?: McpAppsConnectionLike;
566
- /** The agent's consent gate for an app's calls: `useAgent().approveAppToolCall`. */
567
- approve?: (call: AppToolCallRequest, signal?: AbortSignal) => Promise<void>;
611
+ /**
612
+ * The agent's consent gate for an app's calls: `useAgent().approveAppToolCall`. The call carries
613
+ * `frame` (the asking frame's `AppView.id`) and `serverId` (its connection's identity).
614
+ */
615
+ approve?: (call: AppToolCallRequest & {
616
+ frame?: string;
617
+ }, signal?: AbortSignal) => Promise<void>;
568
618
  /** The pending consent requests (`useAgent().pendingApprovals`): an app's are its "waiting". */
569
619
  approvals?: ApprovalView[];
570
620
  /**
@@ -585,6 +635,11 @@ interface UseMcpAppHostOptions {
585
635
  /** The agent's seam for it: `useAgent().sampleForApp`. */
586
636
  sample?: (request: AppSamplingRequest, approve: (view: AppSamplingView) => Promise<boolean>, signal?: AbortSignal) => Promise<AppSamplingResult>;
587
637
  }
638
+ /**
639
+ * A pending consent request of THIS frame (`ApprovalView.app.frame`, set by `useAgent`); for a
640
+ * request that names no frame (a host's own gate), one of this app's server and resource.
641
+ */
642
+ declare const isApprovalOfApp: (approval: ApprovalView, app: AppView) => boolean;
588
643
  /**
589
644
  * The host's side of MCP Apps for a chat: reads an app from its own server, puts each tool call
590
645
  * an app asks for through the agent's consent gate, and holds the link and message requests until
@@ -1127,12 +1182,14 @@ interface ApprovalView {
1127
1182
  * Set when an MCP App asks, not the model (`useAgent().approveAppToolCall`): its server, the
1128
1183
  * tool's own name there and the app's resource. `name` is then the key the consent rules
1129
1184
  * match. Such a request outlives a run (it is the user's, not the run's) and is never kept on
1130
- * a message.
1185
+ * a message. `frame` is the host's id of the frame that asked (`AppView.id`, from
1186
+ * `AppToolCall.frame`): two frames of one app each have their own requests.
1131
1187
  */
1132
1188
  app?: {
1133
1189
  server: string;
1134
1190
  tool: string;
1135
1191
  resourceUri: string;
1192
+ frame?: string;
1136
1193
  };
1137
1194
  /**
1138
1195
  * Asked in another tab, by a run of this conversation going on there (`AgentUiState.remote`):
@@ -1148,6 +1205,12 @@ interface ApprovalView {
1148
1205
  * request is decided, so a saved conversation does not keep a server's instructions.
1149
1206
  */
1150
1207
  skill?: SkillConsentView;
1208
+ /**
1209
+ * Set when an explicit `'ask'` rule asked (the core's `ToolApprovalRequest.rule`): its name or
1210
+ * pattern. The core asks such a call EVERY time - no "always allow" answers a rule -, so
1211
+ * `<ToolApprovalPrompt>` offers no "Always allow" on it by default.
1212
+ */
1213
+ rule?: string;
1151
1214
  }
1152
1215
  /** What a person is shown of an MCP server's skill (the core's `McpSkillConsentView`). */
1153
1216
  type SkillConsentView = Omit<McpSkillConsentView, 'body'> & {
@@ -1684,5 +1747,5 @@ type ElicitationOutcomeReason = 'timeout' | 'step-timeout' | 'aborted' | 'stoppe
1684
1747
  /** "4:05" - what is left of a question's time. */
1685
1748
  declare const formatCountdown: (ms: number) => string;
1686
1749
 
1687
- export { MCP_APP_MAX_FILE_NAME_CHARS as $, MCP_APP_DISPLAY_MODES as Y, MCP_APP_MAX_ARGS_CHARS as Z, MCP_APP_MAX_DOWNLOAD_BYTES as _, MCP_APP_MAX_IN_FLIGHT as a0, MCP_APP_MAX_MESSAGE_CHARS as a1, MCP_APP_MAX_URL_CHARS as a2, MCP_APP_NOTIFICATIONS as a3, MCP_APP_OPTIONAL_REQUESTS as a4, MCP_APP_PROTOCOL_VERSION as a5, MCP_APP_REFUSED as a6, MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS as a7, MCP_APP_REFUSED_DOWNLOAD_TYPES as a8, MCP_APP_RELAY as a9, appFileExtensionOf as aA, appFileNameOf as aB, appGestureOf as aC, appLinkOf as aD, appMessageTextOf as aE, appMimeTypeOf as aF, appSamplingErrorOf as aG, buildMcpAppDocument as aH, buildMcpAppSandboxShell as aI, clampAppHeight as aJ, elicitationFields as aK, elicitationFormAnswer as aL, elicitationInitialDraft as aM, elicitationLink as aN, formatCountdown as aO, grantedAppCsp as aP, mcpAppCsp as aQ, mcpAppHostCapabilities as aR, mcpAppSandboxProxyUrl as aS, mcpAppSandboxShellCsp as aT, mcpAppSandboxTarget as aU, resolveAppDownload as aV, saveAppFile as aW, useMcpAppHost as aX, MCP_APP_REQUESTS as aa, MCP_APP_SANDBOX_FRAME_TOKENS as ab, MCP_APP_SANDBOX_GRACE_MS as ac, MCP_APP_SANDBOX_SERVER as ad, MCP_APP_SANDBOX_TIMEOUT_MS as ae, McpAppBridge as af, McpAppRpcError as aj, McpAppSandboxLink as am, appDisplayModeAllowed as ax, appDownloadOf as ay, appDownloadRefusal as az, createElicitationQueue as bc, elicitationConnectOptions as bd, elicitationSettings as be, elicitationTimeoutOf as bf, APP_DEFAULT_HEIGHT as s, APP_MAX_HEIGHT as t, APP_MIN_HEIGHT as u };
1688
- export type { AgentUiState as A, BudgetView as B, ChatAttachment as C, DecisionView as D, ElicitationIssueKind as E, AppResourceReader as F, ElicitationControl as G, ElicitationDraft as H, ElicitationDraftValue as I, ElicitationField as J, ElicitationFormOutcome as K, LessonView as L, McpAppSandboxReason as M, ElicitationIssue as N, ElicitationLink as O, PendingElicitation as P, QuestionView as Q, RemoteRunView as R, SubagentView as S, ToolCallView as T, UserNoteView as U, ElicitationOption as V, WrittenFileView as W, FetchView as X, ApprovalView as a, McpCatalogEntry as a$, McpOAuthRegistration as aY, McpProtocolMode as aZ, McpElicitationOptions as a_, McpAppBridgeHandlers as ag, McpAppBridgeOptions as ah, McpAppDisplayMode as ai, McpAppRpcMessage as ak, McpAppSandboxInput as al, McpAppSandboxLinkOptions as an, McpAppSandboxTarget as ao, McpElicitationFieldSchema as ap, McpElicitationRequest as aq, McpElicitationSchema as ar, QueuedMessageView as as, ReplanState as at, SkillConsentView as au, StepEscalationView as av, UseMcpAppHostOptions as aw, ChatMessage as b, McpServerProtocol as b0, McpOAuthRegistrationKind as b1, McpOAuthCallback as b2, McpServerResult as b3, McpModule as b4, ConnectedMcp as b5, BrowserOAuthProviderOptions as b6, BrowserOAuthProvider as b7, ElicitationQueue as b8, ElicitationQueueOptions as b9, McpElicitationHandler as ba, McpServerInstructions as bb, AgentStatus as c, ElicitationOutcomeReason as d, SubagentNode as e, McpElicitationResult as f, ElicitationView as g, StepView as h, MediaView as i, AppView as j, McpAppsConnectionLike as k, McpAppSandboxOptions as l, AppRequestView as m, TranscriptView as n, CompactionView as o, ModelLoadState as p, McpAppHost as q, AppRequestAnswerOptions as r, AppDownload as v, AppDownloadView as w, AppFileSaverEnv as x, AppLink as y, AppReadyDownload as z };
1750
+ export { MCP_APP_DISPLAY_MODES as $, saveAppFile as a$, MCP_APP_MAX_ARGS_CHARS as a0, MCP_APP_MAX_DOWNLOAD_BYTES as a1, MCP_APP_MAX_FILE_NAME_CHARS as a2, MCP_APP_MAX_IN_FLIGHT as a3, MCP_APP_MAX_MESSAGE_CHARS as a4, MCP_APP_MAX_URL_CHARS as a5, MCP_APP_NOTIFICATIONS as a6, MCP_APP_OPTIONAL_REQUESTS as a7, MCP_APP_PROTOCOL_VERSION as a8, MCP_APP_REFUSED as a9, appDownloadOf as aA, appDownloadRefusal as aB, appFileExtensionOf as aC, appFileNameOf as aD, appGestureOf as aE, appHeightCap as aF, appLinkOf as aG, appMessageTextOf as aH, appMimeTypeOf as aI, appSamplingErrorOf as aJ, buildMcpAppDocument as aK, buildMcpAppSandboxShell as aL, clampAppHeight as aM, elicitationFields as aN, elicitationFormAnswer as aO, elicitationInitialDraft as aP, elicitationLink as aQ, formatCountdown as aR, grantedAppCsp as aS, isApprovalOfApp as aT, mcpAppCsp as aU, mcpAppHostCapabilities as aV, mcpAppSandboxProxyUrl as aW, mcpAppSandboxShellCsp as aX, mcpAppSandboxTarget as aY, nextAppHeightCap as aZ, resolveAppDownload as a_, MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS as aa, MCP_APP_REFUSED_DOWNLOAD_TYPES as ab, MCP_APP_RELAY as ac, MCP_APP_REQUESTS as ad, MCP_APP_SANDBOX_FRAME_TOKENS as ae, MCP_APP_SANDBOX_GRACE_MS as af, MCP_APP_SANDBOX_SERVER as ag, MCP_APP_SANDBOX_TIMEOUT_MS as ah, McpAppBridge as ai, McpAppRpcError as al, McpAppSandboxLink as ao, appDisplayModeAllowed as az, useMcpAppHost as b0, createElicitationQueue as bh, elicitationConnectOptions as bi, elicitationSettings as bj, elicitationTimeoutOf as bk, APP_DEFAULT_HEIGHT as t, APP_HEIGHT_CEILING as u, APP_HEIGHT_SCREENS as v, APP_MAX_HEIGHT as w, APP_MIN_HEIGHT as x };
1751
+ export type { AgentUiState as A, BudgetView as B, ChatAttachment as C, DecisionView as D, ElicitationIssueKind as E, AppFileSaverEnv as F, AppLink as G, AppReadyDownload as H, AppResourceReader as I, ElicitationControl as J, ElicitationDraft as K, LessonView as L, McpAppSandboxReason as M, ElicitationDraftValue as N, ElicitationField as O, PendingElicitation as P, QuestionView as Q, RemoteRunView as R, SubagentView as S, ToolCallView as T, UserNoteView as U, ElicitationFormOutcome as V, WrittenFileView as W, ElicitationIssue as X, ElicitationLink as Y, ElicitationOption as Z, FetchView as _, ApprovalView as a, McpAppBridgeHandlers as aj, McpAppBridgeOptions as ak, McpAppRpcMessage as am, McpAppSandboxInput as an, McpAppSandboxLinkOptions as ap, McpAppSandboxTarget as aq, McpElicitationFieldSchema as ar, McpElicitationRequest as as, McpElicitationSchema as at, QueuedMessageView as au, ReplanState as av, SkillConsentView as aw, StepEscalationView as ax, UseMcpAppHostOptions as ay, ChatMessage as b, McpOAuthRegistration as b1, McpProtocolMode as b2, McpElicitationOptions as b3, McpCatalogEntry as b4, McpServerProtocol as b5, McpOAuthRegistrationKind as b6, McpOAuthCallback as b7, McpServerResult as b8, McpModule as b9, ConnectedMcp as ba, BrowserOAuthProviderOptions as bb, BrowserOAuthProvider as bc, ElicitationQueue as bd, ElicitationQueueOptions as be, McpElicitationHandler as bf, McpServerInstructions as bg, AgentStatus as c, ElicitationOutcomeReason as d, SubagentNode as e, McpElicitationResult as f, ElicitationView as g, StepView as h, MediaView as i, AppView as j, McpAppsConnectionLike as k, McpAppSandboxOptions as l, AppRequestView as m, TranscriptView as n, CompactionView as o, ModelLoadState as p, McpAppHost as q, McpAppDisplayMode as r, AppRequestAnswerOptions as s, AppDownload as y, AppDownloadView as z };
@@ -1,4 +1,5 @@
1
1
  import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCallRequest, AppSamplingRequest, AppSamplingResult, AgentToolSet, IPlan, IPlanStep, ModelTier, TierReason, EscalationReason, DecisionPoint, DecisionFallbackReason, McpSkillConsentView, IUsage, AskUserOption, AskUserAction, SessionHolder, ReplanMode, AgentEvent } from '@dudko.dev/agent-web';
2
+ import { d as McpAppColorScheme } from './mcp-app-policy-BhBIsbBy.js';
2
3
 
3
4
  /**
4
5
  * MCP Apps, the host's side: the security core of `<McpAppFrame>`, as pure code - no React, no
@@ -34,9 +35,34 @@ import { McpAppCsp, McpAppResource, McpAppToolResult, AppSamplingView, AppToolCa
34
35
  declare const MCP_APP_PROTOCOL_VERSION = "2026-01-26";
35
36
  /** An app's frame height, before it says how tall it is. */
36
37
  declare const APP_DEFAULT_HEIGHT = 360;
37
- /** The frame's height is the host's: the app's wish, clamped to these. */
38
+ /**
39
+ * The frame's height is the host's: the app's wish, clamped to `APP_MIN_HEIGHT` .. the cap. The
40
+ * cap is `appHeightCap` of the chat's visible height - a few screens, never less than
41
+ * `APP_MAX_HEIGHT` - so an app as tall as its content has no scroller of its own inside the
42
+ * transcript (one scroller: the chat's), and an app that grows forever stops there.
43
+ */
38
44
  declare const APP_MIN_HEIGHT = 120;
45
+ /** The least the cap is (and the cap where nothing says how tall the chat is). */
39
46
  declare const APP_MAX_HEIGHT = 800;
47
+ /** The cap is this many of the chat's visible heights. */
48
+ declare const APP_HEIGHT_SCREENS = 3;
49
+ /** ... and never more than this, whatever the screen. */
50
+ declare const APP_HEIGHT_CEILING = 6000;
51
+ /**
52
+ * The tallest an inline app's frame is drawn, for a chat body (or viewport) `viewHeight` px tall:
53
+ * `APP_HEIGHT_SCREENS` of it, rounded down to 100 px (the app is told it in
54
+ * `containerDimensions.maxHeight`, and a resize of a few pixels must not tell it again), at least
55
+ * `APP_MAX_HEIGHT`, at most `APP_HEIGHT_CEILING`.
56
+ */
57
+ declare const appHeightCap: (viewHeight: number | undefined) => number;
58
+ /**
59
+ * The cap of a frame that is already drawn, when the chat's height changes: `appHeightCap` of the
60
+ * new height, but never less than the cap the frame had (`current`) - a rotation, a keyboard
61
+ * resizing the page or a relayout for a touch screen must not give an app that was drawn whole a
62
+ * scroller of its own. The cap only grows while the frame is shown (at most
63
+ * `APP_HEIGHT_CEILING`); a new frame starts from the cap of its moment.
64
+ */
65
+ declare const nextAppHeightCap: (current: number, viewHeight: number | undefined) => number;
40
66
  /** At most this many requests of one app wait at once (tool calls, links, messages). */
41
67
  declare const MCP_APP_MAX_IN_FLIGHT = 3;
42
68
  /** A message an app puts in the chat: at most this many characters. */
@@ -45,7 +71,8 @@ declare const MCP_APP_MAX_MESSAGE_CHARS = 4000;
45
71
  declare const MCP_APP_MAX_URL_CHARS = 2048;
46
72
  /** The arguments of a tool call an app makes: at most this many characters as JSON. */
47
73
  declare const MCP_APP_MAX_ARGS_CHARS = 64000;
48
- declare const clampAppHeight: (height: number) => number;
74
+ /** An app's wish for a height, as the frame draws it: within `APP_MIN_HEIGHT` .. `max` (the cap). */
75
+ declare const clampAppHeight: (height: number, max?: number) => number;
49
76
  /**
50
77
  * The policy of an app's document: scripts and styles inline, `data:` / `blob:` media, and the
51
78
  * network ONLY where the resource declared it - `connectDomains` for `fetch` / XHR / WebSocket,
@@ -70,8 +97,10 @@ declare const MCP_APP_RELAY: string;
70
97
  * What goes into the OUTER frame's `srcdoc`: the shell (the app's policy first, one inner frame
71
98
  * that fills it, the relay) carrying the app, escaped, as the inner frame's `srcdoc` - with the
72
99
  * same policy first in it. Give the outer `<iframe>` `sandbox="allow-scripts"` and nothing else.
100
+ * `scheme` (the theme the app is told) is declared by the shell and its inner frame; give the
101
+ * outer `<iframe>` the same `color-scheme`. Only `light` / `dark` are declared.
73
102
  */
74
- declare const buildMcpAppDocument: (html: string, csp?: Partial<McpAppCsp>) => string;
103
+ declare const buildMcpAppDocument: (html: string, csp?: Partial<McpAppCsp>, scheme?: McpAppColorScheme) => string;
75
104
  /** A link an app asks to open, taken apart for the prompt: the host is what the user checks. */
76
105
  interface AppLink {
77
106
  /** The normalised URL (what is opened). */
@@ -215,6 +244,8 @@ declare class McpAppBridge {
215
244
  close(): void;
216
245
  /** Tell the app it is being torn down (not waited for: the frame goes anyway). */
217
246
  teardown(reason: string): void;
247
+ /** The display modes the app declared at `ui/initialize` (undefined: none, or not yet). */
248
+ get appDisplayModes(): readonly McpAppDisplayMode[] | undefined;
218
249
  /** How the app is shown now (`hostContext.displayMode`). */
219
250
  get displayMode(): McpAppDisplayMode;
220
251
  /** Tell an initialized app that part of the host context changed (the theme). */
@@ -400,9 +431,12 @@ declare const mcpAppSandboxShellCsp: (proxyUrl: string) => string;
400
431
  * What goes into the OUTER frame's `srcdoc` in sandbox mode: the shell - its policy first, one
401
432
  * frame of the proxy page, no script, nothing of the app. Give the outer `<iframe>`
402
433
  * `sandbox={MCP_APP_SANDBOX_FRAME_TOKENS}` and nothing else. Throws on a URL that is not a proxy
403
- * URL this package builds (`mcpAppSandboxProxyUrl`).
434
+ * URL this package builds (`mcpAppSandboxProxyUrl`). `scheme` is declared by the shell and its
435
+ * frame, and handed to the proxy page as `?scheme=` on its frame's `src` ONLY: the shell's
436
+ * `frame-src` stays the path (a source expression carries no query, and a path source ignores
437
+ * one), so the pin is the same with or without it.
404
438
  */
405
- declare const buildMcpAppSandboxShell: (proxyUrl: string) => string;
439
+ declare const buildMcpAppSandboxShell: (proxyUrl: string, scheme?: McpAppColorScheme) => string;
406
440
  /** What one message from the proxy's frame is, for the page (`McpAppSandboxLink.receive`). */
407
441
  type McpAppSandboxInput = 'drop' | 'ready' | 'broken' | 'app';
408
442
  interface McpAppSandboxLinkOptions {
@@ -461,6 +495,8 @@ interface McpAppsConnectionLike {
461
495
  readOnly: boolean;
462
496
  description?: string;
463
497
  inputSchema?: unknown;
498
+ /** The server's identity on its connection (newer cores): what a grant is kept under. */
499
+ serverId?: string;
464
500
  } | undefined;
465
501
  callAppTool: (server: string, name: string, args: Record<string, unknown>, options?: {
466
502
  signal?: AbortSignal;
@@ -554,6 +590,15 @@ interface McpAppHost {
554
590
  };
555
591
  /** Whether the app has something waiting for the user (a link, a message, a tool call). */
556
592
  isWaiting: (app: AppView) => boolean;
593
+ /**
594
+ * What this app waits for: its tool calls' consent requests (of `approvals`: its server and
595
+ * resource, while one of its calls is at the gate) and its other requests. A host draws them
596
+ * where the app is (`<McpAppFrame renderPrompts>`); answered there, they are answered.
597
+ */
598
+ pendingFor: (app: AppView) => {
599
+ approvals: ApprovalView[];
600
+ requests: AppRequestView[];
601
+ };
557
602
  /**
558
603
  * Where apps run: on an origin of their own, through the sandbox page at this URL - or, when
559
604
  * absent (the default), in an opaque frame. See `McpAppSandboxOptions`.
@@ -563,8 +608,13 @@ interface McpAppHost {
563
608
  interface UseMcpAppHostOptions {
564
609
  /** The connection(s) the apps came from; without one, frames say their server is not connected. */
565
610
  connection?: McpAppsConnectionLike;
566
- /** The agent's consent gate for an app's calls: `useAgent().approveAppToolCall`. */
567
- approve?: (call: AppToolCallRequest, signal?: AbortSignal) => Promise<void>;
611
+ /**
612
+ * The agent's consent gate for an app's calls: `useAgent().approveAppToolCall`. The call carries
613
+ * `frame` (the asking frame's `AppView.id`) and `serverId` (its connection's identity).
614
+ */
615
+ approve?: (call: AppToolCallRequest & {
616
+ frame?: string;
617
+ }, signal?: AbortSignal) => Promise<void>;
568
618
  /** The pending consent requests (`useAgent().pendingApprovals`): an app's are its "waiting". */
569
619
  approvals?: ApprovalView[];
570
620
  /**
@@ -585,6 +635,11 @@ interface UseMcpAppHostOptions {
585
635
  /** The agent's seam for it: `useAgent().sampleForApp`. */
586
636
  sample?: (request: AppSamplingRequest, approve: (view: AppSamplingView) => Promise<boolean>, signal?: AbortSignal) => Promise<AppSamplingResult>;
587
637
  }
638
+ /**
639
+ * A pending consent request of THIS frame (`ApprovalView.app.frame`, set by `useAgent`); for a
640
+ * request that names no frame (a host's own gate), one of this app's server and resource.
641
+ */
642
+ declare const isApprovalOfApp: (approval: ApprovalView, app: AppView) => boolean;
588
643
  /**
589
644
  * The host's side of MCP Apps for a chat: reads an app from its own server, puts each tool call
590
645
  * an app asks for through the agent's consent gate, and holds the link and message requests until
@@ -1127,12 +1182,14 @@ interface ApprovalView {
1127
1182
  * Set when an MCP App asks, not the model (`useAgent().approveAppToolCall`): its server, the
1128
1183
  * tool's own name there and the app's resource. `name` is then the key the consent rules
1129
1184
  * match. Such a request outlives a run (it is the user's, not the run's) and is never kept on
1130
- * a message.
1185
+ * a message. `frame` is the host's id of the frame that asked (`AppView.id`, from
1186
+ * `AppToolCall.frame`): two frames of one app each have their own requests.
1131
1187
  */
1132
1188
  app?: {
1133
1189
  server: string;
1134
1190
  tool: string;
1135
1191
  resourceUri: string;
1192
+ frame?: string;
1136
1193
  };
1137
1194
  /**
1138
1195
  * Asked in another tab, by a run of this conversation going on there (`AgentUiState.remote`):
@@ -1148,6 +1205,12 @@ interface ApprovalView {
1148
1205
  * request is decided, so a saved conversation does not keep a server's instructions.
1149
1206
  */
1150
1207
  skill?: SkillConsentView;
1208
+ /**
1209
+ * Set when an explicit `'ask'` rule asked (the core's `ToolApprovalRequest.rule`): its name or
1210
+ * pattern. The core asks such a call EVERY time - no "always allow" answers a rule -, so
1211
+ * `<ToolApprovalPrompt>` offers no "Always allow" on it by default.
1212
+ */
1213
+ rule?: string;
1151
1214
  }
1152
1215
  /** What a person is shown of an MCP server's skill (the core's `McpSkillConsentView`). */
1153
1216
  type SkillConsentView = Omit<McpSkillConsentView, 'body'> & {
@@ -1684,5 +1747,5 @@ type ElicitationOutcomeReason = 'timeout' | 'step-timeout' | 'aborted' | 'stoppe
1684
1747
  /** "4:05" - what is left of a question's time. */
1685
1748
  declare const formatCountdown: (ms: number) => string;
1686
1749
 
1687
- export { MCP_APP_MAX_FILE_NAME_CHARS as $, MCP_APP_DISPLAY_MODES as Y, MCP_APP_MAX_ARGS_CHARS as Z, MCP_APP_MAX_DOWNLOAD_BYTES as _, MCP_APP_MAX_IN_FLIGHT as a0, MCP_APP_MAX_MESSAGE_CHARS as a1, MCP_APP_MAX_URL_CHARS as a2, MCP_APP_NOTIFICATIONS as a3, MCP_APP_OPTIONAL_REQUESTS as a4, MCP_APP_PROTOCOL_VERSION as a5, MCP_APP_REFUSED as a6, MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS as a7, MCP_APP_REFUSED_DOWNLOAD_TYPES as a8, MCP_APP_RELAY as a9, appFileExtensionOf as aA, appFileNameOf as aB, appGestureOf as aC, appLinkOf as aD, appMessageTextOf as aE, appMimeTypeOf as aF, appSamplingErrorOf as aG, buildMcpAppDocument as aH, buildMcpAppSandboxShell as aI, clampAppHeight as aJ, elicitationFields as aK, elicitationFormAnswer as aL, elicitationInitialDraft as aM, elicitationLink as aN, formatCountdown as aO, grantedAppCsp as aP, mcpAppCsp as aQ, mcpAppHostCapabilities as aR, mcpAppSandboxProxyUrl as aS, mcpAppSandboxShellCsp as aT, mcpAppSandboxTarget as aU, resolveAppDownload as aV, saveAppFile as aW, useMcpAppHost as aX, MCP_APP_REQUESTS as aa, MCP_APP_SANDBOX_FRAME_TOKENS as ab, MCP_APP_SANDBOX_GRACE_MS as ac, MCP_APP_SANDBOX_SERVER as ad, MCP_APP_SANDBOX_TIMEOUT_MS as ae, McpAppBridge as af, McpAppRpcError as aj, McpAppSandboxLink as am, appDisplayModeAllowed as ax, appDownloadOf as ay, appDownloadRefusal as az, createElicitationQueue as bc, elicitationConnectOptions as bd, elicitationSettings as be, elicitationTimeoutOf as bf, APP_DEFAULT_HEIGHT as s, APP_MAX_HEIGHT as t, APP_MIN_HEIGHT as u };
1688
- export type { AgentUiState as A, BudgetView as B, ChatAttachment as C, DecisionView as D, ElicitationIssueKind as E, AppResourceReader as F, ElicitationControl as G, ElicitationDraft as H, ElicitationDraftValue as I, ElicitationField as J, ElicitationFormOutcome as K, LessonView as L, McpAppSandboxReason as M, ElicitationIssue as N, ElicitationLink as O, PendingElicitation as P, QuestionView as Q, RemoteRunView as R, SubagentView as S, ToolCallView as T, UserNoteView as U, ElicitationOption as V, WrittenFileView as W, FetchView as X, ApprovalView as a, McpCatalogEntry as a$, McpOAuthRegistration as aY, McpProtocolMode as aZ, McpElicitationOptions as a_, McpAppBridgeHandlers as ag, McpAppBridgeOptions as ah, McpAppDisplayMode as ai, McpAppRpcMessage as ak, McpAppSandboxInput as al, McpAppSandboxLinkOptions as an, McpAppSandboxTarget as ao, McpElicitationFieldSchema as ap, McpElicitationRequest as aq, McpElicitationSchema as ar, QueuedMessageView as as, ReplanState as at, SkillConsentView as au, StepEscalationView as av, UseMcpAppHostOptions as aw, ChatMessage as b, McpServerProtocol as b0, McpOAuthRegistrationKind as b1, McpOAuthCallback as b2, McpServerResult as b3, McpModule as b4, ConnectedMcp as b5, BrowserOAuthProviderOptions as b6, BrowserOAuthProvider as b7, ElicitationQueue as b8, ElicitationQueueOptions as b9, McpElicitationHandler as ba, McpServerInstructions as bb, AgentStatus as c, ElicitationOutcomeReason as d, SubagentNode as e, McpElicitationResult as f, ElicitationView as g, StepView as h, MediaView as i, AppView as j, McpAppsConnectionLike as k, McpAppSandboxOptions as l, AppRequestView as m, TranscriptView as n, CompactionView as o, ModelLoadState as p, McpAppHost as q, AppRequestAnswerOptions as r, AppDownload as v, AppDownloadView as w, AppFileSaverEnv as x, AppLink as y, AppReadyDownload as z };
1750
+ export { MCP_APP_DISPLAY_MODES as $, saveAppFile as a$, MCP_APP_MAX_ARGS_CHARS as a0, MCP_APP_MAX_DOWNLOAD_BYTES as a1, MCP_APP_MAX_FILE_NAME_CHARS as a2, MCP_APP_MAX_IN_FLIGHT as a3, MCP_APP_MAX_MESSAGE_CHARS as a4, MCP_APP_MAX_URL_CHARS as a5, MCP_APP_NOTIFICATIONS as a6, MCP_APP_OPTIONAL_REQUESTS as a7, MCP_APP_PROTOCOL_VERSION as a8, MCP_APP_REFUSED as a9, appDownloadOf as aA, appDownloadRefusal as aB, appFileExtensionOf as aC, appFileNameOf as aD, appGestureOf as aE, appHeightCap as aF, appLinkOf as aG, appMessageTextOf as aH, appMimeTypeOf as aI, appSamplingErrorOf as aJ, buildMcpAppDocument as aK, buildMcpAppSandboxShell as aL, clampAppHeight as aM, elicitationFields as aN, elicitationFormAnswer as aO, elicitationInitialDraft as aP, elicitationLink as aQ, formatCountdown as aR, grantedAppCsp as aS, isApprovalOfApp as aT, mcpAppCsp as aU, mcpAppHostCapabilities as aV, mcpAppSandboxProxyUrl as aW, mcpAppSandboxShellCsp as aX, mcpAppSandboxTarget as aY, nextAppHeightCap as aZ, resolveAppDownload as a_, MCP_APP_REFUSED_DOWNLOAD_EXTENSIONS as aa, MCP_APP_REFUSED_DOWNLOAD_TYPES as ab, MCP_APP_RELAY as ac, MCP_APP_REQUESTS as ad, MCP_APP_SANDBOX_FRAME_TOKENS as ae, MCP_APP_SANDBOX_GRACE_MS as af, MCP_APP_SANDBOX_SERVER as ag, MCP_APP_SANDBOX_TIMEOUT_MS as ah, McpAppBridge as ai, McpAppRpcError as al, McpAppSandboxLink as ao, appDisplayModeAllowed as az, useMcpAppHost as b0, createElicitationQueue as bh, elicitationConnectOptions as bi, elicitationSettings as bj, elicitationTimeoutOf as bk, APP_DEFAULT_HEIGHT as t, APP_HEIGHT_CEILING as u, APP_HEIGHT_SCREENS as v, APP_MAX_HEIGHT as w, APP_MIN_HEIGHT as x };
1751
+ export type { AgentUiState as A, BudgetView as B, ChatAttachment as C, DecisionView as D, ElicitationIssueKind as E, AppFileSaverEnv as F, AppLink as G, AppReadyDownload as H, AppResourceReader as I, ElicitationControl as J, ElicitationDraft as K, LessonView as L, McpAppSandboxReason as M, ElicitationDraftValue as N, ElicitationField as O, PendingElicitation as P, QuestionView as Q, RemoteRunView as R, SubagentView as S, ToolCallView as T, UserNoteView as U, ElicitationFormOutcome as V, WrittenFileView as W, ElicitationIssue as X, ElicitationLink as Y, ElicitationOption as Z, FetchView as _, ApprovalView as a, McpAppBridgeHandlers as aj, McpAppBridgeOptions as ak, McpAppRpcMessage as am, McpAppSandboxInput as an, McpAppSandboxLinkOptions as ap, McpAppSandboxTarget as aq, McpElicitationFieldSchema as ar, McpElicitationRequest as as, McpElicitationSchema as at, QueuedMessageView as au, ReplanState as av, SkillConsentView as aw, StepEscalationView as ax, UseMcpAppHostOptions as ay, ChatMessage as b, McpOAuthRegistration as b1, McpProtocolMode as b2, McpElicitationOptions as b3, McpCatalogEntry as b4, McpServerProtocol as b5, McpOAuthRegistrationKind as b6, McpOAuthCallback as b7, McpServerResult as b8, McpModule as b9, ConnectedMcp as ba, BrowserOAuthProviderOptions as bb, BrowserOAuthProvider as bc, ElicitationQueue as bd, ElicitationQueueOptions as be, McpElicitationHandler as bf, McpServerInstructions as bg, AgentStatus as c, ElicitationOutcomeReason as d, SubagentNode as e, McpElicitationResult as f, ElicitationView as g, StepView as h, MediaView as i, AppView as j, McpAppsConnectionLike as k, McpAppSandboxOptions as l, AppRequestView as m, TranscriptView as n, CompactionView as o, ModelLoadState as p, McpAppHost as q, McpAppDisplayMode as r, AppRequestAnswerOptions as s, AppDownload as y, AppDownloadView as z };