`www-example-com.oaiusercontent.com\`)

If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:l.boolean().optional().describe(`Visual boundary preference - true if view prefers a visible border.

Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.

- \`true\`: request visible border + background
- \`false\`: request no visible border + background
- omitted: host decides border`)}),dH=l.object({method:l.literal("ui/request-display-mode"),params:l.object({mode:dE.describe("The display mode being requested.")})}),dY=(l.object({mode:dE.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),l.union([l.literal("model"),l.literal("app")]).describe("Tool visibility scope - who can access the tool.")),dQ=(l.object({resourceUri:l.string().optional(),visibility:l.array(dY).optional().describe(`Who can access this tool. Default: ["model", "app"]
- "model": Tool visible to and callable by the agent
- "app": Tool callable by the app from this server only`)}),l.object({mimeTypes:l.array(l.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),l.object({method:l.literal("ui/download-file"),params:l.object({contents:l.array(l.union([r.w9,r.u$])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})})),d4=l.object({method:l.literal("ui/message"),params:l.object({role:l.literal("user").describe('Message role, currently only "user" is supported.'),content:l.array(r.WK).describe("Message content blocks (text, image, etc.).")})}),d6=(l.object({method:l.literal("ui/notifications/sandbox-resource-ready"),params:l.object({html:l.string().describe("HTML content to load into the inner iframe."),sandbox:l.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:dL.optional().describe("CSP configuration from resource metadata."),permissions:dJ.optional().describe("Sandbox permissions from resource metadata.")})}),l.object({method:l.literal("ui/notifications/tool-result"),params:r.TF.describe("Standard MCP tool execution result.")}),l.object({toolInfo:l.object({id:r.UJ.optional().describe("JSON-RPC id of the tools/call request."),tool:r.Dn.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:dP.optional().describe("Current color theme preference."),styles:dW.optional().describe("Style configuration for theming the app."),displayMode:dE.optional().describe("How the UI is currently displayed."),availableDisplayModes:l.array(dE).optional().describe("Display modes the host supports."),containerDimensions:l.union([l.object({height:l.number().describe("Fixed container height in pixels.")}),l.object({maxHeight:l.union([l.number(),l.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(l.union([l.object({width:l.number().describe("Fixed container width in pixels.")}),l.object({maxWidth:l.union([l.number(),l.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:l.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:l.string().optional().describe("User's timezone in IANA format."),userAgent:l.string().optional().describe("Host application identifier."),platform:l.union([l.literal("web"),l.literal("desktop"),l.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:l.object({touch:l.boolean().optional().describe("Whether the device supports touch input."),hover:l.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:l.object({top:l.number().describe("Top safe area inset in pixels."),right:l.number().describe("Right safe area inset in pixels."),bottom:l.number().describe("Bottom safe area inset in pixels."),left:l.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough()),d0=(l.object({method:l.literal("ui/notifications/host-context-changed"),params:d6.describe("Partial context update containing only changed fields.")}),l.object({method:l.literal("ui/update-model-context"),params:l.object({content:l.array(r.WK).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:l.record(l.string(),l.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})})),d1=l.object({method:l.literal("ui/initialize"),params:l.object({appInfo:r.a8.describe("App identification (name and version)."),appCapabilities:dG.describe("Features and capabilities this app provides."),protocolVersion:l.string().describe("Protocol version this app supports.")})});l.object({protocolVersion:l.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:r.a8.describe("Host application identification and version."),hostCapabilities:dV.describe("Features and capabilities provided by the host."),hostContext:d6.describe("Rich context about the host environment.")}).passthrough();class d2{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource)return void console.debug("Ignoring message from unknown source",e);let i=r.OR.safeParse(e.data);i.success?(console.debug("Parsed message",i.data),this.onmessage?.(i.data)):e.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",i.error.message,e):(console.error("Failed to parse message",i.error.message,e),this.onerror?.(Error("Invalid JSON-RPC message received: "+i.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,t){console.debug("Sending message",e),this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}function d9(e){let t=e._meta?.ui?.resourceUri;if(void 0===t&&(t=e._meta?.["ui/resourceUri"]),"string"==typeof t&&t.startsWith("ui://"))return t;if(void 0!==t)throw Error(`Invalid UI resource URI: ${JSON.stringify(t)}`)}a.Zs;var d3=[u];class d7 extends a.Zs{_client;_hostInfo;_capabilities;_appCapabilities;_hostContext={};_appInfo;constructor(e,t,i,n){super(n),this._client=e,this._hostInfo=t,this._capabilities=i,this._hostContext=n?.hostContext||{},this.setRequestHandler(d1,e=>this._oninitialize(e)),this.setRequestHandler(r.tC,(e,t)=>(this.onping?.(e.params,t),{})),this.setRequestHandler(dH,e=>({mode:this._hostContext.displayMode??"inline"}))}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;set onsizechange(e){this.setNotificationHandler(dM,t=>e(t.params))}set onsandboxready(e){this.setNotificationHandler(dR,t=>e(t.params))}set oninitialized(e){this.setNotificationHandler(dB,t=>e(t.params))}set onmessage(e){this.setRequestHandler(d4,async(t,i)=>e(t.params,i))}set onopenlink(e){this.setRequestHandler(dC,async(t,i)=>e(t.params,i))}set ondownloadfile(e){this.setRequestHandler(dQ,async(t,i)=>e(t.params,i))}set onrequestdisplaymode(e){this.setRequestHandler(dH,async(t,i)=>e(t.params,i))}set onloggingmessage(e){this.setNotificationHandler(r.B,async t=>{e(t.params)})}set onupdatemodelcontext(e){this.setRequestHandler(d0,async(t,i)=>e(t.params,i))}set oncalltool(e){this.setRequestHandler(r.FT,async(t,i)=>e(t.params,i))}sendToolListChanged(e={}){return this.notification({method:"notifications/tools/list_changed",params:e})}set onlistresources(e){this.setRequestHandler(r.OI,async(t,i)=>e(t.params,i))}set onlistresourcetemplates(e){this.setRequestHandler(r.s,async(t,i)=>e(t.params,i))}set onreadresource(e){this.setRequestHandler(r.R6,async(t,i)=>e(t.params,i))}sendResourceListChanged(e={}){return this.notification({method:"notifications/resources/list_changed",params:e})}set onlistprompts(e){this.setRequestHandler(r.Qq,async(t,i)=>e(t.params,i))}sendPromptListChanged(e={}){return this.notification({method:"notifications/prompts/list_changed",params:e})}assertCapabilityForMethod(e){}assertRequestHandlerCapability(e){}assertNotificationCapability(e){}assertTaskCapability(e){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(e){throw Error("Task handlers are not supported in MCP Apps")}getCapabilities(){return this._capabilities}async _oninitialize(e){let t=e.params.protocolVersion;return this._appCapabilities=e.params.appCapabilities,this._appInfo=e.params.appInfo,{protocolVersion:d3.includes(t)?t:u,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(e){let t={},i=!1;for(let a of Object.keys(e)){var n,r;let o=this._hostContext[a],s=e[a];n=o,r=s,JSON.stringify(n)!==JSON.stringify(r)&&(t[a]=s,i=!0)}i&&(this._hostContext=e,this.sendHostContextChange(t))}sendHostContextChange(e){return this.notification({method:"ui/notifications/host-context-changed",params:e})}sendToolInput(e){return this.notification({method:"ui/notifications/tool-input",params:e})}sendToolInputPartial(e){return this.notification({method:"ui/notifications/tool-input-partial",params:e})}sendToolResult(e){return this.notification({method:"ui/notifications/tool-result",params:e})}sendToolCancelled(e){return this.notification({method:"ui/notifications/tool-cancelled",params:e})}sendSandboxResourceReady(e){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:e})}teardownResource(e,t){return this.request({method:"ui/resource-teardown",params:e},dq,t)}sendResourceTeardown=this.teardownResource;async connect(e){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._client){let e=this._client.getServerCapabilities();if(!e)throw Error("Client server capabilities not available");e.tools&&(this.oncalltool=async(e,t)=>this._client.request({method:"tools/call",params:e},r.TF,{signal:t.signal}),e.tools.listChanged)&&this._client.setNotificationHandler(r.fH,e=>this.sendToolListChanged(e.params)),e.resources&&(this.onlistresources=async(e,t)=>this._client.request({method:"resources/list",params:e},r.cv,{signal:t.signal}),this.onlistresourcetemplates=async(e,t)=>this._client.request({method:"resources/templates/list",params:e},r.O$,{signal:t.signal}),this.onreadresource=async(e,t)=>this._client.request({method:"resources/read",params:e},r.ve,{signal:t.signal}),e.resources.listChanged)&&this._client.setNotificationHandler(r.hh,e=>this.sendResourceListChanged(e.params)),e.prompts&&(this.onlistprompts=async(e,t)=>this._client.request({method:"prompts/list",params:e},r.Yu,{signal:t.signal}),e.prompts.listChanged)&&this._client.setNotificationHandler(r.br,e=>this.sendPromptListChanged(e.params))}return super.connect(e)}}}}]);Ә