@copilotkit/vue 2.0.0-rc.3 → 2.0.0-rc.30
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/CONTRIBUTOR_GUIDE.md +1 -1
- package/PARITY.md +3 -3
- package/dist/hooks/use-copilot-action.d.ts.map +1 -1
- package/dist/hooks/use-frontend-tool.d.ts +1 -1
- package/dist/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/hooks/zod-parameters.d.ts +14 -0
- package/dist/hooks/zod-parameters.d.ts.map +1 -0
- package/dist/index.cjs +1 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +365 -16920
- package/dist/index.mjs.map +1 -1
- package/dist/use-render-activity-message-BZJ33B_r.cjs +113 -0
- package/dist/use-render-activity-message-BZJ33B_r.cjs.map +1 -0
- package/dist/use-render-activity-message-DrR407LQ.js +15901 -0
- package/dist/use-render-activity-message-DrR407LQ.js.map +1 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts +14 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -1
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts +10 -3
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/CopilotKitInspector.vue.d.ts +5 -1
- package/dist/v2/components/CopilotKitInspector.vue.d.ts.map +1 -1
- package/dist/v2/components/InlineFeatureWarning.vue.d.ts.map +1 -1
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts +2 -2
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -1
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts.map +1 -1
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +13 -59
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +3 -11
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +10 -15
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +14 -130
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -1
- package/dist/v2/components/a2ui/catalog.d.ts.map +1 -1
- package/dist/v2/components/a2ui/utils.d.ts +3 -15
- package/dist/v2/components/a2ui/utils.d.ts.map +1 -1
- package/dist/v2/components/a2ui.d.ts +9 -8
- package/dist/v2/components/a2ui.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChat.vue.d.ts +2 -2
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts +4 -8
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +7 -286
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +3 -3
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts +8 -3
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +5 -3
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +5 -3
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +8 -3
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +6 -4
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +6 -4
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotThreadsDrawer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts +1 -0
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/audioRecorder.d.ts +3 -4
- package/dist/v2/components/chat/audioRecorder.d.ts.map +1 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +4 -4
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
- package/dist/v2/components/chat/forwarded-slots.d.ts +12 -0
- package/dist/v2/components/chat/forwarded-slots.d.ts.map +1 -0
- package/dist/v2/components/chat/index.d.ts +34 -31
- package/dist/v2/components/chat/index.d.ts.map +1 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts +2 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts.map +1 -1
- package/dist/v2/components/chat/message-feedback.d.ts +38 -49
- package/dist/v2/components/chat/message-feedback.d.ts.map +1 -1
- package/dist/v2/components/chat/tool-call-display-context.d.ts +4 -19
- package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -1
- package/dist/v2/components/chat/tool-call-group-parts.d.ts +7 -20
- package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -1
- package/dist/v2/components/chat/turn-work.d.ts +0 -2
- package/dist/v2/components/chat/turn-work.d.ts.map +1 -1
- package/dist/v2/components/chat/types.d.ts +9 -4
- package/dist/v2/components/chat/types.d.ts.map +1 -1
- package/dist/v2/components/chat/use-chat-labels.d.ts +8 -0
- package/dist/v2/components/chat/use-chat-labels.d.ts.map +1 -0
- package/dist/v2/components/chat/use-copy-feedback.d.ts +11 -0
- package/dist/v2/components/chat/use-copy-feedback.d.ts.map +1 -0
- package/dist/v2/components/chat/use-lightbox.d.ts.map +1 -1
- package/dist/v2/components/icons/index.d.ts +968 -1
- package/dist/v2/components/icons/index.d.ts.map +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts.map +1 -1
- package/dist/v2/hooks/use-agent-context.d.ts +2 -3
- package/dist/v2/hooks/use-agent-context.d.ts.map +1 -1
- package/dist/v2/hooks/use-agent.d.ts +4 -1
- package/dist/v2/hooks/use-agent.d.ts.map +1 -1
- package/dist/v2/hooks/use-attachments.d.ts +7 -0
- package/dist/v2/hooks/use-attachments.d.ts.map +1 -1
- package/dist/v2/hooks/use-capabilities.d.ts.map +1 -1
- package/dist/v2/hooks/use-component.d.ts +1 -0
- package/dist/v2/hooks/use-component.d.ts.map +1 -1
- package/dist/v2/hooks/use-configure-suggestions.d.ts +4 -9
- package/dist/v2/hooks/use-configure-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-default-render-tool.d.ts +2 -7
- package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-frontend-tool.d.ts +5 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-human-in-the-loop.d.ts +2 -1
- package/dist/v2/hooks/use-human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/hooks/use-interrupt.d.ts +0 -1
- package/dist/v2/hooks/use-interrupt.d.ts.map +1 -1
- package/dist/v2/hooks/use-keyboard-height.d.ts +1 -1
- package/dist/v2/hooks/use-keyboard-height.d.ts.map +1 -1
- package/dist/v2/hooks/use-pin-to-send.d.ts +4 -12
- package/dist/v2/hooks/use-pin-to-send.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-activity-message.d.ts +13 -9
- package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-custom-messages.d.ts +5 -7
- package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-tool.d.ts +1 -1
- package/dist/v2/hooks/use-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-threads.d.ts +6 -23
- package/dist/v2/hooks/use-threads.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +197 -200
- package/dist/v2/index.mjs.map +1 -1
- package/dist/v2/lib/processPartialHtml.d.ts +1 -2
- package/dist/v2/lib/processPartialHtml.d.ts.map +1 -1
- package/dist/v2/lib/shallow-stable.d.ts.map +1 -1
- package/dist/v2/lib/vue-core.d.ts +33 -19
- package/dist/v2/lib/vue-core.d.ts.map +1 -1
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +9 -129
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +9 -10
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/chat-configuration-store-key.d.ts +8 -0
- package/dist/v2/providers/chat-configuration-store-key.d.ts.map +1 -0
- package/dist/v2/providers/markdown-renderer.d.ts +4 -2
- package/dist/v2/providers/markdown-renderer.d.ts.map +1 -1
- package/dist/v2/providers/types.d.ts +3 -46
- package/dist/v2/providers/types.d.ts.map +1 -1
- package/dist/v2/providers/use-inspector-thread-override.d.ts +5 -0
- package/dist/v2/providers/use-inspector-thread-override.d.ts.map +1 -1
- package/dist/v2/types/defineToolCallRenderer.d.ts +1 -1
- package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/types/human-in-the-loop.d.ts +8 -29
- package/dist/v2/types/human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/types/interrupt.d.ts +1 -22
- package/dist/v2/types/interrupt.d.ts.map +1 -1
- package/dist/v2/types/vue-activity-message-renderer.d.ts +16 -15
- package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-custom-message-renderer.d.ts +7 -16
- package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-tool-call-renderer.d.ts +16 -35
- package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
- package/package.json +12 -13
- package/src/__tests__/build-entries.test.ts +29 -0
- package/src/hooks/__tests__/zod-parameters.test.ts +520 -0
- package/src/hooks/use-copilot-action.ts +2 -1
- package/src/hooks/use-frontend-tool.ts +3 -6
- package/src/hooks/zod-parameters.ts +162 -0
- package/src/v2/__tests__/exports.test.ts +10 -0
- package/src/v2/__tests__/mocks/web-inspector.ts +6 -0
- package/src/v2/__tests__/utils/test-helpers.ts +34 -4
- package/src/v2/components/A2UIMessageRenderer.ts +98 -68
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +68 -103
- package/src/v2/components/CopilotKitInspector.vue +104 -51
- package/src/v2/components/InlineFeatureWarning.vue +20 -21
- package/src/v2/components/LicenseWarningBanner.vue +27 -135
- package/src/v2/components/MCPAppsActivityRenderer.ts +75 -201
- package/src/v2/components/OpenGenerativeUIRenderer.ts +122 -446
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +171 -8
- package/src/v2/components/__tests__/CopilotKitInspector.test.ts +42 -0
- package/src/v2/components/__tests__/LicenseWarningBanner.test.ts +60 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +64 -8
- package/src/v2/components/__tests__/OpenGenerativeUIToolRenderer.test.ts +38 -0
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +6 -26
- package/src/v2/components/a2ui/A2UICatalogContext.ts +27 -185
- package/src/v2/components/a2ui/A2UIRecoveryStates.ts +127 -327
- package/src/v2/components/a2ui/catalog.ts +3 -3
- package/src/v2/components/a2ui/utils.ts +13 -65
- package/src/v2/components/a2ui.ts +15 -22
- package/src/v2/components/chat/CopilotChat.vue +121 -498
- package/src/v2/components/chat/CopilotChatAssistantMessage.vue +47 -184
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +36 -55
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +14 -6
- package/src/v2/components/chat/CopilotChatAudioRecorder.vue +19 -246
- package/src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue +12 -77
- package/src/v2/components/chat/CopilotChatInput.vue +139 -654
- package/src/v2/components/chat/CopilotChatInspectorButton.vue +45 -108
- package/src/v2/components/chat/CopilotChatLightbox.vue +10 -31
- package/src/v2/components/chat/CopilotChatMessageView.vue +96 -274
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +27 -62
- package/src/v2/components/chat/CopilotChatToolCallGroup.vue +63 -71
- package/src/v2/components/chat/CopilotChatToolCallItem.vue +8 -6
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +31 -32
- package/src/v2/components/chat/CopilotChatUserMessage.vue +24 -112
- package/src/v2/components/chat/CopilotChatView.vue +123 -161
- package/src/v2/components/chat/CopilotChatWorkSummary.vue +26 -36
- package/src/v2/components/chat/CopilotModalHeader.vue +11 -23
- package/src/v2/components/chat/CopilotPopup.vue +23 -25
- package/src/v2/components/chat/CopilotPopupView.vue +10 -39
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +49 -185
- package/src/v2/components/chat/CopilotSidebar.vue +23 -25
- package/src/v2/components/chat/CopilotSidebarView.vue +10 -39
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +56 -100
- package/src/v2/components/chat/CopilotThreadsDrawer.vue +43 -105
- package/src/v2/components/chat/StreamingMarkdownDefault.vue +15 -28
- package/src/v2/components/chat/__tests__/CopilotChat.labels.test.ts +19 -4
- package/src/v2/components/chat/__tests__/CopilotChat.test.ts +12 -10
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +26 -9
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.learningFeedback.test.ts +5 -5
- package/src/v2/components/chat/__tests__/CopilotChatAttachmentQueue.test.ts +28 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +132 -1
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +247 -403
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +1 -99
- package/src/v2/components/chat/__tests__/CopilotChatView.pinToSend.test.ts +43 -1
- package/src/v2/components/chat/__tests__/CopilotPopup.test.ts +90 -1
- package/src/v2/components/chat/__tests__/CopilotPopupView.test.ts +19 -0
- package/src/v2/components/chat/__tests__/CopilotSidebar.test.ts +90 -1
- package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.ts +32 -8
- package/src/v2/components/chat/__tests__/CopilotSidebarView.test.ts +2 -1
- package/src/v2/components/chat/__tests__/StreamingMarkdownDefault.test.ts +54 -0
- package/src/v2/components/chat/audioRecorder.ts +4 -7
- package/src/v2/components/chat/copilotChatToolCallItemRender.ts +25 -90
- package/src/v2/components/chat/forwarded-slots.ts +17 -0
- package/src/v2/components/chat/index.ts +0 -1
- package/src/v2/components/chat/inspector-shortcuts.ts +10 -16
- package/src/v2/components/chat/message-feedback.ts +92 -195
- package/src/v2/components/chat/tool-call-display-context.ts +6 -22
- package/src/v2/components/chat/tool-call-group-parts.ts +47 -108
- package/src/v2/components/chat/turn-work.ts +0 -9
- package/src/v2/components/chat/types.ts +12 -4
- package/src/v2/components/chat/use-chat-labels.ts +16 -0
- package/src/v2/components/chat/use-copy-feedback.ts +21 -0
- package/src/v2/components/chat/use-lightbox.ts +15 -33
- package/src/v2/components/icons/__tests__/icons.test.ts +72 -68
- package/src/v2/components/icons/index.ts +109 -27
- package/src/v2/hooks/__tests__/use-agent-error-state.test.ts +5 -3
- package/src/v2/hooks/__tests__/use-agent-stability.test.ts +25 -4
- package/src/v2/hooks/__tests__/use-agent-throttle.test.ts +5 -1
- package/src/v2/hooks/__tests__/use-agent.test.ts +6 -3
- package/src/v2/hooks/__tests__/use-component.test.ts +21 -0
- package/src/v2/hooks/__tests__/use-configure-suggestions.test.ts +30 -1
- package/src/v2/hooks/__tests__/use-default-render-tool.test.ts +10 -10
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +66 -1
- package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.ts +6 -1
- package/src/v2/hooks/__tests__/use-human-in-the-loop.test.ts +187 -12
- package/src/v2/hooks/__tests__/use-interrupt.test.ts +97 -0
- package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +106 -0
- package/src/v2/hooks/__tests__/use-render-tool.test.ts +3 -6
- package/src/v2/hooks/__tests__/use-threads.test.ts +48 -6
- package/src/v2/hooks/__tests__/zod-regression.test.ts +5 -4
- package/src/v2/hooks/use-agent-context.ts +4 -10
- package/src/v2/hooks/use-agent.ts +86 -290
- package/src/v2/hooks/use-attachments.ts +48 -168
- package/src/v2/hooks/use-capabilities.ts +2 -7
- package/src/v2/hooks/use-component.ts +7 -4
- package/src/v2/hooks/use-configure-suggestions.ts +29 -220
- package/src/v2/hooks/use-default-render-tool.ts +31 -152
- package/src/v2/hooks/use-frontend-tool.ts +15 -25
- package/src/v2/hooks/use-human-in-the-loop.ts +11 -80
- package/src/v2/hooks/use-interrupt.ts +29 -308
- package/src/v2/hooks/use-keyboard-height.ts +17 -40
- package/src/v2/hooks/use-pin-to-send.ts +15 -99
- package/src/v2/hooks/use-render-activity-message.ts +35 -57
- package/src/v2/hooks/use-render-custom-messages.ts +24 -88
- package/src/v2/hooks/use-render-tool.ts +2 -4
- package/src/v2/hooks/use-suggestions.ts +17 -36
- package/src/v2/hooks/use-threads.ts +49 -288
- package/src/v2/lib/__tests__/shallow-stable.test.ts +54 -0
- package/src/v2/lib/__tests__/vue-core-renderers.test.ts +42 -0
- package/src/v2/lib/processPartialHtml.ts +6 -21
- package/src/v2/lib/shallow-stable.ts +2 -16
- package/src/v2/lib/vue-core.ts +90 -85
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +48 -186
- package/src/v2/providers/CopilotKitProvider.types.ts +12 -132
- package/src/v2/providers/CopilotKitProvider.vue +291 -641
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.ts +22 -2
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +38 -2
- package/src/v2/providers/__tests__/CopilotKitProvider.config.test.ts +124 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.headersAtSendTime.test.ts +3 -3
- package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +3 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.ts +4 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +88 -28
- package/src/v2/providers/chat-configuration-store-key.ts +9 -0
- package/src/v2/providers/markdown-renderer.ts +8 -2
- package/src/v2/providers/types.ts +3 -49
- package/src/v2/providers/use-inspector-thread-override.ts +22 -80
- package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +28 -33
- package/src/v2/types/defineToolCallRenderer.ts +7 -6
- package/src/v2/types/human-in-the-loop.ts +8 -32
- package/src/v2/types/interrupt.ts +7 -31
- package/src/v2/types/vue-activity-message-renderer.ts +24 -15
- package/src/v2/types/vue-custom-message-renderer.ts +12 -16
- package/src/v2/types/vue-tool-call-renderer.ts +23 -38
- package/tsconfig.json +0 -1
- package/vite.config.ts +8 -5
- package/vitest.config.ts +12 -7
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts +0 -9
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts.map +0 -1
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts +0 -3
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts.map +0 -1
- package/dist/v2/components/chat/tool-call-layout.d.ts +0 -115
- package/dist/v2/components/chat/tool-call-layout.d.ts.map +0 -1
- package/dist/v2/lib/is-mobile-viewport.d.ts +0 -15
- package/dist/v2/lib/is-mobile-viewport.d.ts.map +0 -1
- package/dist/v2/lib/message-feedback.d.ts +0 -33
- package/dist/v2/lib/message-feedback.d.ts.map +0 -1
- package/dist/v2/lib/transcription-client.d.ts +0 -19
- package/dist/v2/lib/transcription-client.d.ts.map +0 -1
- package/src/v2/components/__tests__/A2UICatalogContext.test.ts +0 -63
- package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +0 -175
- package/src/v2/components/chat/BasicMarkdown.vue +0 -160
- package/src/v2/components/chat/__tests__/BasicMarkdown.test.ts +0 -69
- package/src/v2/components/chat/__tests__/normalize-auto-scroll.test.ts +0 -39
- package/src/v2/components/chat/normalize-auto-scroll.ts +0 -17
- package/src/v2/components/chat/tool-call-layout.ts +0 -304
- package/src/v2/lib/__tests__/is-mobile-viewport.test.ts +0 -48
- package/src/v2/lib/__tests__/message-feedback.test.ts +0 -152
- package/src/v2/lib/__tests__/processPartialHtml.test.ts +0 -84
- package/src/v2/lib/__tests__/transcription-client.test.ts +0 -67
- package/src/v2/lib/is-mobile-viewport.ts +0 -23
- package/src/v2/lib/message-feedback.ts +0 -120
- package/src/v2/lib/transcription-client.ts +0 -151
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useAttrs } from "vue";
|
|
3
3
|
import CopilotChatConfigurationProvider from "../../providers/CopilotChatConfigurationProvider.vue";
|
|
4
|
+
import { forwardedSlotNames } from "./forwarded-slots";
|
|
4
5
|
import CopilotPopupViewInternal from "./CopilotPopupViewInternal.vue";
|
|
5
6
|
import type {
|
|
6
7
|
CopilotChatFeatherSlotProps,
|
|
8
|
+
CopilotChatInterruptSlotProps,
|
|
7
9
|
CopilotChatMessageViewSlotProps,
|
|
8
10
|
CopilotChatScrollToBottomButtonSlotProps,
|
|
9
11
|
CopilotChatScrollViewSlotProps,
|
|
@@ -44,12 +46,16 @@ defineSlots<{
|
|
|
44
46
|
"scroll-to-bottom-button"?: (
|
|
45
47
|
props: CopilotChatScrollToBottomButtonSlotProps,
|
|
46
48
|
) => unknown;
|
|
49
|
+
interrupt?: (props: CopilotChatInterruptSlotProps) => unknown;
|
|
47
50
|
input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;
|
|
48
51
|
"suggestion-view"?: (
|
|
49
52
|
props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,
|
|
50
53
|
) => unknown;
|
|
51
54
|
"welcome-screen"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;
|
|
52
55
|
"welcome-message"?: () => unknown;
|
|
56
|
+
// Any other slot goes to the chat view, as on CopilotChat.
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
|
+
[key: string]: ((props: any) => unknown) | undefined;
|
|
53
59
|
}>();
|
|
54
60
|
|
|
55
61
|
const emit = defineEmits<{
|
|
@@ -112,47 +118,12 @@ const internalBindings = computed(() => ({
|
|
|
112
118
|
<template>
|
|
113
119
|
<CopilotChatConfigurationProvider :is-modal-default-open="defaultOpen">
|
|
114
120
|
<CopilotPopupViewInternal v-bind="internalBindings">
|
|
115
|
-
<template v-if="$slots.header" #header="slotProps">
|
|
116
|
-
<slot name="header" v-bind="slotProps" />
|
|
117
|
-
</template>
|
|
118
|
-
|
|
119
|
-
<template v-if="$slots['toggle-button']" #toggle-button="slotProps">
|
|
120
|
-
<slot name="toggle-button" v-bind="slotProps" />
|
|
121
|
-
</template>
|
|
122
|
-
|
|
123
|
-
<template v-if="$slots['message-view']" #message-view="slotProps">
|
|
124
|
-
<slot name="message-view" v-bind="slotProps" />
|
|
125
|
-
</template>
|
|
126
|
-
|
|
127
|
-
<template v-if="$slots['scroll-view']" #scroll-view="slotProps">
|
|
128
|
-
<slot name="scroll-view" v-bind="slotProps" />
|
|
129
|
-
</template>
|
|
130
|
-
|
|
131
|
-
<template v-if="$slots.feather" #feather="slotProps">
|
|
132
|
-
<slot name="feather" v-bind="slotProps" />
|
|
133
|
-
</template>
|
|
134
|
-
|
|
135
121
|
<template
|
|
136
|
-
v-
|
|
137
|
-
|
|
122
|
+
v-for="slotName in forwardedSlotNames($slots)"
|
|
123
|
+
:key="slotName"
|
|
124
|
+
#[slotName]="slotProps"
|
|
138
125
|
>
|
|
139
|
-
<slot name="
|
|
140
|
-
</template>
|
|
141
|
-
|
|
142
|
-
<template v-if="$slots.input" #input="slotProps">
|
|
143
|
-
<slot name="input" v-bind="slotProps" />
|
|
144
|
-
</template>
|
|
145
|
-
|
|
146
|
-
<template v-if="$slots['suggestion-view']" #suggestion-view="slotProps">
|
|
147
|
-
<slot name="suggestion-view" v-bind="slotProps" />
|
|
148
|
-
</template>
|
|
149
|
-
|
|
150
|
-
<template v-if="$slots['welcome-screen']" #welcome-screen="slotProps">
|
|
151
|
-
<slot name="welcome-screen" v-bind="slotProps" />
|
|
152
|
-
</template>
|
|
153
|
-
|
|
154
|
-
<template v-if="$slots['welcome-message']" #welcome-message>
|
|
155
|
-
<slot name="welcome-message" />
|
|
126
|
+
<slot :name="slotName" v-bind="slotProps" />
|
|
156
127
|
</template>
|
|
157
128
|
</CopilotPopupViewInternal>
|
|
158
129
|
</CopilotChatConfigurationProvider>
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { computed, onBeforeUnmount, ref, useAttrs, watch } from "vue";
|
|
2
3
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
watch,
|
|
10
|
-
} from "vue";
|
|
4
|
+
ɵPOPUP_DEFAULT_HEIGHT,
|
|
5
|
+
ɵPOPUP_DEFAULT_WIDTH,
|
|
6
|
+
ɵbindPopupDismiss,
|
|
7
|
+
ɵcreateExitPresence,
|
|
8
|
+
ɵdimensionToCss,
|
|
9
|
+
} from "@copilotkit/core";
|
|
11
10
|
import { CopilotChatDefaultLabels } from "../../providers/types";
|
|
12
11
|
import { useCopilotChatConfiguration } from "../../providers/useCopilotChatConfiguration";
|
|
13
12
|
import CopilotChatToggleButton from "./CopilotChatToggleButton.vue";
|
|
14
13
|
import CopilotChatView from "./CopilotChatView.vue";
|
|
15
14
|
import CopilotModalHeader from "./CopilotModalHeader.vue";
|
|
15
|
+
import { forwardedSlotNames } from "./forwarded-slots";
|
|
16
16
|
import type {
|
|
17
17
|
CopilotChatFeatherSlotProps,
|
|
18
|
+
CopilotChatInterruptSlotProps,
|
|
18
19
|
CopilotChatMessageViewSlotProps,
|
|
19
20
|
CopilotChatScrollToBottomButtonSlotProps,
|
|
20
21
|
CopilotChatScrollViewSlotProps,
|
|
@@ -28,10 +29,6 @@ import type {
|
|
|
28
29
|
|
|
29
30
|
defineOptions({ inheritAttrs: false });
|
|
30
31
|
|
|
31
|
-
const DEFAULT_POPUP_WIDTH = 420;
|
|
32
|
-
const DEFAULT_POPUP_HEIGHT = 560;
|
|
33
|
-
const POPUP_ANIMATION_MS = 200;
|
|
34
|
-
|
|
35
32
|
const props = withDefaults(
|
|
36
33
|
defineProps<Omit<CopilotPopupViewProps, "defaultOpen">>(),
|
|
37
34
|
{
|
|
@@ -61,14 +58,22 @@ defineSlots<{
|
|
|
61
58
|
"scroll-to-bottom-button"?: (
|
|
62
59
|
props: CopilotChatScrollToBottomButtonSlotProps,
|
|
63
60
|
) => unknown;
|
|
61
|
+
interrupt?: (props: CopilotChatInterruptSlotProps) => unknown;
|
|
64
62
|
input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;
|
|
65
63
|
"suggestion-view"?: (
|
|
66
64
|
props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,
|
|
67
65
|
) => unknown;
|
|
68
66
|
"welcome-screen"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;
|
|
69
67
|
"welcome-message"?: () => unknown;
|
|
68
|
+
// Any other slot goes to the chat view, as on CopilotChat.
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
[key: string]: ((props: any) => unknown) | undefined;
|
|
70
71
|
}>();
|
|
71
72
|
|
|
73
|
+
// Slots this component renders itself. It passes every other slot to the
|
|
74
|
+
// chat view.
|
|
75
|
+
const OWN_SLOTS = ["header", "toggle-button"] as const;
|
|
76
|
+
|
|
72
77
|
const emit = defineEmits<{
|
|
73
78
|
"submit-message": [value: string];
|
|
74
79
|
stop: [];
|
|
@@ -87,12 +92,19 @@ const attrs = useAttrs();
|
|
|
87
92
|
const config = useCopilotChatConfiguration();
|
|
88
93
|
|
|
89
94
|
const containerRef = ref<HTMLElement | null>(null);
|
|
90
|
-
const isRendered = ref(config.value?.isModalOpen ?? false);
|
|
91
|
-
const isAnimatingOut = ref(false);
|
|
92
|
-
let animationTimer: ReturnType<typeof setTimeout> | undefined;
|
|
93
|
-
let focusTimer: ReturnType<typeof setTimeout> | undefined;
|
|
94
|
-
|
|
95
95
|
const isPopupOpen = computed(() => config.value?.isModalOpen ?? false);
|
|
96
|
+
|
|
97
|
+
// Core keeps the closed popup rendered while its exit animation plays.
|
|
98
|
+
const presence = ɵcreateExitPresence(isPopupOpen.value);
|
|
99
|
+
const isRendered = ref(presence.getState().isRendered);
|
|
100
|
+
const isAnimatingOut = ref(presence.getState().isClosing);
|
|
101
|
+
presence.subscribe((state) => {
|
|
102
|
+
isRendered.value = state.isRendered;
|
|
103
|
+
isAnimatingOut.value = state.isClosing;
|
|
104
|
+
});
|
|
105
|
+
watch(isPopupOpen, (open) => presence.setOpen(open));
|
|
106
|
+
onBeforeUnmount(() => presence.dispose());
|
|
107
|
+
|
|
96
108
|
const labels = computed(() => config.value?.labels ?? CopilotChatDefaultLabels);
|
|
97
109
|
const headerTitle = computed(() => labels.value.modalHeaderTitle);
|
|
98
110
|
const popupAnimationClass = computed(() =>
|
|
@@ -103,10 +115,13 @@ const popupAnimationClass = computed(() =>
|
|
|
103
115
|
const popupStyle = computed(
|
|
104
116
|
() =>
|
|
105
117
|
({
|
|
106
|
-
"--copilot-popup-width":
|
|
107
|
-
|
|
118
|
+
"--copilot-popup-width": ɵdimensionToCss(
|
|
119
|
+
props.width,
|
|
120
|
+
ɵPOPUP_DEFAULT_WIDTH,
|
|
121
|
+
),
|
|
122
|
+
"--copilot-popup-height": ɵdimensionToCss(
|
|
108
123
|
props.height,
|
|
109
|
-
|
|
124
|
+
ɵPOPUP_DEFAULT_HEIGHT,
|
|
110
125
|
),
|
|
111
126
|
"--copilot-popup-max-width": "calc(100vw - 3rem)",
|
|
112
127
|
"--copilot-popup-max-height": "calc(100dvh - 7.5rem)",
|
|
@@ -117,19 +132,6 @@ const popupStyle = computed(
|
|
|
117
132
|
}) as Record<string, string>,
|
|
118
133
|
);
|
|
119
134
|
|
|
120
|
-
function dimensionToCss(
|
|
121
|
-
value: number | string | undefined,
|
|
122
|
-
fallback: number,
|
|
123
|
-
): string {
|
|
124
|
-
if (typeof value === "number" && Number.isFinite(value)) {
|
|
125
|
-
return `${value}px`;
|
|
126
|
-
}
|
|
127
|
-
if (typeof value === "string" && value.trim().length > 0) {
|
|
128
|
-
return value;
|
|
129
|
-
}
|
|
130
|
-
return `${fallback}px`;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
135
|
function closePopup() {
|
|
134
136
|
config.value?.setModalOpen?.(false);
|
|
135
137
|
}
|
|
@@ -208,131 +210,23 @@ const chatViewBindings = computed(() => ({
|
|
|
208
210
|
...chatViewEventProps.value,
|
|
209
211
|
}));
|
|
210
212
|
|
|
211
|
-
|
|
212
|
-
isPopupOpen,
|
|
213
|
-
(open) => {
|
|
214
|
-
if (animationTimer) {
|
|
215
|
-
clearTimeout(animationTimer);
|
|
216
|
-
animationTimer = undefined;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if (open) {
|
|
220
|
-
isRendered.value = true;
|
|
221
|
-
isAnimatingOut.value = false;
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
if (!isRendered.value) {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
isAnimatingOut.value = true;
|
|
230
|
-
animationTimer = setTimeout(() => {
|
|
231
|
-
isRendered.value = false;
|
|
232
|
-
isAnimatingOut.value = false;
|
|
233
|
-
animationTimer = undefined;
|
|
234
|
-
}, POPUP_ANIMATION_MS);
|
|
235
|
-
},
|
|
236
|
-
{ immediate: true },
|
|
237
|
-
);
|
|
238
|
-
|
|
239
|
-
watch(
|
|
240
|
-
isPopupOpen,
|
|
241
|
-
(open, _old, onCleanup) => {
|
|
242
|
-
if (!open || typeof window === "undefined") {
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
247
|
-
if (event.key === "Escape") {
|
|
248
|
-
event.preventDefault();
|
|
249
|
-
closePopup();
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
window.addEventListener("keydown", handleKeyDown);
|
|
254
|
-
onCleanup(() => {
|
|
255
|
-
window.removeEventListener("keydown", handleKeyDown);
|
|
256
|
-
});
|
|
257
|
-
},
|
|
258
|
-
{ immediate: true },
|
|
259
|
-
);
|
|
260
|
-
|
|
261
|
-
watch(
|
|
262
|
-
isPopupOpen,
|
|
263
|
-
(open, _old, onCleanup) => {
|
|
264
|
-
if (!open) {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
focusTimer = setTimeout(() => {
|
|
269
|
-
if (typeof document === "undefined") {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
const container = containerRef.value;
|
|
273
|
-
if (container && !container.contains(document.activeElement)) {
|
|
274
|
-
container.focus({ preventScroll: true });
|
|
275
|
-
}
|
|
276
|
-
}, POPUP_ANIMATION_MS);
|
|
277
|
-
|
|
278
|
-
onCleanup(() => {
|
|
279
|
-
if (focusTimer) {
|
|
280
|
-
clearTimeout(focusTimer);
|
|
281
|
-
focusTimer = undefined;
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
},
|
|
285
|
-
{ immediate: true },
|
|
286
|
-
);
|
|
287
|
-
|
|
213
|
+
// Escape, a click outside (when enabled), and focus once the popup opens.
|
|
288
214
|
watch(
|
|
289
215
|
[isPopupOpen, () => props.clickOutsideToClose],
|
|
290
|
-
([open,
|
|
291
|
-
if (!open
|
|
216
|
+
([open, clickOutsideToClose], _old, onCleanup) => {
|
|
217
|
+
if (!open) {
|
|
292
218
|
return;
|
|
293
219
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
const container = containerRef.value;
|
|
302
|
-
if (container?.contains(target)) {
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
const toggleButton = document.querySelector(
|
|
307
|
-
"[data-slot='chat-toggle-button']",
|
|
308
|
-
);
|
|
309
|
-
if (toggleButton?.contains(target)) {
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
closePopup();
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
document.addEventListener("pointerdown", handlePointerDown);
|
|
317
|
-
onCleanup(() => {
|
|
318
|
-
document.removeEventListener("pointerdown", handlePointerDown);
|
|
319
|
-
});
|
|
220
|
+
onCleanup(
|
|
221
|
+
ɵbindPopupDismiss({
|
|
222
|
+
getContainer: () => containerRef.value,
|
|
223
|
+
onDismiss: closePopup,
|
|
224
|
+
clickOutsideToClose: clickOutsideToClose === true,
|
|
225
|
+
}),
|
|
226
|
+
);
|
|
320
227
|
},
|
|
321
228
|
{ immediate: true },
|
|
322
229
|
);
|
|
323
|
-
|
|
324
|
-
onMounted(async () => {
|
|
325
|
-
await nextTick();
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
onBeforeUnmount(() => {
|
|
329
|
-
if (animationTimer) {
|
|
330
|
-
clearTimeout(animationTimer);
|
|
331
|
-
}
|
|
332
|
-
if (focusTimer) {
|
|
333
|
-
clearTimeout(focusTimer);
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
230
|
</script>
|
|
337
231
|
|
|
338
232
|
<template>
|
|
@@ -385,42 +279,12 @@ onBeforeUnmount(() => {
|
|
|
385
279
|
:on-finish-transcribe-with-audio="onFinishTranscribeWithAudio"
|
|
386
280
|
v-bind="chatViewBindings"
|
|
387
281
|
>
|
|
388
|
-
<template v-if="$slots['message-view']" #message-view="slotProps">
|
|
389
|
-
<slot name="message-view" v-bind="slotProps" />
|
|
390
|
-
</template>
|
|
391
|
-
|
|
392
|
-
<template v-if="$slots['scroll-view']" #scroll-view="slotProps">
|
|
393
|
-
<slot name="scroll-view" v-bind="slotProps" />
|
|
394
|
-
</template>
|
|
395
|
-
|
|
396
|
-
<template v-if="$slots.feather" #feather>
|
|
397
|
-
<slot name="feather" />
|
|
398
|
-
</template>
|
|
399
|
-
|
|
400
282
|
<template
|
|
401
|
-
v-
|
|
402
|
-
|
|
283
|
+
v-for="slotName in forwardedSlotNames($slots, OWN_SLOTS)"
|
|
284
|
+
:key="slotName"
|
|
285
|
+
#[slotName]="slotProps"
|
|
403
286
|
>
|
|
404
|
-
<slot name="
|
|
405
|
-
</template>
|
|
406
|
-
|
|
407
|
-
<template v-if="$slots.input" #input="slotProps">
|
|
408
|
-
<slot name="input" v-bind="slotProps" />
|
|
409
|
-
</template>
|
|
410
|
-
|
|
411
|
-
<template
|
|
412
|
-
v-if="$slots['suggestion-view']"
|
|
413
|
-
#suggestion-view="slotProps"
|
|
414
|
-
>
|
|
415
|
-
<slot name="suggestion-view" v-bind="slotProps" />
|
|
416
|
-
</template>
|
|
417
|
-
|
|
418
|
-
<template v-if="$slots['welcome-screen']" #welcome-screen="slotProps">
|
|
419
|
-
<slot name="welcome-screen" v-bind="slotProps" />
|
|
420
|
-
</template>
|
|
421
|
-
|
|
422
|
-
<template v-if="$slots['welcome-message']" #welcome-message>
|
|
423
|
-
<slot name="welcome-message" />
|
|
287
|
+
<slot :name="slotName" v-bind="slotProps" />
|
|
424
288
|
</template>
|
|
425
289
|
</CopilotChatView>
|
|
426
290
|
</div>
|
|
@@ -4,9 +4,14 @@ import CopilotChat from "./CopilotChat.vue";
|
|
|
4
4
|
import CopilotSidebarView from "./CopilotSidebarView.vue";
|
|
5
5
|
import CopilotSidebarWelcomeScreen from "./CopilotSidebarWelcomeScreen.vue";
|
|
6
6
|
import InlineFeatureWarning from "../InlineFeatureWarning.vue";
|
|
7
|
+
import { forwardedSlotNames } from "./forwarded-slots";
|
|
7
8
|
import { useLicenseContext } from "../../providers/useLicenseContext";
|
|
8
9
|
import type {
|
|
10
|
+
CopilotChatFeatherSlotProps,
|
|
11
|
+
CopilotChatInterruptSlotProps,
|
|
9
12
|
CopilotChatMessageViewSlotProps,
|
|
13
|
+
CopilotChatScrollToBottomButtonSlotProps,
|
|
14
|
+
CopilotChatScrollViewSlotProps,
|
|
10
15
|
CopilotChatViewOverrideSlotProps,
|
|
11
16
|
CopilotChatWelcomeScreenSlotProps,
|
|
12
17
|
CopilotSidebarProps,
|
|
@@ -52,14 +57,28 @@ defineSlots<{
|
|
|
52
57
|
"toggle-button"?: (props: CopilotSidebarViewToggleButtonSlotProps) => unknown;
|
|
53
58
|
"chat-view"?: (props: CopilotChatViewOverrideSlotProps) => unknown;
|
|
54
59
|
"message-view"?: (props: CopilotChatMessageViewSlotProps) => unknown;
|
|
60
|
+
"scroll-view"?: (props: CopilotChatScrollViewSlotProps) => unknown;
|
|
61
|
+
feather?: (props: CopilotChatFeatherSlotProps) => unknown;
|
|
62
|
+
"scroll-to-bottom-button"?: (
|
|
63
|
+
props: CopilotChatScrollToBottomButtonSlotProps,
|
|
64
|
+
) => unknown;
|
|
65
|
+
interrupt?: (props: CopilotChatInterruptSlotProps) => unknown;
|
|
55
66
|
input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;
|
|
56
67
|
"suggestion-view"?: (
|
|
57
68
|
props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,
|
|
58
69
|
) => unknown;
|
|
59
70
|
"welcome-screen"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;
|
|
60
71
|
"welcome-message"?: () => unknown;
|
|
72
|
+
// Any other slot goes to the chat view, as on CopilotChat.
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
|
+
[key: string]: ((props: any) => unknown) | undefined;
|
|
61
75
|
}>();
|
|
62
76
|
|
|
77
|
+
// Slots this component renders itself and does not pass to the view. It passes
|
|
78
|
+
// every other slot to the view. It also renders `input` and `suggestion-view`
|
|
79
|
+
// in its welcome screen, so those two go to both places.
|
|
80
|
+
const OWN_SLOTS = ["chat-view", "welcome-screen", "welcome-message"] as const;
|
|
81
|
+
|
|
63
82
|
defineEmits<{
|
|
64
83
|
"submit-message": [value: string];
|
|
65
84
|
stop: [];
|
|
@@ -123,15 +142,12 @@ watch(
|
|
|
123
142
|
:on-finish-transcribe-with-audio="slotProps.onFinishTranscribeWithAudio"
|
|
124
143
|
v-bind="sidebarViewEventBindings(slotProps)"
|
|
125
144
|
>
|
|
126
|
-
<template v-if="$slots.header" #header="headerProps">
|
|
127
|
-
<slot name="header" v-bind="headerProps" />
|
|
128
|
-
</template>
|
|
129
|
-
|
|
130
145
|
<template
|
|
131
|
-
v-
|
|
132
|
-
|
|
146
|
+
v-for="slotName in forwardedSlotNames($slots, OWN_SLOTS)"
|
|
147
|
+
:key="slotName"
|
|
148
|
+
#[slotName]="forwardedProps"
|
|
133
149
|
>
|
|
134
|
-
<slot name="
|
|
150
|
+
<slot :name="slotName" v-bind="forwardedProps" />
|
|
135
151
|
</template>
|
|
136
152
|
|
|
137
153
|
<template #welcome-screen="welcomeScreenProps">
|
|
@@ -157,24 +173,6 @@ watch(
|
|
|
157
173
|
</template>
|
|
158
174
|
</CopilotSidebarWelcomeScreen>
|
|
159
175
|
</template>
|
|
160
|
-
|
|
161
|
-
<template
|
|
162
|
-
v-if="$slots['message-view']"
|
|
163
|
-
#message-view="messageViewProps"
|
|
164
|
-
>
|
|
165
|
-
<slot name="message-view" v-bind="messageViewProps" />
|
|
166
|
-
</template>
|
|
167
|
-
|
|
168
|
-
<template v-if="$slots.input" #input="inputProps">
|
|
169
|
-
<slot name="input" v-bind="inputProps" />
|
|
170
|
-
</template>
|
|
171
|
-
|
|
172
|
-
<template
|
|
173
|
-
v-if="$slots['suggestion-view']"
|
|
174
|
-
#suggestion-view="suggestionViewProps"
|
|
175
|
-
>
|
|
176
|
-
<slot name="suggestion-view" v-bind="suggestionViewProps" />
|
|
177
|
-
</template>
|
|
178
176
|
</CopilotSidebarView>
|
|
179
177
|
</template>
|
|
180
178
|
</CopilotChat>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, useAttrs } from "vue";
|
|
3
3
|
import CopilotChatConfigurationProvider from "../../providers/CopilotChatConfigurationProvider.vue";
|
|
4
|
+
import { forwardedSlotNames } from "./forwarded-slots";
|
|
4
5
|
import CopilotSidebarViewInternal from "./CopilotSidebarViewInternal.vue";
|
|
5
6
|
import type {
|
|
6
7
|
CopilotChatFeatherSlotProps,
|
|
8
|
+
CopilotChatInterruptSlotProps,
|
|
7
9
|
CopilotChatWelcomeScreenSlotProps,
|
|
8
10
|
CopilotChatMessageViewSlotProps,
|
|
9
11
|
CopilotChatScrollToBottomButtonSlotProps,
|
|
@@ -50,12 +52,16 @@ defineSlots<{
|
|
|
50
52
|
"scroll-to-bottom-button"?: (
|
|
51
53
|
props: CopilotChatScrollToBottomButtonSlotProps,
|
|
52
54
|
) => unknown;
|
|
55
|
+
interrupt?: (props: CopilotChatInterruptSlotProps) => unknown;
|
|
53
56
|
input?: (props: CopilotSidebarWelcomeScreenInputSlotProps) => unknown;
|
|
54
57
|
"suggestion-view"?: (
|
|
55
58
|
props: CopilotSidebarWelcomeScreenSuggestionViewSlotProps,
|
|
56
59
|
) => unknown;
|
|
57
60
|
"welcome-screen"?: (props: CopilotChatWelcomeScreenSlotProps) => unknown;
|
|
58
61
|
"welcome-message"?: () => unknown;
|
|
62
|
+
// Any other slot goes to the chat view, as on CopilotChat.
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
|
+
[key: string]: ((props: any) => unknown) | undefined;
|
|
59
65
|
}>();
|
|
60
66
|
|
|
61
67
|
const emit = defineEmits<{
|
|
@@ -117,47 +123,12 @@ const forwardedEventListeners = computed(() => {
|
|
|
117
123
|
<template>
|
|
118
124
|
<CopilotChatConfigurationProvider :is-modal-default-open="defaultOpen">
|
|
119
125
|
<CopilotSidebarViewInternal v-bind="internalBindings">
|
|
120
|
-
<template v-if="$slots.header" #header="slotProps">
|
|
121
|
-
<slot name="header" v-bind="slotProps" />
|
|
122
|
-
</template>
|
|
123
|
-
|
|
124
|
-
<template v-if="$slots['toggle-button']" #toggle-button="slotProps">
|
|
125
|
-
<slot name="toggle-button" v-bind="slotProps" />
|
|
126
|
-
</template>
|
|
127
|
-
|
|
128
|
-
<template v-if="$slots['message-view']" #message-view="slotProps">
|
|
129
|
-
<slot name="message-view" v-bind="slotProps" />
|
|
130
|
-
</template>
|
|
131
|
-
|
|
132
|
-
<template v-if="$slots['scroll-view']" #scroll-view="slotProps">
|
|
133
|
-
<slot name="scroll-view" v-bind="slotProps" />
|
|
134
|
-
</template>
|
|
135
|
-
|
|
136
|
-
<template v-if="$slots.feather" #feather="slotProps">
|
|
137
|
-
<slot name="feather" v-bind="slotProps" />
|
|
138
|
-
</template>
|
|
139
|
-
|
|
140
126
|
<template
|
|
141
|
-
v-
|
|
142
|
-
|
|
127
|
+
v-for="slotName in forwardedSlotNames($slots)"
|
|
128
|
+
:key="slotName"
|
|
129
|
+
#[slotName]="slotProps"
|
|
143
130
|
>
|
|
144
|
-
<slot name="
|
|
145
|
-
</template>
|
|
146
|
-
|
|
147
|
-
<template v-if="$slots.input" #input="slotProps">
|
|
148
|
-
<slot name="input" v-bind="slotProps" />
|
|
149
|
-
</template>
|
|
150
|
-
|
|
151
|
-
<template v-if="$slots['suggestion-view']" #suggestion-view="slotProps">
|
|
152
|
-
<slot name="suggestion-view" v-bind="slotProps" />
|
|
153
|
-
</template>
|
|
154
|
-
|
|
155
|
-
<template v-if="$slots['welcome-screen']" #welcome-screen="slotProps">
|
|
156
|
-
<slot name="welcome-screen" v-bind="slotProps" />
|
|
157
|
-
</template>
|
|
158
|
-
|
|
159
|
-
<template v-if="$slots['welcome-message']" #welcome-message>
|
|
160
|
-
<slot name="welcome-message" />
|
|
131
|
+
<slot :name="slotName" v-bind="slotProps" />
|
|
161
132
|
</template>
|
|
162
133
|
</CopilotSidebarViewInternal>
|
|
163
134
|
</CopilotChatConfigurationProvider>
|