Skip to content

Commit 5c79a81

Browse files
Add web client for session management and console interaction
Implements a full-featured web interface for mux with: - TypeScript type generation from Rust structs via TypeShare - HTTP/WebSocket API for session management and real-time updates - Type-safe TypeScript client library (@mux/client) - React 19 frontend with session list, console, and chat interface - Terminal emulation with xterm.js for browser-based console access - Embedded static file serving in Rust binary via include_dir Architecture: - Dual protocol: Unix socket (existing CLI/TUI) + HTTP server (web) - REST API endpoints for CRUD operations on sessions - WebSocket /ws/events for real-time session updates - WebSocket /ws/console/:id for PTY streaming with base64 encoding - Vite + Tailwind CSS v4 + Radix UI for modern frontend Usage: - Start daemon with: cargo run -- daemon --http-port 3030 - Access web UI at: http://localhost:3030 - Zero breaking changes to existing CLI/TUI functionality 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 5b1394b commit 5c79a81

48 files changed

Lines changed: 3848 additions & 18 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/multiplexer/Cargo.lock

Lines changed: 76 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/multiplexer/Cargo.toml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ exec = "0.3"
5555
async-trait = "0.1"
5656
nucleo-matcher = "0.3"
5757
fs2 = "0.4"
58+
base64 = "0.22"
59+
include_dir = "0.7"
60+
mime_guess = "2"
5861

5962
# HTTP Proxy with TLS interception
6063
hudsucker = { version = "0.24", default-features = false, features = ["rcgen-ca", "rustls-client"] }
@@ -77,18 +80,20 @@ serde_yaml = "0.9"
7780
# Time handling (for certificate generation)
7881
time = "0.3"
7982

83+
# HTTP/WebSocket server
84+
axum = { version = "0.7", features = ["ws"] }
85+
tower = "0.5"
86+
tower-http = { version = "0.6", features = ["cors", "trace"] }
87+
hyper = { version = "1", features = ["full"] }
88+
hyper-util = { version = "0.1", features = ["tokio", "server"] }
89+
http-body-util = "0.1"
90+
8091
[dev-dependencies]
8192
cargo-husky = { version = "1", features = ["precommit-hook", "run-cargo-fmt", "run-cargo-clippy"] }
8293
tempfile = "3"
83-
base64 = "0.22"
8494
proptest = "1.0"
8595

86-
# HTTP server/client for integration tests
87-
axum = "0.7"
88-
hyper = { version = "1", features = ["full"] }
89-
hyper-util = { version = "0.1", features = ["tokio", "server"] }
90-
http-body-util = "0.1"
91-
tower = "0.5"
96+
# HTTP client for integration tests
9297
reqwest = { version = "0.12", features = ["json", "blocking"] }
9398
tokio-test = "0.4"
9499

packages/multiplexer/build.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
use std::path::PathBuf;
2+
use std::process::Command;
3+
4+
fn main() {
5+
// Output directory for generated TypeScript types
6+
let output_dir = PathBuf::from("web/shared/src/generated");
7+
8+
// Ensure output directory exists
9+
std::fs::create_dir_all(&output_dir).expect("Failed to create output directory");
10+
11+
// Run TypeShare CLI to generate TypeScript types
12+
// This requires 'typeshare' to be installed: cargo install typeshare-cli
13+
let status = Command::new("typeshare")
14+
.arg(".")
15+
.arg("--lang=typescript")
16+
.arg(format!("--output-file={}/index.ts", output_dir.display()))
17+
.status();
18+
19+
match status {
20+
Ok(exit_status) if exit_status.success() => {
21+
println!("cargo:warning=TypeShare generation completed successfully");
22+
}
23+
Ok(exit_status) => {
24+
println!("cargo:warning=TypeShare CLI failed with status: {}", exit_status);
25+
println!("cargo:warning=Install typeshare-cli: cargo install typeshare-cli");
26+
}
27+
Err(e) => {
28+
println!("cargo:warning=Failed to run TypeShare CLI: {}", e);
29+
println!("cargo:warning=Install typeshare-cli: cargo install typeshare-cli");
30+
}
31+
}
32+
33+
// Trigger rebuild if any Rust source files change
34+
println!("cargo:rerun-if-changed=src/");
35+
}

0 commit comments

Comments
 (0)