# ============================================================================
# 本地配置示例文件 / Local Configuration Example File
# ============================================================================
# 此文件是 appsettings.Local.yml 的示例模板，用于本地部署和桌面应用配置。
# This file is an example template for appsettings.Local.yml, used for local deployment and desktop app configuration.
#
# 使用方法 / Usage:
# 1. 复制此文件为 appsettings.Local.yml
#    Copy this file to appsettings.Local.yml
# 2. 根据需要修改配置项
#    Modify configuration items as needed
# 3. 将 appsettings.Local.yml 放在与 appsettings.yml 相同的目录
#    Place appsettings.Local.yml in the same directory as appsettings.yml
#
# 配置优先级 / Configuration Priority:
# 1. 环境变量（最高优先级）/ Environment Variables (highest priority)
# 2. appsettings.Local.yml（本文件）/ appsettings.Local.yml (this file)
# 3. appsettings.{Environment}.yml
# 4. appsettings.yml（最低优先级）/ appsettings.yml (lowest priority)
#
# 注意 / Notes:
# - 所有配置项都是可选的，未配置的项将使用 appsettings.yml 中的默认值
#   All configuration items are optional; unconfigured items will use defaults from appsettings.yml
# - 敏感信息（如 API 密钥）建议使用环境变量配置
#   Sensitive information (like API keys) should be configured via environment variables
# - 以 # 开头的行是注释，不会影响配置
#   Lines starting with # are comments and do not affect configuration
# ============================================================================

# ============================================================================
# 服务器 URL 配置 / Server URL Configuration
# ============================================================================
# 应用程序监听的 URL 地址。可以配置多个地址，用分号分隔。
# The URLs the application listens to. Multiple URLs can be separated by semicolons.
#
# 默认值 / Default: "http://127.0.0.1:35167"
# 可选值 / Optional: 任何有效的 HTTP/HTTPS URL
# 环境变量 / Environment Variable: ASPNETCORE_URLS
#
# 示例 / Examples:
# - 本地开发: "http://127.0.0.1:35167"
# - 所有网络接口: "http://0.0.0.0:35167"
# - HTTPS: "https://0.0.0.0:35168"
# - 多个地址: "http://127.0.0.1:35167;https://0.0.0.0:35168"
#
# 生产环境建议 / Production Recommendation:
# 使用 Kestrel:Endpoints 配置以支持 SSL 证书和更精细的控制
# Use Kestrel:Endpoints configuration for SSL certificate support and finer control
# ============================================================================
Urls: "http://127.0.0.1:35167"

# ============================================================================
# 数据库配置 / Database Configuration
# ============================================================================
# HagiCode 支持两种数据库提供商：
# HagiCode supports two database providers:
#
# 1. SQLite（默认）/ SQLite (Default)
#    - 嵌入式数据库，零配置 / Embedded database, zero configuration
#    - 适合场景：单机部署、开发环境、软件包部署
#      Best for: Single-machine deployments, development, software packages
#    - 优点：无外部依赖、易于设置、可移植的数据库文件
#      Pros: No external dependencies, easy setup, portable database file
#    - 缺点：单写入、有限并发、不适合多用户团队
#      Cons: Single writer, limited concurrency, not for multi-user teams
#    - 数据库文件：./data/hagicode.db（自动创建）
#      Database file: ./data/hagicode.db (auto-created)
#
# 2. PostgreSQL
#    - 生产级关系数据库 / Production-grade relational database
#    - 适合场景：生产部署、多用户团队、高并发
#      Best for: Production deployments, multi-user teams, high concurrency
#    - 优点：多写入、高性能、高级功能
#      Pros: Multi-writer, high performance, advanced features
#    - 缺点：需要外部数据库安装和配置
#      Cons: Requires external database installation and configuration
#
# 切换到 PostgreSQL 的方法 / To switch to PostgreSQL:
# - 在此文件中设置: Provider: "postgresql"
#   Set in this file: Provider: "postgresql"
# - 或使用环境变量: export Database__Provider=postgresql
#   Or use environment variable: export Database__Provider=postgresql
# ============================================================================

Database:
  # 数据库提供商 / Database provider: "sqlite" (默认/default) 或 "postgresql"
  # 环境变量 / Environment Variable: Database__Provider
  Provider: "sqlite"

  # 是否在应用启动时自动应用数据库迁移
  # Whether to automatically apply database migrations on application startup
  #
  # 默认值 / Default: true
  # 可选值 / Optional: true, false
  # 建议 / Recommendation: 生产环境建议设置为 true
  AutoMigrateDatabase: true

  # 是否在应用启动时自动运行 DbUp SQL 脚本迁移
  # Whether to automatically run DbUp SQL script migrations on application startup
  #
  # 默认值 / Default: true
  # 可选值 / Optional: true, false
  AutoRunDbUpMigrations: true

  # 是否在迁移后自动种子数据
  # Whether to seed data after migration
  #
  # 默认值 / Default: true
  # 可选值 / Optional: true, false
  AutoSeedData: true

  # 数据库操作超时时间（秒）
  # Timeout for database operations in seconds
  #
  # 默认值 / Default: 300
  # 可选值 / Optional: 任何正整数
  MigrationTimeoutSeconds: 300

# ============================================================================
# 数据库连接字符串 / Database Connection Strings
# ============================================================================
# 默认连接字符串，格式取决于 Database:Provider 的设置
# Default connection string, format depends on Database:Provider setting
#
# 对于 SQLite（默认）/ For SQLite (default):
#   默认值 / Default: "Data Source=./data/hagicode.db"
#   数据库文件路径可以是相对路径或绝对路径
#   Database file path can be relative or absolute
#
# 对于 PostgreSQL / For PostgreSQL:
#   默认值 / Default: "Host=localhost;Port=35439;Database=hagicode;Username=postgres;Password=postgres"
#   或使用环境变量: ${DATABASE_URL}
#   Or use environment variable: ${DATABASE_URL}
#
# 环境变量 / Environment Variable: ConnectionStrings__Default
# ============================================================================
ConnectionStrings:
  # SQLite 连接字符串（默认）
  # SQLite connection string (default)
  #
  # 数据库文件将在指定路径自动创建
  # Database file will be auto-created at the specified path
  #  Default: "Data Source=./data/hagicode.db;"

  # PostgreSQL 连接字符串（如需使用 PostgreSQL，请取消注释并配置）
  # PostgreSQL connection string (uncomment and configure to use PostgreSQL)
  # Default: "Host=localhost;Port=5432;Database=hagicode;Username=postgres;Password=postgres"

# ============================================================================
# 数据目录配置 / Data Directory Configuration
# ============================================================================
# 应用程序数据目录，用于存储数据库文件、日志等所有数据文件
# Application data directory for storing all data files like databases, logs, etc.
#
# 默认值 / Default: "./data"
# 可选值 / Optional: 任何有效的文件系统路径
# 环境变量 / Environment Variable: HAGICODE_DATA_DIR
#
# 推荐路径 / Recommended Paths:
# - Linux/macOS: ./data 或 /var/hagicode/data
# - Windows: .\data 或 C:\ProgramData\HagiCode\data
#
# Docker 部署建议 / Docker Deployment Recommendation:
# 将此目录挂载到卷：/path/on/host:/app/data
# Mount this directory to a volume: /path/on/host:/app/data
# ============================================================================
DataDir: "./data"

# ============================================================================
# Orleans 集群配置 / Orleans Cluster Configuration
# ============================================================================
# Orleans 是一个分布式应用程序框架，用于构建可扩展的云服务
# Orleans is a distributed application framework for building scalable cloud services
#
# 集群 ID 和服务 ID 用于标识 Orleans Silo
# Cluster ID and Service ID are used to identify the Orleans Silo
#
# 环境变量 / Environment Variables:
# - Orleans__ClusterId
# - Orleans__ServiceId
# ============================================================================
Orleans:
  # Orleans 集群标识符 / Orleans cluster identifier
  #
  # 默认值 / Default: "pcode-cluster"
  # 建议 / Recommendation: 同一集群的所有节点使用相同的 ClusterId
  ClusterId: "pcode-cluster"

  # Orleans 服务标识符 / Orleans service identifier
  #
  # 默认值 / Default: "pcode-service"
  ServiceId: "pcode-service"

  # Grain Storage 数据库路径（SQLite with LINQ to DB）
  # Grain Storage Database Path (SQLite with LINQ to DB)
  #
  # 存储在数据目录中以便于备份和 Docker 卷挂载
  # Stored in data directory for easier backup and Docker volume mounting
  # 使用 WAL 模式以获得更好的并发性能
  # Uses WAL mode for better concurrency
  #
  # 默认值 / Default: "Data Source=./data/orleans/grains.db"
  # 环境变量 / Environment Variable: Orleans__GrainStorageDbPath
  #  GrainStorageDbPath: "Data Source=./data/orleans/grains.db"

# ============================================================================
# AI 提供商配置 / AI Provider Configuration
# ============================================================================
# 配置基于 CLI 的 AI 提供商及其特定设置
# Configure CLI-based AI providers with their specific settings
#
# 注意：仅支持基于 CLI 的提供商（ClaudeCodeCli, IFlowCli, OpenCodeCli, GitHubCopilot）
# Note: Only CLI-based providers are supported
#
# 支持的提供商类型 / Supported Provider Types:
# - ClaudeCodeCli: Claude Code CLI（默认/default）
# - IFlowCli: IFlow CLI
# - OpenCodeCli: OpenCode CLI
# - GitHubCopilot: GitHub Copilot CLI（ACP 模式）
# ============================================================================
AI:
  # 默认 AI 提供商 / Default AI provider
  #
  # 当未指定提供商时使用的默认提供商
  # The default provider to use when none is specified
  #
  # 默认值 / Default: "ClaudeCodeCli"
  # 可选值 / Optional: "ClaudeCodeCli", "IFlowCli", "OpenCodeCli", "GitHubCopilot"
  # 环境变量 / Environment Variable: AI__DefaultProvider
  DefaultProvider: "ClaudeCodeCli"

  # ========================================================================
  # AI 服务配置 / AI Service Configuration
  # ========================================================================
  Service:
    # 是否自动将语言偏好注入到不包含语言指令的提示词中
    # Whether to automatically inject language preference into prompts that don't contain language instructions
    #
    # 默认值 / Default: true
    # 可选值 / Optional: true, false
    # 环境变量 / Environment Variable: AI__Service__AutoInjectLanguagePreference
    AutoInjectLanguagePreference: true

    # 当用户未设置语言偏好时的默认语言偏好
    # Default language preference when user hasn't set one
    #
    # 默认值 / Default: "zh-CN"
    # 可选值 / Optional: null（跟随 UI/follow UI）, "zh-CN", "en-US"
    # 环境变量 / Environment Variable: AI__Service__DefaultLanguagePreference
    DefaultLanguagePreference: "zh-CN"

  # ========================================================================
  # AI 提供商详细配置 / AI Providers Detailed Configuration
  # ========================================================================
  Providers:
    # ------------------------------------------------------------------------
    # Claude Code CLI 提供商（默认）/ Claude Code CLI Provider (Default)
    # ------------------------------------------------------------------------
    ClaudeCodeCli:
      # 提供商类型 / Provider type
      #
      # 默认值 / Default: "ClaudeCodeCli"
      Type: "ClaudeCodeCli"

      # Claude CLI 可执行文件路径
      # Path to claude CLI executable
      #
      # 默认值 / Default: "claude"
      # 可选值 / Optional: 命令名称或完整路径/command name or full path
      # 环境变量 / Environment Variable: AI__Providers__ClaudeCodeCli__ExecutablePath
      ExecutablePath: "claude"

      # 使用的模型（可选）
      # Model to use (optional)
      #
      # 默认值 / Default: null（使用 Claude CLI 默认模型/use Claude CLI default model）
      # 可选值 / Optional: "claude-3-5-sonnet-20241022", "claude-opus-4-5", etc.
      # 环境变量 / Environment Variable: AI__Providers__ClaudeCodeCli__Model
      # Model: "claude-3-5-sonnet-20241022"

      # 工作目录（可选，可覆盖默认工作目录）
      # Working directory (optional, can override default working directory)
      #
      # 默认值 / Default: null（使用系统默认/use system default）
      # 环境变量 / Environment Variable: AI__Providers__ClaudeCodeCli__WorkingDirectory
      WorkingDirectory: null

      # 提供商特定设置 / Provider-specific settings
      Settings:
        # CLI 执行超时时间（秒）
        # CLI execution timeout in seconds
        #
        # 默认值 / Default: "300"
        # 可选值 / Optional: 任何正整数
        # 环境变量 / Environment Variable: AI__Providers__ClaudeCodeCli__Settings__TimeoutSeconds
        TimeoutSeconds: "300"

    # ------------------------------------------------------------------------
    # IFlow CLI 提供商（替代方案）/ IFlow CLI Provider (Alternative)
    # ------------------------------------------------------------------------
    IFlowCli:
      # 提供商类型 / Provider type
      #
      # 默认值 / Default: "IFlowCli"
      Type: "IFlowCli"

      # IFlow CLI 可执行文件路径
      # Path to iflow CLI executable
      #
      # 默认值 / Default: "iflow"
      # 可选值 / Optional: 命令名称或完整路径/command name or full path
      ExecutablePath: "iflow"

      # 模型选择（iflow 使用自己的配置）
      # Model selection (iflow uses its own configuration)
      #
      # 默认值 / Default: "default"
      Model: "default"

      # 工作目录（可选）
      # Working directory (optional)
      WorkingDirectory: null

      Settings:
        # CLI 执行超时时间（秒）
        # CLI execution timeout in seconds
        #
        # 默认值 / Default: "120"
        TimeoutSeconds: "120"

        # 最大输出字节数
        # Maximum output bytes
        #
        # 默认值 / Default: "10000000"
        MaxOutputLength: "10000000"

    # ------------------------------------------------------------------------
    # OpenCode CLI 提供商 / OpenCode CLI Provider
    # ------------------------------------------------------------------------
    OpenCodeCli:
      # 提供商类型 / Provider type
      #
      # 默认值 / Default: "OpenCodeCli"
      Type: "OpenCodeCli"

      # OpenCode CLI 可执行文件路径
      # Path to opencode CLI executable
      #
      # 默认值 / Default: "opencode"
      ExecutablePath: "opencode"

      # 模型选择
      # Model selection
      #
      # 默认值 / Default: "default"
      Model: "default"

      # 工作目录（可选）
      # Working directory (optional)
      WorkingDirectory: null

      Settings:
        # CLI 执行超时时间（秒）
        # CLI execution timeout in seconds
        #
        # 默认值 / Default: "300"
        TimeoutSeconds: "300"

    # ------------------------------------------------------------------------
    # GitHub Copilot CLI 提供商（ACP 模式）/ GitHub Copilot CLI Provider (ACP mode)
    # ------------------------------------------------------------------------
    GitHubCopilot:
      # 提供商类型 / Provider type
      #
      # 默认值 / Default: "GitHubCopilot"
      Type: "GitHubCopilot"

      # 是否启用 GitHub Copilot
      # Whether to enable GitHub Copilot
      #
      # 默认值 / Default: false
      # 可选值 / Optional: true, false
      # 注意 / Note: 需要有效的 GitHub Copilot 订阅/Requires valid GitHub Copilot subscription
      Enabled: false

      # Copilot CLI 可执行文件路径
      # Path to copilot CLI executable
      #
      # 默认值 / Default: "copilot"
      ExecutablePath: "copilot"

      # 使用的模型
      # Model to use
      #
      # 默认值 / Default: "gpt-4.1"
      # 可选值 / Optional: "claude-sonnet-4.5", "claude-opus-4.5", "gpt-4.1", "gpt-5", etc.
      Model: "gpt-4.1"

      # 工作目录（可选）
      # Working directory (optional)
      WorkingDirectory: null

      # 请求超时时间（秒）
      # Request timeout in seconds
      #
      # 默认值 / Default: 300
      Timeout: 300

      # 进程启动超时时间（秒）
      # Process startup timeout in seconds
      #
      # 默认值 / Default: 30
      StartupTimeout: 30

      # ACP 模式的权限设置
      # Permission settings for ACP mode
      Permissions:
        # 是否允许所有工具（生产环境不推荐）
        # Allow all tools (not recommended for production)
        #
        # 默认值 / Default: false
        AllowAllTools: false

        # 是否允许所有文件系统路径（生产环境不推荐）
        # Allow all file system paths (not recommended for production)
        #
        # 默认值 / Default: false
        AllowAllPaths: false

        # 是否允许所有 URL 访问（生产环境不推荐）
        # Allow all URL access (not recommended for production)
        #
        # 默认值 / Default: false
        AllowAllUrls: false

        # 允许的工具名称白名单
        # Whitelist of allowed tool names
        #
        # 默认值 / Default: [] (空列表/empty list)
        AllowedTools: []

        # 允许的文件系统路径白名单
        # Whitelist of allowed file system paths
        #
        # 默认值 / Default: [] (空列表/empty list)
        AllowedPaths: []

        # 拒绝的工具名称黑名单
        # Blacklist of denied tool names
        #
        # 默认值 / Default: [] (空列表/empty list)
        DeniedTools: []

        # 拒绝的 URL 黑名单
        # Blacklist of denied URLs
        #
        # 默认值 / Default: [] (空列表/empty list)
        DeniedUrls: []

      # 额外的命令行参数
      # Additional command-line arguments
      #
      # 默认值 / Default: [] (空列表/empty list)
      # 示例 / Example: ["--experimental"]
      AdditionalArgs: []

  # ========================================================================
  # ACP 会话管理器配置 / ACP Session Manager Configuration
  # ========================================================================
  SessionManager:
    # 最大并发会话数
    # Maximum concurrent sessions
    #
    # 默认值 / Default: 50
    # 可选值 / Optional: 0 表示无限制/0 means unlimited, 或任何正整数/or any positive integer
    # 环境变量 / Environment Variable: AI__SessionManager__MaxSessions
    MaxSessions: 50

    # 会话的默认工作目录
    # Default working directory for sessions
    #
    # 默认值 / Default: null（使用系统临时目录/use system temp directory）
    # 可选值 / Optional: 任何有效的文件系统路径
    # 环境变量 / Environment Variable: AI__SessionManager__DefaultWorkingDirectory
    DefaultWorkingDirectory: null

  # ========================================================================
  # ACP 会话管理的平台配置 / Platform Configurations for ACP Session Management
  # ========================================================================
  # 每个平台根据自己的传输类型和需求都有自己的配置
  # Each platform has its own configuration based on its transport type and requirements
  # ============================================================================
  PlatformConfigurations:
    # ------------------------------------------------------------------------
    # IFlow 平台配置（基于 WebSocket，带端口分配）/ IFlow Platform Configuration
    # ------------------------------------------------------------------------
    IFlowCli:
      # 传输类型 / Transport type
      #
      # 默认值 / Default: "WebSocket"
      # 说明 / Note: iFlow 使用 WebSocket 进行 ACP 通信/iFlow uses WebSocket for ACP communication
      TransportType: "WebSocket"

      # IFlow 可执行文件路径
      # Path to iflow executable
      #
      # 默认值 / Default: "iflow"
      ExecutablePath: "iflow"

      # 命令参数（{port} 将被替换为分配的端口）
      # Command arguments ({port} will be replaced with allocated port)
      #
      # 默认值 / Default: "--experimental-acp --port {port}"
      Arguments: "--experimental-acp --port {port}"

      # 端口分配模式 / Port allocation mode
      #
      # 默认值 / Default: "Managed"
      # 可选值 / Optional:
      #   - "Managed": 系统自动分配端口（在 MinPort 和 MaxPort 之间）
      #               System automatically allocates port (between MinPort and MaxPort)
      #   - "ExternalFixedPort": 使用外部指定的固定端口
      #                         Use externally specified fixed port
      PortMode: "Managed"

      # 最小端口号（仅 Managed 模式）/ Minimum port (Managed mode only)
      #
      # 默认值 / Default: 8090
      MinPort: 8090

      # 最大端口号（仅 Managed 模式）/ Maximum port (Managed mode only)
      #
      # 默认值 / Default: 9000
      MaxPort: 9000

      # 外部模式固定端口（仅 ExternalFixedPort 模式）
      # Fixed port for external mode (ExternalFixedPort mode only)
      #
      # 默认值 / Default: null
      ExternalPort: null

      # 外部端点（可选，格式："hostname:port"）
      # Optional external endpoint (format: "hostname:port")
      #
      # 默认值 / Default: null
      ExternalEndpoint: null

      # 进程启动超时时间（毫秒）
      # Process startup timeout in milliseconds
      #
      # 默认值 / Default: 5000
      StartupTimeoutMs: 5000

    # ------------------------------------------------------------------------
    # OpenCode 平台配置（基于 stdio，无需端口）/ OpenCode Platform Configuration
    # ------------------------------------------------------------------------
    OpenCodeCli:
      # 传输类型 / Transport type
      #
      # 默认值 / Default: "Stdio"
      # 说明 / Note: OpenCode 使用 stdio 进行 ACP 通信/OpenCode uses stdio for ACP communication
      TransportType: "Stdio"

      # OpenCode 可执行文件路径
      # Path to opencode executable
      #
      # 默认值 / Default: "opencode"
      ExecutablePath: "opencode"

      # 启用 ACP 协议的命令参数
      # Command arguments to enable ACP protocol
      #
      # 默认值 / Default: "acp"
      Arguments: "acp"

      # 进程启动超时时间（秒）
      # Process startup timeout in seconds
      #
      # 默认值 / Default: 5
      StartupTimeoutSec: 5

    # ------------------------------------------------------------------------
    # GitHub Copilot 平台配置（基于 stdio，无需端口）/ GitHub Copilot Platform
    # ------------------------------------------------------------------------
    GitHubCopilot:
      # 传输类型 / Transport type
      #
      # 默认值 / Default: "Stdio"
      # 说明 / Note: Copilot 使用 stdio 进行 ACP 通信/Copilot uses stdio for ACP communication
      TransportType: "Stdio"

      # Copilot 可执行文件路径
      # Path to copilot executable
      #
      # 默认值 / Default: "copilot"
      ExecutablePath: "copilot"

      # 使用的模型
      # Model to use
      #
      # 默认值 / Default: "gpt-4.1"
      # 可选值 / Optional: "claude-sonnet-4.5", "claude-opus-4.5", "gpt-4.1", "gpt-5", etc.
      Model: "gpt-4.1"

      # 进程启动超时时间（秒）
      # Process startup timeout in seconds
      #
      # 默认值 / Default: 30
      StartupTimeoutSec: 30

      # 是否允许所有工具（生产环境不推荐）
      # Allow all tools (not recommended for production)
      #
      # 默认值 / Default: false
      AllowAllTools: false

      # 是否允许所有文件系统路径（生产环境不推荐）
      # Allow all file system paths (not recommended for production)
      #
      # 默认值 / Default: false
      AllowAllPaths: false

      # 是否允许所有 URL 访问（生产环境不推荐）
      # Allow all URL access (not recommended for production)
      #
      # 默认值 / Default: false
      AllowAllUrls: false

      # 额外的命令行参数
      # Additional command-line arguments
      #
      # 默认值 / Default: [] (空列表/empty list)
      AdditionalArgs: []

# ============================================================================
# 工作区持久化配置 / Workspace Persistence Configuration
# ============================================================================
# 配置 PCode 存储编码会话的临时工作区文件的位置
# Configure where PCode stores temporary workspace files for coding sessions
#
# 默认情况下，使用系统临时目录。取消注释 WorkspaceRoot 以使用持久化位置。
# By default, uses the system Temp directory. Uncomment WorkspaceRoot to use a persistent location.
# ============================================================================
Workspace:
  # 工作区根目录（可选）
  # Workspace root directory (optional)
  #
  # 默认值 / Default: "" (使用系统临时目录/uses system temp directory)
  # 可选值 / Optional: 任何有效的文件系统路径
  # 建议 / Recommendation: Linux 上使用 "/var/lib/pcode/workspaces" 等持久化路径
  #                       Use persistent paths like "/var/lib/pcode/workspaces" on Linux
  # 环境变量 / Environment Variable: PCODE_WORKSPACE_ROOT
  # WorkspaceRoot: ""

  # 是否自动创建工作区目录
  # Whether to automatically create the workspace directory if it doesn't exist
  #
  # 默认值 / Default: true
  # 可选值 / Optional: true, false
  AutoCreateDirectory: true

# ============================================================================
# 许可服务配置 / License Service Configuration
# ============================================================================
# 配置 HagiCode 许可证验证服务
# Configure HagiCode license verification service
#
# 注意：这是可选配置。如果您的部署不需要许可证验证，可以省略此部分。
# Note: This is optional configuration. If your deployment doesn't require license verification, you can omit this section.
# ============================================================================
License:
  # 主服务器配置 / Primary server configuration
  PrimaryServer:
    # 许可证服务器端点
    # License server endpoint
    #
    # 默认值 / Default: "https://api.keygen.sh"
    # 环境变量 / Environment Variable: License__PrimaryServer__Endpoint
    Endpoint: "https://api.keygen.sh"

    # API 密钥
    # API key
    #
    # 默认值 / Default: "activ-cc0493de1b3d2d3ab58e3d1115d61564v3"
    # 建议 / Recommendation: 生产环境应通过环境变量配置
    #                       In production, configure via environment variable
    # 环境变量 / Environment Variable: License__PrimaryServer__ApiKey
    ApiKey: "activ-cc0493de1b3d2d3ab58e3d1115d61564v3"

    # 账户 ID
    # Account ID
    #
    # 默认值 / Default: "0bb7cd41-a70d-4dd2-a740-5e30500cf70b"
    AccountId: "0bb7cd41-a70d-4dd2-a740-5e30500cf70b"

    # 产品 ID
    # Product ID
    #
    # 默认值 / Default: "2c73c847-1077-44e6-afeb-651d5e7eb005"
    ProductId: "2c73c847-1077-44e6-afeb-651d5e7eb005"

    # 请求超时时间（秒）
    # Request timeout in seconds
    #
    # 默认值 / Default: 30
    TimeoutSeconds: 60

  # 激活配置 / Activation configuration
  Activation:
    # 是否在启动时自动激活
    # Whether to automatically activate on startup
    #
    # 默认值 / Default: true
    AutoActivateOnStartup: true

    # 是否要求有效的许可证
    # Whether to require a valid license
    #
    # 默认值 / Default: true
    # 注意 / Note: 如果设置为 false，应用将在无许可证情况下运行
    #               If set to false, the app will run without a license
    RequireValidLicense: false
    
    # 许可证密钥
    # License key
    # 默认值 / Default: "D76B5C-EC0A70-AEA453-BC9414-0A198D-V3"
    LicenseKey: "D76B5C-EC0A70-AEA453-BC9414-0A198D-V3"

  # 签名验证配置 / Signature verification configuration
  SignatureVerification:
    # 是否启用签名验证
    # Whether to enable signature verification
    #
    # 默认值 / Default: true
    Enabled: true

    # 容差时间（秒）
    # Tolerance in seconds
    #
    # 默认值 / Default: 300
    ToleranceSeconds: 300

    # 严格模式
    # Strict mode
    #
    # 默认值 / Default: true
    StrictMode: true

# ============================================================================
# 监控和分析配置 / Monitoring and Analytics Configuration
# ============================================================================

# ---------------------------------------------------------------------------
# Azure Application Insights 配置 / Azure Application Insights Configuration
# ---------------------------------------------------------------------------
# 提供应用程序性能监控、遥测和错误跟踪
# Provides application performance monitoring, telemetry, and error tracking
#
# 文档 / Documentation: https://learn.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview
#
# 注意：这是可选配置。如果不需要监控，可以设置 Enable: false
# Note: This is optional configuration. If monitoring is not needed, set Enable: false
# ---------------------------------------------------------------------------
ApplicationInsights:
  # 是否启用 Application Insights
  # Whether Application Insights is enabled
  #
  # 默认值 / Default: true
  # 可选值 / Optional: true, false
  # 环境变量 / Environment Variable: APPLICATIONINSIGHTS_ENABLE
  Enable: true

  # 从 Azure Portal 获取的连接字符串（Application Insights 资源）
  # Connection string from Azure Portal (Application Insights resource)
  #
  # 可以通过环境变量覆盖：APPLICATIONINSIGHTS_CONNECTION_STRING
  # Can be overridden via APPLICATIONINSIGHTS_CONNECTION_STRING environment variable
  #
  # 默认值 / Default: 见 appsettings.yml / See appsettings.yml
  ConnectionString: "InstrumentationKey=4f37a9cf-0fb5-4de4-a6c1-4b9c691215f5;IngestionEndpoint=https://eastasia-0.in.applicationinsights.azure.com/;LiveEndpoint=https://eastasia.livediagnostics.monitor.azure.com/;ApplicationId=cc0fa271-5952-4c71-96d0-540d77449286"

# ---------------------------------------------------------------------------
# 调试数据库配置 / Debug Database Configuration
# ---------------------------------------------------------------------------
# 存储反序列化错误捕获数据，用于调试 AI 消息解析失败
# Stores deserialization error capture data for debugging AI message parsing failures
#
# 注意：这是可选配置，主要用于开发和故障排除
# Note: This is optional configuration, mainly for development and troubleshooting
# ---------------------------------------------------------------------------
DebugDatabase:
  # 是否启用调试数据捕获
  # Enable or disable debug data capture
  #
  # 默认值 / Default: true
  # 可选值 / Optional: true, false
  Enabled: true

  # 数据库文件位置（相对于应用程序根目录）
  # Database file location (relative to application root)
  #
  # 默认值 / Default: "Data Source=./data/debug.db"
  ConnectionString: "Data Source=./data/debug.db"

  # 是否在启动时自动创建架构
  # Automatically create schema on startup
  #
  # 默认值 / Default: true
  AutoCreateSchema: true

  # 保留调试记录的时间（天）
  # How long to keep debug records (in days)
  #
  # 默认值 / Default: 90
  RetentionDays: 90

  # 警告前的最大数据库文件大小（MB）
  # Maximum database file size before warning (in MB)
  #
  # 默认值 / Default: 500
  MaxDatabaseSizeMB: 500

  # 数据库写入超时时间（毫秒）
  # Write timeout for database operations (in milliseconds)
  #
  # 默认值 / Default: 5000
  WriteTimeout: 5000

  # 数据库查询超时时间（毫秒）
  # Query timeout for database operations (in milliseconds)
  #
  # 默认值 / Default: 30000
  QueryTimeout: 30000

  # 最大并发写入数
  # Maximum concurrent writers
  #
  # 默认值 / Default: 10
  MaxConcurrentWriters: 10

  # 是否在启动时自动清理旧记录
  # Whether to automatically clean up old records on startup
  #
  # 默认值 / Default: true
  AutoCleanup: true

# ============================================================================
# 游戏化配置 / Gamification Configuration
# ============================================================================
# 配置用户成就和积分系统
# Configure user achievement and scoring system
#
# 注意：这是可选配置。如果不需要游戏化功能，可以省略此部分。
# Note: This is optional configuration. If gamification features are not needed, you can omit this section.
# ============================================================================
Gamification:
  # 成就层级阈值（基于每日贡献）
  # Achievement tier thresholds (based on DAILY contribution)
  #
  # 使用放大评分产生 10000+ 范围的分数
  # Amplified scoring to produce 10000+ range scores
  Tiers:
    # 铜牌最低分 / Bronze minimum score
    #
    # 默认值 / Default: 0
    BronzeMin: 0

    # 银牌最低分 / Silver minimum score
    #
    # 默认值 / Default: 1000
    SilverMin: 1000

    # 金牌最低分 / Gold minimum score
    #
    # 默认值 / Default: 3000
    GoldMin: 3000

    # 钻石最低分 / Diamond minimum score
    #
    # 默认值 / Default: 6000
    DiamondMin: 6000

  # 正面强化的积分权重（放大）
  # Score weights for positive reinforcement (amplified)
  ScoreWeights:
    # 会话权重 / Session weight
    #
    # 默认值 / Default: 200
    SessionWeight: 200

    # 回合权重 / Round weight
    #
    # 默认值 / Default: 10
    RoundWeight: 10

    # 工具调用权重 / Tool call weight
    #
    # 默认值 / Default: 15
    ToolCallWeight: 15

    # 代码块权重 / Code block weight
    #
    # 默认值 / Default: 25
    CodeBlockWeight: 25

    # 每 30 分钟活跃时间的奖励
    # Bonus per 30 minutes of active time
    #
    # 默认值 / Default: 50
    ActiveTimeBonusPer30Min: 50

  # 异常性能的奖励乘数（应用于每日分数）
  # Bonus multipliers for exceptional performance (applied to daily score)
  BonusMultipliers:
    # 异常表现阈值 / Exceptional performance threshold
    #
    # 默认值 / Default: 5000
    ExceptionalThreshold: 5000

    # 异常表现乘数 / Exceptional performance multiplier
    #
    # 默认值 / Default: 1.5
    ExceptionalMultiplier: 1.5

    # 优秀表现阈值 / Excellent performance threshold
    #
    # 默认值 / Default: 2500
    ExcellentThreshold: 2500

    # 优秀表现乘数 / Excellent performance multiplier
    #
    # 默认值 / Default: 1.3
    ExcellentMultiplier: 1.3

    # 良好表现阈值 / Good performance threshold
    #
    # 默认值 / Default: 1000
    GoodThreshold: 1000

    # 良好表现乘数 / Good performance multiplier
    #
    # 默认值 / Default: 1.1
    GoodMultiplier: 1.1

    # 标准乘数 / Standard multiplier
    #
    # 默认值 / Default: 1.0
    StandardMultiplier: 1.0

  # 动画设置 / Animation settings
  Animation:
    # 分数揭示持续时间（毫秒）
    # Score reveal duration in milliseconds
    #
    # 默认值 / Default: 800
    ScoreRevealDuration: 800

    # 徽章动画持续时间（毫秒）
    # Badge animation duration in milliseconds
    #
    # 默认值 / Default: 600
    BadgeAnimationDuration: 600

    # 进度环持续时间（毫秒）
    # Progress ring duration in milliseconds
    #
    # 默认值 / Default: 1000
    ProgressRingDuration: 1000

    # 交错延迟（毫秒）
    # Stagger delay in milliseconds
    #
    # 默认值 / Default: 150
    StaggerDelay: 150

    # 是否启用彩带效果
    # Whether to enable confetti effect
    #
    # 默认值 / Default: true
    EnableConfetti: true

    # 彩带效果阈值（分数）
    # Confetti effect threshold (score)
    #
    # 默认值 / Default: 6000
    ConfettiThreshold: 6000

# ============================================================================
# 容器和部署配置 / Container and Deployment Configuration
# ============================================================================

# ---------------------------------------------------------------------------
# 容器首次运行配置 / Container First-Run Configuration
# ---------------------------------------------------------------------------
# 具有自动项目发现的容器化部署设置
# Settings for containerized deployments with auto project discovery
#
# 注意：这是可选配置，主要用于 Docker 部署
# Note: This is optional configuration, mainly for Docker deployments
# ---------------------------------------------------------------------------
Container:
  # 容器项目发现的默认挂载路径
  # Default container mount path for project discovery
  #
  # 默认值 / Default: "/app/workdir"
  # 环境变量 / Environment Variable: HAGICODE_CONTAINER__MOUNTPATH
  MountPath: "/app/workdir"

  # 是否启用首次运行项目发现流程
  # Enable first-run project discovery flow
  #
  # 默认值 / Default: true
  # 可选值 / Optional: true, false
  # 环境变量 / Environment Variable: HAGICODE_CONTAINER__FIRSTRUNCHECKENABLED
  FirstRunCheckEnabled: true

# ---------------------------------------------------------------------------
# 版本检查配置 / Version Check Configuration
# ---------------------------------------------------------------------------
# 前端将检查更新并在有可用更新时显示通知
# Frontend will check for updates and display notifications when available
#
# 注意：这是可选配置。如果不需要自动更新检查，可以设置 Enabled: false
# Note: This is optional configuration. If auto update check is not needed, set Enabled: false
# ---------------------------------------------------------------------------
VersionCheck:
  # 是否启用版本检查
  # Whether version checking is enabled
  #
  # 默认值 / Default: true
  # 可选值 / Optional: true, false
  Enabled: true

  # GitHub 仓库所有者
  # GitHub repository owner
  #
  # 默认值 / Default: "HagiCode-org"
  GitHubRepositoryOwner: "HagiCode-org"

  # GitHub 仓库名称
  # GitHub repository name
  #
  # 默认值 / Default: "releases"
  GitHubRepositoryName: "releases"

  # 当前版本（可选，可覆盖自动检测的版本）
  # Optional: Override auto-detected version
  #
  # 默认值 / Default: null（自动检测/auto-detect）
  # 示例 / Example: "v0.1.0"
  CurrentVersion: null

  # GitHub API 请求的 HTTP 超时时间（秒）
  # HTTP timeout for GitHub API requests in seconds
  #
  # 默认值 / Default: 30
  HttpTimeoutSeconds: 30

  # GitHub API 请求的最大重试次数
  # Maximum retry attempts for GitHub API requests
  #
  # 默认值 / Default: 3
  MaxRetries: 3

  # 指数退避的基础延迟（毫秒）
  # Base delay in milliseconds for exponential backoff
  #
  # 默认值 / Default: 1000
  RetryBaseDelayMs: 1000

# ============================================================================
# 反馈和提示词配置 / Feedback and Prompts Configuration
# ============================================================================

# ---------------------------------------------------------------------------
# 反馈配置 / Feedback Configuration
# ---------------------------------------------------------------------------
# 用户体验反馈收集系统设置
# Settings for user experience feedback collection system
#
# 注意：这是可选配置。如果不需要反馈功能，可以省略此部分。
# Note: This is optional configuration. If feedback feature is not needed, you can omit this section.
# ---------------------------------------------------------------------------
Feedback:
  # 用户反馈表单链接
  # User feedback form link
  #
  # 默认值 / Default: "https://docs.qq.com/form/page/DRFVGVVp6RFpSRVVR"
  Link: "https://docs.qq.com/form/page/DRFVGVVp6RFpSRVVR"

  # 是否启用反馈功能
  # Whether feedback functionality is enabled
  #
  # 默认值 / Default: "true"
  # 可选值 / Optional: "true", "false"
  Enabled: "true"

# ---------------------------------------------------------------------------
# 提示词配置 / Prompts Configuration
# ---------------------------------------------------------------------------
# 多语言提示词文件管理系统设置
# Settings for multilingual prompt file management system
#
# 注意：这是可选配置。如果需要自定义提示词，可以配置此部分。
# Note: This is optional configuration. Configure this section if you need custom prompts.
# ---------------------------------------------------------------------------
Prompts:
  # 提示词文件的根路径（相对于 Web 项目根目录）
  # Root path for prompt files (relative to Web project root)
  #
  # 默认值 / Default: "Resources/Prompts"
  RootPath: "Resources/Prompts"

  # 默认语言区域（用于回退）
  # Default language locale for fallback
  #
  # 默认值 / Default: "en-US"
  # 可选值 / Optional: "zh-CN", "en-US", etc.
  DefaultLocale: "en-US"

  # 是否启用运行时提示词热重载（需要管理员 API）
  # Enable runtime hot reload of prompts (requires admin API)
  #
  # 默认值 / Default: false
  # 可选值 / Optional: true, false
  EnableHotReload: false

  # 严格模式（如果提示词文件缺失或无效，启动将失败）
  # In strict mode, startup fails if prompt files are missing or invalid
  #
  # 默认值 / Default: false
  # 可选值 / Optional: true, false
  StrictMode: false

  # 是否启用提示词内存缓存
  # Enable in-memory caching of prompts
  #
  # 默认值 / Default: true
  # 可选值 / Optional: true, false
  EnableCache: true

  # 支持的语言区域列表
  # List of supported language locales
  #
  # 默认值 / Default: ["zh-CN", "en-US"]
  SupportedLocales:
    - "zh-CN"
    - "en-US"

  # 提示词完整性验证模式
  # Prompt completeness validation mode
  #
  # 默认值 / Default: "Lenient"
  # 可选值 / Optional:
  #   - "Lenient": 仅警告/warnings only
  #   - "Strict": 抛出异常/throws exception
  ValidationMode: "Lenient"

  # 是否启用占位符完整性验证（启动时）
  # Enable placeholder completeness validation at startup
  #
  # 默认值 / Default: true
  # 可选值 / Optional: true, false
  EnableCompletenessValidation: true

# ============================================================================
# 报告配置 / Reports Configuration
# ============================================================================
# 配置报告生成和缓存
# Configure report generation and caching
#
# 注意：这是可选配置。如果不需要报告功能，可以省略此部分。
# Note: This is optional configuration. If report features are not needed, you can omit this section.
# ============================================================================
Reports:
  # 缓存生存时间（秒）
  # Cache time-to-live in seconds
  #
  # 默认值 / Default: 86400 (24 小时/24 hours)
  CacheTtlSeconds: 86400

  # 是否启用缓存
  # Whether to enable cache
  #
  # 默认值 / Default: true
  # 可选值 / Optional: true, false
  EnableCache: true

  # 效率权重 / Efficiency weights
  EfficiencyWeights:
    # 会话权重 / Session weight
    #
    # 默认值 / Default: 10
    SessionWeight: 10

    # 回合权重 / Round weight
    #
    # 默认值 / Default: 1
    RoundWeight: 1

    # 工具调用权重 / Tool call weight
    #
    # 默认值 / Default: 5
    ToolCallWeight: 5

    # 代码块权重 / Code block weight
    #
    # 默认值 / Default: 3
    CodeBlockWeight: 3

    # 高活跃度乘数 / High activity multiplier
    #
    # 默认值 / Default: 1.2
    HighActivityMultiplier: 1.2

    # 中等活跃度乘数 / Medium activity multiplier
    #
    # 默认值 / Default: 1.0
    MediumActivityMultiplier: 1.0

    # 低活跃度乘数 / Low activity multiplier
    #
    # 默认值 / Default: 0.8
    LowActivityMultiplier: 0.8

    # 归一化除数 / Normalization divisor
    #
    # 默认值 / Default: 100
    NormalizationDivisor: 100

# ============================================================================
# GitHub OAuth 配置 / GitHub OAuth Configuration
# ============================================================================
# 配置 GitHub OAuth 登录
# Configure GitHub OAuth login
#
# 注意：这是可选配置。如果不需要 GitHub 登录，可以省略此部分。
# Note: This is optional configuration. If GitHub login is not needed, you can omit this section.
#
# 获取 GitHub OAuth 凭据：
# To get GitHub OAuth credentials:
# 1. 访问 https://github.com/settings/developers
#    Visit https://github.com/settings/developers
# 2. 创建一个新的 OAuth App
#    Create a new OAuth App
# 3. 设置授权回调 URL: http://your-domain:port/signin-github
#    Set Authorization callback URL: http://your-domain:port/signin-github
# ============================================================================
#GitHub:
#  # GitHub OAuth 应用客户端 ID
#  # GitHub OAuth application client ID
#  #
#  # 环境变量 / Environment Variable: GitHub__ClientId
#  ClientId: "your_github_client_id_here"
#
#  # GitHub OAuth 应用客户端密钥
#  # GitHub OAuth application client secret
#  #
#  # 注意 / Note: 生产环境应通过环境变量配置
#  #       In production, configure via environment variable
#  # 环境变量 / Environment Variable: GitHub__ClientSecret
#  ClientSecret: "your_github_client_secret_here"

# ============================================================================
# 配置文件使用说明 / Configuration File Usage Instructions
# ============================================================================
#
# 如何使用此配置文件 / How to use this configuration file:
#
# 1. 复制此文件 / Copy this file:
#    cp appsettings.Local.example.yml appsettings.Local.yml
#
# 2. 编辑配置 / Edit configuration:
#    - 取消注释您需要的配置项
#      Uncomment the configuration items you need
#    - 修改配置值以适应您的环境
#      Modify configuration values to suit your environment
#    - 删除不需要的配置项（可选）
#      Remove unneeded configuration items (optional)
#
# 3. 配置文件位置 / Configuration file location:
#    将 appsettings.Local.yml 放在与 appsettings.yml 相同的目录
#    Place appsettings.Local.yml in the same directory as appsettings.yml
#    通常为 /src/PCode.Web/appsettings.Local.yml
#    Typically at /src/PCode.Web/appsettings.Local.yml
#
# 4. 重启应用程序 / Restart the application:
#    配置将在下次启动时自动加载
#    Configuration will be automatically loaded on next startup
#
# 环境变量配置 / Environment Variable Configuration:
#
# 所有配置项都可以通过环境变量覆盖，命名规则为：
# All configuration items can be overridden via environment variables, naming convention:
# - 使用双下划线 __ 替代 YAML 层级结构
#   Use double underscore __ to replace YAML hierarchy
# - 示例 / Example: Database__Provider, AI__DefaultProvider
#
# 常用环境变量 / Common Environment Variables:
# - Database__Provider: 数据库提供商 / Database provider ("sqlite" or "postgresql")
# - ConnectionStrings__Default: 数据库连接字符串 / Database connection string
# - AI__DefaultProvider: 默认 AI 提供商 / Default AI provider
# - HAGICODE_DATA_DIR: 数据目录 / Data directory
# - ASPNETCORE_URLS: 服务器 URL / Server URLs
# - APPLICATIONINSIGHTS_CONNECTION_STRING: Application Insights 连接字符串 / Connection string
#
# 生产环境最佳实践 / Production Best Practices:
#
# 1. 敏感信息 / Sensitive Information:
#    - 使用环境变量配置 API 密钥、密码等敏感信息
#      Use environment variables for API keys, passwords, and other sensitive information
#    - 不要将敏感信息提交到版本控制系统
#      Do not commit sensitive information to version control
#    - 将 appsettings.Local.yml 添加到 .gitignore
#      Add appsettings.Local.yml to .gitignore
#
# 2. 数据库选择 / Database Selection:
#    - 开发/单机部署：使用 SQLite（默认配置）
#      Development/single-machine: Use SQLite (default configuration)
#    - 生产/多用户：使用 PostgreSQL
#      Production/multi-user: Use PostgreSQL
#
# 3. 监控和日志 / Monitoring and Logging:
#    - 生产环境建议启用 Application Insights
#      Enable Application Insights in production
#    - 考虑配置日志聚合服务
#      Consider configuring log aggregation services
#
# 4. 安全性 / Security:
#    - 使用反向代理（Nginx/IIS）保护应用
#      Use reverse proxy (Nginx/IIS) to protect the application
#    - 配置 HTTPS 和 SSL 证书
#      Configure HTTPS and SSL certificates
#    - 限制 AllowedHosts 为特定域名
#      Limit AllowedHosts to specific domain names
#
# 5. 备份策略 / Backup Strategy:
#    - 定期备份 DataDir 目录中的所有数据
#      Regularly backup all data in the DataDir directory
#    - 包括数据库文件和 Orleans grain storage
#      Include database files and Orleans grain storage
#
# 故障排除 / Troubleshooting:
#
# 1. 应用无法启动 / Application won't start:
#    - 检查 YAML 语法是否正确（使用在线 YAML 验证器）
#      Check YAML syntax (use online YAML validator)
#    - 确认配置键名与 appsettings.yml 一致
#      Ensure configuration keys match appsettings.yml
#    - 查看应用程序日志获取详细错误信息
#      Check application logs for detailed error messages
#
# 2. 数据库连接失败 / Database connection fails:
#    - 检查 ConnectionStrings:Default 是否正确
#      Check ConnectionStrings:Default is correct
#    - 确认 Database:Provider 设置与连接字符串匹配
#      Ensure Database:Provider matches the connection string
#    - 验证数据库服务正在运行（PostgreSQL）
#      Verify database service is running (PostgreSQL)
#    - 检查数据目录权限
#      Check data directory permissions
#
# 3. AI 提供商不工作 / AI provider not working:
#    - 验证 ExecutablePath 指向有效的可执行文件
#      Verify ExecutablePath points to valid executable
#    - 检查可执行文件是否在系统 PATH 中
#      Check if executable is in system PATH
#    - 确认 AI 提供商已正确安装和配置
#      Ensure AI provider is properly installed and configured
#    - 查看 AI 会话日志获取错误详情
#      Check AI session logs for error details
#
# 4. 配置未生效 / Configuration not taking effect:
#    - 确认文件名是 appsettings.Local.yml（不是 .example）
#      Ensure filename is appsettings.Local.yml (not .example)
#    - 验证文件位置正确（与 appsettings.yml 同目录）
#      Verify file location is correct (same directory as appsettings.yml)
#    - 检查配置优先级（环境变量优先级更高）
#      Check configuration priority (environment variables have higher priority)
#    - 重启应用程序以加载新配置
#      Restart application to load new configuration
#
# 支持和帮助 / Support and Help:
#
# - 文档 / Documentation: 查看 HagiCode 项目文档 / Check HagiCode project documentation
# - 问题报告 / Issue Reporting: 在 GitHub 上提交问题 / Submit issues on GitHub
# - 配置示例 / Configuration Examples: 参考本文件的注释部分 / Refer to comments in this file
#
# ============================================================================
