mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-08 07:17:39 +00:00
feat: add todo tracking and custom tool views
Adds todo tracking infrastructure with TodoWrite tool integration to extract and persist todos in sessions. Refactors ToolCard component to support custom tool view rendering and displays todo progress in SessionList.
This commit is contained in:
+12
-3
@@ -176,6 +176,11 @@ function ensureToolBlock(
|
||||
): ToolCallBlock {
|
||||
const existing = toolBlocksById.get(id)
|
||||
if (existing) {
|
||||
const isPlaceholderToolName = (name: string): boolean => {
|
||||
const normalized = name.trim().toLowerCase()
|
||||
return normalized === '' || normalized === 'tool' || normalized === 'unknown'
|
||||
}
|
||||
|
||||
// Preserve earliest createdAt for stable ordering.
|
||||
if (seed.createdAt < existing.createdAt) {
|
||||
existing.createdAt = seed.createdAt
|
||||
@@ -187,11 +192,15 @@ function ensureToolBlock(
|
||||
existing.tool.state = 'pending'
|
||||
}
|
||||
}
|
||||
if (seed.name) {
|
||||
if (seed.name && (!isPlaceholderToolName(seed.name) || isPlaceholderToolName(existing.tool.name))) {
|
||||
existing.tool.name = seed.name
|
||||
}
|
||||
existing.tool.input = seed.input
|
||||
existing.tool.description = seed.description
|
||||
if (seed.input !== null && seed.input !== undefined) {
|
||||
existing.tool.input = seed.input
|
||||
}
|
||||
if (seed.description !== null) {
|
||||
existing.tool.description = seed.description
|
||||
}
|
||||
return existing
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user