# Example Configuration
# Copy this file to config.yaml and edit as needed.
# Environment variables can be used with ${VAR} syntax.

# Number of concurrent message processing workers (LLM queries + SMTP sends).
# Default: 1 (for llama.cpp without the -np / --parallel flag).
concurrency: 1

# How long to wait for in-flight messages during shutdown.
shutdown_timeout: 30s

# Message filtering configuration.
# All specified filters are AND'd together.
# Excluding allowed_senders, filters are used for IMAP search and will match
# substrings.
filters:
  # Only accept emails from these addresses (case-insensitive exact match).
  # Empty list = accept from anyone (not recommended for production).
  allowed_senders:
    - trusted@example.com
    # - another@example.com

  # Only process emails with body containing these keywords.
  # body:
  #   - "token:e5a78ec2-18f5-4d13-8e97-4062393eb439"
  #   - "user:e8220e30-cdb6-4c20-a579-35c757bddb7b"

  # Only process emails with subject containing this string.
  # subject: "[AI]"

  # Only process emails sent to this address.
  # Useful for plus-addressing: you+ai@example.com
  # to: you+ai@example.com

# IMAP server connection for reading messages.
imap:
  host: imap.gmail.com
  port: "993"
  user: you@gmail.com
  password: ${RAVEN_IMAP_PASSWORD}

# Message retrieval strategy.
intake:
  # Mode: idle | poll
  # - idle: Use IMAP IDLE for real-time notifications (requires server support)
  # - poll: Periodically check for new messages
  mode: poll
  # How often to poll for new messages (only used in poll mode).
  poll_interval: 30s

# LLM configuration.
llm:
  url: http://localhost:8080/v1
  key: ${RAVEN_LLM_KEY}
  model: local-model
  system_prompt: |
    You are a helpful assistant responding to plain text emails.
    Be concise and helpful. Do not use Markdown formatting.
  # Maximum time to wait for LLM response.
  timeout: 15m

# SMTP server connection for sending replies.
# User, password, and from default to IMAP values if not specified.
smtp:
  host: smtp.gmail.com
  port: "587"
  # user: you@gmail.com
  # password: ${RAVEN_SMTP_PASSWORD}
  # from: you@example.com

# External tools available to the LLM.
tools:
  - name: echo
    description: Echoes back the input message. Useful for testing.
    command: echo
    arguments:
      - "'{{ .message }}'"
    parameters:
      type: object
      properties:
        message:
          type: string
          description: The message to echo back
      required:
        - message
    timeout: 3s

  - name: man
    description: Read a Unix manual page.
    command: man
    arguments:
      - "{{ .page_name }}"
    parameters:
      type: object
      properties:
        page_name:
          type: string
          description: |
            The name of the man page to read.
            Can optionally include a section number.
            For example: '2 read' or 'cat(1)'.
      required:
        - page_name

  - name: now
    description: Retrieves the current local date, time, and timezone.
    command: date
    arguments:
      - "+%Y-%m-%dT%H:%M:%S%:z"
    timeout: 1s
