@copilotkit/vue 2.0.0-rc.3 → 2.0.0-rc.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTOR_GUIDE.md +1 -1
- package/PARITY.md +3 -3
- package/dist/hooks/use-copilot-action.d.ts.map +1 -1
- package/dist/hooks/use-frontend-tool.d.ts +1 -1
- package/dist/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/hooks/zod-parameters.d.ts +14 -0
- package/dist/hooks/zod-parameters.d.ts.map +1 -0
- package/dist/index.cjs +1 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +365 -16920
- package/dist/index.mjs.map +1 -1
- package/dist/use-render-activity-message-BZJ33B_r.cjs +113 -0
- package/dist/use-render-activity-message-BZJ33B_r.cjs.map +1 -0
- package/dist/use-render-activity-message-DrR407LQ.js +15901 -0
- package/dist/use-render-activity-message-DrR407LQ.js.map +1 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts +14 -0
- package/dist/v2/components/A2UIMessageRenderer.d.ts.map +1 -1
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts +10 -3
- package/dist/v2/components/A2UISurfaceActivityRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/CopilotKitInspector.vue.d.ts +5 -1
- package/dist/v2/components/CopilotKitInspector.vue.d.ts.map +1 -1
- package/dist/v2/components/InlineFeatureWarning.vue.d.ts.map +1 -1
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts +2 -2
- package/dist/v2/components/LicenseWarningBanner.vue.d.ts.map +1 -1
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts.map +1 -1
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +13 -59
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts +3 -11
- package/dist/v2/components/a2ui/A2UIBuiltInToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +10 -15
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +14 -130
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -1
- package/dist/v2/components/a2ui/catalog.d.ts.map +1 -1
- package/dist/v2/components/a2ui/utils.d.ts +3 -15
- package/dist/v2/components/a2ui/utils.d.ts.map +1 -1
- package/dist/v2/components/a2ui.d.ts +9 -8
- package/dist/v2/components/a2ui.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChat.vue.d.ts +2 -2
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentRenderer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts +4 -8
- package/dist/v2/components/chat/CopilotChatAudioRecorder.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatFeedbackCommentPopover.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +7 -286
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInspectorButton.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatLightbox.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallGroup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallItem.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotChatToolCallsView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatUserMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +3 -3
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatWorkSummary.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts +8 -3
- package/dist/v2/components/chat/CopilotPopup.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts +5 -3
- package/dist/v2/components/chat/CopilotPopupView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts +5 -3
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts +8 -3
- package/dist/v2/components/chat/CopilotSidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts +6 -4
- package/dist/v2/components/chat/CopilotSidebarView.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts +6 -4
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotThreadsDrawer.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts +1 -0
- package/dist/v2/components/chat/StreamingMarkdownDefault.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/audioRecorder.d.ts +3 -4
- package/dist/v2/components/chat/audioRecorder.d.ts.map +1 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts +4 -4
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
- package/dist/v2/components/chat/forwarded-slots.d.ts +12 -0
- package/dist/v2/components/chat/forwarded-slots.d.ts.map +1 -0
- package/dist/v2/components/chat/index.d.ts +34 -31
- package/dist/v2/components/chat/index.d.ts.map +1 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts +2 -1
- package/dist/v2/components/chat/inspector-shortcuts.d.ts.map +1 -1
- package/dist/v2/components/chat/message-feedback.d.ts +38 -49
- package/dist/v2/components/chat/message-feedback.d.ts.map +1 -1
- package/dist/v2/components/chat/tool-call-display-context.d.ts +4 -19
- package/dist/v2/components/chat/tool-call-display-context.d.ts.map +1 -1
- package/dist/v2/components/chat/tool-call-group-parts.d.ts +7 -20
- package/dist/v2/components/chat/tool-call-group-parts.d.ts.map +1 -1
- package/dist/v2/components/chat/turn-work.d.ts +0 -2
- package/dist/v2/components/chat/turn-work.d.ts.map +1 -1
- package/dist/v2/components/chat/types.d.ts +9 -4
- package/dist/v2/components/chat/types.d.ts.map +1 -1
- package/dist/v2/components/chat/use-chat-labels.d.ts +8 -0
- package/dist/v2/components/chat/use-chat-labels.d.ts.map +1 -0
- package/dist/v2/components/chat/use-copy-feedback.d.ts +11 -0
- package/dist/v2/components/chat/use-copy-feedback.d.ts.map +1 -0
- package/dist/v2/components/chat/use-lightbox.d.ts.map +1 -1
- package/dist/v2/components/icons/index.d.ts +968 -1
- package/dist/v2/components/icons/index.d.ts.map +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts +1 -1
- package/dist/v2/components/ui/CopilotDropdownMenuContent.vue.d.ts.map +1 -1
- package/dist/v2/hooks/use-agent-context.d.ts +2 -3
- package/dist/v2/hooks/use-agent-context.d.ts.map +1 -1
- package/dist/v2/hooks/use-agent.d.ts +4 -1
- package/dist/v2/hooks/use-agent.d.ts.map +1 -1
- package/dist/v2/hooks/use-attachments.d.ts +7 -0
- package/dist/v2/hooks/use-attachments.d.ts.map +1 -1
- package/dist/v2/hooks/use-capabilities.d.ts.map +1 -1
- package/dist/v2/hooks/use-component.d.ts +1 -0
- package/dist/v2/hooks/use-component.d.ts.map +1 -1
- package/dist/v2/hooks/use-configure-suggestions.d.ts +4 -9
- package/dist/v2/hooks/use-configure-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-default-render-tool.d.ts +2 -7
- package/dist/v2/hooks/use-default-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-frontend-tool.d.ts +5 -0
- package/dist/v2/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-human-in-the-loop.d.ts +2 -1
- package/dist/v2/hooks/use-human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/hooks/use-interrupt.d.ts +0 -1
- package/dist/v2/hooks/use-interrupt.d.ts.map +1 -1
- package/dist/v2/hooks/use-keyboard-height.d.ts +1 -1
- package/dist/v2/hooks/use-keyboard-height.d.ts.map +1 -1
- package/dist/v2/hooks/use-pin-to-send.d.ts +4 -12
- package/dist/v2/hooks/use-pin-to-send.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-activity-message.d.ts +13 -9
- package/dist/v2/hooks/use-render-activity-message.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-custom-messages.d.ts +5 -7
- package/dist/v2/hooks/use-render-custom-messages.d.ts.map +1 -1
- package/dist/v2/hooks/use-render-tool.d.ts +1 -1
- package/dist/v2/hooks/use-render-tool.d.ts.map +1 -1
- package/dist/v2/hooks/use-suggestions.d.ts.map +1 -1
- package/dist/v2/hooks/use-threads.d.ts +6 -23
- package/dist/v2/hooks/use-threads.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +197 -200
- package/dist/v2/index.mjs.map +1 -1
- package/dist/v2/lib/processPartialHtml.d.ts +1 -2
- package/dist/v2/lib/processPartialHtml.d.ts.map +1 -1
- package/dist/v2/lib/shallow-stable.d.ts.map +1 -1
- package/dist/v2/lib/vue-core.d.ts +33 -19
- package/dist/v2/lib/vue-core.d.ts.map +1 -1
- package/dist/v2/providers/CopilotChatConfigurationProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +9 -129
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +9 -10
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/chat-configuration-store-key.d.ts +8 -0
- package/dist/v2/providers/chat-configuration-store-key.d.ts.map +1 -0
- package/dist/v2/providers/markdown-renderer.d.ts +4 -2
- package/dist/v2/providers/markdown-renderer.d.ts.map +1 -1
- package/dist/v2/providers/types.d.ts +3 -46
- package/dist/v2/providers/types.d.ts.map +1 -1
- package/dist/v2/providers/use-inspector-thread-override.d.ts +5 -0
- package/dist/v2/providers/use-inspector-thread-override.d.ts.map +1 -1
- package/dist/v2/types/defineToolCallRenderer.d.ts +1 -1
- package/dist/v2/types/defineToolCallRenderer.d.ts.map +1 -1
- package/dist/v2/types/human-in-the-loop.d.ts +8 -29
- package/dist/v2/types/human-in-the-loop.d.ts.map +1 -1
- package/dist/v2/types/interrupt.d.ts +1 -22
- package/dist/v2/types/interrupt.d.ts.map +1 -1
- package/dist/v2/types/vue-activity-message-renderer.d.ts +16 -15
- package/dist/v2/types/vue-activity-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-custom-message-renderer.d.ts +7 -16
- package/dist/v2/types/vue-custom-message-renderer.d.ts.map +1 -1
- package/dist/v2/types/vue-tool-call-renderer.d.ts +16 -35
- package/dist/v2/types/vue-tool-call-renderer.d.ts.map +1 -1
- package/package.json +12 -13
- package/src/__tests__/build-entries.test.ts +29 -0
- package/src/hooks/__tests__/zod-parameters.test.ts +520 -0
- package/src/hooks/use-copilot-action.ts +2 -1
- package/src/hooks/use-frontend-tool.ts +3 -6
- package/src/hooks/zod-parameters.ts +162 -0
- package/src/v2/__tests__/exports.test.ts +10 -0
- package/src/v2/__tests__/mocks/web-inspector.ts +6 -0
- package/src/v2/__tests__/utils/test-helpers.ts +34 -4
- package/src/v2/components/A2UIMessageRenderer.ts +98 -68
- package/src/v2/components/A2UISurfaceActivityRenderer.vue +68 -103
- package/src/v2/components/CopilotKitInspector.vue +104 -51
- package/src/v2/components/InlineFeatureWarning.vue +20 -21
- package/src/v2/components/LicenseWarningBanner.vue +27 -135
- package/src/v2/components/MCPAppsActivityRenderer.ts +75 -201
- package/src/v2/components/OpenGenerativeUIRenderer.ts +122 -446
- package/src/v2/components/__tests__/A2UIMessageRenderer.test.ts +171 -8
- package/src/v2/components/__tests__/CopilotKitInspector.test.ts +42 -0
- package/src/v2/components/__tests__/LicenseWarningBanner.test.ts +60 -0
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +64 -8
- package/src/v2/components/__tests__/OpenGenerativeUIToolRenderer.test.ts +38 -0
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +6 -26
- package/src/v2/components/a2ui/A2UICatalogContext.ts +27 -185
- package/src/v2/components/a2ui/A2UIRecoveryStates.ts +127 -327
- package/src/v2/components/a2ui/catalog.ts +3 -3
- package/src/v2/components/a2ui/utils.ts +13 -65
- package/src/v2/components/a2ui.ts +15 -22
- package/src/v2/components/chat/CopilotChat.vue +121 -498
- package/src/v2/components/chat/CopilotChatAssistantMessage.vue +47 -184
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +36 -55
- package/src/v2/components/chat/CopilotChatAttachmentRenderer.vue +14 -6
- package/src/v2/components/chat/CopilotChatAudioRecorder.vue +19 -246
- package/src/v2/components/chat/CopilotChatFeedbackCommentPopover.vue +12 -77
- package/src/v2/components/chat/CopilotChatInput.vue +139 -654
- package/src/v2/components/chat/CopilotChatInspectorButton.vue +45 -108
- package/src/v2/components/chat/CopilotChatLightbox.vue +10 -31
- package/src/v2/components/chat/CopilotChatMessageView.vue +96 -274
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +27 -62
- package/src/v2/components/chat/CopilotChatToolCallGroup.vue +63 -71
- package/src/v2/components/chat/CopilotChatToolCallItem.vue +8 -6
- package/src/v2/components/chat/CopilotChatToolCallsView.vue +31 -32
- package/src/v2/components/chat/CopilotChatUserMessage.vue +24 -112
- package/src/v2/components/chat/CopilotChatView.vue +123 -161
- package/src/v2/components/chat/CopilotChatWorkSummary.vue +26 -36
- package/src/v2/components/chat/CopilotModalHeader.vue +11 -23
- package/src/v2/components/chat/CopilotPopup.vue +23 -25
- package/src/v2/components/chat/CopilotPopupView.vue +10 -39
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +49 -185
- package/src/v2/components/chat/CopilotSidebar.vue +23 -25
- package/src/v2/components/chat/CopilotSidebarView.vue +10 -39
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +56 -100
- package/src/v2/components/chat/CopilotThreadsDrawer.vue +43 -105
- package/src/v2/components/chat/StreamingMarkdownDefault.vue +15 -28
- package/src/v2/components/chat/__tests__/CopilotChat.labels.test.ts +19 -4
- package/src/v2/components/chat/__tests__/CopilotChat.test.ts +12 -10
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +26 -9
- package/src/v2/components/chat/__tests__/CopilotChatAssistantMessage.learningFeedback.test.ts +5 -5
- package/src/v2/components/chat/__tests__/CopilotChatAttachmentQueue.test.ts +28 -0
- package/src/v2/components/chat/__tests__/CopilotChatInput.test.ts +132 -1
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.test.ts +247 -403
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.toolCallDisplay.test.ts +1 -99
- package/src/v2/components/chat/__tests__/CopilotChatView.pinToSend.test.ts +43 -1
- package/src/v2/components/chat/__tests__/CopilotPopup.test.ts +90 -1
- package/src/v2/components/chat/__tests__/CopilotPopupView.test.ts +19 -0
- package/src/v2/components/chat/__tests__/CopilotSidebar.test.ts +90 -1
- package/src/v2/components/chat/__tests__/CopilotSidebarView.position.test.ts +32 -8
- package/src/v2/components/chat/__tests__/CopilotSidebarView.test.ts +2 -1
- package/src/v2/components/chat/__tests__/StreamingMarkdownDefault.test.ts +54 -0
- package/src/v2/components/chat/audioRecorder.ts +4 -7
- package/src/v2/components/chat/copilotChatToolCallItemRender.ts +25 -90
- package/src/v2/components/chat/forwarded-slots.ts +17 -0
- package/src/v2/components/chat/index.ts +0 -1
- package/src/v2/components/chat/inspector-shortcuts.ts +10 -16
- package/src/v2/components/chat/message-feedback.ts +92 -195
- package/src/v2/components/chat/tool-call-display-context.ts +6 -22
- package/src/v2/components/chat/tool-call-group-parts.ts +47 -108
- package/src/v2/components/chat/turn-work.ts +0 -9
- package/src/v2/components/chat/types.ts +12 -4
- package/src/v2/components/chat/use-chat-labels.ts +16 -0
- package/src/v2/components/chat/use-copy-feedback.ts +21 -0
- package/src/v2/components/chat/use-lightbox.ts +15 -33
- package/src/v2/components/icons/__tests__/icons.test.ts +72 -68
- package/src/v2/components/icons/index.ts +109 -27
- package/src/v2/hooks/__tests__/use-agent-error-state.test.ts +5 -3
- package/src/v2/hooks/__tests__/use-agent-stability.test.ts +25 -4
- package/src/v2/hooks/__tests__/use-agent-throttle.test.ts +5 -1
- package/src/v2/hooks/__tests__/use-agent.test.ts +6 -3
- package/src/v2/hooks/__tests__/use-component.test.ts +21 -0
- package/src/v2/hooks/__tests__/use-configure-suggestions.test.ts +30 -1
- package/src/v2/hooks/__tests__/use-default-render-tool.test.ts +10 -10
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +66 -1
- package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.ts +6 -1
- package/src/v2/hooks/__tests__/use-human-in-the-loop.test.ts +187 -12
- package/src/v2/hooks/__tests__/use-interrupt.test.ts +97 -0
- package/src/v2/hooks/__tests__/use-render-activity-message.test.ts +106 -0
- package/src/v2/hooks/__tests__/use-render-tool.test.ts +3 -6
- package/src/v2/hooks/__tests__/use-threads.test.ts +48 -6
- package/src/v2/hooks/__tests__/zod-regression.test.ts +5 -4
- package/src/v2/hooks/use-agent-context.ts +4 -10
- package/src/v2/hooks/use-agent.ts +86 -290
- package/src/v2/hooks/use-attachments.ts +48 -168
- package/src/v2/hooks/use-capabilities.ts +2 -7
- package/src/v2/hooks/use-component.ts +7 -4
- package/src/v2/hooks/use-configure-suggestions.ts +29 -220
- package/src/v2/hooks/use-default-render-tool.ts +31 -152
- package/src/v2/hooks/use-frontend-tool.ts +15 -25
- package/src/v2/hooks/use-human-in-the-loop.ts +11 -80
- package/src/v2/hooks/use-interrupt.ts +29 -308
- package/src/v2/hooks/use-keyboard-height.ts +17 -40
- package/src/v2/hooks/use-pin-to-send.ts +15 -99
- package/src/v2/hooks/use-render-activity-message.ts +35 -57
- package/src/v2/hooks/use-render-custom-messages.ts +24 -88
- package/src/v2/hooks/use-render-tool.ts +2 -4
- package/src/v2/hooks/use-suggestions.ts +17 -36
- package/src/v2/hooks/use-threads.ts +49 -288
- package/src/v2/lib/__tests__/shallow-stable.test.ts +54 -0
- package/src/v2/lib/__tests__/vue-core-renderers.test.ts +42 -0
- package/src/v2/lib/processPartialHtml.ts +6 -21
- package/src/v2/lib/shallow-stable.ts +2 -16
- package/src/v2/lib/vue-core.ts +90 -85
- package/src/v2/providers/CopilotChatConfigurationProvider.vue +48 -186
- package/src/v2/providers/CopilotKitProvider.types.ts +12 -132
- package/src/v2/providers/CopilotKitProvider.vue +291 -641
- package/src/v2/providers/__tests__/CopilotChatConfigurationProvider.test.ts +22 -2
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +38 -2
- package/src/v2/providers/__tests__/CopilotKitProvider.config.test.ts +124 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.headersAtSendTime.test.ts +3 -3
- package/src/v2/providers/__tests__/CopilotKitProvider.learning.test.ts +3 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.sandboxFunctions.test.ts +4 -1
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +88 -28
- package/src/v2/providers/chat-configuration-store-key.ts +9 -0
- package/src/v2/providers/markdown-renderer.ts +8 -2
- package/src/v2/providers/types.ts +3 -49
- package/src/v2/providers/use-inspector-thread-override.ts +22 -80
- package/src/v2/types/__tests__/defineToolCallRenderer.test.ts +28 -33
- package/src/v2/types/defineToolCallRenderer.ts +7 -6
- package/src/v2/types/human-in-the-loop.ts +8 -32
- package/src/v2/types/interrupt.ts +7 -31
- package/src/v2/types/vue-activity-message-renderer.ts +24 -15
- package/src/v2/types/vue-custom-message-renderer.ts +12 -16
- package/src/v2/types/vue-tool-call-renderer.ts +23 -38
- package/tsconfig.json +0 -1
- package/vite.config.ts +8 -5
- package/vitest.config.ts +12 -7
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts +0 -9
- package/dist/v2/components/chat/BasicMarkdown.vue.d.ts.map +0 -1
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts +0 -3
- package/dist/v2/components/chat/normalize-auto-scroll.d.ts.map +0 -1
- package/dist/v2/components/chat/tool-call-layout.d.ts +0 -115
- package/dist/v2/components/chat/tool-call-layout.d.ts.map +0 -1
- package/dist/v2/lib/is-mobile-viewport.d.ts +0 -15
- package/dist/v2/lib/is-mobile-viewport.d.ts.map +0 -1
- package/dist/v2/lib/message-feedback.d.ts +0 -33
- package/dist/v2/lib/message-feedback.d.ts.map +0 -1
- package/dist/v2/lib/transcription-client.d.ts +0 -19
- package/dist/v2/lib/transcription-client.d.ts.map +0 -1
- package/src/v2/components/__tests__/A2UICatalogContext.test.ts +0 -63
- package/src/v2/components/a2ui/__tests__/A2UIRecoveryStates.test.ts +0 -175
- package/src/v2/components/chat/BasicMarkdown.vue +0 -160
- package/src/v2/components/chat/__tests__/BasicMarkdown.test.ts +0 -69
- package/src/v2/components/chat/__tests__/normalize-auto-scroll.test.ts +0 -39
- package/src/v2/components/chat/normalize-auto-scroll.ts +0 -17
- package/src/v2/components/chat/tool-call-layout.ts +0 -304
- package/src/v2/lib/__tests__/is-mobile-viewport.test.ts +0 -48
- package/src/v2/lib/__tests__/message-feedback.test.ts +0 -152
- package/src/v2/lib/__tests__/processPartialHtml.test.ts +0 -84
- package/src/v2/lib/__tests__/transcription-client.test.ts +0 -67
- package/src/v2/lib/is-mobile-viewport.ts +0 -23
- package/src/v2/lib/message-feedback.ts +0 -120
- package/src/v2/lib/transcription-client.ts +0 -151
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { actionParametersToJsonSchema } from "@copilotkit/shared";
|
|
3
|
+
import type { Parameter } from "@copilotkit/shared";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Convert a JSON Schema to a Zod schema. Resolves `$ref` against `$defs` /
|
|
7
|
+
* `definitions`, maps `anyOf` / `oneOf` to unions, and falls back to
|
|
8
|
+
* `z.any()` for circular refs and unsupported types.
|
|
9
|
+
*
|
|
10
|
+
* Moved here from `@copilotkit/shared` in 2.0 so that shared does not depend
|
|
11
|
+
* on zod.
|
|
12
|
+
*/
|
|
13
|
+
export function convertJsonSchemaToZodSchema(
|
|
14
|
+
jsonSchema: any,
|
|
15
|
+
required: boolean,
|
|
16
|
+
definitions?: Record<string, any>,
|
|
17
|
+
visitedRefs?: Set<string>,
|
|
18
|
+
): z.ZodSchema {
|
|
19
|
+
// Resolve $ref references
|
|
20
|
+
if (jsonSchema.$ref && definitions) {
|
|
21
|
+
const refPath = jsonSchema.$ref.replace(
|
|
22
|
+
/^#\/\$defs\/|^#\/definitions\//,
|
|
23
|
+
"",
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// Detect circular $ref cycles
|
|
27
|
+
const refs = visitedRefs ?? new Set<string>();
|
|
28
|
+
if (refs.has(refPath)) {
|
|
29
|
+
console.warn(
|
|
30
|
+
`[CopilotKit] Circular $ref detected for "${refPath}" — falling back to z.any()`,
|
|
31
|
+
);
|
|
32
|
+
let schema = z.any();
|
|
33
|
+
if (jsonSchema.description) {
|
|
34
|
+
schema = schema.describe(jsonSchema.description);
|
|
35
|
+
}
|
|
36
|
+
return required ? schema : schema.optional();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const resolved = definitions[refPath];
|
|
40
|
+
if (resolved) {
|
|
41
|
+
// Clone the set so sibling branches don't see each other's visited refs
|
|
42
|
+
const nextRefs = new Set(refs);
|
|
43
|
+
nextRefs.add(refPath);
|
|
44
|
+
return convertJsonSchemaToZodSchema(
|
|
45
|
+
resolved,
|
|
46
|
+
required,
|
|
47
|
+
definitions,
|
|
48
|
+
nextRefs,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Collect top-level definitions for $ref resolution
|
|
54
|
+
const defs = definitions ?? jsonSchema.$defs ?? jsonSchema.definitions;
|
|
55
|
+
|
|
56
|
+
// Handle null-union types like ["string", "null"]
|
|
57
|
+
if (Array.isArray(jsonSchema.type)) {
|
|
58
|
+
const types = jsonSchema.type as string[];
|
|
59
|
+
const hasNull = types.includes("null");
|
|
60
|
+
const nonNullTypes = types.filter((t: string) => t !== "null");
|
|
61
|
+
const resolvedType = nonNullTypes.length > 0 ? nonNullTypes[0] : "string";
|
|
62
|
+
const innerSchema = convertJsonSchemaToZodSchema(
|
|
63
|
+
{ ...jsonSchema, type: resolvedType },
|
|
64
|
+
true,
|
|
65
|
+
defs,
|
|
66
|
+
visitedRefs,
|
|
67
|
+
);
|
|
68
|
+
let schema = hasNull ? z.union([innerSchema, z.null()]) : innerSchema;
|
|
69
|
+
if (jsonSchema.description) {
|
|
70
|
+
schema = schema.describe(jsonSchema.description);
|
|
71
|
+
}
|
|
72
|
+
return required ? schema : schema.optional();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Handle anyOf / oneOf as z.union
|
|
76
|
+
const unionVariants = jsonSchema.anyOf ?? jsonSchema.oneOf;
|
|
77
|
+
if (Array.isArray(unionVariants) && unionVariants.length > 0) {
|
|
78
|
+
if (unionVariants.length === 1) {
|
|
79
|
+
return convertJsonSchemaToZodSchema(
|
|
80
|
+
unionVariants[0],
|
|
81
|
+
required,
|
|
82
|
+
defs,
|
|
83
|
+
visitedRefs,
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
const schemas = unionVariants.map((v: any) =>
|
|
87
|
+
convertJsonSchemaToZodSchema(v, true, defs, visitedRefs),
|
|
88
|
+
);
|
|
89
|
+
let schema = z.union(
|
|
90
|
+
schemas as [z.ZodSchema, z.ZodSchema, ...z.ZodSchema[]],
|
|
91
|
+
);
|
|
92
|
+
if (jsonSchema.description) {
|
|
93
|
+
schema = schema.describe(jsonSchema.description);
|
|
94
|
+
}
|
|
95
|
+
return required ? schema : schema.optional();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (jsonSchema.type === "object") {
|
|
99
|
+
const spec: { [key: string]: z.ZodSchema } = {};
|
|
100
|
+
|
|
101
|
+
if (!jsonSchema.properties || !Object.keys(jsonSchema.properties).length) {
|
|
102
|
+
return !required ? z.object(spec).optional() : z.object(spec);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
for (const [key, value] of Object.entries(jsonSchema.properties)) {
|
|
106
|
+
spec[key] = convertJsonSchemaToZodSchema(
|
|
107
|
+
value,
|
|
108
|
+
jsonSchema.required ? jsonSchema.required.includes(key) : false,
|
|
109
|
+
defs,
|
|
110
|
+
visitedRefs,
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
let schema = z.object(spec).describe(jsonSchema.description);
|
|
114
|
+
return required ? schema : schema.optional();
|
|
115
|
+
} else if (jsonSchema.type === "string") {
|
|
116
|
+
if (jsonSchema.enum && jsonSchema.enum.length > 0) {
|
|
117
|
+
let schema = z
|
|
118
|
+
.enum(jsonSchema.enum as [string, ...string[]])
|
|
119
|
+
.describe(jsonSchema.description);
|
|
120
|
+
return required ? schema : schema.optional();
|
|
121
|
+
}
|
|
122
|
+
let schema = z.string().describe(jsonSchema.description);
|
|
123
|
+
return required ? schema : schema.optional();
|
|
124
|
+
} else if (jsonSchema.type === "number" || jsonSchema.type === "integer") {
|
|
125
|
+
let schema = z.number().describe(jsonSchema.description);
|
|
126
|
+
return required ? schema : schema.optional();
|
|
127
|
+
} else if (jsonSchema.type === "boolean") {
|
|
128
|
+
let schema = z.boolean().describe(jsonSchema.description);
|
|
129
|
+
return required ? schema : schema.optional();
|
|
130
|
+
} else if (jsonSchema.type === "array") {
|
|
131
|
+
let itemSchema = convertJsonSchemaToZodSchema(
|
|
132
|
+
jsonSchema.items,
|
|
133
|
+
true,
|
|
134
|
+
defs,
|
|
135
|
+
visitedRefs,
|
|
136
|
+
);
|
|
137
|
+
let schema = z.array(itemSchema).describe(jsonSchema.description);
|
|
138
|
+
return required ? schema : schema.optional();
|
|
139
|
+
} else if (jsonSchema.type === "null") {
|
|
140
|
+
let schema = z.null().describe(jsonSchema.description);
|
|
141
|
+
return required ? schema : schema.optional();
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Fallback: accept any value rather than throwing
|
|
145
|
+
console.warn(
|
|
146
|
+
`[CopilotKit] Unsupported JSON schema type "${jsonSchema.type ?? "unknown"}" — falling back to z.any()`,
|
|
147
|
+
);
|
|
148
|
+
let schema = z.any();
|
|
149
|
+
if (jsonSchema.description) {
|
|
150
|
+
schema = schema.describe(jsonSchema.description);
|
|
151
|
+
}
|
|
152
|
+
return required ? schema : schema.optional();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Convert v1 `Parameter[]` action parameters to a Zod object schema. */
|
|
156
|
+
export function getZodParameters<T extends [] | Parameter[] | undefined>(
|
|
157
|
+
parameters: T,
|
|
158
|
+
): any {
|
|
159
|
+
if (!parameters) return z.object({});
|
|
160
|
+
const jsonParams = actionParametersToJsonSchema(parameters);
|
|
161
|
+
return convertJsonSchemaToZodSchema(jsonParams, true);
|
|
162
|
+
}
|
|
@@ -24,6 +24,16 @@ describe("package exports", () => {
|
|
|
24
24
|
expect(typeof VuePackage.MCPAppsActivityRenderer).toBe("object");
|
|
25
25
|
expect(VuePackage.A2UISurfaceActivityType).toBe("a2ui-surface");
|
|
26
26
|
expect(typeof VuePackage.A2UISurfaceActivityRenderer).toBe("object");
|
|
27
|
+
expect(
|
|
28
|
+
VuePackage.getOperationSurfaceId({ createSurface: { surfaceId: "s" } }),
|
|
29
|
+
).toBe("s");
|
|
30
|
+
// Standard Schemas since 2.0 (see the generative UI migration guide).
|
|
31
|
+
expect(VuePackage.OpenGenerativeUIContentSchema["~standard"].vendor).toBe(
|
|
32
|
+
"copilotkit",
|
|
33
|
+
);
|
|
34
|
+
expect(VuePackage.GenerateSandboxedUiArgsSchema["~standard"].vendor).toBe(
|
|
35
|
+
"copilotkit",
|
|
36
|
+
);
|
|
27
37
|
});
|
|
28
38
|
|
|
29
39
|
it("exports the default A2UI catalog for the catalog-on-provider path", () => {
|
|
@@ -12,6 +12,12 @@ export class WebInspectorElement extends HTMLElement {
|
|
|
12
12
|
connectedCallback() {
|
|
13
13
|
this.autoAttachCoreAtConnection = this.autoAttachCore;
|
|
14
14
|
this.coreAtConnection = this.core;
|
|
15
|
+
// The real element reports that it is shown after its first render.
|
|
16
|
+
this.dispatchEvent(
|
|
17
|
+
new CustomEvent("cpk-inspector-visibility-change", {
|
|
18
|
+
detail: { visible: true },
|
|
19
|
+
}),
|
|
20
|
+
);
|
|
15
21
|
}
|
|
16
22
|
}
|
|
17
23
|
|
|
@@ -178,11 +178,26 @@ export class MockStepwiseAgent extends AbstractAgent {
|
|
|
178
178
|
|
|
179
179
|
run(_input: RunAgentInput): Observable<BaseEvent> {
|
|
180
180
|
return new Observable<BaseEvent>((observer) => {
|
|
181
|
-
|
|
181
|
+
// Finish each run at its terminal event, as a real agent does, while
|
|
182
|
+
// keeping the shared subject for the next run in a multi-turn test. A
|
|
183
|
+
// send waits for the run in flight, so a run that never ends would hold
|
|
184
|
+
// every later send.
|
|
185
|
+
const deliver = (event: BaseEvent) => {
|
|
186
|
+
observer.next(event);
|
|
187
|
+
const isTerminal =
|
|
188
|
+
event.type === EventType.RUN_FINISHED ||
|
|
189
|
+
event.type === EventType.RUN_ERROR;
|
|
190
|
+
if (isTerminal) observer.complete();
|
|
191
|
+
};
|
|
192
|
+
const subscription = this.subject.subscribe({
|
|
193
|
+
next: deliver,
|
|
194
|
+
error: (error: unknown) => observer.error(error),
|
|
195
|
+
complete: () => observer.complete(),
|
|
196
|
+
});
|
|
182
197
|
void this.enqueueDelivery(async () => {
|
|
183
198
|
if (this.bufferedEvents.length > 0) {
|
|
184
199
|
for (const event of this.bufferedEvents) {
|
|
185
|
-
|
|
200
|
+
deliver(event);
|
|
186
201
|
}
|
|
187
202
|
this.bufferedEvents = [];
|
|
188
203
|
}
|
|
@@ -386,11 +401,26 @@ export class MockReconnectableAgent extends AbstractAgent {
|
|
|
386
401
|
|
|
387
402
|
run(_input: RunAgentInput): Observable<BaseEvent> {
|
|
388
403
|
return new Observable<BaseEvent>((observer) => {
|
|
389
|
-
|
|
404
|
+
// Finish each run at its terminal event, as a real agent does, while
|
|
405
|
+
// keeping the shared subject for the next run in a multi-turn test. A
|
|
406
|
+
// send waits for the run in flight, so a run that never ends would hold
|
|
407
|
+
// every later send.
|
|
408
|
+
const deliver = (event: BaseEvent) => {
|
|
409
|
+
observer.next(event);
|
|
410
|
+
const isTerminal =
|
|
411
|
+
event.type === EventType.RUN_FINISHED ||
|
|
412
|
+
event.type === EventType.RUN_ERROR;
|
|
413
|
+
if (isTerminal) observer.complete();
|
|
414
|
+
};
|
|
415
|
+
const subscription = this.subject.subscribe({
|
|
416
|
+
next: deliver,
|
|
417
|
+
error: (error: unknown) => observer.error(error),
|
|
418
|
+
complete: () => observer.complete(),
|
|
419
|
+
});
|
|
390
420
|
void this.enqueueDelivery(async () => {
|
|
391
421
|
if (this.bufferedEvents.length > 0) {
|
|
392
422
|
for (const event of this.bufferedEvents) {
|
|
393
|
-
|
|
423
|
+
deliver(event);
|
|
394
424
|
}
|
|
395
425
|
this.bufferedEvents = [];
|
|
396
426
|
}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { PropType } from "vue";
|
|
3
|
-
import {
|
|
1
|
+
import { defineComponent, h, onBeforeUnmount, shallowRef, watch } from "vue";
|
|
2
|
+
import type { Component, PropType } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
ɵA2UIActivityController,
|
|
5
|
+
ɵA2UI_SURFACE_ACTIVITY_TYPE,
|
|
6
|
+
ɵA2UI_SURFACE_CONTENT_SCHEMA,
|
|
7
|
+
} from "@copilotkit/core";
|
|
8
|
+
import type {
|
|
9
|
+
ɵA2UIActionAgent,
|
|
10
|
+
ɵA2UIActionInterceptor,
|
|
11
|
+
ɵA2UISurfaceContent,
|
|
12
|
+
} from "@copilotkit/core";
|
|
13
|
+
import type { ActivityMessage } from "@ag-ui/core";
|
|
4
14
|
import type { VueActivityMessageRenderer } from "../types";
|
|
5
15
|
import type { A2UITheme } from "../types";
|
|
6
16
|
import A2UISurfaceActivityRenderer from "./A2UISurfaceActivityRenderer.vue";
|
|
7
|
-
import {
|
|
8
|
-
A2UIBuildingState,
|
|
9
|
-
A2UILifecycleFields,
|
|
10
|
-
A2UIRecoveryFailure,
|
|
11
|
-
A2UIRetryingState,
|
|
12
|
-
resolveDebugExposure,
|
|
13
|
-
} from "./a2ui/A2UIRecoveryStates";
|
|
17
|
+
import { renderA2UILifecycleState } from "./a2ui/A2UIRecoveryStates";
|
|
14
18
|
import type { A2UIRecoveryRendererOptions } from "./a2ui/A2UIRecoveryStates";
|
|
15
19
|
|
|
16
|
-
const A2UI_OPERATIONS_KEY = "a2ui_operations";
|
|
17
|
-
|
|
18
20
|
export type A2UIMessageRendererOptions = {
|
|
19
21
|
theme: A2UITheme;
|
|
20
22
|
catalog?: any;
|
|
@@ -25,88 +27,116 @@ export type A2UIMessageRendererOptions = {
|
|
|
25
27
|
* sub-label appears, and how much retry/debug detail to surface.
|
|
26
28
|
*/
|
|
27
29
|
recovery?: A2UIRecoveryRendererOptions;
|
|
30
|
+
/**
|
|
31
|
+
* Intercept actions before they reach the agent: return `null` to handle an
|
|
32
|
+
* action client-side, return an action to forward that one instead, or
|
|
33
|
+
* return nothing to forward it unchanged.
|
|
34
|
+
*/
|
|
35
|
+
onAction?: ɵA2UIActionInterceptor;
|
|
28
36
|
};
|
|
29
37
|
|
|
38
|
+
function isComponent(value: unknown): value is Component {
|
|
39
|
+
return (
|
|
40
|
+
typeof value === "function" || (typeof value === "object" && value !== null)
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
30
44
|
/**
|
|
31
45
|
* The `a2ui-surface` activity carries the WHOLE generative-UI lifecycle on one
|
|
32
46
|
* stable messageId: pre-paint `status` ("building" | "retrying" | "failed")
|
|
33
|
-
* with recovery detail, then `a2ui_operations` on paint.
|
|
34
|
-
*
|
|
35
|
-
* the
|
|
47
|
+
* with recovery detail, then `a2ui_operations` on paint. Core's
|
|
48
|
+
* `ɵA2UIActivityController` decides what shows; this renderer draws it and
|
|
49
|
+
* keeps the surface mounted, hidden under the loader, until it has painted.
|
|
36
50
|
*/
|
|
37
|
-
const A2UISurfaceContentSchema = z
|
|
38
|
-
.object({
|
|
39
|
-
a2ui_operations: z.array(z.any()).optional(),
|
|
40
|
-
...A2UILifecycleFields,
|
|
41
|
-
})
|
|
42
|
-
.passthrough();
|
|
43
|
-
|
|
44
51
|
export function createA2UIMessageRenderer(
|
|
45
52
|
options: A2UIMessageRendererOptions,
|
|
46
53
|
): VueActivityMessageRenderer<any> {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// Renders the pre-paint lifecycle state for a content snapshot.
|
|
52
|
-
const renderLifecycle = (content: any) => {
|
|
53
|
-
const debugExposure = resolveDebugExposure(content, optionDebugExposure);
|
|
54
|
-
if (content?.status === "failed") {
|
|
55
|
-
return h(A2UIRecoveryFailure, { content, debugExposure });
|
|
56
|
-
}
|
|
57
|
-
if (content?.status === "retrying") {
|
|
58
|
-
return h(A2UIRetryingState, {
|
|
59
|
-
content,
|
|
60
|
-
showAfterMs,
|
|
61
|
-
showAfterAttempts,
|
|
62
|
-
debugExposure,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
// "building" / default: a host-supplied loader wins; else the skeleton.
|
|
66
|
-
if (options.loadingComponent) {
|
|
67
|
-
return h(options.loadingComponent as any);
|
|
68
|
-
}
|
|
69
|
-
return h(A2UIBuildingState, { content });
|
|
70
|
-
};
|
|
54
|
+
const loadingComponent = isComponent(options.loadingComponent)
|
|
55
|
+
? options.loadingComponent
|
|
56
|
+
: undefined;
|
|
71
57
|
|
|
72
58
|
return {
|
|
73
|
-
activityType:
|
|
74
|
-
content:
|
|
59
|
+
activityType: ɵA2UI_SURFACE_ACTIVITY_TYPE,
|
|
60
|
+
content: ɵA2UI_SURFACE_CONTENT_SCHEMA,
|
|
75
61
|
render: defineComponent({
|
|
76
62
|
name: "A2UIMessageRendererHost",
|
|
77
63
|
props: {
|
|
78
64
|
activityType: { type: String, required: true },
|
|
79
|
-
content: {
|
|
80
|
-
|
|
65
|
+
content: {
|
|
66
|
+
type: Object as PropType<ɵA2UISurfaceContent>,
|
|
67
|
+
required: true,
|
|
68
|
+
},
|
|
69
|
+
message: { type: Object as PropType<ActivityMessage>, required: true },
|
|
81
70
|
agent: {
|
|
82
|
-
type: Object as PropType
|
|
71
|
+
type: Object as PropType<ɵA2UIActionAgent>,
|
|
83
72
|
required: false,
|
|
84
73
|
default: undefined,
|
|
85
74
|
},
|
|
86
75
|
},
|
|
87
76
|
setup(props) {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
77
|
+
const controller = new ɵA2UIActivityController({
|
|
78
|
+
recovery: options.recovery,
|
|
79
|
+
warn:
|
|
80
|
+
process.env.NODE_ENV !== "production"
|
|
81
|
+
? (message) => console.warn(message)
|
|
82
|
+
: undefined,
|
|
83
|
+
});
|
|
84
|
+
const snapshot = shallowRef(controller.getSnapshot());
|
|
85
|
+
const unsubscribe = controller.subscribe(() => {
|
|
86
|
+
snapshot.value = controller.getSnapshot();
|
|
87
|
+
});
|
|
88
|
+
watch(
|
|
89
|
+
() => props.content,
|
|
90
|
+
(content) => controller.setContent(content),
|
|
91
|
+
{ immediate: true },
|
|
92
92
|
);
|
|
93
|
+
onBeforeUnmount(() => {
|
|
94
|
+
unsubscribe();
|
|
95
|
+
controller.dispose();
|
|
96
|
+
});
|
|
97
|
+
const markRendered = () => controller.markRendered();
|
|
93
98
|
|
|
94
99
|
return () => {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (operations.value.length === 0) {
|
|
99
|
-
return renderLifecycle(props.content);
|
|
100
|
+
const current = snapshot.value;
|
|
101
|
+
if (current.view === "lifecycle") {
|
|
102
|
+
return renderA2UILifecycleState(current, loadingComponent);
|
|
100
103
|
}
|
|
101
104
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
const handingOff = current.view === "handoff";
|
|
106
|
+
return h("div", { style: { position: "relative" } }, [
|
|
107
|
+
// The surface stays mounted in the same place across the
|
|
108
|
+
// hand-off; only its wrapper styling changes, so what painted
|
|
109
|
+
// while hidden is kept.
|
|
110
|
+
h(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
"aria-hidden": handingOff ? "true" : undefined,
|
|
114
|
+
style: handingOff
|
|
115
|
+
? {
|
|
116
|
+
position: "absolute",
|
|
117
|
+
inset: "0",
|
|
118
|
+
opacity: 0,
|
|
119
|
+
pointerEvents: "none",
|
|
120
|
+
}
|
|
121
|
+
: undefined,
|
|
122
|
+
},
|
|
123
|
+
[
|
|
124
|
+
h(A2UISurfaceActivityRenderer, {
|
|
125
|
+
activityType: ɵA2UI_SURFACE_ACTIVITY_TYPE,
|
|
126
|
+
content: { operations: current.operations },
|
|
127
|
+
message: props.message,
|
|
128
|
+
agent: props.agent,
|
|
129
|
+
theme: options.theme,
|
|
130
|
+
catalog: options.catalog,
|
|
131
|
+
onAction: options.onAction,
|
|
132
|
+
onRendered: markRendered,
|
|
133
|
+
}),
|
|
134
|
+
],
|
|
135
|
+
),
|
|
136
|
+
handingOff
|
|
137
|
+
? renderA2UILifecycleState(current, loadingComponent)
|
|
138
|
+
: null,
|
|
139
|
+
]);
|
|
110
140
|
};
|
|
111
141
|
},
|
|
112
142
|
}),
|