@@ -20,17 +20,17 @@ import {
20
20
AgentRuntime ,
21
21
CacheManager ,
22
22
CacheStore ,
23
- Character ,
24
- Client ,
23
+ type Character ,
24
+ type Client ,
25
25
Clients ,
26
26
DbCacheAdapter ,
27
27
defaultCharacter ,
28
28
elizaLogger ,
29
29
FsCacheAdapter ,
30
- IAgentRuntime ,
31
- ICacheManager ,
32
- IDatabaseAdapter ,
33
- IDatabaseCacheAdapter ,
30
+ type IAgentRuntime ,
31
+ type ICacheManager ,
32
+ type IDatabaseAdapter ,
33
+ type IDatabaseCacheAdapter ,
34
34
ModelProviderName ,
35
35
parseBooleanFromText ,
36
36
settings ,
@@ -116,7 +116,7 @@ import yargs from "yargs";
116
116
const __filename = fileURLToPath ( import . meta. url ) ; // get the resolved path to the file
117
117
const __dirname = path . dirname ( __filename ) ; // get the name of the directory
118
118
119
- export const wait = ( minTime : number = 1000 , maxTime : number = 3000 ) => {
119
+ export const wait = ( minTime = 1000 , maxTime = 3000 ) => {
120
120
const waitTime =
121
121
Math . floor ( Math . random ( ) * ( maxTime - minTime + 1 ) ) + minTime ;
122
122
return new Promise ( ( resolve ) => setTimeout ( resolve , waitTime ) ) ;
@@ -300,7 +300,7 @@ async function loadCharacter(filePath: string): Promise<Character> {
300
300
if ( ! content ) {
301
301
throw new Error ( `Character file not found: ${ filePath } ` ) ;
302
302
}
303
- let character = JSON . parse ( content ) ;
303
+ const character = JSON . parse ( content ) ;
304
304
return jsonToCharacter ( filePath , character ) ;
305
305
}
306
306
@@ -311,7 +311,7 @@ function commaSeparatedStringToArray(commaSeparated: string): string[] {
311
311
export async function loadCharacters (
312
312
charactersArg : string
313
313
) : Promise < Character [ ] > {
314
- let characterPaths = commaSeparatedStringToArray ( charactersArg ) ;
314
+ const characterPaths = commaSeparatedStringToArray ( charactersArg ) ;
315
315
const loadedCharacters : Character [ ] = [ ] ;
316
316
317
317
if ( characterPaths ?. length > 0 ) {
@@ -385,7 +385,7 @@ export async function loadCharacters(
385
385
386
386
if ( hasValidRemoteUrls ( ) ) {
387
387
elizaLogger . info ( "Loading characters from remote URLs" ) ;
388
- let characterUrls = commaSeparatedStringToArray (
388
+ const characterUrls = commaSeparatedStringToArray (
389
389
process . env . REMOTE_CHARACTER_URLS
390
390
) ;
391
391
for ( const characterUrl of characterUrls ) {
@@ -1191,9 +1191,9 @@ const hasValidRemoteUrls = () =>
1191
1191
1192
1192
const startAgents = async ( ) => {
1193
1193
const directClient = new DirectClient ( ) ;
1194
- let serverPort = parseInt ( settings . SERVER_PORT || "3000" ) ;
1194
+ let serverPort = Number . parseInt ( settings . SERVER_PORT || "3000" ) ;
1195
1195
const args = parseArguments ( ) ;
1196
- let charactersArg = args . characters || args . character ;
1196
+ const charactersArg = args . characters || args . character ;
1197
1197
let characters = [ defaultCharacter ] ;
1198
1198
1199
1199
if ( process . env . IQ_WALLET_ADDRESS && process . env . IQSOlRPC ) {
@@ -1231,7 +1231,7 @@ const startAgents = async () => {
1231
1231
1232
1232
directClient . start ( serverPort ) ;
1233
1233
1234
- if ( serverPort !== parseInt ( settings . SERVER_PORT || "3000" ) ) {
1234
+ if ( serverPort !== Number . parseInt ( settings . SERVER_PORT || "3000" ) ) {
1235
1235
elizaLogger . log ( `Server started on alternate port ${ serverPort } ` ) ;
1236
1236
}
1237
1237
@@ -1251,12 +1251,12 @@ if (
1251
1251
parseBooleanFromText ( process . env . PREVENT_UNHANDLED_EXIT )
1252
1252
) {
1253
1253
// Handle uncaught exceptions to prevent the process from crashing
1254
- process . on ( "uncaughtException" , function ( err ) {
1254
+ process . on ( "uncaughtException" , ( err ) => {
1255
1255
console . error ( "uncaughtException" , err ) ;
1256
1256
} ) ;
1257
1257
1258
1258
// Handle unhandled rejections to prevent the process from crashing
1259
- process . on ( "unhandledRejection" , function ( err ) {
1259
+ process . on ( "unhandledRejection" , ( err ) => {
1260
1260
console . error ( "unhandledRejection" , err ) ;
1261
1261
} ) ;
1262
1262
}
0 commit comments