mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-02 00:23:16 +00:00
fix: show subagent current status instead of full tool-call list (#1528)
The subagent card listed every nested tool call, ballooning the card as the subagent ran. Show a single status line (current activity + step count) until a richer activity UI lands. Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
This commit is contained in:
parent
dfa3fc13b9
commit
3deb3ef4e0
1 changed files with 28 additions and 25 deletions
|
|
@ -6,12 +6,16 @@ function humanizeToolName(name: string): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Live nested activity for a single subagent, read straight from the SDK's
|
* Live status for a single subagent, read straight from the SDK's scoped
|
||||||
* scoped `tools` projection (`useToolCalls(stream, { namespace })`). The
|
* `tools` projection (`useToolCalls(stream, { namespace })`). The namespace
|
||||||
* namespace comes from `stream.subagents` (attached to the `task` chunk by
|
* comes from `stream.subagents` (attached to the `task` chunk by
|
||||||
* `streamMessagesToUi`), so this subscribes to exactly the subagent that the
|
* `streamMessagesToUi`), so this subscribes to exactly the subagent that the
|
||||||
* parent card represents.
|
* parent card represents.
|
||||||
*
|
*
|
||||||
|
* Hotfix: rather than listing every nested tool call (which balloons the card),
|
||||||
|
* this shows a single line with the subagent's current activity plus a running
|
||||||
|
* step count. A richer activity UI will replace this later.
|
||||||
|
*
|
||||||
* Mounting opens a ref-counted subscription scoped to `namespace`; unmounting
|
* Mounting opens a ref-counted subscription scoped to `namespace`; unmounting
|
||||||
* closes it. Only mounted from {@link SubagentCard} when
|
* closes it. Only mounted from {@link SubagentCard} when
|
||||||
* `useIsInAgentThreadStream()` is true, so the `useStreamContext` read is
|
* `useIsInAgentThreadStream()` is true, so the `useStreamContext` read is
|
||||||
|
|
@ -21,30 +25,29 @@ export function SubagentActivity({ namespace }: { namespace: Array<string> }) {
|
||||||
const stream = useAgentThreadStream()
|
const stream = useAgentThreadStream()
|
||||||
const toolCalls = useToolCalls(stream, { namespace })
|
const toolCalls = useToolCalls(stream, { namespace })
|
||||||
|
|
||||||
if (toolCalls.length === 0) return null
|
const current = toolCalls[toolCalls.length - 1]
|
||||||
|
if (!current) return null
|
||||||
|
|
||||||
|
const stepCount = toolCalls.length
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mt-1 flex flex-col gap-1 border-t border-[var(--ui-border)] pt-1.5">
|
<div className="mt-1 flex min-w-0 items-center gap-1.5 border-t border-[var(--ui-border)] pt-1.5">
|
||||||
{toolCalls.map((toolCall, index) => {
|
{current.status === "finished" ? (
|
||||||
const id = toolCall.id || toolCall.callId || `sub-tool-${index}`
|
<Check className="h-3 w-3 shrink-0 text-[color:var(--ui-accent)]" aria-hidden />
|
||||||
return (
|
) : current.status === "error" ? (
|
||||||
<div key={id} className="flex min-w-0 items-center gap-1.5">
|
<X className="h-3 w-3 shrink-0 text-red-400" aria-hidden />
|
||||||
{toolCall.status === "finished" ? (
|
) : (
|
||||||
<Check className="h-3 w-3 shrink-0 text-[color:var(--ui-accent)]" aria-hidden />
|
<Loader2
|
||||||
) : toolCall.status === "error" ? (
|
className="h-3 w-3 shrink-0 animate-spin text-[color:var(--ui-text-dim)]"
|
||||||
<X className="h-3 w-3 shrink-0 text-red-400" aria-hidden />
|
aria-hidden
|
||||||
) : (
|
/>
|
||||||
<Loader2
|
)}
|
||||||
className="h-3 w-3 shrink-0 animate-spin text-[color:var(--ui-text-dim)]"
|
<span className="truncate text-[10px] text-[color:var(--ui-text-dim)]">
|
||||||
aria-hidden
|
{humanizeToolName(current.name)}
|
||||||
/>
|
</span>
|
||||||
)}
|
<span className="ml-auto shrink-0 text-[10px] tabular-nums text-[color:var(--ui-text-dim)]">
|
||||||
<span className="truncate text-[10px] text-[color:var(--ui-text-dim)]">
|
{stepCount} {stepCount === 1 ? "step" : "steps"}
|
||||||
{humanizeToolName(toolCall.name)}
|
</span>
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue