/**
* React Hooks for NeuroLink Client SDK
*
* Provides React hooks for interacting with NeuroLink agents, chat, workflows,
* and voice features. Compatible with React 18+ and follows React hooks best practices.
*
* @remarks
* This module requires React 18+ as a peer dependency. Install it with:
* ```bash
* npm install react react-dom
* # or
* pnpm add react react-dom
* ```
*
* @module @neurolink/react
*/
import type { ReactNode } from "react";
import type { NeuroLinkProviderProps, UseChatOptions, UseChatReturn, UseAgentOptions, UseAgentReturn, UseWorkflowOptions, UseWorkflowReturn, UseVoiceOptions, UseVoiceReturn, UseStreamOptions, UseStreamReturn, UseToolsOptions, UseToolsReturn, SpeechRecognitionInternal } from "../types/index.js";
import { NeuroLinkClient } from "./httpClient.js";
/**
* Provider component for NeuroLink client
*
* Wraps your application to provide the NeuroLink client to all hooks.
*
* @example
* ```tsx
* import { NeuroLinkProvider } from '@neurolink/react';
*
* function App() {
* return (
*
*
*
* );
* }
* ```
*/
export declare function NeuroLinkProvider({ config, children, }: NeuroLinkProviderProps & {
children: ReactNode;
}): ReactNode;
/**
* Hook to access the NeuroLink client
*
* Must be used within a NeuroLinkProvider.
*
* @throws Error if used outside of NeuroLinkProvider
*/
export declare function useNeuroLinkClient(): NeuroLinkClient;
/**
* React hook for chat interactions with NeuroLink agents
*
* Provides a chat interface with support for streaming responses,
* tool calls, and conversation history management.
*
* @example Basic usage
* ```tsx
* function ChatComponent() {
* const { messages, input, handleInputChange, handleSubmit, isLoading } = useChat({
* api: '/api/chat',
* agentId: 'my-agent',
* });
*
* return (
*
* {messages.map(m => (
*
* {m.content}
*
* ))}
*
*
* );
* }
* ```
*/
export declare function useChat(options?: UseChatOptions): UseChatReturn;
/**
* React hook for interacting with NeuroLink agents
*
* Provides methods for executing agents with both streaming
* and non-streaming responses, with session management.
*
* @example Basic usage
* ```tsx
* function AgentComponent() {
* const { execute, isLoading, result, error } = useAgent({
* agentId: 'my-agent',
* onResponse: (result) => console.log('Agent responded:', result),
* });
*
* return (
*
*
* {result &&
{result.content}
}
* {error &&
{error.message}
}
*
* );
* }
* ```
*/
export declare function useAgent(options: UseAgentOptions): UseAgentReturn;
/**
* React hook for executing NeuroLink workflows
*
* Provides methods for executing, resuming, and monitoring workflows
* with automatic status polling and suspension handling.
*
* @example Basic usage
* ```tsx
* function WorkflowComponent() {
* const { execute, status, result, isLoading, error } = useWorkflow({
* workflowId: 'data-processing-workflow',
* onComplete: (result) => console.log('Workflow completed:', result),
* onStepComplete: (step) => console.log('Step completed:', step.stepId),
* });
*
* return (
*
*
* {status &&
Status: {status}
}
* {result?.output &&
{JSON.stringify(result.output, null, 2)}}
*
* );
* }
* ```
*/
export declare function useWorkflow(options: UseWorkflowOptions): UseWorkflowReturn;
/**
* React hook for voice interactions with NeuroLink
*
* Provides voice input (speech recognition) and output (text-to-speech)
* capabilities with support for real-time conversation.
*
* @example Basic usage
* ```tsx
* function VoiceComponent() {
* const {
* startListening,
* stopListening,
* speak,
* isListening,
* isSpeaking,
* transcript,
* isSupported,
* } = useVoice({
* voice: 'en-US-Neural2-C',
* autoPlay: true,
* });
*
* if (!isSupported) {
* return Voice not supported in this browser
;
* }
*
* return (
*
*
*
Transcript: {transcript}
*
*
* );
* }
* ```
*/
export declare function useVoice(options?: UseVoiceOptions): UseVoiceReturn;
/**
* React hook for streaming responses from NeuroLink
*
* @example
* ```tsx
* function StreamComponent() {
* const { start, stop, text, isStreaming } = useStream({
* api: '/api/stream',
* });
*
* return (
*
*
*
*
{text}
*
* );
* }
* ```
*/
export declare function useStream(options?: UseStreamOptions): UseStreamReturn;
/**
* React hook for accessing and executing NeuroLink tools
*
* @example
* ```tsx
* function ToolsComponent() {
* const { tools, execute, isLoading, error } = useTools({
* category: 'data',
* });
*
* return (
*
* {tools.map(tool => (
*
*
{tool.name}
*
{tool.description}
*
*
* ))}
*
* );
* }
* ```
*/
export declare function useTools(options?: UseToolsOptions): UseToolsReturn;
declare global {
interface Window {
SpeechRecognition: {
new (): SpeechRecognitionInternal;
};
webkitSpeechRecognition: {
new (): SpeechRecognitionInternal;
};
}
}