@copilotkit/vue 2.0.0-rc.2 → 2.0.0-rc.21
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 +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-BAhbpSDh.js +16200 -0
- package/dist/use-render-activity-message-BAhbpSDh.js.map +1 -0
- package/dist/use-render-activity-message-DJ6q1qHV.cjs +114 -0
- package/dist/use-render-activity-message-DJ6q1qHV.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 +0 -5
- 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 +6 -270
- 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 +3 -3
- 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 +18 -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.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-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-threads.d.ts +0 -8
- 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 +12 -12
- 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/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 +10 -11
- package/src/__tests__/build-entries.test.ts +27 -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 +2 -7
- 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 +147 -356
- package/src/v2/components/chat/CopilotChatAssistantMessage.vue +19 -43
- 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 +2 -2
- package/src/v2/components/chat/CopilotChatInput.vue +108 -436
- 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 +82 -210
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +7 -15
- 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 +33 -28
- 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 +35 -131
- 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 +38 -59
- package/src/v2/components/chat/CopilotThreadsDrawer.vue +37 -102
- 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 +89 -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__/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 +24 -89
- 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 +62 -197
- 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 +28 -218
- package/src/v2/hooks/use-default-render-tool.ts +34 -94
- package/src/v2/hooks/use-frontend-tool.ts +10 -10
- 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 +31 -55
- package/src/v2/hooks/use-render-custom-messages.ts +24 -88
- package/src/v2/hooks/use-suggestions.ts +9 -33
- package/src/v2/hooks/use-threads.ts +43 -273
- 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 +69 -78
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +48 -186
- package/src/v2/providers/CopilotKitProvider.types.ts +12 -132
- package/src/v2/providers/CopilotKitProvider.vue +237 -510
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.ts +22 -2
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +20 -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 +53 -26
- 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 +5 -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 -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";
|
|
@@ -125,4 +125,22 @@ describe("CopilotKitProvider a2ui catalog context", () => {
|
|
|
125
125
|
expect(value).toContain(" - FlightCard:\n {");
|
|
126
126
|
expect(value).toContain('"airline"');
|
|
127
127
|
});
|
|
128
|
+
|
|
129
|
+
it("registers the catalog's components with core for the Inspector", () => {
|
|
130
|
+
const { observedCore } = mountProvider({
|
|
131
|
+
a2ui: { catalog: makeCustomCatalog() },
|
|
132
|
+
});
|
|
133
|
+
expect(
|
|
134
|
+
observedCore.value?.catalogComponents.map((component) => component.name),
|
|
135
|
+
).toEqual(["FlightCard"]);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("stops advertising a component the Inspector disables", async () => {
|
|
139
|
+
const { observedCore } = mountProvider({
|
|
140
|
+
a2ui: { catalog: makeCustomCatalog() },
|
|
141
|
+
});
|
|
142
|
+
observedCore.value?.setCatalogComponentEnabled("FlightCard", false);
|
|
143
|
+
await nextTick();
|
|
144
|
+
expect(capabilitiesValue(observedCore.value)).not.toContain("FlightCard");
|
|
145
|
+
});
|
|
128
146
|
});
|
|
@@ -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";
|
|
@@ -810,6 +812,23 @@ describe("CopilotKitProvider", () => {
|
|
|
810
812
|
});
|
|
811
813
|
});
|
|
812
814
|
|
|
815
|
+
describe("Unmount", () => {
|
|
816
|
+
it("disposes the core it created, so subscribers stop hearing from it", () => {
|
|
817
|
+
const { getCore, wrapper } = mountWithProvider(() => h("div"));
|
|
818
|
+
const core = getCore();
|
|
819
|
+
const onPropertiesChanged = vi.fn();
|
|
820
|
+
core.subscribe({ onPropertiesChanged });
|
|
821
|
+
|
|
822
|
+
core.setProperties({ before: "unmount" });
|
|
823
|
+
expect(onPropertiesChanged).toHaveBeenCalledTimes(1);
|
|
824
|
+
|
|
825
|
+
wrapper.unmount();
|
|
826
|
+
core.setProperties({ after: "unmount" });
|
|
827
|
+
|
|
828
|
+
expect(onPropertiesChanged).toHaveBeenCalledTimes(1);
|
|
829
|
+
});
|
|
830
|
+
});
|
|
831
|
+
|
|
813
832
|
describe("inspector visibility", () => {
|
|
814
833
|
async function settleInspectorLoad(): Promise<void> {
|
|
815
834
|
await vi.dynamicImportSettled();
|
|
@@ -821,7 +840,7 @@ describe("CopilotKitProvider", () => {
|
|
|
821
840
|
vi.stubEnv("NODE_ENV", "development");
|
|
822
841
|
});
|
|
823
842
|
|
|
824
|
-
it("renders by default on
|
|
843
|
+
it("renders by default on a loopback development host and passes the provider core before connection", async () => {
|
|
825
844
|
let providerCore: CopilotKitCoreContextValue | null = null;
|
|
826
845
|
const Probe = defineComponent({
|
|
827
846
|
setup() {
|
|
@@ -855,12 +874,10 @@ describe("CopilotKitProvider", () => {
|
|
|
855
874
|
view.unmount();
|
|
856
875
|
});
|
|
857
876
|
|
|
858
|
-
it("
|
|
877
|
+
it("never renders or loads on a remote development host, even when explicitly enabled", async () => {
|
|
878
|
+
vi.stubGlobal("location", new URL("http://192.168.1.25:3000"));
|
|
859
879
|
const view = render(CopilotKitProvider, {
|
|
860
|
-
props: {
|
|
861
|
-
runtimeUrl: "/api/copilotkit",
|
|
862
|
-
enableInspector: false,
|
|
863
|
-
},
|
|
880
|
+
props: { runtimeUrl: "/api/copilotkit", enableInspector: true },
|
|
864
881
|
slots: { default: "child" },
|
|
865
882
|
});
|
|
866
883
|
|
|
@@ -870,45 +887,55 @@ describe("CopilotKitProvider", () => {
|
|
|
870
887
|
view.unmount();
|
|
871
888
|
});
|
|
872
889
|
|
|
873
|
-
it("
|
|
874
|
-
|
|
875
|
-
const
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
890
|
+
it("enables Inspector message actions only while the Inspector is shown", async () => {
|
|
891
|
+
let isInspectorEnabled: ComputedRef<boolean> | undefined;
|
|
892
|
+
const Probe = defineComponent({
|
|
893
|
+
setup() {
|
|
894
|
+
isInspectorEnabled = inject(InspectorKey)?.isInspectorEnabled;
|
|
895
|
+
return () => null;
|
|
879
896
|
},
|
|
880
|
-
|
|
897
|
+
});
|
|
898
|
+
const view = render(CopilotKitProvider, {
|
|
899
|
+
props: { runtimeUrl: "/api/copilotkit" },
|
|
900
|
+
slots: { default: Probe },
|
|
881
901
|
});
|
|
882
902
|
|
|
883
|
-
await
|
|
884
|
-
|
|
885
|
-
|
|
903
|
+
await waitFor(() => {
|
|
904
|
+
expect(isInspectorEnabled?.value).toBe(true);
|
|
905
|
+
});
|
|
906
|
+
const inspector = view.container.querySelector("cpk-web-inspector")!;
|
|
907
|
+
inspector.dispatchEvent(
|
|
908
|
+
new CustomEvent("cpk-inspector-visibility-change", {
|
|
909
|
+
detail: { visible: false },
|
|
910
|
+
}),
|
|
911
|
+
);
|
|
912
|
+
await nextTick();
|
|
913
|
+
expect(isInspectorEnabled?.value).toBe(false);
|
|
914
|
+
expect(inspector.isConnected).toBe(true);
|
|
886
915
|
view.unmount();
|
|
887
916
|
});
|
|
888
917
|
|
|
889
|
-
it("does not
|
|
918
|
+
it("does not render or load when explicitly disabled in development", async () => {
|
|
890
919
|
const view = render(CopilotKitProvider, {
|
|
891
920
|
props: {
|
|
892
921
|
runtimeUrl: "/api/copilotkit",
|
|
893
|
-
|
|
922
|
+
enableInspector: false,
|
|
894
923
|
},
|
|
895
924
|
slots: { default: "child" },
|
|
896
925
|
});
|
|
897
926
|
|
|
898
|
-
await
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
).not.toBeNull();
|
|
902
|
-
});
|
|
927
|
+
await settleInspectorLoad();
|
|
928
|
+
expect(view.container.querySelector("cpk-web-inspector")).toBeNull();
|
|
929
|
+
expect(defineWebInspector).not.toHaveBeenCalled();
|
|
903
930
|
view.unmount();
|
|
904
931
|
});
|
|
905
932
|
|
|
906
|
-
it("
|
|
933
|
+
it("never renders or loads in production, even when explicitly enabled", async () => {
|
|
907
934
|
vi.stubEnv("NODE_ENV", "production");
|
|
908
935
|
const view = render(CopilotKitProvider, {
|
|
909
936
|
props: {
|
|
910
937
|
runtimeUrl: "/api/copilotkit",
|
|
911
|
-
|
|
938
|
+
enableInspector: true,
|
|
912
939
|
},
|
|
913
940
|
slots: { default: "child" },
|
|
914
941
|
});
|
|
@@ -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;
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import { computed, onBeforeUnmount,
|
|
1
|
+
import { computed, onBeforeUnmount, shallowRef, watch } from "vue";
|
|
2
2
|
import type { Ref } from "vue";
|
|
3
|
-
import {
|
|
4
|
-
emitInspectorActiveThread,
|
|
5
|
-
emitInspectorViewThreadResult,
|
|
6
|
-
isInspectorThreadBridgeEnabled,
|
|
7
|
-
onInspectorStopViewing,
|
|
8
|
-
onInspectorViewThread,
|
|
9
|
-
} from "@copilotkit/core";
|
|
10
|
-
|
|
11
|
-
type InspectorOverride = {
|
|
12
|
-
requestId: string;
|
|
13
|
-
threadId: string;
|
|
14
|
-
agentId: string;
|
|
15
|
-
previousThreadId: string;
|
|
16
|
-
};
|
|
3
|
+
import { ɵInspectorThreadOverride } from "@copilotkit/core";
|
|
17
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Apply the Inspector's "view this thread" requests to a chat. Core's
|
|
7
|
+
* `ɵInspectorThreadOverride` owns the state machine; this composable binds it
|
|
8
|
+
* to the component's lifetime and Vue reactivity.
|
|
9
|
+
*/
|
|
18
10
|
export function useInspectorThreadOverride(args: {
|
|
19
11
|
agentId: Ref<string>;
|
|
20
12
|
baseThreadId: Ref<string>;
|
|
@@ -23,77 +15,27 @@ export function useInspectorThreadOverride(args: {
|
|
|
23
15
|
inspectorRequestId: Ref<string | null>;
|
|
24
16
|
failInspectorOverride: (requestId: string) => void;
|
|
25
17
|
} {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
) => {
|
|
32
|
-
override.value =
|
|
33
|
-
|
|
34
|
-
requestId: current.requestId,
|
|
35
|
-
threadId: nextThreadId,
|
|
36
|
-
agentId: current.agentId,
|
|
37
|
-
source: "app",
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const failInspectorOverride = (requestId: string) => {
|
|
42
|
-
const current = override.value;
|
|
43
|
-
if (!current || current.requestId !== requestId) return;
|
|
44
|
-
emitInspectorViewThreadResult({
|
|
45
|
-
requestId,
|
|
46
|
-
threadId: current.threadId,
|
|
47
|
-
agentId: current.agentId,
|
|
48
|
-
ok: false,
|
|
49
|
-
reason: "connect-failed",
|
|
50
|
-
});
|
|
51
|
-
restoreOverride(current, current.previousThreadId);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
if (isInspectorThreadBridgeEnabled()) {
|
|
55
|
-
const offView = onInspectorViewThread((payload) => {
|
|
56
|
-
if (payload.agentId !== args.agentId.value) return false;
|
|
57
|
-
override.value = override.value
|
|
58
|
-
? { ...override.value, ...payload }
|
|
59
|
-
: {
|
|
60
|
-
...payload,
|
|
61
|
-
previousThreadId: args.baseThreadId.value,
|
|
62
|
-
};
|
|
63
|
-
emitInspectorViewThreadResult({ ...payload, ok: true });
|
|
64
|
-
emitInspectorActiveThread({ ...payload, source: "override" });
|
|
65
|
-
return true;
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const offStop = onInspectorStopViewing((payload) => {
|
|
69
|
-
const current = override.value;
|
|
70
|
-
if (!current) return;
|
|
71
|
-
if (payload.requestId !== current.requestId) return;
|
|
72
|
-
if (payload.agentId !== current.agentId) return;
|
|
73
|
-
restoreOverride(current, current.previousThreadId);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
onBeforeUnmount(() => {
|
|
77
|
-
offView();
|
|
78
|
-
offStop();
|
|
79
|
-
});
|
|
80
|
-
}
|
|
18
|
+
const controller = new ɵInspectorThreadOverride({
|
|
19
|
+
agentId: args.agentId.value,
|
|
20
|
+
baseThreadId: args.baseThreadId.value,
|
|
21
|
+
});
|
|
22
|
+
const override = shallowRef(controller.getSnapshot());
|
|
23
|
+
const unsubscribe = controller.subscribe(() => {
|
|
24
|
+
override.value = controller.getSnapshot();
|
|
25
|
+
});
|
|
81
26
|
|
|
82
27
|
watch([args.agentId, args.baseThreadId], ([agentId, baseThreadId]) => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (baseThreadId === current.previousThreadId) return;
|
|
90
|
-
if (baseThreadId === current.threadId) return;
|
|
91
|
-
restoreOverride(current, baseThreadId);
|
|
28
|
+
controller.update({ agentId, baseThreadId });
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
onBeforeUnmount(() => {
|
|
32
|
+
unsubscribe();
|
|
33
|
+
controller.dispose();
|
|
92
34
|
});
|
|
93
35
|
|
|
94
36
|
return {
|
|
95
37
|
inspectorThreadId: computed(() => override.value?.threadId ?? null),
|
|
96
38
|
inspectorRequestId: computed(() => override.value?.requestId ?? null),
|
|
97
|
-
failInspectorOverride,
|
|
39
|
+
failInspectorOverride: controller.fail,
|
|
98
40
|
};
|
|
99
41
|
}
|