"""Platform-agnostic chat adapter contracts (adapter layer)."""

from .adapter import ChatAdapter, SendAttachmentRequest, SendTextRequest
from .agents import (
    DEFAULT_CHAT_AGENT,
    DEFAULT_CHAT_AGENT_MODELS,
    VALID_CHAT_AGENT_VALUES,
    ChatAgentProfileOption,
    ChatAgentSwitchState,
    build_agent_switch_state,
    chat_agent_definitions,
    chat_agent_supports_effort,
    chat_hermes_profile_options,
    default_chat_model_for_agent,
    format_chat_agent_selection,
    normalize_chat_agent,
    normalize_hermes_profile,
    resolve_chat_agent_and_profile,
    resolve_chat_runtime_agent,
    valid_chat_agent_values,
)
from .bootstrap import ChatBootstrapStep, run_chat_bootstrap_steps
from .callbacks import (
    CALLBACK_AGENT,
    CALLBACK_APPROVAL,
    CALLBACK_BIND,
    CALLBACK_CANCEL,
    CALLBACK_COMPACT,
    CALLBACK_EFFORT,
    CALLBACK_FLOW,
    CALLBACK_FLOW_RUN,
    CALLBACK_MODEL,
    CALLBACK_PAGE,
    CALLBACK_QUESTION_CANCEL,
    CALLBACK_QUESTION_CUSTOM,
    CALLBACK_QUESTION_DONE,
    CALLBACK_QUESTION_OPTION,
    CALLBACK_RESUME,
    CALLBACK_REVIEW_COMMIT,
    CALLBACK_UPDATE,
    CALLBACK_UPDATE_CONFIRM,
    CallbackCodec,
    LogicalCallback,
    decode_logical_callback,
    encode_logical_callback,
)
from .capabilities import ChatCapabilities
from .channel_directory import (
    CHANNEL_DIRECTORY_FILENAME,
    ChannelDirectoryStore,
    channel_entry_key,
    default_channel_directory_path,
    default_channel_directory_state,
    normalize_channel_entry,
)
from .command_contract import COMMAND_CONTRACT, CommandContractEntry, CommandStatus
from .commands import ChatCommand, parse_chat_command
from .dispatcher import (
    ChatDispatcher,
    DispatchContext,
    DispatchResult,
    build_dispatch_context,
    conversation_id_for,
    is_bypass_event,
)
from .doctor import chat_doctor_checks
from .errors import (
    ChatAdapterError,
    ChatAdapterPermanentError,
    ChatAdapterTimeoutError,
    ChatAdapterTransientError,
)
from .forwarding import compose_forwarded_message_text, compose_inbound_message_text
from .handlers import (
    ChatApprovalHandlers,
    ChatContext,
    ChatQuestionHandlers,
    ChatSelectionHandlers,
    handle_custom_text_input,
)
from .media import (
    ChatVoiceInput,
    audio_content_type_for_input,
    audio_extension_for_input,
    format_media_batch_failure,
    is_audio_mime_or_path,
    is_image_mime_or_path,
    normalize_mime_type,
)
from .models import (
    ChatAction,
    ChatAttachment,
    ChatEvent,
    ChatForwardInfo,
    ChatInteractionEvent,
    ChatInteractionRef,
    ChatMessageEvent,
    ChatMessageRef,
    ChatReplyInfo,
    ChatThreadRef,
)
from .parity_checker import run_parity_checks
from .renderer import RenderedText, TextRenderer
from .runtime import iter_exception_chain
from .service import ChatBotServiceCore
from .state_store import ChatOutboxRecord, ChatPendingApprovalRecord, ChatStateStore
from .text_chunking import chunk_text
from .transport import ChatTransport
from .turn_policy import (
    PlainTextTurnContext,
    TurnTriggerMode,
    should_trigger_plain_text_turn,
)

__all__ = [
    "CALLBACK_AGENT",
    "CALLBACK_APPROVAL",
    "CALLBACK_BIND",
    "CALLBACK_CANCEL",
    "CALLBACK_COMPACT",
    "CALLBACK_EFFORT",
    "CALLBACK_FLOW",
    "CALLBACK_FLOW_RUN",
    "CALLBACK_MODEL",
    "CALLBACK_PAGE",
    "CALLBACK_QUESTION_CANCEL",
    "CALLBACK_QUESTION_CUSTOM",
    "CALLBACK_QUESTION_DONE",
    "CALLBACK_QUESTION_OPTION",
    "CALLBACK_RESUME",
    "CALLBACK_REVIEW_COMMIT",
    "CALLBACK_UPDATE",
    "CALLBACK_UPDATE_CONFIRM",
    "CHANNEL_DIRECTORY_FILENAME",
    "COMMAND_CONTRACT",
    "CallbackCodec",
    "ChannelDirectoryStore",
    "ChatAction",
    "ChatAdapter",
    "ChatAdapterError",
    "ChatAdapterPermanentError",
    "ChatAdapterTimeoutError",
    "ChatAdapterTransientError",
    "ChatAgentSwitchState",
    "ChatAgentProfileOption",
    "ChatApprovalHandlers",
    "ChatAttachment",
    "ChatBootstrapStep",
    "ChatBotServiceCore",
    "ChatCapabilities",
    "ChatCommand",
    "ChatContext",
    "ChatDispatcher",
    "ChatEvent",
    "ChatForwardInfo",
    "ChatInteractionEvent",
    "ChatInteractionRef",
    "ChatMessageEvent",
    "ChatMessageRef",
    "ChatOutboxRecord",
    "ChatPendingApprovalRecord",
    "ChatQuestionHandlers",
    "ChatReplyInfo",
    "ChatSelectionHandlers",
    "ChatStateStore",
    "ChatThreadRef",
    "ChatTransport",
    "ChatVoiceInput",
    "CommandContractEntry",
    "CommandStatus",
    "DEFAULT_CHAT_AGENT",
    "DEFAULT_CHAT_AGENT_MODELS",
    "DispatchContext",
    "DispatchResult",
    "LogicalCallback",
    "PlainTextTurnContext",
    "RenderedText",
    "SendAttachmentRequest",
    "SendTextRequest",
    "TextRenderer",
    "TurnTriggerMode",
    "VALID_CHAT_AGENT_VALUES",
    "audio_content_type_for_input",
    "audio_extension_for_input",
    "build_agent_switch_state",
    "chat_hermes_profile_options",
    "build_dispatch_context",
    "channel_entry_key",
    "chat_agent_definitions",
    "chat_agent_supports_effort",
    "chat_doctor_checks",
    "chunk_text",
    "compose_inbound_message_text",
    "compose_forwarded_message_text",
    "conversation_id_for",
    "decode_logical_callback",
    "default_channel_directory_path",
    "default_channel_directory_state",
    "default_chat_model_for_agent",
    "encode_logical_callback",
    "format_media_batch_failure",
    "format_chat_agent_selection",
    "handle_custom_text_input",
    "is_audio_mime_or_path",
    "is_bypass_event",
    "is_image_mime_or_path",
    "iter_exception_chain",
    "normalize_channel_entry",
    "normalize_hermes_profile",
    "normalize_chat_agent",
    "resolve_chat_agent_and_profile",
    "resolve_chat_runtime_agent",
    "normalize_mime_type",
    "parse_chat_command",
    "run_chat_bootstrap_steps",
    "run_parity_checks",
    "should_trigger_plain_text_turn",
    "valid_chat_agent_values",
]
