落地并存测服全端:智能体 Graph/路由、后台切 8180、主账与部署脚本齐备,便于线上重发与验收。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
"""
|
||||
消息账本协议:inbox / outbox 认领接口。
|
||||
|
||||
Memory 与 Postgres 实现共用此协议,通道运行时不依赖具体后端。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Optional, Protocol
|
||||
|
||||
from agent.channel.queue import InboxItem, OutboxItem
|
||||
from agent.channel.wecom.models import InboundMessage
|
||||
|
||||
|
||||
class MessageStore(Protocol):
|
||||
"""inbox/outbox 账本协议。"""
|
||||
|
||||
def enqueue_inbound(self, message: InboundMessage) -> tuple[bool, str]: ...
|
||||
|
||||
def claim_inbound(self) -> Optional[InboxItem]: ...
|
||||
|
||||
def complete_inbound(self, item_id: str, *, error: str = "") -> None: ...
|
||||
|
||||
def enqueue_outbound(
|
||||
self,
|
||||
*,
|
||||
touser: str,
|
||||
content: str,
|
||||
dedupe_key: str = "",
|
||||
) -> tuple[bool, str]: ...
|
||||
|
||||
def claim_outbound(self) -> Optional[OutboxItem]: ...
|
||||
|
||||
def complete_outbound(
|
||||
self, item_id: str, *, error: str = "", permanent: bool = False
|
||||
) -> None: ...
|
||||
|
||||
def wait_inbox(self, timeout: float = 1.0) -> None: ...
|
||||
|
||||
def wait_outbox(self, timeout: float = 1.0) -> None: ...
|
||||
|
||||
def stats(self) -> dict[str, Any]: ...
|
||||
Reference in New Issue
Block a user