feat: surface read bounds
This commit is contained in:
@@ -702,6 +702,9 @@ export default function ToolCall(props: ToolCallProps) {
|
||||
if (!state) return getRendererAction()
|
||||
if (state.status === "pending") return getRendererAction()
|
||||
|
||||
const customTitle = renderer().getTitle?.(rendererContext)
|
||||
if (customTitle) return customTitle
|
||||
|
||||
if (isToolStateRunning(state) && state.title) {
|
||||
return state.title
|
||||
}
|
||||
@@ -710,9 +713,6 @@ export default function ToolCall(props: ToolCallProps) {
|
||||
return state.title
|
||||
}
|
||||
|
||||
const customTitle = renderer().getTitle?.(rendererContext)
|
||||
if (customTitle) return customTitle
|
||||
|
||||
return getToolName(toolName())
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,25 @@ export const readRenderer: ToolRenderer = {
|
||||
if (!state) return undefined
|
||||
const { input } = readToolStatePayload(state)
|
||||
const filePath = typeof input.filePath === "string" ? input.filePath : ""
|
||||
if (!filePath) return getToolName("read")
|
||||
return `${getToolName("read")} ${getRelativePath(filePath)}`
|
||||
const offset = typeof input.offset === "number" ? input.offset : undefined
|
||||
const limit = typeof input.limit === "number" ? input.limit : undefined
|
||||
const relativePath = filePath ? getRelativePath(filePath) : ""
|
||||
const detailParts: string[] = []
|
||||
|
||||
if (typeof offset === "number") {
|
||||
detailParts.push(`Offset: ${offset}`)
|
||||
}
|
||||
|
||||
if (typeof limit === "number") {
|
||||
detailParts.push(`Limit: ${limit}`)
|
||||
}
|
||||
|
||||
const baseTitle = relativePath ? `${getToolName("read")} ${relativePath}` : getToolName("read")
|
||||
if (!detailParts.length) {
|
||||
return baseTitle
|
||||
}
|
||||
|
||||
return `${baseTitle} · ${detailParts.join(" · ")}`
|
||||
},
|
||||
renderBody({ toolState, renderMarkdown }) {
|
||||
const state = toolState()
|
||||
|
||||
Reference in New Issue
Block a user