How are you able to do this with all of Apple's restrictions? I know there's the accessibility API, but since Mojave the user needs to manually grant permission to do control each individual target app, is that what they need to do for Yoink?

Can't speak to Yoink but I built a project a year or two ago that did something similar. I used a stupid simple method - input simulation (using the fantastic enigo library). And if you want context, you can simulate select all + copy, and access via clipboard. Similar if you want to replace, etc.

https://github.com/jasonjmcghee/plock

The goal of this project was to just be able to pipe / run arbitrary commands from any text context. But, that lined up well with LLMs usage.

Sorry for the late reply! Not super familiar with HN and didn't have email notifs on :/ thought my launch here flopped completely...

We use a mix of accessibility, GUI trees, and pastebins for this!