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

Method buildDynamicBoundaries

src/mcp/tools.ts:3972–4000  ·  view source on GitHub ↗

* Dynamic-boundary surfacing (#687): when the flow among the agent's named * symbols does not fully connect, scan the disconnected symbols' bodies for * dynamic-dispatch sites (computed member calls, getattr, reflection, typed * message buses, runtime-keyed emits) and ANNOUNCE the boundary

(cg: CodeGraph, scanList: Node[], named: Map<string, Node>)

Source from the content-addressed store, hash-verified

3970 * connected flow never reaches this method.
3971 */
3972 private buildDynamicBoundaries(cg: CodeGraph, scanList: Node[], named: Map<string, Node>): string {
3973 const MAX_NOTES = 4; // boundary bullets per explore
3974 // The verdict is not derived here — `findDynamicBoundaries` produces it and
3975 // the viewer's end cap renders the same object, so the two can never
3976 // disagree about where a flow stops. What is left here is the prose.
3977 const reports = findDynamicBoundaries(cg, scanList, { named, maxSites: MAX_NOTES });
3978 const notes: string[] = [];
3979 for (const report of reports) {
3980 if (notes.length >= MAX_NOTES) break;
3981 for (const site of report.sites) {
3982 if (notes.length >= MAX_NOTES) break;
3983 const more = site.moreSites
3984 ? ` (+${site.moreSites} more such site${site.moreSites > 1 ? 's' : ''} in this body)`
3985 : '';
3986 notes.push(`- \`${report.node.name}\` (${report.node.filePath}:${site.line}) — ${site.label}: \`${site.snippet}\`${more}`);
3987 const cand = this.boundaryCandidates(site);
3988 if (cand) notes.push(` ${cand}`);
3989 }
3990 }
3991 if (notes.length === 0) return '';
3992 return [
3993 '**Dynamic boundaries (the static path ends at runtime dispatch)**',
3994 '',
3995 ...notes,
3996 '',
3997 `> These sites choose their call target at runtime (registry / bus / reflection) — the site shown IS where the flow continues. To follow it, run codegraph_explore${this.isToolServed('node') ? ' or codegraph_node' : ''} on a candidate; source for the sites above is included below.`,
3998 '',
3999 ].join('\n');
4000 }
4001
4002 /**
4003 * Interface/registry-dispatch announcement — #687 extended to GRAPH-visible

Callers 1

Calls 5

boundaryCandidatesMethod · 0.95
isToolServedMethod · 0.95
findDynamicBoundariesFunction · 0.90
pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected