feat(ui): add dedicated Agent subagent rendering with nested tool call display

Render Agent/Explore/Plan tool calls in a visually distinct collapsible
container with colored left border, replacing the generic tool card. Parse
subagent JSONL transcripts from {sessionId}/subagents/ to extract and
display the actual tool calls (Bash, Read, Grep, etc.) the subagent
executed, reusing the existing ToolCallPart for consistent appearance.

- Add AgentToolCallPart component with collapsible body, prompt section,
  execution stats, and nested tool call list via render prop injection
- Add AgentExecutionStats and AgentToolCall types (Rust + TypeScript)
- Parse toolUseResult.agentId to locate and read subagent JSONL files
- Validate agentId against path traversal before filesystem access
- Pass agentStats through adapter for both ID-matched and positional
  tool result pairing
- Strip agentStats in nested render to prevent recursive Agent expansion
- Add i18n keys for agent UI labels across all 10 languages
This commit is contained in:
xintaofei
2026-04-16 21:32:25 +08:00
parent ffdc0019fc
commit 9f82fdf350
22 changed files with 634 additions and 8 deletions

View File

@@ -1703,6 +1703,13 @@
"subjectLabel": "الموضوع",
"taskLabel": "المهمة",
"nameLabel": "الاسم:",
"agentPromptLabel": "المطالبة",
"agentModelLabel": "النموذج",
"agentStatsBash": "الأوامر",
"agentStatsRead": "الملفات المقروءة",
"agentStatsSearch": "عمليات البحث",
"agentStatsEdit": "التعديلات",
"agentStatsOther": "أخرى",
"field": {
"file": "ملف",
"notebook": "دفتر",

View File

@@ -1703,6 +1703,13 @@
"subjectLabel": "Betreff",
"taskLabel": "Aufgabe",
"nameLabel": "Bezeichnung:",
"agentPromptLabel": "Eingabe",
"agentModelLabel": "Modell",
"agentStatsBash": "Befehle",
"agentStatsRead": "Dateien gelesen",
"agentStatsSearch": "Suchen",
"agentStatsEdit": "Bearbeitungen",
"agentStatsOther": "Sonstige",
"field": {
"file": "Datei",
"notebook": "Notizbuch",

View File

@@ -1703,6 +1703,13 @@
"subjectLabel": "Subject",
"taskLabel": "Task",
"nameLabel": "Name:",
"agentPromptLabel": "Prompt",
"agentModelLabel": "Model",
"agentStatsBash": "Commands",
"agentStatsRead": "Files read",
"agentStatsSearch": "Searches",
"agentStatsEdit": "Edits",
"agentStatsOther": "Other",
"field": {
"file": "File",
"notebook": "Notebook",

View File

@@ -1703,6 +1703,13 @@
"subjectLabel": "Asunto",
"taskLabel": "Tarea",
"nameLabel": "Nombre:",
"agentPromptLabel": "Instrucción",
"agentModelLabel": "Modelo",
"agentStatsBash": "Comandos",
"agentStatsRead": "Archivos leídos",
"agentStatsSearch": "Búsquedas",
"agentStatsEdit": "Ediciones",
"agentStatsOther": "Otros",
"field": {
"file": "Archivo",
"notebook": "Cuaderno",

View File

@@ -1703,6 +1703,13 @@
"subjectLabel": "Sujet",
"taskLabel": "Tâche",
"nameLabel": "Nom :",
"agentPromptLabel": "Instruction",
"agentModelLabel": "Modèle",
"agentStatsBash": "Commandes",
"agentStatsRead": "Fichiers lus",
"agentStatsSearch": "Recherches",
"agentStatsEdit": "Modifications",
"agentStatsOther": "Autres",
"field": {
"file": "Fichier",
"notebook": "Carnet",

View File

@@ -1703,6 +1703,13 @@
"subjectLabel": "件名",
"taskLabel": "タスク",
"nameLabel": "名前:",
"agentPromptLabel": "プロンプト",
"agentModelLabel": "モデル",
"agentStatsBash": "コマンド",
"agentStatsRead": "ファイル読取",
"agentStatsSearch": "検索",
"agentStatsEdit": "編集",
"agentStatsOther": "その他",
"field": {
"file": "ファイル",
"notebook": "ノートブック",

View File

@@ -1703,6 +1703,13 @@
"subjectLabel": "제목",
"taskLabel": "작업",
"nameLabel": "이름:",
"agentPromptLabel": "프롬프트",
"agentModelLabel": "모델",
"agentStatsBash": "명령",
"agentStatsRead": "파일 읽기",
"agentStatsSearch": "검색",
"agentStatsEdit": "편집",
"agentStatsOther": "기타",
"field": {
"file": "파일",
"notebook": "노트북",

View File

@@ -1703,6 +1703,13 @@
"subjectLabel": "Assunto",
"taskLabel": "Tarefa",
"nameLabel": "Nome:",
"agentPromptLabel": "Instrução",
"agentModelLabel": "Modelo",
"agentStatsBash": "Comandos",
"agentStatsRead": "Arquivos lidos",
"agentStatsSearch": "Pesquisas",
"agentStatsEdit": "Edições",
"agentStatsOther": "Outros",
"field": {
"file": "Arquivo",
"notebook": "Caderno",

View File

@@ -1703,6 +1703,13 @@
"subjectLabel": "主题",
"taskLabel": "任务",
"nameLabel": "名称:",
"agentPromptLabel": "提示词",
"agentModelLabel": "模型",
"agentStatsBash": "命令",
"agentStatsRead": "读取文件",
"agentStatsSearch": "搜索",
"agentStatsEdit": "编辑",
"agentStatsOther": "其他",
"field": {
"file": "文件",
"notebook": "笔记本",

View File

@@ -1703,6 +1703,13 @@
"subjectLabel": "主題",
"taskLabel": "任務",
"nameLabel": "名稱:",
"agentPromptLabel": "提示詞",
"agentModelLabel": "模型",
"agentStatsBash": "命令",
"agentStatsRead": "讀取檔案",
"agentStatsSearch": "搜尋",
"agentStatsEdit": "編輯",
"agentStatsOther": "其他",
"field": {
"file": "檔案",
"notebook": "筆記本",