# GENERATED by `harn dump-protocol-artifacts` - do not edit by hand.
# Source: Harn adapter schemas and Rust wire vocabulary.
"""Python bindings for Harn's host/integrator protocol surface.

Mirrors the TypeScript and Swift artifacts generated alongside this
module. Field names match the wire JSON (camelCase) so dataclass
instances round-trip through ``json.dumps(asdict(obj))`` without a
custom encoder. Optional fields default to ``None`` and are stripped
by :func:`to_wire`.
"""

from __future__ import annotations

from dataclasses import asdict, dataclass, field, fields, is_dataclass
from enum import Enum
from typing import Any, Dict, List, Mapping, Optional, Type, TypeVar, Union

__all__ = [
    "HARN_PROTOCOL_ARTIFACT_VERSION",
    "HARN_AGENT_EVENT_METHOD",
    "HARN_PROVIDER_CATALOG_METHOD",
    "ACP_SCHEMA_COMPATIBILITY",
    "A2A_PROTOCOL_VERSION",
    "MCP_PROTOCOL_VERSION",
    "MCP_STABLE_PROTOCOL_VERSION",
    "MCP_DRAFT_PROTOCOL_VERSION",
    "MCP_FINAL_2026_PROTOCOL_VERSION",
    "MCP_JSON_SCHEMA_2020_12_DIALECT",
    "MCP_INPUT_REQUIRED_RESULT_TYPE",
    "MCP_UNSUPPORTED_PROTOCOL_VERSION_ERROR_CODE",
    "MCP_UNSUPPORTED_PROTOCOL_VERSION_ERROR_MESSAGE",
    "ACP_AGENT_METHODS",
    "ACP_CLIENT_METHODS",
    "ACP_AGENT_NOTIFICATIONS",
    "ACP_SESSION_UPDATES",
    "HARN_ACP_SESSION_UPDATE_EXTENSIONS",
    "HARN_AGENT_EVENT_KINDS",
    "ACP_CONTENT_BLOCK_TYPES",
    "ACP_TOOL_KINDS",
    "ACP_TOOL_CALL_STATUSES",
    "HARN_TOOL_CALL_ERROR_CATEGORIES",
    "HARN_SIDE_EFFECT_LEVELS",
    "HARN_WORKER_STATUSES",
    "HARN_TOOL_CALL_RECEIPT_STATUSES",
    "HARN_TOOL_CALL_RECEIPT_EXECUTORS",
    "HARN_TOOL_LIFECYCLE_EXTENSION_FIELDS",
    "HARN_CONTENT_EXTENSION_FIELDS",
    "A2A_METHODS",
    "A2A_TASK_STATES",
    "A2A_TASK_EVENT_TYPES",
    "MCP_PROTOCOL_VERSIONS",
    "MCP_METHODS",
    "MCP_REQUIRED_METADATA_KEYS",
    "MCP_METADATA_KEYS",
    "MCP_STANDARD_HTTP_HEADERS",
    "MCP_CACHE_RESULT_FIELDS",
    "MCP_CACHE_SCOPES",
    "MCP_RESULT_TYPES",
    "MCP_LOGGING_LEVELS",
    "ACPAgentMethod",
    "ACPClientMethod",
    "ACPAgentNotification",
    "ACPSessionUpdate",
    "ACPToolKind",
    "ACPToolCallStatus",
    "HarnToolCallErrorCategory",
    "HarnSideEffectLevel",
    "HarnWorkerStatus",
    "ToolCallReceiptStatus",
    "ToolCallReceiptExecutor",
    "A2ATaskState",
    "A2ATaskEventType",
    "MCPCacheScope",
    "MCPResultType",
    "MCPLoggingLevel",
    "ACPError",
    "ACPRequest",
    "ACPResponse",
    "ACPNotification",
    "ACPMessage",
    "HarnExtensionMeta",
    "ACPContentBlock",
    "HarnToolLifecycleMeta",
    "ToolCallReceipt",
    "ACPToolCall",
    "ACPToolCallUpdate",
    "ACPSessionUpdateEnvelope",
    "ACPSessionUpdateParams",
    "ACPSessionUpdateNotification",
    "HarnAgentEventNotification",
    "HarnToolArgSchema",
    "HarnToolAnnotations",
    "A2AMessage",
    "A2ATaskStatus",
    "A2ATask",
    "MCPJsonSchema202012",
    "MCPRequestMeta",
    "MCPHTTPHeaders",
    "MCPImplementation",
    "MCPCacheHints",
    "MCPDiscoverResult",
    "MCPInputRequiredResult",
    "MCPUnsupportedProtocolVersionErrorData",
    "MCPUnsupportedProtocolVersionError",
    "MCPTool",
    "MCPResource",
    "MCPResourceTemplate",
    "MCPPrompt",
    "JsonValue",
    "JsonObject",
    "JsonRpcId",
    "is_request",
    "is_response",
    "is_notification",
]

HARN_PROTOCOL_ARTIFACT_VERSION: str = "0.8.104"
HARN_AGENT_EVENT_METHOD: str = "_harn/agentEvent"
HARN_PROVIDER_CATALOG_METHOD: str = "_harn/providerCatalog"
ACP_SCHEMA_COMPATIBILITY: str = "agentclientprotocol/agent-client-protocol schema v0.12.2"
A2A_PROTOCOL_VERSION: str = "0.3.0"
MCP_PROTOCOL_VERSION: str = "2025-11-25"
MCP_STABLE_PROTOCOL_VERSION: str = "2025-11-25"
MCP_DRAFT_PROTOCOL_VERSION: str = "DRAFT-2026-v1"
MCP_FINAL_2026_PROTOCOL_VERSION: str = "2026-07-28"
MCP_JSON_SCHEMA_2020_12_DIALECT: str = "https://json-schema.org/draft/2020-12/schema"
MCP_INPUT_REQUIRED_RESULT_TYPE: str = "input_required"
MCP_UNSUPPORTED_PROTOCOL_VERSION_ERROR_MESSAGE: str = "Unsupported protocol version"
MCP_UNSUPPORTED_PROTOCOL_VERSION_ERROR_CODE: int = -32004

ACP_AGENT_METHODS: tuple = (
    "initialize",
    "session/inject",
    "session/new",
    "session/load",
    "session/replace_inject",
    "session/resume",
    "session/prompt",
    "session/revoke_inject",
    "session/truncate",
    "session/rollback",
    "session/redo",
    "session/remind",
    "session/pending_injections",
    "session/revoke_reminder",
    "session/cancel_tool_call",
    "session/close",
    "session/stop",
)
ACP_CLIENT_METHODS: tuple = (
    "fs/read_text_file",
    "fs/write_text_file",
    "terminal/create",
    "terminal/kill",
    "session/request_permission",
)
ACP_AGENT_NOTIFICATIONS: tuple = (
    "session/message",
    "session/update",
    "terminal/output",
)
ACP_SESSION_UPDATES: tuple = (
    "user_message",
    "user_message_chunk",
    "agent_message_chunk",
    "agent_thought_chunk",
    "tool_call",
    "tool_call_update",
    "plan",
    "available_commands_update",
    "current_mode_update",
    "config_option_update",
    "session_info_update",
    "session_redo",
    "session_rollback",
    "session_truncated",
    "artifact",
    "fs_watch",
    "handoff",
    "hitl_request",
    "hitl_resolved",
    "log",
    "progress",
    "reminder_emitted",
    "skill_activated",
    "skill_deactivated",
    "skill_narrow",
    "skill_scope_tools",
    "tool_search_query",
    "tool_search_result",
    "transcript_compacted",
    "transcript_projected",
    "worker_update",
)
HARN_ACP_SESSION_UPDATE_EXTENSIONS: tuple = (
    "artifact",
    "available_commands_update",
    "fs_watch",
    "handoff",
    "hitl_request",
    "hitl_resolved",
    "log",
    "progress",
    "reminder_emitted",
    "skill_activated",
    "skill_deactivated",
    "skill_narrow",
    "skill_scope_tools",
    "tool_search_query",
    "tool_search_result",
    "transcript_compacted",
    "transcript_projected",
    "worker_update",
)
HARN_AGENT_EVENT_KINDS: tuple = (
    "budget_circuit_breaker",
    "budget_exhausted",
    "composition_child_call",
    "composition_child_result",
    "composition_error",
    "composition_finish",
    "composition_start",
    "compass_routing_decision",
    "control_outcome",
    "daemon_watchdog_tripped",
    "feedback_injected",
    "iteration_end",
    "iteration_start",
    "judge_decision",
    "loop_control_decision",
    "loop_stuck",
    "mcp_auth_required",
    "mcp_catalog_changed",
    "mcp_notification",
    "progress_reported",
    "scope_classifier_verdict",
    "session_closed",
    "structural_validator_decision",
    "step_judge_decision",
    "tool_call_audit",
    "tool_format_override",
    "typed_checkpoint",
)
ACP_CONTENT_BLOCK_TYPES: tuple = (
    "text",
    "resource_link",
    "resource",
    "image",
    "audio",
)
ACP_TOOL_KINDS: tuple = (
    "read",
    "edit",
    "delete",
    "move",
    "search",
    "execute",
    "think",
    "fetch",
    "other",
)
ACP_TOOL_CALL_STATUSES: tuple = (
    "pending",
    "in_progress",
    "completed",
    "failed",
)
HARN_TOOL_CALL_ERROR_CATEGORIES: tuple = (
    "schema_validation",
    "tool_error",
    "mcp_server_error",
    "host_bridge_error",
    "permission_denied",
    "rejected_loop",
    "parse_aborted",
    "timeout",
    "network",
    "cancelled",
    "unknown",
)
HARN_SIDE_EFFECT_LEVELS: tuple = (
    "none",
    "read_only",
    "workspace_write",
    "process_exec",
    "network",
)
HARN_WORKER_STATUSES: tuple = (
    "running",
    "progressed",
    "awaiting_input",
    "suspended",
    "completed",
    "failed",
    "stopped",
    "cancelled",
)
HARN_TOOL_CALL_RECEIPT_STATUSES: tuple = (
    "ok",
    "schema_violation",
    "consent_denied",
    "timeout",
    "error",
)
HARN_TOOL_CALL_RECEIPT_EXECUTORS: tuple = (
    "harn",
    "host_bridge",
    "mcp_server",
    "provider_native",
)
HARN_TOOL_LIFECYCLE_EXTENSION_FIELDS: tuple = (
    "audit",
    "durationMs",
    "error",
    "errorCategory",
    "executionDurationMs",
    "executor",
    "parsing",
    "rawInputPartial",
)
HARN_CONTENT_EXTENSION_FIELDS: tuple = (
    "visible_delta",
    "visible_text",
)
A2A_METHODS: tuple = (
    "message/send",
    "message/stream",
    "tasks/get",
    "tasks/cancel",
    "tasks/resubscribe",
    "tasks/pushNotificationConfig/set",
    "tasks/pushNotificationConfig/get",
    "tasks/pushNotificationConfig/list",
    "tasks/pushNotificationConfig/delete",
    "agent/getAuthenticatedExtendedCard",
)
A2A_TASK_STATES: tuple = (
    "submitted",
    "working",
    "completed",
    "failed",
    "canceled",
    "cancelled",
    "input-required",
    "rejected",
    "auth-required",
)
A2A_TASK_EVENT_TYPES: tuple = (
    "status",
    "message",
    "worker_update",
)
MCP_PROTOCOL_VERSIONS: tuple = (
    "DRAFT-2026-v1",
    "2025-11-25",
)
MCP_METHODS: tuple = (
    "server/discover",
    "initialize",
    "tools/list",
    "tools/call",
    "resources/list",
    "resources/read",
    "resources/templates/list",
    "prompts/list",
    "prompts/get",
    "completion/complete",
    "logging/setLevel",
    "sampling/createMessage",
    "elicitation/create",
    "notifications/initialized",
    "notifications/message",
)
MCP_REQUIRED_METADATA_KEYS: tuple = (
    "io.modelcontextprotocol/protocolVersion",
    "io.modelcontextprotocol/clientInfo",
    "io.modelcontextprotocol/clientCapabilities",
)
MCP_METADATA_KEYS: tuple = (
    "io.modelcontextprotocol/protocolVersion",
    "io.modelcontextprotocol/clientInfo",
    "io.modelcontextprotocol/clientCapabilities",
    "io.modelcontextprotocol/logLevel",
    "progressToken",
    "traceparent",
    "tracestate",
    "baggage",
)
MCP_STANDARD_HTTP_HEADERS: tuple = (
    "MCP-Protocol-Version",
    "Mcp-Method",
    "Mcp-Name",
)
MCP_CACHE_RESULT_FIELDS: tuple = (
    "ttlMs",
    "cacheScope",
)
MCP_CACHE_SCOPES: tuple = (
    "private",
    "public",
)
MCP_RESULT_TYPES: tuple = (
    "complete",
    "input_required",
)
MCP_LOGGING_LEVELS: tuple = (
    "debug",
    "info",
    "notice",
    "warning",
    "error",
    "critical",
    "alert",
    "emergency",
)


class ACPAgentMethod(str, Enum):
    INITIALIZE = "initialize"
    SESSION_INJECT = "session/inject"
    SESSION_NEW = "session/new"
    SESSION_LOAD = "session/load"
    SESSION_REPLACE_INJECT = "session/replace_inject"
    SESSION_RESUME = "session/resume"
    SESSION_PROMPT = "session/prompt"
    SESSION_REVOKE_INJECT = "session/revoke_inject"
    SESSION_TRUNCATE = "session/truncate"
    SESSION_ROLLBACK = "session/rollback"
    SESSION_REDO = "session/redo"
    SESSION_REMIND = "session/remind"
    SESSION_PENDING_INJECTIONS = "session/pending_injections"
    SESSION_REVOKE_REMINDER = "session/revoke_reminder"
    SESSION_CANCEL_TOOL_CALL = "session/cancel_tool_call"
    SESSION_CLOSE = "session/close"
    SESSION_STOP = "session/stop"


class ACPClientMethod(str, Enum):
    FS_READ_TEXT_FILE = "fs/read_text_file"
    FS_WRITE_TEXT_FILE = "fs/write_text_file"
    TERMINAL_CREATE = "terminal/create"
    TERMINAL_KILL = "terminal/kill"
    SESSION_REQUEST_PERMISSION = "session/request_permission"


class ACPAgentNotification(str, Enum):
    SESSION_MESSAGE = "session/message"
    SESSION_UPDATE = "session/update"
    TERMINAL_OUTPUT = "terminal/output"


class ACPSessionUpdate(str, Enum):
    USER_MESSAGE = "user_message"
    USER_MESSAGE_CHUNK = "user_message_chunk"
    AGENT_MESSAGE_CHUNK = "agent_message_chunk"
    AGENT_THOUGHT_CHUNK = "agent_thought_chunk"
    TOOL_CALL = "tool_call"
    TOOL_CALL_UPDATE = "tool_call_update"
    PLAN = "plan"
    AVAILABLE_COMMANDS_UPDATE = "available_commands_update"
    CURRENT_MODE_UPDATE = "current_mode_update"
    CONFIG_OPTION_UPDATE = "config_option_update"
    SESSION_INFO_UPDATE = "session_info_update"
    SESSION_REDO = "session_redo"
    SESSION_ROLLBACK = "session_rollback"
    SESSION_TRUNCATED = "session_truncated"
    ARTIFACT = "artifact"
    FS_WATCH = "fs_watch"
    HANDOFF = "handoff"
    HITL_REQUEST = "hitl_request"
    HITL_RESOLVED = "hitl_resolved"
    LOG = "log"
    PROGRESS = "progress"
    REMINDER_EMITTED = "reminder_emitted"
    SKILL_ACTIVATED = "skill_activated"
    SKILL_DEACTIVATED = "skill_deactivated"
    SKILL_NARROW = "skill_narrow"
    SKILL_SCOPE_TOOLS = "skill_scope_tools"
    TOOL_SEARCH_QUERY = "tool_search_query"
    TOOL_SEARCH_RESULT = "tool_search_result"
    TRANSCRIPT_COMPACTED = "transcript_compacted"
    TRANSCRIPT_PROJECTED = "transcript_projected"
    WORKER_UPDATE = "worker_update"


class ACPToolKind(str, Enum):
    READ = "read"
    EDIT = "edit"
    DELETE = "delete"
    MOVE = "move"
    SEARCH = "search"
    EXECUTE = "execute"
    THINK = "think"
    FETCH = "fetch"
    OTHER = "other"


class ACPToolCallStatus(str, Enum):
    PENDING = "pending"
    IN_PROGRESS = "in_progress"
    COMPLETED = "completed"
    FAILED = "failed"


class HarnToolCallErrorCategory(str, Enum):
    SCHEMA_VALIDATION = "schema_validation"
    TOOL_ERROR = "tool_error"
    MCP_SERVER_ERROR = "mcp_server_error"
    HOST_BRIDGE_ERROR = "host_bridge_error"
    PERMISSION_DENIED = "permission_denied"
    REJECTED_LOOP = "rejected_loop"
    PARSE_ABORTED = "parse_aborted"
    TIMEOUT = "timeout"
    NETWORK = "network"
    CANCELLED = "cancelled"
    UNKNOWN = "unknown"


class HarnSideEffectLevel(str, Enum):
    NONE = "none"
    READ_ONLY = "read_only"
    WORKSPACE_WRITE = "workspace_write"
    PROCESS_EXEC = "process_exec"
    NETWORK = "network"


class HarnWorkerStatus(str, Enum):
    RUNNING = "running"
    PROGRESSED = "progressed"
    AWAITING_INPUT = "awaiting_input"
    SUSPENDED = "suspended"
    COMPLETED = "completed"
    FAILED = "failed"
    STOPPED = "stopped"
    CANCELLED = "cancelled"


class ToolCallReceiptStatus(str, Enum):
    OK = "ok"
    SCHEMA_VIOLATION = "schema_violation"
    CONSENT_DENIED = "consent_denied"
    TIMEOUT = "timeout"
    ERROR = "error"


class ToolCallReceiptExecutor(str, Enum):
    HARN = "harn"
    HOST_BRIDGE = "host_bridge"
    MCP_SERVER = "mcp_server"
    PROVIDER_NATIVE = "provider_native"


class A2ATaskState(str, Enum):
    SUBMITTED = "submitted"
    WORKING = "working"
    COMPLETED = "completed"
    FAILED = "failed"
    CANCELED = "canceled"
    CANCELLED = "cancelled"
    INPUT_REQUIRED = "input-required"
    REJECTED = "rejected"
    AUTH_REQUIRED = "auth-required"


class A2ATaskEventType(str, Enum):
    STATUS = "status"
    MESSAGE = "message"
    WORKER_UPDATE = "worker_update"


class MCPCacheScope(str, Enum):
    PRIVATE = "private"
    PUBLIC = "public"


class MCPResultType(str, Enum):
    COMPLETE = "complete"
    INPUT_REQUIRED = "input_required"


class MCPLoggingLevel(str, Enum):
    DEBUG = "debug"
    INFO = "info"
    NOTICE = "notice"
    WARNING = "warning"
    ERROR = "error"
    CRITICAL = "critical"
    ALERT = "alert"
    EMERGENCY = "emergency"


JsonValue = Union[None, bool, int, float, str, List[Any], Dict[str, Any]]
JsonObject = Dict[str, JsonValue]
JsonRpcId = Union[int, str, None]


_T = TypeVar("_T", bound="_HarnDataclass")


class _HarnDataclass:
    """Mixin providing wire-faithful ``to_wire`` / ``from_wire`` helpers.

    ``to_wire`` strips fields that are ``None`` so the JSON envelope stays
    minimal and matches what the Rust adapters emit. ``from_wire`` accepts a
    decoded JSON object plus any unknown extension fields, ignoring keys
    that the static schema does not yet know about so additive enum or
    struct extensions stay forward-compatible.
    """

    @classmethod
    def from_wire(cls: Type[_T], data: Mapping[str, Any]) -> _T:
        if not isinstance(data, Mapping):
            raise TypeError(f"{cls.__name__}.from_wire expected a mapping, got {type(data).__name__}")
        accepted = {f.name for f in fields(cls)}  # type: ignore[arg-type]
        kwargs = {key: value for key, value in data.items() if key in accepted}
        return cls(**kwargs)

    def to_wire(self) -> JsonObject:
        if not is_dataclass(self):
            raise TypeError("to_wire requires a dataclass instance")
        return _strip_none(asdict(self))


def _strip_none(value: Any) -> Any:
    if isinstance(value, dict):
        return {key: _strip_none(item) for key, item in value.items() if item is not None}
    if isinstance(value, list):
        return [_strip_none(item) for item in value]
    if isinstance(value, Enum):
        return value.value
    return value


@dataclass
class ACPError(_HarnDataclass):
    code: int
    message: str
    data: Optional[JsonValue] = None


@dataclass
class ACPRequest(_HarnDataclass):
    id: JsonRpcId
    method: str
    params: Optional[JsonValue] = None
    jsonrpc: str = "2.0"


@dataclass
class ACPResponse(_HarnDataclass):
    id: JsonRpcId
    result: Optional[JsonValue] = None
    error: Optional[ACPError] = None
    jsonrpc: str = "2.0"


@dataclass
class ACPNotification(_HarnDataclass):
    method: str
    params: Optional[JsonValue] = None
    jsonrpc: str = "2.0"


ACPMessage = Union[ACPRequest, ACPResponse, ACPNotification]


def is_request(message: Mapping[str, Any]) -> bool:
    return "id" in message and "method" in message


def is_response(message: Mapping[str, Any]) -> bool:
    return "id" in message and "method" not in message


def is_notification(message: Mapping[str, Any]) -> bool:
    return "id" not in message and "method" in message


@dataclass
class HarnExtensionMeta(_HarnDataclass):
    harn: Optional[JsonObject] = None


@dataclass
class ACPContentBlock(_HarnDataclass):
    type: str
    text: Optional[str] = None
    _meta: Optional[HarnExtensionMeta] = None


@dataclass
class HarnToolLifecycleMeta(_HarnDataclass):
    audit: Optional[JsonValue] = None
    durationMs: Optional[float] = None
    error: Optional[str] = None
    errorCategory: Optional[str] = None
    executionDurationMs: Optional[float] = None
    executor: Optional[JsonValue] = None
    parsing: Optional[bool] = None
    rawInputPartial: Optional[str] = None


@dataclass
class ToolCallReceipt(_HarnDataclass):
    schema_version: int
    session_id: str
    tool_call_id: str
    tool_name: str
    iteration: int
    emit_order: int
    status: str
    duration_ms: int
    args_hash: str
    audit: JsonValue
    emitted_at: str
    run_id: Optional[str] = None
    turn_index: Optional[int] = None
    reason: Optional[str] = None
    kind: Optional[str] = None
    executor: Optional[str] = None
    error_category: Optional[str] = None
    result_hash: Optional[str] = None
    model: Optional[str] = None
    provider: Optional[str] = None

    def to_wire(self) -> JsonObject:
        return asdict(self)


@dataclass
class ACPToolCall(_HarnDataclass):
    sessionUpdate: str
    toolCallId: str
    title: str
    kind: Optional[str] = None
    status: Optional[str] = None
    content: Optional[List[ACPContentBlock]] = None
    locations: Optional[List[JsonValue]] = None
    rawInput: Optional[JsonValue] = None
    rawOutput: Optional[JsonValue] = None
    _meta: Optional[HarnExtensionMeta] = None


@dataclass
class ACPToolCallUpdate(_HarnDataclass):
    sessionUpdate: str
    toolCallId: str
    title: Optional[str] = None
    kind: Optional[str] = None
    status: Optional[str] = None
    content: Optional[List[ACPContentBlock]] = None
    locations: Optional[List[JsonValue]] = None
    rawInput: Optional[JsonValue] = None
    rawOutput: Optional[JsonValue] = None
    _meta: Optional[HarnExtensionMeta] = None


@dataclass
class ACPSessionUpdateEnvelope(_HarnDataclass):
    sessionUpdate: str
    content: Optional[JsonValue] = None
    messageId: Optional[str] = None
    entries: Optional[List[JsonValue]] = None
    keptTurnCount: Optional[int] = None
    removedTurnCount: Optional[int] = None
    newTipTurnId: Optional[str] = None
    reason: Optional[str] = None
    toolCallId: Optional[str] = None
    title: Optional[str] = None
    kind: Optional[str] = None
    status: Optional[str] = None
    rawInput: Optional[JsonValue] = None
    rawOutput: Optional[JsonValue] = None
    _meta: Optional[HarnExtensionMeta] = None


@dataclass
class ACPSessionUpdateParams(_HarnDataclass):
    sessionId: str
    update: ACPSessionUpdateEnvelope


@dataclass
class ACPSessionUpdateNotification(_HarnDataclass):
    params: ACPSessionUpdateParams
    method: str = "session/update"
    jsonrpc: str = "2.0"


@dataclass
class HarnAgentEventNotification(_HarnDataclass):
    params: JsonObject
    method: str = HARN_AGENT_EVENT_METHOD
    jsonrpc: str = "2.0"


@dataclass
class HarnToolArgSchema(_HarnDataclass):
    path_params: List[str] = field(default_factory=list)
    arg_aliases: Dict[str, str] = field(default_factory=dict)
    required: List[str] = field(default_factory=list)


@dataclass
class HarnToolAnnotations(_HarnDataclass):
    kind: str
    side_effect_level: str
    arg_schema: HarnToolArgSchema
    capabilities: Dict[str, List[str]] = field(default_factory=dict)
    emits_artifacts: bool = False
    result_readers: List[str] = field(default_factory=list)
    inline_result: bool = False


@dataclass
class A2AMessage(_HarnDataclass):
    id: str
    role: str
    parts: List[JsonValue] = field(default_factory=list)


@dataclass
class A2ATaskStatus(_HarnDataclass):
    state: str
    message: Optional[A2AMessage] = None
    timestamp: Optional[str] = None


@dataclass
class A2ATask(_HarnDataclass):
    id: str
    status: A2ATaskStatus
    contextId: Optional[str] = None
    history: Optional[List[A2AMessage]] = None
    artifacts: Optional[List[JsonValue]] = None
    metadata: Optional[JsonObject] = None


MCPJsonSchema202012 = JsonObject
MCPRequestMeta = JsonObject
MCPHTTPHeaders = Dict[str, str]


@dataclass
class MCPImplementation(_HarnDataclass):
    name: str
    version: str
    title: Optional[str] = None
    description: Optional[str] = None
    websiteUrl: Optional[str] = None


@dataclass
class MCPCacheHints(_HarnDataclass):
    ttlMs: int
    cacheScope: str


@dataclass
class MCPDiscoverResult(_HarnDataclass):
    resultType: str
    supportedVersions: List[str]
    capabilities: JsonObject
    serverInfo: MCPImplementation
    instructions: Optional[str] = None
    _meta: Optional[JsonObject] = None


@dataclass
class MCPInputRequiredResult(_HarnDataclass):
    resultType: str
    inputRequests: Optional[JsonObject] = None
    requestState: Optional[str] = None
    _meta: Optional[JsonObject] = None


@dataclass
class MCPUnsupportedProtocolVersionErrorData(_HarnDataclass):
    requested: str
    supported: List[str]


@dataclass
class MCPUnsupportedProtocolVersionError(_HarnDataclass):
    error: ACPError
    id: JsonRpcId = None
    jsonrpc: str = "2.0"


@dataclass
class MCPTool(_HarnDataclass):
    name: str
    inputSchema: MCPJsonSchema202012
    title: Optional[str] = None
    description: Optional[str] = None
    outputSchema: Optional[MCPJsonSchema202012] = None
    annotations: Optional[JsonObject] = None


@dataclass
class MCPResource(_HarnDataclass):
    uri: str
    name: str
    title: Optional[str] = None
    description: Optional[str] = None
    mimeType: Optional[str] = None


@dataclass
class MCPResourceTemplate(_HarnDataclass):
    uriTemplate: str
    name: str
    title: Optional[str] = None
    description: Optional[str] = None
    mimeType: Optional[str] = None


@dataclass
class MCPPrompt(_HarnDataclass):
    name: str
    title: Optional[str] = None
    description: Optional[str] = None
    arguments: Optional[List[JsonObject]] = None
