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。

改为Home加载全局技能

DavidShen7aa6618566e6
diff --git a/apps/desktop/src/renderer/__tests__/slashCommandsDeviceId.test.ts b/apps/desktop/src/renderer/__tests__/slashCommandsDeviceId.test.ts
index 33ee6db55e..79d32531dc 100644
--- a/apps/desktop/src/renderer/__tests__/slashCommandsDeviceId.test.ts
+++ b/apps/desktop/src/renderer/__tests__/slashCommandsDeviceId.test.ts
@@ -70,12 +70,12 @@ describe('loadAllCommands deviceId', () => {
expect(cmds.some((x) => x.kind === 'agent-skill')).toBe(false);
});
- it('本地 Codex 新对话 workingDir=null 时保持不请求 skills/list', async () => {
+ it('本地 Codex 新对话 workingDir=null 时仍加载全局 skills', async () => {
const s = stubElectron();
const cmds = await loadAllCommands('codex', null);
- expect(s.listAgentSkills).not.toHaveBeenCalled();
- expect(cmds.some((x) => x.kind === 'agent-skill')).toBe(false);
+ expect(s.listAgentSkills).toHaveBeenCalledWith('codex', {});
+ expect(cmds.some((x) => x.name === 'localskill')).toBe(true);
});
it('远程会话:agent-builtin / agent-skill 走隧道,desktop 仍本地', async () => {
diff --git a/apps/desktop/src/renderer/lib/slashCommands.ts b/apps/desktop/src/renderer/lib/slashCommands.ts
index 0b7be5562d..6a1260f5ef 100644
--- a/apps/desktop/src/renderer/lib/slashCommands.ts
+++ b/apps/desktop/src/renderer/lib/slashCommands.ts
@@ -109,7 +109,7 @@ export async function loadAllCommands(
? (window.electronAPI.deviceLink.invoke(deviceId, 'maker:list-agent-commands', [agentKind]) as Promise<CmdRes>)
: api.listAgentCommands(agentKind)
).catch(() => ({ success: false }));
- const shouldLoadSkills = !opts?.skipAgentSkills && (agentKind === 'claude-code' || Boolean(workingDir));
+ const shouldLoadSkills = !opts?.skipAgentSkills;
const skillParams = {
...(workingDir ? { workingDir } : {}),
...(opts?.forceReload !== undefined ? { forceReload: opts.forceReload } : {}),
diff --git a/packages/maker-core/src/agents/codex/index.test.ts b/packages/maker-core/src/agents/codex/index.test.ts
index e328c51e9c..c7728ce888 100644
--- a/packages/maker-core/src/agents/codex/index.test.ts
+++ b/packages/maker-core/src/agents/codex/index.test.ts
@@ -2708,6 +2708,19 @@ describe('CodexAgent MCP thread context hooks', () => {
await agent.dispose();
});
+ it('uses the home directory to list global skills for a new conversation without a cwd', async () => {
+ const agent = new CodexAgent(createDeps());
+
+ await expect(agent.listAgentSkills({})).resolves.toMatchObject({ skills: [] });
+
+ const request = createdTransports[0].lines
+ .map((line) => JSON.parse(line) as { method?: string; params?: unknown })
+ .find((line) => line.method === Method.SkillsList);
+ expect(request?.params).toMatchObject({ cwds: [os.homedir()] });
+
+ await agent.dispose();
+ });
+
it('starts a cold OAuth host before account rate-limit RPCs', async () => {
const rateLimits = {
rateLimits: { planType: 'plus', primary: { usedPercent: 100, windowMinutes: 300 } },
diff --git a/packages/maker-core/src/agents/codex/index.ts b/packages/maker-core/src/agents/codex/index.ts
index 6bce253f42..9e62458270 100644
--- a/packages/maker-core/src/agents/codex/index.ts
+++ b/packages/maker-core/src/agents/codex/index.ts
@@ -1160,10 +1160,11 @@ export class CodexAgent extends BaseAgent {
* 只是包成新的 AgentSkillCommand 形状(kind='agent-skill')。
*/
override async listAgentSkills(opts: ListAgentSkillsOptions): Promise<ListAgentSkillsResult> {
- // Codex app-server 的 skills/list 需要 cwd;无项目的新对话保持原先的空列表语义。
- if (!opts.workingDir) return { skills: [] };
+ // Codex app-server 的 skills/list 强制要求 cwd;无项目的新对话用 HOME 作为
+ // 查询上下文,既能发现全局 skills,又不会误带任意项目的 repo skills。
+ const workingDir = opts.workingDir || os.homedir();
try {
- const { skills, errors } = await this.listSkillsForCwd(opts.workingDir, opts.forceReload ?? false);
+ const { skills, errors } = await this.listSkillsForCwd(workingDir, opts.forceReload ?? false);
const out: ListAgentSkillsResult = {
skills: skills
.filter((skill) => skill.enabled)