No description
  • Rust 57.5%
  • Shell 21.5%
  • JavaScript 8.4%
  • HTML 4.3%
  • CSS 2.9%
  • Other 5.4%
Find a file
mik-tf 01e48e70b5
Some checks failed
Build & Test / check (push) Failing after 19s
chore: D-10 closure — service.toml + service_base!() across 4 binaries
hero_proc#102 D-10 sweep (T2, s114). Wires hero_livekit fully to the canonical
service.toml + service_base!() + handle_info_flag contract across all four
service binaries (hero_livekit_server, hero_livekit_admin, lk-backend,
hero_do_hero_livekit).

- service.toml at every binary crate root (server + admin updated to drop the
  pre-30a0b34e HERO_SOCKET_DIR/HOME workaround and ship the canonical
  PATH_ROOT default; backend + rhai service.toml authored from scratch).
  All four list the same 4-binary set with TCP block for lk-backend (port
  8080) and empty sockets/tcp for the hero_do_hero_livekit cli.

- main.rs wired via herolib_core::service_base!() + validate_service_toml +
  handle_info_flag in all four; server + admin also call print_startup_banner
  + prepare_sockets. Rhai uses the subcommand-gated nth(1)==Some("--info")
  pattern so the script runner's own argv handling isn't disturbed.

- HeroLogger absorption (lesson #21 broadened): hero_proc_sdk's logger.rs +
  HeroLogger struct were deleted upstream at cc836a7 / 03e7ed83. Three sites
  needed adjustment — AuthorizedOsisLivekit drops its Arc<HeroLogger> field
  and the constructor's logger param, the lone deny-log call converts to
  tracing::warn!, and both startup-info call sites in server + admin
  collapse to tracing::info!. Authz behavior is preserved; structured-log
  shipping is off until a herolib_core::logger::Logger migration lands.

- Cargo.lock absorbs the s113 cascade: hero_proc_sdk c9730d17→03e7ed83,
  hero_rpc 8a8d66d8, herolib_core d20792fd. Dep audit strips 8 zero-match
  entries (server: hero_proc_sdk, tracing-subscriber; admin: dirs,
  tower-service, http-body-util, bytes; rhai: hero_rpc_openrpc, serde,
  serde_json, thiserror, dirs) and adds herolib_core to backend + rhai.

- osis_server_generated.rs is regenerated by build.rs against the new
  hero_rpc_osis tip (adds *_list_full helpers, drops dead service-method
  scaffolding); per D-03 the change is at the generator layer.

- .gitignore covers crates/hero_livekit_sdk/src/generated/ — emitted by the
  openrpc_client! macro at the new lib-relative path.

D-10 acceptance: 5/5 met.
  - service.toml at every crate root.
  - service_base!() + validate + handle_info_flag on every binary.
  - lab infocheck: 4 crates clean, 0 findings.
  - smoke 6/6: server rpc.sock {health, openrpc.json, well-known,
    system.ping}; admin admin.sock {health, well-known}. PATH_ROOT
    confirmed in /proc/$pid/environ for both daemons.
  - cargo test --workspace --release: 30 passed, 0 failed, 2 ignored.

Lessons:
  - Lesson #19 N/A (no top-level CLI orchestrator).
  - Lesson #20 N/A (every daemon uses src/main.rs, not src/bin/<name>.rs).
  - Lesson #21 confirmed again — cargo update can land deletions; HeroLogger
    cascade-absorb pattern from s113 applies to consumers with struct-field
    threading too, not just `let _logger = ...` lines.

Signed-off-by: mik-tf
2026-05-18 13:10:03 -04:00
.cargo ci(workflows): rewrite build/release around build_lib.sh + ARM64 matrix 2026-04-27 13:16:59 +00:00
.forgejo/workflows ci(workflows): rewrite build/release around build_lib.sh + ARM64 matrix 2026-04-27 13:16:59 +00:00
crates chore: D-10 closure — service.toml + service_base!() across 4 binaries 2026-05-18 13:10:03 -04:00
docs refactor: rename hero_livekit_ui -> hero_livekit_admin (ui.sock -> admin.sock) (#38) 2026-05-08 02:06:12 +00:00
schemas/livekit fix(rpc): make configure rtc_tcp_port optional for old-skill compat 2026-04-30 07:05:02 +03:00
scripts refactor: rename hero_livekit_ui -> hero_livekit_admin (ui.sock -> admin.sock) (#38) 2026-05-08 02:06:12 +00:00
sdk/js refactor(oschema): align layout with canonical hero_osis/hero_voice pattern 2026-04-23 10:13:41 +02:00
.gitignore chore: D-10 closure — service.toml + service_base!() across 4 binaries 2026-05-18 13:10:03 -04:00
buildenv.sh refactor: rename hero_livekit_ui -> hero_livekit_admin (ui.sock -> admin.sock) (#38) 2026-05-08 02:06:12 +00:00
Cargo.lock chore: D-10 closure — service.toml + service_base!() across 4 binaries 2026-05-18 13:10:03 -04:00
Cargo.toml fix: align with current hero_lib/hero_rpc APIs and axum 0.8 2026-05-13 17:35:51 +02:00
Cargo.toml.hero_builder_backup chore(deps): bump dependency versions and add workspace resolver = "3" 2026-05-13 17:20:15 +02:00
Makefile refactor: rename hero_livekit_ui -> hero_livekit_admin (ui.sock -> admin.sock) (#38) 2026-05-08 02:06:12 +00:00
README.md refactor: rename hero_livekit_ui -> hero_livekit_admin (ui.sock -> admin.sock) (#38) 2026-05-08 02:06:12 +00:00
rust-toolchain.toml ci: pin rustc 1.95 and rustfmt generated tests.rs 2026-05-17 15:12:03 +03:00
rustfmt.toml build: default cargo fmt to edition 2024 2026-04-28 07:29:18 +00:00

hero_livekit

LiveKit SFU orchestrator for the Hero OS Suite. Downloads, configures, and supervises the upstream livekit-server and lk-backend binaries, and exposes a typed OpenRPC surface plus an admin + meeting UI.

HERO_SOCKET_DIR defaults to ~/hero/var/sockets when unset. All socket paths below resolve to $HERO_SOCKET_DIR/hero_livekit/<sock>.

                 ┌───────────────────────────────────────────────────┐
                 │   hero_livekit_admin  (Askama/Bootstrap dashboard)   │
                 │   - Server lifecycle tab                          │
                 │   - Rooms / Tokens / Join                         │
                 │   - /join/{room}  (livekit-client meeting page)   │
                 └───────────────┬────────────────┬──────────────────┘
                                 │ JSON-RPC       │ ws://host:7880
                                 ▼                │
            ┌────────────────────────────────┐    │
            │    hero_livekit_server         │    │
            │    (OServer, OSchema-based)    │    │
            │    rpc.sock + admin.sock          │    │
            │    spawns & supervises:        │    │
            │      livekit-server            │────┘
            │      lk-backend                │
            └────────────────────────────────┘
                    │              │
                    ▼              ▼
             ~/hero/bin/      Redis (127.0.0.1:6379)
             livekit-server
             lk-backend

Crates

Crate Purpose
hero_livekit_server OServer-backed supervisor. Generates types + CRUD + OpenRPC spec from schemas/livekit/livekit.oschema.
hero_livekit_admin Axum-based admin dashboard + meeting page (embeds livekit-client).
hero_livekit_examples Tiny CLI programs that call the generated OpenRPC client.

Quickstart

Prerequisites on the host: Redis running at 127.0.0.1:6379.

# Build and install both binaries to ~/hero/bin/
make install

# Start the supervisor (foreground — hero_proc can also manage it via --start)
~/hero/bin/hero_livekit_server &

# Start the admin UI (binds to $HERO_SOCKET_DIR/hero_livekit/ui.sock)
~/hero/bin/hero_livekit_admin &

Then open the hero_router dashboard (usually http://127.0.0.1:9988/) and click Hero LiveKit Admin, or go directly to http://127.0.0.1:9988/hero_livekit/ui/.

In the UI, run the Server tab flow once:

  1. Install — downloads livekit-server + lk-backend to ~/hero/bin/
  2. Configure — generates livekit.yaml + backend.env with a random API secret, persists to runtime.json
  3. Start — spawns both processes

Then go to Join and click Start a new meeting to open a browser meeting page backed by livekit-client.

Documentation

Service lifecycle via hero_proc

scripts/nu_service.nu is a Nushell module that registers and supervises hero_livekit_server and hero_livekit_admin under hero_proc. It provides four subcommands: install, start, stop, status.

use scripts/nu_service.nu
nu_service install         # cargo-install the binaries into ~/hero/bin
nu_service start           # register + start actions and service in hero_proc
nu_service status          # show current state
nu_service stop            # tear down the registrations

Add --root to any subcommand when hero_proc is running as root. Prerequisite: the hero_skills tools/modules/ directory must be reachable via NU_LIB_DIRS, and hero_proc must be running.

Scripting (Rhai)

crates/hero_livekit_rhai ships a hero_do_hero_livekit binary that exposes the full LiveKitService OpenRPC surface to Rhai scripts. Build and install it with:

make install-rhai

then run one of the bundled examples:

hero_do_hero_livekit crates/hero_livekit_rhai/examples/rhai/01_status.rhai
hero_do_hero_livekit crates/hero_livekit_rhai/examples/rhai/02_list_rooms.rhai

The binary auto-injects SCRIPT_DIR, SCRIPT_FILE, and ARGS into the Rhai scope. See the files under crates/hero_livekit_rhai/examples/rhai/ for patterns:

  • 01_status.rhai — connect + print the current service state
  • 02_list_rooms.rhai — enumerate active rooms
  • 03_create_delete_room.rhai — room CRUD round-trip
  • 04_issue_token.rhai — mint a JWT with grants
  • 05_full_lifecycle.rhai — install → configure → start → create → token → stop

Scripts default to $HERO_SOCKET_DIR/hero_livekit/rpc.sock (falling back to ~/hero/var/sockets/hero_livekit/rpc.sock); pass an explicit path to livekit_client("/custom/path/rpc.sock") to override.

License

See individual crates.