Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

merge: 同步 main(08d178868c)

WZBbiao4a019c1890aa
diff --cc apps/desktop/src/main/__tests__/notificationService.test.ts
index b9bd55b213,026ac5e009..08f62e2194
--- a/apps/desktop/src/main/__tests__/notificationService.test.ts
+++ b/apps/desktop/src/main/__tests__/notificationService.test.ts
@@@ -159,10 -161,9 +167,10 @@@ async function freshService()
ownerScopeCurrent = true;
ownerScopeKey = 'account-a:1';
markSessionNeedsAttention.mockClear();
+ isSessionNotificationsMutedSync.mockReset().mockReturnValue(false);
sendMobileSessionNotify.mockReset().mockReturnValue(true);
getMobileNotifyGeneration.mockClear();
- latestMessageText.mockClear();
+ latestMessageText.mockReset().mockResolvedValue('');
readSessionNotificationPreview.mockReset().mockImplementation(async (sessionId, includeReply = true) => {
if (!includeReply) return {};
const text = await latestMessageText(sessionId, 'assistant');
diff --cc apps/desktop/src/main/notificationService.ts
index ae7fafcac0,712373f009..15cd6aeada
--- a/apps/desktop/src/main/notificationService.ts
+++ b/apps/desktop/src/main/notificationService.ts
@@@ -29,7 -29,9 +29,10 @@@ import * as path from 'node:path'
import { markSessionNeedsAttention } from './appBadgeService';
import { getMobileNotifyGeneration, sendMobileSessionNotify } from './device-link';
import { notificationPreview } from './notificationPreview';
+ import { companionAvatarThumbnail } from './agent-island/companionIdentity';
+ import { getDeepLinkMainWindow, openMainWindowChatMessage } from './deepLink';
+import { isSessionNotificationsMutedSync } from './localDb/sessionFlagRegistry';
+ import type { ChatMessageNotification } from './maker-ipc/chatMessageNotifications';
import { readSessionNotificationPreview, type SessionNotificationPreview } from './localDb/sessionNotificationPreview';
import { drainSessionActiveTurnWrites, getSessionNotificationTurnSignal } from './localDb/sessionActiveTurn';
import { captureDataOwnerBroadcastScope, isDataOwnerBroadcastScopeCurrent } from './device-link/broadcast-tap';
@@@ -174,14 -214,9 +215,14 @@@ export function showDesktopSessionEvent
},
): boolean {
const { sessionId, title, kind } = payload;
- if (sessionId && payload.markAttention !== false) markSessionNeedsAttention(sessionId);
+ const isLocalSession = !!sessionId && payload.markAttention !== false;
+ if (isLocalSession) markSessionNeedsAttention(sessionId);
+ // 「消息免打扰」门放在这个**公共出口**上:scheduler、伙伴自主跟进等 main 内
+ // 直接调用方都不经过 IPC handler 的那道判定,只挡 handler 会漏出系统 toast。
+ // 其它设备的任务(markAttention === false)不查本机静音标记。
+ if (isLocalSession && isSessionNotificationsMutedSync(sessionId)) return false;
const safeTitle = title?.trim() || sessionId.slice(0, 8) || getSessionNotificationUntitled();
- return showDesktopToast(safeTitle, kind, () => focusWindow(getWindow, sessionId), payload.body, payload.teammate);
+ return showDesktopToast(safeTitle, kind, () => focusWindow(getWindow, sessionId), payload.body, payload.teammate, payload.avatarJpeg);
}
/**
@@@ -244,14 -279,7 +285,10 @@@ export function initNotificationService
const wantDesktop = channels?.desktop ?? true;
const wantFeishu = channels?.feishu === true;
if (markAttention) markSessionNeedsAttention(sessionId);
+ // 「消息免打扰」任务不再走任何外向提醒通道(系统 toast / 灵动岛 / 手机 / 飞书);
+ // 未读与角标已在上一行照常记账,任务内的提醒不受影响。
+ if (isSessionNotificationsMutedSync(sessionId)) return;
- // Action/error desktop notices have no transcript preview and must be immediate.
- if (wantDesktop && kind !== 'done') {
- showDesktopSessionEvent(getWindow, { sessionId, title: safeTitle, kind, markAttention });
- }
// Content is read from main's transcript. Bound only enrichment, not delivery;
// a timeout is not a dedupe window and never causes a second late toast.
void (async () => {