@@ -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 ,
@@ -117,7 +117,7 @@ import yargs from "yargs";
117
117
const __filename = fileURLToPath ( import . meta. url ) ; // get the resolved path to the file
118
118
const __dirname = path . dirname ( __filename ) ; // get the name of the directory
119
119
120
- export const wait = ( minTime : number = 1000 , maxTime : number = 3000 ) => {
120
+ export const wait = ( minTime = 1000 , maxTime = 3000 ) => {
121
121
const waitTime =
122
122
Math . floor ( Math . random ( ) * ( maxTime - minTime + 1 ) ) + minTime ;
123
123
return new Promise ( ( resolve ) => setTimeout ( resolve , waitTime ) ) ;
@@ -301,7 +301,7 @@ async function loadCharacter(filePath: string): Promise<Character> {
301
301
if ( ! content ) {
302
302
throw new Error ( `Character file not found: ${ filePath } ` ) ;
303
303
}
304
- let character = JSON . parse ( content ) ;
304
+ const character = JSON . parse ( content ) ;
305
305
return jsonToCharacter ( filePath , character ) ;
306
306
}
307
307
@@ -312,7 +312,7 @@ function commaSeparatedStringToArray(commaSeparated: string): string[] {
312
312
export async function loadCharacters (
313
313
charactersArg : string
314
314
) : Promise < Character [ ] > {
315
- let characterPaths = commaSeparatedStringToArray ( charactersArg ) ;
315
+ const characterPaths = commaSeparatedStringToArray ( charactersArg ) ;
316
316
const loadedCharacters : Character [ ] = [ ] ;
317
317
318
318
if ( characterPaths ?. length > 0 ) {
@@ -386,7 +386,7 @@ export async function loadCharacters(
386
386
387
387
if ( hasValidRemoteUrls ( ) ) {
388
388
elizaLogger . info ( "Loading characters from remote URLs" ) ;
389
- let characterUrls = commaSeparatedStringToArray (
389
+ const characterUrls = commaSeparatedStringToArray (
390
390
process . env . REMOTE_CHARACTER_URLS
391
391
) ;
392
392
for ( const characterUrl of characterUrls ) {
@@ -1192,9 +1192,9 @@ const hasValidRemoteUrls = () =>
1192
1192
1193
1193
const startAgents = async ( ) => {
1194
1194
const directClient = new DirectClient ( ) ;
1195
- let serverPort = parseInt ( settings . SERVER_PORT || "3000" ) ;
1195
+ let serverPort = Number . parseInt ( settings . SERVER_PORT || "3000" ) ;
1196
1196
const args = parseArguments ( ) ;
1197
- let charactersArg = args . characters || args . character ;
1197
+ const charactersArg = args . characters || args . character ;
1198
1198
let characters = [ defaultCharacter ] ;
1199
1199
1200
1200
if ( process . env . IQ_WALLET_ADDRESS && process . env . IQSOlRPC ) {
@@ -1235,7 +1235,7 @@ const startAgents = async () => {
1235
1235
1236
1236
directClient . start ( serverPort ) ;
1237
1237
1238
- if ( serverPort !== parseInt ( settings . SERVER_PORT || "3000" ) ) {
1238
+ if ( serverPort !== Number . parseInt ( settings . SERVER_PORT || "3000" ) ) {
1239
1239
elizaLogger . log ( `Server started on alternate port ${ serverPort } ` ) ;
1240
1240
}
1241
1241
@@ -1255,12 +1255,12 @@ if (
1255
1255
parseBooleanFromText ( process . env . PREVENT_UNHANDLED_EXIT )
1256
1256
) {
1257
1257
// Handle uncaught exceptions to prevent the process from crashing
1258
- process . on ( "uncaughtException" , function ( err ) {
1258
+ process . on ( "uncaughtException" , ( err ) => {
1259
1259
console . error ( "uncaughtException" , err ) ;
1260
1260
} ) ;
1261
1261
1262
1262
// Handle unhandled rejections to prevent the process from crashing
1263
- process . on ( "unhandledRejection" , function ( err ) {
1263
+ process . on ( "unhandledRejection" , ( err ) => {
1264
1264
console . error ( "unhandledRejection" , err ) ;
1265
1265
} ) ;
1266
1266
}
0 commit comments