(parts: MessagePart[])
| 241 | * @returns The combined prompt text, or `undefined` if empty |
| 242 | */ |
| 243 | export function extractPrompt(parts: MessagePart[]): string | undefined { |
| 244 | const texts = parts |
| 245 | .filter((p) => p.type === "text" && typeof p.text === "string") |
| 246 | .map((p) => p.text as string); |
| 247 | |
| 248 | const combined = texts.join("\n").trim(); |
| 249 | return combined.length > 0 ? combined : undefined; |
| 250 | } |
no outgoing calls
no test coverage detected