pub fn build_graph(ast: JsValue) -> Result<JsValue, JsValue>
Build a reference graph from an AgentScript AST.