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

Function formatSufficiency

scripts/agent-eval/parse-run.mjs:925–946  ·  view source on GitHub ↗
(s, indent = '  ')

Source from the content-addressed store, hash-verified

923
924/** The sufficiency block, as printed under a run and reused by aggregators. */
925export function formatSufficiency(s, indent = ' ') {
926 const f = s.sufficiency;
927 if (!f.answered) {
928 return `${indent}Explore sufficiency: no answered codegraph_explore calls`
929 + (f.errors ? ` (${f.errors} errored or never returned)` : '');
930 }
931 const pct = (n) => ((n / f.answered) * 100).toFixed(0) + '%';
932 const out = [`${indent}Explore sufficiency — what the agent did NEXT (${f.answered} answered call${f.answered === 1 ? '' : 's'}):`];
933 for (const [key, label, meaning] of SUFFICIENCY) {
934 out.push(`${indent} ${String(f.counts[key]).padStart(3)} ${pct(f.counts[key]).padStart(4)} ${label.padEnd(31)}${meaning}`);
935 }
936 f.calls.forEach((c, i) => {
937 const q = c.query.length > 46 ? c.query.slice(0, 45) + '…' : c.query;
938 const where = c.thread && c.thread !== 'main' ? ' [subagent]' : '';
939 out.push(`${indent} ${i + 1}.${where} "${q}" [${c.files} file${c.files === 1 ? '' : 's'}] → ${c.next}`);
940 });
941 const notes = [];
942 if (f.errors) notes.push(`${f.errors} errored/unanswered call${f.errors === 1 ? '' : 's'} (not bucketed)`);
943 if (f.concurrent) notes.push(`${f.concurrent} file-access call${f.concurrent === 1 ? '' : 's'} in the SAME message as an explore (not a reaction)`);
944 if (notes.length) out.push(`${indent} note: ${notes.join(' · ')}`);
945 return out.join('\n');
946}
947
948// ---------------------------------------------------------------------------
949// `--selftest`: the occupancy math over synthetic transcripts with known

Callers 2

parse-session.mjsFile · 0.90
parse-run.mjsFile · 0.85

Calls 2

pctFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected