Sync tool-call titles and task summaries

This commit is contained in:
Shantur Rathore
2025-12-12 13:51:40 +00:00
parent 90c6835ee7
commit 0da2e1d7bb
6 changed files with 286 additions and 68 deletions

View File

@@ -17,7 +17,8 @@ import type {
ToolRendererContext,
ToolScrollHelpers,
} from "./tool-call/types"
import { getRelativePath, getToolIcon, getToolName, isToolStateCompleted, isToolStateError, isToolStateRunning } from "./tool-call/utils"
import { getRelativePath, getToolIcon, getToolName, isToolStateCompleted, isToolStateError, isToolStateRunning, getDefaultToolAction } from "./tool-call/utils"
import { resolveTitleForTool } from "./tool-call/tool-title"
import { getLogger } from "../lib/logger"
const log = getLogger("session")
@@ -710,6 +711,12 @@ export default function ToolCall(props: ToolCallProps) {
const renderToolTitle = () => {
const state = toolState()
const currentTool = toolName()
if (currentTool !== "task") {
return resolveTitleForTool({ toolName: currentTool, state })
}
if (!state) return getRendererAction()
if (state.status === "pending") return getRendererAction()
@@ -724,7 +731,7 @@ export default function ToolCall(props: ToolCallProps) {
return state.title
}
return getToolName(toolName())
return getToolName(currentTool)
}
const renderToolBody = () => {
@@ -918,33 +925,3 @@ export default function ToolCall(props: ToolCallProps) {
</div>
)
}
function getDefaultToolAction(toolName: string) {
switch (toolName) {
case "task":
return "Delegating..."
case "bash":
return "Writing command..."
case "edit":
return "Preparing edit..."
case "webfetch":
return "Fetching from the web..."
case "glob":
return "Finding files..."
case "grep":
return "Searching content..."
case "list":
return "Listing directory..."
case "read":
return "Reading file..."
case "write":
return "Preparing write..."
case "todowrite":
case "todoread":
return "Planning..."
case "patch":
return "Preparing patch..."
default:
return "Working..."
}
}