# 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: ```bash 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`: ```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 ```bash 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: ```bash cargo run --bin supervisor-cli -- --config examples/cli_config.toml --verbose ``` ## Available Commands 1. **list_jobs** - List all jobs in the system 2. **run_job** - Create and run a new job interactively 3. **get_job_status** - Get status of a specific job 4. **get_job_output** - Get output of a completed job 5. **get_job_logs** - Get logs for a specific job 6. **stop_job** - Stop a running job 7. **delete_job** - Delete a specific job 8. **clear_all_jobs** - Clear all jobs from the system 9. **quit** - Exit the CLI ## Example Workflow 1. Start the CLI with your configuration 2. Select option `2` (run_job) 3. Enter job details: - **Caller**: Your name or identifier - **Context**: Description of what the job does - **Script**: Rhai script to execute (end with empty line) 4. The job is automatically dispatched to the OSIS actor 5. View the real-time result ### Example Rhai Script ```rhai // Simple calculation let result = 10 + 20 * 3; print("Calculation result: " + result); result ``` ```rhai // 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