File tree 5 files changed +19
-5
lines changed
5 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -59,10 +59,13 @@ export class AgentServer {
59
59
) ;
60
60
61
61
// Initialize the database
62
- this . database . init ( ) ;
63
-
64
- // Initialize server components - will handle agent disabling
65
- this . initializeServer ( options ) ;
62
+ this . database . init ( ) . then ( ( ) => {
63
+ logger . success ( "Database initialized successfully" ) ;
64
+ this . initializeServer ( options ) ;
65
+ } ) . catch ( ( error ) => {
66
+ logger . error ( "Failed to initialize database:" , error ) ;
67
+ throw error ;
68
+ } ) ;
66
69
} catch ( error ) {
67
70
logger . error ( "Failed to initialize AgentServer:" , error ) ;
68
71
throw error ;
Original file line number Diff line number Diff line change 1
- { "version" : " 1.0.0-alpha.2" }
1
+ {"version" : " 1.0.0-alpha.2" }
Original file line number Diff line number Diff line change @@ -27,6 +27,12 @@ export abstract class DatabaseAdapter<DB = unknown>
27
27
*/
28
28
db : DB ;
29
29
30
+ /**
31
+ * Initialize the database adapter.
32
+ * @returns A Promise that resolves when initialization is complete.
33
+ */
34
+ abstract init ( ) : Promise < void > ;
35
+
30
36
/**
31
37
* Optional close method for the database adapter.
32
38
* @returns A Promise that resolves when closing is complete.
Original file line number Diff line number Diff line change @@ -221,6 +221,8 @@ export class AgentRuntime implements IAgentRuntime {
221
221
async initialize ( ) {
222
222
// First create the agent entity directly
223
223
try {
224
+ await this . getDatabaseAdapter ( ) . init ( ) ;
225
+
224
226
await this . getDatabaseAdapter ( ) . ensureAgentExists (
225
227
this . character as Partial < Agent > ,
226
228
) ;
Original file line number Diff line number Diff line change @@ -704,6 +704,9 @@ export interface IDatabaseAdapter {
704
704
/** Database instance */
705
705
db : any ;
706
706
707
+ /** Initialize database connection */
708
+ init ( ) : Promise < void > ;
709
+
707
710
/** Close database connection */
708
711
close ( ) : Promise < void > ;
709
712
You can’t perform that action at this time.
0 commit comments