fix(sdk): harden host integration contracts

This commit is contained in:
chengyongru
2026-07-28 15:30:28 +08:00
committed by Xubin Ren
parent c050955ae3
commit fd17c1352a
7 changed files with 119 additions and 22 deletions
+17
View File
@@ -14,6 +14,23 @@ class RecordingHook(AgentHook):
self._events.append(f"{self._label}:{context.iteration}")
def test_turn_hook_context_preserves_legacy_positional_arguments(tmp_path) -> None:
context = AgentTurnHookContext(
None,
tmp_path,
"sdk",
"chat-a",
"message-1",
"sdk:chat-a",
{"trusted": True},
True,
)
assert context.metadata == {"trusted": True}
assert context.ephemeral is True
assert context.attributes == {}
@pytest.mark.asyncio
async def test_turn_hook_builder_runs_progress_hook_before_extra_hooks() -> None:
events: list[str] = []