@copilotkit/vue 2.0.0-rc.1 → 2.0.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PARITY.md +13 -12
- package/README.md +1 -2
- package/dist/components/copilot-provider/CopilotKit.vue.d.ts +3 -1
- package/dist/components/copilot-provider/CopilotKit.vue.d.ts.map +1 -1
- package/dist/hooks/use-copilot-action.d.ts.map +1 -1
- package/dist/hooks/use-frontend-tool.d.ts +1 -1
- package/dist/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/hooks/zod-parameters.d.ts +14 -0
- package/dist/hooks/zod-parameters.d.ts.map +1 -0
- package/dist/index.cjs +1 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +384 -14275
- package/dist/index.mjs.map +1 -1
- package/dist/use-render-activity-message-2np7y4Qt.cjs +92 -0
- package/dist/use-render-activity-message-2np7y4Qt.cjs.map +1 -0
- package/dist/use-render-activity-message-D59E9t0x.js +18097 -0
- package/dist/use-render-activity-message-D59E9t0x.js.map +1 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts +7 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -1
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -1
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +13 -45
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +11 -2
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +144 -0
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -0
- package/dist/v2/components/a2ui.d.ts +3 -7
- package/dist/v2/components/a2ui.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChat.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts +3 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantToolbarButton.vue.d.ts +16 -0
- package/dist/v2/components/chat/CopilotChatAssistantToolbarButton.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts +22 -0
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +21 -232
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts +12 -0
- package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts +22 -0
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +20 -0
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatSuggestionPill.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatSuggestionView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToggleButton.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts +32 -0
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +11 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts +5 -0
- package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeaderTitle.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +1 -0
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupWelcomeScreen.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +2 -0
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +2 -0
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +2 -0
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarWelcomeScreen.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +0 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
- package/dist/v2/components/chat/index.d.ts +17 -1
- package/dist/v2/components/chat/index.d.ts.map +1 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts +12 -0
- package/dist/v2/components/chat/inspector-shortcuts.d.ts.map +1 -0
- package/dist/v2/components/chat/message-feedback.d.ts +89 -0
- package/dist/v2/components/chat/message-feedback.d.ts.map +1 -0
- package/dist/v2/components/chat/tool-call-capture.d.ts +39 -0
- package/dist/v2/components/chat/tool-call-capture.d.ts.map +1 -0
- package/dist/v2/components/chat/tool-call-display-context.d.ts +22 -0
- package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -0
- package/dist/v2/components/chat/tool-call-group-parts.d.ts +131 -0
- package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -0
- package/dist/v2/components/chat/turn-work.d.ts +33 -0
- package/dist/v2/components/chat/turn-work.d.ts.map +1 -0
- package/dist/v2/components/chat/types.d.ts +104 -5
- package/dist/v2/components/chat/types.d.ts.map +1 -1
- package/dist/v2/components/chat/use-chat-labels.d.ts +8 -0
- package/dist/v2/components/chat/use-chat-labels.d.ts.map +1 -0
- package/dist/v2/components/chat/use-lightbox.d.ts +18 -0
- package/dist/v2/components/chat/use-lightbox.d.ts.map +1 -0
- package/dist/v2/components/icons/index.d.ts +968 -1
- package/dist/v2/components/icons/index.d.ts.map +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts +55 -0
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts.map +1 -0
- package/dist/v2/components/ui/CopilotPopover.vue.d.ts +40 -0
- package/dist/v2/components/ui/CopilotPopover.vue.d.ts.map +1 -0
- package/dist/v2/components/ui/CopilotTooltip.vue.d.ts +37 -0
- package/dist/v2/components/ui/CopilotTooltip.vue.d.ts.map +1 -0
- package/dist/v2/components/ui/dropdown-menu.d.ts +14 -0
- package/dist/v2/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/v2/components/ui/floating.d.ts +84 -0
- package/dist/v2/components/ui/floating.d.ts.map +1 -0
- package/dist/v2/components/ui/presence.d.ts +9 -0
- package/dist/v2/components/ui/presence.d.ts.map +1 -0
- package/dist/v2/components/ui/use-id.d.ts +9 -0
- package/dist/v2/components/ui/use-id.d.ts.map +1 -0
- package/dist/v2/hooks/use-default-render-tool.d.ts +6 -0
- package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-frontend-tool.d.ts +5 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-activity-message.d.ts +13 -9
- package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-custom-messages.d.ts +5 -7
- package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-tool.d.ts +4 -0
- package/dist/v2/hooks/use-render-tool.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.d.cts +3 -0
- package/dist/v2/index.d.mts +3 -0
- package/dist/v2/index.d.ts +3 -0
- package/dist/v2/index.d.ts.map +1 -1
- package/dist/v2/index.mjs +197 -197
- package/dist/v2/index.mjs.map +1 -1
- package/dist/v2/lib/message-feedback.d.ts +33 -0
- package/dist/v2/lib/message-feedback.d.ts.map +1 -0
- package/dist/v2/lib/processPartialHtml.d.ts +1 -2
- package/dist/v2/lib/processPartialHtml.d.ts.map +1 -1
- package/dist/v2/lib/vue-core.d.ts +0 -1
- package/dist/v2/lib/vue-core.d.ts.map +1 -1
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +56 -6
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +6 -2
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/index.d.ts +1 -1
- package/dist/v2/providers/index.d.ts.map +1 -1
- package/dist/v2/providers/keys.d.ts +8 -0
- package/dist/v2/providers/keys.d.ts.map +1 -1
- package/dist/v2/providers/types.d.ts +3 -37
- package/dist/v2/providers/types.d.ts.map +1 -1
- package/dist/v2/styles/CopilotKitStyles.d.ts +18 -0
- package/dist/v2/styles/CopilotKitStyles.d.ts.map +1 -0
- package/dist/v2/types/defineToolCallRenderer.d.ts +2 -0
- package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/types/human-in-the-loop.d.ts +8 -29
- package/dist/v2/types/human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/types/interrupt.d.ts +1 -22
- package/dist/v2/types/interrupt.d.ts.map +1 -1
- package/dist/v2/types/vue-activity-message-renderer.d.ts +16 -15
- package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-custom-message-renderer.d.ts +7 -16
- package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-tool-call-renderer.d.ts +16 -28
- package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
- package/package.json +14 -27
- package/src/__tests__/build-entries.test.ts +27 -0
- package/src/components/copilot-provider/CopilotKit.vue +4 -1
- package/src/hooks/__tests__/zod-parameters.test.ts +520 -0
- package/src/hooks/use-copilot-action.ts +2 -1
- package/src/hooks/use-frontend-tool.ts +3 -6
- package/src/hooks/zod-parameters.ts +162 -0
- package/src/v2/__tests__/exports.test.ts +4 -2
- package/src/v2/components/A2UIMessageRenderer.ts +56 -68
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +11 -23
- package/src/v2/components/LicenseWarningBanner.vue +31 -15
- package/src/v2/components/OpenGenerativeUIRenderer.ts +51 -373
- package/src/v2/components/__tests__/A2UIBasicCatalogColors.test.ts +8 -9
- package/src/v2/components/__tests__/A2UICatalogContext.test.ts +1 -1
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +63 -36
- package/src/v2/components/__tests__/LicenseWarningBanner.test.ts +20 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +55 -6
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +15 -258
- package/src/v2/components/a2ui/A2UICatalogContext.ts +10 -102
- package/src/v2/components/a2ui/A2UIRecoveryStates.ts +444 -0
- package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +175 -0
- package/src/v2/components/a2ui.ts +1 -1
- package/src/v2/components/chat/CopilotChat.vue +26 -40
- package/src/v2/components/chat/CopilotChatAssistantMessage.vue +267 -67
- package/src/v2/components/chat/CopilotChatAssistantToolbarButton.vue +46 -0
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +150 -173
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +77 -20
- package/src/v2/components/chat/CopilotChatAudioRecorder.vue +2 -2
- package/src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue +240 -0
- package/src/v2/components/chat/CopilotChatInput.vue +250 -191
- package/src/v2/components/chat/CopilotChatInspectorButton.vue +331 -0
- package/src/v2/components/chat/CopilotChatLightbox.vue +105 -0
- package/src/v2/components/chat/CopilotChatMessageView.vue +262 -87
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +52 -35
- package/src/v2/components/chat/CopilotChatSuggestionPill.vue +5 -14
- package/src/v2/components/chat/CopilotChatSuggestionView.vue +1 -4
- package/src/v2/components/chat/CopilotChatToggleButton.vue +3 -9
- package/src/v2/components/chat/CopilotChatToggleButtonCloseIcon.ts +1 -1
- package/src/v2/components/chat/CopilotChatToggleButtonOpenIcon.ts +1 -1
- package/src/v2/components/chat/CopilotChatToolCallGroup.vue +353 -0
- package/src/v2/components/chat/CopilotChatToolCallItem.vue +24 -14
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +194 -21
- package/src/v2/components/chat/CopilotChatUserMessage.vue +105 -42
- package/src/v2/components/chat/CopilotChatView.vue +37 -42
- package/src/v2/components/chat/CopilotChatWorkSummary.vue +111 -0
- package/src/v2/components/chat/CopilotModalHeader.vue +10 -8
- package/src/v2/components/chat/CopilotModalHeaderCloseButton.ts +7 -6
- package/src/v2/components/chat/CopilotModalHeaderTitle.ts +1 -4
- package/src/v2/components/chat/CopilotPopup.vue +3 -0
- package/src/v2/components/chat/CopilotPopupView.vue +1 -0
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +9 -19
- package/src/v2/components/chat/CopilotPopupWelcomeScreen.vue +5 -8
- package/src/v2/components/chat/CopilotSidebar.vue +5 -0
- package/src/v2/components/chat/CopilotSidebarView.vue +2 -0
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +24 -17
- package/src/v2/components/chat/CopilotSidebarWelcomeScreen.vue +7 -10
- package/src/v2/components/chat/StreamingMarkdownDefault.vue +3 -5
- package/src/v2/components/chat/__tests__/CopilotChat.labels.test.ts +19 -4
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +26 -9
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.inspector.test.ts +269 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.learningFeedback.test.ts +760 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.slots.e2e.test.ts +3 -5
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.ts +2 -2
- package/src/v2/components/chat/__tests__/CopilotChatInput.addMenu.test.ts +328 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.slots.e2e.test.ts +6 -3
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +55 -14
- package/src/v2/components/chat/__tests__/CopilotChatLightbox.test.ts +160 -0
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +247 -403
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +637 -0
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionPill.test.ts +1 -1
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.slots.e2e.test.ts +3 -1
- package/src/v2/components/chat/__tests__/CopilotChatToolCallsView.learning.test.ts +75 -0
- package/src/v2/components/chat/__tests__/CopilotChatUserMessage.attachments.test.ts +143 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.inputOverlay.test.ts +5 -4
- package/src/v2/components/chat/__tests__/CopilotChatView.rootWidth.test.ts +7 -33
- package/src/v2/components/chat/__tests__/CopilotModalHeader.slots.e2e.test.ts +1 -1
- package/src/v2/components/chat/__tests__/CopilotPopupView.slots.e2e.test.ts +3 -3
- package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.ts +126 -0
- package/src/v2/components/chat/__tests__/messageFeedbackDefaults.test.ts +33 -0
- package/src/v2/components/chat/__tests__/modalChatDisplayProps.test.ts +44 -0
- package/src/v2/components/chat/copilotChatToolCallItemRender.ts +3 -19
- package/src/v2/components/chat/index.ts +2 -1
- package/src/v2/components/chat/inspector-shortcuts.ts +34 -0
- package/src/v2/components/chat/message-feedback.ts +291 -0
- package/src/v2/components/chat/tool-call-capture.ts +55 -0
- package/src/v2/components/chat/tool-call-display-context.ts +28 -0
- package/src/v2/components/chat/tool-call-group-parts.ts +251 -0
- package/src/v2/components/chat/turn-work.ts +52 -0
- package/src/v2/components/chat/types.ts +114 -4
- package/src/v2/components/chat/use-chat-labels.ts +16 -0
- package/src/v2/components/chat/use-lightbox.ts +64 -0
- package/src/v2/components/icons/__tests__/icons.test.ts +72 -68
- package/src/v2/components/icons/index.ts +109 -23
- package/src/v2/components/ui/CopilotDropdownMenuContent.vue +465 -0
- package/src/v2/components/ui/CopilotPopover.vue +138 -0
- package/src/v2/components/ui/CopilotTooltip.vue +237 -0
- package/src/v2/components/ui/__tests__/CopilotTooltip.test.ts +168 -0
- package/src/v2/components/ui/dropdown-menu.ts +15 -0
- package/src/v2/components/ui/floating.ts +321 -0
- package/src/v2/components/ui/presence.ts +54 -0
- package/src/v2/components/ui/use-id.ts +16 -0
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +62 -1
- package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +105 -0
- package/src/v2/hooks/__tests__/use-render-tool.test.ts +3 -6
- package/src/v2/hooks/__tests__/zod-regression.test.ts +5 -4
- package/src/v2/hooks/use-default-render-tool.ts +123 -62
- package/src/v2/hooks/use-frontend-tool.ts +10 -10
- package/src/v2/hooks/use-render-activity-message.ts +27 -48
- package/src/v2/hooks/use-render-custom-messages.ts +14 -35
- package/src/v2/hooks/use-render-tool.ts +8 -0
- package/src/v2/index.ts +3 -0
- package/src/v2/lib/__tests__/message-feedback.test.ts +152 -0
- package/src/v2/lib/message-feedback.ts +120 -0
- package/src/v2/lib/processPartialHtml.ts +6 -21
- package/src/v2/lib/vue-core.ts +3 -5
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +29 -2
- package/src/v2/providers/CopilotKitProvider.types.ts +57 -5
- package/src/v2/providers/CopilotKitProvider.vue +177 -114
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.openThread.test.ts +69 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +1 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.headersAtSendTime.test.ts +3 -3
- package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +536 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +17 -33
- package/src/v2/providers/index.ts +4 -1
- package/src/v2/providers/keys.ts +12 -0
- package/src/v2/providers/types.ts +3 -38
- package/src/v2/styles/CopilotKitStyles.ts +95 -0
- package/src/v2/styles/__tests__/CopilotKitStyles.client.test.ts +149 -0
- package/src/v2/styles/__tests__/CopilotKitStyles.ssr.test.ts +71 -0
- package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +28 -33
- package/src/v2/types/defineToolCallRenderer.ts +9 -4
- package/src/v2/types/human-in-the-loop.ts +8 -32
- package/src/v2/types/interrupt.ts +7 -31
- package/src/v2/types/vue-activity-message-renderer.ts +24 -15
- package/src/v2/types/vue-custom-message-renderer.ts +12 -16
- package/src/v2/types/vue-tool-call-renderer.ts +23 -31
- package/vite.config.ts +5 -5
- package/dist/styles.css +0 -2
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts +0 -9
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts.map +0 -1
- package/dist/v2/lib/transcription-client.d.ts +0 -19
- package/dist/v2/lib/transcription-client.d.ts.map +0 -1
- package/scripts/scope-preflight.mjs +0 -100
- package/src/styles/globals.css +0 -233
- package/src/v2/components/chat/BasicMarkdown.vue +0 -158
- package/src/v2/components/chat/__tests__/BasicMarkdown.test.ts +0 -69
- package/src/v2/lib/__tests__/processPartialHtml.test.ts +0 -84
- package/src/v2/lib/__tests__/transcription-client.test.ts +0 -67
- package/src/v2/lib/transcription-client.ts +0 -151
|
@@ -33,12 +33,7 @@ const ariaLabel = computed(() =>
|
|
|
33
33
|
: labels.value.chatToggleOpenLabel,
|
|
34
34
|
);
|
|
35
35
|
const buttonClass = computed(() => [
|
|
36
|
-
"
|
|
37
|
-
"cpk:rounded-full cpk:border cpk:border-primary cpk:bg-primary cpk:text-primary-foreground",
|
|
38
|
-
"cpk:shadow-sm cpk:transition-all cpk:duration-200 cpk:ease-out",
|
|
39
|
-
"cpk:hover:scale-[1.04] cpk:hover:shadow-md cpk:cursor-pointer cpk:active:scale-[0.96]",
|
|
40
|
-
"cpk:focus-visible:outline-none cpk:focus-visible:ring-2 cpk:focus-visible:ring-primary/50 cpk:focus-visible:ring-offset-2 cpk:focus-visible:ring-offset-background",
|
|
41
|
-
"cpk:disabled:pointer-events-none cpk:disabled:opacity-60",
|
|
36
|
+
"copilotKitButton cpk-chat-toggle-button",
|
|
42
37
|
attrs.class,
|
|
43
38
|
]);
|
|
44
39
|
const buttonAttrs = computed(() => {
|
|
@@ -46,13 +41,12 @@ const buttonAttrs = computed(() => {
|
|
|
46
41
|
return rest;
|
|
47
42
|
});
|
|
48
43
|
|
|
49
|
-
const iconClass = "cpk
|
|
44
|
+
const iconClass = "cpk-chat-toggle-button-icon";
|
|
50
45
|
const iconTransitionStyle = Object.freeze({
|
|
51
46
|
transition:
|
|
52
47
|
"opacity 120ms ease-out, transform 260ms cubic-bezier(0.22, 1, 0.36, 1)",
|
|
53
48
|
});
|
|
54
|
-
const iconWrapperBase =
|
|
55
|
-
"cpk:pointer-events-none cpk:absolute cpk:inset-0 cpk:flex cpk:items-center cpk:justify-center cpk:will-change-transform";
|
|
49
|
+
const iconWrapperBase = "cpk-chat-toggle-button-icon-wrapper";
|
|
56
50
|
|
|
57
51
|
function setModalOpen(open: boolean) {
|
|
58
52
|
if (config.value?.setModalOpen) {
|
|
@@ -9,7 +9,7 @@ export default defineComponent({
|
|
|
9
9
|
const { class: className, ...rest } = attrs as Record<string, unknown>;
|
|
10
10
|
return h(IconX, {
|
|
11
11
|
...rest,
|
|
12
|
-
class: ["cpk
|
|
12
|
+
class: ["cpk-chat-toggle-button-icon", className],
|
|
13
13
|
strokeWidth: 1.75,
|
|
14
14
|
});
|
|
15
15
|
};
|
|
@@ -9,7 +9,7 @@ export default defineComponent({
|
|
|
9
9
|
const { class: className, ...rest } = attrs as Record<string, unknown>;
|
|
10
10
|
return h(IconMessageCircle, {
|
|
11
11
|
...rest,
|
|
12
|
-
class: ["cpk
|
|
12
|
+
class: ["cpk-chat-toggle-button-icon", className],
|
|
13
13
|
strokeWidth: 1.75,
|
|
14
14
|
fill: "currentColor",
|
|
15
15
|
});
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Tool calls made in a row, collapsed into one summary. While a call runs the
|
|
4
|
+
* summary names it ("Running read_file src/app.ts"); once they're all done it
|
|
5
|
+
* reads "Used 3 tools" and opens to the calls.
|
|
6
|
+
*
|
|
7
|
+
* Each call is drawn by the `call` slot, which the tool calls view fills with
|
|
8
|
+
* the registered renderers. CopilotKit's built-in card (`useDefaultRenderTool`)
|
|
9
|
+
* draws a compact row inside the card and line appearances and an open stack;
|
|
10
|
+
* a custom wildcard renderer draws whatever it draws.
|
|
11
|
+
*/
|
|
12
|
+
import { computed, provide, ref } from "vue";
|
|
13
|
+
import {
|
|
14
|
+
ɵformatLabel,
|
|
15
|
+
ɵformatToolNames,
|
|
16
|
+
ɵgetToolCallPreview,
|
|
17
|
+
ɵgetToolCallRowStatus,
|
|
18
|
+
ɵformatCountLabel,
|
|
19
|
+
} from "@copilotkit/core";
|
|
20
|
+
import type { ToolCallEntry, ɵToolCallRowStatus } from "@copilotkit/core";
|
|
21
|
+
import { useCopilotId } from "../ui/use-id";
|
|
22
|
+
import { ToolCallGroupContextKey } from "./tool-call-display-context";
|
|
23
|
+
import type { ToolCallGroupContextValue } from "./tool-call-display-context";
|
|
24
|
+
import {
|
|
25
|
+
CopilotChatCollapsible,
|
|
26
|
+
ToolCallChevron,
|
|
27
|
+
ToolCallFailedCount,
|
|
28
|
+
ToolCallStatusIcon,
|
|
29
|
+
toolCallStatusLabel,
|
|
30
|
+
} from "./tool-call-group-parts";
|
|
31
|
+
import { useChatLabels } from "./use-chat-labels";
|
|
32
|
+
import type { CopilotChatToolCallGroupAppearance } from "./types";
|
|
33
|
+
|
|
34
|
+
const props = withDefaults(
|
|
35
|
+
defineProps<{
|
|
36
|
+
/** The calls in the group, in order. */
|
|
37
|
+
calls: ToolCallEntry[];
|
|
38
|
+
/**
|
|
39
|
+
* - `"card"` (default): one card with a summary header and a row per call.
|
|
40
|
+
* - `"line"`: a quiet line of text that opens to a list of rows.
|
|
41
|
+
* - `"stack"`: the latest call on a stack of the earlier ones.
|
|
42
|
+
*/
|
|
43
|
+
appearance?: CopilotChatToolCallGroupAppearance;
|
|
44
|
+
/** The agent is running and nothing follows the group, so more calls may join it. */
|
|
45
|
+
isActive?: boolean;
|
|
46
|
+
}>(),
|
|
47
|
+
{ appearance: "card", isActive: false },
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
defineSlots<{
|
|
51
|
+
/** Draws one call. */
|
|
52
|
+
call(props: { call: ToolCallEntry }): unknown;
|
|
53
|
+
}>();
|
|
54
|
+
|
|
55
|
+
const labels = useChatLabels();
|
|
56
|
+
const open = ref(false);
|
|
57
|
+
const bodyId = useCopilotId("cpk-tool-call-group");
|
|
58
|
+
const toggle = () => {
|
|
59
|
+
open.value = !open.value;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const latest = computed(() => props.calls[props.calls.length - 1]);
|
|
63
|
+
// Only an active group has a call in progress. Between calls nothing is
|
|
64
|
+
// running, so the latest call stays the subject (or the label flickers).
|
|
65
|
+
const current = computed(() =>
|
|
66
|
+
props.isActive
|
|
67
|
+
? (props.calls.find((call) => !call.toolMessage) ?? latest.value)
|
|
68
|
+
: undefined,
|
|
69
|
+
);
|
|
70
|
+
const preview = computed(() =>
|
|
71
|
+
current.value ? ɵgetToolCallPreview(current.value) : undefined,
|
|
72
|
+
);
|
|
73
|
+
const done = computed(
|
|
74
|
+
() => props.calls.filter((call) => call.toolMessage).length,
|
|
75
|
+
);
|
|
76
|
+
const statuses = computed(() =>
|
|
77
|
+
props.calls.map((call) => ɵgetToolCallRowStatus(call, props.isActive)),
|
|
78
|
+
);
|
|
79
|
+
const failedIds = computed(
|
|
80
|
+
() =>
|
|
81
|
+
new Set(
|
|
82
|
+
props.calls
|
|
83
|
+
.filter((_, index) => statuses.value[index] === "failed")
|
|
84
|
+
.map((call) => call.toolCall.id),
|
|
85
|
+
),
|
|
86
|
+
);
|
|
87
|
+
const status = computed<ɵToolCallRowStatus>(() =>
|
|
88
|
+
current.value
|
|
89
|
+
? "running"
|
|
90
|
+
: failedIds.value.size > 0
|
|
91
|
+
? "failed"
|
|
92
|
+
: statuses.value.includes("stopped")
|
|
93
|
+
? "stopped"
|
|
94
|
+
: "done",
|
|
95
|
+
);
|
|
96
|
+
const single = computed(
|
|
97
|
+
() =>
|
|
98
|
+
props.appearance === "line" && props.calls.length === 1 && !current.value,
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
provide(
|
|
102
|
+
ToolCallGroupContextKey,
|
|
103
|
+
computed<ToolCallGroupContextValue>(() => ({
|
|
104
|
+
appearance: props.appearance,
|
|
105
|
+
failedIds: failedIds.value,
|
|
106
|
+
active: props.isActive,
|
|
107
|
+
})),
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
// Stack: a lone call is the top card of a stack with nothing behind it yet.
|
|
111
|
+
const behind = computed(() =>
|
|
112
|
+
open.value ? 0 : Math.min(props.calls.length - 1, 2),
|
|
113
|
+
);
|
|
114
|
+
const latestStatus = computed(() =>
|
|
115
|
+
latest.value ? ɵgetToolCallRowStatus(latest.value, props.isActive) : "done",
|
|
116
|
+
);
|
|
117
|
+
const latestPreview = computed(() =>
|
|
118
|
+
latest.value ? ɵgetToolCallPreview(latest.value) : undefined,
|
|
119
|
+
);
|
|
120
|
+
const runningLabel = computed(() =>
|
|
121
|
+
current.value
|
|
122
|
+
? ɵformatLabel(labels.value.toolCallRunningLabel, {
|
|
123
|
+
name: current.value.toolCall.function.name,
|
|
124
|
+
})
|
|
125
|
+
: "",
|
|
126
|
+
);
|
|
127
|
+
const usedToolsLabel = computed(() =>
|
|
128
|
+
ɵformatCountLabel(props.calls.length, {
|
|
129
|
+
one: labels.value.toolCallUsedToolsOne,
|
|
130
|
+
other: labels.value.toolCallUsedToolsOther,
|
|
131
|
+
}),
|
|
132
|
+
);
|
|
133
|
+
const toolNames = computed(() => ɵformatToolNames(props.calls));
|
|
134
|
+
const latestStatusLabel = computed(() =>
|
|
135
|
+
toolCallStatusLabel(labels.value, latestStatus.value),
|
|
136
|
+
);
|
|
137
|
+
const layer = "cpk-tool-call-group-stack-layer";
|
|
138
|
+
</script>
|
|
139
|
+
|
|
140
|
+
<template>
|
|
141
|
+
<div
|
|
142
|
+
v-if="latest && single"
|
|
143
|
+
data-copilotkit
|
|
144
|
+
data-testid="copilot-tool-call-group"
|
|
145
|
+
:data-appearance="appearance"
|
|
146
|
+
:data-state="status"
|
|
147
|
+
class="cpk-tool-call-group cpk-tool-call-group-line cpk-tool-call-group-single"
|
|
148
|
+
>
|
|
149
|
+
<slot name="call" :call="latest" />
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
<div
|
|
153
|
+
v-else-if="latest && appearance === 'line'"
|
|
154
|
+
data-copilotkit
|
|
155
|
+
data-testid="copilot-tool-call-group"
|
|
156
|
+
:data-appearance="appearance"
|
|
157
|
+
:data-state="status"
|
|
158
|
+
class="cpk-tool-call-group cpk-tool-call-group-line"
|
|
159
|
+
>
|
|
160
|
+
<button
|
|
161
|
+
type="button"
|
|
162
|
+
:aria-expanded="open ? 'true' : 'false'"
|
|
163
|
+
:aria-controls="bodyId"
|
|
164
|
+
class="cpk-tool-call-group-line-toggle"
|
|
165
|
+
@click="toggle"
|
|
166
|
+
>
|
|
167
|
+
<template v-if="current">
|
|
168
|
+
<span class="cpk-tool-call-group-running cpk-shimmer">{{
|
|
169
|
+
runningLabel
|
|
170
|
+
}}</span>
|
|
171
|
+
<span v-if="preview" class="cpk-tool-call-group-preview">{{
|
|
172
|
+
preview
|
|
173
|
+
}}</span>
|
|
174
|
+
</template>
|
|
175
|
+
<template v-else>
|
|
176
|
+
<span class="cpk-tool-call-group-line-summary">{{
|
|
177
|
+
usedToolsLabel
|
|
178
|
+
}}</span>
|
|
179
|
+
<span class="cpk-tool-call-group-line-names">{{ toolNames }}</span>
|
|
180
|
+
<ToolCallFailedCount :calls="calls" />
|
|
181
|
+
</template>
|
|
182
|
+
<ToolCallChevron :open="open" />
|
|
183
|
+
</button>
|
|
184
|
+
<CopilotChatCollapsible :id="bodyId" :open="open">
|
|
185
|
+
<div class="cpk-tool-call-group-line-body">
|
|
186
|
+
<template v-for="call in calls" :key="call.toolCall.id">
|
|
187
|
+
<slot name="call" :call="call" />
|
|
188
|
+
</template>
|
|
189
|
+
</div>
|
|
190
|
+
</CopilotChatCollapsible>
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<div
|
|
194
|
+
v-else-if="latest && appearance === 'stack'"
|
|
195
|
+
data-copilotkit
|
|
196
|
+
data-testid="copilot-tool-call-group"
|
|
197
|
+
:data-appearance="appearance"
|
|
198
|
+
:data-state="status"
|
|
199
|
+
class="cpk-tool-call-group cpk-tool-call-group-stack"
|
|
200
|
+
:style="{ paddingBottom: `${behind * 6}px` }"
|
|
201
|
+
>
|
|
202
|
+
<div class="cpk-tool-call-group-stack-pile">
|
|
203
|
+
<div
|
|
204
|
+
v-for="index in behind"
|
|
205
|
+
:key="index"
|
|
206
|
+
aria-hidden="true"
|
|
207
|
+
:class="[layer, 'cpk-tool-call-group-stack-behind']"
|
|
208
|
+
:style="{
|
|
209
|
+
transform: `translateY(${index * 6}px) scaleX(${1 - index * 0.045})`,
|
|
210
|
+
zIndex: -index,
|
|
211
|
+
opacity: 1 - index * 0.28,
|
|
212
|
+
}"
|
|
213
|
+
/>
|
|
214
|
+
<!-- One toggle in both states, so it keeps keyboard focus when pressed. -->
|
|
215
|
+
<button
|
|
216
|
+
type="button"
|
|
217
|
+
:aria-expanded="open ? 'true' : 'false'"
|
|
218
|
+
:aria-controls="open ? bodyId : undefined"
|
|
219
|
+
:class="[
|
|
220
|
+
'cpk-tool-call-group-stack-toggle',
|
|
221
|
+
open
|
|
222
|
+
? 'cpk-tool-call-group-stack-toggle-open'
|
|
223
|
+
: [layer, 'cpk-tool-call-group-stack-toggle-closed'],
|
|
224
|
+
]"
|
|
225
|
+
@click="toggle"
|
|
226
|
+
>
|
|
227
|
+
<template v-if="open">
|
|
228
|
+
{{
|
|
229
|
+
ɵformatCountLabel(calls.length, {
|
|
230
|
+
one: labels.toolCallToolCallCountOne,
|
|
231
|
+
other: labels.toolCallToolCallCountOther,
|
|
232
|
+
})
|
|
233
|
+
}}
|
|
234
|
+
<ToolCallFailedCount :calls="calls" />
|
|
235
|
+
<span class="cpk-tool-call-group-stack-collapse">
|
|
236
|
+
{{ labels.toolCallCollapseLabel }}
|
|
237
|
+
<ToolCallChevron
|
|
238
|
+
:open="true"
|
|
239
|
+
class="cpk-tool-call-group-stack-collapse-icon"
|
|
240
|
+
/>
|
|
241
|
+
</span>
|
|
242
|
+
</template>
|
|
243
|
+
<template v-else>
|
|
244
|
+
<span
|
|
245
|
+
:key="latest.toolCall.id"
|
|
246
|
+
class="cpk-tool-call-group-stack-latest"
|
|
247
|
+
>
|
|
248
|
+
<ToolCallStatusIcon :status="latestStatus" />
|
|
249
|
+
<span
|
|
250
|
+
:class="[
|
|
251
|
+
'cpk-tool-call-group-stack-name',
|
|
252
|
+
latestStatus === 'running' && 'cpk-shimmer',
|
|
253
|
+
]"
|
|
254
|
+
>{{ latest.toolCall.function.name }}</span
|
|
255
|
+
>
|
|
256
|
+
<span
|
|
257
|
+
v-if="latestPreview"
|
|
258
|
+
class="cpk-tool-call-group-stack-preview"
|
|
259
|
+
>{{ latestPreview }}</span
|
|
260
|
+
>
|
|
261
|
+
<!-- The status icon is decorative, so say the status. -->
|
|
262
|
+
<span class="cpk-tool-call-group-stack-status">{{
|
|
263
|
+
latestStatusLabel
|
|
264
|
+
}}</span>
|
|
265
|
+
</span>
|
|
266
|
+
<span class="cpk-tool-call-group-stack-meta">
|
|
267
|
+
<ToolCallFailedCount :calls="calls" />
|
|
268
|
+
<span class="cpk-tool-call-group-stack-count">{{
|
|
269
|
+
ɵformatCountLabel(calls.length, {
|
|
270
|
+
one: labels.toolCallCallCountOne,
|
|
271
|
+
other: labels.toolCallCallCountOther,
|
|
272
|
+
})
|
|
273
|
+
}}</span>
|
|
274
|
+
<ToolCallChevron
|
|
275
|
+
:open="false"
|
|
276
|
+
class="cpk-tool-call-group-stack-expand-icon"
|
|
277
|
+
/>
|
|
278
|
+
</span>
|
|
279
|
+
</template>
|
|
280
|
+
</button>
|
|
281
|
+
<!-- Always mounted, so screen readers hear the closed stack's latest
|
|
282
|
+
call change ("read_file: Running", then "read_file: Done"); the
|
|
283
|
+
button only names it. -->
|
|
284
|
+
<span aria-live="polite" class="cpk-tool-call-group-stack-live">{{
|
|
285
|
+
open ? "" : `${latest.toolCall.function.name}: ${latestStatusLabel}`
|
|
286
|
+
}}</span>
|
|
287
|
+
</div>
|
|
288
|
+
<!-- Each call gets the collapsed stack's card, easing out of the stack. -->
|
|
289
|
+
<div v-if="open" :id="bodyId" class="cpk-tool-call-group-stack-items">
|
|
290
|
+
<div
|
|
291
|
+
v-for="(call, index) in calls"
|
|
292
|
+
:key="call.toolCall.id"
|
|
293
|
+
:class="[layer, 'cpk-tool-call-group-stack-item']"
|
|
294
|
+
:style="{ animationDelay: `${index * 30}ms` }"
|
|
295
|
+
>
|
|
296
|
+
<slot name="call" :call="call" />
|
|
297
|
+
</div>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
|
|
301
|
+
<!-- card: one call gets the same card as several, so the card a run
|
|
302
|
+
starts with doesn't change style when the next call joins it. -->
|
|
303
|
+
<div
|
|
304
|
+
v-else-if="latest"
|
|
305
|
+
data-copilotkit
|
|
306
|
+
data-testid="copilot-tool-call-group"
|
|
307
|
+
:data-appearance="appearance"
|
|
308
|
+
:data-state="status"
|
|
309
|
+
class="cpk-tool-call-group cpk-tool-call-group-card"
|
|
310
|
+
>
|
|
311
|
+
<button
|
|
312
|
+
type="button"
|
|
313
|
+
:aria-expanded="open ? 'true' : 'false'"
|
|
314
|
+
:aria-controls="bodyId"
|
|
315
|
+
class="cpk-tool-call-group-card-toggle"
|
|
316
|
+
@click="toggle"
|
|
317
|
+
>
|
|
318
|
+
<ToolCallStatusIcon :status="status" />
|
|
319
|
+
<template v-if="current">
|
|
320
|
+
<span class="cpk-tool-call-group-running cpk-shimmer">{{
|
|
321
|
+
runningLabel
|
|
322
|
+
}}</span>
|
|
323
|
+
<span v-if="preview" class="cpk-tool-call-group-preview">{{
|
|
324
|
+
preview
|
|
325
|
+
}}</span>
|
|
326
|
+
</template>
|
|
327
|
+
<template v-else>
|
|
328
|
+
<span class="cpk-tool-call-group-card-summary">{{
|
|
329
|
+
usedToolsLabel
|
|
330
|
+
}}</span>
|
|
331
|
+
<span class="cpk-tool-call-group-card-names">{{ toolNames }}</span>
|
|
332
|
+
</template>
|
|
333
|
+
<span class="cpk-tool-call-group-card-meta">
|
|
334
|
+
<ToolCallFailedCount v-if="status === 'failed'" :calls="calls" />
|
|
335
|
+
<span v-else class="cpk-tool-call-group-card-status">{{
|
|
336
|
+
status !== "running"
|
|
337
|
+
? toolCallStatusLabel(labels, status)
|
|
338
|
+
: done > 0
|
|
339
|
+
? ɵformatLabel(labels.toolCallDoneCountLabel, { count: done })
|
|
340
|
+
: ""
|
|
341
|
+
}}</span>
|
|
342
|
+
<ToolCallChevron :open="open" />
|
|
343
|
+
</span>
|
|
344
|
+
</button>
|
|
345
|
+
<CopilotChatCollapsible :id="bodyId" :open="open">
|
|
346
|
+
<div>
|
|
347
|
+
<template v-for="call in calls" :key="call.toolCall.id">
|
|
348
|
+
<slot name="call" :call="call" />
|
|
349
|
+
</template>
|
|
350
|
+
</div>
|
|
351
|
+
</CopilotChatCollapsible>
|
|
352
|
+
</div>
|
|
353
|
+
</template>
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { Message, ToolCall } from "@ag-ui/core";
|
|
3
3
|
import { DEFAULT_AGENT_ID } from "@copilotkit/shared";
|
|
4
|
+
import { ɵresolveToolCallRenderer } from "@copilotkit/core";
|
|
4
5
|
import { useCopilotKit } from "../../providers/useCopilotKit";
|
|
5
6
|
import { useCopilotChatConfiguration } from "../../providers/useCopilotChatConfiguration";
|
|
6
7
|
import type { CopilotChatToolCallRenderSlotProps } from "./types";
|
|
7
8
|
import {
|
|
8
|
-
getCoreRenderConfig,
|
|
9
9
|
getCoreRenderProps,
|
|
10
10
|
getToolCallMemoDeps,
|
|
11
11
|
getToolCallRenderProps,
|
|
12
12
|
getToolCallSlotName,
|
|
13
13
|
} from "./copilotChatToolCallItemRender";
|
|
14
|
+
import {
|
|
15
|
+
ToolCallCaptureScope,
|
|
16
|
+
useLearningConfigured,
|
|
17
|
+
} from "./tool-call-capture";
|
|
14
18
|
|
|
15
19
|
const props = withDefaults(
|
|
16
20
|
defineProps<{
|
|
@@ -31,6 +35,7 @@ defineSlots<{
|
|
|
31
35
|
|
|
32
36
|
const { copilotkit, executingToolCallIds } = useCopilotKit();
|
|
33
37
|
const config = useCopilotChatConfiguration();
|
|
38
|
+
const learningConfigured = useLearningConfigured(copilotkit);
|
|
34
39
|
|
|
35
40
|
function getRenderProps(): CopilotChatToolCallRenderSlotProps {
|
|
36
41
|
return getToolCallRenderProps(
|
|
@@ -50,9 +55,9 @@ function getCoreProps() {
|
|
|
50
55
|
|
|
51
56
|
function getRenderConfig() {
|
|
52
57
|
const agentId = config.value?.agentId ?? DEFAULT_AGENT_ID;
|
|
53
|
-
return
|
|
54
|
-
props.toolCall,
|
|
58
|
+
return ɵresolveToolCallRenderer(
|
|
55
59
|
copilotkit.value.renderToolCalls,
|
|
60
|
+
props.toolCall.function.name,
|
|
56
61
|
agentId,
|
|
57
62
|
);
|
|
58
63
|
}
|
|
@@ -70,17 +75,22 @@ function getMemoDeps() {
|
|
|
70
75
|
</script>
|
|
71
76
|
|
|
72
77
|
<template>
|
|
73
|
-
<
|
|
74
|
-
:
|
|
75
|
-
|
|
78
|
+
<ToolCallCaptureScope
|
|
79
|
+
:tool-call-id="toolCall.id"
|
|
80
|
+
:enabled="learningConfigured"
|
|
76
81
|
>
|
|
77
|
-
<slot
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
<slot
|
|
83
|
+
:name="getToolCallSlotName(toolCall.function.name)"
|
|
84
|
+
v-bind="getRenderProps()"
|
|
85
|
+
>
|
|
86
|
+
<slot name="tool-call" v-bind="getRenderProps()">
|
|
87
|
+
<component
|
|
88
|
+
:is="getRenderConfig()?.render"
|
|
89
|
+
v-if="getRenderConfig()"
|
|
90
|
+
v-memo="getMemoDeps()"
|
|
91
|
+
v-bind="getCoreProps()"
|
|
92
|
+
/>
|
|
93
|
+
</slot>
|
|
84
94
|
</slot>
|
|
85
|
-
</
|
|
95
|
+
</ToolCallCaptureScope>
|
|
86
96
|
</template>
|