fix(auto-reply): prevent sender spoofing in group prompts

This commit is contained in:
Peter Steinberger
2026-02-10 00:35:56 -06:00
parent 8ff1618bfc
commit 53273b490b
42 changed files with 405 additions and 243 deletions

View File

@@ -549,8 +549,18 @@ export async function monitorIMessageProvider(opts: MonitorIMessageOpts = {}): P
}
const imessageTo = (isGroup ? chatTarget : undefined) || `imessage:${sender}`;
const inboundHistory =
isGroup && historyKey && historyLimit > 0
? (groupHistories.get(historyKey) ?? []).map((entry) => ({
sender: entry.sender,
body: entry.body,
timestamp: entry.timestamp,
}))
: undefined;
const ctxPayload = finalizeInboundContext({
Body: combinedBody,
BodyForAgent: bodyText,
InboundHistory: inboundHistory,
RawBody: bodyText,
CommandBody: bodyText,
From: isGroup ? `imessage:group:${chatId ?? "unknown"}` : `imessage:${sender}`,