MCPcopy Create free account
hub / github.com/freecodexyz/free-code / extractPlanFromLog

Function extractPlanFromLog

src/tasks/RemoteAgentTask/RemoteAgentTask.tsx:208–218  ·  view source on GitHub ↗
(log: SDKMessage[])

Source from the content-addressed store, hash-verified

206 * Searches all assistant messages for <ultraplan>...</ultraplan> tags.
207 */
208export 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

Callers

nothing calls this directly

Calls 2

extractTextContentFunction · 0.85
extractTagFunction · 0.85

Tested by

no test coverage detected