Skip to content

feat: receive agentInput (remote agent control v1, Atem side)#11

Open
guohai wants to merge 1 commit into
mainfrom
feat/agent-input-receiver
Open

feat: receive agentInput (remote agent control v1, Atem side)#11
guohai wants to merge 1 commit into
mainfrom
feat/agent-input-receiver

Conversation

@guohai

@guohai guohai commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Completes the Atem side of remote agent control v1. Astation (merged in Agora-Build/Astation PR #6) now sends agentInput; this PR makes Atem receive it and drive the focused coding agent's terminal — so you can type instructions or send control keys (interrupt, approve/reject a tool prompt) to a Claude Code / Codex session running under atem.

Before this, Astation's remote-control UI emitted agentInput and Atem silently dropped it (only the design existed). Now the round-trip is complete.

What it does

  • New message: AstationMessage::AgentInput { agent_id, kind, text, key } — matches the merged Astation wire shape exactly ({type:"agentInput", data:{agentId?, kind, text?, key?}}), grounded in Astation/Sources/Menubar/AstationMessage.swift.
  • handle_agent_input:
    • kind:"text" → trim + skip-empty, then type the line and submit (\n\r, matching the app's existing send_claude_prompt).
    • kind:"key" → write raw PTY bytes via agent_key_to_bytes (enter/esc/ctrl-c/up/down/left/right/y/n).
    • Routes to the codex PTY when it's the focused chat, else claude (mirrors the voice path's default target).
    • No-ops if no agent session is live — v1 drives an already-running agent only (non-goal: attaching to an agent atem didn't launch).
  • agent_id is ignored in v1 (focused/only agent = current chat mode).

Tests

10 new tests, all green: wire deserialization + roundtrip, key→bytes mapping, and handler routing asserting the exact bytes reach the PTY (text submit sequence, raw control bytes, codex routing, empty-text drop, unknown-key drop).

cargo build clean. agentInput suite fully passing. (The repo has a known pre-existing parallel-fs flake in agent_visualize::tests unrelated to this change — passes serially.)

Reviewed

Passed a code-quality review against the actual Astation contract (key strings, CSI byte sequences verified against tui/mod.rs) — approved, no Critical/Important issues. Applied the suggested empty-text guard and synced the design doc (designs/remote-agent-control.md) to the real \n\r submit sequence.

Design: designs/remote-agent-control.md.

Generated with SMT smt@agora.build

…t PTY

Completes the Atem side of remote agent control v1. Astation (merged) sends
`agentInput` over the relay; Atem now receives it and drives the focused
agent's terminal.

- AstationMessage::AgentInput { agent_id, kind, text, key } matching the
  Astation wire shape exactly ({type:"agentInput", data:{agentId?, kind,
  text?, key?}}).
- handle_agent_input: kind:"text" trims/skips-empty then types the line +
  submit sequence (\n\r, matching send_claude_prompt); kind:"key" writes raw
  PTY bytes via agent_key_to_bytes (enter/esc/ctrl-c/up/down/left/right/y/n).
- Routes to the codex PTY when it's the focused chat, else claude; no-ops if
  no agent session is live (v1: drives an already-running agent only).
- 10 tests: wire deserialization/roundtrip, key→bytes mapping, and handler
  routing asserting exact bytes reach the PTY (incl. empty-text + unknown-key).

🤖 Built with SMT <smt@agora.build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant