Restrict the token-free proxy socket to ticketed persistent PTY connects.
OpenCode builds per-directory services before it validates an /api/pty
ticket, so that route must not be reachable without the Manager token.
- Reject untrusted Origins and an uninitialized lifecycle before upgrading
- Open the upstream socket first and answer 403 on rejection instead of
upgrading and closing
- Handle ticketed sockets before the repo lookup and the password read
- Cap client-to-upstream buffering at 4 MiB and add a 10 s connect deadline
- Share bridge handlers, peer wrapper, proxy prefix and WebSocket URL helpers
- Remove persistent PTYs with their directory in TerminalService.removeAll