diff --git a/lib/ccweb-mcp-server.js b/lib/ccweb-mcp-server.js index 4ebf81e..654b183 100644 --- a/lib/ccweb-mcp-server.js +++ b/lib/ccweb-mcp-server.js @@ -38,15 +38,10 @@ const TOOLS = [ }, { name: 'ccweb_create_conversation', - description: '创建一个新的 ccweb 持久对话。只用于需要在会话列表中长期追踪、后续可继续对话的工作流;一次性并行研究应优先使用子代能力。', + description: '创建一个新的 ccweb 持久对话。Agent 固定继承来源对话,不作为参数指定;只用于需要在会话列表中长期追踪、后续可继续对话的工作流;一次性并行研究应优先使用子代能力。', inputSchema: { type: 'object', properties: { - agent: { - type: 'string', - enum: ['claude', 'codex', 'codexapp'], - description: '可选。新对话使用的 Agent,默认继承来源对话。', - }, cwd: { type: 'string', description: '可选。新对话工作目录;指定时必须是已存在的绝对路径,默认继承来源对话 cwd。', diff --git a/scripts/regression.js b/scripts/regression.js index f0d98ac..cfc2b46 100644 --- a/scripts/regression.js +++ b/scripts/regression.js @@ -726,12 +726,13 @@ async function main() { sourceSessionId: codexSession.sessionId, sourceHopCount: 0, args: { - agent: 'codex', + agent: 'claude', title: 'MCP Created Conversation', initialMessage: 'mcp created initial prompt', }, }); assert(mcpCreate.status === 200 && mcpCreate.body?.ok, `MCP create conversation should succeed: ${JSON.stringify(mcpCreate.body)}`); + assert(mcpCreate.body.agent === 'codex', 'MCP create conversation should ignore agent args and inherit the source agent'); assert(mcpCreate.body.cwd === codexInitCwd, 'MCP create conversation should inherit source cwd by default'); assert(mcpCreate.body.mode === 'plan', 'MCP create conversation should inherit source mode by default'); assert(mcpCreate.body.status === 'running', 'MCP create with initialMessage should start the new conversation'); @@ -739,6 +740,7 @@ async function main() { await nextMessage(messages, ws, (msg) => msg.type === 'background_done' && msg.sessionId === mcpCreate.body.conversationId); const storedMcpCreated = JSON.parse(fs.readFileSync(path.join(sessionsDir, `${mcpCreate.body.conversationId}.json`), 'utf8')); assert(storedMcpCreated.title === 'MCP Created Conversation', 'MCP created conversation should persist the requested title'); + assert(storedMcpCreated.agent === 'codex', 'MCP created conversation should persist the inherited source agent'); assert(storedMcpCreated.createdFrom?.sourceSessionId === codexSession.sessionId, 'MCP created conversation should persist source metadata'); assert(storedMcpCreated.messages.some((message) => message.content === 'mcp created initial prompt' && message.crossConversation?.sourceSessionId === codexSession.sessionId), 'MCP created conversation should persist the initial cross-conversation message'); assert(storedMcpCreated.messages.some((message) => message.role === 'assistant' && /mcp created initial prompt/.test(String(message.content || ''))), 'MCP created conversation should run the initial prompt'); @@ -750,7 +752,7 @@ async function main() { sourceSessionId: codexSession.sessionId, sourceHopCount: 0, args: { - agent: 'codex', + agent: 'claude', cwd: mcpReplyCreateCwd, title: 'MCP Reply Conversation', initialMessage: 'mcp create request reply', @@ -758,6 +760,7 @@ async function main() { }, }); assert(mcpCreateReply.status === 200 && mcpCreateReply.body?.ok, `MCP create conversation with requestReply should succeed: ${JSON.stringify(mcpCreateReply.body)}`); + assert(mcpCreateReply.body.agent === 'codex', 'MCP create requestReply should inherit source agent even if args.agent is passed'); assert(mcpCreateReply.body.cwd === mcpReplyCreateCwd, 'MCP create conversation should use an explicit absolute cwd'); assert(mcpCreateReply.body.requestId && mcpCreateReply.body.replyStatus === 'waiting', 'MCP create requestReply should return a waiting request id'); await nextMessage(messages, ws, (msg) => msg.type === 'background_done' && msg.sessionId === mcpCreateReply.body.conversationId); diff --git a/server.js b/server.js index 63517af..b58747c 100644 --- a/server.js +++ b/server.js @@ -3251,7 +3251,9 @@ function createMcpConversation(args = {}, sourceSessionId = '', sourceHopCount = } const now = new Date().toISOString(); - const created = createPersistentConversationSession(args, { + const createArgs = { ...args }; + delete createArgs.agent; + const created = createPersistentConversationSession(createArgs, { sourceSession, strict: true, requireAbsoluteCwd: true, @@ -6324,15 +6326,10 @@ function codexAppCommunicationDynamicTools() { { name: 'ccweb_create_conversation', namespace: 'ccweb', - description: '创建新的 cc-web 持久对话。只用于需要长期追踪、后续继续对话或跨项目工作区管理的场景;一次性并行研究应使用子代能力。', + description: '创建新的 cc-web 持久对话。Agent 固定继承来源对话,不作为参数指定;只用于需要长期追踪、后续继续对话或跨项目工作区管理的场景;一次性并行研究应使用子代能力。', inputSchema: { type: 'object', properties: { - agent: { - type: 'string', - enum: ['claude', 'codex', 'codexapp'], - description: '可选。新对话 Agent,默认继承来源对话。', - }, cwd: { type: 'string', description: '可选。新对话工作目录;指定时必须是已存在的绝对路径,默认继承来源对话 cwd。',