# Helion Social Intelligence Configuration
# Version: 2.3

# ============================================
# GROUP TRUST MODE
# ============================================
group_trust_mode:
  enabled: true
  
  # Trusted chats (Telegram username or chat_id)
  trusted_chats:
    - username: "@energyunionofficial"
      name: "Energy Union Official"
      chat_id: null  # Will be filled automatically on first message
      
    - username: "@energyunionteam"
      name: "Energy Union Team"
      chat_id: null  # Will be filled automatically on first message
      
  # Platform triggers that allow response without direct mention
  platform_triggers:
    - "Energy Union"
    - "EcoMiner"
    - "BioMiner"
    - "EUT"
    - "Helion"
    - "energyunion.io"
    - "ENERGY токен"
    - "kWt токен"
    - "1T токен"

# ============================================
# APPRENTICE MODE
# ============================================
apprentice_mode:
  enabled: true
  
  # Limits to prevent spam
  limits:
    proactive_question_cooldown_minutes: 30
    proactive_questions_per_day: 3
    max_questions_per_thread: 1
    
  # Mentors list
  mentors:
    - name: "Сергій Герман"
      telegram:
        username: null  # No username, only phone
        phone: "+380504115611"
        user_id: null
      role: "mentor"
      confidence: "configured"
      
    - name: "Олег Ковальчук"
      telegram:
        username: "@olegarch88"
        user_id: null
      role: "mentor"
      confidence: "configured"
      
    - name: "Сергій Варнавський"
      telegram:
        username: null  # No username, only phone
        phone: "+380503132143"
        user_id: null
      role: "mentor"
      confidence: "configured"
      
    - name: "Іван Титар"
      telegram:
        username: "@ivantytar"
        user_id: null
      role: "mentor"
      confidence: "configured"
      
    - name: "Александр Вертій"
      telegram:
        username: "@archenvis"
        user_id: null
      role: "mentor"
      confidence: "configured"

# ============================================
# ADDRESS DETECTION
# ============================================
address_detection:
  # Name variants to recognize
  name_variants:
    - "Helion"
    - "Hélion"
    - "Хеліон"
    - "Helios"
    - "helion"
    - "хеліон"
    
  # Bot usernames
  bot_usernames:
    - "@energyunionBot"
    - "@HelionBot"
    
  # Regex patterns for detection
  patterns:
    # Start of message
    start_pattern: "^(helion|hélion|хеліон|helios)\\b[\\s,!?—:]"
    # Anywhere in message (less reliable)
    anywhere_pattern: "\\b(helion|hélion|хеліон)\\b[\\s,!?—:]"
    # Presence ping
    presence_pattern: "^(helion|hélion|хеліон)\\??\\s*(ти тут|here\\??)?$"

# ============================================
# SESSION STATE MEMORY (SSM) SCHEMA
# ============================================
session_state:
  fields:
    - name: "chat_id"
      type: "string"
      description: "Telegram chat ID"
      
    - name: "thread_id"
      type: "string"
      nullable: true
      
    - name: "last_addressed_to_helion"
      type: "boolean"
      default: false
      
    - name: "last_user_id"
      type: "string"
      nullable: true
      
    - name: "last_user_nick"
      type: "string"
      nullable: true
      
    - name: "active_topic_id"
      type: "string"
      nullable: true
      
    - name: "active_context_open"
      type: "boolean"
      default: false
      
    - name: "last_media_id"
      type: "string"
      nullable: true
      
    - name: "last_media_handled"
      type: "boolean"
      default: false
      
    - name: "last_answer_fingerprint"
      type: "string"
      nullable: true
      description: "Semantic hash to prevent repetition"
      
    - name: "group_trust_mode"
      type: "boolean"
      default: false
      
    - name: "apprentice_mode"
      type: "boolean"
      default: false
      
    - name: "mentors"
      type: "array"
      default: []
      
    - name: "question_count_today"
      type: "integer"
      default: 0
      
    - name: "last_question_timestamp"
      type: "datetime"
      nullable: true

# ============================================
# CONTEXT CLOSURE RULES
# ============================================
context_closure:
  # Keywords that reopen context
  reopen_triggers:
    - "про те фото"
    - "повернімося до"
    - "ще про"
    - "щодо того"
    - "about that"
    - "back to"
    
  # Auto-close after response
  auto_close_on:
    - "image_question_answered"
    - "direct_question_answered"
    - "factual_query_answered"

# ============================================
# ANTI-REPEAT SETTINGS
# ============================================
anti_repeat:
  enabled: true
  fingerprint_method: "semantic_hash"
  similarity_threshold: 0.85
  
  # Allowed responses when repeat detected
  on_repeat_detected:
    - action: "ask_clarification"
      template: "Що саме уточнити з мого попереднього повідомлення?"
    - action: "stop"
      condition: "no_new_question"
