feat(messages): also derive responsePrefix from identity.name

When identity.name is configured and responsePrefix is not explicitly set,
automatically default responsePrefix to [identity.name].

This means users only need to set their identity once:
  { identity: { name: "MyBot" } }

And outbound messages will automatically be prefixed with [MyBot].
This commit is contained in:
Richard Poelderl
2026-01-09 16:06:02 +01:00
committed by Peter Steinberger
parent 8112b276c0
commit 43848b7b43
3 changed files with 48 additions and 3 deletions

View File

@@ -1170,9 +1170,15 @@ export async function monitorWebProvider(
const textLimit = resolveTextChunkLimit(cfg, "whatsapp");
let didLogHeartbeatStrip = false;
let didSendReply = false;
// Derive responsePrefix from identity.name if not explicitly set
const responsePrefix =
cfg.messages?.responsePrefix ??
(cfg.identity?.name?.trim()
? `[${cfg.identity.name.trim()}]`
: undefined);
const { dispatcher, replyOptions, markDispatchIdle } =
createReplyDispatcherWithTyping({
responsePrefix: cfg.messages?.responsePrefix,
responsePrefix,
onHeartbeatStrip: () => {
if (!didLogHeartbeatStrip) {
didLogHeartbeatStrip = true;