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 P1 — 默认 provider 比对与 SSH 归属清理
Shinku9fdb0d670b53
diff --git a/apps/desktop/src/main/maker-ipc/promptPrediction.ts b/apps/desktop/src/main/maker-ipc/promptPrediction.tsindex 05b571c6fa..b0e02cf626 100644--- a/apps/desktop/src/main/maker-ipc/promptPrediction.ts+++ b/apps/desktop/src/main/maker-ipc/promptPrediction.ts@@ -18,7 +18,7 @@ import { dbToMakerAgentKind } from '../../shared/agentKindConversion.js';import { getResolvedMainLocale } from '../i18n.js';import { getDesktopProviderService } from '../maker-host/createDesktopProviderService.js';import { generateTitleViaProviderResult } from '../maker-host/title-one-shot.js';-import { connectedProvidersForAgent, type ProviderView } from '@cindy/model-providers';+import { connectedProvidersForAgent, nativeDefaultSourceId, type ProviderView } from '@cindy/model-providers';import { eq } from 'drizzle-orm';import { getDbClient } from '../localDb/client/current.js';import { sessions } from '../localDb/schema.js';@@ -245,7 +245,8 @@ export async function generatePromptPrediction(// 继续派发会外发到过期 provider/账号。重新计算当前有效默认 provider// 并与 resolvedProviderId 比对。const providers = await listConnectedProvidersForAgent(agentKind);- if (providers.length === 0 || providers[0].id !== resolvedProviderId) return false;+ const defaultProviderId = nativeDefaultSourceId(providers, agentKind);+ if (!defaultProviderId || defaultProviderId !== resolvedProviderId) return false;}// 紧前复查 workingDir:用户在 provider/凭证解析期间切换了工作目录,// 此时 buildPredictionPrompt 已嵌入旧 params.workingDir,继续派发diff --git a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsxindex fe856d9789..fc649c13b2 100644--- a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx+++ b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx@@ -3588,11 +3588,14 @@ export function ChatInput({const dlDeviceId = deviceLinkDeviceIdRef.current;const canPlaceHostCapability =!remoteHostIdRef.current && dlDeviceId === null;- // 归属未解析(deviceLinkDeviceId === undefined)时延后决定:不清除+ // 归属未解析(deviceLinkDeviceId === undefined)且非 SSH 时延后决定:不清除// pendingHostCapabilityGhostId,等归属解析后 effect 重跑。若此时清除,// 后续解析成本机也无法恢复芯片,Host 插件(如 iOS Simulator)的"使用"// handoff 会静默丢失。- if (dlDeviceId === undefined) {+ // SSH(remoteHostId 已解析)时:即使 dlDeviceId === undefined,SSH 会话+ // 永远无法放置 Host capability 芯片,直接清除 pendingHostCapabilityGhostId,+ // 避免残留芯片在后续依赖变化时延迟插入已失效的能力。+ if (dlDeviceId === undefined && !remoteHostIdRef.current) {return;}saveComposerDraft(