@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
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { defineComponent, h, inject, ref } from "vue";
|
|
2
2
|
import type { WatchSource } from "vue";
|
|
3
3
|
import type { Component, VNodeChild } from "vue";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ɵgetToolCallBadge,
|
|
6
|
+
ɵnormalizeToolCallStatus,
|
|
7
|
+
ɵstringifyToolCallAttr,
|
|
8
|
+
ɵstringifyToolCallPayload,
|
|
9
|
+
} from "@copilotkit/core";
|
|
10
|
+
import type { ToolCallStatus } from "@copilotkit/core";
|
|
5
11
|
import { useRenderTool } from "./use-render-tool";
|
|
6
12
|
import { ToolCallGroupContextKey } from "../components/chat/tool-call-display-context";
|
|
7
13
|
import { ToolCallRow } from "../components/chat/tool-call-group-parts";
|
|
14
|
+
import { useChatLabels } from "../components/chat/use-chat-labels";
|
|
8
15
|
|
|
9
16
|
type DefaultRenderProps = {
|
|
10
17
|
name: string;
|
|
@@ -30,24 +37,16 @@ const warnedUnknownStatuses = new Set<string>();
|
|
|
30
37
|
function mapToolCallStatus(
|
|
31
38
|
status: ToolCallStatus,
|
|
32
39
|
): DefaultRenderProps["status"] {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const key = String(status);
|
|
42
|
-
if (!warnedUnknownStatuses.has(key)) {
|
|
43
|
-
warnedUnknownStatuses.add(key);
|
|
44
|
-
console.warn(
|
|
45
|
-
`[CopilotKit] Unknown ToolCallStatus "${key}" in default tool-call renderer; falling back to "inProgress".`,
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
return "inProgress";
|
|
49
|
-
}
|
|
40
|
+
const normalized = ɵnormalizeToolCallStatus(status);
|
|
41
|
+
if (normalized !== "unknown") return normalized;
|
|
42
|
+
const key = String(status);
|
|
43
|
+
if (!warnedUnknownStatuses.has(key)) {
|
|
44
|
+
warnedUnknownStatuses.add(key);
|
|
45
|
+
console.warn(
|
|
46
|
+
`[CopilotKit] Unknown ToolCallStatus "${key}" in default tool-call renderer; falling back to "inProgress".`,
|
|
47
|
+
);
|
|
50
48
|
}
|
|
49
|
+
return "inProgress";
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
/**
|
|
@@ -82,30 +81,6 @@ function adaptRendererProps(raw: AdaptInput): DefaultRenderProps {
|
|
|
82
81
|
};
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
/**
|
|
86
|
-
* Guarded JSON.stringify for the expanded `<pre>` blocks. A circular reference
|
|
87
|
-
* would otherwise crash the Vue render.
|
|
88
|
-
*/
|
|
89
|
-
function safeStringifyForPre(value: unknown): string {
|
|
90
|
-
try {
|
|
91
|
-
return JSON.stringify(value, null, 2);
|
|
92
|
-
} catch (err) {
|
|
93
|
-
console.warn(
|
|
94
|
-
"[CopilotKit] Failed to JSON.stringify tool-call payload for default renderer; falling back to String():",
|
|
95
|
-
err,
|
|
96
|
-
);
|
|
97
|
-
try {
|
|
98
|
-
return String(value);
|
|
99
|
-
} catch (innerErr) {
|
|
100
|
-
console.warn(
|
|
101
|
-
"[CopilotKit] safeStringifyForPre: value could not be stringified:",
|
|
102
|
-
innerErr,
|
|
103
|
-
);
|
|
104
|
-
return "[unserializable]";
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
84
|
const DefaultToolCallRenderer = defineComponent({
|
|
110
85
|
props: {
|
|
111
86
|
name: {
|
|
@@ -127,7 +102,7 @@ const DefaultToolCallRenderer = defineComponent({
|
|
|
127
102
|
},
|
|
128
103
|
result: {
|
|
129
104
|
// Typeless on purpose: the renderer body handles both string results
|
|
130
|
-
// and structured (object) results via
|
|
105
|
+
// and structured (object) results via `ɵstringifyToolCallPayload`. Declaring
|
|
131
106
|
// `type: String` would trip Vue's dev-mode prop-type warning on every
|
|
132
107
|
// non-string result and make the defensive branch unreachable.
|
|
133
108
|
type: null,
|
|
@@ -138,42 +113,31 @@ const DefaultToolCallRenderer = defineComponent({
|
|
|
138
113
|
setup(props) {
|
|
139
114
|
const isExpanded = ref(false);
|
|
140
115
|
const groupContext = inject(ToolCallGroupContextKey, null);
|
|
116
|
+
const labels = useChatLabels();
|
|
141
117
|
|
|
142
118
|
return () => {
|
|
143
119
|
const group = groupContext?.value;
|
|
120
|
+
// A status a newer runtime could send reads "unknown".
|
|
121
|
+
const cardStatus = ɵnormalizeToolCallStatus(props.status);
|
|
144
122
|
// Inside a group of calls, a row that fits the group instead of a card.
|
|
145
123
|
if (group) {
|
|
146
124
|
return h(ToolCallRow, {
|
|
147
125
|
"data-testid": "copilot-tool-render",
|
|
148
126
|
"data-tool-name": props.name,
|
|
149
127
|
"data-tool-call-id": props.toolCallId,
|
|
150
|
-
"data-status":
|
|
151
|
-
"data-args":
|
|
152
|
-
"data-result":
|
|
128
|
+
"data-status": cardStatus,
|
|
129
|
+
"data-args": ɵstringifyToolCallAttr(props.parameters),
|
|
130
|
+
"data-result": ɵstringifyToolCallAttr(props.result),
|
|
153
131
|
name: props.name,
|
|
154
132
|
parameters: props.parameters,
|
|
155
133
|
result: props.result,
|
|
156
|
-
status:
|
|
157
|
-
props.status === "complete"
|
|
158
|
-
? group.failedIds.has(props.toolCallId)
|
|
159
|
-
? "failed"
|
|
160
|
-
: "done"
|
|
161
|
-
: group.active
|
|
162
|
-
? "running"
|
|
163
|
-
: "stopped",
|
|
134
|
+
status: group.statusById.get(props.toolCallId) ?? "done",
|
|
164
135
|
appearance: group.appearance,
|
|
165
136
|
});
|
|
166
137
|
}
|
|
167
138
|
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
const isComplete = props.status === "complete";
|
|
171
|
-
const statusLabel = isActive
|
|
172
|
-
? "Running"
|
|
173
|
-
: isComplete
|
|
174
|
-
? "Done"
|
|
175
|
-
: props.status;
|
|
176
|
-
const tone = isActive ? "running" : isComplete ? "done" : "other";
|
|
139
|
+
const { tone, labelKey } = ɵgetToolCallBadge(cardStatus);
|
|
140
|
+
const statusLabel = labels.value[labelKey];
|
|
177
141
|
|
|
178
142
|
// Markup and classes match React's DefaultToolCallRenderer; styles live
|
|
179
143
|
// in @copilotkit/core (default-tool-call.css).
|
|
@@ -183,9 +147,9 @@ const DefaultToolCallRenderer = defineComponent({
|
|
|
183
147
|
"data-testid": "copilot-tool-render",
|
|
184
148
|
"data-tool-name": props.name,
|
|
185
149
|
"data-tool-call-id": props.toolCallId,
|
|
186
|
-
"data-status":
|
|
187
|
-
"data-args":
|
|
188
|
-
"data-result":
|
|
150
|
+
"data-status": cardStatus,
|
|
151
|
+
"data-args": ɵstringifyToolCallAttr(props.parameters),
|
|
152
|
+
"data-result": ɵstringifyToolCallAttr(props.result),
|
|
189
153
|
class: "cpk-default-tool-call",
|
|
190
154
|
},
|
|
191
155
|
[
|
|
@@ -252,12 +216,12 @@ const DefaultToolCallRenderer = defineComponent({
|
|
|
252
216
|
h(
|
|
253
217
|
"div",
|
|
254
218
|
{ class: "cpk-default-tool-call-label" },
|
|
255
|
-
|
|
219
|
+
labels.value.toolCallArgumentsLabel,
|
|
256
220
|
),
|
|
257
221
|
h(
|
|
258
222
|
"pre",
|
|
259
223
|
{ class: "cpk-default-tool-call-code" },
|
|
260
|
-
|
|
224
|
+
ɵstringifyToolCallPayload(props.parameters ?? {}),
|
|
261
225
|
),
|
|
262
226
|
]),
|
|
263
227
|
props.result !== undefined
|
|
@@ -265,14 +229,12 @@ const DefaultToolCallRenderer = defineComponent({
|
|
|
265
229
|
h(
|
|
266
230
|
"div",
|
|
267
231
|
{ class: "cpk-default-tool-call-label" },
|
|
268
|
-
|
|
232
|
+
labels.value.toolCallResultLabel,
|
|
269
233
|
),
|
|
270
234
|
h(
|
|
271
235
|
"pre",
|
|
272
236
|
{ class: "cpk-default-tool-call-code" },
|
|
273
|
-
|
|
274
|
-
? props.result
|
|
275
|
-
: safeStringifyForPre(props.result),
|
|
237
|
+
ɵstringifyToolCallPayload(props.result),
|
|
276
238
|
),
|
|
277
239
|
])
|
|
278
240
|
: null,
|
|
@@ -285,28 +247,6 @@ const DefaultToolCallRenderer = defineComponent({
|
|
|
285
247
|
},
|
|
286
248
|
});
|
|
287
249
|
|
|
288
|
-
function safeStringifyForAttr(value: unknown): string {
|
|
289
|
-
if (value === undefined || value === null) return "";
|
|
290
|
-
if (typeof value === "string") return value;
|
|
291
|
-
try {
|
|
292
|
-
return JSON.stringify(value);
|
|
293
|
-
} catch (err) {
|
|
294
|
-
console.warn(
|
|
295
|
-
"[CopilotKit] Failed to JSON.stringify tool-call payload for data-* attribute; falling back to String():",
|
|
296
|
-
err,
|
|
297
|
-
);
|
|
298
|
-
try {
|
|
299
|
-
return String(value);
|
|
300
|
-
} catch (innerErr) {
|
|
301
|
-
console.warn(
|
|
302
|
-
"[CopilotKit] safeStringifyForAttr: value could not be stringified:",
|
|
303
|
-
innerErr,
|
|
304
|
-
);
|
|
305
|
-
return "";
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
250
|
export function useDefaultRenderTool(
|
|
311
251
|
config?: {
|
|
312
252
|
render?:
|
|
@@ -12,6 +12,11 @@ const EMPTY_DEPS: WatchSource<unknown>[] = [];
|
|
|
12
12
|
* The tool registration is reactive to provided dependencies and is cleaned up
|
|
13
13
|
* automatically when the current scope is disposed.
|
|
14
14
|
*
|
|
15
|
+
* A tool with the same name and `agentId` as a tool that is already
|
|
16
|
+
* registered (for example a provider `frontendTools` entry) takes its place
|
|
17
|
+
* while this scope is active. When the scope is disposed, the earlier tool is
|
|
18
|
+
* active again.
|
|
19
|
+
*
|
|
15
20
|
* @example
|
|
16
21
|
* ```ts
|
|
17
22
|
* useFrontendTool({
|
|
@@ -42,13 +47,10 @@ export function useFrontendTool<T extends Record<string, unknown>>(
|
|
|
42
47
|
const core = copilotkit.value;
|
|
43
48
|
const name = tool.name;
|
|
44
49
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
core.removeTool(name, tool.agentId);
|
|
50
|
-
}
|
|
51
|
-
core.addTool(tool);
|
|
50
|
+
// Registrations stack in core: this one shadows an earlier tool with the
|
|
51
|
+
// same name and agentId (a provider tool, or another component's), and
|
|
52
|
+
// unregistering it brings that tool back.
|
|
53
|
+
const unregister = core.addTool(tool);
|
|
52
54
|
|
|
53
55
|
// The render function is registered even when tool.parameters is
|
|
54
56
|
// undefined — tools like HITL confirm dialogs have no parameters
|
|
@@ -62,9 +64,7 @@ export function useFrontendTool<T extends Record<string, unknown>>(
|
|
|
62
64
|
} as VueToolCallRenderer<unknown>);
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
onCleanup(
|
|
66
|
-
core.removeTool(name, tool.agentId);
|
|
67
|
-
});
|
|
67
|
+
onCleanup(unregister);
|
|
68
68
|
},
|
|
69
69
|
{ immediate: true },
|
|
70
70
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { onScopeDispose
|
|
1
|
+
import { onScopeDispose } from "vue";
|
|
2
2
|
import type { WatchSource } from "vue";
|
|
3
3
|
import { h } from "vue";
|
|
4
|
-
import {
|
|
4
|
+
import { ɵbuildHumanInTheLoopTool, ɵhitlRenderProps } from "@copilotkit/core";
|
|
5
5
|
import { useCopilotKit } from "../providers/useCopilotKit";
|
|
6
6
|
import { useFrontendTool } from "./use-frontend-tool";
|
|
7
7
|
import type {
|
|
@@ -15,7 +15,8 @@ import type {
|
|
|
15
15
|
* Registers a human-in-the-loop frontend tool.
|
|
16
16
|
*
|
|
17
17
|
* The tool pauses execution until `respond` is called from the rendered
|
|
18
|
-
* component during the `executing` phase.
|
|
18
|
+
* component during the `executing` phase. Each call waits on its own
|
|
19
|
+
* `respond`, so parallel calls of one tool stay independent.
|
|
19
20
|
*
|
|
20
21
|
* @example
|
|
21
22
|
* ```ts
|
|
@@ -31,88 +32,18 @@ export function useHumanInTheLoop<T extends Record<string, unknown>>(
|
|
|
31
32
|
deps?: WatchSource<unknown>[],
|
|
32
33
|
) {
|
|
33
34
|
const { copilotkit } = useCopilotKit();
|
|
34
|
-
const
|
|
35
|
-
const rejectPromiseRef = ref<((error: unknown) => void) | null>(null);
|
|
36
|
-
const cleanupAbortRef = ref<(() => void) | null>(null);
|
|
37
|
-
|
|
38
|
-
const respond = async (result: unknown) => {
|
|
39
|
-
if (resolvePromiseRef.value) {
|
|
40
|
-
cleanupAbortRef.value?.();
|
|
41
|
-
cleanupAbortRef.value = null;
|
|
42
|
-
resolvePromiseRef.value(result);
|
|
43
|
-
resolvePromiseRef.value = null;
|
|
44
|
-
rejectPromiseRef.value = null;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const handler = async (_args: T, context?: { signal?: AbortSignal }) => {
|
|
49
|
-
const signal = context?.signal;
|
|
50
|
-
return new Promise((resolve, reject) => {
|
|
51
|
-
if (signal?.aborted) {
|
|
52
|
-
reject(new Error("Human-in-the-loop interaction aborted"));
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
resolvePromiseRef.value = resolve;
|
|
57
|
-
rejectPromiseRef.value = reject;
|
|
58
|
-
|
|
59
|
-
if (signal) {
|
|
60
|
-
const onAbort = () => {
|
|
61
|
-
cleanupAbortRef.value = null;
|
|
62
|
-
resolvePromiseRef.value = null;
|
|
63
|
-
const rejectPending = rejectPromiseRef.value;
|
|
64
|
-
rejectPromiseRef.value = null;
|
|
65
|
-
rejectPending?.(new Error("Human-in-the-loop interaction aborted"));
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
69
|
-
cleanupAbortRef.value = () => {
|
|
70
|
-
signal.removeEventListener("abort", onAbort);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
};
|
|
35
|
+
const registry = () => copilotkit.value.ɵhumanInTheLoop;
|
|
75
36
|
|
|
76
37
|
const RenderComponent: VueToolCallRenderer<T>["render"] = (
|
|
77
38
|
props: VueToolCallRendererRenderProps<T>,
|
|
78
|
-
) =>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
name: tool.name,
|
|
84
|
-
description: tool.description || "",
|
|
85
|
-
agentId: tool.agentId,
|
|
86
|
-
respond: undefined,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
if (props.status === ToolCallStatus.Executing) {
|
|
90
|
-
return h(ToolComponent as Parameters<typeof h>[0], {
|
|
91
|
-
...props,
|
|
92
|
-
name: tool.name,
|
|
93
|
-
description: tool.description || "",
|
|
94
|
-
agentId: tool.agentId,
|
|
95
|
-
respond,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
if (props.status === ToolCallStatus.Complete) {
|
|
99
|
-
return h(ToolComponent as Parameters<typeof h>[0], {
|
|
100
|
-
...props,
|
|
101
|
-
name: tool.name,
|
|
102
|
-
description: tool.description || "",
|
|
103
|
-
agentId: tool.agentId,
|
|
104
|
-
respond: undefined,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const exhaustiveCheck: never = props;
|
|
109
|
-
return exhaustiveCheck;
|
|
110
|
-
};
|
|
39
|
+
) =>
|
|
40
|
+
h(
|
|
41
|
+
tool.render as Parameters<typeof h>[0],
|
|
42
|
+
ɵhitlRenderProps<T, typeof props>(props, tool, registry()),
|
|
43
|
+
);
|
|
111
44
|
|
|
112
45
|
const frontendTool: VueFrontendTool<T> = {
|
|
113
|
-
|
|
114
|
-
type: "human-in-the-loop",
|
|
115
|
-
handler,
|
|
46
|
+
...ɵbuildHumanInTheLoopTool<T>(tool, registry),
|
|
116
47
|
render: RenderComponent,
|
|
117
48
|
};
|
|
118
49
|
|