.. | ||
README.md | ||
supervisor_cli.rs | ||
supervisor_tui.rs | ||
TUI_README.md |
Supervisor CLI
Interactive command-line interface for the Hero Supervisor that allows you to dispatch jobs to actors and manage the job lifecycle.
Features
- Interactive Menu: Easy-to-use menu system for all supervisor operations
- Job Management: Create, run, monitor, and manage jobs
- OSIS Actor Integration: Dispatch Rhai scripts to the OSIS actor
- Real-time Results: Get immediate feedback from job execution
- Colorized Output: Clear visual feedback with colored status indicators
Usage
1. Build the OSIS Actor
First, ensure the OSIS actor is built:
cd /Users/timurgordon/code/git.ourworld.tf/herocode/actor_osis
cargo build
2. Configure the Supervisor
Create or use the example configuration file at examples/cli_config.toml
:
[global]
redis_url = "redis://127.0.0.1/"
[actors]
osis_actor = "/Users/timurgordon/code/git.ourworld.tf/herocode/actor_osis/target/debug/actor_osis"
3. Run the CLI
cd /Users/timurgordon/code/git.ourworld.tf/herocode/baobab/core/supervisor
cargo run --bin supervisor-cli -- --config examples/cli_config.toml
Or with verbose logging:
cargo run --bin supervisor-cli -- --config examples/cli_config.toml --verbose
Available Commands
- list_jobs - List all jobs in the system
- run_job - Create and run a new job interactively
- get_job_status - Get status of a specific job
- get_job_output - Get output of a completed job
- get_job_logs - Get logs for a specific job
- stop_job - Stop a running job
- delete_job - Delete a specific job
- clear_all_jobs - Clear all jobs from the system
- quit - Exit the CLI
Example Workflow
- Start the CLI with your configuration
- Select option
2
(run_job) - Enter job details:
- Caller: Your name or identifier
- Context: Description of what the job does
- Script: Rhai script to execute (end with empty line)
- The job is automatically dispatched to the OSIS actor
- View the real-time result
Example Rhai Script
// Simple calculation
let result = 10 + 20 * 3;
print("Calculation result: " + result);
result
// Working with strings
let message = "Hello from OSIS Actor!";
print(message);
message.to_upper()
Job Status Colors
- Created - Cyan
- Dispatched - Blue
- Started - Yellow
- Finished - Green
- Error - Red
Prerequisites
- Redis server running on localhost:6379 (or configured URL)
- OSIS actor binary built and accessible
- Proper permissions to start/stop processes via Zinit
Troubleshooting
Actor Not Starting
- Verify the OSIS actor binary path in the TOML config
- Check that the binary exists and is executable
- Ensure Redis is running and accessible
Connection Issues
- Verify Redis URL in configuration
- Check network connectivity to Redis server
- Ensure no firewall blocking connections
Job Execution Failures
- Check job logs using
get_job_logs
command - Verify Rhai script syntax
- Check actor logs for detailed error information