@@ -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 ) ) ;
@@ -315,7 +315,7 @@ async function loadCharacter(filePath: string): Promise<Character> {
315
315
if ( ! content ) {
316
316
throw new Error ( `Character file not found: ${ filePath } ` ) ;
317
317
}
318
- let character = JSON . parse ( content ) ;
318
+ const character = JSON . parse ( content ) ;
319
319
return jsonToCharacter ( filePath , character ) ;
320
320
}
321
321
@@ -326,7 +326,7 @@ function commaSeparatedStringToArray(commaSeparated: string): string[] {
326
326
export async function loadCharacters (
327
327
charactersArg : string
328
328
) : Promise < Character [ ] > {
329
- let characterPaths = commaSeparatedStringToArray ( charactersArg ) ;
329
+ const characterPaths = commaSeparatedStringToArray ( charactersArg ) ;
330
330
const loadedCharacters : Character [ ] = [ ] ;
331
331
332
332
if ( characterPaths ?. length > 0 ) {
@@ -400,7 +400,7 @@ export async function loadCharacters(
400
400
401
401
if ( hasValidRemoteUrls ( ) ) {
402
402
elizaLogger . info ( "Loading characters from remote URLs" ) ;
403
- let characterUrls = commaSeparatedStringToArray (
403
+ const characterUrls = commaSeparatedStringToArray (
404
404
process . env . REMOTE_CHARACTER_URLS
405
405
) ;
406
406
for ( const characterUrl of characterUrls ) {
@@ -1206,9 +1206,9 @@ const hasValidRemoteUrls = () =>
1206
1206
1207
1207
const startAgents = async ( ) => {
1208
1208
const directClient = new DirectClient ( ) ;
1209
- let serverPort = parseInt ( settings . SERVER_PORT || "3000" ) ;
1209
+ let serverPort = Number . parseInt ( settings . SERVER_PORT || "3000" ) ;
1210
1210
const args = parseArguments ( ) ;
1211
- let charactersArg = args . characters || args . character ;
1211
+ const charactersArg = args . characters || args . character ;
1212
1212
let characters = [ defaultCharacter ] ;
1213
1213
1214
1214
if ( process . env . IQ_WALLET_ADDRESS && process . env . IQSOlRPC ) {
@@ -1246,7 +1246,7 @@ const startAgents = async () => {
1246
1246
1247
1247
directClient . start ( serverPort ) ;
1248
1248
1249
- if ( serverPort !== parseInt ( settings . SERVER_PORT || "3000" ) ) {
1249
+ if ( serverPort !== Number . parseInt ( settings . SERVER_PORT || "3000" ) ) {
1250
1250
elizaLogger . log ( `Server started on alternate port ${ serverPort } ` ) ;
1251
1251
}
1252
1252
@@ -1266,12 +1266,12 @@ if (
1266
1266
parseBooleanFromText ( process . env . PREVENT_UNHANDLED_EXIT )
1267
1267
) {
1268
1268
// Handle uncaught exceptions to prevent the process from crashing
1269
- process . on ( "uncaughtException" , function ( err ) {
1269
+ process . on ( "uncaughtException" , ( err ) => {
1270
1270
console . error ( "uncaughtException" , err ) ;
1271
1271
} ) ;
1272
1272
1273
1273
// Handle unhandled rejections to prevent the process from crashing
1274
- process . on ( "unhandledRejection" , function ( err ) {
1274
+ process . on ( "unhandledRejection" , ( err ) => {
1275
1275
console . error ( "unhandledRejection" , err ) ;
1276
1276
} ) ;
1277
1277
}
0 commit comments