feat: route workflow image inputs natively

This commit is contained in:
Xin Wang
2026-08-03 10:55:57 +08:00
parent 2e84de0798
commit f3439b21d1
10 changed files with 412 additions and 33 deletions

View File

@@ -166,11 +166,18 @@ class BaseBrain:
def record_user_message(self, content: str) -> None:
"""Observe a committed user message for brain-owned routing state."""
async def on_user_turn_end(self, content: str) -> bool:
async def on_user_turn_end(
self,
content: str,
user_message: dict[str, Any] | None = None,
) -> bool:
"""Handle a complete user turn before the conversational LLM runs.
Return True when the brain scheduled the next action itself and the
in-flight context frame must not reach the previous Agent's LLM.
``user_message`` preserves the current universal-context message for
brains that need multimodal routing. Text-only brains can ignore it.
"""
self.record_user_message(content)
return False
@@ -222,7 +229,11 @@ class Brain(Protocol):
def record_user_message(self, content: str) -> None: ...
async def on_user_turn_end(self, content: str) -> bool: ...
async def on_user_turn_end(
self,
content: str,
user_message: dict[str, Any] | None = None,
) -> bool: ...
async def on_assistant_text_start(self, turn_id: str) -> None: ...