refactor(workspace): align layout with hero_compute #30
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refactor/align-with-hero-compute"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
hero_compute_server's simpler model:build.rslives in the server crate, no separate core crate, single-file SDK, bin-only UI crate.rpc.rs,openrpc.json, and the generated files preserve history.single_bin,bin_companions,bin_ui,client_crate_dir,sdk_types_crate,with_wasm,nested_layout, orautobins = falseanywhere in the repo.Related issue
Closes #29
Changes by crate
crates/hero_livekit/— deleted entirely. The 962-line handwritten orchestrator (livekit/server/rpc.rs— install/configure/start/stop/restart/status, room+participant ops, JWT signing, lifecycle triggers) is harvested intohero_livekit_server/src/livekit/rpc.rs.crates/hero_livekit_server/— newbuild.rswith the minimal compute-styleOschemaBuildConfig.Cargo.tomldrops thehero_livekitdep, gainsreqwest,jsonwebtoken,flate2,tar,dirs,herolib_sid, plus[build-dependencies] hero_rpc_osis, plus[features] default = ["livekit"]; livekit = []to mirror compute. Thelivekit/server/mod.rsis the compute bridge pattern (path-includes the flat generated files + handwrittenrpc.rs).crates/hero_livekit_sdk/— collapsed to a singlesrc/lib.rs(~270 lines) modeled onhero_compute_sdk:openrpc_client!("../hero_livekit_server/openrpc.json", name = "LiveKitClient")plus env / socket / proxy / HTTP-RPC helpers.build.rs,src/openrpc.rs, and the entiresrc/livekit/subtree are gone.Cargo.tomltrimmed to compute's dep set; droppedhero_rpc_client,herolib_otoml,herolib_sid, the[features]block, and[lints.clippy].crates/hero_livekit_ui/— collapsed lib + bin into bin-only.src/lib.rsdeleted; contents moved intosrc/server.rswith apub async fn run() -> anyhow::Result<()>entry point.src/main.rsis now 9 lines,src/assets.rsextracted as a smallrust_embedmodule (mirrorshero_compute_ui).[lib]target removed. Dropped the deadWhitelistState::new()async ctor — onlynew_blocking()is used.crates/hero_livekit_examples/,crates/hero_livekit_rhai/— single-line import fix:hero_livekit_sdk::openrpc::*→hero_livekit_sdk::*. No behavior change.crates/hero_livekit_backend/— untouched.Cargo.toml— removedcrates/hero_livekitfrom members and thehero_livekitworkspace dep. Addeddotenvy = "0.15". Updatedherolib_coretodefault-features = false, features = ["openrpc-transport"]to match compute and the SDK override..gitignore— addedcrates/hero_livekit_server/sdk/andcrates/hero_livekit_server/openrpc.client.generated.rs(mirrors compute's gitignore).Local generator workarounds
The current
OschemaBuilderemits a few things that don't match the layout we want:livekit/mod.rswithpub use self as core;andpub use self as server;— invalid Rust syntax.core/mod.rsbridge for the cfg-gated WASM types path.osis_server_generated.rsshipsinclude_str!("../core/openrpc.json")pointing nowhere.The new
build.rsworks around all three locally and inline-documented:livekit/mod.rswith the canonical nested-bridge form.livekit/core/mod.rs(cfg-gated path-includes totypes.rs/types_wasm_generated.rs).include_str!path in the generated server file to read the spec from its sibling.When the generator is fixed upstream, those three blocks can be removed.
Test plan
cargo build --workspacecargo clippy --workspace --all-targets -- -D warningscargo test --workspace— 31 tests passed, 0 failed, 2 doc-tests ignoredsingle_bin,bin_companions,bin_ui,client_crate_dir,sdk_types_crate,with_wasm,nested_layout,autobins = false,hero_livekit::livekit::,hero_livekit_sdk::openrpc::,hero_livekit_sdk::livekit::cargo run --bin hero_livekit_serveragainst a fresh socket dircargo run --example basic_usageagainst the running server