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: address review — 扩权批准交由 Main 在安装锁内复核基线 + 面板文案同步

Chris58926db0c4e8
diff --git a/apps/desktop/src/main/plugin-market/__tests__/service.test.ts b/apps/desktop/src/main/plugin-market/__tests__/service.test.ts
index 2badcd2cfd..a3484e13f4 100644
--- a/apps/desktop/src/main/plugin-market/__tests__/service.test.ts
+++ b/apps/desktop/src/main/plugin-market/__tests__/service.test.ts
@@ -4,6 +4,8 @@ import path from 'node:path';
import { afterEach, describe, expect, it, vi } from 'vitest';
+import { ghostPermissionBaselineKey } from '../../../shared/ghost.js';
+
const runtime = vi.hoisted(() => ({
ghosts: [] as Array<{
manifest: Record<string, unknown>;
@@ -749,6 +751,50 @@ describe('PluginMarketService migration and defaultInstall', () => {
expect(runtime.install).toHaveBeenCalledTimes(1);
});
+ it('re-checks the reviewed baseline inside the install lock before honouring an expansion', async () => {
+ const item = summary({
+ currentRelease: { ...summary().currentRelease, id: 'release-2', version: '2.0.0' },
+ });
+ // 用户审阅时的已装 manifest 是 notify+fs(相对目标包没有新增权限);
+ // IPC 往返期间「从文件更新」把它换成了只有 notify 的包——此刻目标包相对
+ // **当前**已装多出 fs,而这条权限用户从没审过。旧批准不得放行它。
+ const reviewedInstalled = manifest('cindy-test', '1.0.0', ['notify', 'fs']);
+ runtime.ghosts = [
+ {
+ manifest: manifest(),
+ dir: '/userData/cindy-brain/cindy-test',
+ enabled: true,
+ },
+ ];
+ runtime.install.mockResolvedValue({
+ manifest: manifest('cindy-test', '2.0.0', ['notify', 'fs']),
+ dir: '/userData/cindy-brain/cindy-test',
+ enabled: true,
+ });
+ const h = harness([item]);
+ h.ledger.upsertInstallation({ ...recordForTest(item), releaseId: 'release-1', version: '1.0.0' });
+ h.api.detail.mockResolvedValue(detail(item, ['notify', 'fs']));
+
+ await expect(
+ h.service.install(item.id, {
+ expectedReleaseId: item.currentRelease.id,
+ allowPermissionExpansion: true,
+ reviewedBaseline: ghostPermissionBaselineKey(reviewedInstalled),
+ }),
+ ).rejects.toThrow('[PRECONDITION_FAILED]');
+ expect(runtime.install).not.toHaveBeenCalled();
+
+ // 基线与当前已装一致时照常放行(正常批准路径不被这道复核破坏)。
+ await expect(
+ h.service.install(item.id, {
+ expectedReleaseId: item.currentRelease.id,
+ allowPermissionExpansion: true,
+ reviewedBaseline: ghostPermissionBaselineKey(manifest()),
+ }),
+ ).resolves.toMatchObject({ ghost: { manifest: { version: '2.0.0' } } });
+ expect(runtime.install).toHaveBeenCalledTimes(1);
+ });
+
it('rejects an update when the installed target disappears during download', async () => {
const item = summary({ currentRelease: { ...summary().currentRelease, version: '2.0.0' } });
const h = harness([item]);
diff --git a/apps/desktop/src/main/plugin-market/registerIpc.ts b/apps/desktop/src/main/plugin-market/registerIpc.ts
index c24d32ae44..fe041fb6d0 100644
--- a/apps/desktop/src/main/plugin-market/registerIpc.ts
+++ b/apps/desktop/src/main/plugin-market/registerIpc.ts
@@ -64,6 +64,7 @@ export function registerPluginMarketIpc(): void {
expectedReleaseId?: unknown;
expectedManifest?: unknown;
allowPermissionExpansion?: unknown;
+ reviewedBaseline?: unknown;
})
: null;
const expectedReleaseId = requireString(obj?.expectedReleaseId, 'expectedReleaseId');
@@ -72,11 +73,15 @@ export function registerPluginMarketIpc(): void {
? undefined
: requireObject(obj.expectedManifest);
const allowPermissionExpansion = obj?.allowPermissionExpansion === true;
+ // 扩权批准的审阅基线:只收字符串,野值按缺席处理(缺席 = 保持旧行为)。
+ const reviewedBaseline =
+ typeof obj?.reviewedBaseline === 'string' ? obj.reviewedBaseline : undefined;
return invokePluginMarket(() =>
service().install(requireString(pluginId, 'pluginId'), {
expectedReleaseId,
...(expectedManifest ? { expectedManifest: expectedManifest as unknown as GhostManifest } : {}),
allowPermissionExpansion,
+ ...(reviewedBaseline !== undefined ? { reviewedBaseline } : {}),
}),
);
},
diff --git a/apps/desktop/src/main/plugin-market/service.ts b/apps/desktop/src/main/plugin-market/service.ts
index e5b9e8d060..575282a933 100644
--- a/apps/desktop/src/main/plugin-market/service.ts
+++ b/apps/desktop/src/main/plugin-market/service.ts
@@ -7,10 +7,11 @@ import {
type VisiblePluginDetail,
type VisiblePluginSummary,
} from '@cindy/plugin-protocol';
-import { app, dialog, type WebContents } from 'electron';
+import { app, dialog } from 'electron';
import {
diffGhostPermissionItems,
+ ghostPermissionBaselineKey,
isOfficialGhostId,
validateGhostManifest,
type GhostManifest,
@@ -83,6 +84,30 @@ const NO_DUPLICATE_GHOST_IDS: ReadonlySet<string> = new Set();
*/
const SOURCE_MUTATION_KEY = 'market-sources';
+/**
+ * 扩权批准的原子复核:Renderer 的 allowPermissionExpansion 只代表「用户对
+ * **某一份**已装 manifest 与目标包之间的差异点过同意」。它到达这里之前有一段
+ * 往返窗口,期间「从文件更新」等路径可能整体替换已装 manifest(ghosts.update()
+ * 没有版本单调性检查),那份同意就不再对应现实——继续放行等于让旧批准覆盖
+ * 相对新 manifest 的全部新增权限。
+ *
+ * 所以带审阅基线来的批准,必须在安装锁内、真正放行扩权之前,拿**当前**已装
+ * manifest 重算指纹比对;不一致就拒绝这次批准,由 Renderer 回到重新审阅。
+ * 基线缺席时保持既有行为(旧版本 Renderer / 首装无基线可比),不新增拒绝面。
+ */
+function assertReviewedBaselineFresh(
+ installed: GhostManifest,
+ reviewedBaseline: string | undefined,
+): void {
+ if (reviewedBaseline === undefined) return;
+ if (ghostPermissionBaselineKey(installed) !== reviewedBaseline) {
+ throwIpcError(
+ 'PRECONDITION_FAILED',
+ 'Installed Plugin permissions changed after review; re-review required',
+ );
+ }
+}
+
function captureMarketOwner(): ActiveAppSession {
const session = getActiveAppSession();
if (
@@ -387,6 +412,14 @@ export class PluginMarketService {
/** 自定义市场插件:Renderer 确认框实际审阅过的完整 manifest。 */
expectedManifest?: GhostManifest;
allowPermissionExpansion?: boolean;
+ /**
+ * 扩权批准所依据的**已装 manifest 权限指纹**
+ * (`ghostPermissionBaselineKey`)。带 allowPermissionExpansion 时应一并
+ * 传入:Main 在安装锁内用当前已装 manifest 重算比对,不一致说明审阅与
+ * 现实已经脱节(典型是审阅期间「从文件更新」换了包),此时拒绝这次批准
+ * 而不是拿旧批准放行相对新 manifest 的全部新增权限。
+ */
+ reviewedBaseline?: string;
},
): Promise<{ ghost: InstalledGhost }> {
const customRef = parseCustomMarketPluginId(pluginId);
@@ -448,6 +481,9 @@ export class PluginMarketService {
{
expectedInstalled: existing,
allowPermissionExpansion: options.allowPermissionExpansion === true,
+ ...(options.reviewedBaseline !== undefined
+ ? { reviewedBaseline: options.reviewedBaseline }
+ : {}),
// 下载可能持续数分钟,提交副作用前按当前事实再算一次。
recheckOwnership: assertOwnership,
},
@@ -697,7 +733,13 @@ export class PluginMarketService {
*/
private async customInstall(
ref: { marketName: string; ghostId: string },
- options: { expectedReleaseId: string; expectedManifest: GhostManifest; allowPermissionExpansion?: boolean },
+ options: {
+ expectedReleaseId: string;
+ expectedManifest: GhostManifest;
+ allowPermissionExpansion?: boolean;
+ /** 扩权批准所依据的已装权限指纹;安装锁内复核,详见 install() 的说明。 */
+ reviewedBaseline?: string;
+ },
): Promise<{ ghost: InstalledGhost }> {
const owner = captureMarketOwner();
const ledger = this.ledgerForOwner(owner);
@@ -762,10 +804,12 @@ export class PluginMarketService {
existing &&
// 与服务端安装同口径:对比已装 manifest 与候选包,只有新增权限才要求
// 显式确认(upstream 已回退批准 receipt 基线,这里跟随主干口径)。
- diffGhostPermissionItems(existing.manifest, plugin.manifest).added.length > 0 &&
- options.allowPermissionExpansion !== true
+ diffGhostPermissionItems(existing.manifest, plugin.manifest).added.length > 0
) {
- throwIpcError('PRECONDITION_FAILED', 'Plugin permissions changed and require review');
+ if (options.allowPermissionExpansion !== true) {
+ throwIpcError('PRECONDITION_FAILED', 'Plugin permissions changed and require review');
+ }
+ assertReviewedBaselineFresh(existing.manifest, options.reviewedBaseline);
}
requireSameMarketOwner(owner);
const ghost = await installCustomMarketPlugin({
@@ -1038,6 +1082,8 @@ export class PluginMarketService {
plugin: VisiblePluginDetail,
options: {
allowPermissionExpansion?: boolean;
+ /** 扩权批准所依据的已装权限指纹;安装锁内复核,详见 install() 的说明。 */
+ reviewedBaseline?: string;
/** 确认操作时的安装意图;下载窗口期目标被另一窗口卸载时拒绝滑入首装。 */
expectedInstalled: boolean;
/**
@@ -1067,10 +1113,12 @@ export class PluginMarketService {
}
if (
existing &&
- diffGhostPermissionItems(existing.manifest, compatible.manifest).added.length > 0 &&
- options.allowPermissionExpansion !== true
+ diffGhostPermissionItems(existing.manifest, compatible.manifest).added.length > 0
) {
- throwIpcError('PRECONDITION_FAILED', 'Plugin permissions changed and require review');
+ if (options.allowPermissionExpansion !== true) {
+ throwIpcError('PRECONDITION_FAILED', 'Plugin permissions changed and require review');
+ }
+ assertReviewedBaselineFresh(existing.manifest, options.reviewedBaseline);
}
const download = await this.api.download(plugin.id, plugin.currentRelease.id);
requireSameMarketOwner(owner);
diff --git a/apps/desktop/src/preload/preload.ts b/apps/desktop/src/preload/preload.ts
index 4745a8889c..a7b1de9989 100644
--- a/apps/desktop/src/preload/preload.ts
+++ b/apps/desktop/src/preload/preload.ts
@@ -1027,6 +1027,8 @@ contextBridge.exposeInMainWorld('electronAPI', {
expectedReleaseId: string;
expectedManifest?: import('../shared/ghost').GhostManifest;
allowPermissionExpansion?: boolean;
+ /** 扩权批准所依据的已装权限指纹;Main 在安装锁内复核后才放行扩权。 */
+ reviewedBaseline?: string;
},
): Promise<{ ghost: import('../shared/ghost').InstalledGhost }> =>
ipcRenderer.invoke('plugin-market:install', pluginId, options),
diff --git a/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx b/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx
index 570cc0a553..a8f69934f1 100644
--- a/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx
+++ b/apps/desktop/src/renderer/features/plugin/GhostPluginPage.tsx
@@ -62,6 +62,7 @@ import { resolveSystemLocale } from '../../../shared/locale';
import {
diffGhostPermissionItems,
ghostPanelKind,
+ ghostPermissionBaselineKey,
ghostPermissionItems,
isOfficialGhostId,
type GhostSetupStatus,
@@ -649,6 +650,11 @@ export function GhostPluginPage() {
expectedReleaseId: next.releaseId,
...(next.sourceType !== 'server' ? { expectedManifest: next.manifest } : {}),
allowPermissionExpansion: diff.added.length > 0,
+ // 用户看确认框这段时间里已装 manifest 可能被换掉(如从文件更新);
+ // 把审阅基线交给 Main,在安装锁内复核后才放行扩权。
+ ...(installedGhost
+ ? { reviewedBaseline: ghostPermissionBaselineKey(installedGhost.manifest) }
+ : {}),
});
if (!isMarketBusyLeaseActive(marketBusyLease)) return;
toast.success(
@@ -1018,7 +1024,14 @@ export function GhostPluginPage() {
? { expectedManifest: marketDetail.manifest }
: {}),
...(isUpdate && diff!.added.length > 0
- ? { allowPermissionExpansion: true }
+ ? {
+ allowPermissionExpansion: true,
+ // 确认框展示期间已装 manifest 可能被换掉;基线交由 Main 在
+ // 安装锁内复核,不一致就拒绝这次批准而不是沿用旧同意。
+ ...(installedGhost
+ ? { reviewedBaseline: ghostPermissionBaselineKey(installedGhost.manifest) }
+ : {}),
+ }
: {}),
});
if (!isMarketBusyLeaseActive(marketBusyLease)) return;
diff --git a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCreatePrompt.test.ts b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCreatePrompt.test.ts
index 0117eacc9f..b89a2e528a 100644
--- a/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCreatePrompt.test.ts
+++ b/apps/desktop/src/renderer/features/plugin/__tests__/GhostPluginCreatePrompt.test.ts
@@ -36,6 +36,8 @@ describe('Ghost Plugin creation prompt', () => {
expect(prompt).toContain('提问卡片');
expect(prompt).toContain('推荐项');
expect(prompt).toContain('停靠面板');
- expect(prompt).toContain('右侧栏页签');
+ // 面板收束(2026-08-02):tab 形态住在插件页内,不再是右侧栏页签。
+ expect(prompt).toContain('插件页内面板');
+ expect(prompt).not.toContain('右侧栏页签');
});
});
diff --git a/apps/desktop/src/renderer/features/plugin/__tests__/updateAllController.test.ts b/apps/desktop/src/renderer/features/plugin/__tests__/updateAllController.test.ts
index 9d706953c1..3d44699e2a 100644
--- a/apps/desktop/src/renderer/features/plugin/__tests__/updateAllController.test.ts
+++ b/apps/desktop/src/renderer/features/plugin/__tests__/updateAllController.test.ts
@@ -127,6 +127,7 @@ describe('updateAllController', () => {
expectedReleaseId: 'release-2',
expectedManifest: nextManifest,
allowPermissionExpansion: true,
+ reviewedBaseline: expect.any(String),
});
expect(getUpdateAllBatchState().rows?.[0]?.status).toBe('done');
});
@@ -144,6 +145,7 @@ describe('updateAllController', () => {
expect(installMock).toHaveBeenCalledWith('plugin-a', {
expectedReleaseId: 'release-2',
allowPermissionExpansion: true,
+ reviewedBaseline: expect.any(String),
});
});
@@ -273,6 +275,7 @@ describe('updateAllController', () => {
expect(installMock).toHaveBeenCalledWith('plugin-a', {
expectedReleaseId: 'release-2',
allowPermissionExpansion: true,
+ reviewedBaseline: expect.any(String),
});
});
@@ -343,6 +346,7 @@ describe('updateAllController', () => {
expect(installMock).toHaveBeenCalledWith('plugin-a', {
expectedReleaseId: 'release-2',
allowPermissionExpansion: true,
+ reviewedBaseline: expect.any(String),
});
expect(getUpdateAllBatchState().rows?.[0]?.status).toBe('done');
});
diff --git a/apps/desktop/src/renderer/features/plugin/lib/updateAllController.ts b/apps/desktop/src/renderer/features/plugin/lib/updateAllController.ts
index 6fa172ddeb..2c2e94e7bf 100644
--- a/apps/desktop/src/renderer/features/plugin/lib/updateAllController.ts
+++ b/apps/desktop/src/renderer/features/plugin/lib/updateAllController.ts
@@ -20,14 +20,17 @@ import {
isDataOwnerGenerationCurrent,
type DataOwnerGeneration,
} from '@/contexts/dataOwnerGeneration';
-import { diffGhostPermissionItems, type GhostManifest } from '../../../../shared/ghost';
+import {
+ diffGhostPermissionItems,
+ ghostPermissionBaselineKey,
+ type GhostManifest,
+} from '../../../../shared/ghost';
import type { PluginMarketItem } from '../../../../shared/pluginMarket';
import { pluginMarketErrorKey } from './pluginMarketErrorKey';
import {
batchSummary,
buildUpdateAllRows,
isBatchFinished,
- permissionBaselineKey,
updateRow,
type UpdateAllRow,
} from './updateAllModel';
@@ -197,7 +200,7 @@ async function runQueue(generation: number): Promise<void> {
releaseId: detail.releaseId,
permissionDiff: diff,
// 审阅基线绑定权限指纹而非版本号:同版本换 manifest 也能识别。
- reviewedBaseline: permissionBaselineKey(installedManifest),
+ reviewedBaseline: ghostPermissionBaselineKey(installedManifest),
...(detail.sourceType !== 'server' ? { expectedManifest: detail.manifest } : {}),
});
continue;
@@ -280,13 +283,18 @@ export async function approveUpdateExpansion(pluginId: string): Promise<void> {
// - 目标 release 变化:市场在等待期间发了新版,审的不是这一版。
const reviewStillValid =
row.staleReview !== true &&
- permissionBaselineKey(installed) === row.reviewedBaseline &&
+ ghostPermissionBaselineKey(installed) === row.reviewedBaseline &&
detail.releaseId === row.releaseId;
if (reviewStillValid) {
await window.electronAPI.pluginMarket.install(pluginId, {
expectedReleaseId: row.releaseId,
...(row.expectedManifest ? { expectedManifest: row.expectedManifest } : {}),
allowPermissionExpansion: true,
+ // 审阅基线随批准回传:Main 在安装锁内用当时的已装 manifest 复核,
+ // renderer 这边的检查挡不住 IPC 往返窗口内的替换。
+ ...(row.reviewedBaseline !== undefined
+ ? { reviewedBaseline: row.reviewedBaseline }
+ : {}),
});
patchRow(generation, pluginId, { status: 'done' });
} else {
@@ -300,7 +308,7 @@ export async function approveUpdateExpansion(pluginId: string): Promise<void> {
releaseId: detail.releaseId,
permissionDiff: freshDiff,
staleReview: false,
- reviewedBaseline: permissionBaselineKey(installed),
+ reviewedBaseline: ghostPermissionBaselineKey(installed),
expectedManifest: detail.sourceType !== 'server' ? detail.manifest : undefined,
});
return;
@@ -369,7 +377,7 @@ export function reconcileUpdateAllBatch(marketItems: readonly PluginMarketItem[]
// 目标 release 已落账(main 侧 record.releaseId 对上):无需再装。
rows = updateRow(rows, row.pluginId, { status: 'done' });
changed = true;
- } else if (permissionBaselineKey(installed) !== row.reviewedBaseline) {
+ } else if (ghostPermissionBaselineKey(installed) !== row.reviewedBaseline) {
// 权限基线变了(换版本,或同版本换入不同权限声明):旧审阅作废。
rows = updateRow(rows, row.pluginId, {
fromVersion: installed.version,
diff --git a/apps/desktop/src/renderer/features/plugin/lib/updateAllModel.ts b/apps/desktop/src/renderer/features/plugin/lib/updateAllModel.ts
index 208711bbf5..8d3964abdf 100644
--- a/apps/desktop/src/renderer/features/plugin/lib/updateAllModel.ts
+++ b/apps/desktop/src/renderer/features/plugin/lib/updateAllModel.ts
@@ -7,11 +7,7 @@
* [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
*/
-import {
- ghostPermissionItems,
- type GhostManifest,
- type GhostPermissionDiff,
-} from '../../../../shared/ghost';
+import type { GhostManifest, GhostPermissionDiff } from '../../../../shared/ghost';
import type { PluginMarketItem } from '../../../../shared/pluginMarket';
/**
@@ -59,20 +55,6 @@ export interface UpdateAllRow {
errorText?: string;
}
-/**
- * 权限审阅基线指纹:同一份 manifest 推导出的权限条目集合(key + detail)。
- * 与 diffGhostPermissionItems 同口径(它也是按 key 对齐、detail 变化算差异),
- * 所以"指纹相同"等价于"权限面没变",可安全沿用先前的审阅结论。
- */
-export function permissionBaselineKey(manifest: GhostManifest): string {
- // 每项 JSON 编码后再排序拼接:全可打印(不进 NUL,git diff 才不会把本文件
- // 判成二进制),且转义天然消除 "a","b" 与 "a,b","" 的拼接歧义。
- return ghostPermissionItems(manifest)
- .map((item) => JSON.stringify([item.key, item.detail ?? '']))
- .sort()
- .join('\n');
-}
-
/** 从市场快照萃取可更新行;顺序即执行顺序(与列表快照顺序一致,稳定)。 */
export function buildUpdateAllRows(
marketItems: readonly PluginMarketItem[],
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index fb3761aec6..5edee911d5 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -3103,7 +3103,7 @@
"updateTo": "Update to v{{version}}",
"updateAria": "Update {{name}} to v{{version}}",
"createWithCindy": "Create with Cindy",
- "createPrompt": "I want to create a Cindy plugin. First call ghost_forge_guide to get the handbook's table of contents, read chapter 0 (design alignment) first, then read the relevant chapters via the section parameter (at minimum the sandbox red-lines and packaging chapters) before writing any code; do not start implementing yet. Begin by asking questions: prefer option-based question cards, one key decision per card with your recommended choice marked, and proactively surface design options I may not know about — such as the UI form (docked panel, right-sidebar tab, chat card, or no UI), a $ command word, launch mode, network access, and whether a settings page is needed. Step by step, confirm the problem to solve, target users, interaction flow, required tools and connections, permission boundaries, and acceptance criteria. After I confirm the design, implement and validate it according to the specification, then call ghost_forge_pack to package and install the plugin.",
+ "createPrompt": "I want to create a Cindy plugin. First call ghost_forge_guide to get the handbook's table of contents, read chapter 0 (design alignment) first, then read the relevant chapters via the section parameter (at minimum the sandbox red-lines and packaging chapters) before writing any code; do not start implementing yet. Begin by asking questions: prefer option-based question cards, one key decision per card with your recommended choice marked, and proactively surface design options I may not know about — such as the UI form (docked panel, panel inside the Plugins page, chat card, or no UI), a $ command word, launch mode, network access, and whether a settings page is needed. Step by step, confirm the problem to solve, target users, interaction flow, required tools and connections, permission boundaries, and acceptance criteria. After I confirm the design, implement and validate it according to the specification, then call ghost_forge_pack to package and install the plugin.",
"filterAll": "All",
"filtersAria": "Filter plugins by source",
"origin": {
@@ -3337,7 +3337,7 @@
"tool": "Tool \"{{name}}\"",
"command": "Chat command ${{command}}",
"panelLeft": "Panel \"{{title}}\" · docked left of the chat",
- "panelTab": "Panel \"{{title}}\" · tab in the right sidebar",
+ "panelTab": "Panel \"{{title}}\" · opens inside the Plugins page",
"code": "Executable code",
"codeDetail": "Runs in an isolated sandbox with no access to your files or network.",
"resident": "Always-on (starts when enabled, keeps a background process even when idle)",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 74815b4420..e7ddc662a1 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -3102,7 +3102,7 @@
"updateTo": "v{{version}} に更新",
"updateAria": "{{name}} を v{{version}} に更新",
"createWithCindy": "Cindy で作成",
- "createPrompt": "Cindy プラグインを作成したいです。まず ghost_forge_guide を呼び出してハンドブックの目次を取得し、最初に第 0 章「設計のすり合わせ」を読み、その後 section パラメータで関連する章(少なくともサンドボックスの禁止事項とパッケージ化の章)を読み込んでから着手してください。すぐに実装を始めないでください。質問から始めてください:選択肢付きの質問カードを優先し、1 枚のカードでは 1 つの重要な判断に絞り、あなたのおすすめを明示した上で、私が気づきにくい設計オプション(UI 形態:ドッキングパネル / 右サイドバーのタブ / チャットカード / UI なし、$ 呼び出しコマンド、起動モード、ネットワーク接続の要否、設定ページの要否など)を積極的に提示して選ばせてください。解決する課題、対象ユーザー、操作フロー、必要なツールと接続、権限の境界、受け入れ条件を段階的に確認してください。設計を確認した後、仕様に沿って実装と検証を行い、最後に ghost_forge_pack を呼び出してプラグインをパッケージ化し、インストールしてください。",
+ "createPrompt": "Cindy プラグインを作成したいです。まず ghost_forge_guide を呼び出してハンドブックの目次を取得し、最初に第 0 章「設計のすり合わせ」を読み、その後 section パラメータで関連する章(少なくともサンドボックスの禁止事項とパッケージ化の章)を読み込んでから着手してください。すぐに実装を始めないでください。質問から始めてください:選択肢付きの質問カードを優先し、1 枚のカードでは 1 つの重要な判断に絞り、あなたのおすすめを明示した上で、私が気づきにくい設計オプション(UI 形態:ドッキングパネル / プラグインページ内のパネル / チャットカード / UI なし、$ 呼び出しコマンド、起動モード、ネットワーク接続の要否、設定ページの要否など)を積極的に提示して選ばせてください。解決する課題、対象ユーザー、操作フロー、必要なツールと接続、権限の境界、受け入れ条件を段階的に確認してください。設計を確認した後、仕様に沿って実装と検証を行い、最後に ghost_forge_pack を呼び出してプラグインをパッケージ化し、インストールしてください。",
"filterAll": "すべて",
"filtersAria": "提供元でプラグインを絞り込む",
"origin": {
@@ -3336,7 +3336,7 @@
"tool": "ツール「{{name}}」",
"command": "チャット指令 ${{command}}",
"panelLeft": "パネル「{{title}}」· チャットの左側にドッキング",
- "panelTab": "パネル「{{title}}」· 右サイドバーのタブ",
+ "panelTab": "パネル「{{title}}」· プラグインページ内で開く",
"code": "実行コード",
"codeDetail": "独立したサンドボックスで実行され、ファイルやネットワークにはアクセスできません。",
"resident": "常駐実行(有効化すると起動し、呼び出されなくてもバックグラウンドプロセスを維持)",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 8983e1df11..670008d00d 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -3102,7 +3102,7 @@
"updateTo": "v{{version}}(으)로 업데이트",
"updateAria": "{{name}}을(를) v{{version}}(으)로 업데이트",
"createWithCindy": "Cindy로 만들기",
- "createPrompt": "Cindy 플러그인을 만들고 싶습니다. 먼저 ghost_forge_guide를 호출해 핸드북 목차를 받고, 우선 0장 「설계 맞추기」를 읽은 뒤 section 매개변수로 관련 장(최소한 샌드박스 금지선과 패키징 장)을 읽고 나서 작업을 시작하세요. 바로 구현을 시작하지 마세요. 질문부터 시작하세요: 선택지가 있는 질문 카드를 우선 사용하고, 카드 한 장에는 핵심 결정 하나만 담아 추천안을 표시하며, 제가 모를 수 있는 설계 옵션(UI 형태: 도킹 패널 / 오른쪽 사이드바 탭 / 채팅 카드 / UI 없음, $ 호출 명령어, 시작 모드, 네트워크 사용 여부, 설정 페이지 필요 여부 등)을 먼저 보여 주고 고르게 해 주세요. 해결할 문제, 대상 사용자, 상호작용 흐름, 필요한 도구와 연결, 권한 경계, 완료 기준을 단계적으로 확인해 주세요. 설계를 확인한 뒤 규격에 따라 구현하고 검증한 다음, 마지막으로 ghost_forge_pack을 호출해 플러그인을 패키징하고 설치해 주세요.",
+ "createPrompt": "Cindy 플러그인을 만들고 싶습니다. 먼저 ghost_forge_guide를 호출해 핸드북 목차를 받고, 우선 0장 「설계 맞추기」를 읽은 뒤 section 매개변수로 관련 장(최소한 샌드박스 금지선과 패키징 장)을 읽고 나서 작업을 시작하세요. 바로 구현을 시작하지 마세요. 질문부터 시작하세요: 선택지가 있는 질문 카드를 우선 사용하고, 카드 한 장에는 핵심 결정 하나만 담아 추천안을 표시하며, 제가 모를 수 있는 설계 옵션(UI 형태: 도킹 패널 / 플러그인 페이지 내 패널 / 채팅 카드 / UI 없음, $ 호출 명령어, 시작 모드, 네트워크 사용 여부, 설정 페이지 필요 여부 등)을 먼저 보여 주고 고르게 해 주세요. 해결할 문제, 대상 사용자, 상호작용 흐름, 필요한 도구와 연결, 권한 경계, 완료 기준을 단계적으로 확인해 주세요. 설계를 확인한 뒤 규격에 따라 구현하고 검증한 다음, 마지막으로 ghost_forge_pack을 호출해 플러그인을 패키징하고 설치해 주세요.",
"filterAll": "전체",
"filtersAria": "출처별 플러그인 필터",
"origin": {
@@ -3336,7 +3336,7 @@
"tool": "도구 \"{{name}}\"",
"command": "채팅 명령 ${{command}}",
"panelLeft": "패널 \"{{title}}\" · 채팅 왼쪽에 도킹",
- "panelTab": "패널 \"{{title}}\" · 오른쪽 사이드바 탭",
+ "panelTab": "패널 \"{{title}}\" · 플러그인 페이지에서 열기",
"code": "실행 코드",
"codeDetail": "격리된 샌드박스에서 실행되며 파일과 네트워크에 접근할 수 없습니다.",
"resident": "상주 실행(활성화하면 시작되며 호출이 없어도 백그라운드 프로세스 유지)",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index b1b7af2306..44166c4a6e 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -3102,7 +3102,7 @@
"updateTo": "更新到 v{{version}}",
"updateAria": "将 {{name}} 更新到 v{{version}}",
"createWithCindy": "使用 Cindy 创建",
- "createPrompt": "我要创建一个 Cindy 插件。请先调用 ghost_forge_guide 获取手册目录,先读第 0 章「设计对齐」,再用 section 参数读透相关章节(动手前至少读完沙箱红线与打包流程两章),不要直接开始实现。先从提问开始:优先用带选项的提问卡片,每张卡片聚焦一个关键决策并标注你的推荐项,把我可能不知道的设计选项主动摆出来让我选——比如界面形态(停靠面板、右侧栏页签、对话卡片还是无界面)、$ 点名词、启动模式、是否联网、是否需要设置页;并逐步确认插件要解决的问题、目标用户、交互流程、所需工具与连接、权限边界和验收标准。设计确认后,再按规范实现并自检;最后调用 ghost_forge_pack 打包并安装插件。",
+ "createPrompt": "我要创建一个 Cindy 插件。请先调用 ghost_forge_guide 获取手册目录,先读第 0 章「设计对齐」,再用 section 参数读透相关章节(动手前至少读完沙箱红线与打包流程两章),不要直接开始实现。先从提问开始:优先用带选项的提问卡片,每张卡片聚焦一个关键决策并标注你的推荐项,把我可能不知道的设计选项主动摆出来让我选——比如界面形态(停靠面板、插件页内面板、对话卡片还是无界面)、$ 点名词、启动模式、是否联网、是否需要设置页;并逐步确认插件要解决的问题、目标用户、交互流程、所需工具与连接、权限边界和验收标准。设计确认后,再按规范实现并自检;最后调用 ghost_forge_pack 打包并安装插件。",
"filterAll": "全部",
"filtersAria": "按来源筛选插件",
"origin": {
@@ -3336,7 +3336,7 @@
"tool": "工具「{{name}}」",
"command": "对话指令 ${{command}}",
"panelLeft": "面板「{{title}}」· 停靠主对话区左侧",
- "panelTab": "面板「{{title}}」· 右侧栏页签",
+ "panelTab": "面板「{{title}}」· 插件页内打开",
"code": "可执行代码",
"codeDetail": "在独立沙箱中运行,无法访问你的文件与网络。",
"resident": "常驻运行(生效后即启动,不调用也保持后台进程)",
diff --git a/apps/desktop/src/shared/ghost.ts b/apps/desktop/src/shared/ghost.ts
index 710d81648c..7fbe69333a 100644
--- a/apps/desktop/src/shared/ghost.ts
+++ b/apps/desktop/src/shared/ghost.ts
@@ -1805,6 +1805,22 @@ export interface GhostPermissionDiff {
unchanged: GhostPermissionItem[];
}
+/**
+ * 权限审阅基线指纹:同一份 manifest 推导出的权限条目集合(key + detail)。
+ * 与 diffGhostPermissionItems 同口径(按 key 对齐、detail 变化算差异),
+ * 所以"指纹相同"等价于"权限面没变",可安全沿用先前的审阅结论。
+ *
+ * renderer 审阅时记录基线并随安装请求回传,main 在安装锁内用**当前**已装
+ * manifest 重算比对——两侧必须用同一个实现,否则复核形同虚设,故住在 shared。
+ * 每项 JSON 编码后排序拼接,全可打印、无拼接歧义。
+ */
+export function ghostPermissionBaselineKey(manifest: GhostManifest): string {
+ return ghostPermissionItems(manifest)
+ .map((item) => JSON.stringify([item.key, item.detail ?? '']))
+ .sort()
+ .join('\n');
+}
+
export function diffGhostPermissionItems(
prev: GhostManifest,
next: GhostManifest,