For this environment, the reliable path is writing to the PTY master, not the slave.
For message MSG:
\x1b[200~MSG\x1b[201~200 ms\rClaude Code’s terminal UI enables bracketed paste mode and handles pasted content as a unit.
/dev/pts/N Is WrongWriting to the slave PTY usually goes to display output rather than the input queue consumed by the terminal application.
The helper used here is:
/home/xertrov/src/meta-agent/apps/ma_adapter_claude/priv/pty_injectIt already has the needed capability on this machine:
cap_sys_ptrace=epThis machine uses Ghostty and a single process can hold multiple PTY masters. The discovery code maps a target pts/N to the correct Ghostty master fd by scanning fdinfo for tty-index.