# Planner 配置文件
# ============================================================================
# 该文件包含 planner.py 的规则引擎配置和 planner_node.py 的运行参数。
# 启动时由 planner_node 通过 planner_config_loader 加载。
#
# 目录位置：
#   ROS2 包内：share/agint_brain/config/planner_config.yaml
#   或通过参数 planner_config_path 指定绝对路径


# ============================================================================
# Planner 模式
# ============================================================================
# 可选值：rule / llm / hybrid
#   - rule: 仅使用规则引擎（不调用 LLM）
#   - llm: 仅使用 LLM（调用 OmniNode）
#   - hybrid: 优先规则，复杂意图走 LLM
mode: "hybrid"


# ============================================================================
# Planner 核心参数
# ============================================================================
planner:
  # 默认风险等级：low / medium / high
  default_risk_level: "low"

  # 中高风险操作是否需要用户确认
  require_confirmation_on_medium_risk: true
  require_confirmation_on_high_risk: true

  # 单个 Plan 最大步骤数
  max_plan_steps: 10

  # 计划来源标识（用于 Plan.source 字段）
  default_source: "hybrid"


# ============================================================================
# 可用工具（Capability 列表）
# ============================================================================
  available_tools:
    - "feed"
    - "adjust_fan"
    - "control_light"
    - "speak"
    - "query"
    - "move"
    - "inspect"
    - "turn_on"
    - "turn_off"
    - "adjust"

  # 工具语义描述（供 OmniNode 使用）
  # 格式：name, description, tool_call_type, category
  tool_descriptions:
    - name: "feed"
      description: "用于执行喂食动作（如宠物或牲畜喂食）"
      tool_call_type: "execute"
      category: "action"

    - name: "adjust_fan"
      description: "用于调整风扇的风力档位或开关状态"
      tool_call_type: "execute"
      category: "action"

    - name: "control_light"
      description: "用于控制灯光的开关或亮度"
      tool_call_type: "execute"
      category: "action"

    - name: "speak"
      description: "用于播报自然语言给用户，仅用于对话播报"
      tool_call_type: "speak"
      category: "dialog"

    - name: "query"
      description: "用于查询机器人系统内部状态，不代表联网查询外部实时信息"
      tool_call_type: "query_world"
      category: "query"

    - name: "move"
      description: "用于控制机器人移动到指定位置"
      tool_call_type: "execute"
      category: "action"

    - name: "inspect"
      description: "用于巡检、查看环境或检查状态"
      tool_call_type: "execute"
      category: "action"

    - name: "turn_on"
      description: "用于打开设备"
      tool_call_type: "execute"
      category: "action"

    - name: "turn_off"
      description: "用于关闭设备"
      tool_call_type: "execute"
      category: "action"

    - name: "adjust"
      description: "用于通用调节操作"
      tool_call_type: "execute"
      category: "action"


# ============================================================================
# 意图映射（关键词 → action）
# ============================================================================
  intent_to_action:
    # 喂食相关
    "喂": "feed"
    "喂食": "feed"
    "喂养": "feed"

    # 风扇控制
    "打开风扇": "adjust_fan"
    "关闭风扇": "adjust_fan"
    "调整风扇": "adjust_fan"
    "降温": "adjust_fan"
    "升温": "adjust_fan"

    # 灯光控制
    "开灯": "control_light"
    "关灯": "control_light"
    "调整灯光": "control_light"

    # 通用开关
    "打开": "turn_on"
    "关闭": "turn_off"
    "启动": "turn_on"
    "停止": "turn_off"
    "调节": "adjust"

    # 移动
    "移动": "move"
    "前往": "move"
    "走到": "move"

    # 查询/检查
    "查询": "query"
    "查看": "query"
    "检查": "inspect"
    "巡检": "inspect"
    "监测": "monitor"

    # 语音/通知
    "播报": "speak"
    "报告": "speak"
    "说": "speak"
    "告诉": "speak"
    "通知": "notify"
    "提醒": "remind"
    "警告": "warn"
    "询问": "ask"


# ============================================================================
# 高风险动作列表
# ============================================================================
  high_risk_actions:
    - "turn_off"
    - "emergency_stop"
    - "shutdown"
    - "power_off"


# ============================================================================
# 中风险动作列表
# ============================================================================
  medium_risk_actions:
    - "adjust_fan"
    - "adjust"
    - "control_light"


# ============================================================================
# 确认规则
# ============================================================================
  confirmation_rules:
    # 重复动作需要确认
    repeated_action_requires_confirmation: true

    # 执行器不可用时需要确认
    unavailable_actuator_requires_confirmation: true

    # 高风险需要确认（覆盖默认值）
    high_risk_requires_confirmation: true

    # 中风险需要确认（覆盖默认值）
    medium_risk_requires_confirmation: true


# ============================================================================
# Planner Node 运行时参数（也可通过 ROS2 参数传入）
# ============================================================================
planner_node:
  # Topic 配置
  input_world_topic: "/world/snapshot"
  input_asr_topic: "/asr"
  output_plan_topic: "/plan"
  llm_request_topic: "/planner/llm_request"
  llm_response_topic: "/planner/llm_response"
  planner_config_path: "planner_config.yaml"

  # LLM 配置
  llm_timeout_sec: 10.0
  use_llm: true
  default_session_id: "default"

  # 日志配置
  debug_log: true


# ============================================================================
# Gate 前置治理配置（可选，已迁移到 planner_gate_config.yaml）
# ============================================================================
# gate_rules 和 project_env 配置已迁移到独立的 planner_gate_config.yaml
# 此处保留占位，便于后续扩展
gate_config:
  # Gate 配置文件路径
  gate_config_path: "planner_gate_config.yaml"

  # 是否启用 Gate 前置治理
  enable_gate: true

  # 是否启用 Teacher Memory
  enable_teacher_memory: true


# ============================================================================
# 项目环境配置（场景相关，可切换）
# ============================================================================
# 此处为基础配置，详细配置见 planner_gate_config.yaml
project_env:
  # 场景标识
  scene: cattle_farm_robot

  # 标准地点列表
  standard_locations:
    - "广场"
    - "大门"
    - "充电站"
    - "牛棚1号"
    - "牛棚2号"

  # 地点别名映射（用户说法 -> 标准地点）
  location_alias_map:
    "牛鹏1号": "牛棚1号"
    "牛鹏2号": "牛棚2号"
    "牛栏1号": "牛棚1号"
    "牛栏2号": "牛棚2号"

  # 机器人角色
  robot_role: "智能农场机器人"
  robot_name: "农宝"


# ============================================================================
# Teacher Memory 模板（基础模板，详细模板见 teaching_memory_templates.yaml）
# ============================================================================
# 此处为基础模板，系统会优先加载 teaching_memory_templates.yaml
teaching_memory_base:
  # 查询类基础回复
  query.position: "我目前在广场。"
  query.status: "我当前电量充足，状态正常，随时可以工作。"
  query.weather: "当前天气晴朗，温度28°C，适合户外工作。"
  query.identity: "我是农宝，智能农场机器人，为您服务。"

