Anchor generated attachments to assistant messages

Deliverables now inherit the active assistant draft message ID so clients can render them beside the reply that produced them.
This commit is contained in:
2026-09-09 06:54:56 +00:00
parent 5725d635b2
commit 6be1601ccd
3 changed files with 17 additions and 2 deletions
+8
View File
@@ -28,6 +28,7 @@ if str(_PLUGIN_DIR) not in sys.path:
from pheby import protocol as proto # noqa: E402
from pheby.attachments import AttachmentStore, constant_time_equals # noqa: E402
from pheby.adapter import PhebyAdapter # noqa: E402
from pheby.config import load_config # noqa: E402
from pheby.conversations import ConversationRouter # noqa: E402
from pheby.server import PhebyServer # noqa: E402
@@ -344,6 +345,13 @@ class TestConversations:
# Attachments
# ═══════════════════════════════════════════════════════════════════════════
class TestAttachments:
def test_adapter_anchors_deliverable_to_active_assistant_draft(self):
adapter = object.__new__(PhebyAdapter)
adapter._drafts = {"conv": {"message_id": "draft-run-1", "text": ""}}
assert adapter._active_assistant_message_id("conv") == "draft-run-1"
assert adapter._active_assistant_message_id("unknown") is None
@pytest.mark.asyncio
async def test_register_describe_download_path(self, tmp_path):
src = Path(tmp_path) / "report.pdf"