mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 09:13:14 +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
|
||||
* scoped `tools` projection (`useToolCalls(stream, { namespace })`). The
|
||||
* namespace comes from `stream.subagents` (attached to the `task` chunk by
|
||||
* Live status for a single subagent, read straight from the SDK's scoped
|
||||
* `tools` projection (`useToolCalls(stream, { namespace })`). The namespace
|
||||
* comes from `stream.subagents` (attached to the `task` chunk by
|
||||
* `streamMessagesToUi`), so this subscribes to exactly the subagent that the
|
||||
* 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
|
||||
* closes it. Only mounted from {@link SubagentCard} when
|
||||
* `useIsInAgentThreadStream()` is true, so the `useStreamContext` read is
|
||||
|
|
@ -21,30 +25,29 @@ export function SubagentActivity({ namespace }: { namespace: Array<string> }) {
|
|||
const stream = useAgentThreadStream()
|
||||
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 (
|
||||
<div className="mt-1 flex flex-col gap-1 border-t border-[var(--ui-border)] pt-1.5">
|
||||
{toolCalls.map((toolCall, index) => {
|
||||
const id = toolCall.id || toolCall.callId || `sub-tool-${index}`
|
||||
return (
|
||||
<div key={id} className="flex min-w-0 items-center gap-1.5">
|
||||
{toolCall.status === "finished" ? (
|
||||
<Check className="h-3 w-3 shrink-0 text-[color:var(--ui-accent)]" aria-hidden />
|
||||
) : toolCall.status === "error" ? (
|
||||
<X className="h-3 w-3 shrink-0 text-red-400" aria-hidden />
|
||||
) : (
|
||||
<Loader2
|
||||
className="h-3 w-3 shrink-0 animate-spin text-[color:var(--ui-text-dim)]"
|
||||
aria-hidden
|
||||
/>
|
||||
)}
|
||||
<span className="truncate text-[10px] text-[color:var(--ui-text-dim)]">
|
||||
{humanizeToolName(toolCall.name)}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
<div className="mt-1 flex min-w-0 items-center gap-1.5 border-t border-[var(--ui-border)] pt-1.5">
|
||||
{current.status === "finished" ? (
|
||||
<Check className="h-3 w-3 shrink-0 text-[color:var(--ui-accent)]" aria-hidden />
|
||||
) : current.status === "error" ? (
|
||||
<X className="h-3 w-3 shrink-0 text-red-400" aria-hidden />
|
||||
) : (
|
||||
<Loader2
|
||||
className="h-3 w-3 shrink-0 animate-spin text-[color:var(--ui-text-dim)]"
|
||||
aria-hidden
|
||||
/>
|
||||
)}
|
||||
<span className="truncate text-[10px] text-[color:var(--ui-text-dim)]">
|
||||
{humanizeToolName(current.name)}
|
||||
</span>
|
||||
<span className="ml-auto shrink-0 text-[10px] tabular-nums text-[color:var(--ui-text-dim)]">
|
||||
{stepCount} {stepCount === 1 ? "step" : "steps"}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue