"""Agent 运行时端口。

实际 LangChain/DeepSeek 实现在 ``app.harness.kernel``，领域服务只依赖此协议。
"""

from typing import Protocol

from zbt.core.errors import AppError
from zbt.harness.kernel import AgentInvocation
from zbt.harness.schemas import AgentReply

__all__ = [
    "AgentInvocation",
    "AgentReply",
    "AgentRuntime",
    "UnavailableAgentRuntime",
]


class AgentRuntime(Protocol):
    def reply(self, invocation: AgentInvocation) -> AgentReply: ...


class UnavailableAgentRuntime:
    def reply(self, invocation: AgentInvocation) -> AgentReply:
        del invocation
        raise AppError(
            "AGENT_NOT_CONFIGURED",
            "DeepSeek尚未配置，无法启动智能体",
            503,
            retryable=False,
        )
