@copilotkit/vue 1.57.3 → 1.58.0-canary.thread-id-propagation
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{use-render-activity-message-BCoXRqzE.js → use-render-activity-message-CE0GKV5B.js} +2 -2
- package/dist/use-render-activity-message-CE0GKV5B.js.map +1 -0
- package/dist/{use-render-activity-message-BRL1Rpl-.cjs → use-render-activity-message-D7Ve-ASg.cjs} +2 -2
- package/dist/use-render-activity-message-D7Ve-ASg.cjs.map +1 -0
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +1 -1
- package/package.json +4 -4
- package/src/v2/components/MCPAppsActivityRenderer.ts +1 -1
- package/dist/use-render-activity-message-BCoXRqzE.js.map +0 -1
- package/dist/use-render-activity-message-BRL1Rpl-.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-render-activity-message-D7Ve-ASg.cjs","sources":["../src/v2/components/CopilotKitInspector.vue","../src/v2/providers/keys.ts","../src/v2/providers/useCopilotKit.ts","../src/v2/components/MCPAppsActivityRenderer.ts","../src/v2/components/a2ui.ts","../src/v2/lib/vue-core.ts","../src/v2/components/A2UIMessageRenderer.ts","../src/v2/types/defineToolCallRenderer.ts","../src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts","../src/v2/components/a2ui/adapter.ts","../src/v2/components/a2ui/utils.ts","../src/v2/components/a2ui/catalog.ts","../src/v2/components/a2ui/A2UICatalogContext.ts","../src/v2/lib/processPartialHtml.ts","../src/v2/providers/SandboxFunctionsContext.ts","../src/v2/components/OpenGenerativeUIRenderer.ts","../src/v2/providers/license-context.ts","../src/v2/components/LicenseWarningBanner.vue","../src/v2/providers/CopilotKitProvider.vue","../src/v2/providers/types.ts","../src/v2/lib/shallow-stable.ts","../src/v2/providers/CopilotChatConfigurationProvider.vue","../src/v2/providers/useLicenseContext.ts","../src/v2/providers/useCopilotChatConfiguration.ts","../src/v2/components/a2ui/VueSurface.ts","../src/v2/components/A2UISurfaceActivityRenderer.vue","../src/v2/components/chat/CopilotChatToolCallsView.vue","../src/v2/hooks/use-katex-styles.ts","../src/v2/components/chat/CopilotChatAssistantMessage.vue","../src/v2/components/chat/audioRecorder.ts","../src/v2/components/chat/CopilotChatAudioRecorder.vue","../src/v2/components/InlineFeatureWarning.vue","../src/v2/hooks/use-agent.ts","../src/v2/hooks/use-suggestions.ts","../src/v2/hooks/use-attachments.ts","../src/v2/lib/transcription-client.ts","../src/v2/hooks/use-keyboard-height.ts","../src/v2/components/chat/last-user-message-context.ts","../src/v2/hooks/use-pin-to-send.ts","../src/v2/components/chat/CopilotChatInput.vue","../src/v2/components/chat/CopilotChatAttachmentQueue.vue","../src/v2/components/chat/CopilotChatReasoningMessage.vue","../src/v2/components/chat/CopilotChatUserMessage.vue","../src/v2/components/chat/CopilotChatMessageView.vue","../src/v2/components/chat/CopilotChatSuggestionPill.vue","../src/v2/components/chat/CopilotChatSuggestionView.vue","../src/v2/components/chat/normalize-auto-scroll.ts","../src/v2/components/chat/CopilotChatView.vue","../src/v2/components/chat/CopilotChat.vue","../src/v2/components/chat/CopilotChatAttachmentRenderer.vue","../src/v2/components/chat/CopilotChatToggleButtonCloseIcon.ts","../src/v2/components/chat/CopilotChatToggleButtonOpenIcon.ts","../src/v2/components/chat/CopilotChatToggleButton.vue","../src/v2/components/chat/CopilotModalHeaderCloseButton.ts","../src/v2/components/chat/CopilotModalHeaderTitle.ts","../src/v2/components/chat/CopilotModalHeader.vue","../src/v2/components/chat/CopilotPopupViewInternal.vue","../src/v2/components/chat/CopilotPopupView.vue","../src/v2/components/chat/CopilotPopupWelcomeScreen.vue","../src/v2/components/chat/CopilotSidebarViewInternal.vue","../src/v2/components/chat/CopilotSidebarView.vue","../src/v2/components/chat/CopilotSidebarWelcomeScreen.vue","../src/v2/components/chat/CopilotPopup.vue","../src/v2/components/chat/CopilotSidebar.vue","../src/v2/components/chat/index.ts","../src/v2/hooks/use-agent-context.ts","../src/v2/hooks/use-frontend-tool.ts","../src/v2/hooks/use-component.ts","../src/v2/hooks/use-render-tool.ts","../src/v2/hooks/use-default-render-tool.ts","../src/v2/hooks/use-human-in-the-loop.ts","../src/v2/hooks/use-configure-suggestions.ts","../src/v2/hooks/use-interrupt.ts","../src/v2/hooks/use-threads.ts","../src/v2/hooks/use-capabilities.ts","../src/v2/hooks/use-render-custom-messages.ts","../src/v2/hooks/use-render-activity-message.ts"],"sourcesContent":["<script setup lang=\"ts\">\ndefineOptions({\n inheritAttrs: false,\n});\n\nimport { onMounted, onUnmounted, shallowRef, useAttrs } from \"vue\";\nimport type { CopilotKitCoreVue } from \"../lib/vue-core\";\n\nconst props = defineProps<{\n core?: CopilotKitCoreVue | null;\n}>();\n\nconst attrs = useAttrs();\nconst inspectorTag = shallowRef<string | null>(null);\n\nlet isMounted = true;\n\nonMounted(() => {\n void import(\"@copilotkit/web-inspector\")\n .then((mod) => {\n mod.defineWebInspector?.();\n if (!isMounted) return;\n inspectorTag.value = mod.WEB_INSPECTOR_TAG;\n })\n .catch((error: unknown) => {\n console.error(\"Failed to load CopilotKit inspector:\", error);\n });\n});\n\nonUnmounted(() => {\n isMounted = false;\n});\n</script>\n\n<template>\n <component\n :is=\"inspectorTag\"\n v-if=\"inspectorTag\"\n v-bind=\"attrs\"\n :core.prop=\"props.core ?? null\"\n />\n</template>\n","import type { ComputedRef, InjectionKey, Ref, ShallowRef } from \"vue\";\nimport type { CopilotKitCoreVue } from \"../lib/vue-core\";\nimport type { CopilotChatConfigurationValue } from \"./types\";\nimport type { A2UITheme } from \"../types\";\nimport type { SandboxFunction } from \"../types\";\n\nexport interface CopilotKitContextValue {\n copilotkit: ShallowRef<CopilotKitCoreVue>;\n executingToolCallIds: Ref<ReadonlySet<string>>;\n a2uiTheme: ComputedRef<A2UITheme | undefined>;\n a2uiCatalog: ComputedRef<unknown>;\n a2uiLoadingComponent: ComputedRef<unknown>;\n a2uiIncludeSchema: ComputedRef<boolean>;\n}\n\nexport const CopilotKitKey: InjectionKey<CopilotKitContextValue> =\n Symbol(\"CopilotKit\");\n\nexport const CopilotChatConfigurationKey: InjectionKey<\n ComputedRef<CopilotChatConfigurationValue>\n> = Symbol(\"CopilotChatConfiguration\");\n\nexport const SandboxFunctionsKey: InjectionKey<\n Ref<readonly SandboxFunction[]>\n> = Symbol(\"SandboxFunctions\");\n","import { inject } from \"vue\";\nimport { CopilotKitKey } from \"./keys\";\n\nexport function useCopilotKit() {\n const context = inject(CopilotKitKey);\n if (!context) {\n throw new Error(\"useCopilotKit must be used within CopilotKitProvider\");\n }\n\n return context;\n}\n","import { computed, defineComponent, h, onBeforeUnmount, ref, watch } from \"vue\";\nimport type { PropType } from \"vue\";\nimport { z } from \"zod\";\nimport type { AbstractAgent, RunAgentResult } from \"@ag-ui/client\";\nimport { randomUUID } from \"@copilotkit/shared\";\nimport type { VueActivityMessageRendererProps } from \"../types\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\n\nconst PROTOCOL_VERSION = \"2025-06-18\";\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){\nwindow.parent.postMessage(event.data,\"*\");\n}\n});\nwindow.parent.postMessage({jsonrpc:\"2.0\",method:\"ui/notifications/sandbox-proxy-ready\",params:{}},\"*\");\n</script>\n</body>\n</html>`;\n}\n\nclass MCPAppsRequestQueue {\n private queues = new Map<\n string,\n Array<{\n execute: () => Promise<RunAgentResult>;\n resolve: (result: RunAgentResult) => void;\n reject: (error: Error) => void;\n }>\n >();\n\n private processing = new Map<string, boolean>();\n\n async enqueue(\n agent: AbstractAgent,\n request: () => Promise<RunAgentResult>,\n ): Promise<RunAgentResult> {\n const threadId = agent.threadId || \"default\";\n\n return new Promise((resolve, reject) => {\n let queue = this.queues.get(threadId);\n if (!queue) {\n queue = [];\n this.queues.set(threadId, queue);\n }\n\n queue.push({ execute: request, resolve, reject });\n void this.processQueue(threadId, agent);\n });\n }\n\n private async processQueue(\n threadId: string,\n agent: AbstractAgent,\n ): Promise<void> {\n if (this.processing.get(threadId)) {\n return;\n }\n\n this.processing.set(threadId, true);\n try {\n const queue = this.queues.get(threadId);\n if (!queue) return;\n\n while (queue.length > 0) {\n const item = queue[0]!;\n try {\n await this.waitForAgentIdle(agent);\n const result = await item.execute();\n item.resolve(result);\n } catch (error) {\n item.reject(\n error instanceof Error ? error : new Error(String(error)),\n );\n }\n queue.shift();\n }\n } finally {\n this.processing.set(threadId, false);\n }\n }\n\n cancel(threadId: string): void {\n const queue = this.queues.get(threadId);\n if (queue) {\n for (const item of queue) {\n item.reject(new Error(\"MCPAppsRequestQueue cancelled on unmount\"));\n }\n queue.length = 0;\n }\n this.queues.delete(threadId);\n this.processing.delete(threadId);\n }\n\n private waitForAgentIdle(agent: AbstractAgent): Promise<void> {\n return new Promise((resolve, reject) => {\n if (!agent.isRunning) {\n resolve();\n return;\n }\n\n let done = false;\n\n const timeout = setTimeout(() => {\n if (done) return;\n done = true;\n clearInterval(checkInterval);\n sub.unsubscribe();\n reject(\n new Error(\"[CopilotKit] Timed out waiting for agent to become idle\"),\n );\n }, 30_000);\n\n const finish = () => {\n if (done) return;\n done = true;\n clearTimeout(timeout);\n clearInterval(checkInterval);\n sub.unsubscribe();\n resolve();\n };\n\n const sub = agent.subscribe({\n onRunFinalized: finish,\n onRunFailed: finish,\n });\n\n const checkInterval = setInterval(() => {\n if (!agent.isRunning) {\n finish();\n }\n }, 500);\n });\n }\n}\n\nconst mcpAppsRequestQueue = new MCPAppsRequestQueue();\n\nexport const MCPAppsActivityType = \"mcp-apps\";\n\nexport const MCPAppsActivityContentSchema = z.object({\n result: z.object({\n content: z.array(z.any()).optional(),\n structuredContent: z.any().optional(),\n isError: z.boolean().optional(),\n }),\n resourceUri: z.string(),\n serverHash: z.string(),\n serverId: z.string().optional(),\n toolInput: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport type MCPAppsActivityContent = z.infer<\n typeof MCPAppsActivityContentSchema\n>;\n\ninterface FetchedResource {\n uri: string;\n mimeType?: string;\n text?: string;\n blob?: string;\n _meta?: {\n ui?: {\n prefersBorder?: boolean;\n csp?: {\n connectDomains?: string[];\n resourceDomains?: string[];\n };\n };\n };\n}\n\ninterface JSONRPCRequest {\n jsonrpc: \"2.0\";\n id: string | number;\n method: string;\n params?: Record<string, unknown>;\n}\n\ninterface JSONRPCResponse {\n jsonrpc: \"2.0\";\n id: string | number;\n result?: unknown;\n error?: { code: number; message: string };\n}\n\ninterface JSONRPCNotification {\n jsonrpc: \"2.0\";\n method: string;\n params?: Record<string, unknown>;\n}\n\ntype JSONRPCMessage = JSONRPCRequest | JSONRPCResponse | JSONRPCNotification;\n\nfunction isRequest(message: JSONRPCMessage): message is JSONRPCRequest {\n return \"id\" in message && \"method\" in message;\n}\n\nfunction isNotification(\n message: JSONRPCMessage,\n): message is JSONRPCNotification {\n return !(\"id\" in message) && \"method\" in message;\n}\n\nexport const MCPAppsActivityRenderer = defineComponent({\n name: \"MCPAppsActivityRenderer\",\n props: {\n activityType: {\n type: String,\n required: true,\n },\n content: {\n type: Object as PropType<MCPAppsActivityContent>,\n required: true,\n },\n message: {\n type: Object as PropType<\n VueActivityMessageRendererProps<MCPAppsActivityContent>[\"message\"]\n >,\n required: true,\n },\n agent: {\n type: Object as PropType<AbstractAgent | undefined>,\n required: false,\n default: undefined,\n },\n },\n setup(props) {\n const { copilotkit } = useCopilotKit();\n const containerRef = ref<HTMLDivElement | null>(null);\n const iframeRef = ref<HTMLIFrameElement | null>(null);\n const iframeReady = ref(false);\n const error = ref<Error | null>(null);\n const isLoading = ref(true);\n const iframeSize = ref<{ width?: number; height?: number }>({});\n const fetchedResource = ref<FetchedResource | null>(null);\n\n const fetchStateRef = ref<{\n inProgress: boolean;\n promise: Promise<FetchedResource | null> | null;\n resourceUri: string | null;\n }>({\n inProgress: false,\n promise: null,\n resourceUri: null,\n });\n\n const sendToIframe = (message: JSONRPCMessage) => {\n if (iframeRef.value?.contentWindow) {\n iframeRef.value.contentWindow.postMessage(message, \"*\");\n }\n };\n\n const sendResponse = (id: string | number, result: unknown) => {\n sendToIframe({\n jsonrpc: \"2.0\",\n id,\n result,\n });\n };\n\n const sendErrorResponse = (\n id: string | number,\n code: number,\n message: string,\n ) => {\n sendToIframe({\n jsonrpc: \"2.0\",\n id,\n error: { code, message },\n });\n };\n\n const sendNotification = (\n method: string,\n params?: Record<string, unknown>,\n ) => {\n sendToIframe({\n jsonrpc: \"2.0\",\n method,\n params: params || {},\n });\n };\n\n watch(\n [() => props.agent, () => props.content],\n ([agent, content]) => {\n isLoading.value = true;\n error.value = null;\n iframeReady.value = false;\n iframeSize.value = {};\n fetchedResource.value = null;\n\n const { resourceUri, serverHash, serverId } = content;\n\n if (\n fetchStateRef.value.inProgress &&\n fetchStateRef.value.resourceUri === resourceUri\n ) {\n void fetchStateRef.value.promise\n ?.then((resource) => {\n if (resource) {\n fetchedResource.value = resource;\n isLoading.value = false;\n }\n })\n .catch((err: unknown) => {\n error.value = err instanceof Error ? err : new Error(String(err));\n isLoading.value = false;\n });\n return;\n }\n\n if (!agent) {\n error.value = new Error(\"No agent available to fetch resource\");\n isLoading.value = false;\n return;\n }\n\n fetchStateRef.value.inProgress = true;\n fetchStateRef.value.resourceUri = resourceUri;\n\n const fetchPromise = (async (): Promise<FetchedResource | null> => {\n try {\n const runResult = await mcpAppsRequestQueue.enqueue(agent, () =>\n agent.runAgent({\n forwardedProps: {\n __proxiedMCPRequest: {\n serverHash,\n serverId,\n method: \"resources/read\",\n params: { uri: resourceUri },\n },\n },\n }),\n );\n\n const resultData = runResult.result as\n | { contents?: FetchedResource[] }\n | undefined;\n const resource = resultData?.contents?.[0];\n\n if (!resource) {\n throw new Error(\"No resource content in response\");\n }\n\n return resource;\n } finally {\n fetchStateRef.value.inProgress = false;\n }\n })();\n\n fetchStateRef.value.promise = fetchPromise;\n\n void fetchPromise\n .then((resource) => {\n if (resource) {\n fetchedResource.value = resource;\n isLoading.value = false;\n }\n })\n .catch((err: unknown) => {\n error.value = err instanceof Error ? err : new Error(String(err));\n isLoading.value = false;\n });\n },\n { immediate: true },\n );\n\n watch(\n [isLoading, fetchedResource],\n ([loading, resource], _old, onCleanup) => {\n if (loading || !resource) {\n return;\n }\n\n const container = containerRef.value;\n if (!container) {\n return;\n }\n\n let mounted = true;\n let messageHandler: ((event: MessageEvent) => void) | null = null;\n let initialListener: ((event: MessageEvent) => void) | null = null;\n let createdIframe: HTMLIFrameElement | null = null;\n\n const setup = async () => {\n try {\n const iframe = document.createElement(\"iframe\");\n createdIframe = iframe;\n iframe.style.width = \"100%\";\n iframe.style.height = \"100px\";\n iframe.style.border = \"none\";\n iframe.style.backgroundColor = \"transparent\";\n iframe.style.display = \"block\";\n iframe.setAttribute(\n \"sandbox\",\n \"allow-scripts allow-same-origin allow-forms\",\n );\n\n const sandboxReady = new Promise<void>((resolve) => {\n initialListener = (event: MessageEvent) => {\n if (\n event.source === iframe.contentWindow &&\n event.data?.method === \"ui/notifications/sandbox-proxy-ready\"\n ) {\n if (initialListener) {\n window.removeEventListener(\"message\", initialListener);\n initialListener = null;\n }\n resolve();\n }\n };\n window.addEventListener(\"message\", initialListener);\n });\n\n if (!mounted) {\n if (initialListener) {\n window.removeEventListener(\"message\", initialListener);\n initialListener = null;\n }\n return;\n }\n\n const cspDomains =\n fetchedResource.value?._meta?.ui?.csp?.resourceDomains;\n iframe.srcdoc = buildSandboxHTML(cspDomains);\n iframeRef.value = iframe;\n container.appendChild(iframe);\n\n await sandboxReady;\n if (!mounted) return;\n\n messageHandler = async (event: MessageEvent) => {\n if (event.source !== iframe.contentWindow) return;\n\n const msg = event.data as JSONRPCMessage;\n if (!msg || typeof msg !== \"object\" || msg.jsonrpc !== \"2.0\") {\n return;\n }\n\n if (isRequest(msg)) {\n switch (msg.method) {\n case \"ui/initialize\": {\n sendResponse(msg.id, {\n protocolVersion: PROTOCOL_VERSION,\n hostInfo: {\n name: \"CopilotKit MCP Apps Host\",\n version: \"1.0.0\",\n },\n hostCapabilities: {\n openLinks: {},\n logging: {},\n },\n hostContext: {\n theme: \"light\",\n platform: \"web\",\n },\n });\n break;\n }\n\n case \"ui/message\": {\n const currentAgent = props.agent;\n if (!currentAgent) {\n sendResponse(msg.id, { isError: false });\n break;\n }\n\n try {\n const params = msg.params as\n | {\n role?: string;\n content?: Array<{ type: string; text?: string }>;\n followUp?: boolean;\n }\n | undefined;\n\n const role =\n (params?.role as \"user\" | \"assistant\") || \"user\";\n const textContent =\n params?.content\n ?.filter((part) => part.type === \"text\" && part.text)\n .map((part) => part.text)\n .join(\"\\n\") || \"\";\n\n if (textContent) {\n currentAgent.addMessage({\n id: randomUUID(),\n role,\n content: textContent,\n });\n }\n\n sendResponse(msg.id, { isError: false });\n\n const shouldFollowUp =\n params?.followUp ?? role === \"user\";\n if (shouldFollowUp && textContent) {\n void mcpAppsRequestQueue\n .enqueue(currentAgent, () =>\n copilotkit.value.runAgent({ agent: currentAgent }),\n )\n .catch((err) => {\n console.error(\n \"[MCPAppsRenderer] ui/message agent run failed:\",\n err,\n );\n });\n }\n } catch (err) {\n console.error(\n \"[CopilotKit] MCPApps ui/message handler error:\",\n err,\n );\n sendResponse(msg.id, { isError: true });\n }\n break;\n }\n\n case \"ui/open-link\": {\n const url = msg.params?.url as string | undefined;\n if (!url) {\n sendErrorResponse(\n msg.id,\n -32602,\n \"Missing url parameter\",\n );\n break;\n }\n window.open(url, \"_blank\", \"noopener,noreferrer\");\n sendResponse(msg.id, { isError: false });\n break;\n }\n\n case \"tools/call\": {\n const { serverHash, serverId } = props.content;\n const currentAgent = props.agent;\n\n if (!serverHash) {\n sendErrorResponse(\n msg.id,\n -32603,\n \"No server hash available for proxying\",\n );\n break;\n }\n if (!currentAgent) {\n sendErrorResponse(\n msg.id,\n -32603,\n \"No agent available for proxying\",\n );\n break;\n }\n\n try {\n const runResult = await mcpAppsRequestQueue.enqueue(\n currentAgent,\n () =>\n currentAgent.runAgent({\n forwardedProps: {\n __proxiedMCPRequest: {\n serverHash,\n serverId,\n method: \"tools/call\",\n params: msg.params,\n },\n },\n }),\n );\n sendResponse(msg.id, runResult.result || {});\n } catch (err) {\n sendErrorResponse(msg.id, -32603, String(err));\n }\n break;\n }\n\n default: {\n sendErrorResponse(\n msg.id,\n -32601,\n `Method not found: ${msg.method}`,\n );\n }\n }\n }\n\n if (isNotification(msg)) {\n switch (msg.method) {\n case \"ui/notifications/initialized\":\n if (mounted) {\n iframeReady.value = true;\n }\n break;\n\n case \"ui/notifications/size-changed\": {\n const { width, height } = msg.params || {};\n if (mounted) {\n iframeSize.value = {\n width: typeof width === \"number\" ? width : undefined,\n height: typeof height === \"number\" ? height : undefined,\n };\n }\n break;\n }\n }\n }\n };\n\n window.addEventListener(\"message\", messageHandler);\n\n const html = resource.text\n ? resource.text\n : resource.blob\n ? atob(resource.blob)\n : null;\n\n if (!html) {\n throw new Error(\"Resource has no text or blob content\");\n }\n\n sendNotification(\"ui/notifications/sandbox-resource-ready\", {\n html,\n });\n } catch (err) {\n if (mounted) {\n error.value = err instanceof Error ? err : new Error(String(err));\n }\n }\n };\n\n void setup();\n\n onCleanup(() => {\n mounted = false;\n if (initialListener) {\n window.removeEventListener(\"message\", initialListener);\n initialListener = null;\n }\n if (messageHandler) {\n window.removeEventListener(\"message\", messageHandler);\n }\n if (createdIframe) {\n createdIframe.remove();\n createdIframe = null;\n }\n iframeRef.value = null;\n });\n },\n { flush: \"post\" },\n );\n\n watch(\n iframeSize,\n (size) => {\n if (!iframeRef.value) return;\n if (size.width !== undefined) {\n iframeRef.value.style.minWidth = `min(${size.width}px, 100%)`;\n iframeRef.value.style.width = \"100%\";\n }\n if (size.height !== undefined) {\n iframeRef.value.style.height = `${size.height}px`;\n }\n },\n { deep: true },\n );\n\n watch(\n [iframeReady, () => props.content.toolInput],\n ([ready, toolInput]) => {\n if (ready && toolInput) {\n sendNotification(\"ui/notifications/tool-input\", {\n arguments: toolInput,\n });\n }\n },\n { deep: true },\n );\n\n watch(\n [iframeReady, () => props.content.result],\n ([ready, result]) => {\n if (ready && result) {\n sendNotification(\n \"ui/notifications/tool-result\",\n result as Record<string, unknown>,\n );\n }\n },\n { deep: true },\n );\n\n const borderStyle = computed(() => {\n const prefersBorder = fetchedResource.value?._meta?.ui?.prefersBorder;\n if (prefersBorder !== true) return {};\n return {\n borderRadius: \"8px\",\n backgroundColor: \"#f9f9f9\",\n border: \"1px solid #e0e0e0\",\n };\n });\n\n onBeforeUnmount(() => {\n const threadId = props.agent?.threadId || \"default\";\n mcpAppsRequestQueue.cancel(threadId);\n });\n\n return () =>\n h(\n \"div\",\n {\n ref: containerRef,\n style: {\n width: \"100%\",\n height:\n iframeSize.value.height !== undefined\n ? `${iframeSize.value.height}px`\n : \"auto\",\n minHeight: \"100px\",\n overflow: \"hidden\",\n position: \"relative\",\n ...borderStyle.value,\n },\n },\n [\n isLoading.value\n ? h(\n \"div\",\n { style: { padding: \"1rem\", color: \"#666\" } },\n \"Loading...\",\n )\n : null,\n error.value\n ? h(\n \"div\",\n { style: { color: \"red\", padding: \"1rem\" } },\n `Error: ${error.value.message}`,\n )\n : null,\n ],\n );\n },\n});\n\nexport default MCPAppsActivityRenderer;\n","import { z } from \"zod\";\n\nexport type A2UIOperation = Record<string, unknown>;\n\nexport const A2UISurfaceActivityType = \"a2ui-surface\";\n\nexport const A2UIActivityContentSchema = z.object({\n operations: z.array(z.record(z.string(), z.unknown())),\n});\n\nexport function getOperationSurfaceId(operation: A2UIOperation): string {\n const surfaceId =\n (operation.surfaceId as string | undefined) ??\n ((operation.beginRendering as { surfaceId?: string } | undefined)\n ?.surfaceId as string | undefined) ??\n ((operation.surfaceUpdate as { surfaceId?: string } | undefined)\n ?.surfaceId as string | undefined) ??\n ((operation.dataModelUpdate as { surfaceId?: string } | undefined)\n ?.surfaceId as string | undefined) ??\n ((operation.deleteSurface as { surfaceId?: string } | undefined)\n ?.surfaceId as string | undefined) ??\n ((operation.createSurface as { surfaceId?: string } | undefined)\n ?.surfaceId as string | undefined) ??\n ((operation.updateComponents as { surfaceId?: string } | undefined)\n ?.surfaceId as string | undefined) ??\n ((operation.updateDataModel as { surfaceId?: string } | undefined)\n ?.surfaceId as string | undefined);\n\n return surfaceId ?? \"default\";\n}\n","import { nextTick } from \"vue\";\nimport type {\n VueActivityMessageRenderer,\n VueToolCallRenderer,\n VueCustomMessageRenderer,\n} from \"../types\";\nimport type { InterruptRenderProps } from \"../types/interrupt\";\nimport { CopilotKitCore } from \"@copilotkit/core\";\nimport type {\n CopilotKitCoreConfig,\n CopilotKitCoreSubscriber,\n CopilotKitCoreSubscription,\n} from \"@copilotkit/core\";\n\nexport interface CopilotKitCoreVueConfig extends CopilotKitCoreConfig {\n renderToolCalls?: VueToolCallRenderer<unknown>[];\n renderActivityMessages?: VueActivityMessageRenderer<unknown>[];\n renderCustomMessages?: VueCustomMessageRenderer[];\n}\n\nexport interface CopilotKitCoreVueSubscriber extends CopilotKitCoreSubscriber {\n onRenderToolCallsChanged?: (event: {\n copilotkit: CopilotKitCoreVue;\n renderToolCalls: VueToolCallRenderer<unknown>[];\n }) => void | Promise<void>;\n onRenderCustomMessagesChanged?: (event: {\n copilotkit: CopilotKitCoreVue;\n renderCustomMessages: VueCustomMessageRenderer[];\n }) => void | Promise<void>;\n onInterruptStateChanged?: (event: {\n copilotkit: CopilotKitCoreVue;\n interruptState: InterruptRenderProps<unknown, unknown> | null;\n }) => void | Promise<void>;\n}\n\nexport class CopilotKitCoreVue extends CopilotKitCore {\n private _renderToolCalls: VueToolCallRenderer<unknown>[] = [];\n private _hookRenderToolCalls: Map<string, VueToolCallRenderer<unknown>> =\n new Map();\n private _cachedMergedRenderToolCalls: VueToolCallRenderer<unknown>[] | null =\n null;\n private _renderCustomMessages: VueCustomMessageRenderer[] = [];\n private _renderActivityMessages: VueActivityMessageRenderer<unknown>[] = [];\n private _interruptState: InterruptRenderProps<unknown, unknown> | null = null;\n\n constructor(config: CopilotKitCoreVueConfig) {\n super(config);\n this._renderToolCalls = config.renderToolCalls ?? [];\n this._renderCustomMessages = config.renderCustomMessages ?? [];\n this._renderActivityMessages = config.renderActivityMessages ?? [];\n }\n\n get renderCustomMessages(): Readonly<VueCustomMessageRenderer[]> {\n return this._renderCustomMessages;\n }\n\n get renderActivityMessages(): Readonly<\n VueActivityMessageRenderer<unknown>[]\n > {\n return this._renderActivityMessages;\n }\n\n setRenderActivityMessages(\n renderers: VueActivityMessageRenderer<unknown>[],\n ): void {\n this._renderActivityMessages = [...renderers];\n }\n\n setRenderCustomMessages(renderers: VueCustomMessageRenderer[]): void {\n this._renderCustomMessages = [...renderers];\n void this.notifySubscribers((subscriber) => {\n const vueSubscriber = subscriber as CopilotKitCoreVueSubscriber;\n vueSubscriber.onRenderCustomMessagesChanged?.({\n copilotkit: this,\n renderCustomMessages: [...this.renderCustomMessages],\n });\n }, \"Subscriber onRenderCustomMessagesChanged error:\");\n }\n\n get propRenderToolCalls(): Readonly<VueToolCallRenderer<unknown>[]> {\n return this._renderToolCalls;\n }\n\n get renderToolCalls(): Readonly<VueToolCallRenderer<unknown>[]> {\n if (this._hookRenderToolCalls.size === 0) {\n return this._renderToolCalls;\n }\n if (this._cachedMergedRenderToolCalls) {\n return this._cachedMergedRenderToolCalls;\n }\n const merged = new Map<string, VueToolCallRenderer<unknown>>();\n for (const rc of this._renderToolCalls) {\n merged.set(`${rc.agentId ?? \"\"}:${rc.name}`, rc);\n }\n for (const [key, rc] of this._hookRenderToolCalls) {\n merged.set(key, rc);\n }\n this._cachedMergedRenderToolCalls = Array.from(merged.values());\n return this._cachedMergedRenderToolCalls;\n }\n\n get interruptState(): InterruptRenderProps<unknown, unknown> | null {\n return this._interruptState;\n }\n\n setRenderToolCalls(renderToolCalls: VueToolCallRenderer<unknown>[]): void {\n this._renderToolCalls = [...renderToolCalls];\n this._cachedMergedRenderToolCalls = null;\n this._notifyRenderToolCallsChanged();\n }\n\n addHookRenderToolCall(entry: VueToolCallRenderer<unknown>): void {\n const key = `${entry.agentId ?? \"\"}:${entry.name}`;\n this._hookRenderToolCalls.set(key, entry);\n this._cachedMergedRenderToolCalls = null;\n this._notifyRenderToolCallsChanged();\n }\n\n removeHookRenderToolCall(name: string, agentId?: string): void {\n const key = `${agentId ?? \"\"}:${name}`;\n if (this._hookRenderToolCalls.delete(key)) {\n this._cachedMergedRenderToolCalls = null;\n this._notifyRenderToolCallsChanged();\n }\n }\n\n private _notifyRenderToolCallsChanged(): void {\n void this.notifySubscribers((subscriber) => {\n const vueSubscriber = subscriber as CopilotKitCoreVueSubscriber;\n if (vueSubscriber.onRenderToolCallsChanged) {\n vueSubscriber.onRenderToolCallsChanged({\n copilotkit: this,\n renderToolCalls: [...this.renderToolCalls],\n });\n }\n }, \"Subscriber onRenderToolCallsChanged error:\");\n }\n\n setInterruptState(\n interruptState: InterruptRenderProps<unknown, unknown> | null,\n ): void {\n this._interruptState = interruptState;\n void this.notifySubscribers((subscriber) => {\n const vueSubscriber = subscriber as CopilotKitCoreVueSubscriber;\n vueSubscriber.onInterruptStateChanged?.({\n copilotkit: this,\n interruptState: this._interruptState,\n });\n }, \"Subscriber onInterruptStateChanged error:\");\n }\n\n subscribe(\n subscriber: CopilotKitCoreVueSubscriber,\n ): CopilotKitCoreSubscription {\n return super.subscribe(subscriber);\n }\n\n async waitForPendingFrameworkUpdates(): Promise<void> {\n await nextTick();\n }\n}\n","import { computed, defineComponent, h, type PropType } from \"vue\";\nimport { z } from \"zod\";\nimport type { VueActivityMessageRenderer } from \"../types\";\nimport type { A2UITheme } from \"../types\";\nimport A2UISurfaceActivityRenderer from \"./A2UISurfaceActivityRenderer.vue\";\n\nconst A2UI_OPERATIONS_KEY = \"a2ui_operations\";\n\nexport type A2UIMessageRendererOptions = {\n theme: A2UITheme;\n catalog?: any;\n loadingComponent?: unknown;\n};\n\n/**\n * Default loading component shown while an A2UI surface is generating.\n * Mirrors React's `DefaultA2UILoading` in\n * `packages/react-core/src/v2/a2ui/A2UIMessageRenderer.tsx`:\n * an animated dot + \"Generating UI...\" label + three shimmer bars\n * (80% / 60% / 40% widths) with staggered `cpk-a2ui-pulse` opacity animation.\n */\nconst DefaultA2UILoading = defineComponent({\n name: \"DefaultA2UILoading\",\n setup() {\n const barWidths = [0.8, 0.6, 0.4] as const;\n return () =>\n h(\n \"div\",\n {\n class:\n \"cpk:flex cpk:flex-col cpk:gap-3 cpk:rounded-xl cpk:border cpk:border-gray-100 cpk:bg-gray-50/50 cpk:p-5\",\n style: { minHeight: \"120px\" },\n \"data-testid\": \"a2ui-loading\",\n },\n [\n h(\"div\", { class: \"cpk:flex cpk:items-center cpk:gap-2\" }, [\n h(\"div\", {\n class: \"cpk:h-3 cpk:w-3 cpk:rounded-full cpk:bg-gray-200\",\n style: {\n animation: \"cpk-a2ui-pulse 1.5s ease-in-out infinite\",\n },\n \"data-testid\": \"a2ui-loading-dot\",\n }),\n h(\n \"span\",\n {\n class: \"cpk:text-xs cpk:font-medium cpk:text-gray-400\",\n },\n \"Generating UI...\",\n ),\n ]),\n h(\n \"div\",\n { class: \"cpk:flex cpk:flex-col cpk:gap-2\" },\n barWidths.map((width, i) =>\n h(\"div\", {\n key: i,\n class: \"cpk:h-3 cpk:rounded cpk:bg-gray-200/70\",\n style: {\n width: `${width * 100}%`,\n animation: `cpk-a2ui-pulse 1.5s ease-in-out ${i * 0.15}s infinite`,\n },\n \"data-testid\": \"a2ui-loading-bar\",\n }),\n ),\n ),\n h(\n \"style\",\n {},\n `@keyframes cpk-a2ui-pulse {\n 0%, 100% { opacity: 0.4; }\n 50% { opacity: 1; }\n}`,\n ),\n ],\n );\n },\n});\n\nexport function createA2UIMessageRenderer(\n options: A2UIMessageRendererOptions,\n): VueActivityMessageRenderer<any> {\n return {\n activityType: \"a2ui-surface\",\n content: z.any(),\n render: defineComponent({\n name: \"A2UIMessageRendererHost\",\n props: {\n activityType: { type: String, required: true },\n content: { type: Object as PropType<any>, required: true },\n message: { type: Object as PropType<any>, required: true },\n agent: {\n type: Object as PropType<any>,\n required: false,\n default: undefined,\n },\n },\n setup(props) {\n const operations = computed(() =>\n Array.isArray(props.content?.[A2UI_OPERATIONS_KEY])\n ? props.content[A2UI_OPERATIONS_KEY]\n : [],\n );\n\n return () => {\n if (operations.value.length === 0) {\n if (options.loadingComponent) {\n return h(options.loadingComponent as any);\n }\n return h(DefaultA2UILoading);\n }\n\n return h(A2UISurfaceActivityRenderer, {\n activityType: \"a2ui-surface\",\n content: { operations: operations.value },\n message: props.message,\n agent: props.agent,\n theme: options.theme,\n catalog: options.catalog,\n });\n };\n },\n }),\n };\n}\n","import { z } from \"zod\";\nimport type { StandardSchemaV1, InferSchemaOutput } from \"@copilotkit/shared\";\nimport type { VueToolCallRenderer } from \"./vue-tool-call-renderer\";\nimport type { VueToolCallRendererRenderFn } from \"./vue-tool-call-renderer\";\n\nexport function defineToolCallRenderer(def: {\n name: \"*\";\n render: VueToolCallRendererRenderFn<unknown>;\n agentId?: string;\n}): VueToolCallRenderer<unknown>;\n\nexport function defineToolCallRenderer<S extends StandardSchemaV1>(def: {\n name: string;\n args: S;\n render: VueToolCallRendererRenderFn<InferSchemaOutput<S>>;\n agentId?: string;\n}): VueToolCallRenderer<InferSchemaOutput<S>>;\n\nexport function defineToolCallRenderer<S extends StandardSchemaV1>(def: {\n name: string;\n args?: S;\n render: VueToolCallRendererRenderFn<unknown>;\n agentId?: string;\n}): VueToolCallRenderer<unknown> {\n const argsSchema = def.name === \"*\" && !def.args ? z.any() : def.args;\n return {\n name: def.name,\n args: argsSchema as StandardSchemaV1<any, unknown>,\n render: def.render as VueToolCallRenderer<unknown>[\"render\"],\n ...(def.agentId ? { agentId: def.agentId } : {}),\n };\n}\n","import { h, watch, type VNodeChild } from \"vue\";\nimport type { ShallowRef } from \"vue\";\nimport { z } from \"zod\";\nimport type { ToolCallStatus } from \"@copilotkit/core\";\nimport type { CopilotKitCoreVue } from \"../../lib/vue-core\";\nimport { defineToolCallRenderer } from \"../../types/defineToolCallRenderer\";\n\n/**\n * Tool name used by the dynamic A2UI generation secondary LLM.\n * This renderer is auto-registered when A2UI is enabled.\n */\nexport const RENDER_A2UI_TOOL_NAME = \"render_a2ui\";\n\n/**\n * Registers the built-in `render_a2ui` tool call renderer via the props-based\n * `setRenderToolCalls` mechanism (not `useRenderTool`).\n *\n * This ensures user-registered `useRenderTool({ name: \"render_a2ui\", ... })`\n * hooks automatically override the built-in, since the merge logic in\n * vue-core.ts gives hook-based entries priority over prop-based entries.\n *\n * Call from the provider's setup function and pass a cleanup callback.\n */\nexport function registerA2UIBuiltInToolCallRenderer(\n copilotkit: ShallowRef<CopilotKitCoreVue>,\n enabled: () => boolean,\n): void {\n watch(\n [() => copilotkit.value, enabled],\n ([core, isEnabled], _prev, onCleanup) => {\n if (!isEnabled) return;\n\n const renderer = defineToolCallRenderer({\n name: RENDER_A2UI_TOOL_NAME,\n args: z.any(),\n render: ({\n status,\n args: parameters,\n }: {\n status: ToolCallStatus;\n args: unknown;\n [key: string]: unknown;\n }): VNodeChild => {\n if (status === \"complete\") return null;\n const params = parameters as Record<string, unknown>;\n // Hide skeleton once the A2UI surface has enough data to render.\n const items = params?.items;\n if (Array.isArray(items) && items.length > 0) return null;\n const components = params?.components;\n if (Array.isArray(components) && components.length > 2) return null;\n return renderA2UIProgressIndicator(parameters);\n },\n });\n\n // Register via props-based mechanism so useRenderTool hooks take priority\n const existing = core.propRenderToolCalls;\n core.setRenderToolCalls([\n ...existing.filter((rc) => rc.name !== RENDER_A2UI_TOOL_NAME),\n renderer,\n ]);\n\n onCleanup(() => {\n const current = core.propRenderToolCalls;\n core.setRenderToolCalls(\n current.filter((rc) => rc.name !== RENDER_A2UI_TOOL_NAME),\n );\n progressState.clear();\n });\n },\n { immediate: true },\n );\n}\n\n/**\n * Vue render-function equivalent of the React A2UIProgressIndicator.\n * Shows a skeleton wireframe that progressively reveals as tokens stream in.\n */\nconst progressState = new Map<\n string,\n { lastTime: number; lastTokens: number }\n>();\n\nfunction renderA2UIProgressIndicator(parameters: unknown): VNodeChild {\n const params = parameters as Record<string, unknown> | null | undefined;\n const key = typeof params?.name === \"string\" ? params.name : \"__default__\";\n let state = progressState.get(key);\n if (!state) {\n state = { lastTime: 0, lastTokens: 0 };\n progressState.set(key, state);\n }\n\n const now = Date.now();\n let tokens = state.lastTokens;\n if (now - state.lastTime > 200) {\n const chars = JSON.stringify(parameters ?? {}).length;\n tokens = Math.round(chars / 4);\n state.lastTime = now;\n state.lastTokens = tokens;\n }\n\n const phase = tokens < 50 ? 0 : tokens < 200 ? 1 : tokens < 400 ? 2 : 3;\n\n const dot = () =>\n h(\"div\", {\n style: {\n width: \"7px\",\n height: \"7px\",\n borderRadius: \"50%\",\n backgroundColor: \"#d4d4d8\",\n flexShrink: 0,\n },\n });\n\n const spacer = () => h(\"div\", { style: { width: \"12px\" } });\n\n const bar = (\n w: number,\n ht: number,\n bg: string,\n anim?: number,\n opacity?: number,\n transition?: string,\n ) =>\n h(\"div\", {\n style: {\n width: `${w}px`,\n height: `${ht}px`,\n borderRadius: \"9999px\",\n backgroundColor: bg,\n ...(anim !== undefined\n ? {\n animation: `cpk-a2ui-fade 2.4s ease-in-out ${anim}s infinite`,\n }\n : {}),\n ...(opacity !== undefined ? { opacity } : {}),\n ...(transition ? { transition } : {}),\n },\n });\n\n const row = (show: boolean, delay: number, children: VNodeChild[]) =>\n h(\n \"div\",\n {\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"6px\",\n opacity: show ? 1 : 0,\n transition: `opacity 0.4s ${delay}s`,\n },\n },\n children,\n );\n\n return h(\"div\", { style: { margin: \"12px 0\", maxWidth: \"320px\" } }, [\n h(\n \"div\",\n {\n style: {\n position: \"relative\",\n overflow: \"hidden\",\n borderRadius: \"12px\",\n border: \"1px solid rgba(228,228,231,0.8)\",\n backgroundColor: \"#fff\",\n boxShadow: \"0 1px 2px rgba(0,0,0,0.04)\",\n padding: \"16px 18px 14px\",\n },\n },\n [\n // Top bar\n h(\n \"div\",\n {\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"8px\",\n marginBottom: \"12px\",\n },\n },\n [\n h(\"div\", { style: { display: \"flex\", gap: \"4px\" } }, [\n dot(),\n dot(),\n dot(),\n ]),\n bar(\n 64,\n 6,\n \"#e4e4e7\",\n undefined,\n phase >= 1 ? 1 : 0.4,\n \"opacity 0.5s\",\n ),\n ],\n ),\n // Skeleton lines\n h(\"div\", { style: { display: \"grid\", gap: \"7px\" } }, [\n row(phase >= 0, 0, [\n bar(36, 7, \"rgba(147,197,253,0.7)\", 0),\n bar(80, 7, \"rgba(219,234,254,0.8)\", 0.2),\n ]),\n row(phase >= 0, 0.1, [\n spacer(),\n dot(),\n bar(100, 7, \"rgba(24,24,27,0.2)\", 0.3),\n ]),\n row(phase >= 1, 0.15, [\n spacer(),\n bar(48, 7, \"rgba(24,24,27,0.15)\", 0.1),\n bar(40, 7, \"rgba(153,246,228,0.6)\", 0.5),\n bar(56, 7, \"rgba(147,197,253,0.6)\", 0.3),\n ]),\n row(phase >= 1, 0.2, [\n spacer(),\n dot(),\n bar(60, 7, \"rgba(24,24,27,0.15)\", 0.4),\n ]),\n row(phase >= 2, 0.25, [\n bar(40, 7, \"rgba(153,246,228,0.5)\", 0.2),\n dot(),\n bar(48, 7, \"rgba(24,24,27,0.15)\", 0.6),\n bar(64, 7, \"rgba(147,197,253,0.5)\", 0.1),\n ]),\n row(phase >= 2, 0.3, [\n bar(36, 7, \"rgba(147,197,253,0.6)\", 0.5),\n bar(36, 7, \"rgba(24,24,27,0.12)\", 0.7),\n ]),\n row(phase >= 3, 0.35, [\n dot(),\n bar(44, 7, \"rgba(24,24,27,0.18)\", 0.3),\n dot(),\n bar(56, 7, \"rgba(153,246,228,0.5)\", 0.8),\n bar(48, 7, \"rgba(147,197,253,0.5)\", 0.4),\n ]),\n ]),\n // Shimmer\n h(\"div\", {\n style: {\n pointerEvents: \"none\",\n position: \"absolute\",\n inset: \"0\",\n background:\n \"linear-gradient(105deg, transparent 0%, transparent 40%, rgba(255,255,255,0.6) 50%, transparent 60%, transparent 100%)\",\n backgroundSize: \"250% 100%\",\n animation: \"cpk-a2ui-sweep 3s ease-in-out infinite\",\n },\n }),\n ],\n ),\n // Label\n h(\n \"div\",\n {\n style: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: \"8px\",\n marginTop: \"8px\",\n },\n },\n [\n h(\n \"span\",\n {\n style: {\n fontSize: \"12px\",\n color: \"#a1a1aa\",\n letterSpacing: \"0.025em\",\n },\n },\n \"Building interface\",\n ),\n ...(tokens > 0\n ? [\n h(\n \"span\",\n {\n style: {\n fontSize: \"11px\",\n color: \"#d4d4d8\",\n fontVariantNumeric: \"tabular-nums\",\n },\n },\n `~${tokens.toLocaleString()} tokens`,\n ),\n ]\n : []),\n ],\n ),\n // Keyframe styles\n h(\n \"style\",\n `\n @keyframes cpk-a2ui-fade {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n }\n @keyframes cpk-a2ui-sweep {\n 0% { background-position: 250% 0; }\n 100% { background-position: -250% 0; }\n }\n `,\n ),\n ]);\n}\n","/**\n * Vue adapter for @a2ui/web_core v0.9 component rendering.\n *\n * Provides createVueComponent — the Vue equivalent of createReactComponent\n * from the React renderer. Uses GenericBinder for reactive data binding\n * and Vue's render functions for component output.\n */\n\nimport {\n defineComponent,\n ref,\n onUnmounted,\n watch,\n type VNode,\n type PropType,\n} from \"vue\";\nimport {\n ComponentContext,\n GenericBinder,\n type ComponentApi,\n type InferredComponentApiSchemaType,\n type ResolveA2uiProps,\n} from \"@a2ui/web_core/v0_9\";\n\n/** Props passed to a Vue A2UI component's render function. */\nexport interface VueA2uiComponentProps<T, S = void> {\n props: T;\n buildChild: (id: string, basePath?: string) => VNode;\n context: ComponentContext;\n state: S;\n}\n\n/**\n * A Vue component implementation registered with the A2UI Catalog.\n * Mirrors ReactComponentImplementation but uses Vue's component system.\n */\nexport interface VueComponentImplementation extends ComponentApi {\n /** The Vue component that handles rendering. */\n render: ReturnType<typeof defineComponent>;\n}\n\n/**\n * Creates a Vue component implementation using the GenericBinder.\n * This is the Vue equivalent of createReactComponent from the React adapter.\n */\nexport function createVueComponent<Api extends ComponentApi, S = void>(\n api: Api,\n renderFn: (\n componentProps: VueA2uiComponentProps<\n ResolveA2uiProps<InferredComponentApiSchemaType<Api>>,\n S\n >,\n ) => VNode | VNode[] | null,\n setupState?: () => S,\n): VueComponentImplementation {\n type Props = ResolveA2uiProps<InferredComponentApiSchemaType<Api>>;\n\n const VueWrapper = defineComponent({\n name: `A2UI_${api.name}`,\n props: {\n context: {\n type: Object as PropType<ComponentContext>,\n required: true,\n },\n buildChild: {\n type: Function as PropType<(id: string, basePath?: string) => VNode>,\n required: true,\n },\n },\n setup(wrapperProps) {\n const resolvedProps = ref<Props>({} as Props);\n let binder: GenericBinder<Props> | null = null;\n const state = setupState ? setupState() : (undefined as S);\n\n function initBinder(context: ComponentContext) {\n if (binder) {\n binder.dispose();\n }\n binder = new GenericBinder<Props>(context, api.schema);\n resolvedProps.value = binder.snapshot;\n binder.subscribe((newProps: Props) => {\n resolvedProps.value = newProps;\n });\n }\n\n initBinder(wrapperProps.context);\n\n watch(\n () => wrapperProps.context,\n (newContext) => {\n initBinder(newContext);\n },\n );\n\n onUnmounted(() => {\n if (binder) {\n binder.dispose();\n binder = null;\n }\n });\n\n return () =>\n renderFn({\n props: resolvedProps.value,\n buildChild: wrapperProps.buildChild,\n context: wrapperProps.context,\n state,\n });\n },\n });\n\n return {\n name: api.name,\n schema: api.schema,\n render: VueWrapper,\n };\n}\n\n/**\n * Creates a Vue component implementation without the generic binder\n * (for components that manage their own context bindings).\n */\nexport function createBinderlessVueComponent(\n api: ComponentApi,\n renderFn: (componentProps: {\n context: ComponentContext;\n buildChild: (id: string, basePath?: string) => VNode;\n }) => VNode | VNode[] | null,\n): VueComponentImplementation {\n const VueWrapper = defineComponent({\n name: `A2UI_${api.name}`,\n props: {\n context: {\n type: Object as PropType<ComponentContext>,\n required: true,\n },\n buildChild: {\n type: Function as PropType<(id: string, basePath?: string) => VNode>,\n required: true,\n },\n },\n setup(wrapperProps) {\n return () =>\n renderFn({\n context: wrapperProps.context,\n buildChild: wrapperProps.buildChild,\n });\n },\n });\n\n return {\n name: api.name,\n schema: api.schema,\n render: VueWrapper,\n };\n}\n","/**\n * Style utilities for Vue A2UI basic catalog components.\n * Mirrors the React renderer's catalog/basic/utils.ts.\n */\n\nimport type { CSSProperties } from \"vue\";\n\n/** Standard leaf margin from the implementation guide. */\nexport const LEAF_MARGIN = \"8px\";\n\n/** Standard internal padding for visually bounded containers. */\nexport const CONTAINER_PADDING = \"16px\";\n\n/** Standard border for cards and inputs. */\nexport const STANDARD_BORDER = \"1px solid #ccc\";\n\n/** Standard border radius. */\nexport const STANDARD_RADIUS = \"8px\";\n\nexport const mapJustify = (j?: string): string => {\n switch (j) {\n case \"center\":\n return \"center\";\n case \"end\":\n return \"flex-end\";\n case \"spaceAround\":\n return \"space-around\";\n case \"spaceBetween\":\n return \"space-between\";\n case \"spaceEvenly\":\n return \"space-evenly\";\n case \"start\":\n return \"flex-start\";\n case \"stretch\":\n return \"stretch\";\n default:\n return \"flex-start\";\n }\n};\n\nexport const mapAlign = (a?: string): string => {\n switch (a) {\n case \"start\":\n return \"flex-start\";\n case \"center\":\n return \"center\";\n case \"end\":\n return \"flex-end\";\n case \"stretch\":\n return \"stretch\";\n default:\n return \"stretch\";\n }\n};\n\nexport const getBaseLeafStyle = (): CSSProperties => ({\n margin: LEAF_MARGIN,\n boxSizing: \"border-box\",\n});\n\nexport const getBaseContainerStyle = (): CSSProperties => ({\n margin: LEAF_MARGIN,\n padding: CONTAINER_PADDING,\n border: STANDARD_BORDER,\n borderRadius: STANDARD_RADIUS,\n boxSizing: \"border-box\",\n});\n","/**\n * Vue basic catalog for A2UI v0.9.\n *\n * Provides Vue component implementations for all 18 basic catalog components,\n * mirroring the React renderer's catalog/basic/.\n */\n\nimport { h, ref, type CSSProperties, type VNode } from \"vue\";\nimport { Catalog } from \"@a2ui/web_core/v0_9\";\nimport {\n TextApi,\n ImageApi,\n IconApi,\n VideoApi,\n AudioPlayerApi,\n RowApi,\n ColumnApi,\n ListApi,\n CardApi,\n TabsApi,\n DividerApi,\n ModalApi,\n ButtonApi,\n TextFieldApi,\n CheckBoxApi,\n ChoicePickerApi,\n SliderApi,\n DateTimeInputApi,\n BASIC_FUNCTIONS,\n} from \"@a2ui/web_core/v0_9/basic_catalog\";\n\nimport { createVueComponent, type VueComponentImplementation } from \"./adapter\";\nimport {\n LEAF_MARGIN,\n STANDARD_BORDER,\n STANDARD_RADIUS,\n getBaseLeafStyle,\n getBaseContainerStyle,\n mapJustify,\n mapAlign,\n} from \"./utils\";\n\n// -- Helper: render a child list (arrays of { id, basePath } or string IDs) --\nfunction renderChildList(\n childList: unknown,\n buildChild: (id: string, basePath?: string) => VNode,\n): VNode[] {\n if (!Array.isArray(childList)) return [];\n return childList\n .map((item: unknown) => {\n if (item && typeof item === \"object\" && \"id\" in item) {\n const node = item as { id: string; basePath?: string };\n return buildChild(node.id, node.basePath);\n }\n if (typeof item === \"string\") {\n return buildChild(item);\n }\n return null;\n })\n .filter((v): v is VNode => v !== null);\n}\n\n// -- Unique ID counter for form elements --\nlet a2uiIdCounter = 0;\nfunction useA2UIUniqueId(): string {\n return `a2ui-vue-${++a2uiIdCounter}`;\n}\n\n// ============================================================\n// Component Implementations\n// ============================================================\n\nconst Text = createVueComponent(TextApi, ({ props }) => {\n const text = props.text ?? \"\";\n const style = { ...getBaseLeafStyle(), display: \"inline-block\" };\n\n switch (props.variant) {\n case \"h1\":\n return h(\"h1\", { style }, text);\n case \"h2\":\n return h(\"h2\", { style }, text);\n case \"h3\":\n return h(\"h3\", { style }, text);\n case \"h4\":\n return h(\"h4\", { style }, text);\n case \"h5\":\n return h(\"h5\", { style }, text);\n case \"caption\":\n return h(\n \"small\",\n { style: { ...style, color: \"#666\", textAlign: \"left\" } },\n text,\n );\n case \"body\":\n default:\n return h(\"span\", { style }, text);\n }\n});\n\nconst Image = createVueComponent(ImageApi, ({ props }) => {\n const mapFit = (fit?: string): string => {\n if (fit === \"scaleDown\") return \"scale-down\";\n return fit || \"fill\";\n };\n\n const style: CSSProperties = {\n ...getBaseLeafStyle(),\n objectFit: mapFit(props.fit) as CSSProperties[\"objectFit\"],\n width: \"100%\",\n height: \"auto\",\n display: \"block\",\n };\n\n if (props.variant === \"icon\") {\n style.width = \"24px\";\n style.height = \"24px\";\n } else if (props.variant === \"avatar\") {\n style.width = \"40px\";\n style.height = \"40px\";\n style.borderRadius = \"50%\";\n } else if (props.variant === \"smallFeature\") {\n style.maxWidth = \"100px\";\n } else if (props.variant === \"largeFeature\") {\n style.maxHeight = \"400px\";\n } else if (props.variant === \"header\") {\n style.height = \"200px\";\n style.objectFit = \"cover\";\n }\n\n return h(\"img\", { src: props.url, alt: props.description || \"\", style });\n});\n\nconst Icon = createVueComponent(IconApi, ({ props }) => {\n const iconName =\n typeof props.name === \"string\"\n ? props.name\n : (props.name as { path?: string })?.path;\n const style = {\n ...getBaseLeafStyle(),\n fontSize: \"24px\",\n width: \"24px\",\n height: \"24px\",\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n };\n\n return h(\"span\", { class: \"material-symbols-outlined\", style }, iconName);\n});\n\nconst Video = createVueComponent(VideoApi, ({ props }) => {\n const style = {\n ...getBaseLeafStyle(),\n width: \"100%\",\n aspectRatio: \"16/9\",\n };\n\n return h(\"video\", { src: props.url, controls: true, style });\n});\n\nconst AudioPlayer = createVueComponent(AudioPlayerApi, ({ props }) => {\n const style = { ...getBaseLeafStyle(), width: \"100%\" };\n\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"4px\",\n width: \"100%\",\n },\n },\n [\n props.description\n ? h(\n \"span\",\n { style: { fontSize: \"12px\", color: \"#666\" } },\n props.description,\n )\n : null,\n h(\"audio\", { src: props.url, controls: true, style }),\n ],\n );\n});\n\nconst Row = createVueComponent(RowApi, ({ props, buildChild }) => {\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: mapJustify(props.justify),\n alignItems: mapAlign(props.align),\n width: \"100%\",\n margin: \"0\",\n padding: \"0\",\n },\n },\n renderChildList(props.children, buildChild),\n );\n});\n\nconst Column = createVueComponent(ColumnApi, ({ props, buildChild }) => {\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: mapJustify(props.justify),\n alignItems: mapAlign(props.align),\n width: \"100%\",\n margin: \"0\",\n padding: \"0\",\n },\n },\n renderChildList(props.children, buildChild),\n );\n});\n\nconst List = createVueComponent(ListApi, ({ props, buildChild }) => {\n const isHorizontal = props.direction === \"horizontal\";\n const style = {\n display: \"flex\",\n flexDirection: isHorizontal ? (\"row\" as const) : (\"column\" as const),\n alignItems: mapAlign(props.align),\n overflowX: isHorizontal ? (\"auto\" as const) : (\"hidden\" as const),\n overflowY: isHorizontal ? (\"hidden\" as const) : (\"auto\" as const),\n width: \"100%\",\n margin: \"0\",\n padding: \"0\",\n };\n\n return h(\"div\", { style }, renderChildList(props.children, buildChild));\n});\n\nconst Card = createVueComponent(CardApi, ({ props, buildChild }) => {\n const style = {\n ...getBaseContainerStyle(),\n backgroundColor: \"#fff\",\n boxShadow: \"0 2px 4px rgba(0,0,0,0.1)\",\n width: \"100%\",\n };\n\n return h(\"div\", { style }, [props.child ? buildChild(props.child) : null]);\n});\n\nconst Tabs = createVueComponent(\n TabsApi,\n ({ props, buildChild, state }) => {\n const tabs = props.tabs || [];\n\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n width: \"100%\",\n margin: LEAF_MARGIN,\n },\n },\n [\n h(\n \"div\",\n {\n style: {\n display: \"flex\",\n borderBottom: \"1px solid #ccc\",\n marginBottom: \"8px\",\n },\n },\n tabs.map((tab, i: number) => {\n const title =\n typeof tab.title === \"string\"\n ? tab.title\n : String(tab.title ?? \"\");\n return h(\n \"button\",\n {\n key: i,\n onClick: () => {\n state.selectedIndex.value = i;\n },\n style: {\n padding: \"8px 16px\",\n border: \"none\",\n background: \"none\",\n borderBottom:\n state.selectedIndex.value === i\n ? \"2px solid var(--a2ui-primary-color, #007bff)\"\n : \"none\",\n fontWeight:\n state.selectedIndex.value === i ? \"bold\" : \"normal\",\n cursor: \"pointer\",\n color:\n state.selectedIndex.value === i\n ? \"var(--a2ui-primary-color, #007bff)\"\n : \"inherit\",\n },\n },\n title,\n );\n }),\n ),\n h(\"div\", { style: { flex: \"1\" } }, [\n tabs[state.selectedIndex.value]?.child\n ? buildChild(tabs[state.selectedIndex.value]!.child)\n : null,\n ]),\n ],\n );\n },\n () => ({ selectedIndex: ref(0) }),\n);\n\nconst Divider = createVueComponent(DividerApi, ({ props }) => {\n const isVertical = props.axis === \"vertical\";\n const style: Record<string, string> = {\n margin: LEAF_MARGIN,\n border: \"none\",\n backgroundColor: \"#ccc\",\n };\n\n if (isVertical) {\n style.width = \"1px\";\n style.height = \"100%\";\n } else {\n style.width = \"100%\";\n style.height = \"1px\";\n }\n\n return h(\"div\", { style });\n});\n\nconst Modal = createVueComponent(\n ModalApi,\n ({ props, buildChild, state }) => {\n return h(\"div\", {}, [\n h(\n \"div\",\n {\n onClick: () => {\n state.isOpen.value = true;\n },\n style: { display: \"inline-block\" },\n },\n [props.trigger ? buildChild(props.trigger) : null],\n ),\n state.isOpen.value\n ? h(\n \"div\",\n {\n style: {\n position: \"fixed\",\n top: \"0\",\n left: \"0\",\n right: \"0\",\n bottom: \"0\",\n backgroundColor: \"rgba(0,0,0,0.5)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n zIndex: \"1000\",\n },\n onClick: () => {\n state.isOpen.value = false;\n },\n },\n [\n h(\n \"div\",\n {\n style: {\n backgroundColor: \"#fff\",\n padding: \"24px\",\n borderRadius: \"8px\",\n maxWidth: \"90%\",\n maxHeight: \"90%\",\n overflow: \"auto\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n onClick: (e: Event) => e.stopPropagation(),\n },\n [\n h(\n \"div\",\n { style: { display: \"flex\", justifyContent: \"flex-end\" } },\n [\n h(\n \"button\",\n {\n onClick: () => {\n state.isOpen.value = false;\n },\n style: {\n border: \"none\",\n background: \"none\",\n fontSize: \"20px\",\n cursor: \"pointer\",\n padding: \"4px\",\n },\n },\n \"\\u00D7\",\n ),\n ],\n ),\n h(\"div\", { style: { flex: \"1\" } }, [\n props.content ? buildChild(props.content) : null,\n ]),\n ],\n ),\n ],\n )\n : null,\n ]);\n },\n () => ({ isOpen: ref(false) }),\n);\n\nconst Button = createVueComponent(ButtonApi, ({ props, buildChild }) => {\n const style = {\n margin: LEAF_MARGIN,\n padding: \"8px 16px\",\n cursor: \"pointer\",\n border: props.variant === \"borderless\" ? \"none\" : \"1px solid #ccc\",\n backgroundColor:\n props.variant === \"primary\"\n ? \"var(--a2ui-primary-color, #007bff)\"\n : props.variant === \"borderless\"\n ? \"transparent\"\n : \"#fff\",\n color: props.variant === \"primary\" ? \"#fff\" : \"inherit\",\n borderRadius: \"4px\",\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n boxSizing: \"border-box\",\n };\n\n return h(\n \"button\",\n {\n style,\n onClick: props.action,\n disabled: props.isValid === false,\n },\n [props.child ? buildChild(props.child) : null],\n );\n});\n\nconst TextField = createVueComponent(\n TextFieldApi,\n ({ props, state }) => {\n const uniqueId = state.id;\n const isLong = props.variant === \"longText\";\n const type =\n props.variant === \"number\"\n ? \"number\"\n : props.variant === \"obscured\"\n ? \"password\"\n : \"text\";\n\n const inputStyle = {\n padding: \"8px\",\n width: \"100%\",\n border:\n props.validationErrors && props.validationErrors.length > 0\n ? \"1px solid red\"\n : STANDARD_BORDER,\n borderRadius: STANDARD_RADIUS,\n boxSizing: \"border-box\",\n };\n\n const hasError =\n props.validationErrors && props.validationErrors.length > 0;\n\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"4px\",\n width: \"100%\",\n margin: LEAF_MARGIN,\n },\n },\n [\n props.label\n ? h(\n \"label\",\n {\n for: uniqueId,\n style: { fontSize: \"14px\", fontWeight: \"bold\" },\n },\n props.label,\n )\n : null,\n isLong\n ? h(\"textarea\", {\n id: uniqueId,\n style: inputStyle,\n value: props.value || \"\",\n onInput: (e: Event) =>\n props.setValue((e.target as HTMLTextAreaElement).value),\n })\n : h(\"input\", {\n id: uniqueId,\n type,\n style: inputStyle,\n value: props.value || \"\",\n onInput: (e: Event) =>\n props.setValue((e.target as HTMLInputElement).value),\n }),\n hasError\n ? h(\n \"span\",\n { style: { fontSize: \"12px\", color: \"red\" } },\n props.validationErrors![0],\n )\n : null,\n ],\n );\n },\n () => ({ id: useA2UIUniqueId() }),\n);\n\nconst CheckBox = createVueComponent(\n CheckBoxApi,\n ({ props, state }) => {\n const uniqueId = state.id;\n const hasError =\n props.validationErrors && props.validationErrors.length > 0;\n\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n margin: LEAF_MARGIN,\n },\n },\n [\n h(\n \"div\",\n { style: { display: \"flex\", alignItems: \"center\", gap: \"8px\" } },\n [\n h(\"input\", {\n id: uniqueId,\n type: \"checkbox\",\n checked: !!props.value,\n onChange: (e: Event) =>\n props.setValue((e.target as HTMLInputElement).checked),\n style: {\n cursor: \"pointer\",\n outline: hasError ? \"1px solid red\" : \"none\",\n },\n }),\n props.label\n ? h(\n \"label\",\n {\n for: uniqueId,\n style: {\n cursor: \"pointer\",\n color: hasError ? \"red\" : \"inherit\",\n },\n },\n props.label,\n )\n : null,\n ],\n ),\n hasError\n ? h(\n \"span\",\n {\n style: { fontSize: \"12px\", color: \"red\", marginTop: \"4px\" },\n },\n props.validationErrors?.[0],\n )\n : null,\n ],\n );\n },\n () => ({ id: useA2UIUniqueId() }),\n);\n\nconst ChoicePicker = createVueComponent(\n ChoicePickerApi,\n ({ props, context, state }) => {\n const values = Array.isArray(props.value) ? props.value : [];\n const isMutuallyExclusive = props.variant === \"mutuallyExclusive\";\n\n const onToggle = (val: string) => {\n if (isMutuallyExclusive) {\n props.setValue([val]);\n } else {\n const newValues = values.includes(val)\n ? values.filter((v: string) => v !== val)\n : [...values, val];\n props.setValue(newValues);\n }\n };\n\n type ChoiceOption = {\n label?: string | Record<string, unknown>;\n value: string;\n };\n const options = (props.options || []).filter(\n (opt: ChoiceOption) =>\n !props.filterable ||\n state.filter.value === \"\" ||\n String(typeof opt.label === \"string\" ? opt.label : \"\")\n .toLowerCase()\n .includes(state.filter.value.toLowerCase()),\n );\n\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"8px\",\n margin: LEAF_MARGIN,\n width: \"100%\",\n },\n },\n [\n props.label\n ? h(\"strong\", { style: { fontSize: \"14px\" } }, props.label)\n : null,\n props.filterable\n ? h(\"input\", {\n type: \"text\",\n placeholder: \"Filter options...\",\n value: state.filter.value,\n onInput: (e: Event) => {\n state.filter.value = (e.target as HTMLInputElement).value;\n },\n style: {\n padding: \"4px 8px\",\n border: STANDARD_BORDER,\n borderRadius: STANDARD_RADIUS,\n },\n })\n : null,\n h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: props.displayStyle === \"chips\" ? \"row\" : \"column\",\n flexWrap: props.displayStyle === \"chips\" ? \"wrap\" : \"nowrap\",\n gap: \"8px\",\n },\n },\n options.map((opt: ChoiceOption, i: number) => {\n const isSelected = values.includes(opt.value);\n const label =\n typeof opt.label === \"string\"\n ? opt.label\n : String(opt.label ?? opt.value);\n if (props.displayStyle === \"chips\") {\n return h(\n \"button\",\n {\n key: i,\n onClick: () => onToggle(opt.value),\n style: {\n padding: \"4px 12px\",\n borderRadius: \"16px\",\n border: isSelected\n ? \"1px solid var(--a2ui-primary-color, #007bff)\"\n : STANDARD_BORDER,\n backgroundColor: isSelected\n ? \"var(--a2ui-primary-color, #007bff)\"\n : \"#fff\",\n color: isSelected ? \"#fff\" : \"inherit\",\n cursor: \"pointer\",\n fontSize: \"12px\",\n },\n },\n label,\n );\n }\n return h(\n \"label\",\n {\n key: i,\n style: {\n display: \"flex\",\n alignItems: \"center\",\n gap: \"8px\",\n cursor: \"pointer\",\n },\n },\n [\n h(\"input\", {\n type: isMutuallyExclusive ? \"radio\" : \"checkbox\",\n checked: isSelected,\n onChange: () => onToggle(opt.value),\n name: isMutuallyExclusive\n ? `choice-${context.componentModel.id}`\n : undefined,\n }),\n h(\"span\", { style: { fontSize: \"14px\" } }, label),\n ],\n );\n }),\n ),\n ],\n );\n },\n () => ({ filter: ref(\"\") }),\n);\n\nconst Slider = createVueComponent(\n SliderApi,\n ({ props, state }) => {\n const uniqueId = state.id;\n\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"4px\",\n margin: LEAF_MARGIN,\n width: \"100%\",\n },\n },\n [\n h(\n \"div\",\n { style: { display: \"flex\", justifyContent: \"space-between\" } },\n [\n props.label\n ? h(\n \"label\",\n {\n for: uniqueId,\n style: { fontSize: \"14px\", fontWeight: \"bold\" },\n },\n props.label,\n )\n : null,\n h(\n \"span\",\n { style: { fontSize: \"12px\", color: \"#666\" } },\n String(props.value),\n ),\n ],\n ),\n h(\"input\", {\n id: uniqueId,\n type: \"range\",\n min: props.min ?? 0,\n max: props.max,\n value: props.value ?? 0,\n onInput: (e: Event) =>\n props.setValue(Number((e.target as HTMLInputElement).value)),\n style: { width: \"100%\", cursor: \"pointer\" },\n }),\n ],\n );\n },\n () => ({ id: useA2UIUniqueId() }),\n);\n\nconst DateTimeInput = createVueComponent(\n DateTimeInputApi,\n ({ props, state }) => {\n const uniqueId = state.id;\n\n let type = \"datetime-local\";\n if (props.enableDate && !props.enableTime) type = \"date\";\n if (!props.enableDate && props.enableTime) type = \"time\";\n\n const style = {\n padding: \"8px\",\n width: \"100%\",\n border: STANDARD_BORDER,\n borderRadius: STANDARD_RADIUS,\n boxSizing: \"border-box\",\n };\n\n return h(\n \"div\",\n {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"4px\",\n width: \"100%\",\n margin: LEAF_MARGIN,\n },\n },\n [\n props.label\n ? h(\n \"label\",\n {\n for: uniqueId,\n style: { fontSize: \"14px\", fontWeight: \"bold\" },\n },\n props.label,\n )\n : null,\n h(\"input\", {\n id: uniqueId,\n type,\n style,\n value: props.value || \"\",\n onInput: (e: Event) =>\n props.setValue((e.target as HTMLInputElement).value),\n min: typeof props.min === \"string\" ? props.min : undefined,\n max: typeof props.max === \"string\" ? props.max : undefined,\n }),\n ],\n );\n },\n () => ({ id: useA2UIUniqueId() }),\n);\n\n// ============================================================\n// Catalog Assembly\n// ============================================================\n\nconst vueBasicComponents: VueComponentImplementation[] = [\n Text,\n Image,\n Icon,\n Video,\n AudioPlayer,\n Row,\n Column,\n List,\n Card,\n Tabs,\n Divider,\n Modal,\n Button,\n TextField,\n CheckBox,\n ChoicePicker,\n Slider,\n DateTimeInput,\n];\n\nexport const vueBasicCatalog = new Catalog<VueComponentImplementation>(\n \"https://a2ui.org/specification/v0_9/basic_catalog.json\",\n vueBasicComponents,\n BASIC_FUNCTIONS,\n);\n\nexport {\n Text,\n Image,\n Icon,\n Video,\n AudioPlayer,\n Row,\n Column,\n List,\n Card,\n Tabs,\n Divider,\n Modal,\n Button,\n TextField,\n CheckBox,\n ChoicePicker,\n Slider,\n DateTimeInput,\n};\n","import { computed, watch } from \"vue\";\nimport type { ShallowRef } from \"vue\";\nimport type { Catalog, ComponentApi } from \"@a2ui/web_core/v0_9\";\nimport { zodToJsonSchema } from \"zod-to-json-schema\";\nimport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n} from \"@copilotkit/shared\";\nimport type { CopilotKitCoreVue } from \"../../lib/vue-core\";\nimport { vueBasicCatalog } from \"./catalog\";\n\n/**\n * Context description used to identify the A2UI component schema in\n * RunAgentInput.context. Must match the constant in @ag-ui/a2ui-middleware\n * so the middleware can overwrite a frontend-provided schema with a\n * server-side one.\n *\n * Duplicated from @copilotkit/a2ui-renderer/catalog-utils to avoid pulling\n * in React dependencies.\n */\nconst A2UI_SCHEMA_CONTEXT_DESCRIPTION =\n \"A2UI Component Schema — available components for generating UI surfaces. \" +\n \"Use these component names and properties when creating A2UI operations.\";\n\n/**\n * Build a context string describing the available A2UI catalog.\n * Vue-native equivalent of buildCatalogContextValue from a2ui-renderer.\n */\nfunction buildCatalogContextValue(catalog?: Catalog<ComponentApi>): string {\n const resolved = catalog ?? vueBasicCatalog;\n const BASIC_CATALOG_ID =\n \"https://a2ui.org/specification/v0_9/basic_catalog.json\";\n const lines: string[] = [];\n lines.push(\"Available A2UI catalog:\");\n\n if (resolved.id === BASIC_CATALOG_ID) {\n lines.push(`- ${resolved.id} (basic catalog)`);\n return lines.join(\"\\n\");\n }\n\n // Check if the resolved catalog extends the basic catalog\n let isSuperset = true;\n for (const name of vueBasicCatalog.components.keys()) {\n if (!resolved.components.has(name)) {\n isSuperset = false;\n break;\n }\n }\n\n // Identify custom components (not in basic catalog)\n const customNames: string[] = [];\n for (const name of resolved.components.keys()) {\n if (!vueBasicCatalog.components.has(name)) {\n customNames.push(name);\n }\n }\n\n lines.push(`- ${resolved.id}`);\n if (isSuperset) {\n lines.push(\n \" Extends the basic catalog with all standard components plus:\",\n );\n } else {\n lines.push(\" Custom catalog (does NOT include all basic components).\");\n lines.push(\" Custom components:\");\n }\n\n for (const name of customNames) {\n const comp = resolved.components.get(name);\n if (!comp) continue;\n const jsonSchema = zodToJsonSchema(comp.schema);\n lines.push(` - ${name}:`);\n lines.push(\n ` ${JSON.stringify(jsonSchema, null, 2).split(\"\\n\").join(\"\\n \")}`,\n );\n }\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Extract component schemas from a catalog in A2UI v0.9 inline format.\n * Vue-native equivalent of extractCatalogComponentSchemas.\n */\nfunction extractCatalogComponentSchemas(catalog?: Catalog<ComponentApi>): {\n catalogId: string;\n components: Record<string, Record<string, unknown>>;\n} {\n const resolved = catalog ?? vueBasicCatalog;\n const components: Record<string, Record<string, unknown>> = {};\n\n for (const [name, comp] of resolved.components) {\n const zodSchema = zodToJsonSchema(comp.schema, {\n target: \"jsonSchema2019-09\",\n }) as { properties?: Record<string, unknown>; required?: string[] };\n\n components[name] = {\n allOf: [\n { $ref: \"common_types.json#/$defs/ComponentCommon\" },\n {\n properties: {\n component: { const: name },\n ...(zodSchema.properties ?? {}),\n },\n required: [\"component\", ...(zodSchema.required ?? [])],\n },\n ],\n };\n }\n\n return { catalogId: resolved.id, components };\n}\n\n/**\n * Registers agent context describing the available A2UI catalog, component\n * schemas, and generation/design guidelines.\n *\n * Vue-native equivalent of React's `<A2UICatalogContext>` component.\n * Call from the provider's setup function.\n */\nexport function registerA2UICatalogContext(\n copilotkit: ShallowRef<CopilotKitCoreVue>,\n options: {\n enabled: () => boolean;\n catalog: () => Catalog<ComponentApi> | undefined;\n includeSchema: () => boolean;\n },\n): void {\n const contextValue = computed(() =>\n buildCatalogContextValue(options.catalog()),\n );\n\n // Register catalog capabilities context\n watch(\n [() => copilotkit.value, options.enabled, contextValue],\n ([core, isEnabled, value], _prev, onCleanup) => {\n if (!isEnabled) return;\n const id = core.addContext({\n description:\n \"A2UI catalog capabilities: available catalog IDs and \" +\n \"custom component definitions the client can render.\",\n value,\n });\n onCleanup(() => core.removeContext(id));\n },\n { immediate: true },\n );\n\n // Register schema + generation/design guidelines\n const schemaValue = computed(() => {\n if (!options.includeSchema()) return null;\n return JSON.stringify(extractCatalogComponentSchemas(options.catalog()));\n });\n\n watch(\n [() => copilotkit.value, options.enabled, schemaValue],\n ([core, isEnabled, schema], _prev, onCleanup) => {\n if (!isEnabled || !schema) return;\n const ids: string[] = [];\n ids.push(\n core.addContext({\n description: A2UI_SCHEMA_CONTEXT_DESCRIPTION,\n value: schema,\n }),\n );\n ids.push(\n core.addContext({\n description:\n \"A2UI generation guidelines — protocol rules, tool arguments, \" +\n \"path rules, data model format, and \" +\n \"form/two-way-binding instructions.\",\n value: A2UI_DEFAULT_GENERATION_GUIDELINES,\n }),\n );\n ids.push(\n core.addContext({\n description:\n \"A2UI design guidelines — visual design rules, component \" +\n \"hierarchy tips, and action handler patterns.\",\n value: A2UI_DEFAULT_DESIGN_GUIDELINES,\n }),\n );\n onCleanup(() => {\n for (const id of ids) core.removeContext(id);\n });\n },\n { immediate: true },\n );\n}\n","export function extractCompleteStyles(html: string): string {\n const matches = html.match(/<style\\b[^>]*>[\\s\\S]*?<\\/style>/gi);\n return matches ? matches.join(\"\") : \"\";\n}\n\nexport function processPartialHtml(html: string): string {\n let result = html;\n\n result = result.replace(/<[^>]*$/, \"\");\n result = result.replace(/<(style|script|head)\\b[^>]*>[\\s\\S]*?<\\/\\1>/gi, \"\");\n result = result.replace(/<(style|script|head)\\b[^>]*>[\\s\\S]*$/gi, \"\");\n result = result.replace(/&[a-zA-Z0-9#]*$/, \"\");\n\n const bodyMatch = result.match(/<body[^>]*>([\\s\\S]*)/i);\n if (bodyMatch) {\n result = bodyMatch[1]!;\n result = result.replace(/<\\/body>[\\s\\S]*/i, \"\");\n }\n\n return result;\n}\n","import { computed, inject, type ComputedRef, type Ref } from \"vue\";\nimport type { SandboxFunction } from \"../types\";\nimport { SandboxFunctionsKey } from \"./keys\";\n\nexport function useSandboxFunctions(): ComputedRef<readonly SandboxFunction[]> {\n const functionsRef = inject<Ref<readonly SandboxFunction[]>>(\n SandboxFunctionsKey,\n computed(() => []),\n );\n return computed(() => functionsRef.value);\n}\n","import {\n computed,\n defineComponent,\n h,\n onBeforeUnmount,\n ref,\n watch,\n type PropType,\n} from \"vue\";\nimport { z } from \"zod\";\nimport { ToolCallStatus } from \"@copilotkit/core\";\nimport {\n processPartialHtml,\n extractCompleteStyles,\n} from \"../lib/processPartialHtml\";\nimport { useSandboxFunctions } from \"../providers/SandboxFunctionsContext\";\n\nexport const OpenGenerativeUIActivityType = \"open-generative-ui\";\n\nexport const OpenGenerativeUIContentSchema = z.object({\n initialHeight: z.number().optional(),\n generating: z.boolean().optional(),\n css: z.string().optional(),\n cssComplete: z.boolean().optional(),\n html: z.array(z.string()).optional(),\n htmlComplete: z.boolean().optional(),\n jsFunctions: z.string().optional(),\n jsFunctionsComplete: z.boolean().optional(),\n jsExpressions: z.array(z.string()).optional(),\n jsExpressionsComplete: z.boolean().optional(),\n});\n\nexport type OpenGenerativeUIContent = z.infer<\n typeof OpenGenerativeUIContentSchema\n>;\n\nexport const GenerateSandboxedUiArgsSchema = z.object({\n initialHeight: z.number().optional(),\n placeholderMessages: z.array(z.string()).optional(),\n css: z.string().optional(),\n html: z.string().optional(),\n jsFunctions: z.string().optional(),\n jsExpressions: z.array(z.string()).optional(),\n});\n\nexport type GenerateSandboxedUiArgs = z.infer<\n typeof GenerateSandboxedUiArgsSchema\n>;\n\nfunction shouldFlushImmediately(\n previous: OpenGenerativeUIContent | null,\n next: OpenGenerativeUIContent,\n): boolean {\n if (next.cssComplete && (!previous || !previous.cssComplete)) return true;\n if (next.htmlComplete) return true;\n if (next.generating === false) return true;\n if (next.jsFunctions && (!previous || !previous.jsFunctions)) return true;\n if (\n (next.jsExpressions?.length ?? 0) > (previous?.jsExpressions?.length ?? 0)\n )\n return true;\n if (next.html?.length && (!previous || !previous.html?.length)) return true;\n return false;\n}\n\nfunction ensureHead(html: string): string {\n if (/<head[\\s>]/i.test(html)) return html;\n return `<head></head>${html}`;\n}\n\nfunction injectCssIntoHtml(html: string, css: string): string {\n const headCloseIdx = html.indexOf(\"</head>\");\n if (headCloseIdx !== -1) {\n return (\n html.slice(0, headCloseIdx) +\n `<style>${css}</style>` +\n html.slice(headCloseIdx)\n );\n }\n return `<head><style>${css}</style></head>${html}`;\n}\n\ntype SandboxInstance = {\n iframe: HTMLIFrameElement;\n promise: Promise<unknown>;\n run: (code: string | Function) => Promise<unknown>;\n destroy: () => void;\n};\n\ntype WebsandboxModule = {\n create: (\n localApi: Record<string, unknown>,\n options: {\n frameContainer: HTMLElement;\n frameContent: string;\n allowAdditionalAttributes: string;\n },\n ) => SandboxInstance;\n};\n\nasync function loadWebsandbox(): Promise<WebsandboxModule> {\n const mod = (await import(\"@jetbrains/websandbox\")) as any;\n return (mod.default?.default ?? mod.default) as WebsandboxModule;\n}\n\nexport const OpenGenerativeUIRenderer = defineComponent({\n name: \"OpenGenerativeUIRenderer\",\n props: {\n content: {\n type: Object as PropType<OpenGenerativeUIContent>,\n required: true,\n },\n },\n setup(props) {\n const sandboxFunctions = useSandboxFunctions();\n const containerRef = ref<HTMLElement | null>(null);\n const throttledContent = ref<OpenGenerativeUIContent>(props.content);\n const latestContent = ref<OpenGenerativeUIContent>(props.content);\n const throttleTimer = ref<number | null>(null);\n const sandboxRef = ref<SandboxInstance | null>(null);\n const previewSandboxRef = ref<SandboxInstance | null>(null);\n const sandboxReady = ref(false);\n const previewReady = ref(false);\n const executedExpressionIndex = ref(0);\n const jsFunctionsInjected = ref(false);\n const pendingQueue = ref<string[]>([]);\n\n const localApi = computed(() => {\n const api: Record<string, unknown> = {};\n for (const fn of sandboxFunctions.value) {\n api[fn.name] = fn.handler;\n }\n return api;\n });\n\n watch(\n () => props.content,\n (next) => {\n latestContent.value = next;\n if (shouldFlushImmediately(throttledContent.value, next)) {\n if (throttleTimer.value !== null) {\n window.clearTimeout(throttleTimer.value);\n throttleTimer.value = null;\n }\n throttledContent.value = next;\n return;\n }\n if (throttleTimer.value === null) {\n throttleTimer.value = window.setTimeout(() => {\n throttledContent.value = latestContent.value;\n throttleTimer.value = null;\n }, 1000);\n }\n },\n { immediate: true },\n );\n\n onBeforeUnmount(() => {\n if (throttleTimer.value !== null) {\n window.clearTimeout(throttleTimer.value);\n }\n });\n\n const partialHtml = computed(() => {\n if (throttledContent.value.htmlComplete) return undefined;\n if (!throttledContent.value.html?.length) return undefined;\n return throttledContent.value.html.join(\"\");\n });\n const previewBody = computed(() =>\n partialHtml.value ? processPartialHtml(partialHtml.value) : undefined,\n );\n const previewStyles = computed(() =>\n partialHtml.value ? extractCompleteStyles(partialHtml.value) : \"\",\n );\n const fullHtml = computed(() =>\n throttledContent.value.htmlComplete && throttledContent.value.html?.length\n ? throttledContent.value.html.join(\"\")\n : undefined,\n );\n const css = computed(() =>\n throttledContent.value.cssComplete\n ? throttledContent.value.css\n : undefined,\n );\n const hasPreview = computed(\n () =>\n !!throttledContent.value.cssComplete &&\n !!previewBody.value &&\n previewBody.value.trim().length > 0,\n );\n const hasVisibleSandbox = computed(\n () => !!fullHtml.value || hasPreview.value,\n );\n const resolvedHeight = computed(\n () => `${throttledContent.value.initialHeight ?? 200}px`,\n );\n\n const destroyPreview = () => {\n if (previewSandboxRef.value) {\n previewSandboxRef.value.destroy();\n previewSandboxRef.value = null;\n }\n previewReady.value = false;\n };\n\n const destroyFinal = () => {\n if (sandboxRef.value) {\n sandboxRef.value.destroy();\n sandboxRef.value = null;\n }\n sandboxReady.value = false;\n pendingQueue.value = [];\n executedExpressionIndex.value = 0;\n jsFunctionsInjected.value = false;\n };\n\n watch(\n [\n hasPreview,\n fullHtml,\n css,\n previewBody,\n previewStyles,\n () => containerRef.value,\n ],\n async ([previewVisible, htmlComplete], _previous, onCleanup) => {\n if (!previewVisible || htmlComplete || !containerRef.value) return;\n if (previewSandboxRef.value) return;\n\n let cancelled = false;\n try {\n const Websandbox = await loadWebsandbox();\n if (cancelled || !containerRef.value) return;\n\n const sandbox = Websandbox.create(\n {},\n {\n frameContainer: containerRef.value,\n frameContent: \"<head></head><body></body>\",\n allowAdditionalAttributes: \"\",\n },\n );\n previewSandboxRef.value = sandbox;\n sandbox.iframe.setAttribute(\n \"data-testid\",\n \"open-generative-ui-preview-sandbox\",\n );\n sandbox.iframe.style.width = \"100%\";\n sandbox.iframe.style.height = \"100%\";\n sandbox.iframe.style.border = \"none\";\n sandbox.iframe.style.backgroundColor = \"transparent\";\n\n sandbox.promise.then(() => {\n if (cancelled || !previewSandboxRef.value) return;\n previewReady.value = true;\n void sandbox.run(\n \"var s=document.createElement('style');s.textContent='html, body { overflow: hidden !important; }';document.head.appendChild(s);\",\n );\n });\n } catch (error) {\n console.error(\n \"[OpenGenerativeUI] Failed to load sandbox module:\",\n error,\n );\n }\n\n onCleanup(() => {\n cancelled = true;\n });\n },\n { immediate: true },\n );\n\n watch(\n [previewBody, previewStyles, css, previewReady],\n ([body, styles, cssText, ready]) => {\n if (!previewSandboxRef.value || !ready) return;\n const headParts: string[] = [];\n if (cssText) headParts.push(`<style>${cssText}</style>`);\n if (styles) headParts.push(styles);\n if (headParts.length) {\n void previewSandboxRef.value.run(\n `document.head.innerHTML = ${JSON.stringify(headParts.join(\"\"))}`,\n );\n }\n if (body) {\n void previewSandboxRef.value.run(\n `document.body.innerHTML = ${JSON.stringify(body)}`,\n );\n }\n },\n { immediate: true },\n );\n\n watch(\n [fullHtml, css, localApi, () => containerRef.value],\n async ([html, cssText, api], _previous, onCleanup) => {\n destroyFinal();\n if (!html || !containerRef.value) return;\n destroyPreview();\n\n let cancelled = false;\n try {\n const Websandbox = await loadWebsandbox();\n if (cancelled || !containerRef.value) return;\n const htmlWithHead = ensureHead(html);\n const htmlWithCss = cssText\n ? injectCssIntoHtml(htmlWithHead, cssText)\n : htmlWithHead;\n const sandbox = Websandbox.create(api, {\n frameContainer: containerRef.value,\n frameContent: htmlWithCss,\n allowAdditionalAttributes: \"\",\n });\n sandboxRef.value = sandbox;\n sandbox.iframe.setAttribute(\n \"data-testid\",\n \"open-generative-ui-final-sandbox\",\n );\n sandbox.iframe.style.width = \"100%\";\n sandbox.iframe.style.height = \"100%\";\n sandbox.iframe.style.border = \"none\";\n sandbox.iframe.style.backgroundColor = \"transparent\";\n\n sandbox.promise.then(() => {\n if (cancelled || !sandboxRef.value) return;\n sandboxReady.value = true;\n void sandbox.run(\n \"var s=document.createElement('style');s.textContent='html, body { overflow: hidden !important; }';document.head.appendChild(s);\",\n );\n const functionsCode = throttledContent.value.jsFunctions;\n if (functionsCode && !jsFunctionsInjected.value) {\n jsFunctionsInjected.value = true;\n pendingQueue.value.unshift(functionsCode);\n }\n const expressions = throttledContent.value.jsExpressions;\n if (expressions?.length) {\n const startIndex = executedExpressionIndex.value;\n if (startIndex < expressions.length) {\n pendingQueue.value.push(...expressions.slice(startIndex));\n executedExpressionIndex.value = expressions.length;\n }\n }\n const queue = [...pendingQueue.value];\n pendingQueue.value = [];\n for (const code of queue) {\n void sandbox.run(code);\n }\n });\n } catch (error) {\n console.error(\n \"[OpenGenerativeUI] Failed to load sandbox module:\",\n error,\n );\n }\n\n onCleanup(() => {\n cancelled = true;\n });\n },\n { immediate: true },\n );\n\n watch(\n () => throttledContent.value.jsFunctions,\n (functionsCode) => {\n if (!functionsCode || jsFunctionsInjected.value) return;\n jsFunctionsInjected.value = true;\n if (sandboxReady.value && sandboxRef.value) {\n void sandboxRef.value.run(functionsCode);\n } else {\n pendingQueue.value.push(functionsCode);\n }\n },\n );\n\n watch(\n () => throttledContent.value.jsExpressions,\n (expressions) => {\n if (!expressions?.length) return;\n const startIndex = executedExpressionIndex.value;\n if (startIndex >= expressions.length) return;\n const newExpressions = expressions.slice(startIndex);\n executedExpressionIndex.value = expressions.length;\n if (sandboxReady.value && sandboxRef.value) {\n for (const expression of newExpressions) {\n void sandboxRef.value.run(expression);\n }\n } else {\n pendingQueue.value.push(...newExpressions);\n }\n },\n { deep: true },\n );\n\n const isGenerating = computed(\n () => throttledContent.value.generating !== false,\n );\n watch(\n [hasPreview, fullHtml],\n ([previewVisible, html]) => {\n if (html) destroyPreview();\n if (!previewVisible) destroyPreview();\n },\n { immediate: true },\n );\n\n onBeforeUnmount(() => {\n if (throttleTimer.value !== null) {\n window.clearTimeout(throttleTimer.value);\n }\n destroyPreview();\n destroyFinal();\n });\n\n return () =>\n h(\n \"div\",\n {\n ref: containerRef,\n \"data-testid\": \"open-generative-ui-renderer\",\n style: {\n position: \"relative\",\n width: \"100%\",\n height: resolvedHeight.value,\n borderRadius: \"8px\",\n backgroundColor: hasVisibleSandbox.value\n ? \"transparent\"\n : \"#f5f5f5\",\n border: hasVisibleSandbox.value ? \"none\" : \"1px solid #e0e0e0\",\n overflow: \"hidden\",\n display: hasVisibleSandbox.value ? \"block\" : \"flex\",\n alignItems: hasVisibleSandbox.value ? undefined : \"center\",\n justifyContent: hasVisibleSandbox.value ? undefined : \"center\",\n },\n },\n [\n !hasVisibleSandbox.value\n ? h(\"div\", { \"data-testid\": \"open-generative-ui-placeholder\" }, [\n h(\n \"svg\",\n {\n width: \"48\",\n height: \"48\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n style: { animation: \"ck-spin 1s linear infinite\" },\n },\n [\n h(\"circle\", {\n cx: \"12\",\n cy: \"12\",\n r: \"10\",\n stroke: \"#e0e0e0\",\n \"stroke-width\": \"3\",\n }),\n h(\"path\", {\n d: \"M12 2a10 10 0 0 1 10 10\",\n stroke: \"#999\",\n \"stroke-width\": \"3\",\n \"stroke-linecap\": \"round\",\n }),\n ],\n ),\n h(\n \"style\",\n \"@keyframes ck-spin { to { transform: rotate(360deg) } }\",\n ),\n ])\n : null,\n isGenerating.value\n ? h(\"div\", {\n \"data-testid\": \"open-generative-ui-progress-overlay\",\n style: {\n position: \"absolute\",\n inset: 0,\n backgroundColor: \"rgba(255,255,255,0.45)\",\n },\n })\n : null,\n ],\n );\n },\n});\n\nexport const OpenGenerativeUIActivityRenderer = defineComponent({\n name: \"OpenGenerativeUIActivityRenderer\",\n props: {\n activityType: { type: String, required: true },\n content: {\n type: Object as PropType<OpenGenerativeUIContent>,\n required: true,\n },\n message: { type: Object as PropType<unknown>, required: true },\n agent: {\n type: Object as PropType<unknown>,\n required: false,\n default: undefined,\n },\n },\n setup(props) {\n return () => h(OpenGenerativeUIRenderer, { content: props.content });\n },\n});\n\nexport const OpenGenerativeUIToolRenderer = defineComponent({\n name: \"OpenGenerativeUIToolRenderer\",\n props: {\n name: { type: String, required: true },\n args: {\n type: Object as PropType<Partial<GenerateSandboxedUiArgs>>,\n required: true,\n },\n status: { type: String as PropType<ToolCallStatus>, required: true },\n result: { type: String as PropType<string | undefined>, required: false },\n },\n setup(props) {\n const visibleMessageIndex = ref(0);\n\n watch(\n () => props.args.placeholderMessages,\n (messages, _, onCleanup) => {\n if (!messages?.length || props.status === ToolCallStatus.Complete)\n return;\n visibleMessageIndex.value = Math.max(messages.length - 1, 0);\n const timer = window.setInterval(() => {\n visibleMessageIndex.value =\n (visibleMessageIndex.value + 1) % Math.max(messages.length, 1);\n }, 5000);\n onCleanup(() => window.clearInterval(timer));\n },\n { immediate: true },\n );\n\n return () => {\n if (props.status === ToolCallStatus.Complete) return null;\n const messages = props.args.placeholderMessages;\n if (!messages?.length) return null;\n const currentMessage = messages[visibleMessageIndex.value] ?? messages[0];\n return h(\n \"div\",\n {\n style: { padding: \"8px 12px\", color: \"#999\", fontSize: \"14px\" },\n \"data-testid\": \"open-generative-ui-tool-placeholder\",\n },\n currentMessage,\n );\n };\n },\n});\n","import type { InjectionKey, Ref } from \"vue\";\nimport { ref } from \"vue\";\nimport {\n createLicenseContextValue,\n type LicenseContextValue,\n} from \"@copilotkit/shared\";\n\nexport type { LicenseContextValue };\nexport { createLicenseContextValue };\n\nexport const LicenseContextKey: InjectionKey<Ref<LicenseContextValue>> =\n Symbol(\"LicenseContext\");\n\nexport function createDefaultLicenseRef(): Ref<LicenseContextValue> {\n return ref(createLicenseContextValue(null));\n}\n","<script setup lang=\"ts\">\nimport { computed, getCurrentInstance, onBeforeUnmount, onMounted } from \"vue\";\n\n// Total reserved vertical space for the fixed license banner: banner height\n// (~36px) + bottom offset (8px) + visual gap above the chat input (~8px).\nconst LICENSE_BANNER_OFFSET_PX = 52;\nconst LICENSE_BANNER_OFFSET_VAR = \"--copilotkit-license-banner-offset\";\n\ntype LicenseBannerType =\n | \"no_license\"\n | \"expired\"\n | \"expiring\"\n | \"invalid\"\n | \"feature_unlicensed\";\n\nconst props = withDefaults(\n defineProps<{\n type: LicenseBannerType;\n featureName?: string;\n expiryDate?: string;\n graceRemaining?: number;\n }>(),\n {\n featureName: undefined,\n expiryDate: undefined,\n graceRemaining: undefined,\n },\n);\n\nconst emit = defineEmits<{\n dismiss: [];\n}>();\n\ninterface BannerSpec {\n severity: \"info\" | \"warning\" | \"critical\";\n message: string;\n actionLabel: string;\n actionUrl: string;\n}\n\nconst spec = computed<BannerSpec | null>(() => {\n switch (props.type) {\n case \"no_license\":\n return {\n severity: \"info\",\n message: \"Powered by CopilotKit\",\n actionLabel: \"Get a license\",\n actionUrl: \"https://copilotkit.ai/pricing\",\n };\n case \"feature_unlicensed\":\n return {\n severity: \"warning\",\n message: `⚠ The \"${props.featureName ?? \"\"}\" feature requires a CopilotKit license.`,\n actionLabel: \"Get a license\",\n actionUrl: \"https://copilotkit.ai/pricing\",\n };\n case \"expiring\": {\n const days = props.graceRemaining;\n const dayLabel = days === 1 ? \"day\" : \"days\";\n return {\n severity: \"warning\",\n message: `Your CopilotKit license expires in ${days} ${dayLabel}. Please renew.`,\n actionLabel: \"Renew\",\n actionUrl: \"https://cloud.copilotkit.ai\",\n };\n }\n case \"expired\":\n return {\n severity: \"critical\",\n message: `Your CopilotKit license expired${props.expiryDate ? ` on ${props.expiryDate}` : \"\"}. Please renew at copilotkit.ai/pricing`,\n actionLabel: \"Renew now\",\n actionUrl: \"https://copilotkit.ai/pricing\",\n };\n case \"invalid\":\n return {\n severity: \"critical\",\n message:\n \"Invalid CopilotKit license token. Please check your configuration.\",\n actionLabel: \"Get a license\",\n actionUrl: \"https://copilotkit.ai/pricing\",\n };\n default:\n return null;\n }\n});\n\nconst baseStyle = {\n position: \"fixed\",\n bottom: \"8px\",\n left: \"50%\",\n transform: \"translateX(-50%)\",\n zIndex: 99999,\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: \"12px\",\n whiteSpace: \"nowrap\",\n padding: \"8px 16px\",\n fontSize: \"13px\",\n fontFamily:\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif\",\n borderRadius: \"6px\",\n boxShadow: \"0 2px 8px rgba(0, 0, 0, 0.15)\",\n} as const;\n\nconst severityStyle = computed(() => {\n switch (spec.value?.severity) {\n case \"warning\":\n return {\n backgroundColor: \"#fffbeb\",\n border: \"1px solid #fbbf24\",\n color: \"#92400e\",\n };\n case \"critical\":\n return {\n backgroundColor: \"#fef2f2\",\n border: \"1px solid #fca5a5\",\n color: \"#991b1b\",\n };\n default:\n return {\n backgroundColor: \"#eff6ff\",\n border: \"1px solid #93c5fd\",\n color: \"#1e40af\",\n };\n }\n});\n\nconst containerStyle = computed(() => ({\n ...baseStyle,\n ...severityStyle.value,\n}));\n\nconst instance = getCurrentInstance();\nconst hasDismissListener = computed(() => {\n const vnodeProps = (instance?.vnode.props ?? {}) as Record<string, unknown>;\n return typeof vnodeProps.onDismiss === \"function\";\n});\n\nfunction handleDismiss() {\n emit(\"dismiss\");\n}\n\n// Publish the banner's reserved bottom offset so the chat input can lift\n// itself above it via padding-bottom: var(--copilotkit-license-banner-offset).\nonMounted(() => {\n if (typeof document === \"undefined\") return;\n document.documentElement.style.setProperty(\n LICENSE_BANNER_OFFSET_VAR,\n `${LICENSE_BANNER_OFFSET_PX}px`,\n );\n});\n\nonBeforeUnmount(() => {\n if (typeof document === \"undefined\") return;\n document.documentElement.style.removeProperty(LICENSE_BANNER_OFFSET_VAR);\n});\n</script>\n\n<template>\n <div v-if=\"spec\" :style=\"containerStyle\" data-testid=\"copilot-license-banner\">\n <span>{{ spec.message }}</span>\n <div\n :style=\"{\n display: 'flex',\n gap: '8px',\n alignItems: 'center',\n }\"\n >\n <a\n :href=\"spec.actionUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n :style=\"{\n fontWeight: 600,\n textDecoration: 'underline',\n color: 'inherit',\n }\"\n >\n {{ spec.actionLabel }}\n </a>\n <button\n v-if=\"hasDismissListener\"\n :style=\"{\n background: 'none',\n border: 'none',\n cursor: 'pointer',\n color: 'inherit',\n fontSize: '16px',\n }\"\n @click=\"handleDismiss\"\n >\n ×\n </button>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport {\n computed,\n onMounted,\n provide,\n ref,\n shallowRef,\n triggerRef,\n watch,\n} from \"vue\";\nimport { z } from \"zod\";\nimport type { AbstractAgent } from \"@ag-ui/client\";\nimport type {\n CopilotKitCoreErrorCode,\n CopilotKitCoreSubscriber,\n FrontendTool,\n} from \"@copilotkit/core\";\nimport { schemaToJsonSchema } from \"@copilotkit/shared\";\nimport { zodToJsonSchema } from \"zod-to-json-schema\";\nimport { CopilotKitCoreVue } from \"../lib/vue-core\";\nimport { createA2UIMessageRenderer } from \"../components/A2UIMessageRenderer\";\nimport { registerA2UIBuiltInToolCallRenderer } from \"../components/a2ui/A2UIBuiltInToolCallRenderer\";\nimport { registerA2UICatalogContext } from \"../components/a2ui/A2UICatalogContext\";\nimport {\n GenerateSandboxedUiArgsSchema,\n OpenGenerativeUIActivityRenderer,\n OpenGenerativeUIActivityType,\n OpenGenerativeUIContentSchema,\n OpenGenerativeUIToolRenderer,\n} from \"../components/OpenGenerativeUIRenderer\";\nimport {\n MCPAppsActivityContentSchema,\n MCPAppsActivityRenderer,\n MCPAppsActivityType,\n} from \"../components/MCPAppsActivityRenderer\";\nimport { CopilotKitKey, SandboxFunctionsKey } from \"./keys\";\nimport {\n LicenseContextKey,\n createLicenseContextValue,\n type LicenseContextValue,\n} from \"./license-context\";\nimport CopilotKitInspector from \"../components/CopilotKitInspector.vue\";\nimport LicenseWarningBanner from \"../components/LicenseWarningBanner.vue\";\nimport type { CopilotKitProviderProps } from \"./CopilotKitProvider.types\";\nimport type {\n SandboxFunction,\n VueActivityMessageRenderer,\n VueFrontendTool,\n VueHumanInTheLoop,\n VueToolCallRenderer,\n} from \"../types\";\n\nconst HEADER_NAME = \"X-CopilotCloud-Public-Api-Key\";\nconst COPILOT_CLOUD_CHAT_URL = \"https://api.cloud.copilotkit.ai/copilotkit/v1\";\n\n// Canonical A2UI viewer theme default (matches @copilotkit/a2ui-renderer).\n// Defined locally to avoid pulling React dependencies from a2ui-renderer.\nconst viewerTheme: Record<string, unknown> = {};\n\nconst FRONTEND_TOOLS_STABLE_WARNING =\n \"frontendTools must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.\";\nconst HUMAN_IN_THE_LOOP_STABLE_WARNING =\n \"humanInTheLoop must be a stable array. If you want to dynamically add or remove human-in-the-loop tools, use `useHumanInTheLoop` instead.\";\nconst RENDER_CUSTOM_MESSAGES_STABLE_WARNING =\n \"renderCustomMessages must be a stable array.\";\nconst RENDER_ACTIVITY_MESSAGES_STABLE_WARNING =\n \"renderActivityMessages must be a stable array.\";\nconst SANDBOX_FUNCTIONS_STABLE_WARNING =\n \"openGenerativeUI.sandboxFunctions must be a stable array.\";\nconst DEFAULT_DESIGN_SKILL = `When generating UI with generateSandboxedUi, follow these design principles inspired by shadcn/ui:\n\n- Use a minimal, flat aesthetic. Avoid drop shadows and gradients — rely on subtle borders (1px solid, light gray like #e5e7eb) to define surfaces.\n- Neutral base palette: white backgrounds, zinc/slate gray text (#09090b for headings, #71717a for secondary text). One accent color for interactive elements.\n- Use system font stacks (system-ui, -apple-system, sans-serif) at readable sizes (14px body, 600 weight for headings). Tight line-heights.\n- Small, consistent border-radius (6–8px). Cards and containers use border, not shadow, for separation.\n- Buttons: solid fill for primary (dark bg, white text), outline for secondary (border + transparent bg). Subtle hover state (slight opacity or background shift).\n- Use CSS Grid or Flexbox for layout. Ensure the UI looks good at any width.\n- Minimal transitions (150ms) for hover/focus states only. No decorative animations.\n- Keep the UI focused and dense — avoid excessive padding. Use compact spacing (8–12px gaps, 10–14px padding in controls).`;\n\nconst GENERATE_SANDBOXED_UI_DESCRIPTION =\n \"Generate sandboxed UI. \" +\n \"IMPORTANT: The generated code runs in a sandboxed iframe WITHOUT same-origin access. \" +\n \"Do NOT use localStorage, sessionStorage, document.cookie, IndexedDB, or fetch/XMLHttpRequest to same-origin URLs. \" +\n \"To communicate with the host application, use Websandbox.connection.remote.<functionName>(args) which returns a Promise.\\n\\n\" +\n \"You CAN use external libraries from CDNs by including <script> or <link> tags in the HTML <head> (e.g., Chart.js, D3, Three.js, x-data-spreadsheet, etc.). \" +\n \"CDN resources load normally inside the sandbox.\\n\\n\" +\n \"PARAMETER ORDER IS CRITICAL — generate parameters in exactly this order:\\n\" +\n \"1. initialHeight + placeholderMessages (shown to user while generating)\\n\" +\n \"2. css (all styles FIRST — the user sees a placeholder until CSS is complete)\\n\" +\n \"3. html (streams in live — the user watches the UI build as HTML is generated)\\n\" +\n \"4. jsFunctions (reusable helper functions)\\n\" +\n \"5. jsExpressions (applied one-by-one — the user sees each expression take effect)\";\n\nconst props = withDefaults(defineProps<CopilotKitProviderProps>(), {\n headers: () => ({}),\n properties: () => ({}),\n agents__unsafe_dev_only: () => ({}),\n selfManagedAgents: () => ({}),\n frontendTools: () => [],\n humanInTheLoop: () => [],\n renderCustomMessages: () => [],\n renderActivityMessages: () => [],\n openGenerativeUI: undefined,\n showDevConsole: false,\n useSingleEndpoint: undefined,\n a2ui: undefined,\n});\n\nconst shouldRenderInspector = ref(false);\n\nconst updateInspectorVisibility = () => {\n if (props.showDevConsole === true) {\n shouldRenderInspector.value = true;\n return;\n }\n if (props.showDevConsole === \"auto\") {\n if (typeof window === \"undefined\") {\n shouldRenderInspector.value = false;\n return;\n }\n const localhostHosts = new Set([\"localhost\", \"127.0.0.1\"]);\n shouldRenderInspector.value = localhostHosts.has(window.location.hostname);\n return;\n }\n shouldRenderInspector.value = false;\n};\n\nwatch(() => props.showDevConsole, updateInspectorVisibility, {\n immediate: true,\n});\n\nconst initialFrontendTools = props.frontendTools;\nconst initialHumanInTheLoop = props.humanInTheLoop;\nconst initialRenderCustomMessages = props.renderCustomMessages;\nconst initialRenderActivityMessages = props.renderActivityMessages;\nconst initialSandboxFunctions = props.openGenerativeUI?.sandboxFunctions;\n\nwatch(\n () => props.frontendTools,\n (next) => {\n if (next !== initialFrontendTools) {\n console.error(FRONTEND_TOOLS_STABLE_WARNING);\n }\n },\n);\n\nwatch(\n () => props.humanInTheLoop,\n (next) => {\n if (next !== initialHumanInTheLoop) {\n console.error(HUMAN_IN_THE_LOOP_STABLE_WARNING);\n }\n },\n);\n\nwatch(\n () => props.renderCustomMessages,\n (next) => {\n if (next !== initialRenderCustomMessages) {\n console.error(RENDER_CUSTOM_MESSAGES_STABLE_WARNING);\n }\n },\n);\n\nwatch(\n () => props.renderActivityMessages,\n (next) => {\n if (next !== initialRenderActivityMessages) {\n console.error(RENDER_ACTIVITY_MESSAGES_STABLE_WARNING);\n }\n },\n);\n\nwatch(\n () => props.openGenerativeUI?.sandboxFunctions,\n (next) => {\n if (next !== initialSandboxFunctions) {\n console.error(SANDBOX_FUNCTIONS_STABLE_WARNING);\n }\n },\n);\n\nconst resolvedPublicKey = computed(\n () => props.publicApiKey ?? props.publicLicenseKey,\n);\nconst mergedAgents = computed(() => ({\n ...props.agents__unsafe_dev_only,\n ...props.selfManagedAgents,\n}));\nconst hasLocalAgents = computed(\n () => Object.keys(mergedAgents.value).length > 0,\n);\n\nconst resolvedHeaders = computed(() =>\n typeof props.headers === \"function\" ? props.headers() : props.headers,\n);\n\nconst mergedHeaders = computed(() => {\n const headers = resolvedHeaders.value;\n if (!resolvedPublicKey.value) return headers;\n if (headers[HEADER_NAME]) return headers;\n return { ...headers, [HEADER_NAME]: resolvedPublicKey.value };\n});\n\nconst chatApiEndpoint = computed(\n () =>\n props.runtimeUrl ??\n (resolvedPublicKey.value ? COPILOT_CLOUD_CHAT_URL : undefined),\n);\n\nwatch(\n [chatApiEndpoint, resolvedPublicKey, hasLocalAgents],\n ([endpoint, publicKey, localAgents]) => {\n if (endpoint || publicKey || localAgents) return;\n const msg =\n \"Missing required prop: 'runtimeUrl' or 'publicApiKey' or 'publicLicenseKey'\";\n if (process.env.NODE_ENV === \"production\") {\n throw new Error(msg);\n }\n console.warn(msg);\n },\n { immediate: true },\n);\n\nconst processedHumanInTheLoop = computed(() => {\n const tools: FrontendTool[] = [];\n const renderToolCalls: VueToolCallRenderer<unknown>[] = [];\n\n for (const tool of props.humanInTheLoop) {\n tools.push({\n name: tool.name,\n description: tool.description,\n parameters: tool.parameters,\n followUp: tool.followUp,\n ...(tool.agentId && { agentId: tool.agentId }),\n handler: async () => {\n console.warn(\n `Human-in-the-loop tool '${tool.name}' called but no interactive handler is set up.`,\n );\n return undefined;\n },\n });\n if (tool.render) {\n renderToolCalls.push({\n name: tool.name,\n args: tool.parameters ?? z.any(),\n render: tool.render,\n ...(tool.agentId && { agentId: tool.agentId }),\n } as VueToolCallRenderer<unknown>);\n }\n }\n return { tools, renderToolCalls };\n});\n\nconst allTools = computed(() => {\n const tools: FrontendTool[] = [];\n for (const t of props.frontendTools) {\n tools.push(t as FrontendTool);\n }\n for (const t of builtInFrontendTools.value) {\n tools.push(t as FrontendTool);\n }\n tools.push(...processedHumanInTheLoop.value.tools);\n return tools;\n});\n\nconst allRenderToolCalls = computed(() => {\n const combined: VueToolCallRenderer<unknown>[] = [\n ...(props.renderToolCalls ?? []),\n ];\n for (const tool of [...props.frontendTools, ...builtInFrontendTools.value]) {\n if (tool.render) {\n const args = tool.parameters ?? (tool.name === \"*\" ? z.any() : undefined);\n if (args) {\n combined.push({\n name: tool.name,\n args,\n render: tool.render,\n } as VueToolCallRenderer<unknown>);\n }\n }\n }\n combined.push(...processedHumanInTheLoop.value.renderToolCalls);\n return combined;\n});\n\nconst allRenderCustomMessages = computed(\n () => props.renderCustomMessages ?? [],\n);\nconst runtimeA2UIEnabled = ref(false);\nconst runtimeOpenGenerativeUIEnabled = ref(false);\nconst runtimeLicenseStatus = ref<string | undefined>(undefined);\nconst openGenerativeUIActive = computed(\n () => runtimeOpenGenerativeUIEnabled.value || !!props.openGenerativeUI,\n);\nconst sandboxFunctions = computed<readonly SandboxFunction[]>(\n () => props.openGenerativeUI?.sandboxFunctions ?? [],\n);\nconst zodToJsonSchemaCompat = (\n schema: unknown,\n options?: { $refStrategy?: string },\n): Record<string, unknown> =>\n zodToJsonSchema(\n schema as z.ZodTypeAny,\n options as { $refStrategy?: \"none\" | \"relative\" | \"root\" | \"seen\" },\n ) as Record<string, unknown>;\n\nconst builtInFrontendTools = computed<VueFrontendTool[]>(() => {\n if (!openGenerativeUIActive.value) return [];\n return [\n {\n name: \"generateSandboxedUi\",\n description: GENERATE_SANDBOXED_UI_DESCRIPTION,\n parameters: GenerateSandboxedUiArgsSchema,\n handler: async () => \"UI generated\",\n followUp: true,\n render:\n OpenGenerativeUIToolRenderer as unknown as VueFrontendTool[\"render\"],\n } as VueFrontendTool,\n ];\n});\n\nconst builtInActivityRenderers = computed<\n VueActivityMessageRenderer<unknown>[]\n>(() => {\n const renderers: VueActivityMessageRenderer<unknown>[] = [\n {\n activityType: MCPAppsActivityType,\n content: MCPAppsActivityContentSchema as unknown as z.ZodSchema<unknown>,\n render:\n MCPAppsActivityRenderer as unknown as VueActivityMessageRenderer<unknown>[\"render\"],\n },\n ];\n\n if (openGenerativeUIActive.value) {\n renderers.push({\n activityType: OpenGenerativeUIActivityType,\n content: OpenGenerativeUIContentSchema as unknown as z.ZodSchema<unknown>,\n render:\n OpenGenerativeUIActivityRenderer as unknown as VueActivityMessageRenderer<unknown>[\"render\"],\n });\n }\n\n if (runtimeA2UIEnabled.value) {\n renderers.unshift(\n createA2UIMessageRenderer({\n theme: props.a2ui?.theme ?? viewerTheme,\n catalog: props.a2ui?.catalog,\n loadingComponent: props.a2ui?.loadingComponent,\n }),\n );\n }\n\n return renderers;\n});\n\nconst allRenderActivityMessages = computed(() => [\n ...(props.renderActivityMessages ?? []),\n ...builtInActivityRenderers.value,\n]);\n\nconst applyDefaultThrottleMs = (core: CopilotKitCoreVue) => {\n if (\n props.defaultThrottleMs !== undefined &&\n (!Number.isFinite(props.defaultThrottleMs) || props.defaultThrottleMs < 0)\n ) {\n console.error(\n `CopilotKitProvider: defaultThrottleMs must be a non-negative finite number, got ${props.defaultThrottleMs}. useAgent hooks without an explicit throttleMs will fall back to unthrottled.`,\n );\n }\n core.setDefaultThrottleMs(props.defaultThrottleMs);\n};\n\nconst createCopilotKit = () => {\n const core = new CopilotKitCoreVue({\n runtimeUrl: chatApiEndpoint.value,\n runtimeTransport:\n props.useSingleEndpoint === true\n ? \"single\"\n : props.useSingleEndpoint === false\n ? \"rest\"\n : \"auto\",\n headers: mergedHeaders.value,\n credentials: props.credentials,\n properties: props.properties,\n agents__unsafe_dev_only: mergedAgents.value,\n tools: allTools.value,\n renderToolCalls: allRenderToolCalls.value,\n renderActivityMessages: allRenderActivityMessages.value,\n renderCustomMessages: allRenderCustomMessages.value,\n debug: props.debug,\n });\n // Initialize synchronously so child hooks can read the value on first render.\n applyDefaultThrottleMs(core);\n return core;\n};\n\nconst copilotkit = shallowRef<CopilotKitCoreVue>(createCopilotKit());\nconst didMountRef = ref(false);\n\nconst executingToolCallIds = ref<ReadonlySet<string>>(new Set());\n\nwatch(\n copilotkit,\n (core, _, onCleanup) => {\n const sub1 = core.subscribe({\n onToolExecutionStart: ({\n toolCallId,\n }: Parameters<\n NonNullable<CopilotKitCoreSubscriber[\"onToolExecutionStart\"]>\n >[0]) => {\n executingToolCallIds.value = new Set(executingToolCallIds.value).add(\n toolCallId,\n );\n },\n onToolExecutionEnd: ({\n toolCallId,\n }: Parameters<\n NonNullable<CopilotKitCoreSubscriber[\"onToolExecutionEnd\"]>\n >[0]) => {\n setTimeout(() => {\n const next = new Set(executingToolCallIds.value);\n next.delete(toolCallId);\n executingToolCallIds.value = next;\n triggerRef(copilotkit);\n }, 0);\n },\n });\n const sub2 = core.subscribe({\n onRenderToolCallsChanged: () => {\n triggerRef(copilotkit);\n },\n });\n const sub3 = core.subscribe({\n onRenderCustomMessagesChanged: () => {\n triggerRef(copilotkit);\n },\n });\n const sub4 = core.subscribe({\n onRuntimeConnectionStatusChanged: () => {\n runtimeA2UIEnabled.value = core.a2uiEnabled;\n runtimeOpenGenerativeUIEnabled.value = core.openGenerativeUIEnabled;\n runtimeLicenseStatus.value = core.licenseStatus;\n triggerRef(copilotkit);\n },\n });\n const sub5 = core.subscribe({\n onError: (event: {\n error: Error;\n code: CopilotKitCoreErrorCode;\n context: Record<string, any>;\n }) => {\n void props.onError?.({\n error: event.error,\n code: event.code,\n context: event.context,\n });\n },\n });\n onCleanup(() => {\n sub1.unsubscribe();\n sub2.unsubscribe();\n sub3.unsubscribe();\n sub4.unsubscribe();\n sub5.unsubscribe();\n });\n },\n { immediate: true },\n);\n\nwatch([allTools], ([tools]) => {\n if (!didMountRef.value) return;\n copilotkit.value.setTools(tools);\n});\n\nwatch([allRenderToolCalls], ([renderToolCalls]) => {\n if (!didMountRef.value) return;\n copilotkit.value.setRenderToolCalls(renderToolCalls);\n});\n\nwatch([allRenderCustomMessages], ([renderCustomMessages]) => {\n if (!didMountRef.value) return;\n copilotkit.value.setRenderCustomMessages(renderCustomMessages);\n triggerRef(copilotkit);\n});\n\nwatch([allRenderActivityMessages], ([renderActivityMessages]) => {\n if (!didMountRef.value) return;\n copilotkit.value.setRenderActivityMessages(renderActivityMessages);\n triggerRef(copilotkit);\n});\n\nfunction syncRuntimeConfig() {\n copilotkit.value.setRuntimeUrl(chatApiEndpoint.value);\n copilotkit.value.setRuntimeTransport(\n props.useSingleEndpoint === true\n ? \"single\"\n : props.useSingleEndpoint === false\n ? \"rest\"\n : \"auto\",\n );\n copilotkit.value.setHeaders(mergedHeaders.value);\n copilotkit.value.setCredentials(props.credentials);\n copilotkit.value.setProperties(props.properties);\n copilotkit.value.setAgents__unsafe_dev_only(mergedAgents.value);\n copilotkit.value.setDebug(props.debug);\n applyDefaultThrottleMs(copilotkit.value);\n}\n\nwatch(\n [\n () => chatApiEndpoint.value,\n () => mergedHeaders.value,\n () => props.credentials,\n () => props.properties,\n () => mergedAgents.value,\n () => props.useSingleEndpoint,\n () => props.debug,\n ],\n () => {\n if (!didMountRef.value) return;\n syncRuntimeConfig();\n },\n);\n\nwatch(\n () => props.defaultThrottleMs,\n () => {\n if (!didMountRef.value) return;\n applyDefaultThrottleMs(copilotkit.value);\n triggerRef(copilotkit);\n },\n);\n\nonMounted(() => {\n syncRuntimeConfig();\n runtimeA2UIEnabled.value = copilotkit.value.a2uiEnabled;\n runtimeOpenGenerativeUIEnabled.value =\n copilotkit.value.openGenerativeUIEnabled;\n runtimeLicenseStatus.value = copilotkit.value.licenseStatus;\n didMountRef.value = true;\n});\n\nconst a2uiTheme = computed(() => props.a2ui?.theme);\nconst a2uiCatalog = computed(() => props.a2ui?.catalog);\nconst a2uiLoadingComponent = computed(() => props.a2ui?.loadingComponent);\nconst a2uiIncludeSchema = computed(() => props.a2ui?.includeSchema ?? true);\n\n// A2UI tool call renderer (progress indicator) — auto-registered when A2UI enabled\nregisterA2UIBuiltInToolCallRenderer(copilotkit, () => runtimeA2UIEnabled.value);\n\n// A2UI catalog context, schema, and generation/design guidelines\nregisterA2UICatalogContext(copilotkit, {\n enabled: () => runtimeA2UIEnabled.value,\n catalog: () => props.a2ui?.catalog,\n includeSchema: () => props.a2ui?.includeSchema ?? true,\n});\n\nconst providerContextIds = ref<string[]>([]);\nwatch(\n [\n openGenerativeUIActive,\n sandboxFunctions,\n () => props.openGenerativeUI?.designSkill,\n ],\n ([active, functions, designSkill], _previous, onCleanup) => {\n if (!active) return;\n\n const ids: string[] = [];\n ids.push(\n copilotkit.value.addContext({\n description:\n \"Design guidelines for the generateSandboxedUi tool. Follow these when building UI.\",\n value: designSkill ?? DEFAULT_DESIGN_SKILL,\n }),\n );\n\n if (functions.length > 0) {\n const descriptors = JSON.stringify(\n functions.map((fn) => ({\n name: fn.name,\n description: fn.description,\n parameters: schemaToJsonSchema(fn.parameters, {\n zodToJsonSchema: zodToJsonSchemaCompat,\n }),\n })),\n );\n ids.push(\n copilotkit.value.addContext({\n description:\n \"Sandbox functions available in generated sandboxed UI code. Call via Websandbox.connection.remote.<functionName>(args).\",\n value: descriptors,\n }),\n );\n }\n\n providerContextIds.value = ids;\n onCleanup(() => {\n for (const id of ids) {\n copilotkit.value.removeContext(id);\n }\n });\n },\n { immediate: true },\n);\n\nprovide(CopilotKitKey, {\n copilotkit,\n executingToolCallIds,\n a2uiTheme,\n a2uiCatalog,\n a2uiLoadingComponent,\n a2uiIncludeSchema,\n});\nprovide(SandboxFunctionsKey, sandboxFunctions);\n\n// License context — driven by server-reported `/info` license status.\n// Stays at the permissive default (`createLicenseContextValue(null)`)\n// to mirror React's current provider behavior; banner rendering below\n// is the sole consumer of `runtimeLicenseStatus`.\nconst licenseContextValue = computed<LicenseContextValue>(() =>\n createLicenseContextValue(null),\n);\nprovide(LicenseContextKey, licenseContextValue);\n\nconst showNoLicenseBanner = computed(\n () => runtimeLicenseStatus.value === \"none\" && !resolvedPublicKey.value,\n);\nconst showExpiredBanner = computed(\n () => runtimeLicenseStatus.value === \"expired\",\n);\nconst showInvalidBanner = computed(\n () => runtimeLicenseStatus.value === \"invalid\",\n);\nconst showExpiringBanner = computed(\n () => runtimeLicenseStatus.value === \"expiring\",\n);\n</script>\n\n<template>\n <slot />\n <CopilotKitInspector\n v-if=\"shouldRenderInspector\"\n :core=\"copilotkit\"\n :default-anchor=\"props.inspectorDefaultAnchor\"\n />\n <!-- License warnings — driven by server-reported status -->\n <LicenseWarningBanner v-if=\"showNoLicenseBanner\" type=\"no_license\" />\n <LicenseWarningBanner v-if=\"showExpiredBanner\" type=\"expired\" />\n <LicenseWarningBanner v-if=\"showInvalidBanner\" type=\"invalid\" />\n <LicenseWarningBanner v-if=\"showExpiringBanner\" type=\"expiring\" />\n</template>\n","export const CopilotChatDefaultLabels = {\n chatInputPlaceholder: \"Type a message...\",\n chatInputToolbarStartTranscribeButtonLabel: \"Transcribe\",\n chatInputToolbarCancelTranscribeButtonLabel: \"Cancel\",\n chatInputToolbarFinishTranscribeButtonLabel: \"Finish\",\n chatInputToolbarAddButtonLabel: \"Add photos or files\",\n chatInputToolbarToolsButtonLabel: \"Tools\",\n assistantMessageToolbarCopyCodeLabel: \"Copy\",\n assistantMessageToolbarCopyCodeCopiedLabel: \"Copied\",\n assistantMessageToolbarCopyMessageLabel: \"Copy\",\n assistantMessageToolbarThumbsUpLabel: \"Good response\",\n assistantMessageToolbarThumbsDownLabel: \"Bad response\",\n assistantMessageToolbarReadAloudLabel: \"Read aloud\",\n assistantMessageToolbarRegenerateLabel: \"Regenerate\",\n userMessageToolbarCopyMessageLabel: \"Copy\",\n userMessageToolbarEditMessageLabel: \"Edit\",\n chatDisclaimerText:\n \"AI can make mistakes. Please verify important information.\",\n chatToggleOpenLabel: \"Open chat\",\n chatToggleCloseLabel: \"Close chat\",\n modalHeaderTitle: \"CopilotKit Chat\",\n welcomeMessageText: \"How can I help you today?\",\n} as const;\n\nexport type CopilotChatLabels = typeof CopilotChatDefaultLabels;\n\nexport interface CopilotChatConfigurationValue {\n labels: CopilotChatLabels;\n agentId: string;\n threadId: string;\n /**\n * True when the current `threadId` was chosen by the caller rather than\n * silently minted inside the provider chain. Consumers that only make\n * sense against a real backend thread (e.g. `/connect`, suppressing the\n * welcome screen on switch) gate on this instead of `!!threadId`.\n */\n hasExplicitThreadId: boolean;\n isModalOpen?: boolean;\n setModalOpen?: (open: boolean) => void;\n}\n","import { shallowRef, toValue, watch } from \"vue\";\nimport type { MaybeRefOrGetter, ShallowRef } from \"vue\";\n\nfunction shallowEqualObjects(\n first: Record<string, unknown>,\n second: Record<string, unknown>,\n): boolean {\n const firstKeys = Object.keys(first);\n const secondKeys = Object.keys(second);\n if (firstKeys.length !== secondKeys.length) return false;\n\n for (const key of firstKeys) {\n if (first[key] !== second[key]) return false;\n }\n\n return true;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return (\n value !== null &&\n typeof value === \"object\" &&\n Object.prototype.toString.call(value) === \"[object Object]\"\n );\n}\n\n/**\n * Keeps reference identity stable for shallow-equal plain-object inputs.\n * Non-plain objects keep strict reference equality semantics.\n */\nexport function useShallowStableRef<T>(\n value: MaybeRefOrGetter<T>,\n): Readonly<ShallowRef<T>> {\n const stable = shallowRef(toValue(value)) as ShallowRef<T>;\n\n watch(\n () => toValue(value),\n (next) => {\n const previous = stable.value;\n if (previous === next) return;\n\n if (isPlainObject(previous) && isPlainObject(next)) {\n if (shallowEqualObjects(previous, next)) {\n return;\n }\n }\n\n stable.value = next;\n },\n { immediate: true },\n );\n\n return stable;\n}\n","<script setup lang=\"ts\">\nimport { computed, inject, provide, ref } from \"vue\";\nimport type { ComputedRef } from \"vue\";\nimport { DEFAULT_AGENT_ID, randomUUID } from \"@copilotkit/shared\";\nimport { CopilotChatConfigurationKey } from \"./keys\";\nimport { CopilotChatDefaultLabels } from \"./types\";\nimport type { CopilotChatConfigurationValue, CopilotChatLabels } from \"./types\";\nimport type { CopilotChatConfigurationProviderProps } from \"./CopilotChatConfigurationProvider.types\";\nimport { useShallowStableRef } from \"../lib/shallow-stable\";\n\n// Vue normalizes optional Boolean props to `false` when not supplied; declare\n// `undefined` defaults so we can faithfully distinguish \"caller passed false\"\n// from \"caller did not pass the prop\", matching React's prop semantics.\nconst props = withDefaults(\n defineProps<CopilotChatConfigurationProviderProps>(),\n {\n hasExplicitThreadId: undefined,\n isModalDefaultOpen: undefined,\n },\n);\n\nconst parentConfig = inject<ComputedRef<CopilotChatConfigurationValue> | null>(\n CopilotChatConfigurationKey,\n null,\n);\nconst parentConfigValue = computed(() => parentConfig?.value ?? null);\nconst stableLabels = useShallowStableRef(computed(() => props.labels));\n\nconst mergedLabels = computed<CopilotChatLabels>(() => ({\n ...CopilotChatDefaultLabels,\n ...parentConfigValue.value?.labels,\n ...stableLabels.value,\n}));\n\nconst resolvedAgentId = computed(\n () => props.agentId ?? parentConfigValue.value?.agentId ?? DEFAULT_AGENT_ID,\n);\n\nconst fallbackThreadId = randomUUID();\nconst resolvedThreadId = computed(() => {\n if (props.threadId) return props.threadId;\n if (parentConfigValue.value?.threadId)\n return parentConfigValue.value.threadId;\n return fallbackThreadId;\n});\n\nconst resolvedHasExplicitThreadId = computed(() => {\n const ownExplicit =\n props.hasExplicitThreadId !== undefined\n ? props.hasExplicitThreadId\n : !!props.threadId;\n return ownExplicit || !!parentConfigValue.value?.hasExplicitThreadId;\n});\n\nconst shouldCreateModalState = computed(\n () => props.isModalDefaultOpen !== undefined,\n);\nconst resolvedDefaultOpen = computed(() => props.isModalDefaultOpen ?? true);\n\nconst internalModalOpen = ref<boolean>(\n parentConfigValue.value?.isModalOpen ?? resolvedDefaultOpen.value,\n);\n\nfunction setInternalModalOpen(open: boolean) {\n internalModalOpen.value = open;\n}\n\nconst resolvedIsModalOpen = computed(() =>\n shouldCreateModalState.value\n ? internalModalOpen.value\n : parentConfigValue.value?.isModalOpen,\n);\nconst resolvedSetModalOpen = computed(() =>\n shouldCreateModalState.value\n ? setInternalModalOpen\n : parentConfigValue.value?.setModalOpen,\n);\n\nconst configurationValue = computed<CopilotChatConfigurationValue>(() => ({\n labels: mergedLabels.value,\n agentId: resolvedAgentId.value,\n threadId: resolvedThreadId.value,\n hasExplicitThreadId: resolvedHasExplicitThreadId.value,\n isModalOpen: resolvedIsModalOpen.value,\n setModalOpen: resolvedSetModalOpen.value,\n}));\n\nprovide(CopilotChatConfigurationKey, configurationValue);\n</script>\n\n<template>\n <slot />\n</template>\n","import { computed, inject, type ComputedRef } from \"vue\";\nimport {\n LicenseContextKey,\n createDefaultLicenseRef,\n type LicenseContextValue,\n} from \"./license-context\";\n\n/**\n * Vue counterpart of React's `useLicenseContext()` hook.\n *\n * Returns a `ComputedRef<LicenseContextValue>` whose `checkFeature(...)` /\n * `getLimit(...)` callbacks track the value installed by\n * `CopilotKitProvider`. Falls back to a permissive default\n * (`createLicenseContextValue(null)`) when no provider has registered the\n * context — matching React's `createContext(createLicenseContextValue(null))`\n * default and keeping component trees mountable in isolation.\n */\nexport function useLicenseContext(): ComputedRef<LicenseContextValue> {\n const source = inject(LicenseContextKey, createDefaultLicenseRef(), true);\n return computed(() => source.value);\n}\n","import { computed, inject } from \"vue\";\nimport type { ComputedRef } from \"vue\";\nimport { CopilotChatConfigurationKey } from \"./keys\";\nimport type { CopilotChatConfigurationValue } from \"./types\";\n\nexport function useCopilotChatConfiguration(): ComputedRef<CopilotChatConfigurationValue | null> {\n const injected = inject<\n ComputedRef<CopilotChatConfigurationValue> | undefined\n >(CopilotChatConfigurationKey, undefined);\n return computed(() => injected?.value ?? null);\n}\n","/**\n * Vue-native A2UI Surface renderer.\n *\n * Replaces the React island pattern with Vue components that use\n * @a2ui/web_core's framework-agnostic primitives directly.\n */\n\nimport {\n defineComponent,\n h,\n ref,\n onUnmounted,\n type PropType,\n type VNode,\n} from \"vue\";\nimport {\n ComponentContext,\n type SurfaceModel,\n type ComponentModel,\n} from \"@a2ui/web_core/v0_9\";\nimport type { VueComponentImplementation } from \"./adapter\";\n\n/**\n * DeferredChild — Vue equivalent of the React DeferredChild.\n * Subscribes to component create/delete events and renders the\n * appropriate catalog component via the GenericBinder adapter.\n */\nconst DeferredChild = defineComponent({\n name: \"A2UIDeferredChild\",\n props: {\n surface: {\n type: Object as PropType<SurfaceModel<VueComponentImplementation>>,\n required: true,\n },\n id: { type: String, required: true },\n basePath: { type: String, required: true },\n },\n setup(props) {\n // Reactive trigger — incremented when the component is created/deleted\n const version = ref(0);\n\n const sub1 = props.surface.componentsModel.onCreated.subscribe(\n (comp: ComponentModel) => {\n if (comp.id === props.id) {\n version.value++;\n }\n },\n );\n const sub2 = props.surface.componentsModel.onDeleted.subscribe(\n (delId: string) => {\n if (delId === props.id) {\n version.value++;\n }\n },\n );\n\n onUnmounted(() => {\n sub1.unsubscribe();\n sub2.unsubscribe();\n });\n\n function buildChild(childId: string, specificPath?: string): VNode {\n const path = specificPath || props.basePath;\n return h(DeferredChild, {\n key: `${childId}-${path}`,\n surface: props.surface,\n id: childId,\n basePath: path,\n });\n }\n\n return () => {\n // Touch version to ensure reactivity\n void version.value;\n\n const componentModel = props.surface.componentsModel.get(props.id);\n\n if (!componentModel) {\n // Shimmer placeholder while component isn't yet available\n return h(\"div\", {\n style: {\n padding: \"12px 16px\",\n borderRadius: \"8px\",\n background:\n \"linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%)\",\n backgroundSize: \"200% 100%\",\n animation: \"a2ui-shimmer 1.5s ease-in-out infinite\",\n minHeight: \"2rem\",\n },\n innerHTML: `<style>@keyframes a2ui-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }</style>`,\n });\n }\n\n const compImpl = props.surface.catalog.components.get(\n componentModel.type,\n );\n\n if (!compImpl) {\n return h(\n \"div\",\n { style: { color: \"red\" } },\n `Unknown component: ${componentModel.type}`,\n );\n }\n\n // Create context for this component\n const context = new ComponentContext(\n props.surface,\n props.id,\n props.basePath,\n );\n\n // Render the catalog component's Vue wrapper (created by createVueComponent)\n return h(compImpl.render, {\n context,\n buildChild,\n });\n };\n },\n});\n\n/**\n * A2uiSurface — renders the root of a single A2UI surface.\n * The root component always has ID 'root' and base path '/'.\n */\nexport const A2uiSurface = defineComponent({\n name: \"A2uiSurface\",\n props: {\n surface: {\n type: Object as PropType<SurfaceModel<VueComponentImplementation>>,\n required: true,\n },\n },\n setup(props) {\n return () =>\n h(DeferredChild, {\n surface: props.surface,\n id: \"root\",\n basePath: \"/\",\n });\n },\n});\n\nexport { DeferredChild };\n","<script setup lang=\"ts\">\nimport {\n computed,\n h,\n onBeforeUnmount,\n shallowRef,\n ref,\n watch,\n type VNode,\n} from \"vue\";\nimport type { ActivityMessage } from \"@ag-ui/core\";\nimport type { A2UITheme } from \"../types\";\nimport type { A2UIOperation } from \"./a2ui\";\nimport { getOperationSurfaceId } from \"./a2ui\";\nimport { useCopilotKit } from \"../providers\";\nimport { MessageProcessor, type SurfaceModel } from \"@a2ui/web_core/v0_9\";\nimport {\n vueBasicCatalog,\n A2uiSurface,\n type VueComponentImplementation,\n} from \"./a2ui/index\";\n\nconst DEFAULT_SURFACE_ID = \"default\";\n\nconst props = defineProps<{\n activityType: string;\n content: { operations: A2UIOperation[] };\n message: ActivityMessage;\n agent?: object;\n theme?: A2UITheme;\n catalog?: any;\n}>();\n\nconst { copilotkit } = useCopilotKit();\n\n// MessageProcessor from @a2ui/web_core — framework-agnostic\n// Use shallowRef to avoid Vue's deep UnwrapRef which strips private class members\nconst processorRef =\n shallowRef<MessageProcessor<VueComponentImplementation> | null>(null);\n// Version counter to trigger Vue reactivity on processor state changes\nconst version = ref(0);\n// Error state\nconst error = ref<string | null>(null);\n// Track last processed operations hash to avoid re-processing\nlet lastOpsHash = \"\";\n\nfunction getOrCreateProcessor(): MessageProcessor<VueComponentImplementation> {\n if (!processorRef.value) {\n const catalog = props.catalog ?? vueBasicCatalog;\n processorRef.value = new MessageProcessor<VueComponentImplementation>(\n [catalog],\n (action: unknown) => {\n handleAction(action);\n },\n );\n }\n return processorRef.value;\n}\n\nasync function handleAction(message: unknown) {\n if (!props.agent) return;\n try {\n copilotkit.value.setProperties({\n ...(copilotkit.value.properties ?? {}),\n a2uiAction: message,\n });\n await copilotkit.value.runAgent({ agent: props.agent as any });\n } finally {\n const { a2uiAction, ...rest } = copilotkit.value.properties ?? {};\n copilotkit.value.setProperties(rest);\n }\n}\n\nfunction processOperations(operations: A2UIOperation[]) {\n if (!operations?.length) return;\n\n const hash = JSON.stringify(operations);\n if (hash === lastOpsHash) return;\n lastOpsHash = hash;\n\n const processor = getOrCreateProcessor();\n try {\n // Group operations by surface ID\n const grouped = new Map<string, A2UIOperation[]>();\n for (const op of operations) {\n const surfaceId = getOperationSurfaceId(op) ?? DEFAULT_SURFACE_ID;\n if (!grouped.has(surfaceId)) grouped.set(surfaceId, []);\n grouped.get(surfaceId)!.push(op);\n }\n\n // For each surface, skip createSurface if the surface already exists\n for (const [surfaceId, ops] of grouped) {\n const existing = processor.model.getSurface(surfaceId);\n const filtered = existing\n ? ops.filter((op) => !(op as any)?.createSurface)\n : ops;\n processor.processMessages(filtered as any);\n }\n error.value = null;\n } catch (err) {\n console.warn(\"[A2UI Vue] processMessages error:\", err);\n error.value = err instanceof Error ? err.message : String(err);\n }\n version.value++;\n}\n\n// Process operations on mount and when they change\nwatch(\n () => [props.content.operations, props.theme, props.catalog, props.agent],\n () => {\n processOperations(props.content.operations);\n },\n { deep: true, immediate: true },\n);\n\nonBeforeUnmount(() => {\n processorRef.value = null;\n lastOpsHash = \"\";\n});\n\nconst hasOperations = computed(\n () => (props.content.operations ?? []).length > 0,\n);\n\n// Compute the list of surfaces to render\nconst surfaceEntries = computed(() => {\n // Touch version to ensure reactivity\n void version.value;\n\n if (!processorRef.value) return [];\n\n const entries: Array<{\n surfaceId: string;\n surface: SurfaceModel<VueComponentImplementation>;\n }> = [];\n\n // Group operations by surface to know which surfaces we expect\n const grouped = new Map<string, A2UIOperation[]>();\n for (const op of props.content.operations ?? []) {\n const surfaceId = getOperationSurfaceId(op) ?? DEFAULT_SURFACE_ID;\n if (!grouped.has(surfaceId)) grouped.set(surfaceId, []);\n grouped.get(surfaceId)!.push(op);\n }\n\n for (const [surfaceId] of grouped) {\n const surface = processorRef.value.model.getSurface(surfaceId);\n if (surface) {\n entries.push({ surfaceId, surface });\n }\n }\n\n return entries;\n});\n</script>\n\n<template>\n <div\n v-if=\"hasOperations\"\n data-copilotkit\n :data-activity-type=\"activityType\"\n :data-message-id=\"message.id\"\n >\n <div\n v-if=\"error\"\n class=\"cpk:rounded-lg cpk:border cpk:border-red-200 cpk:bg-red-50 cpk:p-3 cpk:text-sm cpk:text-red-700\"\n >\n A2UI render error: {{ error }}\n </div>\n <div\n v-else\n class=\"cpk:flex cpk:min-h-0 cpk:flex-1 cpk:flex-col cpk:gap-6 cpk:overflow-auto cpk:py-6\"\n data-testid=\"a2ui-activity-renderer\"\n >\n <div\n v-for=\"entry in surfaceEntries\"\n :key=\"entry.surfaceId\"\n class=\"cpk:flex cpk:w-full cpk:flex-none cpk:flex-col cpk:gap-4\"\n :data-surface-id=\"entry.surfaceId\"\n >\n <div class=\"a2ui-surface cpk:flex cpk:flex-1\">\n <A2uiSurface :surface=\"entry.surface\" />\n </div>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport type {\n AssistantMessage,\n Message,\n ToolCall,\n ToolMessage,\n} from \"@ag-ui/core\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\nimport { ToolCallStatus } from \"@copilotkit/core\";\nimport { partialJSONParse } from \"@copilotkit/shared\";\nimport { useCopilotKit } from \"../../providers/useCopilotKit\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport type { CopilotChatToolCallRenderSlotProps } from \"./types\";\nimport type { VueToolCallRenderer } from \"../../types\";\nimport type { VueToolCallRendererRenderProps } from \"../../types\";\n\nconst props = withDefaults(\n defineProps<{\n message: AssistantMessage;\n messages?: Message[];\n }>(),\n {\n messages: () => [],\n },\n);\n\ndefineSlots<{\n \"tool-call\"?: (props: CopilotChatToolCallRenderSlotProps) => unknown;\n [key: `tool-call-${string}`]: (\n props: CopilotChatToolCallRenderSlotProps,\n ) => unknown;\n}>();\n\nconst { copilotkit, executingToolCallIds } = useCopilotKit();\nconst config = useCopilotChatConfiguration();\n\nfunction findToolMessage(toolCallId: string): ToolMessage | undefined {\n return props.messages.find(\n (message) =>\n message.role === \"tool\" &&\n (message as ToolMessage).toolCallId === toolCallId,\n ) as ToolMessage | undefined;\n}\n\nfunction getSlotName(toolName: string): `tool-call-${string}` {\n return `tool-call-${toolName}`;\n}\n\nfunction isExecutingToolCall(toolCallId: string): boolean {\n return executingToolCallIds.value.has(toolCallId);\n}\n\nfunction getToolResultContent(toolCallId: string): string | undefined {\n return findToolMessage(toolCallId)?.content;\n}\n\nfunction getRenderProps(\n toolCall: ToolCall,\n): CopilotChatToolCallRenderSlotProps {\n const toolMessage = findToolMessage(toolCall.id);\n const parsedArgs = partialJSONParse(toolCall.function.arguments);\n\n if (toolMessage) {\n return {\n name: toolCall.function.name,\n args: parsedArgs,\n status: ToolCallStatus.Complete,\n result: toolMessage.content,\n toolCall,\n toolMessage,\n };\n }\n\n const isExecuting = isExecutingToolCall(toolCall.id);\n return {\n name: toolCall.function.name,\n args: parsedArgs,\n status: isExecuting ? ToolCallStatus.Executing : ToolCallStatus.InProgress,\n result: undefined,\n toolCall,\n toolMessage: undefined,\n };\n}\n\nfunction getCoreRenderProps(\n toolCall: ToolCall,\n): VueToolCallRendererRenderProps<unknown> {\n const toolMessage = findToolMessage(toolCall.id);\n const parsedArgs = partialJSONParse(toolCall.function.arguments);\n\n if (toolMessage) {\n return {\n name: toolCall.function.name,\n toolCallId: toolCall.id,\n args: parsedArgs,\n status: ToolCallStatus.Complete,\n result: toolMessage.content,\n };\n }\n\n const isExecuting = isExecutingToolCall(toolCall.id);\n if (isExecuting) {\n return {\n name: toolCall.function.name,\n toolCallId: toolCall.id,\n args: parsedArgs,\n status: ToolCallStatus.Executing,\n result: undefined,\n };\n }\n\n return {\n name: toolCall.function.name,\n toolCallId: toolCall.id,\n args: parsedArgs && typeof parsedArgs === \"object\" ? parsedArgs : {},\n status: ToolCallStatus.InProgress,\n result: undefined,\n };\n}\n\nfunction getCoreRenderConfig(\n toolCall: ToolCall,\n): VueToolCallRenderer<unknown> | undefined {\n const renderToolCalls = copilotkit.value.renderToolCalls;\n const agentId = config.value?.agentId ?? DEFAULT_AGENT_ID;\n const exactMatches = renderToolCalls.filter(\n (renderConfig) => renderConfig.name === toolCall.function.name,\n );\n\n return (\n exactMatches.find((renderConfig) => renderConfig.agentId === agentId) ??\n exactMatches.find((renderConfig) => !renderConfig.agentId) ??\n exactMatches[0] ??\n renderToolCalls.find((renderConfig) => renderConfig.name === \"*\")\n );\n}\n</script>\n\n<template>\n <template v-for=\"toolCall in message.toolCalls ?? []\" :key=\"toolCall.id\">\n <slot\n :name=\"getSlotName(toolCall.function.name)\"\n v-bind=\"getRenderProps(toolCall)\"\n >\n <slot name=\"tool-call\" v-bind=\"getRenderProps(toolCall)\">\n <component\n :is=\"getCoreRenderConfig(toolCall)?.render\"\n v-if=\"getCoreRenderConfig(toolCall)\"\n v-bind=\"getCoreRenderProps(toolCall)\"\n v-memo=\"[\n toolCall.id,\n toolCall.function.arguments,\n getToolResultContent(toolCall.id),\n isExecutingToolCall(toolCall.id),\n getCoreRenderConfig(toolCall)?.render,\n ]\"\n />\n </slot>\n </slot>\n </template>\n</template>\n","import { onMounted } from \"vue\";\n\n// Module-level singleton flag so the stylesheet is only injected once per\n// module graph (matches the React singleton injection intent).\nlet injected = false;\n\n/**\n * Dynamically loads KaTeX CSS at runtime to avoid Next.js-style\n * \"Global CSS cannot be imported from within node_modules\" build errors and\n * to keep the CSS out of the static import graph.\n *\n * Uses a module-level singleton flag so the stylesheet is only loaded once,\n * regardless of how many components call this composable.\n *\n * Mirrors the React `useKatexStyles` hook: returns `void`, never throws, and\n * logs a warning with equivalent intent if the dynamic import fails.\n *\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { useKatexStyles } from \"@copilotkit/vue\";\n *\n * useKatexStyles();\n * </script>\n * ```\n */\nexport function useKatexStyles(): void {\n onMounted(() => {\n if (injected || typeof document === \"undefined\") return;\n injected = true;\n\n // Dynamic import defers CSS loading to runtime, bypassing build-time\n // static analysis that rejects global CSS from node_modules.\n // The `@vite-ignore` + indirect specifier keeps TypeScript from trying\n // to resolve a type declaration for the CSS module while still letting\n // the bundler handle the actual side-effect import at runtime.\n const katexStylesSpecifier = \"katex/dist/katex.min.css\";\n void import(/* @vite-ignore */ katexStylesSpecifier).catch(() => {\n console.warn(\n \"[CopilotKit] Failed to load katex styles — math content may render without formatting\",\n );\n });\n });\n}\n","<script setup lang=\"ts\">\nimport {\n computed,\n defineComponent,\n getCurrentInstance,\n h,\n onBeforeUnmount,\n onMounted,\n ref,\n} from \"vue\";\nimport type { AssistantMessage, Message } from \"@ag-ui/core\";\nimport { StreamMarkdown } from \"streamdown-vue\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport {\n IconCheck,\n IconCopy,\n IconDownload,\n IconRefreshCw,\n IconThumbsDown,\n IconThumbsUp,\n IconVolume2,\n} from \"../icons\";\nimport CopilotChatToolCallsView from \"./CopilotChatToolCallsView.vue\";\nimport type {\n CopilotChatAssistantMessageCopyButtonSlotProps,\n CopilotChatAssistantMessageLayoutSlotProps,\n CopilotChatAssistantMessageMessageRendererSlotProps,\n CopilotChatAssistantMessageReadAloudButtonSlotProps,\n CopilotChatAssistantMessageRegenerateButtonSlotProps,\n CopilotChatAssistantMessageThumbsDownButtonSlotProps,\n CopilotChatAssistantMessageThumbsUpButtonSlotProps,\n CopilotChatAssistantMessageToolCallsViewSlotProps,\n CopilotChatAssistantMessageToolbarSlotProps,\n} from \"./types\";\nimport { useKatexStyles } from \"../../hooks/use-katex-styles\";\n\nuseKatexStyles();\n\nconst props = withDefaults(\n defineProps<{\n message: AssistantMessage;\n messages?: Message[];\n isRunning?: boolean;\n toolbarVisible?: boolean;\n }>(),\n {\n messages: () => [],\n isRunning: false,\n toolbarVisible: true,\n },\n);\n\ndefineSlots<{\n layout?: (props: CopilotChatAssistantMessageLayoutSlotProps) => unknown;\n \"message-renderer\"?: (\n props: CopilotChatAssistantMessageMessageRendererSlotProps,\n ) => unknown;\n toolbar?: (props: CopilotChatAssistantMessageToolbarSlotProps) => unknown;\n \"copy-button\"?: (\n props: CopilotChatAssistantMessageCopyButtonSlotProps,\n ) => unknown;\n \"thumbs-up-button\"?: (\n props: CopilotChatAssistantMessageThumbsUpButtonSlotProps,\n ) => unknown;\n \"thumbs-down-button\"?: (\n props: CopilotChatAssistantMessageThumbsDownButtonSlotProps,\n ) => unknown;\n \"read-aloud-button\"?: (\n props: CopilotChatAssistantMessageReadAloudButtonSlotProps,\n ) => unknown;\n \"regenerate-button\"?: (\n props: CopilotChatAssistantMessageRegenerateButtonSlotProps,\n ) => unknown;\n \"tool-calls-view\"?: (\n props: CopilotChatAssistantMessageToolCallsViewSlotProps,\n ) => unknown;\n \"toolbar-items\"?: () => unknown;\n [key: string]: ((props: any) => unknown) | undefined;\n}>();\n\nconst emit = defineEmits<{\n \"thumbs-up\": [message: AssistantMessage];\n \"thumbs-down\": [message: AssistantMessage];\n \"read-aloud\": [message: AssistantMessage];\n regenerate: [message: AssistantMessage];\n}>();\n\nconst config = useCopilotChatConfiguration();\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\nconst instance = getCurrentInstance();\nconst copied = ref(false);\nlet copiedResetTimeout: ReturnType<typeof setTimeout> | null = null;\nconst vnodeProps = computed(\n () => (instance?.vnode.props ?? {}) as Record<string, unknown>,\n);\n\nconst toolbarButtonClass = [\n \"cpk:inline-flex cpk:h-8 cpk:w-8 cpk:items-center cpk:justify-center cpk:rounded-md cpk:p-0\",\n \"cpk:cursor-pointer cpk:text-[rgb(93,93,93)] cpk:transition-colors cpk:hover:bg-[#E8E8E8]\",\n \"cpk:hover:text-[rgb(93,93,93)] cpk:dark:text-[rgb(243,243,243)] cpk:dark:hover:bg-[#303030]\",\n \"cpk:dark:hover:text-[rgb(243,243,243)] cpk:disabled:pointer-events-none cpk:disabled:opacity-50\",\n].join(\" \");\n\nfunction extractFileNameFromUrl(url: string, fallback: string) {\n try {\n const parsed = new URL(url, \"https://copilotkit.local\");\n const pathname = parsed.pathname.split(\"/\").filter(Boolean).pop();\n if (pathname) {\n return decodeURIComponent(pathname);\n }\n } catch {\n return fallback;\n }\n return fallback;\n}\n\nfunction triggerDownload(href: string, fileName: string) {\n if (typeof document === \"undefined\") {\n return;\n }\n const anchor = document.createElement(\"a\");\n anchor.href = href;\n anchor.download = fileName;\n anchor.rel = \"noopener noreferrer\";\n document.body.appendChild(anchor);\n anchor.click();\n document.body.removeChild(anchor);\n}\n\ntype MarkdownTableData = {\n headers: string[];\n rows: string[][];\n};\n\nfunction extractTableData(table: HTMLTableElement): MarkdownTableData {\n const headers = Array.from(table.querySelectorAll(\"thead th\")).map((cell) =>\n (cell.textContent ?? \"\").trim(),\n );\n const rows = Array.from(table.querySelectorAll(\"tbody tr\")).map((row) =>\n Array.from(row.querySelectorAll(\"td\")).map((cell) =>\n (cell.textContent ?? \"\").trim(),\n ),\n );\n return { headers, rows };\n}\n\nfunction toDelimitedTable(\n data: MarkdownTableData,\n delimiter: \",\" | \"\\t\",\n): string {\n const escapeCell = (value: string): string => {\n const needsQuotes =\n value.includes(delimiter) || value.includes('\"') || value.includes(\"\\n\");\n const escaped = value.replace(/\"/g, '\"\"');\n return needsQuotes ? `\"${escaped}\"` : escaped;\n };\n\n const lines: string[] = [];\n if (data.headers.length > 0) {\n lines.push(data.headers.map(escapeCell).join(delimiter));\n }\n for (const row of data.rows) {\n lines.push(row.map(escapeCell).join(delimiter));\n }\n return lines.join(\"\\n\");\n}\n\nfunction toMarkdownTable(data: MarkdownTableData): string {\n if (data.headers.length === 0) {\n return data.rows.map((row) => `| ${row.join(\" | \")} |`).join(\"\\n\");\n }\n\n const separator = `| ${data.headers.map(() => \"---\").join(\" | \")} |`;\n const body = data.rows.map((row) => `| ${row.join(\" | \")} |`);\n return [`| ${data.headers.join(\" | \")} |`, separator, ...body].join(\"\\n\");\n}\n\nfunction triggerBlobDownload(\n content: string,\n fileName: string,\n mimeType: string,\n) {\n if (typeof document === \"undefined\") {\n return;\n }\n const blob = new Blob([content], { type: mimeType });\n const url = URL.createObjectURL(blob);\n triggerDownload(url, fileName);\n URL.revokeObjectURL(url);\n}\n\nconst MarkdownImage = defineComponent({\n name: \"CopilotMarkdownImage\",\n inheritAttrs: false,\n props: {\n src: {\n type: String,\n default: \"\",\n },\n alt: {\n type: String,\n default: \"\",\n },\n },\n setup(imageProps, { attrs }) {\n async function handleDownload() {\n if (!imageProps.src) {\n return;\n }\n\n const fileName = extractFileNameFromUrl(imageProps.src, \"image\");\n try {\n const response = await fetch(imageProps.src);\n if (!response.ok) {\n throw new Error(\"Failed to fetch image\");\n }\n const blob = await response.blob();\n const objectUrl = URL.createObjectURL(blob);\n triggerDownload(objectUrl, fileName);\n URL.revokeObjectURL(objectUrl);\n } catch {\n triggerDownload(imageProps.src, fileName);\n }\n }\n\n return () => {\n const imageAttrs = {\n ...attrs,\n src: imageProps.src,\n alt: imageProps.alt,\n class: [\"cpk:max-w-full cpk:rounded-lg\", attrs.class]\n .filter(Boolean)\n .join(\" \"),\n \"data-streamdown\": \"image\",\n } as Record<string, unknown>;\n\n delete imageAttrs.className;\n\n return h(\n \"div\",\n {\n class: \"cpk:group cpk:relative cpk:my-4 cpk:inline-block\",\n \"data-streamdown\": \"image-wrapper\",\n },\n [\n h(\"img\", imageAttrs),\n h(\"div\", {\n class:\n \"cpk:pointer-events-none cpk:absolute cpk:inset-0 cpk:hidden cpk:rounded-lg cpk:bg-black/10 cpk:group-hover:block\",\n }),\n h(\n \"button\",\n {\n type: \"button\",\n class:\n \"cpk:absolute cpk:right-2 cpk:bottom-2 cpk:flex cpk:h-8 cpk:w-8 cpk:cursor-pointer cpk:items-center cpk:justify-center cpk:rounded-md cpk:border cpk:border-border cpk:bg-background/90 cpk:shadow-sm cpk:backdrop-blur-sm cpk:transition-all cpk:duration-200 cpk:hover:bg-background cpk:opacity-0 cpk:group-hover:opacity-100\",\n title: \"Download image\",\n onClick: handleDownload,\n },\n [h(IconDownload, { class: \"cpk:size-[14px]\" })],\n ),\n ],\n );\n };\n },\n});\n\nconst tableIconButtonClass =\n \"cpk:cursor-pointer cpk:p-1 cpk:text-muted-foreground cpk:transition-all cpk:hover:text-foreground cpk:disabled:cursor-not-allowed cpk:disabled:opacity-50\";\nconst tableMenuClass =\n \"cpk:absolute cpk:top-full cpk:right-0 cpk:z-10 cpk:mt-1 cpk:min-w-[120px] cpk:overflow-hidden cpk:rounded-md cpk:border cpk:border-border cpk:bg-background cpk:shadow-lg\";\nconst tableMenuItemClass =\n \"cpk:w-full cpk:px-3 cpk:py-2 cpk:text-left cpk:text-sm cpk:transition-colors cpk:hover:bg-muted/40\";\n\nconst MarkdownTable = defineComponent({\n name: \"CopilotMarkdownTable\",\n inheritAttrs: false,\n setup(_, { attrs, slots }) {\n const wrapperRef = ref<HTMLElement | null>(null);\n const showCopyMenu = ref(false);\n const showDownloadMenu = ref(false);\n const tableCopied = ref(false);\n let tableCopiedResetTimeout: ReturnType<typeof setTimeout> | null = null;\n\n const closeMenus = () => {\n showCopyMenu.value = false;\n showDownloadMenu.value = false;\n };\n\n const setTableCopiedStateWithDelay = () => {\n if (tableCopiedResetTimeout) {\n clearTimeout(tableCopiedResetTimeout);\n }\n tableCopied.value = true;\n tableCopiedResetTimeout = setTimeout(() => {\n tableCopied.value = false;\n tableCopiedResetTimeout = null;\n }, 2000);\n };\n\n const findTable = (): HTMLTableElement | null => {\n if (!wrapperRef.value) return null;\n return wrapperRef.value.querySelector(\"table\");\n };\n\n const getTableData = (): MarkdownTableData | null => {\n const table = findTable();\n if (!table) return null;\n return extractTableData(table);\n };\n\n const copyTableAs = async (format: \"csv\" | \"tsv\") => {\n const data = getTableData();\n if (!data) return;\n\n const delimiter = format === \"csv\" ? \",\" : \"\\t\";\n const text = toDelimitedTable(data, delimiter);\n\n if (typeof navigator !== \"undefined\" && navigator.clipboard?.writeText) {\n try {\n await navigator.clipboard.writeText(text);\n } catch {\n return;\n }\n }\n\n closeMenus();\n setTableCopiedStateWithDelay();\n };\n\n const downloadTableAs = (format: \"csv\" | \"markdown\") => {\n const data = getTableData();\n if (!data) return;\n\n if (format === \"csv\") {\n triggerBlobDownload(\n toDelimitedTable(data, \",\"),\n \"table.csv\",\n \"text/csv\",\n );\n } else {\n triggerBlobDownload(toMarkdownTable(data), \"table.md\", \"text/markdown\");\n }\n\n closeMenus();\n };\n\n const handleClickOutside = (event: MouseEvent) => {\n if (!wrapperRef.value) return;\n const target = event.target as Node | null;\n if (target && !wrapperRef.value.contains(target)) {\n closeMenus();\n }\n };\n\n onMounted(() => {\n if (typeof document !== \"undefined\") {\n document.addEventListener(\"mousedown\", handleClickOutside);\n }\n });\n\n onBeforeUnmount(() => {\n if (tableCopiedResetTimeout) {\n clearTimeout(tableCopiedResetTimeout);\n }\n if (typeof document !== \"undefined\") {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n }\n });\n\n return () => {\n const tableAttrs = {\n ...attrs,\n class: [\n \"cpk:w-full cpk:border-collapse cpk:border cpk:border-border\",\n attrs.class,\n ]\n .filter(Boolean)\n .join(\" \"),\n \"data-streamdown\": \"table\",\n } as Record<string, unknown>;\n\n delete tableAttrs.className;\n\n return h(\n \"div\",\n {\n ref: wrapperRef,\n class: \"cpk:my-4 cpk:flex cpk:flex-col cpk:space-y-2\",\n \"data-streamdown\": \"table-wrapper\",\n },\n [\n h(\n \"div\",\n { class: \"cpk:flex cpk:items-center cpk:justify-end cpk:gap-1\" },\n [\n h(\"div\", { class: \"cpk:relative\" }, [\n h(\n \"button\",\n {\n type: \"button\",\n class: tableIconButtonClass,\n title: \"Copy table\",\n onClick: () => {\n showCopyMenu.value = !showCopyMenu.value;\n showDownloadMenu.value = false;\n },\n },\n [\n tableCopied.value\n ? h(IconCheck, { class: \"cpk:size-[14px]\" })\n : h(IconCopy, { class: \"cpk:size-[14px]\" }),\n ],\n ),\n showCopyMenu.value\n ? h(\"div\", { class: tableMenuClass }, [\n h(\n \"button\",\n {\n type: \"button\",\n class: tableMenuItemClass,\n title: \"Copy table as CSV\",\n onClick: () => copyTableAs(\"csv\"),\n },\n \"CSV\",\n ),\n h(\n \"button\",\n {\n type: \"button\",\n class: tableMenuItemClass,\n title: \"Copy table as TSV\",\n onClick: () => copyTableAs(\"tsv\"),\n },\n \"TSV\",\n ),\n ])\n : null,\n ]),\n h(\"div\", { class: \"cpk:relative\" }, [\n h(\n \"button\",\n {\n type: \"button\",\n class: tableIconButtonClass,\n title: \"Download table\",\n onClick: () => {\n showDownloadMenu.value = !showDownloadMenu.value;\n showCopyMenu.value = false;\n },\n },\n [h(IconDownload, { class: \"cpk:size-[14px]\" })],\n ),\n showDownloadMenu.value\n ? h(\"div\", { class: tableMenuClass }, [\n h(\n \"button\",\n {\n type: \"button\",\n class: tableMenuItemClass,\n title: \"Download table as CSV\",\n onClick: () => downloadTableAs(\"csv\"),\n },\n \"CSV\",\n ),\n h(\n \"button\",\n {\n type: \"button\",\n class: tableMenuItemClass,\n title: \"Download table as Markdown\",\n onClick: () => downloadTableAs(\"markdown\"),\n },\n \"Markdown\",\n ),\n ])\n : null,\n ]),\n ],\n ),\n h(\"div\", { class: \"cpk:overflow-x-auto\" }, [\n h(\"table\", tableAttrs, slots.default ? slots.default() : []),\n ]),\n ],\n );\n };\n },\n});\n\nconst codeActionButtonClass =\n \"cpk:cursor-pointer cpk:p-1 cpk:text-muted-foreground cpk:transition-all cpk:hover:text-foreground cpk:disabled:cursor-not-allowed cpk:disabled:opacity-50\";\n\nconst codeLanguageExtensionMap: Record<string, string> = {\n javascript: \"js\",\n js: \"js\",\n typescript: \"ts\",\n ts: \"ts\",\n json: \"json\",\n vue: \"vue\",\n html: \"html\",\n css: \"css\",\n md: \"md\",\n markdown: \"md\",\n sh: \"sh\",\n bash: \"sh\",\n py: \"py\",\n python: \"py\",\n go: \"go\",\n rust: \"rs\",\n rs: \"rs\",\n};\n\nconst CodeBlockCopyAction = defineComponent({\n name: \"CopilotCodeBlockCopyAction\",\n props: {\n code: {\n type: String,\n default: \"\",\n },\n },\n setup(actionProps) {\n const isCopied = ref(false);\n let resetTimeout: ReturnType<typeof setTimeout> | null = null;\n\n const handleClick = async () => {\n if (!actionProps.code) return;\n if (typeof navigator !== \"undefined\" && navigator.clipboard?.writeText) {\n try {\n await navigator.clipboard.writeText(actionProps.code);\n } catch {\n return;\n }\n }\n\n if (resetTimeout) {\n clearTimeout(resetTimeout);\n }\n isCopied.value = true;\n resetTimeout = setTimeout(() => {\n isCopied.value = false;\n resetTimeout = null;\n }, 2000);\n };\n\n onBeforeUnmount(() => {\n if (resetTimeout) {\n clearTimeout(resetTimeout);\n }\n });\n\n return () =>\n h(\n \"button\",\n {\n type: \"button\",\n class: codeActionButtonClass,\n title: \"Copy Code\",\n \"data-streamdown\": \"code-block-copy-button\",\n onClick: handleClick,\n },\n [\n isCopied.value\n ? h(IconCheck, { class: \"cpk:size-[14px]\" })\n : h(IconCopy, { class: \"cpk:size-[14px]\" }),\n ],\n );\n },\n});\n\nconst CodeBlockDownloadAction = defineComponent({\n name: \"CopilotCodeBlockDownloadAction\",\n props: {\n code: {\n type: String,\n default: \"\",\n },\n language: {\n type: String,\n default: \"\",\n },\n },\n setup(actionProps) {\n const handleClick = () => {\n if (!actionProps.code) return;\n const extension =\n codeLanguageExtensionMap[actionProps.language.toLowerCase()] ?? \"txt\";\n triggerBlobDownload(actionProps.code, `file.${extension}`, \"text/plain\");\n };\n\n return () =>\n h(\n \"button\",\n {\n type: \"button\",\n class: codeActionButtonClass,\n title: \"Download file\",\n \"data-streamdown\": \"code-block-download-button\",\n onClick: handleClick,\n },\n [h(IconDownload, { class: \"cpk:size-[14px]\" })],\n );\n },\n});\n\nconst markdownComponents = {\n img: MarkdownImage,\n table: MarkdownTable,\n};\n\nfunction normalizeContent(content: unknown): string {\n if (!content) {\n return \"\";\n }\n\n if (typeof content === \"string\") {\n return content;\n }\n\n if (Array.isArray(content)) {\n const parts = content as Array<{ type?: unknown; text?: unknown }>;\n return parts\n .map((part) => {\n if (\n part &&\n typeof part === \"object\" &&\n \"type\" in part &&\n part.type === \"text\" &&\n typeof part.text === \"string\"\n ) {\n return part.text;\n }\n return \"\";\n })\n .filter((text) => text.length > 0)\n .join(\"\\n\");\n }\n\n return \"\";\n}\n\nconst normalizedContent = computed(() =>\n normalizeContent(props.message.content),\n);\nconst hasContent = computed(() => normalizedContent.value.trim().length > 0);\nfunction hasListener(listenerName: string) {\n const listener = vnodeProps.value[listenerName];\n if (Array.isArray(listener)) {\n return listener.length > 0;\n }\n return !!listener;\n}\n\nconst hasThumbsUp = computed(() => hasListener(\"onThumbsUp\"));\nconst hasThumbsDown = computed(() => hasListener(\"onThumbsDown\"));\nconst hasReadAloud = computed(() => hasListener(\"onReadAloud\"));\nconst hasRegenerate = computed(() => hasListener(\"onRegenerate\"));\nconst isLatestAssistantMessage = computed(\n () => props.messages[props.messages.length - 1]?.id === props.message.id,\n);\nconst shouldShowToolbar = computed(\n () =>\n props.toolbarVisible &&\n hasContent.value &&\n !(props.isRunning && isLatestAssistantMessage.value),\n);\n\nfunction resetCopiedStateWithDelay() {\n if (copiedResetTimeout) {\n clearTimeout(copiedResetTimeout);\n }\n copied.value = true;\n copiedResetTimeout = setTimeout(() => {\n copied.value = false;\n copiedResetTimeout = null;\n }, 2000);\n}\n\nasync function handleCopyMessage() {\n const content = normalizedContent.value;\n if (!content) return;\n\n if (\n typeof navigator === \"undefined\" ||\n typeof navigator.clipboard?.writeText !== \"function\"\n ) {\n return;\n }\n\n try {\n await navigator.clipboard.writeText(content);\n resetCopiedStateWithDelay();\n } catch (error) {\n console.error(\"Failed to copy to clipboard:\", error);\n }\n}\n\nfunction handleThumbsUp() {\n emit(\"thumbs-up\", props.message);\n}\n\nfunction handleThumbsDown() {\n emit(\"thumbs-down\", props.message);\n}\n\nfunction handleReadAloud() {\n emit(\"read-aloud\", props.message);\n}\n\nfunction handleRegenerate() {\n emit(\"regenerate\", props.message);\n}\n\nonBeforeUnmount(() => {\n if (copiedResetTimeout) {\n clearTimeout(copiedResetTimeout);\n }\n});\n</script>\n\n<template>\n <slot\n name=\"layout\"\n :message=\"message\"\n :content=\"normalizedContent\"\n :is-running=\"isRunning\"\n :toolbar-visible=\"toolbarVisible\"\n :should-show-toolbar=\"shouldShowToolbar\"\n :message-renderer=\"$slots['message-renderer'] ?? (() => null)\"\n :toolbar=\"$slots['toolbar'] ?? (() => null)\"\n :copy-button=\"$slots['copy-button'] ?? (() => null)\"\n :thumbs-up-button=\"$slots['thumbs-up-button'] ?? (() => null)\"\n :thumbs-down-button=\"$slots['thumbs-down-button'] ?? (() => null)\"\n :read-aloud-button=\"$slots['read-aloud-button'] ?? (() => null)\"\n :regenerate-button=\"$slots['regenerate-button'] ?? (() => null)\"\n :tool-calls-view=\"$slots['tool-calls-view'] ?? (() => null)\"\n :on-copy=\"handleCopyMessage\"\n :on-thumbs-up=\"handleThumbsUp\"\n :on-thumbs-down=\"handleThumbsDown\"\n :on-read-aloud=\"handleReadAloud\"\n :on-regenerate=\"handleRegenerate\"\n >\n <div\n data-copilotkit\n data-testid=\"copilot-assistant-message\"\n class=\"cpk:prose cpk:max-w-full cpk:break-words cpk:dark:prose-invert\"\n :data-message-id=\"message.id\"\n v-bind=\"$attrs\"\n >\n <slot\n name=\"message-renderer\"\n :message=\"message\"\n :content=\"normalizedContent\"\n >\n <StreamMarkdown\n v-if=\"hasContent\"\n class=\"copilot-chat-assistant-markdown\"\n :content=\"normalizedContent\"\n :components=\"markdownComponents\"\n :code-block-actions=\"[CodeBlockDownloadAction, CodeBlockCopyAction]\"\n :code-block-show-line-numbers=\"false\"\n :code-block-hide-copy=\"true\"\n :code-block-hide-download=\"true\"\n :allowed-link-prefixes=\"[\n 'https://',\n 'http://',\n '#',\n '/',\n './',\n '../',\n ]\"\n :shiki-theme=\"{ light: 'github-light', dark: 'github-dark' }\"\n />\n </slot>\n\n <slot name=\"tool-calls-view\" :message=\"message\" :messages=\"messages\">\n <CopilotChatToolCallsView :message=\"message\" :messages=\"messages\">\n <template\n v-for=\"(_, slotName) in $slots\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps\" />\n </template>\n </CopilotChatToolCallsView>\n </slot>\n\n <slot\n v-if=\"shouldShowToolbar\"\n name=\"toolbar\"\n :message=\"message\"\n :should-show-toolbar=\"shouldShowToolbar\"\n >\n <div\n class=\"cpk:w-full cpk:bg-transparent cpk:flex cpk:items-center cpk:-ml-[5px] cpk:-mt-[0px]\"\n >\n <div class=\"cpk:flex cpk:items-center cpk:gap-1\">\n <slot\n name=\"copy-button\"\n :on-copy=\"handleCopyMessage\"\n :copied=\"copied\"\n :label=\"labels.assistantMessageToolbarCopyMessageLabel\"\n >\n <button\n data-testid=\"copilot-copy-button\"\n type=\"button\"\n :class=\"toolbarButtonClass\"\n :aria-label=\"labels.assistantMessageToolbarCopyMessageLabel\"\n :title=\"labels.assistantMessageToolbarCopyMessageLabel\"\n @click=\"handleCopyMessage\"\n >\n <IconCheck v-if=\"copied\" class=\"cpk:size-[18px]\" />\n <IconCopy v-else class=\"cpk:size-[18px]\" />\n </button>\n </slot>\n\n <slot\n v-if=\"hasThumbsUp\"\n name=\"thumbs-up-button\"\n :on-thumbs-up=\"handleThumbsUp\"\n :label=\"labels.assistantMessageToolbarThumbsUpLabel\"\n >\n <button\n type=\"button\"\n :class=\"toolbarButtonClass\"\n :aria-label=\"labels.assistantMessageToolbarThumbsUpLabel\"\n :title=\"labels.assistantMessageToolbarThumbsUpLabel\"\n @click=\"handleThumbsUp\"\n >\n <IconThumbsUp class=\"cpk:size-[18px]\" />\n </button>\n </slot>\n\n <slot\n v-if=\"hasThumbsDown\"\n name=\"thumbs-down-button\"\n :on-thumbs-down=\"handleThumbsDown\"\n :label=\"labels.assistantMessageToolbarThumbsDownLabel\"\n >\n <button\n type=\"button\"\n :class=\"toolbarButtonClass\"\n :aria-label=\"labels.assistantMessageToolbarThumbsDownLabel\"\n :title=\"labels.assistantMessageToolbarThumbsDownLabel\"\n @click=\"handleThumbsDown\"\n >\n <IconThumbsDown class=\"cpk:size-[18px]\" />\n </button>\n </slot>\n\n <slot\n v-if=\"hasReadAloud\"\n name=\"read-aloud-button\"\n :on-read-aloud=\"handleReadAloud\"\n :label=\"labels.assistantMessageToolbarReadAloudLabel\"\n >\n <button\n type=\"button\"\n :class=\"toolbarButtonClass\"\n :aria-label=\"labels.assistantMessageToolbarReadAloudLabel\"\n :title=\"labels.assistantMessageToolbarReadAloudLabel\"\n @click=\"handleReadAloud\"\n >\n <IconVolume2 class=\"cpk:size-[20px]\" />\n </button>\n </slot>\n\n <slot\n v-if=\"hasRegenerate\"\n name=\"regenerate-button\"\n :on-regenerate=\"handleRegenerate\"\n :label=\"labels.assistantMessageToolbarRegenerateLabel\"\n >\n <button\n type=\"button\"\n :class=\"toolbarButtonClass\"\n :aria-label=\"labels.assistantMessageToolbarRegenerateLabel\"\n :title=\"labels.assistantMessageToolbarRegenerateLabel\"\n @click=\"handleRegenerate\"\n >\n <IconRefreshCw class=\"cpk:size-[18px]\" />\n </button>\n </slot>\n\n <slot name=\"toolbar-items\" />\n </div>\n </div>\n </slot>\n </div>\n </slot>\n</template>\n","export type AudioRecorderState = \"idle\" | \"recording\" | \"processing\";\n\nexport class AudioRecorderError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"AudioRecorderError\";\n }\n}\n\nexport interface CopilotChatAudioRecorderRef {\n state: AudioRecorderState;\n start: () => Promise<void>;\n stop: () => Promise<Blob>;\n dispose: () => void;\n}\n","<script setup lang=\"ts\">\nimport { onBeforeUnmount, ref, useAttrs, watch } from \"vue\";\nimport { AudioRecorderError } from \"./audioRecorder\";\nimport type { AudioRecorderState } from \"./audioRecorder\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst attrs = useAttrs();\nconst canvasRef = ref<HTMLCanvasElement | null>(null);\nconst recorderState = ref<AudioRecorderState>(\"idle\");\nconst mediaRecorderRef = ref<MediaRecorder | null>(null);\nconst streamRef = ref<MediaStream | null>(null);\nconst analyserRef = ref<AnalyserNode | null>(null);\nconst audioContextRef = ref<AudioContext | null>(null);\nconst animationIdRef = ref<number | null>(null);\nconst audioChunksRef = ref<Blob[]>([]);\nconst amplitudeHistoryRef = ref<number[]>([]);\nconst scrollOffsetRef = ref(0);\nconst smoothedAmplitudeRef = ref(0);\nconst fadeOpacityRef = ref(0);\n\nfunction cleanup() {\n if (animationIdRef.value !== null) {\n cancelAnimationFrame(animationIdRef.value);\n animationIdRef.value = null;\n }\n\n const recorder = mediaRecorderRef.value;\n if (recorder && recorder.state !== \"inactive\") {\n try {\n recorder.stop();\n } catch {\n // ignore cleanup stop failures\n }\n }\n\n if (streamRef.value) {\n streamRef.value.getTracks().forEach((track) => track.stop());\n streamRef.value = null;\n }\n\n const audioContext = audioContextRef.value;\n if (audioContext && audioContext.state !== \"closed\") {\n audioContext.close().catch(() => {\n // ignore close errors\n });\n }\n\n mediaRecorderRef.value = null;\n analyserRef.value = null;\n audioContextRef.value = null;\n audioChunksRef.value = [];\n amplitudeHistoryRef.value = [];\n scrollOffsetRef.value = 0;\n smoothedAmplitudeRef.value = 0;\n fadeOpacityRef.value = 0;\n}\n\nasync function start() {\n if (recorderState.value !== \"idle\") {\n throw new AudioRecorderError(\"Recorder is already active\");\n }\n\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n streamRef.value = stream;\n\n const audioContext = new AudioContext();\n audioContextRef.value = audioContext;\n const source = audioContext.createMediaStreamSource(stream);\n const analyser = audioContext.createAnalyser();\n analyser.fftSize = 2048;\n source.connect(analyser);\n analyserRef.value = analyser;\n\n const mimeType = MediaRecorder.isTypeSupported(\"audio/webm;codecs=opus\")\n ? \"audio/webm;codecs=opus\"\n : MediaRecorder.isTypeSupported(\"audio/webm\")\n ? \"audio/webm\"\n : MediaRecorder.isTypeSupported(\"audio/mp4\")\n ? \"audio/mp4\"\n : \"\";\n\n const options = mimeType ? { mimeType } : {};\n const recorder = new MediaRecorder(stream, options);\n mediaRecorderRef.value = recorder;\n audioChunksRef.value = [];\n\n recorder.ondataavailable = (event) => {\n if (event.data.size > 0) {\n audioChunksRef.value.push(event.data);\n }\n };\n\n recorder.start(100);\n recorderState.value = \"recording\";\n } catch (error) {\n cleanup();\n if (error instanceof Error && error.name === \"NotAllowedError\") {\n throw new AudioRecorderError(\"Microphone permission denied\");\n }\n if (error instanceof Error && error.name === \"NotFoundError\") {\n throw new AudioRecorderError(\"No microphone found\");\n }\n throw new AudioRecorderError(\n error instanceof Error ? error.message : \"Failed to start recording\",\n );\n }\n}\n\nfunction stop() {\n return new Promise<Blob>((resolve, reject) => {\n const recorder = mediaRecorderRef.value;\n if (!recorder || recorderState.value !== \"recording\") {\n reject(new AudioRecorderError(\"No active recording\"));\n return;\n }\n\n recorderState.value = \"processing\";\n recorder.onstop = () => {\n const audioBlob = new Blob(audioChunksRef.value, {\n type: recorder.mimeType || \"audio/webm\",\n });\n cleanup();\n recorderState.value = \"idle\";\n resolve(audioBlob);\n };\n recorder.onerror = () => {\n cleanup();\n recorderState.value = \"idle\";\n reject(new AudioRecorderError(\"Recording failed\"));\n };\n recorder.stop();\n });\n}\n\nfunction calculateAmplitude(dataArray: Uint8Array) {\n let sum = 0;\n for (let index = 0; index < dataArray.length; index += 1) {\n const sample = (dataArray[index] ?? 128) / 128 - 1;\n sum += sample * sample;\n }\n return Math.sqrt(sum / dataArray.length);\n}\n\nfunction drawFrame() {\n const canvas = canvasRef.value;\n if (!canvas) {\n return;\n }\n\n const context = canvas.getContext(\"2d\");\n if (!context) {\n return;\n }\n\n const rect = canvas.getBoundingClientRect();\n const dpr = window.devicePixelRatio || 1;\n if (\n canvas.width !== rect.width * dpr ||\n canvas.height !== rect.height * dpr\n ) {\n canvas.width = rect.width * dpr;\n canvas.height = rect.height * dpr;\n context.scale(dpr, dpr);\n }\n\n const barWidth = 2;\n const barGap = 1;\n const barSpacing = barWidth + barGap;\n const maxBars = Math.floor(rect.width / barSpacing) + 2;\n\n if (analyserRef.value && recorderState.value === \"recording\") {\n if (amplitudeHistoryRef.value.length === 0) {\n amplitudeHistoryRef.value = Array.from({ length: maxBars }, () => 0);\n }\n\n if (fadeOpacityRef.value < 1) {\n fadeOpacityRef.value = Math.min(1, fadeOpacityRef.value + 0.03);\n }\n\n scrollOffsetRef.value += 1 / 3;\n const bufferLength = analyserRef.value.fftSize;\n const dataArray = new Uint8Array(bufferLength);\n analyserRef.value.getByteTimeDomainData(dataArray);\n const rawAmplitude = calculateAmplitude(dataArray);\n const attackSpeed = 0.12;\n const decaySpeed = 0.08;\n const speed =\n rawAmplitude > smoothedAmplitudeRef.value ? attackSpeed : decaySpeed;\n smoothedAmplitudeRef.value +=\n (rawAmplitude - smoothedAmplitudeRef.value) * speed;\n\n if (scrollOffsetRef.value >= barSpacing) {\n scrollOffsetRef.value -= barSpacing;\n amplitudeHistoryRef.value.push(smoothedAmplitudeRef.value);\n if (amplitudeHistoryRef.value.length > maxBars) {\n amplitudeHistoryRef.value = amplitudeHistoryRef.value.slice(-maxBars);\n }\n }\n }\n\n context.clearRect(0, 0, rect.width, rect.height);\n const computedStyle = window.getComputedStyle(canvas);\n context.fillStyle = computedStyle.color;\n context.globalAlpha = fadeOpacityRef.value;\n\n const centerY = rect.height / 2;\n const maxAmplitude = rect.height / 2 - 2;\n const edgeFadeWidth = 12;\n\n for (let index = 0; index < amplitudeHistoryRef.value.length; index += 1) {\n const amplitude = amplitudeHistoryRef.value[index] ?? 0;\n const scaledAmplitude = Math.min(amplitude * 4, 1);\n const barHeight = Math.max(2, scaledAmplitude * maxAmplitude * 2);\n const x =\n rect.width -\n (amplitudeHistoryRef.value.length - index) * barSpacing -\n scrollOffsetRef.value;\n const y = centerY - barHeight / 2;\n if (x + barWidth <= 0 || x >= rect.width) {\n continue;\n }\n\n let edgeOpacity = 1;\n if (x < edgeFadeWidth) {\n edgeOpacity = Math.max(0, x / edgeFadeWidth);\n } else if (x > rect.width - edgeFadeWidth) {\n edgeOpacity = Math.max(0, (rect.width - x) / edgeFadeWidth);\n }\n\n context.globalAlpha = fadeOpacityRef.value * edgeOpacity;\n context.fillRect(x, y, barWidth, barHeight);\n }\n\n animationIdRef.value = requestAnimationFrame(drawFrame);\n}\n\nwatch(\n recorderState,\n () => {\n if (animationIdRef.value !== null) {\n cancelAnimationFrame(animationIdRef.value);\n animationIdRef.value = null;\n }\n animationIdRef.value = requestAnimationFrame(drawFrame);\n },\n { immediate: true },\n);\n\nonBeforeUnmount(() => {\n cleanup();\n});\n\ndefineExpose({\n get state() {\n return recorderState.value;\n },\n start,\n stop,\n dispose: cleanup,\n});\n</script>\n\n<template>\n <div data-copilotkit class=\"cpk:w-full cpk:px-5 cpk:py-3\" v-bind=\"attrs\">\n <canvas ref=\"canvasRef\" class=\"cpk:block cpk:h-[26px] cpk:w-full\" />\n </div>\n</template>\n","<script setup lang=\"ts\">\ndefineProps<{\n featureName: string;\n}>();\n\nconst containerStyle = {\n padding: \"8px 12px\",\n backgroundColor: \"#fffbeb\",\n border: \"1px solid #fbbf24\",\n borderRadius: \"6px\",\n fontSize: \"13px\",\n color: \"#92400e\",\n fontFamily:\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif\",\n} as const;\n\nconst linkStyle = {\n color: \"#b45309\",\n textDecoration: \"underline\",\n} as const;\n</script>\n\n<template>\n <div :style=\"containerStyle\" data-testid=\"copilot-inline-feature-warning\">\n ⚠ The \"{{ featureName }}\" feature requires a CopilotKit license.\n <a\n href=\"https://copilotkit.ai/pricing\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n :style=\"linkStyle\"\n >\n Get one at copilotkit.ai/pricing\n </a>\n </div>\n</template>\n","import { computed, shallowRef, toValue, triggerRef, watch } from \"vue\";\nimport type { MaybeRefOrGetter } from \"vue\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\nimport { HttpAgent } from \"@ag-ui/client\";\nimport type { AbstractAgent } from \"@ag-ui/client\";\nimport {\n ProxiedCopilotRuntimeAgent,\n CopilotKitCoreRuntimeConnectionStatus,\n} from \"@copilotkit/core\";\nimport type {\n CopilotRuntimeTransport,\n SubscribeToAgentSubscriber,\n} from \"@copilotkit/core\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { useCopilotChatConfiguration } from \"../providers/useCopilotChatConfiguration\";\n\nexport enum UseAgentUpdate {\n OnMessagesChanged = \"OnMessagesChanged\",\n OnStateChanged = \"OnStateChanged\",\n OnRunStatusChanged = \"OnRunStatusChanged\",\n}\n\nconst ALL_UPDATES: UseAgentUpdate[] = [\n UseAgentUpdate.OnMessagesChanged,\n UseAgentUpdate.OnStateChanged,\n UseAgentUpdate.OnRunStatusChanged,\n];\n\nexport interface UseAgentProps {\n agentId?: MaybeRefOrGetter<string | undefined>;\n threadId?: MaybeRefOrGetter<string | undefined>;\n updates?: UseAgentUpdate[];\n /**\n * Throttle interval (in milliseconds) for re-renders triggered by\n * `onMessagesChanged` and `onStateChanged` notifications. Useful to reduce\n * re-render frequency during high-frequency streaming updates.\n *\n * Uses a leading+trailing pattern with a shared window — first update\n * fires immediately, subsequent updates within the window are coalesced,\n * and a trailing timer ensures the most recent update fires after the\n * window expires. See `CopilotKitCore.subscribeToAgentWithOptions` in\n * `@copilotkit/core` for details.\n *\n * Resolved as: `throttleMs ?? provider defaultThrottleMs ?? 0`.\n * Passing `throttleMs: 0` explicitly disables throttling even when the\n * provider specifies a non-zero `defaultThrottleMs`.\n *\n * Run lifecycle callbacks (`onRunInitialized`, `onRunFinalized`,\n * `onRunFailed`, `onRunErrorEvent`) always fire immediately.\n *\n * @default undefined\n * When unset, inherits from the provider's `defaultThrottleMs`;\n * if that is also unset, the effective value is `0` (no throttle).\n */\n throttleMs?: MaybeRefOrGetter<number | undefined>;\n}\n\nfunction cloneForThread(\n source: AbstractAgent,\n threadId: string,\n headers: Record<string, string>,\n): AbstractAgent {\n const clone = source.clone();\n if (clone === source) {\n throw new Error(\n `useAgent: ${source.constructor.name}.clone() returned the same instance. ` +\n \"clone() must return a new, independent object.\",\n );\n }\n\n clone.threadId = threadId;\n clone.setMessages([]);\n clone.setState({});\n if (clone instanceof HttpAgent) {\n clone.headers = { ...headers };\n }\n return clone;\n}\n\nexport const globalThreadCloneMap = new WeakMap<\n AbstractAgent,\n Map<string, AbstractAgent>\n>();\n\nexport function getThreadClone(\n registryAgent: AbstractAgent | undefined | null,\n threadId: string | undefined | null,\n): AbstractAgent | undefined {\n if (!registryAgent || !threadId) return undefined;\n return globalThreadCloneMap.get(registryAgent)?.get(threadId);\n}\n\nfunction getOrCreateThreadClone(\n source: AbstractAgent,\n threadId: string,\n headers: Record<string, string>,\n): AbstractAgent {\n let byThread = globalThreadCloneMap.get(source);\n if (!byThread) {\n byThread = new Map();\n globalThreadCloneMap.set(source, byThread);\n }\n\n const existing = byThread.get(threadId);\n if (existing) {\n existing.threadId = threadId;\n if (existing instanceof HttpAgent) {\n existing.headers = { ...headers };\n }\n return existing;\n }\n\n const clone = cloneForThread(source, threadId, headers);\n byThread.set(threadId, clone);\n return clone;\n}\n\n/**\n * Resolves and subscribes to a CopilotKit agent for the current Vue scope.\n *\n * It returns a reactive `agent` ref that updates when the selected agent\n * changes, when runtime connection state changes, or when subscribed update\n * events fire.\n *\n * @example\n * ```ts\n * const { agent } = useAgent({ agentId: \"default\" });\n * ```\n */\nexport function useAgent(props: UseAgentProps = {}) {\n const agentId = computed(() => toValue(props.agentId) ?? DEFAULT_AGENT_ID);\n const chatConfig = useCopilotChatConfiguration();\n const threadId = computed(\n () => toValue(props.threadId) ?? chatConfig.value?.threadId,\n );\n const { copilotkit } = useCopilotKit();\n const updateFlags = computed(() => props.updates ?? ALL_UPDATES);\n // Read the provider-level default so it appears in the subscribe watcher\n // deps. `subscribeToAgentWithOptions` reads it from the core instance, but\n // Vue still needs the dep to know when to resubscribe (same role it plays\n // in React's `useEffect` dep array).\n const providerThrottleMs = computed(() => copilotkit.value.defaultThrottleMs);\n const hookThrottleMs = computed(() => toValue(props.throttleMs));\n\n const agent = shallowRef<AbstractAgent | null>(null);\n const subscriptionAgent = shallowRef<AbstractAgent | null>(null);\n const provisionalAgentCache = new Map<string, ProxiedCopilotRuntimeAgent>();\n\n const createProvisionalAgent = (\n id: string,\n runtimeUrl: string,\n transport: CopilotRuntimeTransport,\n headers: Record<string, string>,\n ) => {\n const provisional = new ProxiedCopilotRuntimeAgent({\n runtimeUrl,\n agentId: id,\n transport,\n runtimeMode: \"pending\",\n });\n provisional.headers = { ...headers };\n return provisional;\n };\n\n const resolveAgent = () => {\n const id = agentId.value;\n const resolvedThreadId = threadId.value;\n const cacheKey = resolvedThreadId ? `${id}:${resolvedThreadId}` : id;\n const core = copilotkit.value;\n const existing = core.getAgent(id);\n if (existing) {\n provisionalAgentCache.delete(cacheKey);\n provisionalAgentCache.delete(id);\n\n const resolvedAgent = resolvedThreadId\n ? getOrCreateThreadClone(existing, resolvedThreadId, core.headers)\n : existing;\n const shouldForceUpdate = agent.value === resolvedAgent;\n agent.value = resolvedAgent;\n subscriptionAgent.value = resolvedAgent;\n if (shouldForceUpdate) {\n triggerRef(agent);\n }\n return;\n }\n\n const isRuntimeConfigured = core.runtimeUrl !== undefined;\n const status = core.runtimeConnectionStatus;\n\n if (\n isRuntimeConfigured &&\n (status === CopilotKitCoreRuntimeConnectionStatus.Disconnected ||\n status === CopilotKitCoreRuntimeConnectionStatus.Connecting ||\n status === CopilotKitCoreRuntimeConnectionStatus.Error)\n ) {\n const cached = provisionalAgentCache.get(cacheKey);\n if (cached) {\n cached.headers = { ...core.headers };\n if (resolvedThreadId) {\n cached.threadId = resolvedThreadId;\n }\n agent.value = cached;\n subscriptionAgent.value = cached;\n return;\n }\n\n const provisional = createProvisionalAgent(\n id,\n core.runtimeUrl!,\n core.runtimeTransport,\n core.headers,\n );\n if (resolvedThreadId) {\n provisional.threadId = resolvedThreadId;\n }\n provisionalAgentCache.set(cacheKey, provisional);\n agent.value = provisional;\n subscriptionAgent.value = provisional;\n return;\n }\n\n const knownAgents = Object.keys(core.agents ?? {});\n const runtimePart = isRuntimeConfigured\n ? `runtimeUrl=${core.runtimeUrl}`\n : \"no runtimeUrl\";\n throw new Error(\n `useAgent: Agent '${id}' not found after runtime sync (${runtimePart}). ` +\n (knownAgents.length\n ? `Known agents: [${knownAgents.join(\", \")}]`\n : \"No agents registered.\") +\n \" Verify your runtime /info and/or agents__unsafe_dev_only.\",\n );\n };\n\n watch(\n [\n agentId,\n () => copilotkit.value.agents,\n () => copilotkit.value.runtimeConnectionStatus,\n () => copilotkit.value.runtimeUrl,\n () => copilotkit.value.runtimeTransport,\n () =>\n JSON.stringify(\n Object.entries(copilotkit.value.headers ?? {}).sort(([a], [b]) =>\n a.localeCompare(b),\n ),\n ),\n threadId,\n ],\n resolveAgent,\n { immediate: true },\n );\n\n watch(\n [\n subscriptionAgent,\n () =>\n JSON.stringify(\n Object.entries(copilotkit.value.headers ?? {}).sort(([a], [b]) =>\n a.localeCompare(b),\n ),\n ),\n ],\n ([currentAgent]) => {\n if (currentAgent instanceof HttpAgent) {\n currentAgent.headers = { ...copilotkit.value.headers };\n }\n },\n { immediate: true },\n );\n\n // Subscribe through the shared `CopilotKitCore.subscribeToAgentWithOptions`\n // API. Core owns:\n // - shared leading+trailing throttle window across `onMessagesChanged`\n // and `onStateChanged` (parity with React)\n // - safeCall-guarded callbacks (errors in subscribers never poison the\n // agent notification loop)\n // - validation/fallback for invalid `throttleMs`\n // - `onRunErrorEvent` in the run-status callback set\n //\n // The hook only schedules a microtask-batched `triggerRef(agent)` so\n // multiple synchronous notifications (e.g. state + run-status firing in\n // the same tick) coalesce into a single Vue re-render — matching React's\n // `queueMicrotask`-batched forceUpdate strategy.\n watch(\n [subscriptionAgent, updateFlags, hookThrottleMs, providerThrottleMs],\n ([a, flags], _old, onCleanup) => {\n const f = flags as UseAgentUpdate[];\n if (!a || f.length === 0) return;\n\n let active = true;\n let batchScheduled = false;\n const batchedRefresh = () => {\n if (!active) return;\n if (!batchScheduled) {\n batchScheduled = true;\n queueMicrotask(() => {\n batchScheduled = false;\n if (active) {\n triggerRef(agent);\n }\n });\n }\n };\n\n const handlers: SubscribeToAgentSubscriber = {};\n\n if (f.includes(UseAgentUpdate.OnMessagesChanged)) {\n // Messages fire immediately (no microtask indirection) so shared-\n // window throttling in core sees an unadorned callback. Matches\n // React's `handlers.onMessagesChanged = forceUpdate`.\n handlers.onMessagesChanged = () => {\n if (active) triggerRef(agent);\n };\n }\n\n if (f.includes(UseAgentUpdate.OnStateChanged)) {\n handlers.onStateChanged = batchedRefresh;\n }\n\n if (f.includes(UseAgentUpdate.OnRunStatusChanged)) {\n handlers.onRunInitialized = batchedRefresh;\n handlers.onRunFinalized = batchedRefresh;\n handlers.onRunFailed = batchedRefresh;\n // Protocol-level RUN_ERROR event (distinct from `onRunFailed`\n // which handles local exceptions like network errors).\n handlers.onRunErrorEvent = batchedRefresh;\n }\n\n const subscription = copilotkit.value.subscribeToAgentWithOptions(\n a as AbstractAgent,\n handlers,\n { throttleMs: toValue(props.throttleMs) },\n );\n\n onCleanup(() => {\n active = false;\n subscription.unsubscribe();\n });\n },\n { immediate: true },\n );\n\n return { agent };\n}\n","import { computed, ref, toValue, watch } from \"vue\";\nimport type { MaybeRefOrGetter, Ref } from \"vue\";\nimport type { Suggestion } from \"@copilotkit/core\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { useCopilotChatConfiguration } from \"../providers/useCopilotChatConfiguration\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\n\nexport interface UseSuggestionsOptions {\n agentId?: MaybeRefOrGetter<string | undefined>;\n}\n\nexport interface UseSuggestionsResult {\n suggestions: Ref<Suggestion[]>;\n isLoading: Ref<boolean>;\n reloadSuggestions: () => void;\n clearSuggestions: () => void;\n}\n\n/**\n * Provides reactive access to agent suggestions.\n *\n * It tracks suggestion updates for the resolved agent and exposes helpers to\n * reload or clear suggestions.\n *\n * @example\n * ```ts\n * const { suggestions, isLoading, reloadSuggestions } = useSuggestions({\n * agentId: \"default\",\n * });\n * ```\n */\nexport function useSuggestions(\n options: UseSuggestionsOptions = {},\n): UseSuggestionsResult {\n const { copilotkit } = useCopilotKit();\n const config = useCopilotChatConfiguration();\n const resolvedAgentId = computed(\n () => toValue(options.agentId) ?? config.value?.agentId ?? DEFAULT_AGENT_ID,\n );\n\n const suggestions = ref<Suggestion[]>([]);\n const isLoading = ref(false);\n\n const initState = () => {\n const result = copilotkit.value.getSuggestions(resolvedAgentId.value);\n suggestions.value = result.suggestions;\n isLoading.value = result.isLoading;\n };\n\n watch([() => copilotkit.value, resolvedAgentId], () => initState(), {\n immediate: true,\n });\n\n watch(\n [() => copilotkit.value, resolvedAgentId],\n (_newValues, _old, onCleanup) => {\n const core = copilotkit.value;\n const agentId = resolvedAgentId.value;\n const sub = core.subscribe({\n onSuggestionsChanged: ({ agentId: changedAgentId, suggestions: s }) => {\n if (changedAgentId !== agentId) return;\n suggestions.value = s;\n const result = core.getSuggestions(agentId);\n isLoading.value = result.isLoading;\n },\n onSuggestionsStartedLoading: ({ agentId: changedAgentId }) => {\n if (changedAgentId !== agentId) return;\n isLoading.value = true;\n },\n onSuggestionsFinishedLoading: ({ agentId: changedAgentId }) => {\n if (changedAgentId !== agentId) return;\n isLoading.value = false;\n },\n onSuggestionsConfigChanged: () => {\n const result = core.getSuggestions(agentId);\n suggestions.value = result.suggestions;\n isLoading.value = result.isLoading;\n },\n });\n onCleanup(() => sub.unsubscribe());\n },\n { immediate: true },\n );\n\n const reloadSuggestions = () => {\n copilotkit.value.reloadSuggestions(resolvedAgentId.value);\n };\n const clearSuggestions = () => {\n copilotkit.value.clearSuggestions(resolvedAgentId.value);\n };\n\n return {\n suggestions,\n isLoading,\n reloadSuggestions,\n clearSuggestions,\n };\n}\n","import { computed, onBeforeUnmount, onMounted, ref, toValue, watch } from \"vue\";\nimport type { MaybeRefOrGetter, Ref } from \"vue\";\nimport {\n randomUUID,\n getModalityFromMimeType,\n exceedsMaxSize,\n readFileAsBase64,\n generateVideoThumbnail,\n matchesAcceptFilter,\n formatFileSize,\n} from \"@copilotkit/shared\";\nimport type {\n Attachment,\n AttachmentUploadResult,\n AttachmentsConfig,\n} from \"@copilotkit/shared\";\n\nexport interface UseAttachmentsProps {\n config?: MaybeRefOrGetter<AttachmentsConfig | undefined>;\n}\n\nexport interface UseAttachmentsReturn {\n attachments: Ref<Attachment[]>;\n enabled: Ref<boolean>;\n dragOver: Ref<boolean>;\n fileInputRef: Ref<HTMLInputElement | null>;\n containerRef: Ref<HTMLElement | null>;\n processFiles: (files: File[]) => Promise<void>;\n handleFileUpload: (event: Event) => Promise<void>;\n handleDragOver: (event: DragEvent) => void;\n handleDragLeave: (event: DragEvent) => void;\n handleDrop: (event: DragEvent) => Promise<void>;\n removeAttachment: (id: string) => void;\n consumeAttachments: () => Attachment[];\n}\n\nexport function useAttachments(\n props: UseAttachmentsProps,\n): UseAttachmentsReturn {\n const attachments = ref<Attachment[]>([]);\n const dragOver = ref(false);\n const fileInputRef = ref<HTMLInputElement | null>(null);\n const containerRef = ref<HTMLElement | null>(null);\n const configRef = ref<AttachmentsConfig | undefined>(toValue(props.config));\n const attachmentsRef = ref<Attachment[]>(attachments.value);\n const enabled = computed(() => configRef.value?.enabled ?? false);\n\n watch(\n () => toValue(props.config),\n (next) => {\n configRef.value = next;\n },\n { immediate: true },\n );\n\n const setAttachments = (next: Attachment[]) => {\n attachments.value = next;\n attachmentsRef.value = next;\n };\n\n const updateAttachments = (\n updater: (previous: Attachment[]) => Attachment[],\n ) => {\n setAttachments(updater(attachmentsRef.value));\n };\n\n async function processFiles(files: File[]) {\n const config = configRef.value;\n const accept = config?.accept ?? \"*/*\";\n const maxSize = config?.maxSize ?? 20 * 1024 * 1024;\n\n const rejectedFiles = files.filter(\n (file) => !matchesAcceptFilter(file, accept),\n );\n for (const file of rejectedFiles) {\n config?.onUploadFailed?.({\n reason: \"invalid-type\",\n file,\n message: `File \"${file.name}\" is not accepted. Supported types: ${accept}`,\n });\n }\n\n const validFiles = files.filter((file) =>\n matchesAcceptFilter(file, accept),\n );\n for (const file of validFiles) {\n if (exceedsMaxSize(file, maxSize)) {\n config?.onUploadFailed?.({\n reason: \"file-too-large\",\n file,\n message: `File \"${file.name}\" exceeds the maximum size of ${formatFileSize(maxSize)}`,\n });\n continue;\n }\n\n const modality = getModalityFromMimeType(file.type);\n const placeholderId = randomUUID();\n updateAttachments((previous) => [\n ...previous,\n {\n id: placeholderId,\n type: modality,\n source: { type: \"data\", value: \"\", mimeType: file.type },\n filename: file.name,\n size: file.size,\n status: \"uploading\",\n },\n ]);\n\n try {\n let source: Attachment[\"source\"];\n let uploadMetadata: Record<string, unknown> | undefined;\n if (config?.onUpload) {\n const uploadResult: AttachmentUploadResult =\n await config.onUpload(file);\n const { metadata, ...uploadSource } = uploadResult;\n source = uploadSource;\n uploadMetadata = metadata;\n } else {\n const base64 = await readFileAsBase64(file);\n source = { type: \"data\", value: base64, mimeType: file.type };\n }\n\n let thumbnail: string | undefined;\n if (modality === \"video\") {\n thumbnail = await generateVideoThumbnail(file);\n }\n\n updateAttachments((previous) =>\n previous.map((attachment) =>\n attachment.id === placeholderId\n ? {\n ...attachment,\n source,\n status: \"ready\",\n thumbnail,\n metadata: uploadMetadata,\n }\n : attachment,\n ),\n );\n } catch (error) {\n updateAttachments((previous) =>\n previous.filter((attachment) => attachment.id !== placeholderId),\n );\n console.error(`[CopilotKit] Failed to upload \"${file.name}\":`, error);\n config?.onUploadFailed?.({\n reason: \"upload-failed\",\n file,\n message:\n error instanceof Error\n ? error.message\n : `Failed to upload \"${file.name}\"`,\n });\n }\n }\n }\n\n async function handleFileUpload(event: Event) {\n const target = event.target as HTMLInputElement | null;\n if (!target?.files?.length) return;\n await processFiles(Array.from(target.files));\n if (target) target.value = \"\";\n }\n\n function handleDragOver(event: DragEvent) {\n if (!enabled.value) return;\n event.preventDefault();\n event.stopPropagation();\n dragOver.value = true;\n }\n\n function handleDragLeave(event: DragEvent) {\n event.preventDefault();\n event.stopPropagation();\n dragOver.value = false;\n }\n\n async function handleDrop(event: DragEvent) {\n event.preventDefault();\n event.stopPropagation();\n dragOver.value = false;\n if (!enabled.value) return;\n\n const files = Array.from(event.dataTransfer?.files ?? []);\n if (files.length > 0) {\n await processFiles(files);\n }\n }\n\n function removeAttachment(id: string) {\n updateAttachments((previous) =>\n previous.filter((attachment) => attachment.id !== id),\n );\n }\n\n function consumeAttachments() {\n const ready = attachmentsRef.value.filter(\n (attachment) => attachment.status === \"ready\",\n );\n if (ready.length === 0) {\n return ready;\n }\n updateAttachments((previous) =>\n previous.filter((attachment) => attachment.status !== \"ready\"),\n );\n if (fileInputRef.value) {\n fileInputRef.value.value = \"\";\n }\n return ready;\n }\n\n async function handlePaste(event: ClipboardEvent) {\n if (!enabled.value) return;\n\n const target = event.target as HTMLElement | null;\n if (!target || !containerRef.value?.contains(target)) return;\n\n const accept = configRef.value?.accept ?? \"*/*\";\n const items = Array.from(event.clipboardData?.items ?? []);\n const fileItems = items.filter((item) => {\n if (item.kind !== \"file\") return false;\n const file = item.getAsFile();\n return file !== null && matchesAcceptFilter(file, accept);\n });\n if (fileItems.length === 0) return;\n\n event.preventDefault();\n const files = fileItems\n .map((item) => item.getAsFile())\n .filter((file): file is File => file !== null);\n await processFiles(files);\n }\n\n onMounted(() => {\n if (typeof document !== \"undefined\") {\n document.addEventListener(\"paste\", handlePaste);\n }\n });\n\n onBeforeUnmount(() => {\n if (typeof document !== \"undefined\") {\n document.removeEventListener(\"paste\", handlePaste);\n }\n });\n\n return {\n attachments,\n enabled,\n dragOver,\n fileInputRef,\n containerRef,\n processFiles,\n handleFileUpload,\n handleDragOver,\n handleDragLeave,\n handleDrop,\n removeAttachment,\n consumeAttachments,\n };\n}\n","import type { CopilotKitCoreVue } from \"./vue-core\";\nimport { TranscriptionErrorCode } from \"@copilotkit/shared\";\nimport type { TranscriptionErrorResponse } from \"@copilotkit/shared\";\n\nexport interface TranscriptionResult {\n text: string;\n size: number;\n type: string;\n}\n\nexport interface TranscriptionErrorInfo {\n code: TranscriptionErrorCode;\n message: string;\n retryable: boolean;\n}\n\nexport { TranscriptionErrorCode };\n\nasync function blobToBase64(blob: Blob): Promise<string> {\n return await new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onloadend = () => {\n const result = reader.result as string;\n resolve(result.split(\",\")[1] ?? \"\");\n };\n reader.addEventListener(\"error\", () =>\n reject(new Error(\"Failed to read audio data\")),\n );\n reader.readAsDataURL(blob);\n });\n}\n\nfunction isTranscriptionErrorResponse(\n data: unknown,\n): data is TranscriptionErrorResponse {\n return (\n typeof data === \"object\" &&\n data !== null &&\n \"error\" in data &&\n \"message\" in data &&\n typeof (data as TranscriptionErrorResponse).error === \"string\" &&\n typeof (data as TranscriptionErrorResponse).message === \"string\"\n );\n}\n\nfunction parseTranscriptionError(\n response: TranscriptionErrorResponse,\n): TranscriptionErrorInfo {\n return {\n code: response.error,\n message: response.message,\n retryable: response.retryable ?? false,\n };\n}\n\nexport class TranscriptionError extends Error {\n public readonly info: TranscriptionErrorInfo;\n\n constructor(info: TranscriptionErrorInfo) {\n super(info.message);\n this.name = \"TranscriptionError\";\n this.info = info;\n }\n}\n\nexport async function transcribeAudio(\n core: CopilotKitCoreVue,\n audioBlob: Blob,\n filename: string = \"recording.webm\",\n): Promise<TranscriptionResult> {\n const runtimeUrl = core.runtimeUrl;\n if (!runtimeUrl) {\n throw new TranscriptionError({\n code: TranscriptionErrorCode.INVALID_REQUEST,\n message: \"Runtime URL is not configured\",\n retryable: false,\n });\n }\n\n const headers: Record<string, string> = { ...core.headers };\n let response: Response;\n\n try {\n if (core.runtimeTransport === \"single\") {\n const base64Audio = await blobToBase64(audioBlob);\n\n headers[\"Content-Type\"] = \"application/json\";\n\n response = await fetch(runtimeUrl, {\n method: \"POST\",\n headers,\n body: JSON.stringify({\n method: \"transcribe\",\n body: {\n audio: base64Audio,\n mimeType: audioBlob.type || \"audio/webm\",\n filename,\n },\n }),\n });\n } else {\n delete headers[\"Content-Type\"];\n\n const formData = new FormData();\n formData.append(\"audio\", audioBlob, filename);\n\n response = await fetch(`${runtimeUrl}/transcribe`, {\n method: \"POST\",\n headers,\n body: formData,\n });\n }\n } catch (error) {\n throw new TranscriptionError({\n code: TranscriptionErrorCode.NETWORK_ERROR,\n message:\n error instanceof Error ? error.message : \"Network request failed\",\n retryable: true,\n });\n }\n\n if (!response.ok) {\n let errorData: unknown;\n try {\n errorData = await response.json();\n } catch {\n throw new TranscriptionError({\n code: TranscriptionErrorCode.PROVIDER_ERROR,\n message: `HTTP ${response.status}: ${response.statusText}`,\n retryable: response.status >= 500,\n });\n }\n\n if (isTranscriptionErrorResponse(errorData)) {\n throw new TranscriptionError(parseTranscriptionError(errorData));\n }\n\n throw new TranscriptionError({\n code: TranscriptionErrorCode.PROVIDER_ERROR,\n message:\n typeof errorData === \"object\" &&\n errorData !== null &&\n \"message\" in errorData\n ? String((errorData as { message: unknown }).message)\n : \"Transcription failed\",\n retryable: response.status >= 500,\n });\n }\n\n return (await response.json()) as TranscriptionResult;\n}\n","import { onBeforeUnmount, onMounted, readonly, ref, type Ref } from \"vue\";\n\n/**\n * Vue-idiomatic result of {@link useKeyboardHeight}. Fields mirror the React\n * `KeyboardState` shape (`isKeyboardOpen`, `keyboardHeight`, `availableHeight`,\n * `viewportHeight`) and are exposed as readonly refs so consumers can bind them\n * reactively inside templates or computed values.\n */\nexport interface KeyboardState {\n isKeyboardOpen: Readonly<Ref<boolean>>;\n keyboardHeight: Readonly<Ref<number>>;\n availableHeight: Readonly<Ref<number>>;\n viewportHeight: Readonly<Ref<number>>;\n}\n\n/**\n * Composable to detect mobile keyboard appearance and calculate available\n * viewport height. Uses the Visual Viewport API to track keyboard state on\n * mobile devices.\n *\n * Mirrors the React `useKeyboardHeight` hook: returns `keyboardHeight` as the\n * difference between `window.innerHeight` and `visualViewport.height`, clamped\n * to `0`, and reports the keyboard as open when the diff exceeds `150` px.\n *\n * @example\n * ```vue\n * <script setup lang=\"ts\">\n * import { useKeyboardHeight } from \"@copilotkit/vue\";\n *\n * const { isKeyboardOpen, keyboardHeight } = useKeyboardHeight();\n * </script>\n * ```\n */\nexport function useKeyboardHeight(): KeyboardState {\n const initialHeight = typeof window !== \"undefined\" ? window.innerHeight : 0;\n const isKeyboardOpen = ref(false);\n const keyboardHeight = ref(0);\n const availableHeight = ref(initialHeight);\n const viewportHeight = ref(initialHeight);\n\n const updateKeyboardState = () => {\n if (typeof window === \"undefined\") return;\n const visualViewport = window.visualViewport;\n if (!visualViewport) return;\n\n const layoutHeight = window.innerHeight;\n const visualHeight = visualViewport.height;\n\n // Keyboard height = layout viewport minus visual viewport, clamped to 0.\n const nextKeyboardHeight = Math.max(0, layoutHeight - visualHeight);\n // Only treat the keyboard as open past the 150px threshold, matching\n // the React implementation's mobile heuristic.\n const nextIsOpen = nextKeyboardHeight > 150;\n\n keyboardHeight.value = nextKeyboardHeight;\n isKeyboardOpen.value = nextIsOpen;\n availableHeight.value = visualHeight;\n viewportHeight.value = layoutHeight;\n };\n\n let visualViewport: VisualViewport | null = null;\n\n onMounted(() => {\n if (typeof window === \"undefined\") return;\n visualViewport = window.visualViewport ?? null;\n if (!visualViewport) return;\n\n updateKeyboardState();\n\n visualViewport.addEventListener(\"resize\", updateKeyboardState);\n visualViewport.addEventListener(\"scroll\", updateKeyboardState);\n });\n\n onBeforeUnmount(() => {\n if (!visualViewport) return;\n visualViewport.removeEventListener(\"resize\", updateKeyboardState);\n visualViewport.removeEventListener(\"scroll\", updateKeyboardState);\n visualViewport = null;\n });\n\n return {\n isKeyboardOpen: readonly(isKeyboardOpen),\n keyboardHeight: readonly(keyboardHeight),\n availableHeight: readonly(availableHeight),\n viewportHeight: readonly(viewportHeight),\n };\n}\n","import type { InjectionKey, Ref } from \"vue\";\nimport { ref } from \"vue\";\n\n/**\n * Vue counterpart of React's `LastUserMessageContext`.\n *\n * Used by `CopilotChatView` to announce the latest user message\n * to descendants (notably `usePinToSend`), so scroll logic can anchor\n * the viewport to the most recent user turn in \"pin-to-send\" mode.\n *\n * `sendNonce` increments on each new send so repeated IDs (e.g., message\n * edits that preserve the ID) still trigger dependent effects.\n *\n * Vue divergence: React exposes a `React.Context` whose value is replaced\n * via `<Provider value={...}>`. Vue idiomatically provides a `Ref` so\n * descendant `watch` effects fire when the value changes; the underlying\n * `{ id, sendNonce }` shape and semantics match React 1:1.\n */\nexport type LastUserMessageState = {\n id: string | null;\n sendNonce: number;\n};\n\nexport const DEFAULT_LAST_USER_MESSAGE_STATE: LastUserMessageState = {\n id: null,\n sendNonce: 0,\n};\n\nexport const LastUserMessageKey: InjectionKey<Ref<LastUserMessageState>> =\n Symbol(\"LastUserMessage\");\n\n/**\n * Returns the default `LastUserMessageState` ref used when no provider\n * has been mounted above the consumer. Mirrors React's context default\n * value (`{ id: null, sendNonce: 0 }`).\n */\nexport function createDefaultLastUserMessageRef(): Ref<LastUserMessageState> {\n return ref({ ...DEFAULT_LAST_USER_MESSAGE_STATE });\n}\n","import { inject, watch, type Ref } from \"vue\";\nimport {\n LastUserMessageKey,\n createDefaultLastUserMessageRef,\n} from \"../components/chat/last-user-message-context\";\n\nexport interface UsePinToSendOptions {\n scrollRef: Ref<HTMLElement | null>;\n contentRef: Ref<HTMLElement | null>;\n spacerRef: Ref<HTMLElement | null>;\n topOffset?: number;\n}\n\n/**\n * Vue counterpart of React's `usePinToSend` (`packages/react-core/src/v2/hooks/use-pin-to-send.ts`).\n *\n * Anchors the chat scroll container so the most recent user message stays\n * pinned near the top of the viewport while the assistant streams a\n * response beneath it.\n *\n * Implementation parity with React:\n * - Reads the latest user message via the `LastUserMessageContext`\n * equivalent (`LastUserMessageKey` + `Ref<LastUserMessageState>`).\n * - On each `sendNonce` increment, sizes the spacer to\n * `viewportHeight - bubbleHeight - topOffset` and scrolls so the bubble\n * sits `topOffset` from the viewport top (padding above the bubble is\n * pushed off-screen).\n * - Installs a shrink-only `ResizeObserver` on `contentRef` that collapses\n * the spacer as the assistant response grows; never grows it back.\n * - Cancels the scheduled `requestAnimationFrame` and disconnects the\n * `ResizeObserver` on subsequent re-runs and on scope dispose.\n */\nexport function usePinToSend({\n scrollRef,\n contentRef,\n spacerRef,\n topOffset = 16,\n}: UsePinToSendOptions): void {\n const lastUserMessage = inject(\n LastUserMessageKey,\n createDefaultLastUserMessageRef(),\n true,\n );\n\n let lastNonce = -1;\n let currentSpacerHeight = 0;\n let raf: number | null = null;\n let ro: ResizeObserver | null = null;\n\n function teardown() {\n if (raf !== null && typeof cancelAnimationFrame === \"function\") {\n cancelAnimationFrame(raf);\n }\n raf = null;\n ro?.disconnect();\n ro = null;\n }\n\n watch(\n [\n () => lastUserMessage.value.id,\n () => lastUserMessage.value.sendNonce,\n scrollRef,\n contentRef,\n spacerRef,\n () => topOffset,\n ],\n ([id, sendNonce, scrollEl, contentEl, spacerEl], _old, onCleanup) => {\n // Always tear down the previous run's RAF / ResizeObserver before\n // evaluating any of the early-exit guards below. Mirrors React\n // `useEffect` cleanup semantics: the prior run's cleanup runs before\n // the next callback executes regardless of why the deps changed.\n // Without this, a reactive `autoScroll` mode change (e.g. switching\n // away from `\"pin-to-send\"`) or a `ref` swap that doesn't bump\n // `sendNonce` would leak the stale content-element observer because\n // the nonce guard skips the body. Registering via `onCleanup` also\n // covers watcher stop on scope dispose, so an explicit\n // `onScopeDispose(teardown)` is no longer required.\n onCleanup(teardown);\n\n if (sendNonce === lastNonce) return;\n lastNonce = sendNonce;\n\n if (!id) return;\n if (!scrollEl || !contentEl || !spacerEl) return;\n\n const escaped =\n typeof CSS !== \"undefined\" && typeof CSS.escape === \"function\"\n ? CSS.escape(id)\n : id.replace(/[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^`{|}~]/g, \"\\\\$&\");\n const targetEl = contentEl.querySelector<HTMLElement>(\n `[data-message-id=\"${escaped}\"]`,\n );\n if (!targetEl) return;\n\n // The target message's element has a top padding (e.g. `pt-10`) that\n // creates breathing room above the visible bubble. When we \"anchor at\n // the top\", we mean anchor the *bubble*, not the element's padded box.\n // So we scroll past the padding (it goes above the viewport, hiding\n // whatever was above the element too — including the previous message's\n // trailing copy button).\n const viewportHeight = scrollEl.clientHeight;\n const userMessageHeight = targetEl.getBoundingClientRect().height;\n const paddingTop = parseFloat(getComputedStyle(targetEl).paddingTop) || 0;\n const bubbleHeight = Math.max(0, userMessageHeight - paddingTop);\n const spacerHeight = Math.max(\n 0,\n viewportHeight - bubbleHeight - topOffset,\n );\n\n spacerEl.style.height = `${spacerHeight}px`;\n currentSpacerHeight = spacerHeight;\n\n if (typeof requestAnimationFrame === \"function\") {\n raf = requestAnimationFrame(() => {\n // Scroll so the BUBBLE is `topOffset` from the viewport top — the\n // padding above the bubble ends up scrolled off-screen.\n const targetTop =\n computeOffsetTop(targetEl, scrollEl) + paddingTop - topOffset;\n scrollEl.scrollTo({\n top: Math.max(0, targetTop),\n behavior: \"smooth\",\n });\n });\n }\n\n // Shrink-only ResizeObserver: as the assistant response grows below the\n // anchored user message, collapse the spacer by the same amount so total\n // scrollable space below the bubble stays constant (and the bubble stays\n // pinned). Never grow the spacer after initial sizing.\n if (typeof ResizeObserver !== \"undefined\") {\n ro = new ResizeObserver(() => {\n if (!contentEl || !spacerEl || !scrollEl) return;\n const contentHeight = contentEl.getBoundingClientRect().height;\n const targetOffsetWithinContent = computeOffsetTop(\n targetEl,\n contentEl,\n );\n const consumedBelow =\n contentHeight - targetOffsetWithinContent - userMessageHeight;\n const remaining = Math.max(0, spacerHeight - consumedBelow);\n if (remaining < currentSpacerHeight) {\n spacerEl.style.height = `${remaining}px`;\n currentSpacerHeight = remaining;\n }\n });\n ro.observe(contentEl);\n }\n },\n { immediate: true, flush: \"post\" },\n );\n}\n\n// Compute the offset of el relative to stopAt, accounting for stopAt's current scrollTop.\n// Uses getBoundingClientRect so it works regardless of CSS positioning (including position:static).\nfunction computeOffsetTop(el: HTMLElement, stopAt: HTMLElement): number {\n const elRect = el.getBoundingClientRect();\n const stopRect = stopAt.getBoundingClientRect();\n return elRect.top - stopRect.top + stopAt.scrollTop;\n}\n","<script setup lang=\"ts\">\nimport {\n computed,\n getCurrentInstance,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n watch,\n} from \"vue\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport {\n IconArrowUp,\n IconCheck,\n IconChevronRight,\n IconLoader2,\n IconMic,\n IconPlus,\n IconSquare,\n IconX,\n} from \"../icons\";\nimport CopilotChatAudioRecorder from \"./CopilotChatAudioRecorder.vue\";\nimport type { CopilotChatAudioRecorderRef } from \"./audioRecorder\";\nimport type { CopilotChatInputMode, ToolsMenuItem } from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\ntype MenuEntry = ToolsMenuItem | \"-\";\ntype MenuDisplayEntry =\n | { type: \"separator\"; key: string }\n | { type: \"label\"; key: string; label: string; depth: number }\n | {\n type: \"item\";\n key: string;\n label: string;\n depth: number;\n action: () => void;\n };\n\nconst props = withDefaults(\n defineProps<{\n modelValue?: string;\n disabled?: boolean;\n placeholder?: string;\n autoFocus?: boolean;\n clearOnSubmit?: boolean;\n mode?: CopilotChatInputMode;\n toolsMenu?: MenuEntry[];\n isRunning?: boolean;\n positioning?: \"static\" | \"absolute\";\n keyboardHeight?: number;\n showDisclaimer?: boolean;\n maxRows?: number;\n /**\n * Set to `true` when the input sits at the bottom of its container as a\n * flex-last-child (visible position is driven by layout, not CSS\n * positioning). Triggers reservation of bottom space for the fixed\n * CopilotKit license banner via the\n * `--copilotkit-license-banner-offset` CSS var so the two don't overlap.\n *\n * Not needed when `positioning === \"absolute\"`; that mode already pins\n * the input to the bottom and picks up the same reservation\n * automatically. Leave unset (default `false`) for inputs rendered\n * mid-layout such as the welcome screen, where the banner offset would\n * push the input off-center.\n */\n bottomAnchored?: boolean;\n }>(),\n {\n disabled: false,\n autoFocus: true,\n clearOnSubmit: true,\n mode: \"input\",\n toolsMenu: () => [],\n isRunning: false,\n positioning: \"static\",\n keyboardHeight: 0,\n showDisclaimer: undefined,\n maxRows: 5,\n bottomAnchored: false,\n },\n);\n\nconst emit = defineEmits<{\n \"update:modelValue\": [value: string];\n \"submit-message\": [value: string];\n stop: [];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n \"finish-transcribe-with-audio\": [audioBlob: Blob];\n}>();\n\nconst attrs = useAttrs();\nconst config = useCopilotChatConfiguration();\nconst instance = getCurrentInstance();\nconst shellRef = ref<HTMLElement | null>(null);\nconst textareaRef = ref<HTMLTextAreaElement | null>(null);\nconst gridRef = ref<HTMLElement | null>(null);\nconst addButtonContainerRef = ref<HTMLElement | null>(null);\nconst actionsContainerRef = ref<HTMLElement | null>(null);\nconst slashMenuRef = ref<HTMLElement | null>(null);\nconst addMenuRef = ref<HTMLElement | null>(null);\nconst audioRecorderRef = ref<CopilotChatAudioRecorderRef | null>(null);\nconst localValue = ref(props.modelValue ?? \"\");\nconst isComposing = ref(false);\nconst layout = ref<\"compact\" | \"expanded\">(\"compact\");\nconst commandQuery = ref<string | null>(null);\nconst slashHighlightIndex = ref(0);\nconst previousCommandQuery = ref<string | null>(null);\nconst addMenuOpen = ref(false);\nconst measurements = ref({\n singleLineHeight: 0,\n maxHeight: 0,\n paddingLeft: 0,\n paddingRight: 0,\n});\nconst resizeEvaluationRafRef = ref<number | null>(null);\nconst ignoreResizeRef = ref(false);\nconst measurementCanvasRef = ref<HTMLCanvasElement | null>(null);\nconst containerCacheRef = ref<{\n compactWidth: number;\n} | null>(null);\nconst didWarnMissingFontRef = ref(false);\nconst didWarnMissingCanvasContextRef = ref(false);\nlet resizeObserver: ResizeObserver | null = null;\nlet documentPointerDownHandler: ((event: MouseEvent) => void) | null = null;\n\nconst vnodeProps = computed(\n () => (instance?.vnode.props ?? {}) as Record<string, unknown>,\n);\n\nconst isControlled = computed(() => props.modelValue !== undefined);\nconst inputValue = computed(() =>\n isControlled.value ? (props.modelValue ?? \"\") : localValue.value,\n);\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\nconst resolvedPlaceholder = computed(\n () => props.placeholder ?? labels.value.chatInputPlaceholder,\n);\nconst isExpanded = computed(\n () => props.mode === \"input\" && layout.value === \"expanded\",\n);\nconst isProcessing = computed(\n () => props.mode !== \"transcribe\" && props.isRunning,\n);\nconst shouldShowDisclaimer = computed(\n () => props.showDisclaimer ?? props.positioning === \"absolute\",\n);\nconst hasSubmitAction = computed(() => hasListener(\"onSubmitMessage\"));\nconst hasStopAction = computed(() => hasListener(\"onStop\"));\nconst hasAddFileAction = computed(() => hasListener(\"onAddFile\"));\nconst hasStartTranscribeAction = computed(() =>\n hasListener(\"onStartTranscribe\"),\n);\nconst hasCancelTranscribeAction = computed(() =>\n hasListener(\"onCancelTranscribe\"),\n);\nconst hasFinishTranscribeAction = computed(() =>\n hasListener(\"onFinishTranscribe\"),\n);\nconst canSend = computed(\n () =>\n props.mode === \"input\" &&\n !props.disabled &&\n hasSubmitAction.value &&\n inputValue.value.trim().length > 0,\n);\nconst sendDisabled = computed(() =>\n isProcessing.value ? !hasStopAction.value : !canSend.value,\n);\n\nconst containerClass = computed(() => [\n props.positioning === \"absolute\" &&\n \"cpk:absolute cpk:bottom-0 cpk:left-0 cpk:right-0 cpk:z-20 cpk:pointer-events-none\",\n attrs.class,\n]);\n\nconst rootAttrs = computed(() => {\n const rest = { ...attrs };\n delete rest.class;\n return rest;\n});\n\nfunction isMenuGroup(\n item: ToolsMenuItem,\n): item is ToolsMenuItem & { items: MenuEntry[] } {\n return Array.isArray((item as ToolsMenuItem).items);\n}\n\nfunction hasListener(listenerName: string) {\n const listener = vnodeProps.value[listenerName];\n if (Array.isArray(listener)) {\n return listener.length > 0;\n }\n return !!listener;\n}\n\nfunction createDefaultAddItem(): ToolsMenuItem | null {\n if (!hasAddFileAction.value) {\n return null;\n }\n return {\n label: labels.value.chatInputToolbarAddButtonLabel,\n action: () => emit(\"add-file\"),\n };\n}\n\nfunction normalizeMenuItems() {\n const items: MenuEntry[] = [];\n const addItem = createDefaultAddItem();\n if (addItem) {\n items.push(addItem);\n }\n\n if (props.toolsMenu.length > 0) {\n if (items.length > 0) {\n items.push(\"-\");\n }\n\n for (const menuEntry of props.toolsMenu) {\n if (menuEntry === \"-\") {\n if (items.length === 0 || items[items.length - 1] === \"-\") {\n continue;\n }\n items.push(\"-\");\n continue;\n }\n\n items.push(menuEntry);\n }\n }\n\n while (items.length > 0 && items[items.length - 1] === \"-\") {\n items.pop();\n }\n\n return items;\n}\n\nconst menuItems = computed(() => normalizeMenuItems());\nconst hasMenuItems = computed(() => menuItems.value.length > 0);\n\nfunction flattenMenuForCommands(items: MenuEntry[]) {\n const seen = new Set<string>();\n const commands: ToolsMenuItem[] = [];\n\n const walk = (entryList: MenuEntry[]) => {\n for (const entry of entryList) {\n if (entry === \"-\") {\n continue;\n }\n\n if (isMenuGroup(entry) && entry.items.length > 0) {\n walk(entry.items);\n continue;\n }\n\n if (!entry.action || seen.has(entry.label)) {\n continue;\n }\n\n seen.add(entry.label);\n commands.push(entry);\n }\n };\n\n walk(items);\n return commands;\n}\n\nconst commandItems = computed(() => flattenMenuForCommands(menuItems.value));\n\nfunction flattenMenuDisplay(items: MenuEntry[], depth = 0, prefix = \"root\") {\n const entries: MenuDisplayEntry[] = [];\n for (const [index, item] of items.entries()) {\n const key = `${prefix}-${index}`;\n if (item === \"-\") {\n entries.push({ type: \"separator\", key: `sep-${key}` });\n continue;\n }\n if (isMenuGroup(item) && item.items.length > 0) {\n entries.push({\n type: \"label\",\n key: `label-${key}`,\n label: item.label,\n depth,\n });\n entries.push(...flattenMenuDisplay(item.items, depth + 1, key));\n continue;\n }\n if (item.action) {\n entries.push({\n type: \"item\",\n key: `item-${key}`,\n label: item.label,\n depth,\n action: item.action,\n });\n }\n }\n return entries;\n}\n\nconst menuDisplayItems = computed(() => flattenMenuDisplay(menuItems.value));\n\nconst filteredCommands = computed(() => {\n if (commandQuery.value === null || commandItems.value.length === 0) {\n return [] as ToolsMenuItem[];\n }\n\n const normalized = commandQuery.value.trim().toLowerCase();\n if (normalized.length === 0) {\n return commandItems.value;\n }\n\n const startsWith: ToolsMenuItem[] = [];\n const contains: ToolsMenuItem[] = [];\n\n for (const command of commandItems.value) {\n const label = command.label.toLowerCase();\n if (label.startsWith(normalized)) {\n startsWith.push(command);\n continue;\n }\n if (label.includes(normalized)) {\n contains.push(command);\n }\n }\n\n return [...startsWith, ...contains];\n});\n\nconst slashMenuVisible = computed(\n () => commandQuery.value !== null && commandItems.value.length > 0,\n);\n\nfunction updateInputValue(nextValue: string) {\n if (!isControlled.value) {\n localValue.value = nextValue;\n }\n emit(\"update:modelValue\", nextValue);\n}\n\nfunction clearInputValue() {\n updateInputValue(\"\");\n}\n\nfunction updateSlashState(value: string) {\n if (commandItems.value.length === 0) {\n commandQuery.value = null;\n return;\n }\n\n if (value.startsWith(\"/\")) {\n const firstLine = value.split(/\\r?\\n/, 1)[0] ?? \"\";\n commandQuery.value = firstLine.slice(1);\n return;\n }\n\n commandQuery.value = null;\n}\n\nfunction runCommand(command: ToolsMenuItem) {\n clearInputValue();\n command.action?.();\n commandQuery.value = null;\n slashHighlightIndex.value = 0;\n requestAnimationFrame(() => {\n textareaRef.value?.focus();\n });\n}\n\nfunction submit() {\n if (props.mode !== \"input\" || props.disabled || !hasSubmitAction.value) {\n return;\n }\n // In controlled mode, parent-updated modelValue can lag one tick behind\n // the actual textarea value during intense runtime/connect churn.\n const rawValue = textareaRef.value?.value ?? inputValue.value;\n const trimmed = rawValue.trim();\n if (!trimmed) {\n return;\n }\n\n emit(\"submit-message\", trimmed);\n\n if (props.clearOnSubmit) {\n clearInputValue();\n }\n\n textareaRef.value?.focus();\n}\n\nfunction handleInput(event: Event) {\n const nextValue = (event.target as HTMLTextAreaElement).value;\n updateInputValue(nextValue);\n updateSlashState(nextValue);\n}\n\nfunction handleSendButtonClick() {\n if (isProcessing.value) {\n if (hasStopAction.value) {\n emit(\"stop\");\n }\n return;\n }\n submit();\n}\n\nfunction handleKeydown(event: KeyboardEvent) {\n if (props.disabled) {\n return;\n }\n\n if (isComposing.value || event.isComposing || event.keyCode === 229) {\n return;\n }\n\n if (commandQuery.value !== null && props.mode === \"input\") {\n if (event.key === \"ArrowDown\") {\n if (filteredCommands.value.length > 0) {\n event.preventDefault();\n slashHighlightIndex.value =\n slashHighlightIndex.value < 0\n ? 0\n : (slashHighlightIndex.value + 1) % filteredCommands.value.length;\n }\n return;\n }\n\n if (event.key === \"ArrowUp\") {\n if (filteredCommands.value.length > 0) {\n event.preventDefault();\n if (slashHighlightIndex.value < 0) {\n slashHighlightIndex.value = filteredCommands.value.length - 1;\n } else {\n slashHighlightIndex.value =\n slashHighlightIndex.value <= 0\n ? filteredCommands.value.length - 1\n : slashHighlightIndex.value - 1;\n }\n }\n return;\n }\n\n if (event.key === \"Enter\") {\n const selected =\n slashHighlightIndex.value >= 0\n ? filteredCommands.value[slashHighlightIndex.value]\n : undefined;\n if (selected) {\n event.preventDefault();\n runCommand(selected);\n return;\n }\n }\n\n if (event.key === \"Escape\") {\n event.preventDefault();\n commandQuery.value = null;\n return;\n }\n }\n\n if (event.key === \"Enter\" && !event.shiftKey && props.mode === \"input\") {\n event.preventDefault();\n if (isProcessing.value) {\n if (hasStopAction.value) {\n emit(\"stop\");\n }\n return;\n }\n submit();\n }\n}\n\nfunction toggleAddMenu() {\n if (!hasMenuItems.value || props.mode === \"transcribe\" || props.disabled) {\n return;\n }\n addMenuOpen.value = !addMenuOpen.value;\n}\n\nfunction closeAddMenu() {\n addMenuOpen.value = false;\n}\n\nfunction handleMenuAction(action: () => void) {\n action();\n closeAddMenu();\n nextTick(() => {\n textareaRef.value?.focus();\n });\n}\n\nasync function handleFinishTranscribe() {\n const recorder = audioRecorderRef.value;\n if (recorder && recorder.state === \"recording\") {\n try {\n const blob = await recorder.stop();\n emit(\"finish-transcribe-with-audio\", blob);\n } catch (error) {\n console.error(\"Failed to stop recording:\", error);\n }\n }\n emit(\"finish-transcribe\");\n}\n\nfunction handleContainerClick(event: MouseEvent) {\n const target = event.target as HTMLElement | null;\n if (!target || props.mode !== \"input\") {\n return;\n }\n if (target.tagName === \"BUTTON\" || target.closest(\"button\")) {\n return;\n }\n textareaRef.value?.focus();\n}\n\nfunction ensureMeasurements() {\n const textarea = textareaRef.value;\n if (!textarea || isComposing.value) {\n return;\n }\n\n const previousValue = textarea.value;\n const previousHeight = textarea.style.height;\n textarea.style.height = \"auto\";\n\n const computedStyle = window.getComputedStyle(textarea);\n const paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;\n const paddingRight = parseFloat(computedStyle.paddingRight) || 0;\n const paddingTop = parseFloat(computedStyle.paddingTop) || 0;\n const paddingBottom = parseFloat(computedStyle.paddingBottom) || 0;\n\n textarea.value = \"\";\n const singleLineHeight = textarea.scrollHeight;\n textarea.value = previousValue;\n\n const contentHeight = singleLineHeight - paddingTop - paddingBottom;\n const maxHeight = contentHeight * props.maxRows + paddingTop + paddingBottom;\n\n measurements.value = {\n singleLineHeight,\n maxHeight,\n paddingLeft,\n paddingRight,\n };\n\n textarea.style.height = previousHeight;\n textarea.style.maxHeight = `${maxHeight}px`;\n}\n\nfunction adjustTextareaHeight() {\n const textarea = textareaRef.value;\n if (!textarea) {\n return 0;\n }\n\n if (measurements.value.singleLineHeight === 0) {\n ensureMeasurements();\n }\n\n const { maxHeight } = measurements.value;\n if (maxHeight) {\n textarea.style.maxHeight = `${maxHeight}px`;\n }\n\n textarea.style.height = \"auto\";\n const scrollHeight = textarea.scrollHeight;\n textarea.style.height = `${maxHeight ? Math.min(scrollHeight, maxHeight) : scrollHeight}px`;\n return scrollHeight;\n}\n\nfunction updateLayout(nextLayout: \"compact\" | \"expanded\") {\n if (layout.value === nextLayout) {\n return;\n }\n ignoreResizeRef.value = true;\n layout.value = nextLayout;\n}\n\nfunction resolveTextareaFont(textarea: HTMLTextAreaElement): string | null {\n const textareaStyles = window.getComputedStyle(textarea);\n if (textareaStyles.font?.trim()) {\n return textareaStyles.font;\n }\n\n if (textareaStyles.fontSize && textareaStyles.fontFamily) {\n const fallbackFont =\n `${textareaStyles.fontStyle} ${textareaStyles.fontVariant} ` +\n `${textareaStyles.fontWeight} ${textareaStyles.fontSize}/${textareaStyles.lineHeight} ` +\n `${textareaStyles.fontFamily}`;\n if (fallbackFont.trim()) {\n return fallbackFont;\n }\n }\n\n if (process.env.NODE_ENV !== \"production\" && !didWarnMissingFontRef.value) {\n didWarnMissingFontRef.value = true;\n console.warn(\n \"[CopilotChatInput] Could not resolve textarea font for layout measurement. \" +\n \"Text-width-based expansion will be skipped until the next container resize.\",\n );\n }\n return null;\n}\n\nfunction updateContainerCache() {\n const grid = gridRef.value;\n const addContainer = addButtonContainerRef.value;\n const actionsContainer = actionsContainerRef.value;\n if (!grid || !addContainer || !actionsContainer) {\n containerCacheRef.value = null;\n return null;\n }\n\n const gridStyles = window.getComputedStyle(grid);\n const paddingLeft = parseFloat(gridStyles.paddingLeft) || 0;\n const paddingRight = parseFloat(gridStyles.paddingRight) || 0;\n const columnGap = parseFloat(gridStyles.columnGap) || 0;\n const gridAvailableWidth = grid.clientWidth - paddingLeft - paddingRight;\n if (gridAvailableWidth <= 0) {\n containerCacheRef.value = null;\n return null;\n }\n\n const addWidth = addContainer.getBoundingClientRect().width;\n const actionsWidth = actionsContainer.getBoundingClientRect().width;\n const compactWidth = Math.max(\n gridAvailableWidth - addWidth - actionsWidth - columnGap * 2,\n 0,\n );\n if (compactWidth <= 0) {\n containerCacheRef.value = null;\n return null;\n }\n\n const cache = { compactWidth };\n containerCacheRef.value = cache;\n return cache;\n}\n\nfunction evaluateLayout() {\n if (props.mode !== \"input\") {\n updateLayout(\"compact\");\n return;\n }\n\n if (\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(max-width: 767px)\").matches\n ) {\n ensureMeasurements();\n adjustTextareaHeight();\n updateLayout(\"expanded\");\n return;\n }\n\n const textarea = textareaRef.value;\n if (\n !textarea ||\n !gridRef.value ||\n !addButtonContainerRef.value ||\n !actionsContainerRef.value\n ) {\n return;\n }\n\n if (measurements.value.singleLineHeight === 0) {\n ensureMeasurements();\n }\n\n const scrollHeight = adjustTextareaHeight();\n const baseline = measurements.value.singleLineHeight;\n const hasExplicitBreak = inputValue.value.includes(\"\\n\");\n const renderedMultiline = baseline > 0 ? scrollHeight > baseline + 1 : false;\n let shouldExpand = hasExplicitBreak || renderedMultiline;\n\n if (!shouldExpand) {\n const cache = containerCacheRef.value ?? updateContainerCache();\n if (cache && cache.compactWidth > 0) {\n const compactInnerWidth = Math.max(\n cache.compactWidth -\n measurements.value.paddingLeft -\n measurements.value.paddingRight,\n 0,\n );\n\n if (compactInnerWidth > 0) {\n const canvas =\n measurementCanvasRef.value ?? document.createElement(\"canvas\");\n if (!measurementCanvasRef.value) {\n measurementCanvasRef.value = canvas;\n }\n\n const context = canvas.getContext(\"2d\");\n if (context) {\n const resolvedFont = resolveTextareaFont(textarea);\n if (resolvedFont) {\n context.font = resolvedFont;\n const lines =\n inputValue.value.length > 0 ? inputValue.value.split(\"\\n\") : [\"\"];\n let longestLine = 0;\n for (const line of lines) {\n const width = context.measureText(line || \" \").width;\n if (width > longestLine) {\n longestLine = width;\n }\n }\n if (longestLine > compactInnerWidth) {\n shouldExpand = true;\n }\n }\n } else if (\n process.env.NODE_ENV !== \"production\" &&\n !didWarnMissingCanvasContextRef.value\n ) {\n didWarnMissingCanvasContextRef.value = true;\n console.warn(\n \"[CopilotChatInput] canvas.getContext('2d') returned null. \" +\n \"Text-width-based expansion will be skipped.\",\n );\n }\n }\n }\n }\n\n updateLayout(shouldExpand ? \"expanded\" : \"compact\");\n}\n\nfunction scheduleLayoutEvaluation(invalidateCache: boolean) {\n if (ignoreResizeRef.value) {\n ignoreResizeRef.value = false;\n return;\n }\n\n if (invalidateCache) {\n containerCacheRef.value = null;\n didWarnMissingFontRef.value = false;\n didWarnMissingCanvasContextRef.value = false;\n }\n\n if (resizeEvaluationRafRef.value !== null) {\n cancelAnimationFrame(resizeEvaluationRafRef.value);\n }\n\n resizeEvaluationRafRef.value = requestAnimationFrame(() => {\n resizeEvaluationRafRef.value = null;\n evaluateLayout();\n });\n}\n\nwatch(\n () => props.modelValue,\n (next) => {\n if (isControlled.value) {\n localValue.value = next ?? \"\";\n }\n },\n);\n\nwatch(inputValue, (value) => {\n updateSlashState(value);\n evaluateLayout();\n});\n\nwatch(commandItems, () => {\n if (commandItems.value.length === 0) {\n commandQuery.value = null;\n }\n});\n\nwatch(\n [commandQuery, () => filteredCommands.value.length],\n ([query, filteredCount]) => {\n if (\n query !== null &&\n query !== previousCommandQuery.value &&\n filteredCount > 0\n ) {\n slashHighlightIndex.value = 0;\n }\n\n previousCommandQuery.value = query;\n },\n { immediate: true },\n);\n\nwatch(\n [commandQuery, filteredCommands],\n () => {\n if (commandQuery.value === null) {\n slashHighlightIndex.value = 0;\n return;\n }\n if (filteredCommands.value.length === 0) {\n slashHighlightIndex.value = -1;\n return;\n }\n if (\n slashHighlightIndex.value < 0 ||\n slashHighlightIndex.value >= filteredCommands.value.length\n ) {\n slashHighlightIndex.value = 0;\n }\n },\n { immediate: true },\n);\n\nwatch(\n () => props.mode,\n async (mode) => {\n if (mode !== \"input\") {\n layout.value = \"compact\";\n commandQuery.value = null;\n closeAddMenu();\n }\n\n const recorder = audioRecorderRef.value;\n if (!recorder) {\n return;\n }\n\n if (mode === \"transcribe\") {\n try {\n await recorder.start();\n } catch (error) {\n console.error(error);\n }\n return;\n }\n\n if (recorder.state === \"recording\") {\n try {\n await recorder.stop();\n } catch {\n // ignore transition stop failures\n }\n }\n },\n { immediate: true },\n);\n\nwatch(\n audioRecorderRef,\n async (recorder) => {\n if (!recorder || props.mode !== \"transcribe\") {\n return;\n }\n if (recorder.state === \"idle\") {\n try {\n await recorder.start();\n } catch (error) {\n console.error(error);\n }\n }\n },\n { immediate: true },\n);\n\nwatch(slashHighlightIndex, async (index) => {\n if (!slashMenuVisible.value || index < 0) {\n return;\n }\n await nextTick();\n const active = slashMenuRef.value?.querySelector<HTMLElement>(\n `[data-slash-index=\"${index}\"]`,\n );\n active?.scrollIntoView?.({ block: \"nearest\" });\n});\n\nwatch(\n () => props.disabled,\n (disabled) => {\n if (disabled) {\n closeAddMenu();\n }\n },\n);\n\nonMounted(() => {\n if (props.autoFocus && props.mode === \"input\") {\n textareaRef.value?.focus();\n }\n\n evaluateLayout();\n\n if (typeof ResizeObserver !== \"undefined\") {\n const containerTargets = new Set<HTMLElement>();\n if (gridRef.value) containerTargets.add(gridRef.value);\n if (addButtonContainerRef.value)\n containerTargets.add(addButtonContainerRef.value);\n if (actionsContainerRef.value)\n containerTargets.add(actionsContainerRef.value);\n\n resizeObserver = new ResizeObserver((entries) => {\n const shouldInvalidate = entries.some((entry) =>\n containerTargets.has(entry.target as HTMLElement),\n );\n scheduleLayoutEvaluation(shouldInvalidate);\n });\n\n if (gridRef.value) resizeObserver.observe(gridRef.value);\n if (addButtonContainerRef.value)\n resizeObserver.observe(addButtonContainerRef.value);\n if (actionsContainerRef.value)\n resizeObserver.observe(actionsContainerRef.value);\n if (textareaRef.value) resizeObserver.observe(textareaRef.value);\n }\n\n documentPointerDownHandler = (event: MouseEvent) => {\n if (!addMenuOpen.value) {\n return;\n }\n const target = event.target as Node | null;\n if (!target) {\n return;\n }\n if (\n addMenuRef.value?.contains(target) ||\n addButtonContainerRef.value?.contains(target)\n ) {\n return;\n }\n closeAddMenu();\n };\n\n document.addEventListener(\"mousedown\", documentPointerDownHandler);\n});\n\nonBeforeUnmount(() => {\n if (documentPointerDownHandler) {\n document.removeEventListener(\"mousedown\", documentPointerDownHandler);\n documentPointerDownHandler = null;\n }\n resizeObserver?.disconnect();\n resizeObserver = null;\n if (resizeEvaluationRafRef.value !== null) {\n cancelAnimationFrame(resizeEvaluationRafRef.value);\n resizeEvaluationRafRef.value = null;\n }\n});\n</script>\n\n<template>\n <div\n data-copilotkit\n data-testid=\"copilot-chat-input-container\"\n :class=\"containerClass\"\n :style=\"{\n transform:\n keyboardHeight > 0 ? `translateY(-${keyboardHeight}px)` : undefined,\n transition: 'transform 0.2s ease-out',\n ...(positioning === 'absolute' || bottomAnchored\n ? { paddingBottom: 'var(--copilotkit-license-banner-offset, 0px)' }\n : {}),\n }\"\n v-bind=\"rootAttrs\"\n >\n <div\n class=\"cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4 cpk:py-0 cpk:sm:px-0 cpk:[div[data-sidebar-chat]_&]:px-8 cpk:[div[data-popup-chat]_&]:px-4\"\n >\n <slot\n name=\"layout\"\n :mode=\"mode\"\n :is-multiline=\"isExpanded\"\n :value=\"inputValue\"\n :disabled=\"disabled\"\n :placeholder=\"resolvedPlaceholder\"\n :is-processing=\"isProcessing\"\n :send-disabled=\"sendDisabled\"\n :menu-open=\"addMenuOpen\"\n :menu-items=\"menuDisplayItems\"\n :on-toggle-menu=\"toggleAddMenu\"\n :on-menu-action=\"handleMenuAction\"\n :on-update-value=\"updateInputValue\"\n :on-submit=\"submit\"\n :on-keydown=\"handleKeydown\"\n :on-send-click=\"handleSendButtonClick\"\n :on-start-transcribe=\"() => emit('start-transcribe')\"\n :on-cancel-transcribe=\"() => emit('cancel-transcribe')\"\n :on-finish-transcribe=\"handleFinishTranscribe\"\n >\n <div\n ref=\"shellRef\"\n data-testid=\"copilot-chat-input-shell\"\n class=\"cpk:flex cpk:w-full cpk:cursor-text cpk:flex-col cpk:items-center cpk:justify-center cpk:overflow-visible cpk:rounded-[28px] cpk:bg-white cpk:bg-clip-padding cpk:shadow-[0_4px_4px_0_#0000000a,0_0_1px_0_#0000009e] cpk:contain-inline-size cpk:dark:bg-[#303030]\"\n :data-layout=\"isExpanded ? 'expanded' : 'compact'\"\n @click=\"handleContainerClick\"\n >\n <div\n ref=\"gridRef\"\n :class=\"[\n 'cpk:grid cpk:w-full cpk:gap-x-3 cpk:gap-y-3 cpk:px-3 cpk:py-2',\n isExpanded\n ? 'cpk:grid-cols-[auto_minmax(0,1fr)_auto] cpk:grid-rows-[auto_auto]'\n : 'cpk:grid-cols-[auto_minmax(0,1fr)_auto] cpk:items-center',\n ]\"\n :data-layout=\"isExpanded ? 'expanded' : 'compact'\"\n >\n <div\n ref=\"addButtonContainerRef\"\n :class=\"[\n 'cpk:relative cpk:flex cpk:items-center cpk:col-start-1',\n isExpanded ? 'cpk:row-start-2' : 'cpk:row-start-1',\n ]\"\n >\n <slot\n name=\"add-menu-button\"\n :disabled=\"disabled || mode === 'transcribe' || !hasMenuItems\"\n :menu-open=\"addMenuOpen\"\n :toggle-menu=\"toggleAddMenu\"\n :labels=\"labels\"\n >\n <button\n type=\"button\"\n data-testid=\"copilot-chat-input-add\"\n :aria-label=\"labels.chatInputToolbarAddButtonLabel\"\n :disabled=\"disabled || mode === 'transcribe' || !hasMenuItems\"\n class=\"cpk:ml-1 cpk:inline-flex cpk:h-9 cpk:w-9 cpk:shrink-0 cpk:items-center cpk:justify-center cpk:rounded-full cpk:bg-transparent cpk:text-[#444444] cpk:transition-colors cpk:hover:bg-[#f8f8f8] cpk:hover:text-[#333333] cpk:disabled:cursor-not-allowed cpk:disabled:opacity-50 cpk:disabled:hover:bg-transparent cpk:disabled:hover:text-[#444444] cpk:dark:text-white cpk:dark:hover:bg-[#404040] cpk:dark:hover:text-[#FFFFFF] cpk:dark:disabled:hover:bg-transparent cpk:dark:disabled:hover:text-[#CCCCCC]\"\n @click.stop=\"toggleAddMenu\"\n >\n <IconPlus class=\"cpk:size-[20px]\" />\n </button>\n </slot>\n\n <div\n v-if=\"addMenuOpen && hasMenuItems\"\n ref=\"addMenuRef\"\n class=\"cpk:absolute cpk:bottom-full cpk:left-0 cpk:z-30 cpk:mb-2 cpk:min-w-[220px] cpk:overflow-hidden cpk:rounded-lg cpk:border cpk:border-border cpk:bg-white cpk:shadow-lg cpk:dark:border-[#3a3a3a] cpk:dark:bg-[#1f1f1f]\"\n data-testid=\"copilot-chat-input-add-menu\"\n >\n <template v-for=\"entry in menuDisplayItems\" :key=\"entry.key\">\n <div\n v-if=\"entry.type === 'separator'\"\n class=\"cpk:my-1 cpk:h-px cpk:bg-border cpk:dark:bg-[#333333]\"\n />\n <div\n v-else-if=\"entry.type === 'label'\"\n class=\"cpk:flex cpk:items-center cpk:gap-1 cpk:px-3 cpk:py-1.5 cpk:text-xs cpk:font-semibold cpk:text-muted-foreground\"\n :style=\"{ paddingLeft: `${12 + entry.depth * 12}px` }\"\n >\n <span>{{ entry.label }}</span>\n <IconChevronRight class=\"cpk:size-3\" />\n </div>\n <button\n v-else\n type=\"button\"\n role=\"menuitem\"\n class=\"cpk:w-full cpk:px-3 cpk:py-2 cpk:text-left cpk:text-sm cpk:transition-colors cpk:hover:bg-muted cpk:dark:hover:bg-[#2f2f2f]\"\n :style=\"{ paddingLeft: `${12 + entry.depth * 12}px` }\"\n @click=\"handleMenuAction(entry.action)\"\n >\n {{ entry.label }}\n </button>\n </template>\n </div>\n </div>\n\n <div\n :class=\"[\n 'cpk:relative cpk:flex cpk:min-h-[50px] cpk:min-w-0 cpk:flex-col cpk:justify-center',\n isExpanded\n ? 'cpk:col-span-3 cpk:row-start-1'\n : 'cpk:col-start-2 cpk:row-start-1',\n ]\"\n >\n <template v-if=\"mode === 'transcribe'\">\n <slot name=\"audio-recorder\">\n <CopilotChatAudioRecorder ref=\"audioRecorderRef\" />\n </slot>\n </template>\n <template v-else-if=\"mode === 'processing'\">\n <div\n class=\"cpk:flex cpk:w-full cpk:items-center cpk:justify-center cpk:px-5 cpk:py-3\"\n >\n <IconLoader2\n class=\"cpk:size-[26px] cpk:animate-spin cpk:text-muted-foreground\"\n />\n </div>\n </template>\n <template v-else>\n <slot\n name=\"text-area\"\n :value=\"inputValue\"\n :disabled=\"disabled\"\n :placeholder=\"resolvedPlaceholder\"\n :on-input=\"handleInput\"\n :on-keydown=\"handleKeydown\"\n :auto-focus=\"autoFocus\"\n :is-expanded=\"isExpanded\"\n :rows=\"1\"\n :labels=\"labels\"\n >\n <textarea\n ref=\"textareaRef\"\n data-testid=\"copilot-chat-input-textarea\"\n :value=\"inputValue\"\n :placeholder=\"resolvedPlaceholder\"\n :disabled=\"disabled\"\n rows=\"1\"\n :class=\"[\n 'cpk:w-full cpk:bg-transparent cpk:py-3 cpk:text-[16px] cpk:font-normal cpk:leading-relaxed cpk:text-foreground cpk:antialiased cpk:outline-none cpk:placeholder:text-[#00000077] cpk:dark:placeholder:text-[#fffc]',\n isExpanded ? 'cpk:px-5' : 'cpk:pr-5',\n ]\"\n style=\"overflow: auto; resize: none\"\n @input=\"handleInput\"\n @keydown=\"handleKeydown\"\n @compositionstart=\"isComposing = true\"\n @compositionend=\"isComposing = false\"\n />\n </slot>\n\n <div\n v-if=\"slashMenuVisible\"\n ref=\"slashMenuRef\"\n data-testid=\"copilot-slash-menu\"\n role=\"listbox\"\n aria-label=\"Slash commands\"\n class=\"cpk:absolute cpk:bottom-full cpk:left-0 cpk:right-0 cpk:z-30 cpk:mb-2 cpk:max-h-64 cpk:overflow-y-auto cpk:rounded-lg cpk:border cpk:border-border cpk:bg-white cpk:shadow-lg cpk:dark:border-[#3a3a3a] cpk:dark:bg-[#1f1f1f]\"\n :style=\"{ maxHeight: `${5 * 40}px` }\"\n >\n <div\n v-if=\"filteredCommands.length === 0\"\n class=\"cpk:px-3 cpk:py-2 cpk:text-sm cpk:text-muted-foreground\"\n >\n No commands found\n </div>\n <button\n v-for=\"(command, index) in filteredCommands\"\n v-else\n :key=\"`${command.label}-${index}`\"\n type=\"button\"\n role=\"option\"\n :data-slash-index=\"index\"\n :aria-selected=\"index === slashHighlightIndex\"\n :data-active=\"\n index === slashHighlightIndex ? 'true' : undefined\n \"\n :class=\"[\n 'cpk:w-full cpk:px-3 cpk:py-2 cpk:text-left cpk:text-sm cpk:transition-colors cpk:hover:bg-muted cpk:dark:hover:bg-[#2f2f2f]',\n index === slashHighlightIndex\n ? 'cpk:bg-muted cpk:dark:bg-[#2f2f2f]'\n : 'cpk:bg-transparent',\n ]\"\n @mouseenter=\"slashHighlightIndex = index\"\n @mousedown.prevent=\"runCommand(command)\"\n >\n {{ command.label }}\n </button>\n </div>\n </template>\n </div>\n\n <div\n ref=\"actionsContainerRef\"\n :class=\"[\n 'cpk:flex cpk:items-center cpk:justify-end cpk:gap-2',\n isExpanded\n ? 'cpk:col-start-3 cpk:row-start-2'\n : 'cpk:col-start-3 cpk:row-start-1',\n ]\"\n >\n <template v-if=\"mode === 'transcribe'\">\n <slot\n v-if=\"hasCancelTranscribeAction\"\n name=\"cancel-transcribe-button\"\n :disabled=\"disabled\"\n :on-click=\"() => emit('cancel-transcribe')\"\n :labels=\"labels\"\n >\n <button\n type=\"button\"\n data-testid=\"copilot-chat-input-cancel-transcribe\"\n :aria-label=\"\n labels.chatInputToolbarCancelTranscribeButtonLabel\n \"\n :disabled=\"disabled\"\n class=\"cpk:mr-2 cpk:inline-flex cpk:h-9 cpk:w-9 cpk:shrink-0 cpk:items-center cpk:justify-center cpk:rounded-full cpk:bg-transparent cpk:text-[#444444] cpk:transition-colors cpk:hover:bg-[#f8f8f8] cpk:hover:text-[#333333] cpk:disabled:cursor-not-allowed cpk:disabled:opacity-50 cpk:dark:text-white cpk:dark:hover:bg-[#404040] cpk:dark:hover:text-[#FFFFFF]\"\n @click=\"emit('cancel-transcribe')\"\n >\n <IconX class=\"cpk:size-[18px]\" />\n </button>\n </slot>\n <slot\n v-if=\"hasFinishTranscribeAction\"\n name=\"finish-transcribe-button\"\n :disabled=\"disabled\"\n :on-click=\"handleFinishTranscribe\"\n :labels=\"labels\"\n >\n <button\n type=\"button\"\n data-testid=\"copilot-chat-input-finish-transcribe\"\n :aria-label=\"\n labels.chatInputToolbarFinishTranscribeButtonLabel\n \"\n :disabled=\"disabled\"\n class=\"cpk:mr-[10px] cpk:inline-flex cpk:h-9 cpk:w-9 cpk:shrink-0 cpk:items-center cpk:justify-center cpk:rounded-full cpk:bg-transparent cpk:text-[#444444] cpk:transition-colors cpk:hover:bg-[#f8f8f8] cpk:hover:text-[#333333] cpk:disabled:cursor-not-allowed cpk:disabled:opacity-50 cpk:dark:text-white cpk:dark:hover:bg-[#404040] cpk:dark:hover:text-[#FFFFFF]\"\n @click=\"handleFinishTranscribe\"\n >\n <IconCheck class=\"cpk:size-[18px]\" />\n </button>\n </slot>\n </template>\n <template v-else>\n <slot\n v-if=\"hasStartTranscribeAction\"\n name=\"start-transcribe-button\"\n :disabled=\"disabled\"\n :on-click=\"() => emit('start-transcribe')\"\n :labels=\"labels\"\n >\n <button\n type=\"button\"\n data-testid=\"copilot-chat-input-start-transcribe\"\n :aria-label=\"\n labels.chatInputToolbarStartTranscribeButtonLabel\n \"\n :disabled=\"disabled\"\n class=\"cpk:mr-2 cpk:inline-flex cpk:h-9 cpk:w-9 cpk:shrink-0 cpk:items-center cpk:justify-center cpk:rounded-full cpk:bg-transparent cpk:text-[#444444] cpk:transition-colors cpk:hover:bg-[#f8f8f8] cpk:hover:text-[#333333] cpk:disabled:cursor-not-allowed cpk:disabled:opacity-50 cpk:disabled:hover:bg-transparent cpk:disabled:hover:text-[#444444] cpk:dark:text-white cpk:dark:hover:bg-[#404040] cpk:dark:hover:text-[#FFFFFF] cpk:dark:disabled:hover:bg-transparent cpk:dark:disabled:hover:text-[#CCCCCC]\"\n @click=\"emit('start-transcribe')\"\n >\n <IconMic class=\"cpk:size-[18px]\" />\n </button>\n </slot>\n <slot\n name=\"send-button\"\n :disabled=\"sendDisabled\"\n :is-processing=\"isProcessing\"\n :on-click=\"handleSendButtonClick\"\n >\n <div class=\"cpk:mr-[10px]\">\n <button\n type=\"button\"\n data-testid=\"copilot-chat-input-send\"\n aria-label=\"Send message\"\n :disabled=\"sendDisabled\"\n class=\"cpk:inline-flex cpk:h-9 cpk:w-9 cpk:shrink-0 cpk:items-center cpk:justify-center cpk:rounded-full cpk:bg-black cpk:text-white cpk:transition-colors cpk:hover:opacity-70 cpk:disabled:cursor-not-allowed cpk:disabled:opacity-50 cpk:disabled:bg-[#00000014] cpk:disabled:text-[rgb(13,13,13)] cpk:disabled:hover:opacity-100 cpk:dark:bg-white cpk:dark:text-black cpk:dark:disabled:bg-[#454545] cpk:dark:disabled:text-white\"\n @click=\"handleSendButtonClick\"\n >\n <IconSquare\n v-if=\"isProcessing && hasStopAction\"\n class=\"cpk:size-[18px] cpk:fill-current\"\n />\n <IconArrowUp v-else class=\"cpk:size-[18px]\" />\n </button>\n </div>\n </slot>\n </template>\n </div>\n </div>\n </div>\n </slot>\n </div>\n\n <slot v-if=\"shouldShowDisclaimer\" name=\"disclaimer\" :labels=\"labels\">\n <p\n data-testid=\"copilot-chat-input-disclaimer\"\n class=\"cpk:mx-auto cpk:max-w-3xl cpk:px-4 cpk:py-3 cpk:text-center cpk:text-xs cpk:text-muted-foreground\"\n >\n {{ labels.chatDisclaimerText }}\n </p>\n </slot>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from \"vue\";\nimport {\n formatFileSize,\n getDocumentIcon,\n getSourceUrl,\n} from \"@copilotkit/shared\";\nimport type { Attachment } from \"@copilotkit/shared\";\nimport type { CopilotChatAttachmentQueueProps } from \"./types\";\n\nconst props = withDefaults(defineProps<CopilotChatAttachmentQueueProps>(), {\n attachments: () => [],\n className: \"\",\n});\n\nconst emit = defineEmits<{\n \"remove-attachment\": [id: string];\n}>();\n\nconst activeLightboxAttachment = ref<Attachment | null>(null);\nconst documentBlobUrl = ref<string | null>(null);\n\nconst isLightboxOpen = computed(() => activeLightboxAttachment.value !== null);\nconst isPreviewableDocument = computed(() => {\n const attachment = activeLightboxAttachment.value;\n if (!attachment || attachment.type !== \"document\") return false;\n const mimeType = attachment.source.mimeType;\n return isPdf(mimeType) || isText(mimeType);\n});\nconst decodedTextPreview = computed(() => {\n const attachment = activeLightboxAttachment.value;\n if (!attachment || attachment.type !== \"document\") return null;\n const mimeType = attachment.source.mimeType;\n if (!isText(mimeType) || attachment.source.type !== \"data\") return null;\n try {\n return atob(attachment.source.value);\n } catch {\n return attachment.source.value;\n }\n});\nconst lightboxDocumentSource = computed(() => {\n const attachment = activeLightboxAttachment.value;\n if (!attachment || attachment.type !== \"document\") return null;\n if (attachment.source.type === \"url\") return attachment.source.value;\n return documentBlobUrl.value;\n});\n\nwatch(\n activeLightboxAttachment,\n (next, previous) => {\n if (documentBlobUrl.value) {\n URL.revokeObjectURL(documentBlobUrl.value);\n documentBlobUrl.value = null;\n }\n\n if (\n !next ||\n next.type !== \"document\" ||\n next.source.type !== \"data\" ||\n typeof window === \"undefined\"\n ) {\n return;\n }\n\n const mimeType = next.source.mimeType;\n if (!isPdf(mimeType) && !isText(mimeType)) {\n return;\n }\n\n const blobUrl = createBlobUrl(next.source.value, mimeType);\n documentBlobUrl.value = blobUrl;\n },\n { immediate: true },\n);\n\nwatch(isLightboxOpen, (open, _previous, onCleanup) => {\n if (!open || typeof document === \"undefined\") return;\n\n const handleKeydown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n closeLightbox();\n }\n };\n document.addEventListener(\"keydown\", handleKeydown);\n onCleanup(() => {\n document.removeEventListener(\"keydown\", handleKeydown);\n });\n});\n\nonBeforeUnmount(() => {\n if (documentBlobUrl.value) {\n URL.revokeObjectURL(documentBlobUrl.value);\n documentBlobUrl.value = null;\n }\n});\n\nfunction openLightbox(attachment: Attachment) {\n if (typeof document !== \"undefined\") {\n const withTransition = document as Document & {\n startViewTransition?: (cb: () => void) => unknown;\n };\n if (typeof withTransition.startViewTransition === \"function\") {\n withTransition.startViewTransition(() => {\n activeLightboxAttachment.value = attachment;\n });\n return;\n }\n }\n activeLightboxAttachment.value = attachment;\n}\n\nfunction closeLightbox() {\n activeLightboxAttachment.value = null;\n}\n\nfunction cardClassName(attachment: Attachment) {\n if (attachment.type === \"image\" || attachment.type === \"video\") {\n return \"cpk:w-[72px] cpk:h-[72px]\";\n }\n if (attachment.type === \"audio\") {\n return \"cpk:min-w-[200px] cpk:max-w-[280px] cpk:flex-col cpk:p-1 cpk:pr-8\";\n }\n return \"cpk:p-2 cpk:px-3 cpk:pr-8 cpk:max-w-[240px]\";\n}\n\nfunction isPdf(mimeType: string | undefined): boolean {\n return !!mimeType && mimeType.includes(\"pdf\");\n}\n\nfunction isText(mimeType: string | undefined): boolean {\n return !!mimeType && mimeType.startsWith(\"text/\");\n}\n\nfunction createBlobUrl(\n base64Value: string,\n mimeType: string | undefined,\n): string | null {\n try {\n const binary = atob(base64Value);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i += 1) {\n bytes[i] = binary.charCodeAt(i);\n }\n const blob = new Blob([bytes], {\n type: mimeType || \"application/octet-stream\",\n });\n return URL.createObjectURL(blob);\n } catch (error) {\n console.error(\"[CopilotKit] Failed to decode attachment data:\", error);\n return null;\n }\n}\n</script>\n\n<template>\n <div\n v-if=\"props.attachments.length > 0\"\n class=\"cpk:flex cpk:flex-wrap cpk:gap-2 cpk:p-2\"\n :class=\"props.className\"\n data-testid=\"copilot-chat-attachment-queue\"\n >\n <div\n v-for=\"attachment in props.attachments\"\n :key=\"attachment.id\"\n class=\"cpk:relative cpk:inline-flex cpk:rounded-lg cpk:overflow-hidden cpk:border cpk:border-border\"\n :class=\"cardClassName(attachment)\"\n data-testid=\"copilot-chat-attachment-item\"\n :data-card-type=\"attachment.type\"\n >\n <div\n v-if=\"attachment.status === 'uploading'\"\n class=\"cpk:absolute cpk:inset-0 cpk:flex cpk:items-center cpk:justify-center cpk:bg-black/40 cpk:z-10\"\n data-testid=\"copilot-chat-attachment-uploading-overlay\"\n >\n <div\n class=\"cpk:w-5 cpk:h-5 cpk:border-2 cpk:border-white cpk:border-t-transparent cpk:rounded-full cpk:animate-spin\"\n />\n </div>\n\n <template v-if=\"attachment.status === 'ready'\">\n <button\n v-if=\"attachment.type === 'image'\"\n type=\"button\"\n class=\"cpk:w-full cpk:h-full cpk:border-none cpk:bg-transparent cpk:p-0 cpk:cursor-pointer\"\n data-testid=\"copilot-chat-attachment-image-button\"\n @click=\"openLightbox(attachment)\"\n >\n <img\n :src=\"getSourceUrl(attachment.source)\"\n :alt=\"attachment.filename || 'Image attachment'\"\n class=\"cpk:w-full cpk:h-full cpk:object-cover\"\n data-testid=\"copilot-chat-attachment-image-thumbnail\"\n />\n </button>\n\n <div\n v-else-if=\"attachment.type === 'video'\"\n class=\"cpk:w-full cpk:h-full cpk:relative\"\n >\n <img\n v-if=\"attachment.thumbnail\"\n :src=\"attachment.thumbnail\"\n :alt=\"attachment.filename || 'Video thumbnail'\"\n class=\"cpk:w-full cpk:h-full cpk:object-cover\"\n data-testid=\"copilot-chat-attachment-video-thumbnail\"\n />\n <video\n v-else\n :src=\"getSourceUrl(attachment.source)\"\n preload=\"metadata\"\n muted\n class=\"cpk:w-full cpk:h-full cpk:object-cover\"\n data-testid=\"copilot-chat-attachment-video-fallback\"\n />\n <button\n type=\"button\"\n class=\"cpk:absolute cpk:inset-0 cpk:flex cpk:items-center cpk:justify-center cpk:z-10 cpk:cursor-pointer cpk:bg-black/20 cpk:border-none cpk:p-0\"\n aria-label=\"Play video\"\n data-testid=\"copilot-chat-attachment-video-play\"\n @click=\"openLightbox(attachment)\"\n >\n <div\n class=\"cpk:w-8 cpk:h-8 cpk:rounded-full cpk:bg-black/60 cpk:flex cpk:items-center cpk:justify-center cpk:text-white cpk:text-xs cpk:font-semibold\"\n >\n ▶\n </div>\n </button>\n </div>\n\n <div\n v-else-if=\"attachment.type === 'audio'\"\n class=\"cpk:flex cpk:flex-col cpk:gap-1 cpk:w-full\"\n >\n <audio\n :src=\"getSourceUrl(attachment.source)\"\n controls\n preload=\"metadata\"\n class=\"cpk:w-full cpk:h-8\"\n data-testid=\"copilot-chat-attachment-audio-player\"\n />\n <span\n v-if=\"attachment.filename\"\n class=\"cpk:text-xs cpk:font-medium cpk:overflow-hidden cpk:text-ellipsis cpk:whitespace-nowrap\"\n >\n {{ attachment.filename }}\n </span>\n </div>\n\n <button\n v-else\n type=\"button\"\n class=\"cpk:flex cpk:items-center cpk:gap-2 cpk:w-full cpk:border-none cpk:bg-transparent cpk:p-0 cpk:text-left\"\n :class=\"\n isPdf(attachment.source.mimeType) ||\n isText(attachment.source.mimeType)\n ? 'cpk:cursor-pointer'\n : 'cpk:cursor-default'\n \"\n data-testid=\"copilot-chat-attachment-document-button\"\n @click=\"\n (isPdf(attachment.source.mimeType) ||\n isText(attachment.source.mimeType)) &&\n openLightbox(attachment)\n \"\n >\n <div\n class=\"cpk:w-8 cpk:h-8 cpk:rounded-md cpk:bg-primary cpk:text-primary-foreground cpk:flex cpk:items-center cpk:justify-center cpk:text-[10px] cpk:font-semibold cpk:shrink-0\"\n >\n {{ getDocumentIcon(attachment.source.mimeType ?? \"\") }}\n </div>\n <div class=\"cpk:flex cpk:flex-col cpk:min-w-0\">\n <span\n class=\"cpk:text-xs cpk:font-medium cpk:break-all cpk:leading-tight\"\n data-testid=\"copilot-chat-attachment-document-filename\"\n >\n {{ attachment.filename || \"Document\" }}\n </span>\n <span\n v-if=\"attachment.size != null\"\n class=\"cpk:text-[11px] cpk:text-muted-foreground\"\n >\n {{ formatFileSize(attachment.size) }}\n </span>\n </div>\n </button>\n </template>\n\n <div\n v-else\n class=\"cpk:w-full cpk:h-full cpk:bg-muted-foreground/20\"\n data-testid=\"copilot-chat-attachment-placeholder\"\n />\n\n <button\n type=\"button\"\n class=\"cpk:absolute cpk:bg-black/60 cpk:text-white cpk:border-none cpk:rounded-full cpk:w-5 cpk:h-5 cpk:flex cpk:items-center cpk:justify-center cpk:cursor-pointer cpk:text-[10px] cpk:z-20 cpk:top-1 cpk:right-1\"\n aria-label=\"Remove attachment\"\n @click=\"emit('remove-attachment', attachment.id)\"\n >\n ✕\n </button>\n </div>\n </div>\n\n <Teleport to=\"body\">\n <div\n v-if=\"activeLightboxAttachment\"\n class=\"cpk:fixed cpk:inset-0 cpk:z-[9999] cpk:flex cpk:items-center cpk:justify-center cpk:bg-black/80\"\n data-testid=\"copilot-chat-attachment-lightbox\"\n @click=\"closeLightbox\"\n >\n <button\n type=\"button\"\n class=\"cpk:absolute cpk:top-4 cpk:right-4 cpk:text-white cpk:bg-white/10 cpk:hover:bg-white/20 cpk:rounded-full cpk:w-10 cpk:h-10 cpk:flex cpk:items-center cpk:justify-center cpk:cursor-pointer cpk:border-none\"\n aria-label=\"Close preview\"\n @click.stop=\"closeLightbox\"\n >\n ✕\n </button>\n\n <div data-testid=\"copilot-chat-attachment-lightbox-content\" @click.stop>\n <img\n v-if=\"activeLightboxAttachment.type === 'image'\"\n :src=\"getSourceUrl(activeLightboxAttachment.source)\"\n :alt=\"activeLightboxAttachment.filename || 'Image attachment'\"\n class=\"cpk:max-w-[90vw] cpk:max-h-[90vh] cpk:object-contain cpk:rounded-lg\"\n data-testid=\"copilot-chat-attachment-lightbox-image\"\n />\n\n <video\n v-else-if=\"activeLightboxAttachment.type === 'video'\"\n :src=\"getSourceUrl(activeLightboxAttachment.source)\"\n controls\n autoplay\n class=\"cpk:max-w-[90vw] cpk:max-h-[90vh] cpk:rounded-lg\"\n data-testid=\"copilot-chat-attachment-lightbox-video\"\n />\n\n <template v-else-if=\"activeLightboxAttachment.type === 'document'\">\n <iframe\n v-if=\"\n isPreviewableDocument &&\n isPdf(activeLightboxAttachment.source.mimeType) &&\n lightboxDocumentSource\n \"\n :src=\"lightboxDocumentSource\"\n :title=\"activeLightboxAttachment.filename || 'PDF preview'\"\n class=\"cpk:w-[90vw] cpk:h-[90vh] cpk:max-w-[1000px] cpk:rounded-lg cpk:bg-white\"\n data-testid=\"copilot-chat-attachment-lightbox-document-iframe\"\n />\n\n <div\n v-else-if=\"\n isPreviewableDocument &&\n isText(activeLightboxAttachment.source.mimeType)\n \"\n class=\"cpk:w-[90vw] cpk:max-w-[800px] cpk:max-h-[90vh] cpk:overflow-auto cpk:rounded-lg cpk:bg-white cpk:dark:bg-gray-900 cpk:p-6\"\n >\n <pre\n v-if=\"decodedTextPreview !== null\"\n class=\"cpk:text-sm cpk:whitespace-pre-wrap cpk:wrap-break-word cpk:text-gray-800 cpk:dark:text-gray-200 cpk:font-mono cpk:m-0\"\n data-testid=\"copilot-chat-attachment-lightbox-document-text\"\n >{{ decodedTextPreview }}</pre\n >\n <iframe\n v-else-if=\"lightboxDocumentSource\"\n :src=\"lightboxDocumentSource\"\n :title=\"activeLightboxAttachment.filename || 'Text preview'\"\n class=\"cpk:w-full cpk:h-[80vh] cpk:border-none\"\n data-testid=\"copilot-chat-attachment-lightbox-document-iframe\"\n />\n </div>\n\n <div\n v-else\n class=\"cpk:flex cpk:flex-col cpk:items-center cpk:gap-4 cpk:p-8 cpk:rounded-lg cpk:bg-white cpk:dark:bg-gray-900\"\n data-testid=\"copilot-chat-attachment-lightbox-document-fallback\"\n >\n <div\n class=\"cpk:w-16 cpk:h-16 cpk:rounded-xl cpk:bg-primary cpk:text-primary-foreground cpk:flex cpk:items-center cpk:justify-center cpk:text-xl cpk:font-bold\"\n >\n {{\n getDocumentIcon(activeLightboxAttachment.source.mimeType ?? \"\")\n }}\n </div>\n <div class=\"cpk:text-center\">\n <div\n class=\"cpk:text-base cpk:font-medium cpk:text-gray-800 cpk:dark:text-gray-200\"\n >\n {{ activeLightboxAttachment.filename || \"Document\" }}\n </div>\n <div\n class=\"cpk:text-sm cpk:text-gray-500 cpk:dark:text-gray-400 cpk:mt-1\"\n >\n {{ activeLightboxAttachment.source.mimeType || \"Unknown type\" }}\n {{\n activeLightboxAttachment.size != null\n ? ` · ${formatFileSize(activeLightboxAttachment.size)}`\n : \"\"\n }}\n </div>\n </div>\n <div class=\"cpk:text-xs cpk:text-gray-400 cpk:dark:text-gray-500\">\n No preview available for this file type\n </div>\n </div>\n </template>\n </div>\n </div>\n </Teleport>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from \"vue\";\nimport type { Message, ReasoningMessage } from \"@ag-ui/core\";\nimport { StreamMarkdown } from \"streamdown-vue\";\nimport { IconChevronRight } from \"../icons\";\n\nconst props = withDefaults(\n defineProps<{\n message: ReasoningMessage;\n messages?: Message[];\n isRunning?: boolean;\n }>(),\n {\n messages: () => [],\n isRunning: false,\n },\n);\n\ndefineSlots<{\n layout?: (props: {\n message: ReasoningMessage;\n messages: Message[];\n isRunning: boolean;\n header: {\n isOpen: boolean;\n label: string;\n hasContent: boolean;\n isStreaming: boolean;\n onClick?: () => void;\n };\n contentView: {\n isStreaming: boolean;\n hasContent: boolean;\n content: string;\n };\n toggle: {\n isOpen: boolean;\n contentView: {\n isStreaming: boolean;\n hasContent: boolean;\n content: string;\n };\n };\n }) => unknown;\n header?: (props: {\n isOpen: boolean;\n label: string;\n hasContent: boolean;\n isStreaming: boolean;\n onClick?: () => void;\n }) => unknown;\n \"content-view\"?: (props: {\n isStreaming: boolean;\n hasContent: boolean;\n content: string;\n }) => unknown;\n toggle?: (props: {\n isOpen: boolean;\n contentView: {\n isStreaming: boolean;\n hasContent: boolean;\n content: string;\n };\n }) => unknown;\n}>();\n\nfunction formatDuration(seconds: number): string {\n if (seconds < 1) return \"a few seconds\";\n if (seconds < 60) return `${Math.round(seconds)} seconds`;\n const mins = Math.floor(seconds / 60);\n const secs = Math.round(seconds % 60);\n if (secs === 0) return `${mins} minute${mins > 1 ? \"s\" : \"\"}`;\n return `${mins}m ${secs}s`;\n}\n\nconst normalizedContent = computed(() =>\n typeof props.message.content === \"string\" ? props.message.content : \"\",\n);\nconst hasContent = computed(() => normalizedContent.value.length > 0);\nconst isLatest = computed(\n () => props.messages[props.messages.length - 1]?.id === props.message.id,\n);\nconst isStreaming = computed(() => !!(props.isRunning && isLatest.value));\n\nconst elapsed = ref(0);\nconst isOpen = ref(isStreaming.value);\nconst userToggledDuringStreaming = ref(false);\nlet startTimeMs: number | null = null;\nlet elapsedInterval: ReturnType<typeof setInterval> | null = null;\n\nfunction clearElapsedInterval() {\n if (elapsedInterval) {\n clearInterval(elapsedInterval);\n elapsedInterval = null;\n }\n}\n\nfunction updateElapsedNow() {\n if (startTimeMs !== null) {\n elapsed.value = (Date.now() - startTimeMs) / 1000;\n }\n}\n\nwatch(\n isStreaming,\n (nextIsStreaming) => {\n if (nextIsStreaming) {\n if (startTimeMs === null) {\n startTimeMs = Date.now();\n }\n clearElapsedInterval();\n elapsedInterval = setInterval(updateElapsedNow, 1000);\n userToggledDuringStreaming.value = false;\n isOpen.value = true;\n return;\n }\n\n clearElapsedInterval();\n updateElapsedNow();\n if (!userToggledDuringStreaming.value) {\n isOpen.value = false;\n }\n },\n { immediate: true },\n);\n\nonBeforeUnmount(() => {\n clearElapsedInterval();\n});\n\nconst label = computed(() =>\n isStreaming.value\n ? \"Thinking…\"\n : `Thought for ${formatDuration(elapsed.value)}`,\n);\n\nfunction toggleOpen() {\n if (!hasContent.value) return;\n userToggledDuringStreaming.value = true;\n isOpen.value = !isOpen.value;\n}\n</script>\n\n<template>\n <div data-copilotkit class=\"cpk:my-1\" :data-message-id=\"message.id\">\n <slot\n name=\"layout\"\n :message=\"message\"\n :messages=\"messages\"\n :is-running=\"isRunning\"\n :header=\"{\n isOpen,\n label,\n hasContent,\n isStreaming,\n onClick: hasContent ? toggleOpen : undefined,\n }\"\n :content-view=\"{\n isStreaming,\n hasContent,\n content: normalizedContent,\n }\"\n :toggle=\"{\n isOpen,\n contentView: {\n isStreaming,\n hasContent,\n content: normalizedContent,\n },\n }\"\n >\n <slot\n name=\"header\"\n :is-open=\"isOpen\"\n :label=\"label\"\n :has-content=\"hasContent\"\n :is-streaming=\"isStreaming\"\n :on-click=\"hasContent ? toggleOpen : undefined\"\n >\n <button\n type=\"button\"\n class=\"cpk:inline-flex cpk:items-center cpk:gap-1 cpk:py-1 cpk:text-sm cpk:text-muted-foreground cpk:transition-colors cpk:select-none\"\n :class=\"\n hasContent\n ? 'cpk:hover:text-foreground cpk:cursor-pointer'\n : 'cpk:cursor-default'\n \"\n :aria-expanded=\"hasContent ? isOpen : undefined\"\n @click=\"hasContent ? toggleOpen() : undefined\"\n >\n <span class=\"cpk:font-medium\">{{ label }}</span>\n <span\n v-if=\"isStreaming && !hasContent\"\n class=\"cpk:inline-flex cpk:items-center cpk:ml-1\"\n >\n <span\n class=\"cpk:w-1.5 cpk:h-1.5 cpk:rounded-full cpk:bg-muted-foreground cpk:animate-pulse\"\n />\n </span>\n <IconChevronRight\n v-if=\"hasContent\"\n class=\"cpk:size-3.5 cpk:shrink-0 cpk:transition-transform cpk:duration-200\"\n :class=\"{ 'cpk:rotate-90': isOpen }\"\n />\n </button>\n </slot>\n\n <slot\n name=\"toggle\"\n :is-open=\"isOpen\"\n :content-view=\"{\n isStreaming,\n hasContent,\n content: normalizedContent,\n }\"\n >\n <div\n class=\"cpk:grid cpk:transition-[grid-template-rows] cpk:duration-200 cpk:ease-in-out\"\n :style=\"{ gridTemplateRows: isOpen ? '1fr' : '0fr' }\"\n >\n <div class=\"cpk:overflow-hidden\">\n <slot\n name=\"content-view\"\n :is-streaming=\"isStreaming\"\n :has-content=\"hasContent\"\n :content=\"normalizedContent\"\n >\n <div v-if=\"hasContent || isStreaming\" class=\"cpk:pb-2 cpk:pt-1\">\n <div class=\"cpk:text-sm cpk:text-muted-foreground\">\n <StreamMarkdown :content=\"normalizedContent\" />\n <span\n v-if=\"isStreaming && hasContent\"\n class=\"cpk:inline-flex cpk:items-center cpk:ml-1 cpk:align-middle\"\n >\n <span\n class=\"cpk:w-2 cpk:h-2 cpk:rounded-full cpk:bg-muted-foreground cpk:animate-pulse-cursor\"\n />\n </span>\n </div>\n </div>\n </slot>\n </div>\n </div>\n </slot>\n </slot>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, getCurrentInstance, onBeforeUnmount, ref } from \"vue\";\nimport type { UserMessage } from \"@ag-ui/core\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport {\n IconCheck,\n IconChevronLeft,\n IconChevronRight,\n IconCopy,\n IconEdit,\n} from \"../icons\";\nimport type {\n CopilotChatUserMessageBranchNavigationSlotProps,\n CopilotChatUserMessageCopyButtonSlotProps,\n CopilotChatUserMessageEditButtonSlotProps,\n CopilotChatUserMessageLayoutSlotProps,\n CopilotChatUserMessageMessageRendererSlotProps,\n CopilotChatUserMessageOnEditMessageProps,\n CopilotChatUserMessageOnSwitchToBranchProps,\n CopilotChatUserMessageToolbarSlotProps,\n} from \"./types\";\n\nconst props = withDefaults(\n defineProps<{\n message: UserMessage;\n branchIndex?: number;\n numberOfBranches?: number;\n }>(),\n {\n branchIndex: 0,\n numberOfBranches: 1,\n },\n);\n\ndefineSlots<{\n \"message-renderer\"?: (\n props: CopilotChatUserMessageMessageRendererSlotProps,\n ) => unknown;\n toolbar?: (props: CopilotChatUserMessageToolbarSlotProps) => unknown;\n \"copy-button\"?: (props: CopilotChatUserMessageCopyButtonSlotProps) => unknown;\n \"edit-button\"?: (props: CopilotChatUserMessageEditButtonSlotProps) => unknown;\n \"branch-navigation\"?: (\n props: CopilotChatUserMessageBranchNavigationSlotProps,\n ) => unknown;\n layout?: (props: CopilotChatUserMessageLayoutSlotProps) => unknown;\n \"toolbar-items\"?: () => unknown;\n}>();\n\nconst emit = defineEmits<{\n \"edit-message\": [payload: CopilotChatUserMessageOnEditMessageProps];\n \"switch-to-branch\": [payload: CopilotChatUserMessageOnSwitchToBranchProps];\n}>();\n\nconst config = useCopilotChatConfiguration();\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\nconst instance = getCurrentInstance();\nconst copied = ref(false);\nlet copiedResetTimeout: ReturnType<typeof setTimeout> | null = null;\nconst vnodeProps = computed(\n () => (instance?.vnode.props ?? {}) as Record<string, unknown>,\n);\n\nconst toolbarButtonClass = [\n \"cpk:inline-flex cpk:h-8 cpk:w-8 cpk:items-center cpk:justify-center cpk:rounded-md cpk:p-0\",\n \"cpk:cursor-pointer cpk:text-[rgb(93,93,93)] cpk:transition-colors cpk:hover:bg-[#E8E8E8]\",\n \"cpk:hover:text-[rgb(93,93,93)] cpk:dark:text-[rgb(243,243,243)] cpk:dark:hover:bg-[#303030]\",\n \"cpk:dark:hover:text-[rgb(243,243,243)] cpk:disabled:pointer-events-none cpk:disabled:opacity-50\",\n].join(\" \");\n\nfunction flattenUserMessageContent(content?: UserMessage[\"content\"]): string {\n if (!content) {\n return \"\";\n }\n\n if (typeof content === \"string\") {\n return content;\n }\n\n return content\n .map((part) => {\n if (\n part &&\n typeof part === \"object\" &&\n \"type\" in part &&\n (part as { type?: unknown }).type === \"text\" &&\n typeof (part as { text?: unknown }).text === \"string\"\n ) {\n return (part as { text: string }).text;\n }\n return \"\";\n })\n .filter((text) => text.length > 0)\n .join(\"\\n\");\n}\n\nconst flattenedContent = computed(() =>\n flattenUserMessageContent(props.message.content),\n);\nconst isMultiline = computed(() => flattenedContent.value.includes(\"\\n\"));\nfunction hasListener(listenerName: string) {\n const listener = vnodeProps.value[listenerName];\n if (Array.isArray(listener)) {\n return listener.length > 0;\n }\n return !!listener;\n}\n\nconst hasEditAction = computed(() => hasListener(\"onEditMessage\"));\nconst showBranchNavigation = computed(\n () => props.numberOfBranches > 1 && hasListener(\"onSwitchToBranch\"),\n);\n\nconst canGoPrev = computed(() => props.branchIndex > 0);\nconst canGoNext = computed(\n () => props.branchIndex < props.numberOfBranches - 1,\n);\n\nfunction resetCopiedStateWithDelay() {\n if (copiedResetTimeout) {\n clearTimeout(copiedResetTimeout);\n }\n copied.value = true;\n copiedResetTimeout = setTimeout(() => {\n copied.value = false;\n copiedResetTimeout = null;\n }, 2000);\n}\n\nasync function handleCopyMessage() {\n if (!flattenedContent.value) return;\n\n if (\n typeof navigator === \"undefined\" ||\n typeof navigator.clipboard?.writeText !== \"function\"\n ) {\n return;\n }\n\n try {\n await navigator.clipboard.writeText(flattenedContent.value);\n resetCopiedStateWithDelay();\n } catch (error) {\n console.error(\"Failed to copy to clipboard:\", error);\n }\n}\n\nfunction handleEditMessage() {\n if (!hasEditAction.value) {\n return;\n }\n const payload = { message: props.message };\n emit(\"edit-message\", payload);\n}\n\nfunction switchToBranch(branchIndex: number) {\n if (!showBranchNavigation.value) {\n return;\n }\n const payload = {\n branchIndex,\n numberOfBranches: props.numberOfBranches,\n message: props.message,\n };\n emit(\"switch-to-branch\", payload);\n}\n\nfunction goPrev() {\n if (!canGoPrev.value) {\n return;\n }\n switchToBranch(props.branchIndex - 1);\n}\n\nfunction goNext() {\n if (!canGoNext.value) {\n return;\n }\n switchToBranch(props.branchIndex + 1);\n}\n\nonBeforeUnmount(() => {\n if (copiedResetTimeout) {\n clearTimeout(copiedResetTimeout);\n }\n});\n</script>\n\n<template>\n <slot\n name=\"layout\"\n :message=\"message\"\n :content=\"flattenedContent\"\n :is-multiline=\"isMultiline\"\n :show-branch-navigation=\"showBranchNavigation\"\n :has-edit-action=\"hasEditAction\"\n :branch-index=\"branchIndex\"\n :number-of-branches=\"numberOfBranches\"\n :can-go-prev=\"canGoPrev\"\n :can-go-next=\"canGoNext\"\n :on-copy=\"handleCopyMessage\"\n :on-edit=\"handleEditMessage\"\n :go-prev=\"goPrev\"\n :go-next=\"goNext\"\n :copied=\"copied\"\n >\n <div\n data-copilotkit\n data-testid=\"copilot-user-message\"\n class=\"cpk:flex cpk:flex-col cpk:items-end cpk:group cpk:pt-10\"\n :data-message-id=\"message.id\"\n v-bind=\"$attrs\"\n >\n <slot\n name=\"message-renderer\"\n :message=\"message\"\n :content=\"flattenedContent\"\n :is-multiline=\"isMultiline\"\n >\n <div\n class=\"cpk:prose cpk:dark:prose-invert cpk:bg-muted cpk:relative cpk:max-w-[80%] cpk:rounded-[18px] cpk:px-4 cpk:py-1.5 cpk:inline-block cpk:whitespace-pre-wrap\"\n :data-multiline=\"isMultiline ? 'true' : undefined\"\n :class=\"{ 'cpk:py-3': isMultiline }\"\n >\n {{ flattenedContent }}\n </div>\n </slot>\n\n <slot\n name=\"toolbar\"\n :message=\"message\"\n :show-branch-navigation=\"showBranchNavigation\"\n :has-edit-action=\"hasEditAction\"\n >\n <div\n class=\"cpk:w-full cpk:bg-transparent cpk:flex cpk:items-center cpk:justify-end cpk:-mr-[5px] cpk:mt-[4px] cpk:invisible cpk:group-hover:visible\"\n >\n <div class=\"cpk:flex cpk:items-center cpk:gap-1 cpk:justify-end\">\n <slot name=\"toolbar-items\" />\n\n <slot\n name=\"copy-button\"\n :on-copy=\"handleCopyMessage\"\n :copied=\"copied\"\n :label=\"labels.userMessageToolbarCopyMessageLabel\"\n >\n <button\n data-testid=\"copilot-user-copy-button\"\n type=\"button\"\n :class=\"toolbarButtonClass\"\n :aria-label=\"labels.userMessageToolbarCopyMessageLabel\"\n :title=\"labels.userMessageToolbarCopyMessageLabel\"\n @click=\"handleCopyMessage\"\n >\n <IconCheck v-if=\"copied\" class=\"cpk:size-[18px]\" />\n <IconCopy v-else class=\"cpk:size-[18px]\" />\n </button>\n </slot>\n\n <slot\n v-if=\"hasEditAction\"\n name=\"edit-button\"\n :on-edit=\"handleEditMessage\"\n :label=\"labels.userMessageToolbarEditMessageLabel\"\n >\n <button\n type=\"button\"\n :class=\"toolbarButtonClass\"\n :aria-label=\"labels.userMessageToolbarEditMessageLabel\"\n :title=\"labels.userMessageToolbarEditMessageLabel\"\n @click=\"handleEditMessage\"\n >\n <IconEdit class=\"cpk:size-[18px]\" />\n </button>\n </slot>\n\n <slot\n v-if=\"showBranchNavigation\"\n name=\"branch-navigation\"\n :branch-index=\"branchIndex\"\n :number-of-branches=\"numberOfBranches\"\n :can-go-prev=\"canGoPrev\"\n :can-go-next=\"canGoNext\"\n :go-prev=\"goPrev\"\n :go-next=\"goNext\"\n >\n <div class=\"cpk:flex cpk:items-center cpk:gap-1\">\n <button\n type=\"button\"\n :class=\"toolbarButtonClass\"\n class=\"cpk:h-6 cpk:w-6 cpk:p-0\"\n :disabled=\"!canGoPrev\"\n aria-label=\"Previous branch\"\n title=\"Previous branch\"\n @click=\"goPrev\"\n >\n <IconChevronLeft class=\"cpk:size-[20px]\" />\n </button>\n <span\n class=\"cpk:text-sm cpk:text-muted-foreground cpk:px-0 cpk:font-medium\"\n >\n {{ branchIndex + 1 }}/{{ numberOfBranches }}\n </span>\n <button\n type=\"button\"\n :class=\"toolbarButtonClass\"\n class=\"cpk:h-6 cpk:w-6 cpk:p-0\"\n :disabled=\"!canGoNext\"\n aria-label=\"Next branch\"\n title=\"Next branch\"\n @click=\"goNext\"\n >\n <IconChevronRight class=\"cpk:size-[20px]\" />\n </button>\n </div>\n </slot>\n </div>\n </div>\n </slot>\n </div>\n </slot>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref, useSlots, watch } from \"vue\";\nimport type { Component } from \"vue\";\nimport type {\n ActivityMessage,\n AssistantMessage,\n Message,\n ReasoningMessage,\n ToolMessage,\n UserMessage,\n} from \"@ag-ui/core\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\nimport type {\n InterruptRenderProps,\n VueCustomMessageRendererProps,\n} from \"../../types\";\nimport { getThreadClone } from \"../../hooks/use-agent\";\nimport { useCopilotKit } from \"../../providers/useCopilotKit\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport CopilotChatAssistantMessage from \"./CopilotChatAssistantMessage.vue\";\nimport CopilotChatReasoningMessage from \"./CopilotChatReasoningMessage.vue\";\nimport CopilotChatUserMessage from \"./CopilotChatUserMessage.vue\";\n\ninterface MessageMetaProps {\n message: Message;\n position: \"before\" | \"after\";\n runId: string;\n messageIndex: number;\n messageIndexInRun: number;\n numberOfMessagesInRun: number;\n agentId: string;\n stateSnapshot: unknown;\n}\n\ninterface ActivitySlotProps {\n activityType: string;\n content: unknown;\n message: ActivityMessage;\n agent: unknown;\n}\n\ntype InterruptSlotProps = InterruptRenderProps<unknown, unknown>;\ntype CustomMessagePosition = VueCustomMessageRendererProps[\"position\"];\ntype ResolvedCustomMessageRenderer = {\n renderer:\n | Component<VueCustomMessageRendererProps>\n | ((props: VueCustomMessageRendererProps) => unknown);\n props: VueCustomMessageRendererProps;\n};\n\nconst props = withDefaults(\n defineProps<{\n messages?: Message[];\n isRunning?: boolean;\n }>(),\n {\n messages: () => [],\n isRunning: false,\n },\n);\n\ndefineSlots<{\n \"message-before\"?: (props: MessageMetaProps) => unknown;\n \"message-after\"?: (props: MessageMetaProps) => unknown;\n interrupt?: (props: InterruptSlotProps) => unknown;\n \"assistant-message\"?: (props: {\n message: AssistantMessage;\n messages: Message[];\n isRunning: boolean;\n }) => unknown;\n \"user-message\"?: (props: { message: UserMessage }) => unknown;\n \"reasoning-message\"?: (props: {\n message: ReasoningMessage;\n messages: Message[];\n isRunning: boolean;\n }) => unknown;\n \"activity-message\"?: (props: ActivitySlotProps) => unknown;\n [key: string]: ((props: any) => unknown) | undefined;\n cursor?: () => unknown;\n \"tool-call\"?: (props: {\n name: string;\n args: unknown;\n status: string;\n result: string | undefined;\n toolCall: unknown;\n toolMessage: ToolMessage | undefined;\n }) => unknown;\n [key: `tool-call-${string}`]: (props: {\n name: string;\n args: unknown;\n status: string;\n result: string | undefined;\n toolCall: unknown;\n toolMessage: ToolMessage | undefined;\n }) => unknown;\n}>();\n\nconst { copilotkit } = useCopilotKit();\nconst config = useCopilotChatConfiguration();\nconst stateTick = ref(0);\nconst interruptState = ref<InterruptSlotProps | null>(null);\nconst componentSlots = useSlots() as Record<string, (props?: any) => unknown>;\nconst forwardedSlotNames = computed(() => Object.keys(componentSlots));\nconst resolvedAgentId = computed(\n () => config.value?.agentId ?? DEFAULT_AGENT_ID,\n);\nconst resolvedThreadAgent = computed(() => {\n const agentId = resolvedAgentId.value;\n const registryAgent = copilotkit.value.getAgent(agentId);\n return getThreadClone(registryAgent, config.value?.threadId) ?? registryAgent;\n});\n\nwatch(\n [\n resolvedAgentId,\n () => config.value?.threadId,\n () => copilotkit.value,\n () => copilotkit.value.runtimeConnectionStatus,\n ],\n ([_agentId, threadId], _prev, onCleanup) => {\n const registryAgent = copilotkit.value.getAgent(resolvedAgentId.value);\n const agent = getThreadClone(registryAgent, threadId) ?? registryAgent;\n if (!agent) return;\n\n const sub = agent.subscribe({\n onStateChanged: () => {\n stateTick.value += 1;\n },\n onRunStartedEvent: () => {\n stateTick.value += 1;\n },\n onRunFinishedEvent: () => {\n stateTick.value += 1;\n },\n onRunErrorEvent: () => {\n stateTick.value += 1;\n },\n });\n\n onCleanup(() => sub.unsubscribe());\n },\n { immediate: true },\n);\n\nwatch(\n () => copilotkit.value,\n (core, _previous, onCleanup) => {\n interruptState.value = core.interruptState as InterruptSlotProps | null;\n const sub = core.subscribe({\n onInterruptStateChanged: ({ interruptState: nextInterruptState }) => {\n interruptState.value = nextInterruptState as InterruptSlotProps | null;\n },\n onRuntimeConnectionStatusChanged: () => {\n stateTick.value += 1;\n },\n });\n\n onCleanup(() => sub.unsubscribe());\n },\n { immediate: true },\n);\n\nfunction deduplicateMessages(messages: Message[]): Message[] {\n const byId = new Map<string, Message>();\n for (const message of messages) {\n const existing = byId.get(message.id);\n if (\n existing &&\n message.role === \"assistant\" &&\n existing.role === \"assistant\"\n ) {\n const content = message.content || existing.content;\n const toolCalls = message.toolCalls ?? existing.toolCalls;\n byId.set(message.id, {\n ...existing,\n ...message,\n content,\n toolCalls,\n } as AssistantMessage);\n } else {\n byId.set(message.id, message);\n }\n }\n return [...byId.values()];\n}\n\nconst deduplicatedMessages = computed(() =>\n deduplicateMessages(props.messages),\n);\nconst lastMessage = computed(() => props.messages[props.messages.length - 1]);\nconst showCursor = computed(\n () => props.isRunning && lastMessage.value?.role !== \"reasoning\",\n);\n\nwatch(\n [() => props.messages.length, () => deduplicatedMessages.value.length],\n ([messageCount, deduplicatedCount]) => {\n if (\n process.env.NODE_ENV === \"development\" &&\n deduplicatedCount < messageCount\n ) {\n console.warn(\n `CopilotChatMessageView: Deduplicated ${messageCount - deduplicatedCount} message(s) with duplicate IDs.`,\n );\n }\n },\n { immediate: true },\n);\n\nfunction getMeta(\n message: Message,\n): Omit<MessageMetaProps, \"position\" | \"message\"> {\n stateTick.value += 0;\n const agentId = resolvedAgentId.value;\n const threadId = config.value?.threadId ?? \"\";\n const core = copilotkit.value;\n\n const resolvedRunId =\n core.getRunIdForMessage(agentId, threadId, message.id) ??\n core.getRunIdsForThread(agentId, threadId).slice(-1)[0];\n const runId = resolvedRunId ?? `missing-run-id:${message.id}`;\n\n const agent = resolvedThreadAgent.value ?? core.getAgent(agentId);\n\n const messageIdsInRun =\n resolvedRunId && agent\n ? agent.messages\n .filter(\n (msg) =>\n core.getRunIdForMessage(agentId, threadId, msg.id) ===\n resolvedRunId,\n )\n .map((msg) => msg.id)\n : [message.id];\n\n const rawMessageIndex = agent\n ? agent.messages.findIndex((msg) => msg.id === message.id)\n : -1;\n const messageIndex = rawMessageIndex >= 0 ? rawMessageIndex : 0;\n const messageIndexInRun = resolvedRunId\n ? Math.max(messageIdsInRun.indexOf(message.id), 0)\n : 0;\n const numberOfMessagesInRun = resolvedRunId ? messageIdsInRun.length : 1;\n const stateSnapshot = resolvedRunId\n ? core.getStateByRun(agentId, threadId, resolvedRunId)\n : undefined;\n\n return {\n runId,\n messageIndex,\n messageIndexInRun,\n numberOfMessagesInRun,\n agentId,\n stateSnapshot,\n };\n}\n\nfunction getActivitySlotName(activityType: string): `activity-${string}` {\n return `activity-${activityType}`;\n}\n\nfunction resolveCustomMessageRenderer(\n message: Message,\n position: CustomMessagePosition,\n): ResolvedCustomMessageRenderer | null {\n stateTick.value += 0;\n const slotName = position === \"before\" ? \"message-before\" : \"message-after\";\n if (componentSlots[slotName]) {\n return null;\n }\n\n const agentId = resolvedAgentId.value;\n const renderers = [...copilotkit.value.renderCustomMessages]\n .filter(\n (renderer) =>\n renderer.agentId === undefined || renderer.agentId === agentId,\n )\n .sort((a, b) => {\n const aHasAgent = a.agentId !== undefined;\n const bHasAgent = b.agentId !== undefined;\n if (aHasAgent === bHasAgent) return 0;\n return aHasAgent ? -1 : 1;\n });\n\n const selected = renderers[0];\n if (!selected?.render) {\n return null;\n }\n\n return {\n renderer: selected.render as ResolvedCustomMessageRenderer[\"renderer\"],\n props: {\n ...getMeta(message),\n message,\n position,\n },\n };\n}\n\nfunction resolveActivityRenderer(\n message: ActivityMessage,\n): { renderer: Component; props: ActivitySlotProps } | null {\n stateTick.value += 0;\n\n const agentId = resolvedAgentId.value;\n const renderer = [...copilotkit.value.renderActivityMessages]\n .filter(\n (entry) =>\n entry.activityType === message.activityType &&\n (entry.agentId === undefined || entry.agentId === agentId),\n )\n .sort((a, b) => {\n const aScoped = a.agentId !== undefined;\n const bScoped = b.agentId !== undefined;\n if (aScoped === bScoped) return 0;\n return aScoped ? -1 : 1;\n })[0];\n\n if (!renderer) return null;\n const parsed = renderer.content.safeParse(message.content);\n if (!parsed.success) return null;\n\n return {\n renderer: renderer.render as Component,\n props: {\n activityType: message.activityType,\n content: parsed.data,\n message,\n agent: resolvedThreadAgent.value,\n },\n };\n}\n\nfunction resolveToolMessage(\n message: Message,\n toolCallId: string,\n): ToolMessage | undefined {\n return props.messages.find(\n (candidate) =>\n candidate.role === \"tool\" &&\n (candidate as ToolMessage).toolCallId === toolCallId,\n ) as ToolMessage | undefined;\n}\n</script>\n\n<template>\n <div data-copilotkit class=\"cpk:flex cpk:flex-col\" v-bind=\"$attrs\">\n <template v-for=\"message in deduplicatedMessages\" :key=\"message.id\">\n <slot\n v-if=\"componentSlots['message-before']\"\n name=\"message-before\"\n :message=\"message\"\n position=\"before\"\n :run-id=\"getMeta(message).runId\"\n :message-index=\"getMeta(message).messageIndex\"\n :message-index-in-run=\"getMeta(message).messageIndexInRun\"\n :number-of-messages-in-run=\"getMeta(message).numberOfMessagesInRun\"\n :agent-id=\"getMeta(message).agentId\"\n :state-snapshot=\"getMeta(message).stateSnapshot\"\n />\n <component\n v-else-if=\"resolveCustomMessageRenderer(message, 'before')\"\n :is=\"resolveCustomMessageRenderer(message, 'before')!.renderer\"\n v-bind=\"resolveCustomMessageRenderer(message, 'before')!.props\"\n />\n\n <slot\n v-if=\"message.role === 'assistant'\"\n name=\"assistant-message\"\n :message=\"message\"\n :messages=\"messages\"\n :is-running=\"isRunning\"\n >\n <CopilotChatAssistantMessage\n :message=\"message\"\n :messages=\"messages\"\n :is-running=\"isRunning\"\n >\n <template\n v-for=\"slotName in forwardedSlotNames\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps\" />\n </template>\n </CopilotChatAssistantMessage>\n </slot>\n\n <slot\n v-else-if=\"message.role === 'user'\"\n name=\"user-message\"\n :message=\"message\"\n >\n <CopilotChatUserMessage :message=\"message\">\n <template\n v-for=\"slotName in forwardedSlotNames\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps\" />\n </template>\n </CopilotChatUserMessage>\n </slot>\n\n <slot\n v-else-if=\"message.role === 'reasoning'\"\n name=\"reasoning-message\"\n :message=\"message\"\n :messages=\"messages\"\n :is-running=\"isRunning\"\n >\n <CopilotChatReasoningMessage\n :message=\"message\"\n :messages=\"messages\"\n :is-running=\"isRunning\"\n />\n </slot>\n\n <slot\n v-else-if=\"message.role === 'activity'\"\n :name=\"getActivitySlotName(message.activityType)\"\n :activity-type=\"message.activityType\"\n :content=\"message.content\"\n :message=\"message\"\n :agent=\"resolvedThreadAgent\"\n >\n <slot\n name=\"activity-message\"\n :activity-type=\"message.activityType\"\n :content=\"message.content\"\n :message=\"message\"\n :agent=\"resolvedThreadAgent\"\n >\n <component\n v-if=\"resolveActivityRenderer(message)\"\n :is=\"resolveActivityRenderer(message)!.renderer\"\n v-bind=\"resolveActivityRenderer(message)!.props\"\n />\n </slot>\n </slot>\n\n <slot\n v-if=\"componentSlots['message-after']\"\n name=\"message-after\"\n :message=\"message\"\n position=\"after\"\n :run-id=\"getMeta(message).runId\"\n :message-index=\"getMeta(message).messageIndex\"\n :message-index-in-run=\"getMeta(message).messageIndexInRun\"\n :number-of-messages-in-run=\"getMeta(message).numberOfMessagesInRun\"\n :agent-id=\"getMeta(message).agentId\"\n :state-snapshot=\"getMeta(message).stateSnapshot\"\n />\n <component\n v-else-if=\"resolveCustomMessageRenderer(message, 'after')\"\n :is=\"resolveCustomMessageRenderer(message, 'after')!.renderer\"\n v-bind=\"resolveCustomMessageRenderer(message, 'after')!.props\"\n />\n </template>\n\n <slot\n v-if=\"interruptState\"\n name=\"interrupt\"\n :event=\"interruptState.event\"\n :result=\"interruptState.result\"\n :resolve=\"interruptState.resolve\"\n />\n\n <slot v-if=\"showCursor\" name=\"cursor\">\n <div\n class=\"cpk:w-[11px] cpk:h-[11px] cpk:rounded-full cpk:bg-foreground cpk:animate-pulse cpk:ml-1\"\n data-testid=\"copilot-chat-cursor\"\n />\n </slot>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport type { Component } from \"vue\";\nimport { computed } from \"vue\";\nimport { IconLoader2 } from \"../icons\";\n\nconst props = withDefaults(\n defineProps<{\n icon?: Component;\n isLoading?: boolean;\n disabled?: boolean;\n type?: \"button\" | \"submit\" | \"reset\";\n }>(),\n {\n icon: undefined,\n isLoading: false,\n disabled: false,\n type: \"button\",\n },\n);\n\nconst isDisabled = computed(() => props.isLoading || props.disabled);\n</script>\n\n<template>\n <button\n data-copilotkit\n data-slot=\"suggestion-pill\"\n data-testid=\"copilot-chat-suggestion-pill\"\n :type=\"type\"\n :aria-busy=\"isLoading ? 'true' : undefined\"\n :disabled=\"isDisabled\"\n class=\"cpk:group cpk:inline-flex cpk:h-7 cpk:w-fit cpk:items-center cpk:gap-1 cpk:rounded-full cpk:border cpk:border-border/60 cpk:bg-background cpk:px-2.5 cpk:text-[11px] cpk:leading-none cpk:text-foreground cpk:transition-colors cpk:cursor-pointer cpk:hover:bg-accent/60 cpk:hover:text-foreground cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-ring cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background cpk:disabled:cursor-not-allowed cpk:disabled:text-muted-foreground cpk:disabled:hover:bg-background cpk:disabled:hover:text-muted-foreground cpk:pointer-events-auto cpk:sm:h-8 cpk:sm:gap-1.5 cpk:sm:px-3 cpk:sm:text-xs\"\n v-bind=\"$attrs\"\n >\n <span\n v-if=\"isLoading\"\n class=\"cpk:flex cpk:h-3.5 cpk:w-3.5 cpk:items-center cpk:justify-center cpk:text-muted-foreground cpk:sm:h-4 cpk:sm:w-4\"\n >\n <IconLoader2\n class=\"cpk:h-3.5 cpk:w-3.5 cpk:animate-spin cpk:sm:h-4 cpk:sm:w-4\"\n aria-hidden=\"true\"\n />\n </span>\n <span\n v-else-if=\"$slots.icon || icon\"\n class=\"cpk:flex cpk:h-3.5 cpk:w-3.5 cpk:items-center cpk:justify-center cpk:text-muted-foreground cpk:sm:h-4 cpk:sm:w-4\"\n >\n <slot name=\"icon\">\n <component :is=\"icon\" />\n </slot>\n </span>\n <span class=\"cpk:whitespace-nowrap cpk:font-medium cpk:leading-none\">\n <slot />\n </span>\n </button>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useAttrs } from \"vue\";\nimport type { Suggestion } from \"@copilotkit/core\";\nimport CopilotChatSuggestionPill from \"./CopilotChatSuggestionPill.vue\";\nimport type {\n CopilotChatSuggestionViewContainerSlotProps,\n CopilotChatSuggestionViewLayoutSlotProps,\n CopilotChatSuggestionViewSuggestionSlotProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(\n defineProps<{\n suggestions: Suggestion[];\n loadingIndexes?: ReadonlyArray<number>;\n }>(),\n {\n loadingIndexes: () => [],\n },\n);\n\ndefineSlots<{\n suggestion?: (props: CopilotChatSuggestionViewSuggestionSlotProps) => unknown;\n container?: (props: CopilotChatSuggestionViewContainerSlotProps) => unknown;\n layout?: (props: CopilotChatSuggestionViewLayoutSlotProps) => unknown;\n}>();\n\nconst emit = defineEmits<{\n \"select-suggestion\": [suggestion: Suggestion, index: number];\n}>();\n\nconst attrs = useAttrs();\nconst loadingSet = computed(() => new Set(props.loadingIndexes));\nconst containerClass = computed(() => [\n \"cpk:flex cpk:flex-wrap cpk:items-center cpk:gap-1.5 cpk:pl-0 cpk:pr-4 cpk:pointer-events-none cpk:sm:gap-2 cpk:sm:px-0\",\n attrs.class,\n]);\nconst containerAttrs = computed(() => {\n const { class: _className, ...rest } = attrs;\n return rest;\n});\n\nfunction isLoading(index: number, suggestion: Suggestion) {\n return loadingSet.value.has(index) || suggestion.isLoading === true;\n}\n\nfunction handleSelectSuggestion(suggestion: Suggestion, index: number) {\n emit(\"select-suggestion\", suggestion, index);\n}\n\nconst slotProps = computed<CopilotChatSuggestionViewContainerSlotProps>(() => ({\n suggestions: props.suggestions,\n loadingIndexes: props.loadingIndexes,\n onSelectSuggestion: handleSelectSuggestion,\n containerClass: containerClass.value,\n containerAttrs: containerAttrs.value as Record<string, unknown>,\n}));\n</script>\n\n<template>\n <slot name=\"layout\" v-bind=\"slotProps\">\n <slot name=\"container\" v-bind=\"slotProps\">\n <div\n data-copilotkit\n data-testid=\"copilot-chat-suggestion-view\"\n :class=\"containerClass\"\n v-bind=\"containerAttrs\"\n >\n <template\n v-for=\"(suggestion, index) in suggestions\"\n :key=\"`${suggestion.title}-${index}`\"\n >\n <slot\n name=\"suggestion\"\n :suggestion=\"suggestion\"\n :index=\"index\"\n :is-loading=\"isLoading(index, suggestion)\"\n :on-select=\"() => handleSelectSuggestion(suggestion, index)\"\n >\n <CopilotChatSuggestionPill\n :is-loading=\"isLoading(index, suggestion)\"\n type=\"button\"\n @click=\"handleSelectSuggestion(suggestion, index)\"\n >\n {{ suggestion.title }}\n </CopilotChatSuggestionPill>\n </slot>\n </template>\n </div>\n </slot>\n </slot>\n</template>\n","export type AutoScrollMode = \"pin-to-bottom\" | \"pin-to-send\" | \"none\";\n\nconst VALID: readonly AutoScrollMode[] = [\n \"pin-to-bottom\",\n \"pin-to-send\",\n \"none\",\n];\n\nexport function normalizeAutoScroll(\n value: AutoScrollMode | boolean | undefined,\n): AutoScrollMode {\n if (value === undefined) return \"pin-to-bottom\";\n if (value === true) return \"pin-to-bottom\";\n if (value === false) return \"none\";\n if ((VALID as readonly string[]).includes(value)) return value;\n return \"pin-to-bottom\";\n}\n","<script setup lang=\"ts\">\nimport {\n computed,\n getCurrentInstance,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useSlots,\n watch,\n} from \"vue\";\nimport type { Message } from \"@ag-ui/core\";\nimport type { Suggestion } from \"@copilotkit/core\";\nimport type { Attachment } from \"@copilotkit/shared\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport { useKeyboardHeight } from \"../../hooks/use-keyboard-height\";\nimport { usePinToSend } from \"../../hooks/use-pin-to-send\";\nimport { IconChevronDown } from \"../icons\";\nimport CopilotChatInput from \"./CopilotChatInput.vue\";\nimport CopilotChatAttachmentQueue from \"./CopilotChatAttachmentQueue.vue\";\nimport CopilotChatMessageView from \"./CopilotChatMessageView.vue\";\nimport CopilotChatSuggestionView from \"./CopilotChatSuggestionView.vue\";\nimport { normalizeAutoScroll } from \"./normalize-auto-scroll\";\nimport type {\n CopilotChatInputMode,\n CopilotChatInterruptSlotProps,\n CopilotChatViewProps,\n ToolsMenuItem,\n} from \"./types\";\n\n// Vertical gap between the scroll-to-bottom button and the input container.\n// Mirrors React `CopilotChatView` `SCROLL_BUTTON_OFFSET`.\nconst SCROLL_BUTTON_OFFSET = 16;\nconst SCROLL_BOTTOM_THRESHOLD = 12;\n\nconst props = withDefaults(defineProps<CopilotChatViewProps>(), {\n messages: () => [],\n autoScroll: true,\n isRunning: false,\n suggestions: () => [],\n suggestionLoadingIndexes: () => [],\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n isConnecting: false,\n hasExplicitThreadId: false,\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n \"message-view\"?: (props: {\n messages: Message[];\n isRunning: boolean;\n }) => unknown;\n \"scroll-view\"?: (props: {\n messages: Message[];\n isRunning: boolean;\n suggestions: Suggestion[];\n loadingIndexes: ReadonlyArray<number>;\n messagePaddingBottom: string;\n showScrollToBottomButton: boolean;\n onSelectSuggestion: (suggestion: Suggestion, index: number) => void;\n onScroll: () => void;\n scrollToBottom: () => void;\n }) => unknown;\n feather?: () => unknown;\n \"scroll-to-bottom-button\"?: (props: { onClick: () => void }) => unknown;\n interrupt?: (props: CopilotChatInterruptSlotProps) => unknown;\n input?: (props: {\n modelValue: string;\n isRunning: boolean;\n inputMode: CopilotChatInputMode;\n inputToolsMenu: (ToolsMenuItem | \"-\")[];\n attachments: Attachment[];\n onUpdateModelValue: (value: string) => void;\n onSubmitMessage: (value: string) => void;\n onStop?: () => void;\n onAddFile: () => void;\n onStartTranscribe: () => void;\n onCancelTranscribe: () => void;\n onFinishTranscribe: () => void;\n onFinishTranscribeWithAudio: (audioBlob: Blob) => void | Promise<void>;\n }) => unknown;\n \"suggestion-view\"?: (props: {\n suggestions: Suggestion[];\n loadingIndexes: ReadonlyArray<number>;\n onSelectSuggestion: (suggestion: Suggestion, index: number) => void;\n }) => unknown;\n \"welcome-screen\"?: (props: {\n suggestions: Suggestion[];\n loadingIndexes: ReadonlyArray<number>;\n attachments: Attachment[];\n modelValue: string;\n isRunning: boolean;\n inputMode: CopilotChatInputMode;\n inputToolsMenu: (ToolsMenuItem | \"-\")[];\n onUpdateModelValue: (value: string) => void;\n onSubmitMessage: (value: string) => void;\n onStop?: () => void;\n onAddFile: () => void;\n onStartTranscribe: () => void;\n onCancelTranscribe: () => void;\n onFinishTranscribe: () => void;\n onFinishTranscribeWithAudio: (audioBlob: Blob) => void | Promise<void>;\n onSelectSuggestion: (suggestion: Suggestion, index: number) => void;\n }) => unknown;\n \"welcome-message\"?: () => unknown;\n [key: string]: ((props: any) => unknown) | undefined;\n}>();\n\nconst emit = defineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [suggestion: Suggestion, index: number];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst config = useCopilotChatConfiguration();\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\nconst instance = getCurrentInstance();\nconst componentSlots = useSlots();\n\nconst scrollContainerRef = ref<HTMLElement | null>(null);\nconst scrollContentRef = ref<HTMLElement | null>(null);\nconst spacerRef = ref<HTMLElement | null>(null);\nconst inputContainerRef = ref<HTMLElement | null>(null);\nconst inputContainerHeight = ref(0);\nconst isAtBottom = ref(true);\nconst isControlledInput = computed(() => props.inputValue !== undefined);\nconst localInputValue = ref(props.inputValue ?? \"\");\n\n// Normalize the `autoScroll` prop into the canonical mode triplet\n// (`pin-to-bottom` | `pin-to-send` | `none`). Boolean back-compat is\n// preserved by `normalizeAutoScroll` (parity with React).\nconst autoScrollMode = computed(() => normalizeAutoScroll(props.autoScroll));\nconst isPinToBottomMode = computed(\n () => autoScrollMode.value === \"pin-to-bottom\",\n);\nconst isPinToSendMode = computed(() => autoScrollMode.value === \"pin-to-send\");\n\n// `usePinToSend` is always wired but bails internally when the spacer ref\n// is null — i.e. unless `pin-to-send` mode is active and the spacer div\n// has been mounted in the template.\nusePinToSend({\n scrollRef: scrollContainerRef,\n contentRef: scrollContentRef,\n spacerRef,\n topOffset: 16,\n});\n\n// Track mobile keyboard state so the input can translate itself above the\n// on-screen keyboard (matches React CopilotChatView behavior).\nconst { isKeyboardOpen, keyboardHeight } = useKeyboardHeight();\nconst effectiveKeyboardHeight = computed(() =>\n isKeyboardOpen.value ? keyboardHeight.value : 0,\n);\n\nconst resolvedInputValue = computed(() =>\n isControlledInput.value ? (props.inputValue ?? \"\") : localInputValue.value,\n);\nconst hasSuggestions = computed(\n () =>\n !props.isConnecting &&\n !props.isRunning &&\n Array.isArray(props.suggestions) &&\n props.suggestions.length > 0,\n);\nconst hasAttachments = computed(\n () => Array.isArray(props.attachments) && props.attachments.length > 0,\n);\nconst vnodeProps = computed(\n () => (instance?.vnode.props ?? {}) as Record<string, unknown>,\n);\nconst forwardedMessageViewSlotNames = computed(() =>\n Object.keys(componentSlots).filter(\n (slotName) =>\n slotName !== \"message-view\" &&\n slotName !== \"scroll-view\" &&\n slotName !== \"feather\" &&\n slotName !== \"scroll-to-bottom-button\" &&\n slotName !== \"input\" &&\n slotName !== \"suggestion-view\" &&\n slotName !== \"welcome-screen\" &&\n slotName !== \"welcome-message\",\n ),\n);\nconst shouldShowWelcomeScreen = computed(\n () =>\n props.messages.length === 0 &&\n props.welcomeScreen !== false &&\n !props.isConnecting &&\n !props.hasExplicitThreadId,\n);\nconst hasAddFileAction = computed(() => hasListener(\"onAddFile\"));\nconst hasStopAction = computed(() => hasListener(\"onStop\"));\nconst hasStartTranscribeAction = computed(() =>\n hasListener(\"onStartTranscribe\"),\n);\nconst hasCancelTranscribeAction = computed(() =>\n hasListener(\"onCancelTranscribe\"),\n);\nconst hasFinishTranscribeAction = computed(() =>\n hasListener(\"onFinishTranscribe\"),\n);\nconst hasFinishTranscribeWithAudioAction = computed(\n () => typeof props.onFinishTranscribeWithAudio === \"function\",\n);\n// Mirrors React: `paddingBottom = inputContainerHeight + (hasSuggestions ? 4 : 32)`.\n// React intentionally does NOT add bonus padding for attachments — the\n// attachment queue lives inside the input overlay, so its height is already\n// captured by the overlay's measured `inputContainerHeight`.\nconst messagePaddingBottom = computed(\n () => `${inputContainerHeight.value + (hasSuggestions.value ? 4 : 32)}px`,\n);\nconst showScrollToBottomButton = computed(\n () => !shouldShowWelcomeScreen.value && !isAtBottom.value,\n);\n\nlet inputResizeObserver: ResizeObserver | null = null;\nlet contentResizeObserver: ResizeObserver | null = null;\n\nfunction attachInputOverlayObserver() {\n if (typeof ResizeObserver === \"undefined\") return;\n\n inputResizeObserver?.disconnect();\n inputResizeObserver = null;\n\n const el = inputContainerRef.value;\n if (!el) return;\n\n inputResizeObserver = new ResizeObserver((entries) => {\n const wasAtBottom = isAtBottom.value;\n const measured = entries[0]?.contentRect?.height;\n if (typeof measured === \"number\") {\n inputContainerHeight.value = measured;\n } else {\n syncInputContainerHeight();\n }\n updateIsAtBottom();\n if (isPinToBottomMode.value && wasAtBottom) {\n scrollToBottom(\"auto\");\n }\n });\n inputResizeObserver.observe(el);\n}\n\nfunction attachScrollContentObserver() {\n if (typeof ResizeObserver === \"undefined\") return;\n\n contentResizeObserver?.disconnect();\n contentResizeObserver = null;\n\n const el = scrollContentRef.value;\n if (!el) return;\n\n contentResizeObserver = new ResizeObserver(() => {\n const wasAtBottom = isAtBottom.value;\n updateIsAtBottom();\n if (isPinToBottomMode.value && wasAtBottom) {\n scrollToBottom(\"auto\");\n }\n });\n contentResizeObserver.observe(el);\n}\n\n// When the welcome screen disappears and the main chat view (with the input\n// overlay) appears, the template-ref elements become non-null. Re-attach\n// observers that were skipped during the initial mount.\nwatch(shouldShowWelcomeScreen, async (show) => {\n if (show) return;\n await nextTick();\n syncInputContainerHeight();\n attachInputOverlayObserver();\n attachScrollContentObserver();\n});\n\nwatch(\n () => props.inputValue,\n (next) => {\n if (isControlledInput.value) {\n localInputValue.value = next ?? \"\";\n }\n },\n);\n\nwatch(\n [() => props.messages, () => props.suggestions, () => props.isRunning],\n async () => {\n const wasAtBottom = isAtBottom.value;\n await nextTick();\n if (!isPinToBottomMode.value || !wasAtBottom) {\n return;\n }\n scrollToBottom(\"auto\");\n if (typeof requestAnimationFrame === \"function\") {\n requestAnimationFrame(() => {\n scrollToBottom(\"auto\");\n });\n }\n },\n { deep: true },\n);\n\nfunction updateIsAtBottom() {\n const element = scrollContainerRef.value;\n if (!element) {\n isAtBottom.value = true;\n return;\n }\n\n const distance =\n element.scrollHeight - element.scrollTop - element.clientHeight;\n isAtBottom.value = distance <= SCROLL_BOTTOM_THRESHOLD;\n}\n\nfunction syncInputContainerHeight() {\n const element = inputContainerRef.value;\n inputContainerHeight.value = element?.offsetHeight ?? 0;\n}\n\nfunction scrollToBottom(behavior: ScrollBehavior = \"smooth\") {\n const element = scrollContainerRef.value;\n if (!element) return;\n\n if (typeof element.scrollTo === \"function\") {\n element.scrollTo({\n top: element.scrollHeight,\n behavior,\n });\n } else {\n element.scrollTop = element.scrollHeight;\n }\n updateIsAtBottom();\n}\n\nfunction handleScroll() {\n updateIsAtBottom();\n}\n\nfunction hasListener(listenerName: string) {\n const listener = vnodeProps.value[listenerName];\n if (Array.isArray(listener)) {\n return listener.length > 0;\n }\n return !!listener;\n}\n\nfunction handleInputValueChange(value: string) {\n if (!isControlledInput.value) {\n localInputValue.value = value;\n }\n emit(\"input-change\", value);\n}\n\nfunction handleSubmitMessage(value: string) {\n emit(\"submit-message\", value);\n}\n\nfunction handleStop() {\n emit(\"stop\");\n}\n\nfunction handleSelectSuggestion(suggestion: Suggestion, index: number) {\n emit(\"select-suggestion\", suggestion, index);\n}\n\nfunction handleAddFile() {\n emit(\"add-file\");\n}\n\nfunction handleDragOver(event: DragEvent) {\n props.onDragOver?.(event);\n}\n\nfunction handleDragLeave(event: DragEvent) {\n props.onDragLeave?.(event);\n}\n\nfunction handleDrop(event: DragEvent) {\n void props.onDrop?.(event);\n}\n\nfunction handleStartTranscribe() {\n emit(\"start-transcribe\");\n}\n\nfunction handleCancelTranscribe() {\n emit(\"cancel-transcribe\");\n}\n\nfunction handleFinishTranscribe() {\n emit(\"finish-transcribe\");\n}\n\nasync function handleFinishTranscribeWithAudio(audioBlob: Blob) {\n await props.onFinishTranscribeWithAudio?.(audioBlob);\n}\n\nconst inputEventProps = computed(() => {\n const listeners: Record<string, unknown> = {\n \"onUpdate:modelValue\": handleInputValueChange,\n onSubmitMessage: handleSubmitMessage,\n };\n\n if (hasStopAction.value) {\n listeners.onStop = handleStop;\n }\n if (hasAddFileAction.value) {\n listeners.onAddFile = handleAddFile;\n }\n if (hasStartTranscribeAction.value) {\n listeners.onStartTranscribe = handleStartTranscribe;\n }\n if (hasCancelTranscribeAction.value) {\n listeners.onCancelTranscribe = handleCancelTranscribe;\n }\n if (hasFinishTranscribeAction.value) {\n listeners.onFinishTranscribe = handleFinishTranscribe;\n }\n if (hasFinishTranscribeWithAudioAction.value) {\n listeners.onFinishTranscribeWithAudio = handleFinishTranscribeWithAudio;\n }\n\n return listeners;\n});\n\nonMounted(async () => {\n await nextTick();\n syncInputContainerHeight();\n updateIsAtBottom();\n if (isPinToBottomMode.value) {\n scrollToBottom(\"auto\");\n if (typeof requestAnimationFrame === \"function\") {\n requestAnimationFrame(() => {\n scrollToBottom(\"auto\");\n });\n }\n }\n\n attachInputOverlayObserver();\n attachScrollContentObserver();\n});\n\nonBeforeUnmount(() => {\n inputResizeObserver?.disconnect();\n contentResizeObserver?.disconnect();\n inputResizeObserver = null;\n contentResizeObserver = null;\n});\n</script>\n\n<template>\n <div\n data-copilotkit\n class=\"cpk:relative cpk:h-full\"\n data-testid=\"copilot-chat-view\"\n v-bind=\"$attrs\"\n @dragover=\"handleDragOver\"\n @dragleave=\"handleDragLeave\"\n @drop=\"handleDrop\"\n >\n <div\n v-if=\"dragOver\"\n class=\"cpk:absolute cpk:inset-0 cpk:z-50 cpk:pointer-events-none cpk:flex cpk:items-center cpk:justify-center cpk:bg-primary/5 cpk:border-2 cpk:border-dashed cpk:border-primary/40 cpk:rounded-lg cpk:m-2\"\n data-testid=\"copilot-chat-drop-overlay\"\n >\n <span class=\"cpk:text-sm cpk:font-medium cpk:text-primary/70\">\n Drop files here\n </span>\n </div>\n <slot\n v-if=\"shouldShowWelcomeScreen\"\n name=\"welcome-screen\"\n :suggestions=\"suggestions\"\n :loading-indexes=\"suggestionLoadingIndexes\"\n :attachments=\"attachments ?? []\"\n :model-value=\"resolvedInputValue\"\n :is-running=\"isRunning\"\n :input-mode=\"inputMode\"\n :input-tools-menu=\"inputToolsMenu\"\n :on-update-model-value=\"handleInputValueChange\"\n :on-submit-message=\"handleSubmitMessage\"\n :on-stop=\"hasStopAction ? handleStop : undefined\"\n :on-add-file=\"handleAddFile\"\n :on-start-transcribe=\"handleStartTranscribe\"\n :on-cancel-transcribe=\"handleCancelTranscribe\"\n :on-finish-transcribe=\"handleFinishTranscribe\"\n :on-finish-transcribe-with-audio=\"handleFinishTranscribeWithAudio\"\n :on-select-suggestion=\"handleSelectSuggestion\"\n >\n <div\n class=\"cpk:flex cpk:h-full cpk:flex-col cpk:items-center cpk:justify-center cpk:px-4\"\n data-testid=\"copilot-chat-view-welcome-screen\"\n >\n <div\n class=\"cpk:w-full cpk:max-w-3xl cpk:flex cpk:flex-col cpk:items-center\"\n >\n <div class=\"cpk:mb-6\">\n <slot name=\"welcome-message\">\n <h1\n class=\"cpk:text-xl cpk:sm:text-2xl cpk:font-medium cpk:text-foreground cpk:text-center\"\n >\n {{ labels.welcomeMessageText }}\n </h1>\n </slot>\n </div>\n\n <div class=\"cpk:w-full\">\n <CopilotChatAttachmentQueue\n v-if=\"hasAttachments\"\n :attachments=\"attachments ?? []\"\n class-name=\"cpk:mb-2\"\n @remove-attachment=\"\n (id: string) => onRemoveAttachment && onRemoveAttachment(id)\n \"\n />\n <slot\n name=\"input\"\n :model-value=\"resolvedInputValue\"\n :is-running=\"isRunning\"\n :input-mode=\"inputMode\"\n :input-tools-menu=\"inputToolsMenu\"\n :attachments=\"attachments ?? []\"\n :on-update-model-value=\"handleInputValueChange\"\n :on-submit-message=\"handleSubmitMessage\"\n :on-stop=\"hasStopAction ? handleStop : undefined\"\n :on-add-file=\"handleAddFile\"\n :on-start-transcribe=\"handleStartTranscribe\"\n :on-cancel-transcribe=\"handleCancelTranscribe\"\n :on-finish-transcribe=\"handleFinishTranscribe\"\n :on-finish-transcribe-with-audio=\"handleFinishTranscribeWithAudio\"\n >\n <CopilotChatInput\n :model-value=\"resolvedInputValue\"\n :is-running=\"isRunning\"\n :mode=\"inputMode\"\n :tools-menu=\"inputToolsMenu\"\n positioning=\"static\"\n :show-disclaimer=\"true\"\n :keyboard-height=\"effectiveKeyboardHeight\"\n v-bind=\"inputEventProps\"\n />\n </slot>\n </div>\n\n <div\n v-if=\"hasSuggestions\"\n class=\"cpk:mt-4 cpk:flex cpk:justify-center\"\n >\n <slot\n name=\"suggestion-view\"\n :suggestions=\"suggestions\"\n :loading-indexes=\"suggestionLoadingIndexes\"\n :on-select-suggestion=\"handleSelectSuggestion\"\n >\n <CopilotChatSuggestionView\n :suggestions=\"suggestions\"\n :loading-indexes=\"suggestionLoadingIndexes\"\n @select-suggestion=\"handleSelectSuggestion\"\n />\n </slot>\n </div>\n </div>\n </div>\n </slot>\n\n <template v-else>\n <slot\n name=\"scroll-view\"\n :messages=\"messages\"\n :is-running=\"isRunning\"\n :suggestions=\"suggestions\"\n :loading-indexes=\"suggestionLoadingIndexes\"\n :message-padding-bottom=\"messagePaddingBottom\"\n :show-scroll-to-bottom-button=\"showScrollToBottomButton\"\n :on-select-suggestion=\"handleSelectSuggestion\"\n :on-scroll=\"handleScroll\"\n :scroll-to-bottom=\"scrollToBottom\"\n >\n <div\n ref=\"scrollContainerRef\"\n data-testid=\"copilot-chat-view-scroll\"\n class=\"cpk:h-full cpk:max-h-full cpk:min-h-0 cpk:overflow-y-scroll cpk:overflow-x-hidden cpk:relative\"\n @scroll=\"handleScroll\"\n >\n <div\n class=\"cpk:px-4 cpk:sm:px-0 cpk:[div[data-sidebar-chat]_&]:px-8 cpk:[div[data-popup-chat]_&]:px-6\"\n >\n <div\n ref=\"scrollContentRef\"\n data-testid=\"copilot-scroll-content\"\n :style=\"{ paddingBottom: messagePaddingBottom }\"\n >\n <div class=\"cpk:max-w-3xl cpk:mx-auto\">\n <slot\n name=\"message-view\"\n :messages=\"messages\"\n :is-running=\"isRunning\"\n >\n <CopilotChatMessageView\n :messages=\"messages\"\n :is-running=\"isRunning\"\n >\n <template\n v-for=\"slotName in forwardedMessageViewSlotNames\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps\" />\n </template>\n </CopilotChatMessageView>\n </slot>\n <div\n v-if=\"hasSuggestions\"\n class=\"cpk:mt-4 cpk:pl-0 cpk:pr-4 cpk:sm:px-0\"\n >\n <slot\n name=\"suggestion-view\"\n :suggestions=\"suggestions\"\n :loading-indexes=\"suggestionLoadingIndexes\"\n :on-select-suggestion=\"handleSelectSuggestion\"\n >\n <CopilotChatSuggestionView\n class=\"cpk:mb-3 cpk:lg:ml-4 cpk:lg:mr-4 cpk:ml-0 cpk:mr-0\"\n :suggestions=\"suggestions\"\n :loading-indexes=\"suggestionLoadingIndexes\"\n @select-suggestion=\"handleSelectSuggestion\"\n />\n </slot>\n </div>\n </div>\n </div>\n <!--\n `pin-to-send` spacer. Sized to anchor the latest user message\n near the top of the viewport while the assistant streams a\n response. `usePinToSend` reads this ref and only activates\n when the spacer is present in the tree.\n -->\n <div\n v-if=\"isPinToSendMode\"\n ref=\"spacerRef\"\n data-pin-to-send-spacer\n aria-hidden=\"true\"\n :style=\"{ height: '0px', flex: '0 0 auto' }\"\n />\n </div>\n </div>\n </slot>\n\n <slot name=\"feather\">\n <!--\n Default renders an empty div — no visual, but the element is\n still in the tree so a slot override / consumer styling can\n still apply (mirrors React `CopilotChatView.Feather`).\n -->\n <div data-testid=\"copilot-chat-view-feather\" />\n </slot>\n\n <div\n v-if=\"showScrollToBottomButton\"\n class=\"cpk:absolute cpk:inset-x-0 cpk:flex cpk:justify-center cpk:z-30 cpk:pointer-events-none\"\n :style=\"{ bottom: `${inputContainerHeight + SCROLL_BUTTON_OFFSET}px` }\"\n >\n <slot name=\"scroll-to-bottom-button\" :on-click=\"() => scrollToBottom()\">\n <button\n type=\"button\"\n data-testid=\"copilot-chat-view-scroll-to-bottom\"\n class=\"cpk:rounded-full cpk:w-10 cpk:h-10 cpk:p-0 cpk:pointer-events-auto cpk:bg-white cpk:dark:bg-gray-900 cpk:shadow-lg cpk:border cpk:border-gray-200 cpk:dark:border-gray-700 cpk:hover:bg-gray-50 cpk:dark:hover:bg-gray-800 cpk:flex cpk:items-center cpk:justify-center cpk:cursor-pointer\"\n @click=\"scrollToBottom()\"\n >\n <IconChevronDown\n class=\"cpk:w-4 cpk:h-4 cpk:text-gray-600 cpk:dark:text-white\"\n />\n </button>\n </slot>\n </div>\n\n <!--\n Input overlay. Mirrors React `CopilotChatView` `copilot-input-overlay`:\n absolutely positioned at the bottom, holds both the attachment queue\n and the chat input. The input itself uses `positioning=\"static\"` so\n the overlay wrapper alone owns the absolute positioning, and the\n attachment queue is layered visually above the input via DOM order.\n The welcome-screen path intentionally does NOT use this overlay.\n -->\n <div\n ref=\"inputContainerRef\"\n class=\"cpk:absolute cpk:bottom-0 cpk:left-0 cpk:right-0 cpk:z-20 cpk:pointer-events-none\"\n data-testid=\"copilot-input-overlay\"\n >\n <div\n v-if=\"hasAttachments\"\n class=\"cpk:max-w-3xl cpk:mx-auto cpk:w-full cpk:pointer-events-auto\"\n >\n <CopilotChatAttachmentQueue\n :attachments=\"attachments ?? []\"\n class-name=\"cpk:px-4\"\n @remove-attachment=\"\n (id: string) => onRemoveAttachment && onRemoveAttachment(id)\n \"\n />\n </div>\n <slot\n name=\"input\"\n :model-value=\"resolvedInputValue\"\n :is-running=\"isRunning\"\n :input-mode=\"inputMode\"\n :input-tools-menu=\"inputToolsMenu\"\n :attachments=\"attachments ?? []\"\n :on-update-model-value=\"handleInputValueChange\"\n :on-submit-message=\"handleSubmitMessage\"\n :on-stop=\"hasStopAction ? handleStop : undefined\"\n :on-add-file=\"handleAddFile\"\n :on-start-transcribe=\"handleStartTranscribe\"\n :on-cancel-transcribe=\"handleCancelTranscribe\"\n :on-finish-transcribe=\"handleFinishTranscribe\"\n :on-finish-transcribe-with-audio=\"handleFinishTranscribeWithAudio\"\n >\n <CopilotChatInput\n :model-value=\"resolvedInputValue\"\n :is-running=\"isRunning\"\n :mode=\"inputMode\"\n :tools-menu=\"inputToolsMenu\"\n positioning=\"static\"\n :show-disclaimer=\"true\"\n :keyboard-height=\"effectiveKeyboardHeight\"\n :bottom-anchored=\"true\"\n v-bind=\"inputEventProps\"\n />\n </slot>\n </div>\n </template>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport {\n AGUIConnectNotImplementedError,\n AbstractAgent,\n HttpAgent,\n} from \"@ag-ui/client\";\nimport {\n DEFAULT_AGENT_ID,\n randomUUID,\n TranscriptionErrorCode,\n} from \"@copilotkit/shared\";\nimport {\n computed,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n shallowRef,\n useAttrs,\n useSlots,\n watch,\n} from \"vue\";\nimport type { Suggestion } from \"@copilotkit/core\";\nimport CopilotChatConfigurationProvider from \"../../providers/CopilotChatConfigurationProvider.vue\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { useCopilotKit } from \"../../providers/useCopilotKit\";\nimport { useLicenseContext } from \"../../providers/useLicenseContext\";\nimport InlineFeatureWarning from \"../InlineFeatureWarning.vue\";\nimport { useAgent } from \"../../hooks/use-agent\";\nimport { useSuggestions } from \"../../hooks/use-suggestions\";\nimport { useAttachments } from \"../../hooks/use-attachments\";\nimport { useShallowStableRef } from \"../../lib/shallow-stable\";\nimport {\n transcribeAudio,\n TranscriptionError,\n} from \"../../lib/transcription-client\";\nimport CopilotChatView from \"./CopilotChatView.vue\";\nimport {\n LastUserMessageKey,\n type LastUserMessageState,\n} from \"./last-user-message-context\";\nimport type { Message } from \"@ag-ui/core\";\nimport type { InputContent } from \"@copilotkit/shared\";\nimport type {\n CopilotChatInputSlotProps,\n CopilotChatProps,\n CopilotChatInterruptSlotProps,\n CopilotChatSuggestionViewSlotProps,\n CopilotChatViewOverrideSlotProps,\n CopilotChatWelcomeScreenSlotProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(defineProps<CopilotChatProps>(), {\n autoScroll: true,\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n \"chat-view\"?: (props: CopilotChatViewOverrideSlotProps) => unknown;\n \"message-view\"?: (props: {\n messages: Message[];\n isRunning: boolean;\n }) => unknown;\n interrupt?: (props: CopilotChatInterruptSlotProps) => unknown;\n input?: (props: CopilotChatInputSlotProps) => unknown;\n \"suggestion-view\"?: (props: CopilotChatSuggestionViewSlotProps) => unknown;\n \"welcome-screen\"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;\n \"welcome-message\"?: () => unknown;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: ((props: any) => unknown) | undefined;\n}>();\n\nconst emit = defineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [suggestion: Suggestion, index: number];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst attrs = useAttrs();\nconst componentSlots = useSlots();\nconst existingConfig = useCopilotChatConfiguration();\nconst { copilotkit } = useCopilotKit();\nconst forwardedChatViewSlotNames = computed(() =>\n Object.keys(componentSlots).filter((slotName) => slotName !== \"chat-view\"),\n);\n\nconst generatedThreadId = ref(randomUUID());\nconst transcribeMode = ref<\"input\" | \"transcribe\" | \"processing\">(\"input\");\nconst inputValue = ref(props.inputValue ?? \"\");\nconst transcriptionError = ref<string | null>(null);\nconst isTranscribing = ref(false);\nconst isMounted = ref(false);\nconst isUnmounting = ref(false);\n\ntype ActiveConnectCycle = {\n core: object;\n agent: AbstractAgent;\n threadId: string;\n abortController: AbortController;\n detached: boolean;\n};\n\nconst activeConnectCycle = shallowRef<ActiveConnectCycle | null>(null);\n\nconst resolvedAgentId = computed(\n () => props.agentId ?? existingConfig.value?.agentId ?? DEFAULT_AGENT_ID,\n);\n// \"Provided\" — supplied by either the caller's prop or a wrapping\n// CopilotChatConfigurationProvider. Distinct from `resolvedThreadId`, which\n// falls back to a locally minted UUID when neither source is set. We only\n// gate `/connect` on a provided id; the local UUID has never been seen by\n// the backend and would always 404.\nconst providedThreadId = computed(\n () => props.threadId ?? existingConfig.value?.threadId,\n);\nconst resolvedThreadId = computed(\n () => providedThreadId.value ?? generatedThreadId.value,\n);\n// \"Explicit\" means the caller actually picked this thread — via the\n// `threadId` prop on CopilotChat or a wrapping provider that flagged its\n// threadId as caller-chosen. An auto-minted UUID leaking down through a\n// CopilotChatConfigurationProvider does NOT count.\nconst hasExplicitThreadId = computed(\n () => !!props.threadId || !!existingConfig.value?.hasExplicitThreadId,\n);\nconst lastConnectedThreadId = ref<string | null>(null);\nconst isConnecting = computed(\n () =>\n hasExplicitThreadId.value &&\n lastConnectedThreadId.value !== resolvedThreadId.value,\n);\nconst stableLabels = useShallowStableRef(computed(() => props.labels));\nconst resolvedLabels = computed(() => stableLabels.value);\n\nconst { agent } = useAgent({\n agentId: resolvedAgentId,\n threadId: resolvedThreadId,\n throttleMs: computed(() => props.throttleMs),\n});\nconst { suggestions: autoSuggestions } = useSuggestions({\n agentId: resolvedAgentId,\n});\n\nconst license = useLicenseContext();\nconst isChatLicensed = computed(() => license.value.checkFeature(\"chat\"));\n\nwatch(\n isChatLicensed,\n (licensed) => {\n if (!licensed) {\n console.warn(\n '[CopilotKit] Warning: \"chat\" feature is not licensed. Visit copilotkit.ai/pricing',\n );\n }\n },\n { immediate: true },\n);\n\nconst isTranscriptionEnabled = computed(\n () => copilotkit.value.audioFileTranscriptionEnabled,\n);\nconst isMediaRecorderSupported = computed(\n () => typeof window !== \"undefined\" && typeof MediaRecorder !== \"undefined\",\n);\nconst showTranscription = computed(\n () => isTranscriptionEnabled.value && isMediaRecorderSupported.value,\n);\nconst {\n attachments,\n enabled: attachmentsEnabled,\n dragOver,\n fileInputRef,\n containerRef: attachmentContainerRef,\n handleFileUpload,\n handleDragOver,\n handleDragLeave,\n handleDrop,\n removeAttachment,\n consumeAttachments,\n} = useAttachments({\n config: computed(() => props.attachments),\n});\nconst effectiveMode = computed<\"input\" | \"transcribe\" | \"processing\">(() =>\n isTranscribing.value ? \"processing\" : transcribeMode.value,\n);\nconst runLifecycleTick = ref(0);\nconst messages = computed(() => [...(agent.value?.messages ?? [])]);\nconst isRunning = computed(() => {\n void runLifecycleTick.value;\n return agent.value?.isRunning ?? false;\n});\nconst shouldAllowStop = computed(\n () => isRunning.value && messages.value.length > 0,\n);\n\n// Track the latest user message id so descendants (notably `usePinToSend`\n// inside `CopilotChatView`) can anchor to the most recent user turn.\n// Mirrors React `CopilotChat.tsx` `lastUserMessageId` + `sendNonce` state.\nconst lastUserMessageId = computed<string | null>(() => {\n for (let i = messages.value.length - 1; i >= 0; i--) {\n const message = messages.value[i];\n if (message?.role === \"user\") return message.id;\n }\n return null;\n});\nconst sendNonce = ref(0);\n// Seed with the current value so restoring a thread with existing messages\n// does not count as a new send. Only later id transitions bump.\nlet prevLastUserMessageId: string | null = lastUserMessageId.value;\nwatch(lastUserMessageId, (next) => {\n if (next && next !== prevLastUserMessageId) {\n sendNonce.value += 1;\n prevLastUserMessageId = next;\n }\n});\nconst lastUserMessageState = computed<LastUserMessageState>(() => ({\n id: lastUserMessageId.value,\n sendNonce: sendNonce.value,\n}));\nprovide(LastUserMessageKey, lastUserMessageState);\n\nwatch(\n () => agent.value,\n (currentAgent, _previous, onCleanup) => {\n if (!currentAgent) return;\n const sub = currentAgent.subscribe({\n onRunStartedEvent: () => {\n runLifecycleTick.value += 1;\n },\n onRunFinishedEvent: () => {\n runLifecycleTick.value += 1;\n },\n onRunErrorEvent: () => {\n runLifecycleTick.value += 1;\n },\n });\n onCleanup(() => sub.unsubscribe());\n },\n { immediate: true },\n);\n\nwatch(\n () => props.inputValue,\n (next) => {\n if (next !== undefined) {\n inputValue.value = next;\n }\n },\n);\n\nwatch(\n [() => props.threadId, () => existingConfig.value?.threadId],\n ([threadId, inheritedThreadId], previousValues) => {\n if (threadId || inheritedThreadId) {\n return;\n }\n\n if (previousValues && (previousValues[0] || previousValues[1])) {\n generatedThreadId.value = randomUUID();\n }\n },\n);\n\nwatch(\n [() => copilotkit.value, resolvedAgentId, () => props.onError],\n ([core, agentId, onError], _old, onCleanup) => {\n if (!onError) {\n return;\n }\n\n const subscription = core.subscribe({\n onError: (event) => {\n if (event.context?.agentId === agentId || !event.context?.agentId) {\n void onError({\n error: event.error,\n code: event.code,\n context: event.context,\n });\n }\n },\n });\n\n onCleanup(() => subscription.unsubscribe());\n },\n { immediate: true },\n);\n\nwatch(\n [\n isMounted,\n () => copilotkit.value,\n () => agent.value,\n resolvedThreadId,\n hasExplicitThreadId,\n ],\n ([mounted, core, currentAgent, threadId, isExplicit], _old, onCleanup) => {\n if (!mounted) {\n return;\n }\n if (typeof window === \"undefined\") {\n return;\n }\n if (!currentAgent) {\n return;\n }\n // When the caller hasn't picked a specific thread, resolvedThreadId is\n // a UUID minted locally. The backend has never seen it, so /connect\n // would always 404 — skip the call. A real thread is only created\n // once the user runs the agent for the first time.\n if (!isExplicit) {\n return;\n }\n\n const abstractAgentPrototype = AbstractAgent.prototype as unknown as {\n connect?: unknown;\n connectAgent?: unknown;\n };\n const inspectableAgent = currentAgent as unknown as {\n connect?: unknown;\n connectAgent?: unknown;\n };\n const hasCustomConnect =\n inspectableAgent.connect !== abstractAgentPrototype.connect;\n const hasCustomConnectAgent =\n inspectableAgent.connectAgent !== abstractAgentPrototype.connectAgent;\n if (!hasCustomConnect && !hasCustomConnectAgent) {\n // No custom connect to wait for — mark as connected so the welcome\n // suppression / suggestion gating release immediately.\n lastConnectedThreadId.value = threadId;\n return;\n }\n\n const existingCycle = activeConnectCycle.value;\n const hasSameDeps =\n existingCycle &&\n existingCycle.core === (core as object) &&\n existingCycle.agent === currentAgent &&\n existingCycle.threadId === threadId;\n\n let cycle: ActiveConnectCycle;\n if (hasSameDeps && existingCycle) {\n cycle = existingCycle;\n } else {\n const connectAbortController = new AbortController();\n if (currentAgent instanceof HttpAgent) {\n currentAgent.abortController = connectAbortController;\n }\n\n cycle = {\n core: core as object,\n agent: currentAgent,\n threadId,\n abortController: connectAbortController,\n detached: false,\n };\n activeConnectCycle.value = cycle;\n\n void core\n .connectAgent({ agent: currentAgent })\n .catch((error: unknown) => {\n if (cycle.detached) {\n return;\n }\n if (error instanceof AGUIConnectNotImplementedError) {\n return;\n }\n console.error(\"CopilotChat: connectAgent failed\", error);\n })\n .finally(() => {\n // Whether the connect succeeded or failed, we're no longer in\n // the transitional \"connecting\" state for this thread — release\n // the welcome / suggestion gating so the view can settle.\n //\n // Defer one animation frame so any trailing reactive commits\n // from the bootstrap replay (final assistant message content)\n // paint before isConnecting flips off. Without this, suggestions\n // can briefly render against an incompletely-laid-out message\n // tree and visibly snap once the last text chunk lands.\n if (cycle.detached) {\n return;\n }\n const raf =\n typeof requestAnimationFrame === \"function\"\n ? requestAnimationFrame\n : (cb: () => void) => setTimeout(cb, 16);\n raf(() => {\n if (cycle.detached) return;\n lastConnectedThreadId.value = cycle.threadId;\n });\n });\n }\n\n onCleanup(() => {\n const activeCycle = activeConnectCycle.value;\n if (!activeCycle || activeCycle !== cycle) {\n return;\n }\n\n const shouldDetach =\n isUnmounting.value ||\n copilotkit.value !== activeCycle.core ||\n agent.value !== activeCycle.agent ||\n resolvedThreadId.value !== activeCycle.threadId;\n if (!shouldDetach) {\n return;\n }\n\n activeCycle.detached = true;\n activeCycle.abortController.abort();\n void activeCycle.agent.detachActiveRun?.();\n activeConnectCycle.value = null;\n });\n },\n { immediate: true },\n);\n\nonBeforeUnmount(() => {\n isUnmounting.value = true;\n});\n\nonMounted(() => {\n isMounted.value = true;\n});\n\nwatch(transcriptionError, (next, _old, onCleanup) => {\n if (!next) {\n return;\n }\n const timer = setTimeout(() => {\n transcriptionError.value = null;\n }, 5000);\n onCleanup(() => clearTimeout(timer));\n});\n\nasync function runCurrentAgent() {\n const currentAgent = agent.value;\n if (!currentAgent) {\n return;\n }\n\n try {\n const activeCycle = activeConnectCycle.value;\n if (\n activeCycle &&\n activeCycle.agent === currentAgent &&\n activeCycle.threadId === resolvedThreadId.value\n ) {\n activeCycle.detached = true;\n activeCycle.abortController.abort();\n activeConnectCycle.value = null;\n await activeCycle.agent.detachActiveRun?.();\n }\n await copilotkit.value.runAgent({ agent: currentAgent });\n } catch (error) {\n console.error(\"CopilotChat: runAgent failed\", error);\n }\n}\n\nasync function handleSubmitMessage(value: string) {\n const hasUploading = attachments.value.some(\n (attachment) => attachment.status === \"uploading\",\n );\n if (hasUploading) {\n console.error(\"[CopilotKit] Cannot send while attachments are uploading\");\n return;\n }\n\n emit(\"submit-message\", value);\n\n if (!agent.value) {\n console.error(\"[CopilotKit] Cannot send message: no agent available\");\n return;\n }\n\n const readyAttachments = consumeAttachments();\n if (readyAttachments.length > 0) {\n const contentParts: InputContent[] = [];\n if (value.trim()) {\n contentParts.push({ type: \"text\", text: value });\n }\n for (const attachment of readyAttachments) {\n contentParts.push({\n type: attachment.type,\n source: attachment.source,\n metadata: {\n ...(attachment.filename ? { filename: attachment.filename } : {}),\n ...attachment.metadata,\n },\n } as InputContent);\n }\n agent.value.addMessage({\n id: randomUUID(),\n role: \"user\",\n content: contentParts,\n });\n } else {\n agent.value.addMessage({\n id: randomUUID(),\n role: \"user\",\n content: value,\n });\n }\n\n inputValue.value = \"\";\n await runCurrentAgent();\n}\n\nasync function handleSelectSuggestion(suggestion: Suggestion, index: number) {\n emit(\"select-suggestion\", suggestion, index);\n agent.value?.addMessage({\n id: randomUUID(),\n role: \"user\",\n content: suggestion.message,\n });\n await runCurrentAgent();\n}\n\nfunction stopCurrentRun() {\n const currentAgent = agent.value;\n if (!currentAgent) {\n return;\n }\n\n try {\n copilotkit.value.stopAgent({ agent: currentAgent });\n } catch (error) {\n console.error(\"CopilotChat: stopAgent failed\", error);\n try {\n currentAgent.abortRun();\n } catch (abortError) {\n console.error(\"CopilotChat: abortRun fallback failed\", abortError);\n }\n }\n}\n\nfunction handleStop() {\n emit(\"stop\");\n if (shouldAllowStop.value) {\n stopCurrentRun();\n }\n}\n\nfunction handleInputChange(value: string) {\n inputValue.value = value;\n emit(\"input-change\", value);\n}\n\nfunction handleAddFile() {\n emit(\"add-file\");\n if (!attachmentsEnabled.value) {\n return;\n }\n setTimeout(() => {\n fileInputRef.value?.click();\n }, 100);\n}\n\nfunction handleStartTranscribe() {\n transcriptionError.value = null;\n transcribeMode.value = \"transcribe\";\n emit(\"start-transcribe\");\n}\n\nfunction handleCancelTranscribe() {\n transcriptionError.value = null;\n transcribeMode.value = \"input\";\n emit(\"cancel-transcribe\");\n}\n\nfunction handleFinishTranscribe() {\n transcribeMode.value = \"input\";\n emit(\"finish-transcribe\");\n}\n\nasync function handleFinishTranscribeWithAudio(audioBlob: Blob) {\n if (props.onFinishTranscribeWithAudio) {\n await props.onFinishTranscribeWithAudio(audioBlob);\n return;\n }\n\n isTranscribing.value = true;\n try {\n transcriptionError.value = null;\n const result = await transcribeAudio(copilotkit.value, audioBlob);\n const trimmedPrevious = inputValue.value.trim();\n inputValue.value = trimmedPrevious\n ? `${trimmedPrevious} ${result.text}`\n : result.text;\n } catch (error) {\n console.error(\"CopilotChat: Transcription failed\", error);\n if (error instanceof TranscriptionError) {\n const { code, retryable, message } = error.info;\n switch (code) {\n case TranscriptionErrorCode.RATE_LIMITED:\n transcriptionError.value = \"Too many requests. Please wait a moment.\";\n break;\n case TranscriptionErrorCode.AUTH_FAILED:\n transcriptionError.value =\n \"Authentication error. Please check your configuration.\";\n break;\n case TranscriptionErrorCode.AUDIO_TOO_LONG:\n transcriptionError.value =\n \"Recording is too long. Please try a shorter recording.\";\n break;\n case TranscriptionErrorCode.AUDIO_TOO_SHORT:\n transcriptionError.value =\n \"Recording is too short. Please try again.\";\n break;\n case TranscriptionErrorCode.INVALID_AUDIO_FORMAT:\n transcriptionError.value = \"Audio format not supported.\";\n break;\n case TranscriptionErrorCode.SERVICE_NOT_CONFIGURED:\n transcriptionError.value = \"Transcription service is not available.\";\n break;\n case TranscriptionErrorCode.NETWORK_ERROR:\n transcriptionError.value =\n \"Network error. Please check your connection.\";\n break;\n default:\n transcriptionError.value = retryable\n ? \"Transcription failed. Please try again.\"\n : message;\n }\n } else {\n transcriptionError.value = \"Transcription failed. Please try again.\";\n }\n } finally {\n isTranscribing.value = false;\n }\n}\n\nconst chatViewSlotProps = computed<CopilotChatViewOverrideSlotProps>(() => ({\n messages: messages.value,\n autoScroll: props.autoScroll,\n isRunning: isRunning.value,\n suggestions: autoSuggestions.value,\n suggestionLoadingIndexes: [],\n welcomeScreen: props.welcomeScreen,\n attachments: attachments.value,\n dragOver: dragOver.value,\n inputValue: inputValue.value,\n inputMode: effectiveMode.value,\n inputToolsMenu: props.inputToolsMenu,\n isConnecting: isConnecting.value,\n hasExplicitThreadId: hasExplicitThreadId.value,\n onSubmitMessage: handleSubmitMessage,\n onStop: shouldAllowStop.value ? handleStop : undefined,\n onInputChange: handleInputChange,\n onSelectSuggestion: handleSelectSuggestion,\n onRemoveAttachment: removeAttachment,\n onAddFile: attachmentsEnabled.value ? handleAddFile : undefined,\n onDragOver: attachmentsEnabled.value ? handleDragOver : undefined,\n onDragLeave: attachmentsEnabled.value ? handleDragLeave : undefined,\n onDrop: attachmentsEnabled.value ? handleDrop : undefined,\n onStartTranscribe: showTranscription.value\n ? handleStartTranscribe\n : undefined,\n onCancelTranscribe: showTranscription.value\n ? handleCancelTranscribe\n : undefined,\n onFinishTranscribe: showTranscription.value\n ? handleFinishTranscribe\n : undefined,\n onFinishTranscribeWithAudio: showTranscription.value\n ? handleFinishTranscribeWithAudio\n : undefined,\n}));\n\nconst defaultChatViewBindings = computed(() => {\n const listeners: Record<string, unknown> = {\n ...attrs,\n onSubmitMessage: handleSubmitMessage,\n onInputChange: handleInputChange,\n onSelectSuggestion: handleSelectSuggestion,\n };\n\n if (shouldAllowStop.value) {\n listeners.onStop = handleStop;\n }\n if (attachmentsEnabled.value) {\n listeners.onAddFile = handleAddFile;\n listeners.attachments = attachments.value;\n listeners.onRemoveAttachment = removeAttachment;\n listeners.dragOver = dragOver.value;\n listeners.onDragOver = handleDragOver;\n listeners.onDragLeave = handleDragLeave;\n listeners.onDrop = handleDrop;\n }\n if (showTranscription.value) {\n listeners.onStartTranscribe = handleStartTranscribe;\n listeners.onCancelTranscribe = handleCancelTranscribe;\n listeners.onFinishTranscribe = handleFinishTranscribe;\n }\n\n return listeners;\n});\n</script>\n\n<template>\n <CopilotChatConfigurationProvider\n :agent-id=\"resolvedAgentId\"\n :thread-id=\"resolvedThreadId\"\n :has-explicit-thread-id=\"hasExplicitThreadId\"\n :labels=\"resolvedLabels\"\n >\n <div ref=\"attachmentContainerRef\" style=\"display: contents\">\n <input\n v-if=\"attachmentsEnabled\"\n ref=\"fileInputRef\"\n type=\"file\"\n multiple\n :accept=\"props.attachments?.accept ?? '*/*'\"\n style=\"display: none\"\n @change=\"(event) => void handleFileUpload(event)\"\n />\n <InlineFeatureWarning v-if=\"!isChatLicensed\" feature-name=\"Chat\" />\n <div\n v-if=\"transcriptionError\"\n style=\"\n position: absolute;\n bottom: 100px;\n left: 50%;\n transform: translateX(-50%);\n background-color: #ef4444;\n color: white;\n padding: 8px 16px;\n border-radius: 8px;\n font-size: 14px;\n z-index: 50;\n \"\n >\n {{ transcriptionError }}\n </div>\n\n <slot name=\"chat-view\" v-bind=\"chatViewSlotProps\">\n <CopilotChatView\n v-bind=\"defaultChatViewBindings\"\n :messages=\"chatViewSlotProps.messages\"\n :auto-scroll=\"chatViewSlotProps.autoScroll\"\n :is-running=\"chatViewSlotProps.isRunning\"\n :suggestions=\"chatViewSlotProps.suggestions\"\n :suggestion-loading-indexes=\"\n chatViewSlotProps.suggestionLoadingIndexes\n \"\n :welcome-screen=\"chatViewSlotProps.welcomeScreen\"\n :input-value=\"chatViewSlotProps.inputValue\"\n :input-mode=\"chatViewSlotProps.inputMode\"\n :input-tools-menu=\"chatViewSlotProps.inputToolsMenu\"\n :is-connecting=\"chatViewSlotProps.isConnecting\"\n :has-explicit-thread-id=\"chatViewSlotProps.hasExplicitThreadId\"\n :on-finish-transcribe-with-audio=\"\n chatViewSlotProps.onFinishTranscribeWithAudio\n \"\n >\n <template\n v-for=\"slotName in forwardedChatViewSlotNames\"\n :key=\"slotName\"\n #[slotName]=\"slotProps\"\n >\n <slot :name=\"slotName\" v-bind=\"slotProps\" />\n </template>\n </CopilotChatView>\n </slot>\n </div>\n </CopilotChatConfigurationProvider>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, ref } from \"vue\";\nimport { getDocumentIcon, getSourceUrl } from \"@copilotkit/shared\";\nimport type { CopilotChatAttachmentRendererProps } from \"./types\";\n\nconst props = withDefaults(defineProps<CopilotChatAttachmentRendererProps>(), {\n filename: undefined,\n className: \"\",\n});\n\nconst imageLoadFailed = ref(false);\nconst sourceUrl = computed(() => getSourceUrl(props.source));\nconst documentLabel = computed(\n () => props.filename || props.source.mimeType || \"Unknown type\",\n);\n</script>\n\n<template>\n <img\n v-if=\"props.type === 'image' && !imageLoadFailed\"\n :src=\"sourceUrl\"\n alt=\"Image attachment\"\n class=\"cpk:max-w-full cpk:h-auto cpk:rounded-lg\"\n :class=\"props.className\"\n data-testid=\"copilot-chat-attachment-renderer-image\"\n @error=\"imageLoadFailed = true\"\n />\n <div\n v-else-if=\"props.type === 'image'\"\n class=\"cpk:flex cpk:flex-col cpk:items-center cpk:justify-center cpk:rounded-lg cpk:bg-muted cpk:p-4 cpk:text-sm cpk:text-muted-foreground\"\n :class=\"props.className\"\n data-testid=\"copilot-chat-attachment-renderer-image-fallback\"\n >\n <span>Failed to load image</span>\n </div>\n\n <div\n v-else-if=\"props.type === 'audio'\"\n class=\"cpk:flex cpk:flex-col cpk:gap-1\"\n :class=\"props.className\"\n data-testid=\"copilot-chat-attachment-renderer-audio\"\n >\n <audio\n :src=\"sourceUrl\"\n controls\n preload=\"metadata\"\n class=\"cpk:max-w-[300px] cpk:w-full cpk:h-10\"\n />\n <span\n v-if=\"props.filename\"\n class=\"cpk:text-xs cpk:text-muted-foreground cpk:truncate cpk:max-w-[300px]\"\n data-testid=\"copilot-chat-attachment-renderer-audio-filename\"\n >\n {{ props.filename }}\n </span>\n </div>\n\n <video\n v-else-if=\"props.type === 'video'\"\n :src=\"sourceUrl\"\n controls\n preload=\"metadata\"\n class=\"cpk:max-w-[400px] cpk:w-full cpk:rounded-lg\"\n :class=\"props.className\"\n data-testid=\"copilot-chat-attachment-renderer-video\"\n />\n\n <div\n v-else\n class=\"cpk:inline-flex cpk:items-center cpk:gap-2 cpk:px-3 cpk:py-2 cpk:border cpk:border-border cpk:rounded-lg cpk:bg-muted\"\n :class=\"props.className\"\n data-testid=\"copilot-chat-attachment-renderer-document\"\n >\n <span\n class=\"cpk:text-xs cpk:font-bold cpk:uppercase\"\n data-testid=\"copilot-chat-attachment-renderer-document-icon\"\n >\n {{ getDocumentIcon(props.source.mimeType ?? \"\") }}\n </span>\n <span\n class=\"cpk:text-sm cpk:text-muted-foreground cpk:truncate\"\n data-testid=\"copilot-chat-attachment-renderer-document-label\"\n >\n {{ documentLabel }}\n </span>\n </div>\n</template>\n","import { defineComponent, h } from \"vue\";\nimport { IconX } from \"../icons\";\n\nexport default defineComponent({\n name: \"CopilotChatToggleButtonCloseIcon\",\n inheritAttrs: false,\n setup(_, { attrs }) {\n return () => {\n const { class: className, ...rest } = attrs as Record<string, unknown>;\n return h(IconX, {\n ...rest,\n class: [\"cpk:h-6 cpk:w-6\", className],\n strokeWidth: 1.75,\n });\n };\n },\n});\n","import { defineComponent, h } from \"vue\";\nimport { IconMessageCircle } from \"../icons\";\n\nexport default defineComponent({\n name: \"CopilotChatToggleButtonOpenIcon\",\n inheritAttrs: false,\n setup(_, { attrs }) {\n return () => {\n const { class: className, ...rest } = attrs as Record<string, unknown>;\n return h(IconMessageCircle, {\n ...rest,\n class: [\"cpk:h-6 cpk:w-6\", className],\n strokeWidth: 1.75,\n fill: \"currentColor\",\n });\n };\n },\n});\n","<script setup lang=\"ts\">\nimport { computed, ref, useAttrs } from \"vue\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport CopilotChatToggleButtonCloseIcon from \"./CopilotChatToggleButtonCloseIcon\";\nimport CopilotChatToggleButtonOpenIcon from \"./CopilotChatToggleButtonOpenIcon\";\nimport type {\n CopilotChatToggleButtonIconSlotProps,\n CopilotChatToggleButtonProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(defineProps<CopilotChatToggleButtonProps>(), {\n disabled: false,\n type: \"button\",\n});\n\ndefineSlots<{\n \"open-icon\"?: (props: CopilotChatToggleButtonIconSlotProps) => unknown;\n \"close-icon\"?: (props: CopilotChatToggleButtonIconSlotProps) => unknown;\n}>();\n\nconst attrs = useAttrs();\nconst config = useCopilotChatConfiguration();\nconst fallbackOpen = ref(false);\n\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\nconst isOpen = computed(() => config.value?.isModalOpen ?? fallbackOpen.value);\nconst ariaLabel = computed(() =>\n isOpen.value\n ? labels.value.chatToggleCloseLabel\n : labels.value.chatToggleOpenLabel,\n);\nconst buttonClass = computed(() => [\n \"cpk:fixed cpk:bottom-6 cpk:right-6 cpk:z-[1100] cpk:flex cpk:h-14 cpk:w-14 cpk:items-center cpk:justify-center\",\n \"cpk:rounded-full cpk:border cpk:border-primary cpk:bg-primary cpk:text-primary-foreground\",\n \"cpk:shadow-sm cpk:transition-all cpk:duration-200 cpk:ease-out\",\n \"cpk:hover:scale-[1.04] cpk:hover:shadow-md cpk:cursor-pointer cpk:active:scale-[0.96]\",\n \"cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-primary/50 cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background\",\n \"cpk:disabled:pointer-events-none cpk:disabled:opacity-60\",\n attrs.class,\n]);\nconst buttonAttrs = computed(() => {\n const { class: _className, onClick: _onClick, ...rest } = attrs;\n return rest;\n});\n\nconst iconClass = \"cpk:h-6 cpk:w-6\";\nconst iconTransitionStyle = Object.freeze({\n transition:\n \"opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)\",\n});\nconst iconWrapperBase =\n \"cpk:pointer-events-none cpk:absolute cpk:inset-0 cpk:flex cpk:items-center cpk:justify-center cpk:will-change-transform\";\n\nfunction setModalOpen(open: boolean) {\n if (config.value?.setModalOpen) {\n config.value.setModalOpen(open);\n return;\n }\n fallbackOpen.value = open;\n}\n\nfunction getClickListeners() {\n const listener = attrs.onClick;\n if (Array.isArray(listener)) {\n return listener.filter(\n (item): item is (event: MouseEvent) => void => typeof item === \"function\",\n );\n }\n return typeof listener === \"function\"\n ? [listener as (event: MouseEvent) => void]\n : [];\n}\n\nfunction handleClick(event: MouseEvent) {\n if (props.disabled) {\n return;\n }\n\n for (const listener of getClickListeners()) {\n listener(event);\n }\n\n if (event.defaultPrevented) {\n return;\n }\n\n setModalOpen(!isOpen.value);\n}\n</script>\n\n<template>\n <button\n data-copilotkit\n :type=\"type\"\n data-slot=\"chat-toggle-button\"\n :data-state=\"isOpen ? 'open' : 'closed'\"\n :class=\"buttonClass\"\n :aria-label=\"ariaLabel\"\n :aria-pressed=\"isOpen\"\n :disabled=\"disabled\"\n v-bind=\"buttonAttrs\"\n @click=\"handleClick\"\n >\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-open-icon\"\n :class=\"iconWrapperBase\"\n :style=\"{\n ...iconTransitionStyle,\n opacity: isOpen ? 0 : 1,\n transform: `scale(${isOpen ? 0.75 : 1}) rotate(${isOpen ? 90 : 0}deg)`,\n }\"\n >\n <slot name=\"open-icon\" :icon-class=\"iconClass\" :is-open=\"isOpen\">\n <CopilotChatToggleButtonOpenIcon\n :class=\"iconClass\"\n aria-hidden=\"true\"\n :focusable=\"false\"\n />\n </slot>\n </span>\n\n <span\n aria-hidden=\"true\"\n data-slot=\"chat-toggle-button-close-icon\"\n :class=\"iconWrapperBase\"\n :style=\"{\n ...iconTransitionStyle,\n opacity: isOpen ? 1 : 0,\n transform: `scale(${isOpen ? 1 : 0.75}) rotate(${isOpen ? 0 : -90}deg)`,\n }\"\n >\n <slot name=\"close-icon\" :icon-class=\"iconClass\" :is-open=\"isOpen\">\n <CopilotChatToggleButtonCloseIcon\n :class=\"iconClass\"\n aria-hidden=\"true\"\n :focusable=\"false\"\n />\n </slot>\n </span>\n </button>\n</template>\n","import { computed, defineComponent, h, useAttrs } from \"vue\";\nimport { IconX } from \"../icons\";\n\nexport default defineComponent({\n name: \"CopilotModalHeaderCloseButton\",\n inheritAttrs: false,\n setup(_, { slots }) {\n const attrs = useAttrs();\n const ariaLabel = computed(() =>\n typeof attrs[\"aria-label\"] === \"string\" ? attrs[\"aria-label\"] : \"Close\",\n );\n\n return () => {\n const {\n class: className,\n type,\n ...rest\n } = attrs as Record<string, unknown>;\n\n return h(\n \"button\",\n {\n ...rest,\n type: typeof type === \"string\" ? type : \"button\",\n class: [\n \"cpk:inline-flex cpk:size-8 cpk:items-center cpk:justify-center cpk:rounded-full cpk:text-muted-foreground cpk:transition cpk:cursor-pointer\",\n \"cpk:hover:bg-muted cpk:hover:text-foreground cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-ring\",\n className,\n ],\n \"aria-label\": ariaLabel.value,\n },\n slots.default\n ? slots.default()\n : [h(IconX, { class: \"cpk:h-4 cpk:w-4\", \"aria-hidden\": true })],\n );\n };\n },\n});\n","import { defineComponent, h } from \"vue\";\n\nexport default defineComponent({\n name: \"CopilotModalHeaderTitle\",\n inheritAttrs: false,\n setup(_, { attrs, slots }) {\n return () => {\n const { class: className, ...rest } = attrs as Record<string, unknown>;\n return h(\n \"div\",\n {\n ...rest,\n class: [\n \"cpk:w-full cpk:text-base cpk:font-medium cpk:leading-none cpk:tracking-tight cpk:text-foreground\",\n className,\n ],\n },\n slots.default ? slots.default() : [],\n );\n };\n },\n});\n","<script setup lang=\"ts\">\nimport { computed, useAttrs } from \"vue\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport CopilotModalHeaderCloseButton from \"./CopilotModalHeaderCloseButton\";\nimport CopilotModalHeaderTitle from \"./CopilotModalHeaderTitle\";\nimport type {\n CopilotModalHeaderCloseButtonSlotProps,\n CopilotModalHeaderLayoutSlotProps,\n CopilotModalHeaderProps,\n CopilotModalHeaderTitleContentSlotProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = defineProps<CopilotModalHeaderProps>();\n\ndefineSlots<{\n \"title-content\"?: (props: CopilotModalHeaderTitleContentSlotProps) => unknown;\n \"close-button\"?: (props: CopilotModalHeaderCloseButtonSlotProps) => unknown;\n layout?: (props: CopilotModalHeaderLayoutSlotProps) => unknown;\n}>();\n\nconst attrs = useAttrs();\nconst config = useCopilotChatConfiguration();\n\nconst resolvedTitle = computed(\n () =>\n props.title ??\n config.value?.labels.modalHeaderTitle ??\n CopilotChatDefaultLabels.modalHeaderTitle,\n);\nconst headerClass = computed(() => [\n \"cpk:flex cpk:items-center cpk:justify-between cpk:border-b cpk:border-border cpk:px-4 cpk:py-4\",\n \"cpk:bg-background/95 cpk:backdrop-blur cpk:supports-[backdrop-filter]:bg-background/80\",\n attrs.class,\n]);\nconst headerAttrs = computed(() => {\n const { class: _className, ...rest } = attrs;\n return rest;\n});\n\nfunction handleClose() {\n config.value?.setModalOpen?.(false);\n}\n</script>\n\n<template>\n <header\n data-copilotkit\n data-slot=\"copilot-modal-header\"\n :class=\"headerClass\"\n v-bind=\"headerAttrs\"\n >\n <slot name=\"layout\" :title=\"resolvedTitle\" :on-close=\"handleClose\">\n <div class=\"cpk:flex cpk:w-full cpk:items-center cpk:gap-2\">\n <div class=\"cpk:flex cpk:flex-1\" aria-hidden=\"true\" />\n <div class=\"cpk:flex cpk:flex-1 cpk:justify-center cpk:text-center\">\n <slot name=\"title-content\" :title=\"resolvedTitle\">\n <CopilotModalHeaderTitle>\n {{ resolvedTitle }}\n </CopilotModalHeaderTitle>\n </slot>\n </div>\n <div class=\"cpk:flex cpk:flex-1 cpk:justify-end\">\n <slot name=\"close-button\" :on-close=\"handleClose\">\n <CopilotModalHeaderCloseButton @click=\"handleClose\" />\n </slot>\n </div>\n </div>\n </slot>\n </header>\n</template>\n","<script setup lang=\"ts\">\nimport {\n computed,\n getCurrentInstance,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n watch,\n} from \"vue\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport CopilotChatToggleButton from \"./CopilotChatToggleButton.vue\";\nimport CopilotChatView from \"./CopilotChatView.vue\";\nimport CopilotModalHeader from \"./CopilotModalHeader.vue\";\nimport type {\n CopilotChatFeatherSlotProps,\n CopilotChatMessageViewSlotProps,\n CopilotChatScrollToBottomButtonSlotProps,\n CopilotChatScrollViewSlotProps,\n CopilotChatWelcomeScreenSlotProps,\n CopilotPopupViewHeaderSlotProps,\n CopilotPopupViewProps,\n CopilotPopupViewToggleButtonSlotProps,\n CopilotSidebarWelcomeScreenInputSlotProps,\n CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst DEFAULT_POPUP_WIDTH = 420;\nconst DEFAULT_POPUP_HEIGHT = 560;\nconst POPUP_ANIMATION_MS = 200;\n\nconst props = withDefaults(\n defineProps<Omit<CopilotPopupViewProps, \"defaultOpen\">>(),\n {\n messages: () => [],\n autoScroll: true,\n isRunning: false,\n suggestions: () => [],\n suggestionLoadingIndexes: () => [],\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n width: undefined,\n height: undefined,\n clickOutsideToClose: false,\n onFinishTranscribeWithAudio: undefined,\n },\n);\n\ndefineSlots<{\n header?: (props: CopilotPopupViewHeaderSlotProps) => unknown;\n \"toggle-button\"?: (props: CopilotPopupViewToggleButtonSlotProps) => unknown;\n \"message-view\"?: (props: CopilotChatMessageViewSlotProps) => unknown;\n \"scroll-view\"?: (props: CopilotChatScrollViewSlotProps) => unknown;\n feather?: (props: CopilotChatFeatherSlotProps) => unknown;\n \"scroll-to-bottom-button\"?: (\n props: CopilotChatScrollToBottomButtonSlotProps,\n ) => unknown;\n input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n \"welcome-screen\"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;\n \"welcome-message\"?: () => unknown;\n}>();\n\nconst emit = defineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [\n suggestion: (typeof props.suggestions)[number],\n index: number,\n ];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst attrs = useAttrs();\nconst config = useCopilotChatConfiguration();\nconst instance = getCurrentInstance();\nconst vnodeProps = computed(\n () => (instance?.vnode.props ?? {}) as Record<string, unknown>,\n);\n\nconst containerRef = ref<HTMLElement | null>(null);\nconst isRendered = ref(config.value?.isModalOpen ?? false);\nconst isAnimatingOut = ref(false);\nlet animationTimer: ReturnType<typeof setTimeout> | undefined;\nlet focusTimer: ReturnType<typeof setTimeout> | undefined;\n\nconst isPopupOpen = computed(() => config.value?.isModalOpen ?? false);\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\nconst headerTitle = computed(() => labels.value.modalHeaderTitle);\nconst hasStopAction = computed(() => hasListener(\"onStop\"));\nconst popupAnimationClass = computed(() =>\n isPopupOpen.value && !isAnimatingOut.value\n ? \"cpk:pointer-events-auto cpk:translate-y-0 cpk:opacity-100 cpk:md:scale-100\"\n : \"cpk:pointer-events-none cpk:translate-y-4 cpk:opacity-0 cpk:md:translate-y-5 cpk:md:scale-[0.95]\",\n);\nconst popupStyle = computed(\n () =>\n ({\n \"--copilot-popup-width\": dimensionToCss(props.width, DEFAULT_POPUP_WIDTH),\n \"--copilot-popup-height\": dimensionToCss(\n props.height,\n DEFAULT_POPUP_HEIGHT,\n ),\n \"--copilot-popup-max-width\": \"calc(100vw - 3rem)\",\n \"--copilot-popup-max-height\": \"calc(100dvh - 7.5rem)\",\n width: \"var(--copilot-popup-width)\",\n height: \"var(--copilot-popup-height)\",\n maxWidth: \"var(--copilot-popup-max-width)\",\n maxHeight: \"var(--copilot-popup-max-height)\",\n paddingTop: \"env(safe-area-inset-top)\",\n paddingBottom: \"env(safe-area-inset-bottom)\",\n paddingLeft: \"env(safe-area-inset-left)\",\n paddingRight: \"env(safe-area-inset-right)\",\n }) as Record<string, string>,\n);\n\nfunction dimensionToCss(\n value: number | string | undefined,\n fallback: number,\n): string {\n if (typeof value === \"number\" && Number.isFinite(value)) {\n return `${value}px`;\n }\n if (typeof value === \"string\" && value.trim().length > 0) {\n return value;\n }\n return `${fallback}px`;\n}\n\nfunction hasListener(listenerName: string) {\n const listener = vnodeProps.value[listenerName];\n if (Array.isArray(listener)) {\n return listener.length > 0;\n }\n return !!listener;\n}\n\nfunction closePopup() {\n config.value?.setModalOpen?.(false);\n}\n\nfunction openPopup() {\n config.value?.setModalOpen?.(true);\n}\n\nfunction togglePopup() {\n config.value?.setModalOpen?.(!isPopupOpen.value);\n}\n\nfunction handleSubmitMessage(value: string) {\n emit(\"submit-message\", value);\n}\n\nfunction handleStop() {\n emit(\"stop\");\n}\n\nfunction handleInputChange(value: string) {\n emit(\"input-change\", value);\n}\n\nfunction handleSelectSuggestion(\n suggestion: (typeof props.suggestions)[number],\n index: number,\n) {\n emit(\"select-suggestion\", suggestion, index);\n}\n\nfunction handleAddFile() {\n emit(\"add-file\");\n}\n\nfunction handleStartTranscribe() {\n emit(\"start-transcribe\");\n}\n\nfunction handleCancelTranscribe() {\n emit(\"cancel-transcribe\");\n}\n\nfunction handleFinishTranscribe() {\n emit(\"finish-transcribe\");\n}\n\nconst chatViewEventProps = computed(() => {\n const listeners: Record<string, unknown> = {\n onSubmitMessage: handleSubmitMessage,\n onInputChange: handleInputChange,\n onSelectSuggestion: handleSelectSuggestion,\n };\n\n if (hasStopAction.value) {\n listeners.onStop = handleStop;\n }\n if (hasListener(\"onAddFile\")) {\n listeners.onAddFile = handleAddFile;\n }\n if (hasListener(\"onStartTranscribe\")) {\n listeners.onStartTranscribe = handleStartTranscribe;\n }\n if (hasListener(\"onCancelTranscribe\")) {\n listeners.onCancelTranscribe = handleCancelTranscribe;\n }\n if (hasListener(\"onFinishTranscribe\")) {\n listeners.onFinishTranscribe = handleFinishTranscribe;\n }\n\n return listeners;\n});\n\nconst chatViewBindings = computed(() => ({\n ...attrs,\n ...chatViewEventProps.value,\n}));\n\nwatch(\n isPopupOpen,\n (open) => {\n if (animationTimer) {\n clearTimeout(animationTimer);\n animationTimer = undefined;\n }\n\n if (open) {\n isRendered.value = true;\n isAnimatingOut.value = false;\n return;\n }\n\n if (!isRendered.value) {\n return;\n }\n\n isAnimatingOut.value = true;\n animationTimer = setTimeout(() => {\n isRendered.value = false;\n isAnimatingOut.value = false;\n animationTimer = undefined;\n }, POPUP_ANIMATION_MS);\n },\n { immediate: true },\n);\n\nwatch(\n isPopupOpen,\n (open, _old, onCleanup) => {\n if (!open || typeof window === \"undefined\") {\n return;\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n closePopup();\n }\n };\n\n window.addEventListener(\"keydown\", handleKeyDown);\n onCleanup(() => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n });\n },\n { immediate: true },\n);\n\nwatch(\n isPopupOpen,\n (open, _old, onCleanup) => {\n if (!open) {\n return;\n }\n\n focusTimer = setTimeout(() => {\n if (typeof document === \"undefined\") {\n return;\n }\n const container = containerRef.value;\n if (container && !container.contains(document.activeElement)) {\n container.focus({ preventScroll: true });\n }\n }, POPUP_ANIMATION_MS);\n\n onCleanup(() => {\n if (focusTimer) {\n clearTimeout(focusTimer);\n focusTimer = undefined;\n }\n });\n },\n { immediate: true },\n);\n\nwatch(\n [isPopupOpen, () => props.clickOutsideToClose],\n ([open, allowClose], _old, onCleanup) => {\n if (!open || !allowClose || typeof document === \"undefined\") {\n return;\n }\n\n const handlePointerDown = (event: PointerEvent) => {\n const target = event.target as Node | null;\n if (!target) {\n return;\n }\n\n const container = containerRef.value;\n if (container?.contains(target)) {\n return;\n }\n\n const toggleButton = document.querySelector(\n \"[data-slot='chat-toggle-button']\",\n );\n if (toggleButton?.contains(target)) {\n return;\n }\n\n closePopup();\n };\n\n document.addEventListener(\"pointerdown\", handlePointerDown);\n onCleanup(() => {\n document.removeEventListener(\"pointerdown\", handlePointerDown);\n });\n },\n { immediate: true },\n);\n\nonMounted(async () => {\n await nextTick();\n});\n\nonBeforeUnmount(() => {\n if (animationTimer) {\n clearTimeout(animationTimer);\n }\n if (focusTimer) {\n clearTimeout(focusTimer);\n }\n});\n</script>\n\n<template>\n <slot\n name=\"toggle-button\"\n :is-open=\"isPopupOpen\"\n :toggle=\"togglePopup\"\n :open=\"openPopup\"\n :close=\"closePopup\"\n >\n <CopilotChatToggleButton />\n </slot>\n\n <div\n v-if=\"isRendered\"\n data-copilotkit\n class=\"cpk:fixed cpk:inset-0 cpk:z-[1200] cpk:flex cpk:max-w-full cpk:flex-col cpk:items-stretch cpk:md:inset-auto cpk:md:bottom-24 cpk:md:right-6 cpk:md:items-end cpk:md:gap-4\"\n >\n <div\n ref=\"containerRef\"\n tabindex=\"-1\"\n role=\"dialog\"\n :aria-label=\"labels.modalHeaderTitle\"\n data-copilot-popup\n :class=\"[\n 'cpk:relative cpk:flex cpk:h-full cpk:w-full cpk:flex-col cpk:overflow-hidden cpk:bg-background cpk:text-foreground',\n 'cpk:origin-bottom cpk:focus:outline-none cpk:transform-gpu cpk:transition-transform cpk:transition-opacity cpk:duration-200 cpk:ease-out',\n 'cpk:md:transition-transform cpk:md:transition-opacity',\n 'cpk:rounded-none cpk:border cpk:border-border/0 cpk:shadow-none cpk:ring-0',\n 'cpk:md:h-[var(--copilot-popup-height)] cpk:md:w-[var(--copilot-popup-width)]',\n 'cpk:md:max-h-[var(--copilot-popup-max-height)] cpk:md:max-w-[var(--copilot-popup-max-width)]',\n 'cpk:md:origin-bottom-right cpk:md:rounded-2xl cpk:md:border-border cpk:md:shadow-xl cpk:md:ring-1 cpk:md:ring-border/40',\n popupAnimationClass,\n ]\"\n :style=\"popupStyle\"\n >\n <slot\n name=\"header\"\n :title=\"headerTitle\"\n :on-close=\"closePopup\"\n :is-open=\"isPopupOpen\"\n >\n <CopilotModalHeader :title=\"headerTitle\" />\n </slot>\n\n <div class=\"cpk:flex-1 cpk:overflow-hidden\" data-popup-chat>\n <CopilotChatView\n :messages=\"messages\"\n :auto-scroll=\"autoScroll\"\n :is-running=\"isRunning\"\n :suggestions=\"suggestions\"\n :suggestion-loading-indexes=\"suggestionLoadingIndexes\"\n :welcome-screen=\"welcomeScreen\"\n :input-value=\"inputValue\"\n :input-mode=\"inputMode\"\n :input-tools-menu=\"inputToolsMenu\"\n :on-finish-transcribe-with-audio=\"onFinishTranscribeWithAudio\"\n v-bind=\"chatViewBindings\"\n >\n <template v-if=\"$slots['message-view']\" #message-view=\"slotProps\">\n <slot name=\"message-view\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['scroll-view']\" #scroll-view=\"slotProps\">\n <slot name=\"scroll-view\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots.feather\" #feather>\n <slot name=\"feather\" />\n </template>\n\n <template\n v-if=\"$slots['scroll-to-bottom-button']\"\n #scroll-to-bottom-button=\"slotProps\"\n >\n <slot name=\"scroll-to-bottom-button\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots.input\" #input=\"slotProps\">\n <slot name=\"input\" v-bind=\"slotProps\" />\n </template>\n\n <template\n v-if=\"$slots['suggestion-view']\"\n #suggestion-view=\"slotProps\"\n >\n <slot name=\"suggestion-view\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['welcome-screen']\" #welcome-screen=\"slotProps\">\n <slot name=\"welcome-screen\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['welcome-message']\" #welcome-message>\n <slot name=\"welcome-message\" />\n </template>\n </CopilotChatView>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, getCurrentInstance, useAttrs } from \"vue\";\nimport CopilotChatConfigurationProvider from \"../../providers/CopilotChatConfigurationProvider.vue\";\nimport CopilotPopupViewInternal from \"./CopilotPopupViewInternal.vue\";\nimport type {\n CopilotChatFeatherSlotProps,\n CopilotChatMessageViewSlotProps,\n CopilotChatScrollToBottomButtonSlotProps,\n CopilotChatScrollViewSlotProps,\n CopilotChatWelcomeScreenSlotProps,\n CopilotPopupViewHeaderSlotProps,\n CopilotPopupViewProps,\n CopilotPopupViewToggleButtonSlotProps,\n CopilotSidebarWelcomeScreenInputSlotProps,\n CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(defineProps<CopilotPopupViewProps>(), {\n messages: () => [],\n autoScroll: true,\n isRunning: false,\n suggestions: () => [],\n suggestionLoadingIndexes: () => [],\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n width: undefined,\n height: undefined,\n clickOutsideToClose: false,\n defaultOpen: true,\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n header?: (props: CopilotPopupViewHeaderSlotProps) => unknown;\n \"toggle-button\"?: (props: CopilotPopupViewToggleButtonSlotProps) => unknown;\n \"message-view\"?: (props: CopilotChatMessageViewSlotProps) => unknown;\n \"scroll-view\"?: (props: CopilotChatScrollViewSlotProps) => unknown;\n feather?: (props: CopilotChatFeatherSlotProps) => unknown;\n \"scroll-to-bottom-button\"?: (\n props: CopilotChatScrollToBottomButtonSlotProps,\n ) => unknown;\n input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n \"welcome-screen\"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;\n \"welcome-message\"?: () => unknown;\n}>();\n\nconst emit = defineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [\n suggestion: (typeof props.suggestions)[number],\n index: number,\n ];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst attrs = useAttrs();\nconst instance = getCurrentInstance();\nconst vnodeProps = computed(\n () => (instance?.vnode.props ?? {}) as Record<string, unknown>,\n);\n\nfunction hasListener(listenerName: string) {\n const listener = vnodeProps.value[listenerName];\n if (Array.isArray(listener)) {\n return listener.length > 0;\n }\n return !!listener;\n}\n\nconst internalProps = computed(() => {\n const { defaultOpen: _defaultOpen, ...rest } = props;\n return rest;\n});\n\nconst forwardedEventListeners = computed(() => {\n const listeners: Record<string, unknown> = {\n onSubmitMessage: (value: string) => emit(\"submit-message\", value),\n onStop: () => emit(\"stop\"),\n onInputChange: (value: string) => emit(\"input-change\", value),\n onSelectSuggestion: (\n suggestion: (typeof props.suggestions)[number],\n index: number,\n ) => emit(\"select-suggestion\", suggestion, index),\n };\n\n if (hasListener(\"onAddFile\")) {\n listeners.onAddFile = () => emit(\"add-file\");\n }\n if (hasListener(\"onStartTranscribe\")) {\n listeners.onStartTranscribe = () => emit(\"start-transcribe\");\n }\n if (hasListener(\"onCancelTranscribe\")) {\n listeners.onCancelTranscribe = () => emit(\"cancel-transcribe\");\n }\n if (hasListener(\"onFinishTranscribe\")) {\n listeners.onFinishTranscribe = () => emit(\"finish-transcribe\");\n }\n\n return listeners;\n});\n\nconst internalBindings = computed(() => ({\n ...attrs,\n ...internalProps.value,\n ...forwardedEventListeners.value,\n}));\n</script>\n\n<template>\n <CopilotChatConfigurationProvider :is-modal-default-open=\"defaultOpen\">\n <CopilotPopupViewInternal v-bind=\"internalBindings\">\n <template v-if=\"$slots.header\" #header=\"slotProps\">\n <slot name=\"header\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['toggle-button']\" #toggle-button=\"slotProps\">\n <slot name=\"toggle-button\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['message-view']\" #message-view=\"slotProps\">\n <slot name=\"message-view\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['scroll-view']\" #scroll-view=\"slotProps\">\n <slot name=\"scroll-view\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots.feather\" #feather=\"slotProps\">\n <slot name=\"feather\" v-bind=\"slotProps\" />\n </template>\n\n <template\n v-if=\"$slots['scroll-to-bottom-button']\"\n #scroll-to-bottom-button=\"slotProps\"\n >\n <slot name=\"scroll-to-bottom-button\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots.input\" #input=\"slotProps\">\n <slot name=\"input\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['suggestion-view']\" #suggestion-view=\"slotProps\">\n <slot name=\"suggestion-view\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['welcome-screen']\" #welcome-screen=\"slotProps\">\n <slot name=\"welcome-screen\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['welcome-message']\" #welcome-message>\n <slot name=\"welcome-message\" />\n </template>\n </CopilotPopupViewInternal>\n </CopilotChatConfigurationProvider>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport CopilotChatInput from \"./CopilotChatInput.vue\";\nimport CopilotChatSuggestionView from \"./CopilotChatSuggestionView.vue\";\nimport type {\n CopilotPopupWelcomeScreenInputSlotProps,\n CopilotPopupWelcomeScreenLayoutSlotProps,\n CopilotPopupWelcomeScreenProps,\n CopilotPopupWelcomeScreenSuggestionViewSlotProps,\n} from \"./types\";\n\nconst props = withDefaults(defineProps<CopilotPopupWelcomeScreenProps>(), {\n suggestions: () => [],\n loadingIndexes: () => [],\n modelValue: \"\",\n isRunning: false,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n onAddFile: undefined,\n onStartTranscribe: undefined,\n onCancelTranscribe: undefined,\n onFinishTranscribe: undefined,\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n \"welcome-message\"?: () => unknown;\n input?: (props: CopilotPopupWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotPopupWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n layout?: (props: CopilotPopupWelcomeScreenLayoutSlotProps) => unknown;\n}>();\n\nconst config = useCopilotChatConfiguration();\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\n\nconst inputSlotProps = computed<CopilotPopupWelcomeScreenInputSlotProps>(\n () => ({\n modelValue: props.modelValue,\n isRunning: props.isRunning,\n inputMode: props.inputMode,\n inputToolsMenu: props.inputToolsMenu,\n onUpdateModelValue: props.onUpdateModelValue,\n onSubmitMessage: props.onSubmitMessage,\n onStop: props.onStop,\n onAddFile: props.onAddFile,\n onStartTranscribe: props.onStartTranscribe,\n onCancelTranscribe: props.onCancelTranscribe,\n onFinishTranscribe: props.onFinishTranscribe,\n onFinishTranscribeWithAudio: props.onFinishTranscribeWithAudio,\n }),\n);\nconst suggestionViewSlotProps =\n computed<CopilotPopupWelcomeScreenSuggestionViewSlotProps>(() => ({\n suggestions: props.suggestions,\n loadingIndexes: props.loadingIndexes,\n onSelectSuggestion: props.onSelectSuggestion,\n }));\nconst layoutSlotProps = computed<CopilotPopupWelcomeScreenLayoutSlotProps>(\n () => ({\n ...inputSlotProps.value,\n ...suggestionViewSlotProps.value,\n }),\n);\n\nconst inputEventProps = computed(() => {\n const listeners: Record<string, unknown> = {\n \"onUpdate:modelValue\": props.onUpdateModelValue,\n onSubmitMessage: props.onSubmitMessage,\n onStop: props.onStop,\n };\n\n if (props.onAddFile) {\n listeners.onAddFile = props.onAddFile;\n }\n if (props.onStartTranscribe) {\n listeners.onStartTranscribe = props.onStartTranscribe;\n }\n if (props.onCancelTranscribe) {\n listeners.onCancelTranscribe = props.onCancelTranscribe;\n }\n if (props.onFinishTranscribe) {\n listeners.onFinishTranscribe = props.onFinishTranscribe;\n }\n if (props.onFinishTranscribeWithAudio) {\n listeners.onFinishTranscribeWithAudio = props.onFinishTranscribeWithAudio;\n }\n\n return listeners;\n});\n</script>\n\n<template>\n <slot name=\"layout\" v-bind=\"layoutSlotProps\">\n <div\n data-copilotkit\n class=\"cpk:h-full cpk:flex cpk:flex-col\"\n data-testid=\"copilot-popup-welcome-screen\"\n >\n <div\n class=\"cpk:flex-1 cpk:flex cpk:flex-col cpk:items-center cpk:justify-center cpk:px-4\"\n >\n <slot name=\"welcome-message\">\n <h1\n class=\"cpk:text-xl cpk:sm:text-2xl cpk:font-medium cpk:text-foreground cpk:text-center\"\n >\n {{ labels.welcomeMessageText }}\n </h1>\n </slot>\n </div>\n\n <div>\n <div class=\"cpk:mb-4 cpk:flex cpk:justify-center cpk:px-4\">\n <slot name=\"suggestion-view\" v-bind=\"suggestionViewSlotProps\">\n <CopilotChatSuggestionView\n :suggestions=\"suggestions\"\n :loading-indexes=\"loadingIndexes\"\n @select-suggestion=\"onSelectSuggestion\"\n />\n </slot>\n </div>\n\n <slot name=\"input\" v-bind=\"inputSlotProps\">\n <CopilotChatInput\n :model-value=\"modelValue\"\n :is-running=\"isRunning\"\n :mode=\"inputMode\"\n :tools-menu=\"inputToolsMenu\"\n positioning=\"static\"\n :show-disclaimer=\"true\"\n v-bind=\"inputEventProps\"\n />\n </slot>\n </div>\n </div>\n </slot>\n</template>\n","<script setup lang=\"ts\">\nimport {\n computed,\n getCurrentInstance,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n watch,\n} from \"vue\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport CopilotChatToggleButton from \"./CopilotChatToggleButton.vue\";\nimport CopilotChatView from \"./CopilotChatView.vue\";\nimport CopilotModalHeader from \"./CopilotModalHeader.vue\";\nimport type {\n CopilotChatFeatherSlotProps,\n CopilotChatMessageViewSlotProps,\n CopilotChatScrollToBottomButtonSlotProps,\n CopilotChatScrollViewSlotProps,\n CopilotChatWelcomeScreenSlotProps,\n CopilotSidebarWelcomeScreenInputSlotProps,\n CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n CopilotSidebarViewHeaderSlotProps,\n CopilotSidebarViewProps,\n CopilotSidebarViewToggleButtonSlotProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst DEFAULT_SIDEBAR_WIDTH = 480;\nconst SIDEBAR_TRANSITION_MS = 260;\n\nconst props = withDefaults(\n defineProps<Omit<CopilotSidebarViewProps, \"defaultOpen\">>(),\n {\n messages: () => [],\n autoScroll: true,\n isRunning: false,\n suggestions: () => [],\n suggestionLoadingIndexes: () => [],\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n width: undefined,\n onFinishTranscribeWithAudio: undefined,\n },\n);\n\ndefineSlots<{\n header?: (props: CopilotSidebarViewHeaderSlotProps) => unknown;\n \"toggle-button\"?: (props: CopilotSidebarViewToggleButtonSlotProps) => unknown;\n \"message-view\"?: (props: CopilotChatMessageViewSlotProps) => unknown;\n \"scroll-view\"?: (props: CopilotChatScrollViewSlotProps) => unknown;\n feather?: (props: CopilotChatFeatherSlotProps) => unknown;\n \"scroll-to-bottom-button\"?: (\n props: CopilotChatScrollToBottomButtonSlotProps,\n ) => unknown;\n input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n \"welcome-screen\"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;\n \"welcome-message\"?: () => unknown;\n}>();\n\nconst emit = defineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [\n suggestion: (typeof props.suggestions)[number],\n index: number,\n ];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst attrs = useAttrs();\nconst config = useCopilotChatConfiguration();\nconst instance = getCurrentInstance();\nconst vnodeProps = computed(\n () => (instance?.vnode.props ?? {}) as Record<string, unknown>,\n);\n\nconst sidebarRef = ref<HTMLElement | null>(null);\nconst measuredSidebarWidth = ref<number | string>(\n props.width ?? DEFAULT_SIDEBAR_WIDTH,\n);\nlet resizeObserver: ResizeObserver | null = null;\n\nconst isSidebarOpen = computed(() => config.value?.isModalOpen ?? false);\nconst resolvedSidebarWidth = computed(\n () => props.width ?? measuredSidebarWidth.value,\n);\nconst headerTitle = computed(\n () =>\n config.value?.labels.modalHeaderTitle ??\n CopilotChatDefaultLabels.modalHeaderTitle,\n);\nconst asideClass = computed(() => [\n \"cpk:fixed cpk:right-0 cpk:top-0 cpk:z-[1200] cpk:flex cpk:h-[100vh] cpk:h-[100dvh] cpk:max-h-screen cpk:w-full\",\n \"cpk:border-l cpk:border-border cpk:bg-background cpk:text-foreground cpk:shadow-xl\",\n \"cpk:transition-transform cpk:duration-300 cpk:ease-out\",\n isSidebarOpen.value\n ? \"cpk:translate-x-0\"\n : \"cpk:translate-x-full cpk:pointer-events-none\",\n attrs.class,\n]);\nconst asideAttrs = computed(() => {\n const { class: _className, ...rest } = attrs;\n return rest;\n});\nconst hasStopAction = computed(() => hasListener(\"onStop\"));\nconst asideStyle = computed(\n () =>\n ({\n \"--sidebar-width\": widthToCss(resolvedSidebarWidth.value),\n paddingTop: \"env(safe-area-inset-top)\",\n paddingBottom: \"env(safe-area-inset-bottom)\",\n }) as Record<string, string>,\n);\nconst bodyMarginStyle = computed(\n () => `\n@media (min-width: 768px) {\n body {\n margin-inline-end: ${widthToMargin(resolvedSidebarWidth.value)};\n transition: margin-inline-end ${SIDEBAR_TRANSITION_MS}ms ease;\n }\n}\n`,\n);\n\nfunction hasListener(listenerName: string) {\n const listener = vnodeProps.value[listenerName];\n if (Array.isArray(listener)) {\n return listener.length > 0;\n }\n return !!listener;\n}\n\nfunction widthToCss(width: number | string): string {\n return typeof width === \"number\" ? `${width}px` : width;\n}\n\nfunction widthToMargin(width: number | string): string {\n return typeof width === \"number\" ? `${width}px` : width;\n}\n\nfunction updateMeasuredWidth() {\n if (props.width !== undefined || !sidebarRef.value) {\n return;\n }\n\n const nextWidth = sidebarRef.value.getBoundingClientRect().width;\n if (nextWidth > 0) {\n measuredSidebarWidth.value = nextWidth;\n }\n}\n\nfunction closeSidebar() {\n config.value?.setModalOpen?.(false);\n}\n\nfunction openSidebar() {\n config.value?.setModalOpen?.(true);\n}\n\nfunction toggleSidebar() {\n config.value?.setModalOpen?.(!isSidebarOpen.value);\n}\n\nfunction handleSubmitMessage(value: string) {\n emit(\"submit-message\", value);\n}\n\nfunction handleStop() {\n emit(\"stop\");\n}\n\nfunction handleInputChange(value: string) {\n emit(\"input-change\", value);\n}\n\nfunction handleSelectSuggestion(\n suggestion: (typeof props.suggestions)[number],\n index: number,\n) {\n emit(\"select-suggestion\", suggestion, index);\n}\n\nfunction handleAddFile() {\n emit(\"add-file\");\n}\n\nfunction handleStartTranscribe() {\n emit(\"start-transcribe\");\n}\n\nfunction handleCancelTranscribe() {\n emit(\"cancel-transcribe\");\n}\n\nfunction handleFinishTranscribe() {\n emit(\"finish-transcribe\");\n}\n\nconst chatViewEventProps = computed(() => {\n const listeners: Record<string, unknown> = {\n onSubmitMessage: handleSubmitMessage,\n onInputChange: handleInputChange,\n onSelectSuggestion: handleSelectSuggestion,\n };\n\n if (hasStopAction.value) {\n listeners.onStop = handleStop;\n }\n if (hasListener(\"onAddFile\")) {\n listeners.onAddFile = handleAddFile;\n }\n if (hasListener(\"onStartTranscribe\")) {\n listeners.onStartTranscribe = handleStartTranscribe;\n }\n if (hasListener(\"onCancelTranscribe\")) {\n listeners.onCancelTranscribe = handleCancelTranscribe;\n }\n if (hasListener(\"onFinishTranscribe\")) {\n listeners.onFinishTranscribe = handleFinishTranscribe;\n }\n\n return listeners;\n});\n\nwatch(\n () => props.width,\n (nextWidth) => {\n if (nextWidth !== undefined) {\n measuredSidebarWidth.value = nextWidth;\n return;\n }\n updateMeasuredWidth();\n },\n);\n\nonMounted(async () => {\n await nextTick();\n updateMeasuredWidth();\n\n if (\n props.width !== undefined ||\n !sidebarRef.value ||\n typeof ResizeObserver === \"undefined\"\n ) {\n return;\n }\n\n resizeObserver = new ResizeObserver(() => {\n updateMeasuredWidth();\n });\n resizeObserver.observe(sidebarRef.value);\n});\n\nonBeforeUnmount(() => {\n resizeObserver?.disconnect();\n resizeObserver = null;\n});\n</script>\n\n<template>\n <component :is=\"'style'\" v-if=\"isSidebarOpen\">\n {{ bodyMarginStyle }}\n </component>\n\n <slot\n name=\"toggle-button\"\n :is-open=\"isSidebarOpen\"\n :toggle=\"toggleSidebar\"\n :open=\"openSidebar\"\n :close=\"closeSidebar\"\n >\n <CopilotChatToggleButton />\n </slot>\n\n <aside\n ref=\"sidebarRef\"\n data-copilotkit\n data-copilot-sidebar\n :class=\"asideClass\"\n :style=\"asideStyle\"\n aria-label=\"Copilot chat sidebar\"\n :aria-hidden=\"!isSidebarOpen\"\n role=\"complementary\"\n v-bind=\"asideAttrs\"\n >\n <div\n class=\"cpk:flex cpk:h-full cpk:w-full cpk:flex-col cpk:overflow-hidden\"\n >\n <slot\n name=\"header\"\n :title=\"headerTitle\"\n :on-close=\"closeSidebar\"\n :is-open=\"isSidebarOpen\"\n >\n <CopilotModalHeader :title=\"headerTitle\" />\n </slot>\n\n <div class=\"cpk:flex-1 cpk:overflow-hidden\" data-sidebar-chat>\n <CopilotChatView\n :messages=\"messages\"\n :auto-scroll=\"autoScroll\"\n :is-running=\"isRunning\"\n :suggestions=\"suggestions\"\n :suggestion-loading-indexes=\"suggestionLoadingIndexes\"\n :welcome-screen=\"welcomeScreen\"\n :input-value=\"inputValue\"\n :input-mode=\"inputMode\"\n :input-tools-menu=\"inputToolsMenu\"\n :on-finish-transcribe-with-audio=\"onFinishTranscribeWithAudio\"\n v-bind=\"chatViewEventProps\"\n >\n <template v-if=\"$slots['message-view']\" #message-view=\"slotProps\">\n <slot name=\"message-view\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['scroll-view']\" #scroll-view=\"slotProps\">\n <slot name=\"scroll-view\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots.feather\" #feather>\n <slot name=\"feather\" />\n </template>\n\n <template\n v-if=\"$slots['scroll-to-bottom-button']\"\n #scroll-to-bottom-button=\"slotProps\"\n >\n <slot name=\"scroll-to-bottom-button\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots.input\" #input=\"slotProps\">\n <slot name=\"input\" v-bind=\"slotProps\" />\n </template>\n\n <template\n v-if=\"$slots['suggestion-view']\"\n #suggestion-view=\"slotProps\"\n >\n <slot name=\"suggestion-view\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['welcome-screen']\" #welcome-screen=\"slotProps\">\n <slot name=\"welcome-screen\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['welcome-message']\" #welcome-message>\n <slot name=\"welcome-message\" />\n </template>\n </CopilotChatView>\n </div>\n </div>\n </aside>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, getCurrentInstance, useAttrs } from \"vue\";\nimport CopilotChatConfigurationProvider from \"../../providers/CopilotChatConfigurationProvider.vue\";\nimport CopilotSidebarViewInternal from \"./CopilotSidebarViewInternal.vue\";\nimport type {\n CopilotChatFeatherSlotProps,\n CopilotChatWelcomeScreenSlotProps,\n CopilotChatMessageViewSlotProps,\n CopilotChatScrollToBottomButtonSlotProps,\n CopilotChatScrollViewSlotProps,\n CopilotSidebarWelcomeScreenInputSlotProps,\n CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n CopilotSidebarViewProps,\n} from \"./types\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(defineProps<CopilotSidebarViewProps>(), {\n messages: () => [],\n autoScroll: true,\n isRunning: false,\n suggestions: () => [],\n suggestionLoadingIndexes: () => [],\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n width: undefined,\n defaultOpen: true,\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n header?: (props: {\n title: string;\n onClose: () => void;\n isOpen: boolean;\n }) => unknown;\n \"toggle-button\"?: (props: {\n isOpen: boolean;\n toggle: () => void;\n open: () => void;\n close: () => void;\n }) => unknown;\n \"message-view\"?: (props: CopilotChatMessageViewSlotProps) => unknown;\n \"scroll-view\"?: (props: CopilotChatScrollViewSlotProps) => unknown;\n feather?: (props: CopilotChatFeatherSlotProps) => unknown;\n \"scroll-to-bottom-button\"?: (\n props: CopilotChatScrollToBottomButtonSlotProps,\n ) => unknown;\n input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n \"welcome-screen\"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;\n \"welcome-message\"?: () => unknown;\n}>();\n\nconst emit = defineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [\n suggestion: (typeof props.suggestions)[number],\n index: number,\n ];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst attrs = useAttrs();\nconst instance = getCurrentInstance();\nconst vnodeProps = computed(\n () => (instance?.vnode.props ?? {}) as Record<string, unknown>,\n);\n\nconst internalProps = computed(() => {\n const { defaultOpen: _defaultOpen, ...rest } = props;\n return rest;\n});\nconst internalBindings = computed(() => ({\n ...attrs,\n ...internalProps.value,\n ...forwardedEventListeners.value,\n}));\n\nfunction hasListener(listenerName: string) {\n const listener = vnodeProps.value[listenerName];\n if (Array.isArray(listener)) {\n return listener.length > 0;\n }\n return !!listener;\n}\n\nconst forwardedEventListeners = computed(() => {\n const listeners: Record<string, unknown> = {\n onSubmitMessage: (value: string) => emit(\"submit-message\", value),\n onStop: () => emit(\"stop\"),\n onInputChange: (value: string) => emit(\"input-change\", value),\n onSelectSuggestion: (\n suggestion: (typeof props.suggestions)[number],\n index: number,\n ) => emit(\"select-suggestion\", suggestion, index),\n };\n\n if (hasListener(\"onAddFile\")) {\n listeners.onAddFile = () => emit(\"add-file\");\n }\n if (hasListener(\"onStartTranscribe\")) {\n listeners.onStartTranscribe = () => emit(\"start-transcribe\");\n }\n if (hasListener(\"onCancelTranscribe\")) {\n listeners.onCancelTranscribe = () => emit(\"cancel-transcribe\");\n }\n if (hasListener(\"onFinishTranscribe\")) {\n listeners.onFinishTranscribe = () => emit(\"finish-transcribe\");\n }\n\n return listeners;\n});\n</script>\n\n<template>\n <CopilotChatConfigurationProvider :is-modal-default-open=\"defaultOpen\">\n <CopilotSidebarViewInternal v-bind=\"internalBindings\">\n <template v-if=\"$slots.header\" #header=\"slotProps\">\n <slot name=\"header\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['toggle-button']\" #toggle-button=\"slotProps\">\n <slot name=\"toggle-button\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['message-view']\" #message-view=\"slotProps\">\n <slot name=\"message-view\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['scroll-view']\" #scroll-view=\"slotProps\">\n <slot name=\"scroll-view\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots.feather\" #feather=\"slotProps\">\n <slot name=\"feather\" v-bind=\"slotProps\" />\n </template>\n\n <template\n v-if=\"$slots['scroll-to-bottom-button']\"\n #scroll-to-bottom-button=\"slotProps\"\n >\n <slot name=\"scroll-to-bottom-button\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots.input\" #input=\"slotProps\">\n <slot name=\"input\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['suggestion-view']\" #suggestion-view=\"slotProps\">\n <slot name=\"suggestion-view\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['welcome-screen']\" #welcome-screen=\"slotProps\">\n <slot name=\"welcome-screen\" v-bind=\"slotProps\" />\n </template>\n\n <template v-if=\"$slots['welcome-message']\" #welcome-message>\n <slot name=\"welcome-message\" />\n </template>\n </CopilotSidebarViewInternal>\n </CopilotChatConfigurationProvider>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport { useCopilotChatConfiguration } from \"../../providers/useCopilotChatConfiguration\";\nimport { CopilotChatDefaultLabels } from \"../../providers/types\";\nimport CopilotChatInput from \"./CopilotChatInput.vue\";\nimport CopilotChatSuggestionView from \"./CopilotChatSuggestionView.vue\";\nimport type {\n CopilotSidebarWelcomeScreenInputSlotProps,\n CopilotSidebarWelcomeScreenLayoutSlotProps,\n CopilotSidebarWelcomeScreenProps,\n CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n} from \"./types\";\n\nconst props = withDefaults(defineProps<CopilotSidebarWelcomeScreenProps>(), {\n suggestions: () => [],\n loadingIndexes: () => [],\n modelValue: \"\",\n isRunning: false,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n onAddFile: undefined,\n onStartTranscribe: undefined,\n onCancelTranscribe: undefined,\n onFinishTranscribe: undefined,\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n \"welcome-message\"?: () => unknown;\n input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n layout?: (props: CopilotSidebarWelcomeScreenLayoutSlotProps) => unknown;\n}>();\n\nconst config = useCopilotChatConfiguration();\nconst labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);\n\nconst inputSlotProps = computed<CopilotSidebarWelcomeScreenInputSlotProps>(\n () => ({\n modelValue: props.modelValue,\n isRunning: props.isRunning,\n inputMode: props.inputMode,\n inputToolsMenu: props.inputToolsMenu,\n onUpdateModelValue: props.onUpdateModelValue,\n onSubmitMessage: props.onSubmitMessage,\n onStop: props.onStop,\n onAddFile: props.onAddFile,\n onStartTranscribe: props.onStartTranscribe,\n onCancelTranscribe: props.onCancelTranscribe,\n onFinishTranscribe: props.onFinishTranscribe,\n onFinishTranscribeWithAudio: props.onFinishTranscribeWithAudio,\n }),\n);\nconst suggestionViewSlotProps =\n computed<CopilotSidebarWelcomeScreenSuggestionViewSlotProps>(() => ({\n suggestions: props.suggestions,\n loadingIndexes: props.loadingIndexes,\n onSelectSuggestion: props.onSelectSuggestion,\n }));\nconst layoutSlotProps = computed<CopilotSidebarWelcomeScreenLayoutSlotProps>(\n () => ({\n ...inputSlotProps.value,\n ...suggestionViewSlotProps.value,\n }),\n);\n\nconst inputEventProps = computed(() => {\n const listeners: Record<string, unknown> = {\n \"onUpdate:modelValue\": props.onUpdateModelValue,\n onSubmitMessage: props.onSubmitMessage,\n onStop: props.onStop,\n };\n\n if (props.onAddFile) {\n listeners.onAddFile = props.onAddFile;\n }\n if (props.onStartTranscribe) {\n listeners.onStartTranscribe = props.onStartTranscribe;\n }\n if (props.onCancelTranscribe) {\n listeners.onCancelTranscribe = props.onCancelTranscribe;\n }\n if (props.onFinishTranscribe) {\n listeners.onFinishTranscribe = props.onFinishTranscribe;\n }\n if (props.onFinishTranscribeWithAudio) {\n listeners.onFinishTranscribeWithAudio = props.onFinishTranscribeWithAudio;\n }\n\n return listeners;\n});\n</script>\n\n<template>\n <slot name=\"layout\" v-bind=\"layoutSlotProps\">\n <div\n data-copilotkit\n class=\"cpk:h-full cpk:flex cpk:flex-col\"\n data-testid=\"copilot-sidebar-welcome-screen\"\n >\n <div\n class=\"cpk:flex-1 cpk:flex cpk:flex-col cpk:items-center cpk:justify-center cpk:px-4\"\n >\n <slot name=\"welcome-message\">\n <h1\n class=\"cpk:text-xl cpk:sm:text-2xl cpk:font-medium cpk:text-foreground cpk:text-center\"\n >\n {{ labels.welcomeMessageText }}\n </h1>\n </slot>\n </div>\n\n <div class=\"cpk:px-8 cpk:pb-4\">\n <div class=\"cpk:max-w-3xl cpk:mx-auto\">\n <div class=\"cpk:mb-4 cpk:flex cpk:justify-center\">\n <slot name=\"suggestion-view\" v-bind=\"suggestionViewSlotProps\">\n <CopilotChatSuggestionView\n :suggestions=\"suggestions\"\n :loading-indexes=\"loadingIndexes\"\n @select-suggestion=\"onSelectSuggestion\"\n />\n </slot>\n </div>\n\n <slot name=\"input\" v-bind=\"inputSlotProps\">\n <CopilotChatInput\n :model-value=\"modelValue\"\n :is-running=\"isRunning\"\n :mode=\"inputMode\"\n :tools-menu=\"inputToolsMenu\"\n positioning=\"static\"\n :show-disclaimer=\"true\"\n v-bind=\"inputEventProps\"\n />\n </slot>\n </div>\n </div>\n </div>\n </slot>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, watch } from \"vue\";\nimport CopilotChat from \"./CopilotChat.vue\";\nimport CopilotPopupView from \"./CopilotPopupView.vue\";\nimport CopilotPopupWelcomeScreen from \"./CopilotPopupWelcomeScreen.vue\";\nimport InlineFeatureWarning from \"../InlineFeatureWarning.vue\";\nimport { useLicenseContext } from \"../../providers/useLicenseContext\";\nimport type {\n CopilotChatMessageViewSlotProps,\n CopilotChatViewOverrideSlotProps,\n CopilotChatWelcomeScreenSlotProps,\n CopilotPopupProps,\n CopilotPopupViewHeaderSlotProps,\n CopilotPopupViewToggleButtonSlotProps,\n CopilotSidebarWelcomeScreenInputSlotProps,\n CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n} from \"./types\";\nimport type { Suggestion } from \"@copilotkit/core\";\n\nfunction popupViewEventBindings(slotProps: CopilotChatViewOverrideSlotProps) {\n return {\n onSubmitMessage: slotProps.onSubmitMessage,\n onInputChange: slotProps.onInputChange,\n onSelectSuggestion: slotProps.onSelectSuggestion,\n ...(slotProps.onStop ? { onStop: slotProps.onStop } : {}),\n ...(slotProps.onAddFile ? { onAddFile: slotProps.onAddFile } : {}),\n ...(slotProps.onStartTranscribe\n ? { onStartTranscribe: slotProps.onStartTranscribe }\n : {}),\n ...(slotProps.onCancelTranscribe\n ? { onCancelTranscribe: slotProps.onCancelTranscribe }\n : {}),\n ...(slotProps.onFinishTranscribe\n ? { onFinishTranscribe: slotProps.onFinishTranscribe }\n : {}),\n };\n}\n\nconst props = withDefaults(defineProps<CopilotPopupProps>(), {\n autoScroll: true,\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n width: undefined,\n height: undefined,\n clickOutsideToClose: false,\n defaultOpen: true,\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n header?: (props: CopilotPopupViewHeaderSlotProps) => unknown;\n \"toggle-button\"?: (props: CopilotPopupViewToggleButtonSlotProps) => unknown;\n \"chat-view\"?: (props: CopilotChatViewOverrideSlotProps) => unknown;\n \"message-view\"?: (props: CopilotChatMessageViewSlotProps) => unknown;\n input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n \"welcome-screen\"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;\n \"welcome-message\"?: () => unknown;\n}>();\n\ndefineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [suggestion: Suggestion, index: number];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst license = useLicenseContext();\nconst isPopupLicensed = computed(() => license.value.checkFeature(\"popup\"));\n\nwatch(\n isPopupLicensed,\n (licensed) => {\n if (!licensed) {\n console.warn(\n '[CopilotKit] Warning: \"popup\" feature is not licensed. Visit copilotkit.ai/pricing',\n );\n }\n },\n { immediate: true },\n);\n</script>\n\n<template>\n <InlineFeatureWarning v-if=\"!isPopupLicensed\" feature-name=\"Popup\" />\n <CopilotChat\n v-bind=\"props\"\n @submit-message=\"$emit('submit-message', $event)\"\n @stop=\"$emit('stop')\"\n @input-change=\"$emit('input-change', $event)\"\n @select-suggestion=\"\n (suggestion, index) => $emit('select-suggestion', suggestion, index)\n \"\n @add-file=\"$emit('add-file')\"\n @start-transcribe=\"$emit('start-transcribe')\"\n @cancel-transcribe=\"$emit('cancel-transcribe')\"\n @finish-transcribe=\"$emit('finish-transcribe')\"\n >\n <template #chat-view=\"slotProps\">\n <slot v-if=\"$slots['chat-view']\" name=\"chat-view\" v-bind=\"slotProps\" />\n <CopilotPopupView\n v-else\n :messages=\"slotProps.messages\"\n :auto-scroll=\"slotProps.autoScroll\"\n :is-running=\"slotProps.isRunning\"\n :suggestions=\"slotProps.suggestions\"\n :suggestion-loading-indexes=\"slotProps.suggestionLoadingIndexes\"\n :welcome-screen=\"slotProps.welcomeScreen\"\n :input-value=\"slotProps.inputValue\"\n :input-mode=\"slotProps.inputMode\"\n :input-tools-menu=\"slotProps.inputToolsMenu\"\n :width=\"width\"\n :height=\"height\"\n :click-outside-to-close=\"clickOutsideToClose\"\n :default-open=\"defaultOpen\"\n :on-finish-transcribe-with-audio=\"slotProps.onFinishTranscribeWithAudio\"\n v-bind=\"popupViewEventBindings(slotProps)\"\n >\n <template v-if=\"$slots.header\" #header=\"headerProps\">\n <slot name=\"header\" v-bind=\"headerProps\" />\n </template>\n\n <template\n v-if=\"$slots['toggle-button']\"\n #toggle-button=\"toggleButtonProps\"\n >\n <slot name=\"toggle-button\" v-bind=\"toggleButtonProps\" />\n </template>\n\n <template #welcome-screen=\"welcomeScreenProps\">\n <slot\n v-if=\"$slots['welcome-screen']\"\n name=\"welcome-screen\"\n v-bind=\"welcomeScreenProps\"\n />\n <CopilotPopupWelcomeScreen v-else v-bind=\"welcomeScreenProps\">\n <template v-if=\"$slots['welcome-message']\" #welcome-message>\n <slot name=\"welcome-message\" />\n </template>\n\n <template\n v-if=\"$slots['suggestion-view']\"\n #suggestion-view=\"suggestionViewProps\"\n >\n <slot name=\"suggestion-view\" v-bind=\"suggestionViewProps\" />\n </template>\n\n <template v-if=\"$slots.input\" #input=\"inputProps\">\n <slot name=\"input\" v-bind=\"inputProps\" />\n </template>\n </CopilotPopupWelcomeScreen>\n </template>\n\n <template\n v-if=\"$slots['message-view']\"\n #message-view=\"messageViewProps\"\n >\n <slot name=\"message-view\" v-bind=\"messageViewProps\" />\n </template>\n\n <template v-if=\"$slots.input\" #input=\"inputProps\">\n <slot name=\"input\" v-bind=\"inputProps\" />\n </template>\n\n <template\n v-if=\"$slots['suggestion-view']\"\n #suggestion-view=\"suggestionViewProps\"\n >\n <slot name=\"suggestion-view\" v-bind=\"suggestionViewProps\" />\n </template>\n </CopilotPopupView>\n </template>\n </CopilotChat>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, watch } from \"vue\";\nimport CopilotChat from \"./CopilotChat.vue\";\nimport CopilotSidebarView from \"./CopilotSidebarView.vue\";\nimport CopilotSidebarWelcomeScreen from \"./CopilotSidebarWelcomeScreen.vue\";\nimport InlineFeatureWarning from \"../InlineFeatureWarning.vue\";\nimport { useLicenseContext } from \"../../providers/useLicenseContext\";\nimport type {\n CopilotChatMessageViewSlotProps,\n CopilotChatViewOverrideSlotProps,\n CopilotChatWelcomeScreenSlotProps,\n CopilotSidebarProps,\n CopilotSidebarViewHeaderSlotProps,\n CopilotSidebarViewToggleButtonSlotProps,\n CopilotSidebarWelcomeScreenInputSlotProps,\n CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n} from \"./types\";\nimport type { Suggestion } from \"@copilotkit/core\";\n\nfunction sidebarViewEventBindings(slotProps: CopilotChatViewOverrideSlotProps) {\n return {\n onSubmitMessage: slotProps.onSubmitMessage,\n onInputChange: slotProps.onInputChange,\n onSelectSuggestion: slotProps.onSelectSuggestion,\n ...(slotProps.onStop ? { onStop: slotProps.onStop } : {}),\n ...(slotProps.onAddFile ? { onAddFile: slotProps.onAddFile } : {}),\n ...(slotProps.onStartTranscribe\n ? { onStartTranscribe: slotProps.onStartTranscribe }\n : {}),\n ...(slotProps.onCancelTranscribe\n ? { onCancelTranscribe: slotProps.onCancelTranscribe }\n : {}),\n ...(slotProps.onFinishTranscribe\n ? { onFinishTranscribe: slotProps.onFinishTranscribe }\n : {}),\n };\n}\n\nconst props = withDefaults(defineProps<CopilotSidebarProps>(), {\n autoScroll: true,\n welcomeScreen: true,\n inputValue: undefined,\n inputMode: \"input\",\n inputToolsMenu: () => [],\n width: undefined,\n defaultOpen: true,\n onFinishTranscribeWithAudio: undefined,\n});\n\ndefineSlots<{\n header?: (props: CopilotSidebarViewHeaderSlotProps) => unknown;\n \"toggle-button\"?: (props: CopilotSidebarViewToggleButtonSlotProps) => unknown;\n \"chat-view\"?: (props: CopilotChatViewOverrideSlotProps) => unknown;\n \"message-view\"?: (props: CopilotChatMessageViewSlotProps) => unknown;\n input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;\n \"suggestion-view\"?: (\n props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,\n ) => unknown;\n \"welcome-screen\"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;\n \"welcome-message\"?: () => unknown;\n}>();\n\ndefineEmits<{\n \"submit-message\": [value: string];\n stop: [];\n \"input-change\": [value: string];\n \"select-suggestion\": [suggestion: Suggestion, index: number];\n \"add-file\": [];\n \"start-transcribe\": [];\n \"cancel-transcribe\": [];\n \"finish-transcribe\": [];\n}>();\n\nconst license = useLicenseContext();\nconst isSidebarLicensed = computed(() => license.value.checkFeature(\"sidebar\"));\n\nwatch(\n isSidebarLicensed,\n (licensed) => {\n if (!licensed) {\n console.warn(\n '[CopilotKit] Warning: \"sidebar\" feature is not licensed. Visit copilotkit.ai/pricing',\n );\n }\n },\n { immediate: true },\n);\n</script>\n\n<template>\n <InlineFeatureWarning v-if=\"!isSidebarLicensed\" feature-name=\"Sidebar\" />\n <CopilotChat\n v-bind=\"props\"\n @submit-message=\"$emit('submit-message', $event)\"\n @stop=\"$emit('stop')\"\n @input-change=\"$emit('input-change', $event)\"\n @select-suggestion=\"\n (suggestion, index) => $emit('select-suggestion', suggestion, index)\n \"\n @add-file=\"$emit('add-file')\"\n @start-transcribe=\"$emit('start-transcribe')\"\n @cancel-transcribe=\"$emit('cancel-transcribe')\"\n @finish-transcribe=\"$emit('finish-transcribe')\"\n >\n <template #chat-view=\"slotProps\">\n <slot v-if=\"$slots['chat-view']\" name=\"chat-view\" v-bind=\"slotProps\" />\n <CopilotSidebarView\n v-else\n :messages=\"slotProps.messages\"\n :auto-scroll=\"slotProps.autoScroll\"\n :is-running=\"slotProps.isRunning\"\n :suggestions=\"slotProps.suggestions\"\n :suggestion-loading-indexes=\"slotProps.suggestionLoadingIndexes\"\n :welcome-screen=\"slotProps.welcomeScreen\"\n :input-value=\"slotProps.inputValue\"\n :input-mode=\"slotProps.inputMode\"\n :input-tools-menu=\"slotProps.inputToolsMenu\"\n :width=\"width\"\n :default-open=\"defaultOpen\"\n :on-finish-transcribe-with-audio=\"slotProps.onFinishTranscribeWithAudio\"\n v-bind=\"sidebarViewEventBindings(slotProps)\"\n >\n <template v-if=\"$slots.header\" #header=\"headerProps\">\n <slot name=\"header\" v-bind=\"headerProps\" />\n </template>\n\n <template\n v-if=\"$slots['toggle-button']\"\n #toggle-button=\"toggleButtonProps\"\n >\n <slot name=\"toggle-button\" v-bind=\"toggleButtonProps\" />\n </template>\n\n <template #welcome-screen=\"welcomeScreenProps\">\n <slot\n v-if=\"$slots['welcome-screen']\"\n name=\"welcome-screen\"\n v-bind=\"welcomeScreenProps\"\n />\n <CopilotSidebarWelcomeScreen v-else v-bind=\"welcomeScreenProps\">\n <template v-if=\"$slots['welcome-message']\" #welcome-message>\n <slot name=\"welcome-message\" />\n </template>\n\n <template\n v-if=\"$slots['suggestion-view']\"\n #suggestion-view=\"suggestionViewProps\"\n >\n <slot name=\"suggestion-view\" v-bind=\"suggestionViewProps\" />\n </template>\n\n <template v-if=\"$slots.input\" #input=\"inputProps\">\n <slot name=\"input\" v-bind=\"inputProps\" />\n </template>\n </CopilotSidebarWelcomeScreen>\n </template>\n\n <template\n v-if=\"$slots['message-view']\"\n #message-view=\"messageViewProps\"\n >\n <slot name=\"message-view\" v-bind=\"messageViewProps\" />\n </template>\n\n <template v-if=\"$slots.input\" #input=\"inputProps\">\n <slot name=\"input\" v-bind=\"inputProps\" />\n </template>\n\n <template\n v-if=\"$slots['suggestion-view']\"\n #suggestion-view=\"suggestionViewProps\"\n >\n <slot name=\"suggestion-view\" v-bind=\"suggestionViewProps\" />\n </template>\n </CopilotSidebarView>\n </template>\n </CopilotChat>\n</template>\n","export * from \"./types\";\nexport { default as CopilotChatAssistantMessage } from \"./CopilotChatAssistantMessage.vue\";\nexport { default as CopilotChatAudioRecorder } from \"./CopilotChatAudioRecorder.vue\";\nimport _CopilotChat from \"./CopilotChat.vue\";\nimport _CopilotChatView from \"./CopilotChatView.vue\";\nexport { default as CopilotChatInput } from \"./CopilotChatInput.vue\";\nexport { default as CopilotChatAttachmentQueue } from \"./CopilotChatAttachmentQueue.vue\";\nexport { default as CopilotChatAttachmentRenderer } from \"./CopilotChatAttachmentRenderer.vue\";\nexport { default as CopilotChatMessageView } from \"./CopilotChatMessageView.vue\";\nexport { default as CopilotChatReasoningMessage } from \"./CopilotChatReasoningMessage.vue\";\nexport { default as CopilotChatSuggestionPill } from \"./CopilotChatSuggestionPill.vue\";\nexport { default as CopilotChatSuggestionView } from \"./CopilotChatSuggestionView.vue\";\nexport { default as CopilotChatToolCallsView } from \"./CopilotChatToolCallsView.vue\";\nexport { default as CopilotChatUserMessage } from \"./CopilotChatUserMessage.vue\";\nexport { default as CopilotChatView } from \"./CopilotChatView.vue\";\nimport _CopilotChatToggleButton from \"./CopilotChatToggleButton.vue\";\nimport CopilotChatToggleButtonCloseIcon from \"./CopilotChatToggleButtonCloseIcon\";\nimport CopilotChatToggleButtonOpenIcon from \"./CopilotChatToggleButtonOpenIcon\";\nimport _CopilotModalHeader from \"./CopilotModalHeader.vue\";\nimport CopilotModalHeaderCloseButton from \"./CopilotModalHeaderCloseButton\";\nimport CopilotModalHeaderTitle from \"./CopilotModalHeaderTitle\";\nimport _CopilotPopupView from \"./CopilotPopupView.vue\";\nimport CopilotPopupWelcomeScreen from \"./CopilotPopupWelcomeScreen.vue\";\nimport _CopilotSidebarView from \"./CopilotSidebarView.vue\";\nimport CopilotSidebarWelcomeScreen from \"./CopilotSidebarWelcomeScreen.vue\";\n\nexport const CopilotChat = Object.assign(_CopilotChat, {\n View: _CopilotChatView,\n});\n\nexport const CopilotChatToggleButton = Object.assign(_CopilotChatToggleButton, {\n OpenIcon: CopilotChatToggleButtonOpenIcon,\n CloseIcon: CopilotChatToggleButtonCloseIcon,\n});\n\nexport { CopilotChatToggleButtonOpenIcon, CopilotChatToggleButtonCloseIcon };\n\nexport const CopilotModalHeader = Object.assign(_CopilotModalHeader, {\n Title: CopilotModalHeaderTitle,\n CloseButton: CopilotModalHeaderCloseButton,\n});\n\nexport const CopilotPopupView = Object.assign(_CopilotPopupView, {\n WelcomeScreen: CopilotPopupWelcomeScreen,\n});\n\nexport { default as CopilotPopup } from \"./CopilotPopup.vue\";\nexport { default as CopilotSidebar } from \"./CopilotSidebar.vue\";\n\nexport const CopilotSidebarView = Object.assign(_CopilotSidebarView, {\n WelcomeScreen: CopilotSidebarWelcomeScreen,\n});\n","import { computed, toValue, watch } from \"vue\";\nimport type { MaybeRefOrGetter } from \"vue\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\n\nexport type JsonSerializable =\n | string\n | number\n | boolean\n | null\n | JsonSerializable[]\n | { [key: string]: JsonSerializable };\n\nexport interface AgentContextInput {\n description: MaybeRefOrGetter<string>;\n value: MaybeRefOrGetter<JsonSerializable>;\n}\n\n/**\n * Registers reactive contextual data that is sent with agent runs.\n *\n * The context entry is added when the composable is active and removed\n * automatically on scope cleanup.\n *\n * @example\n * ```ts\n * useAgentContext({\n * description: \"Current workspace\",\n * value: \"copilotkit-vue\",\n * });\n * ```\n */\nexport function useAgentContext(context: AgentContextInput): void {\n const { copilotkit } = useCopilotKit();\n const resolvedDescription = computed(() => toValue(context.description));\n const resolvedValue = computed(() => toValue(context.value));\n\n const stringValue = computed(() =>\n typeof resolvedValue.value === \"string\"\n ? resolvedValue.value\n : JSON.stringify(resolvedValue.value),\n );\n\n watch(\n [() => copilotkit.value, resolvedDescription, stringValue],\n (_newValues, _old, onCleanup) => {\n const core = copilotkit.value;\n const id = core.addContext({\n description: resolvedDescription.value,\n value: stringValue.value,\n });\n onCleanup(() => core.removeContext(id));\n },\n { immediate: true },\n );\n}\n","import { watch } from \"vue\";\nimport type { WatchSource } from \"vue\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport type { VueFrontendTool } from \"../types\";\nimport type { VueToolCallRenderer } from \"../types\";\n\nconst EMPTY_DEPS: WatchSource<unknown>[] = [];\n\n/**\n * Registers a frontend tool and optional renderer with CopilotKit core.\n *\n * The tool registration is reactive to provided dependencies and is cleaned up\n * automatically when the current scope is disposed.\n *\n * @example\n * ```ts\n * useFrontendTool({\n * name: \"sayHello\",\n * parameters: z.object({ name: z.string() }),\n * handler: async ({ name }) => `Hello ${name}`,\n * });\n * ```\n */\nexport function useFrontendTool<T extends Record<string, unknown>>(\n tool: VueFrontendTool<T>,\n deps?: WatchSource<unknown>[],\n) {\n const { copilotkit } = useCopilotKit();\n const extraDeps = deps ?? EMPTY_DEPS;\n\n watch(\n [\n () => tool.name,\n () => tool.available,\n () => extraDeps.length,\n ...extraDeps,\n ],\n (_newValues, _old, onCleanup) => {\n const core = copilotkit.value;\n const name = tool.name;\n\n if (core.getTool({ toolName: name, agentId: tool.agentId })) {\n console.warn(\n `Tool '${name}' already exists for agent '${tool.agentId || \"global\"}'. Overriding with latest registration.`,\n );\n core.removeTool(name, tool.agentId);\n }\n core.addTool(tool);\n\n // The render function is registered even when tool.parameters is\n // undefined — tools like HITL confirm dialogs have no parameters\n // but still need their UI rendered in the chat.\n if (tool.render) {\n core.addHookRenderToolCall({\n name,\n args: tool.parameters,\n agentId: tool.agentId,\n render: tool.render,\n } as VueToolCallRenderer<unknown>);\n }\n\n onCleanup(() => {\n core.removeTool(name, tool.agentId);\n });\n },\n { immediate: true },\n );\n}\n","import type { StandardSchemaV1, InferSchemaOutput } from \"@copilotkit/shared\";\nimport type { Component } from \"vue\";\nimport { h } from \"vue\";\nimport type { WatchSource } from \"vue\";\nimport { useFrontendTool } from \"./use-frontend-tool\";\n\ntype InferRenderProps<T> = T extends StandardSchemaV1\n ? InferSchemaOutput<T>\n : any;\n\nexport function useComponent<\n TSchema extends StandardSchemaV1 | undefined = undefined,\n>(\n config: {\n name: string;\n description?: string;\n parameters?: TSchema;\n render: Component<NoInfer<InferRenderProps<TSchema>>>;\n agentId?: string;\n },\n deps?: WatchSource<unknown>[],\n): void {\n const prefix = `Use this tool to display the \"${config.name}\" component in the chat. This tool renders a visual UI component for the user.`;\n const fullDescription = config.description\n ? `${prefix}\\n\\n${config.description}`\n : prefix;\n\n useFrontendTool(\n {\n name: config.name,\n description: fullDescription,\n parameters: config.parameters as\n | StandardSchemaV1<any, Record<string, unknown>>\n | undefined,\n render: ({ args }: { args: unknown }) => {\n const RenderComponent = config.render;\n return h(\n RenderComponent as Component,\n args as InferRenderProps<TSchema>,\n );\n },\n agentId: config.agentId,\n },\n deps,\n );\n}\n","import { h, watch } from \"vue\";\nimport type { Component, WatchSource, VNodeChild } from \"vue\";\nimport type { StandardSchemaV1, InferSchemaOutput } from \"@copilotkit/shared\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { defineToolCallRenderer } from \"../types/defineToolCallRenderer\";\nimport type {\n VueToolCallRenderer,\n VueToolCallRendererRenderProps,\n} from \"../types\";\n\nconst EMPTY_DEPS: WatchSource<unknown>[] = [];\n\nexport interface RenderToolInProgressProps<S extends StandardSchemaV1> {\n name: string;\n toolCallId: string;\n parameters: Partial<InferSchemaOutput<S>>;\n status: \"inProgress\";\n result: undefined;\n}\n\nexport interface RenderToolExecutingProps<S extends StandardSchemaV1> {\n name: string;\n toolCallId: string;\n parameters: InferSchemaOutput<S>;\n status: \"executing\";\n result: undefined;\n}\n\nexport interface RenderToolCompleteProps<S extends StandardSchemaV1> {\n name: string;\n toolCallId: string;\n parameters: InferSchemaOutput<S>;\n status: \"complete\";\n result: string;\n}\n\nexport type RenderToolProps<S extends StandardSchemaV1> =\n | RenderToolInProgressProps<S>\n | RenderToolExecutingProps<S>\n | RenderToolCompleteProps<S>;\n\ntype RenderToolConfig<S extends StandardSchemaV1> = {\n name: string;\n parameters?: S;\n render:\n | ((props: RenderToolProps<S>) => VNodeChild)\n | Component<RenderToolProps<S>>;\n agentId?: string;\n};\n\nexport function useRenderTool(\n config: {\n name: \"*\";\n render: ((props: any) => VNodeChild) | Component<any>;\n agentId?: string;\n },\n deps?: WatchSource<unknown>[],\n): void;\n\nexport function useRenderTool<S extends StandardSchemaV1>(\n config: {\n name: string;\n parameters: S;\n render:\n | ((props: RenderToolProps<S>) => VNodeChild)\n | Component<RenderToolProps<S>>;\n agentId?: string;\n },\n deps?: WatchSource<unknown>[],\n): void;\n\nexport function useRenderTool<S extends StandardSchemaV1>(\n config: RenderToolConfig<S>,\n deps?: WatchSource<unknown>[],\n): void {\n const { copilotkit } = useCopilotKit();\n const extraDeps = deps ?? EMPTY_DEPS;\n\n watch(\n [\n () => copilotkit.value,\n () => config.name,\n () => config.agentId,\n () => extraDeps.length,\n ...extraDeps,\n ],\n () => {\n const renderTool = (props: RenderToolProps<S>): VNodeChild => {\n if (typeof config.render === \"function\") {\n return (config.render as (props: RenderToolProps<S>) => VNodeChild)(\n props,\n );\n }\n return h(config.render, props);\n };\n\n const renderer =\n config.name === \"*\" && !config.parameters\n ? defineToolCallRenderer({\n name: \"*\",\n render: (props: VueToolCallRendererRenderProps<unknown>) =>\n renderTool({\n ...props,\n parameters: props.args,\n } as RenderToolProps<S>),\n ...(config.agentId ? { agentId: config.agentId } : {}),\n })\n : defineToolCallRenderer({\n name: config.name,\n args: config.parameters!,\n render: (\n props: VueToolCallRendererRenderProps<InferSchemaOutput<S>>,\n ) =>\n renderTool({\n ...props,\n parameters: props.args,\n } as RenderToolProps<S>),\n ...(config.agentId ? { agentId: config.agentId } : {}),\n });\n\n copilotkit.value.addHookRenderToolCall(\n renderer as VueToolCallRenderer<unknown>,\n );\n // Intentionally no cleanup removal to preserve renderers for chat history.\n },\n { immediate: true },\n );\n}\n","import { defineComponent, h, ref } from \"vue\";\nimport type { WatchSource } from \"vue\";\nimport type { Component, VNodeChild } from \"vue\";\nimport { useRenderTool } from \"./use-render-tool\";\n\ntype DefaultRenderProps = {\n name: string;\n toolCallId: string;\n parameters: unknown;\n status: \"inProgress\" | \"executing\" | \"complete\";\n result: string | undefined;\n};\n\nconst DefaultToolCallRenderer = defineComponent({\n props: {\n name: {\n type: String,\n required: true,\n },\n toolCallId: {\n type: String,\n required: true,\n },\n parameters: {\n type: null,\n required: false,\n default: undefined,\n },\n status: {\n type: String as () => \"inProgress\" | \"executing\" | \"complete\",\n required: true,\n },\n result: {\n type: String,\n required: false,\n default: undefined,\n },\n },\n setup(props) {\n const isExpanded = ref(false);\n\n return () => {\n const isActive =\n props.status === \"inProgress\" || props.status === \"executing\";\n const isComplete = props.status === \"complete\";\n const statusLabel = isActive\n ? \"Running\"\n : isComplete\n ? \"Done\"\n : props.status;\n\n return h(\"div\", { style: { marginTop: \"8px\", paddingBottom: \"8px\" } }, [\n h(\n \"div\",\n {\n style: {\n borderRadius: \"12px\",\n border: \"1px solid #e4e4e7\",\n backgroundColor: \"#fafafa\",\n padding: \"14px 16px\",\n },\n },\n [\n h(\n \"button\",\n {\n type: \"button\",\n onClick: () => {\n isExpanded.value = !isExpanded.value;\n },\n style: {\n width: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n gap: \"10px\",\n cursor: \"pointer\",\n border: \"none\",\n padding: 0,\n margin: 0,\n background: \"transparent\",\n textAlign: \"left\",\n },\n },\n [\n h(\"span\", { style: { fontWeight: \"600\" } }, props.name),\n h(\"span\", statusLabel),\n ],\n ),\n isExpanded.value\n ? h(\"div\", { style: { marginTop: \"12px\" } }, [\n h(\"div\", \"Arguments\"),\n h(\"pre\", JSON.stringify(props.parameters ?? {}, null, 2)),\n props.result !== undefined\n ? h(\"div\", [h(\"div\", \"Result\"), h(\"pre\", props.result)])\n : null,\n ])\n : null,\n ],\n ),\n ]);\n };\n },\n});\n\nexport function useDefaultRenderTool(\n config?: {\n render?:\n | ((props: DefaultRenderProps) => VNodeChild)\n | Component<DefaultRenderProps>;\n },\n deps?: WatchSource<unknown>[],\n): void {\n useRenderTool(\n {\n name: \"*\",\n render:\n config?.render ??\n ((props: DefaultRenderProps) =>\n h(DefaultToolCallRenderer, {\n name: props.name,\n toolCallId: props.toolCallId,\n parameters: props.parameters,\n status: props.status,\n result: props.result,\n })),\n },\n deps,\n );\n}\n","import { onScopeDispose, ref } from \"vue\";\nimport type { WatchSource } from \"vue\";\nimport { h } from \"vue\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { useFrontendTool } from \"./use-frontend-tool\";\nimport type {\n VueFrontendTool,\n VueHumanInTheLoop,\n VueToolCallRenderer,\n VueToolCallRendererRenderProps,\n} from \"../types\";\n\n/**\n * Registers a human-in-the-loop frontend tool.\n *\n * The tool pauses execution until `respond` is called from the rendered\n * component during the `executing` phase.\n *\n * @example\n * ```ts\n * useHumanInTheLoop({\n * name: \"approveAction\",\n * parameters: z.object({ reason: z.string() }),\n * render: ApprovalCard,\n * });\n * ```\n */\nexport function useHumanInTheLoop<T extends Record<string, unknown>>(\n tool: VueHumanInTheLoop<T>,\n deps?: WatchSource<unknown>[],\n) {\n const { copilotkit } = useCopilotKit();\n const resolvePromiseRef = ref<((result: unknown) => void) | null>(null);\n\n const respond = async (result: unknown) => {\n if (resolvePromiseRef.value) {\n resolvePromiseRef.value(result);\n resolvePromiseRef.value = null;\n }\n };\n\n const handler = async () => {\n return new Promise((resolve) => {\n resolvePromiseRef.value = resolve;\n });\n };\n\n const RenderComponent: VueToolCallRenderer<T>[\"render\"] = (\n props: VueToolCallRendererRenderProps<T>,\n ) => {\n const ToolComponent = tool.render;\n if (props.status === \"inProgress\") {\n return h(ToolComponent as Parameters<typeof h>[0], {\n ...props,\n name: tool.name,\n description: tool.description || \"\",\n respond: undefined,\n });\n }\n if (props.status === \"executing\") {\n return h(ToolComponent as Parameters<typeof h>[0], {\n ...props,\n name: tool.name,\n description: tool.description || \"\",\n respond,\n });\n }\n if (props.status === \"complete\") {\n return h(ToolComponent as Parameters<typeof h>[0], {\n ...props,\n name: tool.name,\n description: tool.description || \"\",\n respond: undefined,\n });\n }\n return h(ToolComponent as Parameters<typeof h>[0], props);\n };\n\n const frontendTool: VueFrontendTool<T> = {\n ...tool,\n handler,\n render: RenderComponent,\n };\n\n useFrontendTool(frontendTool, deps);\n\n onScopeDispose(() => {\n copilotkit.value.removeHookRenderToolCall(tool.name, tool.agentId);\n });\n}\n","import { computed, ref, watch } from \"vue\";\nimport type { WatchSource } from \"vue\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { useCopilotChatConfiguration } from \"../providers/useCopilotChatConfiguration\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\nimport type {\n DynamicSuggestionsConfig,\n Suggestion,\n StaticSuggestionsConfig,\n SuggestionsConfig,\n} from \"@copilotkit/core\";\n\ntype StaticSuggestionInput = Omit<Suggestion, \"isLoading\"> &\n Partial<Pick<Suggestion, \"isLoading\">>;\n\ntype StaticSuggestionsConfigInput = Omit<\n StaticSuggestionsConfig,\n \"suggestions\"\n> & {\n suggestions: StaticSuggestionInput[];\n};\n\ntype SuggestionsConfigInput =\n | DynamicSuggestionsConfig\n | StaticSuggestionsConfigInput;\n\nfunction isDynamicConfig(\n config: SuggestionsConfigInput,\n): config is DynamicSuggestionsConfig {\n return \"instructions\" in config;\n}\n\nfunction normalizeStaticSuggestions(\n suggestions: StaticSuggestionInput[],\n): Suggestion[] {\n return suggestions.map((s) => ({\n ...s,\n isLoading: s.isLoading ?? false,\n }));\n}\n\n/**\n * Registers a suggestions configuration (dynamic or static) for the current\n * chat context.\n *\n * Configuration is kept in sync reactively and removed on scope cleanup.\n *\n * @example\n * ```ts\n * useConfigureSuggestions({\n * instructions: \"Suggest concise next steps for the user\",\n * available: \"always\",\n * });\n * ```\n */\nexport function useConfigureSuggestions(\n config: SuggestionsConfigInput | null | undefined,\n deps?: WatchSource<unknown>[],\n): void {\n const { copilotkit } = useCopilotKit();\n const chatConfig = useCopilotChatConfiguration();\n const extraDeps = deps ?? [];\n\n const resolvedConsumerAgentId = computed(\n () => chatConfig.value?.agentId ?? DEFAULT_AGENT_ID,\n );\n const rawConsumerAgentId = computed(() =>\n config ? (config as SuggestionsConfigInput).consumerAgentId : undefined,\n );\n\n const normalizedConfig = computed<SuggestionsConfig | null>(() => {\n if (\n !config ||\n (config as { available?: string }).available === \"disabled\"\n ) {\n return null;\n }\n if (isDynamicConfig(config)) {\n return { ...config };\n }\n const normalizedSuggestions = normalizeStaticSuggestions(\n config.suggestions,\n );\n return { ...config, suggestions: normalizedSuggestions };\n });\n const serializedConfig = computed(() =>\n normalizedConfig.value ? JSON.stringify(normalizedConfig.value) : null,\n );\n\n const targetAgentId = computed(() => {\n if (!normalizedConfig.value) return resolvedConsumerAgentId.value;\n const consumer = (\n normalizedConfig.value as\n | StaticSuggestionsConfig\n | DynamicSuggestionsConfig\n ).consumerAgentId;\n if (!consumer || consumer === \"*\") return resolvedConsumerAgentId.value;\n return consumer;\n });\n\n const isGlobalConfig = computed(\n () =>\n rawConsumerAgentId.value === undefined ||\n rawConsumerAgentId.value === \"*\",\n );\n const pendingGlobalReload = ref(false);\n const pendingReloadTimer = ref<ReturnType<typeof setTimeout> | null>(null);\n const previousSerializedConfig = ref<string | null>(null);\n\n const flushPendingGlobalReload = () => {\n if (!pendingGlobalReload.value || !isGlobalConfig.value) {\n return;\n }\n const hasRunning = Object.values(copilotkit.value.agents ?? {}).some(\n (entry) => !!entry.agentId && entry.isRunning,\n );\n if (hasRunning) {\n pendingReloadTimer.value = setTimeout(() => {\n pendingReloadTimer.value = null;\n flushPendingGlobalReload();\n }, 0);\n return;\n }\n\n pendingGlobalReload.value = false;\n requestReload();\n };\n\n const requestReload = () => {\n if (!normalizedConfig.value) {\n return;\n }\n\n if (isGlobalConfig.value) {\n let skippedBecauseRunning = false;\n const agents = Object.values(copilotkit.value.agents ?? {});\n for (const entry of agents) {\n const aid = entry.agentId;\n if (!aid) {\n continue;\n }\n if (!entry.isRunning) {\n copilotkit.value.reloadSuggestions(aid);\n } else {\n skippedBecauseRunning = true;\n }\n }\n pendingGlobalReload.value = skippedBecauseRunning;\n if (skippedBecauseRunning && pendingReloadTimer.value === null) {\n pendingReloadTimer.value = setTimeout(() => {\n pendingReloadTimer.value = null;\n flushPendingGlobalReload();\n }, 0);\n }\n return;\n }\n\n if (targetAgentId.value) {\n copilotkit.value.reloadSuggestions(targetAgentId.value);\n }\n };\n\n watch(\n [() => copilotkit.value, serializedConfig],\n ([_core, serialized], _old, onCleanup) => {\n if (!serialized || !normalizedConfig.value) {\n return;\n }\n\n const core = copilotkit.value;\n const cfg = normalizedConfig.value;\n const id = core.addSuggestionsConfig(cfg);\n requestReload();\n\n onCleanup(() => core.removeSuggestionsConfig(id));\n },\n { immediate: true },\n );\n\n watch(\n [normalizedConfig, serializedConfig],\n ([cfg, serialized]) => {\n if (!cfg) {\n previousSerializedConfig.value = null;\n return;\n }\n\n if (serialized && previousSerializedConfig.value === serialized) {\n return;\n }\n\n if (serialized) {\n previousSerializedConfig.value = serialized;\n }\n\n requestReload();\n },\n { immediate: false },\n );\n\n watch(\n [normalizedConfig, () => extraDeps.length, ...extraDeps],\n ([cfg]) => {\n if (!cfg || extraDeps.length === 0) {\n return;\n }\n requestReload();\n },\n { immediate: true },\n );\n\n watch(\n [() => copilotkit.value, pendingGlobalReload],\n (_vals, _old, onCleanup) => {\n onCleanup(() => {\n if (pendingReloadTimer.value !== null) {\n clearTimeout(pendingReloadTimer.value);\n pendingReloadTimer.value = null;\n }\n });\n },\n { immediate: true },\n );\n\n watch(\n [() => copilotkit.value, isGlobalConfig],\n ([core, global], _old, onCleanup) => {\n if (!global) {\n return;\n }\n\n const agentSubscriptions = Object.values(core.agents ?? {})\n .filter((agent): agent is NonNullable<typeof agent> => !!agent)\n .map((agent) =>\n agent.subscribe({\n onRunStartedEvent: flushPendingGlobalReload,\n onRunFinishedEvent: flushPendingGlobalReload,\n onRunFinalized: flushPendingGlobalReload,\n onRunFailed: flushPendingGlobalReload,\n onRunErrorEvent: flushPendingGlobalReload,\n }),\n );\n\n onCleanup(() => {\n for (const sub of agentSubscriptions) {\n sub.unsubscribe();\n }\n });\n },\n { immediate: true },\n );\n}\n","import { computed, onScopeDispose, shallowRef, watch } from \"vue\";\nimport type { ComputedRef, Ref } from \"vue\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { useAgent } from \"./use-agent\";\nimport type {\n InterruptEvent,\n InterruptHandlerProps,\n InterruptRenderProps,\n} from \"../types/interrupt\";\n\nexport type { InterruptEvent, InterruptHandlerProps, InterruptRenderProps };\n\nconst INTERRUPT_EVENT_NAME = \"on_interrupt\";\n\ntype InterruptHandlerFn<TValue, TResult> = (\n props: InterruptHandlerProps<TValue>,\n) => TResult | PromiseLike<TResult>;\n\ntype InterruptResultFromHandler<THandler> = THandler extends (\n ...args: never[]\n) => infer TResult\n ? TResult extends PromiseLike<infer TResolved>\n ? TResolved | null\n : TResult | null\n : null;\n\ntype InterruptResult<TValue, TResult> = InterruptResultFromHandler<\n InterruptHandlerFn<TValue, TResult>\n>;\n\nexport interface UseInterruptConfig<TValue = unknown, TResult = never> {\n handler?: InterruptHandlerFn<TValue, TResult>;\n enabled?: (event: InterruptEvent<TValue>) => boolean;\n agentId?: string;\n renderInChat?: boolean;\n}\n\nexport interface UseInterruptResult<TValue = unknown, TResult = never> {\n interrupt: Ref<InterruptEvent<TValue> | null>;\n result: Ref<InterruptResult<TValue, TResult>>;\n hasInterrupt: ComputedRef<boolean>;\n resolveInterrupt: (response: unknown) => void;\n slotProps: ComputedRef<InterruptRenderProps<\n TValue,\n InterruptResult<TValue, TResult>\n > | null>;\n}\n\nexport function isPromiseLike<TValue>(\n value: TValue | PromiseLike<TValue>,\n): value is PromiseLike<TValue> {\n return (\n (typeof value === \"object\" || typeof value === \"function\") &&\n value !== null &&\n typeof Reflect.get(value, \"then\") === \"function\"\n );\n}\n\nfunction normalizeAsyncResult<TValue>(\n value: PromiseLike<TValue>,\n): Promise<TValue> {\n if (value instanceof Promise) {\n return value;\n }\n\n return new Promise<TValue>((resolve, reject) => {\n try {\n value.then(resolve, reject);\n } catch (error) {\n reject(error);\n }\n });\n}\n\n/**\n * Vue composable for handling `on_interrupt` custom events from an agent.\n *\n * It tracks the latest pending interrupt, optionally derives UI data via\n * `handler`, and can publish slot state into `CopilotChat` so consumers render\n * interrupts through the `#interrupt` slot instead of render functions/TSX.\n *\n * @example\n * ```ts\n * const { interrupt, hasInterrupt, resolveInterrupt } = useInterrupt({\n * handler: ({ event }) => ({ label: String(event.value) }),\n * });\n * ```\n */\nexport function useInterrupt<TValue = unknown, TResult = never>(\n config: UseInterruptConfig<TValue, TResult> = {},\n): UseInterruptResult<TValue, TResult> {\n const { copilotkit } = useCopilotKit();\n const { agent } = useAgent({ agentId: config.agentId });\n const interrupt = shallowRef<InterruptEvent<TValue> | null>(null);\n const result = shallowRef<InterruptResult<TValue, TResult>>(null);\n\n watch(\n agent,\n (resolvedAgent, _previousAgent, onCleanup) => {\n if (!resolvedAgent) {\n interrupt.value = null;\n result.value = null;\n return;\n }\n\n let localInterrupt: InterruptEvent<TValue> | null = null;\n const subscription = resolvedAgent.subscribe({\n onCustomEvent: ({ event }) => {\n if (event.name === INTERRUPT_EVENT_NAME) {\n localInterrupt = {\n name: event.name,\n value: event.value as TValue,\n };\n }\n },\n onRunStartedEvent: () => {\n localInterrupt = null;\n interrupt.value = null;\n },\n onRunFinalized: () => {\n if (localInterrupt) {\n interrupt.value = localInterrupt;\n localInterrupt = null;\n }\n },\n onRunFailed: () => {\n localInterrupt = null;\n },\n });\n\n onCleanup(() => subscription.unsubscribe());\n },\n { immediate: true },\n );\n\n const resolveInterrupt = (response: unknown) => {\n const resolvedAgent = agent.value;\n if (!resolvedAgent) return;\n\n const interruptEventValue = interrupt.value?.value;\n interrupt.value = null;\n void copilotkit.value\n .runAgent({\n agent: resolvedAgent,\n forwardedProps: {\n command: {\n resume: response,\n interruptEvent: interruptEventValue,\n },\n },\n })\n .catch((error) => {\n console.error(\n \"[CopilotKit] useInterrupt: failed to resume agent:\",\n error,\n );\n });\n };\n\n watch(\n interrupt,\n (pendingEvent, _previous, onCleanup) => {\n if (!pendingEvent) {\n result.value = null;\n return;\n }\n if (config.enabled && !config.enabled(pendingEvent)) {\n result.value = null;\n return;\n }\n const handler = config.handler;\n if (!handler) {\n result.value = null;\n return;\n }\n\n let cancelled = false;\n const maybePromise = handler({\n event: pendingEvent,\n resolve: resolveInterrupt,\n });\n\n if (isPromiseLike(maybePromise)) {\n normalizeAsyncResult(maybePromise)\n .then((resolved) => {\n if (!cancelled) {\n result.value = resolved;\n }\n })\n .catch((err) => {\n if (!cancelled) {\n console.error(\"[CopilotKit] useInterrupt handler failed:\", err);\n result.value = null;\n }\n });\n } else {\n result.value = maybePromise;\n }\n\n onCleanup(() => {\n cancelled = true;\n });\n },\n { immediate: true },\n );\n\n const slotProps = computed<InterruptRenderProps<\n TValue,\n InterruptResult<TValue, TResult>\n > | null>(() => {\n if (!interrupt.value) return null;\n if (config.enabled && !config.enabled(interrupt.value)) return null;\n\n return {\n event: interrupt.value,\n result: result.value,\n resolve: resolveInterrupt,\n };\n });\n\n watch(\n [() => copilotkit.value, slotProps, () => config.renderInChat !== false],\n ([core, nextSlotProps, shouldRenderInChat], _previous, onCleanup) => {\n if (!shouldRenderInChat) {\n return;\n }\n\n core.setInterruptState(\n nextSlotProps as InterruptRenderProps<any, any> | null,\n );\n const publishedState = nextSlotProps;\n\n onCleanup(() => {\n if (core.interruptState === publishedState) {\n core.setInterruptState(null);\n }\n });\n },\n { immediate: true },\n );\n\n onScopeDispose(() => {\n const core = copilotkit.value;\n if (\n config.renderInChat !== false &&\n core.interruptState === slotProps.value\n ) {\n core.setInterruptState(null);\n }\n });\n\n return {\n interrupt: interrupt as Ref<InterruptEvent<TValue> | null>,\n result: result as Ref<InterruptResult<TValue, TResult>>,\n hasInterrupt: computed(() => slotProps.value !== null),\n resolveInterrupt,\n slotProps: slotProps as ComputedRef<InterruptRenderProps<\n TValue,\n InterruptResult<TValue, TResult>\n > | null>,\n };\n}\n","import { computed, onScopeDispose, ref, toValue, watch } from \"vue\";\nimport type { MaybeRefOrGetter, Ref } from \"vue\";\nimport {\n CopilotKitCoreRuntimeConnectionStatus,\n ɵcreateThreadStore,\n ɵselectHasNextPage,\n ɵselectIsFetchingNextPage,\n ɵselectThreads,\n ɵselectThreadsError,\n ɵselectThreadsIsLoading,\n} from \"@copilotkit/core\";\nimport type { ɵThreadRuntimeContext, ɵThreadStore } from \"@copilotkit/core\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\n\nexport interface Thread {\n id: string;\n agentId: string;\n name: string | null;\n archived: boolean;\n createdAt: string;\n updatedAt: string;\n /**\n * ISO-8601 timestamp of the most recent agent run on this thread. Absent\n * when the thread has never been run. Prefer this over `updatedAt` for\n * user-facing \"last activity\" displays — it is not bumped by metadata-only\n * actions like rename or archive.\n */\n lastRunAt?: string;\n}\n\nexport interface UseThreadsInput {\n agentId: MaybeRefOrGetter<string>;\n includeArchived?: MaybeRefOrGetter<boolean | undefined>;\n limit?: MaybeRefOrGetter<number | undefined>;\n}\n\nexport interface UseThreadsResult {\n threads: Ref<Thread[]>;\n isLoading: Ref<boolean>;\n error: Ref<Error | null>;\n hasMoreThreads: Ref<boolean>;\n isFetchingMoreThreads: Ref<boolean>;\n fetchMoreThreads: () => void;\n renameThread: (threadId: string, name: string) => Promise<void>;\n archiveThread: (threadId: string) => Promise<void>;\n deleteThread: (threadId: string) => Promise<void>;\n}\n\nfunction bindThreadStoreSelector<T>(\n store: ɵThreadStore,\n selector: (state: ReturnType<ɵThreadStore[\"getState\"]>) => T,\n target: Ref<T>,\n): void {\n target.value = selector(store.getState());\n const subscription = store.select(selector).subscribe(() => {\n target.value = selector(store.getState());\n });\n onScopeDispose(() => subscription.unsubscribe());\n}\n\n/**\n * Vue composable for listing and managing Intelligence platform threads.\n *\n * The hook fetches threads for the runtime-authenticated user and the given\n * `agentId`, then keeps the result in sync via the core thread store's realtime\n * channel when available. Inputs accept refs/computeds to make thread context\n * changes reactive.\n */\nexport function useThreads(input: UseThreadsInput): UseThreadsResult {\n const { copilotkit } = useCopilotKit();\n const store = ɵcreateThreadStore({\n fetch: globalThis.fetch,\n });\n\n const resolvedAgentId = computed(() => toValue(input.agentId));\n const resolvedIncludeArchived = computed(() =>\n toValue(input.includeArchived),\n );\n const resolvedLimit = computed(() => toValue(input.limit));\n const headersKey = computed(() =>\n JSON.stringify(\n Object.entries(copilotkit.value.headers ?? {}).sort(([left], [right]) =>\n left.localeCompare(right),\n ),\n ),\n );\n\n const threads = ref<Thread[]>([]);\n const storeIsLoading = ref(false);\n const storeError = ref<Error | null>(null);\n const hasMoreThreads = ref(false);\n const isFetchingMoreThreads = ref(false);\n\n bindThreadStoreSelector(store, ɵselectThreads, threads as Ref<Thread[]>);\n bindThreadStoreSelector(store, ɵselectThreadsIsLoading, storeIsLoading);\n bindThreadStoreSelector(store, ɵselectThreadsError, storeError);\n bindThreadStoreSelector(store, ɵselectHasNextPage, hasMoreThreads);\n bindThreadStoreSelector(\n store,\n ɵselectIsFetchingNextPage,\n isFetchingMoreThreads,\n );\n\n store.start();\n onScopeDispose(() => {\n store.stop();\n });\n\n // Tracks whether we've dispatched the first real context to the store.\n // The store itself starts with `isLoading: false`, so before we dispatch\n // consumers would otherwise see an empty, non-loading state (empty-list\n // flash). While runtimeUrl is set and we haven't dispatched yet, we\n // synthesize `isLoading: true` so the UI keeps its loading indicator until\n // the first fetch is in flight (at which point the store's own\n // isLoading takes over).\n const hasDispatchedContext = ref(false);\n\n // Defer setting the context until the runtime reports Connected. Before\n // `/info` resolves we don't know `intelligence.wsUrl`, so dispatching the\n // context early would issue a list fetch with `wsUrl: undefined`, then a\n // second list fetch (and a `/threads/subscribe`) once the flag lands.\n // Waiting lets the hook issue just one `/threads?…` + one `/threads/subscribe`.\n //\n // When `runtimeUrl` is absent we dispatch `null` to clear the store. For\n // transient states (Disconnected/Connecting/Error with a URL still set) we\n // leave the previously-dispatched context in place — any in-flight\n // realtime subscription or cached thread list stays usable while the\n // runtime recovers, and we don't re-trigger a fetch storm on transitions.\n watch(\n [\n () => copilotkit.value.runtimeUrl,\n () => copilotkit.value.runtimeConnectionStatus,\n headersKey,\n () => copilotkit.value.intelligence?.wsUrl,\n resolvedAgentId,\n resolvedIncludeArchived,\n resolvedLimit,\n ],\n ([runtimeUrl, runtimeStatus, , wsUrl, agentId, includeArchived, limit]) => {\n if (!runtimeUrl) {\n store.setContext(null);\n return;\n }\n\n if (runtimeStatus !== CopilotKitCoreRuntimeConnectionStatus.Connected) {\n return;\n }\n\n const context: ɵThreadRuntimeContext = {\n runtimeUrl,\n headers: { ...copilotkit.value.headers },\n wsUrl,\n agentId,\n includeArchived,\n limit,\n };\n\n store.setContext(context);\n hasDispatchedContext.value = true;\n },\n { immediate: true },\n );\n\n const runtimeError = computed<Error | null>(() =>\n copilotkit.value.runtimeUrl\n ? null\n : new Error(\"Runtime URL is not configured\"),\n );\n\n const preConnectLoading = computed(\n () => !!copilotkit.value.runtimeUrl && !hasDispatchedContext.value,\n );\n\n const isLoading = computed(() =>\n runtimeError.value\n ? false\n : preConnectLoading.value || storeIsLoading.value,\n );\n\n const error = computed<Error | null>(\n () => runtimeError.value ?? storeError.value,\n );\n\n return {\n threads: computed(() =>\n threads.value.map(\n ({ id, agentId, name, archived, createdAt, updatedAt, lastRunAt }) => ({\n id,\n agentId,\n name,\n archived,\n createdAt,\n updatedAt,\n ...(lastRunAt !== undefined ? { lastRunAt } : {}),\n }),\n ),\n ),\n isLoading,\n error,\n hasMoreThreads,\n isFetchingMoreThreads,\n fetchMoreThreads: () => store.fetchNextPage(),\n renameThread: (threadId: string, name: string) =>\n store.renameThread(threadId, name),\n archiveThread: (threadId: string) => store.archiveThread(threadId),\n deleteThread: (threadId: string) => store.deleteThread(threadId),\n };\n}\n","import type { AgentCapabilities } from \"@ag-ui/core\";\nimport { computed } from \"vue\";\nimport type { ComputedRef } from \"vue\";\nimport { useAgent } from \"./use-agent\";\n\n/**\n * Returns the capabilities declared by the given agent (or the default agent).\n *\n * Capabilities are populated from the runtime `/info` response at connection\n * time. The composable reads them synchronously from the agent instance — there\n * is no separate loading state, but the value will be `undefined` until the\n * runtime handshake completes.\n *\n * @param agentId - Optional agent ID. If omitted, uses the default agent.\n * @returns A computed ref containing the agent's capabilities, or `undefined`\n * if the agent doesn't declare capabilities.\n */\nexport function useCapabilities(\n agentId?: string,\n): ComputedRef<AgentCapabilities | undefined> {\n const { agent } = useAgent({ agentId });\n\n return computed(() => {\n const a = agent.value;\n if (a && \"capabilities\" in a) {\n return (a as { capabilities?: AgentCapabilities }).capabilities;\n }\n return undefined;\n });\n}\n","import type { Component, VNodeChild } from \"vue\";\nimport type { Message } from \"@ag-ui/core\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { useCopilotChatConfiguration } from \"../providers/useCopilotChatConfiguration\";\nimport type {\n VueCustomMessageRendererPosition,\n VueCustomMessageRendererProps,\n} from \"../types\";\n\ninterface UseRenderCustomMessagesParams {\n message: Message;\n position: VueCustomMessageRendererPosition;\n}\n\ninterface CustomMessageRendererResult {\n renderer:\n | Component<VueCustomMessageRendererProps>\n | ((props: VueCustomMessageRendererProps) => VNodeChild);\n props: VueCustomMessageRendererProps;\n}\n\n/**\n * Returns a function that resolves the appropriate custom message renderer for\n * a given message and position.\n *\n * Matches the React `useRenderCustomMessages` API: filters registered\n * renderers by the current agent, preferring agent-scoped renderers over\n * global ones, and computes the full renderer props (runId, indices, state\n * snapshot).\n *\n * The returned function yields `null` if no chat configuration is available\n * (i.e. when called outside a `CopilotChat` component tree) or if no\n * matching renderer is found.\n */\nexport function useRenderCustomMessages() {\n const { copilotkit } = useCopilotKit();\n const config = useCopilotChatConfiguration();\n\n return function renderCustomMessage(\n params: UseRenderCustomMessagesParams,\n ): CustomMessageRendererResult | null {\n const configValue = config.value;\n if (!configValue) return null;\n\n const agentId = configValue.agentId || DEFAULT_AGENT_ID;\n const { threadId } = configValue;\n const core = copilotkit.value;\n\n const customMessageRenderers = [...core.renderCustomMessages]\n .filter(\n (renderer) =>\n renderer.agentId === undefined || renderer.agentId === agentId,\n )\n .sort((a, b) => {\n const aHasAgent = a.agentId !== undefined;\n const bHasAgent = b.agentId !== undefined;\n if (aHasAgent === bHasAgent) return 0;\n return aHasAgent ? -1 : 1;\n });\n\n if (!customMessageRenderers.length) {\n return null;\n }\n\n const { message, position } = params;\n const resolvedRunId =\n core.getRunIdForMessage(agentId, threadId, message.id) ??\n core.getRunIdsForThread(agentId, threadId).slice(-1)[0];\n const runId = resolvedRunId ?? `missing-run-id:${message.id}`;\n const agent = core.getAgent(agentId);\n if (!agent) {\n return null;\n }\n\n const messagesIdsInRun = resolvedRunId\n ? agent.messages\n .filter(\n (msg) =>\n core.getRunIdForMessage(agentId, threadId, msg.id) ===\n resolvedRunId,\n )\n .map((msg) => msg.id)\n : [message.id];\n\n const rawMessageIndex = agent.messages.findIndex(\n (msg) => msg.id === message.id,\n );\n if (rawMessageIndex < 0) {\n console.warn(\n `[CopilotKit] useRenderCustomMessages: message \"${message.id}\" ` +\n `not found in agent \"${agentId}\" messages`,\n );\n }\n const messageIndex = Math.max(0, rawMessageIndex);\n const messageIndexInRun = resolvedRunId\n ? Math.max(messagesIdsInRun.indexOf(message.id), 0)\n : 0;\n const numberOfMessagesInRun = resolvedRunId ? messagesIdsInRun.length : 1;\n const stateSnapshot = resolvedRunId\n ? core.getStateByRun(agentId, threadId, resolvedRunId)\n : undefined;\n\n const props: CustomMessageRendererResult[\"props\"] = {\n message,\n position,\n runId,\n messageIndex,\n messageIndexInRun,\n numberOfMessagesInRun,\n agentId,\n stateSnapshot,\n };\n\n // Iterate renderers like React: try each one and use the first that\n // returns a non-null render function.\n for (const candidate of customMessageRenderers) {\n if (!candidate.render) {\n continue;\n }\n return {\n renderer: candidate.render as CustomMessageRendererResult[\"renderer\"],\n props,\n };\n }\n\n return null;\n };\n}\n","import { computed } from \"vue\";\nimport type { Component } from \"vue\";\nimport type { ActivityMessage } from \"@ag-ui/core\";\nimport type { AbstractAgent } from \"@ag-ui/client\";\nimport { DEFAULT_AGENT_ID } from \"@copilotkit/shared\";\nimport { useCopilotKit } from \"../providers/useCopilotKit\";\nimport { useCopilotChatConfiguration } from \"../providers/useCopilotChatConfiguration\";\nimport type {\n VueActivityMessageRenderer,\n VueActivityMessageRendererProps,\n} from \"../types\";\n\ninterface ActivityRendererResult {\n renderer: Component<VueActivityMessageRendererProps<unknown>>;\n props: VueActivityMessageRendererProps<unknown>;\n}\n\n/**\n * Returns helpers for rendering activity messages.\n *\n * Matches the React `useRenderActivityMessage` API: `findRenderer` locates a\n * registered renderer by activity type (preferring agent-scoped over global,\n * with `\"*\"` as a wildcard fallback), and `renderActivityMessage` resolves the\n * renderer and validates the content schema.\n */\nexport function useRenderActivityMessage() {\n const { copilotkit } = useCopilotKit();\n const config = useCopilotChatConfiguration();\n const agentId = computed(() => config.value?.agentId ?? DEFAULT_AGENT_ID);\n\n const renderers = computed(() => [\n ...copilotkit.value.renderActivityMessages,\n ]);\n\n function findRenderer(\n activityType: string,\n ): VueActivityMessageRenderer<unknown> | null {\n const list = renderers.value;\n if (!list.length) {\n return null;\n }\n\n const matches = list.filter(\n (renderer) => renderer.activityType === activityType,\n );\n\n return (\n matches.find((candidate) => candidate.agentId === agentId.value) ??\n matches.find((candidate) => candidate.agentId === undefined) ??\n list.find((candidate) => candidate.activityType === \"*\") ??\n null\n );\n }\n\n function renderActivityMessage(\n message: ActivityMessage,\n ): ActivityRendererResult | null {\n const renderer = findRenderer(message.activityType);\n\n if (!renderer) {\n return null;\n }\n\n const parseResult = renderer.content.safeParse(message.content);\n\n if (!parseResult.success) {\n console.warn(\n `Failed to parse content for activity message ` +\n `'${message.activityType}':`,\n parseResult.error,\n );\n return null;\n }\n\n const agent: AbstractAgent | undefined = copilotkit.value.getAgent(\n agentId.value,\n );\n\n return {\n renderer: renderer.render as Component<\n VueActivityMessageRendererProps<unknown>\n >,\n props: {\n activityType: message.activityType,\n content: parseResult.data,\n message,\n agent,\n },\n };\n }\n\n return { renderActivityMessage, findRenderer };\n}\n"],"names":["props","__props","attrs","useAttrs","inspectorTag","shallowRef","isMounted","onMounted","mod","error","onUnmounted","_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","CopilotKitKey","CopilotChatConfigurationKey","SandboxFunctionsKey","useCopilotKit","context","inject","PROTOCOL_VERSION","buildSandboxHTML","extraCspDomains","baseScriptSrc","baseFrameSrc","extra","scriptSrc","frameSrc","MCPAppsRequestQueue","agent","request","threadId","resolve","reject","queue","item","result","done","timeout","checkInterval","sub","finish","mcpAppsRequestQueue","MCPAppsActivityType","MCPAppsActivityContentSchema","z","isRequest","message","isNotification","MCPAppsActivityRenderer","defineComponent","copilotkit","containerRef","ref","iframeRef","iframeReady","isLoading","iframeSize","fetchedResource","fetchStateRef","sendToIframe","sendResponse","id","sendErrorResponse","code","sendNotification","method","params","watch","content","resourceUri","serverHash","serverId","resource","err","fetchPromise","loading","_old","onCleanup","container","mounted","messageHandler","initialListener","createdIframe","iframe","sandboxReady","event","cspDomains","msg","currentAgent","role","textContent","part","randomUUID","url","runResult","width","height","html","size","ready","toolInput","borderStyle","computed","onBeforeUnmount","h","A2UISurfaceActivityType","A2UIActivityContentSchema","getOperationSurfaceId","operation","CopilotKitCoreVue","CopilotKitCore","config","renderers","subscriber","merged","rc","key","renderToolCalls","entry","name","agentId","vueSubscriber","interruptState","nextTick","A2UI_OPERATIONS_KEY","DefaultA2UILoading","barWidths","i","createA2UIMessageRenderer","options","operations","A2UISurfaceActivityRenderer","defineToolCallRenderer","def","argsSchema","RENDER_A2UI_TOOL_NAME","registerA2UIBuiltInToolCallRenderer","enabled","core","isEnabled","_prev","renderer","status","parameters","items","components","renderA2UIProgressIndicator","existing","current","progressState","state","now","tokens","chars","phase","dot","spacer","bar","w","ht","bg","anim","opacity","transition","row","show","delay","children","createVueComponent","api","renderFn","setupState","VueWrapper","wrapperProps","resolvedProps","binder","initBinder","GenericBinder","newProps","newContext","LEAF_MARGIN","CONTAINER_PADDING","STANDARD_BORDER","STANDARD_RADIUS","mapJustify","j","mapAlign","a","getBaseLeafStyle","getBaseContainerStyle","renderChildList","childList","buildChild","node","v","a2uiIdCounter","useA2UIUniqueId","Text","TextApi","text","style","Image","ImageApi","mapFit","fit","Icon","IconApi","iconName","Video","VideoApi","AudioPlayer","AudioPlayerApi","Row","RowApi","Column","ColumnApi","List","ListApi","isHorizontal","Card","CardApi","Tabs","TabsApi","tabs","tab","title","Divider","DividerApi","isVertical","Modal","ModalApi","e","Button","ButtonApi","TextField","TextFieldApi","uniqueId","isLong","type","inputStyle","hasError","CheckBox","CheckBoxApi","ChoicePicker","ChoicePickerApi","values","isMutuallyExclusive","onToggle","val","newValues","opt","isSelected","label","Slider","SliderApi","DateTimeInput","DateTimeInputApi","vueBasicComponents","vueBasicCatalog","Catalog","BASIC_FUNCTIONS","A2UI_SCHEMA_CONTEXT_DESCRIPTION","buildCatalogContextValue","catalog","resolved","BASIC_CATALOG_ID","lines","isSuperset","customNames","comp","jsonSchema","zodToJsonSchema","extractCatalogComponentSchemas","zodSchema","registerA2UICatalogContext","contextValue","value","schemaValue","schema","ids","A2UI_DEFAULT_GENERATION_GUIDELINES","A2UI_DEFAULT_DESIGN_GUIDELINES","extractCompleteStyles","matches","processPartialHtml","bodyMatch","useSandboxFunctions","functionsRef","OpenGenerativeUIActivityType","OpenGenerativeUIContentSchema","GenerateSandboxedUiArgsSchema","shouldFlushImmediately","previous","next","ensureHead","injectCssIntoHtml","css","headCloseIdx","loadWebsandbox","OpenGenerativeUIRenderer","sandboxFunctions","throttledContent","latestContent","throttleTimer","sandboxRef","previewSandboxRef","previewReady","executedExpressionIndex","jsFunctionsInjected","pendingQueue","localApi","fn","partialHtml","previewBody","previewStyles","fullHtml","hasPreview","hasVisibleSandbox","resolvedHeight","destroyPreview","destroyFinal","previewVisible","htmlComplete","_previous","cancelled","Websandbox","sandbox","body","styles","cssText","headParts","htmlWithHead","htmlWithCss","functionsCode","expressions","startIndex","newExpressions","expression","isGenerating","OpenGenerativeUIActivityRenderer","OpenGenerativeUIToolRenderer","visibleMessageIndex","messages","_","ToolCallStatus","timer","currentMessage","LicenseContextKey","createDefaultLicenseRef","createLicenseContextValue","LICENSE_BANNER_OFFSET_PX","LICENSE_BANNER_OFFSET_VAR","emit","__emit","spec","days","baseStyle","severityStyle","containerStyle","instance","getCurrentInstance","hasDismissListener","handleDismiss","_createElementBlock","_createElementVNode","_toDisplayString","_hoisted_1","_hoisted_2","HEADER_NAME","COPILOT_CLOUD_CHAT_URL","FRONTEND_TOOLS_STABLE_WARNING","HUMAN_IN_THE_LOOP_STABLE_WARNING","RENDER_CUSTOM_MESSAGES_STABLE_WARNING","RENDER_ACTIVITY_MESSAGES_STABLE_WARNING","SANDBOX_FUNCTIONS_STABLE_WARNING","DEFAULT_DESIGN_SKILL","GENERATE_SANDBOXED_UI_DESCRIPTION","viewerTheme","shouldRenderInspector","updateInspectorVisibility","localhostHosts","initialFrontendTools","initialHumanInTheLoop","initialRenderCustomMessages","initialRenderActivityMessages","initialSandboxFunctions","resolvedPublicKey","mergedAgents","hasLocalAgents","resolvedHeaders","mergedHeaders","headers","chatApiEndpoint","endpoint","publicKey","localAgents","processedHumanInTheLoop","tools","tool","allTools","t","builtInFrontendTools","allRenderToolCalls","combined","args","allRenderCustomMessages","runtimeA2UIEnabled","runtimeOpenGenerativeUIEnabled","runtimeLicenseStatus","openGenerativeUIActive","zodToJsonSchemaCompat","builtInActivityRenderers","allRenderActivityMessages","applyDefaultThrottleMs","createCopilotKit","didMountRef","executingToolCallIds","sub1","toolCallId","triggerRef","sub2","sub3","sub4","sub5","renderCustomMessages","renderActivityMessages","syncRuntimeConfig","a2uiTheme","a2uiCatalog","a2uiLoadingComponent","a2uiIncludeSchema","providerContextIds","active","functions","designSkill","descriptors","schemaToJsonSchema","provide","licenseContextValue","showNoLicenseBanner","showExpiredBanner","showInvalidBanner","showExpiringBanner","_renderSlot","_ctx","CopilotKitInspector","LicenseWarningBanner","CopilotChatDefaultLabels","shallowEqualObjects","first","second","firstKeys","secondKeys","isPlainObject","useShallowStableRef","stable","toValue","parentConfig","parentConfigValue","stableLabels","mergedLabels","resolvedAgentId","DEFAULT_AGENT_ID","fallbackThreadId","resolvedThreadId","resolvedHasExplicitThreadId","shouldCreateModalState","resolvedDefaultOpen","internalModalOpen","setInternalModalOpen","open","resolvedIsModalOpen","resolvedSetModalOpen","configurationValue","useLicenseContext","source","useCopilotChatConfiguration","injected","DeferredChild","version","delId","childId","specificPath","path","componentModel","compImpl","ComponentContext","A2uiSurface","DEFAULT_SURFACE_ID","processorRef","lastOpsHash","getOrCreateProcessor","MessageProcessor","action","handleAction","a2uiAction","rest","processOperations","hash","processor","grouped","op","surfaceId","ops","filtered","hasOperations","surfaceEntries","entries","surface","_hoisted_3","_Fragment","_renderList","_hoisted_5","_createVNode","findToolMessage","getSlotName","toolName","isExecutingToolCall","getToolResultContent","getRenderProps","toolCall","toolMessage","parsedArgs","partialJSONParse","isExecuting","getCoreRenderProps","getCoreRenderConfig","exactMatches","renderConfig","_cache","useKatexStyles","tableIconButtonClass","tableMenuClass","tableMenuItemClass","codeActionButtonClass","labels","copied","copiedResetTimeout","vnodeProps","toolbarButtonClass","extractFileNameFromUrl","fallback","pathname","triggerDownload","href","fileName","anchor","extractTableData","table","cell","rows","toDelimitedTable","data","delimiter","escapeCell","needsQuotes","escaped","toMarkdownTable","separator","triggerBlobDownload","mimeType","blob","MarkdownImage","imageProps","handleDownload","response","objectUrl","imageAttrs","IconDownload","MarkdownTable","slots","wrapperRef","showCopyMenu","showDownloadMenu","tableCopied","tableCopiedResetTimeout","closeMenus","setTableCopiedStateWithDelay","findTable","getTableData","copyTableAs","format","downloadTableAs","handleClickOutside","target","tableAttrs","IconCheck","IconCopy","codeLanguageExtensionMap","CodeBlockCopyAction","actionProps","isCopied","resetTimeout","handleClick","CodeBlockDownloadAction","extension","markdownComponents","normalizeContent","normalizedContent","hasContent","hasListener","listenerName","listener","hasThumbsUp","hasThumbsDown","hasReadAloud","hasRegenerate","isLatestAssistantMessage","shouldShowToolbar","resetCopiedStateWithDelay","handleCopyMessage","handleThumbsUp","handleThumbsDown","handleReadAloud","handleRegenerate","$slots","$attrs","StreamMarkdown","CopilotChatToolCallsView","slotName","_withCtx","slotProps","_normalizeProps","_guardReactiveProps","IconThumbsUp","IconThumbsDown","IconVolume2","IconRefreshCw","AudioRecorderError","canvasRef","recorderState","mediaRecorderRef","streamRef","analyserRef","audioContextRef","animationIdRef","audioChunksRef","amplitudeHistoryRef","scrollOffsetRef","smoothedAmplitudeRef","fadeOpacityRef","cleanup","recorder","track","audioContext","start","stream","analyser","stop","audioBlob","calculateAmplitude","dataArray","sum","index","sample","drawFrame","canvas","rect","dpr","barWidth","barSpacing","maxBars","bufferLength","rawAmplitude","speed","computedStyle","centerY","maxAmplitude","edgeFadeWidth","amplitude","scaledAmplitude","barHeight","x","y","edgeOpacity","__expose","linkStyle","UseAgentUpdate","ALL_UPDATES","cloneForThread","clone","HttpAgent","globalThreadCloneMap","getThreadClone","registryAgent","getOrCreateThreadClone","byThread","useAgent","chatConfig","updateFlags","providerThrottleMs","hookThrottleMs","subscriptionAgent","provisionalAgentCache","createProvisionalAgent","runtimeUrl","transport","provisional","ProxiedCopilotRuntimeAgent","resolveAgent","cacheKey","resolvedAgent","shouldForceUpdate","isRuntimeConfigured","CopilotKitCoreRuntimeConnectionStatus","cached","knownAgents","runtimePart","b","flags","f","batchScheduled","batchedRefresh","handlers","subscription","useSuggestions","suggestions","initState","_newValues","changedAgentId","s","useAttachments","attachments","dragOver","fileInputRef","configRef","attachmentsRef","setAttachments","updateAttachments","updater","processFiles","files","accept","maxSize","rejectedFiles","file","matchesAcceptFilter","validFiles","exceedsMaxSize","formatFileSize","modality","getModalityFromMimeType","placeholderId","uploadMetadata","uploadResult","metadata","uploadSource","readFileAsBase64","thumbnail","generateVideoThumbnail","attachment","handleFileUpload","handleDragOver","handleDragLeave","handleDrop","removeAttachment","consumeAttachments","handlePaste","fileItems","blobToBase64","reader","isTranscriptionErrorResponse","parseTranscriptionError","TranscriptionError","info","transcribeAudio","filename","TranscriptionErrorCode","base64Audio","formData","errorData","useKeyboardHeight","initialHeight","isKeyboardOpen","keyboardHeight","availableHeight","viewportHeight","updateKeyboardState","visualViewport","layoutHeight","visualHeight","nextKeyboardHeight","nextIsOpen","readonly","DEFAULT_LAST_USER_MESSAGE_STATE","LastUserMessageKey","createDefaultLastUserMessageRef","usePinToSend","scrollRef","contentRef","spacerRef","topOffset","lastUserMessage","lastNonce","currentSpacerHeight","raf","ro","teardown","sendNonce","scrollEl","contentEl","spacerEl","targetEl","userMessageHeight","paddingTop","bubbleHeight","spacerHeight","targetTop","computeOffsetTop","contentHeight","targetOffsetWithinContent","consumedBelow","remaining","el","stopAt","elRect","stopRect","shellRef","textareaRef","gridRef","addButtonContainerRef","actionsContainerRef","slashMenuRef","addMenuRef","audioRecorderRef","localValue","isComposing","layout","commandQuery","slashHighlightIndex","previousCommandQuery","addMenuOpen","measurements","resizeEvaluationRafRef","ignoreResizeRef","measurementCanvasRef","containerCacheRef","didWarnMissingFontRef","didWarnMissingCanvasContextRef","resizeObserver","documentPointerDownHandler","isControlled","inputValue","resolvedPlaceholder","isExpanded","isProcessing","shouldShowDisclaimer","hasSubmitAction","hasStopAction","hasAddFileAction","hasStartTranscribeAction","hasCancelTranscribeAction","hasFinishTranscribeAction","canSend","sendDisabled","containerClass","rootAttrs","isMenuGroup","createDefaultAddItem","normalizeMenuItems","addItem","menuEntry","menuItems","hasMenuItems","flattenMenuForCommands","seen","commands","walk","entryList","commandItems","flattenMenuDisplay","depth","prefix","menuDisplayItems","filteredCommands","normalized","startsWith","contains","command","slashMenuVisible","updateInputValue","nextValue","clearInputValue","updateSlashState","firstLine","runCommand","submit","trimmed","handleInput","handleSendButtonClick","handleKeydown","selected","toggleAddMenu","closeAddMenu","handleMenuAction","handleFinishTranscribe","handleContainerClick","ensureMeasurements","textarea","previousValue","previousHeight","paddingLeft","paddingRight","paddingBottom","singleLineHeight","maxHeight","adjustTextareaHeight","scrollHeight","updateLayout","nextLayout","resolveTextareaFont","textareaStyles","fallbackFont","updateContainerCache","grid","addContainer","actionsContainer","gridStyles","columnGap","gridAvailableWidth","addWidth","actionsWidth","compactWidth","cache","evaluateLayout","baseline","hasExplicitBreak","renderedMultiline","shouldExpand","compactInnerWidth","resolvedFont","longestLine","line","scheduleLayoutEvaluation","invalidateCache","query","filteredCount","mode","disabled","containerTargets","shouldInvalidate","_normalizeClass","IconPlus","_normalizeStyle","IconChevronRight","$event","_hoisted_6","CopilotChatAudioRecorder","_hoisted_7","IconLoader2","_hoisted_9","_withModifiers","_hoisted_10","IconX","IconMic","_hoisted_14","IconSquare","IconArrowUp","_hoisted_16","activeLightboxAttachment","documentBlobUrl","isLightboxOpen","isPreviewableDocument","isPdf","isText","decodedTextPreview","lightboxDocumentSource","blobUrl","createBlobUrl","closeLightbox","openLightbox","withTransition","cardClassName","base64Value","binary","bytes","getSourceUrl","_hoisted_11","_hoisted_13","getDocumentIcon","_hoisted_15","_hoisted_17","_hoisted_18","_Teleport","_hoisted_22","_hoisted_23","_hoisted_25","_hoisted_26","_hoisted_27","_hoisted_28","_hoisted_29","formatDuration","seconds","mins","secs","isLatest","isStreaming","elapsed","isOpen","userToggledDuringStreaming","startTimeMs","elapsedInterval","clearElapsedInterval","updateElapsedNow","nextIsStreaming","toggleOpen","_hoisted_4","_hoisted_8","flattenUserMessageContent","flattenedContent","isMultiline","hasEditAction","showBranchNavigation","canGoPrev","canGoNext","handleEditMessage","payload","switchToBranch","branchIndex","goPrev","goNext","IconEdit","IconChevronLeft","stateTick","componentSlots","useSlots","forwardedSlotNames","resolvedThreadAgent","_agentId","nextInterruptState","deduplicateMessages","byId","toolCalls","deduplicatedMessages","lastMessage","showCursor","messageCount","deduplicatedCount","getMeta","resolvedRunId","runId","messageIdsInRun","rawMessageIndex","messageIndex","messageIndexInRun","numberOfMessagesInRun","stateSnapshot","getActivitySlotName","activityType","resolveCustomMessageRenderer","position","aHasAgent","bHasAgent","resolveActivityRenderer","aScoped","bScoped","parsed","CopilotChatAssistantMessage","CopilotChatUserMessage","_createSlots","CopilotChatReasoningMessage","isDisabled","loadingSet","containerAttrs","_className","suggestion","handleSelectSuggestion","CopilotChatSuggestionPill","_createTextVNode","VALID","normalizeAutoScroll","SCROLL_BUTTON_OFFSET","SCROLL_BOTTOM_THRESHOLD","scrollContainerRef","scrollContentRef","inputContainerRef","inputContainerHeight","isAtBottom","isControlledInput","localInputValue","autoScrollMode","isPinToBottomMode","isPinToSendMode","effectiveKeyboardHeight","resolvedInputValue","hasSuggestions","hasAttachments","forwardedMessageViewSlotNames","shouldShowWelcomeScreen","hasFinishTranscribeWithAudioAction","messagePaddingBottom","showScrollToBottomButton","inputResizeObserver","contentResizeObserver","attachInputOverlayObserver","wasAtBottom","measured","syncInputContainerHeight","updateIsAtBottom","scrollToBottom","attachScrollContentObserver","element","distance","behavior","handleScroll","handleInputValueChange","handleSubmitMessage","handleStop","handleAddFile","handleStartTranscribe","handleCancelTranscribe","handleFinishTranscribeWithAudio","inputEventProps","listeners","CopilotChatAttachmentQueue","CopilotChatInput","CopilotChatSuggestionView","CopilotChatMessageView","IconChevronDown","existingConfig","forwardedChatViewSlotNames","generatedThreadId","transcribeMode","transcriptionError","isTranscribing","isUnmounting","activeConnectCycle","providedThreadId","hasExplicitThreadId","lastConnectedThreadId","isConnecting","resolvedLabels","autoSuggestions","license","isChatLicensed","licensed","isTranscriptionEnabled","isMediaRecorderSupported","showTranscription","attachmentsEnabled","attachmentContainerRef","effectiveMode","runLifecycleTick","isRunning","shouldAllowStop","lastUserMessageId","prevLastUserMessageId","lastUserMessageState","inheritedThreadId","previousValues","onError","isExplicit","abstractAgentPrototype","AbstractAgent","inspectableAgent","hasCustomConnect","hasCustomConnectAgent","existingCycle","hasSameDeps","cycle","connectAbortController","AGUIConnectNotImplementedError","cb","activeCycle","runCurrentAgent","readyAttachments","contentParts","stopCurrentRun","abortError","handleInputChange","trimmedPrevious","retryable","chatViewSlotProps","defaultChatViewBindings","CopilotChatConfigurationProvider","InlineFeatureWarning","CopilotChatView","imageLoadFailed","sourceUrl","documentLabel","CopilotChatToggleButtonCloseIcon","className","CopilotChatToggleButtonOpenIcon","IconMessageCircle","iconClass","iconWrapperBase","fallbackOpen","ariaLabel","buttonClass","buttonAttrs","_onClick","iconTransitionStyle","setModalOpen","getClickListeners","CopilotModalHeaderCloseButton","CopilotModalHeaderTitle","resolvedTitle","headerClass","headerAttrs","handleClose","DEFAULT_POPUP_WIDTH","DEFAULT_POPUP_HEIGHT","POPUP_ANIMATION_MS","isRendered","isAnimatingOut","animationTimer","focusTimer","isPopupOpen","headerTitle","popupAnimationClass","popupStyle","dimensionToCss","closePopup","openPopup","togglePopup","chatViewEventProps","chatViewBindings","handleKeyDown","allowClose","handlePointerDown","CopilotChatToggleButton","CopilotModalHeader","internalProps","_defaultOpen","forwardedEventListeners","internalBindings","CopilotPopupViewInternal","inputSlotProps","suggestionViewSlotProps","layoutSlotProps","DEFAULT_SIDEBAR_WIDTH","SIDEBAR_TRANSITION_MS","sidebarRef","measuredSidebarWidth","isSidebarOpen","resolvedSidebarWidth","asideClass","asideAttrs","asideStyle","widthToCss","bodyMarginStyle","widthToMargin","updateMeasuredWidth","nextWidth","closeSidebar","openSidebar","toggleSidebar","CopilotSidebarViewInternal","popupViewEventBindings","isPopupLicensed","CopilotChat","$emit","CopilotPopupView","welcomeScreenProps","CopilotPopupWelcomeScreen","suggestionViewProps","inputProps","headerProps","toggleButtonProps","messageViewProps","sidebarViewEventBindings","isSidebarLicensed","CopilotSidebarView","CopilotSidebarWelcomeScreen","_CopilotChat","_CopilotChatView","_CopilotChatToggleButton","_CopilotModalHeader","_CopilotPopupView","_CopilotSidebarView","useAgentContext","resolvedDescription","resolvedValue","stringValue","EMPTY_DEPS","useFrontendTool","deps","extraDeps","useComponent","fullDescription","RenderComponent","useRenderTool","renderTool","DefaultToolCallRenderer","isActive","isComplete","statusLabel","useDefaultRenderTool","useHumanInTheLoop","resolvePromiseRef","respond","frontendTool","ToolComponent","onScopeDispose","isDynamicConfig","normalizeStaticSuggestions","useConfigureSuggestions","resolvedConsumerAgentId","rawConsumerAgentId","normalizedConfig","normalizedSuggestions","serializedConfig","targetAgentId","consumer","isGlobalConfig","pendingGlobalReload","pendingReloadTimer","previousSerializedConfig","flushPendingGlobalReload","requestReload","skippedBecauseRunning","agents","aid","_core","serialized","cfg","_vals","global","agentSubscriptions","INTERRUPT_EVENT_NAME","isPromiseLike","normalizeAsyncResult","useInterrupt","interrupt","_previousAgent","localInterrupt","resolveInterrupt","interruptEventValue","pendingEvent","handler","maybePromise","nextSlotProps","shouldRenderInChat","publishedState","bindThreadStoreSelector","store","selector","useThreads","input","ɵcreateThreadStore","resolvedIncludeArchived","resolvedLimit","headersKey","left","right","threads","storeIsLoading","storeError","hasMoreThreads","isFetchingMoreThreads","ɵselectThreads","ɵselectThreadsIsLoading","ɵselectThreadsError","ɵselectHasNextPage","ɵselectIsFetchingNextPage","hasDispatchedContext","runtimeStatus","wsUrl","includeArchived","limit","runtimeError","preConnectLoading","archived","createdAt","updatedAt","lastRunAt","useCapabilities","useRenderCustomMessages","configValue","customMessageRenderers","messagesIdsInRun","candidate","useRenderActivityMessage","findRenderer","list","renderActivityMessage","parseResult"],"mappings":"q3BAQA,MAAMA,EAAQC,EAIRC,EAAQC,EAAAA,SAAA,EACRC,EAAeC,EAAAA,WAA0B,IAAI,EAEnD,IAAIC,EAAY,GAEhBC,OAAAA,EAAAA,UAAU,IAAM,CACT,OAAO,2BAA2B,EACpC,KAAMC,GAAQ,CACbA,EAAI,qBAAA,EACCF,IACLF,EAAa,MAAQI,EAAI,kBAC3B,CAAC,EACA,MAAOC,GAAmB,CACzB,QAAQ,MAAM,uCAAwCA,CAAK,CAC7D,CAAC,CACL,CAAC,EAEDC,EAAAA,YAAY,IAAM,CAChBJ,EAAY,EACd,CAAC,SAMSF,EAAA,OAFRO,EAAAA,UAAA,EAAAC,EAAAA,YAKEC,EAAAA,wBAJKT,EAAA,KAAY,EADnBU,EAAAA,WAKE,QAFQC,EAAAA,MAAAb,CAAA,EAAK,CACZ,QAAWF,EAAM,MAAI,IAAA,sDCxBbgB,UACJ,YAAY,EAERC,UAEF,0BAA0B,EAExBC,UAEF,kBAAkB,ECrBtB,SAASC,IAAgB,CAC9B,MAAMC,EAAUC,EAAAA,OAAOL,EAAa,EACpC,GAAI,CAACI,EACH,MAAM,IAAI,MAAM,sDAAsD,EAGxE,OAAOA,CACT,CCFA,MAAME,GAAmB,aAEzB,SAASC,GAAiBC,EAAoC,CAC5D,MAAMC,EACJ,6GACIC,EAAe,uDACfC,EAAQH,GAAiB,OAAS,IAAIA,EAAgB,KAAK,GAAG,CAAC,GAAK,GACpEI,EAAY,GAAGH,CAAa,GAAGE,CAAK,GACpCE,EAAW,GAAGH,CAAY,GAAGC,CAAK,GAExC,MAAO;AAAA;AAAA;AAAA;AAAA,6KAIoKC,CAAS,uEAAuEC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