@copilotkit/vue 1.57.1
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/AGENTS.md +50 -0
- package/CHANGELOG.md +13 -0
- package/PARITY.md +434 -0
- package/README.md +396 -0
- package/dist/components/copilot-provider/CopilotKit.vue.d.ts +20 -0
- package/dist/components/copilot-provider/CopilotKit.vue.d.ts.map +1 -0
- package/dist/components/copilot-provider/index.d.ts +3 -0
- package/dist/components/copilot-provider/index.d.ts.map +1 -0
- package/dist/components/copilot-provider/types.d.ts +22 -0
- package/dist/components/copilot-provider/types.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/use-copilot-action.d.ts +27 -0
- package/dist/hooks/use-copilot-action.d.ts.map +1 -0
- package/dist/hooks/use-copilot-readable.d.ts +20 -0
- package/dist/hooks/use-copilot-readable.d.ts.map +1 -0
- package/dist/hooks/use-frontend-tool.d.ts +21 -0
- package/dist/hooks/use-frontend-tool.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +10 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +252 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/use-render-activity-message-BRL1Rpl-.cjs +85 -0
- package/dist/use-render-activity-message-BRL1Rpl-.cjs.map +1 -0
- package/dist/use-render-activity-message-CqtxiFSs.js +8927 -0
- package/dist/use-render-activity-message-CqtxiFSs.js.map +1 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts +9 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -0
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts +16 -0
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -0
- package/dist/v2/components/CopilotKitInspector.vue.d.ts +7 -0
- package/dist/v2/components/CopilotKitInspector.vue.d.ts.map +1 -0
- package/dist/v2/components/InlineFeatureWarning.vue.d.ts +6 -0
- package/dist/v2/components/InlineFeatureWarning.vue.d.ts.map +1 -0
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts +18 -0
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -0
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts +88 -0
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts.map +1 -0
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +154 -0
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -0
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +19 -0
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -0
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +16 -0
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -0
- package/dist/v2/components/a2ui/VueSurface.d.ts +62 -0
- package/dist/v2/components/a2ui/VueSurface.d.ts.map +1 -0
- package/dist/v2/components/a2ui/adapter.d.ts +38 -0
- package/dist/v2/components/a2ui/adapter.d.ts.map +1 -0
- package/dist/v2/components/a2ui/catalog.d.ts +29 -0
- package/dist/v2/components/a2ui/catalog.d.ts.map +1 -0
- package/dist/v2/components/a2ui/index.d.ts +5 -0
- package/dist/v2/components/a2ui/index.d.ts.map +1 -0
- package/dist/v2/components/a2ui/utils.d.ts +18 -0
- package/dist/v2/components/a2ui/utils.d.ts.map +1 -0
- package/dist/v2/components/a2ui.d.ts +12 -0
- package/dist/v2/components/a2ui.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChat.vue.d.ts +50 -0
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts +164 -0
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts +12 -0
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts +7 -0
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts +12 -0
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +290 -0
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +72 -0
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts +65 -0
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatSuggestionPill.vue.d.ts +27 -0
- package/dist/v2/components/chat/CopilotChatSuggestionPill.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatSuggestionView.vue.d.ts +26 -0
- package/dist/v2/components/chat/CopilotChatSuggestionView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToggleButton.vue.d.ts +17 -0
- package/dist/v2/components/chat/CopilotChatToggleButton.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToggleButtonCloseIcon.d.ts +5 -0
- package/dist/v2/components/chat/CopilotChatToggleButtonCloseIcon.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToggleButtonOpenIcon.d.ts +5 -0
- package/dist/v2/components/chat/CopilotChatToggleButtonOpenIcon.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +21 -0
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts +34 -0
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +106 -0
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts +15 -0
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts +5 -0
- package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotModalHeaderTitle.d.ts +5 -0
- package/dist/v2/components/chat/CopilotModalHeaderTitle.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts +50 -0
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +55 -0
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +55 -0
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotPopupWelcomeScreen.vue.d.ts +28 -0
- package/dist/v2/components/chat/CopilotPopupWelcomeScreen.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +48 -0
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +62 -0
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +53 -0
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotSidebarWelcomeScreen.vue.d.ts +28 -0
- package/dist/v2/components/chat/CopilotSidebarWelcomeScreen.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/audioRecorder.d.ts +11 -0
- package/dist/v2/components/chat/audioRecorder.d.ts.map +1 -0
- package/dist/v2/components/chat/index.d.ts +682 -0
- package/dist/v2/components/chat/index.d.ts.map +1 -0
- package/dist/v2/components/chat/last-user-message-context.d.ts +29 -0
- package/dist/v2/components/chat/last-user-message-context.d.ts.map +1 -0
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts +3 -0
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts.map +1 -0
- package/dist/v2/components/chat/types.d.ts +380 -0
- package/dist/v2/components/chat/types.d.ts.map +1 -0
- package/dist/v2/components/icons/index.d.ts +2 -0
- package/dist/v2/components/icons/index.d.ts.map +1 -0
- package/dist/v2/components/index.d.ts +8 -0
- package/dist/v2/components/index.d.ts.map +1 -0
- package/dist/v2/hooks/index.d.ts +24 -0
- package/dist/v2/hooks/index.d.ts.map +1 -0
- package/dist/v2/hooks/use-agent-context.d.ts +24 -0
- package/dist/v2/hooks/use-agent-context.d.ts.map +1 -0
- package/dist/v2/hooks/use-agent.d.ts +53 -0
- package/dist/v2/hooks/use-agent.d.ts.map +1 -0
- package/dist/v2/hooks/use-attachments.d.ts +21 -0
- package/dist/v2/hooks/use-attachments.d.ts.map +1 -0
- package/dist/v2/hooks/use-capabilities.d.ts +16 -0
- package/dist/v2/hooks/use-capabilities.d.ts.map +1 -0
- package/dist/v2/hooks/use-component.d.ts +13 -0
- package/dist/v2/hooks/use-component.d.ts.map +1 -0
- package/dist/v2/hooks/use-configure-suggestions.d.ts +24 -0
- package/dist/v2/hooks/use-configure-suggestions.d.ts.map +1 -0
- package/dist/v2/hooks/use-default-render-tool.d.ts +14 -0
- package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts +19 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -0
- package/dist/v2/hooks/use-human-in-the-loop.d.ts +19 -0
- package/dist/v2/hooks/use-human-in-the-loop.d.ts.map +1 -0
- package/dist/v2/hooks/use-interrupt.d.ts +36 -0
- package/dist/v2/hooks/use-interrupt.d.ts.map +1 -0
- package/dist/v2/hooks/use-katex-styles.d.ts +22 -0
- package/dist/v2/hooks/use-katex-styles.d.ts.map +1 -0
- package/dist/v2/hooks/use-keyboard-height.d.ts +33 -0
- package/dist/v2/hooks/use-keyboard-height.d.ts.map +1 -0
- package/dist/v2/hooks/use-pin-to-send.d.ts +28 -0
- package/dist/v2/hooks/use-pin-to-send.d.ts.map +1 -0
- package/dist/v2/hooks/use-render-activity-message.d.ts +21 -0
- package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -0
- package/dist/v2/hooks/use-render-custom-messages.d.ts +27 -0
- package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -0
- package/dist/v2/hooks/use-render-tool.d.ts +36 -0
- package/dist/v2/hooks/use-render-tool.d.ts.map +1 -0
- package/dist/v2/hooks/use-suggestions.d.ts +26 -0
- package/dist/v2/hooks/use-suggestions.d.ts.map +1 -0
- package/dist/v2/hooks/use-threads.d.ts +42 -0
- package/dist/v2/hooks/use-threads.d.ts.map +1 -0
- package/dist/v2/index.cjs +2 -0
- package/dist/v2/index.cjs.map +1 -0
- package/dist/v2/index.d.cts +9 -0
- package/dist/v2/index.d.mts +9 -0
- package/dist/v2/index.d.ts +9 -0
- package/dist/v2/index.d.ts.map +1 -0
- package/dist/v2/index.mjs +75 -0
- package/dist/v2/index.mjs.map +1 -0
- package/dist/v2/lib/processPartialHtml.d.ts +3 -0
- package/dist/v2/lib/processPartialHtml.d.ts.map +1 -0
- package/dist/v2/lib/shallow-stable.d.ts +7 -0
- package/dist/v2/lib/shallow-stable.d.ts.map +1 -0
- package/dist/v2/lib/transcription-client.d.ts +19 -0
- package/dist/v2/lib/transcription-client.d.ts.map +1 -0
- package/dist/v2/lib/vue-core.d.ts +47 -0
- package/dist/v2/lib/vue-core.d.ts.map +1 -0
- package/dist/v2/providers/CopilotChatConfigurationProvider.types.d.ts +15 -0
- package/dist/v2/providers/CopilotChatConfigurationProvider.types.d.ts.map +1 -0
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts +17 -0
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -0
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +61 -0
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -0
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +37 -0
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -0
- package/dist/v2/providers/SandboxFunctionsContext.d.ts +4 -0
- package/dist/v2/providers/SandboxFunctionsContext.d.ts.map +1 -0
- package/dist/v2/providers/index.d.ts +13 -0
- package/dist/v2/providers/index.d.ts.map +1 -0
- package/dist/v2/providers/keys.d.ts +17 -0
- package/dist/v2/providers/keys.d.ts.map +1 -0
- package/dist/v2/providers/license-context.d.ts +7 -0
- package/dist/v2/providers/license-context.d.ts.map +1 -0
- package/dist/v2/providers/types.d.ts +38 -0
- package/dist/v2/providers/types.d.ts.map +1 -0
- package/dist/v2/providers/useCopilotChatConfiguration.d.ts +4 -0
- package/dist/v2/providers/useCopilotChatConfiguration.d.ts.map +1 -0
- package/dist/v2/providers/useCopilotKit.d.ts +2 -0
- package/dist/v2/providers/useCopilotKit.d.ts.map +1 -0
- package/dist/v2/providers/useLicenseContext.d.ts +14 -0
- package/dist/v2/providers/useLicenseContext.d.ts.map +1 -0
- package/dist/v2/types/a2ui.d.ts +5 -0
- package/dist/v2/types/a2ui.d.ts.map +1 -0
- package/dist/v2/types/defineToolCallRenderer.d.ts +15 -0
- package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -0
- package/dist/v2/types/frontend-tool.d.ts +6 -0
- package/dist/v2/types/frontend-tool.d.ts.map +1 -0
- package/dist/v2/types/human-in-the-loop.d.ts +29 -0
- package/dist/v2/types/human-in-the-loop.d.ts.map +1 -0
- package/dist/v2/types/index.d.ts +10 -0
- package/dist/v2/types/index.d.ts.map +1 -0
- package/dist/v2/types/interrupt.d.ts +14 -0
- package/dist/v2/types/interrupt.d.ts.map +1 -0
- package/dist/v2/types/sandbox-function.d.ts +8 -0
- package/dist/v2/types/sandbox-function.d.ts.map +1 -0
- package/dist/v2/types/vue-activity-message-renderer.d.ts +18 -0
- package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -0
- package/dist/v2/types/vue-custom-message-renderer.d.ts +19 -0
- package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -0
- package/dist/v2/types/vue-tool-call-renderer.d.ts +37 -0
- package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -0
- package/env.d.ts +7 -0
- package/eslint.config.mjs +42 -0
- package/package.json +130 -0
- package/scripts/scope-preflight.mjs +100 -0
- package/src/components/copilot-provider/CopilotKit.vue +18 -0
- package/src/components/copilot-provider/index.ts +2 -0
- package/src/components/copilot-provider/types.ts +24 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/use-copilot-action.ts +168 -0
- package/src/hooks/use-copilot-readable.ts +75 -0
- package/src/hooks/use-frontend-tool.ts +76 -0
- package/src/index.ts +12 -0
- package/src/styles/globals.css +314 -0
- package/src/v2/__tests__/exports.test.ts +35 -0
- package/src/v2/__tests__/mocks/web-inspector.ts +5 -0
- package/src/v2/__tests__/setup.ts +141 -0
- package/src/v2/__tests__/utils/agents.ts +391 -0
- package/src/v2/__tests__/utils/mount.ts +83 -0
- package/src/v2/__tests__/utils/test-helpers.ts +712 -0
- package/src/v2/components/A2UIMessageRenderer.ts +125 -0
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +186 -0
- package/src/v2/components/CopilotKitInspector.vue +42 -0
- package/src/v2/components/InlineFeatureWarning.vue +35 -0
- package/src/v2/components/LicenseWarningBanner.vue +196 -0
- package/src/v2/components/MCPAppsActivityRenderer.ts +778 -0
- package/src/v2/components/OpenGenerativeUIRenderer.ts +550 -0
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +271 -0
- package/src/v2/components/__tests__/CopilotKitInspector.test.ts +57 -0
- package/src/v2/components/__tests__/MCPAppsActivityRenderer.e2e.test.ts +851 -0
- package/src/v2/components/__tests__/MCPAppsActivityRenderer.test.ts +237 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +516 -0
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +295 -0
- package/src/v2/components/a2ui/A2UICatalogContext.ts +190 -0
- package/src/v2/components/a2ui/VueSurface.ts +144 -0
- package/src/v2/components/a2ui/adapter.ts +156 -0
- package/src/v2/components/a2ui/catalog.ts +858 -0
- package/src/v2/components/a2ui/index.ts +7 -0
- package/src/v2/components/a2ui/utils.ts +67 -0
- package/src/v2/components/a2ui.ts +30 -0
- package/src/v2/components/chat/CopilotChat.vue +777 -0
- package/src/v2/components/chat/CopilotChatAssistantMessage.vue +891 -0
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +411 -0
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +87 -0
- package/src/v2/components/chat/CopilotChatAudioRecorder.vue +269 -0
- package/src/v2/components/chat/CopilotChatInput.vue +1271 -0
- package/src/v2/components/chat/CopilotChatMessageView.vue +476 -0
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +247 -0
- package/src/v2/components/chat/CopilotChatSuggestionPill.vue +56 -0
- package/src/v2/components/chat/CopilotChatSuggestionView.vue +93 -0
- package/src/v2/components/chat/CopilotChatToggleButton.vue +145 -0
- package/src/v2/components/chat/CopilotChatToggleButtonCloseIcon.ts +17 -0
- package/src/v2/components/chat/CopilotChatToggleButtonOpenIcon.ts +18 -0
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +161 -0
- package/src/v2/components/chat/CopilotChatUserMessage.vue +322 -0
- package/src/v2/components/chat/CopilotChatView.vue +740 -0
- package/src/v2/components/chat/CopilotModalHeader.vue +73 -0
- package/src/v2/components/chat/CopilotModalHeaderCloseButton.ts +38 -0
- package/src/v2/components/chat/CopilotModalHeaderTitle.ts +22 -0
- package/src/v2/components/chat/CopilotPopup.vue +182 -0
- package/src/v2/components/chat/CopilotPopupView.vue +168 -0
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +453 -0
- package/src/v2/components/chat/CopilotPopupWelcomeScreen.vue +140 -0
- package/src/v2/components/chat/CopilotSidebar.vue +178 -0
- package/src/v2/components/chat/CopilotSidebarView.vue +172 -0
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +366 -0
- package/src/v2/components/chat/CopilotSidebarWelcomeScreen.vue +142 -0
- package/src/v2/components/chat/__tests__/CopilotChat.attachments.test.ts +237 -0
- package/src/v2/components/chat/__tests__/CopilotChat.e2e.test.ts +1240 -0
- package/src/v2/components/chat/__tests__/CopilotChat.licenseWarning.test.ts +138 -0
- package/src/v2/components/chat/__tests__/CopilotChat.onError.test.ts +85 -0
- package/src/v2/components/chat/__tests__/CopilotChat.slots.e2e.test.ts +141 -0
- package/src/v2/components/chat/__tests__/CopilotChat.test.ts +652 -0
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +683 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.slots.e2e.test.ts +768 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.ts +1108 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.thumbs.test.ts +87 -0
- package/src/v2/components/chat/__tests__/CopilotChatAttachmentQueue.test.ts +277 -0
- package/src/v2/components/chat/__tests__/CopilotChatAttachmentRenderer.test.ts +124 -0
- package/src/v2/components/chat/__tests__/CopilotChatCopyButton.clipboard.test.ts +230 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.bottomAnchored.test.ts +83 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.slots.e2e.test.ts +1139 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +1051 -0
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.slots.e2e.test.ts +141 -0
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +494 -0
- package/src/v2/components/chat/__tests__/CopilotChatPropsRerender.e2e.test.ts +181 -0
- package/src/v2/components/chat/__tests__/CopilotChatReasoningMessage.test.ts +73 -0
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionPill.test.ts +73 -0
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.slots.e2e.test.ts +674 -0
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.test.ts +91 -0
- package/src/v2/components/chat/__tests__/CopilotChatToggleButton.test.ts +93 -0
- package/src/v2/components/chat/__tests__/CopilotChatToolCallsView.test.ts +382 -0
- package/src/v2/components/chat/__tests__/CopilotChatToolRendering.e2e.test.ts +1019 -0
- package/src/v2/components/chat/__tests__/CopilotChatToolRerenders.e2e.test.ts +516 -0
- package/src/v2/components/chat/__tests__/CopilotChatUserMessage.slots.e2e.test.ts +701 -0
- package/src/v2/components/chat/__tests__/CopilotChatUserMessage.test.ts +337 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.connectingGate.test.ts +135 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.inputOverlay.test.ts +278 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.onClick.e2e.test.ts +1082 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.pinToSend.test.ts +166 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.slots.e2e.test.ts +1145 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.test.ts +374 -0
- package/src/v2/components/chat/__tests__/CopilotModalHeader.slots.e2e.test.ts +636 -0
- package/src/v2/components/chat/__tests__/CopilotModalHeader.test.ts +112 -0
- package/src/v2/components/chat/__tests__/CopilotPopup.test.ts +58 -0
- package/src/v2/components/chat/__tests__/CopilotPopupView.slots.e2e.test.ts +725 -0
- package/src/v2/components/chat/__tests__/CopilotPopupView.test.ts +112 -0
- package/src/v2/components/chat/__tests__/CopilotSidebar.test.ts +58 -0
- package/src/v2/components/chat/__tests__/CopilotSidebarView.slots.e2e.test.ts +603 -0
- package/src/v2/components/chat/__tests__/CopilotSidebarView.test.ts +214 -0
- package/src/v2/components/chat/__tests__/MCPAppsUiMessage.e2e.test.ts +394 -0
- package/src/v2/components/chat/__tests__/copilot-chat-throttle.test.ts +82 -0
- package/src/v2/components/chat/__tests__/normalize-auto-scroll.test.ts +39 -0
- package/src/v2/components/chat/audioRecorder.ts +15 -0
- package/src/v2/components/chat/index.ts +52 -0
- package/src/v2/components/chat/last-user-message-context.ts +39 -0
- package/src/v2/components/chat/normalize-auto-scroll.ts +17 -0
- package/src/v2/components/chat/types.ts +481 -0
- package/src/v2/components/icons/__tests__/icons.test.ts +86 -0
- package/src/v2/components/icons/index.ts +22 -0
- package/src/v2/components/index.ts +7 -0
- package/src/v2/hooks/__tests__/standard-schema-types.test.ts +149 -0
- package/src/v2/hooks/__tests__/standard-schema.test.ts +315 -0
- package/src/v2/hooks/__tests__/use-agent-context-timing.e2e.test.ts +144 -0
- package/src/v2/hooks/__tests__/use-agent-context.test.ts +271 -0
- package/src/v2/hooks/__tests__/use-agent-error-state.test.ts +64 -0
- package/src/v2/hooks/__tests__/use-agent-stability.test.ts +268 -0
- package/src/v2/hooks/__tests__/use-agent-thread-isolation.test.ts +433 -0
- package/src/v2/hooks/__tests__/use-agent-throttle.test.ts +747 -0
- package/src/v2/hooks/__tests__/use-agent.e2e.test.ts +187 -0
- package/src/v2/hooks/__tests__/use-agent.test.ts +126 -0
- package/src/v2/hooks/__tests__/use-attachments.test.ts +181 -0
- package/src/v2/hooks/__tests__/use-component.test.ts +145 -0
- package/src/v2/hooks/__tests__/use-configure-suggestions.e2e.test.ts +527 -0
- package/src/v2/hooks/__tests__/use-configure-suggestions.test.ts +399 -0
- package/src/v2/hooks/__tests__/use-default-render-tool.test.ts +214 -0
- package/src/v2/hooks/__tests__/use-frontend-tool-available.test.ts +220 -0
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +2320 -0
- package/src/v2/hooks/__tests__/use-frontend-tool.test.ts +648 -0
- package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.ts +1379 -0
- package/src/v2/hooks/__tests__/use-human-in-the-loop.test.ts +282 -0
- package/src/v2/hooks/__tests__/use-interrupt.test.ts +345 -0
- package/src/v2/hooks/__tests__/use-katex-styles.test.ts +69 -0
- package/src/v2/hooks/__tests__/use-keyboard-height.test.ts +199 -0
- package/src/v2/hooks/__tests__/use-pin-to-send.test.ts +363 -0
- package/src/v2/hooks/__tests__/use-render-tool.test.ts +329 -0
- package/src/v2/hooks/__tests__/use-suggestions.e2e.test.ts +397 -0
- package/src/v2/hooks/__tests__/use-suggestions.test.ts +198 -0
- package/src/v2/hooks/__tests__/use-threads.test.ts +1041 -0
- package/src/v2/hooks/__tests__/zod-regression.test.ts +339 -0
- package/src/v2/hooks/index.ts +29 -0
- package/src/v2/hooks/use-agent-context.ts +55 -0
- package/src/v2/hooks/use-agent.ts +345 -0
- package/src/v2/hooks/use-attachments.ts +261 -0
- package/src/v2/hooks/use-capabilities.ts +30 -0
- package/src/v2/hooks/use-component.ts +46 -0
- package/src/v2/hooks/use-configure-suggestions.ts +252 -0
- package/src/v2/hooks/use-default-render-tool.ts +130 -0
- package/src/v2/hooks/use-frontend-tool.ts +68 -0
- package/src/v2/hooks/use-human-in-the-loop.ts +90 -0
- package/src/v2/hooks/use-interrupt.ts +257 -0
- package/src/v2/hooks/use-katex-styles.ts +44 -0
- package/src/v2/hooks/use-keyboard-height.ts +87 -0
- package/src/v2/hooks/use-pin-to-send.ts +160 -0
- package/src/v2/hooks/use-render-activity-message.ts +92 -0
- package/src/v2/hooks/use-render-custom-messages.ts +129 -0
- package/src/v2/hooks/use-render-tool.ts +128 -0
- package/src/v2/hooks/use-suggestions.ts +98 -0
- package/src/v2/hooks/use-threads.ts +208 -0
- package/src/v2/index.ts +11 -0
- package/src/v2/lib/__tests__/processPartialHtml.test.ts +84 -0
- package/src/v2/lib/__tests__/transcription-client.test.ts +65 -0
- package/src/v2/lib/processPartialHtml.ts +21 -0
- package/src/v2/lib/shallow-stable.ts +54 -0
- package/src/v2/lib/transcription-client.ts +151 -0
- package/src/v2/lib/vue-core.ts +161 -0
- package/src/v2/providers/CopilotChatConfigurationProvider.types.ts +15 -0
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +95 -0
- package/src/v2/providers/CopilotKitProvider.types.ts +66 -0
- package/src/v2/providers/CopilotKitProvider.vue +653 -0
- package/src/v2/providers/SandboxFunctionsContext.ts +11 -0
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.ts +309 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.debug.test.ts +295 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.license.test.ts +110 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.onError.test.ts +67 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.renderCustomMessages.e2e.test.ts +901 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.ts +141 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.stability.test.ts +871 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +603 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.wildcard.test.ts +104 -0
- package/src/v2/providers/index.ts +21 -0
- package/src/v2/providers/keys.ts +25 -0
- package/src/v2/providers/license-context.ts +16 -0
- package/src/v2/providers/types.ts +40 -0
- package/src/v2/providers/useCopilotChatConfiguration.ts +11 -0
- package/src/v2/providers/useCopilotKit.ts +11 -0
- package/src/v2/providers/useLicenseContext.ts +21 -0
- package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +157 -0
- package/src/v2/types/a2ui.ts +5 -0
- package/src/v2/types/defineToolCallRenderer.ts +32 -0
- package/src/v2/types/frontend-tool.ts +8 -0
- package/src/v2/types/human-in-the-loop.ts +38 -0
- package/src/v2/types/index.ts +9 -0
- package/src/v2/types/interrupt.ts +15 -0
- package/src/v2/types/sandbox-function.ts +8 -0
- package/src/v2/types/vue-activity-message-renderer.ts +22 -0
- package/src/v2/types/vue-custom-message-renderer.ts +24 -0
- package/src/v2/types/vue-tool-call-renderer.ts +44 -0
- package/tsconfig.json +27 -0
- package/vite.config.ts +49 -0
- package/vitest.config.ts +23 -0
|
@@ -0,0 +1,851 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cleanup,
|
|
3
|
+
fireEvent,
|
|
4
|
+
render,
|
|
5
|
+
screen,
|
|
6
|
+
waitFor,
|
|
7
|
+
} from "@testing-library/vue";
|
|
8
|
+
import { defineComponent, nextTick } from "vue";
|
|
9
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
10
|
+
import { AbstractAgent, EventType } from "@ag-ui/client";
|
|
11
|
+
import type { BaseEvent, RunAgentInput, RunAgentResult } from "@ag-ui/client";
|
|
12
|
+
import { Observable, Subject } from "rxjs";
|
|
13
|
+
import CopilotChat from "../chat/CopilotChat.vue";
|
|
14
|
+
import CopilotKitProvider from "../../providers/CopilotKitProvider.vue";
|
|
15
|
+
import CopilotChatConfigurationProvider from "../../providers/CopilotChatConfigurationProvider.vue";
|
|
16
|
+
import {
|
|
17
|
+
MCPAppsActivityContentSchema,
|
|
18
|
+
MCPAppsActivityType,
|
|
19
|
+
} from "../MCPAppsActivityRenderer";
|
|
20
|
+
import {
|
|
21
|
+
activitySnapshotEvent,
|
|
22
|
+
runFinishedEvent,
|
|
23
|
+
runStartedEvent,
|
|
24
|
+
} from "../../__tests__/utils/test-helpers";
|
|
25
|
+
|
|
26
|
+
class MockMCPProxyAgent extends AbstractAgent {
|
|
27
|
+
private readonly subject = new Subject<BaseEvent>();
|
|
28
|
+
private bufferedEvents: BaseEvent[] = [];
|
|
29
|
+
public runAgentCalls: Array<{ input: Partial<RunAgentInput> }> = [];
|
|
30
|
+
private readonly runAgentResponses = new Map<string, unknown>();
|
|
31
|
+
|
|
32
|
+
setRunAgentResponse(method: string, response: unknown): void {
|
|
33
|
+
this.runAgentResponses.set(method, response);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async emit(event: BaseEvent): Promise<void> {
|
|
37
|
+
if (event.type === EventType.RUN_STARTED) {
|
|
38
|
+
this.isRunning = true;
|
|
39
|
+
} else if (
|
|
40
|
+
event.type === EventType.RUN_FINISHED ||
|
|
41
|
+
event.type === EventType.RUN_ERROR
|
|
42
|
+
) {
|
|
43
|
+
this.isRunning = false;
|
|
44
|
+
}
|
|
45
|
+
if (this.subject.observers.length === 0) {
|
|
46
|
+
this.bufferedEvents.push(event);
|
|
47
|
+
} else {
|
|
48
|
+
this.subject.next(event);
|
|
49
|
+
}
|
|
50
|
+
await flushVueUpdates();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
clone(): MockMCPProxyAgent {
|
|
54
|
+
const cloned = new MockMCPProxyAgent();
|
|
55
|
+
cloned.agentId = this.agentId;
|
|
56
|
+
type Internal = {
|
|
57
|
+
subject: Subject<BaseEvent>;
|
|
58
|
+
bufferedEvents: BaseEvent[];
|
|
59
|
+
runAgentCalls: Array<{ input: Partial<RunAgentInput> }>;
|
|
60
|
+
runAgentResponses: Map<string, unknown>;
|
|
61
|
+
};
|
|
62
|
+
(cloned as unknown as Internal).subject = (
|
|
63
|
+
this as unknown as Internal
|
|
64
|
+
).subject;
|
|
65
|
+
(cloned as unknown as Internal).bufferedEvents = (
|
|
66
|
+
this as unknown as Internal
|
|
67
|
+
).bufferedEvents;
|
|
68
|
+
(cloned as unknown as Internal).runAgentCalls = (
|
|
69
|
+
this as unknown as Internal
|
|
70
|
+
).runAgentCalls;
|
|
71
|
+
(cloned as unknown as Internal).runAgentResponses = (
|
|
72
|
+
this as unknown as Internal
|
|
73
|
+
).runAgentResponses;
|
|
74
|
+
|
|
75
|
+
const registry = this;
|
|
76
|
+
Object.defineProperty(cloned, "isRunning", {
|
|
77
|
+
get() {
|
|
78
|
+
return registry.isRunning;
|
|
79
|
+
},
|
|
80
|
+
set(v: boolean) {
|
|
81
|
+
registry.isRunning = v;
|
|
82
|
+
},
|
|
83
|
+
configurable: true,
|
|
84
|
+
enumerable: true,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const proto = MockMCPProxyAgent.prototype;
|
|
88
|
+
cloned.runAgent = async function (
|
|
89
|
+
input?: Partial<RunAgentInput>,
|
|
90
|
+
): Promise<RunAgentResult> {
|
|
91
|
+
const proxiedRequest = input?.forwardedProps?.__proxiedMCPRequest;
|
|
92
|
+
if (proxiedRequest) {
|
|
93
|
+
return registry.runAgent(input);
|
|
94
|
+
}
|
|
95
|
+
return proto.runAgent.call(cloned, input);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return cloned;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
run(_input: RunAgentInput): Observable<BaseEvent> {
|
|
102
|
+
return new Observable<BaseEvent>((observer) => {
|
|
103
|
+
if (this.bufferedEvents.length > 0) {
|
|
104
|
+
for (const event of this.bufferedEvents) {
|
|
105
|
+
observer.next(event);
|
|
106
|
+
}
|
|
107
|
+
this.bufferedEvents = [];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const subscription = this.subject.subscribe(observer);
|
|
111
|
+
return () => subscription.unsubscribe();
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async runAgent(input?: Partial<RunAgentInput>): Promise<RunAgentResult> {
|
|
116
|
+
const proxiedRequest = input?.forwardedProps?.__proxiedMCPRequest as
|
|
117
|
+
| {
|
|
118
|
+
serverHash?: string;
|
|
119
|
+
serverId?: string;
|
|
120
|
+
method: string;
|
|
121
|
+
params?: Record<string, unknown>;
|
|
122
|
+
}
|
|
123
|
+
| undefined;
|
|
124
|
+
|
|
125
|
+
if (proxiedRequest) {
|
|
126
|
+
if (input) {
|
|
127
|
+
this.runAgentCalls.push({ input });
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const method = proxiedRequest.method;
|
|
131
|
+
const response = this.runAgentResponses.get(method);
|
|
132
|
+
if (response !== undefined) {
|
|
133
|
+
return { result: response, newMessages: [] };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (method === "resources/read") {
|
|
137
|
+
return {
|
|
138
|
+
result: {
|
|
139
|
+
contents: [
|
|
140
|
+
{
|
|
141
|
+
uri: proxiedRequest.params?.uri,
|
|
142
|
+
mimeType: "text/html",
|
|
143
|
+
text: "<html><body>Test content</body></html>",
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
newMessages: [],
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (method === "tools/call") {
|
|
152
|
+
return {
|
|
153
|
+
result: {
|
|
154
|
+
content: [{ type: "text", text: "Tool call result" }],
|
|
155
|
+
isError: false,
|
|
156
|
+
},
|
|
157
|
+
newMessages: [],
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return { result: {}, newMessages: [] };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return super.runAgent(input);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
async function flushVueUpdates(): Promise<void> {
|
|
169
|
+
await nextTick();
|
|
170
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function mcpAppsActivityContent(overrides: {
|
|
174
|
+
resourceUri?: string;
|
|
175
|
+
serverHash?: string;
|
|
176
|
+
serverId?: string;
|
|
177
|
+
toolInput?: Record<string, unknown>;
|
|
178
|
+
result?: {
|
|
179
|
+
content?: unknown[];
|
|
180
|
+
structuredContent?: unknown;
|
|
181
|
+
isError?: boolean;
|
|
182
|
+
};
|
|
183
|
+
}) {
|
|
184
|
+
return {
|
|
185
|
+
resourceUri: overrides.resourceUri ?? "ui://test-server/test-resource",
|
|
186
|
+
serverHash: overrides.serverHash ?? "abc123hash",
|
|
187
|
+
serverId: overrides.serverId,
|
|
188
|
+
toolInput: overrides.toolInput ?? {},
|
|
189
|
+
result: overrides.result ?? {
|
|
190
|
+
content: [{ type: "text", text: "Tool output" }],
|
|
191
|
+
isError: false,
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function renderChatWithAgent(
|
|
197
|
+
agent: MockMCPProxyAgent,
|
|
198
|
+
{ withCustomRenderer = false }: { withCustomRenderer?: boolean } = {},
|
|
199
|
+
) {
|
|
200
|
+
const agentId = "mcp-test-agent";
|
|
201
|
+
const threadId = `test-thread-${Math.random().toString(36).slice(2)}`;
|
|
202
|
+
agent.agentId = agentId;
|
|
203
|
+
|
|
204
|
+
const Host = defineComponent({
|
|
205
|
+
components: {
|
|
206
|
+
CopilotKitProvider,
|
|
207
|
+
CopilotChatConfigurationProvider,
|
|
208
|
+
CopilotChat,
|
|
209
|
+
},
|
|
210
|
+
setup() {
|
|
211
|
+
return {
|
|
212
|
+
agentId,
|
|
213
|
+
threadId,
|
|
214
|
+
agents: { [agentId]: agent },
|
|
215
|
+
withCustomRenderer,
|
|
216
|
+
};
|
|
217
|
+
},
|
|
218
|
+
template: `
|
|
219
|
+
<CopilotKitProvider runtimeUrl="/api/copilotkit" :agents__unsafe_dev_only="agents">
|
|
220
|
+
<CopilotChatConfigurationProvider :thread-id="threadId" :agent-id="agentId">
|
|
221
|
+
<div style="height: 400px;">
|
|
222
|
+
<CopilotChat :welcome-screen="false">
|
|
223
|
+
<template v-if="withCustomRenderer" #activity-mcp-apps="{ content }">
|
|
224
|
+
<div data-testid="custom-mcp-renderer">
|
|
225
|
+
Custom MCP Renderer: {{ String(content?.resourceUri ?? "") }}
|
|
226
|
+
</div>
|
|
227
|
+
</template>
|
|
228
|
+
</CopilotChat>
|
|
229
|
+
</div>
|
|
230
|
+
</CopilotChatConfigurationProvider>
|
|
231
|
+
</CopilotKitProvider>
|
|
232
|
+
`,
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
return render(Host);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
async function submitMessage(value: string) {
|
|
239
|
+
const input = await screen.findByRole("textbox");
|
|
240
|
+
await fireEvent.update(input, value);
|
|
241
|
+
await fireEvent.keyDown(input, { key: "Enter", code: "Enter" });
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
async function submitMessageAndWaitForRun(value: string) {
|
|
245
|
+
await submitMessage(value);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
describe("MCP Apps Activity Renderer E2E", () => {
|
|
249
|
+
beforeEach(() => {
|
|
250
|
+
vi.clearAllMocks();
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
afterEach(() => {
|
|
254
|
+
cleanup();
|
|
255
|
+
document.body.innerHTML = "";
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
describe("Resource Fetching", () => {
|
|
259
|
+
it("fetches resource content via proxied MCP request on mount", async () => {
|
|
260
|
+
const agent = new MockMCPProxyAgent();
|
|
261
|
+
agent.setRunAgentResponse("resources/read", {
|
|
262
|
+
contents: [
|
|
263
|
+
{
|
|
264
|
+
uri: "ui://test-server/dashboard",
|
|
265
|
+
mimeType: "text/html",
|
|
266
|
+
text: "<html><body>Dashboard content</body></html>",
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
renderChatWithAgent(agent);
|
|
272
|
+
|
|
273
|
+
await submitMessageAndWaitForRun("Show dashboard");
|
|
274
|
+
|
|
275
|
+
await agent.emit(runStartedEvent());
|
|
276
|
+
await agent.emit(
|
|
277
|
+
activitySnapshotEvent({
|
|
278
|
+
messageId: "mcp-activity",
|
|
279
|
+
activityType: MCPAppsActivityType,
|
|
280
|
+
content: mcpAppsActivityContent({
|
|
281
|
+
resourceUri: "ui://test-server/dashboard",
|
|
282
|
+
serverHash: "dashboard-hash-123",
|
|
283
|
+
}),
|
|
284
|
+
}),
|
|
285
|
+
);
|
|
286
|
+
await agent.emit(runFinishedEvent());
|
|
287
|
+
|
|
288
|
+
await waitFor(
|
|
289
|
+
() => {
|
|
290
|
+
expect(document.body.textContent ?? "").toContain("Loading...");
|
|
291
|
+
},
|
|
292
|
+
{ timeout: 2000 },
|
|
293
|
+
);
|
|
294
|
+
|
|
295
|
+
await waitFor(
|
|
296
|
+
() => {
|
|
297
|
+
expect(agent.runAgentCalls.length).toBeGreaterThan(0);
|
|
298
|
+
},
|
|
299
|
+
{ timeout: 2000 },
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
const resourceCall = agent.runAgentCalls.find(
|
|
303
|
+
(call) =>
|
|
304
|
+
call.input.forwardedProps?.__proxiedMCPRequest?.method ===
|
|
305
|
+
"resources/read",
|
|
306
|
+
);
|
|
307
|
+
expect(resourceCall).toBeDefined();
|
|
308
|
+
expect(
|
|
309
|
+
resourceCall?.input.forwardedProps?.__proxiedMCPRequest,
|
|
310
|
+
).toMatchObject({
|
|
311
|
+
serverHash: "dashboard-hash-123",
|
|
312
|
+
method: "resources/read",
|
|
313
|
+
params: { uri: "ui://test-server/dashboard" },
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
it("uses serverId when provided (takes precedence over serverHash)", async () => {
|
|
318
|
+
const agent = new MockMCPProxyAgent();
|
|
319
|
+
agent.setRunAgentResponse("resources/read", {
|
|
320
|
+
contents: [
|
|
321
|
+
{
|
|
322
|
+
uri: "ui://my-app/settings",
|
|
323
|
+
mimeType: "text/html",
|
|
324
|
+
text: "<html><body>Settings</body></html>",
|
|
325
|
+
},
|
|
326
|
+
],
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
renderChatWithAgent(agent);
|
|
330
|
+
|
|
331
|
+
await submitMessageAndWaitForRun("Show settings");
|
|
332
|
+
|
|
333
|
+
await agent.emit(runStartedEvent());
|
|
334
|
+
await agent.emit(
|
|
335
|
+
activitySnapshotEvent({
|
|
336
|
+
messageId: "mcp-activity",
|
|
337
|
+
activityType: MCPAppsActivityType,
|
|
338
|
+
content: mcpAppsActivityContent({
|
|
339
|
+
resourceUri: "ui://my-app/settings",
|
|
340
|
+
serverHash: "fallback-hash",
|
|
341
|
+
serverId: "my-app-stable-id",
|
|
342
|
+
}),
|
|
343
|
+
}),
|
|
344
|
+
);
|
|
345
|
+
await agent.emit(runFinishedEvent());
|
|
346
|
+
|
|
347
|
+
await waitFor(() => {
|
|
348
|
+
const resourceCall = agent.runAgentCalls.find(
|
|
349
|
+
(call) =>
|
|
350
|
+
call.input.forwardedProps?.__proxiedMCPRequest?.method ===
|
|
351
|
+
"resources/read",
|
|
352
|
+
);
|
|
353
|
+
expect(resourceCall).toBeDefined();
|
|
354
|
+
expect(
|
|
355
|
+
resourceCall?.input.forwardedProps?.__proxiedMCPRequest?.serverId,
|
|
356
|
+
).toBe("my-app-stable-id");
|
|
357
|
+
expect(
|
|
358
|
+
resourceCall?.input.forwardedProps?.__proxiedMCPRequest?.serverHash,
|
|
359
|
+
).toBe("fallback-hash");
|
|
360
|
+
});
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
it("shows loading state while fetching resource", async () => {
|
|
364
|
+
const agent = new MockMCPProxyAgent();
|
|
365
|
+
|
|
366
|
+
let resolveResource: ((value: unknown) => void) | undefined;
|
|
367
|
+
const resourcePromise = new Promise((resolve) => {
|
|
368
|
+
resolveResource = resolve;
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
const originalRunAgent = agent.runAgent.bind(agent);
|
|
372
|
+
agent.runAgent = vi.fn(
|
|
373
|
+
async (input?: Partial<RunAgentInput>): Promise<RunAgentResult> => {
|
|
374
|
+
const proxiedRequest = input?.forwardedProps?.__proxiedMCPRequest as
|
|
375
|
+
| { method: string }
|
|
376
|
+
| undefined;
|
|
377
|
+
if (proxiedRequest?.method === "resources/read") {
|
|
378
|
+
await resourcePromise;
|
|
379
|
+
return originalRunAgent(input);
|
|
380
|
+
}
|
|
381
|
+
return originalRunAgent(input);
|
|
382
|
+
},
|
|
383
|
+
);
|
|
384
|
+
|
|
385
|
+
renderChatWithAgent(agent);
|
|
386
|
+
|
|
387
|
+
await submitMessageAndWaitForRun("Load app");
|
|
388
|
+
|
|
389
|
+
await agent.emit(runStartedEvent());
|
|
390
|
+
await agent.emit(
|
|
391
|
+
activitySnapshotEvent({
|
|
392
|
+
messageId: "mcp-activity",
|
|
393
|
+
activityType: MCPAppsActivityType,
|
|
394
|
+
content: mcpAppsActivityContent({
|
|
395
|
+
resourceUri: "ui://test/app",
|
|
396
|
+
serverHash: "test-hash",
|
|
397
|
+
}),
|
|
398
|
+
}),
|
|
399
|
+
);
|
|
400
|
+
await agent.emit(runFinishedEvent());
|
|
401
|
+
|
|
402
|
+
resolveResource?.(true);
|
|
403
|
+
|
|
404
|
+
await waitFor(
|
|
405
|
+
() => {
|
|
406
|
+
expect(document.body.textContent ?? "").not.toContain("Loading...");
|
|
407
|
+
},
|
|
408
|
+
{ timeout: 3000 },
|
|
409
|
+
);
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
it("shows error state when resource fetch fails", async () => {
|
|
413
|
+
const agent = new MockMCPProxyAgent();
|
|
414
|
+
|
|
415
|
+
const originalRunAgent = agent.runAgent.bind(agent);
|
|
416
|
+
agent.runAgent = vi.fn(
|
|
417
|
+
async (input?: Partial<RunAgentInput>): Promise<RunAgentResult> => {
|
|
418
|
+
const proxiedRequest = input?.forwardedProps?.__proxiedMCPRequest as
|
|
419
|
+
| { method: string }
|
|
420
|
+
| undefined;
|
|
421
|
+
if (proxiedRequest) {
|
|
422
|
+
throw new Error("Network error: Failed to fetch resource");
|
|
423
|
+
}
|
|
424
|
+
return originalRunAgent(input);
|
|
425
|
+
},
|
|
426
|
+
);
|
|
427
|
+
|
|
428
|
+
renderChatWithAgent(agent);
|
|
429
|
+
|
|
430
|
+
await submitMessageAndWaitForRun("Fetch broken");
|
|
431
|
+
|
|
432
|
+
await agent.emit(runStartedEvent());
|
|
433
|
+
await agent.emit(
|
|
434
|
+
activitySnapshotEvent({
|
|
435
|
+
messageId: "mcp-activity",
|
|
436
|
+
activityType: MCPAppsActivityType,
|
|
437
|
+
content: mcpAppsActivityContent({
|
|
438
|
+
resourceUri: "ui://broken/resource",
|
|
439
|
+
serverHash: "broken-hash",
|
|
440
|
+
}),
|
|
441
|
+
}),
|
|
442
|
+
);
|
|
443
|
+
await agent.emit(runFinishedEvent());
|
|
444
|
+
|
|
445
|
+
await waitFor(() => {
|
|
446
|
+
expect(document.body.textContent ?? "").toMatch(
|
|
447
|
+
/Error:.*Failed to fetch resource/i,
|
|
448
|
+
);
|
|
449
|
+
});
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
it("handles resource with no content gracefully", async () => {
|
|
453
|
+
const agent = new MockMCPProxyAgent();
|
|
454
|
+
agent.setRunAgentResponse("resources/read", { contents: [] });
|
|
455
|
+
|
|
456
|
+
renderChatWithAgent(agent);
|
|
457
|
+
|
|
458
|
+
await submitMessageAndWaitForRun("Empty resource");
|
|
459
|
+
|
|
460
|
+
await agent.emit(runStartedEvent());
|
|
461
|
+
await agent.emit(
|
|
462
|
+
activitySnapshotEvent({
|
|
463
|
+
messageId: "mcp-activity",
|
|
464
|
+
activityType: MCPAppsActivityType,
|
|
465
|
+
content: mcpAppsActivityContent({
|
|
466
|
+
resourceUri: "ui://empty/resource",
|
|
467
|
+
serverHash: "empty-hash",
|
|
468
|
+
}),
|
|
469
|
+
}),
|
|
470
|
+
);
|
|
471
|
+
await agent.emit(runFinishedEvent());
|
|
472
|
+
|
|
473
|
+
await waitFor(() => {
|
|
474
|
+
expect(document.body.textContent ?? "").toMatch(
|
|
475
|
+
/Error:.*No resource content/i,
|
|
476
|
+
);
|
|
477
|
+
});
|
|
478
|
+
});
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
describe("Schema Validation", () => {
|
|
482
|
+
it("validates activity content with the correct schema", () => {
|
|
483
|
+
const validContent = {
|
|
484
|
+
resourceUri: "ui://server/resource",
|
|
485
|
+
serverHash: "hash123",
|
|
486
|
+
result: {
|
|
487
|
+
content: [{ type: "text", text: "output" }],
|
|
488
|
+
isError: false,
|
|
489
|
+
},
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
const validResult = MCPAppsActivityContentSchema.safeParse(validContent);
|
|
493
|
+
expect(validResult.success).toBe(true);
|
|
494
|
+
|
|
495
|
+
const withServerId = {
|
|
496
|
+
...validContent,
|
|
497
|
+
serverId: "stable-server-id",
|
|
498
|
+
};
|
|
499
|
+
const serverIdResult =
|
|
500
|
+
MCPAppsActivityContentSchema.safeParse(withServerId);
|
|
501
|
+
expect(serverIdResult.success).toBe(true);
|
|
502
|
+
|
|
503
|
+
const withToolInput = {
|
|
504
|
+
...validContent,
|
|
505
|
+
toolInput: { param1: "value1", param2: 42 },
|
|
506
|
+
};
|
|
507
|
+
const toolInputResult =
|
|
508
|
+
MCPAppsActivityContentSchema.safeParse(withToolInput);
|
|
509
|
+
expect(toolInputResult.success).toBe(true);
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
it("rejects invalid activity content", () => {
|
|
513
|
+
const missingResourceUri = {
|
|
514
|
+
serverHash: "hash123",
|
|
515
|
+
result: { isError: false },
|
|
516
|
+
};
|
|
517
|
+
expect(
|
|
518
|
+
MCPAppsActivityContentSchema.safeParse(missingResourceUri).success,
|
|
519
|
+
).toBe(false);
|
|
520
|
+
|
|
521
|
+
const missingServerHash = {
|
|
522
|
+
resourceUri: "ui://server/resource",
|
|
523
|
+
result: { isError: false },
|
|
524
|
+
};
|
|
525
|
+
expect(
|
|
526
|
+
MCPAppsActivityContentSchema.safeParse(missingServerHash).success,
|
|
527
|
+
).toBe(false);
|
|
528
|
+
|
|
529
|
+
const missingResult = {
|
|
530
|
+
resourceUri: "ui://server/resource",
|
|
531
|
+
serverHash: "hash123",
|
|
532
|
+
};
|
|
533
|
+
expect(
|
|
534
|
+
MCPAppsActivityContentSchema.safeParse(missingResult).success,
|
|
535
|
+
).toBe(false);
|
|
536
|
+
});
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
describe("Activity Type Integration", () => {
|
|
540
|
+
it("built-in MCP Apps renderer is registered with correct activity type", async () => {
|
|
541
|
+
const agent = new MockMCPProxyAgent();
|
|
542
|
+
renderChatWithAgent(agent);
|
|
543
|
+
|
|
544
|
+
await submitMessageAndWaitForRun("Test MCP");
|
|
545
|
+
|
|
546
|
+
await agent.emit(runStartedEvent());
|
|
547
|
+
await agent.emit(
|
|
548
|
+
activitySnapshotEvent({
|
|
549
|
+
messageId: "mcp-activity",
|
|
550
|
+
activityType: "mcp-apps",
|
|
551
|
+
content: mcpAppsActivityContent({
|
|
552
|
+
resourceUri: "ui://builtin/test",
|
|
553
|
+
serverHash: "builtin-hash",
|
|
554
|
+
}),
|
|
555
|
+
}),
|
|
556
|
+
);
|
|
557
|
+
await agent.emit(runFinishedEvent());
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
it("user-provided renderer takes precedence over built-in", async () => {
|
|
561
|
+
const agent = new MockMCPProxyAgent();
|
|
562
|
+
renderChatWithAgent(agent, { withCustomRenderer: true });
|
|
563
|
+
|
|
564
|
+
await submitMessageAndWaitForRun("Custom renderer");
|
|
565
|
+
|
|
566
|
+
await agent.emit(runStartedEvent());
|
|
567
|
+
await agent.emit(
|
|
568
|
+
activitySnapshotEvent({
|
|
569
|
+
messageId: "mcp-activity",
|
|
570
|
+
activityType: MCPAppsActivityType,
|
|
571
|
+
content: mcpAppsActivityContent({
|
|
572
|
+
resourceUri: "ui://custom/resource",
|
|
573
|
+
serverHash: "custom-hash",
|
|
574
|
+
}),
|
|
575
|
+
}),
|
|
576
|
+
);
|
|
577
|
+
await agent.emit(runFinishedEvent());
|
|
578
|
+
|
|
579
|
+
await waitFor(() => {
|
|
580
|
+
expect(screen.getByTestId("custom-mcp-renderer")).toBeDefined();
|
|
581
|
+
expect(document.body.textContent ?? "").toContain(
|
|
582
|
+
"Custom MCP Renderer: ui://custom/resource",
|
|
583
|
+
);
|
|
584
|
+
});
|
|
585
|
+
});
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
describe("Multiple Activity Messages", () => {
|
|
589
|
+
it("renders multiple MCP Apps activities independently", async () => {
|
|
590
|
+
const agent = new MockMCPProxyAgent();
|
|
591
|
+
|
|
592
|
+
const originalRunAgent = agent.runAgent.bind(agent);
|
|
593
|
+
agent.runAgent = vi.fn(
|
|
594
|
+
async (input?: Partial<RunAgentInput>): Promise<RunAgentResult> => {
|
|
595
|
+
const proxiedRequest = input?.forwardedProps?.__proxiedMCPRequest as
|
|
596
|
+
| { method: string; params?: { uri?: string } }
|
|
597
|
+
| undefined;
|
|
598
|
+
if (proxiedRequest?.method === "resources/read") {
|
|
599
|
+
const uri = proxiedRequest.params?.uri;
|
|
600
|
+
if (uri === "ui://first/app") {
|
|
601
|
+
return {
|
|
602
|
+
result: {
|
|
603
|
+
contents: [
|
|
604
|
+
{
|
|
605
|
+
uri,
|
|
606
|
+
mimeType: "text/html",
|
|
607
|
+
text: "<div>First App</div>",
|
|
608
|
+
},
|
|
609
|
+
],
|
|
610
|
+
},
|
|
611
|
+
newMessages: [],
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
if (uri === "ui://second/app") {
|
|
615
|
+
return {
|
|
616
|
+
result: {
|
|
617
|
+
contents: [
|
|
618
|
+
{
|
|
619
|
+
uri,
|
|
620
|
+
mimeType: "text/html",
|
|
621
|
+
text: "<div>Second App</div>",
|
|
622
|
+
},
|
|
623
|
+
],
|
|
624
|
+
},
|
|
625
|
+
newMessages: [],
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
return originalRunAgent(input);
|
|
630
|
+
},
|
|
631
|
+
);
|
|
632
|
+
|
|
633
|
+
renderChatWithAgent(agent);
|
|
634
|
+
|
|
635
|
+
await submitMessageAndWaitForRun("Multiple apps");
|
|
636
|
+
|
|
637
|
+
await agent.emit(runStartedEvent());
|
|
638
|
+
await agent.emit(
|
|
639
|
+
activitySnapshotEvent({
|
|
640
|
+
messageId: "mcp-first",
|
|
641
|
+
activityType: MCPAppsActivityType,
|
|
642
|
+
content: mcpAppsActivityContent({
|
|
643
|
+
resourceUri: "ui://first/app",
|
|
644
|
+
serverHash: "first-hash",
|
|
645
|
+
}),
|
|
646
|
+
}),
|
|
647
|
+
);
|
|
648
|
+
await agent.emit(
|
|
649
|
+
activitySnapshotEvent({
|
|
650
|
+
messageId: "mcp-second",
|
|
651
|
+
activityType: MCPAppsActivityType,
|
|
652
|
+
content: mcpAppsActivityContent({
|
|
653
|
+
resourceUri: "ui://second/app",
|
|
654
|
+
serverHash: "second-hash",
|
|
655
|
+
}),
|
|
656
|
+
}),
|
|
657
|
+
);
|
|
658
|
+
await agent.emit(runFinishedEvent());
|
|
659
|
+
|
|
660
|
+
await waitFor(
|
|
661
|
+
() => {
|
|
662
|
+
const iframes = document.querySelectorAll("iframe[srcdoc]");
|
|
663
|
+
expect(iframes.length).toBe(2);
|
|
664
|
+
},
|
|
665
|
+
{ timeout: 2000 },
|
|
666
|
+
);
|
|
667
|
+
});
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
describe("Content Types", () => {
|
|
671
|
+
it("handles text content from resource", async () => {
|
|
672
|
+
const agent = new MockMCPProxyAgent();
|
|
673
|
+
agent.setRunAgentResponse("resources/read", {
|
|
674
|
+
contents: [
|
|
675
|
+
{
|
|
676
|
+
uri: "ui://test/text",
|
|
677
|
+
mimeType: "text/html",
|
|
678
|
+
text: "<html><body><h1>Text Content</h1></body></html>",
|
|
679
|
+
},
|
|
680
|
+
],
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
renderChatWithAgent(agent);
|
|
684
|
+
|
|
685
|
+
await submitMessageAndWaitForRun("Text content");
|
|
686
|
+
|
|
687
|
+
await agent.emit(runStartedEvent());
|
|
688
|
+
await agent.emit(
|
|
689
|
+
activitySnapshotEvent({
|
|
690
|
+
messageId: "mcp-activity",
|
|
691
|
+
activityType: MCPAppsActivityType,
|
|
692
|
+
content: mcpAppsActivityContent({
|
|
693
|
+
resourceUri: "ui://test/text",
|
|
694
|
+
serverHash: "text-hash",
|
|
695
|
+
}),
|
|
696
|
+
}),
|
|
697
|
+
);
|
|
698
|
+
await agent.emit(runFinishedEvent());
|
|
699
|
+
});
|
|
700
|
+
|
|
701
|
+
it("handles blob (base64) content from resource", async () => {
|
|
702
|
+
const agent = new MockMCPProxyAgent();
|
|
703
|
+
const base64Html = btoa("<html><body>Blob Content</body></html>");
|
|
704
|
+
|
|
705
|
+
agent.setRunAgentResponse("resources/read", {
|
|
706
|
+
contents: [
|
|
707
|
+
{
|
|
708
|
+
uri: "ui://test/blob",
|
|
709
|
+
mimeType: "text/html",
|
|
710
|
+
blob: base64Html,
|
|
711
|
+
},
|
|
712
|
+
],
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
renderChatWithAgent(agent);
|
|
716
|
+
|
|
717
|
+
await submitMessageAndWaitForRun("Blob content");
|
|
718
|
+
|
|
719
|
+
await agent.emit(runStartedEvent());
|
|
720
|
+
await agent.emit(
|
|
721
|
+
activitySnapshotEvent({
|
|
722
|
+
messageId: "mcp-activity",
|
|
723
|
+
activityType: MCPAppsActivityType,
|
|
724
|
+
content: mcpAppsActivityContent({
|
|
725
|
+
resourceUri: "ui://test/blob",
|
|
726
|
+
serverHash: "blob-hash",
|
|
727
|
+
}),
|
|
728
|
+
}),
|
|
729
|
+
);
|
|
730
|
+
await agent.emit(runFinishedEvent());
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
it("handles resource with no text or blob - iframe created but stuck waiting for sandbox", async () => {
|
|
734
|
+
const agent = new MockMCPProxyAgent();
|
|
735
|
+
agent.setRunAgentResponse("resources/read", {
|
|
736
|
+
contents: [
|
|
737
|
+
{
|
|
738
|
+
uri: "ui://test/empty",
|
|
739
|
+
mimeType: "text/html",
|
|
740
|
+
},
|
|
741
|
+
],
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
renderChatWithAgent(agent);
|
|
745
|
+
|
|
746
|
+
await submitMessageAndWaitForRun("No content");
|
|
747
|
+
|
|
748
|
+
await agent.emit(runStartedEvent());
|
|
749
|
+
await agent.emit(
|
|
750
|
+
activitySnapshotEvent({
|
|
751
|
+
messageId: "mcp-activity",
|
|
752
|
+
activityType: MCPAppsActivityType,
|
|
753
|
+
content: mcpAppsActivityContent({
|
|
754
|
+
resourceUri: "ui://test/empty",
|
|
755
|
+
serverHash: "empty-hash",
|
|
756
|
+
}),
|
|
757
|
+
}),
|
|
758
|
+
);
|
|
759
|
+
await agent.emit(runFinishedEvent());
|
|
760
|
+
|
|
761
|
+
await waitFor(
|
|
762
|
+
() => {
|
|
763
|
+
const iframe = document.querySelector("iframe[srcdoc]");
|
|
764
|
+
expect(iframe).not.toBeNull();
|
|
765
|
+
},
|
|
766
|
+
{ timeout: 2000 },
|
|
767
|
+
);
|
|
768
|
+
});
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
describe("Metadata Handling", () => {
|
|
772
|
+
it("applies border styling when prefersBorder is true", async () => {
|
|
773
|
+
const agent = new MockMCPProxyAgent();
|
|
774
|
+
agent.setRunAgentResponse("resources/read", {
|
|
775
|
+
contents: [
|
|
776
|
+
{
|
|
777
|
+
uri: "ui://test/bordered",
|
|
778
|
+
mimeType: "text/html",
|
|
779
|
+
text: "<html><body>Bordered Content</body></html>",
|
|
780
|
+
_meta: {
|
|
781
|
+
ui: {
|
|
782
|
+
prefersBorder: true,
|
|
783
|
+
},
|
|
784
|
+
},
|
|
785
|
+
},
|
|
786
|
+
],
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
renderChatWithAgent(agent);
|
|
790
|
+
|
|
791
|
+
await submitMessageAndWaitForRun("Bordered app");
|
|
792
|
+
|
|
793
|
+
await agent.emit(runStartedEvent());
|
|
794
|
+
await agent.emit(
|
|
795
|
+
activitySnapshotEvent({
|
|
796
|
+
messageId: "mcp-activity",
|
|
797
|
+
activityType: MCPAppsActivityType,
|
|
798
|
+
content: mcpAppsActivityContent({
|
|
799
|
+
resourceUri: "ui://test/bordered",
|
|
800
|
+
serverHash: "bordered-hash",
|
|
801
|
+
}),
|
|
802
|
+
}),
|
|
803
|
+
);
|
|
804
|
+
await agent.emit(runFinishedEvent());
|
|
805
|
+
|
|
806
|
+
await waitFor(
|
|
807
|
+
() => {
|
|
808
|
+
expect(document.body.textContent ?? "").not.toContain("Loading...");
|
|
809
|
+
const iframe = document.querySelector("iframe[srcdoc]");
|
|
810
|
+
expect(iframe).not.toBeNull();
|
|
811
|
+
},
|
|
812
|
+
{ timeout: 3000 },
|
|
813
|
+
);
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
it("does not apply border styling when prefersBorder is false", async () => {
|
|
817
|
+
const agent = new MockMCPProxyAgent();
|
|
818
|
+
agent.setRunAgentResponse("resources/read", {
|
|
819
|
+
contents: [
|
|
820
|
+
{
|
|
821
|
+
uri: "ui://test/borderless",
|
|
822
|
+
mimeType: "text/html",
|
|
823
|
+
text: "<html><body>Borderless Content</body></html>",
|
|
824
|
+
_meta: {
|
|
825
|
+
ui: {
|
|
826
|
+
prefersBorder: false,
|
|
827
|
+
},
|
|
828
|
+
},
|
|
829
|
+
},
|
|
830
|
+
],
|
|
831
|
+
});
|
|
832
|
+
|
|
833
|
+
renderChatWithAgent(agent);
|
|
834
|
+
|
|
835
|
+
await submitMessageAndWaitForRun("Borderless app");
|
|
836
|
+
|
|
837
|
+
await agent.emit(runStartedEvent());
|
|
838
|
+
await agent.emit(
|
|
839
|
+
activitySnapshotEvent({
|
|
840
|
+
messageId: "mcp-activity",
|
|
841
|
+
activityType: MCPAppsActivityType,
|
|
842
|
+
content: mcpAppsActivityContent({
|
|
843
|
+
resourceUri: "ui://test/borderless",
|
|
844
|
+
serverHash: "borderless-hash",
|
|
845
|
+
}),
|
|
846
|
+
}),
|
|
847
|
+
);
|
|
848
|
+
await agent.emit(runFinishedEvent());
|
|
849
|
+
});
|
|
850
|
+
});
|
|
851
|
+
});
|