@@ -78,6 +78,8 @@ let acpBindingRuntimePromise:
7878let sessionBindingRuntimePromise :
7979 | Promise < typeof import ( "openclaw/plugin-sdk/session-binding-runtime" ) >
8080 | undefined ;
81+ let matrixReactionEventsPromise : Promise < typeof import ( "./reaction-events.js" ) > | undefined ;
82+ let matrixDraftStreamPromise : Promise < typeof import ( "../draft-stream.js" ) > | undefined ;
8183
8284function loadMatrixSendModule ( ) : Promise < typeof import ( "../send.js" ) > {
8385 matrixSendModulePromise ??= import ( "../send.js" ) ;
@@ -97,6 +99,17 @@ function loadSessionBindingRuntime(): Promise<
9799 sessionBindingRuntimePromise ??= import ( "openclaw/plugin-sdk/session-binding-runtime" ) ;
98100 return sessionBindingRuntimePromise ;
99101}
102+
103+ function loadMatrixReactionEvents ( ) : Promise < typeof import ( "./reaction-events.js" ) > {
104+ matrixReactionEventsPromise ??= import ( "./reaction-events.js" ) ;
105+ return matrixReactionEventsPromise ;
106+ }
107+
108+ function loadMatrixDraftStream ( ) : Promise < typeof import ( "../draft-stream.js" ) > {
109+ matrixDraftStreamPromise ??= import ( "../draft-stream.js" ) ;
110+ return matrixDraftStreamPromise ;
111+ }
112+
100113const MAX_TRACKED_PAIRING_REPLY_SENDERS = 512 ;
101114const MAX_TRACKED_SHARED_DM_CONTEXT_NOTICES = 512 ;
102115type MatrixAllowBotsMode = "off" | "mentions" | "all" ;
@@ -739,7 +752,7 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
739752
740753 if ( isReactionEvent ) {
741754 const senderName = await getSenderName ( ) ;
742- const { handleInboundMatrixReaction } = await import ( "./reaction-events.js" ) ;
755+ const { handleInboundMatrixReaction } = await loadMatrixReactionEvents ( ) ;
743756 await handleInboundMatrixReaction ( {
744757 client,
745758 core,
@@ -1366,7 +1379,7 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
13661379 const quietDraftStreaming = streaming === "quiet" ;
13671380 const draftReplyToId = replyToMode !== "off" && ! threadTarget ? _messageId : undefined ;
13681381 const draftStream : MatrixDraftStreamHandle | undefined = draftStreamingEnabled
1369- ? await import ( "../draft-stream.js" ) . then ( ( { createMatrixDraftStream } ) =>
1382+ ? await loadMatrixDraftStream ( ) . then ( ( { createMatrixDraftStream } ) =>
13701383 createMatrixDraftStream ( {
13711384 roomId,
13721385 client,
0 commit comments