11import { useState , useEffect , useCallback , useRef } from 'react' ;
2- import LayercodeClient from '@layercode/js-sdk' ;
2+ import LayercodeClient , { type AgentConfig } from '@layercode/js-sdk' ;
33
44/**
55 * Configuration options for the useLayercodeAgent hook.
@@ -9,7 +9,7 @@ interface UseLayercodeAgentOptions {
99 conversationId ?: string ;
1010 authorizeSessionEndpoint : string ;
1111 metadata ?: Record < string , any > ;
12- onConnect ?: ( { conversationId } : { conversationId : string | null } ) => void ;
12+ onConnect ?: ( { conversationId, config } : { conversationId : string | null ; config ?: AgentConfig } ) => void ;
1313 onDisconnect ?: ( ) => void ;
1414 onError ?: ( error : Error ) => void ;
1515 onDataMessage ?: ( data : any ) => void ;
@@ -57,14 +57,14 @@ const useLayercodeAgent = (
5757 conversationId : initialConversationId ,
5858 authorizeSessionEndpoint,
5959 metadata,
60- onConnect : ( { conversationId } : { conversationId : string | null } ) => {
60+ onConnect : ( { conversationId, config } : { conversationId : string | null ; config ?: AgentConfig } ) => {
6161 setInternalConversationId ( ( current ) => {
6262 if ( conversationIdRef . current === undefined ) {
6363 return conversationId ;
6464 }
6565 return conversationId ?? current ?? null ;
6666 } ) ;
67- onConnect ?.( { conversationId } ) ;
67+ onConnect ?.( { conversationId, config } ) ;
6868 } ,
6969 onDisconnect : ( ) => {
7070 onDisconnect ?.( ) ;
0 commit comments