mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
fix: ACP 模式加载 agent 定义并透传 subagent 层级信息
- agent.ts: session 创建时调用 getAgentDefinitionsWithOverrides 加载内置 subagent(Explore/Plan/General-Purpose 等),注入 appState 和 engineConfig - bridge.ts: assistantMessageToAcpNotifications 调用时补上 parentToolUseId, 使 subagent 内部工具调用的 _meta 中携带父级标记
This commit is contained in:
@@ -54,6 +54,7 @@ import { getEmptyToolPermissionContext } from '../../Tool.js'
|
||||
import type { PermissionMode } from '../../types/permissions.js'
|
||||
import type { Command } from '../../types/command.js'
|
||||
import { getCommands } from '../../commands.js'
|
||||
import { getAgentDefinitionsWithOverrides } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
|
||||
import {
|
||||
setOriginalCwd,
|
||||
switchSession,
|
||||
@@ -549,8 +550,14 @@ export class AcpAgent implements Agent {
|
||||
},
|
||||
}
|
||||
|
||||
// Load commands for slash command and skill support
|
||||
const commands = await getCommands(cwd)
|
||||
// Load commands and agent definitions for subagent support
|
||||
const [commands, agentDefinitionsResult] = await Promise.all([
|
||||
getCommands(cwd),
|
||||
getAgentDefinitionsWithOverrides(cwd),
|
||||
])
|
||||
|
||||
// Inject agent definitions into appState
|
||||
appState.agentDefinitions = agentDefinitionsResult
|
||||
|
||||
// Build QueryEngine config
|
||||
const engineConfig: QueryEngineConfig = {
|
||||
@@ -558,7 +565,7 @@ export class AcpAgent implements Agent {
|
||||
tools,
|
||||
commands,
|
||||
mcpClients: [],
|
||||
agents: [],
|
||||
agents: agentDefinitionsResult.activeAgents,
|
||||
canUseTool,
|
||||
getAppState: () => appState,
|
||||
setAppState: (updater: (prev: AppState) => AppState) => {
|
||||
|
||||
@@ -827,6 +827,7 @@ export async function forwardSessionUpdates(
|
||||
{
|
||||
clientCapabilities,
|
||||
cwd,
|
||||
parentToolUseId,
|
||||
},
|
||||
)
|
||||
for (const notification of notifications) {
|
||||
|
||||
Reference in New Issue
Block a user