# AppSettings schema endpoint is deprecated.
# Environment manifest endpoint: /api/schema/environment-manifest
# Application Logging Configuration
Logging:
  LogLevel:
    Default: Information
    Microsoft.AspNetCore: Warning

# Serilog Structured Logging Configuration
# Note: Serilog is configured programmatically in Program.cs with environment-adaptive settings.
# This section is provided for reference and potential future configuration-based setup.
#
# Environment-Adaptive Behavior:
# - Development (non-container): Console + File dual output for debugging
# - Production (non-container): File only for persistent logging
# - Container (any environment): Compact JSON Lines to stdout for log aggregation
#
# Container Detection (automatically performed in Program.cs):
# - Primary: Checks for /.dockerenv file (Docker-specific)
# - Fallback: Analyzes /proc/1/cgroup for docker/containerd/kubepods strings
# - Default: Non-container mode if detection fails
#
Serilog:
  # Minimum log level (can be overridden in environment-specific files)
  MinimumLevel:
    Default: Debug
    # Log level overrides for specific namespaces
    Override:
      Microsoft.EntityFrameworkCore: Warning
      Microsoft: Warning
      System: Warning
      Volo: Warning
      Orleans: Warning
      PCode.Orleans.Storage: Warning
      PCode.ClaudeHelper.AcpImp: Warning

# ============================================================================
# Server URL Configuration
# ============================================================================
# Option 1: Kestrel Endpoints (Recommended for production)
# Uncomment and configure Kestrel:Endpoints for production deployments
# This provides full control over HTTPS, certificates, and multiple endpoints.
#
# Kestrel:
#   Endpoints:
#     # HTTP endpoint
#     Http:
#       Url: "http://0.0.0.0:5000"
#
#     # HTTPS endpoint with development certificate
#     Https:
#       Url: "https://0.0.0.0:5001"
#       Certificate:
#         Subject: "localhost"
#         Store: "My"
#         StoreLocation: "LocalMachine"
#         AllowInvalid: true
#
#     # HTTPS endpoint with specific certificate file (pfx)
#     # HttpsPfx:
#     #   Url: "https://example.com:443"
#     #   Certificate:
#     #     Path: "/path/to/certificate.pfx"
#     #     Password: "your-password"
#
#     # IPv6 endpoint example
#     # HttpIPv6:
#     #   Url: "http://[::]:5000"
#
#     # Specific IP binding example
#     # HttpSpecificIP:
#     #   Url: "http://192.168.1.100:5000"

# Option 2: Simple URLs configuration (Fallback)
# Semicolon-separated list of URLs for HTTP and HTTPS endpoints.
# This is simpler but doesn't support certificate configuration.

# Option 3: Environment Variable (Alternative)
# Set ASPNETCORE_URLS environment variable to override configuration.
# Example: ASPNETCORE_URLS="http://0.0.0.0:5000;https://0.0.0.0:5001"

# Configuration Priority:
# 1. Kestrel:Endpoints (highest priority)
# 2. Urls configuration
# 3. ASPNETCORE_URLS environment variable
# 4. Default: http://localhost:5000

# Migration Guide:
# To migrate from Urls to Kestrel:Endpoints:
# 1. Uncomment Kestrel:Endpoints section above
# 2. Copy your URLs from the Urls key to individual endpoint entries
# 3. Add certificate configuration for HTTPS endpoints
# 4. Comment out or remove the Urls key
# ============================================================================

# Allowed hosts for the application
AllowedHosts: "*"

# ============================================================================
# Remote Deployment Configuration Examples
# ============================================================================
# The application now supports remote deployment without address restrictions.
# To enable remote access, use one of the following methods:
#
# 1. Override Urls in appsettings.Production.yml:
#    Urls: "http://0.0.0.0:35167"
#
# 2. Use Kestrel:Endpoints for more control:
#    Kestrel:
#      Endpoints:
#        Http:
#          Url: "http://0.0.0.0:35167"
#
# 3. Use environment variable:
#    export ASPNETCORE_URLS="http://0.0.0.0:35167"
#
# SECURITY RECOMMENDATION:
# In production, use a reverse proxy (Nginx/IIS) in front of this application
# for proper access control, SSL termination, and security hardening.
# Do not expose the application directly to the internet without protection.
# ============================================================================

# Startup Banner Configuration
StartupBanner:
  Enabled: true               # Whether to display the startup banner
  CheckEnvironment: true      # Whether to check environment dependencies
  ShowOrleansInfo: true       # Whether to display Orleans Silo information
  StrictMode: false           # If true, application will not start if required tools are missing

App:
  DocumentSubjectThemes:
    DefaultThemeId: "agents"
    Themes:
      - Id: "agents"
        DisplayNameKey: "documentSubjectThemes.themes.agents.displayName"
        DescriptionKey: "documentSubjectThemes.themes.agents.description"
        SortOrder: 10
        Enabled: true
        PreviewSlotKeys:
          - "workspaceTitle"
          - "agentPlural"
          - "jobPlural"
          - "historyLabel"
          - "fallbackTeamLabel"
      - Id: "fantasy-adventure"
        DisplayNameKey: "documentSubjectThemes.themes.fantasy-adventure.displayName"
        DescriptionKey: "documentSubjectThemes.themes.fantasy-adventure.description"
        SortOrder: 20
        Enabled: true
        PreviewSlotKeys:
          - "workspaceTitle"
          - "agentPlural"
          - "jobPlural"
          - "historyLabel"
          - "fallbackTeamLabel"
      - Id: "cattle-ranching"
        DisplayNameKey: "documentSubjectThemes.themes.cattle-ranching.displayName"
        DescriptionKey: "documentSubjectThemes.themes.cattle-ranching.description"
        SortOrder: 30
        Enabled: true
        PreviewSlotKeys:
          - "workspaceTitle"
          - "agentPlural"
          - "jobPlural"
          - "historyLabel"
          - "fallbackTeamLabel"
  HeroSettings:
    PrimaryProfessions:
      - Id: "profession-claude-code"
        Name: "Claude Code"
        Family: "claude"
        Summary: "hero.professionCopy.primary.claudeCode.summary"
        Icon: "executor-avatar:Claude"
        SourceLabel: "hero.professionCopy.sources.aiProvidersClaudeCodeCli"
        ProviderType: "ClaudeCodeCli"
        SortOrder: 10
        DefaultEnabled: true
        DefaultParameters:
          binary: "claude"
          thinkingMode: "balanced"
          timeoutSeconds: "7200"
      - Id: "profession-codex"
        Name: "Codex"
        Family: "codex"
        Summary: "hero.professionCopy.primary.codex.summary"
        Icon: "executor-avatar:Codex"
        SourceLabel: "hero.professionCopy.sources.aiProvidersCodexCli"
        ProviderType: "CodexCli"
        SortOrder: 20
        DefaultEnabled: true
        DefaultParameters:
          binary: "codex"
          sandboxMode: "danger-full-access"
          modelReasoningEffort: "high"
          networkAccessEnabled: "true"
      - Id: "profession-github-copilot"
        Name: "GitHub Copilot"
        Family: "copilot"
        Summary: "hero.professionCopy.primary.githubCopilot.summary"
        Icon: "executor-avatar:Copilot"
        SourceLabel: "hero.professionCopy.sources.aiProvidersGitHubCopilot"
        ProviderType: "GitHubCopilot"
        SortOrder: 30
        DefaultEnabled: true
        DefaultParameters:
          binary: "copilot"
          mode: "agent"
          noAskUser: "true"
          timeout: "7200"
      - Id: "profession-opencode"
        Name: "OpenCode"
        Family: "opencode"
        Summary: "hero.professionCopy.primary.opencode.summary"
        Icon: "executor-avatar:OpenCode"
        SourceLabel: "hero.professionCopy.sources.aiProvidersOpenCodeCli"
        ProviderType: "OpenCodeCli"
        SortOrder: 35
        DefaultEnabled: true
        IsBeta: false
        DefaultParameters:
          binary: "opencode"
          executionMode: "live"
          startupTimeoutSeconds: "15"
      - Id: "profession-hermes"
        Name: "Hermes"
        Family: "hermes"
        Summary: "hero.professionCopy.primary.hermes.summary"
        Icon: "executor-avatar:Hermes"
        SourceLabel: "hero.professionCopy.sources.aiProvidersHermesCli"
        ProviderType: "HermesCli"
        SortOrder: 40
        DefaultEnabled: true
        IsBeta: false
        DefaultParameters:
          binary: "hermes"
          arguments: "acp"
          startupTimeoutMs: "5000"
          modeId: "analysis"
      - Id: "profession-iflow"
        Name: "IFlow"
        Family: "iflow"
        Summary: "hero.professionCopy.primary.iflow.summary"
        Icon: "workflow"
        SourceLabel: "hero.professionCopy.sources.aiProvidersIFlowCli"
        ProviderType: "IFlowCli"
        SortOrder: 50
        DefaultEnabled: true
        IsBeta: false
        DefaultParameters:
          binary: "iflow"
          arguments: "--experimental-acp --port {port}"
          startupTimeoutMs: "5000"
          timeoutSeconds: "7200"
      - Id: "profession-codebuddy"
        Name: "Codebuddy"
        Family: "codebuddy"
        Summary: "hero.professionCopy.primary.codebuddy.summary"
        Icon: "bot"
        SourceLabel: "hero.professionCopy.sources.aiProvidersCodebuddyCli"
        ProviderType: "CodebuddyCli"
        SortOrder: 60
        DefaultEnabled: true
        IsBeta: false
        DefaultParameters:
          binary: "codebuddy"
          bootstrapArguments: "--acp"
          startupTimeoutMs: "5000"
    SecondaryProfessions:
      # OpenCode intentionally has no built-in secondary professions because its model
      # identifiers must be entered by users in provider/model format.
      - Id: "secondary-gpt-5-4"
        Name: "GPT 5.4"
        Family: "gpt"
        Summary: "hero.professionCopy.secondary.gpt54.summary"
        SourceLabel: "hero.professionCopy.sources.aiProvidersCodexCliModel"
        SortOrder: 10
        CompatiblePrimaryFamilies:
          - "codex"
          - "copilot"
          - "hermes"
        DefaultParameters:
          model: "gpt-5.4"
          reasoning: "high"
      - Id: "secondary-gpt-5-3-codex"
        Name: "GPT 5.3 Codex"
        Family: "gpt"
        Summary: "hero.professionCopy.secondary.gpt53Codex.summary"
        SourceLabel: "hero.professionCopy.sources.aiCodex"
        SortOrder: 20
        CompatiblePrimaryFamilies:
          - "codex"
          - "copilot"
          - "hermes"
        DefaultParameters:
          model: "gpt-5.3-codex"
          reasoning: "high"
      - Id: "secondary-gpt-5-2-codex"
        Name: "GPT 5.2 Codex"
        Family: "gpt"
        Summary: "hero.professionCopy.secondary.gpt52Codex.summary"
        SourceLabel: "hero.professionCopy.sources.aiCodex"
        SortOrder: 20
        CompatiblePrimaryFamilies:
          - "codex"
          - "copilot"
          - "hermes"
        DefaultParameters:
          model: "gpt-5.2-codex"
          reasoning: "high"
      - Id: "secondary-gpt-5-mini"
        Name: "GPT 5 Mini"
        Family: "gpt"
        Summary: "hero.professionCopy.secondary.gpt5Mini.summary"
        SourceLabel: "hero.professionCopy.sources.aiProvidersGitHubCopilotModel"
        SortOrder: 30
        CompatiblePrimaryFamilies:
          - "codex"
          - "copilot"
          - "hermes"
        DefaultParameters:
          model: "gpt-5-mini"
          reasoning: "medium"
      - Id: "secondary-claude-4-sonnet"
        Name: "Claude 4 Sonnet"
        Family: "anthropic"
        Summary: "hero.professionCopy.secondary.claude4Sonnet.summary"
        SourceLabel: "hero.professionCopy.sources.aiProvidersClaudeCodeCliModel"
        SortOrder: 40
        CompatiblePrimaryFamilies:
          - "claude"
          - "iflow"
          - "codebuddy"
          - "hermes"
        # Keep the stable template ID while moving the shared default model to Claude 4.6.
        DefaultParameters:
          model: "anthropic/claude-sonnet-4-6"
          reasoning: "high"
      - Id: "secondary-claude-opus-4"
        Name: "Claude 4 Sonnet"
        Family: "anthropic"
        Summary: "hero.professionCopy.secondary.claude4Opus.summary"
        SourceLabel: "hero.professionCopy.sources.aiProvidersClaudeCodeCliModel"
        SortOrder: 40
        CompatiblePrimaryFamilies:
          - "claude"
          - "iflow"
          - "codebuddy"
          - "hermes"
        DefaultParameters:
          model: "anthropic/claude-opus-4-6"
          reasoning: "high"
      - Id: "secondary-glm-4-7"
        Name: "GLM 4.7"
        Family: "anthropic"
        Summary: "hero.professionCopy.secondary.glm47.summary"
        SourceLabel: "hero.professionCopy.sources.aiSharedAnthropicModel"
        SortOrder: 60
        CompatiblePrimaryFamilies:
          - "claude"
          - "iflow"
          - "codebuddy"
          - "hermes"
        DefaultParameters:
          model: "glm-4.7"
          reasoning: "high"
      # GLM 5, GLM 5 Turbo, and GLM 5.0 are three different secondary professions.
      # Hermes continues to receive the shared GPT + anthropic coverage.
      - Id: "secondary-glm-5"
        Name: "GLM 5"
        Family: "anthropic"
        Summary: "hero.professionCopy.secondary.glm5.summary"
        SourceLabel: "hero.professionCopy.sources.aiSharedAnthropicModel"
        SortOrder: 60
        CompatiblePrimaryFamilies:
          - "claude"
          - "iflow"
          - "codebuddy"
          - "hermes"
        DefaultParameters:
          model: "glm-5"
          reasoning: "high"
      - Id: "secondary-glm-5-turbo"
        Name: "GLM 5 Turbo"
        Family: "anthropic"
        Summary: "hero.professionCopy.secondary.glm5Turbo.summary"
        SourceLabel: "hero.professionCopy.sources.aiSharedAnthropicModel"
        SortOrder: 60
        CompatiblePrimaryFamilies:
          - "claude"
          - "iflow"
          - "codebuddy"
          - "hermes"
        DefaultParameters:
          model: "glm-5-turbo"
          reasoning: "high"
      - Id: "secondary-glm-5-codebuddy"
        Name: "GLM 5.0"
        Family: "anthropic"
        Summary: "hero.professionCopy.secondary.glm50.summary"
        SourceLabel: "hero.professionCopy.sources.aiProvidersCodebuddyCliModel"
        SortOrder: 61
        CompatiblePrimaryFamilies:
          - "claude"
          - "iflow"
          - "codebuddy"
          - "hermes"
        DefaultParameters:
          model: "glm-5.0"
          reasoning: "high"
      - Id: "secondary-minimax-m2-7"
        Name: "Minimax M2.7"
        Family: "anthropic"
        Summary: "hero.professionCopy.secondary.minimaxM27.summary"
        SourceLabel: "hero.professionCopy.sources.aiSharedAnthropicModel"
        SortOrder: 70
        CompatiblePrimaryFamilies:
          - "claude"
          - "iflow"
          - "codebuddy"
          - "hermes"
        DefaultParameters:
          model: "minimax-m2.7"
          reasoning: "medium"
      - Id: "secondary-minimax-m2-7-high-speed"
        Name: "Minimax M2.7 High Speed"
        Family: "anthropic"
        Summary: "hero.professionCopy.secondary.minimaxM27HighSpeed.summary"
        SourceLabel: "hero.professionCopy.sources.aiSharedAnthropicModel"
        SortOrder: 71
        CompatiblePrimaryFamilies:
          - "claude"
          - "iflow"
          - "codebuddy"
          - "hermes"
        DefaultParameters:
          model: "minimax-m2.7-high-speed"
          reasoning: "medium"
      - Id: "secondary-minimax-m2-5"
        Name: "Minimax M2.5"
        Family: "anthropic"
        Summary: "hero.professionCopy.secondary.minimaxM25.summary"
        SourceLabel: "hero.professionCopy.sources.aiSharedAnthropicModel"
        SortOrder: 72
        CompatiblePrimaryFamilies:
          - "claude"
          - "iflow"
          - "codebuddy"
          - "hermes"
        DefaultParameters:
          model: "minimax-m2.5"
          reasoning: "medium"

# ============================================================================
# Data Directory Configuration
# ============================================================================
# All application data (SQLite databases, logs, etc.) should be stored
# in a dedicated data directory for easier management and backup.
#
# Default data directory paths:
# - Linux/macOS: ./data or /var/pcode/data
# - Windows: .\data or C:\ProgramData\PCode\data
#
# For Docker deployment, mount this directory to a volume:
#   volumes:
#     - pcode_data:/app/data
#
# For production, consider using environment variable:
#   export DATADIR=/var/pcode/data
#
# This directory is used by all SQLite databases:
# - Main database: {DataDir}/hagicode.db
# - Debug database: {DataDir}/debug.db
# - Orleans storage: {DataDir}/orleans/grains.db
# - Session message shards: {DataDir}/messages/*.db
# ============================================================================

# Application Data Directory
# Base directory for all application data files
# Environment variable: DATADIR
DataDir: "./data"

# Database Connection Strings
# For SQLite (default): ConnectionStrings:Default is optional
# - If not set, it will be automatically generated as: {DataDir}/hagicode.db
# - For PostgreSQL, this must be explicitly configured
ConnectionStrings:
# Default connection string - format depends on Database:Provider
#
# For SQLite (default):
#   Default: "Data Source=./data/hagicode.db"
#   If omitted, automatically uses: {DataDir}/hagicode.db
#
# For PostgreSQL:
#   Default: "Host=localhost;Port=35439;Database=hagicode;Username=postgres;Password=postgres"
#   Or use environment variable: ${DATABASE_URL}
#  Default: "Data Source=./data/hagicode.db"

# ============================================================================
# Database Configuration
# ============================================================================
# HagiCode supports two database providers:
#
# 1. 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
#    - 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
#    - Setup: Configure ConnectionStrings:Default below
#
# To switch to PostgreSQL, set Provider to "postgresql" explicitly:
#   - In appsettings.Production.yml: Provider: "postgresql"
#   - Via environment variable: export Database__Provider=postgresql
# ============================================================================

Database:
  # Database provider: "sqlite" (default) or "postgresql"
  # Environment variable override: Database__Provider
  Provider: "sqlite"

  # Whether to automatically apply database migrations on application startup
  AutoMigrateDatabase: true

  # Whether to automatically run DbUp SQL script migrations on application startup
  AutoRunDbUpMigrations: true

  # Whether to seed data after migration
  AutoSeedData: true

  # Timeout for database operations in seconds
  MigrationTimeoutSeconds: 300

# Orleans Cluster Configuration
Orleans:
  ClusterId: "pcode-cluster"
  ServiceId: "pcode-service"
  # BREAKING: Orleans grain storage now uses a sharded SQLite layout.
  # By default, 100 shard databases are created under {DataDir}/orleans/grains.
  # Set ShardRootPath to override the shard directory.
  #  ShardRootPath: "./data/orleans/grains"
  ShardCount: 100
  UseWalMode: true
  BusyTimeoutMs: 5000
  InitializationMaxConcurrency: 8

# Claude Code Integration Settings
ClaudeCode:
  ExecutablePath: claude
  WorkspacePath: /tmp/claude-workspaces
  TimeoutSeconds: 7200
  EnableStreaming: true

# AI Provider Configuration
# Configure CLI-based AI providers with their specific settings
# Note: Supported providers include ClaudeCodeCli, CodebuddyCli, GitHubCopilot, CodexCli, HermesCli, IFlowCli
AI:

  # AI Service Settings
  Service:
    # Timeout for non-session AI grain calls such as proposal naming and description optimization.
    # Keep this aligned with the 2-hour Orleans grain timeout contract.
    RequestTimeoutSeconds: 7200
    # Whether to automatically inject language preference into prompts that don't contain language instructions
    AutoInjectLanguagePreference: true
    # Default language preference when user hasn't set one (null: follow UI, "zh-CN", "en-US")
    DefaultLanguagePreference: "zh-CN"
    # Default executor type used by SessionGrain (ClaudeCodeCli, CodexCli, GitHubCopilot, CodebuddyCli, HermesCli, IFlowCli)
    DefaultExecutorType: "ClaudeCodeCli"

  Providers:
    Providers:
      # Claude Code CLI Provider (Default)
      ClaudeCodeCli:
        Type: "ClaudeCodeCli"
        ExecutablePath: "claude"  # Path to claude CLI executable
        WorkingDirectory: null  # Optional: override working directory
        Settings:
          TimeoutSeconds: "7200"  # CLI execution timeout in seconds; aligned with the 2-hour Orleans grain timeout

      # Codebuddy CLI Provider (ACP stdio runtime)
      CodebuddyCli:
        Type: "CodebuddyCli"
        Enabled: false
        ExecutablePath: "codebuddy"
        WorkingDirectory: null

      # IFlow CLI Provider (ACP WebSocket runtime)
      IFlowCli:
        Type: "IFlowCli"
        Enabled: false
        ExecutablePath: "iflow"
        Model: null
        WorkingDirectory: null
        Settings:
          TimeoutSeconds: "7200"

      # Hermes CLI Provider (ACP stdio runtime with dynamic auth)
      HermesCli:
        Type: "HermesCli"
        Enabled: false
        ExecutablePath: "hermes"
        Model: null
        WorkingDirectory: null
        Settings:
          TimeoutSeconds: "7200"
      
      # GitHub Copilot CLI Provider (SDK-only mode)
      GitHubCopilot:
        Type: "GitHubCopilot"
        Enabled: true  # Set to true to enable GitHub Copilot
        ExecutablePath: "copilot"  # Path to copilot CLI executable
        UseLoggedInUser: true  # Use local Copilot login state (set false to use GitHubToken)
        GitHubToken: null  # Optional token when UseLoggedInUser=false
        CliUrl: null  # Optional Copilot CLI URL override
        NoAskUser: true  # Maps to the verified --no-ask-user SDK startup flag
        Model: "gpt-5-mini"  # Model: claude-sonnet-4-6, claude-opus-4-6, gpt-5, etc.
        WorkingDirectory: null  # Optional: override working directory
        Timeout: 7200  # Request timeout in seconds; aligned with the 2-hour Orleans grain timeout
        StartupTimeout: 30  # Process startup timeout in seconds
        # Permission defaults converted to verified Copilot SDK startup arguments
        # Supported flags were checked with `copilot --help`; unsupported flags such as --headless are filtered out and the request fails instead of falling back to raw CLI prompt mode.
        Permissions:
          AllowAllTools: false  # Allow all tools (not recommended for production)
          AllowAllPaths: false  # Allow all file system paths (not recommended for production)
          AllowAllUrls: false  # Allow all URL access (not recommended for production)
          AllowedTools: [ ]  # Whitelist of allowed tool names
          AllowedPaths: [ ]  # Whitelist of allowed file system paths
          DeniedTools: [ ]  # Blacklist of denied tool names
          DeniedUrls: [ ]  # Blacklist of denied URLs
        AdditionalArgs: [ ]  # Additional startup arguments filtered against the verified Copilot CLI help surface for SDK bootstrap only
      
      # Codex CLI Provider (JSON event mode)
      CodexCli:
        Type: "CodexCli"
        Enabled: false
        ExecutablePath: "codex"
        Model: "gpt-5.4"
        WorkingDirectory: null

      # OpenCode CLI Provider (HTTP runtime mode)
      OpenCodeCli:
        Type: "OpenCodeCli"
        Enabled: true
        ExecutablePath: "opencode"
        Model: null
        WorkingDirectory: null

  # ACP session manager settings
  SessionManager:
    MaxSessions: 50
    DefaultWorkingDirectory: null

  # Platform-specific ACP runtime configuration
  PlatformConfigurations:
    CodebuddyCli:
      ExecutablePath: "codebuddy"
      Arguments: "--acp"
      StartupTimeoutMs: 5000
      EnvironmentVariables: { }
    HermesCli:
      ExecutablePath: "hermes"
      Arguments: "acp"
      ClientName: "HagiCode"
      StartupTimeoutMs: 5000
      Authentication:
        PreferredMethodId: null
        MethodInfo: { }
      SessionDefaults:
        ModeId: "analysis"
        Metadata: { }
    IFlowCli:
      ProviderName: "IFlowCli"
      ExecutablePath: "iflow"
      Arguments: "--experimental-acp --port {port}"
      AuthMethod: "iflow"
      StartupTimeoutMs: 5000
      EnvironmentVariables: { }

  # Codex provider settings
  Codex:
    Enabled: true
    ExecutablePath: "codex"
    Model: "gpt-5.4"
    SandboxMode: "danger-full-access"
    WorkingDirectory: null
    SkipGitRepoCheck: true
    ModelReasoningEffort: "high"
    NetworkAccessEnabled: true
    WebSearchMode: null
    WebSearchEnabled: true
    ApprovalPolicy: "never"
    AdditionalDirectories: [ ]
    # SessionThreadBindingDatabaseConnectionString: ""
    # 如未设置，自动使用 {DataDir}/codex.db
    RequestTimeoutSeconds: 7200
    EnvironmentVariables: { }

  # OpenCode provider settings
  OpenCode:
    Enabled: true
    ExecutablePath: "opencode"
    BaseUri: null
    ExecutionMode: "live"
    # Prefer the OpenCode runtime's default model unless a Hero/runtime override supplies one.
    Model: null
    DefaultModelProvider: "anthropic"
    WorkingDirectory: null
    Workspace: null
    SessionTitlePrefix: "PCode OpenCode"
    # SessionThreadBindingDatabaseConnectionString: ""
    # 如未设置，自动使用 {DataDir}/opencode.db
    RequestTimeoutSeconds: 180
    StartupTimeoutSeconds: 15
    LogLevel: null
    EnvironmentVariables: { }

# Session Concurrency Settings
SessionConcurrency:
  DefaultMaxConcurrentSessions: 10

# Workspace Persistence Configuration
# Configure where PCode stores temporary workspace files for coding sessions.
# By default, uses the system Temp directory. Uncomment WorkspaceRoot to use a persistent location.
Workspace:
  # WorkspaceRoot: ""  # Optional: Set to a persistent path like "/var/lib/pcode/workspaces" on Linux
  # If empty or not set, defaults to system Temp directory.
  # Can be overridden via PCODE_WORKSPACE_ROOT environment variable.
  AutoCreateDirectory: true  # Automatically create the workspace directory if it doesn't exist

# License Service Configuration
License:
  PrimaryServer:
    Endpoint: "https://api.keygen.sh"
    ApiKey: "activ-cc0493de1b3d2d3ab58e3d1115d61564v3"
    AccountId: "0bb7cd41-a70d-4dd2-a740-5e30500cf70b"
    ProductId: "2c73c847-1077-44e6-afeb-651d5e7eb005"
    TimeoutSeconds: 30
  Activation:
    AutoActivateOnStartup: true
    RequireValidLicense: true
  SignatureVerification:
    Enabled: true
    ToleranceSeconds: 300
    StrictMode: true

# Version Check Configuration
# Frontend will check for updates and display notifications when available
VersionCheck:
  Enabled: true  # Whether version checking is enabled
  GitHubRepositoryOwner: "HagiCode-org"  # GitHub repository owner
  GitHubRepositoryName: "releases"  # GitHub repository name
  CurrentVersion: null  # Optional: Override auto-detected version (e.g., "v0.1.0")
  HttpTimeoutSeconds: 30  # HTTP timeout for GitHub API requests
  MaxRetries: 3  # Maximum retry attempts for GitHub API requests
  RetryBaseDelayMs: 1000  # Base delay in milliseconds for exponential backoff

# Container First-Run Configuration
# Settings for containerized deployments with auto project discovery
Container:
  MountPath: "/app/workdir"  # Default container mount path for project discovery
  FirstRunCheckEnabled: true  # Enable first-run project discovery flow
  # Environment variable override: HAGICODE_CONTAINER__MOUNTPATH or HAGICODE_CONTAINER__FIRSTRUNCHECKENABLED

# Community Configuration
# Settings for official community entry points managed by the backend
Community:
  # Official Discord community invite link
  DiscordLink: "https://discord.gg/qY662sJK"

# Feedback Configuration
# Settings for user experience feedback collection system
Feedback:
  # User feedback form link
  Link: "https://docs.qq.com/form/page/DRFVGVVp6RFpSRVVR"

  # Whether feedback functionality is enabled
  Enabled: "true"

# RSS Feed Configuration
# Settings for RSS blog feed integration
RssFeed:
  # RSS feed URL to fetch blog posts from
  FeedUrl: "https://docs.hagicode.com/blog/rss.xml"
  # Cache duration in hours for RSS feed content
  CacheDurationHours: 24
  # Maximum number of items to return from the RSS feed
  MaxItems: 5

# Prompts Configuration
# Settings for multilingual prompt file management system
Prompts:
  RootPath: "Resources/Prompts"  # Root path for prompt files (relative to Web project root)
  DefaultLocale: "en-US"  # Default language locale for fallback
  EnableHotReload: false  # Enable runtime hot reload of prompts (requires admin API)
  StrictMode: false  # In strict mode, startup fails if prompt files are missing or invalid
  EnableCache: true  # Enable in-memory caching of prompts
  SupportedLocales: # List of supported language locales
    - "zh-CN"
    - "en-US"
  # Prompt completeness validation settings
  ValidationMode: "Lenient"  # Validation mode: "Lenient" (warnings only) or "Strict" (throws exception)
  EnableCompletenessValidation: true  # Enable placeholder completeness validation at startup
  TemplateValidationMode: "Strict"  # Template validation mode: "Lenient" or "Strict"

  # Scenario enumeration validation settings
  ValidateAllScenarios: true  # Validate all PromptScenario enum values have corresponding prompt files
  RequiredLocales: # Required locales for scenario validation
    - "zh-CN"
    - "en-US"

  # Fallback lookup for deprecated filenames (during deprecation period)
  EnableFallbackLookup: true  # Enable fallback lookup for old filename patterns during deprecation

  # Default template engine configuration
  DefaultSyntax: "handlebars"  # Default template syntax: "handlebars" or "scriban"

  # Handlebars template engine configuration
  Handlebars:
    CacheSize: 100  # Maximum number of compiled templates to cache

# Debug Database Configuration
# Stores deserialization error capture data for debugging AI message parsing failures
# If ConnectionString is omitted, automatically uses: {DataDir}/debug.db
DebugDatabase:
  # Enable or disable debug data capture
  Enabled: true

  # Database file location (relative to application root)
  # If omitted or set to default, automatically uses: {DataDir}/debug.db
  # ConnectionString: ""
  # 如未设置，自动使用 {DataDir}/debug.db

  # Automatically create schema on startup
  AutoCreateSchema: true

  # How long to keep debug records (in days)
  RetentionDays: 90

  # Maximum database file size before warning (in MB)
  MaxDatabaseSizeMB: 500

  # Write timeout for database operations (in milliseconds)
  WriteTimeout: 5000

  # Query timeout for database operations (in milliseconds)
  QueryTimeout: 30000

  # Maximum concurrent writers
  MaxConcurrentWriters: 10

  # Whether to automatically clean up old records on startup
  AutoCleanup: true

# Session Message Shard Storage Configuration
# Stores new session messages in dedicated SQLite shard databases under DataDir/messages
MessageStorage:
  # Base directory for shard database files
  # If omitted or set to default, automatically uses: {DataDir}/messages
  DirectoryPath: "./data/messages"

  # Enable WAL mode for shard databases
  UseWalMode: true

  # SQLite busy timeout in milliseconds
  BusyTimeoutMs: 5000

# Hero History Shard Storage Configuration
# Stores active hero history in dedicated SQLite shard databases under DataDir/hero-history
HeroHistoryStorage:
  # Base directory for shard database files
  # If omitted or set to default, automatically uses: {DataDir}/hero-history
  DirectoryPath: "./data/hero-history"

  # Enable WAL mode for shard databases
  UseWalMode: true

  # SQLite busy timeout in milliseconds
  BusyTimeoutMs: 5000
