@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,309 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { mount } from "@vue/test-utils";
|
|
3
|
+
import { defineComponent, h, nextTick } from "vue";
|
|
4
|
+
import { DEFAULT_AGENT_ID } from "@copilotkit/shared";
|
|
5
|
+
import CopilotChatConfigurationProvider from "../CopilotChatConfigurationProvider.vue";
|
|
6
|
+
import { useCopilotChatConfiguration } from "../useCopilotChatConfiguration";
|
|
7
|
+
import { CopilotChatDefaultLabels } from "../types";
|
|
8
|
+
|
|
9
|
+
function makeDisplay() {
|
|
10
|
+
return defineComponent({
|
|
11
|
+
setup() {
|
|
12
|
+
const config = useCopilotChatConfiguration();
|
|
13
|
+
return () =>
|
|
14
|
+
h("div", [
|
|
15
|
+
h(
|
|
16
|
+
"span",
|
|
17
|
+
{ "data-testid": "agent" },
|
|
18
|
+
config.value?.agentId ?? "no-config",
|
|
19
|
+
),
|
|
20
|
+
h(
|
|
21
|
+
"span",
|
|
22
|
+
{ "data-testid": "thread" },
|
|
23
|
+
config.value?.threadId ?? "no-config",
|
|
24
|
+
),
|
|
25
|
+
h(
|
|
26
|
+
"span",
|
|
27
|
+
{ "data-testid": "placeholder" },
|
|
28
|
+
config.value?.labels.chatInputPlaceholder ?? "no-config",
|
|
29
|
+
),
|
|
30
|
+
h(
|
|
31
|
+
"span",
|
|
32
|
+
{ "data-testid": "copy" },
|
|
33
|
+
config.value?.labels.assistantMessageToolbarCopyMessageLabel ??
|
|
34
|
+
"no-config",
|
|
35
|
+
),
|
|
36
|
+
h(
|
|
37
|
+
"span",
|
|
38
|
+
{ "data-testid": "modal" },
|
|
39
|
+
String(config.value?.isModalOpen),
|
|
40
|
+
),
|
|
41
|
+
h(
|
|
42
|
+
"span",
|
|
43
|
+
{ "data-testid": "explicit" },
|
|
44
|
+
String(config.value?.hasExplicitThreadId ?? "no-config"),
|
|
45
|
+
),
|
|
46
|
+
]);
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
describe("CopilotChatConfigurationProvider", () => {
|
|
52
|
+
it("provides default values", () => {
|
|
53
|
+
const Display = makeDisplay();
|
|
54
|
+
const wrapper = mount(CopilotChatConfigurationProvider, {
|
|
55
|
+
props: { threadId: "thread-1" },
|
|
56
|
+
slots: { default: () => h(Display) },
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(wrapper.find("[data-testid=agent]").text()).toBe(DEFAULT_AGENT_ID);
|
|
60
|
+
expect(wrapper.find("[data-testid=thread]").text()).toBe("thread-1");
|
|
61
|
+
expect(wrapper.find("[data-testid=placeholder]").text()).toBe(
|
|
62
|
+
CopilotChatDefaultLabels.chatInputPlaceholder,
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("accepts custom agentId and merges labels", () => {
|
|
67
|
+
const Display = makeDisplay();
|
|
68
|
+
const wrapper = mount(CopilotChatConfigurationProvider, {
|
|
69
|
+
props: {
|
|
70
|
+
threadId: "thread-1",
|
|
71
|
+
agentId: "agent-custom",
|
|
72
|
+
labels: { chatInputPlaceholder: "Custom Placeholder" },
|
|
73
|
+
},
|
|
74
|
+
slots: { default: () => h(Display) },
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
expect(wrapper.find("[data-testid=agent]").text()).toBe("agent-custom");
|
|
78
|
+
expect(wrapper.find("[data-testid=placeholder]").text()).toBe(
|
|
79
|
+
"Custom Placeholder",
|
|
80
|
+
);
|
|
81
|
+
expect(wrapper.find("[data-testid=copy]").text()).toBe(
|
|
82
|
+
CopilotChatDefaultLabels.assistantMessageToolbarCopyMessageLabel,
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("returns null from hook without provider", () => {
|
|
87
|
+
const Display = makeDisplay();
|
|
88
|
+
const wrapper = mount(Display);
|
|
89
|
+
|
|
90
|
+
expect(wrapper.find("[data-testid=agent]").text()).toBe("no-config");
|
|
91
|
+
expect(wrapper.find("[data-testid=thread]").text()).toBe("no-config");
|
|
92
|
+
expect(wrapper.find("[data-testid=placeholder]").text()).toBe("no-config");
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("uses nested provider precedence", () => {
|
|
96
|
+
const Display = makeDisplay();
|
|
97
|
+
const wrapper = mount(CopilotChatConfigurationProvider, {
|
|
98
|
+
props: {
|
|
99
|
+
threadId: "outer-thread",
|
|
100
|
+
agentId: "outer-agent",
|
|
101
|
+
labels: { chatInputPlaceholder: "Outer" },
|
|
102
|
+
},
|
|
103
|
+
slots: {
|
|
104
|
+
default: () =>
|
|
105
|
+
h(
|
|
106
|
+
CopilotChatConfigurationProvider,
|
|
107
|
+
{
|
|
108
|
+
threadId: "inner-thread",
|
|
109
|
+
agentId: "inner-agent",
|
|
110
|
+
labels: { chatInputPlaceholder: "Inner" },
|
|
111
|
+
},
|
|
112
|
+
{ default: () => h(Display) },
|
|
113
|
+
),
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
expect(wrapper.find("[data-testid=agent]").text()).toBe("inner-agent");
|
|
118
|
+
expect(wrapper.find("[data-testid=thread]").text()).toBe("inner-thread");
|
|
119
|
+
expect(wrapper.find("[data-testid=placeholder]").text()).toBe("Inner");
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("creates and mutates modal state when isModalDefaultOpen is provided", async () => {
|
|
123
|
+
const Toggle = defineComponent({
|
|
124
|
+
setup() {
|
|
125
|
+
const config = useCopilotChatConfiguration();
|
|
126
|
+
const close = () => config.value?.setModalOpen?.(false);
|
|
127
|
+
return () =>
|
|
128
|
+
h("div", [
|
|
129
|
+
h(
|
|
130
|
+
"span",
|
|
131
|
+
{ "data-testid": "modal" },
|
|
132
|
+
String(config.value?.isModalOpen),
|
|
133
|
+
),
|
|
134
|
+
h("button", { "data-testid": "close", onClick: close }, "close"),
|
|
135
|
+
]);
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const wrapper = mount(CopilotChatConfigurationProvider, {
|
|
140
|
+
props: {
|
|
141
|
+
threadId: "thread-1",
|
|
142
|
+
isModalDefaultOpen: true,
|
|
143
|
+
},
|
|
144
|
+
slots: { default: () => h(Toggle) },
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
expect(wrapper.find("[data-testid=modal]").text()).toBe("true");
|
|
148
|
+
await wrapper.find("[data-testid=close]").trigger("click");
|
|
149
|
+
await nextTick();
|
|
150
|
+
expect(wrapper.find("[data-testid=modal]").text()).toBe("false");
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it("creates modal state when isModalDefaultOpen is passed through template bindings", () => {
|
|
154
|
+
const Display = makeDisplay();
|
|
155
|
+
const TemplateWrapper = defineComponent({
|
|
156
|
+
components: { CopilotChatConfigurationProvider, Display },
|
|
157
|
+
template: `
|
|
158
|
+
<CopilotChatConfigurationProvider
|
|
159
|
+
thread-id="thread-1"
|
|
160
|
+
:is-modal-default-open="true"
|
|
161
|
+
>
|
|
162
|
+
<Display />
|
|
163
|
+
</CopilotChatConfigurationProvider>
|
|
164
|
+
`,
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const wrapper = mount(TemplateWrapper);
|
|
168
|
+
|
|
169
|
+
expect(wrapper.find("[data-testid=modal]").text()).toBe("true");
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
describe("hasExplicitThreadId", () => {
|
|
173
|
+
it("infers true when threadId is supplied and hasExplicitThreadId is omitted", () => {
|
|
174
|
+
const Display = makeDisplay();
|
|
175
|
+
const wrapper = mount(CopilotChatConfigurationProvider, {
|
|
176
|
+
props: { threadId: "thread-1" },
|
|
177
|
+
slots: { default: () => h(Display) },
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
expect(wrapper.find("[data-testid=explicit]").text()).toBe("true");
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it("infers false when neither threadId nor hasExplicitThreadId is supplied", () => {
|
|
184
|
+
const Display = makeDisplay();
|
|
185
|
+
const wrapper = mount(CopilotChatConfigurationProvider, {
|
|
186
|
+
props: {},
|
|
187
|
+
slots: { default: () => h(Display) },
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
expect(wrapper.find("[data-testid=explicit]").text()).toBe("false");
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it("respects hasExplicitThreadId=false even when threadId is present", () => {
|
|
194
|
+
const Display = makeDisplay();
|
|
195
|
+
const wrapper = mount(CopilotChatConfigurationProvider, {
|
|
196
|
+
props: { threadId: "thread-1", hasExplicitThreadId: false },
|
|
197
|
+
slots: { default: () => h(Display) },
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
expect(wrapper.find("[data-testid=explicit]").text()).toBe("false");
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it("explicit parent overrides non-explicit child", () => {
|
|
204
|
+
const Display = makeDisplay();
|
|
205
|
+
const wrapper = mount(CopilotChatConfigurationProvider, {
|
|
206
|
+
props: { threadId: "outer-thread" },
|
|
207
|
+
slots: {
|
|
208
|
+
default: () =>
|
|
209
|
+
h(
|
|
210
|
+
CopilotChatConfigurationProvider,
|
|
211
|
+
{ threadId: "inner-thread", hasExplicitThreadId: false },
|
|
212
|
+
{ default: () => h(Display) },
|
|
213
|
+
),
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
expect(wrapper.find("[data-testid=explicit]").text()).toBe("true");
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it("propagates explicitness through a multi-level provider chain", () => {
|
|
221
|
+
const Display = makeDisplay();
|
|
222
|
+
const wrapper = mount(CopilotChatConfigurationProvider, {
|
|
223
|
+
props: { threadId: "level-1" },
|
|
224
|
+
slots: {
|
|
225
|
+
default: () =>
|
|
226
|
+
h(
|
|
227
|
+
CopilotChatConfigurationProvider,
|
|
228
|
+
{},
|
|
229
|
+
{
|
|
230
|
+
default: () =>
|
|
231
|
+
h(
|
|
232
|
+
CopilotChatConfigurationProvider,
|
|
233
|
+
{},
|
|
234
|
+
{ default: () => h(Display) },
|
|
235
|
+
),
|
|
236
|
+
},
|
|
237
|
+
),
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
expect(wrapper.find("[data-testid=explicit]").text()).toBe("true");
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
it("non-explicit parent does not prevent an explicit child from being explicit", () => {
|
|
245
|
+
const Display = makeDisplay();
|
|
246
|
+
const wrapper = mount(CopilotChatConfigurationProvider, {
|
|
247
|
+
props: {},
|
|
248
|
+
slots: {
|
|
249
|
+
default: () =>
|
|
250
|
+
h(
|
|
251
|
+
CopilotChatConfigurationProvider,
|
|
252
|
+
{ threadId: "child-thread" },
|
|
253
|
+
{ default: () => h(Display) },
|
|
254
|
+
),
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
expect(wrapper.find("[data-testid=explicit]").text()).toBe("true");
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it("inherits modal state from parent when child does not define isModalDefaultOpen", async () => {
|
|
263
|
+
const ChildDisplay = defineComponent({
|
|
264
|
+
setup() {
|
|
265
|
+
const config = useCopilotChatConfiguration();
|
|
266
|
+
return () =>
|
|
267
|
+
h(
|
|
268
|
+
"span",
|
|
269
|
+
{ "data-testid": "child-modal" },
|
|
270
|
+
String(config.value?.isModalOpen),
|
|
271
|
+
);
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
const ParentToggle = defineComponent({
|
|
276
|
+
setup() {
|
|
277
|
+
const config = useCopilotChatConfiguration();
|
|
278
|
+
const close = () => config.value?.setModalOpen?.(false);
|
|
279
|
+
return () =>
|
|
280
|
+
h("div", [
|
|
281
|
+
h(
|
|
282
|
+
"button",
|
|
283
|
+
{ "data-testid": "close-parent", onClick: close },
|
|
284
|
+
"close",
|
|
285
|
+
),
|
|
286
|
+
h(
|
|
287
|
+
CopilotChatConfigurationProvider,
|
|
288
|
+
{ threadId: "child" },
|
|
289
|
+
{ default: () => h(ChildDisplay) },
|
|
290
|
+
),
|
|
291
|
+
]);
|
|
292
|
+
},
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
const wrapper = mount(CopilotChatConfigurationProvider, {
|
|
296
|
+
props: {
|
|
297
|
+
threadId: "parent",
|
|
298
|
+
isModalDefaultOpen: true,
|
|
299
|
+
},
|
|
300
|
+
slots: { default: () => h(ParentToggle) },
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
expect(wrapper.find("[data-testid=child-modal]").text()).toBe("true");
|
|
304
|
+
await wrapper.find("[data-testid=close-parent]").trigger("click");
|
|
305
|
+
await nextTick();
|
|
306
|
+
await nextTick();
|
|
307
|
+
expect(wrapper.find("[data-testid=child-modal]").text()).toBe("false");
|
|
308
|
+
});
|
|
309
|
+
});
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { cleanup, render } from "@testing-library/vue";
|
|
2
|
+
import { defineComponent, nextTick } from "vue";
|
|
3
|
+
import type { Component, PropType } from "vue";
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
+
import type { DebugConfig } from "@copilotkit/shared";
|
|
6
|
+
import CopilotKitProvider from "../CopilotKitProvider.vue";
|
|
7
|
+
import { useCopilotKit } from "../useCopilotKit";
|
|
8
|
+
import type { CopilotKitCoreVue } from "../../lib/vue-core";
|
|
9
|
+
|
|
10
|
+
let consoleErrorSpy: ReturnType<typeof vi.spyOn>;
|
|
11
|
+
let consoleWarnSpy: ReturnType<typeof vi.spyOn>;
|
|
12
|
+
|
|
13
|
+
function renderProvider(args: {
|
|
14
|
+
child: Component;
|
|
15
|
+
debug?: DebugConfig;
|
|
16
|
+
runtimeUrl?: string;
|
|
17
|
+
credentials?: RequestCredentials;
|
|
18
|
+
headers?: Record<string, string>;
|
|
19
|
+
properties?: Record<string, unknown>;
|
|
20
|
+
agents__unsafe_dev_only?: Record<string, unknown>;
|
|
21
|
+
defaultThrottleMs?: number;
|
|
22
|
+
}) {
|
|
23
|
+
const Host = defineComponent({
|
|
24
|
+
components: {
|
|
25
|
+
CopilotKitProvider,
|
|
26
|
+
ChildComponent: args.child,
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
runtimeUrl: { type: String, required: false },
|
|
30
|
+
debug: {
|
|
31
|
+
type: [Boolean, Object] as PropType<DebugConfig | undefined>,
|
|
32
|
+
required: false,
|
|
33
|
+
default: undefined,
|
|
34
|
+
},
|
|
35
|
+
credentials: {
|
|
36
|
+
type: String as PropType<RequestCredentials | undefined>,
|
|
37
|
+
required: false,
|
|
38
|
+
default: undefined,
|
|
39
|
+
},
|
|
40
|
+
headers: {
|
|
41
|
+
type: Object as PropType<Record<string, string> | undefined>,
|
|
42
|
+
required: false,
|
|
43
|
+
default: undefined,
|
|
44
|
+
},
|
|
45
|
+
properties: {
|
|
46
|
+
type: Object as PropType<Record<string, unknown> | undefined>,
|
|
47
|
+
required: false,
|
|
48
|
+
default: undefined,
|
|
49
|
+
},
|
|
50
|
+
agents__unsafe_dev_only: {
|
|
51
|
+
type: Object as PropType<Record<string, unknown> | undefined>,
|
|
52
|
+
required: false,
|
|
53
|
+
default: undefined,
|
|
54
|
+
},
|
|
55
|
+
defaultThrottleMs: {
|
|
56
|
+
type: Number,
|
|
57
|
+
required: false,
|
|
58
|
+
default: undefined,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
template: `
|
|
62
|
+
<CopilotKitProvider
|
|
63
|
+
:runtime-url="runtimeUrl"
|
|
64
|
+
:debug="debug"
|
|
65
|
+
:credentials="credentials"
|
|
66
|
+
:headers="headers"
|
|
67
|
+
:properties="properties"
|
|
68
|
+
:agents__unsafe_dev_only="agents__unsafe_dev_only"
|
|
69
|
+
:default-throttle-ms="defaultThrottleMs"
|
|
70
|
+
>
|
|
71
|
+
<ChildComponent />
|
|
72
|
+
</CopilotKitProvider>
|
|
73
|
+
`,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
return render(Host, {
|
|
77
|
+
props: {
|
|
78
|
+
runtimeUrl: args.runtimeUrl ?? "/api/copilotkit",
|
|
79
|
+
debug: args.debug,
|
|
80
|
+
credentials: args.credentials,
|
|
81
|
+
headers: args.headers,
|
|
82
|
+
properties: args.properties,
|
|
83
|
+
agents__unsafe_dev_only: args.agents__unsafe_dev_only,
|
|
84
|
+
defaultThrottleMs: args.defaultThrottleMs,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function createCoreCollector(): {
|
|
90
|
+
child: Component;
|
|
91
|
+
getCore: () => CopilotKitCoreVue;
|
|
92
|
+
getInstances: () => CopilotKitCoreVue[];
|
|
93
|
+
} {
|
|
94
|
+
const instances: CopilotKitCoreVue[] = [];
|
|
95
|
+
const Collector = defineComponent({
|
|
96
|
+
setup() {
|
|
97
|
+
const { copilotkit } = useCopilotKit();
|
|
98
|
+
instances.push(copilotkit.value);
|
|
99
|
+
return () => null;
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
child: Collector,
|
|
104
|
+
getCore: () => {
|
|
105
|
+
if (instances.length === 0) {
|
|
106
|
+
throw new Error("CopilotKit core not captured yet");
|
|
107
|
+
}
|
|
108
|
+
return instances[instances.length - 1]!;
|
|
109
|
+
},
|
|
110
|
+
getInstances: () => instances,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
describe("CopilotKitProvider debug", () => {
|
|
115
|
+
beforeEach(() => {
|
|
116
|
+
consoleErrorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
|
|
117
|
+
consoleWarnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
afterEach(() => {
|
|
121
|
+
cleanup();
|
|
122
|
+
consoleErrorSpy.mockRestore();
|
|
123
|
+
consoleWarnSpy.mockRestore();
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
describe("initial threading", () => {
|
|
127
|
+
it("threads debug=true through to copilotkit.debug on mount", async () => {
|
|
128
|
+
const { child, getCore } = createCoreCollector();
|
|
129
|
+
|
|
130
|
+
renderProvider({ child, debug: true });
|
|
131
|
+
await nextTick();
|
|
132
|
+
|
|
133
|
+
expect(getCore().debug).toBe(true);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it("preserves the exact object config shape on the core instance", async () => {
|
|
137
|
+
const { child, getCore } = createCoreCollector();
|
|
138
|
+
const debugConfig: DebugConfig = {
|
|
139
|
+
events: true,
|
|
140
|
+
lifecycle: false,
|
|
141
|
+
verbose: true,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
renderProvider({ child, debug: debugConfig });
|
|
145
|
+
await nextTick();
|
|
146
|
+
|
|
147
|
+
expect(getCore().debug).toEqual({
|
|
148
|
+
events: true,
|
|
149
|
+
lifecycle: false,
|
|
150
|
+
verbose: true,
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it("leaves copilotkit.debug undefined when debug prop is omitted", async () => {
|
|
155
|
+
const { child, getCore } = createCoreCollector();
|
|
156
|
+
|
|
157
|
+
renderProvider({ child });
|
|
158
|
+
await nextTick();
|
|
159
|
+
|
|
160
|
+
expect(getCore().debug).toBeUndefined();
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
describe("runtime sync", () => {
|
|
165
|
+
it("updates copilotkit.debug when the prop changes after mount", async () => {
|
|
166
|
+
const { child, getCore } = createCoreCollector();
|
|
167
|
+
|
|
168
|
+
const view = renderProvider({ child, debug: false });
|
|
169
|
+
await nextTick();
|
|
170
|
+
expect(getCore().debug).toBe(false);
|
|
171
|
+
|
|
172
|
+
await view.rerender({
|
|
173
|
+
runtimeUrl: "/api/copilotkit",
|
|
174
|
+
debug: { events: true, lifecycle: true, verbose: true },
|
|
175
|
+
});
|
|
176
|
+
await nextTick();
|
|
177
|
+
|
|
178
|
+
expect(getCore().debug).toEqual({
|
|
179
|
+
events: true,
|
|
180
|
+
lifecycle: true,
|
|
181
|
+
verbose: true,
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it("does not recreate the CopilotKitCoreVue instance when debug changes", async () => {
|
|
186
|
+
const { child, getInstances } = createCoreCollector();
|
|
187
|
+
|
|
188
|
+
const view = renderProvider({ child, debug: false });
|
|
189
|
+
await nextTick();
|
|
190
|
+
const initialInstance = getInstances()[0];
|
|
191
|
+
expect(initialInstance).toBeDefined();
|
|
192
|
+
|
|
193
|
+
await view.rerender({
|
|
194
|
+
runtimeUrl: "/api/copilotkit",
|
|
195
|
+
debug: true,
|
|
196
|
+
});
|
|
197
|
+
await nextTick();
|
|
198
|
+
|
|
199
|
+
await view.rerender({
|
|
200
|
+
runtimeUrl: "/api/copilotkit",
|
|
201
|
+
debug: { events: false, lifecycle: true },
|
|
202
|
+
});
|
|
203
|
+
await nextTick();
|
|
204
|
+
|
|
205
|
+
for (const instance of getInstances()) {
|
|
206
|
+
expect(instance).toBe(initialInstance);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it("calls setDebug on the stable core instance for each prop change", async () => {
|
|
211
|
+
const { child, getCore } = createCoreCollector();
|
|
212
|
+
|
|
213
|
+
const view = renderProvider({ child, debug: false });
|
|
214
|
+
await nextTick();
|
|
215
|
+
|
|
216
|
+
const core = getCore();
|
|
217
|
+
const setDebugSpy = vi.spyOn(core, "setDebug");
|
|
218
|
+
|
|
219
|
+
await view.rerender({
|
|
220
|
+
runtimeUrl: "/api/copilotkit",
|
|
221
|
+
debug: true,
|
|
222
|
+
});
|
|
223
|
+
await nextTick();
|
|
224
|
+
|
|
225
|
+
expect(setDebugSpy).toHaveBeenCalledWith(true);
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
describe("clearing behavior", () => {
|
|
230
|
+
it("clears the core debug config when debug changes from truthy to undefined", async () => {
|
|
231
|
+
const { child, getCore } = createCoreCollector();
|
|
232
|
+
|
|
233
|
+
const view = renderProvider({
|
|
234
|
+
child,
|
|
235
|
+
debug: { events: true, lifecycle: true },
|
|
236
|
+
});
|
|
237
|
+
await nextTick();
|
|
238
|
+
expect(getCore().debug).toEqual({ events: true, lifecycle: true });
|
|
239
|
+
|
|
240
|
+
await view.rerender({
|
|
241
|
+
runtimeUrl: "/api/copilotkit",
|
|
242
|
+
debug: undefined,
|
|
243
|
+
});
|
|
244
|
+
await nextTick();
|
|
245
|
+
|
|
246
|
+
expect(getCore().debug).toBeUndefined();
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
describe("regression safety", () => {
|
|
251
|
+
it("does not affect neighboring runtime config prop-sync behavior", async () => {
|
|
252
|
+
const { child, getCore } = createCoreCollector();
|
|
253
|
+
|
|
254
|
+
const view = renderProvider({
|
|
255
|
+
child,
|
|
256
|
+
runtimeUrl: "/api/copilotkit",
|
|
257
|
+
credentials: "include",
|
|
258
|
+
headers: { "X-Init": "1" },
|
|
259
|
+
properties: { initial: true },
|
|
260
|
+
agents__unsafe_dev_only: {},
|
|
261
|
+
defaultThrottleMs: 100,
|
|
262
|
+
debug: false,
|
|
263
|
+
});
|
|
264
|
+
await nextTick();
|
|
265
|
+
|
|
266
|
+
const core = getCore();
|
|
267
|
+
const setRuntimeUrlSpy = vi.spyOn(core, "setRuntimeUrl");
|
|
268
|
+
const setHeadersSpy = vi.spyOn(core, "setHeaders");
|
|
269
|
+
const setCredentialsSpy = vi.spyOn(core, "setCredentials");
|
|
270
|
+
const setPropertiesSpy = vi.spyOn(core, "setProperties");
|
|
271
|
+
const setAgentsSpy = vi.spyOn(core, "setAgents__unsafe_dev_only");
|
|
272
|
+
const setDefaultThrottleSpy = vi.spyOn(core, "setDefaultThrottleMs");
|
|
273
|
+
const setDebugSpy = vi.spyOn(core, "setDebug");
|
|
274
|
+
|
|
275
|
+
await view.rerender({
|
|
276
|
+
runtimeUrl: "/api/copilotkit/v2",
|
|
277
|
+
credentials: "same-origin",
|
|
278
|
+
headers: { "X-Updated": "1" },
|
|
279
|
+
properties: { initial: true, added: 42 },
|
|
280
|
+
agents__unsafe_dev_only: {},
|
|
281
|
+
defaultThrottleMs: 200,
|
|
282
|
+
debug: true,
|
|
283
|
+
});
|
|
284
|
+
await nextTick();
|
|
285
|
+
|
|
286
|
+
expect(setRuntimeUrlSpy).toHaveBeenCalledWith("/api/copilotkit/v2");
|
|
287
|
+
expect(setHeadersSpy).toHaveBeenCalled();
|
|
288
|
+
expect(setCredentialsSpy).toHaveBeenCalledWith("same-origin");
|
|
289
|
+
expect(setPropertiesSpy).toHaveBeenCalled();
|
|
290
|
+
expect(setAgentsSpy).toHaveBeenCalled();
|
|
291
|
+
expect(setDefaultThrottleSpy).toHaveBeenCalledWith(200);
|
|
292
|
+
expect(setDebugSpy).toHaveBeenCalledWith(true);
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { cleanup, render, waitFor } from "@testing-library/vue";
|
|
2
|
+
import { defineComponent, h } from "vue";
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
import CopilotKitProvider from "../CopilotKitProvider.vue";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* These tests verify that the license banner is driven by the server-reported
|
|
8
|
+
* licenseStatus field in the /info response — not by client-side token
|
|
9
|
+
* verification. Mirrors React's `CopilotKitProvider.license.test.tsx`.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
function mockFetchWithLicenseStatus(licenseStatus?: string) {
|
|
13
|
+
return vi.fn().mockResolvedValue({
|
|
14
|
+
ok: true,
|
|
15
|
+
status: 200,
|
|
16
|
+
headers: new Headers(),
|
|
17
|
+
json: async () => ({
|
|
18
|
+
version: "1.0.0",
|
|
19
|
+
agents: {},
|
|
20
|
+
audioFileTranscriptionEnabled: false,
|
|
21
|
+
mode: "intelligence",
|
|
22
|
+
licenseStatus,
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const Child = defineComponent({
|
|
28
|
+
setup() {
|
|
29
|
+
return () => h("div", "child");
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
function renderProvider(opts?: { publicApiKey?: string }) {
|
|
34
|
+
const Host = defineComponent({
|
|
35
|
+
components: { CopilotKitProvider, Child },
|
|
36
|
+
template: `
|
|
37
|
+
<CopilotKitProvider runtime-url="/api" :public-api-key="publicApiKey">
|
|
38
|
+
<Child />
|
|
39
|
+
</CopilotKitProvider>
|
|
40
|
+
`,
|
|
41
|
+
setup() {
|
|
42
|
+
return { publicApiKey: opts?.publicApiKey };
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return render(Host);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
describe("CopilotKitProvider license (server-driven)", () => {
|
|
50
|
+
beforeEach(() => {
|
|
51
|
+
vi.spyOn(console, "warn").mockImplementation(() => {});
|
|
52
|
+
vi.spyOn(console, "error").mockImplementation(() => {});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
afterEach(() => {
|
|
56
|
+
cleanup();
|
|
57
|
+
vi.unstubAllGlobals();
|
|
58
|
+
vi.restoreAllMocks();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("shows no_license banner when server reports 'none'", async () => {
|
|
62
|
+
vi.stubGlobal("fetch", mockFetchWithLicenseStatus("none"));
|
|
63
|
+
|
|
64
|
+
const view = renderProvider();
|
|
65
|
+
await waitFor(() => {
|
|
66
|
+
expect(view.queryByText(/Powered by CopilotKit/)).not.toBeNull();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("shows expired banner when server reports 'expired'", async () => {
|
|
71
|
+
vi.stubGlobal("fetch", mockFetchWithLicenseStatus("expired"));
|
|
72
|
+
|
|
73
|
+
const view = renderProvider();
|
|
74
|
+
await waitFor(() => {
|
|
75
|
+
expect(view.queryByText(/expired/i)).not.toBeNull();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("shows invalid banner when server reports 'invalid'", async () => {
|
|
80
|
+
vi.stubGlobal("fetch", mockFetchWithLicenseStatus("invalid"));
|
|
81
|
+
|
|
82
|
+
const view = renderProvider();
|
|
83
|
+
await waitFor(() => {
|
|
84
|
+
expect(
|
|
85
|
+
view.queryByText(/Invalid CopilotKit license token/i),
|
|
86
|
+
).not.toBeNull();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("shows no banner when server reports 'valid'", async () => {
|
|
91
|
+
vi.stubGlobal("fetch", mockFetchWithLicenseStatus("valid"));
|
|
92
|
+
|
|
93
|
+
const view = renderProvider();
|
|
94
|
+
await waitFor(() => {
|
|
95
|
+
expect(view.queryByText(/Powered by CopilotKit/)).toBeNull();
|
|
96
|
+
expect(view.queryByText(/expired/i)).toBeNull();
|
|
97
|
+
expect(view.queryByText(/Invalid/i)).toBeNull();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("shows no banner when licenseStatus is absent (non-intelligence mode)", async () => {
|
|
102
|
+
vi.stubGlobal("fetch", mockFetchWithLicenseStatus(undefined));
|
|
103
|
+
|
|
104
|
+
const view = renderProvider();
|
|
105
|
+
await waitFor(() => {
|
|
106
|
+
expect(view.queryByText(/Powered by CopilotKit/)).toBeNull();
|
|
107
|
+
expect(view.queryByText(/expired/i)).toBeNull();
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
});
|