Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(browser-extension): 代输入读页保护认别名、nativeHost 未知成员入审批上限、旧扩展拒绝 wait.text
Dash88dcae7b4e84
diff --git a/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/user-browser-backend.test.ts b/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/user-browser-backend.test.tsindex 6bd04109ce..548468d040 100644--- a/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/user-browser-backend.test.ts+++ b/apps/desktop/src/main/mcp-integrations/browser-backend/__tests__/user-browser-backend.test.ts@@ -332,6 +332,10 @@ describe('UserBrowserBackend · 读取与动作', () => {expect(await call(b, { action: 'act', targetId: 't1', request: { kind: 'wait', selector: '.ready', timeMs: 500 } }),).toMatchObject({ ok: false, message: expect.stringContaining('组合') });+ // Review 2026-10-30 (Codex P2): a text wait is not something an older extension can run either.+ expect(+ await call(b, { action: 'act', targetId: 't1', request: { kind: 'wait', selector: '.ready', text: '完成' } }),+ ).toMatchObject({ ok: false });expect(await call(b, { action: 'act', targetId: 't1', request: { kind: 'wait', loadState: 'networkidle' } }),).toMatchObject({ ok: false, message: expect.stringContaining('networkidle') });diff --git a/apps/desktop/src/main/mcp-integrations/browser-backend/user-browser-backend.ts b/apps/desktop/src/main/mcp-integrations/browser-backend/user-browser-backend.tsindex dd3963f1b9..11ab775ced 100644--- a/apps/desktop/src/main/mcp-integrations/browser-backend/user-browser-backend.ts+++ b/apps/desktop/src/main/mcp-integrations/browser-backend/user-browser-backend.ts@@ -1408,7 +1408,7 @@ export class UserBrowserBackend implements BrowserBackend {bridge: BrowserExtensionBridge,): Promise<BackendResult> {const request = req.request!;- if (request.fn || request.textGone) return unsupported(req.action, 'wait.fn / wait.textGone');+ if (request.fn || request.textGone || request.text) return unsupported(req.action, 'wait.fn / wait.text / wait.textGone');// Older extensions run one wait condition per call; a combination would silently drop all but the// first, so it is refused instead.const conditions = [request.selector, typeof request.timeMs === 'number', request.url, request.loadState].filter(Boolean);diff --git a/apps/desktop/src/main/mcp-integrations/browser.ts b/apps/desktop/src/main/mcp-integrations/browser.tsindex 8528cad7d4..04083d37b5 100644--- a/apps/desktop/src/main/mcp-integrations/browser.ts+++ b/apps/desktop/src/main/mcp-integrations/browser.ts@@ -597,11 +597,21 @@ export function getBrowserMcpDeps(): {if (!hasSecretPages()) return false;const listed = await backendController.call({ action: 'tabs', ...(profile ? { profile } : {}) });if (!listed.ok) return true;- const tabs = (listed.data as { tabs?: Array<{ targetId?: unknown; url?: unknown }> } | undefined)?.tabs ?? [];- // Without a target the runtime acts on its last tab; check every tab conservatively.- return tabs- .filter((tab) => !targetId || tab.targetId === targetId)- .some((tab) => typeof tab.url === 'string' && isSecretPage(tab.url));+ const tabs = (listed.data as { tabs?: Array<Record<string, unknown>> } | undefined)?.tabs ?? [];+ // The backend also accepts a tab's short alias, label or an unambiguous id prefix, so match those too.+ const named = targetId+ ? tabs.filter(+ (tab) =>+ tab.targetId === targetId ||+ tab.tabId === targetId ||+ tab.suggestedTargetId === targetId ||+ tab.label === targetId ||+ (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));},logger,};diff --git a/apps/desktop/src/shared/__tests__/ghost.test.ts b/apps/desktop/src/shared/__tests__/ghost.test.tsindex 85f666d878..23faaf1353 100644--- a/apps/desktop/src/shared/__tests__/ghost.test.ts+++ b/apps/desktop/src/shared/__tests__/ghost.test.ts@@ -5045,6 +5045,16 @@ describe('ghost · browserExtension 槽(2026-10-27 浏览器扩展经宿主桥expect(ghostBrowserExtensionWithinCap(withUnknown.manifest, sameUnknown.manifest)).toBe(true);});+ // Review 2026-10-30 (Codex P1): the same holds for members nested inside nativeHost.+ it('nativeHost 里未识别的成员也须与已审清单一致', () => {+ const reviewed = withNeeds(good);+ const nativeHost = { name: 'com.example.browser', binary: 'native-host/bin' };+ const withUnknown = withNeeds({ ...good, nativeHost: { ...nativeHost, futureCapability: true } });+ if (!reviewed.ok || !withUnknown.ok) throw new Error('fixture');+ expect(ghostBrowserExtensionWithinCap(reviewed.manifest, withUnknown.manifest)).toBe(false);+ expect(ghostBrowserExtensionWithinCap(withUnknown.manifest, withUnknown.manifest)).toBe(true);+ });+it('pageControlReplaces 列出被「我的浏览器」取代的插件工具与手册,须与 pageControl 同时声明', () => {const replaces = { tools: ['browser_read', 'browser_act'], manual: ['browser'] };const ok = withNeeds({ ...good, pageControlReplaces: replaces });diff --git a/apps/desktop/src/shared/ghost.ts b/apps/desktop/src/shared/ghost.tsindex a255dd3e40..94b3d1fdb5 100644--- a/apps/desktop/src/shared/ghost.ts+++ b/apps/desktop/src/shared/ghost.ts@@ -2853,18 +2853,33 @@ export function ghostBrowserExtensionWithinCap(}// Members this Host does not interpret ride along on the declaration. A later Host that starts to read// one must not find it already approved: every such member has to be in the reviewed declaration too.- const known = new Set(['protocol', 'extensionIds', 'nativeHost', 'pageControl', 'pageControlReplaces']);- for (const [key, value] of Object.entries(actualNeeds)) {- if (known.has(key)) continue;- if (- !Object.prototype.hasOwnProperty.call(cap, key) ||- canonicalGhostExtensionValue(value) !==- canonicalGhostExtensionValue((cap as unknown as Record<string, unknown>)[key])- ) {- return false;+ const unknownWithinCap = (actualObject: object, capObject: object, known: readonly string[]): boolean => {+ for (const [key, value] of Object.entries(actualObject)) {+ if (known.includes(key)) continue;+ if (+ !Object.prototype.hasOwnProperty.call(capObject, key) ||+ canonicalGhostExtensionValue(value) !==+ canonicalGhostExtensionValue((capObject as Record<string, unknown>)[key])+ ) {+ return false;+ }}+ return true;+ };+ if (+ actualNeeds.nativeHost !== undefined &&+ cap.nativeHost !== undefined &&+ !unknownWithinCap(actualNeeds.nativeHost, cap.nativeHost, ['name', 'binary'])+ ) {+ return false;}- return true;+ return unknownWithinCap(actualNeeds, cap, [+ 'protocol',+ 'extensionIds',+ 'nativeHost',+ 'pageControl',+ 'pageControlReplaces',+ ]);}/** 市场清单对 Node Worker 凭证注入与配置引导的授权上限。 */