# HotPlex Worker Gateway - Environment Variables
#
# cp configs/env.example .env
#
# Load order (later overrides earlier):
#   .env → .env.local → shell environment
#
# NEVER commit .env or .env.local to version control!

# ── Required Secrets ──────────────────────────────────────────────────────────

# JWT signing key (ES256). Generate: openssl rand -base64 32 | tr -d '\n'
HOTPLEX_JWT_SECRET=

# Admin API tokens. Referenced by config-dev.yaml as ${ADMIN_TOKEN}.
# Also supports _1..N env vars for rotation: HOTPLEX_ADMIN_TOKEN_1, HOTPLEX_ADMIN_TOKEN_2, ...
# Generate: openssl rand -hex 32
ADMIN_TOKEN=
# HOTPLEX_ADMIN_TOKEN_2=

# ── Client Authentication ─────────────────────────────────────────────────────

# API keys for client-level auth (_1..N)
# HOTPLEX_SECURITY_API_KEY_1=
# HOTPLEX_SECURITY_API_KEY_2=

# ── Core Overrides ────────────────────────────────────────────────────────────

# Log level: debug, info, warn, error (default: info)
# HOTPLEX_LOG_LEVEL=info

# Log format: json, text (default: json)
# HOTPLEX_LOG_FORMAT=text

# Database path (default: data/hotplex.db)
# HOTPLEX_DB_PATH=data/hotplex.db

# Gateway address (default: :8888)
# HOTPLEX_GATEWAY_ADDR=:8888

# Admin address (default: :9999)
# HOTPLEX_ADMIN_ADDR=:9999

# ── Resource Limits ───────────────────────────────────────────────────────────

# HOTPLEX_SESSION_MAX_CONCURRENT=1000
# HOTPLEX_POOL_MAX_SIZE=100
# HOTPLEX_POOL_MAX_MEMORY_PER_USER=8589934592

# ── Observability ─────────────────────────────────────────────────────────────

# OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
# OTEL_SERVICE_NAME=hotplex-gateway

# ── Messaging (Global) ─────────────────────────────────────────────────────────

# Send turn summary after each completed turn. Default: true
# HOTPLEX_MESSAGING_TURN_SUMMARY_ENABLED=true

# ── Messaging Shared Defaults ──────────────────────────────────────────────────
# These are inherited by all platforms. Per-platform env vars below can override.

# HOTPLEX_MESSAGING_WORKER_TYPE=claude_code

# STT (Speech-to-Text) — shared defaults
# Provider: feishu (cloud), local (command), feishu+local (cloud+fallback), empty (disabled)
# HOTPLEX_MESSAGING_STT_PROVIDER=local
# HOTPLEX_MESSAGING_STT_LOCAL_CMD="python3 ~/.hotplex/scripts/stt_server.py"
# HOTPLEX_MESSAGING_STT_LOCAL_IDLE_TTL=1h

# TTS (Text-to-Speech) — shared defaults
# Provider: edge (Edge TTS, free), moss (MOSS-TTS-Nano local CPU),
#   edge+moss (Edge primary + MOSS fallback), empty (disabled)
# HOTPLEX_MESSAGING_TTS_ENABLED=true
# HOTPLEX_MESSAGING_TTS_PROVIDER=edge+moss
# HOTPLEX_MESSAGING_TTS_VOICE=zh-CN-XiaoxiaoNeural
# HOTPLEX_MESSAGING_TTS_MAX_CHARS=150
# HOTPLEX_MESSAGING_TTS_MOSS_MODEL_DIR=~/.hotplex/models/moss-tts-nano
# HOTPLEX_MESSAGING_TTS_MOSS_VOICE=Xiaoyu
# HOTPLEX_MESSAGING_TTS_MOSS_PORT=18083
# HOTPLEX_MESSAGING_TTS_MOSS_IDLE_TIMEOUT=30m
# HOTPLEX_MESSAGING_TTS_MOSS_CPU_THREADS=2

# ── Slack ──────────────────────────────────────────────────────────────────────

# HOTPLEX_MESSAGING_SLACK_ENABLED=true
# HOTPLEX_MESSAGING_SLACK_BOT_TOKEN=xoxb-...
# HOTPLEX_MESSAGING_SLACK_APP_TOKEN=xapp-...
# HOTPLEX_MESSAGING_SLACK_WORK_DIR=
# HOTPLEX_MESSAGING_SLACK_REQUIRE_MENTION=true
# HOTPLEX_MESSAGING_SLACK_ALLOW_FROM=
# HOTPLEX_MESSAGING_SLACK_ALLOW_DM_FROM=
# HOTPLEX_MESSAGING_SLACK_ALLOW_GROUP_FROM=

# ── Feishu ─────────────────────────────────────────────────────────────────────

# HOTPLEX_MESSAGING_FEISHU_ENABLED=true
# HOTPLEX_MESSAGING_FEISHU_APP_ID=cli_xxxxxxxxxxxx
# HOTPLEX_MESSAGING_FEISHU_APP_SECRET=
# HOTPLEX_MESSAGING_FEISHU_WORK_DIR=
# HOTPLEX_MESSAGING_FEISHU_REQUIRE_MENTION=true
# HOTPLEX_MESSAGING_FEISHU_ALLOW_FROM=
# HOTPLEX_MESSAGING_FEISHU_ALLOW_DM_FROM=
# HOTPLEX_MESSAGING_FEISHU_ALLOW_GROUP_FROM=

# ── Agent Config (Persona & Context) ───────────────────────────────────────────

# Enable loading personality (SOUL.md) and context (USER.md) from config_dir. Default: true
# HOTPLEX_AGENT_CONFIG_ENABLED=true

# Directory for .md config files. Default: ~/.hotplex/agent-configs/
# HOTPLEX_AGENT_CONFIG_DIR=~/.hotplex/agent-configs/


# ── Worker Config ─────────────────────────────────────────────────────────────
#
# Worker startup commands. Default: "claude" and "opencode".
# If you are using a custom binary name (e.g. ccr) or have multiple versions
# installed, uncomment and modify these variables.

# Binary command for Claude Code worker (default: "claude")
# TIP: If your binary is not in PATH, use absolute path: /usr/local/bin/claude
HOTPLEX_WORKER_CLAUDE_CODE_COMMAND=claude

# Binary command for OpenCode Server worker (default: "opencode")
# TIP: Use "opencode serve" if you need to pass default arguments.
HOTPLEX_WORKER_OPENCODE_SERVER_COMMAND=opencode

# HOTPLEX_WORKER_OPENCODE_SERVER_IDLE_DRAIN_PERIOD=30m

# ── Worker Environment ──────────────────────────────────────────────────────

# GitHub token for gh CLI in workers (injected via config.yaml, not shell env)
# HOTPLEX_WORKER_GH_TOKEN=ghp_xxxxxxxxxxxx
# HOTPLEX_WORKER_GITHUB_TOKEN=ghp_xxxxxxxxxxxx
