(part: Part, options: TranscriptOptions)
| 82 | } |
| 83 | |
| 84 | export function formatPart(part: Part, options: TranscriptOptions): string { |
| 85 | if (part.type === "text" && !part.synthetic) { |
| 86 | return `${part.text}\n\n` |
| 87 | } |
| 88 | |
| 89 | if (part.type === "reasoning") { |
| 90 | if (options.thinking) { |
| 91 | return `_Thinking:_\n\n${part.text}\n\n` |
| 92 | } |
| 93 | return "" |
| 94 | } |
| 95 | |
| 96 | if (part.type === "tool") { |
| 97 | let result = `**Tool: ${part.tool}**\n` |
| 98 | if (options.toolDetails && part.state.input) { |
| 99 | result += `\n**Input:**\n\`\`\`json\n${JSON.stringify(part.state.input, null, 2)}\n\`\`\`\n` |
| 100 | } |
| 101 | if (options.toolDetails && part.state.status === "completed" && part.state.output) { |
| 102 | result += `\n**Output:**\n\`\`\`\n${part.state.output}\n\`\`\`\n` |
| 103 | } |
| 104 | if (options.toolDetails && part.state.status === "error" && part.state.error) { |
| 105 | result += `\n**Error:**\n\`\`\`\n${part.state.error}\n\`\`\`\n` |
| 106 | } |
| 107 | result += `\n` |
| 108 | return result |
| 109 | } |
| 110 | |
| 111 | return "" |
| 112 | } |
no outgoing calls
no test coverage detected