feat(events): widen content type to str|dict in all store backends

Allow event content to be a dict (for structured OpenAI-format messages)
in addition to plain strings. Dict values are JSON-serialized for the DB
backend and deserialized on read; memory and JSONL backends handle dicts
natively. Trace truncation now serializes dicts to JSON before measuring.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
rayhpeng
2026-04-04 08:49:25 +08:00
parent b92ddafd4b
commit 17eb509dbd
5 changed files with 106 additions and 9 deletions
@@ -33,7 +33,7 @@ class RunEventStore(abc.ABC):
run_id: str,
event_type: str,
category: str,
content: str = "",
content: str | dict = "",
metadata: dict | None = None,
created_at: str | None = None,
) -> dict: