"""
Talkback orchestration subpackage.

Import everything from the public symbols for backward compatibility with
``from app.services.talkback_orchestrator import X`` usage.
"""
from app.services.talkback.types import (
    NodeStatus,
    TalkbackTrace,
    TalkbackTraceStep,
    TalkbackState,
    ResolveAuthorizedAgentIds,
    GetAskmeService,
    RunInThreadpool,
    ExecuteTalkback,
)
from app.services.talkback.utils import (
    _coerce_route_handler_result_to_dict,
    _parse_sql_preview_for_meta,
    _df_row_count_and_columns,
    _infer_datasource_from_details,
    _collect_api_names,
    _ordinal_to_index,
    _looks_like_clarification_reply,
    _safe_str,
    _extract_talkback_options,
    _parse_df_input_light,
    _clone_ask_request,
    _ensure_web_prefix_for_search_web_request,
)
from app.services.talkback.meta import (
    _dispatch_agents_for_talkback_meta,
    _agent_display_labels,
    build_talkback_answer_meta,
    _rewrite_context_should_omit_assistant_answer,
    _enriched_answer_for_context,
    _turn_for_llm_context,
)
from app.services.talkback.routing import (
    OUT_OF_CONTEXT_CLEAR_CONFIRM_CONSENT_TYPE,
    _history_last_turn_expected_agent_disambiguation_reply,
    _merge_original_question_with_clarification_selection,
    _last_turn_is_clarification_response_matching_question,
    _reply_means_out_of_context_proceed,
    _reply_means_use_current_context_agents,
    _resolve_talkback_effective_session_key,
    talkback_client_session_key_is_empty,
    decide_uploaded_file_followup_action,
    _derive_talkback_db_session_key,
    _agent_scope_list_from_session,
    _resolve_clarification_via_persisted_agent_scope,
    _filter_agent_ids_by_datasource,
    _infer_talkback_datasource_from_dispatch_and_intent,
    _resolve_talkback_file_agent_id,
    _state_snapshot,
    _print_node,
    _build_intent_routing_question,
    _derive_request_id,
    _derive_request_id_for_direct,
)
from app.services.talkback.nodes import (
    BaseNode,
    _TalkbackStop,
    _UQL_CACHE_NODE_NAME,
    _PERSIST_TURN_NODE_NAME,
    _UserQuestionLogCacheHitNode,
    _ResolveAgentsNode,
    _NormalizeDatasourceNode,
    _FileCommandDetectNode,
    _LoadSessionNode,
    _ContextRelevanceNode,
    _PreparePriorQuestionsNode,
    _ContextRewriteForRoutingNode,
    _IntentRoutingNode,
    _DispatchDecisionNode,
    LLM_PRIOR_DF_CONSENT_MESSAGE,
    LLM_PRIOR_DF_MISSING_DATA_MESSAGE,
    _PriorDfConsentNode,
    _BroadScopeProcessingWarningNode,
    _ClarificationShortCircuitNode,
    _ExecuteNode,
    _merge_mixed_intent_results,
    _PersistTurnNode,
)
from app.services.talkback.pipeline import (
    TalkbackPipeline,
    _run_talkback_prior_df_search_web_direct,
    run_talkback_pipeline,
)

__all__ = [
    # types
    "NodeStatus",
    "TalkbackTrace",
    "TalkbackTraceStep",
    "TalkbackState",
    "ResolveAuthorizedAgentIds",
    "GetAskmeService",
    "RunInThreadpool",
    "ExecuteTalkback",
    # utils
    "_coerce_route_handler_result_to_dict",
    "_parse_sql_preview_for_meta",
    "_df_row_count_and_columns",
    "_infer_datasource_from_details",
    "_collect_api_names",
    "_ordinal_to_index",
    "_looks_like_clarification_reply",
    "_safe_str",
    "_extract_talkback_options",
    "_parse_df_input_light",
    "_clone_ask_request",
    "_ensure_web_prefix_for_search_web_request",
    # meta
    "_dispatch_agents_for_talkback_meta",
    "_agent_display_labels",
    "build_talkback_answer_meta",
    "_rewrite_context_should_omit_assistant_answer",
    "_enriched_answer_for_context",
    "_turn_for_llm_context",
    # routing
    "OUT_OF_CONTEXT_CLEAR_CONFIRM_CONSENT_TYPE",
    "_history_last_turn_expected_agent_disambiguation_reply",
    "_merge_original_question_with_clarification_selection",
    "_last_turn_is_clarification_response_matching_question",
    "_reply_means_out_of_context_proceed",
    "_reply_means_use_current_context_agents",
    "_resolve_talkback_effective_session_key",
    "talkback_client_session_key_is_empty",
    "decide_uploaded_file_followup_action",
    "_derive_talkback_db_session_key",
    "_agent_scope_list_from_session",
    "_resolve_clarification_via_persisted_agent_scope",
    "_filter_agent_ids_by_datasource",
    "_infer_talkback_datasource_from_dispatch_and_intent",
    "_resolve_talkback_file_agent_id",
    "_state_snapshot",
    "_print_node",
    "_build_intent_routing_question",
    "_derive_request_id",
    "_derive_request_id_for_direct",
    # nodes
    "BaseNode",
    "_TalkbackStop",
    "_UQL_CACHE_NODE_NAME",
    "_PERSIST_TURN_NODE_NAME",
    "_UserQuestionLogCacheHitNode",
    "_ResolveAgentsNode",
    "_NormalizeDatasourceNode",
    "_FileCommandDetectNode",
    "_LoadSessionNode",
    "_ContextRelevanceNode",
    "_PreparePriorQuestionsNode",
    "_ContextRewriteForRoutingNode",
    "_IntentRoutingNode",
    "_DispatchDecisionNode",
    "LLM_PRIOR_DF_CONSENT_MESSAGE",
    "LLM_PRIOR_DF_MISSING_DATA_MESSAGE",
    "_PriorDfConsentNode",
    "_BroadScopeProcessingWarningNode",
    "_ClarificationShortCircuitNode",
    "_ExecuteNode",
    "_merge_mixed_intent_results",
    "_PersistTurnNode",
    # pipeline
    "TalkbackPipeline",
    "_run_talkback_prior_df_search_web_direct",
    "run_talkback_pipeline",
]
