@copilotkit/vue 2.0.0-rc.1 → 2.0.0-rc.11
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/PARITY.md +13 -12
- package/README.md +1 -2
- package/dist/components/copilot-provider/CopilotKit.vue.d.ts +3 -1
- package/dist/components/copilot-provider/CopilotKit.vue.d.ts.map +1 -1
- 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 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +384 -14275
- package/dist/index.mjs.map +1 -1
- package/dist/use-render-activity-message-2np7y4Qt.cjs +92 -0
- package/dist/use-render-activity-message-2np7y4Qt.cjs.map +1 -0
- package/dist/use-render-activity-message-D59E9t0x.js +18097 -0
- package/dist/use-render-activity-message-D59E9t0x.js.map +1 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts +7 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -1
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -1
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +13 -45
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +11 -2
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +144 -0
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -0
- package/dist/v2/components/a2ui.d.ts +3 -7
- package/dist/v2/components/a2ui.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChat.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts +3 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantToolbarButton.vue.d.ts +16 -0
- package/dist/v2/components/chat/CopilotChatAssistantToolbarButton.vue.d.ts.map +1 -0
- 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.map +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts +22 -0
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +21 -232
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts +12 -0
- package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts +22 -0
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +20 -0
- 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/CopilotChatSuggestionPill.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatSuggestionView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToggleButton.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts +32 -0
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +11 -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 +1 -0
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts +5 -0
- package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeaderTitle.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupWelcomeScreen.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +2 -0
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +2 -0
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +2 -0
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarWelcomeScreen.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +0 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
- package/dist/v2/components/chat/index.d.ts +17 -1
- package/dist/v2/components/chat/index.d.ts.map +1 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts +12 -0
- package/dist/v2/components/chat/inspector-shortcuts.d.ts.map +1 -0
- package/dist/v2/components/chat/message-feedback.d.ts +89 -0
- package/dist/v2/components/chat/message-feedback.d.ts.map +1 -0
- package/dist/v2/components/chat/tool-call-capture.d.ts +39 -0
- package/dist/v2/components/chat/tool-call-capture.d.ts.map +1 -0
- package/dist/v2/components/chat/tool-call-display-context.d.ts +22 -0
- package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -0
- package/dist/v2/components/chat/tool-call-group-parts.d.ts +131 -0
- package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -0
- package/dist/v2/components/chat/turn-work.d.ts +33 -0
- package/dist/v2/components/chat/turn-work.d.ts.map +1 -0
- package/dist/v2/components/chat/types.d.ts +104 -5
- 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-lightbox.d.ts +18 -0
- package/dist/v2/components/chat/use-lightbox.d.ts.map +1 -0
- 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 +55 -0
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts.map +1 -0
- package/dist/v2/components/ui/CopilotPopover.vue.d.ts +40 -0
- package/dist/v2/components/ui/CopilotPopover.vue.d.ts.map +1 -0
- package/dist/v2/components/ui/CopilotTooltip.vue.d.ts +37 -0
- package/dist/v2/components/ui/CopilotTooltip.vue.d.ts.map +1 -0
- package/dist/v2/components/ui/dropdown-menu.d.ts +14 -0
- package/dist/v2/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/v2/components/ui/floating.d.ts +84 -0
- package/dist/v2/components/ui/floating.d.ts.map +1 -0
- package/dist/v2/components/ui/presence.d.ts +9 -0
- package/dist/v2/components/ui/presence.d.ts.map +1 -0
- package/dist/v2/components/ui/use-id.d.ts +9 -0
- package/dist/v2/components/ui/use-id.d.ts.map +1 -0
- package/dist/v2/hooks/use-default-render-tool.d.ts +6 -0
- 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-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 +4 -0
- package/dist/v2/hooks/use-render-tool.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.d.cts +3 -0
- package/dist/v2/index.d.mts +3 -0
- package/dist/v2/index.d.ts +3 -0
- package/dist/v2/index.d.ts.map +1 -1
- package/dist/v2/index.mjs +197 -197
- package/dist/v2/index.mjs.map +1 -1
- package/dist/v2/lib/message-feedback.d.ts +33 -0
- package/dist/v2/lib/message-feedback.d.ts.map +1 -0
- package/dist/v2/lib/processPartialHtml.d.ts +1 -2
- package/dist/v2/lib/processPartialHtml.d.ts.map +1 -1
- package/dist/v2/lib/vue-core.d.ts +0 -1
- 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 +56 -6
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +6 -2
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/index.d.ts +1 -1
- package/dist/v2/providers/index.d.ts.map +1 -1
- package/dist/v2/providers/keys.d.ts +8 -0
- package/dist/v2/providers/keys.d.ts.map +1 -1
- package/dist/v2/providers/types.d.ts +3 -37
- package/dist/v2/providers/types.d.ts.map +1 -1
- package/dist/v2/styles/CopilotKitStyles.d.ts +18 -0
- package/dist/v2/styles/CopilotKitStyles.d.ts.map +1 -0
- package/dist/v2/types/defineToolCallRenderer.d.ts +2 -0
- 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 -28
- package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
- package/package.json +14 -27
- package/src/__tests__/build-entries.test.ts +27 -0
- package/src/components/copilot-provider/CopilotKit.vue +4 -1
- 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 +4 -2
- package/src/v2/components/A2UIMessageRenderer.ts +56 -68
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +11 -23
- package/src/v2/components/LicenseWarningBanner.vue +31 -15
- package/src/v2/components/OpenGenerativeUIRenderer.ts +51 -373
- package/src/v2/components/__tests__/A2UIBasicCatalogColors.test.ts +8 -9
- package/src/v2/components/__tests__/A2UICatalogContext.test.ts +1 -1
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +63 -36
- package/src/v2/components/__tests__/LicenseWarningBanner.test.ts +20 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +55 -6
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +15 -258
- package/src/v2/components/a2ui/A2UICatalogContext.ts +10 -102
- package/src/v2/components/a2ui/A2UIRecoveryStates.ts +444 -0
- package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +175 -0
- package/src/v2/components/a2ui.ts +1 -1
- package/src/v2/components/chat/CopilotChat.vue +26 -40
- package/src/v2/components/chat/CopilotChatAssistantMessage.vue +267 -67
- package/src/v2/components/chat/CopilotChatAssistantToolbarButton.vue +46 -0
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +150 -173
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +77 -20
- package/src/v2/components/chat/CopilotChatAudioRecorder.vue +2 -2
- package/src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue +240 -0
- package/src/v2/components/chat/CopilotChatInput.vue +250 -191
- package/src/v2/components/chat/CopilotChatInspectorButton.vue +331 -0
- package/src/v2/components/chat/CopilotChatLightbox.vue +105 -0
- package/src/v2/components/chat/CopilotChatMessageView.vue +262 -87
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +52 -35
- package/src/v2/components/chat/CopilotChatSuggestionPill.vue +5 -14
- package/src/v2/components/chat/CopilotChatSuggestionView.vue +1 -4
- package/src/v2/components/chat/CopilotChatToggleButton.vue +3 -9
- package/src/v2/components/chat/CopilotChatToggleButtonCloseIcon.ts +1 -1
- package/src/v2/components/chat/CopilotChatToggleButtonOpenIcon.ts +1 -1
- package/src/v2/components/chat/CopilotChatToolCallGroup.vue +353 -0
- package/src/v2/components/chat/CopilotChatToolCallItem.vue +24 -14
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +194 -21
- package/src/v2/components/chat/CopilotChatUserMessage.vue +105 -42
- package/src/v2/components/chat/CopilotChatView.vue +37 -42
- package/src/v2/components/chat/CopilotChatWorkSummary.vue +111 -0
- package/src/v2/components/chat/CopilotModalHeader.vue +10 -8
- package/src/v2/components/chat/CopilotModalHeaderCloseButton.ts +7 -6
- package/src/v2/components/chat/CopilotModalHeaderTitle.ts +1 -4
- package/src/v2/components/chat/CopilotPopup.vue +3 -0
- package/src/v2/components/chat/CopilotPopupView.vue +1 -0
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +9 -19
- package/src/v2/components/chat/CopilotPopupWelcomeScreen.vue +5 -8
- package/src/v2/components/chat/CopilotSidebar.vue +5 -0
- package/src/v2/components/chat/CopilotSidebarView.vue +2 -0
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +24 -17
- package/src/v2/components/chat/CopilotSidebarWelcomeScreen.vue +7 -10
- package/src/v2/components/chat/StreamingMarkdownDefault.vue +3 -5
- package/src/v2/components/chat/__tests__/CopilotChat.labels.test.ts +19 -4
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +26 -9
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.inspector.test.ts +269 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.learningFeedback.test.ts +760 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.slots.e2e.test.ts +3 -5
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.ts +2 -2
- package/src/v2/components/chat/__tests__/CopilotChatInput.addMenu.test.ts +328 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.slots.e2e.test.ts +6 -3
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +55 -14
- package/src/v2/components/chat/__tests__/CopilotChatLightbox.test.ts +160 -0
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +247 -403
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +637 -0
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionPill.test.ts +1 -1
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.slots.e2e.test.ts +3 -1
- package/src/v2/components/chat/__tests__/CopilotChatToolCallsView.learning.test.ts +75 -0
- package/src/v2/components/chat/__tests__/CopilotChatUserMessage.attachments.test.ts +143 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.inputOverlay.test.ts +5 -4
- package/src/v2/components/chat/__tests__/CopilotChatView.rootWidth.test.ts +7 -33
- package/src/v2/components/chat/__tests__/CopilotModalHeader.slots.e2e.test.ts +1 -1
- package/src/v2/components/chat/__tests__/CopilotPopupView.slots.e2e.test.ts +3 -3
- package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.ts +126 -0
- package/src/v2/components/chat/__tests__/messageFeedbackDefaults.test.ts +33 -0
- package/src/v2/components/chat/__tests__/modalChatDisplayProps.test.ts +44 -0
- package/src/v2/components/chat/copilotChatToolCallItemRender.ts +3 -19
- package/src/v2/components/chat/index.ts +2 -1
- package/src/v2/components/chat/inspector-shortcuts.ts +34 -0
- package/src/v2/components/chat/message-feedback.ts +291 -0
- package/src/v2/components/chat/tool-call-capture.ts +55 -0
- package/src/v2/components/chat/tool-call-display-context.ts +28 -0
- package/src/v2/components/chat/tool-call-group-parts.ts +251 -0
- package/src/v2/components/chat/turn-work.ts +52 -0
- package/src/v2/components/chat/types.ts +114 -4
- package/src/v2/components/chat/use-chat-labels.ts +16 -0
- package/src/v2/components/chat/use-lightbox.ts +64 -0
- package/src/v2/components/icons/__tests__/icons.test.ts +72 -68
- package/src/v2/components/icons/index.ts +109 -23
- package/src/v2/components/ui/CopilotDropdownMenuContent.vue +465 -0
- package/src/v2/components/ui/CopilotPopover.vue +138 -0
- package/src/v2/components/ui/CopilotTooltip.vue +237 -0
- package/src/v2/components/ui/__tests__/CopilotTooltip.test.ts +168 -0
- package/src/v2/components/ui/dropdown-menu.ts +15 -0
- package/src/v2/components/ui/floating.ts +321 -0
- package/src/v2/components/ui/presence.ts +54 -0
- package/src/v2/components/ui/use-id.ts +16 -0
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +62 -1
- package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +105 -0
- package/src/v2/hooks/__tests__/use-render-tool.test.ts +3 -6
- package/src/v2/hooks/__tests__/zod-regression.test.ts +5 -4
- package/src/v2/hooks/use-default-render-tool.ts +123 -62
- package/src/v2/hooks/use-frontend-tool.ts +10 -10
- package/src/v2/hooks/use-render-activity-message.ts +27 -48
- package/src/v2/hooks/use-render-custom-messages.ts +14 -35
- package/src/v2/hooks/use-render-tool.ts +8 -0
- package/src/v2/index.ts +3 -0
- package/src/v2/lib/__tests__/message-feedback.test.ts +152 -0
- package/src/v2/lib/message-feedback.ts +120 -0
- package/src/v2/lib/processPartialHtml.ts +6 -21
- package/src/v2/lib/vue-core.ts +3 -5
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +29 -2
- package/src/v2/providers/CopilotKitProvider.types.ts +57 -5
- package/src/v2/providers/CopilotKitProvider.vue +177 -114
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.openThread.test.ts +69 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +1 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.headersAtSendTime.test.ts +3 -3
- package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +536 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +17 -33
- package/src/v2/providers/index.ts +4 -1
- package/src/v2/providers/keys.ts +12 -0
- package/src/v2/providers/types.ts +3 -38
- package/src/v2/styles/CopilotKitStyles.ts +95 -0
- package/src/v2/styles/__tests__/CopilotKitStyles.client.test.ts +149 -0
- package/src/v2/styles/__tests__/CopilotKitStyles.ssr.test.ts +71 -0
- package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +28 -33
- package/src/v2/types/defineToolCallRenderer.ts +9 -4
- 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 -31
- package/vite.config.ts +5 -5
- package/dist/styles.css +0 -2
- 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/lib/transcription-client.d.ts +0 -19
- package/dist/v2/lib/transcription-client.d.ts.map +0 -1
- package/scripts/scope-preflight.mjs +0 -100
- package/src/styles/globals.css +0 -233
- package/src/v2/components/chat/BasicMarkdown.vue +0 -158
- package/src/v2/components/chat/__tests__/BasicMarkdown.test.ts +0 -69
- 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/transcription-client.ts +0 -151
|
@@ -8,12 +8,10 @@ import {
|
|
|
8
8
|
useAttrs,
|
|
9
9
|
watch,
|
|
10
10
|
} from "vue";
|
|
11
|
-
import {
|
|
12
|
-
import { CopilotChatDefaultLabels } from "../../providers/types";
|
|
11
|
+
import { ɵcomposerButtonState, ɵresolveComposerKey } from "@copilotkit/core";
|
|
13
12
|
import {
|
|
14
13
|
IconArrowUp,
|
|
15
14
|
IconCheck,
|
|
16
|
-
IconChevronRight,
|
|
17
15
|
IconLoader2,
|
|
18
16
|
IconMic,
|
|
19
17
|
IconPlus,
|
|
@@ -21,8 +19,16 @@ import {
|
|
|
21
19
|
IconX,
|
|
22
20
|
} from "../icons";
|
|
23
21
|
import CopilotChatAudioRecorder from "./CopilotChatAudioRecorder.vue";
|
|
22
|
+
import CopilotTooltip from "../ui/CopilotTooltip.vue";
|
|
23
|
+
import CopilotDropdownMenuContent from "../ui/CopilotDropdownMenuContent.vue";
|
|
24
|
+
import type {
|
|
25
|
+
CopilotDropdownMenuDismissReason,
|
|
26
|
+
CopilotDropdownMenuItem,
|
|
27
|
+
} from "../ui/dropdown-menu";
|
|
28
|
+
import { useCopilotId } from "../ui/use-id";
|
|
24
29
|
import type { CopilotChatAudioRecorderRef } from "./audioRecorder";
|
|
25
30
|
import type { CopilotChatInputMode, ToolsMenuItem } from "./types";
|
|
31
|
+
import { useChatLabels } from "./use-chat-labels";
|
|
26
32
|
|
|
27
33
|
defineOptions({ inheritAttrs: false });
|
|
28
34
|
|
|
@@ -101,14 +107,12 @@ const emit = defineEmits<{
|
|
|
101
107
|
}>();
|
|
102
108
|
|
|
103
109
|
const attrs = useAttrs();
|
|
104
|
-
const config = useCopilotChatConfiguration();
|
|
105
110
|
const shellRef = ref<HTMLElement | null>(null);
|
|
106
111
|
const textareaRef = ref<HTMLTextAreaElement | null>(null);
|
|
107
112
|
const gridRef = ref<HTMLElement | null>(null);
|
|
108
113
|
const addButtonContainerRef = ref<HTMLElement | null>(null);
|
|
109
114
|
const actionsContainerRef = ref<HTMLElement | null>(null);
|
|
110
115
|
const slashMenuRef = ref<HTMLElement | null>(null);
|
|
111
|
-
const addMenuRef = ref<HTMLElement | null>(null);
|
|
112
116
|
const audioRecorderRef = ref<CopilotChatAudioRecorderRef | null>(null);
|
|
113
117
|
const localValue = ref(props.modelValue ?? "");
|
|
114
118
|
const isComposing = ref(false);
|
|
@@ -117,6 +121,12 @@ const commandQuery = ref<string | null>(null);
|
|
|
117
121
|
const slashHighlightIndex = ref(0);
|
|
118
122
|
const previousCommandQuery = ref<string | null>(null);
|
|
119
123
|
const addMenuOpen = ref(false);
|
|
124
|
+
// Where focus goes as the add menu opens: its first or last item for the
|
|
125
|
+
// keyboard, the menu itself for a pointer, as Radix's DropdownMenu does.
|
|
126
|
+
const addMenuInitialFocus = ref<"first" | "last" | "content">("content");
|
|
127
|
+
const addMenuAnchor = ref<HTMLElement | null>(null);
|
|
128
|
+
const addMenuId = useCopilotId("cpk-add-menu");
|
|
129
|
+
const addMenuTriggerId = `${addMenuId}-trigger`;
|
|
120
130
|
const measurements = ref({
|
|
121
131
|
singleLineHeight: 0,
|
|
122
132
|
maxHeight: 0,
|
|
@@ -132,22 +142,18 @@ const containerCacheRef = ref<{
|
|
|
132
142
|
const didWarnMissingFontRef = ref(false);
|
|
133
143
|
const didWarnMissingCanvasContextRef = ref(false);
|
|
134
144
|
let resizeObserver: ResizeObserver | null = null;
|
|
135
|
-
let documentPointerDownHandler: ((event: MouseEvent) => void) | null = null;
|
|
136
145
|
|
|
137
146
|
const isControlled = computed(() => props.modelValue !== undefined);
|
|
138
147
|
const inputValue = computed(() =>
|
|
139
148
|
isControlled.value ? (props.modelValue ?? "") : localValue.value,
|
|
140
149
|
);
|
|
141
|
-
const labels =
|
|
150
|
+
const labels = useChatLabels();
|
|
142
151
|
const resolvedPlaceholder = computed(
|
|
143
152
|
() => props.placeholder ?? labels.value.chatInputPlaceholder,
|
|
144
153
|
);
|
|
145
154
|
const isExpanded = computed(
|
|
146
155
|
() => props.mode === "input" && layout.value === "expanded",
|
|
147
156
|
);
|
|
148
|
-
const isProcessing = computed(
|
|
149
|
-
() => props.mode !== "transcribe" && props.isRunning,
|
|
150
|
-
);
|
|
151
157
|
const shouldShowDisclaimer = computed(
|
|
152
158
|
() => props.showDisclaimer ?? props.positioning === "absolute",
|
|
153
159
|
);
|
|
@@ -167,20 +173,24 @@ const hasFinishTranscribeAction = computed(
|
|
|
167
173
|
typeof props.onFinishTranscribe === "function" ||
|
|
168
174
|
typeof props.onFinishTranscribeWithAudio === "function",
|
|
169
175
|
);
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
const composerInput = computed(() => ({
|
|
177
|
+
mode: props.mode,
|
|
178
|
+
isRunning: props.isRunning,
|
|
179
|
+
value: inputValue.value,
|
|
180
|
+
canSubmit: hasSubmitAction.value,
|
|
181
|
+
canStop: hasStopAction.value,
|
|
182
|
+
disabled: props.disabled,
|
|
183
|
+
}));
|
|
184
|
+
const composerButton = computed(() =>
|
|
185
|
+
ɵcomposerButtonState(composerInput.value),
|
|
179
186
|
);
|
|
187
|
+
const isProcessing = computed(() => composerButton.value.isProcessing);
|
|
188
|
+
const sendDisabled = computed(() => composerButton.value.disabled);
|
|
189
|
+
const showsStop = computed(() => composerButton.value.action === "stop");
|
|
180
190
|
|
|
181
191
|
const containerClass = computed(() => [
|
|
182
|
-
|
|
183
|
-
|
|
192
|
+
"cpk-chat-input",
|
|
193
|
+
props.positioning === "absolute" && "cpk-chat-input-absolute",
|
|
184
194
|
attrs.class,
|
|
185
195
|
]);
|
|
186
196
|
|
|
@@ -398,14 +408,16 @@ function handleInput(event: Event) {
|
|
|
398
408
|
updateSlashState(nextValue);
|
|
399
409
|
}
|
|
400
410
|
|
|
411
|
+
// The button stops a run whatever the input holds. Enter differs: see
|
|
412
|
+
// handleKeydown.
|
|
401
413
|
function handleSendButtonClick() {
|
|
402
|
-
if (
|
|
403
|
-
|
|
404
|
-
emit("stop");
|
|
405
|
-
}
|
|
414
|
+
if (showsStop.value) {
|
|
415
|
+
emit("stop");
|
|
406
416
|
return;
|
|
407
417
|
}
|
|
408
|
-
|
|
418
|
+
if (!isProcessing.value) {
|
|
419
|
+
submit();
|
|
420
|
+
}
|
|
409
421
|
}
|
|
410
422
|
|
|
411
423
|
function handleKeydown(event: KeyboardEvent) {
|
|
@@ -463,35 +475,108 @@ function handleKeydown(event: KeyboardEvent) {
|
|
|
463
475
|
}
|
|
464
476
|
}
|
|
465
477
|
|
|
466
|
-
if (
|
|
478
|
+
if (props.mode !== "input") {
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
// Enter with text sends, also while a run is going. Enter in an empty input
|
|
483
|
+
// stops the run. Read the textarea: a controlled modelValue can lag a tick.
|
|
484
|
+
const action = ɵresolveComposerKey(event, {
|
|
485
|
+
...composerInput.value,
|
|
486
|
+
value: textareaRef.value?.value ?? inputValue.value,
|
|
487
|
+
});
|
|
488
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
467
489
|
event.preventDefault();
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
emit("stop");
|
|
471
|
-
}
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
490
|
+
}
|
|
491
|
+
if (action === "send") {
|
|
474
492
|
submit();
|
|
493
|
+
} else if (action === "stop") {
|
|
494
|
+
emit("stop");
|
|
475
495
|
}
|
|
476
496
|
}
|
|
477
497
|
|
|
478
|
-
|
|
498
|
+
/** The add button, or the first button of a custom `add-menu-button` slot. */
|
|
499
|
+
function getAddMenuTrigger(): HTMLElement | null {
|
|
500
|
+
const container = addButtonContainerRef.value;
|
|
501
|
+
return container?.querySelector<HTMLElement>("button") ?? container ?? null;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
function toggleAddMenu(focus: "first" | "last" | "content" = "content") {
|
|
479
505
|
if (!hasMenuItems.value || props.mode === "transcribe" || props.disabled) {
|
|
480
506
|
return;
|
|
481
507
|
}
|
|
482
|
-
addMenuOpen.value
|
|
508
|
+
if (addMenuOpen.value) {
|
|
509
|
+
closeAddMenu();
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
addMenuAnchor.value = getAddMenuTrigger();
|
|
513
|
+
addMenuInitialFocus.value = focus;
|
|
514
|
+
addMenuOpen.value = true;
|
|
483
515
|
}
|
|
484
516
|
|
|
485
|
-
function closeAddMenu() {
|
|
517
|
+
function closeAddMenu(options: { returnFocus?: boolean } = {}) {
|
|
518
|
+
if (!addMenuOpen.value) {
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
486
521
|
addMenuOpen.value = false;
|
|
522
|
+
if (options.returnFocus) {
|
|
523
|
+
getAddMenuTrigger()?.focus();
|
|
524
|
+
}
|
|
487
525
|
}
|
|
488
526
|
|
|
489
527
|
function handleMenuAction(action: () => void) {
|
|
528
|
+
// As Radix does, the menu closes and focus returns to its trigger first, so
|
|
529
|
+
// an action that moves focus (for example into the textarea) keeps it.
|
|
530
|
+
closeAddMenu({ returnFocus: true });
|
|
490
531
|
action();
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
function handleAddMenuSelect(item: CopilotDropdownMenuItem) {
|
|
535
|
+
if (item.action) {
|
|
536
|
+
handleMenuAction(item.action);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function handleAddMenuDismiss(reason: CopilotDropdownMenuDismissReason) {
|
|
541
|
+
// A pointer down outside leaves focus where the pointer put it.
|
|
542
|
+
closeAddMenu({ returnFocus: reason !== "outside" });
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// A pointer down opens the menu, as Radix's trigger does; the click that
|
|
546
|
+
// follows it then must not toggle it again. Keyboard and synthetic clicks
|
|
547
|
+
// (detail 0) still toggle it from the click.
|
|
548
|
+
let addMenuPointerToggled = false;
|
|
549
|
+
|
|
550
|
+
function handleAddMenuPointerDown(event: PointerEvent) {
|
|
551
|
+
if (event.button !== 0 || event.ctrlKey) {
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
addMenuPointerToggled = true;
|
|
555
|
+
if (!addMenuOpen.value) {
|
|
556
|
+
// Keep focus off the trigger, so the menu can take it.
|
|
557
|
+
event.preventDefault();
|
|
558
|
+
}
|
|
559
|
+
toggleAddMenu("content");
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function handleAddMenuClick(event: MouseEvent) {
|
|
563
|
+
if (addMenuPointerToggled) {
|
|
564
|
+
addMenuPointerToggled = false;
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
toggleAddMenu(event.detail === 0 ? "first" : "content");
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
function handleAddMenuTriggerKeydown(event: KeyboardEvent) {
|
|
571
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
572
|
+
event.preventDefault();
|
|
573
|
+
toggleAddMenu("first");
|
|
574
|
+
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
575
|
+
event.preventDefault();
|
|
576
|
+
if (!addMenuOpen.value) {
|
|
577
|
+
toggleAddMenu(event.key === "ArrowDown" ? "first" : "last");
|
|
578
|
+
}
|
|
579
|
+
}
|
|
495
580
|
}
|
|
496
581
|
|
|
497
582
|
async function handleFinishTranscribe() {
|
|
@@ -909,32 +994,9 @@ onMounted(() => {
|
|
|
909
994
|
resizeObserver.observe(actionsContainerRef.value);
|
|
910
995
|
if (textareaRef.value) resizeObserver.observe(textareaRef.value);
|
|
911
996
|
}
|
|
912
|
-
|
|
913
|
-
documentPointerDownHandler = (event: MouseEvent) => {
|
|
914
|
-
if (!addMenuOpen.value) {
|
|
915
|
-
return;
|
|
916
|
-
}
|
|
917
|
-
const target = event.target as Node | null;
|
|
918
|
-
if (!target) {
|
|
919
|
-
return;
|
|
920
|
-
}
|
|
921
|
-
if (
|
|
922
|
-
addMenuRef.value?.contains(target) ||
|
|
923
|
-
addButtonContainerRef.value?.contains(target)
|
|
924
|
-
) {
|
|
925
|
-
return;
|
|
926
|
-
}
|
|
927
|
-
closeAddMenu();
|
|
928
|
-
};
|
|
929
|
-
|
|
930
|
-
document.addEventListener("mousedown", documentPointerDownHandler);
|
|
931
997
|
});
|
|
932
998
|
|
|
933
999
|
onBeforeUnmount(() => {
|
|
934
|
-
if (documentPointerDownHandler) {
|
|
935
|
-
document.removeEventListener("mousedown", documentPointerDownHandler);
|
|
936
|
-
documentPointerDownHandler = null;
|
|
937
|
-
}
|
|
938
1000
|
resizeObserver?.disconnect();
|
|
939
1001
|
resizeObserver = null;
|
|
940
1002
|
if (resizeEvaluationRafRef.value !== null) {
|
|
@@ -959,9 +1021,7 @@ onBeforeUnmount(() => {
|
|
|
959
1021
|
}"
|
|
960
1022
|
v-bind="rootAttrs"
|
|
961
1023
|
>
|
|
962
|
-
<div
|
|
963
|
-
class="cpk:pointer-events-auto cpk:mx-auto cpk:max-w-3xl cpk:px-4 cpk:py-0 cpk:@3xl:px-0 cpk:[div[data-sidebar-chat]_&]:px-8 cpk:[div[data-popup-chat]_&]:px-4"
|
|
964
|
-
>
|
|
1024
|
+
<div class="cpk-chat-input-wrapper">
|
|
965
1025
|
<slot
|
|
966
1026
|
name="layout"
|
|
967
1027
|
:mode="mode"
|
|
@@ -973,7 +1033,7 @@ onBeforeUnmount(() => {
|
|
|
973
1033
|
:send-disabled="sendDisabled"
|
|
974
1034
|
:menu-open="addMenuOpen"
|
|
975
1035
|
:menu-items="menuDisplayItems"
|
|
976
|
-
:on-toggle-menu="toggleAddMenu"
|
|
1036
|
+
:on-toggle-menu="() => toggleAddMenu()"
|
|
977
1037
|
:on-menu-action="handleMenuAction"
|
|
978
1038
|
:on-update-value="updateInputValue"
|
|
979
1039
|
:on-submit="submit"
|
|
@@ -986,99 +1046,81 @@ onBeforeUnmount(() => {
|
|
|
986
1046
|
<div
|
|
987
1047
|
ref="shellRef"
|
|
988
1048
|
data-testid="copilot-chat-input-shell"
|
|
989
|
-
class="
|
|
1049
|
+
class="copilotKitInput cpk-chat-input-pill"
|
|
990
1050
|
:data-layout="isExpanded ? 'expanded' : 'compact'"
|
|
991
1051
|
@click="handleContainerClick"
|
|
992
1052
|
>
|
|
993
1053
|
<div
|
|
994
1054
|
ref="gridRef"
|
|
995
|
-
|
|
996
|
-
'cpk:grid cpk:w-full cpk:gap-x-3 cpk:gap-y-3 cpk:px-3 cpk:py-2',
|
|
997
|
-
isExpanded
|
|
998
|
-
? 'cpk:grid-cols-[auto_minmax(0,1fr)_auto] cpk:grid-rows-[auto_auto]'
|
|
999
|
-
: 'cpk:grid-cols-[auto_minmax(0,1fr)_auto] cpk:items-center',
|
|
1000
|
-
]"
|
|
1055
|
+
class="cpk-chat-input-grid"
|
|
1001
1056
|
:data-layout="isExpanded ? 'expanded' : 'compact'"
|
|
1002
1057
|
>
|
|
1003
|
-
<div
|
|
1004
|
-
ref="addButtonContainerRef"
|
|
1005
|
-
:class="[
|
|
1006
|
-
'cpk:relative cpk:flex cpk:items-center cpk:col-start-1',
|
|
1007
|
-
isExpanded ? 'cpk:row-start-2' : 'cpk:row-start-1',
|
|
1008
|
-
]"
|
|
1009
|
-
>
|
|
1058
|
+
<div ref="addButtonContainerRef" class="cpk-chat-input-start">
|
|
1010
1059
|
<slot
|
|
1011
1060
|
name="add-menu-button"
|
|
1012
1061
|
:disabled="disabled || mode === 'transcribe' || !hasMenuItems"
|
|
1013
1062
|
:menu-open="addMenuOpen"
|
|
1014
|
-
:toggle-menu="toggleAddMenu"
|
|
1063
|
+
:toggle-menu="() => toggleAddMenu()"
|
|
1015
1064
|
:labels="labels"
|
|
1016
1065
|
>
|
|
1017
|
-
<
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1066
|
+
<CopilotTooltip side="bottom" :suppressed="addMenuOpen">
|
|
1067
|
+
<template #default="{ triggerProps }">
|
|
1068
|
+
<button
|
|
1069
|
+
v-bind="triggerProps"
|
|
1070
|
+
:id="addMenuTriggerId"
|
|
1071
|
+
type="button"
|
|
1072
|
+
data-testid="copilot-chat-input-add"
|
|
1073
|
+
:aria-label="labels.chatInputToolbarAddButtonLabel"
|
|
1074
|
+
aria-haspopup="menu"
|
|
1075
|
+
:aria-expanded="addMenuOpen"
|
|
1076
|
+
:aria-controls="addMenuOpen ? addMenuId : undefined"
|
|
1077
|
+
:data-state="addMenuOpen ? 'open' : 'closed'"
|
|
1078
|
+
:disabled="
|
|
1079
|
+
disabled || mode === 'transcribe' || !hasMenuItems
|
|
1080
|
+
"
|
|
1081
|
+
class="cpk-button cpk-button-chat-input-toolbar-secondary cpk-button-size-chat-input-toolbar-icon cpk-chat-input-add-menu-button"
|
|
1082
|
+
@pointerdown="handleAddMenuPointerDown"
|
|
1083
|
+
@click.stop="handleAddMenuClick"
|
|
1084
|
+
@keydown="handleAddMenuTriggerKeydown"
|
|
1085
|
+
>
|
|
1086
|
+
<IconPlus class="cpk-chat-input-add-menu-icon" />
|
|
1087
|
+
</button>
|
|
1088
|
+
</template>
|
|
1089
|
+
<template #content>
|
|
1090
|
+
<p class="cpk-chat-input-add-menu-tooltip">
|
|
1091
|
+
<span>{{ labels.chatInputToolbarAddButtonLabel }}</span>
|
|
1092
|
+
<code class="cpk-chat-input-add-menu-shortcut">/</code>
|
|
1093
|
+
</p>
|
|
1094
|
+
</template>
|
|
1095
|
+
</CopilotTooltip>
|
|
1027
1096
|
</slot>
|
|
1028
1097
|
|
|
1029
|
-
<
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1098
|
+
<CopilotDropdownMenuContent
|
|
1099
|
+
:id="addMenuId"
|
|
1100
|
+
:open="addMenuOpen && hasMenuItems"
|
|
1101
|
+
:anchor="addMenuAnchor"
|
|
1102
|
+
:items="menuItems"
|
|
1103
|
+
:menu-id="addMenuId"
|
|
1104
|
+
:labelled-by="addMenuAnchor?.id || undefined"
|
|
1105
|
+
side="top"
|
|
1106
|
+
align="start"
|
|
1107
|
+
:side-offset="4"
|
|
1108
|
+
:initial-focus="addMenuInitialFocus"
|
|
1033
1109
|
data-testid="copilot-chat-input-add-menu"
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
v-if="entry.type === 'separator'"
|
|
1038
|
-
class="cpk:my-1 cpk:h-px cpk:bg-border cpk:dark:bg-[#333333]"
|
|
1039
|
-
/>
|
|
1040
|
-
<div
|
|
1041
|
-
v-else-if="entry.type === 'label'"
|
|
1042
|
-
class="cpk:flex cpk:items-center cpk:gap-1 cpk:px-3 cpk:py-1.5 cpk:text-xs cpk:font-semibold cpk:text-muted-foreground"
|
|
1043
|
-
:style="{ paddingLeft: `${12 + entry.depth * 12}px` }"
|
|
1044
|
-
>
|
|
1045
|
-
<span>{{ entry.label }}</span>
|
|
1046
|
-
<IconChevronRight class="cpk:size-3" />
|
|
1047
|
-
</div>
|
|
1048
|
-
<button
|
|
1049
|
-
v-else
|
|
1050
|
-
type="button"
|
|
1051
|
-
role="menuitem"
|
|
1052
|
-
class="cpk:w-full cpk:px-3 cpk:py-2 cpk:text-left cpk:text-sm cpk:transition-colors cpk:hover:bg-muted cpk:dark:hover:bg-[#2f2f2f]"
|
|
1053
|
-
:style="{ paddingLeft: `${12 + entry.depth * 12}px` }"
|
|
1054
|
-
@click="handleMenuAction(entry.action)"
|
|
1055
|
-
>
|
|
1056
|
-
{{ entry.label }}
|
|
1057
|
-
</button>
|
|
1058
|
-
</template>
|
|
1059
|
-
</div>
|
|
1110
|
+
@select="handleAddMenuSelect"
|
|
1111
|
+
@dismiss="handleAddMenuDismiss"
|
|
1112
|
+
/>
|
|
1060
1113
|
</div>
|
|
1061
1114
|
|
|
1062
|
-
<div
|
|
1063
|
-
:class="[
|
|
1064
|
-
'cpk:relative cpk:flex cpk:min-h-[50px] cpk:min-w-0 cpk:flex-col cpk:justify-center',
|
|
1065
|
-
isExpanded
|
|
1066
|
-
? 'cpk:col-span-3 cpk:row-start-1'
|
|
1067
|
-
: 'cpk:col-start-2 cpk:row-start-1',
|
|
1068
|
-
]"
|
|
1069
|
-
>
|
|
1115
|
+
<div class="cpk-chat-input-field">
|
|
1070
1116
|
<template v-if="mode === 'transcribe'">
|
|
1071
1117
|
<slot name="audio-recorder">
|
|
1072
1118
|
<CopilotChatAudioRecorder ref="audioRecorderRef" />
|
|
1073
1119
|
</slot>
|
|
1074
1120
|
</template>
|
|
1075
1121
|
<template v-else-if="mode === 'processing'">
|
|
1076
|
-
<div
|
|
1077
|
-
class="cpk
|
|
1078
|
-
>
|
|
1079
|
-
<IconLoader2
|
|
1080
|
-
class="cpk:size-[26px] cpk:animate-spin cpk:text-muted-foreground"
|
|
1081
|
-
/>
|
|
1122
|
+
<div class="cpk-chat-input-processing">
|
|
1123
|
+
<IconLoader2 class="cpk-chat-input-processing-spinner" />
|
|
1082
1124
|
</div>
|
|
1083
1125
|
</template>
|
|
1084
1126
|
<template v-else>
|
|
@@ -1102,8 +1144,10 @@ onBeforeUnmount(() => {
|
|
|
1102
1144
|
:disabled="disabled"
|
|
1103
1145
|
rows="1"
|
|
1104
1146
|
:class="[
|
|
1105
|
-
'cpk
|
|
1106
|
-
isExpanded
|
|
1147
|
+
'cpk-chat-input-textarea',
|
|
1148
|
+
isExpanded
|
|
1149
|
+
? 'cpk-chat-input-textarea-expanded'
|
|
1150
|
+
: 'cpk-chat-input-textarea-compact',
|
|
1107
1151
|
]"
|
|
1108
1152
|
style="overflow: auto; resize: none"
|
|
1109
1153
|
@input="handleInput"
|
|
@@ -1119,12 +1163,12 @@ onBeforeUnmount(() => {
|
|
|
1119
1163
|
data-testid="copilot-slash-menu"
|
|
1120
1164
|
role="listbox"
|
|
1121
1165
|
:aria-label="labels.chatInputSlashMenuLabel"
|
|
1122
|
-
class="cpk
|
|
1166
|
+
class="cpk-chat-input-slash-menu"
|
|
1123
1167
|
:style="{ maxHeight: `${5 * 40}px` }"
|
|
1124
1168
|
>
|
|
1125
1169
|
<div
|
|
1126
1170
|
v-if="filteredCommands.length === 0"
|
|
1127
|
-
class="cpk
|
|
1171
|
+
class="cpk-chat-input-slash-menu-empty"
|
|
1128
1172
|
>
|
|
1129
1173
|
{{ labels.chatInputSlashMenuEmptyText }}
|
|
1130
1174
|
</div>
|
|
@@ -1139,12 +1183,7 @@ onBeforeUnmount(() => {
|
|
|
1139
1183
|
:data-active="
|
|
1140
1184
|
index === slashHighlightIndex ? 'true' : undefined
|
|
1141
1185
|
"
|
|
1142
|
-
|
|
1143
|
-
'cpk:w-full cpk:px-3 cpk:py-2 cpk:text-left cpk:text-sm cpk:transition-colors cpk:hover:bg-muted cpk:dark:hover:bg-[#2f2f2f]',
|
|
1144
|
-
index === slashHighlightIndex
|
|
1145
|
-
? 'cpk:bg-muted cpk:dark:bg-[#2f2f2f]'
|
|
1146
|
-
: 'cpk:bg-transparent',
|
|
1147
|
-
]"
|
|
1186
|
+
class="cpk-chat-input-slash-menu-item"
|
|
1148
1187
|
@mouseenter="slashHighlightIndex = index"
|
|
1149
1188
|
@mousedown.prevent="runCommand(command)"
|
|
1150
1189
|
>
|
|
@@ -1154,15 +1193,7 @@ onBeforeUnmount(() => {
|
|
|
1154
1193
|
</template>
|
|
1155
1194
|
</div>
|
|
1156
1195
|
|
|
1157
|
-
<div
|
|
1158
|
-
ref="actionsContainerRef"
|
|
1159
|
-
:class="[
|
|
1160
|
-
'cpk:flex cpk:items-center cpk:justify-end cpk:gap-2',
|
|
1161
|
-
isExpanded
|
|
1162
|
-
? 'cpk:col-start-3 cpk:row-start-2'
|
|
1163
|
-
: 'cpk:col-start-3 cpk:row-start-1',
|
|
1164
|
-
]"
|
|
1165
|
-
>
|
|
1196
|
+
<div ref="actionsContainerRef" class="cpk-chat-input-actions">
|
|
1166
1197
|
<template v-if="mode === 'transcribe'">
|
|
1167
1198
|
<slot
|
|
1168
1199
|
v-if="
|
|
@@ -1174,18 +1205,28 @@ onBeforeUnmount(() => {
|
|
|
1174
1205
|
:on-click="() => emit('cancel-transcribe')"
|
|
1175
1206
|
:labels="labels"
|
|
1176
1207
|
>
|
|
1177
|
-
<
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
:aria-label="
|
|
1208
|
+
<CopilotTooltip
|
|
1209
|
+
side="bottom"
|
|
1210
|
+
:content="
|
|
1181
1211
|
labels.chatInputToolbarCancelTranscribeButtonLabel
|
|
1182
1212
|
"
|
|
1183
|
-
:disabled="disabled"
|
|
1184
|
-
class="cpk:mr-2 cpk:inline-flex cpk:h-9 cpk:w-9 cpk:shrink-0 cpk:items-center cpk:justify-center cpk:rounded-full cpk:bg-transparent cpk:text-[#444444] cpk:transition-colors cpk:hover:bg-[#f8f8f8] cpk:hover:text-[#333333] cpk:disabled:cursor-not-allowed cpk:disabled:opacity-50 cpk:dark:text-white cpk:dark:hover:bg-[#404040] cpk:dark:hover:text-[#FFFFFF]"
|
|
1185
|
-
@click="emit('cancel-transcribe')"
|
|
1186
1213
|
>
|
|
1187
|
-
<
|
|
1188
|
-
|
|
1214
|
+
<template #default="{ triggerProps }">
|
|
1215
|
+
<button
|
|
1216
|
+
v-bind="triggerProps"
|
|
1217
|
+
type="button"
|
|
1218
|
+
data-testid="copilot-chat-input-cancel-transcribe"
|
|
1219
|
+
:aria-label="
|
|
1220
|
+
labels.chatInputToolbarCancelTranscribeButtonLabel
|
|
1221
|
+
"
|
|
1222
|
+
:disabled="disabled"
|
|
1223
|
+
class="cpk-button cpk-button-chat-input-toolbar-secondary cpk-button-size-chat-input-toolbar-icon cpk-chat-input-cancel-transcribe-button"
|
|
1224
|
+
@click="emit('cancel-transcribe')"
|
|
1225
|
+
>
|
|
1226
|
+
<IconX class="cpk-chat-input-toolbar-icon" />
|
|
1227
|
+
</button>
|
|
1228
|
+
</template>
|
|
1229
|
+
</CopilotTooltip>
|
|
1189
1230
|
</slot>
|
|
1190
1231
|
<slot
|
|
1191
1232
|
v-if="
|
|
@@ -1197,18 +1238,28 @@ onBeforeUnmount(() => {
|
|
|
1197
1238
|
:on-click="handleFinishTranscribe"
|
|
1198
1239
|
:labels="labels"
|
|
1199
1240
|
>
|
|
1200
|
-
<
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
:aria-label="
|
|
1241
|
+
<CopilotTooltip
|
|
1242
|
+
side="bottom"
|
|
1243
|
+
:content="
|
|
1204
1244
|
labels.chatInputToolbarFinishTranscribeButtonLabel
|
|
1205
1245
|
"
|
|
1206
|
-
:disabled="disabled"
|
|
1207
|
-
class="cpk:mr-[10px] cpk:inline-flex cpk:h-9 cpk:w-9 cpk:shrink-0 cpk:items-center cpk:justify-center cpk:rounded-full cpk:bg-transparent cpk:text-[#444444] cpk:transition-colors cpk:hover:bg-[#f8f8f8] cpk:hover:text-[#333333] cpk:disabled:cursor-not-allowed cpk:disabled:opacity-50 cpk:dark:text-white cpk:dark:hover:bg-[#404040] cpk:dark:hover:text-[#FFFFFF]"
|
|
1208
|
-
@click="handleFinishTranscribe"
|
|
1209
1246
|
>
|
|
1210
|
-
<
|
|
1211
|
-
|
|
1247
|
+
<template #default="{ triggerProps }">
|
|
1248
|
+
<button
|
|
1249
|
+
v-bind="triggerProps"
|
|
1250
|
+
type="button"
|
|
1251
|
+
data-testid="copilot-chat-input-finish-transcribe"
|
|
1252
|
+
:aria-label="
|
|
1253
|
+
labels.chatInputToolbarFinishTranscribeButtonLabel
|
|
1254
|
+
"
|
|
1255
|
+
:disabled="disabled"
|
|
1256
|
+
class="cpk-button cpk-button-chat-input-toolbar-secondary cpk-button-size-chat-input-toolbar-icon cpk-chat-input-finish-transcribe-button"
|
|
1257
|
+
@click="handleFinishTranscribe"
|
|
1258
|
+
>
|
|
1259
|
+
<IconCheck class="cpk-chat-input-toolbar-icon" />
|
|
1260
|
+
</button>
|
|
1261
|
+
</template>
|
|
1262
|
+
</CopilotTooltip>
|
|
1212
1263
|
</slot>
|
|
1213
1264
|
</template>
|
|
1214
1265
|
<template v-else>
|
|
@@ -1222,18 +1273,26 @@ onBeforeUnmount(() => {
|
|
|
1222
1273
|
:on-click="() => emit('start-transcribe')"
|
|
1223
1274
|
:labels="labels"
|
|
1224
1275
|
>
|
|
1225
|
-
<
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
:aria-label="
|
|
1229
|
-
labels.chatInputToolbarStartTranscribeButtonLabel
|
|
1230
|
-
"
|
|
1231
|
-
:disabled="disabled"
|
|
1232
|
-
class="cpk:mr-2 cpk:inline-flex cpk:h-9 cpk:w-9 cpk:shrink-0 cpk:items-center cpk:justify-center cpk:rounded-full cpk:bg-transparent cpk:text-[#444444] cpk:transition-colors cpk:hover:bg-[#f8f8f8] cpk:hover:text-[#333333] cpk:disabled:cursor-not-allowed cpk:disabled:opacity-50 cpk:disabled:hover:bg-transparent cpk:disabled:hover:text-[#444444] cpk:dark:text-white cpk:dark:hover:bg-[#404040] cpk:dark:hover:text-[#FFFFFF] cpk:dark:disabled:hover:bg-transparent cpk:dark:disabled:hover:text-[#CCCCCC]"
|
|
1233
|
-
@click="emit('start-transcribe')"
|
|
1276
|
+
<CopilotTooltip
|
|
1277
|
+
side="bottom"
|
|
1278
|
+
:content="labels.chatInputToolbarStartTranscribeButtonLabel"
|
|
1234
1279
|
>
|
|
1235
|
-
<
|
|
1236
|
-
|
|
1280
|
+
<template #default="{ triggerProps }">
|
|
1281
|
+
<button
|
|
1282
|
+
v-bind="triggerProps"
|
|
1283
|
+
type="button"
|
|
1284
|
+
data-testid="copilot-chat-input-start-transcribe"
|
|
1285
|
+
:aria-label="
|
|
1286
|
+
labels.chatInputToolbarStartTranscribeButtonLabel
|
|
1287
|
+
"
|
|
1288
|
+
:disabled="disabled"
|
|
1289
|
+
class="cpk-button cpk-button-chat-input-toolbar-secondary cpk-button-size-chat-input-toolbar-icon cpk-chat-input-start-transcribe-button"
|
|
1290
|
+
@click="emit('start-transcribe')"
|
|
1291
|
+
>
|
|
1292
|
+
<IconMic class="cpk-chat-input-toolbar-icon" />
|
|
1293
|
+
</button>
|
|
1294
|
+
</template>
|
|
1295
|
+
</CopilotTooltip>
|
|
1237
1296
|
</slot>
|
|
1238
1297
|
<slot
|
|
1239
1298
|
name="send-button"
|
|
@@ -1241,24 +1300,24 @@ onBeforeUnmount(() => {
|
|
|
1241
1300
|
:is-processing="isProcessing"
|
|
1242
1301
|
:on-click="handleSendButtonClick"
|
|
1243
1302
|
>
|
|
1244
|
-
<div class="cpk
|
|
1303
|
+
<div class="cpk-chat-input-send">
|
|
1245
1304
|
<button
|
|
1246
1305
|
type="button"
|
|
1247
1306
|
data-testid="copilot-chat-input-send"
|
|
1248
1307
|
:aria-label="
|
|
1249
|
-
|
|
1308
|
+
showsStop
|
|
1250
1309
|
? labels.chatInputToolbarStopButtonLabel
|
|
1251
1310
|
: labels.chatInputToolbarSendButtonLabel
|
|
1252
1311
|
"
|
|
1253
1312
|
:disabled="sendDisabled"
|
|
1254
|
-
class="cpk
|
|
1313
|
+
class="cpk-button cpk-button-chat-input-toolbar-primary cpk-button-size-chat-input-toolbar-icon cpk-chat-input-send-button"
|
|
1255
1314
|
@click="handleSendButtonClick"
|
|
1256
1315
|
>
|
|
1257
1316
|
<IconSquare
|
|
1258
|
-
v-if="
|
|
1259
|
-
class="cpk
|
|
1317
|
+
v-if="showsStop"
|
|
1318
|
+
class="cpk-chat-input-stop-icon"
|
|
1260
1319
|
/>
|
|
1261
|
-
<IconArrowUp v-else class="cpk
|
|
1320
|
+
<IconArrowUp v-else class="cpk-chat-input-send-icon" />
|
|
1262
1321
|
</button>
|
|
1263
1322
|
</div>
|
|
1264
1323
|
</slot>
|
|
@@ -1272,7 +1331,7 @@ onBeforeUnmount(() => {
|
|
|
1272
1331
|
<slot v-if="shouldShowDisclaimer" name="disclaimer" :labels="labels">
|
|
1273
1332
|
<p
|
|
1274
1333
|
data-testid="copilot-chat-input-disclaimer"
|
|
1275
|
-
class="cpk
|
|
1334
|
+
class="cpk-chat-input-disclaimer"
|
|
1276
1335
|
>
|
|
1277
1336
|
{{ labels.chatDisclaimerText }}
|
|
1278
1337
|
</p>
|