from __future__ import annotations

from armorer.agent import BaseAgent
from armorer.tools.runtime_state_tools import (
    get_agent_setup_state,
    get_dashboard_urls,
    get_installed_agents_snapshot,
    get_recent_jobs_snapshot,
    get_runtime_access_snapshot,
    get_status_snapshot,
)


def build_runtime_access_specialist_tool(base_agent: BaseAgent):
    return base_agent.create_agent_tool(
        system_prompt=(
            "You are Armorer's runtime-access specialist. "
            "Answer questions about URLs, dashboards, ports, endpoints, setup readiness, and current runtime state. "
            "Use live runtime-state tools first. Prefer user-facing URLs over raw localhost endpoints. "
            "If live state is missing or ambiguous, say that explicitly instead of guessing."
        ),
        tool_name="runtime_access_specialist",
        tool_description=(
            "Resolve live Armorer URLs, dashboards, ports, access paths, setup readiness, and current runtime state."
        ),
        tools=[
            get_runtime_access_snapshot,
            get_status_snapshot,
            get_installed_agents_snapshot,
            get_dashboard_urls,
            get_recent_jobs_snapshot,
            get_agent_setup_state,
        ],
        agent_name="armorer:core:runtime-access",
    )
