from __future__ import annotations

from armorer.agent import BaseAgent
from armorer.tools.knowledge import get_knowledge_topic, list_knowledge_topics, search_knowledge
from armorer.tools.runtime_state_tools import (
    get_agent_setup_state,
    get_dashboard_urls,
    get_installed_agents_snapshot,
    get_runtime_access_snapshot,
)


def build_setup_specialist_tool(base_agent: BaseAgent):
    return base_agent.create_agent_tool(
        system_prompt=(
            "You are Armorer's setup-state specialist. "
            "Use live setup state and knowledge tools to explain what is configured, what is missing, "
            "and what the next setup step should be. "
            "Do not invent credentials or claim setup is complete without verified state."
        ),
        tool_name="setup_state_specialist",
        tool_description=(
            "Inspect installed app setup state, explain missing configuration, and identify the next verified setup step."
        ),
        tools=[
            get_agent_setup_state,
            get_installed_agents_snapshot,
            get_runtime_access_snapshot,
            get_dashboard_urls,
            search_knowledge,
            get_knowledge_topic,
            list_knowledge_topics,
        ],
        agent_name="armorer:core:setup-state",
    )
