(uiState, call)
| 176 | } |
| 177 | |
| 178 | function renderToolStartWeb(uiState, call) { |
| 179 | if (!call || !call.name) return; |
| 180 | const name = call.name; |
| 181 | const args = call.arguments || {}; |
| 182 | |
| 183 | if (name === "TodoWrite" || name === "write_todos") { |
| 184 | const title = extractActiveTaskTitleWeb(args) || "任务规划"; |
| 185 | appendPhaseLine(`Plan(${title})`, "plan"); |
| 186 | uiState.currentPhase = { kind: "Plan", title: title, count: 0 }; |
| 187 | return; |
| 188 | } |
| 189 | |
| 190 | if (name === "Task" || name === "task") { |
| 191 | const subType = getStringArgWeb(args, "subagent_type"); |
| 192 | const prompt = getStringArgWeb(args, "prompt") || "子代理任务"; |
| 193 | const labelType = subType || "Task"; |
| 194 | const className = labelType === "Explore" ? "explore" : labelType === "Plan" ? "plan" : "tool"; |
| 195 | appendPhaseLine(`${labelType}(${prompt})`, className); |
| 196 | uiState.currentPhase = { kind: labelType, title: prompt, count: 0 }; |
| 197 | return; |
| 198 | } |
| 199 | |
| 200 | const label = formatToolCallLabelWeb(call); |
| 201 | if (!label) return; |
| 202 | |
| 203 | if (uiState.currentPhase) { |
| 204 | if (uiState.currentPhase.count === 0) { |
| 205 | appendPhaseLine(` └─ ${label}`, "tool"); |
| 206 | } else { |
| 207 | appendPhaseLine(` ${label}`, "tool"); |
| 208 | } |
| 209 | uiState.currentPhase.count += 1; |
| 210 | } else { |
| 211 | appendPhaseLine(`[Tool] ${label}`, "tool"); |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | function extractActiveTaskTitleWeb(args) { |
| 216 | const todos = args.todos; |
no test coverage detected