"""子智能体服务专用配置。"""

from pathlib import Path
import os

BASE_DIR = Path(__file__).resolve().parents[1]
DEFAULT_PORT = int(os.environ.get("SUB_AGENT_SERVICE_PORT", "8092"))
TASKS_ROOT = Path(os.environ.get("SUB_AGENT_TASKS_ROOT", BASE_DIR / "tasks")).resolve()
LOGS_DIR = Path(os.environ.get("SUB_AGENT_LOGS_DIR", BASE_DIR / "logs")).resolve()
DATA_ROOT = Path(os.environ.get("SUB_AGENT_DATA_ROOT", BASE_DIR / "data")).resolve()
MAX_ACTIVE_AGENTS = int(os.environ.get("SUB_AGENT_MAX_ACTIVE", "5"))
MAX_REFERENCE_FILES = int(os.environ.get("SUB_AGENT_MAX_REFERENCE_FILES", "10"))
DEFAULT_TIMEOUT_SECONDS = int(os.environ.get("SUB_AGENT_TIMEOUT", "180"))
STATUS_POLL_INTERVAL = float(os.environ.get("SUB_AGENT_STATUS_POLL_INTERVAL", "2.0"))

TASKS_ROOT.mkdir(parents=True, exist_ok=True)
LOGS_DIR.mkdir(parents=True, exist_ok=True)
DATA_ROOT.mkdir(parents=True, exist_ok=True)

__all__ = [
    "BASE_DIR",
    "DEFAULT_PORT",
    "TASKS_ROOT",
    "LOGS_DIR",
    "DATA_ROOT",
    "MAX_ACTIVE_AGENTS",
    "MAX_REFERENCE_FILES",
    "DEFAULT_TIMEOUT_SECONDS",
    "STATUS_POLL_INTERVAL",
]
