Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(plugins): unknown members of a browserExtension declaration must be in the reviewed one
Dashc618bf828814
diff --git a/apps/desktop/src/shared/__tests__/ghost.test.ts b/apps/desktop/src/shared/__tests__/ghost.test.tsindex 47cdba3a57..85f666d878 100644--- a/apps/desktop/src/shared/__tests__/ghost.test.ts+++ b/apps/desktop/src/shared/__tests__/ghost.test.ts@@ -5035,6 +5035,16 @@ describe('ghost · browserExtension 槽(2026-10-27 浏览器扩展经宿主桥expect(ghostBrowserExtensionWithinCap(reviewed.manifest, expanded.manifest)).toBe(false);});+ // Review 2026-10-30 (Codex P1): an undeclared nested member must not slip through the cap unreviewed.+ it('浏览器扩展声明里未识别的嵌套成员须与已审清单一致', () => {+ const reviewed = withNeeds(good);+ const withUnknown = withNeeds({ ...good, futureCapability: { enabled: true } });+ const sameUnknown = withNeeds({ ...good, futureCapability: { enabled: true } });+ if (!reviewed.ok || !withUnknown.ok || !sameUnknown.ok) throw new Error('fixture');+ expect(ghostBrowserExtensionWithinCap(reviewed.manifest, withUnknown.manifest)).toBe(false);+ expect(ghostBrowserExtensionWithinCap(withUnknown.manifest, sameUnknown.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 6c18e0ab5f..a255dd3e40 100644--- a/apps/desktop/src/shared/ghost.ts+++ b/apps/desktop/src/shared/ghost.ts@@ -2851,6 +2851,19 @@ export function ghostBrowserExtensionWithinCap(if (actualNeeds.nativeHost !== undefined && cap.nativeHost?.name !== actualNeeds.nativeHost.name) {return false;}+ // 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;+ }+ }return true;}