(session: RenderSession)
| 45 | } |
| 46 | |
| 47 | function sessionToToolResponse(session: RenderSession): ToolResponse { |
| 48 | const text = session.finalize(); |
| 49 | const attachments = session.getAttachments(); |
| 50 | |
| 51 | const content: ToolResponse['content'] = []; |
| 52 | if (text) { |
| 53 | content.push({ type: 'text' as const, text }); |
| 54 | } |
| 55 | for (const attachment of attachments) { |
| 56 | content.push({ |
| 57 | type: 'image' as const, |
| 58 | data: attachment.data, |
| 59 | mimeType: attachment.mimeType, |
| 60 | }); |
| 61 | } |
| 62 | |
| 63 | const structuredContent = buildStructuredContent(session); |
| 64 | |
| 65 | return { |
| 66 | content, |
| 67 | isError: session.isError() || undefined, |
| 68 | ...(structuredContent ? { structuredContent } : {}), |
| 69 | }; |
| 70 | } |
| 71 | |
| 72 | export interface RuntimeToolInfo { |
| 73 | enabledWorkflows: string[]; |
no test coverage detected