feat: persist session origin metadata across connectors

This commit is contained in:
Peter Steinberger
2026-01-18 02:41:06 +00:00
parent 0c93b9b7bb
commit 34590d2144
30 changed files with 246 additions and 66 deletions

View File

@@ -7,6 +7,7 @@ import {
} from "../../../src/auto-reply/command-detection.js";
import { finalizeInboundContext } from "../../../src/auto-reply/reply/inbound-context.js";
import { resolveCommandAuthorizedFromAuthorizers } from "../../../src/channels/command-gating.js";
import { recordSessionMetaFromInbound, resolveStorePath } from "../../../src/config/sessions.js";
import {
ZaloApiError,
deleteWebhook,
@@ -552,6 +553,17 @@ async function processMessageWithPipeline(params: {
OriginatingTo: `zalo:${chatId}`,
});
const storePath = resolveStorePath(config.session?.store, {
agentId: route.agentId,
});
void recordSessionMetaFromInbound({
storePath,
sessionKey: ctxPayload.SessionKey ?? route.sessionKey,
ctx: ctxPayload,
}).catch((err) => {
runtime.error?.(`zalo: failed updating session meta: ${String(err)}`);
});
await deps.dispatchReplyWithBufferedBlockDispatcher({
ctx: ctxPayload,
cfg: config,