@base44/superagent-native 0.0.2 → 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.
Files changed (306) hide show
  1. package/lib/commonjs/AgentSettingsPanel.js +123 -47
  2. package/lib/commonjs/AgentSettingsPanel.js.map +1 -1
  3. package/lib/commonjs/AgentSphereIcon.js +14 -118
  4. package/lib/commonjs/AgentSphereIcon.js.map +1 -1
  5. package/lib/commonjs/AttachmentPickerStatusModal.js +3 -2
  6. package/lib/commonjs/AttachmentPickerStatusModal.js.map +1 -1
  7. package/lib/commonjs/ChannelsPanel.js +66 -44
  8. package/lib/commonjs/ChannelsPanel.js.map +1 -1
  9. package/lib/commonjs/ConversationChat.js +11 -2
  10. package/lib/commonjs/ConversationChat.js.map +1 -1
  11. package/lib/commonjs/ConversationComposer.js +8 -7
  12. package/lib/commonjs/ConversationComposer.js.map +1 -1
  13. package/lib/commonjs/ConversationScreen.js +2 -0
  14. package/lib/commonjs/ConversationScreen.js.map +1 -1
  15. package/lib/commonjs/EditorDrawer.js +54 -24
  16. package/lib/commonjs/EditorDrawer.js.map +1 -1
  17. package/lib/commonjs/FilesPanel.js +56 -20
  18. package/lib/commonjs/FilesPanel.js.map +1 -1
  19. package/lib/commonjs/RenameAgentModal.js +2 -1
  20. package/lib/commonjs/RenameAgentModal.js.map +1 -1
  21. package/lib/commonjs/ShareAgentModal.js +11 -10
  22. package/lib/commonjs/ShareAgentModal.js.map +1 -1
  23. package/lib/commonjs/ShareAgentModal.styles.js +2 -2
  24. package/lib/commonjs/ShareAgentModal.styles.js.map +1 -1
  25. package/lib/commonjs/SuperagentHomeScreen.js +27 -9
  26. package/lib/commonjs/SuperagentHomeScreen.js.map +1 -1
  27. package/lib/commonjs/ToolApprovalCard.js +72 -14
  28. package/lib/commonjs/ToolApprovalCard.js.map +1 -1
  29. package/lib/commonjs/ToolCallSummary.js +14 -9
  30. package/lib/commonjs/ToolCallSummary.js.map +1 -1
  31. package/lib/commonjs/agentSphereAssets.js +327 -0
  32. package/lib/commonjs/agentSphereAssets.js.map +1 -0
  33. package/lib/commonjs/agentSphereStyles.js +3 -3
  34. package/lib/commonjs/agentSphereStyles.js.map +1 -1
  35. package/lib/commonjs/apiClient.js +7 -0
  36. package/lib/commonjs/apiClient.js.map +1 -1
  37. package/lib/commonjs/composerStyles.js +2 -2
  38. package/lib/commonjs/composerStyles.js.map +1 -1
  39. package/lib/commonjs/connectorBrandIcons.generated.js +625 -0
  40. package/lib/commonjs/connectorBrandIcons.generated.js.map +1 -0
  41. package/lib/commonjs/connectorBrandIcons.js +3 -55
  42. package/lib/commonjs/connectorBrandIcons.js.map +1 -1
  43. package/lib/commonjs/connectorCatalog.js +19 -1
  44. package/lib/commonjs/connectorCatalog.js.map +1 -1
  45. package/lib/commonjs/conversationParts.js +5 -4
  46. package/lib/commonjs/conversationParts.js.map +1 -1
  47. package/lib/commonjs/conversationRuntime.js +120 -12
  48. package/lib/commonjs/conversationRuntime.js.map +1 -1
  49. package/lib/commonjs/conversationStyles.js +2 -1
  50. package/lib/commonjs/conversationStyles.js.map +1 -1
  51. package/lib/commonjs/editorShellStyles.js +6 -2
  52. package/lib/commonjs/editorShellStyles.js.map +1 -1
  53. package/lib/commonjs/index.js +7 -0
  54. package/lib/commonjs/index.js.map +1 -1
  55. package/lib/commonjs/markdownStyles.js +2 -2
  56. package/lib/commonjs/markdownStyles.js.map +1 -1
  57. package/lib/commonjs/messageActionStyles.js +2 -2
  58. package/lib/commonjs/messageActionStyles.js.map +1 -1
  59. package/lib/commonjs/realtimeClient.js +4 -1
  60. package/lib/commonjs/realtimeClient.js.map +1 -1
  61. package/lib/commonjs/renameAgentModalStyles.js +2 -2
  62. package/lib/commonjs/renameAgentModalStyles.js.map +1 -1
  63. package/lib/commonjs/screenParts.js +24 -41
  64. package/lib/commonjs/screenParts.js.map +1 -1
  65. package/lib/commonjs/styles.js +71 -60
  66. package/lib/commonjs/styles.js.map +1 -1
  67. package/lib/commonjs/superagentApiClient.js +63 -18
  68. package/lib/commonjs/superagentApiClient.js.map +1 -1
  69. package/lib/commonjs/theme.js +249 -0
  70. package/lib/commonjs/theme.js.map +1 -0
  71. package/lib/commonjs/useSuperagentConversation.js +133 -20
  72. package/lib/commonjs/useSuperagentConversation.js.map +1 -1
  73. package/lib/commonjs/useSuperagentRuntime.js +167 -82
  74. package/lib/commonjs/useSuperagentRuntime.js.map +1 -1
  75. package/lib/module/AgentSettingsPanel.js +125 -49
  76. package/lib/module/AgentSettingsPanel.js.map +1 -1
  77. package/lib/module/AgentSphereIcon.js +15 -118
  78. package/lib/module/AgentSphereIcon.js.map +1 -1
  79. package/lib/module/AttachmentPickerStatusModal.js +4 -3
  80. package/lib/module/AttachmentPickerStatusModal.js.map +1 -1
  81. package/lib/module/ChannelsPanel.js +67 -45
  82. package/lib/module/ChannelsPanel.js.map +1 -1
  83. package/lib/module/ConversationChat.js +11 -2
  84. package/lib/module/ConversationChat.js.map +1 -1
  85. package/lib/module/ConversationComposer.js +8 -7
  86. package/lib/module/ConversationComposer.js.map +1 -1
  87. package/lib/module/ConversationScreen.js +2 -0
  88. package/lib/module/ConversationScreen.js.map +1 -1
  89. package/lib/module/EditorDrawer.js +55 -25
  90. package/lib/module/EditorDrawer.js.map +1 -1
  91. package/lib/module/FilesPanel.js +56 -20
  92. package/lib/module/FilesPanel.js.map +1 -1
  93. package/lib/module/RenameAgentModal.js +2 -1
  94. package/lib/module/RenameAgentModal.js.map +1 -1
  95. package/lib/module/ShareAgentModal.js +11 -10
  96. package/lib/module/ShareAgentModal.js.map +1 -1
  97. package/lib/module/ShareAgentModal.styles.js +2 -2
  98. package/lib/module/ShareAgentModal.styles.js.map +1 -1
  99. package/lib/module/SuperagentHomeScreen.js +27 -9
  100. package/lib/module/SuperagentHomeScreen.js.map +1 -1
  101. package/lib/module/ToolApprovalCard.js +72 -14
  102. package/lib/module/ToolApprovalCard.js.map +1 -1
  103. package/lib/module/ToolCallSummary.js +14 -9
  104. package/lib/module/ToolCallSummary.js.map +1 -1
  105. package/lib/module/agentSphereAssets.js +323 -0
  106. package/lib/module/agentSphereAssets.js.map +1 -0
  107. package/lib/module/agentSphereStyles.js +3 -3
  108. package/lib/module/agentSphereStyles.js.map +1 -1
  109. package/lib/module/apiClient.js +7 -0
  110. package/lib/module/apiClient.js.map +1 -1
  111. package/lib/module/composerStyles.js +2 -2
  112. package/lib/module/composerStyles.js.map +1 -1
  113. package/lib/module/connectorBrandIcons.generated.js +621 -0
  114. package/lib/module/connectorBrandIcons.generated.js.map +1 -0
  115. package/lib/module/connectorBrandIcons.js +1 -53
  116. package/lib/module/connectorBrandIcons.js.map +1 -1
  117. package/lib/module/connectorCatalog.js +17 -0
  118. package/lib/module/connectorCatalog.js.map +1 -1
  119. package/lib/module/conversationParts.js +5 -4
  120. package/lib/module/conversationParts.js.map +1 -1
  121. package/lib/module/conversationRuntime.js +118 -12
  122. package/lib/module/conversationRuntime.js.map +1 -1
  123. package/lib/module/conversationStyles.js +3 -2
  124. package/lib/module/conversationStyles.js.map +1 -1
  125. package/lib/module/editorShellStyles.js +6 -2
  126. package/lib/module/editorShellStyles.js.map +1 -1
  127. package/lib/module/index.js +1 -0
  128. package/lib/module/index.js.map +1 -1
  129. package/lib/module/markdownStyles.js +2 -2
  130. package/lib/module/markdownStyles.js.map +1 -1
  131. package/lib/module/messageActionStyles.js +2 -2
  132. package/lib/module/messageActionStyles.js.map +1 -1
  133. package/lib/module/realtimeClient.js +4 -1
  134. package/lib/module/realtimeClient.js.map +1 -1
  135. package/lib/module/renameAgentModalStyles.js +2 -2
  136. package/lib/module/renameAgentModalStyles.js.map +1 -1
  137. package/lib/module/screenParts.js +25 -42
  138. package/lib/module/screenParts.js.map +1 -1
  139. package/lib/module/styles.js +71 -60
  140. package/lib/module/styles.js.map +1 -1
  141. package/lib/module/superagentApiClient.js +63 -18
  142. package/lib/module/superagentApiClient.js.map +1 -1
  143. package/lib/module/theme.js +239 -0
  144. package/lib/module/theme.js.map +1 -0
  145. package/lib/module/useSuperagentConversation.js +135 -22
  146. package/lib/module/useSuperagentConversation.js.map +1 -1
  147. package/lib/module/useSuperagentRuntime.js +167 -82
  148. package/lib/module/useSuperagentRuntime.js.map +1 -1
  149. package/lib/typescript/commonjs/AgentSettingsPanel.d.ts.map +1 -1
  150. package/lib/typescript/commonjs/AgentSphereIcon.d.ts.map +1 -1
  151. package/lib/typescript/commonjs/AttachmentPickerStatusModal.d.ts.map +1 -1
  152. package/lib/typescript/commonjs/ChannelsPanel.d.ts.map +1 -1
  153. package/lib/typescript/commonjs/ConversationChat.d.ts +1 -1
  154. package/lib/typescript/commonjs/ConversationChat.d.ts.map +1 -1
  155. package/lib/typescript/commonjs/ConversationComposer.d.ts.map +1 -1
  156. package/lib/typescript/commonjs/ConversationMessageList.d.ts +1 -1
  157. package/lib/typescript/commonjs/ConversationMessageList.d.ts.map +1 -1
  158. package/lib/typescript/commonjs/ConversationScreen.d.ts +2 -1
  159. package/lib/typescript/commonjs/ConversationScreen.d.ts.map +1 -1
  160. package/lib/typescript/commonjs/EditorDrawer.d.ts +1 -1
  161. package/lib/typescript/commonjs/EditorDrawer.d.ts.map +1 -1
  162. package/lib/typescript/commonjs/FilesPanel.d.ts.map +1 -1
  163. package/lib/typescript/commonjs/RenameAgentModal.d.ts.map +1 -1
  164. package/lib/typescript/commonjs/ShareAgentModal.d.ts.map +1 -1
  165. package/lib/typescript/commonjs/ShareAgentModal.styles.d.ts.map +1 -1
  166. package/lib/typescript/commonjs/SuperagentHomeScreen.d.ts.map +1 -1
  167. package/lib/typescript/commonjs/ToolApprovalCard.d.ts +3 -3
  168. package/lib/typescript/commonjs/ToolApprovalCard.d.ts.map +1 -1
  169. package/lib/typescript/commonjs/ToolCallSummary.d.ts +1 -1
  170. package/lib/typescript/commonjs/ToolCallSummary.d.ts.map +1 -1
  171. package/lib/typescript/commonjs/agentSphereAssets.d.ts +2 -0
  172. package/lib/typescript/commonjs/agentSphereAssets.d.ts.map +1 -0
  173. package/lib/typescript/commonjs/agentSphereStyles.d.ts.map +1 -1
  174. package/lib/typescript/commonjs/apiClient.d.ts.map +1 -1
  175. package/lib/typescript/commonjs/composerStyles.d.ts.map +1 -1
  176. package/lib/typescript/commonjs/connectorBrandIcons.d.ts.map +1 -1
  177. package/lib/typescript/commonjs/connectorBrandIcons.generated.d.ts +2 -0
  178. package/lib/typescript/commonjs/connectorBrandIcons.generated.d.ts.map +1 -0
  179. package/lib/typescript/commonjs/connectorCatalog.d.ts +2 -0
  180. package/lib/typescript/commonjs/connectorCatalog.d.ts.map +1 -1
  181. package/lib/typescript/commonjs/conversationParts.d.ts +1 -1
  182. package/lib/typescript/commonjs/conversationParts.d.ts.map +1 -1
  183. package/lib/typescript/commonjs/conversationRuntime.d.ts +6 -1
  184. package/lib/typescript/commonjs/conversationRuntime.d.ts.map +1 -1
  185. package/lib/typescript/commonjs/conversationStyles.d.ts.map +1 -1
  186. package/lib/typescript/commonjs/editorShellStyles.d.ts +4 -0
  187. package/lib/typescript/commonjs/editorShellStyles.d.ts.map +1 -1
  188. package/lib/typescript/commonjs/index.d.ts +2 -0
  189. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  190. package/lib/typescript/commonjs/markdownStyles.d.ts.map +1 -1
  191. package/lib/typescript/commonjs/messageActionStyles.d.ts.map +1 -1
  192. package/lib/typescript/commonjs/realtimeClient.d.ts.map +1 -1
  193. package/lib/typescript/commonjs/renameAgentModalStyles.d.ts.map +1 -1
  194. package/lib/typescript/commonjs/screenParts.d.ts +1 -1
  195. package/lib/typescript/commonjs/screenParts.d.ts.map +1 -1
  196. package/lib/typescript/commonjs/styles.d.ts +20 -11
  197. package/lib/typescript/commonjs/styles.d.ts.map +1 -1
  198. package/lib/typescript/commonjs/superagentApiClient.d.ts +2 -1
  199. package/lib/typescript/commonjs/superagentApiClient.d.ts.map +1 -1
  200. package/lib/typescript/commonjs/theme.d.ts +36 -0
  201. package/lib/typescript/commonjs/theme.d.ts.map +1 -0
  202. package/lib/typescript/commonjs/types.d.ts +16 -2
  203. package/lib/typescript/commonjs/types.d.ts.map +1 -1
  204. package/lib/typescript/commonjs/useSuperagentConversation.d.ts +3 -2
  205. package/lib/typescript/commonjs/useSuperagentConversation.d.ts.map +1 -1
  206. package/lib/typescript/commonjs/useSuperagentRuntime.d.ts +2 -1
  207. package/lib/typescript/commonjs/useSuperagentRuntime.d.ts.map +1 -1
  208. package/lib/typescript/module/AgentSettingsPanel.d.ts.map +1 -1
  209. package/lib/typescript/module/AgentSphereIcon.d.ts.map +1 -1
  210. package/lib/typescript/module/AttachmentPickerStatusModal.d.ts.map +1 -1
  211. package/lib/typescript/module/ChannelsPanel.d.ts.map +1 -1
  212. package/lib/typescript/module/ConversationChat.d.ts +1 -1
  213. package/lib/typescript/module/ConversationChat.d.ts.map +1 -1
  214. package/lib/typescript/module/ConversationComposer.d.ts.map +1 -1
  215. package/lib/typescript/module/ConversationMessageList.d.ts +1 -1
  216. package/lib/typescript/module/ConversationMessageList.d.ts.map +1 -1
  217. package/lib/typescript/module/ConversationScreen.d.ts +2 -1
  218. package/lib/typescript/module/ConversationScreen.d.ts.map +1 -1
  219. package/lib/typescript/module/EditorDrawer.d.ts +1 -1
  220. package/lib/typescript/module/EditorDrawer.d.ts.map +1 -1
  221. package/lib/typescript/module/FilesPanel.d.ts.map +1 -1
  222. package/lib/typescript/module/RenameAgentModal.d.ts.map +1 -1
  223. package/lib/typescript/module/ShareAgentModal.d.ts.map +1 -1
  224. package/lib/typescript/module/ShareAgentModal.styles.d.ts.map +1 -1
  225. package/lib/typescript/module/SuperagentHomeScreen.d.ts.map +1 -1
  226. package/lib/typescript/module/ToolApprovalCard.d.ts +3 -3
  227. package/lib/typescript/module/ToolApprovalCard.d.ts.map +1 -1
  228. package/lib/typescript/module/ToolCallSummary.d.ts +1 -1
  229. package/lib/typescript/module/ToolCallSummary.d.ts.map +1 -1
  230. package/lib/typescript/module/agentSphereAssets.d.ts +2 -0
  231. package/lib/typescript/module/agentSphereAssets.d.ts.map +1 -0
  232. package/lib/typescript/module/agentSphereStyles.d.ts.map +1 -1
  233. package/lib/typescript/module/apiClient.d.ts.map +1 -1
  234. package/lib/typescript/module/composerStyles.d.ts.map +1 -1
  235. package/lib/typescript/module/connectorBrandIcons.d.ts.map +1 -1
  236. package/lib/typescript/module/connectorBrandIcons.generated.d.ts +2 -0
  237. package/lib/typescript/module/connectorBrandIcons.generated.d.ts.map +1 -0
  238. package/lib/typescript/module/connectorCatalog.d.ts +2 -0
  239. package/lib/typescript/module/connectorCatalog.d.ts.map +1 -1
  240. package/lib/typescript/module/conversationParts.d.ts +1 -1
  241. package/lib/typescript/module/conversationParts.d.ts.map +1 -1
  242. package/lib/typescript/module/conversationRuntime.d.ts +6 -1
  243. package/lib/typescript/module/conversationRuntime.d.ts.map +1 -1
  244. package/lib/typescript/module/conversationStyles.d.ts.map +1 -1
  245. package/lib/typescript/module/editorShellStyles.d.ts +4 -0
  246. package/lib/typescript/module/editorShellStyles.d.ts.map +1 -1
  247. package/lib/typescript/module/index.d.ts +2 -0
  248. package/lib/typescript/module/index.d.ts.map +1 -1
  249. package/lib/typescript/module/markdownStyles.d.ts.map +1 -1
  250. package/lib/typescript/module/messageActionStyles.d.ts.map +1 -1
  251. package/lib/typescript/module/realtimeClient.d.ts.map +1 -1
  252. package/lib/typescript/module/renameAgentModalStyles.d.ts.map +1 -1
  253. package/lib/typescript/module/screenParts.d.ts +1 -1
  254. package/lib/typescript/module/screenParts.d.ts.map +1 -1
  255. package/lib/typescript/module/styles.d.ts +20 -11
  256. package/lib/typescript/module/styles.d.ts.map +1 -1
  257. package/lib/typescript/module/superagentApiClient.d.ts +2 -1
  258. package/lib/typescript/module/superagentApiClient.d.ts.map +1 -1
  259. package/lib/typescript/module/theme.d.ts +36 -0
  260. package/lib/typescript/module/theme.d.ts.map +1 -0
  261. package/lib/typescript/module/types.d.ts +16 -2
  262. package/lib/typescript/module/types.d.ts.map +1 -1
  263. package/lib/typescript/module/useSuperagentConversation.d.ts +3 -2
  264. package/lib/typescript/module/useSuperagentConversation.d.ts.map +1 -1
  265. package/lib/typescript/module/useSuperagentRuntime.d.ts +2 -1
  266. package/lib/typescript/module/useSuperagentRuntime.d.ts.map +1 -1
  267. package/package.json +1 -1
  268. package/src/AgentSettingsPanel.tsx +118 -49
  269. package/src/AgentSphereIcon.tsx +11 -62
  270. package/src/AttachmentPickerStatusModal.tsx +4 -3
  271. package/src/ChannelsPanel.tsx +59 -39
  272. package/src/ConversationChat.tsx +12 -3
  273. package/src/ConversationComposer.tsx +7 -6
  274. package/src/ConversationMessageList.tsx +1 -1
  275. package/src/ConversationScreen.tsx +3 -0
  276. package/src/EditorDrawer.tsx +66 -41
  277. package/src/FilesPanel.tsx +48 -20
  278. package/src/RenameAgentModal.tsx +2 -1
  279. package/src/ShareAgentModal.styles.ts +2 -1
  280. package/src/ShareAgentModal.tsx +9 -8
  281. package/src/SuperagentHomeScreen.tsx +27 -7
  282. package/src/ToolApprovalCard.tsx +82 -14
  283. package/src/ToolCallSummary.tsx +18 -12
  284. package/src/agentSphereAssets.ts +325 -0
  285. package/src/agentSphereStyles.ts +3 -2
  286. package/src/apiClient.ts +7 -0
  287. package/src/composerStyles.ts +2 -1
  288. package/src/connectorBrandIcons.generated.ts +618 -0
  289. package/src/connectorBrandIcons.tsx +1 -53
  290. package/src/connectorCatalog.ts +24 -0
  291. package/src/conversationParts.tsx +6 -5
  292. package/src/conversationRuntime.ts +123 -12
  293. package/src/conversationStyles.ts +2 -1
  294. package/src/editorShellStyles.ts +6 -1
  295. package/src/index.ts +2 -0
  296. package/src/markdownStyles.ts +2 -1
  297. package/src/messageActionStyles.ts +2 -1
  298. package/src/realtimeClient.ts +7 -1
  299. package/src/renameAgentModalStyles.ts +2 -1
  300. package/src/screenParts.tsx +17 -29
  301. package/src/styles.ts +63 -54
  302. package/src/superagentApiClient.ts +68 -18
  303. package/src/theme.ts +254 -0
  304. package/src/types.ts +21 -2
  305. package/src/useSuperagentConversation.ts +141 -24
  306. package/src/useSuperagentRuntime.ts +165 -84
@@ -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,6 +116,7 @@ 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('');
@@ -128,6 +129,10 @@ export function AgentSettingsPanel({
128
129
  () => normalizePermissions(agent.toolsPermissionConfig),
129
130
  [agent.toolsPermissionConfig],
130
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;
131
136
  const selectedModel = useMemo(
132
137
  () => MODEL_OPTIONS.find((model) => model.id === (agent.model || 'default')) ?? MODEL_OPTIONS[0],
133
138
  [agent.model],
@@ -151,6 +156,11 @@ export function AgentSettingsPanel({
151
156
  // eslint-disable-next-line react-hooks/exhaustive-deps
152
157
  }, [agent.id]);
153
158
 
159
+ useEffect(() => {
160
+ // Fresh server state (or an agent switch) supersedes the optimistic flip.
161
+ setOptimisticOps(null);
162
+ }, [agent.id, agent.toolsPermissionConfig]);
163
+
154
164
  const runAction = async (action: Exclude<PendingAction, null>, handler: () => Promise<void> | void) => {
155
165
  if (pendingAction) {
156
166
  return;
@@ -166,19 +176,62 @@ export function AgentSettingsPanel({
166
176
 
167
177
  const updatePermissions = async (
168
178
  nextConfig: SuperagentToolPermissionConfig,
169
- action: Exclude<PendingAction, null> = 'toggle-permission',
179
+ action: Exclude<PendingAction, null>,
170
180
  ) => {
171
181
  if (!onUpdateToolPermissions) {
172
182
  return;
173
183
  }
174
184
 
175
- await runAction(action, () => onUpdateToolPermissions({
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({
176
216
  agentId: agent.id,
177
217
  config: {
178
- auto_approved_operations: nextConfig.auto_approved_operations ?? [],
179
- connector_guards: cleanGuards(nextConfig.connector_guards ?? {}),
218
+ auto_approved_operations: nextList,
219
+ connector_guards: cleanGuards(permissions.connector_guards),
180
220
  },
181
- }));
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
+ });
182
235
  };
183
236
 
184
237
  const selectModel = (model: ModelOption) => {
@@ -214,8 +267,11 @@ export function AgentSettingsPanel({
214
267
 
215
268
  const addSecret = async () => {
216
269
  const name = newSecretName.trim().toUpperCase();
217
- const value = newSecretValue.trim();
218
- if (!name || !value || !onSaveSecret) {
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) {
219
275
  return;
220
276
  }
221
277
 
@@ -275,9 +331,9 @@ export function AgentSettingsPanel({
275
331
  <Text numberOfLines={1} style={localStyles.modelDropdownValue}>{selectedModel.label}</Text>
276
332
  <View style={localStyles.modelDropdownIcon}>
277
333
  {pendingAction === 'model' ? (
278
- <ActivityIndicator color="#F4F4F5" size="small" />
334
+ <ActivityIndicator color={themedColor('#F4F4F5')} size="small" />
279
335
  ) : (
280
- <ChevronDown color="#F4F4F5" size={20} strokeWidth={2.5} />
336
+ <ChevronDown color={themedColor('#F4F4F5')} size={20} strokeWidth={2.5} />
281
337
  )}
282
338
  </View>
283
339
  </Pressable>
@@ -315,9 +371,9 @@ export function AgentSettingsPanel({
315
371
  style={({ pressed }) => [localStyles.iconButton, pressed && sharedStyles.pressed]}
316
372
  >
317
373
  {isVisible ? (
318
- <EyeOff color="#E4E4E7" size={16} strokeWidth={2.4} />
374
+ <EyeOff color={themedColor('#E4E4E7')} size={16} strokeWidth={2.4} />
319
375
  ) : (
320
- <Eye color="#E4E4E7" size={16} strokeWidth={2.4} />
376
+ <Eye color={themedColor('#E4E4E7')} size={16} strokeWidth={2.4} />
321
377
  )}
322
378
  </Pressable>
323
379
  <Pressable
@@ -328,9 +384,9 @@ export function AgentSettingsPanel({
328
384
  style={({ pressed }) => [localStyles.iconButtonDanger, pressed && sharedStyles.pressed]}
329
385
  >
330
386
  {deletingSecretName === secret.name ? (
331
- <ActivityIndicator color="#FCA5A5" size="small" />
387
+ <ActivityIndicator color={themedColor('#FCA5A5')} size="small" />
332
388
  ) : (
333
- <Trash2 color="#FCA5A5" size={16} strokeWidth={2.4} />
389
+ <Trash2 color={themedColor('#FCA5A5')} size={16} strokeWidth={2.4} />
334
390
  )}
335
391
  </Pressable>
336
392
  </View>
@@ -346,14 +402,14 @@ export function AgentSettingsPanel({
346
402
  autoCapitalize="characters"
347
403
  onChangeText={(value) => setNewSecretName(value.toUpperCase())}
348
404
  placeholder="SECRET_NAME"
349
- placeholderTextColor="#71717A"
405
+ placeholderTextColor={themedColor('#71717A')}
350
406
  style={localStyles.textInput}
351
407
  value={newSecretName}
352
408
  />
353
409
  <TextInput
354
410
  onChangeText={setNewSecretValue}
355
411
  placeholder="Value"
356
- placeholderTextColor="#71717A"
412
+ placeholderTextColor={themedColor('#71717A')}
357
413
  secureTextEntry
358
414
  style={localStyles.textInput}
359
415
  value={newSecretValue}
@@ -370,22 +426,42 @@ export function AgentSettingsPanel({
370
426
  ]}
371
427
  >
372
428
  {pendingAction === 'save-secret' ? (
373
- <ActivityIndicator color="#111111" size="small" />
429
+ <ActivityIndicator color={themedColor('#111111')} size="small" />
374
430
  ) : (
375
- <Plus color="#111111" size={16} strokeWidth={2.6} />
431
+ <Plus color={themedColor('#111111')} size={16} strokeWidth={2.6} />
376
432
  )}
377
433
  <Text style={localStyles.primaryButtonText}>Add</Text>
378
434
  </Pressable>
379
435
  </View>
380
436
  </SettingsSection>
381
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
+
382
458
  <SettingsSection
383
459
  icon={ShieldCheck}
384
460
  subtitle="Matches the web tool permission controls."
385
461
  title="Tool Permissions"
386
462
  >
387
463
  {TOOL_OPERATIONS.map((operation) => {
388
- const isEnabled = permissions.auto_approved_operations.includes(operation.id);
464
+ const isEnabled = autoApprovedOps.includes(operation.id);
389
465
  return (
390
466
  <View key={operation.id} style={localStyles.permissionRow}>
391
467
  <View style={localStyles.permissionText}>
@@ -393,22 +469,11 @@ export function AgentSettingsPanel({
393
469
  <Text style={localStyles.rowBody}>{operation.body}</Text>
394
470
  </View>
395
471
  <Switch
396
- disabled={!onUpdateToolPermissions || pendingAction === 'toggle-permission'}
397
- ios_backgroundColor="#2A2A2A"
398
- onValueChange={(enabled) => {
399
- const nextOps = new Set(permissions.auto_approved_operations);
400
- if (enabled) {
401
- nextOps.add(operation.id);
402
- } else {
403
- nextOps.delete(operation.id);
404
- }
405
- updatePermissions({
406
- ...permissions,
407
- auto_approved_operations: Array.from(nextOps),
408
- });
409
- }}
472
+ disabled={!onUpdateToolPermissions}
473
+ ios_backgroundColor={themedSurface('#2A2A2A')}
474
+ onValueChange={(enabled) => toggleOperation(operation.id, enabled)}
410
475
  thumbColor="#F4F4F5"
411
- trackColor={{ false: '#2A2A2A', true: '#246B43' }}
476
+ trackColor={{ false: themedSurface('#2A2A2A'), true: '#246B43' }}
412
477
  value={isEnabled}
413
478
  />
414
479
  </View>
@@ -450,7 +515,7 @@ export function AgentSettingsPanel({
450
515
  }));
451
516
  }}
452
517
  placeholder="Example: ask before sending email outside my domain."
453
- placeholderTextColor="#71717A"
518
+ placeholderTextColor={themedColor('#71717A')}
454
519
  style={[localStyles.textInput, localStyles.guardInput]}
455
520
  value={guardDrafts[connectorId] ?? ''}
456
521
  />
@@ -466,7 +531,11 @@ export function AgentSettingsPanel({
466
531
  accessibilityRole="button"
467
532
  disabled={!onUpdateToolPermissions || !guardDraftsDirty || pendingAction === 'save-guards'}
468
533
  onPress={() => updatePermissions({
469
- auto_approved_operations: permissions.auto_approved_operations,
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,
470
539
  connector_guards: guardDrafts,
471
540
  }, 'save-guards')}
472
541
  style={({ pressed }) => [
@@ -476,9 +545,9 @@ export function AgentSettingsPanel({
476
545
  ]}
477
546
  >
478
547
  {pendingAction === 'save-guards' ? (
479
- <ActivityIndicator color="#F4F4F5" size="small" />
548
+ <ActivityIndicator color={themedColor('#F4F4F5')} size="small" />
480
549
  ) : (
481
- <Check color="#F4F4F5" size={16} strokeWidth={2.6} />
550
+ <Check color={themedColor('#F4F4F5')} size={16} strokeWidth={2.6} />
482
551
  )}
483
552
  <Text style={localStyles.secondaryButtonText}>Save rules</Text>
484
553
  </Pressable>
@@ -546,7 +615,7 @@ function SettingsSection({
546
615
  <View style={[localStyles.sectionCard, isDanger && localStyles.dangerSectionCard]}>
547
616
  <View style={localStyles.sectionHeader}>
548
617
  <View style={[localStyles.sectionIcon, isDanger && localStyles.sectionIconDanger]}>
549
- <Icon color={isDanger ? '#FCA5A5' : '#F4F4F5'} size={19} strokeWidth={2.35} />
618
+ <Icon color={isDanger ? themedColor('#FCA5A5') : themedColor('#F4F4F5')} size={19} strokeWidth={2.35} />
550
619
  </View>
551
620
  <View style={localStyles.sectionTitleWrap}>
552
621
  <Text style={localStyles.sectionTitle}>{title}</Text>
@@ -556,7 +625,7 @@ function SettingsSection({
556
625
  </View>
557
626
  {isLoading ? (
558
627
  <View style={localStyles.loadingRow}>
559
- <ActivityIndicator color="#FF5A1F" />
628
+ <ActivityIndicator color={themedColor('#FF5A1F')} />
560
629
  <Text style={localStyles.mutedText}>Loading...</Text>
561
630
  </View>
562
631
  ) : children}
@@ -584,9 +653,9 @@ function HeaderAction({
584
653
  style={({ pressed }) => [localStyles.headerAction, pressed && sharedStyles.pressed]}
585
654
  >
586
655
  {isLoading ? (
587
- <ActivityIndicator color="#F4F4F5" size="small" />
656
+ <ActivityIndicator color={themedColor('#F4F4F5')} size="small" />
588
657
  ) : (
589
- <Icon color="#F4F4F5" size={16} strokeWidth={2.4} />
658
+ <Icon color={themedColor('#F4F4F5')} size={16} strokeWidth={2.4} />
590
659
  )}
591
660
  </Pressable>
592
661
  );
@@ -633,7 +702,7 @@ function ModelPickerModal({
633
702
  <Text style={localStyles.modelModalOptionLabel}>{model.label}</Text>
634
703
  <Text numberOfLines={2} style={localStyles.modelDescription}>{model.description}</Text>
635
704
  </View>
636
- {isSelected ? <Check color="#34D399" size={18} strokeWidth={2.7} /> : null}
705
+ {isSelected ? <Check color={themedColor('#34D399')} size={18} strokeWidth={2.7} /> : null}
637
706
  </Pressable>
638
707
  );
639
708
  })}
@@ -674,9 +743,9 @@ function ActionRow({
674
743
  >
675
744
  <View style={[localStyles.actionIcon, isDanger && localStyles.actionIconDanger]}>
676
745
  {isLoading ? (
677
- <ActivityIndicator color={isDanger ? '#FCA5A5' : '#F4F4F5'} size="small" />
746
+ <ActivityIndicator color={isDanger ? themedColor('#FCA5A5') : themedColor('#F4F4F5')} size="small" />
678
747
  ) : (
679
- <Icon color={isDanger ? '#FCA5A5' : '#F4F4F5'} size={18} strokeWidth={2.35} />
748
+ <Icon color={isDanger ? themedColor('#FCA5A5') : themedColor('#F4F4F5')} size={18} strokeWidth={2.35} />
680
749
  )}
681
750
  </View>
682
751
  <View style={localStyles.actionText}>
@@ -718,9 +787,9 @@ function ShareMembersSummary({
718
787
  >
719
788
  <View style={localStyles.actionIcon}>
720
789
  {isLoading || isSharing ? (
721
- <ActivityIndicator color="#F4F4F5" size="small" />
790
+ <ActivityIndicator color={themedColor('#F4F4F5')} size="small" />
722
791
  ) : (
723
- <Share2 color="#F4F4F5" size={18} strokeWidth={2.35} />
792
+ <Share2 color={themedColor('#F4F4F5')} size={18} strokeWidth={2.35} />
724
793
  )}
725
794
  </View>
726
795
  <View style={localStyles.actionText}>
@@ -756,7 +825,7 @@ function toggleSecretVisibility(current: Set<string>, name: string) {
756
825
  return next;
757
826
  }
758
827
 
759
- const localStyles = StyleSheet.create({
828
+ const localStyles = createThemedStyles({
760
829
  actionIcon: {
761
830
  alignItems: 'center',
762
831
  backgroundColor: '#1F1F23',
@@ -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 Svg, {
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="#D4D4D8" size={dimension * 0.48} strokeWidth={2.4} />
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
- const palette = getSpherePalette(avatarIndex);
118
- const rawId = React.useId();
119
- const id = rawId.replace(/[^a-zA-Z0-9_-]/g, '');
120
- const clipId = `agentSphereClip${id}`;
121
- const glowId = `agentSphereGlow${id}`;
122
- const sheenId = `agentSphereSheen${id}`;
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 {ActivityIndicator, Modal, Pressable, StyleSheet, Text, View} from 'react-native';
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,7 +17,7 @@ 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="#F4F4F5" style={styles.loader} />}
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 ? (
@@ -30,7 +31,7 @@ export function AttachmentPickerStatusModal({
30
31
  );
31
32
  }
32
33
 
33
- const styles = StyleSheet.create({
34
+ const styles = createThemedStyles({
34
35
  backdrop: {
35
36
  alignItems: 'center',
36
37
  backgroundColor: 'rgba(0, 0, 0, 0.62)',