rhailib/research/rhai_engine_ui/README.md

1.8 KiB

Rhai Engine Worker UI

A Yew-based WASM interface to monitor Rhai workers.

Prerequisites

  • Rust: Install from rust-lang.org
  • Trunk: Install with cargo install trunk
  • A backend service providing the necessary API endpoints (see below).

Backend API Requirements

This UI expects a backend service to be running that can provide data from Redis. The UI will make requests to the following (example) endpoints:

  • GET /api/worker/{worker_name}/tasks_and_stats: Returns initial WorkerData including a list of TaskSummary and initial QueueStats.
    • WorkerData: { "queue_stats": { "current_size": u32, "color_code": "string" }, "tasks": [TaskSummary] }
    • TaskSummary: { "hash": "string", "created_at": i64, "status": "string" }
  • GET /api/worker/{worker_name}/queue_stats: Returns current QueueStats for polling.
    • QueueStats: { "current_size": u32, "color_code": "string" }
  • GET /api/task/{task_hash}: Returns TaskDetails.
    • TaskDetails: { "hash": "string", "created_at": i64, "status": "string", "script_content": "string", "result": "optional_string", "error": "optional_string" }

Note: The API endpoints are currently hardcoded with relative paths (e.g., /api/...). This assumes the backend API is served from the same host and port as the Trunk development server, or that a proxy is configured.

Development

  1. Navigate to the rhai_engine_ui directory:
    cd /Users/timurgordon/code/git.ourworld.tf/herocode/rhailib/rhai_engine_ui/
    
  2. Run the development server:
    trunk serve --port 8081
    
  3. Open your browser to http://127.0.0.1:8081.

Building for Release

trunk build --release

This will output static files to the dist directory.