MCPcopy Create free account
hub / github.com/block/buzz / buildNode

Function buildNode

desktop/src/features/agent-memory/lib/buildMemoryGraph.ts:82–97  ·  view source on GitHub ↗
(entry: EngramEntry)

Source from the content-addressed store, hash-verified

80 }
81
82 function buildNode(entry: EngramEntry): MemoryTreeNode {
83 visited.add(entry.slug);
84 const children: MemoryTreeNode[] = [];
85 for (const refSlug of entry.outgoingRefs) {
86 const target = bySlug.get(refSlug);
87 if (!target) {
88 recordDangling(refSlug, entry.slug);
89 continue;
90 }
91 // Skip self-refs and already-visited nodes; the visited guard makes
92 // the recursion finite even on cyclic graphs.
93 if (visited.has(target.slug)) continue;
94 children.push(buildNode(target));
95 }
96 return { entry, children };
97 }
98
99 const rootedTree = listing.core ? buildNode(listing.core) : null;
100

Callers 2

buildMemoryGraphFunction · 0.85
splitByPatternFunction · 0.85

Calls 4

recordDanglingFunction · 0.85
hasMethod · 0.80
pushMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected