chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 12:39:17 +08:00
commit 4ed4e9ff99
1368 changed files with 334957 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
try:
from agents.voice import StreamedAudioResult
except ImportError:
pass
async def extract_events(result: StreamedAudioResult) -> tuple[list[str], list[bytes]]:
"""Collapse pipeline stream events to simple labels for ordering assertions."""
flattened: list[str] = []
audio_chunks: list[bytes] = []
async for ev in result.stream():
if ev.type == "voice_stream_event_audio":
if ev.data is not None:
audio_chunks.append(ev.data.tobytes())
flattened.append("audio")
elif ev.type == "voice_stream_event_lifecycle":
flattened.append(ev.event)
elif ev.type == "voice_stream_event_error":
flattened.append("error")
return flattened, audio_chunks