Skip to content

feat(tui): --connect mode to attach TUI to remote daemon via A2A SSE #585

@bug-ops

Description

@bug-ops

Parent

Part of #581. Depends on streaming TaskProcessor and --daemon issues.

Summary

Add --connect <url> CLI flag that starts TUI in remote mode: connects to a running daemon's A2A endpoint, sends user messages, renders streaming SSE responses token-by-token.

Scope

Files: src/main.rs, crates/zeph-tui/src/lib.rs (minor)

CLI flag

#[cfg(all(feature = "tui", feature = "a2a"))]
#[arg(long, value_name = "URL")]
connect: Option<String>,

run_tui_remote(url, auth_token) function

  1. Create A2aClient with ssrf_protection=false, require_tls=false (localhost)
  2. Generate context_id = Uuid::new_v4() for session continuity
  3. Build TUI App with standard mpsc channels
  4. SSE pump task: for each user input from user_rx:
    • Build SendMessageParams with message.context_id
    • Call client.stream_message()TaskEventStream
    • Map SSE events to AgentEvent:
      • ArtifactUpdate(text, !is_final)AgentEvent::Chunk
      • StatusUpdate(Working)AgentEvent::Typing
      • StatusUpdate(Completed)AgentEvent::Flush
      • StatusUpdate(Failed)AgentEvent::FullMessage("Error: ...")
  5. No changes to App rendering — it already handles AgentEvent

Acceptance Criteria

  • cargo run --features tui,a2a -- --connect http://localhost:8080 connects to daemon
  • User input sent as A2A messages, responses streamed token-by-token
  • Multi-turn conversation works (context persists via context_id)
  • Connection error shown gracefully in TUI
  • Ctrl-C exits TUI cleanly

Metadata

Metadata

Assignees

No one assigned

    Labels

    a2aA2A protocol integrationfeatureNew functionalitypriority/highHigh prioritysize/MtuiTUI dashboard

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions