fix: deduplicate desktop notifications and tighten notification text extraction

Desktop notifications no longer duplicate when native delivery succeeds
Reasoning chain-of-thought is excluded from notification body text
Untyped message parts are ignored in notification text extraction
This commit is contained in:
Bohdan Triapitsyn
2026-06-16 15:21:27 +03:00
parent 6ea8fb357d
commit 91de51d1a5
7 changed files with 144 additions and 46 deletions
@@ -279,8 +279,8 @@ export const createNotificationTriggerRuntime = (deps) => {
directory: notificationDirectory,
requireHidden: settings.notificationMode !== 'always',
};
emitDesktopNotification(notificationPayload);
broadcastUiNotification(notificationPayload);
const desktopNotificationDelivered = emitDesktopNotification(notificationPayload);
broadcastUiNotification(notificationPayload, { desktopNotificationDelivered });
}
await sendPushToAllUiSessions(
@@ -341,8 +341,8 @@ export const createNotificationTriggerRuntime = (deps) => {
directory: notificationDirectory,
requireHidden: settings.notificationMode !== 'always',
};
emitDesktopNotification(notificationPayload);
broadcastUiNotification(notificationPayload);
const desktopNotificationDelivered = emitDesktopNotification(notificationPayload);
broadcastUiNotification(notificationPayload, { desktopNotificationDelivered });
}
await sendPushToAllUiSessions(
@@ -408,7 +408,7 @@ export const createNotificationTriggerRuntime = (deps) => {
}
if (settings.nativeNotificationsEnabled) {
emitDesktopNotification({
const notificationPayload = {
kind: 'question',
title,
body,
@@ -416,17 +416,9 @@ export const createNotificationTriggerRuntime = (deps) => {
sessionId,
directory: notificationDirectory,
requireHidden: settings.notificationMode !== 'always',
});
broadcastUiNotification({
kind: 'question',
title,
body,
tag: `question-${sessionId}`,
sessionId,
directory: notificationDirectory,
requireHidden: settings.notificationMode !== 'always',
});
};
const desktopNotificationDelivered = emitDesktopNotification(notificationPayload);
broadcastUiNotification(notificationPayload, { desktopNotificationDelivered });
}
void sendPushToAllUiSessions(
@@ -530,7 +522,7 @@ export const createNotificationTriggerRuntime = (deps) => {
}
if (settings.nativeNotificationsEnabled) {
emitDesktopNotification({
const notificationPayload = {
kind: 'permission',
title,
body,
@@ -538,17 +530,9 @@ export const createNotificationTriggerRuntime = (deps) => {
sessionId,
directory: notificationDirectory,
requireHidden: settings.notificationMode !== 'always',
});
broadcastUiNotification({
kind: 'permission',
title,
body,
tag: requestKey ? `permission-${requestKey}` : `permission-${sessionId}`,
sessionId,
directory: notificationDirectory,
requireHidden: settings.notificationMode !== 'always',
});
};
const desktopNotificationDelivered = emitDesktopNotification(notificationPayload);
broadcastUiNotification(notificationPayload, { desktopNotificationDelivered });
}
if (requestKey) {