feat: show execute result as spoiler after child tools

Порядок когда execute имеет детей:
1. Thinking spoiler
2. Каждый дочерний инструмент с args
3. Execute result spoiler
4. --- separator + step.text
This commit is contained in:
Бородин Роман 2026-09-27 13:50:22 +03:00
parent 542f72d449
commit 26cc61d26f
1 changed files with 7 additions and 2 deletions

View File

@ -579,8 +579,7 @@ async function runPlugin(ctx: any, options: any, dataDir: string) {
: [] : []
if (childTools.length > 0) { if (childTools.length > 0) {
// Execute has child tool calls — show only children, skip execute entirely // Execute has child tool calls — show children, then execute result
// (execute result is in step.text, shown after "---")
for (const child of childTools) { for (const child of childTools) {
parts.push(`<details>\n<summary>🔧 ${child.name}</summary>\n\n`) parts.push(`<details>\n<summary>🔧 ${child.name}</summary>\n\n`)
parts.push(`<b>Args:</b>\n\`\`\`\n${child.args}\n\`\`\`\n\n`) parts.push(`<b>Args:</b>\n\`\`\`\n${child.args}\n\`\`\`\n\n`)
@ -591,6 +590,12 @@ async function runPlugin(ctx: any, options: any, dataDir: string) {
} }
parts.push(`</details>`) parts.push(`</details>`)
} }
// Execute result as a separate spoiler (like a regular tool result)
if (executeTool?.result) {
parts.push(`<details>\n<summary>🔧 execute</summary>\n\n`)
parts.push(`<b>Result:</b>\n\`\`\`\n${executeTool.result}\n\`\`\`\n\n`)
parts.push(`</details>`)
}
} else { } else {
// No child tool calls — show tools normally (including execute as-is) // No child tool calls — show tools normally (including execute as-is)
for (const tool of step.tools) { for (const tool of step.tools) {