@base44/superagent-native 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (465) hide show
  1. package/README.md +132 -0
  2. package/lib/commonjs/AgentSettingsPanel.js +1067 -0
  3. package/lib/commonjs/AgentSettingsPanel.js.map +1 -0
  4. package/lib/commonjs/AgentSphereIcon.js +243 -0
  5. package/lib/commonjs/AgentSphereIcon.js.map +1 -0
  6. package/lib/commonjs/AttachmentPickerStatusModal.js +96 -0
  7. package/lib/commonjs/AttachmentPickerStatusModal.js.map +1 -0
  8. package/lib/commonjs/AttachmentPreviewStrip.js +49 -0
  9. package/lib/commonjs/AttachmentPreviewStrip.js.map +1 -0
  10. package/lib/commonjs/ChannelsPanel.js +733 -0
  11. package/lib/commonjs/ChannelsPanel.js.map +1 -0
  12. package/lib/commonjs/ConversationChat.js +219 -0
  13. package/lib/commonjs/ConversationChat.js.map +1 -0
  14. package/lib/commonjs/ConversationComposer.js +323 -0
  15. package/lib/commonjs/ConversationComposer.js.map +1 -0
  16. package/lib/commonjs/ConversationMessageList.js +105 -0
  17. package/lib/commonjs/ConversationMessageList.js.map +1 -0
  18. package/lib/commonjs/ConversationScreen.js +241 -0
  19. package/lib/commonjs/ConversationScreen.js.map +1 -0
  20. package/lib/commonjs/EditorDrawer.js +1127 -0
  21. package/lib/commonjs/EditorDrawer.js.map +1 -0
  22. package/lib/commonjs/EditorTabPanel.js +28 -0
  23. package/lib/commonjs/EditorTabPanel.js.map +1 -0
  24. package/lib/commonjs/FilesPanel.js +533 -0
  25. package/lib/commonjs/FilesPanel.js.map +1 -0
  26. package/lib/commonjs/MarkdownText.js +313 -0
  27. package/lib/commonjs/MarkdownText.js.map +1 -0
  28. package/lib/commonjs/MessageActionBar.js +90 -0
  29. package/lib/commonjs/MessageActionBar.js.map +1 -0
  30. package/lib/commonjs/RenameAgentModal.js +99 -0
  31. package/lib/commonjs/RenameAgentModal.js.map +1 -0
  32. package/lib/commonjs/ShareAgentModal.js +349 -0
  33. package/lib/commonjs/ShareAgentModal.js.map +1 -0
  34. package/lib/commonjs/ShareAgentModal.styles.js +236 -0
  35. package/lib/commonjs/ShareAgentModal.styles.js.map +1 -0
  36. package/lib/commonjs/SuperagentHomeScreen.js +316 -0
  37. package/lib/commonjs/SuperagentHomeScreen.js.map +1 -0
  38. package/lib/commonjs/ToolApprovalCard.js +542 -0
  39. package/lib/commonjs/ToolApprovalCard.js.map +1 -0
  40. package/lib/commonjs/ToolCallSummary.js +632 -0
  41. package/lib/commonjs/ToolCallSummary.js.map +1 -0
  42. package/lib/commonjs/agentSphereStyles.js +38 -0
  43. package/lib/commonjs/agentSphereStyles.js.map +1 -0
  44. package/lib/commonjs/apiClient.js +158 -0
  45. package/lib/commonjs/apiClient.js.map +1 -0
  46. package/lib/commonjs/attachmentFileHelpers.js +104 -0
  47. package/lib/commonjs/attachmentFileHelpers.js.map +1 -0
  48. package/lib/commonjs/attachmentUpload.js +87 -0
  49. package/lib/commonjs/attachmentUpload.js.map +1 -0
  50. package/lib/commonjs/composerStyles.js +248 -0
  51. package/lib/commonjs/composerStyles.js.map +1 -0
  52. package/lib/commonjs/connectorBrandIcons.js +82 -0
  53. package/lib/commonjs/connectorBrandIcons.js.map +1 -0
  54. package/lib/commonjs/connectorCatalog.js +377 -0
  55. package/lib/commonjs/connectorCatalog.js.map +1 -0
  56. package/lib/commonjs/constants.js +15 -0
  57. package/lib/commonjs/constants.js.map +1 -0
  58. package/lib/commonjs/conversationParts.js +273 -0
  59. package/lib/commonjs/conversationParts.js.map +1 -0
  60. package/lib/commonjs/conversationRuntime.js +144 -0
  61. package/lib/commonjs/conversationRuntime.js.map +1 -0
  62. package/lib/commonjs/conversationStyles.js +758 -0
  63. package/lib/commonjs/conversationStyles.js.map +1 -0
  64. package/lib/commonjs/editorShellStyles.js +1032 -0
  65. package/lib/commonjs/editorShellStyles.js.map +1 -0
  66. package/lib/commonjs/editorTabs.js +42 -0
  67. package/lib/commonjs/editorTabs.js.map +1 -0
  68. package/lib/commonjs/fileTreeUtils.js +133 -0
  69. package/lib/commonjs/fileTreeUtils.js.map +1 -0
  70. package/lib/commonjs/index.js +110 -0
  71. package/lib/commonjs/index.js.map +1 -0
  72. package/lib/commonjs/markdownStyles.js +157 -0
  73. package/lib/commonjs/markdownStyles.js.map +1 -0
  74. package/lib/commonjs/mediaUtils.js +61 -0
  75. package/lib/commonjs/mediaUtils.js.map +1 -0
  76. package/lib/commonjs/messageActionStyles.js +45 -0
  77. package/lib/commonjs/messageActionStyles.js.map +1 -0
  78. package/lib/commonjs/messageUtils.js +55 -0
  79. package/lib/commonjs/messageUtils.js.map +1 -0
  80. package/lib/commonjs/nativeActionSheet.js +21 -0
  81. package/lib/commonjs/nativeActionSheet.js.map +1 -0
  82. package/lib/commonjs/nativeActionSheet.web.js +10 -0
  83. package/lib/commonjs/nativeActionSheet.web.js.map +1 -0
  84. package/lib/commonjs/package.json +1 -0
  85. package/lib/commonjs/paperTheme.js +59 -0
  86. package/lib/commonjs/paperTheme.js.map +1 -0
  87. package/lib/commonjs/realtimeClient.js +99 -0
  88. package/lib/commonjs/realtimeClient.js.map +1 -0
  89. package/lib/commonjs/renameAgentModalStyles.js +83 -0
  90. package/lib/commonjs/renameAgentModalStyles.js.map +1 -0
  91. package/lib/commonjs/screenParts.js +220 -0
  92. package/lib/commonjs/screenParts.js.map +1 -0
  93. package/lib/commonjs/styles.js +343 -0
  94. package/lib/commonjs/styles.js.map +1 -0
  95. package/lib/commonjs/superagentApiClient.js +613 -0
  96. package/lib/commonjs/superagentApiClient.js.map +1 -0
  97. package/lib/commonjs/types.js +6 -0
  98. package/lib/commonjs/types.js.map +1 -0
  99. package/lib/commonjs/useSuperagentAttachmentPicker.js +80 -0
  100. package/lib/commonjs/useSuperagentAttachmentPicker.js.map +1 -0
  101. package/lib/commonjs/useSuperagentConversation.js +216 -0
  102. package/lib/commonjs/useSuperagentConversation.js.map +1 -0
  103. package/lib/commonjs/useSuperagentRuntime.js +1207 -0
  104. package/lib/commonjs/useSuperagentRuntime.js.map +1 -0
  105. package/lib/module/AgentSettingsPanel.js +1062 -0
  106. package/lib/module/AgentSettingsPanel.js.map +1 -0
  107. package/lib/module/AgentSphereIcon.js +237 -0
  108. package/lib/module/AgentSphereIcon.js.map +1 -0
  109. package/lib/module/AttachmentPickerStatusModal.js +91 -0
  110. package/lib/module/AttachmentPickerStatusModal.js.map +1 -0
  111. package/lib/module/AttachmentPreviewStrip.js +44 -0
  112. package/lib/module/AttachmentPreviewStrip.js.map +1 -0
  113. package/lib/module/ChannelsPanel.js +728 -0
  114. package/lib/module/ChannelsPanel.js.map +1 -0
  115. package/lib/module/ConversationChat.js +214 -0
  116. package/lib/module/ConversationChat.js.map +1 -0
  117. package/lib/module/ConversationComposer.js +318 -0
  118. package/lib/module/ConversationComposer.js.map +1 -0
  119. package/lib/module/ConversationMessageList.js +100 -0
  120. package/lib/module/ConversationMessageList.js.map +1 -0
  121. package/lib/module/ConversationScreen.js +236 -0
  122. package/lib/module/ConversationScreen.js.map +1 -0
  123. package/lib/module/EditorDrawer.js +1122 -0
  124. package/lib/module/EditorDrawer.js.map +1 -0
  125. package/lib/module/EditorTabPanel.js +23 -0
  126. package/lib/module/EditorTabPanel.js.map +1 -0
  127. package/lib/module/FilesPanel.js +528 -0
  128. package/lib/module/FilesPanel.js.map +1 -0
  129. package/lib/module/MarkdownText.js +308 -0
  130. package/lib/module/MarkdownText.js.map +1 -0
  131. package/lib/module/MessageActionBar.js +85 -0
  132. package/lib/module/MessageActionBar.js.map +1 -0
  133. package/lib/module/RenameAgentModal.js +94 -0
  134. package/lib/module/RenameAgentModal.js.map +1 -0
  135. package/lib/module/ShareAgentModal.js +344 -0
  136. package/lib/module/ShareAgentModal.js.map +1 -0
  137. package/lib/module/ShareAgentModal.styles.js +232 -0
  138. package/lib/module/ShareAgentModal.styles.js.map +1 -0
  139. package/lib/module/SuperagentHomeScreen.js +311 -0
  140. package/lib/module/SuperagentHomeScreen.js.map +1 -0
  141. package/lib/module/ToolApprovalCard.js +537 -0
  142. package/lib/module/ToolApprovalCard.js.map +1 -0
  143. package/lib/module/ToolCallSummary.js +627 -0
  144. package/lib/module/ToolCallSummary.js.map +1 -0
  145. package/lib/module/agentSphereStyles.js +34 -0
  146. package/lib/module/agentSphereStyles.js.map +1 -0
  147. package/lib/module/apiClient.js +154 -0
  148. package/lib/module/apiClient.js.map +1 -0
  149. package/lib/module/attachmentFileHelpers.js +97 -0
  150. package/lib/module/attachmentFileHelpers.js.map +1 -0
  151. package/lib/module/attachmentUpload.js +82 -0
  152. package/lib/module/attachmentUpload.js.map +1 -0
  153. package/lib/module/composerStyles.js +244 -0
  154. package/lib/module/composerStyles.js.map +1 -0
  155. package/lib/module/connectorBrandIcons.js +76 -0
  156. package/lib/module/connectorBrandIcons.js.map +1 -0
  157. package/lib/module/connectorCatalog.js +373 -0
  158. package/lib/module/connectorCatalog.js.map +1 -0
  159. package/lib/module/constants.js +10 -0
  160. package/lib/module/constants.js.map +1 -0
  161. package/lib/module/conversationParts.js +266 -0
  162. package/lib/module/conversationParts.js.map +1 -0
  163. package/lib/module/conversationRuntime.js +129 -0
  164. package/lib/module/conversationRuntime.js.map +1 -0
  165. package/lib/module/conversationStyles.js +754 -0
  166. package/lib/module/conversationStyles.js.map +1 -0
  167. package/lib/module/editorShellStyles.js +1028 -0
  168. package/lib/module/editorShellStyles.js.map +1 -0
  169. package/lib/module/editorTabs.js +37 -0
  170. package/lib/module/editorTabs.js.map +1 -0
  171. package/lib/module/fileTreeUtils.js +120 -0
  172. package/lib/module/fileTreeUtils.js.map +1 -0
  173. package/lib/module/index.js +17 -0
  174. package/lib/module/index.js.map +1 -0
  175. package/lib/module/markdownStyles.js +153 -0
  176. package/lib/module/markdownStyles.js.map +1 -0
  177. package/lib/module/mediaUtils.js +53 -0
  178. package/lib/module/mediaUtils.js.map +1 -0
  179. package/lib/module/messageActionStyles.js +41 -0
  180. package/lib/module/messageActionStyles.js.map +1 -0
  181. package/lib/module/messageUtils.js +46 -0
  182. package/lib/module/messageUtils.js.map +1 -0
  183. package/lib/module/nativeActionSheet.js +17 -0
  184. package/lib/module/nativeActionSheet.js.map +1 -0
  185. package/lib/module/nativeActionSheet.web.js +6 -0
  186. package/lib/module/nativeActionSheet.web.js.map +1 -0
  187. package/lib/module/package.json +1 -0
  188. package/lib/module/paperTheme.js +55 -0
  189. package/lib/module/paperTheme.js.map +1 -0
  190. package/lib/module/realtimeClient.js +95 -0
  191. package/lib/module/realtimeClient.js.map +1 -0
  192. package/lib/module/renameAgentModalStyles.js +79 -0
  193. package/lib/module/renameAgentModalStyles.js.map +1 -0
  194. package/lib/module/screenParts.js +210 -0
  195. package/lib/module/screenParts.js.map +1 -0
  196. package/lib/module/styles.js +339 -0
  197. package/lib/module/styles.js.map +1 -0
  198. package/lib/module/superagentApiClient.js +609 -0
  199. package/lib/module/superagentApiClient.js.map +1 -0
  200. package/lib/module/types.js +4 -0
  201. package/lib/module/types.js.map +1 -0
  202. package/lib/module/useSuperagentAttachmentPicker.js +75 -0
  203. package/lib/module/useSuperagentAttachmentPicker.js.map +1 -0
  204. package/lib/module/useSuperagentConversation.js +212 -0
  205. package/lib/module/useSuperagentConversation.js.map +1 -0
  206. package/lib/module/useSuperagentRuntime.js +1203 -0
  207. package/lib/module/useSuperagentRuntime.js.map +1 -0
  208. package/lib/typescript/commonjs/AgentSettingsPanel.d.ts +19 -0
  209. package/lib/typescript/commonjs/AgentSettingsPanel.d.ts.map +1 -0
  210. package/lib/typescript/commonjs/AgentSphereIcon.d.ts +15 -0
  211. package/lib/typescript/commonjs/AgentSphereIcon.d.ts.map +1 -0
  212. package/lib/typescript/commonjs/AttachmentPickerStatusModal.d.ts +8 -0
  213. package/lib/typescript/commonjs/AttachmentPickerStatusModal.d.ts.map +1 -0
  214. package/lib/typescript/commonjs/AttachmentPreviewStrip.d.ts +7 -0
  215. package/lib/typescript/commonjs/AttachmentPreviewStrip.d.ts.map +1 -0
  216. package/lib/typescript/commonjs/ChannelsPanel.d.ts +21 -0
  217. package/lib/typescript/commonjs/ChannelsPanel.d.ts.map +1 -0
  218. package/lib/typescript/commonjs/ConversationChat.d.ts +22 -0
  219. package/lib/typescript/commonjs/ConversationChat.d.ts.map +1 -0
  220. package/lib/typescript/commonjs/ConversationComposer.d.ts +24 -0
  221. package/lib/typescript/commonjs/ConversationComposer.d.ts.map +1 -0
  222. package/lib/typescript/commonjs/ConversationMessageList.d.ts +17 -0
  223. package/lib/typescript/commonjs/ConversationMessageList.d.ts.map +1 -0
  224. package/lib/typescript/commonjs/ConversationScreen.d.ts +80 -0
  225. package/lib/typescript/commonjs/ConversationScreen.d.ts.map +1 -0
  226. package/lib/typescript/commonjs/EditorDrawer.d.ts +67 -0
  227. package/lib/typescript/commonjs/EditorDrawer.d.ts.map +1 -0
  228. package/lib/typescript/commonjs/EditorTabPanel.d.ts +6 -0
  229. package/lib/typescript/commonjs/EditorTabPanel.d.ts.map +1 -0
  230. package/lib/typescript/commonjs/FilesPanel.d.ts +14 -0
  231. package/lib/typescript/commonjs/FilesPanel.d.ts.map +1 -0
  232. package/lib/typescript/commonjs/MarkdownText.d.ts +10 -0
  233. package/lib/typescript/commonjs/MarkdownText.d.ts.map +1 -0
  234. package/lib/typescript/commonjs/MessageActionBar.d.ts +8 -0
  235. package/lib/typescript/commonjs/MessageActionBar.d.ts.map +1 -0
  236. package/lib/typescript/commonjs/RenameAgentModal.d.ts +10 -0
  237. package/lib/typescript/commonjs/RenameAgentModal.d.ts.map +1 -0
  238. package/lib/typescript/commonjs/ShareAgentModal.d.ts +15 -0
  239. package/lib/typescript/commonjs/ShareAgentModal.d.ts.map +1 -0
  240. package/lib/typescript/commonjs/ShareAgentModal.styles.d.ts +229 -0
  241. package/lib/typescript/commonjs/ShareAgentModal.styles.d.ts.map +1 -0
  242. package/lib/typescript/commonjs/SuperagentHomeScreen.d.ts +4 -0
  243. package/lib/typescript/commonjs/SuperagentHomeScreen.d.ts.map +1 -0
  244. package/lib/typescript/commonjs/ToolApprovalCard.d.ts +13 -0
  245. package/lib/typescript/commonjs/ToolApprovalCard.d.ts.map +1 -0
  246. package/lib/typescript/commonjs/ToolCallSummary.d.ts +16 -0
  247. package/lib/typescript/commonjs/ToolCallSummary.d.ts.map +1 -0
  248. package/lib/typescript/commonjs/agentSphereStyles.d.ts +31 -0
  249. package/lib/typescript/commonjs/agentSphereStyles.d.ts.map +1 -0
  250. package/lib/typescript/commonjs/apiClient.d.ts +4 -0
  251. package/lib/typescript/commonjs/apiClient.d.ts.map +1 -0
  252. package/lib/typescript/commonjs/attachmentFileHelpers.d.ts +6 -0
  253. package/lib/typescript/commonjs/attachmentFileHelpers.d.ts.map +1 -0
  254. package/lib/typescript/commonjs/attachmentUpload.d.ts +12 -0
  255. package/lib/typescript/commonjs/attachmentUpload.d.ts.map +1 -0
  256. package/lib/typescript/commonjs/composerStyles.d.ts +241 -0
  257. package/lib/typescript/commonjs/composerStyles.d.ts.map +1 -0
  258. package/lib/typescript/commonjs/connectorBrandIcons.d.ts +7 -0
  259. package/lib/typescript/commonjs/connectorBrandIcons.d.ts.map +1 -0
  260. package/lib/typescript/commonjs/connectorCatalog.d.ts +3 -0
  261. package/lib/typescript/commonjs/connectorCatalog.d.ts.map +1 -0
  262. package/lib/typescript/commonjs/constants.d.ts +4 -0
  263. package/lib/typescript/commonjs/constants.d.ts.map +1 -0
  264. package/lib/typescript/commonjs/conversationParts.d.ts +29 -0
  265. package/lib/typescript/commonjs/conversationParts.d.ts.map +1 -0
  266. package/lib/typescript/commonjs/conversationRuntime.d.ts +67 -0
  267. package/lib/typescript/commonjs/conversationRuntime.d.ts.map +1 -0
  268. package/lib/typescript/commonjs/conversationStyles.d.ts +742 -0
  269. package/lib/typescript/commonjs/conversationStyles.d.ts.map +1 -0
  270. package/lib/typescript/commonjs/editorShellStyles.d.ts +1025 -0
  271. package/lib/typescript/commonjs/editorShellStyles.d.ts.map +1 -0
  272. package/lib/typescript/commonjs/editorTabs.d.ts +11 -0
  273. package/lib/typescript/commonjs/editorTabs.d.ts.map +1 -0
  274. package/lib/typescript/commonjs/fileTreeUtils.d.ts +17 -0
  275. package/lib/typescript/commonjs/fileTreeUtils.d.ts.map +1 -0
  276. package/lib/typescript/commonjs/index.d.ts +20 -0
  277. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  278. package/lib/typescript/commonjs/markdownStyles.d.ts +150 -0
  279. package/lib/typescript/commonjs/markdownStyles.d.ts.map +1 -0
  280. package/lib/typescript/commonjs/mediaUtils.d.ts +9 -0
  281. package/lib/typescript/commonjs/mediaUtils.d.ts.map +1 -0
  282. package/lib/typescript/commonjs/messageActionStyles.d.ts +38 -0
  283. package/lib/typescript/commonjs/messageActionStyles.d.ts.map +1 -0
  284. package/lib/typescript/commonjs/messageUtils.d.ts +8 -0
  285. package/lib/typescript/commonjs/messageUtils.d.ts.map +1 -0
  286. package/lib/typescript/commonjs/nativeActionSheet.d.ts +6 -0
  287. package/lib/typescript/commonjs/nativeActionSheet.d.ts.map +1 -0
  288. package/lib/typescript/commonjs/nativeActionSheet.web.d.ts +3 -0
  289. package/lib/typescript/commonjs/nativeActionSheet.web.d.ts.map +1 -0
  290. package/lib/typescript/commonjs/package.json +1 -0
  291. package/lib/typescript/commonjs/paperTheme.d.ts +3 -0
  292. package/lib/typescript/commonjs/paperTheme.d.ts.map +1 -0
  293. package/lib/typescript/commonjs/realtimeClient.d.ts +16 -0
  294. package/lib/typescript/commonjs/realtimeClient.d.ts.map +1 -0
  295. package/lib/typescript/commonjs/renameAgentModalStyles.d.ts +76 -0
  296. package/lib/typescript/commonjs/renameAgentModalStyles.d.ts.map +1 -0
  297. package/lib/typescript/commonjs/screenParts.d.ts +31 -0
  298. package/lib/typescript/commonjs/screenParts.d.ts.map +1 -0
  299. package/lib/typescript/commonjs/styles.d.ts +336 -0
  300. package/lib/typescript/commonjs/styles.d.ts.map +1 -0
  301. package/lib/typescript/commonjs/superagentApiClient.d.ts +66 -0
  302. package/lib/typescript/commonjs/superagentApiClient.d.ts.map +1 -0
  303. package/lib/typescript/commonjs/types.d.ts +437 -0
  304. package/lib/typescript/commonjs/types.d.ts.map +1 -0
  305. package/lib/typescript/commonjs/useSuperagentAttachmentPicker.d.ts +30 -0
  306. package/lib/typescript/commonjs/useSuperagentAttachmentPicker.d.ts.map +1 -0
  307. package/lib/typescript/commonjs/useSuperagentConversation.d.ts +36 -0
  308. package/lib/typescript/commonjs/useSuperagentConversation.d.ts.map +1 -0
  309. package/lib/typescript/commonjs/useSuperagentRuntime.d.ts +163 -0
  310. package/lib/typescript/commonjs/useSuperagentRuntime.d.ts.map +1 -0
  311. package/lib/typescript/module/AgentSettingsPanel.d.ts +19 -0
  312. package/lib/typescript/module/AgentSettingsPanel.d.ts.map +1 -0
  313. package/lib/typescript/module/AgentSphereIcon.d.ts +15 -0
  314. package/lib/typescript/module/AgentSphereIcon.d.ts.map +1 -0
  315. package/lib/typescript/module/AttachmentPickerStatusModal.d.ts +8 -0
  316. package/lib/typescript/module/AttachmentPickerStatusModal.d.ts.map +1 -0
  317. package/lib/typescript/module/AttachmentPreviewStrip.d.ts +7 -0
  318. package/lib/typescript/module/AttachmentPreviewStrip.d.ts.map +1 -0
  319. package/lib/typescript/module/ChannelsPanel.d.ts +21 -0
  320. package/lib/typescript/module/ChannelsPanel.d.ts.map +1 -0
  321. package/lib/typescript/module/ConversationChat.d.ts +22 -0
  322. package/lib/typescript/module/ConversationChat.d.ts.map +1 -0
  323. package/lib/typescript/module/ConversationComposer.d.ts +24 -0
  324. package/lib/typescript/module/ConversationComposer.d.ts.map +1 -0
  325. package/lib/typescript/module/ConversationMessageList.d.ts +17 -0
  326. package/lib/typescript/module/ConversationMessageList.d.ts.map +1 -0
  327. package/lib/typescript/module/ConversationScreen.d.ts +80 -0
  328. package/lib/typescript/module/ConversationScreen.d.ts.map +1 -0
  329. package/lib/typescript/module/EditorDrawer.d.ts +67 -0
  330. package/lib/typescript/module/EditorDrawer.d.ts.map +1 -0
  331. package/lib/typescript/module/EditorTabPanel.d.ts +6 -0
  332. package/lib/typescript/module/EditorTabPanel.d.ts.map +1 -0
  333. package/lib/typescript/module/FilesPanel.d.ts +14 -0
  334. package/lib/typescript/module/FilesPanel.d.ts.map +1 -0
  335. package/lib/typescript/module/MarkdownText.d.ts +10 -0
  336. package/lib/typescript/module/MarkdownText.d.ts.map +1 -0
  337. package/lib/typescript/module/MessageActionBar.d.ts +8 -0
  338. package/lib/typescript/module/MessageActionBar.d.ts.map +1 -0
  339. package/lib/typescript/module/RenameAgentModal.d.ts +10 -0
  340. package/lib/typescript/module/RenameAgentModal.d.ts.map +1 -0
  341. package/lib/typescript/module/ShareAgentModal.d.ts +15 -0
  342. package/lib/typescript/module/ShareAgentModal.d.ts.map +1 -0
  343. package/lib/typescript/module/ShareAgentModal.styles.d.ts +229 -0
  344. package/lib/typescript/module/ShareAgentModal.styles.d.ts.map +1 -0
  345. package/lib/typescript/module/SuperagentHomeScreen.d.ts +4 -0
  346. package/lib/typescript/module/SuperagentHomeScreen.d.ts.map +1 -0
  347. package/lib/typescript/module/ToolApprovalCard.d.ts +13 -0
  348. package/lib/typescript/module/ToolApprovalCard.d.ts.map +1 -0
  349. package/lib/typescript/module/ToolCallSummary.d.ts +16 -0
  350. package/lib/typescript/module/ToolCallSummary.d.ts.map +1 -0
  351. package/lib/typescript/module/agentSphereStyles.d.ts +31 -0
  352. package/lib/typescript/module/agentSphereStyles.d.ts.map +1 -0
  353. package/lib/typescript/module/apiClient.d.ts +4 -0
  354. package/lib/typescript/module/apiClient.d.ts.map +1 -0
  355. package/lib/typescript/module/attachmentFileHelpers.d.ts +6 -0
  356. package/lib/typescript/module/attachmentFileHelpers.d.ts.map +1 -0
  357. package/lib/typescript/module/attachmentUpload.d.ts +12 -0
  358. package/lib/typescript/module/attachmentUpload.d.ts.map +1 -0
  359. package/lib/typescript/module/composerStyles.d.ts +241 -0
  360. package/lib/typescript/module/composerStyles.d.ts.map +1 -0
  361. package/lib/typescript/module/connectorBrandIcons.d.ts +7 -0
  362. package/lib/typescript/module/connectorBrandIcons.d.ts.map +1 -0
  363. package/lib/typescript/module/connectorCatalog.d.ts +3 -0
  364. package/lib/typescript/module/connectorCatalog.d.ts.map +1 -0
  365. package/lib/typescript/module/constants.d.ts +4 -0
  366. package/lib/typescript/module/constants.d.ts.map +1 -0
  367. package/lib/typescript/module/conversationParts.d.ts +29 -0
  368. package/lib/typescript/module/conversationParts.d.ts.map +1 -0
  369. package/lib/typescript/module/conversationRuntime.d.ts +67 -0
  370. package/lib/typescript/module/conversationRuntime.d.ts.map +1 -0
  371. package/lib/typescript/module/conversationStyles.d.ts +742 -0
  372. package/lib/typescript/module/conversationStyles.d.ts.map +1 -0
  373. package/lib/typescript/module/editorShellStyles.d.ts +1025 -0
  374. package/lib/typescript/module/editorShellStyles.d.ts.map +1 -0
  375. package/lib/typescript/module/editorTabs.d.ts +11 -0
  376. package/lib/typescript/module/editorTabs.d.ts.map +1 -0
  377. package/lib/typescript/module/fileTreeUtils.d.ts +17 -0
  378. package/lib/typescript/module/fileTreeUtils.d.ts.map +1 -0
  379. package/lib/typescript/module/index.d.ts +20 -0
  380. package/lib/typescript/module/index.d.ts.map +1 -0
  381. package/lib/typescript/module/markdownStyles.d.ts +150 -0
  382. package/lib/typescript/module/markdownStyles.d.ts.map +1 -0
  383. package/lib/typescript/module/mediaUtils.d.ts +9 -0
  384. package/lib/typescript/module/mediaUtils.d.ts.map +1 -0
  385. package/lib/typescript/module/messageActionStyles.d.ts +38 -0
  386. package/lib/typescript/module/messageActionStyles.d.ts.map +1 -0
  387. package/lib/typescript/module/messageUtils.d.ts +8 -0
  388. package/lib/typescript/module/messageUtils.d.ts.map +1 -0
  389. package/lib/typescript/module/nativeActionSheet.d.ts +6 -0
  390. package/lib/typescript/module/nativeActionSheet.d.ts.map +1 -0
  391. package/lib/typescript/module/nativeActionSheet.web.d.ts +3 -0
  392. package/lib/typescript/module/nativeActionSheet.web.d.ts.map +1 -0
  393. package/lib/typescript/module/package.json +1 -0
  394. package/lib/typescript/module/paperTheme.d.ts +3 -0
  395. package/lib/typescript/module/paperTheme.d.ts.map +1 -0
  396. package/lib/typescript/module/realtimeClient.d.ts +16 -0
  397. package/lib/typescript/module/realtimeClient.d.ts.map +1 -0
  398. package/lib/typescript/module/renameAgentModalStyles.d.ts +76 -0
  399. package/lib/typescript/module/renameAgentModalStyles.d.ts.map +1 -0
  400. package/lib/typescript/module/screenParts.d.ts +31 -0
  401. package/lib/typescript/module/screenParts.d.ts.map +1 -0
  402. package/lib/typescript/module/styles.d.ts +336 -0
  403. package/lib/typescript/module/styles.d.ts.map +1 -0
  404. package/lib/typescript/module/superagentApiClient.d.ts +66 -0
  405. package/lib/typescript/module/superagentApiClient.d.ts.map +1 -0
  406. package/lib/typescript/module/types.d.ts +437 -0
  407. package/lib/typescript/module/types.d.ts.map +1 -0
  408. package/lib/typescript/module/useSuperagentAttachmentPicker.d.ts +30 -0
  409. package/lib/typescript/module/useSuperagentAttachmentPicker.d.ts.map +1 -0
  410. package/lib/typescript/module/useSuperagentConversation.d.ts +36 -0
  411. package/lib/typescript/module/useSuperagentConversation.d.ts.map +1 -0
  412. package/lib/typescript/module/useSuperagentRuntime.d.ts +163 -0
  413. package/lib/typescript/module/useSuperagentRuntime.d.ts.map +1 -0
  414. package/package.json +87 -0
  415. package/src/AgentSettingsPanel.tsx +1122 -0
  416. package/src/AgentSphereIcon.tsx +170 -0
  417. package/src/AttachmentPickerStatusModal.tsx +80 -0
  418. package/src/AttachmentPreviewStrip.tsx +38 -0
  419. package/src/ChannelsPanel.tsx +705 -0
  420. package/src/ConversationChat.tsx +245 -0
  421. package/src/ConversationComposer.tsx +368 -0
  422. package/src/ConversationMessageList.tsx +140 -0
  423. package/src/ConversationScreen.tsx +320 -0
  424. package/src/EditorDrawer.tsx +1297 -0
  425. package/src/EditorTabPanel.tsx +19 -0
  426. package/src/FilesPanel.tsx +577 -0
  427. package/src/MarkdownText.tsx +317 -0
  428. package/src/MessageActionBar.tsx +126 -0
  429. package/src/RenameAgentModal.tsx +107 -0
  430. package/src/ShareAgentModal.styles.ts +95 -0
  431. package/src/ShareAgentModal.tsx +320 -0
  432. package/src/SuperagentHomeScreen.tsx +318 -0
  433. package/src/ToolApprovalCard.tsx +592 -0
  434. package/src/ToolCallSummary.tsx +599 -0
  435. package/src/agentSphereStyles.ts +25 -0
  436. package/src/apiClient.ts +189 -0
  437. package/src/attachmentFileHelpers.ts +109 -0
  438. package/src/attachmentUpload.ts +112 -0
  439. package/src/composerStyles.ts +167 -0
  440. package/src/connectorBrandIcons.tsx +69 -0
  441. package/src/connectorCatalog.ts +414 -0
  442. package/src/constants.ts +9 -0
  443. package/src/conversationParts.tsx +307 -0
  444. package/src/conversationRuntime.ts +171 -0
  445. package/src/conversationStyles.ts +412 -0
  446. package/src/editorShellStyles.ts +1023 -0
  447. package/src/editorTabs.ts +26 -0
  448. package/src/fileTreeUtils.ts +165 -0
  449. package/src/index.ts +110 -0
  450. package/src/markdownStyles.ts +64 -0
  451. package/src/mediaUtils.ts +75 -0
  452. package/src/messageActionStyles.ts +26 -0
  453. package/src/messageUtils.ts +58 -0
  454. package/src/nativeActionSheet.ts +25 -0
  455. package/src/nativeActionSheet.web.ts +5 -0
  456. package/src/paperTheme.ts +52 -0
  457. package/src/realtimeClient.ts +149 -0
  458. package/src/renameAgentModalStyles.ts +77 -0
  459. package/src/screenParts.tsx +185 -0
  460. package/src/styles.ts +190 -0
  461. package/src/superagentApiClient.ts +895 -0
  462. package/src/types.ts +514 -0
  463. package/src/useSuperagentAttachmentPicker.tsx +117 -0
  464. package/src/useSuperagentConversation.ts +242 -0
  465. package/src/useSuperagentRuntime.ts +1371 -0
@@ -0,0 +1,1297 @@
1
+ import React, { useEffect, useMemo, useState } from 'react';
2
+ import { ActivityIndicator, Modal, Pressable, ScrollView, Text, TextInput, View } from 'react-native';
3
+ import {
4
+ AlertCircle,
5
+ Archive,
6
+ BriefcaseBusiness,
7
+ CalendarDays,
8
+ Check,
9
+ ChevronDown,
10
+ Coins,
11
+ Cloud,
12
+ Database,
13
+ Edit3,
14
+ FileText,
15
+ GitBranch,
16
+ HardDrive,
17
+ Mail,
18
+ MessageCircle,
19
+ MoreHorizontal,
20
+ Plug,
21
+ Play,
22
+ RotateCcw,
23
+ Search,
24
+ Settings,
25
+ Timer,
26
+ ToggleLeft,
27
+ ToggleRight,
28
+ Trash2,
29
+ Unplug,
30
+ Webhook,
31
+ X,
32
+ Zap,
33
+ type LucideIcon,
34
+ } from 'lucide-react-native';
35
+
36
+ import { AgentSettingsPanel } from './AgentSettingsPanel';
37
+ import { AgentSphereIcon } from './AgentSphereIcon';
38
+ import { ChannelsPanel } from './ChannelsPanel';
39
+ import { ConnectorBrandIcon, hasConnectorBrandIcon } from './connectorBrandIcons';
40
+ import { SUPERAGENT_CONNECTOR_CATALOG } from './connectorCatalog';
41
+ import { EDITOR_TAB_SECTIONS, getEditorTabLabel } from './editorTabs';
42
+ import { editorShellStyles } from './editorShellStyles';
43
+ import { FilesPanel } from './FilesPanel';
44
+ import { styles } from './styles';
45
+ import type {
46
+ SuperagentAgent,
47
+ SuperagentAutomationActionInput,
48
+ SuperagentAutomationCreditsSummary,
49
+ SuperagentAutomation,
50
+ SuperagentConnector,
51
+ SuperagentConnectorAccessMode,
52
+ SuperagentConnectorActionInput,
53
+ SuperagentEditorTab,
54
+ SuperagentHomeScreenProps,
55
+ } from './types';
56
+
57
+ const CONNECTOR_ICONS: Record<string, LucideIcon> = {
58
+ github: GitBranch,
59
+ gmail: Mail,
60
+ googlecalendar: CalendarDays,
61
+ googledocs: FileText,
62
+ googledrive: HardDrive,
63
+ googlesheets: Database,
64
+ hubspot: BriefcaseBusiness,
65
+ notion: FileText,
66
+ outlook: Mail,
67
+ salesforce: Cloud,
68
+ slack: MessageCircle,
69
+ slackbot: MessageCircle,
70
+ stripe: Database,
71
+ };
72
+
73
+ const AUTOMATION_ICONS: Partial<Record<SuperagentAutomation['automation_type'], LucideIcon>> = {
74
+ connector: Webhook,
75
+ entity: Zap,
76
+ scheduled: Timer,
77
+ };
78
+
79
+ const SETTING_TABS = EDITOR_TAB_SECTIONS
80
+ .flatMap((section) => section.tabs)
81
+ .filter((tab) => tab.id !== 'chat');
82
+
83
+ export function EditorDrawer({
84
+ activeTab,
85
+ agent,
86
+ automations,
87
+ automationCredits,
88
+ availableConnectors,
89
+ channelStatus,
90
+ collaborators,
91
+ connectedConnectors,
92
+ connectingChannelId,
93
+ connectingConnectorId,
94
+ fileLoadError,
95
+ fileLoadFailed,
96
+ filePaths,
97
+ isLoadingAgentSettings,
98
+ isLoadingChannels,
99
+ isLoadingCollaborators,
100
+ isLoadingFiles,
101
+ isLoadingAutomations,
102
+ isLoadingConnectors,
103
+ isVisible,
104
+ secrets,
105
+ onClose,
106
+ onCancelConnectorConnection,
107
+ onArchiveAutomation,
108
+ onCloneAgent,
109
+ onConnectConnector,
110
+ onDeleteAgent,
111
+ onDeleteAutomation,
112
+ onDeleteSecret,
113
+ onDisconnectConnector,
114
+ onDisconnectIMessage,
115
+ onDisconnectTelegram,
116
+ onEditAutomation,
117
+ onGenerateLineCode,
118
+ onGenerateIMessageCode,
119
+ onOpenIMessage,
120
+ onOpenLine,
121
+ onRemoveConnector,
122
+ onOpenTelegram,
123
+ onOpenWhatsApp,
124
+ onOpenSandboxFile,
125
+ onRefreshChannels,
126
+ onRefreshAgentSettings,
127
+ onRefreshAutomations,
128
+ onRefreshCollaborators,
129
+ onRefreshFiles,
130
+ onRestoreAutomation,
131
+ onRunAutomationNow,
132
+ onSaveSandboxFile,
133
+ onSaveSecret,
134
+ onSelectTab,
135
+ onShareAgentLink,
136
+ onShareIMessageCode,
137
+ onShareLineCode,
138
+ onSetupTelegram,
139
+ onToggleAutomation,
140
+ onUpdateAgentModel,
141
+ onUpdateToolPermissions,
142
+ onUploadSandboxFiles,
143
+ }: {
144
+ activeTab: SuperagentEditorTab;
145
+ agent: SuperagentAgent;
146
+ automations?: SuperagentAutomation[];
147
+ automationCredits?: Record<string, SuperagentAutomationCreditsSummary>;
148
+ availableConnectors?: SuperagentConnector[];
149
+ channelStatus?: SuperagentHomeScreenProps['channelStatus'];
150
+ collaborators?: SuperagentHomeScreenProps['collaborators'];
151
+ connectedConnectors?: SuperagentConnector[];
152
+ connectingChannelId?: SuperagentHomeScreenProps['connectingChannelId'];
153
+ connectingConnectorId?: string | null;
154
+ fileLoadError?: SuperagentHomeScreenProps['fileLoadError'];
155
+ fileLoadFailed?: SuperagentHomeScreenProps['fileLoadFailed'];
156
+ filePaths?: string[];
157
+ isLoadingAgentSettings?: boolean;
158
+ isLoadingChannels?: boolean;
159
+ isLoadingCollaborators?: boolean;
160
+ isLoadingFiles?: boolean;
161
+ isLoadingAutomations?: boolean;
162
+ isLoadingConnectors?: boolean;
163
+ isVisible: boolean;
164
+ secrets?: SuperagentHomeScreenProps['secrets'];
165
+ onClose: () => void;
166
+ onCancelConnectorConnection?: (input: { agentId: string; connectorId: string }) => void;
167
+ onArchiveAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
168
+ onCloneAgent?: SuperagentHomeScreenProps['onCloneAgent'];
169
+ onConnectConnector?: (input: SuperagentConnectorActionInput) => Promise<boolean | void> | boolean | void;
170
+ onDeleteAgent?: SuperagentHomeScreenProps['onDeleteAgent'];
171
+ onDeleteAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
172
+ onDeleteSecret?: SuperagentHomeScreenProps['onDeleteSecret'];
173
+ onDisconnectConnector?: (input: SuperagentConnectorActionInput) => Promise<void> | void;
174
+ onDisconnectIMessage?: SuperagentHomeScreenProps['onDisconnectIMessage'];
175
+ onDisconnectTelegram?: SuperagentHomeScreenProps['onDisconnectTelegram'];
176
+ onEditAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
177
+ onGenerateLineCode?: SuperagentHomeScreenProps['onGenerateLineCode'];
178
+ onGenerateIMessageCode?: SuperagentHomeScreenProps['onGenerateIMessageCode'];
179
+ onOpenIMessage?: SuperagentHomeScreenProps['onOpenIMessage'];
180
+ onOpenLine?: SuperagentHomeScreenProps['onOpenLine'];
181
+ onRemoveConnector?: (input: SuperagentConnectorActionInput) => Promise<void> | void;
182
+ onOpenTelegram?: SuperagentHomeScreenProps['onOpenTelegram'];
183
+ onOpenWhatsApp?: SuperagentHomeScreenProps['onOpenWhatsApp'];
184
+ onOpenSandboxFile?: SuperagentHomeScreenProps['onOpenSandboxFile'];
185
+ onRefreshChannels?: SuperagentHomeScreenProps['onRefreshChannels'];
186
+ onRefreshAgentSettings?: SuperagentHomeScreenProps['onRefreshAgentSettings'];
187
+ onRefreshAutomations?: (agentId: string) => Promise<void> | void;
188
+ onRefreshCollaborators?: SuperagentHomeScreenProps['onRefreshCollaborators'];
189
+ onRefreshFiles?: SuperagentHomeScreenProps['onRefreshFiles'];
190
+ onRestoreAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
191
+ onRunAutomationNow?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
192
+ onSaveSandboxFile?: SuperagentHomeScreenProps['onSaveSandboxFile'];
193
+ onSaveSecret?: SuperagentHomeScreenProps['onSaveSecret'];
194
+ onSelectTab: (tab: SuperagentEditorTab) => void;
195
+ onShareAgentLink?: SuperagentHomeScreenProps['onShareAgentLink'];
196
+ onShareIMessageCode?: SuperagentHomeScreenProps['onShareIMessageCode'];
197
+ onShareLineCode?: SuperagentHomeScreenProps['onShareLineCode'];
198
+ onSetupTelegram?: SuperagentHomeScreenProps['onSetupTelegram'];
199
+ onToggleAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
200
+ onUpdateAgentModel?: SuperagentHomeScreenProps['onUpdateAgentModel'];
201
+ onUpdateToolPermissions?: SuperagentHomeScreenProps['onUpdateToolPermissions'];
202
+ onUploadSandboxFiles?: SuperagentHomeScreenProps['onUploadSandboxFiles'];
203
+ }) {
204
+ const initialTab = activeTab === 'chat' ? 'integrations' : activeTab;
205
+ const [selectedTab, setSelectedTab] = useState<SuperagentEditorTab>(initialTab);
206
+
207
+ useEffect(() => {
208
+ if (isVisible) {
209
+ setSelectedTab(activeTab === 'chat' ? 'integrations' : activeTab);
210
+ }
211
+ }, [activeTab, isVisible]);
212
+
213
+ const selectTab = (tab: SuperagentEditorTab) => {
214
+ setSelectedTab(tab);
215
+ onSelectTab(tab);
216
+ if (tab === 'tasks') {
217
+ onRefreshAutomations?.(agent.id);
218
+ }
219
+ if (tab === 'files') {
220
+ onRefreshFiles?.(agent.id);
221
+ }
222
+ if (tab === 'channels') {
223
+ onRefreshChannels?.(agent.id);
224
+ }
225
+ if (tab === 'agent_settings') {
226
+ onRefreshAgentSettings?.(agent.id);
227
+ onRefreshCollaborators?.(agent.id);
228
+ }
229
+ };
230
+
231
+ return (
232
+ <Modal animationType="slide" presentationStyle="pageSheet" visible={isVisible} onRequestClose={onClose}>
233
+ <View style={editorShellStyles.modalRoot}>
234
+ <View style={editorShellStyles.modalTopBar}>
235
+ <Pressable accessibilityLabel="Close settings" accessibilityRole="button" onPress={onClose} style={({ pressed }) => [
236
+ editorShellStyles.closeButton,
237
+ pressed && styles.pressed,
238
+ ]}>
239
+ <X color="#F4F4F5" size={22} strokeWidth={2.5} />
240
+ </Pressable>
241
+ <View style={editorShellStyles.modalTitleWrap}>
242
+ <Text style={editorShellStyles.modalTitle}>Settings</Text>
243
+ </View>
244
+ <AgentSphereIcon agent={agent} size="header" />
245
+ </View>
246
+
247
+ <ScrollView
248
+ contentContainerStyle={editorShellStyles.modalScrollContent}
249
+ showsVerticalScrollIndicator={false}
250
+ stickyHeaderIndices={[0]}
251
+ >
252
+ <View style={editorShellStyles.stickyTabsWrap}>
253
+ <ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={editorShellStyles.tabsContent}>
254
+ {SETTING_TABS.map((tab) => (
255
+ <Pressable
256
+ accessibilityRole="button"
257
+ key={tab.id}
258
+ onPress={() => selectTab(tab.id)}
259
+ style={({ pressed }) => [
260
+ editorShellStyles.segmentButton,
261
+ selectedTab === tab.id && editorShellStyles.segmentButtonActive,
262
+ pressed && styles.pressed,
263
+ ]}
264
+ >
265
+ <Text style={[
266
+ editorShellStyles.segmentLabel,
267
+ selectedTab === tab.id && editorShellStyles.segmentLabelActive,
268
+ ]}>{tab.label}</Text>
269
+ </Pressable>
270
+ ))}
271
+ </ScrollView>
272
+ </View>
273
+
274
+ {selectedTab === 'integrations' ? (
275
+ <ConnectorsPanel
276
+ agent={agent}
277
+ availableConnectors={availableConnectors}
278
+ connectedConnectors={connectedConnectors}
279
+ connectingConnectorId={connectingConnectorId}
280
+ isLoading={isLoadingConnectors}
281
+ onCancel={onCancelConnectorConnection}
282
+ onConnect={onConnectConnector}
283
+ onDisconnect={onDisconnectConnector}
284
+ onRemove={onRemoveConnector}
285
+ />
286
+ ) : selectedTab === 'tasks' ? (
287
+ <TasksPanel
288
+ agent={agent}
289
+ automationCredits={automationCredits}
290
+ automations={automations}
291
+ isLoading={isLoadingAutomations}
292
+ onArchiveAutomation={onArchiveAutomation}
293
+ onDeleteAutomation={onDeleteAutomation}
294
+ onEditAutomation={onEditAutomation}
295
+ onRestoreAutomation={onRestoreAutomation}
296
+ onRunAutomationNow={onRunAutomationNow}
297
+ onToggleAutomation={onToggleAutomation}
298
+ />
299
+ ) : selectedTab === 'files' ? (
300
+ <FilesPanel
301
+ agent={agent}
302
+ fileLoadError={fileLoadError}
303
+ fileLoadFailed={fileLoadFailed}
304
+ filePaths={filePaths}
305
+ isLoading={isLoadingFiles}
306
+ onOpenSandboxFile={onOpenSandboxFile}
307
+ onRefreshFiles={onRefreshFiles}
308
+ onSaveSandboxFile={onSaveSandboxFile}
309
+ onUploadSandboxFiles={onUploadSandboxFiles}
310
+ />
311
+ ) : selectedTab === 'channels' ? (
312
+ <ChannelsPanel
313
+ agent={agent}
314
+ channelStatus={channelStatus}
315
+ connectingChannelId={connectingChannelId}
316
+ isLoading={isLoadingChannels}
317
+ onDisconnectIMessage={onDisconnectIMessage}
318
+ onDisconnectTelegram={onDisconnectTelegram}
319
+ onGenerateIMessageCode={onGenerateIMessageCode}
320
+ onGenerateLineCode={onGenerateLineCode}
321
+ onOpenIMessage={onOpenIMessage}
322
+ onOpenLine={onOpenLine}
323
+ onOpenTelegram={onOpenTelegram}
324
+ onOpenWhatsApp={onOpenWhatsApp}
325
+ onRefreshChannels={onRefreshChannels}
326
+ onSetupTelegram={onSetupTelegram}
327
+ onShareIMessageCode={onShareIMessageCode}
328
+ onShareLineCode={onShareLineCode}
329
+ />
330
+ ) : selectedTab === 'agent_settings' ? (
331
+ <AgentSettingsPanel
332
+ agent={agent}
333
+ collaborators={collaborators}
334
+ connectedConnectors={connectedConnectors}
335
+ isLoading={isLoadingAgentSettings}
336
+ isLoadingCollaborators={isLoadingCollaborators}
337
+ onCloneAgent={onCloneAgent}
338
+ onDeleteAgent={onDeleteAgent}
339
+ onDeleteSecret={onDeleteSecret}
340
+ onRefreshAgentSettings={onRefreshAgentSettings}
341
+ onSaveSecret={onSaveSecret}
342
+ onShareAgentLink={onShareAgentLink}
343
+ onUpdateAgentModel={onUpdateAgentModel}
344
+ onUpdateToolPermissions={onUpdateToolPermissions}
345
+ secrets={secrets}
346
+ />
347
+ ) : (
348
+ <PlaceholderSettingsPanel tab={selectedTab} />
349
+ )}
350
+ </ScrollView>
351
+ </View>
352
+ </Modal>
353
+ );
354
+ }
355
+
356
+ function TasksPanel({
357
+ agent,
358
+ automationCredits = {},
359
+ automations = [],
360
+ isLoading,
361
+ onArchiveAutomation,
362
+ onDeleteAutomation,
363
+ onEditAutomation,
364
+ onRestoreAutomation,
365
+ onRunAutomationNow,
366
+ onToggleAutomation,
367
+ }: {
368
+ agent: SuperagentAgent;
369
+ automationCredits?: Record<string, SuperagentAutomationCreditsSummary>;
370
+ automations?: SuperagentAutomation[];
371
+ isLoading?: boolean;
372
+ onArchiveAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
373
+ onDeleteAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
374
+ onEditAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
375
+ onRestoreAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
376
+ onRunAutomationNow?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
377
+ onToggleAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
378
+ }) {
379
+ const [viewTab, setViewTab] = useState<'active' | 'archived'>('active');
380
+ const sortedAutomations = useMemo(
381
+ () => [...automations].sort((a, b) => getAutomationTime(b) - getAutomationTime(a)),
382
+ [automations],
383
+ );
384
+ const activeAutomations = sortedAutomations.filter((automation) => !automation.is_archived);
385
+ const archivedAutomations = sortedAutomations.filter((automation) => automation.is_archived);
386
+
387
+ if (isLoading) {
388
+ return (
389
+ <View style={editorShellStyles.loadingPanel}>
390
+ <ActivityIndicator color="#FF5A1F" />
391
+ <Text style={editorShellStyles.loadingText}>Loading automations...</Text>
392
+ </View>
393
+ );
394
+ }
395
+
396
+ const displayAutomations = viewTab === 'archived' ? archivedAutomations : activeAutomations;
397
+
398
+ return (
399
+ <View style={editorShellStyles.settingsStack}>
400
+ <View style={editorShellStyles.panel}>
401
+ <View style={editorShellStyles.panelHeader}>
402
+ <View>
403
+ <Text style={editorShellStyles.panelTitle}>Automations</Text>
404
+ <Text style={editorShellStyles.panelSubtitle}>Scheduled tasks, triggers, history, and usage.</Text>
405
+ </View>
406
+ <Text style={editorShellStyles.countBadge}>{displayAutomations.length}</Text>
407
+ </View>
408
+
409
+ <View style={editorShellStyles.automationTabs}>
410
+ <Pressable
411
+ accessibilityRole="button"
412
+ onPress={() => setViewTab('active')}
413
+ style={({ pressed }) => [
414
+ editorShellStyles.automationTabButton,
415
+ viewTab === 'active' && editorShellStyles.automationTabButtonActive,
416
+ pressed && styles.pressed,
417
+ ]}
418
+ >
419
+ <Text style={[
420
+ editorShellStyles.automationTabText,
421
+ viewTab === 'active' && editorShellStyles.automationTabTextActive,
422
+ ]}>Active {activeAutomations.length}</Text>
423
+ </Pressable>
424
+ <Pressable
425
+ accessibilityRole="button"
426
+ onPress={() => setViewTab('archived')}
427
+ style={({ pressed }) => [
428
+ editorShellStyles.automationTabButton,
429
+ viewTab === 'archived' && editorShellStyles.automationTabButtonActive,
430
+ pressed && styles.pressed,
431
+ ]}
432
+ >
433
+ <Text style={[
434
+ editorShellStyles.automationTabText,
435
+ viewTab === 'archived' && editorShellStyles.automationTabTextActive,
436
+ ]}>Archived {archivedAutomations.length}</Text>
437
+ </Pressable>
438
+ </View>
439
+
440
+ {displayAutomations.length > 0 ? (
441
+ <View style={editorShellStyles.automationList}>
442
+ {displayAutomations.map((automation) => (
443
+ <AutomationCard
444
+ agentId={agent.id}
445
+ automation={automation}
446
+ credits={automationCredits[automation.id]}
447
+ key={automation.id}
448
+ onArchiveAutomation={onArchiveAutomation}
449
+ onDeleteAutomation={onDeleteAutomation}
450
+ onEditAutomation={onEditAutomation}
451
+ onRestoreAutomation={onRestoreAutomation}
452
+ onRunAutomationNow={onRunAutomationNow}
453
+ onToggleAutomation={onToggleAutomation}
454
+ />
455
+ ))}
456
+ </View>
457
+ ) : (
458
+ <View style={editorShellStyles.emptyPanel}>
459
+ {viewTab === 'archived' ? (
460
+ <Archive color="#8E8E93" size={22} strokeWidth={2.2} />
461
+ ) : (
462
+ <Timer color="#8E8E93" size={22} strokeWidth={2.2} />
463
+ )}
464
+ <Text style={editorShellStyles.emptyTitle}>
465
+ {viewTab === 'archived' ? 'No archived automations' : 'No automations yet'}
466
+ </Text>
467
+ <Text style={editorShellStyles.emptyBody}>
468
+ {viewTab === 'archived'
469
+ ? 'Automations you archive will appear here.'
470
+ : 'Ask Superagent to create a scheduled or connector task.'}
471
+ </Text>
472
+ </View>
473
+ )}
474
+ </View>
475
+ </View>
476
+ );
477
+ }
478
+
479
+ type AutomationPendingAction = 'archive' | 'delete' | 'edit' | 'restore' | 'run' | 'toggle';
480
+
481
+ function AutomationCard({
482
+ agentId,
483
+ automation,
484
+ credits,
485
+ onArchiveAutomation,
486
+ onDeleteAutomation,
487
+ onEditAutomation,
488
+ onRestoreAutomation,
489
+ onRunAutomationNow,
490
+ onToggleAutomation,
491
+ }: {
492
+ agentId: string;
493
+ automation: SuperagentAutomation;
494
+ credits?: SuperagentAutomationCreditsSummary;
495
+ onArchiveAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
496
+ onDeleteAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
497
+ onEditAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
498
+ onRestoreAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
499
+ onRunAutomationNow?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
500
+ onToggleAutomation?: (input: SuperagentAutomationActionInput) => Promise<void> | void;
501
+ }) {
502
+ const [expanded, setExpanded] = useState(false);
503
+ const [pendingAction, setPendingAction] = useState<AutomationPendingAction | null>(null);
504
+ const Icon = AUTOMATION_ICONS[automation.automation_type] ?? Timer;
505
+ const trigger = describeAutomationTrigger(automation);
506
+ const lastRun = formatDateTime(automation.last_run_at);
507
+ const isArchived = !!automation.is_archived;
508
+ const isActive = !isArchived && automation.is_active !== false;
509
+ const canRunNow = automation.automation_type === 'scheduled' && !isArchived && !!onRunAutomationNow;
510
+ const actionInput = { agentId, automation };
511
+
512
+ const runAction = async (
513
+ action: AutomationPendingAction,
514
+ handler?: (input: SuperagentAutomationActionInput) => Promise<void> | void,
515
+ ) => {
516
+ if (!handler || pendingAction) {
517
+ return;
518
+ }
519
+
520
+ setPendingAction(action);
521
+ try {
522
+ await handler(actionInput);
523
+ } finally {
524
+ setPendingAction(null);
525
+ }
526
+ };
527
+
528
+ return (
529
+ <View style={editorShellStyles.automationCard}>
530
+ <View style={editorShellStyles.automationIcon}>
531
+ <Icon color="#F4F4F5" size={19} strokeWidth={2.35} />
532
+ </View>
533
+ <View style={editorShellStyles.automationText}>
534
+ <View style={editorShellStyles.inlineTitleRow}>
535
+ <Text numberOfLines={1} style={editorShellStyles.automationName}>{automation.name}</Text>
536
+ <AutomationStatusBadge automation={automation} />
537
+ </View>
538
+ {trigger ? (
539
+ <Text numberOfLines={2} style={editorShellStyles.automationTrigger}>{trigger}</Text>
540
+ ) : null}
541
+ {automation.description ? (
542
+ <Text numberOfLines={2} style={editorShellStyles.automationDescription}>{automation.description}</Text>
543
+ ) : null}
544
+ <View style={editorShellStyles.automationMetaRow}>
545
+ <Text numberOfLines={1} style={editorShellStyles.automationMeta}>
546
+ {formatAutomationType(automation.automation_type)}
547
+ </Text>
548
+ {automation.function_name ? (
549
+ <Text numberOfLines={1} style={editorShellStyles.automationMeta}>
550
+ {automation.function_name}
551
+ </Text>
552
+ ) : null}
553
+ <View style={editorShellStyles.automationCreditBadge}>
554
+ <Coins color="#A1A1AA" size={11} strokeWidth={2.4} />
555
+ <Text numberOfLines={1} style={editorShellStyles.automationCreditText}>
556
+ {credits ? `${formatCredits(credits.total)} credits used` : 'Consumes credits'}
557
+ </Text>
558
+ </View>
559
+ </View>
560
+ <Text numberOfLines={1} style={editorShellStyles.automationRuns}>
561
+ {formatRuns(automation)}
562
+ {lastRun ? ` · Last run ${lastRun}` : ''}
563
+ </Text>
564
+ <View style={editorShellStyles.automationActionRow}>
565
+ <AutomationActionButton
566
+ icon={expanded ? X : ChevronDown}
567
+ label={expanded ? 'Close' : 'Details'}
568
+ onPress={() => setExpanded((current) => !current)}
569
+ />
570
+ {onEditAutomation ? (
571
+ <AutomationActionButton
572
+ icon={Edit3}
573
+ isLoading={pendingAction === 'edit'}
574
+ label="Edit"
575
+ onPress={() => runAction('edit', onEditAutomation)}
576
+ />
577
+ ) : null}
578
+ {canRunNow ? (
579
+ <AutomationActionButton
580
+ icon={Play}
581
+ isLoading={pendingAction === 'run'}
582
+ label="Run"
583
+ onPress={() => runAction('run', onRunAutomationNow)}
584
+ />
585
+ ) : null}
586
+ {!isArchived && onToggleAutomation ? (
587
+ <AutomationActionButton
588
+ icon={isActive ? ToggleRight : ToggleLeft}
589
+ isLoading={pendingAction === 'toggle'}
590
+ label={isActive ? 'Pause' : 'Activate'}
591
+ onPress={() => runAction('toggle', onToggleAutomation)}
592
+ />
593
+ ) : null}
594
+ {!isArchived && onArchiveAutomation ? (
595
+ <AutomationActionButton
596
+ icon={Archive}
597
+ isLoading={pendingAction === 'archive'}
598
+ label="Archive"
599
+ onPress={() => runAction('archive', onArchiveAutomation)}
600
+ />
601
+ ) : null}
602
+ {isArchived && onRestoreAutomation ? (
603
+ <AutomationActionButton
604
+ icon={RotateCcw}
605
+ isLoading={pendingAction === 'restore'}
606
+ label="Restore"
607
+ onPress={() => runAction('restore', onRestoreAutomation)}
608
+ />
609
+ ) : null}
610
+ {onDeleteAutomation ? (
611
+ <AutomationActionButton
612
+ danger
613
+ icon={Trash2}
614
+ isLoading={pendingAction === 'delete'}
615
+ label="Delete"
616
+ onPress={() => runAction('delete', onDeleteAutomation)}
617
+ />
618
+ ) : null}
619
+ </View>
620
+ {expanded ? (
621
+ <View style={editorShellStyles.automationDetailsPanel}>
622
+ {trigger ? (
623
+ <AutomationDetailBlock label="Trigger" value={trigger} />
624
+ ) : null}
625
+ {automation.description ? (
626
+ <AutomationDetailBlock label="Instructions" value={automation.description} />
627
+ ) : null}
628
+ {automation.function_name ? (
629
+ <AutomationDetailBlock label="Task ID" monospace value={automation.function_name} />
630
+ ) : null}
631
+ {automation.function_args && Object.keys(automation.function_args).length > 0 ? (
632
+ <AutomationDetailBlock label="Parameters" monospace value={JSON.stringify(automation.function_args, null, 2)} />
633
+ ) : null}
634
+ <View style={editorShellStyles.automationDetailStats}>
635
+ <Text style={editorShellStyles.automationDetailStatText}>{automation.total_runs ?? 0} total</Text>
636
+ <Text style={editorShellStyles.automationDetailSuccess}>{automation.successful_runs ?? 0} succeeded</Text>
637
+ <Text style={editorShellStyles.automationDetailFailure}>{automation.failed_runs ?? 0} failed</Text>
638
+ </View>
639
+ {credits ? (
640
+ <Text style={editorShellStyles.automationDetailMuted}>
641
+ Total credits: {formatCredits(credits.total)}
642
+ {credits.since ? ` · since ${formatDate(credits.since) ?? credits.since}` : ''}
643
+ </Text>
644
+ ) : null}
645
+ {lastRun ? (
646
+ <Text style={editorShellStyles.automationDetailMuted}>
647
+ Last run: {lastRun}
648
+ {automation.last_run_status ? ` · ${automation.last_run_status}` : ''}
649
+ </Text>
650
+ ) : null}
651
+ {automation.created_date ? (
652
+ <Text style={editorShellStyles.automationDetailMuted}>
653
+ Created {formatDate(automation.created_date) ?? automation.created_date}
654
+ </Text>
655
+ ) : null}
656
+ </View>
657
+ ) : null}
658
+ </View>
659
+ </View>
660
+ );
661
+ }
662
+
663
+ function AutomationActionButton({
664
+ danger,
665
+ icon: Icon,
666
+ isLoading,
667
+ label,
668
+ onPress,
669
+ }: {
670
+ danger?: boolean;
671
+ icon: LucideIcon;
672
+ isLoading?: boolean;
673
+ label: string;
674
+ onPress: () => void;
675
+ }) {
676
+ return (
677
+ <Pressable
678
+ accessibilityLabel={label}
679
+ accessibilityRole="button"
680
+ disabled={isLoading}
681
+ onPress={onPress}
682
+ style={({ pressed }) => [
683
+ editorShellStyles.automationActionButton,
684
+ danger && editorShellStyles.automationActionButtonDanger,
685
+ pressed && styles.pressed,
686
+ isLoading && editorShellStyles.automationActionButtonDisabled,
687
+ ]}
688
+ >
689
+ {isLoading ? (
690
+ <ActivityIndicator color={danger ? '#FCA5A5' : '#F4F4F5'} size="small" />
691
+ ) : (
692
+ <Icon color={danger ? '#FCA5A5' : '#F4F4F5'} size={13} strokeWidth={2.45} />
693
+ )}
694
+ <Text style={[
695
+ editorShellStyles.automationActionText,
696
+ danger && editorShellStyles.automationActionTextDanger,
697
+ ]}>{label}</Text>
698
+ </Pressable>
699
+ );
700
+ }
701
+
702
+ function AutomationDetailBlock({
703
+ label,
704
+ monospace,
705
+ value,
706
+ }: {
707
+ label: string;
708
+ monospace?: boolean;
709
+ value: string;
710
+ }) {
711
+ return (
712
+ <View style={editorShellStyles.automationDetailBlock}>
713
+ <Text style={editorShellStyles.automationDetailLabel}>{label}</Text>
714
+ <Text style={[
715
+ editorShellStyles.automationDetailValue,
716
+ monospace && editorShellStyles.automationDetailValueMono,
717
+ ]}>{value}</Text>
718
+ </View>
719
+ );
720
+ }
721
+
722
+ function AutomationStatusBadge({ automation }: { automation: SuperagentAutomation }) {
723
+ const isArchived = !!automation.is_archived;
724
+ const isActive = !isArchived && automation.is_active !== false;
725
+ const label = isArchived ? 'Archived' : isActive ? 'Active' : 'Paused';
726
+
727
+ return (
728
+ <View style={[
729
+ editorShellStyles.automationStatusBadge,
730
+ isActive ? editorShellStyles.automationStatusActive : editorShellStyles.automationStatusInactive,
731
+ ]}>
732
+ <Text style={[
733
+ editorShellStyles.automationStatusText,
734
+ isActive ? editorShellStyles.automationStatusTextActive : editorShellStyles.automationStatusTextInactive,
735
+ ]}>{label}</Text>
736
+ </View>
737
+ );
738
+ }
739
+
740
+ function ConnectorsPanel({
741
+ agent,
742
+ availableConnectors,
743
+ connectedConnectors,
744
+ connectingConnectorId,
745
+ isLoading,
746
+ onCancel,
747
+ onConnect,
748
+ onDisconnect,
749
+ onRemove,
750
+ }: {
751
+ agent: SuperagentAgent;
752
+ availableConnectors?: SuperagentConnector[];
753
+ connectedConnectors?: SuperagentConnector[];
754
+ connectingConnectorId?: string | null;
755
+ isLoading?: boolean;
756
+ onCancel?: (input: { agentId: string; connectorId: string }) => void;
757
+ onConnect?: (input: SuperagentConnectorActionInput) => Promise<boolean | void> | boolean | void;
758
+ onDisconnect?: (input: SuperagentConnectorActionInput) => Promise<void> | void;
759
+ onRemove?: (input: SuperagentConnectorActionInput) => Promise<void> | void;
760
+ }) {
761
+ const [searchQuery, setSearchQuery] = useState('');
762
+ const connectedIds = useMemo(
763
+ () => new Set((connectedConnectors ?? []).map((connector) => connector.id)),
764
+ [connectedConnectors],
765
+ );
766
+ const available = useMemo(() => {
767
+ const normalizedQuery = searchQuery.trim().toLowerCase();
768
+ return (availableConnectors ?? SUPERAGENT_CONNECTOR_CATALOG)
769
+ .filter((connector) => !connectedIds.has(connector.id))
770
+ .filter((connector) => {
771
+ if (!normalizedQuery) {
772
+ return true;
773
+ }
774
+
775
+ return [
776
+ connector.id,
777
+ connector.name,
778
+ connector.subtitle,
779
+ connector.category,
780
+ ]
781
+ .filter(Boolean)
782
+ .join(' ')
783
+ .toLowerCase()
784
+ .includes(normalizedQuery);
785
+ });
786
+ }, [availableConnectors, connectedIds, searchQuery]);
787
+
788
+ if (isLoading) {
789
+ return (
790
+ <View style={editorShellStyles.loadingPanel}>
791
+ <ActivityIndicator color="#FF5A1F" />
792
+ <Text style={editorShellStyles.loadingText}>Loading connectors...</Text>
793
+ </View>
794
+ );
795
+ }
796
+
797
+ return (
798
+ <View style={editorShellStyles.settingsStack}>
799
+ <View style={editorShellStyles.panel}>
800
+ <View style={editorShellStyles.panelHeader}>
801
+ <View>
802
+ <Text style={editorShellStyles.panelTitle}>Connected</Text>
803
+ <Text style={editorShellStyles.panelSubtitle}>Tools this agent can already use.</Text>
804
+ </View>
805
+ <Text style={editorShellStyles.countBadge}>{connectedConnectors?.length ?? 0}</Text>
806
+ </View>
807
+
808
+ {connectedConnectors && connectedConnectors.length > 0 ? (
809
+ <View style={editorShellStyles.connectorList}>
810
+ {connectedConnectors.map((connector) => (
811
+ <ConnectedConnectorCard
812
+ agentId={agent.id}
813
+ connector={connector}
814
+ isConnecting={connectingConnectorId === connector.id}
815
+ key={connector.id}
816
+ onCancel={onCancel}
817
+ onConnect={onConnect}
818
+ onDisconnect={onDisconnect}
819
+ onRemove={onRemove}
820
+ />
821
+ ))}
822
+ </View>
823
+ ) : (
824
+ <View style={editorShellStyles.emptyPanel}>
825
+ <Plug color="#8E8E93" size={22} strokeWidth={2.2} />
826
+ <Text style={editorShellStyles.emptyTitle}>No connectors yet</Text>
827
+ <Text style={editorShellStyles.emptyBody}>Connect a service below to let this agent use it from chat.</Text>
828
+ </View>
829
+ )}
830
+ </View>
831
+
832
+ <View style={editorShellStyles.panel}>
833
+ <View style={editorShellStyles.panelHeader}>
834
+ <View>
835
+ <Text style={editorShellStyles.panelTitle}>Available connectors</Text>
836
+ <Text style={editorShellStyles.panelSubtitle}>Browse the same tools from the web editor.</Text>
837
+ </View>
838
+ <Text style={editorShellStyles.countBadge}>{available.length}</Text>
839
+ </View>
840
+ <View style={editorShellStyles.connectorSearchWrap}>
841
+ <Search color="#A1A1AA" size={16} strokeWidth={2.4} />
842
+ <TextInput
843
+ autoCapitalize="none"
844
+ autoCorrect={false}
845
+ clearButtonMode="while-editing"
846
+ onChangeText={setSearchQuery}
847
+ placeholder="Search connectors"
848
+ placeholderTextColor="#8E8E93"
849
+ returnKeyType="search"
850
+ style={editorShellStyles.connectorSearchInput}
851
+ value={searchQuery}
852
+ />
853
+ </View>
854
+ <View style={editorShellStyles.connectorList}>
855
+ {available.length > 0 ? (
856
+ available.map((connector) => (
857
+ <AvailableConnectorCard
858
+ agentId={agent.id}
859
+ connector={connector}
860
+ isConnecting={connectingConnectorId === connector.id}
861
+ key={connector.id}
862
+ onCancel={onCancel}
863
+ onConnect={onConnect}
864
+ />
865
+ ))
866
+ ) : (
867
+ <View style={editorShellStyles.emptyPanel}>
868
+ <Search color="#8E8E93" size={22} strokeWidth={2.2} />
869
+ <Text style={editorShellStyles.emptyTitle}>No matching connectors</Text>
870
+ <Text style={editorShellStyles.emptyBody}>Try a different connector name or category.</Text>
871
+ </View>
872
+ )}
873
+ </View>
874
+ </View>
875
+ </View>
876
+ );
877
+ }
878
+
879
+ function ConnectedConnectorCard({
880
+ agentId,
881
+ connector,
882
+ isConnecting,
883
+ onCancel,
884
+ onConnect,
885
+ onDisconnect,
886
+ onRemove,
887
+ }: {
888
+ agentId: string;
889
+ connector: SuperagentConnector;
890
+ isConnecting: boolean;
891
+ onCancel?: (input: { agentId: string; connectorId: string }) => void;
892
+ onConnect?: (input: SuperagentConnectorActionInput) => Promise<boolean | void> | boolean | void;
893
+ onDisconnect?: (input: SuperagentConnectorActionInput) => Promise<void> | void;
894
+ onRemove?: (input: SuperagentConnectorActionInput) => Promise<void> | void;
895
+ }) {
896
+ const status = connector.status ?? 'active';
897
+ const [menuOpen, setMenuOpen] = useState(false);
898
+ const hasAccessModes = !!connector.accessModes;
899
+ const currentMode = connector.accessMode ?? null;
900
+ const oppositeMode: SuperagentConnectorAccessMode = currentMode === 'read_only' ? 'full_access' : 'read_only';
901
+
902
+ return (
903
+ <View style={[editorShellStyles.connectorCard, menuOpen && editorShellStyles.connectorCardMenuOpen]}>
904
+ <ConnectorIcon connector={connector} />
905
+ <View style={editorShellStyles.connectorText}>
906
+ <View style={editorShellStyles.inlineTitleRow}>
907
+ <Text numberOfLines={1} style={editorShellStyles.connectorName}>{connector.name}</Text>
908
+ <StatusBadge status={status} />
909
+ {currentMode ? <AccessModeBadge mode={currentMode} /> : null}
910
+ </View>
911
+ <Text numberOfLines={1} style={editorShellStyles.connectorSubtitle}>
912
+ {connector.accountIdentifier || connector.subtitle || 'Connected account'}
913
+ </Text>
914
+ </View>
915
+ {isConnecting ? (
916
+ <View style={editorShellStyles.connectingWrap}>
917
+ <ActivityIndicator color="#8B5CF6" size="small" />
918
+ <Pressable
919
+ accessibilityLabel={`Cancel ${connector.name} connection`}
920
+ accessibilityRole="button"
921
+ onPress={() => onCancel?.({ agentId, connectorId: connector.id })}
922
+ style={({ pressed }) => [editorShellStyles.cancelConnectButton, pressed && styles.pressed]}
923
+ >
924
+ <Text style={editorShellStyles.cancelConnectText}>Cancel</Text>
925
+ </Pressable>
926
+ </View>
927
+ ) : (
928
+ <View style={editorShellStyles.connectorActions}>
929
+ <Pressable
930
+ accessibilityLabel={`${connector.name} actions`}
931
+ accessibilityRole="button"
932
+ onPress={() => setMenuOpen((open) => !open)}
933
+ style={({ pressed }) => [
934
+ editorShellStyles.moreButton,
935
+ pressed && styles.pressed,
936
+ ]}
937
+ >
938
+ <MoreHorizontal color="#E4E4E7" size={19} strokeWidth={2.4} />
939
+ </Pressable>
940
+ </View>
941
+ )}
942
+ {menuOpen ? (
943
+ <View style={editorShellStyles.connectorMenu}>
944
+ {hasAccessModes && onConnect ? (
945
+ <MenuAction
946
+ label={oppositeMode === 'read_only' ? 'Switch to read only' : 'Switch to full access'}
947
+ onPress={() => {
948
+ setMenuOpen(false);
949
+ onConnect({
950
+ accessMode: oppositeMode,
951
+ agentId,
952
+ connectorId: connector.id,
953
+ forceReconnect: true,
954
+ scopes: getConnectorScopesForMode(connector, oppositeMode),
955
+ });
956
+ }}
957
+ />
958
+ ) : null}
959
+ <MenuAction
960
+ label={status === 'active' ? 'Switch account' : 'Reconnect'}
961
+ onPress={() => {
962
+ setMenuOpen(false);
963
+ onConnect?.({
964
+ accessMode: connector.accessMode ?? undefined,
965
+ agentId,
966
+ connectorId: connector.id,
967
+ forceReconnect: true,
968
+ scopes: connector.scopes?.length ? connector.scopes : getConnectorScopesForMode(connector, connector.accessMode ?? 'full_access'),
969
+ });
970
+ }}
971
+ />
972
+ {status !== 'disconnected' ? (
973
+ <MenuAction
974
+ destructive
975
+ label="Disconnect"
976
+ onPress={() => {
977
+ setMenuOpen(false);
978
+ onDisconnect?.({ agentId, connectorId: connector.id });
979
+ }}
980
+ />
981
+ ) : null}
982
+ <MenuAction
983
+ destructive
984
+ label="Remove"
985
+ onPress={() => {
986
+ setMenuOpen(false);
987
+ onRemove?.({ agentId, connectorId: connector.id });
988
+ }}
989
+ />
990
+ </View>
991
+ ) : null}
992
+ </View>
993
+ );
994
+ }
995
+
996
+ function MenuAction({ destructive, label, onPress }: { destructive?: boolean; label: string; onPress: () => void }) {
997
+ return (
998
+ <Pressable accessibilityRole="button" onPress={onPress} style={({ pressed }) => [
999
+ editorShellStyles.menuAction,
1000
+ pressed && styles.pressed,
1001
+ ]}>
1002
+ <Text style={[
1003
+ editorShellStyles.menuActionText,
1004
+ destructive && editorShellStyles.menuActionTextDestructive,
1005
+ ]}>{label}</Text>
1006
+ </Pressable>
1007
+ );
1008
+ }
1009
+
1010
+ function AvailableConnectorCard({
1011
+ agentId,
1012
+ connector,
1013
+ isConnecting,
1014
+ onCancel,
1015
+ onConnect,
1016
+ }: {
1017
+ agentId: string;
1018
+ connector: SuperagentConnector;
1019
+ isConnecting: boolean;
1020
+ onCancel?: (input: { agentId: string; connectorId: string }) => void;
1021
+ onConnect?: (input: SuperagentConnectorActionInput) => Promise<boolean | void> | boolean | void;
1022
+ }) {
1023
+ const [accessMode, setAccessMode] = useState<SuperagentConnectorAccessMode>(
1024
+ connector.accessMode ?? 'full_access',
1025
+ );
1026
+ const hasAccessModes = !!connector.accessModes || connector.supportsReadOnly;
1027
+
1028
+ return (
1029
+ <View style={editorShellStyles.connectorCard}>
1030
+ <ConnectorIcon connector={connector} />
1031
+ <View style={editorShellStyles.connectorText}>
1032
+ <Text numberOfLines={1} style={editorShellStyles.connectorName}>{connector.name}</Text>
1033
+ <Text numberOfLines={1} style={editorShellStyles.connectorSubtitle}>{connector.subtitle}</Text>
1034
+ </View>
1035
+ {isConnecting ? (
1036
+ <View style={editorShellStyles.connectingWrap}>
1037
+ <ActivityIndicator color="#8B5CF6" size="small" />
1038
+ <Pressable
1039
+ accessibilityLabel={`Cancel ${connector.name} connection`}
1040
+ accessibilityRole="button"
1041
+ onPress={() => onCancel?.({ agentId, connectorId: connector.id })}
1042
+ style={({ pressed }) => [editorShellStyles.cancelConnectButton, pressed && styles.pressed]}
1043
+ >
1044
+ <Text style={editorShellStyles.cancelConnectText}>Cancel</Text>
1045
+ </Pressable>
1046
+ </View>
1047
+ ) : (
1048
+ <View style={editorShellStyles.availableActions}>
1049
+ <Pressable
1050
+ accessibilityLabel={`Connect ${connector.name}`}
1051
+ accessibilityRole="button"
1052
+ disabled={!onConnect}
1053
+ onPress={() => onConnect?.({
1054
+ accessMode,
1055
+ agentId,
1056
+ connectorId: connector.id,
1057
+ scopes: getConnectorScopesForMode(connector, accessMode),
1058
+ })}
1059
+ style={({ pressed }) => [
1060
+ editorShellStyles.webConnectButton,
1061
+ !onConnect && editorShellStyles.disabledAction,
1062
+ pressed && styles.pressed,
1063
+ ]}
1064
+ >
1065
+ <Text style={editorShellStyles.webConnectText}>Connect</Text>
1066
+ </Pressable>
1067
+ {hasAccessModes ? (
1068
+ <View style={editorShellStyles.accessToggle}>
1069
+ <AccessButton active={accessMode === 'read_only'} label="Read" onPress={() => setAccessMode('read_only')} />
1070
+ <AccessButton active={accessMode === 'full_access'} label="Full" onPress={() => setAccessMode('full_access')} />
1071
+ </View>
1072
+ ) : null}
1073
+ </View>
1074
+ )}
1075
+ </View>
1076
+ );
1077
+ }
1078
+
1079
+ function AccessModeBadge({ mode }: { mode: SuperagentConnectorAccessMode }) {
1080
+ const isReadOnly = mode === 'read_only';
1081
+ return (
1082
+ <View style={[
1083
+ editorShellStyles.accessBadge,
1084
+ isReadOnly ? editorShellStyles.accessBadgeReadOnly : editorShellStyles.accessBadgeFull,
1085
+ ]}>
1086
+ <Text style={[
1087
+ editorShellStyles.accessBadgeText,
1088
+ isReadOnly ? editorShellStyles.accessBadgeTextReadOnly : editorShellStyles.accessBadgeTextFull,
1089
+ ]}>{isReadOnly ? 'Read only' : 'Full access'}</Text>
1090
+ </View>
1091
+ );
1092
+ }
1093
+
1094
+ function getConnectorScopesForMode(connector: SuperagentConnector, mode: SuperagentConnectorAccessMode) {
1095
+ if (connector.accessModes) {
1096
+ return mode === 'read_only' ? connector.accessModes.readOnly : connector.accessModes.fullAccess;
1097
+ }
1098
+
1099
+ return connector.exampleScopes ?? connector.scopes;
1100
+ }
1101
+
1102
+ function AccessButton({ active, label, onPress }: { active: boolean; label: string; onPress: () => void }) {
1103
+ return (
1104
+ <Pressable accessibilityRole="button" onPress={onPress} style={[
1105
+ editorShellStyles.accessButton,
1106
+ active && editorShellStyles.accessButtonActive,
1107
+ ]}>
1108
+ <Text style={[
1109
+ editorShellStyles.accessButtonText,
1110
+ active && editorShellStyles.accessButtonTextActive,
1111
+ ]}>{label}</Text>
1112
+ </Pressable>
1113
+ );
1114
+ }
1115
+
1116
+ const DAY_NAMES = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
1117
+
1118
+ function describeAutomationTrigger(automation: SuperagentAutomation) {
1119
+ if (automation.automation_type === 'scheduled') {
1120
+ return describeSchedule(automation);
1121
+ }
1122
+
1123
+ if (automation.automation_type === 'entity') {
1124
+ const events = automation.event_types?.length ? automation.event_types.join(', ') : 'changes';
1125
+ return automation.entity_name ? `${automation.entity_name} · ${events}` : events;
1126
+ }
1127
+
1128
+ if (automation.automation_type === 'connector') {
1129
+ const connectorName = getConnectorDisplayName(automation.integration_type);
1130
+ const events = automation.events?.length ? automation.events.join(', ') : '';
1131
+ return events ? `${connectorName} · ${events}` : connectorName;
1132
+ }
1133
+
1134
+ return null;
1135
+ }
1136
+
1137
+ function describeSchedule(automation: SuperagentAutomation) {
1138
+ if (automation.schedule_mode === 'one-time' && automation.one_time_date) {
1139
+ return `One-time · ${formatDateTime(automation.one_time_date) ?? automation.one_time_date}`;
1140
+ }
1141
+
1142
+ if (automation.schedule_type === 'cron' && automation.cron_expression) {
1143
+ return `Cron · ${automation.cron_expression}`;
1144
+ }
1145
+
1146
+ const parts: string[] = [];
1147
+ if (automation.repeat_interval && automation.repeat_unit) {
1148
+ const unit = automation.repeat_interval === 1
1149
+ ? automation.repeat_unit.replace(/s$/, '')
1150
+ : automation.repeat_unit;
1151
+ parts.push(`Every ${automation.repeat_interval === 1 ? '' : `${automation.repeat_interval} `}${unit}`.trim());
1152
+ }
1153
+ if (automation.repeat_unit === 'weeks' && automation.repeat_on_days?.length) {
1154
+ parts.push(`on ${automation.repeat_on_days.map((day) => DAY_NAMES[day]).filter(Boolean).join(', ')}`);
1155
+ }
1156
+ if (automation.repeat_unit === 'months' && automation.repeat_on_day_of_month) {
1157
+ parts.push(`on day ${automation.repeat_on_day_of_month}`);
1158
+ }
1159
+ if (automation.start_time) {
1160
+ parts.push(`at ${automation.start_time}`);
1161
+ }
1162
+ if (automation.ends_type === 'on' && automation.ends_on_date) {
1163
+ parts.push(`until ${formatDate(automation.ends_on_date) ?? automation.ends_on_date}`);
1164
+ } else if (automation.ends_type === 'after' && automation.ends_after_count) {
1165
+ parts.push(`for ${automation.ends_after_count} runs`);
1166
+ }
1167
+
1168
+ return parts.length > 0 ? parts.join(' ') : null;
1169
+ }
1170
+
1171
+ function formatAutomationType(type: SuperagentAutomation['automation_type']) {
1172
+ if (type === 'scheduled') {
1173
+ return 'Scheduled';
1174
+ }
1175
+ if (type === 'entity') {
1176
+ return 'Entity trigger';
1177
+ }
1178
+ if (type === 'connector') {
1179
+ return 'Connector trigger';
1180
+ }
1181
+ return String(type);
1182
+ }
1183
+
1184
+ function formatRuns(automation: SuperagentAutomation) {
1185
+ const total = automation.total_runs ?? 0;
1186
+ const successful = automation.successful_runs ?? 0;
1187
+ const failed = automation.failed_runs ?? 0;
1188
+ return `${total} runs · ${successful} succeeded · ${failed} failed`;
1189
+ }
1190
+
1191
+ function formatCredits(value: number) {
1192
+ return Number.isInteger(value) ? String(value) : value.toFixed(1).replace(/\.0$/, '');
1193
+ }
1194
+
1195
+ function getAutomationTime(automation: SuperagentAutomation) {
1196
+ const dateValue = automation.updated_date ?? automation.created_date ?? automation.last_run_at;
1197
+ if (!dateValue) {
1198
+ return 0;
1199
+ }
1200
+
1201
+ const timestamp = Date.parse(dateValue);
1202
+ return Number.isNaN(timestamp) ? 0 : timestamp;
1203
+ }
1204
+
1205
+ function getConnectorDisplayName(connectorId?: string) {
1206
+ if (!connectorId) {
1207
+ return 'Connector';
1208
+ }
1209
+
1210
+ return SUPERAGENT_CONNECTOR_CATALOG.find((connector) => connector.id === connectorId)?.name
1211
+ ?? connectorId
1212
+ .split(/[_-]/)
1213
+ .filter(Boolean)
1214
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
1215
+ .join(' ');
1216
+ }
1217
+
1218
+ function formatDate(value?: string) {
1219
+ if (!value) {
1220
+ return null;
1221
+ }
1222
+
1223
+ const date = new Date(value);
1224
+ if (Number.isNaN(date.getTime())) {
1225
+ return value;
1226
+ }
1227
+
1228
+ return date.toLocaleDateString();
1229
+ }
1230
+
1231
+ function formatDateTime(value?: string) {
1232
+ if (!value) {
1233
+ return null;
1234
+ }
1235
+
1236
+ const date = new Date(value);
1237
+ if (Number.isNaN(date.getTime())) {
1238
+ return value;
1239
+ }
1240
+
1241
+ return date.toLocaleString();
1242
+ }
1243
+
1244
+ function ConnectorIcon({ connector }: { connector: SuperagentConnector }) {
1245
+ const Icon = CONNECTOR_ICONS[connector.id] ?? Plug;
1246
+ const iconBackgroundColor = connector.iconBackgroundColor ?? '#FFFFFF';
1247
+ const hasBrandIcon = hasConnectorBrandIcon(connector.id);
1248
+
1249
+ return (
1250
+ <View style={[editorShellStyles.connectorIcon, { backgroundColor: iconBackgroundColor }]}>
1251
+ {hasBrandIcon ? (
1252
+ <ConnectorBrandIcon connectorId={connector.id} size={22} />
1253
+ ) : (
1254
+ <Icon color="#111827" size={20} strokeWidth={2.35} />
1255
+ )}
1256
+ </View>
1257
+ );
1258
+ }
1259
+
1260
+ function StatusBadge({ status }: { status: SuperagentConnector['status'] }) {
1261
+ const isActive = status === 'active' || !status;
1262
+ const isDisconnected = status === 'disconnected';
1263
+ const Icon = isActive ? Check : isDisconnected ? Unplug : AlertCircle;
1264
+ return (
1265
+ <View style={[
1266
+ editorShellStyles.statusBadge,
1267
+ isActive ? editorShellStyles.statusBadgeActive : isDisconnected ? editorShellStyles.statusBadgeDisconnected : editorShellStyles.statusBadgeWarning,
1268
+ ]}>
1269
+ <Icon color={isActive ? '#34D399' : isDisconnected ? '#A1A1AA' : '#FCA5A5'} size={11} strokeWidth={2.7} />
1270
+ <Text style={[
1271
+ editorShellStyles.statusBadgeText,
1272
+ isActive ? editorShellStyles.statusBadgeTextActive : isDisconnected ? editorShellStyles.statusBadgeTextDisconnected : editorShellStyles.statusBadgeTextWarning,
1273
+ ]}>{isActive ? 'Active' : status}</Text>
1274
+ </View>
1275
+ );
1276
+ }
1277
+
1278
+ function PlaceholderSettingsPanel({ tab }: { tab: SuperagentEditorTab }) {
1279
+ const label = getEditorTabLabel(tab);
1280
+ const iconMap: Partial<Record<SuperagentEditorTab, LucideIcon>> = {
1281
+ files: FileText,
1282
+ tasks: Settings,
1283
+ };
1284
+ const Icon = iconMap[tab] ?? Settings;
1285
+
1286
+ return (
1287
+ <View style={editorShellStyles.placeholderPanel}>
1288
+ <View style={editorShellStyles.placeholderIcon}>
1289
+ <Icon color="#FF5A1F" size={24} strokeWidth={2.3} />
1290
+ </View>
1291
+ <Text style={editorShellStyles.placeholderTitle}>{label}</Text>
1292
+ <Text style={editorShellStyles.placeholderBody}>
1293
+ This section now lives in the settings modal. The next slice can replace this placeholder with the matching native controls.
1294
+ </Text>
1295
+ </View>
1296
+ );
1297
+ }