Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 发送前校验 host-capability 插件仍处于启用且 workdir 可用

Shinku1a490521037d
diff --git a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx
index 11bd14a3da..43daa148b1 100644
--- a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx
+++ b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx
@@ -4755,9 +4755,18 @@ export function ChatInput({
? findGhostByCommand(eligibleGhosts, ghostCommandWord)
: null;
const textToSend = expandGhostCommand(text, eligibleGhosts);
- const routedText = hostCapability
- ? expandHostCapabilityInvocation(textToSend, hostCapability, hostCapability.name)
- : textToSend;
+ // 发送前校验 host-capability 插件仍处于启用且 workdir 可用的状态。
+ // 若用户在插入芯片后停用/卸载了该插件,芯片内序列化的 ghostId/capability
+ // 已失时效,不应再展开 Host 路由指令(fail-closed)。
+ const isHostCapabilityValid =
+ hostCapability !== undefined &&
+ eligibleGhosts.some(
+ (g) => g.manifest.id === hostCapability.ghostId && g.enabled,
+ );
+ const routedText =
+ hostCapability && isHostCapabilityValid
+ ? expandHostCapabilityInvocation(textToSend, hostCapability, hostCapability.name)
+ : textToSend;
const sendSnapshot = captureComposerSendSnapshot(
editor.getJSON(),
latestAttachmentsRef.current,