@dudko.dev/agent-web-react 0.0.41 → 0.0.43
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 +4 -2
- package/dist/{chunk-FXHQXIOU.js → chunk-AWZ2OZSG.js} +6 -2
- package/dist/chunk-AWZ2OZSG.js.map +1 -0
- package/dist/{elicitation-Dp6Fi6ZA.d.ts → elicitation-B5t9hdaJ.d.cts} +9 -3
- package/dist/{elicitation-Dp6Fi6ZA.d.cts → elicitation-rJu93Z3o.d.ts} +9 -3
- package/dist/index.cjs +951 -593
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +134 -9
- package/dist/index.d.ts +134 -9
- package/dist/index.js +800 -451
- package/dist/index.js.map +1 -1
- package/dist/{mcp-app-policy-DIUmGPJP.d.cts → mcp-app-policy-BhBIsbBy.d.cts} +20 -2
- package/dist/{mcp-app-policy-DIUmGPJP.d.ts → mcp-app-policy-BhBIsbBy.d.ts} +20 -2
- package/dist/mcp-app-sandbox.cjs +17 -7
- package/dist/mcp-app-sandbox.cjs.map +1 -1
- package/dist/mcp-app-sandbox.d.cts +11 -6
- package/dist/mcp-app-sandbox.d.ts +11 -6
- package/dist/mcp-app-sandbox.js +15 -7
- package/dist/mcp-app-sandbox.js.map +1 -1
- package/dist/mcp.d.cts +3 -2
- package/dist/mcp.d.ts +3 -2
- package/dist/styles.css +99 -6
- package/package.json +3 -3
- package/dist/chunk-FXHQXIOU.js.map +0 -1
package/README.md
CHANGED
|
@@ -860,11 +860,12 @@ use them standalone. The full guide: [docs/chat.md](docs/chat.md).
|
|
|
860
860
|
| `<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
861
|
| `<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
862
|
| `<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. |
|
|
863
|
+
| `<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). |
|
|
863
864
|
| `<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
865
|
| `<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). |
|
|
865
866
|
| `<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
867
|
| `<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
|
|
868
|
+
| `<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`). `<AgentChat mcpApps>` places them under the answer. See [the boundary](#an-mcp-app-is-a-security-boundary). |
|
|
868
869
|
| `<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). |
|
|
869
870
|
| `<ApprovalModeSwitch>` | Segmented consent-mode switch. |
|
|
870
871
|
| `<ChatHistoryList>` | Saved chats (from `useChatHistory`; the list follows what other tabs of the site save). |
|
|
@@ -936,7 +937,8 @@ and the guards that change are these:
|
|
|
936
937
|
|
|
937
938
|
Its cost: the app is same-origin with every other app on the same sandbox origin (one origin for
|
|
938
939
|
all servers shares storage between them) - `{server}` in the URL gives each server its own.
|
|
939
|
-
|
|
940
|
+
The app's policy lets WebAssembly compile (`'wasm-unsafe-eval'`) and never code from strings
|
|
941
|
+
(`'unsafe-eval'`). WebRTC is not governed by `connect-src` in Chromium. Every guard has a test in
|
|
940
942
|
`tests/apps.test.ts` / `tests/apps-sandbox.test.ts` and, in a real browser against a hostile app,
|
|
941
943
|
in `e2e/apps.spec.ts` / `e2e/apps-sandbox.spec.ts`. Details:
|
|
942
944
|
[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-
|
|
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":"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","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
|
|
@@ -70,8 +71,10 @@ declare const MCP_APP_RELAY: string;
|
|
|
70
71
|
* What goes into the OUTER frame's `srcdoc`: the shell (the app's policy first, one inner frame
|
|
71
72
|
* that fills it, the relay) carrying the app, escaped, as the inner frame's `srcdoc` - with the
|
|
72
73
|
* same policy first in it. Give the outer `<iframe>` `sandbox="allow-scripts"` and nothing else.
|
|
74
|
+
* `scheme` (the theme the app is told) is declared by the shell and its inner frame; give the
|
|
75
|
+
* outer `<iframe>` the same `color-scheme`. Only `light` / `dark` are declared.
|
|
73
76
|
*/
|
|
74
|
-
declare const buildMcpAppDocument: (html: string, csp?: Partial<McpAppCsp
|
|
77
|
+
declare const buildMcpAppDocument: (html: string, csp?: Partial<McpAppCsp>, scheme?: McpAppColorScheme) => string;
|
|
75
78
|
/** A link an app asks to open, taken apart for the prompt: the host is what the user checks. */
|
|
76
79
|
interface AppLink {
|
|
77
80
|
/** The normalised URL (what is opened). */
|
|
@@ -400,9 +403,12 @@ declare const mcpAppSandboxShellCsp: (proxyUrl: string) => string;
|
|
|
400
403
|
* What goes into the OUTER frame's `srcdoc` in sandbox mode: the shell - its policy first, one
|
|
401
404
|
* frame of the proxy page, no script, nothing of the app. Give the outer `<iframe>`
|
|
402
405
|
* `sandbox={MCP_APP_SANDBOX_FRAME_TOKENS}` and nothing else. Throws on a URL that is not a proxy
|
|
403
|
-
* URL this package builds (`mcpAppSandboxProxyUrl`).
|
|
406
|
+
* URL this package builds (`mcpAppSandboxProxyUrl`). `scheme` is declared by the shell and its
|
|
407
|
+
* frame, and handed to the proxy page as `?scheme=` on its frame's `src` ONLY: the shell's
|
|
408
|
+
* `frame-src` stays the path (a source expression carries no query, and a path source ignores
|
|
409
|
+
* one), so the pin is the same with or without it.
|
|
404
410
|
*/
|
|
405
|
-
declare const buildMcpAppSandboxShell: (proxyUrl: string) => string;
|
|
411
|
+
declare const buildMcpAppSandboxShell: (proxyUrl: string, scheme?: McpAppColorScheme) => string;
|
|
406
412
|
/** What one message from the proxy's frame is, for the page (`McpAppSandboxLink.receive`). */
|
|
407
413
|
type McpAppSandboxInput = 'drop' | 'ready' | 'broken' | 'app';
|
|
408
414
|
interface McpAppSandboxLinkOptions {
|
|
@@ -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
|
|
@@ -70,8 +71,10 @@ declare const MCP_APP_RELAY: string;
|
|
|
70
71
|
* What goes into the OUTER frame's `srcdoc`: the shell (the app's policy first, one inner frame
|
|
71
72
|
* that fills it, the relay) carrying the app, escaped, as the inner frame's `srcdoc` - with the
|
|
72
73
|
* same policy first in it. Give the outer `<iframe>` `sandbox="allow-scripts"` and nothing else.
|
|
74
|
+
* `scheme` (the theme the app is told) is declared by the shell and its inner frame; give the
|
|
75
|
+
* outer `<iframe>` the same `color-scheme`. Only `light` / `dark` are declared.
|
|
73
76
|
*/
|
|
74
|
-
declare const buildMcpAppDocument: (html: string, csp?: Partial<McpAppCsp
|
|
77
|
+
declare const buildMcpAppDocument: (html: string, csp?: Partial<McpAppCsp>, scheme?: McpAppColorScheme) => string;
|
|
75
78
|
/** A link an app asks to open, taken apart for the prompt: the host is what the user checks. */
|
|
76
79
|
interface AppLink {
|
|
77
80
|
/** The normalised URL (what is opened). */
|
|
@@ -400,9 +403,12 @@ declare const mcpAppSandboxShellCsp: (proxyUrl: string) => string;
|
|
|
400
403
|
* What goes into the OUTER frame's `srcdoc` in sandbox mode: the shell - its policy first, one
|
|
401
404
|
* frame of the proxy page, no script, nothing of the app. Give the outer `<iframe>`
|
|
402
405
|
* `sandbox={MCP_APP_SANDBOX_FRAME_TOKENS}` and nothing else. Throws on a URL that is not a proxy
|
|
403
|
-
* URL this package builds (`mcpAppSandboxProxyUrl`).
|
|
406
|
+
* URL this package builds (`mcpAppSandboxProxyUrl`). `scheme` is declared by the shell and its
|
|
407
|
+
* frame, and handed to the proxy page as `?scheme=` on its frame's `src` ONLY: the shell's
|
|
408
|
+
* `frame-src` stays the path (a source expression carries no query, and a path source ignores
|
|
409
|
+
* one), so the pin is the same with or without it.
|
|
404
410
|
*/
|
|
405
|
-
declare const buildMcpAppSandboxShell: (proxyUrl: string) => string;
|
|
411
|
+
declare const buildMcpAppSandboxShell: (proxyUrl: string, scheme?: McpAppColorScheme) => string;
|
|
406
412
|
/** What one message from the proxy's frame is, for the page (`McpAppSandboxLink.receive`). */
|
|
407
413
|
type McpAppSandboxInput = 'drop' | 'ready' | 'broken' | 'app';
|
|
408
414
|
interface McpAppSandboxLinkOptions {
|