(log: SDKMessage[])
| 209 | * Searches all assistant messages for <ultraplan>...</ultraplan> tags. |
| 210 | */ |
| 211 | export function extractPlanFromLog(log: SDKMessage[]): string | null { |
| 212 | // Walk backwards through assistant messages to find <ultraplan> content |
| 213 | for (let i = log.length - 1; i >= 0; i--) { |
| 214 | const msg = log[i]; |
| 215 | if (msg?.type !== 'assistant') continue; |
| 216 | const fullText = extractTextContent(msg.message.content, '\n'); |
| 217 | const plan = extractTag(fullText, ULTRAPLAN_TAG); |
| 218 | if (plan?.trim()) return plan.trim(); |
| 219 | } |
| 220 | return null; |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Enqueue an ultraplan-specific failure notification. Unlike enqueueRemoteNotification |
nothing calls this directly
no test coverage detected