@@ -13,7 +13,7 @@ import { SlackClientInterface } from "@elizaos/client-slack";
13
13
import { TelegramClientInterface } from "@elizaos/client-telegram" ;
14
14
import { TwitterClientInterface } from "@elizaos/client-twitter" ;
15
15
// import { ReclaimAdapter } from "@elizaos/plugin-reclaim";
16
- import { elizaCodeinPlugin , onchainJson } from "@elizaos/plugin-iq6900" ;
16
+ // import { elizaCodeinPlugin, onchainJson } from "@elizaos/plugin-iq6900";
17
17
import { PrimusAdapter } from "@elizaos/plugin-primus" ;
18
18
19
19
import {
@@ -63,7 +63,7 @@ import {
63
63
tradePlugin ,
64
64
webhookPlugin ,
65
65
} from "@elizaos/plugin-coinbase" ;
66
- import { coingeckoPlugin } from "@elizaos/plugin-coingecko" ;
66
+ // import { coingeckoPlugin } from "@elizaos/plugin-coingecko";
67
67
import { coinmarketcapPlugin } from "@elizaos/plugin-coinmarketcap" ;
68
68
// import { confluxPlugin } from "@elizaos/plugin-conflux";
69
69
// import { cronosZkEVMPlugin } from "@elizaos/plugin-cronoszkevm";
@@ -86,15 +86,15 @@ import { openWeatherPlugin } from "@elizaos/plugin-open-weather";
86
86
import { quaiPlugin } from "@elizaos/plugin-quai" ;
87
87
import { sgxPlugin } from "@elizaos/plugin-sgx" ;
88
88
import { solanaPlugin } from "@elizaos/plugin-solana" ;
89
- import { solanaAgentkitPlugin } from "@elizaos/plugin-solana-agentkit " ;
89
+ // import { solanaAgentkitPlugin } from "@elizaos/plugin-solana-agent-kit ";
90
90
// import { squidRouterPlugin } from "@elizaos/plugin-squid-router";
91
91
import { dexScreenerPlugin } from "@elizaos/plugin-dexscreener" ;
92
92
import { echoChambersPlugin } from "@elizaos/plugin-echochambers" ;
93
93
import { giphyPlugin } from "@elizaos/plugin-giphy" ;
94
94
import { hyperliquidPlugin } from "@elizaos/plugin-hyperliquid" ;
95
95
import { injectivePlugin } from "@elizaos/plugin-injective" ;
96
96
import { letzAIPlugin } from "@elizaos/plugin-letzai" ;
97
- import { pythDataPlugin } from "@elizaos/plugin-pyth-data" ;
97
+ // import { pythDataPlugin } from "@elizaos/plugin-pyth-data";
98
98
import { stargazePlugin } from "@elizaos/plugin-stargaze" ;
99
99
import { storyPlugin } from "@elizaos/plugin-story" ;
100
100
import { suiPlugin } from "@elizaos/plugin-sui" ;
@@ -114,9 +114,9 @@ import net from "net";
114
114
import path from "path" ;
115
115
import { fileURLToPath } from "url" ;
116
116
import yargs from "yargs" ;
117
- import { cryptoNewsProvider } from "../providers/cryptoNewsProvider" ;
118
- import { cryptoPriceProvider } from "../providers/cryptoPriceProvider" ;
119
- import { timeProvider } from "../providers/timeProvider" ;
117
+ // import { cryptoNewsProvider } from "../providers/cryptoNewsProvider";
118
+ // import { cryptoPriceProvider } from "../providers/cryptoPriceProvider";
119
+ // import { timeProvider } from "../providers/timeProvider";
120
120
121
121
const __filename = fileURLToPath ( import . meta. url ) ; // get the resolved path to the file
122
122
const __dirname = path . dirname ( __filename ) ; // get the name of the directory
@@ -139,7 +139,7 @@ export function parseArguments(): {
139
139
characters ?: string ;
140
140
} {
141
141
try {
142
- return yargs ( process . argv . slice ( 3 ) )
142
+ const args = yargs ( process . argv . slice ( 2 ) )
143
143
. option ( "character" , {
144
144
type : "string" ,
145
145
description : "Path to the character JSON file" ,
@@ -150,6 +150,16 @@ export function parseArguments(): {
150
150
"Comma separated list of paths to character JSON files" ,
151
151
} )
152
152
. parseSync ( ) ;
153
+
154
+ // Handle the case where the value includes the equals sign
155
+ if ( args . character && args . character . startsWith ( "=" ) ) {
156
+ args . character = args . character . slice ( 1 ) ;
157
+ }
158
+ if ( args . characters && args . characters . startsWith ( "=" ) ) {
159
+ args . characters = args . characters . slice ( 1 ) ;
160
+ }
161
+
162
+ return args ;
153
163
} catch ( error ) {
154
164
elizaLogger . error ( "Error parsing arguments:" , error ) ;
155
165
return { } ;
@@ -195,64 +205,65 @@ function mergeCharacters(base: Character, child: Character): Character {
195
205
} ;
196
206
return mergeObjects ( base , child ) ;
197
207
}
198
- function isAllStrings ( arr : unknown [ ] ) : boolean {
199
- return Array . isArray ( arr ) && arr . every ( ( item ) => typeof item === "string" ) ;
200
- }
201
- export async function loadCharacterFromOnchain ( ) : Promise < Character [ ] > {
202
- const jsonText = onchainJson ;
203
-
204
- console . log ( "JSON:" , jsonText ) ;
205
- if ( ! jsonText ) return [ ] ;
206
- const loadedCharacters = [ ] ;
207
- try {
208
- const character = JSON . parse ( jsonText ) ;
209
- validateCharacterConfig ( character ) ;
210
-
211
- // .id isn't really valid
212
- const characterId = character . id || character . name ;
213
- const characterPrefix = `CHARACTER.${ characterId . toUpperCase ( ) . replace ( / / g, "_" ) } .` ;
214
-
215
- const characterSettings = Object . entries ( process . env )
216
- . filter ( ( [ key ] ) => key . startsWith ( characterPrefix ) )
217
- . reduce ( ( settings , [ key , value ] ) => {
218
- const settingKey = key . slice ( characterPrefix . length ) ;
219
- settings [ settingKey ] = value ;
220
- return settings ;
221
- } , { } ) ;
222
-
223
- if ( Object . keys ( characterSettings ) . length > 0 ) {
224
- character . settings = character . settings || { } ;
225
- character . settings . secrets = {
226
- ...characterSettings ,
227
- ...character . settings . secrets ,
228
- } ;
229
- }
230
-
231
- // Handle plugins
232
- if ( isAllStrings ( character . plugins ) ) {
233
- elizaLogger . info ( "Plugins are: " , character . plugins ) ;
234
- const importedPlugins = await Promise . all (
235
- character . plugins . map ( async ( plugin ) => {
236
- const importedPlugin = await import ( plugin ) ;
237
- return importedPlugin . default ;
238
- } )
239
- ) ;
240
- character . plugins = importedPlugins ;
241
- }
242
-
243
- loadedCharacters . push ( character ) ;
244
- elizaLogger . info (
245
- `Successfully loaded character from: ${ process . env . IQ_WALLET_ADDRESS } `
246
- ) ;
247
- return loadedCharacters ;
248
- } catch ( e ) {
249
- elizaLogger . error (
250
- `Error parsing character from ${ process . env . IQ_WALLET_ADDRESS } : ${ e } `
251
- ) ;
252
- process . exit ( 1 ) ;
253
- }
254
- }
255
-
208
+ // function isAllStrings(arr: unknown[]): boolean {
209
+ // return Array.isArray(arr) && arr.every((item) => typeof item === "string");
210
+ // }
211
+ // export async function loadCharacterFromOnchain(): Promise<Character[]> {
212
+ // const jsonText = onchainJson;
213
+
214
+ // console.log("JSON:", jsonText);
215
+ // if (!jsonText) return [];
216
+ // const loadedCharacters = [];
217
+ // try {
218
+ // const character = JSON.parse(jsonText);
219
+ // validateCharacterConfig(character);
220
+
221
+ // // .id isn't really valid
222
+ // const characterId = character.id || character.name;
223
+ // const characterPrefix = `CHARACTER.${characterId
224
+ // .toUpperCase()
225
+ // .replace(/ /g, "_") }.`;
226
+
227
+ // const characterSettings = Object.entries(process.env)
228
+ // .filter(([key]) => key.startsWith(characterPrefix))
229
+ // .reduce((settings, [key, value]) => {
230
+ // const settingKey = key.slice(characterPrefix.length);
231
+ // settings[settingKey] = value;
232
+ // return settings;
233
+ // }, {});
234
+
235
+ // if (Object.keys(characterSettings).length > 0) {
236
+ // character.settings = character.settings || {};
237
+ // character.settings.secrets = {
238
+ // ...characterSettings,
239
+ // ...character.settings.secrets,
240
+ // };
241
+ // }
242
+
243
+ // // Handle plugins
244
+ // if (isAllStrings(character.plugins)) {
245
+ // elizaLogger.info("Plugins are: ", character.plugins);
246
+ // const importedPlugins = await Promise.all(
247
+ // character.plugins.map(async (plugin) => {
248
+ // const importedPlugin = await import(plugin);
249
+ // return importedPlugin.default;
250
+ // })
251
+ // );
252
+ // character.plugins = importedPlugins;
253
+ // }
254
+
255
+ // loadedCharacters.push(character);
256
+ // elizaLogger.info(
257
+ // `Successfully loaded character from: ${process.env.IQ_WALLET_ADDRESS}`
258
+ // );
259
+ // return loadedCharacters;
260
+ // } catch (e) {
261
+ // elizaLogger.error(
262
+ // `Error parsing character from ${process.env.IQ_WALLET_ADDRESS}: ${e}`
263
+ // );
264
+ // process.exit(1);
265
+ // }
266
+ // }
256
267
257
268
async function loadCharactersFromUrl ( url : string ) : Promise < Character [ ] > {
258
269
try {
@@ -283,7 +294,9 @@ async function jsonToCharacter(
283
294
284
295
// .id isn't really valid
285
296
const characterId = character . id || character . name ;
286
- const characterPrefix = `CHARACTER.${ characterId . toUpperCase ( ) . replace ( / / g, "_" ) } .` ;
297
+ const characterPrefix = `CHARACTER.${ characterId
298
+ . toUpperCase ( )
299
+ . replace ( / / g, "_" ) } .`;
287
300
const characterSettings = Object . entries ( process . env )
288
301
. filter ( ( [ key ] ) => key . startsWith ( characterPrefix ) )
289
302
. reduce ( ( settings , [ key , value ] ) => {
@@ -393,8 +406,9 @@ export async function loadCharacters(
393
406
if ( characterPaths ?. length > 0 ) {
394
407
for ( const characterPath of characterPaths ) {
395
408
try {
396
- const character : Character =
397
- await loadCharacterTryPath ( characterPath ) ;
409
+ const character : Character = await loadCharacterTryPath (
410
+ characterPath
411
+ ) ;
398
412
loadedCharacters . push ( character ) ;
399
413
} catch ( e ) {
400
414
process . exit ( 1 ) ;
@@ -468,11 +482,11 @@ export function getTokenForProvider(
468
482
character . settings ?. secrets ?. OPENAI_API_KEY ||
469
483
settings . OPENAI_API_KEY
470
484
) ;
471
- case ModelProviderName . ETERNALAI :
472
- return (
473
- character . settings ?. secrets ?. ETERNALAI_API_KEY ||
474
- settings . ETERNALAI_API_KEY
475
- ) ;
485
+ // case ModelProviderName.ETERNALAI:
486
+ // return (
487
+ // character.settings?.secrets?.ETERNALAI_API_KEY ||
488
+ // settings.ETERNALAI_API_KEY
489
+ // );
476
490
case ModelProviderName . NINETEEN_AI :
477
491
return (
478
492
character . settings ?. secrets ?. NINETEEN_AI_API_KEY ||
@@ -884,10 +898,10 @@ export async function createAgent(
884
898
character,
885
899
// character.plugins are handled when clients are added
886
900
plugins : [
887
- getSecret ( character , "IQ_WALLET_ADDRESS" ) &&
888
- getSecret ( character , "IQSOlRPC" )
889
- ? elizaCodeinPlugin
890
- : null ,
901
+ // getSecret(character, "IQ_WALLET_ADDRESS") &&
902
+ // getSecret(character, "IQSOlRPC")
903
+ // ? elizaCodeinPlugin
904
+ // : null,
891
905
bootstrapPlugin ,
892
906
rabbiPlugin ,
893
907
getSecret ( character , "DEXSCREENER_API_KEY" )
@@ -903,9 +917,9 @@ export async function createAgent(
903
917
! getSecret ( character , "WALLET_PUBLIC_KEY" ) ?. startsWith ( "0x" ) )
904
918
? solanaPlugin
905
919
: null ,
906
- getSecret ( character , "SOLANA_PRIVATE_KEY" )
907
- ? solanaAgentkitPlugin
908
- : null ,
920
+ // getSecret(character, "SOLANA_PRIVATE_KEY")
921
+ // ? solanaAgentkitPlugin
922
+ // : null,
909
923
getSecret ( character , "AUTONOME_JWT_TOKEN" ) ? autonomePlugin : null ,
910
924
// (getSecret(character, "NEAR_ADDRESS") ||
911
925
// getSecret(character, "NEAR_WALLET_PUBLIC_KEY")) &&
@@ -978,10 +992,10 @@ export async function createAgent(
978
992
? webhookPlugin
979
993
: null ,
980
994
goatPlugin ,
981
- getSecret ( character , "COINGECKO_API_KEY" ) ||
982
- getSecret ( character , "COINGECKO_PRO_API_KEY" )
983
- ? coingeckoPlugin
984
- : null ,
995
+ // getSecret(character, "COINGECKO_API_KEY") ||
996
+ // getSecret(character, "COINGECKO_PRO_API_KEY")
997
+ // ? coingeckoPlugin
998
+ // : null,
985
999
getSecret ( character , "EVM_PROVIDER_URL" ) ? goatPlugin : null ,
986
1000
getSecret ( character , "ABSTRACT_PRIVATE_KEY" )
987
1001
? abstractPlugin
@@ -1061,12 +1075,12 @@ export async function createAgent(
1061
1075
getSecret ( character , "RESERVOIR_API_KEY" )
1062
1076
? createNFTCollectionsPlugin ( )
1063
1077
: null ,
1064
- getSecret ( character , "PYTH_TESTNET_PROGRAM_KEY" ) ||
1065
- getSecret ( character , "PYTH_MAINNET_PROGRAM_KEY" )
1066
- ? pythDataPlugin
1067
- : null ,
1078
+ // getSecret(character, "PYTH_TESTNET_PROGRAM_KEY") ||
1079
+ // getSecret(character, "PYTH_MAINNET_PROGRAM_KEY")
1080
+ // ? pythDataPlugin
1081
+ // : null,
1068
1082
] . filter ( Boolean ) ,
1069
- providers : [ timeProvider , cryptoPriceProvider , cryptoNewsProvider ] ,
1083
+ providers : [ ] ,
1070
1084
actions : [ ] ,
1071
1085
services : [ ] ,
1072
1086
managers : [ ] ,
@@ -1238,12 +1252,19 @@ const startAgents = async () => {
1238
1252
const charactersArg = args . characters || args . character ;
1239
1253
let characters = [ defaultCharacter ] ;
1240
1254
1241
- if ( process . env . IQ_WALLET_ADDRESS && process . env . IQSOlRPC ) {
1242
- characters = await loadCharacterFromOnchain ( ) ;
1243
- }
1255
+ elizaLogger . info ( "Loading character settings:" , {
1256
+ ARGV : process . argv ,
1257
+ CHARACTER_ARG : charactersArg ,
1258
+ CWD : process . cwd ( ) ,
1259
+ } ) ;
1244
1260
1245
- if ( ( ! onchainJson && charactersArg ) || hasValidRemoteUrls ( ) ) {
1246
- characters = await loadCharacters ( charactersArg ) ;
1261
+ if ( charactersArg ) {
1262
+ try {
1263
+ characters = await loadCharacters ( charactersArg ) ;
1264
+ } catch ( error ) {
1265
+ elizaLogger . error ( "Error loading characters:" , error ) ;
1266
+ process . exit ( 1 ) ;
1267
+ }
1247
1268
}
1248
1269
1249
1270
// Normalize characters for injectable plugins
0 commit comments