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): iOS 模拟器只认插件开关,从工具页拿掉入口 (#3607)

Dash310439ddfd2e
diff --git a/apps/desktop/src/main/maker-host/index.ts b/apps/desktop/src/main/maker-host/index.ts
index 4df144a926..b00e9ebc08 100644
--- a/apps/desktop/src/main/maker-host/index.ts
+++ b/apps/desktop/src/main/maker-host/index.ts
@@ -763,23 +763,9 @@ export function getMaker(): Maker {
const resolveIOSSimulatorAccess = (context?: IOSSimulatorMcpCallContext) => {
const workingDir = context?.workingDir?.trim() || null;
- const pluginAccess = getIOSSimulatorPluginAccessDecision(workingDir);
- if (!pluginAccess.allowed) return pluginAccess;
- if (!pluginRegistry.isEnabled('ios-simulator', workingDir ?? undefined)) {
- return {
- allowed: false as const,
- errorCode: 'IOS_SIMULATOR_DISABLED' as const,
- message:
- 'The embedded iOS Simulator capability is disabled for the current project. Enable it in the project plugin settings before retrying the embedded tool; other iOS workflows are unaffected.',
- data: {
- reason: 'disabled-in-workdir',
- action: 'enable-plugin',
- pluginId: 'ios-simulator',
- pluginName: 'iOS Simulator',
- },
- };
- }
- return { allowed: true as const };
+ // Product access is the installed plugin (enable + workdir disable).
+ // Leftover Tools-page `builtinTools['ios-simulator']` must not gate runtime.
+ return getIOSSimulatorPluginAccessDecision(workingDir);
};
const makerMemoryProviderDeps = {
diff --git a/apps/desktop/src/main/maker-host/plugins/__tests__/plugin-registry.test.ts b/apps/desktop/src/main/maker-host/plugins/__tests__/plugin-registry.test.ts
index 5614a6bc82..65cb666b4e 100644
--- a/apps/desktop/src/main/maker-host/plugins/__tests__/plugin-registry.test.ts
+++ b/apps/desktop/src/main/maker-host/plugins/__tests__/plugin-registry.test.ts
@@ -120,25 +120,26 @@ describe('PluginRegistry — scoped priority', () => {
expect(state.projectOverride).toBeNull();
});
- it('enables the embedded iOS Simulator by default but respects an explicit project disable', async () => {
+ it('hides the embedded iOS Simulator from Tools and ignores leftover Tools settings at runtime freeze', async () => {
+ expect(HOSTED_ELSEWHERE_PLUGIN_IDS.has('ios-simulator')).toBe(true);
expect(registry.isEnabled('ios-simulator')).toBe(true);
expect(registry.isEnabled('ios-simulator', workingDir)).toBe(true);
- await expect(registry.getEnableState('ios-simulator', workingDir)).resolves.toMatchObject({
- effectiveEnabled: true,
- productDefaultEnabled: true,
- projectOverride: null,
- userOverride: null,
- });
+ expect((await registry.listPlugins(workingDir)).map((item) => item.id)).not.toContain(
+ 'ios-simulator',
+ );
+ expect((await registry.listPlugins()).map((item) => item.id)).not.toContain('ios-simulator');
+ expect(registry.getDisabledRuntimePluginIds(workingDir)).not.toContain('ios-simulator');
writeProjectSettings(workingDir, { 'ios-simulator': false });
registry = createRegistry();
+ // Leftover xdtMaker.builtinTools['ios-simulator'] still parses, but must not
+ // freeze Codex/Pi MCP off — live access is the Plugins-page gate.
expect(registry.isEnabled('ios-simulator', workingDir)).toBe(false);
- await expect(registry.getEnableState('ios-simulator', workingDir)).resolves.toMatchObject({
- effectiveEnabled: false,
- productDefaultEnabled: true,
- projectOverride: { enabled: false, workingDir },
- });
+ expect(registry.getDisabledRuntimePluginIds(workingDir)).not.toContain('ios-simulator');
+ expect((await registry.listPlugins(workingDir)).map((item) => item.id)).not.toContain(
+ 'ios-simulator',
+ );
});
it('returns true by default with workingDir', () => {
@@ -423,6 +424,7 @@ describe('PluginRegistry — scoped priority', () => {
expect(list.find((item) => item.id === 'android')).toBeUndefined();
expect(list.find((item) => item.id === 'computer')).toBeUndefined();
expect(list.find((item) => item.id === 'contacts')).toBeUndefined();
+ expect(list.find((item) => item.id === 'ios-simulator')).toBeUndefined();
});
it('listPlugins: non-essential defaults to true', async () => {
diff --git a/apps/desktop/src/main/maker-host/plugins/plugin-registry.ts b/apps/desktop/src/main/maker-host/plugins/plugin-registry.ts
index 60586e2b2a..561e8f7850 100644
--- a/apps/desktop/src/main/maker-host/plugins/plugin-registry.ts
+++ b/apps/desktop/src/main/maker-host/plugins/plugin-registry.ts
@@ -245,6 +245,10 @@ export class PluginRegistry {
// Freezing it here would keep an existing Codex thread disabled after
// the project setting is enabled.
plugin.id !== 'collab' &&
+ // iOS Simulator access is the live plugin gate (install / enable /
+ // workdir). Leftover Tools-page builtinTools['ios-simulator'] must not
+ // freeze Codex/Pi MCP off after that toggle left Settings.
+ plugin.id !== 'ios-simulator' &&
!ESSENTIAL_PLUGIN_IDS.has(plugin.id) &&
!GLOBAL_PLUGIN_IDS.has(plugin.id) &&
!this.isEnabled(plugin.id, workingDir),
diff --git a/apps/desktop/src/main/maker-host/plugins/types.ts b/apps/desktop/src/main/maker-host/plugins/types.ts
index 5e9ca561c0..4919a41db1 100644
--- a/apps/desktop/src/main/maker-host/plugins/types.ts
+++ b/apps/desktop/src/main/maker-host/plugins/types.ts
@@ -79,6 +79,9 @@ export const HOSTED_ELSEWHERE_PLUGIN_IDS: ReadonlySet<string> = new Set([
// 智能通讯录的开关在 Settings → 智能通讯录 专属页(contacts-settings-store),
// 「内置工具」列表再出现一个 toggle 会造成双开关困惑。
'contacts',
+ // iOS 模拟器的产品开关只在「插件」页(安装 / 启用 / 当前项目停用)。
+ // Host MCP cindy_ios_simulator 仍留给 Agent 自动化,但不再出现在「内置工具」列表。
+ 'ios-simulator',
]);
/** Builtin plugins that are intentionally opt-in by default.