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: reconcile bot capabilities with main task guidance

zqchris7b8351d44873
diff --cc apps/desktop/src/main/maker-ipc/__tests__/botProfileRuntime.test.ts
index bdcd276a52,78b3aebf69..8f1baf23b0
--- a/apps/desktop/src/main/maker-ipc/__tests__/botProfileRuntime.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/botProfileRuntime.test.ts
@@@ -52,7 -56,7 +56,11 @@@ describe('Bot Profile runtime prompt',
const prompt = buildBotCapabilityContextPrompt();
expect(prompt).toContain('You are running as a Cindy Bot');
expect(prompt).toContain('Use direct Bot tools');
++ expect(prompt).toContain('`find_bot_capabilities`');
++ expect(prompt).toContain('`set_bot_capability`');
++ expect(prompt).toContain('New mounts take effect next turn in this same task');
expect(prompt).toContain('`start_session_task`');
++ expect(prompt).toContain('proactively start independent tasks for coding and medium or large work');
expect(prompt).toContain('`check_session_task`');
expect(prompt).toContain('`message_session_task`');
expect(prompt).toContain('`stop_session_task`');
diff --cc apps/desktop/src/main/maker-ipc/botProfileRuntime.ts
index 3486b4f4e9,db8dea9858..21cf17e436
--- a/apps/desktop/src/main/maker-ipc/botProfileRuntime.ts
+++ b/apps/desktop/src/main/maker-ipc/botProfileRuntime.ts
@@@ -300,8 -304,8 +305,8 @@@ export function buildBotCapabilityConte
'## Cindy Bot Runtime',
'You are running as a Cindy Bot with a durable Profile. This task is one active runtime of that Bot, not an ordinary standalone task.',
...(helperAvailable ? [
- 'Use direct Bot tools named in this prompt without inventorying Cindy. Only when the user asks for an explicitly mounted external capability and its exact tool is unknown, perform one scoped discovery for that capability; do not repeatedly list the whole tool surface.',
+ 'Use direct Bot tools for your own memory, Skills and teammates. When work needs another capability, use `find_bot_capabilities` in the helper bots category to search existing Skills, MCP connections or built-in tools, then `set_bot_capability` to join it. References reuse Cindy installations and authorization; do not copy credentials or edit shared sources. New mounts take effect next turn in this same task. Installed plugins are available on demand through `cindy` (`ghost_list`, `ghost_info`, `ghost_call`) under their existing permissions. Discover only what the work needs; do not repeatedly list the whole tool surface.',
- "A real Cindy background task is a standalone Session in the user's task list. Start it with `start_session_task` when the user explicitly asks for a task, Session, or background task, or when development and deliverable work needs independent execution and verification. Use `check_session_task`, `message_session_task`, and `stop_session_task` to control that same task when needed. Completion returns automatically.",
+ "A real Cindy background task is a standalone Session in the user's task list. Follow the workload split in the `start_session_task` guidance: handle short simple work yourself and proactively start independent tasks for coding and medium or large work. Do not wait for the user to ask for delegation. Use `check_session_task`, `message_session_task`, and `stop_session_task` to control that same task when needed. Completion returns automatically; you remain responsible for reviewing and presenting the result.",
'Use `send_to_agent` only to send one bounded asynchronous message to a named teammate. It is not a task and has no progress or cancellation. Never use a teammate named Cindy as a substitute for `start_session_task`.',
"A teammate message does not rewrite another Bot's identity or make that Bot obey. If the user asks for obedience or control, explain this boundary and offer either a message or a tracked Session task, whichever matches the work.",
] : []),
diff --cc apps/desktop/src/main/mcp-integrations/ghost.ts
index f015e46682,36fd172bf5..805d560109
--- a/apps/desktop/src/main/mcp-integrations/ghost.ts
+++ b/apps/desktop/src/main/mcp-integrations/ghost.ts
@@@ -1344,10 -1348,26 +1346,19 @@@ export function getCindyGhostsMcpDeps
): CindyGhostsMcpDeps {
const resolveSessionContext = (): LiziMcpSessionContext | undefined =>
getLiziMcpSessionContext() ?? sessionCtx;
- const isGhostAllowedByFrozenProfile = (ghostId: string): boolean =>
- isFrozenBuiltinPluginAllowed(resolveSessionContext()?.vendorOptions, ghostId);
- const frozenProfileDenied = () => ({
- ok: false as const,
- errorCode: 'GHOST_DISABLED_IN_WORKDIR' as const,
- message: '当前伙伴配置未启用该插件;不要重试,改用已授权能力,或让用户更新伙伴配置后再试。',
- });
return {
callMedia: async (request) => {
- const result = await callCindyMedia(request);
- const sessionId = resolveSessionContext()?.sessionId;
+ const sessionContext = resolveSessionContext();
+ const sessionId = sessionContext?.sessionId;
+ const downloadContext = (request.action === 'request' || request.action === 'poll') && sessionId && sessionContext?.sessionInstanceId
+ ? hostDeps.createMediaDownloadContext?.(sessionId, sessionContext.sessionInstanceId)
+ : undefined;
+ let result: Record<string, unknown>;
+ try {
+ result = await callCindyMedia(request, downloadContext);
+ } finally {
+ downloadContext?.dispose?.();
+ }
if (request.action === 'resolve_local_path' && result.ok !== false) {
const localPath = typeof result.local_path === 'string' ? result.local_path : '';
const mimeType = typeof result.mime_type === 'string' ? result.mime_type : '';