# Agent Gateway configuration example.
# Copy this file to config.local.yaml and replace local paths and credentials.

log:
  level: 0
  isJSON: false
  disableStacktrace: false
  disableCaller: false

# When rootConfigSecretName is set, the Secret must contain YAML with the same
# shape as this file. Values loaded from the Secret override this file.
secret:
  rootConfigSecretName: ""
  awsASM:
    region: "us-west-2"

database:
  host: "127.0.0.1"
  port: 3306
  user: "agent_gateway"
  password: "REPLACE_ME"
  database: "agent_gateway"
  params:
    parseTime: "true"
    charset: "utf8mb4"
  dailTimeout: "60s"
  readTimeout: "30s"
  writeTimeout: "30s"
  connMaxLifetime: "3m"
  maxIdleConns: 10
  maxOpenConns: 20
  logLevel: 4
  logSlowThreshold: "200ms"
  traceQuerySQL: false

# Plaintext gRPC endpoint used by Ticket Manager and other generated clients.
rpcServer:
  address: ":9090"

# REST/JSON gateway. rpcAddress must reach rpcServer.address from this process.
rpcGatewayServer:
  address: ":8080"
  rpcAddress: ":9090"

clients:
  core:
    address: "core-server:9090"

gateway:
  eventListeners:
    ticket-manager:
      sources:
        - type: "lark"
          # Must equal Ticket Manager services.agent.instanceId.
          instanceID: "ticket-manager"
        - type: "application"
          # Must equal Ticket Manager services.agent.instanceId.
          instanceID: "ticket-manager"
      # Ticket Manager owns Lark delivery and application event routing.
      endpoint: "http://ticket-manager:8080/api/v1/ticketmanager/agent-gateway/events"
      timeout: "5s"

agentRuntime:
  # Must match one of the keys under agents.
  defaultAgent: "codex"
  agents:
    codex:
      provider: "codex_cli"
      codexCLI:
        binary: "codex"
        home: "~"
        codexHome: "~/.codex"
        timeout: "10m"
        # Empty uses the Codex default model.
        model: ""
        sandboxMode: "workspace-write"
        # Agent Gateway has no interactive approval forwarding channel.
        approvalPolicy: "never"
      # Optional. Agents without this block do not support Project management.
      sidecar:
        endpoint: "agent-codex:9091"
        timeout: "10s"

    # Alternative provider. Uncomment only when the app-server is already
    # running and its socket or WebSocket endpoint is reachable.
    # codex-app-server:
    #   provider: "codex_app_server"
    #   codexAppServer:
    #     endpoint: "unix://~/.codex/app-server.sock"
    #     # Required for ws:// endpoints. Supply it from the root config Secret.
    #     token: ""
    #     timeout: "10m"
    #     model: ""
    #     sandboxMode: "workspace-write"
    #     approvalPolicy: "never"

taskService:
  maxConcurrency: 2
