python-sdk: rename turn wrapper handles (2026-03-16)

Rename the public SDK wrapper objects from Turn/AsyncTurn to TurnHandle/AsyncTurnHandle so the wrapper control object is clearly distinct from the canonical generated app-server Turn model.

Update the top-level exports, public API docs, runtime behavior test coverage, and the Python SDK codegen helper so future generated method signatures preserve the new wrapper names.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Shaqayeq
2026-03-16 14:54:00 -07:00
parent d864b8c836
commit 5e7154df5e
7 changed files with 36 additions and 31 deletions

View File

@@ -40,7 +40,7 @@ from .models import InitializeResponse
from .public_api import (
AsyncCodex,
AsyncThread,
AsyncTurn,
AsyncTurnHandle,
Codex,
ImageInput,
Input,
@@ -50,7 +50,7 @@ from .public_api import (
SkillInput,
TextInput,
Thread,
Turn,
TurnHandle,
)
from .retry import retry_on_overload
@@ -65,8 +65,8 @@ __all__ = [
"AsyncCodex",
"Thread",
"AsyncThread",
"Turn",
"AsyncTurn",
"TurnHandle",
"AsyncTurnHandle",
"InitializeResponse",
"Input",
"InputItem",

View File

@@ -490,7 +490,7 @@ class Thread:
sandbox_policy: SandboxPolicy | None = None,
service_tier: ServiceTier | None = None,
summary: ReasoningSummary | None = None,
) -> Turn:
) -> TurnHandle:
wire_input = _to_wire_input(input)
params = TurnStartParams(
thread_id=self.id,
@@ -506,7 +506,7 @@ class Thread:
summary=summary,
)
turn = self._client.turn_start(self.id, wire_input, params=params)
return Turn(self._client, self.id, turn.turn.id)
return TurnHandle(self._client, self.id, turn.turn.id)
# END GENERATED: Thread.flat_methods
def read(self, *, include_turns: bool = False) -> ThreadReadResponse:
@@ -538,7 +538,7 @@ class AsyncThread:
sandbox_policy: SandboxPolicy | None = None,
service_tier: ServiceTier | None = None,
summary: ReasoningSummary | None = None,
) -> AsyncTurn:
) -> AsyncTurnHandle:
await self._codex._ensure_initialized()
wire_input = _to_wire_input(input)
params = TurnStartParams(
@@ -559,7 +559,7 @@ class AsyncThread:
wire_input,
params=params,
)
return AsyncTurn(self._codex, self.id, turn.turn.id)
return AsyncTurnHandle(self._codex, self.id, turn.turn.id)
# END GENERATED: AsyncThread.flat_methods
async def read(self, *, include_turns: bool = False) -> ThreadReadResponse:
@@ -576,7 +576,7 @@ class AsyncThread:
@dataclass(slots=True)
class Turn:
class TurnHandle:
_client: AppServerClient
thread_id: str
id: str
@@ -620,7 +620,7 @@ class Turn:
@dataclass(slots=True)
class AsyncTurn:
class AsyncTurnHandle:
_codex: AsyncCodex
thread_id: str
id: str