






















@@ -288,39 +288,73 @@ describe("processMessage group system prompt wiring", () => {
288288289289expect(runMessageReceivedMock).toHaveBeenCalledTimes(1);
290290expect(runMessageReceivedMock).toHaveBeenCalledWith(
291-expect.objectContaining({
291+{
292292from: GROUP_JID,
293293content: "hi",
294294timestamp: 1710000000,
295+threadId: undefined,
295296messageId: "msg1",
296297senderId: "+15550002222",
297298sessionKey: baseRoute.sessionKey,
298-}),
299-expect.objectContaining({
299+runId: undefined,
300+metadata: {
301+to: "+15550001111",
302+provider: "whatsapp",
303+surface: "whatsapp",
304+threadId: undefined,
305+originatingChannel: "whatsapp",
306+originatingTo: GROUP_JID,
307+messageId: "msg1",
308+senderId: "+15550002222",
309+senderName: "Alice",
310+senderUsername: undefined,
311+senderE164: "+15550002222",
312+guildId: undefined,
313+channelName: undefined,
314+topicName: undefined,
315+},
316+},
317+{
300318channelId: "whatsapp",
301319accountId: "default",
302320conversationId: GROUP_JID,
303321sessionKey: baseRoute.sessionKey,
304322messageId: "msg1",
305323senderId: "+15550002222",
306-}),
307-);
308-expect(internalReceived).toHaveBeenCalledWith(
309-expect.objectContaining({
310-type: "message",
311-action: "received",
312-sessionKey: baseRoute.sessionKey,
313-context: expect.objectContaining({
314-from: GROUP_JID,
315-content: "hi",
316-timestamp: 1710000000,
317-channelId: "whatsapp",
318-accountId: "default",
319-conversationId: GROUP_JID,
320-messageId: "msg1",
321-}),
322-}),
324+},
323325);
326+expect(internalReceived).toHaveBeenCalledTimes(1);
327+const [internalEvent] = internalReceived.mock.calls[0] ?? [];
328+expect(internalEvent.timestamp).toBeInstanceOf(Date);
329+expect({ ...internalEvent, timestamp: undefined }).toEqual({
330+type: "message",
331+action: "received",
332+sessionKey: baseRoute.sessionKey,
333+context: {
334+from: GROUP_JID,
335+content: "hi",
336+timestamp: 1710000000,
337+channelId: "whatsapp",
338+accountId: "default",
339+conversationId: GROUP_JID,
340+messageId: "msg1",
341+metadata: {
342+to: "+15550001111",
343+provider: "whatsapp",
344+surface: "whatsapp",
345+threadId: undefined,
346+senderId: "+15550002222",
347+senderName: "Alice",
348+senderUsername: undefined,
349+senderE164: "+15550002222",
350+guildId: undefined,
351+channelName: undefined,
352+topicName: undefined,
353+},
354+},
355+timestamp: undefined,
356+messages: [],
357+});
324358});
325359326360it("does not fire WhatsApp message_received hooks without explicit opt-in", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。