fix(plugin-runtime): surface detailed send failures for plugin tools

This commit is contained in:
Losita
2026-05-12 22:02:15 +08:00
parent fd50f33662
commit 702316ae57
4 changed files with 380 additions and 9 deletions

View File

@@ -284,6 +284,22 @@ async def test_text_to_stream_returns_false_when_platform_io_fails(monkeypatch:
assert len(fake_manager.sent_messages) == 1
@pytest.mark.asyncio
async def test_custom_to_stream_detailed_raises_stream_not_found(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(
send_service._chat_manager,
"get_session_by_session_id",
lambda stream_id: None,
)
with pytest.raises(send_service.SendServiceError, match="未找到聊天流: group_chat"):
await send_service.custom_to_stream_detailed(
message_type="poke",
content={"qq_id": "2810873701"},
stream_id="group_chat",
)
@pytest.mark.asyncio
async def test_private_outbound_message_preserves_bot_sender_and_receiver_user(
monkeypatch: pytest.MonkeyPatch,