@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.
- package/lib/commonjs/AgentSettingsPanel.js +123 -47
- package/lib/commonjs/AgentSettingsPanel.js.map +1 -1
- package/lib/commonjs/AgentSphereIcon.js +14 -118
- package/lib/commonjs/AgentSphereIcon.js.map +1 -1
- package/lib/commonjs/AttachmentPickerStatusModal.js +3 -2
- package/lib/commonjs/AttachmentPickerStatusModal.js.map +1 -1
- package/lib/commonjs/ChannelsPanel.js +66 -44
- package/lib/commonjs/ChannelsPanel.js.map +1 -1
- package/lib/commonjs/ConversationChat.js +11 -2
- package/lib/commonjs/ConversationChat.js.map +1 -1
- package/lib/commonjs/ConversationComposer.js +8 -7
- package/lib/commonjs/ConversationComposer.js.map +1 -1
- package/lib/commonjs/ConversationScreen.js +2 -0
- package/lib/commonjs/ConversationScreen.js.map +1 -1
- package/lib/commonjs/EditorDrawer.js +54 -24
- package/lib/commonjs/EditorDrawer.js.map +1 -1
- package/lib/commonjs/FilesPanel.js +56 -20
- package/lib/commonjs/FilesPanel.js.map +1 -1
- package/lib/commonjs/RenameAgentModal.js +2 -1
- package/lib/commonjs/RenameAgentModal.js.map +1 -1
- package/lib/commonjs/ShareAgentModal.js +11 -10
- package/lib/commonjs/ShareAgentModal.js.map +1 -1
- package/lib/commonjs/ShareAgentModal.styles.js +2 -2
- package/lib/commonjs/ShareAgentModal.styles.js.map +1 -1
- package/lib/commonjs/SuperagentHomeScreen.js +27 -9
- package/lib/commonjs/SuperagentHomeScreen.js.map +1 -1
- package/lib/commonjs/ToolApprovalCard.js +72 -14
- package/lib/commonjs/ToolApprovalCard.js.map +1 -1
- package/lib/commonjs/ToolCallSummary.js +14 -9
- package/lib/commonjs/ToolCallSummary.js.map +1 -1
- package/lib/commonjs/agentSphereAssets.js +327 -0
- package/lib/commonjs/agentSphereAssets.js.map +1 -0
- package/lib/commonjs/agentSphereStyles.js +3 -3
- package/lib/commonjs/agentSphereStyles.js.map +1 -1
- package/lib/commonjs/apiClient.js +7 -0
- package/lib/commonjs/apiClient.js.map +1 -1
- package/lib/commonjs/composerStyles.js +2 -2
- package/lib/commonjs/composerStyles.js.map +1 -1
- package/lib/commonjs/connectorBrandIcons.generated.js +625 -0
- package/lib/commonjs/connectorBrandIcons.generated.js.map +1 -0
- package/lib/commonjs/connectorBrandIcons.js +3 -55
- package/lib/commonjs/connectorBrandIcons.js.map +1 -1
- package/lib/commonjs/connectorCatalog.js +19 -1
- package/lib/commonjs/connectorCatalog.js.map +1 -1
- package/lib/commonjs/conversationParts.js +5 -4
- package/lib/commonjs/conversationParts.js.map +1 -1
- package/lib/commonjs/conversationRuntime.js +120 -12
- package/lib/commonjs/conversationRuntime.js.map +1 -1
- package/lib/commonjs/conversationStyles.js +2 -1
- package/lib/commonjs/conversationStyles.js.map +1 -1
- package/lib/commonjs/editorShellStyles.js +6 -2
- package/lib/commonjs/editorShellStyles.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/markdownStyles.js +2 -2
- package/lib/commonjs/markdownStyles.js.map +1 -1
- package/lib/commonjs/messageActionStyles.js +2 -2
- package/lib/commonjs/messageActionStyles.js.map +1 -1
- package/lib/commonjs/realtimeClient.js +4 -1
- package/lib/commonjs/realtimeClient.js.map +1 -1
- package/lib/commonjs/renameAgentModalStyles.js +2 -2
- package/lib/commonjs/renameAgentModalStyles.js.map +1 -1
- package/lib/commonjs/screenParts.js +24 -41
- package/lib/commonjs/screenParts.js.map +1 -1
- package/lib/commonjs/styles.js +71 -60
- package/lib/commonjs/styles.js.map +1 -1
- package/lib/commonjs/superagentApiClient.js +63 -18
- package/lib/commonjs/superagentApiClient.js.map +1 -1
- package/lib/commonjs/theme.js +249 -0
- package/lib/commonjs/theme.js.map +1 -0
- package/lib/commonjs/useSuperagentConversation.js +133 -20
- package/lib/commonjs/useSuperagentConversation.js.map +1 -1
- package/lib/commonjs/useSuperagentRuntime.js +167 -82
- package/lib/commonjs/useSuperagentRuntime.js.map +1 -1
- package/lib/module/AgentSettingsPanel.js +125 -49
- package/lib/module/AgentSettingsPanel.js.map +1 -1
- package/lib/module/AgentSphereIcon.js +15 -118
- package/lib/module/AgentSphereIcon.js.map +1 -1
- package/lib/module/AttachmentPickerStatusModal.js +4 -3
- package/lib/module/AttachmentPickerStatusModal.js.map +1 -1
- package/lib/module/ChannelsPanel.js +67 -45
- package/lib/module/ChannelsPanel.js.map +1 -1
- package/lib/module/ConversationChat.js +11 -2
- package/lib/module/ConversationChat.js.map +1 -1
- package/lib/module/ConversationComposer.js +8 -7
- package/lib/module/ConversationComposer.js.map +1 -1
- package/lib/module/ConversationScreen.js +2 -0
- package/lib/module/ConversationScreen.js.map +1 -1
- package/lib/module/EditorDrawer.js +55 -25
- package/lib/module/EditorDrawer.js.map +1 -1
- package/lib/module/FilesPanel.js +56 -20
- package/lib/module/FilesPanel.js.map +1 -1
- package/lib/module/RenameAgentModal.js +2 -1
- package/lib/module/RenameAgentModal.js.map +1 -1
- package/lib/module/ShareAgentModal.js +11 -10
- package/lib/module/ShareAgentModal.js.map +1 -1
- package/lib/module/ShareAgentModal.styles.js +2 -2
- package/lib/module/ShareAgentModal.styles.js.map +1 -1
- package/lib/module/SuperagentHomeScreen.js +27 -9
- package/lib/module/SuperagentHomeScreen.js.map +1 -1
- package/lib/module/ToolApprovalCard.js +72 -14
- package/lib/module/ToolApprovalCard.js.map +1 -1
- package/lib/module/ToolCallSummary.js +14 -9
- package/lib/module/ToolCallSummary.js.map +1 -1
- package/lib/module/agentSphereAssets.js +323 -0
- package/lib/module/agentSphereAssets.js.map +1 -0
- package/lib/module/agentSphereStyles.js +3 -3
- package/lib/module/agentSphereStyles.js.map +1 -1
- package/lib/module/apiClient.js +7 -0
- package/lib/module/apiClient.js.map +1 -1
- package/lib/module/composerStyles.js +2 -2
- package/lib/module/composerStyles.js.map +1 -1
- package/lib/module/connectorBrandIcons.generated.js +621 -0
- package/lib/module/connectorBrandIcons.generated.js.map +1 -0
- package/lib/module/connectorBrandIcons.js +1 -53
- package/lib/module/connectorBrandIcons.js.map +1 -1
- package/lib/module/connectorCatalog.js +17 -0
- package/lib/module/connectorCatalog.js.map +1 -1
- package/lib/module/conversationParts.js +5 -4
- package/lib/module/conversationParts.js.map +1 -1
- package/lib/module/conversationRuntime.js +118 -12
- package/lib/module/conversationRuntime.js.map +1 -1
- package/lib/module/conversationStyles.js +3 -2
- package/lib/module/conversationStyles.js.map +1 -1
- package/lib/module/editorShellStyles.js +6 -2
- package/lib/module/editorShellStyles.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/markdownStyles.js +2 -2
- package/lib/module/markdownStyles.js.map +1 -1
- package/lib/module/messageActionStyles.js +2 -2
- package/lib/module/messageActionStyles.js.map +1 -1
- package/lib/module/realtimeClient.js +4 -1
- package/lib/module/realtimeClient.js.map +1 -1
- package/lib/module/renameAgentModalStyles.js +2 -2
- package/lib/module/renameAgentModalStyles.js.map +1 -1
- package/lib/module/screenParts.js +25 -42
- package/lib/module/screenParts.js.map +1 -1
- package/lib/module/styles.js +71 -60
- package/lib/module/styles.js.map +1 -1
- package/lib/module/superagentApiClient.js +63 -18
- package/lib/module/superagentApiClient.js.map +1 -1
- package/lib/module/theme.js +239 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/useSuperagentConversation.js +135 -22
- package/lib/module/useSuperagentConversation.js.map +1 -1
- package/lib/module/useSuperagentRuntime.js +167 -82
- package/lib/module/useSuperagentRuntime.js.map +1 -1
- package/lib/typescript/commonjs/AgentSettingsPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/AgentSphereIcon.d.ts.map +1 -1
- package/lib/typescript/commonjs/AttachmentPickerStatusModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ChannelsPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/ConversationChat.d.ts +1 -1
- package/lib/typescript/commonjs/ConversationChat.d.ts.map +1 -1
- package/lib/typescript/commonjs/ConversationComposer.d.ts.map +1 -1
- package/lib/typescript/commonjs/ConversationMessageList.d.ts +1 -1
- package/lib/typescript/commonjs/ConversationMessageList.d.ts.map +1 -1
- package/lib/typescript/commonjs/ConversationScreen.d.ts +2 -1
- package/lib/typescript/commonjs/ConversationScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/EditorDrawer.d.ts +1 -1
- package/lib/typescript/commonjs/EditorDrawer.d.ts.map +1 -1
- package/lib/typescript/commonjs/FilesPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/RenameAgentModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ShareAgentModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/ShareAgentModal.styles.d.ts.map +1 -1
- package/lib/typescript/commonjs/SuperagentHomeScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ToolApprovalCard.d.ts +3 -3
- package/lib/typescript/commonjs/ToolApprovalCard.d.ts.map +1 -1
- package/lib/typescript/commonjs/ToolCallSummary.d.ts +1 -1
- package/lib/typescript/commonjs/ToolCallSummary.d.ts.map +1 -1
- package/lib/typescript/commonjs/agentSphereAssets.d.ts +2 -0
- package/lib/typescript/commonjs/agentSphereAssets.d.ts.map +1 -0
- package/lib/typescript/commonjs/agentSphereStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/apiClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/composerStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/connectorBrandIcons.d.ts.map +1 -1
- package/lib/typescript/commonjs/connectorBrandIcons.generated.d.ts +2 -0
- package/lib/typescript/commonjs/connectorBrandIcons.generated.d.ts.map +1 -0
- package/lib/typescript/commonjs/connectorCatalog.d.ts +2 -0
- package/lib/typescript/commonjs/connectorCatalog.d.ts.map +1 -1
- package/lib/typescript/commonjs/conversationParts.d.ts +1 -1
- package/lib/typescript/commonjs/conversationParts.d.ts.map +1 -1
- package/lib/typescript/commonjs/conversationRuntime.d.ts +6 -1
- package/lib/typescript/commonjs/conversationRuntime.d.ts.map +1 -1
- package/lib/typescript/commonjs/conversationStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/editorShellStyles.d.ts +4 -0
- package/lib/typescript/commonjs/editorShellStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/markdownStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/messageActionStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/realtimeClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/renameAgentModalStyles.d.ts.map +1 -1
- package/lib/typescript/commonjs/screenParts.d.ts +1 -1
- package/lib/typescript/commonjs/screenParts.d.ts.map +1 -1
- package/lib/typescript/commonjs/styles.d.ts +20 -11
- package/lib/typescript/commonjs/styles.d.ts.map +1 -1
- package/lib/typescript/commonjs/superagentApiClient.d.ts +2 -1
- package/lib/typescript/commonjs/superagentApiClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/theme.d.ts +36 -0
- package/lib/typescript/commonjs/theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/types.d.ts +16 -2
- package/lib/typescript/commonjs/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/useSuperagentConversation.d.ts +3 -2
- package/lib/typescript/commonjs/useSuperagentConversation.d.ts.map +1 -1
- package/lib/typescript/commonjs/useSuperagentRuntime.d.ts +2 -1
- package/lib/typescript/commonjs/useSuperagentRuntime.d.ts.map +1 -1
- package/lib/typescript/module/AgentSettingsPanel.d.ts.map +1 -1
- package/lib/typescript/module/AgentSphereIcon.d.ts.map +1 -1
- package/lib/typescript/module/AttachmentPickerStatusModal.d.ts.map +1 -1
- package/lib/typescript/module/ChannelsPanel.d.ts.map +1 -1
- package/lib/typescript/module/ConversationChat.d.ts +1 -1
- package/lib/typescript/module/ConversationChat.d.ts.map +1 -1
- package/lib/typescript/module/ConversationComposer.d.ts.map +1 -1
- package/lib/typescript/module/ConversationMessageList.d.ts +1 -1
- package/lib/typescript/module/ConversationMessageList.d.ts.map +1 -1
- package/lib/typescript/module/ConversationScreen.d.ts +2 -1
- package/lib/typescript/module/ConversationScreen.d.ts.map +1 -1
- package/lib/typescript/module/EditorDrawer.d.ts +1 -1
- package/lib/typescript/module/EditorDrawer.d.ts.map +1 -1
- package/lib/typescript/module/FilesPanel.d.ts.map +1 -1
- package/lib/typescript/module/RenameAgentModal.d.ts.map +1 -1
- package/lib/typescript/module/ShareAgentModal.d.ts.map +1 -1
- package/lib/typescript/module/ShareAgentModal.styles.d.ts.map +1 -1
- package/lib/typescript/module/SuperagentHomeScreen.d.ts.map +1 -1
- package/lib/typescript/module/ToolApprovalCard.d.ts +3 -3
- package/lib/typescript/module/ToolApprovalCard.d.ts.map +1 -1
- package/lib/typescript/module/ToolCallSummary.d.ts +1 -1
- package/lib/typescript/module/ToolCallSummary.d.ts.map +1 -1
- package/lib/typescript/module/agentSphereAssets.d.ts +2 -0
- package/lib/typescript/module/agentSphereAssets.d.ts.map +1 -0
- package/lib/typescript/module/agentSphereStyles.d.ts.map +1 -1
- package/lib/typescript/module/apiClient.d.ts.map +1 -1
- package/lib/typescript/module/composerStyles.d.ts.map +1 -1
- package/lib/typescript/module/connectorBrandIcons.d.ts.map +1 -1
- package/lib/typescript/module/connectorBrandIcons.generated.d.ts +2 -0
- package/lib/typescript/module/connectorBrandIcons.generated.d.ts.map +1 -0
- package/lib/typescript/module/connectorCatalog.d.ts +2 -0
- package/lib/typescript/module/connectorCatalog.d.ts.map +1 -1
- package/lib/typescript/module/conversationParts.d.ts +1 -1
- package/lib/typescript/module/conversationParts.d.ts.map +1 -1
- package/lib/typescript/module/conversationRuntime.d.ts +6 -1
- package/lib/typescript/module/conversationRuntime.d.ts.map +1 -1
- package/lib/typescript/module/conversationStyles.d.ts.map +1 -1
- package/lib/typescript/module/editorShellStyles.d.ts +4 -0
- package/lib/typescript/module/editorShellStyles.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +2 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/markdownStyles.d.ts.map +1 -1
- package/lib/typescript/module/messageActionStyles.d.ts.map +1 -1
- package/lib/typescript/module/realtimeClient.d.ts.map +1 -1
- package/lib/typescript/module/renameAgentModalStyles.d.ts.map +1 -1
- package/lib/typescript/module/screenParts.d.ts +1 -1
- package/lib/typescript/module/screenParts.d.ts.map +1 -1
- package/lib/typescript/module/styles.d.ts +20 -11
- package/lib/typescript/module/styles.d.ts.map +1 -1
- package/lib/typescript/module/superagentApiClient.d.ts +2 -1
- package/lib/typescript/module/superagentApiClient.d.ts.map +1 -1
- package/lib/typescript/module/theme.d.ts +36 -0
- package/lib/typescript/module/theme.d.ts.map +1 -0
- package/lib/typescript/module/types.d.ts +16 -2
- package/lib/typescript/module/types.d.ts.map +1 -1
- package/lib/typescript/module/useSuperagentConversation.d.ts +3 -2
- package/lib/typescript/module/useSuperagentConversation.d.ts.map +1 -1
- package/lib/typescript/module/useSuperagentRuntime.d.ts +2 -1
- package/lib/typescript/module/useSuperagentRuntime.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/AgentSettingsPanel.tsx +118 -49
- package/src/AgentSphereIcon.tsx +11 -62
- package/src/AttachmentPickerStatusModal.tsx +4 -3
- package/src/ChannelsPanel.tsx +59 -39
- package/src/ConversationChat.tsx +12 -3
- package/src/ConversationComposer.tsx +7 -6
- package/src/ConversationMessageList.tsx +1 -1
- package/src/ConversationScreen.tsx +3 -0
- package/src/EditorDrawer.tsx +66 -41
- package/src/FilesPanel.tsx +48 -20
- package/src/RenameAgentModal.tsx +2 -1
- package/src/ShareAgentModal.styles.ts +2 -1
- package/src/ShareAgentModal.tsx +9 -8
- package/src/SuperagentHomeScreen.tsx +27 -7
- package/src/ToolApprovalCard.tsx +82 -14
- package/src/ToolCallSummary.tsx +18 -12
- package/src/agentSphereAssets.ts +325 -0
- package/src/agentSphereStyles.ts +3 -2
- package/src/apiClient.ts +7 -0
- package/src/composerStyles.ts +2 -1
- package/src/connectorBrandIcons.generated.ts +618 -0
- package/src/connectorBrandIcons.tsx +1 -53
- package/src/connectorCatalog.ts +24 -0
- package/src/conversationParts.tsx +6 -5
- package/src/conversationRuntime.ts +123 -12
- package/src/conversationStyles.ts +2 -1
- package/src/editorShellStyles.ts +6 -1
- package/src/index.ts +2 -0
- package/src/markdownStyles.ts +2 -1
- package/src/messageActionStyles.ts +2 -1
- package/src/realtimeClient.ts +7 -1
- package/src/renameAgentModalStyles.ts +2 -1
- package/src/screenParts.tsx +17 -29
- package/src/styles.ts +63 -54
- package/src/superagentApiClient.ts +68 -18
- package/src/theme.ts +254 -0
- package/src/types.ts +21 -2
- package/src/useSuperagentConversation.ts +141 -24
- package/src/useSuperagentRuntime.ts +165 -84
package/src/ToolApprovalCard.tsx
CHANGED
|
@@ -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
|
-
|
|
40
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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=
|
|
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
|
-
|
|
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=
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
package/src/ToolCallSummary.tsx
CHANGED
|
@@ -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
|
-
(
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
387
|
+
<Wrench color={themedColor('#A1A1AA')} size={17} strokeWidth={2.3} />
|
|
382
388
|
</View>
|
|
383
389
|
);
|
|
384
390
|
}
|