feat: 完成 Agent MCP 对接

- 增加 MCP 连接类型、环境检测接口和容器运行环境支持

- 将 Agent 编排改为绑定整体 MCP 并编译为 runtime McpSpec

- 优化 MCP 工具展示、审批、草稿试运行和画布回显稳定性
This commit is contained in:
2026-05-29 11:09:21 +08:00
parent e39f7521e2
commit cc3bb9cff0
33 changed files with 2405 additions and 127 deletions

View File

@@ -111,6 +111,49 @@ describe('agentTimelineAdapter', () => {
).toBe(true);
});
it('uses tool display name when restoring aliased MCP tools from history', () => {
const items = recordsToTimelineItems([
{
id: 'mcp-history',
senderRole: 'assistant',
contentText: '已完成',
roundId: 'round-mcp',
contentPayload: {
chains: [
{
id: 'tool-mcp-1',
name: 'mcp_123_search',
toolDisplayName: 'Context MCP - search',
status: 'TOOL_RESULT',
result: 'ok',
},
],
messageChain: [
{
role: 'assistant',
toolCalls: [
{
id: 'tool-mcp-1',
name: 'mcp_123_search',
toolDisplayName: 'Context MCP - search',
arguments: '{}',
},
],
},
{
role: 'tool',
toolCallId: 'tool-mcp-1',
content: 'ok',
},
],
},
},
]);
const tool = items.find((item) => item.type === 'tool');
expect(tool?.toolName).toBe('Context MCP - search');
});
it('hides knowledge retrieval cards when restoring agent chat history', () => {
const items = recordsToTimelineItems([
{