(Title was "ParsoidExtensionAPI: Provide a new method for extensions to access enclosing template parameters" but I'm going to retitle it with a more generic description of the problem, so we can describe possible solutions, one of which may involve providing frame access from the ParsoidExtensionAPI.)
See discussion in https://www.mediawiki.org/w/index.php?title=Topic:Xqalap62gl5lw6nf&topic_showPostId=xqeqg1irns773udq&fromnotif=1#flow-post-xqeqg1irns773udq
Consider a template {{my-template}arg1}arg2 .. |argn}} whose implementation includes an extension tag: <ext>... value-of-arg1 .. value-of-arg2 .. </ext>. So, the extension's tag handler might need access to enclosing transclusion's parameters.
We should either pass these through the sourceToDom API method or provide a separate method for extensions to query.