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(teammates): align model and plugin setup guidance

zqchris105309069f8c
diff --git a/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts b/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts
index d120e8f293..6c5ddf5779 100644
--- a/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts
+++ b/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts
@@ -1665,6 +1665,11 @@ describe('Bot canonical Session lifecycle', () => {
'/userdata/managed-teammate-skills/v1',
'/userdata/bot-skills/bot-1',
]);
+ expect(opts.botProfileContextPrompt).toContain('Use `update_teammate_profile`');
+ expect(opts.botProfileContextPrompt).not.toContain('direct the user to the teammate’s model settings');
+ expect(opts.botProfileContextPrompt).toContain('login/configuration card is already in this chat');
+ expect(opts.botProfileContextPrompt).toContain('End the turn and wait for the Host authorization-completed notification');
+ expect(opts.botProfileContextPrompt).not.toContain('This remote runtime does not provide');
// 用户配的 Skill 那一栏不受影响。
expect(opts.botRuntimeProfile?.skillPolicy.catalog).toEqual([]);
});
@@ -1704,7 +1709,18 @@ describe('Bot canonical Session lifecycle', () => {
expect(opts.botProfileContextPrompt).toContain('`create_teammate`');
expect(opts.botProfileContextPrompt).toContain('`start_session_task`');
expect(opts.botProfileContextPrompt).toContain('Respect the user’s memory switch');
- if (agentKind === 'pi') expect(opts.botProfileContextPrompt).toContain('`ghost_list`, `ghost_info`, `ghost_call`');
+ expect(opts.botProfileContextPrompt).toContain('Use `update_teammate_profile`');
+ expect(opts.botProfileContextPrompt).not.toContain('direct the user to the teammate’s model settings');
+ expect(opts.botProfileContextPrompt).not.toContain('login/configuration card is already in this chat');
+ expect(opts.botProfileContextPrompt).not.toContain('End the turn and wait for the Host authorization-completed notification');
+ if (agentKind === 'pi') {
+ expect(opts.botProfileContextPrompt).toContain('`ghost_list`, `ghost_info`, `ghost_call`');
+ expect(opts.botProfileContextPrompt).toContain('This remote runtime does not provide plugin authorization cards');
+ expect(opts.botProfileContextPrompt).toContain('Plugins page on the trusted desktop');
+ expect(opts.botProfileContextPrompt).toContain('after the user confirms readiness');
+ } else {
+ expect(opts.botProfileContextPrompt).not.toContain('`ghost_call`');
+ }
});
it.each(['canonical', 'delegation'] as const)('rejects remote %s personal Skill access before local storage or refresh', async (role) => {
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/botProfileRuntime.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/botProfileRuntime.test.ts
index 72f0a88ad5..70b57164e1 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/botProfileRuntime.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/botProfileRuntime.test.ts
@@ -54,7 +54,10 @@ describe('Bot Profile runtime prompt', () => {
expect(context).toContain('current SOUL and user profile');
expect(context).toContain('execution engines, not your personal identity');
expect(context).toContain('context compaction, restarts, and model changes');
- expect(context).toContain('teammate’s model settings in Cindy');
+ expect(context).toContain('Use available host tools for model changes');
+ expect(context).toContain('Connecting a new model or signing in to a provider is managed in Cindy settings');
+ expect(context).not.toContain('direct the user to the teammate’s model settings');
+ expect(context).not.toContain('claim access to settings you cannot operate');
expect(context).toContain('Do not present terminal-only slash commands');
});
diff --git a/apps/desktop/src/main/maker-ipc/botProfileRuntime.ts b/apps/desktop/src/main/maker-ipc/botProfileRuntime.ts
index bd0b89c155..3d81b5903d 100644
--- a/apps/desktop/src/main/maker-ipc/botProfileRuntime.ts
+++ b/apps/desktop/src/main/maker-ipc/botProfileRuntime.ts
@@ -283,7 +283,7 @@ export function buildBotProfileContextPrompt(displayName: string): string {
`Active Cindy Bot profile: ${name}.`,
'Your name is the active profile name; your personality, role, and relationship with the user come from the current SOUL and user profile. Keep them consistent across replies, context compaction, restarts, and model changes. Do not reverse who is the boss or invent a relationship from habitual forms of address. Correct earlier replies that conflict with the current profile instead of treating them as identity facts.',
'The user is talking to this named teammate inside Cindy. Pi, Claude Code, and Codex are execution engines, not your personal identity or the user-facing application. Their native coding instructions describe how to use tools; they do not replace your profile. If asked about the engine or model, distinguish it from your identity and only state runtime facts you can verify.',
- 'For changing this teammate’s model, direct the user to the teammate’s model settings in Cindy; connecting a model is managed in Cindy settings. Do not present terminal-only slash commands such as /login or /model as commands available in this chat, assume the user is in a Pi terminal, or claim access to settings you cannot operate. When the exact Cindy entry is unknown, say so rather than inventing steps. When the user asks about a native CLI, explain which instructions belong to that terminal. This distinction does not restrict native tools, Pi package management, extensions, or self-repair.',
+ 'Use available host tools for model changes and verify their results before claiming a change. Connecting a new model or signing in to a provider is managed in Cindy settings. Do not present terminal-only slash commands such as /login or /model as commands available in this chat or assume the user is in a Pi terminal. When the exact Cindy entry is unknown, say so rather than inventing steps. When the user asks about a native CLI, explain which instructions belong to that terminal. This distinction does not restrict native tools, Pi package management, extensions, or self-repair.',
].join('\n');
}
@@ -865,7 +865,10 @@ export async function hydrateBotProfileRuntime(
// Delegation children keep Cindy's normal Session prompt plus their
// narrow task context.
...(row.role === 'canonical'
- ? [buildBotCapabilityContextPrompt({ helperAvailable, cindyAvailable, ownSkillsEnabled: promptCapabilities.ownSkillsEnabled })]
+ ? [buildBotCapabilityContextPrompt({ helperAvailable, cindyAvailable,
+ ownSkillsEnabled: promptCapabilities.ownSkillsEnabled,
+ // Same local canonical boundary as isBotAuthorizationSession; remote Pi still has plugins.
+ pluginAuthorizationCardsEnabled: opts.remoteHostId == null })]
: []),
],
};
diff --git a/apps/desktop/src/main/maker-ipc/teammateGuide.ts b/apps/desktop/src/main/maker-ipc/teammateGuide.ts
index 5e28a17b16..4493b27974 100644
--- a/apps/desktop/src/main/maker-ipc/teammateGuide.ts
+++ b/apps/desktop/src/main/maker-ipc/teammateGuide.ts
@@ -5,7 +5,7 @@ export const TEAMMATE_GUIDE_NAME = 'teammate-guide';
export const TEAMMATE_GUIDE_DESCRIPTION = 'Shared operating procedures for every teammate: manage tasks, contact and create teammates, change model defaults, use tools, and maintain personal Skills and memory.';
export function buildTeammateGuide(
- options: { helperAvailable?: boolean; cindyAvailable?: boolean; ownSkillsEnabled?: boolean } = {},
+ options: { helperAvailable?: boolean; cindyAvailable?: boolean; ownSkillsEnabled?: boolean; pluginAuthorizationCardsEnabled?: boolean } = {},
): string {
const helperAvailable = options.helperAvailable !== false;
// Use the same capability signal as runtime Skill mounting and learning.
@@ -15,8 +15,11 @@ export function buildTeammateGuide(
// plugins there would tell the model to call tools it cannot reach. Remote Pi
// tunnels cindy, so keep plugin guidance there.
const cindyAvailable = options.cindyAvailable !== false;
+ const pluginSetupGuidance = options.pluginAuthorizationCardsEnabled === false
+ ? ' This remote runtime does not provide plugin authorization cards or completion notifications. If a plugin returns SETUP_REQUIRED, the requested tool has not run. Ask the user to open the application’s Plugins page on the trusted desktop and complete that plugin’s connection or configuration, then retry the original work after the user confirms readiness. Do not wait for an authorization-completed notification, poll, request credentials in chat, invent login links, or treat login as task execution approval.'
+ : ' When a plugin returns SETUP_REQUIRED with an authorization request id, its login/configuration card is already in this chat and the requested tool has not run. End the turn and wait for the Host authorization-completed notification, then continue the original work through the live plugin tool. Do not poll, ask for credentials in chat, invent login links, or treat login as task execution approval. The phone can display/cancel the card; connection and secret entry happen on the trusted desktop.';
const pluginGuidance = cindyAvailable
- ? ' Installed plugins are a separate discovery surface from Skill/MCP/toolset references. An empty capability search does not mean no plugin can do the work. Before declaring a connected-service task unavailable, inspect the relevant installed plugin. Installed plugins are available on demand through the installed-plugin gateway (`ghost_list`, `ghost_info`, `ghost_call`) under their existing permissions. When a plugin returns SETUP_REQUIRED with an authorization request id, its login/configuration card is already in this chat and the requested tool has not run. End the turn and wait for the Host authorization-completed notification, then continue the original work through the live plugin tool. Do not poll, ask for credentials in chat, invent login links, or treat login as task execution approval. The phone can display/cancel the card; connection and secret entry happen on the trusted desktop.'
+ ? ' Installed plugins are a separate discovery surface from Skill/MCP/toolset references. An empty capability search does not mean no plugin can do the work. Before declaring a connected-service task unavailable, inspect the relevant installed plugin. Installed plugins are available on demand through the installed-plugin gateway (`ghost_list`, `ghost_info`, `ghost_call`) under their existing permissions.' + pluginSetupGuidance
: '';
return [
'## teammate-guide — 伙伴使用指南',
diff --git a/docs/product-rules/bot-authorization-cards.md b/docs/product-rules/bot-authorization-cards.md
index d6e5aa3211..86c680d4ca 100644
--- a/docs/product-rules/bot-authorization-cards.md
+++ b/docs/product-rules/bot-authorization-cards.md
@@ -41,7 +41,9 @@ Grok 的 MCP 后端 state TTL 不能直接套给 Grok 订阅登录或所有插
- #4066 的发送与各 harness 工具暴露修复不在本改动重复实现。两边无新 schema 依赖,可分别合入。
- 不修改插件 manifest、安装批准记录、凭证布局或数据库 schema;不要求存量插件重新配置。
- 手机经已有消息同步显示授权状态并可取消,授权/密钥输入仍在可信电脑端。无原生指纹变更。
-- SSH Agent 不因该工具获得本机凭证;请求要求可交互的本机伙伴主任务。
+- SSH Agent 不因该工具获得本机凭证;请求要求可交互的本机伙伴主任务。远端 Pi 仍可发现和调用
+ 实际可用插件,但缺配置时不承诺聊天授权卡或完成通知;指向可信 Desktop 的插件连接页,
+ 用户确认配置完成后再重试。手机控制本机伙伴仍保留原授权卡与自动续接。
- 没有修改 device-link 重试、relay 或断链恢复;故障范围是单张卡。
## 完成提交边界