Sending a buffer of text to the Sonic Pi Server (Python)


I’m experimenting a bit these days with Python and Sonic Pi. I’m playing with a tiny text editor made with the package prompt-toolkit (Prompt Toolkit Documentation). What I’m trying to achieve by doing so is creating my own personal terminal interface for Sonic-Pi with mutiline support, custom syntax highlighting, etc…

I have seen that some of you have already tried to communicate with the Sonic Pi server from outside the application. My question is relatively simple: how is Sonic Pi sending a whole buffer of text to the server ? Is it possible to send a buffer of text from outside the software to the software/server parser ?

Thanks a lot for your help!

PS : is there a list of the different instructions the server can receive ? (how does Sonic Pi manages the option panel, the play / pause / record buttons, etc…) ?