@copilotkit/vue 2.0.0-rc.3 → 2.0.0-rc.31
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-BMTHA_P2.js +15901 -0
- package/dist/use-render-activity-message-BMTHA_P2.js.map +1 -0
- package/dist/use-render-activity-message-CH3beu7z.cjs +113 -0
- package/dist/use-render-activity-message-CH3beu7z.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 +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,19 +1,15 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
2
|
import type { Component } from "vue";
|
|
3
3
|
import type { ActivityMessage } from "@ag-ui/core";
|
|
4
|
-
import
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
ɵdescribeActivityRendererFailure,
|
|
6
|
+
ɵfindActivityRenderer,
|
|
7
|
+
ɵmatchActivityRenderer,
|
|
8
|
+
ɵresolveAgentId,
|
|
9
|
+
} from "@copilotkit/core";
|
|
6
10
|
import { useCopilotKit } from "../providers/useCopilotKit";
|
|
7
11
|
import { useCopilotChatConfiguration } from "../providers/useCopilotChatConfiguration";
|
|
8
|
-
import type {
|
|
9
|
-
VueActivityMessageRenderer,
|
|
10
|
-
VueActivityMessageRendererProps,
|
|
11
|
-
} from "../types";
|
|
12
|
-
|
|
13
|
-
interface ActivityRendererResult {
|
|
14
|
-
renderer: Component<VueActivityMessageRendererProps<unknown>>;
|
|
15
|
-
props: VueActivityMessageRendererProps<unknown>;
|
|
16
|
-
}
|
|
12
|
+
import type { VueActivityMessageRendererProps } from "../types";
|
|
17
13
|
|
|
18
14
|
/**
|
|
19
15
|
* Returns helpers for rendering activity messages.
|
|
@@ -21,70 +17,52 @@ interface ActivityRendererResult {
|
|
|
21
17
|
* Matches the React `useRenderActivityMessage` API: `findRenderer` locates a
|
|
22
18
|
* registered renderer by activity type (preferring agent-scoped over global,
|
|
23
19
|
* with `"*"` as a wildcard fallback), and `renderActivityMessage` resolves the
|
|
24
|
-
* renderer and validates the content schema
|
|
20
|
+
* renderer and validates the content with the renderer's `content` schema
|
|
21
|
+
* (any Standard Schema, such as zod).
|
|
25
22
|
*/
|
|
26
23
|
export function useRenderActivityMessage() {
|
|
27
24
|
const { copilotkit } = useCopilotKit();
|
|
28
25
|
const config = useCopilotChatConfiguration();
|
|
29
|
-
const agentId = computed(() =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
...copilotkit.value.renderActivityMessages,
|
|
33
|
-
]);
|
|
26
|
+
const agentId = computed(() =>
|
|
27
|
+
ɵresolveAgentId({ chatAgentId: config.value?.agentId }),
|
|
28
|
+
);
|
|
34
29
|
|
|
35
|
-
function findRenderer(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const matches = list.filter(
|
|
44
|
-
(renderer) => renderer.activityType === activityType,
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
matches.find((candidate) => candidate.agentId === agentId.value) ??
|
|
49
|
-
matches.find((candidate) => candidate.agentId === undefined) ??
|
|
50
|
-
list.find((candidate) => candidate.activityType === "*") ??
|
|
51
|
-
null
|
|
52
|
-
);
|
|
30
|
+
function findRenderer(activityType: string) {
|
|
31
|
+
return ɵfindActivityRenderer(copilotkit.value.renderActivityMessages, {
|
|
32
|
+
activityType,
|
|
33
|
+
agentId: agentId.value,
|
|
34
|
+
});
|
|
53
35
|
}
|
|
54
36
|
|
|
55
|
-
function renderActivityMessage(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const parseResult = renderer.content.safeParse(message.content);
|
|
37
|
+
function renderActivityMessage(message: ActivityMessage) {
|
|
38
|
+
const match = ɵmatchActivityRenderer(
|
|
39
|
+
copilotkit.value.renderActivityMessages,
|
|
40
|
+
{
|
|
41
|
+
activityType: message.activityType,
|
|
42
|
+
agentId: agentId.value,
|
|
43
|
+
content: message.content,
|
|
44
|
+
},
|
|
45
|
+
);
|
|
65
46
|
|
|
66
|
-
if (!
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
47
|
+
if (!match.ok) {
|
|
48
|
+
// Explain why a message that has a renderer drew nothing.
|
|
49
|
+
const warning = ɵdescribeActivityRendererFailure(
|
|
50
|
+
message.activityType,
|
|
51
|
+
match,
|
|
71
52
|
);
|
|
53
|
+
if (warning) console.warn(warning.message, ...warning.details);
|
|
72
54
|
return null;
|
|
73
55
|
}
|
|
74
56
|
|
|
75
|
-
const agent: AbstractAgent | undefined = copilotkit.value.getAgent(
|
|
76
|
-
agentId.value,
|
|
77
|
-
);
|
|
78
|
-
|
|
79
57
|
return {
|
|
80
|
-
renderer: renderer.render as Component<
|
|
58
|
+
renderer: match.renderer.render as Component<
|
|
81
59
|
VueActivityMessageRendererProps<unknown>
|
|
82
60
|
>,
|
|
83
61
|
props: {
|
|
84
62
|
activityType: message.activityType,
|
|
85
|
-
content:
|
|
63
|
+
content: match.content,
|
|
86
64
|
message,
|
|
87
|
-
agent,
|
|
65
|
+
agent: copilotkit.value.getAgent(agentId.value),
|
|
88
66
|
},
|
|
89
67
|
};
|
|
90
68
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { Component, VNodeChild } from "vue";
|
|
2
1
|
import type { Message } from "@ag-ui/core";
|
|
3
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ɵgetCustomMessageRenderProps,
|
|
4
|
+
ɵresolveCustomMessageRenderContext,
|
|
5
|
+
} from "@copilotkit/core";
|
|
4
6
|
import { useCopilotKit } from "../providers/useCopilotKit";
|
|
5
7
|
import { useCopilotChatConfiguration } from "../providers/useCopilotChatConfiguration";
|
|
6
8
|
import type {
|
|
@@ -13,13 +15,6 @@ interface UseRenderCustomMessagesParams {
|
|
|
13
15
|
position: VueCustomMessageRendererPosition;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
interface CustomMessageRendererResult {
|
|
17
|
-
renderer:
|
|
18
|
-
| Component<VueCustomMessageRendererProps>
|
|
19
|
-
| ((props: VueCustomMessageRendererProps) => VNodeChild);
|
|
20
|
-
props: VueCustomMessageRendererProps;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
18
|
/**
|
|
24
19
|
* Returns a function that resolves the appropriate custom message renderer for
|
|
25
20
|
* a given message and position.
|
|
@@ -37,93 +32,34 @@ export function useRenderCustomMessages() {
|
|
|
37
32
|
const { copilotkit } = useCopilotKit();
|
|
38
33
|
const config = useCopilotChatConfiguration();
|
|
39
34
|
|
|
40
|
-
return function renderCustomMessage(
|
|
41
|
-
params: UseRenderCustomMessagesParams,
|
|
42
|
-
): CustomMessageRendererResult | null {
|
|
35
|
+
return function renderCustomMessage(params: UseRenderCustomMessagesParams) {
|
|
43
36
|
const configValue = config.value;
|
|
44
37
|
if (!configValue) return null;
|
|
45
38
|
|
|
46
|
-
const agentId = configValue.agentId || DEFAULT_AGENT_ID;
|
|
47
|
-
const { threadId } = configValue;
|
|
48
39
|
const core = copilotkit.value;
|
|
40
|
+
const { agentId, renderers } = ɵresolveCustomMessageRenderContext(
|
|
41
|
+
core.renderCustomMessages,
|
|
42
|
+
configValue.agentId,
|
|
43
|
+
);
|
|
44
|
+
// Agent-scoped renderers come first. Use the first one that has a
|
|
45
|
+
// render function.
|
|
46
|
+
const selected = renderers.find((candidate) => candidate.render);
|
|
47
|
+
if (!selected) return null;
|
|
49
48
|
|
|
50
|
-
const customMessageRenderers = [...core.renderCustomMessages]
|
|
51
|
-
.filter(
|
|
52
|
-
(renderer) =>
|
|
53
|
-
renderer.agentId === undefined || renderer.agentId === agentId,
|
|
54
|
-
)
|
|
55
|
-
.sort((a, b) => {
|
|
56
|
-
const aHasAgent = a.agentId !== undefined;
|
|
57
|
-
const bHasAgent = b.agentId !== undefined;
|
|
58
|
-
if (aHasAgent === bHasAgent) return 0;
|
|
59
|
-
return aHasAgent ? -1 : 1;
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
if (!customMessageRenderers.length) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const { message, position } = params;
|
|
67
|
-
const resolvedRunId =
|
|
68
|
-
core.getRunIdForMessage(agentId, threadId, message.id) ??
|
|
69
|
-
core.getRunIdsForThread(agentId, threadId).slice(-1)[0];
|
|
70
|
-
const runId = resolvedRunId ?? `missing-run-id:${message.id}`;
|
|
71
49
|
const agent = core.getAgent(agentId);
|
|
72
|
-
if (!agent)
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const messagesIdsInRun = resolvedRunId
|
|
77
|
-
? agent.messages
|
|
78
|
-
.filter(
|
|
79
|
-
(msg) =>
|
|
80
|
-
core.getRunIdForMessage(agentId, threadId, msg.id) ===
|
|
81
|
-
resolvedRunId,
|
|
82
|
-
)
|
|
83
|
-
.map((msg) => msg.id)
|
|
84
|
-
: [message.id];
|
|
50
|
+
if (!agent) return null;
|
|
85
51
|
|
|
86
|
-
const
|
|
87
|
-
|
|
52
|
+
const props: VueCustomMessageRendererProps = ɵgetCustomMessageRenderProps(
|
|
53
|
+
core,
|
|
54
|
+
{
|
|
55
|
+
agentId,
|
|
56
|
+
threadId: configValue.threadId,
|
|
57
|
+
agent,
|
|
58
|
+
message: params.message,
|
|
59
|
+
position: params.position,
|
|
60
|
+
},
|
|
88
61
|
);
|
|
89
|
-
if (rawMessageIndex < 0) {
|
|
90
|
-
console.warn(
|
|
91
|
-
`[CopilotKit] useRenderCustomMessages: message "${message.id}" ` +
|
|
92
|
-
`not found in agent "${agentId}" messages`,
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
const messageIndex = Math.max(0, rawMessageIndex);
|
|
96
|
-
const messageIndexInRun = resolvedRunId
|
|
97
|
-
? Math.max(messagesIdsInRun.indexOf(message.id), 0)
|
|
98
|
-
: 0;
|
|
99
|
-
const numberOfMessagesInRun = resolvedRunId ? messagesIdsInRun.length : 1;
|
|
100
|
-
const stateSnapshot = resolvedRunId
|
|
101
|
-
? core.getStateByRun(agentId, threadId, resolvedRunId)
|
|
102
|
-
: undefined;
|
|
103
|
-
|
|
104
|
-
const props: CustomMessageRendererResult["props"] = {
|
|
105
|
-
message,
|
|
106
|
-
position,
|
|
107
|
-
runId,
|
|
108
|
-
messageIndex,
|
|
109
|
-
messageIndexInRun,
|
|
110
|
-
numberOfMessagesInRun,
|
|
111
|
-
agentId,
|
|
112
|
-
stateSnapshot,
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
// Iterate renderers like React: try each one and use the first that
|
|
116
|
-
// returns a non-null render function.
|
|
117
|
-
for (const candidate of customMessageRenderers) {
|
|
118
|
-
if (!candidate.render) {
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
return {
|
|
122
|
-
renderer: candidate.render as CustomMessageRendererResult["renderer"],
|
|
123
|
-
props,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
62
|
|
|
127
|
-
return
|
|
63
|
+
return { renderer: selected.render, props };
|
|
128
64
|
};
|
|
129
65
|
}
|
|
@@ -52,7 +52,7 @@ type RenderToolConfig<S extends StandardSchemaV1> = {
|
|
|
52
52
|
export function useRenderTool(
|
|
53
53
|
config: {
|
|
54
54
|
name: "*";
|
|
55
|
-
render: ((props: any) => VNodeChild) | Component
|
|
55
|
+
render: ((props: any) => VNodeChild) | Component;
|
|
56
56
|
agentId?: string;
|
|
57
57
|
/** Let the chat group the calls this renderer draws (see `toolCallDisplay`). */
|
|
58
58
|
group?: boolean;
|
|
@@ -126,9 +126,7 @@ export function useRenderTool<S extends StandardSchemaV1>(
|
|
|
126
126
|
...(config.group ? { group: true } : {}),
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
-
copilotkit.value.addHookRenderToolCall(
|
|
130
|
-
renderer as VueToolCallRenderer<unknown>,
|
|
131
|
-
);
|
|
129
|
+
copilotkit.value.addHookRenderToolCall(renderer as VueToolCallRenderer);
|
|
132
130
|
// Intentionally no cleanup removal to preserve renderers for chat history.
|
|
133
131
|
},
|
|
134
132
|
{ immediate: true },
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { computed, ref, toValue, watch } from "vue";
|
|
2
2
|
import type { MaybeRefOrGetter, Ref } from "vue";
|
|
3
|
-
import
|
|
3
|
+
import {
|
|
4
|
+
ɵresolveAgentId,
|
|
5
|
+
ɵsubscribeToAgentSuggestions,
|
|
6
|
+
} from "@copilotkit/core";
|
|
7
|
+
import type {
|
|
8
|
+
CopilotKitCoreGetSuggestionsResult,
|
|
9
|
+
Suggestion,
|
|
10
|
+
} from "@copilotkit/core";
|
|
4
11
|
import { useCopilotKit } from "../providers/useCopilotKit";
|
|
5
12
|
import { useCopilotChatConfiguration } from "../providers/useCopilotChatConfiguration";
|
|
6
|
-
import { DEFAULT_AGENT_ID } from "@copilotkit/shared";
|
|
7
13
|
|
|
8
14
|
export interface UseSuggestionsOptions {
|
|
9
15
|
agentId?: MaybeRefOrGetter<string | undefined>;
|
|
@@ -34,50 +40,25 @@ export function useSuggestions(
|
|
|
34
40
|
): UseSuggestionsResult {
|
|
35
41
|
const { copilotkit } = useCopilotKit();
|
|
36
42
|
const config = useCopilotChatConfiguration();
|
|
37
|
-
const resolvedAgentId = computed(
|
|
38
|
-
(
|
|
43
|
+
const resolvedAgentId = computed(() =>
|
|
44
|
+
ɵresolveAgentId({
|
|
45
|
+
agentId: toValue(options.agentId),
|
|
46
|
+
chatAgentId: config.value?.agentId,
|
|
47
|
+
}),
|
|
39
48
|
);
|
|
40
49
|
|
|
41
50
|
const suggestions = ref<Suggestion[]>([]);
|
|
42
51
|
const isLoading = ref(false);
|
|
43
|
-
|
|
44
|
-
const initState = () => {
|
|
45
|
-
const result = copilotkit.value.getSuggestions(resolvedAgentId.value);
|
|
52
|
+
const apply = (result: CopilotKitCoreGetSuggestionsResult) => {
|
|
46
53
|
suggestions.value = result.suggestions;
|
|
47
54
|
isLoading.value = result.isLoading;
|
|
48
55
|
};
|
|
49
56
|
|
|
50
|
-
watch([() => copilotkit.value, resolvedAgentId], () => initState(), {
|
|
51
|
-
immediate: true,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
57
|
watch(
|
|
55
58
|
[() => copilotkit.value, resolvedAgentId],
|
|
56
|
-
(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const sub = core.subscribe({
|
|
60
|
-
onSuggestionsChanged: ({ agentId: changedAgentId, suggestions: s }) => {
|
|
61
|
-
if (changedAgentId !== agentId) return;
|
|
62
|
-
suggestions.value = s;
|
|
63
|
-
const result = core.getSuggestions(agentId);
|
|
64
|
-
isLoading.value = result.isLoading;
|
|
65
|
-
},
|
|
66
|
-
onSuggestionsStartedLoading: ({ agentId: changedAgentId }) => {
|
|
67
|
-
if (changedAgentId !== agentId) return;
|
|
68
|
-
isLoading.value = true;
|
|
69
|
-
},
|
|
70
|
-
onSuggestionsFinishedLoading: ({ agentId: changedAgentId }) => {
|
|
71
|
-
if (changedAgentId !== agentId) return;
|
|
72
|
-
isLoading.value = false;
|
|
73
|
-
},
|
|
74
|
-
onSuggestionsConfigChanged: () => {
|
|
75
|
-
const result = core.getSuggestions(agentId);
|
|
76
|
-
suggestions.value = result.suggestions;
|
|
77
|
-
isLoading.value = result.isLoading;
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
onCleanup(() => sub.unsubscribe());
|
|
59
|
+
([core, agentId], _old, onCleanup) => {
|
|
60
|
+
apply(core.getSuggestions(agentId));
|
|
61
|
+
onCleanup(ɵsubscribeToAgentSuggestions(core, agentId, apply));
|
|
81
62
|
},
|
|
82
63
|
{ immediate: true },
|
|
83
64
|
);
|