@@ -17,14 +17,15 @@ import {
17
17
elizaLogger ,
18
18
FsCacheAdapter ,
19
19
IAgentRuntime ,
20
- ICacheManager ,
21
20
IDatabaseAdapter ,
22
21
IDatabaseCacheAdapter ,
23
22
ModelProviderName ,
24
23
settings ,
25
24
stringToUuid ,
26
25
validateCharacterConfig ,
27
26
CacheStore ,
27
+ Client ,
28
+ ICacheManager ,
28
29
} from "@elizaos/core" ;
29
30
import { RedisClient } from "@elizaos/adapter-redis" ;
30
31
import { zgPlugin } from "@elizaos/plugin-0g" ;
@@ -45,6 +46,7 @@ import { confluxPlugin } from "@elizaos/plugin-conflux";
45
46
import { evmPlugin } from "@elizaos/plugin-evm" ;
46
47
import { storyPlugin } from "@elizaos/plugin-story" ;
47
48
import { flowPlugin } from "@elizaos/plugin-flow" ;
49
+ import { fuelPlugin } from "@elizaos/plugin-fuel" ;
48
50
import { imageGenerationPlugin } from "@elizaos/plugin-image-generation" ;
49
51
import { ThreeDGenerationPlugin } from "@elizaos/plugin-3d-generation" ;
50
52
import { multiversxPlugin } from "@elizaos/plugin-multiversx" ;
@@ -58,6 +60,7 @@ import { tonPlugin } from "@elizaos/plugin-ton";
58
60
import { zksyncEraPlugin } from "@elizaos/plugin-zksync-era" ;
59
61
import { cronosZkEVMPlugin } from "@elizaos/plugin-cronoszkevm" ;
60
62
import { abstractPlugin } from "@elizaos/plugin-abstract" ;
63
+ import { avalanchePlugin } from "@elizaos/plugin-avalanche" ;
61
64
import Database from "better-sqlite3" ;
62
65
import fs from "fs" ;
63
66
import path from "path" ;
@@ -437,12 +440,32 @@ export async function initializeClients(
437
440
if ( slackClient ) clients . slack = slackClient ; // Use object property instead of push
438
441
}
439
442
443
+ function determineClientType ( client : Client ) : string {
444
+ // Check if client has a direct type identifier
445
+ if ( "type" in client ) {
446
+ return ( client as any ) . type ;
447
+ }
448
+
449
+ // Check constructor name
450
+ const constructorName = client . constructor ?. name ;
451
+ if ( constructorName && ! constructorName . includes ( "Object" ) ) {
452
+ return constructorName . toLowerCase ( ) . replace ( "client" , "" ) ;
453
+ }
454
+
455
+ // Fallback: Generate a unique identifier
456
+ return `client_${ Date . now ( ) } ` ;
457
+ }
458
+
440
459
if ( character . plugins ?. length > 0 ) {
441
460
for ( const plugin of character . plugins ) {
442
461
if ( plugin . clients ) {
443
462
for ( const client of plugin . clients ) {
444
463
const startedClient = await client . start ( runtime ) ;
445
- clients [ client . name ] = startedClient ; // Assuming client has a name property
464
+ const clientType = determineClientType ( client ) ;
465
+ elizaLogger . debug (
466
+ `Initializing client of type: ${ clientType } `
467
+ ) ;
468
+ clients [ clientType ] = startedClient ;
446
469
}
447
470
}
448
471
}
@@ -534,7 +557,8 @@ export async function createAgent(
534
557
getSecret ( character , "FAL_API_KEY" ) ||
535
558
getSecret ( character , "OPENAI_API_KEY" ) ||
536
559
getSecret ( character , "VENICE_API_KEY" ) ||
537
- getSecret ( character , "HEURIST_API_KEY" )
560
+ getSecret ( character , "HEURIST_API_KEY" ) ||
561
+ getSecret ( character , "LIVEPEER_GATEWAY_URL" )
538
562
? imageGenerationPlugin
539
563
: null ,
540
564
getSecret ( character , "FAL_API_KEY" ) ? ThreeDGenerationPlugin : null ,
@@ -572,6 +596,10 @@ export async function createAgent(
572
596
getSecret ( character , "TON_PRIVATE_KEY" ) ? tonPlugin : null ,
573
597
getSecret ( character , "SUI_PRIVATE_KEY" ) ? suiPlugin : null ,
574
598
getSecret ( character , "STORY_PRIVATE_KEY" ) ? storyPlugin : null ,
599
+ getSecret ( character , "FUEL_PRIVATE_KEY" ) ? fuelPlugin : null ,
600
+ getSecret ( character , "AVALANCHE_PRIVATE_KEY" )
601
+ ? avalanchePlugin
602
+ : null ,
575
603
] . filter ( Boolean ) ,
576
604
providers : [ ] ,
577
605
actions : [ ] ,
0 commit comments