@copilotkit/vue 1.57.1
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/AGENTS.md +50 -0
- package/CHANGELOG.md +13 -0
- package/PARITY.md +434 -0
- package/README.md +396 -0
- package/dist/components/copilot-provider/CopilotKit.vue.d.ts +20 -0
- package/dist/components/copilot-provider/CopilotKit.vue.d.ts.map +1 -0
- package/dist/components/copilot-provider/index.d.ts +3 -0
- package/dist/components/copilot-provider/index.d.ts.map +1 -0
- package/dist/components/copilot-provider/types.d.ts +22 -0
- package/dist/components/copilot-provider/types.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/use-copilot-action.d.ts +27 -0
- package/dist/hooks/use-copilot-action.d.ts.map +1 -0
- package/dist/hooks/use-copilot-readable.d.ts +20 -0
- package/dist/hooks/use-copilot-readable.d.ts.map +1 -0
- package/dist/hooks/use-frontend-tool.d.ts +21 -0
- package/dist/hooks/use-frontend-tool.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +10 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +252 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/use-render-activity-message-BRL1Rpl-.cjs +85 -0
- package/dist/use-render-activity-message-BRL1Rpl-.cjs.map +1 -0
- package/dist/use-render-activity-message-CqtxiFSs.js +8927 -0
- package/dist/use-render-activity-message-CqtxiFSs.js.map +1 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts +9 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -0
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts +16 -0
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -0
- package/dist/v2/components/CopilotKitInspector.vue.d.ts +7 -0
- package/dist/v2/components/CopilotKitInspector.vue.d.ts.map +1 -0
- package/dist/v2/components/InlineFeatureWarning.vue.d.ts +6 -0
- package/dist/v2/components/InlineFeatureWarning.vue.d.ts.map +1 -0
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts +18 -0
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -0
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts +88 -0
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts.map +1 -0
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +154 -0
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -0
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +19 -0
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -0
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +16 -0
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -0
- package/dist/v2/components/a2ui/VueSurface.d.ts +62 -0
- package/dist/v2/components/a2ui/VueSurface.d.ts.map +1 -0
- package/dist/v2/components/a2ui/adapter.d.ts +38 -0
- package/dist/v2/components/a2ui/adapter.d.ts.map +1 -0
- package/dist/v2/components/a2ui/catalog.d.ts +29 -0
- package/dist/v2/components/a2ui/catalog.d.ts.map +1 -0
- package/dist/v2/components/a2ui/index.d.ts +5 -0
- package/dist/v2/components/a2ui/index.d.ts.map +1 -0
- package/dist/v2/components/a2ui/utils.d.ts +18 -0
- package/dist/v2/components/a2ui/utils.d.ts.map +1 -0
- package/dist/v2/components/a2ui.d.ts +12 -0
- package/dist/v2/components/a2ui.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChat.vue.d.ts +50 -0
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts +164 -0
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts +12 -0
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts +7 -0
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts +12 -0
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +290 -0
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +72 -0
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts +65 -0
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatSuggestionPill.vue.d.ts +27 -0
- package/dist/v2/components/chat/CopilotChatSuggestionPill.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatSuggestionView.vue.d.ts +26 -0
- package/dist/v2/components/chat/CopilotChatSuggestionView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToggleButton.vue.d.ts +17 -0
- package/dist/v2/components/chat/CopilotChatToggleButton.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToggleButtonCloseIcon.d.ts +5 -0
- package/dist/v2/components/chat/CopilotChatToggleButtonCloseIcon.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToggleButtonOpenIcon.d.ts +5 -0
- package/dist/v2/components/chat/CopilotChatToggleButtonOpenIcon.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +21 -0
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts +34 -0
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +106 -0
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts +15 -0
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts +5 -0
- package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotModalHeaderTitle.d.ts +5 -0
- package/dist/v2/components/chat/CopilotModalHeaderTitle.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts +50 -0
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +55 -0
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +55 -0
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotPopupWelcomeScreen.vue.d.ts +28 -0
- package/dist/v2/components/chat/CopilotPopupWelcomeScreen.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +48 -0
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +62 -0
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +53 -0
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/CopilotSidebarWelcomeScreen.vue.d.ts +28 -0
- package/dist/v2/components/chat/CopilotSidebarWelcomeScreen.vue.d.ts.map +1 -0
- package/dist/v2/components/chat/audioRecorder.d.ts +11 -0
- package/dist/v2/components/chat/audioRecorder.d.ts.map +1 -0
- package/dist/v2/components/chat/index.d.ts +682 -0
- package/dist/v2/components/chat/index.d.ts.map +1 -0
- package/dist/v2/components/chat/last-user-message-context.d.ts +29 -0
- package/dist/v2/components/chat/last-user-message-context.d.ts.map +1 -0
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts +3 -0
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts.map +1 -0
- package/dist/v2/components/chat/types.d.ts +380 -0
- package/dist/v2/components/chat/types.d.ts.map +1 -0
- package/dist/v2/components/icons/index.d.ts +2 -0
- package/dist/v2/components/icons/index.d.ts.map +1 -0
- package/dist/v2/components/index.d.ts +8 -0
- package/dist/v2/components/index.d.ts.map +1 -0
- package/dist/v2/hooks/index.d.ts +24 -0
- package/dist/v2/hooks/index.d.ts.map +1 -0
- package/dist/v2/hooks/use-agent-context.d.ts +24 -0
- package/dist/v2/hooks/use-agent-context.d.ts.map +1 -0
- package/dist/v2/hooks/use-agent.d.ts +53 -0
- package/dist/v2/hooks/use-agent.d.ts.map +1 -0
- package/dist/v2/hooks/use-attachments.d.ts +21 -0
- package/dist/v2/hooks/use-attachments.d.ts.map +1 -0
- package/dist/v2/hooks/use-capabilities.d.ts +16 -0
- package/dist/v2/hooks/use-capabilities.d.ts.map +1 -0
- package/dist/v2/hooks/use-component.d.ts +13 -0
- package/dist/v2/hooks/use-component.d.ts.map +1 -0
- package/dist/v2/hooks/use-configure-suggestions.d.ts +24 -0
- package/dist/v2/hooks/use-configure-suggestions.d.ts.map +1 -0
- package/dist/v2/hooks/use-default-render-tool.d.ts +14 -0
- package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts +19 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -0
- package/dist/v2/hooks/use-human-in-the-loop.d.ts +19 -0
- package/dist/v2/hooks/use-human-in-the-loop.d.ts.map +1 -0
- package/dist/v2/hooks/use-interrupt.d.ts +36 -0
- package/dist/v2/hooks/use-interrupt.d.ts.map +1 -0
- package/dist/v2/hooks/use-katex-styles.d.ts +22 -0
- package/dist/v2/hooks/use-katex-styles.d.ts.map +1 -0
- package/dist/v2/hooks/use-keyboard-height.d.ts +33 -0
- package/dist/v2/hooks/use-keyboard-height.d.ts.map +1 -0
- package/dist/v2/hooks/use-pin-to-send.d.ts +28 -0
- package/dist/v2/hooks/use-pin-to-send.d.ts.map +1 -0
- package/dist/v2/hooks/use-render-activity-message.d.ts +21 -0
- package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -0
- package/dist/v2/hooks/use-render-custom-messages.d.ts +27 -0
- package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -0
- package/dist/v2/hooks/use-render-tool.d.ts +36 -0
- package/dist/v2/hooks/use-render-tool.d.ts.map +1 -0
- package/dist/v2/hooks/use-suggestions.d.ts +26 -0
- package/dist/v2/hooks/use-suggestions.d.ts.map +1 -0
- package/dist/v2/hooks/use-threads.d.ts +42 -0
- package/dist/v2/hooks/use-threads.d.ts.map +1 -0
- package/dist/v2/index.cjs +2 -0
- package/dist/v2/index.cjs.map +1 -0
- package/dist/v2/index.d.cts +9 -0
- package/dist/v2/index.d.mts +9 -0
- package/dist/v2/index.d.ts +9 -0
- package/dist/v2/index.d.ts.map +1 -0
- package/dist/v2/index.mjs +75 -0
- package/dist/v2/index.mjs.map +1 -0
- package/dist/v2/lib/processPartialHtml.d.ts +3 -0
- package/dist/v2/lib/processPartialHtml.d.ts.map +1 -0
- package/dist/v2/lib/shallow-stable.d.ts +7 -0
- package/dist/v2/lib/shallow-stable.d.ts.map +1 -0
- package/dist/v2/lib/transcription-client.d.ts +19 -0
- package/dist/v2/lib/transcription-client.d.ts.map +1 -0
- package/dist/v2/lib/vue-core.d.ts +47 -0
- package/dist/v2/lib/vue-core.d.ts.map +1 -0
- package/dist/v2/providers/CopilotChatConfigurationProvider.types.d.ts +15 -0
- package/dist/v2/providers/CopilotChatConfigurationProvider.types.d.ts.map +1 -0
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts +17 -0
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -0
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +61 -0
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -0
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +37 -0
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -0
- package/dist/v2/providers/SandboxFunctionsContext.d.ts +4 -0
- package/dist/v2/providers/SandboxFunctionsContext.d.ts.map +1 -0
- package/dist/v2/providers/index.d.ts +13 -0
- package/dist/v2/providers/index.d.ts.map +1 -0
- package/dist/v2/providers/keys.d.ts +17 -0
- package/dist/v2/providers/keys.d.ts.map +1 -0
- package/dist/v2/providers/license-context.d.ts +7 -0
- package/dist/v2/providers/license-context.d.ts.map +1 -0
- package/dist/v2/providers/types.d.ts +38 -0
- package/dist/v2/providers/types.d.ts.map +1 -0
- package/dist/v2/providers/useCopilotChatConfiguration.d.ts +4 -0
- package/dist/v2/providers/useCopilotChatConfiguration.d.ts.map +1 -0
- package/dist/v2/providers/useCopilotKit.d.ts +2 -0
- package/dist/v2/providers/useCopilotKit.d.ts.map +1 -0
- package/dist/v2/providers/useLicenseContext.d.ts +14 -0
- package/dist/v2/providers/useLicenseContext.d.ts.map +1 -0
- package/dist/v2/types/a2ui.d.ts +5 -0
- package/dist/v2/types/a2ui.d.ts.map +1 -0
- package/dist/v2/types/defineToolCallRenderer.d.ts +15 -0
- package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -0
- package/dist/v2/types/frontend-tool.d.ts +6 -0
- package/dist/v2/types/frontend-tool.d.ts.map +1 -0
- package/dist/v2/types/human-in-the-loop.d.ts +29 -0
- package/dist/v2/types/human-in-the-loop.d.ts.map +1 -0
- package/dist/v2/types/index.d.ts +10 -0
- package/dist/v2/types/index.d.ts.map +1 -0
- package/dist/v2/types/interrupt.d.ts +14 -0
- package/dist/v2/types/interrupt.d.ts.map +1 -0
- package/dist/v2/types/sandbox-function.d.ts +8 -0
- package/dist/v2/types/sandbox-function.d.ts.map +1 -0
- package/dist/v2/types/vue-activity-message-renderer.d.ts +18 -0
- package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -0
- package/dist/v2/types/vue-custom-message-renderer.d.ts +19 -0
- package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -0
- package/dist/v2/types/vue-tool-call-renderer.d.ts +37 -0
- package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -0
- package/env.d.ts +7 -0
- package/eslint.config.mjs +42 -0
- package/package.json +130 -0
- package/scripts/scope-preflight.mjs +100 -0
- package/src/components/copilot-provider/CopilotKit.vue +18 -0
- package/src/components/copilot-provider/index.ts +2 -0
- package/src/components/copilot-provider/types.ts +24 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/use-copilot-action.ts +168 -0
- package/src/hooks/use-copilot-readable.ts +75 -0
- package/src/hooks/use-frontend-tool.ts +76 -0
- package/src/index.ts +12 -0
- package/src/styles/globals.css +314 -0
- package/src/v2/__tests__/exports.test.ts +35 -0
- package/src/v2/__tests__/mocks/web-inspector.ts +5 -0
- package/src/v2/__tests__/setup.ts +141 -0
- package/src/v2/__tests__/utils/agents.ts +391 -0
- package/src/v2/__tests__/utils/mount.ts +83 -0
- package/src/v2/__tests__/utils/test-helpers.ts +712 -0
- package/src/v2/components/A2UIMessageRenderer.ts +125 -0
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +186 -0
- package/src/v2/components/CopilotKitInspector.vue +42 -0
- package/src/v2/components/InlineFeatureWarning.vue +35 -0
- package/src/v2/components/LicenseWarningBanner.vue +196 -0
- package/src/v2/components/MCPAppsActivityRenderer.ts +778 -0
- package/src/v2/components/OpenGenerativeUIRenderer.ts +550 -0
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +271 -0
- package/src/v2/components/__tests__/CopilotKitInspector.test.ts +57 -0
- package/src/v2/components/__tests__/MCPAppsActivityRenderer.e2e.test.ts +851 -0
- package/src/v2/components/__tests__/MCPAppsActivityRenderer.test.ts +237 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +516 -0
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +295 -0
- package/src/v2/components/a2ui/A2UICatalogContext.ts +190 -0
- package/src/v2/components/a2ui/VueSurface.ts +144 -0
- package/src/v2/components/a2ui/adapter.ts +156 -0
- package/src/v2/components/a2ui/catalog.ts +858 -0
- package/src/v2/components/a2ui/index.ts +7 -0
- package/src/v2/components/a2ui/utils.ts +67 -0
- package/src/v2/components/a2ui.ts +30 -0
- package/src/v2/components/chat/CopilotChat.vue +777 -0
- package/src/v2/components/chat/CopilotChatAssistantMessage.vue +891 -0
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +411 -0
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +87 -0
- package/src/v2/components/chat/CopilotChatAudioRecorder.vue +269 -0
- package/src/v2/components/chat/CopilotChatInput.vue +1271 -0
- package/src/v2/components/chat/CopilotChatMessageView.vue +476 -0
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +247 -0
- package/src/v2/components/chat/CopilotChatSuggestionPill.vue +56 -0
- package/src/v2/components/chat/CopilotChatSuggestionView.vue +93 -0
- package/src/v2/components/chat/CopilotChatToggleButton.vue +145 -0
- package/src/v2/components/chat/CopilotChatToggleButtonCloseIcon.ts +17 -0
- package/src/v2/components/chat/CopilotChatToggleButtonOpenIcon.ts +18 -0
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +161 -0
- package/src/v2/components/chat/CopilotChatUserMessage.vue +322 -0
- package/src/v2/components/chat/CopilotChatView.vue +740 -0
- package/src/v2/components/chat/CopilotModalHeader.vue +73 -0
- package/src/v2/components/chat/CopilotModalHeaderCloseButton.ts +38 -0
- package/src/v2/components/chat/CopilotModalHeaderTitle.ts +22 -0
- package/src/v2/components/chat/CopilotPopup.vue +182 -0
- package/src/v2/components/chat/CopilotPopupView.vue +168 -0
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +453 -0
- package/src/v2/components/chat/CopilotPopupWelcomeScreen.vue +140 -0
- package/src/v2/components/chat/CopilotSidebar.vue +178 -0
- package/src/v2/components/chat/CopilotSidebarView.vue +172 -0
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +366 -0
- package/src/v2/components/chat/CopilotSidebarWelcomeScreen.vue +142 -0
- package/src/v2/components/chat/__tests__/CopilotChat.attachments.test.ts +237 -0
- package/src/v2/components/chat/__tests__/CopilotChat.e2e.test.ts +1240 -0
- package/src/v2/components/chat/__tests__/CopilotChat.licenseWarning.test.ts +138 -0
- package/src/v2/components/chat/__tests__/CopilotChat.onError.test.ts +85 -0
- package/src/v2/components/chat/__tests__/CopilotChat.slots.e2e.test.ts +141 -0
- package/src/v2/components/chat/__tests__/CopilotChat.test.ts +652 -0
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +683 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.slots.e2e.test.ts +768 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.test.ts +1108 -0
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.thumbs.test.ts +87 -0
- package/src/v2/components/chat/__tests__/CopilotChatAttachmentQueue.test.ts +277 -0
- package/src/v2/components/chat/__tests__/CopilotChatAttachmentRenderer.test.ts +124 -0
- package/src/v2/components/chat/__tests__/CopilotChatCopyButton.clipboard.test.ts +230 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.bottomAnchored.test.ts +83 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.slots.e2e.test.ts +1139 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +1051 -0
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.slots.e2e.test.ts +141 -0
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +494 -0
- package/src/v2/components/chat/__tests__/CopilotChatPropsRerender.e2e.test.ts +181 -0
- package/src/v2/components/chat/__tests__/CopilotChatReasoningMessage.test.ts +73 -0
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionPill.test.ts +73 -0
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.slots.e2e.test.ts +674 -0
- package/src/v2/components/chat/__tests__/CopilotChatSuggestionView.test.ts +91 -0
- package/src/v2/components/chat/__tests__/CopilotChatToggleButton.test.ts +93 -0
- package/src/v2/components/chat/__tests__/CopilotChatToolCallsView.test.ts +382 -0
- package/src/v2/components/chat/__tests__/CopilotChatToolRendering.e2e.test.ts +1019 -0
- package/src/v2/components/chat/__tests__/CopilotChatToolRerenders.e2e.test.ts +516 -0
- package/src/v2/components/chat/__tests__/CopilotChatUserMessage.slots.e2e.test.ts +701 -0
- package/src/v2/components/chat/__tests__/CopilotChatUserMessage.test.ts +337 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.connectingGate.test.ts +135 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.inputOverlay.test.ts +278 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.onClick.e2e.test.ts +1082 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.pinToSend.test.ts +166 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.slots.e2e.test.ts +1145 -0
- package/src/v2/components/chat/__tests__/CopilotChatView.test.ts +374 -0
- package/src/v2/components/chat/__tests__/CopilotModalHeader.slots.e2e.test.ts +636 -0
- package/src/v2/components/chat/__tests__/CopilotModalHeader.test.ts +112 -0
- package/src/v2/components/chat/__tests__/CopilotPopup.test.ts +58 -0
- package/src/v2/components/chat/__tests__/CopilotPopupView.slots.e2e.test.ts +725 -0
- package/src/v2/components/chat/__tests__/CopilotPopupView.test.ts +112 -0
- package/src/v2/components/chat/__tests__/CopilotSidebar.test.ts +58 -0
- package/src/v2/components/chat/__tests__/CopilotSidebarView.slots.e2e.test.ts +603 -0
- package/src/v2/components/chat/__tests__/CopilotSidebarView.test.ts +214 -0
- package/src/v2/components/chat/__tests__/MCPAppsUiMessage.e2e.test.ts +394 -0
- package/src/v2/components/chat/__tests__/copilot-chat-throttle.test.ts +82 -0
- package/src/v2/components/chat/__tests__/normalize-auto-scroll.test.ts +39 -0
- package/src/v2/components/chat/audioRecorder.ts +15 -0
- package/src/v2/components/chat/index.ts +52 -0
- package/src/v2/components/chat/last-user-message-context.ts +39 -0
- package/src/v2/components/chat/normalize-auto-scroll.ts +17 -0
- package/src/v2/components/chat/types.ts +481 -0
- package/src/v2/components/icons/__tests__/icons.test.ts +86 -0
- package/src/v2/components/icons/index.ts +22 -0
- package/src/v2/components/index.ts +7 -0
- package/src/v2/hooks/__tests__/standard-schema-types.test.ts +149 -0
- package/src/v2/hooks/__tests__/standard-schema.test.ts +315 -0
- package/src/v2/hooks/__tests__/use-agent-context-timing.e2e.test.ts +144 -0
- package/src/v2/hooks/__tests__/use-agent-context.test.ts +271 -0
- package/src/v2/hooks/__tests__/use-agent-error-state.test.ts +64 -0
- package/src/v2/hooks/__tests__/use-agent-stability.test.ts +268 -0
- package/src/v2/hooks/__tests__/use-agent-thread-isolation.test.ts +433 -0
- package/src/v2/hooks/__tests__/use-agent-throttle.test.ts +747 -0
- package/src/v2/hooks/__tests__/use-agent.e2e.test.ts +187 -0
- package/src/v2/hooks/__tests__/use-agent.test.ts +126 -0
- package/src/v2/hooks/__tests__/use-attachments.test.ts +181 -0
- package/src/v2/hooks/__tests__/use-component.test.ts +145 -0
- package/src/v2/hooks/__tests__/use-configure-suggestions.e2e.test.ts +527 -0
- package/src/v2/hooks/__tests__/use-configure-suggestions.test.ts +399 -0
- package/src/v2/hooks/__tests__/use-default-render-tool.test.ts +214 -0
- package/src/v2/hooks/__tests__/use-frontend-tool-available.test.ts +220 -0
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +2320 -0
- package/src/v2/hooks/__tests__/use-frontend-tool.test.ts +648 -0
- package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.ts +1379 -0
- package/src/v2/hooks/__tests__/use-human-in-the-loop.test.ts +282 -0
- package/src/v2/hooks/__tests__/use-interrupt.test.ts +345 -0
- package/src/v2/hooks/__tests__/use-katex-styles.test.ts +69 -0
- package/src/v2/hooks/__tests__/use-keyboard-height.test.ts +199 -0
- package/src/v2/hooks/__tests__/use-pin-to-send.test.ts +363 -0
- package/src/v2/hooks/__tests__/use-render-tool.test.ts +329 -0
- package/src/v2/hooks/__tests__/use-suggestions.e2e.test.ts +397 -0
- package/src/v2/hooks/__tests__/use-suggestions.test.ts +198 -0
- package/src/v2/hooks/__tests__/use-threads.test.ts +1041 -0
- package/src/v2/hooks/__tests__/zod-regression.test.ts +339 -0
- package/src/v2/hooks/index.ts +29 -0
- package/src/v2/hooks/use-agent-context.ts +55 -0
- package/src/v2/hooks/use-agent.ts +345 -0
- package/src/v2/hooks/use-attachments.ts +261 -0
- package/src/v2/hooks/use-capabilities.ts +30 -0
- package/src/v2/hooks/use-component.ts +46 -0
- package/src/v2/hooks/use-configure-suggestions.ts +252 -0
- package/src/v2/hooks/use-default-render-tool.ts +130 -0
- package/src/v2/hooks/use-frontend-tool.ts +68 -0
- package/src/v2/hooks/use-human-in-the-loop.ts +90 -0
- package/src/v2/hooks/use-interrupt.ts +257 -0
- package/src/v2/hooks/use-katex-styles.ts +44 -0
- package/src/v2/hooks/use-keyboard-height.ts +87 -0
- package/src/v2/hooks/use-pin-to-send.ts +160 -0
- package/src/v2/hooks/use-render-activity-message.ts +92 -0
- package/src/v2/hooks/use-render-custom-messages.ts +129 -0
- package/src/v2/hooks/use-render-tool.ts +128 -0
- package/src/v2/hooks/use-suggestions.ts +98 -0
- package/src/v2/hooks/use-threads.ts +208 -0
- package/src/v2/index.ts +11 -0
- package/src/v2/lib/__tests__/processPartialHtml.test.ts +84 -0
- package/src/v2/lib/__tests__/transcription-client.test.ts +65 -0
- package/src/v2/lib/processPartialHtml.ts +21 -0
- package/src/v2/lib/shallow-stable.ts +54 -0
- package/src/v2/lib/transcription-client.ts +151 -0
- package/src/v2/lib/vue-core.ts +161 -0
- package/src/v2/providers/CopilotChatConfigurationProvider.types.ts +15 -0
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +95 -0
- package/src/v2/providers/CopilotKitProvider.types.ts +66 -0
- package/src/v2/providers/CopilotKitProvider.vue +653 -0
- package/src/v2/providers/SandboxFunctionsContext.ts +11 -0
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.ts +309 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.debug.test.ts +295 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.license.test.ts +110 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.onError.test.ts +67 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.renderCustomMessages.e2e.test.ts +901 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.ts +141 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.stability.test.ts +871 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +603 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.wildcard.test.ts +104 -0
- package/src/v2/providers/index.ts +21 -0
- package/src/v2/providers/keys.ts +25 -0
- package/src/v2/providers/license-context.ts +16 -0
- package/src/v2/providers/types.ts +40 -0
- package/src/v2/providers/useCopilotChatConfiguration.ts +11 -0
- package/src/v2/providers/useCopilotKit.ts +11 -0
- package/src/v2/providers/useLicenseContext.ts +21 -0
- package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +157 -0
- package/src/v2/types/a2ui.ts +5 -0
- package/src/v2/types/defineToolCallRenderer.ts +32 -0
- package/src/v2/types/frontend-tool.ts +8 -0
- package/src/v2/types/human-in-the-loop.ts +38 -0
- package/src/v2/types/index.ts +9 -0
- package/src/v2/types/interrupt.ts +15 -0
- package/src/v2/types/sandbox-function.ts +8 -0
- package/src/v2/types/vue-activity-message-renderer.ts +22 -0
- package/src/v2/types/vue-custom-message-renderer.ts +24 -0
- package/src/v2/types/vue-tool-call-renderer.ts +44 -0
- package/tsconfig.json +27 -0
- package/vite.config.ts +49 -0
- package/vitest.config.ts +23 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { default as CopilotKitProvider } from "./CopilotKitProvider.vue";
|
|
2
|
+
export type { CopilotKitProviderProps } from "./CopilotKitProvider.types";
|
|
3
|
+
export type { DebugConfig } from "@copilotkit/shared";
|
|
4
|
+
export { default as CopilotChatConfigurationProvider } from "./CopilotChatConfigurationProvider.vue";
|
|
5
|
+
export type { CopilotChatConfigurationProviderProps } from "./CopilotChatConfigurationProvider.types";
|
|
6
|
+
export { useCopilotKit } from "./useCopilotKit";
|
|
7
|
+
export { useLicenseContext } from "./useLicenseContext";
|
|
8
|
+
export {
|
|
9
|
+
LicenseContextKey,
|
|
10
|
+
createLicenseContextValue,
|
|
11
|
+
createDefaultLicenseRef,
|
|
12
|
+
type LicenseContextValue,
|
|
13
|
+
} from "./license-context";
|
|
14
|
+
export { useSandboxFunctions } from "./SandboxFunctionsContext";
|
|
15
|
+
export { useCopilotChatConfiguration } from "./useCopilotChatConfiguration";
|
|
16
|
+
export {
|
|
17
|
+
CopilotChatDefaultLabels,
|
|
18
|
+
type CopilotChatLabels,
|
|
19
|
+
type CopilotChatConfigurationValue,
|
|
20
|
+
} from "./types";
|
|
21
|
+
export type { CopilotKitContextValue } from "./keys";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ComputedRef, InjectionKey, Ref, ShallowRef } from "vue";
|
|
2
|
+
import type { CopilotKitCoreVue } from "../lib/vue-core";
|
|
3
|
+
import type { CopilotChatConfigurationValue } from "./types";
|
|
4
|
+
import type { A2UITheme } from "../types";
|
|
5
|
+
import type { SandboxFunction } from "../types";
|
|
6
|
+
|
|
7
|
+
export interface CopilotKitContextValue {
|
|
8
|
+
copilotkit: ShallowRef<CopilotKitCoreVue>;
|
|
9
|
+
executingToolCallIds: Ref<ReadonlySet<string>>;
|
|
10
|
+
a2uiTheme: ComputedRef<A2UITheme | undefined>;
|
|
11
|
+
a2uiCatalog: ComputedRef<unknown>;
|
|
12
|
+
a2uiLoadingComponent: ComputedRef<unknown>;
|
|
13
|
+
a2uiIncludeSchema: ComputedRef<boolean>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const CopilotKitKey: InjectionKey<CopilotKitContextValue> =
|
|
17
|
+
Symbol("CopilotKit");
|
|
18
|
+
|
|
19
|
+
export const CopilotChatConfigurationKey: InjectionKey<
|
|
20
|
+
ComputedRef<CopilotChatConfigurationValue>
|
|
21
|
+
> = Symbol("CopilotChatConfiguration");
|
|
22
|
+
|
|
23
|
+
export const SandboxFunctionsKey: InjectionKey<
|
|
24
|
+
Ref<readonly SandboxFunction[]>
|
|
25
|
+
> = Symbol("SandboxFunctions");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { InjectionKey, Ref } from "vue";
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
createLicenseContextValue,
|
|
5
|
+
type LicenseContextValue,
|
|
6
|
+
} from "@copilotkit/shared";
|
|
7
|
+
|
|
8
|
+
export type { LicenseContextValue };
|
|
9
|
+
export { createLicenseContextValue };
|
|
10
|
+
|
|
11
|
+
export const LicenseContextKey: InjectionKey<Ref<LicenseContextValue>> =
|
|
12
|
+
Symbol("LicenseContext");
|
|
13
|
+
|
|
14
|
+
export function createDefaultLicenseRef(): Ref<LicenseContextValue> {
|
|
15
|
+
return ref(createLicenseContextValue(null));
|
|
16
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const CopilotChatDefaultLabels = {
|
|
2
|
+
chatInputPlaceholder: "Type a message...",
|
|
3
|
+
chatInputToolbarStartTranscribeButtonLabel: "Transcribe",
|
|
4
|
+
chatInputToolbarCancelTranscribeButtonLabel: "Cancel",
|
|
5
|
+
chatInputToolbarFinishTranscribeButtonLabel: "Finish",
|
|
6
|
+
chatInputToolbarAddButtonLabel: "Add photos or files",
|
|
7
|
+
chatInputToolbarToolsButtonLabel: "Tools",
|
|
8
|
+
assistantMessageToolbarCopyCodeLabel: "Copy",
|
|
9
|
+
assistantMessageToolbarCopyCodeCopiedLabel: "Copied",
|
|
10
|
+
assistantMessageToolbarCopyMessageLabel: "Copy",
|
|
11
|
+
assistantMessageToolbarThumbsUpLabel: "Good response",
|
|
12
|
+
assistantMessageToolbarThumbsDownLabel: "Bad response",
|
|
13
|
+
assistantMessageToolbarReadAloudLabel: "Read aloud",
|
|
14
|
+
assistantMessageToolbarRegenerateLabel: "Regenerate",
|
|
15
|
+
userMessageToolbarCopyMessageLabel: "Copy",
|
|
16
|
+
userMessageToolbarEditMessageLabel: "Edit",
|
|
17
|
+
chatDisclaimerText:
|
|
18
|
+
"AI can make mistakes. Please verify important information.",
|
|
19
|
+
chatToggleOpenLabel: "Open chat",
|
|
20
|
+
chatToggleCloseLabel: "Close chat",
|
|
21
|
+
modalHeaderTitle: "CopilotKit Chat",
|
|
22
|
+
welcomeMessageText: "How can I help you today?",
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
export type CopilotChatLabels = typeof CopilotChatDefaultLabels;
|
|
26
|
+
|
|
27
|
+
export interface CopilotChatConfigurationValue {
|
|
28
|
+
labels: CopilotChatLabels;
|
|
29
|
+
agentId: string;
|
|
30
|
+
threadId: string;
|
|
31
|
+
/**
|
|
32
|
+
* True when the current `threadId` was chosen by the caller rather than
|
|
33
|
+
* silently minted inside the provider chain. Consumers that only make
|
|
34
|
+
* sense against a real backend thread (e.g. `/connect`, suppressing the
|
|
35
|
+
* welcome screen on switch) gate on this instead of `!!threadId`.
|
|
36
|
+
*/
|
|
37
|
+
hasExplicitThreadId: boolean;
|
|
38
|
+
isModalOpen?: boolean;
|
|
39
|
+
setModalOpen?: (open: boolean) => void;
|
|
40
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { computed, inject } from "vue";
|
|
2
|
+
import type { ComputedRef } from "vue";
|
|
3
|
+
import { CopilotChatConfigurationKey } from "./keys";
|
|
4
|
+
import type { CopilotChatConfigurationValue } from "./types";
|
|
5
|
+
|
|
6
|
+
export function useCopilotChatConfiguration(): ComputedRef<CopilotChatConfigurationValue | null> {
|
|
7
|
+
const injected = inject<
|
|
8
|
+
ComputedRef<CopilotChatConfigurationValue> | undefined
|
|
9
|
+
>(CopilotChatConfigurationKey, undefined);
|
|
10
|
+
return computed(() => injected?.value ?? null);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { inject } from "vue";
|
|
2
|
+
import { CopilotKitKey } from "./keys";
|
|
3
|
+
|
|
4
|
+
export function useCopilotKit() {
|
|
5
|
+
const context = inject(CopilotKitKey);
|
|
6
|
+
if (!context) {
|
|
7
|
+
throw new Error("useCopilotKit must be used within CopilotKitProvider");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { computed, inject, type ComputedRef } from "vue";
|
|
2
|
+
import {
|
|
3
|
+
LicenseContextKey,
|
|
4
|
+
createDefaultLicenseRef,
|
|
5
|
+
type LicenseContextValue,
|
|
6
|
+
} from "./license-context";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Vue counterpart of React's `useLicenseContext()` hook.
|
|
10
|
+
*
|
|
11
|
+
* Returns a `ComputedRef<LicenseContextValue>` whose `checkFeature(...)` /
|
|
12
|
+
* `getLimit(...)` callbacks track the value installed by
|
|
13
|
+
* `CopilotKitProvider`. Falls back to a permissive default
|
|
14
|
+
* (`createLicenseContextValue(null)`) when no provider has registered the
|
|
15
|
+
* context — matching React's `createContext(createLicenseContextValue(null))`
|
|
16
|
+
* default and keeping component trees mountable in isolation.
|
|
17
|
+
*/
|
|
18
|
+
export function useLicenseContext(): ComputedRef<LicenseContextValue> {
|
|
19
|
+
const source = inject(LicenseContextKey, createDefaultLicenseRef(), true);
|
|
20
|
+
return computed(() => source.value);
|
|
21
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { defineComponent, h } from "vue";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { ToolCallStatus } from "@copilotkit/core";
|
|
5
|
+
import { defineToolCallRenderer } from "../defineToolCallRenderer";
|
|
6
|
+
import type { VueToolCallRenderer } from "../vue-tool-call-renderer";
|
|
7
|
+
|
|
8
|
+
describe("defineToolCallRenderer", () => {
|
|
9
|
+
it("defaults wildcard args to z.any and preserves runtime tool name", () => {
|
|
10
|
+
const wildcardRenderer = defineToolCallRenderer({
|
|
11
|
+
name: "*",
|
|
12
|
+
render: ({ name, args, status }) =>
|
|
13
|
+
h(
|
|
14
|
+
"div",
|
|
15
|
+
{ "data-testid": "wildcard" },
|
|
16
|
+
`${name}:${status}:${JSON.stringify(args)}`,
|
|
17
|
+
),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
expect(wildcardRenderer.name).toBe("*");
|
|
21
|
+
expect(wildcardRenderer.args.safeParse({ anything: true }).success).toBe(
|
|
22
|
+
true,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const rendered = (
|
|
26
|
+
wildcardRenderer.render as (props: {
|
|
27
|
+
name: string;
|
|
28
|
+
toolCallId: string;
|
|
29
|
+
args: Record<string, unknown>;
|
|
30
|
+
status: ToolCallStatus;
|
|
31
|
+
result: string | undefined;
|
|
32
|
+
}) => ReturnType<typeof h>
|
|
33
|
+
)({
|
|
34
|
+
name: "customTool",
|
|
35
|
+
toolCallId: "tc-wildcard-1",
|
|
36
|
+
args: { x: 1 },
|
|
37
|
+
status: ToolCallStatus.Executing,
|
|
38
|
+
result: undefined,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
expect(rendered.children).toContain("customTool");
|
|
42
|
+
expect(rendered.children).not.toContain("*:");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("exposes toolCallId to wildcard renderers", () => {
|
|
46
|
+
const wildcardRenderer = defineToolCallRenderer({
|
|
47
|
+
name: "*",
|
|
48
|
+
render: ({ name, toolCallId, status }) =>
|
|
49
|
+
h(
|
|
50
|
+
"div",
|
|
51
|
+
{ "data-testid": "wildcard" },
|
|
52
|
+
`${name}:${toolCallId}:${status}`,
|
|
53
|
+
),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const rendered = (
|
|
57
|
+
wildcardRenderer.render as (props: {
|
|
58
|
+
name: string;
|
|
59
|
+
toolCallId: string;
|
|
60
|
+
args: Record<string, unknown>;
|
|
61
|
+
status: ToolCallStatus;
|
|
62
|
+
result: string | undefined;
|
|
63
|
+
}) => ReturnType<typeof h>
|
|
64
|
+
)({
|
|
65
|
+
name: "customTool",
|
|
66
|
+
toolCallId: "tc-123",
|
|
67
|
+
args: {},
|
|
68
|
+
status: ToolCallStatus.InProgress,
|
|
69
|
+
result: undefined,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
expect(rendered.children).toContain("tc-123");
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("supports mixed renderer arrays without type casts", () => {
|
|
76
|
+
const wildcardRenderer = defineToolCallRenderer({
|
|
77
|
+
name: "*",
|
|
78
|
+
render: ({ name }) => h("div", `fallback:${name}`),
|
|
79
|
+
});
|
|
80
|
+
const weatherRenderer = defineToolCallRenderer({
|
|
81
|
+
name: "get_weather",
|
|
82
|
+
args: z.object({ location: z.string() }),
|
|
83
|
+
render: ({ args }) => h("div", `weather:${args.location}`),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const renderers: VueToolCallRenderer<unknown>[] = [
|
|
87
|
+
wildcardRenderer,
|
|
88
|
+
weatherRenderer,
|
|
89
|
+
];
|
|
90
|
+
expect(renderers).toHaveLength(2);
|
|
91
|
+
expect(renderers[0]?.name).toBe("*");
|
|
92
|
+
expect(renderers[1]?.name).toBe("get_weather");
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("accepts a Vue component as the renderer", () => {
|
|
96
|
+
const ToolRenderer = defineComponent({
|
|
97
|
+
props: {
|
|
98
|
+
name: {
|
|
99
|
+
type: String,
|
|
100
|
+
required: true,
|
|
101
|
+
},
|
|
102
|
+
status: {
|
|
103
|
+
type: String,
|
|
104
|
+
required: true,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
template: `<div data-testid="component-renderer">{{ name }}:{{ status }}</div>`,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const componentRenderer = defineToolCallRenderer({
|
|
111
|
+
name: "get_weather",
|
|
112
|
+
args: z.object({ location: z.string() }),
|
|
113
|
+
render: ToolRenderer,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
expect(componentRenderer.render).toBe(ToolRenderer);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it("infers typed args shape for specific tools", () => {
|
|
120
|
+
const typedRenderer = defineToolCallRenderer({
|
|
121
|
+
name: "get_weather",
|
|
122
|
+
args: z.object({
|
|
123
|
+
location: z.string(),
|
|
124
|
+
units: z.enum(["celsius", "fahrenheit"]).optional(),
|
|
125
|
+
}),
|
|
126
|
+
render: ({ args, toolCallId, status, result }) => {
|
|
127
|
+
if (status === ToolCallStatus.InProgress) {
|
|
128
|
+
const locationMaybe: string | undefined = args.location;
|
|
129
|
+
return h("div", `loading:${toolCallId}:${locationMaybe ?? ""}`);
|
|
130
|
+
}
|
|
131
|
+
if (status === ToolCallStatus.Executing) {
|
|
132
|
+
const location: string = args.location;
|
|
133
|
+
return h("div", `executing:${toolCallId}:${location}`);
|
|
134
|
+
}
|
|
135
|
+
return h("div", `complete:${toolCallId}:${args.location}:${result}`);
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const rendered = (
|
|
140
|
+
typedRenderer.render as (props: {
|
|
141
|
+
name: string;
|
|
142
|
+
toolCallId: string;
|
|
143
|
+
args: { location: string; units?: "celsius" | "fahrenheit" };
|
|
144
|
+
status: ToolCallStatus;
|
|
145
|
+
result: string | undefined;
|
|
146
|
+
}) => ReturnType<typeof h>
|
|
147
|
+
)({
|
|
148
|
+
name: "get_weather",
|
|
149
|
+
toolCallId: "tc-weather-1",
|
|
150
|
+
args: { location: "Paris", units: "celsius" },
|
|
151
|
+
status: ToolCallStatus.Executing,
|
|
152
|
+
result: undefined,
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
expect(rendered.children).toContain("executing:tc-weather-1:Paris");
|
|
156
|
+
});
|
|
157
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { StandardSchemaV1, InferSchemaOutput } from "@copilotkit/shared";
|
|
3
|
+
import type { VueToolCallRenderer } from "./vue-tool-call-renderer";
|
|
4
|
+
import type { VueToolCallRendererRenderFn } from "./vue-tool-call-renderer";
|
|
5
|
+
|
|
6
|
+
export function defineToolCallRenderer(def: {
|
|
7
|
+
name: "*";
|
|
8
|
+
render: VueToolCallRendererRenderFn<unknown>;
|
|
9
|
+
agentId?: string;
|
|
10
|
+
}): VueToolCallRenderer<unknown>;
|
|
11
|
+
|
|
12
|
+
export function defineToolCallRenderer<S extends StandardSchemaV1>(def: {
|
|
13
|
+
name: string;
|
|
14
|
+
args: S;
|
|
15
|
+
render: VueToolCallRendererRenderFn<InferSchemaOutput<S>>;
|
|
16
|
+
agentId?: string;
|
|
17
|
+
}): VueToolCallRenderer<InferSchemaOutput<S>>;
|
|
18
|
+
|
|
19
|
+
export function defineToolCallRenderer<S extends StandardSchemaV1>(def: {
|
|
20
|
+
name: string;
|
|
21
|
+
args?: S;
|
|
22
|
+
render: VueToolCallRendererRenderFn<unknown>;
|
|
23
|
+
agentId?: string;
|
|
24
|
+
}): VueToolCallRenderer<unknown> {
|
|
25
|
+
const argsSchema = def.name === "*" && !def.args ? z.any() : def.args;
|
|
26
|
+
return {
|
|
27
|
+
name: def.name,
|
|
28
|
+
args: argsSchema as StandardSchemaV1<any, unknown>,
|
|
29
|
+
render: def.render as VueToolCallRenderer<unknown>["render"],
|
|
30
|
+
...(def.agentId ? { agentId: def.agentId } : {}),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FrontendTool } from "@copilotkit/core";
|
|
2
|
+
import type { VueToolCallRenderer } from "./vue-tool-call-renderer";
|
|
3
|
+
|
|
4
|
+
export type VueFrontendTool<
|
|
5
|
+
T extends Record<string, unknown> = Record<string, unknown>,
|
|
6
|
+
> = FrontendTool<T> & {
|
|
7
|
+
render?: VueToolCallRenderer<T>["render"];
|
|
8
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { FrontendTool, ToolCallStatus } from "@copilotkit/core";
|
|
2
|
+
import type { Component, VNodeChild } from "vue";
|
|
3
|
+
|
|
4
|
+
export type VueHumanInTheLoopRenderProps<T> =
|
|
5
|
+
| {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
args: Partial<T>;
|
|
9
|
+
status: ToolCallStatus.InProgress;
|
|
10
|
+
result: undefined;
|
|
11
|
+
respond: undefined;
|
|
12
|
+
}
|
|
13
|
+
| {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
args: T;
|
|
17
|
+
status: ToolCallStatus.Executing;
|
|
18
|
+
result: undefined;
|
|
19
|
+
respond: (result: unknown) => Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
| {
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
args: T;
|
|
25
|
+
status: ToolCallStatus.Complete;
|
|
26
|
+
result: string;
|
|
27
|
+
respond: undefined;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type VueHumanInTheLoopRenderFn<T> =
|
|
31
|
+
| ((props: VueHumanInTheLoopRenderProps<T>) => VNodeChild)
|
|
32
|
+
| Component<VueHumanInTheLoopRenderProps<T>>;
|
|
33
|
+
|
|
34
|
+
export type VueHumanInTheLoop<
|
|
35
|
+
T extends Record<string, unknown> = Record<string, unknown>,
|
|
36
|
+
> = Omit<FrontendTool<T>, "handler"> & {
|
|
37
|
+
render: VueHumanInTheLoopRenderFn<T>;
|
|
38
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./vue-tool-call-renderer";
|
|
2
|
+
export * from "./vue-activity-message-renderer";
|
|
3
|
+
export * from "./vue-custom-message-renderer";
|
|
4
|
+
export * from "./frontend-tool";
|
|
5
|
+
export * from "./human-in-the-loop";
|
|
6
|
+
export * from "./defineToolCallRenderer";
|
|
7
|
+
export * from "./interrupt";
|
|
8
|
+
export * from "./a2ui";
|
|
9
|
+
export * from "./sandbox-function";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface InterruptEvent<TValue = unknown> {
|
|
2
|
+
name: string;
|
|
3
|
+
value: TValue;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface InterruptHandlerProps<TValue = unknown> {
|
|
7
|
+
event: InterruptEvent<TValue>;
|
|
8
|
+
resolve: (response: unknown) => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface InterruptRenderProps<TValue = unknown, TResult = unknown> {
|
|
12
|
+
event: InterruptEvent<TValue>;
|
|
13
|
+
result: TResult;
|
|
14
|
+
resolve: (response: unknown) => void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ActivityMessage } from "@ag-ui/core";
|
|
2
|
+
import type { AbstractAgent } from "@ag-ui/client";
|
|
3
|
+
import type { z } from "zod";
|
|
4
|
+
import type { Component, VNodeChild } from "vue";
|
|
5
|
+
|
|
6
|
+
export interface VueActivityMessageRendererProps<TActivityContent> {
|
|
7
|
+
activityType: string;
|
|
8
|
+
content: TActivityContent;
|
|
9
|
+
message: ActivityMessage;
|
|
10
|
+
agent: AbstractAgent | undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type VueActivityMessageRendererRenderFn<TActivityContent> =
|
|
14
|
+
| ((props: VueActivityMessageRendererProps<TActivityContent>) => VNodeChild)
|
|
15
|
+
| Component<VueActivityMessageRendererProps<TActivityContent>>;
|
|
16
|
+
|
|
17
|
+
export interface VueActivityMessageRenderer<TActivityContent> {
|
|
18
|
+
activityType: string;
|
|
19
|
+
agentId?: string;
|
|
20
|
+
content: z.ZodSchema<TActivityContent>;
|
|
21
|
+
render: VueActivityMessageRendererRenderFn<TActivityContent>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Message } from "@ag-ui/core";
|
|
2
|
+
import type { Component, VNodeChild } from "vue";
|
|
3
|
+
|
|
4
|
+
export type VueCustomMessageRendererPosition = "before" | "after";
|
|
5
|
+
|
|
6
|
+
export interface VueCustomMessageRendererProps {
|
|
7
|
+
message: Message;
|
|
8
|
+
position: VueCustomMessageRendererPosition;
|
|
9
|
+
runId: string;
|
|
10
|
+
messageIndex: number;
|
|
11
|
+
messageIndexInRun: number;
|
|
12
|
+
numberOfMessagesInRun: number;
|
|
13
|
+
agentId: string;
|
|
14
|
+
stateSnapshot: unknown;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type VueCustomMessageRendererRenderFn =
|
|
18
|
+
| ((props: VueCustomMessageRendererProps) => VNodeChild)
|
|
19
|
+
| Component<VueCustomMessageRendererProps>;
|
|
20
|
+
|
|
21
|
+
export interface VueCustomMessageRenderer {
|
|
22
|
+
agentId?: string;
|
|
23
|
+
render: VueCustomMessageRendererRenderFn;
|
|
24
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ToolCallStatus } from "@copilotkit/core";
|
|
2
|
+
import type { StandardSchemaV1 } from "@copilotkit/shared";
|
|
3
|
+
import type { Component, VNodeChild } from "vue";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Props passed to a Vue tool call render function.
|
|
7
|
+
*/
|
|
8
|
+
export type VueToolCallRendererRenderProps<T> =
|
|
9
|
+
| {
|
|
10
|
+
name: string;
|
|
11
|
+
toolCallId: string;
|
|
12
|
+
args: Partial<T>;
|
|
13
|
+
status: ToolCallStatus.InProgress;
|
|
14
|
+
result: undefined;
|
|
15
|
+
}
|
|
16
|
+
| {
|
|
17
|
+
name: string;
|
|
18
|
+
toolCallId: string;
|
|
19
|
+
args: T;
|
|
20
|
+
status: ToolCallStatus.Executing;
|
|
21
|
+
result: undefined;
|
|
22
|
+
}
|
|
23
|
+
| {
|
|
24
|
+
name: string;
|
|
25
|
+
toolCallId: string;
|
|
26
|
+
args: T;
|
|
27
|
+
status: ToolCallStatus.Complete;
|
|
28
|
+
result: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Vue component or render function for tool call rendering.
|
|
33
|
+
* Component is normalized to (props) => VNodeChild internally.
|
|
34
|
+
*/
|
|
35
|
+
export type VueToolCallRendererRenderFn<T> =
|
|
36
|
+
| ((props: VueToolCallRendererRenderProps<T>) => VNodeChild)
|
|
37
|
+
| Component<VueToolCallRendererRenderProps<T>>;
|
|
38
|
+
|
|
39
|
+
export interface VueToolCallRenderer<T = unknown> {
|
|
40
|
+
name: string;
|
|
41
|
+
args: StandardSchemaV1<any, T>;
|
|
42
|
+
agentId?: string;
|
|
43
|
+
render: VueToolCallRendererRenderFn<T>;
|
|
44
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "@copilotkit/typescript-config/base.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"target": "ES2022",
|
|
8
|
+
"outDir": "dist",
|
|
9
|
+
"rootDir": "src",
|
|
10
|
+
"baseUrl": ".",
|
|
11
|
+
"paths": {
|
|
12
|
+
"@/*": ["./src/*"],
|
|
13
|
+
"@copilotkit/core": ["../core/dist/index.d.mts", "../core/src/index.ts"],
|
|
14
|
+
"@copilotkit/shared": [
|
|
15
|
+
"../shared/dist/index.d.mts",
|
|
16
|
+
"../shared/src/index.ts"
|
|
17
|
+
],
|
|
18
|
+
"@copilotkit/web-inspector": [
|
|
19
|
+
"../web-inspector/dist/index.d.mts",
|
|
20
|
+
"../web-inspector/src/index.ts"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"types": ["vitest/globals", "node"]
|
|
24
|
+
},
|
|
25
|
+
"include": ["src/**/*", "src/**/*.vue"],
|
|
26
|
+
"exclude": ["dist", "node_modules", "src/**/__tests__/**"]
|
|
27
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { defineConfig } from "vite";
|
|
3
|
+
import vue from "@vitejs/plugin-vue";
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [vue()],
|
|
7
|
+
resolve: {
|
|
8
|
+
alias: {
|
|
9
|
+
"@": resolve(__dirname, "./src"),
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
build: {
|
|
13
|
+
lib: {
|
|
14
|
+
entry: {
|
|
15
|
+
index: resolve(__dirname, "src/index.ts"),
|
|
16
|
+
"v2/index": resolve(__dirname, "src/v2/index.ts"),
|
|
17
|
+
},
|
|
18
|
+
name: "CopilotKitVue",
|
|
19
|
+
formats: ["es", "cjs"],
|
|
20
|
+
fileName: (format, entryName) =>
|
|
21
|
+
format === "es" ? `${entryName}.mjs` : `${entryName}.cjs`,
|
|
22
|
+
},
|
|
23
|
+
rollupOptions: {
|
|
24
|
+
external: [
|
|
25
|
+
"vue",
|
|
26
|
+
"@a2ui/web_core",
|
|
27
|
+
"@a2ui/web_core/v0_9",
|
|
28
|
+
"@a2ui/web_core/v0_9/basic_catalog",
|
|
29
|
+
"@ag-ui/client",
|
|
30
|
+
"@ag-ui/core",
|
|
31
|
+
"@copilotkit/core",
|
|
32
|
+
"@copilotkit/shared",
|
|
33
|
+
"@copilotkit/web-inspector",
|
|
34
|
+
"@jetbrains/websandbox",
|
|
35
|
+
"streamdown-vue",
|
|
36
|
+
"katex",
|
|
37
|
+
"lucide-vue-next",
|
|
38
|
+
"zod",
|
|
39
|
+
"zod-to-json-schema",
|
|
40
|
+
],
|
|
41
|
+
output: {
|
|
42
|
+
globals: { vue: "Vue" },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
outDir: "dist",
|
|
46
|
+
emptyOutDir: true,
|
|
47
|
+
sourcemap: true,
|
|
48
|
+
},
|
|
49
|
+
});
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
import vue from "@vitejs/plugin-vue";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [vue()],
|
|
7
|
+
test: {
|
|
8
|
+
environment: "jsdom",
|
|
9
|
+
setupFiles: ["./src/v2/__tests__/setup.ts"],
|
|
10
|
+
include: ["**/__tests__/**/*.test.ts"],
|
|
11
|
+
globals: true,
|
|
12
|
+
reporters: [["default", { summary: false }]],
|
|
13
|
+
},
|
|
14
|
+
resolve: {
|
|
15
|
+
alias: {
|
|
16
|
+
"@": resolve(__dirname, "./src"),
|
|
17
|
+
"@copilotkit/web-inspector": resolve(
|
|
18
|
+
__dirname,
|
|
19
|
+
"./src/v2/__tests__/mocks/web-inspector.ts",
|
|
20
|
+
),
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|