Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 修复 prompt prediction 的 wake 空窗和远程会话 pendingTaskWake 泄漏
Shinkucb03265de56a
diff --git a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsxindex 0cb1a4317a..5e0fe58bda 100644--- a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx+++ b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx@@ -1154,7 +1154,7 @@ export function ChatInput({// 后台 wake 型任务(local_agent / local_workflow)仍在运行时,主 turn 报告// stopped 但会话仍在工作 —— 跳过预测,避免用不完整上下文发起付费调用。// hasBackgroundAgentWork 已在 _isSessionBusy 里统一折算,这里单独补门禁。- if (makerChatStore.hasRunningWakeTask(sessionId)) return;+ if (makerChatStore.hasBackgroundAgentWork(sessionId)) return;// 冷加载帧:runtimeAgentKind 尚未确认时就默认 claude-code,会将其他引擎的会话内容// 发给 Claude Code provider —— 跳过预测,等 agent 身份确认后再恢复。if (runtimeAgentKind == null) return;diff --git a/apps/desktop/src/renderer/hooks/useCCAgentChat.ts b/apps/desktop/src/renderer/hooks/useCCAgentChat.tsindex b64e40295a..b4faafc4ac 100644--- a/apps/desktop/src/renderer/hooks/useCCAgentChat.ts+++ b/apps/desktop/src/renderer/hooks/useCCAgentChat.ts@@ -55,6 +55,7 @@ import type { AttachedFile, MentionedResource } from '@/lib/fileTypes';import type { PastedTextRange, SlashCommandRange } from '@/lib/imageRef';import type { AgentInputReference } from '@cindy/maker-shared/agent-input-projection';import { createLogger } from '@/lib/logger';+import { isRemoteSession } from '@/lib/makerTransport';import type { UsageLimitRecoveryHint } from '@/lib/usageLimitRecovery';const log = createLogger('UseCCAgentChat');@@ -748,7 +749,10 @@ export function useCCAgentChat(lightState.isStreaming ||lightState.agentStatus.isRunning ||hasPendingSteer ||- lightState.pendingTaskWake ||+ // 远程会话豁免 pendingTaskWake:镜像事件有设计内的丢失窗口(断连/重连),+ // taskUpdates 不在 reconcile 对账覆盖内,终态 drop 后无自愈路径。与+ // makerChatStore.hasBackgroundAgentWork 的远程豁免同口径。+ (lightState.pendingTaskWake && sessionId && !isRemoteSession(sessionId)) ||(pendingQueueLength > 0 && !lightState.queuePaused);const setQueueExpanded = useCallback(diff --git a/apps/desktop/src/renderer/lib/makerChatStore.ts b/apps/desktop/src/renderer/lib/makerChatStore.tsindex 5a900dab7c..b7a30e4894 100644--- a/apps/desktop/src/renderer/lib/makerChatStore.ts+++ b/apps/desktop/src/renderer/lib/makerChatStore.ts@@ -13685,6 +13685,16 @@ export const makerChatStore = {if (!state) return false;return hasRunningWakeTask(state);},+ /**+ * 查询会话是否有本地后台 agent 工作(wake 任务在跑 / 唤醒桥接 pending)。+ * 远程会话豁免(镜像事件有丢失窗口,终态 drop 后无自愈路径)。+ * 与 hasBackgroundAgentWork 内部函数同口径,但暴露为公共 API。+ */+ hasBackgroundAgentWork: (sessionId: string): boolean => {+ const state = sessions.get(sessionId);+ if (!state) return false;+ return hasBackgroundAgentWork(sessionId, state);+ },mirrorSessionFields,/** F-SB-7: Subscribe to all session changes (for Sidebar running indicators). */subscribeAll,