ai-devkit
ai-devkit copied to clipboard
feat(agent-manager): Rex terminal backend for agent discovery and send
Summary
Add a Rex TerminalBackend so agents the user started manually inside a Rex pane (not via ai-devkit agent start) can be found, focused, and messaged with ai-devkit agent send/open.
Context
packages/agent-manager/src/terminal/types.tsdefinesTerminalBackend(find(tty),focus,send,sendKey).- Existing backends: tmux, wezterm, ghostty, iterm2, terminal-app (
terminal/backends/). No Rex backend, so agents running in Rex fall back to the outer terminal app (or nothing).
Proposed approach
find: list blocks (rex block ls --jsonacross sessions) and match the agent pid / tty against each block'sprocessresult.focus:session.focus_block(+ clientsession.selectwhen Remote Control is enabled).send: paste +enter;sendKey:rex send-key(map ESC toescape).- Add
TerminalType.REX; register before the GUI terminal backends so the multiplexer wins over the host app (same as tmux).
Acceptance criteria
- [ ]
terminal/backends/rex.tsregistered inTERMINAL_BACKENDS - [ ]
ai-devkit agent listshows Rex-hosted agents with a Rex location;agent send/agent openwork for them - [ ] Unit tests in
packages/agent-manager/tests/
Related: #459 (shares the Rex CLI client).