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。

merge: keep SSH Codex MCP gating and paused route previews

zqchriscf73b0adccbc
diff --cc apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts
index 7be90e0f78,6feb8f96f6..39de8d16e3
--- a/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts
+++ b/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts
@@@ -2142,21 -2087,7 +2087,25 @@@ describe('Bot canonical Session lifecyc
const created = await invoke('local-db:bots:create-canonical-session', {
botId: 'bot-1', expectedCanonicalSessionId: null, expectedProfileVersion: 1,
});
- const service = createBotCapabilityService(capabilityDeps);
+ const current = { agentKind: 'pi' as const, model: 'grok-4.5', providerId: null, effort: null, fastMode: false };
+ const chain: BotModelRoute[] = [{ harness: 'pi', model: 'grok-4.5', providerId: null, effort: '', fastMode: false }];
+ const profileStatus = () => h.sqlite!.prepare("SELECT status FROM bot_profiles WHERE id = 'bot-1'").pluck().get() as string;
+ const apply = vi.fn();
+ const reconcile = createBotModelRouteReconciler({
+ ownerEpoch: () => h.ownerScopeKey,
- read: async () => profileStatus() === 'active' ? { chain, current, hasRuntimeOverride: false } : null,
- readPreview: async () => ['active', 'paused'].includes(profileStatus())
- ? { chain, current, hasRuntimeOverride: false } : null,
++ read: async (_id, purpose) => {
++ const status = profileStatus();
++ if (purpose === 'preview') {
++ return ['active', 'paused'].includes(status) ? { chain, current, hasRuntimeOverride: false } : null;
++ }
++ return status === 'active' ? { chain, current, hasRuntimeOverride: false } : null;
++ },
+ apply,
+ });
+ const service = createBotCapabilityService({
+ ...capabilityDeps,
+ resolveBotAgentKind: async (id, draft) => (await reconcile.preview(id, draft))?.agentKind ?? null,
+ });
h.validateCapabilityAdditions.mockImplementation(service.validateAdditions);
h.sqlite!.prepare("UPDATE bot_profiles SET status = 'paused' WHERE id = 'bot-1'").run();
await expect(selectBotCapability({
diff --cc apps/desktop/src/main/maker-host/botMcpCatalog.ts
index a4aacb87f7,055a092161..ee96646e7e
--- a/apps/desktop/src/main/maker-host/botMcpCatalog.ts
+++ b/apps/desktop/src/main/maker-host/botMcpCatalog.ts
@@@ -2,23 -2,6 +2,24 @@@ import type { McpProvider, McpProviderC
import type { McpTransport } from '../../shared/customMcp.js';
import { isPiCustomMcpProviderAvailable } from '../mcp-integrations/piMcpTransport.js';
+function isCustomMcpAvailable(input: {
+ agentKind: McpProviderContext['agentKind'];
+ remoteHostId?: string | null;
+ provider: McpProvider;
+ custom?: { transport: McpTransport };
+}): boolean {
- // SSH Claude/Codex only inject REMOTE_ALLOWED_SERVER_NAMES. Neither remote
- // path serializes user MCP configs onto the daemon; advertising them here
- // would let discovery and settings grant a transport the next turn cannot use.
- if (input.remoteHostId && input.agentKind !== 'pi') return false;
- // Evaluate registered user configs using Pi's actual serialization and URL gate.
++ // SSH Codex receives only REMOTE_ALLOWED_SERVER_NAMES; user configs are not
++ // written into its daemon. Remote Claude serializes http/sse into startParams,
++ // and remote Pi tunnels custom servers through the existing URL gate.
++ if (input.agentKind === 'codex') {
++ return !input.remoteHostId && input.custom?.transport !== 'sse';
++ }
+ if (input.agentKind === 'pi' && input.custom) {
+ return isPiCustomMcpProviderAvailable(input.provider);
+ }
- return input.agentKind !== 'codex' || input.custom?.transport !== 'sse';
++ return true;
+}
+
/** Freeze only metadata; compatibility is recomputed for each actual start route. */
export function buildBotMcpCatalog(input: {
agentKind: McpProviderContext['agentKind'];