@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,366 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
computed,
|
|
4
|
+
getCurrentInstance,
|
|
5
|
+
nextTick,
|
|
6
|
+
onBeforeUnmount,
|
|
7
|
+
onMounted,
|
|
8
|
+
ref,
|
|
9
|
+
useAttrs,
|
|
10
|
+
watch,
|
|
11
|
+
} from "vue";
|
|
12
|
+
import { CopilotChatDefaultLabels } from "../../providers/types";
|
|
13
|
+
import { useCopilotChatConfiguration } from "../../providers/useCopilotChatConfiguration";
|
|
14
|
+
import CopilotChatToggleButton from "./CopilotChatToggleButton.vue";
|
|
15
|
+
import CopilotChatView from "./CopilotChatView.vue";
|
|
16
|
+
import CopilotModalHeader from "./CopilotModalHeader.vue";
|
|
17
|
+
import type {
|
|
18
|
+
CopilotChatFeatherSlotProps,
|
|
19
|
+
CopilotChatMessageViewSlotProps,
|
|
20
|
+
CopilotChatScrollToBottomButtonSlotProps,
|
|
21
|
+
CopilotChatScrollViewSlotProps,
|
|
22
|
+
CopilotChatWelcomeScreenSlotProps,
|
|
23
|
+
CopilotSidebarWelcomeScreenInputSlotProps,
|
|
24
|
+
CopilotSidebarWelcomeScreenSuggestionViewSlotProps,
|
|
25
|
+
CopilotSidebarViewHeaderSlotProps,
|
|
26
|
+
CopilotSidebarViewProps,
|
|
27
|
+
CopilotSidebarViewToggleButtonSlotProps,
|
|
28
|
+
} from "./types";
|
|
29
|
+
|
|
30
|
+
defineOptions({ inheritAttrs: false });
|
|
31
|
+
|
|
32
|
+
const DEFAULT_SIDEBAR_WIDTH = 480;
|
|
33
|
+
const SIDEBAR_TRANSITION_MS = 260;
|
|
34
|
+
|
|
35
|
+
const props = withDefaults(
|
|
36
|
+
defineProps<Omit<CopilotSidebarViewProps, "defaultOpen">>(),
|
|
37
|
+
{
|
|
38
|
+
messages: () => [],
|
|
39
|
+
autoScroll: true,
|
|
40
|
+
isRunning: false,
|
|
41
|
+
suggestions: () => [],
|
|
42
|
+
suggestionLoadingIndexes: () => [],
|
|
43
|
+
welcomeScreen: true,
|
|
44
|
+
inputValue: undefined,
|
|
45
|
+
inputMode: "input",
|
|
46
|
+
inputToolsMenu: () => [],
|
|
47
|
+
width: undefined,
|
|
48
|
+
onFinishTranscribeWithAudio: undefined,
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
defineSlots<{
|
|
53
|
+
header?: (props: CopilotSidebarViewHeaderSlotProps) => unknown;
|
|
54
|
+
"toggle-button"?: (props: CopilotSidebarViewToggleButtonSlotProps) => unknown;
|
|
55
|
+
"message-view"?: (props: CopilotChatMessageViewSlotProps) => unknown;
|
|
56
|
+
"scroll-view"?: (props: CopilotChatScrollViewSlotProps) => unknown;
|
|
57
|
+
feather?: (props: CopilotChatFeatherSlotProps) => unknown;
|
|
58
|
+
"scroll-to-bottom-button"?: (
|
|
59
|
+
props: CopilotChatScrollToBottomButtonSlotProps,
|
|
60
|
+
) => unknown;
|
|
61
|
+
input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;
|
|
62
|
+
"suggestion-view"?: (
|
|
63
|
+
props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,
|
|
64
|
+
) => unknown;
|
|
65
|
+
"welcome-screen"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;
|
|
66
|
+
"welcome-message"?: () => unknown;
|
|
67
|
+
}>();
|
|
68
|
+
|
|
69
|
+
const emit = defineEmits<{
|
|
70
|
+
"submit-message": [value: string];
|
|
71
|
+
stop: [];
|
|
72
|
+
"input-change": [value: string];
|
|
73
|
+
"select-suggestion": [
|
|
74
|
+
suggestion: (typeof props.suggestions)[number],
|
|
75
|
+
index: number,
|
|
76
|
+
];
|
|
77
|
+
"add-file": [];
|
|
78
|
+
"start-transcribe": [];
|
|
79
|
+
"cancel-transcribe": [];
|
|
80
|
+
"finish-transcribe": [];
|
|
81
|
+
}>();
|
|
82
|
+
|
|
83
|
+
const attrs = useAttrs();
|
|
84
|
+
const config = useCopilotChatConfiguration();
|
|
85
|
+
const instance = getCurrentInstance();
|
|
86
|
+
const vnodeProps = computed(
|
|
87
|
+
() => (instance?.vnode.props ?? {}) as Record<string, unknown>,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const sidebarRef = ref<HTMLElement | null>(null);
|
|
91
|
+
const measuredSidebarWidth = ref<number | string>(
|
|
92
|
+
props.width ?? DEFAULT_SIDEBAR_WIDTH,
|
|
93
|
+
);
|
|
94
|
+
let resizeObserver: ResizeObserver | null = null;
|
|
95
|
+
|
|
96
|
+
const isSidebarOpen = computed(() => config.value?.isModalOpen ?? false);
|
|
97
|
+
const resolvedSidebarWidth = computed(
|
|
98
|
+
() => props.width ?? measuredSidebarWidth.value,
|
|
99
|
+
);
|
|
100
|
+
const headerTitle = computed(
|
|
101
|
+
() =>
|
|
102
|
+
config.value?.labels.modalHeaderTitle ??
|
|
103
|
+
CopilotChatDefaultLabels.modalHeaderTitle,
|
|
104
|
+
);
|
|
105
|
+
const asideClass = computed(() => [
|
|
106
|
+
"cpk:fixed cpk:right-0 cpk:top-0 cpk:z-[1200] cpk:flex cpk:h-[100vh] cpk:h-[100dvh] cpk:max-h-screen cpk:w-full",
|
|
107
|
+
"cpk:border-l cpk:border-border cpk:bg-background cpk:text-foreground cpk:shadow-xl",
|
|
108
|
+
"cpk:transition-transform cpk:duration-300 cpk:ease-out",
|
|
109
|
+
isSidebarOpen.value
|
|
110
|
+
? "cpk:translate-x-0"
|
|
111
|
+
: "cpk:translate-x-full cpk:pointer-events-none",
|
|
112
|
+
attrs.class,
|
|
113
|
+
]);
|
|
114
|
+
const asideAttrs = computed(() => {
|
|
115
|
+
const { class: _className, ...rest } = attrs;
|
|
116
|
+
return rest;
|
|
117
|
+
});
|
|
118
|
+
const hasStopAction = computed(() => hasListener("onStop"));
|
|
119
|
+
const asideStyle = computed(
|
|
120
|
+
() =>
|
|
121
|
+
({
|
|
122
|
+
"--sidebar-width": widthToCss(resolvedSidebarWidth.value),
|
|
123
|
+
paddingTop: "env(safe-area-inset-top)",
|
|
124
|
+
paddingBottom: "env(safe-area-inset-bottom)",
|
|
125
|
+
}) as Record<string, string>,
|
|
126
|
+
);
|
|
127
|
+
const bodyMarginStyle = computed(
|
|
128
|
+
() => `
|
|
129
|
+
@media (min-width: 768px) {
|
|
130
|
+
body {
|
|
131
|
+
margin-inline-end: ${widthToMargin(resolvedSidebarWidth.value)};
|
|
132
|
+
transition: margin-inline-end ${SIDEBAR_TRANSITION_MS}ms ease;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
`,
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
function hasListener(listenerName: string) {
|
|
139
|
+
const listener = vnodeProps.value[listenerName];
|
|
140
|
+
if (Array.isArray(listener)) {
|
|
141
|
+
return listener.length > 0;
|
|
142
|
+
}
|
|
143
|
+
return !!listener;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function widthToCss(width: number | string): string {
|
|
147
|
+
return typeof width === "number" ? `${width}px` : width;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function widthToMargin(width: number | string): string {
|
|
151
|
+
return typeof width === "number" ? `${width}px` : width;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function updateMeasuredWidth() {
|
|
155
|
+
if (props.width !== undefined || !sidebarRef.value) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const nextWidth = sidebarRef.value.getBoundingClientRect().width;
|
|
160
|
+
if (nextWidth > 0) {
|
|
161
|
+
measuredSidebarWidth.value = nextWidth;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function closeSidebar() {
|
|
166
|
+
config.value?.setModalOpen?.(false);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function openSidebar() {
|
|
170
|
+
config.value?.setModalOpen?.(true);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function toggleSidebar() {
|
|
174
|
+
config.value?.setModalOpen?.(!isSidebarOpen.value);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function handleSubmitMessage(value: string) {
|
|
178
|
+
emit("submit-message", value);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function handleStop() {
|
|
182
|
+
emit("stop");
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function handleInputChange(value: string) {
|
|
186
|
+
emit("input-change", value);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function handleSelectSuggestion(
|
|
190
|
+
suggestion: (typeof props.suggestions)[number],
|
|
191
|
+
index: number,
|
|
192
|
+
) {
|
|
193
|
+
emit("select-suggestion", suggestion, index);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function handleAddFile() {
|
|
197
|
+
emit("add-file");
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function handleStartTranscribe() {
|
|
201
|
+
emit("start-transcribe");
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function handleCancelTranscribe() {
|
|
205
|
+
emit("cancel-transcribe");
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function handleFinishTranscribe() {
|
|
209
|
+
emit("finish-transcribe");
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const chatViewEventProps = computed(() => {
|
|
213
|
+
const listeners: Record<string, unknown> = {
|
|
214
|
+
onSubmitMessage: handleSubmitMessage,
|
|
215
|
+
onInputChange: handleInputChange,
|
|
216
|
+
onSelectSuggestion: handleSelectSuggestion,
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
if (hasStopAction.value) {
|
|
220
|
+
listeners.onStop = handleStop;
|
|
221
|
+
}
|
|
222
|
+
if (hasListener("onAddFile")) {
|
|
223
|
+
listeners.onAddFile = handleAddFile;
|
|
224
|
+
}
|
|
225
|
+
if (hasListener("onStartTranscribe")) {
|
|
226
|
+
listeners.onStartTranscribe = handleStartTranscribe;
|
|
227
|
+
}
|
|
228
|
+
if (hasListener("onCancelTranscribe")) {
|
|
229
|
+
listeners.onCancelTranscribe = handleCancelTranscribe;
|
|
230
|
+
}
|
|
231
|
+
if (hasListener("onFinishTranscribe")) {
|
|
232
|
+
listeners.onFinishTranscribe = handleFinishTranscribe;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return listeners;
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
watch(
|
|
239
|
+
() => props.width,
|
|
240
|
+
(nextWidth) => {
|
|
241
|
+
if (nextWidth !== undefined) {
|
|
242
|
+
measuredSidebarWidth.value = nextWidth;
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
updateMeasuredWidth();
|
|
246
|
+
},
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
onMounted(async () => {
|
|
250
|
+
await nextTick();
|
|
251
|
+
updateMeasuredWidth();
|
|
252
|
+
|
|
253
|
+
if (
|
|
254
|
+
props.width !== undefined ||
|
|
255
|
+
!sidebarRef.value ||
|
|
256
|
+
typeof ResizeObserver === "undefined"
|
|
257
|
+
) {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
resizeObserver = new ResizeObserver(() => {
|
|
262
|
+
updateMeasuredWidth();
|
|
263
|
+
});
|
|
264
|
+
resizeObserver.observe(sidebarRef.value);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
onBeforeUnmount(() => {
|
|
268
|
+
resizeObserver?.disconnect();
|
|
269
|
+
resizeObserver = null;
|
|
270
|
+
});
|
|
271
|
+
</script>
|
|
272
|
+
|
|
273
|
+
<template>
|
|
274
|
+
<component :is="'style'" v-if="isSidebarOpen">
|
|
275
|
+
{{ bodyMarginStyle }}
|
|
276
|
+
</component>
|
|
277
|
+
|
|
278
|
+
<slot
|
|
279
|
+
name="toggle-button"
|
|
280
|
+
:is-open="isSidebarOpen"
|
|
281
|
+
:toggle="toggleSidebar"
|
|
282
|
+
:open="openSidebar"
|
|
283
|
+
:close="closeSidebar"
|
|
284
|
+
>
|
|
285
|
+
<CopilotChatToggleButton />
|
|
286
|
+
</slot>
|
|
287
|
+
|
|
288
|
+
<aside
|
|
289
|
+
ref="sidebarRef"
|
|
290
|
+
data-copilotkit
|
|
291
|
+
data-copilot-sidebar
|
|
292
|
+
:class="asideClass"
|
|
293
|
+
:style="asideStyle"
|
|
294
|
+
aria-label="Copilot chat sidebar"
|
|
295
|
+
:aria-hidden="!isSidebarOpen"
|
|
296
|
+
role="complementary"
|
|
297
|
+
v-bind="asideAttrs"
|
|
298
|
+
>
|
|
299
|
+
<div
|
|
300
|
+
class="cpk:flex cpk:h-full cpk:w-full cpk:flex-col cpk:overflow-hidden"
|
|
301
|
+
>
|
|
302
|
+
<slot
|
|
303
|
+
name="header"
|
|
304
|
+
:title="headerTitle"
|
|
305
|
+
:on-close="closeSidebar"
|
|
306
|
+
:is-open="isSidebarOpen"
|
|
307
|
+
>
|
|
308
|
+
<CopilotModalHeader :title="headerTitle" />
|
|
309
|
+
</slot>
|
|
310
|
+
|
|
311
|
+
<div class="cpk:flex-1 cpk:overflow-hidden" data-sidebar-chat>
|
|
312
|
+
<CopilotChatView
|
|
313
|
+
:messages="messages"
|
|
314
|
+
:auto-scroll="autoScroll"
|
|
315
|
+
:is-running="isRunning"
|
|
316
|
+
:suggestions="suggestions"
|
|
317
|
+
:suggestion-loading-indexes="suggestionLoadingIndexes"
|
|
318
|
+
:welcome-screen="welcomeScreen"
|
|
319
|
+
:input-value="inputValue"
|
|
320
|
+
:input-mode="inputMode"
|
|
321
|
+
:input-tools-menu="inputToolsMenu"
|
|
322
|
+
:on-finish-transcribe-with-audio="onFinishTranscribeWithAudio"
|
|
323
|
+
v-bind="chatViewEventProps"
|
|
324
|
+
>
|
|
325
|
+
<template v-if="$slots['message-view']" #message-view="slotProps">
|
|
326
|
+
<slot name="message-view" v-bind="slotProps" />
|
|
327
|
+
</template>
|
|
328
|
+
|
|
329
|
+
<template v-if="$slots['scroll-view']" #scroll-view="slotProps">
|
|
330
|
+
<slot name="scroll-view" v-bind="slotProps" />
|
|
331
|
+
</template>
|
|
332
|
+
|
|
333
|
+
<template v-if="$slots.feather" #feather>
|
|
334
|
+
<slot name="feather" />
|
|
335
|
+
</template>
|
|
336
|
+
|
|
337
|
+
<template
|
|
338
|
+
v-if="$slots['scroll-to-bottom-button']"
|
|
339
|
+
#scroll-to-bottom-button="slotProps"
|
|
340
|
+
>
|
|
341
|
+
<slot name="scroll-to-bottom-button" v-bind="slotProps" />
|
|
342
|
+
</template>
|
|
343
|
+
|
|
344
|
+
<template v-if="$slots.input" #input="slotProps">
|
|
345
|
+
<slot name="input" v-bind="slotProps" />
|
|
346
|
+
</template>
|
|
347
|
+
|
|
348
|
+
<template
|
|
349
|
+
v-if="$slots['suggestion-view']"
|
|
350
|
+
#suggestion-view="slotProps"
|
|
351
|
+
>
|
|
352
|
+
<slot name="suggestion-view" v-bind="slotProps" />
|
|
353
|
+
</template>
|
|
354
|
+
|
|
355
|
+
<template v-if="$slots['welcome-screen']" #welcome-screen="slotProps">
|
|
356
|
+
<slot name="welcome-screen" v-bind="slotProps" />
|
|
357
|
+
</template>
|
|
358
|
+
|
|
359
|
+
<template v-if="$slots['welcome-message']" #welcome-message>
|
|
360
|
+
<slot name="welcome-message" />
|
|
361
|
+
</template>
|
|
362
|
+
</CopilotChatView>
|
|
363
|
+
</div>
|
|
364
|
+
</div>
|
|
365
|
+
</aside>
|
|
366
|
+
</template>
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useCopilotChatConfiguration } from "../../providers/useCopilotChatConfiguration";
|
|
4
|
+
import { CopilotChatDefaultLabels } from "../../providers/types";
|
|
5
|
+
import CopilotChatInput from "./CopilotChatInput.vue";
|
|
6
|
+
import CopilotChatSuggestionView from "./CopilotChatSuggestionView.vue";
|
|
7
|
+
import type {
|
|
8
|
+
CopilotSidebarWelcomeScreenInputSlotProps,
|
|
9
|
+
CopilotSidebarWelcomeScreenLayoutSlotProps,
|
|
10
|
+
CopilotSidebarWelcomeScreenProps,
|
|
11
|
+
CopilotSidebarWelcomeScreenSuggestionViewSlotProps,
|
|
12
|
+
} from "./types";
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<CopilotSidebarWelcomeScreenProps>(), {
|
|
15
|
+
suggestions: () => [],
|
|
16
|
+
loadingIndexes: () => [],
|
|
17
|
+
modelValue: "",
|
|
18
|
+
isRunning: false,
|
|
19
|
+
inputMode: "input",
|
|
20
|
+
inputToolsMenu: () => [],
|
|
21
|
+
onAddFile: undefined,
|
|
22
|
+
onStartTranscribe: undefined,
|
|
23
|
+
onCancelTranscribe: undefined,
|
|
24
|
+
onFinishTranscribe: undefined,
|
|
25
|
+
onFinishTranscribeWithAudio: undefined,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
defineSlots<{
|
|
29
|
+
"welcome-message"?: () => unknown;
|
|
30
|
+
input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;
|
|
31
|
+
"suggestion-view"?: (
|
|
32
|
+
props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,
|
|
33
|
+
) => unknown;
|
|
34
|
+
layout?: (props: CopilotSidebarWelcomeScreenLayoutSlotProps) => unknown;
|
|
35
|
+
}>();
|
|
36
|
+
|
|
37
|
+
const config = useCopilotChatConfiguration();
|
|
38
|
+
const labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);
|
|
39
|
+
|
|
40
|
+
const inputSlotProps = computed<CopilotSidebarWelcomeScreenInputSlotProps>(
|
|
41
|
+
() => ({
|
|
42
|
+
modelValue: props.modelValue,
|
|
43
|
+
isRunning: props.isRunning,
|
|
44
|
+
inputMode: props.inputMode,
|
|
45
|
+
inputToolsMenu: props.inputToolsMenu,
|
|
46
|
+
onUpdateModelValue: props.onUpdateModelValue,
|
|
47
|
+
onSubmitMessage: props.onSubmitMessage,
|
|
48
|
+
onStop: props.onStop,
|
|
49
|
+
onAddFile: props.onAddFile,
|
|
50
|
+
onStartTranscribe: props.onStartTranscribe,
|
|
51
|
+
onCancelTranscribe: props.onCancelTranscribe,
|
|
52
|
+
onFinishTranscribe: props.onFinishTranscribe,
|
|
53
|
+
onFinishTranscribeWithAudio: props.onFinishTranscribeWithAudio,
|
|
54
|
+
}),
|
|
55
|
+
);
|
|
56
|
+
const suggestionViewSlotProps =
|
|
57
|
+
computed<CopilotSidebarWelcomeScreenSuggestionViewSlotProps>(() => ({
|
|
58
|
+
suggestions: props.suggestions,
|
|
59
|
+
loadingIndexes: props.loadingIndexes,
|
|
60
|
+
onSelectSuggestion: props.onSelectSuggestion,
|
|
61
|
+
}));
|
|
62
|
+
const layoutSlotProps = computed<CopilotSidebarWelcomeScreenLayoutSlotProps>(
|
|
63
|
+
() => ({
|
|
64
|
+
...inputSlotProps.value,
|
|
65
|
+
...suggestionViewSlotProps.value,
|
|
66
|
+
}),
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const inputEventProps = computed(() => {
|
|
70
|
+
const listeners: Record<string, unknown> = {
|
|
71
|
+
"onUpdate:modelValue": props.onUpdateModelValue,
|
|
72
|
+
onSubmitMessage: props.onSubmitMessage,
|
|
73
|
+
onStop: props.onStop,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
if (props.onAddFile) {
|
|
77
|
+
listeners.onAddFile = props.onAddFile;
|
|
78
|
+
}
|
|
79
|
+
if (props.onStartTranscribe) {
|
|
80
|
+
listeners.onStartTranscribe = props.onStartTranscribe;
|
|
81
|
+
}
|
|
82
|
+
if (props.onCancelTranscribe) {
|
|
83
|
+
listeners.onCancelTranscribe = props.onCancelTranscribe;
|
|
84
|
+
}
|
|
85
|
+
if (props.onFinishTranscribe) {
|
|
86
|
+
listeners.onFinishTranscribe = props.onFinishTranscribe;
|
|
87
|
+
}
|
|
88
|
+
if (props.onFinishTranscribeWithAudio) {
|
|
89
|
+
listeners.onFinishTranscribeWithAudio = props.onFinishTranscribeWithAudio;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return listeners;
|
|
93
|
+
});
|
|
94
|
+
</script>
|
|
95
|
+
|
|
96
|
+
<template>
|
|
97
|
+
<slot name="layout" v-bind="layoutSlotProps">
|
|
98
|
+
<div
|
|
99
|
+
data-copilotkit
|
|
100
|
+
class="cpk:h-full cpk:flex cpk:flex-col"
|
|
101
|
+
data-testid="copilot-sidebar-welcome-screen"
|
|
102
|
+
>
|
|
103
|
+
<div
|
|
104
|
+
class="cpk:flex-1 cpk:flex cpk:flex-col cpk:items-center cpk:justify-center cpk:px-4"
|
|
105
|
+
>
|
|
106
|
+
<slot name="welcome-message">
|
|
107
|
+
<h1
|
|
108
|
+
class="cpk:text-xl cpk:sm:text-2xl cpk:font-medium cpk:text-foreground cpk:text-center"
|
|
109
|
+
>
|
|
110
|
+
{{ labels.welcomeMessageText }}
|
|
111
|
+
</h1>
|
|
112
|
+
</slot>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<div class="cpk:px-8 cpk:pb-4">
|
|
116
|
+
<div class="cpk:max-w-3xl cpk:mx-auto">
|
|
117
|
+
<div class="cpk:mb-4 cpk:flex cpk:justify-center">
|
|
118
|
+
<slot name="suggestion-view" v-bind="suggestionViewSlotProps">
|
|
119
|
+
<CopilotChatSuggestionView
|
|
120
|
+
:suggestions="suggestions"
|
|
121
|
+
:loading-indexes="loadingIndexes"
|
|
122
|
+
@select-suggestion="onSelectSuggestion"
|
|
123
|
+
/>
|
|
124
|
+
</slot>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<slot name="input" v-bind="inputSlotProps">
|
|
128
|
+
<CopilotChatInput
|
|
129
|
+
:model-value="modelValue"
|
|
130
|
+
:is-running="isRunning"
|
|
131
|
+
:mode="inputMode"
|
|
132
|
+
:tools-menu="inputToolsMenu"
|
|
133
|
+
positioning="static"
|
|
134
|
+
:show-disclaimer="true"
|
|
135
|
+
v-bind="inputEventProps"
|
|
136
|
+
/>
|
|
137
|
+
</slot>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</slot>
|
|
142
|
+
</template>
|