stream-chat-react-native-core 9.12.1 → 9.13.0
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/a2ui/package.json +6 -0
- package/lib/commonjs/a11y/a11yUtils.js.map +1 -1
- package/lib/commonjs/a11y/hooks/useResolvedModalAccessibilityProps.js.map +1 -1
- package/lib/commonjs/a2ui/A2UIContexts.js +8 -0
- package/lib/commonjs/a2ui/A2UIContexts.js.map +1 -0
- package/lib/commonjs/a2ui/A2UIInstructions.js +49 -0
- package/lib/commonjs/a2ui/A2UIInstructions.js.map +1 -0
- package/lib/commonjs/a2ui/A2UIPlaceholder.js +37 -0
- package/lib/commonjs/a2ui/A2UIPlaceholder.js.map +1 -0
- package/lib/commonjs/a2ui/A2UIRenderer.js +363 -0
- package/lib/commonjs/a2ui/A2UIRenderer.js.map +1 -0
- package/lib/commonjs/a2ui/A2UIStream.js +91 -0
- package/lib/commonjs/a2ui/A2UIStream.js.map +1 -0
- package/lib/commonjs/a2ui/A2UISurface.js +212 -0
- package/lib/commonjs/a2ui/A2UISurface.js.map +1 -0
- package/lib/commonjs/a2ui/basicCatalog.json +1206 -0
- package/lib/commonjs/a2ui/basicFunctions.js +398 -0
- package/lib/commonjs/a2ui/basicFunctions.js.map +1 -0
- package/lib/commonjs/a2ui/catalogDocument.js +80 -0
- package/lib/commonjs/a2ui/catalogDocument.js.map +1 -0
- package/lib/commonjs/a2ui/catalogs.js +105 -0
- package/lib/commonjs/a2ui/catalogs.js.map +1 -0
- package/lib/commonjs/a2ui/components/DateTimeInput.js +445 -0
- package/lib/commonjs/a2ui/components/DateTimeInput.js.map +1 -0
- package/lib/commonjs/a2ui/components/Media.js +316 -0
- package/lib/commonjs/a2ui/components/Media.js.map +1 -0
- package/lib/commonjs/a2ui/components/basicComponents.js +975 -0
- package/lib/commonjs/a2ui/components/basicComponents.js.map +1 -0
- package/lib/commonjs/a2ui/components/iconPaths.js +66 -0
- package/lib/commonjs/a2ui/components/iconPaths.js.map +1 -0
- package/lib/commonjs/a2ui/components/types.js +4 -0
- package/lib/commonjs/a2ui/components/types.js.map +1 -0
- package/lib/commonjs/a2ui/index.js +70 -0
- package/lib/commonjs/a2ui/index.js.map +1 -0
- package/lib/commonjs/a2ui/instructions.js +268 -0
- package/lib/commonjs/a2ui/instructions.js.map +1 -0
- package/lib/commonjs/a2ui/secrets.js +169 -0
- package/lib/commonjs/a2ui/secrets.js.map +1 -0
- package/lib/commonjs/a2ui/useReplyState.js +35 -0
- package/lib/commonjs/a2ui/useReplyState.js.map +1 -0
- package/lib/commonjs/ai-components/AITypingIndicatorView.js +8 -18
- package/lib/commonjs/ai-components/AITypingIndicatorView.js.map +1 -1
- package/lib/commonjs/ai-components/README.md +55 -3
- package/lib/commonjs/ai-components/StreamingMessageView.js +26 -0
- package/lib/commonjs/ai-components/StreamingMessageView.js.map +1 -1
- package/lib/commonjs/ai-components/charts/components/PieLegend.js +2 -1
- package/lib/commonjs/ai-components/charts/components/PieLegend.js.map +1 -1
- package/lib/commonjs/ai-components/charts/components/VictoryChart.js +7 -2
- package/lib/commonjs/ai-components/charts/components/VictoryChart.js.map +1 -1
- package/lib/commonjs/ai-components/charts/utils/format-time-label.js +15 -0
- package/lib/commonjs/ai-components/charts/utils/format-time-label.js.map +1 -0
- package/lib/commonjs/ai-components/charts/vega-lite/schema.js +17 -2
- package/lib/commonjs/ai-components/charts/vega-lite/schema.js.map +1 -1
- package/lib/commonjs/ai-components/contexts/composer-context.js +13 -6
- package/lib/commonjs/ai-components/contexts/composer-context.js.map +1 -1
- package/lib/commonjs/ai-components/contexts/index.js +11 -0
- package/lib/commonjs/ai-components/contexts/index.js.map +1 -1
- package/lib/commonjs/ai-components/contexts/theme-context.js +33 -2
- package/lib/commonjs/ai-components/contexts/theme-context.js.map +1 -1
- package/lib/commonjs/ai-components/contexts/translation-context.js +29 -0
- package/lib/commonjs/ai-components/contexts/translation-context.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/AIConversation.js +366 -0
- package/lib/commonjs/ai-components/conversation/AIConversation.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/AIAgentError.js +13 -0
- package/lib/commonjs/ai-components/conversation/controller/AIAgentError.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/AIConversationController.js +425 -0
- package/lib/commonjs/ai-components/conversation/controller/AIConversationController.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/AIConversationExchange.js +89 -0
- package/lib/commonjs/ai-components/conversation/controller/AIConversationExchange.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/index.js +48 -0
- package/lib/commonjs/ai-components/conversation/controller/index.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/offers.js +29 -0
- package/lib/commonjs/ai-components/conversation/controller/offers.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/types.js +13 -0
- package/lib/commonjs/ai-components/conversation/controller/types.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/useAIConversationState.js +8 -0
- package/lib/commonjs/ai-components/conversation/controller/useAIConversationState.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/entries.js +98 -0
- package/lib/commonjs/ai-components/conversation/entries.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/fromStreamMessage.js +66 -0
- package/lib/commonjs/ai-components/conversation/fromStreamMessage.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/index.js +48 -0
- package/lib/commonjs/ai-components/conversation/index.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/AIChatList.js +224 -0
- package/lib/commonjs/ai-components/conversation/list/AIChatList.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/useChatListController.js +78 -0
- package/lib/commonjs/ai-components/conversation/list/useChatListController.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/useEndInView.js +51 -0
- package/lib/commonjs/ai-components/conversation/list/useEndInView.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/useKeyboardOverlap.js +54 -0
- package/lib/commonjs/ai-components/conversation/list/useKeyboardOverlap.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/useLoadOlder.js +73 -0
- package/lib/commonjs/ai-components/conversation/list/useLoadOlder.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/usePinnedAnchor.js +84 -0
- package/lib/commonjs/ai-components/conversation/list/usePinnedAnchor.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/types.js +4 -0
- package/lib/commonjs/ai-components/conversation/types.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/useConversationRows.js +117 -0
- package/lib/commonjs/ai-components/conversation/useConversationRows.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIAction.js +30 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIAction.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIArguments.js +128 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIArguments.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIComponent.js +50 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIComponent.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIComponentDefinition.js +134 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIComponentDefinition.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIDocument.js +32 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIDocument.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIEntrance.js +193 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIEntrance.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIErrorBoundary.js +30 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIErrorBoundary.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIHelpers.js +54 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIHelpers.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIHost.js +259 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIHost.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIMedia.js +24 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIMedia.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIRenderer.js +10 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIRenderer.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIView.js +57 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIView.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/index.js +181 -0
- package/lib/commonjs/ai-components/generative-ui/index.js.map +1 -0
- package/lib/commonjs/ai-components/icons.js +44 -0
- package/lib/commonjs/ai-components/icons.js.map +1 -0
- package/lib/commonjs/ai-components/index.js +96 -0
- package/lib/commonjs/ai-components/index.js.map +1 -1
- package/lib/commonjs/ai-components/internal/Shimmer.js +36 -0
- package/lib/commonjs/ai-components/internal/Shimmer.js.map +1 -0
- package/lib/commonjs/ai-components/internal/format.js +66 -0
- package/lib/commonjs/ai-components/internal/format.js.map +1 -0
- package/lib/commonjs/ai-components/internal/hooks/useBottomSafeArea.js +12 -0
- package/lib/commonjs/ai-components/internal/hooks/useBottomSafeArea.js.map +1 -0
- package/lib/commonjs/ai-components/internal/icons/AgentIcons.js +74 -0
- package/lib/commonjs/ai-components/internal/icons/AgentIcons.js.map +1 -0
- package/lib/commonjs/ai-components/internal/tokens.js +11 -0
- package/lib/commonjs/ai-components/internal/tokens.js.map +1 -0
- package/lib/commonjs/ai-components/internal/uuid.js +21 -0
- package/lib/commonjs/ai-components/internal/uuid.js.map +1 -0
- package/lib/commonjs/ai-components/markdown/components/CodeBlock.js +4 -2
- package/lib/commonjs/ai-components/markdown/components/CodeBlock.js.map +1 -1
- package/lib/commonjs/ai-components/markdown/components/InlineCode.js +1 -0
- package/lib/commonjs/ai-components/markdown/components/InlineCode.js.map +1 -1
- package/lib/commonjs/ai-components/markdown/components/Text.js +11 -2
- package/lib/commonjs/ai-components/markdown/components/Text.js.map +1 -1
- package/lib/commonjs/ai-components/markdown/styles.js +27 -29
- package/lib/commonjs/ai-components/markdown/styles.js.map +1 -1
- package/lib/commonjs/ai-components/message/AIAssistantMessage.js +63 -0
- package/lib/commonjs/ai-components/message/AIAssistantMessage.js.map +1 -0
- package/lib/commonjs/ai-components/message/AIMessageAttachment.js +189 -0
- package/lib/commonjs/ai-components/message/AIMessageAttachment.js.map +1 -0
- package/lib/commonjs/ai-components/message/AIReplyActions.js +132 -0
- package/lib/commonjs/ai-components/message/AIReplyActions.js.map +1 -0
- package/lib/commonjs/ai-components/message/AIUserMessage.js +104 -0
- package/lib/commonjs/ai-components/message/AIUserMessage.js.map +1 -0
- package/lib/commonjs/ai-components/message/UserMessageMenu.js +150 -0
- package/lib/commonjs/ai-components/message/UserMessageMenu.js.map +1 -0
- package/lib/commonjs/ai-components/message/index.js +48 -0
- package/lib/commonjs/ai-components/message/index.js.map +1 -0
- package/lib/commonjs/ai-components/message-composer/ActionButton.js +2 -1
- package/lib/commonjs/ai-components/message-composer/ActionButton.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/ActionSheet.js +22 -6
- package/lib/commonjs/ai-components/message-composer/ActionSheet.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/AttachmentButton.js +5 -1
- package/lib/commonjs/ai-components/message-composer/AttachmentButton.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/ChatOptions.js +147 -0
- package/lib/commonjs/ai-components/message-composer/ChatOptions.js.map +1 -0
- package/lib/commonjs/ai-components/message-composer/ComposerView.js +136 -20
- package/lib/commonjs/ai-components/message-composer/ComposerView.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/EditingMessageChip.js +80 -0
- package/lib/commonjs/ai-components/message-composer/EditingMessageChip.js.map +1 -0
- package/lib/commonjs/ai-components/message-composer/MediaPreviewList.js +26 -1
- package/lib/commonjs/ai-components/message-composer/MediaPreviewList.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/index.js +11 -0
- package/lib/commonjs/ai-components/message-composer/index.js.map +1 -1
- package/lib/commonjs/ai-components/message-parts/AIMessageParts.js +110 -0
- package/lib/commonjs/ai-components/message-parts/AIMessageParts.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/AIToolApproval.js +197 -0
- package/lib/commonjs/ai-components/message-parts/AIToolApproval.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/AIToolAuthorization.js +250 -0
- package/lib/commonjs/ai-components/message-parts/AIToolAuthorization.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/AIToolCall.js +159 -0
- package/lib/commonjs/ai-components/message-parts/AIToolCall.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/callStates.js +54 -0
- package/lib/commonjs/ai-components/message-parts/callStates.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/index.js +70 -0
- package/lib/commonjs/ai-components/message-parts/index.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/parseMessageParts.js +126 -0
- package/lib/commonjs/ai-components/message-parts/parseMessageParts.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/types.js +2 -0
- package/lib/commonjs/ai-components/message-parts/types.js.map +1 -0
- package/lib/commonjs/ai-components/native-specs/NativeAIAgent.js +7 -0
- package/lib/commonjs/ai-components/native-specs/NativeAIAgent.js.map +1 -0
- package/lib/commonjs/ai-components/reasoning/AIReasoning.js +401 -0
- package/lib/commonjs/ai-components/reasoning/AIReasoning.js.map +1 -0
- package/lib/commonjs/ai-components/reasoning/index.js +26 -0
- package/lib/commonjs/ai-components/reasoning/index.js.map +1 -0
- package/lib/commonjs/ai-components/reasoning/thinkingClock.js +63 -0
- package/lib/commonjs/ai-components/reasoning/thinkingClock.js.map +1 -0
- package/lib/commonjs/ai-components/services/clipboard-service/expo.js +7 -2
- package/lib/commonjs/ai-components/services/clipboard-service/expo.js.map +1 -1
- package/lib/commonjs/ai-components/store/composer/store.js.map +1 -1
- package/lib/commonjs/ai-components/store/composer/useComposerChatOption.js +18 -0
- package/lib/commonjs/ai-components/store/composer/useComposerChatOption.js.map +1 -0
- package/lib/commonjs/ai-components/store/composer/useComposerIsEditing.js +18 -0
- package/lib/commonjs/ai-components/store/composer/useComposerIsEditing.js.map +1 -0
- package/lib/commonjs/ai-components/store/index.js +22 -0
- package/lib/commonjs/ai-components/store/index.js.map +1 -1
- package/lib/commonjs/ai-components/suggestions/AISuggestions.js +66 -0
- package/lib/commonjs/ai-components/suggestions/AISuggestions.js.map +1 -0
- package/lib/commonjs/ai-components/suggestions/index.js +15 -0
- package/lib/commonjs/ai-components/suggestions/index.js.map +1 -0
- package/lib/commonjs/ai-components/syntax-highlighting/utils/flatten-nodes.js +2 -1
- package/lib/commonjs/ai-components/syntax-highlighting/utils/flatten-nodes.js.map +1 -1
- package/lib/commonjs/ai-components/syntax-highlighting/utils/renderer.js +3 -2
- package/lib/commonjs/ai-components/syntax-highlighting/utils/renderer.js.map +1 -1
- package/lib/commonjs/ai-components/theme.js +137 -1
- package/lib/commonjs/ai-components/theme.js.map +1 -1
- package/lib/commonjs/ai-components/tool-calls/AIClientIdentity.js +22 -0
- package/lib/commonjs/ai-components/tool-calls/AIClientIdentity.js.map +1 -0
- package/lib/commonjs/ai-components/tool-calls/AIClientToolRunner.js +109 -0
- package/lib/commonjs/ai-components/tool-calls/AIClientToolRunner.js.map +1 -0
- package/lib/commonjs/ai-components/tool-calls/AIToolApprover.js +23 -0
- package/lib/commonjs/ai-components/tool-calls/AIToolApprover.js.map +1 -0
- package/lib/commonjs/ai-components/tool-calls/authSessionAuthorizer.js +88 -0
- package/lib/commonjs/ai-components/tool-calls/authSessionAuthorizer.js.map +1 -0
- package/lib/commonjs/ai-components/tool-calls/index.js +48 -0
- package/lib/commonjs/ai-components/tool-calls/index.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/glowShader.js.map +1 -1
- package/lib/commonjs/components/Accessibility/useAccessibilityAnnouncer.js.map +1 -1
- package/lib/commonjs/components/Message/MessageItemView/utils/renderText.js.map +1 -1
- package/lib/commonjs/contexts/translationContext/TranslationContext.js +2 -2
- package/lib/commonjs/contexts/translationContext/TranslationContext.js.map +1 -1
- package/lib/commonjs/i18n/ar.json +39 -1
- package/lib/commonjs/i18n/en.json +39 -1
- package/lib/commonjs/i18n/es.json +39 -1
- package/lib/commonjs/i18n/fr.json +39 -1
- package/lib/commonjs/i18n/he.json +39 -1
- package/lib/commonjs/i18n/hi.json +39 -1
- package/lib/commonjs/i18n/it.json +39 -1
- package/lib/commonjs/i18n/ja.json +39 -1
- package/lib/commonjs/i18n/ko.json +39 -1
- package/lib/commonjs/i18n/nl.json +39 -1
- package/lib/commonjs/i18n/pt-br.json +39 -1
- package/lib/commonjs/i18n/ru.json +39 -1
- package/lib/commonjs/i18n/tr.json +39 -1
- package/lib/commonjs/mock-builders/a2ui/ohrid.js +84 -0
- package/lib/commonjs/mock-builders/a2ui/ohrid.js.map +1 -0
- package/lib/commonjs/utils/i18n/Streami18n.js +9 -4
- package/lib/commonjs/utils/i18n/Streami18n.js.map +1 -1
- package/lib/commonjs/utils/i18n/utils.js +7 -0
- package/lib/commonjs/utils/i18n/utils.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/a11y/a11yUtils.js.map +1 -1
- package/lib/module/a11y/hooks/useResolvedModalAccessibilityProps.js.map +1 -1
- package/lib/module/a2ui/A2UIContexts.js +8 -0
- package/lib/module/a2ui/A2UIContexts.js.map +1 -0
- package/lib/module/a2ui/A2UIInstructions.js +49 -0
- package/lib/module/a2ui/A2UIInstructions.js.map +1 -0
- package/lib/module/a2ui/A2UIPlaceholder.js +37 -0
- package/lib/module/a2ui/A2UIPlaceholder.js.map +1 -0
- package/lib/module/a2ui/A2UIRenderer.js +363 -0
- package/lib/module/a2ui/A2UIRenderer.js.map +1 -0
- package/lib/module/a2ui/A2UIStream.js +91 -0
- package/lib/module/a2ui/A2UIStream.js.map +1 -0
- package/lib/module/a2ui/A2UISurface.js +212 -0
- package/lib/module/a2ui/A2UISurface.js.map +1 -0
- package/lib/module/a2ui/basicCatalog.json +1206 -0
- package/lib/module/a2ui/basicFunctions.js +398 -0
- package/lib/module/a2ui/basicFunctions.js.map +1 -0
- package/lib/module/a2ui/catalogDocument.js +80 -0
- package/lib/module/a2ui/catalogDocument.js.map +1 -0
- package/lib/module/a2ui/catalogs.js +105 -0
- package/lib/module/a2ui/catalogs.js.map +1 -0
- package/lib/module/a2ui/components/DateTimeInput.js +445 -0
- package/lib/module/a2ui/components/DateTimeInput.js.map +1 -0
- package/lib/module/a2ui/components/Media.js +316 -0
- package/lib/module/a2ui/components/Media.js.map +1 -0
- package/lib/module/a2ui/components/basicComponents.js +975 -0
- package/lib/module/a2ui/components/basicComponents.js.map +1 -0
- package/lib/module/a2ui/components/iconPaths.js +66 -0
- package/lib/module/a2ui/components/iconPaths.js.map +1 -0
- package/lib/module/a2ui/components/types.js +4 -0
- package/lib/module/a2ui/components/types.js.map +1 -0
- package/lib/module/a2ui/index.js +70 -0
- package/lib/module/a2ui/index.js.map +1 -0
- package/lib/module/a2ui/instructions.js +268 -0
- package/lib/module/a2ui/instructions.js.map +1 -0
- package/lib/module/a2ui/secrets.js +169 -0
- package/lib/module/a2ui/secrets.js.map +1 -0
- package/lib/module/a2ui/useReplyState.js +35 -0
- package/lib/module/a2ui/useReplyState.js.map +1 -0
- package/lib/module/ai-components/AITypingIndicatorView.js +8 -18
- package/lib/module/ai-components/AITypingIndicatorView.js.map +1 -1
- package/lib/module/ai-components/README.md +55 -3
- package/lib/module/ai-components/StreamingMessageView.js +26 -0
- package/lib/module/ai-components/StreamingMessageView.js.map +1 -1
- package/lib/module/ai-components/charts/components/PieLegend.js +2 -1
- package/lib/module/ai-components/charts/components/PieLegend.js.map +1 -1
- package/lib/module/ai-components/charts/components/VictoryChart.js +7 -2
- package/lib/module/ai-components/charts/components/VictoryChart.js.map +1 -1
- package/lib/module/ai-components/charts/utils/format-time-label.js +15 -0
- package/lib/module/ai-components/charts/utils/format-time-label.js.map +1 -0
- package/lib/module/ai-components/charts/vega-lite/schema.js +17 -2
- package/lib/module/ai-components/charts/vega-lite/schema.js.map +1 -1
- package/lib/module/ai-components/contexts/composer-context.js +13 -6
- package/lib/module/ai-components/contexts/composer-context.js.map +1 -1
- package/lib/module/ai-components/contexts/index.js +11 -0
- package/lib/module/ai-components/contexts/index.js.map +1 -1
- package/lib/module/ai-components/contexts/theme-context.js +33 -2
- package/lib/module/ai-components/contexts/theme-context.js.map +1 -1
- package/lib/module/ai-components/contexts/translation-context.js +29 -0
- package/lib/module/ai-components/contexts/translation-context.js.map +1 -0
- package/lib/module/ai-components/conversation/AIConversation.js +366 -0
- package/lib/module/ai-components/conversation/AIConversation.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/AIAgentError.js +13 -0
- package/lib/module/ai-components/conversation/controller/AIAgentError.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/AIConversationController.js +425 -0
- package/lib/module/ai-components/conversation/controller/AIConversationController.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/AIConversationExchange.js +89 -0
- package/lib/module/ai-components/conversation/controller/AIConversationExchange.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/index.js +48 -0
- package/lib/module/ai-components/conversation/controller/index.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/offers.js +29 -0
- package/lib/module/ai-components/conversation/controller/offers.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/types.js +13 -0
- package/lib/module/ai-components/conversation/controller/types.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/useAIConversationState.js +8 -0
- package/lib/module/ai-components/conversation/controller/useAIConversationState.js.map +1 -0
- package/lib/module/ai-components/conversation/entries.js +98 -0
- package/lib/module/ai-components/conversation/entries.js.map +1 -0
- package/lib/module/ai-components/conversation/fromStreamMessage.js +66 -0
- package/lib/module/ai-components/conversation/fromStreamMessage.js.map +1 -0
- package/lib/module/ai-components/conversation/index.js +48 -0
- package/lib/module/ai-components/conversation/index.js.map +1 -0
- package/lib/module/ai-components/conversation/list/AIChatList.js +224 -0
- package/lib/module/ai-components/conversation/list/AIChatList.js.map +1 -0
- package/lib/module/ai-components/conversation/list/useChatListController.js +78 -0
- package/lib/module/ai-components/conversation/list/useChatListController.js.map +1 -0
- package/lib/module/ai-components/conversation/list/useEndInView.js +51 -0
- package/lib/module/ai-components/conversation/list/useEndInView.js.map +1 -0
- package/lib/module/ai-components/conversation/list/useKeyboardOverlap.js +54 -0
- package/lib/module/ai-components/conversation/list/useKeyboardOverlap.js.map +1 -0
- package/lib/module/ai-components/conversation/list/useLoadOlder.js +73 -0
- package/lib/module/ai-components/conversation/list/useLoadOlder.js.map +1 -0
- package/lib/module/ai-components/conversation/list/usePinnedAnchor.js +84 -0
- package/lib/module/ai-components/conversation/list/usePinnedAnchor.js.map +1 -0
- package/lib/module/ai-components/conversation/types.js +4 -0
- package/lib/module/ai-components/conversation/types.js.map +1 -0
- package/lib/module/ai-components/conversation/useConversationRows.js +117 -0
- package/lib/module/ai-components/conversation/useConversationRows.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIAction.js +30 -0
- package/lib/module/ai-components/generative-ui/AIUIAction.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIArguments.js +128 -0
- package/lib/module/ai-components/generative-ui/AIUIArguments.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIComponent.js +50 -0
- package/lib/module/ai-components/generative-ui/AIUIComponent.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIComponentDefinition.js +134 -0
- package/lib/module/ai-components/generative-ui/AIUIComponentDefinition.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIDocument.js +32 -0
- package/lib/module/ai-components/generative-ui/AIUIDocument.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIEntrance.js +193 -0
- package/lib/module/ai-components/generative-ui/AIUIEntrance.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIErrorBoundary.js +30 -0
- package/lib/module/ai-components/generative-ui/AIUIErrorBoundary.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIHelpers.js +54 -0
- package/lib/module/ai-components/generative-ui/AIUIHelpers.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIHost.js +259 -0
- package/lib/module/ai-components/generative-ui/AIUIHost.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIMedia.js +24 -0
- package/lib/module/ai-components/generative-ui/AIUIMedia.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIRenderer.js +10 -0
- package/lib/module/ai-components/generative-ui/AIUIRenderer.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIView.js +57 -0
- package/lib/module/ai-components/generative-ui/AIUIView.js.map +1 -0
- package/lib/module/ai-components/generative-ui/index.js +181 -0
- package/lib/module/ai-components/generative-ui/index.js.map +1 -0
- package/lib/module/ai-components/icons.js +44 -0
- package/lib/module/ai-components/icons.js.map +1 -0
- package/lib/module/ai-components/index.js +96 -0
- package/lib/module/ai-components/index.js.map +1 -1
- package/lib/module/ai-components/internal/Shimmer.js +36 -0
- package/lib/module/ai-components/internal/Shimmer.js.map +1 -0
- package/lib/module/ai-components/internal/format.js +66 -0
- package/lib/module/ai-components/internal/format.js.map +1 -0
- package/lib/module/ai-components/internal/hooks/useBottomSafeArea.js +12 -0
- package/lib/module/ai-components/internal/hooks/useBottomSafeArea.js.map +1 -0
- package/lib/module/ai-components/internal/icons/AgentIcons.js +74 -0
- package/lib/module/ai-components/internal/icons/AgentIcons.js.map +1 -0
- package/lib/module/ai-components/internal/tokens.js +11 -0
- package/lib/module/ai-components/internal/tokens.js.map +1 -0
- package/lib/module/ai-components/internal/uuid.js +21 -0
- package/lib/module/ai-components/internal/uuid.js.map +1 -0
- package/lib/module/ai-components/markdown/components/CodeBlock.js +4 -2
- package/lib/module/ai-components/markdown/components/CodeBlock.js.map +1 -1
- package/lib/module/ai-components/markdown/components/InlineCode.js +1 -0
- package/lib/module/ai-components/markdown/components/InlineCode.js.map +1 -1
- package/lib/module/ai-components/markdown/components/Text.js +11 -2
- package/lib/module/ai-components/markdown/components/Text.js.map +1 -1
- package/lib/module/ai-components/markdown/styles.js +27 -29
- package/lib/module/ai-components/markdown/styles.js.map +1 -1
- package/lib/module/ai-components/message/AIAssistantMessage.js +63 -0
- package/lib/module/ai-components/message/AIAssistantMessage.js.map +1 -0
- package/lib/module/ai-components/message/AIMessageAttachment.js +189 -0
- package/lib/module/ai-components/message/AIMessageAttachment.js.map +1 -0
- package/lib/module/ai-components/message/AIReplyActions.js +132 -0
- package/lib/module/ai-components/message/AIReplyActions.js.map +1 -0
- package/lib/module/ai-components/message/AIUserMessage.js +104 -0
- package/lib/module/ai-components/message/AIUserMessage.js.map +1 -0
- package/lib/module/ai-components/message/UserMessageMenu.js +150 -0
- package/lib/module/ai-components/message/UserMessageMenu.js.map +1 -0
- package/lib/module/ai-components/message/index.js +48 -0
- package/lib/module/ai-components/message/index.js.map +1 -0
- package/lib/module/ai-components/message-composer/ActionButton.js +2 -1
- package/lib/module/ai-components/message-composer/ActionButton.js.map +1 -1
- package/lib/module/ai-components/message-composer/ActionSheet.js +22 -6
- package/lib/module/ai-components/message-composer/ActionSheet.js.map +1 -1
- package/lib/module/ai-components/message-composer/AttachmentButton.js +5 -1
- package/lib/module/ai-components/message-composer/AttachmentButton.js.map +1 -1
- package/lib/module/ai-components/message-composer/ChatOptions.js +147 -0
- package/lib/module/ai-components/message-composer/ChatOptions.js.map +1 -0
- package/lib/module/ai-components/message-composer/ComposerView.js +136 -20
- package/lib/module/ai-components/message-composer/ComposerView.js.map +1 -1
- package/lib/module/ai-components/message-composer/EditingMessageChip.js +80 -0
- package/lib/module/ai-components/message-composer/EditingMessageChip.js.map +1 -0
- package/lib/module/ai-components/message-composer/MediaPreviewList.js +26 -1
- package/lib/module/ai-components/message-composer/MediaPreviewList.js.map +1 -1
- package/lib/module/ai-components/message-composer/index.js +11 -0
- package/lib/module/ai-components/message-composer/index.js.map +1 -1
- package/lib/module/ai-components/message-parts/AIMessageParts.js +110 -0
- package/lib/module/ai-components/message-parts/AIMessageParts.js.map +1 -0
- package/lib/module/ai-components/message-parts/AIToolApproval.js +197 -0
- package/lib/module/ai-components/message-parts/AIToolApproval.js.map +1 -0
- package/lib/module/ai-components/message-parts/AIToolAuthorization.js +250 -0
- package/lib/module/ai-components/message-parts/AIToolAuthorization.js.map +1 -0
- package/lib/module/ai-components/message-parts/AIToolCall.js +159 -0
- package/lib/module/ai-components/message-parts/AIToolCall.js.map +1 -0
- package/lib/module/ai-components/message-parts/callStates.js +54 -0
- package/lib/module/ai-components/message-parts/callStates.js.map +1 -0
- package/lib/module/ai-components/message-parts/index.js +70 -0
- package/lib/module/ai-components/message-parts/index.js.map +1 -0
- package/lib/module/ai-components/message-parts/parseMessageParts.js +126 -0
- package/lib/module/ai-components/message-parts/parseMessageParts.js.map +1 -0
- package/lib/module/ai-components/message-parts/types.js +2 -0
- package/lib/module/ai-components/message-parts/types.js.map +1 -0
- package/lib/module/ai-components/native-specs/NativeAIAgent.js +7 -0
- package/lib/module/ai-components/native-specs/NativeAIAgent.js.map +1 -0
- package/lib/module/ai-components/reasoning/AIReasoning.js +401 -0
- package/lib/module/ai-components/reasoning/AIReasoning.js.map +1 -0
- package/lib/module/ai-components/reasoning/index.js +26 -0
- package/lib/module/ai-components/reasoning/index.js.map +1 -0
- package/lib/module/ai-components/reasoning/thinkingClock.js +63 -0
- package/lib/module/ai-components/reasoning/thinkingClock.js.map +1 -0
- package/lib/module/ai-components/services/clipboard-service/expo.js +7 -2
- package/lib/module/ai-components/services/clipboard-service/expo.js.map +1 -1
- package/lib/module/ai-components/store/composer/store.js.map +1 -1
- package/lib/module/ai-components/store/composer/useComposerChatOption.js +18 -0
- package/lib/module/ai-components/store/composer/useComposerChatOption.js.map +1 -0
- package/lib/module/ai-components/store/composer/useComposerIsEditing.js +18 -0
- package/lib/module/ai-components/store/composer/useComposerIsEditing.js.map +1 -0
- package/lib/module/ai-components/store/index.js +22 -0
- package/lib/module/ai-components/store/index.js.map +1 -1
- package/lib/module/ai-components/suggestions/AISuggestions.js +66 -0
- package/lib/module/ai-components/suggestions/AISuggestions.js.map +1 -0
- package/lib/module/ai-components/suggestions/index.js +15 -0
- package/lib/module/ai-components/suggestions/index.js.map +1 -0
- package/lib/module/ai-components/syntax-highlighting/utils/flatten-nodes.js +2 -1
- package/lib/module/ai-components/syntax-highlighting/utils/flatten-nodes.js.map +1 -1
- package/lib/module/ai-components/syntax-highlighting/utils/renderer.js +3 -2
- package/lib/module/ai-components/syntax-highlighting/utils/renderer.js.map +1 -1
- package/lib/module/ai-components/theme.js +137 -1
- package/lib/module/ai-components/theme.js.map +1 -1
- package/lib/module/ai-components/tool-calls/AIClientIdentity.js +22 -0
- package/lib/module/ai-components/tool-calls/AIClientIdentity.js.map +1 -0
- package/lib/module/ai-components/tool-calls/AIClientToolRunner.js +109 -0
- package/lib/module/ai-components/tool-calls/AIClientToolRunner.js.map +1 -0
- package/lib/module/ai-components/tool-calls/AIToolApprover.js +23 -0
- package/lib/module/ai-components/tool-calls/AIToolApprover.js.map +1 -0
- package/lib/module/ai-components/tool-calls/authSessionAuthorizer.js +88 -0
- package/lib/module/ai-components/tool-calls/authSessionAuthorizer.js.map +1 -0
- package/lib/module/ai-components/tool-calls/index.js +48 -0
- package/lib/module/ai-components/tool-calls/index.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/glowShader.js.map +1 -1
- package/lib/module/components/Accessibility/useAccessibilityAnnouncer.js.map +1 -1
- package/lib/module/components/Message/MessageItemView/utils/renderText.js.map +1 -1
- package/lib/module/contexts/translationContext/TranslationContext.js +2 -2
- package/lib/module/contexts/translationContext/TranslationContext.js.map +1 -1
- package/lib/module/i18n/ar.json +39 -1
- package/lib/module/i18n/en.json +39 -1
- package/lib/module/i18n/es.json +39 -1
- package/lib/module/i18n/fr.json +39 -1
- package/lib/module/i18n/he.json +39 -1
- package/lib/module/i18n/hi.json +39 -1
- package/lib/module/i18n/it.json +39 -1
- package/lib/module/i18n/ja.json +39 -1
- package/lib/module/i18n/ko.json +39 -1
- package/lib/module/i18n/nl.json +39 -1
- package/lib/module/i18n/pt-br.json +39 -1
- package/lib/module/i18n/ru.json +39 -1
- package/lib/module/i18n/tr.json +39 -1
- package/lib/module/mock-builders/a2ui/ohrid.js +84 -0
- package/lib/module/mock-builders/a2ui/ohrid.js.map +1 -0
- package/lib/module/utils/i18n/Streami18n.js +9 -4
- package/lib/module/utils/i18n/Streami18n.js.map +1 -1
- package/lib/module/utils/i18n/utils.js +7 -0
- package/lib/module/utils/i18n/utils.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/a11y/a11yUtils.d.ts +0 -1
- package/lib/typescript/a11y/a11yUtils.d.ts.map +1 -1
- package/lib/typescript/a11y/hooks/useResolvedModalAccessibilityProps.d.ts +2 -3
- package/lib/typescript/a11y/hooks/useResolvedModalAccessibilityProps.d.ts.map +1 -1
- package/lib/typescript/a2ui/A2UIContexts.d.ts +9 -0
- package/lib/typescript/a2ui/A2UIContexts.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UIInstructions.d.ts +47 -0
- package/lib/typescript/a2ui/A2UIInstructions.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UIPlaceholder.d.ts +4 -0
- package/lib/typescript/a2ui/A2UIPlaceholder.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UIRenderer.d.ts +130 -0
- package/lib/typescript/a2ui/A2UIRenderer.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UIStream.d.ts +23 -0
- package/lib/typescript/a2ui/A2UIStream.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UISurface.d.ts +19 -0
- package/lib/typescript/a2ui/A2UISurface.d.ts.map +1 -0
- package/lib/typescript/a2ui/basicFunctions.d.ts +10 -0
- package/lib/typescript/a2ui/basicFunctions.d.ts.map +1 -0
- package/lib/typescript/a2ui/catalogDocument.d.ts +56 -0
- package/lib/typescript/a2ui/catalogDocument.d.ts.map +1 -0
- package/lib/typescript/a2ui/catalogs.d.ts +42 -0
- package/lib/typescript/a2ui/catalogs.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/DateTimeInput.d.ts +44 -0
- package/lib/typescript/a2ui/components/DateTimeInput.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/Media.d.ts +27 -0
- package/lib/typescript/a2ui/components/Media.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/basicComponents.d.ts +4 -0
- package/lib/typescript/a2ui/components/basicComponents.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/iconPaths.d.ts +2 -0
- package/lib/typescript/a2ui/components/iconPaths.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/types.d.ts +23 -0
- package/lib/typescript/a2ui/components/types.d.ts.map +1 -0
- package/lib/typescript/a2ui/index.d.ts +8 -0
- package/lib/typescript/a2ui/index.d.ts.map +1 -0
- package/lib/typescript/a2ui/instructions.d.ts +39 -0
- package/lib/typescript/a2ui/instructions.d.ts.map +1 -0
- package/lib/typescript/a2ui/secrets.d.ts +20 -0
- package/lib/typescript/a2ui/secrets.d.ts.map +1 -0
- package/lib/typescript/a2ui/useReplyState.d.ts +4 -0
- package/lib/typescript/a2ui/useReplyState.d.ts.map +1 -0
- package/lib/typescript/ai-components/AITypingIndicatorView.d.ts.map +1 -1
- package/lib/typescript/ai-components/StreamingMessageView.d.ts +4 -1
- package/lib/typescript/ai-components/StreamingMessageView.d.ts.map +1 -1
- package/lib/typescript/ai-components/charts/components/PieLegend.d.ts.map +1 -1
- package/lib/typescript/ai-components/charts/components/VictoryChart.d.ts.map +1 -1
- package/lib/typescript/ai-components/charts/utils/format-time-label.d.ts +7 -0
- package/lib/typescript/ai-components/charts/utils/format-time-label.d.ts.map +1 -0
- package/lib/typescript/ai-components/charts/vega-lite/schema.d.ts +8 -8
- package/lib/typescript/ai-components/charts/vega-lite/schema.d.ts.map +1 -1
- package/lib/typescript/ai-components/contexts/composer-context.d.ts +3 -0
- package/lib/typescript/ai-components/contexts/composer-context.d.ts.map +1 -1
- package/lib/typescript/ai-components/contexts/index.d.ts +1 -0
- package/lib/typescript/ai-components/contexts/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/contexts/theme-context.d.ts.map +1 -1
- package/lib/typescript/ai-components/contexts/translation-context.d.ts +19 -0
- package/lib/typescript/ai-components/contexts/translation-context.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/AIConversation.d.ts +130 -0
- package/lib/typescript/ai-components/conversation/AIConversation.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/AIAgentError.d.ts +10 -0
- package/lib/typescript/ai-components/conversation/controller/AIAgentError.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/AIConversationController.d.ts +173 -0
- package/lib/typescript/ai-components/conversation/controller/AIConversationController.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/AIConversationExchange.d.ts +23 -0
- package/lib/typescript/ai-components/conversation/controller/AIConversationExchange.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/index.d.ts +5 -0
- package/lib/typescript/ai-components/conversation/controller/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/offers.d.ts +23 -0
- package/lib/typescript/ai-components/conversation/controller/offers.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/types.d.ts +142 -0
- package/lib/typescript/ai-components/conversation/controller/types.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/useAIConversationState.d.ts +9 -0
- package/lib/typescript/ai-components/conversation/controller/useAIConversationState.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/entries.d.ts +47 -0
- package/lib/typescript/ai-components/conversation/entries.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/fromStreamMessage.d.ts +25 -0
- package/lib/typescript/ai-components/conversation/fromStreamMessage.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/index.d.ts +6 -0
- package/lib/typescript/ai-components/conversation/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/AIChatList.d.ts +30 -0
- package/lib/typescript/ai-components/conversation/list/AIChatList.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/useChatListController.d.ts +45 -0
- package/lib/typescript/ai-components/conversation/list/useChatListController.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/useEndInView.d.ts +26 -0
- package/lib/typescript/ai-components/conversation/list/useEndInView.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/useKeyboardOverlap.d.ts +17 -0
- package/lib/typescript/ai-components/conversation/list/useKeyboardOverlap.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/useLoadOlder.d.ts +24 -0
- package/lib/typescript/ai-components/conversation/list/useLoadOlder.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/usePinnedAnchor.d.ts +26 -0
- package/lib/typescript/ai-components/conversation/list/usePinnedAnchor.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/types.d.ts +55 -0
- package/lib/typescript/ai-components/conversation/types.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/useConversationRows.d.ts +66 -0
- package/lib/typescript/ai-components/conversation/useConversationRows.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIAction.d.ts +48 -0
- package/lib/typescript/ai-components/generative-ui/AIUIAction.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIArguments.d.ts +15 -0
- package/lib/typescript/ai-components/generative-ui/AIUIArguments.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIComponent.d.ts +51 -0
- package/lib/typescript/ai-components/generative-ui/AIUIComponent.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIComponentDefinition.d.ts +84 -0
- package/lib/typescript/ai-components/generative-ui/AIUIComponentDefinition.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIDocument.d.ts +50 -0
- package/lib/typescript/ai-components/generative-ui/AIUIDocument.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIEntrance.d.ts +75 -0
- package/lib/typescript/ai-components/generative-ui/AIUIEntrance.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIErrorBoundary.d.ts +26 -0
- package/lib/typescript/ai-components/generative-ui/AIUIErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIHelpers.d.ts +23 -0
- package/lib/typescript/ai-components/generative-ui/AIUIHelpers.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIHost.d.ts +160 -0
- package/lib/typescript/ai-components/generative-ui/AIUIHost.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIMedia.d.ts +22 -0
- package/lib/typescript/ai-components/generative-ui/AIUIMedia.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIRenderer.d.ts +53 -0
- package/lib/typescript/ai-components/generative-ui/AIUIRenderer.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIView.d.ts +35 -0
- package/lib/typescript/ai-components/generative-ui/AIUIView.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/index.d.ts +11 -0
- package/lib/typescript/ai-components/generative-ui/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/icons.d.ts +66 -0
- package/lib/typescript/ai-components/icons.d.ts.map +1 -0
- package/lib/typescript/ai-components/index.d.ts +8 -0
- package/lib/typescript/ai-components/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/internal/Shimmer.d.ts +14 -0
- package/lib/typescript/ai-components/internal/Shimmer.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/format.d.ts +7 -0
- package/lib/typescript/ai-components/internal/format.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/hooks/useBottomSafeArea.d.ts +3 -0
- package/lib/typescript/ai-components/internal/hooks/useBottomSafeArea.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/icons/AgentIcons.d.ts +31 -0
- package/lib/typescript/ai-components/internal/icons/AgentIcons.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/tokens.d.ts +2 -0
- package/lib/typescript/ai-components/internal/tokens.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/uuid.d.ts +2 -0
- package/lib/typescript/ai-components/internal/uuid.d.ts.map +1 -0
- package/lib/typescript/ai-components/markdown/components/CodeBlock.d.ts.map +1 -1
- package/lib/typescript/ai-components/markdown/components/InlineCode.d.ts.map +1 -1
- package/lib/typescript/ai-components/markdown/components/Text.d.ts.map +1 -1
- package/lib/typescript/ai-components/markdown/styles.d.ts +23 -4
- package/lib/typescript/ai-components/markdown/styles.d.ts.map +1 -1
- package/lib/typescript/ai-components/markdown/types.d.ts +1 -0
- package/lib/typescript/ai-components/markdown/types.d.ts.map +1 -1
- package/lib/typescript/ai-components/message/AIAssistantMessage.d.ts +40 -0
- package/lib/typescript/ai-components/message/AIAssistantMessage.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/AIMessageAttachment.d.ts +33 -0
- package/lib/typescript/ai-components/message/AIMessageAttachment.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/AIReplyActions.d.ts +19 -0
- package/lib/typescript/ai-components/message/AIReplyActions.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/AIUserMessage.d.ts +17 -0
- package/lib/typescript/ai-components/message/AIUserMessage.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/UserMessageMenu.d.ts +31 -0
- package/lib/typescript/ai-components/message/UserMessageMenu.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/index.d.ts +5 -0
- package/lib/typescript/ai-components/message/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-composer/ActionButton.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/ActionSheet.d.ts +2 -2
- package/lib/typescript/ai-components/message-composer/ActionSheet.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/AttachmentButton.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/ChatOptions.d.ts +35 -0
- package/lib/typescript/ai-components/message-composer/ChatOptions.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-composer/ComposerView.d.ts +34 -3
- package/lib/typescript/ai-components/message-composer/ComposerView.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/EditingMessageChip.d.ts +7 -0
- package/lib/typescript/ai-components/message-composer/EditingMessageChip.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-composer/MediaPreviewList.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/index.d.ts +1 -0
- package/lib/typescript/ai-components/message-composer/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-parts/AIMessageParts.d.ts +38 -0
- package/lib/typescript/ai-components/message-parts/AIMessageParts.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/AIToolApproval.d.ts +38 -0
- package/lib/typescript/ai-components/message-parts/AIToolApproval.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/AIToolAuthorization.d.ts +48 -0
- package/lib/typescript/ai-components/message-parts/AIToolAuthorization.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/AIToolCall.d.ts +11 -0
- package/lib/typescript/ai-components/message-parts/AIToolCall.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/callStates.d.ts +9 -0
- package/lib/typescript/ai-components/message-parts/callStates.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/index.d.ts +7 -0
- package/lib/typescript/ai-components/message-parts/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/parseMessageParts.d.ts +47 -0
- package/lib/typescript/ai-components/message-parts/parseMessageParts.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/types.d.ts +137 -0
- package/lib/typescript/ai-components/message-parts/types.d.ts.map +1 -0
- package/lib/typescript/ai-components/native-specs/NativeAIAgent.d.ts +22 -0
- package/lib/typescript/ai-components/native-specs/NativeAIAgent.d.ts.map +1 -0
- package/lib/typescript/ai-components/reasoning/AIReasoning.d.ts +63 -0
- package/lib/typescript/ai-components/reasoning/AIReasoning.d.ts.map +1 -0
- package/lib/typescript/ai-components/reasoning/index.d.ts +3 -0
- package/lib/typescript/ai-components/reasoning/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/reasoning/thinkingClock.d.ts +29 -0
- package/lib/typescript/ai-components/reasoning/thinkingClock.d.ts.map +1 -0
- package/lib/typescript/ai-components/services/clipboard-service/expo.d.ts.map +1 -1
- package/lib/typescript/ai-components/store/composer/store.d.ts +8 -0
- package/lib/typescript/ai-components/store/composer/store.d.ts.map +1 -1
- package/lib/typescript/ai-components/store/composer/useComposerChatOption.d.ts +5 -0
- package/lib/typescript/ai-components/store/composer/useComposerChatOption.d.ts.map +1 -0
- package/lib/typescript/ai-components/store/composer/useComposerIsEditing.d.ts +5 -0
- package/lib/typescript/ai-components/store/composer/useComposerIsEditing.d.ts.map +1 -0
- package/lib/typescript/ai-components/store/index.d.ts +2 -0
- package/lib/typescript/ai-components/store/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/suggestions/AISuggestions.d.ts +13 -0
- package/lib/typescript/ai-components/suggestions/AISuggestions.d.ts.map +1 -0
- package/lib/typescript/ai-components/suggestions/index.d.ts +2 -0
- package/lib/typescript/ai-components/suggestions/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/syntax-highlighting/utils/flatten-nodes.d.ts.map +1 -1
- package/lib/typescript/ai-components/syntax-highlighting/utils/renderer.d.ts +1 -1
- package/lib/typescript/ai-components/syntax-highlighting/utils/renderer.d.ts.map +1 -1
- package/lib/typescript/ai-components/theme.d.ts +200 -0
- package/lib/typescript/ai-components/theme.d.ts.map +1 -1
- package/lib/typescript/ai-components/tool-calls/AIClientIdentity.d.ts +14 -0
- package/lib/typescript/ai-components/tool-calls/AIClientIdentity.d.ts.map +1 -0
- package/lib/typescript/ai-components/tool-calls/AIClientToolRunner.d.ts +109 -0
- package/lib/typescript/ai-components/tool-calls/AIClientToolRunner.d.ts.map +1 -0
- package/lib/typescript/ai-components/tool-calls/AIToolApprover.d.ts +48 -0
- package/lib/typescript/ai-components/tool-calls/AIToolApprover.d.ts.map +1 -0
- package/lib/typescript/ai-components/tool-calls/authSessionAuthorizer.d.ts +57 -0
- package/lib/typescript/ai-components/tool-calls/authSessionAuthorizer.d.ts.map +1 -0
- package/lib/typescript/ai-components/tool-calls/index.d.ts +5 -0
- package/lib/typescript/ai-components/tool-calls/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/glowShader.d.ts.map +1 -1
- package/lib/typescript/ai-components/voice-visualization/simplex.d.ts +1 -1
- package/lib/typescript/components/Accessibility/NotificationAnnouncer.d.ts +5 -5
- package/lib/typescript/components/Accessibility/hooks/useIncomingMessageAnnouncements.d.ts +1 -1
- package/lib/typescript/components/Accessibility/useAccessibilityAnnouncer.d.ts +0 -2
- package/lib/typescript/components/Accessibility/useAccessibilityAnnouncer.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageItemView/utils/renderText.d.ts.map +1 -1
- package/lib/typescript/contexts/translationContext/TranslationContext.d.ts +1 -1
- package/lib/typescript/contexts/translationContext/TranslationContext.d.ts.map +1 -1
- package/lib/typescript/i18n/ar.json +39 -1
- package/lib/typescript/i18n/en.json +39 -1
- package/lib/typescript/i18n/es.json +39 -1
- package/lib/typescript/i18n/fr.json +39 -1
- package/lib/typescript/i18n/he.json +39 -1
- package/lib/typescript/i18n/hi.json +39 -1
- package/lib/typescript/i18n/it.json +39 -1
- package/lib/typescript/i18n/ja.json +39 -1
- package/lib/typescript/i18n/ko.json +39 -1
- package/lib/typescript/i18n/nl.json +39 -1
- package/lib/typescript/i18n/pt-br.json +39 -1
- package/lib/typescript/i18n/ru.json +39 -1
- package/lib/typescript/i18n/tr.json +39 -1
- package/lib/typescript/utils/i18n/Streami18n.d.ts +40 -2
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/lib/typescript/utils/i18n/utils.d.ts +3 -0
- package/lib/typescript/utils/i18n/utils.d.ts.map +1 -0
- package/package.json +10 -2
- package/src/a11y/a11yUtils.ts +0 -1
- package/src/a11y/hooks/useResolvedModalAccessibilityProps.ts +2 -3
- package/src/a2ui/A2UIContexts.ts +15 -0
- package/src/a2ui/A2UIInstructions.ts +102 -0
- package/src/a2ui/A2UIPlaceholder.tsx +24 -0
- package/src/a2ui/A2UIRenderer.tsx +504 -0
- package/src/a2ui/A2UIStream.ts +105 -0
- package/src/a2ui/A2UISurface.tsx +241 -0
- package/src/a2ui/__tests__/A2UIInstructions.test.ts +233 -0
- package/src/a2ui/__tests__/A2UIRenderer.test.tsx +1514 -0
- package/src/a2ui/__tests__/conformance.test.ts +579 -0
- package/src/a2ui/basicCatalog.json +1206 -0
- package/src/a2ui/basicFunctions.ts +429 -0
- package/src/a2ui/catalogDocument.ts +119 -0
- package/src/a2ui/catalogs.ts +185 -0
- package/src/a2ui/components/DateTimeInput.tsx +381 -0
- package/src/a2ui/components/Media.tsx +278 -0
- package/src/a2ui/components/basicComponents.tsx +832 -0
- package/src/a2ui/components/iconPaths.ts +116 -0
- package/src/a2ui/components/types.ts +24 -0
- package/src/a2ui/index.ts +18 -0
- package/src/a2ui/instructions.ts +341 -0
- package/src/a2ui/secrets.ts +154 -0
- package/src/a2ui/useReplyState.ts +26 -0
- package/src/ai-components/AITypingIndicatorView.tsx +6 -22
- package/src/ai-components/README.md +55 -3
- package/src/ai-components/StreamingMessageView.tsx +27 -3
- package/src/ai-components/__tests__/ComposerView.test.tsx +227 -2
- package/src/ai-components/__tests__/Markdown.test.tsx +13 -0
- package/src/ai-components/__tests__/StreamingMessageView.test.tsx +69 -0
- package/src/ai-components/__tests__/charts.test.ts +75 -0
- package/src/ai-components/__tests__/clientToolRunner.test.ts +239 -0
- package/src/ai-components/__tests__/conversation.test.tsx +705 -0
- package/src/ai-components/__tests__/conversationController.test.ts +1561 -0
- package/src/ai-components/__tests__/conversationExchange.test.ts +187 -0
- package/src/ai-components/__tests__/conversationRows.test.ts +207 -0
- package/src/ai-components/__tests__/conversationUI.test.tsx +586 -0
- package/src/ai-components/__tests__/format.test.ts +32 -0
- package/src/ai-components/__tests__/generativeUI.test.ts +634 -0
- package/src/ai-components/__tests__/keyboard.test.ts +14 -0
- package/src/ai-components/__tests__/messagePartViews.test.tsx +343 -0
- package/src/ai-components/__tests__/messageParts.test.ts +336 -0
- package/src/ai-components/__tests__/messageViews.test.tsx +321 -0
- package/src/ai-components/__tests__/signIn.test.tsx +324 -0
- package/src/ai-components/__tests__/theme.test.tsx +18 -0
- package/src/ai-components/__tests__/translation.test.tsx +85 -0
- package/src/ai-components/__tests__/voiceDriver.test.ts +0 -3
- package/src/ai-components/__tests__/voicePalette.test.ts +1 -1
- package/src/ai-components/charts/components/PieLegend.tsx +2 -1
- package/src/ai-components/charts/components/VictoryChart.tsx +10 -2
- package/src/ai-components/charts/utils/format-time-label.ts +18 -0
- package/src/ai-components/charts/vega-lite/schema.ts +19 -2
- package/src/ai-components/contexts/composer-context.tsx +13 -5
- package/src/ai-components/contexts/index.ts +1 -0
- package/src/ai-components/contexts/theme-context.tsx +19 -4
- package/src/ai-components/contexts/translation-context.tsx +44 -0
- package/src/ai-components/conversation/AIConversation.tsx +590 -0
- package/src/ai-components/conversation/controller/AIAgentError.ts +14 -0
- package/src/ai-components/conversation/controller/AIConversationController.ts +623 -0
- package/src/ai-components/conversation/controller/AIConversationExchange.ts +132 -0
- package/src/ai-components/conversation/controller/index.ts +4 -0
- package/src/ai-components/conversation/controller/offers.ts +43 -0
- package/src/ai-components/conversation/controller/types.ts +154 -0
- package/src/ai-components/conversation/controller/useAIConversationState.ts +21 -0
- package/src/ai-components/conversation/entries.ts +177 -0
- package/src/ai-components/conversation/fromStreamMessage.ts +87 -0
- package/src/ai-components/conversation/index.ts +5 -0
- package/src/ai-components/conversation/list/AIChatList.tsx +227 -0
- package/src/ai-components/conversation/list/useChatListController.ts +91 -0
- package/src/ai-components/conversation/list/useEndInView.ts +61 -0
- package/src/ai-components/conversation/list/useKeyboardOverlap.ts +51 -0
- package/src/ai-components/conversation/list/useLoadOlder.ts +97 -0
- package/src/ai-components/conversation/list/usePinnedAnchor.ts +113 -0
- package/src/ai-components/conversation/types.ts +57 -0
- package/src/ai-components/conversation/useConversationRows.ts +230 -0
- package/src/ai-components/generative-ui/AIUIAction.ts +73 -0
- package/src/ai-components/generative-ui/AIUIArguments.ts +117 -0
- package/src/ai-components/generative-ui/AIUIComponent.tsx +106 -0
- package/src/ai-components/generative-ui/AIUIComponentDefinition.ts +163 -0
- package/src/ai-components/generative-ui/AIUIDocument.ts +77 -0
- package/src/ai-components/generative-ui/AIUIEntrance.tsx +223 -0
- package/src/ai-components/generative-ui/AIUIErrorBoundary.tsx +39 -0
- package/src/ai-components/generative-ui/AIUIHelpers.ts +86 -0
- package/src/ai-components/generative-ui/AIUIHost.ts +358 -0
- package/src/ai-components/generative-ui/AIUIMedia.ts +45 -0
- package/src/ai-components/generative-ui/AIUIRenderer.ts +60 -0
- package/src/ai-components/generative-ui/AIUIView.tsx +87 -0
- package/src/ai-components/generative-ui/index.ts +48 -0
- package/src/ai-components/icons.ts +101 -0
- package/src/ai-components/index.ts +10 -0
- package/src/ai-components/internal/Shimmer.tsx +40 -0
- package/src/ai-components/internal/format.ts +69 -0
- package/src/ai-components/internal/hooks/useBottomSafeArea.ts +6 -0
- package/src/ai-components/internal/icons/AgentIcons.tsx +138 -0
- package/src/ai-components/internal/tokens.ts +4 -0
- package/src/ai-components/internal/uuid.ts +17 -0
- package/src/ai-components/markdown/components/CodeBlock.tsx +13 -2
- package/src/ai-components/markdown/components/InlineCode.tsx +1 -0
- package/src/ai-components/markdown/components/Text.tsx +7 -2
- package/src/ai-components/markdown/styles.ts +29 -27
- package/src/ai-components/markdown/types.ts +1 -0
- package/src/ai-components/message/AIAssistantMessage.tsx +99 -0
- package/src/ai-components/message/AIMessageAttachment.tsx +245 -0
- package/src/ai-components/message/AIReplyActions.tsx +139 -0
- package/src/ai-components/message/AIUserMessage.tsx +121 -0
- package/src/ai-components/message/UserMessageMenu.tsx +149 -0
- package/src/ai-components/message/index.ts +4 -0
- package/src/ai-components/message-composer/ActionButton.tsx +5 -1
- package/src/ai-components/message-composer/ActionSheet.tsx +28 -6
- package/src/ai-components/message-composer/AttachmentButton.tsx +9 -1
- package/src/ai-components/message-composer/ChatOptions.tsx +144 -0
- package/src/ai-components/message-composer/ComposerView.tsx +179 -29
- package/src/ai-components/message-composer/EditingMessageChip.tsx +61 -0
- package/src/ai-components/message-composer/MediaPreviewList.tsx +34 -8
- package/src/ai-components/message-composer/index.ts +1 -0
- package/src/ai-components/message-parts/AIMessageParts.tsx +120 -0
- package/src/ai-components/message-parts/AIToolApproval.tsx +196 -0
- package/src/ai-components/message-parts/AIToolAuthorization.tsx +279 -0
- package/src/ai-components/message-parts/AIToolCall.tsx +117 -0
- package/src/ai-components/message-parts/callStates.ts +44 -0
- package/src/ai-components/message-parts/index.ts +6 -0
- package/src/ai-components/message-parts/parseMessageParts.ts +195 -0
- package/src/ai-components/message-parts/types.ts +157 -0
- package/src/ai-components/native-specs/NativeAIAgent.ts +25 -0
- package/src/ai-components/reasoning/AIReasoning.tsx +509 -0
- package/src/ai-components/reasoning/index.ts +2 -0
- package/src/ai-components/reasoning/thinkingClock.ts +109 -0
- package/src/ai-components/services/clipboard-service/expo.ts +18 -4
- package/src/ai-components/store/composer/store.ts +9 -0
- package/src/ai-components/store/composer/useComposerChatOption.ts +15 -0
- package/src/ai-components/store/composer/useComposerIsEditing.ts +15 -0
- package/src/ai-components/store/index.ts +2 -0
- package/src/ai-components/suggestions/AISuggestions.tsx +73 -0
- package/src/ai-components/suggestions/index.ts +1 -0
- package/src/ai-components/syntax-highlighting/utils/flatten-nodes.ts +2 -1
- package/src/ai-components/syntax-highlighting/utils/renderer.tsx +4 -2
- package/src/ai-components/theme.ts +334 -0
- package/src/ai-components/tool-calls/AIClientIdentity.ts +33 -0
- package/src/ai-components/tool-calls/AIClientToolRunner.ts +200 -0
- package/src/ai-components/tool-calls/AIToolApprover.tsx +60 -0
- package/src/ai-components/tool-calls/authSessionAuthorizer.ts +137 -0
- package/src/ai-components/tool-calls/index.ts +4 -0
- package/src/ai-components/voice-visualization/glowShader.ts +1 -3
- package/src/ai-components/voice-visualization/simplex.ts +1 -1
- package/src/components/Accessibility/NotificationAnnouncer.tsx +5 -5
- package/src/components/Accessibility/hooks/useIncomingMessageAnnouncements.ts +1 -1
- package/src/components/Accessibility/useAccessibilityAnnouncer.ts +0 -2
- package/src/components/Message/MessageItemView/utils/renderText.tsx +1 -2
- package/src/contexts/translationContext/TranslationContext.tsx +2 -2
- package/src/i18n/ar.json +39 -1
- package/src/i18n/en.json +39 -1
- package/src/i18n/es.json +39 -1
- package/src/i18n/fr.json +39 -1
- package/src/i18n/he.json +39 -1
- package/src/i18n/hi.json +39 -1
- package/src/i18n/it.json +39 -1
- package/src/i18n/ja.json +39 -1
- package/src/i18n/ko.json +39 -1
- package/src/i18n/nl.json +39 -1
- package/src/i18n/pt-br.json +39 -1
- package/src/i18n/ru.json +39 -1
- package/src/i18n/tr.json +39 -1
- package/src/mock-builders/a2ui/ohrid.ts +106 -0
- package/src/utils/i18n/Streami18n.ts +4 -1
- package/src/utils/i18n/utils.ts +3 -0
- package/src/version.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { AIUIDocument } from '../generative-ui/AIUIDocument';
|
|
2
|
+
import type { AIMessageAttachmentData } from '../message/AIMessageAttachment';
|
|
3
|
+
import type { AIMessageRating } from '../message/AIReplyActions';
|
|
4
|
+
import type { AIMessagePartData } from '../message-parts/types';
|
|
5
|
+
|
|
6
|
+
/** Who wrote a message: the person using the app (`user`) or the agent (`assistant`). */
|
|
7
|
+
export type AIMessageRole = 'user' | 'assistant' | (string & {});
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A message of the conversation as the AI components show it. `fromStreamMessage` makes one
|
|
11
|
+
* from a Stream message.
|
|
12
|
+
*/
|
|
13
|
+
export type AIMessage = {
|
|
14
|
+
id: string;
|
|
15
|
+
/** Who wrote it. Each of the person's messages starts a turn. */
|
|
16
|
+
role: AIMessageRole;
|
|
17
|
+
/** What it says. A reply's text is Markdown. */
|
|
18
|
+
text: string;
|
|
19
|
+
/** What it carries besides its text, such as images and files. */
|
|
20
|
+
attachments?: AIMessageAttachmentData[];
|
|
21
|
+
/** Whether the agent is still writing it. */
|
|
22
|
+
isGenerating?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* How the person rated a reply, as your backend has it. An `AIConversationController` shows it
|
|
25
|
+
* until the person rates the reply on this device.
|
|
26
|
+
*/
|
|
27
|
+
rating?: AIMessageRating | null;
|
|
28
|
+
/** The steps the agent took for it, in order: reasoning, tool calls and kinds of its own. */
|
|
29
|
+
parts?: AIMessagePartData[];
|
|
30
|
+
/**
|
|
31
|
+
* The whole of a reasoning step's thinking when the app has it, such as from live updates.
|
|
32
|
+
* Without it, the step shows its own excerpt. It is read on every render, so look it up
|
|
33
|
+
* rather than work it out.
|
|
34
|
+
*/
|
|
35
|
+
reasoningText?: (stepId: string) => string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* The UI the agent wrote for a reply, which shows in place of its text when the
|
|
38
|
+
* conversation's `ui` host has a renderer for it. A person's message has none.
|
|
39
|
+
*/
|
|
40
|
+
uiDocument?: AIUIDocument;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A message the person sent that is not in the conversation's messages yet. The conversation
|
|
45
|
+
* shows it until its copy arrives, and shows the agent thinking meanwhile.
|
|
46
|
+
*/
|
|
47
|
+
export type AIPendingMessage = {
|
|
48
|
+
/**
|
|
49
|
+
* The message's id once it arrives, when you know it (such as the id you send it with). Its
|
|
50
|
+
* copy is then found by it rather than by where it lands. Keep it the same while it waits.
|
|
51
|
+
*/
|
|
52
|
+
id: string;
|
|
53
|
+
/** What the person wrote. */
|
|
54
|
+
text: string;
|
|
55
|
+
/** What they sent with it, such as the photos and files they picked. Its copy shows these too. */
|
|
56
|
+
attachments?: AIMessageAttachmentData[];
|
|
57
|
+
};
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { type ReactNode, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type AIConversationCanShowUI,
|
|
5
|
+
type AIConversationEntry,
|
|
6
|
+
type AIConversationTurn,
|
|
7
|
+
AIPendingMessageTracker,
|
|
8
|
+
hasFinishedSteps,
|
|
9
|
+
turnsOf,
|
|
10
|
+
} from './entries';
|
|
11
|
+
import type { AIMessage, AIPendingMessage } from './types';
|
|
12
|
+
|
|
13
|
+
import type { AIMessageAttachmentData } from '../message/AIMessageAttachment';
|
|
14
|
+
import { AIThinkingClock } from '../reasoning/thinkingClock';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Where a row is: the first of a turn, or within one. The first turn has the same room above it as
|
|
18
|
+
* the others, so older messages arriving above it leave it where it is.
|
|
19
|
+
*/
|
|
20
|
+
export type RowPosition = 'turn' | 'message';
|
|
21
|
+
|
|
22
|
+
/** A row of the list: one message, with the turn it belongs to. */
|
|
23
|
+
export type EntryRow = {
|
|
24
|
+
entry: AIConversationEntry;
|
|
25
|
+
key: string;
|
|
26
|
+
kind: 'entry';
|
|
27
|
+
position: RowPosition;
|
|
28
|
+
turnKey: string;
|
|
29
|
+
/** The turn's first reasoning step, which takes over the seconds the turn was seen thinking. */
|
|
30
|
+
firstStepId?: string;
|
|
31
|
+
/**
|
|
32
|
+
* When the agent started thinking again between the steps of this reply, which is being
|
|
33
|
+
* written, and which its seconds count from. It thinks under the reply, in the reply's row, so
|
|
34
|
+
* it moves with the reply's steps as they fold.
|
|
35
|
+
*/
|
|
36
|
+
thinkingSince?: number;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* What ends the latest turn: the agent thinking, and the app's footer. A row of its own rather than
|
|
41
|
+
* the list's footer: the list lays its rows out itself, together with the room it leaves under the
|
|
42
|
+
* latest turn, while a footer that goes away shrinks the content at once, which moves the view.
|
|
43
|
+
*/
|
|
44
|
+
export type TailRow = {
|
|
45
|
+
isThinking: boolean;
|
|
46
|
+
key: string;
|
|
47
|
+
kind: 'tail';
|
|
48
|
+
turnKey: string;
|
|
49
|
+
firstStepId?: string;
|
|
50
|
+
footer?: ReactNode;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type ConversationRow = EntryRow | TailRow;
|
|
54
|
+
|
|
55
|
+
const TAIL_KEY = 'ai-conversation-tail';
|
|
56
|
+
|
|
57
|
+
// What the latest message was at the last render, to tell whether its answer grew since, and when
|
|
58
|
+
// the agent started thinking between its steps, if it is.
|
|
59
|
+
type BetweenSteps = {
|
|
60
|
+
messageId: string | undefined;
|
|
61
|
+
textLength: number;
|
|
62
|
+
since?: number;
|
|
63
|
+
stepsKey?: string;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const sameAttachments = (a: AIMessageAttachmentData[], b: AIMessageAttachmentData[]) =>
|
|
67
|
+
a === b || (a.length === 0 && b.length === 0);
|
|
68
|
+
|
|
69
|
+
// Whether a row can be kept as it was: the list renders a row again only for a new item.
|
|
70
|
+
const isSameRow = (row: EntryRow, next: Omit<EntryRow, 'key'>) =>
|
|
71
|
+
row.entry.message === next.entry.message &&
|
|
72
|
+
row.entry.pending === next.entry.pending &&
|
|
73
|
+
row.entry.isLatestReply === next.entry.isLatestReply &&
|
|
74
|
+
sameAttachments(row.entry.sentAttachments, next.entry.sentAttachments) &&
|
|
75
|
+
row.firstStepId === next.firstStepId &&
|
|
76
|
+
row.thinkingSince === next.thinkingSince &&
|
|
77
|
+
row.position === next.position &&
|
|
78
|
+
row.turnKey === next.turnKey;
|
|
79
|
+
|
|
80
|
+
// The turn's first reasoning step, which takes over the seconds the turn was seen thinking.
|
|
81
|
+
const firstStepOf = (turn: AIConversationTurn | undefined) => {
|
|
82
|
+
for (const { message } of turn?.entries ?? []) {
|
|
83
|
+
if (!message || message.role === 'user') continue;
|
|
84
|
+
const step = message.parts?.find((part) => part.reasoning);
|
|
85
|
+
if (step) return step.id;
|
|
86
|
+
}
|
|
87
|
+
return undefined;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export type UseConversationRowsOptions = {
|
|
91
|
+
messages: AIMessage[];
|
|
92
|
+
/** Whether a reply's generated UI shows, so a reply that shows only UI has a row. */
|
|
93
|
+
canShowUI?: AIConversationCanShowUI;
|
|
94
|
+
footer?: ReactNode;
|
|
95
|
+
isThinking?: boolean;
|
|
96
|
+
/** Whether `isThinking` alone says whether the agent is thinking, rather than the rows too. */
|
|
97
|
+
isThinkingKnown?: boolean;
|
|
98
|
+
pendingMessage?: AIPendingMessage | null;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export type ConversationRows = {
|
|
102
|
+
/** The key of the latest turn's first row, which pins to the top: `undefined` with no turns. */
|
|
103
|
+
anchorKey: string | undefined;
|
|
104
|
+
/** The turns' thinking clock, for `AIThinkingTurnContext`. */
|
|
105
|
+
clock: AIThinkingClock;
|
|
106
|
+
/** The rows to list: each message, then what ends the latest turn while there is any. */
|
|
107
|
+
rows: ConversationRow[];
|
|
108
|
+
/** Whether there are no messages to show yet, not even one on its way. */
|
|
109
|
+
isEmpty: boolean;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The conversation's data, as rows for a list: its messages grouped into turns, a message on its
|
|
114
|
+
* way until its copy arrives, and what ends the latest turn. Each unchanged row keeps its object,
|
|
115
|
+
* so the list renders only the rows that changed. Knows nothing about the list itself.
|
|
116
|
+
*/
|
|
117
|
+
export const useConversationRows = ({
|
|
118
|
+
canShowUI,
|
|
119
|
+
footer,
|
|
120
|
+
isThinking = false,
|
|
121
|
+
isThinkingKnown = false,
|
|
122
|
+
messages,
|
|
123
|
+
pendingMessage,
|
|
124
|
+
}: UseConversationRowsOptions): ConversationRows => {
|
|
125
|
+
const [tracker] = useState(() => new AIPendingMessageTracker());
|
|
126
|
+
const [clock] = useState(() => new AIThinkingClock());
|
|
127
|
+
|
|
128
|
+
const entries = useMemo(
|
|
129
|
+
() => tracker.entries(messages, pendingMessage, canShowUI),
|
|
130
|
+
[canShowUI, messages, pendingMessage, tracker],
|
|
131
|
+
);
|
|
132
|
+
// after `entries`, which matched the copies
|
|
133
|
+
const thinking =
|
|
134
|
+
isThinking ||
|
|
135
|
+
(!isThinkingKnown && tracker.isAwaitingReply(messages, pendingMessage, canShowUI));
|
|
136
|
+
|
|
137
|
+
// The agent thinking again between the latest reply's steps: from the update in which a step
|
|
138
|
+
// ended without the answer growing, until the answer grows. A step that ends together with more
|
|
139
|
+
// of the answer means the answer is under way.
|
|
140
|
+
const lastMessage = messages[messages.length - 1];
|
|
141
|
+
const stepsKey = hasFinishedSteps(lastMessage, canShowUI)
|
|
142
|
+
? `${lastMessage.id}:${lastMessage.parts?.length}`
|
|
143
|
+
: undefined;
|
|
144
|
+
// A break the agent's backend adds after what came before a step isn't more of the answer.
|
|
145
|
+
const textLength = lastMessage?.text.trimEnd().length ?? 0;
|
|
146
|
+
const [gap, setGap] = useState<BetweenSteps>();
|
|
147
|
+
if (
|
|
148
|
+
gap?.messageId !== lastMessage?.id ||
|
|
149
|
+
gap?.stepsKey !== stepsKey ||
|
|
150
|
+
gap?.textLength !== textLength
|
|
151
|
+
) {
|
|
152
|
+
const grew = gap?.messageId === lastMessage?.id && textLength > (gap?.textLength ?? 0);
|
|
153
|
+
setGap({
|
|
154
|
+
messageId: lastMessage?.id,
|
|
155
|
+
since:
|
|
156
|
+
grew || stepsKey === undefined
|
|
157
|
+
? undefined
|
|
158
|
+
: stepsKey === gap?.stepsKey
|
|
159
|
+
? gap.since
|
|
160
|
+
: Date.now(),
|
|
161
|
+
stepsKey,
|
|
162
|
+
textLength,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
const thinkingSince = !thinking && stepsKey !== undefined ? gap?.since : undefined;
|
|
166
|
+
const thinkingReplyId = thinkingSince !== undefined ? lastMessage?.id : undefined;
|
|
167
|
+
const turns = useMemo(() => turnsOf(entries), [entries]);
|
|
168
|
+
const latest = turns[turns.length - 1];
|
|
169
|
+
const latestHasReplies = (latest?.entries.length ?? 0) > 1;
|
|
170
|
+
const latestFirstStepId = firstStepOf(latest);
|
|
171
|
+
const latestHasFirstStep = latestFirstStepId !== undefined;
|
|
172
|
+
// Before the views below read it in their effects and next renders: a turn's thinking starts
|
|
173
|
+
// and ends once.
|
|
174
|
+
useLayoutEffect(() => {
|
|
175
|
+
clock.update(latest?.id, thinking, latestHasReplies, latestHasFirstStep);
|
|
176
|
+
}, [clock, latest?.id, latestHasFirstStep, latestHasReplies, thinking]);
|
|
177
|
+
|
|
178
|
+
// The rows, keeping each unchanged one's object, so the list renders only the rows that changed.
|
|
179
|
+
const rowCache = useRef(new Map<string, EntryRow>());
|
|
180
|
+
const entryRows = useMemo(() => {
|
|
181
|
+
const cache = new Map<string, EntryRow>();
|
|
182
|
+
const next: EntryRow[] = [];
|
|
183
|
+
turns.forEach((turn) => {
|
|
184
|
+
const firstStepId = firstStepOf(turn);
|
|
185
|
+
turn.entries.forEach((entry, index) => {
|
|
186
|
+
const fields = {
|
|
187
|
+
entry,
|
|
188
|
+
firstStepId,
|
|
189
|
+
kind: 'entry' as const,
|
|
190
|
+
position: (index > 0 ? 'message' : 'turn') as RowPosition,
|
|
191
|
+
thinkingSince:
|
|
192
|
+
thinkingReplyId !== undefined && entry.message?.id === thinkingReplyId
|
|
193
|
+
? thinkingSince
|
|
194
|
+
: undefined,
|
|
195
|
+
turnKey: turn.id,
|
|
196
|
+
};
|
|
197
|
+
const previous = rowCache.current.get(entry.id);
|
|
198
|
+
const row =
|
|
199
|
+
previous && isSameRow(previous, fields) ? previous : { ...fields, key: entry.id };
|
|
200
|
+
cache.set(entry.id, row);
|
|
201
|
+
next.push(row);
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
rowCache.current = cache;
|
|
205
|
+
return next;
|
|
206
|
+
}, [thinkingReplyId, thinkingSince, turns]);
|
|
207
|
+
|
|
208
|
+
// A turn's id is its first entry's, so the latest turn's first row has its key.
|
|
209
|
+
const lastTurnKey = latest?.id;
|
|
210
|
+
const tailRow = useMemo<TailRow | undefined>(
|
|
211
|
+
() =>
|
|
212
|
+
lastTurnKey !== undefined && (thinking || footer)
|
|
213
|
+
? {
|
|
214
|
+
firstStepId: latestFirstStepId,
|
|
215
|
+
footer,
|
|
216
|
+
isThinking: thinking,
|
|
217
|
+
key: TAIL_KEY,
|
|
218
|
+
kind: 'tail',
|
|
219
|
+
turnKey: lastTurnKey,
|
|
220
|
+
}
|
|
221
|
+
: undefined,
|
|
222
|
+
[footer, lastTurnKey, latestFirstStepId, thinking],
|
|
223
|
+
);
|
|
224
|
+
const rows = useMemo<ConversationRow[]>(
|
|
225
|
+
() => (tailRow ? [...entryRows, tailRow] : entryRows),
|
|
226
|
+
[entryRows, tailRow],
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
return { anchorKey: lastTurnKey, clock, isEmpty: entryRows.length === 0, rows };
|
|
230
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { AIUIFormat } from './AIUIDocument';
|
|
2
|
+
import { utf8ByteLength } from './AIUIHelpers';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* What the person did in a reply's UI, such as tapping a place or submitting a form. It goes to
|
|
6
|
+
* the agent as their next message: `label` is its text and `aiUIActionJSON(action)` what it
|
|
7
|
+
* carries.
|
|
8
|
+
*/
|
|
9
|
+
export type AIUIAction = {
|
|
10
|
+
/** The format of the UI it came from. */
|
|
11
|
+
format: AIUIFormat;
|
|
12
|
+
/** What the person did, in their words, such as "Tell me more about St. Naum". */
|
|
13
|
+
label: string;
|
|
14
|
+
/** The reply whose UI it came from. */
|
|
15
|
+
messageId: string;
|
|
16
|
+
/**
|
|
17
|
+
* What happened, such as an event of an app's component (`ask_about`) or OpenUI's
|
|
18
|
+
* `continue_conversation`.
|
|
19
|
+
*/
|
|
20
|
+
name: string;
|
|
21
|
+
/** The details in the format's own shape, such as what was chosen and a form's values. */
|
|
22
|
+
payload: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** The action as the JSON object an agent's backend reads. */
|
|
26
|
+
export type AIUIActionJSON = {
|
|
27
|
+
format: AIUIFormat;
|
|
28
|
+
message_id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
payload: Record<string, unknown>;
|
|
31
|
+
v: 1;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** The custom field of the person's message that holds the action. */
|
|
35
|
+
export const AI_UI_ACTION_CUSTOM_DATA_KEY = 'ai_ui_action';
|
|
36
|
+
/**
|
|
37
|
+
* The most an action may take as JSON. The agents router refuses a larger one, and its
|
|
38
|
+
* refusal would lose the person's message with it.
|
|
39
|
+
*/
|
|
40
|
+
export const AI_UI_ACTION_MAX_BYTES = 8 * 1024;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The action as the JSON object an agent's backend reads, such as the `uiAction` of
|
|
44
|
+
* `session.responses.create(action.label, { uiAction })`. The label is not in it: it is the
|
|
45
|
+
* text of the person's message.
|
|
46
|
+
*/
|
|
47
|
+
export const aiUIActionJSON = (action: AIUIAction): AIUIActionJSON => ({
|
|
48
|
+
format: action.format,
|
|
49
|
+
message_id: action.messageId,
|
|
50
|
+
name: action.name,
|
|
51
|
+
payload: action.payload,
|
|
52
|
+
v: 1,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Why the agent's backend would refuse the action, or `undefined` when it would take it: it
|
|
57
|
+
* names its reply, its format and what happened, in at most `AI_UI_ACTION_MAX_BYTES` of JSON.
|
|
58
|
+
*/
|
|
59
|
+
export const aiUIActionProblem = (action: AIUIAction): string | undefined => {
|
|
60
|
+
if (!action.messageId) return 'an action names the reply it came from';
|
|
61
|
+
if (!action.format) return 'an action names the format of its UI';
|
|
62
|
+
if (!action.name) return 'an action names what happened';
|
|
63
|
+
let json: string;
|
|
64
|
+
try {
|
|
65
|
+
json = JSON.stringify(aiUIActionJSON(action));
|
|
66
|
+
} catch {
|
|
67
|
+
return 'an action carries only JSON';
|
|
68
|
+
}
|
|
69
|
+
const bytes = utf8ByteLength(json);
|
|
70
|
+
return bytes > AI_UI_ACTION_MAX_BYTES
|
|
71
|
+
? `an action takes at most ${AI_UI_ACTION_MAX_BYTES} bytes as JSON, and this one takes ${bytes}`
|
|
72
|
+
: undefined;
|
|
73
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { AIUIJSONSchema, AIUIParameter } from './AIUIComponentDefinition';
|
|
2
|
+
import { aiUIParametersOf } from './AIUIComponentDefinition';
|
|
3
|
+
import { isRecord } from './AIUIHelpers';
|
|
4
|
+
|
|
5
|
+
// Thrown inside decoding only, so a value that does not fit stops it at once.
|
|
6
|
+
class DoesNotFit extends Error {}
|
|
7
|
+
|
|
8
|
+
const RFC_3339 = /^\d{4}-\d{2}-\d{2}[Tt ]\d{2}:\d{2}:\d{2}(\.\d+)?([Zz]|[+-]\d{2}:\d{2})$/;
|
|
9
|
+
const DAY = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A date the agent wrote: an RFC 3339 moment, or a whole day as `yyyy-MM-dd` that the calendar
|
|
13
|
+
* has, which is that day's start where the person is. Anything else is not a date.
|
|
14
|
+
*/
|
|
15
|
+
export const aiUIDate = (text: string): Date | undefined => {
|
|
16
|
+
if (RFC_3339.test(text)) {
|
|
17
|
+
const moment = new Date(text);
|
|
18
|
+
return Number.isNaN(moment.getTime()) ? undefined : moment;
|
|
19
|
+
}
|
|
20
|
+
const day = DAY.exec(text);
|
|
21
|
+
if (!day) return undefined;
|
|
22
|
+
const [year, month, date] = [Number(day[1]), Number(day[2]), Number(day[3])];
|
|
23
|
+
const start = new Date(year, month - 1, date);
|
|
24
|
+
start.setFullYear(year);
|
|
25
|
+
return start.getFullYear() === year && start.getMonth() === month - 1 && start.getDate() === date
|
|
26
|
+
? start
|
|
27
|
+
: undefined;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** `place_name` as `placeName`, the way the agent's snake_case reads in JavaScript. */
|
|
31
|
+
export const aiUICamelCase = (key: string) => {
|
|
32
|
+
const [, leading = '', middle = '', trailing = ''] = /^(_*)(.*?)(_*)$/.exec(key) ?? [];
|
|
33
|
+
if (!middle.includes('_')) return key;
|
|
34
|
+
const [first = '', ...rest] = middle.split('_').filter(Boolean);
|
|
35
|
+
return (
|
|
36
|
+
leading +
|
|
37
|
+
first +
|
|
38
|
+
rest.map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join('') +
|
|
39
|
+
trailing
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const camelCased = (value: unknown): unknown => {
|
|
44
|
+
if (Array.isArray(value)) return value.map(camelCased);
|
|
45
|
+
if (!isRecord(value)) return value;
|
|
46
|
+
return Object.fromEntries(
|
|
47
|
+
Object.entries(value).map(([key, item]) => [aiUICamelCase(key), camelCased(item)]),
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const decodeObject = (value: unknown, parameters: AIUIParameter[]) => {
|
|
52
|
+
if (!isRecord(value)) throw new DoesNotFit();
|
|
53
|
+
const declared = new Set(parameters.map(({ name }) => name));
|
|
54
|
+
const decoded: Record<string, unknown> = {};
|
|
55
|
+
for (const [key, item] of Object.entries(value)) {
|
|
56
|
+
if (!declared.has(key)) decoded[aiUICamelCase(key)] = camelCased(item);
|
|
57
|
+
}
|
|
58
|
+
for (const { isRequired, name, type } of parameters) {
|
|
59
|
+
const item = value[name];
|
|
60
|
+
if (item === undefined || item === null) {
|
|
61
|
+
if (isRequired) throw new DoesNotFit();
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
decoded[aiUICamelCase(name)] = decodeValue(item, type);
|
|
65
|
+
}
|
|
66
|
+
return decoded;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const decodeValue = (value: unknown, schema: AIUIJSONSchema): unknown => {
|
|
70
|
+
switch (schema.type) {
|
|
71
|
+
case 'string': {
|
|
72
|
+
if (typeof value !== 'string') throw new DoesNotFit();
|
|
73
|
+
if (Array.isArray(schema.enum) && !schema.enum.includes(value)) throw new DoesNotFit();
|
|
74
|
+
if (schema.format === 'date' || schema.format === 'date-time') {
|
|
75
|
+
const date = aiUIDate(value);
|
|
76
|
+
if (!date) throw new DoesNotFit();
|
|
77
|
+
return date;
|
|
78
|
+
}
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
case 'number':
|
|
82
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) throw new DoesNotFit();
|
|
83
|
+
return value;
|
|
84
|
+
case 'integer':
|
|
85
|
+
if (!Number.isInteger(value)) throw new DoesNotFit();
|
|
86
|
+
return value;
|
|
87
|
+
case 'boolean':
|
|
88
|
+
if (typeof value !== 'boolean') throw new DoesNotFit();
|
|
89
|
+
return value;
|
|
90
|
+
case 'array': {
|
|
91
|
+
if (!Array.isArray(value)) throw new DoesNotFit();
|
|
92
|
+
const items = isRecord(schema.items) ? schema.items : {};
|
|
93
|
+
return value.map((item) => decodeValue(item, items));
|
|
94
|
+
}
|
|
95
|
+
case 'object':
|
|
96
|
+
return decodeObject(value, aiUIParametersOf(schema));
|
|
97
|
+
default:
|
|
98
|
+
return camelCased(value);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The arguments the agent wrote for a component, as its view reads them: keys in camelCase,
|
|
104
|
+
* dates as `Date`s. `undefined` while they do not fit its parameters, such as while they are
|
|
105
|
+
* still streaming in: a required one is missing, or one is of the wrong type.
|
|
106
|
+
*/
|
|
107
|
+
export const decodeAIUIArguments = <Arguments = Record<string, unknown>>(
|
|
108
|
+
args: Record<string, unknown>,
|
|
109
|
+
parameters: AIUIParameter[],
|
|
110
|
+
): Arguments | undefined => {
|
|
111
|
+
try {
|
|
112
|
+
return decodeObject(args, parameters) as Arguments;
|
|
113
|
+
} catch (error) {
|
|
114
|
+
if (error instanceof DoesNotFit) return undefined;
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React, { type ComponentType, useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { decodeAIUIArguments } from './AIUIArguments';
|
|
4
|
+
import type { AIUIComponentDefinition } from './AIUIComponentDefinition';
|
|
5
|
+
import { AIUIEntrance } from './AIUIEntrance';
|
|
6
|
+
import { AIUIErrorBoundary } from './AIUIErrorBoundary';
|
|
7
|
+
import type { AIUIHost } from './AIUIHost';
|
|
8
|
+
|
|
9
|
+
/** Where an app's component is shown, and how it tells the agent what the person did. */
|
|
10
|
+
export type AIUIComponentContext = {
|
|
11
|
+
/**
|
|
12
|
+
* Tells the agent about one of the component's events, as the person's next message.
|
|
13
|
+
* `label` is what the person did, in their words, such as "Tell me more about St. Naum".
|
|
14
|
+
*/
|
|
15
|
+
emit: (event: string, label: string, payload?: Record<string, unknown>) => void;
|
|
16
|
+
/** The conversation's host, for running the app's tools and opening links. */
|
|
17
|
+
host: AIUIHost;
|
|
18
|
+
/** Whether the agent is still writing the reply's UI, so the arguments may still change. */
|
|
19
|
+
isStreaming: boolean;
|
|
20
|
+
/** The reply the component is in. */
|
|
21
|
+
messageId: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type AIUIComponentProps<Arguments> = {
|
|
25
|
+
/** What the agent filled in: keys in camelCase, dates as `Date`s. */
|
|
26
|
+
args: Arguments;
|
|
27
|
+
context: AIUIComponentContext;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* One of the app's views that the agent can place in a reply's UI, in whichever format it
|
|
32
|
+
* writes, such as a map or a card over the app's own data.
|
|
33
|
+
*/
|
|
34
|
+
export type AIUIComponent = {
|
|
35
|
+
Component: ComponentType<AIUIComponentProps<never>>;
|
|
36
|
+
/** Its description, the same on every platform and for the agent. */
|
|
37
|
+
definition: AIUIComponentDefinition;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* One of the app's components, with what its view reads from the agent's arguments. The view
|
|
42
|
+
* gets them only once they fit the definition's parameters, so it can rely on their types.
|
|
43
|
+
*
|
|
44
|
+
* A conversation reuses its views: one scrolled out of sight shows another reply's UI next, so
|
|
45
|
+
* state the view keeps of its own has to start afresh for a new `context.messageId`.
|
|
46
|
+
*/
|
|
47
|
+
export const defineAIUIComponent = <Arguments,>(
|
|
48
|
+
definition: AIUIComponentDefinition,
|
|
49
|
+
Component: ComponentType<AIUIComponentProps<Arguments>>,
|
|
50
|
+
): AIUIComponent => ({
|
|
51
|
+
// The arguments are checked against `definition` before the view gets them.
|
|
52
|
+
Component: Component as unknown as ComponentType<AIUIComponentProps<never>>,
|
|
53
|
+
definition,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// What an app's component was given, to try it again once that changes or the reply is written.
|
|
57
|
+
const attemptOf = (args: Record<string, unknown>, isStreaming: boolean) => {
|
|
58
|
+
try {
|
|
59
|
+
return `${isStreaming}\u0000${JSON.stringify(args)}`;
|
|
60
|
+
} catch {
|
|
61
|
+
return args;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* An app's component for the arguments the agent wrote, coming in as it shows, or nothing
|
|
67
|
+
* while they don't fit its parameters, such as while they are still streaming in. Renderers
|
|
68
|
+
* place the app's components with it. One that throws leaves only itself out of the reply's
|
|
69
|
+
* UI, is tried again when its arguments change, and is reported once the reply is written.
|
|
70
|
+
*/
|
|
71
|
+
export const AIUIComponentView = ({
|
|
72
|
+
args,
|
|
73
|
+
component,
|
|
74
|
+
context,
|
|
75
|
+
}: {
|
|
76
|
+
args: Record<string, unknown>;
|
|
77
|
+
component: AIUIComponent;
|
|
78
|
+
context: AIUIComponentContext;
|
|
79
|
+
}) => {
|
|
80
|
+
const { host, isStreaming, messageId } = context;
|
|
81
|
+
// Worked out again only when the arguments change, for a renderer that keeps the same object
|
|
82
|
+
// while they don't, as the A2UI renderer does.
|
|
83
|
+
const decoded = useMemo(
|
|
84
|
+
() => decodeAIUIArguments(args, component.definition.parameters),
|
|
85
|
+
[args, component],
|
|
86
|
+
);
|
|
87
|
+
const resetKey = useMemo(
|
|
88
|
+
() => (decoded === undefined ? undefined : attemptOf(decoded, isStreaming)),
|
|
89
|
+
[decoded, isStreaming],
|
|
90
|
+
);
|
|
91
|
+
if (decoded === undefined) return null;
|
|
92
|
+
const { Component } = component;
|
|
93
|
+
return (
|
|
94
|
+
<AIUIErrorBoundary
|
|
95
|
+
onError={(error) => {
|
|
96
|
+
// While the reply streams, what the component was given may still be incomplete.
|
|
97
|
+
if (!isStreaming) host.reportRenderError(error, messageId);
|
|
98
|
+
}}
|
|
99
|
+
resetKey={resetKey}
|
|
100
|
+
>
|
|
101
|
+
<AIUIEntrance>
|
|
102
|
+
<Component args={decoded as never} context={context} />
|
|
103
|
+
</AIUIEntrance>
|
|
104
|
+
</AIUIErrorBoundary>
|
|
105
|
+
);
|
|
106
|
+
};
|