Add training playground with reset capability (Priority 3 #3)
Training Playground Features: - Interactive playground mode with prerequisite validation - Reset capability to clear progress and state - Progressive training that skips completed stages - Progress tracking via .training_progress file - Sandbox state directory for safe experimentation New Functions: - load_progress() - Load completed stages from progress file - save_progress() - Save completed stages to progress file - reset_training_state() - Clear all progress and state - check_prerequisites() - Integrate with generate_prerequisite_checks.py - show_playground_menu() - Interactive playground menu - check_all_prerequisites() - Validate all stages - playground_run_stage() - Run stage with prerequisite check - playground_run_complete() - Progressive complete training Updates: - TOTAL_STAGES increased from 7 to 10 (includes stages 0, 8, 9) - Updated training stages list in overview - Updated show_menu() to add playground option - Updated run_complete_training() for stages 0-9 - Updated review_progress() to load from progress file - Updated view_logs() for stages 0, 8, 9 - Added --playground command-line option - Added .training_progress and .training_state to .gitignore
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -48,6 +48,12 @@ data/
|
||||
apps/blockchain-node/data/
|
||||
cli/config/
|
||||
dev/cache/logs/
|
||||
|
||||
# ===================
|
||||
# Training State
|
||||
# ===================
|
||||
scripts/training/.training_progress
|
||||
scripts/training/.training_state/
|
||||
dev/config/
|
||||
dev/test-nodes/*/data/
|
||||
# Keep coordinator-api data directory (contains application code)
|
||||
|
||||
@@ -27,8 +27,10 @@ NC='\033[0m' # No Color
|
||||
|
||||
# Progress tracking
|
||||
CURRENT_STAGE=0
|
||||
TOTAL_STAGES=7
|
||||
TOTAL_STAGES=10
|
||||
START_TIME=$(date +%s)
|
||||
PROGRESS_FILE="$SCRIPT_DIR/.training_progress"
|
||||
STATE_DIR="$SCRIPT_DIR/.training_state"
|
||||
|
||||
# Logging function
|
||||
log() {
|
||||
@@ -77,11 +79,16 @@ show_overview() {
|
||||
echo
|
||||
|
||||
echo -e "${BOLD}📋 Training Stages:${NC}"
|
||||
echo "0. Environment Setup - Genesis wallet validation, node connectivity"
|
||||
echo "1. Foundation - Basic CLI, wallet, and transaction operations"
|
||||
echo "2. Intermediate - Advanced blockchain and smart contract operations"
|
||||
echo "2. Operations Mastery - Wallet operations, blockchain, mining, network"
|
||||
echo "3. AI Operations - Job submission, resource management, Ollama integration"
|
||||
echo "4. Marketplace & Economics - Trading, economic modeling, distributed optimization"
|
||||
echo "5. Expert & Automation - Advanced workflows, multi-node coordination, security"
|
||||
echo "5. Expert Operations - Advanced workflows, multi-node coordination, security"
|
||||
echo "6. Agent Identity SDK - Agent registration, authentication, SDK usage"
|
||||
echo "7. Cross-Node Training - Multi-chain operations, distributed consensus"
|
||||
echo "8. Advanced Agent Specialization - Bounty, portfolio, knowledge graph, ZK proofs"
|
||||
echo "9. Multi-Chain Architecture - Island setup, gossip sync, multi-chain validator"
|
||||
echo
|
||||
|
||||
echo -e "${BOLD}🏗️ Two-Node Architecture:${NC}"
|
||||
@@ -196,17 +203,281 @@ run_stage() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Load progress from file
|
||||
load_progress() {
|
||||
if [ -f "$PROGRESS_FILE" ]; then
|
||||
source "$PROGRESS_FILE"
|
||||
else
|
||||
COMPLETED_STAGES=()
|
||||
fi
|
||||
}
|
||||
|
||||
# Save progress to file
|
||||
save_progress() {
|
||||
local completed_stages_str=$(
|
||||
for stage in "${COMPLETED_STAGES[@]}"; do
|
||||
echo -n "$stage "
|
||||
done
|
||||
)
|
||||
echo "COMPLETED_STAGES=($completed_stages_str)" > "$PROGRESS_FILE"
|
||||
echo "LAST_UPDATE=$(date +%s)" >> "$PROGRESS_FILE"
|
||||
}
|
||||
|
||||
# Reset training state
|
||||
reset_training_state() {
|
||||
print_header "Reset Training State"
|
||||
|
||||
echo -e "${YELLOW}⚠️ This will:${NC}"
|
||||
echo "• Clear all stage progress"
|
||||
echo "• Remove sandbox state directory"
|
||||
echo "• Reset progress tracking"
|
||||
echo
|
||||
echo -n "Are you sure you want to reset? [yes/NO]: "
|
||||
read -r confirm
|
||||
|
||||
if [[ "$confirm" != "yes" ]]; then
|
||||
print_status "Reset cancelled"
|
||||
return 0
|
||||
fi
|
||||
|
||||
print_status "Resetting training state..."
|
||||
|
||||
# Clear progress file
|
||||
if [ -f "$PROGRESS_FILE" ]; then
|
||||
rm "$PROGRESS_FILE"
|
||||
print_success "Progress file cleared"
|
||||
fi
|
||||
|
||||
# Remove state directory
|
||||
if [ -d "$STATE_DIR" ]; then
|
||||
rm -rf "$STATE_DIR"
|
||||
print_success "State directory cleared"
|
||||
fi
|
||||
|
||||
# Recreate state directory
|
||||
mkdir -p "$STATE_DIR"
|
||||
|
||||
log "Training state reset"
|
||||
print_success "Training state reset successfully"
|
||||
}
|
||||
|
||||
# Check prerequisites using validation script
|
||||
check_prerequisites() {
|
||||
local stage_num=$1
|
||||
local stage_name="stage${stage_num}_*"
|
||||
|
||||
# Run prerequisite validation
|
||||
if [ -f "$SCRIPT_DIR/generate_prerequisite_checks.py" ]; then
|
||||
print_status "Checking prerequisites for Stage $stage_num..."
|
||||
if python3 "$SCRIPT_DIR/generate_prerequisite_checks.py" "$SCRIPT_DIR/../agent-training" 2>/dev/null; then
|
||||
print_success "Prerequisites validated"
|
||||
return 0
|
||||
else
|
||||
print_warning "Prerequisite validation failed"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
print_warning "Prerequisite check script not found, skipping validation"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Show playground menu
|
||||
show_playground_menu() {
|
||||
clear
|
||||
print_header "Training Playground"
|
||||
|
||||
echo -e "${BOLD}🎮 Playground Mode${NC}"
|
||||
echo "Interactive training with prerequisite validation and reset capability"
|
||||
echo
|
||||
|
||||
# Load progress
|
||||
load_progress
|
||||
|
||||
echo -e "${BOLD}📊 Progress:${NC}"
|
||||
if [ ${#COMPLETED_STAGES[@]} -gt 0 ]; then
|
||||
echo "Completed stages: ${COMPLETED_STAGES[*]}"
|
||||
else
|
||||
echo "No stages completed yet"
|
||||
fi
|
||||
echo
|
||||
|
||||
echo -e "${BOLD}📋 Available Actions:${NC}"
|
||||
echo "1. Run Stage with Prerequisites Check"
|
||||
echo "2. Run Complete Training (Progressive)"
|
||||
echo "3. Reset Training State"
|
||||
echo "4. Check Prerequisites for All Stages"
|
||||
echo "5. View Progress"
|
||||
echo "6. Return to Main Menu"
|
||||
echo
|
||||
echo -n "Select option [1-6]: "
|
||||
read -r choice
|
||||
echo
|
||||
|
||||
case $choice in
|
||||
1)
|
||||
playground_run_stage
|
||||
;;
|
||||
2)
|
||||
playground_run_complete
|
||||
;;
|
||||
3)
|
||||
reset_training_state
|
||||
;;
|
||||
4)
|
||||
check_all_prerequisites
|
||||
;;
|
||||
5)
|
||||
review_progress
|
||||
;;
|
||||
6)
|
||||
show_menu
|
||||
;;
|
||||
*)
|
||||
print_error "Invalid option. Please select 1-6."
|
||||
show_playground_menu
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Check prerequisites for all stages
|
||||
check_all_prerequisites() {
|
||||
print_header "Prerequisites Check for All Stages"
|
||||
|
||||
if [ -f "$SCRIPT_DIR/generate_prerequisite_checks.py" ]; then
|
||||
print_status "Running prerequisite validation..."
|
||||
python3 "$SCRIPT_DIR/generate_prerequisite_checks.py" "$SCRIPT_DIR/../agent-training"
|
||||
else
|
||||
print_error "Prerequisite check script not found"
|
||||
fi
|
||||
}
|
||||
|
||||
# Run stage with prerequisite check (playground mode)
|
||||
playground_run_stage() {
|
||||
echo "Available Stages:"
|
||||
for i in {0..9}; do
|
||||
local stage_name=""
|
||||
case $i in
|
||||
0) stage_name="Environment Setup" ;;
|
||||
1) stage_name="Foundation" ;;
|
||||
2) stage_name="Operations Mastery" ;;
|
||||
3) stage_name="AI Operations" ;;
|
||||
4) stage_name="Marketplace & Economics" ;;
|
||||
5) stage_name="Expert Operations" ;;
|
||||
6) stage_name="Agent Identity SDK" ;;
|
||||
7) stage_name="Cross-Node Training" ;;
|
||||
8) stage_name="Advanced Agent Specialization" ;;
|
||||
9) stage_name="Multi-Chain Architecture" ;;
|
||||
esac
|
||||
echo "$i. $stage_name"
|
||||
done
|
||||
echo
|
||||
echo -n "Select stage [0-9]: "
|
||||
read -r stage_choice
|
||||
|
||||
if [[ "$stage_choice" =~ ^[0-9]$ ]]; then
|
||||
echo
|
||||
check_prerequisites $stage_choice
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -n "Proceed with Stage $stage_choice? [Y/n]: "
|
||||
read -r proceed
|
||||
if [[ ! "$proceed" =~ ^[Nn]$ ]]; then
|
||||
run_stage $stage_choice
|
||||
if [ $? -eq 0 ]; then
|
||||
# Add to completed stages
|
||||
COMPLETED_STAGES+=("$stage_choice")
|
||||
save_progress
|
||||
print_success "Stage $stage_choice marked as completed"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
print_error "Prerequisites not satisfied, cannot proceed"
|
||||
fi
|
||||
else
|
||||
print_error "Invalid stage selection"
|
||||
fi
|
||||
|
||||
show_playground_menu
|
||||
}
|
||||
|
||||
# Run complete training progressively (playground mode)
|
||||
playground_run_complete() {
|
||||
print_header "Progressive Complete Training"
|
||||
|
||||
load_progress
|
||||
|
||||
print_status "Starting progressive training from Stage 0..."
|
||||
local start_stage=0
|
||||
|
||||
# Find first uncompleted stage
|
||||
for i in {0..9}; do
|
||||
local completed=false
|
||||
for stage in "${COMPLETED_STAGES[@]}"; do
|
||||
if [ "$stage" == "$i" ]; then
|
||||
completed=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$completed" = false ]; then
|
||||
start_stage=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Starting from Stage $start_stage"
|
||||
echo
|
||||
|
||||
for stage in $(seq $start_stage 9); do
|
||||
print_progress $stage "Starting"
|
||||
|
||||
check_prerequisites $stage
|
||||
if [ $? -ne 0 ]; then
|
||||
print_error "Prerequisites not satisfied for Stage $stage"
|
||||
break
|
||||
fi
|
||||
|
||||
if run_stage $stage; then
|
||||
COMPLETED_STAGES+=("$stage")
|
||||
save_progress
|
||||
print_success "Stage $stage completed and saved"
|
||||
|
||||
if [ $stage -lt 9 ]; then
|
||||
echo
|
||||
echo -n "Continue to next stage? [Y/n]: "
|
||||
read -r continue_choice
|
||||
if [[ "$continue_choice" =~ ^[Nn]$ ]]; then
|
||||
print_status "Training paused by user"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
else
|
||||
print_error "Stage $stage failed"
|
||||
echo -n "Retry this stage? [Y/n]: "
|
||||
read -r retry_choice
|
||||
if [[ ! "$retry_choice" =~ ^[Nn]$ ]]; then
|
||||
stage=$((stage - 1))
|
||||
else
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
show_training_summary ${#COMPLETED_STAGES[@]}
|
||||
}
|
||||
|
||||
# Show training menu
|
||||
show_menu() {
|
||||
echo -e "${BOLD}📋 Training Menu:${NC}"
|
||||
echo "1. Run Complete Training Program (All Stages)"
|
||||
echo "2. Run Individual Stage"
|
||||
echo "3. Check System Readiness"
|
||||
echo "4. Review Training Progress"
|
||||
echo "5. View Training Logs"
|
||||
echo "6. Exit"
|
||||
echo "3. Training Playground (Interactive with Reset)"
|
||||
echo "4. Check System Readiness"
|
||||
echo "5. Review Training Progress"
|
||||
echo "6. View Training Logs"
|
||||
echo "7. Exit"
|
||||
echo
|
||||
echo -n "Select option [1-6]: "
|
||||
echo -n "Select option [1-7]: "
|
||||
read -r choice
|
||||
echo
|
||||
|
||||
@@ -218,20 +489,23 @@ show_menu() {
|
||||
run_individual_stage
|
||||
;;
|
||||
3)
|
||||
check_system_readiness
|
||||
show_playground_menu
|
||||
;;
|
||||
4)
|
||||
review_progress
|
||||
check_system_readiness
|
||||
;;
|
||||
5)
|
||||
view_logs
|
||||
review_progress
|
||||
;;
|
||||
6)
|
||||
view_logs
|
||||
;;
|
||||
7)
|
||||
print_success "Exiting training program"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
print_error "Invalid option. Please select 1-6."
|
||||
print_error "Invalid option. Please select 1-7."
|
||||
show_menu
|
||||
;;
|
||||
esac
|
||||
@@ -246,7 +520,7 @@ run_complete_training() {
|
||||
|
||||
local completed_stages=0
|
||||
|
||||
for stage in {1..7}; do
|
||||
for stage in {0..9}; do
|
||||
echo
|
||||
print_progress $stage "Starting"
|
||||
|
||||
@@ -255,7 +529,7 @@ run_complete_training() {
|
||||
print_success "Stage $stage completed successfully"
|
||||
|
||||
# Ask if user wants to continue
|
||||
if [ $stage -lt 7 ]; then
|
||||
if [ $stage -lt 9 ]; then
|
||||
echo
|
||||
echo -n "Continue to next stage? [Y/n]: "
|
||||
read -r continue_choice
|
||||
@@ -308,21 +582,36 @@ review_progress() {
|
||||
|
||||
echo -e "${BOLD}📊 Training Statistics:${NC}"
|
||||
|
||||
# Check completed stages
|
||||
# Load progress from file
|
||||
load_progress
|
||||
|
||||
# Check completed stages from progress file
|
||||
if [ ${#COMPLETED_STAGES[@]} -gt 0 ]; then
|
||||
echo -e "${BOLD}Completed Stages (from progress file):${NC}"
|
||||
for stage in "${COMPLETED_STAGES[@]}"; do
|
||||
echo "✅ Stage $stage"
|
||||
done
|
||||
else
|
||||
echo -e "${BOLD}No stages completed yet${NC}"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
# Check log files for additional completion status
|
||||
local completed=0
|
||||
for stage in {1..5}; do
|
||||
for stage in {0..9}; do
|
||||
local log_file="$LOG_DIR/training_stage${stage}.log"
|
||||
if [ -f "$log_file" ] && grep -q "completed successfully" "$log_file"; then
|
||||
(( completed += 1 )) || true
|
||||
echo "✅ Stage $stage: Completed"
|
||||
echo "✅ Stage $stage: Log indicates completion"
|
||||
else
|
||||
echo "❌ Stage $stage: Not completed"
|
||||
echo "❌ Stage $stage: Not completed in logs"
|
||||
fi
|
||||
done
|
||||
|
||||
local progress=$((completed * 100 / 5))
|
||||
local progress=$((completed * 100 / 10))
|
||||
echo
|
||||
echo -e "${BOLD}Overall Progress: $completed/5 stages ($progress%)${NC}"
|
||||
echo -e "${BOLD}Overall Progress: $completed/10 stages ($progress%)${NC}"
|
||||
|
||||
# Show time tracking
|
||||
local elapsed=$(($(date +%s) - START_TIME))
|
||||
@@ -347,16 +636,19 @@ view_logs() {
|
||||
|
||||
echo "Available log files:"
|
||||
echo "1. Master training log"
|
||||
echo "2. Stage 1: Foundation"
|
||||
echo "3. Stage 2: Intermediate"
|
||||
echo "4. Stage 3: AI Operations"
|
||||
echo "5. Stage 4: Marketplace & Economics"
|
||||
echo "6. Stage 5: Expert Operations"
|
||||
echo "7. Stage 6: hermes Master Agent"
|
||||
echo "8. Stage 7: Cross-Node Training"
|
||||
echo "9. Return to menu"
|
||||
echo "0. Stage 0: Environment Setup"
|
||||
echo "1. Stage 1: Foundation"
|
||||
echo "2. Stage 2: Operations Mastery"
|
||||
echo "3. Stage 3: AI Operations"
|
||||
echo "4. Stage 4: Marketplace & Economics"
|
||||
echo "5. Stage 5: Expert Operations"
|
||||
echo "6. Stage 6: Agent Identity SDK"
|
||||
echo "7. Stage 7: Cross-Node Training"
|
||||
echo "8. Stage 8: Advanced Agent Specialization"
|
||||
echo "9. Stage 9: Multi-Chain Architecture"
|
||||
echo "10. Return to menu"
|
||||
echo
|
||||
echo -n "Select log to view [1-9]: "
|
||||
echo -n "Select log to view [0-10]: "
|
||||
read -r log_choice
|
||||
|
||||
case $log_choice in
|
||||
@@ -367,56 +659,70 @@ view_logs() {
|
||||
print_error "Master log file not found"
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
if [ -f "$LOG_DIR/training_stage1.log" ]; then
|
||||
less "$LOG_DIR/training_stage1.log"
|
||||
0)
|
||||
if [ -f "$LOG_DIR/training_stage0.log" ]; then
|
||||
less "$LOG_DIR/training_stage0.log"
|
||||
else
|
||||
print_error "Stage 1 log file not found"
|
||||
print_error "Stage 0 log file not found"
|
||||
fi
|
||||
;;
|
||||
3)
|
||||
2)
|
||||
if [ -f "$LOG_DIR/training_stage2.log" ]; then
|
||||
less "$LOG_DIR/training_stage2.log"
|
||||
else
|
||||
print_error "Stage 2 log file not found"
|
||||
fi
|
||||
;;
|
||||
4)
|
||||
3)
|
||||
if [ -f "$LOG_DIR/training_stage3.log" ]; then
|
||||
less "$LOG_DIR/training_stage3.log"
|
||||
else
|
||||
print_error "Stage 3 log file not found"
|
||||
fi
|
||||
;;
|
||||
5)
|
||||
4)
|
||||
if [ -f "$LOG_DIR/training_stage4.log" ]; then
|
||||
less "$LOG_DIR/training_stage4.log"
|
||||
else
|
||||
print_error "Stage 4 log file not found"
|
||||
fi
|
||||
;;
|
||||
6)
|
||||
5)
|
||||
if [ -f "$LOG_DIR/training_stage5.log" ]; then
|
||||
less "$LOG_DIR/training_stage5.log"
|
||||
else
|
||||
print_error "Stage 5 log file not found"
|
||||
fi
|
||||
;;
|
||||
7)
|
||||
if [ -f "$LOG_DIR/training_stage6_agent_development.log" ]; then
|
||||
less "$LOG_DIR/training_stage6_agent_development.log"
|
||||
6)
|
||||
if [ -f "$LOG_DIR/training_stage6_agent_identity_sdk.log" ]; then
|
||||
less "$LOG_DIR/training_stage6_agent_identity_sdk.log"
|
||||
else
|
||||
print_error "Stage 6 log file not found"
|
||||
fi
|
||||
;;
|
||||
8)
|
||||
7)
|
||||
if [ -f "$LOG_DIR/training_stage7_cross_node_training.log" ]; then
|
||||
less "$LOG_DIR/training_stage7_cross_node_training.log"
|
||||
else
|
||||
print_error "Stage 7 log file not found"
|
||||
fi
|
||||
;;
|
||||
8)
|
||||
if [ -f "$LOG_DIR/training_stage8_advanced_agent_specialization.log" ]; then
|
||||
less "$LOG_DIR/training_stage8_advanced_agent_specialization.log"
|
||||
else
|
||||
print_error "Stage 8 log file not found"
|
||||
fi
|
||||
;;
|
||||
9)
|
||||
if [ -f "$LOG_DIR/training_stage9_multi_chain_architecture.log" ]; then
|
||||
less "$LOG_DIR/training_stage9_multi_chain_architecture.log"
|
||||
else
|
||||
print_error "Stage 9 log file not found"
|
||||
fi
|
||||
;;
|
||||
10)
|
||||
return
|
||||
;;
|
||||
*)
|
||||
@@ -477,6 +783,9 @@ main() {
|
||||
# Create log directory
|
||||
mkdir -p "$LOG_DIR"
|
||||
|
||||
# Create state directory
|
||||
mkdir -p "$STATE_DIR"
|
||||
|
||||
# Start logging
|
||||
log "hermes AITBC Mastery Training Program started"
|
||||
|
||||
@@ -546,16 +855,19 @@ case "${1:-}" in
|
||||
check_system_readiness
|
||||
;;
|
||||
--stage)
|
||||
if [[ "$2" =~ ^[1-7]$ ]]; then
|
||||
if [[ "$2" =~ ^[0-9]$ ]]; then
|
||||
run_stage "$2"
|
||||
else
|
||||
echo "Usage: $0 --stage [1-7]"
|
||||
echo "Usage: $0 --stage [0-9]"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
--complete)
|
||||
run_complete_training
|
||||
;;
|
||||
--playground)
|
||||
show_playground_menu
|
||||
;;
|
||||
--help|-h)
|
||||
echo "hermes AITBC Mastery Training Launcher"
|
||||
echo
|
||||
@@ -564,8 +876,9 @@ case "${1:-}" in
|
||||
echo "Options:"
|
||||
echo " --overview Show training overview"
|
||||
echo " --check Check system readiness"
|
||||
echo " --stage N Run specific stage (1-7)"
|
||||
echo " --stage N Run specific stage (0-9)"
|
||||
echo " --complete Run complete training program"
|
||||
echo " --playground Enter training playground mode"
|
||||
echo " --help, -h Show this help message"
|
||||
echo
|
||||
echo "Without arguments, starts interactive menu"
|
||||
|
||||
Reference in New Issue
Block a user