@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,73 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, useAttrs } from "vue";
|
|
3
|
+
import { useCopilotChatConfiguration } from "../../providers/useCopilotChatConfiguration";
|
|
4
|
+
import { CopilotChatDefaultLabels } from "../../providers/types";
|
|
5
|
+
import CopilotModalHeaderCloseButton from "./CopilotModalHeaderCloseButton";
|
|
6
|
+
import CopilotModalHeaderTitle from "./CopilotModalHeaderTitle";
|
|
7
|
+
import type {
|
|
8
|
+
CopilotModalHeaderCloseButtonSlotProps,
|
|
9
|
+
CopilotModalHeaderLayoutSlotProps,
|
|
10
|
+
CopilotModalHeaderProps,
|
|
11
|
+
CopilotModalHeaderTitleContentSlotProps,
|
|
12
|
+
} from "./types";
|
|
13
|
+
|
|
14
|
+
defineOptions({ inheritAttrs: false });
|
|
15
|
+
|
|
16
|
+
const props = defineProps<CopilotModalHeaderProps>();
|
|
17
|
+
|
|
18
|
+
defineSlots<{
|
|
19
|
+
"title-content"?: (props: CopilotModalHeaderTitleContentSlotProps) => unknown;
|
|
20
|
+
"close-button"?: (props: CopilotModalHeaderCloseButtonSlotProps) => unknown;
|
|
21
|
+
layout?: (props: CopilotModalHeaderLayoutSlotProps) => unknown;
|
|
22
|
+
}>();
|
|
23
|
+
|
|
24
|
+
const attrs = useAttrs();
|
|
25
|
+
const config = useCopilotChatConfiguration();
|
|
26
|
+
|
|
27
|
+
const resolvedTitle = computed(
|
|
28
|
+
() =>
|
|
29
|
+
props.title ??
|
|
30
|
+
config.value?.labels.modalHeaderTitle ??
|
|
31
|
+
CopilotChatDefaultLabels.modalHeaderTitle,
|
|
32
|
+
);
|
|
33
|
+
const headerClass = computed(() => [
|
|
34
|
+
"cpk:flex cpk:items-center cpk:justify-between cpk:border-b cpk:border-border cpk:px-4 cpk:py-4",
|
|
35
|
+
"cpk:bg-background/95 cpk:backdrop-blur cpk:supports-[backdrop-filter]:bg-background/80",
|
|
36
|
+
attrs.class,
|
|
37
|
+
]);
|
|
38
|
+
const headerAttrs = computed(() => {
|
|
39
|
+
const { class: _className, ...rest } = attrs;
|
|
40
|
+
return rest;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
function handleClose() {
|
|
44
|
+
config.value?.setModalOpen?.(false);
|
|
45
|
+
}
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<template>
|
|
49
|
+
<header
|
|
50
|
+
data-copilotkit
|
|
51
|
+
data-slot="copilot-modal-header"
|
|
52
|
+
:class="headerClass"
|
|
53
|
+
v-bind="headerAttrs"
|
|
54
|
+
>
|
|
55
|
+
<slot name="layout" :title="resolvedTitle" :on-close="handleClose">
|
|
56
|
+
<div class="cpk:flex cpk:w-full cpk:items-center cpk:gap-2">
|
|
57
|
+
<div class="cpk:flex cpk:flex-1" aria-hidden="true" />
|
|
58
|
+
<div class="cpk:flex cpk:flex-1 cpk:justify-center cpk:text-center">
|
|
59
|
+
<slot name="title-content" :title="resolvedTitle">
|
|
60
|
+
<CopilotModalHeaderTitle>
|
|
61
|
+
{{ resolvedTitle }}
|
|
62
|
+
</CopilotModalHeaderTitle>
|
|
63
|
+
</slot>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="cpk:flex cpk:flex-1 cpk:justify-end">
|
|
66
|
+
<slot name="close-button" :on-close="handleClose">
|
|
67
|
+
<CopilotModalHeaderCloseButton @click="handleClose" />
|
|
68
|
+
</slot>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</slot>
|
|
72
|
+
</header>
|
|
73
|
+
</template>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { computed, defineComponent, h, useAttrs } from "vue";
|
|
2
|
+
import { IconX } from "../icons";
|
|
3
|
+
|
|
4
|
+
export default defineComponent({
|
|
5
|
+
name: "CopilotModalHeaderCloseButton",
|
|
6
|
+
inheritAttrs: false,
|
|
7
|
+
setup(_, { slots }) {
|
|
8
|
+
const attrs = useAttrs();
|
|
9
|
+
const ariaLabel = computed(() =>
|
|
10
|
+
typeof attrs["aria-label"] === "string" ? attrs["aria-label"] : "Close",
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
return () => {
|
|
14
|
+
const {
|
|
15
|
+
class: className,
|
|
16
|
+
type,
|
|
17
|
+
...rest
|
|
18
|
+
} = attrs as Record<string, unknown>;
|
|
19
|
+
|
|
20
|
+
return h(
|
|
21
|
+
"button",
|
|
22
|
+
{
|
|
23
|
+
...rest,
|
|
24
|
+
type: typeof type === "string" ? type : "button",
|
|
25
|
+
class: [
|
|
26
|
+
"cpk:inline-flex cpk:size-8 cpk:items-center cpk:justify-center cpk:rounded-full cpk:text-muted-foreground cpk:transition cpk:cursor-pointer",
|
|
27
|
+
"cpk:hover:bg-muted cpk:hover:text-foreground cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-ring",
|
|
28
|
+
className,
|
|
29
|
+
],
|
|
30
|
+
"aria-label": ariaLabel.value,
|
|
31
|
+
},
|
|
32
|
+
slots.default
|
|
33
|
+
? slots.default()
|
|
34
|
+
: [h(IconX, { class: "cpk:h-4 cpk:w-4", "aria-hidden": true })],
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineComponent, h } from "vue";
|
|
2
|
+
|
|
3
|
+
export default defineComponent({
|
|
4
|
+
name: "CopilotModalHeaderTitle",
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
setup(_, { attrs, slots }) {
|
|
7
|
+
return () => {
|
|
8
|
+
const { class: className, ...rest } = attrs as Record<string, unknown>;
|
|
9
|
+
return h(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
...rest,
|
|
13
|
+
class: [
|
|
14
|
+
"cpk:w-full cpk:text-base cpk:font-medium cpk:leading-none cpk:tracking-tight cpk:text-foreground",
|
|
15
|
+
className,
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
slots.default ? slots.default() : [],
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, watch } from "vue";
|
|
3
|
+
import CopilotChat from "./CopilotChat.vue";
|
|
4
|
+
import CopilotPopupView from "./CopilotPopupView.vue";
|
|
5
|
+
import CopilotPopupWelcomeScreen from "./CopilotPopupWelcomeScreen.vue";
|
|
6
|
+
import InlineFeatureWarning from "../InlineFeatureWarning.vue";
|
|
7
|
+
import { useLicenseContext } from "../../providers/useLicenseContext";
|
|
8
|
+
import type {
|
|
9
|
+
CopilotChatMessageViewSlotProps,
|
|
10
|
+
CopilotChatViewOverrideSlotProps,
|
|
11
|
+
CopilotChatWelcomeScreenSlotProps,
|
|
12
|
+
CopilotPopupProps,
|
|
13
|
+
CopilotPopupViewHeaderSlotProps,
|
|
14
|
+
CopilotPopupViewToggleButtonSlotProps,
|
|
15
|
+
CopilotSidebarWelcomeScreenInputSlotProps,
|
|
16
|
+
CopilotSidebarWelcomeScreenSuggestionViewSlotProps,
|
|
17
|
+
} from "./types";
|
|
18
|
+
import type { Suggestion } from "@copilotkit/core";
|
|
19
|
+
|
|
20
|
+
function popupViewEventBindings(slotProps: CopilotChatViewOverrideSlotProps) {
|
|
21
|
+
return {
|
|
22
|
+
onSubmitMessage: slotProps.onSubmitMessage,
|
|
23
|
+
onInputChange: slotProps.onInputChange,
|
|
24
|
+
onSelectSuggestion: slotProps.onSelectSuggestion,
|
|
25
|
+
...(slotProps.onStop ? { onStop: slotProps.onStop } : {}),
|
|
26
|
+
...(slotProps.onAddFile ? { onAddFile: slotProps.onAddFile } : {}),
|
|
27
|
+
...(slotProps.onStartTranscribe
|
|
28
|
+
? { onStartTranscribe: slotProps.onStartTranscribe }
|
|
29
|
+
: {}),
|
|
30
|
+
...(slotProps.onCancelTranscribe
|
|
31
|
+
? { onCancelTranscribe: slotProps.onCancelTranscribe }
|
|
32
|
+
: {}),
|
|
33
|
+
...(slotProps.onFinishTranscribe
|
|
34
|
+
? { onFinishTranscribe: slotProps.onFinishTranscribe }
|
|
35
|
+
: {}),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const props = withDefaults(defineProps<CopilotPopupProps>(), {
|
|
40
|
+
autoScroll: true,
|
|
41
|
+
welcomeScreen: true,
|
|
42
|
+
inputValue: undefined,
|
|
43
|
+
inputMode: "input",
|
|
44
|
+
inputToolsMenu: () => [],
|
|
45
|
+
width: undefined,
|
|
46
|
+
height: undefined,
|
|
47
|
+
clickOutsideToClose: false,
|
|
48
|
+
defaultOpen: true,
|
|
49
|
+
onFinishTranscribeWithAudio: undefined,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
defineSlots<{
|
|
53
|
+
header?: (props: CopilotPopupViewHeaderSlotProps) => unknown;
|
|
54
|
+
"toggle-button"?: (props: CopilotPopupViewToggleButtonSlotProps) => unknown;
|
|
55
|
+
"chat-view"?: (props: CopilotChatViewOverrideSlotProps) => unknown;
|
|
56
|
+
"message-view"?: (props: CopilotChatMessageViewSlotProps) => unknown;
|
|
57
|
+
input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;
|
|
58
|
+
"suggestion-view"?: (
|
|
59
|
+
props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,
|
|
60
|
+
) => unknown;
|
|
61
|
+
"welcome-screen"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;
|
|
62
|
+
"welcome-message"?: () => unknown;
|
|
63
|
+
}>();
|
|
64
|
+
|
|
65
|
+
defineEmits<{
|
|
66
|
+
"submit-message": [value: string];
|
|
67
|
+
stop: [];
|
|
68
|
+
"input-change": [value: string];
|
|
69
|
+
"select-suggestion": [suggestion: Suggestion, index: number];
|
|
70
|
+
"add-file": [];
|
|
71
|
+
"start-transcribe": [];
|
|
72
|
+
"cancel-transcribe": [];
|
|
73
|
+
"finish-transcribe": [];
|
|
74
|
+
}>();
|
|
75
|
+
|
|
76
|
+
const license = useLicenseContext();
|
|
77
|
+
const isPopupLicensed = computed(() => license.value.checkFeature("popup"));
|
|
78
|
+
|
|
79
|
+
watch(
|
|
80
|
+
isPopupLicensed,
|
|
81
|
+
(licensed) => {
|
|
82
|
+
if (!licensed) {
|
|
83
|
+
console.warn(
|
|
84
|
+
'[CopilotKit] Warning: "popup" feature is not licensed. Visit copilotkit.ai/pricing',
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{ immediate: true },
|
|
89
|
+
);
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<template>
|
|
93
|
+
<InlineFeatureWarning v-if="!isPopupLicensed" feature-name="Popup" />
|
|
94
|
+
<CopilotChat
|
|
95
|
+
v-bind="props"
|
|
96
|
+
@submit-message="$emit('submit-message', $event)"
|
|
97
|
+
@stop="$emit('stop')"
|
|
98
|
+
@input-change="$emit('input-change', $event)"
|
|
99
|
+
@select-suggestion="
|
|
100
|
+
(suggestion, index) => $emit('select-suggestion', suggestion, index)
|
|
101
|
+
"
|
|
102
|
+
@add-file="$emit('add-file')"
|
|
103
|
+
@start-transcribe="$emit('start-transcribe')"
|
|
104
|
+
@cancel-transcribe="$emit('cancel-transcribe')"
|
|
105
|
+
@finish-transcribe="$emit('finish-transcribe')"
|
|
106
|
+
>
|
|
107
|
+
<template #chat-view="slotProps">
|
|
108
|
+
<slot v-if="$slots['chat-view']" name="chat-view" v-bind="slotProps" />
|
|
109
|
+
<CopilotPopupView
|
|
110
|
+
v-else
|
|
111
|
+
:messages="slotProps.messages"
|
|
112
|
+
:auto-scroll="slotProps.autoScroll"
|
|
113
|
+
:is-running="slotProps.isRunning"
|
|
114
|
+
:suggestions="slotProps.suggestions"
|
|
115
|
+
:suggestion-loading-indexes="slotProps.suggestionLoadingIndexes"
|
|
116
|
+
:welcome-screen="slotProps.welcomeScreen"
|
|
117
|
+
:input-value="slotProps.inputValue"
|
|
118
|
+
:input-mode="slotProps.inputMode"
|
|
119
|
+
:input-tools-menu="slotProps.inputToolsMenu"
|
|
120
|
+
:width="width"
|
|
121
|
+
:height="height"
|
|
122
|
+
:click-outside-to-close="clickOutsideToClose"
|
|
123
|
+
:default-open="defaultOpen"
|
|
124
|
+
:on-finish-transcribe-with-audio="slotProps.onFinishTranscribeWithAudio"
|
|
125
|
+
v-bind="popupViewEventBindings(slotProps)"
|
|
126
|
+
>
|
|
127
|
+
<template v-if="$slots.header" #header="headerProps">
|
|
128
|
+
<slot name="header" v-bind="headerProps" />
|
|
129
|
+
</template>
|
|
130
|
+
|
|
131
|
+
<template
|
|
132
|
+
v-if="$slots['toggle-button']"
|
|
133
|
+
#toggle-button="toggleButtonProps"
|
|
134
|
+
>
|
|
135
|
+
<slot name="toggle-button" v-bind="toggleButtonProps" />
|
|
136
|
+
</template>
|
|
137
|
+
|
|
138
|
+
<template #welcome-screen="welcomeScreenProps">
|
|
139
|
+
<slot
|
|
140
|
+
v-if="$slots['welcome-screen']"
|
|
141
|
+
name="welcome-screen"
|
|
142
|
+
v-bind="welcomeScreenProps"
|
|
143
|
+
/>
|
|
144
|
+
<CopilotPopupWelcomeScreen v-else v-bind="welcomeScreenProps">
|
|
145
|
+
<template v-if="$slots['welcome-message']" #welcome-message>
|
|
146
|
+
<slot name="welcome-message" />
|
|
147
|
+
</template>
|
|
148
|
+
|
|
149
|
+
<template
|
|
150
|
+
v-if="$slots['suggestion-view']"
|
|
151
|
+
#suggestion-view="suggestionViewProps"
|
|
152
|
+
>
|
|
153
|
+
<slot name="suggestion-view" v-bind="suggestionViewProps" />
|
|
154
|
+
</template>
|
|
155
|
+
|
|
156
|
+
<template v-if="$slots.input" #input="inputProps">
|
|
157
|
+
<slot name="input" v-bind="inputProps" />
|
|
158
|
+
</template>
|
|
159
|
+
</CopilotPopupWelcomeScreen>
|
|
160
|
+
</template>
|
|
161
|
+
|
|
162
|
+
<template
|
|
163
|
+
v-if="$slots['message-view']"
|
|
164
|
+
#message-view="messageViewProps"
|
|
165
|
+
>
|
|
166
|
+
<slot name="message-view" v-bind="messageViewProps" />
|
|
167
|
+
</template>
|
|
168
|
+
|
|
169
|
+
<template v-if="$slots.input" #input="inputProps">
|
|
170
|
+
<slot name="input" v-bind="inputProps" />
|
|
171
|
+
</template>
|
|
172
|
+
|
|
173
|
+
<template
|
|
174
|
+
v-if="$slots['suggestion-view']"
|
|
175
|
+
#suggestion-view="suggestionViewProps"
|
|
176
|
+
>
|
|
177
|
+
<slot name="suggestion-view" v-bind="suggestionViewProps" />
|
|
178
|
+
</template>
|
|
179
|
+
</CopilotPopupView>
|
|
180
|
+
</template>
|
|
181
|
+
</CopilotChat>
|
|
182
|
+
</template>
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, getCurrentInstance, useAttrs } from "vue";
|
|
3
|
+
import CopilotChatConfigurationProvider from "../../providers/CopilotChatConfigurationProvider.vue";
|
|
4
|
+
import CopilotPopupViewInternal from "./CopilotPopupViewInternal.vue";
|
|
5
|
+
import type {
|
|
6
|
+
CopilotChatFeatherSlotProps,
|
|
7
|
+
CopilotChatMessageViewSlotProps,
|
|
8
|
+
CopilotChatScrollToBottomButtonSlotProps,
|
|
9
|
+
CopilotChatScrollViewSlotProps,
|
|
10
|
+
CopilotChatWelcomeScreenSlotProps,
|
|
11
|
+
CopilotPopupViewHeaderSlotProps,
|
|
12
|
+
CopilotPopupViewProps,
|
|
13
|
+
CopilotPopupViewToggleButtonSlotProps,
|
|
14
|
+
CopilotSidebarWelcomeScreenInputSlotProps,
|
|
15
|
+
CopilotSidebarWelcomeScreenSuggestionViewSlotProps,
|
|
16
|
+
} from "./types";
|
|
17
|
+
|
|
18
|
+
defineOptions({ inheritAttrs: false });
|
|
19
|
+
|
|
20
|
+
const props = withDefaults(defineProps<CopilotPopupViewProps>(), {
|
|
21
|
+
messages: () => [],
|
|
22
|
+
autoScroll: true,
|
|
23
|
+
isRunning: false,
|
|
24
|
+
suggestions: () => [],
|
|
25
|
+
suggestionLoadingIndexes: () => [],
|
|
26
|
+
welcomeScreen: true,
|
|
27
|
+
inputValue: undefined,
|
|
28
|
+
inputMode: "input",
|
|
29
|
+
inputToolsMenu: () => [],
|
|
30
|
+
width: undefined,
|
|
31
|
+
height: undefined,
|
|
32
|
+
clickOutsideToClose: false,
|
|
33
|
+
defaultOpen: true,
|
|
34
|
+
onFinishTranscribeWithAudio: undefined,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
defineSlots<{
|
|
38
|
+
header?: (props: CopilotPopupViewHeaderSlotProps) => unknown;
|
|
39
|
+
"toggle-button"?: (props: CopilotPopupViewToggleButtonSlotProps) => unknown;
|
|
40
|
+
"message-view"?: (props: CopilotChatMessageViewSlotProps) => unknown;
|
|
41
|
+
"scroll-view"?: (props: CopilotChatScrollViewSlotProps) => unknown;
|
|
42
|
+
feather?: (props: CopilotChatFeatherSlotProps) => unknown;
|
|
43
|
+
"scroll-to-bottom-button"?: (
|
|
44
|
+
props: CopilotChatScrollToBottomButtonSlotProps,
|
|
45
|
+
) => unknown;
|
|
46
|
+
input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;
|
|
47
|
+
"suggestion-view"?: (
|
|
48
|
+
props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,
|
|
49
|
+
) => unknown;
|
|
50
|
+
"welcome-screen"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;
|
|
51
|
+
"welcome-message"?: () => unknown;
|
|
52
|
+
}>();
|
|
53
|
+
|
|
54
|
+
const emit = defineEmits<{
|
|
55
|
+
"submit-message": [value: string];
|
|
56
|
+
stop: [];
|
|
57
|
+
"input-change": [value: string];
|
|
58
|
+
"select-suggestion": [
|
|
59
|
+
suggestion: (typeof props.suggestions)[number],
|
|
60
|
+
index: number,
|
|
61
|
+
];
|
|
62
|
+
"add-file": [];
|
|
63
|
+
"start-transcribe": [];
|
|
64
|
+
"cancel-transcribe": [];
|
|
65
|
+
"finish-transcribe": [];
|
|
66
|
+
}>();
|
|
67
|
+
|
|
68
|
+
const attrs = useAttrs();
|
|
69
|
+
const instance = getCurrentInstance();
|
|
70
|
+
const vnodeProps = computed(
|
|
71
|
+
() => (instance?.vnode.props ?? {}) as Record<string, unknown>,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
function hasListener(listenerName: string) {
|
|
75
|
+
const listener = vnodeProps.value[listenerName];
|
|
76
|
+
if (Array.isArray(listener)) {
|
|
77
|
+
return listener.length > 0;
|
|
78
|
+
}
|
|
79
|
+
return !!listener;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const internalProps = computed(() => {
|
|
83
|
+
const { defaultOpen: _defaultOpen, ...rest } = props;
|
|
84
|
+
return rest;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const forwardedEventListeners = computed(() => {
|
|
88
|
+
const listeners: Record<string, unknown> = {
|
|
89
|
+
onSubmitMessage: (value: string) => emit("submit-message", value),
|
|
90
|
+
onStop: () => emit("stop"),
|
|
91
|
+
onInputChange: (value: string) => emit("input-change", value),
|
|
92
|
+
onSelectSuggestion: (
|
|
93
|
+
suggestion: (typeof props.suggestions)[number],
|
|
94
|
+
index: number,
|
|
95
|
+
) => emit("select-suggestion", suggestion, index),
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
if (hasListener("onAddFile")) {
|
|
99
|
+
listeners.onAddFile = () => emit("add-file");
|
|
100
|
+
}
|
|
101
|
+
if (hasListener("onStartTranscribe")) {
|
|
102
|
+
listeners.onStartTranscribe = () => emit("start-transcribe");
|
|
103
|
+
}
|
|
104
|
+
if (hasListener("onCancelTranscribe")) {
|
|
105
|
+
listeners.onCancelTranscribe = () => emit("cancel-transcribe");
|
|
106
|
+
}
|
|
107
|
+
if (hasListener("onFinishTranscribe")) {
|
|
108
|
+
listeners.onFinishTranscribe = () => emit("finish-transcribe");
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return listeners;
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const internalBindings = computed(() => ({
|
|
115
|
+
...attrs,
|
|
116
|
+
...internalProps.value,
|
|
117
|
+
...forwardedEventListeners.value,
|
|
118
|
+
}));
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<template>
|
|
122
|
+
<CopilotChatConfigurationProvider :is-modal-default-open="defaultOpen">
|
|
123
|
+
<CopilotPopupViewInternal v-bind="internalBindings">
|
|
124
|
+
<template v-if="$slots.header" #header="slotProps">
|
|
125
|
+
<slot name="header" v-bind="slotProps" />
|
|
126
|
+
</template>
|
|
127
|
+
|
|
128
|
+
<template v-if="$slots['toggle-button']" #toggle-button="slotProps">
|
|
129
|
+
<slot name="toggle-button" v-bind="slotProps" />
|
|
130
|
+
</template>
|
|
131
|
+
|
|
132
|
+
<template v-if="$slots['message-view']" #message-view="slotProps">
|
|
133
|
+
<slot name="message-view" v-bind="slotProps" />
|
|
134
|
+
</template>
|
|
135
|
+
|
|
136
|
+
<template v-if="$slots['scroll-view']" #scroll-view="slotProps">
|
|
137
|
+
<slot name="scroll-view" v-bind="slotProps" />
|
|
138
|
+
</template>
|
|
139
|
+
|
|
140
|
+
<template v-if="$slots.feather" #feather="slotProps">
|
|
141
|
+
<slot name="feather" v-bind="slotProps" />
|
|
142
|
+
</template>
|
|
143
|
+
|
|
144
|
+
<template
|
|
145
|
+
v-if="$slots['scroll-to-bottom-button']"
|
|
146
|
+
#scroll-to-bottom-button="slotProps"
|
|
147
|
+
>
|
|
148
|
+
<slot name="scroll-to-bottom-button" v-bind="slotProps" />
|
|
149
|
+
</template>
|
|
150
|
+
|
|
151
|
+
<template v-if="$slots.input" #input="slotProps">
|
|
152
|
+
<slot name="input" v-bind="slotProps" />
|
|
153
|
+
</template>
|
|
154
|
+
|
|
155
|
+
<template v-if="$slots['suggestion-view']" #suggestion-view="slotProps">
|
|
156
|
+
<slot name="suggestion-view" v-bind="slotProps" />
|
|
157
|
+
</template>
|
|
158
|
+
|
|
159
|
+
<template v-if="$slots['welcome-screen']" #welcome-screen="slotProps">
|
|
160
|
+
<slot name="welcome-screen" v-bind="slotProps" />
|
|
161
|
+
</template>
|
|
162
|
+
|
|
163
|
+
<template v-if="$slots['welcome-message']" #welcome-message>
|
|
164
|
+
<slot name="welcome-message" />
|
|
165
|
+
</template>
|
|
166
|
+
</CopilotPopupViewInternal>
|
|
167
|
+
</CopilotChatConfigurationProvider>
|
|
168
|
+
</template>
|