Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): force review for unapproved market installs
Yuewei-LLb501c2f9599f
diff --git a/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx b/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsxindex b6e8414472..ad57d835b6 100644--- a/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx+++ b/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx@@ -275,6 +275,13 @@ export function diffMarketUpdatePermissionItems(return diffInstalledGhostPermissionItems(installed, next);}+export function marketUpdateAllowsPermissionExpansion(+ installed: InstalledGhost,+ addedPermissionCount: number,+): boolean {+ return installed.approval.state !== 'approved' || addedPermissionCount > 0;+}+/** 读「忽略本轮更新」的持久值(键按数据归属分桶,见 ignoredRoundStorageKey)。 */function readIgnoredRound(storageKey: string): string {try {@@ -868,7 +875,10 @@ export function GhostPluginPage() {expectedReleaseId: next.releaseId,expectedManifest: next.manifest,expectedInstalledApproval: ghostInstallApprovalToken(installedGhost.approval),- allowPermissionExpansion: diff.added.length > 0,+ allowPermissionExpansion: marketUpdateAllowsPermissionExpansion(+ installedGhost,+ diff.added.length,+ ),...(installedGhost? { reviewedBaseline: ghostPermissionBaselineKey(installedGhost.manifest) }: {}),diff --git a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsxindex 98c5d18380..2cf2e7db1c 100644--- a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx+++ b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCard.test.tsx@@ -31,6 +31,7 @@ import {diffMarketUpdatePermissionItems,GhostPluginCard,LegacyGhostRecoveryNotice,+ marketUpdateAllowsPermissionExpansion,MarketPluginCard,} from '../GhostPluginPage';import {@@ -38,6 +39,7 @@ import {__resetGhostUnreadForTest,} from '@/cindy-brain/ghostUnreadStore';import type { GhostPluginListItem } from '../lib/ghostPluginViewModel';+import type { InstalledGhost } from '../../../../shared/ghost';import type { PluginMarketItem } from '../../../../shared/pluginMarket';const {@@ -83,6 +85,23 @@ describe('diffMarketUpdatePermissionItems', () => {);});+describe('marketUpdateAllowsPermissionExpansion', () => {+ const installed = (approvalState: 'approved' | 'legacy-unapproved' | 'invalid') =>+ ({ approval: { state: approvalState } }) as InstalledGhost;++ it.each(['legacy-unapproved', 'invalid'] as const)(+ 'allows the full reapproval of a no-permission %s install',+ (approvalState) => {+ expect(marketUpdateAllowsPermissionExpansion(installed(approvalState), 0)).toBe(true);+ },+ );++ it('only allows approved installs when the reviewed diff adds permissions', () => {+ expect(marketUpdateAllowsPermissionExpansion(installed('approved'), 0)).toBe(false);+ expect(marketUpdateAllowsPermissionExpansion(installed('approved'), 1)).toBe(true);+ });+});+const commandPlugin: GhostPluginListItem = {id: 'filo-google',name: 'Filo Google',