@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
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* React's `<Tooltip>` (Radix) for Vue: a label that shows next to its trigger
|
|
4
|
+
* on hover and on keyboard focus, and hides on pointer leave, blur, a click,
|
|
5
|
+
* Escape, or a scroll that moves the trigger. The default slot renders the
|
|
6
|
+
* trigger and must bind `triggerProps` on a focusable element.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
import { computed, onBeforeUnmount, ref, watch } from "vue";
|
|
11
|
+
import type { FloatingAlign, FloatingSide } from "./floating";
|
|
12
|
+
import { arrowWrapperStyle, useFloating } from "./floating";
|
|
13
|
+
import { usePresence } from "./presence";
|
|
14
|
+
import { useCopilotId } from "./use-id";
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(
|
|
17
|
+
defineProps<{
|
|
18
|
+
/** Text of the tooltip; the `content` slot replaces it. */
|
|
19
|
+
content?: string;
|
|
20
|
+
side?: FloatingSide;
|
|
21
|
+
align?: FloatingAlign;
|
|
22
|
+
sideOffset?: number;
|
|
23
|
+
/** Hover time before it opens, in ms. Focus opens it at once. */
|
|
24
|
+
delayDuration?: number;
|
|
25
|
+
/** Keeps it closed, for example while the trigger's own popup shows. */
|
|
26
|
+
suppressed?: boolean;
|
|
27
|
+
contentClass?: string;
|
|
28
|
+
}>(),
|
|
29
|
+
{
|
|
30
|
+
content: undefined,
|
|
31
|
+
side: "top",
|
|
32
|
+
align: "center",
|
|
33
|
+
sideOffset: 0,
|
|
34
|
+
delayDuration: 0,
|
|
35
|
+
suppressed: false,
|
|
36
|
+
contentClass: undefined,
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
defineSlots<{
|
|
41
|
+
default(props: {
|
|
42
|
+
triggerProps: Record<string, unknown>;
|
|
43
|
+
open: boolean;
|
|
44
|
+
}): unknown;
|
|
45
|
+
content?(): unknown;
|
|
46
|
+
}>();
|
|
47
|
+
|
|
48
|
+
// Matches `.cpk-tooltip-arrow` (0.625rem); Radix adds it to the offset.
|
|
49
|
+
const ARROW_SIZE = 10;
|
|
50
|
+
// Time the pointer has to cross from the trigger onto the tooltip.
|
|
51
|
+
const HOVER_GRACE_MS = 100;
|
|
52
|
+
|
|
53
|
+
const id = useCopilotId("cpk-tooltip");
|
|
54
|
+
const wantsOpen = ref(false);
|
|
55
|
+
const open = computed(() => wantsOpen.value && !props.suppressed);
|
|
56
|
+
const trigger = ref<HTMLElement | null>(null);
|
|
57
|
+
const wrapper = ref<HTMLElement | null>(null);
|
|
58
|
+
const contentElement = ref<HTMLElement | null>(null);
|
|
59
|
+
const present = usePresence(open, contentElement);
|
|
60
|
+
|
|
61
|
+
const { placement, wrapperStyle } = useFloating(trigger, wrapper, open, () => ({
|
|
62
|
+
side: props.side,
|
|
63
|
+
align: props.align,
|
|
64
|
+
sideOffset: props.sideOffset,
|
|
65
|
+
arrowSize: ARROW_SIZE,
|
|
66
|
+
}));
|
|
67
|
+
|
|
68
|
+
let openTimer: ReturnType<typeof setTimeout> | undefined;
|
|
69
|
+
let closeTimer: ReturnType<typeof setTimeout> | undefined;
|
|
70
|
+
let pointerDown = false;
|
|
71
|
+
// Set once the pointer has opened it, until the pointer leaves: after a click
|
|
72
|
+
// closes it, moving over the trigger again does not reopen it.
|
|
73
|
+
let pointerMoveOpened = false;
|
|
74
|
+
|
|
75
|
+
const clearTimers = () => {
|
|
76
|
+
clearTimeout(openTimer);
|
|
77
|
+
clearTimeout(closeTimer);
|
|
78
|
+
openTimer = undefined;
|
|
79
|
+
closeTimer = undefined;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const show = () => {
|
|
83
|
+
clearTimers();
|
|
84
|
+
if (!props.suppressed) wantsOpen.value = true;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const hide = () => {
|
|
88
|
+
clearTimers();
|
|
89
|
+
wantsOpen.value = false;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// A request to open while suppressed is dropped, so the tooltip does not
|
|
93
|
+
// reappear when the suppression ends under a pointer that already left.
|
|
94
|
+
watch(
|
|
95
|
+
() => props.suppressed,
|
|
96
|
+
(suppressed) => {
|
|
97
|
+
if (suppressed) hide();
|
|
98
|
+
},
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const onPointerMove = (event: PointerEvent) => {
|
|
102
|
+
if (event.pointerType === "touch") return;
|
|
103
|
+
trigger.value = event.currentTarget as HTMLElement;
|
|
104
|
+
clearTimeout(closeTimer);
|
|
105
|
+
closeTimer = undefined;
|
|
106
|
+
if (pointerMoveOpened || pointerDown) return;
|
|
107
|
+
pointerMoveOpened = true;
|
|
108
|
+
if (props.delayDuration > 0) {
|
|
109
|
+
openTimer = setTimeout(show, props.delayDuration);
|
|
110
|
+
} else {
|
|
111
|
+
show();
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const scheduleClose = () => {
|
|
116
|
+
clearTimeout(openTimer);
|
|
117
|
+
openTimer = undefined;
|
|
118
|
+
clearTimeout(closeTimer);
|
|
119
|
+
closeTimer = setTimeout(hide, HOVER_GRACE_MS);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const onPointerLeave = (event: PointerEvent) => {
|
|
123
|
+
if (event.pointerType === "touch") return;
|
|
124
|
+
pointerMoveOpened = false;
|
|
125
|
+
const next = event.relatedTarget;
|
|
126
|
+
if (next instanceof Node && contentElement.value?.contains(next)) return;
|
|
127
|
+
scheduleClose();
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const onPointerUp = () => {
|
|
131
|
+
pointerDown = false;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const onPointerDown = () => {
|
|
135
|
+
pointerDown = true;
|
|
136
|
+
document.addEventListener("pointerup", onPointerUp, { once: true });
|
|
137
|
+
hide();
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const onFocus = (event: FocusEvent) => {
|
|
141
|
+
trigger.value = event.currentTarget as HTMLElement;
|
|
142
|
+
if (!pointerDown) show();
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const triggerProps = computed(() => ({
|
|
146
|
+
"data-state": open.value ? "delayed-open" : "closed",
|
|
147
|
+
"aria-describedby": open.value ? id : undefined,
|
|
148
|
+
onPointermove: onPointerMove,
|
|
149
|
+
onPointerleave: onPointerLeave,
|
|
150
|
+
onPointerdown: onPointerDown,
|
|
151
|
+
onFocus,
|
|
152
|
+
onBlur: hide,
|
|
153
|
+
onClick: hide,
|
|
154
|
+
}));
|
|
155
|
+
|
|
156
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
157
|
+
if (event.key === "Escape") hide();
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const onScroll = (event: Event) => {
|
|
161
|
+
const target = event.target;
|
|
162
|
+
if (target instanceof Node && target.contains(trigger.value)) hide();
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
watch(
|
|
166
|
+
open,
|
|
167
|
+
(isOpen) => {
|
|
168
|
+
if (typeof document === "undefined") return;
|
|
169
|
+
if (isOpen) {
|
|
170
|
+
document.addEventListener("keydown", onKeyDown);
|
|
171
|
+
window.addEventListener("scroll", onScroll, { capture: true });
|
|
172
|
+
} else {
|
|
173
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
174
|
+
window.removeEventListener("scroll", onScroll, { capture: true });
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{ immediate: true },
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
onBeforeUnmount(() => {
|
|
181
|
+
clearTimers();
|
|
182
|
+
if (typeof document === "undefined") return;
|
|
183
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
184
|
+
document.removeEventListener("pointerup", onPointerUp);
|
|
185
|
+
window.removeEventListener("scroll", onScroll, { capture: true });
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
const contentStyle = computed(() => ({
|
|
189
|
+
"--radix-tooltip-content-transform-origin":
|
|
190
|
+
placement.value?.transformOrigin ?? "center",
|
|
191
|
+
}));
|
|
192
|
+
</script>
|
|
193
|
+
|
|
194
|
+
<template>
|
|
195
|
+
<slot :trigger-props="triggerProps" :open="open" />
|
|
196
|
+
<Teleport to="body">
|
|
197
|
+
<div
|
|
198
|
+
v-if="present"
|
|
199
|
+
ref="wrapper"
|
|
200
|
+
data-radix-popper-content-wrapper
|
|
201
|
+
:style="wrapperStyle()"
|
|
202
|
+
>
|
|
203
|
+
<div
|
|
204
|
+
:id="id"
|
|
205
|
+
ref="contentElement"
|
|
206
|
+
data-copilotkit
|
|
207
|
+
data-slot="tooltip-content"
|
|
208
|
+
role="tooltip"
|
|
209
|
+
class="cpk-tooltip"
|
|
210
|
+
:class="contentClass"
|
|
211
|
+
:data-state="open ? 'delayed-open' : 'closed'"
|
|
212
|
+
:data-side="placement?.side ?? side"
|
|
213
|
+
:data-align="placement?.align ?? align"
|
|
214
|
+
:style="contentStyle"
|
|
215
|
+
@pointerenter="clearTimers"
|
|
216
|
+
@pointerleave="scheduleClose"
|
|
217
|
+
>
|
|
218
|
+
<slot name="content">
|
|
219
|
+
<p>{{ content }}</p>
|
|
220
|
+
</slot>
|
|
221
|
+
<span :style="arrowWrapperStyle(placement)">
|
|
222
|
+
<svg
|
|
223
|
+
class="cpk-tooltip-arrow"
|
|
224
|
+
width="10"
|
|
225
|
+
height="5"
|
|
226
|
+
viewBox="0 0 30 10"
|
|
227
|
+
preserveAspectRatio="none"
|
|
228
|
+
aria-hidden="true"
|
|
229
|
+
style="display: block"
|
|
230
|
+
>
|
|
231
|
+
<polygon points="0,0 30,0 15,10" />
|
|
232
|
+
</svg>
|
|
233
|
+
</span>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
</Teleport>
|
|
237
|
+
</template>
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { defineComponent, h, nextTick, ref } from "vue";
|
|
3
|
+
import { fireEvent, render, screen } from "@testing-library/vue";
|
|
4
|
+
import CopilotTooltip from "../CopilotTooltip.vue";
|
|
5
|
+
import { computeFloatingPlacement } from "../floating";
|
|
6
|
+
|
|
7
|
+
function renderTooltip(props: Record<string, unknown> = {}) {
|
|
8
|
+
return render(
|
|
9
|
+
defineComponent({
|
|
10
|
+
setup() {
|
|
11
|
+
return () =>
|
|
12
|
+
h(
|
|
13
|
+
CopilotTooltip,
|
|
14
|
+
{ content: "Copy", side: "bottom", ...props },
|
|
15
|
+
{
|
|
16
|
+
default: ({
|
|
17
|
+
triggerProps,
|
|
18
|
+
}: {
|
|
19
|
+
triggerProps: Record<string, unknown>;
|
|
20
|
+
}) =>
|
|
21
|
+
h("button", {
|
|
22
|
+
type: "button",
|
|
23
|
+
"aria-label": "Copy",
|
|
24
|
+
...triggerProps,
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const pointer = (type: string) =>
|
|
34
|
+
Object.assign(new Event(type, { bubbles: true }), { pointerType: "mouse" });
|
|
35
|
+
|
|
36
|
+
describe("CopilotTooltip", () => {
|
|
37
|
+
afterEach(() => {
|
|
38
|
+
vi.useRealTimers();
|
|
39
|
+
document.body.innerHTML = "";
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("opens on keyboard focus, describes the trigger, and closes on blur", async () => {
|
|
43
|
+
renderTooltip();
|
|
44
|
+
const button = screen.getByRole("button", { name: "Copy" });
|
|
45
|
+
expect(screen.queryByRole("tooltip")).toBeNull();
|
|
46
|
+
|
|
47
|
+
await fireEvent.focus(button);
|
|
48
|
+
const tooltip = screen.getByRole("tooltip");
|
|
49
|
+
expect(tooltip.textContent).toContain("Copy");
|
|
50
|
+
expect(tooltip.classList.contains("cpk-tooltip")).toBe(true);
|
|
51
|
+
expect(tooltip.getAttribute("data-side")).toBe("bottom");
|
|
52
|
+
expect(button.getAttribute("aria-describedby")).toBe(tooltip.id);
|
|
53
|
+
|
|
54
|
+
await fireEvent.blur(button);
|
|
55
|
+
await nextTick();
|
|
56
|
+
expect(screen.queryByRole("tooltip")).toBeNull();
|
|
57
|
+
expect(button.getAttribute("aria-describedby")).toBeNull();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("opens on hover and closes when the pointer leaves", async () => {
|
|
61
|
+
vi.useFakeTimers();
|
|
62
|
+
renderTooltip();
|
|
63
|
+
const button = screen.getByRole("button", { name: "Copy" });
|
|
64
|
+
|
|
65
|
+
button.dispatchEvent(pointer("pointermove"));
|
|
66
|
+
await nextTick();
|
|
67
|
+
expect(screen.getByRole("tooltip")).toBeTruthy();
|
|
68
|
+
|
|
69
|
+
button.dispatchEvent(pointer("pointerleave"));
|
|
70
|
+
await vi.advanceTimersByTimeAsync(200);
|
|
71
|
+
await nextTick();
|
|
72
|
+
expect(screen.queryByRole("tooltip")).toBeNull();
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("closes on Escape without moving focus", async () => {
|
|
76
|
+
renderTooltip();
|
|
77
|
+
const button = screen.getByRole("button", { name: "Copy" });
|
|
78
|
+
button.focus();
|
|
79
|
+
await fireEvent.focus(button);
|
|
80
|
+
expect(screen.getByRole("tooltip")).toBeTruthy();
|
|
81
|
+
|
|
82
|
+
await fireEvent.keyDown(document, { key: "Escape" });
|
|
83
|
+
await nextTick();
|
|
84
|
+
expect(screen.queryByRole("tooltip")).toBeNull();
|
|
85
|
+
expect(document.activeElement).toBe(button);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("stays closed while suppressed", async () => {
|
|
89
|
+
const suppressed = ref(true);
|
|
90
|
+
render(
|
|
91
|
+
defineComponent({
|
|
92
|
+
setup() {
|
|
93
|
+
return () =>
|
|
94
|
+
h(
|
|
95
|
+
CopilotTooltip,
|
|
96
|
+
{ content: "Rate", suppressed: suppressed.value },
|
|
97
|
+
{
|
|
98
|
+
default: ({
|
|
99
|
+
triggerProps,
|
|
100
|
+
}: {
|
|
101
|
+
triggerProps: Record<string, unknown>;
|
|
102
|
+
}) => h("button", { type: "button", ...triggerProps }, "Rate"),
|
|
103
|
+
},
|
|
104
|
+
);
|
|
105
|
+
},
|
|
106
|
+
}),
|
|
107
|
+
);
|
|
108
|
+
const button = screen.getByRole("button", { name: "Rate" });
|
|
109
|
+
await fireEvent.focus(button);
|
|
110
|
+
expect(screen.queryByRole("tooltip")).toBeNull();
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
describe("computeFloatingPlacement", () => {
|
|
115
|
+
const viewport = { width: 1000, height: 800 };
|
|
116
|
+
const size = { width: 100, height: 40 };
|
|
117
|
+
|
|
118
|
+
it("places content below and centered, with the offset", () => {
|
|
119
|
+
const reference = {
|
|
120
|
+
top: 100,
|
|
121
|
+
bottom: 120,
|
|
122
|
+
left: 200,
|
|
123
|
+
right: 240,
|
|
124
|
+
width: 40,
|
|
125
|
+
height: 20,
|
|
126
|
+
};
|
|
127
|
+
const placement = computeFloatingPlacement(reference, size, viewport, {
|
|
128
|
+
side: "bottom",
|
|
129
|
+
sideOffset: 4,
|
|
130
|
+
arrowSize: 10,
|
|
131
|
+
});
|
|
132
|
+
expect(placement.side).toBe("bottom");
|
|
133
|
+
expect(placement.y).toBe(134);
|
|
134
|
+
expect(placement.x).toBe(170);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it("flips to the other side when there is no room", () => {
|
|
138
|
+
const reference = {
|
|
139
|
+
top: 770,
|
|
140
|
+
bottom: 790,
|
|
141
|
+
left: 200,
|
|
142
|
+
right: 240,
|
|
143
|
+
width: 40,
|
|
144
|
+
height: 20,
|
|
145
|
+
};
|
|
146
|
+
const placement = computeFloatingPlacement(reference, size, viewport, {
|
|
147
|
+
side: "bottom",
|
|
148
|
+
});
|
|
149
|
+
expect(placement.side).toBe("top");
|
|
150
|
+
expect(placement.y).toBe(730);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it("shifts content back inside the viewport", () => {
|
|
154
|
+
const reference = {
|
|
155
|
+
top: 100,
|
|
156
|
+
bottom: 120,
|
|
157
|
+
left: 0,
|
|
158
|
+
right: 20,
|
|
159
|
+
width: 20,
|
|
160
|
+
height: 20,
|
|
161
|
+
};
|
|
162
|
+
const placement = computeFloatingPlacement(reference, size, viewport, {
|
|
163
|
+
side: "bottom",
|
|
164
|
+
collisionPadding: 8,
|
|
165
|
+
});
|
|
166
|
+
expect(placement.x).toBe(8);
|
|
167
|
+
});
|
|
168
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** An entry of a `CopilotDropdownMenuContent`: an item, a submenu, or "-". @internal */
|
|
2
|
+
export type CopilotDropdownMenuEntry = CopilotDropdownMenuItem | "-";
|
|
3
|
+
|
|
4
|
+
/** @internal */
|
|
5
|
+
export interface CopilotDropdownMenuItem {
|
|
6
|
+
label: string;
|
|
7
|
+
action?: () => void;
|
|
8
|
+
/** Makes the item a submenu trigger. */
|
|
9
|
+
items?: CopilotDropdownMenuEntry[];
|
|
10
|
+
/** Extra classes on the item. */
|
|
11
|
+
class?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Why a dropdown menu closed by itself. @internal */
|
|
15
|
+
export type CopilotDropdownMenuDismissReason = "escape" | "tab" | "outside";
|