Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
feat(apps): show_html can show a page without the card frame (#4314)
Aditya Umale9e35731d9d15
diff --git a/server/chat-apps.test.ts b/server/chat-apps.test.tsindex e8f2f757f5..cb192945fb 100644--- a/server/chat-apps.test.ts+++ b/server/chat-apps.test.ts@@ -118,6 +118,21 @@ describe("show_html", () => {});});+describe("a frameless page", () => {+ it("is drawn without the card frame only when the bot asks, and keeps that look through updates unless changed", () => {+ const { call, row } = setup();+ call({ tool: "show_html", html: PAGE, title: "Framed" });+ expect(row("m1").app).toMatchObject({ border: true });+ call({ tool: "show_html", html: PAGE, title: "Inline", frameless: true });+ expect(row("m2").app).toMatchObject({ border: false });+ call({ tool: "update_html", app_id: "m2", html: "<p>New numbers</p>" });+ expect(row("m2").app).toMatchObject({ border: false, rev: 1 });+ call({ tool: "update_html", app_id: "m2", html: "<p>New numbers</p>", frameless: false });+ expect(row("m2").app).toMatchObject({ border: true, rev: 1 });+ expect(call({ tool: "show_html", html: PAGE, title: "Bad", frameless: "yes" })).toMatchObject({ ok: false, status: 400, error: expect.stringMatching(/^frameless:/) });+ });+});+describe("update_html", () => {it("replaces the page in place: a new document, the next revision, the title kept unless given, context dropped", () => {const { call, row, store } = setup();diff --git a/server/chat-apps.ts b/server/chat-apps.tsindex b685a725d4..f6b5756882 100644--- a/server/chat-apps.ts+++ b/server/chat-apps.ts@@ -125,7 +125,7 @@ export function createAppCard(args: {function placePage(args: { store: AgentCardStore; docs: AppDocs; bot: { id: string }; threadId: string; authored?(messageId: string): void },- value: { appId?: string; height?: number; fallbackText?: string },+ value: { appId?: string; height?: number; fallbackText?: string; frameless?: boolean },made: MadePage,): AgentCardResult {const { store, docs, bot, threadId } = args;@@ -137,7 +137,7 @@ function placePage(doc: stored.ok ? stored.doc : "", rev: 0, bytes: pageBytes(page),...(page.format ? { format: page.format } : {}),...(value.height !== undefined ? { height: value.height } : {}),- border: true,+ border: value.frameless !== true,network: { connect: [...BOT_HTML_NETWORK.connect], resources: [...BOT_HTML_NETWORK.resources] },...(stored.ok ? {} : { blocked: "too-large" as const }),};@@ -149,17 +149,22 @@ function placePage(const existing = appRow(store, threadId, value.appId);if (!existing || (existing.from && existing.from.botId !== bot.id)) return { ok: false, status: 404, error: NO_SUCH_PAGE };if (existing.app.source !== "html") return { ok: false, status: 409, error: NOT_A_PAGE };- const patched = replacePage(store, docs, threadId, existing, made);+ const patched = replacePage(store, docs, threadId, existing, made, value.frameless);if (!patched) return { ok: false, status: 404, error: NO_SUCH_PAGE };args.authored?.(patched.id);return { ok: true, messageId: patched.id, ...(made.masked ? { masked: true as const } : {}) };}/** The next version of a row's page; the row is unchanged when the page is the same document. */-function replacePage(store: Pick<AgentCardStore, "patchMessage">, docs: AppDocs, threadId: string, existing: Message & { app: AppPayload }, made: MadePage): Message | null {+function replacePage(+ store: Pick<AgentCardStore, "patchMessage">, docs: AppDocs, threadId: string, existing: Message & { app: AppPayload }, made: MadePage, frameless?: boolean,+): Message | null {const { page } = made;const stored = storePage(docs, page);- if (stored.ok && stored.doc === existing.app.doc && made.title === existing.app.title) return existing;+ const border = frameless === undefined ? existing.app.border : !frameless;+ if (stored.ok && stored.doc === existing.app.doc && made.title === existing.app.title) {+ return border === existing.app.border ? existing : store.patchMessage(threadId, existing.id, { app: { ...existing.app, border } });+ }// The page reloads: what the old one told the model about itself no longer holds.const { context: _context, blocked: _blocked, format: _format, history: earlier, ...kept } = existing.app;const history = [...(earlier ?? []), ...(existing.app.doc ? [existing.app.doc] : [])].slice(-(APP_PAGE_VERSIONS - 1));@@ -169,6 +174,7 @@ function replacePage(store: Pick<AgentCardStore, "patchMessage">, docs: AppDocs,doc: stored.ok ? stored.doc : "",rev: (existing.app.rev ?? 0) + 1,bytes: pageBytes(page),+ border,...(history.length ? { history } : {}),...(page.format ? { format: page.format } : {}),...(stored.ok ? {} : { blocked: "too-large" as const }),diff --git a/server/drivers/agents-app-tools.ts b/server/drivers/agents-app-tools.tsindex 95d883b2b2..e5a99462ef 100644--- a/server/drivers/agents-app-tools.ts+++ b/server/drivers/agents-app-tools.ts@@ -13,6 +13,7 @@ export const APP_TOOL_DEFINITIONS = [title: { type: "string", description: "A one-line title, at most 80 characters; a new page needs one." },height: { type: "number", description: "Optional starting height in pixels, 80 to 720." },fallback_text: { type: "string", description: "Optional plain-text version for clients that cannot show pages. Written for you when omitted." },+ frameless: { type: "boolean", description: "Optional: true shows the page without the card frame around it. Default false for a new page; a replacement with app_id keeps the page's frame unless this is given." },app_id: { type: "string", description: "Only to replace a page you showed: the id it returned." },},},diff --git a/server/drivers/agents-call-cards.test.ts b/server/drivers/agents-call-cards.test.tsindex c947ac5d11..5900a1b0e3 100644--- a/server/drivers/agents-call-cards.test.ts+++ b/server/drivers/agents-call-cards.test.ts@@ -174,6 +174,16 @@ describe("the chat-app tools", () => {expect(result).toEqual({ text: "Shown as app m9. To change it, call show_html again with app_id \"m9\"." });});+ it("passes frameless on to the page, for a new page and an update", async () => {+ const { apiResponse, context } = harness({ ok: true, status: 201, body: { messageId: "m9" } });+ await callTool("show_html", { html: "<p>hi</p>", title: "Hi", frameless: true }, context);+ expect(apiResponse).toHaveBeenLastCalledWith("/api/internal/options-card", {+ method: "POST", body: JSON.stringify({ tool: "show_html", html: "<p>hi</p>", title: "Hi", frameless: true }),+ });+ await callTool("show_html", { app_id: "m9", html: "<p>hi</p>", frameless: false }, context);+ expect(JSON.parse(apiResponse.mock.lastCall![1]!.body as string)).toMatchObject({ app_id: "m9", frameless: false });+ });+it("says when something in the page was masked as a secret", async () => {const { context } = harness({ ok: true, status: 201, body: { messageId: "m9", masked: true } });expect((await callTool("show_html", { html: "<p>hi</p>", title: "Hi" }, context)).text).toContain("masked before it was stored");diff --git a/server/drivers/agents-call-cards.ts b/server/drivers/agents-call-cards.tsindex 1d399d1a78..39849c7eb4 100644--- a/server/drivers/agents-call-cards.ts+++ b/server/drivers/agents-call-cards.ts@@ -19,12 +19,14 @@ async function callAppTool(name: "show_html" | "update_html", args: Json, contexconst parsed = updating ? parseUpdateHtmlInput(args) : parseShowHtmlInput(args);if (!parsed.ok) return { text: parsed.error, isError: true };const page = parsed.value.jsx !== undefined ? { jsx: args.jsx } : parsed.value.path !== undefined ? { path: args.path } : { html: args.html };+ const frameless = parsed.value.frameless !== undefined ? { frameless: parsed.value.frameless } : {};const body = updating- ? { tool: name, app_id: args.app_id, ...page, ...(typeof args.title === "string" ? { title: args.title } : {}) }+ ? { tool: name, app_id: args.app_id, ...page, ...(typeof args.title === "string" ? { title: args.title } : {}), ...frameless }: {tool: name, ...page, title: args.title,...(typeof args.height === "number" ? { height: args.height } : {}),...(typeof args.fallback_text === "string" ? { fallback_text: args.fallback_text } : {}),+ ...frameless,};const answer = await context.client.apiResponse(CARD_ROUTE, { method: "POST", body: JSON.stringify(body) });if (!answer.ok) return { text: String(answer.body.error ?? (updating ? "Could not update that page." : "Could not show that page.")), isError: true };diff --git a/server/drivers/agents-catalog-goldens/full.tools-list.json b/server/drivers/agents-catalog-goldens/full.tools-list.jsonindex a143518e6c..7108d3c4dc 100644--- a/server/drivers/agents-catalog-goldens/full.tools-list.json+++ b/server/drivers/agents-catalog-goldens/full.tools-list.json@@ -477,6 +477,10 @@"type": "string","description": "Optional plain-text version for clients that cannot show pages. Written for you when omitted."},+ "frameless": {+ "type": "boolean",+ "description": "Optional: true shows the page without the card frame around it. Default false for a new page; a replacement with app_id keeps the page's frame unless this is given."+ },"app_id": {"type": "string","description": "Only to replace a page you showed: the id it returned."diff --git a/server/drivers/agents-catalog-goldens/profiles.json b/server/drivers/agents-catalog-goldens/profiles.jsonindex e2a255c1db..e675d1b85f 100644--- a/server/drivers/agents-catalog-goldens/profiles.json+++ b/server/drivers/agents-catalog-goldens/profiles.json@@ -1,7 +1,7 @@{"default": {- "bytes": 58409,- "sha256": "9562c453e4685c5ca69ede2fcb7138b2b455aa9a2fdbfa4478f06f5a718a0385",+ "bytes": 58621,+ "sha256": "b279aa06c646ada0fc66c23f743de64b07c8f96ac70509b823014476863694ba","tools": ["tool_result_read","list_room_targets",@@ -50,8 +50,8 @@]},"voice": {- "bytes": 59190,- "sha256": "eac49a92507f595d879017cfd47f08361be5f1a5078bd840c08eff1059b74e39",+ "bytes": 59402,+ "sha256": "c6db244ddad00a7d60a90ccd3909145b5cae287d71e7c9fbe274d8a991476d5d","tools": ["tool_result_read","list_room_targets",@@ -101,8 +101,8 @@]},"shared": {- "bytes": 60674,- "sha256": "ea942863af945881f8bd250611e8c5d3e575855af399d884381bec9fb1c063cd",+ "bytes": 60886,+ "sha256": "9a071b1f63eb673918e263c254009575390a9f7315435ce6d0853a68d46d080c","tools": ["tool_result_read","list_shared_computers",@@ -153,8 +153,8 @@]},"shared+voice": {- "bytes": 61455,- "sha256": "ba67957c0cd7f41b2d811efb95e9f301c9a2cd7429cd5649459b2f5ee6f13c59",+ "bytes": 61667,+ "sha256": "7ff554c9fc07f76cffc491c20070183f2b49b6368e5371cd6b54b62655f8ed45","tools": ["tool_result_read","list_shared_computers",@@ -206,8 +206,8 @@]},"skills": {- "bytes": 61228,- "sha256": "44fb483dd17dc7a3207326a08b15a36830277f01e7dec6c5ac99b82c0ad55437",+ "bytes": 61440,+ "sha256": "7df02eaea1be351da79576114922079c85d7ec1440a15ff0c11421660823579f","tools": ["tool_result_read","list_room_targets",@@ -258,8 +258,8 @@]},"skills+voice": {- "bytes": 62009,- "sha256": "562d2e51f73b659a492f121fcc3823a9e017fefb451841d8678b17fdf7c9ce77",+ "bytes": 62221,+ "sha256": "841143392c57424cb8dbf56772577776768b5124e09c44c68cbfbc2ba08fd920","tools": ["tool_result_read","list_room_targets",@@ -311,8 +311,8 @@]},"skills+shared": {- "bytes": 63493,- "sha256": "050200414b4d840c2dc81783ec45240ef3630a47b9fc77cd64109351614f912d",+ "bytes": 63705,+ "sha256": "2acff5f29463e21f80a82b5a73faf60a8984898227bd7d0ae0433e0a48dc2abd","tools": ["tool_result_read","list_shared_computers",@@ -365,8 +365,8 @@]},"skills+shared+voice": {- "bytes": 64274,- "sha256": "2b1428a64a26703de1ae9b6a1bc8ef3d872aca317f68efccff320ce8068befd9",+ "bytes": 64486,+ "sha256": "b851e02dda62dbc0369536da72c5375ca8aba4d83ad4bc303454b6d3120f3e51","tools": ["tool_result_read","list_shared_computers",@@ -420,8 +420,8 @@]},"non-chief": {- "bytes": 49193,- "sha256": "66a8e259488f939a8e1bf50851839baca4a71d4c51a702f0acbc280cd86c843b",+ "bytes": 49405,+ "sha256": "41ed5692486446176ae6048b18098f3d21fe42d4eebc77d464595a59057ec5e7","tools": ["tool_result_read","list_room_targets",@@ -463,8 +463,8 @@]},"voice+non-chief": {- "bytes": 49974,- "sha256": "10e2b956f6ba71c20b5f2c9728dc6b4259675b88c0ed5b28dc7ea652555f5e7a",+ "bytes": 50186,+ "sha256": "e3fbc34cc167ca06c78091dfc2f84662bab61b2d75ad709fdbde77908db96651","tools": ["tool_result_read","list_room_targets",@@ -507,8 +507,8 @@]},"shared+non-chief": {- "bytes": 51458,- "sha256": "b0d9a111b4b1547d2c127dc78cbbbd5fad3e0e6c815bf8ee772184f708e50872",+ "bytes": 51670,+ "sha256": "44fa4f12a4f3e57b8a6d128a3d00fba8e9466900917739f0ffa9ef5f72d1e577","tools": ["tool_result_read","list_shared_computers",@@ -552,8 +552,8 @@]},"shared+voice+non-chief": {- "bytes": 52239,- "sha256": "3aa8ab7533a5a267dcbb5fcf1e3d4662e11d250ec0fc68243b91cf85c880dcca",+ "bytes": 52451,+ "sha256": "6be0b40e3d37fec75cf3b30c909f95647bc96dca04cfa2bcbef86ba05d09812d","tools": ["tool_result_read","list_shared_computers",@@ -598,8 +598,8 @@]},"skills+non-chief": {- "bytes": 52012,- "sha256": "9269423c527a98b93691303eea784d19cad19ae4e0ffc7661558b6b6d96a5806",+ "bytes": 52224,+ "sha256": "5f96581a7d30ceed3acf9eafff9af545d1227cd1bfc7c2090786e8c81d0f2b7a","tools": ["tool_result_read","list_room_targets",@@ -643,8 +643,8 @@]},"skills+voice+non-chief": {- "bytes": 52793,- "sha256": "92e9e45a2158106a21076c90e196119b6135c63b2f57b0bd7c1833a5df89cfb0",+ "bytes": 53005,+ "sha256": "c4e12a8bb0cdbdcc69fc6c5372b14ecd076320193be91935b04836aa7902449e","tools": ["tool_result_read","list_room_targets",@@ -689,8 +689,8 @@]},"skills+shared+non-chief": {- "bytes": 54277,- "sha256": "eeb50a822802a148819872bd9f3269d811bd8e3c3e2df0769332a51be502cce2",+ "bytes": 54489,+ "sha256": "00002c0b2658e97091f835c82d14f87db273179e289a60c689b063907d171912","tools": ["tool_result_read","list_shared_computers",@@ -736,8 +736,8 @@]},"skills+shared+voice+non-chief": {- "bytes": 55058,- "sha256": "7298d8234cafa2ac30a85b20af5cacca4a0a550fc84af037e6d5f730c988f1ed",+ "bytes": 55270,+ "sha256": "6a64d1aae34d1f756cb0a71b5afa5a9e726083bd8a53e341398b1694324f9429","tools": ["tool_result_read","list_shared_computers",@@ -784,8 +784,8 @@]},"skills+shared+voice+cloud-home": {- "bytes": 64040,- "sha256": "58dbe3d5123035455534cb47be9de9c8f200a56a69a35734c64600a53599c9f3",+ "bytes": 64252,+ "sha256": "8108e48100409323640013bcd340208a0e6b526c95758a9f15d2c27aba7949cd","tools": ["tool_result_read","list_shared_computers",@@ -839,8 +839,8 @@]},"skills+shared+voice+non-chief+cloud-home": {- "bytes": 54824,- "sha256": "297cbcbd0d26fc91384fa50919621e94d21773e6c16e92abe30335e65b2db2af",+ "bytes": 55036,+ "sha256": "0eb8789580a40b38b74928671b1ca36ec22fe3ce96f2e787a443807c34007c34","tools": ["tool_result_read","list_shared_computers",@@ -887,8 +887,8 @@]},"skills+shared+voice+escalations": {- "bytes": 65104,- "sha256": "cf4ff32466e78a0d325ed21d69e6b718df04e52aa476d4df42bb706f8d74852b",+ "bytes": 65316,+ "sha256": "cc4f6d10936c02cb28310e1870be3de7f2c56196a6fe23eb42c81361218cd8f2","tools": ["tool_result_read","list_shared_computers",@@ -943,8 +943,8 @@]},"skills+shared+voice+escalations+x": {- "bytes": 68943,- "sha256": "802eec8e0474ebeb267b97647389cf9b9faa3be22f837a16a0730a9737dc3dc5",+ "bytes": 69155,+ "sha256": "5e2fda297b2ce62ee238cde94612a5021dcbdf33d0f5cb6946fa965aa00e9d58","tools": ["tool_result_read","list_shared_computers",@@ -1003,8 +1003,8 @@]},"skills+shared+voice+escalations+x+team": {- "bytes": 69575,- "sha256": "c62f12910c8534088d25b903ba6f70de139b39d90f722ecb3c1c0221f8974a99",+ "bytes": 69787,+ "sha256": "d88b85a85a38d86b121f0f6b26653fe43630b4a64122fd69e609efae636d7326","tools": ["tool_result_read","list_shared_computers",@@ -1064,8 +1064,8 @@]},"default+legacy-switches": {- "bytes": 58409,- "sha256": "9562c453e4685c5ca69ede2fcb7138b2b455aa9a2fdbfa4478f06f5a718a0385",+ "bytes": 58621,+ "sha256": "b279aa06c646ada0fc66c23f743de64b07c8f96ac70509b823014476863694ba","tools": ["tool_result_read","list_room_targets",@@ -1114,8 +1114,8 @@]},"default+mausbot": {- "bytes": 59060,- "sha256": "87d17f733fe82f6bfef7e0f1984111b8577756adad03ab176858e7dca428a5ec",+ "bytes": 59272,+ "sha256": "ef0471cff21fe974013fb01b11caf353fe34cd5d24adc4dbe0ee101403bb4033","tools": ["tool_result_read","list_room_targets",@@ -1166,8 +1166,8 @@]},"skills+shared+voice+mausbot": {- "bytes": 64925,- "sha256": "9be4d6822fd7e63ccb8f8e6392aa7e303c1a16e3b911be2ea5b4edd9bd446358",+ "bytes": 65137,+ "sha256": "c2447a27197dde714f9d7b30d729a93ab53ac7cacb75788a478cfeb64d262fdd","tools": ["tool_result_read","list_shared_computers",@@ -1223,8 +1223,8 @@]},"default+no-computer-pick": {- "bytes": 57197,- "sha256": "ce30f32b2926cbe267fd259c2ed6e51365d6ffa95b08d98623e215378dfe7167",+ "bytes": 57409,+ "sha256": "b3cdd284624eb996dc5c4fe1aef0c387bafe3b0afba81e1cc4ebedf53297c7de","tools": ["tool_result_read","list_room_targets",diff --git a/shared/app-frame/app-host.html b/shared/app-frame/app-host.htmlindex 90a921a615..12bc28297d 100644--- a/shared/app-frame/app-host.html+++ b/shared/app-frame/app-host.html@@ -1,10 +1,10 @@-<!-- mausbot app-host v1 sha256:de2bbb14a9ef9ae47b48462524529fde45e6e51c817ab274e87340f972c6ab0b -->+<!-- mausbot app-host v1 sha256:c8ebd3f8f5e4d1a49fe0f5cc6c1fb3515f8878110c9eca10ca2c48a079857b23 --><!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"><meta name="color-scheme" content="light dark"><title>App</title><style>html,body{margin:0;padding:0;background:transparent;overflow:hidden}iframe{display:block;width:100%;border:0;background:transparent}</style></head><body>-<script id="mausbot-app-host">(()=>{var E="2026-01-26";var j={htmlBytes:262144,title:80,fallback:1500,fallbackExcerpt:600,heightMin:80,heightMax:720,messageText:4e3,contextText:4e3,mcpHtmlBytes:2097152,rpcArgumentsBytes:65536,rpcResourceBytes:8388608,messagesPerHour:20,rpcPerMinute:60};function B(e){let r=0;for(let s=0;s<e.length;s+=1){let c=e.charCodeAt(s);if(c<128)r+=1;else if(c<2048)r+=2;else if(c>=55296&&c<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);a>=56320&&a<=57343?(r+=4,s+=1):r+=3}else r+=3}return r}var G=["tools/call","tools/list","resources/read","resources/list"],O=-32601,T=-32602,y=-32e3,d={messageBytes:1e6,minHeight:48,defaultHeight:160,maxHeight:720,linkChars:2048,teardownMs:1e3,engagedTouchMs:1e4,contextCoalesceMs:1e3,logsPerMinute:50,rates:{message:[[3e3,1],[6e5,10]],openLink:[[2e3,1]],rpc:[[1e4,10],[6e5,120]]}};function K(e){let r=J(e);return{...e.can.openLinks?{openLinks:{}}:{},logging:{},...e.can.modelContext?{updateModelContext:{text:{},structuredContent:{}}}:{},...e.can.message?{message:{text:{}}}:{},...r&&e.can.serverTools?{serverTools:{}}:{},...r&&e.can.serverResources?{serverResources:{}}:{},sandbox:{permissions:{},csp:{connectDomains:[...e.network.connect],resourceDomains:[...e.network.resources]}}}}function J(e){return!!e.tool}function H(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function $(e){return typeof e=="string"&&e.length<=200||typeof e=="number"&&Number.isFinite(e)}function X(e){let r;try{r=JSON.stringify(e)}catch{return null}return r===void 0?null:r.length*3<=d.messageBytes?r.length:B(r)}function Z(e){if(!H(e)||e.jsonrpc!=="2.0")return null;let r=X(e);return r===null||r>d.messageBytes||e.params!==void 0&&!H(e.params)?null:typeof e.method=="string"?!e.method||e.method.length>200||"id"in e&&!$(e.id)?null:e:e.method!==void 0||!$(e.id)?null:"result"in e||H(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"?e:null}function I(e,r){let s=[],c=Math.max(...e.map(([a])=>a));return{take(){let a=r();for(;s.length&&a-s[0]>=c;)s.shift();for(let[g,u]of e)if(s.filter(A=>a-A<g).length>=u)return!1;return s.push(a),!0}}}function S(e){return H(e)&&typeof e.code=="number"&&Number.isInteger(e.code)?{code:e.code,message:typeof e.message=="string"&&e.message?e.message:"The host refused this."}:{code:y,message:e instanceof Error&&e.message?e.message:"The host could not do that."}}function Q(e){if(typeof e!="string"||!e||e.length>d.linkChars)return null;let r;try{r=new URL(e)}catch{return null}return r.protocol!=="http:"&&r.protocol!=="https:"||r.username||r.password?null:r.href.length<=d.linkChars?r.href:null}function ee(e){if(!e||e.role!=="user"||!Array.isArray(e.content)||e.content.length===0)return null;let r=[];for(let c of e.content){if(!H(c)||c.type!=="text"||typeof c.text!="string")return null;r.push(c.text)}let s=r.join(`-`).trim();return s&&s.length<=j.messageText?s:null}function D(e){let{doc:r,adapter:s}=e,c=J(r),a=e.timers??{set:(t,l)=>setTimeout(t,l),clear:t=>clearTimeout(t)},g=()=>s.now(),u={...e.hostContext,...c&&r.tool?{toolInfo:{tool:r.tool}}:{}},A=null,C=!1,h=!1,x=!1,M=!1,_=0,R=new Map,b={message:I(d.rates.message,g),openLink:I(d.rates.openLink,g),rpc:I(d.rates.rpc,g),log:I([[6e4,d.logsPerMinute]],g)},k=null,n=null,p=-1/0,f=t=>{if(!x)try{s.post(t)}catch{}},w=(t,l)=>f({jsonrpc:"2.0",id:t,result:l}),i=(t,l,o)=>f({jsonrpc:"2.0",id:t,error:{code:l,message:o}}),P=()=>{let t=e.limits?.maxHeight,l=u.containerDimensions?.maxHeight,o=typeof t=="number"&&t>0?t:typeof l=="number"&&l>0?l:d.maxHeight;return Math.max(d.minHeight,o)},L=()=>{if(n=null,x||!k)return;let t=k;k=null,p=g(),Promise.resolve().then(()=>s.setContext(t)).catch(()=>{})},U=async()=>{if(n===null||!k)return;a.clear(n),n=null;let t=k;k=null,p=g();try{await s.setContext(t)}catch{}},q=()=>{if(c&&!M&&(M=!0,f({jsonrpc:"2.0",method:"ui/notifications/tool-input",params:{arguments:r.toolInput??{}}}),f({jsonrpc:"2.0",method:"ui/notifications/tool-result",params:r.toolResult??{content:[]}})),A){let t=A;A=null,f({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:t})}},V=async(t,l,o)=>{if(!c)return i(t,O,"Method not found");if(!(l.startsWith("tools/")?r.can.serverTools:r.can.serverResources))return i(t,y,r.blocked?.text??"This app cannot reach its server right now.");if(l==="tools/call"&&(typeof o.name!="string"||!o.name||o.arguments!==void 0&&!H(o.arguments)))return i(t,T,"tools/call needs {name, arguments?}.");if(l==="resources/read"&&typeof o.uri!="string")return i(t,T,"resources/read needs {uri}.");if(!b.rpc.take())return i(t,y,"Too many calls from this app. Wait a moment.");try{let v=await s.callRpc(l,o);w(t,v??{})}catch(v){let N=S(v);i(t,N.code,N.message)}},W=async(t,l,o)=>{if(l==="ui/initialize")return C=!0,w(t,{protocolVersion:E,hostInfo:{name:"mausbot",version:e.hostVersion},hostCapabilities:K(r),hostContext:u});if(h)switch(l){case"ping":return w(t,{});case"ui/request-display-mode":return w(t,{mode:"inline"});case"ui/open-link":{if(!r.can.openLinks)return i(t,y,"This app cannot open links here.");if(!s.engaged())return i(t,y,"Links open only after the person clicks in the app.");let m=Q(o?.url);if(!m)return i(t,T,"Only http and https links of at most 2,048 characters, without a user name or password, can be opened.");if(!b.openLink.take())return i(t,y,"Too many links from this app. Wait a moment.");try{return await s.openLink(m),w(t,{})}catch(v){return i(t,y,S(v).message)}}case"ui/message":{if(!r.can.message)return i(t,y,"This app cannot send messages here.");if(!s.engaged())return i(t,y,"Messages are sent only after the person clicks in the app.");let m=ee(o);if(m===null)return i(t,T,`Only text messages of 1 to ${j.messageText} characters can be sent.`);if(!b.message.take())return i(t,y,"Too many messages from this app. Wait a moment.");try{return await U(),await s.sendMessage(m),w(t,{})}catch(v){return i(t,y,S(v).message)}}case"ui/update-model-context":{if(!r.can.modelContext)return i(t,y,"This app cannot update the model's context here.");if(o?.content!==void 0&&!Array.isArray(o.content)||o?.structuredContent!==void 0&&!H(o.structuredContent))return i(t,T,"ui/update-model-context takes {content?, structuredContent?}.");if(k={...Array.isArray(o?.content)?{content:o.content}:{},...H(o?.structuredContent)?{structuredContent:o.structuredContent}:{}},n===null){let m=p+d.contextCoalesceMs-g();m<=0?L():n=a.set(L,m)}return w(t,{})}default:return G.includes(l)?V(t,l,o??{}):i(t,O,"Method not found")}},Y=(t,l)=>{if(t==="ui/notifications/initialized"){if(!C||h)return;h=!0,q();return}if(h)switch(t){case"ui/notifications/size-changed":{let o=l?.height;if(typeof o!="number"||!Number.isFinite(o))return;s.resize(Math.round(Math.min(P(),Math.max(d.minHeight,o))));return}case"notifications/message":e.log&&b.log.take()&&e.log(l);return;case"ui/notifications/request-teardown":s.teardownRequested();return;default:}};return{get initialized(){return h},handleMessage(t){if(x)return;let l=e.source();if(l==null||t.source!==l)return;let o=Z(t.data);if(!o)return;if("method"in o){"id"in o?W(o.id,o.method,o.params):Y(o.method,o.params);return}let m=R.get(o.id);m&&(R.delete(o.id),m(o))},contextChanged(t){x||(u={...u,...t},h?f({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:t}):C&&(A={...A,...t}))},teardown(){return x||!h?Promise.resolve():new Promise(t=>{let l=`host:${++_}`,o=!1,m=()=>{o||(o=!0,R.delete(l),a.clear(v),t())},v=a.set(m,d.teardownMs);R.set(l,m),f({jsonrpc:"2.0",id:l,method:"ui/resource-teardown",params:{}})})},dispose(){x=!0,n!==null&&a.clear(n),n=null;for(let t of R.values())t({jsonrpc:"2.0",id:"",result:{}});R.clear()}}}var F=1;function te(e){let s=e.webkit?.messageHandlers?.appHost;if(s&&typeof s.postMessage=="function")return{send:a=>s.postMessage(a)};let c=e.appHost;return c&&typeof c.postMessage=="function"?{send:a=>c.postMessage(JSON.stringify(a)),listen:a=>{c.onmessage=g=>{if(typeof g.data!="string")return;let u;try{u=JSON.parse(g.data)}catch{return}u&&typeof u=="object"&&u.v===F&&a(u)}}}:null}function ne(e,r){let s=r??te(e);if(!s)return null;let c=e.document,a=null,g=null,u=0,A=!1,C=0,h=new Map,x=n=>{try{s.send(n)}catch{}},M=(n,p)=>new Promise((f,w)=>{let i=`c${++C}`;h.set(i,{resolve:f,reject:w}),x({v:1,type:"call",callId:i,op:n,params:p})}),_=()=>{for(let n of h.values())n.reject({code:-32e3,message:"This app was closed."});h.clear()};e.addEventListener("message",n=>{a&&(a.handleMessage({source:n.source,data:n.data}),!A&&a.initialized&&(A=!0,x({v:1,type:"initialized"})))});let R=()=>{a?.dispose(),a=null,g?.remove(),g=null,A=!1,_()},b={load(n){if(!n||n.v!==F||!n.doc||typeof n.doc.srcdoc!="string")return;R(),typeof n.engagedAt=="number"&&(u=n.engagedAt);let p=c.createElement("iframe");p.setAttribute("sandbox","allow-scripts allow-forms"),p.setAttribute("referrerpolicy","no-referrer"),p.setAttribute("title","App");let f=Math.max(d.minHeight,Math.round(n.limits?.height??d.defaultHeight));p.style.height=`${f}px`,a=D({doc:n.doc,hostContext:n.hostContext??{},hostVersion:n.hostVersion??"phone",...n.limits?.maxHeight?{limits:{maxHeight:n.limits.maxHeight}}:{},source:()=>p.contentWindow,adapter:{post:i=>p.contentWindow?.postMessage(i,"*"),callRpc:(i,P)=>M("rpc",{method:i,params:P}),sendMessage:async i=>{await M("message",{text:i})},openLink:async i=>{await M("open-link",{url:i})},setContext:async i=>{await M("context",{...i})},resize:i=>{p.style.height=`${i}px`,x({v:1,type:"size",height:i})},engaged:()=>Date.now()-u<=d.engagedTouchMs,teardownRequested:()=>x({v:1,type:"teardown-request"}),now:()=>Date.now()}}),g=p,p.srcdoc=n.doc.srcdoc,c.body.appendChild(p)},contextChanged(n){a?.contextChanged(n??{})},engaged(n){typeof n=="number"&&Number.isFinite(n)&&(u=Math.max(u,n))},async teardown(){a&&await a.teardown(),R(),x({v:1,type:"torn-down"})},reply(n,p){let f=h.get(n);f&&(h.delete(n),p&&"error"in p&&p.error?f.reject(p.error):f.resolve(p&&"result"in p?p.result:void 0))}};s.listen?.(n=>{switch(n.call){case"load":return b.load(n.args[0]);case"contextChanged":return b.contextChanged(n.args[0]);case"engaged":return b.engaged(n.args[0]);case"teardown":return void b.teardown();case"reply":return b.reply(n.args[0],n.args[1])}});let k=e;return k.appHost&&typeof k.appHost.postMessage=="function"||(k.appHost=b),k.mausbotAppHost=b,x({v:1,type:"ready"}),b}function z(){typeof window<"u"&&ne(window)}z();})();</script>+<script id="mausbot-app-host">(()=>{var E="2026-01-26";var j={htmlBytes:262144,title:80,fallback:1500,fallbackExcerpt:600,heightMin:80,heightMax:720,messageText:4e3,contextText:4e3,mcpHtmlBytes:2097152,rpcArgumentsBytes:65536,rpcResourceBytes:8388608,messagesPerHour:20,rpcPerMinute:60};function B(e){let r=0;for(let s=0;s<e.length;s+=1){let p=e.charCodeAt(s);if(p<128)r+=1;else if(p<2048)r+=2;else if(p>=55296&&p<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);a>=56320&&a<=57343?(r+=4,s+=1):r+=3}else r+=3}return r}var G=["tools/call","tools/list","resources/read","resources/list"],O=-32601,I=-32602,y=-32e3,d={messageBytes:1e6,minHeight:48,defaultHeight:160,maxHeight:720,linkChars:2048,teardownMs:1e3,engagedTouchMs:1e4,contextCoalesceMs:1e3,logsPerMinute:50,rates:{message:[[3e3,1],[6e5,10]],openLink:[[2e3,1]],rpc:[[1e4,10],[6e5,120]]}};function K(e){let r=J(e);return{...e.can.openLinks?{openLinks:{}}:{},logging:{},...e.can.modelContext?{updateModelContext:{text:{},structuredContent:{}}}:{},...e.can.message?{message:{text:{}}}:{},...r&&e.can.serverTools?{serverTools:{}}:{},...r&&e.can.serverResources?{serverResources:{}}:{},sandbox:{permissions:{},csp:{connectDomains:[...e.network.connect],resourceDomains:[...e.network.resources]}}}}function J(e){return!!e.tool}function H(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function $(e){return typeof e=="string"&&e.length<=200||typeof e=="number"&&Number.isFinite(e)}function X(e){let r;try{r=JSON.stringify(e)}catch{return null}return r===void 0?null:r.length*3<=d.messageBytes?r.length:B(r)}function Z(e){if(!H(e)||e.jsonrpc!=="2.0")return null;let r=X(e);return r===null||r>d.messageBytes||e.params!==void 0&&!H(e.params)?null:typeof e.method=="string"?!e.method||e.method.length>200||"id"in e&&!$(e.id)?null:e:e.method!==void 0||!$(e.id)?null:"result"in e||H(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"?e:null}function T(e,r){let s=[],p=Math.max(...e.map(([a])=>a));return{take(){let a=r();for(;s.length&&a-s[0]>=p;)s.shift();for(let[f,u]of e)if(s.filter(A=>a-A<f).length>=u)return!1;return s.push(a),!0}}}function S(e){return H(e)&&typeof e.code=="number"&&Number.isInteger(e.code)?{code:e.code,message:typeof e.message=="string"&&e.message?e.message:"The host refused this."}:{code:y,message:e instanceof Error&&e.message?e.message:"The host could not do that."}}function Q(e){if(typeof e!="string"||!e||e.length>d.linkChars)return null;let r;try{r=new URL(e)}catch{return null}return r.protocol!=="http:"&&r.protocol!=="https:"||r.username||r.password?null:r.href.length<=d.linkChars?r.href:null}function ee(e){if(!e||e.role!=="user"||!Array.isArray(e.content)||e.content.length===0)return null;let r=[];for(let p of e.content){if(!H(p)||p.type!=="text"||typeof p.text!="string")return null;r.push(p.text)}let s=r.join(`+`).trim();return s&&s.length<=j.messageText?s:null}function D(e){let{doc:r,adapter:s}=e,p=J(r),a=e.timers??{set:(t,l)=>setTimeout(t,l),clear:t=>clearTimeout(t)},f=()=>s.now(),u={...e.hostContext,...p&&r.tool?{toolInfo:{tool:r.tool}}:{}},A=null,C=!1,h=!1,x=!1,M=!1,_=0,R=new Map,k={message:T(d.rates.message,f),openLink:T(d.rates.openLink,f),rpc:T(d.rates.rpc,f),log:T([[6e4,d.logsPerMinute]],f)},b=null,n=null,c=-1/0,g=t=>{if(!x)try{s.post(t)}catch{}},w=(t,l)=>g({jsonrpc:"2.0",id:t,result:l}),i=(t,l,o)=>g({jsonrpc:"2.0",id:t,error:{code:l,message:o}}),P=()=>{let t=e.limits?.maxHeight,l=u.containerDimensions?.maxHeight,o=typeof t=="number"&&t>0?t:typeof l=="number"&&l>0?l:d.maxHeight;return Math.max(d.minHeight,o)},L=()=>{if(n=null,x||!b)return;let t=b;b=null,c=f(),Promise.resolve().then(()=>s.setContext(t)).catch(()=>{})},U=async()=>{if(n===null||!b)return;a.clear(n),n=null;let t=b;b=null,c=f();try{await s.setContext(t)}catch{}},q=()=>{if(p&&!M&&(M=!0,g({jsonrpc:"2.0",method:"ui/notifications/tool-input",params:{arguments:r.toolInput??{}}}),g({jsonrpc:"2.0",method:"ui/notifications/tool-result",params:r.toolResult??{content:[]}})),A){let t=A;A=null,g({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:t})}},V=async(t,l,o)=>{if(!p)return i(t,O,"Method not found");if(!(l.startsWith("tools/")?r.can.serverTools:r.can.serverResources))return i(t,y,r.blocked?.text??"This app cannot reach its server right now.");if(l==="tools/call"&&(typeof o.name!="string"||!o.name||o.arguments!==void 0&&!H(o.arguments)))return i(t,I,"tools/call needs {name, arguments?}.");if(l==="resources/read"&&typeof o.uri!="string")return i(t,I,"resources/read needs {uri}.");if(!k.rpc.take())return i(t,y,"Too many calls from this app. Wait a moment.");try{let v=await s.callRpc(l,o);w(t,v??{})}catch(v){let N=S(v);i(t,N.code,N.message)}},W=async(t,l,o)=>{if(l==="ui/initialize")return C=!0,w(t,{protocolVersion:E,hostInfo:{name:"mausbot",version:e.hostVersion},hostCapabilities:K(r),hostContext:u});if(h)switch(l){case"ping":return w(t,{});case"ui/request-display-mode":return w(t,{mode:"inline"});case"ui/open-link":{if(!r.can.openLinks)return i(t,y,"This app cannot open links here.");if(!s.engaged())return i(t,y,"Links open only after the person clicks in the app.");let m=Q(o?.url);if(!m)return i(t,I,"Only http and https links of at most 2,048 characters, without a user name or password, can be opened.");if(!k.openLink.take())return i(t,y,"Too many links from this app. Wait a moment.");try{return await s.openLink(m),w(t,{})}catch(v){return i(t,y,S(v).message)}}case"ui/message":{if(!r.can.message)return i(t,y,"This app cannot send messages here.");if(!s.engaged())return i(t,y,"Messages are sent only after the person clicks in the app.");let m=ee(o);if(m===null)return i(t,I,`Only text messages of 1 to ${j.messageText} characters can be sent.`);if(!k.message.take())return i(t,y,"Too many messages from this app. Wait a moment.");try{return await U(),await s.sendMessage(m),w(t,{})}catch(v){return i(t,y,S(v).message)}}case"ui/update-model-context":{if(!r.can.modelContext)return i(t,y,"This app cannot update the model's context here.");if(o?.content!==void 0&&!Array.isArray(o.content)||o?.structuredContent!==void 0&&!H(o.structuredContent))return i(t,I,"ui/update-model-context takes {content?, structuredContent?}.");if(b={...Array.isArray(o?.content)?{content:o.content}:{},...H(o?.structuredContent)?{structuredContent:o.structuredContent}:{}},n===null){let m=c+d.contextCoalesceMs-f();m<=0?L():n=a.set(L,m)}return w(t,{})}default:return G.includes(l)?V(t,l,o??{}):i(t,O,"Method not found")}},Y=(t,l)=>{if(t==="ui/notifications/initialized"){if(!C||h)return;h=!0,q();return}if(h)switch(t){case"ui/notifications/size-changed":{let o=l?.height;if(typeof o!="number"||!Number.isFinite(o))return;s.resize(Math.round(Math.min(P(),Math.max(d.minHeight,o))));return}case"notifications/message":e.log&&k.log.take()&&e.log(l);return;case"ui/notifications/request-teardown":s.teardownRequested();return;default:}};return{get initialized(){return h},handleMessage(t){if(x)return;let l=e.source();if(l==null||t.source!==l)return;let o=Z(t.data);if(!o)return;if("method"in o){"id"in o?W(o.id,o.method,o.params):Y(o.method,o.params);return}let m=R.get(o.id);m&&(R.delete(o.id),m(o))},contextChanged(t){x||(u={...u,...t},h?g({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:t}):C&&(A={...A,...t}))},teardown(){return x||!h?Promise.resolve():new Promise(t=>{let l=`host:${++_}`,o=!1,m=()=>{o||(o=!0,R.delete(l),a.clear(v),t())},v=a.set(m,d.teardownMs);R.set(l,m),g({jsonrpc:"2.0",id:l,method:"ui/resource-teardown",params:{}})})},dispose(){x=!0,n!==null&&a.clear(n),n=null;for(let t of R.values())t({jsonrpc:"2.0",id:"",result:{}});R.clear()}}}var F=1;function te(e){let s=e.webkit?.messageHandlers?.appHost;if(s&&typeof s.postMessage=="function")return{send:a=>s.postMessage(a)};let p=e.appHost;return p&&typeof p.postMessage=="function"?{send:a=>p.postMessage(JSON.stringify(a)),listen:a=>{p.onmessage=f=>{if(typeof f.data!="string")return;let u;try{u=JSON.parse(f.data)}catch{return}u&&typeof u=="object"&&u.v===F&&a(u)}}}:null}function ne(e,r){let s=r??te(e);if(!s)return null;let p=e.document,a=null,f=null,u=0,A=!1,C=0,h=new Map,x=n=>{try{s.send(n)}catch{}},M=(n,c)=>new Promise((g,w)=>{let i=`c${++C}`;h.set(i,{resolve:g,reject:w}),x({v:1,type:"call",callId:i,op:n,params:c})}),_=()=>{for(let n of h.values())n.reject({code:-32e3,message:"This app was closed."});h.clear()};e.addEventListener("message",n=>{a&&(a.handleMessage({source:n.source,data:n.data}),!A&&a.initialized&&(A=!0,x({v:1,type:"initialized"})))});let R=()=>{a?.dispose(),a=null,f?.remove(),f=null,A=!1,_()},k={load(n){if(!n||n.v!==F||!n.doc||typeof n.doc.srcdoc!="string")return;R(),typeof n.engagedAt=="number"&&(u=n.engagedAt);let c=p.createElement("iframe");c.setAttribute("sandbox","allow-scripts allow-forms"),c.setAttribute("referrerpolicy","no-referrer"),c.setAttribute("title","App");let g=Math.max(d.minHeight,Math.round(n.limits?.height??d.defaultHeight));c.style.height=`${g}px`,a=D({doc:n.doc,hostContext:n.hostContext??{},hostVersion:n.hostVersion??"phone",...n.limits?.maxHeight?{limits:{maxHeight:n.limits.maxHeight}}:{},source:()=>c.contentWindow,adapter:{post:i=>c.contentWindow?.postMessage(i,"*"),callRpc:(i,P)=>M("rpc",{method:i,params:P}),sendMessage:async i=>{await M("message",{text:i})},openLink:async i=>{await M("open-link",{url:i})},setContext:async i=>{await M("context",{...i})},resize:i=>{c.style.height=`${i}px`,x({v:1,type:"size",height:i})},engaged:()=>Date.now()-u<=d.engagedTouchMs,teardownRequested:()=>x({v:1,type:"teardown-request"}),now:()=>Date.now()}}),f=c,c.srcdoc=n.doc.srcdoc,p.body.appendChild(c)},contextChanged(n){a?.contextChanged(n??{})},engaged(n){typeof n=="number"&&Number.isFinite(n)&&(u=Math.max(u,n))},async teardown(){a&&await a.teardown(),R(),x({v:1,type:"torn-down"})},reply(n,c){let g=h.get(n);g&&(h.delete(n),c&&"error"in c&&c.error?g.reject(c.error):g.resolve(c&&"result"in c?c.result:void 0))}};s.listen?.(n=>{switch(n.call){case"load":return k.load(n.args[0]);case"contextChanged":return k.contextChanged(n.args[0]);case"engaged":return k.engaged(n.args[0]);case"teardown":return void k.teardown();case"reply":return k.reply(n.args[0],n.args[1])}});let b=e;return b.appHost&&typeof b.appHost.postMessage=="function"||(b.appHost=k),b.mausbotAppHost=k,x({v:1,type:"ready"}),k}function z(){typeof window<"u"&&ne(window)}z();})();</script></body></html>diff --git a/shared/app.ts b/shared/app.tsindex 70b7cc7671..2418fe1977 100644--- a/shared/app.ts+++ b/shared/app.ts@@ -170,6 +170,8 @@ export interface ShowHtmlInput {title: string;height?: number;fallbackText?: string;+ /** Show the page without the card frame (still in its sandboxed frame). */+ frameless?: boolean;}export interface UpdateHtmlInput {@@ -178,6 +180,8 @@ export interface UpdateHtmlInput {jsx?: string;path?: string;title?: string;+ /** Change whether the page has the card frame; kept as it was when omitted. */+ frameless?: boolean;}export type AppInputResult<T> = { ok: true; value: T } | { ok: false; error: string };@@ -254,6 +258,12 @@ function checkTitle(value: unknown): AppInputResult<string> {return { ok: true, value: title };}+function checkFrameless(value: unknown): AppInputResult<boolean | undefined> {+ if (value === undefined || value === null) return { ok: true, value: undefined };+ if (typeof value !== "boolean") return { ok: false, error: "frameless: must be true or false." };+ return { ok: true, value };+}+export function parseShowHtmlInput(input: unknown): AppInputResult<ShowHtmlInput> {if (!isRecord(input)) return { ok: false, error: "show_html needs {html, jsx or path, title, height?, fallback_text?}." };const page = checkPage(input);@@ -261,6 +271,9 @@ export function parseShowHtmlInput(input: unknown): AppInputResult<ShowHtmlInputconst title = checkTitle(input.title);if (!title.ok) return title;const out: ShowHtmlInput = { ...page.value, title: title.value };+ const frameless = checkFrameless(input.frameless);+ if (!frameless.ok) return frameless;+ if (frameless.value) out.frameless = true;if (input.height !== undefined && input.height !== null) {if (typeof input.height !== "number" || !Number.isFinite(input.height)) return { ok: false, error: "height: must be a number of pixels, 80 to 720." };out.height = Math.round(Math.min(APP_LIMITS.heightMax, Math.max(APP_LIMITS.heightMin, input.height)));@@ -282,6 +295,9 @@ export function parseUpdateHtmlInput(input: unknown): AppInputResult<UpdateHtmlIconst page = checkPage(input);if (!page.ok) return page;const out: UpdateHtmlInput = { appId: input.app_id.trim(), ...page.value };+ const frameless = checkFrameless(input.frameless);+ if (!frameless.ok) return frameless;+ if (frameless.value !== undefined) out.frameless = frameless.value;if (input.title !== undefined && input.title !== null) {const title = checkTitle(input.title);if (!title.ok) return title;diff --git a/src/components/app/AppMessage.test.ts b/src/components/app/AppMessage.test.tsindex a1483c8b3a..9fbd1b3447 100644--- a/src/components/app/AppMessage.test.ts+++ b/src/components/app/AppMessage.test.ts@@ -155,6 +155,15 @@ describe("a bot's page", () => {expect(pool.live()).toEqual(["t1:a1"]);});+ it("shows a frameless page as part of the chat: no card around it, still in the sandboxed frame, with its title and tools", async () => {+ await mount(row(htmlPayload({ border: false })));+ expect(find("[data-app] > div")!.className).not.toContain("rounded-3xl");+ expect(find("[data-app-box]")!.className).not.toContain("border-t");+ expect(frame().getAttribute("sandbox")).toBe("allow-scripts allow-forms");+ expect(find("[data-app]")!.textContent).toContain("Coffee counter");+ expect(button("Reload app")).toBeTruthy();+ });+it("lists what the frame may reach, its size, and what is always off", async () => {await mount(row(htmlPayload()));await act(async () => button("About this app")!.click());