"""State schema for LangGraph-based orchestration.

This module defines the state structure used throughout the agent execution flow.
"""

from typing import Any, TypedDict

from langchain_core.messages import BaseMessage


class AgentState(TypedDict):
    """State schema for the agent execution flow.

    Attributes:
        messages: Conversation history with message accumulation
        plan: Execution plan generated by orchestrator
        context: Shared context including multimodal inputs and intermediate data
        mcp_results: Accumulated results from MCP tool executions
        metadata: Session metadata (timestamps, active MCP servers, tracing info)
        extracted_content: Content extracted from unified input
        content_tree: Hierarchical structure of content items
        error: Error information if execution failed
    """

    messages: list[BaseMessage]
    plan: list[str]
    context: dict[str, Any]
    mcp_results: list[dict[str, Any]]
    metadata: dict[str, Any]
    extracted_content: list[dict[str, Any]]
    content_tree: dict[str, Any]
    error: dict[str, Any] | None
