(state, item)
| 269 | } |
| 270 | |
| 271 | function describeCompletedItem(state, item) { |
| 272 | switch (item.type) { |
| 273 | case "commandExecution": { |
| 274 | const exitCode = item.exitCode ?? "?"; |
| 275 | const statusLabel = item.status === "completed" ? "completed" : item.status; |
| 276 | return { |
| 277 | message: `Command ${statusLabel}: ${shorten(item.command, 96)} (exit ${exitCode})`, |
| 278 | phase: looksLikeVerificationCommand(item.command) ? "verifying" : "running" |
| 279 | }; |
| 280 | } |
| 281 | case "fileChange": |
| 282 | return { message: `File changes ${item.status}.`, phase: "editing" }; |
| 283 | case "mcpToolCall": |
| 284 | return { message: `Tool ${item.server}/${item.tool} ${item.status}.`, phase: "investigating" }; |
| 285 | case "dynamicToolCall": |
| 286 | return { message: `Tool ${item.tool} ${item.status}.`, phase: "investigating" }; |
| 287 | case "collabAgentToolCall": { |
| 288 | const subagents = (item.receiverThreadIds ?? []).map((threadId) => labelForThread(state, threadId) ?? threadId); |
| 289 | const summary = |
| 290 | subagents.length > 0 |
| 291 | ? `Subagent ${subagents.join(", ")} ${item.status}.` |
| 292 | : `Collaboration tool ${item.tool} ${item.status}.`; |
| 293 | return { message: summary, phase: "investigating" }; |
| 294 | } |
| 295 | case "exitedReviewMode": |
| 296 | return { message: "Reviewer finished.", phase: "finalizing" }; |
| 297 | default: |
| 298 | return null; |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | /** @returns {TurnCaptureState} */ |
| 303 | function createTurnCaptureState(threadId, options = {}) { |
no test coverage detected