ai-devkit icon indicating copy to clipboard operation
ai-devkit copied to clipboard

feat(agent-manager): Rex agent runtime provider

Open codeaholicguy opened this issue 2 weeks ago • 0 comments

Summary

Add Rex as an InteractiveAgentRuntime provider so ai-devkit agent start/send/wait/kill/console work natively in Rex. This is the foundation for #460, #462, #463.

Context

  • packages/agent-manager/src/runtime/types.ts defines InteractiveAgentRuntime; tmux and herdr implement it today.
  • runtime/herdr/HerdrAgentRuntime.ts (+ HerdrCliClient, HerdrRuntimeRef, response parsers) is the closest template, including the optional wait / readOutput.
  • utils/AgentRegistry.ts: AGENT_RUNTIME_PROVIDERS = ["tmux", "herdr"].

Proposed mapping

Runtime method Rex
isAvailable rex version / rex whoami --json; insideRuntime from REX_SESSION, currentPaneId from REX_BLOCK
startAgent rex run (new tab) or rex split -b $REX_BLOCK with --label <name> -c <cwd> --focus=false --json -- <cmd>; pid from rex block call -b <block> process
send paste via block.event (bracketed paste) then rex send-key enter
focus session.focus_block; optionally rex -C <client> do session.select (needs Remote Control)
stop rex block close <block>
readOutput rex capture -b <block> --trim --unwrap
wait rex wait / program_status (see status issue)

Runtime ref: { sessionId, windowId?, blockId, server? }.

Acceptance criteria

  • [ ] RexAgentRuntime + RexCliClient + RexRuntimeRef under runtime/rex/, wired into RuntimeFactory and AGENT_RUNTIME_PROVIDERS
  • [ ] agent start --runtime rex (or equivalent config) starts an agent in a labelled Rex pane, and list/send/open/kill work against it
  • [ ] Clear errors for binary-missing / backend-unreachable
  • [ ] Unit tests in packages/agent-manager/tests/ with an injected command runner (no real Rex required)

Notes / risks

  • Rex is preview (0.1.0-preview.20, API revision 16); check server.version and fail clearly on an unsupported revision.
  • rex resize / rex block new are not implemented in the CLI yet; use rex api call where needed.
  • Panes started with --keep-open stay visible after exit; stop must close the block.

codeaholicguy avatar Nov 18 '26 09:11 codeaholicguy