@copilotkit/angular 0.5.2 → 0.5.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"copilotkit-angular-mcp-apps.mjs","sources":["../../src/mcp-apps/lib/mcp-apps-content.ts","../../src/mcp-apps/lib/mcp-apps-request-queue.ts","../../src/mcp-apps/lib/mcp-apps-config.ts","../../src/mcp-apps/lib/mcp-apps-widget.ts","../../src/mcp-apps/lib/mcp-apps-activity-renderer.ts","../../src/mcp-apps/lib/provide-mcp-apps.ts","../../src/mcp-apps/copilotkit-angular-mcp-apps.ts"],"sourcesContent":["import { z } from \"zod/v4\";\n\nconst annotationsSchema = z.looseObject({\n audience: z.array(z.enum([\"user\", \"assistant\"])).optional(),\n priority: z.number().min(0).max(1).optional(),\n lastModified: z.string().optional(),\n});\n\nconst base64Schema = z\n .string()\n .refine(\n (value) =>\n value.length % 4 === 0 &&\n /^[A-Za-z0-9+/]*={0,2}$/.test(value) &&\n !/=/.test(value.slice(0, -2)),\n \"Expected base64-encoded data\",\n );\n\nconst resourceContentsSchema = z.union([\n z.looseObject({\n uri: z.string(),\n mimeType: z.string().optional(),\n text: z.string(),\n }),\n z.looseObject({\n uri: z.string(),\n mimeType: z.string().optional(),\n blob: base64Schema,\n }),\n]);\n\nconst contentItemSchema = z.discriminatedUnion(\"type\", [\n z.looseObject({\n type: z.literal(\"text\"),\n text: z.string(),\n annotations: annotationsSchema.optional(),\n }),\n z.looseObject({\n type: z.literal(\"image\"),\n data: base64Schema,\n mimeType: z.string(),\n annotations: annotationsSchema.optional(),\n }),\n z.looseObject({\n type: z.literal(\"audio\"),\n data: base64Schema,\n mimeType: z.string(),\n annotations: annotationsSchema.optional(),\n }),\n z.looseObject({\n type: z.literal(\"resource\"),\n resource: resourceContentsSchema,\n annotations: annotationsSchema.optional(),\n }),\n z.looseObject({\n type: z.literal(\"resource_link\"),\n uri: z.string(),\n name: z.string(),\n description: z.string().optional(),\n mimeType: z.string().optional(),\n annotations: annotationsSchema.optional(),\n }),\n]);\n\nconst callToolResultSchema = z.looseObject({\n content: z.array(contentItemSchema).default([]),\n structuredContent: z.record(z.string(), z.unknown()).optional(),\n isError: z.boolean().optional(),\n _meta: z.record(z.string(), z.unknown()).optional(),\n});\n\n/**\n * Content schema for `activityType: \"mcp-apps\"` activity messages: a snapshot\n * of an MCP Apps tool call, carrying the middleware server hash, optional\n * stable server id, the ui:// resource to render, and its tool exchange.\n *\n * Kept local and declared with the `zod/v4` API so the Angular browser bundle\n * validates protocol data without taking a direct MCP client SDK dependency.\n */\nexport const mcpAppsSnapshotContentSchema = z.looseObject({\n serverHash: z.string(),\n serverId: z.string().optional(),\n resourceUri: z.string(),\n result: callToolResultSchema,\n toolInput: z.record(z.string(), z.unknown()).optional(),\n});\n\n/** Parsed content of an `mcp-apps` activity message. */\nexport type MCPAppsSnapshotContent = z.infer<\n typeof mcpAppsSnapshotContentSchema\n>;\n","const DEFAULT_IDLE_TIMEOUT_MS = 30_000;\nconst DEFAULT_IDLE_POLL_INTERVAL_MS = 500;\n\nexport interface MCPAppsQueueAgent {\n threadId?: string;\n isRunning: boolean;\n subscribe(callbacks: {\n onRunFinalized: () => void;\n onRunFailed: () => void;\n }): { unsubscribe(): void };\n}\n\nexport interface MCPAppsRequestQueueOptions {\n idleTimeoutMs?: number;\n idlePollIntervalMs?: number;\n}\n\nexport interface MCPAppsQueueRequest<T> {\n agent: MCPAppsQueueAgent;\n ownerId: string;\n execute: (signal: AbortSignal) => Promise<T>;\n dropAfterThreadSwitch?: boolean;\n}\n\ntype QueueItem = {\n agent: MCPAppsQueueAgent;\n capturedThreadId: string;\n controller: AbortController;\n dropAfterThreadSwitch: boolean;\n execute: (signal: AbortSignal) => Promise<unknown>;\n ownerId: string;\n reject: (error: Error) => void;\n resolve: (result: unknown) => void;\n};\n\n/** Raised when a renderer cancels MCP work that it owns. */\nexport class MCPAppsQueueCancelledError extends Error {\n constructor() {\n super(\"MCP Apps request cancelled because its renderer was destroyed.\");\n this.name = \"MCPAppsQueueCancelledError\";\n }\n}\n\n/** Raised when an agent does not become idle within the configured limit. */\nexport class MCPAppsQueueTimeoutError extends Error {\n constructor(timeoutMs: number) {\n super(`Timed out waiting ${timeoutMs}ms for the agent to become idle.`);\n this.name = \"MCPAppsQueueTimeoutError\";\n }\n}\n\n/** Raised when a queued follow-up no longer belongs to the active thread. */\nexport class MCPAppsQueueThreadChangedError extends Error {\n constructor(originThreadId: string, currentThreadId: string) {\n super(\n `Dropped MCP Apps follow-up after thread changed from \"${originThreadId}\" to \"${currentThreadId}\".`,\n );\n this.name = \"MCPAppsQueueThreadChangedError\";\n }\n}\n\n/**\n * Serializes MCP requests per agent thread while retaining renderer ownership.\n *\n * An owner can abort its queued and active waits without affecting requests\n * created by another renderer. Follow-ups can additionally opt into a\n * thread-identity check immediately before execution.\n */\nexport class MCPAppsRequestQueue {\n private readonly queues = new Map<\n MCPAppsQueueAgent,\n Map<string, QueueItem[]>\n >();\n private readonly processing = new Map<MCPAppsQueueAgent, Set<string>>();\n private readonly idleTimeoutMs: number;\n private readonly idlePollIntervalMs: number;\n\n constructor(options: MCPAppsRequestQueueOptions = {}) {\n this.idleTimeoutMs = positiveDuration(\n options.idleTimeoutMs,\n DEFAULT_IDLE_TIMEOUT_MS,\n \"idleTimeoutMs\",\n );\n this.idlePollIntervalMs = positiveDuration(\n options.idlePollIntervalMs,\n DEFAULT_IDLE_POLL_INTERVAL_MS,\n \"idlePollIntervalMs\",\n );\n }\n\n /** Enqueues one request and resolves it in FIFO order for its thread. */\n enqueue<T>(request: MCPAppsQueueRequest<T>): Promise<T> {\n const capturedThreadId = request.agent.threadId || \"default\";\n\n return new Promise<T>((resolve, reject) => {\n const agentQueues =\n this.queues.get(request.agent) ?? new Map<string, QueueItem[]>();\n const queue = agentQueues.get(capturedThreadId) ?? [];\n const item: QueueItem = {\n agent: request.agent,\n capturedThreadId,\n controller: new AbortController(),\n dropAfterThreadSwitch: request.dropAfterThreadSwitch ?? false,\n execute: request.execute,\n ownerId: request.ownerId,\n reject,\n resolve: (result) => resolve(result as T),\n };\n\n queue.push(item);\n agentQueues.set(capturedThreadId, queue);\n this.queues.set(request.agent, agentQueues);\n void this.processQueue(request.agent, capturedThreadId);\n });\n }\n\n /** Cancels only requests associated with the supplied renderer owner. */\n cancelOwner(ownerId: string): void {\n for (const agentQueues of this.queues.values()) {\n for (const queue of agentQueues.values()) {\n for (const item of queue) {\n if (item.ownerId === ownerId && !item.controller.signal.aborted) {\n item.controller.abort();\n item.reject(new MCPAppsQueueCancelledError());\n }\n }\n }\n }\n }\n\n private async processQueue(\n agent: MCPAppsQueueAgent,\n threadId: string,\n ): Promise<void> {\n const processingThreads = this.processing.get(agent) ?? new Set<string>();\n if (processingThreads.has(threadId)) return;\n processingThreads.add(threadId);\n this.processing.set(agent, processingThreads);\n\n try {\n const queue = this.queues.get(agent)?.get(threadId);\n if (!queue) return;\n\n while (queue.length > 0) {\n const item = queue[0]!;\n\n try {\n this.throwIfCancelled(item.controller.signal);\n await this.waitForAgentIdle(item.agent, item.controller.signal);\n this.throwIfCancelled(item.controller.signal);\n\n const currentThreadId = item.agent.threadId || \"default\";\n if (\n item.dropAfterThreadSwitch &&\n currentThreadId !== item.capturedThreadId\n ) {\n throw new MCPAppsQueueThreadChangedError(\n item.capturedThreadId,\n currentThreadId,\n );\n }\n\n const result = await raceWithAbort(\n item.execute(item.controller.signal),\n item.controller.signal,\n );\n item.resolve(result);\n } catch (error) {\n item.reject(asError(error));\n } finally {\n queue.shift();\n }\n }\n } finally {\n const agentQueues = this.queues.get(agent);\n agentQueues?.delete(threadId);\n if (agentQueues?.size === 0) this.queues.delete(agent);\n\n processingThreads.delete(threadId);\n if (processingThreads.size === 0) this.processing.delete(agent);\n }\n }\n\n private waitForAgentIdle(\n agent: MCPAppsQueueAgent,\n signal: AbortSignal,\n ): Promise<void> {\n if (!agent.isRunning) return Promise.resolve();\n\n return new Promise<void>((resolve, reject) => {\n let settled = false;\n let subscription: { unsubscribe(): void } | undefined;\n let interval: ReturnType<typeof setInterval> | undefined;\n\n const cleanup = () => {\n clearTimeout(timeout);\n if (interval !== undefined) clearInterval(interval);\n subscription?.unsubscribe();\n signal.removeEventListener(\"abort\", cancel);\n };\n const finish = () => {\n if (settled) return;\n settled = true;\n cleanup();\n resolve();\n };\n const fail = (error: Error) => {\n if (settled) return;\n settled = true;\n cleanup();\n reject(error);\n };\n const cancel = () => fail(new MCPAppsQueueCancelledError());\n const timeout = setTimeout(\n () => fail(new MCPAppsQueueTimeoutError(this.idleTimeoutMs)),\n this.idleTimeoutMs,\n );\n\n signal.addEventListener(\"abort\", cancel, { once: true });\n subscription = agent.subscribe({\n onRunFinalized: finish,\n onRunFailed: finish,\n });\n interval = setInterval(() => {\n if (!agent.isRunning) finish();\n }, this.idlePollIntervalMs);\n\n if (signal.aborted) cancel();\n });\n }\n\n private throwIfCancelled(signal: AbortSignal): void {\n if (signal.aborted) throw new MCPAppsQueueCancelledError();\n }\n}\n\nfunction positiveDuration(\n value: number | undefined,\n fallback: number,\n name: string,\n): number {\n const resolved = value ?? fallback;\n if (!Number.isFinite(resolved) || resolved <= 0) {\n throw new RangeError(`${name} must be a positive finite number.`);\n }\n return resolved;\n}\n\nfunction raceWithAbort<T>(\n promise: Promise<T>,\n signal: AbortSignal,\n): Promise<T> {\n if (signal.aborted) return Promise.reject(new MCPAppsQueueCancelledError());\n\n return new Promise<T>((resolve, reject) => {\n const cancel = () => reject(new MCPAppsQueueCancelledError());\n signal.addEventListener(\"abort\", cancel, { once: true });\n promise.then(\n (value) => {\n signal.removeEventListener(\"abort\", cancel);\n resolve(value);\n },\n (error: unknown) => {\n signal.removeEventListener(\"abort\", cancel);\n reject(error);\n },\n );\n });\n}\n\nfunction asError(error: unknown): Error {\n return error instanceof Error ? error : new Error(String(error));\n}\n","import { InjectionToken } from \"@angular/core\";\n\nexport interface MCPAppsHostInfo {\n name: string;\n version: string;\n}\n\nexport interface MCPAppsConfig {\n /** Maximum time to wait for a busy agent before a queued request fails. */\n idleTimeoutMs?: number;\n /** Maximum time to wait for the sandbox proxy initialization handshake. */\n initializationTimeoutMs?: number;\n /** Host identity announced during the MCP Apps initialization handshake. */\n hostInfo?: MCPAppsHostInfo;\n /** Additional protocol capabilities announced to embedded MCP Apps. */\n hostCapabilities?: Record<string, unknown>;\n /** Additional non-secret UI context announced to embedded MCP Apps. */\n hostContext?: Record<string, unknown>;\n}\n\nexport const DEFAULT_MCP_APPS_CONFIG: Readonly<Required<MCPAppsConfig>> = {\n idleTimeoutMs: 30_000,\n initializationTimeoutMs: 30_000,\n hostInfo: {\n name: \"CopilotKit MCP Apps Host\",\n version: \"1.0.0\",\n },\n hostCapabilities: {\n openLinks: {},\n serverTools: {},\n logging: {},\n },\n hostContext: {\n theme: \"light\",\n platform: \"web\",\n },\n};\n\n/** Holds renderer behavior configuration registered via `provideMCPApps`. */\nexport const MCP_APPS_CONFIG = new InjectionToken<Required<MCPAppsConfig>>(\n \"MCP_APPS_CONFIG\",\n { factory: () => ({ ...DEFAULT_MCP_APPS_CONFIG }) },\n);\n","import { isPlatformBrowser } from \"@angular/common\";\nimport type { AbstractAgent, RunAgentResult } from \"@ag-ui/client\";\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n PLATFORM_ID,\n afterRenderEffect,\n computed,\n inject,\n input,\n signal,\n viewChild,\n} from \"@angular/core\";\nimport { CopilotKit } from \"@copilotkit/angular\";\nimport { randomUUID } from \"@copilotkit/shared\";\nimport { type MCPAppsSnapshotContent } from \"./mcp-apps-content\";\nimport {\n MCPAppsQueueCancelledError,\n MCPAppsQueueThreadChangedError,\n MCPAppsRequestQueue,\n} from \"./mcp-apps-request-queue\";\nimport { MCP_APPS_CONFIG } from \"./mcp-apps-config\";\n\nconst PROTOCOL_VERSION = \"2025-06-18\";\n\nconst queuesByIdleTimeout = new Map<number, MCPAppsRequestQueue>();\n\ninterface FetchedResource {\n uri: string;\n mimeType?: string;\n text?: string;\n blob?: string;\n _meta?: {\n ui?: {\n prefersBorder?: boolean;\n csp?: { resourceDomains?: string[] };\n };\n };\n}\n\ninterface JSONRPCMessage {\n jsonrpc: \"2.0\";\n id?: string | number;\n method: string;\n params?: Record<string, unknown>;\n}\n\n/**\n * Renders one MCP App snapshot through the same agent-mediated protocol used\n * by the other CopilotKit frontends. Each instance owns its queued work and\n * sandbox listener, while requests remain serialized per agent thread.\n */\n@Component({\n selector: \"copilot-mcp-apps-widget\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <div class=\"copilot-mcp-apps-container\">\n @if (loading()) {\n <p class=\"copilot-mcp-apps-status\" role=\"status\" aria-live=\"polite\">\n Loading MCP App…\n </p>\n }\n @if (error()) {\n <p class=\"copilot-mcp-apps-error\" role=\"alert\">{{ error() }}</p>\n }\n <iframe\n #appFrame\n class=\"copilot-mcp-apps-frame\"\n data-testid=\"mcp-app-iframe\"\n title=\"Interactive MCP application\"\n ></iframe>\n </div>\n `,\n styles: `\n .copilot-mcp-apps-container {\n position: relative;\n width: 100%;\n min-height: 100px;\n overflow: hidden;\n }\n\n .copilot-mcp-apps-frame {\n display: block;\n width: 100%;\n min-height: 100px;\n border: 0;\n background: transparent;\n }\n\n .copilot-mcp-apps-status,\n .copilot-mcp-apps-error {\n margin: 0;\n padding: 16px;\n }\n\n .copilot-mcp-apps-status {\n color: #525252;\n }\n\n .copilot-mcp-apps-error {\n color: #991b1b;\n }\n `,\n})\nexport class CopilotMCPAppsWidget {\n private readonly config = inject(MCP_APPS_CONFIG);\n private readonly copilotKit = inject(CopilotKit);\n private readonly platformId = inject(PLATFORM_ID);\n private readonly ownerId = randomUUID();\n private readonly queue = queueForTimeout(this.config.idleTimeoutMs);\n private renderVersion = 0;\n\n readonly data = input.required<MCPAppsSnapshotContent>();\n readonly agent = input<AbstractAgent | undefined>();\n\n private readonly renderSession = computed(\n () => ({ agent: this.agent(), data: this.data() }),\n {\n equal: (previous, current) =>\n previous.agent === current.agent &&\n areStructurallyEqual(previous.data, current.data),\n },\n );\n\n private readonly appFrame =\n viewChild.required<ElementRef<HTMLIFrameElement>>(\"appFrame\");\n protected readonly loading = signal(true);\n protected readonly error = signal(\"\");\n\n constructor() {\n afterRenderEffect((onCleanup) => {\n const frame = this.appFrame().nativeElement;\n const { data, agent } = this.renderSession();\n const version = ++this.renderVersion;\n const controller = new AbortController();\n\n this.queue.cancelOwner(this.ownerId);\n this.resetFrame(frame);\n\n onCleanup(() => {\n controller.abort();\n this.queue.cancelOwner(this.ownerId);\n frame.removeAttribute(\"srcdoc\");\n frame.removeAttribute(\"src\");\n frame.removeAttribute(\"data-mcp-app-initialized\");\n });\n\n if (!isPlatformBrowser(this.platformId)) {\n this.loading.set(false);\n return;\n }\n\n void this.renderApp(frame, data, agent, controller, version);\n });\n }\n\n private async renderApp(\n frame: HTMLIFrameElement,\n data: MCPAppsSnapshotContent,\n agent: AbstractAgent | undefined,\n controller: AbortController,\n version: number,\n ): Promise<void> {\n if (!agent) {\n this.fail(\"No agent is available to load this MCP App.\", frame, version);\n return;\n }\n\n try {\n const runResult = await this.queue.enqueue({\n agent,\n ownerId: this.ownerId,\n execute: () =>\n agent.runAgent({\n forwardedProps: {\n __proxiedMCPRequest: {\n serverHash: data.serverHash,\n serverId: data.serverId,\n method: \"resources/read\",\n params: { uri: data.resourceUri },\n },\n },\n }),\n });\n this.throwIfStale(controller.signal, version);\n\n const resource = findResource(runResult, data.resourceUri);\n const html = resource.text\n ? resource.text\n : resource.blob\n ? decodeBase64(resource.blob)\n : undefined;\n if (!html) {\n throw new Error(\"The MCP App resource has no text or blob content.\");\n }\n\n frame.removeAttribute(\"data-mcp-app-initialized\");\n const sandboxReady = this.connectSandbox(\n frame,\n data,\n agent,\n controller.signal,\n version,\n );\n frame.setAttribute(\n \"sandbox\",\n \"allow-scripts allow-same-origin allow-forms\",\n );\n frame.removeAttribute(\"src\");\n frame.srcdoc = buildSandboxHTML(resource._meta?.ui?.csp?.resourceDomains);\n\n await sandboxReady;\n this.throwIfStale(controller.signal, version);\n this.sendNotification(frame, \"ui/notifications/sandbox-resource-ready\", {\n html,\n });\n this.loading.set(false);\n } catch (error) {\n if (isCancellation(error)) return;\n this.fail(asError(error).message, frame, version);\n }\n }\n\n private connectSandbox(\n frame: HTMLIFrameElement,\n data: MCPAppsSnapshotContent,\n agent: AbstractAgent,\n abortSignal: AbortSignal,\n version: number,\n ): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n let ready = false;\n const timeout = setTimeout(() => {\n cleanup();\n reject(\n new Error(\n `Timed out waiting ${this.config.initializationTimeoutMs}ms for the MCP App sandbox.`,\n ),\n );\n }, this.config.initializationTimeoutMs);\n const cancel = () => {\n cleanup();\n reject(new MCPAppsQueueCancelledError());\n };\n const onMessage = (event: MessageEvent) => {\n if (event.source !== frame.contentWindow) return;\n const message = parseJSONRPCMessage(event.data);\n if (!message) return;\n\n if (message.method === \"ui/notifications/sandbox-proxy-ready\") {\n if (!ready) {\n ready = true;\n clearTimeout(timeout);\n resolve();\n }\n return;\n }\n\n void this.handleMessage(\n frame,\n data,\n agent,\n message,\n abortSignal,\n version,\n );\n };\n const cleanup = () => {\n clearTimeout(timeout);\n window.removeEventListener(\"message\", onMessage);\n abortSignal.removeEventListener(\"abort\", cancel);\n };\n\n window.addEventListener(\"message\", onMessage);\n abortSignal.addEventListener(\"abort\", cancel, { once: true });\n if (abortSignal.aborted) cancel();\n\n // Keep protocol messages connected after initialization. Cleanup occurs\n // when this render session's abort signal fires.\n abortSignal.addEventListener(\n \"abort\",\n () => window.removeEventListener(\"message\", onMessage),\n { once: true },\n );\n });\n }\n\n private async handleMessage(\n frame: HTMLIFrameElement,\n data: MCPAppsSnapshotContent,\n agent: AbstractAgent,\n message: JSONRPCMessage,\n abortSignal: AbortSignal,\n version: number,\n ): Promise<void> {\n if (abortSignal.aborted || version !== this.renderVersion) return;\n\n if (message.id !== undefined) {\n switch (message.method) {\n case \"ui/initialize\":\n frame.setAttribute(\"data-mcp-app-initialized\", \"true\");\n this.sendResponse(frame, message.id, {\n protocolVersion: PROTOCOL_VERSION,\n hostInfo: this.config.hostInfo,\n hostCapabilities: this.config.hostCapabilities,\n hostContext: this.config.hostContext,\n });\n return;\n case \"ui/message\":\n await this.handleUIMessage(frame, agent, message, version);\n return;\n case \"ui/open-link\":\n this.handleOpenLink(frame, message);\n return;\n case \"tools/call\":\n await this.handleToolCall(frame, data, agent, message, abortSignal);\n return;\n default:\n this.sendError(\n frame,\n message.id,\n -32601,\n `Method not found: ${message.method}`,\n );\n return;\n }\n }\n\n switch (message.method) {\n case \"ui/notifications/initialized\":\n if (data.toolInput) {\n this.sendNotification(frame, \"ui/notifications/tool-input\", {\n arguments: data.toolInput,\n });\n }\n this.sendNotification(\n frame,\n \"ui/notifications/tool-result\",\n data.result as Record<string, unknown>,\n );\n break;\n case \"ui/notifications/size-changed\": {\n const height = message.params?.height;\n if (\n typeof height === \"number\" &&\n Number.isFinite(height) &&\n height > 0\n ) {\n frame.style.height = `${Math.ceil(Math.min(height, 5000))}px`;\n }\n break;\n }\n case \"notifications/message\":\n console.info(\"[CopilotKit MCP App]\", message.params ?? {});\n break;\n }\n }\n\n private async handleUIMessage(\n frame: HTMLIFrameElement,\n agent: AbstractAgent,\n message: JSONRPCMessage & { id?: string | number },\n version: number,\n ): Promise<void> {\n const id = message.id!;\n const role = message.params?.role === \"assistant\" ? \"assistant\" : \"user\";\n const content = Array.isArray(message.params?.content)\n ? message.params.content\n .filter(isTextContent)\n .map((part) => part.text)\n .join(\"\\n\")\n : \"\";\n\n if (content) {\n agent.addMessage({ id: randomUUID(), role, content });\n }\n this.sendResponse(frame, id, { isError: false });\n\n const shouldFollowUp =\n typeof message.params?.followUp === \"boolean\"\n ? message.params.followUp\n : role === \"user\";\n if (!shouldFollowUp || !content) return;\n\n try {\n await this.queue.enqueue({\n agent,\n ownerId: this.ownerId,\n dropAfterThreadSwitch: true,\n execute: () => this.copilotKit.core.runAgent({ agent }),\n });\n } catch (error) {\n if (isCancellation(error)) return;\n this.fail(\n `MCP App follow-up failed: ${asError(error).message}`,\n frame,\n version,\n );\n }\n }\n\n private handleOpenLink(\n frame: HTMLIFrameElement,\n message: JSONRPCMessage,\n ): void {\n const id = message.id!;\n const url = safeExternalURL(message.params?.url);\n if (!url) {\n this.sendError(frame, id, -32602, \"A valid HTTP(S) URL is required.\");\n return;\n }\n window.open(url, \"_blank\", \"noopener,noreferrer\");\n this.sendResponse(frame, id, { isError: false });\n }\n\n private async handleToolCall(\n frame: HTMLIFrameElement,\n data: MCPAppsSnapshotContent,\n agent: AbstractAgent,\n message: JSONRPCMessage,\n abortSignal: AbortSignal,\n ): Promise<void> {\n const id = message.id!;\n try {\n const runResult = await this.queue.enqueue({\n agent,\n ownerId: this.ownerId,\n execute: () =>\n agent.runAgent({\n forwardedProps: {\n __proxiedMCPRequest: {\n serverHash: data.serverHash,\n serverId: data.serverId,\n method: \"tools/call\",\n params: message.params,\n },\n },\n }),\n });\n if (!abortSignal.aborted)\n this.sendResponse(frame, id, runResult.result ?? {});\n } catch (error) {\n if (isCancellation(error)) return;\n this.sendError(frame, id, -32603, asError(error).message);\n }\n }\n\n private sendResponse(\n frame: HTMLIFrameElement,\n id: string | number,\n result: unknown,\n ): void {\n frame.contentWindow?.postMessage({ jsonrpc: \"2.0\", id, result }, \"*\");\n }\n\n private sendError(\n frame: HTMLIFrameElement,\n id: string | number,\n code: number,\n message: string,\n ): void {\n frame.contentWindow?.postMessage(\n { jsonrpc: \"2.0\", id, error: { code, message } },\n \"*\",\n );\n }\n\n private sendNotification(\n frame: HTMLIFrameElement,\n method: string,\n params: Record<string, unknown>,\n ): void {\n frame.contentWindow?.postMessage({ jsonrpc: \"2.0\", method, params }, \"*\");\n }\n\n private fail(\n message: string,\n frame: HTMLIFrameElement,\n version: number,\n ): void {\n if (version !== this.renderVersion) return;\n this.loading.set(false);\n this.error.set(message);\n frame.removeAttribute(\"srcdoc\");\n frame.removeAttribute(\"src\");\n frame.removeAttribute(\"data-mcp-app-initialized\");\n }\n\n private resetFrame(frame: HTMLIFrameElement): void {\n this.loading.set(true);\n this.error.set(\"\");\n frame.style.removeProperty(\"height\");\n frame.removeAttribute(\"srcdoc\");\n frame.removeAttribute(\"src\");\n frame.removeAttribute(\"data-mcp-app-initialized\");\n }\n\n private throwIfStale(abortSignal: AbortSignal, version: number): void {\n if (abortSignal.aborted || version !== this.renderVersion) {\n throw new MCPAppsQueueCancelledError();\n }\n }\n}\n\nfunction queueForTimeout(idleTimeoutMs: number): MCPAppsRequestQueue {\n let queue = queuesByIdleTimeout.get(idleTimeoutMs);\n if (!queue) {\n queue = new MCPAppsRequestQueue({ idleTimeoutMs });\n queuesByIdleTimeout.set(idleTimeoutMs, queue);\n }\n return queue;\n}\n\nfunction findResource(\n runResult: RunAgentResult,\n resourceUri: string,\n): FetchedResource {\n const result = runResult.result as\n | { contents?: FetchedResource[] }\n | undefined;\n const resource = result?.contents?.find(\n (candidate) => candidate.uri === resourceUri,\n );\n if (!resource) {\n throw new Error(\n `No matching MCP App resource was returned for \"${resourceUri}\".`,\n );\n }\n return resource;\n}\n\nfunction parseJSONRPCMessage(value: unknown): JSONRPCMessage | undefined {\n if (\n !isRecord(value) ||\n value.jsonrpc !== \"2.0\" ||\n typeof value.method !== \"string\"\n ) {\n return undefined;\n }\n if (\n value.id !== undefined &&\n typeof value.id !== \"string\" &&\n typeof value.id !== \"number\"\n ) {\n return undefined;\n }\n if (value.params !== undefined && !isRecord(value.params)) return undefined;\n return value as unknown as JSONRPCMessage;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value && typeof value === \"object\" && !Array.isArray(value));\n}\n\nfunction isTextContent(\n value: unknown,\n): value is { type: \"text\"; text: string } {\n return (\n isRecord(value) && value.type === \"text\" && typeof value.text === \"string\"\n );\n}\n\nfunction safeExternalURL(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n try {\n const url = new URL(value, window.location.href);\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") return undefined;\n if (url.username || url.password) return undefined;\n return url.href;\n } catch {\n return undefined;\n }\n}\n\nfunction decodeBase64(value: string): string {\n try {\n const binary = atob(value);\n const bytes = Uint8Array.from(binary, (character) =>\n character.charCodeAt(0),\n );\n return new TextDecoder().decode(bytes);\n } catch {\n throw new Error(\"The MCP App resource contains invalid base64 content.\");\n }\n}\n\nfunction isCancellation(error: unknown): boolean {\n return (\n error instanceof MCPAppsQueueCancelledError ||\n error instanceof MCPAppsQueueThreadChangedError\n );\n}\n\nfunction asError(error: unknown): Error {\n return error instanceof Error ? error : new Error(String(error));\n}\n\n/** Compares JSON-compatible activity snapshots without relying on object identity. */\nfunction areStructurallyEqual(left: unknown, right: unknown): boolean {\n if (Object.is(left, right)) return true;\n if (Array.isArray(left) || Array.isArray(right)) {\n return (\n Array.isArray(left) &&\n Array.isArray(right) &&\n left.length === right.length &&\n left.every((value, index) => areStructurallyEqual(value, right[index]))\n );\n }\n if (!isRecord(left) || !isRecord(right)) return false;\n\n const leftKeys = Object.keys(left);\n const rightKeys = Object.keys(right);\n return (\n leftKeys.length === rightKeys.length &&\n leftKeys.every(\n (key) =>\n Object.prototype.hasOwnProperty.call(right, key) &&\n areStructurallyEqual(left[key], right[key]),\n )\n );\n}\n\nfunction buildSandboxHTML(extraCspDomains?: string[]): string {\n const baseScriptSrc =\n \"'self' 'wasm-unsafe-eval' 'unsafe-inline' 'unsafe-eval' blob: data: http://localhost:* https://localhost:*\";\n const baseFrameSrc = \"* blob: data: http://localhost:* https://localhost:*\";\n const extra = extraCspDomains?.length ? ` ${extraCspDomains.join(\" \")}` : \"\";\n const scriptSrc = baseScriptSrc + extra;\n const frameSrc = baseFrameSrc + extra;\n\n return `<!doctype html>\n<html>\n<head>\n<meta charset=\"utf-8\" />\n<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self'; img-src * data: blob: 'unsafe-inline'; media-src * blob: data:; font-src * blob: data:; script-src ${scriptSrc}; style-src * blob: data: 'unsafe-inline'; connect-src *; frame-src ${frameSrc}; base-uri 'self';\" />\n<style>html,body{margin:0;padding:0;height:100%;width:100%;overflow:hidden}*{box-sizing:border-box}iframe{background-color:transparent;border:none;padding:0;overflow:hidden;width:100%;height:100%}</style>\n</head>\n<body>\n<script>\nif(window.self===window.top){throw new Error(\"This file must be used in an iframe.\")}\nconst inner=document.createElement(\"iframe\");\ninner.style=\"width:100%;height:100%;border:none;\";\ninner.setAttribute(\"sandbox\",\"allow-scripts allow-same-origin allow-forms\");\ndocument.body.appendChild(inner);\nwindow.addEventListener(\"message\",async(event)=>{\nif(event.source===window.parent){\nif(event.data&&event.data.method===\"ui/notifications/sandbox-resource-ready\"){\nconst{html,sandbox}=event.data.params;\nif(typeof sandbox===\"string\")inner.setAttribute(\"sandbox\",sandbox);\nif(typeof html===\"string\")inner.srcdoc=html;\n}else if(inner&&inner.contentWindow){\ninner.contentWindow.postMessage(event.data,\"*\");\n}\n}else if(event.source===inner.contentWindow){window.parent.postMessage(event.data,\"*\")}\n});\nwindow.parent.postMessage({jsonrpc:\"2.0\",method:\"ui/notifications/sandbox-proxy-ready\",params:{}},\"*\");\n</script>\n</body>\n</html>`;\n}\n","import type { AbstractAgent, ActivityMessage } from \"@ag-ui/client\";\nimport { ChangeDetectionStrategy, Component, input } from \"@angular/core\";\nimport type {\n ActivityRenderer,\n RenderActivityMessageConfig,\n} from \"@copilotkit/angular\";\nimport {\n mcpAppsSnapshotContentSchema,\n type MCPAppsSnapshotContent,\n} from \"./mcp-apps-content\";\nimport { CopilotMCPAppsWidget } from \"./mcp-apps-widget\";\n\n/**\n * Activity renderer for `mcp-apps` snapshots. Renders the referenced MCP App\n * inline via {@link CopilotMCPAppsWidget}. Resource and tool requests are\n * proxied through the activity's selected AG-UI agent.\n */\n@Component({\n selector: \"copilot-mcp-apps-activity-renderer\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [CopilotMCPAppsWidget],\n template: `\n <copilot-mcp-apps-widget [data]=\"content()\" [agent]=\"agent()\" />\n `,\n})\nexport class CopilotMCPAppsActivityRenderer implements ActivityRenderer<MCPAppsSnapshotContent> {\n readonly activityType = input.required<string>();\n readonly content = input.required<MCPAppsSnapshotContent>();\n readonly message = input.required<ActivityMessage>();\n readonly agent = input<AbstractAgent | undefined>();\n}\n\n/**\n * Ready-to-register render config for `mcp-apps` activity messages. Pass it\n * to `provideCopilotKit({ renderActivityMessages: [...] })`.\n */\nexport const mcpAppsActivityRendererConfig: RenderActivityMessageConfig<MCPAppsSnapshotContent> =\n {\n activityType: \"mcp-apps\",\n content: mcpAppsSnapshotContentSchema,\n component: CopilotMCPAppsActivityRenderer,\n };\n","import {\n makeEnvironmentProviders,\n type EnvironmentProviders,\n} from \"@angular/core\";\nimport { ɵCOPILOTKIT_BUILT_IN_ACTIVITY_RENDERERS } from \"@copilotkit/angular\";\nimport { mcpAppsActivityRendererConfig } from \"./mcp-apps-activity-renderer\";\nimport {\n DEFAULT_MCP_APPS_CONFIG,\n MCP_APPS_CONFIG,\n type MCPAppsConfig,\n type MCPAppsHostInfo,\n} from \"./mcp-apps-config\";\n\nexport type { MCPAppsConfig, MCPAppsHostInfo } from \"./mcp-apps-config\";\nexport { DEFAULT_MCP_APPS_CONFIG, MCP_APPS_CONFIG } from \"./mcp-apps-config\";\n\n/**\n * Configures and registers the built-in MCP Apps renderer.\n *\n * MCP resource and tool requests always travel through the selected AG-UI\n * agent. Server URLs deliberately are not accepted by this browser provider.\n * Application renderers retain precedence over this built-in registration.\n */\nexport function provideMCPApps(\n config: MCPAppsConfig = {},\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: MCP_APPS_CONFIG,\n useValue: {\n ...DEFAULT_MCP_APPS_CONFIG,\n ...config,\n hostInfo: {\n ...DEFAULT_MCP_APPS_CONFIG.hostInfo,\n ...config.hostInfo,\n },\n hostCapabilities: {\n ...DEFAULT_MCP_APPS_CONFIG.hostCapabilities,\n ...config.hostCapabilities,\n },\n hostContext: {\n ...DEFAULT_MCP_APPS_CONFIG.hostContext,\n ...config.hostContext,\n },\n } satisfies Required<MCPAppsConfig>,\n },\n {\n provide: ɵCOPILOTKIT_BUILT_IN_ACTIVITY_RENDERERS,\n multi: true,\n useValue: mcpAppsActivityRendererConfig,\n },\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["asError","ɵCOPILOTKIT_BUILT_IN_ACTIVITY_RENDERERS"],"mappings":";;;;;;;AAEA,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC;AACtC,IAAA,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;AAC3D,IAAA,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;AAC7C,IAAA,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;AACpC,CAAA,CAAC;AAEF,MAAM,YAAY,GAAG;AAClB,KAAA,MAAM;AACN,KAAA,MAAM,CACL,CAAC,KAAK,KACJ,KAAK,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC;AACtB,IAAA,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC;AACpC,IAAA,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAC/B,8BAA8B,CAC/B;AAEH,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC;IACrC,CAAC,CAAC,WAAW,CAAC;AACZ,QAAA,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;AACf,QAAA,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;AAC/B,QAAA,IAAI,EAAE,CAAC,CAAC,MAAM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gBAAA,QAAQ,EAAE;oBACR,GAAG,uBAAuB,CAAC,QAAQ;oBACnC,GAAG,MAAM,CAAC,QAAQ;AACnB,iBAAA;AACD,gBAAA,gBAAgB,EAAE;oBAChB,GAAG,uBAAuB,CAAC,gBAAgB;oBAC3C,GAAG,MAAM,CAAC,gBAAgB;AAC3B,iBAAA;AACD,gBAAA,WAAW,EAAE;oBACX,GAAG,uBAAuB,CAAC,WAAW;oBACtC,GAAG,MAAM,CAAC,WAAW;AACtB,iBAAA;AACgC,aAAA;AACpC,SAAA;AACD,QAAA;AACE,YAAA,OAAO,EAAEC,uCAAuC;AAChD,YAAA,KAAK,EAAE,IAAI;AACX,YAAA,QAAQ,EAAE,6BAA6B;AACxC,SAAA;AACF,KAAA,CAAC;AACJ;;ACpDA;;AAEG;;;;"}
1
+ {"version":3,"file":"copilotkit-angular-mcp-apps.mjs","sources":["../../src/mcp-apps/lib/mcp-apps-content.ts","../../src/mcp-apps/lib/mcp-apps-config.ts","../../src/mcp-apps/lib/mcp-apps-widget.ts","../../src/mcp-apps/lib/mcp-apps-activity-renderer.ts","../../src/mcp-apps/lib/provide-mcp-apps.ts","../../src/mcp-apps/copilotkit-angular-mcp-apps.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { MCPAppsActivityContentSchema } from \"@copilotkit/mcp-apps-renderer/activity\";\n\n/** Preserve the Angular export while sharing the runtime content contract. */\nexport const mcpAppsSnapshotContentSchema = MCPAppsActivityContentSchema;\nexport type MCPAppsSnapshotContent = z.output<\n typeof mcpAppsSnapshotContentSchema\n>;\n","import { InjectionToken } from \"@angular/core\";\n\nexport interface MCPAppsHostInfo {\n name: string;\n version: string;\n}\n\nexport interface MCPAppsConfig {\n /** Maximum time to wait for a busy agent before a queued request fails. */\n idleTimeoutMs?: number;\n /** Maximum time to wait for the sandbox proxy initialization handshake. */\n initializationTimeoutMs?: number;\n /** Host identity announced during the MCP Apps initialization handshake. */\n hostInfo?: MCPAppsHostInfo;\n /** Additional protocol capabilities announced to embedded MCP Apps. */\n hostCapabilities?: Record<string, unknown>;\n /** Additional non-secret UI context announced to embedded MCP Apps. */\n hostContext?: Record<string, unknown>;\n}\n\nexport const DEFAULT_MCP_APPS_CONFIG: Readonly<Required<MCPAppsConfig>> = {\n idleTimeoutMs: 30_000,\n initializationTimeoutMs: 30_000,\n hostInfo: {\n name: \"CopilotKit MCP Apps Host\",\n version: \"1.0.0\",\n },\n hostCapabilities: {\n openLinks: {},\n serverTools: {},\n logging: {},\n },\n hostContext: {\n platform: \"web\",\n },\n};\n\n/** Holds renderer behavior configuration registered via `provideMCPApps`. */\nexport const MCP_APPS_CONFIG = new InjectionToken<Required<MCPAppsConfig>>(\n \"MCP_APPS_CONFIG\",\n { factory: () => ({ ...DEFAULT_MCP_APPS_CONFIG }) },\n);\n","import { isPlatformBrowser } from \"@angular/common\";\nimport type { AbstractAgent } from \"@ag-ui/client\";\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n PLATFORM_ID,\n afterRenderEffect,\n computed,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n} from \"@angular/core\";\nimport { CopilotKit } from \"@copilotkit/angular\";\nimport type { McpAppSession } from \"@copilotkit/mcp-apps-renderer\";\nimport { type MCPAppsSnapshotContent } from \"./mcp-apps-content\";\nimport { MCP_APPS_CONFIG } from \"./mcp-apps-config\";\n\n/** Angular owns the DOM and reactive state; the shared session owns MCP. */\n@Component({\n selector: \"copilot-mcp-apps-widget\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <div class=\"copilot-mcp-apps-container\">\n @if (loading()) {\n <p class=\"copilot-mcp-apps-status\" role=\"status\" aria-live=\"polite\">\n Loading MCP App…\n </p>\n }\n @if (error() || contentError()) {\n <p class=\"copilot-mcp-apps-error\" role=\"alert\">\n {{ error() || contentError() }}\n </p>\n }\n <iframe\n #appFrame\n class=\"copilot-mcp-apps-frame\"\n data-testid=\"mcp-app-iframe\"\n title=\"Interactive MCP application\"\n ></iframe>\n </div>\n `,\n styles: `\n .copilot-mcp-apps-container {\n position: relative;\n width: 100%;\n min-height: 100px;\n overflow: hidden;\n }\n\n .copilot-mcp-apps-frame {\n display: block;\n width: 100%;\n min-height: 100px;\n border: 0;\n background: transparent;\n }\n\n .copilot-mcp-apps-status,\n .copilot-mcp-apps-error {\n margin: 0;\n padding: 16px;\n }\n\n .copilot-mcp-apps-status {\n color: #525252;\n }\n\n .copilot-mcp-apps-error {\n color: #991b1b;\n }\n `,\n})\nexport class CopilotMCPAppsWidget {\n private readonly config = inject(MCP_APPS_CONFIG);\n private readonly copilotKit = inject(CopilotKit);\n private readonly platformId = inject(PLATFORM_ID);\n private session: McpAppSession | undefined;\n\n readonly data = input.required<MCPAppsSnapshotContent>();\n readonly agent = input<AbstractAgent | undefined>();\n /** Omitted for direct widget use with external, prop-driven content. */\n readonly messageId = input<string>();\n\n private readonly identity = computed(\n () => {\n const { resourceUri, serverHash, serverId } = this.data();\n return { resourceUri, serverHash, serverId };\n },\n {\n equal: (a, b) =>\n a.resourceUri === b.resourceUri &&\n a.serverHash === b.serverHash &&\n a.serverId === b.serverId,\n },\n );\n\n private readonly appFrame =\n viewChild.required<ElementRef<HTMLIFrameElement>>(\"appFrame\");\n protected readonly loading = signal(true);\n protected readonly error = signal(\"\");\n protected readonly contentError = signal(\"\");\n\n constructor() {\n afterRenderEffect((onCleanup) => {\n this.identity();\n const agent = this.agent();\n const messageId = this.messageId();\n const frame = this.appFrame().nativeElement;\n let active = true;\n let session: McpAppSession | undefined;\n this.loading.set(true);\n this.error.set(\"\");\n this.contentError.set(\"\");\n frame.style.removeProperty(\"height\");\n frame.removeAttribute(\"src\");\n frame.removeAttribute(\"srcdoc\");\n frame.removeAttribute(\"data-mcp-app-initialized\");\n onCleanup(() => {\n active = false;\n session?.teardown();\n if (this.session === session) this.session = undefined;\n frame.removeAttribute(\"srcdoc\");\n frame.removeAttribute(\"src\");\n frame.removeAttribute(\"data-mcp-app-initialized\");\n });\n if (!isPlatformBrowser(this.platformId)) {\n this.loading.set(false);\n return;\n }\n if (!agent) {\n this.loading.set(false);\n this.error.set(\"No agent is available to load this MCP App.\");\n return;\n }\n const fail = (error: Error) => {\n if (!active) return;\n this.loading.set(false);\n this.error.set(error.message);\n session?.teardown();\n frame.removeAttribute(\"srcdoc\");\n frame.removeAttribute(\"data-mcp-app-initialized\");\n };\n // Cleanup is registered before importing, so an obsolete bind never starts.\n void import(\"@copilotkit/mcp-apps-renderer\")\n .catch((importErr: unknown) => {\n // Name the packages and the fix: the raw module-resolution error\n // (\"Failed to fetch dynamically imported module...\") tells a user\n // nothing about what to install. Same message as React and Vue.\n throw new Error(\n \"MCP Apps require '@copilotkit/mcp-apps-renderer' and its \" +\n \"'@modelcontextprotocol/ext-apps' dependency. Reinstall your \" +\n \"dependencies if this package is missing.\",\n { cause: importErr },\n );\n })\n .then((mcp) => {\n if (!active) return;\n session = mcp.bindMcpApp({\n iframe: frame,\n getContent: () => untracked(this.data),\n getAgent: () => agent,\n messageId,\n host: this.copilotKit.core,\n options: this.config,\n cancelFollowUpsOnTeardown: true,\n requireExactResourceUri: true,\n cancelRunningWaitOnTeardown: true,\n hooks: {\n onSandboxReady: () => {\n if (active) this.loading.set(false);\n },\n onInitialized: () => {\n if (!active) return;\n this.loading.set(false);\n frame.setAttribute(\"data-mcp-app-initialized\", \"true\");\n },\n onSizeChanged: ({ height }) => {\n if (\n active &&\n typeof height === \"number\" &&\n Number.isFinite(height) &&\n height > 0\n ) {\n frame.style.height = `${Math.ceil(Math.min(height, 5000))}px`;\n }\n },\n onError: fail,\n onContentError: (err) => {\n if (active) this.contentError.set(err?.message ?? \"\");\n },\n onFollowUpError: fail,\n },\n });\n this.session = session;\n session.syncContent(untracked(this.data));\n })\n .catch(fail);\n });\n // Content updates feed the existing session and never reload its iframe.\n afterRenderEffect(() => {\n const data = this.data();\n untracked(() => this.session?.syncContent(data));\n });\n }\n}\n","import type { AbstractAgent, ActivityMessage } from \"@ag-ui/client\";\nimport { ChangeDetectionStrategy, Component, input } from \"@angular/core\";\nimport type {\n ActivityRenderer,\n RenderActivityMessageConfig,\n} from \"@copilotkit/angular\";\nimport {\n mcpAppsSnapshotContentSchema,\n type MCPAppsSnapshotContent,\n} from \"./mcp-apps-content\";\nimport { CopilotMCPAppsWidget } from \"./mcp-apps-widget\";\n\n/**\n * Activity renderer for `mcp-apps` snapshots. Renders the referenced MCP App\n * inline via {@link CopilotMCPAppsWidget}. Resource and tool requests are\n * proxied through the activity's selected AG-UI agent.\n */\n@Component({\n selector: \"copilot-mcp-apps-activity-renderer\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [CopilotMCPAppsWidget],\n template: `\n <copilot-mcp-apps-widget\n [data]=\"content()\"\n [agent]=\"agent()\"\n [messageId]=\"message().id\"\n />\n `,\n})\nexport class CopilotMCPAppsActivityRenderer implements ActivityRenderer<MCPAppsSnapshotContent> {\n readonly activityType = input.required<string>();\n readonly content = input.required<MCPAppsSnapshotContent>();\n readonly message = input.required<ActivityMessage>();\n readonly agent = input<AbstractAgent | undefined>();\n}\n\n/**\n * Ready-to-register render config for `mcp-apps` activity messages. Pass it\n * to `provideCopilotKit({ renderActivityMessages: [...] })`.\n */\nexport const mcpAppsActivityRendererConfig: RenderActivityMessageConfig<MCPAppsSnapshotContent> =\n {\n activityType: \"mcp-apps\",\n content: mcpAppsSnapshotContentSchema,\n component: CopilotMCPAppsActivityRenderer,\n };\n","import {\n makeEnvironmentProviders,\n type EnvironmentProviders,\n} from \"@angular/core\";\nimport { ɵCOPILOTKIT_BUILT_IN_ACTIVITY_RENDERERS } from \"@copilotkit/angular\";\nimport { mcpAppsActivityRendererConfig } from \"./mcp-apps-activity-renderer\";\nimport {\n DEFAULT_MCP_APPS_CONFIG,\n MCP_APPS_CONFIG,\n type MCPAppsConfig,\n type MCPAppsHostInfo,\n} from \"./mcp-apps-config\";\n\nexport type { MCPAppsConfig, MCPAppsHostInfo } from \"./mcp-apps-config\";\nexport { DEFAULT_MCP_APPS_CONFIG, MCP_APPS_CONFIG } from \"./mcp-apps-config\";\n\n/**\n * Configures and registers the built-in MCP Apps renderer.\n *\n * MCP resource and tool requests always travel through the selected AG-UI\n * agent. Server URLs deliberately are not accepted by this browser provider.\n * Application renderers retain precedence over this built-in registration.\n */\nexport function provideMCPApps(\n config: MCPAppsConfig = {},\n): EnvironmentProviders {\n const idleTimeoutMs =\n config.idleTimeoutMs ?? DEFAULT_MCP_APPS_CONFIG.idleTimeoutMs;\n if (!Number.isFinite(idleTimeoutMs) || idleTimeoutMs <= 0) {\n throw new RangeError(\"idleTimeoutMs must be a positive finite number.\");\n }\n return makeEnvironmentProviders([\n {\n provide: MCP_APPS_CONFIG,\n useValue: {\n ...DEFAULT_MCP_APPS_CONFIG,\n ...config,\n hostInfo: {\n ...DEFAULT_MCP_APPS_CONFIG.hostInfo,\n ...config.hostInfo,\n },\n hostCapabilities: {\n ...DEFAULT_MCP_APPS_CONFIG.hostCapabilities,\n ...config.hostCapabilities,\n },\n hostContext: {\n ...DEFAULT_MCP_APPS_CONFIG.hostContext,\n ...config.hostContext,\n },\n } satisfies Required<MCPAppsConfig>,\n },\n {\n provide: ɵCOPILOTKIT_BUILT_IN_ACTIVITY_RENDERERS,\n multi: true,\n useValue: mcpAppsActivityRendererConfig,\n },\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵCOPILOTKIT_BUILT_IN_ACTIVITY_RENDERERS"],"mappings":";;;;;;AAGA;AACO,MAAM,4BAA4B,GAAG;;ACgBrC,MAAM,uBAAuB,GAAsC;AACxE,IAAA,aAAa,EAAE,MAAM;AACrB,IAAA,uBAAuB,EAAE,MAAM;AAC/B,IAAA,QAAQ,EAAE;AACR,QAAA,IAAI,EAAE,0BAA0B;AAChC,QAAA,OAAO,EAAE,OAAO;AACjB,KAAA;AACD,IAAA,gBAAgB,EAAE;AAChB,QAAA,SAAS,EAAE,EAAE;AACb,QAAA,WAAW,EAAE,EAAE;AACf,QAAA,OAAO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