Files
codex/codex-rs/code-mode-host/src/main.rs
Channing Conger c0ad3ab014 Add gRPC TCP transport to the code-mode host (#37745)
## What changed

- Accept `grpc://IP:PORT` endpoints through `--listen` and serve the existing
  code-mode gRPC service over TCP.
- Print the bound HTTP endpoint to stdout so callers can discover the port when
  binding to port `0`.
- Apply the protocol frame-size limits and disable Nagle's algorithm on accepted
  connections.

## Testing

- Add an end-to-end test that starts the host on an ephemeral port, connects a
  gRPC client, and opens a session.
- Verify accepted gRPC sockets have `TCP_NODELAY` enabled.

GitOrigin-RevId: 51d6c21dff8cffb47068c0677ba10ff370385cec
2026-08-09 23:39:25 +00:00

24 lines
596 B
Rust

use clap::Parser;
#[derive(Debug, Parser)]
struct Cli {
/// Transport endpoint: `stdio`, `stdio://`, `ws://IP:PORT`, or `grpc://IP:PORT`.
#[arg(
long,
value_name = "URL",
default_value = codex_code_mode_host::DEFAULT_LISTEN_URL
)]
listen: String,
}
#[tokio::main(flavor = "current_thread")]
async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
.with_writer(std::io::stderr)
.with_ansi(false)
.init();
codex_code_mode_host::run_main(&Cli::parse().listen).await
}