Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
Merge main into plugin namespace recovery
Zhao Dengfeng5ec21c7711ad
diff --cc apps/desktop/src/main/maker-host/built-in-skills.tsindex 91ca66daf8,39c3388972..1944bc81b9--- a/apps/desktop/src/main/maker-host/built-in-skills.ts+++ b/apps/desktop/src/main/maker-host/built-in-skills.ts@@@ -25,7 -25,7 +25,7 @@@ const VERSIONS_DIRECTORY = '.versions'const ACTIVE_BUNDLE_LINK = '.active';const BUILT_IN_SKILL_MUTATION_WAIT_MS = 5_000;/** Increment whenever shipped built-in Skill bytes change between releases. */- export const BUILT_IN_SKILLS_BUNDLE_VERSION = 17;-export const BUILT_IN_SKILLS_BUNDLE_VERSION = 18;++export const BUILT_IN_SKILLS_BUNDLE_VERSION = 19;const PLUGIN_CREATOR_FIRST_BUNDLE_VERSION = 13;export interface BuiltInSkillDescriptor {diff --cc apps/desktop/src/main/mcp-integrations/__tests__/ghostWorkdirGate.test.tsindex 64f75a0aec,c831eae835..e6008a754c--- a/apps/desktop/src/main/mcp-integrations/__tests__/ghostWorkdirGate.test.ts+++ b/apps/desktop/src/main/mcp-integrations/__tests__/ghostWorkdirGate.test.ts@@@ -1369,85 -1369,6 +1369,85 @@@ describe('connect_account ordinary tas});describe('花名册 / ghost_list 过滤', () => {+ // PR #6434: list already hides an unavailable owner projection; wrong-address+ // info/manual/call/setup must preserve that boundary before any side effect.+ it.each(['claude-code', 'codex', 'pi'] as const)(+ '%s hides namespace recovery targets while the active owner is unavailable', async (agentKind) => {+ listMock.mockReturnValue([{+ ...(chipGhost('art', ['tool']) as object),+ namespace: 'outgoing-owner',+ dir: path.join(tmpUserData, '_ns', 'outgoing-owner', 'art'),+ }]);+ activeSessionAvailableMock.mockReturnValue(false);+ const deps = makeDeps(agentKind);+ expect(JSON.parse((await handleGhostList(deps)).content[0].text).ghosts).toEqual([]);+ const target = { ghost_id: 'art', namespace: null };+ for (const result of [+ await handleGhostInfo(deps, target),+ await handleGhostManual(deps, target),+ await handleGhostCall(deps, { ...target, tool: 'run', attachments: ['cindy-media://blobs/example.png'] }),+ ]) {+ expect(result.isError).toBe(true);- expect(JSON.parse(result.content[0].text)).toMatchObject({ ok: false, errorCode: 'GHOST_NOT_FOUND' });- expect(result.content[0].text).not.toContain('outgoing-owner');++ expect(JSON.parse((result.content[0] as { text: string }).text)).toMatchObject({ ok: false, errorCode: 'GHOST_NOT_FOUND' });++ expect((result.content[0] as { text: string }).text).not.toContain('outgoing-owner');+ }+ const connection = await deps.connectAccount!({ kind: 'plugin', id: 'art', namespace: null });+ expect(connection).toMatchObject({ ok: false, errorCode: 'GHOST_NOT_FOUND' });+ expect(JSON.stringify(connection)).not.toContain('outgoing-owner');+ expect(ensureReadyMock).not.toHaveBeenCalled();+ expect(grantAttachmentsMock).not.toHaveBeenCalled();+ expect(dispatchMock).not.toHaveBeenCalled();+ },+ );++ // Regression: a listed root was repeatedly addressed with the string "null".+ // Exercise the real MCP handlers and host resolver with the same session deps;+ // a rejected address must never reach setup, attachment grants or dispatch.+ it.each(['claude-code', 'codex', 'pi'] as const)(+ '%s recovers in the same session after correcting a quoted null namespace', async (agentKind) => {+ listMock.mockReturnValue([{+ ...(chipGhost('art', ['tool'], {+ manual: { items: [{ dir: 'docs', name: 'guide', description: 'Usage guide' }] },+ }) as object),+ namespace: null,+ dir: path.join(tmpUserData, '_ns', '_root', 'art'),+ }]);+ const deps = makeDeps(agentKind);+ const listed = JSON.parse((await handleGhostList(deps)).content[0].text).ghosts[0];+ expect(listed).toMatchObject({ id: 'art', namespace: null });+ const wrong = { ghost_id: listed.id, namespace: 'null' };+ const results = [+ await handleGhostInfo(deps, wrong),+ await handleGhostManual(deps, wrong),+ await handleGhostCall(deps, { ...wrong, tool: 'run', attachments: ['cindy-media://blobs/example.png'] }),+ ];+ const target = { ghost_id: listed.id, namespace: listed.namespace };+ for (const result of results) {+ expect(result.isError).toBe(true);- const payload = JSON.parse(result.content[0].text);++ const payload = JSON.parse((result.content[0] as { text: string }).text);+ expect(payload).toMatchObject({ ok: false, errorCode: 'GHOST_NAMESPACE_MISMATCH' });+ expect(payload.message).toContain(JSON.stringify(target));+ }+ await expect(deps.connectAccount!({ kind: 'plugin', id: 'art', namespace: 'null' }))+ .resolves.toMatchObject({ ok: false, errorCode: 'GHOST_NAMESPACE_MISMATCH' });+ expect(ensureReadyMock).not.toHaveBeenCalled();+ expect(grantAttachmentsMock).not.toHaveBeenCalled();+ expect(dispatchMock).not.toHaveBeenCalled();+ expect(JSON.parse((await handleGhostInfo(deps, target)).content[0].text))+ .toMatchObject({ ok: true, ghost: { id: 'art', namespace: null } });+ expect(JSON.parse((await handleGhostManual(deps, target)).content[0].text))+ .toMatchObject({ ok: true, manual: [{ name: 'guide' }] });- expect(JSON.parse((await handleGhostCall(deps, { ...target, tool: 'run' })).content[0].text))++ expect(JSON.parse(((await handleGhostCall(deps, { ...target, tool: 'run' })).content[0] as { text: string }).text))+ .toMatchObject({ ok: true, result: 'done' });+ expect(dispatchMock).toHaveBeenCalledOnce();+ expect(dispatchMock).toHaveBeenCalledWith(expect.objectContaining({ ghostId: '_root__art' }));+ setGhostDisabledForWorkdir(WORKDIR, '_root__art', true);- expect(JSON.parse((await handleGhostCall(deps, { ...target, tool: 'run' })).content[0].text))++ expect(JSON.parse(((await handleGhostCall(deps, { ...target, tool: 'run' })).content[0] as { text: string }).text))+ .toMatchObject({ ok: false, errorCode: 'GHOST_DISABLED_IN_WORKDIR' });+ expect(dispatchMock).toHaveBeenCalledOnce();+ },+ );+it.each((['claude-code', 'codex', 'pi'] as const).flatMap((agentKind) => [true, false].map((pending) => ({ agentKind, pending })),))(