@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,125 @@
|
|
|
1
|
+
import { computed, defineComponent, h, type PropType } from "vue";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { VueActivityMessageRenderer } from "../types";
|
|
4
|
+
import type { A2UITheme } from "../types";
|
|
5
|
+
import A2UISurfaceActivityRenderer from "./A2UISurfaceActivityRenderer.vue";
|
|
6
|
+
|
|
7
|
+
const A2UI_OPERATIONS_KEY = "a2ui_operations";
|
|
8
|
+
|
|
9
|
+
export type A2UIMessageRendererOptions = {
|
|
10
|
+
theme: A2UITheme;
|
|
11
|
+
catalog?: any;
|
|
12
|
+
loadingComponent?: unknown;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Default loading component shown while an A2UI surface is generating.
|
|
17
|
+
* Mirrors React's `DefaultA2UILoading` in
|
|
18
|
+
* `packages/react-core/src/v2/a2ui/A2UIMessageRenderer.tsx`:
|
|
19
|
+
* an animated dot + "Generating UI..." label + three shimmer bars
|
|
20
|
+
* (80% / 60% / 40% widths) with staggered `cpk-a2ui-pulse` opacity animation.
|
|
21
|
+
*/
|
|
22
|
+
const DefaultA2UILoading = defineComponent({
|
|
23
|
+
name: "DefaultA2UILoading",
|
|
24
|
+
setup() {
|
|
25
|
+
const barWidths = [0.8, 0.6, 0.4] as const;
|
|
26
|
+
return () =>
|
|
27
|
+
h(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
class:
|
|
31
|
+
"cpk:flex cpk:flex-col cpk:gap-3 cpk:rounded-xl cpk:border cpk:border-gray-100 cpk:bg-gray-50/50 cpk:p-5",
|
|
32
|
+
style: { minHeight: "120px" },
|
|
33
|
+
"data-testid": "a2ui-loading",
|
|
34
|
+
},
|
|
35
|
+
[
|
|
36
|
+
h("div", { class: "cpk:flex cpk:items-center cpk:gap-2" }, [
|
|
37
|
+
h("div", {
|
|
38
|
+
class: "cpk:h-3 cpk:w-3 cpk:rounded-full cpk:bg-gray-200",
|
|
39
|
+
style: {
|
|
40
|
+
animation: "cpk-a2ui-pulse 1.5s ease-in-out infinite",
|
|
41
|
+
},
|
|
42
|
+
"data-testid": "a2ui-loading-dot",
|
|
43
|
+
}),
|
|
44
|
+
h(
|
|
45
|
+
"span",
|
|
46
|
+
{
|
|
47
|
+
class: "cpk:text-xs cpk:font-medium cpk:text-gray-400",
|
|
48
|
+
},
|
|
49
|
+
"Generating UI...",
|
|
50
|
+
),
|
|
51
|
+
]),
|
|
52
|
+
h(
|
|
53
|
+
"div",
|
|
54
|
+
{ class: "cpk:flex cpk:flex-col cpk:gap-2" },
|
|
55
|
+
barWidths.map((width, i) =>
|
|
56
|
+
h("div", {
|
|
57
|
+
key: i,
|
|
58
|
+
class: "cpk:h-3 cpk:rounded cpk:bg-gray-200/70",
|
|
59
|
+
style: {
|
|
60
|
+
width: `${width * 100}%`,
|
|
61
|
+
animation: `cpk-a2ui-pulse 1.5s ease-in-out ${i * 0.15}s infinite`,
|
|
62
|
+
},
|
|
63
|
+
"data-testid": "a2ui-loading-bar",
|
|
64
|
+
}),
|
|
65
|
+
),
|
|
66
|
+
),
|
|
67
|
+
h(
|
|
68
|
+
"style",
|
|
69
|
+
{},
|
|
70
|
+
`@keyframes cpk-a2ui-pulse {
|
|
71
|
+
0%, 100% { opacity: 0.4; }
|
|
72
|
+
50% { opacity: 1; }
|
|
73
|
+
}`,
|
|
74
|
+
),
|
|
75
|
+
],
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export function createA2UIMessageRenderer(
|
|
81
|
+
options: A2UIMessageRendererOptions,
|
|
82
|
+
): VueActivityMessageRenderer<any> {
|
|
83
|
+
return {
|
|
84
|
+
activityType: "a2ui-surface",
|
|
85
|
+
content: z.any(),
|
|
86
|
+
render: defineComponent({
|
|
87
|
+
name: "A2UIMessageRendererHost",
|
|
88
|
+
props: {
|
|
89
|
+
activityType: { type: String, required: true },
|
|
90
|
+
content: { type: Object as PropType<any>, required: true },
|
|
91
|
+
message: { type: Object as PropType<any>, required: true },
|
|
92
|
+
agent: {
|
|
93
|
+
type: Object as PropType<any>,
|
|
94
|
+
required: false,
|
|
95
|
+
default: undefined,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
setup(props) {
|
|
99
|
+
const operations = computed(() =>
|
|
100
|
+
Array.isArray(props.content?.[A2UI_OPERATIONS_KEY])
|
|
101
|
+
? props.content[A2UI_OPERATIONS_KEY]
|
|
102
|
+
: [],
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
return () => {
|
|
106
|
+
if (operations.value.length === 0) {
|
|
107
|
+
if (options.loadingComponent) {
|
|
108
|
+
return h(options.loadingComponent as any);
|
|
109
|
+
}
|
|
110
|
+
return h(DefaultA2UILoading);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return h(A2UISurfaceActivityRenderer, {
|
|
114
|
+
activityType: "a2ui-surface",
|
|
115
|
+
content: { operations: operations.value },
|
|
116
|
+
message: props.message,
|
|
117
|
+
agent: props.agent,
|
|
118
|
+
theme: options.theme,
|
|
119
|
+
catalog: options.catalog,
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
}),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
computed,
|
|
4
|
+
h,
|
|
5
|
+
onBeforeUnmount,
|
|
6
|
+
shallowRef,
|
|
7
|
+
ref,
|
|
8
|
+
watch,
|
|
9
|
+
type VNode,
|
|
10
|
+
} from "vue";
|
|
11
|
+
import type { ActivityMessage } from "@ag-ui/core";
|
|
12
|
+
import type { A2UITheme } from "../types";
|
|
13
|
+
import type { A2UIOperation } from "./a2ui";
|
|
14
|
+
import { getOperationSurfaceId } from "./a2ui";
|
|
15
|
+
import { useCopilotKit } from "../providers";
|
|
16
|
+
import { MessageProcessor, type SurfaceModel } from "@a2ui/web_core/v0_9";
|
|
17
|
+
import {
|
|
18
|
+
vueBasicCatalog,
|
|
19
|
+
A2uiSurface,
|
|
20
|
+
type VueComponentImplementation,
|
|
21
|
+
} from "./a2ui/index";
|
|
22
|
+
|
|
23
|
+
const DEFAULT_SURFACE_ID = "default";
|
|
24
|
+
|
|
25
|
+
const props = defineProps<{
|
|
26
|
+
activityType: string;
|
|
27
|
+
content: { operations: A2UIOperation[] };
|
|
28
|
+
message: ActivityMessage;
|
|
29
|
+
agent?: object;
|
|
30
|
+
theme?: A2UITheme;
|
|
31
|
+
catalog?: any;
|
|
32
|
+
}>();
|
|
33
|
+
|
|
34
|
+
const { copilotkit } = useCopilotKit();
|
|
35
|
+
|
|
36
|
+
// MessageProcessor from @a2ui/web_core — framework-agnostic
|
|
37
|
+
// Use shallowRef to avoid Vue's deep UnwrapRef which strips private class members
|
|
38
|
+
const processorRef =
|
|
39
|
+
shallowRef<MessageProcessor<VueComponentImplementation> | null>(null);
|
|
40
|
+
// Version counter to trigger Vue reactivity on processor state changes
|
|
41
|
+
const version = ref(0);
|
|
42
|
+
// Error state
|
|
43
|
+
const error = ref<string | null>(null);
|
|
44
|
+
// Track last processed operations hash to avoid re-processing
|
|
45
|
+
let lastOpsHash = "";
|
|
46
|
+
|
|
47
|
+
function getOrCreateProcessor(): MessageProcessor<VueComponentImplementation> {
|
|
48
|
+
if (!processorRef.value) {
|
|
49
|
+
const catalog = props.catalog ?? vueBasicCatalog;
|
|
50
|
+
processorRef.value = new MessageProcessor<VueComponentImplementation>(
|
|
51
|
+
[catalog],
|
|
52
|
+
(action: unknown) => {
|
|
53
|
+
handleAction(action);
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
return processorRef.value;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function handleAction(message: unknown) {
|
|
61
|
+
if (!props.agent) return;
|
|
62
|
+
try {
|
|
63
|
+
copilotkit.value.setProperties({
|
|
64
|
+
...(copilotkit.value.properties ?? {}),
|
|
65
|
+
a2uiAction: message,
|
|
66
|
+
});
|
|
67
|
+
await copilotkit.value.runAgent({ agent: props.agent as any });
|
|
68
|
+
} finally {
|
|
69
|
+
const { a2uiAction, ...rest } = copilotkit.value.properties ?? {};
|
|
70
|
+
copilotkit.value.setProperties(rest);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function processOperations(operations: A2UIOperation[]) {
|
|
75
|
+
if (!operations?.length) return;
|
|
76
|
+
|
|
77
|
+
const hash = JSON.stringify(operations);
|
|
78
|
+
if (hash === lastOpsHash) return;
|
|
79
|
+
lastOpsHash = hash;
|
|
80
|
+
|
|
81
|
+
const processor = getOrCreateProcessor();
|
|
82
|
+
try {
|
|
83
|
+
// Group operations by surface ID
|
|
84
|
+
const grouped = new Map<string, A2UIOperation[]>();
|
|
85
|
+
for (const op of operations) {
|
|
86
|
+
const surfaceId = getOperationSurfaceId(op) ?? DEFAULT_SURFACE_ID;
|
|
87
|
+
if (!grouped.has(surfaceId)) grouped.set(surfaceId, []);
|
|
88
|
+
grouped.get(surfaceId)!.push(op);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// For each surface, skip createSurface if the surface already exists
|
|
92
|
+
for (const [surfaceId, ops] of grouped) {
|
|
93
|
+
const existing = processor.model.getSurface(surfaceId);
|
|
94
|
+
const filtered = existing
|
|
95
|
+
? ops.filter((op) => !(op as any)?.createSurface)
|
|
96
|
+
: ops;
|
|
97
|
+
processor.processMessages(filtered as any);
|
|
98
|
+
}
|
|
99
|
+
error.value = null;
|
|
100
|
+
} catch (err) {
|
|
101
|
+
console.warn("[A2UI Vue] processMessages error:", err);
|
|
102
|
+
error.value = err instanceof Error ? err.message : String(err);
|
|
103
|
+
}
|
|
104
|
+
version.value++;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Process operations on mount and when they change
|
|
108
|
+
watch(
|
|
109
|
+
() => [props.content.operations, props.theme, props.catalog, props.agent],
|
|
110
|
+
() => {
|
|
111
|
+
processOperations(props.content.operations);
|
|
112
|
+
},
|
|
113
|
+
{ deep: true, immediate: true },
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
onBeforeUnmount(() => {
|
|
117
|
+
processorRef.value = null;
|
|
118
|
+
lastOpsHash = "";
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const hasOperations = computed(
|
|
122
|
+
() => (props.content.operations ?? []).length > 0,
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
// Compute the list of surfaces to render
|
|
126
|
+
const surfaceEntries = computed(() => {
|
|
127
|
+
// Touch version to ensure reactivity
|
|
128
|
+
void version.value;
|
|
129
|
+
|
|
130
|
+
if (!processorRef.value) return [];
|
|
131
|
+
|
|
132
|
+
const entries: Array<{
|
|
133
|
+
surfaceId: string;
|
|
134
|
+
surface: SurfaceModel<VueComponentImplementation>;
|
|
135
|
+
}> = [];
|
|
136
|
+
|
|
137
|
+
// Group operations by surface to know which surfaces we expect
|
|
138
|
+
const grouped = new Map<string, A2UIOperation[]>();
|
|
139
|
+
for (const op of props.content.operations ?? []) {
|
|
140
|
+
const surfaceId = getOperationSurfaceId(op) ?? DEFAULT_SURFACE_ID;
|
|
141
|
+
if (!grouped.has(surfaceId)) grouped.set(surfaceId, []);
|
|
142
|
+
grouped.get(surfaceId)!.push(op);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
for (const [surfaceId] of grouped) {
|
|
146
|
+
const surface = processorRef.value.model.getSurface(surfaceId);
|
|
147
|
+
if (surface) {
|
|
148
|
+
entries.push({ surfaceId, surface });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return entries;
|
|
153
|
+
});
|
|
154
|
+
</script>
|
|
155
|
+
|
|
156
|
+
<template>
|
|
157
|
+
<div
|
|
158
|
+
v-if="hasOperations"
|
|
159
|
+
data-copilotkit
|
|
160
|
+
:data-activity-type="activityType"
|
|
161
|
+
:data-message-id="message.id"
|
|
162
|
+
>
|
|
163
|
+
<div
|
|
164
|
+
v-if="error"
|
|
165
|
+
class="cpk:rounded-lg cpk:border cpk:border-red-200 cpk:bg-red-50 cpk:p-3 cpk:text-sm cpk:text-red-700"
|
|
166
|
+
>
|
|
167
|
+
A2UI render error: {{ error }}
|
|
168
|
+
</div>
|
|
169
|
+
<div
|
|
170
|
+
v-else
|
|
171
|
+
class="cpk:flex cpk:min-h-0 cpk:flex-1 cpk:flex-col cpk:gap-6 cpk:overflow-auto cpk:py-6"
|
|
172
|
+
data-testid="a2ui-activity-renderer"
|
|
173
|
+
>
|
|
174
|
+
<div
|
|
175
|
+
v-for="entry in surfaceEntries"
|
|
176
|
+
:key="entry.surfaceId"
|
|
177
|
+
class="cpk:flex cpk:w-full cpk:flex-none cpk:flex-col cpk:gap-4"
|
|
178
|
+
:data-surface-id="entry.surfaceId"
|
|
179
|
+
>
|
|
180
|
+
<div class="a2ui-surface cpk:flex cpk:flex-1">
|
|
181
|
+
<A2uiSurface :surface="entry.surface" />
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
</template>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineOptions({
|
|
3
|
+
inheritAttrs: false,
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
import { onMounted, onUnmounted, shallowRef, useAttrs } from "vue";
|
|
7
|
+
import type { CopilotKitCoreVue } from "../lib/vue-core";
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
core?: CopilotKitCoreVue | null;
|
|
11
|
+
}>();
|
|
12
|
+
|
|
13
|
+
const attrs = useAttrs();
|
|
14
|
+
const inspectorTag = shallowRef<string | null>(null);
|
|
15
|
+
|
|
16
|
+
let isMounted = true;
|
|
17
|
+
|
|
18
|
+
onMounted(() => {
|
|
19
|
+
void import("@copilotkit/web-inspector")
|
|
20
|
+
.then((mod) => {
|
|
21
|
+
mod.defineWebInspector?.();
|
|
22
|
+
if (!isMounted) return;
|
|
23
|
+
inspectorTag.value = mod.WEB_INSPECTOR_TAG;
|
|
24
|
+
})
|
|
25
|
+
.catch((error: unknown) => {
|
|
26
|
+
console.error("Failed to load CopilotKit inspector:", error);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
onUnmounted(() => {
|
|
31
|
+
isMounted = false;
|
|
32
|
+
});
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<component
|
|
37
|
+
:is="inspectorTag"
|
|
38
|
+
v-if="inspectorTag"
|
|
39
|
+
v-bind="attrs"
|
|
40
|
+
:core.prop="props.core ?? null"
|
|
41
|
+
/>
|
|
42
|
+
</template>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
featureName: string;
|
|
4
|
+
}>();
|
|
5
|
+
|
|
6
|
+
const containerStyle = {
|
|
7
|
+
padding: "8px 12px",
|
|
8
|
+
backgroundColor: "#fffbeb",
|
|
9
|
+
border: "1px solid #fbbf24",
|
|
10
|
+
borderRadius: "6px",
|
|
11
|
+
fontSize: "13px",
|
|
12
|
+
color: "#92400e",
|
|
13
|
+
fontFamily:
|
|
14
|
+
"-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif",
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
const linkStyle = {
|
|
18
|
+
color: "#b45309",
|
|
19
|
+
textDecoration: "underline",
|
|
20
|
+
} as const;
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div :style="containerStyle" data-testid="copilot-inline-feature-warning">
|
|
25
|
+
⚠ The "{{ featureName }}" feature requires a CopilotKit license.
|
|
26
|
+
<a
|
|
27
|
+
href="https://copilotkit.ai/pricing"
|
|
28
|
+
target="_blank"
|
|
29
|
+
rel="noopener noreferrer"
|
|
30
|
+
:style="linkStyle"
|
|
31
|
+
>
|
|
32
|
+
Get one at copilotkit.ai/pricing
|
|
33
|
+
</a>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, getCurrentInstance, onBeforeUnmount, onMounted } from "vue";
|
|
3
|
+
|
|
4
|
+
// Total reserved vertical space for the fixed license banner: banner height
|
|
5
|
+
// (~36px) + bottom offset (8px) + visual gap above the chat input (~8px).
|
|
6
|
+
const LICENSE_BANNER_OFFSET_PX = 52;
|
|
7
|
+
const LICENSE_BANNER_OFFSET_VAR = "--copilotkit-license-banner-offset";
|
|
8
|
+
|
|
9
|
+
type LicenseBannerType =
|
|
10
|
+
| "no_license"
|
|
11
|
+
| "expired"
|
|
12
|
+
| "expiring"
|
|
13
|
+
| "invalid"
|
|
14
|
+
| "feature_unlicensed";
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(
|
|
17
|
+
defineProps<{
|
|
18
|
+
type: LicenseBannerType;
|
|
19
|
+
featureName?: string;
|
|
20
|
+
expiryDate?: string;
|
|
21
|
+
graceRemaining?: number;
|
|
22
|
+
}>(),
|
|
23
|
+
{
|
|
24
|
+
featureName: undefined,
|
|
25
|
+
expiryDate: undefined,
|
|
26
|
+
graceRemaining: undefined,
|
|
27
|
+
},
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const emit = defineEmits<{
|
|
31
|
+
dismiss: [];
|
|
32
|
+
}>();
|
|
33
|
+
|
|
34
|
+
interface BannerSpec {
|
|
35
|
+
severity: "info" | "warning" | "critical";
|
|
36
|
+
message: string;
|
|
37
|
+
actionLabel: string;
|
|
38
|
+
actionUrl: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const spec = computed<BannerSpec | null>(() => {
|
|
42
|
+
switch (props.type) {
|
|
43
|
+
case "no_license":
|
|
44
|
+
return {
|
|
45
|
+
severity: "info",
|
|
46
|
+
message: "Powered by CopilotKit",
|
|
47
|
+
actionLabel: "Get a license",
|
|
48
|
+
actionUrl: "https://copilotkit.ai/pricing",
|
|
49
|
+
};
|
|
50
|
+
case "feature_unlicensed":
|
|
51
|
+
return {
|
|
52
|
+
severity: "warning",
|
|
53
|
+
message: `⚠ The "${props.featureName ?? ""}" feature requires a CopilotKit license.`,
|
|
54
|
+
actionLabel: "Get a license",
|
|
55
|
+
actionUrl: "https://copilotkit.ai/pricing",
|
|
56
|
+
};
|
|
57
|
+
case "expiring": {
|
|
58
|
+
const days = props.graceRemaining;
|
|
59
|
+
const dayLabel = days === 1 ? "day" : "days";
|
|
60
|
+
return {
|
|
61
|
+
severity: "warning",
|
|
62
|
+
message: `Your CopilotKit license expires in ${days} ${dayLabel}. Please renew.`,
|
|
63
|
+
actionLabel: "Renew",
|
|
64
|
+
actionUrl: "https://cloud.copilotkit.ai",
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
case "expired":
|
|
68
|
+
return {
|
|
69
|
+
severity: "critical",
|
|
70
|
+
message: `Your CopilotKit license expired${props.expiryDate ? ` on ${props.expiryDate}` : ""}. Please renew at copilotkit.ai/pricing`,
|
|
71
|
+
actionLabel: "Renew now",
|
|
72
|
+
actionUrl: "https://copilotkit.ai/pricing",
|
|
73
|
+
};
|
|
74
|
+
case "invalid":
|
|
75
|
+
return {
|
|
76
|
+
severity: "critical",
|
|
77
|
+
message:
|
|
78
|
+
"Invalid CopilotKit license token. Please check your configuration.",
|
|
79
|
+
actionLabel: "Get a license",
|
|
80
|
+
actionUrl: "https://copilotkit.ai/pricing",
|
|
81
|
+
};
|
|
82
|
+
default:
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const baseStyle = {
|
|
88
|
+
position: "fixed",
|
|
89
|
+
bottom: "8px",
|
|
90
|
+
left: "50%",
|
|
91
|
+
transform: "translateX(-50%)",
|
|
92
|
+
zIndex: 99999,
|
|
93
|
+
display: "inline-flex",
|
|
94
|
+
alignItems: "center",
|
|
95
|
+
gap: "12px",
|
|
96
|
+
whiteSpace: "nowrap",
|
|
97
|
+
padding: "8px 16px",
|
|
98
|
+
fontSize: "13px",
|
|
99
|
+
fontFamily:
|
|
100
|
+
"-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif",
|
|
101
|
+
borderRadius: "6px",
|
|
102
|
+
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
|
|
103
|
+
} as const;
|
|
104
|
+
|
|
105
|
+
const severityStyle = computed(() => {
|
|
106
|
+
switch (spec.value?.severity) {
|
|
107
|
+
case "warning":
|
|
108
|
+
return {
|
|
109
|
+
backgroundColor: "#fffbeb",
|
|
110
|
+
border: "1px solid #fbbf24",
|
|
111
|
+
color: "#92400e",
|
|
112
|
+
};
|
|
113
|
+
case "critical":
|
|
114
|
+
return {
|
|
115
|
+
backgroundColor: "#fef2f2",
|
|
116
|
+
border: "1px solid #fca5a5",
|
|
117
|
+
color: "#991b1b",
|
|
118
|
+
};
|
|
119
|
+
default:
|
|
120
|
+
return {
|
|
121
|
+
backgroundColor: "#eff6ff",
|
|
122
|
+
border: "1px solid #93c5fd",
|
|
123
|
+
color: "#1e40af",
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const containerStyle = computed(() => ({
|
|
129
|
+
...baseStyle,
|
|
130
|
+
...severityStyle.value,
|
|
131
|
+
}));
|
|
132
|
+
|
|
133
|
+
const instance = getCurrentInstance();
|
|
134
|
+
const hasDismissListener = computed(() => {
|
|
135
|
+
const vnodeProps = (instance?.vnode.props ?? {}) as Record<string, unknown>;
|
|
136
|
+
return typeof vnodeProps.onDismiss === "function";
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
function handleDismiss() {
|
|
140
|
+
emit("dismiss");
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Publish the banner's reserved bottom offset so the chat input can lift
|
|
144
|
+
// itself above it via padding-bottom: var(--copilotkit-license-banner-offset).
|
|
145
|
+
onMounted(() => {
|
|
146
|
+
if (typeof document === "undefined") return;
|
|
147
|
+
document.documentElement.style.setProperty(
|
|
148
|
+
LICENSE_BANNER_OFFSET_VAR,
|
|
149
|
+
`${LICENSE_BANNER_OFFSET_PX}px`,
|
|
150
|
+
);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
onBeforeUnmount(() => {
|
|
154
|
+
if (typeof document === "undefined") return;
|
|
155
|
+
document.documentElement.style.removeProperty(LICENSE_BANNER_OFFSET_VAR);
|
|
156
|
+
});
|
|
157
|
+
</script>
|
|
158
|
+
|
|
159
|
+
<template>
|
|
160
|
+
<div v-if="spec" :style="containerStyle" data-testid="copilot-license-banner">
|
|
161
|
+
<span>{{ spec.message }}</span>
|
|
162
|
+
<div
|
|
163
|
+
:style="{
|
|
164
|
+
display: 'flex',
|
|
165
|
+
gap: '8px',
|
|
166
|
+
alignItems: 'center',
|
|
167
|
+
}"
|
|
168
|
+
>
|
|
169
|
+
<a
|
|
170
|
+
:href="spec.actionUrl"
|
|
171
|
+
target="_blank"
|
|
172
|
+
rel="noopener noreferrer"
|
|
173
|
+
:style="{
|
|
174
|
+
fontWeight: 600,
|
|
175
|
+
textDecoration: 'underline',
|
|
176
|
+
color: 'inherit',
|
|
177
|
+
}"
|
|
178
|
+
>
|
|
179
|
+
{{ spec.actionLabel }}
|
|
180
|
+
</a>
|
|
181
|
+
<button
|
|
182
|
+
v-if="hasDismissListener"
|
|
183
|
+
:style="{
|
|
184
|
+
background: 'none',
|
|
185
|
+
border: 'none',
|
|
186
|
+
cursor: 'pointer',
|
|
187
|
+
color: 'inherit',
|
|
188
|
+
fontSize: '16px',
|
|
189
|
+
}"
|
|
190
|
+
@click="handleDismiss"
|
|
191
|
+
>
|
|
192
|
+
×
|
|
193
|
+
</button>
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
</template>
|