refactor(workspace): align layout with hero_compute #30

Merged
ashraf merged 4 commits from refactor/align-with-hero-compute into main 2026-04-28 07:29:19 +00:00
Owner

Summary

  • Strip the aspirational machinery added in PR #18 and reshape the workspace to match hero_compute_server's simpler model: build.rs lives in the server crate, no separate core crate, single-file SDK, bin-only UI crate.
  • 22 files deleted, 18 modified, 11 new. Git detects renames cleanly so rpc.rs, openrpc.json, and the generated files preserve history.
  • No single_bin, bin_companions, bin_ui, client_crate_dir, sdk_types_crate, with_wasm, nested_layout, or autobins = false anywhere in the repo.

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 into hero_livekit_server/src/livekit/rpc.rs.
  • crates/hero_livekit_server/ — new build.rs with the minimal compute-style OschemaBuildConfig. Cargo.toml drops the hero_livekit dep, gains reqwest, jsonwebtoken, flate2, tar, dirs, herolib_sid, plus [build-dependencies] hero_rpc_osis, plus [features] default = ["livekit"]; livekit = [] to mirror compute. The livekit/server/mod.rs is the compute bridge pattern (path-includes the flat generated files + handwritten rpc.rs).
  • crates/hero_livekit_sdk/ — collapsed to a single src/lib.rs (~270 lines) modeled on hero_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 entire src/livekit/ subtree are gone. Cargo.toml trimmed to compute's dep set; dropped hero_rpc_client, herolib_otoml, herolib_sid, the [features] block, and [lints.clippy].
  • crates/hero_livekit_ui/ — collapsed lib + bin into bin-only. src/lib.rs deleted; contents moved into src/server.rs with a pub async fn run() -> anyhow::Result<()> entry point. src/main.rs is now 9 lines, src/assets.rs extracted as a small rust_embed module (mirrors hero_compute_ui). [lib] target removed. Dropped the dead WhitelistState::new() async ctor — only new_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.
  • Workspace Cargo.toml — removed crates/hero_livekit from members and the hero_livekit workspace dep. Added dotenvy = "0.15". Updated herolib_core to default-features = false, features = ["openrpc-transport"] to match compute and the SDK override.
  • .gitignore — added crates/hero_livekit_server/sdk/ and crates/hero_livekit_server/openrpc.client.generated.rs (mirrors compute's gitignore).

Local generator workarounds

The current OschemaBuilder emits a few things that don't match the layout we want:

  1. livekit/mod.rs with pub use self as core; and pub use self as server; — invalid Rust syntax.
  2. No core/mod.rs bridge for the cfg-gated WASM types path.
  3. osis_server_generated.rs ships include_str!("../core/openrpc.json") pointing nowhere.

The new build.rs works around all three locally and inline-documented:

  • Overwrites livekit/mod.rs with the canonical nested-bridge form.
  • Creates livekit/core/mod.rs (cfg-gated path-includes to types.rs / types_wasm_generated.rs).
  • Patches the 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 --workspace
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace — 31 tests passed, 0 failed, 2 doc-tests ignored
  • Repo-wide grep confirms zero references to single_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::
  • Manual smoke: cargo run --bin hero_livekit_server against a fresh socket dir
  • Manual smoke: cargo run --example basic_usage against the running server
## Summary - Strip the aspirational machinery added in PR #18 and reshape the workspace to match `hero_compute_server`'s simpler model: `build.rs` lives in the server crate, no separate core crate, single-file SDK, bin-only UI crate. - 22 files deleted, 18 modified, 11 new. Git detects renames cleanly so `rpc.rs`, `openrpc.json`, and the generated files preserve history. - No `single_bin`, `bin_companions`, `bin_ui`, `client_crate_dir`, `sdk_types_crate`, `with_wasm`, `nested_layout`, or `autobins = false` anywhere 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 into `hero_livekit_server/src/livekit/rpc.rs`. - **`crates/hero_livekit_server/`** — new `build.rs` with the minimal compute-style `OschemaBuildConfig`. `Cargo.toml` drops the `hero_livekit` dep, gains `reqwest`, `jsonwebtoken`, `flate2`, `tar`, `dirs`, `herolib_sid`, plus `[build-dependencies] hero_rpc_osis`, plus `[features] default = ["livekit"]; livekit = []` to mirror compute. The `livekit/server/mod.rs` is the compute bridge pattern (path-includes the flat generated files + handwritten `rpc.rs`). - **`crates/hero_livekit_sdk/`** — collapsed to a single `src/lib.rs` (~270 lines) modeled on `hero_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 entire `src/livekit/` subtree are gone. `Cargo.toml` trimmed to compute's dep set; dropped `hero_rpc_client`, `herolib_otoml`, `herolib_sid`, the `[features]` block, and `[lints.clippy]`. - **`crates/hero_livekit_ui/`** — collapsed lib + bin into bin-only. `src/lib.rs` deleted; contents moved into `src/server.rs` with a `pub async fn run() -> anyhow::Result<()>` entry point. `src/main.rs` is now 9 lines, `src/assets.rs` extracted as a small `rust_embed` module (mirrors `hero_compute_ui`). `[lib]` target removed. Dropped the dead `WhitelistState::new()` async ctor — only `new_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. - **Workspace `Cargo.toml`** — removed `crates/hero_livekit` from members and the `hero_livekit` workspace dep. Added `dotenvy = "0.15"`. Updated `herolib_core` to `default-features = false, features = ["openrpc-transport"]` to match compute and the SDK override. - **`.gitignore`** — added `crates/hero_livekit_server/sdk/` and `crates/hero_livekit_server/openrpc.client.generated.rs` (mirrors compute's gitignore). ## Local generator workarounds The current `OschemaBuilder` emits a few things that don't match the layout we want: 1. `livekit/mod.rs` with `pub use self as core;` and `pub use self as server;` — invalid Rust syntax. 2. No `core/mod.rs` bridge for the cfg-gated WASM types path. 3. `osis_server_generated.rs` ships `include_str!("../core/openrpc.json")` pointing nowhere. The new `build.rs` works around all three locally and inline-documented: - Overwrites `livekit/mod.rs` with the canonical nested-bridge form. - Creates `livekit/core/mod.rs` (cfg-gated path-includes to `types.rs` / `types_wasm_generated.rs`). - Patches the `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 - [x] `cargo build --workspace` - [x] `cargo clippy --workspace --all-targets -- -D warnings` - [x] `cargo test --workspace` — 31 tests passed, 0 failed, 2 doc-tests ignored - [x] Repo-wide grep confirms zero references to `single_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::` - [ ] Manual smoke: `cargo run --bin hero_livekit_server` against a fresh socket dir - [ ] Manual smoke: `cargo run --example basic_usage` against the running server
refactor(workspace): align layout with hero_compute
Some checks failed
Build & Test / check (pull_request) Failing after 3s
6878abfba9
Strip the aspirational machinery added in PR #18 and reshape the workspace
to match hero_compute_server's simpler model: build.rs lives in the server
crate, no separate core crate, single-file SDK, bin-only UI crate.

- Delete crates/hero_livekit/; harvest the 962-line handwritten orchestrator
  into crates/hero_livekit_server/src/livekit/rpc.rs
- crates/hero_livekit_server: new build.rs with minimal OschemaBuildConfig
  matching hero_compute_server (no single_bin, bin_companions, bin_ui,
  client_crate_dir, sdk_types_crate, with_wasm, nested_layout, sdk_dir).
  Build.rs additionally rewrites the broken generator-emitted livekit/mod.rs,
  creates the livekit/core/mod.rs bridge, syncs openrpc.json to the crate
  root, and patches a bad include_str! path in osis_server_generated.rs
- crates/hero_livekit_sdk: collapse to a single src/lib.rs modeled on
  hero_compute_sdk (openrpc_client! macro + env/socket/HTTP-RPC helpers).
  Drop build.rs, src/openrpc.rs, and the entire src/livekit/ subtree
- crates/hero_livekit_ui: collapse lib + bin into bin-only. Move build_router,
  AppState, handlers, and run() into src/server.rs; main.rs is now ~9 lines
  matching hero_compute_ui. Drop [lib] target and the dead WhitelistState::new
  async ctor (only new_blocking is used)
- crates/hero_livekit_examples, crates/hero_livekit_rhai: replace
  hero_livekit_sdk::openrpc::* with hero_livekit_sdk::* (macro now exposes
  types at the SDK crate root)
- Workspace Cargo.toml: remove crates/hero_livekit member and the
  hero_livekit workspace dep. Add dotenvy = "0.15". Update herolib_core to
  default-features = false, features = ["openrpc-transport"] to match
  hero_compute and the SDK override pattern
- .gitignore: ignore build artifacts at crates/hero_livekit_server/sdk/
  and crates/hero_livekit_server/openrpc.client.generated.rs (matches
  hero_compute's gitignore)

cargo build --workspace, cargo clippy --workspace --all-targets -- -D warnings,
and cargo test --workspace all green. 31 tests pass, 0 fail. Repo-wide grep
confirms zero references to single_bin, bin_companions, bin_ui,
client_crate_dir, sdk_types_crate, with_wasm, nested_layout, autobins = false,
hero_livekit::livekit::, hero_livekit_sdk::openrpc::, or
hero_livekit_sdk::livekit::.

#29
style: Remove unnecessary newline in dir creation
Some checks failed
Build & Test / check (pull_request) Failing after 3s
b2bc0f362d
- Remove newline from `create_dir_all` call
style: apply rustfmt --edition 2024 to satisfy fmt-check
All checks were successful
Build & Test / check (pull_request) Successful in 1m25s
b8e3fea43c
cargo fmt's default edition (2021) leaves edition-2024-only formatting
(super-before-std import order; method chains broken across lines) un-fixed.
Apply rustfmt --edition 2024 explicitly so the CI fmt-check target passes.

#29
build: default cargo fmt to edition 2024
All checks were successful
Build & Test / check (pull_request) Successful in 1m27s
f46b83396c
Add rustfmt.toml at the workspace root with edition = "2024" and
style_edition = "2024" so plain `cargo fmt` matches the CI fmt-check
target without a separate `--edition 2024` flag.

#29
ashraf merged commit 3c30c58880 into main 2026-04-28 07:29:19 +00:00
ashraf deleted branch refactor/align-with-hero-compute 2026-04-28 07:29:19 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_livekit!30
No description provided.