Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 修复 review 反馈——pendingTaskWake 纳入 isAgentBusy、turnGen 提前失效、one-shot 日志脱敏
Shinku5807edcae835
diff --git a/apps/desktop/src/main/maker-host/provider-one-shot.ts b/apps/desktop/src/main/maker-host/provider-one-shot.tsindex e82f2a0cb2..99aecc5ae6 100644--- a/apps/desktop/src/main/maker-host/provider-one-shot.ts+++ b/apps/desktop/src/main/maker-host/provider-one-shot.ts@@ -435,7 +435,7 @@ export async function runProviderOneShot(log.debug('oneShot args', {sessionId: args.sessionId,agentKind: args.agentKind,- prompt: args.prompt,+ promptLen: args.prompt.length,opts,});@@ -560,7 +560,7 @@ export async function runProviderOneShot(log.debug('oneShot request body (anthropic)', {model: toSdkModelString(target.model),maxTokens,- prompt: args.prompt,+ promptLen: args.prompt.length,});text = await fetchAnthropicTitle(target.upstream,@@ -585,7 +585,7 @@ export async function runProviderOneShot(model: target.model,effort: target.effort,instructions: codexInstructions,- prompt: args.prompt,+ promptLen: args.prompt.length,});text = await fetchCodexTitle(target.upstream,diff --git a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsxindex f479b4fa64..f7aa7ff911 100644--- a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx+++ b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx@@ -2372,7 +2372,7 @@ export function ChatInput({},},// Tick state on every update so triggerState below recomputes.-onUpdate: ({ editor: ed, transaction }) => {+ onUpdate: ({ editor: ed, transaction }) => {const syntheticRangeEnd = syntheticAtRangeEndRef.current;if (syntheticRangeEnd !== null && transaction.docChanged) {syntheticAtRangeEndRef.current = transaction.mapping.map(syntheticRangeEnd, 1);@@ -2383,7 +2383,6 @@ onUpdate: ({ editor: ed, transaction }) => {showRecommendationRef.current = false;setRecommendedPrompt(null);}- }if (!suppressListNormalizationRef.current &&!ed.view.composing &&@@ -4409,6 +4408,10 @@ onUpdate: ({ editor: ed, transaction }) => {if (!finishAgentSendDispatch) return;draftSaveSchedulerRef.current?.flush();dispatchSendInFlightRef.current = true;+ // 发送新消息时立即递增 turnGen,让任何还未落地的旧 turn 预测结果失效。+ // 必须在所有异步操作(resolveSessionMessageReferencesForSend / effort settle)+ // 之前递增,防止旧预测在 reference 解析等异步等待期间落地到输入框。+ turnGenRef.current += 1;// Local/SSH sends keep the live composer while references and runtime// settings settle; remote sends must stay editable after their// click-time snapshot is cleared.@@ -4887,11 +4890,6 @@ onUpdate: ({ editor: ed, transaction }) => {return;}}- // 发送新消息时立即递增 turnGen,让任何还未落地的旧 turn 预测结果失效。- // 必须在所有异步操作(effort settle / reference 解析)之前递增,防止- // device-link 乐观发送清空编辑器后、异步准备完成前旧预测写回输入框。- turnGenRef.current += 1;-let result: boolean | void;let effortForSend = activeEffort;try {diff --git a/apps/desktop/src/renderer/hooks/useCCAgentChat.ts b/apps/desktop/src/renderer/hooks/useCCAgentChat.tsindex 7907097f24..b64e40295a 100644--- a/apps/desktop/src/renderer/hooks/useCCAgentChat.ts+++ b/apps/desktop/src/renderer/hooks/useCCAgentChat.ts@@ -748,6 +748,7 @@ export function useCCAgentChat(lightState.isStreaming ||lightState.agentStatus.isRunning ||hasPendingSteer ||+ lightState.pendingTaskWake ||(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 fd6b4cba37..3ca863927b 100644--- a/apps/desktop/src/renderer/lib/makerChatStore.ts+++ b/apps/desktop/src/renderer/lib/makerChatStore.ts@@ -2547,6 +2547,7 @@ export type SessionChatLightState = Pick<| 'fastMode'| 'planModeEnabled'| 'agentSwitchIntent'+ | 'pendingTaskWake'>;function createInitialState(): SessionChatState {@@ -7652,6 +7653,7 @@ function selectLightState(state: SessionChatState): SessionChatLightState {queueExpanded: state.queueExpanded,fastMode: state.fastMode,planModeEnabled: state.planModeEnabled,+ pendingTaskWake: state.pendingTaskWake,};}@@ -7692,7 +7694,8 @@ function lightStateEquals(a: SessionChatLightState, b: SessionChatLightState): ba.queuePaused === b.queuePaused &&a.queueExpanded === b.queueExpanded &&a.fastMode === b.fastMode &&- a.planModeEnabled === b.planModeEnabled+ a.planModeEnabled === b.planModeEnabled &&+ a.pendingTaskWake === b.pendingTaskWake);}