# 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: "30000"
          modeId: "analysis"
      - Id: "profession-qoder"
        Name: "QoderCLI"
        Family: "qoder"
        Summary: "hero.professionCopy.primary.qoder.summary"
        Icon: "executor-avatar:Qoder"
        SourceLabel: "hero.professionCopy.sources.aiProvidersQoderCli"
        ProviderType: "QoderCli"
        SortOrder: 50
        DefaultEnabled: true
        IsBeta: false
        DefaultParameters:
          binary: "qodercli"
          arguments: ""
          startupTimeoutMs: "5000"
      - Id: "profession-kiro"
        Name: "Kiro"
        Family: "kiro"
        Summary: "hero.professionCopy.primary.kiro.summary"
        Icon: "executor-avatar:Kiro"
        SourceLabel: "hero.professionCopy.sources.aiProvidersKiroCli"
        ProviderType: "KiroCli"
        SortOrder: 55
        DefaultEnabled: true
        IsBeta: false
        DefaultParameters:
          binary: "kiro-cli"
          arguments: ""
          startupTimeoutMs: "60000"
          authMethod: ""
          authToken: ""
          bootstrapMethod: ""
      - Id: "profession-kimi"
        Name: "Kimi"
        Family: "kimi"
        Summary: "hero.professionCopy.primary.kimi.summary"
        Icon: "executor-avatar:Kimi"
        SourceLabel: "hero.professionCopy.sources.aiProvidersKimiCli"
        ProviderType: "KimiCli"
        SortOrder: 57
        DefaultEnabled: true
        IsBeta: false
        DefaultParameters:
          binary: "kimi"
          arguments: ""
          startupTimeoutMs: "15000"
          authToken: ""
          authHint: "Complete local sign-in or provide a token before refreshing."
      - Id: "profession-gemini"
        Name: "Gemini"
        Family: "gemini"
        Summary: "hero.professionCopy.primary.gemini.summary"
        Icon: "executor-avatar:Gemini"
        SourceLabel: "hero.professionCopy.sources.aiProvidersGeminiCli"
        ProviderType: "GeminiCli"
        SortOrder: 58
        DefaultEnabled: true
        IsBeta: false
        DefaultParameters:
          binary: "gemini"
          arguments: ""
          startupTimeoutMs: "15000"
          authToken: ""
          authHint: "Complete local sign-in or provide a token before refreshing."
      - 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"
# ============================================================================
# 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
  InitializationMaxConcurrency: 8
  TimeoutPolicy:
    LongRunningExecutionSeconds: 7200
    HealthCheckSeconds: 60
    DefaultSiloResponseSeconds: 30
    GrainCollectionMinutes: 30
    StorageBusyTimeoutMs: 5000
    DefaultProviderStartupTimeoutMs: 30000

# 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, QoderCli, KiroCli, KimiCli, GeminiCli
AI:

  # AI Service Settings
  Service:
    # 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, QoderCli, KiroCli, KimiCli, GeminiCli)
    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

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


      # Hermes CLI Provider (ACP stdio runtime with dynamic auth)
      HermesCli:
        Type: "HermesCli"
        Enabled: false
        ExecutablePath: "hermes"
        Model: null
        WorkingDirectory: null
      
      # GitHub Copilot CLI Provider (shared libs adapter 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 startup flag through HagiCode.Libs
        Model: "gpt-5-mini"  # Model: claude-sonnet-4-6, claude-opus-4-6, gpt-5, etc.
        WorkingDirectory: null  # Optional: override working directory
        # Permission defaults converted to verified Copilot startup arguments by HagiCode.Libs
        # Supported flags were checked with `copilot --help`; unsupported flags such as --headless are filtered out and the request fails instead of falling back to any core-local transport.
        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

      # Qoder CLI Provider (shared ACP runtime mode)
      QoderCli:
        Type: "QoderCli"
        Enabled: false
        ExecutablePath: "qodercli"
        Model: null
        WorkingDirectory: null

      # Kiro CLI Provider (shared ACP runtime mode with docs-only auth bootstrap)
      KiroCli:
        Type: "KiroCli"
        Enabled: false
        ExecutablePath: "kiro-cli"
        Model: null
        WorkingDirectory: null
        Settings:
          startupTimeoutMs: "60000"
          authMethod: ""
          authToken: ""
          bootstrapMethod: ""

      # Kimi CLI Provider (shared ACP runtime mode with docs-only/manual-auth guidance)
      KimiCli:
        Type: "KimiCli"
        Enabled: false
        ExecutablePath: "kimi"
        Model: null
        WorkingDirectory: null
        Settings:
          startupTimeoutMs: "15000"
          authMethod: null
          authToken: ""
          authHint: "Complete local sign-in or provide a token before refreshing."

      # Gemini CLI Provider (shared ACP runtime mode via upgraded HagiCode.Libs)
      GeminiCli:
        Type: "GeminiCli"
        Enabled: false
        ExecutablePath: "gemini"
        Model: null
        WorkingDirectory: null
        Settings:
          startupTimeoutMs: "15000"
          authMethod: null
          authToken: ""
          authHint: "Complete local sign-in or provide a token before refreshing."

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

  # Platform-specific ACP runtime configuration
  PlatformConfigurations:
    CodebuddyCli:
      ExecutablePath: "codebuddy"
      Arguments: "--acp"
      EnvironmentVariables: { }
    HermesCli:
      ExecutablePath: "hermes"
      Arguments: "acp"
      ClientName: "HagiCode"
      Authentication:
        PreferredMethodId: null
        MethodInfo: { }
      SessionDefaults:
        ModeId: "analysis"
        Metadata: { }
    QoderCli:
      ExecutablePath: "qodercli"
      Arguments: ""
      EnvironmentVariables: { }
    KiroCli:
      ExecutablePath: "kiro-cli"
      Arguments: ""
      StartupTimeoutMs: 60000
      AuthenticationMethod: null
      AuthenticationToken: null
      BootstrapMethod: ""
      EnvironmentVariables: { }
    KimiCli:
      ExecutablePath: "kimi"
      Arguments: ""
      StartupTimeoutMs: 15000
      AuthenticationMethod: null
      AuthenticationToken: null
      AuthenticationHint: "Complete local sign-in or provide a token before refreshing."
      EnvironmentVariables: { }
    GeminiCli:
      ExecutablePath: "gemini"
      Arguments: ""
      StartupTimeoutMs: 15000
      AuthenticationMethod: null
      AuthenticationToken: null
      AuthenticationHint: "Complete local sign-in or provide a token before refreshing."
      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
    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-session-bindings-v2.db（不会读取或迁移旧的 opencode.db）
    # 仅当 AI:OpenCode:Enabled=true 时，后端才会在 Orleans startup task 完成后异步执行 `opencode models`。
    # 如果本次刷新失败，则继续提供上一次成功快照，并通过 stale 元数据暴露该状态。
    ModelCatalogRefreshTimeoutSeconds: 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"

# 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

# Image Storage Configuration
# Stores uploaded chat images under DataDir/images by default
ImagesStorage:
  # Base directory for uploaded image files
  # If omitted or set to default, automatically uses: {DataDir}/images
  DirectoryPath: "./data/images"

# 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
