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(desktop): harden plugin approval migration, recovery, and market re-approval

Yuewei-LLfa8b855053d2
diff --git a/apps/desktop/src/main/cindy-brain/GhostManager.ts b/apps/desktop/src/main/cindy-brain/GhostManager.ts
index c231e69bef..bf682c6774 100644
--- a/apps/desktop/src/main/cindy-brain/GhostManager.ts
+++ b/apps/desktop/src/main/cindy-brain/GhostManager.ts
@@ -434,7 +434,10 @@ export interface GhostExclusiveMutation {
publishTrustedBundledSeed(
id: string,
sourceDir: string,
- options: { disabled: boolean },
+ options: {
+ disabled: boolean;
+ trust?: typeof CINDY_OFFICIAL_GHOST_TRUST;
+ },
): Promise<void>;
approveTrustedBundledInstall(
manifest: GhostManifest,
@@ -2253,53 +2256,6 @@ export class GhostManager {
}
}
- /** 读取主机安装时写下的信任快照与权限 receipt;坏文件一律 fail closed。 */
- private readInstalledHostMetadata(dir: string): GhostInstalledHostMetadata | null {
- try {
- const bytes = readBoundedFileNoFollowSync(path.join(dir, TRUST_METADATA_FILE), 64 * 1024);
- if (bytes === null) return null;
- const raw = JSON.parse(bytes.toString('utf8')) as Record<string, unknown>;
- if (
- !raw ||
- typeof raw !== 'object' ||
- typeof raw.level !== 'string' ||
- !['cindy-official', 'reviewed', 'verified-publisher', 'unverified'].includes(raw.level) ||
- typeof raw.publisherSigned !== 'boolean' ||
- typeof raw.publisherVerified !== 'boolean' ||
- typeof raw.reviewed !== 'boolean'
- ) return null;
- const trust: GhostTrustInfo = {
- level: raw.level as GhostTrustInfo['level'],
- publisherSigned: raw.publisherSigned,
- publisherVerified: raw.publisherVerified,
- reviewed: raw.reviewed,
- ...(typeof raw.publisherName === 'string' ? { publisherName: raw.publisherName } : {}),
- ...(typeof raw.publisherKeyId === 'string' ? { publisherKeyId: raw.publisherKeyId } : {}),
- ...(typeof raw.reviewerName === 'string' ? { reviewerName: raw.reviewerName } : {}),
- ...(typeof raw.unknownReviewer === 'boolean' ? { unknownReviewer: raw.unknownReviewer } : {}),
- };
- // Official trust is a capability-bearing identity. A malformed receipt is
- // not downgraded into a partially trusted official object; it disappears
- // from the projection so every consumer fails closed.
- if (trust.level === 'cindy-official' && !isCindyOfficialTrustInfo(trust)) return null;
- const approval = raw.approvedAtResourceProvider;
- const approvedAtResourceProviderTool =
- approval
- && typeof approval === 'object'
- && !Array.isArray(approval)
- && Object.keys(approval).length === 1
- && typeof (approval as Record<string, unknown>).tool === 'string'
- ? (approval as Record<string, string>).tool
- : undefined;
- return {
- trust,
- ...(approvedAtResourceProviderTool ? { approvedAtResourceProviderTool } : {}),
- };
- } catch {
- return null;
- }
- }
-
/**
* 只验不装:读 .cindy → 解包 → 校验清单,返回清单(含 icon data URL),
* 零副作用。「装意识前弹确认」(README 安全原则)的数据来源 —— 三个装入
@@ -2685,7 +2641,6 @@ export class GhostManager {
manifest,
approvedManifest,
localeResources,
- trust,
packageSha256,
iconDataUrl,
allEntries,
@@ -2897,7 +2852,6 @@ export class GhostManager {
manifest,
approvedManifest,
localeResources,
- trust,
packageSha256,
iconDataUrl,
allEntries,
@@ -3159,7 +3113,10 @@ export class GhostManager {
private async publishTrustedBundledSeedUnlocked(
id: string,
sourceDirInput: string,
- options: { disabled: boolean },
+ options: {
+ disabled: boolean;
+ trust?: typeof CINDY_OFFICIAL_GHOST_TRUST;
+ },
): Promise<void> {
if (
!isValidGhostId(id) ||
@@ -3194,6 +3151,12 @@ export class GhostManager {
if (options.disabled) {
await fs.promises.writeFile(path.join(stagingDir, DISABLED_MARKER_FILE), '');
}
+ if (options.trust) {
+ await fs.promises.writeFile(
+ path.join(stagingDir, TRUST_METADATA_FILE),
+ `${JSON.stringify(options.trust, null, 2)}\n`,
+ );
+ }
if (finalKind === 'missing') {
await this.receiptStore.writePendingMutation(id, { kind: 'install', packageSha256 });
this.untrustedApprovals.add(this.isolationKey(id));
@@ -3318,12 +3281,7 @@ export class GhostManager {
) {
throw new Error('builtin seed publish journal does not match immutable source');
}
- const trust: GhostTrustInfo = {
- level: 'cindy-official',
- publisherSigned: false,
- publisherVerified: false,
- reviewed: true,
- };
+ const trust = CINDY_OFFICIAL_GHOST_TRUST;
const current = this.readApproval(manifest.id);
// priorEnabled 直接读盘上的 receipt 而不是 readApproval 的投影:进程内隔离态的
// receipt 不可作授权事实,但"曾经停用"这个位只用于往下拉,是 fail closed 方向,
diff --git a/apps/desktop/src/main/cindy-brain/__tests__/GhostManager.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/GhostManager.test.ts
index 047d3238b8..e384693ca0 100644
--- a/apps/desktop/src/main/cindy-brain/__tests__/GhostManager.test.ts
+++ b/apps/desktop/src/main/cindy-brain/__tests__/GhostManager.test.ts
@@ -2618,7 +2618,7 @@ describe('GhostManager · install', () => {
expect(manager.list()[0].trust).toEqual(CINDY_OFFICIAL_GHOST_TRUST);
});
- it('残缺的官方 receipt 不会被投影为可用的官方 trust', async () => {
+ it('可变 trust 镜像损坏不会覆盖有效的官方 Host receipt', async () => {
const local = await makeCindy('github-incomplete-receipt.cindy', goodManifest('cindy-github'));
await manager.install(local, { trustOverride: 'cindy-official' });
const metadataPath = path.join(rootDir, 'cindy-github', '.cindy-trust.json');
@@ -2626,7 +2626,7 @@ describe('GhostManager · install', () => {
delete metadata.publisherName;
await fs.promises.writeFile(metadataPath, `${JSON.stringify(metadata)}\n`);
- expect(manager.list()[0]?.trust).toBeUndefined();
+ expect(manager.list()[0]?.trust).toEqual(CINDY_OFFICIAL_GHOST_TRUST);
});
it('@ 资源入口必须命中主机安装 receipt,旧安装元数据不会在升级后自动扩权', async () => {
diff --git a/apps/desktop/src/main/cindy-brain/builtinGhostProvisioner.ts b/apps/desktop/src/main/cindy-brain/builtinGhostProvisioner.ts
index 5a0da60818..ea8eea99bb 100644
--- a/apps/desktop/src/main/cindy-brain/builtinGhostProvisioner.ts
+++ b/apps/desktop/src/main/cindy-brain/builtinGhostProvisioner.ts
@@ -116,7 +116,10 @@ export interface ProvisionDeps {
publishSeed?: (
id: string,
seedDir: string,
- options: { disabled: boolean },
+ options: {
+ disabled: boolean;
+ trust?: typeof CINDY_OFFICIAL_GHOST_TRUST;
+ },
) => void | Promise<void>;
/**
* 首次真实变更(装/覆盖/回收)动手前回调,整轮至多一次 —— index.ts 用它
@@ -619,117 +622,79 @@ export async function provisionBuiltinGhosts(deps: ProvisionDeps): Promise<Provi
}
// 4) 指纹比对(忽略点开头文件:`.disabled` 是用户状态不是内容)。
+ // 种子是随应用发布的第一方输入,出现链接/FIFO/设备节点属于打包事故:
+ // 必须整颗 fail closed,不能在复制时静默丢掉条目后批准一个残缺安装。
const seedFingerprint = await fingerprintDirContent(seedDir);
if (seedFingerprint.hasNonRegularEntry) {
throw new Error('builtin seed contains a link or non-regular entry');
}
+
+ const trust = id === 'cindy-github' ? CINDY_OFFICIAL_GHOST_TRUST : undefined;
if (installedExists) {
const installedFingerprint = await fingerprintDirContent(installedDir);
- if (
+ const contentMatches =
!installedFingerprint.hasNonRegularEntry &&
- seedFingerprint.hash === installedFingerprint.hash
- ) {
+ seedFingerprint.hash === installedFingerprint.hash;
+ const trustNeedsRepair = trust !== undefined && !hasCindyOfficialTrustMetadata(installedDir);
+ if (contentMatches && !trustNeedsRepair) {
outcome.approved.push(manifest);
outcome.approvedSourceDirs[id] = seedDir;
- if (id === 'cindy-github' && !hasCindyOfficialTrustMetadata(installedDir)) {
- // receipt 与官方字节必须在同一把安装锁内、经同一次 staging swap
- // 原子落位;不能在 hash 后单独给可能已被替换的目录补 trust。
- const wasDisabled = classifyGhostDirEntrySync(path.join(installedDir, '.disabled')) === 'file';
- markApplyStart();
- await swapInSeed(seedDir, installedDir, repoRootDir, id, {
- disabled: wasDisabled,
- trust: CINDY_OFFICIAL_GHOST_TRUST,
- });
- }
outcome.skipped.push(id);
return;
}
- const wasDisabled = classifyGhostDirEntrySync(path.join(installedDir, '.disabled')) === 'file';
+
+ const wasDisabled = (() => {
+ try {
+ return classifyGhostDirEntrySync(path.join(installedDir, '.disabled')) === 'file';
+ } catch {
+ return false;
+ }
+ })();
markApplyStart();
+ // Claim seeded ownership durably before exchanging bytes. If the process
+ // dies after the swap but before the end-of-pass ledger write, the next
+ // reconciliation still knows this id is eligible for audience cleanup.
seeded.add(id);
if (!writeState(repoRootDir, { removed: [...tombstones], seeded: [...seeded].sort() }, log)) {
seeded.delete(id);
throw new Error('builtin seeded ledger could not be persisted before replacement');
}
ownershipClaimPersisted = true;
- await deps.beforeReplace?.(id);
- await swapInSeed(seedDir, installedDir, repoRootDir, id, {
+ if (!contentMatches) await deps.beforeReplace?.(id);
+ const options = {
disabled: wasDisabled,
- ...(id === 'cindy-github' ? { trust: CINDY_OFFICIAL_GHOST_TRUST } : {}),
- });
+ ...(trust ? { trust } : {}),
+ };
+ if (deps.publishSeed) await deps.publishSeed(id, seedDir, options);
+ else await swapInSeed(seedDir, installedDir, repoRootDir, id, options);
outcome.approved.push(manifest);
outcome.approvedSourceDirs[id] = seedDir;
- outcome.updated.push(manifest);
- log?.info('builtin ghost updated to bundled content', { id, version: manifest.version });
+ if (contentMatches) {
+ outcome.skipped.push(id);
+ } else {
+ outcome.updated.push(manifest);
+ log?.info('builtin ghost updated to bundled content', { id, version: manifest.version });
+ }
return;
}
- {
- // 4) 指纹比对(忽略点开头文件:`.disabled` 是用户状态不是内容)。
- // 种子是随应用发布的第一方输入,出现链接/FIFO/设备节点属于打包事故:
- // 必须整颗 fail closed,不能在复制时静默丢掉条目后批准一个残缺安装。
- const seedFingerprint = await fingerprintDirContent(seedDir);
- if (seedFingerprint.hasNonRegularEntry) {
- throw new Error('builtin seed contains a link or non-regular entry');
- }
- if (installedExists) {
- const installedFingerprint = await fingerprintDirContent(installedDir);
- // 安装侧含非普通条目 = 一律判不一致,走重新播种把目录换回随包字节。
- // 否则它既修不回来(判成相同就跳过播种),随后 hashApprovedDirectory 又会因
- // 非普通条目抛错、批准被撤销,插件每次启动都卡在不可用。
- if (
- !installedFingerprint.hasNonRegularEntry &&
- seedFingerprint.hash === installedFingerprint.hash
- ) {
- outcome.approved.push(manifest);
- outcome.approvedSourceDirs[id] = seedDir;
- outcome.skipped.push(id);
- return;
- }
- const wasDisabled = (() => {
- try {
- classifyGhostDirEntrySync(path.join(installedDir, '.disabled'));
- return true;
- } catch {
- return false;
- }
- })();
markApplyStart();
- // Claim seeded ownership durably before exchanging bytes. If the process
- // dies after the swap but before the end-of-pass ledger write, the next
- // reconciliation still knows this id is eligible for audience cleanup.
- seeded.add(id);
- if (!writeState(repoRootDir, { removed: [...tombstones], seeded: [...seeded].sort() }, log)) {
- seeded.delete(id);
- throw new Error('builtin seeded ledger could not be persisted before replacement');
- }
- ownershipClaimPersisted = true;
- await deps.beforeReplace?.(id);
- if (deps.publishSeed) await deps.publishSeed(id, seedDir, { disabled: wasDisabled });
- else await swapInSeed(seedDir, installedDir, repoRootDir, id, { disabled: wasDisabled });
- outcome.approved.push(manifest);
- outcome.approvedSourceDirs[id] = seedDir;
- outcome.updated.push(manifest);
- log?.info('builtin ghost updated to bundled content', { id, version: manifest.version });
- } else {
- markApplyStart();
- await swapInSeed(seedDir, installedDir, repoRootDir, id, {
- disabled: false,
- ...(id === 'cindy-github' ? { trust: CINDY_OFFICIAL_GHOST_TRUST } : {}),
- });
seeded.add(id);
if (!writeState(repoRootDir, { removed: [...tombstones], seeded: [...seeded].sort() }, log)) {
seeded.delete(id);
throw new Error('builtin seeded ledger could not be persisted before install');
}
ownershipClaimPersisted = true;
- if (deps.publishSeed) await deps.publishSeed(id, seedDir, { disabled: false });
- else await swapInSeed(seedDir, installedDir, repoRootDir, id, { disabled: false });
+ const options = {
+ disabled: false,
+ ...(trust ? { trust } : {}),
+ };
+ if (deps.publishSeed) await deps.publishSeed(id, seedDir, options);
+ else await swapInSeed(seedDir, installedDir, repoRootDir, id, options);
outcome.approved.push(manifest);
outcome.approvedSourceDirs[id] = seedDir;
outcome.installed.push(manifest);
log?.info('builtin ghost installed', { id, version: manifest.version });
- }
});
} catch (err) {
// Existing ownership must survive a failed audience/orphan cleanup so the
diff --git a/apps/desktop/src/main/device-link/crossProcessLock.ts b/apps/desktop/src/main/device-link/crossProcessLock.ts
index 3dbab627a0..a792021eba 100644
--- a/apps/desktop/src/main/device-link/crossProcessLock.ts
+++ b/apps/desktop/src/main/device-link/crossProcessLock.ts
@@ -1,5 +1,6 @@
import crypto from 'node:crypto';
import { execFile } from 'node:child_process';
+import type { Stats } from 'node:fs';
import fsp from 'node:fs/promises';
import path from 'node:path';
import { promisify } from 'node:util';
@@ -83,6 +84,10 @@ let currentProcessIdentityPromise: Promise<ProcessIdentity | null> | null = null
const pendingOwnRecordRecovery = new Map<string, string>();
const pendingOwnGateCleanup = new Set<string>();
+function gateReleaseMarkerPath(gatePath: string): string {
+ return `${gatePath}.released`;
+}
+
export async function withCrossProcessLock<T>(
lockPath: string,
opts: FileLockOptions,
@@ -446,7 +451,10 @@ function reclaimGateDirPath(lockPath: string): string {
async function cleanupPendingOwnGates(): Promise<void> {
for (const file of [...pendingOwnGateCleanup]) {
await removePathWithRetry(file);
- if (!(await pathExists(file))) pendingOwnGateCleanup.delete(file);
+ if (!(await pathExists(file))) {
+ await removePathWithRetry(gateReleaseMarkerPath(file));
+ pendingOwnGateCleanup.delete(file);
+ }
}
}
@@ -463,7 +471,7 @@ async function findActiveReclaimGate(dirPath: string): Promise<string | null> {
for (const entry of entries) {
if (!entry.startsWith('gate-') || !entry.endsWith('.json')) continue;
const filePath = path.join(dirPath, entry);
- let stat: Awaited<ReturnType<typeof fsp.stat>>;
+ let stat: Stats;
try {
stat = await fsp.stat(filePath);
} catch {
@@ -471,7 +479,18 @@ async function findActiveReclaimGate(dirPath: string): Promise<string | null> {
}
const record = await readLockRecord(filePath, true);
if (record === 'missing') continue;
- if (typeof record === 'string') return filePath;
+ if (await hasValidGateReleaseMarker(filePath)) {
+ await removePathWithRetry(filePath);
+ await removePathWithRetry(gateReleaseMarkerPath(filePath));
+ continue;
+ }
+ if (typeof record === 'string') {
+ const fresh = Date.now() - stat.mtimeMs <= LOCK_STALE_MS;
+ if (fresh || await isMalformedGateOwnerActive(filePath, stat)) return filePath;
+ await removePathWithRetry(filePath);
+ if (await pathExists(filePath)) return filePath;
+ continue;
+ }
if (record.state === 'released') {
await removePathWithRetry(filePath);
continue;
@@ -495,6 +514,29 @@ async function findActiveReclaimGate(dirPath: string): Promise<string | null> {
return active[0]?.filePath ?? null;
}
+async function isMalformedGateOwnerActive(
+ filePath: string,
+ stat: Stats,
+): Promise<boolean> {
+ const match = /^gate-(\d+)-[0-9a-f-]+\.json$/i.exec(path.basename(filePath));
+ if (!match) return true;
+ const pid = Number(match[1]);
+ if (!Number.isInteger(pid) || pid <= 0) return true;
+ const createdAtMs = Number.isFinite(stat.birthtimeMs) && stat.birthtimeMs > 0
+ ? stat.birthtimeMs
+ : stat.mtimeMs;
+ return isRecordOwnerActive(
+ {
+ pid,
+ startedAt: stat.mtimeMs,
+ nonce: null,
+ processStartIdentity: null,
+ state: 'held',
+ },
+ createdAtMs,
+ );
+}
+
async function acquireReclaimGate(
lockPath: string,
waitMs = RELEASE_GATE_WAIT_MS,
@@ -864,15 +906,22 @@ async function cleanupPublishedLock(
async function releaseReclaimGate(gate: ReclaimGate): Promise<void> {
clearInterval(gate.heartbeat);
+ let releasedRecordDurable = false;
try {
await markReleased(gate.lock);
+ releasedRecordDurable = true;
} catch (error) {
log.warn('lock reclaim gate could not be flushed before release', error);
+ await publishGateReleaseMarker(gate).catch((markerError) => {
+ log.warn('lock reclaim gate release marker could not be published', markerError);
+ });
}
await gate.lock.handle.close().catch(() => undefined);
await removePathWithRetry(gate.filePath);
if (await pathExists(gate.filePath)) {
pendingOwnGateCleanup.add(gate.filePath);
+ } else if (!releasedRecordDurable) {
+ await removePathWithRetry(gateReleaseMarkerPath(gate.filePath));
}
try {
await fsp.rmdir(gate.dirPath);
@@ -881,6 +930,42 @@ async function releaseReclaimGate(gate: ReclaimGate): Promise<void> {
}
}
+async function publishGateReleaseMarker(gate: ReclaimGate): Promise<void> {
+ const markerPath = gateReleaseMarkerPath(gate.filePath);
+ let handle: Awaited<ReturnType<typeof fsp.open>> | null = null;
+ try {
+ handle = await fsp.open(markerPath, 'wx');
+ await writeAllAt(handle, JSON.stringify({
+ gateFile: path.basename(gate.filePath),
+ nonce: gate.lock.nonce,
+ }));
+ await handle.sync();
+ } catch (error) {
+ if ((error as NodeJS.ErrnoException).code !== 'EEXIST') throw error;
+ if (!(await hasValidGateReleaseMarker(gate.filePath))) throw error;
+ } finally {
+ await handle?.close().catch(() => undefined);
+ }
+}
+
+async function hasValidGateReleaseMarker(gatePath: string): Promise<boolean> {
+ try {
+ const value = JSON.parse(
+ await fsp.readFile(gateReleaseMarkerPath(gatePath), 'utf8'),
+ ) as unknown;
+ return Boolean(
+ value
+ && typeof value === 'object'
+ && !Array.isArray(value)
+ && (value as Record<string, unknown>).gateFile === path.basename(gatePath)
+ && typeof (value as Record<string, unknown>).nonce === 'string'
+ && isValidNonce((value as Record<string, unknown>).nonce as string),
+ );
+ } catch {
+ return false;
+ }
+}
+
async function recoverPendingOwnRecord(file: string): Promise<void> {
const nonce = pendingOwnRecordRecovery.get(file);
if (!nonce) return;
diff --git a/apps/desktop/src/main/im/shared/__tests__/turnRunnerSendOutcome.test.ts b/apps/desktop/src/main/im/shared/__tests__/turnRunnerSendOutcome.test.ts
index f8f45ddaa7..1f5f3a6f0d 100644
--- a/apps/desktop/src/main/im/shared/__tests__/turnRunnerSendOutcome.test.ts
+++ b/apps/desktop/src/main/im/shared/__tests__/turnRunnerSendOutcome.test.ts
@@ -2785,7 +2785,7 @@ describe('turnRunner send outcome policy (feishu adapter characterization)', ()
expect(h).toBeTruthy();
expect(mocks.beginTurnChangeSetAtDispatch).not.toHaveBeenCalled();
});
-
+
it('未受保护的消息照常落库(既有行为不变)', async () => {
setupSession(async () => ({ accepted: true }));
mocks.persistUserMessage.mockClear();
diff --git a/apps/desktop/src/main/plugin-market/service.ts b/apps/desktop/src/main/plugin-market/service.ts
index dd57b7b863..10b195dba6 100644
--- a/apps/desktop/src/main/plugin-market/service.ts
+++ b/apps/desktop/src/main/plugin-market/service.ts
@@ -1658,7 +1658,7 @@ export class PluginMarketService {
if (
silentBaselineMismatch &&
reviewedBaseline !== undefined &&
- ghostPermissionBaselineKey(installed) !== reviewedBaseline
+ ghostPermissionBaselineKey(installed.manifest) !== reviewedBaseline
) {
throw new SilentUpgradeStaleBaselineError('Installed Plugin permissions changed');
}
@@ -2028,9 +2028,13 @@ export class PluginMarketService {
return;
}
const freshInstalled = freshLocal.ghostsById.get(summary.ghostId);
- const reviewedBaseline = freshInstalled
- ? ghostPermissionBaselineKey(freshInstalled.manifest)
- : undefined;
+ if (!freshInstalled) {
+ log.warn('default plugin upgrade skipped because the installed record disappeared', {
+ pluginId: summary.id,
+ });
+ return;
+ }
+ const reviewedBaseline = ghostPermissionBaselineKey(freshInstalled.manifest);
const detail = await this.api.detail(summary.id);
requireSameMarketOwner(owner);
assertDetailMatchesSummary(summary, detail);
@@ -2048,6 +2052,7 @@ export class PluginMarketService {
reviewedManifest: reviewedManifest.manifest,
allowPermissionExpansion: true,
reviewedBaseline,
+ expectedInstalledApproval: ghostInstallApprovalToken(freshInstalled.approval),
silentBaselineMismatch: true,
beforeCommitInLock: () => {
if (
diff --git a/apps/desktop/src/main/remote-ssh/ssh-keys.ts b/apps/desktop/src/main/remote-ssh/ssh-keys.ts
index 9c8d54e688..d335e1f5f2 100644
--- a/apps/desktop/src/main/remote-ssh/ssh-keys.ts
+++ b/apps/desktop/src/main/remote-ssh/ssh-keys.ts
@@ -231,7 +231,10 @@ export async function addKeyToAgent(opts: {
try {
await fs.access(privateKeyPath);
} catch (err) {
- if ((err as NodeJS.ErrnoException).code === 'ENOENT') {
+ const code = (err as NodeJS.ErrnoException).code;
+ const windowsPathProbeFailed =
+ process.platform === 'win32' && code === 'UNKNOWN' && path.win32.isAbsolute(privateKeyPath);
+ if (code === 'ENOENT' || windowsPathProbeFailed) {
return {
success: false,
failureReason: 'no_such_file',
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index ad039deac3..591368749d 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -3372,6 +3372,15 @@
"install": "安裝插件…",
"empty": "還沒有安裝任何插件",
"emptyHint": "可從插件市場安裝,或點選右上角匯入 .cindy 檔案",
+ "reapproval": {
+ "badge": "需要重新確認權限",
+ "action": "重新確認權限",
+ "actionAria": "重新確認插件「{{name}}」的權限",
+ "noticeTitle": "需要重新確認權限",
+ "bodyLegacy": "Cindy 沒有這個插件的權限確認記錄,所以先將它停用。點「重新確認權限」重新檢視它要求的權限,確認後即可繼續使用。",
+ "bodyInvalid": "這個插件的權限確認記錄已損壞,所以先將它停用。點「重新確認權限」重新檢視它要求的權限,確認後即可繼續使用。",
+ "bodyBuiltinRestart": "這個內建插件的權限記錄出了問題。重新啟動 Cindy 即可自動恢復,不需要其他操作。"
+ },
"legacyRecovery": {
"title": "舊版本插件正在等待恢復",
"deferred": "檢測到 {{count}} 箇舊插件目錄。為避免其它例項仍在使用這些資料,Cindy 暫緩了自動恢復。",
@@ -3419,6 +3428,7 @@
"groupSeparator": "、"
},
"toast": {
+ "reapproved": "已恢復「{{name}}」",
"installed": "已安裝「{{name}}」",
"uninstalled": "已解除安裝「{{name}}」",
"installedAsleep": "已安裝「{{name}}」(未生效,可在此開啟)",
@@ -3561,6 +3571,7 @@
"errors": {
"fileInvalid": "不是合法的 .cindy 插件檔案",
"alreadyInstalled": "這個插件已經安裝",
+ "approvalRequired": "繼續前需要重新確認這個插件的權限",
"commandConflict": "它的指令和已裝插件撞名了,先解除安裝佔用方或讓作者改名",
"idReserved": "該 id 使用了官方保留字首 cindy-,僅隨應用內建的插件可用",
"sourceMissing": "找不到所選檔案",
@@ -3667,6 +3678,11 @@
"slotWorkspace": "工作區任務"
},
"commandPaletteTag": "插件指令",
+ "reapproveConfirm": {
+ "title": "重新確認「{{name}}」的權限?",
+ "body": "按下方清單重新授權這個已安裝的插件,不需要重新提供安裝包檔案。",
+ "confirm": "確認並恢復"
+ },
"updateConfirm": {
"title": "更新插件「{{name}}」?",
"body": "版本 {{from}} → {{to}}。將替換現有版本;生效狀態與面板位置保持不變。",
diff --git a/docs/dev-rules/plugin-approval-main-merge-2026-08-09.md b/docs/dev-rules/plugin-approval-main-merge-2026-08-09.md
index a4a431dc14..2ea4598f3b 100644
--- a/docs/dev-rules/plugin-approval-main-merge-2026-08-09.md
+++ b/docs/dev-rules/plugin-approval-main-merge-2026-08-09.md
@@ -12,6 +12,12 @@ security rules.
malformed, pending, mismatched, or durability-uncertain state fails closed.
- Every owner-bound Ghost, Agent, broker, slot, skill-link, and IPC consumer must
use the same durable owner and in-process owner generation.
+- General Cindy account capabilities are also fail-closed unless the durable
+ projection marker is `stable` for the active data owner; releasing an in-memory
+ session boundary alone must not reopen cloud services after an uncertain commit.
+- Ghost mutation owner capture and lease acquisition re-check durable owner
+ stability at the mutation boundary, so a pending or mismatched marker cannot be
+ bypassed by a previously captured in-memory session.
- Passive shared-userData instances are read-only for the global projection. They
must not sweep links, publish a different owner, or turn a primary owner's
projection into another account's projection.