refactor(agent): unify request context routing

This commit is contained in:
chengyongru authored and Xubin Ren committed 2026-07-10 17:54:34 +08:00
1 parent bb3b449e09
commit 42d7ad34a4
20 files changed
+363 -423

No files matched your search

-6
View File
@@ -32,7 +32,6 @@ class AgentTurnHookSpec:
session_key: str | None = None
workspace: Path | None = None
tool_hint_max_length: int = 40
set_tool_context: Callable[..., None] | None = None
on_iteration: Callable[[int], None] | None = None
registered_hook_factories: list[AgentTurnHookFactory] = field(default_factory=list)
turn_hook_factories: list[AgentTurnHookFactory] = field(default_factory=list)
@@ -48,13 +47,8 @@ def build_agent_turn_hook(spec: AgentTurnHookSpec) -> AgentHook:
on_progress=spec.on_progress,
on_stream=spec.on_stream,
on_stream_end=spec.on_stream_end,
channel=spec.channel,
chat_id=spec.chat_id,
message_id=spec.message_id,
metadata=spec.metadata,
session_key=spec.session_key,
tool_hint_max_length=spec.tool_hint_max_length,
set_tool_context=spec.set_tool_context,
on_iteration=spec.on_iteration,
)
if spec.ephemeral and not spec.run_extra_hooks_for_ephemeral: