@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,592 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import { ActivityIndicator, Pressable, Text, TextInput, View } from 'react-native';
|
|
3
|
+
import { CheckCircle2, KeyRound, Package, Plug, ShieldAlert } from 'lucide-react-native';
|
|
4
|
+
|
|
5
|
+
import { ConnectorBrandIcon, hasConnectorBrandIcon } from './connectorBrandIcons';
|
|
6
|
+
import { conversationStyles } from './conversationStyles';
|
|
7
|
+
import type {
|
|
8
|
+
SuperagentAgent,
|
|
9
|
+
SuperagentConnector,
|
|
10
|
+
SuperagentConnectorActionInput,
|
|
11
|
+
SuperagentConversation,
|
|
12
|
+
SuperagentToolCall,
|
|
13
|
+
} from './types';
|
|
14
|
+
|
|
15
|
+
type SubmitToolCallInput = (
|
|
16
|
+
toolCallId: string,
|
|
17
|
+
approve: boolean,
|
|
18
|
+
extraUserInput?: unknown,
|
|
19
|
+
originRequestId?: string,
|
|
20
|
+
) => Promise<SuperagentConversation | null>;
|
|
21
|
+
|
|
22
|
+
type ApprovalKind = 'channel' | 'connector' | 'customConnector' | 'package' | 'payment' | 'secrets' | 'guard' | 'generic';
|
|
23
|
+
|
|
24
|
+
type SecretSchemaItem = {
|
|
25
|
+
description?: string;
|
|
26
|
+
name: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export function ToolApprovalCard({
|
|
30
|
+
agent,
|
|
31
|
+
availableConnectors,
|
|
32
|
+
isLastAssistantMessage,
|
|
33
|
+
onConnectConnector,
|
|
34
|
+
submitToolCallInput,
|
|
35
|
+
toolCall,
|
|
36
|
+
}: {
|
|
37
|
+
agent: SuperagentAgent;
|
|
38
|
+
availableConnectors?: SuperagentConnector[];
|
|
39
|
+
isLastAssistantMessage: boolean;
|
|
40
|
+
onConnectConnector?: (input: SuperagentConnectorActionInput) => Promise<boolean | void> | boolean | void;
|
|
41
|
+
submitToolCallInput?: SubmitToolCallInput;
|
|
42
|
+
toolCall: SuperagentToolCall;
|
|
43
|
+
}) {
|
|
44
|
+
const args = useMemo(() => getToolArgs(toolCall), [toolCall]);
|
|
45
|
+
const guardData = useMemo(() => getGuardData(toolCall.results), [toolCall.results]);
|
|
46
|
+
const kind = getApprovalKind(toolCall, guardData);
|
|
47
|
+
const connectorId = getStringArg(args, ['integration_type', 'connector_id', 'provider']);
|
|
48
|
+
const connector = availableConnectors?.find((item) => item.id === connectorId);
|
|
49
|
+
const connectorName = connector?.name || formatConnectorName(connectorId);
|
|
50
|
+
const paymentProvider = getStringArg(args, ['provider']);
|
|
51
|
+
const paymentName = getPaymentName(paymentProvider || toolCall.name);
|
|
52
|
+
const channelName = toolCall.name === 'setup_telegram_connection' ? 'Telegram' : 'Slack';
|
|
53
|
+
const customConnectorName = getStringArg(args, ['name', 'integration_type']) || 'connector';
|
|
54
|
+
const scopes = getStringArrayArg(args, 'scopes');
|
|
55
|
+
const reason = getStringArg(args, ['reason', 'description', 'message']);
|
|
56
|
+
const packages = getPackageSpecs(args);
|
|
57
|
+
const secretSchema = getSecretSchema(args);
|
|
58
|
+
const displayName = kind === 'payment'
|
|
59
|
+
? paymentName
|
|
60
|
+
: kind === 'channel'
|
|
61
|
+
? channelName
|
|
62
|
+
: kind === 'customConnector'
|
|
63
|
+
? formatConnectorName(customConnectorName)
|
|
64
|
+
: connectorName;
|
|
65
|
+
const title = getApprovalTitle(kind, displayName);
|
|
66
|
+
const body = getApprovalBody(kind, reason, guardData, displayName);
|
|
67
|
+
const primaryLabel = getPrimaryLabel(kind, displayName);
|
|
68
|
+
const rejectLabel = kind === 'connector' || kind === 'channel' ? 'Skip' : 'Reject';
|
|
69
|
+
const canAct = Boolean(toolCall.id && submitToolCallInput && isLastAssistantMessage);
|
|
70
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
71
|
+
const [error, setError] = useState<string | null>(null);
|
|
72
|
+
const [formValues, setFormValues] = useState<Record<string, string>>({
|
|
73
|
+
connectorName: customConnectorName === 'connector' ? '' : formatConnectorName(customConnectorName),
|
|
74
|
+
scopes: scopes.join('\n'),
|
|
75
|
+
});
|
|
76
|
+
const [secretValues, setSecretValues] = useState<Record<string, string>>({});
|
|
77
|
+
const needsSecrets = kind === 'secrets' && secretSchema.length > 0;
|
|
78
|
+
const secretsComplete = !needsSecrets || secretSchema.every((secret) => secretValues[secret.name]?.trim());
|
|
79
|
+
const channelComplete = kind !== 'channel' || isChannelFormComplete(toolCall.name, formValues);
|
|
80
|
+
const customConnectorComplete = kind !== 'customConnector' ||
|
|
81
|
+
Boolean(formValues.connectorName?.trim() && formValues.clientId?.trim() && formValues.clientSecret?.trim());
|
|
82
|
+
const disablePrimary = !canAct || isSubmitting || !secretsComplete || !channelComplete || !customConnectorComplete;
|
|
83
|
+
|
|
84
|
+
const submitApproval = async () => {
|
|
85
|
+
if (!toolCall.id || !submitToolCallInput) return;
|
|
86
|
+
|
|
87
|
+
setIsSubmitting(true);
|
|
88
|
+
setError(null);
|
|
89
|
+
try {
|
|
90
|
+
if (kind === 'connector' && onConnectConnector && connectorId) {
|
|
91
|
+
const connected = await onConnectConnector({
|
|
92
|
+
accessMode: 'full_access',
|
|
93
|
+
agentId: agent.id,
|
|
94
|
+
connectorId,
|
|
95
|
+
forceReconnect: false,
|
|
96
|
+
scopes: scopes.length > 0 ? scopes : connector?.scopes,
|
|
97
|
+
});
|
|
98
|
+
if (connected === false) {
|
|
99
|
+
throw new Error(`${connectorName} was not connected.`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
await submitToolCallInput(toolCall.id, true, getApprovalPayload(kind, secretValues, paymentProvider, toolCall.name, formValues));
|
|
104
|
+
} catch (submitError) {
|
|
105
|
+
setError(submitError instanceof Error ? submitError.message : 'Unable to approve this request.');
|
|
106
|
+
} finally {
|
|
107
|
+
setIsSubmitting(false);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const rejectApproval = async () => {
|
|
112
|
+
if (!toolCall.id || !submitToolCallInput) return;
|
|
113
|
+
|
|
114
|
+
setIsSubmitting(true);
|
|
115
|
+
setError(null);
|
|
116
|
+
try {
|
|
117
|
+
await submitToolCallInput(toolCall.id, false, {});
|
|
118
|
+
} catch (submitError) {
|
|
119
|
+
setError(submitError instanceof Error ? submitError.message : 'Unable to reject this request.');
|
|
120
|
+
} finally {
|
|
121
|
+
setIsSubmitting(false);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<View style={conversationStyles.toolApprovalCard}>
|
|
127
|
+
<View style={conversationStyles.toolApprovalHeader}>
|
|
128
|
+
<ApprovalIcon connector={connector} connectorId={connectorId} kind={kind} />
|
|
129
|
+
<View style={conversationStyles.toolApprovalHeaderText}>
|
|
130
|
+
<Text style={conversationStyles.toolApprovalTitle}>{title}</Text>
|
|
131
|
+
<Text style={conversationStyles.toolApprovalSubtitle}>Waiting For User Input</Text>
|
|
132
|
+
</View>
|
|
133
|
+
</View>
|
|
134
|
+
|
|
135
|
+
{body ? <Text style={conversationStyles.toolApprovalBody}>{body}</Text> : null}
|
|
136
|
+
|
|
137
|
+
{kind === 'connector' && scopes.length > 0 ? (
|
|
138
|
+
<View style={conversationStyles.toolApprovalScopeWrap}>
|
|
139
|
+
<Text style={conversationStyles.toolApprovalMuted}>Requested access</Text>
|
|
140
|
+
<View style={conversationStyles.toolApprovalChipWrap}>
|
|
141
|
+
{scopes.slice(0, 4).map((scope) => (
|
|
142
|
+
<View key={scope} style={conversationStyles.toolApprovalChip}>
|
|
143
|
+
<Text numberOfLines={1} style={conversationStyles.toolApprovalChipText}>{scope}</Text>
|
|
144
|
+
</View>
|
|
145
|
+
))}
|
|
146
|
+
{scopes.length > 4 ? (
|
|
147
|
+
<View style={conversationStyles.toolApprovalChip}>
|
|
148
|
+
<Text style={conversationStyles.toolApprovalChipText}>+{scopes.length - 4}</Text>
|
|
149
|
+
</View>
|
|
150
|
+
) : null}
|
|
151
|
+
</View>
|
|
152
|
+
</View>
|
|
153
|
+
) : null}
|
|
154
|
+
|
|
155
|
+
{kind === 'package' && packages.length > 0 ? (
|
|
156
|
+
<View style={conversationStyles.toolApprovalChipWrap}>
|
|
157
|
+
{packages.map((packageSpec) => (
|
|
158
|
+
<View key={packageSpec} style={conversationStyles.toolApprovalChip}>
|
|
159
|
+
<Text numberOfLines={1} style={conversationStyles.toolApprovalChipText}>{packageSpec}</Text>
|
|
160
|
+
</View>
|
|
161
|
+
))}
|
|
162
|
+
</View>
|
|
163
|
+
) : null}
|
|
164
|
+
|
|
165
|
+
{needsSecrets ? (
|
|
166
|
+
<View style={conversationStyles.toolApprovalInputs}>
|
|
167
|
+
{secretSchema.map((secret) => (
|
|
168
|
+
<ApprovalInput
|
|
169
|
+
canAct={canAct}
|
|
170
|
+
help={secret.description}
|
|
171
|
+
isSubmitting={isSubmitting}
|
|
172
|
+
key={secret.name}
|
|
173
|
+
label={secret.name}
|
|
174
|
+
onChange={(value) => setSecretValues((current) => ({ ...current, [secret.name]: value }))}
|
|
175
|
+
placeholder={`Enter ${secret.name}`}
|
|
176
|
+
secure
|
|
177
|
+
value={secretValues[secret.name] ?? ''}
|
|
178
|
+
/>
|
|
179
|
+
))}
|
|
180
|
+
</View>
|
|
181
|
+
) : null}
|
|
182
|
+
|
|
183
|
+
{kind === 'channel' ? (
|
|
184
|
+
<View style={conversationStyles.toolApprovalInputs}>
|
|
185
|
+
{toolCall.name === 'setup_telegram_connection' ? (
|
|
186
|
+
<ApprovalInput
|
|
187
|
+
canAct={canAct}
|
|
188
|
+
help="Paste the bot token from BotFather."
|
|
189
|
+
isSubmitting={isSubmitting}
|
|
190
|
+
label="Bot Token"
|
|
191
|
+
onChange={(value) => setFormValues((current) => ({ ...current, botToken: extractTelegramToken(value) }))}
|
|
192
|
+
placeholder="123456789:ABC..."
|
|
193
|
+
secure
|
|
194
|
+
value={formValues.botToken ?? ''}
|
|
195
|
+
/>
|
|
196
|
+
) : (
|
|
197
|
+
<>
|
|
198
|
+
<ApprovalInput
|
|
199
|
+
canAct={canAct}
|
|
200
|
+
help="From OAuth & Permissions. Starts with xoxb-."
|
|
201
|
+
isSubmitting={isSubmitting}
|
|
202
|
+
label="Bot User OAuth Token"
|
|
203
|
+
onChange={(value) => setFormValues((current) => ({ ...current, botToken: value }))}
|
|
204
|
+
placeholder="xoxb-..."
|
|
205
|
+
secure
|
|
206
|
+
value={formValues.botToken ?? ''}
|
|
207
|
+
/>
|
|
208
|
+
<ApprovalInput
|
|
209
|
+
canAct={canAct}
|
|
210
|
+
help="From Basic Information > App Credentials."
|
|
211
|
+
isSubmitting={isSubmitting}
|
|
212
|
+
label="Signing Secret"
|
|
213
|
+
onChange={(value) => setFormValues((current) => ({ ...current, signingSecret: value }))}
|
|
214
|
+
placeholder="Enter signing secret"
|
|
215
|
+
secure
|
|
216
|
+
value={formValues.signingSecret ?? ''}
|
|
217
|
+
/>
|
|
218
|
+
</>
|
|
219
|
+
)}
|
|
220
|
+
</View>
|
|
221
|
+
) : null}
|
|
222
|
+
|
|
223
|
+
{kind === 'customConnector' ? (
|
|
224
|
+
<View style={conversationStyles.toolApprovalInputs}>
|
|
225
|
+
<ApprovalInput
|
|
226
|
+
canAct={canAct}
|
|
227
|
+
isSubmitting={isSubmitting}
|
|
228
|
+
label="Connector name"
|
|
229
|
+
onChange={(value) => setFormValues((current) => ({ ...current, connectorName: value }))}
|
|
230
|
+
placeholder="Calendar"
|
|
231
|
+
value={formValues.connectorName ?? ''}
|
|
232
|
+
/>
|
|
233
|
+
<ApprovalInput
|
|
234
|
+
canAct={canAct}
|
|
235
|
+
isSubmitting={isSubmitting}
|
|
236
|
+
label="Client ID"
|
|
237
|
+
onChange={(value) => setFormValues((current) => ({ ...current, clientId: value }))}
|
|
238
|
+
placeholder="OAuth client id"
|
|
239
|
+
value={formValues.clientId ?? ''}
|
|
240
|
+
/>
|
|
241
|
+
<ApprovalInput
|
|
242
|
+
canAct={canAct}
|
|
243
|
+
isSubmitting={isSubmitting}
|
|
244
|
+
label="Client Secret"
|
|
245
|
+
onChange={(value) => setFormValues((current) => ({ ...current, clientSecret: value }))}
|
|
246
|
+
placeholder="OAuth client secret"
|
|
247
|
+
secure
|
|
248
|
+
value={formValues.clientSecret ?? ''}
|
|
249
|
+
/>
|
|
250
|
+
<ApprovalInput
|
|
251
|
+
canAct={canAct}
|
|
252
|
+
help="One scope per line."
|
|
253
|
+
isSubmitting={isSubmitting}
|
|
254
|
+
label="Scopes"
|
|
255
|
+
multiline
|
|
256
|
+
onChange={(value) => setFormValues((current) => ({ ...current, scopes: value }))}
|
|
257
|
+
placeholder="https://www.googleapis.com/auth/calendar.readonly"
|
|
258
|
+
value={formValues.scopes ?? ''}
|
|
259
|
+
/>
|
|
260
|
+
</View>
|
|
261
|
+
) : null}
|
|
262
|
+
|
|
263
|
+
{canAct ? (
|
|
264
|
+
<View style={conversationStyles.toolApprovalActions}>
|
|
265
|
+
<Pressable
|
|
266
|
+
accessibilityRole="button"
|
|
267
|
+
disabled={disablePrimary}
|
|
268
|
+
onPress={submitApproval}
|
|
269
|
+
style={[
|
|
270
|
+
conversationStyles.toolApprovalPrimaryButton,
|
|
271
|
+
disablePrimary && conversationStyles.toolApprovalButtonDisabled,
|
|
272
|
+
]}
|
|
273
|
+
>
|
|
274
|
+
{isSubmitting ? <ActivityIndicator color="#111111" size="small" /> : <CheckCircle2 color="#111111" size={15} strokeWidth={2.5} />}
|
|
275
|
+
<Text style={conversationStyles.toolApprovalPrimaryText}>{isSubmitting ? 'Working...' : primaryLabel}</Text>
|
|
276
|
+
</Pressable>
|
|
277
|
+
<Pressable
|
|
278
|
+
accessibilityRole="button"
|
|
279
|
+
disabled={isSubmitting}
|
|
280
|
+
onPress={rejectApproval}
|
|
281
|
+
style={[
|
|
282
|
+
conversationStyles.toolApprovalSecondaryButton,
|
|
283
|
+
isSubmitting && conversationStyles.toolApprovalButtonDisabled,
|
|
284
|
+
]}
|
|
285
|
+
>
|
|
286
|
+
<Text style={conversationStyles.toolApprovalSecondaryText}>{rejectLabel}</Text>
|
|
287
|
+
</Pressable>
|
|
288
|
+
</View>
|
|
289
|
+
) : (
|
|
290
|
+
<Text style={conversationStyles.toolApprovalPreviousText}>
|
|
291
|
+
{isLastAssistantMessage ? 'Approval controls are not available in this build.' : 'This request belongs to an earlier message.'}
|
|
292
|
+
</Text>
|
|
293
|
+
)}
|
|
294
|
+
|
|
295
|
+
{error ? <Text style={conversationStyles.toolApprovalError}>{error}</Text> : null}
|
|
296
|
+
</View>
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function ApprovalIcon({
|
|
301
|
+
connector,
|
|
302
|
+
connectorId,
|
|
303
|
+
kind,
|
|
304
|
+
}: {
|
|
305
|
+
connector?: SuperagentConnector;
|
|
306
|
+
connectorId: string;
|
|
307
|
+
kind: ApprovalKind;
|
|
308
|
+
}) {
|
|
309
|
+
if (kind === 'connector' && connectorId && hasConnectorBrandIcon(connectorId)) {
|
|
310
|
+
return (
|
|
311
|
+
<View style={conversationStyles.toolApprovalBrandIcon}>
|
|
312
|
+
<ConnectorBrandIcon connectorId={connectorId} size={20} />
|
|
313
|
+
</View>
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
const iconColor = kind === 'guard' ? '#FDE047' : '#F4F4F5';
|
|
318
|
+
const fallbackLabel = connector?.iconFallbackLabel || connectorId.slice(0, 2).toUpperCase();
|
|
319
|
+
if (kind === 'connector' && fallbackLabel) {
|
|
320
|
+
return (
|
|
321
|
+
<View style={conversationStyles.toolApprovalBrandIcon}>
|
|
322
|
+
<Text style={conversationStyles.toolApprovalBrandFallback}>{fallbackLabel}</Text>
|
|
323
|
+
</View>
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return (
|
|
328
|
+
<View style={conversationStyles.toolApprovalIcon}>
|
|
329
|
+
{kind === 'package' ? <Package color={iconColor} size={18} strokeWidth={2.3} /> : null}
|
|
330
|
+
{kind === 'payment' ? <Plug color={iconColor} size={18} strokeWidth={2.3} /> : null}
|
|
331
|
+
{kind === 'secrets' ? <KeyRound color={iconColor} size={18} strokeWidth={2.3} /> : null}
|
|
332
|
+
{kind === 'guard' ? <ShieldAlert color={iconColor} size={18} strokeWidth={2.3} /> : null}
|
|
333
|
+
{kind === 'generic' ? <Plug color={iconColor} size={18} strokeWidth={2.3} /> : null}
|
|
334
|
+
</View>
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function ApprovalInput({
|
|
339
|
+
canAct,
|
|
340
|
+
help,
|
|
341
|
+
isSubmitting,
|
|
342
|
+
label,
|
|
343
|
+
multiline,
|
|
344
|
+
onChange,
|
|
345
|
+
placeholder,
|
|
346
|
+
secure,
|
|
347
|
+
value,
|
|
348
|
+
}: {
|
|
349
|
+
canAct: boolean;
|
|
350
|
+
help?: string;
|
|
351
|
+
isSubmitting: boolean;
|
|
352
|
+
label: string;
|
|
353
|
+
multiline?: boolean;
|
|
354
|
+
onChange: (value: string) => void;
|
|
355
|
+
placeholder: string;
|
|
356
|
+
secure?: boolean;
|
|
357
|
+
value: string;
|
|
358
|
+
}) {
|
|
359
|
+
return (
|
|
360
|
+
<View style={conversationStyles.toolApprovalInputGroup}>
|
|
361
|
+
<Text style={conversationStyles.toolApprovalInputLabel}>{label}</Text>
|
|
362
|
+
{help ? <Text style={conversationStyles.toolApprovalInputHelp}>{help}</Text> : null}
|
|
363
|
+
<TextInput
|
|
364
|
+
autoCapitalize="none"
|
|
365
|
+
autoCorrect={false}
|
|
366
|
+
editable={!isSubmitting && canAct}
|
|
367
|
+
multiline={multiline}
|
|
368
|
+
onChangeText={onChange}
|
|
369
|
+
placeholder={placeholder}
|
|
370
|
+
placeholderTextColor="#6F6F76"
|
|
371
|
+
secureTextEntry={secure}
|
|
372
|
+
style={[
|
|
373
|
+
conversationStyles.toolApprovalInput,
|
|
374
|
+
multiline && conversationStyles.toolApprovalMultilineInput,
|
|
375
|
+
]}
|
|
376
|
+
textAlignVertical={multiline ? 'top' : 'center'}
|
|
377
|
+
value={value}
|
|
378
|
+
/>
|
|
379
|
+
</View>
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function getApprovalKind(toolCall: SuperagentToolCall, guardData: Record<string, unknown> | null): ApprovalKind {
|
|
384
|
+
if (guardData) return 'guard';
|
|
385
|
+
if (toolCall.name === 'setup_slack_connection' || toolCall.name === 'setup_telegram_connection') return 'channel';
|
|
386
|
+
if (toolCall.name === 'set_app_user_connector') return 'customConnector';
|
|
387
|
+
if (toolCall.name === 'request_oauth_authorization') return 'connector';
|
|
388
|
+
if (toolCall.name === 'install_npm_package') return 'package';
|
|
389
|
+
if (toolCall.name === 'suggest_payments_installation' || toolCall.name === 'suggest_stripe_installation') return 'payment';
|
|
390
|
+
if (toolCall.name === 'request_secrets' || toolCall.name === 'set_secrets') return 'secrets';
|
|
391
|
+
return 'generic';
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function getApprovalTitle(kind: ApprovalKind, displayName: string) {
|
|
395
|
+
if (kind === 'channel') return `Connect ${displayName}`;
|
|
396
|
+
if (kind === 'connector') return `Connect to ${displayName}`;
|
|
397
|
+
if (kind === 'customConnector') return `Set up ${displayName}`;
|
|
398
|
+
if (kind === 'payment') return `Connect ${displayName}`;
|
|
399
|
+
if (kind === 'package') return 'Approve package install';
|
|
400
|
+
if (kind === 'secrets') return 'Provide secrets';
|
|
401
|
+
if (kind === 'guard') return 'Approve protected change';
|
|
402
|
+
return 'Approval required';
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function getApprovalBody(
|
|
406
|
+
kind: ApprovalKind,
|
|
407
|
+
reason: string,
|
|
408
|
+
guardData: Record<string, unknown> | null,
|
|
409
|
+
displayName: string,
|
|
410
|
+
) {
|
|
411
|
+
if (kind === 'channel') return reason || `Paste your ${displayName} credentials to connect this channel.`;
|
|
412
|
+
if (kind === 'connector') return reason || `${displayName} needs authorization before this agent can continue.`;
|
|
413
|
+
if (kind === 'customConnector') return reason || 'Provide OAuth credentials for this custom connector.';
|
|
414
|
+
if (kind === 'payment') return reason || `Approve setting up ${displayName} for this app.`;
|
|
415
|
+
if (kind === 'package') return reason || 'Approve installing the packages required for this step.';
|
|
416
|
+
if (kind === 'secrets') return reason || 'Enter the requested secret values to continue.';
|
|
417
|
+
if (kind === 'guard') return String(guardData?.reason || 'Review and approve this protected change to continue.');
|
|
418
|
+
return reason || 'Review this request to continue.';
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
function getPrimaryLabel(kind: ApprovalKind, displayName: string) {
|
|
422
|
+
if (kind === 'channel' || kind === 'connector') return `Connect ${displayName}`;
|
|
423
|
+
if (kind === 'customConnector') return 'Connect';
|
|
424
|
+
if (kind === 'payment') return 'Connect';
|
|
425
|
+
if (kind === 'secrets') return 'Submit';
|
|
426
|
+
return 'Approve';
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function getApprovalPayload(
|
|
430
|
+
kind: ApprovalKind,
|
|
431
|
+
secretValues: Record<string, string>,
|
|
432
|
+
paymentProvider: string,
|
|
433
|
+
toolName: string,
|
|
434
|
+
formValues: Record<string, string>,
|
|
435
|
+
) {
|
|
436
|
+
if (kind === 'channel' && toolName === 'setup_telegram_connection') {
|
|
437
|
+
return { bot_token: formValues.botToken };
|
|
438
|
+
}
|
|
439
|
+
if (kind === 'channel') {
|
|
440
|
+
return { bot_token: formValues.botToken, signing_secret: formValues.signingSecret };
|
|
441
|
+
}
|
|
442
|
+
if (kind === 'customConnector') {
|
|
443
|
+
return {
|
|
444
|
+
client_id: formValues.clientId?.trim(),
|
|
445
|
+
client_secret: formValues.clientSecret?.trim(),
|
|
446
|
+
name: formValues.connectorName?.trim(),
|
|
447
|
+
scopes: splitLines(formValues.scopes),
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
if (kind === 'secrets') return { secrets: secretValues };
|
|
451
|
+
if (kind === 'payment' && paymentProvider === 'wix_payments') return { tos_accepted: true };
|
|
452
|
+
if (kind === 'payment' && paymentProvider === 'payments_by_wix') return { confirmed: true };
|
|
453
|
+
return {};
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function getToolArgs(toolCall: SuperagentToolCall): Record<string, unknown> | string | null {
|
|
457
|
+
const raw = toolCall.arguments_string ?? toolCall.arguments ?? null;
|
|
458
|
+
if (!raw) return null;
|
|
459
|
+
if (typeof raw !== 'string') return raw as Record<string, unknown>;
|
|
460
|
+
|
|
461
|
+
try {
|
|
462
|
+
const parsed = JSON.parse(raw);
|
|
463
|
+
return parsed && typeof parsed === 'object' ? parsed as Record<string, unknown> : raw;
|
|
464
|
+
} catch {
|
|
465
|
+
return raw;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function getStringArg(args: Record<string, unknown> | string | null, keys: string[]) {
|
|
470
|
+
if (!args || typeof args === 'string') return '';
|
|
471
|
+
for (const key of keys) {
|
|
472
|
+
const value = args[key];
|
|
473
|
+
if (typeof value === 'string' && value.trim()) return value.trim();
|
|
474
|
+
}
|
|
475
|
+
return '';
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function getStringArrayArg(args: Record<string, unknown> | string | null, key: string) {
|
|
479
|
+
if (!args || typeof args === 'string') return [];
|
|
480
|
+
const value = args[key];
|
|
481
|
+
if (Array.isArray(value)) return value.filter((item): item is string => typeof item === 'string' && item.trim().length > 0);
|
|
482
|
+
if (typeof value === 'string' && value.trim()) return [value.trim()];
|
|
483
|
+
return [];
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function getPackageSpecs(args: Record<string, unknown> | string | null) {
|
|
487
|
+
if (!args || typeof args === 'string') return [];
|
|
488
|
+
const packages = args.packages;
|
|
489
|
+
if (Array.isArray(packages)) {
|
|
490
|
+
return packages
|
|
491
|
+
.map((packageEntry) => {
|
|
492
|
+
if (packageEntry && typeof packageEntry === 'object') {
|
|
493
|
+
const name = String((packageEntry as Record<string, unknown>).name || '').trim();
|
|
494
|
+
const semver = String((packageEntry as Record<string, unknown>).semver || '').trim();
|
|
495
|
+
return name ? (semver ? `${name}@${semver}` : name) : '';
|
|
496
|
+
}
|
|
497
|
+
return String(packageEntry || '').trim();
|
|
498
|
+
})
|
|
499
|
+
.filter(Boolean);
|
|
500
|
+
}
|
|
501
|
+
if (typeof packages === 'string' && packages.trim()) {
|
|
502
|
+
return packages.split(packages.includes(',') ? ',' : /\s+/).map((item) => item.trim()).filter(Boolean);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
const packageName = getStringArg(args, ['package_name']);
|
|
506
|
+
const version = getStringArg(args, ['version']);
|
|
507
|
+
return packageName ? [version ? `${packageName}@${version}` : packageName] : [];
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function getSecretSchema(args: Record<string, unknown> | string | null): SecretSchemaItem[] {
|
|
511
|
+
if (!args || typeof args === 'string') return [];
|
|
512
|
+
let schema = args.secrets_schema;
|
|
513
|
+
if (typeof schema === 'string') {
|
|
514
|
+
try {
|
|
515
|
+
schema = JSON.parse(schema);
|
|
516
|
+
} catch {
|
|
517
|
+
schema = [];
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
if (!Array.isArray(schema)) return [];
|
|
521
|
+
|
|
522
|
+
const secretItems: SecretSchemaItem[] = [];
|
|
523
|
+
schema.forEach((item) => {
|
|
524
|
+
if (!item || typeof item !== 'object') return;
|
|
525
|
+
const record = item as Record<string, unknown>;
|
|
526
|
+
const name = String(record.secretName || record.name || record.key || '').trim();
|
|
527
|
+
if (!name) return;
|
|
528
|
+
secretItems.push({
|
|
529
|
+
description: typeof record.description === 'string' ? record.description : undefined,
|
|
530
|
+
name,
|
|
531
|
+
});
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
return secretItems;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function isChannelFormComplete(toolName: string, formValues: Record<string, string>) {
|
|
538
|
+
if (toolName === 'setup_telegram_connection') {
|
|
539
|
+
return /^\d+:[A-Za-z0-9_-]{35,}$/.test(formValues.botToken?.trim() || '');
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
return Boolean(
|
|
543
|
+
formValues.botToken?.trim().startsWith('xoxb-') &&
|
|
544
|
+
(formValues.botToken?.trim().length ?? 0) >= 20 &&
|
|
545
|
+
(formValues.signingSecret?.trim().length ?? 0) >= 16,
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
function extractTelegramToken(value: string) {
|
|
550
|
+
const trimmed = value.trim();
|
|
551
|
+
if (/^\d+:[A-Za-z0-9_-]{35,}$/.test(trimmed)) return trimmed;
|
|
552
|
+
const match = trimmed.match(/\d{5,15}:[A-Za-z0-9_-]{35,50}/);
|
|
553
|
+
return match?.[0] ?? value;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function splitLines(value?: string) {
|
|
557
|
+
return (value || '')
|
|
558
|
+
.split('\n')
|
|
559
|
+
.map((line) => line.trim())
|
|
560
|
+
.filter(Boolean);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
function getGuardData(result: unknown) {
|
|
564
|
+
if (!result) return null;
|
|
565
|
+
const value = typeof result === 'string' ? parseJson(result) : result;
|
|
566
|
+
if (value && typeof value === 'object' && 'guard' in value) return value as Record<string, unknown>;
|
|
567
|
+
return null;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
function parseJson(value: string) {
|
|
571
|
+
try {
|
|
572
|
+
return JSON.parse(value);
|
|
573
|
+
} catch {
|
|
574
|
+
return null;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function formatConnectorName(connectorId: string) {
|
|
579
|
+
if (!connectorId) return 'connector';
|
|
580
|
+
return connectorId
|
|
581
|
+
.split(/[_-]/)
|
|
582
|
+
.filter(Boolean)
|
|
583
|
+
.map((part) => part.slice(0, 1).toUpperCase() + part.slice(1))
|
|
584
|
+
.join(' ');
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
function getPaymentName(provider: string) {
|
|
588
|
+
if (provider === 'wix_payments') return 'Base44 Payments';
|
|
589
|
+
if (provider === 'payments_by_wix') return 'Payments by Wix';
|
|
590
|
+
if (provider === 'stripe' || provider === 'suggest_stripe_installation') return 'Stripe';
|
|
591
|
+
return 'payments';
|
|
592
|
+
}
|