feat(acp): forward meta/locations fields and use parentToolUseId for precise Agent child grouping

Forward the previously-dropped `locations` and `meta` fields from ACP
SDK ToolCall/ToolCallUpdate events through to the frontend. The meta
field carries `claudeCode.parentToolUseId` which enables precise
parent-child matching for concurrent Agent tool calls during streaming.

- Forward locations/meta in Rust AcpEvent types and connection handlers
- Use parentToolUseId for exact agent→child mapping, with position-based
  fallback for agents that don't provide it (Codex, OpenCode)
- Replace `any` types with proper ToolCallMeta / unknown types
- Add runtime guards for meta field parsing (defensive against
  unexpected shapes from different agents)
- Cache inferLiveToolName results per tool_call_id to avoid redundant
  computation across Phase 1 and Phase 2
- Lazy-construct agentStats only when children exist
This commit is contained in:
xintaofei
2026-04-17 08:24:12 +08:00
parent 6763814a92
commit 834340e536
5 changed files with 141 additions and 58 deletions

View File

@@ -402,6 +402,8 @@ export type AcpEvent =
content: string | null
raw_input: string | null
raw_output: string | null
locations?: unknown
meta?: unknown
}
| {
type: "tool_call_update"
@@ -413,6 +415,8 @@ export type AcpEvent =
raw_input: string | null
raw_output: string | null
raw_output_append?: boolean
locations?: unknown
meta?: unknown
}
| {
type: "permission_request"