(toolName: string, state: CompletedToolState)
| 101 | } |
| 102 | |
| 103 | export function completedToolContent(toolName: string, state: CompletedToolState): ToolCallContent[] { |
| 104 | const text = |
| 105 | toolName.toLocaleLowerCase() === "read" ? (readDisplayText(state.metadata) ?? state.output) : state.output |
| 106 | const content: ToolCallContent[] = [ |
| 107 | { |
| 108 | type: "content", |
| 109 | content: { |
| 110 | type: "text", |
| 111 | text, |
| 112 | }, |
| 113 | }, |
| 114 | ] |
| 115 | |
| 116 | if (toToolKind(toolName) === "edit") { |
| 117 | content.push(...diffContent(state.input)) |
| 118 | } |
| 119 | |
| 120 | content.push(...imageContents(state.attachments ?? [])) |
| 121 | return content |
| 122 | } |
| 123 | |
| 124 | export function pendingToolCall(input: { |
| 125 | readonly toolCallId: string |
no test coverage detected