@base44/superagent-native 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +132 -0
- package/lib/commonjs/AgentSettingsPanel.js +1067 -0
- package/lib/commonjs/AgentSettingsPanel.js.map +1 -0
- package/lib/commonjs/AgentSphereIcon.js +243 -0
- package/lib/commonjs/AgentSphereIcon.js.map +1 -0
- package/lib/commonjs/AttachmentPickerStatusModal.js +96 -0
- package/lib/commonjs/AttachmentPickerStatusModal.js.map +1 -0
- package/lib/commonjs/AttachmentPreviewStrip.js +49 -0
- package/lib/commonjs/AttachmentPreviewStrip.js.map +1 -0
- package/lib/commonjs/ChannelsPanel.js +733 -0
- package/lib/commonjs/ChannelsPanel.js.map +1 -0
- package/lib/commonjs/ConversationChat.js +219 -0
- package/lib/commonjs/ConversationChat.js.map +1 -0
- package/lib/commonjs/ConversationComposer.js +323 -0
- package/lib/commonjs/ConversationComposer.js.map +1 -0
- package/lib/commonjs/ConversationMessageList.js +105 -0
- package/lib/commonjs/ConversationMessageList.js.map +1 -0
- package/lib/commonjs/ConversationScreen.js +241 -0
- package/lib/commonjs/ConversationScreen.js.map +1 -0
- package/lib/commonjs/EditorDrawer.js +1127 -0
- package/lib/commonjs/EditorDrawer.js.map +1 -0
- package/lib/commonjs/EditorTabPanel.js +28 -0
- package/lib/commonjs/EditorTabPanel.js.map +1 -0
- package/lib/commonjs/FilesPanel.js +533 -0
- package/lib/commonjs/FilesPanel.js.map +1 -0
- package/lib/commonjs/MarkdownText.js +313 -0
- package/lib/commonjs/MarkdownText.js.map +1 -0
- package/lib/commonjs/MessageActionBar.js +90 -0
- package/lib/commonjs/MessageActionBar.js.map +1 -0
- package/lib/commonjs/RenameAgentModal.js +99 -0
- package/lib/commonjs/RenameAgentModal.js.map +1 -0
- package/lib/commonjs/ShareAgentModal.js +349 -0
- package/lib/commonjs/ShareAgentModal.js.map +1 -0
- package/lib/commonjs/ShareAgentModal.styles.js +236 -0
- package/lib/commonjs/ShareAgentModal.styles.js.map +1 -0
- package/lib/commonjs/SuperagentHomeScreen.js +316 -0
- package/lib/commonjs/SuperagentHomeScreen.js.map +1 -0
- package/lib/commonjs/ToolApprovalCard.js +542 -0
- package/lib/commonjs/ToolApprovalCard.js.map +1 -0
- package/lib/commonjs/ToolCallSummary.js +632 -0
- package/lib/commonjs/ToolCallSummary.js.map +1 -0
- package/lib/commonjs/agentSphereStyles.js +38 -0
- package/lib/commonjs/agentSphereStyles.js.map +1 -0
- package/lib/commonjs/apiClient.js +158 -0
- package/lib/commonjs/apiClient.js.map +1 -0
- package/lib/commonjs/attachmentFileHelpers.js +104 -0
- package/lib/commonjs/attachmentFileHelpers.js.map +1 -0
- package/lib/commonjs/attachmentUpload.js +87 -0
- package/lib/commonjs/attachmentUpload.js.map +1 -0
- package/lib/commonjs/composerStyles.js +248 -0
- package/lib/commonjs/composerStyles.js.map +1 -0
- package/lib/commonjs/connectorBrandIcons.js +82 -0
- package/lib/commonjs/connectorBrandIcons.js.map +1 -0
- package/lib/commonjs/connectorCatalog.js +377 -0
- package/lib/commonjs/connectorCatalog.js.map +1 -0
- package/lib/commonjs/constants.js +15 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/conversationParts.js +273 -0
- package/lib/commonjs/conversationParts.js.map +1 -0
- package/lib/commonjs/conversationRuntime.js +144 -0
- package/lib/commonjs/conversationRuntime.js.map +1 -0
- package/lib/commonjs/conversationStyles.js +758 -0
- package/lib/commonjs/conversationStyles.js.map +1 -0
- package/lib/commonjs/editorShellStyles.js +1032 -0
- package/lib/commonjs/editorShellStyles.js.map +1 -0
- package/lib/commonjs/editorTabs.js +42 -0
- package/lib/commonjs/editorTabs.js.map +1 -0
- package/lib/commonjs/fileTreeUtils.js +133 -0
- package/lib/commonjs/fileTreeUtils.js.map +1 -0
- package/lib/commonjs/index.js +110 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/markdownStyles.js +157 -0
- package/lib/commonjs/markdownStyles.js.map +1 -0
- package/lib/commonjs/mediaUtils.js +61 -0
- package/lib/commonjs/mediaUtils.js.map +1 -0
- package/lib/commonjs/messageActionStyles.js +45 -0
- package/lib/commonjs/messageActionStyles.js.map +1 -0
- package/lib/commonjs/messageUtils.js +55 -0
- package/lib/commonjs/messageUtils.js.map +1 -0
- package/lib/commonjs/nativeActionSheet.js +21 -0
- package/lib/commonjs/nativeActionSheet.js.map +1 -0
- package/lib/commonjs/nativeActionSheet.web.js +10 -0
- package/lib/commonjs/nativeActionSheet.web.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/paperTheme.js +59 -0
- package/lib/commonjs/paperTheme.js.map +1 -0
- package/lib/commonjs/realtimeClient.js +99 -0
- package/lib/commonjs/realtimeClient.js.map +1 -0
- package/lib/commonjs/renameAgentModalStyles.js +83 -0
- package/lib/commonjs/renameAgentModalStyles.js.map +1 -0
- package/lib/commonjs/screenParts.js +220 -0
- package/lib/commonjs/screenParts.js.map +1 -0
- package/lib/commonjs/styles.js +343 -0
- package/lib/commonjs/styles.js.map +1 -0
- package/lib/commonjs/superagentApiClient.js +613 -0
- package/lib/commonjs/superagentApiClient.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/useSuperagentAttachmentPicker.js +80 -0
- package/lib/commonjs/useSuperagentAttachmentPicker.js.map +1 -0
- package/lib/commonjs/useSuperagentConversation.js +216 -0
- package/lib/commonjs/useSuperagentConversation.js.map +1 -0
- package/lib/commonjs/useSuperagentRuntime.js +1207 -0
- package/lib/commonjs/useSuperagentRuntime.js.map +1 -0
- package/lib/module/AgentSettingsPanel.js +1062 -0
- package/lib/module/AgentSettingsPanel.js.map +1 -0
- package/lib/module/AgentSphereIcon.js +237 -0
- package/lib/module/AgentSphereIcon.js.map +1 -0
- package/lib/module/AttachmentPickerStatusModal.js +91 -0
- package/lib/module/AttachmentPickerStatusModal.js.map +1 -0
- package/lib/module/AttachmentPreviewStrip.js +44 -0
- package/lib/module/AttachmentPreviewStrip.js.map +1 -0
- package/lib/module/ChannelsPanel.js +728 -0
- package/lib/module/ChannelsPanel.js.map +1 -0
- package/lib/module/ConversationChat.js +214 -0
- package/lib/module/ConversationChat.js.map +1 -0
- package/lib/module/ConversationComposer.js +318 -0
- package/lib/module/ConversationComposer.js.map +1 -0
- package/lib/module/ConversationMessageList.js +100 -0
- package/lib/module/ConversationMessageList.js.map +1 -0
- package/lib/module/ConversationScreen.js +236 -0
- package/lib/module/ConversationScreen.js.map +1 -0
- package/lib/module/EditorDrawer.js +1122 -0
- package/lib/module/EditorDrawer.js.map +1 -0
- package/lib/module/EditorTabPanel.js +23 -0
- package/lib/module/EditorTabPanel.js.map +1 -0
- package/lib/module/FilesPanel.js +528 -0
- package/lib/module/FilesPanel.js.map +1 -0
- package/lib/module/MarkdownText.js +308 -0
- package/lib/module/MarkdownText.js.map +1 -0
- package/lib/module/MessageActionBar.js +85 -0
- package/lib/module/MessageActionBar.js.map +1 -0
- package/lib/module/RenameAgentModal.js +94 -0
- package/lib/module/RenameAgentModal.js.map +1 -0
- package/lib/module/ShareAgentModal.js +344 -0
- package/lib/module/ShareAgentModal.js.map +1 -0
- package/lib/module/ShareAgentModal.styles.js +232 -0
- package/lib/module/ShareAgentModal.styles.js.map +1 -0
- package/lib/module/SuperagentHomeScreen.js +311 -0
- package/lib/module/SuperagentHomeScreen.js.map +1 -0
- package/lib/module/ToolApprovalCard.js +537 -0
- package/lib/module/ToolApprovalCard.js.map +1 -0
- package/lib/module/ToolCallSummary.js +627 -0
- package/lib/module/ToolCallSummary.js.map +1 -0
- package/lib/module/agentSphereStyles.js +34 -0
- package/lib/module/agentSphereStyles.js.map +1 -0
- package/lib/module/apiClient.js +154 -0
- package/lib/module/apiClient.js.map +1 -0
- package/lib/module/attachmentFileHelpers.js +97 -0
- package/lib/module/attachmentFileHelpers.js.map +1 -0
- package/lib/module/attachmentUpload.js +82 -0
- package/lib/module/attachmentUpload.js.map +1 -0
- package/lib/module/composerStyles.js +244 -0
- package/lib/module/composerStyles.js.map +1 -0
- package/lib/module/connectorBrandIcons.js +76 -0
- package/lib/module/connectorBrandIcons.js.map +1 -0
- package/lib/module/connectorCatalog.js +373 -0
- package/lib/module/connectorCatalog.js.map +1 -0
- package/lib/module/constants.js +10 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/conversationParts.js +266 -0
- package/lib/module/conversationParts.js.map +1 -0
- package/lib/module/conversationRuntime.js +129 -0
- package/lib/module/conversationRuntime.js.map +1 -0
- package/lib/module/conversationStyles.js +754 -0
- package/lib/module/conversationStyles.js.map +1 -0
- package/lib/module/editorShellStyles.js +1028 -0
- package/lib/module/editorShellStyles.js.map +1 -0
- package/lib/module/editorTabs.js +37 -0
- package/lib/module/editorTabs.js.map +1 -0
- package/lib/module/fileTreeUtils.js +120 -0
- package/lib/module/fileTreeUtils.js.map +1 -0
- package/lib/module/index.js +17 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/markdownStyles.js +153 -0
- package/lib/module/markdownStyles.js.map +1 -0
- package/lib/module/mediaUtils.js +53 -0
- package/lib/module/mediaUtils.js.map +1 -0
- package/lib/module/messageActionStyles.js +41 -0
- package/lib/module/messageActionStyles.js.map +1 -0
- package/lib/module/messageUtils.js +46 -0
- package/lib/module/messageUtils.js.map +1 -0
- package/lib/module/nativeActionSheet.js +17 -0
- package/lib/module/nativeActionSheet.js.map +1 -0
- package/lib/module/nativeActionSheet.web.js +6 -0
- package/lib/module/nativeActionSheet.web.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/paperTheme.js +55 -0
- package/lib/module/paperTheme.js.map +1 -0
- package/lib/module/realtimeClient.js +95 -0
- package/lib/module/realtimeClient.js.map +1 -0
- package/lib/module/renameAgentModalStyles.js +79 -0
- package/lib/module/renameAgentModalStyles.js.map +1 -0
- package/lib/module/screenParts.js +210 -0
- package/lib/module/screenParts.js.map +1 -0
- package/lib/module/styles.js +339 -0
- package/lib/module/styles.js.map +1 -0
- package/lib/module/superagentApiClient.js +609 -0
- package/lib/module/superagentApiClient.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/useSuperagentAttachmentPicker.js +75 -0
- package/lib/module/useSuperagentAttachmentPicker.js.map +1 -0
- package/lib/module/useSuperagentConversation.js +212 -0
- package/lib/module/useSuperagentConversation.js.map +1 -0
- package/lib/module/useSuperagentRuntime.js +1203 -0
- package/lib/module/useSuperagentRuntime.js.map +1 -0
- package/lib/typescript/commonjs/AgentSettingsPanel.d.ts +19 -0
- package/lib/typescript/commonjs/AgentSettingsPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/AgentSphereIcon.d.ts +15 -0
- package/lib/typescript/commonjs/AgentSphereIcon.d.ts.map +1 -0
- package/lib/typescript/commonjs/AttachmentPickerStatusModal.d.ts +8 -0
- package/lib/typescript/commonjs/AttachmentPickerStatusModal.d.ts.map +1 -0
- package/lib/typescript/commonjs/AttachmentPreviewStrip.d.ts +7 -0
- package/lib/typescript/commonjs/AttachmentPreviewStrip.d.ts.map +1 -0
- package/lib/typescript/commonjs/ChannelsPanel.d.ts +21 -0
- package/lib/typescript/commonjs/ChannelsPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/ConversationChat.d.ts +22 -0
- package/lib/typescript/commonjs/ConversationChat.d.ts.map +1 -0
- package/lib/typescript/commonjs/ConversationComposer.d.ts +24 -0
- package/lib/typescript/commonjs/ConversationComposer.d.ts.map +1 -0
- package/lib/typescript/commonjs/ConversationMessageList.d.ts +17 -0
- package/lib/typescript/commonjs/ConversationMessageList.d.ts.map +1 -0
- package/lib/typescript/commonjs/ConversationScreen.d.ts +80 -0
- package/lib/typescript/commonjs/ConversationScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/EditorDrawer.d.ts +67 -0
- package/lib/typescript/commonjs/EditorDrawer.d.ts.map +1 -0
- package/lib/typescript/commonjs/EditorTabPanel.d.ts +6 -0
- package/lib/typescript/commonjs/EditorTabPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/FilesPanel.d.ts +14 -0
- package/lib/typescript/commonjs/FilesPanel.d.ts.map +1 -0
- package/lib/typescript/commonjs/MarkdownText.d.ts +10 -0
- package/lib/typescript/commonjs/MarkdownText.d.ts.map +1 -0
- package/lib/typescript/commonjs/MessageActionBar.d.ts +8 -0
- package/lib/typescript/commonjs/MessageActionBar.d.ts.map +1 -0
- package/lib/typescript/commonjs/RenameAgentModal.d.ts +10 -0
- package/lib/typescript/commonjs/RenameAgentModal.d.ts.map +1 -0
- package/lib/typescript/commonjs/ShareAgentModal.d.ts +15 -0
- package/lib/typescript/commonjs/ShareAgentModal.d.ts.map +1 -0
- package/lib/typescript/commonjs/ShareAgentModal.styles.d.ts +229 -0
- package/lib/typescript/commonjs/ShareAgentModal.styles.d.ts.map +1 -0
- package/lib/typescript/commonjs/SuperagentHomeScreen.d.ts +4 -0
- package/lib/typescript/commonjs/SuperagentHomeScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ToolApprovalCard.d.ts +13 -0
- package/lib/typescript/commonjs/ToolApprovalCard.d.ts.map +1 -0
- package/lib/typescript/commonjs/ToolCallSummary.d.ts +16 -0
- package/lib/typescript/commonjs/ToolCallSummary.d.ts.map +1 -0
- package/lib/typescript/commonjs/agentSphereStyles.d.ts +31 -0
- package/lib/typescript/commonjs/agentSphereStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/apiClient.d.ts +4 -0
- package/lib/typescript/commonjs/apiClient.d.ts.map +1 -0
- package/lib/typescript/commonjs/attachmentFileHelpers.d.ts +6 -0
- package/lib/typescript/commonjs/attachmentFileHelpers.d.ts.map +1 -0
- package/lib/typescript/commonjs/attachmentUpload.d.ts +12 -0
- package/lib/typescript/commonjs/attachmentUpload.d.ts.map +1 -0
- package/lib/typescript/commonjs/composerStyles.d.ts +241 -0
- package/lib/typescript/commonjs/composerStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/connectorBrandIcons.d.ts +7 -0
- package/lib/typescript/commonjs/connectorBrandIcons.d.ts.map +1 -0
- package/lib/typescript/commonjs/connectorCatalog.d.ts +3 -0
- package/lib/typescript/commonjs/connectorCatalog.d.ts.map +1 -0
- package/lib/typescript/commonjs/constants.d.ts +4 -0
- package/lib/typescript/commonjs/constants.d.ts.map +1 -0
- package/lib/typescript/commonjs/conversationParts.d.ts +29 -0
- package/lib/typescript/commonjs/conversationParts.d.ts.map +1 -0
- package/lib/typescript/commonjs/conversationRuntime.d.ts +67 -0
- package/lib/typescript/commonjs/conversationRuntime.d.ts.map +1 -0
- package/lib/typescript/commonjs/conversationStyles.d.ts +742 -0
- package/lib/typescript/commonjs/conversationStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/editorShellStyles.d.ts +1025 -0
- package/lib/typescript/commonjs/editorShellStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/editorTabs.d.ts +11 -0
- package/lib/typescript/commonjs/editorTabs.d.ts.map +1 -0
- package/lib/typescript/commonjs/fileTreeUtils.d.ts +17 -0
- package/lib/typescript/commonjs/fileTreeUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +20 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/markdownStyles.d.ts +150 -0
- package/lib/typescript/commonjs/markdownStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/mediaUtils.d.ts +9 -0
- package/lib/typescript/commonjs/mediaUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/messageActionStyles.d.ts +38 -0
- package/lib/typescript/commonjs/messageActionStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/messageUtils.d.ts +8 -0
- package/lib/typescript/commonjs/messageUtils.d.ts.map +1 -0
- package/lib/typescript/commonjs/nativeActionSheet.d.ts +6 -0
- package/lib/typescript/commonjs/nativeActionSheet.d.ts.map +1 -0
- package/lib/typescript/commonjs/nativeActionSheet.web.d.ts +3 -0
- package/lib/typescript/commonjs/nativeActionSheet.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/paperTheme.d.ts +3 -0
- package/lib/typescript/commonjs/paperTheme.d.ts.map +1 -0
- package/lib/typescript/commonjs/realtimeClient.d.ts +16 -0
- package/lib/typescript/commonjs/realtimeClient.d.ts.map +1 -0
- package/lib/typescript/commonjs/renameAgentModalStyles.d.ts +76 -0
- package/lib/typescript/commonjs/renameAgentModalStyles.d.ts.map +1 -0
- package/lib/typescript/commonjs/screenParts.d.ts +31 -0
- package/lib/typescript/commonjs/screenParts.d.ts.map +1 -0
- package/lib/typescript/commonjs/styles.d.ts +336 -0
- package/lib/typescript/commonjs/styles.d.ts.map +1 -0
- package/lib/typescript/commonjs/superagentApiClient.d.ts +66 -0
- package/lib/typescript/commonjs/superagentApiClient.d.ts.map +1 -0
- package/lib/typescript/commonjs/types.d.ts +437 -0
- package/lib/typescript/commonjs/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/useSuperagentAttachmentPicker.d.ts +30 -0
- package/lib/typescript/commonjs/useSuperagentAttachmentPicker.d.ts.map +1 -0
- package/lib/typescript/commonjs/useSuperagentConversation.d.ts +36 -0
- package/lib/typescript/commonjs/useSuperagentConversation.d.ts.map +1 -0
- package/lib/typescript/commonjs/useSuperagentRuntime.d.ts +163 -0
- package/lib/typescript/commonjs/useSuperagentRuntime.d.ts.map +1 -0
- package/lib/typescript/module/AgentSettingsPanel.d.ts +19 -0
- package/lib/typescript/module/AgentSettingsPanel.d.ts.map +1 -0
- package/lib/typescript/module/AgentSphereIcon.d.ts +15 -0
- package/lib/typescript/module/AgentSphereIcon.d.ts.map +1 -0
- package/lib/typescript/module/AttachmentPickerStatusModal.d.ts +8 -0
- package/lib/typescript/module/AttachmentPickerStatusModal.d.ts.map +1 -0
- package/lib/typescript/module/AttachmentPreviewStrip.d.ts +7 -0
- package/lib/typescript/module/AttachmentPreviewStrip.d.ts.map +1 -0
- package/lib/typescript/module/ChannelsPanel.d.ts +21 -0
- package/lib/typescript/module/ChannelsPanel.d.ts.map +1 -0
- package/lib/typescript/module/ConversationChat.d.ts +22 -0
- package/lib/typescript/module/ConversationChat.d.ts.map +1 -0
- package/lib/typescript/module/ConversationComposer.d.ts +24 -0
- package/lib/typescript/module/ConversationComposer.d.ts.map +1 -0
- package/lib/typescript/module/ConversationMessageList.d.ts +17 -0
- package/lib/typescript/module/ConversationMessageList.d.ts.map +1 -0
- package/lib/typescript/module/ConversationScreen.d.ts +80 -0
- package/lib/typescript/module/ConversationScreen.d.ts.map +1 -0
- package/lib/typescript/module/EditorDrawer.d.ts +67 -0
- package/lib/typescript/module/EditorDrawer.d.ts.map +1 -0
- package/lib/typescript/module/EditorTabPanel.d.ts +6 -0
- package/lib/typescript/module/EditorTabPanel.d.ts.map +1 -0
- package/lib/typescript/module/FilesPanel.d.ts +14 -0
- package/lib/typescript/module/FilesPanel.d.ts.map +1 -0
- package/lib/typescript/module/MarkdownText.d.ts +10 -0
- package/lib/typescript/module/MarkdownText.d.ts.map +1 -0
- package/lib/typescript/module/MessageActionBar.d.ts +8 -0
- package/lib/typescript/module/MessageActionBar.d.ts.map +1 -0
- package/lib/typescript/module/RenameAgentModal.d.ts +10 -0
- package/lib/typescript/module/RenameAgentModal.d.ts.map +1 -0
- package/lib/typescript/module/ShareAgentModal.d.ts +15 -0
- package/lib/typescript/module/ShareAgentModal.d.ts.map +1 -0
- package/lib/typescript/module/ShareAgentModal.styles.d.ts +229 -0
- package/lib/typescript/module/ShareAgentModal.styles.d.ts.map +1 -0
- package/lib/typescript/module/SuperagentHomeScreen.d.ts +4 -0
- package/lib/typescript/module/SuperagentHomeScreen.d.ts.map +1 -0
- package/lib/typescript/module/ToolApprovalCard.d.ts +13 -0
- package/lib/typescript/module/ToolApprovalCard.d.ts.map +1 -0
- package/lib/typescript/module/ToolCallSummary.d.ts +16 -0
- package/lib/typescript/module/ToolCallSummary.d.ts.map +1 -0
- package/lib/typescript/module/agentSphereStyles.d.ts +31 -0
- package/lib/typescript/module/agentSphereStyles.d.ts.map +1 -0
- package/lib/typescript/module/apiClient.d.ts +4 -0
- package/lib/typescript/module/apiClient.d.ts.map +1 -0
- package/lib/typescript/module/attachmentFileHelpers.d.ts +6 -0
- package/lib/typescript/module/attachmentFileHelpers.d.ts.map +1 -0
- package/lib/typescript/module/attachmentUpload.d.ts +12 -0
- package/lib/typescript/module/attachmentUpload.d.ts.map +1 -0
- package/lib/typescript/module/composerStyles.d.ts +241 -0
- package/lib/typescript/module/composerStyles.d.ts.map +1 -0
- package/lib/typescript/module/connectorBrandIcons.d.ts +7 -0
- package/lib/typescript/module/connectorBrandIcons.d.ts.map +1 -0
- package/lib/typescript/module/connectorCatalog.d.ts +3 -0
- package/lib/typescript/module/connectorCatalog.d.ts.map +1 -0
- package/lib/typescript/module/constants.d.ts +4 -0
- package/lib/typescript/module/constants.d.ts.map +1 -0
- package/lib/typescript/module/conversationParts.d.ts +29 -0
- package/lib/typescript/module/conversationParts.d.ts.map +1 -0
- package/lib/typescript/module/conversationRuntime.d.ts +67 -0
- package/lib/typescript/module/conversationRuntime.d.ts.map +1 -0
- package/lib/typescript/module/conversationStyles.d.ts +742 -0
- package/lib/typescript/module/conversationStyles.d.ts.map +1 -0
- package/lib/typescript/module/editorShellStyles.d.ts +1025 -0
- package/lib/typescript/module/editorShellStyles.d.ts.map +1 -0
- package/lib/typescript/module/editorTabs.d.ts +11 -0
- package/lib/typescript/module/editorTabs.d.ts.map +1 -0
- package/lib/typescript/module/fileTreeUtils.d.ts +17 -0
- package/lib/typescript/module/fileTreeUtils.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +20 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/markdownStyles.d.ts +150 -0
- package/lib/typescript/module/markdownStyles.d.ts.map +1 -0
- package/lib/typescript/module/mediaUtils.d.ts +9 -0
- package/lib/typescript/module/mediaUtils.d.ts.map +1 -0
- package/lib/typescript/module/messageActionStyles.d.ts +38 -0
- package/lib/typescript/module/messageActionStyles.d.ts.map +1 -0
- package/lib/typescript/module/messageUtils.d.ts +8 -0
- package/lib/typescript/module/messageUtils.d.ts.map +1 -0
- package/lib/typescript/module/nativeActionSheet.d.ts +6 -0
- package/lib/typescript/module/nativeActionSheet.d.ts.map +1 -0
- package/lib/typescript/module/nativeActionSheet.web.d.ts +3 -0
- package/lib/typescript/module/nativeActionSheet.web.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/paperTheme.d.ts +3 -0
- package/lib/typescript/module/paperTheme.d.ts.map +1 -0
- package/lib/typescript/module/realtimeClient.d.ts +16 -0
- package/lib/typescript/module/realtimeClient.d.ts.map +1 -0
- package/lib/typescript/module/renameAgentModalStyles.d.ts +76 -0
- package/lib/typescript/module/renameAgentModalStyles.d.ts.map +1 -0
- package/lib/typescript/module/screenParts.d.ts +31 -0
- package/lib/typescript/module/screenParts.d.ts.map +1 -0
- package/lib/typescript/module/styles.d.ts +336 -0
- package/lib/typescript/module/styles.d.ts.map +1 -0
- package/lib/typescript/module/superagentApiClient.d.ts +66 -0
- package/lib/typescript/module/superagentApiClient.d.ts.map +1 -0
- package/lib/typescript/module/types.d.ts +437 -0
- package/lib/typescript/module/types.d.ts.map +1 -0
- package/lib/typescript/module/useSuperagentAttachmentPicker.d.ts +30 -0
- package/lib/typescript/module/useSuperagentAttachmentPicker.d.ts.map +1 -0
- package/lib/typescript/module/useSuperagentConversation.d.ts +36 -0
- package/lib/typescript/module/useSuperagentConversation.d.ts.map +1 -0
- package/lib/typescript/module/useSuperagentRuntime.d.ts +163 -0
- package/lib/typescript/module/useSuperagentRuntime.d.ts.map +1 -0
- package/package.json +87 -0
- package/src/AgentSettingsPanel.tsx +1122 -0
- package/src/AgentSphereIcon.tsx +170 -0
- package/src/AttachmentPickerStatusModal.tsx +80 -0
- package/src/AttachmentPreviewStrip.tsx +38 -0
- package/src/ChannelsPanel.tsx +705 -0
- package/src/ConversationChat.tsx +245 -0
- package/src/ConversationComposer.tsx +368 -0
- package/src/ConversationMessageList.tsx +140 -0
- package/src/ConversationScreen.tsx +320 -0
- package/src/EditorDrawer.tsx +1297 -0
- package/src/EditorTabPanel.tsx +19 -0
- package/src/FilesPanel.tsx +577 -0
- package/src/MarkdownText.tsx +317 -0
- package/src/MessageActionBar.tsx +126 -0
- package/src/RenameAgentModal.tsx +107 -0
- package/src/ShareAgentModal.styles.ts +95 -0
- package/src/ShareAgentModal.tsx +320 -0
- package/src/SuperagentHomeScreen.tsx +318 -0
- package/src/ToolApprovalCard.tsx +592 -0
- package/src/ToolCallSummary.tsx +599 -0
- package/src/agentSphereStyles.ts +25 -0
- package/src/apiClient.ts +189 -0
- package/src/attachmentFileHelpers.ts +109 -0
- package/src/attachmentUpload.ts +112 -0
- package/src/composerStyles.ts +167 -0
- package/src/connectorBrandIcons.tsx +69 -0
- package/src/connectorCatalog.ts +414 -0
- package/src/constants.ts +9 -0
- package/src/conversationParts.tsx +307 -0
- package/src/conversationRuntime.ts +171 -0
- package/src/conversationStyles.ts +412 -0
- package/src/editorShellStyles.ts +1023 -0
- package/src/editorTabs.ts +26 -0
- package/src/fileTreeUtils.ts +165 -0
- package/src/index.ts +110 -0
- package/src/markdownStyles.ts +64 -0
- package/src/mediaUtils.ts +75 -0
- package/src/messageActionStyles.ts +26 -0
- package/src/messageUtils.ts +58 -0
- package/src/nativeActionSheet.ts +25 -0
- package/src/nativeActionSheet.web.ts +5 -0
- package/src/paperTheme.ts +52 -0
- package/src/realtimeClient.ts +149 -0
- package/src/renameAgentModalStyles.ts +77 -0
- package/src/screenParts.tsx +185 -0
- package/src/styles.ts +190 -0
- package/src/superagentApiClient.ts +895 -0
- package/src/types.ts +514 -0
- package/src/useSuperagentAttachmentPicker.tsx +117 -0
- package/src/useSuperagentConversation.ts +242 -0
- package/src/useSuperagentRuntime.ts +1371 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { ActivityIndicator, Pressable, ScrollView, Text, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { ConversationComposer } from './ConversationComposer';
|
|
5
|
+
import { ConversationMessageList } from './ConversationMessageList';
|
|
6
|
+
import { TypingIndicator } from './conversationParts';
|
|
7
|
+
import { conversationStyles } from './conversationStyles';
|
|
8
|
+
import { buildAttachmentPrompt, MAX_ATTACHMENTS } from './mediaUtils';
|
|
9
|
+
import type {
|
|
10
|
+
SuperagentAgent,
|
|
11
|
+
SuperagentConnector,
|
|
12
|
+
SuperagentConnectorActionInput,
|
|
13
|
+
SuperagentCopyMessageInput,
|
|
14
|
+
SuperagentLiveVoiceInput,
|
|
15
|
+
SuperagentMarkdownRenderer,
|
|
16
|
+
SuperagentMediaAttachment,
|
|
17
|
+
SuperagentMediaPicker,
|
|
18
|
+
SuperagentMessage,
|
|
19
|
+
SuperagentReplyTo,
|
|
20
|
+
SuperagentToolRenderers,
|
|
21
|
+
SuperagentVoiceInput,
|
|
22
|
+
} from './types';
|
|
23
|
+
import type { useSuperagentConversation } from './useSuperagentConversation';
|
|
24
|
+
|
|
25
|
+
const MAX_CHAT_WIDTH = 900;
|
|
26
|
+
|
|
27
|
+
type ConversationState = ReturnType<typeof useSuperagentConversation>;
|
|
28
|
+
|
|
29
|
+
export function ConversationChat({
|
|
30
|
+
agent,
|
|
31
|
+
availableConnectors,
|
|
32
|
+
conversation,
|
|
33
|
+
currentUserAvatarUrl,
|
|
34
|
+
onConnectConnector,
|
|
35
|
+
onCopyMessage,
|
|
36
|
+
onImportFromDrive,
|
|
37
|
+
onPickFiles,
|
|
38
|
+
onPickPhotos,
|
|
39
|
+
onStartLiveVoice,
|
|
40
|
+
onStartVoiceInput,
|
|
41
|
+
onTakePhoto,
|
|
42
|
+
renderMarkdown,
|
|
43
|
+
toolRenderers,
|
|
44
|
+
}: {
|
|
45
|
+
agent: SuperagentAgent;
|
|
46
|
+
availableConnectors?: SuperagentConnector[];
|
|
47
|
+
conversation: ConversationState;
|
|
48
|
+
currentUserAvatarUrl?: string | null;
|
|
49
|
+
onConnectConnector?: (input: SuperagentConnectorActionInput) => Promise<boolean | void> | boolean | void;
|
|
50
|
+
onImportFromDrive?: SuperagentMediaPicker;
|
|
51
|
+
onCopyMessage?: SuperagentCopyMessageInput;
|
|
52
|
+
onPickFiles?: SuperagentMediaPicker;
|
|
53
|
+
onPickPhotos?: SuperagentMediaPicker;
|
|
54
|
+
onStartLiveVoice?: SuperagentLiveVoiceInput;
|
|
55
|
+
onStartVoiceInput?: SuperagentVoiceInput;
|
|
56
|
+
onTakePhoto?: SuperagentMediaPicker;
|
|
57
|
+
renderMarkdown?: SuperagentMarkdownRenderer;
|
|
58
|
+
toolRenderers?: SuperagentToolRenderers;
|
|
59
|
+
}) {
|
|
60
|
+
const scrollRef = useRef<ScrollView>(null);
|
|
61
|
+
const shouldAutoScrollRef = useRef(true);
|
|
62
|
+
const lastTailMessageIdRef = useRef<string | null>(null);
|
|
63
|
+
const [draft, setDraft] = useState('');
|
|
64
|
+
const [attachments, setAttachments] = useState<SuperagentMediaAttachment[]>([]);
|
|
65
|
+
const [replyTo, setReplyTo] = useState<SuperagentReplyTo | null>(null);
|
|
66
|
+
const canSend = (draft.trim().length > 0 || attachments.length > 0) && !conversation.isSending;
|
|
67
|
+
const displayedMessages = useMemo(
|
|
68
|
+
() => (conversation.messages.length > 0 ? conversation.messages : [createWelcomeMessage(agent)]),
|
|
69
|
+
[agent, conversation.messages],
|
|
70
|
+
);
|
|
71
|
+
const tailMessage = displayedMessages[displayedMessages.length - 1];
|
|
72
|
+
const tailMessageId = tailMessage ? getMessageAutoScrollId(tailMessage, displayedMessages.length - 1) : null;
|
|
73
|
+
const tailMessageContent = tailMessage?.content ?? '';
|
|
74
|
+
|
|
75
|
+
const scrollToBottom = useCallback((animated = true) => {
|
|
76
|
+
setTimeout(() => scrollRef.current?.scrollToEnd({ animated }), 0);
|
|
77
|
+
}, []);
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (!tailMessageId) return;
|
|
81
|
+
|
|
82
|
+
const tailMessageChanged = lastTailMessageIdRef.current !== tailMessageId;
|
|
83
|
+
if (tailMessageChanged) {
|
|
84
|
+
lastTailMessageIdRef.current = tailMessageId;
|
|
85
|
+
shouldAutoScrollRef.current = true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (shouldAutoScrollRef.current) {
|
|
89
|
+
scrollToBottom(tailMessageChanged);
|
|
90
|
+
}
|
|
91
|
+
}, [conversation.isSending, scrollToBottom, tailMessageContent, tailMessageId]);
|
|
92
|
+
|
|
93
|
+
const pauseAutoScroll = useCallback(() => {
|
|
94
|
+
shouldAutoScrollRef.current = false;
|
|
95
|
+
}, []);
|
|
96
|
+
|
|
97
|
+
const scrollAfterContentResize = useCallback(() => {
|
|
98
|
+
if (shouldAutoScrollRef.current) {
|
|
99
|
+
scrollToBottom(false);
|
|
100
|
+
}
|
|
101
|
+
}, [scrollToBottom]);
|
|
102
|
+
|
|
103
|
+
const sendMessage = useCallback(async () => {
|
|
104
|
+
const selectedAttachments = attachments;
|
|
105
|
+
const selectedReplyTo = replyTo;
|
|
106
|
+
const content = draft.trim() || buildAttachmentPrompt(selectedAttachments);
|
|
107
|
+
if ((!content && selectedAttachments.length === 0) || conversation.isSending) return;
|
|
108
|
+
|
|
109
|
+
setDraft('');
|
|
110
|
+
setAttachments([]);
|
|
111
|
+
setReplyTo(null);
|
|
112
|
+
|
|
113
|
+
await conversation.sendMessage(content, {
|
|
114
|
+
fileUrls: selectedAttachments.map((attachment) => attachment.url),
|
|
115
|
+
replyTo: selectedReplyTo ?? undefined,
|
|
116
|
+
});
|
|
117
|
+
}, [attachments, conversation, draft, replyTo]);
|
|
118
|
+
|
|
119
|
+
const addAttachments = useCallback((incoming: SuperagentMediaAttachment[]) => {
|
|
120
|
+
setAttachments((current) => [...current, ...incoming].slice(0, MAX_ATTACHMENTS));
|
|
121
|
+
}, []);
|
|
122
|
+
|
|
123
|
+
const appendTranscript = useCallback((transcript: string) => {
|
|
124
|
+
setDraft((current) => (current ? `${current} ${transcript}` : transcript));
|
|
125
|
+
}, []);
|
|
126
|
+
|
|
127
|
+
const replyToMessage = useCallback((message: SuperagentMessage) => {
|
|
128
|
+
const content = message.content.trim();
|
|
129
|
+
if (!content) return;
|
|
130
|
+
setReplyTo({
|
|
131
|
+
content,
|
|
132
|
+
messageId: message.id,
|
|
133
|
+
});
|
|
134
|
+
}, []);
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<>
|
|
138
|
+
<ScrollView
|
|
139
|
+
ref={scrollRef}
|
|
140
|
+
contentContainerStyle={conversationStyles.scrollContent}
|
|
141
|
+
onContentSizeChange={scrollAfterContentResize}
|
|
142
|
+
onScrollBeginDrag={pauseAutoScroll}
|
|
143
|
+
onTouchStart={pauseAutoScroll}
|
|
144
|
+
>
|
|
145
|
+
<View style={[conversationStyles.messagesContainer, { maxWidth: MAX_CHAT_WIDTH }]}>
|
|
146
|
+
<ConversationStates conversation={conversation} />
|
|
147
|
+
<ConversationMessageList
|
|
148
|
+
agent={agent}
|
|
149
|
+
availableConnectors={availableConnectors}
|
|
150
|
+
conversationId={conversation.conversationId}
|
|
151
|
+
currentUserAvatarUrl={currentUserAvatarUrl}
|
|
152
|
+
messages={displayedMessages}
|
|
153
|
+
onConnectConnector={onConnectConnector}
|
|
154
|
+
onCopyMessage={onCopyMessage}
|
|
155
|
+
onDeleteMessage={conversation.deleteMessage}
|
|
156
|
+
onReplyMessage={replyToMessage}
|
|
157
|
+
renderMarkdown={renderMarkdown}
|
|
158
|
+
submitToolCallInput={conversation.submitToolCallInput}
|
|
159
|
+
toolRenderers={toolRenderers}
|
|
160
|
+
/>
|
|
161
|
+
{conversation.isSending ? <TypingIndicator /> : null}
|
|
162
|
+
{conversation.queuedMessages.length > 0 ? (
|
|
163
|
+
<QueuedMessages messages={conversation.queuedMessages} />
|
|
164
|
+
) : null}
|
|
165
|
+
</View>
|
|
166
|
+
</ScrollView>
|
|
167
|
+
<ConversationComposer
|
|
168
|
+
attachments={attachments}
|
|
169
|
+
canSend={canSend}
|
|
170
|
+
context={{ agentId: agent.id, conversationId: conversation.conversationId }}
|
|
171
|
+
draft={draft}
|
|
172
|
+
isSending={conversation.isSending}
|
|
173
|
+
onAddAttachments={addAttachments}
|
|
174
|
+
onAppendTranscript={appendTranscript}
|
|
175
|
+
onChangeDraft={setDraft}
|
|
176
|
+
onClearReply={() => setReplyTo(null)}
|
|
177
|
+
onImportFromDrive={onImportFromDrive}
|
|
178
|
+
onPickFiles={onPickFiles}
|
|
179
|
+
onPickPhotos={onPickPhotos}
|
|
180
|
+
onRemoveAttachment={(index) => setAttachments((current) => current.filter((_, itemIndex) => itemIndex !== index))}
|
|
181
|
+
onSend={sendMessage}
|
|
182
|
+
onStartLiveVoice={onStartLiveVoice}
|
|
183
|
+
onStartVoiceInput={onStartVoiceInput}
|
|
184
|
+
onStop={conversation.stop}
|
|
185
|
+
onTakePhoto={onTakePhoto}
|
|
186
|
+
replyTo={replyTo}
|
|
187
|
+
/>
|
|
188
|
+
</>
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function ConversationStates({ conversation }: { conversation: ConversationState }) {
|
|
193
|
+
return (
|
|
194
|
+
<>
|
|
195
|
+
{conversation.hasMoreMessages ? (
|
|
196
|
+
<Pressable accessibilityRole="button" onPress={conversation.loadPrevious} style={conversationStyles.loadPreviousButton}>
|
|
197
|
+
<Text style={conversationStyles.loadPreviousText}>Load previous messages</Text>
|
|
198
|
+
</Pressable>
|
|
199
|
+
) : null}
|
|
200
|
+
{conversation.initError ? <ErrorPanel message={conversation.initError} /> : null}
|
|
201
|
+
{conversation.isLoading ? <LoadingPanel /> : null}
|
|
202
|
+
</>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function LoadingPanel() {
|
|
207
|
+
return (
|
|
208
|
+
<View style={conversationStyles.statePanel}>
|
|
209
|
+
<ActivityIndicator color="#FF5A1F" size="small" />
|
|
210
|
+
<Text style={conversationStyles.statePanelText}>Loading conversation...</Text>
|
|
211
|
+
</View>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function ErrorPanel({ message }: { message: string }) {
|
|
216
|
+
return (
|
|
217
|
+
<View style={conversationStyles.errorPanel}>
|
|
218
|
+
<Text style={conversationStyles.errorPanelTitle}>Something went wrong</Text>
|
|
219
|
+
<Text style={conversationStyles.errorPanelText}>{message}</Text>
|
|
220
|
+
</View>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function QueuedMessages({ messages }: { messages: Array<{ id: string; content: string }> }) {
|
|
225
|
+
return (
|
|
226
|
+
<View style={conversationStyles.queuedWrap}>
|
|
227
|
+
<Text style={conversationStyles.queuedTitle}>Queued ({messages.length})</Text>
|
|
228
|
+
{messages.map((message) => (
|
|
229
|
+
<Text key={message.id} style={conversationStyles.queuedMessage} numberOfLines={2}>{message.content}</Text>
|
|
230
|
+
))}
|
|
231
|
+
</View>
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function createWelcomeMessage(agent: SuperagentAgent): SuperagentMessage {
|
|
236
|
+
return {
|
|
237
|
+
id: 'welcome',
|
|
238
|
+
role: 'assistant',
|
|
239
|
+
content: `Tell ${agent.name || 'your Superagent'} what you want to get done.`,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function getMessageAutoScrollId(message: SuperagentMessage, index: number) {
|
|
244
|
+
return message.id ?? `${message.role}-${index}`;
|
|
245
|
+
}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import { Alert, Pressable, Text, TextInput, View } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
AudioLines,
|
|
5
|
+
Camera,
|
|
6
|
+
FileText,
|
|
7
|
+
Image as ImageIcon,
|
|
8
|
+
Paperclip,
|
|
9
|
+
Plus,
|
|
10
|
+
Send,
|
|
11
|
+
Square,
|
|
12
|
+
X,
|
|
13
|
+
type LucideIcon,
|
|
14
|
+
} from 'lucide-react-native';
|
|
15
|
+
|
|
16
|
+
import { AttachmentPreviewStrip } from './AttachmentPreviewStrip';
|
|
17
|
+
import { composerStyles } from './composerStyles';
|
|
18
|
+
import { MAX_ATTACHMENTS, normalizeMediaAttachments } from './mediaUtils';
|
|
19
|
+
import { showNativeActionSheet } from './nativeActionSheet';
|
|
20
|
+
import { styles } from './styles';
|
|
21
|
+
import type {
|
|
22
|
+
SuperagentLiveVoiceInput,
|
|
23
|
+
SuperagentMediaActionContext,
|
|
24
|
+
SuperagentMediaAttachment,
|
|
25
|
+
SuperagentMediaPicker,
|
|
26
|
+
SuperagentReplyTo,
|
|
27
|
+
SuperagentVoiceInput,
|
|
28
|
+
} from './types';
|
|
29
|
+
|
|
30
|
+
const MAX_CHAT_WIDTH = 900;
|
|
31
|
+
|
|
32
|
+
type VoiceState = 'idle' | 'processing';
|
|
33
|
+
type AttachmentAction = {
|
|
34
|
+
label: string;
|
|
35
|
+
picker: SuperagentMediaPicker;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function ConversationComposer({
|
|
39
|
+
attachments,
|
|
40
|
+
canSend,
|
|
41
|
+
context,
|
|
42
|
+
draft,
|
|
43
|
+
isSending,
|
|
44
|
+
onAddAttachments,
|
|
45
|
+
onAppendTranscript,
|
|
46
|
+
onChangeDraft,
|
|
47
|
+
onClearReply,
|
|
48
|
+
onImportFromDrive,
|
|
49
|
+
onPickFiles,
|
|
50
|
+
onPickPhotos,
|
|
51
|
+
onRemoveAttachment,
|
|
52
|
+
onSend,
|
|
53
|
+
onStartLiveVoice,
|
|
54
|
+
onStartVoiceInput,
|
|
55
|
+
onStop,
|
|
56
|
+
onTakePhoto,
|
|
57
|
+
replyTo,
|
|
58
|
+
}: {
|
|
59
|
+
attachments: SuperagentMediaAttachment[];
|
|
60
|
+
canSend: boolean;
|
|
61
|
+
context: SuperagentMediaActionContext;
|
|
62
|
+
draft: string;
|
|
63
|
+
isSending: boolean;
|
|
64
|
+
onAddAttachments: (attachments: SuperagentMediaAttachment[]) => void;
|
|
65
|
+
onAppendTranscript: (transcript: string) => void;
|
|
66
|
+
onChangeDraft: (value: string) => void;
|
|
67
|
+
onClearReply: () => void;
|
|
68
|
+
onImportFromDrive?: SuperagentMediaPicker;
|
|
69
|
+
onPickFiles?: SuperagentMediaPicker;
|
|
70
|
+
onPickPhotos?: SuperagentMediaPicker;
|
|
71
|
+
onRemoveAttachment: (index: number) => void;
|
|
72
|
+
onSend: () => void;
|
|
73
|
+
onStartLiveVoice?: SuperagentLiveVoiceInput;
|
|
74
|
+
onStartVoiceInput?: SuperagentVoiceInput;
|
|
75
|
+
onStop: () => void;
|
|
76
|
+
onTakePhoto?: SuperagentMediaPicker;
|
|
77
|
+
replyTo: SuperagentReplyTo | null;
|
|
78
|
+
}) {
|
|
79
|
+
const [voiceState, setVoiceState] = useState<VoiceState>('idle');
|
|
80
|
+
const [liveVoiceState, setLiveVoiceState] = useState<VoiceState>('idle');
|
|
81
|
+
const [mediaError, setMediaError] = useState<string | null>(null);
|
|
82
|
+
const [isAttachmentMenuOpen, setIsAttachmentMenuOpen] = useState(false);
|
|
83
|
+
|
|
84
|
+
const addFromPicker = useCallback(async (picker: SuperagentMediaPicker | undefined) => {
|
|
85
|
+
if (!picker || attachments.length >= MAX_ATTACHMENTS) return;
|
|
86
|
+
setIsAttachmentMenuOpen(false);
|
|
87
|
+
setMediaError(null);
|
|
88
|
+
try {
|
|
89
|
+
const next = normalizeMediaAttachments(await picker(context));
|
|
90
|
+
if (next.length === 0) return;
|
|
91
|
+
onAddAttachments(next.slice(0, MAX_ATTACHMENTS - attachments.length));
|
|
92
|
+
} catch (error) {
|
|
93
|
+
setMediaError(error instanceof Error ? error.message : 'Failed to attach media');
|
|
94
|
+
}
|
|
95
|
+
}, [attachments.length, context, onAddAttachments]);
|
|
96
|
+
|
|
97
|
+
const startVoiceInput = useCallback(async () => {
|
|
98
|
+
if (!onStartVoiceInput || voiceState !== 'idle') return;
|
|
99
|
+
setMediaError(null);
|
|
100
|
+
setVoiceState('processing');
|
|
101
|
+
try {
|
|
102
|
+
const transcript = (await onStartVoiceInput(context))?.trim();
|
|
103
|
+
if (transcript) onAppendTranscript(transcript);
|
|
104
|
+
else setMediaError('No speech detected. Please try again.');
|
|
105
|
+
} catch (error) {
|
|
106
|
+
setMediaError(error instanceof Error ? error.message : 'Failed to transcribe audio');
|
|
107
|
+
} finally {
|
|
108
|
+
setVoiceState('idle');
|
|
109
|
+
}
|
|
110
|
+
}, [context, onAppendTranscript, onStartVoiceInput, voiceState]);
|
|
111
|
+
|
|
112
|
+
const startLiveVoice = useCallback(async () => {
|
|
113
|
+
if (!onStartLiveVoice || liveVoiceState !== 'idle') return;
|
|
114
|
+
setMediaError(null);
|
|
115
|
+
setLiveVoiceState('processing');
|
|
116
|
+
try {
|
|
117
|
+
await onStartLiveVoice(context);
|
|
118
|
+
} catch (error) {
|
|
119
|
+
Alert.alert(
|
|
120
|
+
'Live Voice unavailable',
|
|
121
|
+
error instanceof Error ? error.message : 'Failed to start Live Voice',
|
|
122
|
+
);
|
|
123
|
+
} finally {
|
|
124
|
+
setLiveVoiceState('idle');
|
|
125
|
+
}
|
|
126
|
+
}, [context, liveVoiceState, onStartLiveVoice]);
|
|
127
|
+
|
|
128
|
+
const canAttach = Boolean(onImportFromDrive || onPickFiles || onPickPhotos || onTakePhoto) && attachments.length < MAX_ATTACHMENTS;
|
|
129
|
+
const isDraftEmpty = draft.trim().length === 0 && attachments.length === 0;
|
|
130
|
+
const openAttachmentOptions = useCallback(() => {
|
|
131
|
+
if (!canAttach) return;
|
|
132
|
+
const actions: AttachmentAction[] = [
|
|
133
|
+
onPickFiles ? { label: 'Files', picker: onPickFiles } : null,
|
|
134
|
+
onTakePhoto ? { label: 'Camera', picker: onTakePhoto } : null,
|
|
135
|
+
onPickPhotos ? { label: 'Photos', picker: onPickPhotos } : null,
|
|
136
|
+
onImportFromDrive ? { label: 'Google Drive', picker: onImportFromDrive } : null,
|
|
137
|
+
].filter((action): action is AttachmentAction => Boolean(action));
|
|
138
|
+
|
|
139
|
+
if (showNativeActionSheet('Add attachment', actions.map((action) => ({
|
|
140
|
+
label: action.label,
|
|
141
|
+
onPress: () => addFromPicker(action.picker),
|
|
142
|
+
})))) {
|
|
143
|
+
setIsAttachmentMenuOpen(false);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
setIsAttachmentMenuOpen((current) => !current);
|
|
148
|
+
}, [addFromPicker, canAttach, onImportFromDrive, onPickFiles, onPickPhotos, onTakePhoto]);
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<View style={composerStyles.wrap}>
|
|
152
|
+
{mediaError ? <Text style={composerStyles.errorText}>{mediaError}</Text> : null}
|
|
153
|
+
{replyTo ? <ReplyPreview replyTo={replyTo} onClear={onClearReply} /> : null}
|
|
154
|
+
<AttachmentPreviewStrip attachments={attachments} onRemove={onRemoveAttachment} />
|
|
155
|
+
<View style={[composerStyles.shell, { maxWidth: MAX_CHAT_WIDTH }]}>
|
|
156
|
+
{isAttachmentMenuOpen ? (
|
|
157
|
+
<AttachmentMenu
|
|
158
|
+
canAttach={canAttach}
|
|
159
|
+
onImportFromDrive={onImportFromDrive ? () => addFromPicker(onImportFromDrive) : undefined}
|
|
160
|
+
onPickFiles={onPickFiles ? () => addFromPicker(onPickFiles) : undefined}
|
|
161
|
+
onPickPhotos={onPickPhotos ? () => addFromPicker(onPickPhotos) : undefined}
|
|
162
|
+
onTakePhoto={onTakePhoto ? () => addFromPicker(onTakePhoto) : undefined}
|
|
163
|
+
/>
|
|
164
|
+
) : null}
|
|
165
|
+
<ToolButton
|
|
166
|
+
Icon={Plus}
|
|
167
|
+
active={isAttachmentMenuOpen}
|
|
168
|
+
disabled={!canAttach}
|
|
169
|
+
label="Add attachment"
|
|
170
|
+
onPress={openAttachmentOptions}
|
|
171
|
+
/>
|
|
172
|
+
<TextInput
|
|
173
|
+
multiline
|
|
174
|
+
onChangeText={onChangeDraft}
|
|
175
|
+
onFocus={() => setIsAttachmentMenuOpen(false)}
|
|
176
|
+
placeholder="Ask Superagent"
|
|
177
|
+
placeholderTextColor="#A1A1AA"
|
|
178
|
+
style={composerStyles.input}
|
|
179
|
+
textAlignVertical="top"
|
|
180
|
+
value={draft}
|
|
181
|
+
/>
|
|
182
|
+
<ComposerActionButton
|
|
183
|
+
canSend={canSend}
|
|
184
|
+
isDraftEmpty={isDraftEmpty}
|
|
185
|
+
isLiveVoiceActive={liveVoiceState === 'processing'}
|
|
186
|
+
isVoiceInputActive={voiceState === 'processing'}
|
|
187
|
+
onSend={onSend}
|
|
188
|
+
onStartLiveVoice={onStartLiveVoice ? startLiveVoice : onStartVoiceInput ? startVoiceInput : undefined}
|
|
189
|
+
onStop={onStop}
|
|
190
|
+
isSending={isSending}
|
|
191
|
+
/>
|
|
192
|
+
</View>
|
|
193
|
+
</View>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function AttachmentMenu({
|
|
198
|
+
canAttach,
|
|
199
|
+
onImportFromDrive,
|
|
200
|
+
onPickFiles,
|
|
201
|
+
onPickPhotos,
|
|
202
|
+
onTakePhoto,
|
|
203
|
+
}: {
|
|
204
|
+
canAttach: boolean;
|
|
205
|
+
onImportFromDrive?: () => void;
|
|
206
|
+
onPickFiles?: () => void;
|
|
207
|
+
onPickPhotos?: () => void;
|
|
208
|
+
onTakePhoto?: () => void;
|
|
209
|
+
}) {
|
|
210
|
+
return (
|
|
211
|
+
<View style={composerStyles.attachmentMenu}>
|
|
212
|
+
<AttachmentMenuItem
|
|
213
|
+
Icon={Paperclip}
|
|
214
|
+
disabled={!canAttach || !onPickFiles}
|
|
215
|
+
label="Files"
|
|
216
|
+
onPress={onPickFiles}
|
|
217
|
+
/>
|
|
218
|
+
<AttachmentMenuItem
|
|
219
|
+
Icon={Camera}
|
|
220
|
+
disabled={!canAttach || !onTakePhoto}
|
|
221
|
+
label="Camera"
|
|
222
|
+
onPress={onTakePhoto}
|
|
223
|
+
/>
|
|
224
|
+
<AttachmentMenuItem
|
|
225
|
+
Icon={ImageIcon}
|
|
226
|
+
disabled={!canAttach || !onPickPhotos}
|
|
227
|
+
label="Photos"
|
|
228
|
+
onPress={onPickPhotos}
|
|
229
|
+
/>
|
|
230
|
+
{onImportFromDrive ? (
|
|
231
|
+
<>
|
|
232
|
+
<Text style={composerStyles.attachmentMenuSectionLabel}>Plugins</Text>
|
|
233
|
+
<AttachmentMenuItem
|
|
234
|
+
Icon={FileText}
|
|
235
|
+
disabled={!canAttach}
|
|
236
|
+
label="Google Drive"
|
|
237
|
+
onPress={onImportFromDrive}
|
|
238
|
+
/>
|
|
239
|
+
</>
|
|
240
|
+
) : null}
|
|
241
|
+
</View>
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function AttachmentMenuItem({
|
|
246
|
+
Icon,
|
|
247
|
+
disabled,
|
|
248
|
+
label,
|
|
249
|
+
onPress,
|
|
250
|
+
}: {
|
|
251
|
+
Icon: LucideIcon;
|
|
252
|
+
disabled?: boolean;
|
|
253
|
+
label: string;
|
|
254
|
+
onPress?: () => void;
|
|
255
|
+
}) {
|
|
256
|
+
return (
|
|
257
|
+
<Pressable
|
|
258
|
+
accessibilityLabel={label}
|
|
259
|
+
accessibilityRole="button"
|
|
260
|
+
disabled={disabled}
|
|
261
|
+
onPress={onPress}
|
|
262
|
+
style={({ pressed }) => [
|
|
263
|
+
composerStyles.attachmentMenuItem,
|
|
264
|
+
disabled && composerStyles.disabledButton,
|
|
265
|
+
pressed && styles.pressed,
|
|
266
|
+
]}
|
|
267
|
+
>
|
|
268
|
+
<View style={composerStyles.attachmentMenuIcon}>
|
|
269
|
+
<Icon color={disabled ? '#8E8E93' : '#F4F4F5'} size={22} strokeWidth={2.2} />
|
|
270
|
+
</View>
|
|
271
|
+
<Text style={[composerStyles.attachmentMenuItemText, disabled && composerStyles.attachmentMenuItemTextDisabled]}>
|
|
272
|
+
{label}
|
|
273
|
+
</Text>
|
|
274
|
+
</Pressable>
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function ReplyPreview({ onClear, replyTo }: { onClear: () => void; replyTo: SuperagentReplyTo }) {
|
|
279
|
+
return (
|
|
280
|
+
<View style={composerStyles.replyPreview}>
|
|
281
|
+
<View style={composerStyles.replyPreviewMarker} />
|
|
282
|
+
<Text numberOfLines={2} style={composerStyles.replyPreviewText}>{replyTo.content}</Text>
|
|
283
|
+
<Pressable accessibilityLabel="Clear reply" accessibilityRole="button" onPress={onClear} style={composerStyles.replyPreviewClose}>
|
|
284
|
+
<X color="#F4F4F5" size={16} strokeWidth={2.6} />
|
|
285
|
+
</Pressable>
|
|
286
|
+
</View>
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function ToolButton({
|
|
291
|
+
Icon,
|
|
292
|
+
active,
|
|
293
|
+
disabled,
|
|
294
|
+
label,
|
|
295
|
+
onPress,
|
|
296
|
+
}: {
|
|
297
|
+
Icon: LucideIcon;
|
|
298
|
+
active?: boolean;
|
|
299
|
+
disabled?: boolean;
|
|
300
|
+
label: string;
|
|
301
|
+
onPress: () => void;
|
|
302
|
+
}) {
|
|
303
|
+
const iconColor = disabled ? '#8E8E93' : '#F4F4F5';
|
|
304
|
+
|
|
305
|
+
return (
|
|
306
|
+
<Pressable accessibilityLabel={label} accessibilityRole="button" disabled={disabled} onPress={onPress} style={({ pressed }) => [
|
|
307
|
+
composerStyles.iconButton,
|
|
308
|
+
active && composerStyles.activeButton,
|
|
309
|
+
disabled && composerStyles.disabledButton,
|
|
310
|
+
pressed && styles.pressed,
|
|
311
|
+
]}>
|
|
312
|
+
<Icon color={iconColor} size={21} strokeWidth={2.4} />
|
|
313
|
+
</Pressable>
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function ComposerActionButton({
|
|
318
|
+
canSend,
|
|
319
|
+
isDraftEmpty,
|
|
320
|
+
isLiveVoiceActive,
|
|
321
|
+
isSending,
|
|
322
|
+
isVoiceInputActive,
|
|
323
|
+
onSend,
|
|
324
|
+
onStartLiveVoice,
|
|
325
|
+
onStop,
|
|
326
|
+
}: {
|
|
327
|
+
canSend: boolean;
|
|
328
|
+
isDraftEmpty: boolean;
|
|
329
|
+
isLiveVoiceActive: boolean;
|
|
330
|
+
isSending: boolean;
|
|
331
|
+
isVoiceInputActive: boolean;
|
|
332
|
+
onSend: () => void;
|
|
333
|
+
onStartLiveVoice?: () => void;
|
|
334
|
+
onStop: () => void;
|
|
335
|
+
}) {
|
|
336
|
+
if (isSending) {
|
|
337
|
+
return (
|
|
338
|
+
<Pressable accessibilityLabel="Stop Superagent" accessibilityRole="button" onPress={onStop} style={composerStyles.stopButton}>
|
|
339
|
+
<Square color="#111111" fill="#111111" size={17} strokeWidth={2.2} />
|
|
340
|
+
</Pressable>
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (isDraftEmpty) {
|
|
345
|
+
const disabled = !onStartLiveVoice;
|
|
346
|
+
return (
|
|
347
|
+
<Pressable accessibilityLabel="Start Live Voice" accessibilityRole="button" disabled={disabled} onPress={onStartLiveVoice} style={({ pressed }) => [
|
|
348
|
+
composerStyles.sendButton,
|
|
349
|
+
composerStyles.liveActionButton,
|
|
350
|
+
(isLiveVoiceActive || isVoiceInputActive) && composerStyles.activeButton,
|
|
351
|
+
disabled && composerStyles.sendButtonDisabled,
|
|
352
|
+
pressed && styles.pressed,
|
|
353
|
+
]}>
|
|
354
|
+
<AudioLines color={disabled ? '#8E8E93' : '#F4F4F5'} size={21} strokeWidth={2.4} />
|
|
355
|
+
</Pressable>
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
return (
|
|
360
|
+
<Pressable accessibilityLabel="Send message" accessibilityRole="button" disabled={!canSend} onPress={onSend} style={({ pressed }) => [
|
|
361
|
+
composerStyles.sendButton,
|
|
362
|
+
!canSend && composerStyles.sendButtonDisabled,
|
|
363
|
+
pressed && styles.pressed,
|
|
364
|
+
]}>
|
|
365
|
+
<Send color={canSend ? '#111111' : '#8E8E93'} size={19} strokeWidth={2.6} />
|
|
366
|
+
</Pressable>
|
|
367
|
+
);
|
|
368
|
+
}
|