Iād recommend looking at the source for druid. Itās pretty short and concise. You can see the serial sending stuff here. Thereās a lot of moving parts going on, and the serial port behaviour is platform dependent (below the python layer).
Iād also recommend reading crowās readme-development document which outlines a number of considerations when building applications that talk to crow.
Additionally, thereās a work-in-progress electron app here that is covering similar territory I believe.
Regarding sending code, I would note specifically that using ^^s and ^^e will reset the lua environment every time, so they are designed for uploading whole scripts. If you want to send code to be executed in the Lua environment on top of the current state, youāll need to use the āmultilineā characters (three backticks surrounding the code block, like markdown) to avoid evaluation errors. That input buffer is 2kB, but perhaps there is something else going on causing the 380 char limit.
If you have some way for us to observe the unresponsive state I should be able to debug whatās causing it, but itās a little hard because none of my tools are able to send this right now. If you want to open a Github issue on the crow repo thatās probably the best way for us to look into this further, and not have it buried here.