mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-24 06:45:22 +00:00
wip
This commit is contained in:
@@ -168,8 +168,12 @@ function websearch(info: ToolProps<typeof WebSearchTool>) {
|
||||
}
|
||||
|
||||
function task(info: ToolProps<typeof TaskTool>) {
|
||||
const agent = Locale.titlecase(info.input.subagent_type)
|
||||
const desc = info.input.description
|
||||
const input = info.part.state.input
|
||||
const subagent =
|
||||
typeof input.subagent_type === "string" && input.subagent_type.trim().length > 0 ? input.subagent_type : "unknown"
|
||||
const agent = Locale.titlecase(subagent)
|
||||
const desc =
|
||||
typeof input.description === "string" && input.description.trim().length > 0 ? input.description : undefined
|
||||
const started = info.part.state.status === "running"
|
||||
const name = desc ?? `${agent} Task`
|
||||
inline({
|
||||
@@ -451,9 +455,12 @@ export const RunCommand = cmd({
|
||||
const part = event.properties.part
|
||||
if (part.sessionID !== sessionID) continue
|
||||
|
||||
if (part.type === "tool" && part.state.status === "completed") {
|
||||
if (part.type === "tool" && (part.state.status === "completed" || part.state.status === "error")) {
|
||||
if (emit("tool_use", { part })) continue
|
||||
tool(part)
|
||||
if (part.state.status === "error") {
|
||||
UI.error(part.state.error)
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
@@ -104,6 +104,9 @@ export namespace UI {
|
||||
}
|
||||
|
||||
export function error(message: string) {
|
||||
if (message.startsWith("Error: ")) {
|
||||
message = message.slice("Error: ".length)
|
||||
}
|
||||
println(Style.TEXT_DANGER_BOLD + "Error: " + Style.TEXT_NORMAL + message)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user