diff --git a/crates/protocol/tests/parity_protocol.rs b/crates/protocol/tests/parity_protocol.rs index 0b6f082d..1a05026e 100644 --- a/crates/protocol/tests/parity_protocol.rs +++ b/crates/protocol/tests/parity_protocol.rs @@ -64,6 +64,7 @@ fn runtime_event_envelope_roundtrip() { "turn_id": "turn_456", "item_id": "item_789", "timestamp": "2026-02-11T20:18:49.123Z", + "created_at": "2026-02-11T20:18:49.123Z", "payload": { "delta": "ok", "kind": "agent_message" }, }); let envelope: RuntimeEventEnvelope = @@ -76,7 +77,17 @@ fn runtime_event_envelope_roundtrip() { let encoded = serde_json::to_value(&envelope).expect("serialize runtime event envelope"); assert_eq!(encoded["event"], encoded["kind"]); + assert_eq!(encoded["schema_version"], 1); assert_eq!(encoded["seq"], 12); + assert_eq!(encoded["thread_id"], "thr_123"); + assert_eq!(encoded["turn_id"], "turn_456"); + assert_eq!(encoded["item_id"], "item_789"); + assert_eq!(encoded["timestamp"], "2026-02-11T20:18:49.123Z"); + assert_eq!(encoded["created_at"], "2026-02-11T20:18:49.123Z"); + assert_eq!( + encoded["payload"], + json!({ "delta": "ok", "kind": "agent_message" }) + ); } #[test] diff --git a/crates/tui/src/runtime_api.rs b/crates/tui/src/runtime_api.rs index 4eb3aff5..1b8d9fff 100644 --- a/crates/tui/src/runtime_api.rs +++ b/crates/tui/src/runtime_api.rs @@ -2779,7 +2779,6 @@ mod tests { seq_b > seq_a, "expected seq after cursor: {seq_b} <= {seq_a}" ); - assert_eq!(payload_b["thread_id"], thread_id); handle.abort(); Ok(()) diff --git a/docs/RUNTIME_API.md b/docs/RUNTIME_API.md index 8e5d5b2e..d57960bd 100644 --- a/docs/RUNTIME_API.md +++ b/docs/RUNTIME_API.md @@ -314,8 +314,9 @@ Compatibility notes: - `kind` mirrors `event` in the stable envelope for typed clients. - `thread.started`, `turn.started`, and `turn.completed` are emitted as SSE event names exactly as before. -- `created_at` is currently a duplicate of `timestamp` (`timestamp` is the existing - canonical field). +- `timestamp` remains the canonical event time for schema version 1. `created_at` + is an equivalent alias for clients that use `created_at` naming elsewhere; do + not require both fields to be present. Common event names: `thread.started`, `thread.forked`, `turn.started`, `turn.lifecycle`, `turn.steered`, `turn.interrupt_requested`,