diff --git a/apps/desktop/src/main/localDb/client/tx/types.ts b/apps/desktop/src/main/localDb/client/tx/types.ts index dfc1c34bc33..b1fc647c34f 100644 --- a/apps/desktop/src/main/localDb/client/tx/types.ts +++ b/apps/desktop/src/main/localDb/client/tx/types.ts @@ -683,6 +683,8 @@ export interface BotsUpdateProfileArgs { inactiveCindyIds?: string[]; /** A saved model choice supersedes automation restores in the same commit. */ clearScheduledModelBaseline?: boolean; + /** A selected plugin primary cannot be applied to an active local canonical Lead. */ + rejectPluginPrimaryForLocalLead?: boolean; /** Explicit settings changes also update the permanent chat in this transaction. */ canonicalPermissionMode?: 'ask' | 'auto' | 'bypassPermissions'; displayName?: string; diff --git a/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts b/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts index 1b2426b458d..56aaad4f5cc 100644 --- a/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts +++ b/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts @@ -5724,6 +5724,45 @@ describe('Teammate model selection shares profile persistence and route reconcil id: JSON.stringify(['pi', 'xd', model.id]), model }; } + // #12276, DB tier. Use the settings IPC with a built-in canonical session + // and an ACP primary. Before the fix the save advanced the profile version, + // even though the ordinary session switch could never apply it to the Lead. + it('rejects a plugin primary for a local canonical Lead and accepts a built-in recovery', async () => { + const { sessionId } = await setupModelControl(); + const getProfile = () => invoke('local-db:bots:get', 'bot-1'); + const save = (modelChainOverride: BotModelRoute[]) => + invoke('local-db:bots:update', { id: 'bot-1', capabilities: { modelChainOverride } }); + const setLead = (role: 'lead' | null) => + h.sqlite!.prepare('UPDATE sessions SET orca_role = ? WHERE id = ?').run(role, sessionId); + const plugin: BotModelRoute = { + harness: 'acp', providerId: 'acp-plugin:fixture:echo', model: 'default', effort: '', fastMode: false, + }; + const before = await getProfile(); + const [builtIn] = before.capabilities.modelChain as BotModelRoute[]; + if (!builtIn || builtIn.harness === 'acp') throw new Error('Expected a built-in fixture route'); + setLead('lead'); + h.requestRuntimeRefresh.mockClear(); + await expect(save([plugin, builtIn])).rejects.toThrow('BOT_LEAD_PLUGIN_ENGINE_UNSUPPORTED'); + const rejected = await getProfile(); + expect(rejected.currentVersion).toBe(before.currentVersion); + expect(rejected.capabilities.modelChain).toEqual(before.capabilities.modelChain); + expect(h.requestRuntimeRefresh).not.toHaveBeenCalled(); + + await expect(save([builtIn, plugin])).resolves.toMatchObject({ + capabilities: { modelChain: [builtIn, plugin] }, + }); + setLead(null); + await expect(save([plugin, builtIn])).resolves.toMatchObject({ + capabilities: { modelChain: [plugin, builtIn] }, + }); + // Simulate a profile saved by an older build while the actual session kept its built-in route. + setLead('lead'); + await expect(save([builtIn])).resolves.toMatchObject({ + canonicalSessionId: sessionId, + capabilities: { modelChain: [builtIn] }, + }); + }); + // #7177, DB tier: an explicit same-value tool selection must reach the // acceptance transaction; a plain metadata edit must retain the old scope. it('reaccepts the same model through the teammate tool without treating a rename as recovery', async () => { diff --git a/apps/desktop/src/main/localDb/ipc/bots.ts b/apps/desktop/src/main/localDb/ipc/bots.ts index 2eda8b3b0a0..fe51cb60c90 100644 --- a/apps/desktop/src/main/localDb/ipc/bots.ts +++ b/apps/desktop/src/main/localDb/ipc/bots.ts @@ -2219,6 +2219,7 @@ export async function updateBotProfile(raw: unknown, expectedVersion?: number, // Compare the same representation so unrelated edits do not validate stale routes. const modelSelectionChanged = botProfileModelSelectionChanged(normalizeBotModelCapabilitiesOrThrow(previous), normalizedNextConfig); const acceptsModelSelection = modelSelectionChanged || acceptsSavedModel; + let pluginPrimarySelected = false; if (acceptsModelSelection) { const primary = (await readEffectiveBotModelChain(normalizedNextConfig))[0]; owner.assertCurrent(); @@ -2226,6 +2227,7 @@ export async function updateBotProfile(raw: unknown, expectedVersion?: number, throwIpcError('INVALID_PARAMS', 'Model route unavailable'); } owner.assertCurrent(); + pluginPrimarySelected = primary.harness === 'acp'; } const nextIdentitySource = body.identitySource !== undefined @@ -2258,6 +2260,7 @@ export async function updateBotProfile(raw: unknown, expectedVersion?: number, await client.tx('bots.updateProfile', { id, ...(acceptsModelSelection ? { clearScheduledModelBaseline: true } : {}), + ...(pluginPrimarySelected ? { rejectPluginPrimaryForLocalLead: true } : {}), ...(changesPermissions ? { canonicalPermissionMode: botSessionPermissionMode(normalizedNextConfig) } : {}), ...(restored?.allowSameName === true ? { allowDuplicateName: true } : {}), ...(restored?.templateId === 'cindy' ? { inactiveCindyIds: inactiveCompanionCopyIds(companionHomes.snapshot()) } : {}), diff --git a/apps/desktop/src/main/localDb/worker/opHandlers/tx.ts b/apps/desktop/src/main/localDb/worker/opHandlers/tx.ts index 66f5d4aaaa8..ae0a9ab7f5d 100644 --- a/apps/desktop/src/main/localDb/worker/opHandlers/tx.ts +++ b/apps/desktop/src/main/localDb/worker/opHandlers/tx.ts @@ -13,7 +13,8 @@ import { batchAutoReviewProjection, readAutoReviewProjectionTransaction } from ' import { CLOSE_SHARED_TASKS_FOR_SESSION_SQL } from '../../sharedTaskClosureSql.js'; import { IDLE_ARCHIVE_GUARD_SQL } from '../../../task-management/eligibility.js'; import { assertSessionDeleteTarget, COMMITTED_SIDE_CHAT_WORKER_SQL, ORCA_WORKER_LINK_TEAM_SQL, SIDE_CHAT_CLOSE_TARGET_SQL } from '../../sessionDeleteTarget.js'; -import { botProfileModelSelectionChanged } from '../../../../shared/botModelChain.js'; +import { BOT_LEAD_PLUGIN_ENGINE_UNSUPPORTED, botProfileModelSelectionChanged } from '../../../../shared/botModelChain.js'; +import { throwIpcError } from '../../../utils/ipcValidate.js'; import { dbToMakerAgentKind } from '../../../../shared/agentKindConversion.js'; import { parseScheduledModelBaseline } from '../../../../shared/scheduledModelBaseline.js'; import { normalizeBotName } from '../../../../shared/botCreation.js'; @@ -401,6 +402,7 @@ function botsUpdateProfile(db: Database.Database, args: unknown): { currentVersi const expectedVersion = expectNumber(p.expectedCurrentVersion, 'expectedCurrentVersion'); const now = expectNumber(p.now, 'now'); const allowDuplicateName = expectOptionalFlag(p.allowDuplicateName, 'allowDuplicateName'); + const rejectPluginPrimaryForLocalLead = expectOptionalFlag(p.rejectPluginPrimaryForLocalLead, 'rejectPluginPrimaryForLocalLead'); const inactive = inactiveCindyIds(p.inactiveCindyIds); const avatarRef = p.botAvatarRef === undefined ? null @@ -424,6 +426,17 @@ function botsUpdateProfile(db: Database.Database, args: unknown): { currentVersi if (current.currentVersion !== expectedVersion) { throw Object.assign(new Error('Bot Profile 已被另一处更新,请刷新后重试'), { code: 'PRECONDITION_FAILED' }); } + // Check the authoritative link and current role in the same commit as the choice. + if (rejectPluginPrimaryForLocalLead && db.prepare(` + SELECT 1 FROM bot_session_links l JOIN sessions s ON s.id = l.session_id + WHERE l.bot_id = ? AND l.role = 'canonical' AND l.archived_at IS NULL + AND s.source = 'bot' AND s.status = 'active' AND s.orca_role = 'lead' + AND s.remote_host_id IS NULL AND s.orca_remote_lead IS NULL + LIMIT 1 + `).get(id)) { + throwIpcError('UNSUPPORTED_CAPABILITY', + `${BOT_LEAD_PLUGIN_ENGINE_UNSUPPORTED}: Choose a built-in engine for this companion chat while it leads a collaboration.`); + } if (p.expectedAvatar !== undefined && current.avatar !== expectString(p.expectedAvatar, 'expectedAvatar')) { throw Object.assign(new Error('Buddy avatar changed during update'), { code: 'PRECONDITION_FAILED' }); } diff --git a/apps/desktop/src/renderer/features/bots/BotSettingsSaveStatus.tsx b/apps/desktop/src/renderer/features/bots/BotSettingsSaveStatus.tsx index ea5dff9a512..369fbffb75a 100644 --- a/apps/desktop/src/renderer/features/bots/BotSettingsSaveStatus.tsx +++ b/apps/desktop/src/renderer/features/bots/BotSettingsSaveStatus.tsx @@ -1,6 +1,7 @@ import { Check } from 'lucide-react'; import { Spinner } from '@/components/ui/spinner'; import { useBotTranslation } from './botPronounContext'; +import { BOT_LEAD_PLUGIN_ENGINE_ERROR_KEY } from './botSettingsAutosave'; import type { BotSettingsAutosaveController } from './useBotSettingsAutosave'; /** Shared settings header feedback; only a confirmed receipt becomes saved. */ @@ -23,7 +24,7 @@ export function BotSettingsSaveStatus({ autosave, modelPage, sourceTooLong }: { if (autosave.status === 'error') return (

{t(autosave.errorKey ?? 'bots.profileSaveFailed')} - {!sourceTooLong && } diff --git a/apps/desktop/src/renderer/features/bots/BotsHomeView.tsx b/apps/desktop/src/renderer/features/bots/BotsHomeView.tsx index 26851c31c6d..0e328e3b99e 100644 --- a/apps/desktop/src/renderer/features/bots/BotsHomeView.tsx +++ b/apps/desktop/src/renderer/features/bots/BotsHomeView.tsx @@ -67,6 +67,7 @@ import { BotMemorySettings } from './BotMemorySettings'; import { CompanionVoiceSettings } from './voice/CompanionVoiceSettings'; import { BotChannelsPage } from './BotChannelsPage'; import { + BOT_LEAD_PLUGIN_ENGINE_ERROR_KEY, botSettingsChanges, normalizeBotSettingsPayload, reconcileBotSettingsDraft, @@ -254,9 +255,9 @@ export function BotSettings({ && userContextSource.trim() !== savedSettingsRef.current.userContextSource); const canLeave = useCallback(async () => { if (avatarInFlight.current) return false; - await autosave.flush(); + const errorKey = await autosave.flush(); if (autosave.isDirty()) { - if (!sourceTooLong) return false; + if (!sourceTooLong && errorKey !== BOT_LEAD_PLUGIN_ENGINE_ERROR_KEY) return false; const discard = await confirm({ title: t('bots.memory.unsavedTitle'), description: t('bots.remoteSettings.leaveDescription'), diff --git a/apps/desktop/src/renderer/features/bots/__tests__/botSettings.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/botSettings.test.tsx index cb34d6b32a9..2985bd236c6 100644 --- a/apps/desktop/src/renderer/features/bots/__tests__/botSettings.test.tsx +++ b/apps/desktop/src/renderer/features/bots/__tests__/botSettings.test.tsx @@ -884,6 +884,54 @@ describe('Bot settings profile consolidation', () => { expect(mocks.updateBotProfile).toHaveBeenCalledTimes(2); }); + // #12276, unit. A permanent Lead rejection is actionable and the user can + // discard the rejected draft to leave settings and use the saved route. + it('lets a Lead discard an unsupported model choice and leave the model page', async () => { + mocks.updateBotProfile.mockRejectedValue(createIpcError( + 'UNSUPPORTED_CAPABILITY', 'BOT_LEAD_PLUGIN_ENGINE_UNSUPPORTED: Choose a built-in engine.', + )); + const view = renderSettings({ capabilities: capabilities({ modelChainOverride: capabilities().modelChain }) }); + fireEvent.click(screen.getByRole('button', { name: 'bots.settingsTabs.model' })); + fireEvent.click(within(screen.getByTestId('bot-primary-model-controls')).getByTestId('codex-model-selector')); + expect((await screen.findByRole('alert')).textContent).toContain('bots.autosave.leadPluginEngineUnsupported'); + expect(screen.queryByText('bots.autosave.retry')).toBeNull(); + + fireEvent.click(screen.getByRole('button', { name: 'bots.settingsBack' })); + fireEvent.click(await screen.findByRole('button', { name: 'bots.memory.discard' })); + await screen.findByRole('button', { name: 'bots.settingsTabs.model' }); + const attempts = mocks.updateBotProfile.mock.calls.length; + view.unmount(); + expect(mocks.updateBotProfile).toHaveBeenCalledTimes(attempts); + }); + + // #12276, unit. The first Back click must use the receipt from the pending save. + it.each(['rejected', 'saved'] as const)('handles Back during a model save that is %s', async (outcome) => { + let settle!: () => void; + if (outcome === 'rejected') { + const error = createIpcError('UNSUPPORTED_CAPABILITY', 'BOT_LEAD_PLUGIN_ENGINE_UNSUPPORTED: Choose a built-in engine.'); + mocks.updateBotProfile.mockRejectedValue(error); + mocks.updateBotProfile.mockImplementationOnce(() => new Promise((_, reject) => { + settle = () => reject(error); + })); + } else { + mocks.updateBotProfile.mockImplementationOnce((id, patch) => new Promise(resolve => { + settle = () => resolve({ id, currentVersion: 2, ...patch }); + })); + } + renderSettings({ capabilities: capabilities({ modelChainOverride: capabilities().modelChain }) }); + fireEvent.click(screen.getByRole('button', { name: 'bots.settingsTabs.model' })); + fireEvent.click(within(screen.getByTestId('bot-primary-model-controls')).getByTestId('codex-model-selector')); + await waitFor(() => expect(mocks.updateBotProfile).toHaveBeenCalledTimes(1)); + fireEvent.click(screen.getByRole('button', { name: 'bots.settingsBack' })); + expect(screen.queryByRole('button', { name: 'bots.memory.discard' })).toBeNull(); + await act(async () => { settle(); }); + if (outcome === 'rejected') { + fireEvent.click(await screen.findByRole('button', { name: 'bots.memory.discard' })); + } + await screen.findByRole('button', { name: 'bots.settingsTabs.model' }); + expect(screen.queryByRole('button', { name: 'bots.memory.discard' })).toBeNull(); + }); + it('keeps a same-model choice through a failed save and a newer host profile', async () => { vi.useFakeTimers(); const primary: BotModelRoute = { harness: 'pi', model: 'custom-model', providerId: 'custom', effort: 'high', fastMode: false }; diff --git a/apps/desktop/src/renderer/features/bots/botSettingsAutosave.ts b/apps/desktop/src/renderer/features/bots/botSettingsAutosave.ts index 62c7a1c8dc1..0e7540c549b 100644 --- a/apps/desktop/src/renderer/features/bots/botSettingsAutosave.ts +++ b/apps/desktop/src/renderer/features/bots/botSettingsAutosave.ts @@ -26,9 +26,11 @@ import type { BotCapabilities, BotProfileUpdatePatch } from './botStore'; import { reconcileBotCapabilityList } from '../../../shared/botCapabilitySelection'; import { extractIpcError } from '../../../shared/ipcError'; import { readBotProfileSource, BotProfileSourceTooLong } from '../../../shared/botProfileSources'; +import { BOT_LEAD_PLUGIN_ENGINE_UNSUPPORTED } from '../../../shared/botModelChain'; /** Bounds the UI wait, not the host transaction: a timeout cannot cancel a write. */ export const BOT_SETTINGS_SAVE_WAIT_MS = 30_000; +export const BOT_LEAD_PLUGIN_ENGINE_ERROR_KEY = 'bots.autosave.leadPluginEngineUnsupported'; export class BotSettingsSaveUnconfirmed extends Error {} /** Only recognized causes become localized copy; never display raw host errors. */ @@ -51,7 +53,8 @@ export function botSettingsSaveErrorKey(error: unknown): string | null { case 'DEVICE_LINK_DEVICE_UNRESPONSIVE': return 'bots.remoteSettings.saveFailed'; case 'UNSUPPORTED_CAPABILITY': - return 'bots.remoteSettings.unsupported'; + return failure.message.replace(/^\[UNSUPPORTED_CAPABILITY\]\s*/, '').startsWith(`${BOT_LEAD_PLUGIN_ENGINE_UNSUPPORTED}:`) + ? BOT_LEAD_PLUGIN_ENGINE_ERROR_KEY : 'bots.remoteSettings.unsupported'; case 'PRECONDITION_FAILED': return /伙伴配置已更新/.test(failure.message) ? 'bots.remoteSettings.conflict' : 'ipcError.PRECONDITION_FAILED'; default: diff --git a/apps/desktop/src/renderer/features/bots/useBotSettingsAutosave.ts b/apps/desktop/src/renderer/features/bots/useBotSettingsAutosave.ts index 3bdbac19376..c3e93f1616f 100644 --- a/apps/desktop/src/renderer/features/bots/useBotSettingsAutosave.ts +++ b/apps/desktop/src/renderer/features/bots/useBotSettingsAutosave.ts @@ -50,8 +50,8 @@ export interface BotSettingsAutosaveController { errorKey: string | null; /** 字段变化:文本走防抖,离散选择走即时合并窗口。 */ onEdit: (trigger: BotAutosaveTrigger) => void; - /** blur / 返回聊天等显式边界的冲刷。 */ - flush: () => Promise; + /** Flush pending edits and return the latest error key for navigation guards. */ + flush: () => Promise; /** 失败后重发。 */ retry: () => Promise; /** 是否有已改但未落库的内容。 */ @@ -103,6 +103,7 @@ export function useBotSettingsAutosave( const [modelSelectionSaved, setModelSelectionSaved] = useState(false); const completedModelSelectionRef = useRef(false); const [errorKey, setErrorKey] = useState(null); + const latestErrorKey = useRef(null); const savedTimerRef = useRef | null>(null); const mountedRef = useRef(true); @@ -114,7 +115,8 @@ export function useBotSettingsAutosave( } setStatus(next); setModelSelectionSaved(next === 'saved' && completedModelSelectionRef.current); - setErrorKey(next === 'error' ? botSettingsSaveErrorKey(error) : null); + latestErrorKey.current = next === 'error' ? botSettingsSaveErrorKey(error) : null; + setErrorKey(latestErrorKey.current); if (next !== 'saved') return; savedTimerRef.current = setTimeout(() => { savedTimerRef.current = null; @@ -183,9 +185,10 @@ export function useBotSettingsAutosave( [autosave, captureIntentOwner], ); - const flush = useCallback(() => { - if (!enabledRef.current) return Promise.resolve(); - return autosave.flush(); + const flush = useCallback(async () => { + if (!enabledRef.current) return null; + await autosave.flush(); + return latestErrorKey.current; }, [autosave]); const retry = useCallback(() => { diff --git a/apps/desktop/src/renderer/i18n/locales/de/common.json b/apps/desktop/src/renderer/i18n/locales/de/common.json index e317345a374..0836e4f2066 100644 --- a/apps/desktop/src/renderer/i18n/locales/de/common.json +++ b/apps/desktop/src/renderer/i18n/locales/de/common.json @@ -11316,6 +11316,7 @@ "saved": "Gespeichert", "unconfirmed": "Speichern nicht bestätigt", "savedModel": "Gespeichert · ab nächstem Zug", + "leadPluginEngineUnsupported": "Dieser Chat ist der Lead der Zusammenarbeit. Wähle eine integrierte Engine.", "retry": "Erneut speichern" }, "retry": "Erneut versuchen", diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json index 267fa6b18a5..25a42c56d93 100644 --- a/apps/desktop/src/renderer/i18n/locales/en/common.json +++ b/apps/desktop/src/renderer/i18n/locales/en/common.json @@ -11316,6 +11316,7 @@ "saved": "Saved", "unconfirmed": "Save not confirmed", "savedModel": "Saved · applies next turn", + "leadPluginEngineUnsupported": "This chat is the collaboration Lead. Choose a built-in engine.", "retry": "Save Again" }, "retry": "Retry", diff --git a/apps/desktop/src/renderer/i18n/locales/es/common.json b/apps/desktop/src/renderer/i18n/locales/es/common.json index a6b4603ea60..a395898bf8c 100644 --- a/apps/desktop/src/renderer/i18n/locales/es/common.json +++ b/apps/desktop/src/renderer/i18n/locales/es/common.json @@ -11402,6 +11402,7 @@ "saved": "Guardado", "unconfirmed": "Guardado sin confirmar", "savedModel": "Guardado · desde el próximo turno", + "leadPluginEngineUnsupported": "Este chat es el Lead de la colaboración. Elige un motor integrado.", "retry": "Guardar de nuevo" }, "retry": "Reintentar", diff --git a/apps/desktop/src/renderer/i18n/locales/fr/common.json b/apps/desktop/src/renderer/i18n/locales/fr/common.json index f16a3169289..f22aebd725b 100644 --- a/apps/desktop/src/renderer/i18n/locales/fr/common.json +++ b/apps/desktop/src/renderer/i18n/locales/fr/common.json @@ -11402,6 +11402,7 @@ "saved": "Enregistré", "unconfirmed": "Enregistrement non confirmé", "savedModel": "Enregistré · dès le prochain tour", + "leadPluginEngineUnsupported": "Cette conversation est le Lead de la collaboration. Choisissez un moteur intégré.", "retry": "Enregistrer à nouveau" }, "retry": "Réessayer", diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json index c922028d96f..bb3fcb8def7 100644 --- a/apps/desktop/src/renderer/i18n/locales/ja/common.json +++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json @@ -11271,6 +11271,7 @@ "saved": "保存しました", "unconfirmed": "保存を確認できません", "savedModel": "保存済み・次のターンから適用", + "leadPluginEngineUnsupported": "この会話は協同の Lead です。組み込みのエンジンを選択してください。", "retry": "再保存" }, "retry": "再試行", diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json index 769c489ccb3..171038a8744 100644 --- a/apps/desktop/src/renderer/i18n/locales/ko/common.json +++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json @@ -11271,6 +11271,7 @@ "saved": "저장됨", "unconfirmed": "저장을 확인하지 못함", "savedModel": "저장됨 · 다음 턴부터 적용", + "leadPluginEngineUnsupported": "이 대화는 협업의 Lead입니다. 내장 엔진을 선택하세요.", "retry": "다시 저장" }, "retry": "다시 시도", diff --git a/apps/desktop/src/renderer/i18n/locales/pt-BR/common.json b/apps/desktop/src/renderer/i18n/locales/pt-BR/common.json index a4a040d1161..4133daa8b3c 100644 --- a/apps/desktop/src/renderer/i18n/locales/pt-BR/common.json +++ b/apps/desktop/src/renderer/i18n/locales/pt-BR/common.json @@ -11402,6 +11402,7 @@ "saved": "Salvo", "unconfirmed": "Salvamento não confirmado", "savedModel": "Salvo · a partir do próximo turno", + "leadPluginEngineUnsupported": "Esta conversa é o Lead da colaboração. Escolha um motor integrado.", "retry": "Salvar novamente" }, "retry": "Tentar novamente", diff --git a/apps/desktop/src/renderer/i18n/locales/pt-PT/common.json b/apps/desktop/src/renderer/i18n/locales/pt-PT/common.json index 2b1600f2202..de3d9f8331e 100644 --- a/apps/desktop/src/renderer/i18n/locales/pt-PT/common.json +++ b/apps/desktop/src/renderer/i18n/locales/pt-PT/common.json @@ -11402,6 +11402,7 @@ "saved": "Guardado", "unconfirmed": "Gravação não confirmada", "savedModel": "Guardado · a partir do próximo turno", + "leadPluginEngineUnsupported": "Esta conversa é o Lead da colaboração. Escolhe um motor integrado.", "retry": "Guardar novamente" }, "retry": "Tentar novamente", diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json index 15e9b8e9150..9c0592bef40 100644 --- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json +++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json @@ -11271,6 +11271,7 @@ "saved": "已保存", "unconfirmed": "尚未确认保存", "savedModel": "已保存,下轮生效", + "leadPluginEngineUnsupported": "当前对话是协同 Lead,请选择内置引擎", "retry": "重新保存" }, "retry": "重试", diff --git a/apps/desktop/src/renderer/i18n/locales/zh-Hans-x-lzh/common.json b/apps/desktop/src/renderer/i18n/locales/zh-Hans-x-lzh/common.json index 527f417f878..d5926fa3619 100644 --- a/apps/desktop/src/renderer/i18n/locales/zh-Hans-x-lzh/common.json +++ b/apps/desktop/src/renderer/i18n/locales/zh-Hans-x-lzh/common.json @@ -11271,6 +11271,7 @@ "saved": "已存", "unconfirmed": "尚未核实存否", "savedModel": "已存,下轮生效", + "leadPluginEngineUnsupported": "此对话为协同 Lead,请选内置引擎", "retry": "再存" }, "retry": "再试", diff --git a/apps/desktop/src/renderer/i18n/locales/zh-Hant-x-lzh/common.json b/apps/desktop/src/renderer/i18n/locales/zh-Hant-x-lzh/common.json index 192053f916e..028acf21750 100644 --- a/apps/desktop/src/renderer/i18n/locales/zh-Hant-x-lzh/common.json +++ b/apps/desktop/src/renderer/i18n/locales/zh-Hant-x-lzh/common.json @@ -11271,6 +11271,7 @@ "saved": "已存", "unconfirmed": "尚未核實存否", "savedModel": "已存,下輪生效", + "leadPluginEngineUnsupported": "此對話為協同 Lead,請選內建引擎", "retry": "再存" }, "retry": "再試", diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json index 078340052dc..ff600581a42 100644 --- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json +++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json @@ -11271,6 +11271,7 @@ "saved": "已儲存", "unconfirmed": "尚未確認儲存", "savedModel": "已儲存,下輪生效", + "leadPluginEngineUnsupported": "目前對話是協同 Lead,請選擇內建引擎", "retry": "重新儲存" }, "retry": "重試", diff --git a/apps/desktop/src/shared/botModelChain.ts b/apps/desktop/src/shared/botModelChain.ts index a0d484ffb57..55497758268 100644 --- a/apps/desktop/src/shared/botModelChain.ts +++ b/apps/desktop/src/shared/botModelChain.ts @@ -1,6 +1,7 @@ import { normalizeCompanionModelRoute, modelRouteLocationKey, type CompanionModelRoute } from '@cindy/maker-shared/model-route'; export const BOT_MODEL_CHAIN_MAX = 5; +export const BOT_LEAD_PLUGIN_ENGINE_UNSUPPORTED = 'BOT_LEAD_PLUGIN_ENGINE_UNSUPPORTED'; export type BotHarness = CompanionModelRoute['harness']; diff --git a/docs/product-rules/cindy-bots-runtime.md b/docs/product-rules/cindy-bots-runtime.md index 0ddff1d67b1..1b6527916f2 100644 --- a/docs/product-rules/cindy-bots-runtime.md +++ b/docs/product-rules/cindy-bots-runtime.md @@ -629,6 +629,7 @@ harness + provider + model + effort + fastMode - 自动切换复用普通任务的模型/供应商/电脑切换提示,Desktop 与 Mobile 均直接显示在消息流中,不折进伙伴工作过程。 - 同 harness 可在安全边界切模型;跨 harness 必须走既有 agent-switch / 交接重建事务。 - 伙伴设置中的显式模型保存立即同步当前主任务的运行选择;空闲时在既有安全边界完成切换,运行中先记录最新选择,在回复、工具与审批结束后的安全边界接替,不要求用户再发一条消息才能登记。连续改选以最后一次为准,选回当前路由应取消不同的待切换路由。 +- 本机伙伴主对话担任 Orca 协同 Lead 时,选择插件引擎作为首选会在写入档案前被拒绝。仍可在备用位置保留插件引擎,也可把此前保存的插件首选改回内置引擎。 - 自动化指定的临时模型在本轮发送中不被伙伴默认模型对齐覆盖,包括跟随全局默认的伙伴。主人随后保存新的伙伴模型选择时,在发送锁内以同一数据库事务清除活跃主任务及群/IM 专线的旧恢复偏好,并同步标记模型对齐失效;新自动化记录恢复选择前在同一发送锁内对齐已保存模型,避免异步运行态刷新尚未执行时重新写回旧选择。恢复记录写入还须原子校验读取路由时的伙伴 Profile 版本,覆盖保存期间新建、尚未进入发送锁快照的专线;版本变化时重新准备,不能写回旧选择。设置已保存但运行态刷新前退出也不会复活旧选择;即使新选择恰好等于临时运行模型,下一次聊天也不得恢复到旧选择。普通内部投递先拒绝已降级的伙伴副本,再在发送边界恢复原选择,并在所有异步准备结束、真正派发给 Agent 前同步重查降级状态;能力设置预览使用下一轮普通聊天的选择,不因预览消费恢复记录。 - 模型配置只保留统一选择器入口,备用链仍在原组件内折叠;思考深度、Fast 与 Harness 不拆成独立设置页。缩窗交接复用已经核实目标窗口的延迟选择处理,完整记录与主任务身份保留,不绕过原生副作用重放限制。 - fallback 只改变当前任务的有效路由,不暗改 Profile 顺序。下一次确定性重建仍从首选开始。