@@ -28,6 +28,7 @@ export function useAgents(): SWRResponse<Agent[]> {
2828 company . agents . map ( ( agent ) => ( {
2929 ...agent ,
3030 companyName : company . name ,
31+ settings : [ ] , // Add empty settings array to match Agent type
3132 } ) ) ,
3233 ) || [ ] ,
3334 { fallbackData : [ ] } ,
@@ -45,6 +46,7 @@ export function useAgent(
4546 agent : Agent | null ;
4647 commands : string [ ] ;
4748 settings : any [ ] ;
49+ extensions : any [ ] ;
4850} > {
4951 const getDefaultAgent = ( ) => {
5052 const primaryCompany = companies . find ( ( c ) => c . primary ) ;
@@ -67,18 +69,18 @@ export function useAgent(
6769 if ( ! searchName && companies ?. length ) {
6870 foundEarly = getDefaultAgent ( ) ;
6971 }
70- const swrHook = useSWR < { agent : Agent | null ; commands : string [ ] ; settings : any [ ] } > (
72+ const swrHook = useSWR < { agent : Agent | null ; commands : string [ ] ; settings : any [ ] ; extensions : any [ ] } > (
7173 [ `/agent?name=${ searchName } ` , companies , withSettings ] ,
72- async ( ) : Promise < { agent : Agent | null ; commands : string [ ] ; settings : any [ ] } > => {
74+ async ( ) : Promise < { agent : Agent | null ; commands : string [ ] ; settings : any [ ] ; extensions : any [ ] } > => {
7375 try {
7476 if ( withSettings ) {
7577 const client = createGraphQLClient ( ) ;
7678 const query = AgentSchema . toGQL ( 'query' , 'GetAgent' , { name : searchName } ) ;
7779 const response = await client . request < { agent : Agent } > ( query , { name : searchName } ) ;
7880 const agent = AgentSchema . parse ( response . agent ) ;
79- return { agent, commands : [ ] , settings : [ ] } ;
81+ return { agent, commands : [ ] , settings : [ ] , extensions : [ ] } ;
8082 } else {
81- const toReturn = { agent : foundEarly , commands : [ ] , settings : [ ] } ;
83+ const toReturn = { agent : foundEarly , commands : [ ] , settings : [ ] , extensions : [ ] } ;
8284 if ( companies ?. length && ! toReturn . agent ) {
8385 for ( const company of companies ) {
8486 const agent = company . agents . find ( ( a ) => a . name === searchName ) ;
@@ -91,7 +93,7 @@ export function useAgent(
9193 toReturn . agent = getDefaultAgent ( ) ;
9294 }
9395 if ( toReturn . agent ) {
94- toReturn . settings = (
96+ toReturn . extensions = (
9597 await axios . get ( `${ process . env . NEXT_PUBLIC_AGIXT_SERVER } /api/agent/${ toReturn . agent . name } /extensions` , {
9698 headers : {
9799 Authorization : getCookie ( 'jwt' ) ,
@@ -105,10 +107,10 @@ export function useAgent(
105107 }
106108 } catch ( error ) {
107109 console . error ( 'Error fetching agent:' , error ) ;
108- return { agent : null , commands : [ ] , settings : [ ] } ;
110+ return { agent : null , commands : [ ] , settings : [ ] , extensions : [ ] } ;
109111 }
110112 } ,
111- { fallbackData : { agent : null , commands : [ ] , settings : [ ] } } ,
113+ { fallbackData : { agent : null , commands : [ ] , settings : [ ] , extensions : [ ] } } ,
112114 ) ;
113115 const originalMutate = swrHook . mutate ;
114116 swrHook . mutate = chainMutations ( companiesHook , originalMutate ) ;
0 commit comments