from collections.abc import Callable
from dataclasses import dataclass, field
from logfire._internal.utils import read_toml_file as read_toml_file
from logfire.exceptions import LogfireConfigError as LogfireConfigError
from pathlib import Path
from rich.console import Console
from typing import Any

LOCAL_TOKEN_PLACEHOLDER: str
LOGFIRE_MCP_TOML: str

@dataclass(frozen=True)
class AiToolIntegration:
    name: str
    display_name: str
    binary: str
    env: dict[str, str]
    model_env: dict[str, str] = field(default_factory=dict[str, str])
    setup: Callable[[str, str | None, Path, str], dict[str, str]] | None = ...
    configure_mcp: Callable[[str, Console, bool], None] | None = ...
    description: str = ...
    notice: str = ...
    def binary_path(self) -> str | None: ...
    def build_gateway_env(self, *, proxy_base: str, model: str | None, workdir: Path, local_token: str) -> dict[str, str]: ...
    def configure_mcp_server(self, *, mcp_url: str, console: Console, update: bool) -> None: ...

def gateway_template_values(proxy_base: str, local_token: str) -> dict[str, str]: ...
def resolve_ai_tool(name: str) -> AiToolIntegration: ...
def ai_tool_names() -> tuple[str, ...]: ...
def opencode_mcp_json(url: str) -> dict[str, Any]: ...

AI_TOOL_INTEGRATIONS: dict[str, AiToolIntegration]
