mirror of
https://github.com/openai/codex.git
synced 2026-10-29 19:08:43 +00:00
## Summary Foundation PR only (base for PR #3). This PR contains the SDK runtime foundation and generated artifacts: - pinned runtime binary in `sdk/python/bin/` (`codex` or `codex.exe` by platform) - single maintenance script: `sdk/python/scripts/update_sdk_artifacts.py` - generated protocol/types artifacts under: - `sdk/python/src/codex_app_server/generated/protocol_types.py` - `sdk/python/src/codex_app_server/generated/schema_types.py` - `sdk/python/src/codex_app_server/generated/v2_all/*` - generation-contract test wiring (`tests/test_contract_generation.py`) ## Release asset behavior `update_sdk_artifacts.py` now: - selects latest release by channel (`--channel stable|alpha`) - resolves the correct asset for current OS/arch - extracts platform binary (`codex` on macOS/Linux, `codex.exe` on Windows) - keeps runtime on single pinned binary source in `sdk/python/bin/` ## Scope boundary - ✅ PR #2 = binary + generation pipeline + generated types foundation - ❌ PR #2 does **not** include examples/integration logic polish (that is PR #3) ## Validation - Ran: `python scripts/update_sdk_artifacts.py --channel stable` - Regenerated and committed resulting generated artifacts - Local tests pass on branch
98 lines
2.8 KiB
Python
98 lines
2.8 KiB
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from typing import TypeAlias
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from .generated.v2_all import (
|
|
AccountLoginCompletedNotification,
|
|
AccountRateLimitsUpdatedNotification,
|
|
AccountUpdatedNotification,
|
|
AgentMessageDeltaNotification,
|
|
AppListUpdatedNotification,
|
|
CommandExecutionOutputDeltaNotification,
|
|
ConfigWarningNotification,
|
|
ContextCompactedNotification,
|
|
DeprecationNoticeNotification,
|
|
ErrorNotification,
|
|
FileChangeOutputDeltaNotification,
|
|
ItemCompletedNotification,
|
|
ItemStartedNotification,
|
|
McpServerOauthLoginCompletedNotification,
|
|
McpToolCallProgressNotification,
|
|
PlanDeltaNotification,
|
|
RawResponseItemCompletedNotification,
|
|
ReasoningSummaryPartAddedNotification,
|
|
ReasoningSummaryTextDeltaNotification,
|
|
ReasoningTextDeltaNotification,
|
|
TerminalInteractionNotification,
|
|
ThreadNameUpdatedNotification,
|
|
ThreadStartedNotification,
|
|
ThreadTokenUsageUpdatedNotification,
|
|
TurnCompletedNotification,
|
|
TurnDiffUpdatedNotification,
|
|
TurnPlanUpdatedNotification,
|
|
TurnStartedNotification,
|
|
WindowsWorldWritableWarningNotification,
|
|
)
|
|
|
|
JsonScalar: TypeAlias = str | int | float | bool | None
|
|
JsonValue: TypeAlias = JsonScalar | dict[str, "JsonValue"] | list["JsonValue"]
|
|
JsonObject: TypeAlias = dict[str, JsonValue]
|
|
|
|
|
|
@dataclass(slots=True)
|
|
class UnknownNotification:
|
|
params: JsonObject
|
|
|
|
|
|
NotificationPayload: TypeAlias = (
|
|
AccountLoginCompletedNotification
|
|
| AccountRateLimitsUpdatedNotification
|
|
| AccountUpdatedNotification
|
|
| AgentMessageDeltaNotification
|
|
| AppListUpdatedNotification
|
|
| CommandExecutionOutputDeltaNotification
|
|
| ConfigWarningNotification
|
|
| ContextCompactedNotification
|
|
| DeprecationNoticeNotification
|
|
| ErrorNotification
|
|
| FileChangeOutputDeltaNotification
|
|
| ItemCompletedNotification
|
|
| ItemStartedNotification
|
|
| McpServerOauthLoginCompletedNotification
|
|
| McpToolCallProgressNotification
|
|
| PlanDeltaNotification
|
|
| RawResponseItemCompletedNotification
|
|
| ReasoningSummaryPartAddedNotification
|
|
| ReasoningSummaryTextDeltaNotification
|
|
| ReasoningTextDeltaNotification
|
|
| TerminalInteractionNotification
|
|
| ThreadNameUpdatedNotification
|
|
| ThreadStartedNotification
|
|
| ThreadTokenUsageUpdatedNotification
|
|
| TurnCompletedNotification
|
|
| TurnDiffUpdatedNotification
|
|
| TurnPlanUpdatedNotification
|
|
| TurnStartedNotification
|
|
| WindowsWorldWritableWarningNotification
|
|
| UnknownNotification
|
|
)
|
|
|
|
|
|
@dataclass(slots=True)
|
|
class Notification:
|
|
method: str
|
|
payload: NotificationPayload
|
|
|
|
|
|
class ServerInfo(BaseModel):
|
|
name: str | None = None
|
|
version: str | None = None
|
|
|
|
|
|
class InitializeResponse(BaseModel):
|
|
serverInfo: ServerInfo | None = None
|
|
userAgent: str | None = None
|