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(browser): 代输入读页保护在目标不在标签页列表时保守拒绝

Dash882d01ff93cf
diff --git a/apps/desktop/src/main/mcp-integrations/browser.ts b/apps/desktop/src/main/mcp-integrations/browser.ts
index 04083d37b5..37cf2c8576 100644
--- a/apps/desktop/src/main/mcp-integrations/browser.ts
+++ b/apps/desktop/src/main/mcp-integrations/browser.ts
@@ -609,9 +609,11 @@ export function getBrowserMcpDeps(): {
(typeof tab.targetId === 'string' && tab.targetId.startsWith(targetId)),
)
: [];
- // Without a target (or one that matches nothing listed) the runtime acts on its last tab, or
- // the call fails; check every tab conservatively.
- return (named.length > 0 ? named : tabs).some((tab) => typeof tab.url === 'string' && isSecretPage(tab.url));
+ // A target the (possibly truncated) tab list does not show may still be the page the owner typed
+ // into: while any secret page is remembered, fail closed. Without a target the runtime acts on its
+ // last tab, so every listed tab is checked.
+ if (targetId && named.length === 0) return true;
+ return (targetId ? named : tabs).some((tab) => typeof tab.url === 'string' && isSecretPage(tab.url));
},
logger,
};