fix(tui): show background subagent completion

This commit is contained in:
Kit Langton
2026-07-12 12:40:39 +00:00
committed by opencode-agent[bot]
parent 02e2277057
commit 885c13fcee
3 changed files with 61 additions and 8 deletions
+35 -3
View File
@@ -1245,15 +1245,47 @@ function SessionSwitchMessageV2(props: { message: SessionMessageInfo }) {
function SessionNoticeMessageV2(props: { message: SessionMessageInfo }) {
const { theme } = useTheme()
const completion = () => props.message.type === "synthetic" && props.message.metadata?.source === "subagent"
const state = () => {
if (props.message.type !== "synthetic") return
return typeof props.message.metadata?.state === "string" ? props.message.metadata.state : undefined
}
const agent = () => {
if (props.message.type !== "synthetic") return "Subagent"
return typeof props.message.metadata?.agent === "string"
? Locale.titlecase(props.message.metadata.agent)
: "Subagent"
}
const text = () => {
if (props.message.type === "system") return props.message.text
if (props.message.type === "synthetic") return props.message.description ?? ""
return ""
}
const status = () => {
if (state() === "completed") return "finished"
if (state() === "error") return "failed"
return state() ?? "finished"
}
const color = () => {
if (state() === "error") return theme.error
if (state() === "cancelled") return theme.warning
return theme.info
}
return (
<InlineToolRow icon="◈" color={theme.textMuted} pending="Notice" complete={true}>
{text()}
</InlineToolRow>
<Show
when={completion()}
fallback={
<InlineToolRow icon="◈" color={theme.textMuted} pending="Notice" complete={true}>
{text()}
</InlineToolRow>
}
>
<box marginLeft={3} flexDirection="row">
<text fg={color()}>
{state() === "completed" ? "↳" : "!"} {agent()} {status()}
</text>
</box>
</Show>
)
}