@@ -44,6 +44,8 @@ import type { GrepTool } from "@/tool/grep"
4444import type { EditTool } from "@/tool/edit"
4545import type { ApplyPatchTool } from "@/tool/apply_patch"
4646import type { WebFetchTool } from "@/tool/webfetch"
47+ import type { CodeSearchTool } from "@/tool/codesearch"
48+ import type { WebSearchTool } from "@/tool/websearch"
4749import type { TaskTool } from "@/tool/task"
4850import type { QuestionTool } from "@/tool/question"
4951import type { SkillTool } from "@/tool/skill"
@@ -1934,28 +1936,26 @@ function Grep(props: ToolProps<typeof GrepTool>) {
19341936
19351937function WebFetch ( props : ToolProps < typeof WebFetchTool > ) {
19361938 return (
1937- < InlineTool icon = "%" pending = "Fetching from the web..." complete = { ( props . input as any ) . url } part = { props . part } >
1938- WebFetch { ( props . input as any ) . url }
1939+ < InlineTool icon = "%" pending = "Fetching from the web..." complete = { props . input . url } part = { props . part } >
1940+ WebFetch { props . input . url }
19391941 </ InlineTool >
19401942 )
19411943}
19421944
1943- function CodeSearch ( props : ToolProps < any > ) {
1944- const input = props . input as any
1945- const metadata = props . metadata as any
1945+ function CodeSearch ( props : ToolProps < typeof CodeSearchTool > ) {
1946+ const metadata = props . metadata as { results ?: number }
19461947 return (
1947- < InlineTool icon = "◇" pending = "Searching code..." complete = { input . query } part = { props . part } >
1948- Exa Code Search "{ input . query } " < Show when = { metadata . results } > ({ metadata . results } results)</ Show >
1948+ < InlineTool icon = "◇" pending = "Searching code..." complete = { props . input . query } part = { props . part } >
1949+ Exa Code Search "{ props . input . query } " < Show when = { metadata . results } > ({ metadata . results } results)</ Show >
19491950 </ InlineTool >
19501951 )
19511952}
19521953
1953- function WebSearch ( props : ToolProps < any > ) {
1954- const input = props . input as any
1955- const metadata = props . metadata as any
1954+ function WebSearch ( props : ToolProps < typeof WebSearchTool > ) {
1955+ const metadata = props . metadata as { numResults ?: number }
19561956 return (
1957- < InlineTool icon = "◈" pending = "Searching web..." complete = { input . query } part = { props . part } >
1958- Exa Web Search "{ input . query } " < Show when = { metadata . numResults } > ({ metadata . numResults } results)</ Show >
1957+ < InlineTool icon = "◈" pending = "Searching web..." complete = { props . input . query } part = { props . part } >
1958+ Exa Web Search "{ props . input . query } " < Show when = { metadata . numResults } > ({ metadata . numResults } results)</ Show >
19591959 </ InlineTool >
19601960 )
19611961}
@@ -1979,7 +1979,9 @@ function Task(props: ToolProps<typeof TaskTool>) {
19791979 )
19801980 } )
19811981
1982- const current = createMemo ( ( ) => tools ( ) . findLast ( ( x ) => ( x . state as any ) . title ) )
1982+ const current = createMemo ( ( ) =>
1983+ tools ( ) . findLast ( ( x ) => ( x . state . status === "running" || x . state . status === "completed" ) && x . state . title ) ,
1984+ )
19831985
19841986 const isRunning = createMemo ( ( ) => props . part . state . status === "running" )
19851987
@@ -1996,8 +1998,11 @@ function Task(props: ToolProps<typeof TaskTool>) {
19961998
19971999 if ( isRunning ( ) && tools ( ) . length > 0 ) {
19982000 // content[0] += ` · ${tools().length} toolcalls`
1999- if ( current ( ) ) content . push ( `↳ ${ Locale . titlecase ( current ( ) ! . tool ) } ${ ( current ( ) ! . state as any ) . title } ` )
2000- else content . push ( `↳ ${ tools ( ) . length } toolcalls` )
2001+ if ( current ( ) ) {
2002+ const state = current ( ) ! . state
2003+ const title = state . status === "running" || state . status === "completed" ? state . title : undefined
2004+ content . push ( `↳ ${ Locale . titlecase ( current ( ) ! . tool ) } ${ title } ` )
2005+ } else content . push ( `↳ ${ tools ( ) . length } toolcalls` )
20012006 }
20022007
20032008 if ( props . part . state . status === "completed" ) {
0 commit comments