Restructure: move clients/openrpc to client/ and clients/admin-ui to ui/

This commit is contained in:
Timur Gordon
2025-11-06 14:07:55 +01:00
parent af5cd30516
commit 4a5f19e091
38 changed files with 43 additions and 11 deletions

31
Cargo.lock generated
View File

@@ -592,6 +592,7 @@ checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
[[package]] [[package]]
name = "hero-job" name = "hero-job"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ourworld.tf/herocode/job.git#7b9420f3e67802e34de1337bac4e2728ed321657"
dependencies = [ dependencies = [
"chrono", "chrono",
"hex", "hex",
@@ -609,6 +610,7 @@ dependencies = [
[[package]] [[package]]
name = "hero-job-client" name = "hero-job-client"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.ourworld.tf/herocode/job.git#7b9420f3e67802e34de1337bac4e2728ed321657"
dependencies = [ dependencies = [
"chrono", "chrono",
"hero-job", "hero-job",
@@ -651,6 +653,33 @@ dependencies = [
"uuid", "uuid",
] ]
[[package]]
name = "hero-supervisor"
version = "0.1.0"
source = "git+https://git.ourworld.tf/herocode/supervisor.git#af5cd3051628db629efa325b5b6dc64630b3a4c2"
dependencies = [
"anyhow",
"async-trait",
"chrono",
"clap",
"env_logger 0.10.2",
"hero-job",
"hero-job-client",
"hyper",
"hyper-util",
"jsonrpsee",
"log",
"redis",
"serde",
"serde_json",
"thiserror",
"tokio",
"toml",
"tower 0.4.13",
"tower-http 0.5.2",
"uuid",
]
[[package]] [[package]]
name = "hero-supervisor-openrpc-client" name = "hero-supervisor-openrpc-client"
version = "0.1.0" version = "0.1.0"
@@ -661,7 +690,7 @@ dependencies = [
"getrandom 0.2.16", "getrandom 0.2.16",
"hero-job", "hero-job",
"hero-job-client", "hero-job-client",
"hero-supervisor", "hero-supervisor 0.1.0 (git+https://git.ourworld.tf/herocode/supervisor.git)",
"hex", "hex",
"indexmap", "indexmap",
"js-sys", "js-sys",

View File

@@ -50,7 +50,7 @@ reqwest = { version = "0.12", features = ["json"], optional = true }
[dev-dependencies] [dev-dependencies]
tokio-test = "0.4" tokio-test = "0.4"
hero-supervisor-openrpc-client = { path = "clients/openrpc" } hero-supervisor-openrpc-client = { path = "client" }
escargot = "0.5" escargot = "0.5"
[features] [features]

View File

@@ -175,7 +175,7 @@ RUST_LOG=info cargo run --example simple_e2e
1. **Try different Rhai scripts** - Modify the payload in examples 1. **Try different Rhai scripts** - Modify the payload in examples
2. **Add more runners** - Start multiple runners with different IDs 2. **Add more runners** - Start multiple runners with different IDs
3. **Explore the API** - Use the OpenRPC client library 3. **Explore the API** - Use the OpenRPC client library
4. **Build your own client** - See `clients/openrpc/` for examples 4. **Build your own client** - See `client/` for examples
## Useful Commands ## Useful Commands

View File

@@ -19,7 +19,6 @@ thiserror = "1.0"
log = "0.4" log = "0.4"
uuid = { version = "1.0", features = ["v4", "serde"] } uuid = { version = "1.0", features = ["v4", "serde"] }
indexmap = "2.0" indexmap = "2.0"
# hero-job = { path = "../../../job/rust" }
hero-job = { git = "https://git.ourworld.tf/herocode/job.git" } hero-job = { git = "https://git.ourworld.tf/herocode/job.git" }
# Native JSON-RPC client (not WASM compatible) # Native JSON-RPC client (not WASM compatible)

View File

@@ -204,7 +204,7 @@ cargo build --release
cargo build --release --features openrpc cargo build --release --features openrpc
# Build client library # Build client library
cd clients/openrpc cd client
cargo build --release cargo build --release
``` ```

View File

@@ -6,7 +6,7 @@ All examples now use the official `hero-supervisor-openrpc-client` library for t
### **What Was Updated:** ### **What Was Updated:**
1. **OpenRPC Client Library** (`clients/openrpc/src/lib.rs`) 1. **OpenRPC Client Library** (`client/src/lib.rs`)
- Added `JobRunResponse` - Response from blocking `job.run` - Added `JobRunResponse` - Response from blocking `job.run`
- Added `JobStartResponse` - Response from non-blocking `job.start` - Added `JobStartResponse` - Response from non-blocking `job.start`
- Updated `job_run()` method - Now accepts timeout parameter - Updated `job_run()` method - Now accepts timeout parameter
@@ -172,7 +172,7 @@ RUST_LOG=info cargo run --example end_to_end_demo
### **Files Modified:** ### **Files Modified:**
-`clients/openrpc/src/lib.rs` - Updated client methods and response types -`client/src/lib.rs` - Updated client methods and response types
-`examples/simple_e2e.rs` - Refactored to use OpenRPC client -`examples/simple_e2e.rs` - Refactored to use OpenRPC client
-`examples/end_to_end_demo.rs` - Refactored to use OpenRPC client -`examples/end_to_end_demo.rs` - Refactored to use OpenRPC client
-`examples/E2E_EXAMPLES.md` - Updated documentation -`examples/E2E_EXAMPLES.md` - Updated documentation

View File

@@ -1,9 +1,13 @@
///! Comprehensive OSIRIS + OpenRPC + Admin UI Example ///! Comprehensive OSIRIS + OpenRPC + Admin UI Example
///! ///!
///! This example demonstrates: /// This example demonstrates using the Hero Supervisor OpenRPC client
/// to run OSIRIS scripts through the supervisor.
///
/// The client library is located at: client/
///!
///! 1. Starting a Hero Supervisor with OpenRPC server ///! 1. Starting a Hero Supervisor with OpenRPC server
///! 2. Building and serving the Admin UI (Yew WASM) ///! 2. Building and serving the Admin UI (Yew WASM)
///! 3. Starting an OSIRIS runner ///! 3. Building and starting an OSIRIS runner
///! 4. Registering the runner with the supervisor ///! 4. Registering the runner with the supervisor
///! 5. Dispatching multiple OSIRIS jobs via OpenRPC ///! 5. Dispatching multiple OSIRIS jobs via OpenRPC
///! 6. Monitoring job execution via CLI and Web UI ///! 6. Monitoring job execution via CLI and Web UI
@@ -86,7 +90,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.arg("8080") .arg("8080")
.arg("--address") .arg("--address")
.arg("127.0.0.1") .arg("127.0.0.1")
.current_dir("clients/admin-ui") .current_dir("ui")
.stdout(Stdio::null()) .stdout(Stdio::null())
.stderr(Stdio::null()) .stderr(Stdio::null())
.spawn()?; .spawn()?;

View File

@@ -48,7 +48,7 @@ fi
# Start admin UI # Start admin UI
echo "Starting Admin UI on port $ADMIN_UI_PORT..." echo "Starting Admin UI on port $ADMIN_UI_PORT..."
cd "$PROJECT_DIR/clients/admin-ui" cd "$PROJECT_DIR/ui"
trunk serve --port "$ADMIN_UI_PORT" & trunk serve --port "$ADMIN_UI_PORT" &
ADMIN_UI_PID=$! ADMIN_UI_PID=$!