Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions sdk/src/openagents/mods/workspace/messaging/mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -2258,28 +2258,26 @@ def _extract_text_from_event(self, event: Event) -> str:
return ""

def _extract_content_from_event(self, event: Event) -> Dict[str, Any]:
"""Extract full content (text and files) from an Event object's payload.
"""Extract message content from an Event object's payload.

This handles the nested content structure: payload.content
This preserves all fields in the nested payload.content mapping, such
as text, files, schema, embeds, actions, and custom extension fields,
while ensuring the returned dict always has a text key.

Args:
event: The Event object to extract content from

Returns:
Dict with text and optionally files
Dict containing all payload.content fields plus a guaranteed text field
"""
if not event or not event.payload:
return {"text": ""}

# Handle nested content structure (payload.content)
if "content" in event.payload and isinstance(event.payload["content"], dict):
content = event.payload["content"]
result = {"text": content.get("text", "")}

# Include files if present
if "files" in content and content["files"]:
result["files"] = content["files"]

result = dict(content)
result["text"] = result.get("text", "")
return result
else:
return {"text": ""}
Expand Down
Loading
Loading