@base44/superagent-native 0.0.1 → 0.0.3
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/LICENSE +21 -0
- package/README.md +12 -20
- package/lib/commonjs/AgentSettingsPanel.js +155 -62
- package/lib/commonjs/AgentSettingsPanel.js.map +1 -1
- package/lib/commonjs/AgentSphereIcon.js +14 -118
- package/lib/commonjs/AgentSphereIcon.js.map +1 -1
- package/lib/commonjs/AttachmentPickerStatusModal.js +5 -4
- package/lib/commonjs/AttachmentPickerStatusModal.js.map +1 -1
- package/lib/commonjs/ChannelsPanel.js +66 -44
- package/lib/commonjs/ChannelsPanel.js.map +1 -1
- package/lib/commonjs/ConversationChat.js +38 -13
- package/lib/commonjs/ConversationChat.js.map +1 -1
- package/lib/commonjs/ConversationComposer.js +18 -13
- package/lib/commonjs/ConversationComposer.js.map +1 -1
- package/lib/commonjs/ConversationScreen.js +4 -0
- package/lib/commonjs/ConversationScreen.js.map +1 -1
- package/lib/commonjs/EditorDrawer.js +54 -24
- package/lib/commonjs/EditorDrawer.js.map +1 -1
- package/lib/commonjs/FilesPanel.js +56 -20
- package/lib/commonjs/FilesPanel.js.map +1 -1
- package/lib/commonjs/MarkdownText.js +1 -1
- package/lib/commonjs/MarkdownText.js.map +1 -1
- package/lib/commonjs/MessageActionBar.js +10 -3
- package/lib/commonjs/MessageActionBar.js.map +1 -1
- package/lib/commonjs/RenameAgentModal.js +2 -1
- package/lib/commonjs/RenameAgentModal.js.map +1 -1
- package/lib/commonjs/ShareAgentModal.js +11 -10
- package/lib/commonjs/ShareAgentModal.js.map +1 -1
- package/lib/commonjs/ShareAgentModal.styles.js +2 -2
- package/lib/commonjs/ShareAgentModal.styles.js.map +1 -1
- package/lib/commonjs/SuperagentHomeScreen.js +44 -12
- package/lib/commonjs/SuperagentHomeScreen.js.map +1 -1
- package/lib/commonjs/ToolApprovalCard.js +73 -15
- package/lib/commonjs/ToolApprovalCard.js.map +1 -1
- package/lib/commonjs/ToolCallSummary.js +19 -10
- package/lib/commonjs/ToolCallSummary.js.map +1 -1
- package/lib/commonjs/agentSphereAssets.js +327 -0
- package/lib/commonjs/agentSphereAssets.js.map +1 -0
- package/lib/commonjs/agentSphereStyles.js +3 -3
- package/lib/commonjs/agentSphereStyles.js.map +1 -1
- package/lib/commonjs/apiClient.js +7 -0
- package/lib/commonjs/apiClient.js.map +1 -1
- package/lib/commonjs/attachmentUpload.js +2 -1
- package/lib/commonjs/attachmentUpload.js.map +1 -1
- package/lib/commonjs/composerStyles.js +2 -2
- package/lib/commonjs/composerStyles.js.map +1 -1
- package/lib/commonjs/connectorBrandIcons.generated.js +625 -0
- package/lib/commonjs/connectorBrandIcons.generated.js.map +1 -0
- package/lib/commonjs/connectorBrandIcons.js +3 -55
- package/lib/commonjs/connectorBrandIcons.js.map +1 -1
- package/lib/commonjs/connectorCatalog.js +19 -1
- package/lib/commonjs/connectorCatalog.js.map +1 -1
- package/lib/commonjs/conversationParts.js +5 -4
- package/lib/commonjs/conversationParts.js.map +1 -1
- package/lib/commonjs/conversationRuntime.js +152 -9
- package/lib/commonjs/conversationRuntime.js.map +1 -1
- package/lib/commonjs/conversationStyles.js +2 -1
- package/lib/commonjs/conversationStyles.js.map +1 -1
- package/lib/commonjs/editorShellStyles.js +6 -2
- package/lib/commonjs/editorShellStyles.js.map +1 -1
- package/lib/commonjs/fileTreeUtils.js +7 -0
- package/lib/commonjs/fileTreeUtils.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/markdownStyles.js +2 -2
- package/lib/commonjs/markdownStyles.js.map +1 -1
- package/lib/commonjs/messageActionStyles.js +2 -2
- package/lib/commonjs/messageActionStyles.js.map +1 -1
- package/lib/commonjs/realtimeClient.js +4 -1
- package/lib/commonjs/realtimeClient.js.map +1 -1
- package/lib/commonjs/renameAgentModalStyles.js +2 -2
- package/lib/commonjs/renameAgentModalStyles.js.map +1 -1
- package/lib/commonjs/screenParts.js +24 -41
- package/lib/commonjs/screenParts.js.map +1 -1
- package/lib/commonjs/styles.js +32 -21
- package/lib/commonjs/styles.js.map +1 -1
- package/lib/commonjs/superagentApiClient.js +63 -18
- package/lib/commonjs/superagentApiClient.js.map +1 -1
- package/lib/commonjs/theme.js +249 -0
- package/lib/commonjs/theme.js.map +1 -0
- package/lib/commonjs/useSuperagentConversation.js +240 -44
- package/lib/commonjs/useSuperagentConversation.js.map +1 -1
- package/lib/commonjs/useSuperagentRuntime.js +245 -105
- package/lib/commonjs/useSuperagentRuntime.js.map +1 -1
- package/lib/module/AgentSettingsPanel.js +157 -64
- package/lib/module/AgentSettingsPanel.js.map +1 -1
- package/lib/module/AgentSphereIcon.js +15 -118
- package/lib/module/AgentSphereIcon.js.map +1 -1
- package/lib/module/AttachmentPickerStatusModal.js +6 -5
- package/lib/module/AttachmentPickerStatusModal.js.map +1 -1
- package/lib/module/ChannelsPanel.js +67 -45
- package/lib/module/ChannelsPanel.js.map +1 -1
- package/lib/module/ConversationChat.js +38 -13
- package/lib/module/ConversationChat.js.map +1 -1
- package/lib/module/ConversationComposer.js +18 -13
- package/lib/module/ConversationComposer.js.map +1 -1
- package/lib/module/ConversationScreen.js +4 -0
- package/lib/module/ConversationScreen.js.map +1 -1
- package/lib/module/EditorDrawer.js +55 -25
- package/lib/module/EditorDrawer.js.map +1 -1
- package/lib/module/FilesPanel.js +56 -20
- package/lib/module/FilesPanel.js.map +1 -1
- package/lib/module/MarkdownText.js +1 -1
- package/lib/module/MarkdownText.js.map +1 -1
- package/lib/module/MessageActionBar.js +10 -3
- package/lib/module/MessageActionBar.js.map +1 -1
- package/lib/module/RenameAgentModal.js +2 -1
- package/lib/module/RenameAgentModal.js.map +1 -1
- package/lib/module/ShareAgentModal.js +11 -10
- package/lib/module/ShareAgentModal.js.map +1 -1
- package/lib/module/ShareAgentModal.styles.js +2 -2
- package/lib/module/ShareAgentModal.styles.js.map +1 -1
- package/lib/module/SuperagentHomeScreen.js +45 -13
- package/lib/module/SuperagentHomeScreen.js.map +1 -1
- package/lib/module/ToolApprovalCard.js +73 -15
- package/lib/module/ToolApprovalCard.js.map +1 -1
- package/lib/module/ToolCallSummary.js +19 -10
- package/lib/module/ToolCallSummary.js.map +1 -1
- package/lib/module/agentSphereAssets.js +323 -0
- package/lib/module/agentSphereAssets.js.map +1 -0
- package/lib/module/agentSphereStyles.js +3 -3
- package/lib/module/agentSphereStyles.js.map +1 -1
- package/lib/module/apiClient.js +7 -0
- package/lib/module/apiClient.js.map +1 -1
- package/lib/module/attachmentUpload.js +2 -1
- package/lib/module/attachmentUpload.js.map +1 -1
- package/lib/module/composerStyles.js +2 -2
- package/lib/module/composerStyles.js.map +1 -1
- package/lib/module/connectorBrandIcons.generated.js +621 -0
- package/lib/module/connectorBrandIcons.generated.js.map +1 -0
- package/lib/module/connectorBrandIcons.js +1 -53
- package/lib/module/connectorBrandIcons.js.map +1 -1
- package/lib/module/connectorCatalog.js +17 -0
- package/lib/module/connectorCatalog.js.map +1 -1
- package/lib/module/conversationParts.js +5 -4
- package/lib/module/conversationParts.js.map +1 -1
- package/lib/module/conversationRuntime.js +149 -9
- package/lib/module/conversationRuntime.js.map +1 -1
- package/lib/module/conversationStyles.js +3 -2
- package/lib/module/conversationStyles.js.map +1 -1
- package/lib/module/editorShellStyles.js +6 -2
- package/lib/module/editorShellStyles.js.map +1 -1
- package/lib/module/fileTreeUtils.js +6 -0
- package/lib/module/fileTreeUtils.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/markdownStyles.js +2 -2
- package/lib/module/markdownStyles.js.map +1 -1
- package/lib/module/messageActionStyles.js +2 -2
- package/lib/module/messageActionStyles.js.map +1 -1
- package/lib/module/realtimeClient.js +4 -1
- package/lib/module/realtimeClient.js.map +1 -1
- package/lib/module/renameAgentModalStyles.js +2 -2
- package/lib/module/renameAgentModalStyles.js.map +1 -1
- package/lib/module/screenParts.js +25 -42
- package/lib/module/screenParts.js.map +1 -1
- package/lib/module/styles.js +32 -21
- package/lib/module/styles.js.map +1 -1
- package/lib/module/superagentApiClient.js +63 -18
- package/lib/module/superagentApiClient.js.map +1 -1
- package/lib/module/theme.js +239 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/useSuperagentConversation.js +242 -46
- package/lib/module/useSuperagentConversation.js.map +1 -1
- package/lib/module/useSuperagentRuntime.js +246 -106
- package/lib/module/useSuperagentRuntime.js.map +1 -1
- package/lib/typescript/commonjs/AgentSettingsPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/AgentSphereIcon.d.ts.map +1 -1
- package/lib/typescript/commonjs/AttachmentPickerStatusModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ChannelsPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/ConversationChat.d.ts +1 -1
- package/lib/typescript/commonjs/ConversationChat.d.ts.map +1 -1
- package/lib/typescript/commonjs/ConversationComposer.d.ts.map +1 -1
- package/lib/typescript/commonjs/ConversationMessageList.d.ts +1 -1
- package/lib/typescript/commonjs/ConversationMessageList.d.ts.map +1 -1
- package/lib/typescript/commonjs/ConversationScreen.d.ts +2 -1
- package/lib/typescript/commonjs/ConversationScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/EditorDrawer.d.ts +1 -1
- package/lib/typescript/commonjs/EditorDrawer.d.ts.map +1 -1
- package/lib/typescript/commonjs/FilesPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/RenameAgentModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ShareAgentModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ShareAgentModal.styles.d.ts.map +1 -1
- package/lib/typescript/commonjs/SuperagentHomeScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ToolApprovalCard.d.ts +3 -3
- package/lib/typescript/commonjs/ToolApprovalCard.d.ts.map +1 -1
- package/lib/typescript/commonjs/ToolCallSummary.d.ts +1 -1
- package/lib/typescript/commonjs/ToolCallSummary.d.ts.map +1 -1
- package/lib/typescript/commonjs/agentSphereAssets.d.ts +2 -0
- package/lib/typescript/commonjs/agentSphereAssets.d.ts.map +1 -0
- package/lib/typescript/commonjs/agentSphereStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/apiClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/composerStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/connectorBrandIcons.d.ts.map +1 -1
- package/lib/typescript/commonjs/connectorBrandIcons.generated.d.ts +2 -0
- package/lib/typescript/commonjs/connectorBrandIcons.generated.d.ts.map +1 -0
- package/lib/typescript/commonjs/connectorCatalog.d.ts +2 -0
- package/lib/typescript/commonjs/connectorCatalog.d.ts.map +1 -1
- package/lib/typescript/commonjs/conversationParts.d.ts +1 -1
- package/lib/typescript/commonjs/conversationParts.d.ts.map +1 -1
- package/lib/typescript/commonjs/conversationRuntime.d.ts +9 -3
- package/lib/typescript/commonjs/conversationRuntime.d.ts.map +1 -1
- package/lib/typescript/commonjs/conversationStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/editorShellStyles.d.ts +4 -0
- package/lib/typescript/commonjs/editorShellStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/fileTreeUtils.d.ts +1 -0
- package/lib/typescript/commonjs/fileTreeUtils.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/markdownStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/messageActionStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/realtimeClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/renameAgentModalStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/screenParts.d.ts +1 -1
- package/lib/typescript/commonjs/screenParts.d.ts.map +1 -1
- package/lib/typescript/commonjs/styles.d.ts +20 -11
- package/lib/typescript/commonjs/styles.d.ts.map +1 -1
- package/lib/typescript/commonjs/superagentApiClient.d.ts +2 -1
- package/lib/typescript/commonjs/superagentApiClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme.d.ts +36 -0
- package/lib/typescript/commonjs/theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/types.d.ts +17 -2
- package/lib/typescript/commonjs/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/useSuperagentConversation.d.ts +3 -2
- package/lib/typescript/commonjs/useSuperagentConversation.d.ts.map +1 -1
- package/lib/typescript/commonjs/useSuperagentRuntime.d.ts +5 -2
- package/lib/typescript/commonjs/useSuperagentRuntime.d.ts.map +1 -1
- package/lib/typescript/module/AgentSettingsPanel.d.ts.map +1 -1
- package/lib/typescript/module/AgentSphereIcon.d.ts.map +1 -1
- package/lib/typescript/module/AttachmentPickerStatusModal.d.ts.map +1 -1
- package/lib/typescript/module/ChannelsPanel.d.ts.map +1 -1
- package/lib/typescript/module/ConversationChat.d.ts +1 -1
- package/lib/typescript/module/ConversationChat.d.ts.map +1 -1
- package/lib/typescript/module/ConversationComposer.d.ts.map +1 -1
- package/lib/typescript/module/ConversationMessageList.d.ts +1 -1
- package/lib/typescript/module/ConversationMessageList.d.ts.map +1 -1
- package/lib/typescript/module/ConversationScreen.d.ts +2 -1
- package/lib/typescript/module/ConversationScreen.d.ts.map +1 -1
- package/lib/typescript/module/EditorDrawer.d.ts +1 -1
- package/lib/typescript/module/EditorDrawer.d.ts.map +1 -1
- package/lib/typescript/module/FilesPanel.d.ts.map +1 -1
- package/lib/typescript/module/RenameAgentModal.d.ts.map +1 -1
- package/lib/typescript/module/ShareAgentModal.d.ts.map +1 -1
- package/lib/typescript/module/ShareAgentModal.styles.d.ts.map +1 -1
- package/lib/typescript/module/SuperagentHomeScreen.d.ts.map +1 -1
- package/lib/typescript/module/ToolApprovalCard.d.ts +3 -3
- package/lib/typescript/module/ToolApprovalCard.d.ts.map +1 -1
- package/lib/typescript/module/ToolCallSummary.d.ts +1 -1
- package/lib/typescript/module/ToolCallSummary.d.ts.map +1 -1
- package/lib/typescript/module/agentSphereAssets.d.ts +2 -0
- package/lib/typescript/module/agentSphereAssets.d.ts.map +1 -0
- package/lib/typescript/module/agentSphereStyles.d.ts.map +1 -1
- package/lib/typescript/module/apiClient.d.ts.map +1 -1
- package/lib/typescript/module/composerStyles.d.ts.map +1 -1
- package/lib/typescript/module/connectorBrandIcons.d.ts.map +1 -1
- package/lib/typescript/module/connectorBrandIcons.generated.d.ts +2 -0
- package/lib/typescript/module/connectorBrandIcons.generated.d.ts.map +1 -0
- package/lib/typescript/module/connectorCatalog.d.ts +2 -0
- package/lib/typescript/module/connectorCatalog.d.ts.map +1 -1
- package/lib/typescript/module/conversationParts.d.ts +1 -1
- package/lib/typescript/module/conversationParts.d.ts.map +1 -1
- package/lib/typescript/module/conversationRuntime.d.ts +9 -3
- package/lib/typescript/module/conversationRuntime.d.ts.map +1 -1
- package/lib/typescript/module/conversationStyles.d.ts.map +1 -1
- package/lib/typescript/module/editorShellStyles.d.ts +4 -0
- package/lib/typescript/module/editorShellStyles.d.ts.map +1 -1
- package/lib/typescript/module/fileTreeUtils.d.ts +1 -0
- package/lib/typescript/module/fileTreeUtils.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +2 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/markdownStyles.d.ts.map +1 -1
- package/lib/typescript/module/messageActionStyles.d.ts.map +1 -1
- package/lib/typescript/module/realtimeClient.d.ts.map +1 -1
- package/lib/typescript/module/renameAgentModalStyles.d.ts.map +1 -1
- package/lib/typescript/module/screenParts.d.ts +1 -1
- package/lib/typescript/module/screenParts.d.ts.map +1 -1
- package/lib/typescript/module/styles.d.ts +20 -11
- package/lib/typescript/module/styles.d.ts.map +1 -1
- package/lib/typescript/module/superagentApiClient.d.ts +2 -1
- package/lib/typescript/module/superagentApiClient.d.ts.map +1 -1
- package/lib/typescript/module/theme.d.ts +36 -0
- package/lib/typescript/module/theme.d.ts.map +1 -0
- package/lib/typescript/module/types.d.ts +17 -2
- package/lib/typescript/module/types.d.ts.map +1 -1
- package/lib/typescript/module/useSuperagentConversation.d.ts +3 -2
- package/lib/typescript/module/useSuperagentConversation.d.ts.map +1 -1
- package/lib/typescript/module/useSuperagentRuntime.d.ts +5 -2
- package/lib/typescript/module/useSuperagentRuntime.d.ts.map +1 -1
- package/package.json +13 -11
- package/src/AgentSettingsPanel.tsx +146 -58
- package/src/AgentSphereIcon.tsx +11 -62
- package/src/AttachmentPickerStatusModal.tsx +6 -5
- package/src/ChannelsPanel.tsx +59 -39
- package/src/ConversationChat.tsx +49 -12
- package/src/ConversationComposer.tsx +18 -12
- package/src/ConversationMessageList.tsx +1 -1
- package/src/ConversationScreen.tsx +5 -0
- package/src/EditorDrawer.tsx +66 -41
- package/src/FilesPanel.tsx +48 -20
- package/src/MarkdownText.tsx +1 -1
- package/src/MessageActionBar.tsx +9 -3
- package/src/RenameAgentModal.tsx +2 -1
- package/src/ShareAgentModal.styles.ts +2 -1
- package/src/ShareAgentModal.tsx +9 -8
- package/src/SuperagentHomeScreen.tsx +45 -10
- package/src/ToolApprovalCard.tsx +83 -15
- package/src/ToolCallSummary.tsx +22 -13
- package/src/agentSphereAssets.ts +325 -0
- package/src/agentSphereStyles.ts +3 -2
- package/src/apiClient.ts +7 -0
- package/src/attachmentUpload.ts +2 -1
- package/src/composerStyles.ts +2 -1
- package/src/connectorBrandIcons.generated.ts +618 -0
- package/src/connectorBrandIcons.tsx +1 -53
- package/src/connectorCatalog.ts +24 -0
- package/src/conversationParts.tsx +6 -5
- package/src/conversationRuntime.ts +166 -11
- package/src/conversationStyles.ts +2 -1
- package/src/editorShellStyles.ts +6 -1
- package/src/fileTreeUtils.ts +13 -0
- package/src/index.ts +2 -0
- package/src/markdownStyles.ts +2 -1
- package/src/messageActionStyles.ts +2 -1
- package/src/realtimeClient.ts +7 -1
- package/src/renameAgentModalStyles.ts +2 -1
- package/src/screenParts.tsx +17 -29
- package/src/styles.ts +25 -16
- package/src/superagentApiClient.ts +68 -18
- package/src/theme.ts +254 -0
- package/src/types.ts +22 -2
- package/src/useSuperagentConversation.ts +247 -45
- package/src/useSuperagentRuntime.ts +244 -107
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { createThemedStyles, themedColor, themedSurface, useSuperagentTheme } from './theme';
|
|
2
3
|
import {
|
|
3
4
|
ActivityIndicator,
|
|
4
5
|
Modal,
|
|
5
6
|
Pressable,
|
|
6
7
|
ScrollView,
|
|
7
|
-
StyleSheet,
|
|
8
8
|
Switch,
|
|
9
9
|
Text,
|
|
10
10
|
TextInput,
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
Eye,
|
|
19
19
|
EyeOff,
|
|
20
20
|
KeyRound,
|
|
21
|
+
Moon,
|
|
21
22
|
Plug,
|
|
22
23
|
Plus,
|
|
23
24
|
RefreshCcw,
|
|
@@ -82,7 +83,6 @@ type PendingAction =
|
|
|
82
83
|
| 'save-guards'
|
|
83
84
|
| 'save-secret'
|
|
84
85
|
| 'share'
|
|
85
|
-
| 'toggle-permission'
|
|
86
86
|
| null;
|
|
87
87
|
|
|
88
88
|
export function AgentSettingsPanel({
|
|
@@ -116,14 +116,23 @@ export function AgentSettingsPanel({
|
|
|
116
116
|
onUpdateToolPermissions?: SuperagentHomeScreenProps['onUpdateToolPermissions'];
|
|
117
117
|
secrets?: SuperagentSecret[];
|
|
118
118
|
}) {
|
|
119
|
+
const { scheme, setScheme } = useSuperagentTheme();
|
|
119
120
|
const [guardDrafts, setGuardDrafts] = useState<Record<string, string>>({});
|
|
120
121
|
const [newSecretName, setNewSecretName] = useState('');
|
|
121
122
|
const [newSecretValue, setNewSecretValue] = useState('');
|
|
122
123
|
const [isModelPickerOpen, setIsModelPickerOpen] = useState(false);
|
|
123
124
|
const [pendingAction, setPendingAction] = useState<PendingAction>(null);
|
|
125
|
+
const [deletingSecretName, setDeletingSecretName] = useState<string | null>(null);
|
|
124
126
|
const [visibleSecrets, setVisibleSecrets] = useState<Set<string>>(new Set());
|
|
125
127
|
|
|
126
|
-
const permissions =
|
|
128
|
+
const permissions = useMemo(
|
|
129
|
+
() => normalizePermissions(agent.toolsPermissionConfig),
|
|
130
|
+
[agent.toolsPermissionConfig],
|
|
131
|
+
);
|
|
132
|
+
// Optimistic override for the permission toggles: flipped immediately on
|
|
133
|
+
// press, cleared when fresh server state arrives, reverted on failure.
|
|
134
|
+
const [optimisticOps, setOptimisticOps] = useState<string[] | null>(null);
|
|
135
|
+
const autoApprovedOps = optimisticOps ?? permissions.auto_approved_operations;
|
|
127
136
|
const selectedModel = useMemo(
|
|
128
137
|
() => MODEL_OPTIONS.find((model) => model.id === (agent.model || 'default')) ?? MODEL_OPTIONS[0],
|
|
129
138
|
[agent.model],
|
|
@@ -140,8 +149,17 @@ export function AgentSettingsPanel({
|
|
|
140
149
|
);
|
|
141
150
|
|
|
142
151
|
useEffect(() => {
|
|
152
|
+
// Seed guard drafts only when switching agents — not on every
|
|
153
|
+
// toolsPermissionConfig change — so in-progress guard edits aren't wiped by
|
|
154
|
+
// an unrelated permission toggle before "Save rules" is pressed.
|
|
143
155
|
setGuardDrafts(permissions.connector_guards);
|
|
144
|
-
|
|
156
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
157
|
+
}, [agent.id]);
|
|
158
|
+
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
// Fresh server state (or an agent switch) supersedes the optimistic flip.
|
|
161
|
+
setOptimisticOps(null);
|
|
162
|
+
}, [agent.id, agent.toolsPermissionConfig]);
|
|
145
163
|
|
|
146
164
|
const runAction = async (action: Exclude<PendingAction, null>, handler: () => Promise<void> | void) => {
|
|
147
165
|
if (pendingAction) {
|
|
@@ -158,19 +176,62 @@ export function AgentSettingsPanel({
|
|
|
158
176
|
|
|
159
177
|
const updatePermissions = async (
|
|
160
178
|
nextConfig: SuperagentToolPermissionConfig,
|
|
161
|
-
action: Exclude<PendingAction, null
|
|
179
|
+
action: Exclude<PendingAction, null>,
|
|
162
180
|
) => {
|
|
163
181
|
if (!onUpdateToolPermissions) {
|
|
164
182
|
return;
|
|
165
183
|
}
|
|
166
184
|
|
|
167
|
-
|
|
185
|
+
try {
|
|
186
|
+
await runAction(action, () => onUpdateToolPermissions({
|
|
187
|
+
agentId: agent.id,
|
|
188
|
+
config: {
|
|
189
|
+
auto_approved_operations: nextConfig.auto_approved_operations ?? [],
|
|
190
|
+
connector_guards: cleanGuards(nextConfig.connector_guards ?? {}),
|
|
191
|
+
},
|
|
192
|
+
}));
|
|
193
|
+
} catch {
|
|
194
|
+
// onUpdateToolPermissions already surfaced the error; guard drafts stay
|
|
195
|
+
// dirty so the user can retry. (Nothing optimistic to revert on this path.)
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const toggleOperation = (operationId: string, enabled: boolean) => {
|
|
200
|
+
if (!onUpdateToolPermissions) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const nextOps = new Set(autoApprovedOps);
|
|
205
|
+
if (enabled) {
|
|
206
|
+
nextOps.add(operationId);
|
|
207
|
+
} else {
|
|
208
|
+
nextOps.delete(operationId);
|
|
209
|
+
}
|
|
210
|
+
const nextList = Array.from(nextOps);
|
|
211
|
+
|
|
212
|
+
// Optimistic: flip the switch now, sync with the server in the background,
|
|
213
|
+
// and fall back to the last known server state if the update fails.
|
|
214
|
+
setOptimisticOps(nextList);
|
|
215
|
+
Promise.resolve(onUpdateToolPermissions({
|
|
168
216
|
agentId: agent.id,
|
|
169
217
|
config: {
|
|
170
|
-
auto_approved_operations:
|
|
171
|
-
connector_guards: cleanGuards(
|
|
218
|
+
auto_approved_operations: nextList,
|
|
219
|
+
connector_guards: cleanGuards(permissions.connector_guards),
|
|
172
220
|
},
|
|
173
|
-
}))
|
|
221
|
+
})).catch(() => {
|
|
222
|
+
// Revert only this operation, not every optimistic flip: a sibling toggle
|
|
223
|
+
// the user changed in parallel may have already saved successfully, and
|
|
224
|
+
// clearing all optimistic state would visually undo it until a refresh.
|
|
225
|
+
setOptimisticOps((current) => {
|
|
226
|
+
const reverted = new Set(current ?? permissions.auto_approved_operations);
|
|
227
|
+
if (enabled) {
|
|
228
|
+
reverted.delete(operationId);
|
|
229
|
+
} else {
|
|
230
|
+
reverted.add(operationId);
|
|
231
|
+
}
|
|
232
|
+
return Array.from(reverted);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
174
235
|
};
|
|
175
236
|
|
|
176
237
|
const selectModel = (model: ModelOption) => {
|
|
@@ -206,16 +267,25 @@ export function AgentSettingsPanel({
|
|
|
206
267
|
|
|
207
268
|
const addSecret = async () => {
|
|
208
269
|
const name = newSecretName.trim().toUpperCase();
|
|
209
|
-
|
|
210
|
-
|
|
270
|
+
// Preserve the secret value byte-for-byte — PEM keys, tokens with a trailing
|
|
271
|
+
// newline, and whitespace-sensitive passwords must reach the backend exactly as
|
|
272
|
+
// typed (the API client sends it raw). Only require it to be non-empty.
|
|
273
|
+
const value = newSecretValue;
|
|
274
|
+
if (!name || !value.trim() || !onSaveSecret) {
|
|
211
275
|
return;
|
|
212
276
|
}
|
|
213
277
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
278
|
+
// Only clear the inputs after a successful save; if onSaveSecret rejects it
|
|
279
|
+
// already surfaced the error, and we keep the typed values so they aren't lost.
|
|
280
|
+
try {
|
|
281
|
+
await runAction('save-secret', async () => {
|
|
282
|
+
await onSaveSecret({ agentId: agent.id, name, value });
|
|
283
|
+
setNewSecretName('');
|
|
284
|
+
setNewSecretValue('');
|
|
285
|
+
});
|
|
286
|
+
} catch {
|
|
287
|
+
// onSaveSecret already surfaced the error; keep the form populated.
|
|
288
|
+
}
|
|
219
289
|
};
|
|
220
290
|
|
|
221
291
|
const deleteSecret = async (secret: SuperagentSecret) => {
|
|
@@ -223,7 +293,12 @@ export function AgentSettingsPanel({
|
|
|
223
293
|
return;
|
|
224
294
|
}
|
|
225
295
|
|
|
226
|
-
|
|
296
|
+
setDeletingSecretName(secret.name);
|
|
297
|
+
try {
|
|
298
|
+
await runAction('delete-secret', () => onDeleteSecret({ agentId: agent.id, name: secret.name }));
|
|
299
|
+
} finally {
|
|
300
|
+
setDeletingSecretName(null);
|
|
301
|
+
}
|
|
227
302
|
};
|
|
228
303
|
|
|
229
304
|
return (
|
|
@@ -256,9 +331,9 @@ export function AgentSettingsPanel({
|
|
|
256
331
|
<Text numberOfLines={1} style={localStyles.modelDropdownValue}>{selectedModel.label}</Text>
|
|
257
332
|
<View style={localStyles.modelDropdownIcon}>
|
|
258
333
|
{pendingAction === 'model' ? (
|
|
259
|
-
<ActivityIndicator color=
|
|
334
|
+
<ActivityIndicator color={themedColor('#F4F4F5')} size="small" />
|
|
260
335
|
) : (
|
|
261
|
-
<ChevronDown color=
|
|
336
|
+
<ChevronDown color={themedColor('#F4F4F5')} size={20} strokeWidth={2.5} />
|
|
262
337
|
)}
|
|
263
338
|
</View>
|
|
264
339
|
</Pressable>
|
|
@@ -296,9 +371,9 @@ export function AgentSettingsPanel({
|
|
|
296
371
|
style={({ pressed }) => [localStyles.iconButton, pressed && sharedStyles.pressed]}
|
|
297
372
|
>
|
|
298
373
|
{isVisible ? (
|
|
299
|
-
<EyeOff color=
|
|
374
|
+
<EyeOff color={themedColor('#E4E4E7')} size={16} strokeWidth={2.4} />
|
|
300
375
|
) : (
|
|
301
|
-
<Eye color=
|
|
376
|
+
<Eye color={themedColor('#E4E4E7')} size={16} strokeWidth={2.4} />
|
|
302
377
|
)}
|
|
303
378
|
</Pressable>
|
|
304
379
|
<Pressable
|
|
@@ -308,10 +383,10 @@ export function AgentSettingsPanel({
|
|
|
308
383
|
onPress={() => deleteSecret(secret)}
|
|
309
384
|
style={({ pressed }) => [localStyles.iconButtonDanger, pressed && sharedStyles.pressed]}
|
|
310
385
|
>
|
|
311
|
-
{
|
|
312
|
-
<ActivityIndicator color=
|
|
386
|
+
{deletingSecretName === secret.name ? (
|
|
387
|
+
<ActivityIndicator color={themedColor('#FCA5A5')} size="small" />
|
|
313
388
|
) : (
|
|
314
|
-
<Trash2 color=
|
|
389
|
+
<Trash2 color={themedColor('#FCA5A5')} size={16} strokeWidth={2.4} />
|
|
315
390
|
)}
|
|
316
391
|
</Pressable>
|
|
317
392
|
</View>
|
|
@@ -327,14 +402,14 @@ export function AgentSettingsPanel({
|
|
|
327
402
|
autoCapitalize="characters"
|
|
328
403
|
onChangeText={(value) => setNewSecretName(value.toUpperCase())}
|
|
329
404
|
placeholder="SECRET_NAME"
|
|
330
|
-
placeholderTextColor=
|
|
405
|
+
placeholderTextColor={themedColor('#71717A')}
|
|
331
406
|
style={localStyles.textInput}
|
|
332
407
|
value={newSecretName}
|
|
333
408
|
/>
|
|
334
409
|
<TextInput
|
|
335
410
|
onChangeText={setNewSecretValue}
|
|
336
411
|
placeholder="Value"
|
|
337
|
-
placeholderTextColor=
|
|
412
|
+
placeholderTextColor={themedColor('#71717A')}
|
|
338
413
|
secureTextEntry
|
|
339
414
|
style={localStyles.textInput}
|
|
340
415
|
value={newSecretValue}
|
|
@@ -351,22 +426,42 @@ export function AgentSettingsPanel({
|
|
|
351
426
|
]}
|
|
352
427
|
>
|
|
353
428
|
{pendingAction === 'save-secret' ? (
|
|
354
|
-
<ActivityIndicator color=
|
|
429
|
+
<ActivityIndicator color={themedColor('#111111')} size="small" />
|
|
355
430
|
) : (
|
|
356
|
-
<Plus color=
|
|
431
|
+
<Plus color={themedColor('#111111')} size={16} strokeWidth={2.6} />
|
|
357
432
|
)}
|
|
358
433
|
<Text style={localStyles.primaryButtonText}>Add</Text>
|
|
359
434
|
</Pressable>
|
|
360
435
|
</View>
|
|
361
436
|
</SettingsSection>
|
|
362
437
|
|
|
438
|
+
<SettingsSection
|
|
439
|
+
icon={Moon}
|
|
440
|
+
subtitle="Choose how Superagent looks on this device."
|
|
441
|
+
title="Appearance"
|
|
442
|
+
>
|
|
443
|
+
<View style={localStyles.permissionRow}>
|
|
444
|
+
<View style={localStyles.permissionText}>
|
|
445
|
+
<Text style={localStyles.rowTitle}>Dark mode</Text>
|
|
446
|
+
<Text style={localStyles.rowBody}>Use the dark theme across all Superagent screens.</Text>
|
|
447
|
+
</View>
|
|
448
|
+
<Switch
|
|
449
|
+
ios_backgroundColor={themedSurface('#2A2A2A')}
|
|
450
|
+
onValueChange={(enabled) => setScheme(enabled ? 'dark' : 'light')}
|
|
451
|
+
thumbColor="#F4F4F5"
|
|
452
|
+
trackColor={{ false: themedSurface('#2A2A2A'), true: '#246B43' }}
|
|
453
|
+
value={scheme === 'dark'}
|
|
454
|
+
/>
|
|
455
|
+
</View>
|
|
456
|
+
</SettingsSection>
|
|
457
|
+
|
|
363
458
|
<SettingsSection
|
|
364
459
|
icon={ShieldCheck}
|
|
365
460
|
subtitle="Matches the web tool permission controls."
|
|
366
461
|
title="Tool Permissions"
|
|
367
462
|
>
|
|
368
463
|
{TOOL_OPERATIONS.map((operation) => {
|
|
369
|
-
const isEnabled =
|
|
464
|
+
const isEnabled = autoApprovedOps.includes(operation.id);
|
|
370
465
|
return (
|
|
371
466
|
<View key={operation.id} style={localStyles.permissionRow}>
|
|
372
467
|
<View style={localStyles.permissionText}>
|
|
@@ -374,22 +469,11 @@ export function AgentSettingsPanel({
|
|
|
374
469
|
<Text style={localStyles.rowBody}>{operation.body}</Text>
|
|
375
470
|
</View>
|
|
376
471
|
<Switch
|
|
377
|
-
disabled={!onUpdateToolPermissions
|
|
378
|
-
ios_backgroundColor=
|
|
379
|
-
onValueChange={(enabled) =>
|
|
380
|
-
const nextOps = new Set(permissions.auto_approved_operations);
|
|
381
|
-
if (enabled) {
|
|
382
|
-
nextOps.add(operation.id);
|
|
383
|
-
} else {
|
|
384
|
-
nextOps.delete(operation.id);
|
|
385
|
-
}
|
|
386
|
-
updatePermissions({
|
|
387
|
-
...permissions,
|
|
388
|
-
auto_approved_operations: Array.from(nextOps),
|
|
389
|
-
});
|
|
390
|
-
}}
|
|
472
|
+
disabled={!onUpdateToolPermissions}
|
|
473
|
+
ios_backgroundColor={themedSurface('#2A2A2A')}
|
|
474
|
+
onValueChange={(enabled) => toggleOperation(operation.id, enabled)}
|
|
391
475
|
thumbColor="#F4F4F5"
|
|
392
|
-
trackColor={{ false: '#2A2A2A', true: '#246B43' }}
|
|
476
|
+
trackColor={{ false: themedSurface('#2A2A2A'), true: '#246B43' }}
|
|
393
477
|
value={isEnabled}
|
|
394
478
|
/>
|
|
395
479
|
</View>
|
|
@@ -431,7 +515,7 @@ export function AgentSettingsPanel({
|
|
|
431
515
|
}));
|
|
432
516
|
}}
|
|
433
517
|
placeholder="Example: ask before sending email outside my domain."
|
|
434
|
-
placeholderTextColor=
|
|
518
|
+
placeholderTextColor={themedColor('#71717A')}
|
|
435
519
|
style={[localStyles.textInput, localStyles.guardInput]}
|
|
436
520
|
value={guardDrafts[connectorId] ?? ''}
|
|
437
521
|
/>
|
|
@@ -447,7 +531,11 @@ export function AgentSettingsPanel({
|
|
|
447
531
|
accessibilityRole="button"
|
|
448
532
|
disabled={!onUpdateToolPermissions || !guardDraftsDirty || pendingAction === 'save-guards'}
|
|
449
533
|
onPress={() => updatePermissions({
|
|
450
|
-
|
|
534
|
+
// Carry the latest optimistic toggle state (autoApprovedOps), not the
|
|
535
|
+
// stale server-backed list: this PUT sends the FULL config, so using
|
|
536
|
+
// the server value would clobber a toggle the user just flipped but
|
|
537
|
+
// whose own request hasn't synced agent.toolsPermissionConfig yet.
|
|
538
|
+
auto_approved_operations: autoApprovedOps,
|
|
451
539
|
connector_guards: guardDrafts,
|
|
452
540
|
}, 'save-guards')}
|
|
453
541
|
style={({ pressed }) => [
|
|
@@ -457,9 +545,9 @@ export function AgentSettingsPanel({
|
|
|
457
545
|
]}
|
|
458
546
|
>
|
|
459
547
|
{pendingAction === 'save-guards' ? (
|
|
460
|
-
<ActivityIndicator color=
|
|
548
|
+
<ActivityIndicator color={themedColor('#F4F4F5')} size="small" />
|
|
461
549
|
) : (
|
|
462
|
-
<Check color=
|
|
550
|
+
<Check color={themedColor('#F4F4F5')} size={16} strokeWidth={2.6} />
|
|
463
551
|
)}
|
|
464
552
|
<Text style={localStyles.secondaryButtonText}>Save rules</Text>
|
|
465
553
|
</Pressable>
|
|
@@ -527,7 +615,7 @@ function SettingsSection({
|
|
|
527
615
|
<View style={[localStyles.sectionCard, isDanger && localStyles.dangerSectionCard]}>
|
|
528
616
|
<View style={localStyles.sectionHeader}>
|
|
529
617
|
<View style={[localStyles.sectionIcon, isDanger && localStyles.sectionIconDanger]}>
|
|
530
|
-
<Icon color={isDanger ? '#FCA5A5' : '#F4F4F5'} size={19} strokeWidth={2.35} />
|
|
618
|
+
<Icon color={isDanger ? themedColor('#FCA5A5') : themedColor('#F4F4F5')} size={19} strokeWidth={2.35} />
|
|
531
619
|
</View>
|
|
532
620
|
<View style={localStyles.sectionTitleWrap}>
|
|
533
621
|
<Text style={localStyles.sectionTitle}>{title}</Text>
|
|
@@ -537,7 +625,7 @@ function SettingsSection({
|
|
|
537
625
|
</View>
|
|
538
626
|
{isLoading ? (
|
|
539
627
|
<View style={localStyles.loadingRow}>
|
|
540
|
-
<ActivityIndicator color=
|
|
628
|
+
<ActivityIndicator color={themedColor('#FF5A1F')} />
|
|
541
629
|
<Text style={localStyles.mutedText}>Loading...</Text>
|
|
542
630
|
</View>
|
|
543
631
|
) : children}
|
|
@@ -565,9 +653,9 @@ function HeaderAction({
|
|
|
565
653
|
style={({ pressed }) => [localStyles.headerAction, pressed && sharedStyles.pressed]}
|
|
566
654
|
>
|
|
567
655
|
{isLoading ? (
|
|
568
|
-
<ActivityIndicator color=
|
|
656
|
+
<ActivityIndicator color={themedColor('#F4F4F5')} size="small" />
|
|
569
657
|
) : (
|
|
570
|
-
<Icon color=
|
|
658
|
+
<Icon color={themedColor('#F4F4F5')} size={16} strokeWidth={2.4} />
|
|
571
659
|
)}
|
|
572
660
|
</Pressable>
|
|
573
661
|
);
|
|
@@ -614,7 +702,7 @@ function ModelPickerModal({
|
|
|
614
702
|
<Text style={localStyles.modelModalOptionLabel}>{model.label}</Text>
|
|
615
703
|
<Text numberOfLines={2} style={localStyles.modelDescription}>{model.description}</Text>
|
|
616
704
|
</View>
|
|
617
|
-
{isSelected ? <Check color=
|
|
705
|
+
{isSelected ? <Check color={themedColor('#34D399')} size={18} strokeWidth={2.7} /> : null}
|
|
618
706
|
</Pressable>
|
|
619
707
|
);
|
|
620
708
|
})}
|
|
@@ -655,9 +743,9 @@ function ActionRow({
|
|
|
655
743
|
>
|
|
656
744
|
<View style={[localStyles.actionIcon, isDanger && localStyles.actionIconDanger]}>
|
|
657
745
|
{isLoading ? (
|
|
658
|
-
<ActivityIndicator color={isDanger ? '#FCA5A5' : '#F4F4F5'} size="small" />
|
|
746
|
+
<ActivityIndicator color={isDanger ? themedColor('#FCA5A5') : themedColor('#F4F4F5')} size="small" />
|
|
659
747
|
) : (
|
|
660
|
-
<Icon color={isDanger ? '#FCA5A5' : '#F4F4F5'} size={18} strokeWidth={2.35} />
|
|
748
|
+
<Icon color={isDanger ? themedColor('#FCA5A5') : themedColor('#F4F4F5')} size={18} strokeWidth={2.35} />
|
|
661
749
|
)}
|
|
662
750
|
</View>
|
|
663
751
|
<View style={localStyles.actionText}>
|
|
@@ -699,9 +787,9 @@ function ShareMembersSummary({
|
|
|
699
787
|
>
|
|
700
788
|
<View style={localStyles.actionIcon}>
|
|
701
789
|
{isLoading || isSharing ? (
|
|
702
|
-
<ActivityIndicator color=
|
|
790
|
+
<ActivityIndicator color={themedColor('#F4F4F5')} size="small" />
|
|
703
791
|
) : (
|
|
704
|
-
<Share2 color=
|
|
792
|
+
<Share2 color={themedColor('#F4F4F5')} size={18} strokeWidth={2.35} />
|
|
705
793
|
)}
|
|
706
794
|
</View>
|
|
707
795
|
<View style={localStyles.actionText}>
|
|
@@ -737,7 +825,7 @@ function toggleSecretVisibility(current: Set<string>, name: string) {
|
|
|
737
825
|
return next;
|
|
738
826
|
}
|
|
739
827
|
|
|
740
|
-
const localStyles =
|
|
828
|
+
const localStyles = createThemedStyles({
|
|
741
829
|
actionIcon: {
|
|
742
830
|
alignItems: 'center',
|
|
743
831
|
backgroundColor: '#1F1F23',
|
package/src/AgentSphereIcon.tsx
CHANGED
|
@@ -1,32 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { themedColor } from './theme';
|
|
2
3
|
import { Image, Text, View } from 'react-native';
|
|
3
4
|
import { User } from 'lucide-react-native';
|
|
4
|
-
import
|
|
5
|
-
Circle,
|
|
6
|
-
ClipPath,
|
|
7
|
-
Defs,
|
|
8
|
-
Ellipse,
|
|
9
|
-
G,
|
|
10
|
-
LinearGradient,
|
|
11
|
-
Path,
|
|
12
|
-
RadialGradient,
|
|
13
|
-
Rect,
|
|
14
|
-
Stop,
|
|
15
|
-
} from 'react-native-svg';
|
|
5
|
+
import { SvgXml } from 'react-native-svg';
|
|
16
6
|
|
|
7
|
+
import { AGENT_SPHERE_SVGS } from './agentSphereAssets';
|
|
17
8
|
import { agentSphereStyles } from './agentSphereStyles';
|
|
18
9
|
import type { SuperagentAgent } from './types';
|
|
19
10
|
|
|
20
11
|
const SIZES = { header: 34, md: 30, sm: 24 };
|
|
21
12
|
|
|
22
|
-
const SPHERE_PALETTES = [
|
|
23
|
-
['#FF4F00', '#FF9867', '#F5D3A2', '#A9B0ED', '#FFF3E2'],
|
|
24
|
-
['#23AEE0', '#3874FF', '#93C5F7', '#33EBFF', '#D1F3FF'],
|
|
25
|
-
['#119C72', '#5FE6A3', '#C8FACC', '#2F7D6D', '#F0FFF4'],
|
|
26
|
-
['#9BE266', '#D9F99D', '#5AC27C', '#F4FFE7', '#7EA650'],
|
|
27
|
-
['#0A0A0F', '#2A2A36', '#73717F', '#F4F4F5', '#15151C'],
|
|
28
|
-
] as const;
|
|
29
|
-
|
|
30
13
|
export function AgentSphereIcon({
|
|
31
14
|
agent,
|
|
32
15
|
isUser = false,
|
|
@@ -72,7 +55,7 @@ export function AgentSphereIcon({
|
|
|
72
55
|
agentSphereStyles.userFrame,
|
|
73
56
|
{ borderRadius, height: dimension, width: dimension },
|
|
74
57
|
]}>
|
|
75
|
-
<User color=
|
|
58
|
+
<User color={themedColor('#D4D4D8')} size={dimension * 0.48} strokeWidth={2.4} />
|
|
76
59
|
</View>
|
|
77
60
|
);
|
|
78
61
|
}
|
|
@@ -114,42 +97,13 @@ export function AgentSphereIcon({
|
|
|
114
97
|
}
|
|
115
98
|
|
|
116
99
|
function SphereAvatar({ avatarIndex, size }: { avatarIndex?: number | null; size: number }) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
return (
|
|
125
|
-
<Svg width={size} height={size} viewBox="0 0 48 48">
|
|
126
|
-
<Defs>
|
|
127
|
-
<ClipPath id={clipId}>
|
|
128
|
-
<Circle cx="24" cy="24" r="19" />
|
|
129
|
-
</ClipPath>
|
|
130
|
-
<RadialGradient id={glowId} cx="38%" cy="30%" r="72%">
|
|
131
|
-
<Stop offset="0%" stopColor={palette[4]} stopOpacity="0.95" />
|
|
132
|
-
<Stop offset="36%" stopColor={palette[2]} stopOpacity="0.92" />
|
|
133
|
-
<Stop offset="72%" stopColor={palette[1]} stopOpacity="0.92" />
|
|
134
|
-
<Stop offset="100%" stopColor={palette[0]} stopOpacity="1" />
|
|
135
|
-
</RadialGradient>
|
|
136
|
-
<LinearGradient id={sheenId} x1="7" y1="3" x2="44" y2="47">
|
|
137
|
-
<Stop offset="0%" stopColor="#FFFFFF" stopOpacity="0" />
|
|
138
|
-
<Stop offset="42%" stopColor="#FFFFFF" stopOpacity="0.08" />
|
|
139
|
-
<Stop offset="100%" stopColor="#FFFFFF" stopOpacity="0.24" />
|
|
140
|
-
</LinearGradient>
|
|
141
|
-
</Defs>
|
|
142
|
-
<G clipPath={`url(#${clipId})`}>
|
|
143
|
-
<Rect width="48" height="48" fill={`url(#${glowId})`} />
|
|
144
|
-
<Ellipse cx="12" cy="18" rx="17" ry="8" fill={palette[1]} opacity="0.95" transform="rotate(-26 12 18)" />
|
|
145
|
-
<Ellipse cx="31" cy="13" rx="18" ry="7" fill={palette[2]} opacity="0.94" transform="rotate(25 31 13)" />
|
|
146
|
-
<Ellipse cx="34" cy="31" rx="18" ry="10" fill={palette[3]} opacity="0.68" transform="rotate(-18 34 31)" />
|
|
147
|
-
<Ellipse cx="16" cy="37" rx="18" ry="5" fill={palette[4]} opacity="0.72" transform="rotate(-5 16 37)" />
|
|
148
|
-
<Path d="M6 30 C15 16 27 18 41 27 C36 40 14 44 6 30Z" fill="#FFFFFF" opacity="0.16" />
|
|
149
|
-
<Rect x="-5" y="-2" width="58" height="54" fill={`url(#${sheenId})`} />
|
|
150
|
-
</G>
|
|
151
|
-
</Svg>
|
|
152
|
-
);
|
|
100
|
+
// Renders the same built-in sphere SVGs the web builder uses, selected by
|
|
101
|
+
// avatarIndex (see AgentAvatarImage in the builder app). The artwork's
|
|
102
|
+
// visible sphere is a r=19 circle in a 48-unit viewBox, so scale up to make
|
|
103
|
+
// the sphere itself span `size`; the frame clips the transparent margins.
|
|
104
|
+
const index = ((avatarIndex ?? 0) % AGENT_SPHERE_SVGS.length + AGENT_SPHERE_SVGS.length) % AGENT_SPHERE_SVGS.length;
|
|
105
|
+
const renderedSize = size * (48 / 38);
|
|
106
|
+
return <SvgXml xml={AGENT_SPHERE_SVGS[index]} width={renderedSize} height={renderedSize} />;
|
|
153
107
|
}
|
|
154
108
|
|
|
155
109
|
function getAgentLogo(agent?: SuperagentAgent) {
|
|
@@ -163,8 +117,3 @@ function getAgentLogo(agent?: SuperagentAgent) {
|
|
|
163
117
|
url: logoUrl || null,
|
|
164
118
|
};
|
|
165
119
|
}
|
|
166
|
-
|
|
167
|
-
function getSpherePalette(avatarIndex?: number | null) {
|
|
168
|
-
const index = ((avatarIndex ?? 0) % SPHERE_PALETTES.length + SPHERE_PALETTES.length) % SPHERE_PALETTES.length;
|
|
169
|
-
return SPHERE_PALETTES[index];
|
|
170
|
-
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createThemedStyles, themedColor } from './theme';
|
|
3
|
+
import {ActivityIndicator, Modal, Pressable, Text, View} from 'react-native';
|
|
3
4
|
|
|
4
5
|
export function AttachmentPickerStatusModal({
|
|
5
6
|
isError,
|
|
@@ -16,12 +17,12 @@ export function AttachmentPickerStatusModal({
|
|
|
16
17
|
<Modal animationType="fade" transparent visible onRequestClose={onClose}>
|
|
17
18
|
<View style={styles.backdrop}>
|
|
18
19
|
<View style={styles.sheet}>
|
|
19
|
-
{isError ? null : <ActivityIndicator color=
|
|
20
|
+
{isError ? null : <ActivityIndicator color={themedColor('#F4F4F5')} style={styles.loader} />}
|
|
20
21
|
<Text style={styles.title}>{title}</Text>
|
|
21
22
|
<Text style={[styles.message, isError ? styles.error : undefined]}>{message}</Text>
|
|
22
|
-
{
|
|
23
|
+
{onClose ? (
|
|
23
24
|
<Pressable accessibilityRole="button" onPress={onClose} style={styles.closeButton}>
|
|
24
|
-
<Text style={styles.closeText}>Close</Text>
|
|
25
|
+
<Text style={styles.closeText}>{isError ? 'Close' : 'Cancel'}</Text>
|
|
25
26
|
</Pressable>
|
|
26
27
|
) : null}
|
|
27
28
|
</View>
|
|
@@ -30,7 +31,7 @@ export function AttachmentPickerStatusModal({
|
|
|
30
31
|
);
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
const styles =
|
|
34
|
+
const styles = createThemedStyles({
|
|
34
35
|
backdrop: {
|
|
35
36
|
alignItems: 'center',
|
|
36
37
|
backgroundColor: 'rgba(0, 0, 0, 0.62)',
|