MCPcopy Create free account
hub / github.com/agent-tower/core / getNotificationService

Function getNotificationService

packages/server/src/core/container.ts:72–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70}
71
72export function getNotificationService(): NotificationService {
73 if (!notificationService) {
74 notificationService = new NotificationService();
75
76 // 监听 task:updated,当任务进入 IN_REVIEW 时发送通知
77 getEventBus().on('task:updated', ({ taskId, status }) => {
78 if (status !== 'IN_REVIEW') return;
79 prisma.task.findUnique({
80 where: { id: taskId },
81 select: { title: true, projectId: true },
82 })
83 .then((task) => {
84 notificationService!.notify({
85 type: 'task_in_review',
86 title: 'Agent Tower', // 模板里会覆盖
87 body: '', // 模板里会覆盖
88 metadata: {
89 taskId,
90 taskTitle: task?.title ?? taskId,
91 projectId: task?.projectId ?? '',
92 },
93 });
94 })
95 .catch((err) => {
96 console.error('[NotificationService] Failed to fetch task for notification:', err);
97 });
98 });
99 }
100 return notificationService;
101}

Callers 2

notificationRoutesFunction · 0.85
initializeSocketFunction · 0.85

Calls 3

getEventBusFunction · 0.85
notifyMethod · 0.80
onMethod · 0.45

Tested by

no test coverage detected