@copilotkit/vue 2.0.0-rc.1 → 2.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PARITY.md +13 -12
- package/README.md +1 -2
- package/dist/components/copilot-provider/CopilotKit.vue.d.ts +3 -1
- package/dist/components/copilot-provider/CopilotKit.vue.d.ts.map +1 -1
- package/dist/hooks/use-copilot-action.d.ts.map +1 -1
- package/dist/hooks/use-frontend-tool.d.ts +1 -1
- package/dist/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/hooks/zod-parameters.d.ts +14 -0
- package/dist/hooks/zod-parameters.d.ts.map +1 -0
- package/dist/index.cjs +1 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +384 -14275
- package/dist/index.mjs.map +1 -1
- package/dist/use-render-activity-message-CTR_ziWV.js +18097 -0
- package/dist/use-render-activity-message-CTR_ziWV.js.map +1 -0
- package/dist/use-render-activity-message-Dky9_GRG.cjs +92 -0
- package/dist/use-render-activity-message-Dky9_GRG.cjs.map +1 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts +7 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -1
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -1
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +13 -45
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +11 -2
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +144 -0
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -0
- package/dist/v2/components/a2ui.d.ts +3 -7
- package/dist/v2/components/a2ui.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChat.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts +3 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantToolbarButton.vue.d.ts +16 -0
- package/dist/v2/components/chat/CopilotChatAssistantToolbarButton.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts +22 -0
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +21 -232
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts +12 -0
- package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts +22 -0
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +20 -0
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatSuggestionPill.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatSuggestionView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToggleButton.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts +32 -0
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +11 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts +5 -0
- package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeaderTitle.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupWelcomeScreen.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +2 -0
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +2 -0
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +2 -0
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarWelcomeScreen.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +0 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
- package/dist/v2/components/chat/index.d.ts +17 -1
- package/dist/v2/components/chat/index.d.ts.map +1 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts +12 -0
- package/dist/v2/components/chat/inspector-shortcuts.d.ts.map +1 -0
- package/dist/v2/components/chat/message-feedback.d.ts +89 -0
- package/dist/v2/components/chat/message-feedback.d.ts.map +1 -0
- package/dist/v2/components/chat/tool-call-capture.d.ts +39 -0
- package/dist/v2/components/chat/tool-call-capture.d.ts.map +1 -0
- package/dist/v2/components/chat/tool-call-display-context.d.ts +22 -0
- package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -0
- package/dist/v2/components/chat/tool-call-group-parts.d.ts +131 -0
- package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -0
- package/dist/v2/components/chat/turn-work.d.ts +33 -0
- package/dist/v2/components/chat/turn-work.d.ts.map +1 -0
- package/dist/v2/components/chat/types.d.ts +104 -5
- package/dist/v2/components/chat/types.d.ts.map +1 -1
- package/dist/v2/components/chat/use-chat-labels.d.ts +8 -0
- package/dist/v2/components/chat/use-chat-labels.d.ts.map +1 -0
- package/dist/v2/components/chat/use-lightbox.d.ts +18 -0
- package/dist/v2/components/chat/use-lightbox.d.ts.map +1 -0
- package/dist/v2/components/icons/index.d.ts +968 -1
- package/dist/v2/components/icons/index.d.ts.map +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts +55 -0
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts.map +1 -0
- package/dist/v2/components/ui/CopilotPopover.vue.d.ts +40 -0
- package/dist/v2/components/ui/CopilotPopover.vue.d.ts.map +1 -0
- package/dist/v2/components/ui/CopilotTooltip.vue.d.ts +37 -0
- package/dist/v2/components/ui/CopilotTooltip.vue.d.ts.map +1 -0
- package/dist/v2/components/ui/dropdown-menu.d.ts +14 -0
- package/dist/v2/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/v2/components/ui/floating.d.ts +84 -0
- package/dist/v2/components/ui/floating.d.ts.map +1 -0
- package/dist/v2/components/ui/presence.d.ts +9 -0
- package/dist/v2/components/ui/presence.d.ts.map +1 -0
- package/dist/v2/components/ui/use-id.d.ts +9 -0
- package/dist/v2/components/ui/use-id.d.ts.map +1 -0
- package/dist/v2/hooks/use-default-render-tool.d.ts +6 -0
- package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-frontend-tool.d.ts +5 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-activity-message.d.ts +13 -9
- package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-custom-messages.d.ts +5 -7
- package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-tool.d.ts +4 -0
- package/dist/v2/hooks/use-render-tool.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.d.cts +3 -0
- package/dist/v2/index.d.mts +3 -0
- package/dist/v2/index.d.ts +3 -0
- package/dist/v2/index.d.ts.map +1 -1
- package/dist/v2/index.mjs +197 -197
- package/dist/v2/index.mjs.map +1 -1
- package/dist/v2/lib/message-feedback.d.ts +33 -0
- package/dist/v2/lib/message-feedback.d.ts.map +1 -0
- package/dist/v2/lib/processPartialHtml.d.ts +1 -2
- package/dist/v2/lib/processPartialHtml.d.ts.map +1 -1
- package/dist/v2/lib/vue-core.d.ts +0 -1
- package/dist/v2/lib/vue-core.d.ts.map +1 -1
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +56 -6
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +6 -2
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/index.d.ts +1 -1
- package/dist/v2/providers/index.d.ts.map +1 -1
- package/dist/v2/providers/keys.d.ts +8 -0
- package/dist/v2/providers/keys.d.ts.map +1 -1
- package/dist/v2/providers/types.d.ts +3 -37
- package/dist/v2/providers/types.d.ts.map +1 -1
- package/dist/v2/styles/CopilotKitStyles.d.ts +18 -0
- package/dist/v2/styles/CopilotKitStyles.d.ts.map +1 -0
- package/dist/v2/types/defineToolCallRenderer.d.ts +2 -0
- package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/types/human-in-the-loop.d.ts +8 -29
- package/dist/v2/types/human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/types/interrupt.d.ts +1 -22
- package/dist/v2/types/interrupt.d.ts.map +1 -1
- package/dist/v2/types/vue-activity-message-renderer.d.ts +16 -15
- package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-custom-message-renderer.d.ts +7 -16
- package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-tool-call-renderer.d.ts +16 -28
- package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
- package/package.json +14 -27
- package/src/__tests__/build-entries.test.ts +27 -0
- package/src/components/copilot-provider/CopilotKit.vue +4 -1
- package/src/hooks/__tests__/zod-parameters.test.ts +520 -0
- package/src/hooks/use-copilot-action.ts +2 -1
- package/src/hooks/use-frontend-tool.ts +3 -6
- package/src/hooks/zod-parameters.ts +162 -0
- package/src/v2/__tests__/exports.test.ts +4 -2
- package/src/v2/components/A2UIMessageRenderer.ts +56 -68
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +11 -23
- package/src/v2/components/LicenseWarningBanner.vue +31 -15
- package/src/v2/components/OpenGenerativeUIRenderer.ts +51 -373
- package/src/v2/components/__tests__/A2UIBasicCatalogColors.test.ts +8 -9
- package/src/v2/components/__tests__/A2UICatalogContext.test.ts +1 -1
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +63 -36
- package/src/v2/components/__tests__/LicenseWarningBanner.test.ts +20 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +55 -6
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +15 -258
- package/src/v2/components/a2ui/A2UICatalogContext.ts +10 -102
- package/src/v2/components/a2ui/A2UIRecoveryStates.ts +444 -0
- package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +175 -0
- package/src/v2/components/a2ui.ts +1 -1
- package/src/v2/components/chat/CopilotChat.vue +26 -40
- package/src/v2/components/chat/CopilotChatAssistantMessage.vue +267 -67
- package/src/v2/components/chat/CopilotChatAssistantToolbarButton.vue +46 -0
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +150 -173
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +77 -20
- package/src/v2/components/chat/CopilotChatAudioRecorder.vue +2 -2
- package/src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue +240 -0
- package/src/v2/components/chat/CopilotChatInput.vue +250 -191
- package/src/v2/components/chat/CopilotChatInspectorButton.vue +331 -0
- package/src/v2/components/chat/CopilotChatLightbox.vue +105 -0
- package/src/v2/components/chat/CopilotChatMessageView.vue +262 -87
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +52 -35
- package/src/v2/components/chat/CopilotChatSuggestionPill.vue +5 -14
- package/src/v2/components/chat/CopilotChatSuggestionView.vue +1 -4
- package/src/v2/components/chat/CopilotChatToggleButton.vue +3 -9
- package/src/v2/components/chat/CopilotChatToggleButtonCloseIcon.ts +1 -1
- package/src/v2/components/chat/CopilotChatToggleButtonOpenIcon.ts +1 -1
- package/src/v2/components/chat/CopilotChatToolCallGroup.vue +353 -0
- package/src/v2/components/chat/CopilotChatToolCallItem.vue +24 -14
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +194 -21
- package/src/v2/components/chat/CopilotChatUserMessage.vue +105 -42
- package/src/v2/components/chat/CopilotChatView.vue +37 -42
- package/src/v2/components/chat/CopilotChatWorkSummary.vue +111 -0
- package/src/v2/components/chat/CopilotModalHeader.vue +10 -8
- package/src/v2/components/chat/CopilotModalHeaderCloseButton.ts +7 -6
- package/src/v2/components/chat/CopilotModalHeaderTitle.ts +1 -4
- package/src/v2/components/chat/CopilotPopup.vue +3 -0
- package/src/v2/components/chat/CopilotPopupView.vue +1 -0
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +9 -19
- package/src/v2/components/chat/CopilotPopupWelcomeScreen.vue +5 -8
- package/src/v2/components/chat/CopilotSidebar.vue +5 -0
- package/src/v2/components/chat/CopilotSidebarView.vue +2 -0
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +24 -17
- package/src/v2/components/chat/CopilotSidebarWelcomeScreen.vue +7 -10
- package/src/v2/components/chat/StreamingMarkdownDefault.vue +3 -5
- package/src/v2/components/chat/__tests__/CopilotChat.labels.test.ts +19 -4
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +26 -9
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.inspector.test.ts +269 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.learningFeedback.test.ts +760 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.slots.e2e.test.ts +3 -5
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.ts +2 -2
- package/src/v2/components/chat/__tests__/CopilotChatInput.addMenu.test.ts +328 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.slots.e2e.test.ts +6 -3
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +55 -14
- package/src/v2/components/chat/__tests__/CopilotChatLightbox.test.ts +160 -0
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +247 -403
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +637 -0
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionPill.test.ts +1 -1
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.slots.e2e.test.ts +3 -1
- package/src/v2/components/chat/__tests__/CopilotChatToolCallsView.learning.test.ts +75 -0
- package/src/v2/components/chat/__tests__/CopilotChatUserMessage.attachments.test.ts +143 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.inputOverlay.test.ts +5 -4
- package/src/v2/components/chat/__tests__/CopilotChatView.rootWidth.test.ts +7 -33
- package/src/v2/components/chat/__tests__/CopilotModalHeader.slots.e2e.test.ts +1 -1
- package/src/v2/components/chat/__tests__/CopilotPopupView.slots.e2e.test.ts +3 -3
- package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.ts +126 -0
- package/src/v2/components/chat/__tests__/messageFeedbackDefaults.test.ts +33 -0
- package/src/v2/components/chat/__tests__/modalChatDisplayProps.test.ts +44 -0
- package/src/v2/components/chat/copilotChatToolCallItemRender.ts +3 -19
- package/src/v2/components/chat/index.ts +2 -1
- package/src/v2/components/chat/inspector-shortcuts.ts +34 -0
- package/src/v2/components/chat/message-feedback.ts +291 -0
- package/src/v2/components/chat/tool-call-capture.ts +55 -0
- package/src/v2/components/chat/tool-call-display-context.ts +28 -0
- package/src/v2/components/chat/tool-call-group-parts.ts +251 -0
- package/src/v2/components/chat/turn-work.ts +52 -0
- package/src/v2/components/chat/types.ts +114 -4
- package/src/v2/components/chat/use-chat-labels.ts +16 -0
- package/src/v2/components/chat/use-lightbox.ts +64 -0
- package/src/v2/components/icons/__tests__/icons.test.ts +72 -68
- package/src/v2/components/icons/index.ts +109 -23
- package/src/v2/components/ui/CopilotDropdownMenuContent.vue +465 -0
- package/src/v2/components/ui/CopilotPopover.vue +138 -0
- package/src/v2/components/ui/CopilotTooltip.vue +237 -0
- package/src/v2/components/ui/__tests__/CopilotTooltip.test.ts +168 -0
- package/src/v2/components/ui/dropdown-menu.ts +15 -0
- package/src/v2/components/ui/floating.ts +321 -0
- package/src/v2/components/ui/presence.ts +54 -0
- package/src/v2/components/ui/use-id.ts +16 -0
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +62 -1
- package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +105 -0
- package/src/v2/hooks/__tests__/use-render-tool.test.ts +3 -6
- package/src/v2/hooks/__tests__/zod-regression.test.ts +5 -4
- package/src/v2/hooks/use-default-render-tool.ts +123 -62
- package/src/v2/hooks/use-frontend-tool.ts +10 -10
- package/src/v2/hooks/use-render-activity-message.ts +27 -48
- package/src/v2/hooks/use-render-custom-messages.ts +14 -35
- package/src/v2/hooks/use-render-tool.ts +8 -0
- package/src/v2/index.ts +3 -0
- package/src/v2/lib/__tests__/message-feedback.test.ts +152 -0
- package/src/v2/lib/message-feedback.ts +120 -0
- package/src/v2/lib/processPartialHtml.ts +6 -21
- package/src/v2/lib/vue-core.ts +3 -5
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +29 -2
- package/src/v2/providers/CopilotKitProvider.types.ts +57 -5
- package/src/v2/providers/CopilotKitProvider.vue +177 -114
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.openThread.test.ts +69 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +1 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.headersAtSendTime.test.ts +3 -3
- package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +536 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +17 -33
- package/src/v2/providers/index.ts +4 -1
- package/src/v2/providers/keys.ts +12 -0
- package/src/v2/providers/types.ts +3 -38
- package/src/v2/styles/CopilotKitStyles.ts +95 -0
- package/src/v2/styles/__tests__/CopilotKitStyles.client.test.ts +149 -0
- package/src/v2/styles/__tests__/CopilotKitStyles.ssr.test.ts +71 -0
- package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +28 -33
- package/src/v2/types/defineToolCallRenderer.ts +9 -4
- package/src/v2/types/human-in-the-loop.ts +8 -32
- package/src/v2/types/interrupt.ts +7 -31
- package/src/v2/types/vue-activity-message-renderer.ts +24 -15
- package/src/v2/types/vue-custom-message-renderer.ts +12 -16
- package/src/v2/types/vue-tool-call-renderer.ts +23 -31
- package/vite.config.ts +5 -5
- package/dist/styles.css +0 -2
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts +0 -9
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts.map +0 -1
- package/dist/v2/lib/transcription-client.d.ts +0 -19
- package/dist/v2/lib/transcription-client.d.ts.map +0 -1
- package/scripts/scope-preflight.mjs +0 -100
- package/src/styles/globals.css +0 -233
- package/src/v2/components/chat/BasicMarkdown.vue +0 -158
- package/src/v2/components/chat/__tests__/BasicMarkdown.test.ts +0 -69
- package/src/v2/lib/__tests__/processPartialHtml.test.ts +0 -84
- package/src/v2/lib/__tests__/transcription-client.test.ts +0 -67
- package/src/v2/lib/transcription-client.ts +0 -151
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
GENERATE_SANDBOXED_UI_DESCRIPTION,
|
|
4
|
+
randomUUID,
|
|
5
|
+
ɵanySchema,
|
|
6
|
+
} from "@copilotkit/shared";
|
|
3
7
|
import {
|
|
4
8
|
computed,
|
|
5
9
|
h,
|
|
6
10
|
onMounted,
|
|
11
|
+
onUnmounted,
|
|
7
12
|
provide,
|
|
8
13
|
ref,
|
|
9
14
|
shallowRef,
|
|
15
|
+
toRaw,
|
|
10
16
|
triggerRef,
|
|
11
17
|
watch,
|
|
12
18
|
} from "vue";
|
|
13
19
|
import type { Component, FunctionalComponent } from "vue";
|
|
14
|
-
import { z } from "zod";
|
|
15
20
|
import type { AbstractAgent } from "@ag-ui/client";
|
|
16
21
|
import { ToolCallStatus } from "@copilotkit/core";
|
|
17
22
|
import type {
|
|
@@ -20,13 +25,17 @@ import type {
|
|
|
20
25
|
CopilotKitHeadersSource,
|
|
21
26
|
FrontendTool,
|
|
22
27
|
} from "@copilotkit/core";
|
|
23
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
DEFAULT_OPEN_GENERATIVE_UI_DESIGN_SKILL,
|
|
30
|
+
GENERATE_SANDBOXED_UI_TOOL_NAME,
|
|
31
|
+
ɵresolveLicenseState,
|
|
32
|
+
ɵwithHeaderDefaults,
|
|
33
|
+
} from "@copilotkit/core";
|
|
24
34
|
import { schemaToJsonSchema, shouldEnableInspector } from "@copilotkit/shared";
|
|
25
35
|
import type {
|
|
26
36
|
RuntimeEntitlementResponse,
|
|
27
37
|
RuntimeLicenseStatus,
|
|
28
38
|
} from "@copilotkit/shared";
|
|
29
|
-
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
30
39
|
import { CopilotKitCoreVue } from "../lib/vue-core";
|
|
31
40
|
import { createA2UIMessageRenderer } from "../components/A2UIMessageRenderer";
|
|
32
41
|
import { registerA2UIBuiltInToolCallRenderer } from "../components/a2ui/A2UIBuiltInToolCallRenderer";
|
|
@@ -43,17 +52,21 @@ import {
|
|
|
43
52
|
MCPAppsActivityRenderer,
|
|
44
53
|
MCPAppsActivityType,
|
|
45
54
|
} from "../components/MCPAppsActivityRenderer";
|
|
46
|
-
import {
|
|
55
|
+
import {
|
|
56
|
+
CopilotKitKey,
|
|
57
|
+
CopilotStyleOptionsKey,
|
|
58
|
+
InspectorKey,
|
|
59
|
+
SandboxFunctionsKey,
|
|
60
|
+
} from "./keys";
|
|
47
61
|
import type { VueInspectorOpenRequest } from "./keys";
|
|
48
62
|
import { MARKDOWN_RENDERER_KEY } from "./markdown-renderer";
|
|
49
|
-
import {
|
|
50
|
-
LicenseContextKey,
|
|
51
|
-
createLicenseContextValue,
|
|
52
|
-
} from "./license-context";
|
|
53
|
-
import type { LicenseContextValue } from "./license-context";
|
|
63
|
+
import { LicenseContextKey } from "./license-context";
|
|
54
64
|
import CopilotKitInspector from "../components/CopilotKitInspector.vue";
|
|
55
65
|
import LicenseWarningBanner from "../components/LicenseWarningBanner.vue";
|
|
56
|
-
import type {
|
|
66
|
+
import type {
|
|
67
|
+
CopilotKitLearningOptions,
|
|
68
|
+
CopilotKitProviderProps,
|
|
69
|
+
} from "./CopilotKitProvider.types";
|
|
57
70
|
import type {
|
|
58
71
|
SandboxFunction,
|
|
59
72
|
VueActivityMessageRenderer,
|
|
@@ -82,16 +95,6 @@ const SANDBOX_FUNCTIONS_STABLE_WARNING =
|
|
|
82
95
|
// interrupt reads the same across frameworks (see #5554).
|
|
83
96
|
const HUMAN_IN_THE_LOOP_ABORTED_MESSAGE =
|
|
84
97
|
"Human-in-the-loop interaction aborted";
|
|
85
|
-
const DEFAULT_DESIGN_SKILL = `When generating UI with generateSandboxedUi, follow these design principles inspired by shadcn/ui:
|
|
86
|
-
|
|
87
|
-
- Use a minimal, flat aesthetic. Avoid drop shadows and gradients — rely on subtle borders (1px solid, light gray like #e5e7eb) to define surfaces.
|
|
88
|
-
- Neutral base palette: white backgrounds, zinc/slate gray text (#09090b for headings, #71717a for secondary text). One accent color for interactive elements.
|
|
89
|
-
- Use system font stacks (system-ui, -apple-system, sans-serif) at readable sizes (14px body, 600 weight for headings). Tight line-heights.
|
|
90
|
-
- Small, consistent border-radius (6–8px). Cards and containers use border, not shadow, for separation.
|
|
91
|
-
- Buttons: solid fill for primary (dark bg, white text), outline for secondary (border + transparent bg). Subtle hover state (slight opacity or background shift).
|
|
92
|
-
- Use CSS Grid or Flexbox for layout. Ensure the UI looks good at any width.
|
|
93
|
-
- Minimal transitions (150ms) for hover/focus states only. No decorative animations.
|
|
94
|
-
- Keep the UI focused and dense — avoid excessive padding. Use compact spacing (8–12px gaps, 10–14px padding in controls).`;
|
|
95
98
|
|
|
96
99
|
/** The MCP Apps renderer with `mcpApps.allowSameOriginFallback` applied. */
|
|
97
100
|
const SameOriginMCPAppsActivityRenderer: FunctionalComponent = (_, { attrs }) =>
|
|
@@ -114,8 +117,17 @@ const props = withDefaults(defineProps<CopilotKitProviderProps>(), {
|
|
|
114
117
|
a2ui: undefined,
|
|
115
118
|
mcpApps: undefined,
|
|
116
119
|
enableInspector: undefined,
|
|
120
|
+
nonce: undefined,
|
|
121
|
+
injectStyles: true,
|
|
122
|
+
// A missing boolean prop would otherwise read as `false`.
|
|
123
|
+
learning: undefined,
|
|
117
124
|
});
|
|
118
125
|
|
|
126
|
+
provide(
|
|
127
|
+
CopilotStyleOptionsKey,
|
|
128
|
+
computed(() => ({ nonce: props.nonce, inject: props.injectStyles })),
|
|
129
|
+
);
|
|
130
|
+
|
|
119
131
|
const shouldRenderInspector = ref(false);
|
|
120
132
|
|
|
121
133
|
function updateInspectorVisibility(): void {
|
|
@@ -147,6 +159,12 @@ const initialRenderCustomMessages = props.renderCustomMessages;
|
|
|
147
159
|
const initialRenderActivityMessages = props.renderActivityMessages;
|
|
148
160
|
const initialSandboxFunctions = props.openGenerativeUI?.sandboxFunctions;
|
|
149
161
|
|
|
162
|
+
// Props that come from reactive state arrive as deep proxies. Zod 4 schemas
|
|
163
|
+
// break behind a Vue proxy (their `_zod` property is read-only and
|
|
164
|
+
// non-configurable), so read tools and renderers through their raw objects.
|
|
165
|
+
const rawEntries = <T>(entries: readonly T[] | undefined): T[] =>
|
|
166
|
+
[...toRaw(entries ?? [])].map((entry) => toRaw(entry));
|
|
167
|
+
|
|
150
168
|
watch(
|
|
151
169
|
() => props.frontendTools,
|
|
152
170
|
(next) => {
|
|
@@ -279,7 +297,7 @@ const processedHumanInTheLoop = computed(() => {
|
|
|
279
297
|
const tools: FrontendTool[] = [];
|
|
280
298
|
const renderToolCalls: VueToolCallRenderer<unknown>[] = [];
|
|
281
299
|
|
|
282
|
-
for (const tool of props.humanInTheLoop) {
|
|
300
|
+
for (const tool of rawEntries(props.humanInTheLoop)) {
|
|
283
301
|
tools.push({
|
|
284
302
|
type: "human-in-the-loop",
|
|
285
303
|
name: tool.name,
|
|
@@ -345,7 +363,7 @@ const processedHumanInTheLoop = computed(() => {
|
|
|
345
363
|
|
|
346
364
|
renderToolCalls.push({
|
|
347
365
|
name: tool.name,
|
|
348
|
-
args: tool.parameters ??
|
|
366
|
+
args: tool.parameters ?? ɵanySchema,
|
|
349
367
|
render,
|
|
350
368
|
...(tool.agentId && { agentId: tool.agentId }),
|
|
351
369
|
} as VueToolCallRenderer<unknown>);
|
|
@@ -356,7 +374,7 @@ const processedHumanInTheLoop = computed(() => {
|
|
|
356
374
|
|
|
357
375
|
const allTools = computed(() => {
|
|
358
376
|
const tools: FrontendTool[] = [];
|
|
359
|
-
for (const t of props.frontendTools) {
|
|
377
|
+
for (const t of rawEntries(props.frontendTools)) {
|
|
360
378
|
tools.push(t as FrontendTool);
|
|
361
379
|
}
|
|
362
380
|
for (const t of builtInFrontendTools.value) {
|
|
@@ -368,11 +386,15 @@ const allTools = computed(() => {
|
|
|
368
386
|
|
|
369
387
|
const allRenderToolCalls = computed(() => {
|
|
370
388
|
const combined: VueToolCallRenderer<unknown>[] = [
|
|
371
|
-
...(props.renderToolCalls
|
|
389
|
+
...rawEntries(props.renderToolCalls),
|
|
372
390
|
];
|
|
373
|
-
for (const tool of [
|
|
391
|
+
for (const tool of [
|
|
392
|
+
...rawEntries(props.frontendTools),
|
|
393
|
+
...builtInFrontendTools.value,
|
|
394
|
+
]) {
|
|
374
395
|
if (tool.render) {
|
|
375
|
-
const args =
|
|
396
|
+
const args =
|
|
397
|
+
tool.parameters ?? (tool.name === "*" ? ɵanySchema : undefined);
|
|
376
398
|
if (args) {
|
|
377
399
|
combined.push({
|
|
378
400
|
name: tool.name,
|
|
@@ -414,23 +436,14 @@ const resolvedProperties = computed(() =>
|
|
|
414
436
|
? { ...props.properties, a2uiCatalogAvailable: true }
|
|
415
437
|
: props.properties,
|
|
416
438
|
);
|
|
417
|
-
const sandboxFunctions = computed<readonly SandboxFunction[]>(
|
|
418
|
-
(
|
|
439
|
+
const sandboxFunctions = computed<readonly SandboxFunction[]>(() =>
|
|
440
|
+
rawEntries(props.openGenerativeUI?.sandboxFunctions),
|
|
419
441
|
);
|
|
420
|
-
const zodToJsonSchemaCompat = (
|
|
421
|
-
schema: unknown,
|
|
422
|
-
options?: { $refStrategy?: string },
|
|
423
|
-
): Record<string, unknown> =>
|
|
424
|
-
zodToJsonSchema(
|
|
425
|
-
schema as z.ZodTypeAny,
|
|
426
|
-
options as { $refStrategy?: "none" | "relative" | "root" | "seen" },
|
|
427
|
-
) as Record<string, unknown>;
|
|
428
|
-
|
|
429
442
|
const builtInFrontendTools = computed<VueFrontendTool[]>(() => {
|
|
430
443
|
if (!openGenerativeUIActive.value) return [];
|
|
431
444
|
return [
|
|
432
445
|
{
|
|
433
|
-
name:
|
|
446
|
+
name: GENERATE_SANDBOXED_UI_TOOL_NAME,
|
|
434
447
|
description: GENERATE_SANDBOXED_UI_DESCRIPTION,
|
|
435
448
|
parameters: GenerateSandboxedUiArgsSchema,
|
|
436
449
|
handler: async () => "UI generated",
|
|
@@ -449,7 +462,7 @@ const builtInActivityRenderers = computed<
|
|
|
449
462
|
const renderers: VueActivityMessageRenderer<unknown>[] = [
|
|
450
463
|
{
|
|
451
464
|
activityType: MCPAppsActivityType,
|
|
452
|
-
content: MCPAppsActivityContentSchema
|
|
465
|
+
content: MCPAppsActivityContentSchema,
|
|
453
466
|
render: (props.mcpApps?.allowSameOriginFallback
|
|
454
467
|
? SameOriginMCPAppsActivityRenderer
|
|
455
468
|
: MCPAppsActivityRenderer) as unknown as VueActivityMessageRenderer<unknown>["render"],
|
|
@@ -459,7 +472,7 @@ const builtInActivityRenderers = computed<
|
|
|
459
472
|
if (openGenerativeUIActive.value) {
|
|
460
473
|
renderers.push({
|
|
461
474
|
activityType: OpenGenerativeUIActivityType,
|
|
462
|
-
content: OpenGenerativeUIContentSchema
|
|
475
|
+
content: OpenGenerativeUIContentSchema,
|
|
463
476
|
render:
|
|
464
477
|
OpenGenerativeUIActivityRenderer as unknown as VueActivityMessageRenderer<unknown>["render"],
|
|
465
478
|
});
|
|
@@ -471,6 +484,7 @@ const builtInActivityRenderers = computed<
|
|
|
471
484
|
theme: props.a2ui?.theme ?? viewerTheme,
|
|
472
485
|
catalog: props.a2ui?.catalog,
|
|
473
486
|
loadingComponent: props.a2ui?.loadingComponent,
|
|
487
|
+
recovery: props.a2ui?.recovery,
|
|
474
488
|
}),
|
|
475
489
|
);
|
|
476
490
|
}
|
|
@@ -479,7 +493,7 @@ const builtInActivityRenderers = computed<
|
|
|
479
493
|
});
|
|
480
494
|
|
|
481
495
|
const allRenderActivityMessages = computed(() => [
|
|
482
|
-
...(props.renderActivityMessages
|
|
496
|
+
...rawEntries(props.renderActivityMessages),
|
|
483
497
|
...builtInActivityRenderers.value,
|
|
484
498
|
]);
|
|
485
499
|
|
|
@@ -495,6 +509,19 @@ const applyDefaultThrottleMs = (core: CopilotKitCoreVue) => {
|
|
|
495
509
|
core.setDefaultThrottleMs(props.defaultThrottleMs);
|
|
496
510
|
};
|
|
497
511
|
|
|
512
|
+
function toLearningConfig(
|
|
513
|
+
learning: boolean | CopilotKitLearningOptions | undefined,
|
|
514
|
+
): CopilotKitLearningOptions | undefined {
|
|
515
|
+
// `true` uses the default authenticated capture options.
|
|
516
|
+
if (learning === true) return {};
|
|
517
|
+
if (learning === false || learning === undefined) return undefined;
|
|
518
|
+
// `autoStart` only controls the provider; Core never receives it.
|
|
519
|
+
const { autoStart: _autoStart, ...config } = learning;
|
|
520
|
+
return config;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
const learningConfig = computed(() => toLearningConfig(props.learning));
|
|
524
|
+
|
|
498
525
|
const createCopilotKit = () => {
|
|
499
526
|
const core = new CopilotKitCoreVue({
|
|
500
527
|
runtimeUrl: chatApiEndpoint.value,
|
|
@@ -514,6 +541,7 @@ const createCopilotKit = () => {
|
|
|
514
541
|
renderActivityMessages: allRenderActivityMessages.value,
|
|
515
542
|
renderCustomMessages: allRenderCustomMessages.value,
|
|
516
543
|
debug: props.debug,
|
|
544
|
+
learning: learningConfig.value,
|
|
517
545
|
});
|
|
518
546
|
// Initialize synchronously so child hooks can read the value on first render.
|
|
519
547
|
applyDefaultThrottleMs(core);
|
|
@@ -696,8 +724,95 @@ onMounted(() => {
|
|
|
696
724
|
runtimeEntitlementRetryPending.value =
|
|
697
725
|
copilotkit.value.runtimeEntitlementRetryPending;
|
|
698
726
|
didMountRef.value = true;
|
|
727
|
+
// After the runtime URL is set, so CopilotKit's own runtime traffic is never
|
|
728
|
+
// captured. Created here, the watchers stop (and stop capture) on unmount.
|
|
729
|
+
watchLearning();
|
|
699
730
|
});
|
|
700
731
|
|
|
732
|
+
const learningEnabled = computed(() => learningConfig.value !== undefined);
|
|
733
|
+
// `true` is the options-free form, so only an object can opt out.
|
|
734
|
+
const learningAutoStart = computed(
|
|
735
|
+
() =>
|
|
736
|
+
learningEnabled.value &&
|
|
737
|
+
(typeof props.learning !== "object" || props.learning.autoStart !== false),
|
|
738
|
+
);
|
|
739
|
+
const suppliedTrajectoryId = computed(() =>
|
|
740
|
+
learningAutoStart.value ? learningConfig.value?.trajectoryId : undefined,
|
|
741
|
+
);
|
|
742
|
+
const generatesTrajectoryId = computed(
|
|
743
|
+
() => learningAutoStart.value && suppliedTrajectoryId.value === undefined,
|
|
744
|
+
);
|
|
745
|
+
|
|
746
|
+
function watchLearning() {
|
|
747
|
+
let learningContainerIds = learningConfig.value?.learningContainerIds;
|
|
748
|
+
|
|
749
|
+
watch(
|
|
750
|
+
[learningConfig, learningAutoStart],
|
|
751
|
+
([config, autoStart]) => {
|
|
752
|
+
copilotkit.value.setLearningConfig(config);
|
|
753
|
+
learningContainerIds = config?.learningContainerIds;
|
|
754
|
+
// Automatic starts report unsupported options in Core. With manual
|
|
755
|
+
// starts, the provider's container option is not part of
|
|
756
|
+
// startTrajectory() options.
|
|
757
|
+
if (
|
|
758
|
+
config?.sink === undefined &&
|
|
759
|
+
!autoStart &&
|
|
760
|
+
config?.learningContainerIds !== undefined
|
|
761
|
+
) {
|
|
762
|
+
console.warn(
|
|
763
|
+
"[CopilotKit] learningContainerIds is supported only with a custom sink. Authenticated Trajectory capture ignores it; assign Learning Spaces on the server with getTrajectoryLearningContainerIds on CopilotKitIntelligence, and remove learningContainerIds from the capture options.",
|
|
764
|
+
);
|
|
765
|
+
}
|
|
766
|
+
},
|
|
767
|
+
{ immediate: true },
|
|
768
|
+
);
|
|
769
|
+
|
|
770
|
+
// Watched as a boolean so a new inline `learning` object warns once.
|
|
771
|
+
watch(
|
|
772
|
+
() =>
|
|
773
|
+
!learningAutoStart.value &&
|
|
774
|
+
learningConfig.value?.trajectoryId !== undefined,
|
|
775
|
+
(ignoresTrajectoryId) => {
|
|
776
|
+
if (!ignoresTrajectoryId) return;
|
|
777
|
+
console.warn(
|
|
778
|
+
"[CopilotKit] learning.trajectoryId is ignored when autoStart is false; pass the ID to startTrajectory() instead.",
|
|
779
|
+
);
|
|
780
|
+
},
|
|
781
|
+
{ immediate: true },
|
|
782
|
+
);
|
|
783
|
+
|
|
784
|
+
// Runs only when these change, so option changes that keep generating keep
|
|
785
|
+
// the generated Trajectory; generating again starts one with a new ID.
|
|
786
|
+
watch(
|
|
787
|
+
[learningEnabled, generatesTrajectoryId, suppliedTrajectoryId],
|
|
788
|
+
([enabled, generates, supplied], _previous, onCleanup) => {
|
|
789
|
+
if (!enabled) return;
|
|
790
|
+
let disposed = false;
|
|
791
|
+
const core = copilotkit.value;
|
|
792
|
+
const trajectoryId = generates ? randomUUID() : supplied;
|
|
793
|
+
if (trajectoryId !== undefined) {
|
|
794
|
+
void core
|
|
795
|
+
.startTrajectory({ trajectoryId, learningContainerIds })
|
|
796
|
+
.catch(() => {
|
|
797
|
+
// Expected authentication/connection failures resolve with an
|
|
798
|
+
// error result; Core reports them to LearningConfig.onError or
|
|
799
|
+
// warns once. Consume unexpected rejections without logging
|
|
800
|
+
// credentials or errors from a previous start after a new
|
|
801
|
+
// Trajectory has already started.
|
|
802
|
+
if (!disposed) {
|
|
803
|
+
console.warn("[CopilotKit] Failed to start interaction capture.");
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
onCleanup(() => {
|
|
808
|
+
disposed = true;
|
|
809
|
+
core.stopTrajectory();
|
|
810
|
+
});
|
|
811
|
+
},
|
|
812
|
+
{ immediate: true },
|
|
813
|
+
);
|
|
814
|
+
}
|
|
815
|
+
|
|
701
816
|
const a2uiTheme = computed(() => props.a2ui?.theme);
|
|
702
817
|
const a2uiCatalog = computed(() => props.a2ui?.catalog);
|
|
703
818
|
const a2uiLoadingComponent = computed(() => props.a2ui?.loadingComponent);
|
|
@@ -728,7 +843,7 @@ watch(
|
|
|
728
843
|
copilotkit.value.addContext({
|
|
729
844
|
description:
|
|
730
845
|
"Design guidelines for the generateSandboxedUi tool. Follow these when building UI.",
|
|
731
|
-
value: designSkill ??
|
|
846
|
+
value: designSkill ?? DEFAULT_OPEN_GENERATIVE_UI_DESIGN_SKILL,
|
|
732
847
|
}),
|
|
733
848
|
);
|
|
734
849
|
|
|
@@ -737,9 +852,7 @@ watch(
|
|
|
737
852
|
functions.map((fn) => ({
|
|
738
853
|
name: fn.name,
|
|
739
854
|
description: fn.description,
|
|
740
|
-
parameters: schemaToJsonSchema(fn.parameters,
|
|
741
|
-
zodToJsonSchema: zodToJsonSchemaCompat,
|
|
742
|
-
}),
|
|
855
|
+
parameters: schemaToJsonSchema(fn.parameters),
|
|
743
856
|
})),
|
|
744
857
|
);
|
|
745
858
|
ids.push(
|
|
@@ -772,73 +885,26 @@ provide(CopilotKitKey, {
|
|
|
772
885
|
provide(SandboxFunctionsKey, sandboxFunctions);
|
|
773
886
|
provide(MARKDOWN_RENDERER_KEY, props.markdownRenderer);
|
|
774
887
|
|
|
775
|
-
// License context
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
runtimeEntitlements.value.status !== "ready",
|
|
785
|
-
);
|
|
786
|
-
const hasLegacyRuntimeEntitlementFallback = computed(
|
|
787
|
-
() =>
|
|
788
|
-
runtimeLicenseStatus.value === "valid" ||
|
|
789
|
-
runtimeLicenseStatus.value === "expiring",
|
|
790
|
-
);
|
|
791
|
-
const runtimeEntitlementRetryInProgress = computed(
|
|
792
|
-
() =>
|
|
793
|
-
retryableRuntimeEntitlementFailure.value &&
|
|
794
|
-
runtimeEntitlementRetryPending.value &&
|
|
795
|
-
!hasLegacyRuntimeEntitlementFallback.value,
|
|
888
|
+
// License context and banner, from the runtime license status and the
|
|
889
|
+
// structured entitlement response.
|
|
890
|
+
const licenseState = computed(() =>
|
|
891
|
+
ɵresolveLicenseState({
|
|
892
|
+
status: runtimeLicenseStatus.value,
|
|
893
|
+
entitlements: runtimeEntitlements.value,
|
|
894
|
+
retryPending: runtimeEntitlementRetryPending.value,
|
|
895
|
+
publicKey: resolvedPublicKey.value,
|
|
896
|
+
}),
|
|
796
897
|
);
|
|
797
|
-
|
|
798
|
-
// a network error, a 5xx) says nothing about what the project may use.
|
|
799
|
-
const terminalRuntimeEntitlementFailure = computed(
|
|
800
|
-
() =>
|
|
801
|
-
hasNonReadyRuntimeEntitlement.value &&
|
|
802
|
-
!retryableRuntimeEntitlementFailure.value &&
|
|
803
|
-
!hasLegacyRuntimeEntitlementFallback.value,
|
|
804
|
-
);
|
|
805
|
-
const licenseContextValue = computed<LicenseContextValue>(() => {
|
|
806
|
-
const runtimeLicenseContext = createLicenseContextValue(
|
|
807
|
-
runtimeEntitlementRetryInProgress.value
|
|
808
|
-
? undefined
|
|
809
|
-
: runtimeLicenseStatus.value,
|
|
810
|
-
runtimeEntitlements.value,
|
|
811
|
-
);
|
|
812
|
-
if (!terminalRuntimeEntitlementFailure.value) {
|
|
813
|
-
return runtimeLicenseContext;
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
return {
|
|
817
|
-
...runtimeLicenseContext,
|
|
818
|
-
checkFeature: () => false,
|
|
819
|
-
getLimit: () => null,
|
|
820
|
-
};
|
|
821
|
-
});
|
|
898
|
+
const licenseContextValue = computed(() => licenseState.value.context);
|
|
822
899
|
provide(LicenseContextKey, licenseContextValue);
|
|
900
|
+
const licenseBannerType = computed(() => licenseState.value.bannerType);
|
|
823
901
|
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
);
|
|
829
|
-
|
|
830
|
-
() =>
|
|
831
|
-
runtimeLicenseWarningStatus.value === "none" && !resolvedPublicKey.value,
|
|
832
|
-
);
|
|
833
|
-
const showExpiredBanner = computed(
|
|
834
|
-
() => runtimeLicenseWarningStatus.value === "expired",
|
|
835
|
-
);
|
|
836
|
-
const showInvalidBanner = computed(
|
|
837
|
-
() => runtimeLicenseWarningStatus.value === "invalid",
|
|
838
|
-
);
|
|
839
|
-
const showExpiringBanner = computed(
|
|
840
|
-
() => runtimeLicenseWarningStatus.value === "expiring",
|
|
841
|
-
);
|
|
902
|
+
// The provider created this core, so it stops the core's runs, timers and
|
|
903
|
+
// subscriptions. `onUnmounted` runs after the children unmount, so their
|
|
904
|
+
// cleanup still reaches a live core.
|
|
905
|
+
onUnmounted(() => {
|
|
906
|
+
copilotkit.value.dispose();
|
|
907
|
+
});
|
|
842
908
|
</script>
|
|
843
909
|
|
|
844
910
|
<template>
|
|
@@ -849,8 +915,5 @@ const showExpiringBanner = computed(
|
|
|
849
915
|
:open-request="inspectorOpenRequest"
|
|
850
916
|
/>
|
|
851
917
|
<!-- License warnings — driven by server-reported status -->
|
|
852
|
-
<LicenseWarningBanner v-if="
|
|
853
|
-
<LicenseWarningBanner v-if="showExpiredBanner" type="expired" />
|
|
854
|
-
<LicenseWarningBanner v-if="showInvalidBanner" type="invalid" />
|
|
855
|
-
<LicenseWarningBanner v-if="showExpiringBanner" type="expiring" />
|
|
918
|
+
<LicenseWarningBanner v-if="licenseBannerType" :type="licenseBannerType" />
|
|
856
919
|
</template>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { defineComponent, h, nextTick, ref } from "vue";
|
|
3
|
+
import { mount } from "@vue/test-utils";
|
|
4
|
+
import { CopilotKitCore } from "@copilotkit/core";
|
|
5
|
+
import CopilotKitProvider from "../CopilotKitProvider.vue";
|
|
6
|
+
import CopilotChatConfigurationProvider from "../CopilotChatConfigurationProvider.vue";
|
|
7
|
+
|
|
8
|
+
// Core links captured interactions to the Thread that a chat view shows, as
|
|
9
|
+
// React's CopilotChatConfigurationProvider does.
|
|
10
|
+
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
vi.restoreAllMocks();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
function spyOnRegistration() {
|
|
16
|
+
const registration = { update: vi.fn(), unregister: vi.fn() };
|
|
17
|
+
const register = vi
|
|
18
|
+
.spyOn(CopilotKitCore.prototype, "registerOpenThread")
|
|
19
|
+
.mockReturnValue(registration);
|
|
20
|
+
return { register, registration };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
describe("CopilotChatConfigurationProvider open Thread", () => {
|
|
24
|
+
it("registers its Thread, follows Thread changes, and unregisters on unmount", async () => {
|
|
25
|
+
const { register, registration } = spyOnRegistration();
|
|
26
|
+
const threadId = ref("t-1");
|
|
27
|
+
const App = defineComponent({
|
|
28
|
+
setup: () => () =>
|
|
29
|
+
h(
|
|
30
|
+
CopilotKitProvider,
|
|
31
|
+
{ runtimeUrl: "/api/copilotkit" },
|
|
32
|
+
{
|
|
33
|
+
default: () =>
|
|
34
|
+
h(
|
|
35
|
+
CopilotChatConfigurationProvider,
|
|
36
|
+
{ agentId: "agent-a", threadId: threadId.value },
|
|
37
|
+
{ default: () => h("div") },
|
|
38
|
+
),
|
|
39
|
+
},
|
|
40
|
+
),
|
|
41
|
+
});
|
|
42
|
+
const wrapper = mount(App);
|
|
43
|
+
|
|
44
|
+
expect(register).toHaveBeenCalledTimes(1);
|
|
45
|
+
expect(register).toHaveBeenCalledWith({
|
|
46
|
+
agentId: "agent-a",
|
|
47
|
+
threadId: "t-1",
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
threadId.value = "t-2";
|
|
51
|
+
await nextTick();
|
|
52
|
+
expect(registration.update).toHaveBeenLastCalledWith("t-2");
|
|
53
|
+
expect(register).toHaveBeenCalledTimes(1);
|
|
54
|
+
|
|
55
|
+
wrapper.unmount();
|
|
56
|
+
expect(registration.unregister).toHaveBeenCalledTimes(1);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("works without a CopilotKitProvider", () => {
|
|
60
|
+
const { register } = spyOnRegistration();
|
|
61
|
+
const wrapper = mount(CopilotChatConfigurationProvider, {
|
|
62
|
+
props: { agentId: "agent-a", threadId: "t-1" },
|
|
63
|
+
slots: { default: () => h("div") },
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
expect(register).not.toHaveBeenCalled();
|
|
67
|
+
wrapper.unmount();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { defineComponent, h, 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";
|
|
@@ -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();
|