MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / finalAnswerText

Function finalAnswerText

scripts/agent-eval/parse-run.mjs:679–689  ·  view source on GitHub ↗
(events)

Source from the content-addressed store, hash-verified

677 * the main thread — intermediate narration would flood the citation set.
678 */
679export function finalAnswerText(events) {
680 const answers = events.filter((e) => e.type === 'result' && typeof e.result === 'string').map((e) => e.result);
681 if (answers.length) return answers.join('\n\n');
682 let last = '';
683 for (const ev of events) {
684 if (ev.type !== 'assistant' || (ev.parent_tool_use_id ?? null) !== null) continue;
685 const text = (ev.message?.content || []).filter((b) => b.type === 'text').map((b) => b.text || '').join('');
686 if (text.trim()) last = text;
687 }
688 return last;
689}
690
691/** The allocation block, as printed under a run and reused by aggregators. */
692export function formatAllocation(s, indent = ' ') {

Callers 3

parse-session.mjsFile · 0.90
parseSessionFunction · 0.85
selftestFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected