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