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]]
name = "hero-job"
version = "0.1.0"
source = "git+https://git.ourworld.tf/herocode/job.git#7b9420f3e67802e34de1337bac4e2728ed321657"
dependencies = [
"chrono",
"hex",
@@ -609,6 +610,7 @@ dependencies = [
[[package]]
name = "hero-job-client"
version = "0.1.0"
source = "git+https://git.ourworld.tf/herocode/job.git#7b9420f3e67802e34de1337bac4e2728ed321657"
dependencies = [
"chrono",
"hero-job",
@@ -651,6 +653,33 @@ dependencies = [
"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]]
name = "hero-supervisor-openrpc-client"
version = "0.1.0"
@@ -661,7 +690,7 @@ dependencies = [
"getrandom 0.2.16",
"hero-job",
"hero-job-client",
"hero-supervisor",
"hero-supervisor 0.1.0 (git+https://git.ourworld.tf/herocode/supervisor.git)",
"hex",
"indexmap",
"js-sys",

View File

@@ -50,7 +50,7 @@ reqwest = { version = "0.12", features = ["json"], optional = true }
[dev-dependencies]
tokio-test = "0.4"
hero-supervisor-openrpc-client = { path = "clients/openrpc" }
hero-supervisor-openrpc-client = { path = "client" }
escargot = "0.5"
[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
2. **Add more runners** - Start multiple runners with different IDs
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

View File

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

View File

@@ -204,7 +204,7 @@ cargo build --release
cargo build --release --features openrpc
# Build client library
cd clients/openrpc
cd client
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:**
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 `JobStartResponse` - Response from non-blocking `job.start`
- Updated `job_run()` method - Now accepts timeout parameter
@@ -172,7 +172,7 @@ RUST_LOG=info cargo run --example end_to_end_demo
### **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/end_to_end_demo.rs` - Refactored to use OpenRPC client
-`examples/E2E_EXAMPLES.md` - Updated documentation

View File

@@ -1,9 +1,13 @@
///! 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
///! 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
///! 5. Dispatching multiple OSIRIS jobs via OpenRPC
///! 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("--address")
.arg("127.0.0.1")
.current_dir("clients/admin-ui")
.current_dir("ui")
.stdout(Stdio::null())
.stderr(Stdio::null())
.spawn()?;

View File

@@ -48,7 +48,7 @@ fi
# Start admin UI
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" &
ADMIN_UI_PID=$!