I’ve put quite some work into something similar.
The aim is to make native APIs easily accessible for extensions, my approach has all extensions start their own native app, though.
The native program then locates the current extension on the disk and makes the files inside available to be require
ed as node.js modules. That way it makes sure to only execute code that the developer intended, and doesn’t just eval
something send to it. And the extension developers don’t have to worry about the native messaging protocol or most aspects of RPC at all.
A good portion of the project is already pretty well documented, others parts I didn’t have the time for yet. I am open to questions and suggestions.
More to the topic of this thread:
I am also working on a major update to my Wikipedia Peek extension. It currently only shows previews of Wikipedia articles on Wikipedia, I want to make it display previews for all kinds of links everywhere.
For the latter, I implemented an cross extension mechanism to allow other extensions to become providers of the previews. It works, but the entire thing is still very much beta, though.
I hope I remember to update this here once it is done!