@copilotkit/vue 2.0.0-rc.3 → 2.0.0-rc.31
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-BMTHA_P2.js +15901 -0
- package/dist/use-render-activity-message-BMTHA_P2.js.map +1 -0
- package/dist/use-render-activity-message-CH3beu7z.cjs +113 -0
- package/dist/use-render-activity-message-CH3beu7z.cjs.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
|
@@ -119,6 +119,23 @@ describe("CopilotChatConfigurationProvider", () => {
|
|
|
119
119
|
expect(wrapper.find("[data-testid=placeholder]").text()).toBe("Inner");
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
+
it("a nested non-explicit seed yields to the parent's thread, like React", () => {
|
|
123
|
+
const Display = makeDisplay();
|
|
124
|
+
const wrapper = mount(CopilotChatConfigurationProvider, {
|
|
125
|
+
props: { threadId: "outer-thread" },
|
|
126
|
+
slots: {
|
|
127
|
+
default: () =>
|
|
128
|
+
h(
|
|
129
|
+
CopilotChatConfigurationProvider,
|
|
130
|
+
{ threadId: "inner-seed", hasExplicitThreadId: false },
|
|
131
|
+
{ default: () => h(Display) },
|
|
132
|
+
),
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
expect(wrapper.find("[data-testid=thread]").text()).toBe("outer-thread");
|
|
137
|
+
});
|
|
138
|
+
|
|
122
139
|
it("creates and mutates modal state when isModalDefaultOpen is provided", async () => {
|
|
123
140
|
const Toggle = defineComponent({
|
|
124
141
|
setup() {
|
|
@@ -398,9 +415,12 @@ describe("CopilotChatConfiguration drawer-awareness", () => {
|
|
|
398
415
|
});
|
|
399
416
|
|
|
400
417
|
describe("CopilotChatConfiguration modal-setter presence contract", () => {
|
|
401
|
-
it("bare provider (no isModalDefaultOpen, no parent)
|
|
418
|
+
it("bare provider (no isModalDefaultOpen, no parent) owns a modal that starts open, like React", async () => {
|
|
402
419
|
const cfg = harness({ threadId: "thread-1" });
|
|
403
|
-
expect(cfg().
|
|
420
|
+
expect(cfg().isModalOpen).toBe(true);
|
|
421
|
+
cfg().setModalOpen?.(false);
|
|
422
|
+
await nextTick();
|
|
423
|
+
expect(cfg().isModalOpen).toBe(false);
|
|
404
424
|
});
|
|
405
425
|
|
|
406
426
|
it("provider with isModalDefaultOpen exposes a working setModalOpen", async () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { defineComponent, h, ref } from "vue";
|
|
2
|
+
import { defineComponent, h, nextTick, ref } from "vue";
|
|
3
3
|
import { mount } from "@vue/test-utils";
|
|
4
|
-
import { z } from "zod";
|
|
4
|
+
import { z } from "zod-v3";
|
|
5
5
|
import { Catalog } from "@a2ui/web_core/v0_9";
|
|
6
6
|
import type { ComponentApi } from "@a2ui/web_core/v0_9";
|
|
7
7
|
import CopilotKitProvider from "../CopilotKitProvider.vue";
|
|
@@ -70,6 +70,24 @@ describe("CopilotKitProvider a2ui catalog auto-enable", () => {
|
|
|
70
70
|
expect(a2uiRenderer).toBeDefined();
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
+
it("keeps the built-in render_a2ui renderer and the app's renderers together when the app's renderers change", async () => {
|
|
74
|
+
const catalog = { id: "test", components: new Map() };
|
|
75
|
+
const weather = { name: "weather", args: z.any(), render: () => null };
|
|
76
|
+
const { wrapper, observedCore } = mountProvider({
|
|
77
|
+
a2ui: { catalog },
|
|
78
|
+
renderToolCalls: [weather],
|
|
79
|
+
});
|
|
80
|
+
const names = () =>
|
|
81
|
+
observedCore.value?.renderToolCalls.map((renderer) => renderer.name);
|
|
82
|
+
expect(names()).toEqual(["weather", "render_a2ui"]);
|
|
83
|
+
|
|
84
|
+
await wrapper.setProps({
|
|
85
|
+
renderToolCalls: [weather, { ...weather, name: "search" }],
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
expect(names()).toEqual(["weather", "search", "render_a2ui"]);
|
|
89
|
+
});
|
|
90
|
+
|
|
73
91
|
it("does not register an a2ui-surface renderer when no catalog is provided and runtime has not signaled a2uiEnabled", () => {
|
|
74
92
|
const { observedCore } = mountProvider({ a2ui: { theme: {} } });
|
|
75
93
|
|
|
@@ -125,4 +143,22 @@ describe("CopilotKitProvider a2ui catalog context", () => {
|
|
|
125
143
|
expect(value).toContain(" - FlightCard:\n {");
|
|
126
144
|
expect(value).toContain('"airline"');
|
|
127
145
|
});
|
|
146
|
+
|
|
147
|
+
it("registers the catalog's components with core for the Inspector", () => {
|
|
148
|
+
const { observedCore } = mountProvider({
|
|
149
|
+
a2ui: { catalog: makeCustomCatalog() },
|
|
150
|
+
});
|
|
151
|
+
expect(
|
|
152
|
+
observedCore.value?.catalogComponents.map((component) => component.name),
|
|
153
|
+
).toEqual(["FlightCard"]);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it("stops advertising a component the Inspector disables", async () => {
|
|
157
|
+
const { observedCore } = mountProvider({
|
|
158
|
+
a2ui: { catalog: makeCustomCatalog() },
|
|
159
|
+
});
|
|
160
|
+
observedCore.value?.setCatalogComponentEnabled("FlightCard", false);
|
|
161
|
+
await nextTick();
|
|
162
|
+
expect(capabilitiesValue(observedCore.value)).not.toContain("FlightCard");
|
|
163
|
+
});
|
|
128
164
|
});
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { createSSRApp } from "vue";
|
|
3
|
+
import { mount } from "@vue/test-utils";
|
|
4
|
+
import { renderToString } from "vue/server-renderer";
|
|
5
|
+
import CopilotKitProvider from "../CopilotKitProvider.vue";
|
|
6
|
+
|
|
7
|
+
const RUNTIME_URL = "https://runtime.example/api/copilotkit";
|
|
8
|
+
const SHAPE_WARNING =
|
|
9
|
+
"renderToolCalls must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.";
|
|
10
|
+
|
|
11
|
+
function stubInfoFetch() {
|
|
12
|
+
const fetchMock = vi.fn(async () => {
|
|
13
|
+
throw new Error("network failure");
|
|
14
|
+
});
|
|
15
|
+
vi.stubGlobal("fetch", fetchMock);
|
|
16
|
+
return () =>
|
|
17
|
+
fetchMock.mock.calls.filter(([url]) => String(url).includes("/info"));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** A tool call renderer shape: only `name` and `agentId` matter here. */
|
|
21
|
+
function renderer(name: string) {
|
|
22
|
+
return { name, args: undefined, render: () => null };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
afterEach(() => {
|
|
26
|
+
vi.unstubAllGlobals();
|
|
27
|
+
vi.restoreAllMocks();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("CopilotKitProvider (Vue) runtime connection", () => {
|
|
31
|
+
it("does not fetch /info during server-side rendering", async () => {
|
|
32
|
+
const infoCalls = stubInfoFetch();
|
|
33
|
+
await renderToString(
|
|
34
|
+
createSSRApp(CopilotKitProvider, { runtimeUrl: RUNTIME_URL }),
|
|
35
|
+
);
|
|
36
|
+
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
37
|
+
expect(infoCalls()).toHaveLength(0);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("fetches /info once the provider mounts", async () => {
|
|
41
|
+
vi.spyOn(console, "error").mockImplementation(() => {});
|
|
42
|
+
const infoCalls = stubInfoFetch();
|
|
43
|
+
const wrapper = mount(CopilotKitProvider, {
|
|
44
|
+
props: { runtimeUrl: RUNTIME_URL },
|
|
45
|
+
});
|
|
46
|
+
await vi.waitFor(() => expect(infoCalls().length).toBeGreaterThan(0));
|
|
47
|
+
wrapper.unmount();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe("CopilotKitProvider (Vue) errors", () => {
|
|
52
|
+
it("logs core errors when no onError is given", async () => {
|
|
53
|
+
stubInfoFetch();
|
|
54
|
+
const error = vi.spyOn(console, "error").mockImplementation(() => {});
|
|
55
|
+
const wrapper = mount(CopilotKitProvider, {
|
|
56
|
+
props: { runtimeUrl: RUNTIME_URL },
|
|
57
|
+
});
|
|
58
|
+
await vi.waitFor(() =>
|
|
59
|
+
expect(error).toHaveBeenCalledWith(
|
|
60
|
+
"[CopilotKit] Error (runtime_info_fetch_failed):",
|
|
61
|
+
expect.any(Error),
|
|
62
|
+
expect.anything(),
|
|
63
|
+
),
|
|
64
|
+
);
|
|
65
|
+
wrapper.unmount();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("reports an invalid defaultThrottleMs once, from core", () => {
|
|
69
|
+
const error = vi.spyOn(console, "error").mockImplementation(() => {});
|
|
70
|
+
const wrapper = mount(CopilotKitProvider, {
|
|
71
|
+
props: { runtimeUrl: RUNTIME_URL, defaultThrottleMs: -1 },
|
|
72
|
+
});
|
|
73
|
+
const providerCopies = error.mock.calls.filter(
|
|
74
|
+
([message]) =>
|
|
75
|
+
typeof message === "string" &&
|
|
76
|
+
message.startsWith("CopilotKitProvider: defaultThrottleMs"),
|
|
77
|
+
);
|
|
78
|
+
const coreReports = error.mock.calls.filter(
|
|
79
|
+
([message]) =>
|
|
80
|
+
typeof message === "string" &&
|
|
81
|
+
message.startsWith("CopilotKitCore.setDefaultThrottleMs"),
|
|
82
|
+
);
|
|
83
|
+
expect(providerCopies).toEqual([]);
|
|
84
|
+
expect(coreReports.length).toBeGreaterThan(0);
|
|
85
|
+
wrapper.unmount();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
describe("CopilotKitProvider (Vue) renderToolCalls warning", () => {
|
|
90
|
+
it("warns when the renderToolCalls shape changes", async () => {
|
|
91
|
+
const error = vi.spyOn(console, "error").mockImplementation(() => {});
|
|
92
|
+
const wrapper = mount(CopilotKitProvider, {
|
|
93
|
+
props: { runtimeUrl: RUNTIME_URL, renderToolCalls: [renderer("a")] },
|
|
94
|
+
});
|
|
95
|
+
await wrapper.setProps({ renderToolCalls: [renderer("b")] });
|
|
96
|
+
expect(error).toHaveBeenCalledWith(SHAPE_WARNING);
|
|
97
|
+
wrapper.unmount();
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("does not warn for a new array with the same tools", async () => {
|
|
101
|
+
const error = vi.spyOn(console, "error").mockImplementation(() => {});
|
|
102
|
+
const wrapper = mount(CopilotKitProvider, {
|
|
103
|
+
props: { runtimeUrl: RUNTIME_URL, renderToolCalls: [renderer("a")] },
|
|
104
|
+
});
|
|
105
|
+
await wrapper.setProps({ renderToolCalls: [renderer("a")] });
|
|
106
|
+
expect(error).not.toHaveBeenCalledWith(SHAPE_WARNING);
|
|
107
|
+
wrapper.unmount();
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
describe("CopilotKitProvider (Vue) config diagnostics", () => {
|
|
112
|
+
it("warns about a missing runtime config once", async () => {
|
|
113
|
+
const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
|
|
114
|
+
const wrapper = mount(CopilotKitProvider, { props: {} });
|
|
115
|
+
await wrapper.setProps({ properties: { tenant: "acme" } });
|
|
116
|
+
const missing = warn.mock.calls.filter(
|
|
117
|
+
([message]) =>
|
|
118
|
+
message ===
|
|
119
|
+
"Missing required prop: 'runtimeUrl' or 'publicApiKey' or 'publicLicenseKey'",
|
|
120
|
+
);
|
|
121
|
+
expect(missing).toHaveLength(1);
|
|
122
|
+
wrapper.unmount();
|
|
123
|
+
});
|
|
124
|
+
});
|
|
@@ -7,12 +7,12 @@ import { mount } from "@vue/test-utils";
|
|
|
7
7
|
import { defineComponent, h, nextTick } from "vue";
|
|
8
8
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
9
9
|
import { HttpAgent } from "@ag-ui/client";
|
|
10
|
+
import { ɵtranscribeAudio } from "@copilotkit/core";
|
|
10
11
|
import type { CopilotKitHeadersSource } from "@copilotkit/core";
|
|
11
12
|
import CopilotKitProvider from "../CopilotKitProvider.vue";
|
|
12
13
|
import { useCopilotKit } from "../useCopilotKit";
|
|
13
14
|
import { useAgent } from "../../hooks/use-agent";
|
|
14
15
|
import { useThreads } from "../../hooks/use-threads";
|
|
15
|
-
import { transcribeAudio } from "../../lib/transcription-client";
|
|
16
16
|
import type { CopilotKitCoreVue } from "../../lib/vue-core";
|
|
17
17
|
|
|
18
18
|
type Call = { url: string; auth: string | null; publicApiKey: string | null };
|
|
@@ -418,14 +418,14 @@ describe("CopilotKitProvider — headers builder evaluated at send time (#1937)"
|
|
|
418
418
|
// Force an actual resolution while signed in, so the header source's
|
|
419
419
|
// last snapshot is non-empty — otherwise a stale-merge bug has nothing
|
|
420
420
|
// stale to leak, and the assertion below would pass vacuously.
|
|
421
|
-
await
|
|
421
|
+
await ɵtranscribeAudio(getCore(), new Blob(["a"], { type: "audio/webm" }));
|
|
422
422
|
const firstCall = calls.find((c) => c.url.endsWith("/transcribe"));
|
|
423
423
|
expect(firstCall?.auth).toBe("Bearer x");
|
|
424
424
|
|
|
425
425
|
calls.length = 0;
|
|
426
426
|
signedIn = false;
|
|
427
427
|
|
|
428
|
-
await
|
|
428
|
+
await ɵtranscribeAudio(getCore(), new Blob(["a"], { type: "audio/webm" }));
|
|
429
429
|
const secondCall = calls.find((c) => c.url.endsWith("/transcribe"));
|
|
430
430
|
expect(secondCall).toBeDefined();
|
|
431
431
|
expect(secondCall!.auth).toBeNull();
|
|
@@ -478,7 +478,9 @@ describe("CopilotKitProvider learning prop", () => {
|
|
|
478
478
|
const app = renderApp(true);
|
|
479
479
|
|
|
480
480
|
await app.unmount();
|
|
481
|
-
|
|
481
|
+
// The learning watcher stops capture, then disposing the core stops
|
|
482
|
+
// it again. Stopping twice is safe; capture must end either way.
|
|
483
|
+
expect(stop).toHaveBeenCalled();
|
|
482
484
|
expect(History.prototype.pushState).toBe(nativePushState);
|
|
483
485
|
});
|
|
484
486
|
|
|
@@ -79,7 +79,10 @@ describe("CopilotKitProvider sandbox functions", () => {
|
|
|
79
79
|
},
|
|
80
80
|
});
|
|
81
81
|
const sandboxContext = findSandboxContext(observedCore.value!.context);
|
|
82
|
-
|
|
82
|
+
// The same model-visible call form React and Angular send.
|
|
83
|
+
expect(sandboxContext?.description).toBe(
|
|
84
|
+
"Sandbox functions available in generated sandboxed UI code. Call via: await Websandbox.connection.remote.<functionName>(args)",
|
|
85
|
+
);
|
|
83
86
|
});
|
|
84
87
|
|
|
85
88
|
it("does not register agent context when sandbox functions are empty", () => {
|
|
@@ -5,11 +5,12 @@ import {
|
|
|
5
5
|
createSSRApp,
|
|
6
6
|
defineComponent,
|
|
7
7
|
h,
|
|
8
|
+
inject,
|
|
8
9
|
nextTick,
|
|
9
10
|
ref,
|
|
10
11
|
watchEffect,
|
|
11
12
|
} from "vue";
|
|
12
|
-
import type { VNode } from "vue";
|
|
13
|
+
import type { ComputedRef, VNode } from "vue";
|
|
13
14
|
import { renderToString } from "vue/server-renderer";
|
|
14
15
|
import type {
|
|
15
16
|
CopilotKitCoreSubscriber,
|
|
@@ -23,6 +24,7 @@ import { defineWebInspector } from "@copilotkit/web-inspector";
|
|
|
23
24
|
import { z } from "zod";
|
|
24
25
|
import CopilotKitProvider from "../CopilotKitProvider.vue";
|
|
25
26
|
import { useCopilotKit } from "../useCopilotKit";
|
|
27
|
+
import { InspectorKey } from "../keys";
|
|
26
28
|
import type { VueFrontendTool } from "../../types";
|
|
27
29
|
import type { VueHumanInTheLoop } from "../../types";
|
|
28
30
|
import { mountWithProvider } from "../../__tests__/utils/mount";
|
|
@@ -320,7 +322,7 @@ describe("CopilotKitProvider", () => {
|
|
|
320
322
|
expect(renderTool?.render).toStrictEqual(TestComponent);
|
|
321
323
|
});
|
|
322
324
|
|
|
323
|
-
it("
|
|
325
|
+
it("scopes frontendTools-derived render entries by agentId, like useFrontendTool", () => {
|
|
324
326
|
const TestComponent = defineComponent({
|
|
325
327
|
setup() {
|
|
326
328
|
return () => h("div", "Test");
|
|
@@ -342,7 +344,7 @@ describe("CopilotKitProvider", () => {
|
|
|
342
344
|
);
|
|
343
345
|
|
|
344
346
|
expect(renderTool).toBeDefined();
|
|
345
|
-
expect(renderTool?.agentId).
|
|
347
|
+
expect(renderTool?.agentId).toBe("specific-agent");
|
|
346
348
|
});
|
|
347
349
|
});
|
|
348
350
|
|
|
@@ -409,6 +411,39 @@ describe("CopilotKitProvider", () => {
|
|
|
409
411
|
expect(typeof renderTool?.render).toBe("function");
|
|
410
412
|
});
|
|
411
413
|
|
|
414
|
+
it("keeps the wrapped render and the tools when only renderToolCalls changes", async () => {
|
|
415
|
+
// A new wrapper is a new component type, so Vue would remount the card
|
|
416
|
+
// and lose its state.
|
|
417
|
+
const humanInTheLoop: VueHumanInTheLoop[] = [
|
|
418
|
+
{
|
|
419
|
+
name: "approvalTool",
|
|
420
|
+
parameters: z.object({}),
|
|
421
|
+
render: HitlComponent,
|
|
422
|
+
},
|
|
423
|
+
];
|
|
424
|
+
const weather = () => [
|
|
425
|
+
{ name: "weather", args: z.any(), render: HitlComponent },
|
|
426
|
+
];
|
|
427
|
+
const { wrapper, getCore } = mountWithProvider(() => h("div"), {
|
|
428
|
+
humanInTheLoop,
|
|
429
|
+
renderToolCalls: weather(),
|
|
430
|
+
});
|
|
431
|
+
const approveRender = () =>
|
|
432
|
+
getCore().renderToolCalls.find((rc) => rc.name === "approvalTool")
|
|
433
|
+
?.render;
|
|
434
|
+
const before = approveRender();
|
|
435
|
+
const setTools = vi.spyOn(getCore(), "setTools");
|
|
436
|
+
|
|
437
|
+
await wrapper.setProps({ renderToolCalls: weather() });
|
|
438
|
+
await flush();
|
|
439
|
+
|
|
440
|
+
expect(getCore().renderToolCalls.map((rc) => rc.name)).toContain(
|
|
441
|
+
"weather",
|
|
442
|
+
);
|
|
443
|
+
expect(approveRender()).toBe(before);
|
|
444
|
+
expect(setTools).not.toHaveBeenCalled();
|
|
445
|
+
});
|
|
446
|
+
|
|
412
447
|
it("keeps the tool call pending until respond is called", async () => {
|
|
413
448
|
// Reproduces OSS-803: the handler used to warn and resolve undefined
|
|
414
449
|
// immediately, so the HITL UI flashed and disappeared instead of waiting
|
|
@@ -810,6 +845,23 @@ describe("CopilotKitProvider", () => {
|
|
|
810
845
|
});
|
|
811
846
|
});
|
|
812
847
|
|
|
848
|
+
describe("Unmount", () => {
|
|
849
|
+
it("disposes the core it created, so subscribers stop hearing from it", () => {
|
|
850
|
+
const { getCore, wrapper } = mountWithProvider(() => h("div"));
|
|
851
|
+
const core = getCore();
|
|
852
|
+
const onPropertiesChanged = vi.fn();
|
|
853
|
+
core.subscribe({ onPropertiesChanged });
|
|
854
|
+
|
|
855
|
+
core.setProperties({ before: "unmount" });
|
|
856
|
+
expect(onPropertiesChanged).toHaveBeenCalledTimes(1);
|
|
857
|
+
|
|
858
|
+
wrapper.unmount();
|
|
859
|
+
core.setProperties({ after: "unmount" });
|
|
860
|
+
|
|
861
|
+
expect(onPropertiesChanged).toHaveBeenCalledTimes(1);
|
|
862
|
+
});
|
|
863
|
+
});
|
|
864
|
+
|
|
813
865
|
describe("inspector visibility", () => {
|
|
814
866
|
async function settleInspectorLoad(): Promise<void> {
|
|
815
867
|
await vi.dynamicImportSettled();
|
|
@@ -821,7 +873,7 @@ describe("CopilotKitProvider", () => {
|
|
|
821
873
|
vi.stubEnv("NODE_ENV", "development");
|
|
822
874
|
});
|
|
823
875
|
|
|
824
|
-
it("renders by default on
|
|
876
|
+
it("renders by default on a loopback development host and passes the provider core before connection", async () => {
|
|
825
877
|
let providerCore: CopilotKitCoreContextValue | null = null;
|
|
826
878
|
const Probe = defineComponent({
|
|
827
879
|
setup() {
|
|
@@ -855,12 +907,10 @@ describe("CopilotKitProvider", () => {
|
|
|
855
907
|
view.unmount();
|
|
856
908
|
});
|
|
857
909
|
|
|
858
|
-
it("
|
|
910
|
+
it("never renders or loads on a remote development host, even when explicitly enabled", async () => {
|
|
911
|
+
vi.stubGlobal("location", new URL("http://192.168.1.25:3000"));
|
|
859
912
|
const view = render(CopilotKitProvider, {
|
|
860
|
-
props: {
|
|
861
|
-
runtimeUrl: "/api/copilotkit",
|
|
862
|
-
enableInspector: false,
|
|
863
|
-
},
|
|
913
|
+
props: { runtimeUrl: "/api/copilotkit", enableInspector: true },
|
|
864
914
|
slots: { default: "child" },
|
|
865
915
|
});
|
|
866
916
|
|
|
@@ -870,45 +920,55 @@ describe("CopilotKitProvider", () => {
|
|
|
870
920
|
view.unmount();
|
|
871
921
|
});
|
|
872
922
|
|
|
873
|
-
it("
|
|
874
|
-
|
|
875
|
-
const
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
923
|
+
it("enables Inspector message actions only while the Inspector is shown", async () => {
|
|
924
|
+
let isInspectorEnabled: ComputedRef<boolean> | undefined;
|
|
925
|
+
const Probe = defineComponent({
|
|
926
|
+
setup() {
|
|
927
|
+
isInspectorEnabled = inject(InspectorKey)?.isInspectorEnabled;
|
|
928
|
+
return () => null;
|
|
879
929
|
},
|
|
880
|
-
|
|
930
|
+
});
|
|
931
|
+
const view = render(CopilotKitProvider, {
|
|
932
|
+
props: { runtimeUrl: "/api/copilotkit" },
|
|
933
|
+
slots: { default: Probe },
|
|
881
934
|
});
|
|
882
935
|
|
|
883
|
-
await
|
|
884
|
-
|
|
885
|
-
|
|
936
|
+
await waitFor(() => {
|
|
937
|
+
expect(isInspectorEnabled?.value).toBe(true);
|
|
938
|
+
});
|
|
939
|
+
const inspector = view.container.querySelector("cpk-web-inspector")!;
|
|
940
|
+
inspector.dispatchEvent(
|
|
941
|
+
new CustomEvent("cpk-inspector-visibility-change", {
|
|
942
|
+
detail: { visible: false },
|
|
943
|
+
}),
|
|
944
|
+
);
|
|
945
|
+
await nextTick();
|
|
946
|
+
expect(isInspectorEnabled?.value).toBe(false);
|
|
947
|
+
expect(inspector.isConnected).toBe(true);
|
|
886
948
|
view.unmount();
|
|
887
949
|
});
|
|
888
950
|
|
|
889
|
-
it("does not
|
|
951
|
+
it("does not render or load when explicitly disabled in development", async () => {
|
|
890
952
|
const view = render(CopilotKitProvider, {
|
|
891
953
|
props: {
|
|
892
954
|
runtimeUrl: "/api/copilotkit",
|
|
893
|
-
|
|
955
|
+
enableInspector: false,
|
|
894
956
|
},
|
|
895
957
|
slots: { default: "child" },
|
|
896
958
|
});
|
|
897
959
|
|
|
898
|
-
await
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
).not.toBeNull();
|
|
902
|
-
});
|
|
960
|
+
await settleInspectorLoad();
|
|
961
|
+
expect(view.container.querySelector("cpk-web-inspector")).toBeNull();
|
|
962
|
+
expect(defineWebInspector).not.toHaveBeenCalled();
|
|
903
963
|
view.unmount();
|
|
904
964
|
});
|
|
905
965
|
|
|
906
|
-
it("
|
|
966
|
+
it("never renders or loads in production, even when explicitly enabled", async () => {
|
|
907
967
|
vi.stubEnv("NODE_ENV", "production");
|
|
908
968
|
const view = render(CopilotKitProvider, {
|
|
909
969
|
props: {
|
|
910
970
|
runtimeUrl: "/api/copilotkit",
|
|
911
|
-
|
|
971
|
+
enableInspector: true,
|
|
912
972
|
},
|
|
913
973
|
slots: { default: "child" },
|
|
914
974
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InjectionKey } from "vue";
|
|
2
|
+
import type { ɵChatConfigurationStore } from "@copilotkit/core";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The nearest `CopilotChatConfigurationProvider`'s core store, so a nested
|
|
6
|
+
* provider can link its own store to it.
|
|
7
|
+
*/
|
|
8
|
+
export const ChatConfigurationStoreKey: InjectionKey<ɵChatConfigurationStore> =
|
|
9
|
+
Symbol("CopilotChatConfigurationStore");
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { inject } from "vue";
|
|
2
2
|
import type { Component, InjectionKey } from "vue";
|
|
3
|
-
import type {
|
|
4
|
-
|
|
3
|
+
import type {
|
|
4
|
+
VueStreamingMarkdownCitationClickHandler,
|
|
5
|
+
VueStreamingMarkdownLinkClickHandler,
|
|
6
|
+
VueStreamingMarkdownNodeRenderers,
|
|
7
|
+
} from "@copilotkit/markdown/vue";
|
|
8
|
+
import type { StreamingMarkdownParserOptions } from "@copilotkit/markdown";
|
|
5
9
|
|
|
6
10
|
/** Config for the built-in Vue default renderer (pass instead of a component). */
|
|
7
11
|
export interface DefaultMarkdownRendererProps {
|
|
@@ -9,6 +13,8 @@ export interface DefaultMarkdownRendererProps {
|
|
|
9
13
|
caret?: boolean;
|
|
10
14
|
options?: Partial<StreamingMarkdownParserOptions>;
|
|
11
15
|
class?: string;
|
|
16
|
+
onLinkClick?: VueStreamingMarkdownLinkClickHandler;
|
|
17
|
+
onCitationClick?: VueStreamingMarkdownCitationClickHandler;
|
|
12
18
|
}
|
|
13
19
|
|
|
14
20
|
export type MarkdownRendererValue = Component | DefaultMarkdownRendererProps;
|
|
@@ -1,53 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
chatInputPlaceholder: "Type a message...",
|
|
3
|
-
chatInputToolbarStartTranscribeButtonLabel: "Transcribe",
|
|
4
|
-
chatInputToolbarCancelTranscribeButtonLabel: "Cancel",
|
|
5
|
-
chatInputToolbarFinishTranscribeButtonLabel: "Finish",
|
|
6
|
-
chatInputToolbarAddButtonLabel: "Add photos or files",
|
|
7
|
-
chatInputToolbarToolsButtonLabel: "Tools",
|
|
8
|
-
chatInputToolbarSendButtonLabel: "Send message",
|
|
9
|
-
chatInputToolbarStopButtonLabel: "Stop",
|
|
10
|
-
assistantMessageToolbarCopyCodeLabel: "Copy",
|
|
11
|
-
assistantMessageToolbarCopyCodeCopiedLabel: "Copied",
|
|
12
|
-
assistantMessageToolbarCopyMessageLabel: "Copy",
|
|
13
|
-
assistantMessageToolbarInspectorLabel: "View in Inspector",
|
|
14
|
-
assistantMessageToolbarInspectorDescription:
|
|
15
|
-
"Open this message in the Inspector",
|
|
16
|
-
assistantMessageToolbarInspectorLocalOnlyLabel: "Local only",
|
|
17
|
-
assistantMessageToolbarInspectorLocalOnlyDescription:
|
|
18
|
-
"Only visible on localhost or loopback hosts in development. Never shown in production.",
|
|
19
|
-
assistantMessageToolbarInspectorTitle: "CopilotKit Inspector",
|
|
20
|
-
assistantMessageToolbarInspectorHideLabel: "Hide this icon",
|
|
21
|
-
assistantMessageToolbarInspectorHideDescription: "Until you reload this page",
|
|
22
|
-
assistantMessageToolbarThumbsUpLabel: "Good response",
|
|
23
|
-
assistantMessageToolbarThumbsDownLabel: "Bad response",
|
|
24
|
-
assistantMessageFeedbackCommentPlaceholder: "Add a comment (optional)",
|
|
25
|
-
assistantMessageFeedbackCommentSubmitLabel: "Send comment",
|
|
26
|
-
assistantMessageToolbarReadAloudLabel: "Read aloud",
|
|
27
|
-
assistantMessageToolbarRegenerateLabel: "Regenerate",
|
|
28
|
-
userMessageToolbarCopyMessageLabel: "Copy",
|
|
29
|
-
userMessageToolbarEditMessageLabel: "Edit",
|
|
30
|
-
userMessageToolbarPreviousBranchLabel: "Previous branch",
|
|
31
|
-
userMessageToolbarNextBranchLabel: "Next branch",
|
|
32
|
-
chatDisclaimerText:
|
|
33
|
-
"AI can make mistakes. Please verify important information.",
|
|
34
|
-
chatToggleOpenLabel: "Open chat",
|
|
35
|
-
chatToggleCloseLabel: "Close chat",
|
|
36
|
-
chatScrollToBottomLabel: "Scroll to bottom",
|
|
37
|
-
modalHeaderTitle: "CopilotKit Chat",
|
|
38
|
-
welcomeMessageText: "How can I help you today?",
|
|
39
|
-
reasoningMessageThinkingLabel: "Thinking…",
|
|
40
|
-
chatInputSlashMenuLabel: "Slash commands",
|
|
41
|
-
chatInputSlashMenuEmptyText: "No commands found",
|
|
42
|
-
attachmentRemoveButtonLabel: "Remove attachment",
|
|
43
|
-
attachmentPlayVideoButtonLabel: "Play video",
|
|
44
|
-
attachmentPreviewCloseButtonLabel: "Close preview",
|
|
45
|
-
modalHeaderCloseButtonLabel: "Close",
|
|
46
|
-
modalHeaderThreadsButtonLabel: "Open threads",
|
|
47
|
-
sidebarLabel: "Copilot chat sidebar",
|
|
48
|
-
} as const;
|
|
1
|
+
import type { CopilotChatLabels } from "@copilotkit/core";
|
|
49
2
|
|
|
50
|
-
export
|
|
3
|
+
export { CopilotChatDefaultLabels } from "@copilotkit/core";
|
|
4
|
+
export type { CopilotChatLabels } from "@copilotkit/core";
|
|
51
5
|
|
|
52
6
|
export interface CopilotChatConfigurationValue {
|
|
53
7
|
labels: CopilotChatLabels;
|