@copilotkit/vue 2.0.0-rc.3 → 2.0.0-rc.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTOR_GUIDE.md +1 -1
- package/PARITY.md +3 -3
- package/dist/hooks/use-copilot-action.d.ts.map +1 -1
- package/dist/hooks/use-frontend-tool.d.ts +1 -1
- package/dist/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/hooks/zod-parameters.d.ts +14 -0
- package/dist/hooks/zod-parameters.d.ts.map +1 -0
- package/dist/index.cjs +1 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +365 -16920
- package/dist/index.mjs.map +1 -1
- package/dist/use-render-activity-message-BMTHA_P2.js +15901 -0
- package/dist/use-render-activity-message-BMTHA_P2.js.map +1 -0
- package/dist/use-render-activity-message-CH3beu7z.cjs +113 -0
- package/dist/use-render-activity-message-CH3beu7z.cjs.map +1 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts +14 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -1
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts +10 -3
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/CopilotKitInspector.vue.d.ts +5 -1
- package/dist/v2/components/CopilotKitInspector.vue.d.ts.map +1 -1
- package/dist/v2/components/InlineFeatureWarning.vue.d.ts.map +1 -1
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts +2 -2
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -1
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts.map +1 -1
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +13 -59
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +3 -11
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +10 -15
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +14 -130
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -1
- package/dist/v2/components/a2ui/catalog.d.ts.map +1 -1
- package/dist/v2/components/a2ui/utils.d.ts +3 -15
- package/dist/v2/components/a2ui/utils.d.ts.map +1 -1
- package/dist/v2/components/a2ui.d.ts +9 -8
- package/dist/v2/components/a2ui.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChat.vue.d.ts +2 -2
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts +4 -8
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +7 -286
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +3 -3
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts +8 -3
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +5 -3
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +5 -3
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +8 -3
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +6 -4
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +6 -4
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotThreadsDrawer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts +1 -0
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/audioRecorder.d.ts +3 -4
- package/dist/v2/components/chat/audioRecorder.d.ts.map +1 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +4 -4
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
- package/dist/v2/components/chat/forwarded-slots.d.ts +12 -0
- package/dist/v2/components/chat/forwarded-slots.d.ts.map +1 -0
- package/dist/v2/components/chat/index.d.ts +34 -31
- package/dist/v2/components/chat/index.d.ts.map +1 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts +2 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts.map +1 -1
- package/dist/v2/components/chat/message-feedback.d.ts +38 -49
- package/dist/v2/components/chat/message-feedback.d.ts.map +1 -1
- package/dist/v2/components/chat/tool-call-display-context.d.ts +4 -19
- package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -1
- package/dist/v2/components/chat/tool-call-group-parts.d.ts +7 -20
- package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -1
- package/dist/v2/components/chat/turn-work.d.ts +0 -2
- package/dist/v2/components/chat/turn-work.d.ts.map +1 -1
- package/dist/v2/components/chat/types.d.ts +9 -4
- package/dist/v2/components/chat/types.d.ts.map +1 -1
- package/dist/v2/components/chat/use-chat-labels.d.ts +8 -0
- package/dist/v2/components/chat/use-chat-labels.d.ts.map +1 -0
- package/dist/v2/components/chat/use-copy-feedback.d.ts +11 -0
- package/dist/v2/components/chat/use-copy-feedback.d.ts.map +1 -0
- package/dist/v2/components/chat/use-lightbox.d.ts.map +1 -1
- package/dist/v2/components/icons/index.d.ts +968 -1
- package/dist/v2/components/icons/index.d.ts.map +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts.map +1 -1
- package/dist/v2/hooks/use-agent-context.d.ts +2 -3
- package/dist/v2/hooks/use-agent-context.d.ts.map +1 -1
- package/dist/v2/hooks/use-agent.d.ts +4 -1
- package/dist/v2/hooks/use-agent.d.ts.map +1 -1
- package/dist/v2/hooks/use-attachments.d.ts +7 -0
- package/dist/v2/hooks/use-attachments.d.ts.map +1 -1
- package/dist/v2/hooks/use-capabilities.d.ts.map +1 -1
- package/dist/v2/hooks/use-component.d.ts +1 -0
- package/dist/v2/hooks/use-component.d.ts.map +1 -1
- package/dist/v2/hooks/use-configure-suggestions.d.ts +4 -9
- package/dist/v2/hooks/use-configure-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-default-render-tool.d.ts +2 -7
- package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-frontend-tool.d.ts +5 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-human-in-the-loop.d.ts +2 -1
- package/dist/v2/hooks/use-human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/hooks/use-interrupt.d.ts +0 -1
- package/dist/v2/hooks/use-interrupt.d.ts.map +1 -1
- package/dist/v2/hooks/use-keyboard-height.d.ts +1 -1
- package/dist/v2/hooks/use-keyboard-height.d.ts.map +1 -1
- package/dist/v2/hooks/use-pin-to-send.d.ts +4 -12
- package/dist/v2/hooks/use-pin-to-send.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-activity-message.d.ts +13 -9
- package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-custom-messages.d.ts +5 -7
- package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-tool.d.ts +1 -1
- package/dist/v2/hooks/use-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-threads.d.ts +6 -23
- package/dist/v2/hooks/use-threads.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +197 -200
- package/dist/v2/index.mjs.map +1 -1
- package/dist/v2/lib/processPartialHtml.d.ts +1 -2
- package/dist/v2/lib/processPartialHtml.d.ts.map +1 -1
- package/dist/v2/lib/shallow-stable.d.ts.map +1 -1
- package/dist/v2/lib/vue-core.d.ts +33 -19
- package/dist/v2/lib/vue-core.d.ts.map +1 -1
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +9 -129
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +9 -10
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/chat-configuration-store-key.d.ts +8 -0
- package/dist/v2/providers/chat-configuration-store-key.d.ts.map +1 -0
- package/dist/v2/providers/markdown-renderer.d.ts +4 -2
- package/dist/v2/providers/markdown-renderer.d.ts.map +1 -1
- package/dist/v2/providers/types.d.ts +3 -46
- package/dist/v2/providers/types.d.ts.map +1 -1
- package/dist/v2/providers/use-inspector-thread-override.d.ts +5 -0
- package/dist/v2/providers/use-inspector-thread-override.d.ts.map +1 -1
- package/dist/v2/types/defineToolCallRenderer.d.ts +1 -1
- package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/types/human-in-the-loop.d.ts +8 -29
- package/dist/v2/types/human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/types/interrupt.d.ts +1 -22
- package/dist/v2/types/interrupt.d.ts.map +1 -1
- package/dist/v2/types/vue-activity-message-renderer.d.ts +16 -15
- package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-custom-message-renderer.d.ts +7 -16
- package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-tool-call-renderer.d.ts +16 -35
- package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
- package/package.json +12 -13
- package/src/__tests__/build-entries.test.ts +29 -0
- package/src/hooks/__tests__/zod-parameters.test.ts +520 -0
- package/src/hooks/use-copilot-action.ts +2 -1
- package/src/hooks/use-frontend-tool.ts +3 -6
- package/src/hooks/zod-parameters.ts +162 -0
- package/src/v2/__tests__/exports.test.ts +10 -0
- package/src/v2/__tests__/mocks/web-inspector.ts +6 -0
- package/src/v2/__tests__/utils/test-helpers.ts +34 -4
- package/src/v2/components/A2UIMessageRenderer.ts +98 -68
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +68 -103
- package/src/v2/components/CopilotKitInspector.vue +104 -51
- package/src/v2/components/InlineFeatureWarning.vue +20 -21
- package/src/v2/components/LicenseWarningBanner.vue +27 -135
- package/src/v2/components/MCPAppsActivityRenderer.ts +75 -201
- package/src/v2/components/OpenGenerativeUIRenderer.ts +122 -446
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +171 -8
- package/src/v2/components/__tests__/CopilotKitInspector.test.ts +42 -0
- package/src/v2/components/__tests__/LicenseWarningBanner.test.ts +60 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +64 -8
- package/src/v2/components/__tests__/OpenGenerativeUIToolRenderer.test.ts +38 -0
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +6 -26
- package/src/v2/components/a2ui/A2UICatalogContext.ts +27 -185
- package/src/v2/components/a2ui/A2UIRecoveryStates.ts +127 -327
- package/src/v2/components/a2ui/catalog.ts +3 -3
- package/src/v2/components/a2ui/utils.ts +13 -65
- package/src/v2/components/a2ui.ts +15 -22
- package/src/v2/components/chat/CopilotChat.vue +121 -498
- package/src/v2/components/chat/CopilotChatAssistantMessage.vue +47 -184
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +36 -55
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +14 -6
- package/src/v2/components/chat/CopilotChatAudioRecorder.vue +19 -246
- package/src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue +12 -77
- package/src/v2/components/chat/CopilotChatInput.vue +139 -654
- package/src/v2/components/chat/CopilotChatInspectorButton.vue +45 -108
- package/src/v2/components/chat/CopilotChatLightbox.vue +10 -31
- package/src/v2/components/chat/CopilotChatMessageView.vue +96 -274
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +27 -62
- package/src/v2/components/chat/CopilotChatToolCallGroup.vue +63 -71
- package/src/v2/components/chat/CopilotChatToolCallItem.vue +8 -6
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +31 -32
- package/src/v2/components/chat/CopilotChatUserMessage.vue +24 -112
- package/src/v2/components/chat/CopilotChatView.vue +123 -161
- package/src/v2/components/chat/CopilotChatWorkSummary.vue +26 -36
- package/src/v2/components/chat/CopilotModalHeader.vue +11 -23
- package/src/v2/components/chat/CopilotPopup.vue +23 -25
- package/src/v2/components/chat/CopilotPopupView.vue +10 -39
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +49 -185
- package/src/v2/components/chat/CopilotSidebar.vue +23 -25
- package/src/v2/components/chat/CopilotSidebarView.vue +10 -39
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +56 -100
- package/src/v2/components/chat/CopilotThreadsDrawer.vue +43 -105
- package/src/v2/components/chat/StreamingMarkdownDefault.vue +15 -28
- package/src/v2/components/chat/__tests__/CopilotChat.labels.test.ts +19 -4
- package/src/v2/components/chat/__tests__/CopilotChat.test.ts +12 -10
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +26 -9
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.learningFeedback.test.ts +5 -5
- package/src/v2/components/chat/__tests__/CopilotChatAttachmentQueue.test.ts +28 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +132 -1
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +247 -403
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +1 -99
- package/src/v2/components/chat/__tests__/CopilotChatView.pinToSend.test.ts +43 -1
- package/src/v2/components/chat/__tests__/CopilotPopup.test.ts +90 -1
- package/src/v2/components/chat/__tests__/CopilotPopupView.test.ts +19 -0
- package/src/v2/components/chat/__tests__/CopilotSidebar.test.ts +90 -1
- package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.ts +32 -8
- package/src/v2/components/chat/__tests__/CopilotSidebarView.test.ts +2 -1
- package/src/v2/components/chat/__tests__/StreamingMarkdownDefault.test.ts +54 -0
- package/src/v2/components/chat/audioRecorder.ts +4 -7
- package/src/v2/components/chat/copilotChatToolCallItemRender.ts +25 -90
- package/src/v2/components/chat/forwarded-slots.ts +17 -0
- package/src/v2/components/chat/index.ts +0 -1
- package/src/v2/components/chat/inspector-shortcuts.ts +10 -16
- package/src/v2/components/chat/message-feedback.ts +92 -195
- package/src/v2/components/chat/tool-call-display-context.ts +6 -22
- package/src/v2/components/chat/tool-call-group-parts.ts +47 -108
- package/src/v2/components/chat/turn-work.ts +0 -9
- package/src/v2/components/chat/types.ts +12 -4
- package/src/v2/components/chat/use-chat-labels.ts +16 -0
- package/src/v2/components/chat/use-copy-feedback.ts +21 -0
- package/src/v2/components/chat/use-lightbox.ts +15 -33
- package/src/v2/components/icons/__tests__/icons.test.ts +72 -68
- package/src/v2/components/icons/index.ts +109 -27
- package/src/v2/hooks/__tests__/use-agent-error-state.test.ts +5 -3
- package/src/v2/hooks/__tests__/use-agent-stability.test.ts +25 -4
- package/src/v2/hooks/__tests__/use-agent-throttle.test.ts +5 -1
- package/src/v2/hooks/__tests__/use-agent.test.ts +6 -3
- package/src/v2/hooks/__tests__/use-component.test.ts +21 -0
- package/src/v2/hooks/__tests__/use-configure-suggestions.test.ts +30 -1
- package/src/v2/hooks/__tests__/use-default-render-tool.test.ts +10 -10
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +66 -1
- package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.ts +6 -1
- package/src/v2/hooks/__tests__/use-human-in-the-loop.test.ts +187 -12
- package/src/v2/hooks/__tests__/use-interrupt.test.ts +97 -0
- package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +106 -0
- package/src/v2/hooks/__tests__/use-render-tool.test.ts +3 -6
- package/src/v2/hooks/__tests__/use-threads.test.ts +48 -6
- package/src/v2/hooks/__tests__/zod-regression.test.ts +5 -4
- package/src/v2/hooks/use-agent-context.ts +4 -10
- package/src/v2/hooks/use-agent.ts +86 -290
- package/src/v2/hooks/use-attachments.ts +48 -168
- package/src/v2/hooks/use-capabilities.ts +2 -7
- package/src/v2/hooks/use-component.ts +7 -4
- package/src/v2/hooks/use-configure-suggestions.ts +29 -220
- package/src/v2/hooks/use-default-render-tool.ts +31 -152
- package/src/v2/hooks/use-frontend-tool.ts +15 -25
- package/src/v2/hooks/use-human-in-the-loop.ts +11 -80
- package/src/v2/hooks/use-interrupt.ts +29 -308
- package/src/v2/hooks/use-keyboard-height.ts +17 -40
- package/src/v2/hooks/use-pin-to-send.ts +15 -99
- package/src/v2/hooks/use-render-activity-message.ts +35 -57
- package/src/v2/hooks/use-render-custom-messages.ts +24 -88
- package/src/v2/hooks/use-render-tool.ts +2 -4
- package/src/v2/hooks/use-suggestions.ts +17 -36
- package/src/v2/hooks/use-threads.ts +49 -288
- package/src/v2/lib/__tests__/shallow-stable.test.ts +54 -0
- package/src/v2/lib/__tests__/vue-core-renderers.test.ts +42 -0
- package/src/v2/lib/processPartialHtml.ts +6 -21
- package/src/v2/lib/shallow-stable.ts +2 -16
- package/src/v2/lib/vue-core.ts +90 -85
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +48 -186
- package/src/v2/providers/CopilotKitProvider.types.ts +12 -132
- package/src/v2/providers/CopilotKitProvider.vue +291 -641
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.ts +22 -2
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +38 -2
- package/src/v2/providers/__tests__/CopilotKitProvider.config.test.ts +124 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.headersAtSendTime.test.ts +3 -3
- package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +3 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.ts +4 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +88 -28
- package/src/v2/providers/chat-configuration-store-key.ts +9 -0
- package/src/v2/providers/markdown-renderer.ts +8 -2
- package/src/v2/providers/types.ts +3 -49
- package/src/v2/providers/use-inspector-thread-override.ts +22 -80
- package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +28 -33
- package/src/v2/types/defineToolCallRenderer.ts +7 -6
- package/src/v2/types/human-in-the-loop.ts +8 -32
- package/src/v2/types/interrupt.ts +7 -31
- package/src/v2/types/vue-activity-message-renderer.ts +24 -15
- package/src/v2/types/vue-custom-message-renderer.ts +12 -16
- package/src/v2/types/vue-tool-call-renderer.ts +23 -38
- package/tsconfig.json +0 -1
- package/vite.config.ts +8 -5
- package/vitest.config.ts +12 -7
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts +0 -9
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts.map +0 -1
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts +0 -3
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts.map +0 -1
- package/dist/v2/components/chat/tool-call-layout.d.ts +0 -115
- package/dist/v2/components/chat/tool-call-layout.d.ts.map +0 -1
- package/dist/v2/lib/is-mobile-viewport.d.ts +0 -15
- package/dist/v2/lib/is-mobile-viewport.d.ts.map +0 -1
- package/dist/v2/lib/message-feedback.d.ts +0 -33
- package/dist/v2/lib/message-feedback.d.ts.map +0 -1
- package/dist/v2/lib/transcription-client.d.ts +0 -19
- package/dist/v2/lib/transcription-client.d.ts.map +0 -1
- package/src/v2/components/__tests__/A2UICatalogContext.test.ts +0 -63
- package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +0 -175
- package/src/v2/components/chat/BasicMarkdown.vue +0 -160
- package/src/v2/components/chat/__tests__/BasicMarkdown.test.ts +0 -69
- package/src/v2/components/chat/__tests__/normalize-auto-scroll.test.ts +0 -39
- package/src/v2/components/chat/normalize-auto-scroll.ts +0 -17
- package/src/v2/components/chat/tool-call-layout.ts +0 -304
- package/src/v2/lib/__tests__/is-mobile-viewport.test.ts +0 -48
- package/src/v2/lib/__tests__/message-feedback.test.ts +0 -152
- package/src/v2/lib/__tests__/processPartialHtml.test.ts +0 -84
- package/src/v2/lib/__tests__/transcription-client.test.ts +0 -67
- package/src/v2/lib/is-mobile-viewport.ts +0 -23
- package/src/v2/lib/message-feedback.ts +0 -120
- package/src/v2/lib/transcription-client.ts +0 -151
|
@@ -1,69 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
1
|
+
import { h } from "vue";
|
|
2
|
+
import type { Component, VNodeChild } from "vue";
|
|
3
|
+
import { ɵA2UI_LIFECYCLE_TEXT, ɵA2UI_SKELETON_ROWS } from "@copilotkit/core";
|
|
4
|
+
import type {
|
|
5
|
+
ɵA2UIActivitySnapshot,
|
|
6
|
+
ɵA2UIProgressPhase,
|
|
7
|
+
ɵA2UIRecoveryOptions,
|
|
8
|
+
ɵA2UISkeletonPart,
|
|
9
|
+
} from "@copilotkit/core";
|
|
4
10
|
|
|
5
11
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `a2ui-surface` activity (one stable messageId, `replace: true`), so the states
|
|
11
|
-
* below swap IN PLACE and the painted surface ultimately replaces them:
|
|
12
|
-
*
|
|
13
|
-
* building → animated skeleton + "Building interface" (+ optional ~N tokens)
|
|
14
|
-
* retrying → same skeleton; once perceptible, the sub-label becomes
|
|
15
|
-
* "Retrying generation… (N/M attempts)" (threshold-gated so a fast
|
|
16
|
-
* transient retry never flashes), with debug detail per debugExposure
|
|
17
|
-
* failed → a clean hard-failure card (replacing the skeleton), developer
|
|
18
|
-
* detail tucked into an expander gated by debugExposure
|
|
19
|
-
* painted → the surface renderer owns the UI (these states render nothing)
|
|
20
|
-
*
|
|
21
|
-
* Timing (`showAfterMs` / `showAfterAttempts`) and how much debug detail to
|
|
22
|
-
* surface (`debugExposure`) are client concerns; the server can override
|
|
23
|
-
* `debugExposure` by stamping it onto the activity content (it wins over the
|
|
24
|
-
* client option).
|
|
25
|
-
*/
|
|
26
|
-
export type A2UIRecoveryRendererOptions = {
|
|
27
|
-
/** Delay (ms) before the "Retrying…" sub-label becomes visible. Default 2000. */
|
|
28
|
-
showAfterMs?: number;
|
|
29
|
-
/** Show the "Retrying…" sub-label immediately once `attempt` reaches this. Default 2. */
|
|
30
|
-
showAfterAttempts?: number;
|
|
31
|
-
/** How much retry/debug detail to surface. Default "collapsed". */
|
|
32
|
-
debugExposure?: "hidden" | "collapsed" | "verbose";
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type DebugExposure = "hidden" | "collapsed" | "verbose";
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* The pre-paint lifecycle fields the middleware stamps onto the `a2ui-surface`
|
|
39
|
-
* activity content (alongside `a2ui_operations` on paint).
|
|
12
|
+
* Pre-paint recovery and loading options: how long before the "Retrying…"
|
|
13
|
+
* label appears, and how much retry and debug detail to show. Core's
|
|
14
|
+
* `ɵA2UIActivityController` owns the rules; this module only draws its
|
|
15
|
+
* snapshot.
|
|
40
16
|
*/
|
|
41
|
-
export
|
|
42
|
-
status: z.enum(["building", "retrying", "failed"]).optional(),
|
|
43
|
-
attempt: z.number().optional(),
|
|
44
|
-
maxAttempts: z.number().optional(),
|
|
45
|
-
progressTokens: z.number().optional(),
|
|
46
|
-
error: z.string().optional(),
|
|
47
|
-
errors: z.array(z.any()).optional(),
|
|
48
|
-
attempts: z.array(z.any()).optional(),
|
|
49
|
-
// Server-side knob (stamped by the A2UI middleware).
|
|
50
|
-
debugExposure: z.enum(["hidden", "collapsed", "verbose"]).optional(),
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/** Server-stamped debugExposure wins; else the client option. */
|
|
54
|
-
export function resolveDebugExposure(
|
|
55
|
-
content: any,
|
|
56
|
-
optionDebugExposure: DebugExposure,
|
|
57
|
-
): DebugExposure {
|
|
58
|
-
return content?.debugExposure ?? optionDebugExposure;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const tokensOf = (content: any): number | undefined =>
|
|
62
|
-
typeof content?.progressTokens === "number"
|
|
63
|
-
? content.progressTokens
|
|
64
|
-
: undefined;
|
|
65
|
-
|
|
66
|
-
// --- Skeleton + primitives ---------------------------------------------------
|
|
17
|
+
export type A2UIRecoveryRendererOptions = ɵA2UIRecoveryOptions;
|
|
67
18
|
|
|
68
19
|
const dot = () =>
|
|
69
20
|
h("div", {
|
|
@@ -76,69 +27,30 @@ const dot = () =>
|
|
|
76
27
|
},
|
|
77
28
|
});
|
|
78
29
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
ht: number,
|
|
84
|
-
bg: string,
|
|
85
|
-
anim?: number,
|
|
86
|
-
opacity?: number,
|
|
87
|
-
transition?: string,
|
|
88
|
-
) =>
|
|
89
|
-
h("div", {
|
|
30
|
+
function skeletonPart(part: ɵA2UISkeletonPart) {
|
|
31
|
+
if (part === "dot") return dot();
|
|
32
|
+
if (part === "spacer") return h("div", { style: { width: "12px" } });
|
|
33
|
+
return h("div", {
|
|
90
34
|
style: {
|
|
91
|
-
width: `${w}px`,
|
|
92
|
-
height:
|
|
35
|
+
width: `${String(part.w)}px`,
|
|
36
|
+
height: "7px",
|
|
93
37
|
borderRadius: "9999px",
|
|
94
|
-
backgroundColor: bg,
|
|
95
|
-
|
|
96
|
-
? {
|
|
97
|
-
animation: `cpk-a2ui-fade 2.4s ease-in-out ${anim}s infinite`,
|
|
98
|
-
}
|
|
99
|
-
: {}),
|
|
100
|
-
...(opacity !== undefined ? { opacity } : {}),
|
|
101
|
-
...(transition ? { transition } : {}),
|
|
38
|
+
backgroundColor: part.bg,
|
|
39
|
+
animation: `cpk-a2ui-fade 2.4s ease-in-out ${String(part.anim)}s infinite`,
|
|
102
40
|
},
|
|
103
41
|
});
|
|
104
|
-
|
|
105
|
-
const row = (show: boolean, delay: number, children: VNodeChild[]) =>
|
|
106
|
-
h(
|
|
107
|
-
"div",
|
|
108
|
-
{
|
|
109
|
-
style: {
|
|
110
|
-
display: "flex",
|
|
111
|
-
alignItems: "center",
|
|
112
|
-
gap: "6px",
|
|
113
|
-
opacity: show ? 1 : 0,
|
|
114
|
-
transition: `opacity 0.4s ${delay}s`,
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
children,
|
|
118
|
-
);
|
|
42
|
+
}
|
|
119
43
|
|
|
120
44
|
/**
|
|
121
45
|
* Animated wireframe skeleton with a label, an optional live token count, and
|
|
122
|
-
* optional debug detail below it.
|
|
123
|
-
* reveal of skeleton rows.
|
|
46
|
+
* optional debug detail below it. `phase` reveals the rows.
|
|
124
47
|
*/
|
|
125
|
-
|
|
48
|
+
function renderA2UIGeneratingSkeleton(
|
|
126
49
|
label: string,
|
|
127
|
-
tokens
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const phase =
|
|
132
|
-
tokens == null
|
|
133
|
-
? 3
|
|
134
|
-
: tokens < 50
|
|
135
|
-
? 0
|
|
136
|
-
: tokens < 200
|
|
137
|
-
? 1
|
|
138
|
-
: tokens < 400
|
|
139
|
-
? 2
|
|
140
|
-
: 3;
|
|
141
|
-
|
|
50
|
+
tokens: number | undefined,
|
|
51
|
+
phase: ɵA2UIProgressPhase,
|
|
52
|
+
children: VNodeChild[],
|
|
53
|
+
) {
|
|
142
54
|
return h("div", { style: { margin: "12px 0", maxWidth: "320px" } }, [
|
|
143
55
|
h(
|
|
144
56
|
"div",
|
|
@@ -154,7 +66,6 @@ export function renderA2UIGeneratingSkeleton(
|
|
|
154
66
|
},
|
|
155
67
|
},
|
|
156
68
|
[
|
|
157
|
-
// Top bar
|
|
158
69
|
h(
|
|
159
70
|
"div",
|
|
160
71
|
{
|
|
@@ -171,57 +82,37 @@ export function renderA2UIGeneratingSkeleton(
|
|
|
171
82
|
dot(),
|
|
172
83
|
dot(),
|
|
173
84
|
]),
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
85
|
+
h("div", {
|
|
86
|
+
style: {
|
|
87
|
+
width: "64px",
|
|
88
|
+
height: "6px",
|
|
89
|
+
borderRadius: "9999px",
|
|
90
|
+
backgroundColor: "#e4e4e7",
|
|
91
|
+
opacity: phase >= 1 ? 1 : 0.4,
|
|
92
|
+
transition: "opacity 0.5s",
|
|
93
|
+
},
|
|
94
|
+
}),
|
|
182
95
|
],
|
|
183
96
|
),
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
dot(),
|
|
204
|
-
bar(60, 7, "rgba(24,24,27,0.15)", 0.4),
|
|
205
|
-
]),
|
|
206
|
-
row(phase >= 2, 0.25, [
|
|
207
|
-
bar(40, 7, "rgba(153,246,228,0.5)", 0.2),
|
|
208
|
-
dot(),
|
|
209
|
-
bar(48, 7, "rgba(24,24,27,0.15)", 0.6),
|
|
210
|
-
bar(64, 7, "rgba(147,197,253,0.5)", 0.1),
|
|
211
|
-
]),
|
|
212
|
-
row(phase >= 2, 0.3, [
|
|
213
|
-
bar(36, 7, "rgba(147,197,253,0.6)", 0.5),
|
|
214
|
-
bar(36, 7, "rgba(24,24,27,0.12)", 0.7),
|
|
215
|
-
]),
|
|
216
|
-
row(phase >= 3, 0.35, [
|
|
217
|
-
dot(),
|
|
218
|
-
bar(44, 7, "rgba(24,24,27,0.18)", 0.3),
|
|
219
|
-
dot(),
|
|
220
|
-
bar(56, 7, "rgba(153,246,228,0.5)", 0.8),
|
|
221
|
-
bar(48, 7, "rgba(147,197,253,0.5)", 0.4),
|
|
222
|
-
]),
|
|
223
|
-
]),
|
|
224
|
-
// Shimmer
|
|
97
|
+
h(
|
|
98
|
+
"div",
|
|
99
|
+
{ style: { display: "grid", gap: "7px" } },
|
|
100
|
+
ɵA2UI_SKELETON_ROWS.map((row) =>
|
|
101
|
+
h(
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
style: {
|
|
105
|
+
display: "flex",
|
|
106
|
+
alignItems: "center",
|
|
107
|
+
gap: "6px",
|
|
108
|
+
opacity: phase >= row.phase ? 1 : 0,
|
|
109
|
+
transition: `opacity 0.4s ${String(row.delay)}s`,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
row.parts.map(skeletonPart),
|
|
113
|
+
),
|
|
114
|
+
),
|
|
115
|
+
),
|
|
225
116
|
h("div", {
|
|
226
117
|
style: {
|
|
227
118
|
pointerEvents: "none",
|
|
@@ -235,7 +126,6 @@ export function renderA2UIGeneratingSkeleton(
|
|
|
235
126
|
}),
|
|
236
127
|
],
|
|
237
128
|
),
|
|
238
|
-
// Label
|
|
239
129
|
h(
|
|
240
130
|
"div",
|
|
241
131
|
{
|
|
@@ -259,25 +149,22 @@ export function renderA2UIGeneratingSkeleton(
|
|
|
259
149
|
},
|
|
260
150
|
label,
|
|
261
151
|
),
|
|
262
|
-
|
|
263
|
-
?
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
{
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
fontVariantNumeric: "tabular-nums",
|
|
271
|
-
},
|
|
152
|
+
typeof tokens === "number" && tokens > 0
|
|
153
|
+
? h(
|
|
154
|
+
"span",
|
|
155
|
+
{
|
|
156
|
+
style: {
|
|
157
|
+
fontSize: "11px",
|
|
158
|
+
color: "#d4d4d8",
|
|
159
|
+
fontVariantNumeric: "tabular-nums",
|
|
272
160
|
},
|
|
273
|
-
|
|
274
|
-
)
|
|
275
|
-
|
|
276
|
-
:
|
|
161
|
+
},
|
|
162
|
+
`~${tokens.toLocaleString()} tokens`,
|
|
163
|
+
)
|
|
164
|
+
: null,
|
|
277
165
|
],
|
|
278
166
|
),
|
|
279
|
-
...
|
|
280
|
-
// Keyframe styles
|
|
167
|
+
...children,
|
|
281
168
|
h(
|
|
282
169
|
"style",
|
|
283
170
|
`
|
|
@@ -294,151 +181,64 @@ export function renderA2UIGeneratingSkeleton(
|
|
|
294
181
|
]);
|
|
295
182
|
}
|
|
296
183
|
|
|
297
|
-
function renderDebugDetails(
|
|
298
|
-
label: string,
|
|
299
|
-
open: boolean,
|
|
300
|
-
payload: unknown,
|
|
301
|
-
): VNodeChild {
|
|
302
|
-
return h("details", { open, class: "cpk-a2ui-debug-details" }, [
|
|
303
|
-
h("summary", { class: "cpk-a2ui-debug-details-summary" }, label),
|
|
304
|
-
h(
|
|
305
|
-
"pre",
|
|
306
|
-
{ class: "cpk-a2ui-debug-details-payload", style: { fontSize: "11px" } },
|
|
307
|
-
JSON.stringify(payload, null, 2),
|
|
308
|
-
),
|
|
309
|
-
]);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// --- Lifecycle states ---------------------------------------------------------
|
|
313
|
-
|
|
314
|
-
/** building: the generic skeleton + optional live token count. */
|
|
315
|
-
export const A2UIBuildingState = defineComponent({
|
|
316
|
-
name: "A2UIBuildingState",
|
|
317
|
-
props: {
|
|
318
|
-
content: { type: null as unknown as PropType<any>, default: undefined },
|
|
319
|
-
},
|
|
320
|
-
setup(props) {
|
|
321
|
-
return () =>
|
|
322
|
-
renderA2UIGeneratingSkeleton(
|
|
323
|
-
"Building interface",
|
|
324
|
-
tokensOf(props.content),
|
|
325
|
-
);
|
|
326
|
-
},
|
|
327
|
-
});
|
|
328
|
-
|
|
329
184
|
/**
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
185
|
+
* Draws the lifecycle state of an `a2ui-surface` activity: the failure card,
|
|
186
|
+
* the host's loading component while building, or the skeleton.
|
|
187
|
+
*
|
|
188
|
+
* @param snapshot - The activity controller's snapshot.
|
|
189
|
+
* @param loadingComponent - Shown instead of the skeleton while building.
|
|
334
190
|
*/
|
|
335
|
-
export
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
debugExposure: {
|
|
342
|
-
type: String as PropType<DebugExposure>,
|
|
343
|
-
required: true,
|
|
344
|
-
},
|
|
345
|
-
},
|
|
346
|
-
setup(props) {
|
|
347
|
-
const attempt = () =>
|
|
348
|
-
typeof props.content?.attempt === "number"
|
|
349
|
-
? (props.content.attempt as number)
|
|
350
|
-
: undefined;
|
|
351
|
-
const immediate = () => {
|
|
352
|
-
const current = attempt();
|
|
353
|
-
return current !== undefined && current >= props.showAfterAttempts;
|
|
354
|
-
};
|
|
355
|
-
const revealed = ref(immediate());
|
|
356
|
-
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
357
|
-
|
|
358
|
-
watch(
|
|
359
|
-
[immediate, () => props.showAfterMs],
|
|
360
|
-
([isImmediate, showAfterMs]) => {
|
|
361
|
-
clearTimeout(timer);
|
|
362
|
-
if (isImmediate) {
|
|
363
|
-
revealed.value = true;
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
timer = setTimeout(() => {
|
|
367
|
-
revealed.value = true;
|
|
368
|
-
}, showAfterMs);
|
|
369
|
-
},
|
|
370
|
-
{ immediate: true },
|
|
371
|
-
);
|
|
372
|
-
onBeforeUnmount(() => clearTimeout(timer));
|
|
373
|
-
|
|
374
|
-
return () => {
|
|
375
|
-
const tokens = tokensOf(props.content);
|
|
376
|
-
// Not yet perceptible → indistinguishable from normal building.
|
|
377
|
-
if (!revealed.value) {
|
|
378
|
-
return renderA2UIGeneratingSkeleton("Building interface", tokens);
|
|
379
|
-
}
|
|
380
|
-
const current = attempt();
|
|
381
|
-
const maxAttempts =
|
|
382
|
-
typeof props.content?.maxAttempts === "number"
|
|
383
|
-
? props.content.maxAttempts
|
|
384
|
-
: undefined;
|
|
385
|
-
const label =
|
|
386
|
-
current !== undefined && maxAttempts !== undefined
|
|
387
|
-
? `Retrying generation… (${current}/${maxAttempts} attempts)`
|
|
388
|
-
: "Retrying generation…";
|
|
389
|
-
const errors = Array.isArray(props.content?.errors)
|
|
390
|
-
? props.content.errors
|
|
391
|
-
: [];
|
|
392
|
-
return renderA2UIGeneratingSkeleton(
|
|
393
|
-
label,
|
|
394
|
-
tokens,
|
|
395
|
-
props.debugExposure !== "hidden" && errors.length > 0
|
|
396
|
-
? [
|
|
397
|
-
renderDebugDetails(
|
|
398
|
-
"validation issues",
|
|
399
|
-
props.debugExposure === "verbose",
|
|
400
|
-
{ attempt: props.content?.attempt, errors },
|
|
401
|
-
),
|
|
402
|
-
]
|
|
403
|
-
: [],
|
|
404
|
-
);
|
|
405
|
-
};
|
|
406
|
-
},
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
/** failed: a clean hard-failure card that replaces the skeleton in place. */
|
|
410
|
-
export const A2UIRecoveryFailure = defineComponent({
|
|
411
|
-
name: "A2UIRecoveryFailure",
|
|
412
|
-
props: {
|
|
413
|
-
content: { type: null as unknown as PropType<any>, default: undefined },
|
|
414
|
-
debugExposure: {
|
|
415
|
-
type: String as PropType<DebugExposure>,
|
|
416
|
-
required: true,
|
|
417
|
-
},
|
|
418
|
-
},
|
|
419
|
-
setup(props) {
|
|
420
|
-
return () =>
|
|
421
|
-
h("div", { class: "cpk-a2ui-recovery-failure" }, [
|
|
422
|
-
h(
|
|
423
|
-
"div",
|
|
424
|
-
{ class: "cpk-a2ui-recovery-failure-title" },
|
|
425
|
-
"Couldn't generate the UI",
|
|
426
|
-
),
|
|
191
|
+
export function renderA2UILifecycleState(
|
|
192
|
+
snapshot: ɵA2UIActivitySnapshot,
|
|
193
|
+
loadingComponent: Component | undefined,
|
|
194
|
+
) {
|
|
195
|
+
const details: VNodeChild[] = snapshot.showDebugDetails
|
|
196
|
+
? [
|
|
427
197
|
h(
|
|
428
|
-
"
|
|
429
|
-
{ class: "cpk-a2ui-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
198
|
+
"details",
|
|
199
|
+
{ open: snapshot.debugDetailsOpen, class: "cpk-a2ui-debug-details" },
|
|
200
|
+
[
|
|
201
|
+
h(
|
|
202
|
+
"summary",
|
|
203
|
+
{ class: "cpk-a2ui-debug-details-summary" },
|
|
204
|
+
snapshot.debugDetailsLabel,
|
|
205
|
+
),
|
|
206
|
+
h(
|
|
207
|
+
"pre",
|
|
436
208
|
{
|
|
437
|
-
|
|
438
|
-
|
|
209
|
+
class: "cpk-a2ui-debug-details-payload",
|
|
210
|
+
style: { fontSize: "11px" },
|
|
439
211
|
},
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
212
|
+
snapshot.debugPayload,
|
|
213
|
+
),
|
|
214
|
+
],
|
|
215
|
+
),
|
|
216
|
+
]
|
|
217
|
+
: [];
|
|
218
|
+
const { lifecycle } = snapshot;
|
|
219
|
+
|
|
220
|
+
if (lifecycle.status === "failed") {
|
|
221
|
+
return h("div", { class: "cpk-a2ui-recovery-failure" }, [
|
|
222
|
+
h(
|
|
223
|
+
"div",
|
|
224
|
+
{ class: "cpk-a2ui-recovery-failure-title" },
|
|
225
|
+
ɵA2UI_LIFECYCLE_TEXT.failureTitle,
|
|
226
|
+
),
|
|
227
|
+
h(
|
|
228
|
+
"div",
|
|
229
|
+
{ class: "cpk-a2ui-recovery-failure-description" },
|
|
230
|
+
ɵA2UI_LIFECYCLE_TEXT.failureDescription,
|
|
231
|
+
),
|
|
232
|
+
...details,
|
|
233
|
+
]);
|
|
234
|
+
}
|
|
235
|
+
if (lifecycle.status === "building" && loadingComponent) {
|
|
236
|
+
return h(loadingComponent);
|
|
237
|
+
}
|
|
238
|
+
return renderA2UIGeneratingSkeleton(
|
|
239
|
+
snapshot.label,
|
|
240
|
+
lifecycle.progressTokens,
|
|
241
|
+
snapshot.progressPhase,
|
|
242
|
+
details,
|
|
243
|
+
);
|
|
244
|
+
}
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
getBaseContainerStyle,
|
|
41
41
|
mapJustify,
|
|
42
42
|
mapAlign,
|
|
43
|
+
getDateTimeInputType,
|
|
43
44
|
} from "./utils";
|
|
44
45
|
|
|
45
46
|
// -- Helper: render a child list (arrays of { id, basePath } or string IDs) --
|
|
@@ -100,6 +101,7 @@ const Text = createVueComponent(TextApi, ({ props }) => {
|
|
|
100
101
|
text,
|
|
101
102
|
);
|
|
102
103
|
case "body":
|
|
104
|
+
case undefined:
|
|
103
105
|
default:
|
|
104
106
|
return h("span", { style }, text);
|
|
105
107
|
}
|
|
@@ -811,9 +813,7 @@ const DateTimeInput = createVueComponent(
|
|
|
811
813
|
({ props, state }) => {
|
|
812
814
|
const uniqueId = state.id;
|
|
813
815
|
|
|
814
|
-
|
|
815
|
-
if (props.enableDate && !props.enableTime) type = "date";
|
|
816
|
-
if (!props.enableDate && props.enableTime) type = "time";
|
|
816
|
+
const type = getDateTimeInputType(props);
|
|
817
817
|
|
|
818
818
|
const style = {
|
|
819
819
|
padding: "8px",
|
|
@@ -1,67 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Style utilities for Vue A2UI basic catalog components
|
|
3
|
-
*
|
|
2
|
+
* Style utilities for Vue A2UI basic catalog components, shared with the
|
|
3
|
+
* React and Angular renderers through `@copilotkit/a2ui-renderer/engine`.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/** Standard border radius. */
|
|
18
|
-
export const STANDARD_RADIUS = "8px";
|
|
19
|
-
|
|
20
|
-
export const mapJustify = (j?: string): string => {
|
|
21
|
-
switch (j) {
|
|
22
|
-
case "center":
|
|
23
|
-
return "center";
|
|
24
|
-
case "end":
|
|
25
|
-
return "flex-end";
|
|
26
|
-
case "spaceAround":
|
|
27
|
-
return "space-around";
|
|
28
|
-
case "spaceBetween":
|
|
29
|
-
return "space-between";
|
|
30
|
-
case "spaceEvenly":
|
|
31
|
-
return "space-evenly";
|
|
32
|
-
case "start":
|
|
33
|
-
return "flex-start";
|
|
34
|
-
case "stretch":
|
|
35
|
-
return "stretch";
|
|
36
|
-
default:
|
|
37
|
-
return "flex-start";
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const mapAlign = (a?: string): string => {
|
|
42
|
-
switch (a) {
|
|
43
|
-
case "start":
|
|
44
|
-
return "flex-start";
|
|
45
|
-
case "center":
|
|
46
|
-
return "center";
|
|
47
|
-
case "end":
|
|
48
|
-
return "flex-end";
|
|
49
|
-
case "stretch":
|
|
50
|
-
return "stretch";
|
|
51
|
-
default:
|
|
52
|
-
return "stretch";
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const getBaseLeafStyle = (): CSSProperties => ({
|
|
57
|
-
margin: LEAF_MARGIN,
|
|
58
|
-
boxSizing: "border-box",
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
export const getBaseContainerStyle = (): CSSProperties => ({
|
|
62
|
-
margin: LEAF_MARGIN,
|
|
63
|
-
padding: CONTAINER_PADDING,
|
|
64
|
-
border: STANDARD_BORDER,
|
|
65
|
-
borderRadius: STANDARD_RADIUS,
|
|
66
|
-
boxSizing: "border-box",
|
|
67
|
-
});
|
|
5
|
+
export {
|
|
6
|
+
LEAF_MARGIN,
|
|
7
|
+
CONTAINER_PADDING,
|
|
8
|
+
STANDARD_BORDER,
|
|
9
|
+
STANDARD_RADIUS,
|
|
10
|
+
mapJustify,
|
|
11
|
+
mapAlign,
|
|
12
|
+
getBaseLeafStyle,
|
|
13
|
+
getBaseContainerStyle,
|
|
14
|
+
getDateTimeInputType,
|
|
15
|
+
} from "@copilotkit/a2ui-renderer/engine";
|
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import {
|
|
3
|
+
ɵA2UI_DEFAULT_SURFACE_ID,
|
|
4
|
+
ɵA2UI_SURFACE_ACTIVITY_TYPE,
|
|
5
|
+
ɵgetA2UIOperationSurfaceId,
|
|
6
|
+
} from "@copilotkit/core";
|
|
7
|
+
import type { ɵA2UIOperation } from "@copilotkit/core";
|
|
2
8
|
|
|
3
|
-
export type A2UIOperation =
|
|
9
|
+
export type A2UIOperation = ɵA2UIOperation;
|
|
4
10
|
|
|
5
|
-
export const A2UISurfaceActivityType =
|
|
11
|
+
export const A2UISurfaceActivityType = ɵA2UI_SURFACE_ACTIVITY_TYPE;
|
|
6
12
|
|
|
7
13
|
export const A2UIActivityContentSchema = z.object({
|
|
8
14
|
operations: z.array(z.record(z.string(), z.unknown())),
|
|
9
15
|
});
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
?.surfaceId as string | undefined) ??
|
|
18
|
-
((operation.dataModelUpdate as { surfaceId?: string } | undefined)
|
|
19
|
-
?.surfaceId as string | undefined) ??
|
|
20
|
-
((operation.deleteSurface as { surfaceId?: string } | undefined)
|
|
21
|
-
?.surfaceId as string | undefined) ??
|
|
22
|
-
((operation.createSurface as { surfaceId?: string } | undefined)
|
|
23
|
-
?.surfaceId as string | undefined) ??
|
|
24
|
-
((operation.updateComponents as { surfaceId?: string } | undefined)
|
|
25
|
-
?.surfaceId as string | undefined) ??
|
|
26
|
-
((operation.updateDataModel as { surfaceId?: string } | undefined)
|
|
27
|
-
?.surfaceId as string | undefined);
|
|
28
|
-
|
|
29
|
-
return surfaceId ?? "default";
|
|
17
|
+
/**
|
|
18
|
+
* The surface an operation addresses: the id nested in the operation wins
|
|
19
|
+
* over a top-level `surfaceId` (OSS-1048); "default" when it names none.
|
|
20
|
+
*/
|
|
21
|
+
export function getOperationSurfaceId(operation: A2UIOperation) {
|
|
22
|
+
return ɵgetA2UIOperationSurfaceId(operation) ?? ɵA2UI_DEFAULT_SURFACE_ID;
|
|
30
23
|
}
|