fix(FN-3886): resolve peer agent names in mail and notifications
- Resolve participant display names in AgentDetailView mail tab for peer agents - Update MailboxModal labeling to use readable agent names instead of raw IDs - Propagate resolved agent names through notification service, notifier, and provider payloads - Add and update dashboard/engine tests plus a changeset for @runfusion/fusion Fusion-Task-Id: FN-3886
This commit is contained in:
@@ -76,7 +76,14 @@ describe("WebhookNotificationProvider", () => {
|
||||
taskId: "FN-1",
|
||||
taskTitle: "My Task",
|
||||
event: "message:agent-to-user",
|
||||
metadata: { messageId: "msg-1", fromId: "agent-1", toId: "user:dashboard", preview: "hello" },
|
||||
metadata: {
|
||||
messageId: "msg-1",
|
||||
fromId: "agent-1",
|
||||
toId: "user:dashboard",
|
||||
fromName: "Triage Bot",
|
||||
toName: "Dashboard User",
|
||||
preview: "hello",
|
||||
},
|
||||
});
|
||||
|
||||
const [, requestInit] = fetchMock.mock.calls[0] as [string, RequestInit];
|
||||
@@ -84,7 +91,15 @@ describe("WebhookNotificationProvider", () => {
|
||||
expect(payload.event).toBe("message:agent-to-user");
|
||||
expect(payload.timestamp).toEqual(expect.any(String));
|
||||
expect(payload.task).toEqual({ id: "FN-1", title: "My Task" });
|
||||
expect(payload.metadata).toEqual(expect.objectContaining({ messageId: "msg-1" }));
|
||||
expect(payload.metadata).toEqual(
|
||||
expect.objectContaining({
|
||||
messageId: "msg-1",
|
||||
fromId: "agent-1",
|
||||
toId: "user:dashboard",
|
||||
fromName: "Triage Bot",
|
||||
toName: "Dashboard User",
|
||||
}),
|
||||
);
|
||||
expect(payload.clickUrl).toBe("http://dash/?project=p1&task=FN-1#message-msg-1");
|
||||
});
|
||||
|
||||
@@ -150,14 +165,19 @@ describe("WebhookNotificationProvider", () => {
|
||||
["planning-awaiting-input", "is awaiting your input during planning"],
|
||||
["gridlock", "Pipeline gridlocked"],
|
||||
["fallback-used", "Fusion recovered by switching from"],
|
||||
["message:agent-to-user", 'Event "message:agent-to-user" for task My Task'],
|
||||
["message:agent-to-agent", 'Event "message:agent-to-agent" for task My Task'],
|
||||
["message:agent-to-user", "From: Triage Bot → You: hello"],
|
||||
["message:agent-to-agent", "From: Triage Bot → To: Executor Bot: hello"],
|
||||
["unknown-event", 'Event "unknown-event" for task My Task'],
|
||||
])("message formatting for %s", async (event, expectedPart) => {
|
||||
fetchMock.mockResolvedValue({ ok: true, status: 200, statusText: "OK" });
|
||||
await provider.initialize({ webhookUrl: "https://example.com/hook", webhookFormat: "slack" });
|
||||
|
||||
await provider.sendNotification(event, { taskId: "FN-1", taskTitle: "My Task", event });
|
||||
await provider.sendNotification(event, {
|
||||
taskId: "FN-1",
|
||||
taskTitle: "My Task",
|
||||
event,
|
||||
metadata: { fromId: "agent-1", toId: "agent-2", fromName: "Triage Bot", toName: "Executor Bot", preview: "hello" },
|
||||
});
|
||||
|
||||
const [, requestInit] = fetchMock.mock.calls[0] as [string, RequestInit];
|
||||
const body = JSON.parse(String(requestInit.body));
|
||||
|
||||
Reference in New Issue
Block a user