feat: prepare Zhinian desktop pilot
Some checks failed
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled

This commit is contained in:
inman
2026-05-07 21:49:20 +08:00
parent cddaf37016
commit 0abc48189c
103 changed files with 10975 additions and 2049 deletions

View File

@@ -359,7 +359,7 @@ describe('sanitizeOpenClawConfig', () => {
it('properly sanitizes a genuinely empty {} config (fresh install)', async () => {
// A fresh install with {} is a valid config — sanitize should proceed
// and enforce tools.profile, commands.restart, etc.
// and enforce the desktop tools profile, commands.restart, etc.
await writeOpenClawJson({});
const { sanitizeOpenClawConfig } = await import('@electron/utils/openclaw-auth');
@@ -371,7 +371,35 @@ describe('sanitizeOpenClawConfig', () => {
const result = JSON.parse(await readFile(configPath, 'utf8')) as Record<string, unknown>;
// Fresh install should get tools settings enforced
const tools = result.tools as Record<string, unknown>;
expect(tools.profile).toBe('full');
expect(tools.profile).toBe('coding');
logSpy.mockRestore();
});
it('removes deprecated plugins.bundledDiscovery before Gateway start', async () => {
await writeOpenClawJson({
plugins: {
allow: ['agentbus'],
bundledDiscovery: 'compat',
entries: {
agentbus: { enabled: true },
},
},
});
const { sanitizeOpenClawConfig } = await import('@electron/utils/openclaw-auth');
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
await sanitizeOpenClawConfig();
const result = await readOpenClawJson();
expect((result.plugins as Record<string, unknown>).bundledDiscovery).toBeUndefined();
expect(result.plugins).toMatchObject({
allow: ['agentbus'],
entries: {
agentbus: { enabled: true },
},
});
logSpy.mockRestore();
});
@@ -399,7 +427,37 @@ describe('sanitizeOpenClawConfig', () => {
});
// tools settings should now be enforced
const tools = result.tools as Record<string, unknown>;
expect(tools.profile).toBe('full');
expect(tools.profile).toBe('coding');
logSpy.mockRestore();
});
it('sets Yinian managed agents to lightweight skill loading', async () => {
await writeOpenClawJson({
models: {
providers: {
minimax: {
baseUrl: 'https://api.minimaxi.com/anthropic',
api: 'anthropic-messages',
},
},
},
agents: {
defaults: {
model: { primary: 'minimax/MiniMax-M2.7' },
},
},
});
const { sanitizeOpenClawConfig } = await import('@electron/utils/openclaw-auth');
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
await sanitizeOpenClawConfig();
const result = await readOpenClawJson();
const defaults = (result.agents as Record<string, unknown>).defaults as Record<string, unknown>;
expect(defaults.skills).toEqual([]);
expect(defaults.heartbeat).toMatchObject({ every: '0m' });
logSpy.mockRestore();
});
@@ -505,7 +563,7 @@ describe('sanitizeOpenClawConfig', () => {
expect(dingtalk.clientSecret).toBe('dt-secret');
});
it('removes stale minimax-portal-auth plugin entries when merged minimax plugin is installed', async () => {
it('trims Yinian managed plugins to the core desktop plugin surface', async () => {
await writeOpenClawJson({
plugins: {
allow: ['minimax-portal-auth', 'custom-plugin'],
@@ -550,11 +608,11 @@ describe('sanitizeOpenClawConfig', () => {
const result = await readOpenClawJson();
const plugins = result.plugins as Record<string, unknown>;
const allow = plugins.allow as string[];
const entries = plugins.entries as Record<string, Record<string, unknown>>;
const entries = (plugins.entries || {}) as Record<string, Record<string, unknown>>;
expect(allow).toEqual(['custom-plugin']);
expect(new Set(allow)).toEqual(new Set(['minimax', 'cloud-sync']));
expect(entries['minimax-portal-auth']).toBeUndefined();
expect(entries['custom-plugin']).toEqual({ enabled: true });
expect(entries['custom-plugin']).toBeUndefined();
});
});