(msg: ContextMessage, toolName: string, hint: string)
| 73 | } |
| 74 | |
| 75 | function formatToolResultMd(msg: ContextMessage, toolName: string, hint: string): string { |
| 76 | const callId = msg.toolCallId ?? 'unknown'; |
| 77 | const parts: string[] = []; |
| 78 | for (const part of msg.content) { |
| 79 | const text = formatContentPartMd(part); |
| 80 | if (text.trim()) parts.push(text); |
| 81 | } |
| 82 | const resultText = parts.join('\n'); |
| 83 | |
| 84 | let summary = `Tool Result: ${toolName}`; |
| 85 | if (hint) summary += ` (\`${hint}\`)`; |
| 86 | |
| 87 | return ( |
| 88 | `<details><summary>${summary}</summary>\n\n` + |
| 89 | `<!-- call_id: ${callId} -->\n` + |
| 90 | `${resultText}\n\n` + |
| 91 | '</details>' |
| 92 | ); |
| 93 | } |
| 94 | |
| 95 | const INTERNAL_ORIGINS = new Set<PromptOrigin['kind']>([ |
| 96 | 'injection', |
no test coverage detected