合并远程主分支客户端收口

This commit is contained in:
2026-08-13 17:13:36 +08:00
240 changed files with 4900 additions and 20399 deletions

View File

@@ -22,6 +22,36 @@ test.describe('OpenCode image compression composer', () => {
updatedAt: '2026-07-18T00:00:00.000Z',
lastOpenedAt: '2026-07-18T00:00:00.000Z',
};
const agent = {
id: 'game-development',
avatarId: 'avatar-01',
roleName: 'Game Developer',
name: 'Game Developer',
builtIn: false,
enabled: true,
model: 'niancode-user-models/qwen3.7-plus',
skillIds: [],
responsibility: {
mission: 'Build and verify the project.',
owns: [],
boundaries: [],
collaborators: [],
principles: [],
},
prompt: '',
archivedAt: null,
pinned: false,
};
const projectConfig = {
schemaVersion: 1,
projectType: 'custom',
initialized: true,
defaultModel: agent.model,
agents: [agent],
knowledgeDirectory: 'knowledge',
createdAt: '2026-07-18T00:00:00.000Z',
updatedAt: '2026-07-18T00:00:00.000Z',
};
const respond = (json: unknown, status = 200) => ({
ok: true,
data: {
@@ -44,7 +74,37 @@ test.describe('OpenCode image compression composer', () => {
url: 'http://127.0.0.1:4096',
});
}
if (path.startsWith('/api/opencode/projects')) {
if (path.startsWith('/api/opencode/projects/config?')) {
return respond({
status: 'valid',
config: projectConfig,
knowledgeFiles: [],
});
}
if (path.startsWith('/api/opencode/projects/template?')) {
return respond({ status: 'missing' });
}
if (path.startsWith('/api/opencode/projects/conversations?')) {
return respond({
state: {
schemaVersion: 1,
sessions: [{
sessionId: 'ses_e2e_compression',
agentId: agent.id,
archivedAt: null,
unreadCount: 0,
createdAt: '2026-07-18T00:00:00.000Z',
updatedAt: '2026-07-18T00:00:00.000Z',
}],
updatedAt: '2026-07-18T00:00:00.000Z',
},
});
}
if (
path === '/api/opencode/projects'
|| path.startsWith('/api/opencode/projects?')
|| (path === '/api/opencode/projects/active' && method === 'GET')
) {
return respond({ projects: [activeProject], activeProject });
}
if (path === '/api/opencode/config-summary') {
@@ -60,6 +120,7 @@ test.describe('OpenCode image compression composer', () => {
sessions: [{
id: 'ses_e2e_compression',
title: 'Image compression',
agent: agent.id,
updatedAt: '2026-07-18T00:00:00.000Z',
}],
});
@@ -88,9 +149,14 @@ test.describe('OpenCode image compression composer', () => {
const page = await getStableWindow(app);
await page.reload();
await expect(page.getByTestId('sidebar-nav-agent-chat')).toBeVisible();
await page.getByTestId('sidebar-nav-agent-chat').click();
await expect(page.getByTestId('opencode-message-composer')).toBeVisible();
await expect(page.getByTestId('ai-module-selection-page')).toBeVisible();
await page.getByTestId('ai-module-option-programming').click();
const composer = page.getByTestId('opencode-message-composer');
await expect(composer).toBeVisible();
const projectAgent = page.getByTestId('project-agent-chat-game-development');
await projectAgent.click();
await expect(projectAgent).toHaveAttribute('aria-pressed', 'true');
await expect(composer.getByRole('button').first()).toBeEnabled();
const png = await sharp({
create: {