@@ -63,6 +63,7 @@ import { flowPlugin } from "@elizaos/plugin-flow";
63
63
import { fuelPlugin } from "@elizaos/plugin-fuel" ;
64
64
import { genLayerPlugin } from "@elizaos/plugin-genlayer" ;
65
65
import { imageGenerationPlugin } from "@elizaos/plugin-image-generation" ;
66
+ import { lensPlugin } from "@elizaos/plugin-lensNetwork" ;
66
67
import { multiversxPlugin } from "@elizaos/plugin-multiversx" ;
67
68
import { nearPlugin } from "@elizaos/plugin-near" ;
68
69
import { nftGenerationPlugin } from "@elizaos/plugin-nft-generation" ;
@@ -71,6 +72,7 @@ import { obsidianPlugin } from "@elizaos/plugin-obsidian";
71
72
import { sgxPlugin } from "@elizaos/plugin-sgx" ;
72
73
import { solanaPlugin } from "@elizaos/plugin-solana" ;
73
74
import { solanaAgentkitPlguin } from "@elizaos/plugin-solana-agentkit" ;
75
+ import { autonomePlugin } from "@elizaos/plugin-autonome" ;
74
76
import { storyPlugin } from "@elizaos/plugin-story" ;
75
77
import { suiPlugin } from "@elizaos/plugin-sui" ;
76
78
import { TEEMode , teePlugin } from "@elizaos/plugin-tee" ;
@@ -79,7 +81,6 @@ import { teeMarlinPlugin } from "@elizaos/plugin-tee-marlin";
79
81
import { tonPlugin } from "@elizaos/plugin-ton" ;
80
82
import { webSearchPlugin } from "@elizaos/plugin-web-search" ;
81
83
82
- import { coingeckoPlugin } from "@elizaos/plugin-coingecko" ;
83
84
import { giphyPlugin } from "@elizaos/plugin-giphy" ;
84
85
import { letzAIPlugin } from "@elizaos/plugin-letzai" ;
85
86
import { thirdwebPlugin } from "@elizaos/plugin-thirdweb" ;
@@ -89,6 +90,7 @@ import { zksyncEraPlugin } from "@elizaos/plugin-zksync-era";
89
90
import { OpacityAdapter } from "@elizaos/plugin-opacity" ;
90
91
import { openWeatherPlugin } from "@elizaos/plugin-open-weather" ;
91
92
import { stargazePlugin } from "@elizaos/plugin-stargaze" ;
93
+ import { akashPlugin } from "@elizaos/plugin-akash" ;
92
94
import Database from "better-sqlite3" ;
93
95
import fs from "fs" ;
94
96
import net from "net" ;
@@ -142,10 +144,6 @@ function tryLoadFile(filePath: string): string | null {
142
144
}
143
145
}
144
146
145
- function isAllStrings ( arr : unknown [ ] ) : boolean {
146
- return Array . isArray ( arr ) && arr . every ( ( item ) => typeof item === "string" ) ;
147
- }
148
-
149
147
export async function loadCharacters (
150
148
charactersArg : string
151
149
) : Promise < Character [ ] > {
@@ -231,16 +229,9 @@ export async function loadCharacters(
231
229
}
232
230
233
231
// Handle plugins
234
- if ( isAllStrings ( character . plugins ) ) {
235
- elizaLogger . info ( "Plugins are: " , character . plugins ) ;
236
- const importedPlugins = await Promise . all (
237
- character . plugins . map ( async ( plugin ) => {
238
- const importedPlugin = await import ( plugin ) ;
239
- return importedPlugin . default ;
240
- } )
241
- ) ;
242
- character . plugins = importedPlugins ;
243
- }
232
+ character . plugins = await handlePluginImporting (
233
+ character . plugins
234
+ ) ;
244
235
245
236
loadedCharacters . push ( character ) ;
246
237
elizaLogger . info (
@@ -263,6 +254,36 @@ export async function loadCharacters(
263
254
return loadedCharacters ;
264
255
}
265
256
257
+ async function handlePluginImporting ( plugins : string [ ] ) {
258
+ if ( plugins . length > 0 ) {
259
+ elizaLogger . info ( "Plugins are: " , plugins ) ;
260
+ const importedPlugins = await Promise . all (
261
+ plugins . map ( async ( plugin ) => {
262
+ try {
263
+ const importedPlugin = await import ( plugin ) ;
264
+ const functionName =
265
+ plugin
266
+ . replace ( "@elizaos/plugin-" , "" )
267
+ . replace ( / - ./ g, ( x ) => x [ 1 ] . toUpperCase ( ) ) +
268
+ "Plugin" ; // Assumes plugin function is camelCased with Plugin suffix
269
+ return (
270
+ importedPlugin . default || importedPlugin [ functionName ]
271
+ ) ;
272
+ } catch ( importError ) {
273
+ elizaLogger . error (
274
+ `Failed to import plugin: ${ plugin } ` ,
275
+ importError
276
+ ) ;
277
+ return [ ] ; // Return null for failed imports
278
+ }
279
+ } )
280
+ ) ;
281
+ return importedPlugins ;
282
+ } else {
283
+ return [ ] ;
284
+ }
285
+ }
286
+
266
287
export function getTokenForProvider (
267
288
provider : ModelProviderName ,
268
289
character : Character
@@ -618,6 +639,7 @@ export async function createAgent(
618
639
getSecret ( character , "SOLANA_PRIVATE_KEY" )
619
640
? solanaAgentkitPlguin
620
641
: null ,
642
+ getSecret ( character , "AUTONOME_JWT_TOKEN" ) ? autonomePlugin : null ,
621
643
( getSecret ( character , "NEAR_ADDRESS" ) ||
622
644
getSecret ( character , "NEAR_WALLET_PUBLIC_KEY" ) ) &&
623
645
getSecret ( character , "NEAR_WALLET_SECRET_KEY" )
@@ -681,8 +703,8 @@ export async function createAgent(
681
703
goatPlugin ,
682
704
getSecret ( character , "COINGECKO_API_KEY" ) ||
683
705
getSecret ( character , "COINGECKO_PRO_API_KEY" )
684
- ? coingeckoPlugin
685
- : null ,
706
+ ? coingeckoPlugin
707
+ : null ,
686
708
getSecret ( character , "EVM_PROVIDER_URL" ) ? goatPlugin : null ,
687
709
getSecret ( character , "ABSTRACT_PRIVATE_KEY" )
688
710
? abstractPlugin
@@ -695,6 +717,10 @@ export async function createAgent(
695
717
getSecret ( character , "FLOW_PRIVATE_KEY" )
696
718
? flowPlugin
697
719
: null ,
720
+ getSecret ( character , "LENS_ADDRESS" ) &&
721
+ getSecret ( character , "LENS_PRIVATE_KEY" )
722
+ ? lensPlugin
723
+ : null ,
698
724
getSecret ( character , "APTOS_PRIVATE_KEY" ) ? aptosPlugin : null ,
699
725
getSecret ( character , "MVX_PRIVATE_KEY" ) ? multiversxPlugin : null ,
700
726
getSecret ( character , "ZKSYNC_PRIVATE_KEY" ) ? zksyncEraPlugin : null ,
@@ -732,6 +758,10 @@ export async function createAgent(
732
758
? artheraPlugin
733
759
: null ,
734
760
getSecret ( character , "ALLORA_API_KEY" ) ? alloraPlugin : null ,
761
+ getSecret ( character , "AKASH_MNEMONIC" ) &&
762
+ getSecret ( character , "AKASH_WALLET_ADDRESS" )
763
+ ? akashPlugin
764
+ : null ,
735
765
] . filter ( Boolean ) ,
736
766
providers : [ ] ,
737
767
actions : [ ] ,
@@ -921,7 +951,10 @@ const startAgents = async () => {
921
951
}
922
952
923
953
// upload some agent functionality into directClient
924
- directClient . startAgent = async ( character : Character ) => {
954
+ directClient . startAgent = async ( character ) => {
955
+ // Handle plugins
956
+ character . plugins = await handlePluginImporting ( character . plugins ) ;
957
+
925
958
// wrap it so we don't have to inject directClient later
926
959
return startAgent ( character , directClient ) ;
927
960
} ;
0 commit comments