feat: 事件异常主账起停等待接口

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-21 18:21:03 +08:00
co-authored by Cursor
parent 9e27bada94
commit 1bab19f1a2
4 changed files with 241 additions and 0 deletions
@@ -103,6 +103,33 @@ class TestMentions(unittest.TestCase):
self.assertEqual(conversation_of(wait_kind=WAIT_DEAL, collab_chat_id=""), "private")
class TestMemoryEventWait(unittest.TestCase):
def test_same_kind_keeps_start(self) -> None:
from agent.ledger.memory_ledger import MemoryLedger
book = MemoryLedger()
created = book.create_ticket(sender_id="s1", business_line="SEA", facts={"运输分类": "其他"})
wo = created["work_order_no"]
book.start_event_wait(work_order_no=wo, wait_kind="product_quote")
first = book.get_ticket(work_order_no=wo).event_wait_started_at
book.start_event_wait(work_order_no=wo, wait_kind="product_quote")
self.assertEqual(book.get_ticket(work_order_no=wo).event_wait_started_at, first)
def test_record_appends_and_alerts(self) -> None:
from agent.ledger.memory_ledger import MemoryLedger
book = MemoryLedger()
created = book.create_ticket(sender_id="s1", business_line="AIR", facts={})
wo = created["work_order_no"]
book.start_event_wait(work_order_no=wo, wait_kind="air_quote")
book.record_event_exception(work_order_no=wo, event_exception="航线响应超时")
book.record_event_exception(work_order_no=wo, event_exception="销售响应超时")
t = book.get_ticket(work_order_no=wo)
self.assertEqual(t.event_exception, "航线响应超时;销售响应超时")
self.assertEqual(t.event_wait_alerted, 1)
self.assertEqual(book.list_event_waits(), [])
class TestEventExceptionCopy(unittest.TestCase):
def test_group_air(self) -> None:
text = copy.event_exception_session_text(