2026-06-11 09:54:35 -07:00
|
|
|
|
import { SubagentCard } from "./SubagentCard";
|
2026-06-15 17:29:38 -07:00
|
|
|
|
import type { ToolExecutionChunk } from "@/lib/agents/types";
|
2026-06-11 09:54:35 -07:00
|
|
|
|
|
|
|
|
|
|
/** Maximum number of subagent cards rendered per row. */
|
|
|
|
|
|
const MAX_SUBAGENT_COLUMNS = 4;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Renders the subagents from a `subagent-group` render item as a responsive
|
|
|
|
|
|
* card grid. The column count follows the number of cards up to
|
|
|
|
|
|
* {@link MAX_SUBAGENT_COLUMNS}, so 1–4 subagents fill the row evenly and 5+
|
|
|
|
|
|
* wrap onto additional rows.
|
|
|
|
|
|
*/
|
2026-06-15 17:29:38 -07:00
|
|
|
|
export function SubagentGroup({ chunks }: { chunks: Array<ToolExecutionChunk> }) {
|
2026-06-11 09:54:35 -07:00
|
|
|
|
const columns = Math.min(Math.max(chunks.length, 1), MAX_SUBAGENT_COLUMNS);
|
|
|
|
|
|
return (
|
|
|
|
|
|
<div
|
|
|
|
|
|
className="grid gap-2"
|
|
|
|
|
|
style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}
|
|
|
|
|
|
>
|
|
|
|
|
|
{chunks.map((chunk) => (
|
|
|
|
|
|
<SubagentCard key={chunk.toolCallId} chunk={chunk} />
|
|
|
|
|
|
))}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|