Files
rutster/crates/rutster-tap-echo/src/main.rs
opencode controller 237a1388a4 feat(tap-echo): Rust reference echo brain + test server (spec §2.3)
- start_echo_server(addr): in-process WS server for integration tests;
  returns EchoHandle { shutdown, join, addr }.
- echo_one_connection: the per-connection echo loop — hello handshake,
  audio_in → audio_out (same PCM), bye/session_end graceful close.
- Reuses rutster-tap's protocol types — the wire-types-reusable contract
  test (spec §2.3).
- Stateless across reconnects (spec §5.3) — every hello starts fresh.
- Standalone binary: binds ws://127.0.0.1:8081, runs forever.
- 1 unit test exercises full hello/ack/audio_in/audio_out/bye over a
  TCP loopback pair.

Spec ref: 2026-06-28-slice-2-agent-tap-design.md §2.3, §5.3.
2026-06-28 17:20:00 -04:00

24 lines
787 B
Rust

//! Standalone binary: bind `ws://127.0.0.1:8081/echo`, echo audio_in → audio_out.
//! Dev-loop brain the core dials out to (spec §2.3, §8.3).
use std::net::SocketAddr;
use rutster_tap_echo::start_echo_server;
use tracing::info;
#[tokio::main]
async fn main() {
tracing_subscriber::fmt()
.with_env_filter(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| "rutster_tap_echo=info".into()),
)
.init();
let addr: SocketAddr = "127.0.0.1:8081".parse().expect("valid addr");
info!(%addr, "rutster-tap-echo listening");
let handle = start_echo_server(addr).await.expect("bind ok");
// Run forever (Ctrl-C terminates the process; no graceful shutdown yet).
let _ = handle.join.await;
}