Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(review): 静音也要挡住代输入与桌面确认的 IM 旁路提示
WZBbiaoda5685baf77b
diff --git a/apps/desktop/src/main/im/__tests__/desktopConfirmNotice.test.ts b/apps/desktop/src/main/im/__tests__/desktopConfirmNotice.test.tsindex 66d0e8ff17..b771992e74 100644--- a/apps/desktop/src/main/im/__tests__/desktopConfirmNotice.test.ts+++ b/apps/desktop/src/main/im/__tests__/desktopConfirmNotice.test.ts@@ -43,6 +43,27 @@ describe('createDesktopConfirmNotifier', () => {expect(send).not.toHaveBeenCalled();});+ it('「消息免打扰」任务 → 连 IM 提示也不发,连 openId 都不查(卡仍在桌面)', async () => {+ const send = vi.fn(async () => ({}));+ const getFeishuOpenId = vi.fn(async () => 'ou_123');+ const notify = createDesktopConfirmNotifier({+ getFeishuOpenId,+ sendFeishuText: send,+ isSuppressed: (sessionId) => sessionId === 'muted',+ });+ notify('muted', '「提交 GitHub issue」的确认卡');+ // 代输入指引走同一个工厂:同一条静音判定一起管。+ notify('muted', '任务名');+ await flush();+ expect(send).not.toHaveBeenCalled();+ expect(getFeishuOpenId).not.toHaveBeenCalled();++ // 同一次装配里未静音的任务不受影响。+ notify('loud', '「提交 GitHub issue」的确认卡');+ await flush();+ expect(send).toHaveBeenCalledOnce();+ });+it('查询/发送失败 → 只落 warn,不抛出(不影响确认流程)', async () => {const warn = vi.fn();const notify = createDesktopConfirmNotifier({diff --git a/apps/desktop/src/main/im/desktopConfirmNotice.ts b/apps/desktop/src/main/im/desktopConfirmNotice.tsindex 4aedfd6fba..92d3ed85c9 100644--- a/apps/desktop/src/main/im/desktopConfirmNotice.ts+++ b/apps/desktop/src/main/im/desktopConfirmNotice.ts@@ -18,6 +18,11 @@ export interface DesktopConfirmNoticeDeps {/** 会话绑定的飞书 openId;非飞书会话返回 null(桌面本来就是唯一交互面)。 */getFeishuOpenId(sessionId: string): Promise<string | null>;sendFeishuText(openId: string, markdown: string): Promise<unknown>;+ /**+ * 该任务开了「消息免打扰」→ IM 侧提示也不发,与 toast / 灵动岛 / 手机推送+ * 同一口径。桌面卡片本身不受影响:提示是提醒,卡片是交互面。+ */+ isSuppressed?(sessionId: string): boolean;logWarn?(message: string): void;}@@ -65,6 +70,7 @@ export function createDesktopConfirmNotifier(buildText: (what: string) => string = buildDesktopConfirmNoticeText,): (sessionId: string, what: string) => void {return (sessionId, what) => {+ if (deps.isSuppressed?.(sessionId)) return;void (async () => {try {const openId = await deps.getFeishuOpenId(sessionId);diff --git a/apps/desktop/src/main/im/desktopConfirmNoticeWiring.ts b/apps/desktop/src/main/im/desktopConfirmNoticeWiring.tsindex eaef002fa9..e1f74ec156 100644--- a/apps/desktop/src/main/im/desktopConfirmNoticeWiring.ts+++ b/apps/desktop/src/main/im/desktopConfirmNoticeWiring.ts@@ -14,6 +14,7 @@ import { eq } from 'drizzle-orm';import { createLogger } from '../logger.js';import { getDbClient } from '../localDb/client/current.js';import { sessions } from '../localDb/schema.js';+import { isSessionNotificationsMutedSync } from '../localDb/sessionFlagRegistry.js';import { bindingStore } from './binding.js';import { feishuIm } from './host.js';import {@@ -28,6 +29,9 @@ export function createFeishuDesktopConfirmNotifier(buildText?: (what: string) => string,): (sessionId: string, what: string) => void {return createDesktopConfirmNotifier({+ // 「消息免打扰」任务不发 IM 提示(桌面确认卡 / 代输入指引都不发);提示属于+ // 提醒面,与 notificationService / device-link / scheduler-host 的四道门同口径。+ isSuppressed: (sessionId) => isSessionNotificationsMutedSync(sessionId),async getFeishuOpenId(sessionId) {return resolveFeishuNoticeTarget({diff --git a/apps/desktop/src/main/maker-ipc/register.ts b/apps/desktop/src/main/maker-ipc/register.tsindex cb414b0e2f..c8758f9833 100644--- a/apps/desktop/src/main/maker-ipc/register.ts+++ b/apps/desktop/src/main/maker-ipc/register.ts@@ -3009,6 +3009,9 @@ const inputHandoffImNotifier = createFeishuDesktopConfirmNotifier(buildInputHand* copy: no screen contents, no purpose text, never a value.*/function notifyInputHandoffOwner(sessionId: string, snapshot: InputHandoffSnapshot): void {+ // 「消息免打扰」任务不提醒主人:这一行的 IM 指引(渠道内一行 / 飞书兜底)与+ // 手机推送都不发。推送侧另有同一道门,这里同时收掉 IM 一侧。+ if (isSessionNotificationsMutedSync(sessionId)) return;const generation = getMobileNotifyGeneration();void (async () => {try {