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): 补完 PR #333 漏删的市场安装 Node 授权调用点

Lizifa6cb192e5ec
diff --git a/apps/desktop/src/main/cindy-brain/__tests__/marketGhostSessionBoundary.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/marketGhostSessionBoundary.test.ts
index 6bd7f1f77c..b897b7634b 100644
--- a/apps/desktop/src/main/cindy-brain/__tests__/marketGhostSessionBoundary.test.ts
+++ b/apps/desktop/src/main/cindy-brain/__tests__/marketGhostSessionBoundary.test.ts
@@ -49,14 +49,13 @@ describe('market Ghost session boundary', () => {
'const mutationOwner = captureGhostMutationOwner();',
);
const inspectIndex = body.indexOf('await manager.inspect(cindyFilePath)');
- const authorizationIndex = body.indexOf('await requestNodeInstallAuthorization(');
const leaseIndex = body.indexOf(
'releaseMutation = beginGhostMutation(mutationOwner);',
);
expect(captureIndex).toBeGreaterThan(-1);
expect(captureIndex).toBeLessThan(inspectIndex);
- expect(authorizationIndex).toBeLessThan(leaseIndex);
+ expect(leaseIndex).toBeGreaterThan(inspectIndex);
expect(body).toContain('releaseMutation?.();');
});
});
diff --git a/apps/desktop/src/main/cindy-brain/index.ts b/apps/desktop/src/main/cindy-brain/index.ts
index b4da660b82..10cd9d6421 100644
--- a/apps/desktop/src/main/cindy-brain/index.ts
+++ b/apps/desktop/src/main/cindy-brain/index.ts
@@ -1848,28 +1848,11 @@ export async function installOrUpdateMarketGhostPackage(
rejectUnauthorizedTokenBroker(inspected.manifest);
const installed = manager.list().find((ghost) => ghost.manifest.id === expected.ghostId);
- if (inspected.manifest.node) {
- const sender = expected.nodeAuthorizationWebContents;
- if (
- !sender ||
- !(await requestNodeInstallAuthorization(
- sender,
- inspected.manifest,
- installed ? 'update' : 'install',
- ))
- ) {
- throwIpcError(
- 'PERMISSION_DENIED',
- sender
- ? '用户取消了 Node Plugin 安装授权'
- : 'Node Plugin 需要用户显式授权,不能自动安装',
- );
- }
- }
+ // Node 高风险条目由 renderer 装入确认卡权限清单如实展示;
+ // 2026-07-24 Lizi 定案:不再有 Main 侧原生二次确认弹窗(PR #333,本处为其
+ // 漏删的市场安装路径调用点,一并对齐)。
// Hold the owner-stability lease only for the actual Ghost filesystem
- // mutation. Node authorization is an unbounded user interaction; keeping
- // the lease across it would block account teardown indefinitely if the
- // dialog is left unanswered.
+ // mutation.
releaseMutation = beginGhostMutation(mutationOwner);
if (!installed) {
// defaultInstall 首次装入即启用;手动市场安装仍保持沉睡,等待用户主动开启。
diff --git a/apps/desktop/src/renderer/cindy-brain/__tests__/installFlow.test.tsx b/apps/desktop/src/renderer/cindy-brain/__tests__/installFlow.test.tsx
index f0eaa4bdd9..90f2bf6afd 100644
--- a/apps/desktop/src/renderer/cindy-brain/__tests__/installFlow.test.tsx
+++ b/apps/desktop/src/renderer/cindy-brain/__tests__/installFlow.test.tsx
@@ -195,16 +195,6 @@ describe('installFlow · tab 型插件「立即开启并打开页签」', () =>
expect(openGhostTab).not.toHaveBeenCalled();
});
- it('Main 原生确认取消(canceled)→ 不打开页签', async () => {
- setupWindow(tabManifest, { canceled: true });
- const openGhostTab = vi.fn(async () => undefined);
- const { deps: d } = tabDeps({ sessionId: 's1', openGhostTab });
-
- await confirmAndInstallGhost('/tmp/tab.cindy', d);
-
- expect(openGhostTab).not.toHaveBeenCalled();
- });
-
it('打开页签失败只记日志:装入成功 toast 不改口、不冒错误', async () => {
setupWindow(tabManifest);
const openGhostTab = vi.fn(async () => {