import { type QueryClient } from '@tanstack/react-query'; import { type SuperagentSocketLike } from './socketClient'; import { type SuperagentAgent, type SuperagentAgentActionInput, type SuperagentAutomation, type SuperagentAutomationActionInput, type SuperagentAutomationCreditsSummary, type SuperagentChannelActionInput, type SuperagentChannelId, type SuperagentChannelStatus, type SuperagentChannelUrlActionInput, type SuperagentCollaborator, type SuperagentConnector, type SuperagentConnectorActionInput, type SuperagentShareAgentInput, type SuperagentIMessageCodeShareInput, type SuperagentLineCodeShareInput, type SuperagentLiveVoiceInput, type SuperagentModelUpdateInput, type SuperagentOpenWorkspaceMembersInput, type SuperagentRealtimeClient, type SuperagentRenameAgentInput, type SuperagentSandboxFileActionInput, type SuperagentSandboxFileSaveInput, type SuperagentSandboxFileUploadInput, type SuperagentSecret, type SuperagentSecretDeleteInput, type SuperagentSecretSaveInput, type SuperagentTelegramSetupInput, type SuperagentRoute, type SuperagentToolPermissionsUpdateInput, type SuperagentWorkflow, type SuperagentWorkflowActionInput } from '../types'; import type { SuperagentAttachmentPickerAdapters } from '../features/attachments/useSuperagentAttachmentPicker'; import type { SuperagentUser } from '../types'; export type SuperagentExternalAuthCallbackStatus = 'success' | 'error' | 'unknown'; export type SuperagentExternalAuthCallbackEvent = { callbackUrl: string; ok: boolean; status: SuperagentExternalAuthCallbackStatus; }; export type SuperagentSessionConfig = { baseUrl: string; /** Stable, opaque host-owned scope for isolating cached session data (for example a workspace id). */ cacheScope: string; getAccessToken: () => Promise | string | null | undefined; getHeaders?: () => Promise | undefined> | Record | undefined; /** Host-owned client shared by every native-navigation root. */ queryClient: QueryClient; webUrl?: string; }; export type SuperagentSandboxPickedFile = { content: string; name: string; }; export type SuperagentRealtimeSocketFactoryInput = { appId: string; baseUrl: string; token: string; }; export type SuperagentRuntimeSocket = SuperagentSocketLike & { disconnect?: () => void; }; export type SuperagentLiveAudioChunk = { data: string; mimeType?: string; }; export type SuperagentLiveAudioCapture = { stop?: () => Promise | void; }; export type SuperagentLiveAudioCaptureInput = { mimeType: string; onAudioChunk: (chunk: SuperagentLiveAudioChunk) => void; onError?: (error: Error) => void; onStop?: () => void; sampleRate: number; }; export type SuperagentLiveVoiceAudioAdapters = { playAudioChunk?: (chunk: SuperagentLiveAudioChunk) => Promise | void; prepareAudioSession?: () => Promise | void; requestMicrophonePermission?: () => Promise | boolean; startAudioCapture: (input: SuperagentLiveAudioCaptureInput) => Promise | SuperagentLiveAudioCapture | void; stopAudioCapture?: () => Promise | void; stopAudioPlayback?: () => Promise | void; }; /** * Thin recorder passthrough for speech-to-text (dictation) — distinct from * `SuperagentLiveVoiceAudioAdapters` (streaming Live Voice). The host records a * clip and hands back a local file; the package uploads it and appends the * transcript to the composer. No metering in v1. `stopRecording` returns the * captured clip (native produces m4a/mp4). */ export type SuperagentVoiceRecorderAdapter = { requestMicrophonePermission?: () => Promise | boolean; startRecording: () => Promise; stopRecording: () => Promise<{ uri: string; mimeType?: string; name?: string; }>; cancelRecording?: () => Promise; getInputLevel?: () => number; }; export type SuperagentNativeRuntimeAdapters = { alert?: (title: string, message?: string) => void; completeExternalAuthCallback?: (url: string) => Promise; confirm?: (input: { confirmText?: string; destructive?: boolean; message?: string; title: string; }) => Promise | boolean; copyToClipboard?: (text: string) => Promise | void; createRealtimeSocket?: (input: SuperagentRealtimeSocketFactoryInput) => SuperagentRuntimeSocket | null | undefined; isAttachmentPickerCancel?: (error: unknown) => boolean; isExternalAuthCallbackUrl?: (url: string) => boolean; liveVoiceAudio?: SuperagentLiveVoiceAudioAdapters; voiceRecorder: SuperagentVoiceRecorderAdapter; onAgentMessageDone?: () => Promise | void; openUrl?: (url: string) => Promise | void; openWebUrl?: (url: string) => Promise | void; pickSandboxFiles?: () => Promise | SuperagentSandboxPickedFile[] | null | undefined; share?: (input: { message: string; title?: string; url?: string; }) => Promise | void; subscribeToAppResume?: (listener: () => void) => () => void; subscribeToDeepLinks?: (listener: (url: string) => void) => () => void; subscribeToExternalAuthCallbacks?: (listener: (event: SuperagentExternalAuthCallbackEvent) => void) => () => void; }; /** * The full native-adapter surface the host passes to `SuperagentHomeScreen`: the * runtime adapters above, plus the optional attachment-picker adapters. When * `attachments` is present the package drives file/photo/camera picking and renders * its own upload-status modal; when absent, those composer affordances are hidden. */ export type SuperagentShellAdapters = SuperagentNativeRuntimeAdapters & { attachments?: SuperagentAttachmentPickerAdapters; }; type UseSuperagentRuntimeParams = { session: SuperagentSessionConfig; user?: SuperagentUser | null; adapters: SuperagentShellAdapters; /** Opening route (seeds `currentRoute`). */ initialRoute?: SuperagentRoute; }; export declare function useSuperagentRuntime({ session, user, adapters: nativeAdapters, initialRoute, }: UseSuperagentRuntimeParams): { activeAgent: SuperagentAgent | null; activeAgentId: string | null; agents: SuperagentAgent[]; apiClient: import("./nativeClient").SuperagentNativeClient | undefined; availableConnectors: SuperagentConnector[]; automationCredits: Record; automationLoadError: string | null; automations: SuperagentAutomation[]; workflows: SuperagentWorkflow[]; workflowLoadError: string | null; isLoadingWorkflows: boolean; channelStatus: SuperagentChannelStatus; collaborators: SuperagentCollaborator[]; connectingChannelId: SuperagentChannelId | null; disconnectingChannelId: SuperagentChannelId | null; connectingConnectorId: string | null; connectedConnectors: SuperagentConnector[]; currentRoute: SuperagentRoute; initialRoute: SuperagentRoute; currentUserAvatarUrl: string | null; currentUserId: string | null; currentUserName: string | undefined; fileLoadError: string | null; fileLoadFailed: boolean; filePaths: string[]; isLoadingAgentSettings: boolean; isLoadingChannels: boolean; isLoadingCollaborators: boolean; isLoadingConnectors: boolean; isLoadingAutomations: boolean; isLoadingFiles: boolean; isLoading: boolean; isRefreshingAgents: boolean; onRefreshAgents: (options?: import("@tanstack/react-query").RefetchOptions) => Promise, Error>>; latestMessages: never[]; loadError: string | null; messagesByAgentId: {}; onAgentMessageDone: () => Promise; copyToClipboard: ((text: string) => Promise) | undefined; onCancelConnectorConnection: ({ agentId, connectorId }: { agentId: string; connectorId: string; }) => void; onArchiveAutomation: ({ agentId, automation }: SuperagentAutomationActionInput) => Promise; onCloneAgent: ({ agentId }: SuperagentAgentActionInput) => void; onConnectConnector: ({ accessMode, agentId, connectorId, forceReconnect, scopes, }: SuperagentConnectorActionInput) => Promise; onConnectSlack: ({ agentId }: SuperagentChannelActionInput) => Promise; onCreateAgent: () => Promise; onDeleteAgent: ({ agentId }: SuperagentAgentActionInput) => Promise; onDeleteAutomation: ({ agentId, automation }: SuperagentAutomationActionInput) => Promise; onDeleteSecret: ({ agentId, name }: SuperagentSecretDeleteInput) => Promise; onDisconnectConnector: ({ agentId, connectorId }: SuperagentConnectorActionInput) => Promise; onDisconnectIMessage: ({ agentId }: SuperagentChannelActionInput) => Promise; onDisconnectSlack: ({ agentId }: SuperagentChannelActionInput) => Promise; onDisconnectTelegram: ({ agentId }: SuperagentChannelActionInput) => Promise; onDisconnectWhatsApp: ({ agentId }: SuperagentChannelActionInput) => Promise; onEditAutomation: ({ agentId }: SuperagentAutomationActionInput) => void; onGenerateLineCode: ({ agentId }: SuperagentChannelActionInput) => Promise; onGenerateIMessageCode: ({ agentId }: SuperagentChannelActionInput) => Promise; onOpenIMessage: ({ code, phoneNumber }: SuperagentIMessageCodeShareInput) => Promise; onOpenLine: ({ url }: SuperagentChannelUrlActionInput) => Promise; onOpenAgent: (agentId: string) => void; onOpenTelegram: ({ url }: SuperagentChannelUrlActionInput) => Promise; onOpenWhatsApp: ({ agentId }: SuperagentChannelActionInput) => Promise; onOpenSandboxFile: ({ agentId, path }: SuperagentSandboxFileActionInput) => Promise; onOpenWorkspaceMembers: ({ organizationId }: SuperagentOpenWorkspaceMembersInput) => void; onRemoveConnector: ({ agentId, connectorId }: SuperagentConnectorActionInput) => Promise; onRenameAgent: (input: SuperagentRenameAgentInput) => Promise; onRefreshAgentSettings: (agentId: string) => Promise; onRefreshAutomations: (agentId: string) => Promise; onRefreshCollaborators: (agentId: string) => Promise; onRefreshChannels: (agentId: string) => Promise; onRefreshFiles: (agentId: string) => Promise; onRestoreAutomation: ({ agentId, automation }: SuperagentAutomationActionInput) => Promise; onRouteChange: (route: SuperagentRoute) => void; onRunAutomationNow: ({ agentId, automation }: SuperagentAutomationActionInput) => Promise; onToggleWorkflow: ({ agentId, workflow }: SuperagentWorkflowActionInput) => Promise; onArchiveWorkflow: ({ agentId, workflow }: SuperagentWorkflowActionInput) => Promise; onRestoreWorkflow: ({ agentId, workflow }: SuperagentWorkflowActionInput) => Promise; onRunWorkflowNow: ({ agentId, workflow }: SuperagentWorkflowActionInput) => Promise; onRefreshWorkflows: (agentId: string) => Promise; onSaveSandboxFile: ({ agentId, content, path }: SuperagentSandboxFileSaveInput) => Promise; onSaveSecret: ({ agentId, name, value }: SuperagentSecretSaveInput) => Promise; onShareAgent: ({ agentId, addAsGuest, emails }: SuperagentShareAgentInput) => Promise; onShareAgentLink: ({ agentId }: SuperagentAgentActionInput) => Promise; onShareIMessageCode: ({ code, phoneNumber }: SuperagentIMessageCodeShareInput) => Promise; onShareLineCode: ({ addFriendUrl, code }: SuperagentLineCodeShareInput) => Promise; onStartLiveVoice: SuperagentLiveVoiceInput | undefined; speechToText: import("./useSpeechToText").UseSpeechToTextResult; onSetupTelegram: ({ agentDisplayName, agentId, agentProfilePhotoUrl, }: SuperagentTelegramSetupInput) => Promise; onToggleAutomation: ({ agentId, automation }: SuperagentAutomationActionInput) => Promise; onUpdateAgentModel: (input: SuperagentModelUpdateInput) => Promise; onUpdateAgentAutomationModel: (input: SuperagentModelUpdateInput) => Promise; onUpdateToolPermissions: (input: SuperagentToolPermissionsUpdateInput) => Promise; onUploadSandboxFiles: ({ agentId }: SuperagentSandboxFileUploadInput) => Promise<{ path: string; }[]>; realtimeClient: SuperagentRealtimeClient | undefined; secrets: SuperagentSecret[]; }; export {}; //# sourceMappingURL=useSuperagentRuntime.d.ts.map