feat: add a required first-token event to the transport port

Transport.complete gains the keyword-only first_token_event (no default,
per the port convention): streaming sets it on the first delta, the
non-streaming path accepts it but never sets it, None means the caller
does not observe the first token. All fake/wrapping transports and the
three direct call sites follow the signature; the e2e wrapper forwards.

Red-green evidence: tests/outputs/137/t1/ (batch A TypeError red, then
147 file tests + 1550 unit tests green).
This commit is contained in:
2026-09-10 13:16:38 -04:00
parent 166b2865d0
commit 0a6d6225db
12 changed files with 114 additions and 9 deletions
+3
View File
@@ -1,5 +1,6 @@
"""测试侧独立 HTTP 取证装配;无环境自读取或成功 SSE 预读。"""
import asyncio
from collections.abc import AsyncIterator, Iterator, Mapping
from contextlib import AsyncExitStack, asynccontextmanager, contextmanager
from contextvars import ContextVar
@@ -290,6 +291,7 @@ class ObservedTransport:
overlay: dict[str, Any],
call_id: str,
reasoning_effort: Effort | None,
first_token_event: asyncio.Event | None,
) -> TransportResult:
"""与生产端口逐参数同签名。"""
with self._capture.attempt_context(call_id):
@@ -301,6 +303,7 @@ class ObservedTransport:
overlay=overlay,
call_id=call_id,
reasoning_effort=reasoning_effort,
first_token_event=first_token_event,
)
async def embed(