feat(routing): route replies to originating channel
Implement reply routing based on OriginatingChannel/OriginatingTo fields. This ensures replies go back to the provider where the message originated instead of using the session's lastChannel. Changes: - Add OriginatingChannel/OriginatingTo fields to MsgContext (templating.ts) - Add originatingChannel/originatingTo fields to FollowupRun (queue.ts) - Create route-reply.ts with provider-agnostic router - Update all providers (Telegram, Slack, Discord, Signal, iMessage) to pass originating channel info - Update reply.ts to pass originating channel to followupRun - Update followup-runner.ts to use route-reply for originating channels This addresses the issue where messages from one provider (e.g., Slack) would receive replies on a different provider (e.g., Telegram) because the queue used the last active dispatcher instead of the originating one.
This commit is contained in:
committed by
Peter Steinberger
parent
514fcfe77e
commit
9d50ebad7d
@@ -351,10 +351,11 @@ export async function monitorIMessageProvider(
|
||||
: normalizeIMessageHandle(sender),
|
||||
},
|
||||
});
|
||||
const imessageTo = chatTarget || `imessage:${sender}`;
|
||||
const ctxPayload = {
|
||||
Body: body,
|
||||
From: isGroup ? `group:${chatId}` : `imessage:${sender}`,
|
||||
To: chatTarget || `imessage:${sender}`,
|
||||
To: imessageTo,
|
||||
SessionKey: route.sessionKey,
|
||||
AccountId: route.accountId,
|
||||
ChatType: isGroup ? "group" : "direct",
|
||||
@@ -372,6 +373,9 @@ export async function monitorIMessageProvider(
|
||||
MediaUrl: mediaPath,
|
||||
WasMentioned: mentioned,
|
||||
CommandAuthorized: commandAuthorized,
|
||||
// Originating channel for reply routing.
|
||||
OriginatingChannel: "imessage" as const,
|
||||
OriginatingTo: imessageTo,
|
||||
};
|
||||
|
||||
if (!isGroup) {
|
||||
|
||||
Reference in New Issue
Block a user