import type { ToolCallBlock } from '@agentscope-ai/agentscope/message'; import { Users } from 'lucide-react'; import { ConfirmCard } from './ConfirmCard'; import type { SubagentHitlEntry } from '@/hooks/useMessages'; import { useTranslation } from '@/i18n/useI18n'; /** * A pending HITL confirmation raised by a team *member* (worker) * session, surfaced on the *leader* view so the user can answer it * without drilling into the member's own session. * * Renders one {@link ConfirmCard} per pending tool call, reusing the * exact same confirm UI (and suggested-rules interaction) as a * first-party confirmation. The only addition is a header naming the * member that is asking. * * Confirmation is routed through {@link onConfirm}, which the parent * wires to ``useMessages``' ``onSubagentConfirm`` — POSTing the result * to the leader front door, where the backend forwards it to the * worker session (design §3.6). */ export function SubagentHitlCard({ entry, onConfirm, }: { entry: SubagentHitlEntry; onConfirm: ( toolCall: ToolCallBlock, confirm: boolean, rules?: ToolCallBlock['suggested_rules'], ) => void; }) { const { t } = useTranslation(); const toolCalls = entry.event.tool_calls ?? []; if (toolCalls.length === 0) return null; return (
{t('chat.subagentConfirmTitle', { name: entry.worker_agent_name })}
{toolCalls.map((toolCall) => ( onConfirm(toolCall, confirm, rules)} /> ))}
); }