# ticket-manager configuration — example
#
# Copy this file to config.local.yaml (which is gitignored) and edit for your
# local environment, or check it in with placeholder values for production
# environments. Field names mirror the Go structs in services/ticket-manager/config.
#
# Run the service with:
#   go run ./cmd/ticket-manager --config config.local.yaml

# Logging — see packages/sdk-go/infra/config/logger.go for all options.
log:
  level: 0          # 0=normal info/error logs; 4=debug logs such as request enter/exit; 8=very verbose
  isJSON: false

# Optional: AWS Secrets Manager-backed override layer. The named secret should
# contain a YAML blob in the same shape as this file; values from it overwrite
# the values below at startup. Leave rootConfigSecretName empty to disable.
secret:
  rootConfigSecretName: ""    # e.g. "ticket-manager/root-config"
  awsASM:
    region: "us-west-2"

# MySQL connection. Required.
database:
  host: "127.0.0.1"
  port: 3306
  user: "ticket_manager"
  password: "REPLACE_ME"      # READ FROM ASM in production
  database: "ticket_manager"
  params:
    parseTime: "true"
    charset: "utf8mb4"
  logLevel: 4                 # 1=silent 2=error 3=warn 4=info
  logSlowThreshold: "200ms"

# HTTP API server.
apiServer:
  address: ":8080"


services:
  # Agent Gateway-backed Lark Bot and application-message adapter.
  agent:
    agentID: "" # Shared Agent for all flows; empty delegates selection to Gateway.
    instanceId: "ticket-manager"
    # Working directory on the host that executes the configured Agent Gateway provider.
    # Use an absolute path in deployments.
    workingDirectory: "../.."
    allowGroupChat: true
    maxMessageSize: 8000         # Unicode characters after removing mentions
    commentaryMessageMergeBuffer: 4000 # Unicode characters merged into one Commentary card
  # Engineer identities are synchronized from all available Core users.
  engineer:
    syncInterval: "5m"
    syncInitDelay: "10s"
  # Bots are separate Dispatch receivers and are not synchronized as engineers.
  dispatch:
    botEmails:
      - "jira-service-account@example.com"
    # Dispatch triage optionally overrides the shared Agent's model.
    triage:
      agentModel: "" # Empty uses the selected Agent's default model.
    # Recovers newly-created Jira tickets that still have an auto-assignment
    # label but do not have the corresponding assignee. projectKeys is required
    # when the recovery is enabled.
    stalledAutoAssignmentRecovery:
      enabled: false
      projectKeys:
        - "TCID"
      interval: "5m"
      lookback: "24h"
      minAge: "5m"
      maxRetries: 3
      pageSize: 50
      maxIssuesPerRun: 200
  collaboration:
    watchResourceGrantInterval: "5m"
  workspace:
    syncCaseWorkspaceInterval: "5m"
    syncOverviewMessageInterval: "5m"
    archiveCaseWorkspaceInterval: "1h"
    archiveCaseWorkspaceRecoveryThreshold: "168h"
    # TaskAdvisor watches workspace Lark messages and creates add-task advice.
    taskAdvisor:
      addTask:
        agentModel: "" # Empty uses the selected Agent's default model.
        enabled: true
        triggerThreshold: 4
      bindLarkMeeting:
        enabled: true
      bindLarkDoc:
        enabled: true
    # Timeline polls firing workspaces and appends deduplicated workspace
    # events from bound Jira issues, alert issues, tasks, DevOps operations,
    # and config changes.
    timeline:
      agentModel: "" # Empty uses the selected Agent's default model.
      agentTimeout: "2m" # total submission + queue + execution wait
      enabled: true
      watchInterval: "2m"
      syncWarRoomInterval: "5m"
      syncCaseWorkspaceInterval: "20m"
      # Opt-in: when enabled, new timeline evidence is grouped by the Agent
      # model into concise AI draft entries. If the model call fails, the
      # service falls back to deterministic rule drafts.
      aiDraftsEnabled: false
      aiEvidenceLimit: 40
      # Opt-in Lark chat evidence ingestion. The event callback only persists
      # evidence and wakes the worker; the periodic watcher remains the
      # correctness fallback. Empty 10-minute windows create no state rows.
      lark:
        enabled: false
        eventIngestionEnabled: false
        reconciliationEnabled: false
        ingestionLookback: "72h"

# External clients.
clients:
  agentGateway:
    address: "agent-gateway:9090"
    timeout: "5s"
  oncall:
    addr: "http://127.0.0.1:8081"
    apiKey: "REPLACE_ME" # READ FROM ASM; /api/v1/page requires oncall:read + oncall:write scopes
    timeout: "5s"
    debug: false
  jira:
    dummy: false              # set true to short-circuit Jira calls in dev
    url: "https://your-org.atlassian.net"
    username: "jira-bot@example.com"
    password: "REPLACE_ME"    # READ FROM ASM in production

  lark:
    appCode: "cli_REPLACE_ME"
    appSecret: "REPLACE_ME"           # READ FROM ASM
    encryptKey: "REPLACE_ME"          # READ FROM ASM
    verificationToken: "REPLACE_ME"   # READ FROM ASM

  # Core Server RPC client. Use the core-server rpcServer address.
  core:
    addr: "127.0.0.1:9090"

  # DevOps API is used by the timeline evidence collector.
  devops:
    apiToken: "REPLACE_ME"    # READ FROM ASM in production
    baseUrl: "https://prod.devops.pingcap.com"
    frontendUrl: "https://ops.tidbcloud.com"
    timeout: "30s"
