"""Optional browser layer for A360 MCP.

This package is installed behind the ``[browser]`` extra. The core MCP server
(auth, HTTP, diagnosis, snapshots, CLI) does not import it; it is brought in
only by the browser tools in ``a360_mcp.tools.browser_tools``.

Design rules (see IMPLEMENTATION_HANDOFF.md §Phase 9):

- **No clicks.** This layer never synthesises input. The human clicks; the
  model only reads.
- **``inspect_*`` cannot open a window.** They accept a running
  :class:`~a360_mcp.browser.window.WindowState` and error out when none exists.
  Only :func:`~a360_mcp.browser.window.launch_window` can open one.
- **Self-session.** The window signs in to the Control Room under its own
  credentials, costing one of the account's five session slots. The slot is
  accounted on the shared disk ledger so the budget stays honest.
- **Launch budget.** A window that vanishes within 15s of launch is treated
  as a crash and relaunches are refused.
- **Unsaved-input guard.** Disruptive actions are blocked when the page has
  unsaved form input.
"""

from __future__ import annotations

from .launch_budget import (
    LaunchBudgetExceeded,
    check_launch_allowed,
    record_launch,
)
from .session import (
    bind_browser_slot,
    claim_browser_slot,
    release_browser_slot,
)
from .window import (
    WindowLaunchError,
    WindowState,
    close_window,
    find_window,
    launch_window,
)

__all__ = [
    "LaunchBudgetExceeded",
    "WindowLaunchError",
    "WindowState",
    "bind_browser_slot",
    "check_launch_allowed",
    "claim_browser_slot",
    "close_window",
    "find_window",
    "launch_window",
    "record_launch",
    "release_browser_slot",
]
