|
|
@@ -44,6 +44,8 @@ import type { GrepTool } from "@/tool/grep"
|
|
|
import type { EditTool } from "@/tool/edit"
|
|
|
import type { ApplyPatchTool } from "@/tool/apply_patch"
|
|
|
import type { WebFetchTool } from "@/tool/webfetch"
|
|
|
+import type { CodeSearchTool } from "@/tool/codesearch"
|
|
|
+import type { WebSearchTool } from "@/tool/websearch"
|
|
|
import type { TaskTool } from "@/tool/task"
|
|
|
import type { QuestionTool } from "@/tool/question"
|
|
|
import type { SkillTool } from "@/tool/skill"
|
|
|
@@ -1934,28 +1936,26 @@ function Grep(props: ToolProps<typeof GrepTool>) {
|
|
|
|
|
|
function WebFetch(props: ToolProps<typeof WebFetchTool>) {
|
|
|
return (
|
|
|
- <InlineTool icon="%" pending="Fetching from the web..." complete={(props.input as any).url} part={props.part}>
|
|
|
- WebFetch {(props.input as any).url}
|
|
|
+ <InlineTool icon="%" pending="Fetching from the web..." complete={props.input.url} part={props.part}>
|
|
|
+ WebFetch {props.input.url}
|
|
|
</InlineTool>
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-function CodeSearch(props: ToolProps<any>) {
|
|
|
- const input = props.input as any
|
|
|
- const metadata = props.metadata as any
|
|
|
+function CodeSearch(props: ToolProps<typeof CodeSearchTool>) {
|
|
|
+ const metadata = props.metadata as { results?: number }
|
|
|
return (
|
|
|
- <InlineTool icon="◇" pending="Searching code..." complete={input.query} part={props.part}>
|
|
|
- Exa Code Search "{input.query}" <Show when={metadata.results}>({metadata.results} results)</Show>
|
|
|
+ <InlineTool icon="◇" pending="Searching code..." complete={props.input.query} part={props.part}>
|
|
|
+ Exa Code Search "{props.input.query}" <Show when={metadata.results}>({metadata.results} results)</Show>
|
|
|
</InlineTool>
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-function WebSearch(props: ToolProps<any>) {
|
|
|
- const input = props.input as any
|
|
|
- const metadata = props.metadata as any
|
|
|
+function WebSearch(props: ToolProps<typeof WebSearchTool>) {
|
|
|
+ const metadata = props.metadata as { numResults?: number }
|
|
|
return (
|
|
|
- <InlineTool icon="◈" pending="Searching web..." complete={input.query} part={props.part}>
|
|
|
- Exa Web Search "{input.query}" <Show when={metadata.numResults}>({metadata.numResults} results)</Show>
|
|
|
+ <InlineTool icon="◈" pending="Searching web..." complete={props.input.query} part={props.part}>
|
|
|
+ Exa Web Search "{props.input.query}" <Show when={metadata.numResults}>({metadata.numResults} results)</Show>
|
|
|
</InlineTool>
|
|
|
)
|
|
|
}
|
|
|
@@ -1979,7 +1979,9 @@ function Task(props: ToolProps<typeof TaskTool>) {
|
|
|
)
|
|
|
})
|
|
|
|
|
|
- const current = createMemo(() => tools().findLast((x) => (x.state as any).title))
|
|
|
+ const current = createMemo(() =>
|
|
|
+ tools().findLast((x) => (x.state.status === "running" || x.state.status === "completed") && x.state.title),
|
|
|
+ )
|
|
|
|
|
|
const isRunning = createMemo(() => props.part.state.status === "running")
|
|
|
|
|
|
@@ -1996,8 +1998,11 @@ function Task(props: ToolProps<typeof TaskTool>) {
|
|
|
|
|
|
if (isRunning() && tools().length > 0) {
|
|
|
// content[0] += ` · ${tools().length} toolcalls`
|
|
|
- if (current()) content.push(`↳ ${Locale.titlecase(current()!.tool)} ${(current()!.state as any).title}`)
|
|
|
- else content.push(`↳ ${tools().length} toolcalls`)
|
|
|
+ if (current()) {
|
|
|
+ const state = current()!.state
|
|
|
+ const title = state.status === "running" || state.status === "completed" ? state.title : undefined
|
|
|
+ content.push(`↳ ${Locale.titlecase(current()!.tool)} ${title}`)
|
|
|
+ } else content.push(`↳ ${tools().length} toolcalls`)
|
|
|
}
|
|
|
|
|
|
if (props.part.state.status === "completed") {
|