@copilotkit/vue 2.0.0-rc.3 → 2.0.0-rc.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTOR_GUIDE.md +1 -1
- package/PARITY.md +3 -3
- package/dist/hooks/use-copilot-action.d.ts.map +1 -1
- package/dist/hooks/use-frontend-tool.d.ts +1 -1
- package/dist/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/hooks/zod-parameters.d.ts +14 -0
- package/dist/hooks/zod-parameters.d.ts.map +1 -0
- package/dist/index.cjs +1 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +365 -16920
- package/dist/index.mjs.map +1 -1
- package/dist/use-render-activity-message-BZJ33B_r.cjs +113 -0
- package/dist/use-render-activity-message-BZJ33B_r.cjs.map +1 -0
- package/dist/use-render-activity-message-DrR407LQ.js +15901 -0
- package/dist/use-render-activity-message-DrR407LQ.js.map +1 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts +14 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -1
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts +10 -3
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/CopilotKitInspector.vue.d.ts +5 -1
- package/dist/v2/components/CopilotKitInspector.vue.d.ts.map +1 -1
- package/dist/v2/components/InlineFeatureWarning.vue.d.ts.map +1 -1
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts +2 -2
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -1
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts.map +1 -1
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +13 -59
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +3 -11
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +10 -15
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +14 -130
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -1
- package/dist/v2/components/a2ui/catalog.d.ts.map +1 -1
- package/dist/v2/components/a2ui/utils.d.ts +3 -15
- package/dist/v2/components/a2ui/utils.d.ts.map +1 -1
- package/dist/v2/components/a2ui.d.ts +9 -8
- package/dist/v2/components/a2ui.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChat.vue.d.ts +2 -2
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts +4 -8
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +7 -286
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +3 -3
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts +8 -3
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +5 -3
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +5 -3
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +8 -3
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +6 -4
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +6 -4
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotThreadsDrawer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts +1 -0
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/audioRecorder.d.ts +3 -4
- package/dist/v2/components/chat/audioRecorder.d.ts.map +1 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +4 -4
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
- package/dist/v2/components/chat/forwarded-slots.d.ts +12 -0
- package/dist/v2/components/chat/forwarded-slots.d.ts.map +1 -0
- package/dist/v2/components/chat/index.d.ts +34 -31
- package/dist/v2/components/chat/index.d.ts.map +1 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts +2 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts.map +1 -1
- package/dist/v2/components/chat/message-feedback.d.ts +38 -49
- package/dist/v2/components/chat/message-feedback.d.ts.map +1 -1
- package/dist/v2/components/chat/tool-call-display-context.d.ts +4 -19
- package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -1
- package/dist/v2/components/chat/tool-call-group-parts.d.ts +7 -20
- package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -1
- package/dist/v2/components/chat/turn-work.d.ts +0 -2
- package/dist/v2/components/chat/turn-work.d.ts.map +1 -1
- package/dist/v2/components/chat/types.d.ts +9 -4
- package/dist/v2/components/chat/types.d.ts.map +1 -1
- package/dist/v2/components/chat/use-chat-labels.d.ts +8 -0
- package/dist/v2/components/chat/use-chat-labels.d.ts.map +1 -0
- package/dist/v2/components/chat/use-copy-feedback.d.ts +11 -0
- package/dist/v2/components/chat/use-copy-feedback.d.ts.map +1 -0
- package/dist/v2/components/chat/use-lightbox.d.ts.map +1 -1
- package/dist/v2/components/icons/index.d.ts +968 -1
- package/dist/v2/components/icons/index.d.ts.map +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts.map +1 -1
- package/dist/v2/hooks/use-agent-context.d.ts +2 -3
- package/dist/v2/hooks/use-agent-context.d.ts.map +1 -1
- package/dist/v2/hooks/use-agent.d.ts +4 -1
- package/dist/v2/hooks/use-agent.d.ts.map +1 -1
- package/dist/v2/hooks/use-attachments.d.ts +7 -0
- package/dist/v2/hooks/use-attachments.d.ts.map +1 -1
- package/dist/v2/hooks/use-capabilities.d.ts.map +1 -1
- package/dist/v2/hooks/use-component.d.ts +1 -0
- package/dist/v2/hooks/use-component.d.ts.map +1 -1
- package/dist/v2/hooks/use-configure-suggestions.d.ts +4 -9
- package/dist/v2/hooks/use-configure-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-default-render-tool.d.ts +2 -7
- package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-frontend-tool.d.ts +5 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-human-in-the-loop.d.ts +2 -1
- package/dist/v2/hooks/use-human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/hooks/use-interrupt.d.ts +0 -1
- package/dist/v2/hooks/use-interrupt.d.ts.map +1 -1
- package/dist/v2/hooks/use-keyboard-height.d.ts +1 -1
- package/dist/v2/hooks/use-keyboard-height.d.ts.map +1 -1
- package/dist/v2/hooks/use-pin-to-send.d.ts +4 -12
- package/dist/v2/hooks/use-pin-to-send.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-activity-message.d.ts +13 -9
- package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-custom-messages.d.ts +5 -7
- package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-tool.d.ts +1 -1
- package/dist/v2/hooks/use-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-threads.d.ts +6 -23
- package/dist/v2/hooks/use-threads.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +197 -200
- package/dist/v2/index.mjs.map +1 -1
- package/dist/v2/lib/processPartialHtml.d.ts +1 -2
- package/dist/v2/lib/processPartialHtml.d.ts.map +1 -1
- package/dist/v2/lib/shallow-stable.d.ts.map +1 -1
- package/dist/v2/lib/vue-core.d.ts +33 -19
- package/dist/v2/lib/vue-core.d.ts.map +1 -1
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +9 -129
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +9 -10
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/chat-configuration-store-key.d.ts +8 -0
- package/dist/v2/providers/chat-configuration-store-key.d.ts.map +1 -0
- package/dist/v2/providers/markdown-renderer.d.ts +4 -2
- package/dist/v2/providers/markdown-renderer.d.ts.map +1 -1
- package/dist/v2/providers/types.d.ts +3 -46
- package/dist/v2/providers/types.d.ts.map +1 -1
- package/dist/v2/providers/use-inspector-thread-override.d.ts +5 -0
- package/dist/v2/providers/use-inspector-thread-override.d.ts.map +1 -1
- package/dist/v2/types/defineToolCallRenderer.d.ts +1 -1
- package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/types/human-in-the-loop.d.ts +8 -29
- package/dist/v2/types/human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/types/interrupt.d.ts +1 -22
- package/dist/v2/types/interrupt.d.ts.map +1 -1
- package/dist/v2/types/vue-activity-message-renderer.d.ts +16 -15
- package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-custom-message-renderer.d.ts +7 -16
- package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-tool-call-renderer.d.ts +16 -35
- package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
- package/package.json +12 -13
- package/src/__tests__/build-entries.test.ts +29 -0
- package/src/hooks/__tests__/zod-parameters.test.ts +520 -0
- package/src/hooks/use-copilot-action.ts +2 -1
- package/src/hooks/use-frontend-tool.ts +3 -6
- package/src/hooks/zod-parameters.ts +162 -0
- package/src/v2/__tests__/exports.test.ts +10 -0
- package/src/v2/__tests__/mocks/web-inspector.ts +6 -0
- package/src/v2/__tests__/utils/test-helpers.ts +34 -4
- package/src/v2/components/A2UIMessageRenderer.ts +98 -68
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +68 -103
- package/src/v2/components/CopilotKitInspector.vue +104 -51
- package/src/v2/components/InlineFeatureWarning.vue +20 -21
- package/src/v2/components/LicenseWarningBanner.vue +27 -135
- package/src/v2/components/MCPAppsActivityRenderer.ts +75 -201
- package/src/v2/components/OpenGenerativeUIRenderer.ts +122 -446
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +171 -8
- package/src/v2/components/__tests__/CopilotKitInspector.test.ts +42 -0
- package/src/v2/components/__tests__/LicenseWarningBanner.test.ts +60 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +64 -8
- package/src/v2/components/__tests__/OpenGenerativeUIToolRenderer.test.ts +38 -0
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +6 -26
- package/src/v2/components/a2ui/A2UICatalogContext.ts +27 -185
- package/src/v2/components/a2ui/A2UIRecoveryStates.ts +127 -327
- package/src/v2/components/a2ui/catalog.ts +3 -3
- package/src/v2/components/a2ui/utils.ts +13 -65
- package/src/v2/components/a2ui.ts +15 -22
- package/src/v2/components/chat/CopilotChat.vue +121 -498
- package/src/v2/components/chat/CopilotChatAssistantMessage.vue +47 -184
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +36 -55
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +14 -6
- package/src/v2/components/chat/CopilotChatAudioRecorder.vue +19 -246
- package/src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue +12 -77
- package/src/v2/components/chat/CopilotChatInput.vue +139 -654
- package/src/v2/components/chat/CopilotChatInspectorButton.vue +45 -108
- package/src/v2/components/chat/CopilotChatLightbox.vue +10 -31
- package/src/v2/components/chat/CopilotChatMessageView.vue +96 -274
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +27 -62
- package/src/v2/components/chat/CopilotChatToolCallGroup.vue +63 -71
- package/src/v2/components/chat/CopilotChatToolCallItem.vue +8 -6
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +31 -32
- package/src/v2/components/chat/CopilotChatUserMessage.vue +24 -112
- package/src/v2/components/chat/CopilotChatView.vue +123 -161
- package/src/v2/components/chat/CopilotChatWorkSummary.vue +26 -36
- package/src/v2/components/chat/CopilotModalHeader.vue +11 -23
- package/src/v2/components/chat/CopilotPopup.vue +23 -25
- package/src/v2/components/chat/CopilotPopupView.vue +10 -39
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +49 -185
- package/src/v2/components/chat/CopilotSidebar.vue +23 -25
- package/src/v2/components/chat/CopilotSidebarView.vue +10 -39
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +56 -100
- package/src/v2/components/chat/CopilotThreadsDrawer.vue +43 -105
- package/src/v2/components/chat/StreamingMarkdownDefault.vue +15 -28
- package/src/v2/components/chat/__tests__/CopilotChat.labels.test.ts +19 -4
- package/src/v2/components/chat/__tests__/CopilotChat.test.ts +12 -10
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +26 -9
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.learningFeedback.test.ts +5 -5
- package/src/v2/components/chat/__tests__/CopilotChatAttachmentQueue.test.ts +28 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +132 -1
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +247 -403
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +1 -99
- package/src/v2/components/chat/__tests__/CopilotChatView.pinToSend.test.ts +43 -1
- package/src/v2/components/chat/__tests__/CopilotPopup.test.ts +90 -1
- package/src/v2/components/chat/__tests__/CopilotPopupView.test.ts +19 -0
- package/src/v2/components/chat/__tests__/CopilotSidebar.test.ts +90 -1
- package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.ts +32 -8
- package/src/v2/components/chat/__tests__/CopilotSidebarView.test.ts +2 -1
- package/src/v2/components/chat/__tests__/StreamingMarkdownDefault.test.ts +54 -0
- package/src/v2/components/chat/audioRecorder.ts +4 -7
- package/src/v2/components/chat/copilotChatToolCallItemRender.ts +25 -90
- package/src/v2/components/chat/forwarded-slots.ts +17 -0
- package/src/v2/components/chat/index.ts +0 -1
- package/src/v2/components/chat/inspector-shortcuts.ts +10 -16
- package/src/v2/components/chat/message-feedback.ts +92 -195
- package/src/v2/components/chat/tool-call-display-context.ts +6 -22
- package/src/v2/components/chat/tool-call-group-parts.ts +47 -108
- package/src/v2/components/chat/turn-work.ts +0 -9
- package/src/v2/components/chat/types.ts +12 -4
- package/src/v2/components/chat/use-chat-labels.ts +16 -0
- package/src/v2/components/chat/use-copy-feedback.ts +21 -0
- package/src/v2/components/chat/use-lightbox.ts +15 -33
- package/src/v2/components/icons/__tests__/icons.test.ts +72 -68
- package/src/v2/components/icons/index.ts +109 -27
- package/src/v2/hooks/__tests__/use-agent-error-state.test.ts +5 -3
- package/src/v2/hooks/__tests__/use-agent-stability.test.ts +25 -4
- package/src/v2/hooks/__tests__/use-agent-throttle.test.ts +5 -1
- package/src/v2/hooks/__tests__/use-agent.test.ts +6 -3
- package/src/v2/hooks/__tests__/use-component.test.ts +21 -0
- package/src/v2/hooks/__tests__/use-configure-suggestions.test.ts +30 -1
- package/src/v2/hooks/__tests__/use-default-render-tool.test.ts +10 -10
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +66 -1
- package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.ts +6 -1
- package/src/v2/hooks/__tests__/use-human-in-the-loop.test.ts +187 -12
- package/src/v2/hooks/__tests__/use-interrupt.test.ts +97 -0
- package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +106 -0
- package/src/v2/hooks/__tests__/use-render-tool.test.ts +3 -6
- package/src/v2/hooks/__tests__/use-threads.test.ts +48 -6
- package/src/v2/hooks/__tests__/zod-regression.test.ts +5 -4
- package/src/v2/hooks/use-agent-context.ts +4 -10
- package/src/v2/hooks/use-agent.ts +86 -290
- package/src/v2/hooks/use-attachments.ts +48 -168
- package/src/v2/hooks/use-capabilities.ts +2 -7
- package/src/v2/hooks/use-component.ts +7 -4
- package/src/v2/hooks/use-configure-suggestions.ts +29 -220
- package/src/v2/hooks/use-default-render-tool.ts +31 -152
- package/src/v2/hooks/use-frontend-tool.ts +15 -25
- package/src/v2/hooks/use-human-in-the-loop.ts +11 -80
- package/src/v2/hooks/use-interrupt.ts +29 -308
- package/src/v2/hooks/use-keyboard-height.ts +17 -40
- package/src/v2/hooks/use-pin-to-send.ts +15 -99
- package/src/v2/hooks/use-render-activity-message.ts +35 -57
- package/src/v2/hooks/use-render-custom-messages.ts +24 -88
- package/src/v2/hooks/use-render-tool.ts +2 -4
- package/src/v2/hooks/use-suggestions.ts +17 -36
- package/src/v2/hooks/use-threads.ts +49 -288
- package/src/v2/lib/__tests__/shallow-stable.test.ts +54 -0
- package/src/v2/lib/__tests__/vue-core-renderers.test.ts +42 -0
- package/src/v2/lib/processPartialHtml.ts +6 -21
- package/src/v2/lib/shallow-stable.ts +2 -16
- package/src/v2/lib/vue-core.ts +90 -85
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +48 -186
- package/src/v2/providers/CopilotKitProvider.types.ts +12 -132
- package/src/v2/providers/CopilotKitProvider.vue +291 -641
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.ts +22 -2
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +38 -2
- package/src/v2/providers/__tests__/CopilotKitProvider.config.test.ts +124 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.headersAtSendTime.test.ts +3 -3
- package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +3 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.ts +4 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +88 -28
- package/src/v2/providers/chat-configuration-store-key.ts +9 -0
- package/src/v2/providers/markdown-renderer.ts +8 -2
- package/src/v2/providers/types.ts +3 -49
- package/src/v2/providers/use-inspector-thread-override.ts +22 -80
- package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +28 -33
- package/src/v2/types/defineToolCallRenderer.ts +7 -6
- package/src/v2/types/human-in-the-loop.ts +8 -32
- package/src/v2/types/interrupt.ts +7 -31
- package/src/v2/types/vue-activity-message-renderer.ts +24 -15
- package/src/v2/types/vue-custom-message-renderer.ts +12 -16
- package/src/v2/types/vue-tool-call-renderer.ts +23 -38
- package/tsconfig.json +0 -1
- package/vite.config.ts +8 -5
- package/vitest.config.ts +12 -7
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts +0 -9
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts.map +0 -1
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts +0 -3
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts.map +0 -1
- package/dist/v2/components/chat/tool-call-layout.d.ts +0 -115
- package/dist/v2/components/chat/tool-call-layout.d.ts.map +0 -1
- package/dist/v2/lib/is-mobile-viewport.d.ts +0 -15
- package/dist/v2/lib/is-mobile-viewport.d.ts.map +0 -1
- package/dist/v2/lib/message-feedback.d.ts +0 -33
- package/dist/v2/lib/message-feedback.d.ts.map +0 -1
- package/dist/v2/lib/transcription-client.d.ts +0 -19
- package/dist/v2/lib/transcription-client.d.ts.map +0 -1
- package/src/v2/components/__tests__/A2UICatalogContext.test.ts +0 -63
- package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +0 -175
- package/src/v2/components/chat/BasicMarkdown.vue +0 -160
- package/src/v2/components/chat/__tests__/BasicMarkdown.test.ts +0 -69
- package/src/v2/components/chat/__tests__/normalize-auto-scroll.test.ts +0 -39
- package/src/v2/components/chat/normalize-auto-scroll.ts +0 -17
- package/src/v2/components/chat/tool-call-layout.ts +0 -304
- package/src/v2/lib/__tests__/is-mobile-viewport.test.ts +0 -48
- package/src/v2/lib/__tests__/message-feedback.test.ts +0 -152
- package/src/v2/lib/__tests__/processPartialHtml.test.ts +0 -84
- package/src/v2/lib/__tests__/transcription-client.test.ts +0 -67
- package/src/v2/lib/is-mobile-viewport.ts +0 -23
- package/src/v2/lib/message-feedback.ts +0 -120
- package/src/v2/lib/transcription-client.ts +0 -151
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { TranscriptionErrorCode } from "@copilotkit/shared";
|
|
3
|
-
import type { TranscriptionError } from "../transcription-client";
|
|
4
|
-
import { transcribeAudio } from "../transcription-client";
|
|
5
|
-
import type { CopilotKitCoreVue } from "../vue-core";
|
|
6
|
-
|
|
7
|
-
describe("transcription-client", () => {
|
|
8
|
-
const originalFetch = globalThis.fetch;
|
|
9
|
-
|
|
10
|
-
afterEach(() => {
|
|
11
|
-
globalThis.fetch = originalFetch;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it("transcribes audio in REST mode", async () => {
|
|
15
|
-
globalThis.fetch = vi.fn().mockResolvedValue({
|
|
16
|
-
ok: true,
|
|
17
|
-
json: async () => ({
|
|
18
|
-
text: "Transcribed text",
|
|
19
|
-
size: 12,
|
|
20
|
-
type: "audio/webm",
|
|
21
|
-
}),
|
|
22
|
-
} satisfies Partial<Response>) as typeof fetch;
|
|
23
|
-
|
|
24
|
-
const result = await transcribeAudio(
|
|
25
|
-
{
|
|
26
|
-
runtimeUrl: "/api/copilotkit",
|
|
27
|
-
runtimeTransport: "rest",
|
|
28
|
-
headers: {},
|
|
29
|
-
resolveHeaders: async () => ({}),
|
|
30
|
-
} as CopilotKitCoreVue,
|
|
31
|
-
new Blob(["audio"], { type: "audio/webm" }),
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
expect(globalThis.fetch).toHaveBeenCalledTimes(1);
|
|
35
|
-
expect(result.text).toBe("Transcribed text");
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("maps structured error responses to TranscriptionError", async () => {
|
|
39
|
-
globalThis.fetch = vi.fn().mockResolvedValue({
|
|
40
|
-
ok: false,
|
|
41
|
-
status: 429,
|
|
42
|
-
statusText: "Too Many Requests",
|
|
43
|
-
json: async () => ({
|
|
44
|
-
error: TranscriptionErrorCode.RATE_LIMITED,
|
|
45
|
-
message: "Rate limited",
|
|
46
|
-
retryable: true,
|
|
47
|
-
}),
|
|
48
|
-
} satisfies Partial<Response>) as typeof fetch;
|
|
49
|
-
|
|
50
|
-
await expect(
|
|
51
|
-
transcribeAudio(
|
|
52
|
-
{
|
|
53
|
-
runtimeUrl: "/api/copilotkit",
|
|
54
|
-
runtimeTransport: "rest",
|
|
55
|
-
headers: {},
|
|
56
|
-
resolveHeaders: async () => ({}),
|
|
57
|
-
} as CopilotKitCoreVue,
|
|
58
|
-
new Blob(["audio"], { type: "audio/webm" }),
|
|
59
|
-
),
|
|
60
|
-
).rejects.toMatchObject({
|
|
61
|
-
info: {
|
|
62
|
-
code: TranscriptionErrorCode.RATE_LIMITED,
|
|
63
|
-
retryable: true,
|
|
64
|
-
},
|
|
65
|
-
} satisfies Partial<TranscriptionError>);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Media query for the mobile breakpoint, shared so the string literal isn't
|
|
3
|
-
* duplicated across call sites within this package (e.g. `CopilotModalHeader`,
|
|
4
|
-
* which needs a live `matchMedia` change-listener and so can't call
|
|
5
|
-
* `isMobileViewport()` directly).
|
|
6
|
-
*/
|
|
7
|
-
export const MOBILE_MAX_WIDTH_QUERY = "(max-width: 767px)";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Reports whether the viewport is in the mobile range (`<768px`), where the
|
|
11
|
-
* drawer and chat modal are mutually exclusive. SSR-safe (returns `false`
|
|
12
|
-
* when `window` is absent) and guards environments where `window` exists but
|
|
13
|
-
* `window.matchMedia` does not (some test runners, embedded webviews).
|
|
14
|
-
*/
|
|
15
|
-
export function isMobileViewport(): boolean {
|
|
16
|
-
if (
|
|
17
|
-
typeof window === "undefined" ||
|
|
18
|
-
typeof window.matchMedia !== "function"
|
|
19
|
-
) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
return window.matchMedia(MOBILE_MAX_WIDTH_QUERY).matches;
|
|
23
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import type { AssistantMessage } from "@ag-ui/core";
|
|
2
|
-
import type { CopilotKitCore } from "@copilotkit/core";
|
|
3
|
-
|
|
4
|
-
/** Trajectory event name for a rating of one assistant message. */
|
|
5
|
-
export const MESSAGE_FEEDBACK_EVENT_NAME = "message.feedback";
|
|
6
|
-
|
|
7
|
-
/** Longest comment kept, in characters; the rest is cut so the event stays small. */
|
|
8
|
-
export const MESSAGE_FEEDBACK_MAX_COMMENT_LENGTH = 1000;
|
|
9
|
-
|
|
10
|
-
/** Longest excerpt of the rated response sent with the rating, in characters. */
|
|
11
|
-
const RESPONSE_EXCERPT_LENGTH = 500;
|
|
12
|
-
|
|
13
|
-
export type MessageFeedbackRating = "up" | "down";
|
|
14
|
-
|
|
15
|
-
/** The rating this page gave one assistant message. */
|
|
16
|
-
export interface MessageFeedback {
|
|
17
|
-
readonly rating: MessageFeedbackRating;
|
|
18
|
-
readonly comment?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Ratings given on this page, by message. Kept outside Vue, so a rated
|
|
22
|
-
// message that scrolls out of a virtual list still shows its rating when it
|
|
23
|
-
// comes back. Intelligence holds the ratings across page loads.
|
|
24
|
-
const ratings = new Map<string, MessageFeedback>();
|
|
25
|
-
const listeners = new Map<string, Set<() => void>>();
|
|
26
|
-
|
|
27
|
-
const threadKey = (agentId: string, threadId: string) =>
|
|
28
|
-
JSON.stringify([agentId, threadId]);
|
|
29
|
-
|
|
30
|
-
const messageKey = (agentId: string, threadId: string, messageId: string) =>
|
|
31
|
-
JSON.stringify([agentId, threadId, messageId]);
|
|
32
|
-
|
|
33
|
-
/** Cuts `text` to `max` characters without splitting a surrogate pair. */
|
|
34
|
-
const clip = (text: string, max: number): string => {
|
|
35
|
-
const characters = Array.from(text);
|
|
36
|
-
return characters.length > max ? characters.slice(0, max).join("") : text;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/** The comment as kept and sent: trimmed and capped, or none. */
|
|
40
|
-
const normalizeComment = (comment: unknown): string | undefined => {
|
|
41
|
-
if (typeof comment !== "string") return undefined;
|
|
42
|
-
const text = clip(comment.trim(), MESSAGE_FEEDBACK_MAX_COMMENT_LENGTH);
|
|
43
|
-
return text === "" ? undefined : text;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
/** The rating this page gave one message, if any. */
|
|
47
|
-
export function getMessageFeedback(
|
|
48
|
-
agentId: string,
|
|
49
|
-
threadId: string,
|
|
50
|
-
messageId: string,
|
|
51
|
-
): MessageFeedback | undefined {
|
|
52
|
-
return ratings.get(messageKey(agentId, threadId, messageId));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/** Calls `listener` whenever a rating in this Thread changes. */
|
|
56
|
-
export function subscribeToMessageFeedback(
|
|
57
|
-
agentId: string,
|
|
58
|
-
threadId: string,
|
|
59
|
-
listener: () => void,
|
|
60
|
-
): () => void {
|
|
61
|
-
const key = threadKey(agentId, threadId);
|
|
62
|
-
let set = listeners.get(key);
|
|
63
|
-
if (set === undefined) {
|
|
64
|
-
set = new Set();
|
|
65
|
-
listeners.set(key, set);
|
|
66
|
-
}
|
|
67
|
-
set.add(listener);
|
|
68
|
-
return () => {
|
|
69
|
-
set.delete(listener);
|
|
70
|
-
if (set.size === 0) listeners.delete(key);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Sets (or, with `null`, clears) this page's rating of one message and sends
|
|
76
|
-
* it to the active Trajectory. Every change is a new event; the newest event
|
|
77
|
-
* for a `feedbackId` is the current one. Like any Trajectory event, a change
|
|
78
|
-
* made while no Trajectory captures, for example during a reconnect, is not
|
|
79
|
-
* sent; the page still shows it.
|
|
80
|
-
*/
|
|
81
|
-
export function setMessageFeedback(params: {
|
|
82
|
-
copilotkit: CopilotKitCore;
|
|
83
|
-
agentId: string;
|
|
84
|
-
threadId: string;
|
|
85
|
-
message: AssistantMessage;
|
|
86
|
-
feedback: MessageFeedback | null;
|
|
87
|
-
}): void {
|
|
88
|
-
const { copilotkit, agentId, threadId, message } = params;
|
|
89
|
-
const comment = normalizeComment(params.feedback?.comment);
|
|
90
|
-
const feedback: MessageFeedback | null = params.feedback && {
|
|
91
|
-
rating: params.feedback.rating,
|
|
92
|
-
...(comment ? { comment } : {}),
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const key = messageKey(agentId, threadId, message.id);
|
|
96
|
-
if (feedback) ratings.set(key, feedback);
|
|
97
|
-
else ratings.delete(key);
|
|
98
|
-
for (const listener of listeners.get(threadKey(agentId, threadId)) ?? [])
|
|
99
|
-
listener();
|
|
100
|
-
|
|
101
|
-
const runId = copilotkit.getRunIdForMessage(agentId, threadId, message.id);
|
|
102
|
-
copilotkit.emitTrajectoryEvent(MESSAGE_FEEDBACK_EVENT_NAME, {
|
|
103
|
-
feedbackId: `${threadId}:${message.id}`,
|
|
104
|
-
threadId,
|
|
105
|
-
messageId: message.id,
|
|
106
|
-
agentId,
|
|
107
|
-
...(runId ? { runId } : {}),
|
|
108
|
-
rating: feedback?.rating ?? null,
|
|
109
|
-
...(feedback?.comment ? { comment: feedback.comment } : {}),
|
|
110
|
-
// A custom sink set to omit agent text gets no excerpt of the reply.
|
|
111
|
-
...(copilotkit.ɵlearningCapturesAgentText
|
|
112
|
-
? { response: clip(message.content ?? "", RESPONSE_EXCERPT_LENGTH) }
|
|
113
|
-
: {}),
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/** @internal Forgets every rating, so each test starts empty. */
|
|
118
|
-
export function ɵresetMessageFeedbackCache(): void {
|
|
119
|
-
ratings.clear();
|
|
120
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import type { CopilotKitCoreVue } from "./vue-core";
|
|
2
|
-
import { TranscriptionErrorCode } from "@copilotkit/shared";
|
|
3
|
-
import type { TranscriptionErrorResponse } from "@copilotkit/shared";
|
|
4
|
-
|
|
5
|
-
export interface TranscriptionResult {
|
|
6
|
-
text: string;
|
|
7
|
-
size: number;
|
|
8
|
-
type: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface TranscriptionErrorInfo {
|
|
12
|
-
code: TranscriptionErrorCode;
|
|
13
|
-
message: string;
|
|
14
|
-
retryable: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { TranscriptionErrorCode };
|
|
18
|
-
|
|
19
|
-
async function blobToBase64(blob: Blob): Promise<string> {
|
|
20
|
-
return await new Promise((resolve, reject) => {
|
|
21
|
-
const reader = new FileReader();
|
|
22
|
-
reader.onloadend = () => {
|
|
23
|
-
const result = reader.result as string;
|
|
24
|
-
resolve(result.split(",")[1] ?? "");
|
|
25
|
-
};
|
|
26
|
-
reader.addEventListener("error", () =>
|
|
27
|
-
reject(new Error("Failed to read audio data")),
|
|
28
|
-
);
|
|
29
|
-
reader.readAsDataURL(blob);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function isTranscriptionErrorResponse(
|
|
34
|
-
data: unknown,
|
|
35
|
-
): data is TranscriptionErrorResponse {
|
|
36
|
-
return (
|
|
37
|
-
typeof data === "object" &&
|
|
38
|
-
data !== null &&
|
|
39
|
-
"error" in data &&
|
|
40
|
-
"message" in data &&
|
|
41
|
-
typeof (data as TranscriptionErrorResponse).error === "string" &&
|
|
42
|
-
typeof (data as TranscriptionErrorResponse).message === "string"
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function parseTranscriptionError(
|
|
47
|
-
response: TranscriptionErrorResponse,
|
|
48
|
-
): TranscriptionErrorInfo {
|
|
49
|
-
return {
|
|
50
|
-
code: response.error,
|
|
51
|
-
message: response.message,
|
|
52
|
-
retryable: response.retryable ?? false,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export class TranscriptionError extends Error {
|
|
57
|
-
public readonly info: TranscriptionErrorInfo;
|
|
58
|
-
|
|
59
|
-
constructor(info: TranscriptionErrorInfo) {
|
|
60
|
-
super(info.message);
|
|
61
|
-
this.name = "TranscriptionError";
|
|
62
|
-
this.info = info;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export async function transcribeAudio(
|
|
67
|
-
core: CopilotKitCoreVue,
|
|
68
|
-
audioBlob: Blob,
|
|
69
|
-
filename: string = "recording.webm",
|
|
70
|
-
): Promise<TranscriptionResult> {
|
|
71
|
-
const runtimeUrl = core.runtimeUrl;
|
|
72
|
-
if (!runtimeUrl) {
|
|
73
|
-
throw new TranscriptionError({
|
|
74
|
-
code: TranscriptionErrorCode.INVALID_REQUEST,
|
|
75
|
-
message: "Runtime URL is not configured",
|
|
76
|
-
retryable: false,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const headers: Record<string, string> = { ...(await core.resolveHeaders()) };
|
|
81
|
-
let response: Response;
|
|
82
|
-
|
|
83
|
-
try {
|
|
84
|
-
if (core.runtimeTransport === "single") {
|
|
85
|
-
const base64Audio = await blobToBase64(audioBlob);
|
|
86
|
-
|
|
87
|
-
headers["Content-Type"] = "application/json";
|
|
88
|
-
|
|
89
|
-
response = await fetch(runtimeUrl, {
|
|
90
|
-
method: "POST",
|
|
91
|
-
headers,
|
|
92
|
-
body: JSON.stringify({
|
|
93
|
-
method: "transcribe",
|
|
94
|
-
body: {
|
|
95
|
-
audio: base64Audio,
|
|
96
|
-
mimeType: audioBlob.type || "audio/webm",
|
|
97
|
-
filename,
|
|
98
|
-
},
|
|
99
|
-
}),
|
|
100
|
-
});
|
|
101
|
-
} else {
|
|
102
|
-
delete headers["Content-Type"];
|
|
103
|
-
|
|
104
|
-
const formData = new FormData();
|
|
105
|
-
formData.append("audio", audioBlob, filename);
|
|
106
|
-
|
|
107
|
-
response = await fetch(`${runtimeUrl}/transcribe`, {
|
|
108
|
-
method: "POST",
|
|
109
|
-
headers,
|
|
110
|
-
body: formData,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
} catch (error) {
|
|
114
|
-
throw new TranscriptionError({
|
|
115
|
-
code: TranscriptionErrorCode.NETWORK_ERROR,
|
|
116
|
-
message:
|
|
117
|
-
error instanceof Error ? error.message : "Network request failed",
|
|
118
|
-
retryable: true,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (!response.ok) {
|
|
123
|
-
let errorData: unknown;
|
|
124
|
-
try {
|
|
125
|
-
errorData = await response.json();
|
|
126
|
-
} catch {
|
|
127
|
-
throw new TranscriptionError({
|
|
128
|
-
code: TranscriptionErrorCode.PROVIDER_ERROR,
|
|
129
|
-
message: `HTTP ${response.status}: ${response.statusText}`,
|
|
130
|
-
retryable: response.status >= 500,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (isTranscriptionErrorResponse(errorData)) {
|
|
135
|
-
throw new TranscriptionError(parseTranscriptionError(errorData));
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
throw new TranscriptionError({
|
|
139
|
-
code: TranscriptionErrorCode.PROVIDER_ERROR,
|
|
140
|
-
message:
|
|
141
|
-
typeof errorData === "object" &&
|
|
142
|
-
errorData !== null &&
|
|
143
|
-
"message" in errorData
|
|
144
|
-
? String((errorData as { message: unknown }).message)
|
|
145
|
-
: "Transcription failed",
|
|
146
|
-
retryable: response.status >= 500,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return (await response.json()) as TranscriptionResult;
|
|
151
|
-
}
|