feat: group all tools in single spoiler with names in summary

Раньше: каждый инструмент — отдельный <details>.
Теперь: один <details> с именами всех инструментов в summary,
каждый инструмент внутри с <b>toolName</b> заголовком.
This commit is contained in:
Бородин Роман 2026-09-26 11:32:14 +03:00
parent 1778231a2d
commit 28992f8657
1 changed files with 9 additions and 6 deletions

View File

@ -330,19 +330,22 @@ async function runPlugin(ctx: any, options: any, dataDir: string) {
parts.push(`<details>\n<summary>Thinking</summary>\n\n${step.reasoning}\n\n</details>`) parts.push(`<details>\n<summary>Thinking</summary>\n\n${step.reasoning}\n\n</details>`)
} }
// Tool calls // Tool calls — all in one spoiler with tool names in summary
if (step.tools.length > 0) { if (step.tools.length > 0) {
const toolNames = step.tools.map(t => t.name).join(", ")
parts.push(`<details>\n<summary>🔧 ${toolNames}</summary>\n\n`)
for (const tool of step.tools) { for (const tool of step.tools) {
parts.push(`<details>\n<summary>🔧 ${tool.name}</summary>\n\n`) parts.push(`<b>${tool.name}</b>\n`)
parts.push(`<b>Args:</b>\n\`\`\`\n${tool.args}\n\`\`\`\n\n`) parts.push(`<b>Args:</b>\n\`\`\`\n${tool.args}\n\`\`\`\n`)
if (tool.failed) { if (tool.failed) {
parts.push(`<b>Failed:</b> ${tool.result}\n\n`) parts.push(`<b>Failed:</b> ${tool.result}\n`)
} else { } else {
parts.push(`<b>Result:</b>\n\`\`\`\n${tool.result}\n\`\`\`\n\n`) parts.push(`<b>Result:</b>\n\`\`\`\n${tool.result}\n\`\`\`\n`)
}
parts.push("\n")
} }
parts.push(`</details>`) parts.push(`</details>`)
} }
}
// Separator before text // Separator before text
if (step.text) { if (step.text) {