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) return getRendererAction()
|
||||||
if (state.status === "pending") return getRendererAction()
|
if (state.status === "pending") return getRendererAction()
|
||||||
|
|
||||||
|
const customTitle = renderer().getTitle?.(rendererContext)
|
||||||
|
if (customTitle) return customTitle
|
||||||
|
|
||||||
if (isToolStateRunning(state) && state.title) {
|
if (isToolStateRunning(state) && state.title) {
|
||||||
return state.title
|
return state.title
|
||||||
}
|
}
|
||||||
@@ -710,9 +713,6 @@ export default function ToolCall(props: ToolCallProps) {
|
|||||||
return state.title
|
return state.title
|
||||||
}
|
}
|
||||||
|
|
||||||
const customTitle = renderer().getTitle?.(rendererContext)
|
|
||||||
if (customTitle) return customTitle
|
|
||||||
|
|
||||||
return getToolName(toolName())
|
return getToolName(toolName())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,25 @@ export const readRenderer: ToolRenderer = {
|
|||||||
if (!state) return undefined
|
if (!state) return undefined
|
||||||
const { input } = readToolStatePayload(state)
|
const { input } = readToolStatePayload(state)
|
||||||
const filePath = typeof input.filePath === "string" ? input.filePath : ""
|
const filePath = typeof input.filePath === "string" ? input.filePath : ""
|
||||||
if (!filePath) return getToolName("read")
|
const offset = typeof input.offset === "number" ? input.offset : undefined
|
||||||
return `${getToolName("read")} ${getRelativePath(filePath)}`
|
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 }) {
|
renderBody({ toolState, renderMarkdown }) {
|
||||||
const state = toolState()
|
const state = toolState()
|
||||||
|
|||||||
Reference in New Issue
Block a user