summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components/tool-error-card.tsx
diff options
context:
space:
mode:
authorAdam <[email protected]>2026-03-12 16:25:36 -0500
committerAdam <[email protected]>2026-03-12 16:25:49 -0500
commit9d3c42c8c49ec56ee890dc2af9c47f19494999fc (patch)
treea71cda6b9c27e7cb426bfd78eead45a2fa54afae /packages/ui/src/components/tool-error-card.tsx
parentf2cad046e6c38885b454d01cb28888152a54b375 (diff)
downloadopencode-9d3c42c8c49ec56ee890dc2af9c47f19494999fc.tar.gz
opencode-9d3c42c8c49ec56ee890dc2af9c47f19494999fc.zip
fix(app): task error state
Diffstat (limited to 'packages/ui/src/components/tool-error-card.tsx')
-rw-r--r--packages/ui/src/components/tool-error-card.tsx21
1 files changed, 19 insertions, 2 deletions
diff --git a/packages/ui/src/components/tool-error-card.tsx b/packages/ui/src/components/tool-error-card.tsx
index 2e9612b2b..ba39ae586 100644
--- a/packages/ui/src/components/tool-error-card.tsx
+++ b/packages/ui/src/components/tool-error-card.tsx
@@ -10,19 +10,22 @@ export interface ToolErrorCardProps extends Omit<ComponentProps<typeof Card>, "c
tool: string
error: string
defaultOpen?: boolean
+ subtitle?: string
+ href?: string
}
export function ToolErrorCard(props: ToolErrorCardProps) {
const i18n = useI18n()
const [open, setOpen] = createSignal(props.defaultOpen ?? false)
const [copied, setCopied] = createSignal(false)
- const [split, rest] = splitProps(props, ["tool", "error", "defaultOpen"])
+ const [split, rest] = splitProps(props, ["tool", "error", "defaultOpen", "subtitle", "href"])
const name = createMemo(() => {
const map: Record<string, string> = {
read: "ui.tool.read",
list: "ui.tool.list",
glob: "ui.tool.glob",
grep: "ui.tool.grep",
+ task: "Task",
webfetch: "ui.tool.webfetch",
websearch: "ui.tool.websearch",
codesearch: "ui.tool.codesearch",
@@ -32,6 +35,7 @@ export function ToolErrorCard(props: ToolErrorCardProps) {
}
const key = map[split.tool]
if (!key) return split.tool
+ if (!key.includes(".")) return key
return i18n.t(key)
})
const cleaned = createMemo(() => split.error.replace(/^Error:\s*/, "").trim())
@@ -43,6 +47,7 @@ export function ToolErrorCard(props: ToolErrorCardProps) {
})
const subtitle = createMemo(() => {
+ if (split.subtitle) return split.subtitle
const parts = tail().split(": ")
if (parts.length <= 1) return "Failed"
const head = (parts[0] ?? "").trim()
@@ -77,7 +82,19 @@ export function ToolErrorCard(props: ToolErrorCardProps) {
<div data-slot="basic-tool-tool-info-structured">
<div data-slot="basic-tool-tool-info-main">
<span data-slot="basic-tool-tool-title">{name()}</span>
- <span data-slot="basic-tool-tool-subtitle">{subtitle()}</span>
+ <Show
+ when={split.href && split.subtitle}
+ fallback={<span data-slot="basic-tool-tool-subtitle">{subtitle()}</span>}
+ >
+ <a
+ data-slot="basic-tool-tool-subtitle"
+ class="clickable subagent-link"
+ href={split.href!}
+ onClick={(e) => e.stopPropagation()}
+ >
+ {subtitle()}
+ </a>
+ </Show>
</div>
</div>
</div>