"""Executor lifecycle endpoints: start/stop."""

from typing import Any

from fastapi import APIRouter

router = APIRouter(prefix="/queue", tags=["tools"])


@router.post("/start")
async def start_executor() -> dict[str, Any]:
    """Start the background executor loop."""
    from proxym.tools.executor import ToolExecutor
    await ToolExecutor.get().start()
    return {"ok": True, "message": "Executor started"}


@router.post("/stop")
async def stop_executor() -> dict[str, Any]:
    """Stop the background executor loop."""
    from proxym.tools.executor import ToolExecutor
    await ToolExecutor.get().stop()
    return {"ok": True, "message": "Executor stopped"}
