fix: pass accountId to resolveAgentRoute for multi-account routing
The handler was calling resolveAgentRoute without accountId, causing all Matrix messages to route to the default agent regardless of which account received them. Changes: - Add accountId to MatrixMonitorHandlerParams type - Extract accountId in createMatrixRoomMessageHandler - Pass accountId to resolveAgentRoute call - Pass accountId from monitorMatrixProvider to handler
This commit is contained in:
parent
91f9010237
commit
2c653096eb
2 changed files with 5 additions and 0 deletions
|
|
@ -79,6 +79,8 @@ export type MatrixMonitorHandlerParams = {
|
|||
};
|
||||
getRoomInfo: (roomId: string) => Promise<{ name?: string; canonicalAlias?: string; altAliases: string[] }>;
|
||||
getMemberDisplayName: (roomId: string, userId: string) => Promise<string>;
|
||||
/** Account ID for multi-account routing */
|
||||
accountId?: string | null;
|
||||
};
|
||||
|
||||
export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParams) {
|
||||
|
|
@ -104,6 +106,7 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
|
|||
directTracker,
|
||||
getRoomInfo,
|
||||
getMemberDisplayName,
|
||||
accountId,
|
||||
} = params;
|
||||
|
||||
return async (roomId: string, event: MatrixRawEvent) => {
|
||||
|
|
@ -442,6 +445,7 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
|
|||
const route = core.channel.routing.resolveAgentRoute({
|
||||
cfg,
|
||||
channel: "matrix",
|
||||
accountId: accountId ?? undefined,
|
||||
peer: {
|
||||
kind: isDirectMessage ? "dm" : "channel",
|
||||
id: isDirectMessage ? senderId : roomId,
|
||||
|
|
|
|||
|
|
@ -223,6 +223,7 @@ export async function monitorMatrixProvider(opts: MonitorMatrixOpts = {}): Promi
|
|||
directTracker,
|
||||
getRoomInfo,
|
||||
getMemberDisplayName,
|
||||
accountId: opts.accountId,
|
||||
});
|
||||
|
||||
registerMatrixMonitorEvents({
|
||||
|
|
|
|||
Loading…
Reference in a new issue