@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,8 +1,10 @@
1
1
  import React, { useMemo, useState } from 'react';
2
+ import { themedColor } from './theme';
2
3
  import { ActivityIndicator, Pressable, Text, TextInput, View } from 'react-native';
3
4
  import { CheckCircle2, KeyRound, Package, Plug, ShieldAlert } from 'lucide-react-native';
4
5
 
5
6
  import { ConnectorBrandIcon, hasConnectorBrandIcon } from './connectorBrandIcons';
7
+ import { connectorRequiresConnectionConfig } from './connectorCatalog';
6
8
  import { conversationStyles } from './conversationStyles';
7
9
  import type {
8
10
  SuperagentAgent,
@@ -29,15 +31,17 @@ type SecretSchemaItem = {
29
31
  export function ToolApprovalCard({
30
32
  agent,
31
33
  availableConnectors,
32
- isLastAssistantMessage,
33
34
  onConnectConnector,
34
35
  submitToolCallInput,
35
36
  toolCall,
36
37
  }: {
37
38
  agent: SuperagentAgent;
38
39
  availableConnectors?: SuperagentConnector[];
39
- isLastAssistantMessage: boolean;
40
- onConnectConnector?: (input: SuperagentConnectorActionInput) => Promise<boolean | void> | boolean | void;
40
+ // Accepted for backwards-compatible prop plumbing but intentionally unused:
41
+ // the card only renders for tool calls still awaiting input (see
42
+ // isApprovalRequest), so an approval is actionable regardless of position.
43
+ isLastAssistantMessage?: boolean;
44
+ onConnectConnector?: (input: SuperagentConnectorActionInput) => Promise<boolean | string | void> | boolean | string | void;
41
45
  submitToolCallInput?: SubmitToolCallInput;
42
46
  toolCall: SuperagentToolCall;
43
47
  }) {
@@ -66,7 +70,7 @@ export function ToolApprovalCard({
66
70
  const body = getApprovalBody(kind, reason, guardData, displayName);
67
71
  const primaryLabel = getPrimaryLabel(kind, displayName);
68
72
  const rejectLabel = kind === 'connector' || kind === 'channel' ? 'Skip' : 'Reject';
69
- const canAct = Boolean(toolCall.id && submitToolCallInput && isLastAssistantMessage);
73
+ const canAct = Boolean(toolCall.id && submitToolCallInput);
70
74
  const [isSubmitting, setIsSubmitting] = useState(false);
71
75
  const [error, setError] = useState<string | null>(null);
72
76
  const [formValues, setFormValues] = useState<Record<string, string>>({
@@ -79,7 +83,31 @@ export function ToolApprovalCard({
79
83
  const channelComplete = kind !== 'channel' || isChannelFormComplete(toolCall.name, formValues);
80
84
  const customConnectorComplete = kind !== 'customConnector' ||
81
85
  Boolean(formValues.connectorName?.trim() && formValues.clientId?.trim() && formValues.clientSecret?.trim());
82
- const disablePrimary = !canAct || isSubmitting || !secretsComplete || !channelComplete || !customConnectorComplete;
86
+ // Connectors needing extra connection_config (e.g. subdomain) can't complete
87
+ // OAuth from native — the backend initiate rejects them — so block approval here
88
+ // and steer to the web app, matching the connectors drawer. Skip stays enabled.
89
+ // Fall back to the catalog: listConnectors drops already-connected integrations
90
+ // from availableConnectors, so an already-connected config-required connector
91
+ // (scope upgrade / force_reconnect) would otherwise have connector === undefined
92
+ // and slip past this gate, then fail backend validation for missing connection_config.
93
+ const connectorNeedsConfig = kind === 'connector'
94
+ && (Boolean(connector?.requiresConnectionConfig) || connectorRequiresConnectionConfig(connectorId));
95
+ // BYO_SHARED connectors arrive as an OrganizationConnector connector_id (no
96
+ // integration_type). The native personal-agent facade has no connector_id field
97
+ // and requires a real integration type, so the OAuth can only fail — block it
98
+ // here too and steer to the web app.
99
+ const isByoConnector = kind === 'connector'
100
+ && !getStringArg(args, ['integration_type'])
101
+ && Boolean(getStringArg(args, ['connector_id']));
102
+ // register_workspace_connector for an integration needing connection_config
103
+ // (e.g. subdomain) can't succeed here: this card only collects id/secret/name/
104
+ // scopes, not connection_config, so the backend's get_validated_connection_config
105
+ // rejects it. Block it and steer to the web app, like the config-required OAuth
106
+ // path above. Skip stays enabled.
107
+ const customConnectorNeedsConfig = kind === 'customConnector'
108
+ && connectorRequiresConnectionConfig(getStringArg(args, ['integration_type', 'name']));
109
+ const connectorUnsupportedHere = connectorNeedsConfig || isByoConnector || customConnectorNeedsConfig;
110
+ const disablePrimary = !canAct || isSubmitting || !secretsComplete || !channelComplete || !customConnectorComplete || connectorUnsupportedHere;
83
111
 
84
112
  const submitApproval = async () => {
85
113
  if (!toolCall.id || !submitToolCallInput) return;
@@ -87,20 +115,35 @@ export function ToolApprovalCard({
87
115
  setIsSubmitting(true);
88
116
  setError(null);
89
117
  try {
118
+ let connectionId: string | undefined;
90
119
  if (kind === 'connector' && onConnectConnector && connectorId) {
91
120
  const connected = await onConnectConnector({
92
121
  accessMode: 'full_access',
93
122
  agentId: agent.id,
94
123
  connectorId,
95
- forceReconnect: false,
124
+ // Honor the agent's force_reconnect arg (e.g. "switch accounts") so the
125
+ // initiate route shows the provider/account picker instead of
126
+ // short-circuiting as already-authorized — matches the web flow.
127
+ forceReconnect: getBooleanArg(args, ['force_reconnect']),
96
128
  scopes: scopes.length > 0 ? scopes : connector?.scopes,
97
129
  });
98
130
  if (connected === false) {
99
131
  throw new Error(`${connectorName} was not connected.`);
100
132
  }
133
+ // onConnectConnector returns the connection_id (string) on success; the
134
+ // backend verifies it against the just-created AppIntegration before
135
+ // marking the tool successful, matching the web flow.
136
+ if (typeof connected === 'string') {
137
+ connectionId = connected;
138
+ }
101
139
  }
102
140
 
103
- await submitToolCallInput(toolCall.id, true, getApprovalPayload(kind, secretValues, paymentProvider, toolCall.name, formValues));
141
+ const result = await submitToolCallInput(toolCall.id, true, getApprovalPayload(kind, secretValues, paymentProvider, toolCall.name, formValues, connectionId));
142
+ if (result === null) {
143
+ // The conversation client isn't ready yet (still initializing), so nothing
144
+ // reached the server. Surface it instead of silently no-opping.
145
+ throw new Error('The conversation is still loading. Try again in a moment.');
146
+ }
104
147
  } catch (submitError) {
105
148
  setError(submitError instanceof Error ? submitError.message : 'Unable to approve this request.');
106
149
  } finally {
@@ -114,7 +157,10 @@ export function ToolApprovalCard({
114
157
  setIsSubmitting(true);
115
158
  setError(null);
116
159
  try {
117
- await submitToolCallInput(toolCall.id, false, {});
160
+ const result = await submitToolCallInput(toolCall.id, false, {});
161
+ if (result === null) {
162
+ throw new Error('The conversation is still loading. Try again in a moment.');
163
+ }
118
164
  } catch (submitError) {
119
165
  setError(submitError instanceof Error ? submitError.message : 'Unable to reject this request.');
120
166
  } finally {
@@ -134,6 +180,12 @@ export function ToolApprovalCard({
134
180
 
135
181
  {body ? <Text style={conversationStyles.toolApprovalBody}>{body}</Text> : null}
136
182
 
183
+ {connectorUnsupportedHere ? (
184
+ <Text style={conversationStyles.toolApprovalMuted}>
185
+ Connect {connectorName} from the web app — it isn't supported in the app yet.
186
+ </Text>
187
+ ) : null}
188
+
137
189
  {kind === 'connector' && scopes.length > 0 ? (
138
190
  <View style={conversationStyles.toolApprovalScopeWrap}>
139
191
  <Text style={conversationStyles.toolApprovalMuted}>Requested access</Text>
@@ -185,7 +237,7 @@ export function ToolApprovalCard({
185
237
  {toolCall.name === 'setup_telegram_connection' ? (
186
238
  <ApprovalInput
187
239
  canAct={canAct}
188
- help="Paste the bot token from BotFather."
240
+ help="Paste the bot token from BotFather, or leave empty to create a managed bot."
189
241
  isSubmitting={isSubmitting}
190
242
  label="Bot Token"
191
243
  onChange={(value) => setFormValues((current) => ({ ...current, botToken: extractTelegramToken(value) }))}
@@ -271,7 +323,7 @@ export function ToolApprovalCard({
271
323
  disablePrimary && conversationStyles.toolApprovalButtonDisabled,
272
324
  ]}
273
325
  >
274
- {isSubmitting ? <ActivityIndicator color="#111111" size="small" /> : <CheckCircle2 color="#111111" size={15} strokeWidth={2.5} />}
326
+ {isSubmitting ? <ActivityIndicator color={themedColor('#111111')} size="small" /> : <CheckCircle2 color={themedColor('#111111')} size={15} strokeWidth={2.5} />}
275
327
  <Text style={conversationStyles.toolApprovalPrimaryText}>{isSubmitting ? 'Working...' : primaryLabel}</Text>
276
328
  </Pressable>
277
329
  <Pressable
@@ -288,7 +340,7 @@ export function ToolApprovalCard({
288
340
  </View>
289
341
  ) : (
290
342
  <Text style={conversationStyles.toolApprovalPreviousText}>
291
- {isLastAssistantMessage ? 'Approval controls are not available in this build.' : 'This request belongs to an earlier message.'}
343
+ Approval controls are not available here.
292
344
  </Text>
293
345
  )}
294
346
 
@@ -367,7 +419,7 @@ function ApprovalInput({
367
419
  multiline={multiline}
368
420
  onChangeText={onChange}
369
421
  placeholder={placeholder}
370
- placeholderTextColor="#6F6F76"
422
+ placeholderTextColor={themedColor('#6F6F76')}
371
423
  secureTextEntry={secure}
372
424
  style={[
373
425
  conversationStyles.toolApprovalInput,
@@ -432,9 +484,11 @@ function getApprovalPayload(
432
484
  paymentProvider: string,
433
485
  toolName: string,
434
486
  formValues: Record<string, string>,
487
+ connectionId?: string,
435
488
  ) {
436
489
  if (kind === 'channel' && toolName === 'setup_telegram_connection') {
437
- return { bot_token: formValues.botToken };
490
+ // Empty string routes to the managed one-click bot flow on the backend.
491
+ return { bot_token: formValues.botToken?.trim() ?? '' };
438
492
  }
439
493
  if (kind === 'channel') {
440
494
  return { bot_token: formValues.botToken, signing_secret: formValues.signingSecret };
@@ -450,6 +504,7 @@ function getApprovalPayload(
450
504
  if (kind === 'secrets') return { secrets: secretValues };
451
505
  if (kind === 'payment' && paymentProvider === 'wix_payments') return { tos_accepted: true };
452
506
  if (kind === 'payment' && paymentProvider === 'payments_by_wix') return { confirmed: true };
507
+ if (kind === 'connector') return connectionId ? { connection_id: connectionId } : {};
453
508
  return {};
454
509
  }
455
510
 
@@ -475,6 +530,16 @@ function getStringArg(args: Record<string, unknown> | string | null, keys: strin
475
530
  return '';
476
531
  }
477
532
 
533
+ function getBooleanArg(args: Record<string, unknown> | string | null, keys: string[]): boolean {
534
+ if (!args || typeof args === 'string') return false;
535
+ for (const key of keys) {
536
+ const value = args[key];
537
+ if (typeof value === 'boolean') return value;
538
+ if (value === 'true') return true;
539
+ }
540
+ return false;
541
+ }
542
+
478
543
  function getStringArrayArg(args: Record<string, unknown> | string | null, key: string) {
479
544
  if (!args || typeof args === 'string') return [];
480
545
  const value = args[key];
@@ -536,7 +601,10 @@ function getSecretSchema(args: Record<string, unknown> | string | null): SecretS
536
601
 
537
602
  function isChannelFormComplete(toolName: string, formValues: Record<string, string>) {
538
603
  if (toolName === 'setup_telegram_connection') {
539
- return /^\d+:[A-Za-z0-9_-]{35,}$/.test(formValues.botToken?.trim() || '');
604
+ const token = formValues.botToken?.trim() || '';
605
+ // An empty token is valid: the backend creates a managed one-click bot in that
606
+ // case. A token that *is* provided must be a well-formed BotFather token.
607
+ return token === '' || /^\d+:[A-Za-z0-9_-]{35,}$/.test(token);
540
608
  }
541
609
 
542
610
  return Boolean(
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect, useMemo, useState } from 'react';
2
+ import { themedColor } from './theme';
2
3
  import { ActivityIndicator, Pressable, ScrollView, Text, View } from 'react-native';
3
4
  import { CheckCircle2, ChevronRight, CircleAlert, Clock, Wrench } from 'lucide-react-native';
4
5
 
@@ -92,7 +93,7 @@ export function ToolCallSummary({
92
93
  conversationId: string | null;
93
94
  isLastAssistantMessage: boolean;
94
95
  message: SuperagentMessage;
95
- onConnectConnector?: (input: SuperagentConnectorActionInput) => Promise<boolean | void> | boolean | void;
96
+ onConnectConnector?: (input: SuperagentConnectorActionInput) => Promise<boolean | string | void> | boolean | string | void;
96
97
  submitToolCallInput?: SubmitToolCallInput;
97
98
  toolCalls: SuperagentToolCall[];
98
99
  toolRenderers?: SuperagentToolRenderers;
@@ -148,12 +149,17 @@ function DefaultToolTimeline({
148
149
  agent: SuperagentAgent;
149
150
  availableConnectors?: SuperagentConnector[];
150
151
  isLastAssistantMessage: boolean;
151
- onConnectConnector?: (input: SuperagentConnectorActionInput) => Promise<boolean | void> | boolean | void;
152
+ onConnectConnector?: (input: SuperagentConnectorActionInput) => Promise<boolean | string | void> | boolean | string | void;
152
153
  submitToolCallInput?: SubmitToolCallInput;
153
154
  toolCalls: SuperagentToolCall[];
154
155
  }) {
155
156
  const visibleToolCalls = useMemo(
156
- () => toolCalls.flatMap(flattenToolCall).filter((toolCall) => !HIDDEN_TOOLS.has(toolCall.name || '')),
157
+ // Hidden tools (write_file, delete_file, ...) stay hidden during normal
158
+ // execution, but a pre-execution guard can pause one as waiting_for_user_input.
159
+ // Keep those visible so the approval card renders and the agent can resume.
160
+ () => toolCalls
161
+ .flatMap(flattenToolCall)
162
+ .filter((toolCall) => !HIDDEN_TOOLS.has(toolCall.name || '') || isApprovalRequest(toolCall)),
157
163
  [toolCalls],
158
164
  );
159
165
  const hasWaitingTool = visibleToolCalls.some(isApprovalRequest);
@@ -189,7 +195,7 @@ function DefaultToolTimeline({
189
195
  >
190
196
  <Text style={conversationStyles.toolTimelineHeaderText}>{label}</Text>
191
197
  <ChevronRight
192
- color="#8E8E93"
198
+ color={themedColor('#8E8E93')}
193
199
  size={15}
194
200
  strokeWidth={2.3}
195
201
  style={expanded ? conversationStyles.toolTimelineChevronOpen : conversationStyles.toolTimelineChevron}
@@ -239,7 +245,7 @@ function ToolTimelineRow({
239
245
  isLastAssistantMessage: boolean;
240
246
  isLast: boolean;
241
247
  isOpen: boolean;
242
- onConnectConnector?: (input: SuperagentConnectorActionInput) => Promise<boolean | void> | boolean | void;
248
+ onConnectConnector?: (input: SuperagentConnectorActionInput) => Promise<boolean | string | void> | boolean | string | void;
243
249
  onToggle: () => void;
244
250
  submitToolCallInput?: SubmitToolCallInput;
245
251
  toolCall: SuperagentToolCall;
@@ -264,7 +270,7 @@ function ToolTimelineRow({
264
270
  style={conversationStyles.toolTimelineRowHeader}
265
271
  >
266
272
  <ChevronRight
267
- color="#A1A1AA"
273
+ color={themedColor('#A1A1AA')}
268
274
  size={15}
269
275
  strokeWidth={2.3}
270
276
  style={isOpen ? conversationStyles.toolTimelineChevronOpen : conversationStyles.toolTimelineChevron}
@@ -322,7 +328,7 @@ function DoneRow() {
322
328
  <View style={conversationStyles.toolDoneRow}>
323
329
  <View style={conversationStyles.toolTimelineIconCol}>
324
330
  <View style={conversationStyles.toolCallIcon}>
325
- <CheckCircle2 color="#E4E4E7" size={17} strokeWidth={2.3} />
331
+ <CheckCircle2 color={themedColor('#E4E4E7')} size={17} strokeWidth={2.3} />
326
332
  </View>
327
333
  </View>
328
334
  <Text style={conversationStyles.toolDoneText}>Done</Text>
@@ -347,7 +353,7 @@ function ToolStatusIcon({ status }: { status?: string }) {
347
353
  if (isRunningStatus({ status })) {
348
354
  return (
349
355
  <View style={conversationStyles.toolCallIcon}>
350
- <ActivityIndicator color="#C9CAF8" size="small" />
356
+ <ActivityIndicator color={themedColor('#C9CAF8')} size="small" />
351
357
  </View>
352
358
  );
353
359
  }
@@ -355,7 +361,7 @@ function ToolStatusIcon({ status }: { status?: string }) {
355
361
  if (isErrorStatus({ status })) {
356
362
  return (
357
363
  <View style={conversationStyles.toolCallIcon}>
358
- <CircleAlert color="#FCA5A5" size={17} strokeWidth={2.3} />
364
+ <CircleAlert color={themedColor('#FCA5A5')} size={17} strokeWidth={2.3} />
359
365
  </View>
360
366
  );
361
367
  }
@@ -363,7 +369,7 @@ function ToolStatusIcon({ status }: { status?: string }) {
363
369
  if (isWaitingStatus({ status })) {
364
370
  return (
365
371
  <View style={conversationStyles.toolCallIcon}>
366
- <Clock color="#FDE047" size={17} strokeWidth={2.3} />
372
+ <Clock color={themedColor('#FDE047')} size={17} strokeWidth={2.3} />
367
373
  </View>
368
374
  );
369
375
  }
@@ -371,14 +377,14 @@ function ToolStatusIcon({ status }: { status?: string }) {
371
377
  if (isSuccessStatus({ status })) {
372
378
  return (
373
379
  <View style={conversationStyles.toolCallIcon}>
374
- <CheckCircle2 color="#86EFAC" size={17} strokeWidth={2.3} />
380
+ <CheckCircle2 color={themedColor('#86EFAC')} size={17} strokeWidth={2.3} />
375
381
  </View>
376
382
  );
377
383
  }
378
384
 
379
385
  return (
380
386
  <View style={conversationStyles.toolCallIcon}>
381
- <Wrench color="#A1A1AA" size={17} strokeWidth={2.3} />
387
+ <Wrench color={themedColor('#A1A1AA')} size={17} strokeWidth={2.3} />
382
388
  </View>
383
389
  );
384
390
  }