FocusSession tries to focus the iTerm2 session whose underlying process is `binary` running with `--session-id ` or `--resume ` (or any flag carrying the UUID). The `binary` arg is the harness's executable name (e.g. "claude", "codex", "gemini") used to filter ps rows. Returns
(sessionID, binary string)
| 98 | // controlling tty, then drive osascript to walk every window/tab/ |
| 99 | // session and select the one whose `tty` property matches. |
| 100 | func FocusSession(sessionID, binary string) (bool, error) { |
| 101 | if sessionID == "" { |
| 102 | return false, nil |
| 103 | } |
| 104 | tty, err := ttyForHarnessSession(sessionID, binary) |
| 105 | if err != nil { |
| 106 | return false, err |
| 107 | } |
| 108 | if tty == "" { |
| 109 | return false, nil |
| 110 | } |
| 111 | return focusByTTY(tty) |
| 112 | } |
| 113 | |
| 114 | // sessionUUIDRowRe matches a `ps` line carrying a session UUID via |
| 115 | // `--session-id <uuid>` or `--resume <uuid>`. Paired with a binary- |