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

Function extractPlanFromLog

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

Source from the content-addressed store, hash-verified

209 * Searches all assistant messages for <ultraplan>...</ultraplan> tags.
210 */
211export 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

Callers

nothing calls this directly

Calls 2

extractTextContentFunction · 0.85
extractTagFunction · 0.85

Tested by

no test coverage detected