Add on_client_ready method to BaseBrain and WorkflowBrain

- Implement on_client_ready in BaseBrain to handle client-visible state after the app message channel is ready.
- Extend WorkflowBrain with on_client_ready to replay state that may have been emitted before WebRTC data was ready.
- Update pipeline to call on_client_ready when a client connects.
- Enhance tests to verify the correct behavior of on_client_ready in WorkflowBrain.
This commit is contained in:
Xin Wang
2026-07-14 11:20:18 +08:00
parent f74040adf3
commit 2d6ff5b7aa
4 changed files with 48 additions and 0 deletions

View File

@@ -86,6 +86,9 @@ class BaseBrain:
async def on_connected(self) -> None:
"""Handle a connected client after the common greeting is queued."""
async def on_client_ready(self) -> None:
"""Replay client-visible state after its app message channel is ready."""
def record_user_message(self, content: str) -> None:
"""Observe a committed user message for brain-owned routing state."""
@@ -126,6 +129,8 @@ class Brain(Protocol):
async def on_connected(self) -> None: ...
async def on_client_ready(self) -> None: ...
def record_user_message(self, content: str) -> None: ...
async def on_user_turn_end(self, content: str) -> bool: ...