stream-chat-react-native-core 9.12.1 → 9.14.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/ai-components/conversation/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 +237 -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 +64 -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 +374 -0
- package/lib/commonjs/ai-components/conversation/AIConversation.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/index.js +15 -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 +53 -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/useConversationRows.js +117 -0
- package/lib/commonjs/ai-components/conversation/useConversationRows.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/controller/AIAgentError.js +13 -0
- package/lib/commonjs/ai-components/conversation-state/controller/AIAgentError.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/controller/AIConversationController.js +431 -0
- package/lib/commonjs/ai-components/conversation-state/controller/AIConversationController.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/controller/AIConversationExchange.js +89 -0
- package/lib/commonjs/ai-components/conversation-state/controller/AIConversationExchange.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/controller/index.js +48 -0
- package/lib/commonjs/ai-components/conversation-state/controller/index.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/controller/offers.js +35 -0
- package/lib/commonjs/ai-components/conversation-state/controller/offers.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/controller/types.js +13 -0
- package/lib/commonjs/ai-components/conversation-state/controller/types.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/controller/useAIConversationState.js +8 -0
- package/lib/commonjs/ai-components/conversation-state/controller/useAIConversationState.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/fromStreamMessage.js +67 -0
- package/lib/commonjs/ai-components/conversation-state/fromStreamMessage.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/index.js +37 -0
- package/lib/commonjs/ai-components/conversation-state/index.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/types.js +4 -0
- package/lib/commonjs/ai-components/conversation-state/types.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 +197 -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/keyboard.js +40 -0
- package/lib/commonjs/ai-components/internal/keyboard.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 +64 -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 +4 -2
- 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 +146 -20
- package/lib/commonjs/ai-components/message-composer/ComposerView.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/EditingMessageChip.js +81 -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 +133 -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 +40 -1
- package/lib/commonjs/i18n/en.json +40 -1
- package/lib/commonjs/i18n/es.json +40 -1
- package/lib/commonjs/i18n/fr.json +40 -1
- package/lib/commonjs/i18n/he.json +40 -1
- package/lib/commonjs/i18n/hi.json +40 -1
- package/lib/commonjs/i18n/it.json +40 -1
- package/lib/commonjs/i18n/ja.json +40 -1
- package/lib/commonjs/i18n/ko.json +40 -1
- package/lib/commonjs/i18n/nl.json +40 -1
- package/lib/commonjs/i18n/pt-br.json +40 -1
- package/lib/commonjs/i18n/ru.json +40 -1
- package/lib/commonjs/i18n/tr.json +40 -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 +237 -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 +64 -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 +374 -0
- package/lib/module/ai-components/conversation/AIConversation.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/index.js +15 -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 +53 -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/useConversationRows.js +117 -0
- package/lib/module/ai-components/conversation/useConversationRows.js.map +1 -0
- package/lib/module/ai-components/conversation-state/controller/AIAgentError.js +13 -0
- package/lib/module/ai-components/conversation-state/controller/AIAgentError.js.map +1 -0
- package/lib/module/ai-components/conversation-state/controller/AIConversationController.js +431 -0
- package/lib/module/ai-components/conversation-state/controller/AIConversationController.js.map +1 -0
- package/lib/module/ai-components/conversation-state/controller/AIConversationExchange.js +89 -0
- package/lib/module/ai-components/conversation-state/controller/AIConversationExchange.js.map +1 -0
- package/lib/module/ai-components/conversation-state/controller/index.js +48 -0
- package/lib/module/ai-components/conversation-state/controller/index.js.map +1 -0
- package/lib/module/ai-components/conversation-state/controller/offers.js +35 -0
- package/lib/module/ai-components/conversation-state/controller/offers.js.map +1 -0
- package/lib/module/ai-components/conversation-state/controller/types.js +13 -0
- package/lib/module/ai-components/conversation-state/controller/types.js.map +1 -0
- package/lib/module/ai-components/conversation-state/controller/useAIConversationState.js +8 -0
- package/lib/module/ai-components/conversation-state/controller/useAIConversationState.js.map +1 -0
- package/lib/module/ai-components/conversation-state/fromStreamMessage.js +67 -0
- package/lib/module/ai-components/conversation-state/fromStreamMessage.js.map +1 -0
- package/lib/module/ai-components/conversation-state/index.js +37 -0
- package/lib/module/ai-components/conversation-state/index.js.map +1 -0
- package/lib/module/ai-components/conversation-state/types.js +4 -0
- package/lib/module/ai-components/conversation-state/types.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 +197 -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/keyboard.js +40 -0
- package/lib/module/ai-components/internal/keyboard.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 +64 -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 +4 -2
- 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 +146 -20
- package/lib/module/ai-components/message-composer/ComposerView.js.map +1 -1
- package/lib/module/ai-components/message-composer/EditingMessageChip.js +81 -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 +133 -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 +40 -1
- package/lib/module/i18n/en.json +40 -1
- package/lib/module/i18n/es.json +40 -1
- package/lib/module/i18n/fr.json +40 -1
- package/lib/module/i18n/he.json +40 -1
- package/lib/module/i18n/hi.json +40 -1
- package/lib/module/i18n/it.json +40 -1
- package/lib/module/i18n/ja.json +40 -1
- package/lib/module/i18n/ko.json +40 -1
- package/lib/module/i18n/nl.json +40 -1
- package/lib/module/i18n/pt-br.json +40 -1
- package/lib/module/i18n/ru.json +40 -1
- package/lib/module/i18n/tr.json +40 -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 +133 -0
- package/lib/typescript/ai-components/conversation/AIConversation.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/index.d.ts +3 -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/useConversationRows.d.ts +66 -0
- package/lib/typescript/ai-components/conversation/useConversationRows.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/controller/AIAgentError.d.ts +10 -0
- package/lib/typescript/ai-components/conversation-state/controller/AIAgentError.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/controller/AIConversationController.d.ts +173 -0
- package/lib/typescript/ai-components/conversation-state/controller/AIConversationController.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/controller/AIConversationExchange.d.ts +23 -0
- package/lib/typescript/ai-components/conversation-state/controller/AIConversationExchange.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/controller/index.d.ts +5 -0
- package/lib/typescript/ai-components/conversation-state/controller/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/controller/offers.d.ts +25 -0
- package/lib/typescript/ai-components/conversation-state/controller/offers.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/controller/types.d.ts +142 -0
- package/lib/typescript/ai-components/conversation-state/controller/types.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/controller/useAIConversationState.d.ts +9 -0
- package/lib/typescript/ai-components/conversation-state/controller/useAIConversationState.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/fromStreamMessage.d.ts +25 -0
- package/lib/typescript/ai-components/conversation-state/fromStreamMessage.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/index.d.ts +4 -0
- package/lib/typescript/ai-components/conversation-state/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/types.d.ts +55 -0
- package/lib/typescript/ai-components/conversation-state/types.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 +76 -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/keyboard.d.ts +9 -0
- package/lib/typescript/ai-components/internal/keyboard.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 +1 -1
- 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 +39 -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 +40 -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 +40 -1
- package/lib/typescript/i18n/en.json +40 -1
- package/lib/typescript/i18n/es.json +40 -1
- package/lib/typescript/i18n/fr.json +40 -1
- package/lib/typescript/i18n/he.json +40 -1
- package/lib/typescript/i18n/hi.json +40 -1
- package/lib/typescript/i18n/it.json +40 -1
- package/lib/typescript/i18n/ja.json +40 -1
- package/lib/typescript/i18n/ko.json +40 -1
- package/lib/typescript/i18n/nl.json +40 -1
- package/lib/typescript/i18n/pt-br.json +40 -1
- package/lib/typescript/i18n/ru.json +40 -1
- package/lib/typescript/i18n/tr.json +40 -1
- package/lib/typescript/utils/i18n/Streami18n.d.ts +41 -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 +270 -0
- package/src/a2ui/__tests__/A2UIInstructions.test.ts +233 -0
- package/src/a2ui/__tests__/A2UIRenderer.test.tsx +1559 -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 +64 -3
- package/src/ai-components/StreamingMessageView.tsx +27 -3
- package/src/ai-components/__tests__/ComposerView.test.tsx +247 -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 +787 -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 +606 -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 +385 -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/__tests__/withoutKeyboardController.test.tsx +60 -0
- 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 +612 -0
- package/src/ai-components/conversation/entries.ts +177 -0
- package/src/ai-components/conversation/index.ts +2 -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 +52 -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/useConversationRows.ts +231 -0
- package/src/ai-components/conversation-state/controller/AIAgentError.ts +14 -0
- package/src/ai-components/conversation-state/controller/AIConversationController.ts +628 -0
- package/src/ai-components/conversation-state/controller/AIConversationExchange.ts +132 -0
- package/src/ai-components/conversation-state/controller/index.ts +4 -0
- package/src/ai-components/conversation-state/controller/offers.ts +53 -0
- package/src/ai-components/conversation-state/controller/types.ts +154 -0
- package/src/ai-components/conversation-state/controller/useAIConversationState.ts +21 -0
- package/src/ai-components/conversation-state/fromStreamMessage.ts +89 -0
- package/src/ai-components/conversation-state/index.ts +3 -0
- package/src/ai-components/conversation-state/types.ts +57 -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 +229 -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/keyboard.tsx +34 -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 +100 -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 +10 -5
- 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 +194 -30
- package/src/ai-components/message-composer/EditingMessageChip.tsx +62 -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 +145 -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 +40 -1
- package/src/i18n/en.json +40 -1
- package/src/i18n/es.json +40 -1
- package/src/i18n/fr.json +40 -1
- package/src/i18n/he.json +40 -1
- package/src/i18n/hi.json +40 -1
- package/src/i18n/it.json +40 -1
- package/src/i18n/ja.json +40 -1
- package/src/i18n/ko.json +40 -1
- package/src/i18n/nl.json +40 -1
- package/src/i18n/pt-br.json +40 -1
- package/src/i18n/ru.json +40 -1
- package/src/i18n/tr.json +40 -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,132 @@
|
|
|
1
|
+
import isEqual from 'lodash/isEqual';
|
|
2
|
+
|
|
3
|
+
import type { AIConversationRequest } from './types';
|
|
4
|
+
|
|
5
|
+
import { generateUUIDv4 } from '../../internal/uuid';
|
|
6
|
+
import type { AIMessageAttachmentData } from '../../message/AIMessageAttachment';
|
|
7
|
+
import type { MediaAsset } from '../../services/media-picker-service/AbstractMediaPickerService';
|
|
8
|
+
import type { AIMessage, AIPendingMessage } from '../types';
|
|
9
|
+
|
|
10
|
+
// Where the request is: waiting for its reply, stopped by the person before it started, not
|
|
11
|
+
// sent because the transport failed, or not answered by the agent.
|
|
12
|
+
export type AIConversationExchangeState = 'waiting' | 'stopped' | 'failed' | 'unanswered';
|
|
13
|
+
|
|
14
|
+
// A reply the agent has started with no text, steps or attachments yet. Its generated UI can
|
|
15
|
+
// still show, when the conversation's host reads it.
|
|
16
|
+
export const hasEmptyContent = (message: AIMessage) =>
|
|
17
|
+
message.role !== 'user' &&
|
|
18
|
+
message.text === '' &&
|
|
19
|
+
!message.parts?.length &&
|
|
20
|
+
!message.attachments?.length;
|
|
21
|
+
|
|
22
|
+
// Whether a reply is written again since it was `original`: it started anew, or it shows
|
|
23
|
+
// something else.
|
|
24
|
+
const isRewritten = (message: AIMessage, original: AIMessage) =>
|
|
25
|
+
(!!message.isGenerating && !original.isGenerating) ||
|
|
26
|
+
message.text !== original.text ||
|
|
27
|
+
!isEqual(message.parts ?? [], original.parts ?? []) ||
|
|
28
|
+
!isEqual(message.attachments ?? [], original.attachments ?? []) ||
|
|
29
|
+
!isEqual(message.uiDocument, original.uiDocument);
|
|
30
|
+
|
|
31
|
+
export const attachmentOfAsset = (asset: MediaAsset): AIMessageAttachmentData => ({
|
|
32
|
+
kind: !asset.type || asset.type.startsWith('image') ? 'image' : 'file',
|
|
33
|
+
mimeType: asset.type?.includes('/') ? asset.type : undefined,
|
|
34
|
+
name: asset.name,
|
|
35
|
+
size: asset.size,
|
|
36
|
+
url: asset.uri,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// The latest request, until its reply starts or another request takes its place.
|
|
40
|
+
export class AIConversationExchange<Message extends AIMessage> {
|
|
41
|
+
state: AIConversationExchangeState = 'waiting';
|
|
42
|
+
// The messages there were when it was made, none of which is its reply.
|
|
43
|
+
readonly known: Set<string>;
|
|
44
|
+
// The messages it replaces, as they were, which the conversation leaves out while it waits:
|
|
45
|
+
// the reply written again, or the message edited, and those after it.
|
|
46
|
+
readonly replaced: Map<string, Message>;
|
|
47
|
+
// The person's message on its way.
|
|
48
|
+
readonly pending: AIPendingMessage | undefined;
|
|
49
|
+
|
|
50
|
+
constructor(
|
|
51
|
+
// Tells it apart from the requests before and after it.
|
|
52
|
+
readonly id: number,
|
|
53
|
+
readonly request: AIConversationRequest<Message>,
|
|
54
|
+
conversation: readonly Message[],
|
|
55
|
+
) {
|
|
56
|
+
this.known = new Set(conversation.map((message) => message.id));
|
|
57
|
+
const target = request.message
|
|
58
|
+
? conversation.findIndex((message) => message.id === request.message?.id)
|
|
59
|
+
: -1;
|
|
60
|
+
this.replaced = new Map(
|
|
61
|
+
target >= 0 && (request.kind === 'regenerate' || request.kind === 'edit')
|
|
62
|
+
? conversation.slice(target).map((message) => [message.id, message])
|
|
63
|
+
: [],
|
|
64
|
+
);
|
|
65
|
+
if (request.kind === 'regenerate') {
|
|
66
|
+
this.pending = undefined;
|
|
67
|
+
} else {
|
|
68
|
+
const edited = request.kind === 'edit' ? (request.message?.attachments ?? []) : [];
|
|
69
|
+
this.pending = {
|
|
70
|
+
attachments: [...edited, ...request.attachments.map(attachmentOfAsset)],
|
|
71
|
+
id: request.messageId,
|
|
72
|
+
text: request.text,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
get hasFailed() {
|
|
78
|
+
return this.state === 'failed' || this.state === 'unanswered';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// The person's message while the conversation shows it: until its reply starts, and for a
|
|
82
|
+
// new message also once it is stopped or failed, since the agent may have it, or `retry()`
|
|
83
|
+
// sends it again. The messages an edit replaces come back instead.
|
|
84
|
+
get shownPending() {
|
|
85
|
+
return this.state === 'waiting' || this.request.kind === 'message' ? this.pending : undefined;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// The latest message when it is the request's reply: a reply that wasn't there, or one the
|
|
89
|
+
// request replaces, once it is written again.
|
|
90
|
+
reply(conversation: readonly Message[]) {
|
|
91
|
+
const last = conversation[conversation.length - 1];
|
|
92
|
+
if (!last || last.role === 'user') return undefined;
|
|
93
|
+
const original = this.replaced.get(last.id);
|
|
94
|
+
const rewritten = original ? isRewritten(last, original) : false;
|
|
95
|
+
return !this.known.has(last.id) || rewritten ? last : undefined;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Whether its reply has started: it shows something, or it is already finished.
|
|
99
|
+
hasReplyStarted(conversation: readonly Message[]) {
|
|
100
|
+
const reply = this.reply(conversation);
|
|
101
|
+
return !!reply && (!hasEmptyContent(reply) || !reply.isGenerating);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Whether the person's message is in the conversation: one with its id, or one of theirs
|
|
105
|
+
// after the messages there were.
|
|
106
|
+
hasMessageArrived(conversation: readonly Message[]) {
|
|
107
|
+
if (conversation.some((message) => message.id === this.request.messageId)) return true;
|
|
108
|
+
let lastKnown = -1;
|
|
109
|
+
conversation.forEach((message, index) => {
|
|
110
|
+
if (this.known.has(message.id)) lastKnown = index;
|
|
111
|
+
});
|
|
112
|
+
return conversation.slice(lastKnown + 1).some((message) => message.role === 'user');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// What `retry()` sends: the request again, or, when the agent had the person's message but
|
|
116
|
+
// couldn't answer it, a request for its reply, since sending it again would add it twice.
|
|
117
|
+
retryRequest(conversation: readonly Message[]): AIConversationRequest<Message> {
|
|
118
|
+
if (
|
|
119
|
+
this.state !== 'unanswered' ||
|
|
120
|
+
this.request.kind !== 'message' ||
|
|
121
|
+
!this.hasMessageArrived(conversation)
|
|
122
|
+
) {
|
|
123
|
+
return this.request;
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
attachments: [],
|
|
127
|
+
kind: 'regenerate',
|
|
128
|
+
messageId: generateUUIDv4(),
|
|
129
|
+
text: this.request.text,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type AIConversationStatus, isAIConversationAnswering } from './types';
|
|
2
|
+
|
|
3
|
+
import type { AIMessageRating, AIReplyActionsProps } from '../../message/AIReplyActions';
|
|
4
|
+
import type { AIMessage } from '../types';
|
|
5
|
+
|
|
6
|
+
type Offerer<Message extends AIMessage> = {
|
|
7
|
+
actions: { edit: boolean; rate: boolean; regenerate: boolean };
|
|
8
|
+
edit: (message: Message) => void;
|
|
9
|
+
rate: (reply: Message, rating: AIMessageRating | null) => void;
|
|
10
|
+
regenerate: (reply: Message) => void;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// What the person can do with a finished reply: rate it, and write it again while it is the
|
|
14
|
+
// latest and the agent isn't answering.
|
|
15
|
+
export const replyActionsOf = <Message extends AIMessage>(
|
|
16
|
+
offerer: Offerer<Message>,
|
|
17
|
+
{
|
|
18
|
+
ratings,
|
|
19
|
+
status,
|
|
20
|
+
}: { ratings: Readonly<Record<string, AIMessageRating>>; status: AIConversationStatus },
|
|
21
|
+
reply: Message,
|
|
22
|
+
isLatestReply: boolean,
|
|
23
|
+
): Omit<AIReplyActionsProps, 'text'> => ({
|
|
24
|
+
onRate: offerer.actions.rate ? (rating) => offerer.rate(reply, rating) : undefined,
|
|
25
|
+
onRegenerate:
|
|
26
|
+
offerer.actions.regenerate && isLatestReply && !isAIConversationAnswering(status)
|
|
27
|
+
? () => offerer.regenerate(reply)
|
|
28
|
+
: undefined,
|
|
29
|
+
rating: ratings[reply.id] ?? null,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
/** The id of the person's latest message, the one they can edit. */
|
|
33
|
+
export const latestUserMessageIdOf = (messages: readonly AIMessage[]) => {
|
|
34
|
+
for (let index = messages.length - 1; index >= 0; index--) {
|
|
35
|
+
if (messages[index].role === 'user') return messages[index].id;
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Edits a message of the person's, when it is their latest and the agent isn't answering.
|
|
41
|
+
export const editActionOf = <Message extends AIMessage>(
|
|
42
|
+
offerer: Offerer<Message>,
|
|
43
|
+
{
|
|
44
|
+
latestUserMessageId,
|
|
45
|
+
status,
|
|
46
|
+
}: { latestUserMessageId: string | undefined; status: AIConversationStatus },
|
|
47
|
+
message: Message,
|
|
48
|
+
): (() => void) | undefined => {
|
|
49
|
+
if (!offerer.actions.edit || message.role !== 'user' || isAIConversationAnswering(status)) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return latestUserMessageId === message.id ? () => offerer.edit(message) : undefined;
|
|
53
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { AIMessageRating } from '../../message/AIReplyActions';
|
|
2
|
+
import type { AIChatOption } from '../../message-composer/ChatOptions';
|
|
3
|
+
import type { MediaAsset } from '../../services/media-picker-service/AbstractMediaPickerService';
|
|
4
|
+
import type { AIMessage } from '../types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Where the latest exchange with the agent is:
|
|
8
|
+
* - `ready`: nothing is on its way: the agent answered, or the person stopped it.
|
|
9
|
+
* - `submitted`: the person's request is on its way, or the agent is working on it and its reply
|
|
10
|
+
* shows nothing yet.
|
|
11
|
+
* - `streaming`: the agent is writing its reply.
|
|
12
|
+
* - `error`: the latest request failed, or the agent couldn't answer it. `retry()` tries again.
|
|
13
|
+
*/
|
|
14
|
+
export type AIConversationStatus = 'ready' | 'submitted' | 'streaming' | 'error';
|
|
15
|
+
|
|
16
|
+
/** Whether the agent is answering: the request is submitted, or its reply streaming. */
|
|
17
|
+
export const isAIConversationAnswering = (status: AIConversationStatus) =>
|
|
18
|
+
status === 'submitted' || status === 'streaming';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* What the person asks for:
|
|
22
|
+
* - `message`: a new message from the person.
|
|
23
|
+
* - `regenerate`: a new reply in place of the request's `message`, which is a reply, and of those
|
|
24
|
+
* after it. Without `message`, a reply to the latest message, which has none, such as after the
|
|
25
|
+
* agent couldn't answer it.
|
|
26
|
+
* - `edit`: the person changed the request's `message`, one of theirs, to say its `text`: it is
|
|
27
|
+
* answered again, in place of the replies after it.
|
|
28
|
+
*
|
|
29
|
+
* An open set: a kind of your own is on its way like a message.
|
|
30
|
+
*/
|
|
31
|
+
export type AIConversationRequestKind = 'message' | 'regenerate' | 'edit' | (string & {});
|
|
32
|
+
|
|
33
|
+
/** What the person asks the agent, as an `AIConversationTransport` sends it. */
|
|
34
|
+
export type AIConversationRequest<Message extends AIMessage = AIMessage> = {
|
|
35
|
+
/** What the person asks for. */
|
|
36
|
+
kind: AIConversationRequestKind;
|
|
37
|
+
/**
|
|
38
|
+
* An id for the person's message. A transport that creates the message with it lets the
|
|
39
|
+
* conversation find its copy by it. A retry of the request keeps it.
|
|
40
|
+
*/
|
|
41
|
+
messageId: string;
|
|
42
|
+
/** What the person wrote. When a reply is written again, the message it answers says it. */
|
|
43
|
+
text: string;
|
|
44
|
+
/** The files the person picked, on this device, to upload with their message. */
|
|
45
|
+
attachments: MediaAsset[];
|
|
46
|
+
/** The option the person picked in the composer, such as thinking harder. */
|
|
47
|
+
chatOption?: AIChatOption;
|
|
48
|
+
/** What the composer held besides, as `ComposerState.custom`. */
|
|
49
|
+
custom?: Record<string, unknown>;
|
|
50
|
+
/** The message it is about: the reply to write again, or the person's message they edited. */
|
|
51
|
+
message?: Message;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** The ids of the states Stream Chat's AI indicator reports. */
|
|
55
|
+
export const AIAgentActivityStates = {
|
|
56
|
+
checkingExternalSources: 'AI_STATE_EXTERNAL_SOURCES',
|
|
57
|
+
error: 'AI_STATE_ERROR',
|
|
58
|
+
generating: 'AI_STATE_GENERATING',
|
|
59
|
+
thinking: 'AI_STATE_THINKING',
|
|
60
|
+
} as const;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* What the agent is doing. An open set: compare against the states you know. Those of
|
|
64
|
+
* `AIAgentActivityStates` are Stream Chat's AI indicator's.
|
|
65
|
+
*/
|
|
66
|
+
export type AIAgentActivityState =
|
|
67
|
+
| (typeof AIAgentActivityStates)[keyof typeof AIAgentActivityStates]
|
|
68
|
+
| (string & {});
|
|
69
|
+
|
|
70
|
+
/** What the agent says it is doing besides what its reply shows, such as checking sources. */
|
|
71
|
+
export type AIAgentActivity = {
|
|
72
|
+
state: AIAgentActivityState;
|
|
73
|
+
/** What it says about it, such as "Searching the web", or why it couldn't answer. */
|
|
74
|
+
text?: string;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/** What the conversation's views offer the person to do with its messages. All by default. */
|
|
78
|
+
export type AIConversationActions = {
|
|
79
|
+
/** Editing the person's latest message, which is then answered again. */
|
|
80
|
+
edit?: boolean;
|
|
81
|
+
/** Rating replies. */
|
|
82
|
+
rate?: boolean;
|
|
83
|
+
/** Asking for a new reply in place of the latest. */
|
|
84
|
+
regenerate?: boolean;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Where an `AIConversationTransport` tells its `AIConversationController` what the conversation
|
|
89
|
+
* holds. Once the controller is disposed, its updates go nowhere.
|
|
90
|
+
*/
|
|
91
|
+
export type AIConversationFeed<Message extends AIMessage = AIMessage> = {
|
|
92
|
+
/** Whether the controller it updates is still there. Stop following what it holds once it isn't. */
|
|
93
|
+
readonly isConnected: boolean;
|
|
94
|
+
/** The conversation's messages, oldest first, each time they change. */
|
|
95
|
+
updateMessages: (messages: readonly Message[]) => void;
|
|
96
|
+
/** Whether there are messages before the first one, which `loadOlderMessages` loads. */
|
|
97
|
+
updateHasOlderMessages: (hasOlderMessages: boolean) => void;
|
|
98
|
+
/** What the agent says it is doing, or `undefined` once it stops saying. */
|
|
99
|
+
updateActivity: (activity: AIAgentActivity | undefined) => void;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* How an `AIConversationController` reaches the agent and learns what it holds: it sends what the
|
|
104
|
+
* person asks, stops the agent, and tells the controller its messages as they change.
|
|
105
|
+
*
|
|
106
|
+
* With Stream Chat, the conversation is a channel: the transport follows its messages and AI
|
|
107
|
+
* indicator events, and sends each request through the channel or your agent's own API.
|
|
108
|
+
*
|
|
109
|
+
* ```ts
|
|
110
|
+
* const transport: AIConversationTransport = {
|
|
111
|
+
* connect: (feed) => {
|
|
112
|
+
* const update = () => feed.updateMessages(channel.state.messages.map(fromStreamMessage));
|
|
113
|
+
* update();
|
|
114
|
+
* return channel.on(update).unsubscribe;
|
|
115
|
+
* },
|
|
116
|
+
* send: (request) => agent.respond(request.text, request.attachments),
|
|
117
|
+
* stop: () => agent.interrupt(),
|
|
118
|
+
* };
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export type AIConversationTransport<Message extends AIMessage = AIMessage> = {
|
|
122
|
+
/**
|
|
123
|
+
* Starts telling `feed` what the conversation holds: its messages each time they change,
|
|
124
|
+
* whether there are older ones to load, and what the agent says it is doing. The controller
|
|
125
|
+
* calls it once, as it is made, and calls what it returns once it is disposed.
|
|
126
|
+
*/
|
|
127
|
+
connect: (feed: AIConversationFeed<Message>) => void | (() => void);
|
|
128
|
+
/**
|
|
129
|
+
* Sends what the person asks. Resolve once the agent has the request: its reply arrives
|
|
130
|
+
* through the feed. A rejection shows as the conversation's error, and the person can retry,
|
|
131
|
+
* which sends the same request again with the same `messageId`: if the first attempt reached
|
|
132
|
+
* your backend, or you keep a copy of the failed message, use the id so the message isn't added
|
|
133
|
+
* twice. A rejection with an `AbortError` ends the request without an error.
|
|
134
|
+
*
|
|
135
|
+
* The controller leaves out the messages a `regenerate` or an `edit` replaces only until the
|
|
136
|
+
* new reply starts. From then on it shows the messages as the feed has them, so update the
|
|
137
|
+
* conversation before the new reply arrives:
|
|
138
|
+
* - For a regenerate, remove the request's `message` and the messages after it, or write the
|
|
139
|
+
* new reply in place of `message`, under its id.
|
|
140
|
+
* - For an edit, change the person's `message` to say the request's `text`, under its id, and
|
|
141
|
+
* remove the messages after it.
|
|
142
|
+
*/
|
|
143
|
+
send: (request: AIConversationRequest<Message>) => Promise<void>;
|
|
144
|
+
/** Stops the reply the agent is writing. What it wrote so far stays. */
|
|
145
|
+
stop: () => Promise<void>;
|
|
146
|
+
/** Loads the messages before the first one, which arrive through the feed. */
|
|
147
|
+
loadOlderMessages?: () => Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Tells your backend how the person rated a reply, or that they took their rating back with
|
|
150
|
+
* `null`. Without it, the controller keeps the ratings on this device. Ratings your backend has
|
|
151
|
+
* show through each message's `rating`.
|
|
152
|
+
*/
|
|
153
|
+
rate?: (reply: Message, rating: AIMessageRating | null) => Promise<void>;
|
|
154
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useStateStore } from '@stream-io/state-store/react-bindings';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
AIConversationController,
|
|
5
|
+
AIConversationControllerState,
|
|
6
|
+
} from './AIConversationController';
|
|
7
|
+
|
|
8
|
+
import type { AIMessage } from '../types';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Follows what `selector` picks of a conversation's state, such as its `status` or `error`: the
|
|
12
|
+
* component renders again when it changes. Keep `selector` outside the component, so it stays the
|
|
13
|
+
* same between renders.
|
|
14
|
+
*/
|
|
15
|
+
export const useAIConversationState = <
|
|
16
|
+
Message extends AIMessage,
|
|
17
|
+
Selected extends Readonly<Record<string, unknown>>,
|
|
18
|
+
>(
|
|
19
|
+
conversation: AIConversationController<Message>,
|
|
20
|
+
selector: (state: AIConversationControllerState<Message>) => Selected,
|
|
21
|
+
) => useStateStore(conversation.state, selector);
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { Attachment, LocalMessage, MessageResponse } from 'stream-chat';
|
|
2
|
+
|
|
3
|
+
import type { AIMessage } from './types';
|
|
4
|
+
|
|
5
|
+
import { AI_UI_CUSTOM_DATA_KEY, parseAIUIDocument } from '../generative-ui/AIUIDocument';
|
|
6
|
+
import type { AIMessageAttachmentData } from '../message/AIMessageAttachment';
|
|
7
|
+
import { parseMessageParts } from '../message-parts/parseMessageParts';
|
|
8
|
+
|
|
9
|
+
/** A Stream message, as the channel's state or an event has it. */
|
|
10
|
+
export type AIStreamMessage = Pick<LocalMessage | MessageResponse, 'attachments' | 'id' | 'text'> &
|
|
11
|
+
Record<string, unknown>;
|
|
12
|
+
|
|
13
|
+
export type FromStreamMessageOptions = {
|
|
14
|
+
/** Whether the agent wrote it. Defaults to the message's `ai_generated` field. */
|
|
15
|
+
isAssistant?: (message: AIStreamMessage) => boolean;
|
|
16
|
+
/** The whole of a reasoning step's thinking, when the app has it, such as from live updates. */
|
|
17
|
+
reasoningText?: (messageId: string, stepId: string) => string | undefined;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// Images and files only: the steps (`ai_*`) are read as parts, link previews Stream made from
|
|
21
|
+
// the text are left out, and other kinds are the app's.
|
|
22
|
+
const attachmentOf = (attachment: Attachment): AIMessageAttachmentData | undefined => {
|
|
23
|
+
if (attachment.og_scrape_url) return undefined;
|
|
24
|
+
const name = attachment.title ?? attachment.fallback ?? undefined;
|
|
25
|
+
if (attachment.type === 'image') {
|
|
26
|
+
const url = attachment.image_url ?? attachment.asset_url ?? attachment.thumb_url;
|
|
27
|
+
return url ? { kind: 'image', mimeType: attachment.mime_type, name, url } : undefined;
|
|
28
|
+
}
|
|
29
|
+
if (attachment.type === 'file') {
|
|
30
|
+
const size = Number(attachment.file_size);
|
|
31
|
+
return attachment.asset_url
|
|
32
|
+
? {
|
|
33
|
+
kind: 'file',
|
|
34
|
+
mimeType: attachment.mime_type,
|
|
35
|
+
name,
|
|
36
|
+
size: Number.isFinite(size) && size > 0 ? size : undefined,
|
|
37
|
+
url: attachment.asset_url,
|
|
38
|
+
}
|
|
39
|
+
: undefined;
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Adapts a Stream message for `AIConversation`: a reply is one with `ai_generated: true`, it is
|
|
46
|
+
* being written while `generating: true`, its steps are its `ai_reasoning` and `ai_tool_call`
|
|
47
|
+
* attachments, its images and files are its other attachments, and the UI the agent wrote for
|
|
48
|
+
* it is its `ai_ui` field. A person's message has no UI, whatever its fields say.
|
|
49
|
+
*/
|
|
50
|
+
export const fromStreamMessage = (
|
|
51
|
+
message: AIStreamMessage,
|
|
52
|
+
{ isAssistant, reasoningText }: FromStreamMessageOptions = {},
|
|
53
|
+
): AIMessage => {
|
|
54
|
+
const attachments = message.attachments ?? [];
|
|
55
|
+
const assistant = isAssistant ? isAssistant(message) : message.ai_generated === true;
|
|
56
|
+
const uiDocument = assistant ? parseAIUIDocument(message[AI_UI_CUSTOM_DATA_KEY]) : undefined;
|
|
57
|
+
return {
|
|
58
|
+
attachments: attachments
|
|
59
|
+
.map(attachmentOf)
|
|
60
|
+
.filter((attachment): attachment is AIMessageAttachmentData => !!attachment),
|
|
61
|
+
id: message.id,
|
|
62
|
+
isGenerating: message.generating === true,
|
|
63
|
+
parts: parseMessageParts(attachments),
|
|
64
|
+
reasoningText: reasoningText
|
|
65
|
+
? (stepId: string) => reasoningText(message.id, stepId)
|
|
66
|
+
: undefined,
|
|
67
|
+
role: assistant ? 'assistant' : 'user',
|
|
68
|
+
text: message.text ?? '',
|
|
69
|
+
...(uiDocument ? { uiDocument } : {}),
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* A `fromStreamMessage` that gives back the same `AIMessage` for the same Stream message object.
|
|
75
|
+
* The channel's state replaces only the messages that change, so mapping its messages through it
|
|
76
|
+
* on every update leaves the others as they were, and `AIConversation` renders only the changed
|
|
77
|
+
* ones again. Make one per conversation, such as with `useState(() => createFromStreamMessage())`.
|
|
78
|
+
*/
|
|
79
|
+
export const createFromStreamMessage = (options?: FromStreamMessageOptions) => {
|
|
80
|
+
const cache = new WeakMap<AIStreamMessage, AIMessage>();
|
|
81
|
+
return (message: AIStreamMessage) => {
|
|
82
|
+
let adapted = cache.get(message);
|
|
83
|
+
if (!adapted) {
|
|
84
|
+
adapted = fromStreamMessage(message, options);
|
|
85
|
+
cache.set(message, adapted);
|
|
86
|
+
}
|
|
87
|
+
return adapted;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -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,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
|
+
};
|